From 4ce00a32f4a8a11ac942e5b031d71b1dd584d461 Mon Sep 17 00:00:00 2001 From: Lincoln Stein Date: Tue, 3 Oct 2023 08:48:50 -0400 Subject: [PATCH 01/31] add font Inter-Regular.ttf to installed assets --- invokeai/app/invocations/facetools.py | 7 ++++--- pyproject.toml | 6 +++--- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/invokeai/app/invocations/facetools.py b/invokeai/app/invocations/facetools.py index f02e4d476a..53b4602a5b 100644 --- a/invokeai/app/invocations/facetools.py +++ b/invokeai/app/invocations/facetools.py @@ -11,6 +11,7 @@ from PIL import Image, ImageDraw, ImageFilter, ImageFont, ImageOps from PIL.Image import Image as ImageType from pydantic import validator +import invokeai.assets.fonts as font_assets from invokeai.app.invocations.baseinvocation import ( BaseInvocation, InputField, @@ -641,9 +642,9 @@ class FaceIdentifierInvocation(BaseInvocation): draw_mesh=False, ) - path = Path(__file__).resolve().parent.parent.parent - font_path = os.path.abspath(path / "assets/fonts/inter/Inter-Regular.ttf") - font = ImageFont.truetype(font_path, FONT_SIZE) + # Note - font may be found either in the repo if running an editable install, or in the venv if running a package install + font_path = [x for x in [Path(y, "inter/Inter-Regular.ttf") for y in font_assets.__path__] if x.exists()] + font = ImageFont.truetype(font_path[0].as_posix(), FONT_SIZE) # Paste face IDs on the output image draw = ImageDraw.Draw(image) diff --git a/pyproject.toml b/pyproject.toml index 21cda5eebd..da9dccd71d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -161,16 +161,16 @@ version = { attr = "invokeai.version.__version__" } [tool.setuptools.packages.find] "where" = ["."] "include" = [ - "invokeai.assets.web*","invokeai.version*", + "invokeai.assets.fonts*","invokeai.version*", "invokeai.generator*","invokeai.backend*", "invokeai.frontend*", "invokeai.frontend.web.dist*", "invokeai.frontend.web.static*", "invokeai.configs*", - "invokeai.app*","ldm*", + "invokeai.app*", ] [tool.setuptools.package-data] -"invokeai.assets.web" = ["**.png","**.js","**.woff2","**.css"] +"invokeai.assets.fonts" = ["**/*.ttf"] "invokeai.backend" = ["**.png"] "invokeai.configs" = ["*.example", "**/*.yaml", "*.txt"] "invokeai.frontend.web.dist" = ["**"] From 920c5dd68691447251997544829bc2f842b9d025 Mon Sep 17 00:00:00 2001 From: Lincoln Stein Date: Tue, 3 Oct 2023 08:53:47 -0400 Subject: [PATCH 02/31] remove unneeded os import --- invokeai/app/invocations/facetools.py | 1 - 1 file changed, 1 deletion(-) diff --git a/invokeai/app/invocations/facetools.py b/invokeai/app/invocations/facetools.py index 53b4602a5b..b13f0e81cc 100644 --- a/invokeai/app/invocations/facetools.py +++ b/invokeai/app/invocations/facetools.py @@ -1,5 +1,4 @@ import math -import os import re from pathlib import Path from typing import Optional, TypedDict From 24d73d484a4f5d960a983bf70b410b9ebf0f6a78 Mon Sep 17 00:00:00 2001 From: Mary Hipp Date: Tue, 3 Oct 2023 13:28:15 -0400 Subject: [PATCH 03/31] IP adapter UI --- .../components/ipAdapter/IPAdapterPanel.tsx | 40 ++++++++++++++++--- .../ipAdapter/ParamIPAdapterImage.tsx | 3 +- .../ipAdapter/ParamIPAdapterModelSelect.tsx | 23 ++++++++++- 3 files changed, 59 insertions(+), 7 deletions(-) diff --git a/invokeai/frontend/web/src/features/controlNet/components/ipAdapter/IPAdapterPanel.tsx b/invokeai/frontend/web/src/features/controlNet/components/ipAdapter/IPAdapterPanel.tsx index b0a1fcc731..fa269fefdc 100644 --- a/invokeai/frontend/web/src/features/controlNet/components/ipAdapter/IPAdapterPanel.tsx +++ b/invokeai/frontend/web/src/features/controlNet/components/ipAdapter/IPAdapterPanel.tsx @@ -5,8 +5,23 @@ import ParamIPAdapterFeatureToggle from './ParamIPAdapterFeatureToggle'; import ParamIPAdapterImage from './ParamIPAdapterImage'; import ParamIPAdapterModelSelect from './ParamIPAdapterModelSelect'; import ParamIPAdapterWeight from './ParamIPAdapterWeight'; +import { createSelector } from '@reduxjs/toolkit'; +import { stateSelector } from '../../../../app/store/store'; +import { defaultSelectorOptions } from '../../../../app/store/util/defaultMemoizeOptions'; +import { useAppSelector } from '../../../../app/store/storeHooks'; + +const selector = createSelector( + stateSelector, + (state) => { + const { isIPAdapterEnabled } = state.controlNet; + + return { isIPAdapterEnabled }; + }, + defaultSelectorOptions +); const IPAdapterPanel = () => { + const { isIPAdapterEnabled } = useAppSelector(selector); return ( { gap: 3, paddingInline: 3, paddingBlock: 2, - paddingBottom: 5, borderRadius: 'base', position: 'relative', bg: 'base.250', @@ -24,10 +38,26 @@ const IPAdapterPanel = () => { }} > - - - - + {isIPAdapterEnabled && ( + <> + + + + + + + + + + )} ); }; diff --git a/invokeai/frontend/web/src/features/controlNet/components/ipAdapter/ParamIPAdapterImage.tsx b/invokeai/frontend/web/src/features/controlNet/components/ipAdapter/ParamIPAdapterImage.tsx index 9c5087d297..b8e3bdbae0 100644 --- a/invokeai/frontend/web/src/features/controlNet/components/ipAdapter/ParamIPAdapterImage.tsx +++ b/invokeai/frontend/web/src/features/controlNet/components/ipAdapter/ParamIPAdapterImage.tsx @@ -66,7 +66,8 @@ const ParamIPAdapterImage = () => { layerStyle="second" sx={{ position: 'relative', - w: 'full', + h: 28, + w: 28, alignItems: 'center', justifyContent: 'center', aspectRatio: '1/1', diff --git a/invokeai/frontend/web/src/features/controlNet/components/ipAdapter/ParamIPAdapterModelSelect.tsx b/invokeai/frontend/web/src/features/controlNet/components/ipAdapter/ParamIPAdapterModelSelect.tsx index 8fb738d025..4cf2352f6a 100644 --- a/invokeai/frontend/web/src/features/controlNet/components/ipAdapter/ParamIPAdapterModelSelect.tsx +++ b/invokeai/frontend/web/src/features/controlNet/components/ipAdapter/ParamIPAdapterModelSelect.tsx @@ -6,7 +6,7 @@ import { ipAdapterModelChanged } from 'features/controlNet/store/controlNetSlice import { MODEL_TYPE_MAP } from 'features/parameters/types/constants'; import { modelIdToIPAdapterModelParam } from 'features/parameters/util/modelIdToIPAdapterModelParams'; import { forEach } from 'lodash-es'; -import { memo, useCallback, useMemo } from 'react'; +import { memo, useCallback, useEffect, useMemo } from 'react'; import { useTranslation } from 'react-i18next'; import { useGetIPAdapterModelsQuery } from 'services/api/endpoints/models'; @@ -24,6 +24,27 @@ const ParamIPAdapterModelSelect = () => { const { data: ipAdapterModels } = useGetIPAdapterModelsQuery(); + const firstModel = useMemo(() => { + if (!ipAdapterModels || !Object.keys(ipAdapterModels.entities).length) { + return undefined; + } + const firstModelId = Object.keys(ipAdapterModels.entities)[0]; + + if (!firstModelId) { + return undefined; + } + + const firstModel = ipAdapterModels.entities[firstModelId]; + + return firstModel ? firstModel : undefined; + }, [ipAdapterModels]); + + useEffect(() => { + if (firstModel) { + dispatch(ipAdapterModelChanged(firstModel)); + } + }, [firstModel, dispatch]); + // grab the full model entity from the RTK Query cache const selectedModel = useMemo( () => From 069d8b581234daebcc84bc5e9b4112ee0c1617ef Mon Sep 17 00:00:00 2001 From: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed, 4 Oct 2023 08:37:51 +1100 Subject: [PATCH 04/31] feat(ui): move initial IP adapter model selection to listener --- invokeai/frontend/web/public/locales/en.json | 2 +- .../listeners/modelsLoaded.ts | 51 ++++++++++++++++++- .../ipAdapter/ParamIPAdapterModelSelect.tsx | 33 +++--------- 3 files changed, 59 insertions(+), 27 deletions(-) diff --git a/invokeai/frontend/web/public/locales/en.json b/invokeai/frontend/web/public/locales/en.json index 34e4dd79d6..b635db997a 100644 --- a/invokeai/frontend/web/public/locales/en.json +++ b/invokeai/frontend/web/public/locales/en.json @@ -697,7 +697,7 @@ "noLoRAsAvailable": "No LoRAs available", "noMatchingLoRAs": "No matching LoRAs", "noMatchingModels": "No matching Models", - "noModelsAvailable": "No Modelss available", + "noModelsAvailable": "No models available", "selectLoRA": "Select a LoRA", "selectModel": "Select a Model" }, diff --git a/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/modelsLoaded.ts b/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/modelsLoaded.ts index 4d30ee3b8b..e7dc4e9291 100644 --- a/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/modelsLoaded.ts +++ b/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/modelsLoaded.ts @@ -1,5 +1,8 @@ import { logger } from 'app/logging/logger'; -import { controlNetRemoved } from 'features/controlNet/store/controlNetSlice'; +import { + controlNetRemoved, + ipAdapterModelChanged, +} from 'features/controlNet/store/controlNetSlice'; import { loraRemoved } from 'features/lora/store/loraSlice'; import { modelChanged, @@ -16,12 +19,14 @@ import { } from 'features/sdxl/store/sdxlSlice'; import { forEach, some } from 'lodash-es'; import { + ipAdapterModelsAdapter, mainModelsAdapter, modelsApi, vaeModelsAdapter, } from 'services/api/endpoints/models'; import { TypeGuardFor } from 'services/api/types'; import { startAppListening } from '..'; +import { zIPAdapterModel } from 'features/nodes/types/types'; export const addModelsLoadedListener = () => { startAppListening({ @@ -234,6 +239,50 @@ export const addModelsLoadedListener = () => { }); }, }); + startAppListening({ + matcher: modelsApi.endpoints.getIPAdapterModels.matchFulfilled, + effect: async (action, { getState, dispatch }) => { + // ControlNet models loaded - need to remove missing ControlNets from state + const log = logger('models'); + log.info( + { models: action.payload.entities }, + `IP Adapter models loaded (${action.payload.ids.length})` + ); + + const { model } = getState().controlNet.ipAdapterInfo; + + const isModelAvailable = some( + action.payload.entities, + (m) => + m?.model_name === model?.model_name && + m?.base_model === model?.base_model + ); + + if (isModelAvailable) { + return; + } + + const firstModel = ipAdapterModelsAdapter + .getSelectors() + .selectAll(action.payload)[0]; + + if (!firstModel) { + dispatch(ipAdapterModelChanged(null)); + } + + const result = zIPAdapterModel.safeParse(firstModel); + + if (!result.success) { + log.error( + { error: result.error.format() }, + 'Failed to parse IP Adapter model' + ); + return; + } + + dispatch(ipAdapterModelChanged(result.data)); + }, + }); startAppListening({ matcher: modelsApi.endpoints.getTextualInversionModels.matchFulfilled, effect: async (action) => { diff --git a/invokeai/frontend/web/src/features/controlNet/components/ipAdapter/ParamIPAdapterModelSelect.tsx b/invokeai/frontend/web/src/features/controlNet/components/ipAdapter/ParamIPAdapterModelSelect.tsx index 4cf2352f6a..d164cb1208 100644 --- a/invokeai/frontend/web/src/features/controlNet/components/ipAdapter/ParamIPAdapterModelSelect.tsx +++ b/invokeai/frontend/web/src/features/controlNet/components/ipAdapter/ParamIPAdapterModelSelect.tsx @@ -6,7 +6,7 @@ import { ipAdapterModelChanged } from 'features/controlNet/store/controlNetSlice import { MODEL_TYPE_MAP } from 'features/parameters/types/constants'; import { modelIdToIPAdapterModelParam } from 'features/parameters/util/modelIdToIPAdapterModelParams'; import { forEach } from 'lodash-es'; -import { memo, useCallback, useEffect, useMemo } from 'react'; +import { memo, useCallback, useMemo } from 'react'; import { useTranslation } from 'react-i18next'; import { useGetIPAdapterModelsQuery } from 'services/api/endpoints/models'; @@ -24,27 +24,6 @@ const ParamIPAdapterModelSelect = () => { const { data: ipAdapterModels } = useGetIPAdapterModelsQuery(); - const firstModel = useMemo(() => { - if (!ipAdapterModels || !Object.keys(ipAdapterModels.entities).length) { - return undefined; - } - const firstModelId = Object.keys(ipAdapterModels.entities)[0]; - - if (!firstModelId) { - return undefined; - } - - const firstModel = ipAdapterModels.entities[firstModelId]; - - return firstModel ? firstModel : undefined; - }, [ipAdapterModels]); - - useEffect(() => { - if (firstModel) { - dispatch(ipAdapterModelChanged(firstModel)); - } - }, [firstModel, dispatch]); - // grab the full model entity from the RTK Query cache const selectedModel = useMemo( () => @@ -109,12 +88,16 @@ const ParamIPAdapterModelSelect = () => { className="nowheel nodrag" tooltip={selectedModel?.description} value={selectedModel?.id ?? null} - placeholder="Pick one" - error={!selectedModel} + placeholder={ + data.length > 0 + ? t('models.selectModel') + : t('models.noModelsAvailable') + } + error={!selectedModel && data.length > 0} data={data} onChange={handleValueChanged} sx={{ width: '100%' }} - disabled={!isEnabled} + disabled={!isEnabled || data.length === 0} /> ); }; From f4ba7be9189b0c35ed772c291a6b7105a93b747d Mon Sep 17 00:00:00 2001 From: Mary Hipp Date: Tue, 3 Oct 2023 12:05:07 -0400 Subject: [PATCH 05/31] refetch baord list when image is starred or unstarred --- .../frontend/web/src/services/api/endpoints/images.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/invokeai/frontend/web/src/services/api/endpoints/images.ts b/invokeai/frontend/web/src/services/api/endpoints/images.ts index e653a6ec3e..239dfaa982 100644 --- a/invokeai/frontend/web/src/services/api/endpoints/images.ts +++ b/invokeai/frontend/web/src/services/api/endpoints/images.ts @@ -473,6 +473,7 @@ export const imagesApi = api.injectEndpoints({ if (images[0]) { const categories = getCategories(images[0]); const boardId = images[0].board_id; + return [ { type: 'ImageList', @@ -481,6 +482,10 @@ export const imagesApi = api.injectEndpoints({ categories, }), }, + { + type: 'Board', + id: boardId, + }, ]; } return []; @@ -595,6 +600,10 @@ export const imagesApi = api.injectEndpoints({ categories, }), }, + { + type: 'Board', + id: boardId, + }, ]; } return []; From 5a1019d8589ef7ae72bf2039ef6ec3de29bfb573 Mon Sep 17 00:00:00 2001 From: maryhipp Date: Tue, 3 Oct 2023 12:08:00 -0400 Subject: [PATCH 06/31] sort by starred and then created_at to get board cover image --- invokeai/app/services/image_record_storage.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/invokeai/app/services/image_record_storage.py b/invokeai/app/services/image_record_storage.py index f743fd1fe2..21afcaf0bf 100644 --- a/invokeai/app/services/image_record_storage.py +++ b/invokeai/app/services/image_record_storage.py @@ -584,7 +584,7 @@ class SqliteImageRecordStorage(ImageRecordStorageBase): FROM images JOIN board_images ON images.image_name = board_images.image_name WHERE board_images.board_id = ? - ORDER BY images.created_at DESC + ORDER BY images.starred DESC, images.created_at DESC LIMIT 1; """, (board_id,), From 67366921c0688597fc88dc3f20f41d6f1ba989d4 Mon Sep 17 00:00:00 2001 From: ymgenesis Date: Tue, 3 Oct 2023 18:05:09 +0200 Subject: [PATCH 07/31] add checkbounds bool - don't check bounds on first detection before chunking, allows larger faces to be detected --- invokeai/app/invocations/facetools.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/invokeai/app/invocations/facetools.py b/invokeai/app/invocations/facetools.py index b13f0e81cc..7965b69619 100644 --- a/invokeai/app/invocations/facetools.py +++ b/invokeai/app/invocations/facetools.py @@ -138,6 +138,7 @@ def generate_face_box_mask( chunk_x_offset: int = 0, chunk_y_offset: int = 0, draw_mesh: bool = True, + check_bounds: bool = True, ) -> list[FaceResultData]: result = [] mask_pil = None @@ -217,7 +218,7 @@ def generate_face_box_mask( im_width, im_height = pil_image.size over_w = im_width * 0.1 over_h = im_height * 0.1 - if ( + if not check_bounds or ( (left_side >= -over_w) and (right_side < im_width + over_w) and (top_side >= -over_h) @@ -345,6 +346,7 @@ def get_faces_list( chunk_x_offset=0, chunk_y_offset=0, draw_mesh=draw_mesh, + check_bounds=False, ) if should_chunk or len(result) == 0: context.services.logger.info("FaceTools --> Chunking image (chunk toggled on, or no face found in full image).") From dedead672f2e9f995b6b96d7ada37456dab15b55 Mon Sep 17 00:00:00 2001 From: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed, 4 Oct 2023 09:27:13 +1100 Subject: [PATCH 08/31] chore(facetools): bump node patch versions The helper function `generate_face_box_mask()` had a bug that prevented larger faces from being detected in some situations. This is resolved, and its dependent nodes (all the FaceTools nodes) have a patch version bump. --- invokeai/app/invocations/facetools.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/invokeai/app/invocations/facetools.py b/invokeai/app/invocations/facetools.py index 7965b69619..7926f76ce2 100644 --- a/invokeai/app/invocations/facetools.py +++ b/invokeai/app/invocations/facetools.py @@ -404,7 +404,7 @@ def get_faces_list( return all_faces -@invocation("face_off", title="FaceOff", tags=["image", "faceoff", "face", "mask"], category="image", version="1.0.0") +@invocation("face_off", title="FaceOff", tags=["image", "faceoff", "face", "mask"], category="image", version="1.0.1") class FaceOffInvocation(BaseInvocation): """Bound, extract, and mask a face from an image using MediaPipe detection""" @@ -498,7 +498,7 @@ class FaceOffInvocation(BaseInvocation): return output -@invocation("face_mask_detection", title="FaceMask", tags=["image", "face", "mask"], category="image", version="1.0.0") +@invocation("face_mask_detection", title="FaceMask", tags=["image", "face", "mask"], category="image", version="1.0.1") class FaceMaskInvocation(BaseInvocation): """Face mask creation using mediapipe face detection""" @@ -616,7 +616,7 @@ class FaceMaskInvocation(BaseInvocation): @invocation( - "face_identifier", title="FaceIdentifier", tags=["image", "face", "identifier"], category="image", version="1.0.0" + "face_identifier", title="FaceIdentifier", tags=["image", "face", "identifier"], category="image", version="1.0.1" ) class FaceIdentifierInvocation(BaseInvocation): """Outputs an image with detected face IDs printed on each face. For use with other FaceTools.""" From 3a586fc9c4f04b1df349a03b115718a6d2004623 Mon Sep 17 00:00:00 2001 From: Millun Atluri Date: Wed, 4 Oct 2023 17:36:35 +1100 Subject: [PATCH 09/31] Prevent caching to ensure updated UI is shown --- invokeai/frontend/web/index.html | 3 +++ 1 file changed, 3 insertions(+) diff --git a/invokeai/frontend/web/index.html b/invokeai/frontend/web/index.html index 04d81e5490..627b07d481 100644 --- a/invokeai/frontend/web/index.html +++ b/invokeai/frontend/web/index.html @@ -3,6 +3,9 @@ + + + InvokeAI - A Stable Diffusion Toolkit - + diff --git a/invokeai/frontend/web/dist/locales/en.json b/invokeai/frontend/web/dist/locales/en.json index 34e4dd79d6..b635db997a 100644 --- a/invokeai/frontend/web/dist/locales/en.json +++ b/invokeai/frontend/web/dist/locales/en.json @@ -697,7 +697,7 @@ "noLoRAsAvailable": "No LoRAs available", "noMatchingLoRAs": "No matching LoRAs", "noMatchingModels": "No matching Models", - "noModelsAvailable": "No Modelss available", + "noModelsAvailable": "No models available", "selectLoRA": "Select a LoRA", "selectModel": "Select a Model" }, From fbb61f2334ee8e8919f1b16eeafa0115392ae3b3 Mon Sep 17 00:00:00 2001 From: Millun Atluri Date: Wed, 4 Oct 2023 19:48:09 +1100 Subject: [PATCH 11/31] Revert "Updated js files" This reverts commit a0e936f3a79c11e2397e3726e7089af648c8bdd3. --- .../{App-eaffaaa1.js => App-ba2d118a.js} | 30 +++++------ ...3f4942b.js => MantineProvider-a057bfc9.js} | 2 +- ...448.js => ThemeLocaleProvider-632b3401.js} | 2 +- .../{index-285abe50.js => index-94062f76.js} | 54 +++++++++---------- invokeai/frontend/web/dist/index.html | 5 +- invokeai/frontend/web/dist/locales/en.json | 2 +- 6 files changed, 46 insertions(+), 49 deletions(-) rename invokeai/frontend/web/dist/assets/{App-eaffaaa1.js => App-ba2d118a.js} (78%) rename invokeai/frontend/web/dist/assets/{MantineProvider-23f4942b.js => MantineProvider-a057bfc9.js} (99%) rename invokeai/frontend/web/dist/assets/{ThemeLocaleProvider-d93a1448.js => ThemeLocaleProvider-632b3401.js} (99%) rename invokeai/frontend/web/dist/assets/{index-285abe50.js => index-94062f76.js} (50%) diff --git a/invokeai/frontend/web/dist/assets/App-eaffaaa1.js b/invokeai/frontend/web/dist/assets/App-ba2d118a.js similarity index 78% rename from invokeai/frontend/web/dist/assets/App-eaffaaa1.js rename to invokeai/frontend/web/dist/assets/App-ba2d118a.js index d6654534ed..6ab7aae3d7 100644 --- a/invokeai/frontend/web/dist/assets/App-eaffaaa1.js +++ b/invokeai/frontend/web/dist/assets/App-ba2d118a.js @@ -1,6 +1,6 @@ -import{a as Dc,b as W_,S as U_,c as G_,d as K_,e as o1,f as q_,i as s1,g as vR,h as xR,j as bR,k as yR,l as X_,m as CR,n as YC,o as Q_,t as wR,p as SR,q as kR,r as jR,s as _R,u as IR,v as d,w as a,x as $x,y as qp,z as PR,A as ER,B as MR,C as OR,P as RR,D as Lx,E as DR,F as AR,G as TR,H as NR,I as Y_,J as je,K as Tn,L as $R,M as LR,N as zR,O as Wt,Q as we,R as Ye,T as un,U as He,V as vd,W as dr,X as In,Y as Un,Z as on,_ as fa,$ as oi,a0 as dt,a1 as Co,a2 as rc,a3 as pa,a4 as ma,a5 as ph,a6 as zx,a7 as xd,a8 as pn,a9 as FR,aa as H,ab as ZC,ac as BR,ad as Z_,ae as a1,af as bd,ag as Ac,ah as HR,ai as J_,aj as eI,ak as tI,al as Ho,am as VR,an as le,ao as xe,ap as Ft,aq as W,ar as WR,as as JC,at as UR,au as GR,av as KR,aw as el,ax as te,ay as qR,az as ct,aA as Qt,aB as Ie,aC as L,aD as cr,aE as Jn,aF as Se,aG as Z,aH as nI,aI as XR,aJ as QR,aK as YR,aL as ZR,aM as qr,aN as Fx,aO as ha,aP as Nr,aQ as yd,aR as JR,aS as eD,aT as ew,aU as Bx,aV as ve,aW as Xr,aX as tD,aY as rI,aZ as oI,a_ as tw,a$ as nD,b0 as rD,b1 as oD,b2 as ga,b3 as Hx,b4 as yt,b5 as sD,b6 as aD,b7 as sI,b8 as aI,b9 as mh,ba as iD,bb as nw,bc as iI,bd as lD,be as cD,bf as uD,bg as dD,bh as fD,bi as pD,bj as mD,bk as lI,bl as hD,bm as gD,bn as vD,bo as xD,bp as bD,bq as va,br as vc,bs as yD,bt as $r,bu as CD,bv as wD,bw as SD,bx as rw,by as kD,bz as jD,bA as Zs,bB as hh,bC as cI,bD as uI,bE as to,bF as dI,bG as _D,bH as Fi,bI as Mu,bJ as ow,bK as ID,bL as PD,bM as ED,bN as qf,bO as Xf,bP as bu,bQ as Q0,bR as Nu,bS as $u,bT as Lu,bU as zu,bV as sw,bW as Xp,bX as Y0,bY as Qp,bZ as aw,b_ as i1,b$ as Z0,c0 as l1,c1 as J0,c2 as Yp,c3 as iw,c4 as Bi,c5 as lw,c6 as Hi,c7 as cw,c8 as Zp,c9 as Cd,ca as MD,cb as fI,cc as uw,cd as gh,ce as OD,cf as c1,cg as dw,ch as Fr,ci as Ta,cj as fw,ck as Vx,cl as RD,cm as DD,cn as ev,co as pw,cp as u1,cq as vh,cr as AD,cs as pI,ct as d1,cu as f1,cv as mI,cw as TD,cx as p1,cy as ND,cz as m1,cA as $D,cB as h1,cC as LD,cD as zD,cE as FD,cF as Wx,cG as Ux,cH as Gx,cI as Kx,cJ as qx,cK as xh,cL as Xx,cM as Xs,cN as hI,cO as gI,cP as Qx,cQ as vI,cR as BD,cS as yu,cT as sa,cU as xI,cV as bI,cW as mw,cX as Yx,cY as yI,cZ as Zx,c_ as Jx,c$ as CI,d0 as Mn,d1 as HD,d2 as $n,d3 as bh,d4 as eb,d5 as wI,d6 as SI,d7 as VD,d8 as WD,d9 as UD,da as GD,db as KD,dc as qD,dd as XD,de as QD,df as YD,dg as ZD,dh as hw,di as tb,dj as JD,dk as eA,dl as wd,dm as tA,dn as nA,dp as yh,dq as rA,dr as oA,ds as sA,dt as aA,du as mn,dv as iA,dw as lA,dx as cA,dy as uA,dz as dA,dA as fA,dB as Ku,dC as gw,dD as Xo,dE as kI,dF as pA,dG as nb,dH as mA,dI as vw,dJ as hA,dK as gA,dL as vA,dM as jI,dN as xA,dO as bA,dP as yA,dQ as CA,dR as _I,dS as wA,dT as SA,dU as xw,dV as kA,dW as jA,dX as _A,dY as IA,dZ as PA,d_ as EA,d$ as MA,e0 as II,e1 as OA,e2 as RA,e3 as DA,e4 as bw,e5 as Qf,e6 as PI,e7 as AA,e8 as TA,e9 as NA,ea as $A,eb as LA,ec as Vo,ed as zA,ee as FA,ef as BA,eg as HA,eh as VA,ei as WA,ej as UA,ek as GA,el as KA,em as qA,en as XA,eo as QA,ep as YA,eq as ZA,er as JA,es as eT,et as yw,eu as tT,ev as nT,ew as rT,ex as oT,ey as sT,ez as aT,eA as iT,eB as Cw,eC as ww,eD as EI,eE as lT,eF as zo,eG as qu,eH as wr,eI as cT,eJ as uT,eK as MI,eL as OI,eM as dT,eN as Sw,eO as fT,eP as kw,eQ as jw,eR as _w,eS as pT,eT as mT,eU as Iw,eV as Pw,eW as hT,eX as gT,eY as Jp,eZ as vT,e_ as Ew,e$ as Mw,f0 as xT,f1 as bT,f2 as yT,f3 as RI,f4 as CT,f5 as wT,f6 as DI,f7 as ST,f8 as kT,f9 as Ow,fa as jT,fb as Rw,fc as _T,fd as AI,fe as TI,ff as Sd,fg as NI,fh as Pi,fi as $I,fj as Dw,fk as IT,fl as PT,fm as LI,fn as ET,fo as MT,fp as OT,fq as RT,fr as DT,fs as rb,ft as g1,fu as Aw,fv as tl,fw as AT,fx as TT,fy as NT,fz as zI,fA as ob,fB as FI,fC as sb,fD as BI,fE as $T,fF as Ys,fG as LT,fH as HI,fI as zT,fJ as ab,fK as VI,fL as FT,fM as BT,fN as HT,fO as VT,fP as WT,fQ as UT,fR as GT,fS as em,fT as Ou,fU as Ql,fV as KT,fW as qT,fX as XT,fY as QT,fZ as YT,f_ as ZT,f$ as JT,g0 as eN,g1 as Tw,g2 as tN,g3 as nN,g4 as rN,g5 as oN,g6 as sN,g7 as aN,g8 as Nw,g9 as iN,ga as lN,gb as cN,gc as uN,gd as dN,ge as fN,gf as pN,gg as $w,gh as mN,gi as hN,gj as gN,gk as vN,gl as xN,gm as bN,gn as yN,go as CN,gp as wN,gq as SN,gr as kN,gs as jN,gt as _N,gu as IN,gv as kd,gw as PN,gx as EN,gy as MN,gz as ON,gA as RN,gB as DN,gC as AN,gD as TN,gE as Lw,gF as Tp,gG as NN,gH as tm,gI as WI,gJ as nm,gK as $N,gL as LN,gM as oc,gN as UI,gO as GI,gP as ib,gQ as zN,gR as FN,gS as BN,gT as v1,gU as KI,gV as HN,gW as VN,gX as qI,gY as WN,gZ as UN,g_ as GN,g$ as KN,h0 as qN,h1 as zw,h2 as Ml,h3 as XN,h4 as QN,h5 as YN,h6 as ZN,h7 as JN,h8 as e9,h9 as Fw,ha as t9,hb as n9,hc as r9,hd as o9,he as s9,hf as a9,hg as i9,hh as l9,hi as tv,hj as nv,hk as rv,hl as Yf,hm as Bw,hn as x1,ho as Hw,hp as c9,hq as u9,hr as d9,hs as f9,ht as XI,hu as p9,hv as m9,hw as h9,hx as g9,hy as v9,hz as x9,hA as b9,hB as y9,hC as C9,hD as w9,hE as S9,hF as Zf,hG as ov,hH as k9,hI as j9,hJ as _9,hK as I9,hL as P9,hM as E9,hN as M9,hO as O9,hP as R9,hQ as D9,hR as Vw,hS as Ww,hT as A9,hU as T9,hV as N9,hW as $9,hX as L9}from"./index-285abe50.js";import{u as QI,a as xa,b as z9,r as Re,f as F9,g as Uw,c as mt,d as Rn}from"./MantineProvider-23f4942b.js";var B9=200;function H9(e,t,n,r){var o=-1,s=G_,i=!0,l=e.length,u=[],p=t.length;if(!l)return u;n&&(t=Dc(t,W_(n))),r?(s=K_,i=!1):t.length>=B9&&(s=o1,i=!1,t=new U_(t));e:for(;++o=120&&m.length>=120)?new U_(i&&m):void 0}m=e[0];var h=-1,g=l[0];e:for(;++h{r.has(s)&&n(o,s)})}function r$(e,t){if(e==null)return{};var n={},r=Object.keys(e),o,s;for(s=0;s=0)&&(n[o]=e[o]);return n}const YI=({id:e,x:t,y:n,width:r,height:o,style:s,color:i,strokeColor:l,strokeWidth:u,className:p,borderRadius:m,shapeRendering:h,onClick:g,selected:x})=>{const{background:y,backgroundColor:b}=s||{},w=i||y||b;return a.jsx("rect",{className:$x(["react-flow__minimap-node",{selected:x},p]),x:t,y:n,rx:m,ry:m,width:r,height:o,fill:w,stroke:l,strokeWidth:u,shapeRendering:h,onClick:g?S=>g(S,e):void 0})};YI.displayName="MiniMapNode";var o$=d.memo(YI);const s$=e=>e.nodeOrigin,a$=e=>e.getNodes().filter(t=>!t.hidden&&t.width&&t.height),sv=e=>e instanceof Function?e:()=>e;function i$({nodeStrokeColor:e="transparent",nodeColor:t="#e2e2e2",nodeClassName:n="",nodeBorderRadius:r=5,nodeStrokeWidth:o=2,nodeComponent:s=o$,onClick:i}){const l=qp(a$,Lx),u=qp(s$),p=sv(t),m=sv(e),h=sv(n),g=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return a.jsx(a.Fragment,{children:l.map(x=>{const{x:y,y:b}=PR(x,u).positionAbsolute;return a.jsx(s,{x:y,y:b,width:x.width,height:x.height,style:x.style,selected:x.selected,className:h(x),color:p(x),borderRadius:r,strokeColor:m(x),strokeWidth:o,shapeRendering:g,onClick:i,id:x.id},x.id)})})}var l$=d.memo(i$);const c$=200,u$=150,d$=e=>{const t=e.getNodes(),n={x:-e.transform[0]/e.transform[2],y:-e.transform[1]/e.transform[2],width:e.width/e.transform[2],height:e.height/e.transform[2]};return{viewBB:n,boundingRect:t.length>0?TR(NR(t,e.nodeOrigin),n):n,rfId:e.rfId}},f$="react-flow__minimap-desc";function ZI({style:e,className:t,nodeStrokeColor:n="transparent",nodeColor:r="#e2e2e2",nodeClassName:o="",nodeBorderRadius:s=5,nodeStrokeWidth:i=2,nodeComponent:l,maskColor:u="rgb(240, 240, 240, 0.6)",maskStrokeColor:p="none",maskStrokeWidth:m=1,position:h="bottom-right",onClick:g,onNodeClick:x,pannable:y=!1,zoomable:b=!1,ariaLabel:w="React Flow mini map",inversePan:S=!1,zoomStep:j=10,offsetScale:_=5}){const E=ER(),I=d.useRef(null),{boundingRect:M,viewBB:R,rfId:D}=qp(d$,Lx),A=(e==null?void 0:e.width)??c$,O=(e==null?void 0:e.height)??u$,T=M.width/A,X=M.height/O,B=Math.max(T,X),V=B*A,U=B*O,N=_*B,$=M.x-(V-M.width)/2-N,q=M.y-(U-M.height)/2-N,F=V+N*2,Q=U+N*2,Y=`${f$}-${D}`,se=d.useRef(0);se.current=B,d.useEffect(()=>{if(I.current){const G=MR(I.current),K=J=>{const{transform:ie,d3Selection:de,d3Zoom:ge}=E.getState();if(J.sourceEvent.type!=="wheel"||!de||!ge)return;const Ce=-J.sourceEvent.deltaY*(J.sourceEvent.deltaMode===1?.05:J.sourceEvent.deltaMode?1:.002)*j,he=ie[2]*Math.pow(2,Ce);ge.scaleTo(de,he)},ee=J=>{const{transform:ie,d3Selection:de,d3Zoom:ge,translateExtent:Ce,width:he,height:fe}=E.getState();if(J.sourceEvent.type!=="mousemove"||!de||!ge)return;const Oe=se.current*Math.max(1,ie[2])*(S?-1:1),_e={x:ie[0]-J.sourceEvent.movementX*Oe,y:ie[1]-J.sourceEvent.movementY*Oe},Ne=[[0,0],[he,fe]],nt=DR.translate(_e.x,_e.y).scale(ie[2]),$e=ge.constrain()(nt,Ne,Ce);ge.transform(de,$e)},ce=OR().on("zoom",y?ee:null).on("zoom.wheel",b?K:null);return G.call(ce),()=>{G.on("zoom",null)}}},[y,b,S,j]);const ae=g?G=>{const K=AR(G);g(G,{x:K[0],y:K[1]})}:void 0,re=x?(G,K)=>{const ee=E.getState().nodeInternals.get(K);x(G,ee)}:void 0;return a.jsx(RR,{position:h,style:e,className:$x(["react-flow__minimap",t]),"data-testid":"rf__minimap",children:a.jsxs("svg",{width:A,height:O,viewBox:`${$} ${q} ${F} ${Q}`,role:"img","aria-labelledby":Y,ref:I,onClick:ae,children:[w&&a.jsx("title",{id:Y,children:w}),a.jsx(l$,{onClick:re,nodeColor:r,nodeStrokeColor:n,nodeBorderRadius:s,nodeClassName:o,nodeStrokeWidth:i,nodeComponent:l}),a.jsx("path",{className:"react-flow__minimap-mask",d:`M${$-N},${q-N}h${F+N*2}v${Q+N*2}h${-F-N*2}z - M${R.x},${R.y}h${R.width}v${R.height}h${-R.width}z`,fill:u,fillRule:"evenodd",stroke:p,strokeWidth:m,pointerEvents:"none"})]})})}ZI.displayName="MiniMap";var p$=d.memo(ZI),Wo;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(Wo||(Wo={}));function m$({color:e,dimensions:t,lineWidth:n}){return a.jsx("path",{stroke:e,strokeWidth:n,d:`M${t[0]/2} 0 V${t[1]} M0 ${t[1]/2} H${t[0]}`})}function h$({color:e,radius:t}){return a.jsx("circle",{cx:t,cy:t,r:t,fill:e})}const g$={[Wo.Dots]:"#91919a",[Wo.Lines]:"#eee",[Wo.Cross]:"#e2e2e2"},v$={[Wo.Dots]:1,[Wo.Lines]:1,[Wo.Cross]:6},x$=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function JI({id:e,variant:t=Wo.Dots,gap:n=20,size:r,lineWidth:o=1,offset:s=2,color:i,style:l,className:u}){const p=d.useRef(null),{transform:m,patternId:h}=qp(x$,Lx),g=i||g$[t],x=r||v$[t],y=t===Wo.Dots,b=t===Wo.Cross,w=Array.isArray(n)?n:[n,n],S=[w[0]*m[2]||1,w[1]*m[2]||1],j=x*m[2],_=b?[j,j]:S,E=y?[j/s,j/s]:[_[0]/s,_[1]/s];return a.jsxs("svg",{className:$x(["react-flow__background",u]),style:{...l,position:"absolute",width:"100%",height:"100%",top:0,left:0},ref:p,"data-testid":"rf__background",children:[a.jsx("pattern",{id:h+e,x:m[0]%S[0],y:m[1]%S[1],width:S[0],height:S[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${E[0]},-${E[1]})`,children:y?a.jsx(h$,{color:g,radius:j/s}):a.jsx(m$,{dimensions:_,color:g,lineWidth:o})}),a.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${h+e})`})]})}JI.displayName="Background";var b$=d.memo(JI);const qw=(e,t,n)=>{y$(n);const r=Y_(e,t);return e5[n].includes(r)},e5={">":[1],">=":[0,1],"=":[0],"<=":[-1,0],"<":[-1],"!=":[-1,1]},Xw=Object.keys(e5),y$=e=>{if(typeof e!="string")throw new TypeError(`Invalid operator type, expected string but got ${typeof e}`);if(Xw.indexOf(e)===-1)throw new Error(`Invalid operator, expected one of ${Xw.join("|")}`)};function C$(){return!!(typeof window<"u"&&window.document&&window.document.createElement)}var w$=C$();const t5=1/60*1e3,S$=typeof performance<"u"?()=>performance.now():()=>Date.now(),n5=typeof window<"u"?e=>window.requestAnimationFrame(e):e=>setTimeout(()=>e(S$()),t5);function k$(e){let t=[],n=[],r=0,o=!1,s=!1;const i=new WeakSet,l={schedule:(u,p=!1,m=!1)=>{const h=m&&o,g=h?t:n;return p&&i.add(u),g.indexOf(u)===-1&&(g.push(u),h&&o&&(r=t.length)),u},cancel:u=>{const p=n.indexOf(u);p!==-1&&n.splice(p,1),i.delete(u)},process:u=>{if(o){s=!0;return}if(o=!0,[t,n]=[n,t],n.length=0,r=t.length,r)for(let p=0;p(e[t]=k$(()=>Xu=!0),e),{}),_$=jd.reduce((e,t)=>{const n=Ch[t];return e[t]=(r,o=!1,s=!1)=>(Xu||E$(),n.schedule(r,o,s)),e},{}),I$=jd.reduce((e,t)=>(e[t]=Ch[t].cancel,e),{});jd.reduce((e,t)=>(e[t]=()=>Ch[t].process(sc),e),{});const P$=e=>Ch[e].process(sc),r5=e=>{Xu=!1,sc.delta=b1?t5:Math.max(Math.min(e-sc.timestamp,j$),1),sc.timestamp=e,y1=!0,jd.forEach(P$),y1=!1,Xu&&(b1=!1,n5(r5))},E$=()=>{Xu=!0,b1=!0,y1||n5(r5)},Qw=()=>sc;function wh(e){const{viewBox:t="0 0 24 24",d:n,displayName:r,defaultProps:o={}}=e,s=d.Children.toArray(e.path),i=je((l,u)=>a.jsx(Tn,{ref:u,viewBox:t,...o,...l,children:s.length?s:a.jsx("path",{fill:"currentColor",d:n})}));return i.displayName=r,i}function o5(e){const{theme:t}=$R(),n=LR();return d.useMemo(()=>zR(t.direction,{...n,...e}),[e,t.direction,n])}var M$=Object.defineProperty,O$=(e,t,n)=>t in e?M$(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,jn=(e,t,n)=>(O$(e,typeof t!="symbol"?t+"":t,n),n);function Yw(e){return e.sort((t,n)=>{const r=t.compareDocumentPosition(n);if(r&Node.DOCUMENT_POSITION_FOLLOWING||r&Node.DOCUMENT_POSITION_CONTAINED_BY)return-1;if(r&Node.DOCUMENT_POSITION_PRECEDING||r&Node.DOCUMENT_POSITION_CONTAINS)return 1;if(r&Node.DOCUMENT_POSITION_DISCONNECTED||r&Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC)throw Error("Cannot sort the given nodes.");return 0})}var R$=e=>typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.ELEMENT_NODE;function Zw(e,t,n){let r=e+1;return n&&r>=t&&(r=0),r}function Jw(e,t,n){let r=e-1;return n&&r<0&&(r=t),r}var C1=typeof window<"u"?d.useLayoutEffect:d.useEffect,rm=e=>e,D$=class{constructor(){jn(this,"descendants",new Map),jn(this,"register",e=>{if(e!=null)return R$(e)?this.registerNode(e):t=>{this.registerNode(t,e)}}),jn(this,"unregister",e=>{this.descendants.delete(e);const t=Yw(Array.from(this.descendants.keys()));this.assignIndex(t)}),jn(this,"destroy",()=>{this.descendants.clear()}),jn(this,"assignIndex",e=>{this.descendants.forEach(t=>{const n=e.indexOf(t.node);t.index=n,t.node.dataset.index=t.index.toString()})}),jn(this,"count",()=>this.descendants.size),jn(this,"enabledCount",()=>this.enabledValues().length),jn(this,"values",()=>Array.from(this.descendants.values()).sort((t,n)=>t.index-n.index)),jn(this,"enabledValues",()=>this.values().filter(e=>!e.disabled)),jn(this,"item",e=>{if(this.count()!==0)return this.values()[e]}),jn(this,"enabledItem",e=>{if(this.enabledCount()!==0)return this.enabledValues()[e]}),jn(this,"first",()=>this.item(0)),jn(this,"firstEnabled",()=>this.enabledItem(0)),jn(this,"last",()=>this.item(this.descendants.size-1)),jn(this,"lastEnabled",()=>{const e=this.enabledValues().length-1;return this.enabledItem(e)}),jn(this,"indexOf",e=>{var t,n;return e&&(n=(t=this.descendants.get(e))==null?void 0:t.index)!=null?n:-1}),jn(this,"enabledIndexOf",e=>e==null?-1:this.enabledValues().findIndex(t=>t.node.isSameNode(e))),jn(this,"next",(e,t=!0)=>{const n=Zw(e,this.count(),t);return this.item(n)}),jn(this,"nextEnabled",(e,t=!0)=>{const n=this.item(e);if(!n)return;const r=this.enabledIndexOf(n.node),o=Zw(r,this.enabledCount(),t);return this.enabledItem(o)}),jn(this,"prev",(e,t=!0)=>{const n=Jw(e,this.count()-1,t);return this.item(n)}),jn(this,"prevEnabled",(e,t=!0)=>{const n=this.item(e);if(!n)return;const r=this.enabledIndexOf(n.node),o=Jw(r,this.enabledCount()-1,t);return this.enabledItem(o)}),jn(this,"registerNode",(e,t)=>{if(!e||this.descendants.has(e))return;const n=Array.from(this.descendants.keys()).concat(e),r=Yw(n);t!=null&&t.disabled&&(t.disabled=!!t.disabled);const o={node:e,index:-1,...t};this.descendants.set(e,o),this.assignIndex(r)})}};function A$(e,t){if(e!=null){if(typeof e=="function"){e(t);return}try{e.current=t}catch{throw new Error(`Cannot assign value '${t}' to ref '${e}'`)}}}function It(...e){return t=>{e.forEach(n=>{A$(n,t)})}}function T$(...e){return d.useMemo(()=>It(...e),e)}function N$(){const e=d.useRef(new D$);return C1(()=>()=>e.current.destroy()),e.current}var[$$,s5]=Wt({name:"DescendantsProvider",errorMessage:"useDescendantsContext must be used within DescendantsProvider"});function L$(e){const t=s5(),[n,r]=d.useState(-1),o=d.useRef(null);C1(()=>()=>{o.current&&t.unregister(o.current)},[]),C1(()=>{if(!o.current)return;const i=Number(o.current.dataset.index);n!=i&&!Number.isNaN(i)&&r(i)});const s=rm(e?t.register(e):t.register);return{descendants:t,index:n,enabledIndex:t.enabledIndexOf(o.current),register:It(s,o)}}function lb(){return[rm($$),()=>rm(s5()),()=>N$(),o=>L$(o)]}var[z$,Sh]=Wt({name:"AccordionStylesContext",hookName:"useAccordionStyles",providerName:""}),[F$,cb]=Wt({name:"AccordionItemContext",hookName:"useAccordionItemContext",providerName:""}),[B$,P1e,H$,V$]=lb(),Bl=je(function(t,n){const{getButtonProps:r}=cb(),o=r(t,n),i={display:"flex",alignItems:"center",width:"100%",outline:0,...Sh().button};return a.jsx(we.button,{...o,className:Ye("chakra-accordion__button",t.className),__css:i})});Bl.displayName="AccordionButton";function _d(e){const{value:t,defaultValue:n,onChange:r,shouldUpdate:o=(g,x)=>g!==x}=e,s=un(r),i=un(o),[l,u]=d.useState(n),p=t!==void 0,m=p?t:l,h=un(g=>{const y=typeof g=="function"?g(m):g;i(m,y)&&(p||u(y),s(y))},[p,s,m,i]);return[m,h]}function W$(e){const{onChange:t,defaultIndex:n,index:r,allowMultiple:o,allowToggle:s,...i}=e;K$(e),q$(e);const l=H$(),[u,p]=d.useState(-1);d.useEffect(()=>()=>{p(-1)},[]);const[m,h]=_d({value:r,defaultValue(){return o?n??[]:n??-1},onChange:t});return{index:m,setIndex:h,htmlProps:i,getAccordionItemProps:x=>{let y=!1;return x!==null&&(y=Array.isArray(m)?m.includes(x):m===x),{isOpen:y,onChange:w=>{if(x!==null)if(o&&Array.isArray(m)){const S=w?m.concat(x):m.filter(j=>j!==x);h(S)}else w?h(x):s&&h(-1)}}},focusedIndex:u,setFocusedIndex:p,descendants:l}}var[U$,ub]=Wt({name:"AccordionContext",hookName:"useAccordionContext",providerName:"Accordion"});function G$(e){const{isDisabled:t,isFocusable:n,id:r,...o}=e,{getAccordionItemProps:s,setFocusedIndex:i}=ub(),l=d.useRef(null),u=d.useId(),p=r??u,m=`accordion-button-${p}`,h=`accordion-panel-${p}`;X$(e);const{register:g,index:x,descendants:y}=V$({disabled:t&&!n}),{isOpen:b,onChange:w}=s(x===-1?null:x);Q$({isOpen:b,isDisabled:t});const S=()=>{w==null||w(!0)},j=()=>{w==null||w(!1)},_=d.useCallback(()=>{w==null||w(!b),i(x)},[x,i,b,w]),E=d.useCallback(D=>{const O={ArrowDown:()=>{const T=y.nextEnabled(x);T==null||T.node.focus()},ArrowUp:()=>{const T=y.prevEnabled(x);T==null||T.node.focus()},Home:()=>{const T=y.firstEnabled();T==null||T.node.focus()},End:()=>{const T=y.lastEnabled();T==null||T.node.focus()}}[D.key];O&&(D.preventDefault(),O(D))},[y,x]),I=d.useCallback(()=>{i(x)},[i,x]),M=d.useCallback(function(A={},O=null){return{...A,type:"button",ref:It(g,l,O),id:m,disabled:!!t,"aria-expanded":!!b,"aria-controls":h,onClick:He(A.onClick,_),onFocus:He(A.onFocus,I),onKeyDown:He(A.onKeyDown,E)}},[m,t,b,_,I,E,h,g]),R=d.useCallback(function(A={},O=null){return{...A,ref:O,role:"region",id:h,"aria-labelledby":m,hidden:!b}},[m,b,h]);return{isOpen:b,isDisabled:t,isFocusable:n,onOpen:S,onClose:j,getButtonProps:M,getPanelProps:R,htmlProps:o}}function K$(e){const t=e.index||e.defaultIndex,n=t!=null&&!Array.isArray(t)&&e.allowMultiple;vd({condition:!!n,message:`If 'allowMultiple' is passed, then 'index' or 'defaultIndex' must be an array. You passed: ${typeof t},`})}function q$(e){vd({condition:!!(e.allowMultiple&&e.allowToggle),message:"If 'allowMultiple' is passed, 'allowToggle' will be ignored. Either remove 'allowToggle' or 'allowMultiple' depending on whether you want multiple accordions visible or not"})}function X$(e){vd({condition:!!(e.isFocusable&&!e.isDisabled),message:`Using only 'isFocusable', this prop is reserved for situations where you pass 'isDisabled' but you still want the element to receive focus (A11y). Either remove it or pass 'isDisabled' as well. - `})}function Q$(e){vd({condition:e.isOpen&&!!e.isDisabled,message:"Cannot open a disabled accordion item"})}function Hl(e){const{isOpen:t,isDisabled:n}=cb(),{reduceMotion:r}=ub(),o=Ye("chakra-accordion__icon",e.className),s=Sh(),i={opacity:n?.4:1,transform:t?"rotate(-180deg)":void 0,transition:r?void 0:"transform 0.2s",transformOrigin:"center",...s.icon};return a.jsx(Tn,{viewBox:"0 0 24 24","aria-hidden":!0,className:o,__css:i,...e,children:a.jsx("path",{fill:"currentColor",d:"M16.59 8.59L12 13.17 7.41 8.59 6 10l6 6 6-6z"})})}Hl.displayName="AccordionIcon";var Vl=je(function(t,n){const{children:r,className:o}=t,{htmlProps:s,...i}=G$(t),u={...Sh().container,overflowAnchor:"none"},p=d.useMemo(()=>i,[i]);return a.jsx(F$,{value:p,children:a.jsx(we.div,{ref:n,...s,className:Ye("chakra-accordion__item",o),__css:u,children:typeof r=="function"?r({isExpanded:!!i.isOpen,isDisabled:!!i.isDisabled}):r})})});Vl.displayName="AccordionItem";var Yl={ease:[.25,.1,.25,1],easeIn:[.4,0,1,1],easeOut:[0,0,.2,1],easeInOut:[.4,0,.2,1]},Oi={enter:{duration:.2,ease:Yl.easeOut},exit:{duration:.1,ease:Yl.easeIn}},Js={enter:(e,t)=>({...e,delay:typeof t=="number"?t:t==null?void 0:t.enter}),exit:(e,t)=>({...e,delay:typeof t=="number"?t:t==null?void 0:t.exit})},Y$=e=>e!=null&&parseInt(e.toString(),10)>0,eS={exit:{height:{duration:.2,ease:Yl.ease},opacity:{duration:.3,ease:Yl.ease}},enter:{height:{duration:.3,ease:Yl.ease},opacity:{duration:.4,ease:Yl.ease}}},Z$={exit:({animateOpacity:e,startingHeight:t,transition:n,transitionEnd:r,delay:o})=>{var s;return{...e&&{opacity:Y$(t)?1:0},height:t,transitionEnd:r==null?void 0:r.exit,transition:(s=n==null?void 0:n.exit)!=null?s:Js.exit(eS.exit,o)}},enter:({animateOpacity:e,endingHeight:t,transition:n,transitionEnd:r,delay:o})=>{var s;return{...e&&{opacity:1},height:t,transitionEnd:r==null?void 0:r.enter,transition:(s=n==null?void 0:n.enter)!=null?s:Js.enter(eS.enter,o)}}},Id=d.forwardRef((e,t)=>{const{in:n,unmountOnExit:r,animateOpacity:o=!0,startingHeight:s=0,endingHeight:i="auto",style:l,className:u,transition:p,transitionEnd:m,...h}=e,[g,x]=d.useState(!1);d.useEffect(()=>{const j=setTimeout(()=>{x(!0)});return()=>clearTimeout(j)},[]),vd({condition:Number(s)>0&&!!r,message:"startingHeight and unmountOnExit are mutually exclusive. You can't use them together"});const y=parseFloat(s.toString())>0,b={startingHeight:s,endingHeight:i,animateOpacity:o,transition:g?p:{enter:{duration:0}},transitionEnd:{enter:m==null?void 0:m.enter,exit:r?m==null?void 0:m.exit:{...m==null?void 0:m.exit,display:y?"block":"none"}}},w=r?n:!0,S=n||r?"enter":"exit";return a.jsx(dr,{initial:!1,custom:b,children:w&&a.jsx(In.div,{ref:t,...h,className:Ye("chakra-collapse",u),style:{overflow:"hidden",display:"block",...l},custom:b,variants:Z$,initial:r?"exit":!1,animate:S,exit:"exit"})})});Id.displayName="Collapse";var J$={enter:({transition:e,transitionEnd:t,delay:n}={})=>{var r;return{opacity:1,transition:(r=e==null?void 0:e.enter)!=null?r:Js.enter(Oi.enter,n),transitionEnd:t==null?void 0:t.enter}},exit:({transition:e,transitionEnd:t,delay:n}={})=>{var r;return{opacity:0,transition:(r=e==null?void 0:e.exit)!=null?r:Js.exit(Oi.exit,n),transitionEnd:t==null?void 0:t.exit}}},a5={initial:"exit",animate:"enter",exit:"exit",variants:J$},eL=d.forwardRef(function(t,n){const{unmountOnExit:r,in:o,className:s,transition:i,transitionEnd:l,delay:u,...p}=t,m=o||r?"enter":"exit",h=r?o&&r:!0,g={transition:i,transitionEnd:l,delay:u};return a.jsx(dr,{custom:g,children:h&&a.jsx(In.div,{ref:n,className:Ye("chakra-fade",s),custom:g,...a5,animate:m,...p})})});eL.displayName="Fade";var tL={exit:({reverse:e,initialScale:t,transition:n,transitionEnd:r,delay:o})=>{var s;return{opacity:0,...e?{scale:t,transitionEnd:r==null?void 0:r.exit}:{transitionEnd:{scale:t,...r==null?void 0:r.exit}},transition:(s=n==null?void 0:n.exit)!=null?s:Js.exit(Oi.exit,o)}},enter:({transitionEnd:e,transition:t,delay:n})=>{var r;return{opacity:1,scale:1,transition:(r=t==null?void 0:t.enter)!=null?r:Js.enter(Oi.enter,n),transitionEnd:e==null?void 0:e.enter}}},i5={initial:"exit",animate:"enter",exit:"exit",variants:tL},nL=d.forwardRef(function(t,n){const{unmountOnExit:r,in:o,reverse:s=!0,initialScale:i=.95,className:l,transition:u,transitionEnd:p,delay:m,...h}=t,g=r?o&&r:!0,x=o||r?"enter":"exit",y={initialScale:i,reverse:s,transition:u,transitionEnd:p,delay:m};return a.jsx(dr,{custom:y,children:g&&a.jsx(In.div,{ref:n,className:Ye("chakra-offset-slide",l),...i5,animate:x,custom:y,...h})})});nL.displayName="ScaleFade";var rL={initial:({offsetX:e,offsetY:t,transition:n,transitionEnd:r,delay:o})=>{var s;return{opacity:0,x:e,y:t,transition:(s=n==null?void 0:n.exit)!=null?s:Js.exit(Oi.exit,o),transitionEnd:r==null?void 0:r.exit}},enter:({transition:e,transitionEnd:t,delay:n})=>{var r;return{opacity:1,x:0,y:0,transition:(r=e==null?void 0:e.enter)!=null?r:Js.enter(Oi.enter,n),transitionEnd:t==null?void 0:t.enter}},exit:({offsetY:e,offsetX:t,transition:n,transitionEnd:r,reverse:o,delay:s})=>{var i;const l={x:t,y:e};return{opacity:0,transition:(i=n==null?void 0:n.exit)!=null?i:Js.exit(Oi.exit,s),...o?{...l,transitionEnd:r==null?void 0:r.exit}:{transitionEnd:{...l,...r==null?void 0:r.exit}}}}},w1={initial:"initial",animate:"enter",exit:"exit",variants:rL},oL=d.forwardRef(function(t,n){const{unmountOnExit:r,in:o,reverse:s=!0,className:i,offsetX:l=0,offsetY:u=8,transition:p,transitionEnd:m,delay:h,...g}=t,x=r?o&&r:!0,y=o||r?"enter":"exit",b={offsetX:l,offsetY:u,reverse:s,transition:p,transitionEnd:m,delay:h};return a.jsx(dr,{custom:b,children:x&&a.jsx(In.div,{ref:n,className:Ye("chakra-offset-slide",i),custom:b,...w1,animate:y,...g})})});oL.displayName="SlideFade";var Wl=je(function(t,n){const{className:r,motionProps:o,...s}=t,{reduceMotion:i}=ub(),{getPanelProps:l,isOpen:u}=cb(),p=l(s,n),m=Ye("chakra-accordion__panel",r),h=Sh();i||delete p.hidden;const g=a.jsx(we.div,{...p,__css:h.panel,className:m});return i?g:a.jsx(Id,{in:u,...o,children:g})});Wl.displayName="AccordionPanel";var l5=je(function({children:t,reduceMotion:n,...r},o){const s=Un("Accordion",r),i=on(r),{htmlProps:l,descendants:u,...p}=W$(i),m=d.useMemo(()=>({...p,reduceMotion:!!n}),[p,n]);return a.jsx(B$,{value:u,children:a.jsx(U$,{value:m,children:a.jsx(z$,{value:s,children:a.jsx(we.div,{ref:o,...l,className:Ye("chakra-accordion",r.className),__css:s.root,children:t})})})})});l5.displayName="Accordion";function kh(e){return d.Children.toArray(e).filter(t=>d.isValidElement(t))}var[sL,aL]=Wt({strict:!1,name:"ButtonGroupContext"}),iL={horizontal:{"> *:first-of-type:not(:last-of-type)":{borderEndRadius:0},"> *:not(:first-of-type):not(:last-of-type)":{borderRadius:0},"> *:not(:first-of-type):last-of-type":{borderStartRadius:0}},vertical:{"> *:first-of-type:not(:last-of-type)":{borderBottomRadius:0},"> *:not(:first-of-type):not(:last-of-type)":{borderRadius:0},"> *:not(:first-of-type):last-of-type":{borderTopRadius:0}}},lL={horizontal:e=>({"& > *:not(style) ~ *:not(style)":{marginStart:e}}),vertical:e=>({"& > *:not(style) ~ *:not(style)":{marginTop:e}})},Vt=je(function(t,n){const{size:r,colorScheme:o,variant:s,className:i,spacing:l="0.5rem",isAttached:u,isDisabled:p,orientation:m="horizontal",...h}=t,g=Ye("chakra-button__group",i),x=d.useMemo(()=>({size:r,colorScheme:o,variant:s,isDisabled:p}),[r,o,s,p]);let y={display:"inline-flex",...u?iL[m]:lL[m](l)};const b=m==="vertical";return a.jsx(sL,{value:x,children:a.jsx(we.div,{ref:n,role:"group",__css:y,className:g,"data-attached":u?"":void 0,"data-orientation":m,flexDir:b?"column":void 0,...h})})});Vt.displayName="ButtonGroup";function cL(e){const[t,n]=d.useState(!e);return{ref:d.useCallback(s=>{s&&n(s.tagName==="BUTTON")},[]),type:t?"button":void 0}}function S1(e){const{children:t,className:n,...r}=e,o=d.isValidElement(t)?d.cloneElement(t,{"aria-hidden":!0,focusable:!1}):t,s=Ye("chakra-button__icon",n);return a.jsx(we.span,{display:"inline-flex",alignSelf:"center",flexShrink:0,...r,className:s,children:o})}S1.displayName="ButtonIcon";function k1(e){const{label:t,placement:n,spacing:r="0.5rem",children:o=a.jsx(fa,{color:"currentColor",width:"1em",height:"1em"}),className:s,__css:i,...l}=e,u=Ye("chakra-button__spinner",s),p=n==="start"?"marginEnd":"marginStart",m=d.useMemo(()=>({display:"flex",alignItems:"center",position:t?"relative":"absolute",[p]:t?r:0,fontSize:"1em",lineHeight:"normal",...i}),[i,t,p,r]);return a.jsx(we.div,{className:u,...l,__css:m,children:o})}k1.displayName="ButtonSpinner";var Za=je((e,t)=>{const n=aL(),r=oi("Button",{...n,...e}),{isDisabled:o=n==null?void 0:n.isDisabled,isLoading:s,isActive:i,children:l,leftIcon:u,rightIcon:p,loadingText:m,iconSpacing:h="0.5rem",type:g,spinner:x,spinnerPlacement:y="start",className:b,as:w,...S}=on(e),j=d.useMemo(()=>{const M={...r==null?void 0:r._focus,zIndex:1};return{display:"inline-flex",appearance:"none",alignItems:"center",justifyContent:"center",userSelect:"none",position:"relative",whiteSpace:"nowrap",verticalAlign:"middle",outline:"none",...r,...!!n&&{_focus:M}}},[r,n]),{ref:_,type:E}=cL(w),I={rightIcon:p,leftIcon:u,iconSpacing:h,children:l};return a.jsxs(we.button,{ref:T$(t,_),as:w,type:g??E,"data-active":dt(i),"data-loading":dt(s),__css:j,className:Ye("chakra-button",b),...S,disabled:o||s,children:[s&&y==="start"&&a.jsx(k1,{className:"chakra-button__spinner--start",label:m,placement:"start",spacing:h,children:x}),s?m||a.jsx(we.span,{opacity:0,children:a.jsx(tS,{...I})}):a.jsx(tS,{...I}),s&&y==="end"&&a.jsx(k1,{className:"chakra-button__spinner--end",label:m,placement:"end",spacing:h,children:x})]})});Za.displayName="Button";function tS(e){const{leftIcon:t,rightIcon:n,children:r,iconSpacing:o}=e;return a.jsxs(a.Fragment,{children:[t&&a.jsx(S1,{marginEnd:o,children:t}),r,n&&a.jsx(S1,{marginStart:o,children:n})]})}var ys=je((e,t)=>{const{icon:n,children:r,isRound:o,"aria-label":s,...i}=e,l=n||r,u=d.isValidElement(l)?d.cloneElement(l,{"aria-hidden":!0,focusable:!1}):null;return a.jsx(Za,{padding:"0",borderRadius:o?"full":void 0,ref:t,"aria-label":s,...i,children:u})});ys.displayName="IconButton";var[E1e,uL]=Wt({name:"CheckboxGroupContext",strict:!1});function dL(e){const[t,n]=d.useState(e),[r,o]=d.useState(!1);return e!==t&&(o(!0),n(e)),r}function fL(e){return a.jsx(we.svg,{width:"1.2em",viewBox:"0 0 12 10",style:{fill:"none",strokeWidth:2,stroke:"currentColor",strokeDasharray:16},...e,children:a.jsx("polyline",{points:"1.5 6 4.5 9 10.5 1"})})}function pL(e){return a.jsx(we.svg,{width:"1.2em",viewBox:"0 0 24 24",style:{stroke:"currentColor",strokeWidth:4},...e,children:a.jsx("line",{x1:"21",x2:"3",y1:"12",y2:"12"})})}function mL(e){const{isIndeterminate:t,isChecked:n,...r}=e,o=t?pL:fL;return n||t?a.jsx(we.div,{style:{display:"flex",alignItems:"center",justifyContent:"center",height:"100%"},children:a.jsx(o,{...r})}):null}var[hL,c5]=Wt({name:"FormControlStylesContext",errorMessage:`useFormControlStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),[gL,Pd]=Wt({strict:!1,name:"FormControlContext"});function vL(e){const{id:t,isRequired:n,isInvalid:r,isDisabled:o,isReadOnly:s,...i}=e,l=d.useId(),u=t||`field-${l}`,p=`${u}-label`,m=`${u}-feedback`,h=`${u}-helptext`,[g,x]=d.useState(!1),[y,b]=d.useState(!1),[w,S]=d.useState(!1),j=d.useCallback((R={},D=null)=>({id:h,...R,ref:It(D,A=>{A&&b(!0)})}),[h]),_=d.useCallback((R={},D=null)=>({...R,ref:D,"data-focus":dt(w),"data-disabled":dt(o),"data-invalid":dt(r),"data-readonly":dt(s),id:R.id!==void 0?R.id:p,htmlFor:R.htmlFor!==void 0?R.htmlFor:u}),[u,o,w,r,s,p]),E=d.useCallback((R={},D=null)=>({id:m,...R,ref:It(D,A=>{A&&x(!0)}),"aria-live":"polite"}),[m]),I=d.useCallback((R={},D=null)=>({...R,...i,ref:D,role:"group"}),[i]),M=d.useCallback((R={},D=null)=>({...R,ref:D,role:"presentation","aria-hidden":!0,children:R.children||"*"}),[]);return{isRequired:!!n,isInvalid:!!r,isReadOnly:!!s,isDisabled:!!o,isFocused:!!w,onFocus:()=>S(!0),onBlur:()=>S(!1),hasFeedbackText:g,setHasFeedbackText:x,hasHelpText:y,setHasHelpText:b,id:u,labelId:p,feedbackId:m,helpTextId:h,htmlProps:i,getHelpTextProps:j,getErrorMessageProps:E,getRootProps:I,getLabelProps:_,getRequiredIndicatorProps:M}}var Kt=je(function(t,n){const r=Un("Form",t),o=on(t),{getRootProps:s,htmlProps:i,...l}=vL(o),u=Ye("chakra-form-control",t.className);return a.jsx(gL,{value:l,children:a.jsx(hL,{value:r,children:a.jsx(we.div,{...s({},n),className:u,__css:r.container})})})});Kt.displayName="FormControl";var u5=je(function(t,n){const r=Pd(),o=c5(),s=Ye("chakra-form__helper-text",t.className);return a.jsx(we.div,{...r==null?void 0:r.getHelpTextProps(t,n),__css:o.helperText,className:s})});u5.displayName="FormHelperText";var wn=je(function(t,n){var r;const o=oi("FormLabel",t),s=on(t),{className:i,children:l,requiredIndicator:u=a.jsx(d5,{}),optionalIndicator:p=null,...m}=s,h=Pd(),g=(r=h==null?void 0:h.getLabelProps(m,n))!=null?r:{ref:n,...m};return a.jsxs(we.label,{...g,className:Ye("chakra-form__label",s.className),__css:{display:"block",textAlign:"start",...o},children:[l,h!=null&&h.isRequired?u:p]})});wn.displayName="FormLabel";var d5=je(function(t,n){const r=Pd(),o=c5();if(!(r!=null&&r.isRequired))return null;const s=Ye("chakra-form__required-indicator",t.className);return a.jsx(we.span,{...r==null?void 0:r.getRequiredIndicatorProps(t,n),__css:o.requiredIndicator,className:s})});d5.displayName="RequiredIndicator";function db(e){const{isDisabled:t,isInvalid:n,isReadOnly:r,isRequired:o,...s}=fb(e);return{...s,disabled:t,readOnly:r,required:o,"aria-invalid":Co(n),"aria-required":Co(o),"aria-readonly":Co(r)}}function fb(e){var t,n,r;const o=Pd(),{id:s,disabled:i,readOnly:l,required:u,isRequired:p,isInvalid:m,isReadOnly:h,isDisabled:g,onFocus:x,onBlur:y,...b}=e,w=e["aria-describedby"]?[e["aria-describedby"]]:[];return o!=null&&o.hasFeedbackText&&(o!=null&&o.isInvalid)&&w.push(o.feedbackId),o!=null&&o.hasHelpText&&w.push(o.helpTextId),{...b,"aria-describedby":w.join(" ")||void 0,id:s??(o==null?void 0:o.id),isDisabled:(t=i??g)!=null?t:o==null?void 0:o.isDisabled,isReadOnly:(n=l??h)!=null?n:o==null?void 0:o.isReadOnly,isRequired:(r=u??p)!=null?r:o==null?void 0:o.isRequired,isInvalid:m??(o==null?void 0:o.isInvalid),onFocus:He(o==null?void 0:o.onFocus,x),onBlur:He(o==null?void 0:o.onBlur,y)}}var pb={border:"0",clip:"rect(0, 0, 0, 0)",height:"1px",width:"1px",margin:"-1px",padding:"0",overflow:"hidden",whiteSpace:"nowrap",position:"absolute"},f5=we("span",{baseStyle:pb});f5.displayName="VisuallyHidden";var xL=we("input",{baseStyle:pb});xL.displayName="VisuallyHiddenInput";const bL=()=>typeof document<"u";let nS=!1,Ed=null,Vi=!1,j1=!1;const _1=new Set;function mb(e,t){_1.forEach(n=>n(e,t))}const yL=typeof window<"u"&&window.navigator!=null?/^Mac/.test(window.navigator.platform):!1;function CL(e){return!(e.metaKey||!yL&&e.altKey||e.ctrlKey||e.key==="Control"||e.key==="Shift"||e.key==="Meta")}function rS(e){Vi=!0,CL(e)&&(Ed="keyboard",mb("keyboard",e))}function Ol(e){if(Ed="pointer",e.type==="mousedown"||e.type==="pointerdown"){Vi=!0;const t=e.composedPath?e.composedPath()[0]:e.target;let n=!1;try{n=t.matches(":focus-visible")}catch{}if(n)return;mb("pointer",e)}}function wL(e){return e.mozInputSource===0&&e.isTrusted?!0:e.detail===0&&!e.pointerType}function SL(e){wL(e)&&(Vi=!0,Ed="virtual")}function kL(e){e.target===window||e.target===document||(!Vi&&!j1&&(Ed="virtual",mb("virtual",e)),Vi=!1,j1=!1)}function jL(){Vi=!1,j1=!0}function oS(){return Ed!=="pointer"}function _L(){if(!bL()||nS)return;const{focus:e}=HTMLElement.prototype;HTMLElement.prototype.focus=function(...n){Vi=!0,e.apply(this,n)},document.addEventListener("keydown",rS,!0),document.addEventListener("keyup",rS,!0),document.addEventListener("click",SL,!0),window.addEventListener("focus",kL,!0),window.addEventListener("blur",jL,!1),typeof PointerEvent<"u"?(document.addEventListener("pointerdown",Ol,!0),document.addEventListener("pointermove",Ol,!0),document.addEventListener("pointerup",Ol,!0)):(document.addEventListener("mousedown",Ol,!0),document.addEventListener("mousemove",Ol,!0),document.addEventListener("mouseup",Ol,!0)),nS=!0}function p5(e){_L(),e(oS());const t=()=>e(oS());return _1.add(t),()=>{_1.delete(t)}}function IL(e,t=[]){const n=Object.assign({},e);for(const r of t)r in n&&delete n[r];return n}function m5(e={}){const t=fb(e),{isDisabled:n,isReadOnly:r,isRequired:o,isInvalid:s,id:i,onBlur:l,onFocus:u,"aria-describedby":p}=t,{defaultChecked:m,isChecked:h,isFocusable:g,onChange:x,isIndeterminate:y,name:b,value:w,tabIndex:S=void 0,"aria-label":j,"aria-labelledby":_,"aria-invalid":E,...I}=e,M=IL(I,["isDisabled","isReadOnly","isRequired","isInvalid","id","onBlur","onFocus","aria-describedby"]),R=un(x),D=un(l),A=un(u),[O,T]=d.useState(!1),[X,B]=d.useState(!1),[V,U]=d.useState(!1),[N,$]=d.useState(!1);d.useEffect(()=>p5(T),[]);const q=d.useRef(null),[F,Q]=d.useState(!0),[Y,se]=d.useState(!!m),ae=h!==void 0,re=ae?h:Y,G=d.useCallback(fe=>{if(r||n){fe.preventDefault();return}ae||se(re?fe.target.checked:y?!0:fe.target.checked),R==null||R(fe)},[r,n,re,ae,y,R]);rc(()=>{q.current&&(q.current.indeterminate=!!y)},[y]),pa(()=>{n&&B(!1)},[n,B]),rc(()=>{const fe=q.current;if(!(fe!=null&&fe.form))return;const Oe=()=>{se(!!m)};return fe.form.addEventListener("reset",Oe),()=>{var _e;return(_e=fe.form)==null?void 0:_e.removeEventListener("reset",Oe)}},[]);const K=n&&!g,ee=d.useCallback(fe=>{fe.key===" "&&$(!0)},[$]),ce=d.useCallback(fe=>{fe.key===" "&&$(!1)},[$]);rc(()=>{if(!q.current)return;q.current.checked!==re&&se(q.current.checked)},[q.current]);const J=d.useCallback((fe={},Oe=null)=>{const _e=Ne=>{X&&Ne.preventDefault(),$(!0)};return{...fe,ref:Oe,"data-active":dt(N),"data-hover":dt(V),"data-checked":dt(re),"data-focus":dt(X),"data-focus-visible":dt(X&&O),"data-indeterminate":dt(y),"data-disabled":dt(n),"data-invalid":dt(s),"data-readonly":dt(r),"aria-hidden":!0,onMouseDown:He(fe.onMouseDown,_e),onMouseUp:He(fe.onMouseUp,()=>$(!1)),onMouseEnter:He(fe.onMouseEnter,()=>U(!0)),onMouseLeave:He(fe.onMouseLeave,()=>U(!1))}},[N,re,n,X,O,V,y,s,r]),ie=d.useCallback((fe={},Oe=null)=>({...fe,ref:Oe,"data-active":dt(N),"data-hover":dt(V),"data-checked":dt(re),"data-focus":dt(X),"data-focus-visible":dt(X&&O),"data-indeterminate":dt(y),"data-disabled":dt(n),"data-invalid":dt(s),"data-readonly":dt(r)}),[N,re,n,X,O,V,y,s,r]),de=d.useCallback((fe={},Oe=null)=>({...M,...fe,ref:It(Oe,_e=>{_e&&Q(_e.tagName==="LABEL")}),onClick:He(fe.onClick,()=>{var _e;F||((_e=q.current)==null||_e.click(),requestAnimationFrame(()=>{var Ne;(Ne=q.current)==null||Ne.focus({preventScroll:!0})}))}),"data-disabled":dt(n),"data-checked":dt(re),"data-invalid":dt(s)}),[M,n,re,s,F]),ge=d.useCallback((fe={},Oe=null)=>({...fe,ref:It(q,Oe),type:"checkbox",name:b,value:w,id:i,tabIndex:S,onChange:He(fe.onChange,G),onBlur:He(fe.onBlur,D,()=>B(!1)),onFocus:He(fe.onFocus,A,()=>B(!0)),onKeyDown:He(fe.onKeyDown,ee),onKeyUp:He(fe.onKeyUp,ce),required:o,checked:re,disabled:K,readOnly:r,"aria-label":j,"aria-labelledby":_,"aria-invalid":E?!!E:s,"aria-describedby":p,"aria-disabled":n,style:pb}),[b,w,i,G,D,A,ee,ce,o,re,K,r,j,_,E,s,p,n,S]),Ce=d.useCallback((fe={},Oe=null)=>({...fe,ref:Oe,onMouseDown:He(fe.onMouseDown,PL),"data-disabled":dt(n),"data-checked":dt(re),"data-invalid":dt(s)}),[re,n,s]);return{state:{isInvalid:s,isFocused:X,isChecked:re,isActive:N,isHovered:V,isIndeterminate:y,isDisabled:n,isReadOnly:r,isRequired:o},getRootProps:de,getCheckboxProps:J,getIndicatorProps:ie,getInputProps:ge,getLabelProps:Ce,htmlProps:M}}function PL(e){e.preventDefault(),e.stopPropagation()}var EL={display:"inline-flex",alignItems:"center",justifyContent:"center",verticalAlign:"top",userSelect:"none",flexShrink:0},ML={cursor:"pointer",display:"inline-flex",alignItems:"center",verticalAlign:"top",position:"relative"},OL=ma({from:{opacity:0,strokeDashoffset:16,transform:"scale(0.95)"},to:{opacity:1,strokeDashoffset:0,transform:"scale(1)"}}),RL=ma({from:{opacity:0},to:{opacity:1}}),DL=ma({from:{transform:"scaleX(0.65)"},to:{transform:"scaleX(1)"}}),Md=je(function(t,n){const r=uL(),o={...r,...t},s=Un("Checkbox",o),i=on(t),{spacing:l="0.5rem",className:u,children:p,iconColor:m,iconSize:h,icon:g=a.jsx(mL,{}),isChecked:x,isDisabled:y=r==null?void 0:r.isDisabled,onChange:b,inputProps:w,...S}=i;let j=x;r!=null&&r.value&&i.value&&(j=r.value.includes(i.value));let _=b;r!=null&&r.onChange&&i.value&&(_=ph(r.onChange,b));const{state:E,getInputProps:I,getCheckboxProps:M,getLabelProps:R,getRootProps:D}=m5({...S,isDisabled:y,isChecked:j,onChange:_}),A=dL(E.isChecked),O=d.useMemo(()=>({animation:A?E.isIndeterminate?`${RL} 20ms linear, ${DL} 200ms linear`:`${OL} 200ms linear`:void 0,fontSize:h,color:m,...s.icon}),[m,h,A,E.isIndeterminate,s.icon]),T=d.cloneElement(g,{__css:O,isIndeterminate:E.isIndeterminate,isChecked:E.isChecked});return a.jsxs(we.label,{__css:{...ML,...s.container},className:Ye("chakra-checkbox",u),...D(),children:[a.jsx("input",{className:"chakra-checkbox__input",...I(w,n)}),a.jsx(we.span,{__css:{...EL,...s.control},className:"chakra-checkbox__control",...M(),children:T}),p&&a.jsx(we.span,{className:"chakra-checkbox__label",...R(),__css:{marginStart:l,...s.label},children:p})]})});Md.displayName="Checkbox";function AL(e){const t=parseFloat(e);return typeof t!="number"||Number.isNaN(t)?0:t}function hb(e,t){let n=AL(e);const r=10**(t??10);return n=Math.round(n*r)/r,t?n.toFixed(t):n.toString()}function I1(e){if(!Number.isFinite(e))return 0;let t=1,n=0;for(;Math.round(e*t)/t!==e;)t*=10,n+=1;return n}function om(e,t,n){return(e-t)*100/(n-t)}function h5(e,t,n){return(n-t)*e+t}function P1(e,t,n){const r=Math.round((e-t)/n)*n+t,o=I1(n);return hb(r,o)}function ac(e,t,n){return e==null?e:(n{var O;return r==null?"":(O=av(r,s,n))!=null?O:""}),g=typeof o<"u",x=g?o:m,y=g5(za(x),s),b=n??y,w=d.useCallback(O=>{O!==x&&(g||h(O.toString()),p==null||p(O.toString(),za(O)))},[p,g,x]),S=d.useCallback(O=>{let T=O;return u&&(T=ac(T,i,l)),hb(T,b)},[b,u,l,i]),j=d.useCallback((O=s)=>{let T;x===""?T=za(O):T=za(x)+O,T=S(T),w(T)},[S,s,w,x]),_=d.useCallback((O=s)=>{let T;x===""?T=za(-O):T=za(x)-O,T=S(T),w(T)},[S,s,w,x]),E=d.useCallback(()=>{var O;let T;r==null?T="":T=(O=av(r,s,n))!=null?O:i,w(T)},[r,n,s,w,i]),I=d.useCallback(O=>{var T;const X=(T=av(O,s,b))!=null?T:i;w(X)},[b,s,w,i]),M=za(x);return{isOutOfRange:M>l||M" `}),[$L,gb]=Wt({name:"EditableContext",errorMessage:"useEditableContext: context is undefined. Seems you forgot to wrap the editable components in ``"}),x5={fontSize:"inherit",fontWeight:"inherit",textAlign:"inherit",bg:"transparent"},jh=je(function(t,n){const{getInputProps:r}=gb(),o=v5(),s=r(t,n),i=Ye("chakra-editable__input",t.className);return a.jsx(we.input,{...s,__css:{outline:0,...x5,...o.input},className:i})});jh.displayName="EditableInput";var _h=je(function(t,n){const{getPreviewProps:r}=gb(),o=v5(),s=r(t,n),i=Ye("chakra-editable__preview",t.className);return a.jsx(we.span,{...s,__css:{cursor:"text",display:"inline-block",...x5,...o.preview},className:i})});_h.displayName="EditablePreview";function Ri(e,t,n,r){const o=un(n);return d.useEffect(()=>{const s=typeof e=="function"?e():e??document;if(!(!n||!s))return s.addEventListener(t,o,r),()=>{s.removeEventListener(t,o,r)}},[t,e,r,o,n]),()=>{const s=typeof e=="function"?e():e??document;s==null||s.removeEventListener(t,o,r)}}function LL(e){return"current"in e}var b5=()=>typeof window<"u";function zL(){var e;const t=navigator.userAgentData;return(e=t==null?void 0:t.platform)!=null?e:navigator.platform}var FL=e=>b5()&&e.test(navigator.vendor),BL=e=>b5()&&e.test(zL()),HL=()=>BL(/mac|iphone|ipad|ipod/i),VL=()=>HL()&&FL(/apple/i);function y5(e){const{ref:t,elements:n,enabled:r}=e,o=()=>{var s,i;return(i=(s=t.current)==null?void 0:s.ownerDocument)!=null?i:document};Ri(o,"pointerdown",s=>{if(!VL()||!r)return;const i=s.target,u=(n??[t]).some(p=>{const m=LL(p)?p.current:p;return(m==null?void 0:m.contains(i))||m===i});o().activeElement!==i&&u&&(s.preventDefault(),i.focus())})}function sS(e,t){return e?e===t||e.contains(t):!1}function WL(e={}){const{onChange:t,onCancel:n,onSubmit:r,onBlur:o,value:s,isDisabled:i,defaultValue:l,startWithEditView:u,isPreviewFocusable:p=!0,submitOnBlur:m=!0,selectAllOnFocus:h=!0,placeholder:g,onEdit:x,finalFocusRef:y,...b}=e,w=un(x),S=!!(u&&!i),[j,_]=d.useState(S),[E,I]=_d({defaultValue:l||"",value:s,onChange:t}),[M,R]=d.useState(E),D=d.useRef(null),A=d.useRef(null),O=d.useRef(null),T=d.useRef(null),X=d.useRef(null);y5({ref:D,enabled:j,elements:[T,X]});const B=!j&&!i;rc(()=>{var J,ie;j&&((J=D.current)==null||J.focus(),h&&((ie=D.current)==null||ie.select()))},[]),pa(()=>{var J,ie,de,ge;if(!j){y?(J=y.current)==null||J.focus():(ie=O.current)==null||ie.focus();return}(de=D.current)==null||de.focus(),h&&((ge=D.current)==null||ge.select()),w==null||w()},[j,w,h]);const V=d.useCallback(()=>{B&&_(!0)},[B]),U=d.useCallback(()=>{R(E)},[E]),N=d.useCallback(()=>{_(!1),I(M),n==null||n(M),o==null||o(M)},[n,o,I,M]),$=d.useCallback(()=>{_(!1),R(E),r==null||r(E),o==null||o(M)},[E,r,o,M]);d.useEffect(()=>{if(j)return;const J=D.current;(J==null?void 0:J.ownerDocument.activeElement)===J&&(J==null||J.blur())},[j]);const q=d.useCallback(J=>{I(J.currentTarget.value)},[I]),F=d.useCallback(J=>{const ie=J.key,ge={Escape:N,Enter:Ce=>{!Ce.shiftKey&&!Ce.metaKey&&$()}}[ie];ge&&(J.preventDefault(),ge(J))},[N,$]),Q=d.useCallback(J=>{const ie=J.key,ge={Escape:N}[ie];ge&&(J.preventDefault(),ge(J))},[N]),Y=E.length===0,se=d.useCallback(J=>{var ie;if(!j)return;const de=J.currentTarget.ownerDocument,ge=(ie=J.relatedTarget)!=null?ie:de.activeElement,Ce=sS(T.current,ge),he=sS(X.current,ge);!Ce&&!he&&(m?$():N())},[m,$,N,j]),ae=d.useCallback((J={},ie=null)=>{const de=B&&p?0:void 0;return{...J,ref:It(ie,A),children:Y?g:E,hidden:j,"aria-disabled":Co(i),tabIndex:de,onFocus:He(J.onFocus,V,U)}},[i,j,B,p,Y,V,U,g,E]),re=d.useCallback((J={},ie=null)=>({...J,hidden:!j,placeholder:g,ref:It(ie,D),disabled:i,"aria-disabled":Co(i),value:E,onBlur:He(J.onBlur,se),onChange:He(J.onChange,q),onKeyDown:He(J.onKeyDown,F),onFocus:He(J.onFocus,U)}),[i,j,se,q,F,U,g,E]),G=d.useCallback((J={},ie=null)=>({...J,hidden:!j,placeholder:g,ref:It(ie,D),disabled:i,"aria-disabled":Co(i),value:E,onBlur:He(J.onBlur,se),onChange:He(J.onChange,q),onKeyDown:He(J.onKeyDown,Q),onFocus:He(J.onFocus,U)}),[i,j,se,q,Q,U,g,E]),K=d.useCallback((J={},ie=null)=>({"aria-label":"Edit",...J,type:"button",onClick:He(J.onClick,V),ref:It(ie,O),disabled:i}),[V,i]),ee=d.useCallback((J={},ie=null)=>({...J,"aria-label":"Submit",ref:It(X,ie),type:"button",onClick:He(J.onClick,$),disabled:i}),[$,i]),ce=d.useCallback((J={},ie=null)=>({"aria-label":"Cancel",id:"cancel",...J,ref:It(T,ie),type:"button",onClick:He(J.onClick,N),disabled:i}),[N,i]);return{isEditing:j,isDisabled:i,isValueEmpty:Y,value:E,onEdit:V,onCancel:N,onSubmit:$,getPreviewProps:ae,getInputProps:re,getTextareaProps:G,getEditButtonProps:K,getSubmitButtonProps:ee,getCancelButtonProps:ce,htmlProps:b}}var Ih=je(function(t,n){const r=Un("Editable",t),o=on(t),{htmlProps:s,...i}=WL(o),{isEditing:l,onSubmit:u,onCancel:p,onEdit:m}=i,h=Ye("chakra-editable",t.className),g=zx(t.children,{isEditing:l,onSubmit:u,onCancel:p,onEdit:m});return a.jsx($L,{value:i,children:a.jsx(NL,{value:r,children:a.jsx(we.div,{ref:n,...s,className:h,children:g})})})});Ih.displayName="Editable";function C5(){const{isEditing:e,getEditButtonProps:t,getCancelButtonProps:n,getSubmitButtonProps:r}=gb();return{isEditing:e,getEditButtonProps:t,getCancelButtonProps:n,getSubmitButtonProps:r}}var w5={exports:{}},UL="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",GL=UL,KL=GL;function S5(){}function k5(){}k5.resetWarningCache=S5;var qL=function(){function e(r,o,s,i,l,u){if(u!==KL){var p=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw p.name="Invariant Violation",p}}e.isRequired=e;function t(){return e}var n={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:k5,resetWarningCache:S5};return n.PropTypes=n,n};w5.exports=qL();var XL=w5.exports;const Jt=xd(XL);var E1="data-focus-lock",j5="data-focus-lock-disabled",QL="data-no-focus-lock",YL="data-autofocus-inside",ZL="data-no-autofocus";function JL(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function ez(e,t){var n=d.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(r){var o=n.value;o!==r&&(n.value=r,n.callback(r,o))}}}})[0];return n.callback=t,n.facade}function _5(e,t){return ez(t||null,function(n){return e.forEach(function(r){return JL(r,n)})})}var iv={width:"1px",height:"0px",padding:0,overflow:"hidden",position:"fixed",top:"1px",left:"1px"},gs=function(){return gs=Object.assign||function(t){for(var n,r=1,o=arguments.length;r0&&s[s.length-1])&&(p[0]===6||p[0]===2)){n=0;continue}if(p[0]===3&&(!s||p[1]>s[0]&&p[1]0)&&!(o=r.next()).done;)s.push(o.value)}catch(l){i={error:l}}finally{try{o&&!o.done&&(n=r.return)&&n.call(r)}finally{if(i)throw i.error}}return s}function M1(e,t,n){if(n||arguments.length===2)for(var r=0,o=t.length,s;r=0}).sort(mz)},hz=["button:enabled","select:enabled","textarea:enabled","input:enabled","a[href]","area[href]","summary","iframe","object","embed","audio[controls]","video[controls]","[tabindex]","[contenteditable]","[autofocus]"],yb=hz.join(","),gz="".concat(yb,", [data-focus-guard]"),W5=function(e,t){return Rs((e.shadowRoot||e).children).reduce(function(n,r){return n.concat(r.matches(t?gz:yb)?[r]:[],W5(r))},[])},vz=function(e,t){var n;return e instanceof HTMLIFrameElement&&(!((n=e.contentDocument)===null||n===void 0)&&n.body)?Ph([e.contentDocument.body],t):[e]},Ph=function(e,t){return e.reduce(function(n,r){var o,s=W5(r,t),i=(o=[]).concat.apply(o,s.map(function(l){return vz(l,t)}));return n.concat(i,r.parentNode?Rs(r.parentNode.querySelectorAll(yb)).filter(function(l){return l===r}):[])},[])},xz=function(e){var t=e.querySelectorAll("[".concat(YL,"]"));return Rs(t).map(function(n){return Ph([n])}).reduce(function(n,r){return n.concat(r)},[])},Cb=function(e,t){return Rs(e).filter(function(n){return L5(t,n)}).filter(function(n){return dz(n)})},iS=function(e,t){return t===void 0&&(t=new Map),Rs(e).filter(function(n){return z5(t,n)})},R1=function(e,t,n){return V5(Cb(Ph(e,n),t),!0,n)},lS=function(e,t){return V5(Cb(Ph(e),t),!1)},bz=function(e,t){return Cb(xz(e),t)},ic=function(e,t){return e.shadowRoot?ic(e.shadowRoot,t):Object.getPrototypeOf(e).contains!==void 0&&Object.getPrototypeOf(e).contains.call(e,t)?!0:Rs(e.children).some(function(n){var r;if(n instanceof HTMLIFrameElement){var o=(r=n.contentDocument)===null||r===void 0?void 0:r.body;return o?ic(o,t):!1}return ic(n,t)})},yz=function(e){for(var t=new Set,n=e.length,r=0;r0&&t.add(o),(s&Node.DOCUMENT_POSITION_CONTAINS)>0&&t.add(r)}return e.filter(function(i,l){return!t.has(l)})},U5=function(e){return e.parentNode?U5(e.parentNode):e},wb=function(e){var t=sm(e);return t.filter(Boolean).reduce(function(n,r){var o=r.getAttribute(E1);return n.push.apply(n,o?yz(Rs(U5(r).querySelectorAll("[".concat(E1,'="').concat(o,'"]:not([').concat(j5,'="disabled"])')))):[r]),n},[])},Cz=function(e){try{return e()}catch{return}},Qu=function(e){if(e===void 0&&(e=document),!(!e||!e.activeElement)){var t=e.activeElement;return t.shadowRoot?Qu(t.shadowRoot):t instanceof HTMLIFrameElement&&Cz(function(){return t.contentWindow.document})?Qu(t.contentWindow.document):t}},wz=function(e,t){return e===t},Sz=function(e,t){return!!Rs(e.querySelectorAll("iframe")).some(function(n){return wz(n,t)})},G5=function(e,t){return t===void 0&&(t=Qu(T5(e).ownerDocument)),!t||t.dataset&&t.dataset.focusGuard?!1:wb(e).some(function(n){return ic(n,t)||Sz(n,t)})},kz=function(e){e===void 0&&(e=document);var t=Qu(e);return t?Rs(e.querySelectorAll("[".concat(QL,"]"))).some(function(n){return ic(n,t)}):!1},jz=function(e,t){return t.filter(H5).filter(function(n){return n.name===e.name}).filter(function(n){return n.checked})[0]||e},Sb=function(e,t){return H5(e)&&e.name?jz(e,t):e},_z=function(e){var t=new Set;return e.forEach(function(n){return t.add(Sb(n,e))}),e.filter(function(n){return t.has(n)})},cS=function(e){return e[0]&&e.length>1?Sb(e[0],e):e[0]},uS=function(e,t){return e.length>1?e.indexOf(Sb(e[t],e)):t},K5="NEW_FOCUS",Iz=function(e,t,n,r){var o=e.length,s=e[0],i=e[o-1],l=bb(n);if(!(n&&e.indexOf(n)>=0)){var u=n!==void 0?t.indexOf(n):-1,p=r?t.indexOf(r):u,m=r?e.indexOf(r):-1,h=u-p,g=t.indexOf(s),x=t.indexOf(i),y=_z(t),b=n!==void 0?y.indexOf(n):-1,w=b-(r?y.indexOf(r):u),S=uS(e,0),j=uS(e,o-1);if(u===-1||m===-1)return K5;if(!h&&m>=0)return m;if(u<=g&&l&&Math.abs(h)>1)return j;if(u>=x&&l&&Math.abs(h)>1)return S;if(h&&Math.abs(w)>1)return m;if(u<=g)return j;if(u>x)return S;if(h)return Math.abs(h)>1?m:(o+m+h)%o}},Pz=function(e){return function(t){var n,r=(n=F5(t))===null||n===void 0?void 0:n.autofocus;return t.autofocus||r!==void 0&&r!=="false"||e.indexOf(t)>=0}},Ez=function(e,t,n){var r=e.map(function(s){var i=s.node;return i}),o=iS(r.filter(Pz(n)));return o&&o.length?cS(o):cS(iS(t))},D1=function(e,t){return t===void 0&&(t=[]),t.push(e),e.parentNode&&D1(e.parentNode.host||e.parentNode,t),t},lv=function(e,t){for(var n=D1(e),r=D1(t),o=0;o=0)return s}return!1},q5=function(e,t,n){var r=sm(e),o=sm(t),s=r[0],i=!1;return o.filter(Boolean).forEach(function(l){i=lv(i||l,l)||i,n.filter(Boolean).forEach(function(u){var p=lv(s,u);p&&(!i||ic(p,i)?i=p:i=lv(p,i))})}),i},Mz=function(e,t){return e.reduce(function(n,r){return n.concat(bz(r,t))},[])},Oz=function(e,t){var n=new Map;return t.forEach(function(r){return n.set(r.node,r)}),e.map(function(r){return n.get(r)}).filter(pz)},Rz=function(e,t){var n=Qu(sm(e).length>0?document:T5(e).ownerDocument),r=wb(e).filter(am),o=q5(n||e,e,r),s=new Map,i=lS(r,s),l=R1(r,s).filter(function(x){var y=x.node;return am(y)});if(!(!l[0]&&(l=i,!l[0]))){var u=lS([o],s).map(function(x){var y=x.node;return y}),p=Oz(u,l),m=p.map(function(x){var y=x.node;return y}),h=Iz(m,u,n,t);if(h===K5){var g=Ez(i,m,Mz(r,s));if(g)return{node:g};console.warn("focus-lock: cannot find any node to move focus into");return}return h===void 0?h:p[h]}},Dz=function(e){var t=wb(e).filter(am),n=q5(e,e,t),r=new Map,o=R1([n],r,!0),s=R1(t,r).filter(function(i){var l=i.node;return am(l)}).map(function(i){var l=i.node;return l});return o.map(function(i){var l=i.node,u=i.index;return{node:l,index:u,lockItem:s.indexOf(l)>=0,guard:bb(l)}})},Az=function(e,t){"focus"in e&&e.focus(t),"contentWindow"in e&&e.contentWindow&&e.contentWindow.focus()},cv=0,uv=!1,X5=function(e,t,n){n===void 0&&(n={});var r=Rz(e,t);if(!uv&&r){if(cv>2){console.error("FocusLock: focus-fighting detected. Only one focus management system could be active. See https://github.com/theKashey/focus-lock/#focus-fighting"),uv=!0,setTimeout(function(){uv=!1},1);return}cv++,Az(r.node,n.focusOptions),cv--}};function kb(e){setTimeout(e,1)}var Tz=function(){return document&&document.activeElement===document.body},Nz=function(){return Tz()||kz()},lc=null,Zl=null,cc=null,Yu=!1,$z=function(){return!0},Lz=function(t){return(lc.whiteList||$z)(t)},zz=function(t,n){cc={observerNode:t,portaledElement:n}},Fz=function(t){return cc&&cc.portaledElement===t};function dS(e,t,n,r){var o=null,s=e;do{var i=r[s];if(i.guard)i.node.dataset.focusAutoGuard&&(o=i);else if(i.lockItem){if(s!==e)return;o=null}else break}while((s+=n)!==t);o&&(o.node.tabIndex=0)}var Bz=function(t){return t&&"current"in t?t.current:t},Hz=function(t){return t?!!Yu:Yu==="meanwhile"},Vz=function e(t,n,r){return n&&(n.host===t&&(!n.activeElement||r.contains(n.activeElement))||n.parentNode&&e(t,n.parentNode,r))},Wz=function(t,n){return n.some(function(r){return Vz(t,r,r)})},im=function(){var t=!1;if(lc){var n=lc,r=n.observed,o=n.persistentFocus,s=n.autoFocus,i=n.shards,l=n.crossFrame,u=n.focusOptions,p=r||cc&&cc.portaledElement,m=document&&document.activeElement;if(p){var h=[p].concat(i.map(Bz).filter(Boolean));if((!m||Lz(m))&&(o||Hz(l)||!Nz()||!Zl&&s)&&(p&&!(G5(h)||m&&Wz(m,h)||Fz(m))&&(document&&!Zl&&m&&!s?(m.blur&&m.blur(),document.body.focus()):(t=X5(h,Zl,{focusOptions:u}),cc={})),Yu=!1,Zl=document&&document.activeElement),document){var g=document&&document.activeElement,x=Dz(h),y=x.map(function(b){var w=b.node;return w}).indexOf(g);y>-1&&(x.filter(function(b){var w=b.guard,S=b.node;return w&&S.dataset.focusAutoGuard}).forEach(function(b){var w=b.node;return w.removeAttribute("tabIndex")}),dS(y,x.length,1,x),dS(y,-1,-1,x))}}}return t},Q5=function(t){im()&&t&&(t.stopPropagation(),t.preventDefault())},jb=function(){return kb(im)},Uz=function(t){var n=t.target,r=t.currentTarget;r.contains(n)||zz(r,n)},Gz=function(){return null},Y5=function(){Yu="just",kb(function(){Yu="meanwhile"})},Kz=function(){document.addEventListener("focusin",Q5),document.addEventListener("focusout",jb),window.addEventListener("blur",Y5)},qz=function(){document.removeEventListener("focusin",Q5),document.removeEventListener("focusout",jb),window.removeEventListener("blur",Y5)};function Xz(e){return e.filter(function(t){var n=t.disabled;return!n})}function Qz(e){var t=e.slice(-1)[0];t&&!lc&&Kz();var n=lc,r=n&&t&&t.id===n.id;lc=t,n&&!r&&(n.onDeactivation(),e.filter(function(o){var s=o.id;return s===n.id}).length||n.returnFocus(!t)),t?(Zl=null,(!r||n.observed!==t.observed)&&t.onActivation(),im(),kb(im)):(qz(),Zl=null)}R5.assignSyncMedium(Uz);D5.assignMedium(jb);nz.assignMedium(function(e){return e({moveFocusInside:X5,focusInside:G5})});const Yz=az(Xz,Qz)(Gz);var Z5=d.forwardRef(function(t,n){return d.createElement(A5,pn({sideCar:Yz,ref:n},t))}),J5=A5.propTypes||{};J5.sideCar;r$(J5,["sideCar"]);Z5.propTypes={};const fS=Z5;function e3(e){return e!=null&&typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.ELEMENT_NODE}function _b(e){var t;if(!e3(e))return!1;const n=(t=e.ownerDocument.defaultView)!=null?t:window;return e instanceof n.HTMLElement}function Zz(e){var t,n;return(n=(t=t3(e))==null?void 0:t.defaultView)!=null?n:window}function t3(e){return e3(e)?e.ownerDocument:document}function Jz(e){return t3(e).activeElement}function eF(e){const t=e.ownerDocument.defaultView||window,{overflow:n,overflowX:r,overflowY:o}=t.getComputedStyle(e);return/auto|scroll|overlay|hidden/.test(n+o+r)}function tF(e){return e.localName==="html"?e:e.assignedSlot||e.parentElement||e.ownerDocument.documentElement}function n3(e){return["html","body","#document"].includes(e.localName)?e.ownerDocument.body:_b(e)&&eF(e)?e:n3(tF(e))}var r3=e=>e.hasAttribute("tabindex"),nF=e=>r3(e)&&e.tabIndex===-1;function rF(e){return!!e.getAttribute("disabled")||!!e.getAttribute("aria-disabled")}function o3(e){return e.parentElement&&o3(e.parentElement)?!0:e.hidden}function oF(e){const t=e.getAttribute("contenteditable");return t!=="false"&&t!=null}function s3(e){if(!_b(e)||o3(e)||rF(e))return!1;const{localName:t}=e;if(["input","select","textarea","button"].indexOf(t)>=0)return!0;const r={a:()=>e.hasAttribute("href"),audio:()=>e.hasAttribute("controls"),video:()=>e.hasAttribute("controls")};return t in r?r[t]():oF(e)?!0:r3(e)}function sF(e){return e?_b(e)&&s3(e)&&!nF(e):!1}var aF=["input:not(:disabled):not([disabled])","select:not(:disabled):not([disabled])","textarea:not(:disabled):not([disabled])","embed","iframe","object","a[href]","area[href]","button:not(:disabled):not([disabled])","[tabindex]","audio[controls]","video[controls]","*[tabindex]:not([aria-disabled])","*[contenteditable]"],iF=aF.join(),lF=e=>e.offsetWidth>0&&e.offsetHeight>0;function a3(e){const t=Array.from(e.querySelectorAll(iF));return t.unshift(e),t.filter(n=>s3(n)&&lF(n))}var pS,cF=(pS=fS.default)!=null?pS:fS,i3=e=>{const{initialFocusRef:t,finalFocusRef:n,contentRef:r,restoreFocus:o,children:s,isDisabled:i,autoFocus:l,persistentFocus:u,lockFocusAcrossFrames:p}=e,m=d.useCallback(()=>{t!=null&&t.current?t.current.focus():r!=null&&r.current&&a3(r.current).length===0&&requestAnimationFrame(()=>{var y;(y=r.current)==null||y.focus()})},[t,r]),h=d.useCallback(()=>{var x;(x=n==null?void 0:n.current)==null||x.focus()},[n]),g=o&&!n;return a.jsx(cF,{crossFrame:p,persistentFocus:u,autoFocus:l,disabled:i,onActivation:m,onDeactivation:h,returnFocus:g,children:s})};i3.displayName="FocusLock";var uF=w$?d.useLayoutEffect:d.useEffect;function A1(e,t=[]){const n=d.useRef(e);return uF(()=>{n.current=e}),d.useCallback((...r)=>{var o;return(o=n.current)==null?void 0:o.call(n,...r)},t)}function dF(e,t,n,r){const o=A1(t);return d.useEffect(()=>{var s;const i=(s=ZC(n))!=null?s:document;if(t)return i.addEventListener(e,o,r),()=>{i.removeEventListener(e,o,r)}},[e,n,r,o,t]),()=>{var s;((s=ZC(n))!=null?s:document).removeEventListener(e,o,r)}}function fF(e,t){const n=d.useId();return d.useMemo(()=>e||[t,n].filter(Boolean).join("-"),[e,t,n])}function pF(e,t){const n=e!==void 0;return[n,n&&typeof e<"u"?e:t]}function Lr(e={}){const{onClose:t,onOpen:n,isOpen:r,id:o}=e,s=A1(n),i=A1(t),[l,u]=d.useState(e.defaultIsOpen||!1),[p,m]=pF(r,l),h=fF(o,"disclosure"),g=d.useCallback(()=>{p||u(!1),i==null||i()},[p,i]),x=d.useCallback(()=>{p||u(!0),s==null||s()},[p,s]),y=d.useCallback(()=>{(m?g:x)()},[m,x,g]);return{isOpen:!!m,onOpen:x,onClose:g,onToggle:y,isControlled:p,getButtonProps:(b={})=>({...b,"aria-expanded":m,"aria-controls":h,onClick:BR(b.onClick,y)}),getDisclosureProps:(b={})=>({...b,hidden:!m,id:h})}}var[mF,hF]=Wt({name:"InputGroupStylesContext",errorMessage:`useInputGroupStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),l3=je(function(t,n){const r=Un("Input",t),{children:o,className:s,...i}=on(t),l=Ye("chakra-input__group",s),u={},p=kh(o),m=r.field;p.forEach(g=>{var x,y;r&&(m&&g.type.id==="InputLeftElement"&&(u.paddingStart=(x=m.height)!=null?x:m.h),m&&g.type.id==="InputRightElement"&&(u.paddingEnd=(y=m.height)!=null?y:m.h),g.type.id==="InputRightAddon"&&(u.borderEndRadius=0),g.type.id==="InputLeftAddon"&&(u.borderStartRadius=0))});const h=p.map(g=>{var x,y;const b=Z_({size:((x=g.props)==null?void 0:x.size)||t.size,variant:((y=g.props)==null?void 0:y.variant)||t.variant});return g.type.id!=="Input"?d.cloneElement(g,b):d.cloneElement(g,Object.assign(b,u,g.props))});return a.jsx(we.div,{className:l,ref:n,__css:{width:"100%",display:"flex",position:"relative",isolation:"isolate",...r.group},"data-group":!0,...i,children:a.jsx(mF,{value:r,children:h})})});l3.displayName="InputGroup";var gF=we("div",{baseStyle:{display:"flex",alignItems:"center",justifyContent:"center",position:"absolute",top:"0",zIndex:2}}),Eh=je(function(t,n){var r,o;const{placement:s="left",...i}=t,l=hF(),u=l.field,m={[s==="left"?"insetStart":"insetEnd"]:"0",width:(r=u==null?void 0:u.height)!=null?r:u==null?void 0:u.h,height:(o=u==null?void 0:u.height)!=null?o:u==null?void 0:u.h,fontSize:u==null?void 0:u.fontSize,...l.element};return a.jsx(gF,{ref:n,__css:m,...i})});Eh.id="InputElement";Eh.displayName="InputElement";var c3=je(function(t,n){const{className:r,...o}=t,s=Ye("chakra-input__left-element",r);return a.jsx(Eh,{ref:n,placement:"left",className:s,...o})});c3.id="InputLeftElement";c3.displayName="InputLeftElement";var Ib=je(function(t,n){const{className:r,...o}=t,s=Ye("chakra-input__right-element",r);return a.jsx(Eh,{ref:n,placement:"right",className:s,...o})});Ib.id="InputRightElement";Ib.displayName="InputRightElement";var Mh=je(function(t,n){const{htmlSize:r,...o}=t,s=Un("Input",o),i=on(o),l=db(i),u=Ye("chakra-input",t.className);return a.jsx(we.input,{size:r,...l,__css:s.field,ref:n,className:u})});Mh.displayName="Input";Mh.id="Input";var Oh=je(function(t,n){const r=oi("Link",t),{className:o,isExternal:s,...i}=on(t);return a.jsx(we.a,{target:s?"_blank":void 0,rel:s?"noopener":void 0,ref:n,className:Ye("chakra-link",o),...i,__css:r})});Oh.displayName="Link";var[vF,u3]=Wt({name:"ListStylesContext",errorMessage:`useListStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),Pb=je(function(t,n){const r=Un("List",t),{children:o,styleType:s="none",stylePosition:i,spacing:l,...u}=on(t),p=kh(o),h=l?{["& > *:not(style) ~ *:not(style)"]:{mt:l}}:{};return a.jsx(vF,{value:r,children:a.jsx(we.ul,{ref:n,listStyleType:s,listStylePosition:i,role:"list",__css:{...r.container,...h},...u,children:p})})});Pb.displayName="List";var d3=je((e,t)=>{const{as:n,...r}=e;return a.jsx(Pb,{ref:t,as:"ol",styleType:"decimal",marginStart:"1em",...r})});d3.displayName="OrderedList";var Od=je(function(t,n){const{as:r,...o}=t;return a.jsx(Pb,{ref:n,as:"ul",styleType:"initial",marginStart:"1em",...o})});Od.displayName="UnorderedList";var Qr=je(function(t,n){const r=u3();return a.jsx(we.li,{ref:n,...t,__css:r.item})});Qr.displayName="ListItem";var xF=je(function(t,n){const r=u3();return a.jsx(Tn,{ref:n,role:"presentation",...t,__css:r.icon})});xF.displayName="ListIcon";var Ja=je(function(t,n){const{templateAreas:r,gap:o,rowGap:s,columnGap:i,column:l,row:u,autoFlow:p,autoRows:m,templateRows:h,autoColumns:g,templateColumns:x,...y}=t,b={display:"grid",gridTemplateAreas:r,gridGap:o,gridRowGap:s,gridColumnGap:i,gridAutoColumns:g,gridColumn:l,gridRow:u,gridAutoFlow:p,gridAutoRows:m,gridTemplateRows:h,gridTemplateColumns:x};return a.jsx(we.div,{ref:n,__css:b,...y})});Ja.displayName="Grid";function f3(e,t){return Array.isArray(e)?e.map(n=>n===null?null:t(n)):a1(e)?Object.keys(e).reduce((n,r)=>(n[r]=t(e[r]),n),{}):e!=null?t(e):null}var ba=we("div",{baseStyle:{flex:1,justifySelf:"stretch",alignSelf:"stretch"}});ba.displayName="Spacer";var p3=e=>a.jsx(we.div,{className:"chakra-stack__item",...e,__css:{display:"inline-block",flex:"0 0 auto",minWidth:0,...e.__css}});p3.displayName="StackItem";function bF(e){const{spacing:t,direction:n}=e,r={column:{my:t,mx:0,borderLeftWidth:0,borderBottomWidth:"1px"},"column-reverse":{my:t,mx:0,borderLeftWidth:0,borderBottomWidth:"1px"},row:{mx:t,my:0,borderLeftWidth:"1px",borderBottomWidth:0},"row-reverse":{mx:t,my:0,borderLeftWidth:"1px",borderBottomWidth:0}};return{"&":f3(n,o=>r[o])}}var Eb=je((e,t)=>{const{isInline:n,direction:r,align:o,justify:s,spacing:i="0.5rem",wrap:l,children:u,divider:p,className:m,shouldWrapChildren:h,...g}=e,x=n?"row":r??"column",y=d.useMemo(()=>bF({spacing:i,direction:x}),[i,x]),b=!!p,w=!h&&!b,S=d.useMemo(()=>{const _=kh(u);return w?_:_.map((E,I)=>{const M=typeof E.key<"u"?E.key:I,R=I+1===_.length,A=h?a.jsx(p3,{children:E},M):E;if(!b)return A;const O=d.cloneElement(p,{__css:y}),T=R?null:O;return a.jsxs(d.Fragment,{children:[A,T]},M)})},[p,y,b,w,h,u]),j=Ye("chakra-stack",m);return a.jsx(we.div,{ref:t,display:"flex",alignItems:o,justifyContent:s,flexDirection:x,flexWrap:l,gap:b?void 0:i,className:j,...g,children:S})});Eb.displayName="Stack";var m3=je((e,t)=>a.jsx(Eb,{align:"center",...e,direction:"column",ref:t}));m3.displayName="VStack";var Rh=je((e,t)=>a.jsx(Eb,{align:"center",...e,direction:"row",ref:t}));Rh.displayName="HStack";function mS(e){return f3(e,t=>t==="auto"?"auto":`span ${t}/span ${t}`)}var Zu=je(function(t,n){const{area:r,colSpan:o,colStart:s,colEnd:i,rowEnd:l,rowSpan:u,rowStart:p,...m}=t,h=Z_({gridArea:r,gridColumn:mS(o),gridRow:mS(u),gridColumnStart:s,gridColumnEnd:i,gridRowStart:p,gridRowEnd:l});return a.jsx(we.div,{ref:n,__css:h,...m})});Zu.displayName="GridItem";var Ds=je(function(t,n){const r=oi("Badge",t),{className:o,...s}=on(t);return a.jsx(we.span,{ref:n,className:Ye("chakra-badge",t.className),...s,__css:{display:"inline-block",whiteSpace:"nowrap",verticalAlign:"middle",...r}})});Ds.displayName="Badge";var Yn=je(function(t,n){const{borderLeftWidth:r,borderBottomWidth:o,borderTopWidth:s,borderRightWidth:i,borderWidth:l,borderStyle:u,borderColor:p,...m}=oi("Divider",t),{className:h,orientation:g="horizontal",__css:x,...y}=on(t),b={vertical:{borderLeftWidth:r||i||l||"1px",height:"100%"},horizontal:{borderBottomWidth:o||s||l||"1px",width:"100%"}};return a.jsx(we.hr,{ref:n,"aria-orientation":g,...y,__css:{...m,border:"0",borderColor:p,borderStyle:u,...b[g],...x},className:Ye("chakra-divider",h)})});Yn.displayName="Divider";function yF(e){const{key:t}=e;return t.length===1||t.length>1&&/[^a-zA-Z0-9]/.test(t)}function CF(e={}){const{timeout:t=300,preventDefault:n=()=>!0}=e,[r,o]=d.useState([]),s=d.useRef(),i=()=>{s.current&&(clearTimeout(s.current),s.current=null)},l=()=>{i(),s.current=setTimeout(()=>{o([]),s.current=null},t)};d.useEffect(()=>i,[]);function u(p){return m=>{if(m.key==="Backspace"){const h=[...r];h.pop(),o(h);return}if(yF(m)){const h=r.concat(m.key);n(m)&&(m.preventDefault(),m.stopPropagation()),o(h),p(h.join("")),l()}}}return u}function wF(e,t,n,r){if(t==null)return r;if(!r)return e.find(i=>n(i).toLowerCase().startsWith(t.toLowerCase()));const o=e.filter(s=>n(s).toLowerCase().startsWith(t.toLowerCase()));if(o.length>0){let s;return o.includes(r)?(s=o.indexOf(r)+1,s===o.length&&(s=0),o[s]):(s=e.indexOf(o[0]),e[s])}return r}function SF(){const e=d.useRef(new Map),t=e.current,n=d.useCallback((o,s,i,l)=>{e.current.set(i,{type:s,el:o,options:l}),o.addEventListener(s,i,l)},[]),r=d.useCallback((o,s,i,l)=>{o.removeEventListener(s,i,l),e.current.delete(i)},[]);return d.useEffect(()=>()=>{t.forEach((o,s)=>{r(o.el,o.type,s,o.options)})},[r,t]),{add:n,remove:r}}function dv(e){const t=e.target,{tagName:n,isContentEditable:r}=t;return n!=="INPUT"&&n!=="TEXTAREA"&&r!==!0}function h3(e={}){const{ref:t,isDisabled:n,isFocusable:r,clickOnEnter:o=!0,clickOnSpace:s=!0,onMouseDown:i,onMouseUp:l,onClick:u,onKeyDown:p,onKeyUp:m,tabIndex:h,onMouseOver:g,onMouseLeave:x,...y}=e,[b,w]=d.useState(!0),[S,j]=d.useState(!1),_=SF(),E=$=>{$&&$.tagName!=="BUTTON"&&w(!1)},I=b?h:h||0,M=n&&!r,R=d.useCallback($=>{if(n){$.stopPropagation(),$.preventDefault();return}$.currentTarget.focus(),u==null||u($)},[n,u]),D=d.useCallback($=>{S&&dv($)&&($.preventDefault(),$.stopPropagation(),j(!1),_.remove(document,"keyup",D,!1))},[S,_]),A=d.useCallback($=>{if(p==null||p($),n||$.defaultPrevented||$.metaKey||!dv($.nativeEvent)||b)return;const q=o&&$.key==="Enter";s&&$.key===" "&&($.preventDefault(),j(!0)),q&&($.preventDefault(),$.currentTarget.click()),_.add(document,"keyup",D,!1)},[n,b,p,o,s,_,D]),O=d.useCallback($=>{if(m==null||m($),n||$.defaultPrevented||$.metaKey||!dv($.nativeEvent)||b)return;s&&$.key===" "&&($.preventDefault(),j(!1),$.currentTarget.click())},[s,b,n,m]),T=d.useCallback($=>{$.button===0&&(j(!1),_.remove(document,"mouseup",T,!1))},[_]),X=d.useCallback($=>{if($.button!==0)return;if(n){$.stopPropagation(),$.preventDefault();return}b||j(!0),$.currentTarget.focus({preventScroll:!0}),_.add(document,"mouseup",T,!1),i==null||i($)},[n,b,i,_,T]),B=d.useCallback($=>{$.button===0&&(b||j(!1),l==null||l($))},[l,b]),V=d.useCallback($=>{if(n){$.preventDefault();return}g==null||g($)},[n,g]),U=d.useCallback($=>{S&&($.preventDefault(),j(!1)),x==null||x($)},[S,x]),N=It(t,E);return b?{...y,ref:N,type:"button","aria-disabled":M?void 0:n,disabled:M,onClick:R,onMouseDown:i,onMouseUp:l,onKeyUp:m,onKeyDown:p,onMouseOver:g,onMouseLeave:x}:{...y,ref:N,role:"button","data-active":dt(S),"aria-disabled":n?"true":void 0,tabIndex:M?void 0:I,onClick:R,onMouseDown:X,onMouseUp:B,onKeyUp:O,onKeyDown:A,onMouseOver:V,onMouseLeave:U}}function kF(e){const t=e.current;if(!t)return!1;const n=Jz(t);return!n||t.contains(n)?!1:!!sF(n)}function g3(e,t){const{shouldFocus:n,visible:r,focusRef:o}=t,s=n&&!r;pa(()=>{if(!s||kF(e))return;const i=(o==null?void 0:o.current)||e.current;let l;if(i)return l=requestAnimationFrame(()=>{i.focus({preventScroll:!0})}),()=>{cancelAnimationFrame(l)}},[s,e,o])}var jF={preventScroll:!0,shouldFocus:!1};function _F(e,t=jF){const{focusRef:n,preventScroll:r,shouldFocus:o,visible:s}=t,i=IF(e)?e.current:e,l=o&&s,u=d.useRef(l),p=d.useRef(s);rc(()=>{!p.current&&s&&(u.current=l),p.current=s},[s,l]);const m=d.useCallback(()=>{if(!(!s||!i||!u.current)&&(u.current=!1,!i.contains(document.activeElement)))if(n!=null&&n.current)requestAnimationFrame(()=>{var h;(h=n.current)==null||h.focus({preventScroll:r})});else{const h=a3(i);h.length>0&&requestAnimationFrame(()=>{h[0].focus({preventScroll:r})})}},[s,r,i,n]);pa(()=>{m()},[m]),Ri(i,"transitionend",m)}function IF(e){return"current"in e}var Rl=(e,t)=>({var:e,varRef:t?`var(${e}, ${t})`:`var(${e})`}),Nn={arrowShadowColor:Rl("--popper-arrow-shadow-color"),arrowSize:Rl("--popper-arrow-size","8px"),arrowSizeHalf:Rl("--popper-arrow-size-half"),arrowBg:Rl("--popper-arrow-bg"),transformOrigin:Rl("--popper-transform-origin"),arrowOffset:Rl("--popper-arrow-offset")};function PF(e){if(e.includes("top"))return"1px 1px 0px 0 var(--popper-arrow-shadow-color)";if(e.includes("bottom"))return"-1px -1px 0px 0 var(--popper-arrow-shadow-color)";if(e.includes("right"))return"-1px 1px 0px 0 var(--popper-arrow-shadow-color)";if(e.includes("left"))return"1px -1px 0px 0 var(--popper-arrow-shadow-color)"}var EF={top:"bottom center","top-start":"bottom left","top-end":"bottom right",bottom:"top center","bottom-start":"top left","bottom-end":"top right",left:"right center","left-start":"right top","left-end":"right bottom",right:"left center","right-start":"left top","right-end":"left bottom"},MF=e=>EF[e],hS={scroll:!0,resize:!0};function OF(e){let t;return typeof e=="object"?t={enabled:!0,options:{...hS,...e}}:t={enabled:e,options:hS},t}var RF={name:"matchWidth",enabled:!0,phase:"beforeWrite",requires:["computeStyles"],fn:({state:e})=>{e.styles.popper.width=`${e.rects.reference.width}px`},effect:({state:e})=>()=>{const t=e.elements.reference;e.elements.popper.style.width=`${t.offsetWidth}px`}},DF={name:"transformOrigin",enabled:!0,phase:"write",fn:({state:e})=>{gS(e)},effect:({state:e})=>()=>{gS(e)}},gS=e=>{e.elements.popper.style.setProperty(Nn.transformOrigin.var,MF(e.placement))},AF={name:"positionArrow",enabled:!0,phase:"afterWrite",fn:({state:e})=>{TF(e)}},TF=e=>{var t;if(!e.placement)return;const n=NF(e.placement);if((t=e.elements)!=null&&t.arrow&&n){Object.assign(e.elements.arrow.style,{[n.property]:n.value,width:Nn.arrowSize.varRef,height:Nn.arrowSize.varRef,zIndex:-1});const r={[Nn.arrowSizeHalf.var]:`calc(${Nn.arrowSize.varRef} / 2 - 1px)`,[Nn.arrowOffset.var]:`calc(${Nn.arrowSizeHalf.varRef} * -1)`};for(const o in r)e.elements.arrow.style.setProperty(o,r[o])}},NF=e=>{if(e.startsWith("top"))return{property:"bottom",value:Nn.arrowOffset.varRef};if(e.startsWith("bottom"))return{property:"top",value:Nn.arrowOffset.varRef};if(e.startsWith("left"))return{property:"right",value:Nn.arrowOffset.varRef};if(e.startsWith("right"))return{property:"left",value:Nn.arrowOffset.varRef}},$F={name:"innerArrow",enabled:!0,phase:"main",requires:["arrow"],fn:({state:e})=>{vS(e)},effect:({state:e})=>()=>{vS(e)}},vS=e=>{if(!e.elements.arrow)return;const t=e.elements.arrow.querySelector("[data-popper-arrow-inner]");if(!t)return;const n=PF(e.placement);n&&t.style.setProperty("--popper-arrow-default-shadow",n),Object.assign(t.style,{transform:"rotate(45deg)",background:Nn.arrowBg.varRef,top:0,left:0,width:"100%",height:"100%",position:"absolute",zIndex:"inherit",boxShadow:"var(--popper-arrow-shadow, var(--popper-arrow-default-shadow))"})},LF={"start-start":{ltr:"left-start",rtl:"right-start"},"start-end":{ltr:"left-end",rtl:"right-end"},"end-start":{ltr:"right-start",rtl:"left-start"},"end-end":{ltr:"right-end",rtl:"left-end"},start:{ltr:"left",rtl:"right"},end:{ltr:"right",rtl:"left"}},zF={"auto-start":"auto-end","auto-end":"auto-start","top-start":"top-end","top-end":"top-start","bottom-start":"bottom-end","bottom-end":"bottom-start"};function FF(e,t="ltr"){var n,r;const o=((n=LF[e])==null?void 0:n[t])||e;return t==="ltr"?o:(r=zF[e])!=null?r:o}var Dr="top",ko="bottom",jo="right",Ar="left",Mb="auto",Rd=[Dr,ko,jo,Ar],xc="start",Ju="end",BF="clippingParents",v3="viewport",Cu="popper",HF="reference",xS=Rd.reduce(function(e,t){return e.concat([t+"-"+xc,t+"-"+Ju])},[]),x3=[].concat(Rd,[Mb]).reduce(function(e,t){return e.concat([t,t+"-"+xc,t+"-"+Ju])},[]),VF="beforeRead",WF="read",UF="afterRead",GF="beforeMain",KF="main",qF="afterMain",XF="beforeWrite",QF="write",YF="afterWrite",ZF=[VF,WF,UF,GF,KF,qF,XF,QF,YF];function ws(e){return e?(e.nodeName||"").toLowerCase():null}function no(e){if(e==null)return window;if(e.toString()!=="[object Window]"){var t=e.ownerDocument;return t&&t.defaultView||window}return e}function Wi(e){var t=no(e).Element;return e instanceof t||e instanceof Element}function wo(e){var t=no(e).HTMLElement;return e instanceof t||e instanceof HTMLElement}function Ob(e){if(typeof ShadowRoot>"u")return!1;var t=no(e).ShadowRoot;return e instanceof t||e instanceof ShadowRoot}function JF(e){var t=e.state;Object.keys(t.elements).forEach(function(n){var r=t.styles[n]||{},o=t.attributes[n]||{},s=t.elements[n];!wo(s)||!ws(s)||(Object.assign(s.style,r),Object.keys(o).forEach(function(i){var l=o[i];l===!1?s.removeAttribute(i):s.setAttribute(i,l===!0?"":l)}))})}function eB(e){var t=e.state,n={popper:{position:t.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(t.elements.popper.style,n.popper),t.styles=n,t.elements.arrow&&Object.assign(t.elements.arrow.style,n.arrow),function(){Object.keys(t.elements).forEach(function(r){var o=t.elements[r],s=t.attributes[r]||{},i=Object.keys(t.styles.hasOwnProperty(r)?t.styles[r]:n[r]),l=i.reduce(function(u,p){return u[p]="",u},{});!wo(o)||!ws(o)||(Object.assign(o.style,l),Object.keys(s).forEach(function(u){o.removeAttribute(u)}))})}}const tB={name:"applyStyles",enabled:!0,phase:"write",fn:JF,effect:eB,requires:["computeStyles"]};function Cs(e){return e.split("-")[0]}var Di=Math.max,lm=Math.min,bc=Math.round;function T1(){var e=navigator.userAgentData;return e!=null&&e.brands&&Array.isArray(e.brands)?e.brands.map(function(t){return t.brand+"/"+t.version}).join(" "):navigator.userAgent}function b3(){return!/^((?!chrome|android).)*safari/i.test(T1())}function yc(e,t,n){t===void 0&&(t=!1),n===void 0&&(n=!1);var r=e.getBoundingClientRect(),o=1,s=1;t&&wo(e)&&(o=e.offsetWidth>0&&bc(r.width)/e.offsetWidth||1,s=e.offsetHeight>0&&bc(r.height)/e.offsetHeight||1);var i=Wi(e)?no(e):window,l=i.visualViewport,u=!b3()&&n,p=(r.left+(u&&l?l.offsetLeft:0))/o,m=(r.top+(u&&l?l.offsetTop:0))/s,h=r.width/o,g=r.height/s;return{width:h,height:g,top:m,right:p+h,bottom:m+g,left:p,x:p,y:m}}function Rb(e){var t=yc(e),n=e.offsetWidth,r=e.offsetHeight;return Math.abs(t.width-n)<=1&&(n=t.width),Math.abs(t.height-r)<=1&&(r=t.height),{x:e.offsetLeft,y:e.offsetTop,width:n,height:r}}function y3(e,t){var n=t.getRootNode&&t.getRootNode();if(e.contains(t))return!0;if(n&&Ob(n)){var r=t;do{if(r&&e.isSameNode(r))return!0;r=r.parentNode||r.host}while(r)}return!1}function aa(e){return no(e).getComputedStyle(e)}function nB(e){return["table","td","th"].indexOf(ws(e))>=0}function si(e){return((Wi(e)?e.ownerDocument:e.document)||window.document).documentElement}function Dh(e){return ws(e)==="html"?e:e.assignedSlot||e.parentNode||(Ob(e)?e.host:null)||si(e)}function bS(e){return!wo(e)||aa(e).position==="fixed"?null:e.offsetParent}function rB(e){var t=/firefox/i.test(T1()),n=/Trident/i.test(T1());if(n&&wo(e)){var r=aa(e);if(r.position==="fixed")return null}var o=Dh(e);for(Ob(o)&&(o=o.host);wo(o)&&["html","body"].indexOf(ws(o))<0;){var s=aa(o);if(s.transform!=="none"||s.perspective!=="none"||s.contain==="paint"||["transform","perspective"].indexOf(s.willChange)!==-1||t&&s.willChange==="filter"||t&&s.filter&&s.filter!=="none")return o;o=o.parentNode}return null}function Dd(e){for(var t=no(e),n=bS(e);n&&nB(n)&&aa(n).position==="static";)n=bS(n);return n&&(ws(n)==="html"||ws(n)==="body"&&aa(n).position==="static")?t:n||rB(e)||t}function Db(e){return["top","bottom"].indexOf(e)>=0?"x":"y"}function Fu(e,t,n){return Di(e,lm(t,n))}function oB(e,t,n){var r=Fu(e,t,n);return r>n?n:r}function C3(){return{top:0,right:0,bottom:0,left:0}}function w3(e){return Object.assign({},C3(),e)}function S3(e,t){return t.reduce(function(n,r){return n[r]=e,n},{})}var sB=function(t,n){return t=typeof t=="function"?t(Object.assign({},n.rects,{placement:n.placement})):t,w3(typeof t!="number"?t:S3(t,Rd))};function aB(e){var t,n=e.state,r=e.name,o=e.options,s=n.elements.arrow,i=n.modifiersData.popperOffsets,l=Cs(n.placement),u=Db(l),p=[Ar,jo].indexOf(l)>=0,m=p?"height":"width";if(!(!s||!i)){var h=sB(o.padding,n),g=Rb(s),x=u==="y"?Dr:Ar,y=u==="y"?ko:jo,b=n.rects.reference[m]+n.rects.reference[u]-i[u]-n.rects.popper[m],w=i[u]-n.rects.reference[u],S=Dd(s),j=S?u==="y"?S.clientHeight||0:S.clientWidth||0:0,_=b/2-w/2,E=h[x],I=j-g[m]-h[y],M=j/2-g[m]/2+_,R=Fu(E,M,I),D=u;n.modifiersData[r]=(t={},t[D]=R,t.centerOffset=R-M,t)}}function iB(e){var t=e.state,n=e.options,r=n.element,o=r===void 0?"[data-popper-arrow]":r;o!=null&&(typeof o=="string"&&(o=t.elements.popper.querySelector(o),!o)||y3(t.elements.popper,o)&&(t.elements.arrow=o))}const lB={name:"arrow",enabled:!0,phase:"main",fn:aB,effect:iB,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function Cc(e){return e.split("-")[1]}var cB={top:"auto",right:"auto",bottom:"auto",left:"auto"};function uB(e,t){var n=e.x,r=e.y,o=t.devicePixelRatio||1;return{x:bc(n*o)/o||0,y:bc(r*o)/o||0}}function yS(e){var t,n=e.popper,r=e.popperRect,o=e.placement,s=e.variation,i=e.offsets,l=e.position,u=e.gpuAcceleration,p=e.adaptive,m=e.roundOffsets,h=e.isFixed,g=i.x,x=g===void 0?0:g,y=i.y,b=y===void 0?0:y,w=typeof m=="function"?m({x,y:b}):{x,y:b};x=w.x,b=w.y;var S=i.hasOwnProperty("x"),j=i.hasOwnProperty("y"),_=Ar,E=Dr,I=window;if(p){var M=Dd(n),R="clientHeight",D="clientWidth";if(M===no(n)&&(M=si(n),aa(M).position!=="static"&&l==="absolute"&&(R="scrollHeight",D="scrollWidth")),M=M,o===Dr||(o===Ar||o===jo)&&s===Ju){E=ko;var A=h&&M===I&&I.visualViewport?I.visualViewport.height:M[R];b-=A-r.height,b*=u?1:-1}if(o===Ar||(o===Dr||o===ko)&&s===Ju){_=jo;var O=h&&M===I&&I.visualViewport?I.visualViewport.width:M[D];x-=O-r.width,x*=u?1:-1}}var T=Object.assign({position:l},p&&cB),X=m===!0?uB({x,y:b},no(n)):{x,y:b};if(x=X.x,b=X.y,u){var B;return Object.assign({},T,(B={},B[E]=j?"0":"",B[_]=S?"0":"",B.transform=(I.devicePixelRatio||1)<=1?"translate("+x+"px, "+b+"px)":"translate3d("+x+"px, "+b+"px, 0)",B))}return Object.assign({},T,(t={},t[E]=j?b+"px":"",t[_]=S?x+"px":"",t.transform="",t))}function dB(e){var t=e.state,n=e.options,r=n.gpuAcceleration,o=r===void 0?!0:r,s=n.adaptive,i=s===void 0?!0:s,l=n.roundOffsets,u=l===void 0?!0:l,p={placement:Cs(t.placement),variation:Cc(t.placement),popper:t.elements.popper,popperRect:t.rects.popper,gpuAcceleration:o,isFixed:t.options.strategy==="fixed"};t.modifiersData.popperOffsets!=null&&(t.styles.popper=Object.assign({},t.styles.popper,yS(Object.assign({},p,{offsets:t.modifiersData.popperOffsets,position:t.options.strategy,adaptive:i,roundOffsets:u})))),t.modifiersData.arrow!=null&&(t.styles.arrow=Object.assign({},t.styles.arrow,yS(Object.assign({},p,{offsets:t.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:u})))),t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-placement":t.placement})}const fB={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:dB,data:{}};var Jf={passive:!0};function pB(e){var t=e.state,n=e.instance,r=e.options,o=r.scroll,s=o===void 0?!0:o,i=r.resize,l=i===void 0?!0:i,u=no(t.elements.popper),p=[].concat(t.scrollParents.reference,t.scrollParents.popper);return s&&p.forEach(function(m){m.addEventListener("scroll",n.update,Jf)}),l&&u.addEventListener("resize",n.update,Jf),function(){s&&p.forEach(function(m){m.removeEventListener("scroll",n.update,Jf)}),l&&u.removeEventListener("resize",n.update,Jf)}}const mB={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:pB,data:{}};var hB={left:"right",right:"left",bottom:"top",top:"bottom"};function Np(e){return e.replace(/left|right|bottom|top/g,function(t){return hB[t]})}var gB={start:"end",end:"start"};function CS(e){return e.replace(/start|end/g,function(t){return gB[t]})}function Ab(e){var t=no(e),n=t.pageXOffset,r=t.pageYOffset;return{scrollLeft:n,scrollTop:r}}function Tb(e){return yc(si(e)).left+Ab(e).scrollLeft}function vB(e,t){var n=no(e),r=si(e),o=n.visualViewport,s=r.clientWidth,i=r.clientHeight,l=0,u=0;if(o){s=o.width,i=o.height;var p=b3();(p||!p&&t==="fixed")&&(l=o.offsetLeft,u=o.offsetTop)}return{width:s,height:i,x:l+Tb(e),y:u}}function xB(e){var t,n=si(e),r=Ab(e),o=(t=e.ownerDocument)==null?void 0:t.body,s=Di(n.scrollWidth,n.clientWidth,o?o.scrollWidth:0,o?o.clientWidth:0),i=Di(n.scrollHeight,n.clientHeight,o?o.scrollHeight:0,o?o.clientHeight:0),l=-r.scrollLeft+Tb(e),u=-r.scrollTop;return aa(o||n).direction==="rtl"&&(l+=Di(n.clientWidth,o?o.clientWidth:0)-s),{width:s,height:i,x:l,y:u}}function Nb(e){var t=aa(e),n=t.overflow,r=t.overflowX,o=t.overflowY;return/auto|scroll|overlay|hidden/.test(n+o+r)}function k3(e){return["html","body","#document"].indexOf(ws(e))>=0?e.ownerDocument.body:wo(e)&&Nb(e)?e:k3(Dh(e))}function Bu(e,t){var n;t===void 0&&(t=[]);var r=k3(e),o=r===((n=e.ownerDocument)==null?void 0:n.body),s=no(r),i=o?[s].concat(s.visualViewport||[],Nb(r)?r:[]):r,l=t.concat(i);return o?l:l.concat(Bu(Dh(i)))}function N1(e){return Object.assign({},e,{left:e.x,top:e.y,right:e.x+e.width,bottom:e.y+e.height})}function bB(e,t){var n=yc(e,!1,t==="fixed");return n.top=n.top+e.clientTop,n.left=n.left+e.clientLeft,n.bottom=n.top+e.clientHeight,n.right=n.left+e.clientWidth,n.width=e.clientWidth,n.height=e.clientHeight,n.x=n.left,n.y=n.top,n}function wS(e,t,n){return t===v3?N1(vB(e,n)):Wi(t)?bB(t,n):N1(xB(si(e)))}function yB(e){var t=Bu(Dh(e)),n=["absolute","fixed"].indexOf(aa(e).position)>=0,r=n&&wo(e)?Dd(e):e;return Wi(r)?t.filter(function(o){return Wi(o)&&y3(o,r)&&ws(o)!=="body"}):[]}function CB(e,t,n,r){var o=t==="clippingParents"?yB(e):[].concat(t),s=[].concat(o,[n]),i=s[0],l=s.reduce(function(u,p){var m=wS(e,p,r);return u.top=Di(m.top,u.top),u.right=lm(m.right,u.right),u.bottom=lm(m.bottom,u.bottom),u.left=Di(m.left,u.left),u},wS(e,i,r));return l.width=l.right-l.left,l.height=l.bottom-l.top,l.x=l.left,l.y=l.top,l}function j3(e){var t=e.reference,n=e.element,r=e.placement,o=r?Cs(r):null,s=r?Cc(r):null,i=t.x+t.width/2-n.width/2,l=t.y+t.height/2-n.height/2,u;switch(o){case Dr:u={x:i,y:t.y-n.height};break;case ko:u={x:i,y:t.y+t.height};break;case jo:u={x:t.x+t.width,y:l};break;case Ar:u={x:t.x-n.width,y:l};break;default:u={x:t.x,y:t.y}}var p=o?Db(o):null;if(p!=null){var m=p==="y"?"height":"width";switch(s){case xc:u[p]=u[p]-(t[m]/2-n[m]/2);break;case Ju:u[p]=u[p]+(t[m]/2-n[m]/2);break}}return u}function ed(e,t){t===void 0&&(t={});var n=t,r=n.placement,o=r===void 0?e.placement:r,s=n.strategy,i=s===void 0?e.strategy:s,l=n.boundary,u=l===void 0?BF:l,p=n.rootBoundary,m=p===void 0?v3:p,h=n.elementContext,g=h===void 0?Cu:h,x=n.altBoundary,y=x===void 0?!1:x,b=n.padding,w=b===void 0?0:b,S=w3(typeof w!="number"?w:S3(w,Rd)),j=g===Cu?HF:Cu,_=e.rects.popper,E=e.elements[y?j:g],I=CB(Wi(E)?E:E.contextElement||si(e.elements.popper),u,m,i),M=yc(e.elements.reference),R=j3({reference:M,element:_,strategy:"absolute",placement:o}),D=N1(Object.assign({},_,R)),A=g===Cu?D:M,O={top:I.top-A.top+S.top,bottom:A.bottom-I.bottom+S.bottom,left:I.left-A.left+S.left,right:A.right-I.right+S.right},T=e.modifiersData.offset;if(g===Cu&&T){var X=T[o];Object.keys(O).forEach(function(B){var V=[jo,ko].indexOf(B)>=0?1:-1,U=[Dr,ko].indexOf(B)>=0?"y":"x";O[B]+=X[U]*V})}return O}function wB(e,t){t===void 0&&(t={});var n=t,r=n.placement,o=n.boundary,s=n.rootBoundary,i=n.padding,l=n.flipVariations,u=n.allowedAutoPlacements,p=u===void 0?x3:u,m=Cc(r),h=m?l?xS:xS.filter(function(y){return Cc(y)===m}):Rd,g=h.filter(function(y){return p.indexOf(y)>=0});g.length===0&&(g=h);var x=g.reduce(function(y,b){return y[b]=ed(e,{placement:b,boundary:o,rootBoundary:s,padding:i})[Cs(b)],y},{});return Object.keys(x).sort(function(y,b){return x[y]-x[b]})}function SB(e){if(Cs(e)===Mb)return[];var t=Np(e);return[CS(e),t,CS(t)]}function kB(e){var t=e.state,n=e.options,r=e.name;if(!t.modifiersData[r]._skip){for(var o=n.mainAxis,s=o===void 0?!0:o,i=n.altAxis,l=i===void 0?!0:i,u=n.fallbackPlacements,p=n.padding,m=n.boundary,h=n.rootBoundary,g=n.altBoundary,x=n.flipVariations,y=x===void 0?!0:x,b=n.allowedAutoPlacements,w=t.options.placement,S=Cs(w),j=S===w,_=u||(j||!y?[Np(w)]:SB(w)),E=[w].concat(_).reduce(function(re,G){return re.concat(Cs(G)===Mb?wB(t,{placement:G,boundary:m,rootBoundary:h,padding:p,flipVariations:y,allowedAutoPlacements:b}):G)},[]),I=t.rects.reference,M=t.rects.popper,R=new Map,D=!0,A=E[0],O=0;O=0,U=V?"width":"height",N=ed(t,{placement:T,boundary:m,rootBoundary:h,altBoundary:g,padding:p}),$=V?B?jo:Ar:B?ko:Dr;I[U]>M[U]&&($=Np($));var q=Np($),F=[];if(s&&F.push(N[X]<=0),l&&F.push(N[$]<=0,N[q]<=0),F.every(function(re){return re})){A=T,D=!1;break}R.set(T,F)}if(D)for(var Q=y?3:1,Y=function(G){var K=E.find(function(ee){var ce=R.get(ee);if(ce)return ce.slice(0,G).every(function(J){return J})});if(K)return A=K,"break"},se=Q;se>0;se--){var ae=Y(se);if(ae==="break")break}t.placement!==A&&(t.modifiersData[r]._skip=!0,t.placement=A,t.reset=!0)}}const jB={name:"flip",enabled:!0,phase:"main",fn:kB,requiresIfExists:["offset"],data:{_skip:!1}};function SS(e,t,n){return n===void 0&&(n={x:0,y:0}),{top:e.top-t.height-n.y,right:e.right-t.width+n.x,bottom:e.bottom-t.height+n.y,left:e.left-t.width-n.x}}function kS(e){return[Dr,jo,ko,Ar].some(function(t){return e[t]>=0})}function _B(e){var t=e.state,n=e.name,r=t.rects.reference,o=t.rects.popper,s=t.modifiersData.preventOverflow,i=ed(t,{elementContext:"reference"}),l=ed(t,{altBoundary:!0}),u=SS(i,r),p=SS(l,o,s),m=kS(u),h=kS(p);t.modifiersData[n]={referenceClippingOffsets:u,popperEscapeOffsets:p,isReferenceHidden:m,hasPopperEscaped:h},t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-reference-hidden":m,"data-popper-escaped":h})}const IB={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:_B};function PB(e,t,n){var r=Cs(e),o=[Ar,Dr].indexOf(r)>=0?-1:1,s=typeof n=="function"?n(Object.assign({},t,{placement:e})):n,i=s[0],l=s[1];return i=i||0,l=(l||0)*o,[Ar,jo].indexOf(r)>=0?{x:l,y:i}:{x:i,y:l}}function EB(e){var t=e.state,n=e.options,r=e.name,o=n.offset,s=o===void 0?[0,0]:o,i=x3.reduce(function(m,h){return m[h]=PB(h,t.rects,s),m},{}),l=i[t.placement],u=l.x,p=l.y;t.modifiersData.popperOffsets!=null&&(t.modifiersData.popperOffsets.x+=u,t.modifiersData.popperOffsets.y+=p),t.modifiersData[r]=i}const MB={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:EB};function OB(e){var t=e.state,n=e.name;t.modifiersData[n]=j3({reference:t.rects.reference,element:t.rects.popper,strategy:"absolute",placement:t.placement})}const RB={name:"popperOffsets",enabled:!0,phase:"read",fn:OB,data:{}};function DB(e){return e==="x"?"y":"x"}function AB(e){var t=e.state,n=e.options,r=e.name,o=n.mainAxis,s=o===void 0?!0:o,i=n.altAxis,l=i===void 0?!1:i,u=n.boundary,p=n.rootBoundary,m=n.altBoundary,h=n.padding,g=n.tether,x=g===void 0?!0:g,y=n.tetherOffset,b=y===void 0?0:y,w=ed(t,{boundary:u,rootBoundary:p,padding:h,altBoundary:m}),S=Cs(t.placement),j=Cc(t.placement),_=!j,E=Db(S),I=DB(E),M=t.modifiersData.popperOffsets,R=t.rects.reference,D=t.rects.popper,A=typeof b=="function"?b(Object.assign({},t.rects,{placement:t.placement})):b,O=typeof A=="number"?{mainAxis:A,altAxis:A}:Object.assign({mainAxis:0,altAxis:0},A),T=t.modifiersData.offset?t.modifiersData.offset[t.placement]:null,X={x:0,y:0};if(M){if(s){var B,V=E==="y"?Dr:Ar,U=E==="y"?ko:jo,N=E==="y"?"height":"width",$=M[E],q=$+w[V],F=$-w[U],Q=x?-D[N]/2:0,Y=j===xc?R[N]:D[N],se=j===xc?-D[N]:-R[N],ae=t.elements.arrow,re=x&&ae?Rb(ae):{width:0,height:0},G=t.modifiersData["arrow#persistent"]?t.modifiersData["arrow#persistent"].padding:C3(),K=G[V],ee=G[U],ce=Fu(0,R[N],re[N]),J=_?R[N]/2-Q-ce-K-O.mainAxis:Y-ce-K-O.mainAxis,ie=_?-R[N]/2+Q+ce+ee+O.mainAxis:se+ce+ee+O.mainAxis,de=t.elements.arrow&&Dd(t.elements.arrow),ge=de?E==="y"?de.clientTop||0:de.clientLeft||0:0,Ce=(B=T==null?void 0:T[E])!=null?B:0,he=$+J-Ce-ge,fe=$+ie-Ce,Oe=Fu(x?lm(q,he):q,$,x?Di(F,fe):F);M[E]=Oe,X[E]=Oe-$}if(l){var _e,Ne=E==="x"?Dr:Ar,nt=E==="x"?ko:jo,$e=M[I],Pt=I==="y"?"height":"width",Ze=$e+w[Ne],ot=$e-w[nt],ye=[Dr,Ar].indexOf(S)!==-1,De=(_e=T==null?void 0:T[I])!=null?_e:0,ut=ye?Ze:$e-R[Pt]-D[Pt]-De+O.altAxis,bt=ye?$e+R[Pt]+D[Pt]-De-O.altAxis:ot,be=x&&ye?oB(ut,$e,bt):Fu(x?ut:Ze,$e,x?bt:ot);M[I]=be,X[I]=be-$e}t.modifiersData[r]=X}}const TB={name:"preventOverflow",enabled:!0,phase:"main",fn:AB,requiresIfExists:["offset"]};function NB(e){return{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}}function $B(e){return e===no(e)||!wo(e)?Ab(e):NB(e)}function LB(e){var t=e.getBoundingClientRect(),n=bc(t.width)/e.offsetWidth||1,r=bc(t.height)/e.offsetHeight||1;return n!==1||r!==1}function zB(e,t,n){n===void 0&&(n=!1);var r=wo(t),o=wo(t)&&LB(t),s=si(t),i=yc(e,o,n),l={scrollLeft:0,scrollTop:0},u={x:0,y:0};return(r||!r&&!n)&&((ws(t)!=="body"||Nb(s))&&(l=$B(t)),wo(t)?(u=yc(t,!0),u.x+=t.clientLeft,u.y+=t.clientTop):s&&(u.x=Tb(s))),{x:i.left+l.scrollLeft-u.x,y:i.top+l.scrollTop-u.y,width:i.width,height:i.height}}function FB(e){var t=new Map,n=new Set,r=[];e.forEach(function(s){t.set(s.name,s)});function o(s){n.add(s.name);var i=[].concat(s.requires||[],s.requiresIfExists||[]);i.forEach(function(l){if(!n.has(l)){var u=t.get(l);u&&o(u)}}),r.push(s)}return e.forEach(function(s){n.has(s.name)||o(s)}),r}function BB(e){var t=FB(e);return ZF.reduce(function(n,r){return n.concat(t.filter(function(o){return o.phase===r}))},[])}function HB(e){var t;return function(){return t||(t=new Promise(function(n){Promise.resolve().then(function(){t=void 0,n(e())})})),t}}function VB(e){var t=e.reduce(function(n,r){var o=n[r.name];return n[r.name]=o?Object.assign({},o,r,{options:Object.assign({},o.options,r.options),data:Object.assign({},o.data,r.data)}):r,n},{});return Object.keys(t).map(function(n){return t[n]})}var jS={placement:"bottom",modifiers:[],strategy:"absolute"};function _S(){for(var e=arguments.length,t=new Array(e),n=0;n{}),_=d.useCallback(()=>{var O;!t||!y.current||!b.current||((O=j.current)==null||O.call(j),w.current=GB(y.current,b.current,{placement:S,modifiers:[$F,AF,DF,{...RF,enabled:!!g},{name:"eventListeners",...OF(i)},{name:"arrow",options:{padding:s}},{name:"offset",options:{offset:l??[0,u]}},{name:"flip",enabled:!!p,options:{padding:8}},{name:"preventOverflow",enabled:!!h,options:{boundary:m}},...n??[]],strategy:o}),w.current.forceUpdate(),j.current=w.current.destroy)},[S,t,n,g,i,s,l,u,p,h,m,o]);d.useEffect(()=>()=>{var O;!y.current&&!b.current&&((O=w.current)==null||O.destroy(),w.current=null)},[]);const E=d.useCallback(O=>{y.current=O,_()},[_]),I=d.useCallback((O={},T=null)=>({...O,ref:It(E,T)}),[E]),M=d.useCallback(O=>{b.current=O,_()},[_]),R=d.useCallback((O={},T=null)=>({...O,ref:It(M,T),style:{...O.style,position:o,minWidth:g?void 0:"max-content",inset:"0 auto auto 0"}}),[o,M,g]),D=d.useCallback((O={},T=null)=>{const{size:X,shadowColor:B,bg:V,style:U,...N}=O;return{...N,ref:T,"data-popper-arrow":"",style:KB(O)}},[]),A=d.useCallback((O={},T=null)=>({...O,ref:T,"data-popper-arrow-inner":""}),[]);return{update(){var O;(O=w.current)==null||O.update()},forceUpdate(){var O;(O=w.current)==null||O.forceUpdate()},transformOrigin:Nn.transformOrigin.varRef,referenceRef:E,popperRef:M,getPopperProps:R,getArrowProps:D,getArrowInnerProps:A,getReferenceProps:I}}function KB(e){const{size:t,shadowColor:n,bg:r,style:o}=e,s={...o,position:"absolute"};return t&&(s["--popper-arrow-size"]=t),n&&(s["--popper-arrow-shadow-color"]=n),r&&(s["--popper-arrow-bg"]=r),s}function Lb(e={}){const{onClose:t,onOpen:n,isOpen:r,id:o}=e,s=un(n),i=un(t),[l,u]=d.useState(e.defaultIsOpen||!1),p=r!==void 0?r:l,m=r!==void 0,h=d.useId(),g=o??`disclosure-${h}`,x=d.useCallback(()=>{m||u(!1),i==null||i()},[m,i]),y=d.useCallback(()=>{m||u(!0),s==null||s()},[m,s]),b=d.useCallback(()=>{p?x():y()},[p,y,x]);function w(j={}){return{...j,"aria-expanded":p,"aria-controls":g,onClick(_){var E;(E=j.onClick)==null||E.call(j,_),b()}}}function S(j={}){return{...j,hidden:!p,id:g}}return{isOpen:p,onOpen:y,onClose:x,onToggle:b,isControlled:m,getButtonProps:w,getDisclosureProps:S}}function qB(e){const{ref:t,handler:n,enabled:r=!0}=e,o=un(n),i=d.useRef({isPointerDown:!1,ignoreEmulatedMouseEvents:!1}).current;d.useEffect(()=>{if(!r)return;const l=h=>{fv(h,t)&&(i.isPointerDown=!0)},u=h=>{if(i.ignoreEmulatedMouseEvents){i.ignoreEmulatedMouseEvents=!1;return}i.isPointerDown&&n&&fv(h,t)&&(i.isPointerDown=!1,o(h))},p=h=>{i.ignoreEmulatedMouseEvents=!0,n&&i.isPointerDown&&fv(h,t)&&(i.isPointerDown=!1,o(h))},m=_3(t.current);return m.addEventListener("mousedown",l,!0),m.addEventListener("mouseup",u,!0),m.addEventListener("touchstart",l,!0),m.addEventListener("touchend",p,!0),()=>{m.removeEventListener("mousedown",l,!0),m.removeEventListener("mouseup",u,!0),m.removeEventListener("touchstart",l,!0),m.removeEventListener("touchend",p,!0)}},[n,t,o,i,r])}function fv(e,t){var n;const r=e.target;return r&&!_3(r).contains(r)?!1:!((n=t.current)!=null&&n.contains(r))}function _3(e){var t;return(t=e==null?void 0:e.ownerDocument)!=null?t:document}function I3(e){const{isOpen:t,ref:n}=e,[r,o]=d.useState(t),[s,i]=d.useState(!1);return d.useEffect(()=>{s||(o(t),i(!0))},[t,s,r]),Ri(()=>n.current,"animationend",()=>{o(t)}),{present:!(t?!1:!r),onComplete(){var u;const p=Zz(n.current),m=new p.CustomEvent("animationend",{bubbles:!0});(u=n.current)==null||u.dispatchEvent(m)}}}function zb(e){const{wasSelected:t,enabled:n,isSelected:r,mode:o="unmount"}=e;return!!(!n||r||o==="keepMounted"&&t)}var[XB,QB,YB,ZB]=lb(),[JB,Ad]=Wt({strict:!1,name:"MenuContext"});function eH(e,...t){const n=d.useId(),r=e||n;return d.useMemo(()=>t.map(o=>`${o}-${r}`),[r,t])}function P3(e){var t;return(t=e==null?void 0:e.ownerDocument)!=null?t:document}function IS(e){return P3(e).activeElement===e}function tH(e={}){const{id:t,closeOnSelect:n=!0,closeOnBlur:r=!0,initialFocusRef:o,autoSelect:s=!0,isLazy:i,isOpen:l,defaultIsOpen:u,onClose:p,onOpen:m,placement:h="bottom-start",lazyBehavior:g="unmount",direction:x,computePositionOnMount:y=!1,...b}=e,w=d.useRef(null),S=d.useRef(null),j=YB(),_=d.useCallback(()=>{requestAnimationFrame(()=>{var ae;(ae=w.current)==null||ae.focus({preventScroll:!1})})},[]),E=d.useCallback(()=>{const ae=setTimeout(()=>{var re;if(o)(re=o.current)==null||re.focus();else{const G=j.firstEnabled();G&&B(G.index)}});q.current.add(ae)},[j,o]),I=d.useCallback(()=>{const ae=setTimeout(()=>{const re=j.lastEnabled();re&&B(re.index)});q.current.add(ae)},[j]),M=d.useCallback(()=>{m==null||m(),s?E():_()},[s,E,_,m]),{isOpen:R,onOpen:D,onClose:A,onToggle:O}=Lb({isOpen:l,defaultIsOpen:u,onClose:p,onOpen:M});qB({enabled:R&&r,ref:w,handler:ae=>{var re;(re=S.current)!=null&&re.contains(ae.target)||A()}});const T=$b({...b,enabled:R||y,placement:h,direction:x}),[X,B]=d.useState(-1);pa(()=>{R||B(-1)},[R]),g3(w,{focusRef:S,visible:R,shouldFocus:!0});const V=I3({isOpen:R,ref:w}),[U,N]=eH(t,"menu-button","menu-list"),$=d.useCallback(()=>{D(),_()},[D,_]),q=d.useRef(new Set([]));lH(()=>{q.current.forEach(ae=>clearTimeout(ae)),q.current.clear()});const F=d.useCallback(()=>{D(),E()},[E,D]),Q=d.useCallback(()=>{D(),I()},[D,I]),Y=d.useCallback(()=>{var ae,re;const G=P3(w.current),K=(ae=w.current)==null?void 0:ae.contains(G.activeElement);if(!(R&&!K))return;const ce=(re=j.item(X))==null?void 0:re.node;ce==null||ce.focus()},[R,X,j]),se=d.useRef(null);return{openAndFocusMenu:$,openAndFocusFirstItem:F,openAndFocusLastItem:Q,onTransitionEnd:Y,unstable__animationState:V,descendants:j,popper:T,buttonId:U,menuId:N,forceUpdate:T.forceUpdate,orientation:"vertical",isOpen:R,onToggle:O,onOpen:D,onClose:A,menuRef:w,buttonRef:S,focusedIndex:X,closeOnSelect:n,closeOnBlur:r,autoSelect:s,setFocusedIndex:B,isLazy:i,lazyBehavior:g,initialFocusRef:o,rafId:se}}function nH(e={},t=null){const n=Ad(),{onToggle:r,popper:o,openAndFocusFirstItem:s,openAndFocusLastItem:i}=n,l=d.useCallback(u=>{const p=u.key,h={Enter:s,ArrowDown:s,ArrowUp:i}[p];h&&(u.preventDefault(),u.stopPropagation(),h(u))},[s,i]);return{...e,ref:It(n.buttonRef,t,o.referenceRef),id:n.buttonId,"data-active":dt(n.isOpen),"aria-expanded":n.isOpen,"aria-haspopup":"menu","aria-controls":n.menuId,onClick:He(e.onClick,r),onKeyDown:He(e.onKeyDown,l)}}function $1(e){var t;return aH(e)&&!!((t=e==null?void 0:e.getAttribute("role"))!=null&&t.startsWith("menuitem"))}function rH(e={},t=null){const n=Ad();if(!n)throw new Error("useMenuContext: context is undefined. Seems you forgot to wrap component within ");const{focusedIndex:r,setFocusedIndex:o,menuRef:s,isOpen:i,onClose:l,menuId:u,isLazy:p,lazyBehavior:m,unstable__animationState:h}=n,g=QB(),x=CF({preventDefault:S=>S.key!==" "&&$1(S.target)}),y=d.useCallback(S=>{if(!S.currentTarget.contains(S.target))return;const j=S.key,E={Tab:M=>M.preventDefault(),Escape:l,ArrowDown:()=>{const M=g.nextEnabled(r);M&&o(M.index)},ArrowUp:()=>{const M=g.prevEnabled(r);M&&o(M.index)}}[j];if(E){S.preventDefault(),E(S);return}const I=x(M=>{const R=wF(g.values(),M,D=>{var A,O;return(O=(A=D==null?void 0:D.node)==null?void 0:A.textContent)!=null?O:""},g.item(r));if(R){const D=g.indexOf(R.node);o(D)}});$1(S.target)&&I(S)},[g,r,x,l,o]),b=d.useRef(!1);i&&(b.current=!0);const w=zb({wasSelected:b.current,enabled:p,mode:m,isSelected:h.present});return{...e,ref:It(s,t),children:w?e.children:null,tabIndex:-1,role:"menu",id:u,style:{...e.style,transformOrigin:"var(--popper-transform-origin)"},"aria-orientation":"vertical",onKeyDown:He(e.onKeyDown,y)}}function oH(e={}){const{popper:t,isOpen:n}=Ad();return t.getPopperProps({...e,style:{visibility:n?"visible":"hidden",...e.style}})}function sH(e={},t=null){const{onMouseEnter:n,onMouseMove:r,onMouseLeave:o,onClick:s,onFocus:i,isDisabled:l,isFocusable:u,closeOnSelect:p,type:m,...h}=e,g=Ad(),{setFocusedIndex:x,focusedIndex:y,closeOnSelect:b,onClose:w,menuRef:S,isOpen:j,menuId:_,rafId:E}=g,I=d.useRef(null),M=`${_}-menuitem-${d.useId()}`,{index:R,register:D}=ZB({disabled:l&&!u}),A=d.useCallback($=>{n==null||n($),!l&&x(R)},[x,R,l,n]),O=d.useCallback($=>{r==null||r($),I.current&&!IS(I.current)&&A($)},[A,r]),T=d.useCallback($=>{o==null||o($),!l&&x(-1)},[x,l,o]),X=d.useCallback($=>{s==null||s($),$1($.currentTarget)&&(p??b)&&w()},[w,s,b,p]),B=d.useCallback($=>{i==null||i($),x(R)},[x,i,R]),V=R===y,U=l&&!u;pa(()=>{j&&(V&&!U&&I.current?(E.current&&cancelAnimationFrame(E.current),E.current=requestAnimationFrame(()=>{var $;($=I.current)==null||$.focus(),E.current=null})):S.current&&!IS(S.current)&&S.current.focus({preventScroll:!0}))},[V,U,S,j]);const N=h3({onClick:X,onFocus:B,onMouseEnter:A,onMouseMove:O,onMouseLeave:T,ref:It(D,I,t),isDisabled:l,isFocusable:u});return{...h,...N,type:m??N.type,id:M,role:"menuitem",tabIndex:V?0:-1}}function aH(e){var t;if(!iH(e))return!1;const n=(t=e.ownerDocument.defaultView)!=null?t:window;return e instanceof n.HTMLElement}function iH(e){return e!=null&&typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.ELEMENT_NODE}function lH(e,t=[]){return d.useEffect(()=>()=>e(),t)}var[cH,$c]=Wt({name:"MenuStylesContext",errorMessage:`useMenuStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),Ah=e=>{const{children:t}=e,n=Un("Menu",e),r=on(e),{direction:o}=bd(),{descendants:s,...i}=tH({...r,direction:o}),l=d.useMemo(()=>i,[i]),{isOpen:u,onClose:p,forceUpdate:m}=l;return a.jsx(XB,{value:s,children:a.jsx(JB,{value:l,children:a.jsx(cH,{value:n,children:zx(t,{isOpen:u,onClose:p,forceUpdate:m})})})})};Ah.displayName="Menu";var E3=je((e,t)=>{const n=$c();return a.jsx(we.span,{ref:t,...e,__css:n.command,className:"chakra-menu__command"})});E3.displayName="MenuCommand";var uH=je((e,t)=>{const{type:n,...r}=e,o=$c(),s=r.as||n?n??void 0:"button",i=d.useMemo(()=>({textDecoration:"none",color:"inherit",userSelect:"none",display:"flex",width:"100%",alignItems:"center",textAlign:"start",flex:"0 0 auto",outline:0,...o.item}),[o.item]);return a.jsx(we.button,{ref:t,type:s,...r,__css:i})}),M3=e=>{const{className:t,children:n,...r}=e,o=$c(),s=d.Children.only(n),i=d.isValidElement(s)?d.cloneElement(s,{focusable:"false","aria-hidden":!0,className:Ye("chakra-menu__icon",s.props.className)}):null,l=Ye("chakra-menu__icon-wrapper",t);return a.jsx(we.span,{className:l,...r,__css:o.icon,children:i})};M3.displayName="MenuIcon";var en=je((e,t)=>{const{icon:n,iconSpacing:r="0.75rem",command:o,commandSpacing:s="0.75rem",children:i,...l}=e,u=sH(l,t),m=n||o?a.jsx("span",{style:{pointerEvents:"none",flex:1},children:i}):i;return a.jsxs(uH,{...u,className:Ye("chakra-menu__menuitem",u.className),children:[n&&a.jsx(M3,{fontSize:"0.8em",marginEnd:r,children:n}),m,o&&a.jsx(E3,{marginStart:s,children:o})]})});en.displayName="MenuItem";var dH={enter:{visibility:"visible",opacity:1,scale:1,transition:{duration:.2,ease:[.4,0,.2,1]}},exit:{transitionEnd:{visibility:"hidden"},opacity:0,scale:.8,transition:{duration:.1,easings:"easeOut"}}},fH=we(In.div),Ui=je(function(t,n){var r,o;const{rootProps:s,motionProps:i,...l}=t,{isOpen:u,onTransitionEnd:p,unstable__animationState:m}=Ad(),h=rH(l,n),g=oH(s),x=$c();return a.jsx(we.div,{...g,__css:{zIndex:(o=t.zIndex)!=null?o:(r=x.list)==null?void 0:r.zIndex},children:a.jsx(fH,{variants:dH,initial:!1,animate:u?"enter":"exit",__css:{outline:0,...x.list},...i,className:Ye("chakra-menu__menu-list",h.className),...h,onUpdate:p,onAnimationComplete:ph(m.onComplete,h.onAnimationComplete)})})});Ui.displayName="MenuList";var td=je((e,t)=>{const{title:n,children:r,className:o,...s}=e,i=Ye("chakra-menu__group__title",o),l=$c();return a.jsxs("div",{ref:t,className:"chakra-menu__group",role:"group",children:[n&&a.jsx(we.p,{className:i,...s,__css:l.groupTitle,children:n}),r]})});td.displayName="MenuGroup";var pH=je((e,t)=>{const n=$c();return a.jsx(we.button,{ref:t,...e,__css:{display:"inline-flex",appearance:"none",alignItems:"center",outline:0,...n.button}})}),Th=je((e,t)=>{const{children:n,as:r,...o}=e,s=nH(o,t),i=r||pH;return a.jsx(i,{...s,className:Ye("chakra-menu__menu-button",e.className),children:a.jsx(we.span,{__css:{pointerEvents:"none",flex:"1 1 auto",minW:0},children:e.children})})});Th.displayName="MenuButton";var mH={slideInBottom:{...w1,custom:{offsetY:16,reverse:!0}},slideInRight:{...w1,custom:{offsetX:16,reverse:!0}},scale:{...i5,custom:{initialScale:.95,reverse:!0}},none:{}},hH=we(In.section),gH=e=>mH[e||"none"],O3=d.forwardRef((e,t)=>{const{preset:n,motionProps:r=gH(n),...o}=e;return a.jsx(hH,{ref:t,...r,...o})});O3.displayName="ModalTransition";var vH=Object.defineProperty,xH=(e,t,n)=>t in e?vH(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,bH=(e,t,n)=>(xH(e,typeof t!="symbol"?t+"":t,n),n),yH=class{constructor(){bH(this,"modals"),this.modals=new Map}add(e){return this.modals.set(e,this.modals.size+1),this.modals.size}remove(e){this.modals.delete(e)}isTopModal(e){return e?this.modals.get(e)===this.modals.size:!1}},L1=new yH;function R3(e,t){const[n,r]=d.useState(0);return d.useEffect(()=>{const o=e.current;if(o){if(t){const s=L1.add(o);r(s)}return()=>{L1.remove(o),r(0)}}},[t,e]),n}var CH=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Dl=new WeakMap,ep=new WeakMap,tp={},pv=0,D3=function(e){return e&&(e.host||D3(e.parentNode))},wH=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=D3(n);return r&&e.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},SH=function(e,t,n,r){var o=wH(t,Array.isArray(e)?e:[e]);tp[n]||(tp[n]=new WeakMap);var s=tp[n],i=[],l=new Set,u=new Set(o),p=function(h){!h||l.has(h)||(l.add(h),p(h.parentNode))};o.forEach(p);var m=function(h){!h||u.has(h)||Array.prototype.forEach.call(h.children,function(g){if(l.has(g))m(g);else{var x=g.getAttribute(r),y=x!==null&&x!=="false",b=(Dl.get(g)||0)+1,w=(s.get(g)||0)+1;Dl.set(g,b),s.set(g,w),i.push(g),b===1&&y&&ep.set(g,!0),w===1&&g.setAttribute(n,"true"),y||g.setAttribute(r,"true")}})};return m(t),l.clear(),pv++,function(){i.forEach(function(h){var g=Dl.get(h)-1,x=s.get(h)-1;Dl.set(h,g),s.set(h,x),g||(ep.has(h)||h.removeAttribute(r),ep.delete(h)),x||h.removeAttribute(n)}),pv--,pv||(Dl=new WeakMap,Dl=new WeakMap,ep=new WeakMap,tp={})}},kH=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),o=t||CH(e);return o?(r.push.apply(r,Array.from(o.querySelectorAll("[aria-live]"))),SH(r,o,n,"aria-hidden")):function(){return null}};function jH(e){const{isOpen:t,onClose:n,id:r,closeOnOverlayClick:o=!0,closeOnEsc:s=!0,useInert:i=!0,onOverlayClick:l,onEsc:u}=e,p=d.useRef(null),m=d.useRef(null),[h,g,x]=IH(r,"chakra-modal","chakra-modal--header","chakra-modal--body");_H(p,t&&i);const y=R3(p,t),b=d.useRef(null),w=d.useCallback(A=>{b.current=A.target},[]),S=d.useCallback(A=>{A.key==="Escape"&&(A.stopPropagation(),s&&(n==null||n()),u==null||u())},[s,n,u]),[j,_]=d.useState(!1),[E,I]=d.useState(!1),M=d.useCallback((A={},O=null)=>({role:"dialog",...A,ref:It(O,p),id:h,tabIndex:-1,"aria-modal":!0,"aria-labelledby":j?g:void 0,"aria-describedby":E?x:void 0,onClick:He(A.onClick,T=>T.stopPropagation())}),[x,E,h,g,j]),R=d.useCallback(A=>{A.stopPropagation(),b.current===A.target&&L1.isTopModal(p.current)&&(o&&(n==null||n()),l==null||l())},[n,o,l]),D=d.useCallback((A={},O=null)=>({...A,ref:It(O,m),onClick:He(A.onClick,R),onKeyDown:He(A.onKeyDown,S),onMouseDown:He(A.onMouseDown,w)}),[S,w,R]);return{isOpen:t,onClose:n,headerId:g,bodyId:x,setBodyMounted:I,setHeaderMounted:_,dialogRef:p,overlayRef:m,getDialogProps:M,getDialogContainerProps:D,index:y}}function _H(e,t){const n=e.current;d.useEffect(()=>{if(!(!e.current||!t))return kH(e.current)},[t,e,n])}function IH(e,...t){const n=d.useId(),r=e||n;return d.useMemo(()=>t.map(o=>`${o}-${r}`),[r,t])}var[PH,Lc]=Wt({name:"ModalStylesContext",errorMessage:`useModalStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),[EH,Gi]=Wt({strict:!0,name:"ModalContext",errorMessage:"useModalContext: `context` is undefined. Seems you forgot to wrap modal components in ``"}),Ki=e=>{const t={scrollBehavior:"outside",autoFocus:!0,trapFocus:!0,returnFocusOnClose:!0,blockScrollOnMount:!0,allowPinchZoom:!1,motionPreset:"scale",lockFocusAcrossFrames:!0,...e},{portalProps:n,children:r,autoFocus:o,trapFocus:s,initialFocusRef:i,finalFocusRef:l,returnFocusOnClose:u,blockScrollOnMount:p,allowPinchZoom:m,preserveScrollBarGap:h,motionPreset:g,lockFocusAcrossFrames:x,onCloseComplete:y}=t,b=Un("Modal",t),S={...jH(t),autoFocus:o,trapFocus:s,initialFocusRef:i,finalFocusRef:l,returnFocusOnClose:u,blockScrollOnMount:p,allowPinchZoom:m,preserveScrollBarGap:h,motionPreset:g,lockFocusAcrossFrames:x};return a.jsx(EH,{value:S,children:a.jsx(PH,{value:b,children:a.jsx(dr,{onExitComplete:y,children:S.isOpen&&a.jsx(Ac,{...n,children:r})})})})};Ki.displayName="Modal";var $p="right-scroll-bar-position",Lp="width-before-scroll-bar",MH="with-scroll-bars-hidden",OH="--removed-body-scroll-bar-size",A3=M5(),mv=function(){},Nh=d.forwardRef(function(e,t){var n=d.useRef(null),r=d.useState({onScrollCapture:mv,onWheelCapture:mv,onTouchMoveCapture:mv}),o=r[0],s=r[1],i=e.forwardProps,l=e.children,u=e.className,p=e.removeScrollBar,m=e.enabled,h=e.shards,g=e.sideCar,x=e.noIsolation,y=e.inert,b=e.allowPinchZoom,w=e.as,S=w===void 0?"div":w,j=e.gapMode,_=I5(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noIsolation","inert","allowPinchZoom","as","gapMode"]),E=g,I=_5([n,t]),M=gs(gs({},_),o);return d.createElement(d.Fragment,null,m&&d.createElement(E,{sideCar:A3,removeScrollBar:p,shards:h,noIsolation:x,inert:y,setCallbacks:s,allowPinchZoom:!!b,lockRef:n,gapMode:j}),i?d.cloneElement(d.Children.only(l),gs(gs({},M),{ref:I})):d.createElement(S,gs({},M,{className:u,ref:I}),l))});Nh.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Nh.classNames={fullWidth:Lp,zeroRight:$p};var PS,RH=function(){if(PS)return PS;if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function DH(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=RH();return t&&e.setAttribute("nonce",t),e}function AH(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function TH(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var NH=function(){var e=0,t=null;return{add:function(n){e==0&&(t=DH())&&(AH(t,n),TH(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},$H=function(){var e=NH();return function(t,n){d.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},T3=function(){var e=$H(),t=function(n){var r=n.styles,o=n.dynamic;return e(r,o),null};return t},LH={left:0,top:0,right:0,gap:0},hv=function(e){return parseInt(e||"",10)||0},zH=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],r=t[e==="padding"?"paddingTop":"marginTop"],o=t[e==="padding"?"paddingRight":"marginRight"];return[hv(n),hv(r),hv(o)]},FH=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return LH;var t=zH(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},BH=T3(),HH=function(e,t,n,r){var o=e.left,s=e.top,i=e.right,l=e.gap;return n===void 0&&(n="margin"),` +import{a as Dc,b as W_,S as U_,c as G_,d as K_,e as o1,f as q_,i as s1,g as vR,h as xR,j as bR,k as yR,l as X_,m as CR,n as YC,o as Q_,t as wR,p as SR,q as kR,r as jR,s as _R,u as IR,v as d,w as a,x as $x,y as qp,z as PR,A as ER,B as MR,C as OR,P as RR,D as Lx,E as DR,F as AR,G as TR,H as NR,I as Y_,J as ke,K as Tn,L as $R,M as LR,N as zR,O as Wt,Q as we,R as Ye,T as un,U as He,V as vd,W as dr,X as In,Y as Un,Z as on,_ as fa,$ as oi,a0 as dt,a1 as Co,a2 as rc,a3 as pa,a4 as ma,a5 as ph,a6 as zx,a7 as xd,a8 as pn,a9 as FR,aa as H,ab as ZC,ac as BR,ad as Z_,ae as a1,af as bd,ag as Ac,ah as HR,ai as J_,aj as eI,ak as tI,al as Ho,am as VR,an as ce,ao as xe,ap as Ft,aq as W,ar as WR,as as JC,at as UR,au as GR,av as KR,aw as el,ax as te,ay as qR,az as ct,aA as Qt,aB as Ie,aC as L,aD as cr,aE as Jn,aF as je,aG as Z,aH as nI,aI as XR,aJ as QR,aK as YR,aL as ZR,aM as qr,aN as Fx,aO as ha,aP as Nr,aQ as yd,aR as JR,aS as eD,aT as ew,aU as Bx,aV as ve,aW as Xr,aX as tD,aY as rI,aZ as oI,a_ as tw,a$ as nD,b0 as rD,b1 as oD,b2 as ga,b3 as Hx,b4 as yt,b5 as sD,b6 as aD,b7 as sI,b8 as aI,b9 as mh,ba as iD,bb as nw,bc as iI,bd as lD,be as cD,bf as uD,bg as dD,bh as fD,bi as pD,bj as mD,bk as lI,bl as hD,bm as gD,bn as vD,bo as xD,bp as bD,bq as va,br as vc,bs as yD,bt as $r,bu as CD,bv as wD,bw as SD,bx as rw,by as kD,bz as jD,bA as Zs,bB as hh,bC as cI,bD as uI,bE as to,bF as dI,bG as _D,bH as Fi,bI as Mu,bJ as ow,bK as ID,bL as PD,bM as ED,bN as qf,bO as Xf,bP as bu,bQ as Q0,bR as Nu,bS as $u,bT as Lu,bU as zu,bV as sw,bW as Xp,bX as Y0,bY as Qp,bZ as aw,b_ as i1,b$ as Z0,c0 as l1,c1 as J0,c2 as Yp,c3 as iw,c4 as Bi,c5 as lw,c6 as Hi,c7 as cw,c8 as Zp,c9 as Cd,ca as MD,cb as fI,cc as uw,cd as gh,ce as OD,cf as c1,cg as dw,ch as Fr,ci as Ta,cj as fw,ck as Vx,cl as RD,cm as DD,cn as ev,co as pw,cp as u1,cq as vh,cr as AD,cs as pI,ct as d1,cu as f1,cv as mI,cw as TD,cx as p1,cy as ND,cz as m1,cA as $D,cB as h1,cC as LD,cD as zD,cE as FD,cF as Wx,cG as Ux,cH as Gx,cI as Kx,cJ as qx,cK as xh,cL as Xx,cM as Xs,cN as hI,cO as gI,cP as Qx,cQ as vI,cR as BD,cS as yu,cT as sa,cU as xI,cV as bI,cW as mw,cX as Yx,cY as yI,cZ as Zx,c_ as Jx,c$ as CI,d0 as Mn,d1 as HD,d2 as $n,d3 as bh,d4 as eb,d5 as wI,d6 as SI,d7 as VD,d8 as WD,d9 as UD,da as GD,db as KD,dc as qD,dd as XD,de as QD,df as YD,dg as ZD,dh as hw,di as tb,dj as JD,dk as eA,dl as wd,dm as tA,dn as nA,dp as yh,dq as rA,dr as oA,ds as sA,dt as aA,du as mn,dv as iA,dw as lA,dx as cA,dy as uA,dz as dA,dA as fA,dB as Ku,dC as gw,dD as Xo,dE as kI,dF as pA,dG as nb,dH as mA,dI as vw,dJ as hA,dK as gA,dL as vA,dM as jI,dN as xA,dO as bA,dP as yA,dQ as CA,dR as _I,dS as wA,dT as SA,dU as xw,dV as kA,dW as jA,dX as _A,dY as IA,dZ as PA,d_ as EA,d$ as MA,e0 as II,e1 as OA,e2 as RA,e3 as DA,e4 as bw,e5 as Qf,e6 as PI,e7 as AA,e8 as TA,e9 as NA,ea as $A,eb as LA,ec as Vo,ed as zA,ee as FA,ef as BA,eg as HA,eh as VA,ei as WA,ej as UA,ek as GA,el as KA,em as qA,en as XA,eo as QA,ep as YA,eq as ZA,er as JA,es as eT,et as yw,eu as tT,ev as nT,ew as rT,ex as oT,ey as sT,ez as aT,eA as iT,eB as Cw,eC as ww,eD as EI,eE as lT,eF as zo,eG as qu,eH as wr,eI as cT,eJ as uT,eK as MI,eL as OI,eM as dT,eN as Sw,eO as fT,eP as kw,eQ as jw,eR as _w,eS as pT,eT as mT,eU as Iw,eV as Pw,eW as hT,eX as gT,eY as Jp,eZ as vT,e_ as Ew,e$ as Mw,f0 as xT,f1 as bT,f2 as yT,f3 as RI,f4 as CT,f5 as wT,f6 as DI,f7 as ST,f8 as kT,f9 as Ow,fa as jT,fb as Rw,fc as _T,fd as AI,fe as TI,ff as Sd,fg as NI,fh as Pi,fi as $I,fj as Dw,fk as IT,fl as PT,fm as LI,fn as ET,fo as MT,fp as OT,fq as RT,fr as DT,fs as rb,ft as g1,fu as Aw,fv as tl,fw as AT,fx as TT,fy as NT,fz as zI,fA as ob,fB as FI,fC as sb,fD as BI,fE as $T,fF as Ys,fG as LT,fH as HI,fI as zT,fJ as ab,fK as VI,fL as FT,fM as BT,fN as HT,fO as VT,fP as WT,fQ as UT,fR as GT,fS as em,fT as Ou,fU as Ql,fV as KT,fW as qT,fX as XT,fY as QT,fZ as YT,f_ as ZT,f$ as JT,g0 as eN,g1 as Tw,g2 as tN,g3 as nN,g4 as rN,g5 as oN,g6 as sN,g7 as aN,g8 as Nw,g9 as iN,ga as lN,gb as cN,gc as uN,gd as dN,ge as fN,gf as pN,gg as $w,gh as mN,gi as hN,gj as gN,gk as vN,gl as xN,gm as bN,gn as yN,go as CN,gp as wN,gq as SN,gr as kN,gs as jN,gt as _N,gu as IN,gv as kd,gw as PN,gx as EN,gy as MN,gz as ON,gA as RN,gB as DN,gC as AN,gD as TN,gE as Lw,gF as Tp,gG as NN,gH as tm,gI as WI,gJ as nm,gK as $N,gL as LN,gM as oc,gN as UI,gO as GI,gP as ib,gQ as zN,gR as FN,gS as BN,gT as v1,gU as KI,gV as HN,gW as VN,gX as qI,gY as WN,gZ as UN,g_ as GN,g$ as KN,h0 as qN,h1 as zw,h2 as Ml,h3 as XN,h4 as QN,h5 as YN,h6 as ZN,h7 as JN,h8 as e9,h9 as Fw,ha as t9,hb as n9,hc as r9,hd as o9,he as s9,hf as a9,hg as i9,hh as l9,hi as tv,hj as nv,hk as rv,hl as Yf,hm as Bw,hn as x1,ho as Hw,hp as c9,hq as u9,hr as d9,hs as f9,ht as XI,hu as p9,hv as m9,hw as h9,hx as g9,hy as v9,hz as x9,hA as b9,hB as y9,hC as C9,hD as w9,hE as S9,hF as Zf,hG as ov,hH as k9,hI as j9,hJ as _9,hK as I9,hL as P9,hM as E9,hN as M9,hO as O9,hP as R9,hQ as D9,hR as Vw,hS as Ww,hT as A9,hU as T9,hV as N9,hW as $9,hX as L9}from"./index-94062f76.js";import{u as QI,a as xa,b as z9,r as Re,f as F9,g as Uw,c as mt,d as Rn}from"./MantineProvider-a057bfc9.js";var B9=200;function H9(e,t,n,r){var o=-1,s=G_,i=!0,l=e.length,u=[],p=t.length;if(!l)return u;n&&(t=Dc(t,W_(n))),r?(s=K_,i=!1):t.length>=B9&&(s=o1,i=!1,t=new U_(t));e:for(;++o=120&&m.length>=120)?new U_(i&&m):void 0}m=e[0];var h=-1,g=l[0];e:for(;++h{r.has(s)&&n(o,s)})}function r$(e,t){if(e==null)return{};var n={},r=Object.keys(e),o,s;for(s=0;s=0)&&(n[o]=e[o]);return n}const YI=({id:e,x:t,y:n,width:r,height:o,style:s,color:i,strokeColor:l,strokeWidth:u,className:p,borderRadius:m,shapeRendering:h,onClick:g,selected:x})=>{const{background:y,backgroundColor:b}=s||{},w=i||y||b;return a.jsx("rect",{className:$x(["react-flow__minimap-node",{selected:x},p]),x:t,y:n,rx:m,ry:m,width:r,height:o,fill:w,stroke:l,strokeWidth:u,shapeRendering:h,onClick:g?S=>g(S,e):void 0})};YI.displayName="MiniMapNode";var o$=d.memo(YI);const s$=e=>e.nodeOrigin,a$=e=>e.getNodes().filter(t=>!t.hidden&&t.width&&t.height),sv=e=>e instanceof Function?e:()=>e;function i$({nodeStrokeColor:e="transparent",nodeColor:t="#e2e2e2",nodeClassName:n="",nodeBorderRadius:r=5,nodeStrokeWidth:o=2,nodeComponent:s=o$,onClick:i}){const l=qp(a$,Lx),u=qp(s$),p=sv(t),m=sv(e),h=sv(n),g=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return a.jsx(a.Fragment,{children:l.map(x=>{const{x:y,y:b}=PR(x,u).positionAbsolute;return a.jsx(s,{x:y,y:b,width:x.width,height:x.height,style:x.style,selected:x.selected,className:h(x),color:p(x),borderRadius:r,strokeColor:m(x),strokeWidth:o,shapeRendering:g,onClick:i,id:x.id},x.id)})})}var l$=d.memo(i$);const c$=200,u$=150,d$=e=>{const t=e.getNodes(),n={x:-e.transform[0]/e.transform[2],y:-e.transform[1]/e.transform[2],width:e.width/e.transform[2],height:e.height/e.transform[2]};return{viewBB:n,boundingRect:t.length>0?TR(NR(t,e.nodeOrigin),n):n,rfId:e.rfId}},f$="react-flow__minimap-desc";function ZI({style:e,className:t,nodeStrokeColor:n="transparent",nodeColor:r="#e2e2e2",nodeClassName:o="",nodeBorderRadius:s=5,nodeStrokeWidth:i=2,nodeComponent:l,maskColor:u="rgb(240, 240, 240, 0.6)",maskStrokeColor:p="none",maskStrokeWidth:m=1,position:h="bottom-right",onClick:g,onNodeClick:x,pannable:y=!1,zoomable:b=!1,ariaLabel:w="React Flow mini map",inversePan:S=!1,zoomStep:j=10,offsetScale:_=5}){const E=ER(),I=d.useRef(null),{boundingRect:M,viewBB:R,rfId:D}=qp(d$,Lx),A=(e==null?void 0:e.width)??c$,O=(e==null?void 0:e.height)??u$,T=M.width/A,X=M.height/O,B=Math.max(T,X),V=B*A,U=B*O,N=_*B,$=M.x-(V-M.width)/2-N,q=M.y-(U-M.height)/2-N,F=V+N*2,Q=U+N*2,Y=`${f$}-${D}`,se=d.useRef(0);se.current=B,d.useEffect(()=>{if(I.current){const G=MR(I.current),K=J=>{const{transform:ie,d3Selection:de,d3Zoom:ge}=E.getState();if(J.sourceEvent.type!=="wheel"||!de||!ge)return;const Ce=-J.sourceEvent.deltaY*(J.sourceEvent.deltaMode===1?.05:J.sourceEvent.deltaMode?1:.002)*j,he=ie[2]*Math.pow(2,Ce);ge.scaleTo(de,he)},ee=J=>{const{transform:ie,d3Selection:de,d3Zoom:ge,translateExtent:Ce,width:he,height:fe}=E.getState();if(J.sourceEvent.type!=="mousemove"||!de||!ge)return;const Oe=se.current*Math.max(1,ie[2])*(S?-1:1),_e={x:ie[0]-J.sourceEvent.movementX*Oe,y:ie[1]-J.sourceEvent.movementY*Oe},Ne=[[0,0],[he,fe]],nt=DR.translate(_e.x,_e.y).scale(ie[2]),$e=ge.constrain()(nt,Ne,Ce);ge.transform(de,$e)},le=OR().on("zoom",y?ee:null).on("zoom.wheel",b?K:null);return G.call(le),()=>{G.on("zoom",null)}}},[y,b,S,j]);const ae=g?G=>{const K=AR(G);g(G,{x:K[0],y:K[1]})}:void 0,re=x?(G,K)=>{const ee=E.getState().nodeInternals.get(K);x(G,ee)}:void 0;return a.jsx(RR,{position:h,style:e,className:$x(["react-flow__minimap",t]),"data-testid":"rf__minimap",children:a.jsxs("svg",{width:A,height:O,viewBox:`${$} ${q} ${F} ${Q}`,role:"img","aria-labelledby":Y,ref:I,onClick:ae,children:[w&&a.jsx("title",{id:Y,children:w}),a.jsx(l$,{onClick:re,nodeColor:r,nodeStrokeColor:n,nodeBorderRadius:s,nodeClassName:o,nodeStrokeWidth:i,nodeComponent:l}),a.jsx("path",{className:"react-flow__minimap-mask",d:`M${$-N},${q-N}h${F+N*2}v${Q+N*2}h${-F-N*2}z + M${R.x},${R.y}h${R.width}v${R.height}h${-R.width}z`,fill:u,fillRule:"evenodd",stroke:p,strokeWidth:m,pointerEvents:"none"})]})})}ZI.displayName="MiniMap";var p$=d.memo(ZI),Wo;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(Wo||(Wo={}));function m$({color:e,dimensions:t,lineWidth:n}){return a.jsx("path",{stroke:e,strokeWidth:n,d:`M${t[0]/2} 0 V${t[1]} M0 ${t[1]/2} H${t[0]}`})}function h$({color:e,radius:t}){return a.jsx("circle",{cx:t,cy:t,r:t,fill:e})}const g$={[Wo.Dots]:"#91919a",[Wo.Lines]:"#eee",[Wo.Cross]:"#e2e2e2"},v$={[Wo.Dots]:1,[Wo.Lines]:1,[Wo.Cross]:6},x$=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function JI({id:e,variant:t=Wo.Dots,gap:n=20,size:r,lineWidth:o=1,offset:s=2,color:i,style:l,className:u}){const p=d.useRef(null),{transform:m,patternId:h}=qp(x$,Lx),g=i||g$[t],x=r||v$[t],y=t===Wo.Dots,b=t===Wo.Cross,w=Array.isArray(n)?n:[n,n],S=[w[0]*m[2]||1,w[1]*m[2]||1],j=x*m[2],_=b?[j,j]:S,E=y?[j/s,j/s]:[_[0]/s,_[1]/s];return a.jsxs("svg",{className:$x(["react-flow__background",u]),style:{...l,position:"absolute",width:"100%",height:"100%",top:0,left:0},ref:p,"data-testid":"rf__background",children:[a.jsx("pattern",{id:h+e,x:m[0]%S[0],y:m[1]%S[1],width:S[0],height:S[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${E[0]},-${E[1]})`,children:y?a.jsx(h$,{color:g,radius:j/s}):a.jsx(m$,{dimensions:_,color:g,lineWidth:o})}),a.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${h+e})`})]})}JI.displayName="Background";var b$=d.memo(JI);const qw=(e,t,n)=>{y$(n);const r=Y_(e,t);return e5[n].includes(r)},e5={">":[1],">=":[0,1],"=":[0],"<=":[-1,0],"<":[-1],"!=":[-1,1]},Xw=Object.keys(e5),y$=e=>{if(typeof e!="string")throw new TypeError(`Invalid operator type, expected string but got ${typeof e}`);if(Xw.indexOf(e)===-1)throw new Error(`Invalid operator, expected one of ${Xw.join("|")}`)};function C$(){return!!(typeof window<"u"&&window.document&&window.document.createElement)}var w$=C$();const t5=1/60*1e3,S$=typeof performance<"u"?()=>performance.now():()=>Date.now(),n5=typeof window<"u"?e=>window.requestAnimationFrame(e):e=>setTimeout(()=>e(S$()),t5);function k$(e){let t=[],n=[],r=0,o=!1,s=!1;const i=new WeakSet,l={schedule:(u,p=!1,m=!1)=>{const h=m&&o,g=h?t:n;return p&&i.add(u),g.indexOf(u)===-1&&(g.push(u),h&&o&&(r=t.length)),u},cancel:u=>{const p=n.indexOf(u);p!==-1&&n.splice(p,1),i.delete(u)},process:u=>{if(o){s=!0;return}if(o=!0,[t,n]=[n,t],n.length=0,r=t.length,r)for(let p=0;p(e[t]=k$(()=>Xu=!0),e),{}),_$=jd.reduce((e,t)=>{const n=Ch[t];return e[t]=(r,o=!1,s=!1)=>(Xu||E$(),n.schedule(r,o,s)),e},{}),I$=jd.reduce((e,t)=>(e[t]=Ch[t].cancel,e),{});jd.reduce((e,t)=>(e[t]=()=>Ch[t].process(sc),e),{});const P$=e=>Ch[e].process(sc),r5=e=>{Xu=!1,sc.delta=b1?t5:Math.max(Math.min(e-sc.timestamp,j$),1),sc.timestamp=e,y1=!0,jd.forEach(P$),y1=!1,Xu&&(b1=!1,n5(r5))},E$=()=>{Xu=!0,b1=!0,y1||n5(r5)},Qw=()=>sc;function wh(e){const{viewBox:t="0 0 24 24",d:n,displayName:r,defaultProps:o={}}=e,s=d.Children.toArray(e.path),i=ke((l,u)=>a.jsx(Tn,{ref:u,viewBox:t,...o,...l,children:s.length?s:a.jsx("path",{fill:"currentColor",d:n})}));return i.displayName=r,i}function o5(e){const{theme:t}=$R(),n=LR();return d.useMemo(()=>zR(t.direction,{...n,...e}),[e,t.direction,n])}var M$=Object.defineProperty,O$=(e,t,n)=>t in e?M$(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,jn=(e,t,n)=>(O$(e,typeof t!="symbol"?t+"":t,n),n);function Yw(e){return e.sort((t,n)=>{const r=t.compareDocumentPosition(n);if(r&Node.DOCUMENT_POSITION_FOLLOWING||r&Node.DOCUMENT_POSITION_CONTAINED_BY)return-1;if(r&Node.DOCUMENT_POSITION_PRECEDING||r&Node.DOCUMENT_POSITION_CONTAINS)return 1;if(r&Node.DOCUMENT_POSITION_DISCONNECTED||r&Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC)throw Error("Cannot sort the given nodes.");return 0})}var R$=e=>typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.ELEMENT_NODE;function Zw(e,t,n){let r=e+1;return n&&r>=t&&(r=0),r}function Jw(e,t,n){let r=e-1;return n&&r<0&&(r=t),r}var C1=typeof window<"u"?d.useLayoutEffect:d.useEffect,rm=e=>e,D$=class{constructor(){jn(this,"descendants",new Map),jn(this,"register",e=>{if(e!=null)return R$(e)?this.registerNode(e):t=>{this.registerNode(t,e)}}),jn(this,"unregister",e=>{this.descendants.delete(e);const t=Yw(Array.from(this.descendants.keys()));this.assignIndex(t)}),jn(this,"destroy",()=>{this.descendants.clear()}),jn(this,"assignIndex",e=>{this.descendants.forEach(t=>{const n=e.indexOf(t.node);t.index=n,t.node.dataset.index=t.index.toString()})}),jn(this,"count",()=>this.descendants.size),jn(this,"enabledCount",()=>this.enabledValues().length),jn(this,"values",()=>Array.from(this.descendants.values()).sort((t,n)=>t.index-n.index)),jn(this,"enabledValues",()=>this.values().filter(e=>!e.disabled)),jn(this,"item",e=>{if(this.count()!==0)return this.values()[e]}),jn(this,"enabledItem",e=>{if(this.enabledCount()!==0)return this.enabledValues()[e]}),jn(this,"first",()=>this.item(0)),jn(this,"firstEnabled",()=>this.enabledItem(0)),jn(this,"last",()=>this.item(this.descendants.size-1)),jn(this,"lastEnabled",()=>{const e=this.enabledValues().length-1;return this.enabledItem(e)}),jn(this,"indexOf",e=>{var t,n;return e&&(n=(t=this.descendants.get(e))==null?void 0:t.index)!=null?n:-1}),jn(this,"enabledIndexOf",e=>e==null?-1:this.enabledValues().findIndex(t=>t.node.isSameNode(e))),jn(this,"next",(e,t=!0)=>{const n=Zw(e,this.count(),t);return this.item(n)}),jn(this,"nextEnabled",(e,t=!0)=>{const n=this.item(e);if(!n)return;const r=this.enabledIndexOf(n.node),o=Zw(r,this.enabledCount(),t);return this.enabledItem(o)}),jn(this,"prev",(e,t=!0)=>{const n=Jw(e,this.count()-1,t);return this.item(n)}),jn(this,"prevEnabled",(e,t=!0)=>{const n=this.item(e);if(!n)return;const r=this.enabledIndexOf(n.node),o=Jw(r,this.enabledCount()-1,t);return this.enabledItem(o)}),jn(this,"registerNode",(e,t)=>{if(!e||this.descendants.has(e))return;const n=Array.from(this.descendants.keys()).concat(e),r=Yw(n);t!=null&&t.disabled&&(t.disabled=!!t.disabled);const o={node:e,index:-1,...t};this.descendants.set(e,o),this.assignIndex(r)})}};function A$(e,t){if(e!=null){if(typeof e=="function"){e(t);return}try{e.current=t}catch{throw new Error(`Cannot assign value '${t}' to ref '${e}'`)}}}function It(...e){return t=>{e.forEach(n=>{A$(n,t)})}}function T$(...e){return d.useMemo(()=>It(...e),e)}function N$(){const e=d.useRef(new D$);return C1(()=>()=>e.current.destroy()),e.current}var[$$,s5]=Wt({name:"DescendantsProvider",errorMessage:"useDescendantsContext must be used within DescendantsProvider"});function L$(e){const t=s5(),[n,r]=d.useState(-1),o=d.useRef(null);C1(()=>()=>{o.current&&t.unregister(o.current)},[]),C1(()=>{if(!o.current)return;const i=Number(o.current.dataset.index);n!=i&&!Number.isNaN(i)&&r(i)});const s=rm(e?t.register(e):t.register);return{descendants:t,index:n,enabledIndex:t.enabledIndexOf(o.current),register:It(s,o)}}function lb(){return[rm($$),()=>rm(s5()),()=>N$(),o=>L$(o)]}var[z$,Sh]=Wt({name:"AccordionStylesContext",hookName:"useAccordionStyles",providerName:""}),[F$,cb]=Wt({name:"AccordionItemContext",hookName:"useAccordionItemContext",providerName:""}),[B$,I1e,H$,V$]=lb(),Bl=ke(function(t,n){const{getButtonProps:r}=cb(),o=r(t,n),i={display:"flex",alignItems:"center",width:"100%",outline:0,...Sh().button};return a.jsx(we.button,{...o,className:Ye("chakra-accordion__button",t.className),__css:i})});Bl.displayName="AccordionButton";function _d(e){const{value:t,defaultValue:n,onChange:r,shouldUpdate:o=(g,x)=>g!==x}=e,s=un(r),i=un(o),[l,u]=d.useState(n),p=t!==void 0,m=p?t:l,h=un(g=>{const y=typeof g=="function"?g(m):g;i(m,y)&&(p||u(y),s(y))},[p,s,m,i]);return[m,h]}function W$(e){const{onChange:t,defaultIndex:n,index:r,allowMultiple:o,allowToggle:s,...i}=e;K$(e),q$(e);const l=H$(),[u,p]=d.useState(-1);d.useEffect(()=>()=>{p(-1)},[]);const[m,h]=_d({value:r,defaultValue(){return o?n??[]:n??-1},onChange:t});return{index:m,setIndex:h,htmlProps:i,getAccordionItemProps:x=>{let y=!1;return x!==null&&(y=Array.isArray(m)?m.includes(x):m===x),{isOpen:y,onChange:w=>{if(x!==null)if(o&&Array.isArray(m)){const S=w?m.concat(x):m.filter(j=>j!==x);h(S)}else w?h(x):s&&h(-1)}}},focusedIndex:u,setFocusedIndex:p,descendants:l}}var[U$,ub]=Wt({name:"AccordionContext",hookName:"useAccordionContext",providerName:"Accordion"});function G$(e){const{isDisabled:t,isFocusable:n,id:r,...o}=e,{getAccordionItemProps:s,setFocusedIndex:i}=ub(),l=d.useRef(null),u=d.useId(),p=r??u,m=`accordion-button-${p}`,h=`accordion-panel-${p}`;X$(e);const{register:g,index:x,descendants:y}=V$({disabled:t&&!n}),{isOpen:b,onChange:w}=s(x===-1?null:x);Q$({isOpen:b,isDisabled:t});const S=()=>{w==null||w(!0)},j=()=>{w==null||w(!1)},_=d.useCallback(()=>{w==null||w(!b),i(x)},[x,i,b,w]),E=d.useCallback(D=>{const O={ArrowDown:()=>{const T=y.nextEnabled(x);T==null||T.node.focus()},ArrowUp:()=>{const T=y.prevEnabled(x);T==null||T.node.focus()},Home:()=>{const T=y.firstEnabled();T==null||T.node.focus()},End:()=>{const T=y.lastEnabled();T==null||T.node.focus()}}[D.key];O&&(D.preventDefault(),O(D))},[y,x]),I=d.useCallback(()=>{i(x)},[i,x]),M=d.useCallback(function(A={},O=null){return{...A,type:"button",ref:It(g,l,O),id:m,disabled:!!t,"aria-expanded":!!b,"aria-controls":h,onClick:He(A.onClick,_),onFocus:He(A.onFocus,I),onKeyDown:He(A.onKeyDown,E)}},[m,t,b,_,I,E,h,g]),R=d.useCallback(function(A={},O=null){return{...A,ref:O,role:"region",id:h,"aria-labelledby":m,hidden:!b}},[m,b,h]);return{isOpen:b,isDisabled:t,isFocusable:n,onOpen:S,onClose:j,getButtonProps:M,getPanelProps:R,htmlProps:o}}function K$(e){const t=e.index||e.defaultIndex,n=t!=null&&!Array.isArray(t)&&e.allowMultiple;vd({condition:!!n,message:`If 'allowMultiple' is passed, then 'index' or 'defaultIndex' must be an array. You passed: ${typeof t},`})}function q$(e){vd({condition:!!(e.allowMultiple&&e.allowToggle),message:"If 'allowMultiple' is passed, 'allowToggle' will be ignored. Either remove 'allowToggle' or 'allowMultiple' depending on whether you want multiple accordions visible or not"})}function X$(e){vd({condition:!!(e.isFocusable&&!e.isDisabled),message:`Using only 'isFocusable', this prop is reserved for situations where you pass 'isDisabled' but you still want the element to receive focus (A11y). Either remove it or pass 'isDisabled' as well. + `})}function Q$(e){vd({condition:e.isOpen&&!!e.isDisabled,message:"Cannot open a disabled accordion item"})}function Hl(e){const{isOpen:t,isDisabled:n}=cb(),{reduceMotion:r}=ub(),o=Ye("chakra-accordion__icon",e.className),s=Sh(),i={opacity:n?.4:1,transform:t?"rotate(-180deg)":void 0,transition:r?void 0:"transform 0.2s",transformOrigin:"center",...s.icon};return a.jsx(Tn,{viewBox:"0 0 24 24","aria-hidden":!0,className:o,__css:i,...e,children:a.jsx("path",{fill:"currentColor",d:"M16.59 8.59L12 13.17 7.41 8.59 6 10l6 6 6-6z"})})}Hl.displayName="AccordionIcon";var Vl=ke(function(t,n){const{children:r,className:o}=t,{htmlProps:s,...i}=G$(t),u={...Sh().container,overflowAnchor:"none"},p=d.useMemo(()=>i,[i]);return a.jsx(F$,{value:p,children:a.jsx(we.div,{ref:n,...s,className:Ye("chakra-accordion__item",o),__css:u,children:typeof r=="function"?r({isExpanded:!!i.isOpen,isDisabled:!!i.isDisabled}):r})})});Vl.displayName="AccordionItem";var Yl={ease:[.25,.1,.25,1],easeIn:[.4,0,1,1],easeOut:[0,0,.2,1],easeInOut:[.4,0,.2,1]},Oi={enter:{duration:.2,ease:Yl.easeOut},exit:{duration:.1,ease:Yl.easeIn}},Js={enter:(e,t)=>({...e,delay:typeof t=="number"?t:t==null?void 0:t.enter}),exit:(e,t)=>({...e,delay:typeof t=="number"?t:t==null?void 0:t.exit})},Y$=e=>e!=null&&parseInt(e.toString(),10)>0,eS={exit:{height:{duration:.2,ease:Yl.ease},opacity:{duration:.3,ease:Yl.ease}},enter:{height:{duration:.3,ease:Yl.ease},opacity:{duration:.4,ease:Yl.ease}}},Z$={exit:({animateOpacity:e,startingHeight:t,transition:n,transitionEnd:r,delay:o})=>{var s;return{...e&&{opacity:Y$(t)?1:0},height:t,transitionEnd:r==null?void 0:r.exit,transition:(s=n==null?void 0:n.exit)!=null?s:Js.exit(eS.exit,o)}},enter:({animateOpacity:e,endingHeight:t,transition:n,transitionEnd:r,delay:o})=>{var s;return{...e&&{opacity:1},height:t,transitionEnd:r==null?void 0:r.enter,transition:(s=n==null?void 0:n.enter)!=null?s:Js.enter(eS.enter,o)}}},Id=d.forwardRef((e,t)=>{const{in:n,unmountOnExit:r,animateOpacity:o=!0,startingHeight:s=0,endingHeight:i="auto",style:l,className:u,transition:p,transitionEnd:m,...h}=e,[g,x]=d.useState(!1);d.useEffect(()=>{const j=setTimeout(()=>{x(!0)});return()=>clearTimeout(j)},[]),vd({condition:Number(s)>0&&!!r,message:"startingHeight and unmountOnExit are mutually exclusive. You can't use them together"});const y=parseFloat(s.toString())>0,b={startingHeight:s,endingHeight:i,animateOpacity:o,transition:g?p:{enter:{duration:0}},transitionEnd:{enter:m==null?void 0:m.enter,exit:r?m==null?void 0:m.exit:{...m==null?void 0:m.exit,display:y?"block":"none"}}},w=r?n:!0,S=n||r?"enter":"exit";return a.jsx(dr,{initial:!1,custom:b,children:w&&a.jsx(In.div,{ref:t,...h,className:Ye("chakra-collapse",u),style:{overflow:"hidden",display:"block",...l},custom:b,variants:Z$,initial:r?"exit":!1,animate:S,exit:"exit"})})});Id.displayName="Collapse";var J$={enter:({transition:e,transitionEnd:t,delay:n}={})=>{var r;return{opacity:1,transition:(r=e==null?void 0:e.enter)!=null?r:Js.enter(Oi.enter,n),transitionEnd:t==null?void 0:t.enter}},exit:({transition:e,transitionEnd:t,delay:n}={})=>{var r;return{opacity:0,transition:(r=e==null?void 0:e.exit)!=null?r:Js.exit(Oi.exit,n),transitionEnd:t==null?void 0:t.exit}}},a5={initial:"exit",animate:"enter",exit:"exit",variants:J$},eL=d.forwardRef(function(t,n){const{unmountOnExit:r,in:o,className:s,transition:i,transitionEnd:l,delay:u,...p}=t,m=o||r?"enter":"exit",h=r?o&&r:!0,g={transition:i,transitionEnd:l,delay:u};return a.jsx(dr,{custom:g,children:h&&a.jsx(In.div,{ref:n,className:Ye("chakra-fade",s),custom:g,...a5,animate:m,...p})})});eL.displayName="Fade";var tL={exit:({reverse:e,initialScale:t,transition:n,transitionEnd:r,delay:o})=>{var s;return{opacity:0,...e?{scale:t,transitionEnd:r==null?void 0:r.exit}:{transitionEnd:{scale:t,...r==null?void 0:r.exit}},transition:(s=n==null?void 0:n.exit)!=null?s:Js.exit(Oi.exit,o)}},enter:({transitionEnd:e,transition:t,delay:n})=>{var r;return{opacity:1,scale:1,transition:(r=t==null?void 0:t.enter)!=null?r:Js.enter(Oi.enter,n),transitionEnd:e==null?void 0:e.enter}}},i5={initial:"exit",animate:"enter",exit:"exit",variants:tL},nL=d.forwardRef(function(t,n){const{unmountOnExit:r,in:o,reverse:s=!0,initialScale:i=.95,className:l,transition:u,transitionEnd:p,delay:m,...h}=t,g=r?o&&r:!0,x=o||r?"enter":"exit",y={initialScale:i,reverse:s,transition:u,transitionEnd:p,delay:m};return a.jsx(dr,{custom:y,children:g&&a.jsx(In.div,{ref:n,className:Ye("chakra-offset-slide",l),...i5,animate:x,custom:y,...h})})});nL.displayName="ScaleFade";var rL={initial:({offsetX:e,offsetY:t,transition:n,transitionEnd:r,delay:o})=>{var s;return{opacity:0,x:e,y:t,transition:(s=n==null?void 0:n.exit)!=null?s:Js.exit(Oi.exit,o),transitionEnd:r==null?void 0:r.exit}},enter:({transition:e,transitionEnd:t,delay:n})=>{var r;return{opacity:1,x:0,y:0,transition:(r=e==null?void 0:e.enter)!=null?r:Js.enter(Oi.enter,n),transitionEnd:t==null?void 0:t.enter}},exit:({offsetY:e,offsetX:t,transition:n,transitionEnd:r,reverse:o,delay:s})=>{var i;const l={x:t,y:e};return{opacity:0,transition:(i=n==null?void 0:n.exit)!=null?i:Js.exit(Oi.exit,s),...o?{...l,transitionEnd:r==null?void 0:r.exit}:{transitionEnd:{...l,...r==null?void 0:r.exit}}}}},w1={initial:"initial",animate:"enter",exit:"exit",variants:rL},oL=d.forwardRef(function(t,n){const{unmountOnExit:r,in:o,reverse:s=!0,className:i,offsetX:l=0,offsetY:u=8,transition:p,transitionEnd:m,delay:h,...g}=t,x=r?o&&r:!0,y=o||r?"enter":"exit",b={offsetX:l,offsetY:u,reverse:s,transition:p,transitionEnd:m,delay:h};return a.jsx(dr,{custom:b,children:x&&a.jsx(In.div,{ref:n,className:Ye("chakra-offset-slide",i),custom:b,...w1,animate:y,...g})})});oL.displayName="SlideFade";var Wl=ke(function(t,n){const{className:r,motionProps:o,...s}=t,{reduceMotion:i}=ub(),{getPanelProps:l,isOpen:u}=cb(),p=l(s,n),m=Ye("chakra-accordion__panel",r),h=Sh();i||delete p.hidden;const g=a.jsx(we.div,{...p,__css:h.panel,className:m});return i?g:a.jsx(Id,{in:u,...o,children:g})});Wl.displayName="AccordionPanel";var l5=ke(function({children:t,reduceMotion:n,...r},o){const s=Un("Accordion",r),i=on(r),{htmlProps:l,descendants:u,...p}=W$(i),m=d.useMemo(()=>({...p,reduceMotion:!!n}),[p,n]);return a.jsx(B$,{value:u,children:a.jsx(U$,{value:m,children:a.jsx(z$,{value:s,children:a.jsx(we.div,{ref:o,...l,className:Ye("chakra-accordion",r.className),__css:s.root,children:t})})})})});l5.displayName="Accordion";function kh(e){return d.Children.toArray(e).filter(t=>d.isValidElement(t))}var[sL,aL]=Wt({strict:!1,name:"ButtonGroupContext"}),iL={horizontal:{"> *:first-of-type:not(:last-of-type)":{borderEndRadius:0},"> *:not(:first-of-type):not(:last-of-type)":{borderRadius:0},"> *:not(:first-of-type):last-of-type":{borderStartRadius:0}},vertical:{"> *:first-of-type:not(:last-of-type)":{borderBottomRadius:0},"> *:not(:first-of-type):not(:last-of-type)":{borderRadius:0},"> *:not(:first-of-type):last-of-type":{borderTopRadius:0}}},lL={horizontal:e=>({"& > *:not(style) ~ *:not(style)":{marginStart:e}}),vertical:e=>({"& > *:not(style) ~ *:not(style)":{marginTop:e}})},Vt=ke(function(t,n){const{size:r,colorScheme:o,variant:s,className:i,spacing:l="0.5rem",isAttached:u,isDisabled:p,orientation:m="horizontal",...h}=t,g=Ye("chakra-button__group",i),x=d.useMemo(()=>({size:r,colorScheme:o,variant:s,isDisabled:p}),[r,o,s,p]);let y={display:"inline-flex",...u?iL[m]:lL[m](l)};const b=m==="vertical";return a.jsx(sL,{value:x,children:a.jsx(we.div,{ref:n,role:"group",__css:y,className:g,"data-attached":u?"":void 0,"data-orientation":m,flexDir:b?"column":void 0,...h})})});Vt.displayName="ButtonGroup";function cL(e){const[t,n]=d.useState(!e);return{ref:d.useCallback(s=>{s&&n(s.tagName==="BUTTON")},[]),type:t?"button":void 0}}function S1(e){const{children:t,className:n,...r}=e,o=d.isValidElement(t)?d.cloneElement(t,{"aria-hidden":!0,focusable:!1}):t,s=Ye("chakra-button__icon",n);return a.jsx(we.span,{display:"inline-flex",alignSelf:"center",flexShrink:0,...r,className:s,children:o})}S1.displayName="ButtonIcon";function k1(e){const{label:t,placement:n,spacing:r="0.5rem",children:o=a.jsx(fa,{color:"currentColor",width:"1em",height:"1em"}),className:s,__css:i,...l}=e,u=Ye("chakra-button__spinner",s),p=n==="start"?"marginEnd":"marginStart",m=d.useMemo(()=>({display:"flex",alignItems:"center",position:t?"relative":"absolute",[p]:t?r:0,fontSize:"1em",lineHeight:"normal",...i}),[i,t,p,r]);return a.jsx(we.div,{className:u,...l,__css:m,children:o})}k1.displayName="ButtonSpinner";var Za=ke((e,t)=>{const n=aL(),r=oi("Button",{...n,...e}),{isDisabled:o=n==null?void 0:n.isDisabled,isLoading:s,isActive:i,children:l,leftIcon:u,rightIcon:p,loadingText:m,iconSpacing:h="0.5rem",type:g,spinner:x,spinnerPlacement:y="start",className:b,as:w,...S}=on(e),j=d.useMemo(()=>{const M={...r==null?void 0:r._focus,zIndex:1};return{display:"inline-flex",appearance:"none",alignItems:"center",justifyContent:"center",userSelect:"none",position:"relative",whiteSpace:"nowrap",verticalAlign:"middle",outline:"none",...r,...!!n&&{_focus:M}}},[r,n]),{ref:_,type:E}=cL(w),I={rightIcon:p,leftIcon:u,iconSpacing:h,children:l};return a.jsxs(we.button,{ref:T$(t,_),as:w,type:g??E,"data-active":dt(i),"data-loading":dt(s),__css:j,className:Ye("chakra-button",b),...S,disabled:o||s,children:[s&&y==="start"&&a.jsx(k1,{className:"chakra-button__spinner--start",label:m,placement:"start",spacing:h,children:x}),s?m||a.jsx(we.span,{opacity:0,children:a.jsx(tS,{...I})}):a.jsx(tS,{...I}),s&&y==="end"&&a.jsx(k1,{className:"chakra-button__spinner--end",label:m,placement:"end",spacing:h,children:x})]})});Za.displayName="Button";function tS(e){const{leftIcon:t,rightIcon:n,children:r,iconSpacing:o}=e;return a.jsxs(a.Fragment,{children:[t&&a.jsx(S1,{marginEnd:o,children:t}),r,n&&a.jsx(S1,{marginStart:o,children:n})]})}var ys=ke((e,t)=>{const{icon:n,children:r,isRound:o,"aria-label":s,...i}=e,l=n||r,u=d.isValidElement(l)?d.cloneElement(l,{"aria-hidden":!0,focusable:!1}):null;return a.jsx(Za,{padding:"0",borderRadius:o?"full":void 0,ref:t,"aria-label":s,...i,children:u})});ys.displayName="IconButton";var[P1e,uL]=Wt({name:"CheckboxGroupContext",strict:!1});function dL(e){const[t,n]=d.useState(e),[r,o]=d.useState(!1);return e!==t&&(o(!0),n(e)),r}function fL(e){return a.jsx(we.svg,{width:"1.2em",viewBox:"0 0 12 10",style:{fill:"none",strokeWidth:2,stroke:"currentColor",strokeDasharray:16},...e,children:a.jsx("polyline",{points:"1.5 6 4.5 9 10.5 1"})})}function pL(e){return a.jsx(we.svg,{width:"1.2em",viewBox:"0 0 24 24",style:{stroke:"currentColor",strokeWidth:4},...e,children:a.jsx("line",{x1:"21",x2:"3",y1:"12",y2:"12"})})}function mL(e){const{isIndeterminate:t,isChecked:n,...r}=e,o=t?pL:fL;return n||t?a.jsx(we.div,{style:{display:"flex",alignItems:"center",justifyContent:"center",height:"100%"},children:a.jsx(o,{...r})}):null}var[hL,c5]=Wt({name:"FormControlStylesContext",errorMessage:`useFormControlStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),[gL,Pd]=Wt({strict:!1,name:"FormControlContext"});function vL(e){const{id:t,isRequired:n,isInvalid:r,isDisabled:o,isReadOnly:s,...i}=e,l=d.useId(),u=t||`field-${l}`,p=`${u}-label`,m=`${u}-feedback`,h=`${u}-helptext`,[g,x]=d.useState(!1),[y,b]=d.useState(!1),[w,S]=d.useState(!1),j=d.useCallback((R={},D=null)=>({id:h,...R,ref:It(D,A=>{A&&b(!0)})}),[h]),_=d.useCallback((R={},D=null)=>({...R,ref:D,"data-focus":dt(w),"data-disabled":dt(o),"data-invalid":dt(r),"data-readonly":dt(s),id:R.id!==void 0?R.id:p,htmlFor:R.htmlFor!==void 0?R.htmlFor:u}),[u,o,w,r,s,p]),E=d.useCallback((R={},D=null)=>({id:m,...R,ref:It(D,A=>{A&&x(!0)}),"aria-live":"polite"}),[m]),I=d.useCallback((R={},D=null)=>({...R,...i,ref:D,role:"group"}),[i]),M=d.useCallback((R={},D=null)=>({...R,ref:D,role:"presentation","aria-hidden":!0,children:R.children||"*"}),[]);return{isRequired:!!n,isInvalid:!!r,isReadOnly:!!s,isDisabled:!!o,isFocused:!!w,onFocus:()=>S(!0),onBlur:()=>S(!1),hasFeedbackText:g,setHasFeedbackText:x,hasHelpText:y,setHasHelpText:b,id:u,labelId:p,feedbackId:m,helpTextId:h,htmlProps:i,getHelpTextProps:j,getErrorMessageProps:E,getRootProps:I,getLabelProps:_,getRequiredIndicatorProps:M}}var Kt=ke(function(t,n){const r=Un("Form",t),o=on(t),{getRootProps:s,htmlProps:i,...l}=vL(o),u=Ye("chakra-form-control",t.className);return a.jsx(gL,{value:l,children:a.jsx(hL,{value:r,children:a.jsx(we.div,{...s({},n),className:u,__css:r.container})})})});Kt.displayName="FormControl";var u5=ke(function(t,n){const r=Pd(),o=c5(),s=Ye("chakra-form__helper-text",t.className);return a.jsx(we.div,{...r==null?void 0:r.getHelpTextProps(t,n),__css:o.helperText,className:s})});u5.displayName="FormHelperText";var wn=ke(function(t,n){var r;const o=oi("FormLabel",t),s=on(t),{className:i,children:l,requiredIndicator:u=a.jsx(d5,{}),optionalIndicator:p=null,...m}=s,h=Pd(),g=(r=h==null?void 0:h.getLabelProps(m,n))!=null?r:{ref:n,...m};return a.jsxs(we.label,{...g,className:Ye("chakra-form__label",s.className),__css:{display:"block",textAlign:"start",...o},children:[l,h!=null&&h.isRequired?u:p]})});wn.displayName="FormLabel";var d5=ke(function(t,n){const r=Pd(),o=c5();if(!(r!=null&&r.isRequired))return null;const s=Ye("chakra-form__required-indicator",t.className);return a.jsx(we.span,{...r==null?void 0:r.getRequiredIndicatorProps(t,n),__css:o.requiredIndicator,className:s})});d5.displayName="RequiredIndicator";function db(e){const{isDisabled:t,isInvalid:n,isReadOnly:r,isRequired:o,...s}=fb(e);return{...s,disabled:t,readOnly:r,required:o,"aria-invalid":Co(n),"aria-required":Co(o),"aria-readonly":Co(r)}}function fb(e){var t,n,r;const o=Pd(),{id:s,disabled:i,readOnly:l,required:u,isRequired:p,isInvalid:m,isReadOnly:h,isDisabled:g,onFocus:x,onBlur:y,...b}=e,w=e["aria-describedby"]?[e["aria-describedby"]]:[];return o!=null&&o.hasFeedbackText&&(o!=null&&o.isInvalid)&&w.push(o.feedbackId),o!=null&&o.hasHelpText&&w.push(o.helpTextId),{...b,"aria-describedby":w.join(" ")||void 0,id:s??(o==null?void 0:o.id),isDisabled:(t=i??g)!=null?t:o==null?void 0:o.isDisabled,isReadOnly:(n=l??h)!=null?n:o==null?void 0:o.isReadOnly,isRequired:(r=u??p)!=null?r:o==null?void 0:o.isRequired,isInvalid:m??(o==null?void 0:o.isInvalid),onFocus:He(o==null?void 0:o.onFocus,x),onBlur:He(o==null?void 0:o.onBlur,y)}}var pb={border:"0",clip:"rect(0, 0, 0, 0)",height:"1px",width:"1px",margin:"-1px",padding:"0",overflow:"hidden",whiteSpace:"nowrap",position:"absolute"},f5=we("span",{baseStyle:pb});f5.displayName="VisuallyHidden";var xL=we("input",{baseStyle:pb});xL.displayName="VisuallyHiddenInput";const bL=()=>typeof document<"u";let nS=!1,Ed=null,Vi=!1,j1=!1;const _1=new Set;function mb(e,t){_1.forEach(n=>n(e,t))}const yL=typeof window<"u"&&window.navigator!=null?/^Mac/.test(window.navigator.platform):!1;function CL(e){return!(e.metaKey||!yL&&e.altKey||e.ctrlKey||e.key==="Control"||e.key==="Shift"||e.key==="Meta")}function rS(e){Vi=!0,CL(e)&&(Ed="keyboard",mb("keyboard",e))}function Ol(e){if(Ed="pointer",e.type==="mousedown"||e.type==="pointerdown"){Vi=!0;const t=e.composedPath?e.composedPath()[0]:e.target;let n=!1;try{n=t.matches(":focus-visible")}catch{}if(n)return;mb("pointer",e)}}function wL(e){return e.mozInputSource===0&&e.isTrusted?!0:e.detail===0&&!e.pointerType}function SL(e){wL(e)&&(Vi=!0,Ed="virtual")}function kL(e){e.target===window||e.target===document||(!Vi&&!j1&&(Ed="virtual",mb("virtual",e)),Vi=!1,j1=!1)}function jL(){Vi=!1,j1=!0}function oS(){return Ed!=="pointer"}function _L(){if(!bL()||nS)return;const{focus:e}=HTMLElement.prototype;HTMLElement.prototype.focus=function(...n){Vi=!0,e.apply(this,n)},document.addEventListener("keydown",rS,!0),document.addEventListener("keyup",rS,!0),document.addEventListener("click",SL,!0),window.addEventListener("focus",kL,!0),window.addEventListener("blur",jL,!1),typeof PointerEvent<"u"?(document.addEventListener("pointerdown",Ol,!0),document.addEventListener("pointermove",Ol,!0),document.addEventListener("pointerup",Ol,!0)):(document.addEventListener("mousedown",Ol,!0),document.addEventListener("mousemove",Ol,!0),document.addEventListener("mouseup",Ol,!0)),nS=!0}function p5(e){_L(),e(oS());const t=()=>e(oS());return _1.add(t),()=>{_1.delete(t)}}function IL(e,t=[]){const n=Object.assign({},e);for(const r of t)r in n&&delete n[r];return n}function m5(e={}){const t=fb(e),{isDisabled:n,isReadOnly:r,isRequired:o,isInvalid:s,id:i,onBlur:l,onFocus:u,"aria-describedby":p}=t,{defaultChecked:m,isChecked:h,isFocusable:g,onChange:x,isIndeterminate:y,name:b,value:w,tabIndex:S=void 0,"aria-label":j,"aria-labelledby":_,"aria-invalid":E,...I}=e,M=IL(I,["isDisabled","isReadOnly","isRequired","isInvalid","id","onBlur","onFocus","aria-describedby"]),R=un(x),D=un(l),A=un(u),[O,T]=d.useState(!1),[X,B]=d.useState(!1),[V,U]=d.useState(!1),[N,$]=d.useState(!1);d.useEffect(()=>p5(T),[]);const q=d.useRef(null),[F,Q]=d.useState(!0),[Y,se]=d.useState(!!m),ae=h!==void 0,re=ae?h:Y,G=d.useCallback(fe=>{if(r||n){fe.preventDefault();return}ae||se(re?fe.target.checked:y?!0:fe.target.checked),R==null||R(fe)},[r,n,re,ae,y,R]);rc(()=>{q.current&&(q.current.indeterminate=!!y)},[y]),pa(()=>{n&&B(!1)},[n,B]),rc(()=>{const fe=q.current;if(!(fe!=null&&fe.form))return;const Oe=()=>{se(!!m)};return fe.form.addEventListener("reset",Oe),()=>{var _e;return(_e=fe.form)==null?void 0:_e.removeEventListener("reset",Oe)}},[]);const K=n&&!g,ee=d.useCallback(fe=>{fe.key===" "&&$(!0)},[$]),le=d.useCallback(fe=>{fe.key===" "&&$(!1)},[$]);rc(()=>{if(!q.current)return;q.current.checked!==re&&se(q.current.checked)},[q.current]);const J=d.useCallback((fe={},Oe=null)=>{const _e=Ne=>{X&&Ne.preventDefault(),$(!0)};return{...fe,ref:Oe,"data-active":dt(N),"data-hover":dt(V),"data-checked":dt(re),"data-focus":dt(X),"data-focus-visible":dt(X&&O),"data-indeterminate":dt(y),"data-disabled":dt(n),"data-invalid":dt(s),"data-readonly":dt(r),"aria-hidden":!0,onMouseDown:He(fe.onMouseDown,_e),onMouseUp:He(fe.onMouseUp,()=>$(!1)),onMouseEnter:He(fe.onMouseEnter,()=>U(!0)),onMouseLeave:He(fe.onMouseLeave,()=>U(!1))}},[N,re,n,X,O,V,y,s,r]),ie=d.useCallback((fe={},Oe=null)=>({...fe,ref:Oe,"data-active":dt(N),"data-hover":dt(V),"data-checked":dt(re),"data-focus":dt(X),"data-focus-visible":dt(X&&O),"data-indeterminate":dt(y),"data-disabled":dt(n),"data-invalid":dt(s),"data-readonly":dt(r)}),[N,re,n,X,O,V,y,s,r]),de=d.useCallback((fe={},Oe=null)=>({...M,...fe,ref:It(Oe,_e=>{_e&&Q(_e.tagName==="LABEL")}),onClick:He(fe.onClick,()=>{var _e;F||((_e=q.current)==null||_e.click(),requestAnimationFrame(()=>{var Ne;(Ne=q.current)==null||Ne.focus({preventScroll:!0})}))}),"data-disabled":dt(n),"data-checked":dt(re),"data-invalid":dt(s)}),[M,n,re,s,F]),ge=d.useCallback((fe={},Oe=null)=>({...fe,ref:It(q,Oe),type:"checkbox",name:b,value:w,id:i,tabIndex:S,onChange:He(fe.onChange,G),onBlur:He(fe.onBlur,D,()=>B(!1)),onFocus:He(fe.onFocus,A,()=>B(!0)),onKeyDown:He(fe.onKeyDown,ee),onKeyUp:He(fe.onKeyUp,le),required:o,checked:re,disabled:K,readOnly:r,"aria-label":j,"aria-labelledby":_,"aria-invalid":E?!!E:s,"aria-describedby":p,"aria-disabled":n,style:pb}),[b,w,i,G,D,A,ee,le,o,re,K,r,j,_,E,s,p,n,S]),Ce=d.useCallback((fe={},Oe=null)=>({...fe,ref:Oe,onMouseDown:He(fe.onMouseDown,PL),"data-disabled":dt(n),"data-checked":dt(re),"data-invalid":dt(s)}),[re,n,s]);return{state:{isInvalid:s,isFocused:X,isChecked:re,isActive:N,isHovered:V,isIndeterminate:y,isDisabled:n,isReadOnly:r,isRequired:o},getRootProps:de,getCheckboxProps:J,getIndicatorProps:ie,getInputProps:ge,getLabelProps:Ce,htmlProps:M}}function PL(e){e.preventDefault(),e.stopPropagation()}var EL={display:"inline-flex",alignItems:"center",justifyContent:"center",verticalAlign:"top",userSelect:"none",flexShrink:0},ML={cursor:"pointer",display:"inline-flex",alignItems:"center",verticalAlign:"top",position:"relative"},OL=ma({from:{opacity:0,strokeDashoffset:16,transform:"scale(0.95)"},to:{opacity:1,strokeDashoffset:0,transform:"scale(1)"}}),RL=ma({from:{opacity:0},to:{opacity:1}}),DL=ma({from:{transform:"scaleX(0.65)"},to:{transform:"scaleX(1)"}}),Md=ke(function(t,n){const r=uL(),o={...r,...t},s=Un("Checkbox",o),i=on(t),{spacing:l="0.5rem",className:u,children:p,iconColor:m,iconSize:h,icon:g=a.jsx(mL,{}),isChecked:x,isDisabled:y=r==null?void 0:r.isDisabled,onChange:b,inputProps:w,...S}=i;let j=x;r!=null&&r.value&&i.value&&(j=r.value.includes(i.value));let _=b;r!=null&&r.onChange&&i.value&&(_=ph(r.onChange,b));const{state:E,getInputProps:I,getCheckboxProps:M,getLabelProps:R,getRootProps:D}=m5({...S,isDisabled:y,isChecked:j,onChange:_}),A=dL(E.isChecked),O=d.useMemo(()=>({animation:A?E.isIndeterminate?`${RL} 20ms linear, ${DL} 200ms linear`:`${OL} 200ms linear`:void 0,fontSize:h,color:m,...s.icon}),[m,h,A,E.isIndeterminate,s.icon]),T=d.cloneElement(g,{__css:O,isIndeterminate:E.isIndeterminate,isChecked:E.isChecked});return a.jsxs(we.label,{__css:{...ML,...s.container},className:Ye("chakra-checkbox",u),...D(),children:[a.jsx("input",{className:"chakra-checkbox__input",...I(w,n)}),a.jsx(we.span,{__css:{...EL,...s.control},className:"chakra-checkbox__control",...M(),children:T}),p&&a.jsx(we.span,{className:"chakra-checkbox__label",...R(),__css:{marginStart:l,...s.label},children:p})]})});Md.displayName="Checkbox";function AL(e){const t=parseFloat(e);return typeof t!="number"||Number.isNaN(t)?0:t}function hb(e,t){let n=AL(e);const r=10**(t??10);return n=Math.round(n*r)/r,t?n.toFixed(t):n.toString()}function I1(e){if(!Number.isFinite(e))return 0;let t=1,n=0;for(;Math.round(e*t)/t!==e;)t*=10,n+=1;return n}function om(e,t,n){return(e-t)*100/(n-t)}function h5(e,t,n){return(n-t)*e+t}function P1(e,t,n){const r=Math.round((e-t)/n)*n+t,o=I1(n);return hb(r,o)}function ac(e,t,n){return e==null?e:(n{var O;return r==null?"":(O=av(r,s,n))!=null?O:""}),g=typeof o<"u",x=g?o:m,y=g5(za(x),s),b=n??y,w=d.useCallback(O=>{O!==x&&(g||h(O.toString()),p==null||p(O.toString(),za(O)))},[p,g,x]),S=d.useCallback(O=>{let T=O;return u&&(T=ac(T,i,l)),hb(T,b)},[b,u,l,i]),j=d.useCallback((O=s)=>{let T;x===""?T=za(O):T=za(x)+O,T=S(T),w(T)},[S,s,w,x]),_=d.useCallback((O=s)=>{let T;x===""?T=za(-O):T=za(x)-O,T=S(T),w(T)},[S,s,w,x]),E=d.useCallback(()=>{var O;let T;r==null?T="":T=(O=av(r,s,n))!=null?O:i,w(T)},[r,n,s,w,i]),I=d.useCallback(O=>{var T;const X=(T=av(O,s,b))!=null?T:i;w(X)},[b,s,w,i]),M=za(x);return{isOutOfRange:M>l||M" `}),[$L,gb]=Wt({name:"EditableContext",errorMessage:"useEditableContext: context is undefined. Seems you forgot to wrap the editable components in ``"}),x5={fontSize:"inherit",fontWeight:"inherit",textAlign:"inherit",bg:"transparent"},jh=ke(function(t,n){const{getInputProps:r}=gb(),o=v5(),s=r(t,n),i=Ye("chakra-editable__input",t.className);return a.jsx(we.input,{...s,__css:{outline:0,...x5,...o.input},className:i})});jh.displayName="EditableInput";var _h=ke(function(t,n){const{getPreviewProps:r}=gb(),o=v5(),s=r(t,n),i=Ye("chakra-editable__preview",t.className);return a.jsx(we.span,{...s,__css:{cursor:"text",display:"inline-block",...x5,...o.preview},className:i})});_h.displayName="EditablePreview";function Ri(e,t,n,r){const o=un(n);return d.useEffect(()=>{const s=typeof e=="function"?e():e??document;if(!(!n||!s))return s.addEventListener(t,o,r),()=>{s.removeEventListener(t,o,r)}},[t,e,r,o,n]),()=>{const s=typeof e=="function"?e():e??document;s==null||s.removeEventListener(t,o,r)}}function LL(e){return"current"in e}var b5=()=>typeof window<"u";function zL(){var e;const t=navigator.userAgentData;return(e=t==null?void 0:t.platform)!=null?e:navigator.platform}var FL=e=>b5()&&e.test(navigator.vendor),BL=e=>b5()&&e.test(zL()),HL=()=>BL(/mac|iphone|ipad|ipod/i),VL=()=>HL()&&FL(/apple/i);function y5(e){const{ref:t,elements:n,enabled:r}=e,o=()=>{var s,i;return(i=(s=t.current)==null?void 0:s.ownerDocument)!=null?i:document};Ri(o,"pointerdown",s=>{if(!VL()||!r)return;const i=s.target,u=(n??[t]).some(p=>{const m=LL(p)?p.current:p;return(m==null?void 0:m.contains(i))||m===i});o().activeElement!==i&&u&&(s.preventDefault(),i.focus())})}function sS(e,t){return e?e===t||e.contains(t):!1}function WL(e={}){const{onChange:t,onCancel:n,onSubmit:r,onBlur:o,value:s,isDisabled:i,defaultValue:l,startWithEditView:u,isPreviewFocusable:p=!0,submitOnBlur:m=!0,selectAllOnFocus:h=!0,placeholder:g,onEdit:x,finalFocusRef:y,...b}=e,w=un(x),S=!!(u&&!i),[j,_]=d.useState(S),[E,I]=_d({defaultValue:l||"",value:s,onChange:t}),[M,R]=d.useState(E),D=d.useRef(null),A=d.useRef(null),O=d.useRef(null),T=d.useRef(null),X=d.useRef(null);y5({ref:D,enabled:j,elements:[T,X]});const B=!j&&!i;rc(()=>{var J,ie;j&&((J=D.current)==null||J.focus(),h&&((ie=D.current)==null||ie.select()))},[]),pa(()=>{var J,ie,de,ge;if(!j){y?(J=y.current)==null||J.focus():(ie=O.current)==null||ie.focus();return}(de=D.current)==null||de.focus(),h&&((ge=D.current)==null||ge.select()),w==null||w()},[j,w,h]);const V=d.useCallback(()=>{B&&_(!0)},[B]),U=d.useCallback(()=>{R(E)},[E]),N=d.useCallback(()=>{_(!1),I(M),n==null||n(M),o==null||o(M)},[n,o,I,M]),$=d.useCallback(()=>{_(!1),R(E),r==null||r(E),o==null||o(M)},[E,r,o,M]);d.useEffect(()=>{if(j)return;const J=D.current;(J==null?void 0:J.ownerDocument.activeElement)===J&&(J==null||J.blur())},[j]);const q=d.useCallback(J=>{I(J.currentTarget.value)},[I]),F=d.useCallback(J=>{const ie=J.key,ge={Escape:N,Enter:Ce=>{!Ce.shiftKey&&!Ce.metaKey&&$()}}[ie];ge&&(J.preventDefault(),ge(J))},[N,$]),Q=d.useCallback(J=>{const ie=J.key,ge={Escape:N}[ie];ge&&(J.preventDefault(),ge(J))},[N]),Y=E.length===0,se=d.useCallback(J=>{var ie;if(!j)return;const de=J.currentTarget.ownerDocument,ge=(ie=J.relatedTarget)!=null?ie:de.activeElement,Ce=sS(T.current,ge),he=sS(X.current,ge);!Ce&&!he&&(m?$():N())},[m,$,N,j]),ae=d.useCallback((J={},ie=null)=>{const de=B&&p?0:void 0;return{...J,ref:It(ie,A),children:Y?g:E,hidden:j,"aria-disabled":Co(i),tabIndex:de,onFocus:He(J.onFocus,V,U)}},[i,j,B,p,Y,V,U,g,E]),re=d.useCallback((J={},ie=null)=>({...J,hidden:!j,placeholder:g,ref:It(ie,D),disabled:i,"aria-disabled":Co(i),value:E,onBlur:He(J.onBlur,se),onChange:He(J.onChange,q),onKeyDown:He(J.onKeyDown,F),onFocus:He(J.onFocus,U)}),[i,j,se,q,F,U,g,E]),G=d.useCallback((J={},ie=null)=>({...J,hidden:!j,placeholder:g,ref:It(ie,D),disabled:i,"aria-disabled":Co(i),value:E,onBlur:He(J.onBlur,se),onChange:He(J.onChange,q),onKeyDown:He(J.onKeyDown,Q),onFocus:He(J.onFocus,U)}),[i,j,se,q,Q,U,g,E]),K=d.useCallback((J={},ie=null)=>({"aria-label":"Edit",...J,type:"button",onClick:He(J.onClick,V),ref:It(ie,O),disabled:i}),[V,i]),ee=d.useCallback((J={},ie=null)=>({...J,"aria-label":"Submit",ref:It(X,ie),type:"button",onClick:He(J.onClick,$),disabled:i}),[$,i]),le=d.useCallback((J={},ie=null)=>({"aria-label":"Cancel",id:"cancel",...J,ref:It(T,ie),type:"button",onClick:He(J.onClick,N),disabled:i}),[N,i]);return{isEditing:j,isDisabled:i,isValueEmpty:Y,value:E,onEdit:V,onCancel:N,onSubmit:$,getPreviewProps:ae,getInputProps:re,getTextareaProps:G,getEditButtonProps:K,getSubmitButtonProps:ee,getCancelButtonProps:le,htmlProps:b}}var Ih=ke(function(t,n){const r=Un("Editable",t),o=on(t),{htmlProps:s,...i}=WL(o),{isEditing:l,onSubmit:u,onCancel:p,onEdit:m}=i,h=Ye("chakra-editable",t.className),g=zx(t.children,{isEditing:l,onSubmit:u,onCancel:p,onEdit:m});return a.jsx($L,{value:i,children:a.jsx(NL,{value:r,children:a.jsx(we.div,{ref:n,...s,className:h,children:g})})})});Ih.displayName="Editable";function C5(){const{isEditing:e,getEditButtonProps:t,getCancelButtonProps:n,getSubmitButtonProps:r}=gb();return{isEditing:e,getEditButtonProps:t,getCancelButtonProps:n,getSubmitButtonProps:r}}var w5={exports:{}},UL="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",GL=UL,KL=GL;function S5(){}function k5(){}k5.resetWarningCache=S5;var qL=function(){function e(r,o,s,i,l,u){if(u!==KL){var p=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw p.name="Invariant Violation",p}}e.isRequired=e;function t(){return e}var n={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:k5,resetWarningCache:S5};return n.PropTypes=n,n};w5.exports=qL();var XL=w5.exports;const Jt=xd(XL);var E1="data-focus-lock",j5="data-focus-lock-disabled",QL="data-no-focus-lock",YL="data-autofocus-inside",ZL="data-no-autofocus";function JL(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function ez(e,t){var n=d.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(r){var o=n.value;o!==r&&(n.value=r,n.callback(r,o))}}}})[0];return n.callback=t,n.facade}function _5(e,t){return ez(t||null,function(n){return e.forEach(function(r){return JL(r,n)})})}var iv={width:"1px",height:"0px",padding:0,overflow:"hidden",position:"fixed",top:"1px",left:"1px"},gs=function(){return gs=Object.assign||function(t){for(var n,r=1,o=arguments.length;r0&&s[s.length-1])&&(p[0]===6||p[0]===2)){n=0;continue}if(p[0]===3&&(!s||p[1]>s[0]&&p[1]0)&&!(o=r.next()).done;)s.push(o.value)}catch(l){i={error:l}}finally{try{o&&!o.done&&(n=r.return)&&n.call(r)}finally{if(i)throw i.error}}return s}function M1(e,t,n){if(n||arguments.length===2)for(var r=0,o=t.length,s;r=0}).sort(mz)},hz=["button:enabled","select:enabled","textarea:enabled","input:enabled","a[href]","area[href]","summary","iframe","object","embed","audio[controls]","video[controls]","[tabindex]","[contenteditable]","[autofocus]"],yb=hz.join(","),gz="".concat(yb,", [data-focus-guard]"),W5=function(e,t){return Rs((e.shadowRoot||e).children).reduce(function(n,r){return n.concat(r.matches(t?gz:yb)?[r]:[],W5(r))},[])},vz=function(e,t){var n;return e instanceof HTMLIFrameElement&&(!((n=e.contentDocument)===null||n===void 0)&&n.body)?Ph([e.contentDocument.body],t):[e]},Ph=function(e,t){return e.reduce(function(n,r){var o,s=W5(r,t),i=(o=[]).concat.apply(o,s.map(function(l){return vz(l,t)}));return n.concat(i,r.parentNode?Rs(r.parentNode.querySelectorAll(yb)).filter(function(l){return l===r}):[])},[])},xz=function(e){var t=e.querySelectorAll("[".concat(YL,"]"));return Rs(t).map(function(n){return Ph([n])}).reduce(function(n,r){return n.concat(r)},[])},Cb=function(e,t){return Rs(e).filter(function(n){return L5(t,n)}).filter(function(n){return dz(n)})},iS=function(e,t){return t===void 0&&(t=new Map),Rs(e).filter(function(n){return z5(t,n)})},R1=function(e,t,n){return V5(Cb(Ph(e,n),t),!0,n)},lS=function(e,t){return V5(Cb(Ph(e),t),!1)},bz=function(e,t){return Cb(xz(e),t)},ic=function(e,t){return e.shadowRoot?ic(e.shadowRoot,t):Object.getPrototypeOf(e).contains!==void 0&&Object.getPrototypeOf(e).contains.call(e,t)?!0:Rs(e.children).some(function(n){var r;if(n instanceof HTMLIFrameElement){var o=(r=n.contentDocument)===null||r===void 0?void 0:r.body;return o?ic(o,t):!1}return ic(n,t)})},yz=function(e){for(var t=new Set,n=e.length,r=0;r0&&t.add(o),(s&Node.DOCUMENT_POSITION_CONTAINS)>0&&t.add(r)}return e.filter(function(i,l){return!t.has(l)})},U5=function(e){return e.parentNode?U5(e.parentNode):e},wb=function(e){var t=sm(e);return t.filter(Boolean).reduce(function(n,r){var o=r.getAttribute(E1);return n.push.apply(n,o?yz(Rs(U5(r).querySelectorAll("[".concat(E1,'="').concat(o,'"]:not([').concat(j5,'="disabled"])')))):[r]),n},[])},Cz=function(e){try{return e()}catch{return}},Qu=function(e){if(e===void 0&&(e=document),!(!e||!e.activeElement)){var t=e.activeElement;return t.shadowRoot?Qu(t.shadowRoot):t instanceof HTMLIFrameElement&&Cz(function(){return t.contentWindow.document})?Qu(t.contentWindow.document):t}},wz=function(e,t){return e===t},Sz=function(e,t){return!!Rs(e.querySelectorAll("iframe")).some(function(n){return wz(n,t)})},G5=function(e,t){return t===void 0&&(t=Qu(T5(e).ownerDocument)),!t||t.dataset&&t.dataset.focusGuard?!1:wb(e).some(function(n){return ic(n,t)||Sz(n,t)})},kz=function(e){e===void 0&&(e=document);var t=Qu(e);return t?Rs(e.querySelectorAll("[".concat(QL,"]"))).some(function(n){return ic(n,t)}):!1},jz=function(e,t){return t.filter(H5).filter(function(n){return n.name===e.name}).filter(function(n){return n.checked})[0]||e},Sb=function(e,t){return H5(e)&&e.name?jz(e,t):e},_z=function(e){var t=new Set;return e.forEach(function(n){return t.add(Sb(n,e))}),e.filter(function(n){return t.has(n)})},cS=function(e){return e[0]&&e.length>1?Sb(e[0],e):e[0]},uS=function(e,t){return e.length>1?e.indexOf(Sb(e[t],e)):t},K5="NEW_FOCUS",Iz=function(e,t,n,r){var o=e.length,s=e[0],i=e[o-1],l=bb(n);if(!(n&&e.indexOf(n)>=0)){var u=n!==void 0?t.indexOf(n):-1,p=r?t.indexOf(r):u,m=r?e.indexOf(r):-1,h=u-p,g=t.indexOf(s),x=t.indexOf(i),y=_z(t),b=n!==void 0?y.indexOf(n):-1,w=b-(r?y.indexOf(r):u),S=uS(e,0),j=uS(e,o-1);if(u===-1||m===-1)return K5;if(!h&&m>=0)return m;if(u<=g&&l&&Math.abs(h)>1)return j;if(u>=x&&l&&Math.abs(h)>1)return S;if(h&&Math.abs(w)>1)return m;if(u<=g)return j;if(u>x)return S;if(h)return Math.abs(h)>1?m:(o+m+h)%o}},Pz=function(e){return function(t){var n,r=(n=F5(t))===null||n===void 0?void 0:n.autofocus;return t.autofocus||r!==void 0&&r!=="false"||e.indexOf(t)>=0}},Ez=function(e,t,n){var r=e.map(function(s){var i=s.node;return i}),o=iS(r.filter(Pz(n)));return o&&o.length?cS(o):cS(iS(t))},D1=function(e,t){return t===void 0&&(t=[]),t.push(e),e.parentNode&&D1(e.parentNode.host||e.parentNode,t),t},lv=function(e,t){for(var n=D1(e),r=D1(t),o=0;o=0)return s}return!1},q5=function(e,t,n){var r=sm(e),o=sm(t),s=r[0],i=!1;return o.filter(Boolean).forEach(function(l){i=lv(i||l,l)||i,n.filter(Boolean).forEach(function(u){var p=lv(s,u);p&&(!i||ic(p,i)?i=p:i=lv(p,i))})}),i},Mz=function(e,t){return e.reduce(function(n,r){return n.concat(bz(r,t))},[])},Oz=function(e,t){var n=new Map;return t.forEach(function(r){return n.set(r.node,r)}),e.map(function(r){return n.get(r)}).filter(pz)},Rz=function(e,t){var n=Qu(sm(e).length>0?document:T5(e).ownerDocument),r=wb(e).filter(am),o=q5(n||e,e,r),s=new Map,i=lS(r,s),l=R1(r,s).filter(function(x){var y=x.node;return am(y)});if(!(!l[0]&&(l=i,!l[0]))){var u=lS([o],s).map(function(x){var y=x.node;return y}),p=Oz(u,l),m=p.map(function(x){var y=x.node;return y}),h=Iz(m,u,n,t);if(h===K5){var g=Ez(i,m,Mz(r,s));if(g)return{node:g};console.warn("focus-lock: cannot find any node to move focus into");return}return h===void 0?h:p[h]}},Dz=function(e){var t=wb(e).filter(am),n=q5(e,e,t),r=new Map,o=R1([n],r,!0),s=R1(t,r).filter(function(i){var l=i.node;return am(l)}).map(function(i){var l=i.node;return l});return o.map(function(i){var l=i.node,u=i.index;return{node:l,index:u,lockItem:s.indexOf(l)>=0,guard:bb(l)}})},Az=function(e,t){"focus"in e&&e.focus(t),"contentWindow"in e&&e.contentWindow&&e.contentWindow.focus()},cv=0,uv=!1,X5=function(e,t,n){n===void 0&&(n={});var r=Rz(e,t);if(!uv&&r){if(cv>2){console.error("FocusLock: focus-fighting detected. Only one focus management system could be active. See https://github.com/theKashey/focus-lock/#focus-fighting"),uv=!0,setTimeout(function(){uv=!1},1);return}cv++,Az(r.node,n.focusOptions),cv--}};function kb(e){setTimeout(e,1)}var Tz=function(){return document&&document.activeElement===document.body},Nz=function(){return Tz()||kz()},lc=null,Zl=null,cc=null,Yu=!1,$z=function(){return!0},Lz=function(t){return(lc.whiteList||$z)(t)},zz=function(t,n){cc={observerNode:t,portaledElement:n}},Fz=function(t){return cc&&cc.portaledElement===t};function dS(e,t,n,r){var o=null,s=e;do{var i=r[s];if(i.guard)i.node.dataset.focusAutoGuard&&(o=i);else if(i.lockItem){if(s!==e)return;o=null}else break}while((s+=n)!==t);o&&(o.node.tabIndex=0)}var Bz=function(t){return t&&"current"in t?t.current:t},Hz=function(t){return t?!!Yu:Yu==="meanwhile"},Vz=function e(t,n,r){return n&&(n.host===t&&(!n.activeElement||r.contains(n.activeElement))||n.parentNode&&e(t,n.parentNode,r))},Wz=function(t,n){return n.some(function(r){return Vz(t,r,r)})},im=function(){var t=!1;if(lc){var n=lc,r=n.observed,o=n.persistentFocus,s=n.autoFocus,i=n.shards,l=n.crossFrame,u=n.focusOptions,p=r||cc&&cc.portaledElement,m=document&&document.activeElement;if(p){var h=[p].concat(i.map(Bz).filter(Boolean));if((!m||Lz(m))&&(o||Hz(l)||!Nz()||!Zl&&s)&&(p&&!(G5(h)||m&&Wz(m,h)||Fz(m))&&(document&&!Zl&&m&&!s?(m.blur&&m.blur(),document.body.focus()):(t=X5(h,Zl,{focusOptions:u}),cc={})),Yu=!1,Zl=document&&document.activeElement),document){var g=document&&document.activeElement,x=Dz(h),y=x.map(function(b){var w=b.node;return w}).indexOf(g);y>-1&&(x.filter(function(b){var w=b.guard,S=b.node;return w&&S.dataset.focusAutoGuard}).forEach(function(b){var w=b.node;return w.removeAttribute("tabIndex")}),dS(y,x.length,1,x),dS(y,-1,-1,x))}}}return t},Q5=function(t){im()&&t&&(t.stopPropagation(),t.preventDefault())},jb=function(){return kb(im)},Uz=function(t){var n=t.target,r=t.currentTarget;r.contains(n)||zz(r,n)},Gz=function(){return null},Y5=function(){Yu="just",kb(function(){Yu="meanwhile"})},Kz=function(){document.addEventListener("focusin",Q5),document.addEventListener("focusout",jb),window.addEventListener("blur",Y5)},qz=function(){document.removeEventListener("focusin",Q5),document.removeEventListener("focusout",jb),window.removeEventListener("blur",Y5)};function Xz(e){return e.filter(function(t){var n=t.disabled;return!n})}function Qz(e){var t=e.slice(-1)[0];t&&!lc&&Kz();var n=lc,r=n&&t&&t.id===n.id;lc=t,n&&!r&&(n.onDeactivation(),e.filter(function(o){var s=o.id;return s===n.id}).length||n.returnFocus(!t)),t?(Zl=null,(!r||n.observed!==t.observed)&&t.onActivation(),im(),kb(im)):(qz(),Zl=null)}R5.assignSyncMedium(Uz);D5.assignMedium(jb);nz.assignMedium(function(e){return e({moveFocusInside:X5,focusInside:G5})});const Yz=az(Xz,Qz)(Gz);var Z5=d.forwardRef(function(t,n){return d.createElement(A5,pn({sideCar:Yz,ref:n},t))}),J5=A5.propTypes||{};J5.sideCar;r$(J5,["sideCar"]);Z5.propTypes={};const fS=Z5;function e3(e){return e!=null&&typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.ELEMENT_NODE}function _b(e){var t;if(!e3(e))return!1;const n=(t=e.ownerDocument.defaultView)!=null?t:window;return e instanceof n.HTMLElement}function Zz(e){var t,n;return(n=(t=t3(e))==null?void 0:t.defaultView)!=null?n:window}function t3(e){return e3(e)?e.ownerDocument:document}function Jz(e){return t3(e).activeElement}function eF(e){const t=e.ownerDocument.defaultView||window,{overflow:n,overflowX:r,overflowY:o}=t.getComputedStyle(e);return/auto|scroll|overlay|hidden/.test(n+o+r)}function tF(e){return e.localName==="html"?e:e.assignedSlot||e.parentElement||e.ownerDocument.documentElement}function n3(e){return["html","body","#document"].includes(e.localName)?e.ownerDocument.body:_b(e)&&eF(e)?e:n3(tF(e))}var r3=e=>e.hasAttribute("tabindex"),nF=e=>r3(e)&&e.tabIndex===-1;function rF(e){return!!e.getAttribute("disabled")||!!e.getAttribute("aria-disabled")}function o3(e){return e.parentElement&&o3(e.parentElement)?!0:e.hidden}function oF(e){const t=e.getAttribute("contenteditable");return t!=="false"&&t!=null}function s3(e){if(!_b(e)||o3(e)||rF(e))return!1;const{localName:t}=e;if(["input","select","textarea","button"].indexOf(t)>=0)return!0;const r={a:()=>e.hasAttribute("href"),audio:()=>e.hasAttribute("controls"),video:()=>e.hasAttribute("controls")};return t in r?r[t]():oF(e)?!0:r3(e)}function sF(e){return e?_b(e)&&s3(e)&&!nF(e):!1}var aF=["input:not(:disabled):not([disabled])","select:not(:disabled):not([disabled])","textarea:not(:disabled):not([disabled])","embed","iframe","object","a[href]","area[href]","button:not(:disabled):not([disabled])","[tabindex]","audio[controls]","video[controls]","*[tabindex]:not([aria-disabled])","*[contenteditable]"],iF=aF.join(),lF=e=>e.offsetWidth>0&&e.offsetHeight>0;function a3(e){const t=Array.from(e.querySelectorAll(iF));return t.unshift(e),t.filter(n=>s3(n)&&lF(n))}var pS,cF=(pS=fS.default)!=null?pS:fS,i3=e=>{const{initialFocusRef:t,finalFocusRef:n,contentRef:r,restoreFocus:o,children:s,isDisabled:i,autoFocus:l,persistentFocus:u,lockFocusAcrossFrames:p}=e,m=d.useCallback(()=>{t!=null&&t.current?t.current.focus():r!=null&&r.current&&a3(r.current).length===0&&requestAnimationFrame(()=>{var y;(y=r.current)==null||y.focus()})},[t,r]),h=d.useCallback(()=>{var x;(x=n==null?void 0:n.current)==null||x.focus()},[n]),g=o&&!n;return a.jsx(cF,{crossFrame:p,persistentFocus:u,autoFocus:l,disabled:i,onActivation:m,onDeactivation:h,returnFocus:g,children:s})};i3.displayName="FocusLock";var uF=w$?d.useLayoutEffect:d.useEffect;function A1(e,t=[]){const n=d.useRef(e);return uF(()=>{n.current=e}),d.useCallback((...r)=>{var o;return(o=n.current)==null?void 0:o.call(n,...r)},t)}function dF(e,t,n,r){const o=A1(t);return d.useEffect(()=>{var s;const i=(s=ZC(n))!=null?s:document;if(t)return i.addEventListener(e,o,r),()=>{i.removeEventListener(e,o,r)}},[e,n,r,o,t]),()=>{var s;((s=ZC(n))!=null?s:document).removeEventListener(e,o,r)}}function fF(e,t){const n=d.useId();return d.useMemo(()=>e||[t,n].filter(Boolean).join("-"),[e,t,n])}function pF(e,t){const n=e!==void 0;return[n,n&&typeof e<"u"?e:t]}function Lr(e={}){const{onClose:t,onOpen:n,isOpen:r,id:o}=e,s=A1(n),i=A1(t),[l,u]=d.useState(e.defaultIsOpen||!1),[p,m]=pF(r,l),h=fF(o,"disclosure"),g=d.useCallback(()=>{p||u(!1),i==null||i()},[p,i]),x=d.useCallback(()=>{p||u(!0),s==null||s()},[p,s]),y=d.useCallback(()=>{(m?g:x)()},[m,x,g]);return{isOpen:!!m,onOpen:x,onClose:g,onToggle:y,isControlled:p,getButtonProps:(b={})=>({...b,"aria-expanded":m,"aria-controls":h,onClick:BR(b.onClick,y)}),getDisclosureProps:(b={})=>({...b,hidden:!m,id:h})}}var[mF,hF]=Wt({name:"InputGroupStylesContext",errorMessage:`useInputGroupStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),l3=ke(function(t,n){const r=Un("Input",t),{children:o,className:s,...i}=on(t),l=Ye("chakra-input__group",s),u={},p=kh(o),m=r.field;p.forEach(g=>{var x,y;r&&(m&&g.type.id==="InputLeftElement"&&(u.paddingStart=(x=m.height)!=null?x:m.h),m&&g.type.id==="InputRightElement"&&(u.paddingEnd=(y=m.height)!=null?y:m.h),g.type.id==="InputRightAddon"&&(u.borderEndRadius=0),g.type.id==="InputLeftAddon"&&(u.borderStartRadius=0))});const h=p.map(g=>{var x,y;const b=Z_({size:((x=g.props)==null?void 0:x.size)||t.size,variant:((y=g.props)==null?void 0:y.variant)||t.variant});return g.type.id!=="Input"?d.cloneElement(g,b):d.cloneElement(g,Object.assign(b,u,g.props))});return a.jsx(we.div,{className:l,ref:n,__css:{width:"100%",display:"flex",position:"relative",isolation:"isolate",...r.group},"data-group":!0,...i,children:a.jsx(mF,{value:r,children:h})})});l3.displayName="InputGroup";var gF=we("div",{baseStyle:{display:"flex",alignItems:"center",justifyContent:"center",position:"absolute",top:"0",zIndex:2}}),Eh=ke(function(t,n){var r,o;const{placement:s="left",...i}=t,l=hF(),u=l.field,m={[s==="left"?"insetStart":"insetEnd"]:"0",width:(r=u==null?void 0:u.height)!=null?r:u==null?void 0:u.h,height:(o=u==null?void 0:u.height)!=null?o:u==null?void 0:u.h,fontSize:u==null?void 0:u.fontSize,...l.element};return a.jsx(gF,{ref:n,__css:m,...i})});Eh.id="InputElement";Eh.displayName="InputElement";var c3=ke(function(t,n){const{className:r,...o}=t,s=Ye("chakra-input__left-element",r);return a.jsx(Eh,{ref:n,placement:"left",className:s,...o})});c3.id="InputLeftElement";c3.displayName="InputLeftElement";var Ib=ke(function(t,n){const{className:r,...o}=t,s=Ye("chakra-input__right-element",r);return a.jsx(Eh,{ref:n,placement:"right",className:s,...o})});Ib.id="InputRightElement";Ib.displayName="InputRightElement";var Mh=ke(function(t,n){const{htmlSize:r,...o}=t,s=Un("Input",o),i=on(o),l=db(i),u=Ye("chakra-input",t.className);return a.jsx(we.input,{size:r,...l,__css:s.field,ref:n,className:u})});Mh.displayName="Input";Mh.id="Input";var Oh=ke(function(t,n){const r=oi("Link",t),{className:o,isExternal:s,...i}=on(t);return a.jsx(we.a,{target:s?"_blank":void 0,rel:s?"noopener":void 0,ref:n,className:Ye("chakra-link",o),...i,__css:r})});Oh.displayName="Link";var[vF,u3]=Wt({name:"ListStylesContext",errorMessage:`useListStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),Pb=ke(function(t,n){const r=Un("List",t),{children:o,styleType:s="none",stylePosition:i,spacing:l,...u}=on(t),p=kh(o),h=l?{["& > *:not(style) ~ *:not(style)"]:{mt:l}}:{};return a.jsx(vF,{value:r,children:a.jsx(we.ul,{ref:n,listStyleType:s,listStylePosition:i,role:"list",__css:{...r.container,...h},...u,children:p})})});Pb.displayName="List";var d3=ke((e,t)=>{const{as:n,...r}=e;return a.jsx(Pb,{ref:t,as:"ol",styleType:"decimal",marginStart:"1em",...r})});d3.displayName="OrderedList";var Od=ke(function(t,n){const{as:r,...o}=t;return a.jsx(Pb,{ref:n,as:"ul",styleType:"initial",marginStart:"1em",...o})});Od.displayName="UnorderedList";var Qr=ke(function(t,n){const r=u3();return a.jsx(we.li,{ref:n,...t,__css:r.item})});Qr.displayName="ListItem";var xF=ke(function(t,n){const r=u3();return a.jsx(Tn,{ref:n,role:"presentation",...t,__css:r.icon})});xF.displayName="ListIcon";var Ja=ke(function(t,n){const{templateAreas:r,gap:o,rowGap:s,columnGap:i,column:l,row:u,autoFlow:p,autoRows:m,templateRows:h,autoColumns:g,templateColumns:x,...y}=t,b={display:"grid",gridTemplateAreas:r,gridGap:o,gridRowGap:s,gridColumnGap:i,gridAutoColumns:g,gridColumn:l,gridRow:u,gridAutoFlow:p,gridAutoRows:m,gridTemplateRows:h,gridTemplateColumns:x};return a.jsx(we.div,{ref:n,__css:b,...y})});Ja.displayName="Grid";function f3(e,t){return Array.isArray(e)?e.map(n=>n===null?null:t(n)):a1(e)?Object.keys(e).reduce((n,r)=>(n[r]=t(e[r]),n),{}):e!=null?t(e):null}var ba=we("div",{baseStyle:{flex:1,justifySelf:"stretch",alignSelf:"stretch"}});ba.displayName="Spacer";var p3=e=>a.jsx(we.div,{className:"chakra-stack__item",...e,__css:{display:"inline-block",flex:"0 0 auto",minWidth:0,...e.__css}});p3.displayName="StackItem";function bF(e){const{spacing:t,direction:n}=e,r={column:{my:t,mx:0,borderLeftWidth:0,borderBottomWidth:"1px"},"column-reverse":{my:t,mx:0,borderLeftWidth:0,borderBottomWidth:"1px"},row:{mx:t,my:0,borderLeftWidth:"1px",borderBottomWidth:0},"row-reverse":{mx:t,my:0,borderLeftWidth:"1px",borderBottomWidth:0}};return{"&":f3(n,o=>r[o])}}var Eb=ke((e,t)=>{const{isInline:n,direction:r,align:o,justify:s,spacing:i="0.5rem",wrap:l,children:u,divider:p,className:m,shouldWrapChildren:h,...g}=e,x=n?"row":r??"column",y=d.useMemo(()=>bF({spacing:i,direction:x}),[i,x]),b=!!p,w=!h&&!b,S=d.useMemo(()=>{const _=kh(u);return w?_:_.map((E,I)=>{const M=typeof E.key<"u"?E.key:I,R=I+1===_.length,A=h?a.jsx(p3,{children:E},M):E;if(!b)return A;const O=d.cloneElement(p,{__css:y}),T=R?null:O;return a.jsxs(d.Fragment,{children:[A,T]},M)})},[p,y,b,w,h,u]),j=Ye("chakra-stack",m);return a.jsx(we.div,{ref:t,display:"flex",alignItems:o,justifyContent:s,flexDirection:x,flexWrap:l,gap:b?void 0:i,className:j,...g,children:S})});Eb.displayName="Stack";var m3=ke((e,t)=>a.jsx(Eb,{align:"center",...e,direction:"column",ref:t}));m3.displayName="VStack";var Rh=ke((e,t)=>a.jsx(Eb,{align:"center",...e,direction:"row",ref:t}));Rh.displayName="HStack";function mS(e){return f3(e,t=>t==="auto"?"auto":`span ${t}/span ${t}`)}var Zu=ke(function(t,n){const{area:r,colSpan:o,colStart:s,colEnd:i,rowEnd:l,rowSpan:u,rowStart:p,...m}=t,h=Z_({gridArea:r,gridColumn:mS(o),gridRow:mS(u),gridColumnStart:s,gridColumnEnd:i,gridRowStart:p,gridRowEnd:l});return a.jsx(we.div,{ref:n,__css:h,...m})});Zu.displayName="GridItem";var Ds=ke(function(t,n){const r=oi("Badge",t),{className:o,...s}=on(t);return a.jsx(we.span,{ref:n,className:Ye("chakra-badge",t.className),...s,__css:{display:"inline-block",whiteSpace:"nowrap",verticalAlign:"middle",...r}})});Ds.displayName="Badge";var Yn=ke(function(t,n){const{borderLeftWidth:r,borderBottomWidth:o,borderTopWidth:s,borderRightWidth:i,borderWidth:l,borderStyle:u,borderColor:p,...m}=oi("Divider",t),{className:h,orientation:g="horizontal",__css:x,...y}=on(t),b={vertical:{borderLeftWidth:r||i||l||"1px",height:"100%"},horizontal:{borderBottomWidth:o||s||l||"1px",width:"100%"}};return a.jsx(we.hr,{ref:n,"aria-orientation":g,...y,__css:{...m,border:"0",borderColor:p,borderStyle:u,...b[g],...x},className:Ye("chakra-divider",h)})});Yn.displayName="Divider";function yF(e){const{key:t}=e;return t.length===1||t.length>1&&/[^a-zA-Z0-9]/.test(t)}function CF(e={}){const{timeout:t=300,preventDefault:n=()=>!0}=e,[r,o]=d.useState([]),s=d.useRef(),i=()=>{s.current&&(clearTimeout(s.current),s.current=null)},l=()=>{i(),s.current=setTimeout(()=>{o([]),s.current=null},t)};d.useEffect(()=>i,[]);function u(p){return m=>{if(m.key==="Backspace"){const h=[...r];h.pop(),o(h);return}if(yF(m)){const h=r.concat(m.key);n(m)&&(m.preventDefault(),m.stopPropagation()),o(h),p(h.join("")),l()}}}return u}function wF(e,t,n,r){if(t==null)return r;if(!r)return e.find(i=>n(i).toLowerCase().startsWith(t.toLowerCase()));const o=e.filter(s=>n(s).toLowerCase().startsWith(t.toLowerCase()));if(o.length>0){let s;return o.includes(r)?(s=o.indexOf(r)+1,s===o.length&&(s=0),o[s]):(s=e.indexOf(o[0]),e[s])}return r}function SF(){const e=d.useRef(new Map),t=e.current,n=d.useCallback((o,s,i,l)=>{e.current.set(i,{type:s,el:o,options:l}),o.addEventListener(s,i,l)},[]),r=d.useCallback((o,s,i,l)=>{o.removeEventListener(s,i,l),e.current.delete(i)},[]);return d.useEffect(()=>()=>{t.forEach((o,s)=>{r(o.el,o.type,s,o.options)})},[r,t]),{add:n,remove:r}}function dv(e){const t=e.target,{tagName:n,isContentEditable:r}=t;return n!=="INPUT"&&n!=="TEXTAREA"&&r!==!0}function h3(e={}){const{ref:t,isDisabled:n,isFocusable:r,clickOnEnter:o=!0,clickOnSpace:s=!0,onMouseDown:i,onMouseUp:l,onClick:u,onKeyDown:p,onKeyUp:m,tabIndex:h,onMouseOver:g,onMouseLeave:x,...y}=e,[b,w]=d.useState(!0),[S,j]=d.useState(!1),_=SF(),E=$=>{$&&$.tagName!=="BUTTON"&&w(!1)},I=b?h:h||0,M=n&&!r,R=d.useCallback($=>{if(n){$.stopPropagation(),$.preventDefault();return}$.currentTarget.focus(),u==null||u($)},[n,u]),D=d.useCallback($=>{S&&dv($)&&($.preventDefault(),$.stopPropagation(),j(!1),_.remove(document,"keyup",D,!1))},[S,_]),A=d.useCallback($=>{if(p==null||p($),n||$.defaultPrevented||$.metaKey||!dv($.nativeEvent)||b)return;const q=o&&$.key==="Enter";s&&$.key===" "&&($.preventDefault(),j(!0)),q&&($.preventDefault(),$.currentTarget.click()),_.add(document,"keyup",D,!1)},[n,b,p,o,s,_,D]),O=d.useCallback($=>{if(m==null||m($),n||$.defaultPrevented||$.metaKey||!dv($.nativeEvent)||b)return;s&&$.key===" "&&($.preventDefault(),j(!1),$.currentTarget.click())},[s,b,n,m]),T=d.useCallback($=>{$.button===0&&(j(!1),_.remove(document,"mouseup",T,!1))},[_]),X=d.useCallback($=>{if($.button!==0)return;if(n){$.stopPropagation(),$.preventDefault();return}b||j(!0),$.currentTarget.focus({preventScroll:!0}),_.add(document,"mouseup",T,!1),i==null||i($)},[n,b,i,_,T]),B=d.useCallback($=>{$.button===0&&(b||j(!1),l==null||l($))},[l,b]),V=d.useCallback($=>{if(n){$.preventDefault();return}g==null||g($)},[n,g]),U=d.useCallback($=>{S&&($.preventDefault(),j(!1)),x==null||x($)},[S,x]),N=It(t,E);return b?{...y,ref:N,type:"button","aria-disabled":M?void 0:n,disabled:M,onClick:R,onMouseDown:i,onMouseUp:l,onKeyUp:m,onKeyDown:p,onMouseOver:g,onMouseLeave:x}:{...y,ref:N,role:"button","data-active":dt(S),"aria-disabled":n?"true":void 0,tabIndex:M?void 0:I,onClick:R,onMouseDown:X,onMouseUp:B,onKeyUp:O,onKeyDown:A,onMouseOver:V,onMouseLeave:U}}function kF(e){const t=e.current;if(!t)return!1;const n=Jz(t);return!n||t.contains(n)?!1:!!sF(n)}function g3(e,t){const{shouldFocus:n,visible:r,focusRef:o}=t,s=n&&!r;pa(()=>{if(!s||kF(e))return;const i=(o==null?void 0:o.current)||e.current;let l;if(i)return l=requestAnimationFrame(()=>{i.focus({preventScroll:!0})}),()=>{cancelAnimationFrame(l)}},[s,e,o])}var jF={preventScroll:!0,shouldFocus:!1};function _F(e,t=jF){const{focusRef:n,preventScroll:r,shouldFocus:o,visible:s}=t,i=IF(e)?e.current:e,l=o&&s,u=d.useRef(l),p=d.useRef(s);rc(()=>{!p.current&&s&&(u.current=l),p.current=s},[s,l]);const m=d.useCallback(()=>{if(!(!s||!i||!u.current)&&(u.current=!1,!i.contains(document.activeElement)))if(n!=null&&n.current)requestAnimationFrame(()=>{var h;(h=n.current)==null||h.focus({preventScroll:r})});else{const h=a3(i);h.length>0&&requestAnimationFrame(()=>{h[0].focus({preventScroll:r})})}},[s,r,i,n]);pa(()=>{m()},[m]),Ri(i,"transitionend",m)}function IF(e){return"current"in e}var Rl=(e,t)=>({var:e,varRef:t?`var(${e}, ${t})`:`var(${e})`}),Nn={arrowShadowColor:Rl("--popper-arrow-shadow-color"),arrowSize:Rl("--popper-arrow-size","8px"),arrowSizeHalf:Rl("--popper-arrow-size-half"),arrowBg:Rl("--popper-arrow-bg"),transformOrigin:Rl("--popper-transform-origin"),arrowOffset:Rl("--popper-arrow-offset")};function PF(e){if(e.includes("top"))return"1px 1px 0px 0 var(--popper-arrow-shadow-color)";if(e.includes("bottom"))return"-1px -1px 0px 0 var(--popper-arrow-shadow-color)";if(e.includes("right"))return"-1px 1px 0px 0 var(--popper-arrow-shadow-color)";if(e.includes("left"))return"1px -1px 0px 0 var(--popper-arrow-shadow-color)"}var EF={top:"bottom center","top-start":"bottom left","top-end":"bottom right",bottom:"top center","bottom-start":"top left","bottom-end":"top right",left:"right center","left-start":"right top","left-end":"right bottom",right:"left center","right-start":"left top","right-end":"left bottom"},MF=e=>EF[e],hS={scroll:!0,resize:!0};function OF(e){let t;return typeof e=="object"?t={enabled:!0,options:{...hS,...e}}:t={enabled:e,options:hS},t}var RF={name:"matchWidth",enabled:!0,phase:"beforeWrite",requires:["computeStyles"],fn:({state:e})=>{e.styles.popper.width=`${e.rects.reference.width}px`},effect:({state:e})=>()=>{const t=e.elements.reference;e.elements.popper.style.width=`${t.offsetWidth}px`}},DF={name:"transformOrigin",enabled:!0,phase:"write",fn:({state:e})=>{gS(e)},effect:({state:e})=>()=>{gS(e)}},gS=e=>{e.elements.popper.style.setProperty(Nn.transformOrigin.var,MF(e.placement))},AF={name:"positionArrow",enabled:!0,phase:"afterWrite",fn:({state:e})=>{TF(e)}},TF=e=>{var t;if(!e.placement)return;const n=NF(e.placement);if((t=e.elements)!=null&&t.arrow&&n){Object.assign(e.elements.arrow.style,{[n.property]:n.value,width:Nn.arrowSize.varRef,height:Nn.arrowSize.varRef,zIndex:-1});const r={[Nn.arrowSizeHalf.var]:`calc(${Nn.arrowSize.varRef} / 2 - 1px)`,[Nn.arrowOffset.var]:`calc(${Nn.arrowSizeHalf.varRef} * -1)`};for(const o in r)e.elements.arrow.style.setProperty(o,r[o])}},NF=e=>{if(e.startsWith("top"))return{property:"bottom",value:Nn.arrowOffset.varRef};if(e.startsWith("bottom"))return{property:"top",value:Nn.arrowOffset.varRef};if(e.startsWith("left"))return{property:"right",value:Nn.arrowOffset.varRef};if(e.startsWith("right"))return{property:"left",value:Nn.arrowOffset.varRef}},$F={name:"innerArrow",enabled:!0,phase:"main",requires:["arrow"],fn:({state:e})=>{vS(e)},effect:({state:e})=>()=>{vS(e)}},vS=e=>{if(!e.elements.arrow)return;const t=e.elements.arrow.querySelector("[data-popper-arrow-inner]");if(!t)return;const n=PF(e.placement);n&&t.style.setProperty("--popper-arrow-default-shadow",n),Object.assign(t.style,{transform:"rotate(45deg)",background:Nn.arrowBg.varRef,top:0,left:0,width:"100%",height:"100%",position:"absolute",zIndex:"inherit",boxShadow:"var(--popper-arrow-shadow, var(--popper-arrow-default-shadow))"})},LF={"start-start":{ltr:"left-start",rtl:"right-start"},"start-end":{ltr:"left-end",rtl:"right-end"},"end-start":{ltr:"right-start",rtl:"left-start"},"end-end":{ltr:"right-end",rtl:"left-end"},start:{ltr:"left",rtl:"right"},end:{ltr:"right",rtl:"left"}},zF={"auto-start":"auto-end","auto-end":"auto-start","top-start":"top-end","top-end":"top-start","bottom-start":"bottom-end","bottom-end":"bottom-start"};function FF(e,t="ltr"){var n,r;const o=((n=LF[e])==null?void 0:n[t])||e;return t==="ltr"?o:(r=zF[e])!=null?r:o}var Dr="top",ko="bottom",jo="right",Ar="left",Mb="auto",Rd=[Dr,ko,jo,Ar],xc="start",Ju="end",BF="clippingParents",v3="viewport",Cu="popper",HF="reference",xS=Rd.reduce(function(e,t){return e.concat([t+"-"+xc,t+"-"+Ju])},[]),x3=[].concat(Rd,[Mb]).reduce(function(e,t){return e.concat([t,t+"-"+xc,t+"-"+Ju])},[]),VF="beforeRead",WF="read",UF="afterRead",GF="beforeMain",KF="main",qF="afterMain",XF="beforeWrite",QF="write",YF="afterWrite",ZF=[VF,WF,UF,GF,KF,qF,XF,QF,YF];function ws(e){return e?(e.nodeName||"").toLowerCase():null}function no(e){if(e==null)return window;if(e.toString()!=="[object Window]"){var t=e.ownerDocument;return t&&t.defaultView||window}return e}function Wi(e){var t=no(e).Element;return e instanceof t||e instanceof Element}function wo(e){var t=no(e).HTMLElement;return e instanceof t||e instanceof HTMLElement}function Ob(e){if(typeof ShadowRoot>"u")return!1;var t=no(e).ShadowRoot;return e instanceof t||e instanceof ShadowRoot}function JF(e){var t=e.state;Object.keys(t.elements).forEach(function(n){var r=t.styles[n]||{},o=t.attributes[n]||{},s=t.elements[n];!wo(s)||!ws(s)||(Object.assign(s.style,r),Object.keys(o).forEach(function(i){var l=o[i];l===!1?s.removeAttribute(i):s.setAttribute(i,l===!0?"":l)}))})}function eB(e){var t=e.state,n={popper:{position:t.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(t.elements.popper.style,n.popper),t.styles=n,t.elements.arrow&&Object.assign(t.elements.arrow.style,n.arrow),function(){Object.keys(t.elements).forEach(function(r){var o=t.elements[r],s=t.attributes[r]||{},i=Object.keys(t.styles.hasOwnProperty(r)?t.styles[r]:n[r]),l=i.reduce(function(u,p){return u[p]="",u},{});!wo(o)||!ws(o)||(Object.assign(o.style,l),Object.keys(s).forEach(function(u){o.removeAttribute(u)}))})}}const tB={name:"applyStyles",enabled:!0,phase:"write",fn:JF,effect:eB,requires:["computeStyles"]};function Cs(e){return e.split("-")[0]}var Di=Math.max,lm=Math.min,bc=Math.round;function T1(){var e=navigator.userAgentData;return e!=null&&e.brands&&Array.isArray(e.brands)?e.brands.map(function(t){return t.brand+"/"+t.version}).join(" "):navigator.userAgent}function b3(){return!/^((?!chrome|android).)*safari/i.test(T1())}function yc(e,t,n){t===void 0&&(t=!1),n===void 0&&(n=!1);var r=e.getBoundingClientRect(),o=1,s=1;t&&wo(e)&&(o=e.offsetWidth>0&&bc(r.width)/e.offsetWidth||1,s=e.offsetHeight>0&&bc(r.height)/e.offsetHeight||1);var i=Wi(e)?no(e):window,l=i.visualViewport,u=!b3()&&n,p=(r.left+(u&&l?l.offsetLeft:0))/o,m=(r.top+(u&&l?l.offsetTop:0))/s,h=r.width/o,g=r.height/s;return{width:h,height:g,top:m,right:p+h,bottom:m+g,left:p,x:p,y:m}}function Rb(e){var t=yc(e),n=e.offsetWidth,r=e.offsetHeight;return Math.abs(t.width-n)<=1&&(n=t.width),Math.abs(t.height-r)<=1&&(r=t.height),{x:e.offsetLeft,y:e.offsetTop,width:n,height:r}}function y3(e,t){var n=t.getRootNode&&t.getRootNode();if(e.contains(t))return!0;if(n&&Ob(n)){var r=t;do{if(r&&e.isSameNode(r))return!0;r=r.parentNode||r.host}while(r)}return!1}function aa(e){return no(e).getComputedStyle(e)}function nB(e){return["table","td","th"].indexOf(ws(e))>=0}function si(e){return((Wi(e)?e.ownerDocument:e.document)||window.document).documentElement}function Dh(e){return ws(e)==="html"?e:e.assignedSlot||e.parentNode||(Ob(e)?e.host:null)||si(e)}function bS(e){return!wo(e)||aa(e).position==="fixed"?null:e.offsetParent}function rB(e){var t=/firefox/i.test(T1()),n=/Trident/i.test(T1());if(n&&wo(e)){var r=aa(e);if(r.position==="fixed")return null}var o=Dh(e);for(Ob(o)&&(o=o.host);wo(o)&&["html","body"].indexOf(ws(o))<0;){var s=aa(o);if(s.transform!=="none"||s.perspective!=="none"||s.contain==="paint"||["transform","perspective"].indexOf(s.willChange)!==-1||t&&s.willChange==="filter"||t&&s.filter&&s.filter!=="none")return o;o=o.parentNode}return null}function Dd(e){for(var t=no(e),n=bS(e);n&&nB(n)&&aa(n).position==="static";)n=bS(n);return n&&(ws(n)==="html"||ws(n)==="body"&&aa(n).position==="static")?t:n||rB(e)||t}function Db(e){return["top","bottom"].indexOf(e)>=0?"x":"y"}function Fu(e,t,n){return Di(e,lm(t,n))}function oB(e,t,n){var r=Fu(e,t,n);return r>n?n:r}function C3(){return{top:0,right:0,bottom:0,left:0}}function w3(e){return Object.assign({},C3(),e)}function S3(e,t){return t.reduce(function(n,r){return n[r]=e,n},{})}var sB=function(t,n){return t=typeof t=="function"?t(Object.assign({},n.rects,{placement:n.placement})):t,w3(typeof t!="number"?t:S3(t,Rd))};function aB(e){var t,n=e.state,r=e.name,o=e.options,s=n.elements.arrow,i=n.modifiersData.popperOffsets,l=Cs(n.placement),u=Db(l),p=[Ar,jo].indexOf(l)>=0,m=p?"height":"width";if(!(!s||!i)){var h=sB(o.padding,n),g=Rb(s),x=u==="y"?Dr:Ar,y=u==="y"?ko:jo,b=n.rects.reference[m]+n.rects.reference[u]-i[u]-n.rects.popper[m],w=i[u]-n.rects.reference[u],S=Dd(s),j=S?u==="y"?S.clientHeight||0:S.clientWidth||0:0,_=b/2-w/2,E=h[x],I=j-g[m]-h[y],M=j/2-g[m]/2+_,R=Fu(E,M,I),D=u;n.modifiersData[r]=(t={},t[D]=R,t.centerOffset=R-M,t)}}function iB(e){var t=e.state,n=e.options,r=n.element,o=r===void 0?"[data-popper-arrow]":r;o!=null&&(typeof o=="string"&&(o=t.elements.popper.querySelector(o),!o)||y3(t.elements.popper,o)&&(t.elements.arrow=o))}const lB={name:"arrow",enabled:!0,phase:"main",fn:aB,effect:iB,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function Cc(e){return e.split("-")[1]}var cB={top:"auto",right:"auto",bottom:"auto",left:"auto"};function uB(e,t){var n=e.x,r=e.y,o=t.devicePixelRatio||1;return{x:bc(n*o)/o||0,y:bc(r*o)/o||0}}function yS(e){var t,n=e.popper,r=e.popperRect,o=e.placement,s=e.variation,i=e.offsets,l=e.position,u=e.gpuAcceleration,p=e.adaptive,m=e.roundOffsets,h=e.isFixed,g=i.x,x=g===void 0?0:g,y=i.y,b=y===void 0?0:y,w=typeof m=="function"?m({x,y:b}):{x,y:b};x=w.x,b=w.y;var S=i.hasOwnProperty("x"),j=i.hasOwnProperty("y"),_=Ar,E=Dr,I=window;if(p){var M=Dd(n),R="clientHeight",D="clientWidth";if(M===no(n)&&(M=si(n),aa(M).position!=="static"&&l==="absolute"&&(R="scrollHeight",D="scrollWidth")),M=M,o===Dr||(o===Ar||o===jo)&&s===Ju){E=ko;var A=h&&M===I&&I.visualViewport?I.visualViewport.height:M[R];b-=A-r.height,b*=u?1:-1}if(o===Ar||(o===Dr||o===ko)&&s===Ju){_=jo;var O=h&&M===I&&I.visualViewport?I.visualViewport.width:M[D];x-=O-r.width,x*=u?1:-1}}var T=Object.assign({position:l},p&&cB),X=m===!0?uB({x,y:b},no(n)):{x,y:b};if(x=X.x,b=X.y,u){var B;return Object.assign({},T,(B={},B[E]=j?"0":"",B[_]=S?"0":"",B.transform=(I.devicePixelRatio||1)<=1?"translate("+x+"px, "+b+"px)":"translate3d("+x+"px, "+b+"px, 0)",B))}return Object.assign({},T,(t={},t[E]=j?b+"px":"",t[_]=S?x+"px":"",t.transform="",t))}function dB(e){var t=e.state,n=e.options,r=n.gpuAcceleration,o=r===void 0?!0:r,s=n.adaptive,i=s===void 0?!0:s,l=n.roundOffsets,u=l===void 0?!0:l,p={placement:Cs(t.placement),variation:Cc(t.placement),popper:t.elements.popper,popperRect:t.rects.popper,gpuAcceleration:o,isFixed:t.options.strategy==="fixed"};t.modifiersData.popperOffsets!=null&&(t.styles.popper=Object.assign({},t.styles.popper,yS(Object.assign({},p,{offsets:t.modifiersData.popperOffsets,position:t.options.strategy,adaptive:i,roundOffsets:u})))),t.modifiersData.arrow!=null&&(t.styles.arrow=Object.assign({},t.styles.arrow,yS(Object.assign({},p,{offsets:t.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:u})))),t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-placement":t.placement})}const fB={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:dB,data:{}};var Jf={passive:!0};function pB(e){var t=e.state,n=e.instance,r=e.options,o=r.scroll,s=o===void 0?!0:o,i=r.resize,l=i===void 0?!0:i,u=no(t.elements.popper),p=[].concat(t.scrollParents.reference,t.scrollParents.popper);return s&&p.forEach(function(m){m.addEventListener("scroll",n.update,Jf)}),l&&u.addEventListener("resize",n.update,Jf),function(){s&&p.forEach(function(m){m.removeEventListener("scroll",n.update,Jf)}),l&&u.removeEventListener("resize",n.update,Jf)}}const mB={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:pB,data:{}};var hB={left:"right",right:"left",bottom:"top",top:"bottom"};function Np(e){return e.replace(/left|right|bottom|top/g,function(t){return hB[t]})}var gB={start:"end",end:"start"};function CS(e){return e.replace(/start|end/g,function(t){return gB[t]})}function Ab(e){var t=no(e),n=t.pageXOffset,r=t.pageYOffset;return{scrollLeft:n,scrollTop:r}}function Tb(e){return yc(si(e)).left+Ab(e).scrollLeft}function vB(e,t){var n=no(e),r=si(e),o=n.visualViewport,s=r.clientWidth,i=r.clientHeight,l=0,u=0;if(o){s=o.width,i=o.height;var p=b3();(p||!p&&t==="fixed")&&(l=o.offsetLeft,u=o.offsetTop)}return{width:s,height:i,x:l+Tb(e),y:u}}function xB(e){var t,n=si(e),r=Ab(e),o=(t=e.ownerDocument)==null?void 0:t.body,s=Di(n.scrollWidth,n.clientWidth,o?o.scrollWidth:0,o?o.clientWidth:0),i=Di(n.scrollHeight,n.clientHeight,o?o.scrollHeight:0,o?o.clientHeight:0),l=-r.scrollLeft+Tb(e),u=-r.scrollTop;return aa(o||n).direction==="rtl"&&(l+=Di(n.clientWidth,o?o.clientWidth:0)-s),{width:s,height:i,x:l,y:u}}function Nb(e){var t=aa(e),n=t.overflow,r=t.overflowX,o=t.overflowY;return/auto|scroll|overlay|hidden/.test(n+o+r)}function k3(e){return["html","body","#document"].indexOf(ws(e))>=0?e.ownerDocument.body:wo(e)&&Nb(e)?e:k3(Dh(e))}function Bu(e,t){var n;t===void 0&&(t=[]);var r=k3(e),o=r===((n=e.ownerDocument)==null?void 0:n.body),s=no(r),i=o?[s].concat(s.visualViewport||[],Nb(r)?r:[]):r,l=t.concat(i);return o?l:l.concat(Bu(Dh(i)))}function N1(e){return Object.assign({},e,{left:e.x,top:e.y,right:e.x+e.width,bottom:e.y+e.height})}function bB(e,t){var n=yc(e,!1,t==="fixed");return n.top=n.top+e.clientTop,n.left=n.left+e.clientLeft,n.bottom=n.top+e.clientHeight,n.right=n.left+e.clientWidth,n.width=e.clientWidth,n.height=e.clientHeight,n.x=n.left,n.y=n.top,n}function wS(e,t,n){return t===v3?N1(vB(e,n)):Wi(t)?bB(t,n):N1(xB(si(e)))}function yB(e){var t=Bu(Dh(e)),n=["absolute","fixed"].indexOf(aa(e).position)>=0,r=n&&wo(e)?Dd(e):e;return Wi(r)?t.filter(function(o){return Wi(o)&&y3(o,r)&&ws(o)!=="body"}):[]}function CB(e,t,n,r){var o=t==="clippingParents"?yB(e):[].concat(t),s=[].concat(o,[n]),i=s[0],l=s.reduce(function(u,p){var m=wS(e,p,r);return u.top=Di(m.top,u.top),u.right=lm(m.right,u.right),u.bottom=lm(m.bottom,u.bottom),u.left=Di(m.left,u.left),u},wS(e,i,r));return l.width=l.right-l.left,l.height=l.bottom-l.top,l.x=l.left,l.y=l.top,l}function j3(e){var t=e.reference,n=e.element,r=e.placement,o=r?Cs(r):null,s=r?Cc(r):null,i=t.x+t.width/2-n.width/2,l=t.y+t.height/2-n.height/2,u;switch(o){case Dr:u={x:i,y:t.y-n.height};break;case ko:u={x:i,y:t.y+t.height};break;case jo:u={x:t.x+t.width,y:l};break;case Ar:u={x:t.x-n.width,y:l};break;default:u={x:t.x,y:t.y}}var p=o?Db(o):null;if(p!=null){var m=p==="y"?"height":"width";switch(s){case xc:u[p]=u[p]-(t[m]/2-n[m]/2);break;case Ju:u[p]=u[p]+(t[m]/2-n[m]/2);break}}return u}function ed(e,t){t===void 0&&(t={});var n=t,r=n.placement,o=r===void 0?e.placement:r,s=n.strategy,i=s===void 0?e.strategy:s,l=n.boundary,u=l===void 0?BF:l,p=n.rootBoundary,m=p===void 0?v3:p,h=n.elementContext,g=h===void 0?Cu:h,x=n.altBoundary,y=x===void 0?!1:x,b=n.padding,w=b===void 0?0:b,S=w3(typeof w!="number"?w:S3(w,Rd)),j=g===Cu?HF:Cu,_=e.rects.popper,E=e.elements[y?j:g],I=CB(Wi(E)?E:E.contextElement||si(e.elements.popper),u,m,i),M=yc(e.elements.reference),R=j3({reference:M,element:_,strategy:"absolute",placement:o}),D=N1(Object.assign({},_,R)),A=g===Cu?D:M,O={top:I.top-A.top+S.top,bottom:A.bottom-I.bottom+S.bottom,left:I.left-A.left+S.left,right:A.right-I.right+S.right},T=e.modifiersData.offset;if(g===Cu&&T){var X=T[o];Object.keys(O).forEach(function(B){var V=[jo,ko].indexOf(B)>=0?1:-1,U=[Dr,ko].indexOf(B)>=0?"y":"x";O[B]+=X[U]*V})}return O}function wB(e,t){t===void 0&&(t={});var n=t,r=n.placement,o=n.boundary,s=n.rootBoundary,i=n.padding,l=n.flipVariations,u=n.allowedAutoPlacements,p=u===void 0?x3:u,m=Cc(r),h=m?l?xS:xS.filter(function(y){return Cc(y)===m}):Rd,g=h.filter(function(y){return p.indexOf(y)>=0});g.length===0&&(g=h);var x=g.reduce(function(y,b){return y[b]=ed(e,{placement:b,boundary:o,rootBoundary:s,padding:i})[Cs(b)],y},{});return Object.keys(x).sort(function(y,b){return x[y]-x[b]})}function SB(e){if(Cs(e)===Mb)return[];var t=Np(e);return[CS(e),t,CS(t)]}function kB(e){var t=e.state,n=e.options,r=e.name;if(!t.modifiersData[r]._skip){for(var o=n.mainAxis,s=o===void 0?!0:o,i=n.altAxis,l=i===void 0?!0:i,u=n.fallbackPlacements,p=n.padding,m=n.boundary,h=n.rootBoundary,g=n.altBoundary,x=n.flipVariations,y=x===void 0?!0:x,b=n.allowedAutoPlacements,w=t.options.placement,S=Cs(w),j=S===w,_=u||(j||!y?[Np(w)]:SB(w)),E=[w].concat(_).reduce(function(re,G){return re.concat(Cs(G)===Mb?wB(t,{placement:G,boundary:m,rootBoundary:h,padding:p,flipVariations:y,allowedAutoPlacements:b}):G)},[]),I=t.rects.reference,M=t.rects.popper,R=new Map,D=!0,A=E[0],O=0;O=0,U=V?"width":"height",N=ed(t,{placement:T,boundary:m,rootBoundary:h,altBoundary:g,padding:p}),$=V?B?jo:Ar:B?ko:Dr;I[U]>M[U]&&($=Np($));var q=Np($),F=[];if(s&&F.push(N[X]<=0),l&&F.push(N[$]<=0,N[q]<=0),F.every(function(re){return re})){A=T,D=!1;break}R.set(T,F)}if(D)for(var Q=y?3:1,Y=function(G){var K=E.find(function(ee){var le=R.get(ee);if(le)return le.slice(0,G).every(function(J){return J})});if(K)return A=K,"break"},se=Q;se>0;se--){var ae=Y(se);if(ae==="break")break}t.placement!==A&&(t.modifiersData[r]._skip=!0,t.placement=A,t.reset=!0)}}const jB={name:"flip",enabled:!0,phase:"main",fn:kB,requiresIfExists:["offset"],data:{_skip:!1}};function SS(e,t,n){return n===void 0&&(n={x:0,y:0}),{top:e.top-t.height-n.y,right:e.right-t.width+n.x,bottom:e.bottom-t.height+n.y,left:e.left-t.width-n.x}}function kS(e){return[Dr,jo,ko,Ar].some(function(t){return e[t]>=0})}function _B(e){var t=e.state,n=e.name,r=t.rects.reference,o=t.rects.popper,s=t.modifiersData.preventOverflow,i=ed(t,{elementContext:"reference"}),l=ed(t,{altBoundary:!0}),u=SS(i,r),p=SS(l,o,s),m=kS(u),h=kS(p);t.modifiersData[n]={referenceClippingOffsets:u,popperEscapeOffsets:p,isReferenceHidden:m,hasPopperEscaped:h},t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-reference-hidden":m,"data-popper-escaped":h})}const IB={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:_B};function PB(e,t,n){var r=Cs(e),o=[Ar,Dr].indexOf(r)>=0?-1:1,s=typeof n=="function"?n(Object.assign({},t,{placement:e})):n,i=s[0],l=s[1];return i=i||0,l=(l||0)*o,[Ar,jo].indexOf(r)>=0?{x:l,y:i}:{x:i,y:l}}function EB(e){var t=e.state,n=e.options,r=e.name,o=n.offset,s=o===void 0?[0,0]:o,i=x3.reduce(function(m,h){return m[h]=PB(h,t.rects,s),m},{}),l=i[t.placement],u=l.x,p=l.y;t.modifiersData.popperOffsets!=null&&(t.modifiersData.popperOffsets.x+=u,t.modifiersData.popperOffsets.y+=p),t.modifiersData[r]=i}const MB={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:EB};function OB(e){var t=e.state,n=e.name;t.modifiersData[n]=j3({reference:t.rects.reference,element:t.rects.popper,strategy:"absolute",placement:t.placement})}const RB={name:"popperOffsets",enabled:!0,phase:"read",fn:OB,data:{}};function DB(e){return e==="x"?"y":"x"}function AB(e){var t=e.state,n=e.options,r=e.name,o=n.mainAxis,s=o===void 0?!0:o,i=n.altAxis,l=i===void 0?!1:i,u=n.boundary,p=n.rootBoundary,m=n.altBoundary,h=n.padding,g=n.tether,x=g===void 0?!0:g,y=n.tetherOffset,b=y===void 0?0:y,w=ed(t,{boundary:u,rootBoundary:p,padding:h,altBoundary:m}),S=Cs(t.placement),j=Cc(t.placement),_=!j,E=Db(S),I=DB(E),M=t.modifiersData.popperOffsets,R=t.rects.reference,D=t.rects.popper,A=typeof b=="function"?b(Object.assign({},t.rects,{placement:t.placement})):b,O=typeof A=="number"?{mainAxis:A,altAxis:A}:Object.assign({mainAxis:0,altAxis:0},A),T=t.modifiersData.offset?t.modifiersData.offset[t.placement]:null,X={x:0,y:0};if(M){if(s){var B,V=E==="y"?Dr:Ar,U=E==="y"?ko:jo,N=E==="y"?"height":"width",$=M[E],q=$+w[V],F=$-w[U],Q=x?-D[N]/2:0,Y=j===xc?R[N]:D[N],se=j===xc?-D[N]:-R[N],ae=t.elements.arrow,re=x&&ae?Rb(ae):{width:0,height:0},G=t.modifiersData["arrow#persistent"]?t.modifiersData["arrow#persistent"].padding:C3(),K=G[V],ee=G[U],le=Fu(0,R[N],re[N]),J=_?R[N]/2-Q-le-K-O.mainAxis:Y-le-K-O.mainAxis,ie=_?-R[N]/2+Q+le+ee+O.mainAxis:se+le+ee+O.mainAxis,de=t.elements.arrow&&Dd(t.elements.arrow),ge=de?E==="y"?de.clientTop||0:de.clientLeft||0:0,Ce=(B=T==null?void 0:T[E])!=null?B:0,he=$+J-Ce-ge,fe=$+ie-Ce,Oe=Fu(x?lm(q,he):q,$,x?Di(F,fe):F);M[E]=Oe,X[E]=Oe-$}if(l){var _e,Ne=E==="x"?Dr:Ar,nt=E==="x"?ko:jo,$e=M[I],Pt=I==="y"?"height":"width",Ze=$e+w[Ne],ot=$e-w[nt],ye=[Dr,Ar].indexOf(S)!==-1,De=(_e=T==null?void 0:T[I])!=null?_e:0,ut=ye?Ze:$e-R[Pt]-D[Pt]-De+O.altAxis,bt=ye?$e+R[Pt]+D[Pt]-De-O.altAxis:ot,be=x&&ye?oB(ut,$e,bt):Fu(x?ut:Ze,$e,x?bt:ot);M[I]=be,X[I]=be-$e}t.modifiersData[r]=X}}const TB={name:"preventOverflow",enabled:!0,phase:"main",fn:AB,requiresIfExists:["offset"]};function NB(e){return{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}}function $B(e){return e===no(e)||!wo(e)?Ab(e):NB(e)}function LB(e){var t=e.getBoundingClientRect(),n=bc(t.width)/e.offsetWidth||1,r=bc(t.height)/e.offsetHeight||1;return n!==1||r!==1}function zB(e,t,n){n===void 0&&(n=!1);var r=wo(t),o=wo(t)&&LB(t),s=si(t),i=yc(e,o,n),l={scrollLeft:0,scrollTop:0},u={x:0,y:0};return(r||!r&&!n)&&((ws(t)!=="body"||Nb(s))&&(l=$B(t)),wo(t)?(u=yc(t,!0),u.x+=t.clientLeft,u.y+=t.clientTop):s&&(u.x=Tb(s))),{x:i.left+l.scrollLeft-u.x,y:i.top+l.scrollTop-u.y,width:i.width,height:i.height}}function FB(e){var t=new Map,n=new Set,r=[];e.forEach(function(s){t.set(s.name,s)});function o(s){n.add(s.name);var i=[].concat(s.requires||[],s.requiresIfExists||[]);i.forEach(function(l){if(!n.has(l)){var u=t.get(l);u&&o(u)}}),r.push(s)}return e.forEach(function(s){n.has(s.name)||o(s)}),r}function BB(e){var t=FB(e);return ZF.reduce(function(n,r){return n.concat(t.filter(function(o){return o.phase===r}))},[])}function HB(e){var t;return function(){return t||(t=new Promise(function(n){Promise.resolve().then(function(){t=void 0,n(e())})})),t}}function VB(e){var t=e.reduce(function(n,r){var o=n[r.name];return n[r.name]=o?Object.assign({},o,r,{options:Object.assign({},o.options,r.options),data:Object.assign({},o.data,r.data)}):r,n},{});return Object.keys(t).map(function(n){return t[n]})}var jS={placement:"bottom",modifiers:[],strategy:"absolute"};function _S(){for(var e=arguments.length,t=new Array(e),n=0;n{}),_=d.useCallback(()=>{var O;!t||!y.current||!b.current||((O=j.current)==null||O.call(j),w.current=GB(y.current,b.current,{placement:S,modifiers:[$F,AF,DF,{...RF,enabled:!!g},{name:"eventListeners",...OF(i)},{name:"arrow",options:{padding:s}},{name:"offset",options:{offset:l??[0,u]}},{name:"flip",enabled:!!p,options:{padding:8}},{name:"preventOverflow",enabled:!!h,options:{boundary:m}},...n??[]],strategy:o}),w.current.forceUpdate(),j.current=w.current.destroy)},[S,t,n,g,i,s,l,u,p,h,m,o]);d.useEffect(()=>()=>{var O;!y.current&&!b.current&&((O=w.current)==null||O.destroy(),w.current=null)},[]);const E=d.useCallback(O=>{y.current=O,_()},[_]),I=d.useCallback((O={},T=null)=>({...O,ref:It(E,T)}),[E]),M=d.useCallback(O=>{b.current=O,_()},[_]),R=d.useCallback((O={},T=null)=>({...O,ref:It(M,T),style:{...O.style,position:o,minWidth:g?void 0:"max-content",inset:"0 auto auto 0"}}),[o,M,g]),D=d.useCallback((O={},T=null)=>{const{size:X,shadowColor:B,bg:V,style:U,...N}=O;return{...N,ref:T,"data-popper-arrow":"",style:KB(O)}},[]),A=d.useCallback((O={},T=null)=>({...O,ref:T,"data-popper-arrow-inner":""}),[]);return{update(){var O;(O=w.current)==null||O.update()},forceUpdate(){var O;(O=w.current)==null||O.forceUpdate()},transformOrigin:Nn.transformOrigin.varRef,referenceRef:E,popperRef:M,getPopperProps:R,getArrowProps:D,getArrowInnerProps:A,getReferenceProps:I}}function KB(e){const{size:t,shadowColor:n,bg:r,style:o}=e,s={...o,position:"absolute"};return t&&(s["--popper-arrow-size"]=t),n&&(s["--popper-arrow-shadow-color"]=n),r&&(s["--popper-arrow-bg"]=r),s}function Lb(e={}){const{onClose:t,onOpen:n,isOpen:r,id:o}=e,s=un(n),i=un(t),[l,u]=d.useState(e.defaultIsOpen||!1),p=r!==void 0?r:l,m=r!==void 0,h=d.useId(),g=o??`disclosure-${h}`,x=d.useCallback(()=>{m||u(!1),i==null||i()},[m,i]),y=d.useCallback(()=>{m||u(!0),s==null||s()},[m,s]),b=d.useCallback(()=>{p?x():y()},[p,y,x]);function w(j={}){return{...j,"aria-expanded":p,"aria-controls":g,onClick(_){var E;(E=j.onClick)==null||E.call(j,_),b()}}}function S(j={}){return{...j,hidden:!p,id:g}}return{isOpen:p,onOpen:y,onClose:x,onToggle:b,isControlled:m,getButtonProps:w,getDisclosureProps:S}}function qB(e){const{ref:t,handler:n,enabled:r=!0}=e,o=un(n),i=d.useRef({isPointerDown:!1,ignoreEmulatedMouseEvents:!1}).current;d.useEffect(()=>{if(!r)return;const l=h=>{fv(h,t)&&(i.isPointerDown=!0)},u=h=>{if(i.ignoreEmulatedMouseEvents){i.ignoreEmulatedMouseEvents=!1;return}i.isPointerDown&&n&&fv(h,t)&&(i.isPointerDown=!1,o(h))},p=h=>{i.ignoreEmulatedMouseEvents=!0,n&&i.isPointerDown&&fv(h,t)&&(i.isPointerDown=!1,o(h))},m=_3(t.current);return m.addEventListener("mousedown",l,!0),m.addEventListener("mouseup",u,!0),m.addEventListener("touchstart",l,!0),m.addEventListener("touchend",p,!0),()=>{m.removeEventListener("mousedown",l,!0),m.removeEventListener("mouseup",u,!0),m.removeEventListener("touchstart",l,!0),m.removeEventListener("touchend",p,!0)}},[n,t,o,i,r])}function fv(e,t){var n;const r=e.target;return r&&!_3(r).contains(r)?!1:!((n=t.current)!=null&&n.contains(r))}function _3(e){var t;return(t=e==null?void 0:e.ownerDocument)!=null?t:document}function I3(e){const{isOpen:t,ref:n}=e,[r,o]=d.useState(t),[s,i]=d.useState(!1);return d.useEffect(()=>{s||(o(t),i(!0))},[t,s,r]),Ri(()=>n.current,"animationend",()=>{o(t)}),{present:!(t?!1:!r),onComplete(){var u;const p=Zz(n.current),m=new p.CustomEvent("animationend",{bubbles:!0});(u=n.current)==null||u.dispatchEvent(m)}}}function zb(e){const{wasSelected:t,enabled:n,isSelected:r,mode:o="unmount"}=e;return!!(!n||r||o==="keepMounted"&&t)}var[XB,QB,YB,ZB]=lb(),[JB,Ad]=Wt({strict:!1,name:"MenuContext"});function eH(e,...t){const n=d.useId(),r=e||n;return d.useMemo(()=>t.map(o=>`${o}-${r}`),[r,t])}function P3(e){var t;return(t=e==null?void 0:e.ownerDocument)!=null?t:document}function IS(e){return P3(e).activeElement===e}function tH(e={}){const{id:t,closeOnSelect:n=!0,closeOnBlur:r=!0,initialFocusRef:o,autoSelect:s=!0,isLazy:i,isOpen:l,defaultIsOpen:u,onClose:p,onOpen:m,placement:h="bottom-start",lazyBehavior:g="unmount",direction:x,computePositionOnMount:y=!1,...b}=e,w=d.useRef(null),S=d.useRef(null),j=YB(),_=d.useCallback(()=>{requestAnimationFrame(()=>{var ae;(ae=w.current)==null||ae.focus({preventScroll:!1})})},[]),E=d.useCallback(()=>{const ae=setTimeout(()=>{var re;if(o)(re=o.current)==null||re.focus();else{const G=j.firstEnabled();G&&B(G.index)}});q.current.add(ae)},[j,o]),I=d.useCallback(()=>{const ae=setTimeout(()=>{const re=j.lastEnabled();re&&B(re.index)});q.current.add(ae)},[j]),M=d.useCallback(()=>{m==null||m(),s?E():_()},[s,E,_,m]),{isOpen:R,onOpen:D,onClose:A,onToggle:O}=Lb({isOpen:l,defaultIsOpen:u,onClose:p,onOpen:M});qB({enabled:R&&r,ref:w,handler:ae=>{var re;(re=S.current)!=null&&re.contains(ae.target)||A()}});const T=$b({...b,enabled:R||y,placement:h,direction:x}),[X,B]=d.useState(-1);pa(()=>{R||B(-1)},[R]),g3(w,{focusRef:S,visible:R,shouldFocus:!0});const V=I3({isOpen:R,ref:w}),[U,N]=eH(t,"menu-button","menu-list"),$=d.useCallback(()=>{D(),_()},[D,_]),q=d.useRef(new Set([]));lH(()=>{q.current.forEach(ae=>clearTimeout(ae)),q.current.clear()});const F=d.useCallback(()=>{D(),E()},[E,D]),Q=d.useCallback(()=>{D(),I()},[D,I]),Y=d.useCallback(()=>{var ae,re;const G=P3(w.current),K=(ae=w.current)==null?void 0:ae.contains(G.activeElement);if(!(R&&!K))return;const le=(re=j.item(X))==null?void 0:re.node;le==null||le.focus()},[R,X,j]),se=d.useRef(null);return{openAndFocusMenu:$,openAndFocusFirstItem:F,openAndFocusLastItem:Q,onTransitionEnd:Y,unstable__animationState:V,descendants:j,popper:T,buttonId:U,menuId:N,forceUpdate:T.forceUpdate,orientation:"vertical",isOpen:R,onToggle:O,onOpen:D,onClose:A,menuRef:w,buttonRef:S,focusedIndex:X,closeOnSelect:n,closeOnBlur:r,autoSelect:s,setFocusedIndex:B,isLazy:i,lazyBehavior:g,initialFocusRef:o,rafId:se}}function nH(e={},t=null){const n=Ad(),{onToggle:r,popper:o,openAndFocusFirstItem:s,openAndFocusLastItem:i}=n,l=d.useCallback(u=>{const p=u.key,h={Enter:s,ArrowDown:s,ArrowUp:i}[p];h&&(u.preventDefault(),u.stopPropagation(),h(u))},[s,i]);return{...e,ref:It(n.buttonRef,t,o.referenceRef),id:n.buttonId,"data-active":dt(n.isOpen),"aria-expanded":n.isOpen,"aria-haspopup":"menu","aria-controls":n.menuId,onClick:He(e.onClick,r),onKeyDown:He(e.onKeyDown,l)}}function $1(e){var t;return aH(e)&&!!((t=e==null?void 0:e.getAttribute("role"))!=null&&t.startsWith("menuitem"))}function rH(e={},t=null){const n=Ad();if(!n)throw new Error("useMenuContext: context is undefined. Seems you forgot to wrap component within ");const{focusedIndex:r,setFocusedIndex:o,menuRef:s,isOpen:i,onClose:l,menuId:u,isLazy:p,lazyBehavior:m,unstable__animationState:h}=n,g=QB(),x=CF({preventDefault:S=>S.key!==" "&&$1(S.target)}),y=d.useCallback(S=>{if(!S.currentTarget.contains(S.target))return;const j=S.key,E={Tab:M=>M.preventDefault(),Escape:l,ArrowDown:()=>{const M=g.nextEnabled(r);M&&o(M.index)},ArrowUp:()=>{const M=g.prevEnabled(r);M&&o(M.index)}}[j];if(E){S.preventDefault(),E(S);return}const I=x(M=>{const R=wF(g.values(),M,D=>{var A,O;return(O=(A=D==null?void 0:D.node)==null?void 0:A.textContent)!=null?O:""},g.item(r));if(R){const D=g.indexOf(R.node);o(D)}});$1(S.target)&&I(S)},[g,r,x,l,o]),b=d.useRef(!1);i&&(b.current=!0);const w=zb({wasSelected:b.current,enabled:p,mode:m,isSelected:h.present});return{...e,ref:It(s,t),children:w?e.children:null,tabIndex:-1,role:"menu",id:u,style:{...e.style,transformOrigin:"var(--popper-transform-origin)"},"aria-orientation":"vertical",onKeyDown:He(e.onKeyDown,y)}}function oH(e={}){const{popper:t,isOpen:n}=Ad();return t.getPopperProps({...e,style:{visibility:n?"visible":"hidden",...e.style}})}function sH(e={},t=null){const{onMouseEnter:n,onMouseMove:r,onMouseLeave:o,onClick:s,onFocus:i,isDisabled:l,isFocusable:u,closeOnSelect:p,type:m,...h}=e,g=Ad(),{setFocusedIndex:x,focusedIndex:y,closeOnSelect:b,onClose:w,menuRef:S,isOpen:j,menuId:_,rafId:E}=g,I=d.useRef(null),M=`${_}-menuitem-${d.useId()}`,{index:R,register:D}=ZB({disabled:l&&!u}),A=d.useCallback($=>{n==null||n($),!l&&x(R)},[x,R,l,n]),O=d.useCallback($=>{r==null||r($),I.current&&!IS(I.current)&&A($)},[A,r]),T=d.useCallback($=>{o==null||o($),!l&&x(-1)},[x,l,o]),X=d.useCallback($=>{s==null||s($),$1($.currentTarget)&&(p??b)&&w()},[w,s,b,p]),B=d.useCallback($=>{i==null||i($),x(R)},[x,i,R]),V=R===y,U=l&&!u;pa(()=>{j&&(V&&!U&&I.current?(E.current&&cancelAnimationFrame(E.current),E.current=requestAnimationFrame(()=>{var $;($=I.current)==null||$.focus(),E.current=null})):S.current&&!IS(S.current)&&S.current.focus({preventScroll:!0}))},[V,U,S,j]);const N=h3({onClick:X,onFocus:B,onMouseEnter:A,onMouseMove:O,onMouseLeave:T,ref:It(D,I,t),isDisabled:l,isFocusable:u});return{...h,...N,type:m??N.type,id:M,role:"menuitem",tabIndex:V?0:-1}}function aH(e){var t;if(!iH(e))return!1;const n=(t=e.ownerDocument.defaultView)!=null?t:window;return e instanceof n.HTMLElement}function iH(e){return e!=null&&typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.ELEMENT_NODE}function lH(e,t=[]){return d.useEffect(()=>()=>e(),t)}var[cH,$c]=Wt({name:"MenuStylesContext",errorMessage:`useMenuStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),Ah=e=>{const{children:t}=e,n=Un("Menu",e),r=on(e),{direction:o}=bd(),{descendants:s,...i}=tH({...r,direction:o}),l=d.useMemo(()=>i,[i]),{isOpen:u,onClose:p,forceUpdate:m}=l;return a.jsx(XB,{value:s,children:a.jsx(JB,{value:l,children:a.jsx(cH,{value:n,children:zx(t,{isOpen:u,onClose:p,forceUpdate:m})})})})};Ah.displayName="Menu";var E3=ke((e,t)=>{const n=$c();return a.jsx(we.span,{ref:t,...e,__css:n.command,className:"chakra-menu__command"})});E3.displayName="MenuCommand";var uH=ke((e,t)=>{const{type:n,...r}=e,o=$c(),s=r.as||n?n??void 0:"button",i=d.useMemo(()=>({textDecoration:"none",color:"inherit",userSelect:"none",display:"flex",width:"100%",alignItems:"center",textAlign:"start",flex:"0 0 auto",outline:0,...o.item}),[o.item]);return a.jsx(we.button,{ref:t,type:s,...r,__css:i})}),M3=e=>{const{className:t,children:n,...r}=e,o=$c(),s=d.Children.only(n),i=d.isValidElement(s)?d.cloneElement(s,{focusable:"false","aria-hidden":!0,className:Ye("chakra-menu__icon",s.props.className)}):null,l=Ye("chakra-menu__icon-wrapper",t);return a.jsx(we.span,{className:l,...r,__css:o.icon,children:i})};M3.displayName="MenuIcon";var en=ke((e,t)=>{const{icon:n,iconSpacing:r="0.75rem",command:o,commandSpacing:s="0.75rem",children:i,...l}=e,u=sH(l,t),m=n||o?a.jsx("span",{style:{pointerEvents:"none",flex:1},children:i}):i;return a.jsxs(uH,{...u,className:Ye("chakra-menu__menuitem",u.className),children:[n&&a.jsx(M3,{fontSize:"0.8em",marginEnd:r,children:n}),m,o&&a.jsx(E3,{marginStart:s,children:o})]})});en.displayName="MenuItem";var dH={enter:{visibility:"visible",opacity:1,scale:1,transition:{duration:.2,ease:[.4,0,.2,1]}},exit:{transitionEnd:{visibility:"hidden"},opacity:0,scale:.8,transition:{duration:.1,easings:"easeOut"}}},fH=we(In.div),Ui=ke(function(t,n){var r,o;const{rootProps:s,motionProps:i,...l}=t,{isOpen:u,onTransitionEnd:p,unstable__animationState:m}=Ad(),h=rH(l,n),g=oH(s),x=$c();return a.jsx(we.div,{...g,__css:{zIndex:(o=t.zIndex)!=null?o:(r=x.list)==null?void 0:r.zIndex},children:a.jsx(fH,{variants:dH,initial:!1,animate:u?"enter":"exit",__css:{outline:0,...x.list},...i,className:Ye("chakra-menu__menu-list",h.className),...h,onUpdate:p,onAnimationComplete:ph(m.onComplete,h.onAnimationComplete)})})});Ui.displayName="MenuList";var td=ke((e,t)=>{const{title:n,children:r,className:o,...s}=e,i=Ye("chakra-menu__group__title",o),l=$c();return a.jsxs("div",{ref:t,className:"chakra-menu__group",role:"group",children:[n&&a.jsx(we.p,{className:i,...s,__css:l.groupTitle,children:n}),r]})});td.displayName="MenuGroup";var pH=ke((e,t)=>{const n=$c();return a.jsx(we.button,{ref:t,...e,__css:{display:"inline-flex",appearance:"none",alignItems:"center",outline:0,...n.button}})}),Th=ke((e,t)=>{const{children:n,as:r,...o}=e,s=nH(o,t),i=r||pH;return a.jsx(i,{...s,className:Ye("chakra-menu__menu-button",e.className),children:a.jsx(we.span,{__css:{pointerEvents:"none",flex:"1 1 auto",minW:0},children:e.children})})});Th.displayName="MenuButton";var mH={slideInBottom:{...w1,custom:{offsetY:16,reverse:!0}},slideInRight:{...w1,custom:{offsetX:16,reverse:!0}},scale:{...i5,custom:{initialScale:.95,reverse:!0}},none:{}},hH=we(In.section),gH=e=>mH[e||"none"],O3=d.forwardRef((e,t)=>{const{preset:n,motionProps:r=gH(n),...o}=e;return a.jsx(hH,{ref:t,...r,...o})});O3.displayName="ModalTransition";var vH=Object.defineProperty,xH=(e,t,n)=>t in e?vH(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,bH=(e,t,n)=>(xH(e,typeof t!="symbol"?t+"":t,n),n),yH=class{constructor(){bH(this,"modals"),this.modals=new Map}add(e){return this.modals.set(e,this.modals.size+1),this.modals.size}remove(e){this.modals.delete(e)}isTopModal(e){return e?this.modals.get(e)===this.modals.size:!1}},L1=new yH;function R3(e,t){const[n,r]=d.useState(0);return d.useEffect(()=>{const o=e.current;if(o){if(t){const s=L1.add(o);r(s)}return()=>{L1.remove(o),r(0)}}},[t,e]),n}var CH=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Dl=new WeakMap,ep=new WeakMap,tp={},pv=0,D3=function(e){return e&&(e.host||D3(e.parentNode))},wH=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=D3(n);return r&&e.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},SH=function(e,t,n,r){var o=wH(t,Array.isArray(e)?e:[e]);tp[n]||(tp[n]=new WeakMap);var s=tp[n],i=[],l=new Set,u=new Set(o),p=function(h){!h||l.has(h)||(l.add(h),p(h.parentNode))};o.forEach(p);var m=function(h){!h||u.has(h)||Array.prototype.forEach.call(h.children,function(g){if(l.has(g))m(g);else{var x=g.getAttribute(r),y=x!==null&&x!=="false",b=(Dl.get(g)||0)+1,w=(s.get(g)||0)+1;Dl.set(g,b),s.set(g,w),i.push(g),b===1&&y&&ep.set(g,!0),w===1&&g.setAttribute(n,"true"),y||g.setAttribute(r,"true")}})};return m(t),l.clear(),pv++,function(){i.forEach(function(h){var g=Dl.get(h)-1,x=s.get(h)-1;Dl.set(h,g),s.set(h,x),g||(ep.has(h)||h.removeAttribute(r),ep.delete(h)),x||h.removeAttribute(n)}),pv--,pv||(Dl=new WeakMap,Dl=new WeakMap,ep=new WeakMap,tp={})}},kH=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),o=t||CH(e);return o?(r.push.apply(r,Array.from(o.querySelectorAll("[aria-live]"))),SH(r,o,n,"aria-hidden")):function(){return null}};function jH(e){const{isOpen:t,onClose:n,id:r,closeOnOverlayClick:o=!0,closeOnEsc:s=!0,useInert:i=!0,onOverlayClick:l,onEsc:u}=e,p=d.useRef(null),m=d.useRef(null),[h,g,x]=IH(r,"chakra-modal","chakra-modal--header","chakra-modal--body");_H(p,t&&i);const y=R3(p,t),b=d.useRef(null),w=d.useCallback(A=>{b.current=A.target},[]),S=d.useCallback(A=>{A.key==="Escape"&&(A.stopPropagation(),s&&(n==null||n()),u==null||u())},[s,n,u]),[j,_]=d.useState(!1),[E,I]=d.useState(!1),M=d.useCallback((A={},O=null)=>({role:"dialog",...A,ref:It(O,p),id:h,tabIndex:-1,"aria-modal":!0,"aria-labelledby":j?g:void 0,"aria-describedby":E?x:void 0,onClick:He(A.onClick,T=>T.stopPropagation())}),[x,E,h,g,j]),R=d.useCallback(A=>{A.stopPropagation(),b.current===A.target&&L1.isTopModal(p.current)&&(o&&(n==null||n()),l==null||l())},[n,o,l]),D=d.useCallback((A={},O=null)=>({...A,ref:It(O,m),onClick:He(A.onClick,R),onKeyDown:He(A.onKeyDown,S),onMouseDown:He(A.onMouseDown,w)}),[S,w,R]);return{isOpen:t,onClose:n,headerId:g,bodyId:x,setBodyMounted:I,setHeaderMounted:_,dialogRef:p,overlayRef:m,getDialogProps:M,getDialogContainerProps:D,index:y}}function _H(e,t){const n=e.current;d.useEffect(()=>{if(!(!e.current||!t))return kH(e.current)},[t,e,n])}function IH(e,...t){const n=d.useId(),r=e||n;return d.useMemo(()=>t.map(o=>`${o}-${r}`),[r,t])}var[PH,Lc]=Wt({name:"ModalStylesContext",errorMessage:`useModalStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),[EH,Gi]=Wt({strict:!0,name:"ModalContext",errorMessage:"useModalContext: `context` is undefined. Seems you forgot to wrap modal components in ``"}),Ki=e=>{const t={scrollBehavior:"outside",autoFocus:!0,trapFocus:!0,returnFocusOnClose:!0,blockScrollOnMount:!0,allowPinchZoom:!1,motionPreset:"scale",lockFocusAcrossFrames:!0,...e},{portalProps:n,children:r,autoFocus:o,trapFocus:s,initialFocusRef:i,finalFocusRef:l,returnFocusOnClose:u,blockScrollOnMount:p,allowPinchZoom:m,preserveScrollBarGap:h,motionPreset:g,lockFocusAcrossFrames:x,onCloseComplete:y}=t,b=Un("Modal",t),S={...jH(t),autoFocus:o,trapFocus:s,initialFocusRef:i,finalFocusRef:l,returnFocusOnClose:u,blockScrollOnMount:p,allowPinchZoom:m,preserveScrollBarGap:h,motionPreset:g,lockFocusAcrossFrames:x};return a.jsx(EH,{value:S,children:a.jsx(PH,{value:b,children:a.jsx(dr,{onExitComplete:y,children:S.isOpen&&a.jsx(Ac,{...n,children:r})})})})};Ki.displayName="Modal";var $p="right-scroll-bar-position",Lp="width-before-scroll-bar",MH="with-scroll-bars-hidden",OH="--removed-body-scroll-bar-size",A3=M5(),mv=function(){},Nh=d.forwardRef(function(e,t){var n=d.useRef(null),r=d.useState({onScrollCapture:mv,onWheelCapture:mv,onTouchMoveCapture:mv}),o=r[0],s=r[1],i=e.forwardProps,l=e.children,u=e.className,p=e.removeScrollBar,m=e.enabled,h=e.shards,g=e.sideCar,x=e.noIsolation,y=e.inert,b=e.allowPinchZoom,w=e.as,S=w===void 0?"div":w,j=e.gapMode,_=I5(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noIsolation","inert","allowPinchZoom","as","gapMode"]),E=g,I=_5([n,t]),M=gs(gs({},_),o);return d.createElement(d.Fragment,null,m&&d.createElement(E,{sideCar:A3,removeScrollBar:p,shards:h,noIsolation:x,inert:y,setCallbacks:s,allowPinchZoom:!!b,lockRef:n,gapMode:j}),i?d.cloneElement(d.Children.only(l),gs(gs({},M),{ref:I})):d.createElement(S,gs({},M,{className:u,ref:I}),l))});Nh.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Nh.classNames={fullWidth:Lp,zeroRight:$p};var PS,RH=function(){if(PS)return PS;if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function DH(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=RH();return t&&e.setAttribute("nonce",t),e}function AH(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function TH(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var NH=function(){var e=0,t=null;return{add:function(n){e==0&&(t=DH())&&(AH(t,n),TH(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},$H=function(){var e=NH();return function(t,n){d.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},T3=function(){var e=$H(),t=function(n){var r=n.styles,o=n.dynamic;return e(r,o),null};return t},LH={left:0,top:0,right:0,gap:0},hv=function(e){return parseInt(e||"",10)||0},zH=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],r=t[e==="padding"?"paddingTop":"marginTop"],o=t[e==="padding"?"paddingRight":"marginRight"];return[hv(n),hv(r),hv(o)]},FH=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return LH;var t=zH(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},BH=T3(),HH=function(e,t,n,r){var o=e.left,s=e.top,i=e.right,l=e.gap;return n===void 0&&(n="margin"),` .`.concat(MH,` { overflow: hidden `).concat(r,`; padding-right: `).concat(l,"px ").concat(r,`; @@ -40,12 +40,12 @@ import{a as Dc,b as W_,S as U_,c as G_,d as K_,e as o1,f as q_,i as s1,g as vR,h `)},VH=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,o=r===void 0?"margin":r,s=d.useMemo(function(){return FH(o)},[o]);return d.createElement(BH,{styles:HH(s,!t,o,n?"":"!important")})},z1=!1;if(typeof window<"u")try{var np=Object.defineProperty({},"passive",{get:function(){return z1=!0,!0}});window.addEventListener("test",np,np),window.removeEventListener("test",np,np)}catch{z1=!1}var Al=z1?{passive:!1}:!1,WH=function(e){return e.tagName==="TEXTAREA"},N3=function(e,t){var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!WH(e)&&n[t]==="visible")},UH=function(e){return N3(e,"overflowY")},GH=function(e){return N3(e,"overflowX")},ES=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var o=$3(e,r);if(o){var s=L3(e,r),i=s[1],l=s[2];if(i>l)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},KH=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},qH=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},$3=function(e,t){return e==="v"?UH(t):GH(t)},L3=function(e,t){return e==="v"?KH(t):qH(t)},XH=function(e,t){return e==="h"&&t==="rtl"?-1:1},QH=function(e,t,n,r,o){var s=XH(e,window.getComputedStyle(t).direction),i=s*r,l=n.target,u=t.contains(l),p=!1,m=i>0,h=0,g=0;do{var x=L3(e,l),y=x[0],b=x[1],w=x[2],S=b-w-s*y;(y||S)&&$3(e,l)&&(h+=S,g+=y),l=l.parentNode}while(!u&&l!==document.body||u&&(t.contains(l)||t===l));return(m&&(o&&h===0||!o&&i>h)||!m&&(o&&g===0||!o&&-i>g))&&(p=!0),p},rp=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},MS=function(e){return[e.deltaX,e.deltaY]},OS=function(e){return e&&"current"in e?e.current:e},YH=function(e,t){return e[0]===t[0]&&e[1]===t[1]},ZH=function(e){return` .block-interactivity-`.concat(e,` {pointer-events: none;} .allow-interactivity-`).concat(e,` {pointer-events: all;} -`)},JH=0,Tl=[];function eV(e){var t=d.useRef([]),n=d.useRef([0,0]),r=d.useRef(),o=d.useState(JH++)[0],s=d.useState(T3)[0],i=d.useRef(e);d.useEffect(function(){i.current=e},[e]),d.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(o));var b=M1([e.lockRef.current],(e.shards||[]).map(OS),!0).filter(Boolean);return b.forEach(function(w){return w.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),b.forEach(function(w){return w.classList.remove("allow-interactivity-".concat(o))})}}},[e.inert,e.lockRef.current,e.shards]);var l=d.useCallback(function(b,w){if("touches"in b&&b.touches.length===2)return!i.current.allowPinchZoom;var S=rp(b),j=n.current,_="deltaX"in b?b.deltaX:j[0]-S[0],E="deltaY"in b?b.deltaY:j[1]-S[1],I,M=b.target,R=Math.abs(_)>Math.abs(E)?"h":"v";if("touches"in b&&R==="h"&&M.type==="range")return!1;var D=ES(R,M);if(!D)return!0;if(D?I=R:(I=R==="v"?"h":"v",D=ES(R,M)),!D)return!1;if(!r.current&&"changedTouches"in b&&(_||E)&&(r.current=I),!I)return!0;var A=r.current||I;return QH(A,w,b,A==="h"?_:E,!0)},[]),u=d.useCallback(function(b){var w=b;if(!(!Tl.length||Tl[Tl.length-1]!==s)){var S="deltaY"in w?MS(w):rp(w),j=t.current.filter(function(I){return I.name===w.type&&I.target===w.target&&YH(I.delta,S)})[0];if(j&&j.should){w.cancelable&&w.preventDefault();return}if(!j){var _=(i.current.shards||[]).map(OS).filter(Boolean).filter(function(I){return I.contains(w.target)}),E=_.length>0?l(w,_[0]):!i.current.noIsolation;E&&w.cancelable&&w.preventDefault()}}},[]),p=d.useCallback(function(b,w,S,j){var _={name:b,delta:w,target:S,should:j};t.current.push(_),setTimeout(function(){t.current=t.current.filter(function(E){return E!==_})},1)},[]),m=d.useCallback(function(b){n.current=rp(b),r.current=void 0},[]),h=d.useCallback(function(b){p(b.type,MS(b),b.target,l(b,e.lockRef.current))},[]),g=d.useCallback(function(b){p(b.type,rp(b),b.target,l(b,e.lockRef.current))},[]);d.useEffect(function(){return Tl.push(s),e.setCallbacks({onScrollCapture:h,onWheelCapture:h,onTouchMoveCapture:g}),document.addEventListener("wheel",u,Al),document.addEventListener("touchmove",u,Al),document.addEventListener("touchstart",m,Al),function(){Tl=Tl.filter(function(b){return b!==s}),document.removeEventListener("wheel",u,Al),document.removeEventListener("touchmove",u,Al),document.removeEventListener("touchstart",m,Al)}},[]);var x=e.removeScrollBar,y=e.inert;return d.createElement(d.Fragment,null,y?d.createElement(s,{styles:ZH(o)}):null,x?d.createElement(VH,{gapMode:e.gapMode}):null)}const tV=tz(A3,eV);var z3=d.forwardRef(function(e,t){return d.createElement(Nh,gs({},e,{ref:t,sideCar:tV}))});z3.classNames=Nh.classNames;const nV=z3;function rV(e){const{autoFocus:t,trapFocus:n,dialogRef:r,initialFocusRef:o,blockScrollOnMount:s,allowPinchZoom:i,finalFocusRef:l,returnFocusOnClose:u,preserveScrollBarGap:p,lockFocusAcrossFrames:m,isOpen:h}=Gi(),[g,x]=HR();d.useEffect(()=>{!g&&x&&setTimeout(x)},[g,x]);const y=R3(r,h);return a.jsx(i3,{autoFocus:t,isDisabled:!n,initialFocusRef:o,finalFocusRef:l,restoreFocus:u,contentRef:r,lockFocusAcrossFrames:m,children:a.jsx(nV,{removeScrollBar:!p,allowPinchZoom:i,enabled:y===1&&s,forwardProps:!0,children:e.children})})}var qi=je((e,t)=>{const{className:n,children:r,containerProps:o,motionProps:s,...i}=e,{getDialogProps:l,getDialogContainerProps:u}=Gi(),p=l(i,t),m=u(o),h=Ye("chakra-modal__content",n),g=Lc(),x={display:"flex",flexDirection:"column",position:"relative",width:"100%",outline:0,...g.dialog},y={display:"flex",width:"100vw",height:"$100vh",position:"fixed",left:0,top:0,...g.dialogContainer},{motionPreset:b}=Gi();return a.jsx(rV,{children:a.jsx(we.div,{...m,className:"chakra-modal__content-container",tabIndex:-1,__css:y,children:a.jsx(O3,{preset:b,motionProps:s,className:h,...p,__css:x,children:r})})})});qi.displayName="ModalContent";function Td(e){const{leastDestructiveRef:t,...n}=e;return a.jsx(Ki,{...n,initialFocusRef:t})}var Nd=je((e,t)=>a.jsx(qi,{ref:t,role:"alertdialog",...e})),Ss=je((e,t)=>{const{className:n,...r}=e,o=Ye("chakra-modal__footer",n),i={display:"flex",alignItems:"center",justifyContent:"flex-end",...Lc().footer};return a.jsx(we.footer,{ref:t,...r,__css:i,className:o})});Ss.displayName="ModalFooter";var Qo=je((e,t)=>{const{className:n,...r}=e,{headerId:o,setHeaderMounted:s}=Gi();d.useEffect(()=>(s(!0),()=>s(!1)),[s]);const i=Ye("chakra-modal__header",n),u={flex:0,...Lc().header};return a.jsx(we.header,{ref:t,className:i,id:o,...r,__css:u})});Qo.displayName="ModalHeader";var oV=we(In.div),Yo=je((e,t)=>{const{className:n,transition:r,motionProps:o,...s}=e,i=Ye("chakra-modal__overlay",n),u={pos:"fixed",left:"0",top:"0",w:"100vw",h:"100vh",...Lc().overlay},{motionPreset:p}=Gi(),h=o||(p==="none"?{}:a5);return a.jsx(oV,{...h,__css:u,ref:t,className:i,...s})});Yo.displayName="ModalOverlay";var Zo=je((e,t)=>{const{className:n,...r}=e,{bodyId:o,setBodyMounted:s}=Gi();d.useEffect(()=>(s(!0),()=>s(!1)),[s]);const i=Ye("chakra-modal__body",n),l=Lc();return a.jsx(we.div,{ref:t,className:i,id:o,...r,__css:l.body})});Zo.displayName="ModalBody";var $d=je((e,t)=>{const{onClick:n,className:r,...o}=e,{onClose:s}=Gi(),i=Ye("chakra-modal__close-btn",r),l=Lc();return a.jsx(J_,{ref:t,__css:l.closeButton,className:i,onClick:He(n,u=>{u.stopPropagation(),s()}),...o})});$d.displayName="ModalCloseButton";var sV=e=>a.jsx(Tn,{viewBox:"0 0 24 24",...e,children:a.jsx("path",{fill:"currentColor",d:"M21,5H3C2.621,5,2.275,5.214,2.105,5.553C1.937,5.892,1.973,6.297,2.2,6.6l9,12 c0.188,0.252,0.485,0.4,0.8,0.4s0.611-0.148,0.8-0.4l9-12c0.228-0.303,0.264-0.708,0.095-1.047C21.725,5.214,21.379,5,21,5z"})}),aV=e=>a.jsx(Tn,{viewBox:"0 0 24 24",...e,children:a.jsx("path",{fill:"currentColor",d:"M12.8,5.4c-0.377-0.504-1.223-0.504-1.6,0l-9,12c-0.228,0.303-0.264,0.708-0.095,1.047 C2.275,18.786,2.621,19,3,19h18c0.379,0,0.725-0.214,0.895-0.553c0.169-0.339,0.133-0.744-0.095-1.047L12.8,5.4z"})});function RS(e,t,n,r){d.useEffect(()=>{var o;if(!e.current||!r)return;const s=(o=e.current.ownerDocument.defaultView)!=null?o:window,i=Array.isArray(t)?t:[t],l=new s.MutationObserver(u=>{for(const p of u)p.type==="attributes"&&p.attributeName&&i.includes(p.attributeName)&&n(p)});return l.observe(e.current,{attributes:!0,attributeFilter:i}),()=>l.disconnect()})}function iV(e,t){const n=un(e);d.useEffect(()=>{let r=null;const o=()=>n();return t!==null&&(r=window.setInterval(o,t)),()=>{r&&window.clearInterval(r)}},[t,n])}var lV=50,DS=300;function cV(e,t){const[n,r]=d.useState(!1),[o,s]=d.useState(null),[i,l]=d.useState(!0),u=d.useRef(null),p=()=>clearTimeout(u.current);iV(()=>{o==="increment"&&e(),o==="decrement"&&t()},n?lV:null);const m=d.useCallback(()=>{i&&e(),u.current=setTimeout(()=>{l(!1),r(!0),s("increment")},DS)},[e,i]),h=d.useCallback(()=>{i&&t(),u.current=setTimeout(()=>{l(!1),r(!0),s("decrement")},DS)},[t,i]),g=d.useCallback(()=>{l(!0),r(!1),p()},[]);return d.useEffect(()=>()=>p(),[]),{up:m,down:h,stop:g,isSpinning:n}}var uV=/^[Ee0-9+\-.]$/;function dV(e){return uV.test(e)}function fV(e,t){if(e.key==null)return!0;const n=e.ctrlKey||e.altKey||e.metaKey;return!(e.key.length===1)||n?!0:t(e.key)}function pV(e={}){const{focusInputOnChange:t=!0,clampValueOnBlur:n=!0,keepWithinRange:r=!0,min:o=Number.MIN_SAFE_INTEGER,max:s=Number.MAX_SAFE_INTEGER,step:i=1,isReadOnly:l,isDisabled:u,isRequired:p,isInvalid:m,pattern:h="[0-9]*(.[0-9]+)?",inputMode:g="decimal",allowMouseWheel:x,id:y,onChange:b,precision:w,name:S,"aria-describedby":j,"aria-label":_,"aria-labelledby":E,onFocus:I,onBlur:M,onInvalid:R,getAriaValueText:D,isValidCharacter:A,format:O,parse:T,...X}=e,B=un(I),V=un(M),U=un(R),N=un(A??dV),$=un(D),q=TL(e),{update:F,increment:Q,decrement:Y}=q,[se,ae]=d.useState(!1),re=!(l||u),G=d.useRef(null),K=d.useRef(null),ee=d.useRef(null),ce=d.useRef(null),J=d.useCallback(be=>be.split("").filter(N).join(""),[N]),ie=d.useCallback(be=>{var Je;return(Je=T==null?void 0:T(be))!=null?Je:be},[T]),de=d.useCallback(be=>{var Je;return((Je=O==null?void 0:O(be))!=null?Je:be).toString()},[O]);pa(()=>{(q.valueAsNumber>s||q.valueAsNumber{if(!G.current)return;if(G.current.value!=q.value){const Je=ie(G.current.value);q.setValue(J(Je))}},[ie,J]);const ge=d.useCallback((be=i)=>{re&&Q(be)},[Q,re,i]),Ce=d.useCallback((be=i)=>{re&&Y(be)},[Y,re,i]),he=cV(ge,Ce);RS(ee,"disabled",he.stop,he.isSpinning),RS(ce,"disabled",he.stop,he.isSpinning);const fe=d.useCallback(be=>{if(be.nativeEvent.isComposing)return;const lt=ie(be.currentTarget.value);F(J(lt)),K.current={start:be.currentTarget.selectionStart,end:be.currentTarget.selectionEnd}},[F,J,ie]),Oe=d.useCallback(be=>{var Je,lt,ft;B==null||B(be),K.current&&(be.target.selectionStart=(lt=K.current.start)!=null?lt:(Je=be.currentTarget.value)==null?void 0:Je.length,be.currentTarget.selectionEnd=(ft=K.current.end)!=null?ft:be.currentTarget.selectionStart)},[B]),_e=d.useCallback(be=>{if(be.nativeEvent.isComposing)return;fV(be,N)||be.preventDefault();const Je=Ne(be)*i,lt=be.key,Me={ArrowUp:()=>ge(Je),ArrowDown:()=>Ce(Je),Home:()=>F(o),End:()=>F(s)}[lt];Me&&(be.preventDefault(),Me(be))},[N,i,ge,Ce,F,o,s]),Ne=be=>{let Je=1;return(be.metaKey||be.ctrlKey)&&(Je=.1),be.shiftKey&&(Je=10),Je},nt=d.useMemo(()=>{const be=$==null?void 0:$(q.value);if(be!=null)return be;const Je=q.value.toString();return Je||void 0},[q.value,$]),$e=d.useCallback(()=>{let be=q.value;if(q.value==="")return;/^[eE]/.test(q.value.toString())?q.setValue(""):(q.valueAsNumbers&&(be=s),q.cast(be))},[q,s,o]),Pt=d.useCallback(()=>{ae(!1),n&&$e()},[n,ae,$e]),Ze=d.useCallback(()=>{t&&requestAnimationFrame(()=>{var be;(be=G.current)==null||be.focus()})},[t]),ot=d.useCallback(be=>{be.preventDefault(),he.up(),Ze()},[Ze,he]),ye=d.useCallback(be=>{be.preventDefault(),he.down(),Ze()},[Ze,he]);Ri(()=>G.current,"wheel",be=>{var Je,lt;const Me=((lt=(Je=G.current)==null?void 0:Je.ownerDocument)!=null?lt:document).activeElement===G.current;if(!x||!Me)return;be.preventDefault();const Le=Ne(be)*i,Ut=Math.sign(be.deltaY);Ut===-1?ge(Le):Ut===1&&Ce(Le)},{passive:!1});const De=d.useCallback((be={},Je=null)=>{const lt=u||r&&q.isAtMax;return{...be,ref:It(Je,ee),role:"button",tabIndex:-1,onPointerDown:He(be.onPointerDown,ft=>{ft.button!==0||lt||ot(ft)}),onPointerLeave:He(be.onPointerLeave,he.stop),onPointerUp:He(be.onPointerUp,he.stop),disabled:lt,"aria-disabled":Co(lt)}},[q.isAtMax,r,ot,he.stop,u]),ut=d.useCallback((be={},Je=null)=>{const lt=u||r&&q.isAtMin;return{...be,ref:It(Je,ce),role:"button",tabIndex:-1,onPointerDown:He(be.onPointerDown,ft=>{ft.button!==0||lt||ye(ft)}),onPointerLeave:He(be.onPointerLeave,he.stop),onPointerUp:He(be.onPointerUp,he.stop),disabled:lt,"aria-disabled":Co(lt)}},[q.isAtMin,r,ye,he.stop,u]),bt=d.useCallback((be={},Je=null)=>{var lt,ft,Me,Le;return{name:S,inputMode:g,type:"text",pattern:h,"aria-labelledby":E,"aria-label":_,"aria-describedby":j,id:y,disabled:u,...be,readOnly:(lt=be.readOnly)!=null?lt:l,"aria-readonly":(ft=be.readOnly)!=null?ft:l,"aria-required":(Me=be.required)!=null?Me:p,required:(Le=be.required)!=null?Le:p,ref:It(G,Je),value:de(q.value),role:"spinbutton","aria-valuemin":o,"aria-valuemax":s,"aria-valuenow":Number.isNaN(q.valueAsNumber)?void 0:q.valueAsNumber,"aria-invalid":Co(m??q.isOutOfRange),"aria-valuetext":nt,autoComplete:"off",autoCorrect:"off",onChange:He(be.onChange,fe),onKeyDown:He(be.onKeyDown,_e),onFocus:He(be.onFocus,Oe,()=>ae(!0)),onBlur:He(be.onBlur,V,Pt)}},[S,g,h,E,_,de,j,y,u,p,l,m,q.value,q.valueAsNumber,q.isOutOfRange,o,s,nt,fe,_e,Oe,V,Pt]);return{value:de(q.value),valueAsNumber:q.valueAsNumber,isFocused:se,isDisabled:u,isReadOnly:l,getIncrementButtonProps:De,getDecrementButtonProps:ut,getInputProps:bt,htmlProps:X}}var[mV,$h]=Wt({name:"NumberInputStylesContext",errorMessage:`useNumberInputStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),[hV,Fb]=Wt({name:"NumberInputContext",errorMessage:"useNumberInputContext: `context` is undefined. Seems you forgot to wrap number-input's components within "}),Lh=je(function(t,n){const r=Un("NumberInput",t),o=on(t),s=fb(o),{htmlProps:i,...l}=pV(s),u=d.useMemo(()=>l,[l]);return a.jsx(hV,{value:u,children:a.jsx(mV,{value:r,children:a.jsx(we.div,{...i,ref:n,className:Ye("chakra-numberinput",t.className),__css:{position:"relative",zIndex:0,...r.root}})})})});Lh.displayName="NumberInput";var zh=je(function(t,n){const r=$h();return a.jsx(we.div,{"aria-hidden":!0,ref:n,...t,__css:{display:"flex",flexDirection:"column",position:"absolute",top:"0",insetEnd:"0px",margin:"1px",height:"calc(100% - 2px)",zIndex:1,...r.stepperGroup}})});zh.displayName="NumberInputStepper";var Fh=je(function(t,n){const{getInputProps:r}=Fb(),o=r(t,n),s=$h();return a.jsx(we.input,{...o,className:Ye("chakra-numberinput__field",t.className),__css:{width:"100%",...s.field}})});Fh.displayName="NumberInputField";var F3=we("div",{baseStyle:{display:"flex",justifyContent:"center",alignItems:"center",flex:1,transitionProperty:"common",transitionDuration:"normal",userSelect:"none",cursor:"pointer",lineHeight:"normal"}}),Bh=je(function(t,n){var r;const o=$h(),{getDecrementButtonProps:s}=Fb(),i=s(t,n);return a.jsx(F3,{...i,__css:o.stepper,children:(r=t.children)!=null?r:a.jsx(sV,{})})});Bh.displayName="NumberDecrementStepper";var Hh=je(function(t,n){var r;const{getIncrementButtonProps:o}=Fb(),s=o(t,n),i=$h();return a.jsx(F3,{...s,__css:i.stepper,children:(r=t.children)!=null?r:a.jsx(aV,{})})});Hh.displayName="NumberIncrementStepper";var[gV,nl]=Wt({name:"PopoverContext",errorMessage:"usePopoverContext: `context` is undefined. Seems you forgot to wrap all popover components within ``"}),[vV,Vh]=Wt({name:"PopoverStylesContext",errorMessage:`usePopoverStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `});function Wh(e){const t=d.Children.only(e.children),{getTriggerProps:n}=nl();return d.cloneElement(t,n(t.props,t.ref))}Wh.displayName="PopoverTrigger";var Nl={click:"click",hover:"hover"};function xV(e={}){const{closeOnBlur:t=!0,closeOnEsc:n=!0,initialFocusRef:r,id:o,returnFocusOnClose:s=!0,autoFocus:i=!0,arrowSize:l,arrowShadowColor:u,trigger:p=Nl.click,openDelay:m=200,closeDelay:h=200,isLazy:g,lazyBehavior:x="unmount",computePositionOnMount:y,...b}=e,{isOpen:w,onClose:S,onOpen:j,onToggle:_}=Lb(e),E=d.useRef(null),I=d.useRef(null),M=d.useRef(null),R=d.useRef(!1),D=d.useRef(!1);w&&(D.current=!0);const[A,O]=d.useState(!1),[T,X]=d.useState(!1),B=d.useId(),V=o??B,[U,N,$,q]=["popover-trigger","popover-content","popover-header","popover-body"].map(fe=>`${fe}-${V}`),{referenceRef:F,getArrowProps:Q,getPopperProps:Y,getArrowInnerProps:se,forceUpdate:ae}=$b({...b,enabled:w||!!y}),re=I3({isOpen:w,ref:M});y5({enabled:w,ref:I}),g3(M,{focusRef:I,visible:w,shouldFocus:s&&p===Nl.click}),_F(M,{focusRef:r,visible:w,shouldFocus:i&&p===Nl.click});const G=zb({wasSelected:D.current,enabled:g,mode:x,isSelected:re.present}),K=d.useCallback((fe={},Oe=null)=>{const _e={...fe,style:{...fe.style,transformOrigin:Nn.transformOrigin.varRef,[Nn.arrowSize.var]:l?`${l}px`:void 0,[Nn.arrowShadowColor.var]:u},ref:It(M,Oe),children:G?fe.children:null,id:N,tabIndex:-1,role:"dialog",onKeyDown:He(fe.onKeyDown,Ne=>{n&&Ne.key==="Escape"&&S()}),onBlur:He(fe.onBlur,Ne=>{const nt=AS(Ne),$e=gv(M.current,nt),Pt=gv(I.current,nt);w&&t&&(!$e&&!Pt)&&S()}),"aria-labelledby":A?$:void 0,"aria-describedby":T?q:void 0};return p===Nl.hover&&(_e.role="tooltip",_e.onMouseEnter=He(fe.onMouseEnter,()=>{R.current=!0}),_e.onMouseLeave=He(fe.onMouseLeave,Ne=>{Ne.nativeEvent.relatedTarget!==null&&(R.current=!1,setTimeout(()=>S(),h))})),_e},[G,N,A,$,T,q,p,n,S,w,t,h,u,l]),ee=d.useCallback((fe={},Oe=null)=>Y({...fe,style:{visibility:w?"visible":"hidden",...fe.style}},Oe),[w,Y]),ce=d.useCallback((fe,Oe=null)=>({...fe,ref:It(Oe,E,F)}),[E,F]),J=d.useRef(),ie=d.useRef(),de=d.useCallback(fe=>{E.current==null&&F(fe)},[F]),ge=d.useCallback((fe={},Oe=null)=>{const _e={...fe,ref:It(I,Oe,de),id:U,"aria-haspopup":"dialog","aria-expanded":w,"aria-controls":N};return p===Nl.click&&(_e.onClick=He(fe.onClick,_)),p===Nl.hover&&(_e.onFocus=He(fe.onFocus,()=>{J.current===void 0&&j()}),_e.onBlur=He(fe.onBlur,Ne=>{const nt=AS(Ne),$e=!gv(M.current,nt);w&&t&&$e&&S()}),_e.onKeyDown=He(fe.onKeyDown,Ne=>{Ne.key==="Escape"&&S()}),_e.onMouseEnter=He(fe.onMouseEnter,()=>{R.current=!0,J.current=window.setTimeout(()=>j(),m)}),_e.onMouseLeave=He(fe.onMouseLeave,()=>{R.current=!1,J.current&&(clearTimeout(J.current),J.current=void 0),ie.current=window.setTimeout(()=>{R.current===!1&&S()},h)})),_e},[U,w,N,p,de,_,j,t,S,m,h]);d.useEffect(()=>()=>{J.current&&clearTimeout(J.current),ie.current&&clearTimeout(ie.current)},[]);const Ce=d.useCallback((fe={},Oe=null)=>({...fe,id:$,ref:It(Oe,_e=>{O(!!_e)})}),[$]),he=d.useCallback((fe={},Oe=null)=>({...fe,id:q,ref:It(Oe,_e=>{X(!!_e)})}),[q]);return{forceUpdate:ae,isOpen:w,onAnimationComplete:re.onComplete,onClose:S,getAnchorProps:ce,getArrowProps:Q,getArrowInnerProps:se,getPopoverPositionerProps:ee,getPopoverProps:K,getTriggerProps:ge,getHeaderProps:Ce,getBodyProps:he}}function gv(e,t){return e===t||(e==null?void 0:e.contains(t))}function AS(e){var t;const n=e.currentTarget.ownerDocument.activeElement;return(t=e.relatedTarget)!=null?t:n}function Ld(e){const t=Un("Popover",e),{children:n,...r}=on(e),o=bd(),s=xV({...r,direction:o.direction});return a.jsx(gV,{value:s,children:a.jsx(vV,{value:t,children:zx(n,{isOpen:s.isOpen,onClose:s.onClose,forceUpdate:s.forceUpdate})})})}Ld.displayName="Popover";function B3(e){const t=d.Children.only(e.children),{getAnchorProps:n}=nl();return d.cloneElement(t,n(t.props,t.ref))}B3.displayName="PopoverAnchor";var vv=(e,t)=>t?`${e}.${t}, ${t}`:void 0;function H3(e){var t;const{bg:n,bgColor:r,backgroundColor:o,shadow:s,boxShadow:i,shadowColor:l}=e,{getArrowProps:u,getArrowInnerProps:p}=nl(),m=Vh(),h=(t=n??r)!=null?t:o,g=s??i;return a.jsx(we.div,{...u(),className:"chakra-popover__arrow-positioner",children:a.jsx(we.div,{className:Ye("chakra-popover__arrow",e.className),...p(e),__css:{"--popper-arrow-shadow-color":vv("colors",l),"--popper-arrow-bg":vv("colors",h),"--popper-arrow-shadow":vv("shadows",g),...m.arrow}})})}H3.displayName="PopoverArrow";var Uh=je(function(t,n){const{getBodyProps:r}=nl(),o=Vh();return a.jsx(we.div,{...r(t,n),className:Ye("chakra-popover__body",t.className),__css:o.body})});Uh.displayName="PopoverBody";var V3=je(function(t,n){const{onClose:r}=nl(),o=Vh();return a.jsx(J_,{size:"sm",onClick:r,className:Ye("chakra-popover__close-btn",t.className),__css:o.closeButton,ref:n,...t})});V3.displayName="PopoverCloseButton";function bV(e){if(e)return{enter:{...e.enter,visibility:"visible"},exit:{...e.exit,transitionEnd:{visibility:"hidden"}}}}var yV={exit:{opacity:0,scale:.95,transition:{duration:.1,ease:[.4,0,1,1]}},enter:{scale:1,opacity:1,transition:{duration:.15,ease:[0,0,.2,1]}}},CV=we(In.section),W3=je(function(t,n){const{variants:r=yV,...o}=t,{isOpen:s}=nl();return a.jsx(CV,{ref:n,variants:bV(r),initial:!1,animate:s?"enter":"exit",...o})});W3.displayName="PopoverTransition";var zd=je(function(t,n){const{rootProps:r,motionProps:o,...s}=t,{getPopoverProps:i,getPopoverPositionerProps:l,onAnimationComplete:u}=nl(),p=Vh(),m={position:"relative",display:"flex",flexDirection:"column",...p.content};return a.jsx(we.div,{...l(r),__css:p.popper,className:"chakra-popover__popper",children:a.jsx(W3,{...o,...i(s,n),onAnimationComplete:ph(u,s.onAnimationComplete),className:Ye("chakra-popover__content",t.className),__css:m})})});zd.displayName="PopoverContent";var F1=e=>a.jsx(we.circle,{cx:50,cy:50,r:42,fill:"transparent",...e});F1.displayName="Circle";function wV(e,t,n){return(e-t)*100/(n-t)}var SV=ma({"0%":{strokeDasharray:"1, 400",strokeDashoffset:"0"},"50%":{strokeDasharray:"400, 400",strokeDashoffset:"-100"},"100%":{strokeDasharray:"400, 400",strokeDashoffset:"-260"}}),kV=ma({"0%":{transform:"rotate(0deg)"},"100%":{transform:"rotate(360deg)"}}),jV=ma({"0%":{left:"-40%"},"100%":{left:"100%"}}),_V=ma({from:{backgroundPosition:"1rem 0"},to:{backgroundPosition:"0 0"}});function U3(e){const{value:t=0,min:n,max:r,valueText:o,getValueText:s,isIndeterminate:i,role:l="progressbar"}=e,u=wV(t,n,r);return{bind:{"data-indeterminate":i?"":void 0,"aria-valuemax":r,"aria-valuemin":n,"aria-valuenow":i?void 0:t,"aria-valuetext":(()=>{if(t!=null)return typeof s=="function"?s(t,u):o})(),role:l},percent:u,value:t}}var G3=e=>{const{size:t,isIndeterminate:n,...r}=e;return a.jsx(we.svg,{viewBox:"0 0 100 100",__css:{width:t,height:t,animation:n?`${kV} 2s linear infinite`:void 0},...r})};G3.displayName="Shape";var B1=je((e,t)=>{var n;const{size:r="48px",max:o=100,min:s=0,valueText:i,getValueText:l,value:u,capIsRound:p,children:m,thickness:h="10px",color:g="#0078d4",trackColor:x="#edebe9",isIndeterminate:y,...b}=e,w=U3({min:s,max:o,value:u,valueText:i,getValueText:l,isIndeterminate:y}),S=y?void 0:((n=w.percent)!=null?n:0)*2.64,j=S==null?void 0:`${S} ${264-S}`,_=y?{css:{animation:`${SV} 1.5s linear infinite`}}:{strokeDashoffset:66,strokeDasharray:j,transitionProperty:"stroke-dasharray, stroke",transitionDuration:"0.6s",transitionTimingFunction:"ease"},E={display:"inline-block",position:"relative",verticalAlign:"middle",fontSize:r};return a.jsxs(we.div,{ref:t,className:"chakra-progress",...w.bind,...b,__css:E,children:[a.jsxs(G3,{size:r,isIndeterminate:y,children:[a.jsx(F1,{stroke:x,strokeWidth:h,className:"chakra-progress__track"}),a.jsx(F1,{stroke:g,strokeWidth:h,className:"chakra-progress__indicator",strokeLinecap:p?"round":void 0,opacity:w.value===0&&!y?0:void 0,..._})]}),m]})});B1.displayName="CircularProgress";var[IV,PV]=Wt({name:"ProgressStylesContext",errorMessage:`useProgressStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),EV=je((e,t)=>{const{min:n,max:r,value:o,isIndeterminate:s,role:i,...l}=e,u=U3({value:o,min:n,max:r,isIndeterminate:s,role:i}),m={height:"100%",...PV().filledTrack};return a.jsx(we.div,{ref:t,style:{width:`${u.percent}%`,...l.style},...u.bind,...l,__css:m})}),K3=je((e,t)=>{var n;const{value:r,min:o=0,max:s=100,hasStripe:i,isAnimated:l,children:u,borderRadius:p,isIndeterminate:m,"aria-label":h,"aria-labelledby":g,"aria-valuetext":x,title:y,role:b,...w}=on(e),S=Un("Progress",e),j=p??((n=S.track)==null?void 0:n.borderRadius),_={animation:`${_V} 1s linear infinite`},M={...!m&&i&&l&&_,...m&&{position:"absolute",willChange:"left",minWidth:"50%",animation:`${jV} 1s ease infinite normal none running`}},R={overflow:"hidden",position:"relative",...S.track};return a.jsx(we.div,{ref:t,borderRadius:j,__css:R,...w,children:a.jsxs(IV,{value:S,children:[a.jsx(EV,{"aria-label":h,"aria-labelledby":g,"aria-valuetext":x,min:o,max:s,value:r,isIndeterminate:m,css:M,borderRadius:j,title:y,role:b}),u]})})});K3.displayName="Progress";function MV(e){return e&&a1(e)&&a1(e.target)}function OV(e={}){const{onChange:t,value:n,defaultValue:r,name:o,isDisabled:s,isFocusable:i,isNative:l,...u}=e,[p,m]=d.useState(r||""),h=typeof n<"u",g=h?n:p,x=d.useRef(null),y=d.useCallback(()=>{const I=x.current;if(!I)return;let M="input:not(:disabled):checked";const R=I.querySelector(M);if(R){R.focus();return}M="input:not(:disabled)";const D=I.querySelector(M);D==null||D.focus()},[]),w=`radio-${d.useId()}`,S=o||w,j=d.useCallback(I=>{const M=MV(I)?I.target.value:I;h||m(M),t==null||t(String(M))},[t,h]),_=d.useCallback((I={},M=null)=>({...I,ref:It(M,x),role:"radiogroup"}),[]),E=d.useCallback((I={},M=null)=>({...I,ref:M,name:S,[l?"checked":"isChecked"]:g!=null?I.value===g:void 0,onChange(D){j(D)},"data-radiogroup":!0}),[l,S,j,g]);return{getRootProps:_,getRadioProps:E,name:S,ref:x,focus:y,setValue:m,value:g,onChange:j,isDisabled:s,isFocusable:i,htmlProps:u}}var[RV,q3]=Wt({name:"RadioGroupContext",strict:!1}),cm=je((e,t)=>{const{colorScheme:n,size:r,variant:o,children:s,className:i,isDisabled:l,isFocusable:u,...p}=e,{value:m,onChange:h,getRootProps:g,name:x,htmlProps:y}=OV(p),b=d.useMemo(()=>({name:x,size:r,onChange:h,colorScheme:n,value:m,variant:o,isDisabled:l,isFocusable:u}),[x,r,h,n,m,o,l,u]);return a.jsx(RV,{value:b,children:a.jsx(we.div,{...g(y,t),className:Ye("chakra-radio-group",i),children:s})})});cm.displayName="RadioGroup";var DV={border:"0",clip:"rect(0, 0, 0, 0)",height:"1px",width:"1px",margin:"-1px",padding:"0",overflow:"hidden",whiteSpace:"nowrap",position:"absolute"};function AV(e={}){const{defaultChecked:t,isChecked:n,isFocusable:r,isDisabled:o,isReadOnly:s,isRequired:i,onChange:l,isInvalid:u,name:p,value:m,id:h,"data-radiogroup":g,"aria-describedby":x,...y}=e,b=`radio-${d.useId()}`,w=Pd(),j=!!q3()||!!g;let E=!!w&&!j?w.id:b;E=h??E;const I=o??(w==null?void 0:w.isDisabled),M=s??(w==null?void 0:w.isReadOnly),R=i??(w==null?void 0:w.isRequired),D=u??(w==null?void 0:w.isInvalid),[A,O]=d.useState(!1),[T,X]=d.useState(!1),[B,V]=d.useState(!1),[U,N]=d.useState(!1),[$,q]=d.useState(!!t),F=typeof n<"u",Q=F?n:$;d.useEffect(()=>p5(O),[]);const Y=d.useCallback(de=>{if(M||I){de.preventDefault();return}F||q(de.target.checked),l==null||l(de)},[F,I,M,l]),se=d.useCallback(de=>{de.key===" "&&N(!0)},[N]),ae=d.useCallback(de=>{de.key===" "&&N(!1)},[N]),re=d.useCallback((de={},ge=null)=>({...de,ref:ge,"data-active":dt(U),"data-hover":dt(B),"data-disabled":dt(I),"data-invalid":dt(D),"data-checked":dt(Q),"data-focus":dt(T),"data-focus-visible":dt(T&&A),"data-readonly":dt(M),"aria-hidden":!0,onMouseDown:He(de.onMouseDown,()=>N(!0)),onMouseUp:He(de.onMouseUp,()=>N(!1)),onMouseEnter:He(de.onMouseEnter,()=>V(!0)),onMouseLeave:He(de.onMouseLeave,()=>V(!1))}),[U,B,I,D,Q,T,M,A]),{onFocus:G,onBlur:K}=w??{},ee=d.useCallback((de={},ge=null)=>{const Ce=I&&!r;return{...de,id:E,ref:ge,type:"radio",name:p,value:m,onChange:He(de.onChange,Y),onBlur:He(K,de.onBlur,()=>X(!1)),onFocus:He(G,de.onFocus,()=>X(!0)),onKeyDown:He(de.onKeyDown,se),onKeyUp:He(de.onKeyUp,ae),checked:Q,disabled:Ce,readOnly:M,required:R,"aria-invalid":Co(D),"aria-disabled":Co(Ce),"aria-required":Co(R),"data-readonly":dt(M),"aria-describedby":x,style:DV}},[I,r,E,p,m,Y,K,G,se,ae,Q,M,R,D,x]);return{state:{isInvalid:D,isFocused:T,isChecked:Q,isActive:U,isHovered:B,isDisabled:I,isReadOnly:M,isRequired:R},getCheckboxProps:re,getRadioProps:re,getInputProps:ee,getLabelProps:(de={},ge=null)=>({...de,ref:ge,onMouseDown:He(de.onMouseDown,TV),"data-disabled":dt(I),"data-checked":dt(Q),"data-invalid":dt(D)}),getRootProps:(de,ge=null)=>({...de,ref:ge,"data-disabled":dt(I),"data-checked":dt(Q),"data-invalid":dt(D)}),htmlProps:y}}function TV(e){e.preventDefault(),e.stopPropagation()}function NV(e,t){const n={},r={};for(const[o,s]of Object.entries(e))t.includes(o)?n[o]=s:r[o]=s;return[n,r]}var Ks=je((e,t)=>{var n;const r=q3(),{onChange:o,value:s}=e,i=Un("Radio",{...r,...e}),l=on(e),{spacing:u="0.5rem",children:p,isDisabled:m=r==null?void 0:r.isDisabled,isFocusable:h=r==null?void 0:r.isFocusable,inputProps:g,...x}=l;let y=e.isChecked;(r==null?void 0:r.value)!=null&&s!=null&&(y=r.value===s);let b=o;r!=null&&r.onChange&&s!=null&&(b=ph(r.onChange,o));const w=(n=e==null?void 0:e.name)!=null?n:r==null?void 0:r.name,{getInputProps:S,getCheckboxProps:j,getLabelProps:_,getRootProps:E,htmlProps:I}=AV({...x,isChecked:y,isFocusable:h,isDisabled:m,onChange:b,name:w}),[M,R]=NV(I,eI),D=j(R),A=S(g,t),O=_(),T=Object.assign({},M,E()),X={display:"inline-flex",alignItems:"center",verticalAlign:"top",cursor:"pointer",position:"relative",...i.container},B={display:"inline-flex",alignItems:"center",justifyContent:"center",flexShrink:0,...i.control},V={userSelect:"none",marginStart:u,...i.label};return a.jsxs(we.label,{className:"chakra-radio",...T,__css:X,children:[a.jsx("input",{className:"chakra-radio__input",...A}),a.jsx(we.span,{className:"chakra-radio__control",...D,__css:B}),p&&a.jsx(we.span,{className:"chakra-radio__label",...O,__css:V,children:p})]})});Ks.displayName="Radio";var X3=je(function(t,n){const{children:r,placeholder:o,className:s,...i}=t;return a.jsxs(we.select,{...i,ref:n,className:Ye("chakra-select",s),children:[o&&a.jsx("option",{value:"",children:o}),r]})});X3.displayName="SelectField";function $V(e,t){const n={},r={};for(const[o,s]of Object.entries(e))t.includes(o)?n[o]=s:r[o]=s;return[n,r]}var Q3=je((e,t)=>{var n;const r=Un("Select",e),{rootProps:o,placeholder:s,icon:i,color:l,height:u,h:p,minH:m,minHeight:h,iconColor:g,iconSize:x,...y}=on(e),[b,w]=$V(y,eI),S=db(w),j={width:"100%",height:"fit-content",position:"relative",color:l},_={paddingEnd:"2rem",...r.field,_focus:{zIndex:"unset",...(n=r.field)==null?void 0:n._focus}};return a.jsxs(we.div,{className:"chakra-select__wrapper",__css:j,...b,...o,children:[a.jsx(X3,{ref:t,height:p??u,minH:m??h,placeholder:s,...S,__css:_,children:e.children}),a.jsx(Y3,{"data-disabled":dt(S.disabled),...(g||l)&&{color:g||l},__css:r.icon,...x&&{fontSize:x},children:i})]})});Q3.displayName="Select";var LV=e=>a.jsx("svg",{viewBox:"0 0 24 24",...e,children:a.jsx("path",{fill:"currentColor",d:"M16.59 8.59L12 13.17 7.41 8.59 6 10l6 6 6-6z"})}),zV=we("div",{baseStyle:{position:"absolute",display:"inline-flex",alignItems:"center",justifyContent:"center",pointerEvents:"none",top:"50%",transform:"translateY(-50%)"}}),Y3=e=>{const{children:t=a.jsx(LV,{}),...n}=e,r=d.cloneElement(t,{role:"presentation",className:"chakra-select__icon",focusable:!1,"aria-hidden":!0,style:{width:"1em",height:"1em",color:"currentColor"}});return a.jsx(zV,{...n,className:"chakra-select__icon-wrapper",children:d.isValidElement(t)?r:null})};Y3.displayName="SelectIcon";function FV(){const e=d.useRef(!0);return d.useEffect(()=>{e.current=!1},[]),e.current}function BV(e){const t=d.useRef();return d.useEffect(()=>{t.current=e},[e]),t.current}var HV=we("div",{baseStyle:{boxShadow:"none",backgroundClip:"padding-box",cursor:"default",color:"transparent",pointerEvents:"none",userSelect:"none","&::before, &::after, *":{visibility:"hidden"}}}),H1=tI("skeleton-start-color"),V1=tI("skeleton-end-color"),VV=ma({from:{opacity:0},to:{opacity:1}}),WV=ma({from:{borderColor:H1.reference,background:H1.reference},to:{borderColor:V1.reference,background:V1.reference}}),Gh=je((e,t)=>{const n={...e,fadeDuration:typeof e.fadeDuration=="number"?e.fadeDuration:.4,speed:typeof e.speed=="number"?e.speed:.8},r=oi("Skeleton",n),o=FV(),{startColor:s="",endColor:i="",isLoaded:l,fadeDuration:u,speed:p,className:m,fitContent:h,...g}=on(n),[x,y]=Ho("colors",[s,i]),b=BV(l),w=Ye("chakra-skeleton",m),S={...x&&{[H1.variable]:x},...y&&{[V1.variable]:y}};if(l){const j=o||b?"none":`${VV} ${u}s`;return a.jsx(we.div,{ref:t,className:w,__css:{animation:j},...g})}return a.jsx(HV,{ref:t,className:w,...g,__css:{width:h?"fit-content":void 0,...r,...S,_dark:{...r._dark,...S},animation:`${p}s linear infinite alternate ${WV}`}})});Gh.displayName="Skeleton";var ho=e=>e?"":void 0,uc=e=>e?!0:void 0,ai=(...e)=>e.filter(Boolean).join(" ");function dc(...e){return function(n){e.some(r=>(r==null||r(n),n==null?void 0:n.defaultPrevented))}}function UV(e){return{root:`slider-root-${e}`,getThumb:t=>`slider-thumb-${e}-${t}`,getInput:t=>`slider-input-${e}-${t}`,track:`slider-track-${e}`,innerTrack:`slider-filled-track-${e}`,getMarker:t=>`slider-marker-${e}-${t}`,output:`slider-output-${e}`}}function Ru(e){const{orientation:t,vertical:n,horizontal:r}=e;return t==="vertical"?n:r}var zp={width:0,height:0},op=e=>e||zp;function Z3(e){const{orientation:t,thumbPercents:n,thumbRects:r,isReversed:o}=e,s=b=>{var w;const S=(w=r[b])!=null?w:zp;return{position:"absolute",userSelect:"none",WebkitUserSelect:"none",MozUserSelect:"none",msUserSelect:"none",touchAction:"none",...Ru({orientation:t,vertical:{bottom:`calc(${n[b]}% - ${S.height/2}px)`},horizontal:{left:`calc(${n[b]}% - ${S.width/2}px)`}})}},i=t==="vertical"?r.reduce((b,w)=>op(b).height>op(w).height?b:w,zp):r.reduce((b,w)=>op(b).width>op(w).width?b:w,zp),l={position:"relative",touchAction:"none",WebkitTapHighlightColor:"rgba(0,0,0,0)",userSelect:"none",outline:0,...Ru({orientation:t,vertical:i?{paddingLeft:i.width/2,paddingRight:i.width/2}:{},horizontal:i?{paddingTop:i.height/2,paddingBottom:i.height/2}:{}})},u={position:"absolute",...Ru({orientation:t,vertical:{left:"50%",transform:"translateX(-50%)",height:"100%"},horizontal:{top:"50%",transform:"translateY(-50%)",width:"100%"}})},p=n.length===1,m=[0,o?100-n[0]:n[0]],h=p?m:n;let g=h[0];!p&&o&&(g=100-g);const x=Math.abs(h[h.length-1]-h[0]),y={...u,...Ru({orientation:t,vertical:o?{height:`${x}%`,top:`${g}%`}:{height:`${x}%`,bottom:`${g}%`},horizontal:o?{width:`${x}%`,right:`${g}%`}:{width:`${x}%`,left:`${g}%`}})};return{trackStyle:u,innerTrackStyle:y,rootStyle:l,getThumbStyle:s}}function J3(e){const{isReversed:t,direction:n,orientation:r}=e;return n==="ltr"||r==="vertical"?t:!t}function GV(e,t,n,r){return e.addEventListener(t,n,r),()=>{e.removeEventListener(t,n,r)}}function KV(e){const t=XV(e);return typeof t.PointerEvent<"u"&&e instanceof t.PointerEvent?e.pointerType==="mouse":e instanceof t.MouseEvent}function eP(e){return!!e.touches}function qV(e){return eP(e)&&e.touches.length>1}function XV(e){var t;return(t=e.view)!=null?t:window}function QV(e,t="page"){const n=e.touches[0]||e.changedTouches[0];return{x:n[`${t}X`],y:n[`${t}Y`]}}function YV(e,t="page"){return{x:e[`${t}X`],y:e[`${t}Y`]}}function tP(e,t="page"){return eP(e)?QV(e,t):YV(e,t)}function ZV(e){return t=>{const n=KV(t);(!n||n&&t.button===0)&&e(t)}}function JV(e,t=!1){function n(o){e(o,{point:tP(o)})}return t?ZV(n):n}function Fp(e,t,n,r){return GV(e,t,JV(n,t==="pointerdown"),r)}var eW=Object.defineProperty,tW=(e,t,n)=>t in e?eW(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,$o=(e,t,n)=>(tW(e,typeof t!="symbol"?t+"":t,n),n),nW=class{constructor(e,t,n){$o(this,"history",[]),$o(this,"startEvent",null),$o(this,"lastEvent",null),$o(this,"lastEventInfo",null),$o(this,"handlers",{}),$o(this,"removeListeners",()=>{}),$o(this,"threshold",3),$o(this,"win"),$o(this,"updatePoint",()=>{if(!(this.lastEvent&&this.lastEventInfo))return;const l=xv(this.lastEventInfo,this.history),u=this.startEvent!==null,p=aW(l.offset,{x:0,y:0})>=this.threshold;if(!u&&!p)return;const{timestamp:m}=Qw();this.history.push({...l.point,timestamp:m});const{onStart:h,onMove:g}=this.handlers;u||(h==null||h(this.lastEvent,l),this.startEvent=this.lastEvent),g==null||g(this.lastEvent,l)}),$o(this,"onPointerMove",(l,u)=>{this.lastEvent=l,this.lastEventInfo=u,_$.update(this.updatePoint,!0)}),$o(this,"onPointerUp",(l,u)=>{const p=xv(u,this.history),{onEnd:m,onSessionEnd:h}=this.handlers;h==null||h(l,p),this.end(),!(!m||!this.startEvent)&&(m==null||m(l,p))});var r;if(this.win=(r=e.view)!=null?r:window,qV(e))return;this.handlers=t,n&&(this.threshold=n),e.stopPropagation(),e.preventDefault();const o={point:tP(e)},{timestamp:s}=Qw();this.history=[{...o.point,timestamp:s}];const{onSessionStart:i}=t;i==null||i(e,xv(o,this.history)),this.removeListeners=sW(Fp(this.win,"pointermove",this.onPointerMove),Fp(this.win,"pointerup",this.onPointerUp),Fp(this.win,"pointercancel",this.onPointerUp))}updateHandlers(e){this.handlers=e}end(){var e;(e=this.removeListeners)==null||e.call(this),I$.update(this.updatePoint)}};function TS(e,t){return{x:e.x-t.x,y:e.y-t.y}}function xv(e,t){return{point:e.point,delta:TS(e.point,t[t.length-1]),offset:TS(e.point,t[0]),velocity:oW(t,.1)}}var rW=e=>e*1e3;function oW(e,t){if(e.length<2)return{x:0,y:0};let n=e.length-1,r=null;const o=e[e.length-1];for(;n>=0&&(r=e[n],!(o.timestamp-r.timestamp>rW(t)));)n--;if(!r)return{x:0,y:0};const s=(o.timestamp-r.timestamp)/1e3;if(s===0)return{x:0,y:0};const i={x:(o.x-r.x)/s,y:(o.y-r.y)/s};return i.x===1/0&&(i.x=0),i.y===1/0&&(i.y=0),i}function sW(...e){return t=>e.reduce((n,r)=>r(n),t)}function bv(e,t){return Math.abs(e-t)}function NS(e){return"x"in e&&"y"in e}function aW(e,t){if(typeof e=="number"&&typeof t=="number")return bv(e,t);if(NS(e)&&NS(t)){const n=bv(e.x,t.x),r=bv(e.y,t.y);return Math.sqrt(n**2+r**2)}return 0}function nP(e){const t=d.useRef(null);return t.current=e,t}function rP(e,t){const{onPan:n,onPanStart:r,onPanEnd:o,onPanSessionStart:s,onPanSessionEnd:i,threshold:l}=t,u=!!(n||r||o||s||i),p=d.useRef(null),m=nP({onSessionStart:s,onSessionEnd:i,onStart:r,onMove:n,onEnd(h,g){p.current=null,o==null||o(h,g)}});d.useEffect(()=>{var h;(h=p.current)==null||h.updateHandlers(m.current)}),d.useEffect(()=>{const h=e.current;if(!h||!u)return;function g(x){p.current=new nW(x,m.current,l)}return Fp(h,"pointerdown",g)},[e,u,m,l]),d.useEffect(()=>()=>{var h;(h=p.current)==null||h.end(),p.current=null},[])}function iW(e,t){if(!e){t(void 0);return}t({width:e.offsetWidth,height:e.offsetHeight});const n=e.ownerDocument.defaultView??window,r=new n.ResizeObserver(o=>{if(!Array.isArray(o)||!o.length)return;const[s]=o;let i,l;if("borderBoxSize"in s){const u=s.borderBoxSize,p=Array.isArray(u)?u[0]:u;i=p.inlineSize,l=p.blockSize}else i=e.offsetWidth,l=e.offsetHeight;t({width:i,height:l})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}var lW=globalThis!=null&&globalThis.document?d.useLayoutEffect:d.useEffect;function cW(e,t){var n,r;if(!e||!e.parentElement)return;const o=(r=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?r:window,s=new o.MutationObserver(()=>{t()});return s.observe(e.parentElement,{childList:!0}),()=>{s.disconnect()}}function oP({getNodes:e,observeMutation:t=!0}){const[n,r]=d.useState([]),[o,s]=d.useState(0);return lW(()=>{const i=e(),l=i.map((u,p)=>iW(u,m=>{r(h=>[...h.slice(0,p),m,...h.slice(p+1)])}));if(t){const u=i[0];l.push(cW(u,()=>{s(p=>p+1)}))}return()=>{l.forEach(u=>{u==null||u()})}},[o]),n}function uW(e){return typeof e=="object"&&e!==null&&"current"in e}function dW(e){const[t]=oP({observeMutation:!1,getNodes(){return[uW(e)?e.current:e]}});return t}function fW(e){const{min:t=0,max:n=100,onChange:r,value:o,defaultValue:s,isReversed:i,direction:l="ltr",orientation:u="horizontal",id:p,isDisabled:m,isReadOnly:h,onChangeStart:g,onChangeEnd:x,step:y=1,getAriaValueText:b,"aria-valuetext":w,"aria-label":S,"aria-labelledby":j,name:_,focusThumbOnChange:E=!0,minStepsBetweenThumbs:I=0,...M}=e,R=un(g),D=un(x),A=un(b),O=J3({isReversed:i,direction:l,orientation:u}),[T,X]=_d({value:o,defaultValue:s??[25,75],onChange:r});if(!Array.isArray(T))throw new TypeError(`[range-slider] You passed an invalid value for \`value\` or \`defaultValue\`, expected \`Array\` but got \`${typeof T}\``);const[B,V]=d.useState(!1),[U,N]=d.useState(!1),[$,q]=d.useState(-1),F=!(m||h),Q=d.useRef(T),Y=T.map(ke=>ac(ke,t,n)),se=I*y,ae=pW(Y,t,n,se),re=d.useRef({eventSource:null,value:[],valueBounds:[]});re.current.value=Y,re.current.valueBounds=ae;const G=Y.map(ke=>n-ke+t),ee=(O?G:Y).map(ke=>om(ke,t,n)),ce=u==="vertical",J=d.useRef(null),ie=d.useRef(null),de=oP({getNodes(){const ke=ie.current,Be=ke==null?void 0:ke.querySelectorAll("[role=slider]");return Be?Array.from(Be):[]}}),ge=d.useId(),he=UV(p??ge),fe=d.useCallback(ke=>{var Be,ze;if(!J.current)return;re.current.eventSource="pointer";const Ge=J.current.getBoundingClientRect(),{clientX:pt,clientY:Pn}=(ze=(Be=ke.touches)==null?void 0:Be[0])!=null?ze:ke,Dt=ce?Ge.bottom-Pn:pt-Ge.left,At=ce?Ge.height:Ge.width;let pr=Dt/At;return O&&(pr=1-pr),h5(pr,t,n)},[ce,O,n,t]),Oe=(n-t)/10,_e=y||(n-t)/100,Ne=d.useMemo(()=>({setValueAtIndex(ke,Be){if(!F)return;const ze=re.current.valueBounds[ke];Be=parseFloat(P1(Be,ze.min,_e)),Be=ac(Be,ze.min,ze.max);const Ge=[...re.current.value];Ge[ke]=Be,X(Ge)},setActiveIndex:q,stepUp(ke,Be=_e){const ze=re.current.value[ke],Ge=O?ze-Be:ze+Be;Ne.setValueAtIndex(ke,Ge)},stepDown(ke,Be=_e){const ze=re.current.value[ke],Ge=O?ze+Be:ze-Be;Ne.setValueAtIndex(ke,Ge)},reset(){X(Q.current)}}),[_e,O,X,F]),nt=d.useCallback(ke=>{const Be=ke.key,Ge={ArrowRight:()=>Ne.stepUp($),ArrowUp:()=>Ne.stepUp($),ArrowLeft:()=>Ne.stepDown($),ArrowDown:()=>Ne.stepDown($),PageUp:()=>Ne.stepUp($,Oe),PageDown:()=>Ne.stepDown($,Oe),Home:()=>{const{min:pt}=ae[$];Ne.setValueAtIndex($,pt)},End:()=>{const{max:pt}=ae[$];Ne.setValueAtIndex($,pt)}}[Be];Ge&&(ke.preventDefault(),ke.stopPropagation(),Ge(ke),re.current.eventSource="keyboard")},[Ne,$,Oe,ae]),{getThumbStyle:$e,rootStyle:Pt,trackStyle:Ze,innerTrackStyle:ot}=d.useMemo(()=>Z3({isReversed:O,orientation:u,thumbRects:de,thumbPercents:ee}),[O,u,ee,de]),ye=d.useCallback(ke=>{var Be;const ze=ke??$;if(ze!==-1&&E){const Ge=he.getThumb(ze),pt=(Be=ie.current)==null?void 0:Be.ownerDocument.getElementById(Ge);pt&&setTimeout(()=>pt.focus())}},[E,$,he]);pa(()=>{re.current.eventSource==="keyboard"&&(D==null||D(re.current.value))},[Y,D]);const De=ke=>{const Be=fe(ke)||0,ze=re.current.value.map(At=>Math.abs(At-Be)),Ge=Math.min(...ze);let pt=ze.indexOf(Ge);const Pn=ze.filter(At=>At===Ge);Pn.length>1&&Be>re.current.value[pt]&&(pt=pt+Pn.length-1),q(pt),Ne.setValueAtIndex(pt,Be),ye(pt)},ut=ke=>{if($==-1)return;const Be=fe(ke)||0;q($),Ne.setValueAtIndex($,Be),ye($)};rP(ie,{onPanSessionStart(ke){F&&(V(!0),De(ke),R==null||R(re.current.value))},onPanSessionEnd(){F&&(V(!1),D==null||D(re.current.value))},onPan(ke){F&&ut(ke)}});const bt=d.useCallback((ke={},Be=null)=>({...ke,...M,id:he.root,ref:It(Be,ie),tabIndex:-1,"aria-disabled":uc(m),"data-focused":ho(U),style:{...ke.style,...Pt}}),[M,m,U,Pt,he]),be=d.useCallback((ke={},Be=null)=>({...ke,ref:It(Be,J),id:he.track,"data-disabled":ho(m),style:{...ke.style,...Ze}}),[m,Ze,he]),Je=d.useCallback((ke={},Be=null)=>({...ke,ref:Be,id:he.innerTrack,style:{...ke.style,...ot}}),[ot,he]),lt=d.useCallback((ke,Be=null)=>{var ze;const{index:Ge,...pt}=ke,Pn=Y[Ge];if(Pn==null)throw new TypeError(`[range-slider > thumb] Cannot find value at index \`${Ge}\`. The \`value\` or \`defaultValue\` length is : ${Y.length}`);const Dt=ae[Ge];return{...pt,ref:Be,role:"slider",tabIndex:F?0:void 0,id:he.getThumb(Ge),"data-active":ho(B&&$===Ge),"aria-valuetext":(ze=A==null?void 0:A(Pn))!=null?ze:w==null?void 0:w[Ge],"aria-valuemin":Dt.min,"aria-valuemax":Dt.max,"aria-valuenow":Pn,"aria-orientation":u,"aria-disabled":uc(m),"aria-readonly":uc(h),"aria-label":S==null?void 0:S[Ge],"aria-labelledby":S!=null&&S[Ge]||j==null?void 0:j[Ge],style:{...ke.style,...$e(Ge)},onKeyDown:dc(ke.onKeyDown,nt),onFocus:dc(ke.onFocus,()=>{N(!0),q(Ge)}),onBlur:dc(ke.onBlur,()=>{N(!1),q(-1)})}},[he,Y,ae,F,B,$,A,w,u,m,h,S,j,$e,nt,N]),ft=d.useCallback((ke={},Be=null)=>({...ke,ref:Be,id:he.output,htmlFor:Y.map((ze,Ge)=>he.getThumb(Ge)).join(" "),"aria-live":"off"}),[he,Y]),Me=d.useCallback((ke,Be=null)=>{const{value:ze,...Ge}=ke,pt=!(zen),Pn=ze>=Y[0]&&ze<=Y[Y.length-1];let Dt=om(ze,t,n);Dt=O?100-Dt:Dt;const At={position:"absolute",pointerEvents:"none",...Ru({orientation:u,vertical:{bottom:`${Dt}%`},horizontal:{left:`${Dt}%`}})};return{...Ge,ref:Be,id:he.getMarker(ke.value),role:"presentation","aria-hidden":!0,"data-disabled":ho(m),"data-invalid":ho(!pt),"data-highlighted":ho(Pn),style:{...ke.style,...At}}},[m,O,n,t,u,Y,he]),Le=d.useCallback((ke,Be=null)=>{const{index:ze,...Ge}=ke;return{...Ge,ref:Be,id:he.getInput(ze),type:"hidden",value:Y[ze],name:Array.isArray(_)?_[ze]:`${_}-${ze}`}},[_,Y,he]);return{state:{value:Y,isFocused:U,isDragging:B,getThumbPercent:ke=>ee[ke],getThumbMinValue:ke=>ae[ke].min,getThumbMaxValue:ke=>ae[ke].max},actions:Ne,getRootProps:bt,getTrackProps:be,getInnerTrackProps:Je,getThumbProps:lt,getMarkerProps:Me,getInputProps:Le,getOutputProps:ft}}function pW(e,t,n,r){return e.map((o,s)=>{const i=s===0?t:e[s-1]+r,l=s===e.length-1?n:e[s+1]-r;return{min:i,max:l}})}var[mW,Kh]=Wt({name:"SliderContext",errorMessage:"useSliderContext: `context` is undefined. Seems you forgot to wrap all slider components within "}),[hW,qh]=Wt({name:"RangeSliderStylesContext",errorMessage:`useRangeSliderStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),Bb=je(function(t,n){const r={orientation:"horizontal",...t},o=Un("Slider",r),s=on(r),{direction:i}=bd();s.direction=i;const{getRootProps:l,...u}=fW(s),p=d.useMemo(()=>({...u,name:r.name}),[u,r.name]);return a.jsx(mW,{value:p,children:a.jsx(hW,{value:o,children:a.jsx(we.div,{...l({},n),className:"chakra-slider",__css:o.container,children:r.children})})})});Bb.displayName="RangeSlider";var nd=je(function(t,n){const{getThumbProps:r,getInputProps:o,name:s}=Kh(),i=qh(),l=r(t,n);return a.jsxs(we.div,{...l,className:ai("chakra-slider__thumb",t.className),__css:i.thumb,children:[l.children,s&&a.jsx("input",{...o({index:t.index})})]})});nd.displayName="RangeSliderThumb";var Hb=je(function(t,n){const{getTrackProps:r}=Kh(),o=qh(),s=r(t,n);return a.jsx(we.div,{...s,className:ai("chakra-slider__track",t.className),__css:o.track,"data-testid":"chakra-range-slider-track"})});Hb.displayName="RangeSliderTrack";var Vb=je(function(t,n){const{getInnerTrackProps:r}=Kh(),o=qh(),s=r(t,n);return a.jsx(we.div,{...s,className:"chakra-slider__filled-track",__css:o.filledTrack})});Vb.displayName="RangeSliderFilledTrack";var Ai=je(function(t,n){const{getMarkerProps:r}=Kh(),o=qh(),s=r(t,n);return a.jsx(we.div,{...s,className:ai("chakra-slider__marker",t.className),__css:o.mark})});Ai.displayName="RangeSliderMark";function gW(e){var t;const{min:n=0,max:r=100,onChange:o,value:s,defaultValue:i,isReversed:l,direction:u="ltr",orientation:p="horizontal",id:m,isDisabled:h,isReadOnly:g,onChangeStart:x,onChangeEnd:y,step:b=1,getAriaValueText:w,"aria-valuetext":S,"aria-label":j,"aria-labelledby":_,name:E,focusThumbOnChange:I=!0,...M}=e,R=un(x),D=un(y),A=un(w),O=J3({isReversed:l,direction:u,orientation:p}),[T,X]=_d({value:s,defaultValue:i??xW(n,r),onChange:o}),[B,V]=d.useState(!1),[U,N]=d.useState(!1),$=!(h||g),q=(r-n)/10,F=b||(r-n)/100,Q=ac(T,n,r),Y=r-Q+n,ae=om(O?Y:Q,n,r),re=p==="vertical",G=nP({min:n,max:r,step:b,isDisabled:h,value:Q,isInteractive:$,isReversed:O,isVertical:re,eventSource:null,focusThumbOnChange:I,orientation:p}),K=d.useRef(null),ee=d.useRef(null),ce=d.useRef(null),J=d.useId(),ie=m??J,[de,ge]=[`slider-thumb-${ie}`,`slider-track-${ie}`],Ce=d.useCallback(Me=>{var Le,Ut;if(!K.current)return;const ke=G.current;ke.eventSource="pointer";const Be=K.current.getBoundingClientRect(),{clientX:ze,clientY:Ge}=(Ut=(Le=Me.touches)==null?void 0:Le[0])!=null?Ut:Me,pt=re?Be.bottom-Ge:ze-Be.left,Pn=re?Be.height:Be.width;let Dt=pt/Pn;O&&(Dt=1-Dt);let At=h5(Dt,ke.min,ke.max);return ke.step&&(At=parseFloat(P1(At,ke.min,ke.step))),At=ac(At,ke.min,ke.max),At},[re,O,G]),he=d.useCallback(Me=>{const Le=G.current;Le.isInteractive&&(Me=parseFloat(P1(Me,Le.min,F)),Me=ac(Me,Le.min,Le.max),X(Me))},[F,X,G]),fe=d.useMemo(()=>({stepUp(Me=F){const Le=O?Q-Me:Q+Me;he(Le)},stepDown(Me=F){const Le=O?Q+Me:Q-Me;he(Le)},reset(){he(i||0)},stepTo(Me){he(Me)}}),[he,O,Q,F,i]),Oe=d.useCallback(Me=>{const Le=G.current,ke={ArrowRight:()=>fe.stepUp(),ArrowUp:()=>fe.stepUp(),ArrowLeft:()=>fe.stepDown(),ArrowDown:()=>fe.stepDown(),PageUp:()=>fe.stepUp(q),PageDown:()=>fe.stepDown(q),Home:()=>he(Le.min),End:()=>he(Le.max)}[Me.key];ke&&(Me.preventDefault(),Me.stopPropagation(),ke(Me),Le.eventSource="keyboard")},[fe,he,q,G]),_e=(t=A==null?void 0:A(Q))!=null?t:S,Ne=dW(ee),{getThumbStyle:nt,rootStyle:$e,trackStyle:Pt,innerTrackStyle:Ze}=d.useMemo(()=>{const Me=G.current,Le=Ne??{width:0,height:0};return Z3({isReversed:O,orientation:Me.orientation,thumbRects:[Le],thumbPercents:[ae]})},[O,Ne,ae,G]),ot=d.useCallback(()=>{G.current.focusThumbOnChange&&setTimeout(()=>{var Le;return(Le=ee.current)==null?void 0:Le.focus()})},[G]);pa(()=>{const Me=G.current;ot(),Me.eventSource==="keyboard"&&(D==null||D(Me.value))},[Q,D]);function ye(Me){const Le=Ce(Me);Le!=null&&Le!==G.current.value&&X(Le)}rP(ce,{onPanSessionStart(Me){const Le=G.current;Le.isInteractive&&(V(!0),ot(),ye(Me),R==null||R(Le.value))},onPanSessionEnd(){const Me=G.current;Me.isInteractive&&(V(!1),D==null||D(Me.value))},onPan(Me){G.current.isInteractive&&ye(Me)}});const De=d.useCallback((Me={},Le=null)=>({...Me,...M,ref:It(Le,ce),tabIndex:-1,"aria-disabled":uc(h),"data-focused":ho(U),style:{...Me.style,...$e}}),[M,h,U,$e]),ut=d.useCallback((Me={},Le=null)=>({...Me,ref:It(Le,K),id:ge,"data-disabled":ho(h),style:{...Me.style,...Pt}}),[h,ge,Pt]),bt=d.useCallback((Me={},Le=null)=>({...Me,ref:Le,style:{...Me.style,...Ze}}),[Ze]),be=d.useCallback((Me={},Le=null)=>({...Me,ref:It(Le,ee),role:"slider",tabIndex:$?0:void 0,id:de,"data-active":ho(B),"aria-valuetext":_e,"aria-valuemin":n,"aria-valuemax":r,"aria-valuenow":Q,"aria-orientation":p,"aria-disabled":uc(h),"aria-readonly":uc(g),"aria-label":j,"aria-labelledby":j?void 0:_,style:{...Me.style,...nt(0)},onKeyDown:dc(Me.onKeyDown,Oe),onFocus:dc(Me.onFocus,()=>N(!0)),onBlur:dc(Me.onBlur,()=>N(!1))}),[$,de,B,_e,n,r,Q,p,h,g,j,_,nt,Oe]),Je=d.useCallback((Me,Le=null)=>{const Ut=!(Me.valuer),ke=Q>=Me.value,Be=om(Me.value,n,r),ze={position:"absolute",pointerEvents:"none",...vW({orientation:p,vertical:{bottom:O?`${100-Be}%`:`${Be}%`},horizontal:{left:O?`${100-Be}%`:`${Be}%`}})};return{...Me,ref:Le,role:"presentation","aria-hidden":!0,"data-disabled":ho(h),"data-invalid":ho(!Ut),"data-highlighted":ho(ke),style:{...Me.style,...ze}}},[h,O,r,n,p,Q]),lt=d.useCallback((Me={},Le=null)=>({...Me,ref:Le,type:"hidden",value:Q,name:E}),[E,Q]);return{state:{value:Q,isFocused:U,isDragging:B},actions:fe,getRootProps:De,getTrackProps:ut,getInnerTrackProps:bt,getThumbProps:be,getMarkerProps:Je,getInputProps:lt}}function vW(e){const{orientation:t,vertical:n,horizontal:r}=e;return t==="vertical"?n:r}function xW(e,t){return t"}),[yW,Qh]=Wt({name:"SliderStylesContext",hookName:"useSliderStyles",providerName:""}),Wb=je((e,t)=>{var n;const r={...e,orientation:(n=e==null?void 0:e.orientation)!=null?n:"horizontal"},o=Un("Slider",r),s=on(r),{direction:i}=bd();s.direction=i;const{getInputProps:l,getRootProps:u,...p}=gW(s),m=u(),h=l({},t);return a.jsx(bW,{value:p,children:a.jsx(yW,{value:o,children:a.jsxs(we.div,{...m,className:ai("chakra-slider",r.className),__css:o.container,children:[r.children,a.jsx("input",{...h})]})})})});Wb.displayName="Slider";var Ub=je((e,t)=>{const{getThumbProps:n}=Xh(),r=Qh(),o=n(e,t);return a.jsx(we.div,{...o,className:ai("chakra-slider__thumb",e.className),__css:r.thumb})});Ub.displayName="SliderThumb";var Gb=je((e,t)=>{const{getTrackProps:n}=Xh(),r=Qh(),o=n(e,t);return a.jsx(we.div,{...o,className:ai("chakra-slider__track",e.className),__css:r.track})});Gb.displayName="SliderTrack";var Kb=je((e,t)=>{const{getInnerTrackProps:n}=Xh(),r=Qh(),o=n(e,t);return a.jsx(we.div,{...o,className:ai("chakra-slider__filled-track",e.className),__css:r.filledTrack})});Kb.displayName="SliderFilledTrack";var Ul=je((e,t)=>{const{getMarkerProps:n}=Xh(),r=Qh(),o=n(e,t);return a.jsx(we.div,{...o,className:ai("chakra-slider__marker",e.className),__css:r.mark})});Ul.displayName="SliderMark";var[CW,sP]=Wt({name:"StatStylesContext",errorMessage:`useStatStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),aP=je(function(t,n){const r=Un("Stat",t),o={position:"relative",flex:"1 1 0%",...r.container},{className:s,children:i,...l}=on(t);return a.jsx(CW,{value:r,children:a.jsx(we.div,{ref:n,...l,className:Ye("chakra-stat",s),__css:o,children:a.jsx("dl",{children:i})})})});aP.displayName="Stat";var iP=je(function(t,n){return a.jsx(we.div,{...t,ref:n,role:"group",className:Ye("chakra-stat__group",t.className),__css:{display:"flex",flexWrap:"wrap",justifyContent:"space-around",alignItems:"flex-start"}})});iP.displayName="StatGroup";var lP=je(function(t,n){const r=sP();return a.jsx(we.dt,{ref:n,...t,className:Ye("chakra-stat__label",t.className),__css:r.label})});lP.displayName="StatLabel";var cP=je(function(t,n){const r=sP();return a.jsx(we.dd,{ref:n,...t,className:Ye("chakra-stat__number",t.className),__css:{...r.number,fontFeatureSettings:"pnum",fontVariantNumeric:"proportional-nums"}})});cP.displayName="StatNumber";var qb=je(function(t,n){const r=Un("Switch",t),{spacing:o="0.5rem",children:s,...i}=on(t),{getIndicatorProps:l,getInputProps:u,getCheckboxProps:p,getRootProps:m,getLabelProps:h}=m5(i),g=d.useMemo(()=>({display:"inline-block",position:"relative",verticalAlign:"middle",lineHeight:0,...r.container}),[r.container]),x=d.useMemo(()=>({display:"inline-flex",flexShrink:0,justifyContent:"flex-start",boxSizing:"content-box",cursor:"pointer",...r.track}),[r.track]),y=d.useMemo(()=>({userSelect:"none",marginStart:o,...r.label}),[o,r.label]);return a.jsxs(we.label,{...m(),className:Ye("chakra-switch",t.className),__css:g,children:[a.jsx("input",{className:"chakra-switch__input",...u({},n)}),a.jsx(we.span,{...p(),className:"chakra-switch__track",__css:x,children:a.jsx(we.span,{__css:r.thumb,className:"chakra-switch__thumb",...l()})}),s&&a.jsx(we.span,{className:"chakra-switch__label",...h(),__css:y,children:s})]})});qb.displayName="Switch";var[wW,SW,kW,jW]=lb();function _W(e){var t;const{defaultIndex:n,onChange:r,index:o,isManual:s,isLazy:i,lazyBehavior:l="unmount",orientation:u="horizontal",direction:p="ltr",...m}=e,[h,g]=d.useState(n??0),[x,y]=_d({defaultValue:n??0,value:o,onChange:r});d.useEffect(()=>{o!=null&&g(o)},[o]);const b=kW(),w=d.useId();return{id:`tabs-${(t=e.id)!=null?t:w}`,selectedIndex:x,focusedIndex:h,setSelectedIndex:y,setFocusedIndex:g,isManual:s,isLazy:i,lazyBehavior:l,orientation:u,descendants:b,direction:p,htmlProps:m}}var[IW,Yh]=Wt({name:"TabsContext",errorMessage:"useTabsContext: `context` is undefined. Seems you forgot to wrap all tabs components within "});function PW(e){const{focusedIndex:t,orientation:n,direction:r}=Yh(),o=SW(),s=d.useCallback(i=>{const l=()=>{var j;const _=o.nextEnabled(t);_&&((j=_.node)==null||j.focus())},u=()=>{var j;const _=o.prevEnabled(t);_&&((j=_.node)==null||j.focus())},p=()=>{var j;const _=o.firstEnabled();_&&((j=_.node)==null||j.focus())},m=()=>{var j;const _=o.lastEnabled();_&&((j=_.node)==null||j.focus())},h=n==="horizontal",g=n==="vertical",x=i.key,y=r==="ltr"?"ArrowLeft":"ArrowRight",b=r==="ltr"?"ArrowRight":"ArrowLeft",S={[y]:()=>h&&u(),[b]:()=>h&&l(),ArrowDown:()=>g&&l(),ArrowUp:()=>g&&u(),Home:p,End:m}[x];S&&(i.preventDefault(),S(i))},[o,t,n,r]);return{...e,role:"tablist","aria-orientation":n,onKeyDown:He(e.onKeyDown,s)}}function EW(e){const{isDisabled:t=!1,isFocusable:n=!1,...r}=e,{setSelectedIndex:o,isManual:s,id:i,setFocusedIndex:l,selectedIndex:u}=Yh(),{index:p,register:m}=jW({disabled:t&&!n}),h=p===u,g=()=>{o(p)},x=()=>{l(p),!s&&!(t&&n)&&o(p)},y=h3({...r,ref:It(m,e.ref),isDisabled:t,isFocusable:n,onClick:He(e.onClick,g)}),b="button";return{...y,id:uP(i,p),role:"tab",tabIndex:h?0:-1,type:b,"aria-selected":h,"aria-controls":dP(i,p),onFocus:t?void 0:He(e.onFocus,x)}}var[MW,OW]=Wt({});function RW(e){const t=Yh(),{id:n,selectedIndex:r}=t,s=kh(e.children).map((i,l)=>d.createElement(MW,{key:l,value:{isSelected:l===r,id:dP(n,l),tabId:uP(n,l),selectedIndex:r}},i));return{...e,children:s}}function DW(e){const{children:t,...n}=e,{isLazy:r,lazyBehavior:o}=Yh(),{isSelected:s,id:i,tabId:l}=OW(),u=d.useRef(!1);s&&(u.current=!0);const p=zb({wasSelected:u.current,isSelected:s,enabled:r,mode:o});return{tabIndex:0,...n,children:p?t:null,role:"tabpanel","aria-labelledby":l,hidden:!s,id:i}}function uP(e,t){return`${e}--tab-${t}`}function dP(e,t){return`${e}--tabpanel-${t}`}var[AW,Zh]=Wt({name:"TabsStylesContext",errorMessage:`useTabsStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),rl=je(function(t,n){const r=Un("Tabs",t),{children:o,className:s,...i}=on(t),{htmlProps:l,descendants:u,...p}=_W(i),m=d.useMemo(()=>p,[p]),{isFitted:h,...g}=l;return a.jsx(wW,{value:u,children:a.jsx(IW,{value:m,children:a.jsx(AW,{value:r,children:a.jsx(we.div,{className:Ye("chakra-tabs",s),ref:n,...g,__css:r.root,children:o})})})})});rl.displayName="Tabs";var ol=je(function(t,n){const r=PW({...t,ref:n}),s={display:"flex",...Zh().tablist};return a.jsx(we.div,{...r,className:Ye("chakra-tabs__tablist",t.className),__css:s})});ol.displayName="TabList";var So=je(function(t,n){const r=DW({...t,ref:n}),o=Zh();return a.jsx(we.div,{outline:"0",...r,className:Ye("chakra-tabs__tab-panel",t.className),__css:o.tabpanel})});So.displayName="TabPanel";var zc=je(function(t,n){const r=RW(t),o=Zh();return a.jsx(we.div,{...r,width:"100%",ref:n,className:Ye("chakra-tabs__tab-panels",t.className),__css:o.tabpanels})});zc.displayName="TabPanels";var Tr=je(function(t,n){const r=Zh(),o=EW({...t,ref:n}),s={outline:"0",display:"flex",alignItems:"center",justifyContent:"center",...r.tab};return a.jsx(we.button,{...o,className:Ye("chakra-tabs__tab",t.className),__css:s})});Tr.displayName="Tab";function TW(e,t=[]){const n=Object.assign({},e);for(const r of t)r in n&&delete n[r];return n}var NW=["h","minH","height","minHeight"],fP=je((e,t)=>{const n=oi("Textarea",e),{className:r,rows:o,...s}=on(e),i=db(s),l=o?TW(n,NW):n;return a.jsx(we.textarea,{ref:t,rows:o,...i,className:Ye("chakra-textarea",r),__css:l})});fP.displayName="Textarea";var $W={exit:{scale:.85,opacity:0,transition:{opacity:{duration:.15,easings:"easeInOut"},scale:{duration:.2,easings:"easeInOut"}}},enter:{scale:1,opacity:1,transition:{opacity:{easings:"easeOut",duration:.2},scale:{duration:.2,ease:[.175,.885,.4,1.1]}}}},W1=e=>{var t;return((t=e.current)==null?void 0:t.ownerDocument)||document},Bp=e=>{var t,n;return((n=(t=e.current)==null?void 0:t.ownerDocument)==null?void 0:n.defaultView)||window};function LW(e={}){const{openDelay:t=0,closeDelay:n=0,closeOnClick:r=!0,closeOnMouseDown:o,closeOnScroll:s,closeOnPointerDown:i=o,closeOnEsc:l=!0,onOpen:u,onClose:p,placement:m,id:h,isOpen:g,defaultIsOpen:x,arrowSize:y=10,arrowShadowColor:b,arrowPadding:w,modifiers:S,isDisabled:j,gutter:_,offset:E,direction:I,...M}=e,{isOpen:R,onOpen:D,onClose:A}=Lb({isOpen:g,defaultIsOpen:x,onOpen:u,onClose:p}),{referenceRef:O,getPopperProps:T,getArrowInnerProps:X,getArrowProps:B}=$b({enabled:R,placement:m,arrowPadding:w,modifiers:S,gutter:_,offset:E,direction:I}),V=d.useId(),N=`tooltip-${h??V}`,$=d.useRef(null),q=d.useRef(),F=d.useCallback(()=>{q.current&&(clearTimeout(q.current),q.current=void 0)},[]),Q=d.useRef(),Y=d.useCallback(()=>{Q.current&&(clearTimeout(Q.current),Q.current=void 0)},[]),se=d.useCallback(()=>{Y(),A()},[A,Y]),ae=zW($,se),re=d.useCallback(()=>{if(!j&&!q.current){R&&ae();const ge=Bp($);q.current=ge.setTimeout(D,t)}},[ae,j,R,D,t]),G=d.useCallback(()=>{F();const ge=Bp($);Q.current=ge.setTimeout(se,n)},[n,se,F]),K=d.useCallback(()=>{R&&r&&G()},[r,G,R]),ee=d.useCallback(()=>{R&&i&&G()},[i,G,R]),ce=d.useCallback(ge=>{R&&ge.key==="Escape"&&G()},[R,G]);Ri(()=>W1($),"keydown",l?ce:void 0),Ri(()=>{const ge=$.current;if(!ge)return null;const Ce=n3(ge);return Ce.localName==="body"?Bp($):Ce},"scroll",()=>{R&&s&&se()},{passive:!0,capture:!0}),d.useEffect(()=>{j&&(F(),R&&A())},[j,R,A,F]),d.useEffect(()=>()=>{F(),Y()},[F,Y]),Ri(()=>$.current,"pointerleave",G);const J=d.useCallback((ge={},Ce=null)=>({...ge,ref:It($,Ce,O),onPointerEnter:He(ge.onPointerEnter,fe=>{fe.pointerType!=="touch"&&re()}),onClick:He(ge.onClick,K),onPointerDown:He(ge.onPointerDown,ee),onFocus:He(ge.onFocus,re),onBlur:He(ge.onBlur,G),"aria-describedby":R?N:void 0}),[re,G,ee,R,N,K,O]),ie=d.useCallback((ge={},Ce=null)=>T({...ge,style:{...ge.style,[Nn.arrowSize.var]:y?`${y}px`:void 0,[Nn.arrowShadowColor.var]:b}},Ce),[T,y,b]),de=d.useCallback((ge={},Ce=null)=>{const he={...ge.style,position:"relative",transformOrigin:Nn.transformOrigin.varRef};return{ref:Ce,...M,...ge,id:N,role:"tooltip",style:he}},[M,N]);return{isOpen:R,show:re,hide:G,getTriggerProps:J,getTooltipProps:de,getTooltipPositionerProps:ie,getArrowProps:B,getArrowInnerProps:X}}var yv="chakra-ui:close-tooltip";function zW(e,t){return d.useEffect(()=>{const n=W1(e);return n.addEventListener(yv,t),()=>n.removeEventListener(yv,t)},[t,e]),()=>{const n=W1(e),r=Bp(e);n.dispatchEvent(new r.CustomEvent(yv))}}function FW(e,t=[]){const n=Object.assign({},e);for(const r of t)r in n&&delete n[r];return n}function BW(e,t){const n={};for(const r of t)r in e&&(n[r]=e[r]);return n}var HW=we(In.div),Ht=je((e,t)=>{var n,r;const o=oi("Tooltip",e),s=on(e),i=bd(),{children:l,label:u,shouldWrapChildren:p,"aria-label":m,hasArrow:h,bg:g,portalProps:x,background:y,backgroundColor:b,bgColor:w,motionProps:S,...j}=s,_=(r=(n=y??b)!=null?n:g)!=null?r:w;if(_){o.bg=_;const T=VR(i,"colors",_);o[Nn.arrowBg.var]=T}const E=LW({...j,direction:i.direction}),I=typeof l=="string"||p;let M;if(I)M=a.jsx(we.span,{display:"inline-block",tabIndex:0,...E.getTriggerProps(),children:l});else{const T=d.Children.only(l);M=d.cloneElement(T,E.getTriggerProps(T.props,T.ref))}const R=!!m,D=E.getTooltipProps({},t),A=R?FW(D,["role","id"]):D,O=BW(D,["role","id"]);return u?a.jsxs(a.Fragment,{children:[M,a.jsx(dr,{children:E.isOpen&&a.jsx(Ac,{...x,children:a.jsx(we.div,{...E.getTooltipPositionerProps(),__css:{zIndex:o.zIndex,pointerEvents:"none"},children:a.jsxs(HW,{variants:$W,initial:"exit",animate:"enter",exit:"exit",...S,...A,__css:o,children:[u,R&&a.jsx(we.span,{srOnly:!0,...O,children:m}),h&&a.jsx(we.div,{"data-popper-arrow":!0,className:"chakra-tooltip__arrow-wrapper",children:a.jsx(we.div,{"data-popper-arrow-inner":!0,className:"chakra-tooltip__arrow",__css:{bg:o.bg}})})]})})})})]}):a.jsx(a.Fragment,{children:l})});Ht.displayName="Tooltip";function Jh(e,t={}){let n=d.useCallback(o=>t.keys?n$(e,t.keys,o):e.listen(o),[t.keys,e]),r=e.get.bind(e);return d.useSyncExternalStore(n,r,r)}const VW=le(xe,({system:e})=>{const{consoleLogLevel:t,shouldLogToConsole:n}=e;return{consoleLogLevel:t,shouldLogToConsole:n}},{memoizeOptions:{resultEqualityCheck:Ft}}),pP=e=>{const{consoleLogLevel:t,shouldLogToConsole:n}=W(VW);return d.useEffect(()=>{n?(localStorage.setItem("ROARR_LOG","true"),localStorage.setItem("ROARR_FILTER",`context.logLevel:>=${WR[t]}`)):localStorage.setItem("ROARR_LOG","false"),JC.ROARR.write=UR.createLogWriter()},[t,n]),d.useEffect(()=>{const o={...GR};KR.set(JC.Roarr.child(o))},[]),d.useMemo(()=>el(e),[e])},WW=()=>{const e=te(),t=W(r=>r.system.toastQueue),n=o5();return d.useEffect(()=>{t.forEach(r=>{n(r)}),t.length>0&&e(qR())},[e,n,t]),null},sl=()=>{const e=te();return d.useCallback(n=>e(ct(Qt(n))),[e])},UW=d.memo(WW);var GW=new Map([["aac","audio/aac"],["abw","application/x-abiword"],["arc","application/x-freearc"],["avif","image/avif"],["avi","video/x-msvideo"],["azw","application/vnd.amazon.ebook"],["bin","application/octet-stream"],["bmp","image/bmp"],["bz","application/x-bzip"],["bz2","application/x-bzip2"],["cda","application/x-cdf"],["csh","application/x-csh"],["css","text/css"],["csv","text/csv"],["doc","application/msword"],["docx","application/vnd.openxmlformats-officedocument.wordprocessingml.document"],["eot","application/vnd.ms-fontobject"],["epub","application/epub+zip"],["gz","application/gzip"],["gif","image/gif"],["heic","image/heic"],["heif","image/heif"],["htm","text/html"],["html","text/html"],["ico","image/vnd.microsoft.icon"],["ics","text/calendar"],["jar","application/java-archive"],["jpeg","image/jpeg"],["jpg","image/jpeg"],["js","text/javascript"],["json","application/json"],["jsonld","application/ld+json"],["mid","audio/midi"],["midi","audio/midi"],["mjs","text/javascript"],["mp3","audio/mpeg"],["mp4","video/mp4"],["mpeg","video/mpeg"],["mpkg","application/vnd.apple.installer+xml"],["odp","application/vnd.oasis.opendocument.presentation"],["ods","application/vnd.oasis.opendocument.spreadsheet"],["odt","application/vnd.oasis.opendocument.text"],["oga","audio/ogg"],["ogv","video/ogg"],["ogx","application/ogg"],["opus","audio/opus"],["otf","font/otf"],["png","image/png"],["pdf","application/pdf"],["php","application/x-httpd-php"],["ppt","application/vnd.ms-powerpoint"],["pptx","application/vnd.openxmlformats-officedocument.presentationml.presentation"],["rar","application/vnd.rar"],["rtf","application/rtf"],["sh","application/x-sh"],["svg","image/svg+xml"],["swf","application/x-shockwave-flash"],["tar","application/x-tar"],["tif","image/tiff"],["tiff","image/tiff"],["ts","video/mp2t"],["ttf","font/ttf"],["txt","text/plain"],["vsd","application/vnd.visio"],["wav","audio/wav"],["weba","audio/webm"],["webm","video/webm"],["webp","image/webp"],["woff","font/woff"],["woff2","font/woff2"],["xhtml","application/xhtml+xml"],["xls","application/vnd.ms-excel"],["xlsx","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"],["xml","application/xml"],["xul","application/vnd.mozilla.xul+xml"],["zip","application/zip"],["7z","application/x-7z-compressed"],["mkv","video/x-matroska"],["mov","video/quicktime"],["msg","application/vnd.ms-outlook"]]);function Fd(e,t){var n=KW(e);if(typeof n.path!="string"){var r=e.webkitRelativePath;Object.defineProperty(n,"path",{value:typeof t=="string"?t:typeof r=="string"&&r.length>0?r:e.name,writable:!1,configurable:!1,enumerable:!0})}return n}function KW(e){var t=e.name,n=t&&t.lastIndexOf(".")!==-1;if(n&&!e.type){var r=t.split(".").pop().toLowerCase(),o=GW.get(r);o&&Object.defineProperty(e,"type",{value:o,writable:!1,configurable:!1,enumerable:!0})}return e}var qW=[".DS_Store","Thumbs.db"];function XW(e){return Tc(this,void 0,void 0,function(){return Nc(this,function(t){return um(e)&&QW(e.dataTransfer)?[2,eU(e.dataTransfer,e.type)]:YW(e)?[2,ZW(e)]:Array.isArray(e)&&e.every(function(n){return"getFile"in n&&typeof n.getFile=="function"})?[2,JW(e)]:[2,[]]})})}function QW(e){return um(e)}function YW(e){return um(e)&&um(e.target)}function um(e){return typeof e=="object"&&e!==null}function ZW(e){return U1(e.target.files).map(function(t){return Fd(t)})}function JW(e){return Tc(this,void 0,void 0,function(){var t;return Nc(this,function(n){switch(n.label){case 0:return[4,Promise.all(e.map(function(r){return r.getFile()}))];case 1:return t=n.sent(),[2,t.map(function(r){return Fd(r)})]}})})}function eU(e,t){return Tc(this,void 0,void 0,function(){var n,r;return Nc(this,function(o){switch(o.label){case 0:return e.items?(n=U1(e.items).filter(function(s){return s.kind==="file"}),t!=="drop"?[2,n]:[4,Promise.all(n.map(tU))]):[3,2];case 1:return r=o.sent(),[2,$S(mP(r))];case 2:return[2,$S(U1(e.files).map(function(s){return Fd(s)}))]}})})}function $S(e){return e.filter(function(t){return qW.indexOf(t.name)===-1})}function U1(e){if(e===null)return[];for(var t=[],n=0;nMath.abs(E)?"h":"v";if("touches"in b&&R==="h"&&M.type==="range")return!1;var D=ES(R,M);if(!D)return!0;if(D?I=R:(I=R==="v"?"h":"v",D=ES(R,M)),!D)return!1;if(!r.current&&"changedTouches"in b&&(_||E)&&(r.current=I),!I)return!0;var A=r.current||I;return QH(A,w,b,A==="h"?_:E,!0)},[]),u=d.useCallback(function(b){var w=b;if(!(!Tl.length||Tl[Tl.length-1]!==s)){var S="deltaY"in w?MS(w):rp(w),j=t.current.filter(function(I){return I.name===w.type&&I.target===w.target&&YH(I.delta,S)})[0];if(j&&j.should){w.cancelable&&w.preventDefault();return}if(!j){var _=(i.current.shards||[]).map(OS).filter(Boolean).filter(function(I){return I.contains(w.target)}),E=_.length>0?l(w,_[0]):!i.current.noIsolation;E&&w.cancelable&&w.preventDefault()}}},[]),p=d.useCallback(function(b,w,S,j){var _={name:b,delta:w,target:S,should:j};t.current.push(_),setTimeout(function(){t.current=t.current.filter(function(E){return E!==_})},1)},[]),m=d.useCallback(function(b){n.current=rp(b),r.current=void 0},[]),h=d.useCallback(function(b){p(b.type,MS(b),b.target,l(b,e.lockRef.current))},[]),g=d.useCallback(function(b){p(b.type,rp(b),b.target,l(b,e.lockRef.current))},[]);d.useEffect(function(){return Tl.push(s),e.setCallbacks({onScrollCapture:h,onWheelCapture:h,onTouchMoveCapture:g}),document.addEventListener("wheel",u,Al),document.addEventListener("touchmove",u,Al),document.addEventListener("touchstart",m,Al),function(){Tl=Tl.filter(function(b){return b!==s}),document.removeEventListener("wheel",u,Al),document.removeEventListener("touchmove",u,Al),document.removeEventListener("touchstart",m,Al)}},[]);var x=e.removeScrollBar,y=e.inert;return d.createElement(d.Fragment,null,y?d.createElement(s,{styles:ZH(o)}):null,x?d.createElement(VH,{gapMode:e.gapMode}):null)}const tV=tz(A3,eV);var z3=d.forwardRef(function(e,t){return d.createElement(Nh,gs({},e,{ref:t,sideCar:tV}))});z3.classNames=Nh.classNames;const nV=z3;function rV(e){const{autoFocus:t,trapFocus:n,dialogRef:r,initialFocusRef:o,blockScrollOnMount:s,allowPinchZoom:i,finalFocusRef:l,returnFocusOnClose:u,preserveScrollBarGap:p,lockFocusAcrossFrames:m,isOpen:h}=Gi(),[g,x]=HR();d.useEffect(()=>{!g&&x&&setTimeout(x)},[g,x]);const y=R3(r,h);return a.jsx(i3,{autoFocus:t,isDisabled:!n,initialFocusRef:o,finalFocusRef:l,restoreFocus:u,contentRef:r,lockFocusAcrossFrames:m,children:a.jsx(nV,{removeScrollBar:!p,allowPinchZoom:i,enabled:y===1&&s,forwardProps:!0,children:e.children})})}var qi=ke((e,t)=>{const{className:n,children:r,containerProps:o,motionProps:s,...i}=e,{getDialogProps:l,getDialogContainerProps:u}=Gi(),p=l(i,t),m=u(o),h=Ye("chakra-modal__content",n),g=Lc(),x={display:"flex",flexDirection:"column",position:"relative",width:"100%",outline:0,...g.dialog},y={display:"flex",width:"100vw",height:"$100vh",position:"fixed",left:0,top:0,...g.dialogContainer},{motionPreset:b}=Gi();return a.jsx(rV,{children:a.jsx(we.div,{...m,className:"chakra-modal__content-container",tabIndex:-1,__css:y,children:a.jsx(O3,{preset:b,motionProps:s,className:h,...p,__css:x,children:r})})})});qi.displayName="ModalContent";function Td(e){const{leastDestructiveRef:t,...n}=e;return a.jsx(Ki,{...n,initialFocusRef:t})}var Nd=ke((e,t)=>a.jsx(qi,{ref:t,role:"alertdialog",...e})),Ss=ke((e,t)=>{const{className:n,...r}=e,o=Ye("chakra-modal__footer",n),i={display:"flex",alignItems:"center",justifyContent:"flex-end",...Lc().footer};return a.jsx(we.footer,{ref:t,...r,__css:i,className:o})});Ss.displayName="ModalFooter";var Qo=ke((e,t)=>{const{className:n,...r}=e,{headerId:o,setHeaderMounted:s}=Gi();d.useEffect(()=>(s(!0),()=>s(!1)),[s]);const i=Ye("chakra-modal__header",n),u={flex:0,...Lc().header};return a.jsx(we.header,{ref:t,className:i,id:o,...r,__css:u})});Qo.displayName="ModalHeader";var oV=we(In.div),Yo=ke((e,t)=>{const{className:n,transition:r,motionProps:o,...s}=e,i=Ye("chakra-modal__overlay",n),u={pos:"fixed",left:"0",top:"0",w:"100vw",h:"100vh",...Lc().overlay},{motionPreset:p}=Gi(),h=o||(p==="none"?{}:a5);return a.jsx(oV,{...h,__css:u,ref:t,className:i,...s})});Yo.displayName="ModalOverlay";var Zo=ke((e,t)=>{const{className:n,...r}=e,{bodyId:o,setBodyMounted:s}=Gi();d.useEffect(()=>(s(!0),()=>s(!1)),[s]);const i=Ye("chakra-modal__body",n),l=Lc();return a.jsx(we.div,{ref:t,className:i,id:o,...r,__css:l.body})});Zo.displayName="ModalBody";var $d=ke((e,t)=>{const{onClick:n,className:r,...o}=e,{onClose:s}=Gi(),i=Ye("chakra-modal__close-btn",r),l=Lc();return a.jsx(J_,{ref:t,__css:l.closeButton,className:i,onClick:He(n,u=>{u.stopPropagation(),s()}),...o})});$d.displayName="ModalCloseButton";var sV=e=>a.jsx(Tn,{viewBox:"0 0 24 24",...e,children:a.jsx("path",{fill:"currentColor",d:"M21,5H3C2.621,5,2.275,5.214,2.105,5.553C1.937,5.892,1.973,6.297,2.2,6.6l9,12 c0.188,0.252,0.485,0.4,0.8,0.4s0.611-0.148,0.8-0.4l9-12c0.228-0.303,0.264-0.708,0.095-1.047C21.725,5.214,21.379,5,21,5z"})}),aV=e=>a.jsx(Tn,{viewBox:"0 0 24 24",...e,children:a.jsx("path",{fill:"currentColor",d:"M12.8,5.4c-0.377-0.504-1.223-0.504-1.6,0l-9,12c-0.228,0.303-0.264,0.708-0.095,1.047 C2.275,18.786,2.621,19,3,19h18c0.379,0,0.725-0.214,0.895-0.553c0.169-0.339,0.133-0.744-0.095-1.047L12.8,5.4z"})});function RS(e,t,n,r){d.useEffect(()=>{var o;if(!e.current||!r)return;const s=(o=e.current.ownerDocument.defaultView)!=null?o:window,i=Array.isArray(t)?t:[t],l=new s.MutationObserver(u=>{for(const p of u)p.type==="attributes"&&p.attributeName&&i.includes(p.attributeName)&&n(p)});return l.observe(e.current,{attributes:!0,attributeFilter:i}),()=>l.disconnect()})}function iV(e,t){const n=un(e);d.useEffect(()=>{let r=null;const o=()=>n();return t!==null&&(r=window.setInterval(o,t)),()=>{r&&window.clearInterval(r)}},[t,n])}var lV=50,DS=300;function cV(e,t){const[n,r]=d.useState(!1),[o,s]=d.useState(null),[i,l]=d.useState(!0),u=d.useRef(null),p=()=>clearTimeout(u.current);iV(()=>{o==="increment"&&e(),o==="decrement"&&t()},n?lV:null);const m=d.useCallback(()=>{i&&e(),u.current=setTimeout(()=>{l(!1),r(!0),s("increment")},DS)},[e,i]),h=d.useCallback(()=>{i&&t(),u.current=setTimeout(()=>{l(!1),r(!0),s("decrement")},DS)},[t,i]),g=d.useCallback(()=>{l(!0),r(!1),p()},[]);return d.useEffect(()=>()=>p(),[]),{up:m,down:h,stop:g,isSpinning:n}}var uV=/^[Ee0-9+\-.]$/;function dV(e){return uV.test(e)}function fV(e,t){if(e.key==null)return!0;const n=e.ctrlKey||e.altKey||e.metaKey;return!(e.key.length===1)||n?!0:t(e.key)}function pV(e={}){const{focusInputOnChange:t=!0,clampValueOnBlur:n=!0,keepWithinRange:r=!0,min:o=Number.MIN_SAFE_INTEGER,max:s=Number.MAX_SAFE_INTEGER,step:i=1,isReadOnly:l,isDisabled:u,isRequired:p,isInvalid:m,pattern:h="[0-9]*(.[0-9]+)?",inputMode:g="decimal",allowMouseWheel:x,id:y,onChange:b,precision:w,name:S,"aria-describedby":j,"aria-label":_,"aria-labelledby":E,onFocus:I,onBlur:M,onInvalid:R,getAriaValueText:D,isValidCharacter:A,format:O,parse:T,...X}=e,B=un(I),V=un(M),U=un(R),N=un(A??dV),$=un(D),q=TL(e),{update:F,increment:Q,decrement:Y}=q,[se,ae]=d.useState(!1),re=!(l||u),G=d.useRef(null),K=d.useRef(null),ee=d.useRef(null),le=d.useRef(null),J=d.useCallback(be=>be.split("").filter(N).join(""),[N]),ie=d.useCallback(be=>{var Je;return(Je=T==null?void 0:T(be))!=null?Je:be},[T]),de=d.useCallback(be=>{var Je;return((Je=O==null?void 0:O(be))!=null?Je:be).toString()},[O]);pa(()=>{(q.valueAsNumber>s||q.valueAsNumber{if(!G.current)return;if(G.current.value!=q.value){const Je=ie(G.current.value);q.setValue(J(Je))}},[ie,J]);const ge=d.useCallback((be=i)=>{re&&Q(be)},[Q,re,i]),Ce=d.useCallback((be=i)=>{re&&Y(be)},[Y,re,i]),he=cV(ge,Ce);RS(ee,"disabled",he.stop,he.isSpinning),RS(le,"disabled",he.stop,he.isSpinning);const fe=d.useCallback(be=>{if(be.nativeEvent.isComposing)return;const lt=ie(be.currentTarget.value);F(J(lt)),K.current={start:be.currentTarget.selectionStart,end:be.currentTarget.selectionEnd}},[F,J,ie]),Oe=d.useCallback(be=>{var Je,lt,ft;B==null||B(be),K.current&&(be.target.selectionStart=(lt=K.current.start)!=null?lt:(Je=be.currentTarget.value)==null?void 0:Je.length,be.currentTarget.selectionEnd=(ft=K.current.end)!=null?ft:be.currentTarget.selectionStart)},[B]),_e=d.useCallback(be=>{if(be.nativeEvent.isComposing)return;fV(be,N)||be.preventDefault();const Je=Ne(be)*i,lt=be.key,Me={ArrowUp:()=>ge(Je),ArrowDown:()=>Ce(Je),Home:()=>F(o),End:()=>F(s)}[lt];Me&&(be.preventDefault(),Me(be))},[N,i,ge,Ce,F,o,s]),Ne=be=>{let Je=1;return(be.metaKey||be.ctrlKey)&&(Je=.1),be.shiftKey&&(Je=10),Je},nt=d.useMemo(()=>{const be=$==null?void 0:$(q.value);if(be!=null)return be;const Je=q.value.toString();return Je||void 0},[q.value,$]),$e=d.useCallback(()=>{let be=q.value;if(q.value==="")return;/^[eE]/.test(q.value.toString())?q.setValue(""):(q.valueAsNumbers&&(be=s),q.cast(be))},[q,s,o]),Pt=d.useCallback(()=>{ae(!1),n&&$e()},[n,ae,$e]),Ze=d.useCallback(()=>{t&&requestAnimationFrame(()=>{var be;(be=G.current)==null||be.focus()})},[t]),ot=d.useCallback(be=>{be.preventDefault(),he.up(),Ze()},[Ze,he]),ye=d.useCallback(be=>{be.preventDefault(),he.down(),Ze()},[Ze,he]);Ri(()=>G.current,"wheel",be=>{var Je,lt;const Me=((lt=(Je=G.current)==null?void 0:Je.ownerDocument)!=null?lt:document).activeElement===G.current;if(!x||!Me)return;be.preventDefault();const Le=Ne(be)*i,Ut=Math.sign(be.deltaY);Ut===-1?ge(Le):Ut===1&&Ce(Le)},{passive:!1});const De=d.useCallback((be={},Je=null)=>{const lt=u||r&&q.isAtMax;return{...be,ref:It(Je,ee),role:"button",tabIndex:-1,onPointerDown:He(be.onPointerDown,ft=>{ft.button!==0||lt||ot(ft)}),onPointerLeave:He(be.onPointerLeave,he.stop),onPointerUp:He(be.onPointerUp,he.stop),disabled:lt,"aria-disabled":Co(lt)}},[q.isAtMax,r,ot,he.stop,u]),ut=d.useCallback((be={},Je=null)=>{const lt=u||r&&q.isAtMin;return{...be,ref:It(Je,le),role:"button",tabIndex:-1,onPointerDown:He(be.onPointerDown,ft=>{ft.button!==0||lt||ye(ft)}),onPointerLeave:He(be.onPointerLeave,he.stop),onPointerUp:He(be.onPointerUp,he.stop),disabled:lt,"aria-disabled":Co(lt)}},[q.isAtMin,r,ye,he.stop,u]),bt=d.useCallback((be={},Je=null)=>{var lt,ft,Me,Le;return{name:S,inputMode:g,type:"text",pattern:h,"aria-labelledby":E,"aria-label":_,"aria-describedby":j,id:y,disabled:u,...be,readOnly:(lt=be.readOnly)!=null?lt:l,"aria-readonly":(ft=be.readOnly)!=null?ft:l,"aria-required":(Me=be.required)!=null?Me:p,required:(Le=be.required)!=null?Le:p,ref:It(G,Je),value:de(q.value),role:"spinbutton","aria-valuemin":o,"aria-valuemax":s,"aria-valuenow":Number.isNaN(q.valueAsNumber)?void 0:q.valueAsNumber,"aria-invalid":Co(m??q.isOutOfRange),"aria-valuetext":nt,autoComplete:"off",autoCorrect:"off",onChange:He(be.onChange,fe),onKeyDown:He(be.onKeyDown,_e),onFocus:He(be.onFocus,Oe,()=>ae(!0)),onBlur:He(be.onBlur,V,Pt)}},[S,g,h,E,_,de,j,y,u,p,l,m,q.value,q.valueAsNumber,q.isOutOfRange,o,s,nt,fe,_e,Oe,V,Pt]);return{value:de(q.value),valueAsNumber:q.valueAsNumber,isFocused:se,isDisabled:u,isReadOnly:l,getIncrementButtonProps:De,getDecrementButtonProps:ut,getInputProps:bt,htmlProps:X}}var[mV,$h]=Wt({name:"NumberInputStylesContext",errorMessage:`useNumberInputStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),[hV,Fb]=Wt({name:"NumberInputContext",errorMessage:"useNumberInputContext: `context` is undefined. Seems you forgot to wrap number-input's components within "}),Lh=ke(function(t,n){const r=Un("NumberInput",t),o=on(t),s=fb(o),{htmlProps:i,...l}=pV(s),u=d.useMemo(()=>l,[l]);return a.jsx(hV,{value:u,children:a.jsx(mV,{value:r,children:a.jsx(we.div,{...i,ref:n,className:Ye("chakra-numberinput",t.className),__css:{position:"relative",zIndex:0,...r.root}})})})});Lh.displayName="NumberInput";var zh=ke(function(t,n){const r=$h();return a.jsx(we.div,{"aria-hidden":!0,ref:n,...t,__css:{display:"flex",flexDirection:"column",position:"absolute",top:"0",insetEnd:"0px",margin:"1px",height:"calc(100% - 2px)",zIndex:1,...r.stepperGroup}})});zh.displayName="NumberInputStepper";var Fh=ke(function(t,n){const{getInputProps:r}=Fb(),o=r(t,n),s=$h();return a.jsx(we.input,{...o,className:Ye("chakra-numberinput__field",t.className),__css:{width:"100%",...s.field}})});Fh.displayName="NumberInputField";var F3=we("div",{baseStyle:{display:"flex",justifyContent:"center",alignItems:"center",flex:1,transitionProperty:"common",transitionDuration:"normal",userSelect:"none",cursor:"pointer",lineHeight:"normal"}}),Bh=ke(function(t,n){var r;const o=$h(),{getDecrementButtonProps:s}=Fb(),i=s(t,n);return a.jsx(F3,{...i,__css:o.stepper,children:(r=t.children)!=null?r:a.jsx(sV,{})})});Bh.displayName="NumberDecrementStepper";var Hh=ke(function(t,n){var r;const{getIncrementButtonProps:o}=Fb(),s=o(t,n),i=$h();return a.jsx(F3,{...s,__css:i.stepper,children:(r=t.children)!=null?r:a.jsx(aV,{})})});Hh.displayName="NumberIncrementStepper";var[gV,nl]=Wt({name:"PopoverContext",errorMessage:"usePopoverContext: `context` is undefined. Seems you forgot to wrap all popover components within ``"}),[vV,Vh]=Wt({name:"PopoverStylesContext",errorMessage:`usePopoverStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `});function Wh(e){const t=d.Children.only(e.children),{getTriggerProps:n}=nl();return d.cloneElement(t,n(t.props,t.ref))}Wh.displayName="PopoverTrigger";var Nl={click:"click",hover:"hover"};function xV(e={}){const{closeOnBlur:t=!0,closeOnEsc:n=!0,initialFocusRef:r,id:o,returnFocusOnClose:s=!0,autoFocus:i=!0,arrowSize:l,arrowShadowColor:u,trigger:p=Nl.click,openDelay:m=200,closeDelay:h=200,isLazy:g,lazyBehavior:x="unmount",computePositionOnMount:y,...b}=e,{isOpen:w,onClose:S,onOpen:j,onToggle:_}=Lb(e),E=d.useRef(null),I=d.useRef(null),M=d.useRef(null),R=d.useRef(!1),D=d.useRef(!1);w&&(D.current=!0);const[A,O]=d.useState(!1),[T,X]=d.useState(!1),B=d.useId(),V=o??B,[U,N,$,q]=["popover-trigger","popover-content","popover-header","popover-body"].map(fe=>`${fe}-${V}`),{referenceRef:F,getArrowProps:Q,getPopperProps:Y,getArrowInnerProps:se,forceUpdate:ae}=$b({...b,enabled:w||!!y}),re=I3({isOpen:w,ref:M});y5({enabled:w,ref:I}),g3(M,{focusRef:I,visible:w,shouldFocus:s&&p===Nl.click}),_F(M,{focusRef:r,visible:w,shouldFocus:i&&p===Nl.click});const G=zb({wasSelected:D.current,enabled:g,mode:x,isSelected:re.present}),K=d.useCallback((fe={},Oe=null)=>{const _e={...fe,style:{...fe.style,transformOrigin:Nn.transformOrigin.varRef,[Nn.arrowSize.var]:l?`${l}px`:void 0,[Nn.arrowShadowColor.var]:u},ref:It(M,Oe),children:G?fe.children:null,id:N,tabIndex:-1,role:"dialog",onKeyDown:He(fe.onKeyDown,Ne=>{n&&Ne.key==="Escape"&&S()}),onBlur:He(fe.onBlur,Ne=>{const nt=AS(Ne),$e=gv(M.current,nt),Pt=gv(I.current,nt);w&&t&&(!$e&&!Pt)&&S()}),"aria-labelledby":A?$:void 0,"aria-describedby":T?q:void 0};return p===Nl.hover&&(_e.role="tooltip",_e.onMouseEnter=He(fe.onMouseEnter,()=>{R.current=!0}),_e.onMouseLeave=He(fe.onMouseLeave,Ne=>{Ne.nativeEvent.relatedTarget!==null&&(R.current=!1,setTimeout(()=>S(),h))})),_e},[G,N,A,$,T,q,p,n,S,w,t,h,u,l]),ee=d.useCallback((fe={},Oe=null)=>Y({...fe,style:{visibility:w?"visible":"hidden",...fe.style}},Oe),[w,Y]),le=d.useCallback((fe,Oe=null)=>({...fe,ref:It(Oe,E,F)}),[E,F]),J=d.useRef(),ie=d.useRef(),de=d.useCallback(fe=>{E.current==null&&F(fe)},[F]),ge=d.useCallback((fe={},Oe=null)=>{const _e={...fe,ref:It(I,Oe,de),id:U,"aria-haspopup":"dialog","aria-expanded":w,"aria-controls":N};return p===Nl.click&&(_e.onClick=He(fe.onClick,_)),p===Nl.hover&&(_e.onFocus=He(fe.onFocus,()=>{J.current===void 0&&j()}),_e.onBlur=He(fe.onBlur,Ne=>{const nt=AS(Ne),$e=!gv(M.current,nt);w&&t&&$e&&S()}),_e.onKeyDown=He(fe.onKeyDown,Ne=>{Ne.key==="Escape"&&S()}),_e.onMouseEnter=He(fe.onMouseEnter,()=>{R.current=!0,J.current=window.setTimeout(()=>j(),m)}),_e.onMouseLeave=He(fe.onMouseLeave,()=>{R.current=!1,J.current&&(clearTimeout(J.current),J.current=void 0),ie.current=window.setTimeout(()=>{R.current===!1&&S()},h)})),_e},[U,w,N,p,de,_,j,t,S,m,h]);d.useEffect(()=>()=>{J.current&&clearTimeout(J.current),ie.current&&clearTimeout(ie.current)},[]);const Ce=d.useCallback((fe={},Oe=null)=>({...fe,id:$,ref:It(Oe,_e=>{O(!!_e)})}),[$]),he=d.useCallback((fe={},Oe=null)=>({...fe,id:q,ref:It(Oe,_e=>{X(!!_e)})}),[q]);return{forceUpdate:ae,isOpen:w,onAnimationComplete:re.onComplete,onClose:S,getAnchorProps:le,getArrowProps:Q,getArrowInnerProps:se,getPopoverPositionerProps:ee,getPopoverProps:K,getTriggerProps:ge,getHeaderProps:Ce,getBodyProps:he}}function gv(e,t){return e===t||(e==null?void 0:e.contains(t))}function AS(e){var t;const n=e.currentTarget.ownerDocument.activeElement;return(t=e.relatedTarget)!=null?t:n}function Ld(e){const t=Un("Popover",e),{children:n,...r}=on(e),o=bd(),s=xV({...r,direction:o.direction});return a.jsx(gV,{value:s,children:a.jsx(vV,{value:t,children:zx(n,{isOpen:s.isOpen,onClose:s.onClose,forceUpdate:s.forceUpdate})})})}Ld.displayName="Popover";function B3(e){const t=d.Children.only(e.children),{getAnchorProps:n}=nl();return d.cloneElement(t,n(t.props,t.ref))}B3.displayName="PopoverAnchor";var vv=(e,t)=>t?`${e}.${t}, ${t}`:void 0;function H3(e){var t;const{bg:n,bgColor:r,backgroundColor:o,shadow:s,boxShadow:i,shadowColor:l}=e,{getArrowProps:u,getArrowInnerProps:p}=nl(),m=Vh(),h=(t=n??r)!=null?t:o,g=s??i;return a.jsx(we.div,{...u(),className:"chakra-popover__arrow-positioner",children:a.jsx(we.div,{className:Ye("chakra-popover__arrow",e.className),...p(e),__css:{"--popper-arrow-shadow-color":vv("colors",l),"--popper-arrow-bg":vv("colors",h),"--popper-arrow-shadow":vv("shadows",g),...m.arrow}})})}H3.displayName="PopoverArrow";var Uh=ke(function(t,n){const{getBodyProps:r}=nl(),o=Vh();return a.jsx(we.div,{...r(t,n),className:Ye("chakra-popover__body",t.className),__css:o.body})});Uh.displayName="PopoverBody";var V3=ke(function(t,n){const{onClose:r}=nl(),o=Vh();return a.jsx(J_,{size:"sm",onClick:r,className:Ye("chakra-popover__close-btn",t.className),__css:o.closeButton,ref:n,...t})});V3.displayName="PopoverCloseButton";function bV(e){if(e)return{enter:{...e.enter,visibility:"visible"},exit:{...e.exit,transitionEnd:{visibility:"hidden"}}}}var yV={exit:{opacity:0,scale:.95,transition:{duration:.1,ease:[.4,0,1,1]}},enter:{scale:1,opacity:1,transition:{duration:.15,ease:[0,0,.2,1]}}},CV=we(In.section),W3=ke(function(t,n){const{variants:r=yV,...o}=t,{isOpen:s}=nl();return a.jsx(CV,{ref:n,variants:bV(r),initial:!1,animate:s?"enter":"exit",...o})});W3.displayName="PopoverTransition";var zd=ke(function(t,n){const{rootProps:r,motionProps:o,...s}=t,{getPopoverProps:i,getPopoverPositionerProps:l,onAnimationComplete:u}=nl(),p=Vh(),m={position:"relative",display:"flex",flexDirection:"column",...p.content};return a.jsx(we.div,{...l(r),__css:p.popper,className:"chakra-popover__popper",children:a.jsx(W3,{...o,...i(s,n),onAnimationComplete:ph(u,s.onAnimationComplete),className:Ye("chakra-popover__content",t.className),__css:m})})});zd.displayName="PopoverContent";var F1=e=>a.jsx(we.circle,{cx:50,cy:50,r:42,fill:"transparent",...e});F1.displayName="Circle";function wV(e,t,n){return(e-t)*100/(n-t)}var SV=ma({"0%":{strokeDasharray:"1, 400",strokeDashoffset:"0"},"50%":{strokeDasharray:"400, 400",strokeDashoffset:"-100"},"100%":{strokeDasharray:"400, 400",strokeDashoffset:"-260"}}),kV=ma({"0%":{transform:"rotate(0deg)"},"100%":{transform:"rotate(360deg)"}}),jV=ma({"0%":{left:"-40%"},"100%":{left:"100%"}}),_V=ma({from:{backgroundPosition:"1rem 0"},to:{backgroundPosition:"0 0"}});function U3(e){const{value:t=0,min:n,max:r,valueText:o,getValueText:s,isIndeterminate:i,role:l="progressbar"}=e,u=wV(t,n,r);return{bind:{"data-indeterminate":i?"":void 0,"aria-valuemax":r,"aria-valuemin":n,"aria-valuenow":i?void 0:t,"aria-valuetext":(()=>{if(t!=null)return typeof s=="function"?s(t,u):o})(),role:l},percent:u,value:t}}var G3=e=>{const{size:t,isIndeterminate:n,...r}=e;return a.jsx(we.svg,{viewBox:"0 0 100 100",__css:{width:t,height:t,animation:n?`${kV} 2s linear infinite`:void 0},...r})};G3.displayName="Shape";var B1=ke((e,t)=>{var n;const{size:r="48px",max:o=100,min:s=0,valueText:i,getValueText:l,value:u,capIsRound:p,children:m,thickness:h="10px",color:g="#0078d4",trackColor:x="#edebe9",isIndeterminate:y,...b}=e,w=U3({min:s,max:o,value:u,valueText:i,getValueText:l,isIndeterminate:y}),S=y?void 0:((n=w.percent)!=null?n:0)*2.64,j=S==null?void 0:`${S} ${264-S}`,_=y?{css:{animation:`${SV} 1.5s linear infinite`}}:{strokeDashoffset:66,strokeDasharray:j,transitionProperty:"stroke-dasharray, stroke",transitionDuration:"0.6s",transitionTimingFunction:"ease"},E={display:"inline-block",position:"relative",verticalAlign:"middle",fontSize:r};return a.jsxs(we.div,{ref:t,className:"chakra-progress",...w.bind,...b,__css:E,children:[a.jsxs(G3,{size:r,isIndeterminate:y,children:[a.jsx(F1,{stroke:x,strokeWidth:h,className:"chakra-progress__track"}),a.jsx(F1,{stroke:g,strokeWidth:h,className:"chakra-progress__indicator",strokeLinecap:p?"round":void 0,opacity:w.value===0&&!y?0:void 0,..._})]}),m]})});B1.displayName="CircularProgress";var[IV,PV]=Wt({name:"ProgressStylesContext",errorMessage:`useProgressStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),EV=ke((e,t)=>{const{min:n,max:r,value:o,isIndeterminate:s,role:i,...l}=e,u=U3({value:o,min:n,max:r,isIndeterminate:s,role:i}),m={height:"100%",...PV().filledTrack};return a.jsx(we.div,{ref:t,style:{width:`${u.percent}%`,...l.style},...u.bind,...l,__css:m})}),K3=ke((e,t)=>{var n;const{value:r,min:o=0,max:s=100,hasStripe:i,isAnimated:l,children:u,borderRadius:p,isIndeterminate:m,"aria-label":h,"aria-labelledby":g,"aria-valuetext":x,title:y,role:b,...w}=on(e),S=Un("Progress",e),j=p??((n=S.track)==null?void 0:n.borderRadius),_={animation:`${_V} 1s linear infinite`},M={...!m&&i&&l&&_,...m&&{position:"absolute",willChange:"left",minWidth:"50%",animation:`${jV} 1s ease infinite normal none running`}},R={overflow:"hidden",position:"relative",...S.track};return a.jsx(we.div,{ref:t,borderRadius:j,__css:R,...w,children:a.jsxs(IV,{value:S,children:[a.jsx(EV,{"aria-label":h,"aria-labelledby":g,"aria-valuetext":x,min:o,max:s,value:r,isIndeterminate:m,css:M,borderRadius:j,title:y,role:b}),u]})})});K3.displayName="Progress";function MV(e){return e&&a1(e)&&a1(e.target)}function OV(e={}){const{onChange:t,value:n,defaultValue:r,name:o,isDisabled:s,isFocusable:i,isNative:l,...u}=e,[p,m]=d.useState(r||""),h=typeof n<"u",g=h?n:p,x=d.useRef(null),y=d.useCallback(()=>{const I=x.current;if(!I)return;let M="input:not(:disabled):checked";const R=I.querySelector(M);if(R){R.focus();return}M="input:not(:disabled)";const D=I.querySelector(M);D==null||D.focus()},[]),w=`radio-${d.useId()}`,S=o||w,j=d.useCallback(I=>{const M=MV(I)?I.target.value:I;h||m(M),t==null||t(String(M))},[t,h]),_=d.useCallback((I={},M=null)=>({...I,ref:It(M,x),role:"radiogroup"}),[]),E=d.useCallback((I={},M=null)=>({...I,ref:M,name:S,[l?"checked":"isChecked"]:g!=null?I.value===g:void 0,onChange(D){j(D)},"data-radiogroup":!0}),[l,S,j,g]);return{getRootProps:_,getRadioProps:E,name:S,ref:x,focus:y,setValue:m,value:g,onChange:j,isDisabled:s,isFocusable:i,htmlProps:u}}var[RV,q3]=Wt({name:"RadioGroupContext",strict:!1}),cm=ke((e,t)=>{const{colorScheme:n,size:r,variant:o,children:s,className:i,isDisabled:l,isFocusable:u,...p}=e,{value:m,onChange:h,getRootProps:g,name:x,htmlProps:y}=OV(p),b=d.useMemo(()=>({name:x,size:r,onChange:h,colorScheme:n,value:m,variant:o,isDisabled:l,isFocusable:u}),[x,r,h,n,m,o,l,u]);return a.jsx(RV,{value:b,children:a.jsx(we.div,{...g(y,t),className:Ye("chakra-radio-group",i),children:s})})});cm.displayName="RadioGroup";var DV={border:"0",clip:"rect(0, 0, 0, 0)",height:"1px",width:"1px",margin:"-1px",padding:"0",overflow:"hidden",whiteSpace:"nowrap",position:"absolute"};function AV(e={}){const{defaultChecked:t,isChecked:n,isFocusable:r,isDisabled:o,isReadOnly:s,isRequired:i,onChange:l,isInvalid:u,name:p,value:m,id:h,"data-radiogroup":g,"aria-describedby":x,...y}=e,b=`radio-${d.useId()}`,w=Pd(),j=!!q3()||!!g;let E=!!w&&!j?w.id:b;E=h??E;const I=o??(w==null?void 0:w.isDisabled),M=s??(w==null?void 0:w.isReadOnly),R=i??(w==null?void 0:w.isRequired),D=u??(w==null?void 0:w.isInvalid),[A,O]=d.useState(!1),[T,X]=d.useState(!1),[B,V]=d.useState(!1),[U,N]=d.useState(!1),[$,q]=d.useState(!!t),F=typeof n<"u",Q=F?n:$;d.useEffect(()=>p5(O),[]);const Y=d.useCallback(de=>{if(M||I){de.preventDefault();return}F||q(de.target.checked),l==null||l(de)},[F,I,M,l]),se=d.useCallback(de=>{de.key===" "&&N(!0)},[N]),ae=d.useCallback(de=>{de.key===" "&&N(!1)},[N]),re=d.useCallback((de={},ge=null)=>({...de,ref:ge,"data-active":dt(U),"data-hover":dt(B),"data-disabled":dt(I),"data-invalid":dt(D),"data-checked":dt(Q),"data-focus":dt(T),"data-focus-visible":dt(T&&A),"data-readonly":dt(M),"aria-hidden":!0,onMouseDown:He(de.onMouseDown,()=>N(!0)),onMouseUp:He(de.onMouseUp,()=>N(!1)),onMouseEnter:He(de.onMouseEnter,()=>V(!0)),onMouseLeave:He(de.onMouseLeave,()=>V(!1))}),[U,B,I,D,Q,T,M,A]),{onFocus:G,onBlur:K}=w??{},ee=d.useCallback((de={},ge=null)=>{const Ce=I&&!r;return{...de,id:E,ref:ge,type:"radio",name:p,value:m,onChange:He(de.onChange,Y),onBlur:He(K,de.onBlur,()=>X(!1)),onFocus:He(G,de.onFocus,()=>X(!0)),onKeyDown:He(de.onKeyDown,se),onKeyUp:He(de.onKeyUp,ae),checked:Q,disabled:Ce,readOnly:M,required:R,"aria-invalid":Co(D),"aria-disabled":Co(Ce),"aria-required":Co(R),"data-readonly":dt(M),"aria-describedby":x,style:DV}},[I,r,E,p,m,Y,K,G,se,ae,Q,M,R,D,x]);return{state:{isInvalid:D,isFocused:T,isChecked:Q,isActive:U,isHovered:B,isDisabled:I,isReadOnly:M,isRequired:R},getCheckboxProps:re,getRadioProps:re,getInputProps:ee,getLabelProps:(de={},ge=null)=>({...de,ref:ge,onMouseDown:He(de.onMouseDown,TV),"data-disabled":dt(I),"data-checked":dt(Q),"data-invalid":dt(D)}),getRootProps:(de,ge=null)=>({...de,ref:ge,"data-disabled":dt(I),"data-checked":dt(Q),"data-invalid":dt(D)}),htmlProps:y}}function TV(e){e.preventDefault(),e.stopPropagation()}function NV(e,t){const n={},r={};for(const[o,s]of Object.entries(e))t.includes(o)?n[o]=s:r[o]=s;return[n,r]}var Ks=ke((e,t)=>{var n;const r=q3(),{onChange:o,value:s}=e,i=Un("Radio",{...r,...e}),l=on(e),{spacing:u="0.5rem",children:p,isDisabled:m=r==null?void 0:r.isDisabled,isFocusable:h=r==null?void 0:r.isFocusable,inputProps:g,...x}=l;let y=e.isChecked;(r==null?void 0:r.value)!=null&&s!=null&&(y=r.value===s);let b=o;r!=null&&r.onChange&&s!=null&&(b=ph(r.onChange,o));const w=(n=e==null?void 0:e.name)!=null?n:r==null?void 0:r.name,{getInputProps:S,getCheckboxProps:j,getLabelProps:_,getRootProps:E,htmlProps:I}=AV({...x,isChecked:y,isFocusable:h,isDisabled:m,onChange:b,name:w}),[M,R]=NV(I,eI),D=j(R),A=S(g,t),O=_(),T=Object.assign({},M,E()),X={display:"inline-flex",alignItems:"center",verticalAlign:"top",cursor:"pointer",position:"relative",...i.container},B={display:"inline-flex",alignItems:"center",justifyContent:"center",flexShrink:0,...i.control},V={userSelect:"none",marginStart:u,...i.label};return a.jsxs(we.label,{className:"chakra-radio",...T,__css:X,children:[a.jsx("input",{className:"chakra-radio__input",...A}),a.jsx(we.span,{className:"chakra-radio__control",...D,__css:B}),p&&a.jsx(we.span,{className:"chakra-radio__label",...O,__css:V,children:p})]})});Ks.displayName="Radio";var X3=ke(function(t,n){const{children:r,placeholder:o,className:s,...i}=t;return a.jsxs(we.select,{...i,ref:n,className:Ye("chakra-select",s),children:[o&&a.jsx("option",{value:"",children:o}),r]})});X3.displayName="SelectField";function $V(e,t){const n={},r={};for(const[o,s]of Object.entries(e))t.includes(o)?n[o]=s:r[o]=s;return[n,r]}var Q3=ke((e,t)=>{var n;const r=Un("Select",e),{rootProps:o,placeholder:s,icon:i,color:l,height:u,h:p,minH:m,minHeight:h,iconColor:g,iconSize:x,...y}=on(e),[b,w]=$V(y,eI),S=db(w),j={width:"100%",height:"fit-content",position:"relative",color:l},_={paddingEnd:"2rem",...r.field,_focus:{zIndex:"unset",...(n=r.field)==null?void 0:n._focus}};return a.jsxs(we.div,{className:"chakra-select__wrapper",__css:j,...b,...o,children:[a.jsx(X3,{ref:t,height:p??u,minH:m??h,placeholder:s,...S,__css:_,children:e.children}),a.jsx(Y3,{"data-disabled":dt(S.disabled),...(g||l)&&{color:g||l},__css:r.icon,...x&&{fontSize:x},children:i})]})});Q3.displayName="Select";var LV=e=>a.jsx("svg",{viewBox:"0 0 24 24",...e,children:a.jsx("path",{fill:"currentColor",d:"M16.59 8.59L12 13.17 7.41 8.59 6 10l6 6 6-6z"})}),zV=we("div",{baseStyle:{position:"absolute",display:"inline-flex",alignItems:"center",justifyContent:"center",pointerEvents:"none",top:"50%",transform:"translateY(-50%)"}}),Y3=e=>{const{children:t=a.jsx(LV,{}),...n}=e,r=d.cloneElement(t,{role:"presentation",className:"chakra-select__icon",focusable:!1,"aria-hidden":!0,style:{width:"1em",height:"1em",color:"currentColor"}});return a.jsx(zV,{...n,className:"chakra-select__icon-wrapper",children:d.isValidElement(t)?r:null})};Y3.displayName="SelectIcon";function FV(){const e=d.useRef(!0);return d.useEffect(()=>{e.current=!1},[]),e.current}function BV(e){const t=d.useRef();return d.useEffect(()=>{t.current=e},[e]),t.current}var HV=we("div",{baseStyle:{boxShadow:"none",backgroundClip:"padding-box",cursor:"default",color:"transparent",pointerEvents:"none",userSelect:"none","&::before, &::after, *":{visibility:"hidden"}}}),H1=tI("skeleton-start-color"),V1=tI("skeleton-end-color"),VV=ma({from:{opacity:0},to:{opacity:1}}),WV=ma({from:{borderColor:H1.reference,background:H1.reference},to:{borderColor:V1.reference,background:V1.reference}}),Gh=ke((e,t)=>{const n={...e,fadeDuration:typeof e.fadeDuration=="number"?e.fadeDuration:.4,speed:typeof e.speed=="number"?e.speed:.8},r=oi("Skeleton",n),o=FV(),{startColor:s="",endColor:i="",isLoaded:l,fadeDuration:u,speed:p,className:m,fitContent:h,...g}=on(n),[x,y]=Ho("colors",[s,i]),b=BV(l),w=Ye("chakra-skeleton",m),S={...x&&{[H1.variable]:x},...y&&{[V1.variable]:y}};if(l){const j=o||b?"none":`${VV} ${u}s`;return a.jsx(we.div,{ref:t,className:w,__css:{animation:j},...g})}return a.jsx(HV,{ref:t,className:w,...g,__css:{width:h?"fit-content":void 0,...r,...S,_dark:{...r._dark,...S},animation:`${p}s linear infinite alternate ${WV}`}})});Gh.displayName="Skeleton";var ho=e=>e?"":void 0,uc=e=>e?!0:void 0,ai=(...e)=>e.filter(Boolean).join(" ");function dc(...e){return function(n){e.some(r=>(r==null||r(n),n==null?void 0:n.defaultPrevented))}}function UV(e){return{root:`slider-root-${e}`,getThumb:t=>`slider-thumb-${e}-${t}`,getInput:t=>`slider-input-${e}-${t}`,track:`slider-track-${e}`,innerTrack:`slider-filled-track-${e}`,getMarker:t=>`slider-marker-${e}-${t}`,output:`slider-output-${e}`}}function Ru(e){const{orientation:t,vertical:n,horizontal:r}=e;return t==="vertical"?n:r}var zp={width:0,height:0},op=e=>e||zp;function Z3(e){const{orientation:t,thumbPercents:n,thumbRects:r,isReversed:o}=e,s=b=>{var w;const S=(w=r[b])!=null?w:zp;return{position:"absolute",userSelect:"none",WebkitUserSelect:"none",MozUserSelect:"none",msUserSelect:"none",touchAction:"none",...Ru({orientation:t,vertical:{bottom:`calc(${n[b]}% - ${S.height/2}px)`},horizontal:{left:`calc(${n[b]}% - ${S.width/2}px)`}})}},i=t==="vertical"?r.reduce((b,w)=>op(b).height>op(w).height?b:w,zp):r.reduce((b,w)=>op(b).width>op(w).width?b:w,zp),l={position:"relative",touchAction:"none",WebkitTapHighlightColor:"rgba(0,0,0,0)",userSelect:"none",outline:0,...Ru({orientation:t,vertical:i?{paddingLeft:i.width/2,paddingRight:i.width/2}:{},horizontal:i?{paddingTop:i.height/2,paddingBottom:i.height/2}:{}})},u={position:"absolute",...Ru({orientation:t,vertical:{left:"50%",transform:"translateX(-50%)",height:"100%"},horizontal:{top:"50%",transform:"translateY(-50%)",width:"100%"}})},p=n.length===1,m=[0,o?100-n[0]:n[0]],h=p?m:n;let g=h[0];!p&&o&&(g=100-g);const x=Math.abs(h[h.length-1]-h[0]),y={...u,...Ru({orientation:t,vertical:o?{height:`${x}%`,top:`${g}%`}:{height:`${x}%`,bottom:`${g}%`},horizontal:o?{width:`${x}%`,right:`${g}%`}:{width:`${x}%`,left:`${g}%`}})};return{trackStyle:u,innerTrackStyle:y,rootStyle:l,getThumbStyle:s}}function J3(e){const{isReversed:t,direction:n,orientation:r}=e;return n==="ltr"||r==="vertical"?t:!t}function GV(e,t,n,r){return e.addEventListener(t,n,r),()=>{e.removeEventListener(t,n,r)}}function KV(e){const t=XV(e);return typeof t.PointerEvent<"u"&&e instanceof t.PointerEvent?e.pointerType==="mouse":e instanceof t.MouseEvent}function eP(e){return!!e.touches}function qV(e){return eP(e)&&e.touches.length>1}function XV(e){var t;return(t=e.view)!=null?t:window}function QV(e,t="page"){const n=e.touches[0]||e.changedTouches[0];return{x:n[`${t}X`],y:n[`${t}Y`]}}function YV(e,t="page"){return{x:e[`${t}X`],y:e[`${t}Y`]}}function tP(e,t="page"){return eP(e)?QV(e,t):YV(e,t)}function ZV(e){return t=>{const n=KV(t);(!n||n&&t.button===0)&&e(t)}}function JV(e,t=!1){function n(o){e(o,{point:tP(o)})}return t?ZV(n):n}function Fp(e,t,n,r){return GV(e,t,JV(n,t==="pointerdown"),r)}var eW=Object.defineProperty,tW=(e,t,n)=>t in e?eW(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,$o=(e,t,n)=>(tW(e,typeof t!="symbol"?t+"":t,n),n),nW=class{constructor(e,t,n){$o(this,"history",[]),$o(this,"startEvent",null),$o(this,"lastEvent",null),$o(this,"lastEventInfo",null),$o(this,"handlers",{}),$o(this,"removeListeners",()=>{}),$o(this,"threshold",3),$o(this,"win"),$o(this,"updatePoint",()=>{if(!(this.lastEvent&&this.lastEventInfo))return;const l=xv(this.lastEventInfo,this.history),u=this.startEvent!==null,p=aW(l.offset,{x:0,y:0})>=this.threshold;if(!u&&!p)return;const{timestamp:m}=Qw();this.history.push({...l.point,timestamp:m});const{onStart:h,onMove:g}=this.handlers;u||(h==null||h(this.lastEvent,l),this.startEvent=this.lastEvent),g==null||g(this.lastEvent,l)}),$o(this,"onPointerMove",(l,u)=>{this.lastEvent=l,this.lastEventInfo=u,_$.update(this.updatePoint,!0)}),$o(this,"onPointerUp",(l,u)=>{const p=xv(u,this.history),{onEnd:m,onSessionEnd:h}=this.handlers;h==null||h(l,p),this.end(),!(!m||!this.startEvent)&&(m==null||m(l,p))});var r;if(this.win=(r=e.view)!=null?r:window,qV(e))return;this.handlers=t,n&&(this.threshold=n),e.stopPropagation(),e.preventDefault();const o={point:tP(e)},{timestamp:s}=Qw();this.history=[{...o.point,timestamp:s}];const{onSessionStart:i}=t;i==null||i(e,xv(o,this.history)),this.removeListeners=sW(Fp(this.win,"pointermove",this.onPointerMove),Fp(this.win,"pointerup",this.onPointerUp),Fp(this.win,"pointercancel",this.onPointerUp))}updateHandlers(e){this.handlers=e}end(){var e;(e=this.removeListeners)==null||e.call(this),I$.update(this.updatePoint)}};function TS(e,t){return{x:e.x-t.x,y:e.y-t.y}}function xv(e,t){return{point:e.point,delta:TS(e.point,t[t.length-1]),offset:TS(e.point,t[0]),velocity:oW(t,.1)}}var rW=e=>e*1e3;function oW(e,t){if(e.length<2)return{x:0,y:0};let n=e.length-1,r=null;const o=e[e.length-1];for(;n>=0&&(r=e[n],!(o.timestamp-r.timestamp>rW(t)));)n--;if(!r)return{x:0,y:0};const s=(o.timestamp-r.timestamp)/1e3;if(s===0)return{x:0,y:0};const i={x:(o.x-r.x)/s,y:(o.y-r.y)/s};return i.x===1/0&&(i.x=0),i.y===1/0&&(i.y=0),i}function sW(...e){return t=>e.reduce((n,r)=>r(n),t)}function bv(e,t){return Math.abs(e-t)}function NS(e){return"x"in e&&"y"in e}function aW(e,t){if(typeof e=="number"&&typeof t=="number")return bv(e,t);if(NS(e)&&NS(t)){const n=bv(e.x,t.x),r=bv(e.y,t.y);return Math.sqrt(n**2+r**2)}return 0}function nP(e){const t=d.useRef(null);return t.current=e,t}function rP(e,t){const{onPan:n,onPanStart:r,onPanEnd:o,onPanSessionStart:s,onPanSessionEnd:i,threshold:l}=t,u=!!(n||r||o||s||i),p=d.useRef(null),m=nP({onSessionStart:s,onSessionEnd:i,onStart:r,onMove:n,onEnd(h,g){p.current=null,o==null||o(h,g)}});d.useEffect(()=>{var h;(h=p.current)==null||h.updateHandlers(m.current)}),d.useEffect(()=>{const h=e.current;if(!h||!u)return;function g(x){p.current=new nW(x,m.current,l)}return Fp(h,"pointerdown",g)},[e,u,m,l]),d.useEffect(()=>()=>{var h;(h=p.current)==null||h.end(),p.current=null},[])}function iW(e,t){if(!e){t(void 0);return}t({width:e.offsetWidth,height:e.offsetHeight});const n=e.ownerDocument.defaultView??window,r=new n.ResizeObserver(o=>{if(!Array.isArray(o)||!o.length)return;const[s]=o;let i,l;if("borderBoxSize"in s){const u=s.borderBoxSize,p=Array.isArray(u)?u[0]:u;i=p.inlineSize,l=p.blockSize}else i=e.offsetWidth,l=e.offsetHeight;t({width:i,height:l})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}var lW=globalThis!=null&&globalThis.document?d.useLayoutEffect:d.useEffect;function cW(e,t){var n,r;if(!e||!e.parentElement)return;const o=(r=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?r:window,s=new o.MutationObserver(()=>{t()});return s.observe(e.parentElement,{childList:!0}),()=>{s.disconnect()}}function oP({getNodes:e,observeMutation:t=!0}){const[n,r]=d.useState([]),[o,s]=d.useState(0);return lW(()=>{const i=e(),l=i.map((u,p)=>iW(u,m=>{r(h=>[...h.slice(0,p),m,...h.slice(p+1)])}));if(t){const u=i[0];l.push(cW(u,()=>{s(p=>p+1)}))}return()=>{l.forEach(u=>{u==null||u()})}},[o]),n}function uW(e){return typeof e=="object"&&e!==null&&"current"in e}function dW(e){const[t]=oP({observeMutation:!1,getNodes(){return[uW(e)?e.current:e]}});return t}function fW(e){const{min:t=0,max:n=100,onChange:r,value:o,defaultValue:s,isReversed:i,direction:l="ltr",orientation:u="horizontal",id:p,isDisabled:m,isReadOnly:h,onChangeStart:g,onChangeEnd:x,step:y=1,getAriaValueText:b,"aria-valuetext":w,"aria-label":S,"aria-labelledby":j,name:_,focusThumbOnChange:E=!0,minStepsBetweenThumbs:I=0,...M}=e,R=un(g),D=un(x),A=un(b),O=J3({isReversed:i,direction:l,orientation:u}),[T,X]=_d({value:o,defaultValue:s??[25,75],onChange:r});if(!Array.isArray(T))throw new TypeError(`[range-slider] You passed an invalid value for \`value\` or \`defaultValue\`, expected \`Array\` but got \`${typeof T}\``);const[B,V]=d.useState(!1),[U,N]=d.useState(!1),[$,q]=d.useState(-1),F=!(m||h),Q=d.useRef(T),Y=T.map(Se=>ac(Se,t,n)),se=I*y,ae=pW(Y,t,n,se),re=d.useRef({eventSource:null,value:[],valueBounds:[]});re.current.value=Y,re.current.valueBounds=ae;const G=Y.map(Se=>n-Se+t),ee=(O?G:Y).map(Se=>om(Se,t,n)),le=u==="vertical",J=d.useRef(null),ie=d.useRef(null),de=oP({getNodes(){const Se=ie.current,Be=Se==null?void 0:Se.querySelectorAll("[role=slider]");return Be?Array.from(Be):[]}}),ge=d.useId(),he=UV(p??ge),fe=d.useCallback(Se=>{var Be,ze;if(!J.current)return;re.current.eventSource="pointer";const Ge=J.current.getBoundingClientRect(),{clientX:pt,clientY:Pn}=(ze=(Be=Se.touches)==null?void 0:Be[0])!=null?ze:Se,Dt=le?Ge.bottom-Pn:pt-Ge.left,At=le?Ge.height:Ge.width;let pr=Dt/At;return O&&(pr=1-pr),h5(pr,t,n)},[le,O,n,t]),Oe=(n-t)/10,_e=y||(n-t)/100,Ne=d.useMemo(()=>({setValueAtIndex(Se,Be){if(!F)return;const ze=re.current.valueBounds[Se];Be=parseFloat(P1(Be,ze.min,_e)),Be=ac(Be,ze.min,ze.max);const Ge=[...re.current.value];Ge[Se]=Be,X(Ge)},setActiveIndex:q,stepUp(Se,Be=_e){const ze=re.current.value[Se],Ge=O?ze-Be:ze+Be;Ne.setValueAtIndex(Se,Ge)},stepDown(Se,Be=_e){const ze=re.current.value[Se],Ge=O?ze+Be:ze-Be;Ne.setValueAtIndex(Se,Ge)},reset(){X(Q.current)}}),[_e,O,X,F]),nt=d.useCallback(Se=>{const Be=Se.key,Ge={ArrowRight:()=>Ne.stepUp($),ArrowUp:()=>Ne.stepUp($),ArrowLeft:()=>Ne.stepDown($),ArrowDown:()=>Ne.stepDown($),PageUp:()=>Ne.stepUp($,Oe),PageDown:()=>Ne.stepDown($,Oe),Home:()=>{const{min:pt}=ae[$];Ne.setValueAtIndex($,pt)},End:()=>{const{max:pt}=ae[$];Ne.setValueAtIndex($,pt)}}[Be];Ge&&(Se.preventDefault(),Se.stopPropagation(),Ge(Se),re.current.eventSource="keyboard")},[Ne,$,Oe,ae]),{getThumbStyle:$e,rootStyle:Pt,trackStyle:Ze,innerTrackStyle:ot}=d.useMemo(()=>Z3({isReversed:O,orientation:u,thumbRects:de,thumbPercents:ee}),[O,u,ee,de]),ye=d.useCallback(Se=>{var Be;const ze=Se??$;if(ze!==-1&&E){const Ge=he.getThumb(ze),pt=(Be=ie.current)==null?void 0:Be.ownerDocument.getElementById(Ge);pt&&setTimeout(()=>pt.focus())}},[E,$,he]);pa(()=>{re.current.eventSource==="keyboard"&&(D==null||D(re.current.value))},[Y,D]);const De=Se=>{const Be=fe(Se)||0,ze=re.current.value.map(At=>Math.abs(At-Be)),Ge=Math.min(...ze);let pt=ze.indexOf(Ge);const Pn=ze.filter(At=>At===Ge);Pn.length>1&&Be>re.current.value[pt]&&(pt=pt+Pn.length-1),q(pt),Ne.setValueAtIndex(pt,Be),ye(pt)},ut=Se=>{if($==-1)return;const Be=fe(Se)||0;q($),Ne.setValueAtIndex($,Be),ye($)};rP(ie,{onPanSessionStart(Se){F&&(V(!0),De(Se),R==null||R(re.current.value))},onPanSessionEnd(){F&&(V(!1),D==null||D(re.current.value))},onPan(Se){F&&ut(Se)}});const bt=d.useCallback((Se={},Be=null)=>({...Se,...M,id:he.root,ref:It(Be,ie),tabIndex:-1,"aria-disabled":uc(m),"data-focused":ho(U),style:{...Se.style,...Pt}}),[M,m,U,Pt,he]),be=d.useCallback((Se={},Be=null)=>({...Se,ref:It(Be,J),id:he.track,"data-disabled":ho(m),style:{...Se.style,...Ze}}),[m,Ze,he]),Je=d.useCallback((Se={},Be=null)=>({...Se,ref:Be,id:he.innerTrack,style:{...Se.style,...ot}}),[ot,he]),lt=d.useCallback((Se,Be=null)=>{var ze;const{index:Ge,...pt}=Se,Pn=Y[Ge];if(Pn==null)throw new TypeError(`[range-slider > thumb] Cannot find value at index \`${Ge}\`. The \`value\` or \`defaultValue\` length is : ${Y.length}`);const Dt=ae[Ge];return{...pt,ref:Be,role:"slider",tabIndex:F?0:void 0,id:he.getThumb(Ge),"data-active":ho(B&&$===Ge),"aria-valuetext":(ze=A==null?void 0:A(Pn))!=null?ze:w==null?void 0:w[Ge],"aria-valuemin":Dt.min,"aria-valuemax":Dt.max,"aria-valuenow":Pn,"aria-orientation":u,"aria-disabled":uc(m),"aria-readonly":uc(h),"aria-label":S==null?void 0:S[Ge],"aria-labelledby":S!=null&&S[Ge]||j==null?void 0:j[Ge],style:{...Se.style,...$e(Ge)},onKeyDown:dc(Se.onKeyDown,nt),onFocus:dc(Se.onFocus,()=>{N(!0),q(Ge)}),onBlur:dc(Se.onBlur,()=>{N(!1),q(-1)})}},[he,Y,ae,F,B,$,A,w,u,m,h,S,j,$e,nt,N]),ft=d.useCallback((Se={},Be=null)=>({...Se,ref:Be,id:he.output,htmlFor:Y.map((ze,Ge)=>he.getThumb(Ge)).join(" "),"aria-live":"off"}),[he,Y]),Me=d.useCallback((Se,Be=null)=>{const{value:ze,...Ge}=Se,pt=!(zen),Pn=ze>=Y[0]&&ze<=Y[Y.length-1];let Dt=om(ze,t,n);Dt=O?100-Dt:Dt;const At={position:"absolute",pointerEvents:"none",...Ru({orientation:u,vertical:{bottom:`${Dt}%`},horizontal:{left:`${Dt}%`}})};return{...Ge,ref:Be,id:he.getMarker(Se.value),role:"presentation","aria-hidden":!0,"data-disabled":ho(m),"data-invalid":ho(!pt),"data-highlighted":ho(Pn),style:{...Se.style,...At}}},[m,O,n,t,u,Y,he]),Le=d.useCallback((Se,Be=null)=>{const{index:ze,...Ge}=Se;return{...Ge,ref:Be,id:he.getInput(ze),type:"hidden",value:Y[ze],name:Array.isArray(_)?_[ze]:`${_}-${ze}`}},[_,Y,he]);return{state:{value:Y,isFocused:U,isDragging:B,getThumbPercent:Se=>ee[Se],getThumbMinValue:Se=>ae[Se].min,getThumbMaxValue:Se=>ae[Se].max},actions:Ne,getRootProps:bt,getTrackProps:be,getInnerTrackProps:Je,getThumbProps:lt,getMarkerProps:Me,getInputProps:Le,getOutputProps:ft}}function pW(e,t,n,r){return e.map((o,s)=>{const i=s===0?t:e[s-1]+r,l=s===e.length-1?n:e[s+1]-r;return{min:i,max:l}})}var[mW,Kh]=Wt({name:"SliderContext",errorMessage:"useSliderContext: `context` is undefined. Seems you forgot to wrap all slider components within "}),[hW,qh]=Wt({name:"RangeSliderStylesContext",errorMessage:`useRangeSliderStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),Bb=ke(function(t,n){const r={orientation:"horizontal",...t},o=Un("Slider",r),s=on(r),{direction:i}=bd();s.direction=i;const{getRootProps:l,...u}=fW(s),p=d.useMemo(()=>({...u,name:r.name}),[u,r.name]);return a.jsx(mW,{value:p,children:a.jsx(hW,{value:o,children:a.jsx(we.div,{...l({},n),className:"chakra-slider",__css:o.container,children:r.children})})})});Bb.displayName="RangeSlider";var nd=ke(function(t,n){const{getThumbProps:r,getInputProps:o,name:s}=Kh(),i=qh(),l=r(t,n);return a.jsxs(we.div,{...l,className:ai("chakra-slider__thumb",t.className),__css:i.thumb,children:[l.children,s&&a.jsx("input",{...o({index:t.index})})]})});nd.displayName="RangeSliderThumb";var Hb=ke(function(t,n){const{getTrackProps:r}=Kh(),o=qh(),s=r(t,n);return a.jsx(we.div,{...s,className:ai("chakra-slider__track",t.className),__css:o.track,"data-testid":"chakra-range-slider-track"})});Hb.displayName="RangeSliderTrack";var Vb=ke(function(t,n){const{getInnerTrackProps:r}=Kh(),o=qh(),s=r(t,n);return a.jsx(we.div,{...s,className:"chakra-slider__filled-track",__css:o.filledTrack})});Vb.displayName="RangeSliderFilledTrack";var Ai=ke(function(t,n){const{getMarkerProps:r}=Kh(),o=qh(),s=r(t,n);return a.jsx(we.div,{...s,className:ai("chakra-slider__marker",t.className),__css:o.mark})});Ai.displayName="RangeSliderMark";function gW(e){var t;const{min:n=0,max:r=100,onChange:o,value:s,defaultValue:i,isReversed:l,direction:u="ltr",orientation:p="horizontal",id:m,isDisabled:h,isReadOnly:g,onChangeStart:x,onChangeEnd:y,step:b=1,getAriaValueText:w,"aria-valuetext":S,"aria-label":j,"aria-labelledby":_,name:E,focusThumbOnChange:I=!0,...M}=e,R=un(x),D=un(y),A=un(w),O=J3({isReversed:l,direction:u,orientation:p}),[T,X]=_d({value:s,defaultValue:i??xW(n,r),onChange:o}),[B,V]=d.useState(!1),[U,N]=d.useState(!1),$=!(h||g),q=(r-n)/10,F=b||(r-n)/100,Q=ac(T,n,r),Y=r-Q+n,ae=om(O?Y:Q,n,r),re=p==="vertical",G=nP({min:n,max:r,step:b,isDisabled:h,value:Q,isInteractive:$,isReversed:O,isVertical:re,eventSource:null,focusThumbOnChange:I,orientation:p}),K=d.useRef(null),ee=d.useRef(null),le=d.useRef(null),J=d.useId(),ie=m??J,[de,ge]=[`slider-thumb-${ie}`,`slider-track-${ie}`],Ce=d.useCallback(Me=>{var Le,Ut;if(!K.current)return;const Se=G.current;Se.eventSource="pointer";const Be=K.current.getBoundingClientRect(),{clientX:ze,clientY:Ge}=(Ut=(Le=Me.touches)==null?void 0:Le[0])!=null?Ut:Me,pt=re?Be.bottom-Ge:ze-Be.left,Pn=re?Be.height:Be.width;let Dt=pt/Pn;O&&(Dt=1-Dt);let At=h5(Dt,Se.min,Se.max);return Se.step&&(At=parseFloat(P1(At,Se.min,Se.step))),At=ac(At,Se.min,Se.max),At},[re,O,G]),he=d.useCallback(Me=>{const Le=G.current;Le.isInteractive&&(Me=parseFloat(P1(Me,Le.min,F)),Me=ac(Me,Le.min,Le.max),X(Me))},[F,X,G]),fe=d.useMemo(()=>({stepUp(Me=F){const Le=O?Q-Me:Q+Me;he(Le)},stepDown(Me=F){const Le=O?Q+Me:Q-Me;he(Le)},reset(){he(i||0)},stepTo(Me){he(Me)}}),[he,O,Q,F,i]),Oe=d.useCallback(Me=>{const Le=G.current,Se={ArrowRight:()=>fe.stepUp(),ArrowUp:()=>fe.stepUp(),ArrowLeft:()=>fe.stepDown(),ArrowDown:()=>fe.stepDown(),PageUp:()=>fe.stepUp(q),PageDown:()=>fe.stepDown(q),Home:()=>he(Le.min),End:()=>he(Le.max)}[Me.key];Se&&(Me.preventDefault(),Me.stopPropagation(),Se(Me),Le.eventSource="keyboard")},[fe,he,q,G]),_e=(t=A==null?void 0:A(Q))!=null?t:S,Ne=dW(ee),{getThumbStyle:nt,rootStyle:$e,trackStyle:Pt,innerTrackStyle:Ze}=d.useMemo(()=>{const Me=G.current,Le=Ne??{width:0,height:0};return Z3({isReversed:O,orientation:Me.orientation,thumbRects:[Le],thumbPercents:[ae]})},[O,Ne,ae,G]),ot=d.useCallback(()=>{G.current.focusThumbOnChange&&setTimeout(()=>{var Le;return(Le=ee.current)==null?void 0:Le.focus()})},[G]);pa(()=>{const Me=G.current;ot(),Me.eventSource==="keyboard"&&(D==null||D(Me.value))},[Q,D]);function ye(Me){const Le=Ce(Me);Le!=null&&Le!==G.current.value&&X(Le)}rP(le,{onPanSessionStart(Me){const Le=G.current;Le.isInteractive&&(V(!0),ot(),ye(Me),R==null||R(Le.value))},onPanSessionEnd(){const Me=G.current;Me.isInteractive&&(V(!1),D==null||D(Me.value))},onPan(Me){G.current.isInteractive&&ye(Me)}});const De=d.useCallback((Me={},Le=null)=>({...Me,...M,ref:It(Le,le),tabIndex:-1,"aria-disabled":uc(h),"data-focused":ho(U),style:{...Me.style,...$e}}),[M,h,U,$e]),ut=d.useCallback((Me={},Le=null)=>({...Me,ref:It(Le,K),id:ge,"data-disabled":ho(h),style:{...Me.style,...Pt}}),[h,ge,Pt]),bt=d.useCallback((Me={},Le=null)=>({...Me,ref:Le,style:{...Me.style,...Ze}}),[Ze]),be=d.useCallback((Me={},Le=null)=>({...Me,ref:It(Le,ee),role:"slider",tabIndex:$?0:void 0,id:de,"data-active":ho(B),"aria-valuetext":_e,"aria-valuemin":n,"aria-valuemax":r,"aria-valuenow":Q,"aria-orientation":p,"aria-disabled":uc(h),"aria-readonly":uc(g),"aria-label":j,"aria-labelledby":j?void 0:_,style:{...Me.style,...nt(0)},onKeyDown:dc(Me.onKeyDown,Oe),onFocus:dc(Me.onFocus,()=>N(!0)),onBlur:dc(Me.onBlur,()=>N(!1))}),[$,de,B,_e,n,r,Q,p,h,g,j,_,nt,Oe]),Je=d.useCallback((Me,Le=null)=>{const Ut=!(Me.valuer),Se=Q>=Me.value,Be=om(Me.value,n,r),ze={position:"absolute",pointerEvents:"none",...vW({orientation:p,vertical:{bottom:O?`${100-Be}%`:`${Be}%`},horizontal:{left:O?`${100-Be}%`:`${Be}%`}})};return{...Me,ref:Le,role:"presentation","aria-hidden":!0,"data-disabled":ho(h),"data-invalid":ho(!Ut),"data-highlighted":ho(Se),style:{...Me.style,...ze}}},[h,O,r,n,p,Q]),lt=d.useCallback((Me={},Le=null)=>({...Me,ref:Le,type:"hidden",value:Q,name:E}),[E,Q]);return{state:{value:Q,isFocused:U,isDragging:B},actions:fe,getRootProps:De,getTrackProps:ut,getInnerTrackProps:bt,getThumbProps:be,getMarkerProps:Je,getInputProps:lt}}function vW(e){const{orientation:t,vertical:n,horizontal:r}=e;return t==="vertical"?n:r}function xW(e,t){return t"}),[yW,Qh]=Wt({name:"SliderStylesContext",hookName:"useSliderStyles",providerName:""}),Wb=ke((e,t)=>{var n;const r={...e,orientation:(n=e==null?void 0:e.orientation)!=null?n:"horizontal"},o=Un("Slider",r),s=on(r),{direction:i}=bd();s.direction=i;const{getInputProps:l,getRootProps:u,...p}=gW(s),m=u(),h=l({},t);return a.jsx(bW,{value:p,children:a.jsx(yW,{value:o,children:a.jsxs(we.div,{...m,className:ai("chakra-slider",r.className),__css:o.container,children:[r.children,a.jsx("input",{...h})]})})})});Wb.displayName="Slider";var Ub=ke((e,t)=>{const{getThumbProps:n}=Xh(),r=Qh(),o=n(e,t);return a.jsx(we.div,{...o,className:ai("chakra-slider__thumb",e.className),__css:r.thumb})});Ub.displayName="SliderThumb";var Gb=ke((e,t)=>{const{getTrackProps:n}=Xh(),r=Qh(),o=n(e,t);return a.jsx(we.div,{...o,className:ai("chakra-slider__track",e.className),__css:r.track})});Gb.displayName="SliderTrack";var Kb=ke((e,t)=>{const{getInnerTrackProps:n}=Xh(),r=Qh(),o=n(e,t);return a.jsx(we.div,{...o,className:ai("chakra-slider__filled-track",e.className),__css:r.filledTrack})});Kb.displayName="SliderFilledTrack";var Ul=ke((e,t)=>{const{getMarkerProps:n}=Xh(),r=Qh(),o=n(e,t);return a.jsx(we.div,{...o,className:ai("chakra-slider__marker",e.className),__css:r.mark})});Ul.displayName="SliderMark";var[CW,sP]=Wt({name:"StatStylesContext",errorMessage:`useStatStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),aP=ke(function(t,n){const r=Un("Stat",t),o={position:"relative",flex:"1 1 0%",...r.container},{className:s,children:i,...l}=on(t);return a.jsx(CW,{value:r,children:a.jsx(we.div,{ref:n,...l,className:Ye("chakra-stat",s),__css:o,children:a.jsx("dl",{children:i})})})});aP.displayName="Stat";var iP=ke(function(t,n){return a.jsx(we.div,{...t,ref:n,role:"group",className:Ye("chakra-stat__group",t.className),__css:{display:"flex",flexWrap:"wrap",justifyContent:"space-around",alignItems:"flex-start"}})});iP.displayName="StatGroup";var lP=ke(function(t,n){const r=sP();return a.jsx(we.dt,{ref:n,...t,className:Ye("chakra-stat__label",t.className),__css:r.label})});lP.displayName="StatLabel";var cP=ke(function(t,n){const r=sP();return a.jsx(we.dd,{ref:n,...t,className:Ye("chakra-stat__number",t.className),__css:{...r.number,fontFeatureSettings:"pnum",fontVariantNumeric:"proportional-nums"}})});cP.displayName="StatNumber";var qb=ke(function(t,n){const r=Un("Switch",t),{spacing:o="0.5rem",children:s,...i}=on(t),{getIndicatorProps:l,getInputProps:u,getCheckboxProps:p,getRootProps:m,getLabelProps:h}=m5(i),g=d.useMemo(()=>({display:"inline-block",position:"relative",verticalAlign:"middle",lineHeight:0,...r.container}),[r.container]),x=d.useMemo(()=>({display:"inline-flex",flexShrink:0,justifyContent:"flex-start",boxSizing:"content-box",cursor:"pointer",...r.track}),[r.track]),y=d.useMemo(()=>({userSelect:"none",marginStart:o,...r.label}),[o,r.label]);return a.jsxs(we.label,{...m(),className:Ye("chakra-switch",t.className),__css:g,children:[a.jsx("input",{className:"chakra-switch__input",...u({},n)}),a.jsx(we.span,{...p(),className:"chakra-switch__track",__css:x,children:a.jsx(we.span,{__css:r.thumb,className:"chakra-switch__thumb",...l()})}),s&&a.jsx(we.span,{className:"chakra-switch__label",...h(),__css:y,children:s})]})});qb.displayName="Switch";var[wW,SW,kW,jW]=lb();function _W(e){var t;const{defaultIndex:n,onChange:r,index:o,isManual:s,isLazy:i,lazyBehavior:l="unmount",orientation:u="horizontal",direction:p="ltr",...m}=e,[h,g]=d.useState(n??0),[x,y]=_d({defaultValue:n??0,value:o,onChange:r});d.useEffect(()=>{o!=null&&g(o)},[o]);const b=kW(),w=d.useId();return{id:`tabs-${(t=e.id)!=null?t:w}`,selectedIndex:x,focusedIndex:h,setSelectedIndex:y,setFocusedIndex:g,isManual:s,isLazy:i,lazyBehavior:l,orientation:u,descendants:b,direction:p,htmlProps:m}}var[IW,Yh]=Wt({name:"TabsContext",errorMessage:"useTabsContext: `context` is undefined. Seems you forgot to wrap all tabs components within "});function PW(e){const{focusedIndex:t,orientation:n,direction:r}=Yh(),o=SW(),s=d.useCallback(i=>{const l=()=>{var j;const _=o.nextEnabled(t);_&&((j=_.node)==null||j.focus())},u=()=>{var j;const _=o.prevEnabled(t);_&&((j=_.node)==null||j.focus())},p=()=>{var j;const _=o.firstEnabled();_&&((j=_.node)==null||j.focus())},m=()=>{var j;const _=o.lastEnabled();_&&((j=_.node)==null||j.focus())},h=n==="horizontal",g=n==="vertical",x=i.key,y=r==="ltr"?"ArrowLeft":"ArrowRight",b=r==="ltr"?"ArrowRight":"ArrowLeft",S={[y]:()=>h&&u(),[b]:()=>h&&l(),ArrowDown:()=>g&&l(),ArrowUp:()=>g&&u(),Home:p,End:m}[x];S&&(i.preventDefault(),S(i))},[o,t,n,r]);return{...e,role:"tablist","aria-orientation":n,onKeyDown:He(e.onKeyDown,s)}}function EW(e){const{isDisabled:t=!1,isFocusable:n=!1,...r}=e,{setSelectedIndex:o,isManual:s,id:i,setFocusedIndex:l,selectedIndex:u}=Yh(),{index:p,register:m}=jW({disabled:t&&!n}),h=p===u,g=()=>{o(p)},x=()=>{l(p),!s&&!(t&&n)&&o(p)},y=h3({...r,ref:It(m,e.ref),isDisabled:t,isFocusable:n,onClick:He(e.onClick,g)}),b="button";return{...y,id:uP(i,p),role:"tab",tabIndex:h?0:-1,type:b,"aria-selected":h,"aria-controls":dP(i,p),onFocus:t?void 0:He(e.onFocus,x)}}var[MW,OW]=Wt({});function RW(e){const t=Yh(),{id:n,selectedIndex:r}=t,s=kh(e.children).map((i,l)=>d.createElement(MW,{key:l,value:{isSelected:l===r,id:dP(n,l),tabId:uP(n,l),selectedIndex:r}},i));return{...e,children:s}}function DW(e){const{children:t,...n}=e,{isLazy:r,lazyBehavior:o}=Yh(),{isSelected:s,id:i,tabId:l}=OW(),u=d.useRef(!1);s&&(u.current=!0);const p=zb({wasSelected:u.current,isSelected:s,enabled:r,mode:o});return{tabIndex:0,...n,children:p?t:null,role:"tabpanel","aria-labelledby":l,hidden:!s,id:i}}function uP(e,t){return`${e}--tab-${t}`}function dP(e,t){return`${e}--tabpanel-${t}`}var[AW,Zh]=Wt({name:"TabsStylesContext",errorMessage:`useTabsStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),rl=ke(function(t,n){const r=Un("Tabs",t),{children:o,className:s,...i}=on(t),{htmlProps:l,descendants:u,...p}=_W(i),m=d.useMemo(()=>p,[p]),{isFitted:h,...g}=l;return a.jsx(wW,{value:u,children:a.jsx(IW,{value:m,children:a.jsx(AW,{value:r,children:a.jsx(we.div,{className:Ye("chakra-tabs",s),ref:n,...g,__css:r.root,children:o})})})})});rl.displayName="Tabs";var ol=ke(function(t,n){const r=PW({...t,ref:n}),s={display:"flex",...Zh().tablist};return a.jsx(we.div,{...r,className:Ye("chakra-tabs__tablist",t.className),__css:s})});ol.displayName="TabList";var So=ke(function(t,n){const r=DW({...t,ref:n}),o=Zh();return a.jsx(we.div,{outline:"0",...r,className:Ye("chakra-tabs__tab-panel",t.className),__css:o.tabpanel})});So.displayName="TabPanel";var zc=ke(function(t,n){const r=RW(t),o=Zh();return a.jsx(we.div,{...r,width:"100%",ref:n,className:Ye("chakra-tabs__tab-panels",t.className),__css:o.tabpanels})});zc.displayName="TabPanels";var Tr=ke(function(t,n){const r=Zh(),o=EW({...t,ref:n}),s={outline:"0",display:"flex",alignItems:"center",justifyContent:"center",...r.tab};return a.jsx(we.button,{...o,className:Ye("chakra-tabs__tab",t.className),__css:s})});Tr.displayName="Tab";function TW(e,t=[]){const n=Object.assign({},e);for(const r of t)r in n&&delete n[r];return n}var NW=["h","minH","height","minHeight"],fP=ke((e,t)=>{const n=oi("Textarea",e),{className:r,rows:o,...s}=on(e),i=db(s),l=o?TW(n,NW):n;return a.jsx(we.textarea,{ref:t,rows:o,...i,className:Ye("chakra-textarea",r),__css:l})});fP.displayName="Textarea";var $W={exit:{scale:.85,opacity:0,transition:{opacity:{duration:.15,easings:"easeInOut"},scale:{duration:.2,easings:"easeInOut"}}},enter:{scale:1,opacity:1,transition:{opacity:{easings:"easeOut",duration:.2},scale:{duration:.2,ease:[.175,.885,.4,1.1]}}}},W1=e=>{var t;return((t=e.current)==null?void 0:t.ownerDocument)||document},Bp=e=>{var t,n;return((n=(t=e.current)==null?void 0:t.ownerDocument)==null?void 0:n.defaultView)||window};function LW(e={}){const{openDelay:t=0,closeDelay:n=0,closeOnClick:r=!0,closeOnMouseDown:o,closeOnScroll:s,closeOnPointerDown:i=o,closeOnEsc:l=!0,onOpen:u,onClose:p,placement:m,id:h,isOpen:g,defaultIsOpen:x,arrowSize:y=10,arrowShadowColor:b,arrowPadding:w,modifiers:S,isDisabled:j,gutter:_,offset:E,direction:I,...M}=e,{isOpen:R,onOpen:D,onClose:A}=Lb({isOpen:g,defaultIsOpen:x,onOpen:u,onClose:p}),{referenceRef:O,getPopperProps:T,getArrowInnerProps:X,getArrowProps:B}=$b({enabled:R,placement:m,arrowPadding:w,modifiers:S,gutter:_,offset:E,direction:I}),V=d.useId(),N=`tooltip-${h??V}`,$=d.useRef(null),q=d.useRef(),F=d.useCallback(()=>{q.current&&(clearTimeout(q.current),q.current=void 0)},[]),Q=d.useRef(),Y=d.useCallback(()=>{Q.current&&(clearTimeout(Q.current),Q.current=void 0)},[]),se=d.useCallback(()=>{Y(),A()},[A,Y]),ae=zW($,se),re=d.useCallback(()=>{if(!j&&!q.current){R&&ae();const ge=Bp($);q.current=ge.setTimeout(D,t)}},[ae,j,R,D,t]),G=d.useCallback(()=>{F();const ge=Bp($);Q.current=ge.setTimeout(se,n)},[n,se,F]),K=d.useCallback(()=>{R&&r&&G()},[r,G,R]),ee=d.useCallback(()=>{R&&i&&G()},[i,G,R]),le=d.useCallback(ge=>{R&&ge.key==="Escape"&&G()},[R,G]);Ri(()=>W1($),"keydown",l?le:void 0),Ri(()=>{const ge=$.current;if(!ge)return null;const Ce=n3(ge);return Ce.localName==="body"?Bp($):Ce},"scroll",()=>{R&&s&&se()},{passive:!0,capture:!0}),d.useEffect(()=>{j&&(F(),R&&A())},[j,R,A,F]),d.useEffect(()=>()=>{F(),Y()},[F,Y]),Ri(()=>$.current,"pointerleave",G);const J=d.useCallback((ge={},Ce=null)=>({...ge,ref:It($,Ce,O),onPointerEnter:He(ge.onPointerEnter,fe=>{fe.pointerType!=="touch"&&re()}),onClick:He(ge.onClick,K),onPointerDown:He(ge.onPointerDown,ee),onFocus:He(ge.onFocus,re),onBlur:He(ge.onBlur,G),"aria-describedby":R?N:void 0}),[re,G,ee,R,N,K,O]),ie=d.useCallback((ge={},Ce=null)=>T({...ge,style:{...ge.style,[Nn.arrowSize.var]:y?`${y}px`:void 0,[Nn.arrowShadowColor.var]:b}},Ce),[T,y,b]),de=d.useCallback((ge={},Ce=null)=>{const he={...ge.style,position:"relative",transformOrigin:Nn.transformOrigin.varRef};return{ref:Ce,...M,...ge,id:N,role:"tooltip",style:he}},[M,N]);return{isOpen:R,show:re,hide:G,getTriggerProps:J,getTooltipProps:de,getTooltipPositionerProps:ie,getArrowProps:B,getArrowInnerProps:X}}var yv="chakra-ui:close-tooltip";function zW(e,t){return d.useEffect(()=>{const n=W1(e);return n.addEventListener(yv,t),()=>n.removeEventListener(yv,t)},[t,e]),()=>{const n=W1(e),r=Bp(e);n.dispatchEvent(new r.CustomEvent(yv))}}function FW(e,t=[]){const n=Object.assign({},e);for(const r of t)r in n&&delete n[r];return n}function BW(e,t){const n={};for(const r of t)r in e&&(n[r]=e[r]);return n}var HW=we(In.div),Ht=ke((e,t)=>{var n,r;const o=oi("Tooltip",e),s=on(e),i=bd(),{children:l,label:u,shouldWrapChildren:p,"aria-label":m,hasArrow:h,bg:g,portalProps:x,background:y,backgroundColor:b,bgColor:w,motionProps:S,...j}=s,_=(r=(n=y??b)!=null?n:g)!=null?r:w;if(_){o.bg=_;const T=VR(i,"colors",_);o[Nn.arrowBg.var]=T}const E=LW({...j,direction:i.direction}),I=typeof l=="string"||p;let M;if(I)M=a.jsx(we.span,{display:"inline-block",tabIndex:0,...E.getTriggerProps(),children:l});else{const T=d.Children.only(l);M=d.cloneElement(T,E.getTriggerProps(T.props,T.ref))}const R=!!m,D=E.getTooltipProps({},t),A=R?FW(D,["role","id"]):D,O=BW(D,["role","id"]);return u?a.jsxs(a.Fragment,{children:[M,a.jsx(dr,{children:E.isOpen&&a.jsx(Ac,{...x,children:a.jsx(we.div,{...E.getTooltipPositionerProps(),__css:{zIndex:o.zIndex,pointerEvents:"none"},children:a.jsxs(HW,{variants:$W,initial:"exit",animate:"enter",exit:"exit",...S,...A,__css:o,children:[u,R&&a.jsx(we.span,{srOnly:!0,...O,children:m}),h&&a.jsx(we.div,{"data-popper-arrow":!0,className:"chakra-tooltip__arrow-wrapper",children:a.jsx(we.div,{"data-popper-arrow-inner":!0,className:"chakra-tooltip__arrow",__css:{bg:o.bg}})})]})})})})]}):a.jsx(a.Fragment,{children:l})});Ht.displayName="Tooltip";function Jh(e,t={}){let n=d.useCallback(o=>t.keys?n$(e,t.keys,o):e.listen(o),[t.keys,e]),r=e.get.bind(e);return d.useSyncExternalStore(n,r,r)}const VW=ce(xe,({system:e})=>{const{consoleLogLevel:t,shouldLogToConsole:n}=e;return{consoleLogLevel:t,shouldLogToConsole:n}},{memoizeOptions:{resultEqualityCheck:Ft}}),pP=e=>{const{consoleLogLevel:t,shouldLogToConsole:n}=W(VW);return d.useEffect(()=>{n?(localStorage.setItem("ROARR_LOG","true"),localStorage.setItem("ROARR_FILTER",`context.logLevel:>=${WR[t]}`)):localStorage.setItem("ROARR_LOG","false"),JC.ROARR.write=UR.createLogWriter()},[t,n]),d.useEffect(()=>{const o={...GR};KR.set(JC.Roarr.child(o))},[]),d.useMemo(()=>el(e),[e])},WW=()=>{const e=te(),t=W(r=>r.system.toastQueue),n=o5();return d.useEffect(()=>{t.forEach(r=>{n(r)}),t.length>0&&e(qR())},[e,n,t]),null},sl=()=>{const e=te();return d.useCallback(n=>e(ct(Qt(n))),[e])},UW=d.memo(WW);var GW=new Map([["aac","audio/aac"],["abw","application/x-abiword"],["arc","application/x-freearc"],["avif","image/avif"],["avi","video/x-msvideo"],["azw","application/vnd.amazon.ebook"],["bin","application/octet-stream"],["bmp","image/bmp"],["bz","application/x-bzip"],["bz2","application/x-bzip2"],["cda","application/x-cdf"],["csh","application/x-csh"],["css","text/css"],["csv","text/csv"],["doc","application/msword"],["docx","application/vnd.openxmlformats-officedocument.wordprocessingml.document"],["eot","application/vnd.ms-fontobject"],["epub","application/epub+zip"],["gz","application/gzip"],["gif","image/gif"],["heic","image/heic"],["heif","image/heif"],["htm","text/html"],["html","text/html"],["ico","image/vnd.microsoft.icon"],["ics","text/calendar"],["jar","application/java-archive"],["jpeg","image/jpeg"],["jpg","image/jpeg"],["js","text/javascript"],["json","application/json"],["jsonld","application/ld+json"],["mid","audio/midi"],["midi","audio/midi"],["mjs","text/javascript"],["mp3","audio/mpeg"],["mp4","video/mp4"],["mpeg","video/mpeg"],["mpkg","application/vnd.apple.installer+xml"],["odp","application/vnd.oasis.opendocument.presentation"],["ods","application/vnd.oasis.opendocument.spreadsheet"],["odt","application/vnd.oasis.opendocument.text"],["oga","audio/ogg"],["ogv","video/ogg"],["ogx","application/ogg"],["opus","audio/opus"],["otf","font/otf"],["png","image/png"],["pdf","application/pdf"],["php","application/x-httpd-php"],["ppt","application/vnd.ms-powerpoint"],["pptx","application/vnd.openxmlformats-officedocument.presentationml.presentation"],["rar","application/vnd.rar"],["rtf","application/rtf"],["sh","application/x-sh"],["svg","image/svg+xml"],["swf","application/x-shockwave-flash"],["tar","application/x-tar"],["tif","image/tiff"],["tiff","image/tiff"],["ts","video/mp2t"],["ttf","font/ttf"],["txt","text/plain"],["vsd","application/vnd.visio"],["wav","audio/wav"],["weba","audio/webm"],["webm","video/webm"],["webp","image/webp"],["woff","font/woff"],["woff2","font/woff2"],["xhtml","application/xhtml+xml"],["xls","application/vnd.ms-excel"],["xlsx","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"],["xml","application/xml"],["xul","application/vnd.mozilla.xul+xml"],["zip","application/zip"],["7z","application/x-7z-compressed"],["mkv","video/x-matroska"],["mov","video/quicktime"],["msg","application/vnd.ms-outlook"]]);function Fd(e,t){var n=KW(e);if(typeof n.path!="string"){var r=e.webkitRelativePath;Object.defineProperty(n,"path",{value:typeof t=="string"?t:typeof r=="string"&&r.length>0?r:e.name,writable:!1,configurable:!1,enumerable:!0})}return n}function KW(e){var t=e.name,n=t&&t.lastIndexOf(".")!==-1;if(n&&!e.type){var r=t.split(".").pop().toLowerCase(),o=GW.get(r);o&&Object.defineProperty(e,"type",{value:o,writable:!1,configurable:!1,enumerable:!0})}return e}var qW=[".DS_Store","Thumbs.db"];function XW(e){return Tc(this,void 0,void 0,function(){return Nc(this,function(t){return um(e)&&QW(e.dataTransfer)?[2,eU(e.dataTransfer,e.type)]:YW(e)?[2,ZW(e)]:Array.isArray(e)&&e.every(function(n){return"getFile"in n&&typeof n.getFile=="function"})?[2,JW(e)]:[2,[]]})})}function QW(e){return um(e)}function YW(e){return um(e)&&um(e.target)}function um(e){return typeof e=="object"&&e!==null}function ZW(e){return U1(e.target.files).map(function(t){return Fd(t)})}function JW(e){return Tc(this,void 0,void 0,function(){var t;return Nc(this,function(n){switch(n.label){case 0:return[4,Promise.all(e.map(function(r){return r.getFile()}))];case 1:return t=n.sent(),[2,t.map(function(r){return Fd(r)})]}})})}function eU(e,t){return Tc(this,void 0,void 0,function(){var n,r;return Nc(this,function(o){switch(o.label){case 0:return e.items?(n=U1(e.items).filter(function(s){return s.kind==="file"}),t!=="drop"?[2,n]:[4,Promise.all(n.map(tU))]):[3,2];case 1:return r=o.sent(),[2,$S(mP(r))];case 2:return[2,$S(U1(e.files).map(function(s){return Fd(s)}))]}})})}function $S(e){return e.filter(function(t){return qW.indexOf(t.name)===-1})}function U1(e){if(e===null)return[];for(var t=[],n=0;ne.length)&&(t=e.length);for(var n=0,r=new Array(t);nn)return[!1,HS(n)];if(e.sizen)return[!1,HS(n)]}return[!0,null]}function _i(e){return e!=null}function vU(e){var t=e.files,n=e.accept,r=e.minSize,o=e.maxSize,s=e.multiple,i=e.maxFiles,l=e.validator;return!s&&t.length>1||s&&i>=1&&t.length>i?!1:t.every(function(u){var p=xP(u,n),m=rd(p,1),h=m[0],g=bP(u,r,o),x=rd(g,1),y=x[0],b=l?l(u):null;return h&&y&&!b})}function dm(e){return typeof e.isPropagationStopped=="function"?e.isPropagationStopped():typeof e.cancelBubble<"u"?e.cancelBubble:!1}function sp(e){return e.dataTransfer?Array.prototype.some.call(e.dataTransfer.types,function(t){return t==="Files"||t==="application/x-moz-file"}):!!e.target&&!!e.target.files}function WS(e){e.preventDefault()}function xU(e){return e.indexOf("MSIE")!==-1||e.indexOf("Trident/")!==-1}function bU(e){return e.indexOf("Edge/")!==-1}function yU(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:window.navigator.userAgent;return xU(e)||bU(e)}function ps(){for(var e=arguments.length,t=new Array(e),n=0;n1?o-1:0),i=1;ie.length)&&(t=e.length);for(var n=0,r=new Array(t);n=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function $U(e,t){if(e==null)return{};var n={},r=Object.keys(e),o,s;for(s=0;s=0)&&(n[o]=e[o]);return n}var Xb=d.forwardRef(function(e,t){var n=e.children,r=fm(e,_U),o=Qb(r),s=o.open,i=fm(o,IU);return d.useImperativeHandle(t,function(){return{open:s}},[s]),H.createElement(d.Fragment,null,n(bn(bn({},i),{},{open:s})))});Xb.displayName="Dropzone";var SP={disabled:!1,getFilesFromEvent:XW,maxSize:1/0,minSize:0,multiple:!0,maxFiles:0,preventDropOnDocument:!0,noClick:!1,noKeyboard:!1,noDrag:!1,noDragEventsBubbling:!1,validator:null,useFsAccessApi:!0,autoFocus:!1};Xb.defaultProps=SP;Xb.propTypes={children:Jt.func,accept:Jt.objectOf(Jt.arrayOf(Jt.string)),multiple:Jt.bool,preventDropOnDocument:Jt.bool,noClick:Jt.bool,noKeyboard:Jt.bool,noDrag:Jt.bool,noDragEventsBubbling:Jt.bool,minSize:Jt.number,maxSize:Jt.number,maxFiles:Jt.number,disabled:Jt.bool,getFilesFromEvent:Jt.func,onFileDialogCancel:Jt.func,onFileDialogOpen:Jt.func,useFsAccessApi:Jt.bool,autoFocus:Jt.bool,onDragEnter:Jt.func,onDragLeave:Jt.func,onDragOver:Jt.func,onDrop:Jt.func,onDropAccepted:Jt.func,onDropRejected:Jt.func,onError:Jt.func,validator:Jt.func};var X1={isFocused:!1,isFileDialogActive:!1,isDragActive:!1,isDragAccept:!1,isDragReject:!1,acceptedFiles:[],fileRejections:[]};function Qb(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=bn(bn({},SP),e),n=t.accept,r=t.disabled,o=t.getFilesFromEvent,s=t.maxSize,i=t.minSize,l=t.multiple,u=t.maxFiles,p=t.onDragEnter,m=t.onDragLeave,h=t.onDragOver,g=t.onDrop,x=t.onDropAccepted,y=t.onDropRejected,b=t.onFileDialogCancel,w=t.onFileDialogOpen,S=t.useFsAccessApi,j=t.autoFocus,_=t.preventDropOnDocument,E=t.noClick,I=t.noKeyboard,M=t.noDrag,R=t.noDragEventsBubbling,D=t.onError,A=t.validator,O=d.useMemo(function(){return SU(n)},[n]),T=d.useMemo(function(){return wU(n)},[n]),X=d.useMemo(function(){return typeof w=="function"?w:GS},[w]),B=d.useMemo(function(){return typeof b=="function"?b:GS},[b]),V=d.useRef(null),U=d.useRef(null),N=d.useReducer(LU,X1),$=Cv(N,2),q=$[0],F=$[1],Q=q.isFocused,Y=q.isFileDialogActive,se=d.useRef(typeof window<"u"&&window.isSecureContext&&S&&CU()),ae=function(){!se.current&&Y&&setTimeout(function(){if(U.current){var De=U.current.files;De.length||(F({type:"closeDialog"}),B())}},300)};d.useEffect(function(){return window.addEventListener("focus",ae,!1),function(){window.removeEventListener("focus",ae,!1)}},[U,Y,B,se]);var re=d.useRef([]),G=function(De){V.current&&V.current.contains(De.target)||(De.preventDefault(),re.current=[])};d.useEffect(function(){return _&&(document.addEventListener("dragover",WS,!1),document.addEventListener("drop",G,!1)),function(){_&&(document.removeEventListener("dragover",WS),document.removeEventListener("drop",G))}},[V,_]),d.useEffect(function(){return!r&&j&&V.current&&V.current.focus(),function(){}},[V,j,r]);var K=d.useCallback(function(ye){D?D(ye):console.error(ye)},[D]),ee=d.useCallback(function(ye){ye.preventDefault(),ye.persist(),$e(ye),re.current=[].concat(MU(re.current),[ye.target]),sp(ye)&&Promise.resolve(o(ye)).then(function(De){if(!(dm(ye)&&!R)){var ut=De.length,bt=ut>0&&vU({files:De,accept:O,minSize:i,maxSize:s,multiple:l,maxFiles:u,validator:A}),be=ut>0&&!bt;F({isDragAccept:bt,isDragReject:be,isDragActive:!0,type:"setDraggedFiles"}),p&&p(ye)}}).catch(function(De){return K(De)})},[o,p,K,R,O,i,s,l,u,A]),ce=d.useCallback(function(ye){ye.preventDefault(),ye.persist(),$e(ye);var De=sp(ye);if(De&&ye.dataTransfer)try{ye.dataTransfer.dropEffect="copy"}catch{}return De&&h&&h(ye),!1},[h,R]),J=d.useCallback(function(ye){ye.preventDefault(),ye.persist(),$e(ye);var De=re.current.filter(function(bt){return V.current&&V.current.contains(bt)}),ut=De.indexOf(ye.target);ut!==-1&&De.splice(ut,1),re.current=De,!(De.length>0)&&(F({type:"setDraggedFiles",isDragActive:!1,isDragAccept:!1,isDragReject:!1}),sp(ye)&&m&&m(ye))},[V,m,R]),ie=d.useCallback(function(ye,De){var ut=[],bt=[];ye.forEach(function(be){var Je=xP(be,O),lt=Cv(Je,2),ft=lt[0],Me=lt[1],Le=bP(be,i,s),Ut=Cv(Le,2),ke=Ut[0],Be=Ut[1],ze=A?A(be):null;if(ft&&ke&&!ze)ut.push(be);else{var Ge=[Me,Be];ze&&(Ge=Ge.concat(ze)),bt.push({file:be,errors:Ge.filter(function(pt){return pt})})}}),(!l&&ut.length>1||l&&u>=1&&ut.length>u)&&(ut.forEach(function(be){bt.push({file:be,errors:[gU]})}),ut.splice(0)),F({acceptedFiles:ut,fileRejections:bt,type:"setFiles"}),g&&g(ut,bt,De),bt.length>0&&y&&y(bt,De),ut.length>0&&x&&x(ut,De)},[F,l,O,i,s,u,g,x,y,A]),de=d.useCallback(function(ye){ye.preventDefault(),ye.persist(),$e(ye),re.current=[],sp(ye)&&Promise.resolve(o(ye)).then(function(De){dm(ye)&&!R||ie(De,ye)}).catch(function(De){return K(De)}),F({type:"reset"})},[o,ie,K,R]),ge=d.useCallback(function(){if(se.current){F({type:"openDialog"}),X();var ye={multiple:l,types:T};window.showOpenFilePicker(ye).then(function(De){return o(De)}).then(function(De){ie(De,null),F({type:"closeDialog"})}).catch(function(De){kU(De)?(B(De),F({type:"closeDialog"})):jU(De)?(se.current=!1,U.current?(U.current.value=null,U.current.click()):K(new Error("Cannot open the file picker because the https://developer.mozilla.org/en-US/docs/Web/API/File_System_Access_API is not supported and no was provided."))):K(De)});return}U.current&&(F({type:"openDialog"}),X(),U.current.value=null,U.current.click())},[F,X,B,S,ie,K,T,l]),Ce=d.useCallback(function(ye){!V.current||!V.current.isEqualNode(ye.target)||(ye.key===" "||ye.key==="Enter"||ye.keyCode===32||ye.keyCode===13)&&(ye.preventDefault(),ge())},[V,ge]),he=d.useCallback(function(){F({type:"focus"})},[]),fe=d.useCallback(function(){F({type:"blur"})},[]),Oe=d.useCallback(function(){E||(yU()?setTimeout(ge,0):ge())},[E,ge]),_e=function(De){return r?null:De},Ne=function(De){return I?null:_e(De)},nt=function(De){return M?null:_e(De)},$e=function(De){R&&De.stopPropagation()},Pt=d.useMemo(function(){return function(){var ye=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},De=ye.refKey,ut=De===void 0?"ref":De,bt=ye.role,be=ye.onKeyDown,Je=ye.onFocus,lt=ye.onBlur,ft=ye.onClick,Me=ye.onDragEnter,Le=ye.onDragOver,Ut=ye.onDragLeave,ke=ye.onDrop,Be=fm(ye,PU);return bn(bn(q1({onKeyDown:Ne(ps(be,Ce)),onFocus:Ne(ps(Je,he)),onBlur:Ne(ps(lt,fe)),onClick:_e(ps(ft,Oe)),onDragEnter:nt(ps(Me,ee)),onDragOver:nt(ps(Le,ce)),onDragLeave:nt(ps(Ut,J)),onDrop:nt(ps(ke,de)),role:typeof bt=="string"&&bt!==""?bt:"presentation"},ut,V),!r&&!I?{tabIndex:0}:{}),Be)}},[V,Ce,he,fe,Oe,ee,ce,J,de,I,M,r]),Ze=d.useCallback(function(ye){ye.stopPropagation()},[]),ot=d.useMemo(function(){return function(){var ye=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},De=ye.refKey,ut=De===void 0?"ref":De,bt=ye.onChange,be=ye.onClick,Je=fm(ye,EU),lt=q1({accept:O,multiple:l,type:"file",style:{display:"none"},onChange:_e(ps(bt,de)),onClick:_e(ps(be,Ze)),tabIndex:-1},ut,U);return bn(bn({},lt),Je)}},[U,n,l,de,r]);return bn(bn({},q),{},{isFocused:Q&&!r,getRootProps:Pt,getInputProps:ot,rootRef:V,inputRef:U,open:_e(ge)})}function LU(e,t){switch(t.type){case"focus":return bn(bn({},e),{},{isFocused:!0});case"blur":return bn(bn({},e),{},{isFocused:!1});case"openDialog":return bn(bn({},X1),{},{isFileDialogActive:!0});case"closeDialog":return bn(bn({},e),{},{isFileDialogActive:!1});case"setDraggedFiles":return bn(bn({},e),{},{isDragActive:t.isDragActive,isDragAccept:t.isDragAccept,isDragReject:t.isDragReject});case"setFiles":return bn(bn({},e),{},{acceptedFiles:t.acceptedFiles,fileRejections:t.fileRejections});case"reset":return bn({},X1);default:return e}}function GS(){}function Q1(){return Q1=Object.assign?Object.assign.bind():function(e){for(var t=1;t'),!0):t?e.some(function(n){return t.includes(n)})||e.includes("*"):!0}var UU=function(t,n,r){r===void 0&&(r=!1);var o=n.alt,s=n.meta,i=n.mod,l=n.shift,u=n.ctrl,p=n.keys,m=t.key,h=t.code,g=t.ctrlKey,x=t.metaKey,y=t.shiftKey,b=t.altKey,w=Va(h),S=m.toLowerCase();if(!r){if(o===!b&&S!=="alt"||l===!y&&S!=="shift")return!1;if(i){if(!x&&!g)return!1}else if(s===!x&&S!=="meta"&&S!=="os"||u===!g&&S!=="ctrl"&&S!=="control")return!1}return p&&p.length===1&&(p.includes(S)||p.includes(w))?!0:p?Hp(p):!p},GU=d.createContext(void 0),KU=function(){return d.useContext(GU)};function PP(e,t){return e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(e).length===Object.keys(t).length&&Object.keys(e).reduce(function(n,r){return n&&PP(e[r],t[r])},!0):e===t}var qU=d.createContext({hotkeys:[],enabledScopes:[],toggleScope:function(){},enableScope:function(){},disableScope:function(){}}),XU=function(){return d.useContext(qU)};function QU(e){var t=d.useRef(void 0);return PP(t.current,e)||(t.current=e),t.current}var KS=function(t){t.stopPropagation(),t.preventDefault(),t.stopImmediatePropagation()},YU=typeof window<"u"?d.useLayoutEffect:d.useEffect;function et(e,t,n,r){var o=d.useRef(null),s=d.useRef(!1),i=n instanceof Array?r instanceof Array?void 0:r:n,l=Yb(e)?e.join(i==null?void 0:i.splitKey):e,u=n instanceof Array?n:r instanceof Array?r:void 0,p=d.useCallback(t,u??[]),m=d.useRef(p);u?m.current=p:m.current=t;var h=QU(i),g=XU(),x=g.enabledScopes,y=KU();return YU(function(){if(!((h==null?void 0:h.enabled)===!1||!WU(x,h==null?void 0:h.scopes))){var b=function(E,I){var M;if(I===void 0&&(I=!1),!(VU(E)&&!IP(E,h==null?void 0:h.enableOnFormTags))&&!(h!=null&&h.ignoreEventWhen!=null&&h.ignoreEventWhen(E))){if(o.current!==null&&document.activeElement!==o.current&&!o.current.contains(document.activeElement)){KS(E);return}(M=E.target)!=null&&M.isContentEditable&&!(h!=null&&h.enableOnContentEditable)||wv(l,h==null?void 0:h.splitKey).forEach(function(R){var D,A=Sv(R,h==null?void 0:h.combinationKey);if(UU(E,A,h==null?void 0:h.ignoreModifiers)||(D=A.keys)!=null&&D.includes("*")){if(I&&s.current)return;if(BU(E,A,h==null?void 0:h.preventDefault),!HU(E,A,h==null?void 0:h.enabled)){KS(E);return}m.current(E,A),I||(s.current=!0)}})}},w=function(E){E.key!==void 0&&(jP(Va(E.code)),((h==null?void 0:h.keydown)===void 0&&(h==null?void 0:h.keyup)!==!0||h!=null&&h.keydown)&&b(E))},S=function(E){E.key!==void 0&&(_P(Va(E.code)),s.current=!1,h!=null&&h.keyup&&b(E,!0))},j=o.current||(i==null?void 0:i.document)||document;return j.addEventListener("keyup",S),j.addEventListener("keydown",w),y&&wv(l,h==null?void 0:h.splitKey).forEach(function(_){return y.addHotkey(Sv(_,h==null?void 0:h.combinationKey,h==null?void 0:h.description))}),function(){j.removeEventListener("keyup",S),j.removeEventListener("keydown",w),y&&wv(l,h==null?void 0:h.splitKey).forEach(function(_){return y.removeHotkey(Sv(_,h==null?void 0:h.combinationKey,h==null?void 0:h.description))})}}},[l,h,x]),o}const ZU=e=>{const{isDragAccept:t,isDragReject:n,setIsHandlingUpload:r}=e;return et("esc",()=>{r(!1)}),a.jsxs(Ie,{sx:{position:"absolute",top:0,insetInlineStart:0,width:"100vw",height:"100vh",zIndex:999,backdropFilter:"blur(20px)"},children:[a.jsx(L,{sx:{position:"absolute",top:0,insetInlineStart:0,w:"full",h:"full",bg:"base.700",_dark:{bg:"base.900"},opacity:.7,alignItems:"center",justifyContent:"center",transitionProperty:"common",transitionDuration:"0.1s"}}),a.jsx(L,{sx:{position:"absolute",top:0,insetInlineStart:0,width:"full",height:"full",alignItems:"center",justifyContent:"center",p:4},children:a.jsx(L,{sx:{width:"full",height:"full",alignItems:"center",justifyContent:"center",flexDir:"column",gap:4,borderWidth:3,borderRadius:"xl",borderStyle:"dashed",color:"base.100",borderColor:"base.100",_dark:{borderColor:"base.200"}},children:t?a.jsx(cr,{size:"lg",children:"Drop to Upload"}):a.jsxs(a.Fragment,{children:[a.jsx(cr,{size:"lg",children:"Invalid Upload"}),a.jsx(cr,{size:"md",children:"Must be single JPEG or PNG image"})]})})})]})},JU=d.memo(ZU),eG=le([xe,Jn],({gallery:e},t)=>{let n={type:"TOAST"};t==="unifiedCanvas"&&(n={type:"SET_CANVAS_INITIAL_IMAGE"}),t==="img2img"&&(n={type:"SET_INITIAL_IMAGE"});const{autoAddBoardId:r}=e;return{autoAddBoardId:r,postUploadAction:n}},Se),tG=e=>{const{children:t}=e,{autoAddBoardId:n,postUploadAction:r}=W(eG),o=sl(),{t:s}=Z(),[i,l]=d.useState(!1),[u]=nI(),p=d.useCallback(_=>{l(!0),o({title:s("toast.uploadFailed"),description:_.errors.map(E=>E.message).join(` -`),status:"error"})},[s,o]),m=d.useCallback(async _=>{u({file:_,image_category:"user",is_intermediate:!1,postUploadAction:r,board_id:n==="none"?void 0:n})},[n,r,u]),h=d.useCallback((_,E)=>{if(E.length>1){o({title:s("toast.uploadFailed"),description:s("toast.uploadFailedInvalidUploadDesc"),status:"error"});return}E.forEach(I=>{p(I)}),_.forEach(I=>{m(I)})},[s,o,m,p]),g=d.useCallback(()=>{l(!0)},[]),{getRootProps:x,getInputProps:y,isDragAccept:b,isDragReject:w,isDragActive:S,inputRef:j}=Qb({accept:{"image/png":[".png"],"image/jpeg":[".jpg",".jpeg",".png"]},noClick:!0,onDrop:h,onDragOver:g,multiple:!1});return d.useEffect(()=>{const _=async E=>{var I,M;j.current&&(I=E.clipboardData)!=null&&I.files&&(j.current.files=E.clipboardData.files,(M=j.current)==null||M.dispatchEvent(new Event("change",{bubbles:!0})))};return document.addEventListener("paste",_),()=>{document.removeEventListener("paste",_)}},[j]),a.jsxs(Ie,{...x({style:{}}),onKeyDown:_=>{_.key},children:[a.jsx("input",{...y()}),t,a.jsx(dr,{children:S&&i&&a.jsx(In.div,{initial:{opacity:0},animate:{opacity:1,transition:{duration:.1}},exit:{opacity:0,transition:{duration:.1}},children:a.jsx(JU,{isDragAccept:b,isDragReject:w,setIsHandlingUpload:l})},"image-upload-overlay")})]})},nG=d.memo(tG),rG=je((e,t)=>{const{children:n,tooltip:r="",tooltipProps:{placement:o="top",hasArrow:s=!0,...i}={},isChecked:l,...u}=e;return a.jsx(Ht,{label:r,placement:o,hasArrow:s,...i,children:a.jsx(Za,{ref:t,colorScheme:l?"accent":"base",...u,children:n})})}),at=d.memo(rG);function oG(e){const t=d.createContext(null);return[({children:o,value:s})=>H.createElement(t.Provider,{value:s},o),()=>{const o=d.useContext(t);if(o===null)throw new Error(e);return o}]}function EP(e){return Array.isArray(e)?e:[e]}const sG=()=>{};function aG(e,t={active:!0}){return typeof e!="function"||!t.active?t.onKeyDown||sG:n=>{var r;n.key==="Escape"&&(e(n),(r=t.onTrigger)==null||r.call(t))}}function MP({data:e}){const t=[],n=[],r=e.reduce((o,s,i)=>(s.group?o[s.group]?o[s.group].push(i):o[s.group]=[i]:n.push(i),o),{});return Object.keys(r).forEach(o=>{t.push(...r[o].map(s=>e[s]))}),t.push(...n.map(o=>e[o])),t}function OP(e){return Array.isArray(e)||e===null?!1:typeof e=="object"?e.type!==H.Fragment:!1}function RP(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e))for(t=0;tr===t[o]).indexOf(!1)>=0)&&(n.current={v:e(),prevDeps:[...t]}),n.current.v}const cG=XR({key:"mantine",prepend:!0});function uG(){return QI()||cG}var dG=Object.defineProperty,qS=Object.getOwnPropertySymbols,fG=Object.prototype.hasOwnProperty,pG=Object.prototype.propertyIsEnumerable,XS=(e,t,n)=>t in e?dG(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,mG=(e,t)=>{for(var n in t||(t={}))fG.call(t,n)&&XS(e,n,t[n]);if(qS)for(var n of qS(t))pG.call(t,n)&&XS(e,n,t[n]);return e};const kv="ref";function hG(e){let t;if(e.length!==1)return{args:e,ref:t};const[n]=e;if(!(n instanceof Object))return{args:e,ref:t};if(!(kv in n))return{args:e,ref:t};t=n[kv];const r=mG({},n);return delete r[kv],{args:[r],ref:t}}const{cssFactory:gG}=(()=>{function e(n,r,o){const s=[],i=ZR(n,s,o);return s.length<2?o:i+r(s)}function t(n){const{cache:r}=n,o=(...i)=>{const{ref:l,args:u}=hG(i),p=QR(u,r.registered);return YR(r,p,!1),`${r.key}-${p.name}${l===void 0?"":` ${l}`}`};return{css:o,cx:(...i)=>e(r.registered,o,DP(i))}}return{cssFactory:t}})();function AP(){const e=uG();return lG(()=>gG({cache:e}),[e])}function vG({cx:e,classes:t,context:n,classNames:r,name:o,cache:s}){const i=n.reduce((l,u)=>(Object.keys(u.classNames).forEach(p=>{typeof l[p]!="string"?l[p]=`${u.classNames[p]}`:l[p]=`${l[p]} ${u.classNames[p]}`}),l),{});return Object.keys(t).reduce((l,u)=>(l[u]=e(t[u],i[u],r!=null&&r[u],Array.isArray(o)?o.filter(Boolean).map(p=>`${(s==null?void 0:s.key)||"mantine"}-${p}-${u}`).join(" "):o?`${(s==null?void 0:s.key)||"mantine"}-${o}-${u}`:null),l),{})}var xG=Object.defineProperty,QS=Object.getOwnPropertySymbols,bG=Object.prototype.hasOwnProperty,yG=Object.prototype.propertyIsEnumerable,YS=(e,t,n)=>t in e?xG(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,jv=(e,t)=>{for(var n in t||(t={}))bG.call(t,n)&&YS(e,n,t[n]);if(QS)for(var n of QS(t))yG.call(t,n)&&YS(e,n,t[n]);return e};function Y1(e,t){return t&&Object.keys(t).forEach(n=>{e[n]?e[n]=jv(jv({},e[n]),t[n]):e[n]=jv({},t[n])}),e}function ZS(e,t,n,r){const o=s=>typeof s=="function"?s(t,n||{},r):s||{};return Array.isArray(e)?e.map(s=>o(s.styles)).reduce((s,i)=>Y1(s,i),{}):o(e)}function CG({ctx:e,theme:t,params:n,variant:r,size:o}){return e.reduce((s,i)=>(i.variants&&r in i.variants&&Y1(s,i.variants[r](t,n,{variant:r,size:o})),i.sizes&&o in i.sizes&&Y1(s,i.sizes[o](t,n,{variant:r,size:o})),s),{})}function fr(e){const t=typeof e=="function"?e:()=>e;function n(r,o){const s=xa(),i=z9(o==null?void 0:o.name),l=QI(),u={variant:o==null?void 0:o.variant,size:o==null?void 0:o.size},{css:p,cx:m}=AP(),h=t(s,r,u),g=ZS(o==null?void 0:o.styles,s,r,u),x=ZS(i,s,r,u),y=CG({ctx:i,theme:s,params:r,variant:o==null?void 0:o.variant,size:o==null?void 0:o.size}),b=Object.fromEntries(Object.keys(h).map(w=>{const S=m({[p(h[w])]:!(o!=null&&o.unstyled)},p(y[w]),p(x[w]),p(g[w]));return[w,S]}));return{classes:vG({cx:m,classes:b,context:i,classNames:o==null?void 0:o.classNames,name:o==null?void 0:o.name,cache:l}),cx:m,theme:s}}return n}function JS(e){return`___ref-${e||""}`}var wG=Object.defineProperty,SG=Object.defineProperties,kG=Object.getOwnPropertyDescriptors,e4=Object.getOwnPropertySymbols,jG=Object.prototype.hasOwnProperty,_G=Object.prototype.propertyIsEnumerable,t4=(e,t,n)=>t in e?wG(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,wu=(e,t)=>{for(var n in t||(t={}))jG.call(t,n)&&t4(e,n,t[n]);if(e4)for(var n of e4(t))_G.call(t,n)&&t4(e,n,t[n]);return e},Su=(e,t)=>SG(e,kG(t));const ku={in:{opacity:1,transform:"scale(1)"},out:{opacity:0,transform:`scale(.9) translateY(${Re(10)})`},transitionProperty:"transform, opacity"},ap={fade:{in:{opacity:1},out:{opacity:0},transitionProperty:"opacity"},scale:{in:{opacity:1,transform:"scale(1)"},out:{opacity:0,transform:"scale(0)"},common:{transformOrigin:"top"},transitionProperty:"transform, opacity"},"scale-y":{in:{opacity:1,transform:"scaleY(1)"},out:{opacity:0,transform:"scaleY(0)"},common:{transformOrigin:"top"},transitionProperty:"transform, opacity"},"scale-x":{in:{opacity:1,transform:"scaleX(1)"},out:{opacity:0,transform:"scaleX(0)"},common:{transformOrigin:"left"},transitionProperty:"transform, opacity"},"skew-up":{in:{opacity:1,transform:"translateY(0) skew(0deg, 0deg)"},out:{opacity:0,transform:`translateY(-${Re(20)}) skew(-10deg, -5deg)`},common:{transformOrigin:"top"},transitionProperty:"transform, opacity"},"skew-down":{in:{opacity:1,transform:"translateY(0) skew(0deg, 0deg)"},out:{opacity:0,transform:`translateY(${Re(20)}) skew(-10deg, -5deg)`},common:{transformOrigin:"bottom"},transitionProperty:"transform, opacity"},"rotate-left":{in:{opacity:1,transform:"translateY(0) rotate(0deg)"},out:{opacity:0,transform:`translateY(${Re(20)}) rotate(-5deg)`},common:{transformOrigin:"bottom"},transitionProperty:"transform, opacity"},"rotate-right":{in:{opacity:1,transform:"translateY(0) rotate(0deg)"},out:{opacity:0,transform:`translateY(${Re(20)}) rotate(5deg)`},common:{transformOrigin:"top"},transitionProperty:"transform, opacity"},"slide-down":{in:{opacity:1,transform:"translateY(0)"},out:{opacity:0,transform:"translateY(-100%)"},common:{transformOrigin:"top"},transitionProperty:"transform, opacity"},"slide-up":{in:{opacity:1,transform:"translateY(0)"},out:{opacity:0,transform:"translateY(100%)"},common:{transformOrigin:"bottom"},transitionProperty:"transform, opacity"},"slide-left":{in:{opacity:1,transform:"translateX(0)"},out:{opacity:0,transform:"translateX(100%)"},common:{transformOrigin:"left"},transitionProperty:"transform, opacity"},"slide-right":{in:{opacity:1,transform:"translateX(0)"},out:{opacity:0,transform:"translateX(-100%)"},common:{transformOrigin:"right"},transitionProperty:"transform, opacity"},pop:Su(wu({},ku),{common:{transformOrigin:"center center"}}),"pop-bottom-left":Su(wu({},ku),{common:{transformOrigin:"bottom left"}}),"pop-bottom-right":Su(wu({},ku),{common:{transformOrigin:"bottom right"}}),"pop-top-left":Su(wu({},ku),{common:{transformOrigin:"top left"}}),"pop-top-right":Su(wu({},ku),{common:{transformOrigin:"top right"}})},n4=["mousedown","touchstart"];function IG(e,t,n){const r=d.useRef();return d.useEffect(()=>{const o=s=>{const{target:i}=s??{};if(Array.isArray(n)){const l=(i==null?void 0:i.hasAttribute("data-ignore-outside-clicks"))||!document.body.contains(i)&&i.tagName!=="HTML";n.every(p=>!!p&&!s.composedPath().includes(p))&&!l&&e()}else r.current&&!r.current.contains(i)&&e()};return(t||n4).forEach(s=>document.addEventListener(s,o)),()=>{(t||n4).forEach(s=>document.removeEventListener(s,o))}},[r,e,n]),r}function PG(e,t){try{return e.addEventListener("change",t),()=>e.removeEventListener("change",t)}catch{return e.addListener(t),()=>e.removeListener(t)}}function EG(e,t){return typeof t=="boolean"?t:typeof window<"u"&&"matchMedia"in window?window.matchMedia(e).matches:!1}function MG(e,t,{getInitialValueInEffect:n}={getInitialValueInEffect:!0}){const[r,o]=d.useState(n?t:EG(e,t)),s=d.useRef();return d.useEffect(()=>{if("matchMedia"in window)return s.current=window.matchMedia(e),o(s.current.matches),PG(s.current,i=>o(i.matches))},[e]),r}const TP=typeof document<"u"?d.useLayoutEffect:d.useEffect;function Uo(e,t){const n=d.useRef(!1);d.useEffect(()=>()=>{n.current=!1},[]),d.useEffect(()=>{if(n.current)return e();n.current=!0},t)}function OG({opened:e,shouldReturnFocus:t=!0}){const n=d.useRef(),r=()=>{var o;n.current&&"focus"in n.current&&typeof n.current.focus=="function"&&((o=n.current)==null||o.focus({preventScroll:!0}))};return Uo(()=>{let o=-1;const s=i=>{i.key==="Tab"&&window.clearTimeout(o)};return document.addEventListener("keydown",s),e?n.current=document.activeElement:t&&(o=window.setTimeout(r,10)),()=>{window.clearTimeout(o),document.removeEventListener("keydown",s)}},[e,t]),r}const RG=/input|select|textarea|button|object/,NP="a, input, select, textarea, button, object, [tabindex]";function DG(e){return e.style.display==="none"}function AG(e){if(e.getAttribute("aria-hidden")||e.getAttribute("hidden")||e.getAttribute("type")==="hidden")return!1;let n=e;for(;n&&!(n===document.body||n.nodeType===11);){if(DG(n))return!1;n=n.parentNode}return!0}function $P(e){let t=e.getAttribute("tabindex");return t===null&&(t=void 0),parseInt(t,10)}function Z1(e){const t=e.nodeName.toLowerCase(),n=!Number.isNaN($P(e));return(RG.test(t)&&!e.disabled||e instanceof HTMLAnchorElement&&e.href||n)&&AG(e)}function LP(e){const t=$P(e);return(Number.isNaN(t)||t>=0)&&Z1(e)}function TG(e){return Array.from(e.querySelectorAll(NP)).filter(LP)}function NG(e,t){const n=TG(e);if(!n.length){t.preventDefault();return}const r=n[t.shiftKey?0:n.length-1],o=e.getRootNode();if(!(r===o.activeElement||e===o.activeElement))return;t.preventDefault();const i=n[t.shiftKey?n.length-1:0];i&&i.focus()}function Jb(){return`mantine-${Math.random().toString(36).slice(2,11)}`}function $G(e,t="body > :not(script)"){const n=Jb(),r=Array.from(document.querySelectorAll(t)).map(o=>{var s;if((s=o==null?void 0:o.shadowRoot)!=null&&s.contains(e)||o.contains(e))return;const i=o.getAttribute("aria-hidden"),l=o.getAttribute("data-hidden"),u=o.getAttribute("data-focus-id");return o.setAttribute("data-focus-id",n),i===null||i==="false"?o.setAttribute("aria-hidden","true"):!l&&!u&&o.setAttribute("data-hidden",i),{node:o,ariaHidden:l||null}});return()=>{r.forEach(o=>{!o||n!==o.node.getAttribute("data-focus-id")||(o.ariaHidden===null?o.node.removeAttribute("aria-hidden"):o.node.setAttribute("aria-hidden",o.ariaHidden),o.node.removeAttribute("data-focus-id"),o.node.removeAttribute("data-hidden"))})}}function LG(e=!0){const t=d.useRef(),n=d.useRef(null),r=s=>{let i=s.querySelector("[data-autofocus]");if(!i){const l=Array.from(s.querySelectorAll(NP));i=l.find(LP)||l.find(Z1)||null,!i&&Z1(s)&&(i=s)}i&&i.focus({preventScroll:!0})},o=d.useCallback(s=>{if(e){if(s===null){n.current&&(n.current(),n.current=null);return}n.current=$G(s),t.current!==s&&(s?(setTimeout(()=>{s.getRootNode()&&r(s)}),t.current=s):t.current=null)}},[e]);return d.useEffect(()=>{if(!e)return;t.current&&setTimeout(()=>r(t.current));const s=i=>{i.key==="Tab"&&t.current&&NG(t.current,i)};return document.addEventListener("keydown",s),()=>{document.removeEventListener("keydown",s),n.current&&n.current()}},[e]),o}const zG=H["useId".toString()]||(()=>{});function FG(){const e=zG();return e?`mantine-${e.replace(/:/g,"")}`:""}function ey(e){const t=FG(),[n,r]=d.useState(t);return TP(()=>{r(Jb())},[]),typeof e=="string"?e:typeof window>"u"?t:n}function r4(e,t,n){d.useEffect(()=>(window.addEventListener(e,t,n),()=>window.removeEventListener(e,t,n)),[e,t])}function zP(e,t){typeof e=="function"?e(t):typeof e=="object"&&e!==null&&"current"in e&&(e.current=t)}function BG(...e){return t=>{e.forEach(n=>zP(n,t))}}function Bd(...e){return d.useCallback(BG(...e),e)}function od({value:e,defaultValue:t,finalValue:n,onChange:r=()=>{}}){const[o,s]=d.useState(t!==void 0?t:n),i=l=>{s(l),r==null||r(l)};return e!==void 0?[e,r,!0]:[o,i,!1]}function FP(e,t){return MG("(prefers-reduced-motion: reduce)",e,t)}const HG=e=>e<.5?2*e*e:-1+(4-2*e)*e,VG=({axis:e,target:t,parent:n,alignment:r,offset:o,isList:s})=>{if(!t||!n&&typeof document>"u")return 0;const i=!!n,u=(n||document.body).getBoundingClientRect(),p=t.getBoundingClientRect(),m=h=>p[h]-u[h];if(e==="y"){const h=m("top");if(h===0)return 0;if(r==="start"){const x=h-o;return x<=p.height*(s?0:1)||!s?x:0}const g=i?u.height:window.innerHeight;if(r==="end"){const x=h+o-g+p.height;return x>=-p.height*(s?0:1)||!s?x:0}return r==="center"?h-g/2+p.height/2:0}if(e==="x"){const h=m("left");if(h===0)return 0;if(r==="start"){const x=h-o;return x<=p.width||!s?x:0}const g=i?u.width:window.innerWidth;if(r==="end"){const x=h+o-g+p.width;return x>=-p.width||!s?x:0}return r==="center"?h-g/2+p.width/2:0}return 0},WG=({axis:e,parent:t})=>{if(!t&&typeof document>"u")return 0;const n=e==="y"?"scrollTop":"scrollLeft";if(t)return t[n];const{body:r,documentElement:o}=document;return r[n]+o[n]},UG=({axis:e,parent:t,distance:n})=>{if(!t&&typeof document>"u")return;const r=e==="y"?"scrollTop":"scrollLeft";if(t)t[r]=n;else{const{body:o,documentElement:s}=document;o[r]=n,s[r]=n}};function BP({duration:e=1250,axis:t="y",onScrollFinish:n,easing:r=HG,offset:o=0,cancelable:s=!0,isList:i=!1}={}){const l=d.useRef(0),u=d.useRef(0),p=d.useRef(!1),m=d.useRef(null),h=d.useRef(null),g=FP(),x=()=>{l.current&&cancelAnimationFrame(l.current)},y=d.useCallback(({alignment:w="start"}={})=>{var S;p.current=!1,l.current&&x();const j=(S=WG({parent:m.current,axis:t}))!=null?S:0,_=VG({parent:m.current,target:h.current,axis:t,alignment:w,offset:o,isList:i})-(m.current?0:j);function E(){u.current===0&&(u.current=performance.now());const M=performance.now()-u.current,R=g||e===0?1:M/e,D=j+_*r(R);UG({parent:m.current,axis:t,distance:D}),!p.current&&R<1?l.current=requestAnimationFrame(E):(typeof n=="function"&&n(),u.current=0,l.current=0,x())}E()},[t,e,r,i,o,n,g]),b=()=>{s&&(p.current=!0)};return r4("wheel",b,{passive:!0}),r4("touchmove",b,{passive:!0}),d.useEffect(()=>x,[]),{scrollableRef:m,targetRef:h,scrollIntoView:y,cancel:x}}var o4=Object.getOwnPropertySymbols,GG=Object.prototype.hasOwnProperty,KG=Object.prototype.propertyIsEnumerable,qG=(e,t)=>{var n={};for(var r in e)GG.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&o4)for(var r of o4(e))t.indexOf(r)<0&&KG.call(e,r)&&(n[r]=e[r]);return n};function eg(e){const t=e,{m:n,mx:r,my:o,mt:s,mb:i,ml:l,mr:u,p,px:m,py:h,pt:g,pb:x,pl:y,pr:b,bg:w,c:S,opacity:j,ff:_,fz:E,fw:I,lts:M,ta:R,lh:D,fs:A,tt:O,td:T,w:X,miw:B,maw:V,h:U,mih:N,mah:$,bgsz:q,bgp:F,bgr:Q,bga:Y,pos:se,top:ae,left:re,bottom:G,right:K,inset:ee,display:ce}=t,J=qG(t,["m","mx","my","mt","mb","ml","mr","p","px","py","pt","pb","pl","pr","bg","c","opacity","ff","fz","fw","lts","ta","lh","fs","tt","td","w","miw","maw","h","mih","mah","bgsz","bgp","bgr","bga","pos","top","left","bottom","right","inset","display"]);return{systemStyles:F9({m:n,mx:r,my:o,mt:s,mb:i,ml:l,mr:u,p,px:m,py:h,pt:g,pb:x,pl:y,pr:b,bg:w,c:S,opacity:j,ff:_,fz:E,fw:I,lts:M,ta:R,lh:D,fs:A,tt:O,td:T,w:X,miw:B,maw:V,h:U,mih:N,mah:$,bgsz:q,bgp:F,bgr:Q,bga:Y,pos:se,top:ae,left:re,bottom:G,right:K,inset:ee,display:ce}),rest:J}}function XG(e,t){const n=Object.keys(e).filter(r=>r!=="base").sort((r,o)=>Uw(mt({size:r,sizes:t.breakpoints}))-Uw(mt({size:o,sizes:t.breakpoints})));return"base"in e?["base",...n]:n}function QG({value:e,theme:t,getValue:n,property:r}){if(e==null)return;if(typeof e=="object")return XG(e,t).reduce((i,l)=>{if(l==="base"&&e.base!==void 0){const p=n(e.base,t);return Array.isArray(r)?(r.forEach(m=>{i[m]=p}),i):(i[r]=p,i)}const u=n(e[l],t);return Array.isArray(r)?(i[t.fn.largerThan(l)]={},r.forEach(p=>{i[t.fn.largerThan(l)][p]=u}),i):(i[t.fn.largerThan(l)]={[r]:u},i)},{});const o=n(e,t);return Array.isArray(r)?r.reduce((s,i)=>(s[i]=o,s),{}):{[r]:o}}function YG(e,t){return e==="dimmed"?t.colorScheme==="dark"?t.colors.dark[2]:t.colors.gray[6]:t.fn.variant({variant:"filled",color:e,primaryFallback:!1}).background}function ZG(e){return Re(e)}function JG(e){return e}function eK(e,t){return mt({size:e,sizes:t.fontSizes})}const tK=["-xs","-sm","-md","-lg","-xl"];function nK(e,t){return tK.includes(e)?`calc(${mt({size:e.replace("-",""),sizes:t.spacing})} * -1)`:mt({size:e,sizes:t.spacing})}const rK={identity:JG,color:YG,size:ZG,fontSize:eK,spacing:nK},oK={m:{type:"spacing",property:"margin"},mt:{type:"spacing",property:"marginTop"},mb:{type:"spacing",property:"marginBottom"},ml:{type:"spacing",property:"marginLeft"},mr:{type:"spacing",property:"marginRight"},mx:{type:"spacing",property:["marginRight","marginLeft"]},my:{type:"spacing",property:["marginTop","marginBottom"]},p:{type:"spacing",property:"padding"},pt:{type:"spacing",property:"paddingTop"},pb:{type:"spacing",property:"paddingBottom"},pl:{type:"spacing",property:"paddingLeft"},pr:{type:"spacing",property:"paddingRight"},px:{type:"spacing",property:["paddingRight","paddingLeft"]},py:{type:"spacing",property:["paddingTop","paddingBottom"]},bg:{type:"color",property:"background"},c:{type:"color",property:"color"},opacity:{type:"identity",property:"opacity"},ff:{type:"identity",property:"fontFamily"},fz:{type:"fontSize",property:"fontSize"},fw:{type:"identity",property:"fontWeight"},lts:{type:"size",property:"letterSpacing"},ta:{type:"identity",property:"textAlign"},lh:{type:"identity",property:"lineHeight"},fs:{type:"identity",property:"fontStyle"},tt:{type:"identity",property:"textTransform"},td:{type:"identity",property:"textDecoration"},w:{type:"spacing",property:"width"},miw:{type:"spacing",property:"minWidth"},maw:{type:"spacing",property:"maxWidth"},h:{type:"spacing",property:"height"},mih:{type:"spacing",property:"minHeight"},mah:{type:"spacing",property:"maxHeight"},bgsz:{type:"size",property:"backgroundSize"},bgp:{type:"identity",property:"backgroundPosition"},bgr:{type:"identity",property:"backgroundRepeat"},bga:{type:"identity",property:"backgroundAttachment"},pos:{type:"identity",property:"position"},top:{type:"identity",property:"top"},left:{type:"size",property:"left"},bottom:{type:"size",property:"bottom"},right:{type:"size",property:"right"},inset:{type:"size",property:"inset"},display:{type:"identity",property:"display"}};var sK=Object.defineProperty,s4=Object.getOwnPropertySymbols,aK=Object.prototype.hasOwnProperty,iK=Object.prototype.propertyIsEnumerable,a4=(e,t,n)=>t in e?sK(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,i4=(e,t)=>{for(var n in t||(t={}))aK.call(t,n)&&a4(e,n,t[n]);if(s4)for(var n of s4(t))iK.call(t,n)&&a4(e,n,t[n]);return e};function l4(e,t,n=oK){return Object.keys(n).reduce((o,s)=>(s in e&&e[s]!==void 0&&o.push(QG({value:e[s],getValue:rK[n[s].type],property:n[s].property,theme:t})),o),[]).reduce((o,s)=>(Object.keys(s).forEach(i=>{typeof s[i]=="object"&&s[i]!==null&&i in o?o[i]=i4(i4({},o[i]),s[i]):o[i]=s[i]}),o),{})}function c4(e,t){return typeof e=="function"?e(t):e}function lK(e,t,n){const r=xa(),{css:o,cx:s}=AP();return Array.isArray(e)?s(n,o(l4(t,r)),e.map(i=>o(c4(i,r)))):s(n,o(c4(e,r)),o(l4(t,r)))}var cK=Object.defineProperty,pm=Object.getOwnPropertySymbols,HP=Object.prototype.hasOwnProperty,VP=Object.prototype.propertyIsEnumerable,u4=(e,t,n)=>t in e?cK(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,uK=(e,t)=>{for(var n in t||(t={}))HP.call(t,n)&&u4(e,n,t[n]);if(pm)for(var n of pm(t))VP.call(t,n)&&u4(e,n,t[n]);return e},dK=(e,t)=>{var n={};for(var r in e)HP.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&pm)for(var r of pm(e))t.indexOf(r)<0&&VP.call(e,r)&&(n[r]=e[r]);return n};const WP=d.forwardRef((e,t)=>{var n=e,{className:r,component:o,style:s,sx:i}=n,l=dK(n,["className","component","style","sx"]);const{systemStyles:u,rest:p}=eg(l),m=o||"div";return H.createElement(m,uK({ref:t,className:lK(i,u,r),style:s},p))});WP.displayName="@mantine/core/Box";const zr=WP;var fK=Object.defineProperty,pK=Object.defineProperties,mK=Object.getOwnPropertyDescriptors,d4=Object.getOwnPropertySymbols,hK=Object.prototype.hasOwnProperty,gK=Object.prototype.propertyIsEnumerable,f4=(e,t,n)=>t in e?fK(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,p4=(e,t)=>{for(var n in t||(t={}))hK.call(t,n)&&f4(e,n,t[n]);if(d4)for(var n of d4(t))gK.call(t,n)&&f4(e,n,t[n]);return e},vK=(e,t)=>pK(e,mK(t)),xK=fr(e=>({root:vK(p4(p4({},e.fn.focusStyles()),e.fn.fontStyles()),{cursor:"pointer",border:0,padding:0,appearance:"none",fontSize:e.fontSizes.md,backgroundColor:"transparent",textAlign:"left",color:e.colorScheme==="dark"?e.colors.dark[0]:e.black,textDecoration:"none",boxSizing:"border-box"})}));const bK=xK;var yK=Object.defineProperty,mm=Object.getOwnPropertySymbols,UP=Object.prototype.hasOwnProperty,GP=Object.prototype.propertyIsEnumerable,m4=(e,t,n)=>t in e?yK(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,CK=(e,t)=>{for(var n in t||(t={}))UP.call(t,n)&&m4(e,n,t[n]);if(mm)for(var n of mm(t))GP.call(t,n)&&m4(e,n,t[n]);return e},wK=(e,t)=>{var n={};for(var r in e)UP.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&mm)for(var r of mm(e))t.indexOf(r)<0&&GP.call(e,r)&&(n[r]=e[r]);return n};const KP=d.forwardRef((e,t)=>{const n=Rn("UnstyledButton",{},e),{className:r,component:o="button",unstyled:s,variant:i}=n,l=wK(n,["className","component","unstyled","variant"]),{classes:u,cx:p}=bK(null,{name:"UnstyledButton",unstyled:s,variant:i});return H.createElement(zr,CK({component:o,ref:t,className:p(u.root,r),type:o==="button"?"button":void 0},l))});KP.displayName="@mantine/core/UnstyledButton";const SK=KP;var kK=Object.defineProperty,jK=Object.defineProperties,_K=Object.getOwnPropertyDescriptors,h4=Object.getOwnPropertySymbols,IK=Object.prototype.hasOwnProperty,PK=Object.prototype.propertyIsEnumerable,g4=(e,t,n)=>t in e?kK(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,J1=(e,t)=>{for(var n in t||(t={}))IK.call(t,n)&&g4(e,n,t[n]);if(h4)for(var n of h4(t))PK.call(t,n)&&g4(e,n,t[n]);return e},v4=(e,t)=>jK(e,_K(t));const EK=["subtle","filled","outline","light","default","transparent","gradient"],ip={xs:Re(18),sm:Re(22),md:Re(28),lg:Re(34),xl:Re(44)};function MK({variant:e,theme:t,color:n,gradient:r}){const o=t.fn.variant({color:n,variant:e,gradient:r});return e==="gradient"?{border:0,backgroundImage:o.background,color:o.color,"&:hover":t.fn.hover({backgroundSize:"200%"})}:EK.includes(e)?J1({border:`${Re(1)} solid ${o.border}`,backgroundColor:o.background,color:o.color},t.fn.hover({backgroundColor:o.hover})):null}var OK=fr((e,{radius:t,color:n,gradient:r},{variant:o,size:s})=>({root:v4(J1({position:"relative",borderRadius:e.fn.radius(t),padding:0,lineHeight:1,display:"flex",alignItems:"center",justifyContent:"center",height:mt({size:s,sizes:ip}),minHeight:mt({size:s,sizes:ip}),width:mt({size:s,sizes:ip}),minWidth:mt({size:s,sizes:ip})},MK({variant:o,theme:e,color:n,gradient:r})),{"&:active":e.activeStyles,"& [data-action-icon-loader]":{maxWidth:"70%"},"&:disabled, &[data-disabled]":{color:e.colors.gray[e.colorScheme==="dark"?6:4],cursor:"not-allowed",backgroundColor:o==="transparent"?void 0:e.fn.themeColor("gray",e.colorScheme==="dark"?8:1),borderColor:o==="transparent"?void 0:e.fn.themeColor("gray",e.colorScheme==="dark"?8:1),backgroundImage:"none",pointerEvents:"none","&:active":{transform:"none"}},"&[data-loading]":{pointerEvents:"none","&::before":v4(J1({content:'""'},e.fn.cover(Re(-1))),{backgroundColor:e.colorScheme==="dark"?e.fn.rgba(e.colors.dark[7],.5):"rgba(255, 255, 255, .5)",borderRadius:e.fn.radius(t),cursor:"not-allowed"})}})}));const RK=OK;var DK=Object.defineProperty,hm=Object.getOwnPropertySymbols,qP=Object.prototype.hasOwnProperty,XP=Object.prototype.propertyIsEnumerable,x4=(e,t,n)=>t in e?DK(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,b4=(e,t)=>{for(var n in t||(t={}))qP.call(t,n)&&x4(e,n,t[n]);if(hm)for(var n of hm(t))XP.call(t,n)&&x4(e,n,t[n]);return e},y4=(e,t)=>{var n={};for(var r in e)qP.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&hm)for(var r of hm(e))t.indexOf(r)<0&&XP.call(e,r)&&(n[r]=e[r]);return n};function AK(e){var t=e,{size:n,color:r}=t,o=y4(t,["size","color"]);const s=o,{style:i}=s,l=y4(s,["style"]);return H.createElement("svg",b4({viewBox:"0 0 135 140",xmlns:"http://www.w3.org/2000/svg",fill:r,style:b4({width:n},i)},l),H.createElement("rect",{y:"10",width:"15",height:"120",rx:"6"},H.createElement("animate",{attributeName:"height",begin:"0.5s",dur:"1s",values:"120;110;100;90;80;70;60;50;40;140;120",calcMode:"linear",repeatCount:"indefinite"}),H.createElement("animate",{attributeName:"y",begin:"0.5s",dur:"1s",values:"10;15;20;25;30;35;40;45;50;0;10",calcMode:"linear",repeatCount:"indefinite"})),H.createElement("rect",{x:"30",y:"10",width:"15",height:"120",rx:"6"},H.createElement("animate",{attributeName:"height",begin:"0.25s",dur:"1s",values:"120;110;100;90;80;70;60;50;40;140;120",calcMode:"linear",repeatCount:"indefinite"}),H.createElement("animate",{attributeName:"y",begin:"0.25s",dur:"1s",values:"10;15;20;25;30;35;40;45;50;0;10",calcMode:"linear",repeatCount:"indefinite"})),H.createElement("rect",{x:"60",width:"15",height:"140",rx:"6"},H.createElement("animate",{attributeName:"height",begin:"0s",dur:"1s",values:"120;110;100;90;80;70;60;50;40;140;120",calcMode:"linear",repeatCount:"indefinite"}),H.createElement("animate",{attributeName:"y",begin:"0s",dur:"1s",values:"10;15;20;25;30;35;40;45;50;0;10",calcMode:"linear",repeatCount:"indefinite"})),H.createElement("rect",{x:"90",y:"10",width:"15",height:"120",rx:"6"},H.createElement("animate",{attributeName:"height",begin:"0.25s",dur:"1s",values:"120;110;100;90;80;70;60;50;40;140;120",calcMode:"linear",repeatCount:"indefinite"}),H.createElement("animate",{attributeName:"y",begin:"0.25s",dur:"1s",values:"10;15;20;25;30;35;40;45;50;0;10",calcMode:"linear",repeatCount:"indefinite"})),H.createElement("rect",{x:"120",y:"10",width:"15",height:"120",rx:"6"},H.createElement("animate",{attributeName:"height",begin:"0.5s",dur:"1s",values:"120;110;100;90;80;70;60;50;40;140;120",calcMode:"linear",repeatCount:"indefinite"}),H.createElement("animate",{attributeName:"y",begin:"0.5s",dur:"1s",values:"10;15;20;25;30;35;40;45;50;0;10",calcMode:"linear",repeatCount:"indefinite"})))}var TK=Object.defineProperty,gm=Object.getOwnPropertySymbols,QP=Object.prototype.hasOwnProperty,YP=Object.prototype.propertyIsEnumerable,C4=(e,t,n)=>t in e?TK(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,w4=(e,t)=>{for(var n in t||(t={}))QP.call(t,n)&&C4(e,n,t[n]);if(gm)for(var n of gm(t))YP.call(t,n)&&C4(e,n,t[n]);return e},S4=(e,t)=>{var n={};for(var r in e)QP.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&gm)for(var r of gm(e))t.indexOf(r)<0&&YP.call(e,r)&&(n[r]=e[r]);return n};function NK(e){var t=e,{size:n,color:r}=t,o=S4(t,["size","color"]);const s=o,{style:i}=s,l=S4(s,["style"]);return H.createElement("svg",w4({viewBox:"0 0 38 38",xmlns:"http://www.w3.org/2000/svg",stroke:r,style:w4({width:n,height:n},i)},l),H.createElement("g",{fill:"none",fillRule:"evenodd"},H.createElement("g",{transform:"translate(2.5 2.5)",strokeWidth:"5"},H.createElement("circle",{strokeOpacity:".5",cx:"16",cy:"16",r:"16"}),H.createElement("path",{d:"M32 16c0-9.94-8.06-16-16-16"},H.createElement("animateTransform",{attributeName:"transform",type:"rotate",from:"0 16 16",to:"360 16 16",dur:"1s",repeatCount:"indefinite"})))))}var $K=Object.defineProperty,vm=Object.getOwnPropertySymbols,ZP=Object.prototype.hasOwnProperty,JP=Object.prototype.propertyIsEnumerable,k4=(e,t,n)=>t in e?$K(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,j4=(e,t)=>{for(var n in t||(t={}))ZP.call(t,n)&&k4(e,n,t[n]);if(vm)for(var n of vm(t))JP.call(t,n)&&k4(e,n,t[n]);return e},_4=(e,t)=>{var n={};for(var r in e)ZP.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&vm)for(var r of vm(e))t.indexOf(r)<0&&JP.call(e,r)&&(n[r]=e[r]);return n};function LK(e){var t=e,{size:n,color:r}=t,o=_4(t,["size","color"]);const s=o,{style:i}=s,l=_4(s,["style"]);return H.createElement("svg",j4({viewBox:"0 0 120 30",xmlns:"http://www.w3.org/2000/svg",fill:r,style:j4({width:n},i)},l),H.createElement("circle",{cx:"15",cy:"15",r:"15"},H.createElement("animate",{attributeName:"r",from:"15",to:"15",begin:"0s",dur:"0.8s",values:"15;9;15",calcMode:"linear",repeatCount:"indefinite"}),H.createElement("animate",{attributeName:"fill-opacity",from:"1",to:"1",begin:"0s",dur:"0.8s",values:"1;.5;1",calcMode:"linear",repeatCount:"indefinite"})),H.createElement("circle",{cx:"60",cy:"15",r:"9",fillOpacity:"0.3"},H.createElement("animate",{attributeName:"r",from:"9",to:"9",begin:"0s",dur:"0.8s",values:"9;15;9",calcMode:"linear",repeatCount:"indefinite"}),H.createElement("animate",{attributeName:"fill-opacity",from:"0.5",to:"0.5",begin:"0s",dur:"0.8s",values:".5;1;.5",calcMode:"linear",repeatCount:"indefinite"})),H.createElement("circle",{cx:"105",cy:"15",r:"15"},H.createElement("animate",{attributeName:"r",from:"15",to:"15",begin:"0s",dur:"0.8s",values:"15;9;15",calcMode:"linear",repeatCount:"indefinite"}),H.createElement("animate",{attributeName:"fill-opacity",from:"1",to:"1",begin:"0s",dur:"0.8s",values:"1;.5;1",calcMode:"linear",repeatCount:"indefinite"})))}var zK=Object.defineProperty,xm=Object.getOwnPropertySymbols,e6=Object.prototype.hasOwnProperty,t6=Object.prototype.propertyIsEnumerable,I4=(e,t,n)=>t in e?zK(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,FK=(e,t)=>{for(var n in t||(t={}))e6.call(t,n)&&I4(e,n,t[n]);if(xm)for(var n of xm(t))t6.call(t,n)&&I4(e,n,t[n]);return e},BK=(e,t)=>{var n={};for(var r in e)e6.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&xm)for(var r of xm(e))t.indexOf(r)<0&&t6.call(e,r)&&(n[r]=e[r]);return n};const _v={bars:AK,oval:NK,dots:LK},HK={xs:Re(18),sm:Re(22),md:Re(36),lg:Re(44),xl:Re(58)},VK={size:"md"};function n6(e){const t=Rn("Loader",VK,e),{size:n,color:r,variant:o}=t,s=BK(t,["size","color","variant"]),i=xa(),l=o in _v?o:i.loader;return H.createElement(zr,FK({role:"presentation",component:_v[l]||_v.bars,size:mt({size:n,sizes:HK}),color:i.fn.variant({variant:"filled",primaryFallback:!1,color:r||i.primaryColor}).background},s))}n6.displayName="@mantine/core/Loader";var WK=Object.defineProperty,bm=Object.getOwnPropertySymbols,r6=Object.prototype.hasOwnProperty,o6=Object.prototype.propertyIsEnumerable,P4=(e,t,n)=>t in e?WK(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,E4=(e,t)=>{for(var n in t||(t={}))r6.call(t,n)&&P4(e,n,t[n]);if(bm)for(var n of bm(t))o6.call(t,n)&&P4(e,n,t[n]);return e},UK=(e,t)=>{var n={};for(var r in e)r6.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&bm)for(var r of bm(e))t.indexOf(r)<0&&o6.call(e,r)&&(n[r]=e[r]);return n};const GK={color:"gray",size:"md",variant:"subtle"},s6=d.forwardRef((e,t)=>{const n=Rn("ActionIcon",GK,e),{className:r,color:o,children:s,radius:i,size:l,variant:u,gradient:p,disabled:m,loaderProps:h,loading:g,unstyled:x,__staticSelector:y}=n,b=UK(n,["className","color","children","radius","size","variant","gradient","disabled","loaderProps","loading","unstyled","__staticSelector"]),{classes:w,cx:S,theme:j}=RK({radius:i,color:o,gradient:p},{name:["ActionIcon",y],unstyled:x,size:l,variant:u}),_=H.createElement(n6,E4({color:j.fn.variant({color:o,variant:u}).color,size:"100%","data-action-icon-loader":!0},h));return H.createElement(SK,E4({className:S(w.root,r),ref:t,disabled:m,"data-disabled":m||void 0,"data-loading":g||void 0,unstyled:x},b),g?_:s)});s6.displayName="@mantine/core/ActionIcon";const KK=s6;var qK=Object.defineProperty,XK=Object.defineProperties,QK=Object.getOwnPropertyDescriptors,ym=Object.getOwnPropertySymbols,a6=Object.prototype.hasOwnProperty,i6=Object.prototype.propertyIsEnumerable,M4=(e,t,n)=>t in e?qK(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,YK=(e,t)=>{for(var n in t||(t={}))a6.call(t,n)&&M4(e,n,t[n]);if(ym)for(var n of ym(t))i6.call(t,n)&&M4(e,n,t[n]);return e},ZK=(e,t)=>XK(e,QK(t)),JK=(e,t)=>{var n={};for(var r in e)a6.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&ym)for(var r of ym(e))t.indexOf(r)<0&&i6.call(e,r)&&(n[r]=e[r]);return n};function l6(e){const t=Rn("Portal",{},e),{children:n,target:r,className:o,innerRef:s}=t,i=JK(t,["children","target","className","innerRef"]),l=xa(),[u,p]=d.useState(!1),m=d.useRef();return TP(()=>(p(!0),m.current=r?typeof r=="string"?document.querySelector(r):r:document.createElement("div"),r||document.body.appendChild(m.current),()=>{!r&&document.body.removeChild(m.current)}),[r]),u?qr.createPortal(H.createElement("div",ZK(YK({className:o,dir:l.dir},i),{ref:s}),n),m.current):null}l6.displayName="@mantine/core/Portal";var eq=Object.defineProperty,Cm=Object.getOwnPropertySymbols,c6=Object.prototype.hasOwnProperty,u6=Object.prototype.propertyIsEnumerable,O4=(e,t,n)=>t in e?eq(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,tq=(e,t)=>{for(var n in t||(t={}))c6.call(t,n)&&O4(e,n,t[n]);if(Cm)for(var n of Cm(t))u6.call(t,n)&&O4(e,n,t[n]);return e},nq=(e,t)=>{var n={};for(var r in e)c6.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Cm)for(var r of Cm(e))t.indexOf(r)<0&&u6.call(e,r)&&(n[r]=e[r]);return n};function d6(e){var t=e,{withinPortal:n=!0,children:r}=t,o=nq(t,["withinPortal","children"]);return n?H.createElement(l6,tq({},o),r):H.createElement(H.Fragment,null,r)}d6.displayName="@mantine/core/OptionalPortal";var rq=Object.defineProperty,wm=Object.getOwnPropertySymbols,f6=Object.prototype.hasOwnProperty,p6=Object.prototype.propertyIsEnumerable,R4=(e,t,n)=>t in e?rq(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,D4=(e,t)=>{for(var n in t||(t={}))f6.call(t,n)&&R4(e,n,t[n]);if(wm)for(var n of wm(t))p6.call(t,n)&&R4(e,n,t[n]);return e},oq=(e,t)=>{var n={};for(var r in e)f6.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&wm)for(var r of wm(e))t.indexOf(r)<0&&p6.call(e,r)&&(n[r]=e[r]);return n};function m6(e){const t=e,{width:n,height:r,style:o}=t,s=oq(t,["width","height","style"]);return H.createElement("svg",D4({viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:D4({width:n,height:r},o)},s),H.createElement("path",{d:"M11.7816 4.03157C12.0062 3.80702 12.0062 3.44295 11.7816 3.2184C11.5571 2.99385 11.193 2.99385 10.9685 3.2184L7.50005 6.68682L4.03164 3.2184C3.80708 2.99385 3.44301 2.99385 3.21846 3.2184C2.99391 3.44295 2.99391 3.80702 3.21846 4.03157L6.68688 7.49999L3.21846 10.9684C2.99391 11.193 2.99391 11.557 3.21846 11.7816C3.44301 12.0061 3.80708 12.0061 4.03164 11.7816L7.50005 8.31316L10.9685 11.7816C11.193 12.0061 11.5571 12.0061 11.7816 11.7816C12.0062 11.557 12.0062 11.193 11.7816 10.9684L8.31322 7.49999L11.7816 4.03157Z",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd"}))}m6.displayName="@mantine/core/CloseIcon";var sq=Object.defineProperty,Sm=Object.getOwnPropertySymbols,h6=Object.prototype.hasOwnProperty,g6=Object.prototype.propertyIsEnumerable,A4=(e,t,n)=>t in e?sq(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,aq=(e,t)=>{for(var n in t||(t={}))h6.call(t,n)&&A4(e,n,t[n]);if(Sm)for(var n of Sm(t))g6.call(t,n)&&A4(e,n,t[n]);return e},iq=(e,t)=>{var n={};for(var r in e)h6.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Sm)for(var r of Sm(e))t.indexOf(r)<0&&g6.call(e,r)&&(n[r]=e[r]);return n};const lq={xs:Re(12),sm:Re(16),md:Re(20),lg:Re(28),xl:Re(34)},cq={size:"sm"},v6=d.forwardRef((e,t)=>{const n=Rn("CloseButton",cq,e),{iconSize:r,size:o,children:s}=n,i=iq(n,["iconSize","size","children"]),l=Re(r||lq[o]);return H.createElement(KK,aq({ref:t,__staticSelector:"CloseButton",size:o},i),s||H.createElement(m6,{width:l,height:l}))});v6.displayName="@mantine/core/CloseButton";const x6=v6;var uq=Object.defineProperty,dq=Object.defineProperties,fq=Object.getOwnPropertyDescriptors,T4=Object.getOwnPropertySymbols,pq=Object.prototype.hasOwnProperty,mq=Object.prototype.propertyIsEnumerable,N4=(e,t,n)=>t in e?uq(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,lp=(e,t)=>{for(var n in t||(t={}))pq.call(t,n)&&N4(e,n,t[n]);if(T4)for(var n of T4(t))mq.call(t,n)&&N4(e,n,t[n]);return e},hq=(e,t)=>dq(e,fq(t));function gq({underline:e,strikethrough:t}){const n=[];return e&&n.push("underline"),t&&n.push("line-through"),n.length>0?n.join(" "):"none"}function vq({theme:e,color:t}){return t==="dimmed"?e.fn.dimmed():typeof t=="string"&&(t in e.colors||t.split(".")[0]in e.colors)?e.fn.variant({variant:"filled",color:t}).background:t||"inherit"}function xq(e){return typeof e=="number"?{overflow:"hidden",textOverflow:"ellipsis",display:"-webkit-box",WebkitLineClamp:e,WebkitBoxOrient:"vertical"}:null}function bq({theme:e,truncate:t}){return t==="start"?{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",direction:e.dir==="ltr"?"rtl":"ltr",textAlign:e.dir==="ltr"?"right":"left"}:t?{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}:null}var yq=fr((e,{color:t,lineClamp:n,truncate:r,inline:o,inherit:s,underline:i,gradient:l,weight:u,transform:p,align:m,strikethrough:h,italic:g},{size:x})=>{const y=e.fn.variant({variant:"gradient",gradient:l});return{root:hq(lp(lp(lp(lp({},e.fn.fontStyles()),e.fn.focusStyles()),xq(n)),bq({theme:e,truncate:r})),{color:vq({color:t,theme:e}),fontFamily:s?"inherit":e.fontFamily,fontSize:s||x===void 0?"inherit":mt({size:x,sizes:e.fontSizes}),lineHeight:s?"inherit":o?1:e.lineHeight,textDecoration:gq({underline:i,strikethrough:h}),WebkitTapHighlightColor:"transparent",fontWeight:s?"inherit":u,textTransform:p,textAlign:m,fontStyle:g?"italic":void 0}),gradient:{backgroundImage:y.background,WebkitBackgroundClip:"text",WebkitTextFillColor:"transparent"}}});const Cq=yq;var wq=Object.defineProperty,km=Object.getOwnPropertySymbols,b6=Object.prototype.hasOwnProperty,y6=Object.prototype.propertyIsEnumerable,$4=(e,t,n)=>t in e?wq(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Sq=(e,t)=>{for(var n in t||(t={}))b6.call(t,n)&&$4(e,n,t[n]);if(km)for(var n of km(t))y6.call(t,n)&&$4(e,n,t[n]);return e},kq=(e,t)=>{var n={};for(var r in e)b6.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&km)for(var r of km(e))t.indexOf(r)<0&&y6.call(e,r)&&(n[r]=e[r]);return n};const jq={variant:"text"},C6=d.forwardRef((e,t)=>{const n=Rn("Text",jq,e),{className:r,size:o,weight:s,transform:i,color:l,align:u,variant:p,lineClamp:m,truncate:h,gradient:g,inline:x,inherit:y,underline:b,strikethrough:w,italic:S,classNames:j,styles:_,unstyled:E,span:I,__staticSelector:M}=n,R=kq(n,["className","size","weight","transform","color","align","variant","lineClamp","truncate","gradient","inline","inherit","underline","strikethrough","italic","classNames","styles","unstyled","span","__staticSelector"]),{classes:D,cx:A}=Cq({color:l,lineClamp:m,truncate:h,inline:x,inherit:y,underline:b,strikethrough:w,italic:S,weight:s,transform:i,align:u,gradient:g},{unstyled:E,name:M||"Text",variant:p,size:o});return H.createElement(zr,Sq({ref:t,className:A(D.root,{[D.gradient]:p==="gradient"},r),component:I?"span":"div"},R))});C6.displayName="@mantine/core/Text";const wc=C6,cp={xs:Re(1),sm:Re(2),md:Re(3),lg:Re(4),xl:Re(5)};function up(e,t){const n=e.fn.variant({variant:"outline",color:t}).border;return typeof t=="string"&&(t in e.colors||t.split(".")[0]in e.colors)?n:t===void 0?e.colorScheme==="dark"?e.colors.dark[4]:e.colors.gray[4]:t}var _q=fr((e,{color:t},{size:n,variant:r})=>({root:{},withLabel:{borderTop:"0 !important"},left:{"&::before":{display:"none"}},right:{"&::after":{display:"none"}},label:{display:"flex",alignItems:"center","&::before":{content:'""',flex:1,height:Re(1),borderTop:`${mt({size:n,sizes:cp})} ${r} ${up(e,t)}`,marginRight:e.spacing.xs},"&::after":{content:'""',flex:1,borderTop:`${mt({size:n,sizes:cp})} ${r} ${up(e,t)}`,marginLeft:e.spacing.xs}},labelDefaultStyles:{color:t==="dark"?e.colors.dark[1]:e.fn.themeColor(t,e.colorScheme==="dark"?5:e.fn.primaryShade(),!1)},horizontal:{border:0,borderTopWidth:Re(mt({size:n,sizes:cp})),borderTopColor:up(e,t),borderTopStyle:r,margin:0},vertical:{border:0,alignSelf:"stretch",height:"auto",borderLeftWidth:Re(mt({size:n,sizes:cp})),borderLeftColor:up(e,t),borderLeftStyle:r}}));const Iq=_q;var Pq=Object.defineProperty,Eq=Object.defineProperties,Mq=Object.getOwnPropertyDescriptors,jm=Object.getOwnPropertySymbols,w6=Object.prototype.hasOwnProperty,S6=Object.prototype.propertyIsEnumerable,L4=(e,t,n)=>t in e?Pq(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,z4=(e,t)=>{for(var n in t||(t={}))w6.call(t,n)&&L4(e,n,t[n]);if(jm)for(var n of jm(t))S6.call(t,n)&&L4(e,n,t[n]);return e},Oq=(e,t)=>Eq(e,Mq(t)),Rq=(e,t)=>{var n={};for(var r in e)w6.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&jm)for(var r of jm(e))t.indexOf(r)<0&&S6.call(e,r)&&(n[r]=e[r]);return n};const Dq={orientation:"horizontal",size:"xs",labelPosition:"left",variant:"solid"},ex=d.forwardRef((e,t)=>{const n=Rn("Divider",Dq,e),{className:r,color:o,orientation:s,size:i,label:l,labelPosition:u,labelProps:p,variant:m,styles:h,classNames:g,unstyled:x}=n,y=Rq(n,["className","color","orientation","size","label","labelPosition","labelProps","variant","styles","classNames","unstyled"]),{classes:b,cx:w}=Iq({color:o},{classNames:g,styles:h,unstyled:x,name:"Divider",variant:m,size:i}),S=s==="vertical",j=s==="horizontal",_=!!l&&j,E=!(p!=null&&p.color);return H.createElement(zr,z4({ref:t,className:w(b.root,{[b.vertical]:S,[b.horizontal]:j,[b.withLabel]:_},r),role:"separator"},y),_&&H.createElement(wc,Oq(z4({},p),{size:(p==null?void 0:p.size)||"xs",mt:Re(2),className:w(b.label,b[u],{[b.labelDefaultStyles]:E})}),l))});ex.displayName="@mantine/core/Divider";var Aq=Object.defineProperty,Tq=Object.defineProperties,Nq=Object.getOwnPropertyDescriptors,F4=Object.getOwnPropertySymbols,$q=Object.prototype.hasOwnProperty,Lq=Object.prototype.propertyIsEnumerable,B4=(e,t,n)=>t in e?Aq(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,H4=(e,t)=>{for(var n in t||(t={}))$q.call(t,n)&&B4(e,n,t[n]);if(F4)for(var n of F4(t))Lq.call(t,n)&&B4(e,n,t[n]);return e},zq=(e,t)=>Tq(e,Nq(t)),Fq=fr((e,t,{size:n})=>({item:zq(H4({},e.fn.fontStyles()),{boxSizing:"border-box",wordBreak:"break-all",textAlign:"left",width:"100%",padding:`calc(${mt({size:n,sizes:e.spacing})} / 1.5) ${mt({size:n,sizes:e.spacing})}`,cursor:"pointer",fontSize:mt({size:n,sizes:e.fontSizes}),color:e.colorScheme==="dark"?e.colors.dark[0]:e.black,borderRadius:e.fn.radius(),"&[data-hovered]":{backgroundColor:e.colorScheme==="dark"?e.colors.dark[4]:e.colors.gray[1]},"&[data-selected]":H4({backgroundColor:e.fn.variant({variant:"filled"}).background,color:e.fn.variant({variant:"filled"}).color},e.fn.hover({backgroundColor:e.fn.variant({variant:"filled"}).hover})),"&[data-disabled]":{cursor:"default",color:e.colors.dark[2]}}),nothingFound:{boxSizing:"border-box",color:e.colors.gray[6],paddingTop:`calc(${mt({size:n,sizes:e.spacing})} / 2)`,paddingBottom:`calc(${mt({size:n,sizes:e.spacing})} / 2)`,textAlign:"center"},separator:{boxSizing:"border-box",textAlign:"left",width:"100%",padding:`calc(${mt({size:n,sizes:e.spacing})} / 1.5) ${mt({size:n,sizes:e.spacing})}`},separatorLabel:{color:e.colorScheme==="dark"?e.colors.dark[3]:e.colors.gray[5]}}));const Bq=Fq;var Hq=Object.defineProperty,V4=Object.getOwnPropertySymbols,Vq=Object.prototype.hasOwnProperty,Wq=Object.prototype.propertyIsEnumerable,W4=(e,t,n)=>t in e?Hq(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Uq=(e,t)=>{for(var n in t||(t={}))Vq.call(t,n)&&W4(e,n,t[n]);if(V4)for(var n of V4(t))Wq.call(t,n)&&W4(e,n,t[n]);return e};function ty({data:e,hovered:t,classNames:n,styles:r,isItemSelected:o,uuid:s,__staticSelector:i,onItemHover:l,onItemSelect:u,itemsRefs:p,itemComponent:m,size:h,nothingFound:g,creatable:x,createLabel:y,unstyled:b,variant:w}){const{classes:S}=Bq(null,{classNames:n,styles:r,unstyled:b,name:i,variant:w,size:h}),j=[],_=[];let E=null;const I=(R,D)=>{const A=typeof o=="function"?o(R.value):!1;return H.createElement(m,Uq({key:R.value,className:S.item,"data-disabled":R.disabled||void 0,"data-hovered":!R.disabled&&t===D||void 0,"data-selected":!R.disabled&&A||void 0,selected:A,onMouseEnter:()=>l(D),id:`${s}-${D}`,role:"option",tabIndex:-1,"aria-selected":t===D,ref:O=>{p&&p.current&&(p.current[R.value]=O)},onMouseDown:R.disabled?null:O=>{O.preventDefault(),u(R)},disabled:R.disabled,variant:w},R))};let M=null;if(e.forEach((R,D)=>{R.creatable?E=D:R.group?(M!==R.group&&(M=R.group,_.push(H.createElement("div",{className:S.separator,key:`__mantine-divider-${D}`},H.createElement(ex,{classNames:{label:S.separatorLabel},label:R.group})))),_.push(I(R,D))):j.push(I(R,D))}),x){const R=e[E];j.push(H.createElement("div",{key:Jb(),className:S.item,"data-hovered":t===E||void 0,onMouseEnter:()=>l(E),onMouseDown:D=>{D.preventDefault(),u(R)},tabIndex:-1,ref:D=>{p&&p.current&&(p.current[R.value]=D)}},y))}return _.length>0&&j.length>0&&j.unshift(H.createElement("div",{className:S.separator,key:"empty-group-separator"},H.createElement(ex,null))),_.length>0||j.length>0?H.createElement(H.Fragment,null,_,j):H.createElement(wc,{size:h,unstyled:b,className:S.nothingFound},g)}ty.displayName="@mantine/core/SelectItems";var Gq=Object.defineProperty,_m=Object.getOwnPropertySymbols,k6=Object.prototype.hasOwnProperty,j6=Object.prototype.propertyIsEnumerable,U4=(e,t,n)=>t in e?Gq(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Kq=(e,t)=>{for(var n in t||(t={}))k6.call(t,n)&&U4(e,n,t[n]);if(_m)for(var n of _m(t))j6.call(t,n)&&U4(e,n,t[n]);return e},qq=(e,t)=>{var n={};for(var r in e)k6.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&_m)for(var r of _m(e))t.indexOf(r)<0&&j6.call(e,r)&&(n[r]=e[r]);return n};const ny=d.forwardRef((e,t)=>{var n=e,{label:r,value:o}=n,s=qq(n,["label","value"]);return H.createElement("div",Kq({ref:t},s),r||o)});ny.displayName="@mantine/core/DefaultItem";function Xq(e,t){typeof e=="function"?e(t):e!=null&&(e.current=t)}function _6(...e){return t=>e.forEach(n=>Xq(n,t))}function al(...e){return d.useCallback(_6(...e),e)}const I6=d.forwardRef((e,t)=>{const{children:n,...r}=e,o=d.Children.toArray(n),s=o.find(Yq);if(s){const i=s.props.children,l=o.map(u=>u===s?d.Children.count(i)>1?d.Children.only(null):d.isValidElement(i)?i.props.children:null:u);return d.createElement(tx,pn({},r,{ref:t}),d.isValidElement(i)?d.cloneElement(i,void 0,l):null)}return d.createElement(tx,pn({},r,{ref:t}),n)});I6.displayName="Slot";const tx=d.forwardRef((e,t)=>{const{children:n,...r}=e;return d.isValidElement(n)?d.cloneElement(n,{...Zq(r,n.props),ref:_6(t,n.ref)}):d.Children.count(n)>1?d.Children.only(null):null});tx.displayName="SlotClone";const Qq=({children:e})=>d.createElement(d.Fragment,null,e);function Yq(e){return d.isValidElement(e)&&e.type===Qq}function Zq(e,t){const n={...t};for(const r in t){const o=e[r],s=t[r];/^on[A-Z]/.test(r)?o&&s?n[r]=(...l)=>{s(...l),o(...l)}:o&&(n[r]=o):r==="style"?n[r]={...o,...s}:r==="className"&&(n[r]=[o,s].filter(Boolean).join(" "))}return{...e,...n}}const Jq=["a","button","div","h2","h3","img","label","li","nav","ol","p","span","svg","ul"],Hd=Jq.reduce((e,t)=>{const n=d.forwardRef((r,o)=>{const{asChild:s,...i}=r,l=s?I6:t;return d.useEffect(()=>{window[Symbol.for("radix-ui")]=!0},[]),d.createElement(l,pn({},i,{ref:o}))});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{}),nx=globalThis!=null&&globalThis.document?d.useLayoutEffect:()=>{};function eX(e,t){return d.useReducer((n,r)=>{const o=t[n][r];return o??n},e)}const Vd=e=>{const{present:t,children:n}=e,r=tX(t),o=typeof n=="function"?n({present:r.isPresent}):d.Children.only(n),s=al(r.ref,o.ref);return typeof n=="function"||r.isPresent?d.cloneElement(o,{ref:s}):null};Vd.displayName="Presence";function tX(e){const[t,n]=d.useState(),r=d.useRef({}),o=d.useRef(e),s=d.useRef("none"),i=e?"mounted":"unmounted",[l,u]=eX(i,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return d.useEffect(()=>{const p=dp(r.current);s.current=l==="mounted"?p:"none"},[l]),nx(()=>{const p=r.current,m=o.current;if(m!==e){const g=s.current,x=dp(p);e?u("MOUNT"):x==="none"||(p==null?void 0:p.display)==="none"?u("UNMOUNT"):u(m&&g!==x?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,u]),nx(()=>{if(t){const p=h=>{const x=dp(r.current).includes(h.animationName);h.target===t&&x&&qr.flushSync(()=>u("ANIMATION_END"))},m=h=>{h.target===t&&(s.current=dp(r.current))};return t.addEventListener("animationstart",m),t.addEventListener("animationcancel",p),t.addEventListener("animationend",p),()=>{t.removeEventListener("animationstart",m),t.removeEventListener("animationcancel",p),t.removeEventListener("animationend",p)}}else u("ANIMATION_END")},[t,u]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:d.useCallback(p=>{p&&(r.current=getComputedStyle(p)),n(p)},[])}}function dp(e){return(e==null?void 0:e.animationName)||"none"}function nX(e,t=[]){let n=[];function r(s,i){const l=d.createContext(i),u=n.length;n=[...n,i];function p(h){const{scope:g,children:x,...y}=h,b=(g==null?void 0:g[e][u])||l,w=d.useMemo(()=>y,Object.values(y));return d.createElement(b.Provider,{value:w},x)}function m(h,g){const x=(g==null?void 0:g[e][u])||l,y=d.useContext(x);if(y)return y;if(i!==void 0)return i;throw new Error(`\`${h}\` must be used within \`${s}\``)}return p.displayName=s+"Provider",[p,m]}const o=()=>{const s=n.map(i=>d.createContext(i));return function(l){const u=(l==null?void 0:l[e])||s;return d.useMemo(()=>({[`__scope${e}`]:{...l,[e]:u}}),[l,u])}};return o.scopeName=e,[r,rX(o,...t)]}function rX(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(s){const i=r.reduce((l,{useScope:u,scopeName:p})=>{const h=u(s)[`__scope${p}`];return{...l,...h}},{});return d.useMemo(()=>({[`__scope${t.scopeName}`]:i}),[i])}};return n.scopeName=t.scopeName,n}function Ii(e){const t=d.useRef(e);return d.useEffect(()=>{t.current=e}),d.useMemo(()=>(...n)=>{var r;return(r=t.current)===null||r===void 0?void 0:r.call(t,...n)},[])}const oX=d.createContext(void 0);function sX(e){const t=d.useContext(oX);return e||t||"ltr"}function aX(e,[t,n]){return Math.min(n,Math.max(t,e))}function Ti(e,t,{checkForDefaultPrevented:n=!0}={}){return function(o){if(e==null||e(o),n===!1||!o.defaultPrevented)return t==null?void 0:t(o)}}function iX(e,t){return d.useReducer((n,r)=>{const o=t[n][r];return o??n},e)}const P6="ScrollArea",[E6,M1e]=nX(P6),[lX,_o]=E6(P6),cX=d.forwardRef((e,t)=>{const{__scopeScrollArea:n,type:r="hover",dir:o,scrollHideDelay:s=600,...i}=e,[l,u]=d.useState(null),[p,m]=d.useState(null),[h,g]=d.useState(null),[x,y]=d.useState(null),[b,w]=d.useState(null),[S,j]=d.useState(0),[_,E]=d.useState(0),[I,M]=d.useState(!1),[R,D]=d.useState(!1),A=al(t,T=>u(T)),O=sX(o);return d.createElement(lX,{scope:n,type:r,dir:O,scrollHideDelay:s,scrollArea:l,viewport:p,onViewportChange:m,content:h,onContentChange:g,scrollbarX:x,onScrollbarXChange:y,scrollbarXEnabled:I,onScrollbarXEnabledChange:M,scrollbarY:b,onScrollbarYChange:w,scrollbarYEnabled:R,onScrollbarYEnabledChange:D,onCornerWidthChange:j,onCornerHeightChange:E},d.createElement(Hd.div,pn({dir:O},i,{ref:A,style:{position:"relative","--radix-scroll-area-corner-width":S+"px","--radix-scroll-area-corner-height":_+"px",...e.style}})))}),uX="ScrollAreaViewport",dX=d.forwardRef((e,t)=>{const{__scopeScrollArea:n,children:r,...o}=e,s=_o(uX,n),i=d.useRef(null),l=al(t,i,s.onViewportChange);return d.createElement(d.Fragment,null,d.createElement("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}"}}),d.createElement(Hd.div,pn({"data-radix-scroll-area-viewport":""},o,{ref:l,style:{overflowX:s.scrollbarXEnabled?"scroll":"hidden",overflowY:s.scrollbarYEnabled?"scroll":"hidden",...e.style}}),d.createElement("div",{ref:s.onContentChange,style:{minWidth:"100%",display:"table"}},r)))}),ya="ScrollAreaScrollbar",fX=d.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=_o(ya,e.__scopeScrollArea),{onScrollbarXEnabledChange:s,onScrollbarYEnabledChange:i}=o,l=e.orientation==="horizontal";return d.useEffect(()=>(l?s(!0):i(!0),()=>{l?s(!1):i(!1)}),[l,s,i]),o.type==="hover"?d.createElement(pX,pn({},r,{ref:t,forceMount:n})):o.type==="scroll"?d.createElement(mX,pn({},r,{ref:t,forceMount:n})):o.type==="auto"?d.createElement(M6,pn({},r,{ref:t,forceMount:n})):o.type==="always"?d.createElement(ry,pn({},r,{ref:t})):null}),pX=d.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=_o(ya,e.__scopeScrollArea),[s,i]=d.useState(!1);return d.useEffect(()=>{const l=o.scrollArea;let u=0;if(l){const p=()=>{window.clearTimeout(u),i(!0)},m=()=>{u=window.setTimeout(()=>i(!1),o.scrollHideDelay)};return l.addEventListener("pointerenter",p),l.addEventListener("pointerleave",m),()=>{window.clearTimeout(u),l.removeEventListener("pointerenter",p),l.removeEventListener("pointerleave",m)}}},[o.scrollArea,o.scrollHideDelay]),d.createElement(Vd,{present:n||s},d.createElement(M6,pn({"data-state":s?"visible":"hidden"},r,{ref:t})))}),mX=d.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=_o(ya,e.__scopeScrollArea),s=e.orientation==="horizontal",i=ng(()=>u("SCROLL_END"),100),[l,u]=iX("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 d.useEffect(()=>{if(l==="idle"){const p=window.setTimeout(()=>u("HIDE"),o.scrollHideDelay);return()=>window.clearTimeout(p)}},[l,o.scrollHideDelay,u]),d.useEffect(()=>{const p=o.viewport,m=s?"scrollLeft":"scrollTop";if(p){let h=p[m];const g=()=>{const x=p[m];h!==x&&(u("SCROLL"),i()),h=x};return p.addEventListener("scroll",g),()=>p.removeEventListener("scroll",g)}},[o.viewport,s,u,i]),d.createElement(Vd,{present:n||l!=="hidden"},d.createElement(ry,pn({"data-state":l==="hidden"?"hidden":"visible"},r,{ref:t,onPointerEnter:Ti(e.onPointerEnter,()=>u("POINTER_ENTER")),onPointerLeave:Ti(e.onPointerLeave,()=>u("POINTER_LEAVE"))})))}),M6=d.forwardRef((e,t)=>{const n=_o(ya,e.__scopeScrollArea),{forceMount:r,...o}=e,[s,i]=d.useState(!1),l=e.orientation==="horizontal",u=ng(()=>{if(n.viewport){const p=n.viewport.offsetWidth{const{orientation:n="vertical",...r}=e,o=_o(ya,e.__scopeScrollArea),s=d.useRef(null),i=d.useRef(0),[l,u]=d.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),p=A6(l.viewport,l.content),m={...r,sizes:l,onSizesChange:u,hasThumb:p>0&&p<1,onThumbChange:g=>s.current=g,onThumbPointerUp:()=>i.current=0,onThumbPointerDown:g=>i.current=g};function h(g,x){return wX(g,i.current,l,x)}return n==="horizontal"?d.createElement(hX,pn({},m,{ref:t,onThumbPositionChange:()=>{if(o.viewport&&s.current){const g=o.viewport.scrollLeft,x=G4(g,l,o.dir);s.current.style.transform=`translate3d(${x}px, 0, 0)`}},onWheelScroll:g=>{o.viewport&&(o.viewport.scrollLeft=g)},onDragScroll:g=>{o.viewport&&(o.viewport.scrollLeft=h(g,o.dir))}})):n==="vertical"?d.createElement(gX,pn({},m,{ref:t,onThumbPositionChange:()=>{if(o.viewport&&s.current){const g=o.viewport.scrollTop,x=G4(g,l);s.current.style.transform=`translate3d(0, ${x}px, 0)`}},onWheelScroll:g=>{o.viewport&&(o.viewport.scrollTop=g)},onDragScroll:g=>{o.viewport&&(o.viewport.scrollTop=h(g))}})):null}),hX=d.forwardRef((e,t)=>{const{sizes:n,onSizesChange:r,...o}=e,s=_o(ya,e.__scopeScrollArea),[i,l]=d.useState(),u=d.useRef(null),p=al(t,u,s.onScrollbarXChange);return d.useEffect(()=>{u.current&&l(getComputedStyle(u.current))},[u]),d.createElement(R6,pn({"data-orientation":"horizontal"},o,{ref:p,sizes:n,style:{bottom:0,left:s.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:s.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":tg(n)+"px",...e.style},onThumbPointerDown:m=>e.onThumbPointerDown(m.x),onDragScroll:m=>e.onDragScroll(m.x),onWheelScroll:(m,h)=>{if(s.viewport){const g=s.viewport.scrollLeft+m.deltaX;e.onWheelScroll(g),N6(g,h)&&m.preventDefault()}},onResize:()=>{u.current&&s.viewport&&i&&r({content:s.viewport.scrollWidth,viewport:s.viewport.offsetWidth,scrollbar:{size:u.current.clientWidth,paddingStart:Im(i.paddingLeft),paddingEnd:Im(i.paddingRight)}})}}))}),gX=d.forwardRef((e,t)=>{const{sizes:n,onSizesChange:r,...o}=e,s=_o(ya,e.__scopeScrollArea),[i,l]=d.useState(),u=d.useRef(null),p=al(t,u,s.onScrollbarYChange);return d.useEffect(()=>{u.current&&l(getComputedStyle(u.current))},[u]),d.createElement(R6,pn({"data-orientation":"vertical"},o,{ref:p,sizes:n,style:{top:0,right:s.dir==="ltr"?0:void 0,left:s.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":tg(n)+"px",...e.style},onThumbPointerDown:m=>e.onThumbPointerDown(m.y),onDragScroll:m=>e.onDragScroll(m.y),onWheelScroll:(m,h)=>{if(s.viewport){const g=s.viewport.scrollTop+m.deltaY;e.onWheelScroll(g),N6(g,h)&&m.preventDefault()}},onResize:()=>{u.current&&s.viewport&&i&&r({content:s.viewport.scrollHeight,viewport:s.viewport.offsetHeight,scrollbar:{size:u.current.clientHeight,paddingStart:Im(i.paddingTop),paddingEnd:Im(i.paddingBottom)}})}}))}),[vX,O6]=E6(ya),R6=d.forwardRef((e,t)=>{const{__scopeScrollArea:n,sizes:r,hasThumb:o,onThumbChange:s,onThumbPointerUp:i,onThumbPointerDown:l,onThumbPositionChange:u,onDragScroll:p,onWheelScroll:m,onResize:h,...g}=e,x=_o(ya,n),[y,b]=d.useState(null),w=al(t,A=>b(A)),S=d.useRef(null),j=d.useRef(""),_=x.viewport,E=r.content-r.viewport,I=Ii(m),M=Ii(u),R=ng(h,10);function D(A){if(S.current){const O=A.clientX-S.current.left,T=A.clientY-S.current.top;p({x:O,y:T})}}return d.useEffect(()=>{const A=O=>{const T=O.target;(y==null?void 0:y.contains(T))&&I(O,E)};return document.addEventListener("wheel",A,{passive:!1}),()=>document.removeEventListener("wheel",A,{passive:!1})},[_,y,E,I]),d.useEffect(M,[r,M]),Sc(y,R),Sc(x.content,R),d.createElement(vX,{scope:n,scrollbar:y,hasThumb:o,onThumbChange:Ii(s),onThumbPointerUp:Ii(i),onThumbPositionChange:M,onThumbPointerDown:Ii(l)},d.createElement(Hd.div,pn({},g,{ref:w,style:{position:"absolute",...g.style},onPointerDown:Ti(e.onPointerDown,A=>{A.button===0&&(A.target.setPointerCapture(A.pointerId),S.current=y.getBoundingClientRect(),j.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",D(A))}),onPointerMove:Ti(e.onPointerMove,D),onPointerUp:Ti(e.onPointerUp,A=>{const O=A.target;O.hasPointerCapture(A.pointerId)&&O.releasePointerCapture(A.pointerId),document.body.style.webkitUserSelect=j.current,S.current=null})})))}),rx="ScrollAreaThumb",xX=d.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=O6(rx,e.__scopeScrollArea);return d.createElement(Vd,{present:n||o.hasThumb},d.createElement(bX,pn({ref:t},r)))}),bX=d.forwardRef((e,t)=>{const{__scopeScrollArea:n,style:r,...o}=e,s=_o(rx,n),i=O6(rx,n),{onThumbPositionChange:l}=i,u=al(t,h=>i.onThumbChange(h)),p=d.useRef(),m=ng(()=>{p.current&&(p.current(),p.current=void 0)},100);return d.useEffect(()=>{const h=s.viewport;if(h){const g=()=>{if(m(),!p.current){const x=SX(h,l);p.current=x,l()}};return l(),h.addEventListener("scroll",g),()=>h.removeEventListener("scroll",g)}},[s.viewport,m,l]),d.createElement(Hd.div,pn({"data-state":i.hasThumb?"visible":"hidden"},o,{ref:u,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...r},onPointerDownCapture:Ti(e.onPointerDownCapture,h=>{const x=h.target.getBoundingClientRect(),y=h.clientX-x.left,b=h.clientY-x.top;i.onThumbPointerDown({x:y,y:b})}),onPointerUp:Ti(e.onPointerUp,i.onThumbPointerUp)}))}),D6="ScrollAreaCorner",yX=d.forwardRef((e,t)=>{const n=_o(D6,e.__scopeScrollArea),r=!!(n.scrollbarX&&n.scrollbarY);return n.type!=="scroll"&&r?d.createElement(CX,pn({},e,{ref:t})):null}),CX=d.forwardRef((e,t)=>{const{__scopeScrollArea:n,...r}=e,o=_o(D6,n),[s,i]=d.useState(0),[l,u]=d.useState(0),p=!!(s&&l);return Sc(o.scrollbarX,()=>{var m;const h=((m=o.scrollbarX)===null||m===void 0?void 0:m.offsetHeight)||0;o.onCornerHeightChange(h),u(h)}),Sc(o.scrollbarY,()=>{var m;const h=((m=o.scrollbarY)===null||m===void 0?void 0:m.offsetWidth)||0;o.onCornerWidthChange(h),i(h)}),p?d.createElement(Hd.div,pn({},r,{ref:t,style:{width:s,height:l,position:"absolute",right:o.dir==="ltr"?0:void 0,left:o.dir==="rtl"?0:void 0,bottom:0,...e.style}})):null});function Im(e){return e?parseInt(e,10):0}function A6(e,t){const n=e/t;return isNaN(n)?0:n}function tg(e){const t=A6(e.viewport,e.content),n=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,r=(e.scrollbar.size-n)*t;return Math.max(r,18)}function wX(e,t,n,r="ltr"){const o=tg(n),s=o/2,i=t||s,l=o-i,u=n.scrollbar.paddingStart+i,p=n.scrollbar.size-n.scrollbar.paddingEnd-l,m=n.content-n.viewport,h=r==="ltr"?[0,m]:[m*-1,0];return T6([u,p],h)(e)}function G4(e,t,n="ltr"){const r=tg(t),o=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,s=t.scrollbar.size-o,i=t.content-t.viewport,l=s-r,u=n==="ltr"?[0,i]:[i*-1,0],p=aX(e,u);return T6([0,i],[0,l])(p)}function T6(e,t){return n=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const r=(t[1]-t[0])/(e[1]-e[0]);return t[0]+r*(n-e[0])}}function N6(e,t){return e>0&&e{})=>{let n={left:e.scrollLeft,top:e.scrollTop},r=0;return function o(){const s={left:e.scrollLeft,top:e.scrollTop},i=n.left!==s.left,l=n.top!==s.top;(i||l)&&t(),n=s,r=window.requestAnimationFrame(o)}(),()=>window.cancelAnimationFrame(r)};function ng(e,t){const n=Ii(e),r=d.useRef(0);return d.useEffect(()=>()=>window.clearTimeout(r.current),[]),d.useCallback(()=>{window.clearTimeout(r.current),r.current=window.setTimeout(n,t)},[n,t])}function Sc(e,t){const n=Ii(t);nx(()=>{let r=0;if(e){const o=new ResizeObserver(()=>{cancelAnimationFrame(r),r=window.requestAnimationFrame(n)});return o.observe(e),()=>{window.cancelAnimationFrame(r),o.unobserve(e)}}},[e,n])}const kX=cX,jX=dX,K4=fX,q4=xX,_X=yX;var IX=fr((e,{scrollbarSize:t,offsetScrollbars:n,scrollbarHovered:r,hidden:o})=>({root:{overflow:"hidden"},viewport:{width:"100%",height:"100%",paddingRight:n?Re(t):void 0,paddingBottom:n?Re(t):void 0},scrollbar:{display:o?"none":"flex",userSelect:"none",touchAction:"none",boxSizing:"border-box",padding:`calc(${Re(t)} / 5)`,transition:"background-color 150ms ease, opacity 150ms ease","&:hover":{backgroundColor:e.colorScheme==="dark"?e.colors.dark[8]:e.colors.gray[0],[`& .${JS("thumb")}`]:{backgroundColor:e.colorScheme==="dark"?e.fn.rgba(e.white,.5):e.fn.rgba(e.black,.5)}},'&[data-orientation="vertical"]':{width:Re(t)},'&[data-orientation="horizontal"]':{flexDirection:"column",height:Re(t)},'&[data-state="hidden"]':{display:"none",opacity:0}},thumb:{ref:JS("thumb"),flex:1,backgroundColor:e.colorScheme==="dark"?e.fn.rgba(e.white,.4):e.fn.rgba(e.black,.4),borderRadius:Re(t),position:"relative",transition:"background-color 150ms ease",display:o?"none":void 0,overflow:"hidden","&::before":{content:'""',position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",width:"100%",height:"100%",minWidth:Re(44),minHeight:Re(44)}},corner:{backgroundColor:e.colorScheme==="dark"?e.colors.dark[6]:e.colors.gray[0],transition:"opacity 150ms ease",opacity:r?1:0,display:o?"none":void 0}}));const PX=IX;var EX=Object.defineProperty,MX=Object.defineProperties,OX=Object.getOwnPropertyDescriptors,Pm=Object.getOwnPropertySymbols,$6=Object.prototype.hasOwnProperty,L6=Object.prototype.propertyIsEnumerable,X4=(e,t,n)=>t in e?EX(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ox=(e,t)=>{for(var n in t||(t={}))$6.call(t,n)&&X4(e,n,t[n]);if(Pm)for(var n of Pm(t))L6.call(t,n)&&X4(e,n,t[n]);return e},z6=(e,t)=>MX(e,OX(t)),F6=(e,t)=>{var n={};for(var r in e)$6.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Pm)for(var r of Pm(e))t.indexOf(r)<0&&L6.call(e,r)&&(n[r]=e[r]);return n};const B6={scrollbarSize:12,scrollHideDelay:1e3,type:"hover",offsetScrollbars:!1},rg=d.forwardRef((e,t)=>{const n=Rn("ScrollArea",B6,e),{children:r,className:o,classNames:s,styles:i,scrollbarSize:l,scrollHideDelay:u,type:p,dir:m,offsetScrollbars:h,viewportRef:g,onScrollPositionChange:x,unstyled:y,variant:b,viewportProps:w}=n,S=F6(n,["children","className","classNames","styles","scrollbarSize","scrollHideDelay","type","dir","offsetScrollbars","viewportRef","onScrollPositionChange","unstyled","variant","viewportProps"]),[j,_]=d.useState(!1),E=xa(),{classes:I,cx:M}=PX({scrollbarSize:l,offsetScrollbars:h,scrollbarHovered:j,hidden:p==="never"},{name:"ScrollArea",classNames:s,styles:i,unstyled:y,variant:b});return H.createElement(kX,{type:p==="never"?"always":p,scrollHideDelay:u,dir:m||E.dir,ref:t,asChild:!0},H.createElement(zr,ox({className:M(I.root,o)},S),H.createElement(jX,z6(ox({},w),{className:I.viewport,ref:g,onScroll:typeof x=="function"?({currentTarget:R})=>x({x:R.scrollLeft,y:R.scrollTop}):void 0}),r),H.createElement(K4,{orientation:"horizontal",className:I.scrollbar,forceMount:!0,onMouseEnter:()=>_(!0),onMouseLeave:()=>_(!1)},H.createElement(q4,{className:I.thumb})),H.createElement(K4,{orientation:"vertical",className:I.scrollbar,forceMount:!0,onMouseEnter:()=>_(!0),onMouseLeave:()=>_(!1)},H.createElement(q4,{className:I.thumb})),H.createElement(_X,{className:I.corner})))}),H6=d.forwardRef((e,t)=>{const n=Rn("ScrollAreaAutosize",B6,e),{children:r,classNames:o,styles:s,scrollbarSize:i,scrollHideDelay:l,type:u,dir:p,offsetScrollbars:m,viewportRef:h,onScrollPositionChange:g,unstyled:x,sx:y,variant:b,viewportProps:w}=n,S=F6(n,["children","classNames","styles","scrollbarSize","scrollHideDelay","type","dir","offsetScrollbars","viewportRef","onScrollPositionChange","unstyled","sx","variant","viewportProps"]);return H.createElement(zr,z6(ox({},S),{ref:t,sx:[{display:"flex"},...EP(y)]}),H.createElement(zr,{sx:{display:"flex",flexDirection:"column",flex:1}},H.createElement(rg,{classNames:o,styles:s,scrollHideDelay:l,scrollbarSize:i,type:u,dir:p,offsetScrollbars:m,viewportRef:h,onScrollPositionChange:g,unstyled:x,variant:b,viewportProps:w},r)))});H6.displayName="@mantine/core/ScrollAreaAutosize";rg.displayName="@mantine/core/ScrollArea";rg.Autosize=H6;const V6=rg;var RX=Object.defineProperty,DX=Object.defineProperties,AX=Object.getOwnPropertyDescriptors,Em=Object.getOwnPropertySymbols,W6=Object.prototype.hasOwnProperty,U6=Object.prototype.propertyIsEnumerable,Q4=(e,t,n)=>t in e?RX(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Y4=(e,t)=>{for(var n in t||(t={}))W6.call(t,n)&&Q4(e,n,t[n]);if(Em)for(var n of Em(t))U6.call(t,n)&&Q4(e,n,t[n]);return e},TX=(e,t)=>DX(e,AX(t)),NX=(e,t)=>{var n={};for(var r in e)W6.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Em)for(var r of Em(e))t.indexOf(r)<0&&U6.call(e,r)&&(n[r]=e[r]);return n};const og=d.forwardRef((e,t)=>{var n=e,{style:r}=n,o=NX(n,["style"]);return H.createElement(V6,TX(Y4({},o),{style:Y4({width:"100%"},r),viewportProps:{tabIndex:-1},viewportRef:t}),o.children)});og.displayName="@mantine/core/SelectScrollArea";var $X=fr(()=>({dropdown:{},itemsWrapper:{padding:Re(4),display:"flex",width:"100%",boxSizing:"border-box"}}));const LX=$X;function Fc(e){return e.split("-")[1]}function oy(e){return e==="y"?"height":"width"}function Go(e){return e.split("-")[0]}function ii(e){return["top","bottom"].includes(Go(e))?"x":"y"}function Z4(e,t,n){let{reference:r,floating:o}=e;const s=r.x+r.width/2-o.width/2,i=r.y+r.height/2-o.height/2,l=ii(t),u=oy(l),p=r[u]/2-o[u]/2,m=l==="x";let h;switch(Go(t)){case"top":h={x:s,y:r.y-o.height};break;case"bottom":h={x:s,y:r.y+r.height};break;case"right":h={x:r.x+r.width,y:i};break;case"left":h={x:r.x-o.width,y:i};break;default:h={x:r.x,y:r.y}}switch(Fc(t)){case"start":h[l]-=p*(n&&m?-1:1);break;case"end":h[l]+=p*(n&&m?-1:1)}return h}const zX=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:s=[],platform:i}=n,l=s.filter(Boolean),u=await(i.isRTL==null?void 0:i.isRTL(t));let p=await i.getElementRects({reference:e,floating:t,strategy:o}),{x:m,y:h}=Z4(p,r,u),g=r,x={},y=0;for(let b=0;b({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:s,platform:i,elements:l}=t,{element:u,padding:p=0}=ia(e,t)||{};if(u==null)return{};const m=sy(p),h={x:n,y:r},g=ii(o),x=oy(g),y=await i.getDimensions(u),b=g==="y",w=b?"top":"left",S=b?"bottom":"right",j=b?"clientHeight":"clientWidth",_=s.reference[x]+s.reference[g]-h[g]-s.floating[x],E=h[g]-s.reference[g],I=await(i.getOffsetParent==null?void 0:i.getOffsetParent(u));let M=I?I[j]:0;M&&await(i.isElement==null?void 0:i.isElement(I))||(M=l.floating[j]||s.floating[x]);const R=_/2-E/2,D=M/2-y[x]/2-1,A=ei(m[w],D),O=ei(m[S],D),T=A,X=M-y[x]-O,B=M/2-y[x]/2+R,V=sx(T,B,X),U=Fc(o)!=null&&B!=V&&s.reference[x]/2-(Be.concat(t,t+"-start",t+"-end"),[]);const BX={left:"right",right:"left",bottom:"top",top:"bottom"};function Mm(e){return e.replace(/left|right|bottom|top/g,t=>BX[t])}function HX(e,t,n){n===void 0&&(n=!1);const r=Fc(e),o=ii(e),s=oy(o);let i=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(i=Mm(i)),{main:i,cross:Mm(i)}}const VX={start:"end",end:"start"};function Iv(e){return e.replace(/start|end/g,t=>VX[t])}const WX=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n;const{placement:r,middlewareData:o,rects:s,initialPlacement:i,platform:l,elements:u}=t,{mainAxis:p=!0,crossAxis:m=!0,fallbackPlacements:h,fallbackStrategy:g="bestFit",fallbackAxisSideDirection:x="none",flipAlignment:y=!0,...b}=ia(e,t),w=Go(r),S=Go(i)===i,j=await(l.isRTL==null?void 0:l.isRTL(u.floating)),_=h||(S||!y?[Mm(i)]:function(T){const X=Mm(T);return[Iv(T),X,Iv(X)]}(i));h||x==="none"||_.push(...function(T,X,B,V){const U=Fc(T);let N=function($,q,F){const Q=["left","right"],Y=["right","left"],se=["top","bottom"],ae=["bottom","top"];switch($){case"top":case"bottom":return F?q?Y:Q:q?Q:Y;case"left":case"right":return q?se:ae;default:return[]}}(Go(T),B==="start",V);return U&&(N=N.map($=>$+"-"+U),X&&(N=N.concat(N.map(Iv)))),N}(i,y,x,j));const E=[i,..._],I=await ay(t,b),M=[];let R=((n=o.flip)==null?void 0:n.overflows)||[];if(p&&M.push(I[w]),m){const{main:T,cross:X}=HX(r,s,j);M.push(I[T],I[X])}if(R=[...R,{placement:r,overflows:M}],!M.every(T=>T<=0)){var D,A;const T=(((D=o.flip)==null?void 0:D.index)||0)+1,X=E[T];if(X)return{data:{index:T,overflows:R},reset:{placement:X}};let B=(A=R.filter(V=>V.overflows[0]<=0).sort((V,U)=>V.overflows[1]-U.overflows[1])[0])==null?void 0:A.placement;if(!B)switch(g){case"bestFit":{var O;const V=(O=R.map(U=>[U.placement,U.overflows.filter(N=>N>0).reduce((N,$)=>N+$,0)]).sort((U,N)=>U[1]-N[1])[0])==null?void 0:O[0];V&&(B=V);break}case"initialPlacement":B=i}if(r!==B)return{reset:{placement:B}}}return{}}}};function ek(e){const t=ei(...e.map(r=>r.left)),n=ei(...e.map(r=>r.top));return{x:t,y:n,width:ms(...e.map(r=>r.right))-t,height:ms(...e.map(r=>r.bottom))-n}}const UX=function(e){return e===void 0&&(e={}),{name:"inline",options:e,async fn(t){const{placement:n,elements:r,rects:o,platform:s,strategy:i}=t,{padding:l=2,x:u,y:p}=ia(e,t),m=Array.from(await(s.getClientRects==null?void 0:s.getClientRects(r.reference))||[]),h=function(b){const w=b.slice().sort((_,E)=>_.y-E.y),S=[];let j=null;for(let _=0;_j.height/2?S.push([E]):S[S.length-1].push(E),j=E}return S.map(_=>kc(ek(_)))}(m),g=kc(ek(m)),x=sy(l),y=await s.getElementRects({reference:{getBoundingClientRect:function(){if(h.length===2&&h[0].left>h[1].right&&u!=null&&p!=null)return h.find(b=>u>b.left-x.left&&ub.top-x.top&&p=2){if(ii(n)==="x"){const I=h[0],M=h[h.length-1],R=Go(n)==="top",D=I.top,A=M.bottom,O=R?I.left:M.left,T=R?I.right:M.right;return{top:D,bottom:A,left:O,right:T,width:T-O,height:A-D,x:O,y:D}}const b=Go(n)==="left",w=ms(...h.map(I=>I.right)),S=ei(...h.map(I=>I.left)),j=h.filter(I=>b?I.left===S:I.right===w),_=j[0].top,E=j[j.length-1].bottom;return{top:_,bottom:E,left:S,right:w,width:w-S,height:E-_,x:S,y:_}}return g}},floating:r.floating,strategy:i});return o.reference.x!==y.reference.x||o.reference.y!==y.reference.y||o.reference.width!==y.reference.width||o.reference.height!==y.reference.height?{reset:{rects:y}}:{}}}},GX=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){const{x:n,y:r}=t,o=await async function(s,i){const{placement:l,platform:u,elements:p}=s,m=await(u.isRTL==null?void 0:u.isRTL(p.floating)),h=Go(l),g=Fc(l),x=ii(l)==="x",y=["left","top"].includes(h)?-1:1,b=m&&x?-1:1,w=ia(i,s);let{mainAxis:S,crossAxis:j,alignmentAxis:_}=typeof w=="number"?{mainAxis:w,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...w};return g&&typeof _=="number"&&(j=g==="end"?-1*_:_),x?{x:j*b,y:S*y}:{x:S*y,y:j*b}}(t,e);return{x:n+o.x,y:r+o.y,data:o}}}};function G6(e){return e==="x"?"y":"x"}const KX=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o}=t,{mainAxis:s=!0,crossAxis:i=!1,limiter:l={fn:w=>{let{x:S,y:j}=w;return{x:S,y:j}}},...u}=ia(e,t),p={x:n,y:r},m=await ay(t,u),h=ii(Go(o)),g=G6(h);let x=p[h],y=p[g];if(s){const w=h==="y"?"bottom":"right";x=sx(x+m[h==="y"?"top":"left"],x,x-m[w])}if(i){const w=g==="y"?"bottom":"right";y=sx(y+m[g==="y"?"top":"left"],y,y-m[w])}const b=l.fn({...t,[h]:x,[g]:y});return{...b,data:{x:b.x-n,y:b.y-r}}}}},qX=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:o,rects:s,middlewareData:i}=t,{offset:l=0,mainAxis:u=!0,crossAxis:p=!0}=ia(e,t),m={x:n,y:r},h=ii(o),g=G6(h);let x=m[h],y=m[g];const b=ia(l,t),w=typeof b=="number"?{mainAxis:b,crossAxis:0}:{mainAxis:0,crossAxis:0,...b};if(u){const _=h==="y"?"height":"width",E=s.reference[h]-s.floating[_]+w.mainAxis,I=s.reference[h]+s.reference[_]-w.mainAxis;xI&&(x=I)}if(p){var S,j;const _=h==="y"?"width":"height",E=["top","left"].includes(Go(o)),I=s.reference[g]-s.floating[_]+(E&&((S=i.offset)==null?void 0:S[g])||0)+(E?0:w.crossAxis),M=s.reference[g]+s.reference[_]+(E?0:((j=i.offset)==null?void 0:j[g])||0)-(E?w.crossAxis:0);yM&&(y=M)}return{[h]:x,[g]:y}}}},XX=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){const{placement:n,rects:r,platform:o,elements:s}=t,{apply:i=()=>{},...l}=ia(e,t),u=await ay(t,l),p=Go(n),m=Fc(n),h=ii(n)==="x",{width:g,height:x}=r.floating;let y,b;p==="top"||p==="bottom"?(y=p,b=m===(await(o.isRTL==null?void 0:o.isRTL(s.floating))?"start":"end")?"left":"right"):(b=p,y=m==="end"?"top":"bottom");const w=x-u[y],S=g-u[b],j=!t.middlewareData.shift;let _=w,E=S;if(h){const M=g-u.left-u.right;E=m||j?ei(S,M):M}else{const M=x-u.top-u.bottom;_=m||j?ei(w,M):M}if(j&&!m){const M=ms(u.left,0),R=ms(u.right,0),D=ms(u.top,0),A=ms(u.bottom,0);h?E=g-2*(M!==0||R!==0?M+R:ms(u.left,u.right)):_=x-2*(D!==0||A!==0?D+A:ms(u.top,u.bottom))}await i({...t,availableWidth:E,availableHeight:_});const I=await o.getDimensions(s.floating);return g!==I.width||x!==I.height?{reset:{rects:!0}}:{}}}};function Zr(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function ks(e){return Zr(e).getComputedStyle(e)}function K6(e){return e instanceof Zr(e).Node}function ti(e){return K6(e)?(e.nodeName||"").toLowerCase():"#document"}function Jo(e){return e instanceof HTMLElement||e instanceof Zr(e).HTMLElement}function tk(e){return typeof ShadowRoot<"u"&&(e instanceof Zr(e).ShadowRoot||e instanceof ShadowRoot)}function sd(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=ks(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!["inline","contents"].includes(o)}function QX(e){return["table","td","th"].includes(ti(e))}function ax(e){const t=iy(),n=ks(e);return n.transform!=="none"||n.perspective!=="none"||!!n.containerType&&n.containerType!=="normal"||!t&&!!n.backdropFilter&&n.backdropFilter!=="none"||!t&&!!n.filter&&n.filter!=="none"||["transform","perspective","filter"].some(r=>(n.willChange||"").includes(r))||["paint","layout","strict","content"].some(r=>(n.contain||"").includes(r))}function iy(){return!(typeof CSS>"u"||!CSS.supports)&&CSS.supports("-webkit-backdrop-filter","none")}function sg(e){return["html","body","#document"].includes(ti(e))}const ix=Math.min,fc=Math.max,Om=Math.round,fp=Math.floor,ni=e=>({x:e,y:e});function q6(e){const t=ks(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=Jo(e),s=o?e.offsetWidth:n,i=o?e.offsetHeight:r,l=Om(n)!==s||Om(r)!==i;return l&&(n=s,r=i),{width:n,height:r,$:l}}function ea(e){return e instanceof Element||e instanceof Zr(e).Element}function ly(e){return ea(e)?e:e.contextElement}function pc(e){const t=ly(e);if(!Jo(t))return ni(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:s}=q6(t);let i=(s?Om(n.width):n.width)/r,l=(s?Om(n.height):n.height)/o;return i&&Number.isFinite(i)||(i=1),l&&Number.isFinite(l)||(l=1),{x:i,y:l}}const YX=ni(0);function X6(e){const t=Zr(e);return iy()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:YX}function Xi(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),s=ly(e);let i=ni(1);t&&(r?ea(r)&&(i=pc(r)):i=pc(e));const l=function(g,x,y){return x===void 0&&(x=!1),!(!y||x&&y!==Zr(g))&&x}(s,n,r)?X6(s):ni(0);let u=(o.left+l.x)/i.x,p=(o.top+l.y)/i.y,m=o.width/i.x,h=o.height/i.y;if(s){const g=Zr(s),x=r&&ea(r)?Zr(r):r;let y=g.frameElement;for(;y&&r&&x!==g;){const b=pc(y),w=y.getBoundingClientRect(),S=getComputedStyle(y),j=w.left+(y.clientLeft+parseFloat(S.paddingLeft))*b.x,_=w.top+(y.clientTop+parseFloat(S.paddingTop))*b.y;u*=b.x,p*=b.y,m*=b.x,h*=b.y,u+=j,p+=_,y=Zr(y).frameElement}}return kc({width:m,height:h,x:u,y:p})}function ag(e){return ea(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.pageXOffset,scrollTop:e.pageYOffset}}function ta(e){var t;return(t=(K6(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Q6(e){return Xi(ta(e)).left+ag(e).scrollLeft}function jc(e){if(ti(e)==="html")return e;const t=e.assignedSlot||e.parentNode||tk(e)&&e.host||ta(e);return tk(t)?t.host:t}function Y6(e){const t=jc(e);return sg(t)?e.ownerDocument?e.ownerDocument.body:e.body:Jo(t)&&sd(t)?t:Y6(t)}function Rm(e,t){var n;t===void 0&&(t=[]);const r=Y6(e),o=r===((n=e.ownerDocument)==null?void 0:n.body),s=Zr(r);return o?t.concat(s,s.visualViewport||[],sd(r)?r:[]):t.concat(r,Rm(r))}function nk(e,t,n){let r;if(t==="viewport")r=function(o,s){const i=Zr(o),l=ta(o),u=i.visualViewport;let p=l.clientWidth,m=l.clientHeight,h=0,g=0;if(u){p=u.width,m=u.height;const x=iy();(!x||x&&s==="fixed")&&(h=u.offsetLeft,g=u.offsetTop)}return{width:p,height:m,x:h,y:g}}(e,n);else if(t==="document")r=function(o){const s=ta(o),i=ag(o),l=o.ownerDocument.body,u=fc(s.scrollWidth,s.clientWidth,l.scrollWidth,l.clientWidth),p=fc(s.scrollHeight,s.clientHeight,l.scrollHeight,l.clientHeight);let m=-i.scrollLeft+Q6(o);const h=-i.scrollTop;return ks(l).direction==="rtl"&&(m+=fc(s.clientWidth,l.clientWidth)-u),{width:u,height:p,x:m,y:h}}(ta(e));else if(ea(t))r=function(o,s){const i=Xi(o,!0,s==="fixed"),l=i.top+o.clientTop,u=i.left+o.clientLeft,p=Jo(o)?pc(o):ni(1);return{width:o.clientWidth*p.x,height:o.clientHeight*p.y,x:u*p.x,y:l*p.y}}(t,n);else{const o=X6(e);r={...t,x:t.x-o.x,y:t.y-o.y}}return kc(r)}function Z6(e,t){const n=jc(e);return!(n===t||!ea(n)||sg(n))&&(ks(n).position==="fixed"||Z6(n,t))}function ZX(e,t,n){const r=Jo(t),o=ta(t),s=n==="fixed",i=Xi(e,!0,s,t);let l={scrollLeft:0,scrollTop:0};const u=ni(0);if(r||!r&&!s)if((ti(t)!=="body"||sd(o))&&(l=ag(t)),Jo(t)){const p=Xi(t,!0,s,t);u.x=p.x+t.clientLeft,u.y=p.y+t.clientTop}else o&&(u.x=Q6(o));return{x:i.left+l.scrollLeft-u.x,y:i.top+l.scrollTop-u.y,width:i.width,height:i.height}}function rk(e,t){return Jo(e)&&ks(e).position!=="fixed"?t?t(e):e.offsetParent:null}function ok(e,t){const n=Zr(e);if(!Jo(e))return n;let r=rk(e,t);for(;r&&QX(r)&&ks(r).position==="static";)r=rk(r,t);return r&&(ti(r)==="html"||ti(r)==="body"&&ks(r).position==="static"&&!ax(r))?n:r||function(o){let s=jc(o);for(;Jo(s)&&!sg(s);){if(ax(s))return s;s=jc(s)}return null}(e)||n}const JX={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{rect:t,offsetParent:n,strategy:r}=e;const o=Jo(n),s=ta(n);if(n===s)return t;let i={scrollLeft:0,scrollTop:0},l=ni(1);const u=ni(0);if((o||!o&&r!=="fixed")&&((ti(n)!=="body"||sd(s))&&(i=ag(n)),Jo(n))){const p=Xi(n);l=pc(n),u.x=p.x+n.clientLeft,u.y=p.y+n.clientTop}return{width:t.width*l.x,height:t.height*l.y,x:t.x*l.x-i.scrollLeft*l.x+u.x,y:t.y*l.y-i.scrollTop*l.y+u.y}},getDocumentElement:ta,getClippingRect:function(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const s=[...n==="clippingAncestors"?function(u,p){const m=p.get(u);if(m)return m;let h=Rm(u).filter(b=>ea(b)&&ti(b)!=="body"),g=null;const x=ks(u).position==="fixed";let y=x?jc(u):u;for(;ea(y)&&!sg(y);){const b=ks(y),w=ax(y);w||b.position!=="fixed"||(g=null),(x?!w&&!g:!w&&b.position==="static"&&g&&["absolute","fixed"].includes(g.position)||sd(y)&&!w&&Z6(u,y))?h=h.filter(S=>S!==y):g=b,y=jc(y)}return p.set(u,h),h}(t,this._c):[].concat(n),r],i=s[0],l=s.reduce((u,p)=>{const m=nk(t,p,o);return u.top=fc(m.top,u.top),u.right=ix(m.right,u.right),u.bottom=ix(m.bottom,u.bottom),u.left=fc(m.left,u.left),u},nk(t,i,o));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}},getOffsetParent:ok,getElementRects:async function(e){let{reference:t,floating:n,strategy:r}=e;const o=this.getOffsetParent||ok,s=this.getDimensions;return{reference:ZX(t,await o(n),r),floating:{x:0,y:0,...await s(n)}}},getClientRects:function(e){return Array.from(e.getClientRects())},getDimensions:function(e){return q6(e)},getScale:pc,isElement:ea,isRTL:function(e){return getComputedStyle(e).direction==="rtl"}};function eQ(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:s=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:u=!1}=r,p=ly(e),m=o||s?[...p?Rm(p):[],...Rm(t)]:[];m.forEach(w=>{o&&w.addEventListener("scroll",n,{passive:!0}),s&&w.addEventListener("resize",n)});const h=p&&l?function(w,S){let j,_=null;const E=ta(w);function I(){clearTimeout(j),_&&_.disconnect(),_=null}return function M(R,D){R===void 0&&(R=!1),D===void 0&&(D=1),I();const{left:A,top:O,width:T,height:X}=w.getBoundingClientRect();if(R||S(),!T||!X)return;const B={rootMargin:-fp(O)+"px "+-fp(E.clientWidth-(A+T))+"px "+-fp(E.clientHeight-(O+X))+"px "+-fp(A)+"px",threshold:fc(0,ix(1,D))||1};let V=!0;function U(N){const $=N[0].intersectionRatio;if($!==D){if(!V)return M();$?M(!1,$):j=setTimeout(()=>{M(!1,1e-7)},100)}V=!1}try{_=new IntersectionObserver(U,{...B,root:E.ownerDocument})}catch{_=new IntersectionObserver(U,B)}_.observe(w)}(!0),I}(p,n):null;let g,x=-1,y=null;i&&(y=new ResizeObserver(w=>{let[S]=w;S&&S.target===p&&y&&(y.unobserve(t),cancelAnimationFrame(x),x=requestAnimationFrame(()=>{y&&y.observe(t)})),n()}),p&&!u&&y.observe(p),y.observe(t));let b=u?Xi(e):null;return u&&function w(){const S=Xi(e);!b||S.x===b.x&&S.y===b.y&&S.width===b.width&&S.height===b.height||n(),b=S,g=requestAnimationFrame(w)}(),n(),()=>{m.forEach(w=>{o&&w.removeEventListener("scroll",n),s&&w.removeEventListener("resize",n)}),h&&h(),y&&y.disconnect(),y=null,u&&cancelAnimationFrame(g)}}const tQ=(e,t,n)=>{const r=new Map,o={platform:JX,...n},s={...o.platform,_c:r};return zX(e,t,{...o,platform:s})},nQ=e=>{const{element:t,padding:n}=e;function r(o){return Object.prototype.hasOwnProperty.call(o,"current")}return{name:"arrow",options:e,fn(o){return r(t)?t.current!=null?J4({element:t.current,padding:n}).fn(o):{}:t?J4({element:t,padding:n}).fn(o):{}}}};var Vp=typeof document<"u"?d.useLayoutEffect:d.useEffect;function Dm(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 n,r,o;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!=t.length)return!1;for(r=n;r--!==0;)if(!Dm(e[r],t[r]))return!1;return!0}if(o=Object.keys(e),n=o.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!Object.prototype.hasOwnProperty.call(t,o[r]))return!1;for(r=n;r--!==0;){const s=o[r];if(!(s==="_owner"&&e.$$typeof)&&!Dm(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function sk(e){const t=d.useRef(e);return Vp(()=>{t.current=e}),t}function rQ(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:o,whileElementsMounted:s,open:i}=e,[l,u]=d.useState({x:null,y:null,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[p,m]=d.useState(r);Dm(p,r)||m(r);const h=d.useRef(null),g=d.useRef(null),x=d.useRef(l),y=sk(s),b=sk(o),[w,S]=d.useState(null),[j,_]=d.useState(null),E=d.useCallback(O=>{h.current!==O&&(h.current=O,S(O))},[]),I=d.useCallback(O=>{g.current!==O&&(g.current=O,_(O))},[]),M=d.useCallback(()=>{if(!h.current||!g.current)return;const O={placement:t,strategy:n,middleware:p};b.current&&(O.platform=b.current),tQ(h.current,g.current,O).then(T=>{const X={...T,isPositioned:!0};R.current&&!Dm(x.current,X)&&(x.current=X,qr.flushSync(()=>{u(X)}))})},[p,t,n,b]);Vp(()=>{i===!1&&x.current.isPositioned&&(x.current.isPositioned=!1,u(O=>({...O,isPositioned:!1})))},[i]);const R=d.useRef(!1);Vp(()=>(R.current=!0,()=>{R.current=!1}),[]),Vp(()=>{if(w&&j){if(y.current)return y.current(w,j,M);M()}},[w,j,M,y]);const D=d.useMemo(()=>({reference:h,floating:g,setReference:E,setFloating:I}),[E,I]),A=d.useMemo(()=>({reference:w,floating:j}),[w,j]);return d.useMemo(()=>({...l,update:M,refs:D,elements:A,reference:E,floating:I}),[l,M,D,A,E,I])}var oQ=typeof document<"u"?d.useLayoutEffect:d.useEffect;function sQ(){const e=new Map;return{emit(t,n){var r;(r=e.get(t))==null||r.forEach(o=>o(n))},on(t,n){e.set(t,[...e.get(t)||[],n])},off(t,n){e.set(t,(e.get(t)||[]).filter(r=>r!==n))}}}const aQ=d.createContext(null),iQ=()=>d.useContext(aQ);function lQ(e){return(e==null?void 0:e.ownerDocument)||document}function cQ(e){return lQ(e).defaultView||window}function pp(e){return e?e instanceof cQ(e).Element:!1}const uQ=Fx["useInsertionEffect".toString()],dQ=uQ||(e=>e());function fQ(e){const t=d.useRef(()=>{});return dQ(()=>{t.current=e}),d.useCallback(function(){for(var n=arguments.length,r=new Array(n),o=0;osQ())[0],[p,m]=d.useState(null),h=d.useCallback(S=>{const j=pp(S)?{getBoundingClientRect:()=>S.getBoundingClientRect(),contextElement:S}:S;o.refs.setReference(j)},[o.refs]),g=d.useCallback(S=>{(pp(S)||S===null)&&(i.current=S,m(S)),(pp(o.refs.reference.current)||o.refs.reference.current===null||S!==null&&!pp(S))&&o.refs.setReference(S)},[o.refs]),x=d.useMemo(()=>({...o.refs,setReference:g,setPositionReference:h,domReference:i}),[o.refs,g,h]),y=d.useMemo(()=>({...o.elements,domReference:p}),[o.elements,p]),b=fQ(n),w=d.useMemo(()=>({...o,refs:x,elements:y,dataRef:l,nodeId:r,events:u,open:t,onOpenChange:b}),[o,r,u,t,b,x,y]);return oQ(()=>{const S=s==null?void 0:s.nodesRef.current.find(j=>j.id===r);S&&(S.context=w)}),d.useMemo(()=>({...o,context:w,refs:x,reference:g,positionReference:h}),[o,x,w,g,h])}function mQ({opened:e,floating:t,position:n,positionDependencies:r}){const[o,s]=d.useState(0);d.useEffect(()=>{if(t.refs.reference.current&&t.refs.floating.current)return eQ(t.refs.reference.current,t.refs.floating.current,t.update)},[t.refs.reference.current,t.refs.floating.current,e,o,n]),Uo(()=>{t.update()},r),Uo(()=>{s(i=>i+1)},[e])}function hQ(e){const t=[GX(e.offset)];return e.middlewares.shift&&t.push(KX({limiter:qX()})),e.middlewares.flip&&t.push(WX()),e.middlewares.inline&&t.push(UX()),t.push(nQ({element:e.arrowRef,padding:e.arrowOffset})),t}function gQ(e){const[t,n]=od({value:e.opened,defaultValue:e.defaultOpened,finalValue:!1,onChange:e.onChange}),r=()=>{var i;(i=e.onClose)==null||i.call(e),n(!1)},o=()=>{var i,l;t?((i=e.onClose)==null||i.call(e),n(!1)):((l=e.onOpen)==null||l.call(e),n(!0))},s=pQ({placement:e.position,middleware:[...hQ(e),...e.width==="target"?[XX({apply({rects:i}){var l,u;Object.assign((u=(l=s.refs.floating.current)==null?void 0:l.style)!=null?u:{},{width:`${i.reference.width}px`})}})]:[]]});return mQ({opened:e.opened,position:e.position,positionDependencies:e.positionDependencies,floating:s}),Uo(()=>{var i;(i=e.onPositionChange)==null||i.call(e,s.placement)},[s.placement]),Uo(()=>{var i,l;e.opened?(l=e.onOpen)==null||l.call(e):(i=e.onClose)==null||i.call(e)},[e.opened]),{floating:s,controlled:typeof e.opened=="boolean",opened:t,onClose:r,onToggle:o}}const J6={context:"Popover component was not found in the tree",children:"Popover.Target component children should be an element or a component that accepts ref. Fragments, strings, numbers and other primitive values are not supported"},[vQ,eE]=oG(J6.context);var xQ=Object.defineProperty,bQ=Object.defineProperties,yQ=Object.getOwnPropertyDescriptors,Am=Object.getOwnPropertySymbols,tE=Object.prototype.hasOwnProperty,nE=Object.prototype.propertyIsEnumerable,ak=(e,t,n)=>t in e?xQ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,mp=(e,t)=>{for(var n in t||(t={}))tE.call(t,n)&&ak(e,n,t[n]);if(Am)for(var n of Am(t))nE.call(t,n)&&ak(e,n,t[n]);return e},CQ=(e,t)=>bQ(e,yQ(t)),wQ=(e,t)=>{var n={};for(var r in e)tE.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Am)for(var r of Am(e))t.indexOf(r)<0&&nE.call(e,r)&&(n[r]=e[r]);return n};const SQ={refProp:"ref",popupType:"dialog"},rE=d.forwardRef((e,t)=>{const n=Rn("PopoverTarget",SQ,e),{children:r,refProp:o,popupType:s}=n,i=wQ(n,["children","refProp","popupType"]);if(!OP(r))throw new Error(J6.children);const l=i,u=eE(),p=Bd(u.reference,r.ref,t),m=u.withRoles?{"aria-haspopup":s,"aria-expanded":u.opened,"aria-controls":u.getDropdownId(),id:u.getTargetId()}:{};return d.cloneElement(r,mp(CQ(mp(mp(mp({},l),m),u.targetProps),{className:DP(u.targetProps.className,l.className,r.props.className),[o]:p}),u.controlled?null:{onClick:u.onToggle}))});rE.displayName="@mantine/core/PopoverTarget";var kQ=fr((e,{radius:t,shadow:n})=>({dropdown:{position:"absolute",backgroundColor:e.white,background:e.colorScheme==="dark"?e.colors.dark[6]:e.white,border:`${Re(1)} solid ${e.colorScheme==="dark"?e.colors.dark[4]:e.colors.gray[2]}`,padding:`${e.spacing.sm} ${e.spacing.md}`,boxShadow:e.shadows[n]||n||"none",borderRadius:e.fn.radius(t),"&:focus":{outline:0}},arrow:{backgroundColor:"inherit",border:`${Re(1)} solid ${e.colorScheme==="dark"?e.colors.dark[4]:e.colors.gray[2]}`,zIndex:1}}));const jQ=kQ;var _Q=Object.defineProperty,ik=Object.getOwnPropertySymbols,IQ=Object.prototype.hasOwnProperty,PQ=Object.prototype.propertyIsEnumerable,lk=(e,t,n)=>t in e?_Q(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,$l=(e,t)=>{for(var n in t||(t={}))IQ.call(t,n)&&lk(e,n,t[n]);if(ik)for(var n of ik(t))PQ.call(t,n)&&lk(e,n,t[n]);return e};const ck={entering:"in",entered:"in",exiting:"out",exited:"out","pre-exiting":"out","pre-entering":"out"};function EQ({transition:e,state:t,duration:n,timingFunction:r}){const o={transitionDuration:`${n}ms`,transitionTimingFunction:r};return typeof e=="string"?e in ap?$l($l($l({transitionProperty:ap[e].transitionProperty},o),ap[e].common),ap[e][ck[t]]):null:$l($l($l({transitionProperty:e.transitionProperty},o),e.common),e[ck[t]])}function MQ({duration:e,exitDuration:t,timingFunction:n,mounted:r,onEnter:o,onExit:s,onEntered:i,onExited:l}){const u=xa(),p=FP(),m=u.respectReducedMotion?p:!1,[h,g]=d.useState(m?0:e),[x,y]=d.useState(r?"entered":"exited"),b=d.useRef(-1),w=S=>{const j=S?o:s,_=S?i:l;y(S?"pre-entering":"pre-exiting"),window.clearTimeout(b.current);const E=m?0:S?e:t;if(g(E),E===0)typeof j=="function"&&j(),typeof _=="function"&&_(),y(S?"entered":"exited");else{const I=window.setTimeout(()=>{typeof j=="function"&&j(),y(S?"entering":"exiting")},10);b.current=window.setTimeout(()=>{window.clearTimeout(I),typeof _=="function"&&_(),y(S?"entered":"exited")},E)}};return Uo(()=>{w(r)},[r]),d.useEffect(()=>()=>window.clearTimeout(b.current),[]),{transitionDuration:h,transitionStatus:x,transitionTimingFunction:n||u.transitionTimingFunction}}function oE({keepMounted:e,transition:t,duration:n=250,exitDuration:r=n,mounted:o,children:s,timingFunction:i,onExit:l,onEntered:u,onEnter:p,onExited:m}){const{transitionDuration:h,transitionStatus:g,transitionTimingFunction:x}=MQ({mounted:o,exitDuration:r,duration:n,timingFunction:i,onExit:l,onEntered:u,onEnter:p,onExited:m});return h===0?o?H.createElement(H.Fragment,null,s({})):e?s({display:"none"}):null:g==="exited"?e?s({display:"none"}):null:H.createElement(H.Fragment,null,s(EQ({transition:t,duration:h,state:g,timingFunction:x})))}oE.displayName="@mantine/core/Transition";function sE({children:e,active:t=!0,refProp:n="ref"}){const r=LG(t),o=Bd(r,e==null?void 0:e.ref);return OP(e)?d.cloneElement(e,{[n]:o}):e}sE.displayName="@mantine/core/FocusTrap";var OQ=Object.defineProperty,RQ=Object.defineProperties,DQ=Object.getOwnPropertyDescriptors,uk=Object.getOwnPropertySymbols,AQ=Object.prototype.hasOwnProperty,TQ=Object.prototype.propertyIsEnumerable,dk=(e,t,n)=>t in e?OQ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Na=(e,t)=>{for(var n in t||(t={}))AQ.call(t,n)&&dk(e,n,t[n]);if(uk)for(var n of uk(t))TQ.call(t,n)&&dk(e,n,t[n]);return e},hp=(e,t)=>RQ(e,DQ(t));function fk(e,t,n,r){return e==="center"||r==="center"?{top:t}:e==="end"?{bottom:n}:e==="start"?{top:n}:{}}function pk(e,t,n,r,o){return e==="center"||r==="center"?{left:t}:e==="end"?{[o==="ltr"?"right":"left"]:n}:e==="start"?{[o==="ltr"?"left":"right"]:n}:{}}const NQ={bottom:"borderTopLeftRadius",left:"borderTopRightRadius",right:"borderBottomLeftRadius",top:"borderBottomRightRadius"};function $Q({position:e,arrowSize:t,arrowOffset:n,arrowRadius:r,arrowPosition:o,arrowX:s,arrowY:i,dir:l}){const[u,p="center"]=e.split("-"),m={width:Re(t),height:Re(t),transform:"rotate(45deg)",position:"absolute",[NQ[u]]:Re(r)},h=Re(-t/2);return u==="left"?hp(Na(Na({},m),fk(p,i,n,o)),{right:h,borderLeftColor:"transparent",borderBottomColor:"transparent"}):u==="right"?hp(Na(Na({},m),fk(p,i,n,o)),{left:h,borderRightColor:"transparent",borderTopColor:"transparent"}):u==="top"?hp(Na(Na({},m),pk(p,s,n,o,l)),{bottom:h,borderTopColor:"transparent",borderLeftColor:"transparent"}):u==="bottom"?hp(Na(Na({},m),pk(p,s,n,o,l)),{top:h,borderBottomColor:"transparent",borderRightColor:"transparent"}):{}}var LQ=Object.defineProperty,zQ=Object.defineProperties,FQ=Object.getOwnPropertyDescriptors,Tm=Object.getOwnPropertySymbols,aE=Object.prototype.hasOwnProperty,iE=Object.prototype.propertyIsEnumerable,mk=(e,t,n)=>t in e?LQ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,BQ=(e,t)=>{for(var n in t||(t={}))aE.call(t,n)&&mk(e,n,t[n]);if(Tm)for(var n of Tm(t))iE.call(t,n)&&mk(e,n,t[n]);return e},HQ=(e,t)=>zQ(e,FQ(t)),VQ=(e,t)=>{var n={};for(var r in e)aE.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Tm)for(var r of Tm(e))t.indexOf(r)<0&&iE.call(e,r)&&(n[r]=e[r]);return n};const lE=d.forwardRef((e,t)=>{var n=e,{position:r,arrowSize:o,arrowOffset:s,arrowRadius:i,arrowPosition:l,visible:u,arrowX:p,arrowY:m}=n,h=VQ(n,["position","arrowSize","arrowOffset","arrowRadius","arrowPosition","visible","arrowX","arrowY"]);const g=xa();return u?H.createElement("div",HQ(BQ({},h),{ref:t,style:$Q({position:r,arrowSize:o,arrowOffset:s,arrowRadius:i,arrowPosition:l,dir:g.dir,arrowX:p,arrowY:m})})):null});lE.displayName="@mantine/core/FloatingArrow";var WQ=Object.defineProperty,UQ=Object.defineProperties,GQ=Object.getOwnPropertyDescriptors,Nm=Object.getOwnPropertySymbols,cE=Object.prototype.hasOwnProperty,uE=Object.prototype.propertyIsEnumerable,hk=(e,t,n)=>t in e?WQ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ll=(e,t)=>{for(var n in t||(t={}))cE.call(t,n)&&hk(e,n,t[n]);if(Nm)for(var n of Nm(t))uE.call(t,n)&&hk(e,n,t[n]);return e},gp=(e,t)=>UQ(e,GQ(t)),KQ=(e,t)=>{var n={};for(var r in e)cE.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Nm)for(var r of Nm(e))t.indexOf(r)<0&&uE.call(e,r)&&(n[r]=e[r]);return n};const qQ={};function dE(e){var t;const n=Rn("PopoverDropdown",qQ,e),{style:r,className:o,children:s,onKeyDownCapture:i}=n,l=KQ(n,["style","className","children","onKeyDownCapture"]),u=eE(),{classes:p,cx:m}=jQ({radius:u.radius,shadow:u.shadow},{name:u.__staticSelector,classNames:u.classNames,styles:u.styles,unstyled:u.unstyled,variant:u.variant}),h=OG({opened:u.opened,shouldReturnFocus:u.returnFocus}),g=u.withRoles?{"aria-labelledby":u.getTargetId(),id:u.getDropdownId(),role:"dialog"}:{};return u.disabled?null:H.createElement(d6,gp(Ll({},u.portalProps),{withinPortal:u.withinPortal}),H.createElement(oE,gp(Ll({mounted:u.opened},u.transitionProps),{transition:u.transitionProps.transition||"fade",duration:(t=u.transitionProps.duration)!=null?t:150,keepMounted:u.keepMounted,exitDuration:typeof u.transitionProps.exitDuration=="number"?u.transitionProps.exitDuration:u.transitionProps.duration}),x=>{var y,b;return H.createElement(sE,{active:u.trapFocus},H.createElement(zr,Ll(gp(Ll({},g),{tabIndex:-1,ref:u.floating,style:gp(Ll(Ll({},r),x),{zIndex:u.zIndex,top:(y=u.y)!=null?y:0,left:(b=u.x)!=null?b:0,width:u.width==="target"?void 0:Re(u.width)}),className:m(p.dropdown,o),onKeyDownCapture:aG(u.onClose,{active:u.closeOnEscape,onTrigger:h,onKeyDown:i}),"data-position":u.placement}),l),s,H.createElement(lE,{ref:u.arrowRef,arrowX:u.arrowX,arrowY:u.arrowY,visible:u.withArrow,position:u.placement,arrowSize:u.arrowSize,arrowRadius:u.arrowRadius,arrowOffset:u.arrowOffset,arrowPosition:u.arrowPosition,className:p.arrow})))}))}dE.displayName="@mantine/core/PopoverDropdown";function XQ(e,t){if(e==="rtl"&&(t.includes("right")||t.includes("left"))){const[n,r]=t.split("-"),o=n==="right"?"left":"right";return r===void 0?o:`${o}-${r}`}return t}var gk=Object.getOwnPropertySymbols,QQ=Object.prototype.hasOwnProperty,YQ=Object.prototype.propertyIsEnumerable,ZQ=(e,t)=>{var n={};for(var r in e)QQ.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&gk)for(var r of gk(e))t.indexOf(r)<0&&YQ.call(e,r)&&(n[r]=e[r]);return n};const JQ={position:"bottom",offset:8,positionDependencies:[],transitionProps:{transition:"fade",duration:150},middlewares:{flip:!0,shift:!0,inline:!1},arrowSize:7,arrowOffset:5,arrowRadius:0,arrowPosition:"side",closeOnClickOutside:!0,withinPortal:!1,closeOnEscape:!0,trapFocus:!1,withRoles:!0,returnFocus:!1,clickOutsideEvents:["mousedown","touchstart"],zIndex:Zb("popover"),__staticSelector:"Popover",width:"max-content"};function Bc(e){var t,n,r,o,s,i;const l=d.useRef(null),u=Rn("Popover",JQ,e),{children:p,position:m,offset:h,onPositionChange:g,positionDependencies:x,opened:y,transitionProps:b,width:w,middlewares:S,withArrow:j,arrowSize:_,arrowOffset:E,arrowRadius:I,arrowPosition:M,unstyled:R,classNames:D,styles:A,closeOnClickOutside:O,withinPortal:T,portalProps:X,closeOnEscape:B,clickOutsideEvents:V,trapFocus:U,onClose:N,onOpen:$,onChange:q,zIndex:F,radius:Q,shadow:Y,id:se,defaultOpened:ae,__staticSelector:re,withRoles:G,disabled:K,returnFocus:ee,variant:ce,keepMounted:J}=u,ie=ZQ(u,["children","position","offset","onPositionChange","positionDependencies","opened","transitionProps","width","middlewares","withArrow","arrowSize","arrowOffset","arrowRadius","arrowPosition","unstyled","classNames","styles","closeOnClickOutside","withinPortal","portalProps","closeOnEscape","clickOutsideEvents","trapFocus","onClose","onOpen","onChange","zIndex","radius","shadow","id","defaultOpened","__staticSelector","withRoles","disabled","returnFocus","variant","keepMounted"]),[de,ge]=d.useState(null),[Ce,he]=d.useState(null),fe=ey(se),Oe=xa(),_e=gQ({middlewares:S,width:w,position:XQ(Oe.dir,m),offset:typeof h=="number"?h+(j?_/2:0):h,arrowRef:l,arrowOffset:E,onPositionChange:g,positionDependencies:x,opened:y,defaultOpened:ae,onChange:q,onOpen:$,onClose:N});IG(()=>_e.opened&&O&&_e.onClose(),V,[de,Ce]);const Ne=d.useCallback($e=>{ge($e),_e.floating.reference($e)},[_e.floating.reference]),nt=d.useCallback($e=>{he($e),_e.floating.floating($e)},[_e.floating.floating]);return H.createElement(vQ,{value:{returnFocus:ee,disabled:K,controlled:_e.controlled,reference:Ne,floating:nt,x:_e.floating.x,y:_e.floating.y,arrowX:(r=(n=(t=_e.floating)==null?void 0:t.middlewareData)==null?void 0:n.arrow)==null?void 0:r.x,arrowY:(i=(s=(o=_e.floating)==null?void 0:o.middlewareData)==null?void 0:s.arrow)==null?void 0:i.y,opened:_e.opened,arrowRef:l,transitionProps:b,width:w,withArrow:j,arrowSize:_,arrowOffset:E,arrowRadius:I,arrowPosition:M,placement:_e.floating.placement,trapFocus:U,withinPortal:T,portalProps:X,zIndex:F,radius:Q,shadow:Y,closeOnEscape:B,onClose:_e.onClose,onToggle:_e.onToggle,getTargetId:()=>`${fe}-target`,getDropdownId:()=>`${fe}-dropdown`,withRoles:G,targetProps:ie,__staticSelector:re,classNames:D,styles:A,unstyled:R,variant:ce,keepMounted:J}},p)}Bc.Target=rE;Bc.Dropdown=dE;Bc.displayName="@mantine/core/Popover";var eY=Object.defineProperty,$m=Object.getOwnPropertySymbols,fE=Object.prototype.hasOwnProperty,pE=Object.prototype.propertyIsEnumerable,vk=(e,t,n)=>t in e?eY(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,tY=(e,t)=>{for(var n in t||(t={}))fE.call(t,n)&&vk(e,n,t[n]);if($m)for(var n of $m(t))pE.call(t,n)&&vk(e,n,t[n]);return e},nY=(e,t)=>{var n={};for(var r in e)fE.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&$m)for(var r of $m(e))t.indexOf(r)<0&&pE.call(e,r)&&(n[r]=e[r]);return n};function rY(e){var t=e,{children:n,component:r="div",maxHeight:o=220,direction:s="column",id:i,innerRef:l,__staticSelector:u,styles:p,classNames:m,unstyled:h}=t,g=nY(t,["children","component","maxHeight","direction","id","innerRef","__staticSelector","styles","classNames","unstyled"]);const{classes:x}=LX(null,{name:u,styles:p,classNames:m,unstyled:h});return H.createElement(Bc.Dropdown,tY({p:0,onMouseDown:y=>y.preventDefault()},g),H.createElement("div",{style:{maxHeight:Re(o),display:"flex"}},H.createElement(zr,{component:r||"div",id:`${i}-items`,"aria-labelledby":`${i}-label`,role:"listbox",onMouseDown:y=>y.preventDefault(),style:{flex:1,overflowY:r!==og?"auto":void 0},"data-combobox-popover":!0,tabIndex:-1,ref:l},H.createElement("div",{className:x.itemsWrapper,style:{flexDirection:s}},n))))}function Ka({opened:e,transitionProps:t={transition:"fade",duration:0},shadow:n,withinPortal:r,portalProps:o,children:s,__staticSelector:i,onDirectionChange:l,switchDirectionOnFlip:u,zIndex:p,dropdownPosition:m,positionDependencies:h=[],classNames:g,styles:x,unstyled:y,readOnly:b,variant:w}){return H.createElement(Bc,{unstyled:y,classNames:g,styles:x,width:"target",withRoles:!1,opened:e,middlewares:{flip:m==="flip",shift:!1},position:m==="flip"?"bottom":m,positionDependencies:h,zIndex:p,__staticSelector:i,withinPortal:r,portalProps:o,transitionProps:t,shadow:n,disabled:b,onPositionChange:S=>u&&(l==null?void 0:l(S==="top"?"column-reverse":"column")),variant:w},s)}Ka.Target=Bc.Target;Ka.Dropdown=rY;var oY=Object.defineProperty,sY=Object.defineProperties,aY=Object.getOwnPropertyDescriptors,Lm=Object.getOwnPropertySymbols,mE=Object.prototype.hasOwnProperty,hE=Object.prototype.propertyIsEnumerable,xk=(e,t,n)=>t in e?oY(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,vp=(e,t)=>{for(var n in t||(t={}))mE.call(t,n)&&xk(e,n,t[n]);if(Lm)for(var n of Lm(t))hE.call(t,n)&&xk(e,n,t[n]);return e},iY=(e,t)=>sY(e,aY(t)),lY=(e,t)=>{var n={};for(var r in e)mE.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Lm)for(var r of Lm(e))t.indexOf(r)<0&&hE.call(e,r)&&(n[r]=e[r]);return n};function gE(e,t,n){const r=Rn(e,t,n),{label:o,description:s,error:i,required:l,classNames:u,styles:p,className:m,unstyled:h,__staticSelector:g,sx:x,errorProps:y,labelProps:b,descriptionProps:w,wrapperProps:S,id:j,size:_,style:E,inputContainer:I,inputWrapperOrder:M,withAsterisk:R,variant:D}=r,A=lY(r,["label","description","error","required","classNames","styles","className","unstyled","__staticSelector","sx","errorProps","labelProps","descriptionProps","wrapperProps","id","size","style","inputContainer","inputWrapperOrder","withAsterisk","variant"]),O=ey(j),{systemStyles:T,rest:X}=eg(A),B=vp({label:o,description:s,error:i,required:l,classNames:u,className:m,__staticSelector:g,sx:x,errorProps:y,labelProps:b,descriptionProps:w,unstyled:h,styles:p,id:O,size:_,style:E,inputContainer:I,inputWrapperOrder:M,withAsterisk:R,variant:D},S);return iY(vp({},X),{classNames:u,styles:p,unstyled:h,wrapperProps:vp(vp({},B),T),inputProps:{required:l,classNames:u,styles:p,unstyled:h,id:O,size:_,__staticSelector:g,error:i,variant:D}})}var cY=fr((e,t,{size:n})=>({label:{display:"inline-block",fontSize:mt({size:n,sizes:e.fontSizes}),fontWeight:500,color:e.colorScheme==="dark"?e.colors.dark[0]:e.colors.gray[9],wordBreak:"break-word",cursor:"default",WebkitTapHighlightColor:"transparent"},required:{color:e.fn.variant({variant:"filled",color:"red"}).background}}));const uY=cY;var dY=Object.defineProperty,zm=Object.getOwnPropertySymbols,vE=Object.prototype.hasOwnProperty,xE=Object.prototype.propertyIsEnumerable,bk=(e,t,n)=>t in e?dY(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,fY=(e,t)=>{for(var n in t||(t={}))vE.call(t,n)&&bk(e,n,t[n]);if(zm)for(var n of zm(t))xE.call(t,n)&&bk(e,n,t[n]);return e},pY=(e,t)=>{var n={};for(var r in e)vE.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&zm)for(var r of zm(e))t.indexOf(r)<0&&xE.call(e,r)&&(n[r]=e[r]);return n};const mY={labelElement:"label",size:"sm"},cy=d.forwardRef((e,t)=>{const n=Rn("InputLabel",mY,e),{labelElement:r,children:o,required:s,size:i,classNames:l,styles:u,unstyled:p,className:m,htmlFor:h,__staticSelector:g,variant:x,onMouseDown:y}=n,b=pY(n,["labelElement","children","required","size","classNames","styles","unstyled","className","htmlFor","__staticSelector","variant","onMouseDown"]),{classes:w,cx:S}=uY(null,{name:["InputWrapper",g],classNames:l,styles:u,unstyled:p,variant:x,size:i});return H.createElement(zr,fY({component:r,ref:t,className:S(w.label,m),htmlFor:r==="label"?h:void 0,onMouseDown:j=>{y==null||y(j),!j.defaultPrevented&&j.detail>1&&j.preventDefault()}},b),o,s&&H.createElement("span",{className:w.required,"aria-hidden":!0}," *"))});cy.displayName="@mantine/core/InputLabel";var hY=fr((e,t,{size:n})=>({error:{wordBreak:"break-word",color:e.fn.variant({variant:"filled",color:"red"}).background,fontSize:`calc(${mt({size:n,sizes:e.fontSizes})} - ${Re(2)})`,lineHeight:1.2,display:"block"}}));const gY=hY;var vY=Object.defineProperty,Fm=Object.getOwnPropertySymbols,bE=Object.prototype.hasOwnProperty,yE=Object.prototype.propertyIsEnumerable,yk=(e,t,n)=>t in e?vY(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,xY=(e,t)=>{for(var n in t||(t={}))bE.call(t,n)&&yk(e,n,t[n]);if(Fm)for(var n of Fm(t))yE.call(t,n)&&yk(e,n,t[n]);return e},bY=(e,t)=>{var n={};for(var r in e)bE.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Fm)for(var r of Fm(e))t.indexOf(r)<0&&yE.call(e,r)&&(n[r]=e[r]);return n};const yY={size:"sm"},uy=d.forwardRef((e,t)=>{const n=Rn("InputError",yY,e),{children:r,className:o,classNames:s,styles:i,unstyled:l,size:u,__staticSelector:p,variant:m}=n,h=bY(n,["children","className","classNames","styles","unstyled","size","__staticSelector","variant"]),{classes:g,cx:x}=gY(null,{name:["InputWrapper",p],classNames:s,styles:i,unstyled:l,variant:m,size:u});return H.createElement(wc,xY({className:x(g.error,o),ref:t},h),r)});uy.displayName="@mantine/core/InputError";var CY=fr((e,t,{size:n})=>({description:{wordBreak:"break-word",color:e.colorScheme==="dark"?e.colors.dark[2]:e.colors.gray[6],fontSize:`calc(${mt({size:n,sizes:e.fontSizes})} - ${Re(2)})`,lineHeight:1.2,display:"block"}}));const wY=CY;var SY=Object.defineProperty,Bm=Object.getOwnPropertySymbols,CE=Object.prototype.hasOwnProperty,wE=Object.prototype.propertyIsEnumerable,Ck=(e,t,n)=>t in e?SY(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,kY=(e,t)=>{for(var n in t||(t={}))CE.call(t,n)&&Ck(e,n,t[n]);if(Bm)for(var n of Bm(t))wE.call(t,n)&&Ck(e,n,t[n]);return e},jY=(e,t)=>{var n={};for(var r in e)CE.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Bm)for(var r of Bm(e))t.indexOf(r)<0&&wE.call(e,r)&&(n[r]=e[r]);return n};const _Y={size:"sm"},dy=d.forwardRef((e,t)=>{const n=Rn("InputDescription",_Y,e),{children:r,className:o,classNames:s,styles:i,unstyled:l,size:u,__staticSelector:p,variant:m}=n,h=jY(n,["children","className","classNames","styles","unstyled","size","__staticSelector","variant"]),{classes:g,cx:x}=wY(null,{name:["InputWrapper",p],classNames:s,styles:i,unstyled:l,variant:m,size:u});return H.createElement(wc,kY({color:"dimmed",className:x(g.description,o),ref:t,unstyled:l},h),r)});dy.displayName="@mantine/core/InputDescription";const SE=d.createContext({offsetBottom:!1,offsetTop:!1,describedBy:void 0}),IY=SE.Provider,PY=()=>d.useContext(SE);function EY(e,{hasDescription:t,hasError:n}){const r=e.findIndex(u=>u==="input"),o=e[r-1],s=e[r+1];return{offsetBottom:t&&s==="description"||n&&s==="error",offsetTop:t&&o==="description"||n&&o==="error"}}var MY=Object.defineProperty,OY=Object.defineProperties,RY=Object.getOwnPropertyDescriptors,wk=Object.getOwnPropertySymbols,DY=Object.prototype.hasOwnProperty,AY=Object.prototype.propertyIsEnumerable,Sk=(e,t,n)=>t in e?MY(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,TY=(e,t)=>{for(var n in t||(t={}))DY.call(t,n)&&Sk(e,n,t[n]);if(wk)for(var n of wk(t))AY.call(t,n)&&Sk(e,n,t[n]);return e},NY=(e,t)=>OY(e,RY(t)),$Y=fr(e=>({root:NY(TY({},e.fn.fontStyles()),{lineHeight:e.lineHeight})}));const LY=$Y;var zY=Object.defineProperty,FY=Object.defineProperties,BY=Object.getOwnPropertyDescriptors,Hm=Object.getOwnPropertySymbols,kE=Object.prototype.hasOwnProperty,jE=Object.prototype.propertyIsEnumerable,kk=(e,t,n)=>t in e?zY(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,$a=(e,t)=>{for(var n in t||(t={}))kE.call(t,n)&&kk(e,n,t[n]);if(Hm)for(var n of Hm(t))jE.call(t,n)&&kk(e,n,t[n]);return e},jk=(e,t)=>FY(e,BY(t)),HY=(e,t)=>{var n={};for(var r in e)kE.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Hm)for(var r of Hm(e))t.indexOf(r)<0&&jE.call(e,r)&&(n[r]=e[r]);return n};const VY={labelElement:"label",size:"sm",inputContainer:e=>e,inputWrapperOrder:["label","description","input","error"]},_E=d.forwardRef((e,t)=>{const n=Rn("InputWrapper",VY,e),{className:r,label:o,children:s,required:i,id:l,error:u,description:p,labelElement:m,labelProps:h,descriptionProps:g,errorProps:x,classNames:y,styles:b,size:w,inputContainer:S,__staticSelector:j,unstyled:_,inputWrapperOrder:E,withAsterisk:I,variant:M}=n,R=HY(n,["className","label","children","required","id","error","description","labelElement","labelProps","descriptionProps","errorProps","classNames","styles","size","inputContainer","__staticSelector","unstyled","inputWrapperOrder","withAsterisk","variant"]),{classes:D,cx:A}=LY(null,{classNames:y,styles:b,name:["InputWrapper",j],unstyled:_,variant:M,size:w}),O={classNames:y,styles:b,unstyled:_,size:w,variant:M,__staticSelector:j},T=typeof I=="boolean"?I:i,X=l?`${l}-error`:x==null?void 0:x.id,B=l?`${l}-description`:g==null?void 0:g.id,U=`${!!u&&typeof u!="boolean"?X:""} ${p?B:""}`,N=U.trim().length>0?U.trim():void 0,$=o&&H.createElement(cy,$a($a({key:"label",labelElement:m,id:l?`${l}-label`:void 0,htmlFor:l,required:T},O),h),o),q=p&&H.createElement(dy,jk($a($a({key:"description"},g),O),{size:(g==null?void 0:g.size)||O.size,id:(g==null?void 0:g.id)||B}),p),F=H.createElement(d.Fragment,{key:"input"},S(s)),Q=typeof u!="boolean"&&u&&H.createElement(uy,jk($a($a({},x),O),{size:(x==null?void 0:x.size)||O.size,key:"error",id:(x==null?void 0:x.id)||X}),u),Y=E.map(se=>{switch(se){case"label":return $;case"input":return F;case"description":return q;case"error":return Q;default:return null}});return H.createElement(IY,{value:$a({describedBy:N},EY(E,{hasDescription:!!q,hasError:!!Q}))},H.createElement(zr,$a({className:A(D.root,r),ref:t},R),Y))});_E.displayName="@mantine/core/InputWrapper";var WY=Object.defineProperty,Vm=Object.getOwnPropertySymbols,IE=Object.prototype.hasOwnProperty,PE=Object.prototype.propertyIsEnumerable,_k=(e,t,n)=>t in e?WY(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,UY=(e,t)=>{for(var n in t||(t={}))IE.call(t,n)&&_k(e,n,t[n]);if(Vm)for(var n of Vm(t))PE.call(t,n)&&_k(e,n,t[n]);return e},GY=(e,t)=>{var n={};for(var r in e)IE.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Vm)for(var r of Vm(e))t.indexOf(r)<0&&PE.call(e,r)&&(n[r]=e[r]);return n};const KY={},EE=d.forwardRef((e,t)=>{const n=Rn("InputPlaceholder",KY,e),{sx:r}=n,o=GY(n,["sx"]);return H.createElement(zr,UY({component:"span",sx:[s=>s.fn.placeholderStyles(),...EP(r)],ref:t},o))});EE.displayName="@mantine/core/InputPlaceholder";var qY=Object.defineProperty,XY=Object.defineProperties,QY=Object.getOwnPropertyDescriptors,Ik=Object.getOwnPropertySymbols,YY=Object.prototype.hasOwnProperty,ZY=Object.prototype.propertyIsEnumerable,Pk=(e,t,n)=>t in e?qY(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,xp=(e,t)=>{for(var n in t||(t={}))YY.call(t,n)&&Pk(e,n,t[n]);if(Ik)for(var n of Ik(t))ZY.call(t,n)&&Pk(e,n,t[n]);return e},Pv=(e,t)=>XY(e,QY(t));const mo={xs:Re(30),sm:Re(36),md:Re(42),lg:Re(50),xl:Re(60)},JY=["default","filled","unstyled"];function eZ({theme:e,variant:t}){return JY.includes(t)?t==="default"?{border:`${Re(1)} solid ${e.colorScheme==="dark"?e.colors.dark[4]:e.colors.gray[4]}`,backgroundColor:e.colorScheme==="dark"?e.colors.dark[6]:e.white,transition:"border-color 100ms ease","&:focus, &:focus-within":e.focusRingStyles.inputStyles(e)}:t==="filled"?{border:`${Re(1)} solid transparent`,backgroundColor:e.colorScheme==="dark"?e.colors.dark[5]:e.colors.gray[1],"&:focus, &:focus-within":e.focusRingStyles.inputStyles(e)}:{borderWidth:0,color:e.colorScheme==="dark"?e.colors.dark[0]:e.black,backgroundColor:"transparent",minHeight:Re(28),outline:0,"&:focus, &:focus-within":{outline:"none",borderColor:"transparent"},"&:disabled":{backgroundColor:"transparent","&:focus, &:focus-within":{outline:"none",borderColor:"transparent"}}}:null}var tZ=fr((e,{multiline:t,radius:n,invalid:r,rightSectionWidth:o,withRightSection:s,iconWidth:i,offsetBottom:l,offsetTop:u,pointer:p},{variant:m,size:h})=>{const g=e.fn.variant({variant:"filled",color:"red"}).background,x=m==="default"||m==="filled"?{minHeight:mt({size:h,sizes:mo}),paddingLeft:`calc(${mt({size:h,sizes:mo})} / 3)`,paddingRight:s?o||mt({size:h,sizes:mo}):`calc(${mt({size:h,sizes:mo})} / 3)`,borderRadius:e.fn.radius(n)}:m==="unstyled"&&s?{paddingRight:o||mt({size:h,sizes:mo})}:null;return{wrapper:{position:"relative",marginTop:u?`calc(${e.spacing.xs} / 2)`:void 0,marginBottom:l?`calc(${e.spacing.xs} / 2)`:void 0,"&:has(input:disabled)":{"& .mantine-Input-rightSection":{display:"none"}}},input:Pv(xp(xp(Pv(xp({},e.fn.fontStyles()),{height:t?m==="unstyled"?void 0:"auto":mt({size:h,sizes:mo}),WebkitTapHighlightColor:"transparent",lineHeight:t?e.lineHeight:`calc(${mt({size:h,sizes:mo})} - ${Re(2)})`,appearance:"none",resize:"none",boxSizing:"border-box",fontSize:mt({size:h,sizes:e.fontSizes}),width:"100%",color:e.colorScheme==="dark"?e.colors.dark[0]:e.black,display:"block",textAlign:"left",cursor:p?"pointer":void 0}),eZ({theme:e,variant:m})),x),{"&:disabled, &[data-disabled]":{backgroundColor:e.colorScheme==="dark"?e.colors.dark[6]:e.colors.gray[1],color:e.colors.dark[2],opacity:.6,cursor:"not-allowed",pointerEvents:"none","&::placeholder":{color:e.colors.dark[2]}},"&[data-invalid]":{color:g,borderColor:g,"&::placeholder":{opacity:1,color:g}},"&[data-with-icon]":{paddingLeft:typeof i=="number"?Re(i):mt({size:h,sizes:mo})},"&::placeholder":Pv(xp({},e.fn.placeholderStyles()),{opacity:1}),"&::-webkit-inner-spin-button, &::-webkit-outer-spin-button, &::-webkit-search-decoration, &::-webkit-search-cancel-button, &::-webkit-search-results-button, &::-webkit-search-results-decoration":{appearance:"none"},"&[type=number]":{MozAppearance:"textfield"}}),icon:{pointerEvents:"none",position:"absolute",zIndex:1,left:0,top:0,bottom:0,display:"flex",alignItems:"center",justifyContent:"center",width:i?Re(i):mt({size:h,sizes:mo}),color:r?e.colors.red[e.colorScheme==="dark"?6:7]:e.colorScheme==="dark"?e.colors.dark[2]:e.colors.gray[5]},rightSection:{position:"absolute",top:0,bottom:0,right:0,display:"flex",alignItems:"center",justifyContent:"center",width:o||mt({size:h,sizes:mo})}}});const nZ=tZ;var rZ=Object.defineProperty,oZ=Object.defineProperties,sZ=Object.getOwnPropertyDescriptors,Wm=Object.getOwnPropertySymbols,ME=Object.prototype.hasOwnProperty,OE=Object.prototype.propertyIsEnumerable,Ek=(e,t,n)=>t in e?rZ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,bp=(e,t)=>{for(var n in t||(t={}))ME.call(t,n)&&Ek(e,n,t[n]);if(Wm)for(var n of Wm(t))OE.call(t,n)&&Ek(e,n,t[n]);return e},Mk=(e,t)=>oZ(e,sZ(t)),aZ=(e,t)=>{var n={};for(var r in e)ME.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Wm)for(var r of Wm(e))t.indexOf(r)<0&&OE.call(e,r)&&(n[r]=e[r]);return n};const iZ={size:"sm",variant:"default"},il=d.forwardRef((e,t)=>{const n=Rn("Input",iZ,e),{className:r,error:o,required:s,disabled:i,variant:l,icon:u,style:p,rightSectionWidth:m,iconWidth:h,rightSection:g,rightSectionProps:x,radius:y,size:b,wrapperProps:w,classNames:S,styles:j,__staticSelector:_,multiline:E,sx:I,unstyled:M,pointer:R}=n,D=aZ(n,["className","error","required","disabled","variant","icon","style","rightSectionWidth","iconWidth","rightSection","rightSectionProps","radius","size","wrapperProps","classNames","styles","__staticSelector","multiline","sx","unstyled","pointer"]),{offsetBottom:A,offsetTop:O,describedBy:T}=PY(),{classes:X,cx:B}=nZ({radius:y,multiline:E,invalid:!!o,rightSectionWidth:m?Re(m):void 0,iconWidth:h,withRightSection:!!g,offsetBottom:A,offsetTop:O,pointer:R},{classNames:S,styles:j,name:["Input",_],unstyled:M,variant:l,size:b}),{systemStyles:V,rest:U}=eg(D);return H.createElement(zr,bp(bp({className:B(X.wrapper,r),sx:I,style:p},V),w),u&&H.createElement("div",{className:X.icon},u),H.createElement(zr,Mk(bp({component:"input"},U),{ref:t,required:s,"aria-invalid":!!o,"aria-describedby":T,disabled:i,"data-disabled":i||void 0,"data-with-icon":!!u||void 0,"data-invalid":!!o||void 0,className:X.input})),g&&H.createElement("div",Mk(bp({},x),{className:X.rightSection}),g))});il.displayName="@mantine/core/Input";il.Wrapper=_E;il.Label=cy;il.Description=dy;il.Error=uy;il.Placeholder=EE;const _c=il;var lZ=Object.defineProperty,Um=Object.getOwnPropertySymbols,RE=Object.prototype.hasOwnProperty,DE=Object.prototype.propertyIsEnumerable,Ok=(e,t,n)=>t in e?lZ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Rk=(e,t)=>{for(var n in t||(t={}))RE.call(t,n)&&Ok(e,n,t[n]);if(Um)for(var n of Um(t))DE.call(t,n)&&Ok(e,n,t[n]);return e},cZ=(e,t)=>{var n={};for(var r in e)RE.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Um)for(var r of Um(e))t.indexOf(r)<0&&DE.call(e,r)&&(n[r]=e[r]);return n};const uZ={multiple:!1},AE=d.forwardRef((e,t)=>{const n=Rn("FileButton",uZ,e),{onChange:r,children:o,multiple:s,accept:i,name:l,form:u,resetRef:p,disabled:m,capture:h,inputProps:g}=n,x=cZ(n,["onChange","children","multiple","accept","name","form","resetRef","disabled","capture","inputProps"]),y=d.useRef(),b=()=>{!m&&y.current.click()},w=j=>{r(s?Array.from(j.currentTarget.files):j.currentTarget.files[0]||null)};return zP(p,()=>{y.current.value=""}),H.createElement(H.Fragment,null,o(Rk({onClick:b},x)),H.createElement("input",Rk({style:{display:"none"},type:"file",accept:i,multiple:s,onChange:w,ref:Bd(t,y),name:l,form:u,capture:h},g)))});AE.displayName="@mantine/core/FileButton";const TE={xs:Re(16),sm:Re(22),md:Re(26),lg:Re(30),xl:Re(36)},dZ={xs:Re(10),sm:Re(12),md:Re(14),lg:Re(16),xl:Re(18)};var fZ=fr((e,{disabled:t,radius:n,readOnly:r},{size:o,variant:s})=>({defaultValue:{display:"flex",alignItems:"center",backgroundColor:t?e.colorScheme==="dark"?e.colors.dark[5]:e.colors.gray[3]:e.colorScheme==="dark"?e.colors.dark[7]:s==="filled"?e.white:e.colors.gray[1],color:t?e.colorScheme==="dark"?e.colors.dark[1]:e.colors.gray[7]:e.colorScheme==="dark"?e.colors.dark[0]:e.colors.gray[7],height:mt({size:o,sizes:TE}),paddingLeft:`calc(${mt({size:o,sizes:e.spacing})} / 1.5)`,paddingRight:t||r?mt({size:o,sizes:e.spacing}):0,fontWeight:500,fontSize:mt({size:o,sizes:dZ}),borderRadius:mt({size:n,sizes:e.radius}),cursor:t?"not-allowed":"default",userSelect:"none",maxWidth:`calc(100% - ${Re(10)})`},defaultValueRemove:{color:e.colorScheme==="dark"?e.colors.dark[0]:e.colors.gray[7],marginLeft:`calc(${mt({size:o,sizes:e.spacing})} / 6)`},defaultValueLabel:{display:"block",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}}));const pZ=fZ;var mZ=Object.defineProperty,Gm=Object.getOwnPropertySymbols,NE=Object.prototype.hasOwnProperty,$E=Object.prototype.propertyIsEnumerable,Dk=(e,t,n)=>t in e?mZ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,hZ=(e,t)=>{for(var n in t||(t={}))NE.call(t,n)&&Dk(e,n,t[n]);if(Gm)for(var n of Gm(t))$E.call(t,n)&&Dk(e,n,t[n]);return e},gZ=(e,t)=>{var n={};for(var r in e)NE.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Gm)for(var r of Gm(e))t.indexOf(r)<0&&$E.call(e,r)&&(n[r]=e[r]);return n};const vZ={xs:16,sm:22,md:24,lg:26,xl:30};function LE(e){var t=e,{label:n,classNames:r,styles:o,className:s,onRemove:i,disabled:l,readOnly:u,size:p,radius:m="sm",variant:h,unstyled:g}=t,x=gZ(t,["label","classNames","styles","className","onRemove","disabled","readOnly","size","radius","variant","unstyled"]);const{classes:y,cx:b}=pZ({disabled:l,readOnly:u,radius:m},{name:"MultiSelect",classNames:r,styles:o,unstyled:g,size:p,variant:h});return H.createElement("div",hZ({className:b(y.defaultValue,s)},x),H.createElement("span",{className:y.defaultValueLabel},n),!l&&!u&&H.createElement(x6,{"aria-hidden":!0,onMouseDown:i,size:vZ[p],radius:2,color:"blue",variant:"transparent",iconSize:"70%",className:y.defaultValueRemove,tabIndex:-1,unstyled:g}))}LE.displayName="@mantine/core/MultiSelect/DefaultValue";function xZ({data:e,searchable:t,limit:n,searchValue:r,filter:o,value:s,disableSelectedItemFiltering:i}){if(!t&&s.length===0)return e;if(!t){const u=[];for(let p=0;pm===e[p].value&&!e[p].disabled))&&u.push(e[p]);return u}const l=[];for(let u=0;up===e[u].value&&!e[u].disabled),e[u])&&l.push(e[u]),!(l.length>=n));u+=1);return l}var bZ=Object.defineProperty,Km=Object.getOwnPropertySymbols,zE=Object.prototype.hasOwnProperty,FE=Object.prototype.propertyIsEnumerable,Ak=(e,t,n)=>t in e?bZ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Tk=(e,t)=>{for(var n in t||(t={}))zE.call(t,n)&&Ak(e,n,t[n]);if(Km)for(var n of Km(t))FE.call(t,n)&&Ak(e,n,t[n]);return e},yZ=(e,t)=>{var n={};for(var r in e)zE.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Km)for(var r of Km(e))t.indexOf(r)<0&&FE.call(e,r)&&(n[r]=e[r]);return n};const CZ={xs:Re(14),sm:Re(18),md:Re(20),lg:Re(24),xl:Re(28)};function wZ(e){var t=e,{size:n,error:r,style:o}=t,s=yZ(t,["size","error","style"]);const i=xa(),l=mt({size:n,sizes:CZ});return H.createElement("svg",Tk({viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:Tk({color:r?i.colors.red[6]:i.colors.gray[6],width:l,height:l},o),"data-chevron":!0},s),H.createElement("path",{d:"M4.93179 5.43179C4.75605 5.60753 4.75605 5.89245 4.93179 6.06819C5.10753 6.24392 5.39245 6.24392 5.56819 6.06819L7.49999 4.13638L9.43179 6.06819C9.60753 6.24392 9.89245 6.24392 10.0682 6.06819C10.2439 5.89245 10.2439 5.60753 10.0682 5.43179L7.81819 3.18179C7.73379 3.0974 7.61933 3.04999 7.49999 3.04999C7.38064 3.04999 7.26618 3.0974 7.18179 3.18179L4.93179 5.43179ZM10.0682 9.56819C10.2439 9.39245 10.2439 9.10753 10.0682 8.93179C9.89245 8.75606 9.60753 8.75606 9.43179 8.93179L7.49999 10.8636L5.56819 8.93179C5.39245 8.75606 5.10753 8.75606 4.93179 8.93179C4.75605 9.10753 4.75605 9.39245 4.93179 9.56819L7.18179 11.8182C7.35753 11.9939 7.64245 11.9939 7.81819 11.8182L10.0682 9.56819Z",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd"}))}var SZ=Object.defineProperty,kZ=Object.defineProperties,jZ=Object.getOwnPropertyDescriptors,Nk=Object.getOwnPropertySymbols,_Z=Object.prototype.hasOwnProperty,IZ=Object.prototype.propertyIsEnumerable,$k=(e,t,n)=>t in e?SZ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,PZ=(e,t)=>{for(var n in t||(t={}))_Z.call(t,n)&&$k(e,n,t[n]);if(Nk)for(var n of Nk(t))IZ.call(t,n)&&$k(e,n,t[n]);return e},EZ=(e,t)=>kZ(e,jZ(t));function BE({shouldClear:e,clearButtonProps:t,onClear:n,size:r,error:o}){return e?H.createElement(x6,EZ(PZ({},t),{variant:"transparent",onClick:n,size:r,onMouseDown:s=>s.preventDefault()})):H.createElement(wZ,{error:o,size:r})}BE.displayName="@mantine/core/SelectRightSection";var MZ=Object.defineProperty,OZ=Object.defineProperties,RZ=Object.getOwnPropertyDescriptors,qm=Object.getOwnPropertySymbols,HE=Object.prototype.hasOwnProperty,VE=Object.prototype.propertyIsEnumerable,Lk=(e,t,n)=>t in e?MZ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ev=(e,t)=>{for(var n in t||(t={}))HE.call(t,n)&&Lk(e,n,t[n]);if(qm)for(var n of qm(t))VE.call(t,n)&&Lk(e,n,t[n]);return e},zk=(e,t)=>OZ(e,RZ(t)),DZ=(e,t)=>{var n={};for(var r in e)HE.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&qm)for(var r of qm(e))t.indexOf(r)<0&&VE.call(e,r)&&(n[r]=e[r]);return n};function WE(e){var t=e,{styles:n,rightSection:r,rightSectionWidth:o,theme:s}=t,i=DZ(t,["styles","rightSection","rightSectionWidth","theme"]);if(r)return{rightSection:r,rightSectionWidth:o,styles:n};const l=typeof n=="function"?n(s):n;return{rightSection:!i.readOnly&&!(i.disabled&&i.shouldClear)&&H.createElement(BE,Ev({},i)),styles:zk(Ev({},l),{rightSection:zk(Ev({},l==null?void 0:l.rightSection),{pointerEvents:i.shouldClear?void 0:"none"})})}}var AZ=Object.defineProperty,TZ=Object.defineProperties,NZ=Object.getOwnPropertyDescriptors,Fk=Object.getOwnPropertySymbols,$Z=Object.prototype.hasOwnProperty,LZ=Object.prototype.propertyIsEnumerable,Bk=(e,t,n)=>t in e?AZ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,zZ=(e,t)=>{for(var n in t||(t={}))$Z.call(t,n)&&Bk(e,n,t[n]);if(Fk)for(var n of Fk(t))LZ.call(t,n)&&Bk(e,n,t[n]);return e},FZ=(e,t)=>TZ(e,NZ(t)),BZ=fr((e,{invalid:t},{size:n})=>({wrapper:{position:"relative","&:has(input:disabled)":{cursor:"not-allowed",pointerEvents:"none","& .mantine-MultiSelect-input":{backgroundColor:e.colorScheme==="dark"?e.colors.dark[6]:e.colors.gray[1],color:e.colors.dark[2],opacity:.6,"&::placeholder":{color:e.colors.dark[2]}},"& .mantine-MultiSelect-defaultValue":{backgroundColor:e.colorScheme==="dark"?e.colors.dark[5]:e.colors.gray[3],color:e.colorScheme==="dark"?e.colors.dark[1]:e.colors.gray[7]}}},values:{minHeight:`calc(${mt({size:n,sizes:mo})} - ${Re(2)})`,display:"flex",alignItems:"center",flexWrap:"wrap",marginLeft:`calc(-${e.spacing.xs} / 2)`,boxSizing:"border-box","&[data-clearable]":{marginRight:mt({size:n,sizes:mo})}},value:{margin:`calc(${e.spacing.xs} / 2 - ${Re(2)}) calc(${e.spacing.xs} / 2)`},searchInput:FZ(zZ({},e.fn.fontStyles()),{flex:1,minWidth:Re(60),backgroundColor:"transparent",border:0,outline:0,fontSize:mt({size:n,sizes:e.fontSizes}),padding:0,marginLeft:`calc(${e.spacing.xs} / 2)`,appearance:"none",color:"inherit",maxHeight:mt({size:n,sizes:TE}),"&::placeholder":{opacity:1,color:t?e.colors.red[e.fn.primaryShade()]:e.colorScheme==="dark"?e.colors.dark[3]:e.colors.gray[5]},"&:disabled":{cursor:"not-allowed",pointerEvents:"none"}}),searchInputEmpty:{width:"100%"},searchInputInputHidden:{flex:0,width:0,minWidth:0,margin:0,overflow:"hidden"},searchInputPointer:{cursor:"pointer","&:disabled":{cursor:"not-allowed",pointerEvents:"none"}},input:{cursor:"pointer","&:disabled":{cursor:"not-allowed",pointerEvents:"none"}}}));const HZ=BZ;var VZ=Object.defineProperty,WZ=Object.defineProperties,UZ=Object.getOwnPropertyDescriptors,Xm=Object.getOwnPropertySymbols,UE=Object.prototype.hasOwnProperty,GE=Object.prototype.propertyIsEnumerable,Hk=(e,t,n)=>t in e?VZ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,zl=(e,t)=>{for(var n in t||(t={}))UE.call(t,n)&&Hk(e,n,t[n]);if(Xm)for(var n of Xm(t))GE.call(t,n)&&Hk(e,n,t[n]);return e},Vk=(e,t)=>WZ(e,UZ(t)),GZ=(e,t)=>{var n={};for(var r in e)UE.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Xm)for(var r of Xm(e))t.indexOf(r)<0&&GE.call(e,r)&&(n[r]=e[r]);return n};function KZ(e,t,n){return t?!1:n.label.toLowerCase().trim().includes(e.toLowerCase().trim())}function qZ(e,t){return!!e&&!t.some(n=>n.value.toLowerCase()===e.toLowerCase())}function Wk(e,t){if(!Array.isArray(e))return;if(t.length===0)return[];const n=t.map(r=>typeof r=="object"?r.value:r);return e.filter(r=>n.includes(r))}const XZ={size:"sm",valueComponent:LE,itemComponent:ny,transitionProps:{transition:"fade",duration:0},maxDropdownHeight:220,shadow:"sm",searchable:!1,filter:KZ,limit:1/0,clearSearchOnChange:!0,clearable:!1,clearSearchOnBlur:!1,disabled:!1,initiallyOpened:!1,creatable:!1,shouldCreate:qZ,switchDirectionOnFlip:!1,zIndex:Zb("popover"),selectOnBlur:!1,positionDependencies:[],dropdownPosition:"flip"},KE=d.forwardRef((e,t)=>{const n=Rn("MultiSelect",XZ,e),{className:r,style:o,required:s,label:i,description:l,size:u,error:p,classNames:m,styles:h,wrapperProps:g,value:x,defaultValue:y,data:b,onChange:w,valueComponent:S,itemComponent:j,id:_,transitionProps:E,maxDropdownHeight:I,shadow:M,nothingFound:R,onFocus:D,onBlur:A,searchable:O,placeholder:T,filter:X,limit:B,clearSearchOnChange:V,clearable:U,clearSearchOnBlur:N,variant:$,onSearchChange:q,searchValue:F,disabled:Q,initiallyOpened:Y,radius:se,icon:ae,rightSection:re,rightSectionWidth:G,creatable:K,getCreateLabel:ee,shouldCreate:ce,onCreate:J,sx:ie,dropdownComponent:de,onDropdownClose:ge,onDropdownOpen:Ce,maxSelectedValues:he,withinPortal:fe,portalProps:Oe,switchDirectionOnFlip:_e,zIndex:Ne,selectOnBlur:nt,name:$e,dropdownPosition:Pt,errorProps:Ze,labelProps:ot,descriptionProps:ye,form:De,positionDependencies:ut,onKeyDown:bt,unstyled:be,inputContainer:Je,inputWrapperOrder:lt,readOnly:ft,withAsterisk:Me,clearButtonProps:Le,hoverOnSearchChange:Ut,disableSelectedItemFiltering:ke}=n,Be=GZ(n,["className","style","required","label","description","size","error","classNames","styles","wrapperProps","value","defaultValue","data","onChange","valueComponent","itemComponent","id","transitionProps","maxDropdownHeight","shadow","nothingFound","onFocus","onBlur","searchable","placeholder","filter","limit","clearSearchOnChange","clearable","clearSearchOnBlur","variant","onSearchChange","searchValue","disabled","initiallyOpened","radius","icon","rightSection","rightSectionWidth","creatable","getCreateLabel","shouldCreate","onCreate","sx","dropdownComponent","onDropdownClose","onDropdownOpen","maxSelectedValues","withinPortal","portalProps","switchDirectionOnFlip","zIndex","selectOnBlur","name","dropdownPosition","errorProps","labelProps","descriptionProps","form","positionDependencies","onKeyDown","unstyled","inputContainer","inputWrapperOrder","readOnly","withAsterisk","clearButtonProps","hoverOnSearchChange","disableSelectedItemFiltering"]),{classes:ze,cx:Ge,theme:pt}=HZ({invalid:!!p},{name:"MultiSelect",classNames:m,styles:h,unstyled:be,size:u,variant:$}),{systemStyles:Pn,rest:Dt}=eg(Be),At=d.useRef(),pr=d.useRef({}),Ln=ey(_),[kn,gn]=d.useState(Y),[an,kr]=d.useState(-1),[Mo,mr]=d.useState("column"),[hr,Ns]=od({value:F,defaultValue:"",finalValue:void 0,onChange:q}),[$s,wa]=d.useState(!1),{scrollIntoView:Sa,targetRef:ml,scrollableRef:ka}=BP({duration:0,offset:5,cancelable:!1,isList:!0}),hl=K&&typeof ee=="function";let Qe=null;const Gt=b.map(rt=>typeof rt=="string"?{label:rt,value:rt}:rt),zn=MP({data:Gt}),[St,ja]=od({value:Wk(x,b),defaultValue:Wk(y,b),finalValue:[],onChange:w}),Wr=d.useRef(!!he&&he{if(!ft){const Mt=St.filter(kt=>kt!==rt);ja(Mt),he&&Mt.length{Ns(rt.currentTarget.value),!Q&&!Wr.current&&O&&gn(!0)},Fg=rt=>{typeof D=="function"&&D(rt),!Q&&!Wr.current&&O&&gn(!0)},Fn=xZ({data:zn,searchable:O,searchValue:hr,limit:B,filter:X,value:St,disableSelectedItemFiltering:ke});hl&&ce(hr,zn)&&(Qe=ee(hr),Fn.push({label:hr,value:hr,creatable:!0}));const Ls=Math.min(an,Fn.length-1),tf=(rt,Mt,kt)=>{let Ot=rt;for(;kt(Ot);)if(Ot=Mt(Ot),!Fn[Ot].disabled)return Ot;return rt};Uo(()=>{kr(Ut&&hr?0:-1)},[hr,Ut]),Uo(()=>{!Q&&St.length>b.length&&gn(!1),he&&St.length=he&&(Wr.current=!0,gn(!1))},[St]);const gl=rt=>{if(!ft)if(V&&Ns(""),St.includes(rt.value))ef(rt.value);else{if(rt.creatable&&typeof J=="function"){const Mt=J(rt.value);typeof Mt<"u"&&Mt!==null&&ja(typeof Mt=="string"?[...St,Mt]:[...St,Mt.value])}else ja([...St,rt.value]);St.length===he-1&&(Wr.current=!0,gn(!1)),Fn.length===1&&gn(!1)}},Zc=rt=>{typeof A=="function"&&A(rt),nt&&Fn[Ls]&&kn&&gl(Fn[Ls]),N&&Ns(""),gn(!1)},mi=rt=>{if($s||(bt==null||bt(rt),ft)||rt.key!=="Backspace"&&he&&Wr.current)return;const Mt=Mo==="column",kt=()=>{kr(rr=>{var rn;const Dn=tf(rr,gr=>gr+1,gr=>gr{kr(rr=>{var rn;const Dn=tf(rr,gr=>gr-1,gr=>gr>0);return kn&&(ml.current=pr.current[(rn=Fn[Dn])==null?void 0:rn.value],Sa({alignment:Mt?"start":"end"})),Dn})};switch(rt.key){case"ArrowUp":{rt.preventDefault(),gn(!0),Mt?Ot():kt();break}case"ArrowDown":{rt.preventDefault(),gn(!0),Mt?kt():Ot();break}case"Enter":{rt.preventDefault(),Fn[Ls]&&kn?gl(Fn[Ls]):gn(!0);break}case" ":{O||(rt.preventDefault(),Fn[Ls]&&kn?gl(Fn[Ls]):gn(!0));break}case"Backspace":{St.length>0&&hr.length===0&&(ja(St.slice(0,-1)),gn(!0),he&&(Wr.current=!1));break}case"Home":{if(!O){rt.preventDefault(),kn||gn(!0);const rr=Fn.findIndex(rn=>!rn.disabled);kr(rr),Sa({alignment:Mt?"end":"start"})}break}case"End":{if(!O){rt.preventDefault(),kn||gn(!0);const rr=Fn.map(rn=>!!rn.disabled).lastIndexOf(!1);kr(rr),Sa({alignment:Mt?"end":"start"})}break}case"Escape":gn(!1)}},Jc=St.map(rt=>{let Mt=zn.find(kt=>kt.value===rt&&!kt.disabled);return!Mt&&hl&&(Mt={value:rt,label:rt}),Mt}).filter(rt=>!!rt).map((rt,Mt)=>H.createElement(S,Vk(zl({},rt),{variant:$,disabled:Q,className:ze.value,readOnly:ft,onRemove:kt=>{kt.preventDefault(),kt.stopPropagation(),ef(rt.value)},key:rt.value,size:u,styles:h,classNames:m,radius:se,index:Mt}))),eu=rt=>St.includes(rt),Bg=()=>{var rt;Ns(""),ja([]),(rt=At.current)==null||rt.focus(),he&&(Wr.current=!1)},_a=!ft&&(Fn.length>0?kn:kn&&!!R);return Uo(()=>{const rt=_a?Ce:ge;typeof rt=="function"&&rt()},[_a]),H.createElement(_c.Wrapper,zl(zl({required:s,id:Ln,label:i,error:p,description:l,size:u,className:r,style:o,classNames:m,styles:h,__staticSelector:"MultiSelect",sx:ie,errorProps:Ze,descriptionProps:ye,labelProps:ot,inputContainer:Je,inputWrapperOrder:lt,unstyled:be,withAsterisk:Me,variant:$},Pn),g),H.createElement(Ka,{opened:_a,transitionProps:E,shadow:"sm",withinPortal:fe,portalProps:Oe,__staticSelector:"MultiSelect",onDirectionChange:mr,switchDirectionOnFlip:_e,zIndex:Ne,dropdownPosition:Pt,positionDependencies:[...ut,hr],classNames:m,styles:h,unstyled:be,variant:$},H.createElement(Ka.Target,null,H.createElement("div",{className:ze.wrapper,role:"combobox","aria-haspopup":"listbox","aria-owns":kn&&_a?`${Ln}-items`:null,"aria-controls":Ln,"aria-expanded":kn,onMouseLeave:()=>kr(-1),tabIndex:-1},H.createElement("input",{type:"hidden",name:$e,value:St.join(","),form:De,disabled:Q}),H.createElement(_c,zl({__staticSelector:"MultiSelect",style:{overflow:"hidden"},component:"div",multiline:!0,size:u,variant:$,disabled:Q,error:p,required:s,radius:se,icon:ae,unstyled:be,onMouseDown:rt=>{var Mt;rt.preventDefault(),!Q&&!Wr.current&&gn(!kn),(Mt=At.current)==null||Mt.focus()},classNames:Vk(zl({},m),{input:Ge({[ze.input]:!O},m==null?void 0:m.input)})},WE({theme:pt,rightSection:re,rightSectionWidth:G,styles:h,size:u,shouldClear:U&&St.length>0,onClear:Bg,error:p,disabled:Q,clearButtonProps:Le,readOnly:ft})),H.createElement("div",{className:ze.values,"data-clearable":U||void 0},Jc,H.createElement("input",zl({ref:Bd(t,At),type:"search",id:Ln,className:Ge(ze.searchInput,{[ze.searchInputPointer]:!O,[ze.searchInputInputHidden]:!kn&&St.length>0||!O&&St.length>0,[ze.searchInputEmpty]:St.length===0}),onKeyDown:mi,value:hr,onChange:zg,onFocus:Fg,onBlur:Zc,readOnly:!O||Wr.current||ft,placeholder:St.length===0?T:void 0,disabled:Q,"data-mantine-stop-propagation":kn,autoComplete:"off",onCompositionStart:()=>wa(!0),onCompositionEnd:()=>wa(!1)},Dt)))))),H.createElement(Ka.Dropdown,{component:de||og,maxHeight:I,direction:Mo,id:Ln,innerRef:ka,__staticSelector:"MultiSelect",classNames:m,styles:h},H.createElement(ty,{data:Fn,hovered:Ls,classNames:m,styles:h,uuid:Ln,__staticSelector:"MultiSelect",onItemHover:kr,onItemSelect:gl,itemsRefs:pr,itemComponent:j,size:u,nothingFound:R,isItemSelected:eu,creatable:K&&!!Qe,createLabel:Qe,unstyled:be,variant:$}))))});KE.displayName="@mantine/core/MultiSelect";var QZ=Object.defineProperty,YZ=Object.defineProperties,ZZ=Object.getOwnPropertyDescriptors,Qm=Object.getOwnPropertySymbols,qE=Object.prototype.hasOwnProperty,XE=Object.prototype.propertyIsEnumerable,Uk=(e,t,n)=>t in e?QZ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Mv=(e,t)=>{for(var n in t||(t={}))qE.call(t,n)&&Uk(e,n,t[n]);if(Qm)for(var n of Qm(t))XE.call(t,n)&&Uk(e,n,t[n]);return e},JZ=(e,t)=>YZ(e,ZZ(t)),eJ=(e,t)=>{var n={};for(var r in e)qE.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Qm)for(var r of Qm(e))t.indexOf(r)<0&&XE.call(e,r)&&(n[r]=e[r]);return n};const tJ={type:"text",size:"sm",__staticSelector:"TextInput"},QE=d.forwardRef((e,t)=>{const n=gE("TextInput",tJ,e),{inputProps:r,wrapperProps:o}=n,s=eJ(n,["inputProps","wrapperProps"]);return H.createElement(_c.Wrapper,Mv({},o),H.createElement(_c,JZ(Mv(Mv({},r),s),{ref:t})))});QE.displayName="@mantine/core/TextInput";function nJ({data:e,searchable:t,limit:n,searchValue:r,filter:o,value:s,filterDataOnExactSearchMatch:i}){if(!t)return e;const l=s!=null&&e.find(p=>p.value===s)||null;if(l&&!i&&(l==null?void 0:l.label)===r){if(n){if(n>=e.length)return e;const p=e.indexOf(l),m=p+n,h=m-e.length;return h>0?e.slice(p-h):e.slice(p,m)}return e}const u=[];for(let p=0;p=n));p+=1);return u}var rJ=fr(()=>({input:{"&:not(:disabled)":{cursor:"pointer","&::selection":{backgroundColor:"transparent"}}}}));const oJ=rJ;var sJ=Object.defineProperty,aJ=Object.defineProperties,iJ=Object.getOwnPropertyDescriptors,Ym=Object.getOwnPropertySymbols,YE=Object.prototype.hasOwnProperty,ZE=Object.prototype.propertyIsEnumerable,Gk=(e,t,n)=>t in e?sJ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ju=(e,t)=>{for(var n in t||(t={}))YE.call(t,n)&&Gk(e,n,t[n]);if(Ym)for(var n of Ym(t))ZE.call(t,n)&&Gk(e,n,t[n]);return e},Ov=(e,t)=>aJ(e,iJ(t)),lJ=(e,t)=>{var n={};for(var r in e)YE.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Ym)for(var r of Ym(e))t.indexOf(r)<0&&ZE.call(e,r)&&(n[r]=e[r]);return n};function cJ(e,t){return t.label.toLowerCase().trim().includes(e.toLowerCase().trim())}function uJ(e,t){return!!e&&!t.some(n=>n.label.toLowerCase()===e.toLowerCase())}const dJ={required:!1,size:"sm",shadow:"sm",itemComponent:ny,transitionProps:{transition:"fade",duration:0},initiallyOpened:!1,filter:cJ,maxDropdownHeight:220,searchable:!1,clearable:!1,limit:1/0,disabled:!1,creatable:!1,shouldCreate:uJ,selectOnBlur:!1,switchDirectionOnFlip:!1,filterDataOnExactSearchMatch:!1,zIndex:Zb("popover"),positionDependencies:[],dropdownPosition:"flip"},fy=d.forwardRef((e,t)=>{const n=gE("Select",dJ,e),{inputProps:r,wrapperProps:o,shadow:s,data:i,value:l,defaultValue:u,onChange:p,itemComponent:m,onKeyDown:h,onBlur:g,onFocus:x,transitionProps:y,initiallyOpened:b,unstyled:w,classNames:S,styles:j,filter:_,maxDropdownHeight:E,searchable:I,clearable:M,nothingFound:R,limit:D,disabled:A,onSearchChange:O,searchValue:T,rightSection:X,rightSectionWidth:B,creatable:V,getCreateLabel:U,shouldCreate:N,selectOnBlur:$,onCreate:q,dropdownComponent:F,onDropdownClose:Q,onDropdownOpen:Y,withinPortal:se,portalProps:ae,switchDirectionOnFlip:re,zIndex:G,name:K,dropdownPosition:ee,allowDeselect:ce,placeholder:J,filterDataOnExactSearchMatch:ie,form:de,positionDependencies:ge,readOnly:Ce,clearButtonProps:he,hoverOnSearchChange:fe}=n,Oe=lJ(n,["inputProps","wrapperProps","shadow","data","value","defaultValue","onChange","itemComponent","onKeyDown","onBlur","onFocus","transitionProps","initiallyOpened","unstyled","classNames","styles","filter","maxDropdownHeight","searchable","clearable","nothingFound","limit","disabled","onSearchChange","searchValue","rightSection","rightSectionWidth","creatable","getCreateLabel","shouldCreate","selectOnBlur","onCreate","dropdownComponent","onDropdownClose","onDropdownOpen","withinPortal","portalProps","switchDirectionOnFlip","zIndex","name","dropdownPosition","allowDeselect","placeholder","filterDataOnExactSearchMatch","form","positionDependencies","readOnly","clearButtonProps","hoverOnSearchChange"]),{classes:_e,cx:Ne,theme:nt}=oJ(),[$e,Pt]=d.useState(b),[Ze,ot]=d.useState(-1),ye=d.useRef(),De=d.useRef({}),[ut,bt]=d.useState("column"),be=ut==="column",{scrollIntoView:Je,targetRef:lt,scrollableRef:ft}=BP({duration:0,offset:5,cancelable:!1,isList:!0}),Me=ce===void 0?M:ce,Le=Qe=>{if($e!==Qe){Pt(Qe);const Gt=Qe?Y:Q;typeof Gt=="function"&&Gt()}},Ut=V&&typeof U=="function";let ke=null;const Be=i.map(Qe=>typeof Qe=="string"?{label:Qe,value:Qe}:Qe),ze=MP({data:Be}),[Ge,pt,Pn]=od({value:l,defaultValue:u,finalValue:null,onChange:p}),Dt=ze.find(Qe=>Qe.value===Ge),[At,pr]=od({value:T,defaultValue:(Dt==null?void 0:Dt.label)||"",finalValue:void 0,onChange:O}),Ln=Qe=>{pr(Qe),I&&typeof O=="function"&&O(Qe)},kn=()=>{var Qe;Ce||(pt(null),Pn||Ln(""),(Qe=ye.current)==null||Qe.focus())};d.useEffect(()=>{const Qe=ze.find(Gt=>Gt.value===Ge);Qe?Ln(Qe.label):(!Ut||!Ge)&&Ln("")},[Ge]),d.useEffect(()=>{Dt&&(!I||!$e)&&Ln(Dt.label)},[Dt==null?void 0:Dt.label]);const gn=Qe=>{if(!Ce)if(Me&&(Dt==null?void 0:Dt.value)===Qe.value)pt(null),Le(!1);else{if(Qe.creatable&&typeof q=="function"){const Gt=q(Qe.value);typeof Gt<"u"&&Gt!==null&&pt(typeof Gt=="string"?Gt:Gt.value)}else pt(Qe.value);Pn||Ln(Qe.label),ot(-1),Le(!1),ye.current.focus()}},an=nJ({data:ze,searchable:I,limit:D,searchValue:At,filter:_,filterDataOnExactSearchMatch:ie,value:Ge});Ut&&N(At,an)&&(ke=U(At),an.push({label:At,value:At,creatable:!0}));const kr=(Qe,Gt,zn)=>{let St=Qe;for(;zn(St);)if(St=Gt(St),!an[St].disabled)return St;return Qe};Uo(()=>{ot(fe&&At?0:-1)},[At,fe]);const Mo=Ge?an.findIndex(Qe=>Qe.value===Ge):0,mr=!Ce&&(an.length>0?$e:$e&&!!R),hr=()=>{ot(Qe=>{var Gt;const zn=kr(Qe,St=>St-1,St=>St>0);return lt.current=De.current[(Gt=an[zn])==null?void 0:Gt.value],mr&&Je({alignment:be?"start":"end"}),zn})},Ns=()=>{ot(Qe=>{var Gt;const zn=kr(Qe,St=>St+1,St=>Stwindow.setTimeout(()=>{var Qe;lt.current=De.current[(Qe=an[Mo])==null?void 0:Qe.value],Je({alignment:be?"end":"start"})},50);Uo(()=>{mr&&$s()},[mr]);const wa=Qe=>{switch(typeof h=="function"&&h(Qe),Qe.key){case"ArrowUp":{Qe.preventDefault(),$e?be?hr():Ns():(ot(Mo),Le(!0),$s());break}case"ArrowDown":{Qe.preventDefault(),$e?be?Ns():hr():(ot(Mo),Le(!0),$s());break}case"Home":{if(!I){Qe.preventDefault(),$e||Le(!0);const Gt=an.findIndex(zn=>!zn.disabled);ot(Gt),mr&&Je({alignment:be?"end":"start"})}break}case"End":{if(!I){Qe.preventDefault(),$e||Le(!0);const Gt=an.map(zn=>!!zn.disabled).lastIndexOf(!1);ot(Gt),mr&&Je({alignment:be?"end":"start"})}break}case"Escape":{Qe.preventDefault(),Le(!1),ot(-1);break}case" ":{I||(Qe.preventDefault(),an[Ze]&&$e?gn(an[Ze]):(Le(!0),ot(Mo),$s()));break}case"Enter":I||Qe.preventDefault(),an[Ze]&&$e&&(Qe.preventDefault(),gn(an[Ze]))}},Sa=Qe=>{typeof g=="function"&&g(Qe);const Gt=ze.find(zn=>zn.value===Ge);$&&an[Ze]&&$e&&gn(an[Ze]),Ln((Gt==null?void 0:Gt.label)||""),Le(!1)},ml=Qe=>{typeof x=="function"&&x(Qe),I&&Le(!0)},ka=Qe=>{Ce||(Ln(Qe.currentTarget.value),M&&Qe.currentTarget.value===""&&pt(null),ot(-1),Le(!0))},hl=()=>{Ce||(Le(!$e),Ge&&!$e&&ot(Mo))};return H.createElement(_c.Wrapper,Ov(ju({},o),{__staticSelector:"Select"}),H.createElement(Ka,{opened:mr,transitionProps:y,shadow:s,withinPortal:se,portalProps:ae,__staticSelector:"Select",onDirectionChange:bt,switchDirectionOnFlip:re,zIndex:G,dropdownPosition:ee,positionDependencies:[...ge,At],classNames:S,styles:j,unstyled:w,variant:r.variant},H.createElement(Ka.Target,null,H.createElement("div",{role:"combobox","aria-haspopup":"listbox","aria-owns":mr?`${r.id}-items`:null,"aria-controls":r.id,"aria-expanded":mr,onMouseLeave:()=>ot(-1),tabIndex:-1},H.createElement("input",{type:"hidden",name:K,value:Ge||"",form:de,disabled:A}),H.createElement(_c,ju(Ov(ju(ju({autoComplete:"off",type:"search"},r),Oe),{ref:Bd(t,ye),onKeyDown:wa,__staticSelector:"Select",value:At,placeholder:J,onChange:ka,"aria-autocomplete":"list","aria-controls":mr?`${r.id}-items`:null,"aria-activedescendant":Ze>=0?`${r.id}-${Ze}`:null,onMouseDown:hl,onBlur:Sa,onFocus:ml,readOnly:!I||Ce,disabled:A,"data-mantine-stop-propagation":mr,name:null,classNames:Ov(ju({},S),{input:Ne({[_e.input]:!I},S==null?void 0:S.input)})}),WE({theme:nt,rightSection:X,rightSectionWidth:B,styles:j,size:r.size,shouldClear:M&&!!Dt,onClear:kn,error:o.error,clearButtonProps:he,disabled:A,readOnly:Ce}))))),H.createElement(Ka.Dropdown,{component:F||og,maxHeight:E,direction:ut,id:r.id,innerRef:ft,__staticSelector:"Select",classNames:S,styles:j},H.createElement(ty,{data:an,hovered:Ze,classNames:S,styles:j,isItemSelected:Qe=>Qe===Ge,uuid:r.id,__staticSelector:"Select",onItemHover:ot,onItemSelect:gn,itemsRefs:De,itemComponent:m,size:r.size,nothingFound:R,creatable:Ut&&!!ke,createLabel:ke,"aria-label":o.label,unstyled:w,variant:r.variant}))))});fy.displayName="@mantine/core/Select";const Wd=()=>{const[e,t,n,r,o,s,i,l,u,p,m,h,g,x,y,b,w,S,j,_,E,I,M,R,D,A,O,T,X,B,V,U,N,$,q,F,Q,Y,se,ae,re,G,K,ee,ce,J,ie,de,ge,Ce,he,fe,Oe,_e,Ne,nt,$e,Pt,Ze,ot,ye,De,ut,bt,be,Je,lt,ft,Me,Le,Ut,ke,Be,ze,Ge,pt]=Ho("colors",["base.50","base.100","base.150","base.200","base.250","base.300","base.350","base.400","base.450","base.500","base.550","base.600","base.650","base.700","base.750","base.800","base.850","base.900","base.950","accent.50","accent.100","accent.150","accent.200","accent.250","accent.300","accent.350","accent.400","accent.450","accent.500","accent.550","accent.600","accent.650","accent.700","accent.750","accent.800","accent.850","accent.900","accent.950","baseAlpha.50","baseAlpha.100","baseAlpha.150","baseAlpha.200","baseAlpha.250","baseAlpha.300","baseAlpha.350","baseAlpha.400","baseAlpha.450","baseAlpha.500","baseAlpha.550","baseAlpha.600","baseAlpha.650","baseAlpha.700","baseAlpha.750","baseAlpha.800","baseAlpha.850","baseAlpha.900","baseAlpha.950","accentAlpha.50","accentAlpha.100","accentAlpha.150","accentAlpha.200","accentAlpha.250","accentAlpha.300","accentAlpha.350","accentAlpha.400","accentAlpha.450","accentAlpha.500","accentAlpha.550","accentAlpha.600","accentAlpha.650","accentAlpha.700","accentAlpha.750","accentAlpha.800","accentAlpha.850","accentAlpha.900","accentAlpha.950"]);return{base50:e,base100:t,base150:n,base200:r,base250:o,base300:s,base350:i,base400:l,base450:u,base500:p,base550:m,base600:h,base650:g,base700:x,base750:y,base800:b,base850:w,base900:S,base950:j,accent50:_,accent100:E,accent150:I,accent200:M,accent250:R,accent300:D,accent350:A,accent400:O,accent450:T,accent500:X,accent550:B,accent600:V,accent650:U,accent700:N,accent750:$,accent800:q,accent850:F,accent900:Q,accent950:Y,baseAlpha50:se,baseAlpha100:ae,baseAlpha150:re,baseAlpha200:G,baseAlpha250:K,baseAlpha300:ee,baseAlpha350:ce,baseAlpha400:J,baseAlpha450:ie,baseAlpha500:de,baseAlpha550:ge,baseAlpha600:Ce,baseAlpha650:he,baseAlpha700:fe,baseAlpha750:Oe,baseAlpha800:_e,baseAlpha850:Ne,baseAlpha900:nt,baseAlpha950:$e,accentAlpha50:Pt,accentAlpha100:Ze,accentAlpha150:ot,accentAlpha200:ye,accentAlpha250:De,accentAlpha300:ut,accentAlpha350:bt,accentAlpha400:be,accentAlpha450:Je,accentAlpha500:lt,accentAlpha550:ft,accentAlpha600:Me,accentAlpha650:Le,accentAlpha700:Ut,accentAlpha750:ke,accentAlpha800:Be,accentAlpha850:ze,accentAlpha900:Ge,accentAlpha950:pt}},Ae=(e,t)=>n=>n==="light"?e:t,JE=()=>{const{base50:e,base100:t,base200:n,base300:r,base400:o,base500:s,base600:i,base700:l,base800:u,base900:p,accent200:m,accent300:h,accent400:g,accent500:x,accent600:y}=Wd(),{colorMode:b}=ha(),[w]=Ho("shadows",["dark-lg"]),[S,j,_]=Ho("space",[1,2,6]),[E]=Ho("radii",["base"]),[I]=Ho("lineHeights",["base"]);return d.useCallback(()=>({label:{color:Ae(l,r)(b)},separatorLabel:{color:Ae(s,s)(b),"::after":{borderTopColor:Ae(r,l)(b)}},input:{border:"unset",backgroundColor:Ae(e,p)(b),borderRadius:E,borderStyle:"solid",borderWidth:"2px",borderColor:Ae(n,u)(b),color:Ae(p,t)(b),minHeight:"unset",lineHeight:I,height:"auto",paddingRight:0,paddingLeft:0,paddingInlineStart:j,paddingInlineEnd:_,paddingTop:S,paddingBottom:S,fontWeight:600,"&:hover":{borderColor:Ae(r,i)(b)},"&:focus":{borderColor:Ae(h,y)(b)},"&:is(:focus, :hover)":{borderColor:Ae(o,s)(b)},"&:focus-within":{borderColor:Ae(m,y)(b)},"&[data-disabled]":{backgroundColor:Ae(r,l)(b),color:Ae(i,o)(b),cursor:"not-allowed"}},value:{backgroundColor:Ae(t,p)(b),color:Ae(p,t)(b),button:{color:Ae(p,t)(b)},"&:hover":{backgroundColor:Ae(r,l)(b),cursor:"pointer"}},dropdown:{backgroundColor:Ae(n,u)(b),borderColor:Ae(n,u)(b),boxShadow:w},item:{backgroundColor:Ae(n,u)(b),color:Ae(u,n)(b),padding:6,"&[data-hovered]":{color:Ae(p,t)(b),backgroundColor:Ae(r,l)(b)},"&[data-active]":{backgroundColor:Ae(r,l)(b),"&:hover":{color:Ae(p,t)(b),backgroundColor:Ae(r,l)(b)}},"&[data-selected]":{backgroundColor:Ae(g,y)(b),color:Ae(e,t)(b),fontWeight:600,"&:hover":{backgroundColor:Ae(x,x)(b),color:Ae("white",e)(b)}},"&[data-disabled]":{color:Ae(s,i)(b),cursor:"not-allowed"}},rightSection:{width:32,button:{color:Ae(p,t)(b)}}}),[m,h,g,x,y,t,n,r,o,e,s,i,l,u,p,w,b,I,E,S,j,_])},eM=je((e,t)=>{const{searchable:n=!0,tooltip:r,inputRef:o,onChange:s,label:i,disabled:l,...u}=e,p=te(),[m,h]=d.useState(""),g=d.useCallback(w=>{w.shiftKey&&p(Nr(!0))},[p]),x=d.useCallback(w=>{w.shiftKey||p(Nr(!1))},[p]),y=d.useCallback(w=>{s&&s(w)},[s]),b=JE();return a.jsx(Ht,{label:r,placement:"top",hasArrow:!0,children:a.jsxs(Kt,{ref:t,isDisabled:l,position:"static","data-testid":`select-${i||e.placeholder}`,children:[i&&a.jsx(wn,{children:i}),a.jsx(fy,{ref:o,disabled:l,searchValue:m,onSearchChange:h,onChange:y,onKeyDown:g,onKeyUp:x,searchable:n,maxDropdownHeight:300,styles:b,...u})]})})});eM.displayName="IAIMantineSearchableSelect";const nn=d.memo(eM),fJ=le([xe],({changeBoardModal:e})=>{const{isModalOpen:t,imagesToChange:n}=e;return{isModalOpen:t,imagesToChange:n}},Se),pJ=()=>{const e=te(),[t,n]=d.useState(),{data:r,isFetching:o}=yd(),{imagesToChange:s,isModalOpen:i}=W(fJ),[l]=JR(),[u]=eD(),{t:p}=Z(),m=d.useMemo(()=>{const y=[{label:p("boards.uncategorized"),value:"none"}];return(r??[]).forEach(b=>y.push({label:b.board_name,value:b.board_id})),y},[r,p]),h=d.useCallback(()=>{e(ew()),e(Bx(!1))},[e]),g=d.useCallback(()=>{!s.length||!t||(t==="none"?u({imageDTOs:s}):l({imageDTOs:s,board_id:t}),n(null),e(ew()))},[l,e,s,u,t]),x=d.useRef(null);return a.jsx(Td,{isOpen:i,onClose:h,leastDestructiveRef:x,isCentered:!0,children:a.jsx(Yo,{children:a.jsxs(Nd,{children:[a.jsx(Qo,{fontSize:"lg",fontWeight:"bold",children:p("boards.changeBoard")}),a.jsx(Zo,{children:a.jsxs(L,{sx:{flexDir:"column",gap:4},children:[a.jsxs(ve,{children:["Moving ",`${s.length}`," image",`${s.length>1?"s":""}`," to board:"]}),a.jsx(nn,{placeholder:p(o?"boards.loading":"boards.selectBoard"),disabled:o,onChange:y=>n(y),value:t,data:m})]})}),a.jsxs(Ss,{children:[a.jsx(at,{ref:x,onClick:h,children:p("boards.cancel")}),a.jsx(at,{colorScheme:"accent",onClick:g,ml:3,children:p("boards.move")})]})]})})})},mJ=d.memo(pJ),tM=e=>{const{label:t,isDisabled:n=!1,width:r="auto",formControlProps:o,formLabelProps:s,tooltip:i,helperText:l,...u}=e;return a.jsx(Ht,{label:i,hasArrow:!0,placement:"top",isDisabled:!i,children:a.jsx(Kt,{isDisabled:n,width:r,alignItems:"center",...o,children:a.jsxs(L,{sx:{flexDir:"column",w:"full"},children:[a.jsxs(L,{sx:{alignItems:"center",w:"full"},children:[t&&a.jsx(wn,{my:1,flexGrow:1,sx:{cursor:n?"not-allowed":"pointer",...s==null?void 0:s.sx,pe:4},...s,children:t}),a.jsx(qb,{...u})]}),l&&a.jsx(u5,{children:a.jsx(ve,{variant:"subtext",children:l})})]})})})};tM.displayName="IAISwitch";const dn=d.memo(tM),hJ=e=>{const{t}=Z(),{imageUsage:n,topMessage:r=t("gallery.currentlyInUse"),bottomMessage:o=t("gallery.featuresWillReset")}=e;return!n||!Xr(n)?null:a.jsxs(a.Fragment,{children:[a.jsx(ve,{children:r}),a.jsxs(Od,{sx:{paddingInlineStart:6},children:[n.isInitialImage&&a.jsx(Qr,{children:t("common.img2img")}),n.isCanvasImage&&a.jsx(Qr,{children:t("common.unifiedCanvas")}),n.isControlNetImage&&a.jsx(Qr,{children:t("common.controlNet")}),n.isIPAdapterImage&&a.jsx(Qr,{children:t("common.ipAdapter")}),n.isNodesImage&&a.jsx(Qr,{children:t("common.nodeEditor")})]}),a.jsx(ve,{children:o})]})},nM=d.memo(hJ),gJ=le([xe,tD],(e,t)=>{const{system:n,config:r,deleteImageModal:o}=e,{shouldConfirmOnDelete:s}=n,{canRestoreDeletedImagesFromBin:i}=r,{imagesToDelete:l,isModalOpen:u}=o,p=(l??[]).map(({image_name:h})=>rI(e,h)),m={isInitialImage:Xr(p,h=>h.isInitialImage),isCanvasImage:Xr(p,h=>h.isCanvasImage),isNodesImage:Xr(p,h=>h.isNodesImage),isControlNetImage:Xr(p,h=>h.isControlNetImage),isIPAdapterImage:Xr(p,h=>h.isIPAdapterImage)};return{shouldConfirmOnDelete:s,canRestoreDeletedImagesFromBin:i,imagesToDelete:l,imagesUsage:t,isModalOpen:u,imageUsageSummary:m}},Se),vJ=()=>{const e=te(),{t}=Z(),{shouldConfirmOnDelete:n,canRestoreDeletedImagesFromBin:r,imagesToDelete:o,imagesUsage:s,isModalOpen:i,imageUsageSummary:l}=W(gJ),u=d.useCallback(g=>e(oI(!g.target.checked)),[e]),p=d.useCallback(()=>{e(tw()),e(nD(!1))},[e]),m=d.useCallback(()=>{!o.length||!s.length||(e(tw()),e(rD({imageDTOs:o,imagesUsage:s})))},[e,o,s]),h=d.useRef(null);return a.jsx(Td,{isOpen:i,onClose:p,leastDestructiveRef:h,isCentered:!0,children:a.jsx(Yo,{children:a.jsxs(Nd,{children:[a.jsx(Qo,{fontSize:"lg",fontWeight:"bold",children:t("gallery.deleteImage")}),a.jsx(Zo,{children:a.jsxs(L,{direction:"column",gap:3,children:[a.jsx(nM,{imageUsage:l}),a.jsx(Yn,{}),a.jsx(ve,{children:t(r?"gallery.deleteImageBin":"gallery.deleteImagePermanent")}),a.jsx(ve,{children:t("common.areYouSure")}),a.jsx(dn,{label:t("common.dontAskMeAgain"),isChecked:!n,onChange:u})]})}),a.jsxs(Ss,{children:[a.jsx(at,{ref:h,onClick:p,children:"Cancel"}),a.jsx(at,{colorScheme:"error",onClick:m,ml:3,children:"Delete"})]})]})})})},xJ=d.memo(vJ),rM=je((e,t)=>{const{role:n,tooltip:r="",tooltipProps:o,isChecked:s,...i}=e;return a.jsx(Ht,{label:r,hasArrow:!0,...o,...o!=null&&o.placement?{placement:o.placement}:{placement:"top"},children:a.jsx(ys,{ref:t,role:n,colorScheme:s?"accent":"base","data-testid":r,...i})})});rM.displayName="IAIIconButton";const Fe=d.memo(rM);var oM={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},Kk=H.createContext&&H.createContext(oM),qa=globalThis&&globalThis.__assign||function(){return qa=Object.assign||function(e){for(var t,n=1,r=arguments.length;n{const t=W(i=>i.config.disabledTabs),n=W(i=>i.config.disabledFeatures),r=W(i=>i.config.disabledSDFeatures),o=d.useMemo(()=>n.includes(e)||r.includes(e)||t.includes(e),[n,r,t,e]),s=d.useMemo(()=>!(n.includes(e)||r.includes(e)||t.includes(e)),[n,r,t,e]);return{isFeatureDisabled:o,isFeatureEnabled:s}};function aee(e){const{title:t,hotkey:n,description:r}=e;return a.jsxs(Ja,{sx:{gridTemplateColumns:"auto max-content",justifyContent:"space-between",alignItems:"center"},children:[a.jsxs(Ja,{children:[a.jsx(ve,{fontWeight:600,children:t}),r&&a.jsx(ve,{sx:{fontSize:"sm"},variant:"subtext",children:r})]}),a.jsx(Ie,{sx:{fontSize:"sm",fontWeight:600,px:2,py:1},children:n})]})}function iee({children:e}){const{isOpen:t,onOpen:n,onClose:r}=Lr(),{t:o}=Z(),s=[{title:o("hotkeys.invoke.title"),desc:o("hotkeys.invoke.desc"),hotkey:"Ctrl+Enter"},{title:o("hotkeys.cancel.title"),desc:o("hotkeys.cancel.desc"),hotkey:"Shift+X"},{title:o("hotkeys.focusPrompt.title"),desc:o("hotkeys.focusPrompt.desc"),hotkey:"Alt+A"},{title:o("hotkeys.toggleOptions.title"),desc:o("hotkeys.toggleOptions.desc"),hotkey:"O"},{title:o("hotkeys.toggleGallery.title"),desc:o("hotkeys.toggleGallery.desc"),hotkey:"G"},{title:o("hotkeys.maximizeWorkSpace.title"),desc:o("hotkeys.maximizeWorkSpace.desc"),hotkey:"F"},{title:o("hotkeys.changeTabs.title"),desc:o("hotkeys.changeTabs.desc"),hotkey:"1-5"}],i=[{title:o("hotkeys.setPrompt.title"),desc:o("hotkeys.setPrompt.desc"),hotkey:"P"},{title:o("hotkeys.setSeed.title"),desc:o("hotkeys.setSeed.desc"),hotkey:"S"},{title:o("hotkeys.setParameters.title"),desc:o("hotkeys.setParameters.desc"),hotkey:"A"},{title:o("hotkeys.upscale.title"),desc:o("hotkeys.upscale.desc"),hotkey:"Shift+U"},{title:o("hotkeys.showInfo.title"),desc:o("hotkeys.showInfo.desc"),hotkey:"I"},{title:o("hotkeys.sendToImageToImage.title"),desc:o("hotkeys.sendToImageToImage.desc"),hotkey:"Shift+I"},{title:o("hotkeys.deleteImage.title"),desc:o("hotkeys.deleteImage.desc"),hotkey:"Del"},{title:o("hotkeys.closePanels.title"),desc:o("hotkeys.closePanels.desc"),hotkey:"Esc"}],l=[{title:o("hotkeys.previousImage.title"),desc:o("hotkeys.previousImage.desc"),hotkey:"Arrow Left"},{title:o("hotkeys.nextImage.title"),desc:o("hotkeys.nextImage.desc"),hotkey:"Arrow Right"},{title:o("hotkeys.increaseGalleryThumbSize.title"),desc:o("hotkeys.increaseGalleryThumbSize.desc"),hotkey:"Shift+Up"},{title:o("hotkeys.decreaseGalleryThumbSize.title"),desc:o("hotkeys.decreaseGalleryThumbSize.desc"),hotkey:"Shift+Down"}],u=[{title:o("hotkeys.selectBrush.title"),desc:o("hotkeys.selectBrush.desc"),hotkey:"B"},{title:o("hotkeys.selectEraser.title"),desc:o("hotkeys.selectEraser.desc"),hotkey:"E"},{title:o("hotkeys.decreaseBrushSize.title"),desc:o("hotkeys.decreaseBrushSize.desc"),hotkey:"["},{title:o("hotkeys.increaseBrushSize.title"),desc:o("hotkeys.increaseBrushSize.desc"),hotkey:"]"},{title:o("hotkeys.decreaseBrushOpacity.title"),desc:o("hotkeys.decreaseBrushOpacity.desc"),hotkey:"Shift + ["},{title:o("hotkeys.increaseBrushOpacity.title"),desc:o("hotkeys.increaseBrushOpacity.desc"),hotkey:"Shift + ]"},{title:o("hotkeys.moveTool.title"),desc:o("hotkeys.moveTool.desc"),hotkey:"V"},{title:o("hotkeys.fillBoundingBox.title"),desc:o("hotkeys.fillBoundingBox.desc"),hotkey:"Shift + F"},{title:o("hotkeys.eraseBoundingBox.title"),desc:o("hotkeys.eraseBoundingBox.desc"),hotkey:"Delete / Backspace"},{title:o("hotkeys.colorPicker.title"),desc:o("hotkeys.colorPicker.desc"),hotkey:"C"},{title:o("hotkeys.toggleSnap.title"),desc:o("hotkeys.toggleSnap.desc"),hotkey:"N"},{title:o("hotkeys.quickToggleMove.title"),desc:o("hotkeys.quickToggleMove.desc"),hotkey:"Hold Space"},{title:o("hotkeys.toggleLayer.title"),desc:o("hotkeys.toggleLayer.desc"),hotkey:"Q"},{title:o("hotkeys.clearMask.title"),desc:o("hotkeys.clearMask.desc"),hotkey:"Shift+C"},{title:o("hotkeys.hideMask.title"),desc:o("hotkeys.hideMask.desc"),hotkey:"H"},{title:o("hotkeys.showHideBoundingBox.title"),desc:o("hotkeys.showHideBoundingBox.desc"),hotkey:"Shift+H"},{title:o("hotkeys.mergeVisible.title"),desc:o("hotkeys.mergeVisible.desc"),hotkey:"Shift+M"},{title:o("hotkeys.saveToGallery.title"),desc:o("hotkeys.saveToGallery.desc"),hotkey:"Shift+S"},{title:o("hotkeys.copyToClipboard.title"),desc:o("hotkeys.copyToClipboard.desc"),hotkey:"Ctrl+C"},{title:o("hotkeys.downloadImage.title"),desc:o("hotkeys.downloadImage.desc"),hotkey:"Shift+D"},{title:o("hotkeys.undoStroke.title"),desc:o("hotkeys.undoStroke.desc"),hotkey:"Ctrl+Z"},{title:o("hotkeys.redoStroke.title"),desc:o("hotkeys.redoStroke.desc"),hotkey:"Ctrl+Shift+Z, Ctrl+Y"},{title:o("hotkeys.resetView.title"),desc:o("hotkeys.resetView.desc"),hotkey:"R"},{title:o("hotkeys.previousStagingImage.title"),desc:o("hotkeys.previousStagingImage.desc"),hotkey:"Arrow Left"},{title:o("hotkeys.nextStagingImage.title"),desc:o("hotkeys.nextStagingImage.desc"),hotkey:"Arrow Right"},{title:o("hotkeys.acceptStagingImage.title"),desc:o("hotkeys.acceptStagingImage.desc"),hotkey:"Enter"}],p=[{title:o("hotkeys.addNodes.title"),desc:o("hotkeys.addNodes.desc"),hotkey:"Shift + A / Space"}],m=h=>a.jsx(L,{flexDir:"column",gap:4,children:h.map((g,x)=>a.jsxs(L,{flexDir:"column",px:2,gap:4,children:[a.jsx(aee,{title:g.title,description:g.desc,hotkey:g.hotkey}),x{const{data:t}=oD(),n=d.useRef(null),r=CM(n);return a.jsxs(L,{alignItems:"center",gap:5,ps:1,ref:n,children:[a.jsx(ga,{src:Hx,alt:"invoke-ai-logo",sx:{w:"32px",h:"32px",minW:"32px",minH:"32px",userSelect:"none"}}),a.jsxs(L,{sx:{gap:3,alignItems:"center"},children:[a.jsxs(ve,{sx:{fontSize:"xl",userSelect:"none"},children:["invoke ",a.jsx("strong",{children:"ai"})]}),a.jsx(dr,{children:e&&r&&t&&a.jsx(In.div,{initial:{opacity:0},animate:{opacity:1,transition:{duration:.15}},exit:{opacity:0,transition:{delay:.8}},children:a.jsx(ve,{sx:{fontWeight:600,marginTop:1,color:"base.300",fontSize:14},variant:"subtext",children:t.version})},"statusText")})]})]})},hee=d.memo(mee),wM=je((e,t)=>{const{tooltip:n,inputRef:r,label:o,disabled:s,required:i,...l}=e,u=JE();return a.jsx(Ht,{label:n,placement:"top",hasArrow:!0,children:a.jsxs(Kt,{ref:t,isRequired:i,isDisabled:s,position:"static","data-testid":`select-${o||e.placeholder}`,children:[a.jsx(wn,{children:o}),a.jsx(fy,{disabled:s,ref:r,styles:u,...l})]})})});wM.displayName="IAIMantineSelect";const On=d.memo(wM),gee={ar:yt.t("common.langArabic",{lng:"ar"}),nl:yt.t("common.langDutch",{lng:"nl"}),en:yt.t("common.langEnglish",{lng:"en"}),fr:yt.t("common.langFrench",{lng:"fr"}),de:yt.t("common.langGerman",{lng:"de"}),he:yt.t("common.langHebrew",{lng:"he"}),it:yt.t("common.langItalian",{lng:"it"}),ja:yt.t("common.langJapanese",{lng:"ja"}),ko:yt.t("common.langKorean",{lng:"ko"}),pl:yt.t("common.langPolish",{lng:"pl"}),pt_BR:yt.t("common.langBrPortuguese",{lng:"pt_BR"}),pt:yt.t("common.langPortuguese",{lng:"pt"}),ru:yt.t("common.langRussian",{lng:"ru"}),zh_CN:yt.t("common.langSimplifiedChinese",{lng:"zh_CN"}),es:yt.t("common.langSpanish",{lng:"es"}),uk:yt.t("common.langUkranian",{lng:"ua"})},vee={CONNECTED:"common.statusConnected",DISCONNECTED:"common.statusDisconnected",PROCESSING:"common.statusProcessing",ERROR:"common.statusError",LOADING_MODEL:"common.statusLoadingModel"},SM=le(xe,({system:e})=>e.language,Se);function Lo(e){const{t}=Z(),{label:n,textProps:r,useBadge:o=!1,badgeLabel:s=t("settings.experimental"),badgeProps:i,...l}=e;return a.jsxs(L,{justifyContent:"space-between",py:1,children:[a.jsxs(L,{gap:2,alignItems:"center",children:[a.jsx(ve,{sx:{fontSize:14,_dark:{color:"base.300"}},...r,children:n}),o&&a.jsx(Ds,{size:"xs",sx:{px:2,color:"base.700",bg:"accent.200",_dark:{bg:"accent.500",color:"base.200"}},...i,children:s})]}),a.jsx(dn,{...l})]})}const xee=e=>a.jsx(L,{sx:{flexDirection:"column",gap:2,p:4,borderRadius:"base",bg:"base.100",_dark:{bg:"base.900"}},children:e.children}),Gl=d.memo(xee);function bee(){const e=te(),{data:t,refetch:n}=sD(),[r,{isLoading:o}]=aD(),s=d.useCallback(()=>{r().unwrap().then(l=>{e(sI()),e(aI()),e(ct({title:`Cleared ${l} intermediates`,status:"info"}))})},[r,e]);d.useEffect(()=>{n()},[n]);const i=t?`Clear ${t} Intermediate${t>1?"s":""}`:"No Intermediates to Clear";return a.jsxs(Gl,{children:[a.jsx(cr,{size:"sm",children:"Clear Intermediates"}),a.jsx(at,{colorScheme:"warning",onClick:s,isLoading:o,isDisabled:!t,children:i}),a.jsx(ve,{fontWeight:"bold",children:"Clearing intermediates will reset your Canvas and ControlNet state."}),a.jsx(ve,{variant:"subtext",children:"Intermediate images are byproducts of generation, different from the result images in the gallery. Clearing intermediates will free disk space."}),a.jsx(ve,{variant:"subtext",children:"Your gallery images will not be deleted."})]})}const yee=()=>{const{base50:e,base100:t,base200:n,base300:r,base400:o,base500:s,base600:i,base700:l,base800:u,base900:p,accent200:m,accent300:h,accent400:g,accent500:x,accent600:y}=Wd(),{colorMode:b}=ha(),[w]=Ho("shadows",["dark-lg"]);return d.useCallback(()=>({label:{color:Ae(l,r)(b)},separatorLabel:{color:Ae(s,s)(b),"::after":{borderTopColor:Ae(r,l)(b)}},searchInput:{":placeholder":{color:Ae(r,l)(b)}},input:{backgroundColor:Ae(e,p)(b),borderWidth:"2px",borderColor:Ae(n,u)(b),color:Ae(p,t)(b),paddingRight:24,fontWeight:600,"&:hover":{borderColor:Ae(r,i)(b)},"&:focus":{borderColor:Ae(h,y)(b)},"&:is(:focus, :hover)":{borderColor:Ae(o,s)(b)},"&:focus-within":{borderColor:Ae(m,y)(b)},"&[data-disabled]":{backgroundColor:Ae(r,l)(b),color:Ae(i,o)(b),cursor:"not-allowed"}},value:{backgroundColor:Ae(n,u)(b),color:Ae(p,t)(b),button:{color:Ae(p,t)(b)},"&:hover":{backgroundColor:Ae(r,l)(b),cursor:"pointer"}},dropdown:{backgroundColor:Ae(n,u)(b),borderColor:Ae(n,u)(b),boxShadow:w},item:{backgroundColor:Ae(n,u)(b),color:Ae(u,n)(b),padding:6,"&[data-hovered]":{color:Ae(p,t)(b),backgroundColor:Ae(r,l)(b)},"&[data-active]":{backgroundColor:Ae(r,l)(b),"&:hover":{color:Ae(p,t)(b),backgroundColor:Ae(r,l)(b)}},"&[data-selected]":{backgroundColor:Ae(g,y)(b),color:Ae(e,t)(b),fontWeight:600,"&:hover":{backgroundColor:Ae(x,x)(b),color:Ae("white",e)(b)}},"&[data-disabled]":{color:Ae(s,i)(b),cursor:"not-allowed"}},rightSection:{width:24,padding:20,button:{color:Ae(p,t)(b)}}}),[m,h,g,x,y,t,n,r,o,e,s,i,l,u,p,w,b])},kM=je((e,t)=>{const{searchable:n=!0,tooltip:r,inputRef:o,label:s,disabled:i,...l}=e,u=te(),p=d.useCallback(g=>{g.shiftKey&&u(Nr(!0))},[u]),m=d.useCallback(g=>{g.shiftKey||u(Nr(!1))},[u]),h=yee();return a.jsx(Ht,{label:r,placement:"top",hasArrow:!0,isOpen:!0,children:a.jsxs(Kt,{ref:t,isDisabled:i,position:"static",children:[s&&a.jsx(wn,{children:s}),a.jsx(KE,{ref:o,disabled:i,onKeyDown:p,onKeyUp:m,searchable:n,maxDropdownHeight:300,styles:h,...l})]})})});kM.displayName="IAIMantineMultiSelect";const Cee=d.memo(kM),wee=nr(mh,(e,t)=>({value:t,label:e})).sort((e,t)=>e.label.localeCompare(t.label));function See(){const e=te(),{t}=Z(),n=W(o=>o.ui.favoriteSchedulers),r=d.useCallback(o=>{e(iD(o))},[e]);return a.jsx(Cee,{label:t("settings.favoriteSchedulers"),value:n,data:wee,onChange:r,clearable:!0,searchable:!0,maxSelectedValues:99,placeholder:t("settings.favoriteSchedulersPlaceholder")})}const kee=le([xe],({system:e,ui:t})=>{const{shouldConfirmOnDelete:n,enableImageDebugging:r,consoleLogLevel:o,shouldLogToConsole:s,shouldAntialiasProgressImage:i,shouldUseNSFWChecker:l,shouldUseWatermarker:u,shouldEnableInformationalPopovers:p}=e,{shouldUseSliders:m,shouldShowProgressInViewer:h,shouldAutoChangeDimensions:g}=t;return{shouldConfirmOnDelete:n,enableImageDebugging:r,shouldUseSliders:m,shouldShowProgressInViewer:h,consoleLogLevel:o,shouldLogToConsole:s,shouldAntialiasProgressImage:i,shouldUseNSFWChecker:l,shouldUseWatermarker:u,shouldAutoChangeDimensions:g,shouldEnableInformationalPopovers:p}},{memoizeOptions:{resultEqualityCheck:Ft}}),jee=({children:e,config:t})=>{const n=te(),{t:r}=Z(),[o,s]=d.useState(3),i=(t==null?void 0:t.shouldShowDeveloperSettings)??!0,l=(t==null?void 0:t.shouldShowResetWebUiText)??!0,u=(t==null?void 0:t.shouldShowClearIntermediates)??!0,p=(t==null?void 0:t.shouldShowLocalizationToggle)??!0;d.useEffect(()=>{i||n(nw(!1))},[i,n]);const{isNSFWCheckerAvailable:m,isWatermarkerAvailable:h}=iI(void 0,{selectFromResult:({data:Y})=>({isNSFWCheckerAvailable:(Y==null?void 0:Y.nsfw_methods.includes("nsfw_checker"))??!1,isWatermarkerAvailable:(Y==null?void 0:Y.watermarking_methods.includes("invisible_watermark"))??!1})}),{isOpen:g,onOpen:x,onClose:y}=Lr(),{isOpen:b,onOpen:w,onClose:S}=Lr(),{shouldConfirmOnDelete:j,enableImageDebugging:_,shouldUseSliders:E,shouldShowProgressInViewer:I,consoleLogLevel:M,shouldLogToConsole:R,shouldAntialiasProgressImage:D,shouldUseNSFWChecker:A,shouldUseWatermarker:O,shouldAutoChangeDimensions:T,shouldEnableInformationalPopovers:X}=W(kee),B=d.useCallback(()=>{Object.keys(window.localStorage).forEach(Y=>{(lD.includes(Y)||Y.startsWith(cD))&&localStorage.removeItem(Y)}),y(),w(),setInterval(()=>s(Y=>Y-1),1e3)},[y,w]);d.useEffect(()=>{o<=0&&window.location.reload()},[o]);const V=d.useCallback(Y=>{n(uD(Y))},[n]),U=d.useCallback(Y=>{n(dD(Y))},[n]),N=d.useCallback(Y=>{n(nw(Y.target.checked))},[n]),{colorMode:$,toggleColorMode:q}=ha(),F=Bt("localization").isFeatureEnabled,Q=W(SM);return a.jsxs(a.Fragment,{children:[d.cloneElement(e,{onClick:x}),a.jsxs(Ki,{isOpen:g,onClose:y,size:"2xl",isCentered:!0,children:[a.jsx(Yo,{}),a.jsxs(qi,{children:[a.jsx(Qo,{bg:"none",children:r("common.settingsLabel")}),a.jsx($d,{}),a.jsx(Zo,{children:a.jsxs(L,{sx:{gap:4,flexDirection:"column"},children:[a.jsxs(Gl,{children:[a.jsx(cr,{size:"sm",children:r("settings.general")}),a.jsx(Lo,{label:r("settings.confirmOnDelete"),isChecked:j,onChange:Y=>n(oI(Y.target.checked))})]}),a.jsxs(Gl,{children:[a.jsx(cr,{size:"sm",children:r("settings.generation")}),a.jsx(See,{}),a.jsx(Lo,{label:"Enable NSFW Checker",isDisabled:!m,isChecked:A,onChange:Y=>n(fD(Y.target.checked))}),a.jsx(Lo,{label:"Enable Invisible Watermark",isDisabled:!h,isChecked:O,onChange:Y=>n(pD(Y.target.checked))})]}),a.jsxs(Gl,{children:[a.jsx(cr,{size:"sm",children:r("settings.ui")}),a.jsx(Lo,{label:r("common.darkMode"),isChecked:$==="dark",onChange:q}),a.jsx(Lo,{label:r("settings.useSlidersForAll"),isChecked:E,onChange:Y=>n(mD(Y.target.checked))}),a.jsx(Lo,{label:r("settings.showProgressInViewer"),isChecked:I,onChange:Y=>n(lI(Y.target.checked))}),a.jsx(Lo,{label:r("settings.antialiasProgressImages"),isChecked:D,onChange:Y=>n(hD(Y.target.checked))}),a.jsx(Lo,{label:r("settings.autoChangeDimensions"),isChecked:T,onChange:Y=>n(gD(Y.target.checked))}),p&&a.jsx(On,{disabled:!F,label:r("common.languagePickerLabel"),value:Q,data:Object.entries(gee).map(([Y,se])=>({value:Y,label:se})),onChange:U}),a.jsx(Lo,{label:"Enable informational popovers",isChecked:X,onChange:Y=>n(vD(Y.target.checked))})]}),i&&a.jsxs(Gl,{children:[a.jsx(cr,{size:"sm",children:r("settings.developer")}),a.jsx(Lo,{label:r("settings.shouldLogToConsole"),isChecked:R,onChange:N}),a.jsx(On,{disabled:!R,label:r("settings.consoleLogLevel"),onChange:V,value:M,data:xD.concat()}),a.jsx(Lo,{label:r("settings.enableImageDebugging"),isChecked:_,onChange:Y=>n(bD(Y.target.checked))})]}),u&&a.jsx(bee,{}),a.jsxs(Gl,{children:[a.jsx(cr,{size:"sm",children:r("settings.resetWebUI")}),a.jsx(at,{colorScheme:"error",onClick:B,children:r("settings.resetWebUI")}),l&&a.jsxs(a.Fragment,{children:[a.jsx(ve,{variant:"subtext",children:r("settings.resetWebUIDesc1")}),a.jsx(ve,{variant:"subtext",children:r("settings.resetWebUIDesc2")})]})]})]})}),a.jsx(Ss,{children:a.jsx(at,{onClick:y,children:r("common.close")})})]})]}),a.jsxs(Ki,{closeOnOverlayClick:!1,isOpen:b,onClose:S,isCentered:!0,closeOnEsc:!1,children:[a.jsx(Yo,{backdropFilter:"blur(40px)"}),a.jsxs(qi,{children:[a.jsx(Qo,{}),a.jsx(Zo,{children:a.jsx(L,{justifyContent:"center",children:a.jsx(ve,{fontSize:"lg",children:a.jsxs(ve,{children:[r("settings.resetComplete")," Reloading in ",o,"..."]})})})}),a.jsx(Ss,{})]})]})]})},_ee=d.memo(jee),Iee=le(xe,({system:e})=>{const{isConnected:t,status:n}=e;return{isConnected:t,statusTranslationKey:vee[n]}},Se),Yk={ok:"green.400",working:"yellow.400",error:"red.400"},Zk={ok:"green.600",working:"yellow.500",error:"red.500"},Pee=()=>{const{isConnected:e,statusTranslationKey:t}=W(Iee),{t:n}=Z(),r=d.useRef(null),{data:o}=va(),s=d.useMemo(()=>e?o!=null&&o.queue.in_progress?"working":"ok":"error",[o==null?void 0:o.queue.in_progress,e]),i=CM(r);return a.jsxs(L,{ref:r,h:"full",px:2,alignItems:"center",gap:5,children:[a.jsx(dr,{children:i&&a.jsx(In.div,{initial:{opacity:0},animate:{opacity:1,transition:{duration:.15}},exit:{opacity:0,transition:{delay:.8}},children:a.jsx(ve,{sx:{fontSize:"sm",fontWeight:"600",pb:"1px",userSelect:"none",color:Zk[s],_dark:{color:Yk[s]}},children:n(t)})},"statusText")}),a.jsx(Tn,{as:OJ,sx:{boxSize:"0.5rem",color:Zk[s],_dark:{color:Yk[s]}}})]})},Eee=d.memo(Pee),Mee=()=>{const{t:e}=Z(),t=Bt("bugLink").isFeatureEnabled,n=Bt("discordLink").isFeatureEnabled,r=Bt("githubLink").isFeatureEnabled,o="http://github.com/invoke-ai/InvokeAI",s="https://discord.gg/ZmtBAhwWhy";return a.jsxs(L,{sx:{gap:2,alignItems:"center"},children:[a.jsx(hee,{}),a.jsx(ba,{}),a.jsx(Eee,{}),a.jsxs(Ah,{children:[a.jsx(Th,{as:Fe,variant:"link","aria-label":e("accessibility.menu"),icon:a.jsx(EJ,{}),sx:{boxSize:8}}),a.jsxs(Ui,{motionProps:vc,children:[a.jsxs(td,{title:e("common.communityLabel"),children:[r&&a.jsx(en,{as:"a",href:o,target:"_blank",icon:a.jsx(wJ,{}),children:e("common.githubLabel")}),t&&a.jsx(en,{as:"a",href:`${o}/issues`,target:"_blank",icon:a.jsx(MJ,{}),children:e("common.reportBugLabel")}),n&&a.jsx(en,{as:"a",href:s,target:"_blank",icon:a.jsx(CJ,{}),children:e("common.discordLabel")})]}),a.jsxs(td,{title:e("common.settingsLabel"),children:[a.jsx(iee,{children:a.jsx(en,{as:"button",icon:a.jsx(UJ,{}),children:e("common.hotkeysLabel")})}),a.jsx(_ee,{children:a.jsx(en,{as:"button",icon:a.jsx(cM,{}),children:e("common.settingsLabel")})})]})]})]})]})},Oee=d.memo(Mee);/*! +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function wP(e,t){if(e){if(typeof e=="string")return K1(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return K1(e,t)}}function K1(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function $U(e,t){if(e==null)return{};var n={},r=Object.keys(e),o,s;for(s=0;s=0)&&(n[o]=e[o]);return n}var Xb=d.forwardRef(function(e,t){var n=e.children,r=fm(e,_U),o=Qb(r),s=o.open,i=fm(o,IU);return d.useImperativeHandle(t,function(){return{open:s}},[s]),H.createElement(d.Fragment,null,n(bn(bn({},i),{},{open:s})))});Xb.displayName="Dropzone";var SP={disabled:!1,getFilesFromEvent:XW,maxSize:1/0,minSize:0,multiple:!0,maxFiles:0,preventDropOnDocument:!0,noClick:!1,noKeyboard:!1,noDrag:!1,noDragEventsBubbling:!1,validator:null,useFsAccessApi:!0,autoFocus:!1};Xb.defaultProps=SP;Xb.propTypes={children:Jt.func,accept:Jt.objectOf(Jt.arrayOf(Jt.string)),multiple:Jt.bool,preventDropOnDocument:Jt.bool,noClick:Jt.bool,noKeyboard:Jt.bool,noDrag:Jt.bool,noDragEventsBubbling:Jt.bool,minSize:Jt.number,maxSize:Jt.number,maxFiles:Jt.number,disabled:Jt.bool,getFilesFromEvent:Jt.func,onFileDialogCancel:Jt.func,onFileDialogOpen:Jt.func,useFsAccessApi:Jt.bool,autoFocus:Jt.bool,onDragEnter:Jt.func,onDragLeave:Jt.func,onDragOver:Jt.func,onDrop:Jt.func,onDropAccepted:Jt.func,onDropRejected:Jt.func,onError:Jt.func,validator:Jt.func};var X1={isFocused:!1,isFileDialogActive:!1,isDragActive:!1,isDragAccept:!1,isDragReject:!1,acceptedFiles:[],fileRejections:[]};function Qb(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=bn(bn({},SP),e),n=t.accept,r=t.disabled,o=t.getFilesFromEvent,s=t.maxSize,i=t.minSize,l=t.multiple,u=t.maxFiles,p=t.onDragEnter,m=t.onDragLeave,h=t.onDragOver,g=t.onDrop,x=t.onDropAccepted,y=t.onDropRejected,b=t.onFileDialogCancel,w=t.onFileDialogOpen,S=t.useFsAccessApi,j=t.autoFocus,_=t.preventDropOnDocument,E=t.noClick,I=t.noKeyboard,M=t.noDrag,R=t.noDragEventsBubbling,D=t.onError,A=t.validator,O=d.useMemo(function(){return SU(n)},[n]),T=d.useMemo(function(){return wU(n)},[n]),X=d.useMemo(function(){return typeof w=="function"?w:GS},[w]),B=d.useMemo(function(){return typeof b=="function"?b:GS},[b]),V=d.useRef(null),U=d.useRef(null),N=d.useReducer(LU,X1),$=Cv(N,2),q=$[0],F=$[1],Q=q.isFocused,Y=q.isFileDialogActive,se=d.useRef(typeof window<"u"&&window.isSecureContext&&S&&CU()),ae=function(){!se.current&&Y&&setTimeout(function(){if(U.current){var De=U.current.files;De.length||(F({type:"closeDialog"}),B())}},300)};d.useEffect(function(){return window.addEventListener("focus",ae,!1),function(){window.removeEventListener("focus",ae,!1)}},[U,Y,B,se]);var re=d.useRef([]),G=function(De){V.current&&V.current.contains(De.target)||(De.preventDefault(),re.current=[])};d.useEffect(function(){return _&&(document.addEventListener("dragover",WS,!1),document.addEventListener("drop",G,!1)),function(){_&&(document.removeEventListener("dragover",WS),document.removeEventListener("drop",G))}},[V,_]),d.useEffect(function(){return!r&&j&&V.current&&V.current.focus(),function(){}},[V,j,r]);var K=d.useCallback(function(ye){D?D(ye):console.error(ye)},[D]),ee=d.useCallback(function(ye){ye.preventDefault(),ye.persist(),$e(ye),re.current=[].concat(MU(re.current),[ye.target]),sp(ye)&&Promise.resolve(o(ye)).then(function(De){if(!(dm(ye)&&!R)){var ut=De.length,bt=ut>0&&vU({files:De,accept:O,minSize:i,maxSize:s,multiple:l,maxFiles:u,validator:A}),be=ut>0&&!bt;F({isDragAccept:bt,isDragReject:be,isDragActive:!0,type:"setDraggedFiles"}),p&&p(ye)}}).catch(function(De){return K(De)})},[o,p,K,R,O,i,s,l,u,A]),le=d.useCallback(function(ye){ye.preventDefault(),ye.persist(),$e(ye);var De=sp(ye);if(De&&ye.dataTransfer)try{ye.dataTransfer.dropEffect="copy"}catch{}return De&&h&&h(ye),!1},[h,R]),J=d.useCallback(function(ye){ye.preventDefault(),ye.persist(),$e(ye);var De=re.current.filter(function(bt){return V.current&&V.current.contains(bt)}),ut=De.indexOf(ye.target);ut!==-1&&De.splice(ut,1),re.current=De,!(De.length>0)&&(F({type:"setDraggedFiles",isDragActive:!1,isDragAccept:!1,isDragReject:!1}),sp(ye)&&m&&m(ye))},[V,m,R]),ie=d.useCallback(function(ye,De){var ut=[],bt=[];ye.forEach(function(be){var Je=xP(be,O),lt=Cv(Je,2),ft=lt[0],Me=lt[1],Le=bP(be,i,s),Ut=Cv(Le,2),Se=Ut[0],Be=Ut[1],ze=A?A(be):null;if(ft&&Se&&!ze)ut.push(be);else{var Ge=[Me,Be];ze&&(Ge=Ge.concat(ze)),bt.push({file:be,errors:Ge.filter(function(pt){return pt})})}}),(!l&&ut.length>1||l&&u>=1&&ut.length>u)&&(ut.forEach(function(be){bt.push({file:be,errors:[gU]})}),ut.splice(0)),F({acceptedFiles:ut,fileRejections:bt,type:"setFiles"}),g&&g(ut,bt,De),bt.length>0&&y&&y(bt,De),ut.length>0&&x&&x(ut,De)},[F,l,O,i,s,u,g,x,y,A]),de=d.useCallback(function(ye){ye.preventDefault(),ye.persist(),$e(ye),re.current=[],sp(ye)&&Promise.resolve(o(ye)).then(function(De){dm(ye)&&!R||ie(De,ye)}).catch(function(De){return K(De)}),F({type:"reset"})},[o,ie,K,R]),ge=d.useCallback(function(){if(se.current){F({type:"openDialog"}),X();var ye={multiple:l,types:T};window.showOpenFilePicker(ye).then(function(De){return o(De)}).then(function(De){ie(De,null),F({type:"closeDialog"})}).catch(function(De){kU(De)?(B(De),F({type:"closeDialog"})):jU(De)?(se.current=!1,U.current?(U.current.value=null,U.current.click()):K(new Error("Cannot open the file picker because the https://developer.mozilla.org/en-US/docs/Web/API/File_System_Access_API is not supported and no was provided."))):K(De)});return}U.current&&(F({type:"openDialog"}),X(),U.current.value=null,U.current.click())},[F,X,B,S,ie,K,T,l]),Ce=d.useCallback(function(ye){!V.current||!V.current.isEqualNode(ye.target)||(ye.key===" "||ye.key==="Enter"||ye.keyCode===32||ye.keyCode===13)&&(ye.preventDefault(),ge())},[V,ge]),he=d.useCallback(function(){F({type:"focus"})},[]),fe=d.useCallback(function(){F({type:"blur"})},[]),Oe=d.useCallback(function(){E||(yU()?setTimeout(ge,0):ge())},[E,ge]),_e=function(De){return r?null:De},Ne=function(De){return I?null:_e(De)},nt=function(De){return M?null:_e(De)},$e=function(De){R&&De.stopPropagation()},Pt=d.useMemo(function(){return function(){var ye=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},De=ye.refKey,ut=De===void 0?"ref":De,bt=ye.role,be=ye.onKeyDown,Je=ye.onFocus,lt=ye.onBlur,ft=ye.onClick,Me=ye.onDragEnter,Le=ye.onDragOver,Ut=ye.onDragLeave,Se=ye.onDrop,Be=fm(ye,PU);return bn(bn(q1({onKeyDown:Ne(ps(be,Ce)),onFocus:Ne(ps(Je,he)),onBlur:Ne(ps(lt,fe)),onClick:_e(ps(ft,Oe)),onDragEnter:nt(ps(Me,ee)),onDragOver:nt(ps(Le,le)),onDragLeave:nt(ps(Ut,J)),onDrop:nt(ps(Se,de)),role:typeof bt=="string"&&bt!==""?bt:"presentation"},ut,V),!r&&!I?{tabIndex:0}:{}),Be)}},[V,Ce,he,fe,Oe,ee,le,J,de,I,M,r]),Ze=d.useCallback(function(ye){ye.stopPropagation()},[]),ot=d.useMemo(function(){return function(){var ye=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},De=ye.refKey,ut=De===void 0?"ref":De,bt=ye.onChange,be=ye.onClick,Je=fm(ye,EU),lt=q1({accept:O,multiple:l,type:"file",style:{display:"none"},onChange:_e(ps(bt,de)),onClick:_e(ps(be,Ze)),tabIndex:-1},ut,U);return bn(bn({},lt),Je)}},[U,n,l,de,r]);return bn(bn({},q),{},{isFocused:Q&&!r,getRootProps:Pt,getInputProps:ot,rootRef:V,inputRef:U,open:_e(ge)})}function LU(e,t){switch(t.type){case"focus":return bn(bn({},e),{},{isFocused:!0});case"blur":return bn(bn({},e),{},{isFocused:!1});case"openDialog":return bn(bn({},X1),{},{isFileDialogActive:!0});case"closeDialog":return bn(bn({},e),{},{isFileDialogActive:!1});case"setDraggedFiles":return bn(bn({},e),{},{isDragActive:t.isDragActive,isDragAccept:t.isDragAccept,isDragReject:t.isDragReject});case"setFiles":return bn(bn({},e),{},{acceptedFiles:t.acceptedFiles,fileRejections:t.fileRejections});case"reset":return bn({},X1);default:return e}}function GS(){}function Q1(){return Q1=Object.assign?Object.assign.bind():function(e){for(var t=1;t'),!0):t?e.some(function(n){return t.includes(n)})||e.includes("*"):!0}var UU=function(t,n,r){r===void 0&&(r=!1);var o=n.alt,s=n.meta,i=n.mod,l=n.shift,u=n.ctrl,p=n.keys,m=t.key,h=t.code,g=t.ctrlKey,x=t.metaKey,y=t.shiftKey,b=t.altKey,w=Va(h),S=m.toLowerCase();if(!r){if(o===!b&&S!=="alt"||l===!y&&S!=="shift")return!1;if(i){if(!x&&!g)return!1}else if(s===!x&&S!=="meta"&&S!=="os"||u===!g&&S!=="ctrl"&&S!=="control")return!1}return p&&p.length===1&&(p.includes(S)||p.includes(w))?!0:p?Hp(p):!p},GU=d.createContext(void 0),KU=function(){return d.useContext(GU)};function PP(e,t){return e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(e).length===Object.keys(t).length&&Object.keys(e).reduce(function(n,r){return n&&PP(e[r],t[r])},!0):e===t}var qU=d.createContext({hotkeys:[],enabledScopes:[],toggleScope:function(){},enableScope:function(){},disableScope:function(){}}),XU=function(){return d.useContext(qU)};function QU(e){var t=d.useRef(void 0);return PP(t.current,e)||(t.current=e),t.current}var KS=function(t){t.stopPropagation(),t.preventDefault(),t.stopImmediatePropagation()},YU=typeof window<"u"?d.useLayoutEffect:d.useEffect;function et(e,t,n,r){var o=d.useRef(null),s=d.useRef(!1),i=n instanceof Array?r instanceof Array?void 0:r:n,l=Yb(e)?e.join(i==null?void 0:i.splitKey):e,u=n instanceof Array?n:r instanceof Array?r:void 0,p=d.useCallback(t,u??[]),m=d.useRef(p);u?m.current=p:m.current=t;var h=QU(i),g=XU(),x=g.enabledScopes,y=KU();return YU(function(){if(!((h==null?void 0:h.enabled)===!1||!WU(x,h==null?void 0:h.scopes))){var b=function(E,I){var M;if(I===void 0&&(I=!1),!(VU(E)&&!IP(E,h==null?void 0:h.enableOnFormTags))&&!(h!=null&&h.ignoreEventWhen!=null&&h.ignoreEventWhen(E))){if(o.current!==null&&document.activeElement!==o.current&&!o.current.contains(document.activeElement)){KS(E);return}(M=E.target)!=null&&M.isContentEditable&&!(h!=null&&h.enableOnContentEditable)||wv(l,h==null?void 0:h.splitKey).forEach(function(R){var D,A=Sv(R,h==null?void 0:h.combinationKey);if(UU(E,A,h==null?void 0:h.ignoreModifiers)||(D=A.keys)!=null&&D.includes("*")){if(I&&s.current)return;if(BU(E,A,h==null?void 0:h.preventDefault),!HU(E,A,h==null?void 0:h.enabled)){KS(E);return}m.current(E,A),I||(s.current=!0)}})}},w=function(E){E.key!==void 0&&(jP(Va(E.code)),((h==null?void 0:h.keydown)===void 0&&(h==null?void 0:h.keyup)!==!0||h!=null&&h.keydown)&&b(E))},S=function(E){E.key!==void 0&&(_P(Va(E.code)),s.current=!1,h!=null&&h.keyup&&b(E,!0))},j=o.current||(i==null?void 0:i.document)||document;return j.addEventListener("keyup",S),j.addEventListener("keydown",w),y&&wv(l,h==null?void 0:h.splitKey).forEach(function(_){return y.addHotkey(Sv(_,h==null?void 0:h.combinationKey,h==null?void 0:h.description))}),function(){j.removeEventListener("keyup",S),j.removeEventListener("keydown",w),y&&wv(l,h==null?void 0:h.splitKey).forEach(function(_){return y.removeHotkey(Sv(_,h==null?void 0:h.combinationKey,h==null?void 0:h.description))})}}},[l,h,x]),o}const ZU=e=>{const{isDragAccept:t,isDragReject:n,setIsHandlingUpload:r}=e;return et("esc",()=>{r(!1)}),a.jsxs(Ie,{sx:{position:"absolute",top:0,insetInlineStart:0,width:"100vw",height:"100vh",zIndex:999,backdropFilter:"blur(20px)"},children:[a.jsx(L,{sx:{position:"absolute",top:0,insetInlineStart:0,w:"full",h:"full",bg:"base.700",_dark:{bg:"base.900"},opacity:.7,alignItems:"center",justifyContent:"center",transitionProperty:"common",transitionDuration:"0.1s"}}),a.jsx(L,{sx:{position:"absolute",top:0,insetInlineStart:0,width:"full",height:"full",alignItems:"center",justifyContent:"center",p:4},children:a.jsx(L,{sx:{width:"full",height:"full",alignItems:"center",justifyContent:"center",flexDir:"column",gap:4,borderWidth:3,borderRadius:"xl",borderStyle:"dashed",color:"base.100",borderColor:"base.100",_dark:{borderColor:"base.200"}},children:t?a.jsx(cr,{size:"lg",children:"Drop to Upload"}):a.jsxs(a.Fragment,{children:[a.jsx(cr,{size:"lg",children:"Invalid Upload"}),a.jsx(cr,{size:"md",children:"Must be single JPEG or PNG image"})]})})})]})},JU=d.memo(ZU),eG=ce([xe,Jn],({gallery:e},t)=>{let n={type:"TOAST"};t==="unifiedCanvas"&&(n={type:"SET_CANVAS_INITIAL_IMAGE"}),t==="img2img"&&(n={type:"SET_INITIAL_IMAGE"});const{autoAddBoardId:r}=e;return{autoAddBoardId:r,postUploadAction:n}},je),tG=e=>{const{children:t}=e,{autoAddBoardId:n,postUploadAction:r}=W(eG),o=sl(),{t:s}=Z(),[i,l]=d.useState(!1),[u]=nI(),p=d.useCallback(_=>{l(!0),o({title:s("toast.uploadFailed"),description:_.errors.map(E=>E.message).join(` +`),status:"error"})},[s,o]),m=d.useCallback(async _=>{u({file:_,image_category:"user",is_intermediate:!1,postUploadAction:r,board_id:n==="none"?void 0:n})},[n,r,u]),h=d.useCallback((_,E)=>{if(E.length>1){o({title:s("toast.uploadFailed"),description:s("toast.uploadFailedInvalidUploadDesc"),status:"error"});return}E.forEach(I=>{p(I)}),_.forEach(I=>{m(I)})},[s,o,m,p]),g=d.useCallback(()=>{l(!0)},[]),{getRootProps:x,getInputProps:y,isDragAccept:b,isDragReject:w,isDragActive:S,inputRef:j}=Qb({accept:{"image/png":[".png"],"image/jpeg":[".jpg",".jpeg",".png"]},noClick:!0,onDrop:h,onDragOver:g,multiple:!1});return d.useEffect(()=>{const _=async E=>{var I,M;j.current&&(I=E.clipboardData)!=null&&I.files&&(j.current.files=E.clipboardData.files,(M=j.current)==null||M.dispatchEvent(new Event("change",{bubbles:!0})))};return document.addEventListener("paste",_),()=>{document.removeEventListener("paste",_)}},[j]),a.jsxs(Ie,{...x({style:{}}),onKeyDown:_=>{_.key},children:[a.jsx("input",{...y()}),t,a.jsx(dr,{children:S&&i&&a.jsx(In.div,{initial:{opacity:0},animate:{opacity:1,transition:{duration:.1}},exit:{opacity:0,transition:{duration:.1}},children:a.jsx(JU,{isDragAccept:b,isDragReject:w,setIsHandlingUpload:l})},"image-upload-overlay")})]})},nG=d.memo(tG),rG=ke((e,t)=>{const{children:n,tooltip:r="",tooltipProps:{placement:o="top",hasArrow:s=!0,...i}={},isChecked:l,...u}=e;return a.jsx(Ht,{label:r,placement:o,hasArrow:s,...i,children:a.jsx(Za,{ref:t,colorScheme:l?"accent":"base",...u,children:n})})}),at=d.memo(rG);function oG(e){const t=d.createContext(null);return[({children:o,value:s})=>H.createElement(t.Provider,{value:s},o),()=>{const o=d.useContext(t);if(o===null)throw new Error(e);return o}]}function EP(e){return Array.isArray(e)?e:[e]}const sG=()=>{};function aG(e,t={active:!0}){return typeof e!="function"||!t.active?t.onKeyDown||sG:n=>{var r;n.key==="Escape"&&(e(n),(r=t.onTrigger)==null||r.call(t))}}function MP({data:e}){const t=[],n=[],r=e.reduce((o,s,i)=>(s.group?o[s.group]?o[s.group].push(i):o[s.group]=[i]:n.push(i),o),{});return Object.keys(r).forEach(o=>{t.push(...r[o].map(s=>e[s]))}),t.push(...n.map(o=>e[o])),t}function OP(e){return Array.isArray(e)||e===null?!1:typeof e=="object"?e.type!==H.Fragment:!1}function RP(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e))for(t=0;tr===t[o]).indexOf(!1)>=0)&&(n.current={v:e(),prevDeps:[...t]}),n.current.v}const cG=XR({key:"mantine",prepend:!0});function uG(){return QI()||cG}var dG=Object.defineProperty,qS=Object.getOwnPropertySymbols,fG=Object.prototype.hasOwnProperty,pG=Object.prototype.propertyIsEnumerable,XS=(e,t,n)=>t in e?dG(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,mG=(e,t)=>{for(var n in t||(t={}))fG.call(t,n)&&XS(e,n,t[n]);if(qS)for(var n of qS(t))pG.call(t,n)&&XS(e,n,t[n]);return e};const kv="ref";function hG(e){let t;if(e.length!==1)return{args:e,ref:t};const[n]=e;if(!(n instanceof Object))return{args:e,ref:t};if(!(kv in n))return{args:e,ref:t};t=n[kv];const r=mG({},n);return delete r[kv],{args:[r],ref:t}}const{cssFactory:gG}=(()=>{function e(n,r,o){const s=[],i=ZR(n,s,o);return s.length<2?o:i+r(s)}function t(n){const{cache:r}=n,o=(...i)=>{const{ref:l,args:u}=hG(i),p=QR(u,r.registered);return YR(r,p,!1),`${r.key}-${p.name}${l===void 0?"":` ${l}`}`};return{css:o,cx:(...i)=>e(r.registered,o,DP(i))}}return{cssFactory:t}})();function AP(){const e=uG();return lG(()=>gG({cache:e}),[e])}function vG({cx:e,classes:t,context:n,classNames:r,name:o,cache:s}){const i=n.reduce((l,u)=>(Object.keys(u.classNames).forEach(p=>{typeof l[p]!="string"?l[p]=`${u.classNames[p]}`:l[p]=`${l[p]} ${u.classNames[p]}`}),l),{});return Object.keys(t).reduce((l,u)=>(l[u]=e(t[u],i[u],r!=null&&r[u],Array.isArray(o)?o.filter(Boolean).map(p=>`${(s==null?void 0:s.key)||"mantine"}-${p}-${u}`).join(" "):o?`${(s==null?void 0:s.key)||"mantine"}-${o}-${u}`:null),l),{})}var xG=Object.defineProperty,QS=Object.getOwnPropertySymbols,bG=Object.prototype.hasOwnProperty,yG=Object.prototype.propertyIsEnumerable,YS=(e,t,n)=>t in e?xG(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,jv=(e,t)=>{for(var n in t||(t={}))bG.call(t,n)&&YS(e,n,t[n]);if(QS)for(var n of QS(t))yG.call(t,n)&&YS(e,n,t[n]);return e};function Y1(e,t){return t&&Object.keys(t).forEach(n=>{e[n]?e[n]=jv(jv({},e[n]),t[n]):e[n]=jv({},t[n])}),e}function ZS(e,t,n,r){const o=s=>typeof s=="function"?s(t,n||{},r):s||{};return Array.isArray(e)?e.map(s=>o(s.styles)).reduce((s,i)=>Y1(s,i),{}):o(e)}function CG({ctx:e,theme:t,params:n,variant:r,size:o}){return e.reduce((s,i)=>(i.variants&&r in i.variants&&Y1(s,i.variants[r](t,n,{variant:r,size:o})),i.sizes&&o in i.sizes&&Y1(s,i.sizes[o](t,n,{variant:r,size:o})),s),{})}function fr(e){const t=typeof e=="function"?e:()=>e;function n(r,o){const s=xa(),i=z9(o==null?void 0:o.name),l=QI(),u={variant:o==null?void 0:o.variant,size:o==null?void 0:o.size},{css:p,cx:m}=AP(),h=t(s,r,u),g=ZS(o==null?void 0:o.styles,s,r,u),x=ZS(i,s,r,u),y=CG({ctx:i,theme:s,params:r,variant:o==null?void 0:o.variant,size:o==null?void 0:o.size}),b=Object.fromEntries(Object.keys(h).map(w=>{const S=m({[p(h[w])]:!(o!=null&&o.unstyled)},p(y[w]),p(x[w]),p(g[w]));return[w,S]}));return{classes:vG({cx:m,classes:b,context:i,classNames:o==null?void 0:o.classNames,name:o==null?void 0:o.name,cache:l}),cx:m,theme:s}}return n}function JS(e){return`___ref-${e||""}`}var wG=Object.defineProperty,SG=Object.defineProperties,kG=Object.getOwnPropertyDescriptors,e4=Object.getOwnPropertySymbols,jG=Object.prototype.hasOwnProperty,_G=Object.prototype.propertyIsEnumerable,t4=(e,t,n)=>t in e?wG(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,wu=(e,t)=>{for(var n in t||(t={}))jG.call(t,n)&&t4(e,n,t[n]);if(e4)for(var n of e4(t))_G.call(t,n)&&t4(e,n,t[n]);return e},Su=(e,t)=>SG(e,kG(t));const ku={in:{opacity:1,transform:"scale(1)"},out:{opacity:0,transform:`scale(.9) translateY(${Re(10)})`},transitionProperty:"transform, opacity"},ap={fade:{in:{opacity:1},out:{opacity:0},transitionProperty:"opacity"},scale:{in:{opacity:1,transform:"scale(1)"},out:{opacity:0,transform:"scale(0)"},common:{transformOrigin:"top"},transitionProperty:"transform, opacity"},"scale-y":{in:{opacity:1,transform:"scaleY(1)"},out:{opacity:0,transform:"scaleY(0)"},common:{transformOrigin:"top"},transitionProperty:"transform, opacity"},"scale-x":{in:{opacity:1,transform:"scaleX(1)"},out:{opacity:0,transform:"scaleX(0)"},common:{transformOrigin:"left"},transitionProperty:"transform, opacity"},"skew-up":{in:{opacity:1,transform:"translateY(0) skew(0deg, 0deg)"},out:{opacity:0,transform:`translateY(-${Re(20)}) skew(-10deg, -5deg)`},common:{transformOrigin:"top"},transitionProperty:"transform, opacity"},"skew-down":{in:{opacity:1,transform:"translateY(0) skew(0deg, 0deg)"},out:{opacity:0,transform:`translateY(${Re(20)}) skew(-10deg, -5deg)`},common:{transformOrigin:"bottom"},transitionProperty:"transform, opacity"},"rotate-left":{in:{opacity:1,transform:"translateY(0) rotate(0deg)"},out:{opacity:0,transform:`translateY(${Re(20)}) rotate(-5deg)`},common:{transformOrigin:"bottom"},transitionProperty:"transform, opacity"},"rotate-right":{in:{opacity:1,transform:"translateY(0) rotate(0deg)"},out:{opacity:0,transform:`translateY(${Re(20)}) rotate(5deg)`},common:{transformOrigin:"top"},transitionProperty:"transform, opacity"},"slide-down":{in:{opacity:1,transform:"translateY(0)"},out:{opacity:0,transform:"translateY(-100%)"},common:{transformOrigin:"top"},transitionProperty:"transform, opacity"},"slide-up":{in:{opacity:1,transform:"translateY(0)"},out:{opacity:0,transform:"translateY(100%)"},common:{transformOrigin:"bottom"},transitionProperty:"transform, opacity"},"slide-left":{in:{opacity:1,transform:"translateX(0)"},out:{opacity:0,transform:"translateX(100%)"},common:{transformOrigin:"left"},transitionProperty:"transform, opacity"},"slide-right":{in:{opacity:1,transform:"translateX(0)"},out:{opacity:0,transform:"translateX(-100%)"},common:{transformOrigin:"right"},transitionProperty:"transform, opacity"},pop:Su(wu({},ku),{common:{transformOrigin:"center center"}}),"pop-bottom-left":Su(wu({},ku),{common:{transformOrigin:"bottom left"}}),"pop-bottom-right":Su(wu({},ku),{common:{transformOrigin:"bottom right"}}),"pop-top-left":Su(wu({},ku),{common:{transformOrigin:"top left"}}),"pop-top-right":Su(wu({},ku),{common:{transformOrigin:"top right"}})},n4=["mousedown","touchstart"];function IG(e,t,n){const r=d.useRef();return d.useEffect(()=>{const o=s=>{const{target:i}=s??{};if(Array.isArray(n)){const l=(i==null?void 0:i.hasAttribute("data-ignore-outside-clicks"))||!document.body.contains(i)&&i.tagName!=="HTML";n.every(p=>!!p&&!s.composedPath().includes(p))&&!l&&e()}else r.current&&!r.current.contains(i)&&e()};return(t||n4).forEach(s=>document.addEventListener(s,o)),()=>{(t||n4).forEach(s=>document.removeEventListener(s,o))}},[r,e,n]),r}function PG(e,t){try{return e.addEventListener("change",t),()=>e.removeEventListener("change",t)}catch{return e.addListener(t),()=>e.removeListener(t)}}function EG(e,t){return typeof t=="boolean"?t:typeof window<"u"&&"matchMedia"in window?window.matchMedia(e).matches:!1}function MG(e,t,{getInitialValueInEffect:n}={getInitialValueInEffect:!0}){const[r,o]=d.useState(n?t:EG(e,t)),s=d.useRef();return d.useEffect(()=>{if("matchMedia"in window)return s.current=window.matchMedia(e),o(s.current.matches),PG(s.current,i=>o(i.matches))},[e]),r}const TP=typeof document<"u"?d.useLayoutEffect:d.useEffect;function Uo(e,t){const n=d.useRef(!1);d.useEffect(()=>()=>{n.current=!1},[]),d.useEffect(()=>{if(n.current)return e();n.current=!0},t)}function OG({opened:e,shouldReturnFocus:t=!0}){const n=d.useRef(),r=()=>{var o;n.current&&"focus"in n.current&&typeof n.current.focus=="function"&&((o=n.current)==null||o.focus({preventScroll:!0}))};return Uo(()=>{let o=-1;const s=i=>{i.key==="Tab"&&window.clearTimeout(o)};return document.addEventListener("keydown",s),e?n.current=document.activeElement:t&&(o=window.setTimeout(r,10)),()=>{window.clearTimeout(o),document.removeEventListener("keydown",s)}},[e,t]),r}const RG=/input|select|textarea|button|object/,NP="a, input, select, textarea, button, object, [tabindex]";function DG(e){return e.style.display==="none"}function AG(e){if(e.getAttribute("aria-hidden")||e.getAttribute("hidden")||e.getAttribute("type")==="hidden")return!1;let n=e;for(;n&&!(n===document.body||n.nodeType===11);){if(DG(n))return!1;n=n.parentNode}return!0}function $P(e){let t=e.getAttribute("tabindex");return t===null&&(t=void 0),parseInt(t,10)}function Z1(e){const t=e.nodeName.toLowerCase(),n=!Number.isNaN($P(e));return(RG.test(t)&&!e.disabled||e instanceof HTMLAnchorElement&&e.href||n)&&AG(e)}function LP(e){const t=$P(e);return(Number.isNaN(t)||t>=0)&&Z1(e)}function TG(e){return Array.from(e.querySelectorAll(NP)).filter(LP)}function NG(e,t){const n=TG(e);if(!n.length){t.preventDefault();return}const r=n[t.shiftKey?0:n.length-1],o=e.getRootNode();if(!(r===o.activeElement||e===o.activeElement))return;t.preventDefault();const i=n[t.shiftKey?n.length-1:0];i&&i.focus()}function Jb(){return`mantine-${Math.random().toString(36).slice(2,11)}`}function $G(e,t="body > :not(script)"){const n=Jb(),r=Array.from(document.querySelectorAll(t)).map(o=>{var s;if((s=o==null?void 0:o.shadowRoot)!=null&&s.contains(e)||o.contains(e))return;const i=o.getAttribute("aria-hidden"),l=o.getAttribute("data-hidden"),u=o.getAttribute("data-focus-id");return o.setAttribute("data-focus-id",n),i===null||i==="false"?o.setAttribute("aria-hidden","true"):!l&&!u&&o.setAttribute("data-hidden",i),{node:o,ariaHidden:l||null}});return()=>{r.forEach(o=>{!o||n!==o.node.getAttribute("data-focus-id")||(o.ariaHidden===null?o.node.removeAttribute("aria-hidden"):o.node.setAttribute("aria-hidden",o.ariaHidden),o.node.removeAttribute("data-focus-id"),o.node.removeAttribute("data-hidden"))})}}function LG(e=!0){const t=d.useRef(),n=d.useRef(null),r=s=>{let i=s.querySelector("[data-autofocus]");if(!i){const l=Array.from(s.querySelectorAll(NP));i=l.find(LP)||l.find(Z1)||null,!i&&Z1(s)&&(i=s)}i&&i.focus({preventScroll:!0})},o=d.useCallback(s=>{if(e){if(s===null){n.current&&(n.current(),n.current=null);return}n.current=$G(s),t.current!==s&&(s?(setTimeout(()=>{s.getRootNode()&&r(s)}),t.current=s):t.current=null)}},[e]);return d.useEffect(()=>{if(!e)return;t.current&&setTimeout(()=>r(t.current));const s=i=>{i.key==="Tab"&&t.current&&NG(t.current,i)};return document.addEventListener("keydown",s),()=>{document.removeEventListener("keydown",s),n.current&&n.current()}},[e]),o}const zG=H["useId".toString()]||(()=>{});function FG(){const e=zG();return e?`mantine-${e.replace(/:/g,"")}`:""}function ey(e){const t=FG(),[n,r]=d.useState(t);return TP(()=>{r(Jb())},[]),typeof e=="string"?e:typeof window>"u"?t:n}function r4(e,t,n){d.useEffect(()=>(window.addEventListener(e,t,n),()=>window.removeEventListener(e,t,n)),[e,t])}function zP(e,t){typeof e=="function"?e(t):typeof e=="object"&&e!==null&&"current"in e&&(e.current=t)}function BG(...e){return t=>{e.forEach(n=>zP(n,t))}}function Bd(...e){return d.useCallback(BG(...e),e)}function od({value:e,defaultValue:t,finalValue:n,onChange:r=()=>{}}){const[o,s]=d.useState(t!==void 0?t:n),i=l=>{s(l),r==null||r(l)};return e!==void 0?[e,r,!0]:[o,i,!1]}function FP(e,t){return MG("(prefers-reduced-motion: reduce)",e,t)}const HG=e=>e<.5?2*e*e:-1+(4-2*e)*e,VG=({axis:e,target:t,parent:n,alignment:r,offset:o,isList:s})=>{if(!t||!n&&typeof document>"u")return 0;const i=!!n,u=(n||document.body).getBoundingClientRect(),p=t.getBoundingClientRect(),m=h=>p[h]-u[h];if(e==="y"){const h=m("top");if(h===0)return 0;if(r==="start"){const x=h-o;return x<=p.height*(s?0:1)||!s?x:0}const g=i?u.height:window.innerHeight;if(r==="end"){const x=h+o-g+p.height;return x>=-p.height*(s?0:1)||!s?x:0}return r==="center"?h-g/2+p.height/2:0}if(e==="x"){const h=m("left");if(h===0)return 0;if(r==="start"){const x=h-o;return x<=p.width||!s?x:0}const g=i?u.width:window.innerWidth;if(r==="end"){const x=h+o-g+p.width;return x>=-p.width||!s?x:0}return r==="center"?h-g/2+p.width/2:0}return 0},WG=({axis:e,parent:t})=>{if(!t&&typeof document>"u")return 0;const n=e==="y"?"scrollTop":"scrollLeft";if(t)return t[n];const{body:r,documentElement:o}=document;return r[n]+o[n]},UG=({axis:e,parent:t,distance:n})=>{if(!t&&typeof document>"u")return;const r=e==="y"?"scrollTop":"scrollLeft";if(t)t[r]=n;else{const{body:o,documentElement:s}=document;o[r]=n,s[r]=n}};function BP({duration:e=1250,axis:t="y",onScrollFinish:n,easing:r=HG,offset:o=0,cancelable:s=!0,isList:i=!1}={}){const l=d.useRef(0),u=d.useRef(0),p=d.useRef(!1),m=d.useRef(null),h=d.useRef(null),g=FP(),x=()=>{l.current&&cancelAnimationFrame(l.current)},y=d.useCallback(({alignment:w="start"}={})=>{var S;p.current=!1,l.current&&x();const j=(S=WG({parent:m.current,axis:t}))!=null?S:0,_=VG({parent:m.current,target:h.current,axis:t,alignment:w,offset:o,isList:i})-(m.current?0:j);function E(){u.current===0&&(u.current=performance.now());const M=performance.now()-u.current,R=g||e===0?1:M/e,D=j+_*r(R);UG({parent:m.current,axis:t,distance:D}),!p.current&&R<1?l.current=requestAnimationFrame(E):(typeof n=="function"&&n(),u.current=0,l.current=0,x())}E()},[t,e,r,i,o,n,g]),b=()=>{s&&(p.current=!0)};return r4("wheel",b,{passive:!0}),r4("touchmove",b,{passive:!0}),d.useEffect(()=>x,[]),{scrollableRef:m,targetRef:h,scrollIntoView:y,cancel:x}}var o4=Object.getOwnPropertySymbols,GG=Object.prototype.hasOwnProperty,KG=Object.prototype.propertyIsEnumerable,qG=(e,t)=>{var n={};for(var r in e)GG.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&o4)for(var r of o4(e))t.indexOf(r)<0&&KG.call(e,r)&&(n[r]=e[r]);return n};function eg(e){const t=e,{m:n,mx:r,my:o,mt:s,mb:i,ml:l,mr:u,p,px:m,py:h,pt:g,pb:x,pl:y,pr:b,bg:w,c:S,opacity:j,ff:_,fz:E,fw:I,lts:M,ta:R,lh:D,fs:A,tt:O,td:T,w:X,miw:B,maw:V,h:U,mih:N,mah:$,bgsz:q,bgp:F,bgr:Q,bga:Y,pos:se,top:ae,left:re,bottom:G,right:K,inset:ee,display:le}=t,J=qG(t,["m","mx","my","mt","mb","ml","mr","p","px","py","pt","pb","pl","pr","bg","c","opacity","ff","fz","fw","lts","ta","lh","fs","tt","td","w","miw","maw","h","mih","mah","bgsz","bgp","bgr","bga","pos","top","left","bottom","right","inset","display"]);return{systemStyles:F9({m:n,mx:r,my:o,mt:s,mb:i,ml:l,mr:u,p,px:m,py:h,pt:g,pb:x,pl:y,pr:b,bg:w,c:S,opacity:j,ff:_,fz:E,fw:I,lts:M,ta:R,lh:D,fs:A,tt:O,td:T,w:X,miw:B,maw:V,h:U,mih:N,mah:$,bgsz:q,bgp:F,bgr:Q,bga:Y,pos:se,top:ae,left:re,bottom:G,right:K,inset:ee,display:le}),rest:J}}function XG(e,t){const n=Object.keys(e).filter(r=>r!=="base").sort((r,o)=>Uw(mt({size:r,sizes:t.breakpoints}))-Uw(mt({size:o,sizes:t.breakpoints})));return"base"in e?["base",...n]:n}function QG({value:e,theme:t,getValue:n,property:r}){if(e==null)return;if(typeof e=="object")return XG(e,t).reduce((i,l)=>{if(l==="base"&&e.base!==void 0){const p=n(e.base,t);return Array.isArray(r)?(r.forEach(m=>{i[m]=p}),i):(i[r]=p,i)}const u=n(e[l],t);return Array.isArray(r)?(i[t.fn.largerThan(l)]={},r.forEach(p=>{i[t.fn.largerThan(l)][p]=u}),i):(i[t.fn.largerThan(l)]={[r]:u},i)},{});const o=n(e,t);return Array.isArray(r)?r.reduce((s,i)=>(s[i]=o,s),{}):{[r]:o}}function YG(e,t){return e==="dimmed"?t.colorScheme==="dark"?t.colors.dark[2]:t.colors.gray[6]:t.fn.variant({variant:"filled",color:e,primaryFallback:!1}).background}function ZG(e){return Re(e)}function JG(e){return e}function eK(e,t){return mt({size:e,sizes:t.fontSizes})}const tK=["-xs","-sm","-md","-lg","-xl"];function nK(e,t){return tK.includes(e)?`calc(${mt({size:e.replace("-",""),sizes:t.spacing})} * -1)`:mt({size:e,sizes:t.spacing})}const rK={identity:JG,color:YG,size:ZG,fontSize:eK,spacing:nK},oK={m:{type:"spacing",property:"margin"},mt:{type:"spacing",property:"marginTop"},mb:{type:"spacing",property:"marginBottom"},ml:{type:"spacing",property:"marginLeft"},mr:{type:"spacing",property:"marginRight"},mx:{type:"spacing",property:["marginRight","marginLeft"]},my:{type:"spacing",property:["marginTop","marginBottom"]},p:{type:"spacing",property:"padding"},pt:{type:"spacing",property:"paddingTop"},pb:{type:"spacing",property:"paddingBottom"},pl:{type:"spacing",property:"paddingLeft"},pr:{type:"spacing",property:"paddingRight"},px:{type:"spacing",property:["paddingRight","paddingLeft"]},py:{type:"spacing",property:["paddingTop","paddingBottom"]},bg:{type:"color",property:"background"},c:{type:"color",property:"color"},opacity:{type:"identity",property:"opacity"},ff:{type:"identity",property:"fontFamily"},fz:{type:"fontSize",property:"fontSize"},fw:{type:"identity",property:"fontWeight"},lts:{type:"size",property:"letterSpacing"},ta:{type:"identity",property:"textAlign"},lh:{type:"identity",property:"lineHeight"},fs:{type:"identity",property:"fontStyle"},tt:{type:"identity",property:"textTransform"},td:{type:"identity",property:"textDecoration"},w:{type:"spacing",property:"width"},miw:{type:"spacing",property:"minWidth"},maw:{type:"spacing",property:"maxWidth"},h:{type:"spacing",property:"height"},mih:{type:"spacing",property:"minHeight"},mah:{type:"spacing",property:"maxHeight"},bgsz:{type:"size",property:"backgroundSize"},bgp:{type:"identity",property:"backgroundPosition"},bgr:{type:"identity",property:"backgroundRepeat"},bga:{type:"identity",property:"backgroundAttachment"},pos:{type:"identity",property:"position"},top:{type:"identity",property:"top"},left:{type:"size",property:"left"},bottom:{type:"size",property:"bottom"},right:{type:"size",property:"right"},inset:{type:"size",property:"inset"},display:{type:"identity",property:"display"}};var sK=Object.defineProperty,s4=Object.getOwnPropertySymbols,aK=Object.prototype.hasOwnProperty,iK=Object.prototype.propertyIsEnumerable,a4=(e,t,n)=>t in e?sK(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,i4=(e,t)=>{for(var n in t||(t={}))aK.call(t,n)&&a4(e,n,t[n]);if(s4)for(var n of s4(t))iK.call(t,n)&&a4(e,n,t[n]);return e};function l4(e,t,n=oK){return Object.keys(n).reduce((o,s)=>(s in e&&e[s]!==void 0&&o.push(QG({value:e[s],getValue:rK[n[s].type],property:n[s].property,theme:t})),o),[]).reduce((o,s)=>(Object.keys(s).forEach(i=>{typeof s[i]=="object"&&s[i]!==null&&i in o?o[i]=i4(i4({},o[i]),s[i]):o[i]=s[i]}),o),{})}function c4(e,t){return typeof e=="function"?e(t):e}function lK(e,t,n){const r=xa(),{css:o,cx:s}=AP();return Array.isArray(e)?s(n,o(l4(t,r)),e.map(i=>o(c4(i,r)))):s(n,o(c4(e,r)),o(l4(t,r)))}var cK=Object.defineProperty,pm=Object.getOwnPropertySymbols,HP=Object.prototype.hasOwnProperty,VP=Object.prototype.propertyIsEnumerable,u4=(e,t,n)=>t in e?cK(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,uK=(e,t)=>{for(var n in t||(t={}))HP.call(t,n)&&u4(e,n,t[n]);if(pm)for(var n of pm(t))VP.call(t,n)&&u4(e,n,t[n]);return e},dK=(e,t)=>{var n={};for(var r in e)HP.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&pm)for(var r of pm(e))t.indexOf(r)<0&&VP.call(e,r)&&(n[r]=e[r]);return n};const WP=d.forwardRef((e,t)=>{var n=e,{className:r,component:o,style:s,sx:i}=n,l=dK(n,["className","component","style","sx"]);const{systemStyles:u,rest:p}=eg(l),m=o||"div";return H.createElement(m,uK({ref:t,className:lK(i,u,r),style:s},p))});WP.displayName="@mantine/core/Box";const zr=WP;var fK=Object.defineProperty,pK=Object.defineProperties,mK=Object.getOwnPropertyDescriptors,d4=Object.getOwnPropertySymbols,hK=Object.prototype.hasOwnProperty,gK=Object.prototype.propertyIsEnumerable,f4=(e,t,n)=>t in e?fK(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,p4=(e,t)=>{for(var n in t||(t={}))hK.call(t,n)&&f4(e,n,t[n]);if(d4)for(var n of d4(t))gK.call(t,n)&&f4(e,n,t[n]);return e},vK=(e,t)=>pK(e,mK(t)),xK=fr(e=>({root:vK(p4(p4({},e.fn.focusStyles()),e.fn.fontStyles()),{cursor:"pointer",border:0,padding:0,appearance:"none",fontSize:e.fontSizes.md,backgroundColor:"transparent",textAlign:"left",color:e.colorScheme==="dark"?e.colors.dark[0]:e.black,textDecoration:"none",boxSizing:"border-box"})}));const bK=xK;var yK=Object.defineProperty,mm=Object.getOwnPropertySymbols,UP=Object.prototype.hasOwnProperty,GP=Object.prototype.propertyIsEnumerable,m4=(e,t,n)=>t in e?yK(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,CK=(e,t)=>{for(var n in t||(t={}))UP.call(t,n)&&m4(e,n,t[n]);if(mm)for(var n of mm(t))GP.call(t,n)&&m4(e,n,t[n]);return e},wK=(e,t)=>{var n={};for(var r in e)UP.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&mm)for(var r of mm(e))t.indexOf(r)<0&&GP.call(e,r)&&(n[r]=e[r]);return n};const KP=d.forwardRef((e,t)=>{const n=Rn("UnstyledButton",{},e),{className:r,component:o="button",unstyled:s,variant:i}=n,l=wK(n,["className","component","unstyled","variant"]),{classes:u,cx:p}=bK(null,{name:"UnstyledButton",unstyled:s,variant:i});return H.createElement(zr,CK({component:o,ref:t,className:p(u.root,r),type:o==="button"?"button":void 0},l))});KP.displayName="@mantine/core/UnstyledButton";const SK=KP;var kK=Object.defineProperty,jK=Object.defineProperties,_K=Object.getOwnPropertyDescriptors,h4=Object.getOwnPropertySymbols,IK=Object.prototype.hasOwnProperty,PK=Object.prototype.propertyIsEnumerable,g4=(e,t,n)=>t in e?kK(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,J1=(e,t)=>{for(var n in t||(t={}))IK.call(t,n)&&g4(e,n,t[n]);if(h4)for(var n of h4(t))PK.call(t,n)&&g4(e,n,t[n]);return e},v4=(e,t)=>jK(e,_K(t));const EK=["subtle","filled","outline","light","default","transparent","gradient"],ip={xs:Re(18),sm:Re(22),md:Re(28),lg:Re(34),xl:Re(44)};function MK({variant:e,theme:t,color:n,gradient:r}){const o=t.fn.variant({color:n,variant:e,gradient:r});return e==="gradient"?{border:0,backgroundImage:o.background,color:o.color,"&:hover":t.fn.hover({backgroundSize:"200%"})}:EK.includes(e)?J1({border:`${Re(1)} solid ${o.border}`,backgroundColor:o.background,color:o.color},t.fn.hover({backgroundColor:o.hover})):null}var OK=fr((e,{radius:t,color:n,gradient:r},{variant:o,size:s})=>({root:v4(J1({position:"relative",borderRadius:e.fn.radius(t),padding:0,lineHeight:1,display:"flex",alignItems:"center",justifyContent:"center",height:mt({size:s,sizes:ip}),minHeight:mt({size:s,sizes:ip}),width:mt({size:s,sizes:ip}),minWidth:mt({size:s,sizes:ip})},MK({variant:o,theme:e,color:n,gradient:r})),{"&:active":e.activeStyles,"& [data-action-icon-loader]":{maxWidth:"70%"},"&:disabled, &[data-disabled]":{color:e.colors.gray[e.colorScheme==="dark"?6:4],cursor:"not-allowed",backgroundColor:o==="transparent"?void 0:e.fn.themeColor("gray",e.colorScheme==="dark"?8:1),borderColor:o==="transparent"?void 0:e.fn.themeColor("gray",e.colorScheme==="dark"?8:1),backgroundImage:"none",pointerEvents:"none","&:active":{transform:"none"}},"&[data-loading]":{pointerEvents:"none","&::before":v4(J1({content:'""'},e.fn.cover(Re(-1))),{backgroundColor:e.colorScheme==="dark"?e.fn.rgba(e.colors.dark[7],.5):"rgba(255, 255, 255, .5)",borderRadius:e.fn.radius(t),cursor:"not-allowed"})}})}));const RK=OK;var DK=Object.defineProperty,hm=Object.getOwnPropertySymbols,qP=Object.prototype.hasOwnProperty,XP=Object.prototype.propertyIsEnumerable,x4=(e,t,n)=>t in e?DK(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,b4=(e,t)=>{for(var n in t||(t={}))qP.call(t,n)&&x4(e,n,t[n]);if(hm)for(var n of hm(t))XP.call(t,n)&&x4(e,n,t[n]);return e},y4=(e,t)=>{var n={};for(var r in e)qP.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&hm)for(var r of hm(e))t.indexOf(r)<0&&XP.call(e,r)&&(n[r]=e[r]);return n};function AK(e){var t=e,{size:n,color:r}=t,o=y4(t,["size","color"]);const s=o,{style:i}=s,l=y4(s,["style"]);return H.createElement("svg",b4({viewBox:"0 0 135 140",xmlns:"http://www.w3.org/2000/svg",fill:r,style:b4({width:n},i)},l),H.createElement("rect",{y:"10",width:"15",height:"120",rx:"6"},H.createElement("animate",{attributeName:"height",begin:"0.5s",dur:"1s",values:"120;110;100;90;80;70;60;50;40;140;120",calcMode:"linear",repeatCount:"indefinite"}),H.createElement("animate",{attributeName:"y",begin:"0.5s",dur:"1s",values:"10;15;20;25;30;35;40;45;50;0;10",calcMode:"linear",repeatCount:"indefinite"})),H.createElement("rect",{x:"30",y:"10",width:"15",height:"120",rx:"6"},H.createElement("animate",{attributeName:"height",begin:"0.25s",dur:"1s",values:"120;110;100;90;80;70;60;50;40;140;120",calcMode:"linear",repeatCount:"indefinite"}),H.createElement("animate",{attributeName:"y",begin:"0.25s",dur:"1s",values:"10;15;20;25;30;35;40;45;50;0;10",calcMode:"linear",repeatCount:"indefinite"})),H.createElement("rect",{x:"60",width:"15",height:"140",rx:"6"},H.createElement("animate",{attributeName:"height",begin:"0s",dur:"1s",values:"120;110;100;90;80;70;60;50;40;140;120",calcMode:"linear",repeatCount:"indefinite"}),H.createElement("animate",{attributeName:"y",begin:"0s",dur:"1s",values:"10;15;20;25;30;35;40;45;50;0;10",calcMode:"linear",repeatCount:"indefinite"})),H.createElement("rect",{x:"90",y:"10",width:"15",height:"120",rx:"6"},H.createElement("animate",{attributeName:"height",begin:"0.25s",dur:"1s",values:"120;110;100;90;80;70;60;50;40;140;120",calcMode:"linear",repeatCount:"indefinite"}),H.createElement("animate",{attributeName:"y",begin:"0.25s",dur:"1s",values:"10;15;20;25;30;35;40;45;50;0;10",calcMode:"linear",repeatCount:"indefinite"})),H.createElement("rect",{x:"120",y:"10",width:"15",height:"120",rx:"6"},H.createElement("animate",{attributeName:"height",begin:"0.5s",dur:"1s",values:"120;110;100;90;80;70;60;50;40;140;120",calcMode:"linear",repeatCount:"indefinite"}),H.createElement("animate",{attributeName:"y",begin:"0.5s",dur:"1s",values:"10;15;20;25;30;35;40;45;50;0;10",calcMode:"linear",repeatCount:"indefinite"})))}var TK=Object.defineProperty,gm=Object.getOwnPropertySymbols,QP=Object.prototype.hasOwnProperty,YP=Object.prototype.propertyIsEnumerable,C4=(e,t,n)=>t in e?TK(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,w4=(e,t)=>{for(var n in t||(t={}))QP.call(t,n)&&C4(e,n,t[n]);if(gm)for(var n of gm(t))YP.call(t,n)&&C4(e,n,t[n]);return e},S4=(e,t)=>{var n={};for(var r in e)QP.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&gm)for(var r of gm(e))t.indexOf(r)<0&&YP.call(e,r)&&(n[r]=e[r]);return n};function NK(e){var t=e,{size:n,color:r}=t,o=S4(t,["size","color"]);const s=o,{style:i}=s,l=S4(s,["style"]);return H.createElement("svg",w4({viewBox:"0 0 38 38",xmlns:"http://www.w3.org/2000/svg",stroke:r,style:w4({width:n,height:n},i)},l),H.createElement("g",{fill:"none",fillRule:"evenodd"},H.createElement("g",{transform:"translate(2.5 2.5)",strokeWidth:"5"},H.createElement("circle",{strokeOpacity:".5",cx:"16",cy:"16",r:"16"}),H.createElement("path",{d:"M32 16c0-9.94-8.06-16-16-16"},H.createElement("animateTransform",{attributeName:"transform",type:"rotate",from:"0 16 16",to:"360 16 16",dur:"1s",repeatCount:"indefinite"})))))}var $K=Object.defineProperty,vm=Object.getOwnPropertySymbols,ZP=Object.prototype.hasOwnProperty,JP=Object.prototype.propertyIsEnumerable,k4=(e,t,n)=>t in e?$K(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,j4=(e,t)=>{for(var n in t||(t={}))ZP.call(t,n)&&k4(e,n,t[n]);if(vm)for(var n of vm(t))JP.call(t,n)&&k4(e,n,t[n]);return e},_4=(e,t)=>{var n={};for(var r in e)ZP.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&vm)for(var r of vm(e))t.indexOf(r)<0&&JP.call(e,r)&&(n[r]=e[r]);return n};function LK(e){var t=e,{size:n,color:r}=t,o=_4(t,["size","color"]);const s=o,{style:i}=s,l=_4(s,["style"]);return H.createElement("svg",j4({viewBox:"0 0 120 30",xmlns:"http://www.w3.org/2000/svg",fill:r,style:j4({width:n},i)},l),H.createElement("circle",{cx:"15",cy:"15",r:"15"},H.createElement("animate",{attributeName:"r",from:"15",to:"15",begin:"0s",dur:"0.8s",values:"15;9;15",calcMode:"linear",repeatCount:"indefinite"}),H.createElement("animate",{attributeName:"fill-opacity",from:"1",to:"1",begin:"0s",dur:"0.8s",values:"1;.5;1",calcMode:"linear",repeatCount:"indefinite"})),H.createElement("circle",{cx:"60",cy:"15",r:"9",fillOpacity:"0.3"},H.createElement("animate",{attributeName:"r",from:"9",to:"9",begin:"0s",dur:"0.8s",values:"9;15;9",calcMode:"linear",repeatCount:"indefinite"}),H.createElement("animate",{attributeName:"fill-opacity",from:"0.5",to:"0.5",begin:"0s",dur:"0.8s",values:".5;1;.5",calcMode:"linear",repeatCount:"indefinite"})),H.createElement("circle",{cx:"105",cy:"15",r:"15"},H.createElement("animate",{attributeName:"r",from:"15",to:"15",begin:"0s",dur:"0.8s",values:"15;9;15",calcMode:"linear",repeatCount:"indefinite"}),H.createElement("animate",{attributeName:"fill-opacity",from:"1",to:"1",begin:"0s",dur:"0.8s",values:"1;.5;1",calcMode:"linear",repeatCount:"indefinite"})))}var zK=Object.defineProperty,xm=Object.getOwnPropertySymbols,e6=Object.prototype.hasOwnProperty,t6=Object.prototype.propertyIsEnumerable,I4=(e,t,n)=>t in e?zK(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,FK=(e,t)=>{for(var n in t||(t={}))e6.call(t,n)&&I4(e,n,t[n]);if(xm)for(var n of xm(t))t6.call(t,n)&&I4(e,n,t[n]);return e},BK=(e,t)=>{var n={};for(var r in e)e6.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&xm)for(var r of xm(e))t.indexOf(r)<0&&t6.call(e,r)&&(n[r]=e[r]);return n};const _v={bars:AK,oval:NK,dots:LK},HK={xs:Re(18),sm:Re(22),md:Re(36),lg:Re(44),xl:Re(58)},VK={size:"md"};function n6(e){const t=Rn("Loader",VK,e),{size:n,color:r,variant:o}=t,s=BK(t,["size","color","variant"]),i=xa(),l=o in _v?o:i.loader;return H.createElement(zr,FK({role:"presentation",component:_v[l]||_v.bars,size:mt({size:n,sizes:HK}),color:i.fn.variant({variant:"filled",primaryFallback:!1,color:r||i.primaryColor}).background},s))}n6.displayName="@mantine/core/Loader";var WK=Object.defineProperty,bm=Object.getOwnPropertySymbols,r6=Object.prototype.hasOwnProperty,o6=Object.prototype.propertyIsEnumerable,P4=(e,t,n)=>t in e?WK(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,E4=(e,t)=>{for(var n in t||(t={}))r6.call(t,n)&&P4(e,n,t[n]);if(bm)for(var n of bm(t))o6.call(t,n)&&P4(e,n,t[n]);return e},UK=(e,t)=>{var n={};for(var r in e)r6.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&bm)for(var r of bm(e))t.indexOf(r)<0&&o6.call(e,r)&&(n[r]=e[r]);return n};const GK={color:"gray",size:"md",variant:"subtle"},s6=d.forwardRef((e,t)=>{const n=Rn("ActionIcon",GK,e),{className:r,color:o,children:s,radius:i,size:l,variant:u,gradient:p,disabled:m,loaderProps:h,loading:g,unstyled:x,__staticSelector:y}=n,b=UK(n,["className","color","children","radius","size","variant","gradient","disabled","loaderProps","loading","unstyled","__staticSelector"]),{classes:w,cx:S,theme:j}=RK({radius:i,color:o,gradient:p},{name:["ActionIcon",y],unstyled:x,size:l,variant:u}),_=H.createElement(n6,E4({color:j.fn.variant({color:o,variant:u}).color,size:"100%","data-action-icon-loader":!0},h));return H.createElement(SK,E4({className:S(w.root,r),ref:t,disabled:m,"data-disabled":m||void 0,"data-loading":g||void 0,unstyled:x},b),g?_:s)});s6.displayName="@mantine/core/ActionIcon";const KK=s6;var qK=Object.defineProperty,XK=Object.defineProperties,QK=Object.getOwnPropertyDescriptors,ym=Object.getOwnPropertySymbols,a6=Object.prototype.hasOwnProperty,i6=Object.prototype.propertyIsEnumerable,M4=(e,t,n)=>t in e?qK(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,YK=(e,t)=>{for(var n in t||(t={}))a6.call(t,n)&&M4(e,n,t[n]);if(ym)for(var n of ym(t))i6.call(t,n)&&M4(e,n,t[n]);return e},ZK=(e,t)=>XK(e,QK(t)),JK=(e,t)=>{var n={};for(var r in e)a6.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&ym)for(var r of ym(e))t.indexOf(r)<0&&i6.call(e,r)&&(n[r]=e[r]);return n};function l6(e){const t=Rn("Portal",{},e),{children:n,target:r,className:o,innerRef:s}=t,i=JK(t,["children","target","className","innerRef"]),l=xa(),[u,p]=d.useState(!1),m=d.useRef();return TP(()=>(p(!0),m.current=r?typeof r=="string"?document.querySelector(r):r:document.createElement("div"),r||document.body.appendChild(m.current),()=>{!r&&document.body.removeChild(m.current)}),[r]),u?qr.createPortal(H.createElement("div",ZK(YK({className:o,dir:l.dir},i),{ref:s}),n),m.current):null}l6.displayName="@mantine/core/Portal";var eq=Object.defineProperty,Cm=Object.getOwnPropertySymbols,c6=Object.prototype.hasOwnProperty,u6=Object.prototype.propertyIsEnumerable,O4=(e,t,n)=>t in e?eq(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,tq=(e,t)=>{for(var n in t||(t={}))c6.call(t,n)&&O4(e,n,t[n]);if(Cm)for(var n of Cm(t))u6.call(t,n)&&O4(e,n,t[n]);return e},nq=(e,t)=>{var n={};for(var r in e)c6.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Cm)for(var r of Cm(e))t.indexOf(r)<0&&u6.call(e,r)&&(n[r]=e[r]);return n};function d6(e){var t=e,{withinPortal:n=!0,children:r}=t,o=nq(t,["withinPortal","children"]);return n?H.createElement(l6,tq({},o),r):H.createElement(H.Fragment,null,r)}d6.displayName="@mantine/core/OptionalPortal";var rq=Object.defineProperty,wm=Object.getOwnPropertySymbols,f6=Object.prototype.hasOwnProperty,p6=Object.prototype.propertyIsEnumerable,R4=(e,t,n)=>t in e?rq(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,D4=(e,t)=>{for(var n in t||(t={}))f6.call(t,n)&&R4(e,n,t[n]);if(wm)for(var n of wm(t))p6.call(t,n)&&R4(e,n,t[n]);return e},oq=(e,t)=>{var n={};for(var r in e)f6.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&wm)for(var r of wm(e))t.indexOf(r)<0&&p6.call(e,r)&&(n[r]=e[r]);return n};function m6(e){const t=e,{width:n,height:r,style:o}=t,s=oq(t,["width","height","style"]);return H.createElement("svg",D4({viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:D4({width:n,height:r},o)},s),H.createElement("path",{d:"M11.7816 4.03157C12.0062 3.80702 12.0062 3.44295 11.7816 3.2184C11.5571 2.99385 11.193 2.99385 10.9685 3.2184L7.50005 6.68682L4.03164 3.2184C3.80708 2.99385 3.44301 2.99385 3.21846 3.2184C2.99391 3.44295 2.99391 3.80702 3.21846 4.03157L6.68688 7.49999L3.21846 10.9684C2.99391 11.193 2.99391 11.557 3.21846 11.7816C3.44301 12.0061 3.80708 12.0061 4.03164 11.7816L7.50005 8.31316L10.9685 11.7816C11.193 12.0061 11.5571 12.0061 11.7816 11.7816C12.0062 11.557 12.0062 11.193 11.7816 10.9684L8.31322 7.49999L11.7816 4.03157Z",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd"}))}m6.displayName="@mantine/core/CloseIcon";var sq=Object.defineProperty,Sm=Object.getOwnPropertySymbols,h6=Object.prototype.hasOwnProperty,g6=Object.prototype.propertyIsEnumerable,A4=(e,t,n)=>t in e?sq(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,aq=(e,t)=>{for(var n in t||(t={}))h6.call(t,n)&&A4(e,n,t[n]);if(Sm)for(var n of Sm(t))g6.call(t,n)&&A4(e,n,t[n]);return e},iq=(e,t)=>{var n={};for(var r in e)h6.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Sm)for(var r of Sm(e))t.indexOf(r)<0&&g6.call(e,r)&&(n[r]=e[r]);return n};const lq={xs:Re(12),sm:Re(16),md:Re(20),lg:Re(28),xl:Re(34)},cq={size:"sm"},v6=d.forwardRef((e,t)=>{const n=Rn("CloseButton",cq,e),{iconSize:r,size:o,children:s}=n,i=iq(n,["iconSize","size","children"]),l=Re(r||lq[o]);return H.createElement(KK,aq({ref:t,__staticSelector:"CloseButton",size:o},i),s||H.createElement(m6,{width:l,height:l}))});v6.displayName="@mantine/core/CloseButton";const x6=v6;var uq=Object.defineProperty,dq=Object.defineProperties,fq=Object.getOwnPropertyDescriptors,T4=Object.getOwnPropertySymbols,pq=Object.prototype.hasOwnProperty,mq=Object.prototype.propertyIsEnumerable,N4=(e,t,n)=>t in e?uq(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,lp=(e,t)=>{for(var n in t||(t={}))pq.call(t,n)&&N4(e,n,t[n]);if(T4)for(var n of T4(t))mq.call(t,n)&&N4(e,n,t[n]);return e},hq=(e,t)=>dq(e,fq(t));function gq({underline:e,strikethrough:t}){const n=[];return e&&n.push("underline"),t&&n.push("line-through"),n.length>0?n.join(" "):"none"}function vq({theme:e,color:t}){return t==="dimmed"?e.fn.dimmed():typeof t=="string"&&(t in e.colors||t.split(".")[0]in e.colors)?e.fn.variant({variant:"filled",color:t}).background:t||"inherit"}function xq(e){return typeof e=="number"?{overflow:"hidden",textOverflow:"ellipsis",display:"-webkit-box",WebkitLineClamp:e,WebkitBoxOrient:"vertical"}:null}function bq({theme:e,truncate:t}){return t==="start"?{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",direction:e.dir==="ltr"?"rtl":"ltr",textAlign:e.dir==="ltr"?"right":"left"}:t?{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}:null}var yq=fr((e,{color:t,lineClamp:n,truncate:r,inline:o,inherit:s,underline:i,gradient:l,weight:u,transform:p,align:m,strikethrough:h,italic:g},{size:x})=>{const y=e.fn.variant({variant:"gradient",gradient:l});return{root:hq(lp(lp(lp(lp({},e.fn.fontStyles()),e.fn.focusStyles()),xq(n)),bq({theme:e,truncate:r})),{color:vq({color:t,theme:e}),fontFamily:s?"inherit":e.fontFamily,fontSize:s||x===void 0?"inherit":mt({size:x,sizes:e.fontSizes}),lineHeight:s?"inherit":o?1:e.lineHeight,textDecoration:gq({underline:i,strikethrough:h}),WebkitTapHighlightColor:"transparent",fontWeight:s?"inherit":u,textTransform:p,textAlign:m,fontStyle:g?"italic":void 0}),gradient:{backgroundImage:y.background,WebkitBackgroundClip:"text",WebkitTextFillColor:"transparent"}}});const Cq=yq;var wq=Object.defineProperty,km=Object.getOwnPropertySymbols,b6=Object.prototype.hasOwnProperty,y6=Object.prototype.propertyIsEnumerable,$4=(e,t,n)=>t in e?wq(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Sq=(e,t)=>{for(var n in t||(t={}))b6.call(t,n)&&$4(e,n,t[n]);if(km)for(var n of km(t))y6.call(t,n)&&$4(e,n,t[n]);return e},kq=(e,t)=>{var n={};for(var r in e)b6.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&km)for(var r of km(e))t.indexOf(r)<0&&y6.call(e,r)&&(n[r]=e[r]);return n};const jq={variant:"text"},C6=d.forwardRef((e,t)=>{const n=Rn("Text",jq,e),{className:r,size:o,weight:s,transform:i,color:l,align:u,variant:p,lineClamp:m,truncate:h,gradient:g,inline:x,inherit:y,underline:b,strikethrough:w,italic:S,classNames:j,styles:_,unstyled:E,span:I,__staticSelector:M}=n,R=kq(n,["className","size","weight","transform","color","align","variant","lineClamp","truncate","gradient","inline","inherit","underline","strikethrough","italic","classNames","styles","unstyled","span","__staticSelector"]),{classes:D,cx:A}=Cq({color:l,lineClamp:m,truncate:h,inline:x,inherit:y,underline:b,strikethrough:w,italic:S,weight:s,transform:i,align:u,gradient:g},{unstyled:E,name:M||"Text",variant:p,size:o});return H.createElement(zr,Sq({ref:t,className:A(D.root,{[D.gradient]:p==="gradient"},r),component:I?"span":"div"},R))});C6.displayName="@mantine/core/Text";const wc=C6,cp={xs:Re(1),sm:Re(2),md:Re(3),lg:Re(4),xl:Re(5)};function up(e,t){const n=e.fn.variant({variant:"outline",color:t}).border;return typeof t=="string"&&(t in e.colors||t.split(".")[0]in e.colors)?n:t===void 0?e.colorScheme==="dark"?e.colors.dark[4]:e.colors.gray[4]:t}var _q=fr((e,{color:t},{size:n,variant:r})=>({root:{},withLabel:{borderTop:"0 !important"},left:{"&::before":{display:"none"}},right:{"&::after":{display:"none"}},label:{display:"flex",alignItems:"center","&::before":{content:'""',flex:1,height:Re(1),borderTop:`${mt({size:n,sizes:cp})} ${r} ${up(e,t)}`,marginRight:e.spacing.xs},"&::after":{content:'""',flex:1,borderTop:`${mt({size:n,sizes:cp})} ${r} ${up(e,t)}`,marginLeft:e.spacing.xs}},labelDefaultStyles:{color:t==="dark"?e.colors.dark[1]:e.fn.themeColor(t,e.colorScheme==="dark"?5:e.fn.primaryShade(),!1)},horizontal:{border:0,borderTopWidth:Re(mt({size:n,sizes:cp})),borderTopColor:up(e,t),borderTopStyle:r,margin:0},vertical:{border:0,alignSelf:"stretch",height:"auto",borderLeftWidth:Re(mt({size:n,sizes:cp})),borderLeftColor:up(e,t),borderLeftStyle:r}}));const Iq=_q;var Pq=Object.defineProperty,Eq=Object.defineProperties,Mq=Object.getOwnPropertyDescriptors,jm=Object.getOwnPropertySymbols,w6=Object.prototype.hasOwnProperty,S6=Object.prototype.propertyIsEnumerable,L4=(e,t,n)=>t in e?Pq(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,z4=(e,t)=>{for(var n in t||(t={}))w6.call(t,n)&&L4(e,n,t[n]);if(jm)for(var n of jm(t))S6.call(t,n)&&L4(e,n,t[n]);return e},Oq=(e,t)=>Eq(e,Mq(t)),Rq=(e,t)=>{var n={};for(var r in e)w6.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&jm)for(var r of jm(e))t.indexOf(r)<0&&S6.call(e,r)&&(n[r]=e[r]);return n};const Dq={orientation:"horizontal",size:"xs",labelPosition:"left",variant:"solid"},ex=d.forwardRef((e,t)=>{const n=Rn("Divider",Dq,e),{className:r,color:o,orientation:s,size:i,label:l,labelPosition:u,labelProps:p,variant:m,styles:h,classNames:g,unstyled:x}=n,y=Rq(n,["className","color","orientation","size","label","labelPosition","labelProps","variant","styles","classNames","unstyled"]),{classes:b,cx:w}=Iq({color:o},{classNames:g,styles:h,unstyled:x,name:"Divider",variant:m,size:i}),S=s==="vertical",j=s==="horizontal",_=!!l&&j,E=!(p!=null&&p.color);return H.createElement(zr,z4({ref:t,className:w(b.root,{[b.vertical]:S,[b.horizontal]:j,[b.withLabel]:_},r),role:"separator"},y),_&&H.createElement(wc,Oq(z4({},p),{size:(p==null?void 0:p.size)||"xs",mt:Re(2),className:w(b.label,b[u],{[b.labelDefaultStyles]:E})}),l))});ex.displayName="@mantine/core/Divider";var Aq=Object.defineProperty,Tq=Object.defineProperties,Nq=Object.getOwnPropertyDescriptors,F4=Object.getOwnPropertySymbols,$q=Object.prototype.hasOwnProperty,Lq=Object.prototype.propertyIsEnumerable,B4=(e,t,n)=>t in e?Aq(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,H4=(e,t)=>{for(var n in t||(t={}))$q.call(t,n)&&B4(e,n,t[n]);if(F4)for(var n of F4(t))Lq.call(t,n)&&B4(e,n,t[n]);return e},zq=(e,t)=>Tq(e,Nq(t)),Fq=fr((e,t,{size:n})=>({item:zq(H4({},e.fn.fontStyles()),{boxSizing:"border-box",wordBreak:"break-all",textAlign:"left",width:"100%",padding:`calc(${mt({size:n,sizes:e.spacing})} / 1.5) ${mt({size:n,sizes:e.spacing})}`,cursor:"pointer",fontSize:mt({size:n,sizes:e.fontSizes}),color:e.colorScheme==="dark"?e.colors.dark[0]:e.black,borderRadius:e.fn.radius(),"&[data-hovered]":{backgroundColor:e.colorScheme==="dark"?e.colors.dark[4]:e.colors.gray[1]},"&[data-selected]":H4({backgroundColor:e.fn.variant({variant:"filled"}).background,color:e.fn.variant({variant:"filled"}).color},e.fn.hover({backgroundColor:e.fn.variant({variant:"filled"}).hover})),"&[data-disabled]":{cursor:"default",color:e.colors.dark[2]}}),nothingFound:{boxSizing:"border-box",color:e.colors.gray[6],paddingTop:`calc(${mt({size:n,sizes:e.spacing})} / 2)`,paddingBottom:`calc(${mt({size:n,sizes:e.spacing})} / 2)`,textAlign:"center"},separator:{boxSizing:"border-box",textAlign:"left",width:"100%",padding:`calc(${mt({size:n,sizes:e.spacing})} / 1.5) ${mt({size:n,sizes:e.spacing})}`},separatorLabel:{color:e.colorScheme==="dark"?e.colors.dark[3]:e.colors.gray[5]}}));const Bq=Fq;var Hq=Object.defineProperty,V4=Object.getOwnPropertySymbols,Vq=Object.prototype.hasOwnProperty,Wq=Object.prototype.propertyIsEnumerable,W4=(e,t,n)=>t in e?Hq(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Uq=(e,t)=>{for(var n in t||(t={}))Vq.call(t,n)&&W4(e,n,t[n]);if(V4)for(var n of V4(t))Wq.call(t,n)&&W4(e,n,t[n]);return e};function ty({data:e,hovered:t,classNames:n,styles:r,isItemSelected:o,uuid:s,__staticSelector:i,onItemHover:l,onItemSelect:u,itemsRefs:p,itemComponent:m,size:h,nothingFound:g,creatable:x,createLabel:y,unstyled:b,variant:w}){const{classes:S}=Bq(null,{classNames:n,styles:r,unstyled:b,name:i,variant:w,size:h}),j=[],_=[];let E=null;const I=(R,D)=>{const A=typeof o=="function"?o(R.value):!1;return H.createElement(m,Uq({key:R.value,className:S.item,"data-disabled":R.disabled||void 0,"data-hovered":!R.disabled&&t===D||void 0,"data-selected":!R.disabled&&A||void 0,selected:A,onMouseEnter:()=>l(D),id:`${s}-${D}`,role:"option",tabIndex:-1,"aria-selected":t===D,ref:O=>{p&&p.current&&(p.current[R.value]=O)},onMouseDown:R.disabled?null:O=>{O.preventDefault(),u(R)},disabled:R.disabled,variant:w},R))};let M=null;if(e.forEach((R,D)=>{R.creatable?E=D:R.group?(M!==R.group&&(M=R.group,_.push(H.createElement("div",{className:S.separator,key:`__mantine-divider-${D}`},H.createElement(ex,{classNames:{label:S.separatorLabel},label:R.group})))),_.push(I(R,D))):j.push(I(R,D))}),x){const R=e[E];j.push(H.createElement("div",{key:Jb(),className:S.item,"data-hovered":t===E||void 0,onMouseEnter:()=>l(E),onMouseDown:D=>{D.preventDefault(),u(R)},tabIndex:-1,ref:D=>{p&&p.current&&(p.current[R.value]=D)}},y))}return _.length>0&&j.length>0&&j.unshift(H.createElement("div",{className:S.separator,key:"empty-group-separator"},H.createElement(ex,null))),_.length>0||j.length>0?H.createElement(H.Fragment,null,_,j):H.createElement(wc,{size:h,unstyled:b,className:S.nothingFound},g)}ty.displayName="@mantine/core/SelectItems";var Gq=Object.defineProperty,_m=Object.getOwnPropertySymbols,k6=Object.prototype.hasOwnProperty,j6=Object.prototype.propertyIsEnumerable,U4=(e,t,n)=>t in e?Gq(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Kq=(e,t)=>{for(var n in t||(t={}))k6.call(t,n)&&U4(e,n,t[n]);if(_m)for(var n of _m(t))j6.call(t,n)&&U4(e,n,t[n]);return e},qq=(e,t)=>{var n={};for(var r in e)k6.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&_m)for(var r of _m(e))t.indexOf(r)<0&&j6.call(e,r)&&(n[r]=e[r]);return n};const ny=d.forwardRef((e,t)=>{var n=e,{label:r,value:o}=n,s=qq(n,["label","value"]);return H.createElement("div",Kq({ref:t},s),r||o)});ny.displayName="@mantine/core/DefaultItem";function Xq(e,t){typeof e=="function"?e(t):e!=null&&(e.current=t)}function _6(...e){return t=>e.forEach(n=>Xq(n,t))}function al(...e){return d.useCallback(_6(...e),e)}const I6=d.forwardRef((e,t)=>{const{children:n,...r}=e,o=d.Children.toArray(n),s=o.find(Yq);if(s){const i=s.props.children,l=o.map(u=>u===s?d.Children.count(i)>1?d.Children.only(null):d.isValidElement(i)?i.props.children:null:u);return d.createElement(tx,pn({},r,{ref:t}),d.isValidElement(i)?d.cloneElement(i,void 0,l):null)}return d.createElement(tx,pn({},r,{ref:t}),n)});I6.displayName="Slot";const tx=d.forwardRef((e,t)=>{const{children:n,...r}=e;return d.isValidElement(n)?d.cloneElement(n,{...Zq(r,n.props),ref:_6(t,n.ref)}):d.Children.count(n)>1?d.Children.only(null):null});tx.displayName="SlotClone";const Qq=({children:e})=>d.createElement(d.Fragment,null,e);function Yq(e){return d.isValidElement(e)&&e.type===Qq}function Zq(e,t){const n={...t};for(const r in t){const o=e[r],s=t[r];/^on[A-Z]/.test(r)?o&&s?n[r]=(...l)=>{s(...l),o(...l)}:o&&(n[r]=o):r==="style"?n[r]={...o,...s}:r==="className"&&(n[r]=[o,s].filter(Boolean).join(" "))}return{...e,...n}}const Jq=["a","button","div","h2","h3","img","label","li","nav","ol","p","span","svg","ul"],Hd=Jq.reduce((e,t)=>{const n=d.forwardRef((r,o)=>{const{asChild:s,...i}=r,l=s?I6:t;return d.useEffect(()=>{window[Symbol.for("radix-ui")]=!0},[]),d.createElement(l,pn({},i,{ref:o}))});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{}),nx=globalThis!=null&&globalThis.document?d.useLayoutEffect:()=>{};function eX(e,t){return d.useReducer((n,r)=>{const o=t[n][r];return o??n},e)}const Vd=e=>{const{present:t,children:n}=e,r=tX(t),o=typeof n=="function"?n({present:r.isPresent}):d.Children.only(n),s=al(r.ref,o.ref);return typeof n=="function"||r.isPresent?d.cloneElement(o,{ref:s}):null};Vd.displayName="Presence";function tX(e){const[t,n]=d.useState(),r=d.useRef({}),o=d.useRef(e),s=d.useRef("none"),i=e?"mounted":"unmounted",[l,u]=eX(i,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return d.useEffect(()=>{const p=dp(r.current);s.current=l==="mounted"?p:"none"},[l]),nx(()=>{const p=r.current,m=o.current;if(m!==e){const g=s.current,x=dp(p);e?u("MOUNT"):x==="none"||(p==null?void 0:p.display)==="none"?u("UNMOUNT"):u(m&&g!==x?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,u]),nx(()=>{if(t){const p=h=>{const x=dp(r.current).includes(h.animationName);h.target===t&&x&&qr.flushSync(()=>u("ANIMATION_END"))},m=h=>{h.target===t&&(s.current=dp(r.current))};return t.addEventListener("animationstart",m),t.addEventListener("animationcancel",p),t.addEventListener("animationend",p),()=>{t.removeEventListener("animationstart",m),t.removeEventListener("animationcancel",p),t.removeEventListener("animationend",p)}}else u("ANIMATION_END")},[t,u]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:d.useCallback(p=>{p&&(r.current=getComputedStyle(p)),n(p)},[])}}function dp(e){return(e==null?void 0:e.animationName)||"none"}function nX(e,t=[]){let n=[];function r(s,i){const l=d.createContext(i),u=n.length;n=[...n,i];function p(h){const{scope:g,children:x,...y}=h,b=(g==null?void 0:g[e][u])||l,w=d.useMemo(()=>y,Object.values(y));return d.createElement(b.Provider,{value:w},x)}function m(h,g){const x=(g==null?void 0:g[e][u])||l,y=d.useContext(x);if(y)return y;if(i!==void 0)return i;throw new Error(`\`${h}\` must be used within \`${s}\``)}return p.displayName=s+"Provider",[p,m]}const o=()=>{const s=n.map(i=>d.createContext(i));return function(l){const u=(l==null?void 0:l[e])||s;return d.useMemo(()=>({[`__scope${e}`]:{...l,[e]:u}}),[l,u])}};return o.scopeName=e,[r,rX(o,...t)]}function rX(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(s){const i=r.reduce((l,{useScope:u,scopeName:p})=>{const h=u(s)[`__scope${p}`];return{...l,...h}},{});return d.useMemo(()=>({[`__scope${t.scopeName}`]:i}),[i])}};return n.scopeName=t.scopeName,n}function Ii(e){const t=d.useRef(e);return d.useEffect(()=>{t.current=e}),d.useMemo(()=>(...n)=>{var r;return(r=t.current)===null||r===void 0?void 0:r.call(t,...n)},[])}const oX=d.createContext(void 0);function sX(e){const t=d.useContext(oX);return e||t||"ltr"}function aX(e,[t,n]){return Math.min(n,Math.max(t,e))}function Ti(e,t,{checkForDefaultPrevented:n=!0}={}){return function(o){if(e==null||e(o),n===!1||!o.defaultPrevented)return t==null?void 0:t(o)}}function iX(e,t){return d.useReducer((n,r)=>{const o=t[n][r];return o??n},e)}const P6="ScrollArea",[E6,E1e]=nX(P6),[lX,_o]=E6(P6),cX=d.forwardRef((e,t)=>{const{__scopeScrollArea:n,type:r="hover",dir:o,scrollHideDelay:s=600,...i}=e,[l,u]=d.useState(null),[p,m]=d.useState(null),[h,g]=d.useState(null),[x,y]=d.useState(null),[b,w]=d.useState(null),[S,j]=d.useState(0),[_,E]=d.useState(0),[I,M]=d.useState(!1),[R,D]=d.useState(!1),A=al(t,T=>u(T)),O=sX(o);return d.createElement(lX,{scope:n,type:r,dir:O,scrollHideDelay:s,scrollArea:l,viewport:p,onViewportChange:m,content:h,onContentChange:g,scrollbarX:x,onScrollbarXChange:y,scrollbarXEnabled:I,onScrollbarXEnabledChange:M,scrollbarY:b,onScrollbarYChange:w,scrollbarYEnabled:R,onScrollbarYEnabledChange:D,onCornerWidthChange:j,onCornerHeightChange:E},d.createElement(Hd.div,pn({dir:O},i,{ref:A,style:{position:"relative","--radix-scroll-area-corner-width":S+"px","--radix-scroll-area-corner-height":_+"px",...e.style}})))}),uX="ScrollAreaViewport",dX=d.forwardRef((e,t)=>{const{__scopeScrollArea:n,children:r,...o}=e,s=_o(uX,n),i=d.useRef(null),l=al(t,i,s.onViewportChange);return d.createElement(d.Fragment,null,d.createElement("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}"}}),d.createElement(Hd.div,pn({"data-radix-scroll-area-viewport":""},o,{ref:l,style:{overflowX:s.scrollbarXEnabled?"scroll":"hidden",overflowY:s.scrollbarYEnabled?"scroll":"hidden",...e.style}}),d.createElement("div",{ref:s.onContentChange,style:{minWidth:"100%",display:"table"}},r)))}),ya="ScrollAreaScrollbar",fX=d.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=_o(ya,e.__scopeScrollArea),{onScrollbarXEnabledChange:s,onScrollbarYEnabledChange:i}=o,l=e.orientation==="horizontal";return d.useEffect(()=>(l?s(!0):i(!0),()=>{l?s(!1):i(!1)}),[l,s,i]),o.type==="hover"?d.createElement(pX,pn({},r,{ref:t,forceMount:n})):o.type==="scroll"?d.createElement(mX,pn({},r,{ref:t,forceMount:n})):o.type==="auto"?d.createElement(M6,pn({},r,{ref:t,forceMount:n})):o.type==="always"?d.createElement(ry,pn({},r,{ref:t})):null}),pX=d.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=_o(ya,e.__scopeScrollArea),[s,i]=d.useState(!1);return d.useEffect(()=>{const l=o.scrollArea;let u=0;if(l){const p=()=>{window.clearTimeout(u),i(!0)},m=()=>{u=window.setTimeout(()=>i(!1),o.scrollHideDelay)};return l.addEventListener("pointerenter",p),l.addEventListener("pointerleave",m),()=>{window.clearTimeout(u),l.removeEventListener("pointerenter",p),l.removeEventListener("pointerleave",m)}}},[o.scrollArea,o.scrollHideDelay]),d.createElement(Vd,{present:n||s},d.createElement(M6,pn({"data-state":s?"visible":"hidden"},r,{ref:t})))}),mX=d.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=_o(ya,e.__scopeScrollArea),s=e.orientation==="horizontal",i=ng(()=>u("SCROLL_END"),100),[l,u]=iX("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 d.useEffect(()=>{if(l==="idle"){const p=window.setTimeout(()=>u("HIDE"),o.scrollHideDelay);return()=>window.clearTimeout(p)}},[l,o.scrollHideDelay,u]),d.useEffect(()=>{const p=o.viewport,m=s?"scrollLeft":"scrollTop";if(p){let h=p[m];const g=()=>{const x=p[m];h!==x&&(u("SCROLL"),i()),h=x};return p.addEventListener("scroll",g),()=>p.removeEventListener("scroll",g)}},[o.viewport,s,u,i]),d.createElement(Vd,{present:n||l!=="hidden"},d.createElement(ry,pn({"data-state":l==="hidden"?"hidden":"visible"},r,{ref:t,onPointerEnter:Ti(e.onPointerEnter,()=>u("POINTER_ENTER")),onPointerLeave:Ti(e.onPointerLeave,()=>u("POINTER_LEAVE"))})))}),M6=d.forwardRef((e,t)=>{const n=_o(ya,e.__scopeScrollArea),{forceMount:r,...o}=e,[s,i]=d.useState(!1),l=e.orientation==="horizontal",u=ng(()=>{if(n.viewport){const p=n.viewport.offsetWidth{const{orientation:n="vertical",...r}=e,o=_o(ya,e.__scopeScrollArea),s=d.useRef(null),i=d.useRef(0),[l,u]=d.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),p=A6(l.viewport,l.content),m={...r,sizes:l,onSizesChange:u,hasThumb:p>0&&p<1,onThumbChange:g=>s.current=g,onThumbPointerUp:()=>i.current=0,onThumbPointerDown:g=>i.current=g};function h(g,x){return wX(g,i.current,l,x)}return n==="horizontal"?d.createElement(hX,pn({},m,{ref:t,onThumbPositionChange:()=>{if(o.viewport&&s.current){const g=o.viewport.scrollLeft,x=G4(g,l,o.dir);s.current.style.transform=`translate3d(${x}px, 0, 0)`}},onWheelScroll:g=>{o.viewport&&(o.viewport.scrollLeft=g)},onDragScroll:g=>{o.viewport&&(o.viewport.scrollLeft=h(g,o.dir))}})):n==="vertical"?d.createElement(gX,pn({},m,{ref:t,onThumbPositionChange:()=>{if(o.viewport&&s.current){const g=o.viewport.scrollTop,x=G4(g,l);s.current.style.transform=`translate3d(0, ${x}px, 0)`}},onWheelScroll:g=>{o.viewport&&(o.viewport.scrollTop=g)},onDragScroll:g=>{o.viewport&&(o.viewport.scrollTop=h(g))}})):null}),hX=d.forwardRef((e,t)=>{const{sizes:n,onSizesChange:r,...o}=e,s=_o(ya,e.__scopeScrollArea),[i,l]=d.useState(),u=d.useRef(null),p=al(t,u,s.onScrollbarXChange);return d.useEffect(()=>{u.current&&l(getComputedStyle(u.current))},[u]),d.createElement(R6,pn({"data-orientation":"horizontal"},o,{ref:p,sizes:n,style:{bottom:0,left:s.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:s.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":tg(n)+"px",...e.style},onThumbPointerDown:m=>e.onThumbPointerDown(m.x),onDragScroll:m=>e.onDragScroll(m.x),onWheelScroll:(m,h)=>{if(s.viewport){const g=s.viewport.scrollLeft+m.deltaX;e.onWheelScroll(g),N6(g,h)&&m.preventDefault()}},onResize:()=>{u.current&&s.viewport&&i&&r({content:s.viewport.scrollWidth,viewport:s.viewport.offsetWidth,scrollbar:{size:u.current.clientWidth,paddingStart:Im(i.paddingLeft),paddingEnd:Im(i.paddingRight)}})}}))}),gX=d.forwardRef((e,t)=>{const{sizes:n,onSizesChange:r,...o}=e,s=_o(ya,e.__scopeScrollArea),[i,l]=d.useState(),u=d.useRef(null),p=al(t,u,s.onScrollbarYChange);return d.useEffect(()=>{u.current&&l(getComputedStyle(u.current))},[u]),d.createElement(R6,pn({"data-orientation":"vertical"},o,{ref:p,sizes:n,style:{top:0,right:s.dir==="ltr"?0:void 0,left:s.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":tg(n)+"px",...e.style},onThumbPointerDown:m=>e.onThumbPointerDown(m.y),onDragScroll:m=>e.onDragScroll(m.y),onWheelScroll:(m,h)=>{if(s.viewport){const g=s.viewport.scrollTop+m.deltaY;e.onWheelScroll(g),N6(g,h)&&m.preventDefault()}},onResize:()=>{u.current&&s.viewport&&i&&r({content:s.viewport.scrollHeight,viewport:s.viewport.offsetHeight,scrollbar:{size:u.current.clientHeight,paddingStart:Im(i.paddingTop),paddingEnd:Im(i.paddingBottom)}})}}))}),[vX,O6]=E6(ya),R6=d.forwardRef((e,t)=>{const{__scopeScrollArea:n,sizes:r,hasThumb:o,onThumbChange:s,onThumbPointerUp:i,onThumbPointerDown:l,onThumbPositionChange:u,onDragScroll:p,onWheelScroll:m,onResize:h,...g}=e,x=_o(ya,n),[y,b]=d.useState(null),w=al(t,A=>b(A)),S=d.useRef(null),j=d.useRef(""),_=x.viewport,E=r.content-r.viewport,I=Ii(m),M=Ii(u),R=ng(h,10);function D(A){if(S.current){const O=A.clientX-S.current.left,T=A.clientY-S.current.top;p({x:O,y:T})}}return d.useEffect(()=>{const A=O=>{const T=O.target;(y==null?void 0:y.contains(T))&&I(O,E)};return document.addEventListener("wheel",A,{passive:!1}),()=>document.removeEventListener("wheel",A,{passive:!1})},[_,y,E,I]),d.useEffect(M,[r,M]),Sc(y,R),Sc(x.content,R),d.createElement(vX,{scope:n,scrollbar:y,hasThumb:o,onThumbChange:Ii(s),onThumbPointerUp:Ii(i),onThumbPositionChange:M,onThumbPointerDown:Ii(l)},d.createElement(Hd.div,pn({},g,{ref:w,style:{position:"absolute",...g.style},onPointerDown:Ti(e.onPointerDown,A=>{A.button===0&&(A.target.setPointerCapture(A.pointerId),S.current=y.getBoundingClientRect(),j.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",D(A))}),onPointerMove:Ti(e.onPointerMove,D),onPointerUp:Ti(e.onPointerUp,A=>{const O=A.target;O.hasPointerCapture(A.pointerId)&&O.releasePointerCapture(A.pointerId),document.body.style.webkitUserSelect=j.current,S.current=null})})))}),rx="ScrollAreaThumb",xX=d.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=O6(rx,e.__scopeScrollArea);return d.createElement(Vd,{present:n||o.hasThumb},d.createElement(bX,pn({ref:t},r)))}),bX=d.forwardRef((e,t)=>{const{__scopeScrollArea:n,style:r,...o}=e,s=_o(rx,n),i=O6(rx,n),{onThumbPositionChange:l}=i,u=al(t,h=>i.onThumbChange(h)),p=d.useRef(),m=ng(()=>{p.current&&(p.current(),p.current=void 0)},100);return d.useEffect(()=>{const h=s.viewport;if(h){const g=()=>{if(m(),!p.current){const x=SX(h,l);p.current=x,l()}};return l(),h.addEventListener("scroll",g),()=>h.removeEventListener("scroll",g)}},[s.viewport,m,l]),d.createElement(Hd.div,pn({"data-state":i.hasThumb?"visible":"hidden"},o,{ref:u,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...r},onPointerDownCapture:Ti(e.onPointerDownCapture,h=>{const x=h.target.getBoundingClientRect(),y=h.clientX-x.left,b=h.clientY-x.top;i.onThumbPointerDown({x:y,y:b})}),onPointerUp:Ti(e.onPointerUp,i.onThumbPointerUp)}))}),D6="ScrollAreaCorner",yX=d.forwardRef((e,t)=>{const n=_o(D6,e.__scopeScrollArea),r=!!(n.scrollbarX&&n.scrollbarY);return n.type!=="scroll"&&r?d.createElement(CX,pn({},e,{ref:t})):null}),CX=d.forwardRef((e,t)=>{const{__scopeScrollArea:n,...r}=e,o=_o(D6,n),[s,i]=d.useState(0),[l,u]=d.useState(0),p=!!(s&&l);return Sc(o.scrollbarX,()=>{var m;const h=((m=o.scrollbarX)===null||m===void 0?void 0:m.offsetHeight)||0;o.onCornerHeightChange(h),u(h)}),Sc(o.scrollbarY,()=>{var m;const h=((m=o.scrollbarY)===null||m===void 0?void 0:m.offsetWidth)||0;o.onCornerWidthChange(h),i(h)}),p?d.createElement(Hd.div,pn({},r,{ref:t,style:{width:s,height:l,position:"absolute",right:o.dir==="ltr"?0:void 0,left:o.dir==="rtl"?0:void 0,bottom:0,...e.style}})):null});function Im(e){return e?parseInt(e,10):0}function A6(e,t){const n=e/t;return isNaN(n)?0:n}function tg(e){const t=A6(e.viewport,e.content),n=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,r=(e.scrollbar.size-n)*t;return Math.max(r,18)}function wX(e,t,n,r="ltr"){const o=tg(n),s=o/2,i=t||s,l=o-i,u=n.scrollbar.paddingStart+i,p=n.scrollbar.size-n.scrollbar.paddingEnd-l,m=n.content-n.viewport,h=r==="ltr"?[0,m]:[m*-1,0];return T6([u,p],h)(e)}function G4(e,t,n="ltr"){const r=tg(t),o=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,s=t.scrollbar.size-o,i=t.content-t.viewport,l=s-r,u=n==="ltr"?[0,i]:[i*-1,0],p=aX(e,u);return T6([0,i],[0,l])(p)}function T6(e,t){return n=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const r=(t[1]-t[0])/(e[1]-e[0]);return t[0]+r*(n-e[0])}}function N6(e,t){return e>0&&e{})=>{let n={left:e.scrollLeft,top:e.scrollTop},r=0;return function o(){const s={left:e.scrollLeft,top:e.scrollTop},i=n.left!==s.left,l=n.top!==s.top;(i||l)&&t(),n=s,r=window.requestAnimationFrame(o)}(),()=>window.cancelAnimationFrame(r)};function ng(e,t){const n=Ii(e),r=d.useRef(0);return d.useEffect(()=>()=>window.clearTimeout(r.current),[]),d.useCallback(()=>{window.clearTimeout(r.current),r.current=window.setTimeout(n,t)},[n,t])}function Sc(e,t){const n=Ii(t);nx(()=>{let r=0;if(e){const o=new ResizeObserver(()=>{cancelAnimationFrame(r),r=window.requestAnimationFrame(n)});return o.observe(e),()=>{window.cancelAnimationFrame(r),o.unobserve(e)}}},[e,n])}const kX=cX,jX=dX,K4=fX,q4=xX,_X=yX;var IX=fr((e,{scrollbarSize:t,offsetScrollbars:n,scrollbarHovered:r,hidden:o})=>({root:{overflow:"hidden"},viewport:{width:"100%",height:"100%",paddingRight:n?Re(t):void 0,paddingBottom:n?Re(t):void 0},scrollbar:{display:o?"none":"flex",userSelect:"none",touchAction:"none",boxSizing:"border-box",padding:`calc(${Re(t)} / 5)`,transition:"background-color 150ms ease, opacity 150ms ease","&:hover":{backgroundColor:e.colorScheme==="dark"?e.colors.dark[8]:e.colors.gray[0],[`& .${JS("thumb")}`]:{backgroundColor:e.colorScheme==="dark"?e.fn.rgba(e.white,.5):e.fn.rgba(e.black,.5)}},'&[data-orientation="vertical"]':{width:Re(t)},'&[data-orientation="horizontal"]':{flexDirection:"column",height:Re(t)},'&[data-state="hidden"]':{display:"none",opacity:0}},thumb:{ref:JS("thumb"),flex:1,backgroundColor:e.colorScheme==="dark"?e.fn.rgba(e.white,.4):e.fn.rgba(e.black,.4),borderRadius:Re(t),position:"relative",transition:"background-color 150ms ease",display:o?"none":void 0,overflow:"hidden","&::before":{content:'""',position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",width:"100%",height:"100%",minWidth:Re(44),minHeight:Re(44)}},corner:{backgroundColor:e.colorScheme==="dark"?e.colors.dark[6]:e.colors.gray[0],transition:"opacity 150ms ease",opacity:r?1:0,display:o?"none":void 0}}));const PX=IX;var EX=Object.defineProperty,MX=Object.defineProperties,OX=Object.getOwnPropertyDescriptors,Pm=Object.getOwnPropertySymbols,$6=Object.prototype.hasOwnProperty,L6=Object.prototype.propertyIsEnumerable,X4=(e,t,n)=>t in e?EX(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ox=(e,t)=>{for(var n in t||(t={}))$6.call(t,n)&&X4(e,n,t[n]);if(Pm)for(var n of Pm(t))L6.call(t,n)&&X4(e,n,t[n]);return e},z6=(e,t)=>MX(e,OX(t)),F6=(e,t)=>{var n={};for(var r in e)$6.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Pm)for(var r of Pm(e))t.indexOf(r)<0&&L6.call(e,r)&&(n[r]=e[r]);return n};const B6={scrollbarSize:12,scrollHideDelay:1e3,type:"hover",offsetScrollbars:!1},rg=d.forwardRef((e,t)=>{const n=Rn("ScrollArea",B6,e),{children:r,className:o,classNames:s,styles:i,scrollbarSize:l,scrollHideDelay:u,type:p,dir:m,offsetScrollbars:h,viewportRef:g,onScrollPositionChange:x,unstyled:y,variant:b,viewportProps:w}=n,S=F6(n,["children","className","classNames","styles","scrollbarSize","scrollHideDelay","type","dir","offsetScrollbars","viewportRef","onScrollPositionChange","unstyled","variant","viewportProps"]),[j,_]=d.useState(!1),E=xa(),{classes:I,cx:M}=PX({scrollbarSize:l,offsetScrollbars:h,scrollbarHovered:j,hidden:p==="never"},{name:"ScrollArea",classNames:s,styles:i,unstyled:y,variant:b});return H.createElement(kX,{type:p==="never"?"always":p,scrollHideDelay:u,dir:m||E.dir,ref:t,asChild:!0},H.createElement(zr,ox({className:M(I.root,o)},S),H.createElement(jX,z6(ox({},w),{className:I.viewport,ref:g,onScroll:typeof x=="function"?({currentTarget:R})=>x({x:R.scrollLeft,y:R.scrollTop}):void 0}),r),H.createElement(K4,{orientation:"horizontal",className:I.scrollbar,forceMount:!0,onMouseEnter:()=>_(!0),onMouseLeave:()=>_(!1)},H.createElement(q4,{className:I.thumb})),H.createElement(K4,{orientation:"vertical",className:I.scrollbar,forceMount:!0,onMouseEnter:()=>_(!0),onMouseLeave:()=>_(!1)},H.createElement(q4,{className:I.thumb})),H.createElement(_X,{className:I.corner})))}),H6=d.forwardRef((e,t)=>{const n=Rn("ScrollAreaAutosize",B6,e),{children:r,classNames:o,styles:s,scrollbarSize:i,scrollHideDelay:l,type:u,dir:p,offsetScrollbars:m,viewportRef:h,onScrollPositionChange:g,unstyled:x,sx:y,variant:b,viewportProps:w}=n,S=F6(n,["children","classNames","styles","scrollbarSize","scrollHideDelay","type","dir","offsetScrollbars","viewportRef","onScrollPositionChange","unstyled","sx","variant","viewportProps"]);return H.createElement(zr,z6(ox({},S),{ref:t,sx:[{display:"flex"},...EP(y)]}),H.createElement(zr,{sx:{display:"flex",flexDirection:"column",flex:1}},H.createElement(rg,{classNames:o,styles:s,scrollHideDelay:l,scrollbarSize:i,type:u,dir:p,offsetScrollbars:m,viewportRef:h,onScrollPositionChange:g,unstyled:x,variant:b,viewportProps:w},r)))});H6.displayName="@mantine/core/ScrollAreaAutosize";rg.displayName="@mantine/core/ScrollArea";rg.Autosize=H6;const V6=rg;var RX=Object.defineProperty,DX=Object.defineProperties,AX=Object.getOwnPropertyDescriptors,Em=Object.getOwnPropertySymbols,W6=Object.prototype.hasOwnProperty,U6=Object.prototype.propertyIsEnumerable,Q4=(e,t,n)=>t in e?RX(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Y4=(e,t)=>{for(var n in t||(t={}))W6.call(t,n)&&Q4(e,n,t[n]);if(Em)for(var n of Em(t))U6.call(t,n)&&Q4(e,n,t[n]);return e},TX=(e,t)=>DX(e,AX(t)),NX=(e,t)=>{var n={};for(var r in e)W6.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Em)for(var r of Em(e))t.indexOf(r)<0&&U6.call(e,r)&&(n[r]=e[r]);return n};const og=d.forwardRef((e,t)=>{var n=e,{style:r}=n,o=NX(n,["style"]);return H.createElement(V6,TX(Y4({},o),{style:Y4({width:"100%"},r),viewportProps:{tabIndex:-1},viewportRef:t}),o.children)});og.displayName="@mantine/core/SelectScrollArea";var $X=fr(()=>({dropdown:{},itemsWrapper:{padding:Re(4),display:"flex",width:"100%",boxSizing:"border-box"}}));const LX=$X;function Fc(e){return e.split("-")[1]}function oy(e){return e==="y"?"height":"width"}function Go(e){return e.split("-")[0]}function ii(e){return["top","bottom"].includes(Go(e))?"x":"y"}function Z4(e,t,n){let{reference:r,floating:o}=e;const s=r.x+r.width/2-o.width/2,i=r.y+r.height/2-o.height/2,l=ii(t),u=oy(l),p=r[u]/2-o[u]/2,m=l==="x";let h;switch(Go(t)){case"top":h={x:s,y:r.y-o.height};break;case"bottom":h={x:s,y:r.y+r.height};break;case"right":h={x:r.x+r.width,y:i};break;case"left":h={x:r.x-o.width,y:i};break;default:h={x:r.x,y:r.y}}switch(Fc(t)){case"start":h[l]-=p*(n&&m?-1:1);break;case"end":h[l]+=p*(n&&m?-1:1)}return h}const zX=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:s=[],platform:i}=n,l=s.filter(Boolean),u=await(i.isRTL==null?void 0:i.isRTL(t));let p=await i.getElementRects({reference:e,floating:t,strategy:o}),{x:m,y:h}=Z4(p,r,u),g=r,x={},y=0;for(let b=0;b({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:s,platform:i,elements:l}=t,{element:u,padding:p=0}=ia(e,t)||{};if(u==null)return{};const m=sy(p),h={x:n,y:r},g=ii(o),x=oy(g),y=await i.getDimensions(u),b=g==="y",w=b?"top":"left",S=b?"bottom":"right",j=b?"clientHeight":"clientWidth",_=s.reference[x]+s.reference[g]-h[g]-s.floating[x],E=h[g]-s.reference[g],I=await(i.getOffsetParent==null?void 0:i.getOffsetParent(u));let M=I?I[j]:0;M&&await(i.isElement==null?void 0:i.isElement(I))||(M=l.floating[j]||s.floating[x]);const R=_/2-E/2,D=M/2-y[x]/2-1,A=ei(m[w],D),O=ei(m[S],D),T=A,X=M-y[x]-O,B=M/2-y[x]/2+R,V=sx(T,B,X),U=Fc(o)!=null&&B!=V&&s.reference[x]/2-(Be.concat(t,t+"-start",t+"-end"),[]);const BX={left:"right",right:"left",bottom:"top",top:"bottom"};function Mm(e){return e.replace(/left|right|bottom|top/g,t=>BX[t])}function HX(e,t,n){n===void 0&&(n=!1);const r=Fc(e),o=ii(e),s=oy(o);let i=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(i=Mm(i)),{main:i,cross:Mm(i)}}const VX={start:"end",end:"start"};function Iv(e){return e.replace(/start|end/g,t=>VX[t])}const WX=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n;const{placement:r,middlewareData:o,rects:s,initialPlacement:i,platform:l,elements:u}=t,{mainAxis:p=!0,crossAxis:m=!0,fallbackPlacements:h,fallbackStrategy:g="bestFit",fallbackAxisSideDirection:x="none",flipAlignment:y=!0,...b}=ia(e,t),w=Go(r),S=Go(i)===i,j=await(l.isRTL==null?void 0:l.isRTL(u.floating)),_=h||(S||!y?[Mm(i)]:function(T){const X=Mm(T);return[Iv(T),X,Iv(X)]}(i));h||x==="none"||_.push(...function(T,X,B,V){const U=Fc(T);let N=function($,q,F){const Q=["left","right"],Y=["right","left"],se=["top","bottom"],ae=["bottom","top"];switch($){case"top":case"bottom":return F?q?Y:Q:q?Q:Y;case"left":case"right":return q?se:ae;default:return[]}}(Go(T),B==="start",V);return U&&(N=N.map($=>$+"-"+U),X&&(N=N.concat(N.map(Iv)))),N}(i,y,x,j));const E=[i,..._],I=await ay(t,b),M=[];let R=((n=o.flip)==null?void 0:n.overflows)||[];if(p&&M.push(I[w]),m){const{main:T,cross:X}=HX(r,s,j);M.push(I[T],I[X])}if(R=[...R,{placement:r,overflows:M}],!M.every(T=>T<=0)){var D,A;const T=(((D=o.flip)==null?void 0:D.index)||0)+1,X=E[T];if(X)return{data:{index:T,overflows:R},reset:{placement:X}};let B=(A=R.filter(V=>V.overflows[0]<=0).sort((V,U)=>V.overflows[1]-U.overflows[1])[0])==null?void 0:A.placement;if(!B)switch(g){case"bestFit":{var O;const V=(O=R.map(U=>[U.placement,U.overflows.filter(N=>N>0).reduce((N,$)=>N+$,0)]).sort((U,N)=>U[1]-N[1])[0])==null?void 0:O[0];V&&(B=V);break}case"initialPlacement":B=i}if(r!==B)return{reset:{placement:B}}}return{}}}};function ek(e){const t=ei(...e.map(r=>r.left)),n=ei(...e.map(r=>r.top));return{x:t,y:n,width:ms(...e.map(r=>r.right))-t,height:ms(...e.map(r=>r.bottom))-n}}const UX=function(e){return e===void 0&&(e={}),{name:"inline",options:e,async fn(t){const{placement:n,elements:r,rects:o,platform:s,strategy:i}=t,{padding:l=2,x:u,y:p}=ia(e,t),m=Array.from(await(s.getClientRects==null?void 0:s.getClientRects(r.reference))||[]),h=function(b){const w=b.slice().sort((_,E)=>_.y-E.y),S=[];let j=null;for(let _=0;_j.height/2?S.push([E]):S[S.length-1].push(E),j=E}return S.map(_=>kc(ek(_)))}(m),g=kc(ek(m)),x=sy(l),y=await s.getElementRects({reference:{getBoundingClientRect:function(){if(h.length===2&&h[0].left>h[1].right&&u!=null&&p!=null)return h.find(b=>u>b.left-x.left&&ub.top-x.top&&p=2){if(ii(n)==="x"){const I=h[0],M=h[h.length-1],R=Go(n)==="top",D=I.top,A=M.bottom,O=R?I.left:M.left,T=R?I.right:M.right;return{top:D,bottom:A,left:O,right:T,width:T-O,height:A-D,x:O,y:D}}const b=Go(n)==="left",w=ms(...h.map(I=>I.right)),S=ei(...h.map(I=>I.left)),j=h.filter(I=>b?I.left===S:I.right===w),_=j[0].top,E=j[j.length-1].bottom;return{top:_,bottom:E,left:S,right:w,width:w-S,height:E-_,x:S,y:_}}return g}},floating:r.floating,strategy:i});return o.reference.x!==y.reference.x||o.reference.y!==y.reference.y||o.reference.width!==y.reference.width||o.reference.height!==y.reference.height?{reset:{rects:y}}:{}}}},GX=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){const{x:n,y:r}=t,o=await async function(s,i){const{placement:l,platform:u,elements:p}=s,m=await(u.isRTL==null?void 0:u.isRTL(p.floating)),h=Go(l),g=Fc(l),x=ii(l)==="x",y=["left","top"].includes(h)?-1:1,b=m&&x?-1:1,w=ia(i,s);let{mainAxis:S,crossAxis:j,alignmentAxis:_}=typeof w=="number"?{mainAxis:w,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...w};return g&&typeof _=="number"&&(j=g==="end"?-1*_:_),x?{x:j*b,y:S*y}:{x:S*y,y:j*b}}(t,e);return{x:n+o.x,y:r+o.y,data:o}}}};function G6(e){return e==="x"?"y":"x"}const KX=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o}=t,{mainAxis:s=!0,crossAxis:i=!1,limiter:l={fn:w=>{let{x:S,y:j}=w;return{x:S,y:j}}},...u}=ia(e,t),p={x:n,y:r},m=await ay(t,u),h=ii(Go(o)),g=G6(h);let x=p[h],y=p[g];if(s){const w=h==="y"?"bottom":"right";x=sx(x+m[h==="y"?"top":"left"],x,x-m[w])}if(i){const w=g==="y"?"bottom":"right";y=sx(y+m[g==="y"?"top":"left"],y,y-m[w])}const b=l.fn({...t,[h]:x,[g]:y});return{...b,data:{x:b.x-n,y:b.y-r}}}}},qX=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:o,rects:s,middlewareData:i}=t,{offset:l=0,mainAxis:u=!0,crossAxis:p=!0}=ia(e,t),m={x:n,y:r},h=ii(o),g=G6(h);let x=m[h],y=m[g];const b=ia(l,t),w=typeof b=="number"?{mainAxis:b,crossAxis:0}:{mainAxis:0,crossAxis:0,...b};if(u){const _=h==="y"?"height":"width",E=s.reference[h]-s.floating[_]+w.mainAxis,I=s.reference[h]+s.reference[_]-w.mainAxis;xI&&(x=I)}if(p){var S,j;const _=h==="y"?"width":"height",E=["top","left"].includes(Go(o)),I=s.reference[g]-s.floating[_]+(E&&((S=i.offset)==null?void 0:S[g])||0)+(E?0:w.crossAxis),M=s.reference[g]+s.reference[_]+(E?0:((j=i.offset)==null?void 0:j[g])||0)-(E?w.crossAxis:0);yM&&(y=M)}return{[h]:x,[g]:y}}}},XX=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){const{placement:n,rects:r,platform:o,elements:s}=t,{apply:i=()=>{},...l}=ia(e,t),u=await ay(t,l),p=Go(n),m=Fc(n),h=ii(n)==="x",{width:g,height:x}=r.floating;let y,b;p==="top"||p==="bottom"?(y=p,b=m===(await(o.isRTL==null?void 0:o.isRTL(s.floating))?"start":"end")?"left":"right"):(b=p,y=m==="end"?"top":"bottom");const w=x-u[y],S=g-u[b],j=!t.middlewareData.shift;let _=w,E=S;if(h){const M=g-u.left-u.right;E=m||j?ei(S,M):M}else{const M=x-u.top-u.bottom;_=m||j?ei(w,M):M}if(j&&!m){const M=ms(u.left,0),R=ms(u.right,0),D=ms(u.top,0),A=ms(u.bottom,0);h?E=g-2*(M!==0||R!==0?M+R:ms(u.left,u.right)):_=x-2*(D!==0||A!==0?D+A:ms(u.top,u.bottom))}await i({...t,availableWidth:E,availableHeight:_});const I=await o.getDimensions(s.floating);return g!==I.width||x!==I.height?{reset:{rects:!0}}:{}}}};function Zr(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function ks(e){return Zr(e).getComputedStyle(e)}function K6(e){return e instanceof Zr(e).Node}function ti(e){return K6(e)?(e.nodeName||"").toLowerCase():"#document"}function Jo(e){return e instanceof HTMLElement||e instanceof Zr(e).HTMLElement}function tk(e){return typeof ShadowRoot<"u"&&(e instanceof Zr(e).ShadowRoot||e instanceof ShadowRoot)}function sd(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=ks(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!["inline","contents"].includes(o)}function QX(e){return["table","td","th"].includes(ti(e))}function ax(e){const t=iy(),n=ks(e);return n.transform!=="none"||n.perspective!=="none"||!!n.containerType&&n.containerType!=="normal"||!t&&!!n.backdropFilter&&n.backdropFilter!=="none"||!t&&!!n.filter&&n.filter!=="none"||["transform","perspective","filter"].some(r=>(n.willChange||"").includes(r))||["paint","layout","strict","content"].some(r=>(n.contain||"").includes(r))}function iy(){return!(typeof CSS>"u"||!CSS.supports)&&CSS.supports("-webkit-backdrop-filter","none")}function sg(e){return["html","body","#document"].includes(ti(e))}const ix=Math.min,fc=Math.max,Om=Math.round,fp=Math.floor,ni=e=>({x:e,y:e});function q6(e){const t=ks(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=Jo(e),s=o?e.offsetWidth:n,i=o?e.offsetHeight:r,l=Om(n)!==s||Om(r)!==i;return l&&(n=s,r=i),{width:n,height:r,$:l}}function ea(e){return e instanceof Element||e instanceof Zr(e).Element}function ly(e){return ea(e)?e:e.contextElement}function pc(e){const t=ly(e);if(!Jo(t))return ni(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:s}=q6(t);let i=(s?Om(n.width):n.width)/r,l=(s?Om(n.height):n.height)/o;return i&&Number.isFinite(i)||(i=1),l&&Number.isFinite(l)||(l=1),{x:i,y:l}}const YX=ni(0);function X6(e){const t=Zr(e);return iy()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:YX}function Xi(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),s=ly(e);let i=ni(1);t&&(r?ea(r)&&(i=pc(r)):i=pc(e));const l=function(g,x,y){return x===void 0&&(x=!1),!(!y||x&&y!==Zr(g))&&x}(s,n,r)?X6(s):ni(0);let u=(o.left+l.x)/i.x,p=(o.top+l.y)/i.y,m=o.width/i.x,h=o.height/i.y;if(s){const g=Zr(s),x=r&&ea(r)?Zr(r):r;let y=g.frameElement;for(;y&&r&&x!==g;){const b=pc(y),w=y.getBoundingClientRect(),S=getComputedStyle(y),j=w.left+(y.clientLeft+parseFloat(S.paddingLeft))*b.x,_=w.top+(y.clientTop+parseFloat(S.paddingTop))*b.y;u*=b.x,p*=b.y,m*=b.x,h*=b.y,u+=j,p+=_,y=Zr(y).frameElement}}return kc({width:m,height:h,x:u,y:p})}function ag(e){return ea(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.pageXOffset,scrollTop:e.pageYOffset}}function ta(e){var t;return(t=(K6(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Q6(e){return Xi(ta(e)).left+ag(e).scrollLeft}function jc(e){if(ti(e)==="html")return e;const t=e.assignedSlot||e.parentNode||tk(e)&&e.host||ta(e);return tk(t)?t.host:t}function Y6(e){const t=jc(e);return sg(t)?e.ownerDocument?e.ownerDocument.body:e.body:Jo(t)&&sd(t)?t:Y6(t)}function Rm(e,t){var n;t===void 0&&(t=[]);const r=Y6(e),o=r===((n=e.ownerDocument)==null?void 0:n.body),s=Zr(r);return o?t.concat(s,s.visualViewport||[],sd(r)?r:[]):t.concat(r,Rm(r))}function nk(e,t,n){let r;if(t==="viewport")r=function(o,s){const i=Zr(o),l=ta(o),u=i.visualViewport;let p=l.clientWidth,m=l.clientHeight,h=0,g=0;if(u){p=u.width,m=u.height;const x=iy();(!x||x&&s==="fixed")&&(h=u.offsetLeft,g=u.offsetTop)}return{width:p,height:m,x:h,y:g}}(e,n);else if(t==="document")r=function(o){const s=ta(o),i=ag(o),l=o.ownerDocument.body,u=fc(s.scrollWidth,s.clientWidth,l.scrollWidth,l.clientWidth),p=fc(s.scrollHeight,s.clientHeight,l.scrollHeight,l.clientHeight);let m=-i.scrollLeft+Q6(o);const h=-i.scrollTop;return ks(l).direction==="rtl"&&(m+=fc(s.clientWidth,l.clientWidth)-u),{width:u,height:p,x:m,y:h}}(ta(e));else if(ea(t))r=function(o,s){const i=Xi(o,!0,s==="fixed"),l=i.top+o.clientTop,u=i.left+o.clientLeft,p=Jo(o)?pc(o):ni(1);return{width:o.clientWidth*p.x,height:o.clientHeight*p.y,x:u*p.x,y:l*p.y}}(t,n);else{const o=X6(e);r={...t,x:t.x-o.x,y:t.y-o.y}}return kc(r)}function Z6(e,t){const n=jc(e);return!(n===t||!ea(n)||sg(n))&&(ks(n).position==="fixed"||Z6(n,t))}function ZX(e,t,n){const r=Jo(t),o=ta(t),s=n==="fixed",i=Xi(e,!0,s,t);let l={scrollLeft:0,scrollTop:0};const u=ni(0);if(r||!r&&!s)if((ti(t)!=="body"||sd(o))&&(l=ag(t)),Jo(t)){const p=Xi(t,!0,s,t);u.x=p.x+t.clientLeft,u.y=p.y+t.clientTop}else o&&(u.x=Q6(o));return{x:i.left+l.scrollLeft-u.x,y:i.top+l.scrollTop-u.y,width:i.width,height:i.height}}function rk(e,t){return Jo(e)&&ks(e).position!=="fixed"?t?t(e):e.offsetParent:null}function ok(e,t){const n=Zr(e);if(!Jo(e))return n;let r=rk(e,t);for(;r&&QX(r)&&ks(r).position==="static";)r=rk(r,t);return r&&(ti(r)==="html"||ti(r)==="body"&&ks(r).position==="static"&&!ax(r))?n:r||function(o){let s=jc(o);for(;Jo(s)&&!sg(s);){if(ax(s))return s;s=jc(s)}return null}(e)||n}const JX={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{rect:t,offsetParent:n,strategy:r}=e;const o=Jo(n),s=ta(n);if(n===s)return t;let i={scrollLeft:0,scrollTop:0},l=ni(1);const u=ni(0);if((o||!o&&r!=="fixed")&&((ti(n)!=="body"||sd(s))&&(i=ag(n)),Jo(n))){const p=Xi(n);l=pc(n),u.x=p.x+n.clientLeft,u.y=p.y+n.clientTop}return{width:t.width*l.x,height:t.height*l.y,x:t.x*l.x-i.scrollLeft*l.x+u.x,y:t.y*l.y-i.scrollTop*l.y+u.y}},getDocumentElement:ta,getClippingRect:function(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const s=[...n==="clippingAncestors"?function(u,p){const m=p.get(u);if(m)return m;let h=Rm(u).filter(b=>ea(b)&&ti(b)!=="body"),g=null;const x=ks(u).position==="fixed";let y=x?jc(u):u;for(;ea(y)&&!sg(y);){const b=ks(y),w=ax(y);w||b.position!=="fixed"||(g=null),(x?!w&&!g:!w&&b.position==="static"&&g&&["absolute","fixed"].includes(g.position)||sd(y)&&!w&&Z6(u,y))?h=h.filter(S=>S!==y):g=b,y=jc(y)}return p.set(u,h),h}(t,this._c):[].concat(n),r],i=s[0],l=s.reduce((u,p)=>{const m=nk(t,p,o);return u.top=fc(m.top,u.top),u.right=ix(m.right,u.right),u.bottom=ix(m.bottom,u.bottom),u.left=fc(m.left,u.left),u},nk(t,i,o));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}},getOffsetParent:ok,getElementRects:async function(e){let{reference:t,floating:n,strategy:r}=e;const o=this.getOffsetParent||ok,s=this.getDimensions;return{reference:ZX(t,await o(n),r),floating:{x:0,y:0,...await s(n)}}},getClientRects:function(e){return Array.from(e.getClientRects())},getDimensions:function(e){return q6(e)},getScale:pc,isElement:ea,isRTL:function(e){return getComputedStyle(e).direction==="rtl"}};function eQ(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:s=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:u=!1}=r,p=ly(e),m=o||s?[...p?Rm(p):[],...Rm(t)]:[];m.forEach(w=>{o&&w.addEventListener("scroll",n,{passive:!0}),s&&w.addEventListener("resize",n)});const h=p&&l?function(w,S){let j,_=null;const E=ta(w);function I(){clearTimeout(j),_&&_.disconnect(),_=null}return function M(R,D){R===void 0&&(R=!1),D===void 0&&(D=1),I();const{left:A,top:O,width:T,height:X}=w.getBoundingClientRect();if(R||S(),!T||!X)return;const B={rootMargin:-fp(O)+"px "+-fp(E.clientWidth-(A+T))+"px "+-fp(E.clientHeight-(O+X))+"px "+-fp(A)+"px",threshold:fc(0,ix(1,D))||1};let V=!0;function U(N){const $=N[0].intersectionRatio;if($!==D){if(!V)return M();$?M(!1,$):j=setTimeout(()=>{M(!1,1e-7)},100)}V=!1}try{_=new IntersectionObserver(U,{...B,root:E.ownerDocument})}catch{_=new IntersectionObserver(U,B)}_.observe(w)}(!0),I}(p,n):null;let g,x=-1,y=null;i&&(y=new ResizeObserver(w=>{let[S]=w;S&&S.target===p&&y&&(y.unobserve(t),cancelAnimationFrame(x),x=requestAnimationFrame(()=>{y&&y.observe(t)})),n()}),p&&!u&&y.observe(p),y.observe(t));let b=u?Xi(e):null;return u&&function w(){const S=Xi(e);!b||S.x===b.x&&S.y===b.y&&S.width===b.width&&S.height===b.height||n(),b=S,g=requestAnimationFrame(w)}(),n(),()=>{m.forEach(w=>{o&&w.removeEventListener("scroll",n),s&&w.removeEventListener("resize",n)}),h&&h(),y&&y.disconnect(),y=null,u&&cancelAnimationFrame(g)}}const tQ=(e,t,n)=>{const r=new Map,o={platform:JX,...n},s={...o.platform,_c:r};return zX(e,t,{...o,platform:s})},nQ=e=>{const{element:t,padding:n}=e;function r(o){return Object.prototype.hasOwnProperty.call(o,"current")}return{name:"arrow",options:e,fn(o){return r(t)?t.current!=null?J4({element:t.current,padding:n}).fn(o):{}:t?J4({element:t,padding:n}).fn(o):{}}}};var Vp=typeof document<"u"?d.useLayoutEffect:d.useEffect;function Dm(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 n,r,o;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!=t.length)return!1;for(r=n;r--!==0;)if(!Dm(e[r],t[r]))return!1;return!0}if(o=Object.keys(e),n=o.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!Object.prototype.hasOwnProperty.call(t,o[r]))return!1;for(r=n;r--!==0;){const s=o[r];if(!(s==="_owner"&&e.$$typeof)&&!Dm(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function sk(e){const t=d.useRef(e);return Vp(()=>{t.current=e}),t}function rQ(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:o,whileElementsMounted:s,open:i}=e,[l,u]=d.useState({x:null,y:null,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[p,m]=d.useState(r);Dm(p,r)||m(r);const h=d.useRef(null),g=d.useRef(null),x=d.useRef(l),y=sk(s),b=sk(o),[w,S]=d.useState(null),[j,_]=d.useState(null),E=d.useCallback(O=>{h.current!==O&&(h.current=O,S(O))},[]),I=d.useCallback(O=>{g.current!==O&&(g.current=O,_(O))},[]),M=d.useCallback(()=>{if(!h.current||!g.current)return;const O={placement:t,strategy:n,middleware:p};b.current&&(O.platform=b.current),tQ(h.current,g.current,O).then(T=>{const X={...T,isPositioned:!0};R.current&&!Dm(x.current,X)&&(x.current=X,qr.flushSync(()=>{u(X)}))})},[p,t,n,b]);Vp(()=>{i===!1&&x.current.isPositioned&&(x.current.isPositioned=!1,u(O=>({...O,isPositioned:!1})))},[i]);const R=d.useRef(!1);Vp(()=>(R.current=!0,()=>{R.current=!1}),[]),Vp(()=>{if(w&&j){if(y.current)return y.current(w,j,M);M()}},[w,j,M,y]);const D=d.useMemo(()=>({reference:h,floating:g,setReference:E,setFloating:I}),[E,I]),A=d.useMemo(()=>({reference:w,floating:j}),[w,j]);return d.useMemo(()=>({...l,update:M,refs:D,elements:A,reference:E,floating:I}),[l,M,D,A,E,I])}var oQ=typeof document<"u"?d.useLayoutEffect:d.useEffect;function sQ(){const e=new Map;return{emit(t,n){var r;(r=e.get(t))==null||r.forEach(o=>o(n))},on(t,n){e.set(t,[...e.get(t)||[],n])},off(t,n){e.set(t,(e.get(t)||[]).filter(r=>r!==n))}}}const aQ=d.createContext(null),iQ=()=>d.useContext(aQ);function lQ(e){return(e==null?void 0:e.ownerDocument)||document}function cQ(e){return lQ(e).defaultView||window}function pp(e){return e?e instanceof cQ(e).Element:!1}const uQ=Fx["useInsertionEffect".toString()],dQ=uQ||(e=>e());function fQ(e){const t=d.useRef(()=>{});return dQ(()=>{t.current=e}),d.useCallback(function(){for(var n=arguments.length,r=new Array(n),o=0;osQ())[0],[p,m]=d.useState(null),h=d.useCallback(S=>{const j=pp(S)?{getBoundingClientRect:()=>S.getBoundingClientRect(),contextElement:S}:S;o.refs.setReference(j)},[o.refs]),g=d.useCallback(S=>{(pp(S)||S===null)&&(i.current=S,m(S)),(pp(o.refs.reference.current)||o.refs.reference.current===null||S!==null&&!pp(S))&&o.refs.setReference(S)},[o.refs]),x=d.useMemo(()=>({...o.refs,setReference:g,setPositionReference:h,domReference:i}),[o.refs,g,h]),y=d.useMemo(()=>({...o.elements,domReference:p}),[o.elements,p]),b=fQ(n),w=d.useMemo(()=>({...o,refs:x,elements:y,dataRef:l,nodeId:r,events:u,open:t,onOpenChange:b}),[o,r,u,t,b,x,y]);return oQ(()=>{const S=s==null?void 0:s.nodesRef.current.find(j=>j.id===r);S&&(S.context=w)}),d.useMemo(()=>({...o,context:w,refs:x,reference:g,positionReference:h}),[o,x,w,g,h])}function mQ({opened:e,floating:t,position:n,positionDependencies:r}){const[o,s]=d.useState(0);d.useEffect(()=>{if(t.refs.reference.current&&t.refs.floating.current)return eQ(t.refs.reference.current,t.refs.floating.current,t.update)},[t.refs.reference.current,t.refs.floating.current,e,o,n]),Uo(()=>{t.update()},r),Uo(()=>{s(i=>i+1)},[e])}function hQ(e){const t=[GX(e.offset)];return e.middlewares.shift&&t.push(KX({limiter:qX()})),e.middlewares.flip&&t.push(WX()),e.middlewares.inline&&t.push(UX()),t.push(nQ({element:e.arrowRef,padding:e.arrowOffset})),t}function gQ(e){const[t,n]=od({value:e.opened,defaultValue:e.defaultOpened,finalValue:!1,onChange:e.onChange}),r=()=>{var i;(i=e.onClose)==null||i.call(e),n(!1)},o=()=>{var i,l;t?((i=e.onClose)==null||i.call(e),n(!1)):((l=e.onOpen)==null||l.call(e),n(!0))},s=pQ({placement:e.position,middleware:[...hQ(e),...e.width==="target"?[XX({apply({rects:i}){var l,u;Object.assign((u=(l=s.refs.floating.current)==null?void 0:l.style)!=null?u:{},{width:`${i.reference.width}px`})}})]:[]]});return mQ({opened:e.opened,position:e.position,positionDependencies:e.positionDependencies,floating:s}),Uo(()=>{var i;(i=e.onPositionChange)==null||i.call(e,s.placement)},[s.placement]),Uo(()=>{var i,l;e.opened?(l=e.onOpen)==null||l.call(e):(i=e.onClose)==null||i.call(e)},[e.opened]),{floating:s,controlled:typeof e.opened=="boolean",opened:t,onClose:r,onToggle:o}}const J6={context:"Popover component was not found in the tree",children:"Popover.Target component children should be an element or a component that accepts ref. Fragments, strings, numbers and other primitive values are not supported"},[vQ,eE]=oG(J6.context);var xQ=Object.defineProperty,bQ=Object.defineProperties,yQ=Object.getOwnPropertyDescriptors,Am=Object.getOwnPropertySymbols,tE=Object.prototype.hasOwnProperty,nE=Object.prototype.propertyIsEnumerable,ak=(e,t,n)=>t in e?xQ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,mp=(e,t)=>{for(var n in t||(t={}))tE.call(t,n)&&ak(e,n,t[n]);if(Am)for(var n of Am(t))nE.call(t,n)&&ak(e,n,t[n]);return e},CQ=(e,t)=>bQ(e,yQ(t)),wQ=(e,t)=>{var n={};for(var r in e)tE.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Am)for(var r of Am(e))t.indexOf(r)<0&&nE.call(e,r)&&(n[r]=e[r]);return n};const SQ={refProp:"ref",popupType:"dialog"},rE=d.forwardRef((e,t)=>{const n=Rn("PopoverTarget",SQ,e),{children:r,refProp:o,popupType:s}=n,i=wQ(n,["children","refProp","popupType"]);if(!OP(r))throw new Error(J6.children);const l=i,u=eE(),p=Bd(u.reference,r.ref,t),m=u.withRoles?{"aria-haspopup":s,"aria-expanded":u.opened,"aria-controls":u.getDropdownId(),id:u.getTargetId()}:{};return d.cloneElement(r,mp(CQ(mp(mp(mp({},l),m),u.targetProps),{className:DP(u.targetProps.className,l.className,r.props.className),[o]:p}),u.controlled?null:{onClick:u.onToggle}))});rE.displayName="@mantine/core/PopoverTarget";var kQ=fr((e,{radius:t,shadow:n})=>({dropdown:{position:"absolute",backgroundColor:e.white,background:e.colorScheme==="dark"?e.colors.dark[6]:e.white,border:`${Re(1)} solid ${e.colorScheme==="dark"?e.colors.dark[4]:e.colors.gray[2]}`,padding:`${e.spacing.sm} ${e.spacing.md}`,boxShadow:e.shadows[n]||n||"none",borderRadius:e.fn.radius(t),"&:focus":{outline:0}},arrow:{backgroundColor:"inherit",border:`${Re(1)} solid ${e.colorScheme==="dark"?e.colors.dark[4]:e.colors.gray[2]}`,zIndex:1}}));const jQ=kQ;var _Q=Object.defineProperty,ik=Object.getOwnPropertySymbols,IQ=Object.prototype.hasOwnProperty,PQ=Object.prototype.propertyIsEnumerable,lk=(e,t,n)=>t in e?_Q(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,$l=(e,t)=>{for(var n in t||(t={}))IQ.call(t,n)&&lk(e,n,t[n]);if(ik)for(var n of ik(t))PQ.call(t,n)&&lk(e,n,t[n]);return e};const ck={entering:"in",entered:"in",exiting:"out",exited:"out","pre-exiting":"out","pre-entering":"out"};function EQ({transition:e,state:t,duration:n,timingFunction:r}){const o={transitionDuration:`${n}ms`,transitionTimingFunction:r};return typeof e=="string"?e in ap?$l($l($l({transitionProperty:ap[e].transitionProperty},o),ap[e].common),ap[e][ck[t]]):null:$l($l($l({transitionProperty:e.transitionProperty},o),e.common),e[ck[t]])}function MQ({duration:e,exitDuration:t,timingFunction:n,mounted:r,onEnter:o,onExit:s,onEntered:i,onExited:l}){const u=xa(),p=FP(),m=u.respectReducedMotion?p:!1,[h,g]=d.useState(m?0:e),[x,y]=d.useState(r?"entered":"exited"),b=d.useRef(-1),w=S=>{const j=S?o:s,_=S?i:l;y(S?"pre-entering":"pre-exiting"),window.clearTimeout(b.current);const E=m?0:S?e:t;if(g(E),E===0)typeof j=="function"&&j(),typeof _=="function"&&_(),y(S?"entered":"exited");else{const I=window.setTimeout(()=>{typeof j=="function"&&j(),y(S?"entering":"exiting")},10);b.current=window.setTimeout(()=>{window.clearTimeout(I),typeof _=="function"&&_(),y(S?"entered":"exited")},E)}};return Uo(()=>{w(r)},[r]),d.useEffect(()=>()=>window.clearTimeout(b.current),[]),{transitionDuration:h,transitionStatus:x,transitionTimingFunction:n||u.transitionTimingFunction}}function oE({keepMounted:e,transition:t,duration:n=250,exitDuration:r=n,mounted:o,children:s,timingFunction:i,onExit:l,onEntered:u,onEnter:p,onExited:m}){const{transitionDuration:h,transitionStatus:g,transitionTimingFunction:x}=MQ({mounted:o,exitDuration:r,duration:n,timingFunction:i,onExit:l,onEntered:u,onEnter:p,onExited:m});return h===0?o?H.createElement(H.Fragment,null,s({})):e?s({display:"none"}):null:g==="exited"?e?s({display:"none"}):null:H.createElement(H.Fragment,null,s(EQ({transition:t,duration:h,state:g,timingFunction:x})))}oE.displayName="@mantine/core/Transition";function sE({children:e,active:t=!0,refProp:n="ref"}){const r=LG(t),o=Bd(r,e==null?void 0:e.ref);return OP(e)?d.cloneElement(e,{[n]:o}):e}sE.displayName="@mantine/core/FocusTrap";var OQ=Object.defineProperty,RQ=Object.defineProperties,DQ=Object.getOwnPropertyDescriptors,uk=Object.getOwnPropertySymbols,AQ=Object.prototype.hasOwnProperty,TQ=Object.prototype.propertyIsEnumerable,dk=(e,t,n)=>t in e?OQ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Na=(e,t)=>{for(var n in t||(t={}))AQ.call(t,n)&&dk(e,n,t[n]);if(uk)for(var n of uk(t))TQ.call(t,n)&&dk(e,n,t[n]);return e},hp=(e,t)=>RQ(e,DQ(t));function fk(e,t,n,r){return e==="center"||r==="center"?{top:t}:e==="end"?{bottom:n}:e==="start"?{top:n}:{}}function pk(e,t,n,r,o){return e==="center"||r==="center"?{left:t}:e==="end"?{[o==="ltr"?"right":"left"]:n}:e==="start"?{[o==="ltr"?"left":"right"]:n}:{}}const NQ={bottom:"borderTopLeftRadius",left:"borderTopRightRadius",right:"borderBottomLeftRadius",top:"borderBottomRightRadius"};function $Q({position:e,arrowSize:t,arrowOffset:n,arrowRadius:r,arrowPosition:o,arrowX:s,arrowY:i,dir:l}){const[u,p="center"]=e.split("-"),m={width:Re(t),height:Re(t),transform:"rotate(45deg)",position:"absolute",[NQ[u]]:Re(r)},h=Re(-t/2);return u==="left"?hp(Na(Na({},m),fk(p,i,n,o)),{right:h,borderLeftColor:"transparent",borderBottomColor:"transparent"}):u==="right"?hp(Na(Na({},m),fk(p,i,n,o)),{left:h,borderRightColor:"transparent",borderTopColor:"transparent"}):u==="top"?hp(Na(Na({},m),pk(p,s,n,o,l)),{bottom:h,borderTopColor:"transparent",borderLeftColor:"transparent"}):u==="bottom"?hp(Na(Na({},m),pk(p,s,n,o,l)),{top:h,borderBottomColor:"transparent",borderRightColor:"transparent"}):{}}var LQ=Object.defineProperty,zQ=Object.defineProperties,FQ=Object.getOwnPropertyDescriptors,Tm=Object.getOwnPropertySymbols,aE=Object.prototype.hasOwnProperty,iE=Object.prototype.propertyIsEnumerable,mk=(e,t,n)=>t in e?LQ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,BQ=(e,t)=>{for(var n in t||(t={}))aE.call(t,n)&&mk(e,n,t[n]);if(Tm)for(var n of Tm(t))iE.call(t,n)&&mk(e,n,t[n]);return e},HQ=(e,t)=>zQ(e,FQ(t)),VQ=(e,t)=>{var n={};for(var r in e)aE.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Tm)for(var r of Tm(e))t.indexOf(r)<0&&iE.call(e,r)&&(n[r]=e[r]);return n};const lE=d.forwardRef((e,t)=>{var n=e,{position:r,arrowSize:o,arrowOffset:s,arrowRadius:i,arrowPosition:l,visible:u,arrowX:p,arrowY:m}=n,h=VQ(n,["position","arrowSize","arrowOffset","arrowRadius","arrowPosition","visible","arrowX","arrowY"]);const g=xa();return u?H.createElement("div",HQ(BQ({},h),{ref:t,style:$Q({position:r,arrowSize:o,arrowOffset:s,arrowRadius:i,arrowPosition:l,dir:g.dir,arrowX:p,arrowY:m})})):null});lE.displayName="@mantine/core/FloatingArrow";var WQ=Object.defineProperty,UQ=Object.defineProperties,GQ=Object.getOwnPropertyDescriptors,Nm=Object.getOwnPropertySymbols,cE=Object.prototype.hasOwnProperty,uE=Object.prototype.propertyIsEnumerable,hk=(e,t,n)=>t in e?WQ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ll=(e,t)=>{for(var n in t||(t={}))cE.call(t,n)&&hk(e,n,t[n]);if(Nm)for(var n of Nm(t))uE.call(t,n)&&hk(e,n,t[n]);return e},gp=(e,t)=>UQ(e,GQ(t)),KQ=(e,t)=>{var n={};for(var r in e)cE.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Nm)for(var r of Nm(e))t.indexOf(r)<0&&uE.call(e,r)&&(n[r]=e[r]);return n};const qQ={};function dE(e){var t;const n=Rn("PopoverDropdown",qQ,e),{style:r,className:o,children:s,onKeyDownCapture:i}=n,l=KQ(n,["style","className","children","onKeyDownCapture"]),u=eE(),{classes:p,cx:m}=jQ({radius:u.radius,shadow:u.shadow},{name:u.__staticSelector,classNames:u.classNames,styles:u.styles,unstyled:u.unstyled,variant:u.variant}),h=OG({opened:u.opened,shouldReturnFocus:u.returnFocus}),g=u.withRoles?{"aria-labelledby":u.getTargetId(),id:u.getDropdownId(),role:"dialog"}:{};return u.disabled?null:H.createElement(d6,gp(Ll({},u.portalProps),{withinPortal:u.withinPortal}),H.createElement(oE,gp(Ll({mounted:u.opened},u.transitionProps),{transition:u.transitionProps.transition||"fade",duration:(t=u.transitionProps.duration)!=null?t:150,keepMounted:u.keepMounted,exitDuration:typeof u.transitionProps.exitDuration=="number"?u.transitionProps.exitDuration:u.transitionProps.duration}),x=>{var y,b;return H.createElement(sE,{active:u.trapFocus},H.createElement(zr,Ll(gp(Ll({},g),{tabIndex:-1,ref:u.floating,style:gp(Ll(Ll({},r),x),{zIndex:u.zIndex,top:(y=u.y)!=null?y:0,left:(b=u.x)!=null?b:0,width:u.width==="target"?void 0:Re(u.width)}),className:m(p.dropdown,o),onKeyDownCapture:aG(u.onClose,{active:u.closeOnEscape,onTrigger:h,onKeyDown:i}),"data-position":u.placement}),l),s,H.createElement(lE,{ref:u.arrowRef,arrowX:u.arrowX,arrowY:u.arrowY,visible:u.withArrow,position:u.placement,arrowSize:u.arrowSize,arrowRadius:u.arrowRadius,arrowOffset:u.arrowOffset,arrowPosition:u.arrowPosition,className:p.arrow})))}))}dE.displayName="@mantine/core/PopoverDropdown";function XQ(e,t){if(e==="rtl"&&(t.includes("right")||t.includes("left"))){const[n,r]=t.split("-"),o=n==="right"?"left":"right";return r===void 0?o:`${o}-${r}`}return t}var gk=Object.getOwnPropertySymbols,QQ=Object.prototype.hasOwnProperty,YQ=Object.prototype.propertyIsEnumerable,ZQ=(e,t)=>{var n={};for(var r in e)QQ.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&gk)for(var r of gk(e))t.indexOf(r)<0&&YQ.call(e,r)&&(n[r]=e[r]);return n};const JQ={position:"bottom",offset:8,positionDependencies:[],transitionProps:{transition:"fade",duration:150},middlewares:{flip:!0,shift:!0,inline:!1},arrowSize:7,arrowOffset:5,arrowRadius:0,arrowPosition:"side",closeOnClickOutside:!0,withinPortal:!1,closeOnEscape:!0,trapFocus:!1,withRoles:!0,returnFocus:!1,clickOutsideEvents:["mousedown","touchstart"],zIndex:Zb("popover"),__staticSelector:"Popover",width:"max-content"};function Bc(e){var t,n,r,o,s,i;const l=d.useRef(null),u=Rn("Popover",JQ,e),{children:p,position:m,offset:h,onPositionChange:g,positionDependencies:x,opened:y,transitionProps:b,width:w,middlewares:S,withArrow:j,arrowSize:_,arrowOffset:E,arrowRadius:I,arrowPosition:M,unstyled:R,classNames:D,styles:A,closeOnClickOutside:O,withinPortal:T,portalProps:X,closeOnEscape:B,clickOutsideEvents:V,trapFocus:U,onClose:N,onOpen:$,onChange:q,zIndex:F,radius:Q,shadow:Y,id:se,defaultOpened:ae,__staticSelector:re,withRoles:G,disabled:K,returnFocus:ee,variant:le,keepMounted:J}=u,ie=ZQ(u,["children","position","offset","onPositionChange","positionDependencies","opened","transitionProps","width","middlewares","withArrow","arrowSize","arrowOffset","arrowRadius","arrowPosition","unstyled","classNames","styles","closeOnClickOutside","withinPortal","portalProps","closeOnEscape","clickOutsideEvents","trapFocus","onClose","onOpen","onChange","zIndex","radius","shadow","id","defaultOpened","__staticSelector","withRoles","disabled","returnFocus","variant","keepMounted"]),[de,ge]=d.useState(null),[Ce,he]=d.useState(null),fe=ey(se),Oe=xa(),_e=gQ({middlewares:S,width:w,position:XQ(Oe.dir,m),offset:typeof h=="number"?h+(j?_/2:0):h,arrowRef:l,arrowOffset:E,onPositionChange:g,positionDependencies:x,opened:y,defaultOpened:ae,onChange:q,onOpen:$,onClose:N});IG(()=>_e.opened&&O&&_e.onClose(),V,[de,Ce]);const Ne=d.useCallback($e=>{ge($e),_e.floating.reference($e)},[_e.floating.reference]),nt=d.useCallback($e=>{he($e),_e.floating.floating($e)},[_e.floating.floating]);return H.createElement(vQ,{value:{returnFocus:ee,disabled:K,controlled:_e.controlled,reference:Ne,floating:nt,x:_e.floating.x,y:_e.floating.y,arrowX:(r=(n=(t=_e.floating)==null?void 0:t.middlewareData)==null?void 0:n.arrow)==null?void 0:r.x,arrowY:(i=(s=(o=_e.floating)==null?void 0:o.middlewareData)==null?void 0:s.arrow)==null?void 0:i.y,opened:_e.opened,arrowRef:l,transitionProps:b,width:w,withArrow:j,arrowSize:_,arrowOffset:E,arrowRadius:I,arrowPosition:M,placement:_e.floating.placement,trapFocus:U,withinPortal:T,portalProps:X,zIndex:F,radius:Q,shadow:Y,closeOnEscape:B,onClose:_e.onClose,onToggle:_e.onToggle,getTargetId:()=>`${fe}-target`,getDropdownId:()=>`${fe}-dropdown`,withRoles:G,targetProps:ie,__staticSelector:re,classNames:D,styles:A,unstyled:R,variant:le,keepMounted:J}},p)}Bc.Target=rE;Bc.Dropdown=dE;Bc.displayName="@mantine/core/Popover";var eY=Object.defineProperty,$m=Object.getOwnPropertySymbols,fE=Object.prototype.hasOwnProperty,pE=Object.prototype.propertyIsEnumerable,vk=(e,t,n)=>t in e?eY(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,tY=(e,t)=>{for(var n in t||(t={}))fE.call(t,n)&&vk(e,n,t[n]);if($m)for(var n of $m(t))pE.call(t,n)&&vk(e,n,t[n]);return e},nY=(e,t)=>{var n={};for(var r in e)fE.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&$m)for(var r of $m(e))t.indexOf(r)<0&&pE.call(e,r)&&(n[r]=e[r]);return n};function rY(e){var t=e,{children:n,component:r="div",maxHeight:o=220,direction:s="column",id:i,innerRef:l,__staticSelector:u,styles:p,classNames:m,unstyled:h}=t,g=nY(t,["children","component","maxHeight","direction","id","innerRef","__staticSelector","styles","classNames","unstyled"]);const{classes:x}=LX(null,{name:u,styles:p,classNames:m,unstyled:h});return H.createElement(Bc.Dropdown,tY({p:0,onMouseDown:y=>y.preventDefault()},g),H.createElement("div",{style:{maxHeight:Re(o),display:"flex"}},H.createElement(zr,{component:r||"div",id:`${i}-items`,"aria-labelledby":`${i}-label`,role:"listbox",onMouseDown:y=>y.preventDefault(),style:{flex:1,overflowY:r!==og?"auto":void 0},"data-combobox-popover":!0,tabIndex:-1,ref:l},H.createElement("div",{className:x.itemsWrapper,style:{flexDirection:s}},n))))}function Ka({opened:e,transitionProps:t={transition:"fade",duration:0},shadow:n,withinPortal:r,portalProps:o,children:s,__staticSelector:i,onDirectionChange:l,switchDirectionOnFlip:u,zIndex:p,dropdownPosition:m,positionDependencies:h=[],classNames:g,styles:x,unstyled:y,readOnly:b,variant:w}){return H.createElement(Bc,{unstyled:y,classNames:g,styles:x,width:"target",withRoles:!1,opened:e,middlewares:{flip:m==="flip",shift:!1},position:m==="flip"?"bottom":m,positionDependencies:h,zIndex:p,__staticSelector:i,withinPortal:r,portalProps:o,transitionProps:t,shadow:n,disabled:b,onPositionChange:S=>u&&(l==null?void 0:l(S==="top"?"column-reverse":"column")),variant:w},s)}Ka.Target=Bc.Target;Ka.Dropdown=rY;var oY=Object.defineProperty,sY=Object.defineProperties,aY=Object.getOwnPropertyDescriptors,Lm=Object.getOwnPropertySymbols,mE=Object.prototype.hasOwnProperty,hE=Object.prototype.propertyIsEnumerable,xk=(e,t,n)=>t in e?oY(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,vp=(e,t)=>{for(var n in t||(t={}))mE.call(t,n)&&xk(e,n,t[n]);if(Lm)for(var n of Lm(t))hE.call(t,n)&&xk(e,n,t[n]);return e},iY=(e,t)=>sY(e,aY(t)),lY=(e,t)=>{var n={};for(var r in e)mE.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Lm)for(var r of Lm(e))t.indexOf(r)<0&&hE.call(e,r)&&(n[r]=e[r]);return n};function gE(e,t,n){const r=Rn(e,t,n),{label:o,description:s,error:i,required:l,classNames:u,styles:p,className:m,unstyled:h,__staticSelector:g,sx:x,errorProps:y,labelProps:b,descriptionProps:w,wrapperProps:S,id:j,size:_,style:E,inputContainer:I,inputWrapperOrder:M,withAsterisk:R,variant:D}=r,A=lY(r,["label","description","error","required","classNames","styles","className","unstyled","__staticSelector","sx","errorProps","labelProps","descriptionProps","wrapperProps","id","size","style","inputContainer","inputWrapperOrder","withAsterisk","variant"]),O=ey(j),{systemStyles:T,rest:X}=eg(A),B=vp({label:o,description:s,error:i,required:l,classNames:u,className:m,__staticSelector:g,sx:x,errorProps:y,labelProps:b,descriptionProps:w,unstyled:h,styles:p,id:O,size:_,style:E,inputContainer:I,inputWrapperOrder:M,withAsterisk:R,variant:D},S);return iY(vp({},X),{classNames:u,styles:p,unstyled:h,wrapperProps:vp(vp({},B),T),inputProps:{required:l,classNames:u,styles:p,unstyled:h,id:O,size:_,__staticSelector:g,error:i,variant:D}})}var cY=fr((e,t,{size:n})=>({label:{display:"inline-block",fontSize:mt({size:n,sizes:e.fontSizes}),fontWeight:500,color:e.colorScheme==="dark"?e.colors.dark[0]:e.colors.gray[9],wordBreak:"break-word",cursor:"default",WebkitTapHighlightColor:"transparent"},required:{color:e.fn.variant({variant:"filled",color:"red"}).background}}));const uY=cY;var dY=Object.defineProperty,zm=Object.getOwnPropertySymbols,vE=Object.prototype.hasOwnProperty,xE=Object.prototype.propertyIsEnumerable,bk=(e,t,n)=>t in e?dY(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,fY=(e,t)=>{for(var n in t||(t={}))vE.call(t,n)&&bk(e,n,t[n]);if(zm)for(var n of zm(t))xE.call(t,n)&&bk(e,n,t[n]);return e},pY=(e,t)=>{var n={};for(var r in e)vE.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&zm)for(var r of zm(e))t.indexOf(r)<0&&xE.call(e,r)&&(n[r]=e[r]);return n};const mY={labelElement:"label",size:"sm"},cy=d.forwardRef((e,t)=>{const n=Rn("InputLabel",mY,e),{labelElement:r,children:o,required:s,size:i,classNames:l,styles:u,unstyled:p,className:m,htmlFor:h,__staticSelector:g,variant:x,onMouseDown:y}=n,b=pY(n,["labelElement","children","required","size","classNames","styles","unstyled","className","htmlFor","__staticSelector","variant","onMouseDown"]),{classes:w,cx:S}=uY(null,{name:["InputWrapper",g],classNames:l,styles:u,unstyled:p,variant:x,size:i});return H.createElement(zr,fY({component:r,ref:t,className:S(w.label,m),htmlFor:r==="label"?h:void 0,onMouseDown:j=>{y==null||y(j),!j.defaultPrevented&&j.detail>1&&j.preventDefault()}},b),o,s&&H.createElement("span",{className:w.required,"aria-hidden":!0}," *"))});cy.displayName="@mantine/core/InputLabel";var hY=fr((e,t,{size:n})=>({error:{wordBreak:"break-word",color:e.fn.variant({variant:"filled",color:"red"}).background,fontSize:`calc(${mt({size:n,sizes:e.fontSizes})} - ${Re(2)})`,lineHeight:1.2,display:"block"}}));const gY=hY;var vY=Object.defineProperty,Fm=Object.getOwnPropertySymbols,bE=Object.prototype.hasOwnProperty,yE=Object.prototype.propertyIsEnumerable,yk=(e,t,n)=>t in e?vY(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,xY=(e,t)=>{for(var n in t||(t={}))bE.call(t,n)&&yk(e,n,t[n]);if(Fm)for(var n of Fm(t))yE.call(t,n)&&yk(e,n,t[n]);return e},bY=(e,t)=>{var n={};for(var r in e)bE.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Fm)for(var r of Fm(e))t.indexOf(r)<0&&yE.call(e,r)&&(n[r]=e[r]);return n};const yY={size:"sm"},uy=d.forwardRef((e,t)=>{const n=Rn("InputError",yY,e),{children:r,className:o,classNames:s,styles:i,unstyled:l,size:u,__staticSelector:p,variant:m}=n,h=bY(n,["children","className","classNames","styles","unstyled","size","__staticSelector","variant"]),{classes:g,cx:x}=gY(null,{name:["InputWrapper",p],classNames:s,styles:i,unstyled:l,variant:m,size:u});return H.createElement(wc,xY({className:x(g.error,o),ref:t},h),r)});uy.displayName="@mantine/core/InputError";var CY=fr((e,t,{size:n})=>({description:{wordBreak:"break-word",color:e.colorScheme==="dark"?e.colors.dark[2]:e.colors.gray[6],fontSize:`calc(${mt({size:n,sizes:e.fontSizes})} - ${Re(2)})`,lineHeight:1.2,display:"block"}}));const wY=CY;var SY=Object.defineProperty,Bm=Object.getOwnPropertySymbols,CE=Object.prototype.hasOwnProperty,wE=Object.prototype.propertyIsEnumerable,Ck=(e,t,n)=>t in e?SY(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,kY=(e,t)=>{for(var n in t||(t={}))CE.call(t,n)&&Ck(e,n,t[n]);if(Bm)for(var n of Bm(t))wE.call(t,n)&&Ck(e,n,t[n]);return e},jY=(e,t)=>{var n={};for(var r in e)CE.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Bm)for(var r of Bm(e))t.indexOf(r)<0&&wE.call(e,r)&&(n[r]=e[r]);return n};const _Y={size:"sm"},dy=d.forwardRef((e,t)=>{const n=Rn("InputDescription",_Y,e),{children:r,className:o,classNames:s,styles:i,unstyled:l,size:u,__staticSelector:p,variant:m}=n,h=jY(n,["children","className","classNames","styles","unstyled","size","__staticSelector","variant"]),{classes:g,cx:x}=wY(null,{name:["InputWrapper",p],classNames:s,styles:i,unstyled:l,variant:m,size:u});return H.createElement(wc,kY({color:"dimmed",className:x(g.description,o),ref:t,unstyled:l},h),r)});dy.displayName="@mantine/core/InputDescription";const SE=d.createContext({offsetBottom:!1,offsetTop:!1,describedBy:void 0}),IY=SE.Provider,PY=()=>d.useContext(SE);function EY(e,{hasDescription:t,hasError:n}){const r=e.findIndex(u=>u==="input"),o=e[r-1],s=e[r+1];return{offsetBottom:t&&s==="description"||n&&s==="error",offsetTop:t&&o==="description"||n&&o==="error"}}var MY=Object.defineProperty,OY=Object.defineProperties,RY=Object.getOwnPropertyDescriptors,wk=Object.getOwnPropertySymbols,DY=Object.prototype.hasOwnProperty,AY=Object.prototype.propertyIsEnumerable,Sk=(e,t,n)=>t in e?MY(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,TY=(e,t)=>{for(var n in t||(t={}))DY.call(t,n)&&Sk(e,n,t[n]);if(wk)for(var n of wk(t))AY.call(t,n)&&Sk(e,n,t[n]);return e},NY=(e,t)=>OY(e,RY(t)),$Y=fr(e=>({root:NY(TY({},e.fn.fontStyles()),{lineHeight:e.lineHeight})}));const LY=$Y;var zY=Object.defineProperty,FY=Object.defineProperties,BY=Object.getOwnPropertyDescriptors,Hm=Object.getOwnPropertySymbols,kE=Object.prototype.hasOwnProperty,jE=Object.prototype.propertyIsEnumerable,kk=(e,t,n)=>t in e?zY(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,$a=(e,t)=>{for(var n in t||(t={}))kE.call(t,n)&&kk(e,n,t[n]);if(Hm)for(var n of Hm(t))jE.call(t,n)&&kk(e,n,t[n]);return e},jk=(e,t)=>FY(e,BY(t)),HY=(e,t)=>{var n={};for(var r in e)kE.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Hm)for(var r of Hm(e))t.indexOf(r)<0&&jE.call(e,r)&&(n[r]=e[r]);return n};const VY={labelElement:"label",size:"sm",inputContainer:e=>e,inputWrapperOrder:["label","description","input","error"]},_E=d.forwardRef((e,t)=>{const n=Rn("InputWrapper",VY,e),{className:r,label:o,children:s,required:i,id:l,error:u,description:p,labelElement:m,labelProps:h,descriptionProps:g,errorProps:x,classNames:y,styles:b,size:w,inputContainer:S,__staticSelector:j,unstyled:_,inputWrapperOrder:E,withAsterisk:I,variant:M}=n,R=HY(n,["className","label","children","required","id","error","description","labelElement","labelProps","descriptionProps","errorProps","classNames","styles","size","inputContainer","__staticSelector","unstyled","inputWrapperOrder","withAsterisk","variant"]),{classes:D,cx:A}=LY(null,{classNames:y,styles:b,name:["InputWrapper",j],unstyled:_,variant:M,size:w}),O={classNames:y,styles:b,unstyled:_,size:w,variant:M,__staticSelector:j},T=typeof I=="boolean"?I:i,X=l?`${l}-error`:x==null?void 0:x.id,B=l?`${l}-description`:g==null?void 0:g.id,U=`${!!u&&typeof u!="boolean"?X:""} ${p?B:""}`,N=U.trim().length>0?U.trim():void 0,$=o&&H.createElement(cy,$a($a({key:"label",labelElement:m,id:l?`${l}-label`:void 0,htmlFor:l,required:T},O),h),o),q=p&&H.createElement(dy,jk($a($a({key:"description"},g),O),{size:(g==null?void 0:g.size)||O.size,id:(g==null?void 0:g.id)||B}),p),F=H.createElement(d.Fragment,{key:"input"},S(s)),Q=typeof u!="boolean"&&u&&H.createElement(uy,jk($a($a({},x),O),{size:(x==null?void 0:x.size)||O.size,key:"error",id:(x==null?void 0:x.id)||X}),u),Y=E.map(se=>{switch(se){case"label":return $;case"input":return F;case"description":return q;case"error":return Q;default:return null}});return H.createElement(IY,{value:$a({describedBy:N},EY(E,{hasDescription:!!q,hasError:!!Q}))},H.createElement(zr,$a({className:A(D.root,r),ref:t},R),Y))});_E.displayName="@mantine/core/InputWrapper";var WY=Object.defineProperty,Vm=Object.getOwnPropertySymbols,IE=Object.prototype.hasOwnProperty,PE=Object.prototype.propertyIsEnumerable,_k=(e,t,n)=>t in e?WY(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,UY=(e,t)=>{for(var n in t||(t={}))IE.call(t,n)&&_k(e,n,t[n]);if(Vm)for(var n of Vm(t))PE.call(t,n)&&_k(e,n,t[n]);return e},GY=(e,t)=>{var n={};for(var r in e)IE.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Vm)for(var r of Vm(e))t.indexOf(r)<0&&PE.call(e,r)&&(n[r]=e[r]);return n};const KY={},EE=d.forwardRef((e,t)=>{const n=Rn("InputPlaceholder",KY,e),{sx:r}=n,o=GY(n,["sx"]);return H.createElement(zr,UY({component:"span",sx:[s=>s.fn.placeholderStyles(),...EP(r)],ref:t},o))});EE.displayName="@mantine/core/InputPlaceholder";var qY=Object.defineProperty,XY=Object.defineProperties,QY=Object.getOwnPropertyDescriptors,Ik=Object.getOwnPropertySymbols,YY=Object.prototype.hasOwnProperty,ZY=Object.prototype.propertyIsEnumerable,Pk=(e,t,n)=>t in e?qY(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,xp=(e,t)=>{for(var n in t||(t={}))YY.call(t,n)&&Pk(e,n,t[n]);if(Ik)for(var n of Ik(t))ZY.call(t,n)&&Pk(e,n,t[n]);return e},Pv=(e,t)=>XY(e,QY(t));const mo={xs:Re(30),sm:Re(36),md:Re(42),lg:Re(50),xl:Re(60)},JY=["default","filled","unstyled"];function eZ({theme:e,variant:t}){return JY.includes(t)?t==="default"?{border:`${Re(1)} solid ${e.colorScheme==="dark"?e.colors.dark[4]:e.colors.gray[4]}`,backgroundColor:e.colorScheme==="dark"?e.colors.dark[6]:e.white,transition:"border-color 100ms ease","&:focus, &:focus-within":e.focusRingStyles.inputStyles(e)}:t==="filled"?{border:`${Re(1)} solid transparent`,backgroundColor:e.colorScheme==="dark"?e.colors.dark[5]:e.colors.gray[1],"&:focus, &:focus-within":e.focusRingStyles.inputStyles(e)}:{borderWidth:0,color:e.colorScheme==="dark"?e.colors.dark[0]:e.black,backgroundColor:"transparent",minHeight:Re(28),outline:0,"&:focus, &:focus-within":{outline:"none",borderColor:"transparent"},"&:disabled":{backgroundColor:"transparent","&:focus, &:focus-within":{outline:"none",borderColor:"transparent"}}}:null}var tZ=fr((e,{multiline:t,radius:n,invalid:r,rightSectionWidth:o,withRightSection:s,iconWidth:i,offsetBottom:l,offsetTop:u,pointer:p},{variant:m,size:h})=>{const g=e.fn.variant({variant:"filled",color:"red"}).background,x=m==="default"||m==="filled"?{minHeight:mt({size:h,sizes:mo}),paddingLeft:`calc(${mt({size:h,sizes:mo})} / 3)`,paddingRight:s?o||mt({size:h,sizes:mo}):`calc(${mt({size:h,sizes:mo})} / 3)`,borderRadius:e.fn.radius(n)}:m==="unstyled"&&s?{paddingRight:o||mt({size:h,sizes:mo})}:null;return{wrapper:{position:"relative",marginTop:u?`calc(${e.spacing.xs} / 2)`:void 0,marginBottom:l?`calc(${e.spacing.xs} / 2)`:void 0,"&:has(input:disabled)":{"& .mantine-Input-rightSection":{display:"none"}}},input:Pv(xp(xp(Pv(xp({},e.fn.fontStyles()),{height:t?m==="unstyled"?void 0:"auto":mt({size:h,sizes:mo}),WebkitTapHighlightColor:"transparent",lineHeight:t?e.lineHeight:`calc(${mt({size:h,sizes:mo})} - ${Re(2)})`,appearance:"none",resize:"none",boxSizing:"border-box",fontSize:mt({size:h,sizes:e.fontSizes}),width:"100%",color:e.colorScheme==="dark"?e.colors.dark[0]:e.black,display:"block",textAlign:"left",cursor:p?"pointer":void 0}),eZ({theme:e,variant:m})),x),{"&:disabled, &[data-disabled]":{backgroundColor:e.colorScheme==="dark"?e.colors.dark[6]:e.colors.gray[1],color:e.colors.dark[2],opacity:.6,cursor:"not-allowed",pointerEvents:"none","&::placeholder":{color:e.colors.dark[2]}},"&[data-invalid]":{color:g,borderColor:g,"&::placeholder":{opacity:1,color:g}},"&[data-with-icon]":{paddingLeft:typeof i=="number"?Re(i):mt({size:h,sizes:mo})},"&::placeholder":Pv(xp({},e.fn.placeholderStyles()),{opacity:1}),"&::-webkit-inner-spin-button, &::-webkit-outer-spin-button, &::-webkit-search-decoration, &::-webkit-search-cancel-button, &::-webkit-search-results-button, &::-webkit-search-results-decoration":{appearance:"none"},"&[type=number]":{MozAppearance:"textfield"}}),icon:{pointerEvents:"none",position:"absolute",zIndex:1,left:0,top:0,bottom:0,display:"flex",alignItems:"center",justifyContent:"center",width:i?Re(i):mt({size:h,sizes:mo}),color:r?e.colors.red[e.colorScheme==="dark"?6:7]:e.colorScheme==="dark"?e.colors.dark[2]:e.colors.gray[5]},rightSection:{position:"absolute",top:0,bottom:0,right:0,display:"flex",alignItems:"center",justifyContent:"center",width:o||mt({size:h,sizes:mo})}}});const nZ=tZ;var rZ=Object.defineProperty,oZ=Object.defineProperties,sZ=Object.getOwnPropertyDescriptors,Wm=Object.getOwnPropertySymbols,ME=Object.prototype.hasOwnProperty,OE=Object.prototype.propertyIsEnumerable,Ek=(e,t,n)=>t in e?rZ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,bp=(e,t)=>{for(var n in t||(t={}))ME.call(t,n)&&Ek(e,n,t[n]);if(Wm)for(var n of Wm(t))OE.call(t,n)&&Ek(e,n,t[n]);return e},Mk=(e,t)=>oZ(e,sZ(t)),aZ=(e,t)=>{var n={};for(var r in e)ME.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Wm)for(var r of Wm(e))t.indexOf(r)<0&&OE.call(e,r)&&(n[r]=e[r]);return n};const iZ={size:"sm",variant:"default"},il=d.forwardRef((e,t)=>{const n=Rn("Input",iZ,e),{className:r,error:o,required:s,disabled:i,variant:l,icon:u,style:p,rightSectionWidth:m,iconWidth:h,rightSection:g,rightSectionProps:x,radius:y,size:b,wrapperProps:w,classNames:S,styles:j,__staticSelector:_,multiline:E,sx:I,unstyled:M,pointer:R}=n,D=aZ(n,["className","error","required","disabled","variant","icon","style","rightSectionWidth","iconWidth","rightSection","rightSectionProps","radius","size","wrapperProps","classNames","styles","__staticSelector","multiline","sx","unstyled","pointer"]),{offsetBottom:A,offsetTop:O,describedBy:T}=PY(),{classes:X,cx:B}=nZ({radius:y,multiline:E,invalid:!!o,rightSectionWidth:m?Re(m):void 0,iconWidth:h,withRightSection:!!g,offsetBottom:A,offsetTop:O,pointer:R},{classNames:S,styles:j,name:["Input",_],unstyled:M,variant:l,size:b}),{systemStyles:V,rest:U}=eg(D);return H.createElement(zr,bp(bp({className:B(X.wrapper,r),sx:I,style:p},V),w),u&&H.createElement("div",{className:X.icon},u),H.createElement(zr,Mk(bp({component:"input"},U),{ref:t,required:s,"aria-invalid":!!o,"aria-describedby":T,disabled:i,"data-disabled":i||void 0,"data-with-icon":!!u||void 0,"data-invalid":!!o||void 0,className:X.input})),g&&H.createElement("div",Mk(bp({},x),{className:X.rightSection}),g))});il.displayName="@mantine/core/Input";il.Wrapper=_E;il.Label=cy;il.Description=dy;il.Error=uy;il.Placeholder=EE;const _c=il;var lZ=Object.defineProperty,Um=Object.getOwnPropertySymbols,RE=Object.prototype.hasOwnProperty,DE=Object.prototype.propertyIsEnumerable,Ok=(e,t,n)=>t in e?lZ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Rk=(e,t)=>{for(var n in t||(t={}))RE.call(t,n)&&Ok(e,n,t[n]);if(Um)for(var n of Um(t))DE.call(t,n)&&Ok(e,n,t[n]);return e},cZ=(e,t)=>{var n={};for(var r in e)RE.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Um)for(var r of Um(e))t.indexOf(r)<0&&DE.call(e,r)&&(n[r]=e[r]);return n};const uZ={multiple:!1},AE=d.forwardRef((e,t)=>{const n=Rn("FileButton",uZ,e),{onChange:r,children:o,multiple:s,accept:i,name:l,form:u,resetRef:p,disabled:m,capture:h,inputProps:g}=n,x=cZ(n,["onChange","children","multiple","accept","name","form","resetRef","disabled","capture","inputProps"]),y=d.useRef(),b=()=>{!m&&y.current.click()},w=j=>{r(s?Array.from(j.currentTarget.files):j.currentTarget.files[0]||null)};return zP(p,()=>{y.current.value=""}),H.createElement(H.Fragment,null,o(Rk({onClick:b},x)),H.createElement("input",Rk({style:{display:"none"},type:"file",accept:i,multiple:s,onChange:w,ref:Bd(t,y),name:l,form:u,capture:h},g)))});AE.displayName="@mantine/core/FileButton";const TE={xs:Re(16),sm:Re(22),md:Re(26),lg:Re(30),xl:Re(36)},dZ={xs:Re(10),sm:Re(12),md:Re(14),lg:Re(16),xl:Re(18)};var fZ=fr((e,{disabled:t,radius:n,readOnly:r},{size:o,variant:s})=>({defaultValue:{display:"flex",alignItems:"center",backgroundColor:t?e.colorScheme==="dark"?e.colors.dark[5]:e.colors.gray[3]:e.colorScheme==="dark"?e.colors.dark[7]:s==="filled"?e.white:e.colors.gray[1],color:t?e.colorScheme==="dark"?e.colors.dark[1]:e.colors.gray[7]:e.colorScheme==="dark"?e.colors.dark[0]:e.colors.gray[7],height:mt({size:o,sizes:TE}),paddingLeft:`calc(${mt({size:o,sizes:e.spacing})} / 1.5)`,paddingRight:t||r?mt({size:o,sizes:e.spacing}):0,fontWeight:500,fontSize:mt({size:o,sizes:dZ}),borderRadius:mt({size:n,sizes:e.radius}),cursor:t?"not-allowed":"default",userSelect:"none",maxWidth:`calc(100% - ${Re(10)})`},defaultValueRemove:{color:e.colorScheme==="dark"?e.colors.dark[0]:e.colors.gray[7],marginLeft:`calc(${mt({size:o,sizes:e.spacing})} / 6)`},defaultValueLabel:{display:"block",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}}));const pZ=fZ;var mZ=Object.defineProperty,Gm=Object.getOwnPropertySymbols,NE=Object.prototype.hasOwnProperty,$E=Object.prototype.propertyIsEnumerable,Dk=(e,t,n)=>t in e?mZ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,hZ=(e,t)=>{for(var n in t||(t={}))NE.call(t,n)&&Dk(e,n,t[n]);if(Gm)for(var n of Gm(t))$E.call(t,n)&&Dk(e,n,t[n]);return e},gZ=(e,t)=>{var n={};for(var r in e)NE.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Gm)for(var r of Gm(e))t.indexOf(r)<0&&$E.call(e,r)&&(n[r]=e[r]);return n};const vZ={xs:16,sm:22,md:24,lg:26,xl:30};function LE(e){var t=e,{label:n,classNames:r,styles:o,className:s,onRemove:i,disabled:l,readOnly:u,size:p,radius:m="sm",variant:h,unstyled:g}=t,x=gZ(t,["label","classNames","styles","className","onRemove","disabled","readOnly","size","radius","variant","unstyled"]);const{classes:y,cx:b}=pZ({disabled:l,readOnly:u,radius:m},{name:"MultiSelect",classNames:r,styles:o,unstyled:g,size:p,variant:h});return H.createElement("div",hZ({className:b(y.defaultValue,s)},x),H.createElement("span",{className:y.defaultValueLabel},n),!l&&!u&&H.createElement(x6,{"aria-hidden":!0,onMouseDown:i,size:vZ[p],radius:2,color:"blue",variant:"transparent",iconSize:"70%",className:y.defaultValueRemove,tabIndex:-1,unstyled:g}))}LE.displayName="@mantine/core/MultiSelect/DefaultValue";function xZ({data:e,searchable:t,limit:n,searchValue:r,filter:o,value:s,disableSelectedItemFiltering:i}){if(!t&&s.length===0)return e;if(!t){const u=[];for(let p=0;pm===e[p].value&&!e[p].disabled))&&u.push(e[p]);return u}const l=[];for(let u=0;up===e[u].value&&!e[u].disabled),e[u])&&l.push(e[u]),!(l.length>=n));u+=1);return l}var bZ=Object.defineProperty,Km=Object.getOwnPropertySymbols,zE=Object.prototype.hasOwnProperty,FE=Object.prototype.propertyIsEnumerable,Ak=(e,t,n)=>t in e?bZ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Tk=(e,t)=>{for(var n in t||(t={}))zE.call(t,n)&&Ak(e,n,t[n]);if(Km)for(var n of Km(t))FE.call(t,n)&&Ak(e,n,t[n]);return e},yZ=(e,t)=>{var n={};for(var r in e)zE.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Km)for(var r of Km(e))t.indexOf(r)<0&&FE.call(e,r)&&(n[r]=e[r]);return n};const CZ={xs:Re(14),sm:Re(18),md:Re(20),lg:Re(24),xl:Re(28)};function wZ(e){var t=e,{size:n,error:r,style:o}=t,s=yZ(t,["size","error","style"]);const i=xa(),l=mt({size:n,sizes:CZ});return H.createElement("svg",Tk({viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:Tk({color:r?i.colors.red[6]:i.colors.gray[6],width:l,height:l},o),"data-chevron":!0},s),H.createElement("path",{d:"M4.93179 5.43179C4.75605 5.60753 4.75605 5.89245 4.93179 6.06819C5.10753 6.24392 5.39245 6.24392 5.56819 6.06819L7.49999 4.13638L9.43179 6.06819C9.60753 6.24392 9.89245 6.24392 10.0682 6.06819C10.2439 5.89245 10.2439 5.60753 10.0682 5.43179L7.81819 3.18179C7.73379 3.0974 7.61933 3.04999 7.49999 3.04999C7.38064 3.04999 7.26618 3.0974 7.18179 3.18179L4.93179 5.43179ZM10.0682 9.56819C10.2439 9.39245 10.2439 9.10753 10.0682 8.93179C9.89245 8.75606 9.60753 8.75606 9.43179 8.93179L7.49999 10.8636L5.56819 8.93179C5.39245 8.75606 5.10753 8.75606 4.93179 8.93179C4.75605 9.10753 4.75605 9.39245 4.93179 9.56819L7.18179 11.8182C7.35753 11.9939 7.64245 11.9939 7.81819 11.8182L10.0682 9.56819Z",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd"}))}var SZ=Object.defineProperty,kZ=Object.defineProperties,jZ=Object.getOwnPropertyDescriptors,Nk=Object.getOwnPropertySymbols,_Z=Object.prototype.hasOwnProperty,IZ=Object.prototype.propertyIsEnumerable,$k=(e,t,n)=>t in e?SZ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,PZ=(e,t)=>{for(var n in t||(t={}))_Z.call(t,n)&&$k(e,n,t[n]);if(Nk)for(var n of Nk(t))IZ.call(t,n)&&$k(e,n,t[n]);return e},EZ=(e,t)=>kZ(e,jZ(t));function BE({shouldClear:e,clearButtonProps:t,onClear:n,size:r,error:o}){return e?H.createElement(x6,EZ(PZ({},t),{variant:"transparent",onClick:n,size:r,onMouseDown:s=>s.preventDefault()})):H.createElement(wZ,{error:o,size:r})}BE.displayName="@mantine/core/SelectRightSection";var MZ=Object.defineProperty,OZ=Object.defineProperties,RZ=Object.getOwnPropertyDescriptors,qm=Object.getOwnPropertySymbols,HE=Object.prototype.hasOwnProperty,VE=Object.prototype.propertyIsEnumerable,Lk=(e,t,n)=>t in e?MZ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ev=(e,t)=>{for(var n in t||(t={}))HE.call(t,n)&&Lk(e,n,t[n]);if(qm)for(var n of qm(t))VE.call(t,n)&&Lk(e,n,t[n]);return e},zk=(e,t)=>OZ(e,RZ(t)),DZ=(e,t)=>{var n={};for(var r in e)HE.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&qm)for(var r of qm(e))t.indexOf(r)<0&&VE.call(e,r)&&(n[r]=e[r]);return n};function WE(e){var t=e,{styles:n,rightSection:r,rightSectionWidth:o,theme:s}=t,i=DZ(t,["styles","rightSection","rightSectionWidth","theme"]);if(r)return{rightSection:r,rightSectionWidth:o,styles:n};const l=typeof n=="function"?n(s):n;return{rightSection:!i.readOnly&&!(i.disabled&&i.shouldClear)&&H.createElement(BE,Ev({},i)),styles:zk(Ev({},l),{rightSection:zk(Ev({},l==null?void 0:l.rightSection),{pointerEvents:i.shouldClear?void 0:"none"})})}}var AZ=Object.defineProperty,TZ=Object.defineProperties,NZ=Object.getOwnPropertyDescriptors,Fk=Object.getOwnPropertySymbols,$Z=Object.prototype.hasOwnProperty,LZ=Object.prototype.propertyIsEnumerable,Bk=(e,t,n)=>t in e?AZ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,zZ=(e,t)=>{for(var n in t||(t={}))$Z.call(t,n)&&Bk(e,n,t[n]);if(Fk)for(var n of Fk(t))LZ.call(t,n)&&Bk(e,n,t[n]);return e},FZ=(e,t)=>TZ(e,NZ(t)),BZ=fr((e,{invalid:t},{size:n})=>({wrapper:{position:"relative","&:has(input:disabled)":{cursor:"not-allowed",pointerEvents:"none","& .mantine-MultiSelect-input":{backgroundColor:e.colorScheme==="dark"?e.colors.dark[6]:e.colors.gray[1],color:e.colors.dark[2],opacity:.6,"&::placeholder":{color:e.colors.dark[2]}},"& .mantine-MultiSelect-defaultValue":{backgroundColor:e.colorScheme==="dark"?e.colors.dark[5]:e.colors.gray[3],color:e.colorScheme==="dark"?e.colors.dark[1]:e.colors.gray[7]}}},values:{minHeight:`calc(${mt({size:n,sizes:mo})} - ${Re(2)})`,display:"flex",alignItems:"center",flexWrap:"wrap",marginLeft:`calc(-${e.spacing.xs} / 2)`,boxSizing:"border-box","&[data-clearable]":{marginRight:mt({size:n,sizes:mo})}},value:{margin:`calc(${e.spacing.xs} / 2 - ${Re(2)}) calc(${e.spacing.xs} / 2)`},searchInput:FZ(zZ({},e.fn.fontStyles()),{flex:1,minWidth:Re(60),backgroundColor:"transparent",border:0,outline:0,fontSize:mt({size:n,sizes:e.fontSizes}),padding:0,marginLeft:`calc(${e.spacing.xs} / 2)`,appearance:"none",color:"inherit",maxHeight:mt({size:n,sizes:TE}),"&::placeholder":{opacity:1,color:t?e.colors.red[e.fn.primaryShade()]:e.colorScheme==="dark"?e.colors.dark[3]:e.colors.gray[5]},"&:disabled":{cursor:"not-allowed",pointerEvents:"none"}}),searchInputEmpty:{width:"100%"},searchInputInputHidden:{flex:0,width:0,minWidth:0,margin:0,overflow:"hidden"},searchInputPointer:{cursor:"pointer","&:disabled":{cursor:"not-allowed",pointerEvents:"none"}},input:{cursor:"pointer","&:disabled":{cursor:"not-allowed",pointerEvents:"none"}}}));const HZ=BZ;var VZ=Object.defineProperty,WZ=Object.defineProperties,UZ=Object.getOwnPropertyDescriptors,Xm=Object.getOwnPropertySymbols,UE=Object.prototype.hasOwnProperty,GE=Object.prototype.propertyIsEnumerable,Hk=(e,t,n)=>t in e?VZ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,zl=(e,t)=>{for(var n in t||(t={}))UE.call(t,n)&&Hk(e,n,t[n]);if(Xm)for(var n of Xm(t))GE.call(t,n)&&Hk(e,n,t[n]);return e},Vk=(e,t)=>WZ(e,UZ(t)),GZ=(e,t)=>{var n={};for(var r in e)UE.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Xm)for(var r of Xm(e))t.indexOf(r)<0&&GE.call(e,r)&&(n[r]=e[r]);return n};function KZ(e,t,n){return t?!1:n.label.toLowerCase().trim().includes(e.toLowerCase().trim())}function qZ(e,t){return!!e&&!t.some(n=>n.value.toLowerCase()===e.toLowerCase())}function Wk(e,t){if(!Array.isArray(e))return;if(t.length===0)return[];const n=t.map(r=>typeof r=="object"?r.value:r);return e.filter(r=>n.includes(r))}const XZ={size:"sm",valueComponent:LE,itemComponent:ny,transitionProps:{transition:"fade",duration:0},maxDropdownHeight:220,shadow:"sm",searchable:!1,filter:KZ,limit:1/0,clearSearchOnChange:!0,clearable:!1,clearSearchOnBlur:!1,disabled:!1,initiallyOpened:!1,creatable:!1,shouldCreate:qZ,switchDirectionOnFlip:!1,zIndex:Zb("popover"),selectOnBlur:!1,positionDependencies:[],dropdownPosition:"flip"},KE=d.forwardRef((e,t)=>{const n=Rn("MultiSelect",XZ,e),{className:r,style:o,required:s,label:i,description:l,size:u,error:p,classNames:m,styles:h,wrapperProps:g,value:x,defaultValue:y,data:b,onChange:w,valueComponent:S,itemComponent:j,id:_,transitionProps:E,maxDropdownHeight:I,shadow:M,nothingFound:R,onFocus:D,onBlur:A,searchable:O,placeholder:T,filter:X,limit:B,clearSearchOnChange:V,clearable:U,clearSearchOnBlur:N,variant:$,onSearchChange:q,searchValue:F,disabled:Q,initiallyOpened:Y,radius:se,icon:ae,rightSection:re,rightSectionWidth:G,creatable:K,getCreateLabel:ee,shouldCreate:le,onCreate:J,sx:ie,dropdownComponent:de,onDropdownClose:ge,onDropdownOpen:Ce,maxSelectedValues:he,withinPortal:fe,portalProps:Oe,switchDirectionOnFlip:_e,zIndex:Ne,selectOnBlur:nt,name:$e,dropdownPosition:Pt,errorProps:Ze,labelProps:ot,descriptionProps:ye,form:De,positionDependencies:ut,onKeyDown:bt,unstyled:be,inputContainer:Je,inputWrapperOrder:lt,readOnly:ft,withAsterisk:Me,clearButtonProps:Le,hoverOnSearchChange:Ut,disableSelectedItemFiltering:Se}=n,Be=GZ(n,["className","style","required","label","description","size","error","classNames","styles","wrapperProps","value","defaultValue","data","onChange","valueComponent","itemComponent","id","transitionProps","maxDropdownHeight","shadow","nothingFound","onFocus","onBlur","searchable","placeholder","filter","limit","clearSearchOnChange","clearable","clearSearchOnBlur","variant","onSearchChange","searchValue","disabled","initiallyOpened","radius","icon","rightSection","rightSectionWidth","creatable","getCreateLabel","shouldCreate","onCreate","sx","dropdownComponent","onDropdownClose","onDropdownOpen","maxSelectedValues","withinPortal","portalProps","switchDirectionOnFlip","zIndex","selectOnBlur","name","dropdownPosition","errorProps","labelProps","descriptionProps","form","positionDependencies","onKeyDown","unstyled","inputContainer","inputWrapperOrder","readOnly","withAsterisk","clearButtonProps","hoverOnSearchChange","disableSelectedItemFiltering"]),{classes:ze,cx:Ge,theme:pt}=HZ({invalid:!!p},{name:"MultiSelect",classNames:m,styles:h,unstyled:be,size:u,variant:$}),{systemStyles:Pn,rest:Dt}=eg(Be),At=d.useRef(),pr=d.useRef({}),Ln=ey(_),[kn,gn]=d.useState(Y),[an,kr]=d.useState(-1),[Mo,mr]=d.useState("column"),[hr,Ns]=od({value:F,defaultValue:"",finalValue:void 0,onChange:q}),[$s,wa]=d.useState(!1),{scrollIntoView:Sa,targetRef:ml,scrollableRef:ka}=BP({duration:0,offset:5,cancelable:!1,isList:!0}),hl=K&&typeof ee=="function";let Qe=null;const Gt=b.map(rt=>typeof rt=="string"?{label:rt,value:rt}:rt),zn=MP({data:Gt}),[St,ja]=od({value:Wk(x,b),defaultValue:Wk(y,b),finalValue:[],onChange:w}),Wr=d.useRef(!!he&&he{if(!ft){const Mt=St.filter(kt=>kt!==rt);ja(Mt),he&&Mt.length{Ns(rt.currentTarget.value),!Q&&!Wr.current&&O&&gn(!0)},Fg=rt=>{typeof D=="function"&&D(rt),!Q&&!Wr.current&&O&&gn(!0)},Fn=xZ({data:zn,searchable:O,searchValue:hr,limit:B,filter:X,value:St,disableSelectedItemFiltering:Se});hl&&le(hr,zn)&&(Qe=ee(hr),Fn.push({label:hr,value:hr,creatable:!0}));const Ls=Math.min(an,Fn.length-1),tf=(rt,Mt,kt)=>{let Ot=rt;for(;kt(Ot);)if(Ot=Mt(Ot),!Fn[Ot].disabled)return Ot;return rt};Uo(()=>{kr(Ut&&hr?0:-1)},[hr,Ut]),Uo(()=>{!Q&&St.length>b.length&&gn(!1),he&&St.length=he&&(Wr.current=!0,gn(!1))},[St]);const gl=rt=>{if(!ft)if(V&&Ns(""),St.includes(rt.value))ef(rt.value);else{if(rt.creatable&&typeof J=="function"){const Mt=J(rt.value);typeof Mt<"u"&&Mt!==null&&ja(typeof Mt=="string"?[...St,Mt]:[...St,Mt.value])}else ja([...St,rt.value]);St.length===he-1&&(Wr.current=!0,gn(!1)),Fn.length===1&&gn(!1)}},Zc=rt=>{typeof A=="function"&&A(rt),nt&&Fn[Ls]&&kn&&gl(Fn[Ls]),N&&Ns(""),gn(!1)},mi=rt=>{if($s||(bt==null||bt(rt),ft)||rt.key!=="Backspace"&&he&&Wr.current)return;const Mt=Mo==="column",kt=()=>{kr(rr=>{var rn;const Dn=tf(rr,gr=>gr+1,gr=>gr{kr(rr=>{var rn;const Dn=tf(rr,gr=>gr-1,gr=>gr>0);return kn&&(ml.current=pr.current[(rn=Fn[Dn])==null?void 0:rn.value],Sa({alignment:Mt?"start":"end"})),Dn})};switch(rt.key){case"ArrowUp":{rt.preventDefault(),gn(!0),Mt?Ot():kt();break}case"ArrowDown":{rt.preventDefault(),gn(!0),Mt?kt():Ot();break}case"Enter":{rt.preventDefault(),Fn[Ls]&&kn?gl(Fn[Ls]):gn(!0);break}case" ":{O||(rt.preventDefault(),Fn[Ls]&&kn?gl(Fn[Ls]):gn(!0));break}case"Backspace":{St.length>0&&hr.length===0&&(ja(St.slice(0,-1)),gn(!0),he&&(Wr.current=!1));break}case"Home":{if(!O){rt.preventDefault(),kn||gn(!0);const rr=Fn.findIndex(rn=>!rn.disabled);kr(rr),Sa({alignment:Mt?"end":"start"})}break}case"End":{if(!O){rt.preventDefault(),kn||gn(!0);const rr=Fn.map(rn=>!!rn.disabled).lastIndexOf(!1);kr(rr),Sa({alignment:Mt?"end":"start"})}break}case"Escape":gn(!1)}},Jc=St.map(rt=>{let Mt=zn.find(kt=>kt.value===rt&&!kt.disabled);return!Mt&&hl&&(Mt={value:rt,label:rt}),Mt}).filter(rt=>!!rt).map((rt,Mt)=>H.createElement(S,Vk(zl({},rt),{variant:$,disabled:Q,className:ze.value,readOnly:ft,onRemove:kt=>{kt.preventDefault(),kt.stopPropagation(),ef(rt.value)},key:rt.value,size:u,styles:h,classNames:m,radius:se,index:Mt}))),eu=rt=>St.includes(rt),Bg=()=>{var rt;Ns(""),ja([]),(rt=At.current)==null||rt.focus(),he&&(Wr.current=!1)},_a=!ft&&(Fn.length>0?kn:kn&&!!R);return Uo(()=>{const rt=_a?Ce:ge;typeof rt=="function"&&rt()},[_a]),H.createElement(_c.Wrapper,zl(zl({required:s,id:Ln,label:i,error:p,description:l,size:u,className:r,style:o,classNames:m,styles:h,__staticSelector:"MultiSelect",sx:ie,errorProps:Ze,descriptionProps:ye,labelProps:ot,inputContainer:Je,inputWrapperOrder:lt,unstyled:be,withAsterisk:Me,variant:$},Pn),g),H.createElement(Ka,{opened:_a,transitionProps:E,shadow:"sm",withinPortal:fe,portalProps:Oe,__staticSelector:"MultiSelect",onDirectionChange:mr,switchDirectionOnFlip:_e,zIndex:Ne,dropdownPosition:Pt,positionDependencies:[...ut,hr],classNames:m,styles:h,unstyled:be,variant:$},H.createElement(Ka.Target,null,H.createElement("div",{className:ze.wrapper,role:"combobox","aria-haspopup":"listbox","aria-owns":kn&&_a?`${Ln}-items`:null,"aria-controls":Ln,"aria-expanded":kn,onMouseLeave:()=>kr(-1),tabIndex:-1},H.createElement("input",{type:"hidden",name:$e,value:St.join(","),form:De,disabled:Q}),H.createElement(_c,zl({__staticSelector:"MultiSelect",style:{overflow:"hidden"},component:"div",multiline:!0,size:u,variant:$,disabled:Q,error:p,required:s,radius:se,icon:ae,unstyled:be,onMouseDown:rt=>{var Mt;rt.preventDefault(),!Q&&!Wr.current&&gn(!kn),(Mt=At.current)==null||Mt.focus()},classNames:Vk(zl({},m),{input:Ge({[ze.input]:!O},m==null?void 0:m.input)})},WE({theme:pt,rightSection:re,rightSectionWidth:G,styles:h,size:u,shouldClear:U&&St.length>0,onClear:Bg,error:p,disabled:Q,clearButtonProps:Le,readOnly:ft})),H.createElement("div",{className:ze.values,"data-clearable":U||void 0},Jc,H.createElement("input",zl({ref:Bd(t,At),type:"search",id:Ln,className:Ge(ze.searchInput,{[ze.searchInputPointer]:!O,[ze.searchInputInputHidden]:!kn&&St.length>0||!O&&St.length>0,[ze.searchInputEmpty]:St.length===0}),onKeyDown:mi,value:hr,onChange:zg,onFocus:Fg,onBlur:Zc,readOnly:!O||Wr.current||ft,placeholder:St.length===0?T:void 0,disabled:Q,"data-mantine-stop-propagation":kn,autoComplete:"off",onCompositionStart:()=>wa(!0),onCompositionEnd:()=>wa(!1)},Dt)))))),H.createElement(Ka.Dropdown,{component:de||og,maxHeight:I,direction:Mo,id:Ln,innerRef:ka,__staticSelector:"MultiSelect",classNames:m,styles:h},H.createElement(ty,{data:Fn,hovered:Ls,classNames:m,styles:h,uuid:Ln,__staticSelector:"MultiSelect",onItemHover:kr,onItemSelect:gl,itemsRefs:pr,itemComponent:j,size:u,nothingFound:R,isItemSelected:eu,creatable:K&&!!Qe,createLabel:Qe,unstyled:be,variant:$}))))});KE.displayName="@mantine/core/MultiSelect";var QZ=Object.defineProperty,YZ=Object.defineProperties,ZZ=Object.getOwnPropertyDescriptors,Qm=Object.getOwnPropertySymbols,qE=Object.prototype.hasOwnProperty,XE=Object.prototype.propertyIsEnumerable,Uk=(e,t,n)=>t in e?QZ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Mv=(e,t)=>{for(var n in t||(t={}))qE.call(t,n)&&Uk(e,n,t[n]);if(Qm)for(var n of Qm(t))XE.call(t,n)&&Uk(e,n,t[n]);return e},JZ=(e,t)=>YZ(e,ZZ(t)),eJ=(e,t)=>{var n={};for(var r in e)qE.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Qm)for(var r of Qm(e))t.indexOf(r)<0&&XE.call(e,r)&&(n[r]=e[r]);return n};const tJ={type:"text",size:"sm",__staticSelector:"TextInput"},QE=d.forwardRef((e,t)=>{const n=gE("TextInput",tJ,e),{inputProps:r,wrapperProps:o}=n,s=eJ(n,["inputProps","wrapperProps"]);return H.createElement(_c.Wrapper,Mv({},o),H.createElement(_c,JZ(Mv(Mv({},r),s),{ref:t})))});QE.displayName="@mantine/core/TextInput";function nJ({data:e,searchable:t,limit:n,searchValue:r,filter:o,value:s,filterDataOnExactSearchMatch:i}){if(!t)return e;const l=s!=null&&e.find(p=>p.value===s)||null;if(l&&!i&&(l==null?void 0:l.label)===r){if(n){if(n>=e.length)return e;const p=e.indexOf(l),m=p+n,h=m-e.length;return h>0?e.slice(p-h):e.slice(p,m)}return e}const u=[];for(let p=0;p=n));p+=1);return u}var rJ=fr(()=>({input:{"&:not(:disabled)":{cursor:"pointer","&::selection":{backgroundColor:"transparent"}}}}));const oJ=rJ;var sJ=Object.defineProperty,aJ=Object.defineProperties,iJ=Object.getOwnPropertyDescriptors,Ym=Object.getOwnPropertySymbols,YE=Object.prototype.hasOwnProperty,ZE=Object.prototype.propertyIsEnumerable,Gk=(e,t,n)=>t in e?sJ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ju=(e,t)=>{for(var n in t||(t={}))YE.call(t,n)&&Gk(e,n,t[n]);if(Ym)for(var n of Ym(t))ZE.call(t,n)&&Gk(e,n,t[n]);return e},Ov=(e,t)=>aJ(e,iJ(t)),lJ=(e,t)=>{var n={};for(var r in e)YE.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Ym)for(var r of Ym(e))t.indexOf(r)<0&&ZE.call(e,r)&&(n[r]=e[r]);return n};function cJ(e,t){return t.label.toLowerCase().trim().includes(e.toLowerCase().trim())}function uJ(e,t){return!!e&&!t.some(n=>n.label.toLowerCase()===e.toLowerCase())}const dJ={required:!1,size:"sm",shadow:"sm",itemComponent:ny,transitionProps:{transition:"fade",duration:0},initiallyOpened:!1,filter:cJ,maxDropdownHeight:220,searchable:!1,clearable:!1,limit:1/0,disabled:!1,creatable:!1,shouldCreate:uJ,selectOnBlur:!1,switchDirectionOnFlip:!1,filterDataOnExactSearchMatch:!1,zIndex:Zb("popover"),positionDependencies:[],dropdownPosition:"flip"},fy=d.forwardRef((e,t)=>{const n=gE("Select",dJ,e),{inputProps:r,wrapperProps:o,shadow:s,data:i,value:l,defaultValue:u,onChange:p,itemComponent:m,onKeyDown:h,onBlur:g,onFocus:x,transitionProps:y,initiallyOpened:b,unstyled:w,classNames:S,styles:j,filter:_,maxDropdownHeight:E,searchable:I,clearable:M,nothingFound:R,limit:D,disabled:A,onSearchChange:O,searchValue:T,rightSection:X,rightSectionWidth:B,creatable:V,getCreateLabel:U,shouldCreate:N,selectOnBlur:$,onCreate:q,dropdownComponent:F,onDropdownClose:Q,onDropdownOpen:Y,withinPortal:se,portalProps:ae,switchDirectionOnFlip:re,zIndex:G,name:K,dropdownPosition:ee,allowDeselect:le,placeholder:J,filterDataOnExactSearchMatch:ie,form:de,positionDependencies:ge,readOnly:Ce,clearButtonProps:he,hoverOnSearchChange:fe}=n,Oe=lJ(n,["inputProps","wrapperProps","shadow","data","value","defaultValue","onChange","itemComponent","onKeyDown","onBlur","onFocus","transitionProps","initiallyOpened","unstyled","classNames","styles","filter","maxDropdownHeight","searchable","clearable","nothingFound","limit","disabled","onSearchChange","searchValue","rightSection","rightSectionWidth","creatable","getCreateLabel","shouldCreate","selectOnBlur","onCreate","dropdownComponent","onDropdownClose","onDropdownOpen","withinPortal","portalProps","switchDirectionOnFlip","zIndex","name","dropdownPosition","allowDeselect","placeholder","filterDataOnExactSearchMatch","form","positionDependencies","readOnly","clearButtonProps","hoverOnSearchChange"]),{classes:_e,cx:Ne,theme:nt}=oJ(),[$e,Pt]=d.useState(b),[Ze,ot]=d.useState(-1),ye=d.useRef(),De=d.useRef({}),[ut,bt]=d.useState("column"),be=ut==="column",{scrollIntoView:Je,targetRef:lt,scrollableRef:ft}=BP({duration:0,offset:5,cancelable:!1,isList:!0}),Me=le===void 0?M:le,Le=Qe=>{if($e!==Qe){Pt(Qe);const Gt=Qe?Y:Q;typeof Gt=="function"&&Gt()}},Ut=V&&typeof U=="function";let Se=null;const Be=i.map(Qe=>typeof Qe=="string"?{label:Qe,value:Qe}:Qe),ze=MP({data:Be}),[Ge,pt,Pn]=od({value:l,defaultValue:u,finalValue:null,onChange:p}),Dt=ze.find(Qe=>Qe.value===Ge),[At,pr]=od({value:T,defaultValue:(Dt==null?void 0:Dt.label)||"",finalValue:void 0,onChange:O}),Ln=Qe=>{pr(Qe),I&&typeof O=="function"&&O(Qe)},kn=()=>{var Qe;Ce||(pt(null),Pn||Ln(""),(Qe=ye.current)==null||Qe.focus())};d.useEffect(()=>{const Qe=ze.find(Gt=>Gt.value===Ge);Qe?Ln(Qe.label):(!Ut||!Ge)&&Ln("")},[Ge]),d.useEffect(()=>{Dt&&(!I||!$e)&&Ln(Dt.label)},[Dt==null?void 0:Dt.label]);const gn=Qe=>{if(!Ce)if(Me&&(Dt==null?void 0:Dt.value)===Qe.value)pt(null),Le(!1);else{if(Qe.creatable&&typeof q=="function"){const Gt=q(Qe.value);typeof Gt<"u"&&Gt!==null&&pt(typeof Gt=="string"?Gt:Gt.value)}else pt(Qe.value);Pn||Ln(Qe.label),ot(-1),Le(!1),ye.current.focus()}},an=nJ({data:ze,searchable:I,limit:D,searchValue:At,filter:_,filterDataOnExactSearchMatch:ie,value:Ge});Ut&&N(At,an)&&(Se=U(At),an.push({label:At,value:At,creatable:!0}));const kr=(Qe,Gt,zn)=>{let St=Qe;for(;zn(St);)if(St=Gt(St),!an[St].disabled)return St;return Qe};Uo(()=>{ot(fe&&At?0:-1)},[At,fe]);const Mo=Ge?an.findIndex(Qe=>Qe.value===Ge):0,mr=!Ce&&(an.length>0?$e:$e&&!!R),hr=()=>{ot(Qe=>{var Gt;const zn=kr(Qe,St=>St-1,St=>St>0);return lt.current=De.current[(Gt=an[zn])==null?void 0:Gt.value],mr&&Je({alignment:be?"start":"end"}),zn})},Ns=()=>{ot(Qe=>{var Gt;const zn=kr(Qe,St=>St+1,St=>Stwindow.setTimeout(()=>{var Qe;lt.current=De.current[(Qe=an[Mo])==null?void 0:Qe.value],Je({alignment:be?"end":"start"})},50);Uo(()=>{mr&&$s()},[mr]);const wa=Qe=>{switch(typeof h=="function"&&h(Qe),Qe.key){case"ArrowUp":{Qe.preventDefault(),$e?be?hr():Ns():(ot(Mo),Le(!0),$s());break}case"ArrowDown":{Qe.preventDefault(),$e?be?Ns():hr():(ot(Mo),Le(!0),$s());break}case"Home":{if(!I){Qe.preventDefault(),$e||Le(!0);const Gt=an.findIndex(zn=>!zn.disabled);ot(Gt),mr&&Je({alignment:be?"end":"start"})}break}case"End":{if(!I){Qe.preventDefault(),$e||Le(!0);const Gt=an.map(zn=>!!zn.disabled).lastIndexOf(!1);ot(Gt),mr&&Je({alignment:be?"end":"start"})}break}case"Escape":{Qe.preventDefault(),Le(!1),ot(-1);break}case" ":{I||(Qe.preventDefault(),an[Ze]&&$e?gn(an[Ze]):(Le(!0),ot(Mo),$s()));break}case"Enter":I||Qe.preventDefault(),an[Ze]&&$e&&(Qe.preventDefault(),gn(an[Ze]))}},Sa=Qe=>{typeof g=="function"&&g(Qe);const Gt=ze.find(zn=>zn.value===Ge);$&&an[Ze]&&$e&&gn(an[Ze]),Ln((Gt==null?void 0:Gt.label)||""),Le(!1)},ml=Qe=>{typeof x=="function"&&x(Qe),I&&Le(!0)},ka=Qe=>{Ce||(Ln(Qe.currentTarget.value),M&&Qe.currentTarget.value===""&&pt(null),ot(-1),Le(!0))},hl=()=>{Ce||(Le(!$e),Ge&&!$e&&ot(Mo))};return H.createElement(_c.Wrapper,Ov(ju({},o),{__staticSelector:"Select"}),H.createElement(Ka,{opened:mr,transitionProps:y,shadow:s,withinPortal:se,portalProps:ae,__staticSelector:"Select",onDirectionChange:bt,switchDirectionOnFlip:re,zIndex:G,dropdownPosition:ee,positionDependencies:[...ge,At],classNames:S,styles:j,unstyled:w,variant:r.variant},H.createElement(Ka.Target,null,H.createElement("div",{role:"combobox","aria-haspopup":"listbox","aria-owns":mr?`${r.id}-items`:null,"aria-controls":r.id,"aria-expanded":mr,onMouseLeave:()=>ot(-1),tabIndex:-1},H.createElement("input",{type:"hidden",name:K,value:Ge||"",form:de,disabled:A}),H.createElement(_c,ju(Ov(ju(ju({autoComplete:"off",type:"search"},r),Oe),{ref:Bd(t,ye),onKeyDown:wa,__staticSelector:"Select",value:At,placeholder:J,onChange:ka,"aria-autocomplete":"list","aria-controls":mr?`${r.id}-items`:null,"aria-activedescendant":Ze>=0?`${r.id}-${Ze}`:null,onMouseDown:hl,onBlur:Sa,onFocus:ml,readOnly:!I||Ce,disabled:A,"data-mantine-stop-propagation":mr,name:null,classNames:Ov(ju({},S),{input:Ne({[_e.input]:!I},S==null?void 0:S.input)})}),WE({theme:nt,rightSection:X,rightSectionWidth:B,styles:j,size:r.size,shouldClear:M&&!!Dt,onClear:kn,error:o.error,clearButtonProps:he,disabled:A,readOnly:Ce}))))),H.createElement(Ka.Dropdown,{component:F||og,maxHeight:E,direction:ut,id:r.id,innerRef:ft,__staticSelector:"Select",classNames:S,styles:j},H.createElement(ty,{data:an,hovered:Ze,classNames:S,styles:j,isItemSelected:Qe=>Qe===Ge,uuid:r.id,__staticSelector:"Select",onItemHover:ot,onItemSelect:gn,itemsRefs:De,itemComponent:m,size:r.size,nothingFound:R,creatable:Ut&&!!Se,createLabel:Se,"aria-label":o.label,unstyled:w,variant:r.variant}))))});fy.displayName="@mantine/core/Select";const Wd=()=>{const[e,t,n,r,o,s,i,l,u,p,m,h,g,x,y,b,w,S,j,_,E,I,M,R,D,A,O,T,X,B,V,U,N,$,q,F,Q,Y,se,ae,re,G,K,ee,le,J,ie,de,ge,Ce,he,fe,Oe,_e,Ne,nt,$e,Pt,Ze,ot,ye,De,ut,bt,be,Je,lt,ft,Me,Le,Ut,Se,Be,ze,Ge,pt]=Ho("colors",["base.50","base.100","base.150","base.200","base.250","base.300","base.350","base.400","base.450","base.500","base.550","base.600","base.650","base.700","base.750","base.800","base.850","base.900","base.950","accent.50","accent.100","accent.150","accent.200","accent.250","accent.300","accent.350","accent.400","accent.450","accent.500","accent.550","accent.600","accent.650","accent.700","accent.750","accent.800","accent.850","accent.900","accent.950","baseAlpha.50","baseAlpha.100","baseAlpha.150","baseAlpha.200","baseAlpha.250","baseAlpha.300","baseAlpha.350","baseAlpha.400","baseAlpha.450","baseAlpha.500","baseAlpha.550","baseAlpha.600","baseAlpha.650","baseAlpha.700","baseAlpha.750","baseAlpha.800","baseAlpha.850","baseAlpha.900","baseAlpha.950","accentAlpha.50","accentAlpha.100","accentAlpha.150","accentAlpha.200","accentAlpha.250","accentAlpha.300","accentAlpha.350","accentAlpha.400","accentAlpha.450","accentAlpha.500","accentAlpha.550","accentAlpha.600","accentAlpha.650","accentAlpha.700","accentAlpha.750","accentAlpha.800","accentAlpha.850","accentAlpha.900","accentAlpha.950"]);return{base50:e,base100:t,base150:n,base200:r,base250:o,base300:s,base350:i,base400:l,base450:u,base500:p,base550:m,base600:h,base650:g,base700:x,base750:y,base800:b,base850:w,base900:S,base950:j,accent50:_,accent100:E,accent150:I,accent200:M,accent250:R,accent300:D,accent350:A,accent400:O,accent450:T,accent500:X,accent550:B,accent600:V,accent650:U,accent700:N,accent750:$,accent800:q,accent850:F,accent900:Q,accent950:Y,baseAlpha50:se,baseAlpha100:ae,baseAlpha150:re,baseAlpha200:G,baseAlpha250:K,baseAlpha300:ee,baseAlpha350:le,baseAlpha400:J,baseAlpha450:ie,baseAlpha500:de,baseAlpha550:ge,baseAlpha600:Ce,baseAlpha650:he,baseAlpha700:fe,baseAlpha750:Oe,baseAlpha800:_e,baseAlpha850:Ne,baseAlpha900:nt,baseAlpha950:$e,accentAlpha50:Pt,accentAlpha100:Ze,accentAlpha150:ot,accentAlpha200:ye,accentAlpha250:De,accentAlpha300:ut,accentAlpha350:bt,accentAlpha400:be,accentAlpha450:Je,accentAlpha500:lt,accentAlpha550:ft,accentAlpha600:Me,accentAlpha650:Le,accentAlpha700:Ut,accentAlpha750:Se,accentAlpha800:Be,accentAlpha850:ze,accentAlpha900:Ge,accentAlpha950:pt}},Ae=(e,t)=>n=>n==="light"?e:t,JE=()=>{const{base50:e,base100:t,base200:n,base300:r,base400:o,base500:s,base600:i,base700:l,base800:u,base900:p,accent200:m,accent300:h,accent400:g,accent500:x,accent600:y}=Wd(),{colorMode:b}=ha(),[w]=Ho("shadows",["dark-lg"]),[S,j,_]=Ho("space",[1,2,6]),[E]=Ho("radii",["base"]),[I]=Ho("lineHeights",["base"]);return d.useCallback(()=>({label:{color:Ae(l,r)(b)},separatorLabel:{color:Ae(s,s)(b),"::after":{borderTopColor:Ae(r,l)(b)}},input:{border:"unset",backgroundColor:Ae(e,p)(b),borderRadius:E,borderStyle:"solid",borderWidth:"2px",borderColor:Ae(n,u)(b),color:Ae(p,t)(b),minHeight:"unset",lineHeight:I,height:"auto",paddingRight:0,paddingLeft:0,paddingInlineStart:j,paddingInlineEnd:_,paddingTop:S,paddingBottom:S,fontWeight:600,"&:hover":{borderColor:Ae(r,i)(b)},"&:focus":{borderColor:Ae(h,y)(b)},"&:is(:focus, :hover)":{borderColor:Ae(o,s)(b)},"&:focus-within":{borderColor:Ae(m,y)(b)},"&[data-disabled]":{backgroundColor:Ae(r,l)(b),color:Ae(i,o)(b),cursor:"not-allowed"}},value:{backgroundColor:Ae(t,p)(b),color:Ae(p,t)(b),button:{color:Ae(p,t)(b)},"&:hover":{backgroundColor:Ae(r,l)(b),cursor:"pointer"}},dropdown:{backgroundColor:Ae(n,u)(b),borderColor:Ae(n,u)(b),boxShadow:w},item:{backgroundColor:Ae(n,u)(b),color:Ae(u,n)(b),padding:6,"&[data-hovered]":{color:Ae(p,t)(b),backgroundColor:Ae(r,l)(b)},"&[data-active]":{backgroundColor:Ae(r,l)(b),"&:hover":{color:Ae(p,t)(b),backgroundColor:Ae(r,l)(b)}},"&[data-selected]":{backgroundColor:Ae(g,y)(b),color:Ae(e,t)(b),fontWeight:600,"&:hover":{backgroundColor:Ae(x,x)(b),color:Ae("white",e)(b)}},"&[data-disabled]":{color:Ae(s,i)(b),cursor:"not-allowed"}},rightSection:{width:32,button:{color:Ae(p,t)(b)}}}),[m,h,g,x,y,t,n,r,o,e,s,i,l,u,p,w,b,I,E,S,j,_])},eM=ke((e,t)=>{const{searchable:n=!0,tooltip:r,inputRef:o,onChange:s,label:i,disabled:l,...u}=e,p=te(),[m,h]=d.useState(""),g=d.useCallback(w=>{w.shiftKey&&p(Nr(!0))},[p]),x=d.useCallback(w=>{w.shiftKey||p(Nr(!1))},[p]),y=d.useCallback(w=>{s&&s(w)},[s]),b=JE();return a.jsx(Ht,{label:r,placement:"top",hasArrow:!0,children:a.jsxs(Kt,{ref:t,isDisabled:l,position:"static","data-testid":`select-${i||e.placeholder}`,children:[i&&a.jsx(wn,{children:i}),a.jsx(fy,{ref:o,disabled:l,searchValue:m,onSearchChange:h,onChange:y,onKeyDown:g,onKeyUp:x,searchable:n,maxDropdownHeight:300,styles:b,...u})]})})});eM.displayName="IAIMantineSearchableSelect";const nn=d.memo(eM),fJ=ce([xe],({changeBoardModal:e})=>{const{isModalOpen:t,imagesToChange:n}=e;return{isModalOpen:t,imagesToChange:n}},je),pJ=()=>{const e=te(),[t,n]=d.useState(),{data:r,isFetching:o}=yd(),{imagesToChange:s,isModalOpen:i}=W(fJ),[l]=JR(),[u]=eD(),{t:p}=Z(),m=d.useMemo(()=>{const y=[{label:p("boards.uncategorized"),value:"none"}];return(r??[]).forEach(b=>y.push({label:b.board_name,value:b.board_id})),y},[r,p]),h=d.useCallback(()=>{e(ew()),e(Bx(!1))},[e]),g=d.useCallback(()=>{!s.length||!t||(t==="none"?u({imageDTOs:s}):l({imageDTOs:s,board_id:t}),n(null),e(ew()))},[l,e,s,u,t]),x=d.useRef(null);return a.jsx(Td,{isOpen:i,onClose:h,leastDestructiveRef:x,isCentered:!0,children:a.jsx(Yo,{children:a.jsxs(Nd,{children:[a.jsx(Qo,{fontSize:"lg",fontWeight:"bold",children:p("boards.changeBoard")}),a.jsx(Zo,{children:a.jsxs(L,{sx:{flexDir:"column",gap:4},children:[a.jsxs(ve,{children:["Moving ",`${s.length}`," image",`${s.length>1?"s":""}`," to board:"]}),a.jsx(nn,{placeholder:p(o?"boards.loading":"boards.selectBoard"),disabled:o,onChange:y=>n(y),value:t,data:m})]})}),a.jsxs(Ss,{children:[a.jsx(at,{ref:x,onClick:h,children:p("boards.cancel")}),a.jsx(at,{colorScheme:"accent",onClick:g,ml:3,children:p("boards.move")})]})]})})})},mJ=d.memo(pJ),tM=e=>{const{label:t,isDisabled:n=!1,width:r="auto",formControlProps:o,formLabelProps:s,tooltip:i,helperText:l,...u}=e;return a.jsx(Ht,{label:i,hasArrow:!0,placement:"top",isDisabled:!i,children:a.jsx(Kt,{isDisabled:n,width:r,alignItems:"center",...o,children:a.jsxs(L,{sx:{flexDir:"column",w:"full"},children:[a.jsxs(L,{sx:{alignItems:"center",w:"full"},children:[t&&a.jsx(wn,{my:1,flexGrow:1,sx:{cursor:n?"not-allowed":"pointer",...s==null?void 0:s.sx,pe:4},...s,children:t}),a.jsx(qb,{...u})]}),l&&a.jsx(u5,{children:a.jsx(ve,{variant:"subtext",children:l})})]})})})};tM.displayName="IAISwitch";const dn=d.memo(tM),hJ=e=>{const{t}=Z(),{imageUsage:n,topMessage:r=t("gallery.currentlyInUse"),bottomMessage:o=t("gallery.featuresWillReset")}=e;return!n||!Xr(n)?null:a.jsxs(a.Fragment,{children:[a.jsx(ve,{children:r}),a.jsxs(Od,{sx:{paddingInlineStart:6},children:[n.isInitialImage&&a.jsx(Qr,{children:t("common.img2img")}),n.isCanvasImage&&a.jsx(Qr,{children:t("common.unifiedCanvas")}),n.isControlNetImage&&a.jsx(Qr,{children:t("common.controlNet")}),n.isIPAdapterImage&&a.jsx(Qr,{children:t("common.ipAdapter")}),n.isNodesImage&&a.jsx(Qr,{children:t("common.nodeEditor")})]}),a.jsx(ve,{children:o})]})},nM=d.memo(hJ),gJ=ce([xe,tD],(e,t)=>{const{system:n,config:r,deleteImageModal:o}=e,{shouldConfirmOnDelete:s}=n,{canRestoreDeletedImagesFromBin:i}=r,{imagesToDelete:l,isModalOpen:u}=o,p=(l??[]).map(({image_name:h})=>rI(e,h)),m={isInitialImage:Xr(p,h=>h.isInitialImage),isCanvasImage:Xr(p,h=>h.isCanvasImage),isNodesImage:Xr(p,h=>h.isNodesImage),isControlNetImage:Xr(p,h=>h.isControlNetImage),isIPAdapterImage:Xr(p,h=>h.isIPAdapterImage)};return{shouldConfirmOnDelete:s,canRestoreDeletedImagesFromBin:i,imagesToDelete:l,imagesUsage:t,isModalOpen:u,imageUsageSummary:m}},je),vJ=()=>{const e=te(),{t}=Z(),{shouldConfirmOnDelete:n,canRestoreDeletedImagesFromBin:r,imagesToDelete:o,imagesUsage:s,isModalOpen:i,imageUsageSummary:l}=W(gJ),u=d.useCallback(g=>e(oI(!g.target.checked)),[e]),p=d.useCallback(()=>{e(tw()),e(nD(!1))},[e]),m=d.useCallback(()=>{!o.length||!s.length||(e(tw()),e(rD({imageDTOs:o,imagesUsage:s})))},[e,o,s]),h=d.useRef(null);return a.jsx(Td,{isOpen:i,onClose:p,leastDestructiveRef:h,isCentered:!0,children:a.jsx(Yo,{children:a.jsxs(Nd,{children:[a.jsx(Qo,{fontSize:"lg",fontWeight:"bold",children:t("gallery.deleteImage")}),a.jsx(Zo,{children:a.jsxs(L,{direction:"column",gap:3,children:[a.jsx(nM,{imageUsage:l}),a.jsx(Yn,{}),a.jsx(ve,{children:t(r?"gallery.deleteImageBin":"gallery.deleteImagePermanent")}),a.jsx(ve,{children:t("common.areYouSure")}),a.jsx(dn,{label:t("common.dontAskMeAgain"),isChecked:!n,onChange:u})]})}),a.jsxs(Ss,{children:[a.jsx(at,{ref:h,onClick:p,children:"Cancel"}),a.jsx(at,{colorScheme:"error",onClick:m,ml:3,children:"Delete"})]})]})})})},xJ=d.memo(vJ),rM=ke((e,t)=>{const{role:n,tooltip:r="",tooltipProps:o,isChecked:s,...i}=e;return a.jsx(Ht,{label:r,hasArrow:!0,...o,...o!=null&&o.placement?{placement:o.placement}:{placement:"top"},children:a.jsx(ys,{ref:t,role:n,colorScheme:s?"accent":"base","data-testid":r,...i})})});rM.displayName="IAIIconButton";const Fe=d.memo(rM);var oM={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},Kk=H.createContext&&H.createContext(oM),qa=globalThis&&globalThis.__assign||function(){return qa=Object.assign||function(e){for(var t,n=1,r=arguments.length;n{const t=W(i=>i.config.disabledTabs),n=W(i=>i.config.disabledFeatures),r=W(i=>i.config.disabledSDFeatures),o=d.useMemo(()=>n.includes(e)||r.includes(e)||t.includes(e),[n,r,t,e]),s=d.useMemo(()=>!(n.includes(e)||r.includes(e)||t.includes(e)),[n,r,t,e]);return{isFeatureDisabled:o,isFeatureEnabled:s}};function aee(e){const{title:t,hotkey:n,description:r}=e;return a.jsxs(Ja,{sx:{gridTemplateColumns:"auto max-content",justifyContent:"space-between",alignItems:"center"},children:[a.jsxs(Ja,{children:[a.jsx(ve,{fontWeight:600,children:t}),r&&a.jsx(ve,{sx:{fontSize:"sm"},variant:"subtext",children:r})]}),a.jsx(Ie,{sx:{fontSize:"sm",fontWeight:600,px:2,py:1},children:n})]})}function iee({children:e}){const{isOpen:t,onOpen:n,onClose:r}=Lr(),{t:o}=Z(),s=[{title:o("hotkeys.invoke.title"),desc:o("hotkeys.invoke.desc"),hotkey:"Ctrl+Enter"},{title:o("hotkeys.cancel.title"),desc:o("hotkeys.cancel.desc"),hotkey:"Shift+X"},{title:o("hotkeys.focusPrompt.title"),desc:o("hotkeys.focusPrompt.desc"),hotkey:"Alt+A"},{title:o("hotkeys.toggleOptions.title"),desc:o("hotkeys.toggleOptions.desc"),hotkey:"O"},{title:o("hotkeys.toggleGallery.title"),desc:o("hotkeys.toggleGallery.desc"),hotkey:"G"},{title:o("hotkeys.maximizeWorkSpace.title"),desc:o("hotkeys.maximizeWorkSpace.desc"),hotkey:"F"},{title:o("hotkeys.changeTabs.title"),desc:o("hotkeys.changeTabs.desc"),hotkey:"1-5"}],i=[{title:o("hotkeys.setPrompt.title"),desc:o("hotkeys.setPrompt.desc"),hotkey:"P"},{title:o("hotkeys.setSeed.title"),desc:o("hotkeys.setSeed.desc"),hotkey:"S"},{title:o("hotkeys.setParameters.title"),desc:o("hotkeys.setParameters.desc"),hotkey:"A"},{title:o("hotkeys.upscale.title"),desc:o("hotkeys.upscale.desc"),hotkey:"Shift+U"},{title:o("hotkeys.showInfo.title"),desc:o("hotkeys.showInfo.desc"),hotkey:"I"},{title:o("hotkeys.sendToImageToImage.title"),desc:o("hotkeys.sendToImageToImage.desc"),hotkey:"Shift+I"},{title:o("hotkeys.deleteImage.title"),desc:o("hotkeys.deleteImage.desc"),hotkey:"Del"},{title:o("hotkeys.closePanels.title"),desc:o("hotkeys.closePanels.desc"),hotkey:"Esc"}],l=[{title:o("hotkeys.previousImage.title"),desc:o("hotkeys.previousImage.desc"),hotkey:"Arrow Left"},{title:o("hotkeys.nextImage.title"),desc:o("hotkeys.nextImage.desc"),hotkey:"Arrow Right"},{title:o("hotkeys.increaseGalleryThumbSize.title"),desc:o("hotkeys.increaseGalleryThumbSize.desc"),hotkey:"Shift+Up"},{title:o("hotkeys.decreaseGalleryThumbSize.title"),desc:o("hotkeys.decreaseGalleryThumbSize.desc"),hotkey:"Shift+Down"}],u=[{title:o("hotkeys.selectBrush.title"),desc:o("hotkeys.selectBrush.desc"),hotkey:"B"},{title:o("hotkeys.selectEraser.title"),desc:o("hotkeys.selectEraser.desc"),hotkey:"E"},{title:o("hotkeys.decreaseBrushSize.title"),desc:o("hotkeys.decreaseBrushSize.desc"),hotkey:"["},{title:o("hotkeys.increaseBrushSize.title"),desc:o("hotkeys.increaseBrushSize.desc"),hotkey:"]"},{title:o("hotkeys.decreaseBrushOpacity.title"),desc:o("hotkeys.decreaseBrushOpacity.desc"),hotkey:"Shift + ["},{title:o("hotkeys.increaseBrushOpacity.title"),desc:o("hotkeys.increaseBrushOpacity.desc"),hotkey:"Shift + ]"},{title:o("hotkeys.moveTool.title"),desc:o("hotkeys.moveTool.desc"),hotkey:"V"},{title:o("hotkeys.fillBoundingBox.title"),desc:o("hotkeys.fillBoundingBox.desc"),hotkey:"Shift + F"},{title:o("hotkeys.eraseBoundingBox.title"),desc:o("hotkeys.eraseBoundingBox.desc"),hotkey:"Delete / Backspace"},{title:o("hotkeys.colorPicker.title"),desc:o("hotkeys.colorPicker.desc"),hotkey:"C"},{title:o("hotkeys.toggleSnap.title"),desc:o("hotkeys.toggleSnap.desc"),hotkey:"N"},{title:o("hotkeys.quickToggleMove.title"),desc:o("hotkeys.quickToggleMove.desc"),hotkey:"Hold Space"},{title:o("hotkeys.toggleLayer.title"),desc:o("hotkeys.toggleLayer.desc"),hotkey:"Q"},{title:o("hotkeys.clearMask.title"),desc:o("hotkeys.clearMask.desc"),hotkey:"Shift+C"},{title:o("hotkeys.hideMask.title"),desc:o("hotkeys.hideMask.desc"),hotkey:"H"},{title:o("hotkeys.showHideBoundingBox.title"),desc:o("hotkeys.showHideBoundingBox.desc"),hotkey:"Shift+H"},{title:o("hotkeys.mergeVisible.title"),desc:o("hotkeys.mergeVisible.desc"),hotkey:"Shift+M"},{title:o("hotkeys.saveToGallery.title"),desc:o("hotkeys.saveToGallery.desc"),hotkey:"Shift+S"},{title:o("hotkeys.copyToClipboard.title"),desc:o("hotkeys.copyToClipboard.desc"),hotkey:"Ctrl+C"},{title:o("hotkeys.downloadImage.title"),desc:o("hotkeys.downloadImage.desc"),hotkey:"Shift+D"},{title:o("hotkeys.undoStroke.title"),desc:o("hotkeys.undoStroke.desc"),hotkey:"Ctrl+Z"},{title:o("hotkeys.redoStroke.title"),desc:o("hotkeys.redoStroke.desc"),hotkey:"Ctrl+Shift+Z, Ctrl+Y"},{title:o("hotkeys.resetView.title"),desc:o("hotkeys.resetView.desc"),hotkey:"R"},{title:o("hotkeys.previousStagingImage.title"),desc:o("hotkeys.previousStagingImage.desc"),hotkey:"Arrow Left"},{title:o("hotkeys.nextStagingImage.title"),desc:o("hotkeys.nextStagingImage.desc"),hotkey:"Arrow Right"},{title:o("hotkeys.acceptStagingImage.title"),desc:o("hotkeys.acceptStagingImage.desc"),hotkey:"Enter"}],p=[{title:o("hotkeys.addNodes.title"),desc:o("hotkeys.addNodes.desc"),hotkey:"Shift + A / Space"}],m=h=>a.jsx(L,{flexDir:"column",gap:4,children:h.map((g,x)=>a.jsxs(L,{flexDir:"column",px:2,gap:4,children:[a.jsx(aee,{title:g.title,description:g.desc,hotkey:g.hotkey}),x{const{data:t}=oD(),n=d.useRef(null),r=CM(n);return a.jsxs(L,{alignItems:"center",gap:5,ps:1,ref:n,children:[a.jsx(ga,{src:Hx,alt:"invoke-ai-logo",sx:{w:"32px",h:"32px",minW:"32px",minH:"32px",userSelect:"none"}}),a.jsxs(L,{sx:{gap:3,alignItems:"center"},children:[a.jsxs(ve,{sx:{fontSize:"xl",userSelect:"none"},children:["invoke ",a.jsx("strong",{children:"ai"})]}),a.jsx(dr,{children:e&&r&&t&&a.jsx(In.div,{initial:{opacity:0},animate:{opacity:1,transition:{duration:.15}},exit:{opacity:0,transition:{delay:.8}},children:a.jsx(ve,{sx:{fontWeight:600,marginTop:1,color:"base.300",fontSize:14},variant:"subtext",children:t.version})},"statusText")})]})]})},hee=d.memo(mee),wM=ke((e,t)=>{const{tooltip:n,inputRef:r,label:o,disabled:s,required:i,...l}=e,u=JE();return a.jsx(Ht,{label:n,placement:"top",hasArrow:!0,children:a.jsxs(Kt,{ref:t,isRequired:i,isDisabled:s,position:"static","data-testid":`select-${o||e.placeholder}`,children:[a.jsx(wn,{children:o}),a.jsx(fy,{disabled:s,ref:r,styles:u,...l})]})})});wM.displayName="IAIMantineSelect";const On=d.memo(wM),gee={ar:yt.t("common.langArabic",{lng:"ar"}),nl:yt.t("common.langDutch",{lng:"nl"}),en:yt.t("common.langEnglish",{lng:"en"}),fr:yt.t("common.langFrench",{lng:"fr"}),de:yt.t("common.langGerman",{lng:"de"}),he:yt.t("common.langHebrew",{lng:"he"}),it:yt.t("common.langItalian",{lng:"it"}),ja:yt.t("common.langJapanese",{lng:"ja"}),ko:yt.t("common.langKorean",{lng:"ko"}),pl:yt.t("common.langPolish",{lng:"pl"}),pt_BR:yt.t("common.langBrPortuguese",{lng:"pt_BR"}),pt:yt.t("common.langPortuguese",{lng:"pt"}),ru:yt.t("common.langRussian",{lng:"ru"}),zh_CN:yt.t("common.langSimplifiedChinese",{lng:"zh_CN"}),es:yt.t("common.langSpanish",{lng:"es"}),uk:yt.t("common.langUkranian",{lng:"ua"})},vee={CONNECTED:"common.statusConnected",DISCONNECTED:"common.statusDisconnected",PROCESSING:"common.statusProcessing",ERROR:"common.statusError",LOADING_MODEL:"common.statusLoadingModel"},SM=ce(xe,({system:e})=>e.language,je);function Lo(e){const{t}=Z(),{label:n,textProps:r,useBadge:o=!1,badgeLabel:s=t("settings.experimental"),badgeProps:i,...l}=e;return a.jsxs(L,{justifyContent:"space-between",py:1,children:[a.jsxs(L,{gap:2,alignItems:"center",children:[a.jsx(ve,{sx:{fontSize:14,_dark:{color:"base.300"}},...r,children:n}),o&&a.jsx(Ds,{size:"xs",sx:{px:2,color:"base.700",bg:"accent.200",_dark:{bg:"accent.500",color:"base.200"}},...i,children:s})]}),a.jsx(dn,{...l})]})}const xee=e=>a.jsx(L,{sx:{flexDirection:"column",gap:2,p:4,borderRadius:"base",bg:"base.100",_dark:{bg:"base.900"}},children:e.children}),Gl=d.memo(xee);function bee(){const e=te(),{data:t,refetch:n}=sD(),[r,{isLoading:o}]=aD(),s=d.useCallback(()=>{r().unwrap().then(l=>{e(sI()),e(aI()),e(ct({title:`Cleared ${l} intermediates`,status:"info"}))})},[r,e]);d.useEffect(()=>{n()},[n]);const i=t?`Clear ${t} Intermediate${t>1?"s":""}`:"No Intermediates to Clear";return a.jsxs(Gl,{children:[a.jsx(cr,{size:"sm",children:"Clear Intermediates"}),a.jsx(at,{colorScheme:"warning",onClick:s,isLoading:o,isDisabled:!t,children:i}),a.jsx(ve,{fontWeight:"bold",children:"Clearing intermediates will reset your Canvas and ControlNet state."}),a.jsx(ve,{variant:"subtext",children:"Intermediate images are byproducts of generation, different from the result images in the gallery. Clearing intermediates will free disk space."}),a.jsx(ve,{variant:"subtext",children:"Your gallery images will not be deleted."})]})}const yee=()=>{const{base50:e,base100:t,base200:n,base300:r,base400:o,base500:s,base600:i,base700:l,base800:u,base900:p,accent200:m,accent300:h,accent400:g,accent500:x,accent600:y}=Wd(),{colorMode:b}=ha(),[w]=Ho("shadows",["dark-lg"]);return d.useCallback(()=>({label:{color:Ae(l,r)(b)},separatorLabel:{color:Ae(s,s)(b),"::after":{borderTopColor:Ae(r,l)(b)}},searchInput:{":placeholder":{color:Ae(r,l)(b)}},input:{backgroundColor:Ae(e,p)(b),borderWidth:"2px",borderColor:Ae(n,u)(b),color:Ae(p,t)(b),paddingRight:24,fontWeight:600,"&:hover":{borderColor:Ae(r,i)(b)},"&:focus":{borderColor:Ae(h,y)(b)},"&:is(:focus, :hover)":{borderColor:Ae(o,s)(b)},"&:focus-within":{borderColor:Ae(m,y)(b)},"&[data-disabled]":{backgroundColor:Ae(r,l)(b),color:Ae(i,o)(b),cursor:"not-allowed"}},value:{backgroundColor:Ae(n,u)(b),color:Ae(p,t)(b),button:{color:Ae(p,t)(b)},"&:hover":{backgroundColor:Ae(r,l)(b),cursor:"pointer"}},dropdown:{backgroundColor:Ae(n,u)(b),borderColor:Ae(n,u)(b),boxShadow:w},item:{backgroundColor:Ae(n,u)(b),color:Ae(u,n)(b),padding:6,"&[data-hovered]":{color:Ae(p,t)(b),backgroundColor:Ae(r,l)(b)},"&[data-active]":{backgroundColor:Ae(r,l)(b),"&:hover":{color:Ae(p,t)(b),backgroundColor:Ae(r,l)(b)}},"&[data-selected]":{backgroundColor:Ae(g,y)(b),color:Ae(e,t)(b),fontWeight:600,"&:hover":{backgroundColor:Ae(x,x)(b),color:Ae("white",e)(b)}},"&[data-disabled]":{color:Ae(s,i)(b),cursor:"not-allowed"}},rightSection:{width:24,padding:20,button:{color:Ae(p,t)(b)}}}),[m,h,g,x,y,t,n,r,o,e,s,i,l,u,p,w,b])},kM=ke((e,t)=>{const{searchable:n=!0,tooltip:r,inputRef:o,label:s,disabled:i,...l}=e,u=te(),p=d.useCallback(g=>{g.shiftKey&&u(Nr(!0))},[u]),m=d.useCallback(g=>{g.shiftKey||u(Nr(!1))},[u]),h=yee();return a.jsx(Ht,{label:r,placement:"top",hasArrow:!0,isOpen:!0,children:a.jsxs(Kt,{ref:t,isDisabled:i,position:"static",children:[s&&a.jsx(wn,{children:s}),a.jsx(KE,{ref:o,disabled:i,onKeyDown:p,onKeyUp:m,searchable:n,maxDropdownHeight:300,styles:h,...l})]})})});kM.displayName="IAIMantineMultiSelect";const Cee=d.memo(kM),wee=nr(mh,(e,t)=>({value:t,label:e})).sort((e,t)=>e.label.localeCompare(t.label));function See(){const e=te(),{t}=Z(),n=W(o=>o.ui.favoriteSchedulers),r=d.useCallback(o=>{e(iD(o))},[e]);return a.jsx(Cee,{label:t("settings.favoriteSchedulers"),value:n,data:wee,onChange:r,clearable:!0,searchable:!0,maxSelectedValues:99,placeholder:t("settings.favoriteSchedulersPlaceholder")})}const kee=ce([xe],({system:e,ui:t})=>{const{shouldConfirmOnDelete:n,enableImageDebugging:r,consoleLogLevel:o,shouldLogToConsole:s,shouldAntialiasProgressImage:i,shouldUseNSFWChecker:l,shouldUseWatermarker:u,shouldEnableInformationalPopovers:p}=e,{shouldUseSliders:m,shouldShowProgressInViewer:h,shouldAutoChangeDimensions:g}=t;return{shouldConfirmOnDelete:n,enableImageDebugging:r,shouldUseSliders:m,shouldShowProgressInViewer:h,consoleLogLevel:o,shouldLogToConsole:s,shouldAntialiasProgressImage:i,shouldUseNSFWChecker:l,shouldUseWatermarker:u,shouldAutoChangeDimensions:g,shouldEnableInformationalPopovers:p}},{memoizeOptions:{resultEqualityCheck:Ft}}),jee=({children:e,config:t})=>{const n=te(),{t:r}=Z(),[o,s]=d.useState(3),i=(t==null?void 0:t.shouldShowDeveloperSettings)??!0,l=(t==null?void 0:t.shouldShowResetWebUiText)??!0,u=(t==null?void 0:t.shouldShowClearIntermediates)??!0,p=(t==null?void 0:t.shouldShowLocalizationToggle)??!0;d.useEffect(()=>{i||n(nw(!1))},[i,n]);const{isNSFWCheckerAvailable:m,isWatermarkerAvailable:h}=iI(void 0,{selectFromResult:({data:Y})=>({isNSFWCheckerAvailable:(Y==null?void 0:Y.nsfw_methods.includes("nsfw_checker"))??!1,isWatermarkerAvailable:(Y==null?void 0:Y.watermarking_methods.includes("invisible_watermark"))??!1})}),{isOpen:g,onOpen:x,onClose:y}=Lr(),{isOpen:b,onOpen:w,onClose:S}=Lr(),{shouldConfirmOnDelete:j,enableImageDebugging:_,shouldUseSliders:E,shouldShowProgressInViewer:I,consoleLogLevel:M,shouldLogToConsole:R,shouldAntialiasProgressImage:D,shouldUseNSFWChecker:A,shouldUseWatermarker:O,shouldAutoChangeDimensions:T,shouldEnableInformationalPopovers:X}=W(kee),B=d.useCallback(()=>{Object.keys(window.localStorage).forEach(Y=>{(lD.includes(Y)||Y.startsWith(cD))&&localStorage.removeItem(Y)}),y(),w(),setInterval(()=>s(Y=>Y-1),1e3)},[y,w]);d.useEffect(()=>{o<=0&&window.location.reload()},[o]);const V=d.useCallback(Y=>{n(uD(Y))},[n]),U=d.useCallback(Y=>{n(dD(Y))},[n]),N=d.useCallback(Y=>{n(nw(Y.target.checked))},[n]),{colorMode:$,toggleColorMode:q}=ha(),F=Bt("localization").isFeatureEnabled,Q=W(SM);return a.jsxs(a.Fragment,{children:[d.cloneElement(e,{onClick:x}),a.jsxs(Ki,{isOpen:g,onClose:y,size:"2xl",isCentered:!0,children:[a.jsx(Yo,{}),a.jsxs(qi,{children:[a.jsx(Qo,{bg:"none",children:r("common.settingsLabel")}),a.jsx($d,{}),a.jsx(Zo,{children:a.jsxs(L,{sx:{gap:4,flexDirection:"column"},children:[a.jsxs(Gl,{children:[a.jsx(cr,{size:"sm",children:r("settings.general")}),a.jsx(Lo,{label:r("settings.confirmOnDelete"),isChecked:j,onChange:Y=>n(oI(Y.target.checked))})]}),a.jsxs(Gl,{children:[a.jsx(cr,{size:"sm",children:r("settings.generation")}),a.jsx(See,{}),a.jsx(Lo,{label:"Enable NSFW Checker",isDisabled:!m,isChecked:A,onChange:Y=>n(fD(Y.target.checked))}),a.jsx(Lo,{label:"Enable Invisible Watermark",isDisabled:!h,isChecked:O,onChange:Y=>n(pD(Y.target.checked))})]}),a.jsxs(Gl,{children:[a.jsx(cr,{size:"sm",children:r("settings.ui")}),a.jsx(Lo,{label:r("common.darkMode"),isChecked:$==="dark",onChange:q}),a.jsx(Lo,{label:r("settings.useSlidersForAll"),isChecked:E,onChange:Y=>n(mD(Y.target.checked))}),a.jsx(Lo,{label:r("settings.showProgressInViewer"),isChecked:I,onChange:Y=>n(lI(Y.target.checked))}),a.jsx(Lo,{label:r("settings.antialiasProgressImages"),isChecked:D,onChange:Y=>n(hD(Y.target.checked))}),a.jsx(Lo,{label:r("settings.autoChangeDimensions"),isChecked:T,onChange:Y=>n(gD(Y.target.checked))}),p&&a.jsx(On,{disabled:!F,label:r("common.languagePickerLabel"),value:Q,data:Object.entries(gee).map(([Y,se])=>({value:Y,label:se})),onChange:U}),a.jsx(Lo,{label:"Enable informational popovers",isChecked:X,onChange:Y=>n(vD(Y.target.checked))})]}),i&&a.jsxs(Gl,{children:[a.jsx(cr,{size:"sm",children:r("settings.developer")}),a.jsx(Lo,{label:r("settings.shouldLogToConsole"),isChecked:R,onChange:N}),a.jsx(On,{disabled:!R,label:r("settings.consoleLogLevel"),onChange:V,value:M,data:xD.concat()}),a.jsx(Lo,{label:r("settings.enableImageDebugging"),isChecked:_,onChange:Y=>n(bD(Y.target.checked))})]}),u&&a.jsx(bee,{}),a.jsxs(Gl,{children:[a.jsx(cr,{size:"sm",children:r("settings.resetWebUI")}),a.jsx(at,{colorScheme:"error",onClick:B,children:r("settings.resetWebUI")}),l&&a.jsxs(a.Fragment,{children:[a.jsx(ve,{variant:"subtext",children:r("settings.resetWebUIDesc1")}),a.jsx(ve,{variant:"subtext",children:r("settings.resetWebUIDesc2")})]})]})]})}),a.jsx(Ss,{children:a.jsx(at,{onClick:y,children:r("common.close")})})]})]}),a.jsxs(Ki,{closeOnOverlayClick:!1,isOpen:b,onClose:S,isCentered:!0,closeOnEsc:!1,children:[a.jsx(Yo,{backdropFilter:"blur(40px)"}),a.jsxs(qi,{children:[a.jsx(Qo,{}),a.jsx(Zo,{children:a.jsx(L,{justifyContent:"center",children:a.jsx(ve,{fontSize:"lg",children:a.jsxs(ve,{children:[r("settings.resetComplete")," Reloading in ",o,"..."]})})})}),a.jsx(Ss,{})]})]})]})},_ee=d.memo(jee),Iee=ce(xe,({system:e})=>{const{isConnected:t,status:n}=e;return{isConnected:t,statusTranslationKey:vee[n]}},je),Yk={ok:"green.400",working:"yellow.400",error:"red.400"},Zk={ok:"green.600",working:"yellow.500",error:"red.500"},Pee=()=>{const{isConnected:e,statusTranslationKey:t}=W(Iee),{t:n}=Z(),r=d.useRef(null),{data:o}=va(),s=d.useMemo(()=>e?o!=null&&o.queue.in_progress?"working":"ok":"error",[o==null?void 0:o.queue.in_progress,e]),i=CM(r);return a.jsxs(L,{ref:r,h:"full",px:2,alignItems:"center",gap:5,children:[a.jsx(dr,{children:i&&a.jsx(In.div,{initial:{opacity:0},animate:{opacity:1,transition:{duration:.15}},exit:{opacity:0,transition:{delay:.8}},children:a.jsx(ve,{sx:{fontSize:"sm",fontWeight:"600",pb:"1px",userSelect:"none",color:Zk[s],_dark:{color:Yk[s]}},children:n(t)})},"statusText")}),a.jsx(Tn,{as:OJ,sx:{boxSize:"0.5rem",color:Zk[s],_dark:{color:Yk[s]}}})]})},Eee=d.memo(Pee),Mee=()=>{const{t:e}=Z(),t=Bt("bugLink").isFeatureEnabled,n=Bt("discordLink").isFeatureEnabled,r=Bt("githubLink").isFeatureEnabled,o="http://github.com/invoke-ai/InvokeAI",s="https://discord.gg/ZmtBAhwWhy";return a.jsxs(L,{sx:{gap:2,alignItems:"center"},children:[a.jsx(hee,{}),a.jsx(ba,{}),a.jsx(Eee,{}),a.jsxs(Ah,{children:[a.jsx(Th,{as:Fe,variant:"link","aria-label":e("accessibility.menu"),icon:a.jsx(EJ,{}),sx:{boxSize:8}}),a.jsxs(Ui,{motionProps:vc,children:[a.jsxs(td,{title:e("common.communityLabel"),children:[r&&a.jsx(en,{as:"a",href:o,target:"_blank",icon:a.jsx(wJ,{}),children:e("common.githubLabel")}),t&&a.jsx(en,{as:"a",href:`${o}/issues`,target:"_blank",icon:a.jsx(MJ,{}),children:e("common.reportBugLabel")}),n&&a.jsx(en,{as:"a",href:s,target:"_blank",icon:a.jsx(CJ,{}),children:e("common.discordLabel")})]}),a.jsxs(td,{title:e("common.settingsLabel"),children:[a.jsx(iee,{children:a.jsx(en,{as:"button",icon:a.jsx(UJ,{}),children:e("common.hotkeysLabel")})}),a.jsx(_ee,{children:a.jsx(en,{as:"button",icon:a.jsx(cM,{}),children:e("common.settingsLabel")})})]})]})]})]})},Oee=d.memo(Mee);/*! * OverlayScrollbars * Version: 2.2.1 * @@ -53,7 +53,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho * https://github.com/KingSora * * Released under the MIT license. - */function zt(e,t){if(dg(e))for(let n=0;nt(e[n],n,e));return e}function ur(e,t){const n=li(t);if(ts(t)||n){let o=n?"":{};if(e){const s=window.getComputedStyle(e,null);o=n?nj(e,s,t):t.reduce((i,l)=>(i[l]=nj(e,s,l),i),o)}return o}e&&zt(ro(t),o=>Kee(e,o,t[o]))}const Fo=(e,t)=>{const{o:n,u:r,_:o}=e;let s=n,i;const l=(m,h)=>{const g=s,x=m,y=h||(r?!r(g,x):g!==x);return(y||o)&&(s=x,i=g),[s,y,i]};return[t?m=>l(t(s,i),m):l,m=>[s,!!m,i]]},Gd=()=>typeof window<"u",jM=Gd()&&Node.ELEMENT_NODE,{toString:Ree,hasOwnProperty:Rv}=Object.prototype,Ca=e=>e===void 0,ug=e=>e===null,Dee=e=>Ca(e)||ug(e)?`${e}`:Ree.call(e).replace(/^\[object (.+)\]$/,"$1").toLowerCase(),Xa=e=>typeof e=="number",li=e=>typeof e=="string",my=e=>typeof e=="boolean",es=e=>typeof e=="function",ts=e=>Array.isArray(e),ad=e=>typeof e=="object"&&!ts(e)&&!ug(e),dg=e=>{const t=!!e&&e.length,n=Xa(t)&&t>-1&&t%1==0;return ts(e)||!es(e)&&n?t>0&&ad(e)?t-1 in e:!0:!1},lx=e=>{if(!e||!ad(e)||Dee(e)!=="object")return!1;let t;const n="constructor",r=e[n],o=r&&r.prototype,s=Rv.call(e,n),i=o&&Rv.call(o,"isPrototypeOf");if(r&&!s&&!i)return!1;for(t in e);return Ca(t)||Rv.call(e,t)},Zm=e=>{const t=HTMLElement;return e?t?e instanceof t:e.nodeType===jM:!1},fg=e=>{const t=Element;return e?t?e instanceof t:e.nodeType===jM:!1},hy=(e,t,n)=>e.indexOf(t,n),Xt=(e,t,n)=>(!n&&!li(t)&&dg(t)?Array.prototype.push.apply(e,t):e.push(t),e),Yi=e=>{const t=Array.from,n=[];return t&&e?t(e):(e instanceof Set?e.forEach(r=>{Xt(n,r)}):zt(e,r=>{Xt(n,r)}),n)},gy=e=>!!e&&e.length===0,As=(e,t,n)=>{zt(e,o=>o&&o.apply(void 0,t||[])),!n&&(e.length=0)},pg=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),ro=e=>e?Object.keys(e):[],Cn=(e,t,n,r,o,s,i)=>{const l=[t,n,r,o,s,i];return(typeof e!="object"||ug(e))&&!es(e)&&(e={}),zt(l,u=>{zt(ro(u),p=>{const m=u[p];if(e===m)return!0;const h=ts(m);if(m&&(lx(m)||h)){const g=e[p];let x=g;h&&!ts(g)?x=[]:!h&&!lx(g)&&(x={}),e[p]=Cn(x,m)}else e[p]=m})}),e},vy=e=>{for(const t in e)return!1;return!0},_M=(e,t,n,r)=>{if(Ca(r))return n?n[e]:t;n&&(li(r)||Xa(r))&&(n[e]=r)},lr=(e,t,n)=>{if(Ca(n))return e?e.getAttribute(t):null;e&&e.setAttribute(t,n)},Mr=(e,t)=>{e&&e.removeAttribute(t)},Ni=(e,t,n,r)=>{if(n){const o=lr(e,t)||"",s=new Set(o.split(" "));s[r?"add":"delete"](n);const i=Yi(s).join(" ").trim();lr(e,t,i)}},Aee=(e,t,n)=>{const r=lr(e,t)||"";return new Set(r.split(" ")).has(n)},Ko=(e,t)=>_M("scrollLeft",0,e,t),na=(e,t)=>_M("scrollTop",0,e,t),cx=Gd()&&Element.prototype,IM=(e,t)=>{const n=[],r=t?fg(t)?t:null:document;return r?Xt(n,r.querySelectorAll(e)):n},Tee=(e,t)=>{const n=t?fg(t)?t:null:document;return n?n.querySelector(e):null},Jm=(e,t)=>fg(e)?(cx.matches||cx.msMatchesSelector).call(e,t):!1,xy=e=>e?Yi(e.childNodes):[],la=e=>e?e.parentElement:null,Jl=(e,t)=>{if(fg(e)){const n=cx.closest;if(n)return n.call(e,t);do{if(Jm(e,t))return e;e=la(e)}while(e)}return null},Nee=(e,t,n)=>{const r=e&&Jl(e,t),o=e&&Tee(n,r),s=Jl(o,t)===r;return r&&o?r===e||o===e||s&&Jl(Jl(e,n),t)!==r:!1},by=(e,t,n)=>{if(n&&e){let r=t,o;dg(n)?(o=document.createDocumentFragment(),zt(n,s=>{s===r&&(r=s.previousSibling),o.appendChild(s)})):o=n,t&&(r?r!==t&&(r=r.nextSibling):r=e.firstChild),e.insertBefore(o,r||null)}},xo=(e,t)=>{by(e,null,t)},$ee=(e,t)=>{by(la(e),e,t)},Jk=(e,t)=>{by(la(e),e&&e.nextSibling,t)},js=e=>{if(dg(e))zt(Yi(e),t=>js(t));else if(e){const t=la(e);t&&t.removeChild(e)}},$i=e=>{const t=document.createElement("div");return e&&lr(t,"class",e),t},PM=e=>{const t=$i();return t.innerHTML=e.trim(),zt(xy(t),n=>js(n))},ux=e=>e.charAt(0).toUpperCase()+e.slice(1),Lee=()=>$i().style,zee=["-webkit-","-moz-","-o-","-ms-"],Fee=["WebKit","Moz","O","MS","webkit","moz","o","ms"],Dv={},Av={},Bee=e=>{let t=Av[e];if(pg(Av,e))return t;const n=ux(e),r=Lee();return zt(zee,o=>{const s=o.replace(/-/g,"");return!(t=[e,o+e,s+n,ux(s)+n].find(l=>r[l]!==void 0))}),Av[e]=t||""},Kd=e=>{if(Gd()){let t=Dv[e]||window[e];return pg(Dv,e)||(zt(Fee,n=>(t=t||window[n+ux(e)],!t)),Dv[e]=t),t}},Hee=Kd("MutationObserver"),ej=Kd("IntersectionObserver"),ec=Kd("ResizeObserver"),EM=Kd("cancelAnimationFrame"),MM=Kd("requestAnimationFrame"),eh=Gd()&&window.setTimeout,dx=Gd()&&window.clearTimeout,Vee=/[^\x20\t\r\n\f]+/g,OM=(e,t,n)=>{const r=e&&e.classList;let o,s=0,i=!1;if(r&&t&&li(t)){const l=t.match(Vee)||[];for(i=l.length>0;o=l[s++];)i=!!n(r,o)&&i}return i},yy=(e,t)=>{OM(e,t,(n,r)=>n.remove(r))},ra=(e,t)=>(OM(e,t,(n,r)=>n.add(r)),yy.bind(0,e,t)),mg=(e,t,n,r)=>{if(e&&t){let o=!0;return zt(n,s=>{const i=r?r(e[s]):e[s],l=r?r(t[s]):t[s];i!==l&&(o=!1)}),o}return!1},RM=(e,t)=>mg(e,t,["w","h"]),DM=(e,t)=>mg(e,t,["x","y"]),Wee=(e,t)=>mg(e,t,["t","r","b","l"]),tj=(e,t,n)=>mg(e,t,["width","height"],n&&(r=>Math.round(r))),go=()=>{},Kl=e=>{let t;const n=e?eh:MM,r=e?dx:EM;return[o=>{r(t),t=n(o,es(e)?e():e)},()=>r(t)]},Cy=(e,t)=>{let n,r,o,s=go;const{v:i,g:l,p:u}=t||{},p=function(y){s(),dx(n),n=r=void 0,s=go,e.apply(this,y)},m=x=>u&&r?u(r,x):x,h=()=>{s!==go&&p(m(o)||o)},g=function(){const y=Yi(arguments),b=es(i)?i():i;if(Xa(b)&&b>=0){const S=es(l)?l():l,j=Xa(S)&&S>=0,_=b>0?eh:MM,E=b>0?dx:EM,M=m(y)||y,R=p.bind(0,M);s();const D=_(R,b);s=()=>E(D),j&&!n&&(n=eh(h,S)),r=o=M}else p(y)};return g.m=h,g},Uee={opacity:1,zindex:1},yp=(e,t)=>{const n=t?parseFloat(e):parseInt(e,10);return n===n?n:0},Gee=(e,t)=>!Uee[e.toLowerCase()]&&Xa(t)?`${t}px`:t,nj=(e,t,n)=>t!=null?t[n]||t.getPropertyValue(n):e.style[n],Kee=(e,t,n)=>{try{const{style:r}=e;Ca(r[t])?r.setProperty(t,n):r[t]=Gee(t,n)}catch{}},id=e=>ur(e,"direction")==="rtl",rj=(e,t,n)=>{const r=t?`${t}-`:"",o=n?`-${n}`:"",s=`${r}top${o}`,i=`${r}right${o}`,l=`${r}bottom${o}`,u=`${r}left${o}`,p=ur(e,[s,i,l,u]);return{t:yp(p[s],!0),r:yp(p[i],!0),b:yp(p[l],!0),l:yp(p[u],!0)}},{round:oj}=Math,wy={w:0,h:0},ld=e=>e?{w:e.offsetWidth,h:e.offsetHeight}:wy,Wp=e=>e?{w:e.clientWidth,h:e.clientHeight}:wy,th=e=>e?{w:e.scrollWidth,h:e.scrollHeight}:wy,nh=e=>{const t=parseFloat(ur(e,"height"))||0,n=parseFloat(ur(e,"width"))||0;return{w:n-oj(n),h:t-oj(t)}},xs=e=>e.getBoundingClientRect();let Cp;const qee=()=>{if(Ca(Cp)){Cp=!1;try{window.addEventListener("test",null,Object.defineProperty({},"passive",{get(){Cp=!0}}))}catch{}}return Cp},AM=e=>e.split(" "),Xee=(e,t,n,r)=>{zt(AM(t),o=>{e.removeEventListener(o,n,r)})},Wn=(e,t,n,r)=>{var o;const s=qee(),i=(o=s&&r&&r.S)!=null?o:s,l=r&&r.$||!1,u=r&&r.C||!1,p=[],m=s?{passive:i,capture:l}:l;return zt(AM(t),h=>{const g=u?x=>{e.removeEventListener(h,g,l),n&&n(x)}:n;Xt(p,Xee.bind(null,e,h,g,l)),e.addEventListener(h,g,m)}),As.bind(0,p)},TM=e=>e.stopPropagation(),NM=e=>e.preventDefault(),Qee={x:0,y:0},Tv=e=>{const t=e?xs(e):0;return t?{x:t.left+window.pageYOffset,y:t.top+window.pageXOffset}:Qee},sj=(e,t)=>{zt(ts(t)?t:[t],e)},Sy=e=>{const t=new Map,n=(s,i)=>{if(s){const l=t.get(s);sj(u=>{l&&l[u?"delete":"clear"](u)},i)}else t.forEach(l=>{l.clear()}),t.clear()},r=(s,i)=>{if(li(s)){const p=t.get(s)||new Set;return t.set(s,p),sj(m=>{es(m)&&p.add(m)},i),n.bind(0,s,i)}my(i)&&i&&n();const l=ro(s),u=[];return zt(l,p=>{const m=s[p];m&&Xt(u,r(p,m))}),As.bind(0,u)},o=(s,i)=>{const l=t.get(s);zt(Yi(l),u=>{i&&!gy(i)?u.apply(0,i):u()})};return r(e||{}),[r,n,o]},aj=e=>JSON.stringify(e,(t,n)=>{if(es(n))throw new Error;return n}),Yee={paddingAbsolute:!1,showNativeOverlaidScrollbars:!1,update:{elementEvents:[["img","load"]],debounce:[0,33],attributes:null,ignoreMutation:null},overflow:{x:"scroll",y:"scroll"},scrollbars:{theme:"os-theme-dark",visibility:"auto",autoHide:"never",autoHideDelay:1300,dragScroll:!0,clickScroll:!1,pointers:["mouse","touch","pen"]}},$M=(e,t)=>{const n={},r=ro(t).concat(ro(e));return zt(r,o=>{const s=e[o],i=t[o];if(ad(s)&&ad(i))Cn(n[o]={},$M(s,i)),vy(n[o])&&delete n[o];else if(pg(t,o)&&i!==s){let l=!0;if(ts(s)||ts(i))try{aj(s)===aj(i)&&(l=!1)}catch{}l&&(n[o]=i)}}),n},LM="os-environment",zM=`${LM}-flexbox-glue`,Zee=`${zM}-max`,FM="os-scrollbar-hidden",Nv="data-overlayscrollbars-initialize",Bo="data-overlayscrollbars",BM=`${Bo}-overflow-x`,HM=`${Bo}-overflow-y`,mc="overflowVisible",Jee="scrollbarHidden",ij="scrollbarPressed",rh="updating",Fa="data-overlayscrollbars-viewport",$v="arrange",VM="scrollbarHidden",hc=mc,fx="data-overlayscrollbars-padding",ete=hc,lj="data-overlayscrollbars-content",ky="os-size-observer",tte=`${ky}-appear`,nte=`${ky}-listener`,rte="os-trinsic-observer",ote="os-no-css-vars",ste="os-theme-none",Hr="os-scrollbar",ate=`${Hr}-rtl`,ite=`${Hr}-horizontal`,lte=`${Hr}-vertical`,WM=`${Hr}-track`,jy=`${Hr}-handle`,cte=`${Hr}-visible`,ute=`${Hr}-cornerless`,cj=`${Hr}-transitionless`,uj=`${Hr}-interaction`,dj=`${Hr}-unusable`,fj=`${Hr}-auto-hidden`,pj=`${Hr}-wheel`,dte=`${WM}-interactive`,fte=`${jy}-interactive`,UM={},Zi=()=>UM,pte=e=>{const t=[];return zt(ts(e)?e:[e],n=>{const r=ro(n);zt(r,o=>{Xt(t,UM[o]=n[o])})}),t},mte="__osOptionsValidationPlugin",hte="__osSizeObserverPlugin",_y="__osScrollbarsHidingPlugin",gte="__osClickScrollPlugin";let Lv;const mj=(e,t,n,r)=>{xo(e,t);const o=Wp(t),s=ld(t),i=nh(n);return r&&js(t),{x:s.h-o.h+i.h,y:s.w-o.w+i.w}},vte=e=>{let t=!1;const n=ra(e,FM);try{t=ur(e,Bee("scrollbar-width"))==="none"||window.getComputedStyle(e,"::-webkit-scrollbar").getPropertyValue("display")==="none"}catch{}return n(),t},xte=(e,t)=>{const n="hidden";ur(e,{overflowX:n,overflowY:n,direction:"rtl"}),Ko(e,0);const r=Tv(e),o=Tv(t);Ko(e,-999);const s=Tv(t);return{i:r.x===o.x,n:o.x!==s.x}},bte=(e,t)=>{const n=ra(e,zM),r=xs(e),o=xs(t),s=tj(o,r,!0),i=ra(e,Zee),l=xs(e),u=xs(t),p=tj(u,l,!0);return n(),i(),s&&p},yte=()=>{const{body:e}=document,n=PM(`
`)[0],r=n.firstChild,[o,,s]=Sy(),[i,l]=Fo({o:mj(e,n,r),u:DM},mj.bind(0,e,n,r,!0)),[u]=l(),p=vte(n),m={x:u.x===0,y:u.y===0},h={elements:{host:null,padding:!p,viewport:j=>p&&j===j.ownerDocument.body&&j,content:!1},scrollbars:{slot:!0},cancel:{nativeScrollbarsOverlaid:!1,body:null}},g=Cn({},Yee),x=Cn.bind(0,{},g),y=Cn.bind(0,{},h),b={k:u,A:m,I:p,L:ur(n,"zIndex")==="-1",B:xte(n,r),V:bte(n,r),Y:o.bind(0,"z"),j:o.bind(0,"r"),N:y,q:j=>Cn(h,j)&&y(),F:x,G:j=>Cn(g,j)&&x(),X:Cn({},h),U:Cn({},g)},w=window.addEventListener,S=Cy(j=>s(j?"z":"r"),{v:33,g:99});if(Mr(n,"style"),js(n),w("resize",S.bind(0,!1)),!p&&(!m.x||!m.y)){let j;w("resize",()=>{const _=Zi()[_y];j=j||_&&_.R(),j&&j(b,i,S.bind(0,!0))})}return b},Vr=()=>(Lv||(Lv=yte()),Lv),Iy=(e,t)=>es(t)?t.apply(0,e):t,Cte=(e,t,n,r)=>{const o=Ca(r)?n:r;return Iy(e,o)||t.apply(0,e)},GM=(e,t,n,r)=>{const o=Ca(r)?n:r,s=Iy(e,o);return!!s&&(Zm(s)?s:t.apply(0,e))},wte=(e,t,n)=>{const{nativeScrollbarsOverlaid:r,body:o}=n||{},{A:s,I:i}=Vr(),{nativeScrollbarsOverlaid:l,body:u}=t,p=r??l,m=Ca(o)?u:o,h=(s.x||s.y)&&p,g=e&&(ug(m)?!i:m);return!!h||!!g},Py=new WeakMap,Ste=(e,t)=>{Py.set(e,t)},kte=e=>{Py.delete(e)},KM=e=>Py.get(e),hj=(e,t)=>e?t.split(".").reduce((n,r)=>n&&pg(n,r)?n[r]:void 0,e):void 0,px=(e,t,n)=>r=>[hj(e,r),n||hj(t,r)!==void 0],qM=e=>{let t=e;return[()=>t,n=>{t=Cn({},t,n)}]},wp="tabindex",Sp=$i.bind(0,""),zv=e=>{xo(la(e),xy(e)),js(e)},jte=e=>{const t=Vr(),{N:n,I:r}=t,o=Zi()[_y],s=o&&o.T,{elements:i}=n(),{host:l,padding:u,viewport:p,content:m}=i,h=Zm(e),g=h?{}:e,{elements:x}=g,{host:y,padding:b,viewport:w,content:S}=x||{},j=h?e:g.target,_=Jm(j,"textarea"),E=j.ownerDocument,I=E.documentElement,M=j===E.body,R=E.defaultView,D=Cte.bind(0,[j]),A=GM.bind(0,[j]),O=Iy.bind(0,[j]),T=D.bind(0,Sp,p),X=A.bind(0,Sp,m),B=T(w),V=B===j,U=V&&M,N=!V&&X(S),$=!V&&Zm(B)&&B===N,q=$&&!!O(m),F=q?T():B,Q=q?N:X(),se=U?I:$?F:B,ae=_?D(Sp,l,y):j,re=U?se:ae,G=$?Q:N,K=E.activeElement,ee=!V&&R.top===R&&K===j,ce={W:j,Z:re,J:se,K:!V&&A(Sp,u,b),tt:G,nt:!V&&!r&&s&&s(t),ot:U?I:se,st:U?E:se,et:R,ct:E,rt:_,it:M,lt:h,ut:V,dt:$,ft:(Ze,ot)=>Aee(se,V?Bo:Fa,V?ot:Ze),_t:(Ze,ot,ye)=>Ni(se,V?Bo:Fa,V?ot:Ze,ye)},J=ro(ce).reduce((Ze,ot)=>{const ye=ce[ot];return Xt(Ze,ye&&!la(ye)?ye:!1)},[]),ie=Ze=>Ze?hy(J,Ze)>-1:null,{W:de,Z:ge,K:Ce,J:he,tt:fe,nt:Oe}=ce,_e=[()=>{Mr(ge,Bo),Mr(ge,Nv),Mr(de,Nv),M&&(Mr(I,Bo),Mr(I,Nv))}],Ne=_&&ie(ge);let nt=_?de:xy([fe,he,Ce,ge,de].find(Ze=>ie(Ze)===!1));const $e=U?de:fe||he;return[ce,()=>{lr(ge,Bo,V?"viewport":"host"),lr(Ce,fx,""),lr(fe,lj,""),V||lr(he,Fa,"");const Ze=M&&!V?ra(la(j),FM):go;if(Ne&&(Jk(de,ge),Xt(_e,()=>{Jk(ge,de),js(ge)})),xo($e,nt),xo(ge,Ce),xo(Ce||ge,!V&&he),xo(he,fe),Xt(_e,()=>{Ze(),Mr(Ce,fx),Mr(fe,lj),Mr(he,BM),Mr(he,HM),Mr(he,Fa),ie(fe)&&zv(fe),ie(he)&&zv(he),ie(Ce)&&zv(Ce)}),r&&!V&&(Ni(he,Fa,VM,!0),Xt(_e,Mr.bind(0,he,Fa))),Oe&&($ee(he,Oe),Xt(_e,js.bind(0,Oe))),ee){const ot=lr(he,wp);lr(he,wp,"-1"),he.focus();const ye=()=>ot?lr(he,wp,ot):Mr(he,wp),De=Wn(E,"pointerdown keydown",()=>{ye(),De()});Xt(_e,[ye,De])}else K&&K.focus&&K.focus();nt=0},As.bind(0,_e)]},_te=(e,t)=>{const{tt:n}=e,[r]=t;return o=>{const{V:s}=Vr(),{ht:i}=r(),{vt:l}=o,u=(n||!s)&&l;return u&&ur(n,{height:i?"":"100%"}),{gt:u,wt:u}}},Ite=(e,t)=>{const[n,r]=t,{Z:o,K:s,J:i,ut:l}=e,[u,p]=Fo({u:Wee,o:rj()},rj.bind(0,o,"padding",""));return(m,h,g)=>{let[x,y]=p(g);const{I:b,V:w}=Vr(),{bt:S}=n(),{gt:j,wt:_,yt:E}=m,[I,M]=h("paddingAbsolute");(j||y||!w&&_)&&([x,y]=u(g));const D=!l&&(M||E||y);if(D){const A=!I||!s&&!b,O=x.r+x.l,T=x.t+x.b,X={marginRight:A&&!S?-O:0,marginBottom:A?-T:0,marginLeft:A&&S?-O:0,top:A?-x.t:0,right:A?S?-x.r:"auto":0,left:A?S?"auto":-x.l:0,width:A?`calc(100% + ${O}px)`:""},B={paddingTop:A?x.t:0,paddingRight:A?x.r:0,paddingBottom:A?x.b:0,paddingLeft:A?x.l:0};ur(s||i,X),ur(i,B),r({K:x,St:!A,P:s?B:Cn({},X,B)})}return{xt:D}}},{max:mx}=Math,Ba=mx.bind(0,0),XM="visible",gj="hidden",Pte=42,kp={u:RM,o:{w:0,h:0}},Ete={u:DM,o:{x:gj,y:gj}},Mte=(e,t)=>{const n=window.devicePixelRatio%1!==0?1:0,r={w:Ba(e.w-t.w),h:Ba(e.h-t.h)};return{w:r.w>n?r.w:0,h:r.h>n?r.h:0}},jp=e=>e.indexOf(XM)===0,Ote=(e,t)=>{const[n,r]=t,{Z:o,K:s,J:i,nt:l,ut:u,_t:p,it:m,et:h}=e,{k:g,V:x,I:y,A:b}=Vr(),w=Zi()[_y],S=!u&&!y&&(b.x||b.y),j=m&&u,[_,E]=Fo(kp,nh.bind(0,i)),[I,M]=Fo(kp,th.bind(0,i)),[R,D]=Fo(kp),[A,O]=Fo(kp),[T]=Fo(Ete),X=(q,F)=>{if(ur(i,{height:""}),F){const{St:Q,K:Y}=n(),{$t:se,D:ae}=q,re=nh(o),G=Wp(o),K=ur(i,"boxSizing")==="content-box",ee=Q||K?Y.b+Y.t:0,ce=!(b.x&&K);ur(i,{height:G.h+re.h+(se.x&&ce?ae.x:0)-ee})}},B=(q,F)=>{const Q=!y&&!q?Pte:0,Y=(ie,de,ge)=>{const Ce=ur(i,ie),fe=(F?F[ie]:Ce)==="scroll";return[Ce,fe,fe&&!y?de?Q:ge:0,de&&!!Q]},[se,ae,re,G]=Y("overflowX",b.x,g.x),[K,ee,ce,J]=Y("overflowY",b.y,g.y);return{Ct:{x:se,y:K},$t:{x:ae,y:ee},D:{x:re,y:ce},M:{x:G,y:J}}},V=(q,F,Q,Y)=>{const se=(ee,ce)=>{const J=jp(ee),ie=ce&&J&&ee.replace(`${XM}-`,"")||"";return[ce&&!J?ee:"",jp(ie)?"hidden":ie]},[ae,re]=se(Q.x,F.x),[G,K]=se(Q.y,F.y);return Y.overflowX=re&&G?re:ae,Y.overflowY=K&&ae?K:G,B(q,Y)},U=(q,F,Q,Y)=>{const{D:se,M:ae}=q,{x:re,y:G}=ae,{x:K,y:ee}=se,{P:ce}=n(),J=F?"marginLeft":"marginRight",ie=F?"paddingLeft":"paddingRight",de=ce[J],ge=ce.marginBottom,Ce=ce[ie],he=ce.paddingBottom;Y.width=`calc(100% + ${ee+-1*de}px)`,Y[J]=-ee+de,Y.marginBottom=-K+ge,Q&&(Y[ie]=Ce+(G?ee:0),Y.paddingBottom=he+(re?K:0))},[N,$]=w?w.H(S,x,i,l,n,B,U):[()=>S,()=>[go]];return(q,F,Q)=>{const{gt:Y,Ot:se,wt:ae,xt:re,vt:G,yt:K}=q,{ht:ee,bt:ce}=n(),[J,ie]=F("showNativeOverlaidScrollbars"),[de,ge]=F("overflow"),Ce=J&&b.x&&b.y,he=!u&&!x&&(Y||ae||se||ie||G),fe=jp(de.x),Oe=jp(de.y),_e=fe||Oe;let Ne=E(Q),nt=M(Q),$e=D(Q),Pt=O(Q),Ze;if(ie&&y&&p(VM,Jee,!Ce),he&&(Ze=B(Ce),X(Ze,ee)),Y||re||ae||K||ie){_e&&p(hc,mc,!1);const[ke,Be]=$(Ce,ce,Ze),[ze,Ge]=Ne=_(Q),[pt,Pn]=nt=I(Q),Dt=Wp(i);let At=pt,pr=Dt;ke(),(Pn||Ge||ie)&&Be&&!Ce&&N(Be,pt,ze,ce)&&(pr=Wp(i),At=th(i));const Ln={w:Ba(mx(pt.w,At.w)+ze.w),h:Ba(mx(pt.h,At.h)+ze.h)},kn={w:Ba((j?h.innerWidth:pr.w+Ba(Dt.w-pt.w))+ze.w),h:Ba((j?h.innerHeight+ze.h:pr.h+Ba(Dt.h-pt.h))+ze.h)};Pt=A(kn),$e=R(Mte(Ln,kn),Q)}const[ot,ye]=Pt,[De,ut]=$e,[bt,be]=nt,[Je,lt]=Ne,ft={x:De.w>0,y:De.h>0},Me=fe&&Oe&&(ft.x||ft.y)||fe&&ft.x&&!ft.y||Oe&&ft.y&&!ft.x;if(re||K||lt||be||ye||ut||ge||ie||he){const ke={marginRight:0,marginBottom:0,marginLeft:0,width:"",overflowY:"",overflowX:""},Be=V(Ce,ft,de,ke),ze=N(Be,bt,Je,ce);u||U(Be,ce,ze,ke),he&&X(Be,ee),u?(lr(o,BM,ke.overflowX),lr(o,HM,ke.overflowY)):ur(i,ke)}Ni(o,Bo,mc,Me),Ni(s,fx,ete,Me),u||Ni(i,Fa,hc,_e);const[Le,Ut]=T(B(Ce).Ct);return r({Ct:Le,zt:{x:ot.w,y:ot.h},Tt:{x:De.w,y:De.h},Et:ft}),{It:Ut,At:ye,Lt:ut}}},vj=(e,t,n)=>{const r={},o=t||{},s=ro(e).concat(ro(o));return zt(s,i=>{const l=e[i],u=o[i];r[i]=!!(n||l||u)}),r},Rte=(e,t)=>{const{W:n,J:r,_t:o,ut:s}=e,{I:i,A:l,V:u}=Vr(),p=!i&&(l.x||l.y),m=[_te(e,t),Ite(e,t),Ote(e,t)];return(h,g,x)=>{const y=vj(Cn({gt:!1,xt:!1,yt:!1,vt:!1,At:!1,Lt:!1,It:!1,Ot:!1,wt:!1},g),{},x),b=p||!u,w=b&&Ko(r),S=b&&na(r);o("",rh,!0);let j=y;return zt(m,_=>{j=vj(j,_(j,h,!!x)||{},x)}),Ko(r,w),na(r,S),o("",rh),s||(Ko(n,0),na(n,0)),j}},Dte=(e,t,n)=>{let r,o=!1;const s=()=>{o=!0},i=l=>{if(n){const u=n.reduce((p,m)=>{if(m){const[h,g]=m,x=g&&h&&(l?l(h):IM(h,e));x&&x.length&&g&&li(g)&&Xt(p,[x,g.trim()],!0)}return p},[]);zt(u,p=>zt(p[0],m=>{const h=p[1],g=r.get(m)||[];if(e.contains(m)){const y=Wn(m,h,b=>{o?(y(),r.delete(m)):t(b)});r.set(m,Xt(g,y))}else As(g),r.delete(m)}))}};return n&&(r=new WeakMap,i()),[s,i]},xj=(e,t,n,r)=>{let o=!1;const{Ht:s,Pt:i,Dt:l,Mt:u,Rt:p,kt:m}=r||{},h=Cy(()=>{o&&n(!0)},{v:33,g:99}),[g,x]=Dte(e,h,l),y=s||[],b=i||[],w=y.concat(b),S=(_,E)=>{const I=p||go,M=m||go,R=new Set,D=new Set;let A=!1,O=!1;if(zt(_,T=>{const{attributeName:X,target:B,type:V,oldValue:U,addedNodes:N,removedNodes:$}=T,q=V==="attributes",F=V==="childList",Q=e===B,Y=q&&li(X)?lr(B,X):0,se=Y!==0&&U!==Y,ae=hy(b,X)>-1&&se;if(t&&(F||!Q)){const re=!q,G=q&&se,K=G&&u&&Jm(B,u),ce=(K?!I(B,X,U,Y):re||G)&&!M(T,!!K,e,r);zt(N,J=>R.add(J)),zt($,J=>R.add(J)),O=O||ce}!t&&Q&&se&&!I(B,X,U,Y)&&(D.add(X),A=A||ae)}),R.size>0&&x(T=>Yi(R).reduce((X,B)=>(Xt(X,IM(T,B)),Jm(B,T)?Xt(X,B):X),[])),t)return!E&&O&&n(!1),[!1];if(D.size>0||A){const T=[Yi(D),A];return!E&&n.apply(0,T),T}},j=new Hee(_=>S(_));return j.observe(e,{attributes:!0,attributeOldValue:!0,attributeFilter:w,subtree:t,childList:t,characterData:t}),o=!0,[()=>{o&&(g(),j.disconnect(),o=!1)},()=>{if(o){h.m();const _=j.takeRecords();return!gy(_)&&S(_,!0)}}]},_p=3333333,Ip=e=>e&&(e.height||e.width),QM=(e,t,n)=>{const{Bt:r=!1,Vt:o=!1}=n||{},s=Zi()[hte],{B:i}=Vr(),u=PM(`
`)[0],p=u.firstChild,m=id.bind(0,e),[h]=Fo({o:void 0,_:!0,u:(b,w)=>!(!b||!Ip(b)&&Ip(w))}),g=b=>{const w=ts(b)&&b.length>0&&ad(b[0]),S=!w&&my(b[0]);let j=!1,_=!1,E=!0;if(w){const[I,,M]=h(b.pop().contentRect),R=Ip(I),D=Ip(M);j=!M||!R,_=!D&&R,E=!j}else S?[,E]=b:_=b===!0;if(r&&E){const I=S?b[0]:id(u);Ko(u,I?i.n?-_p:i.i?0:_p:_p),na(u,_p)}j||t({gt:!S,Yt:S?b:void 0,Vt:!!_})},x=[];let y=o?g:!1;return[()=>{As(x),js(u)},()=>{if(ec){const b=new ec(g);b.observe(p),Xt(x,()=>{b.disconnect()})}else if(s){const[b,w]=s.O(p,g,o);y=b,Xt(x,w)}if(r){const[b]=Fo({o:void 0},m);Xt(x,Wn(u,"scroll",w=>{const S=b(),[j,_,E]=S;_&&(yy(p,"ltr rtl"),j?ra(p,"rtl"):ra(p,"ltr"),g([!!j,_,E])),TM(w)}))}y&&(ra(u,tte),Xt(x,Wn(u,"animationstart",y,{C:!!ec}))),(ec||s)&&xo(e,u)}]},Ate=e=>e.h===0||e.isIntersecting||e.intersectionRatio>0,Tte=(e,t)=>{let n;const r=$i(rte),o=[],[s]=Fo({o:!1}),i=(u,p)=>{if(u){const m=s(Ate(u)),[,h]=m;if(h)return!p&&t(m),[m]}},l=(u,p)=>{if(u&&u.length>0)return i(u.pop(),p)};return[()=>{As(o),js(r)},()=>{if(ej)n=new ej(u=>l(u),{root:e}),n.observe(r),Xt(o,()=>{n.disconnect()});else{const u=()=>{const h=ld(r);i(h)},[p,m]=QM(r,u);Xt(o,p),m(),u()}xo(e,r)},()=>{if(n)return l(n.takeRecords(),!0)}]},bj=`[${Bo}]`,Nte=`[${Fa}]`,Fv=["tabindex"],yj=["wrap","cols","rows"],Bv=["id","class","style","open"],$te=(e,t,n)=>{let r,o,s;const{Z:i,J:l,tt:u,rt:p,ut:m,ft:h,_t:g}=e,{V:x}=Vr(),[y]=Fo({u:RM,o:{w:0,h:0}},()=>{const V=h(hc,mc),U=h($v,""),N=U&&Ko(l),$=U&&na(l);g(hc,mc),g($v,""),g("",rh,!0);const q=th(u),F=th(l),Q=nh(l);return g(hc,mc,V),g($v,"",U),g("",rh),Ko(l,N),na(l,$),{w:F.w+q.w+Q.w,h:F.h+q.h+Q.h}}),b=p?yj:Bv.concat(yj),w=Cy(n,{v:()=>r,g:()=>o,p(V,U){const[N]=V,[$]=U;return[ro(N).concat(ro($)).reduce((q,F)=>(q[F]=N[F]||$[F],q),{})]}}),S=V=>{zt(V||Fv,U=>{if(hy(Fv,U)>-1){const N=lr(i,U);li(N)?lr(l,U,N):Mr(l,U)}})},j=(V,U)=>{const[N,$]=V,q={vt:$};return t({ht:N}),!U&&n(q),q},_=({gt:V,Yt:U,Vt:N})=>{const $=!V||N?n:w;let q=!1;if(U){const[F,Q]=U;q=Q,t({bt:F})}$({gt:V,yt:q})},E=(V,U)=>{const[,N]=y(),$={wt:N};return N&&!U&&(V?n:w)($),$},I=(V,U,N)=>{const $={Ot:U};return U?!N&&w($):m||S(V),$},[M,R,D]=u||!x?Tte(i,j):[go,go,go],[A,O]=m?[go,go]:QM(i,_,{Vt:!0,Bt:!0}),[T,X]=xj(i,!1,I,{Pt:Bv,Ht:Bv.concat(Fv)}),B=m&&ec&&new ec(_.bind(0,{gt:!0}));return B&&B.observe(i),S(),[()=>{M(),A(),s&&s[0](),B&&B.disconnect(),T()},()=>{O(),R()},()=>{const V={},U=X(),N=D(),$=s&&s[1]();return U&&Cn(V,I.apply(0,Xt(U,!0))),N&&Cn(V,j.apply(0,Xt(N,!0))),$&&Cn(V,E.apply(0,Xt($,!0))),V},V=>{const[U]=V("update.ignoreMutation"),[N,$]=V("update.attributes"),[q,F]=V("update.elementEvents"),[Q,Y]=V("update.debounce"),se=F||$,ae=re=>es(U)&&U(re);if(se&&(s&&(s[1](),s[0]()),s=xj(u||l,!0,E,{Ht:b.concat(N||[]),Dt:q,Mt:bj,kt:(re,G)=>{const{target:K,attributeName:ee}=re;return(!G&&ee&&!m?Nee(K,bj,Nte):!1)||!!Jl(K,`.${Hr}`)||!!ae(re)}})),Y)if(w.m(),ts(Q)){const re=Q[0],G=Q[1];r=Xa(re)&&re,o=Xa(G)&&G}else Xa(Q)?(r=Q,o=!1):(r=!1,o=!1)}]},Cj={x:0,y:0},Lte=e=>({K:{t:0,r:0,b:0,l:0},St:!1,P:{marginRight:0,marginBottom:0,marginLeft:0,paddingTop:0,paddingRight:0,paddingBottom:0,paddingLeft:0},zt:Cj,Tt:Cj,Ct:{x:"hidden",y:"hidden"},Et:{x:!1,y:!1},ht:!1,bt:id(e.Z)}),zte=(e,t)=>{const n=px(t,{}),[r,o,s]=Sy(),[i,l,u]=jte(e),p=qM(Lte(i)),[m,h]=p,g=Rte(i,p),x=(_,E,I)=>{const R=ro(_).some(D=>_[D])||!vy(E)||I;return R&&s("u",[_,E,I]),R},[y,b,w,S]=$te(i,h,_=>x(g(n,_),{},!1)),j=m.bind(0);return j.jt=_=>r("u",_),j.Nt=()=>{const{W:_,J:E}=i,I=Ko(_),M=na(_);b(),l(),Ko(E,I),na(E,M)},j.qt=i,[(_,E)=>{const I=px(t,_,E);return S(I),x(g(I,w(),E),_,!!E)},j,()=>{o(),y(),u()}]},{round:wj}=Math,Fte=e=>{const{width:t,height:n}=xs(e),{w:r,h:o}=ld(e);return{x:wj(t)/r||1,y:wj(n)/o||1}},Bte=(e,t,n)=>{const r=t.scrollbars,{button:o,isPrimary:s,pointerType:i}=e,{pointers:l}=r;return o===0&&s&&r[n?"dragScroll":"clickScroll"]&&(l||[]).includes(i)},Hte=(e,t)=>Wn(e,"mousedown",Wn.bind(0,t,"click",TM,{C:!0,$:!0}),{$:!0}),Sj="pointerup pointerleave pointercancel lostpointercapture",Vte=(e,t,n,r,o,s,i)=>{const{B:l}=Vr(),{Ft:u,Gt:p,Xt:m}=r,h=`scroll${i?"Left":"Top"}`,g=`client${i?"X":"Y"}`,x=i?"width":"height",y=i?"left":"top",b=i?"w":"h",w=i?"x":"y",S=(j,_)=>E=>{const{Tt:I}=s(),M=ld(p)[b]-ld(u)[b],D=_*E/M*I[w],O=id(m)&&i?l.n||l.i?1:-1:1;o[h]=j+D*O};return Wn(p,"pointerdown",j=>{const _=Jl(j.target,`.${jy}`)===u,E=_?u:p;if(Ni(t,Bo,ij,!0),Bte(j,e,_)){const I=!_&&j.shiftKey,M=()=>xs(u),R=()=>xs(p),D=(F,Q)=>(F||M())[y]-(Q||R())[y],A=S(o[h]||0,1/Fte(o)[w]),O=j[g],T=M(),X=R(),B=T[x],V=D(T,X)+B/2,U=O-X[y],N=_?0:U-V,$=F=>{As(q),E.releasePointerCapture(F.pointerId)},q=[Ni.bind(0,t,Bo,ij),Wn(n,Sj,$),Wn(n,"selectstart",F=>NM(F),{S:!1}),Wn(p,Sj,$),Wn(p,"pointermove",F=>{const Q=F[g]-O;(_||I)&&A(N+Q)})];if(I)A(N);else if(!_){const F=Zi()[gte];F&&Xt(q,F.O(A,D,N,B,U))}E.setPointerCapture(j.pointerId)}})},Wte=(e,t)=>(n,r,o,s,i,l)=>{const{Xt:u}=n,[p,m]=Kl(333),h=!!i.scrollBy;let g=!0;return As.bind(0,[Wn(u,"pointerenter",()=>{r(uj,!0)}),Wn(u,"pointerleave pointercancel",()=>{r(uj)}),Wn(u,"wheel",x=>{const{deltaX:y,deltaY:b,deltaMode:w}=x;h&&g&&w===0&&la(u)===s&&i.scrollBy({left:y,top:b,behavior:"smooth"}),g=!1,r(pj,!0),p(()=>{g=!0,r(pj)}),NM(x)},{S:!1,$:!0}),Hte(u,o),Vte(e,s,o,n,i,t,l),m])},{min:hx,max:kj,abs:Ute,round:Gte}=Math,YM=(e,t,n,r)=>{if(r){const l=n?"x":"y",{Tt:u,zt:p}=r,m=p[l],h=u[l];return kj(0,hx(1,m/(m+h)))}const o=n?"width":"height",s=xs(e)[o],i=xs(t)[o];return kj(0,hx(1,s/i))},Kte=(e,t,n,r,o,s)=>{const{B:i}=Vr(),l=s?"x":"y",u=s?"Left":"Top",{Tt:p}=r,m=Gte(p[l]),h=Ute(n[`scroll${u}`]),g=s&&o,x=i.i?h:m-h,b=hx(1,(g?x:h)/m),w=YM(e,t,s);return 1/w*(1-w)*b},qte=(e,t,n)=>{const{N:r,L:o}=Vr(),{scrollbars:s}=r(),{slot:i}=s,{ct:l,W:u,Z:p,J:m,lt:h,ot:g,it:x,ut:y}=t,{scrollbars:b}=h?{}:e,{slot:w}=b||{},S=GM([u,p,m],()=>y&&x?u:p,i,w),j=(N,$,q)=>{const F=q?ra:yy;zt(N,Q=>{F(Q.Xt,$)})},_=(N,$)=>{zt(N,q=>{const[F,Q]=$(q);ur(F,Q)})},E=(N,$,q)=>{_(N,F=>{const{Ft:Q,Gt:Y}=F;return[Q,{[q?"width":"height"]:`${(100*YM(Q,Y,q,$)).toFixed(3)}%`}]})},I=(N,$,q)=>{const F=q?"X":"Y";_(N,Q=>{const{Ft:Y,Gt:se,Xt:ae}=Q,re=Kte(Y,se,g,$,id(ae),q);return[Y,{transform:re===re?`translate${F}(${(100*re).toFixed(3)}%)`:""}]})},M=[],R=[],D=[],A=(N,$,q)=>{const F=my(q),Q=F?q:!0,Y=F?!q:!0;Q&&j(R,N,$),Y&&j(D,N,$)},O=N=>{E(R,N,!0),E(D,N)},T=N=>{I(R,N,!0),I(D,N)},X=N=>{const $=N?ite:lte,q=N?R:D,F=gy(q)?cj:"",Q=$i(`${Hr} ${$} ${F}`),Y=$i(WM),se=$i(jy),ae={Xt:Q,Gt:Y,Ft:se};return o||ra(Q,ote),xo(Q,Y),xo(Y,se),Xt(q,ae),Xt(M,[js.bind(0,Q),n(ae,A,l,p,g,N)]),ae},B=X.bind(0,!0),V=X.bind(0,!1),U=()=>{xo(S,R[0].Xt),xo(S,D[0].Xt),eh(()=>{A(cj)},300)};return B(),V(),[{Ut:O,Wt:T,Zt:A,Jt:{Kt:R,Qt:B,tn:_.bind(0,R)},nn:{Kt:D,Qt:V,tn:_.bind(0,D)}},U,As.bind(0,M)]},Xte=(e,t,n,r)=>{let o,s,i,l,u,p=0;const m=qM({}),[h]=m,[g,x]=Kl(),[y,b]=Kl(),[w,S]=Kl(100),[j,_]=Kl(100),[E,I]=Kl(()=>p),[M,R,D]=qte(e,n.qt,Wte(t,n)),{Z:A,J:O,ot:T,st:X,ut:B,it:V}=n.qt,{Jt:U,nn:N,Zt:$,Ut:q,Wt:F}=M,{tn:Q}=U,{tn:Y}=N,se=ee=>{const{Xt:ce}=ee,J=B&&!V&&la(ce)===O&&ce;return[J,{transform:J?`translate(${Ko(T)}px, ${na(T)}px)`:""}]},ae=(ee,ce)=>{if(I(),ee)$(fj);else{const J=()=>$(fj,!0);p>0&&!ce?E(J):J()}},re=()=>{l=s,l&&ae(!0)},G=[S,I,_,b,x,D,Wn(A,"pointerover",re,{C:!0}),Wn(A,"pointerenter",re),Wn(A,"pointerleave",()=>{l=!1,s&&ae(!1)}),Wn(A,"pointermove",()=>{o&&g(()=>{S(),ae(!0),j(()=>{o&&ae(!1)})})}),Wn(X,"scroll",ee=>{y(()=>{F(n()),i&&ae(!0),w(()=>{i&&!l&&ae(!1)})}),r(ee),B&&Q(se),B&&Y(se)})],K=h.bind(0);return K.qt=M,K.Nt=R,[(ee,ce,J)=>{const{At:ie,Lt:de,It:ge,yt:Ce}=J,{A:he}=Vr(),fe=px(t,ee,ce),Oe=n(),{Tt:_e,Ct:Ne,bt:nt}=Oe,[$e,Pt]=fe("showNativeOverlaidScrollbars"),[Ze,ot]=fe("scrollbars.theme"),[ye,De]=fe("scrollbars.visibility"),[ut,bt]=fe("scrollbars.autoHide"),[be]=fe("scrollbars.autoHideDelay"),[Je,lt]=fe("scrollbars.dragScroll"),[ft,Me]=fe("scrollbars.clickScroll"),Le=ie||de||Ce,Ut=ge||De,ke=$e&&he.x&&he.y,Be=(ze,Ge)=>{const pt=ye==="visible"||ye==="auto"&&ze==="scroll";return $(cte,pt,Ge),pt};if(p=be,Pt&&$(ste,ke),ot&&($(u),$(Ze,!0),u=Ze),bt&&(o=ut==="move",s=ut==="leave",i=ut!=="never",ae(!i,!0)),lt&&$(fte,Je),Me&&$(dte,ft),Ut){const ze=Be(Ne.x,!0),Ge=Be(Ne.y,!1);$(ute,!(ze&&Ge))}Le&&(q(Oe),F(Oe),$(dj,!_e.x,!0),$(dj,!_e.y,!1),$(ate,nt&&!V))},K,As.bind(0,G)]},ZM=(e,t,n)=>{es(e)&&e(t||void 0,n||void 0)},Ua=(e,t,n)=>{const{F:r,N:o,Y:s,j:i}=Vr(),l=Zi(),u=Zm(e),p=u?e:e.target,m=KM(p);if(t&&!m){let h=!1;const g=B=>{const V=Zi()[mte],U=V&&V.O;return U?U(B,!0):B},x=Cn({},r(),g(t)),[y,b,w]=Sy(n),[S,j,_]=zte(e,x),[E,I,M]=Xte(e,x,j,B=>w("scroll",[X,B])),R=(B,V)=>S(B,!!V),D=R.bind(0,{},!0),A=s(D),O=i(D),T=B=>{kte(p),A(),O(),M(),_(),h=!0,w("destroyed",[X,!!B]),b()},X={options(B,V){if(B){const U=V?r():{},N=$M(x,Cn(U,g(B)));vy(N)||(Cn(x,N),R(N))}return Cn({},x)},on:y,off:(B,V)=>{B&&V&&b(B,V)},state(){const{zt:B,Tt:V,Ct:U,Et:N,K:$,St:q,bt:F}=j();return Cn({},{overflowEdge:B,overflowAmount:V,overflowStyle:U,hasOverflow:N,padding:$,paddingAbsolute:q,directionRTL:F,destroyed:h})},elements(){const{W:B,Z:V,K:U,J:N,tt:$,ot:q,st:F}=j.qt,{Jt:Q,nn:Y}=I.qt,se=re=>{const{Ft:G,Gt:K,Xt:ee}=re;return{scrollbar:ee,track:K,handle:G}},ae=re=>{const{Kt:G,Qt:K}=re,ee=se(G[0]);return Cn({},ee,{clone:()=>{const ce=se(K());return E({},!0,{}),ce}})};return Cn({},{target:B,host:V,padding:U||N,viewport:N,content:$||N,scrollOffsetElement:q,scrollEventElement:F,scrollbarHorizontal:ae(Q),scrollbarVertical:ae(Y)})},update:B=>R({},B),destroy:T.bind(0)};return j.jt((B,V,U)=>{E(V,U,B)}),Ste(p,X),zt(ro(l),B=>ZM(l[B],0,X)),wte(j.qt.it,o().cancel,!u&&e.cancel)?(T(!0),X):(j.Nt(),I.Nt(),w("initialized",[X]),j.jt((B,V,U)=>{const{gt:N,yt:$,vt:q,At:F,Lt:Q,It:Y,wt:se,Ot:ae}=B;w("updated",[X,{updateHints:{sizeChanged:N,directionChanged:$,heightIntrinsicChanged:q,overflowEdgeChanged:F,overflowAmountChanged:Q,overflowStyleChanged:Y,contentMutation:se,hostMutation:ae},changedOptions:V,force:U}])}),X.update(!0),X)}return m};Ua.plugin=e=>{zt(pte(e),t=>ZM(t,Ua))};Ua.valid=e=>{const t=e&&e.elements,n=es(t)&&t();return lx(n)&&!!KM(n.target)};Ua.env=()=>{const{k:e,A:t,I:n,B:r,V:o,L:s,X:i,U:l,N:u,q:p,F:m,G:h}=Vr();return Cn({},{scrollbarsSize:e,scrollbarsOverlaid:t,scrollbarsHiding:n,rtlScrollBehavior:r,flexboxGlue:o,cssCustomProperties:s,staticDefaultInitialization:i,staticDefaultOptions:l,getDefaultInitialization:u,setDefaultInitialization:p,getDefaultOptions:m,setDefaultOptions:h})};const Qte=()=>{if(typeof window>"u"){const p=()=>{};return[p,p]}let e,t;const n=window,r=typeof n.requestIdleCallback=="function",o=n.requestAnimationFrame,s=n.cancelAnimationFrame,i=r?n.requestIdleCallback:o,l=r?n.cancelIdleCallback:s,u=()=>{l(e),s(t)};return[(p,m)=>{u(),e=i(r?()=>{u(),t=o(p)}:p,typeof m=="object"?m:{timeout:2233})},u]},Ey=e=>{const{options:t,events:n,defer:r}=e||{},[o,s]=d.useMemo(Qte,[]),i=d.useRef(null),l=d.useRef(r),u=d.useRef(t),p=d.useRef(n);return d.useEffect(()=>{l.current=r},[r]),d.useEffect(()=>{const{current:m}=i;u.current=t,Ua.valid(m)&&m.options(t||{},!0)},[t]),d.useEffect(()=>{const{current:m}=i;p.current=n,Ua.valid(m)&&m.on(n||{},!0)},[n]),d.useEffect(()=>()=>{var m;s(),(m=i.current)==null||m.destroy()},[]),d.useMemo(()=>[m=>{const h=i.current;if(Ua.valid(h))return;const g=l.current,x=u.current||{},y=p.current||{},b=()=>i.current=Ua(m,x,y);g?o(b,g):b()},()=>i.current],[])},Yte=(e,t)=>{const{element:n="div",options:r,events:o,defer:s,children:i,...l}=e,u=n,p=d.useRef(null),m=d.useRef(null),[h,g]=Ey({options:r,events:o,defer:s});return d.useEffect(()=>{const{current:x}=p,{current:y}=m;return x&&y&&h({target:x,elements:{viewport:y,content:y}}),()=>{var b;return(b=g())==null?void 0:b.destroy()}},[h,n]),d.useImperativeHandle(t,()=>({osInstance:g,getElement:()=>p.current}),[]),H.createElement(u,{"data-overlayscrollbars-initialize":"",ref:p,...l},H.createElement("div",{ref:m},i))},hg=d.forwardRef(Yte),Zte=e=>{const{boardToDelete:t,setBoardToDelete:n}=e,{t:r}=Z(),o=W(j=>j.config.canRestoreDeletedImagesFromBin),{currentData:s,isFetching:i}=yD((t==null?void 0:t.board_id)??$r.skipToken),l=d.useMemo(()=>le([xe],j=>{const _=(s??[]).map(I=>rI(j,I));return{imageUsageSummary:{isInitialImage:Xr(_,I=>I.isInitialImage),isCanvasImage:Xr(_,I=>I.isCanvasImage),isNodesImage:Xr(_,I=>I.isNodesImage),isControlNetImage:Xr(_,I=>I.isControlNetImage),isIPAdapterImage:Xr(_,I=>I.isIPAdapterImage)}}}),[s]),[u,{isLoading:p}]=CD(),[m,{isLoading:h}]=wD(),{imageUsageSummary:g}=W(l),x=d.useCallback(()=>{t&&(u(t.board_id),n(void 0))},[t,u,n]),y=d.useCallback(()=>{t&&(m(t.board_id),n(void 0))},[t,m,n]),b=d.useCallback(()=>{n(void 0)},[n]),w=d.useRef(null),S=d.useMemo(()=>h||p||i,[h,p,i]);return t?a.jsx(Td,{isOpen:!!t,onClose:b,leastDestructiveRef:w,isCentered:!0,children:a.jsx(Yo,{children:a.jsxs(Nd,{children:[a.jsxs(Qo,{fontSize:"lg",fontWeight:"bold",children:["Delete ",t.board_name]}),a.jsx(Zo,{children:a.jsxs(L,{direction:"column",gap:3,children:[i?a.jsx(Gh,{children:a.jsx(L,{sx:{w:"full",h:32}})}):a.jsx(nM,{imageUsage:g,topMessage:r("boards.topMessage"),bottomMessage:r("boards.bottomMessage")}),a.jsx(ve,{children:"Deleted boards cannot be restored."}),a.jsx(ve,{children:r(o?"gallery.deleteImageBin":"gallery.deleteImagePermanent")})]})}),a.jsx(Ss,{children:a.jsxs(L,{sx:{justifyContent:"space-between",width:"full",gap:2},children:[a.jsx(at,{ref:w,onClick:b,children:"Cancel"}),a.jsx(at,{colorScheme:"warning",isLoading:S,onClick:x,children:"Delete Board Only"}),a.jsx(at,{colorScheme:"error",isLoading:S,onClick:y,children:"Delete Board and Images"})]})})]})})}):null},Jte=d.memo(Zte),ene=()=>{const{t:e}=Z(),[t,{isLoading:n}]=SD(),r=e("boards.myBoard"),o=d.useCallback(()=>{t(r)},[t,r]);return a.jsx(Fe,{icon:a.jsx(Vc,{}),isLoading:n,tooltip:e("boards.addBoard"),"aria-label":e("boards.addBoard"),onClick:o,size:"sm","data-testid":"add-board-button"})},tne=d.memo(ene);var JM=wh({displayName:"ExternalLinkIcon",path:a.jsxs("g",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeWidth:"2",children:[a.jsx("path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"}),a.jsx("path",{d:"M15 3h6v6"}),a.jsx("path",{d:"M10 14L21 3"})]})}),gg=wh({d:"M12 8l-6 6 1.41 1.41L12 10.83l4.59 4.58L18 14z",displayName:"ChevronUpIcon"}),nne=wh({displayName:"CloseIcon",d:"M.439,21.44a1.5,1.5,0,0,0,2.122,2.121L11.823,14.3a.25.25,0,0,1,.354,0l9.262,9.263a1.5,1.5,0,1,0,2.122-2.121L14.3,12.177a.25.25,0,0,1,0-.354l9.263-9.262A1.5,1.5,0,0,0,21.439.44L12.177,9.7a.25.25,0,0,1-.354,0L2.561.44A1.5,1.5,0,0,0,.439,2.561L9.7,11.823a.25.25,0,0,1,0,.354Z"}),rne=wh({displayName:"DeleteIcon",path:a.jsx("g",{fill:"currentColor",children:a.jsx("path",{d:"M19.452 7.5H4.547a.5.5 0 00-.5.545l1.287 14.136A2 2 0 007.326 24h9.347a2 2 0 001.992-1.819L19.95 8.045a.5.5 0 00-.129-.382.5.5 0 00-.369-.163zm-9.2 13a.75.75 0 01-1.5 0v-9a.75.75 0 011.5 0zm5 0a.75.75 0 01-1.5 0v-9a.75.75 0 011.5 0zM22 4h-4.75a.25.25 0 01-.25-.25V2.5A2.5 2.5 0 0014.5 0h-5A2.5 2.5 0 007 2.5v1.25a.25.25 0 01-.25.25H2a1 1 0 000 2h20a1 1 0 000-2zM9 3.75V2.5a.5.5 0 01.5-.5h5a.5.5 0 01.5.5v1.25a.25.25 0 01-.25.25h-5.5A.25.25 0 019 3.75z"})})});const one=le([xe],({gallery:e})=>{const{boardSearchText:t}=e;return{boardSearchText:t}},Se),sne=()=>{const e=te(),{boardSearchText:t}=W(one),n=d.useRef(null),{t:r}=Z(),o=d.useCallback(u=>{e(rw(u))},[e]),s=d.useCallback(()=>{e(rw(""))},[e]),i=d.useCallback(u=>{u.key==="Escape"&&s()},[s]),l=d.useCallback(u=>{o(u.target.value)},[o]);return d.useEffect(()=>{n.current&&n.current.focus()},[]),a.jsxs(l3,{children:[a.jsx(Mh,{ref:n,placeholder:r("boards.searchBoard"),value:t,onKeyDown:i,onChange:l,"data-testid":"board-search-input"}),t&&t.length&&a.jsx(Ib,{children:a.jsx(ys,{onClick:s,size:"xs",variant:"ghost","aria-label":r("boards.clearSearch"),opacity:.5,icon:a.jsx(nne,{boxSize:2})})})]})},ane=d.memo(sne);function e8(e){return kD(e)}function ine(e){return jD(e)}const t8=(e,t)=>{if(!e||!(t!=null&&t.data.current))return!1;const{actionType:n}=e,{payloadType:r}=t.data.current;if(e.id===t.data.current.id)return!1;switch(n){case"ADD_FIELD_TO_LINEAR":return r==="NODE_FIELD";case"SET_CURRENT_IMAGE":return r==="IMAGE_DTO";case"SET_INITIAL_IMAGE":return r==="IMAGE_DTO";case"SET_CONTROLNET_IMAGE":return r==="IMAGE_DTO";case"SET_IP_ADAPTER_IMAGE":return r==="IMAGE_DTO";case"SET_CANVAS_INITIAL_IMAGE":return r==="IMAGE_DTO";case"SET_NODES_IMAGE":return r==="IMAGE_DTO";case"SET_MULTI_NODES_IMAGE":return r==="IMAGE_DTO"||"IMAGE_DTOS";case"ADD_TO_BATCH":return r==="IMAGE_DTO"||"IMAGE_DTOS";case"ADD_TO_BOARD":{if(!(r==="IMAGE_DTO"||"IMAGE_DTOS"))return!1;if(r==="IMAGE_DTO"){const{imageDTO:s}=t.data.current.payload,i=s.board_id??"none",l=e.context.boardId;return i!==l}return r==="IMAGE_DTOS"}case"REMOVE_FROM_BOARD":{if(!(r==="IMAGE_DTO"||"IMAGE_DTOS"))return!1;if(r==="IMAGE_DTO"){const{imageDTO:s}=t.data.current.payload;return s.board_id!=="none"}return r==="IMAGE_DTOS"}default:return!1}},lne=e=>{const{isOver:t,label:n="Drop"}=e,r=d.useRef(Zs()),{colorMode:o}=ha();return a.jsx(In.div,{initial:{opacity:0},animate:{opacity:1,transition:{duration:.1}},exit:{opacity:0,transition:{duration:.1}},children:a.jsxs(L,{sx:{position:"absolute",top:0,insetInlineStart:0,w:"full",h:"full"},children:[a.jsx(L,{sx:{position:"absolute",top:0,insetInlineStart:0,w:"full",h:"full",bg:Ae("base.700","base.900")(o),opacity:.7,borderRadius:"base",alignItems:"center",justifyContent:"center",transitionProperty:"common",transitionDuration:"0.1s"}}),a.jsx(L,{sx:{position:"absolute",top:.5,insetInlineStart:.5,insetInlineEnd:.5,bottom:.5,opacity:1,borderWidth:2,borderColor:t?Ae("base.50","base.50")(o):Ae("base.200","base.300")(o),borderRadius:"lg",borderStyle:"dashed",transitionProperty:"common",transitionDuration:"0.1s",alignItems:"center",justifyContent:"center"},children:a.jsx(Ie,{sx:{fontSize:"2xl",fontWeight:600,transform:t?"scale(1.1)":"scale(1)",color:t?Ae("base.50","base.50")(o):Ae("base.200","base.300")(o),transitionProperty:"common",transitionDuration:"0.1s"},children:n})})]})},r.current)},n8=d.memo(lne),cne=e=>{const{dropLabel:t,data:n,disabled:r}=e,o=d.useRef(Zs()),{isOver:s,setNodeRef:i,active:l}=e8({id:o.current,disabled:r,data:n});return a.jsx(Ie,{ref:i,position:"absolute",top:0,insetInlineStart:0,w:"full",h:"full",pointerEvents:l?"auto":"none",children:a.jsx(dr,{children:t8(n,l)&&a.jsx(n8,{isOver:s,label:t})})})},My=d.memo(cne),une=({isSelected:e,isHovered:t})=>a.jsx(Ie,{className:"selection-box",sx:{position:"absolute",top:0,insetInlineEnd:0,bottom:0,insetInlineStart:0,borderRadius:"base",opacity:e?1:.7,transitionProperty:"common",transitionDuration:"0.1s",pointerEvents:"none",shadow:e?t?"hoverSelected.light":"selected.light":t?"hoverUnselected.light":void 0,_dark:{shadow:e?t?"hoverSelected.dark":"selected.dark":t?"hoverUnselected.dark":void 0}}}),Oy=d.memo(une),dne=()=>a.jsx(L,{sx:{position:"absolute",insetInlineEnd:0,top:0,p:1},children:a.jsx(Ds,{variant:"solid",sx:{bg:"accent.400",_dark:{bg:"accent.500"}},children:"auto"})}),r8=d.memo(dne);function Ry(e){const[t,n]=d.useState(!1),[r,o]=d.useState(!1),[s,i]=d.useState(!1),[l,u]=d.useState([0,0]),p=d.useRef(null),m=W(g=>g.ui.globalContextMenuCloseTrigger);d.useEffect(()=>{if(t)setTimeout(()=>{o(!0),setTimeout(()=>{i(!0)})});else{i(!1);const g=setTimeout(()=>{o(t)},1e3);return()=>clearTimeout(g)}},[t]),d.useEffect(()=>{n(!1),i(!1),o(!1)},[m]),dF("contextmenu",g=>{var x;(x=p.current)!=null&&x.contains(g.target)||g.target===p.current?(g.preventDefault(),n(!0),u([g.pageX,g.pageY])):n(!1)});const h=d.useCallback(()=>{var g,x;(x=(g=e.menuProps)==null?void 0:g.onClose)==null||x.call(g),n(!1)},[e.menuProps]);return a.jsxs(a.Fragment,{children:[e.children(p),r&&a.jsx(Ac,{...e.portalProps,children:a.jsxs(Ah,{isOpen:s,gutter:0,...e.menuProps,onClose:h,children:[a.jsx(Th,{"aria-hidden":!0,w:1,h:1,style:{position:"absolute",left:l[0],top:l[1],cursor:"default"},...e.menuButtonProps}),e.renderMenu()]})})]})}const vg=e=>{const{boardName:t}=yd(void 0,{selectFromResult:({data:n})=>{const r=n==null?void 0:n.find(s=>s.board_id===e);return{boardName:(r==null?void 0:r.board_name)||"Uncategorized"}}});return t},fne=({board:e,setBoardToDelete:t})=>{const n=d.useCallback(()=>{t&&t(e)},[e,t]);return a.jsxs(a.Fragment,{children:[e.image_count>0&&a.jsx(a.Fragment,{}),a.jsx(en,{sx:{color:"error.600",_dark:{color:"error.300"}},icon:a.jsx(Br,{}),onClick:n,children:"Delete Board"})]})},pne=d.memo(fne),mne=()=>a.jsx(a.Fragment,{}),hne=d.memo(mne),gne=({board:e,board_id:t,setBoardToDelete:n,children:r})=>{const o=te(),s=d.useMemo(()=>le(xe,({gallery:g})=>{const x=g.autoAddBoardId===t,y=g.autoAssignBoardOnClick;return{isAutoAdd:x,autoAssignBoardOnClick:y}},Se),[t]),{isAutoAdd:i,autoAssignBoardOnClick:l}=W(s),u=vg(t),p=d.useCallback(()=>{o(hh(t))},[t,o]),m=d.useCallback(g=>{g.preventDefault()},[]),{t:h}=Z();return a.jsx(Ry,{menuProps:{size:"sm",isLazy:!0},menuButtonProps:{bg:"transparent",_hover:{bg:"transparent"}},renderMenu:()=>a.jsx(Ui,{sx:{visibility:"visible !important"},motionProps:vc,onContextMenu:m,children:a.jsxs(td,{title:u,children:[a.jsx(en,{icon:a.jsx(Vc,{}),isDisabled:i||l,onClick:p,children:h("boards.menuItemAutoAdd")}),!e&&a.jsx(hne,{}),e&&a.jsx(pne,{board:e,setBoardToDelete:n})]})}),children:r})},o8=d.memo(gne),vne=({board:e,isSelected:t,setBoardToDelete:n})=>{const r=te(),o=d.useMemo(()=>le(xe,({gallery:A})=>{const O=e.board_id===A.autoAddBoardId,T=A.autoAssignBoardOnClick;return{isSelectedForAutoAdd:O,autoAssignBoardOnClick:T}},Se),[e.board_id]),{isSelectedForAutoAdd:s,autoAssignBoardOnClick:i}=W(o),[l,u]=d.useState(!1),p=d.useCallback(()=>{u(!0)},[]),m=d.useCallback(()=>{u(!1)},[]),{data:h}=cI(e.board_id),{data:g}=uI(e.board_id),x=d.useMemo(()=>{if(!(!h||!g))return`${h} image${h>1?"s":""}, ${g} asset${g>1?"s":""}`},[g,h]),{currentData:y}=to(e.cover_image_name??$r.skipToken),{board_name:b,board_id:w}=e,[S,j]=d.useState(b),_=d.useCallback(()=>{r(dI({boardId:w})),i&&r(hh(w))},[w,i,r]),[E,{isLoading:I}]=_D(),M=d.useMemo(()=>({id:w,actionType:"ADD_TO_BOARD",context:{boardId:w}}),[w]),R=d.useCallback(async A=>{if(!A.trim()){j(b);return}if(A!==b)try{const{board_name:O}=await E({board_id:w,changes:{board_name:A}}).unwrap();j(O)}catch{j(b)}},[w,b,E]),D=d.useCallback(A=>{j(A)},[]);return a.jsx(Ie,{sx:{w:"full",h:"full",touchAction:"none",userSelect:"none"},children:a.jsx(L,{onMouseOver:p,onMouseOut:m,sx:{position:"relative",justifyContent:"center",alignItems:"center",aspectRatio:"1/1",w:"full",h:"full"},children:a.jsx(o8,{board:e,board_id:w,setBoardToDelete:n,children:A=>a.jsx(Ht,{label:x,openDelay:1e3,hasArrow:!0,children:a.jsxs(L,{ref:A,onClick:_,sx:{w:"full",h:"full",position:"relative",justifyContent:"center",alignItems:"center",borderRadius:"base",cursor:"pointer",bg:"base.200",_dark:{bg:"base.800"}},children:[y!=null&&y.thumbnail_url?a.jsx(ga,{src:y==null?void 0:y.thumbnail_url,draggable:!1,sx:{objectFit:"cover",w:"full",h:"full",maxH:"full",borderRadius:"base",borderBottomRadius:"lg"}}):a.jsx(L,{sx:{w:"full",h:"full",justifyContent:"center",alignItems:"center"},children:a.jsx(Tn,{boxSize:12,as:see,sx:{mt:-6,opacity:.7,color:"base.500",_dark:{color:"base.500"}}})}),s&&a.jsx(r8,{}),a.jsx(Oy,{isSelected:t,isHovered:l}),a.jsx(L,{sx:{position:"absolute",bottom:0,left:0,p:1,justifyContent:"center",alignItems:"center",w:"full",maxW:"full",borderBottomRadius:"base",bg:t?"accent.400":"base.500",color:t?"base.50":"base.100",_dark:{bg:t?"accent.500":"base.600",color:t?"base.50":"base.100"},lineHeight:"short",fontSize:"xs"},children:a.jsxs(Ih,{value:S,isDisabled:I,submitOnBlur:!0,onChange:D,onSubmit:R,sx:{w:"full"},children:[a.jsx(_h,{sx:{p:0,fontWeight:t?700:500,textAlign:"center",overflow:"hidden",textOverflow:"ellipsis"},noOfLines:1}),a.jsx(jh,{sx:{p:0,_focusVisible:{p:0,textAlign:"center",boxShadow:"none"}}})]})}),a.jsx(My,{data:M,dropLabel:a.jsx(ve,{fontSize:"md",children:"Move"})})]})})})})})},xne=d.memo(vne),bne=le(xe,({gallery:e})=>{const{autoAddBoardId:t,autoAssignBoardOnClick:n}=e;return{autoAddBoardId:t,autoAssignBoardOnClick:n}},Se),s8=d.memo(({isSelected:e})=>{const t=te(),{autoAddBoardId:n,autoAssignBoardOnClick:r}=W(bne),o=vg("none"),s=d.useCallback(()=>{t(dI({boardId:"none"})),r&&t(hh("none"))},[t,r]),[i,l]=d.useState(!1),u=d.useCallback(()=>{l(!0)},[]),p=d.useCallback(()=>{l(!1)},[]),m=d.useMemo(()=>({id:"no_board",actionType:"REMOVE_FROM_BOARD"}),[]);return a.jsx(Ie,{sx:{w:"full",h:"full",touchAction:"none",userSelect:"none"},children:a.jsx(L,{onMouseOver:u,onMouseOut:p,sx:{position:"relative",justifyContent:"center",alignItems:"center",aspectRatio:"1/1",borderRadius:"base",w:"full",h:"full"},children:a.jsx(o8,{board_id:"none",children:h=>a.jsxs(L,{ref:h,onClick:s,sx:{w:"full",h:"full",position:"relative",justifyContent:"center",alignItems:"center",borderRadius:"base",cursor:"pointer",bg:"base.200",_dark:{bg:"base.800"}},children:[a.jsx(L,{sx:{w:"full",h:"full",justifyContent:"center",alignItems:"center"},children:a.jsx(ga,{src:Hx,alt:"invoke-ai-logo",sx:{opacity:.4,filter:"grayscale(1)",mt:-6,w:16,h:16,minW:16,minH:16,userSelect:"none"}})}),n==="none"&&a.jsx(r8,{}),a.jsx(L,{sx:{position:"absolute",bottom:0,left:0,p:1,justifyContent:"center",alignItems:"center",w:"full",maxW:"full",borderBottomRadius:"base",bg:e?"accent.400":"base.500",color:e?"base.50":"base.100",_dark:{bg:e?"accent.500":"base.600",color:e?"base.50":"base.100"},lineHeight:"short",fontSize:"xs",fontWeight:e?700:500},children:o}),a.jsx(Oy,{isSelected:e,isHovered:i}),a.jsx(My,{data:m,dropLabel:a.jsx(ve,{fontSize:"md",children:"Move"})})]})})})})});s8.displayName="HoverableBoard";const yne=d.memo(s8),Cne=le([xe],({gallery:e})=>{const{selectedBoardId:t,boardSearchText:n}=e;return{selectedBoardId:t,boardSearchText:n}},Se),wne=e=>{const{isOpen:t}=e,{selectedBoardId:n,boardSearchText:r}=W(Cne),{data:o}=yd(),s=r?o==null?void 0:o.filter(u=>u.board_name.toLowerCase().includes(r.toLowerCase())):o,[i,l]=d.useState();return a.jsxs(a.Fragment,{children:[a.jsx(Id,{in:t,animateOpacity:!0,children:a.jsxs(L,{layerStyle:"first",sx:{flexDir:"column",gap:2,p:2,mt:2,borderRadius:"base"},children:[a.jsxs(L,{sx:{gap:2,alignItems:"center"},children:[a.jsx(ane,{}),a.jsx(tne,{})]}),a.jsx(hg,{defer:!0,style:{height:"100%",width:"100%"},options:{scrollbars:{visibility:"auto",autoHide:"move",autoHideDelay:1300,theme:"os-theme-dark"}},children:a.jsxs(Ja,{className:"list-container","data-testid":"boards-list",sx:{gridTemplateColumns:"repeat(auto-fill, minmax(108px, 1fr));",maxH:346},children:[a.jsx(Zu,{sx:{p:1.5},"data-testid":"no-board",children:a.jsx(yne,{isSelected:n==="none"})}),s&&s.map((u,p)=>a.jsx(Zu,{sx:{p:1.5},"data-testid":`board-${p}`,children:a.jsx(xne,{board:u,isSelected:n===u.board_id,setBoardToDelete:l})},u.board_id))]})})]})}),a.jsx(Jte,{boardToDelete:i,setBoardToDelete:l})]})},Sne=d.memo(wne),kne=le([xe],e=>{const{selectedBoardId:t}=e.gallery;return{selectedBoardId:t}},Se),jne=e=>{const{isOpen:t,onToggle:n}=e,{selectedBoardId:r}=W(kne),o=vg(r),s=d.useMemo(()=>o.length>20?`${o.substring(0,20)}...`:o,[o]);return a.jsxs(L,{as:Za,onClick:n,size:"sm",sx:{position:"relative",gap:2,w:"full",justifyContent:"space-between",alignItems:"center",px:2},children:[a.jsx(ve,{noOfLines:1,sx:{fontWeight:600,w:"100%",textAlign:"center",color:"base.800",_dark:{color:"base.200"}},children:s}),a.jsx(gg,{sx:{transform:t?"rotate(0deg)":"rotate(180deg)",transitionProperty:"common",transitionDuration:"normal"}})]})},_ne=d.memo(jne),Ine=e=>{const{triggerComponent:t,children:n,hasArrow:r=!0,isLazy:o=!0,...s}=e;return a.jsxs(Ld,{isLazy:o,...s,children:[a.jsx(Wh,{children:t}),a.jsxs(zd,{shadow:"dark-lg",children:[r&&a.jsx(H3,{}),n]})]})},qd=d.memo(Ine);function Pne(e){return Te({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{d:"M12 16c1.671 0 3-1.331 3-3s-1.329-3-3-3-3 1.331-3 3 1.329 3 3 3z"}},{tag:"path",attr:{d:"M20.817 11.186a8.94 8.94 0 0 0-1.355-3.219 9.053 9.053 0 0 0-2.43-2.43 8.95 8.95 0 0 0-3.219-1.355 9.028 9.028 0 0 0-1.838-.18V2L8 5l3.975 3V6.002c.484-.002.968.044 1.435.14a6.961 6.961 0 0 1 2.502 1.053 7.005 7.005 0 0 1 1.892 1.892A6.967 6.967 0 0 1 19 13a7.032 7.032 0 0 1-.55 2.725 7.11 7.11 0 0 1-.644 1.188 7.2 7.2 0 0 1-.858 1.039 7.028 7.028 0 0 1-3.536 1.907 7.13 7.13 0 0 1-2.822 0 6.961 6.961 0 0 1-2.503-1.054 7.002 7.002 0 0 1-1.89-1.89A6.996 6.996 0 0 1 5 13H3a9.02 9.02 0 0 0 1.539 5.034 9.096 9.096 0 0 0 2.428 2.428A8.95 8.95 0 0 0 12 22a9.09 9.09 0 0 0 1.814-.183 9.014 9.014 0 0 0 3.218-1.355 8.886 8.886 0 0 0 1.331-1.099 9.228 9.228 0 0 0 1.1-1.332A8.952 8.952 0 0 0 21 13a9.09 9.09 0 0 0-.183-1.814z"}}]})(e)}const a8=je((e,t)=>{const[n,r]=d.useState(!1),{label:o,value:s,min:i=1,max:l=100,step:u=1,onChange:p,tooltipSuffix:m="",withSliderMarks:h=!1,withInput:g=!1,isInteger:x=!1,inputWidth:y=16,withReset:b=!1,hideTooltip:w=!1,isCompact:S=!1,isDisabled:j=!1,sliderMarks:_,handleReset:E,sliderFormControlProps:I,sliderFormLabelProps:M,sliderMarkProps:R,sliderTrackProps:D,sliderThumbProps:A,sliderNumberInputProps:O,sliderNumberInputFieldProps:T,sliderNumberInputStepperProps:X,sliderTooltipProps:B,sliderIAIIconButtonProps:V,...U}=e,N=te(),{t:$}=Z(),[q,F]=d.useState(String(s));d.useEffect(()=>{F(s)},[s]);const Q=d.useMemo(()=>O!=null&&O.min?O.min:i,[i,O==null?void 0:O.min]),Y=d.useMemo(()=>O!=null&&O.max?O.max:l,[l,O==null?void 0:O.max]),se=d.useCallback(J=>{p(J)},[p]),ae=d.useCallback(J=>{J.target.value===""&&(J.target.value=String(Q));const ie=Fi(x?Math.floor(Number(J.target.value)):Number(q),Q,Y),de=Mu(ie,u);p(de),F(de)},[x,q,Q,Y,p,u]),re=d.useCallback(J=>{F(J)},[]),G=d.useCallback(()=>{E&&E()},[E]),K=d.useCallback(J=>{J.target instanceof HTMLDivElement&&J.target.focus()},[]),ee=d.useCallback(J=>{J.shiftKey&&N(Nr(!0))},[N]),ce=d.useCallback(J=>{J.shiftKey||N(Nr(!1))},[N]);return a.jsxs(Kt,{ref:t,onClick:K,sx:S?{display:"flex",flexDirection:"row",alignItems:"center",columnGap:4,margin:0,padding:0}:{},isDisabled:j,...I,children:[o&&a.jsx(wn,{sx:g?{mb:-1.5}:{},...M,children:o}),a.jsxs(Rh,{w:"100%",gap:2,alignItems:"center",children:[a.jsxs(Wb,{"aria-label":o,value:s,min:i,max:l,step:u,onChange:se,onMouseEnter:()=>r(!0),onMouseLeave:()=>r(!1),focusThumbOnChange:!1,isDisabled:j,...U,children:[h&&!_&&a.jsxs(a.Fragment,{children:[a.jsx(Ul,{value:i,sx:{insetInlineStart:"0 !important",insetInlineEnd:"unset !important"},...R,children:i}),a.jsx(Ul,{value:l,sx:{insetInlineStart:"unset !important",insetInlineEnd:"0 !important"},...R,children:l})]}),h&&_&&a.jsx(a.Fragment,{children:_.map((J,ie)=>ie===0?a.jsx(Ul,{value:J,sx:{insetInlineStart:"0 !important",insetInlineEnd:"unset !important"},...R,children:J},J):ie===_.length-1?a.jsx(Ul,{value:J,sx:{insetInlineStart:"unset !important",insetInlineEnd:"0 !important"},...R,children:J},J):a.jsx(Ul,{value:J,sx:{transform:"translateX(-50%)"},...R,children:J},J))}),a.jsx(Gb,{...D,children:a.jsx(Kb,{})}),a.jsx(Ht,{hasArrow:!0,placement:"top",isOpen:n,label:`${s}${m}`,hidden:w,...B,children:a.jsx(Ub,{...A,zIndex:0})})]}),g&&a.jsxs(Lh,{min:Q,max:Y,step:u,value:q,onChange:re,onBlur:ae,focusInputOnChange:!1,...O,children:[a.jsx(Fh,{onKeyDown:ee,onKeyUp:ce,minWidth:y,...T}),a.jsxs(zh,{...X,children:[a.jsx(Hh,{onClick:()=>p(Number(q))}),a.jsx(Bh,{onClick:()=>p(Number(q))})]})]}),b&&a.jsx(Fe,{size:"sm","aria-label":$("accessibility.reset"),tooltip:$("accessibility.reset"),icon:a.jsx(Pne,{}),isDisabled:j,onClick:G,...V})]})]})});a8.displayName="IAISlider";const tt=d.memo(a8),i8=d.forwardRef(({label:e,tooltip:t,description:n,disabled:r,...o},s)=>a.jsx(Ht,{label:t,placement:"top",hasArrow:!0,openDelay:500,children:a.jsx(Ie,{ref:s,...o,children:a.jsxs(Ie,{children:[a.jsx(wc,{children:e}),n&&a.jsx(wc,{size:"xs",color:"base.600",children:n})]})})}));i8.displayName="IAIMantineSelectItemWithTooltip";const ci=d.memo(i8),Ene=le([xe],({gallery:e})=>{const{autoAddBoardId:t,autoAssignBoardOnClick:n}=e;return{autoAddBoardId:t,autoAssignBoardOnClick:n}},Se),Mne=()=>{const e=te(),{t}=Z(),{autoAddBoardId:n,autoAssignBoardOnClick:r}=W(Ene),o=d.useRef(null),{boards:s,hasBoards:i}=yd(void 0,{selectFromResult:({data:u})=>{const p=[{label:"None",value:"none"}];return u==null||u.forEach(({board_id:m,board_name:h})=>{p.push({label:h,value:m})}),{boards:p,hasBoards:p.length>1}}}),l=d.useCallback(u=>{u&&e(hh(u))},[e]);return a.jsx(nn,{label:t("boards.autoAddBoard"),inputRef:o,autoFocus:!0,placeholder:t("boards.selectBoard"),value:n,data:s,nothingFound:t("boards.noMatching"),itemComponent:ci,disabled:!i||r,filter:(u,p)=>{var m;return((m=p.label)==null?void 0:m.toLowerCase().includes(u.toLowerCase().trim()))||p.value.toLowerCase().includes(u.toLowerCase().trim())},onChange:l})},One=d.memo(Mne),Rne=e=>{const{label:t,...n}=e,{colorMode:r}=ha();return a.jsx(Md,{colorScheme:"accent",...n,children:a.jsx(ve,{sx:{fontSize:"sm",color:Ae("base.800","base.200")(r)},children:t})})},br=d.memo(Rne),Dne=le([xe],e=>{const{galleryImageMinimumWidth:t,shouldAutoSwitch:n,autoAssignBoardOnClick:r}=e.gallery;return{galleryImageMinimumWidth:t,shouldAutoSwitch:n,autoAssignBoardOnClick:r}},Se),Ane=()=>{const e=te(),{t}=Z(),{galleryImageMinimumWidth:n,shouldAutoSwitch:r,autoAssignBoardOnClick:o}=W(Dne),s=d.useCallback(u=>{e(ow(u))},[e]),i=d.useCallback(()=>{e(ow(64))},[e]),l=d.useCallback(u=>{e(ID(u.target.checked))},[e]);return a.jsx(qd,{triggerComponent:a.jsx(Fe,{tooltip:t("gallery.gallerySettings"),"aria-label":t("gallery.gallerySettings"),size:"sm",icon:a.jsx(yM,{})}),children:a.jsxs(L,{direction:"column",gap:2,children:[a.jsx(tt,{value:n,onChange:s,min:45,max:256,hideTooltip:!0,label:t("gallery.galleryImageSize"),withReset:!0,handleReset:i}),a.jsx(dn,{label:t("gallery.autoSwitchNewImages"),isChecked:r,onChange:l}),a.jsx(br,{label:t("gallery.autoAssignBoardOnClick"),isChecked:o,onChange:u=>e(PD(u.target.checked))}),a.jsx(One,{})]})})},Tne=d.memo(Ane),Nne=e=>e.image?a.jsx(Gh,{sx:{w:`${e.image.width}px`,h:"auto",objectFit:"contain",aspectRatio:`${e.image.width}/${e.image.height}`}}):a.jsx(L,{sx:{opacity:.7,w:"full",h:"full",alignItems:"center",justifyContent:"center",borderRadius:"base",bg:"base.200",_dark:{bg:"base.900"}},children:a.jsx(fa,{size:"xl"})}),Zn=e=>{const{icon:t=Qi,boxSize:n=16,sx:r,...o}=e;return a.jsxs(L,{sx:{w:"full",h:"full",alignItems:"center",justifyContent:"center",borderRadius:"base",flexDir:"column",gap:2,userSelect:"none",opacity:.7,color:"base.700",_dark:{color:"base.500"},...r},...o,children:[t&&a.jsx(Tn,{as:t,boxSize:n,opacity:.7}),e.label&&a.jsx(ve,{textAlign:"center",children:e.label})]})},$ne=e=>{const{sx:t,...n}=e;return a.jsxs(L,{sx:{w:"full",h:"full",alignItems:"center",justifyContent:"center",borderRadius:"base",flexDir:"column",gap:2,userSelect:"none",opacity:.7,color:"base.700",_dark:{color:"base.500"},...t},...n,children:[a.jsx(fa,{size:"xl"}),e.label&&a.jsx(ve,{textAlign:"center",children:e.label})]})},xg=0,ui=1,Wc=2,l8=4;function c8(e,t){return n=>e(t(n))}function Lne(e,t){return t(e)}function u8(e,t){return n=>e(t,n)}function jj(e,t){return()=>e(t)}function bg(e,t){return t(e),e}function hn(...e){return e}function zne(e){e()}function _j(e){return()=>e}function Fne(...e){return()=>{e.map(zne)}}function Dy(e){return e!==void 0}function Uc(){}function Yt(e,t){return e(ui,t)}function wt(e,t){e(xg,t)}function Ay(e){e(Wc)}function bo(e){return e(l8)}function st(e,t){return Yt(e,u8(t,xg))}function ca(e,t){const n=e(ui,r=>{n(),t(r)});return n}function Tt(){const e=[];return(t,n)=>{switch(t){case Wc:e.splice(0,e.length);return;case ui:return e.push(n),()=>{const r=e.indexOf(n);r>-1&&e.splice(r,1)};case xg:e.slice().forEach(r=>{r(n)});return;default:throw new Error(`unrecognized action ${t}`)}}}function Ve(e){let t=e;const n=Tt();return(r,o)=>{switch(r){case ui:o(t);break;case xg:t=o;break;case l8:return t}return n(r,o)}}function Bne(e){let t,n;const r=()=>t&&t();return function(o,s){switch(o){case ui:return s?n===s?void 0:(r(),n=s,t=Yt(e,s),t):(r(),Uc);case Wc:r(),n=null;return;default:throw new Error(`unrecognized action ${o}`)}}}function Jr(e){return bg(Tt(),t=>st(e,t))}function yr(e,t){return bg(Ve(t),n=>st(e,n))}function Hne(...e){return t=>e.reduceRight(Lne,t)}function Pe(e,...t){const n=Hne(...t);return(r,o)=>{switch(r){case ui:return Yt(e,n(o));case Wc:Ay(e);return}}}function d8(e,t){return e===t}function fn(e=d8){let t;return n=>r=>{e(t,r)||(t=r,n(r))}}function gt(e){return t=>n=>{e(n)&&t(n)}}function Xe(e){return t=>c8(t,e)}function qs(e){return t=>()=>t(e)}function bs(e,t){return n=>r=>n(t=e(t,r))}function Pc(e){return t=>n=>{e>0?e--:t(n)}}function Ga(e){let t=null,n;return r=>o=>{t=o,!n&&(n=setTimeout(()=>{n=void 0,r(t)},e))}}function Ij(e){let t,n;return r=>o=>{t=o,n&&clearTimeout(n),n=setTimeout(()=>{r(t)},e)}}function _t(...e){const t=new Array(e.length);let n=0,r=null;const o=Math.pow(2,e.length)-1;return e.forEach((s,i)=>{const l=Math.pow(2,i);Yt(s,u=>{const p=n;n=n|l,t[i]=u,p!==o&&n===o&&r&&(r(),r=null)})}),s=>i=>{const l=()=>s([i].concat(t));n===o?l():r=l}}function Pj(...e){return function(t,n){switch(t){case ui:return Fne(...e.map(r=>Yt(r,n)));case Wc:return;default:throw new Error(`unrecognized action ${t}`)}}}function ht(e,t=d8){return Pe(e,fn(t))}function Qn(...e){const t=Tt(),n=new Array(e.length);let r=0;const o=Math.pow(2,e.length)-1;return e.forEach((s,i)=>{const l=Math.pow(2,i);Yt(s,u=>{n[i]=u,r=r|l,r===o&&wt(t,n)})}),function(s,i){switch(s){case ui:return r===o&&i(n),Yt(t,i);case Wc:return Ay(t);default:throw new Error(`unrecognized action ${s}`)}}}function qt(e,t=[],{singleton:n}={singleton:!0}){return{id:Vne(),constructor:e,dependencies:t,singleton:n}}const Vne=()=>Symbol();function Wne(e){const t=new Map,n=({id:r,constructor:o,dependencies:s,singleton:i})=>{if(i&&t.has(r))return t.get(r);const l=o(s.map(u=>n(u)));return i&&t.set(r,l),l};return n(e)}function Une(e,t){const n={},r={};let o=0;const s=e.length;for(;o(w[S]=j=>{const _=b[t.methods[S]];wt(_,j)},w),{})}function m(b){return i.reduce((w,S)=>(w[S]=Bne(b[t.events[S]]),w),{})}return{Component:H.forwardRef((b,w)=>{const{children:S,...j}=b,[_]=H.useState(()=>bg(Wne(e),I=>u(I,j))),[E]=H.useState(jj(m,_));return Pp(()=>{for(const I of i)I in j&&Yt(E[I],j[I]);return()=>{Object.values(E).map(Ay)}},[j,E,_]),Pp(()=>{u(_,j)}),H.useImperativeHandle(w,_j(p(_))),H.createElement(l.Provider,{value:_},n?H.createElement(n,Une([...r,...o,...i],j),S):S)}),usePublisher:b=>H.useCallback(u8(wt,H.useContext(l)[b]),[b]),useEmitterValue:b=>{const S=H.useContext(l)[b],[j,_]=H.useState(jj(bo,S));return Pp(()=>Yt(S,E=>{E!==j&&_(_j(E))}),[S,j]),j},useEmitter:(b,w)=>{const j=H.useContext(l)[b];Pp(()=>Yt(j,w),[w,j])}}}const Gne=typeof document<"u"?H.useLayoutEffect:H.useEffect,Kne=Gne;var eo=(e=>(e[e.DEBUG=0]="DEBUG",e[e.INFO=1]="INFO",e[e.WARN=2]="WARN",e[e.ERROR=3]="ERROR",e))(eo||{});const qne={0:"debug",1:"log",2:"warn",3:"error"},Xne=()=>typeof globalThis>"u"?window:globalThis,di=qt(()=>{const e=Ve(3);return{log:Ve((n,r,o=1)=>{var s;const i=(s=Xne().VIRTUOSO_LOG_LEVEL)!=null?s:bo(e);o>=i&&console[qne[o]]("%creact-virtuoso: %c%s %o","color: #0253b3; font-weight: bold","color: initial",n,r)}),logLevel:e}},[],{singleton:!0});function Ty(e,t=!0){const n=H.useRef(null);let r=o=>{};if(typeof ResizeObserver<"u"){const o=H.useMemo(()=>new ResizeObserver(s=>{const i=s[0].target;i.offsetParent!==null&&e(i)}),[e]);r=s=>{s&&t?(o.observe(s),n.current=s):(n.current&&o.unobserve(n.current),n.current=null)}}return{ref:n,callbackRef:r}}function ll(e,t=!0){return Ty(e,t).callbackRef}function Qne(e,t,n,r,o,s,i){const l=H.useCallback(u=>{const p=Yne(u.children,t,"offsetHeight",o);let m=u.parentElement;for(;!m.dataset.virtuosoScroller;)m=m.parentElement;const h=m.lastElementChild.dataset.viewportType==="window",g=i?i.scrollTop:h?window.pageYOffset||document.documentElement.scrollTop:m.scrollTop,x=i?i.scrollHeight:h?document.documentElement.scrollHeight:m.scrollHeight,y=i?i.offsetHeight:h?window.innerHeight:m.offsetHeight;r({scrollTop:Math.max(g,0),scrollHeight:x,viewportHeight:y}),s==null||s(Zne("row-gap",getComputedStyle(u).rowGap,o)),p!==null&&e(p)},[e,t,o,s,i,r]);return Ty(l,n)}function Yne(e,t,n,r){const o=e.length;if(o===0)return null;const s=[];for(let i=0;i{const g=h.target,x=g===window||g===document,y=x?window.pageYOffset||document.documentElement.scrollTop:g.scrollTop,b=x?document.documentElement.scrollHeight:g.scrollHeight,w=x?window.innerHeight:g.offsetHeight,S=()=>{e({scrollTop:Math.max(y,0),scrollHeight:b,viewportHeight:w})};h.suppressFlushSync?S():ED.flushSync(S),i.current!==null&&(y===i.current||y<=0||y===b-w)&&(i.current=null,t(!0),l.current&&(clearTimeout(l.current),l.current=null))},[e,t]);H.useEffect(()=>{const h=o||s.current;return r(o||s.current),u({target:h,suppressFlushSync:!0}),h.addEventListener("scroll",u,{passive:!0}),()=>{r(null),h.removeEventListener("scroll",u)}},[s,u,n,r,o]);function p(h){const g=s.current;if(!g||"offsetHeight"in g&&g.offsetHeight===0)return;const x=h.behavior==="smooth";let y,b,w;g===window?(b=Math.max(ri(document.documentElement,"height"),document.documentElement.scrollHeight),y=window.innerHeight,w=document.documentElement.scrollTop):(b=g.scrollHeight,y=ri(g,"height"),w=g.scrollTop);const S=b-y;if(h.top=Math.ceil(Math.max(Math.min(S,h.top),0)),p8(y,b)||h.top===w){e({scrollTop:w,scrollHeight:b,viewportHeight:y}),x&&t(!0);return}x?(i.current=h.top,l.current&&clearTimeout(l.current),l.current=setTimeout(()=>{l.current=null,i.current=null,t(!0)},1e3)):i.current=null,g.scrollTo(h)}function m(h){s.current.scrollBy(h)}return{scrollerRef:s,scrollByCallback:m,scrollToCallback:p}}const Sr=qt(()=>{const e=Tt(),t=Tt(),n=Ve(0),r=Tt(),o=Ve(0),s=Tt(),i=Tt(),l=Ve(0),u=Ve(0),p=Ve(0),m=Ve(0),h=Tt(),g=Tt(),x=Ve(!1);return st(Pe(e,Xe(({scrollTop:y})=>y)),t),st(Pe(e,Xe(({scrollHeight:y})=>y)),i),st(t,o),{scrollContainerState:e,scrollTop:t,viewportHeight:s,headerHeight:l,fixedHeaderHeight:u,fixedFooterHeight:p,footerHeight:m,scrollHeight:i,smoothScrollTargetReached:r,scrollTo:h,scrollBy:g,statefulScrollTop:o,deviation:n,scrollingInProgress:x}},[],{singleton:!0}),cd={lvl:0};function h8(e,t,n,r=cd,o=cd){return{k:e,v:t,lvl:n,l:r,r:o}}function tn(e){return e===cd}function gc(){return cd}function gx(e,t){if(tn(e))return cd;const{k:n,l:r,r:o}=e;if(t===n){if(tn(r))return o;if(tn(o))return r;{const[s,i]=g8(r);return Up(Vn(e,{k:s,v:i,l:v8(r)}))}}else return tt&&(l=l.concat(vx(s,t,n))),r>=t&&r<=n&&l.push({k:r,v:o}),r<=n&&(l=l.concat(vx(i,t,n))),l}function Ei(e){return tn(e)?[]:[...Ei(e.l),{k:e.k,v:e.v},...Ei(e.r)]}function g8(e){return tn(e.r)?[e.k,e.v]:g8(e.r)}function v8(e){return tn(e.r)?e.l:Up(Vn(e,{r:v8(e.r)}))}function Vn(e,t){return h8(t.k!==void 0?t.k:e.k,t.v!==void 0?t.v:e.v,t.lvl!==void 0?t.lvl:e.lvl,t.l!==void 0?t.l:e.l,t.r!==void 0?t.r:e.r)}function Hv(e){return tn(e)||e.lvl>e.r.lvl}function Ej(e){return xx(b8(e))}function Up(e){const{l:t,r:n,lvl:r}=e;if(n.lvl>=r-1&&t.lvl>=r-1)return e;if(r>n.lvl+1){if(Hv(t))return b8(Vn(e,{lvl:r-1}));if(!tn(t)&&!tn(t.r))return Vn(t.r,{l:Vn(t,{r:t.r.l}),r:Vn(e,{l:t.r.r,lvl:r-1}),lvl:r});throw new Error("Unexpected empty nodes")}else{if(Hv(e))return xx(Vn(e,{lvl:r-1}));if(!tn(n)&&!tn(n.l)){const o=n.l,s=Hv(o)?n.lvl-1:n.lvl;return Vn(o,{l:Vn(e,{r:o.l,lvl:r-1}),r:xx(Vn(n,{l:o.r,lvl:s})),lvl:o.lvl+1})}else throw new Error("Unexpected empty nodes")}}function yg(e,t,n){if(tn(e))return[];const r=ns(e,t)[0];return Jne(vx(e,r,n))}function x8(e,t){const n=e.length;if(n===0)return[];let{index:r,value:o}=t(e[0]);const s=[];for(let i=1;i({index:t,value:n}))}function xx(e){const{r:t,lvl:n}=e;return!tn(t)&&!tn(t.r)&&t.lvl===n&&t.r.lvl===n?Vn(t,{l:Vn(e,{r:t.l}),lvl:n+1}):e}function b8(e){const{l:t}=e;return!tn(t)&&t.lvl===e.lvl?Vn(t,{r:Vn(e,{l:t.r})}):e}function oh(e,t,n,r=0){let o=e.length-1;for(;r<=o;){const s=Math.floor((r+o)/2),i=e[s],l=n(i,t);if(l===0)return s;if(l===-1){if(o-r<2)return s-1;o=s-1}else{if(o===r)return s;r=s+1}}throw new Error(`Failed binary finding record in array - ${e.join(",")}, searched for ${t}`)}function y8(e,t,n){return e[oh(e,t,n)]}function ere(e,t,n,r){const o=oh(e,t,r),s=oh(e,n,r,o);return e.slice(o,s+1)}const Ny=qt(()=>({recalcInProgress:Ve(!1)}),[],{singleton:!0});function tre(e){const{size:t,startIndex:n,endIndex:r}=e;return o=>o.start===n&&(o.end===r||o.end===1/0)&&o.value===t}function Mj(e,t){let n=0,r=0;for(;n=m||o===g)&&(e=gx(e,m)):(p=g!==o,u=!0),h>i&&i>=m&&g!==o&&(e=Yr(e,i+1,g));p&&(e=Yr(e,s,o))}return[e,n]}function rre(){return{offsetTree:[],sizeTree:gc(),groupOffsetTree:gc(),lastIndex:0,lastOffset:0,lastSize:0,groupIndices:[]}}function $y({index:e},t){return t===e?0:t0&&(t=Math.max(t,y8(e,r,$y).offset)),x8(ere(e,t,n,ore),sre)}function bx(e,t,n,r){let o=e,s=0,i=0,l=0,u=0;if(t!==0){u=oh(o,t-1,$y),l=o[u].offset;const m=ns(n,t-1);s=m[0],i=m[1],o.length&&o[u].size===ns(n,t)[1]&&(u-=1),o=o.slice(0,u+1)}else o=[];for(const{start:p,value:m}of yg(n,t,1/0)){const h=p-s,g=h*i+l+h*r;o.push({offset:g,size:m,index:p}),s=p,l=g,i=m}return{offsetTree:o,lastIndex:s,lastOffset:l,lastSize:i}}function ire(e,[t,n,r,o]){t.length>0&&r("received item sizes",t,eo.DEBUG);const s=e.sizeTree;let i=s,l=0;if(n.length>0&&tn(s)&&t.length===2){const g=t[0].size,x=t[1].size;i=n.reduce((y,b)=>Yr(Yr(y,b,g),b+1,x),i)}else[i,l]=nre(i,t);if(i===s)return e;const{offsetTree:u,lastIndex:p,lastSize:m,lastOffset:h}=bx(e.offsetTree,l,i,o);return{sizeTree:i,offsetTree:u,lastIndex:p,lastOffset:h,lastSize:m,groupOffsetTree:n.reduce((g,x)=>Yr(g,x,dd(x,u,o)),gc()),groupIndices:n}}function dd(e,t,n){if(t.length===0)return 0;const{offset:r,index:o,size:s}=y8(t,e,$y),i=e-o,l=s*i+(i-1)*n+r;return l>0?l+n:l}function lre(e){return typeof e.groupIndex<"u"}function C8(e,t,n){if(lre(e))return t.groupIndices[e.groupIndex]+1;{const r=e.index==="LAST"?n:e.index;let o=w8(r,t);return o=Math.max(0,o,Math.min(n,o)),o}}function w8(e,t){if(!Cg(t))return e;let n=0;for(;t.groupIndices[n]<=e+n;)n++;return e+n}function Cg(e){return!tn(e.groupOffsetTree)}function cre(e){return Ei(e).map(({k:t,v:n},r,o)=>{const s=o[r+1],i=s?s.k-1:1/0;return{startIndex:t,endIndex:i,size:n}})}const ure={offsetHeight:"height",offsetWidth:"width"},Ts=qt(([{log:e},{recalcInProgress:t}])=>{const n=Tt(),r=Tt(),o=yr(r,0),s=Tt(),i=Tt(),l=Ve(0),u=Ve([]),p=Ve(void 0),m=Ve(void 0),h=Ve((I,M)=>ri(I,ure[M])),g=Ve(void 0),x=Ve(0),y=rre(),b=yr(Pe(n,_t(u,e,x),bs(ire,y),fn()),y),w=yr(Pe(u,fn(),bs((I,M)=>({prev:I.current,current:M}),{prev:[],current:[]}),Xe(({prev:I})=>I)),[]);st(Pe(u,gt(I=>I.length>0),_t(b,x),Xe(([I,M,R])=>{const D=I.reduce((A,O,T)=>Yr(A,O,dd(O,M.offsetTree,R)||T),gc());return{...M,groupIndices:I,groupOffsetTree:D}})),b),st(Pe(r,_t(b),gt(([I,{lastIndex:M}])=>I[{startIndex:I,endIndex:M,size:R}])),n),st(p,m);const S=yr(Pe(p,Xe(I=>I===void 0)),!0);st(Pe(m,gt(I=>I!==void 0&&tn(bo(b).sizeTree)),Xe(I=>[{startIndex:0,endIndex:0,size:I}])),n);const j=Jr(Pe(n,_t(b),bs(({sizes:I},[M,R])=>({changed:R!==I,sizes:R}),{changed:!1,sizes:y}),Xe(I=>I.changed)));Yt(Pe(l,bs((I,M)=>({diff:I.prev-M,prev:M}),{diff:0,prev:0}),Xe(I=>I.diff)),I=>{const{groupIndices:M}=bo(b);if(I>0)wt(t,!0),wt(s,I+Mj(I,M));else if(I<0){const R=bo(w);R.length>0&&(I-=Mj(-I,R)),wt(i,I)}}),Yt(Pe(l,_t(e)),([I,M])=>{I<0&&M("`firstItemIndex` prop should not be set to less than zero. If you don't know the total count, just use a very high value",{firstItemIndex:l},eo.ERROR)});const _=Jr(s);st(Pe(s,_t(b),Xe(([I,M])=>{const R=M.groupIndices.length>0,D=[],A=M.lastSize;if(R){const O=ud(M.sizeTree,0);let T=0,X=0;for(;T{let q=U.ranges;return U.prevSize!==0&&(q=[...U.ranges,{startIndex:U.prevIndex,endIndex:N+I-1,size:U.prevSize}]),{ranges:q,prevIndex:N+I,prevSize:$}},{ranges:D,prevIndex:I,prevSize:0}).ranges}return Ei(M.sizeTree).reduce((O,{k:T,v:X})=>({ranges:[...O.ranges,{startIndex:O.prevIndex,endIndex:T+I-1,size:O.prevSize}],prevIndex:T+I,prevSize:X}),{ranges:[],prevIndex:0,prevSize:A}).ranges})),n);const E=Jr(Pe(i,_t(b,x),Xe(([I,{offsetTree:M},R])=>{const D=-I;return dd(D,M,R)})));return st(Pe(i,_t(b,x),Xe(([I,M,R])=>{if(M.groupIndices.length>0){if(tn(M.sizeTree))return M;let A=gc();const O=bo(w);let T=0,X=0,B=0;for(;T<-I;){B=O[X];const U=O[X+1]-B-1;X++,T+=U+1}if(A=Ei(M.sizeTree).reduce((U,{k:N,v:$})=>Yr(U,Math.max(0,N+I),$),A),T!==-I){const U=ud(M.sizeTree,B);A=Yr(A,0,U);const N=ns(M.sizeTree,-I+1)[1];A=Yr(A,1,N)}return{...M,sizeTree:A,...bx(M.offsetTree,0,A,R)}}else{const A=Ei(M.sizeTree).reduce((O,{k:T,v:X})=>Yr(O,Math.max(0,T+I),X),gc());return{...M,sizeTree:A,...bx(M.offsetTree,0,A,R)}}})),b),{data:g,totalCount:r,sizeRanges:n,groupIndices:u,defaultItemSize:m,fixedItemSize:p,unshiftWith:s,shiftWith:i,shiftWithOffset:E,beforeUnshiftWith:_,firstItemIndex:l,gap:x,sizes:b,listRefresh:j,statefulTotalCount:o,trackItemSizes:S,itemSize:h}},hn(di,Ny),{singleton:!0}),dre=typeof document<"u"&&"scrollBehavior"in document.documentElement.style;function S8(e){const t=typeof e=="number"?{index:e}:e;return t.align||(t.align="start"),(!t.behavior||!dre)&&(t.behavior="auto"),t.offset||(t.offset=0),t}const Xd=qt(([{sizes:e,totalCount:t,listRefresh:n,gap:r},{scrollingInProgress:o,viewportHeight:s,scrollTo:i,smoothScrollTargetReached:l,headerHeight:u,footerHeight:p,fixedHeaderHeight:m,fixedFooterHeight:h},{log:g}])=>{const x=Tt(),y=Ve(0);let b=null,w=null,S=null;function j(){b&&(b(),b=null),S&&(S(),S=null),w&&(clearTimeout(w),w=null),wt(o,!1)}return st(Pe(x,_t(e,s,t,y,u,p,g),_t(r,m,h),Xe(([[_,E,I,M,R,D,A,O],T,X,B])=>{const V=S8(_),{align:U,behavior:N,offset:$}=V,q=M-1,F=C8(V,E,q);let Q=dd(F,E.offsetTree,T)+D;U==="end"?(Q+=X+ns(E.sizeTree,F)[1]-I+B,F===q&&(Q+=A)):U==="center"?Q+=(X+ns(E.sizeTree,F)[1]-I+B)/2:Q-=R,$&&(Q+=$);const Y=se=>{j(),se?(O("retrying to scroll to",{location:_},eo.DEBUG),wt(x,_)):O("list did not change, scroll successful",{},eo.DEBUG)};if(j(),N==="smooth"){let se=!1;S=Yt(n,ae=>{se=se||ae}),b=ca(l,()=>{Y(se)})}else b=ca(Pe(n,fre(150)),Y);return w=setTimeout(()=>{j()},1200),wt(o,!0),O("scrolling from index to",{index:F,top:Q,behavior:N},eo.DEBUG),{top:Q,behavior:N}})),i),{scrollToIndex:x,topListHeight:y}},hn(Ts,Sr,di),{singleton:!0});function fre(e){return t=>{const n=setTimeout(()=>{t(!1)},e);return r=>{r&&(t(!0),clearTimeout(n))}}}const fd="up",Hu="down",pre="none",mre={atBottom:!1,notAtBottomBecause:"NOT_SHOWING_LAST_ITEM",state:{offsetBottom:0,scrollTop:0,viewportHeight:0,scrollHeight:0}},hre=0,Qd=qt(([{scrollContainerState:e,scrollTop:t,viewportHeight:n,headerHeight:r,footerHeight:o,scrollBy:s}])=>{const i=Ve(!1),l=Ve(!0),u=Tt(),p=Tt(),m=Ve(4),h=Ve(hre),g=yr(Pe(Pj(Pe(ht(t),Pc(1),qs(!0)),Pe(ht(t),Pc(1),qs(!1),Ij(100))),fn()),!1),x=yr(Pe(Pj(Pe(s,qs(!0)),Pe(s,qs(!1),Ij(200))),fn()),!1);st(Pe(Qn(ht(t),ht(h)),Xe(([j,_])=>j<=_),fn()),l),st(Pe(l,Ga(50)),p);const y=Jr(Pe(Qn(e,ht(n),ht(r),ht(o),ht(m)),bs((j,[{scrollTop:_,scrollHeight:E},I,M,R,D])=>{const A=_+I-E>-D,O={viewportHeight:I,scrollTop:_,scrollHeight:E};if(A){let X,B;return _>j.state.scrollTop?(X="SCROLLED_DOWN",B=j.state.scrollTop-_):(X="SIZE_DECREASED",B=j.state.scrollTop-_||j.scrollTopDelta),{atBottom:!0,state:O,atBottomBecause:X,scrollTopDelta:B}}let T;return O.scrollHeight>j.state.scrollHeight?T="SIZE_INCREASED":Ij&&j.atBottom===_.atBottom))),b=yr(Pe(e,bs((j,{scrollTop:_,scrollHeight:E,viewportHeight:I})=>{if(p8(j.scrollHeight,E))return{scrollTop:_,scrollHeight:E,jump:0,changed:!1};{const M=E-(_+I)<1;return j.scrollTop!==_&&M?{scrollHeight:E,scrollTop:_,jump:j.scrollTop-_,changed:!0}:{scrollHeight:E,scrollTop:_,jump:0,changed:!0}}},{scrollHeight:0,jump:0,scrollTop:0,changed:!1}),gt(j=>j.changed),Xe(j=>j.jump)),0);st(Pe(y,Xe(j=>j.atBottom)),i),st(Pe(i,Ga(50)),u);const w=Ve(Hu);st(Pe(e,Xe(({scrollTop:j})=>j),fn(),bs((j,_)=>bo(x)?{direction:j.direction,prevScrollTop:_}:{direction:_j.direction)),w),st(Pe(e,Ga(50),qs(pre)),w);const S=Ve(0);return st(Pe(g,gt(j=>!j),qs(0)),S),st(Pe(t,Ga(100),_t(g),gt(([j,_])=>!!_),bs(([j,_],[E])=>[_,E],[0,0]),Xe(([j,_])=>_-j)),S),{isScrolling:g,isAtTop:l,isAtBottom:i,atBottomState:y,atTopStateChange:p,atBottomStateChange:u,scrollDirection:w,atBottomThreshold:m,atTopThreshold:h,scrollVelocity:S,lastJumpDueToItemResize:b}},hn(Sr)),fi=qt(([{log:e}])=>{const t=Ve(!1),n=Jr(Pe(t,gt(r=>r),fn()));return Yt(t,r=>{r&&bo(e)("props updated",{},eo.DEBUG)}),{propsReady:t,didMount:n}},hn(di),{singleton:!0});function Ly(e,t){e==0?t():requestAnimationFrame(()=>Ly(e-1,t))}function zy(e,t){const n=t-1;return typeof e=="number"?e:e.index==="LAST"?n:e.index}const Yd=qt(([{sizes:e,listRefresh:t,defaultItemSize:n},{scrollTop:r},{scrollToIndex:o},{didMount:s}])=>{const i=Ve(!0),l=Ve(0),u=Ve(!1);return st(Pe(s,_t(l),gt(([p,m])=>!!m),qs(!1)),i),Yt(Pe(Qn(t,s),_t(i,e,n,u),gt(([[,p],m,{sizeTree:h},g,x])=>p&&(!tn(h)||Dy(g))&&!m&&!x),_t(l)),([,p])=>{wt(u,!0),Ly(3,()=>{ca(r,()=>wt(i,!0)),wt(o,p)})}),{scrolledToInitialItem:i,initialTopMostItemIndex:l}},hn(Ts,Sr,Xd,fi),{singleton:!0});function Oj(e){return e?e==="smooth"?"smooth":"auto":!1}const gre=(e,t)=>typeof e=="function"?Oj(e(t)):t&&Oj(e),vre=qt(([{totalCount:e,listRefresh:t},{isAtBottom:n,atBottomState:r},{scrollToIndex:o},{scrolledToInitialItem:s},{propsReady:i,didMount:l},{log:u},{scrollingInProgress:p}])=>{const m=Ve(!1),h=Tt();let g=null;function x(b){wt(o,{index:"LAST",align:"end",behavior:b})}Yt(Pe(Qn(Pe(ht(e),Pc(1)),l),_t(ht(m),n,s,p),Xe(([[b,w],S,j,_,E])=>{let I=w&&_,M="auto";return I&&(M=gre(S,j||E),I=I&&!!M),{totalCount:b,shouldFollow:I,followOutputBehavior:M}}),gt(({shouldFollow:b})=>b)),({totalCount:b,followOutputBehavior:w})=>{g&&(g(),g=null),g=ca(t,()=>{bo(u)("following output to ",{totalCount:b},eo.DEBUG),x(w),g=null})});function y(b){const w=ca(r,S=>{b&&!S.atBottom&&S.notAtBottomBecause==="SIZE_INCREASED"&&!g&&(bo(u)("scrolling to bottom due to increased size",{},eo.DEBUG),x("auto"))});setTimeout(w,100)}return Yt(Pe(Qn(ht(m),e,i),gt(([b,,w])=>b&&w),bs(({value:b},[,w])=>({refreshed:b===w,value:w}),{refreshed:!1,value:0}),gt(({refreshed:b})=>b),_t(m,e)),([,b])=>{y(b!==!1)}),Yt(h,()=>{y(bo(m)!==!1)}),Yt(Qn(ht(m),r),([b,w])=>{b&&!w.atBottom&&w.notAtBottomBecause==="VIEWPORT_HEIGHT_DECREASING"&&x("auto")}),{followOutput:m,autoscrollToBottom:h}},hn(Ts,Qd,Xd,Yd,fi,di,Sr));function xre(e){return e.reduce((t,n)=>(t.groupIndices.push(t.totalCount),t.totalCount+=n+1,t),{totalCount:0,groupIndices:[]})}const k8=qt(([{totalCount:e,groupIndices:t,sizes:n},{scrollTop:r,headerHeight:o}])=>{const s=Tt(),i=Tt(),l=Jr(Pe(s,Xe(xre)));return st(Pe(l,Xe(u=>u.totalCount)),e),st(Pe(l,Xe(u=>u.groupIndices)),t),st(Pe(Qn(r,n,o),gt(([u,p])=>Cg(p)),Xe(([u,p,m])=>ns(p.groupOffsetTree,Math.max(u-m,0),"v")[0]),fn(),Xe(u=>[u])),i),{groupCounts:s,topItemsIndexes:i}},hn(Ts,Sr));function pd(e,t){return!!(e&&e[0]===t[0]&&e[1]===t[1])}function j8(e,t){return!!(e&&e.startIndex===t.startIndex&&e.endIndex===t.endIndex)}const sh="top",ah="bottom",Rj="none";function Dj(e,t,n){return typeof e=="number"?n===fd&&t===sh||n===Hu&&t===ah?e:0:n===fd?t===sh?e.main:e.reverse:t===ah?e.main:e.reverse}function Aj(e,t){return typeof e=="number"?e:e[t]||0}const Fy=qt(([{scrollTop:e,viewportHeight:t,deviation:n,headerHeight:r,fixedHeaderHeight:o}])=>{const s=Tt(),i=Ve(0),l=Ve(0),u=Ve(0),p=yr(Pe(Qn(ht(e),ht(t),ht(r),ht(s,pd),ht(u),ht(i),ht(o),ht(n),ht(l)),Xe(([m,h,g,[x,y],b,w,S,j,_])=>{const E=m-j,I=w+S,M=Math.max(g-E,0);let R=Rj;const D=Aj(_,sh),A=Aj(_,ah);return x-=j,x+=g+S,y+=g+S,y-=j,x>m+I-D&&(R=fd),ym!=null),fn(pd)),[0,0]);return{listBoundary:s,overscan:u,topListHeight:i,increaseViewportBy:l,visibleRange:p}},hn(Sr),{singleton:!0});function bre(e,t,n){if(Cg(t)){const r=w8(e,t);return[{index:ns(t.groupOffsetTree,r)[0],size:0,offset:0},{index:r,size:0,offset:0,data:n&&n[0]}]}return[{index:e,size:0,offset:0,data:n&&n[0]}]}const Tj={items:[],topItems:[],offsetTop:0,offsetBottom:0,top:0,bottom:0,topListHeight:0,totalCount:0,firstItemIndex:0};function Nj(e,t,n){if(e.length===0)return[];if(!Cg(t))return e.map(p=>({...p,index:p.index+n,originalIndex:p.index}));const r=e[0].index,o=e[e.length-1].index,s=[],i=yg(t.groupOffsetTree,r,o);let l,u=0;for(const p of e){(!l||l.end0){p=e[0].offset;const b=e[e.length-1];m=b.offset+b.size}const h=n-u,g=l+h*i+(h-1)*r,x=p,y=g-m;return{items:Nj(e,o,s),topItems:Nj(t,o,s),topListHeight:t.reduce((b,w)=>w.size+b,0),offsetTop:p,offsetBottom:y,top:x,bottom:m,totalCount:n,firstItemIndex:s}}const cl=qt(([{sizes:e,totalCount:t,data:n,firstItemIndex:r,gap:o},s,{visibleRange:i,listBoundary:l,topListHeight:u},{scrolledToInitialItem:p,initialTopMostItemIndex:m},{topListHeight:h},g,{didMount:x},{recalcInProgress:y}])=>{const b=Ve([]),w=Tt();st(s.topItemsIndexes,b);const S=yr(Pe(Qn(x,y,ht(i,pd),ht(t),ht(e),ht(m),p,ht(b),ht(r),ht(o),n),gt(([I,M,,R,,,,,,,D])=>{const A=D&&D.length!==R;return I&&!M&&!A}),Xe(([,,[I,M],R,D,A,O,T,X,B,V])=>{const U=D,{sizeTree:N,offsetTree:$}=U;if(R===0||I===0&&M===0)return{...Tj,totalCount:R};if(tn(N))return Gp(bre(zy(A,R),U,V),[],R,B,U,X);const q=[];if(T.length>0){const ae=T[0],re=T[T.length-1];let G=0;for(const K of yg(N,ae,re)){const ee=K.value,ce=Math.max(K.start,ae),J=Math.min(K.end,re);for(let ie=ce;ie<=J;ie++)q.push({index:ie,size:ee,offset:G,data:V&&V[ie]}),G+=ee}}if(!O)return Gp([],q,R,B,U,X);const F=T.length>0?T[T.length-1]+1:0,Q=are($,I,M,F);if(Q.length===0)return null;const Y=R-1,se=bg([],ae=>{for(const re of Q){const G=re.value;let K=G.offset,ee=re.start;const ce=G.size;if(G.offset=M);ie++)ae.push({index:ie,size:ce,offset:K,data:V&&V[ie]}),K+=ce+B}});return Gp(se,q,R,B,U,X)}),gt(I=>I!==null),fn()),Tj);st(Pe(n,gt(Dy),Xe(I=>I==null?void 0:I.length)),t),st(Pe(S,Xe(I=>I.topListHeight)),h),st(h,u),st(Pe(S,Xe(I=>[I.top,I.bottom])),l),st(Pe(S,Xe(I=>I.items)),w);const j=Jr(Pe(S,gt(({items:I})=>I.length>0),_t(t,n),gt(([{items:I},M])=>I[I.length-1].originalIndex===M-1),Xe(([,I,M])=>[I-1,M]),fn(pd),Xe(([I])=>I))),_=Jr(Pe(S,Ga(200),gt(({items:I,topItems:M})=>I.length>0&&I[0].originalIndex===M.length),Xe(({items:I})=>I[0].index),fn())),E=Jr(Pe(S,gt(({items:I})=>I.length>0),Xe(({items:I})=>{let M=0,R=I.length-1;for(;I[M].type==="group"&&MM;)R--;return{startIndex:I[M].index,endIndex:I[R].index}}),fn(j8)));return{listState:S,topItemsIndexes:b,endReached:j,startReached:_,rangeChanged:E,itemsRendered:w,...g}},hn(Ts,k8,Fy,Yd,Xd,Qd,fi,Ny),{singleton:!0}),yre=qt(([{sizes:e,firstItemIndex:t,data:n,gap:r},{initialTopMostItemIndex:o},{listState:s},{didMount:i}])=>{const l=Ve(0);return st(Pe(i,_t(l),gt(([,u])=>u!==0),_t(o,e,t,r,n),Xe(([[,u],p,m,h,g,x=[]])=>{let y=0;if(m.groupIndices.length>0)for(const j of m.groupIndices){if(j-y>=u)break;y++}const b=u+y,w=zy(p,b),S=Array.from({length:b}).map((j,_)=>({index:_+w,size:0,offset:0,data:x[_+w]}));return Gp(S,[],b,g,m,h)})),s),{initialItemCount:l}},hn(Ts,Yd,cl,fi),{singleton:!0}),_8=qt(([{scrollVelocity:e}])=>{const t=Ve(!1),n=Tt(),r=Ve(!1);return st(Pe(e,_t(r,t,n),gt(([o,s])=>!!s),Xe(([o,s,i,l])=>{const{exit:u,enter:p}=s;if(i){if(u(o,l))return!1}else if(p(o,l))return!0;return i}),fn()),t),Yt(Pe(Qn(t,e,n),_t(r)),([[o,s,i],l])=>o&&l&&l.change&&l.change(s,i)),{isSeeking:t,scrollSeekConfiguration:r,scrollVelocity:e,scrollSeekRangeChanged:n}},hn(Qd),{singleton:!0}),Cre=qt(([{topItemsIndexes:e}])=>{const t=Ve(0);return st(Pe(t,gt(n=>n>0),Xe(n=>Array.from({length:n}).map((r,o)=>o))),e),{topItemCount:t}},hn(cl)),I8=qt(([{footerHeight:e,headerHeight:t,fixedHeaderHeight:n,fixedFooterHeight:r},{listState:o}])=>{const s=Tt(),i=yr(Pe(Qn(e,r,t,n,o),Xe(([l,u,p,m,h])=>l+u+p+m+h.offsetBottom+h.bottom)),0);return st(ht(i),s),{totalListHeight:i,totalListHeightChanged:s}},hn(Sr,cl),{singleton:!0});function P8(e){let t=!1,n;return()=>(t||(t=!0,n=e()),n)}const wre=P8(()=>/iP(ad|od|hone)/i.test(navigator.userAgent)&&/WebKit/i.test(navigator.userAgent)),Sre=qt(([{scrollBy:e,scrollTop:t,deviation:n,scrollingInProgress:r},{isScrolling:o,isAtBottom:s,scrollDirection:i,lastJumpDueToItemResize:l},{listState:u},{beforeUnshiftWith:p,shiftWithOffset:m,sizes:h,gap:g},{log:x},{recalcInProgress:y}])=>{const b=Jr(Pe(u,_t(l),bs(([,S,j,_],[{items:E,totalCount:I,bottom:M,offsetBottom:R},D])=>{const A=M+R;let O=0;return j===I&&S.length>0&&E.length>0&&(E[0].originalIndex===0&&S[0].originalIndex===0||(O=A-_,O!==0&&(O+=D))),[O,E,I,A]},[0,[],0,0]),gt(([S])=>S!==0),_t(t,i,r,s,x,y),gt(([,S,j,_,,,E])=>!E&&!_&&S!==0&&j===fd),Xe(([[S],,,,,j])=>(j("Upward scrolling compensation",{amount:S},eo.DEBUG),S))));function w(S){S>0?(wt(e,{top:-S,behavior:"auto"}),wt(n,0)):(wt(n,0),wt(e,{top:-S,behavior:"auto"}))}return Yt(Pe(b,_t(n,o)),([S,j,_])=>{_&&wre()?wt(n,j-S):w(-S)}),Yt(Pe(Qn(yr(o,!1),n,y),gt(([S,j,_])=>!S&&!_&&j!==0),Xe(([S,j])=>j),Ga(1)),w),st(Pe(m,Xe(S=>({top:-S}))),e),Yt(Pe(p,_t(h,g),Xe(([S,{lastSize:j,groupIndices:_,sizeTree:E},I])=>{function M(R){return R*(j+I)}if(_.length===0)return M(S);{let R=0;const D=ud(E,0);let A=0,O=0;for(;AS&&(R-=D,T=S-A+1),A+=T,R+=M(T),O++}return R}})),S=>{wt(n,S),requestAnimationFrame(()=>{wt(e,{top:S}),requestAnimationFrame(()=>{wt(n,0),wt(y,!1)})})}),{deviation:n}},hn(Sr,Qd,cl,Ts,di,Ny)),kre=qt(([{didMount:e},{scrollTo:t},{listState:n}])=>{const r=Ve(0);return Yt(Pe(e,_t(r),gt(([,o])=>o!==0),Xe(([,o])=>({top:o}))),o=>{ca(Pe(n,Pc(1),gt(s=>s.items.length>1)),()=>{requestAnimationFrame(()=>{wt(t,o)})})}),{initialScrollTop:r}},hn(fi,Sr,cl),{singleton:!0}),jre=qt(([{viewportHeight:e},{totalListHeight:t}])=>{const n=Ve(!1),r=yr(Pe(Qn(n,e,t),gt(([o])=>o),Xe(([,o,s])=>Math.max(0,o-s)),Ga(0),fn()),0);return{alignToBottom:n,paddingTopAddition:r}},hn(Sr,I8),{singleton:!0}),By=qt(([{scrollTo:e,scrollContainerState:t}])=>{const n=Tt(),r=Tt(),o=Tt(),s=Ve(!1),i=Ve(void 0);return st(Pe(Qn(n,r),Xe(([{viewportHeight:l,scrollTop:u,scrollHeight:p},{offsetTop:m}])=>({scrollTop:Math.max(0,u-m),scrollHeight:p,viewportHeight:l}))),t),st(Pe(e,_t(r),Xe(([l,{offsetTop:u}])=>({...l,top:l.top+u}))),o),{useWindowScroll:s,customScrollParent:i,windowScrollContainerState:n,windowViewportRect:r,windowScrollTo:o}},hn(Sr)),_re=({itemTop:e,itemBottom:t,viewportTop:n,viewportBottom:r,locationParams:{behavior:o,align:s,...i}})=>er?{...i,behavior:o,align:s??"end"}:null,Ire=qt(([{sizes:e,totalCount:t,gap:n},{scrollTop:r,viewportHeight:o,headerHeight:s,fixedHeaderHeight:i,fixedFooterHeight:l,scrollingInProgress:u},{scrollToIndex:p}])=>{const m=Tt();return st(Pe(m,_t(e,o,t,s,i,l,r),_t(n),Xe(([[h,g,x,y,b,w,S,j],_])=>{const{done:E,behavior:I,align:M,calculateViewLocation:R=_re,...D}=h,A=C8(h,g,y-1),O=dd(A,g.offsetTree,_)+b+w,T=O+ns(g.sizeTree,A)[1],X=j+w,B=j+x-S,V=R({itemTop:O,itemBottom:T,viewportTop:X,viewportBottom:B,locationParams:{behavior:I,align:M,...D}});return V?E&&ca(Pe(u,gt(U=>U===!1),Pc(bo(u)?1:2)),E):E&&E(),V}),gt(h=>h!==null)),p),{scrollIntoView:m}},hn(Ts,Sr,Xd,cl,di),{singleton:!0}),Pre=qt(([{sizes:e,sizeRanges:t},{scrollTop:n},{initialTopMostItemIndex:r},{didMount:o},{useWindowScroll:s,windowScrollContainerState:i,windowViewportRect:l}])=>{const u=Tt(),p=Ve(void 0),m=Ve(null),h=Ve(null);return st(i,m),st(l,h),Yt(Pe(u,_t(e,n,s,m,h)),([g,x,y,b,w,S])=>{const j=cre(x.sizeTree);b&&w!==null&&S!==null&&(y=w.scrollTop-S.offsetTop),g({ranges:j,scrollTop:y})}),st(Pe(p,gt(Dy),Xe(Ere)),r),st(Pe(o,_t(p),gt(([,g])=>g!==void 0),fn(),Xe(([,g])=>g.ranges)),t),{getState:u,restoreStateFrom:p}},hn(Ts,Sr,Yd,fi,By));function Ere(e){return{offset:e.scrollTop,index:0,align:"start"}}const Mre=qt(([e,t,n,r,o,s,i,l,u,p])=>({...e,...t,...n,...r,...o,...s,...i,...l,...u,...p}),hn(Fy,yre,fi,_8,I8,kre,jre,By,Ire,di)),Ore=qt(([{totalCount:e,sizeRanges:t,fixedItemSize:n,defaultItemSize:r,trackItemSizes:o,itemSize:s,data:i,firstItemIndex:l,groupIndices:u,statefulTotalCount:p,gap:m,sizes:h},{initialTopMostItemIndex:g,scrolledToInitialItem:x},y,b,w,{listState:S,topItemsIndexes:j,..._},{scrollToIndex:E},I,{topItemCount:M},{groupCounts:R},D])=>(st(_.rangeChanged,D.scrollSeekRangeChanged),st(Pe(D.windowViewportRect,Xe(A=>A.visibleHeight)),y.viewportHeight),{totalCount:e,data:i,firstItemIndex:l,sizeRanges:t,initialTopMostItemIndex:g,scrolledToInitialItem:x,topItemsIndexes:j,topItemCount:M,groupCounts:R,fixedItemHeight:n,defaultItemHeight:r,gap:m,...w,statefulTotalCount:p,listState:S,scrollToIndex:E,trackItemSizes:o,itemSize:s,groupIndices:u,..._,...D,...y,sizes:h,...b}),hn(Ts,Yd,Sr,Pre,vre,cl,Xd,Sre,Cre,k8,Mre)),Vv="-webkit-sticky",$j="sticky",E8=P8(()=>{if(typeof document>"u")return $j;const e=document.createElement("div");return e.style.position=Vv,e.style.position===Vv?Vv:$j});function M8(e,t){const n=H.useRef(null),r=H.useCallback(l=>{if(l===null||!l.offsetParent)return;const u=l.getBoundingClientRect(),p=u.width;let m,h;if(t){const g=t.getBoundingClientRect(),x=u.top-g.top;m=g.height-Math.max(0,x),h=x+t.scrollTop}else m=window.innerHeight-Math.max(0,u.top),h=u.top+window.pageYOffset;n.current={offsetTop:h,visibleHeight:m,visibleWidth:p},e(n.current)},[e,t]),{callbackRef:o,ref:s}=Ty(r),i=H.useCallback(()=>{r(s.current)},[r,s]);return H.useEffect(()=>{if(t){t.addEventListener("scroll",i);const l=new ResizeObserver(i);return l.observe(t),()=>{t.removeEventListener("scroll",i),l.unobserve(t)}}else return window.addEventListener("scroll",i),window.addEventListener("resize",i),()=>{window.removeEventListener("scroll",i),window.removeEventListener("resize",i)}},[i,t]),o}const O8=H.createContext(void 0),R8=H.createContext(void 0);function D8(e){return e}const Rre=qt(()=>{const e=Ve(u=>`Item ${u}`),t=Ve(null),n=Ve(u=>`Group ${u}`),r=Ve({}),o=Ve(D8),s=Ve("div"),i=Ve(Uc),l=(u,p=null)=>yr(Pe(r,Xe(m=>m[u]),fn()),p);return{context:t,itemContent:e,groupContent:n,components:r,computeItemKey:o,headerFooterTag:s,scrollerRef:i,FooterComponent:l("Footer"),HeaderComponent:l("Header"),TopItemListComponent:l("TopItemList"),ListComponent:l("List","div"),ItemComponent:l("Item","div"),GroupComponent:l("Group","div"),ScrollerComponent:l("Scroller","div"),EmptyPlaceholder:l("EmptyPlaceholder"),ScrollSeekPlaceholder:l("ScrollSeekPlaceholder")}}),Dre=qt(([e,t])=>({...e,...t}),hn(Ore,Rre)),Are=({height:e})=>H.createElement("div",{style:{height:e}}),Tre={position:E8(),zIndex:1,overflowAnchor:"none"},Nre={overflowAnchor:"none"},Lj=H.memo(function({showTopList:t=!1}){const n=Rt("listState"),r=yo("sizeRanges"),o=Rt("useWindowScroll"),s=Rt("customScrollParent"),i=yo("windowScrollContainerState"),l=yo("scrollContainerState"),u=s||o?i:l,p=Rt("itemContent"),m=Rt("context"),h=Rt("groupContent"),g=Rt("trackItemSizes"),x=Rt("itemSize"),y=Rt("log"),b=yo("gap"),{callbackRef:w}=Qne(r,x,g,t?Uc:u,y,b,s),[S,j]=H.useState(0);Hy("deviation",V=>{S!==V&&j(V)});const _=Rt("EmptyPlaceholder"),E=Rt("ScrollSeekPlaceholder")||Are,I=Rt("ListComponent"),M=Rt("ItemComponent"),R=Rt("GroupComponent"),D=Rt("computeItemKey"),A=Rt("isSeeking"),O=Rt("groupIndices").length>0,T=Rt("paddingTopAddition"),X=Rt("scrolledToInitialItem"),B=t?{}:{boxSizing:"border-box",paddingTop:n.offsetTop+T,paddingBottom:n.offsetBottom,marginTop:S,...X?{}:{visibility:"hidden"}};return!t&&n.totalCount===0&&_?H.createElement(_,Rr(_,m)):H.createElement(I,{...Rr(I,m),ref:w,style:B,"data-test-id":t?"virtuoso-top-item-list":"virtuoso-item-list"},(t?n.topItems:n.items).map(V=>{const U=V.originalIndex,N=D(U+n.firstItemIndex,V.data,m);return A?H.createElement(E,{...Rr(E,m),key:N,index:V.index,height:V.size,type:V.type||"item",...V.type==="group"?{}:{groupIndex:V.groupIndex}}):V.type==="group"?H.createElement(R,{...Rr(R,m),key:N,"data-index":U,"data-known-size":V.size,"data-item-index":V.index,style:Tre},h(V.index,m)):H.createElement(M,{...Rr(M,m),key:N,"data-index":U,"data-known-size":V.size,"data-item-index":V.index,"data-item-group-index":V.groupIndex,item:V.data,style:Nre},O?p(V.index,V.groupIndex,V.data,m):p(V.index,V.data,m))}))}),$re={height:"100%",outline:"none",overflowY:"auto",position:"relative",WebkitOverflowScrolling:"touch"},wg={width:"100%",height:"100%",position:"absolute",top:0},Lre={width:"100%",position:E8(),top:0,zIndex:1};function Rr(e,t){if(typeof e!="string")return{context:t}}const zre=H.memo(function(){const t=Rt("HeaderComponent"),n=yo("headerHeight"),r=Rt("headerFooterTag"),o=ll(i=>n(ri(i,"height"))),s=Rt("context");return t?H.createElement(r,{ref:o},H.createElement(t,Rr(t,s))):null}),Fre=H.memo(function(){const t=Rt("FooterComponent"),n=yo("footerHeight"),r=Rt("headerFooterTag"),o=ll(i=>n(ri(i,"height"))),s=Rt("context");return t?H.createElement(r,{ref:o},H.createElement(t,Rr(t,s))):null});function A8({usePublisher:e,useEmitter:t,useEmitterValue:n}){return H.memo(function({style:s,children:i,...l}){const u=e("scrollContainerState"),p=n("ScrollerComponent"),m=e("smoothScrollTargetReached"),h=n("scrollerRef"),g=n("context"),{scrollerRef:x,scrollByCallback:y,scrollToCallback:b}=m8(u,m,p,h);return t("scrollTo",b),t("scrollBy",y),H.createElement(p,{ref:x,style:{...$re,...s},"data-test-id":"virtuoso-scroller","data-virtuoso-scroller":!0,tabIndex:0,...l,...Rr(p,g)},i)})}function T8({usePublisher:e,useEmitter:t,useEmitterValue:n}){return H.memo(function({style:s,children:i,...l}){const u=e("windowScrollContainerState"),p=n("ScrollerComponent"),m=e("smoothScrollTargetReached"),h=n("totalListHeight"),g=n("deviation"),x=n("customScrollParent"),y=n("context"),{scrollerRef:b,scrollByCallback:w,scrollToCallback:S}=m8(u,m,p,Uc,x);return Kne(()=>(b.current=x||window,()=>{b.current=null}),[b,x]),t("windowScrollTo",S),t("scrollBy",w),H.createElement(p,{style:{position:"relative",...s,...h!==0?{height:h+g}:{}},"data-virtuoso-scroller":!0,...l,...Rr(p,y)},i)})}const Bre=({children:e})=>{const t=H.useContext(O8),n=yo("viewportHeight"),r=yo("fixedItemHeight"),o=ll(c8(n,s=>ri(s,"height")));return H.useEffect(()=>{t&&(n(t.viewportHeight),r(t.itemHeight))},[t,n,r]),H.createElement("div",{style:wg,ref:o,"data-viewport-type":"element"},e)},Hre=({children:e})=>{const t=H.useContext(O8),n=yo("windowViewportRect"),r=yo("fixedItemHeight"),o=Rt("customScrollParent"),s=M8(n,o);return H.useEffect(()=>{t&&(r(t.itemHeight),n({offsetTop:0,visibleHeight:t.viewportHeight,visibleWidth:100}))},[t,n,r]),H.createElement("div",{ref:s,style:wg,"data-viewport-type":"window"},e)},Vre=({children:e})=>{const t=Rt("TopItemListComponent"),n=Rt("headerHeight"),r={...Lre,marginTop:`${n}px`},o=Rt("context");return H.createElement(t||"div",{style:r,context:o},e)},Wre=H.memo(function(t){const n=Rt("useWindowScroll"),r=Rt("topItemsIndexes").length>0,o=Rt("customScrollParent"),s=o||n?Kre:Gre,i=o||n?Hre:Bre;return H.createElement(s,{...t},r&&H.createElement(Vre,null,H.createElement(Lj,{showTopList:!0})),H.createElement(i,null,H.createElement(zre,null),H.createElement(Lj,null),H.createElement(Fre,null)))}),{Component:Ure,usePublisher:yo,useEmitterValue:Rt,useEmitter:Hy}=f8(Dre,{required:{},optional:{restoreStateFrom:"restoreStateFrom",context:"context",followOutput:"followOutput",itemContent:"itemContent",groupContent:"groupContent",overscan:"overscan",increaseViewportBy:"increaseViewportBy",totalCount:"totalCount",groupCounts:"groupCounts",topItemCount:"topItemCount",firstItemIndex:"firstItemIndex",initialTopMostItemIndex:"initialTopMostItemIndex",components:"components",atBottomThreshold:"atBottomThreshold",atTopThreshold:"atTopThreshold",computeItemKey:"computeItemKey",defaultItemHeight:"defaultItemHeight",fixedItemHeight:"fixedItemHeight",itemSize:"itemSize",scrollSeekConfiguration:"scrollSeekConfiguration",headerFooterTag:"headerFooterTag",data:"data",initialItemCount:"initialItemCount",initialScrollTop:"initialScrollTop",alignToBottom:"alignToBottom",useWindowScroll:"useWindowScroll",customScrollParent:"customScrollParent",scrollerRef:"scrollerRef",logLevel:"logLevel"},methods:{scrollToIndex:"scrollToIndex",scrollIntoView:"scrollIntoView",scrollTo:"scrollTo",scrollBy:"scrollBy",autoscrollToBottom:"autoscrollToBottom",getState:"getState"},events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange",totalListHeightChanged:"totalListHeightChanged",itemsRendered:"itemsRendered",groupIndices:"groupIndices"}},Wre),Gre=A8({usePublisher:yo,useEmitterValue:Rt,useEmitter:Hy}),Kre=T8({usePublisher:yo,useEmitterValue:Rt,useEmitter:Hy}),qre=Ure,zj={items:[],offsetBottom:0,offsetTop:0,top:0,bottom:0,itemHeight:0,itemWidth:0},Xre={items:[{index:0}],offsetBottom:0,offsetTop:0,top:0,bottom:0,itemHeight:0,itemWidth:0},{round:Fj,ceil:Bj,floor:ih,min:Wv,max:Vu}=Math;function Qre(e){return{...Xre,items:e}}function Hj(e,t,n){return Array.from({length:t-e+1}).map((r,o)=>{const s=n===null?null:n[o+e];return{index:o+e,data:s}})}function Yre(e,t){return e&&e.column===t.column&&e.row===t.row}function Ep(e,t){return e&&e.width===t.width&&e.height===t.height}const Zre=qt(([{overscan:e,visibleRange:t,listBoundary:n},{scrollTop:r,viewportHeight:o,scrollBy:s,scrollTo:i,smoothScrollTargetReached:l,scrollContainerState:u,footerHeight:p,headerHeight:m},h,g,{propsReady:x,didMount:y},{windowViewportRect:b,useWindowScroll:w,customScrollParent:S,windowScrollContainerState:j,windowScrollTo:_},E])=>{const I=Ve(0),M=Ve(0),R=Ve(zj),D=Ve({height:0,width:0}),A=Ve({height:0,width:0}),O=Tt(),T=Tt(),X=Ve(0),B=Ve(null),V=Ve({row:0,column:0}),U=Tt(),N=Tt(),$=Ve(!1),q=Ve(0),F=Ve(!0),Q=Ve(!1);Yt(Pe(y,_t(q),gt(([K,ee])=>!!ee)),()=>{wt(F,!1),wt(M,0)}),Yt(Pe(Qn(y,F,A,D,q,Q),gt(([K,ee,ce,J,,ie])=>K&&!ee&&ce.height!==0&&J.height!==0&&!ie)),([,,,,K])=>{wt(Q,!0),Ly(1,()=>{wt(O,K)}),ca(Pe(r),()=>{wt(n,[0,0]),wt(F,!0)})}),st(Pe(N,gt(K=>K!=null&&K.scrollTop>0),qs(0)),M),Yt(Pe(y,_t(N),gt(([,K])=>K!=null)),([,K])=>{K&&(wt(D,K.viewport),wt(A,K==null?void 0:K.item),wt(V,K.gap),K.scrollTop>0&&(wt($,!0),ca(Pe(r,Pc(1)),ee=>{wt($,!1)}),wt(i,{top:K.scrollTop})))}),st(Pe(D,Xe(({height:K})=>K)),o),st(Pe(Qn(ht(D,Ep),ht(A,Ep),ht(V,(K,ee)=>K&&K.column===ee.column&&K.row===ee.row),ht(r)),Xe(([K,ee,ce,J])=>({viewport:K,item:ee,gap:ce,scrollTop:J}))),U),st(Pe(Qn(ht(I),t,ht(V,Yre),ht(A,Ep),ht(D,Ep),ht(B),ht(M),ht($),ht(F),ht(q)),gt(([,,,,,,,K])=>!K),Xe(([K,[ee,ce],J,ie,de,ge,Ce,,he,fe])=>{const{row:Oe,column:_e}=J,{height:Ne,width:nt}=ie,{width:$e}=de;if(Ce===0&&(K===0||$e===0))return zj;if(nt===0){const lt=zy(fe,K),ft=lt===0?Math.max(Ce-1,0):lt;return Qre(Hj(lt,ft,ge))}const Pt=N8($e,nt,_e);let Ze,ot;he?ee===0&&ce===0&&Ce>0?(Ze=0,ot=Ce-1):(Ze=Pt*ih((ee+Oe)/(Ne+Oe)),ot=Pt*Bj((ce+Oe)/(Ne+Oe))-1,ot=Wv(K-1,Vu(ot,Pt-1)),Ze=Wv(ot,Vu(0,Ze))):(Ze=0,ot=-1);const ye=Hj(Ze,ot,ge),{top:De,bottom:ut}=Vj(de,J,ie,ye),bt=Bj(K/Pt),Je=bt*Ne+(bt-1)*Oe-ut;return{items:ye,offsetTop:De,offsetBottom:Je,top:De,bottom:ut,itemHeight:Ne,itemWidth:nt}})),R),st(Pe(B,gt(K=>K!==null),Xe(K=>K.length)),I),st(Pe(Qn(D,A,R,V),gt(([K,ee,{items:ce}])=>ce.length>0&&ee.height!==0&&K.height!==0),Xe(([K,ee,{items:ce},J])=>{const{top:ie,bottom:de}=Vj(K,J,ee,ce);return[ie,de]}),fn(pd)),n);const Y=Ve(!1);st(Pe(r,_t(Y),Xe(([K,ee])=>ee||K!==0)),Y);const se=Jr(Pe(ht(R),gt(({items:K})=>K.length>0),_t(I,Y),gt(([{items:K},ee,ce])=>ce&&K[K.length-1].index===ee-1),Xe(([,K])=>K-1),fn())),ae=Jr(Pe(ht(R),gt(({items:K})=>K.length>0&&K[0].index===0),qs(0),fn())),re=Jr(Pe(ht(R),_t($),gt(([{items:K},ee])=>K.length>0&&!ee),Xe(([{items:K}])=>({startIndex:K[0].index,endIndex:K[K.length-1].index})),fn(j8),Ga(0)));st(re,g.scrollSeekRangeChanged),st(Pe(O,_t(D,A,I,V),Xe(([K,ee,ce,J,ie])=>{const de=S8(K),{align:ge,behavior:Ce,offset:he}=de;let fe=de.index;fe==="LAST"&&(fe=J-1),fe=Vu(0,fe,Wv(J-1,fe));let Oe=yx(ee,ie,ce,fe);return ge==="end"?Oe=Fj(Oe-ee.height+ce.height):ge==="center"&&(Oe=Fj(Oe-ee.height/2+ce.height/2)),he&&(Oe+=he),{top:Oe,behavior:Ce}})),i);const G=yr(Pe(R,Xe(K=>K.offsetBottom+K.bottom)),0);return st(Pe(b,Xe(K=>({width:K.visibleWidth,height:K.visibleHeight}))),D),{data:B,totalCount:I,viewportDimensions:D,itemDimensions:A,scrollTop:r,scrollHeight:T,overscan:e,scrollBy:s,scrollTo:i,scrollToIndex:O,smoothScrollTargetReached:l,windowViewportRect:b,windowScrollTo:_,useWindowScroll:w,customScrollParent:S,windowScrollContainerState:j,deviation:X,scrollContainerState:u,footerHeight:p,headerHeight:m,initialItemCount:M,gap:V,restoreStateFrom:N,...g,initialTopMostItemIndex:q,gridState:R,totalListHeight:G,...h,startReached:ae,endReached:se,rangeChanged:re,stateChanged:U,propsReady:x,stateRestoreInProgress:$,...E}},hn(Fy,Sr,Qd,_8,fi,By,di));function Vj(e,t,n,r){const{height:o}=n;if(o===void 0||r.length===0)return{top:0,bottom:0};const s=yx(e,t,n,r[0].index),i=yx(e,t,n,r[r.length-1].index)+o;return{top:s,bottom:i}}function yx(e,t,n,r){const o=N8(e.width,n.width,t.column),s=ih(r/o),i=s*n.height+Vu(0,s-1)*t.row;return i>0?i+t.row:i}function N8(e,t,n){return Vu(1,ih((e+n)/(ih(t)+n)))}const Jre=qt(()=>{const e=Ve(p=>`Item ${p}`),t=Ve({}),n=Ve(null),r=Ve("virtuoso-grid-item"),o=Ve("virtuoso-grid-list"),s=Ve(D8),i=Ve("div"),l=Ve(Uc),u=(p,m=null)=>yr(Pe(t,Xe(h=>h[p]),fn()),m);return{context:n,itemContent:e,components:t,computeItemKey:s,itemClassName:r,listClassName:o,headerFooterTag:i,scrollerRef:l,FooterComponent:u("Footer"),HeaderComponent:u("Header"),ListComponent:u("List","div"),ItemComponent:u("Item","div"),ScrollerComponent:u("Scroller","div"),ScrollSeekPlaceholder:u("ScrollSeekPlaceholder","div")}}),eoe=qt(([e,t])=>({...e,...t}),hn(Zre,Jre)),toe=H.memo(function(){const t=yn("gridState"),n=yn("listClassName"),r=yn("itemClassName"),o=yn("itemContent"),s=yn("computeItemKey"),i=yn("isSeeking"),l=qo("scrollHeight"),u=yn("ItemComponent"),p=yn("ListComponent"),m=yn("ScrollSeekPlaceholder"),h=yn("context"),g=qo("itemDimensions"),x=qo("gap"),y=yn("log"),b=yn("stateRestoreInProgress"),w=ll(S=>{const j=S.parentElement.parentElement.scrollHeight;l(j);const _=S.firstChild;if(_){const{width:E,height:I}=_.getBoundingClientRect();g({width:E,height:I})}x({row:Wj("row-gap",getComputedStyle(S).rowGap,y),column:Wj("column-gap",getComputedStyle(S).columnGap,y)})});return b?null:H.createElement(p,{ref:w,className:n,...Rr(p,h),style:{paddingTop:t.offsetTop,paddingBottom:t.offsetBottom},"data-test-id":"virtuoso-item-list"},t.items.map(S=>{const j=s(S.index,S.data,h);return i?H.createElement(m,{key:j,...Rr(m,h),index:S.index,height:t.itemHeight,width:t.itemWidth}):H.createElement(u,{...Rr(u,h),className:r,"data-index":S.index,key:j},o(S.index,S.data,h))}))}),noe=H.memo(function(){const t=yn("HeaderComponent"),n=qo("headerHeight"),r=yn("headerFooterTag"),o=ll(i=>n(ri(i,"height"))),s=yn("context");return t?H.createElement(r,{ref:o},H.createElement(t,Rr(t,s))):null}),roe=H.memo(function(){const t=yn("FooterComponent"),n=qo("footerHeight"),r=yn("headerFooterTag"),o=ll(i=>n(ri(i,"height"))),s=yn("context");return t?H.createElement(r,{ref:o},H.createElement(t,Rr(t,s))):null}),ooe=({children:e})=>{const t=H.useContext(R8),n=qo("itemDimensions"),r=qo("viewportDimensions"),o=ll(s=>{r(s.getBoundingClientRect())});return H.useEffect(()=>{t&&(r({height:t.viewportHeight,width:t.viewportWidth}),n({height:t.itemHeight,width:t.itemWidth}))},[t,r,n]),H.createElement("div",{style:wg,ref:o},e)},soe=({children:e})=>{const t=H.useContext(R8),n=qo("windowViewportRect"),r=qo("itemDimensions"),o=yn("customScrollParent"),s=M8(n,o);return H.useEffect(()=>{t&&(r({height:t.itemHeight,width:t.itemWidth}),n({offsetTop:0,visibleHeight:t.viewportHeight,visibleWidth:t.viewportWidth}))},[t,n,r]),H.createElement("div",{ref:s,style:wg},e)},aoe=H.memo(function({...t}){const n=yn("useWindowScroll"),r=yn("customScrollParent"),o=r||n?coe:loe,s=r||n?soe:ooe;return H.createElement(o,{...t},H.createElement(s,null,H.createElement(noe,null),H.createElement(toe,null),H.createElement(roe,null)))}),{Component:ioe,usePublisher:qo,useEmitterValue:yn,useEmitter:$8}=f8(eoe,{optional:{context:"context",totalCount:"totalCount",overscan:"overscan",itemContent:"itemContent",components:"components",computeItemKey:"computeItemKey",data:"data",initialItemCount:"initialItemCount",scrollSeekConfiguration:"scrollSeekConfiguration",headerFooterTag:"headerFooterTag",listClassName:"listClassName",itemClassName:"itemClassName",useWindowScroll:"useWindowScroll",customScrollParent:"customScrollParent",scrollerRef:"scrollerRef",logLevel:"logLevel",restoreStateFrom:"restoreStateFrom",initialTopMostItemIndex:"initialTopMostItemIndex"},methods:{scrollTo:"scrollTo",scrollBy:"scrollBy",scrollToIndex:"scrollToIndex"},events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange",stateChanged:"stateChanged"}},aoe),loe=A8({usePublisher:qo,useEmitterValue:yn,useEmitter:$8}),coe=T8({usePublisher:qo,useEmitterValue:yn,useEmitter:$8});function Wj(e,t,n){return t!=="normal"&&!(t!=null&&t.endsWith("px"))&&n(`${e} was not resolved to pixel value correctly`,t,eo.WARN),t==="normal"?0:parseInt(t??"0",10)}const uoe=ioe,doe=e=>{const t=W(s=>s.gallery.galleryView),{data:n}=cI(e),{data:r}=uI(e),o=d.useMemo(()=>t==="images"?n:r,[t,r,n]);return{totalImages:n,totalAssets:r,currentViewTotal:o}},foe=({imageDTO:e})=>a.jsx(L,{sx:{pointerEvents:"none",flexDirection:"column",position:"absolute",top:0,insetInlineStart:0,p:2,alignItems:"flex-start",gap:2},children:a.jsxs(Ds,{variant:"solid",colorScheme:"base",children:[e.width," × ",e.height]})}),poe=d.memo(foe),Vy=({postUploadAction:e,isDisabled:t})=>{const n=W(u=>u.gallery.autoAddBoardId),[r]=nI(),o=d.useCallback(u=>{const p=u[0];p&&r({file:p,image_category:"user",is_intermediate:!1,postUploadAction:e??{type:"TOAST"},board_id:n==="none"?void 0:n})},[n,e,r]),{getRootProps:s,getInputProps:i,open:l}=Qb({accept:{"image/png":[".png"],"image/jpeg":[".jpg",".jpeg",".png"]},onDropAccepted:o,disabled:t,noDrag:!0,multiple:!1});return{getUploadButtonProps:s,getUploadInputProps:i,openUploader:l}},moe=le(xe,({generation:e})=>{const{model:t}=e;return{model:t}}),Sg=()=>{const e=te(),t=sl(),{t:n}=Z(),{model:r}=W(moe),o=d.useCallback(()=>{t({title:n("toast.parameterSet"),status:"info",duration:2500,isClosable:!0})},[n,t]),s=d.useCallback(N=>{t({title:n("toast.parameterNotSet"),description:N,status:"warning",duration:2500,isClosable:!0})},[n,t]),i=d.useCallback(()=>{t({title:n("toast.parametersSet"),status:"info",duration:2500,isClosable:!0})},[n,t]),l=d.useCallback(N=>{t({title:n("toast.parametersNotSet"),status:"warning",description:N,duration:2500,isClosable:!0})},[n,t]),u=d.useCallback((N,$,q,F)=>{if(qf(N)||Xf($)||bu(q)||Q0(F)){qf(N)&&e(Nu(N)),Xf($)&&e($u($)),bu(q)&&e(Lu(q)),bu(F)&&e(zu(F)),o();return}s()},[e,o,s]),p=d.useCallback(N=>{if(!qf(N)){s();return}e(Nu(N)),o()},[e,o,s]),m=d.useCallback(N=>{if(!Xf(N)){s();return}e($u(N)),o()},[e,o,s]),h=d.useCallback(N=>{if(!bu(N)){s();return}e(Lu(N)),o()},[e,o,s]),g=d.useCallback(N=>{if(!Q0(N)){s();return}e(zu(N)),o()},[e,o,s]),x=d.useCallback(N=>{if(!sw(N)){s();return}e(Xp(N)),o()},[e,o,s]),y=d.useCallback(N=>{if(!Y0(N)){s();return}e(Qp(N)),o()},[e,o,s]),b=d.useCallback(N=>{if(!aw(N)){s();return}e(i1(N)),o()},[e,o,s]),w=d.useCallback(N=>{if(!Z0(N)){s();return}e(l1(N)),o()},[e,o,s]),S=d.useCallback(N=>{if(!J0(N)){s();return}e(Yp(N)),o()},[e,o,s]),j=d.useCallback(N=>{if(!iw(N)){s();return}e(Bi(N)),o()},[e,o,s]),_=d.useCallback(N=>{if(!lw(N)){s();return}e(Hi(N)),o()},[e,o,s]),E=d.useCallback(N=>{if(!cw(N)){s();return}e(Zp(N)),o()},[e,o,s]),{loras:I}=Cd(void 0,{selectFromResult:N=>({loras:N.data?MD.getSelectors().selectAll(N.data):[]})}),M=d.useCallback(N=>{if(!fI(N.lora))return{lora:null,error:"Invalid LoRA model"};const{base_model:$,model_name:q}=N.lora,F=I.find(Y=>Y.base_model===$&&Y.model_name===q);return F?(F==null?void 0:F.base_model)===(r==null?void 0:r.base_model)?{lora:F,error:null}:{lora:null,error:"LoRA incompatible with currently-selected model"}:{lora:null,error:"LoRA model is not installed"}},[I,r==null?void 0:r.base_model]),R=d.useCallback(N=>{const $=M(N);if(!$.lora){s($.error);return}e(uw({...$.lora,weight:N.weight})),o()},[M,e,o,s]),{controlnets:D}=gh(void 0,{selectFromResult:N=>({controlnets:N.data?OD.getSelectors().selectAll(N.data):[]})}),A=d.useCallback(N=>{if(!c1(N.control_model))return{controlnet:null,error:"Invalid ControlNet model"};const{image:$,control_model:q,control_weight:F,begin_step_percent:Q,end_step_percent:Y,control_mode:se,resize_mode:ae}=N,re=D.find(ie=>ie.base_model===q.base_model&&ie.model_name===q.model_name);if(!re)return{controlnet:null,error:"ControlNet model is not installed"};if(!((re==null?void 0:re.base_model)===(r==null?void 0:r.base_model)))return{controlnet:null,error:"ControlNet incompatible with currently-selected model"};const K=Zs();let ee=Ta.processorType;for(const ie in dw)if(re.model_name.includes(ie)){ee=dw[ie]||Ta.processorType;break}const ce=Fr[ee].default;return{controlnet:{isEnabled:!0,model:re,weight:typeof F=="number"?F:Ta.weight,beginStepPct:Q||Ta.beginStepPct,endStepPct:Y||Ta.endStepPct,controlMode:se||Ta.controlMode,resizeMode:ae||Ta.resizeMode,controlImage:($==null?void 0:$.image_name)||null,processedControlImage:($==null?void 0:$.image_name)||null,processorType:ee,processorNode:ce.type!=="none"?ce:Ta.processorNode,shouldAutoConfig:!0,controlNetId:K},error:null}},[D,r==null?void 0:r.base_model]),O=d.useCallback(N=>{const $=A(N);if(!$.controlnet){s($.error);return}e(fw({...$.controlnet})),o()},[A,e,o,s]),{ipAdapters:T}=Vx(void 0,{selectFromResult:N=>({ipAdapters:N.data?RD.getSelectors().selectAll(N.data):[]})}),X=d.useCallback(N=>{if(!DD(N==null?void 0:N.ip_adapter_model))return{ipAdapter:null,error:"Invalid IP Adapter model"};const{image:$,ip_adapter_model:q,weight:F,begin_step_percent:Q,end_step_percent:Y}=N,se=T.find(G=>G.base_model===(q==null?void 0:q.base_model)&&G.model_name===(q==null?void 0:q.model_name));return se?(se==null?void 0:se.base_model)===(r==null?void 0:r.base_model)?{ipAdapter:{adapterImage:($==null?void 0:$.image_name)??null,model:se,weight:F??ev.weight,beginStepPct:Q??ev.beginStepPct,endStepPct:Y??ev.endStepPct},error:null}:{ipAdapter:null,error:"IP Adapter incompatible with currently-selected model"}:{ipAdapter:null,error:"IP Adapter model is not installed"}},[T,r==null?void 0:r.base_model]),B=d.useCallback(N=>{const $=X(N);if(!$.ipAdapter){s($.error);return}e(pw({...$.ipAdapter})),e(u1(!0)),o()},[X,e,o,s]),V=d.useCallback(N=>{e(vh(N))},[e]),U=d.useCallback(N=>{if(!N){l();return}const{cfg_scale:$,height:q,model:F,positive_prompt:Q,negative_prompt:Y,scheduler:se,seed:ae,steps:re,width:G,strength:K,positive_style_prompt:ee,negative_style_prompt:ce,refiner_model:J,refiner_cfg_scale:ie,refiner_steps:de,refiner_scheduler:ge,refiner_positive_aesthetic_score:Ce,refiner_negative_aesthetic_score:he,refiner_start:fe,loras:Oe,controlnets:_e,ipAdapters:Ne}=N;Y0($)&&e(Qp($)),aw(F)&&e(i1(F)),qf(Q)&&e(Nu(Q)),Xf(Y)&&e($u(Y)),Z0(se)&&e(l1(se)),sw(ae)&&e(Xp(ae)),J0(re)&&e(Yp(re)),iw(G)&&e(Bi(G)),lw(q)&&e(Hi(q)),cw(K)&&e(Zp(K)),bu(ee)&&e(Lu(ee)),Q0(ce)&&e(zu(ce)),AD(J)&&e(pI(J)),J0(de)&&e(d1(de)),Y0(ie)&&e(f1(ie)),Z0(ge)&&e(mI(ge)),TD(Ce)&&e(p1(Ce)),ND(he)&&e(m1(he)),$D(fe)&&e(h1(fe)),e(LD()),Oe==null||Oe.forEach(nt=>{const $e=M(nt);$e.lora&&e(uw({...$e.lora,weight:nt.weight}))}),e(sI()),_e!=null&&_e.length&&e(zD()),_e==null||_e.forEach(nt=>{const $e=A(nt);$e.controlnet&&e(fw($e.controlnet))}),Ne!=null&&Ne.length&&e(u1(!0)),Ne==null||Ne.forEach(nt=>{const $e=X(nt);$e.ipAdapter&&e(pw($e.ipAdapter))}),i()},[l,i,e,M,A,X]);return{recallBothPrompts:u,recallPositivePrompt:p,recallNegativePrompt:m,recallSDXLPositiveStylePrompt:h,recallSDXLNegativeStylePrompt:g,recallSeed:x,recallCfgScale:y,recallModel:b,recallScheduler:w,recallSteps:S,recallWidth:j,recallHeight:_,recallStrength:E,recallLoRA:R,recallControlNet:O,recallIPAdapter:B,recallAllParameters:U,sendToImageToImage:V}},L8=()=>{const e=sl(),{t}=Z(),n=d.useMemo(()=>!!navigator.clipboard&&!!window.ClipboardItem,[]),r=d.useCallback(async o=>{n||e({title:t("toast.problemCopyingImage"),description:"Your browser doesn't support the Clipboard API.",status:"error",duration:2500,isClosable:!0});try{FD((async()=>await(await fetch(o)).blob())()),e({title:t("toast.imageCopied"),status:"success",duration:2500,isClosable:!0})}catch(s){e({title:t("toast.problemCopyingImage"),description:String(s),status:"error",duration:2500,isClosable:!0})}},[n,t,e]);return{isClipboardAPIAvailable:n,copyImageToClipboard:r}};function hoe(e){return Te({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M125.7 160H176c17.7 0 32 14.3 32 32s-14.3 32-32 32H48c-17.7 0-32-14.3-32-32V64c0-17.7 14.3-32 32-32s32 14.3 32 32v51.2L97.6 97.6c87.5-87.5 229.3-87.5 316.8 0s87.5 229.3 0 316.8s-229.3 87.5-316.8 0c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0c62.5 62.5 163.8 62.5 226.3 0s62.5-163.8 0-226.3s-163.8-62.5-226.3 0L125.7 160z"}}]})(e)}function goe(e){return Te({tag:"svg",attr:{viewBox:"0 0 384 512"},child:[{tag:"path",attr:{d:"M0 256L28.5 28c2-16 15.6-28 31.8-28H228.9c15 0 27.1 12.1 27.1 27.1c0 3.2-.6 6.5-1.7 9.5L208 160H347.3c20.2 0 36.7 16.4 36.7 36.7c0 7.4-2.2 14.6-6.4 20.7l-192.2 281c-5.9 8.6-15.6 13.7-25.9 13.7h-2.9c-15.7 0-28.5-12.8-28.5-28.5c0-2.3 .3-4.6 .9-6.9L176 288H32c-17.7 0-32-14.3-32-32z"}}]})(e)}function voe(e){return Te({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M256 512A256 256 0 1 0 256 0a256 256 0 1 0 0 512zm0-384c13.3 0 24 10.7 24 24V264c0 13.3-10.7 24-24 24s-24-10.7-24-24V152c0-13.3 10.7-24 24-24zM224 352a32 32 0 1 1 64 0 32 32 0 1 1 -64 0z"}}]})(e)}function Wy(e){return Te({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M418.4 157.9c35.3-8.3 61.6-40 61.6-77.9c0-44.2-35.8-80-80-80c-43.4 0-78.7 34.5-80 77.5L136.2 151.1C121.7 136.8 101.9 128 80 128c-44.2 0-80 35.8-80 80s35.8 80 80 80c12.2 0 23.8-2.7 34.1-7.6L259.7 407.8c-2.4 7.6-3.7 15.8-3.7 24.2c0 44.2 35.8 80 80 80s80-35.8 80-80c0-27.7-14-52.1-35.4-66.4l37.8-207.7zM156.3 232.2c2.2-6.9 3.5-14.2 3.7-21.7l183.8-73.5c3.6 3.5 7.4 6.7 11.6 9.5L317.6 354.1c-5.5 1.3-10.8 3.1-15.8 5.5L156.3 232.2z"}}]})(e)}function xoe(e){return Te({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M8 256a56 56 0 1 1 112 0A56 56 0 1 1 8 256zm160 0a56 56 0 1 1 112 0 56 56 0 1 1 -112 0zm216-56a56 56 0 1 1 0 112 56 56 0 1 1 0-112z"}}]})(e)}function boe(e){return Te({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M416 208c0 45.9-14.9 88.3-40 122.7L502.6 457.4c12.5 12.5 12.5 32.8 0 45.3s-32.8 12.5-45.3 0L330.7 376c-34.4 25.2-76.8 40-122.7 40C93.1 416 0 322.9 0 208S93.1 0 208 0S416 93.1 416 208zM136 184c-13.3 0-24 10.7-24 24s10.7 24 24 24H280c13.3 0 24-10.7 24-24s-10.7-24-24-24H136z"}}]})(e)}function yoe(e){return Te({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M416 208c0 45.9-14.9 88.3-40 122.7L502.6 457.4c12.5 12.5 12.5 32.8 0 45.3s-32.8 12.5-45.3 0L330.7 376c-34.4 25.2-76.8 40-122.7 40C93.1 416 0 322.9 0 208S93.1 0 208 0S416 93.1 416 208zM184 296c0 13.3 10.7 24 24 24s24-10.7 24-24V232h64c13.3 0 24-10.7 24-24s-10.7-24-24-24H232V120c0-13.3-10.7-24-24-24s-24 10.7-24 24v64H120c-13.3 0-24 10.7-24 24s10.7 24 24 24h64v64z"}}]})(e)}function Coe(e){return Te({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0V0z"}},{tag:"path",attr:{d:"M17 16l-4-4V8.82C14.16 8.4 15 7.3 15 6c0-1.66-1.34-3-3-3S9 4.34 9 6c0 1.3.84 2.4 2 2.82V12l-4 4H3v5h5v-3.05l4-4.2 4 4.2V21h5v-5h-4z"}}]})(e)}function woe(e){return Te({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M20 2H4c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zM8 20H4v-4h4v4zm0-6H4v-4h4v4zm0-6H4V4h4v4zm6 12h-4v-4h4v4zm0-6h-4v-4h4v4zm0-6h-4V4h4v4zm6 12h-4v-4h4v4zm0-6h-4v-4h4v4zm0-6h-4V4h4v4z"}}]})(e)}function Soe(e){return Te({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M22 16V4c0-1.1-.9-2-2-2H8c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2zm-11-4l2.03 2.71L16 11l4 5H8l3-4zM2 6v14c0 1.1.9 2 2 2h14v-2H4V6H2z"}}]})(e)}function Uy(e){return Te({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M22 9.24l-7.19-.62L12 2 9.19 8.63 2 9.24l5.46 4.73L5.82 21 12 17.27 18.18 21l-1.63-7.03L22 9.24zM12 15.4l-3.76 2.27 1-4.28-3.32-2.88 4.38-.38L12 6.1l1.71 4.04 4.38.38-3.32 2.88 1 4.28L12 15.4z"}}]})(e)}function Gy(e){return Te({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M12 17.27L18.18 21l-1.64-7.03L22 9.24l-7.19-.61L12 2 9.19 8.63 2 9.24l5.46 4.73L5.82 21z"}}]})(e)}function z8(e){return Te({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0V0z"}},{tag:"path",attr:{d:"M16 17.01V10h-2v7.01h-3L15 21l4-3.99h-3zM9 3L5 6.99h3V14h2V6.99h3L9 3zm7 14.01V10h-2v7.01h-3L15 21l4-3.99h-3zM9 3L5 6.99h3V14h2V6.99h3L9 3z"}}]})(e)}const Ky=e=>e.config;Wx("gallery/requestedBoardImagesDeletion");const koe=Wx("gallery/sentImageToCanvas"),F8=Wx("gallery/sentImageToImg2Img"),joe=e=>{const{imageDTO:t}=e,n=te(),{t:r}=Z(),o=sl(),s=Bt("unifiedCanvas").isFeatureEnabled,{shouldFetchMetadataFromApi:i}=W(Ky),l=Jh(Ux),{metadata:u,workflow:p,isLoading:m}=Gx({image:t,shouldFetchMetadataFromApi:i},{selectFromResult:B=>{var V,U;return{isLoading:B.isFetching,metadata:(V=B==null?void 0:B.currentData)==null?void 0:V.metadata,workflow:(U=B==null?void 0:B.currentData)==null?void 0:U.workflow}}}),[h]=Kx(),[g]=qx(),{isClipboardAPIAvailable:x,copyImageToClipboard:y}=L8(),b=d.useCallback(()=>{t&&n(xh([t]))},[n,t]),{recallBothPrompts:w,recallSeed:S,recallAllParameters:j}=Sg(),_=d.useCallback(()=>{w(u==null?void 0:u.positive_prompt,u==null?void 0:u.negative_prompt,u==null?void 0:u.positive_style_prompt,u==null?void 0:u.negative_style_prompt)},[u==null?void 0:u.negative_prompt,u==null?void 0:u.positive_prompt,u==null?void 0:u.positive_style_prompt,u==null?void 0:u.negative_style_prompt,w]),E=d.useCallback(()=>{S(u==null?void 0:u.seed)},[u==null?void 0:u.seed,S]),I=d.useCallback(()=>{p&&n(Xx(p))},[n,p]),M=d.useCallback(()=>{n(F8()),n(vh(t))},[n,t]),R=d.useCallback(()=>{n(koe()),qr.flushSync(()=>{n(Xs("unifiedCanvas"))}),n(hI(t)),o({title:r("toast.sentToUnifiedCanvas"),status:"success",duration:2500,isClosable:!0})},[n,t,r,o]),D=d.useCallback(()=>{j(u)},[u,j]),A=d.useCallback(()=>{n(gI([t])),n(Bx(!0))},[n,t]),O=d.useCallback(()=>{y(t.image_url)},[y,t.image_url]),T=d.useCallback(()=>{t&&h({imageDTOs:[t]})},[h,t]),X=d.useCallback(()=>{t&&g({imageDTOs:[t]})},[g,t]);return a.jsxs(a.Fragment,{children:[a.jsx(en,{as:"a",href:t.image_url,target:"_blank",icon:a.jsx(py,{}),children:r("common.openInNewTab")}),x&&a.jsx(en,{icon:a.jsx(Hc,{}),onClickCapture:O,children:r("parameters.copyImage")}),a.jsx(en,{as:"a",download:!0,href:t.image_url,target:"_blank",icon:a.jsx(ig,{}),w:"100%",children:r("parameters.downloadImage")}),a.jsx(en,{icon:m?a.jsx(Mp,{}):a.jsx(Wy,{}),onClickCapture:I,isDisabled:m||!p,children:r("nodes.loadWorkflow")}),a.jsx(en,{icon:m?a.jsx(Mp,{}):a.jsx(gM,{}),onClickCapture:_,isDisabled:m||(u==null?void 0:u.positive_prompt)===void 0&&(u==null?void 0:u.negative_prompt)===void 0,children:r("parameters.usePrompt")}),a.jsx(en,{icon:m?a.jsx(Mp,{}):a.jsx(vM,{}),onClickCapture:E,isDisabled:m||(u==null?void 0:u.seed)===void 0,children:r("parameters.useSeed")}),a.jsx(en,{icon:m?a.jsx(Mp,{}):a.jsx(aM,{}),onClickCapture:D,isDisabled:m||!u,children:r("parameters.useAll")}),a.jsx(en,{icon:a.jsx(qk,{}),onClickCapture:M,id:"send-to-img2img",children:r("parameters.sendToImg2Img")}),s&&a.jsx(en,{icon:a.jsx(qk,{}),onClickCapture:R,id:"send-to-canvas",children:r("parameters.sendToUnifiedCanvas")}),a.jsx(en,{icon:a.jsx(dM,{}),onClickCapture:A,children:"Change Board"}),t.starred?a.jsx(en,{icon:l?l.off.icon:a.jsx(Gy,{}),onClickCapture:X,children:l?l.off.text:"Unstar Image"}):a.jsx(en,{icon:l?l.on.icon:a.jsx(Uy,{}),onClickCapture:T,children:l?l.on.text:"Star Image"}),a.jsx(en,{sx:{color:"error.600",_dark:{color:"error.300"}},icon:a.jsx(Br,{}),onClickCapture:b,children:r("gallery.deleteImage")})]})},B8=d.memo(joe),Mp=()=>a.jsx(L,{w:"14px",alignItems:"center",justifyContent:"center",children:a.jsx(fa,{size:"xs"})}),_oe=()=>{const e=te(),t=W(h=>h.gallery.selection),n=Jh(Ux),[r]=Kx(),[o]=qx(),s=d.useCallback(()=>{e(gI(t)),e(Bx(!0))},[e,t]),i=d.useCallback(()=>{e(xh(t))},[e,t]),l=d.useCallback(()=>{r({imageDTOs:t})},[r,t]),u=d.useCallback(()=>{o({imageDTOs:t})},[o,t]),p=d.useMemo(()=>t.every(h=>h.starred),[t]),m=d.useMemo(()=>t.every(h=>!h.starred),[t]);return a.jsxs(a.Fragment,{children:[p&&a.jsx(en,{icon:n?n.on.icon:a.jsx(Uy,{}),onClickCapture:u,children:n?n.off.text:"Unstar All"}),(m||!p&&!m)&&a.jsx(en,{icon:n?n.on.icon:a.jsx(Gy,{}),onClickCapture:l,children:n?n.on.text:"Star All"}),a.jsx(en,{icon:a.jsx(dM,{}),onClickCapture:s,children:"Change Board"}),a.jsx(en,{sx:{color:"error.600",_dark:{color:"error.300"}},icon:a.jsx(Br,{}),onClickCapture:i,children:"Delete Selection"})]})},Ioe=d.memo(_oe),Poe=le([xe],({gallery:e})=>({selectionCount:e.selection.length}),Se),Eoe=({imageDTO:e,children:t})=>{const{selectionCount:n}=W(Poe),r=d.useCallback(o=>{o.preventDefault()},[]);return a.jsx(Ry,{menuProps:{size:"sm",isLazy:!0},menuButtonProps:{bg:"transparent",_hover:{bg:"transparent"}},renderMenu:()=>e?n>1?a.jsx(Ui,{sx:{visibility:"visible !important"},motionProps:vc,onContextMenu:r,children:a.jsx(Ioe,{})}):a.jsx(Ui,{sx:{visibility:"visible !important"},motionProps:vc,onContextMenu:r,children:a.jsx(B8,{imageDTO:e})}):null,children:t})},Moe=d.memo(Eoe),Ooe=e=>{const{data:t,disabled:n,...r}=e,o=d.useRef(Zs()),{attributes:s,listeners:i,setNodeRef:l}=ine({id:o.current,disabled:n,data:t});return a.jsx(Ie,{ref:l,position:"absolute",w:"full",h:"full",top:0,insetInlineStart:0,...s,...i,...r})},Roe=d.memo(Ooe),Doe=a.jsx(Tn,{as:cg,sx:{boxSize:16}}),Aoe=a.jsx(Zn,{icon:Qi}),Toe=e=>{const{imageDTO:t,onError:n,onClick:r,withMetadataOverlay:o=!1,isDropDisabled:s=!1,isDragDisabled:i=!1,isUploadDisabled:l=!1,minSize:u=24,postUploadAction:p,imageSx:m,fitContainer:h=!1,droppableData:g,draggableData:x,dropLabel:y,isSelected:b=!1,thumbnail:w=!1,noContentFallback:S=Aoe,uploadElement:j=Doe,useThumbailFallback:_,withHoverOverlay:E=!1,children:I,onMouseOver:M,onMouseOut:R,dataTestId:D}=e,{colorMode:A}=ha(),[O,T]=d.useState(!1),X=d.useCallback($=>{M&&M($),T(!0)},[M]),B=d.useCallback($=>{R&&R($),T(!1)},[R]),{getUploadButtonProps:V,getUploadInputProps:U}=Vy({postUploadAction:p,isDisabled:l}),N=l?{}:{cursor:"pointer",bg:Ae("base.200","base.700")(A),_hover:{bg:Ae("base.300","base.650")(A),color:Ae("base.500","base.300")(A)}};return a.jsx(Moe,{imageDTO:t,children:$=>a.jsxs(L,{ref:$,onMouseOver:X,onMouseOut:B,sx:{width:"full",height:"full",alignItems:"center",justifyContent:"center",position:"relative",minW:u||void 0,minH:u||void 0,userSelect:"none",cursor:i||!t?"default":"pointer"},children:[t&&a.jsxs(L,{sx:{w:"full",h:"full",position:h?"absolute":"relative",alignItems:"center",justifyContent:"center"},children:[a.jsx(ga,{src:w?t.thumbnail_url:t.image_url,fallbackStrategy:"beforeLoadOrError",fallbackSrc:_?t.thumbnail_url:void 0,fallback:_?void 0:a.jsx(Nne,{image:t}),onError:n,draggable:!1,sx:{w:t.width,objectFit:"contain",maxW:"full",maxH:"full",borderRadius:"base",...m},"data-testid":D}),o&&a.jsx(poe,{imageDTO:t}),a.jsx(Oy,{isSelected:b,isHovered:E?O:!1})]}),!t&&!l&&a.jsx(a.Fragment,{children:a.jsxs(L,{sx:{minH:u,w:"full",h:"full",alignItems:"center",justifyContent:"center",borderRadius:"base",transitionProperty:"common",transitionDuration:"0.1s",color:Ae("base.500","base.500")(A),...N},...V(),children:[a.jsx("input",{...U()}),j]})}),!t&&l&&S,t&&!i&&a.jsx(Roe,{data:x,disabled:i||!t,onClick:r}),I,!s&&a.jsx(My,{data:g,disabled:s,dropLabel:y})]})})},ua=d.memo(Toe),Noe=()=>a.jsx(Gh,{sx:{position:"relative",height:"full",width:"full","::before":{content:"''",display:"block",pt:"100%"}},children:a.jsx(Ie,{sx:{position:"absolute",top:0,insetInlineStart:0,height:"full",width:"full"}})}),$oe=d.memo(Noe),Loe=le([xe,Qx],({gallery:e},t)=>{const n=e.selection;return{queryArgs:t,selection:n}},Se),zoe=e=>{const t=te(),{queryArgs:n,selection:r}=W(Loe),{imageDTOs:o}=vI(n,{selectFromResult:p=>({imageDTOs:p.data?BD.selectAll(p.data):[]})}),s=Bt("multiselect").isFeatureEnabled,i=d.useCallback(p=>{var m;if(e){if(!s){t(yu([e]));return}if(p.shiftKey){const h=e.image_name,g=(m=r[r.length-1])==null?void 0:m.image_name,x=o.findIndex(b=>b.image_name===g),y=o.findIndex(b=>b.image_name===h);if(x>-1&&y>-1){const b=Math.min(x,y),w=Math.max(x,y),S=o.slice(b,w+1);t(yu(Kw(r.concat(S))))}}else p.ctrlKey||p.metaKey?r.some(h=>h.image_name===e.image_name)&&r.length>1?t(yu(r.filter(h=>h.image_name!==e.image_name))):t(yu(Kw(r.concat(e)))):t(yu([e]))}},[t,e,o,r,s]),l=d.useMemo(()=>e?r.some(p=>p.image_name===e.image_name):!1,[e,r]),u=d.useMemo(()=>r.length,[r.length]);return{selection:r,selectionCount:u,isSelected:l,handleClick:i}},Foe=e=>{const{onClick:t,tooltip:n,icon:r,styleOverrides:o}=e,s=sa("drop-shadow(0px 0px 0.1rem var(--invokeai-colors-base-600))","drop-shadow(0px 0px 0.1rem var(--invokeai-colors-base-800))");return a.jsx(Fe,{onClick:t,"aria-label":n,tooltip:n,icon:r,size:"sm",variant:"link",sx:{position:"absolute",top:1,insetInlineEnd:1,p:0,minW:0,svg:{transitionProperty:"common",transitionDuration:"normal",fill:"base.100",_hover:{fill:"base.50"},filter:s},...o},"data-testid":n})},Li=d.memo(Foe),Boe=e=>{const t=te(),{imageName:n}=e,{currentData:r}=to(n),o=W(M=>M.hotkeys.shift),{t:s}=Z(),{handleClick:i,isSelected:l,selection:u,selectionCount:p}=zoe(r),m=Jh(Ux),h=d.useCallback(M=>{M.stopPropagation(),r&&t(xh([r]))},[t,r]),g=d.useMemo(()=>{if(p>1)return{id:"gallery-image",payloadType:"IMAGE_DTOS",payload:{imageDTOs:u}};if(r)return{id:"gallery-image",payloadType:"IMAGE_DTO",payload:{imageDTO:r}}},[r,u,p]),[x]=Kx(),[y]=qx(),b=d.useCallback(()=>{r&&(r.starred&&y({imageDTOs:[r]}),r.starred||x({imageDTOs:[r]}))},[x,y,r]),[w,S]=d.useState(!1),j=d.useCallback(()=>{S(!0)},[]),_=d.useCallback(()=>{S(!1)},[]),E=d.useMemo(()=>{if(r!=null&&r.starred)return m?m.on.icon:a.jsx(Gy,{size:"20"});if(!(r!=null&&r.starred)&&w)return m?m.off.icon:a.jsx(Uy,{size:"20"})},[r==null?void 0:r.starred,w,m]),I=d.useMemo(()=>r!=null&&r.starred?m?m.off.text:"Unstar":r!=null&&r.starred?"":m?m.on.text:"Star",[r==null?void 0:r.starred,m]);return r?a.jsx(Ie,{sx:{w:"full",h:"full",touchAction:"none"},"data-testid":`image-${r.image_name}`,children:a.jsx(L,{userSelect:"none",sx:{position:"relative",justifyContent:"center",alignItems:"center",aspectRatio:"1/1"},children:a.jsx(ua,{onClick:i,imageDTO:r,draggableData:g,isSelected:l,minSize:0,imageSx:{w:"full",h:"full"},isDropDisabled:!0,isUploadDisabled:!0,thumbnail:!0,withHoverOverlay:!0,onMouseOver:j,onMouseOut:_,children:a.jsxs(a.Fragment,{children:[a.jsx(Li,{onClick:b,icon:E,tooltip:I}),w&&o&&a.jsx(Li,{onClick:h,icon:a.jsx(Br,{}),tooltip:s("gallery.deleteImage"),styleOverrides:{bottom:2,top:"auto"}})]})})})}):a.jsx($oe,{})},Hoe=d.memo(Boe),Voe=je((e,t)=>a.jsx(Ie,{className:"item-container",ref:t,p:1.5,"data-testid":"image-item-container",children:e.children})),Woe=d.memo(Voe),Uoe=je((e,t)=>{const n=W(r=>r.gallery.galleryImageMinimumWidth);return a.jsx(Ja,{...e,className:"list-container",ref:t,sx:{gridTemplateColumns:`repeat(auto-fill, minmax(${n}px, 1fr));`},"data-testid":"image-list-container",children:e.children})}),Goe=d.memo(Uoe),Koe={defer:!0,options:{scrollbars:{visibility:"auto",autoHide:"scroll",autoHideDelay:1300,theme:"os-theme-dark"},overflow:{x:"hidden"}}},qoe=()=>{const{t:e}=Z(),t=d.useRef(null),[n,r]=d.useState(null),[o,s]=Ey(Koe),i=W(w=>w.gallery.selectedBoardId),{currentViewTotal:l}=doe(i),u=W(Qx),{currentData:p,isFetching:m,isSuccess:h,isError:g}=vI(u),[x]=xI(),y=d.useMemo(()=>!p||!l?!1:p.ids.length{y&&x({...u,offset:(p==null?void 0:p.ids.length)??0,limit:bI})},[y,x,u,p==null?void 0:p.ids.length]);return d.useEffect(()=>{const{current:w}=t;return n&&w&&o({target:w,elements:{viewport:n}}),()=>{var S;return(S=s())==null?void 0:S.destroy()}},[n,o,s]),p?h&&(p==null?void 0:p.ids.length)===0?a.jsx(L,{sx:{w:"full",h:"full",alignItems:"center",justifyContent:"center"},children:a.jsx(Zn,{label:e("gallery.noImagesInGallery"),icon:Qi})}):h&&p?a.jsxs(a.Fragment,{children:[a.jsx(Ie,{ref:t,"data-overlayscrollbars":"",h:"100%",children:a.jsx(uoe,{style:{height:"100%"},data:p.ids,endReached:b,components:{Item:Woe,List:Goe},scrollerRef:r,itemContent:(w,S)=>a.jsx(Hoe,{imageName:S},S)})}),a.jsx(at,{onClick:b,isDisabled:!y,isLoading:m,loadingText:e("gallery.loading"),flexShrink:0,children:`Load More (${p.ids.length} of ${l})`})]}):g?a.jsx(Ie,{sx:{w:"full",h:"full"},children:a.jsx(Zn,{label:e("gallery.unableToLoad"),icon:NJ})}):null:a.jsx(L,{sx:{w:"full",h:"full",alignItems:"center",justifyContent:"center"},children:a.jsx(Zn,{label:e("gallery.loading"),icon:Qi})})},Xoe=d.memo(qoe),Qoe=le([xe],e=>{const{galleryView:t}=e.gallery;return{galleryView:t}},Se),Yoe=()=>{const e=d.useRef(null),t=d.useRef(null),{galleryView:n}=W(Qoe),r=te(),{isOpen:o,onToggle:s}=Lr({defaultIsOpen:!0}),i=d.useCallback(()=>{r(mw("images"))},[r]),l=d.useCallback(()=>{r(mw("assets"))},[r]);return a.jsxs(m3,{layerStyle:"first",sx:{flexDirection:"column",h:"full",w:"full",borderRadius:"base",p:2},children:[a.jsxs(Ie,{sx:{w:"full"},children:[a.jsxs(L,{ref:e,sx:{alignItems:"center",justifyContent:"space-between",gap:2},children:[a.jsx(_ne,{isOpen:o,onToggle:s}),a.jsx(Tne,{})]}),a.jsx(Ie,{children:a.jsx(Sne,{isOpen:o})})]}),a.jsxs(L,{ref:t,direction:"column",gap:2,h:"full",w:"full",children:[a.jsx(L,{sx:{alignItems:"center",justifyContent:"space-between",gap:2},children:a.jsx(rl,{index:n==="images"?0:1,variant:"unstyled",size:"sm",sx:{w:"full"},children:a.jsx(ol,{children:a.jsxs(Vt,{isAttached:!0,sx:{w:"full"},children:[a.jsx(Tr,{as:at,size:"sm",isChecked:n==="images",onClick:i,sx:{w:"full"},leftIcon:a.jsx(WJ,{}),"data-testid":"images-tab",children:"Images"}),a.jsx(Tr,{as:at,size:"sm",isChecked:n==="assets",onClick:l,sx:{w:"full"},leftIcon:a.jsx(nee,{}),"data-testid":"assets-tab",children:"Assets"})]})})})}),a.jsx(Xoe,{})]})]})},Zoe=d.memo(Yoe),Joe=()=>{const e=W(p=>p.system.isConnected),{data:t}=va(),[n,{isLoading:r}]=Yx(),o=te(),{t:s}=Z(),i=d.useMemo(()=>t==null?void 0:t.queue.item_id,[t==null?void 0:t.queue.item_id]),l=d.useCallback(async()=>{if(i)try{await n(i).unwrap(),o(ct({title:s("queue.cancelSucceeded"),status:"success"}))}catch{o(ct({title:s("queue.cancelFailed"),status:"error"}))}},[i,o,s,n]),u=d.useMemo(()=>!e||J9(i),[e,i]);return{cancelQueueItem:l,isLoading:r,currentQueueItemId:i,isDisabled:u}},ese=({label:e,tooltip:t,icon:n,onClick:r,isDisabled:o,colorScheme:s,asIconButton:i,isLoading:l,loadingText:u,sx:p})=>i?a.jsx(Fe,{"aria-label":e,tooltip:t,icon:n,onClick:r,isDisabled:o,colorScheme:s,isLoading:l,sx:p,"data-testid":e}):a.jsx(at,{"aria-label":e,tooltip:t,leftIcon:n,onClick:r,isDisabled:o,colorScheme:s,isLoading:l,loadingText:u??e,flexGrow:1,sx:p,"data-testid":e,children:e}),ul=d.memo(ese),tse=({asIconButton:e,sx:t})=>{const{t:n}=Z(),{cancelQueueItem:r,isLoading:o,isDisabled:s}=Joe();return a.jsx(ul,{isDisabled:s,isLoading:o,asIconButton:e,label:n("queue.cancel"),tooltip:n("queue.cancelTooltip"),icon:a.jsx(Ic,{}),onClick:r,colorScheme:"error",sx:t})},H8=d.memo(tse),nse=()=>{const{t:e}=Z(),t=te(),{data:n}=va(),r=W(u=>u.system.isConnected),[o,{isLoading:s}]=yI({fixedCacheKey:"clearQueue"}),i=d.useCallback(async()=>{if(n!=null&&n.queue.total)try{await o().unwrap(),t(ct({title:e("queue.clearSucceeded"),status:"success"})),t(Zx(void 0)),t(Jx(void 0))}catch{t(ct({title:e("queue.clearFailed"),status:"error"}))}},[n==null?void 0:n.queue.total,o,t,e]),l=d.useMemo(()=>!r||!(n!=null&&n.queue.total),[r,n==null?void 0:n.queue.total]);return{clearQueue:i,isLoading:s,queueStatus:n,isDisabled:l}},rse=je((e,t)=>{const{t:n}=Z(),{acceptButtonText:r=n("common.accept"),acceptCallback:o,cancelButtonText:s=n("common.cancel"),cancelCallback:i,children:l,title:u,triggerComponent:p}=e,{isOpen:m,onOpen:h,onClose:g}=Lr(),x=d.useRef(null),y=()=>{o(),g()},b=()=>{i&&i(),g()};return a.jsxs(a.Fragment,{children:[d.cloneElement(p,{onClick:h,ref:t}),a.jsx(Td,{isOpen:m,leastDestructiveRef:x,onClose:g,isCentered:!0,children:a.jsx(Yo,{children:a.jsxs(Nd,{children:[a.jsx(Qo,{fontSize:"lg",fontWeight:"bold",children:u}),a.jsx(Zo,{children:l}),a.jsxs(Ss,{children:[a.jsx(at,{ref:x,onClick:b,children:s}),a.jsx(at,{colorScheme:"error",onClick:y,ml:3,children:r})]})]})})})]})}),kg=d.memo(rse),ose=({asIconButton:e,sx:t})=>{const{t:n}=Z(),{clearQueue:r,isLoading:o,isDisabled:s}=nse();return a.jsxs(kg,{title:n("queue.clearTooltip"),acceptCallback:r,acceptButtonText:n("queue.clear"),triggerComponent:a.jsx(ul,{isDisabled:s,isLoading:o,asIconButton:e,label:n("queue.clear"),tooltip:n("queue.clearTooltip"),icon:a.jsx(Br,{}),colorScheme:"error",sx:t}),children:[a.jsx(ve,{children:n("queue.clearQueueAlertDialog")}),a.jsx("br",{}),a.jsx(ve,{children:n("queue.clearQueueAlertDialog2")})]})},qy=d.memo(ose),sse=()=>{const e=te(),{t}=Z(),n=W(p=>p.system.isConnected),{data:r}=va(),[o,{isLoading:s}]=CI({fixedCacheKey:"pauseProcessor"}),i=d.useMemo(()=>!!(r!=null&&r.processor.is_started),[r==null?void 0:r.processor.is_started]),l=d.useCallback(async()=>{if(i)try{await o().unwrap(),e(ct({title:t("queue.pauseSucceeded"),status:"success"}))}catch{e(ct({title:t("queue.pauseFailed"),status:"error"}))}},[i,o,e,t]),u=d.useMemo(()=>!n||!i,[n,i]);return{pauseProcessor:l,isLoading:s,isStarted:i,isDisabled:u}},ase=({asIconButton:e})=>{const{t}=Z(),{pauseProcessor:n,isLoading:r,isDisabled:o}=sse();return a.jsx(ul,{asIconButton:e,label:t("queue.pause"),tooltip:t("queue.pauseTooltip"),isDisabled:o,isLoading:r,icon:a.jsx(QJ,{}),onClick:n,colorScheme:"gold"})},V8=d.memo(ase),ise=le([xe,Jn],({controlNet:e,generation:t,system:n,nodes:r,dynamicPrompts:o},s)=>{const{initialImage:i,model:l}=t,{isConnected:u}=n,p=[];return u||p.push(yt.t("parameters.invoke.systemDisconnected")),s==="img2img"&&!i&&p.push(yt.t("parameters.invoke.noInitialImageSelected")),s==="nodes"?r.shouldValidateGraph&&(r.nodes.length||p.push(yt.t("parameters.invoke.noNodesInGraph")),r.nodes.forEach(m=>{if(!Mn(m))return;const h=r.nodeTemplates[m.data.type];if(!h){p.push(yt.t("parameters.invoke.missingNodeTemplate"));return}const g=HD([m],r.edges);$n(m.data.inputs,x=>{const y=h.inputs[x.name],b=g.some(w=>w.target===m.id&&w.targetHandle===x.name);if(!y){p.push(yt.t("parameters.invoke.missingFieldTemplate"));return}if(y.required&&x.value===void 0&&!b){p.push(yt.t("parameters.invoke.missingInputForField",{nodeLabel:m.data.label||h.title,fieldLabel:x.label||y.title}));return}})})):(o.prompts.length===0&&p.push(yt.t("parameters.invoke.noPrompts")),l||p.push(yt.t("parameters.invoke.noModelSelected")),e.isEnabled&&nr(e.controlNets).forEach((m,h)=>{m.isEnabled&&(m.model||p.push(yt.t("parameters.invoke.noModelForControlNet",{index:h+1})),(!m.controlImage||!m.processedControlImage&&m.processorType!=="none")&&p.push(yt.t("parameters.invoke.noControlImageForControlNet",{index:h+1})))})),{isReady:!p.length,reasons:p}},Se),Xy=()=>{const{isReady:e,reasons:t}=W(ise);return{isReady:e,reasons:t}},W8=()=>{const e=te(),t=W(Jn),{isReady:n}=Xy(),[r,{isLoading:o}]=bh({fixedCacheKey:"enqueueBatch"}),s=d.useMemo(()=>!n,[n]);return{queueBack:d.useCallback(()=>{s||(e(eb()),e(wI({tabName:t,prepend:!1})))},[e,s,t]),isLoading:o,isDisabled:s}},lse=le([xe],({gallery:e})=>{const{autoAddBoardId:t}=e;return{autoAddBoardId:t}},Se),cse=({prepend:e=!1})=>{const{t}=Z(),{isReady:n,reasons:r}=Xy(),{autoAddBoardId:o}=W(lse),s=vg(o),[i,{isLoading:l}]=bh({fixedCacheKey:"enqueueBatch"}),u=d.useMemo(()=>t(l?"queue.enqueueing":n?e?"queue.queueFront":"queue.queueBack":"queue.notReady"),[l,n,e,t]);return a.jsxs(L,{flexDir:"column",gap:1,children:[a.jsx(ve,{fontWeight:600,children:u}),r.length>0&&a.jsx(Od,{children:r.map((p,m)=>a.jsx(Qr,{children:a.jsx(ve,{fontWeight:400,children:p})},`${p}.${m}`))}),a.jsx(G8,{}),a.jsxs(ve,{fontWeight:400,fontStyle:"oblique 10deg",children:["Adding images to"," ",a.jsx(ve,{as:"span",fontWeight:600,children:s||"Uncategorized"})]})]})},U8=d.memo(cse),G8=d.memo(()=>a.jsx(Yn,{opacity:.2,borderColor:"base.50",_dark:{borderColor:"base.900"}}));G8.displayName="StyledDivider";const use=()=>a.jsx(Ie,{pos:"relative",w:4,h:4,children:a.jsx(ga,{src:Hx,alt:"invoke-ai-logo",pos:"absolute",top:-.5,insetInlineStart:-.5,w:5,h:5,minW:5,minH:5,filter:"saturate(0)"})}),dse=d.memo(use),fse=({asIconButton:e,sx:t})=>{const{t:n}=Z(),{queueBack:r,isLoading:o,isDisabled:s}=W8();return a.jsx(ul,{asIconButton:e,colorScheme:"accent",label:n("parameters.invoke.invoke"),isDisabled:s,isLoading:o,onClick:r,tooltip:a.jsx(U8,{}),sx:t,icon:e?a.jsx(dse,{}):void 0})},K8=d.memo(fse),q8=()=>{const e=te(),t=W(Jn),{isReady:n}=Xy(),[r,{isLoading:o}]=bh({fixedCacheKey:"enqueueBatch"}),s=Bt("prependQueue").isFeatureEnabled,i=d.useMemo(()=>!n||!s,[n,s]);return{queueFront:d.useCallback(()=>{i||(e(eb()),e(wI({tabName:t,prepend:!0})))},[e,i,t]),isLoading:o,isDisabled:i}},pse=({asIconButton:e,sx:t})=>{const{t:n}=Z(),{queueFront:r,isLoading:o,isDisabled:s}=q8();return a.jsx(ul,{asIconButton:e,colorScheme:"base",label:n("queue.queueFront"),isDisabled:s,isLoading:o,onClick:r,tooltip:a.jsx(U8,{prepend:!0}),icon:a.jsx(goe,{}),sx:t})},mse=d.memo(pse),hse=()=>{const e=te(),t=W(p=>p.system.isConnected),{data:n}=va(),{t:r}=Z(),[o,{isLoading:s}]=SI({fixedCacheKey:"resumeProcessor"}),i=d.useMemo(()=>!!(n!=null&&n.processor.is_started),[n==null?void 0:n.processor.is_started]),l=d.useCallback(async()=>{if(!i)try{await o().unwrap(),e(ct({title:r("queue.resumeSucceeded"),status:"success"}))}catch{e(ct({title:r("queue.resumeFailed"),status:"error"}))}},[i,o,e,r]),u=d.useMemo(()=>!t||i,[t,i]);return{resumeProcessor:l,isLoading:s,isStarted:i,isDisabled:u}},gse=({asIconButton:e})=>{const{t}=Z(),{resumeProcessor:n,isLoading:r,isDisabled:o}=hse();return a.jsx(ul,{asIconButton:e,label:t("queue.resume"),tooltip:t("queue.resumeTooltip"),isDisabled:o,isLoading:r,icon:a.jsx(YJ,{}),onClick:n,colorScheme:"green"})},X8=d.memo(gse),vse=le(xe,({system:e})=>{var t;return{isConnected:e.isConnected,hasSteps:!!e.denoiseProgress,value:(((t=e.denoiseProgress)==null?void 0:t.percentage)??0)*100}},Se),xse=()=>{const{t:e}=Z(),{data:t}=va(),{hasSteps:n,value:r,isConnected:o}=W(vse);return a.jsx(K3,{value:r,"aria-label":e("accessibility.invokeProgressBar"),isIndeterminate:o&&!!(t!=null&&t.queue.in_progress)&&!n,h:"full",w:"full",borderRadius:2,colorScheme:"accent"})},bse=d.memo(xse),yse=()=>{const e=Bt("pauseQueue").isFeatureEnabled,t=Bt("resumeQueue").isFeatureEnabled,n=Bt("prependQueue").isFeatureEnabled;return a.jsxs(L,{layerStyle:"first",sx:{w:"full",position:"relative",borderRadius:"base",p:2,gap:2,flexDir:"column"},children:[a.jsxs(L,{gap:2,w:"full",children:[a.jsxs(Vt,{isAttached:!0,flexGrow:2,children:[a.jsx(K8,{}),n?a.jsx(mse,{asIconButton:!0}):a.jsx(a.Fragment,{}),a.jsx(H8,{asIconButton:!0})]}),a.jsxs(Vt,{isAttached:!0,children:[t?a.jsx(X8,{asIconButton:!0}):a.jsx(a.Fragment,{}),e?a.jsx(V8,{asIconButton:!0}):a.jsx(a.Fragment,{})]}),a.jsx(qy,{asIconButton:!0})]}),a.jsx(L,{h:3,w:"full",children:a.jsx(bse,{})}),a.jsx(Y8,{})]})},Q8=d.memo(yse),Y8=d.memo(()=>{const{t:e}=Z(),t=te(),{hasItems:n,pending:r}=va(void 0,{selectFromResult:({data:s})=>{if(!s)return{hasItems:!1,pending:0};const{pending:i,in_progress:l}=s.queue;return{hasItems:i+l>0,pending:i}}}),o=d.useCallback(()=>{t(Xs("queue"))},[t]);return a.jsxs(L,{justifyContent:"space-between",alignItems:"center",pe:1,"data-testid":"queue-count",children:[a.jsx(ba,{}),a.jsx(Za,{onClick:o,size:"sm",variant:"link",fontWeight:400,opacity:.7,fontStyle:"oblique 10deg",children:n?e("queue.queuedCount",{pending:r}):e("queue.queueEmpty")})]})});Y8.displayName="QueueCounts";const{createElement:Ec,createContext:Cse,forwardRef:Z8,useCallback:Gs,useContext:J8,useEffect:oa,useImperativeHandle:eO,useLayoutEffect:wse,useMemo:Sse,useRef:Kr,useState:Wu}=Fx,Uj=Fx["useId".toString()],Uu=wse,kse=typeof Uj=="function"?Uj:()=>null;let jse=0;function Qy(e=null){const t=kse(),n=Kr(e||t||null);return n.current===null&&(n.current=""+jse++),n.current}const jg=Cse(null);jg.displayName="PanelGroupContext";function tO({children:e=null,className:t="",collapsedSize:n=0,collapsible:r=!1,defaultSize:o=null,forwardedRef:s,id:i=null,maxSize:l=null,minSize:u,onCollapse:p=null,onResize:m=null,order:h=null,style:g={},tagName:x="div"}){const y=J8(jg);if(y===null)throw Error("Panel components must be rendered within a PanelGroup container");const b=Qy(i),{collapsePanel:w,expandPanel:S,getPanelSize:j,getPanelStyle:_,registerPanel:E,resizePanel:I,units:M,unregisterPanel:R}=y;u==null&&(M==="percentages"?u=10:u=0);const D=Kr({onCollapse:p,onResize:m});oa(()=>{D.current.onCollapse=p,D.current.onResize=m});const A=_(b,o),O=Kr({size:Gj(A)}),T=Kr({callbacksRef:D,collapsedSize:n,collapsible:r,defaultSize:o,id:b,idWasAutoGenerated:i==null,maxSize:l,minSize:u,order:h});return Uu(()=>{O.current.size=Gj(A),T.current.callbacksRef=D,T.current.collapsedSize=n,T.current.collapsible=r,T.current.defaultSize=o,T.current.id=b,T.current.idWasAutoGenerated=i==null,T.current.maxSize=l,T.current.minSize=u,T.current.order=h}),Uu(()=>(E(b,T),()=>{R(b)}),[h,b,E,R]),eO(s,()=>({collapse:()=>w(b),expand:()=>S(b),getCollapsed(){return O.current.size===0},getId(){return b},getSize(X){return j(b,X)},resize:(X,B)=>I(b,X,B)}),[w,S,j,b,I]),Ec(x,{children:e,className:t,"data-panel":"","data-panel-collapsible":r||void 0,"data-panel-id":b,"data-panel-size":parseFloat(""+A.flexGrow).toFixed(1),id:`data-panel-id-${b}`,style:{...A,...g}})}const Qa=Z8((e,t)=>Ec(tO,{...e,forwardedRef:t}));tO.displayName="Panel";Qa.displayName="forwardRef(Panel)";function Gj(e){const{flexGrow:t}=e;return typeof t=="string"?parseFloat(t):t}const Ji=10;function Du(e,t,n,r,o,s,i,l){const{id:u,panels:p,units:m}=t,h=m==="pixels"?Ha(u):NaN,{sizes:g}=l||{},x=g||s,y=Or(p),b=x.concat();let w=0;{const _=o<0?r:n,E=y.findIndex(D=>D.current.id===_),I=y[E],M=x[E],R=Cx(m,h,I,M,M+Math.abs(o),e);if(M===R)return x;R===0&&M>0&&i.set(_,M),o=o<0?M-R:R-M}let S=o<0?n:r,j=y.findIndex(_=>_.current.id===S);for(;;){const _=y[j],E=x[j],I=Math.abs(o)-Math.abs(w),M=Cx(m,h,_,E,E-I,e);if(E!==M&&(M===0&&E>0&&i.set(_.current.id,E),w+=E-M,b[j]=M,w.toPrecision(Ji).localeCompare(Math.abs(o).toPrecision(Ji),void 0,{numeric:!0})>=0))break;if(o<0){if(--j<0)break}else if(++j>=y.length)break}return w===0?x:(S=o<0?r:n,j=y.findIndex(_=>_.current.id===S),b[j]=x[j]+w,b)}function Fl(e,t,n){t.forEach((r,o)=>{const s=e[o];if(!s)return;const{callbacksRef:i,collapsedSize:l,collapsible:u,id:p}=s.current,m=n[p];if(m!==r){n[p]=r;const{onCollapse:h,onResize:g}=i.current;g&&g(r,m),u&&h&&((m==null||m===l)&&r!==l?h(!1):m!==l&&r===l&&h(!0))}})}function _se({groupId:e,panels:t,units:n}){const r=n==="pixels"?Ha(e):NaN,o=Or(t),s=Array(o.length);let i=0,l=100;for(let u=0;ui.current.id===e);if(n<0)return[null,null];const r=n===t.length-1,o=r?t[n-1].current.id:e,s=r?e:t[n+1].current.id;return[o,s]}function Ha(e){const t=md(e);if(t==null)return NaN;const n=t.getAttribute("data-panel-group-direction"),r=Yy(e);return n==="horizontal"?t.offsetWidth-r.reduce((o,s)=>o+s.offsetWidth,0):t.offsetHeight-r.reduce((o,s)=>o+s.offsetHeight,0)}function nO(e,t,n){if(e.size===1)return"100";const o=Or(e).findIndex(i=>i.current.id===t),s=n[o];return s==null?"0":s.toPrecision(Ji)}function Ise(e){const t=document.querySelector(`[data-panel-id="${e}"]`);return t||null}function md(e){const t=document.querySelector(`[data-panel-group-id="${e}"]`);return t||null}function _g(e){const t=document.querySelector(`[data-panel-resize-handle-id="${e}"]`);return t||null}function Pse(e){return rO().findIndex(r=>r.getAttribute("data-panel-resize-handle-id")===e)??null}function rO(){return Array.from(document.querySelectorAll("[data-panel-resize-handle-id]"))}function Yy(e){return Array.from(document.querySelectorAll(`[data-panel-resize-handle-id][data-panel-group-id="${e}"]`))}function Zy(e,t,n){var u,p,m,h;const r=_g(t),o=Yy(e),s=r?o.indexOf(r):-1,i=((p=(u=n[s])==null?void 0:u.current)==null?void 0:p.id)??null,l=((h=(m=n[s+1])==null?void 0:m.current)==null?void 0:h.id)??null;return[i,l]}function Or(e){return Array.from(e.values()).sort((t,n)=>{const r=t.current.order,o=n.current.order;return r==null&&o==null?0:r==null?-1:o==null?1:r-o})}function Cx(e,t,n,r,o,s=null){var m;let{collapsedSize:i,collapsible:l,maxSize:u,minSize:p}=n.current;if(e==="pixels"&&(i=i/t*100,u!=null&&(u=u/t*100),p=p/t*100),l){if(r>i){if(o<=p/2+i)return i}else if(!((m=s==null?void 0:s.type)==null?void 0:m.startsWith("key"))&&o100)&&(t.current.minSize=0),o!=null&&(o<0||e==="percentages"&&o>100)&&(t.current.maxSize=null),r!==null&&(r<0||e==="percentages"&&r>100?t.current.defaultSize=null:ro&&(t.current.defaultSize=o))}function Gv({groupId:e,panels:t,nextSizes:n,prevSizes:r,units:o}){n=[...n];const s=Or(t),i=o==="pixels"?Ha(e):NaN;let l=0;for(let u=0;u{const{direction:i,panels:l}=e.current,u=md(t);oO(u!=null,`No group found for id "${t}"`);const{height:p,width:m}=u.getBoundingClientRect(),g=Yy(t).map(x=>{const y=x.getAttribute("data-panel-resize-handle-id"),b=Or(l),[w,S]=Zy(t,y,b);if(w==null||S==null)return()=>{};let j=0,_=100,E=0,I=0;b.forEach(T=>{const{id:X,maxSize:B,minSize:V}=T.current;X===w?(j=V,_=B??100):(E+=V,I+=B??100)});const M=Math.min(_,100-E),R=Math.max(j,(b.length-1)*100-I),D=nO(l,w,o);x.setAttribute("aria-valuemax",""+Math.round(M)),x.setAttribute("aria-valuemin",""+Math.round(R)),x.setAttribute("aria-valuenow",""+Math.round(parseInt(D)));const A=T=>{if(!T.defaultPrevented)switch(T.key){case"Enter":{T.preventDefault();const X=b.findIndex(B=>B.current.id===w);if(X>=0){const B=b[X],V=o[X];if(V!=null){let U=0;V.toPrecision(Ji)<=B.current.minSize.toPrecision(Ji)?U=i==="horizontal"?m:p:U=-(i==="horizontal"?m:p);const N=Du(T,e.current,w,S,U,o,s.current,null);o!==N&&r(N)}}break}}};x.addEventListener("keydown",A);const O=Ise(w);return O!=null&&x.setAttribute("aria-controls",O.id),()=>{x.removeAttribute("aria-valuemax"),x.removeAttribute("aria-valuemin"),x.removeAttribute("aria-valuenow"),x.removeEventListener("keydown",A),O!=null&&x.removeAttribute("aria-controls")}});return()=>{g.forEach(x=>x())}},[e,t,n,s,r,o])}function Ose({disabled:e,handleId:t,resizeHandler:n}){oa(()=>{if(e||n==null)return;const r=_g(t);if(r==null)return;const o=s=>{if(!s.defaultPrevented)switch(s.key){case"ArrowDown":case"ArrowLeft":case"ArrowRight":case"ArrowUp":case"End":case"Home":{s.preventDefault(),n(s);break}case"F6":{s.preventDefault();const i=rO(),l=Pse(t);oO(l!==null);const u=s.shiftKey?l>0?l-1:i.length-1:l+1{r.removeEventListener("keydown",o)}},[e,t,n])}function Kv(e,t){if(e.length!==t.length)return!1;for(let n=0;nR.current.id===E),M=r[I];if(M.current.collapsible){const R=m[I];(R===0||R.toPrecision(Ji)===M.current.minSize.toPrecision(Ji))&&(S=S<0?-M.current.minSize*y:M.current.minSize*y)}return S}else return sO(e,n,o,l,u)}function Dse(e){return e.type==="keydown"}function wx(e){return e.type.startsWith("mouse")}function Sx(e){return e.type.startsWith("touch")}let kx=null,Mi=null;function aO(e){switch(e){case"horizontal":return"ew-resize";case"horizontal-max":return"w-resize";case"horizontal-min":return"e-resize";case"vertical":return"ns-resize";case"vertical-max":return"n-resize";case"vertical-min":return"s-resize"}}function Ase(){Mi!==null&&(document.head.removeChild(Mi),kx=null,Mi=null)}function qv(e){if(kx===e)return;kx=e;const t=aO(e);Mi===null&&(Mi=document.createElement("style"),document.head.appendChild(Mi)),Mi.innerHTML=`*{cursor: ${t}!important;}`}function Tse(e,t=10){let n=null;return(...o)=>{n!==null&&clearTimeout(n),n=setTimeout(()=>{e(...o)},t)}}function iO(e){return e.map(t=>{const{minSize:n,order:r}=t.current;return r?`${r}:${n}`:`${n}`}).sort((t,n)=>t.localeCompare(n)).join(",")}function lO(e,t){try{const n=t.getItem(`PanelGroup:sizes:${e}`);if(n){const r=JSON.parse(n);if(typeof r=="object"&&r!=null)return r}}catch{}return null}function Nse(e,t,n){const r=lO(e,n);if(r){const o=iO(t);return r[o]??null}return null}function $se(e,t,n,r){const o=iO(t),s=lO(e,r)||{};s[o]=n;try{r.setItem(`PanelGroup:sizes:${e}`,JSON.stringify(s))}catch(i){console.error(i)}}const Xv={};function Kj(e){try{if(typeof localStorage<"u")e.getItem=t=>localStorage.getItem(t),e.setItem=(t,n)=>{localStorage.setItem(t,n)};else throw new Error("localStorage not supported in this environment")}catch(t){console.error(t),e.getItem=()=>null,e.setItem=()=>{}}}const Au={getItem:e=>(Kj(Au),Au.getItem(e)),setItem:(e,t)=>{Kj(Au),Au.setItem(e,t)}};function cO({autoSaveId:e,children:t=null,className:n="",direction:r,disablePointerEventsDuringResize:o=!1,forwardedRef:s,id:i=null,onLayout:l,storage:u=Au,style:p={},tagName:m="div",units:h="percentages"}){const g=Qy(i),[x,y]=Wu(null),[b,w]=Wu(new Map),S=Kr(null);Kr({didLogDefaultSizeWarning:!1,didLogIdAndOrderWarning:!1,didLogInvalidLayoutWarning:!1,prevPanelIds:[]});const j=Kr({onLayout:l});oa(()=>{j.current.onLayout=l});const _=Kr({}),[E,I]=Wu([]),M=Kr(new Map),R=Kr(0),D=Kr({direction:r,id:g,panels:b,sizes:E,units:h});eO(s,()=>({getId:()=>g,getLayout:F=>{const{sizes:Q,units:Y}=D.current;if((F??Y)==="pixels"){const ae=Ha(g);return Q.map(re=>re/100*ae)}else return Q},setLayout:(F,Q)=>{const{id:Y,panels:se,sizes:ae,units:re}=D.current;if((Q||re)==="pixels"){const ce=Ha(Y);F=F.map(J=>J/ce*100)}const G=_.current,K=Or(se),ee=Gv({groupId:Y,panels:se,nextSizes:F,prevSizes:ae,units:re});Kv(ae,ee)||(I(ee),Fl(K,ee,G))}}),[g]),Uu(()=>{D.current.direction=r,D.current.id=g,D.current.panels=b,D.current.sizes=E,D.current.units=h}),Mse({committedValuesRef:D,groupId:g,panels:b,setSizes:I,sizes:E,panelSizeBeforeCollapse:M}),oa(()=>{const{onLayout:F}=j.current,{panels:Q,sizes:Y}=D.current;if(Y.length>0){F&&F(Y);const se=_.current,ae=Or(Q);Fl(ae,Y,se)}},[E]),Uu(()=>{const{id:F,sizes:Q,units:Y}=D.current;if(Q.length===b.size)return;let se=null;if(e){const ae=Or(b);se=Nse(e,ae,u)}if(se!=null){const ae=Gv({groupId:F,panels:b,nextSizes:se,prevSizes:se,units:Y});I(ae)}else{const ae=_se({groupId:F,panels:b,units:Y});I(ae)}},[e,b,u]),oa(()=>{if(e){if(E.length===0||E.length!==b.size)return;const F=Or(b);Xv[e]||(Xv[e]=Tse($se,100)),Xv[e](e,F,E,u)}},[e,b,E,u]),Uu(()=>{if(h==="pixels"){const F=new ResizeObserver(()=>{const{panels:Q,sizes:Y}=D.current,se=Gv({groupId:g,panels:Q,nextSizes:Y,prevSizes:Y,units:h});Kv(Y,se)||I(se)});return F.observe(md(g)),()=>{F.disconnect()}}},[g,h]);const A=Gs((F,Q)=>{const{panels:Y,units:se}=D.current,re=Or(Y).findIndex(ee=>ee.current.id===F),G=E[re];if((Q??se)==="pixels"){const ee=Ha(g);return G/100*ee}else return G},[g,E]),O=Gs((F,Q)=>{const{panels:Y}=D.current;return Y.size===0?{flexBasis:0,flexGrow:Q??void 0,flexShrink:1,overflow:"hidden"}:{flexBasis:0,flexGrow:nO(Y,F,E),flexShrink:1,overflow:"hidden",pointerEvents:o&&x!==null?"none":void 0}},[x,o,E]),T=Gs((F,Q)=>{const{units:Y}=D.current;Ese(Y,Q),w(se=>{if(se.has(F))return se;const ae=new Map(se);return ae.set(F,Q),ae})},[]),X=Gs(F=>Y=>{Y.preventDefault();const{direction:se,panels:ae,sizes:re}=D.current,G=Or(ae),[K,ee]=Zy(g,F,G);if(K==null||ee==null)return;let ce=Rse(Y,g,F,G,se,re,S.current);if(ce===0)return;const ie=md(g).getBoundingClientRect(),de=se==="horizontal";document.dir==="rtl"&&de&&(ce=-ce);const ge=de?ie.width:ie.height,Ce=ce/ge*100,he=Du(Y,D.current,K,ee,Ce,re,M.current,S.current),fe=!Kv(re,he);if((wx(Y)||Sx(Y))&&R.current!=Ce&&qv(fe?de?"horizontal":"vertical":de?ce<0?"horizontal-min":"horizontal-max":ce<0?"vertical-min":"vertical-max"),fe){const Oe=_.current;I(he),Fl(G,he,Oe)}R.current=Ce},[g]),B=Gs(F=>{w(Q=>{if(!Q.has(F))return Q;const Y=new Map(Q);return Y.delete(F),Y})},[]),V=Gs(F=>{const{panels:Q,sizes:Y}=D.current,se=Q.get(F);if(se==null)return;const{collapsedSize:ae,collapsible:re}=se.current;if(!re)return;const G=Or(Q),K=G.indexOf(se);if(K<0)return;const ee=Y[K];if(ee===ae)return;M.current.set(F,ee);const[ce,J]=Uv(F,G);if(ce==null||J==null)return;const de=K===G.length-1?ee:ae-ee,ge=Du(null,D.current,ce,J,de,Y,M.current,null);if(Y!==ge){const Ce=_.current;I(ge),Fl(G,ge,Ce)}},[]),U=Gs(F=>{const{panels:Q,sizes:Y}=D.current,se=Q.get(F);if(se==null)return;const{collapsedSize:ae,minSize:re}=se.current,G=M.current.get(F)||re;if(!G)return;const K=Or(Q),ee=K.indexOf(se);if(ee<0||Y[ee]!==ae)return;const[J,ie]=Uv(F,K);if(J==null||ie==null)return;const ge=ee===K.length-1?ae-G:G,Ce=Du(null,D.current,J,ie,ge,Y,M.current,null);if(Y!==Ce){const he=_.current;I(Ce),Fl(K,Ce,he)}},[]),N=Gs((F,Q,Y)=>{const{id:se,panels:ae,sizes:re,units:G}=D.current;if((Y||G)==="pixels"){const nt=Ha(se);Q=Q/nt*100}const K=ae.get(F);if(K==null)return;let{collapsedSize:ee,collapsible:ce,maxSize:J,minSize:ie}=K.current;if(G==="pixels"){const nt=Ha(se);ie=ie/nt*100,J!=null&&(J=J/nt*100)}const de=Or(ae),ge=de.indexOf(K);if(ge<0)return;const Ce=re[ge];if(Ce===Q)return;ce&&Q===ee||(Q=Math.min(J??100,Math.max(ie,Q)));const[he,fe]=Uv(F,de);if(he==null||fe==null)return;const _e=ge===de.length-1?Ce-Q:Q-Ce,Ne=Du(null,D.current,he,fe,_e,re,M.current,null);if(re!==Ne){const nt=_.current;I(Ne),Fl(de,Ne,nt)}},[]),$=Sse(()=>({activeHandleId:x,collapsePanel:V,direction:r,expandPanel:U,getPanelSize:A,getPanelStyle:O,groupId:g,registerPanel:T,registerResizeHandle:X,resizePanel:N,startDragging:(F,Q)=>{if(y(F),wx(Q)||Sx(Q)){const Y=_g(F);S.current={dragHandleRect:Y.getBoundingClientRect(),dragOffset:sO(Q,F,r),sizes:D.current.sizes}}},stopDragging:()=>{Ase(),y(null),S.current=null},units:h,unregisterPanel:B}),[x,V,r,U,A,O,g,T,X,N,h,B]),q={display:"flex",flexDirection:r==="horizontal"?"row":"column",height:"100%",overflow:"hidden",width:"100%"};return Ec(jg.Provider,{children:Ec(m,{children:t,className:n,"data-panel-group":"","data-panel-group-direction":r,"data-panel-group-id":g,"data-panel-group-units":h,style:{...q,...p}}),value:$})}const Ig=Z8((e,t)=>Ec(cO,{...e,forwardedRef:t}));cO.displayName="PanelGroup";Ig.displayName="forwardRef(PanelGroup)";function jx({children:e=null,className:t="",disabled:n=!1,id:r=null,onDragging:o,style:s={},tagName:i="div"}){const l=Kr(null),u=Kr({onDragging:o});oa(()=>{u.current.onDragging=o});const p=J8(jg);if(p===null)throw Error("PanelResizeHandle components must be rendered within a PanelGroup container");const{activeHandleId:m,direction:h,groupId:g,registerResizeHandle:x,startDragging:y,stopDragging:b}=p,w=Qy(r),S=m===w,[j,_]=Wu(!1),[E,I]=Wu(null),M=Gs(()=>{l.current.blur(),b();const{onDragging:A}=u.current;A&&A(!1)},[b]);oa(()=>{if(n)I(null);else{const D=x(w);I(()=>D)}},[n,w,x]),oa(()=>{if(n||E==null||!S)return;const D=X=>{E(X)},A=X=>{E(X)},T=l.current.ownerDocument;return T.body.addEventListener("contextmenu",M),T.body.addEventListener("mousemove",D),T.body.addEventListener("touchmove",D),T.body.addEventListener("mouseleave",A),window.addEventListener("mouseup",M),window.addEventListener("touchend",M),()=>{T.body.removeEventListener("contextmenu",M),T.body.removeEventListener("mousemove",D),T.body.removeEventListener("touchmove",D),T.body.removeEventListener("mouseleave",A),window.removeEventListener("mouseup",M),window.removeEventListener("touchend",M)}},[h,n,S,E,M]),Ose({disabled:n,handleId:w,resizeHandler:E});const R={cursor:aO(h),touchAction:"none",userSelect:"none"};return Ec(i,{children:e,className:t,"data-resize-handle-active":S?"pointer":j?"keyboard":void 0,"data-panel-group-direction":h,"data-panel-group-id":g,"data-panel-resize-handle-enabled":!n,"data-panel-resize-handle-id":w,onBlur:()=>_(!1),onFocus:()=>_(!0),onMouseDown:D=>{y(w,D.nativeEvent);const{onDragging:A}=u.current;A&&A(!0)},onMouseUp:M,onTouchCancel:M,onTouchEnd:M,onTouchStart:D=>{y(w,D.nativeEvent);const{onDragging:A}=u.current;A&&A(!0)},ref:l,role:"separator",style:{...R,...s},tabIndex:0})}jx.displayName="PanelResizeHandle";const Lse=e=>{const{direction:t="horizontal",collapsedDirection:n,isCollapsed:r=!1,...o}=e,s=sa("base.100","base.850"),i=sa("base.300","base.700");return t==="horizontal"?a.jsx(jx,{style:{visibility:r?"hidden":"visible",width:r?0:"auto"},children:a.jsx(L,{className:"resize-handle-horizontal",sx:{w:n?2.5:4,h:"full",justifyContent:n?n==="left"?"flex-start":"flex-end":"center",alignItems:"center",div:{bg:s},_hover:{div:{bg:i}}},...o,children:a.jsx(Ie,{sx:{w:1,h:"calc(100% - 1rem)",borderRadius:"base",transitionProperty:"common",transitionDuration:"normal"}})})}):a.jsx(jx,{style:{visibility:r?"hidden":"visible",width:r?0:"auto"},children:a.jsx(L,{className:"resize-handle-vertical",sx:{w:"full",h:n?2.5:4,alignItems:n?n==="top"?"flex-start":"flex-end":"center",justifyContent:"center",div:{bg:s},_hover:{div:{bg:i}}},...o,children:a.jsx(Ie,{sx:{h:1,w:"calc(100% - 1rem)",borderRadius:"base",transitionProperty:"common",transitionDuration:"normal"}})})})},lh=d.memo(Lse),Jy=()=>{const e=te(),t=W(o=>o.ui.panels),n=d.useCallback(o=>t[o]??"",[t]),r=d.useCallback((o,s)=>{e(VD({name:o,value:s}))},[e]);return{getItem:n,setItem:r}};const zse=e=>{const{label:t,data:n,fileName:r,withDownload:o=!0,withCopy:s=!0}=e,i=d.useMemo(()=>WD(n)?n:JSON.stringify(n,null,2),[n]),l=d.useCallback(()=>{navigator.clipboard.writeText(i)},[i]),u=d.useCallback(()=>{const m=new Blob([i]),h=document.createElement("a");h.href=URL.createObjectURL(m),h.download=`${r||t}.json`,document.body.appendChild(h),h.click(),h.remove()},[i,t,r]),{t:p}=Z();return a.jsxs(L,{layerStyle:"second",sx:{borderRadius:"base",flexGrow:1,w:"full",h:"full",position:"relative"},children:[a.jsx(Ie,{sx:{position:"absolute",top:0,left:0,right:0,bottom:0,overflow:"auto",p:4,fontSize:"sm"},children:a.jsx(hg,{defer:!0,style:{height:"100%",width:"100%"},options:{scrollbars:{visibility:"auto",autoHide:"scroll",autoHideDelay:1300,theme:"os-theme-dark"}},children:a.jsx("pre",{children:i})})}),a.jsxs(L,{sx:{position:"absolute",top:0,insetInlineEnd:0,p:2},children:[o&&a.jsx(Ht,{label:`${p("gallery.download")} ${t} JSON`,children:a.jsx(ys,{"aria-label":`${p("gallery.download")} ${t} JSON`,icon:a.jsx(ig,{}),variant:"ghost",opacity:.7,onClick:u})}),s&&a.jsx(Ht,{label:`${p("gallery.copy")} ${t} JSON`,children:a.jsx(ys,{"aria-label":`${p("gallery.copy")} ${t} JSON`,icon:a.jsx(Hc,{}),variant:"ghost",opacity:.7,onClick:l})})]})]})},Ya=d.memo(zse),Fse=le(xe,({nodes:e})=>{const t=e.selectedNodes[e.selectedNodes.length-1],n=e.nodes.find(r=>r.id===t);return{data:n==null?void 0:n.data}},Se),Bse=()=>{const{data:e}=W(Fse);return e?a.jsx(Ya,{data:e,label:"Node Data"}):a.jsx(Zn,{label:"No node selected",icon:null})},Hse=d.memo(Bse),Vse=({children:e,maxHeight:t})=>a.jsx(L,{sx:{w:"full",h:"full",maxHeight:t,position:"relative"},children:a.jsx(Ie,{sx:{position:"absolute",top:0,left:0,right:0,bottom:0},children:a.jsx(hg,{defer:!0,style:{height:"100%",width:"100%"},options:{scrollbars:{visibility:"auto",autoHide:"scroll",autoHideDelay:1300,theme:"os-theme-dark"},overflow:{x:"hidden"}},children:e})})}),Zd=d.memo(Vse),Wse=({output:e})=>{const{image:t}=e,{data:n}=to(t.image_name);return a.jsx(ua,{imageDTO:n})},Use=d.memo(Wse),Gse=le(xe,({nodes:e})=>{const t=e.selectedNodes[e.selectedNodes.length-1],n=e.nodes.find(s=>s.id===t),r=n?e.nodeTemplates[n.data.type]:void 0,o=e.nodeExecutionStates[t??"__UNKNOWN_NODE__"];return{node:n,template:r,nes:o}},Se),Kse=()=>{const{node:e,template:t,nes:n}=W(Gse),{t:r}=Z();return!e||!n||!Mn(e)?a.jsx(Zn,{label:r("nodes.noNodeSelected"),icon:null}):n.outputs.length===0?a.jsx(Zn,{label:r("nodes.noOutputRecorded"),icon:null}):a.jsx(Ie,{sx:{position:"relative",w:"full",h:"full"},children:a.jsx(Zd,{children:a.jsx(L,{sx:{position:"relative",flexDir:"column",alignItems:"flex-start",p:1,gap:2,h:"full",w:"full"},children:(t==null?void 0:t.outputType)==="image_output"?n.outputs.map((o,s)=>a.jsx(Use,{output:o},Xse(o,s))):a.jsx(Ya,{data:n.outputs,label:r("nodes.nodeOutputs")})})})})},qse=d.memo(Kse),Xse=(e,t)=>`${e.type}-${t}`,Qse=le(xe,({nodes:e})=>{const t=e.selectedNodes[e.selectedNodes.length-1],n=e.nodes.find(o=>o.id===t);return{template:n?e.nodeTemplates[n.data.type]:void 0}},Se),Yse=()=>{const{template:e}=W(Qse),{t}=Z();return e?a.jsx(Ya,{data:e,label:t("nodes.nodeTemplate")}):a.jsx(Zn,{label:t("nodes.noNodeSelected"),icon:null})},Zse=d.memo(Yse),Jse=()=>a.jsx(L,{layerStyle:"first",sx:{flexDir:"column",w:"full",h:"full",borderRadius:"base",p:2,gap:2},children:a.jsxs(rl,{variant:"line",sx:{display:"flex",flexDir:"column",w:"full",h:"full"},children:[a.jsxs(ol,{children:[a.jsx(Tr,{children:"Outputs"}),a.jsx(Tr,{children:"Data"}),a.jsx(Tr,{children:"Template"})]}),a.jsxs(zc,{children:[a.jsx(So,{children:a.jsx(qse,{})}),a.jsx(So,{children:a.jsx(Hse,{})}),a.jsx(So,{children:a.jsx(Zse,{})})]})]})}),eae=d.memo(Jse),e2=e=>{e.stopPropagation()},tae={display:"flex",flexDirection:"row",alignItems:"center",gap:10},nae=e=>{const{label:t="",labelPos:n="top",isDisabled:r=!1,isInvalid:o,formControlProps:s,...i}=e,l=te(),u=d.useCallback(m=>{m.shiftKey&&l(Nr(!0))},[l]),p=d.useCallback(m=>{m.shiftKey||l(Nr(!1))},[l]);return a.jsxs(Kt,{isInvalid:o,isDisabled:r,...s,style:n==="side"?tae:void 0,children:[t!==""&&a.jsx(wn,{children:t}),a.jsx(Mh,{...i,onPaste:e2,onKeyDown:u,onKeyUp:p})]})},vo=d.memo(nae),rae=je((e,t)=>{const n=te(),r=d.useCallback(s=>{s.shiftKey&&n(Nr(!0))},[n]),o=d.useCallback(s=>{s.shiftKey||n(Nr(!1))},[n]);return a.jsx(fP,{ref:t,onPaste:e2,onKeyDown:r,onKeyUp:o,...e})}),da=d.memo(rae),oae=le(xe,({nodes:e})=>{const{author:t,name:n,description:r,tags:o,version:s,contact:i,notes:l}=e.workflow;return{name:n,author:t,description:r,tags:o,version:s,contact:i,notes:l}},Se),sae=()=>{const{author:e,name:t,description:n,tags:r,version:o,contact:s,notes:i}=W(oae),l=te(),u=d.useCallback(w=>{l(UD(w.target.value))},[l]),p=d.useCallback(w=>{l(GD(w.target.value))},[l]),m=d.useCallback(w=>{l(KD(w.target.value))},[l]),h=d.useCallback(w=>{l(qD(w.target.value))},[l]),g=d.useCallback(w=>{l(XD(w.target.value))},[l]),x=d.useCallback(w=>{l(QD(w.target.value))},[l]),y=d.useCallback(w=>{l(YD(w.target.value))},[l]),{t:b}=Z();return a.jsx(Zd,{children:a.jsxs(L,{sx:{flexDir:"column",alignItems:"flex-start",gap:2,h:"full"},children:[a.jsxs(L,{sx:{gap:2,w:"full"},children:[a.jsx(vo,{label:b("nodes.workflowName"),value:t,onChange:u}),a.jsx(vo,{label:b("nodes.workflowVersion"),value:o,onChange:h})]}),a.jsxs(L,{sx:{gap:2,w:"full"},children:[a.jsx(vo,{label:b("nodes.workflowAuthor"),value:e,onChange:p}),a.jsx(vo,{label:b("nodes.workflowContact"),value:s,onChange:m})]}),a.jsx(vo,{label:b("nodes.workflowTags"),value:r,onChange:x}),a.jsxs(Kt,{as:L,sx:{flexDir:"column"},children:[a.jsx(wn,{children:b("nodes.workflowDescription")}),a.jsx(da,{onChange:g,value:n,fontSize:"sm",sx:{resize:"none"}})]}),a.jsxs(Kt,{as:L,sx:{flexDir:"column",h:"full"},children:[a.jsx(wn,{children:b("nodes.workflowNotes")}),a.jsx(da,{onChange:y,value:i,fontSize:"sm",sx:{h:"full",resize:"none"}})]})]})})},aae=d.memo(sae);function iae(e,t,n){var r=this,o=d.useRef(null),s=d.useRef(0),i=d.useRef(null),l=d.useRef([]),u=d.useRef(),p=d.useRef(),m=d.useRef(e),h=d.useRef(!0);d.useEffect(function(){m.current=e},[e]);var g=!t&&t!==0&&typeof window<"u";if(typeof e!="function")throw new TypeError("Expected a function");t=+t||0;var x=!!(n=n||{}).leading,y=!("trailing"in n)||!!n.trailing,b="maxWait"in n,w=b?Math.max(+n.maxWait||0,t):null;d.useEffect(function(){return h.current=!0,function(){h.current=!1}},[]);var S=d.useMemo(function(){var j=function(D){var A=l.current,O=u.current;return l.current=u.current=null,s.current=D,p.current=m.current.apply(O,A)},_=function(D,A){g&&cancelAnimationFrame(i.current),i.current=g?requestAnimationFrame(D):setTimeout(D,A)},E=function(D){if(!h.current)return!1;var A=D-o.current;return!o.current||A>=t||A<0||b&&D-s.current>=w},I=function(D){return i.current=null,y&&l.current?j(D):(l.current=u.current=null,p.current)},M=function D(){var A=Date.now();if(E(A))return I(A);if(h.current){var O=t-(A-o.current),T=b?Math.min(O,w-(A-s.current)):O;_(D,T)}},R=function(){var D=Date.now(),A=E(D);if(l.current=[].slice.call(arguments),u.current=r,o.current=D,A){if(!i.current&&h.current)return s.current=o.current,_(M,t),x?j(o.current):p.current;if(b)return _(M,t),j(o.current)}return i.current||_(M,t),p.current};return R.cancel=function(){i.current&&(g?cancelAnimationFrame(i.current):clearTimeout(i.current)),s.current=0,l.current=o.current=u.current=i.current=null},R.isPending=function(){return!!i.current},R.flush=function(){return i.current?I(Date.now()):p.current},R},[x,b,t,w,y,g]);return S}function lae(e,t){return e===t}function qj(e){return typeof e=="function"?function(){return e}:e}function cae(e,t,n){var r,o,s=n&&n.equalityFn||lae,i=(r=d.useState(qj(e)),o=r[1],[r[0],d.useCallback(function(h){return o(qj(h))},[])]),l=i[0],u=i[1],p=iae(d.useCallback(function(h){return u(h)},[u]),t,n),m=d.useRef(e);return s(m.current,e)||(p(e),m.current=e),[l,p]}const uO=()=>{const e=W(r=>r.nodes),[t]=cae(e,300);return d.useMemo(()=>ZD(t),[t])},uae=()=>{const e=uO(),{t}=Z();return a.jsx(L,{sx:{flexDir:"column",alignItems:"flex-start",gap:2,h:"full"},children:a.jsx(Ya,{data:e,label:t("nodes.workflow")})})},dae=d.memo(uae),fae=({isSelected:e,isHovered:t})=>{const n=d.useMemo(()=>{if(e&&t)return"nodeHoveredSelected.light";if(e)return"nodeSelected.light";if(t)return"nodeHovered.light"},[t,e]),r=d.useMemo(()=>{if(e&&t)return"nodeHoveredSelected.dark";if(e)return"nodeSelected.dark";if(t)return"nodeHovered.dark"},[t,e]);return a.jsx(Ie,{className:"selection-box",sx:{position:"absolute",top:0,insetInlineEnd:0,bottom:0,insetInlineStart:0,borderRadius:"base",opacity:e||t?1:.5,transitionProperty:"common",transitionDuration:"0.1s",pointerEvents:"none",shadow:n,_dark:{shadow:r}}})},dO=d.memo(fae),fO=e=>{const t=te(),n=d.useMemo(()=>le(xe,({nodes:i})=>i.mouseOverNode===e,Se),[e]),r=W(n),o=d.useCallback(()=>{!r&&t(hw(e))},[t,e,r]),s=d.useCallback(()=>{r&&t(hw(null))},[t,r]);return{isMouseOverNode:r,handleMouseOver:o,handleMouseOut:s}},pO=(e,t)=>{const n=d.useMemo(()=>le(xe,({nodes:o})=>{var i;const s=o.nodes.find(l=>l.id===e);if(Mn(s))return(i=s==null?void 0:s.data.inputs[t])==null?void 0:i.label},Se),[t,e]);return W(n)},mO=(e,t,n)=>{const r=d.useMemo(()=>le(xe,({nodes:s})=>{var u;const i=s.nodes.find(p=>p.id===e);if(!Mn(i))return;const l=s.nodeTemplates[(i==null?void 0:i.data.type)??""];return(u=l==null?void 0:l[tb[n]][t])==null?void 0:u.title},Se),[t,n,e]);return W(r)},hO=(e,t)=>{const n=d.useMemo(()=>le(xe,({nodes:o})=>{const s=o.nodes.find(i=>i.id===e);if(Mn(s))return s==null?void 0:s.data.inputs[t]},Se),[t,e]);return W(n)},Pg=(e,t,n)=>{const r=d.useMemo(()=>le(xe,({nodes:s})=>{const i=s.nodes.find(u=>u.id===e);if(!Mn(i))return;const l=s.nodeTemplates[(i==null?void 0:i.data.type)??""];return l==null?void 0:l[tb[n]][t]},Se),[t,n,e]);return W(r)},pae=({nodeId:e,fieldName:t,kind:n})=>{const r=hO(e,t),o=Pg(e,t,n),s=JD(o),{t:i}=Z(),l=d.useMemo(()=>eA(r)?r.label&&(o!=null&&o.title)?`${r.label} (${o.title})`:r.label&&!o?r.label:!r.label&&o?o.title:i("nodes.unknownField"):(o==null?void 0:o.title)||i("nodes.unknownField"),[r,o,i]);return a.jsxs(L,{sx:{flexDir:"column"},children:[a.jsx(ve,{sx:{fontWeight:600},children:l}),o&&a.jsx(ve,{sx:{opacity:.7,fontStyle:"oblique 5deg"},children:o.description}),o&&a.jsxs(ve,{children:["Type: ",wd[o.type].title]}),s&&a.jsxs(ve,{children:["Input: ",tA(o.input)]})]})},t2=d.memo(pae),mae=je((e,t)=>{const{nodeId:n,fieldName:r,kind:o,isMissingInput:s=!1,withTooltip:i=!1}=e,l=pO(n,r),u=mO(n,r,o),{t:p}=Z(),m=te(),[h,g]=d.useState(l||u||p("nodes.unknownField")),x=d.useCallback(async b=>{b&&(b===l||b===u)||(g(b||u||p("nodes.unknownField")),m(nA({nodeId:n,fieldName:r,label:b})))},[l,u,m,n,r,p]),y=d.useCallback(b=>{g(b)},[]);return d.useEffect(()=>{g(l||u||p("nodes.unknownField"))},[l,u,p]),a.jsx(Ht,{label:i?a.jsx(t2,{nodeId:n,fieldName:r,kind:"input"}):void 0,openDelay:yh,placement:"top",hasArrow:!0,children:a.jsx(L,{ref:t,sx:{position:"relative",overflow:"hidden",alignItems:"center",justifyContent:"flex-start",gap:1,h:"full"},children:a.jsxs(Ih,{value:h,onChange:y,onSubmit:x,as:L,sx:{position:"relative",alignItems:"center",h:"full"},children:[a.jsx(_h,{sx:{p:0,fontWeight:s?600:400,textAlign:"left",_hover:{fontWeight:"600 !important"}},noOfLines:1}),a.jsx(jh,{className:"nodrag",sx:{p:0,w:"full",fontWeight:600,color:"base.900",_dark:{color:"base.100"},_focusVisible:{p:0,textAlign:"left",boxShadow:"none"}}}),a.jsx(vO,{})]})})})}),gO=d.memo(mae),vO=d.memo(()=>{const{isEditing:e,getEditButtonProps:t}=C5(),n=d.useCallback(r=>{const{onClick:o}=t();o&&(o(r),r.preventDefault())},[t]);return e?null:a.jsx(L,{onClick:n,position:"absolute",w:"full",h:"full",top:0,insetInlineStart:0,cursor:"text"})});vO.displayName="EditableControls";const hae=e=>{const{nodeId:t,field:n}=e,r=te(),o=d.useCallback(s=>{r(rA({nodeId:t,fieldName:n.name,value:s.target.checked}))},[r,n.name,t]);return a.jsx(qb,{className:"nodrag",onChange:o,isChecked:n.value})},gae=d.memo(hae);function Eg(){return(Eg=Object.assign||function(e){for(var t=1;t=0||(o[n]=e[n]);return o}function _x(e){var t=d.useRef(e),n=d.useRef(function(r){t.current&&t.current(r)});return t.current=e,n.current}var Mc=function(e,t,n){return t===void 0&&(t=0),n===void 0&&(n=1),e>n?n:e0:w.buttons>0)&&o.current?s(Xj(o.current,w,l.current)):b(!1)},y=function(){return b(!1)};function b(w){var S=u.current,j=Ix(o.current),_=w?j.addEventListener:j.removeEventListener;_(S?"touchmove":"mousemove",x),_(S?"touchend":"mouseup",y)}return[function(w){var S=w.nativeEvent,j=o.current;if(j&&(Qj(S),!function(E,I){return I&&!Gu(E)}(S,u.current)&&j)){if(Gu(S)){u.current=!0;var _=S.changedTouches||[];_.length&&(l.current=_[0].identifier)}j.focus(),s(Xj(j,S,l.current)),b(!0)}},function(w){var S=w.which||w.keyCode;S<37||S>40||(w.preventDefault(),i({left:S===39?.05:S===37?-.05:0,top:S===40?.05:S===38?-.05:0}))},b]},[i,s]),m=p[0],h=p[1],g=p[2];return d.useEffect(function(){return g},[g]),H.createElement("div",Eg({},r,{onTouchStart:m,onMouseDown:m,className:"react-colorful__interactive",ref:o,onKeyDown:h,tabIndex:0,role:"slider"}))}),Mg=function(e){return e.filter(Boolean).join(" ")},r2=function(e){var t=e.color,n=e.left,r=e.top,o=r===void 0?.5:r,s=Mg(["react-colorful__pointer",e.className]);return H.createElement("div",{className:s,style:{top:100*o+"%",left:100*n+"%"}},H.createElement("div",{className:"react-colorful__pointer-fill",style:{backgroundColor:t}}))},Cr=function(e,t,n){return t===void 0&&(t=0),n===void 0&&(n=Math.pow(10,t)),Math.round(n*e)/n},bO=function(e){var t=e.s,n=e.v,r=e.a,o=(200-t)*n/100;return{h:Cr(e.h),s:Cr(o>0&&o<200?t*n/100/(o<=100?o:200-o)*100:0),l:Cr(o/2),a:Cr(r,2)}},Px=function(e){var t=bO(e);return"hsl("+t.h+", "+t.s+"%, "+t.l+"%)"},Qv=function(e){var t=bO(e);return"hsla("+t.h+", "+t.s+"%, "+t.l+"%, "+t.a+")"},vae=function(e){var t=e.h,n=e.s,r=e.v,o=e.a;t=t/360*6,n/=100,r/=100;var s=Math.floor(t),i=r*(1-n),l=r*(1-(t-s)*n),u=r*(1-(1-t+s)*n),p=s%6;return{r:Cr(255*[r,l,i,i,u,r][p]),g:Cr(255*[u,r,r,l,i,i][p]),b:Cr(255*[i,i,u,r,r,l][p]),a:Cr(o,2)}},xae=function(e){var t=e.r,n=e.g,r=e.b,o=e.a,s=Math.max(t,n,r),i=s-Math.min(t,n,r),l=i?s===t?(n-r)/i:s===n?2+(r-t)/i:4+(t-n)/i:0;return{h:Cr(60*(l<0?l+6:l)),s:Cr(s?i/s*100:0),v:Cr(s/255*100),a:o}},bae=H.memo(function(e){var t=e.hue,n=e.onChange,r=Mg(["react-colorful__hue",e.className]);return H.createElement("div",{className:r},H.createElement(n2,{onMove:function(o){n({h:360*o.left})},onKey:function(o){n({h:Mc(t+360*o.left,0,360)})},"aria-label":"Hue","aria-valuenow":Cr(t),"aria-valuemax":"360","aria-valuemin":"0"},H.createElement(r2,{className:"react-colorful__hue-pointer",left:t/360,color:Px({h:t,s:100,v:100,a:1})})))}),yae=H.memo(function(e){var t=e.hsva,n=e.onChange,r={backgroundColor:Px({h:t.h,s:100,v:100,a:1})};return H.createElement("div",{className:"react-colorful__saturation",style:r},H.createElement(n2,{onMove:function(o){n({s:100*o.left,v:100-100*o.top})},onKey:function(o){n({s:Mc(t.s+100*o.left,0,100),v:Mc(t.v-100*o.top,0,100)})},"aria-label":"Color","aria-valuetext":"Saturation "+Cr(t.s)+"%, Brightness "+Cr(t.v)+"%"},H.createElement(r2,{className:"react-colorful__saturation-pointer",top:1-t.v/100,left:t.s/100,color:Px(t)})))}),yO=function(e,t){if(e===t)return!0;for(var n in e)if(e[n]!==t[n])return!1;return!0};function Cae(e,t,n){var r=_x(n),o=d.useState(function(){return e.toHsva(t)}),s=o[0],i=o[1],l=d.useRef({color:t,hsva:s});d.useEffect(function(){if(!e.equal(t,l.current.color)){var p=e.toHsva(t);l.current={hsva:p,color:t},i(p)}},[t,e]),d.useEffect(function(){var p;yO(s,l.current.hsva)||e.equal(p=e.fromHsva(s),l.current.color)||(l.current={hsva:s,color:p},r(p))},[s,e,r]);var u=d.useCallback(function(p){i(function(m){return Object.assign({},m,p)})},[]);return[s,u]}var wae=typeof window<"u"?d.useLayoutEffect:d.useEffect,Sae=function(){return typeof __webpack_nonce__<"u"?__webpack_nonce__:void 0},Yj=new Map,kae=function(e){wae(function(){var t=e.current?e.current.ownerDocument:document;if(t!==void 0&&!Yj.has(t)){var n=t.createElement("style");n.innerHTML=`.react-colorful{position:relative;display:flex;flex-direction:column;width:200px;height:200px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;cursor:default}.react-colorful__saturation{position:relative;flex-grow:1;border-color:transparent;border-bottom:12px solid #000;border-radius:8px 8px 0 0;background-image:linear-gradient(0deg,#000,transparent),linear-gradient(90deg,#fff,hsla(0,0%,100%,0))}.react-colorful__alpha-gradient,.react-colorful__pointer-fill{content:"";position:absolute;left:0;top:0;right:0;bottom:0;pointer-events:none;border-radius:inherit}.react-colorful__alpha-gradient,.react-colorful__saturation{box-shadow:inset 0 0 0 1px rgba(0,0,0,.05)}.react-colorful__alpha,.react-colorful__hue{position:relative;height:24px}.react-colorful__hue{background:linear-gradient(90deg,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red)}.react-colorful__last-control{border-radius:0 0 8px 8px}.react-colorful__interactive{position:absolute;left:0;top:0;right:0;bottom:0;border-radius:inherit;outline:none;touch-action:none}.react-colorful__pointer{position:absolute;z-index:1;box-sizing:border-box;width:28px;height:28px;transform:translate(-50%,-50%);background-color:#fff;border:2px solid #fff;border-radius:50%;box-shadow:0 2px 4px rgba(0,0,0,.2)}.react-colorful__interactive:focus .react-colorful__pointer{transform:translate(-50%,-50%) scale(1.1)}.react-colorful__alpha,.react-colorful__alpha-pointer{background-color:#fff;background-image:url('data:image/svg+xml;charset=utf-8,')}.react-colorful__saturation-pointer{z-index:3}.react-colorful__hue-pointer{z-index:2}`,Yj.set(t,n);var r=Sae();r&&n.setAttribute("nonce",r),t.head.appendChild(n)}},[])},jae=function(e){var t=e.className,n=e.hsva,r=e.onChange,o={backgroundImage:"linear-gradient(90deg, "+Qv(Object.assign({},n,{a:0}))+", "+Qv(Object.assign({},n,{a:1}))+")"},s=Mg(["react-colorful__alpha",t]),i=Cr(100*n.a);return H.createElement("div",{className:s},H.createElement("div",{className:"react-colorful__alpha-gradient",style:o}),H.createElement(n2,{onMove:function(l){r({a:l.left})},onKey:function(l){r({a:Mc(n.a+l.left)})},"aria-label":"Alpha","aria-valuetext":i+"%","aria-valuenow":i,"aria-valuemin":"0","aria-valuemax":"100"},H.createElement(r2,{className:"react-colorful__alpha-pointer",left:n.a,color:Qv(n)})))},_ae=function(e){var t=e.className,n=e.colorModel,r=e.color,o=r===void 0?n.defaultColor:r,s=e.onChange,i=xO(e,["className","colorModel","color","onChange"]),l=d.useRef(null);kae(l);var u=Cae(n,o,s),p=u[0],m=u[1],h=Mg(["react-colorful",t]);return H.createElement("div",Eg({},i,{ref:l,className:h}),H.createElement(yae,{hsva:p,onChange:m}),H.createElement(bae,{hue:p.h,onChange:m}),H.createElement(jae,{hsva:p,onChange:m,className:"react-colorful__last-control"}))},Iae={defaultColor:{r:0,g:0,b:0,a:1},toHsva:xae,fromHsva:vae,equal:yO},CO=function(e){return H.createElement(_ae,Eg({},e,{colorModel:Iae}))};const Pae=e=>{const{nodeId:t,field:n}=e,r=te(),o=d.useCallback(s=>{r(oA({nodeId:t,fieldName:n.name,value:s}))},[r,n.name,t]);return a.jsx(CO,{className:"nodrag",color:n.value,onChange:o})},Eae=d.memo(Pae),wO=e=>{const t=el("models"),[n,r,o]=e.split("/"),s=sA.safeParse({base_model:n,model_name:o});if(!s.success){t.error({controlNetModelId:e,errors:s.error.format()},"Failed to parse ControlNet model id");return}return s.data},Mae=e=>{const{nodeId:t,field:n}=e,r=n.value,o=te(),{data:s}=gh(),i=d.useMemo(()=>(s==null?void 0:s.entities[`${r==null?void 0:r.base_model}/controlnet/${r==null?void 0:r.model_name}`])??null,[r==null?void 0:r.base_model,r==null?void 0:r.model_name,s==null?void 0:s.entities]),l=d.useMemo(()=>{if(!s)return[];const p=[];return $n(s.entities,(m,h)=>{m&&p.push({value:h,label:m.model_name,group:mn[m.base_model]})}),p},[s]),u=d.useCallback(p=>{if(!p)return;const m=wO(p);m&&o(aA({nodeId:t,fieldName:n.name,value:m}))},[o,n.name,t]);return a.jsx(On,{className:"nowheel nodrag",tooltip:i==null?void 0:i.description,value:(i==null?void 0:i.id)??null,placeholder:"Pick one",error:!i,data:l,onChange:u,sx:{width:"100%"}})},Oae=d.memo(Mae),Rae=e=>{const{nodeId:t,field:n,fieldTemplate:r}=e,o=te(),s=d.useCallback(i=>{o(iA({nodeId:t,fieldName:n.name,value:i.target.value}))},[o,n.name,t]);return a.jsx(Q3,{className:"nowheel nodrag",onChange:s,value:n.value,children:r.options.map(i=>a.jsx("option",{value:i,children:r.ui_choice_labels?r.ui_choice_labels[i]:i},i))})},Dae=d.memo(Rae),Aae=e=>{var p;const{nodeId:t,field:n}=e,r=te(),{currentData:o}=to(((p=n.value)==null?void 0:p.image_name)??$r.skipToken),s=d.useCallback(()=>{r(lA({nodeId:t,fieldName:n.name,value:void 0}))},[r,n.name,t]),i=d.useMemo(()=>{if(o)return{id:`node-${t}-${n.name}`,payloadType:"IMAGE_DTO",payload:{imageDTO:o}}},[n.name,o,t]),l=d.useMemo(()=>({id:`node-${t}-${n.name}`,actionType:"SET_NODES_IMAGE",context:{nodeId:t,fieldName:n.name}}),[n.name,t]),u=d.useMemo(()=>({type:"SET_NODES_IMAGE",nodeId:t,fieldName:n.name}),[t,n.name]);return a.jsx(L,{className:"nodrag",sx:{w:"full",h:"full",alignItems:"center",justifyContent:"center"},children:a.jsx(ua,{imageDTO:o,droppableData:l,draggableData:i,postUploadAction:u,useThumbailFallback:!0,uploadElement:a.jsx(SO,{}),dropLabel:a.jsx(kO,{}),minSize:8,children:a.jsx(Li,{onClick:s,icon:o?a.jsx(Ud,{}):void 0,tooltip:"Reset Image"})})})},Tae=d.memo(Aae),SO=d.memo(()=>a.jsx(ve,{fontSize:16,fontWeight:600,children:"Drop or Upload"}));SO.displayName="UploadElement";const kO=d.memo(()=>a.jsx(ve,{fontSize:16,fontWeight:600,children:"Drop"}));kO.displayName="DropLabel";const Nae=e=>{const t=el("models"),[n,r,o]=e.split("/"),s=cA.safeParse({base_model:n,model_name:o});if(!s.success){t.error({loraModelId:e,errors:s.error.format()},"Failed to parse LoRA model id");return}return s.data},$ae=e=>{const{nodeId:t,field:n}=e,r=n.value,o=te(),{data:s}=Cd(),{t:i}=Z(),l=d.useMemo(()=>{if(!s)return[];const m=[];return $n(s.entities,(h,g)=>{h&&m.push({value:g,label:h.model_name,group:mn[h.base_model]})}),m.sort((h,g)=>h.disabled&&!g.disabled?1:-1)},[s]),u=d.useMemo(()=>(s==null?void 0:s.entities[`${r==null?void 0:r.base_model}/lora/${r==null?void 0:r.model_name}`])??null,[s==null?void 0:s.entities,r==null?void 0:r.base_model,r==null?void 0:r.model_name]),p=d.useCallback(m=>{if(!m)return;const h=Nae(m);h&&o(uA({nodeId:t,fieldName:n.name,value:h}))},[o,n.name,t]);return(s==null?void 0:s.ids.length)===0?a.jsx(L,{sx:{justifyContent:"center",p:2},children:a.jsx(ve,{sx:{fontSize:"sm",color:"base.500",_dark:"base.700"},children:"No LoRAs Loaded"})}):a.jsx(nn,{className:"nowheel nodrag",value:(u==null?void 0:u.id)??null,placeholder:l.length>0?i("models.selectLoRA"):i("models.noLoRAsAvailable"),data:l,nothingFound:i("models.noMatchingLoRAs"),itemComponent:ci,disabled:l.length===0,filter:(m,h)=>{var g;return((g=h.label)==null?void 0:g.toLowerCase().includes(m.toLowerCase().trim()))||h.value.toLowerCase().includes(m.toLowerCase().trim())},error:!u,onChange:p,sx:{width:"100%",".mantine-Select-dropdown":{width:"16rem !important"}}})},Lae=d.memo($ae),Og=e=>{const t=el("models"),[n,r,o]=e.split("/"),s=dA.safeParse({base_model:n,model_name:o,model_type:r});if(!s.success){t.error({mainModelId:e,errors:s.error.format()},"Failed to parse main model id");return}return s.data};function Gc(e){const{iconMode:t=!1,...n}=e,r=te(),{t:o}=Z(),[s,{isLoading:i}]=fA(),l=()=>{s().unwrap().then(u=>{r(ct(Qt({title:`${o("modelManager.modelsSynced")}`,status:"success"})))}).catch(u=>{u&&r(ct(Qt({title:`${o("modelManager.modelSyncFailed")}`,status:"error"})))})};return t?a.jsx(Fe,{icon:a.jsx(bM,{}),tooltip:o("modelManager.syncModels"),"aria-label":o("modelManager.syncModels"),isLoading:i,onClick:l,size:"sm",...n}):a.jsx(at,{isLoading:i,onClick:l,minW:"max-content",...n,children:"Sync Models"})}const zae=e=>{var y,b;const{nodeId:t,field:n}=e,r=te(),o=Bt("syncModels").isFeatureEnabled,{t:s}=Z(),{data:i,isLoading:l}=Ku(gw),{data:u,isLoading:p}=Xo(gw),m=d.useMemo(()=>l||p,[l,p]),h=d.useMemo(()=>{if(!u)return[];const w=[];return $n(u.entities,(S,j)=>{S&&w.push({value:j,label:S.model_name,group:mn[S.base_model]})}),i&&$n(i.entities,(S,j)=>{S&&w.push({value:j,label:S.model_name,group:mn[S.base_model]})}),w},[u,i]),g=d.useMemo(()=>{var w,S,j,_;return((u==null?void 0:u.entities[`${(w=n.value)==null?void 0:w.base_model}/main/${(S=n.value)==null?void 0:S.model_name}`])||(i==null?void 0:i.entities[`${(j=n.value)==null?void 0:j.base_model}/onnx/${(_=n.value)==null?void 0:_.model_name}`]))??null},[(y=n.value)==null?void 0:y.base_model,(b=n.value)==null?void 0:b.model_name,u==null?void 0:u.entities,i==null?void 0:i.entities]),x=d.useCallback(w=>{if(!w)return;const S=Og(w);S&&r(kI({nodeId:t,fieldName:n.name,value:S}))},[r,n.name,t]);return a.jsxs(L,{sx:{w:"full",alignItems:"center",gap:2},children:[m?a.jsx(ve,{variant:"subtext",children:"Loading..."}):a.jsx(nn,{className:"nowheel nodrag",tooltip:g==null?void 0:g.description,value:g==null?void 0:g.id,placeholder:h.length>0?s("models.selectModel"):s("models.noModelsAvailable"),data:h,error:!g,disabled:h.length===0,onChange:x,sx:{width:"100%",".mantine-Select-dropdown":{width:"16rem !important"}}}),o&&a.jsx(Gc,{className:"nodrag",iconMode:!0})]})},Fae=d.memo(zae),ch=/^-?(0\.)?\.?$/,jO=je((e,t)=>{const{label:n,isDisabled:r=!1,showStepper:o=!0,isInvalid:s,value:i,onChange:l,min:u,max:p,isInteger:m=!0,formControlProps:h,formLabelProps:g,numberInputFieldProps:x,numberInputStepperProps:y,tooltipProps:b,...w}=e,S=te(),[j,_]=d.useState(String(i));d.useEffect(()=>{!j.match(ch)&&i!==Number(j)&&_(String(i))},[i,j]);const E=D=>{_(D),D.match(ch)||l(m?Math.floor(Number(D)):Number(D))},I=D=>{const A=Fi(m?Math.floor(Number(D.target.value)):Number(D.target.value),u,p);_(String(A)),l(A)},M=d.useCallback(D=>{D.shiftKey&&S(Nr(!0))},[S]),R=d.useCallback(D=>{D.shiftKey||S(Nr(!1))},[S]);return a.jsx(Ht,{...b,children:a.jsxs(Kt,{ref:t,isDisabled:r,isInvalid:s,...h,children:[n&&a.jsx(wn,{...g,children:n}),a.jsxs(Lh,{value:j,min:u,max:p,keepWithinRange:!0,clampValueOnBlur:!1,onChange:E,onBlur:I,...w,onPaste:e2,children:[a.jsx(Fh,{...x,onKeyDown:M,onKeyUp:R}),o&&a.jsxs(zh,{children:[a.jsx(Hh,{...y}),a.jsx(Bh,{...y})]})]})]})})});jO.displayName="IAINumberInput";const Kc=d.memo(jO),Bae=e=>{const{nodeId:t,field:n,fieldTemplate:r}=e,o=te(),[s,i]=d.useState(String(n.value)),l=d.useMemo(()=>r.type==="integer",[r.type]),u=p=>{i(p),p.match(ch)||o(pA({nodeId:t,fieldName:n.name,value:l?Math.floor(Number(p)):Number(p)}))};return d.useEffect(()=>{!s.match(ch)&&n.value!==Number(s)&&i(String(n.value))},[n.value,s]),a.jsxs(Lh,{onChange:u,value:s,step:l?1:.1,precision:l?0:3,children:[a.jsx(Fh,{className:"nodrag"}),a.jsxs(zh,{children:[a.jsx(Hh,{}),a.jsx(Bh,{})]})]})},Hae=d.memo(Bae),Vae=e=>{var h,g;const{nodeId:t,field:n}=e,r=te(),{t:o}=Z(),s=Bt("syncModels").isFeatureEnabled,{data:i,isLoading:l}=Xo(nb),u=d.useMemo(()=>{if(!i)return[];const x=[];return $n(i.entities,(y,b)=>{y&&x.push({value:b,label:y.model_name,group:mn[y.base_model]})}),x},[i]),p=d.useMemo(()=>{var x,y;return(i==null?void 0:i.entities[`${(x=n.value)==null?void 0:x.base_model}/main/${(y=n.value)==null?void 0:y.model_name}`])??null},[(h=n.value)==null?void 0:h.base_model,(g=n.value)==null?void 0:g.model_name,i==null?void 0:i.entities]),m=d.useCallback(x=>{if(!x)return;const y=Og(x);y&&r(mA({nodeId:t,fieldName:n.name,value:y}))},[r,n.name,t]);return l?a.jsx(nn,{label:o("modelManager.model"),placeholder:o("models.loading"),disabled:!0,data:[]}):a.jsxs(L,{w:"100%",alignItems:"center",gap:2,children:[a.jsx(nn,{className:"nowheel nodrag",tooltip:p==null?void 0:p.description,value:p==null?void 0:p.id,placeholder:u.length>0?o("models.selectModel"):o("models.noModelsAvailable"),data:u,error:!p,disabled:u.length===0,onChange:m,sx:{width:"100%",".mantine-Select-dropdown":{width:"16rem !important"}}}),s&&a.jsx(Gc,{className:"nodrag",iconMode:!0})]})},Wae=d.memo(Vae),Uae=e=>{var g,x;const{nodeId:t,field:n}=e,r=te(),{t:o}=Z(),s=Bt("syncModels").isFeatureEnabled,{data:i}=Ku(vw),{data:l,isLoading:u}=Xo(vw),p=d.useMemo(()=>{if(!l)return[];const y=[];return $n(l.entities,(b,w)=>{!b||b.base_model!=="sdxl"||y.push({value:w,label:b.model_name,group:mn[b.base_model]})}),i&&$n(i.entities,(b,w)=>{!b||b.base_model!=="sdxl"||y.push({value:w,label:b.model_name,group:mn[b.base_model]})}),y},[l,i]),m=d.useMemo(()=>{var y,b,w,S;return((l==null?void 0:l.entities[`${(y=n.value)==null?void 0:y.base_model}/main/${(b=n.value)==null?void 0:b.model_name}`])||(i==null?void 0:i.entities[`${(w=n.value)==null?void 0:w.base_model}/onnx/${(S=n.value)==null?void 0:S.model_name}`]))??null},[(g=n.value)==null?void 0:g.base_model,(x=n.value)==null?void 0:x.model_name,l==null?void 0:l.entities,i==null?void 0:i.entities]),h=d.useCallback(y=>{if(!y)return;const b=Og(y);b&&r(kI({nodeId:t,fieldName:n.name,value:b}))},[r,n.name,t]);return u?a.jsx(nn,{label:o("modelManager.model"),placeholder:o("models.loading"),disabled:!0,data:[]}):a.jsxs(L,{w:"100%",alignItems:"center",gap:2,children:[a.jsx(nn,{className:"nowheel nodrag",tooltip:m==null?void 0:m.description,value:m==null?void 0:m.id,placeholder:p.length>0?o("models.selectModel"):o("models.noModelsAvailable"),data:p,error:!m,disabled:p.length===0,onChange:h,sx:{width:"100%",".mantine-Select-dropdown":{width:"16rem !important"}}}),s&&a.jsx(Gc,{className:"nodrag",iconMode:!0})]})},Gae=d.memo(Uae),Kae=le([xe],({ui:e})=>{const{favoriteSchedulers:t}=e;return{data:nr(mh,(r,o)=>({value:o,label:r,group:t.includes(o)?"Favorites":void 0})).sort((r,o)=>r.label.localeCompare(o.label))}},Se),qae=e=>{const{nodeId:t,field:n}=e,r=te(),{data:o}=W(Kae),s=d.useCallback(i=>{i&&r(hA({nodeId:t,fieldName:n.name,value:i}))},[r,n.name,t]);return a.jsx(nn,{className:"nowheel nodrag",value:n.value,data:o,onChange:s})},Xae=d.memo(qae),Qae=e=>{const{nodeId:t,field:n,fieldTemplate:r}=e,o=te(),s=d.useCallback(i=>{o(gA({nodeId:t,fieldName:n.name,value:i.target.value}))},[o,n.name,t]);return r.ui_component==="textarea"?a.jsx(da,{className:"nodrag",onChange:s,value:n.value,rows:5,resize:"none"}):a.jsx(vo,{onChange:s,value:n.value})},Yae=d.memo(Qae),_O=e=>{const t=el("models"),[n,r,o]=e.split("/"),s=vA.safeParse({base_model:n,model_name:o});if(!s.success){t.error({vaeModelId:e,errors:s.error.format()},"Failed to parse VAE model id");return}return s.data},Zae=e=>{const{nodeId:t,field:n}=e,r=n.value,o=te(),{data:s}=jI(),i=d.useMemo(()=>{if(!s)return[];const p=[{value:"default",label:"Default",group:"Default"}];return $n(s.entities,(m,h)=>{m&&p.push({value:h,label:m.model_name,group:mn[m.base_model]})}),p.sort((m,h)=>m.disabled&&!h.disabled?1:-1)},[s]),l=d.useMemo(()=>(s==null?void 0:s.entities[`${r==null?void 0:r.base_model}/vae/${r==null?void 0:r.model_name}`])??null,[s==null?void 0:s.entities,r]),u=d.useCallback(p=>{if(!p)return;const m=_O(p);m&&o(xA({nodeId:t,fieldName:n.name,value:m}))},[o,n.name,t]);return a.jsx(nn,{className:"nowheel nodrag",itemComponent:ci,tooltip:l==null?void 0:l.description,value:(l==null?void 0:l.id)??"default",placeholder:"Default",data:i,onChange:u,disabled:i.length===0,error:!l,clearable:!0,sx:{width:"100%",".mantine-Select-dropdown":{width:"16rem !important"}}})},Jae=d.memo(Zae),IO=e=>{const t=el("models"),[n,r,o]=e.split("/"),s=bA.safeParse({base_model:n,model_name:o});if(!s.success){t.error({ipAdapterModelId:e,errors:s.error.format()},"Failed to parse IP-Adapter model id");return}return s.data},eie=e=>{const{nodeId:t,field:n}=e,r=n.value,o=te(),{data:s}=Vx(),i=d.useMemo(()=>(s==null?void 0:s.entities[`${r==null?void 0:r.base_model}/ip_adapter/${r==null?void 0:r.model_name}`])??null,[r==null?void 0:r.base_model,r==null?void 0:r.model_name,s==null?void 0:s.entities]),l=d.useMemo(()=>{if(!s)return[];const p=[];return $n(s.entities,(m,h)=>{m&&p.push({value:h,label:m.model_name,group:mn[m.base_model]})}),p},[s]),u=d.useCallback(p=>{if(!p)return;const m=IO(p);m&&o(yA({nodeId:t,fieldName:n.name,value:m}))},[o,n.name,t]);return a.jsx(On,{className:"nowheel nodrag",tooltip:i==null?void 0:i.description,value:(i==null?void 0:i.id)??null,placeholder:"Pick one",error:!i,data:l,onChange:u,sx:{width:"100%"}})},tie=d.memo(eie),nie=e=>{var l;const{nodeId:t,field:n}=e,r=te(),{data:o,hasBoards:s}=yd(void 0,{selectFromResult:({data:u})=>{const p=[{label:"None",value:"none"}];return u==null||u.forEach(({board_id:m,board_name:h})=>{p.push({label:h,value:m})}),{data:p,hasBoards:p.length>1}}}),i=d.useCallback(u=>{r(CA({nodeId:t,fieldName:n.name,value:u&&u!=="none"?{board_id:u}:void 0}))},[r,n.name,t]);return a.jsx(nn,{className:"nowheel nodrag",value:((l=n.value)==null?void 0:l.board_id)??"none",data:o,onChange:i,disabled:!s})},rie=d.memo(nie),oie=({nodeId:e,fieldName:t})=>{const n=hO(e,t),r=Pg(e,t,"input");return(r==null?void 0:r.fieldKind)==="output"?a.jsxs(Ie,{p:2,children:["Output field in input: ",n==null?void 0:n.type]}):(n==null?void 0:n.type)==="string"&&(r==null?void 0:r.type)==="string"||(n==null?void 0:n.type)==="StringPolymorphic"&&(r==null?void 0:r.type)==="StringPolymorphic"?a.jsx(Yae,{nodeId:e,field:n,fieldTemplate:r}):(n==null?void 0:n.type)==="boolean"&&(r==null?void 0:r.type)==="boolean"||(n==null?void 0:n.type)==="BooleanPolymorphic"&&(r==null?void 0:r.type)==="BooleanPolymorphic"?a.jsx(gae,{nodeId:e,field:n,fieldTemplate:r}):(n==null?void 0:n.type)==="integer"&&(r==null?void 0:r.type)==="integer"||(n==null?void 0:n.type)==="float"&&(r==null?void 0:r.type)==="float"||(n==null?void 0:n.type)==="FloatPolymorphic"&&(r==null?void 0:r.type)==="FloatPolymorphic"||(n==null?void 0:n.type)==="IntegerPolymorphic"&&(r==null?void 0:r.type)==="IntegerPolymorphic"?a.jsx(Hae,{nodeId:e,field:n,fieldTemplate:r}):(n==null?void 0:n.type)==="enum"&&(r==null?void 0:r.type)==="enum"?a.jsx(Dae,{nodeId:e,field:n,fieldTemplate:r}):(n==null?void 0:n.type)==="ImageField"&&(r==null?void 0:r.type)==="ImageField"||(n==null?void 0:n.type)==="ImagePolymorphic"&&(r==null?void 0:r.type)==="ImagePolymorphic"?a.jsx(Tae,{nodeId:e,field:n,fieldTemplate:r}):(n==null?void 0:n.type)==="BoardField"&&(r==null?void 0:r.type)==="BoardField"?a.jsx(rie,{nodeId:e,field:n,fieldTemplate:r}):(n==null?void 0:n.type)==="MainModelField"&&(r==null?void 0:r.type)==="MainModelField"?a.jsx(Fae,{nodeId:e,field:n,fieldTemplate:r}):(n==null?void 0:n.type)==="SDXLRefinerModelField"&&(r==null?void 0:r.type)==="SDXLRefinerModelField"?a.jsx(Wae,{nodeId:e,field:n,fieldTemplate:r}):(n==null?void 0:n.type)==="VaeModelField"&&(r==null?void 0:r.type)==="VaeModelField"?a.jsx(Jae,{nodeId:e,field:n,fieldTemplate:r}):(n==null?void 0:n.type)==="LoRAModelField"&&(r==null?void 0:r.type)==="LoRAModelField"?a.jsx(Lae,{nodeId:e,field:n,fieldTemplate:r}):(n==null?void 0:n.type)==="ControlNetModelField"&&(r==null?void 0:r.type)==="ControlNetModelField"?a.jsx(Oae,{nodeId:e,field:n,fieldTemplate:r}):(n==null?void 0:n.type)==="IPAdapterModelField"&&(r==null?void 0:r.type)==="IPAdapterModelField"?a.jsx(tie,{nodeId:e,field:n,fieldTemplate:r}):(n==null?void 0:n.type)==="ColorField"&&(r==null?void 0:r.type)==="ColorField"?a.jsx(Eae,{nodeId:e,field:n,fieldTemplate:r}):(n==null?void 0:n.type)==="SDXLMainModelField"&&(r==null?void 0:r.type)==="SDXLMainModelField"?a.jsx(Gae,{nodeId:e,field:n,fieldTemplate:r}):(n==null?void 0:n.type)==="Scheduler"&&(r==null?void 0:r.type)==="Scheduler"?a.jsx(Xae,{nodeId:e,field:n,fieldTemplate:r}):n&&r?null:a.jsx(Ie,{p:1,children:a.jsxs(ve,{sx:{fontSize:"sm",fontWeight:600,color:"error.400",_dark:{color:"error.300"}},children:["Unknown field type: ",n==null?void 0:n.type]})})},PO=d.memo(oie),sie=({nodeId:e,fieldName:t})=>{const n=te(),{isMouseOverNode:r,handleMouseOut:o,handleMouseOver:s}=fO(e),{t:i}=Z(),l=d.useCallback(()=>{n(_I({nodeId:e,fieldName:t}))},[n,t,e]);return a.jsxs(L,{onMouseEnter:s,onMouseLeave:o,layerStyle:"second",sx:{position:"relative",borderRadius:"base",w:"full",p:2},children:[a.jsxs(Kt,{as:L,sx:{flexDir:"column",gap:1,flexShrink:1},children:[a.jsxs(wn,{sx:{display:"flex",alignItems:"center",mb:0},children:[a.jsx(gO,{nodeId:e,fieldName:t,kind:"input"}),a.jsx(ba,{}),a.jsx(Ht,{label:a.jsx(t2,{nodeId:e,fieldName:t,kind:"input"}),openDelay:yh,placement:"top",hasArrow:!0,children:a.jsx(L,{h:"full",alignItems:"center",children:a.jsx(Tn,{as:fM})})}),a.jsx(Fe,{"aria-label":i("nodes.removeLinearView"),tooltip:i("nodes.removeLinearView"),variant:"ghost",size:"sm",onClick:l,icon:a.jsx(Br,{})})]}),a.jsx(PO,{nodeId:e,fieldName:t})]}),a.jsx(dO,{isSelected:!1,isHovered:r})]})},aie=d.memo(sie),iie=le(xe,({nodes:e})=>({fields:e.workflow.exposedFields}),Se),lie=()=>{const{fields:e}=W(iie),{t}=Z();return a.jsx(Ie,{sx:{position:"relative",w:"full",h:"full"},children:a.jsx(Zd,{children:a.jsx(L,{sx:{position:"relative",flexDir:"column",alignItems:"flex-start",p:1,gap:2,h:"full",w:"full"},children:e.length?e.map(({nodeId:n,fieldName:r})=>a.jsx(aie,{nodeId:n,fieldName:r},`${n}.${r}`)):a.jsx(Zn,{label:t("nodes.noFieldsLinearview"),icon:null})})})})},cie=d.memo(lie),uie=()=>a.jsx(L,{layerStyle:"first",sx:{flexDir:"column",w:"full",h:"full",borderRadius:"base",p:2,gap:2},children:a.jsxs(rl,{variant:"line",sx:{display:"flex",flexDir:"column",w:"full",h:"full"},children:[a.jsxs(ol,{children:[a.jsx(Tr,{children:"Linear"}),a.jsx(Tr,{children:"Details"}),a.jsx(Tr,{children:"JSON"})]}),a.jsxs(zc,{children:[a.jsx(So,{children:a.jsx(cie,{})}),a.jsx(So,{children:a.jsx(aae,{})}),a.jsx(So,{children:a.jsx(dae,{})})]})]})}),die=d.memo(uie),fie={paramNegativeConditioning:{placement:"right"},controlNet:{href:"https://support.invoke.ai/support/solutions/articles/151000105880"},lora:{href:"https://support.invoke.ai/support/solutions/articles/151000159072"},compositingCoherenceMode:{href:"https://support.invoke.ai/support/solutions/articles/151000158838"},infillMethod:{href:"https://support.invoke.ai/support/solutions/articles/151000158841"},scaleBeforeProcessing:{href:"https://support.invoke.ai/support/solutions/articles/151000158841"},paramIterations:{href:"https://support.invoke.ai/support/solutions/articles/151000159073"},paramPositiveConditioning:{href:"https://support.invoke.ai/support/solutions/articles/151000096606-tips-on-crafting-prompts",placement:"right"},paramScheduler:{placement:"right",href:"https://support.invoke.ai/support/solutions/articles/151000159073"},paramModel:{placement:"right",href:"https://support.invoke.ai/support/solutions/articles/151000096601-what-is-a-model-which-should-i-use-"},paramRatio:{gutter:16},controlNetControlMode:{placement:"right"},controlNetResizeMode:{placement:"right"},paramVAE:{placement:"right"},paramVAEPrecision:{placement:"right"}},pie=1e3,mie=[{name:"preventOverflow",options:{padding:10}}],EO=je(({feature:e,children:t,wrapperProps:n,...r},o)=>{const{t:s}=Z(),i=W(g=>g.system.shouldEnableInformationalPopovers),l=d.useMemo(()=>fie[e],[e]),u=d.useMemo(()=>wA(SA(l,["image","href","buttonLabel"]),r),[l,r]),p=d.useMemo(()=>s(`popovers.${e}.heading`),[e,s]),m=d.useMemo(()=>s(`popovers.${e}.paragraphs`,{returnObjects:!0})??[],[e,s]),h=d.useCallback(()=>{l!=null&&l.href&&window.open(l.href)},[l==null?void 0:l.href]);return i?a.jsxs(Ld,{isLazy:!0,closeOnBlur:!1,trigger:"hover",variant:"informational",openDelay:pie,modifiers:mie,placement:"top",...u,children:[a.jsx(Wh,{children:a.jsx(Ie,{ref:o,w:"full",...n,children:t})}),a.jsx(Ac,{children:a.jsxs(zd,{w:96,children:[a.jsx(V3,{}),a.jsx(Uh,{children:a.jsxs(L,{sx:{gap:2,flexDirection:"column",alignItems:"flex-start"},children:[p&&a.jsxs(a.Fragment,{children:[a.jsx(cr,{size:"sm",children:p}),a.jsx(Yn,{})]}),(l==null?void 0:l.image)&&a.jsxs(a.Fragment,{children:[a.jsx(ga,{sx:{objectFit:"contain",maxW:"60%",maxH:"60%",backgroundColor:"white"},src:l.image,alt:"Optional Image"}),a.jsx(Yn,{})]}),m.map(g=>a.jsx(ve,{children:g},g)),(l==null?void 0:l.href)&&a.jsxs(a.Fragment,{children:[a.jsx(Yn,{}),a.jsx(Za,{pt:1,onClick:h,leftIcon:a.jsx(py,{}),alignSelf:"flex-end",variant:"link",children:s("common.learnMore")??p})]})]})})]})})]}):a.jsx(Ie,{ref:o,w:"full",...n,children:t})});EO.displayName="IAIInformationalPopover";const Et=d.memo(EO),hie=le([xe],e=>{const{initial:t,min:n,sliderMax:r,inputMax:o,fineStep:s,coarseStep:i}=e.config.sd.iterations,{iterations:l}=e.generation,{shouldUseSliders:u}=e.ui,p=e.hotkeys.shift?s:i;return{iterations:l,initial:t,min:n,sliderMax:r,inputMax:o,step:p,shouldUseSliders:u}},Se),gie=({asSlider:e})=>{const{iterations:t,initial:n,min:r,sliderMax:o,inputMax:s,step:i,shouldUseSliders:l}=W(hie),u=te(),{t:p}=Z(),m=d.useCallback(g=>{u(xw(g))},[u]),h=d.useCallback(()=>{u(xw(n))},[u,n]);return e||l?a.jsx(Et,{feature:"paramIterations",children:a.jsx(tt,{label:p("parameters.iterations"),step:i,min:r,max:o,onChange:m,handleReset:h,value:t,withInput:!0,withReset:!0,withSliderMarks:!0,sliderNumberInputProps:{max:s}})}):a.jsx(Et,{feature:"paramIterations",children:a.jsx(Kc,{label:p("parameters.iterations"),step:i,min:r,max:s,onChange:m,value:t,numberInputFieldProps:{textAlign:"center"}})})},rs=d.memo(gie),vie=()=>{const[e,t]=d.useState(!1),[n,r]=d.useState(!1),o=d.useRef(null),s=Jy(),i=d.useCallback(()=>{o.current&&o.current.setLayout([50,50])},[]);return a.jsxs(L,{sx:{flexDir:"column",gap:2,height:"100%",width:"100%"},children:[a.jsx(Q8,{}),a.jsx(L,{layerStyle:"first",sx:{w:"full",position:"relative",borderRadius:"base",p:2,pb:3,gap:2,flexDir:"column"},children:a.jsx(rs,{asSlider:!0})}),a.jsxs(Ig,{ref:o,id:"workflow-panel-group",autoSaveId:"workflow-panel-group",direction:"vertical",style:{height:"100%",width:"100%"},storage:s,children:[a.jsx(Qa,{id:"workflow",collapsible:!0,onCollapse:t,minSize:25,children:a.jsx(die,{})}),a.jsx(lh,{direction:"vertical",onDoubleClick:i,collapsedDirection:e?"top":n?"bottom":void 0}),a.jsx(Qa,{id:"inspector",collapsible:!0,onCollapse:r,minSize:25,children:a.jsx(eae,{})})]})]})},xie=d.memo(vie),Zj=(e,t)=>{const n=d.useRef(null),[r,o]=d.useState(()=>{var p;return!!((p=n.current)!=null&&p.getCollapsed())}),s=d.useCallback(()=>{var p;(p=n.current)!=null&&p.getCollapsed()?qr.flushSync(()=>{var m;(m=n.current)==null||m.expand()}):qr.flushSync(()=>{var m;(m=n.current)==null||m.collapse()})},[]),i=d.useCallback(()=>{qr.flushSync(()=>{var p;(p=n.current)==null||p.expand()})},[]),l=d.useCallback(()=>{qr.flushSync(()=>{var p;(p=n.current)==null||p.collapse()})},[]),u=d.useCallback(()=>{qr.flushSync(()=>{var p;(p=n.current)==null||p.resize(e,t)})},[e,t]);return{ref:n,minSize:e,isCollapsed:r,setIsCollapsed:o,reset:u,toggle:s,expand:i,collapse:l}},bie=({isGalleryCollapsed:e,galleryPanelRef:t})=>{const{t:n}=Z(),r=()=>{var o;(o=t.current)==null||o.expand()};return e?a.jsx(Ac,{children:a.jsx(L,{pos:"absolute",transform:"translate(0, -50%)",minW:8,top:"50%",insetInlineEnd:"1.63rem",children:a.jsx(Fe,{tooltip:"Show Gallery (G)",tooltipProps:{placement:"top"},"aria-label":n("accessibility.showGalleryPanel"),onClick:r,icon:a.jsx(Soe,{}),sx:{p:0,px:3,h:48,borderEndRadius:0}})})}):null},yie=d.memo(bie),Op={borderStartRadius:0,flexGrow:1},Cie=({isSidePanelCollapsed:e,sidePanelRef:t})=>{const{t:n}=Z(),r=()=>{var o;(o=t.current)==null||o.expand()};return e?a.jsx(Ac,{children:a.jsxs(L,{pos:"absolute",transform:"translate(0, -50%)",minW:8,top:"50%",insetInlineStart:"5.13rem",direction:"column",gap:2,h:48,children:[a.jsxs(Vt,{isAttached:!0,orientation:"vertical",flexGrow:3,children:[a.jsx(Fe,{tooltip:n("parameters.showOptionsPanel"),"aria-label":n("parameters.showOptionsPanel"),onClick:r,sx:Op,icon:a.jsx(xM,{})}),a.jsx(K8,{asIconButton:!0,sx:Op}),a.jsx(H8,{asIconButton:!0,sx:Op})]}),a.jsx(qy,{asIconButton:!0,sx:Op})]})}):null},wie=d.memo(Cie),Sie=e=>{const{label:t,activeLabel:n,children:r,defaultIsOpen:o=!1}=e,{isOpen:s,onToggle:i}=Lr({defaultIsOpen:o}),{colorMode:l}=ha();return a.jsxs(Ie,{children:[a.jsxs(L,{onClick:i,sx:{alignItems:"center",p:2,px:4,gap:2,borderTopRadius:"base",borderBottomRadius:s?0:"base",bg:Ae("base.250","base.750")(l),color:Ae("base.900","base.100")(l),_hover:{bg:Ae("base.300","base.700")(l)},fontSize:"sm",fontWeight:600,cursor:"pointer",transitionProperty:"common",transitionDuration:"normal",userSelect:"none"},"data-testid":`${t} collapsible`,children:[t,a.jsx(dr,{children:n&&a.jsx(In.div,{initial:{opacity:0},animate:{opacity:1,transition:{duration:.1}},exit:{opacity:0,transition:{duration:.1}},children:a.jsx(ve,{sx:{color:"accent.500",_dark:{color:"accent.300"}},children:n})},"statusText")}),a.jsx(ba,{}),a.jsx(gg,{sx:{w:"1rem",h:"1rem",transform:s?"rotate(0deg)":"rotate(180deg)",transitionProperty:"common",transitionDuration:"normal"}})]}),a.jsx(Id,{in:s,animateOpacity:!0,style:{overflow:"unset"},children:a.jsx(Ie,{sx:{p:4,pb:4,borderBottomRadius:"base",bg:"base.150",_dark:{bg:"base.800"}},children:r})})]})},oo=d.memo(Sie),kie=le(xe,e=>{const{maxPrompts:t,combinatorial:n}=e.dynamicPrompts,{min:r,sliderMax:o,inputMax:s}=e.config.sd.dynamicPrompts.maxPrompts;return{maxPrompts:t,min:r,sliderMax:o,inputMax:s,isDisabled:!n}},Se),jie=()=>{const{maxPrompts:e,min:t,sliderMax:n,inputMax:r,isDisabled:o}=W(kie),s=te(),{t:i}=Z(),l=d.useCallback(p=>{s(kA(p))},[s]),u=d.useCallback(()=>{s(jA())},[s]);return a.jsx(Et,{feature:"dynamicPromptsMaxPrompts",children:a.jsx(tt,{label:i("dynamicPrompts.maxPrompts"),isDisabled:o,min:t,max:n,value:e,onChange:l,sliderNumberInputProps:{max:r},withSliderMarks:!0,withInput:!0,withReset:!0,handleReset:u})})},_ie=d.memo(jie),Iie=le(xe,e=>{const{isLoading:t,isError:n,prompts:r,parsingError:o}=e.dynamicPrompts;return{prompts:r,parsingError:o,isError:n,isLoading:t}},Se),Pie={"&::marker":{color:"base.500",_dark:{color:"base.500"}}},Eie=()=>{const{prompts:e,parsingError:t,isLoading:n,isError:r}=W(Iie);return r?a.jsx(Et,{feature:"dynamicPrompts",children:a.jsx(L,{w:"full",h:"full",layerStyle:"second",alignItems:"center",justifyContent:"center",p:8,children:a.jsx(Zn,{icon:voe,label:"Problem generating prompts"})})}):a.jsx(Et,{feature:"dynamicPrompts",children:a.jsxs(Kt,{isInvalid:!!t,children:[a.jsxs(wn,{whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",children:["Prompts Preview (",e.length,")",t&&` - ${t}`]}),a.jsxs(L,{h:64,pos:"relative",layerStyle:"third",borderRadius:"base",p:2,children:[a.jsx(Zd,{children:a.jsx(d3,{stylePosition:"inside",ms:0,children:e.map((o,s)=>a.jsx(Qr,{fontSize:"sm",sx:Pie,children:a.jsx(ve,{as:"span",children:o})},`${o}.${s}`))})}),n&&a.jsx(L,{pos:"absolute",w:"full",h:"full",top:0,insetInlineStart:0,layerStyle:"second",opacity:.7,alignItems:"center",justifyContent:"center",children:a.jsx(fa,{})})]})]})})},Mie=d.memo(Eie),MO=d.forwardRef(({label:e,description:t,...n},r)=>a.jsx(Ie,{ref:r,...n,children:a.jsxs(Ie,{children:[a.jsx(ve,{fontWeight:600,children:e}),t&&a.jsx(ve,{size:"xs",variant:"subtext",children:t})]})}));MO.displayName="IAIMantineSelectItemWithDescription";const Oie=d.memo(MO),Rie=()=>{const e=te(),{t}=Z(),n=W(s=>s.dynamicPrompts.seedBehaviour),r=d.useMemo(()=>[{value:"PER_ITERATION",label:t("dynamicPrompts.seedBehaviour.perIterationLabel"),description:t("dynamicPrompts.seedBehaviour.perIterationDesc")},{value:"PER_PROMPT",label:t("dynamicPrompts.seedBehaviour.perPromptLabel"),description:t("dynamicPrompts.seedBehaviour.perPromptDesc")}],[t]),o=d.useCallback(s=>{s&&e(_A(s))},[e]);return a.jsx(Et,{feature:"dynamicPromptsSeedBehaviour",children:a.jsx(On,{label:t("dynamicPrompts.seedBehaviour.label"),value:n,data:r,itemComponent:Oie,onChange:o})})},Die=d.memo(Rie),Aie=()=>{const{t:e}=Z(),t=d.useMemo(()=>le(xe,({dynamicPrompts:o})=>{const s=o.prompts.length;return s===1?e("dynamicPrompts.promptsWithCount_one",{count:s}):e("dynamicPrompts.promptsWithCount_other",{count:s})}),[e]),n=W(t);return Bt("dynamicPrompting").isFeatureEnabled?a.jsx(oo,{label:e("dynamicPrompts.dynamicPrompts"),activeLabel:n,children:a.jsxs(L,{sx:{gap:2,flexDir:"column"},children:[a.jsx(Mie,{}),a.jsx(Die,{}),a.jsx(_ie,{})]})}):null},qc=d.memo(Aie),Tie=e=>{const t=te(),{lora:n}=e,r=d.useCallback(i=>{t(IA({id:n.id,weight:i}))},[t,n.id]),o=d.useCallback(()=>{t(PA(n.id))},[t,n.id]),s=d.useCallback(()=>{t(EA(n.id))},[t,n.id]);return a.jsx(Et,{feature:"lora",children:a.jsxs(L,{sx:{gap:2.5,alignItems:"flex-end"},children:[a.jsx(tt,{label:n.model_name,value:n.weight,onChange:r,min:-1,max:2,step:.01,withInput:!0,withReset:!0,handleReset:o,withSliderMarks:!0,sliderMarks:[-1,0,1,2],sliderNumberInputProps:{min:-50,max:50}}),a.jsx(Fe,{size:"sm",onClick:s,tooltip:"Remove LoRA","aria-label":"Remove LoRA",icon:a.jsx(Br,{}),colorScheme:"error"})]})})},Nie=d.memo(Tie),$ie=le(xe,({lora:e})=>({lorasArray:nr(e.loras)}),Se),Lie=()=>{const{lorasArray:e}=W($ie);return a.jsx(a.Fragment,{children:e.map((t,n)=>a.jsxs(L,{sx:{flexDirection:"column",gap:2},children:[n>0&&a.jsx(Yn,{pt:1}),a.jsx(Nie,{lora:t})]},t.model_name))})},zie=d.memo(Lie),Fie=le(xe,({lora:e})=>({loras:e.loras}),Se),Bie=()=>{const e=te(),{loras:t}=W(Fie),{data:n}=Cd(),r=W(i=>i.generation.model),o=d.useMemo(()=>{if(!n)return[];const i=[];return $n(n.entities,(l,u)=>{if(!l||u in t)return;const p=(r==null?void 0:r.base_model)!==l.base_model;i.push({value:u,label:l.model_name,disabled:p,group:mn[l.base_model],tooltip:p?`Incompatible base model: ${l.base_model}`:void 0})}),i.sort((l,u)=>l.label&&!u.label?1:-1),i.sort((l,u)=>l.disabled&&!u.disabled?1:-1)},[t,n,r==null?void 0:r.base_model]),s=d.useCallback(i=>{if(!i)return;const l=n==null?void 0:n.entities[i];l&&e(MA(l))},[e,n==null?void 0:n.entities]);return(n==null?void 0:n.ids.length)===0?a.jsx(L,{sx:{justifyContent:"center",p:2},children:a.jsx(ve,{sx:{fontSize:"sm",color:"base.500",_dark:"base.700"},children:"No LoRAs Loaded"})}):a.jsx(nn,{placeholder:o.length===0?"All LoRAs added":"Add LoRA",value:null,data:o,nothingFound:"No matching LoRAs",itemComponent:ci,disabled:o.length===0,filter:(i,l)=>{var u;return((u=l.label)==null?void 0:u.toLowerCase().includes(i.toLowerCase().trim()))||l.value.toLowerCase().includes(i.toLowerCase().trim())},onChange:s,"data-testid":"add-lora"})},Hie=d.memo(Bie),Vie=le(xe,e=>{const t=II(e.lora.loras);return{activeLabel:t>0?`${t} Active`:void 0}},Se),Wie=()=>{const{activeLabel:e}=W(Vie);return Bt("lora").isFeatureEnabled?a.jsx(oo,{label:"LoRA",activeLabel:e,children:a.jsxs(L,{sx:{flexDir:"column",gap:2},children:[a.jsx(Hie,{}),a.jsx(zie,{})]})}):null},Xc=d.memo(Wie),Uie=()=>{const e=te(),t=W(o=>o.generation.shouldUseCpuNoise),{t:n}=Z(),r=d.useCallback(o=>{e(OA(o.target.checked))},[e]);return a.jsx(Et,{feature:"noiseUseCPU",children:a.jsx(dn,{label:n("parameters.useCpuNoise"),isChecked:t,onChange:r})})},os=e=>e.generation,Gie=le(os,e=>{const{seamlessXAxis:t}=e;return{seamlessXAxis:t}},Se),Kie=()=>{const{t:e}=Z(),{seamlessXAxis:t}=W(Gie),n=te(),r=d.useCallback(o=>{n(RA(o.target.checked))},[n]);return a.jsx(dn,{label:e("parameters.seamlessXAxis"),"aria-label":e("parameters.seamlessXAxis"),isChecked:t,onChange:r})},qie=d.memo(Kie),Xie=le(os,e=>{const{seamlessYAxis:t}=e;return{seamlessYAxis:t}},Se),Qie=()=>{const{t:e}=Z(),{seamlessYAxis:t}=W(Xie),n=te(),r=d.useCallback(o=>{n(DA(o.target.checked))},[n]);return a.jsx(dn,{label:e("parameters.seamlessYAxis"),"aria-label":e("parameters.seamlessYAxis"),isChecked:t,onChange:r})},Yie=d.memo(Qie),Zie=()=>{const{t:e}=Z();return Bt("seamless").isFeatureEnabled?a.jsxs(Kt,{children:[a.jsx(wn,{children:e("parameters.seamlessTiling")})," ",a.jsxs(L,{sx:{gap:5},children:[a.jsx(Ie,{flexGrow:1,children:a.jsx(qie,{})}),a.jsx(Ie,{flexGrow:1,children:a.jsx(Yie,{})})]})]}):null},Jie=d.memo(Zie);function ele(){const e=W(u=>u.generation.clipSkip),{model:t}=W(u=>u.generation),n=te(),{t:r}=Z(),o=d.useCallback(u=>{n(bw(u))},[n]),s=d.useCallback(()=>{n(bw(0))},[n]),i=d.useMemo(()=>t?Qf[t.base_model].maxClip:Qf["sd-1"].maxClip,[t]),l=d.useMemo(()=>t?Qf[t.base_model].markers:Qf["sd-1"].markers,[t]);return(t==null?void 0:t.base_model)==="sdxl"?null:a.jsx(Et,{feature:"clipSkip",placement:"top",children:a.jsx(tt,{label:r("parameters.clipSkip"),"aria-label":r("parameters.clipSkip"),min:0,max:i,step:1,value:e,onChange:o,withSliderMarks:!0,sliderMarks:l,withInput:!0,withReset:!0,handleReset:s})})}const tle=le(xe,e=>{const{clipSkip:t,model:n,seamlessXAxis:r,seamlessYAxis:o,shouldUseCpuNoise:s}=e.generation;return{clipSkip:t,model:n,seamlessXAxis:r,seamlessYAxis:o,shouldUseCpuNoise:s}},Se);function Qc(){const{clipSkip:e,model:t,seamlessXAxis:n,seamlessYAxis:r,shouldUseCpuNoise:o}=W(tle),{t:s}=Z(),i=d.useMemo(()=>{const l=[];return o?l.push(s("parameters.cpuNoise")):l.push(s("parameters.gpuNoise")),e>0&&t&&t.base_model!=="sdxl"&&l.push(s("parameters.clipSkipWithLayerCount",{layerCount:e})),n&&r?l.push(s("parameters.seamlessX&Y")):n?l.push(s("parameters.seamlessX")):r&&l.push(s("parameters.seamlessY")),l.join(", ")},[e,t,n,r,o,s]);return a.jsx(oo,{label:s("common.advanced"),activeLabel:i,children:a.jsxs(L,{sx:{flexDir:"column",gap:2},children:[a.jsx(Jie,{}),a.jsx(Yn,{}),t&&(t==null?void 0:t.base_model)!=="sdxl"&&a.jsxs(a.Fragment,{children:[a.jsx(ele,{}),a.jsx(Yn,{pt:2})]}),a.jsx(Uie,{})]})})}const nle=le(xe,({generation:e})=>{const{model:t}=e;return{mainModel:t}},Se),rle=e=>{const{controlNetId:t,model:n,isEnabled:r}=e.controlNet,o=te(),{mainModel:s}=W(nle),{t:i}=Z(),{data:l}=gh(),u=d.useMemo(()=>{if(!l)return[];const h=[];return $n(l.entities,(g,x)=>{if(!g)return;const y=(g==null?void 0:g.base_model)!==(s==null?void 0:s.base_model);h.push({value:x,label:g.model_name,group:mn[g.base_model],disabled:y,tooltip:y?`${i("controlnet.incompatibleBaseModel")} ${g.base_model}`:void 0})}),h},[l,s==null?void 0:s.base_model,i]),p=d.useMemo(()=>(l==null?void 0:l.entities[`${n==null?void 0:n.base_model}/controlnet/${n==null?void 0:n.model_name}`])??null,[n==null?void 0:n.base_model,n==null?void 0:n.model_name,l==null?void 0:l.entities]),m=d.useCallback(h=>{if(!h)return;const g=wO(h);g&&o(PI({controlNetId:t,model:g}))},[t,o]);return a.jsx(nn,{itemComponent:ci,data:u,error:!p||(s==null?void 0:s.base_model)!==p.base_model,placeholder:i("controlnet.selectModel"),value:(p==null?void 0:p.id)??null,onChange:m,disabled:!r,tooltip:p==null?void 0:p.description})},ole=d.memo(rle),sle=e=>{const{weight:t,isEnabled:n,controlNetId:r}=e.controlNet,o=te(),{t:s}=Z(),i=d.useCallback(l=>{o(AA({controlNetId:r,weight:l}))},[r,o]);return a.jsx(Et,{feature:"controlNetWeight",children:a.jsx(tt,{isDisabled:!n,label:s("controlnet.weight"),value:t,onChange:i,min:0,max:2,step:.01,withSliderMarks:!0,sliderMarks:[0,1,2]})})},ale=d.memo(sle),ile=le(xe,({controlNet:e,gallery:t})=>{const{pendingControlImages:n}=e,{autoAddBoardId:r}=t;return{pendingControlImages:n,autoAddBoardId:r}},Se),lle=({isSmall:e,controlNet:t})=>{const{controlImage:n,processedControlImage:r,processorType:o,controlNetId:s}=t,i=te(),{t:l}=Z(),{pendingControlImages:u,autoAddBoardId:p}=W(ile),m=W(Jn),[h,g]=d.useState(!1),{currentData:x}=to(n??$r.skipToken),{currentData:y}=to(r??$r.skipToken),[b]=TA(),[w]=NA(),[S]=$A(),j=d.useCallback(()=>{i(LA({controlNetId:s,controlImage:null}))},[s,i]),_=d.useCallback(async()=>{y&&(await b({imageDTO:y,is_intermediate:!1}).unwrap(),p!=="none"?w({imageDTO:y,board_id:p}):S({imageDTO:y}))},[y,b,p,w,S]),E=d.useCallback(()=>{x&&(m==="unifiedCanvas"?i(Vo({width:x.width,height:x.height})):(i(Bi(x.width)),i(Hi(x.height))))},[x,m,i]),I=d.useCallback(()=>{g(!0)},[]),M=d.useCallback(()=>{g(!1)},[]),R=d.useMemo(()=>{if(x)return{id:s,payloadType:"IMAGE_DTO",payload:{imageDTO:x}}},[x,s]),D=d.useMemo(()=>({id:s,actionType:"SET_CONTROLNET_IMAGE",context:{controlNetId:s}}),[s]),A=d.useMemo(()=>({type:"SET_CONTROLNET_IMAGE",controlNetId:s}),[s]),O=x&&y&&!h&&!u.includes(s)&&o!=="none";return a.jsxs(L,{onMouseEnter:I,onMouseLeave:M,sx:{position:"relative",w:"full",h:e?28:366,alignItems:"center",justifyContent:"center"},children:[a.jsx(ua,{draggableData:R,droppableData:D,imageDTO:x,isDropDisabled:O,postUploadAction:A}),a.jsx(Ie,{sx:{position:"absolute",top:0,insetInlineStart:0,w:"full",h:"full",opacity:O?1:0,transitionProperty:"common",transitionDuration:"normal",pointerEvents:"none"},children:a.jsx(ua,{draggableData:R,droppableData:D,imageDTO:y,isUploadDisabled:!0})}),a.jsxs(a.Fragment,{children:[a.jsx(Li,{onClick:j,icon:x?a.jsx(Ud,{}):void 0,tooltip:l("controlnet.resetControlImage")}),a.jsx(Li,{onClick:_,icon:x?a.jsx(lg,{size:16}):void 0,tooltip:l("controlnet.saveControlImage"),styleOverrides:{marginTop:6}}),a.jsx(Li,{onClick:E,icon:x?a.jsx(eee,{size:16}):void 0,tooltip:l("controlnet.setControlImageDimensions"),styleOverrides:{marginTop:12}})]}),u.includes(s)&&a.jsx(L,{sx:{position:"absolute",top:0,insetInlineStart:0,w:"full",h:"full",alignItems:"center",justifyContent:"center",opacity:.8,borderRadius:"base",bg:"base.400",_dark:{bg:"base.900"}},children:a.jsx(fa,{size:"xl",sx:{color:"base.100",_dark:{color:"base.400"}}})})]})},Jj=d.memo(lle),Io=()=>{const e=te();return d.useCallback((n,r)=>{e(zA({controlNetId:n,changes:r}))},[e])};function Po(e){return a.jsx(L,{sx:{flexDirection:"column",gap:2,pb:2},children:e.children})}const e_=Fr.canny_image_processor.default,cle=e=>{const{controlNetId:t,processorNode:n,isEnabled:r}=e,{low_threshold:o,high_threshold:s}=n,i=Io(),{t:l}=Z(),u=d.useCallback(g=>{i(t,{low_threshold:g})},[t,i]),p=d.useCallback(()=>{i(t,{low_threshold:e_.low_threshold})},[t,i]),m=d.useCallback(g=>{i(t,{high_threshold:g})},[t,i]),h=d.useCallback(()=>{i(t,{high_threshold:e_.high_threshold})},[t,i]);return a.jsxs(Po,{children:[a.jsx(tt,{isDisabled:!r,label:l("controlnet.lowThreshold"),value:o,onChange:u,handleReset:p,withReset:!0,min:0,max:255,withInput:!0,withSliderMarks:!0}),a.jsx(tt,{isDisabled:!r,label:l("controlnet.highThreshold"),value:s,onChange:m,handleReset:h,withReset:!0,min:0,max:255,withInput:!0,withSliderMarks:!0})]})},ule=d.memo(cle),dle=Fr.color_map_image_processor.default,fle=e=>{const{controlNetId:t,processorNode:n,isEnabled:r}=e,{color_map_tile_size:o}=n,s=Io(),{t:i}=Z(),l=d.useCallback(p=>{s(t,{color_map_tile_size:p})},[t,s]),u=d.useCallback(()=>{s(t,{color_map_tile_size:dle.color_map_tile_size})},[t,s]);return a.jsx(Po,{children:a.jsx(tt,{isDisabled:!r,label:i("controlnet.colorMapTileSize"),value:o,onChange:l,handleReset:u,withReset:!0,min:1,max:256,step:1,withInput:!0,withSliderMarks:!0,sliderNumberInputProps:{max:4096}})})},ple=d.memo(fle),_u=Fr.content_shuffle_image_processor.default,mle=e=>{const{controlNetId:t,processorNode:n,isEnabled:r}=e,{image_resolution:o,detect_resolution:s,w:i,h:l,f:u}=n,p=Io(),{t:m}=Z(),h=d.useCallback(I=>{p(t,{detect_resolution:I})},[t,p]),g=d.useCallback(()=>{p(t,{detect_resolution:_u.detect_resolution})},[t,p]),x=d.useCallback(I=>{p(t,{image_resolution:I})},[t,p]),y=d.useCallback(()=>{p(t,{image_resolution:_u.image_resolution})},[t,p]),b=d.useCallback(I=>{p(t,{w:I})},[t,p]),w=d.useCallback(()=>{p(t,{w:_u.w})},[t,p]),S=d.useCallback(I=>{p(t,{h:I})},[t,p]),j=d.useCallback(()=>{p(t,{h:_u.h})},[t,p]),_=d.useCallback(I=>{p(t,{f:I})},[t,p]),E=d.useCallback(()=>{p(t,{f:_u.f})},[t,p]);return a.jsxs(Po,{children:[a.jsx(tt,{label:m("controlnet.detectResolution"),value:s,onChange:h,handleReset:g,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(tt,{label:m("controlnet.imageResolution"),value:o,onChange:x,handleReset:y,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(tt,{label:m("controlnet.w"),value:i,onChange:b,handleReset:w,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(tt,{label:m("controlnet.h"),value:l,onChange:S,handleReset:j,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(tt,{label:m("controlnet.f"),value:u,onChange:_,handleReset:E,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r})]})},hle=d.memo(mle),t_=Fr.hed_image_processor.default,gle=e=>{const{controlNetId:t,processorNode:{detect_resolution:n,image_resolution:r,scribble:o},isEnabled:s}=e,i=Io(),{t:l}=Z(),u=d.useCallback(x=>{i(t,{detect_resolution:x})},[t,i]),p=d.useCallback(x=>{i(t,{image_resolution:x})},[t,i]),m=d.useCallback(x=>{i(t,{scribble:x.target.checked})},[t,i]),h=d.useCallback(()=>{i(t,{detect_resolution:t_.detect_resolution})},[t,i]),g=d.useCallback(()=>{i(t,{image_resolution:t_.image_resolution})},[t,i]);return a.jsxs(Po,{children:[a.jsx(tt,{label:l("controlnet.detectResolution"),value:n,onChange:u,handleReset:h,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!s}),a.jsx(tt,{label:l("controlnet.imageResolution"),value:r,onChange:p,handleReset:g,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!s}),a.jsx(dn,{label:l("controlnet.scribble"),isChecked:o,onChange:m,isDisabled:!s})]})},vle=d.memo(gle),n_=Fr.lineart_anime_image_processor.default,xle=e=>{const{controlNetId:t,processorNode:n,isEnabled:r}=e,{image_resolution:o,detect_resolution:s}=n,i=Io(),{t:l}=Z(),u=d.useCallback(g=>{i(t,{detect_resolution:g})},[t,i]),p=d.useCallback(g=>{i(t,{image_resolution:g})},[t,i]),m=d.useCallback(()=>{i(t,{detect_resolution:n_.detect_resolution})},[t,i]),h=d.useCallback(()=>{i(t,{image_resolution:n_.image_resolution})},[t,i]);return a.jsxs(Po,{children:[a.jsx(tt,{label:l("controlnet.detectResolution"),value:s,onChange:u,handleReset:m,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(tt,{label:l("controlnet.imageResolution"),value:o,onChange:p,handleReset:h,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r})]})},ble=d.memo(xle),r_=Fr.lineart_image_processor.default,yle=e=>{const{controlNetId:t,processorNode:n,isEnabled:r}=e,{image_resolution:o,detect_resolution:s,coarse:i}=n,l=Io(),{t:u}=Z(),p=d.useCallback(y=>{l(t,{detect_resolution:y})},[t,l]),m=d.useCallback(y=>{l(t,{image_resolution:y})},[t,l]),h=d.useCallback(()=>{l(t,{detect_resolution:r_.detect_resolution})},[t,l]),g=d.useCallback(()=>{l(t,{image_resolution:r_.image_resolution})},[t,l]),x=d.useCallback(y=>{l(t,{coarse:y.target.checked})},[t,l]);return a.jsxs(Po,{children:[a.jsx(tt,{label:u("controlnet.detectResolution"),value:s,onChange:p,handleReset:h,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(tt,{label:u("controlnet.imageResolution"),value:o,onChange:m,handleReset:g,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(dn,{label:u("controlnet.coarse"),isChecked:i,onChange:x,isDisabled:!r})]})},Cle=d.memo(yle),o_=Fr.mediapipe_face_processor.default,wle=e=>{const{controlNetId:t,processorNode:n,isEnabled:r}=e,{max_faces:o,min_confidence:s}=n,i=Io(),{t:l}=Z(),u=d.useCallback(g=>{i(t,{max_faces:g})},[t,i]),p=d.useCallback(g=>{i(t,{min_confidence:g})},[t,i]),m=d.useCallback(()=>{i(t,{max_faces:o_.max_faces})},[t,i]),h=d.useCallback(()=>{i(t,{min_confidence:o_.min_confidence})},[t,i]);return a.jsxs(Po,{children:[a.jsx(tt,{label:l("controlnet.maxFaces"),value:o,onChange:u,handleReset:m,withReset:!0,min:1,max:20,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(tt,{label:l("controlnet.minConfidence"),value:s,onChange:p,handleReset:h,withReset:!0,min:0,max:1,step:.01,withInput:!0,withSliderMarks:!0,isDisabled:!r})]})},Sle=d.memo(wle),s_=Fr.midas_depth_image_processor.default,kle=e=>{const{controlNetId:t,processorNode:n,isEnabled:r}=e,{a_mult:o,bg_th:s}=n,i=Io(),{t:l}=Z(),u=d.useCallback(g=>{i(t,{a_mult:g})},[t,i]),p=d.useCallback(g=>{i(t,{bg_th:g})},[t,i]),m=d.useCallback(()=>{i(t,{a_mult:s_.a_mult})},[t,i]),h=d.useCallback(()=>{i(t,{bg_th:s_.bg_th})},[t,i]);return a.jsxs(Po,{children:[a.jsx(tt,{label:l("controlnet.amult"),value:o,onChange:u,handleReset:m,withReset:!0,min:0,max:20,step:.01,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(tt,{label:l("controlnet.bgth"),value:s,onChange:p,handleReset:h,withReset:!0,min:0,max:20,step:.01,withInput:!0,withSliderMarks:!0,isDisabled:!r})]})},jle=d.memo(kle),Rp=Fr.mlsd_image_processor.default,_le=e=>{const{controlNetId:t,processorNode:n,isEnabled:r}=e,{image_resolution:o,detect_resolution:s,thr_d:i,thr_v:l}=n,u=Io(),{t:p}=Z(),m=d.useCallback(j=>{u(t,{detect_resolution:j})},[t,u]),h=d.useCallback(j=>{u(t,{image_resolution:j})},[t,u]),g=d.useCallback(j=>{u(t,{thr_d:j})},[t,u]),x=d.useCallback(j=>{u(t,{thr_v:j})},[t,u]),y=d.useCallback(()=>{u(t,{detect_resolution:Rp.detect_resolution})},[t,u]),b=d.useCallback(()=>{u(t,{image_resolution:Rp.image_resolution})},[t,u]),w=d.useCallback(()=>{u(t,{thr_d:Rp.thr_d})},[t,u]),S=d.useCallback(()=>{u(t,{thr_v:Rp.thr_v})},[t,u]);return a.jsxs(Po,{children:[a.jsx(tt,{label:p("controlnet.detectResolution"),value:s,onChange:m,handleReset:y,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(tt,{label:p("controlnet.imageResolution"),value:o,onChange:h,handleReset:b,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(tt,{label:p("controlnet.w"),value:i,onChange:g,handleReset:w,withReset:!0,min:0,max:1,step:.01,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(tt,{label:p("controlnet.h"),value:l,onChange:x,handleReset:S,withReset:!0,min:0,max:1,step:.01,withInput:!0,withSliderMarks:!0,isDisabled:!r})]})},Ile=d.memo(_le),a_=Fr.normalbae_image_processor.default,Ple=e=>{const{controlNetId:t,processorNode:n,isEnabled:r}=e,{image_resolution:o,detect_resolution:s}=n,i=Io(),{t:l}=Z(),u=d.useCallback(g=>{i(t,{detect_resolution:g})},[t,i]),p=d.useCallback(g=>{i(t,{image_resolution:g})},[t,i]),m=d.useCallback(()=>{i(t,{detect_resolution:a_.detect_resolution})},[t,i]),h=d.useCallback(()=>{i(t,{image_resolution:a_.image_resolution})},[t,i]);return a.jsxs(Po,{children:[a.jsx(tt,{label:l("controlnet.detectResolution"),value:s,onChange:u,handleReset:m,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(tt,{label:l("controlnet.imageResolution"),value:o,onChange:p,handleReset:h,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r})]})},Ele=d.memo(Ple),i_=Fr.openpose_image_processor.default,Mle=e=>{const{controlNetId:t,processorNode:n,isEnabled:r}=e,{image_resolution:o,detect_resolution:s,hand_and_face:i}=n,l=Io(),{t:u}=Z(),p=d.useCallback(y=>{l(t,{detect_resolution:y})},[t,l]),m=d.useCallback(y=>{l(t,{image_resolution:y})},[t,l]),h=d.useCallback(()=>{l(t,{detect_resolution:i_.detect_resolution})},[t,l]),g=d.useCallback(()=>{l(t,{image_resolution:i_.image_resolution})},[t,l]),x=d.useCallback(y=>{l(t,{hand_and_face:y.target.checked})},[t,l]);return a.jsxs(Po,{children:[a.jsx(tt,{label:u("controlnet.detectResolution"),value:s,onChange:p,handleReset:h,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(tt,{label:u("controlnet.imageResolution"),value:o,onChange:m,handleReset:g,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(dn,{label:u("controlnet.handAndFace"),isChecked:i,onChange:x,isDisabled:!r})]})},Ole=d.memo(Mle),l_=Fr.pidi_image_processor.default,Rle=e=>{const{controlNetId:t,processorNode:n,isEnabled:r}=e,{image_resolution:o,detect_resolution:s,scribble:i,safe:l}=n,u=Io(),{t:p}=Z(),m=d.useCallback(w=>{u(t,{detect_resolution:w})},[t,u]),h=d.useCallback(w=>{u(t,{image_resolution:w})},[t,u]),g=d.useCallback(()=>{u(t,{detect_resolution:l_.detect_resolution})},[t,u]),x=d.useCallback(()=>{u(t,{image_resolution:l_.image_resolution})},[t,u]),y=d.useCallback(w=>{u(t,{scribble:w.target.checked})},[t,u]),b=d.useCallback(w=>{u(t,{safe:w.target.checked})},[t,u]);return a.jsxs(Po,{children:[a.jsx(tt,{label:p("controlnet.detectResolution"),value:s,onChange:m,handleReset:g,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(tt,{label:p("controlnet.imageResolution"),value:o,onChange:h,handleReset:x,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(dn,{label:p("controlnet.scribble"),isChecked:i,onChange:y}),a.jsx(dn,{label:p("controlnet.safe"),isChecked:l,onChange:b,isDisabled:!r})]})},Dle=d.memo(Rle),Ale=e=>null,Tle=d.memo(Ale),Nle=e=>{const{controlNetId:t,isEnabled:n,processorNode:r}=e.controlNet;return r.type==="canny_image_processor"?a.jsx(ule,{controlNetId:t,processorNode:r,isEnabled:n}):r.type==="color_map_image_processor"?a.jsx(ple,{controlNetId:t,processorNode:r,isEnabled:n}):r.type==="hed_image_processor"?a.jsx(vle,{controlNetId:t,processorNode:r,isEnabled:n}):r.type==="lineart_image_processor"?a.jsx(Cle,{controlNetId:t,processorNode:r,isEnabled:n}):r.type==="content_shuffle_image_processor"?a.jsx(hle,{controlNetId:t,processorNode:r,isEnabled:n}):r.type==="lineart_anime_image_processor"?a.jsx(ble,{controlNetId:t,processorNode:r,isEnabled:n}):r.type==="mediapipe_face_processor"?a.jsx(Sle,{controlNetId:t,processorNode:r,isEnabled:n}):r.type==="midas_depth_image_processor"?a.jsx(jle,{controlNetId:t,processorNode:r,isEnabled:n}):r.type==="mlsd_image_processor"?a.jsx(Ile,{controlNetId:t,processorNode:r,isEnabled:n}):r.type==="normalbae_image_processor"?a.jsx(Ele,{controlNetId:t,processorNode:r,isEnabled:n}):r.type==="openpose_image_processor"?a.jsx(Ole,{controlNetId:t,processorNode:r,isEnabled:n}):r.type==="pidi_image_processor"?a.jsx(Dle,{controlNetId:t,processorNode:r,isEnabled:n}):r.type==="zoe_depth_image_processor"?a.jsx(Tle,{controlNetId:t,processorNode:r,isEnabled:n}):null},$le=d.memo(Nle),Lle=e=>{const{controlNetId:t,isEnabled:n,shouldAutoConfig:r}=e.controlNet,o=te(),{t:s}=Z(),i=d.useCallback(()=>{o(FA({controlNetId:t}))},[t,o]);return a.jsx(dn,{label:s("controlnet.autoConfigure"),"aria-label":s("controlnet.autoConfigure"),isChecked:r,onChange:i,isDisabled:!n})},zle=d.memo(Lle),Fle=e=>{const{controlNet:t}=e,n=te(),{t:r}=Z(),o=d.useCallback(()=>{n(BA({controlNet:t}))},[t,n]),s=d.useCallback(()=>{n(HA({controlNet:t}))},[t,n]);return a.jsxs(L,{sx:{gap:2},children:[a.jsx(Fe,{size:"sm",icon:a.jsx(Qi,{}),tooltip:r("controlnet.importImageFromCanvas"),"aria-label":r("controlnet.importImageFromCanvas"),onClick:o}),a.jsx(Fe,{size:"sm",icon:a.jsx(hM,{}),tooltip:r("controlnet.importMaskFromCanvas"),"aria-label":r("controlnet.importMaskFromCanvas"),onClick:s})]})},Ble=d.memo(Fle),c_=e=>`${Math.round(e*100)}%`,Hle=e=>{const{beginStepPct:t,endStepPct:n,isEnabled:r,controlNetId:o}=e.controlNet,s=te(),{t:i}=Z(),l=d.useCallback(u=>{s(VA({controlNetId:o,beginStepPct:u[0]})),s(WA({controlNetId:o,endStepPct:u[1]}))},[o,s]);return a.jsx(Et,{feature:"controlNetBeginEnd",children:a.jsxs(Kt,{isDisabled:!r,children:[a.jsx(wn,{children:i("controlnet.beginEndStepPercent")}),a.jsx(Rh,{w:"100%",gap:2,alignItems:"center",children:a.jsxs(Bb,{"aria-label":["Begin Step %","End Step %!"],value:[t,n],onChange:l,min:0,max:1,step:.01,minStepsBetweenThumbs:5,isDisabled:!r,children:[a.jsx(Hb,{children:a.jsx(Vb,{})}),a.jsx(Ht,{label:c_(t),placement:"top",hasArrow:!0,children:a.jsx(nd,{index:0})}),a.jsx(Ht,{label:c_(n),placement:"top",hasArrow:!0,children:a.jsx(nd,{index:1})}),a.jsx(Ai,{value:0,sx:{insetInlineStart:"0 !important",insetInlineEnd:"unset !important"},children:"0%"}),a.jsx(Ai,{value:.5,sx:{insetInlineStart:"50% !important",transform:"translateX(-50%)"},children:"50%"}),a.jsx(Ai,{value:1,sx:{insetInlineStart:"unset !important",insetInlineEnd:"0 !important"},children:"100%"})]})})]})})},Vle=d.memo(Hle);function Wle(e){const{controlMode:t,isEnabled:n,controlNetId:r}=e.controlNet,o=te(),{t:s}=Z(),i=[{label:s("controlnet.balanced"),value:"balanced"},{label:s("controlnet.prompt"),value:"more_prompt"},{label:s("controlnet.control"),value:"more_control"},{label:s("controlnet.megaControl"),value:"unbalanced"}],l=d.useCallback(u=>{o(UA({controlNetId:r,controlMode:u}))},[r,o]);return a.jsx(Et,{feature:"controlNetControlMode",children:a.jsx(On,{disabled:!n,label:s("controlnet.controlMode"),data:i,value:String(t),onChange:l})})}const Ule=le(Ky,e=>nr(Fr,n=>({value:n.type,label:n.label})).sort((n,r)=>n.value==="none"?-1:r.value==="none"?1:n.label.localeCompare(r.label)).filter(n=>!e.sd.disabledControlNetProcessors.includes(n.value)),Se),Gle=e=>{const t=te(),{controlNetId:n,isEnabled:r,processorNode:o}=e.controlNet,s=W(Ule),{t:i}=Z(),l=d.useCallback(u=>{t(GA({controlNetId:n,processorType:u}))},[n,t]);return a.jsx(nn,{label:i("controlnet.processor"),value:o.type??"canny_image_processor",data:s,onChange:l,disabled:!r})},Kle=d.memo(Gle);function qle(e){const{resizeMode:t,isEnabled:n,controlNetId:r}=e.controlNet,o=te(),{t:s}=Z(),i=[{label:s("controlnet.resize"),value:"just_resize"},{label:s("controlnet.crop"),value:"crop_resize"},{label:s("controlnet.fill"),value:"fill_resize"}],l=d.useCallback(u=>{o(KA({controlNetId:r,resizeMode:u}))},[r,o]);return a.jsx(Et,{feature:"controlNetResizeMode",children:a.jsx(On,{disabled:!n,label:s("controlnet.resizeMode"),data:i,value:String(t),onChange:l})})}const Xle=e=>{const{controlNet:t}=e,{controlNetId:n}=t,r=te(),{t:o}=Z(),s=W(Jn),i=le(xe,({controlNet:y})=>{const b=y.controlNets[n];if(!b)return{isEnabled:!1,shouldAutoConfig:!1};const{isEnabled:w,shouldAutoConfig:S}=b;return{isEnabled:w,shouldAutoConfig:S}},Se),{isEnabled:l,shouldAutoConfig:u}=W(i),[p,m]=uee(!1),h=d.useCallback(()=>{r(qA({controlNetId:n}))},[n,r]),g=d.useCallback(()=>{r(XA({sourceControlNetId:n,newControlNetId:Zs()}))},[n,r]),x=d.useCallback(y=>{r(QA({controlNetId:n,isEnabled:y.target.checked}))},[n,r]);return a.jsxs(L,{sx:{flexDir:"column",gap:3,p:2,borderRadius:"base",position:"relative",bg:"base.250",_dark:{bg:"base.750"}},children:[a.jsxs(L,{sx:{gap:2,alignItems:"center"},children:[a.jsx(dn,{tooltip:o("controlnet.toggleControlNet"),"aria-label":o("controlnet.toggleControlNet"),isChecked:l,onChange:x}),a.jsx(Ie,{sx:{w:"full",minW:0,transitionProperty:"common",transitionDuration:"0.1s"},children:a.jsx(ole,{controlNet:t})}),s==="unifiedCanvas"&&a.jsx(Ble,{controlNet:t}),a.jsx(Fe,{size:"sm",tooltip:o("controlnet.duplicate"),"aria-label":o("controlnet.duplicate"),onClick:g,icon:a.jsx(Hc,{})}),a.jsx(Fe,{size:"sm",tooltip:o("controlnet.delete"),"aria-label":o("controlnet.delete"),colorScheme:"error",onClick:h,icon:a.jsx(Br,{})}),a.jsx(Fe,{size:"sm",tooltip:o(p?"controlnet.hideAdvanced":"controlnet.showAdvanced"),"aria-label":o(p?"controlnet.hideAdvanced":"controlnet.showAdvanced"),onClick:m,variant:"ghost",sx:{_hover:{bg:"none"}},icon:a.jsx(gg,{sx:{boxSize:4,color:"base.700",transform:p?"rotate(0deg)":"rotate(180deg)",transitionProperty:"common",transitionDuration:"normal",_dark:{color:"base.300"}}})}),!u&&a.jsx(Ie,{sx:{position:"absolute",w:1.5,h:1.5,borderRadius:"full",top:4,insetInlineEnd:4,bg:"accent.700",_dark:{bg:"accent.400"}}})]}),a.jsxs(L,{sx:{w:"full",flexDirection:"column",gap:3},children:[a.jsxs(L,{sx:{gap:4,w:"full",alignItems:"center"},children:[a.jsxs(L,{sx:{flexDir:"column",gap:3,h:28,w:"full",paddingInlineStart:1,paddingInlineEnd:p?1:0,pb:2,justifyContent:"space-between"},children:[a.jsx(ale,{controlNet:t}),a.jsx(Vle,{controlNet:t})]}),!p&&a.jsx(L,{sx:{alignItems:"center",justifyContent:"center",h:28,w:28,aspectRatio:"1/1"},children:a.jsx(Jj,{controlNet:t,isSmall:!0})})]}),a.jsxs(L,{sx:{gap:2},children:[a.jsx(Wle,{controlNet:t}),a.jsx(qle,{controlNet:t})]}),a.jsx(Kle,{controlNet:t})]}),p&&a.jsxs(a.Fragment,{children:[a.jsx(Jj,{controlNet:t}),a.jsx(zle,{controlNet:t}),a.jsx($le,{controlNet:t})]})]})},Qle=d.memo(Xle),u_=e=>`${Math.round(e*100)}%`,Yle=()=>{const e=W(i=>i.controlNet.isIPAdapterEnabled),t=W(i=>i.controlNet.ipAdapterInfo.beginStepPct),n=W(i=>i.controlNet.ipAdapterInfo.endStepPct),r=te(),{t:o}=Z(),s=d.useCallback(i=>{r(YA(i[0])),r(ZA(i[1]))},[r]);return a.jsxs(Kt,{isDisabled:!e,children:[a.jsx(wn,{children:o("controlnet.beginEndStepPercent")}),a.jsx(Rh,{w:"100%",gap:2,alignItems:"center",children:a.jsxs(Bb,{"aria-label":["Begin Step %","End Step %!"],value:[t,n],onChange:s,min:0,max:1,step:.01,minStepsBetweenThumbs:5,isDisabled:!e,children:[a.jsx(Hb,{children:a.jsx(Vb,{})}),a.jsx(Ht,{label:u_(t),placement:"top",hasArrow:!0,children:a.jsx(nd,{index:0})}),a.jsx(Ht,{label:u_(n),placement:"top",hasArrow:!0,children:a.jsx(nd,{index:1})}),a.jsx(Ai,{value:0,sx:{insetInlineStart:"0 !important",insetInlineEnd:"unset !important"},children:"0%"}),a.jsx(Ai,{value:.5,sx:{insetInlineStart:"50% !important",transform:"translateX(-50%)"},children:"50%"}),a.jsx(Ai,{value:1,sx:{insetInlineStart:"unset !important",insetInlineEnd:"0 !important"},children:"100%"})]})})]})},Zle=d.memo(Yle),Jle=le(xe,e=>{const{isIPAdapterEnabled:t}=e.controlNet;return{isIPAdapterEnabled:t}},Se),ece=()=>{const{isIPAdapterEnabled:e}=W(Jle),t=te(),{t:n}=Z(),r=d.useCallback(o=>{t(u1(o.target.checked))},[t]);return a.jsx(dn,{label:n("controlnet.enableIPAdapter"),isChecked:e,onChange:r,formControlProps:{width:"100%"}})},tce=d.memo(ece),nce=le(xe,({controlNet:e})=>{const{ipAdapterInfo:t}=e;return{ipAdapterInfo:t}},Se),rce=()=>{const{ipAdapterInfo:e}=W(nce),t=te(),{t:n}=Z(),{currentData:r}=to(e.adapterImage??$r.skipToken),o=d.useMemo(()=>{if(r)return{id:"ip-adapter-image",payloadType:"IMAGE_DTO",payload:{imageDTO:r}}},[r]),s=d.useMemo(()=>({id:"ip-adapter-image",actionType:"SET_IP_ADAPTER_IMAGE"}),[]),i=d.useMemo(()=>({type:"SET_IP_ADAPTER_IMAGE"}),[]);return a.jsxs(L,{layerStyle:"second",sx:{position:"relative",h:28,w:28,alignItems:"center",justifyContent:"center",aspectRatio:"1/1",borderRadius:"base"},children:[a.jsx(ua,{imageDTO:r,droppableData:s,draggableData:o,postUploadAction:i,dropLabel:n("toast.setIPAdapterImage"),noContentFallback:a.jsx(Zn,{label:n("controlnet.ipAdapterImageFallback")})}),a.jsx(Li,{onClick:()=>t(JA(null)),icon:e.adapterImage?a.jsx(Ud,{}):void 0,tooltip:n("controlnet.resetIPAdapterImage")})]})},oce=d.memo(rce),sce=()=>{const e=W(p=>p.controlNet.isIPAdapterEnabled),t=W(p=>p.controlNet.ipAdapterInfo.model),n=W(p=>p.generation.model),r=te(),{t:o}=Z(),{data:s}=Vx(),i=d.useMemo(()=>(s==null?void 0:s.entities[`${t==null?void 0:t.base_model}/ip_adapter/${t==null?void 0:t.model_name}`])??null,[t==null?void 0:t.base_model,t==null?void 0:t.model_name,s==null?void 0:s.entities]),l=d.useMemo(()=>{if(!s)return[];const p=[];return $n(s.entities,(m,h)=>{if(!m)return;const g=(n==null?void 0:n.base_model)!==m.base_model;p.push({value:h,label:m.model_name,group:mn[m.base_model],disabled:g,tooltip:g?`Incompatible base model: ${m.base_model}`:void 0})}),p.sort((m,h)=>m.disabled&&!h.disabled?1:-1)},[s,n==null?void 0:n.base_model]),u=d.useCallback(p=>{if(!p)return;const m=IO(p);m&&r(eT(m))},[r]);return a.jsx(On,{label:o("controlnet.ipAdapterModel"),className:"nowheel nodrag",tooltip:i==null?void 0:i.description,value:(i==null?void 0:i.id)??null,placeholder:l.length>0?o("models.selectModel"):o("models.noModelsAvailable"),error:!i&&l.length>0,data:l,onChange:u,sx:{width:"100%"},disabled:!e||l.length===0})},ace=d.memo(sce),ice=()=>{const e=W(i=>i.controlNet.isIPAdapterEnabled),t=W(i=>i.controlNet.ipAdapterInfo.weight),n=te(),{t:r}=Z(),o=d.useCallback(i=>{n(yw(i))},[n]),s=d.useCallback(()=>{n(yw(1))},[n]);return a.jsx(tt,{isDisabled:!e,label:r("controlnet.weight"),value:t,onChange:o,min:0,max:2,step:.01,withSliderMarks:!0,sliderMarks:[0,1,2],withReset:!0,handleReset:s})},lce=d.memo(ice),cce=le(xe,e=>{const{isIPAdapterEnabled:t}=e.controlNet;return{isIPAdapterEnabled:t}},Se),uce=()=>{const{isIPAdapterEnabled:e}=W(cce);return a.jsxs(L,{sx:{flexDir:"column",gap:3,paddingInline:3,paddingBlock:2,borderRadius:"base",position:"relative",bg:"base.250",_dark:{bg:"base.750"}},children:[a.jsx(tce,{}),e&&a.jsxs(a.Fragment,{children:[a.jsx(ace,{}),a.jsxs(L,{gap:"3",children:[a.jsxs(L,{flexDirection:"column",sx:{h:28,w:"full",gap:4,mb:4},children:[a.jsx(lce,{}),a.jsx(Zle,{})]}),a.jsx(oce,{})]})]})]})},dce=d.memo(uce),fce=le(xe,e=>{const{isEnabled:t}=e.controlNet;return{isEnabled:t}},Se),pce=()=>{const{isEnabled:e}=W(fce),t=te(),n=d.useCallback(()=>{t(tT())},[t]);return a.jsx(Ie,{width:"100%",children:a.jsx(Et,{feature:"controlNet",children:a.jsx(dn,{label:"Enable ControlNet",isChecked:e,onChange:n})})})},mce=d.memo(pce),hce=le([xe],({controlNet:e})=>{const{controlNets:t,isEnabled:n,isIPAdapterEnabled:r,ipAdapterInfo:o}=e,s=nT(t),i=o.model&&o.adapterImage;let l;return n&&s.length>0&&(l=`${s.length} ControlNet`),r&&i&&(l?l=`${l}, IP Adapter`:l="IP Adapter"),{controlNetsArray:nr(t),activeLabel:l}},Se),gce=()=>{const{controlNetsArray:e,activeLabel:t}=W(hce),n=Bt("controlNet").isFeatureDisabled,r=te(),{data:o}=gh(),s=d.useMemo(()=>{if(!o||!Object.keys(o.entities).length)return;const l=Object.keys(o.entities)[0];if(!l)return;const u=o.entities[l];return u||void 0},[o]),i=d.useCallback(()=>{if(!s)return;const l=Zs();r(rT({controlNetId:l})),r(PI({controlNetId:l,model:s}))},[r,s]);return n?null:a.jsx(oo,{label:"Control Adapters",activeLabel:t,children:a.jsxs(L,{sx:{flexDir:"column",gap:2},children:[a.jsxs(L,{sx:{w:"100%",gap:2,p:2,ps:3,borderRadius:"base",alignItems:"center",bg:"base.250",_dark:{bg:"base.750"}},children:[a.jsx(mce,{}),a.jsx(Fe,{tooltip:"Add ControlNet","aria-label":"Add ControlNet",icon:a.jsx(Vc,{}),isDisabled:!s,flexGrow:1,size:"sm",onClick:i,"data-testid":"add controlnet"})]}),e.map((l,u)=>a.jsxs(d.Fragment,{children:[u>0&&a.jsx(Yn,{}),a.jsx(Qle,{controlNet:l})]},l.controlNetId)),a.jsx(dce,{})]})})},Yc=d.memo(gce),vce=e=>{const{onClick:t}=e,{t:n}=Z();return a.jsx(Fe,{size:"sm","aria-label":n("embedding.addEmbedding"),tooltip:n("embedding.addEmbedding"),icon:a.jsx(lM,{}),sx:{p:2,color:"base.500",_hover:{color:"base.600"},_active:{color:"base.700"},_dark:{color:"base.500",_hover:{color:"base.400"},_active:{color:"base.300"}}},variant:"link",onClick:t})},Rg=d.memo(vce),xce="28rem",bce=e=>{const{onSelect:t,isOpen:n,onClose:r,children:o}=e,{data:s}=oT(),i=d.useRef(null),{t:l}=Z(),u=W(h=>h.generation.model),p=d.useMemo(()=>{if(!s)return[];const h=[];return $n(s.entities,(g,x)=>{if(!g)return;const y=(u==null?void 0:u.base_model)!==g.base_model;h.push({value:g.model_name,label:g.model_name,group:mn[g.base_model],disabled:y,tooltip:y?`${l("embedding.incompatibleModel")} ${g.base_model}`:void 0})}),h.sort((g,x)=>{var y;return g.label&&x.label?(y=g.label)!=null&&y.localeCompare(x.label)?-1:1:-1}),h.sort((g,x)=>g.disabled&&!x.disabled?1:-1)},[s,u==null?void 0:u.base_model,l]),m=d.useCallback(h=>{h&&t(h)},[t]);return a.jsxs(Ld,{initialFocusRef:i,isOpen:n,onClose:r,placement:"bottom",openDelay:0,closeDelay:0,closeOnBlur:!0,returnFocusOnClose:!0,children:[a.jsx(Wh,{children:o}),a.jsx(zd,{sx:{p:0,top:-1,shadow:"dark-lg",borderColor:"accent.300",borderWidth:"2px",borderStyle:"solid",_dark:{borderColor:"accent.400"}},children:a.jsx(Uh,{sx:{p:0,w:`calc(${xce} - 2rem )`},children:p.length===0?a.jsx(L,{sx:{justifyContent:"center",p:2,fontSize:"sm",color:"base.500",_dark:{color:"base.700"}},children:a.jsx(ve,{children:"No Embeddings Loaded"})}):a.jsx(nn,{inputRef:i,autoFocus:!0,placeholder:l("embedding.addEmbedding"),value:null,data:p,nothingFound:l("embedding.noMatchingEmbedding"),itemComponent:ci,disabled:p.length===0,onDropdownClose:r,filter:(h,g)=>{var x;return((x=g.label)==null?void 0:x.toLowerCase().includes(h.toLowerCase().trim()))||g.value.toLowerCase().includes(h.toLowerCase().trim())},onChange:m})})})]})},Dg=d.memo(bce),yce=()=>{const e=W(h=>h.generation.negativePrompt),t=d.useRef(null),{isOpen:n,onClose:r,onOpen:o}=Lr(),s=te(),{t:i}=Z(),l=d.useCallback(h=>{s($u(h.target.value))},[s]),u=d.useCallback(h=>{h.key==="<"&&o()},[o]),p=d.useCallback(h=>{if(!t.current)return;const g=t.current.selectionStart;if(g===void 0)return;let x=e.slice(0,g);x[x.length-1]!=="<"&&(x+="<"),x+=`${h}>`;const y=x.length;x+=e.slice(g),qr.flushSync(()=>{s($u(x))}),t.current.selectionEnd=y,r()},[s,r,e]),m=Bt("embedding").isFeatureEnabled;return a.jsxs(Kt,{children:[a.jsx(Dg,{isOpen:n,onClose:r,onSelect:p,children:a.jsx(Et,{feature:"paramNegativeConditioning",placement:"right",children:a.jsx(da,{id:"negativePrompt",name:"negativePrompt",ref:t,value:e,placeholder:i("parameters.negativePromptPlaceholder"),onChange:l,resize:"vertical",fontSize:"sm",minH:16,...m&&{onKeyDown:u}})})}),!n&&m&&a.jsx(Ie,{sx:{position:"absolute",top:0,insetInlineEnd:0},children:a.jsx(Rg,{onClick:o})})]})},OO=d.memo(yce),Cce=le([xe],({generation:e})=>({prompt:e.positivePrompt}),{memoizeOptions:{resultEqualityCheck:Ft}}),wce=()=>{const e=te(),{prompt:t}=W(Cce),n=d.useRef(null),{isOpen:r,onClose:o,onOpen:s}=Lr(),{t:i}=Z(),l=d.useCallback(h=>{e(Nu(h.target.value))},[e]);et("alt+a",()=>{var h;(h=n.current)==null||h.focus()},[]);const u=d.useCallback(h=>{if(!n.current)return;const g=n.current.selectionStart;if(g===void 0)return;let x=t.slice(0,g);x[x.length-1]!=="<"&&(x+="<"),x+=`${h}>`;const y=x.length;x+=t.slice(g),qr.flushSync(()=>{e(Nu(x))}),n.current.selectionStart=y,n.current.selectionEnd=y,o()},[e,o,t]),p=Bt("embedding").isFeatureEnabled,m=d.useCallback(h=>{p&&h.key==="<"&&s()},[s,p]);return a.jsxs(Ie,{position:"relative",children:[a.jsx(Kt,{children:a.jsx(Dg,{isOpen:r,onClose:o,onSelect:u,children:a.jsx(Et,{feature:"paramPositiveConditioning",placement:"right",children:a.jsx(da,{id:"prompt",name:"prompt",ref:n,value:t,placeholder:i("parameters.positivePromptPlaceholder"),onChange:l,onKeyDown:m,resize:"vertical",minH:32})})})}),!r&&p&&a.jsx(Ie,{sx:{position:"absolute",top:0,insetInlineEnd:0},children:a.jsx(Rg,{onClick:s})})]})},RO=d.memo(wce);function Sce(){const e=W(o=>o.sdxl.shouldConcatSDXLStylePrompt),t=te(),{t:n}=Z(),r=()=>{t(sT(!e))};return a.jsx(Fe,{"aria-label":n("sdxl.concatPromptStyle"),tooltip:n("sdxl.concatPromptStyle"),variant:"outline",isChecked:e,onClick:r,icon:a.jsx(pM,{}),size:"xs",sx:{position:"absolute",insetInlineEnd:1,top:6,border:"none",color:e?"accent.500":"base.500",_hover:{bg:"none"}}})}const d_={position:"absolute",bg:"none",w:"full",minH:2,borderRadius:0,borderLeft:"none",borderRight:"none",zIndex:2,maskImage:"radial-gradient(circle at center, black, black 65%, black 30%, black 15%, transparent)"};function DO(){return a.jsxs(L,{children:[a.jsx(Ie,{as:In.div,initial:{scaleX:0,borderWidth:0,display:"none"},animate:{display:["block","block","block","none"],scaleX:[0,.25,.5,1],borderWidth:[0,3,3,0],transition:{duration:.37,times:[0,.25,.5,1]}},sx:{top:"1px",borderTop:"none",borderColor:"base.400",...d_,_dark:{borderColor:"accent.500"}}}),a.jsx(Ie,{as:In.div,initial:{opacity:0,scale:0},animate:{opacity:[0,1,1,1],scale:[0,.75,1.5,1],transition:{duration:.42,times:[0,.25,.5,1]}},exit:{opacity:0,scale:0},sx:{zIndex:3,position:"absolute",left:"48%",top:"3px",p:1,borderRadius:4,bg:"accent.400",color:"base.50",_dark:{bg:"accent.500"}},children:a.jsx(pM,{size:12})}),a.jsx(Ie,{as:In.div,initial:{scaleX:0,borderWidth:0,display:"none"},animate:{display:["block","block","block","none"],scaleX:[0,.25,.5,1],borderWidth:[0,3,3,0],transition:{duration:.37,times:[0,.25,.5,1]}},sx:{top:"17px",borderBottom:"none",borderColor:"base.400",...d_,_dark:{borderColor:"accent.500"}}})]})}const kce=le([xe],({sdxl:e})=>{const{negativeStylePrompt:t,shouldConcatSDXLStylePrompt:n}=e;return{prompt:t,shouldConcatSDXLStylePrompt:n}},{memoizeOptions:{resultEqualityCheck:Ft}}),jce=()=>{const e=te(),t=d.useRef(null),{isOpen:n,onClose:r,onOpen:o}=Lr(),{t:s}=Z(),{prompt:i,shouldConcatSDXLStylePrompt:l}=W(kce),u=d.useCallback(g=>{e(zu(g.target.value))},[e]),p=d.useCallback(g=>{if(!t.current)return;const x=t.current.selectionStart;if(x===void 0)return;let y=i.slice(0,x);y[y.length-1]!=="<"&&(y+="<"),y+=`${g}>`;const b=y.length;y+=i.slice(x),qr.flushSync(()=>{e(zu(y))}),t.current.selectionStart=b,t.current.selectionEnd=b,r()},[e,r,i]),m=Bt("embedding").isFeatureEnabled,h=d.useCallback(g=>{m&&g.key==="<"&&o()},[o,m]);return a.jsxs(Ie,{position:"relative",children:[a.jsx(dr,{children:l&&a.jsx(Ie,{sx:{position:"absolute",left:"3",w:"94%",top:"-17px"},children:a.jsx(DO,{})})}),a.jsx(Kt,{children:a.jsx(Dg,{isOpen:n,onClose:r,onSelect:p,children:a.jsx(da,{id:"prompt",name:"prompt",ref:t,value:i,placeholder:s("sdxl.negStylePrompt"),onChange:u,onKeyDown:h,resize:"vertical",fontSize:"sm",minH:16})})}),!n&&m&&a.jsx(Ie,{sx:{position:"absolute",top:0,insetInlineEnd:0},children:a.jsx(Rg,{onClick:o})})]})},_ce=d.memo(jce),Ice=le([xe],({sdxl:e})=>{const{positiveStylePrompt:t,shouldConcatSDXLStylePrompt:n}=e;return{prompt:t,shouldConcatSDXLStylePrompt:n}},{memoizeOptions:{resultEqualityCheck:Ft}}),Pce=()=>{const e=te(),t=d.useRef(null),{isOpen:n,onClose:r,onOpen:o}=Lr(),{t:s}=Z(),{prompt:i,shouldConcatSDXLStylePrompt:l}=W(Ice),u=d.useCallback(g=>{e(Lu(g.target.value))},[e]),p=d.useCallback(g=>{if(!t.current)return;const x=t.current.selectionStart;if(x===void 0)return;let y=i.slice(0,x);y[y.length-1]!=="<"&&(y+="<"),y+=`${g}>`;const b=y.length;y+=i.slice(x),qr.flushSync(()=>{e(Lu(y))}),t.current.selectionStart=b,t.current.selectionEnd=b,r()},[e,r,i]),m=Bt("embedding").isFeatureEnabled,h=d.useCallback(g=>{m&&g.key==="<"&&o()},[o,m]);return a.jsxs(Ie,{position:"relative",children:[a.jsx(dr,{children:l&&a.jsx(Ie,{sx:{position:"absolute",left:"3",w:"94%",top:"-17px"},children:a.jsx(DO,{})})}),a.jsx(Kt,{children:a.jsx(Dg,{isOpen:n,onClose:r,onSelect:p,children:a.jsx(da,{id:"prompt",name:"prompt",ref:t,value:i,placeholder:s("sdxl.posStylePrompt"),onChange:u,onKeyDown:h,resize:"vertical",minH:16})})}),!n&&m&&a.jsx(Ie,{sx:{position:"absolute",top:0,insetInlineEnd:0},children:a.jsx(Rg,{onClick:o})})]})},Ece=d.memo(Pce);function o2(){return a.jsxs(L,{sx:{flexDirection:"column",gap:2},children:[a.jsx(RO,{}),a.jsx(Sce,{}),a.jsx(Ece,{}),a.jsx(OO,{}),a.jsx(_ce,{})]})}const dl=()=>{const{isRefinerAvailable:e}=Xo(nb,{selectFromResult:({data:t})=>({isRefinerAvailable:t?t.ids.length>0:!1})});return e},Mce=le([xe],({sdxl:e,ui:t,hotkeys:n})=>{const{refinerCFGScale:r}=e,{shouldUseSliders:o}=t,{shift:s}=n;return{refinerCFGScale:r,shouldUseSliders:o,shift:s}},Se),Oce=()=>{const{refinerCFGScale:e,shouldUseSliders:t,shift:n}=W(Mce),r=dl(),o=te(),{t:s}=Z(),i=d.useCallback(u=>o(f1(u)),[o]),l=d.useCallback(()=>o(f1(7)),[o]);return t?a.jsx(tt,{label:s("sdxl.cfgScale"),step:n?.1:.5,min:1,max:20,onChange:i,handleReset:l,value:e,sliderNumberInputProps:{max:200},withInput:!0,withReset:!0,withSliderMarks:!0,isInteger:!1,isDisabled:!r}):a.jsx(Kc,{label:s("sdxl.cfgScale"),step:.5,min:1,max:200,onChange:i,value:e,isInteger:!1,numberInputFieldProps:{textAlign:"center"},isDisabled:!r})},Rce=d.memo(Oce),Dce=e=>{const t=el("models"),[n,r,o]=e.split("/"),s=aT.safeParse({base_model:n,model_name:o,model_type:r});if(!s.success){t.error({mainModelId:e,errors:s.error.format()},"Failed to parse main model id");return}return s.data},Ace=le(xe,e=>({model:e.sdxl.refinerModel}),Se),Tce=()=>{const e=te(),t=Bt("syncModels").isFeatureEnabled,{model:n}=W(Ace),{t:r}=Z(),{data:o,isLoading:s}=Xo(nb),i=d.useMemo(()=>{if(!o)return[];const p=[];return $n(o.entities,(m,h)=>{m&&p.push({value:h,label:m.model_name,group:mn[m.base_model]})}),p},[o]),l=d.useMemo(()=>(o==null?void 0:o.entities[`${n==null?void 0:n.base_model}/main/${n==null?void 0:n.model_name}`])??null,[o==null?void 0:o.entities,n]),u=d.useCallback(p=>{if(!p)return;const m=Dce(p);m&&e(pI(m))},[e]);return s?a.jsx(nn,{label:r("sdxl.refinermodel"),placeholder:r("sdxl.loading"),disabled:!0,data:[]}):a.jsxs(L,{w:"100%",alignItems:"center",gap:2,children:[a.jsx(nn,{tooltip:l==null?void 0:l.description,label:r("sdxl.refinermodel"),value:l==null?void 0:l.id,placeholder:i.length>0?r("sdxl.selectAModel"):r("sdxl.noModelsAvailable"),data:i,error:i.length===0,disabled:i.length===0,onChange:u,w:"100%"}),t&&a.jsx(Ie,{mt:7,children:a.jsx(Gc,{iconMode:!0})})]})},Nce=d.memo(Tce),$ce=le([xe],({sdxl:e,hotkeys:t})=>{const{refinerNegativeAestheticScore:n}=e,{shift:r}=t;return{refinerNegativeAestheticScore:n,shift:r}},Se),Lce=()=>{const{refinerNegativeAestheticScore:e,shift:t}=W($ce),n=dl(),r=te(),{t:o}=Z(),s=d.useCallback(l=>r(m1(l)),[r]),i=d.useCallback(()=>r(m1(2.5)),[r]);return a.jsx(tt,{label:o("sdxl.negAestheticScore"),step:t?.1:.5,min:1,max:10,onChange:s,handleReset:i,value:e,sliderNumberInputProps:{max:10},withInput:!0,withReset:!0,withSliderMarks:!0,isInteger:!1,isDisabled:!n})},zce=d.memo(Lce),Fce=le([xe],({sdxl:e,hotkeys:t})=>{const{refinerPositiveAestheticScore:n}=e,{shift:r}=t;return{refinerPositiveAestheticScore:n,shift:r}},Se),Bce=()=>{const{refinerPositiveAestheticScore:e,shift:t}=W(Fce),n=dl(),r=te(),{t:o}=Z(),s=d.useCallback(l=>r(p1(l)),[r]),i=d.useCallback(()=>r(p1(6)),[r]);return a.jsx(tt,{label:o("sdxl.posAestheticScore"),step:t?.1:.5,min:1,max:10,onChange:s,handleReset:i,value:e,sliderNumberInputProps:{max:10},withInput:!0,withReset:!0,withSliderMarks:!0,isInteger:!1,isDisabled:!n})},Hce=d.memo(Bce),Vce=le(xe,({ui:e,sdxl:t})=>{const{refinerScheduler:n}=t,{favoriteSchedulers:r}=e,o=nr(mh,(s,i)=>({value:i,label:s,group:r.includes(i)?"Favorites":void 0})).sort((s,i)=>s.label.localeCompare(i.label));return{refinerScheduler:n,data:o}},Se),Wce=()=>{const e=te(),{t}=Z(),{refinerScheduler:n,data:r}=W(Vce),o=dl(),s=d.useCallback(i=>{i&&e(mI(i))},[e]);return a.jsx(nn,{w:"100%",label:t("sdxl.scheduler"),value:n,data:r,onChange:s,disabled:!o})},Uce=d.memo(Wce),Gce=le([xe],({sdxl:e})=>{const{refinerStart:t}=e;return{refinerStart:t}},Se),Kce=()=>{const{refinerStart:e}=W(Gce),t=te(),n=dl(),r=d.useCallback(i=>t(h1(i)),[t]),{t:o}=Z(),s=d.useCallback(()=>t(h1(.8)),[t]);return a.jsx(tt,{label:o("sdxl.refinerStart"),step:.01,min:0,max:1,onChange:r,handleReset:s,value:e,withInput:!0,withReset:!0,withSliderMarks:!0,isInteger:!1,isDisabled:!n})},qce=d.memo(Kce),Xce=le([xe],({sdxl:e,ui:t})=>{const{refinerSteps:n}=e,{shouldUseSliders:r}=t;return{refinerSteps:n,shouldUseSliders:r}},Se),Qce=()=>{const{refinerSteps:e,shouldUseSliders:t}=W(Xce),n=dl(),r=te(),{t:o}=Z(),s=d.useCallback(l=>{r(d1(l))},[r]),i=d.useCallback(()=>{r(d1(20))},[r]);return t?a.jsx(tt,{label:o("sdxl.steps"),min:1,max:100,step:1,onChange:s,handleReset:i,value:e,withInput:!0,withReset:!0,withSliderMarks:!0,sliderNumberInputProps:{max:500},isDisabled:!n}):a.jsx(Kc,{label:o("sdxl.steps"),min:1,max:500,step:1,onChange:s,value:e,numberInputFieldProps:{textAlign:"center"},isDisabled:!n})},Yce=d.memo(Qce);function Zce(){const e=W(s=>s.sdxl.shouldUseSDXLRefiner),t=dl(),n=te(),{t:r}=Z(),o=s=>{n(iT(s.target.checked))};return a.jsx(dn,{label:r("sdxl.useRefiner"),isChecked:e,onChange:o,isDisabled:!t})}const Jce=le(xe,e=>{const{shouldUseSDXLRefiner:t}=e.sdxl,{shouldUseSliders:n}=e.ui;return{activeLabel:t?"Enabled":void 0,shouldUseSliders:n}},Se),eue=()=>{const{activeLabel:e,shouldUseSliders:t}=W(Jce),{t:n}=Z();return a.jsx(oo,{label:n("sdxl.refiner"),activeLabel:e,children:a.jsxs(L,{sx:{gap:2,flexDir:"column"},children:[a.jsx(Zce,{}),a.jsx(Nce,{}),a.jsxs(L,{gap:2,flexDirection:t?"column":"row",children:[a.jsx(Yce,{}),a.jsx(Rce,{})]}),a.jsx(Uce,{}),a.jsx(Hce,{}),a.jsx(zce,{}),a.jsx(qce,{})]})})},s2=d.memo(eue),tue=le([xe],({generation:e,config:t,ui:n,hotkeys:r})=>{const{initial:o,min:s,sliderMax:i,inputMax:l}=t.sd.guidance,{cfgScale:u}=e,{shouldUseSliders:p}=n,{shift:m}=r;return{cfgScale:u,initial:o,min:s,sliderMax:i,inputMax:l,shouldUseSliders:p,shift:m}},Se),nue=()=>{const{cfgScale:e,initial:t,min:n,sliderMax:r,inputMax:o,shouldUseSliders:s,shift:i}=W(tue),l=te(),{t:u}=Z(),p=d.useCallback(h=>l(Qp(h)),[l]),m=d.useCallback(()=>l(Qp(t)),[l,t]);return s?a.jsx(Et,{feature:"paramCFGScale",children:a.jsx(tt,{label:u("parameters.cfgScale"),step:i?.1:.5,min:n,max:r,onChange:p,handleReset:m,value:e,sliderNumberInputProps:{max:o},withInput:!0,withReset:!0,withSliderMarks:!0,isInteger:!1})}):a.jsx(Et,{feature:"paramCFGScale",children:a.jsx(Kc,{label:u("parameters.cfgScale"),step:.5,min:n,max:o,onChange:p,value:e,isInteger:!1,numberInputFieldProps:{textAlign:"center"}})})},_s=d.memo(nue),rue=le(xe,e=>({model:e.generation.model}),Se),oue=()=>{const e=te(),{t}=Z(),{model:n}=W(rue),r=Bt("syncModels").isFeatureEnabled,{data:o,isLoading:s}=Xo(Cw),{data:i,isLoading:l}=Ku(Cw),u=W(Jn),p=d.useMemo(()=>{if(!o)return[];const g=[];return $n(o.entities,(x,y)=>{x&&g.push({value:y,label:x.model_name,group:mn[x.base_model]})}),$n(i==null?void 0:i.entities,(x,y)=>{!x||u==="unifiedCanvas"||u==="img2img"||g.push({value:y,label:x.model_name,group:mn[x.base_model]})}),g},[o,i,u]),m=d.useMemo(()=>((o==null?void 0:o.entities[`${n==null?void 0:n.base_model}/main/${n==null?void 0:n.model_name}`])||(i==null?void 0:i.entities[`${n==null?void 0:n.base_model}/onnx/${n==null?void 0:n.model_name}`]))??null,[o==null?void 0:o.entities,n,i==null?void 0:i.entities]),h=d.useCallback(g=>{if(!g)return;const x=Og(g);x&&e(i1(x))},[e]);return s||l?a.jsx(nn,{label:t("modelManager.model"),placeholder:"Loading...",disabled:!0,data:[]}):a.jsxs(L,{w:"100%",alignItems:"center",gap:3,children:[a.jsx(Et,{feature:"paramModel",children:a.jsx(nn,{tooltip:m==null?void 0:m.description,label:t("modelManager.model"),value:m==null?void 0:m.id,placeholder:p.length>0?"Select a model":"No models available",data:p,error:p.length===0,disabled:p.length===0,onChange:h,w:"100%"})}),r&&a.jsx(Ie,{mt:6,children:a.jsx(Gc,{iconMode:!0})})]})},sue=d.memo(oue),aue=le(xe,({generation:e})=>{const{model:t,vae:n}=e;return{model:t,vae:n}},Se),iue=()=>{const e=te(),{t}=Z(),{model:n,vae:r}=W(aue),{data:o}=jI(),s=d.useMemo(()=>{if(!o)return[];const u=[{value:"default",label:"Default",group:"Default"}];return $n(o.entities,(p,m)=>{if(!p)return;const h=(n==null?void 0:n.base_model)!==p.base_model;u.push({value:m,label:p.model_name,group:mn[p.base_model],disabled:h,tooltip:h?`Incompatible base model: ${p.base_model}`:void 0})}),u.sort((p,m)=>p.disabled&&!m.disabled?1:-1)},[o,n==null?void 0:n.base_model]),i=d.useMemo(()=>(o==null?void 0:o.entities[`${r==null?void 0:r.base_model}/vae/${r==null?void 0:r.model_name}`])??null,[o==null?void 0:o.entities,r]),l=d.useCallback(u=>{if(!u||u==="default"){e(ww(null));return}const p=_O(u);p&&e(ww(p))},[e]);return a.jsx(Et,{feature:"paramVAE",children:a.jsx(nn,{itemComponent:ci,tooltip:i==null?void 0:i.description,label:t("modelManager.vae"),value:(i==null?void 0:i.id)??"default",placeholder:"Default",data:s,onChange:l,disabled:s.length===0,clearable:!0})})},lue=d.memo(iue),cue=le([EI,os],(e,t)=>{const{scheduler:n}=t,{favoriteSchedulers:r}=e,o=nr(mh,(s,i)=>({value:i,label:s,group:r.includes(i)?"Favorites":void 0})).sort((s,i)=>s.label.localeCompare(i.label));return{scheduler:n,data:o}},Se),uue=()=>{const e=te(),{t}=Z(),{scheduler:n,data:r}=W(cue),o=d.useCallback(s=>{s&&e(l1(s))},[e]);return a.jsx(Et,{feature:"paramScheduler",children:a.jsx(nn,{label:t("parameters.scheduler"),value:n,data:r,onChange:o})})},due=d.memo(uue),fue=le(xe,({generation:e})=>{const{vaePrecision:t}=e;return{vaePrecision:t}},Se),pue=["fp16","fp32"],mue=()=>{const e=te(),{vaePrecision:t}=W(fue),n=d.useCallback(r=>{r&&e(lT(r))},[e]);return a.jsx(Et,{feature:"paramVAEPrecision",children:a.jsx(On,{label:"VAE Precision",value:t,data:pue,onChange:n})})},hue=d.memo(mue),gue=()=>{const e=Bt("vae").isFeatureEnabled;return a.jsxs(L,{gap:3,w:"full",flexWrap:e?"wrap":"nowrap",children:[a.jsx(Ie,{w:"full",children:a.jsx(sue,{})}),a.jsx(Ie,{w:"full",children:a.jsx(due,{})}),e&&a.jsxs(L,{w:"full",gap:3,children:[a.jsx(lue,{}),a.jsx(hue,{})]})]})},Is=d.memo(gue),AO=[{name:"Free",value:null},{name:"2:3",value:2/3},{name:"16:9",value:16/9},{name:"1:1",value:1/1}],TO=AO.map(e=>e.value);function NO(){const e=W(o=>o.generation.aspectRatio),t=te(),n=W(o=>o.generation.shouldFitToWidthHeight),r=W(Jn);return a.jsx(Vt,{isAttached:!0,children:AO.map(o=>a.jsx(at,{size:"sm",isChecked:e===o.value,isDisabled:r==="img2img"?!n:!1,onClick:()=>{t(zo(o.value)),t(qu(!1))},children:o.name},o.name))})}const vue=le([xe],({generation:e,hotkeys:t,config:n})=>{const{min:r,sliderMax:o,inputMax:s,fineStep:i,coarseStep:l}=n.sd.height,{model:u,height:p}=e,{aspectRatio:m}=e,h=t.shift?i:l;return{model:u,height:p,min:r,sliderMax:o,inputMax:s,step:h,aspectRatio:m}},Se),xue=e=>{const{model:t,height:n,min:r,sliderMax:o,inputMax:s,step:i,aspectRatio:l}=W(vue),u=te(),{t:p}=Z(),m=["sdxl","sdxl-refiner"].includes(t==null?void 0:t.base_model)?1024:512,h=d.useCallback(x=>{if(u(Hi(x)),l){const y=wr(x*l,8);u(Bi(y))}},[u,l]),g=d.useCallback(()=>{if(u(Hi(m)),l){const x=wr(m*l,8);u(Bi(x))}},[u,m,l]);return a.jsx(tt,{label:p("parameters.height"),value:n,min:r,step:i,max:o,onChange:h,handleReset:g,withInput:!0,withReset:!0,withSliderMarks:!0,sliderNumberInputProps:{max:s},...e})},bue=d.memo(xue),yue=le([xe],({generation:e,hotkeys:t,config:n})=>{const{min:r,sliderMax:o,inputMax:s,fineStep:i,coarseStep:l}=n.sd.width,{model:u,width:p,aspectRatio:m}=e,h=t.shift?i:l;return{model:u,width:p,min:r,sliderMax:o,inputMax:s,step:h,aspectRatio:m}},Se),Cue=e=>{const{model:t,width:n,min:r,sliderMax:o,inputMax:s,step:i,aspectRatio:l}=W(yue),u=te(),{t:p}=Z(),m=["sdxl","sdxl-refiner"].includes(t==null?void 0:t.base_model)?1024:512,h=d.useCallback(x=>{if(u(Bi(x)),l){const y=wr(x/l,8);u(Hi(y))}},[u,l]),g=d.useCallback(()=>{if(u(Bi(m)),l){const x=wr(m/l,8);u(Hi(x))}},[u,m,l]);return a.jsx(tt,{label:p("parameters.width"),value:n,min:r,step:i,max:o,onChange:h,handleReset:g,withInput:!0,withReset:!0,withSliderMarks:!0,sliderNumberInputProps:{max:s},...e})},wue=d.memo(Cue),Sue=le([os,Jn],(e,t)=>{const{shouldFitToWidthHeight:n,shouldLockAspectRatio:r,width:o,height:s}=e;return{activeTabName:t,shouldFitToWidthHeight:n,shouldLockAspectRatio:r,width:o,height:s}},Se);function Oc(){const{t:e}=Z(),t=te(),{activeTabName:n,shouldFitToWidthHeight:r,shouldLockAspectRatio:o,width:s,height:i}=W(Sue),l=d.useCallback(()=>{o?(t(qu(!1)),TO.includes(s/i)?t(zo(s/i)):t(zo(null))):(t(qu(!0)),t(zo(s/i)))},[o,s,i,t]),u=d.useCallback(()=>{t(cT()),t(zo(null)),o&&t(zo(i/s))},[t,o,s,i]);return a.jsxs(L,{sx:{gap:2,p:4,borderRadius:4,flexDirection:"column",w:"full",bg:"base.150",_dark:{bg:"base.750"}},children:[a.jsx(Et,{feature:"paramRatio",children:a.jsxs(Kt,{as:L,flexDir:"row",alignItems:"center",gap:2,children:[a.jsx(wn,{children:e("parameters.aspectRatio")}),a.jsx(ba,{}),a.jsx(NO,{}),a.jsx(Fe,{tooltip:e("ui.swapSizes"),"aria-label":e("ui.swapSizes"),size:"sm",icon:a.jsx(z8,{}),fontSize:20,isDisabled:n==="img2img"?!r:!1,onClick:u}),a.jsx(Fe,{tooltip:e("ui.lockRatio"),"aria-label":e("ui.lockRatio"),size:"sm",icon:a.jsx(mM,{}),isChecked:o,isDisabled:n==="img2img"?!r:!1,onClick:l})]})}),a.jsx(L,{gap:2,alignItems:"center",children:a.jsxs(L,{gap:2,flexDirection:"column",width:"full",children:[a.jsx(wue,{isDisabled:n==="img2img"?!r:!1}),a.jsx(bue,{isDisabled:n==="img2img"?!r:!1})]})})]})}const kue=le([xe],({generation:e,config:t,ui:n,hotkeys:r})=>{const{initial:o,min:s,sliderMax:i,inputMax:l,fineStep:u,coarseStep:p}=t.sd.steps,{steps:m}=e,{shouldUseSliders:h}=n,g=r.shift?u:p;return{steps:m,initial:o,min:s,sliderMax:i,inputMax:l,step:g,shouldUseSliders:h}},Se),jue=()=>{const{steps:e,initial:t,min:n,sliderMax:r,inputMax:o,step:s,shouldUseSliders:i}=W(kue),l=te(),{t:u}=Z(),p=d.useCallback(g=>{l(Yp(g))},[l]),m=d.useCallback(()=>{l(Yp(t))},[l,t]),h=d.useCallback(()=>{l(eb())},[l]);return i?a.jsx(Et,{feature:"paramSteps",children:a.jsx(tt,{label:u("parameters.steps"),min:n,max:r,step:s,onChange:p,handleReset:m,value:e,withInput:!0,withReset:!0,withSliderMarks:!0,sliderNumberInputProps:{max:o}})}):a.jsx(Et,{feature:"paramSteps",children:a.jsx(Kc,{label:u("parameters.steps"),min:n,max:o,step:s,onChange:p,value:e,numberInputFieldProps:{textAlign:"center"},onBlur:h})})},Ps=d.memo(jue);function $O(){const e=te(),t=W(o=>o.generation.shouldFitToWidthHeight),n=o=>e(uT(o.target.checked)),{t:r}=Z();return a.jsx(dn,{label:r("parameters.imageFit"),isChecked:t,onChange:n})}function _ue(){const e=W(i=>i.generation.seed),t=W(i=>i.generation.shouldRandomizeSeed),n=W(i=>i.generation.shouldGenerateVariations),{t:r}=Z(),o=te(),s=i=>o(Xp(i));return a.jsx(Kc,{label:r("parameters.seed"),step:1,precision:0,flexGrow:1,min:MI,max:OI,isDisabled:t,isInvalid:e<0&&n,onChange:s,value:e})}const Iue=(e,t)=>Math.floor(Math.random()*(t-e+1)+e);function Pue(){const e=te(),t=W(o=>o.generation.shouldRandomizeSeed),{t:n}=Z(),r=()=>e(Xp(Iue(MI,OI)));return a.jsx(Fe,{size:"sm",isDisabled:t,"aria-label":n("parameters.shuffle"),tooltip:n("parameters.shuffle"),onClick:r,icon:a.jsx(ZJ,{})})}const Eue=()=>{const e=te(),{t}=Z(),n=W(o=>o.generation.shouldRandomizeSeed),r=o=>e(dT(o.target.checked));return a.jsx(dn,{label:t("common.random"),isChecked:n,onChange:r})},Mue=d.memo(Eue),Oue=()=>a.jsx(Et,{feature:"paramSeed",children:a.jsxs(L,{sx:{gap:3,alignItems:"flex-end"},children:[a.jsx(_ue,{}),a.jsx(Pue,{}),a.jsx(Mue,{})]})}),Es=d.memo(Oue),LO=je((e,t)=>a.jsxs(L,{ref:t,sx:{flexDir:"column",gap:2,bg:"base.100",px:4,pt:2,pb:4,borderRadius:"base",_dark:{bg:"base.750"}},children:[a.jsx(ve,{fontSize:"sm",fontWeight:"bold",sx:{color:"base.600",_dark:{color:"base.300"}},children:e.label}),e.children]}));LO.displayName="SubSettingsWrapper";const Rc=d.memo(LO),Rue=le([xe],({sdxl:e})=>{const{sdxlImg2ImgDenoisingStrength:t}=e;return{sdxlImg2ImgDenoisingStrength:t}},Se),Due=()=>{const{sdxlImg2ImgDenoisingStrength:e}=W(Rue),t=te(),{t:n}=Z(),r=d.useCallback(s=>t(Sw(s)),[t]),o=d.useCallback(()=>{t(Sw(.7))},[t]);return a.jsx(Et,{feature:"paramDenoisingStrength",children:a.jsx(Rc,{children:a.jsx(tt,{label:n("sdxl.denoisingStrength"),step:.01,min:0,max:1,onChange:r,handleReset:o,value:e,isInteger:!1,withInput:!0,withSliderMarks:!0,withReset:!0})})})},zO=d.memo(Due),Aue=le([EI,os],(e,t)=>{const{shouldUseSliders:n}=e,{shouldRandomizeSeed:r}=t;return{shouldUseSliders:n,activeLabel:r?void 0:"Manual Seed"}},Se),Tue=()=>{const{shouldUseSliders:e,activeLabel:t}=W(Aue);return a.jsx(oo,{label:"General",activeLabel:t,defaultIsOpen:!0,children:a.jsxs(L,{sx:{flexDirection:"column",gap:3},children:[e?a.jsxs(a.Fragment,{children:[a.jsx(rs,{}),a.jsx(Ps,{}),a.jsx(_s,{}),a.jsx(Is,{}),a.jsx(Ie,{pt:2,children:a.jsx(Es,{})}),a.jsx(Oc,{})]}):a.jsxs(a.Fragment,{children:[a.jsxs(L,{gap:3,children:[a.jsx(rs,{}),a.jsx(Ps,{}),a.jsx(_s,{})]}),a.jsx(Is,{}),a.jsx(Ie,{pt:2,children:a.jsx(Es,{})}),a.jsx(Oc,{})]}),a.jsx(zO,{}),a.jsx($O,{})]})})},Nue=d.memo(Tue),$ue=()=>a.jsxs(a.Fragment,{children:[a.jsx(o2,{}),a.jsx(Nue,{}),a.jsx(s2,{}),a.jsx(Yc,{}),a.jsx(Xc,{}),a.jsx(qc,{}),a.jsx(Qc,{})]}),Lue=d.memo($ue),a2=()=>{const{t:e}=Z(),t=W(i=>i.generation.shouldRandomizeSeed),n=W(i=>i.generation.iterations),r=d.useMemo(()=>n===1?e("parameters.iterationsWithCount_one",{count:1}):e("parameters.iterationsWithCount_other",{count:n}),[n,e]),o=d.useMemo(()=>e(t?"parameters.randomSeed":"parameters.manualSeed"),[t,e]);return{iterationsAndSeedLabel:d.useMemo(()=>[r,o].join(", "),[r,o]),iterationsLabel:r,seedLabel:o}},zue=()=>{const e=W(n=>n.ui.shouldUseSliders),{iterationsAndSeedLabel:t}=a2();return a.jsx(oo,{label:"General",activeLabel:t,defaultIsOpen:!0,children:a.jsx(L,{sx:{flexDirection:"column",gap:3},children:e?a.jsxs(a.Fragment,{children:[a.jsx(rs,{}),a.jsx(Ps,{}),a.jsx(_s,{}),a.jsx(Is,{}),a.jsx(Ie,{pt:2,children:a.jsx(Es,{})}),a.jsx(Oc,{})]}):a.jsxs(a.Fragment,{children:[a.jsxs(L,{gap:3,children:[a.jsx(rs,{}),a.jsx(Ps,{}),a.jsx(_s,{})]}),a.jsx(Is,{}),a.jsx(Ie,{pt:2,children:a.jsx(Es,{})}),a.jsx(Oc,{})]})})})},FO=d.memo(zue),Fue=()=>a.jsxs(a.Fragment,{children:[a.jsx(o2,{}),a.jsx(FO,{}),a.jsx(s2,{}),a.jsx(Yc,{}),a.jsx(Xc,{}),a.jsx(qc,{}),a.jsx(Qc,{})]}),Bue=d.memo(Fue),Hue=[{label:"Unmasked",value:"unmasked"},{label:"Mask",value:"mask"},{label:"Mask Edge",value:"edge"}],Vue=()=>{const e=te(),t=W(o=>o.generation.canvasCoherenceMode),{t:n}=Z(),r=o=>{o&&e(fT(o))};return a.jsx(Et,{feature:"compositingCoherenceMode",children:a.jsx(On,{label:n("parameters.coherenceMode"),data:Hue,value:t,onChange:r})})},Wue=d.memo(Vue),Uue=()=>{const e=te(),t=W(r=>r.generation.canvasCoherenceSteps),{t:n}=Z();return a.jsx(Et,{feature:"compositingCoherenceSteps",children:a.jsx(tt,{label:n("parameters.coherenceSteps"),min:1,max:100,step:1,sliderNumberInputProps:{max:999},value:t,onChange:r=>{e(kw(r))},withInput:!0,withSliderMarks:!0,withReset:!0,handleReset:()=>{e(kw(20))}})})},Gue=d.memo(Uue),Kue=()=>{const e=te(),t=W(r=>r.generation.canvasCoherenceStrength),{t:n}=Z();return a.jsx(Et,{feature:"compositingStrength",children:a.jsx(tt,{label:n("parameters.coherenceStrength"),min:0,max:1,step:.01,sliderNumberInputProps:{max:999},value:t,onChange:r=>{e(jw(r))},withInput:!0,withSliderMarks:!0,withReset:!0,handleReset:()=>{e(jw(.3))}})})},que=d.memo(Kue);function Xue(){const e=te(),t=W(r=>r.generation.maskBlur),{t:n}=Z();return a.jsx(Et,{feature:"compositingBlur",children:a.jsx(tt,{label:n("parameters.maskBlur"),min:0,max:64,sliderNumberInputProps:{max:512},value:t,onChange:r=>{e(_w(r))},withInput:!0,withSliderMarks:!0,withReset:!0,handleReset:()=>{e(_w(16))}})})}const Que=[{label:"Box Blur",value:"box"},{label:"Gaussian Blur",value:"gaussian"}];function Yue(){const e=W(o=>o.generation.maskBlurMethod),t=te(),{t:n}=Z(),r=o=>{o&&t(pT(o))};return a.jsx(Et,{feature:"compositingBlurMethod",children:a.jsx(On,{value:e,onChange:r,label:n("parameters.maskBlurMethod"),data:Que})})}const Zue=()=>{const{t:e}=Z();return a.jsx(oo,{label:e("parameters.compositingSettingsHeader"),children:a.jsxs(L,{sx:{flexDirection:"column",gap:2},children:[a.jsxs(Rc,{label:e("parameters.coherencePassHeader"),children:[a.jsx(Wue,{}),a.jsx(Gue,{}),a.jsx(que,{})]}),a.jsx(Yn,{}),a.jsxs(Rc,{label:e("parameters.maskAdjustmentsHeader"),children:[a.jsx(Xue,{}),a.jsx(Yue,{})]})]})})},BO=d.memo(Zue),Jue=le([xe],({generation:e})=>{const{infillMethod:t}=e;return{infillMethod:t}},Se),ede=()=>{const e=te(),{infillMethod:t}=W(Jue),{data:n,isLoading:r}=iI(),o=n==null?void 0:n.infill_methods,{t:s}=Z(),i=d.useCallback(l=>{e(mT(l))},[e]);return a.jsx(Et,{feature:"infillMethod",children:a.jsx(On,{disabled:(o==null?void 0:o.length)===0,placeholder:r?"Loading...":void 0,label:s("parameters.infillMethod"),value:t,data:o??[],onChange:i})})},tde=d.memo(ede),nde=le([os],e=>{const{infillPatchmatchDownscaleSize:t,infillMethod:n}=e;return{infillPatchmatchDownscaleSize:t,infillMethod:n}},Se),rde=()=>{const e=te(),{infillPatchmatchDownscaleSize:t,infillMethod:n}=W(nde),{t:r}=Z(),o=d.useCallback(i=>{e(Iw(i))},[e]),s=d.useCallback(()=>{e(Iw(2))},[e]);return a.jsx(tt,{isDisabled:n!=="patchmatch",label:r("parameters.patchmatchDownScaleSize"),min:1,max:10,value:t,onChange:o,withInput:!0,withSliderMarks:!0,withReset:!0,handleReset:s})},ode=d.memo(rde),sde=le([os],e=>{const{infillTileSize:t,infillMethod:n}=e;return{infillTileSize:t,infillMethod:n}},Se),ade=()=>{const e=te(),{infillTileSize:t,infillMethod:n}=W(sde),{t:r}=Z(),o=d.useCallback(i=>{e(Pw(i))},[e]),s=d.useCallback(()=>{e(Pw(32))},[e]);return a.jsx(tt,{isDisabled:n!=="tile",label:r("parameters.tileSize"),min:16,max:64,sliderNumberInputProps:{max:256},value:t,onChange:o,withInput:!0,withSliderMarks:!0,withReset:!0,handleReset:s})},ide=d.memo(ade),lde=le([os],e=>{const{infillMethod:t}=e;return{infillMethod:t}},Se);function cde(){const{infillMethod:e}=W(lde);return a.jsxs(L,{children:[e==="tile"&&a.jsx(ide,{}),e==="patchmatch"&&a.jsx(ode,{})]})}const Sn=e=>e.canvas,Eo=le([xe],({canvas:e})=>e.batchIds.length>0||e.layerState.stagingArea.images.length>0),ude=le([Sn],e=>{const{boundingBoxScaleMethod:t}=e;return{boundingBoxScale:t}},Se),dde=()=>{const e=te(),{boundingBoxScale:t}=W(ude),{t:n}=Z(),r=o=>{e(gT(o))};return a.jsx(Et,{feature:"scaleBeforeProcessing",children:a.jsx(nn,{label:n("parameters.scaleBeforeProcessing"),data:hT,value:t,onChange:r})})},fde=d.memo(dde),pde=le([os,Sn],(e,t)=>{const{scaledBoundingBoxDimensions:n,boundingBoxScaleMethod:r}=t,{model:o,aspectRatio:s}=e;return{model:o,scaledBoundingBoxDimensions:n,isManual:r==="manual",aspectRatio:s}},Se),mde=()=>{const e=te(),{model:t,isManual:n,scaledBoundingBoxDimensions:r,aspectRatio:o}=W(pde),s=["sdxl","sdxl-refiner"].includes(t==null?void 0:t.base_model)?1024:512,{t:i}=Z(),l=p=>{let m=r.width;const h=Math.floor(p);o&&(m=wr(h*o,64)),e(Jp({width:m,height:h}))},u=()=>{let p=r.width;const m=Math.floor(s);o&&(p=wr(m*o,64)),e(Jp({width:p,height:m}))};return a.jsx(tt,{isDisabled:!n,label:i("parameters.scaledHeight"),min:64,max:1536,step:64,value:r.height,onChange:l,sliderNumberInputProps:{max:4096},withSliderMarks:!0,withInput:!0,withReset:!0,handleReset:u})},hde=d.memo(mde),gde=le([Sn,os],(e,t)=>{const{boundingBoxScaleMethod:n,scaledBoundingBoxDimensions:r}=e,{model:o,aspectRatio:s}=t;return{model:o,scaledBoundingBoxDimensions:r,aspectRatio:s,isManual:n==="manual"}},Se),vde=()=>{const e=te(),{model:t,isManual:n,scaledBoundingBoxDimensions:r,aspectRatio:o}=W(gde),s=["sdxl","sdxl-refiner"].includes(t==null?void 0:t.base_model)?1024:512,{t:i}=Z(),l=p=>{const m=Math.floor(p);let h=r.height;o&&(h=wr(m/o,64)),e(Jp({width:m,height:h}))},u=()=>{const p=Math.floor(s);let m=r.height;o&&(m=wr(p/o,64)),e(Jp({width:p,height:m}))};return a.jsx(tt,{isDisabled:!n,label:i("parameters.scaledWidth"),min:64,max:1536,step:64,value:r.width,onChange:l,sliderNumberInputProps:{max:4096},withSliderMarks:!0,withInput:!0,withReset:!0,handleReset:u})},xde=d.memo(vde),bde=()=>{const{t:e}=Z();return a.jsx(oo,{label:e("parameters.infillScalingHeader"),children:a.jsxs(L,{sx:{gap:2,flexDirection:"column"},children:[a.jsxs(Rc,{children:[a.jsx(tde,{}),a.jsx(cde,{})]}),a.jsx(Yn,{}),a.jsxs(Rc,{children:[a.jsx(fde,{}),a.jsx(xde,{}),a.jsx(hde,{})]})]})})},HO=d.memo(bde),yde=le([xe,Eo],({canvas:e,generation:t},n)=>{const{boundingBoxDimensions:r}=e,{model:o,aspectRatio:s}=t;return{model:o,boundingBoxDimensions:r,isStaging:n,aspectRatio:s}},Se),Cde=()=>{const e=te(),{model:t,boundingBoxDimensions:n,isStaging:r,aspectRatio:o}=W(yde),{t:s}=Z(),i=["sdxl","sdxl-refiner"].includes(t==null?void 0:t.base_model)?1024:512,l=p=>{if(e(Vo({...n,height:Math.floor(p)})),o){const m=wr(p*o,64);e(Vo({width:m,height:Math.floor(p)}))}},u=()=>{if(e(Vo({...n,height:Math.floor(i)})),o){const p=wr(i*o,64);e(Vo({width:p,height:Math.floor(i)}))}};return a.jsx(tt,{label:s("parameters.boundingBoxHeight"),min:64,max:1536,step:64,value:n.height,onChange:l,isDisabled:r,sliderNumberInputProps:{max:4096},withSliderMarks:!0,withInput:!0,withReset:!0,handleReset:u})},wde=d.memo(Cde),Sde=le([xe,Eo],({canvas:e,generation:t},n)=>{const{boundingBoxDimensions:r}=e,{model:o,aspectRatio:s}=t;return{model:o,boundingBoxDimensions:r,isStaging:n,aspectRatio:s}},Se),kde=()=>{const e=te(),{model:t,boundingBoxDimensions:n,isStaging:r,aspectRatio:o}=W(Sde),s=["sdxl","sdxl-refiner"].includes(t==null?void 0:t.base_model)?1024:512,{t:i}=Z(),l=p=>{if(e(Vo({...n,width:Math.floor(p)})),o){const m=wr(p/o,64);e(Vo({width:Math.floor(p),height:m}))}},u=()=>{if(e(Vo({...n,width:Math.floor(s)})),o){const p=wr(s/o,64);e(Vo({width:Math.floor(s),height:p}))}};return a.jsx(tt,{label:i("parameters.boundingBoxWidth"),min:64,max:1536,step:64,value:n.width,onChange:l,isDisabled:r,sliderNumberInputProps:{max:4096},withSliderMarks:!0,withInput:!0,withReset:!0,handleReset:u})},jde=d.memo(kde),_de=le([os,Sn],(e,t)=>{const{shouldFitToWidthHeight:n,shouldLockAspectRatio:r}=e,{boundingBoxDimensions:o}=t;return{shouldFitToWidthHeight:n,shouldLockAspectRatio:r,boundingBoxDimensions:o}});function uh(){const e=te(),{t}=Z(),{shouldLockAspectRatio:n,boundingBoxDimensions:r}=W(_de),o=d.useCallback(()=>{n?(e(qu(!1)),TO.includes(r.width/r.height)?e(zo(r.width/r.height)):e(zo(null))):(e(qu(!0)),e(zo(r.width/r.height)))},[n,r,e]),s=d.useCallback(()=>{e(vT()),e(zo(null)),n&&e(zo(r.height/r.width))},[e,n,r]);return a.jsxs(L,{sx:{gap:2,p:4,borderRadius:4,flexDirection:"column",w:"full",bg:"base.100",_dark:{bg:"base.750"}},children:[a.jsx(Et,{feature:"paramRatio",children:a.jsxs(Kt,{as:L,flexDir:"row",alignItems:"center",gap:2,children:[a.jsx(wn,{children:t("parameters.aspectRatio")}),a.jsx(ba,{}),a.jsx(NO,{}),a.jsx(Fe,{tooltip:t("ui.swapSizes"),"aria-label":t("ui.swapSizes"),size:"sm",icon:a.jsx(z8,{}),fontSize:20,onClick:s}),a.jsx(Fe,{tooltip:t("ui.lockRatio"),"aria-label":t("ui.lockRatio"),size:"sm",icon:a.jsx(mM,{}),isChecked:n,onClick:o})]})}),a.jsx(jde,{}),a.jsx(wde,{})]})}const Ide=le(xe,({ui:e,generation:t})=>{const{shouldUseSliders:n}=e,{shouldRandomizeSeed:r}=t;return{shouldUseSliders:n,activeLabel:r?void 0:"Manual Seed"}},Se),Pde=()=>{const{shouldUseSliders:e,activeLabel:t}=W(Ide);return a.jsx(oo,{label:"General",activeLabel:t,defaultIsOpen:!0,children:a.jsxs(L,{sx:{flexDirection:"column",gap:3},children:[e?a.jsxs(a.Fragment,{children:[a.jsx(rs,{}),a.jsx(Ps,{}),a.jsx(_s,{}),a.jsx(Is,{}),a.jsx(Ie,{pt:2,children:a.jsx(Es,{})}),a.jsx(uh,{})]}):a.jsxs(a.Fragment,{children:[a.jsxs(L,{gap:3,children:[a.jsx(rs,{}),a.jsx(Ps,{}),a.jsx(_s,{})]}),a.jsx(Is,{}),a.jsx(Ie,{pt:2,children:a.jsx(Es,{})}),a.jsx(uh,{})]}),a.jsx(zO,{})]})})},Ede=d.memo(Pde);function Mde(){return a.jsxs(a.Fragment,{children:[a.jsx(o2,{}),a.jsx(Ede,{}),a.jsx(s2,{}),a.jsx(Yc,{}),a.jsx(Xc,{}),a.jsx(qc,{}),a.jsx(HO,{}),a.jsx(BO,{}),a.jsx(Qc,{})]})}function i2(){return a.jsxs(L,{sx:{flexDirection:"column",gap:2},children:[a.jsx(RO,{}),a.jsx(OO,{})]})}function Ode(){const e=W(o=>o.generation.horizontalSymmetrySteps),t=W(o=>o.generation.steps),n=te(),{t:r}=Z();return a.jsx(tt,{label:r("parameters.hSymmetryStep"),value:e,onChange:o=>n(Ew(o)),min:0,max:t,step:1,withInput:!0,withSliderMarks:!0,withReset:!0,handleReset:()=>n(Ew(0))})}function Rde(){const e=W(o=>o.generation.verticalSymmetrySteps),t=W(o=>o.generation.steps),n=te(),{t:r}=Z();return a.jsx(tt,{label:r("parameters.vSymmetryStep"),value:e,onChange:o=>n(Mw(o)),min:0,max:t,step:1,withInput:!0,withSliderMarks:!0,withReset:!0,handleReset:()=>n(Mw(0))})}function Dde(){const e=W(n=>n.generation.shouldUseSymmetry),t=te();return a.jsx(dn,{label:"Enable Symmetry",isChecked:e,onChange:n=>t(xT(n.target.checked))})}const Ade=le(xe,e=>({activeLabel:e.generation.shouldUseSymmetry?"Enabled":void 0}),Se),Tde=()=>{const{t:e}=Z(),{activeLabel:t}=W(Ade);return Bt("symmetry").isFeatureEnabled?a.jsx(oo,{label:e("parameters.symmetry"),activeLabel:t,children:a.jsxs(L,{sx:{gap:2,flexDirection:"column"},children:[a.jsx(Dde,{}),a.jsx(Ode,{}),a.jsx(Rde,{})]})}):null},l2=d.memo(Tde),Nde=le([xe],({generation:e,hotkeys:t,config:n})=>{const{initial:r,min:o,sliderMax:s,inputMax:i,fineStep:l,coarseStep:u}=n.sd.img2imgStrength,{img2imgStrength:p}=e,m=t.shift?l:u;return{img2imgStrength:p,initial:r,min:o,sliderMax:s,inputMax:i,step:m}},Se),$de=()=>{const{img2imgStrength:e,initial:t,min:n,sliderMax:r,inputMax:o,step:s}=W(Nde),i=te(),{t:l}=Z(),u=d.useCallback(m=>i(Zp(m)),[i]),p=d.useCallback(()=>{i(Zp(t))},[i,t]);return a.jsx(Et,{feature:"paramDenoisingStrength",children:a.jsx(Rc,{children:a.jsx(tt,{label:`${l("parameters.denoisingStrength")}`,step:s,min:n,max:r,onChange:u,handleReset:p,value:e,isInteger:!1,withInput:!0,withSliderMarks:!0,withReset:!0,sliderNumberInputProps:{max:o}})})})},VO=d.memo($de),Lde=()=>{const e=W(n=>n.ui.shouldUseSliders),{iterationsAndSeedLabel:t}=a2();return a.jsx(oo,{label:"General",activeLabel:t,defaultIsOpen:!0,children:a.jsxs(L,{sx:{flexDirection:"column",gap:3},children:[e?a.jsxs(a.Fragment,{children:[a.jsx(rs,{}),a.jsx(Ps,{}),a.jsx(_s,{}),a.jsx(Is,{}),a.jsx(Ie,{pt:2,children:a.jsx(Es,{})}),a.jsx(Oc,{})]}):a.jsxs(a.Fragment,{children:[a.jsxs(L,{gap:3,children:[a.jsx(rs,{}),a.jsx(Ps,{}),a.jsx(_s,{})]}),a.jsx(Is,{}),a.jsx(Ie,{pt:2,children:a.jsx(Es,{})}),a.jsx(Oc,{})]}),a.jsx(VO,{}),a.jsx($O,{})]})})},zde=d.memo(Lde),Fde=()=>a.jsxs(a.Fragment,{children:[a.jsx(i2,{}),a.jsx(zde,{}),a.jsx(Yc,{}),a.jsx(Xc,{}),a.jsx(qc,{}),a.jsx(l2,{}),a.jsx(Qc,{})]}),Bde=d.memo(Fde),Hde=()=>a.jsxs(a.Fragment,{children:[a.jsx(i2,{}),a.jsx(FO,{}),a.jsx(Yc,{}),a.jsx(Xc,{}),a.jsx(qc,{}),a.jsx(l2,{}),a.jsx(Qc,{})]}),Vde=d.memo(Hde),Wde=()=>{const e=W(n=>n.ui.shouldUseSliders),{iterationsAndSeedLabel:t}=a2();return a.jsx(oo,{label:"General",activeLabel:t,defaultIsOpen:!0,children:a.jsxs(L,{sx:{flexDirection:"column",gap:3},children:[e?a.jsxs(a.Fragment,{children:[a.jsx(rs,{}),a.jsx(Ps,{}),a.jsx(_s,{}),a.jsx(Is,{}),a.jsx(Ie,{pt:2,children:a.jsx(Es,{})}),a.jsx(uh,{})]}):a.jsxs(a.Fragment,{children:[a.jsxs(L,{gap:3,children:[a.jsx(rs,{}),a.jsx(Ps,{}),a.jsx(_s,{})]}),a.jsx(Is,{}),a.jsx(Ie,{pt:2,children:a.jsx(Es,{})}),a.jsx(uh,{})]}),a.jsx(VO,{})]})})},Ude=d.memo(Wde),Gde=()=>a.jsxs(a.Fragment,{children:[a.jsx(i2,{}),a.jsx(Ude,{}),a.jsx(Yc,{}),a.jsx(Xc,{}),a.jsx(qc,{}),a.jsx(l2,{}),a.jsx(HO,{}),a.jsx(BO,{}),a.jsx(Qc,{})]}),Kde=d.memo(Gde),qde=()=>{const e=W(Jn),t=W(n=>n.generation.model);return e==="txt2img"?a.jsx(Kp,{children:t&&t.base_model==="sdxl"?a.jsx(Bue,{}):a.jsx(Vde,{})}):e==="img2img"?a.jsx(Kp,{children:t&&t.base_model==="sdxl"?a.jsx(Lue,{}):a.jsx(Bde,{})}):e==="unifiedCanvas"?a.jsx(Kp,{children:t&&t.base_model==="sdxl"?a.jsx(Mde,{}):a.jsx(Kde,{})}):null},Xde=d.memo(qde),Kp=d.memo(e=>a.jsxs(L,{sx:{w:"full",h:"full",flexDir:"column",gap:2},children:[a.jsx(Q8,{}),a.jsx(L,{layerStyle:"first",sx:{w:"full",h:"full",position:"relative",borderRadius:"base",p:2},children:a.jsx(L,{sx:{w:"full",h:"full",position:"relative"},children:a.jsx(Ie,{sx:{position:"absolute",top:0,left:0,right:0,bottom:0},children:a.jsx(hg,{defer:!0,style:{height:"100%",width:"100%"},options:{scrollbars:{visibility:"auto",autoHide:"scroll",autoHideDelay:800,theme:"os-theme-dark"},overflow:{x:"hidden"}},children:a.jsx(L,{sx:{gap:2,flexDirection:"column",h:"full",w:"full"},children:e.children})})})})})]}));Kp.displayName="ParametersPanelWrapper";const Qde=le([xe],e=>{const{initialImage:t}=e.generation;return{initialImage:t,isResetButtonDisabled:!t}},Se),Yde=()=>{const{initialImage:e}=W(Qde),{currentData:t}=to((e==null?void 0:e.imageName)??$r.skipToken),n=d.useMemo(()=>{if(t)return{id:"initial-image",payloadType:"IMAGE_DTO",payload:{imageDTO:t}}},[t]),r=d.useMemo(()=>({id:"initial-image",actionType:"SET_INITIAL_IMAGE"}),[]);return a.jsx(ua,{imageDTO:t,droppableData:r,draggableData:n,isUploadDisabled:!0,fitContainer:!0,dropLabel:"Set as Initial Image",noContentFallback:a.jsx(Zn,{label:"No initial image selected"}),dataTestId:"initial-image"})},Zde=d.memo(Yde),Jde=le([xe],e=>{const{initialImage:t}=e.generation;return{isResetButtonDisabled:!t}},Se),efe={type:"SET_INITIAL_IMAGE"},tfe=()=>{const{isResetButtonDisabled:e}=W(Jde),t=te(),{getUploadButtonProps:n,getUploadInputProps:r}=Vy({postUploadAction:efe}),o=d.useCallback(()=>{t(bT())},[t]);return a.jsxs(L,{layerStyle:"first",sx:{position:"relative",flexDirection:"column",height:"full",width:"full",alignItems:"center",justifyContent:"center",borderRadius:"base",p:2,gap:4},children:[a.jsxs(L,{sx:{w:"full",flexWrap:"wrap",justifyContent:"center",alignItems:"center",gap:2},children:[a.jsx(ve,{sx:{ps:2,fontWeight:600,userSelect:"none",color:"base.700",_dark:{color:"base.200"}},children:"Initial Image"}),a.jsx(ba,{}),a.jsx(Fe,{tooltip:"Upload Initial Image","aria-label":"Upload Initial Image",icon:a.jsx(cg,{}),...n()}),a.jsx(Fe,{tooltip:"Reset Initial Image","aria-label":"Reset Initial Image",icon:a.jsx(Ud,{}),onClick:o,isDisabled:e})]}),a.jsx(Zde,{}),a.jsx("input",{...r()})]})},nfe=d.memo(tfe),rfe=e=>{const{onClick:t,isDisabled:n}=e,{t:r}=Z(),o=W(s=>s.system.isConnected);return a.jsx(Fe,{onClick:t,icon:a.jsx(Br,{}),tooltip:`${r("gallery.deleteImage")} (Del)`,"aria-label":`${r("gallery.deleteImage")} (Del)`,isDisabled:n||!o,colorScheme:"error"})},WO=()=>{const[e,{isLoading:t}]=bh({fixedCacheKey:"enqueueBatch"}),[n,{isLoading:r}]=yT({fixedCacheKey:"enqueueGraph"}),[o,{isLoading:s}]=SI({fixedCacheKey:"resumeProcessor"}),[i,{isLoading:l}]=CI({fixedCacheKey:"pauseProcessor"}),[u,{isLoading:p}]=Yx({fixedCacheKey:"cancelQueueItem"}),[m,{isLoading:h}]=yI({fixedCacheKey:"clearQueue"}),[g,{isLoading:x}]=RI({fixedCacheKey:"pruneQueue"});return t||r||s||l||p||h||x},ofe=[{label:"RealESRGAN x2 Plus",value:"RealESRGAN_x2plus.pth",tooltip:"Attempts to retain sharpness, low smoothing",group:"x2 Upscalers"},{label:"RealESRGAN x4 Plus",value:"RealESRGAN_x4plus.pth",tooltip:"Best for photos and highly detailed images, medium smoothing",group:"x4 Upscalers"},{label:"RealESRGAN x4 Plus (anime 6B)",value:"RealESRGAN_x4plus_anime_6B.pth",tooltip:"Best for anime/manga, high smoothing",group:"x4 Upscalers"},{label:"ESRGAN SRx4",value:"ESRGAN_SRx4_DF2KOST_official-ff704c30.pth",tooltip:"Retains sharpness, low smoothing",group:"x4 Upscalers"}];function sfe(){const e=W(r=>r.postprocessing.esrganModelName),t=te(),n=r=>t(CT(r));return a.jsx(On,{label:"ESRGAN Model",value:e,itemComponent:ci,onChange:n,data:ofe})}const afe=e=>{const{imageDTO:t}=e,n=te(),r=WO(),{t:o}=Z(),{isOpen:s,onOpen:i,onClose:l}=Lr(),{isAllowedToUpscale:u,detail:p}=wT(t),m=d.useCallback(()=>{l(),!(!t||!u)&&n(DI({imageDTO:t}))},[n,t,u,l]);return a.jsx(qd,{isOpen:s,onClose:l,triggerComponent:a.jsx(Fe,{tooltip:o("parameters.upscale"),onClick:i,icon:a.jsx(uM,{}),"aria-label":o("parameters.upscale")}),children:a.jsxs(L,{sx:{flexDirection:"column",gap:4},children:[a.jsx(sfe,{}),a.jsx(at,{tooltip:p,size:"sm",isDisabled:!t||r||!u,onClick:m,children:o("parameters.upscaleImage")})]})})},ife=d.memo(afe),lfe=le([xe,Jn],({gallery:e,system:t,ui:n,config:r},o)=>{const{isConnected:s,shouldConfirmOnDelete:i,denoiseProgress:l}=t,{shouldShowImageDetails:u,shouldHidePreview:p,shouldShowProgressInViewer:m}=n,{shouldFetchMetadataFromApi:h}=r,g=e.selection[e.selection.length-1];return{shouldConfirmOnDelete:i,isConnected:s,shouldDisableToolbarButtons:!!(l!=null&&l.progress_image)||!g,shouldShowImageDetails:u,activeTabName:o,shouldHidePreview:p,shouldShowProgressInViewer:m,lastSelectedImage:g,shouldFetchMetadataFromApi:h}},{memoizeOptions:{resultEqualityCheck:Ft}}),cfe=e=>{const t=te(),{isConnected:n,shouldDisableToolbarButtons:r,shouldShowImageDetails:o,lastSelectedImage:s,shouldShowProgressInViewer:i,shouldFetchMetadataFromApi:l}=W(lfe),u=Bt("upscaling").isFeatureEnabled,p=WO(),m=sl(),{t:h}=Z(),{recallBothPrompts:g,recallSeed:x,recallAllParameters:y}=Sg(),{currentData:b}=to((s==null?void 0:s.image_name)??$r.skipToken),w=d.useMemo(()=>s?{image:s,shouldFetchMetadataFromApi:l}:$r.skipToken,[s,l]),{metadata:S,workflow:j,isLoading:_}=Gx(w,{selectFromResult:B=>{var V,U;return{isLoading:B.isFetching,metadata:(V=B==null?void 0:B.currentData)==null?void 0:V.metadata,workflow:(U=B==null?void 0:B.currentData)==null?void 0:U.workflow}}}),E=d.useCallback(()=>{j&&t(Xx(j))},[t,j]),I=d.useCallback(()=>{y(S)},[S,y]);et("a",()=>{},[S,y]);const M=d.useCallback(()=>{x(S==null?void 0:S.seed)},[S==null?void 0:S.seed,x]);et("s",M,[b]);const R=d.useCallback(()=>{g(S==null?void 0:S.positive_prompt,S==null?void 0:S.negative_prompt,S==null?void 0:S.positive_style_prompt,S==null?void 0:S.negative_style_prompt)},[S==null?void 0:S.negative_prompt,S==null?void 0:S.positive_prompt,S==null?void 0:S.positive_style_prompt,S==null?void 0:S.negative_style_prompt,g]);et("p",R,[b]),et("w",E,[j]);const D=d.useCallback(()=>{t(F8()),t(vh(b))},[t,b]);et("shift+i",D,[b]);const A=d.useCallback(()=>{b&&t(DI({imageDTO:b}))},[t,b]),O=d.useCallback(()=>{b&&t(xh([b]))},[t,b]);et("Shift+U",()=>{A()},{enabled:()=>!!(u&&!r&&n)},[u,b,r,n]);const T=d.useCallback(()=>t(ST(!o)),[t,o]);et("i",()=>{b?T():m({title:h("toast.metadataLoadFailed"),status:"error",duration:2500,isClosable:!0})},[b,o,m]),et("delete",()=>{O()},[t,b]);const X=d.useCallback(()=>{t(lI(!i))},[t,i]);return a.jsx(a.Fragment,{children:a.jsxs(L,{sx:{flexWrap:"wrap",justifyContent:"center",alignItems:"center",gap:2},...e,children:[a.jsx(Vt,{isAttached:!0,isDisabled:r,children:a.jsxs(Ah,{children:[a.jsx(Th,{as:Fe,"aria-label":h("parameters.imageActions"),tooltip:h("parameters.imageActions"),isDisabled:!b,icon:a.jsx(xoe,{})}),a.jsx(Ui,{motionProps:vc,children:b&&a.jsx(B8,{imageDTO:b})})]})}),a.jsxs(Vt,{isAttached:!0,isDisabled:r,children:[a.jsx(Fe,{isLoading:_,icon:a.jsx(Wy,{}),tooltip:`${h("nodes.loadWorkflow")} (W)`,"aria-label":`${h("nodes.loadWorkflow")} (W)`,isDisabled:!j,onClick:E}),a.jsx(Fe,{isLoading:_,icon:a.jsx(gM,{}),tooltip:`${h("parameters.usePrompt")} (P)`,"aria-label":`${h("parameters.usePrompt")} (P)`,isDisabled:!(S!=null&&S.positive_prompt),onClick:R}),a.jsx(Fe,{isLoading:_,icon:a.jsx(vM,{}),tooltip:`${h("parameters.useSeed")} (S)`,"aria-label":`${h("parameters.useSeed")} (S)`,isDisabled:(S==null?void 0:S.seed)===null||(S==null?void 0:S.seed)===void 0,onClick:M}),a.jsx(Fe,{isLoading:_,icon:a.jsx(aM,{}),tooltip:`${h("parameters.useAll")} (A)`,"aria-label":`${h("parameters.useAll")} (A)`,isDisabled:!S,onClick:I})]}),u&&a.jsx(Vt,{isAttached:!0,isDisabled:p,children:u&&a.jsx(ife,{imageDTO:b})}),a.jsx(Vt,{isAttached:!0,children:a.jsx(Fe,{icon:a.jsx(lM,{}),tooltip:`${h("parameters.info")} (I)`,"aria-label":`${h("parameters.info")} (I)`,isChecked:o,onClick:T})}),a.jsx(Vt,{isAttached:!0,children:a.jsx(Fe,{"aria-label":h("settings.displayInProgress"),tooltip:h("settings.displayInProgress"),icon:a.jsx(VJ,{}),isChecked:i,onClick:X})}),a.jsx(Vt,{isAttached:!0,children:a.jsx(rfe,{onClick:O})})]})})},ufe=d.memo(cfe),dfe=le([xe,Qx],(e,t)=>{var j,_;const{data:n,status:r}=kT.endpoints.listImages.select(t)(e),{data:o}=e.gallery.galleryView==="images"?Ow.endpoints.getBoardImagesTotal.select(t.board_id??"none")(e):Ow.endpoints.getBoardAssetsTotal.select(t.board_id??"none")(e),s=e.gallery.selection[e.gallery.selection.length-1],i=r==="pending";if(!n||!s||o===0)return{isFetching:i,queryArgs:t,isOnFirstImage:!0,isOnLastImage:!0};const l={...t,offset:n.ids.length,limit:bI},u=jT.getSelectors(),p=u.selectAll(n),m=p.findIndex(E=>E.image_name===s.image_name),h=Fi(m+1,0,p.length-1),g=Fi(m-1,0,p.length-1),x=(j=p[h])==null?void 0:j.image_name,y=(_=p[g])==null?void 0:_.image_name,b=x?u.selectById(n,x):void 0,w=y?u.selectById(n,y):void 0,S=p.length;return{loadedImagesCount:p.length,currentImageIndex:m,areMoreImagesAvailable:(o??0)>S,isFetching:r==="pending",nextImage:b,prevImage:w,queryArgs:l}},{memoizeOptions:{resultEqualityCheck:Ft}}),UO=()=>{const e=te(),{nextImage:t,prevImage:n,areMoreImagesAvailable:r,isFetching:o,queryArgs:s,loadedImagesCount:i,currentImageIndex:l}=W(dfe),u=d.useCallback(()=>{n&&e(Rw(n))},[e,n]),p=d.useCallback(()=>{t&&e(Rw(t))},[e,t]),[m]=xI(),h=d.useCallback(()=>{m(s)},[m,s]);return{handlePrevImage:u,handleNextImage:p,isOnFirstImage:l===0,isOnLastImage:l!==void 0&&l===i-1,nextImage:t,prevImage:n,areMoreImagesAvailable:r,handleLoadMoreImages:h,isFetching:o}};function ffe(e){return Te({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M245.09 327.74v-37.32c57.07 0 84.51 13.47 108.58 38.68 5.4 5.65 15 1.32 14.29-6.43-5.45-61.45-34.14-117.09-122.87-117.09v-37.32a8.32 8.32 0 00-14.05-6L146.58 242a8.2 8.2 0 000 11.94L231 333.71a8.32 8.32 0 0014.09-5.97z"}},{tag:"path",attr:{fill:"none",strokeMiterlimit:"10",strokeWidth:"32",d:"M256 64C150 64 64 150 64 256s86 192 192 192 192-86 192-192S362 64 256 64z"}}]})(e)}const pfe=({label:e,value:t,onClick:n,isLink:r,labelPosition:o,withCopy:s=!1})=>{const{t:i}=Z();return t?a.jsxs(L,{gap:2,children:[n&&a.jsx(Ht,{label:`Recall ${e}`,children:a.jsx(ys,{"aria-label":i("accessibility.useThisParameter"),icon:a.jsx(ffe,{}),size:"xs",variant:"ghost",fontSize:20,onClick:n})}),s&&a.jsx(Ht,{label:`Copy ${e}`,children:a.jsx(ys,{"aria-label":`Copy ${e}`,icon:a.jsx(Hc,{}),size:"xs",variant:"ghost",fontSize:14,onClick:()=>navigator.clipboard.writeText(t.toString())})}),a.jsxs(L,{direction:o?"column":"row",children:[a.jsxs(ve,{fontWeight:"semibold",whiteSpace:"pre-wrap",pr:2,children:[e,":"]}),r?a.jsxs(Oh,{href:t.toString(),isExternal:!0,wordBreak:"break-all",children:[t.toString()," ",a.jsx(JM,{mx:"2px"})]}):a.jsx(ve,{overflowY:"scroll",wordBreak:"break-all",children:t.toString()})]})]}):null},xr=d.memo(pfe),mfe=e=>{const{metadata:t}=e,{t:n}=Z(),{recallPositivePrompt:r,recallNegativePrompt:o,recallSeed:s,recallCfgScale:i,recallModel:l,recallScheduler:u,recallSteps:p,recallWidth:m,recallHeight:h,recallStrength:g,recallLoRA:x,recallControlNet:y,recallIPAdapter:b}=Sg(),w=d.useCallback(()=>{r(t==null?void 0:t.positive_prompt)},[t==null?void 0:t.positive_prompt,r]),S=d.useCallback(()=>{o(t==null?void 0:t.negative_prompt)},[t==null?void 0:t.negative_prompt,o]),j=d.useCallback(()=>{s(t==null?void 0:t.seed)},[t==null?void 0:t.seed,s]),_=d.useCallback(()=>{l(t==null?void 0:t.model)},[t==null?void 0:t.model,l]),E=d.useCallback(()=>{m(t==null?void 0:t.width)},[t==null?void 0:t.width,m]),I=d.useCallback(()=>{h(t==null?void 0:t.height)},[t==null?void 0:t.height,h]),M=d.useCallback(()=>{u(t==null?void 0:t.scheduler)},[t==null?void 0:t.scheduler,u]),R=d.useCallback(()=>{p(t==null?void 0:t.steps)},[t==null?void 0:t.steps,p]),D=d.useCallback(()=>{i(t==null?void 0:t.cfg_scale)},[t==null?void 0:t.cfg_scale,i]),A=d.useCallback(()=>{g(t==null?void 0:t.strength)},[t==null?void 0:t.strength,g]),O=d.useCallback(U=>{x(U)},[x]),T=d.useCallback(U=>{y(U)},[y]),X=d.useCallback(U=>{b(U)},[b]),B=d.useMemo(()=>t!=null&&t.controlnets?t.controlnets.filter(U=>c1(U.control_model)):[],[t==null?void 0:t.controlnets]),V=d.useMemo(()=>t!=null&&t.ipAdapters?t.ipAdapters.filter(U=>c1(U.ip_adapter_model)):[],[t==null?void 0:t.ipAdapters]);return!t||Object.keys(t).length===0?null:a.jsxs(a.Fragment,{children:[t.created_by&&a.jsx(xr,{label:n("metadata.createdBy"),value:t.created_by}),t.generation_mode&&a.jsx(xr,{label:n("metadata.generationMode"),value:t.generation_mode}),t.positive_prompt&&a.jsx(xr,{label:n("metadata.positivePrompt"),labelPosition:"top",value:t.positive_prompt,onClick:w}),t.negative_prompt&&a.jsx(xr,{label:n("metadata.negativePrompt"),labelPosition:"top",value:t.negative_prompt,onClick:S}),t.seed!==void 0&&t.seed!==null&&a.jsx(xr,{label:n("metadata.seed"),value:t.seed,onClick:j}),t.model!==void 0&&t.model!==null&&t.model.model_name&&a.jsx(xr,{label:n("metadata.model"),value:t.model.model_name,onClick:_}),t.width&&a.jsx(xr,{label:n("metadata.width"),value:t.width,onClick:E}),t.height&&a.jsx(xr,{label:n("metadata.height"),value:t.height,onClick:I}),t.scheduler&&a.jsx(xr,{label:n("metadata.scheduler"),value:t.scheduler,onClick:M}),t.steps&&a.jsx(xr,{label:n("metadata.steps"),value:t.steps,onClick:R}),t.cfg_scale!==void 0&&t.cfg_scale!==null&&a.jsx(xr,{label:n("metadata.cfgScale"),value:t.cfg_scale,onClick:D}),t.strength&&a.jsx(xr,{label:n("metadata.strength"),value:t.strength,onClick:A}),t.loras&&t.loras.map((U,N)=>{if(fI(U.lora))return a.jsx(xr,{label:"LoRA",value:`${U.lora.model_name} - ${U.weight}`,onClick:()=>O(U)},N)}),B.map((U,N)=>{var $;return a.jsx(xr,{label:"ControlNet",value:`${($=U.control_model)==null?void 0:$.model_name} - ${U.control_weight}`,onClick:()=>T(U)},N)}),V.map((U,N)=>{var $;return a.jsx(xr,{label:"IP Adapter",value:`${($=U.ip_adapter_model)==null?void 0:$.model_name} - ${U.weight}`,onClick:()=>X(U)},N)})]})},hfe=d.memo(mfe),gfe=({image:e})=>{const{t}=Z(),{shouldFetchMetadataFromApi:n}=W(Ky),{metadata:r,workflow:o}=Gx({image:e,shouldFetchMetadataFromApi:n},{selectFromResult:s=>{var i,l;return{metadata:(i=s==null?void 0:s.currentData)==null?void 0:i.metadata,workflow:(l=s==null?void 0:s.currentData)==null?void 0:l.workflow}}});return a.jsxs(L,{layerStyle:"first",sx:{padding:4,gap:1,flexDirection:"column",width:"full",height:"full",borderRadius:"base",position:"absolute",overflow:"hidden"},children:[a.jsxs(L,{gap:2,children:[a.jsx(ve,{fontWeight:"semibold",children:"File:"}),a.jsxs(Oh,{href:e.image_url,isExternal:!0,maxW:"calc(100% - 3rem)",children:[e.image_name,a.jsx(JM,{mx:"2px"})]})]}),a.jsx(hfe,{metadata:r}),a.jsxs(rl,{variant:"line",sx:{display:"flex",flexDir:"column",w:"full",h:"full"},children:[a.jsxs(ol,{children:[a.jsx(Tr,{children:t("metadata.metadata")}),a.jsx(Tr,{children:t("metadata.imageDetails")}),a.jsx(Tr,{children:t("metadata.workflow")})]}),a.jsxs(zc,{children:[a.jsx(So,{children:r?a.jsx(Ya,{data:r,label:t("metadata.metadata")}):a.jsx(Zn,{label:t("metadata.noMetaData")})}),a.jsx(So,{children:e?a.jsx(Ya,{data:e,label:t("metadata.imageDetails")}):a.jsx(Zn,{label:t("metadata.noImageDetails")})}),a.jsx(So,{children:o?a.jsx(Ya,{data:o,label:t("metadata.workflow")}):a.jsx(Zn,{label:t("nodes.noWorkflow")})})]})]})]})},vfe=d.memo(gfe),Yv={color:"base.100",pointerEvents:"auto"},xfe=()=>{const{t:e}=Z(),{handlePrevImage:t,handleNextImage:n,isOnFirstImage:r,isOnLastImage:o,handleLoadMoreImages:s,areMoreImagesAvailable:i,isFetching:l}=UO();return a.jsxs(Ie,{sx:{position:"relative",height:"100%",width:"100%"},children:[a.jsx(Ie,{sx:{pos:"absolute",top:"50%",transform:"translate(0, -50%)",insetInlineStart:0},children:!r&&a.jsx(ys,{"aria-label":e("accessibility.previousImage"),icon:a.jsx(kJ,{size:64}),variant:"unstyled",onClick:t,boxSize:16,sx:Yv})}),a.jsxs(Ie,{sx:{pos:"absolute",top:"50%",transform:"translate(0, -50%)",insetInlineEnd:0},children:[!o&&a.jsx(ys,{"aria-label":e("accessibility.nextImage"),icon:a.jsx(jJ,{size:64}),variant:"unstyled",onClick:n,boxSize:16,sx:Yv}),o&&i&&!l&&a.jsx(ys,{"aria-label":e("accessibility.loadMore"),icon:a.jsx(SJ,{size:64}),variant:"unstyled",onClick:s,boxSize:16,sx:Yv}),o&&i&&l&&a.jsx(L,{sx:{w:16,h:16,alignItems:"center",justifyContent:"center"},children:a.jsx(fa,{opacity:.5,size:"xl"})})]})]})},GO=d.memo(xfe),bfe=le([xe,_T],({ui:e,system:t},n)=>{const{shouldShowImageDetails:r,shouldHidePreview:o,shouldShowProgressInViewer:s}=e,{denoiseProgress:i,shouldAntialiasProgressImage:l}=t;return{shouldShowImageDetails:r,shouldHidePreview:o,imageName:n==null?void 0:n.image_name,denoiseProgress:i,shouldShowProgressInViewer:s,shouldAntialiasProgressImage:l}},{memoizeOptions:{resultEqualityCheck:Ft}}),yfe=()=>{const{shouldShowImageDetails:e,imageName:t,denoiseProgress:n,shouldShowProgressInViewer:r,shouldAntialiasProgressImage:o}=W(bfe),{handlePrevImage:s,handleNextImage:i,isOnLastImage:l,handleLoadMoreImages:u,areMoreImagesAvailable:p,isFetching:m}=UO();et("left",()=>{s()},[s]),et("right",()=>{if(l&&p&&!m){u();return}l||i()},[l,p,u,m,i]);const{currentData:h}=to(t??$r.skipToken),g=d.useMemo(()=>{if(h)return{id:"current-image",payloadType:"IMAGE_DTO",payload:{imageDTO:h}}},[h]),x=d.useMemo(()=>({id:"current-image",actionType:"SET_CURRENT_IMAGE"}),[]),[y,b]=d.useState(!1),w=d.useRef(0),{t:S}=Z(),j=d.useCallback(()=>{b(!0),window.clearTimeout(w.current)},[]),_=d.useCallback(()=>{w.current=window.setTimeout(()=>{b(!1)},500)},[]);return a.jsxs(L,{onMouseOver:j,onMouseOut:_,sx:{width:"full",height:"full",alignItems:"center",justifyContent:"center",position:"relative"},children:[n!=null&&n.progress_image&&r?a.jsx(ga,{src:n.progress_image.dataURL,width:n.progress_image.width,height:n.progress_image.height,draggable:!1,"data-testid":"progress-image",sx:{objectFit:"contain",maxWidth:"full",maxHeight:"full",height:"auto",position:"absolute",borderRadius:"base",imageRendering:o?"auto":"pixelated"}}):a.jsx(ua,{imageDTO:h,droppableData:x,draggableData:g,isUploadDisabled:!0,fitContainer:!0,useThumbailFallback:!0,dropLabel:S("gallery.setCurrentImage"),noContentFallback:a.jsx(Zn,{icon:Qi,label:"No image selected"}),dataTestId:"image-preview"}),e&&h&&a.jsx(Ie,{sx:{position:"absolute",top:"0",width:"full",height:"full",borderRadius:"base"},children:a.jsx(vfe,{image:h})}),a.jsx(dr,{children:!e&&h&&y&&a.jsx(In.div,{initial:{opacity:0},animate:{opacity:1,transition:{duration:.1}},exit:{opacity:0,transition:{duration:.1}},style:{position:"absolute",top:"0",width:"100%",height:"100%",pointerEvents:"none"},children:a.jsx(GO,{})},"nextPrevButtons")})]})},Cfe=d.memo(yfe),wfe=()=>a.jsxs(L,{sx:{position:"relative",flexDirection:"column",height:"100%",width:"100%",rowGap:4,alignItems:"center",justifyContent:"center"},children:[a.jsx(ufe,{}),a.jsx(Cfe,{})]}),Sfe=d.memo(wfe),kfe=()=>a.jsx(Ie,{layerStyle:"first",sx:{position:"relative",width:"100%",height:"100%",p:2,borderRadius:"base"},children:a.jsx(L,{sx:{width:"100%",height:"100%"},children:a.jsx(Sfe,{})})}),KO=d.memo(kfe),jfe=()=>{const e=d.useRef(null),t=d.useCallback(()=>{e.current&&e.current.setLayout([50,50])},[]),n=Jy();return a.jsx(Ie,{sx:{w:"full",h:"full"},children:a.jsxs(Ig,{ref:e,autoSaveId:"imageTab.content",direction:"horizontal",style:{height:"100%",width:"100%"},storage:n,units:"percentages",children:[a.jsx(Qa,{id:"imageTab.content.initImage",order:0,defaultSize:50,minSize:25,style:{position:"relative"},children:a.jsx(nfe,{})}),a.jsx(lh,{onDoubleClick:t}),a.jsx(Qa,{id:"imageTab.content.selectedImage",order:1,defaultSize:50,minSize:25,children:a.jsx(KO,{})})]})})},_fe=d.memo(jfe);var Ife=function e(t,n){if(t===n)return!0;if(t&&n&&typeof t=="object"&&typeof n=="object"){if(t.constructor!==n.constructor)return!1;var r,o,s;if(Array.isArray(t)){if(r=t.length,r!=n.length)return!1;for(o=r;o--!==0;)if(!e(t[o],n[o]))return!1;return!0}if(t.constructor===RegExp)return t.source===n.source&&t.flags===n.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===n.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===n.toString();if(s=Object.keys(t),r=s.length,r!==Object.keys(n).length)return!1;for(o=r;o--!==0;)if(!Object.prototype.hasOwnProperty.call(n,s[o]))return!1;for(o=r;o--!==0;){var i=s[o];if(!e(t[i],n[i]))return!1}return!0}return t!==t&&n!==n};const f_=xd(Ife);function Ex(e){return e===null||typeof e!="object"?{}:Object.keys(e).reduce((t,n)=>{const r=e[n];return r!=null&&r!==!1&&(t[n]=r),t},{})}var Pfe=Object.defineProperty,p_=Object.getOwnPropertySymbols,Efe=Object.prototype.hasOwnProperty,Mfe=Object.prototype.propertyIsEnumerable,m_=(e,t,n)=>t in e?Pfe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ofe=(e,t)=>{for(var n in t||(t={}))Efe.call(t,n)&&m_(e,n,t[n]);if(p_)for(var n of p_(t))Mfe.call(t,n)&&m_(e,n,t[n]);return e};function qO(e,t){if(t===null||typeof t!="object")return{};const n=Ofe({},t);return Object.keys(t).forEach(r=>{r.includes(`${String(e)}.`)&&delete n[r]}),n}const Rfe="__MANTINE_FORM_INDEX__";function h_(e,t){return t?typeof t=="boolean"?t:Array.isArray(t)?t.includes(e.replace(/[.][0-9]/g,`.${Rfe}`)):!1:!1}function g_(e,t,n){typeof n.value=="object"&&(n.value=tc(n.value)),!n.enumerable||n.get||n.set||!n.configurable||!n.writable||t==="__proto__"?Object.defineProperty(e,t,n):e[t]=n.value}function tc(e){if(typeof e!="object")return e;var t=0,n,r,o,s=Object.prototype.toString.call(e);if(s==="[object Object]"?o=Object.create(e.__proto__||null):s==="[object Array]"?o=Array(e.length):s==="[object Set]"?(o=new Set,e.forEach(function(i){o.add(tc(i))})):s==="[object Map]"?(o=new Map,e.forEach(function(i,l){o.set(tc(l),tc(i))})):s==="[object Date]"?o=new Date(+e):s==="[object RegExp]"?o=new RegExp(e.source,e.flags):s==="[object DataView]"?o=new e.constructor(tc(e.buffer)):s==="[object ArrayBuffer]"?o=e.slice(0):s.slice(-6)==="Array]"&&(o=new e.constructor(e)),o){for(r=Object.getOwnPropertySymbols(e);t0,errors:t}}function Mx(e,t,n="",r={}){return typeof e!="object"||e===null?r:Object.keys(e).reduce((o,s)=>{const i=e[s],l=`${n===""?"":`${n}.`}${s}`,u=Qs(l,t);let p=!1;return typeof i=="function"&&(o[l]=i(u,t,l)),typeof i=="object"&&Array.isArray(u)&&(p=!0,u.forEach((m,h)=>Mx(i,t,`${l}.${h}`,o))),typeof i=="object"&&typeof u=="object"&&u!==null&&(p||Mx(i,t,l,o)),o},r)}function Ox(e,t){return v_(typeof e=="function"?e(t):Mx(e,t))}function Dp(e,t,n){if(typeof e!="string")return{hasError:!1,error:null};const r=Ox(t,n),o=Object.keys(r.errors).find(s=>e.split(".").every((i,l)=>i===s.split(".")[l]));return{hasError:!!o,error:o?r.errors[o]:null}}function Dfe(e,{from:t,to:n},r){const o=Qs(e,r);if(!Array.isArray(o))return r;const s=[...o],i=o[t];return s.splice(t,1),s.splice(n,0,i),Ag(e,s,r)}var Afe=Object.defineProperty,x_=Object.getOwnPropertySymbols,Tfe=Object.prototype.hasOwnProperty,Nfe=Object.prototype.propertyIsEnumerable,b_=(e,t,n)=>t in e?Afe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,$fe=(e,t)=>{for(var n in t||(t={}))Tfe.call(t,n)&&b_(e,n,t[n]);if(x_)for(var n of x_(t))Nfe.call(t,n)&&b_(e,n,t[n]);return e};function Lfe(e,{from:t,to:n},r){const o=`${e}.${t}`,s=`${e}.${n}`,i=$fe({},r);return Object.keys(r).every(l=>{let u,p;if(l.startsWith(o)&&(u=l,p=l.replace(o,s)),l.startsWith(s)&&(u=l.replace(s,o),p=l),u&&p){const m=i[u],h=i[p];return h===void 0?delete i[u]:i[u]=h,m===void 0?delete i[p]:i[p]=m,!1}return!0}),i}function zfe(e,t,n){const r=Qs(e,n);return Array.isArray(r)?Ag(e,r.filter((o,s)=>s!==t),n):n}var Ffe=Object.defineProperty,y_=Object.getOwnPropertySymbols,Bfe=Object.prototype.hasOwnProperty,Hfe=Object.prototype.propertyIsEnumerable,C_=(e,t,n)=>t in e?Ffe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Vfe=(e,t)=>{for(var n in t||(t={}))Bfe.call(t,n)&&C_(e,n,t[n]);if(y_)for(var n of y_(t))Hfe.call(t,n)&&C_(e,n,t[n]);return e};function w_(e,t){const n=e.substring(t.length+1).split(".")[0];return parseInt(n,10)}function S_(e,t,n,r){if(t===void 0)return n;const o=`${String(e)}`;let s=n;r===-1&&(s=qO(`${o}.${t}`,s));const i=Vfe({},s),l=new Set;return Object.entries(s).filter(([u])=>{if(!u.startsWith(`${o}.`))return!1;const p=w_(u,o);return Number.isNaN(p)?!1:p>=t}).forEach(([u,p])=>{const m=w_(u,o),h=u.replace(`${o}.${m}`,`${o}.${m+r}`);i[h]=p,l.add(h),l.has(u)||delete i[u]}),i}function Wfe(e,t,n,r){const o=Qs(e,r);if(!Array.isArray(o))return r;const s=[...o];return s.splice(typeof n=="number"?n:s.length,0,t),Ag(e,s,r)}function k_(e,t){const n=Object.keys(e);if(typeof t=="string"){const r=n.filter(o=>o.startsWith(`${t}.`));return e[t]||r.some(o=>e[o])||!1}return n.some(r=>e[r])}function Ufe(e){return t=>{if(!t)e(t);else if(typeof t=="function")e(t);else if(typeof t=="object"&&"nativeEvent"in t){const{currentTarget:n}=t;n instanceof HTMLInputElement?n.type==="checkbox"?e(n.checked):e(n.value):(n instanceof HTMLTextAreaElement||n instanceof HTMLSelectElement)&&e(n.value)}else e(t)}}var Gfe=Object.defineProperty,Kfe=Object.defineProperties,qfe=Object.getOwnPropertyDescriptors,j_=Object.getOwnPropertySymbols,Xfe=Object.prototype.hasOwnProperty,Qfe=Object.prototype.propertyIsEnumerable,__=(e,t,n)=>t in e?Gfe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,La=(e,t)=>{for(var n in t||(t={}))Xfe.call(t,n)&&__(e,n,t[n]);if(j_)for(var n of j_(t))Qfe.call(t,n)&&__(e,n,t[n]);return e},Zv=(e,t)=>Kfe(e,qfe(t));function fl({initialValues:e={},initialErrors:t={},initialDirty:n={},initialTouched:r={},clearInputErrorOnChange:o=!0,validateInputOnChange:s=!1,validateInputOnBlur:i=!1,transformValues:l=p=>p,validate:u}={}){const[p,m]=d.useState(r),[h,g]=d.useState(n),[x,y]=d.useState(e),[b,w]=d.useState(Ex(t)),S=d.useRef(e),j=G=>{S.current=G},_=d.useCallback(()=>m({}),[]),E=G=>{const K=G?La(La({},x),G):x;j(K),g({})},I=d.useCallback(G=>w(K=>Ex(typeof G=="function"?G(K):G)),[]),M=d.useCallback(()=>w({}),[]),R=d.useCallback(()=>{y(e),M(),j(e),g({}),_()},[]),D=d.useCallback((G,K)=>I(ee=>Zv(La({},ee),{[G]:K})),[]),A=d.useCallback(G=>I(K=>{if(typeof G!="string")return K;const ee=La({},K);return delete ee[G],ee}),[]),O=d.useCallback(G=>g(K=>{if(typeof G!="string")return K;const ee=qO(G,K);return delete ee[G],ee}),[]),T=d.useCallback((G,K)=>{const ee=h_(G,s);O(G),m(ce=>Zv(La({},ce),{[G]:!0})),y(ce=>{const J=Ag(G,K,ce);if(ee){const ie=Dp(G,u,J);ie.hasError?D(G,ie.error):A(G)}return J}),!ee&&o&&D(G,null)},[]),X=d.useCallback(G=>{y(K=>{const ee=typeof G=="function"?G(K):G;return La(La({},K),ee)}),o&&M()},[]),B=d.useCallback((G,K)=>{O(G),y(ee=>Dfe(G,K,ee)),w(ee=>Lfe(G,K,ee))},[]),V=d.useCallback((G,K)=>{O(G),y(ee=>zfe(G,K,ee)),w(ee=>S_(G,K,ee,-1))},[]),U=d.useCallback((G,K,ee)=>{O(G),y(ce=>Wfe(G,K,ee,ce)),w(ce=>S_(G,ee,ce,1))},[]),N=d.useCallback(()=>{const G=Ox(u,x);return w(G.errors),G},[x,u]),$=d.useCallback(G=>{const K=Dp(G,u,x);return K.hasError?D(G,K.error):A(G),K},[x,u]),q=(G,{type:K="input",withError:ee=!0,withFocus:ce=!0}={})=>{const ie={onChange:Ufe(de=>T(G,de))};return ee&&(ie.error=b[G]),K==="checkbox"?ie.checked=Qs(G,x):ie.value=Qs(G,x),ce&&(ie.onFocus=()=>m(de=>Zv(La({},de),{[G]:!0})),ie.onBlur=()=>{if(h_(G,i)){const de=Dp(G,u,x);de.hasError?D(G,de.error):A(G)}}),ie},F=(G,K)=>ee=>{ee==null||ee.preventDefault();const ce=N();ce.hasErrors?K==null||K(ce.errors,x,ee):G==null||G(l(x),ee)},Q=G=>l(G||x),Y=d.useCallback(G=>{G.preventDefault(),R()},[]),se=G=>{if(G){const ee=Qs(G,h);if(typeof ee=="boolean")return ee;const ce=Qs(G,x),J=Qs(G,S.current);return!f_(ce,J)}return Object.keys(h).length>0?k_(h):!f_(x,S.current)},ae=d.useCallback(G=>k_(p,G),[p]),re=d.useCallback(G=>G?!Dp(G,u,x).hasError:!Ox(u,x).hasErrors,[x,u]);return{values:x,errors:b,setValues:X,setErrors:I,setFieldValue:T,setFieldError:D,clearFieldError:A,clearErrors:M,reset:R,validate:N,validateField:$,reorderListItem:B,removeListItem:V,insertListItem:U,getInputProps:q,onSubmit:F,onReset:Y,isDirty:se,isTouched:ae,setTouched:m,setDirty:g,resetTouched:_,resetDirty:E,isValid:re,getTransformedValues:Q}}function _n(e){const{...t}=e,{base50:n,base100:r,base200:o,base300:s,base800:i,base700:l,base900:u,accent500:p,accent300:m}=Wd(),{colorMode:h}=ha();return a.jsx(QE,{styles:()=>({input:{color:Ae(u,r)(h),backgroundColor:Ae(n,u)(h),borderColor:Ae(o,i)(h),borderWidth:2,outline:"none",":focus":{borderColor:Ae(m,p)(h)}},label:{color:Ae(l,s)(h),fontWeight:"normal",marginBottom:4}}),...t})}const Yfe=[{value:"sd-1",label:mn["sd-1"]},{value:"sd-2",label:mn["sd-2"]},{value:"sdxl",label:mn.sdxl},{value:"sdxl-refiner",label:mn["sdxl-refiner"]}];function Jd(e){const{...t}=e,{t:n}=Z();return a.jsx(On,{label:n("modelManager.baseModel"),data:Yfe,...t})}function QO(e){const{data:t}=AI(),{...n}=e;return a.jsx(On,{label:"Config File",placeholder:"Select A Config File",data:t||[],...n})}const Zfe=[{value:"normal",label:"Normal"},{value:"inpaint",label:"Inpaint"},{value:"depth",label:"Depth"}];function Tg(e){const{...t}=e,{t:n}=Z();return a.jsx(On,{label:n("modelManager.variant"),data:Zfe,...t})}function dh(e,t=!0){let n;t?n=new RegExp("[^\\\\/]+(?=\\.)"):n=new RegExp("[^\\\\/]+(?=[\\\\/]?$)");const r=e.match(n);return r?r[0]:""}function YO(e){const{t}=Z(),n=te(),{model_path:r}=e,o=fl({initialValues:{model_name:r?dh(r):"",base_model:"sd-1",model_type:"main",path:r||"",description:"",model_format:"checkpoint",error:void 0,vae:"",variant:"normal",config:"configs\\stable-diffusion\\v1-inference.yaml"}}),[s]=TI(),[i,l]=d.useState(!1),u=p=>{s({body:p}).unwrap().then(m=>{n(ct(Qt({title:t("modelManager.modelAdded",{modelName:p.model_name}),status:"success"}))),o.reset(),r&&n(Sd(null))}).catch(m=>{m&&n(ct(Qt({title:t("toast.modelAddFailed"),status:"error"})))})};return a.jsx("form",{onSubmit:o.onSubmit(p=>u(p)),style:{width:"100%"},children:a.jsxs(L,{flexDirection:"column",gap:2,children:[a.jsx(_n,{label:t("modelManager.model"),required:!0,...o.getInputProps("model_name")}),a.jsx(Jd,{label:t("modelManager.baseModel"),...o.getInputProps("base_model")}),a.jsx(_n,{label:t("modelManager.modelLocation"),required:!0,...o.getInputProps("path"),onBlur:p=>{if(o.values.model_name===""){const m=dh(p.currentTarget.value);m&&o.setFieldValue("model_name",m)}}}),a.jsx(_n,{label:t("modelManager.description"),...o.getInputProps("description")}),a.jsx(_n,{label:t("modelManager.vaeLocation"),...o.getInputProps("vae")}),a.jsx(Tg,{label:t("modelManager.variant"),...o.getInputProps("variant")}),a.jsxs(L,{flexDirection:"column",width:"100%",gap:2,children:[i?a.jsx(_n,{required:!0,label:t("modelManager.customConfigFileLocation"),...o.getInputProps("config")}):a.jsx(QO,{required:!0,width:"100%",...o.getInputProps("config")}),a.jsx(br,{isChecked:i,onChange:()=>l(!i),label:t("modelManager.useCustomConfig")}),a.jsx(at,{mt:2,type:"submit",children:t("modelManager.addModel")})]})]})})}function ZO(e){const{t}=Z(),n=te(),{model_path:r}=e,[o]=TI(),s=fl({initialValues:{model_name:r?dh(r,!1):"",base_model:"sd-1",model_type:"main",path:r||"",description:"",model_format:"diffusers",error:void 0,vae:"",variant:"normal"}}),i=l=>{o({body:l}).unwrap().then(u=>{n(ct(Qt({title:t("modelManager.modelAdded",{modelName:l.model_name}),status:"success"}))),s.reset(),r&&n(Sd(null))}).catch(u=>{u&&n(ct(Qt({title:t("toast.modelAddFailed"),status:"error"})))})};return a.jsx("form",{onSubmit:s.onSubmit(l=>i(l)),style:{width:"100%"},children:a.jsxs(L,{flexDirection:"column",gap:2,children:[a.jsx(_n,{required:!0,label:t("modelManager.model"),...s.getInputProps("model_name")}),a.jsx(Jd,{label:t("modelManager.baseModel"),...s.getInputProps("base_model")}),a.jsx(_n,{required:!0,label:t("modelManager.modelLocation"),placeholder:t("modelManager.modelLocationValidationMsg"),...s.getInputProps("path"),onBlur:l=>{if(s.values.model_name===""){const u=dh(l.currentTarget.value,!1);u&&s.setFieldValue("model_name",u)}}}),a.jsx(_n,{label:t("modelManager.description"),...s.getInputProps("description")}),a.jsx(_n,{label:t("modelManager.vaeLocation"),...s.getInputProps("vae")}),a.jsx(Tg,{label:t("modelManager.variant"),...s.getInputProps("variant")}),a.jsx(at,{mt:2,type:"submit",children:t("modelManager.addModel")})]})})}const JO=[{label:"Diffusers",value:"diffusers"},{label:"Checkpoint / Safetensors",value:"checkpoint"}];function Jfe(){const[e,t]=d.useState("diffusers"),{t:n}=Z();return a.jsxs(L,{flexDirection:"column",gap:4,width:"100%",children:[a.jsx(On,{label:n("modelManager.modelType"),value:e,data:JO,onChange:r=>{r&&t(r)}}),a.jsxs(L,{sx:{p:4,borderRadius:4,bg:"base.300",_dark:{bg:"base.850"}},children:[e==="diffusers"&&a.jsx(ZO,{}),e==="checkpoint"&&a.jsx(YO,{})]})]})}const epe=[{label:"None",value:"none"},{label:"v_prediction",value:"v_prediction"},{label:"epsilon",value:"epsilon"},{label:"sample",value:"sample"}];function tpe(){const e=te(),{t}=Z(),[n,{isLoading:r}]=NI(),o=fl({initialValues:{location:"",prediction_type:void 0}}),s=i=>{const l={location:i.location,prediction_type:i.prediction_type==="none"?void 0:i.prediction_type};n({body:l}).unwrap().then(u=>{e(ct(Qt({title:t("toast.modelAddedSimple"),status:"success"}))),o.reset()}).catch(u=>{u&&e(ct(Qt({title:`${u.data.detail} `,status:"error"})))})};return a.jsx("form",{onSubmit:o.onSubmit(i=>s(i)),style:{width:"100%"},children:a.jsxs(L,{flexDirection:"column",width:"100%",gap:4,children:[a.jsx(_n,{label:t("modelManager.modelLocation"),placeholder:t("modelManager.simpleModelDesc"),w:"100%",...o.getInputProps("location")}),a.jsx(On,{label:t("modelManager.predictionType"),data:epe,defaultValue:"none",...o.getInputProps("prediction_type")}),a.jsx(at,{type:"submit",isLoading:r,children:t("modelManager.addModel")})]})})}function npe(){const[e,t]=d.useState("simple");return a.jsxs(L,{flexDirection:"column",width:"100%",overflow:"scroll",maxHeight:window.innerHeight-250,gap:4,children:[a.jsxs(Vt,{isAttached:!0,children:[a.jsx(at,{size:"sm",isChecked:e=="simple",onClick:()=>t("simple"),children:"Simple"}),a.jsx(at,{size:"sm",isChecked:e=="advanced",onClick:()=>t("advanced"),children:"Advanced"})]}),a.jsxs(L,{sx:{p:4,borderRadius:4,background:"base.200",_dark:{background:"base.800"}},children:[e==="simple"&&a.jsx(tpe,{}),e==="advanced"&&a.jsx(Jfe,{})]})]})}function rpe(e){const{...t}=e;return a.jsx(V6,{w:"100%",...t,children:e.children})}function ope(){const e=W(b=>b.modelmanager.searchFolder),[t,n]=d.useState(""),{data:r}=Xo(Pi),{foundModels:o,alreadyInstalled:s,filteredModels:i}=$I({search_path:e||""},{selectFromResult:({data:b})=>{const w=K9(r==null?void 0:r.entities),S=nr(w,"path"),j=W9(b,S),_=Z9(b,S);return{foundModels:b,alreadyInstalled:I_(_,t),filteredModels:I_(j,t)}}}),[l,{isLoading:u}]=NI(),p=te(),{t:m}=Z(),h=d.useCallback(b=>{const w=b.currentTarget.id.split("\\").splice(-1)[0];l({body:{location:b.currentTarget.id}}).unwrap().then(S=>{p(ct(Qt({title:`Added Model: ${w}`,status:"success"})))}).catch(S=>{S&&p(ct(Qt({title:m("toast.modelAddFailed"),status:"error"})))})},[p,l,m]),g=d.useCallback(b=>{n(b.target.value)},[]),x=({models:b,showActions:w=!0})=>b.map(S=>a.jsxs(L,{sx:{p:4,gap:4,alignItems:"center",borderRadius:4,bg:"base.200",_dark:{bg:"base.800"}},children:[a.jsxs(L,{w:"100%",sx:{flexDirection:"column",minW:"25%"},children:[a.jsx(ve,{sx:{fontWeight:600},children:S.split("\\").slice(-1)[0]}),a.jsx(ve,{sx:{fontSize:"sm",color:"base.600",_dark:{color:"base.400"}},children:S})]}),w?a.jsxs(L,{gap:2,children:[a.jsx(at,{id:S,onClick:h,isLoading:u,children:m("modelManager.quickAdd")}),a.jsx(at,{onClick:()=>p(Sd(S)),isLoading:u,children:m("modelManager.advanced")})]}):a.jsx(ve,{sx:{fontWeight:600,p:2,borderRadius:4,color:"accent.50",bg:"accent.400",_dark:{color:"accent.100",bg:"accent.600"}},children:"Installed"})]},S));return(()=>e?!o||o.length===0?a.jsx(L,{sx:{w:"full",h:"full",justifyContent:"center",alignItems:"center",height:96,userSelect:"none",bg:"base.200",_dark:{bg:"base.900"}},children:a.jsx(ve,{variant:"subtext",children:m("modelManager.noModels")})}):a.jsxs(L,{sx:{flexDirection:"column",gap:2,w:"100%",minW:"50%"},children:[a.jsx(vo,{onChange:g,label:m("modelManager.search"),labelPos:"side"}),a.jsxs(L,{p:2,gap:2,children:[a.jsxs(ve,{sx:{fontWeight:600},children:["Models Found: ",o.length]}),a.jsxs(ve,{sx:{fontWeight:600,color:"accent.500",_dark:{color:"accent.200"}},children:["Not Installed: ",i.length]})]}),a.jsx(rpe,{offsetScrollbars:!0,children:a.jsxs(L,{gap:2,flexDirection:"column",children:[x({models:i}),x({models:s,showActions:!1})]})})]}):null)()}const I_=(e,t)=>{const n=[];return $n(e,r=>{if(!r)return null;r.includes(t)&&n.push(r)}),n};function spe(){const e=W(l=>l.modelmanager.advancedAddScanModel),{t}=Z(),[n,r]=d.useState("diffusers"),[o,s]=d.useState(!0);d.useEffect(()=>{e&&[".ckpt",".safetensors",".pth",".pt"].some(l=>e.endsWith(l))?r("checkpoint"):r("diffusers")},[e,r,o]);const i=te();return e?a.jsxs(Ie,{as:In.div,initial:{x:-100,opacity:0},animate:{x:0,opacity:1,transition:{duration:.2}},sx:{display:"flex",flexDirection:"column",minWidth:"40%",maxHeight:window.innerHeight-300,overflow:"scroll",p:4,gap:4,borderRadius:4,bg:"base.200",_dark:{bg:"base.800"}},children:[a.jsxs(L,{justifyContent:"space-between",alignItems:"center",children:[a.jsx(ve,{size:"xl",fontWeight:600,children:o||n==="checkpoint"?"Add Checkpoint Model":"Add Diffusers Model"}),a.jsx(Fe,{icon:a.jsx(Ic,{}),"aria-label":t("modelManager.closeAdvanced"),onClick:()=>i(Sd(null)),size:"sm"})]}),a.jsx(On,{label:t("modelManager.modelType"),value:n,data:JO,onChange:l=>{l&&(r(l),s(l==="checkpoint"))}}),o?a.jsx(YO,{model_path:e},e):a.jsx(ZO,{model_path:e},e)]}):null}function ape(){const e=te(),{t}=Z(),n=W(l=>l.modelmanager.searchFolder),{refetch:r}=$I({search_path:n||""}),o=fl({initialValues:{folder:""}}),s=d.useCallback(l=>{e(Dw(l.folder))},[e]),i=()=>{r()};return a.jsx("form",{onSubmit:o.onSubmit(l=>s(l)),style:{width:"100%"},children:a.jsxs(L,{sx:{w:"100%",gap:2,borderRadius:4,alignItems:"center"},children:[a.jsxs(L,{w:"100%",alignItems:"center",gap:4,minH:12,children:[a.jsx(ve,{sx:{fontSize:"sm",fontWeight:600,color:"base.700",minW:"max-content",_dark:{color:"base.300"}},children:"Folder"}),n?a.jsx(L,{sx:{w:"100%",p:2,px:4,bg:"base.300",borderRadius:4,fontSize:"sm",fontWeight:"bold",_dark:{bg:"base.700"}},children:n}):a.jsx(vo,{w:"100%",size:"md",...o.getInputProps("folder")})]}),a.jsxs(L,{gap:2,children:[n?a.jsx(Fe,{"aria-label":t("modelManager.scanAgain"),tooltip:t("modelManager.scanAgain"),icon:a.jsx(bM,{}),onClick:i,fontSize:18,size:"sm"}):a.jsx(Fe,{"aria-label":t("modelManager.findModels"),tooltip:t("modelManager.findModels"),icon:a.jsx(tee,{}),fontSize:18,size:"sm",type:"submit"}),a.jsx(Fe,{"aria-label":t("modelManager.clearCheckpointFolder"),tooltip:t("modelManager.clearCheckpointFolder"),icon:a.jsx(Br,{}),size:"sm",onClick:()=>{e(Dw(null)),e(Sd(null))},isDisabled:!n,colorScheme:"red"})]})]})})}const ipe=d.memo(ape);function lpe(){return a.jsxs(L,{flexDirection:"column",w:"100%",gap:4,children:[a.jsx(ipe,{}),a.jsxs(L,{gap:4,children:[a.jsx(L,{sx:{maxHeight:window.innerHeight-300,overflow:"scroll",gap:4,w:"100%"},children:a.jsx(ope,{})}),a.jsx(spe,{})]})]})}function cpe(){const[e,t]=d.useState("add"),{t:n}=Z();return a.jsxs(L,{flexDirection:"column",gap:4,children:[a.jsxs(Vt,{isAttached:!0,children:[a.jsx(at,{onClick:()=>t("add"),isChecked:e=="add",size:"sm",width:"100%",children:n("modelManager.addModel")}),a.jsx(at,{onClick:()=>t("scan"),isChecked:e=="scan",size:"sm",width:"100%",children:n("modelManager.scanForModels")})]}),e=="add"&&a.jsx(npe,{}),e=="scan"&&a.jsx(lpe,{})]})}const upe=[{label:"Stable Diffusion 1",value:"sd-1"},{label:"Stable Diffusion 2",value:"sd-2"}];function dpe(){var $,q;const{t:e}=Z(),t=te(),{data:n}=Xo(Pi),[r,{isLoading:o}]=IT(),[s,i]=d.useState("sd-1"),l=Gw(n==null?void 0:n.entities,(F,Q)=>(F==null?void 0:F.model_format)==="diffusers"&&(F==null?void 0:F.base_model)==="sd-1"),u=Gw(n==null?void 0:n.entities,(F,Q)=>(F==null?void 0:F.model_format)==="diffusers"&&(F==null?void 0:F.base_model)==="sd-2"),p=d.useMemo(()=>({"sd-1":l,"sd-2":u}),[l,u]),[m,h]=d.useState((($=Object.keys(p[s]))==null?void 0:$[0])??null),[g,x]=d.useState(((q=Object.keys(p[s]))==null?void 0:q[1])??null),[y,b]=d.useState(null),[w,S]=d.useState(""),[j,_]=d.useState(.5),[E,I]=d.useState("weighted_sum"),[M,R]=d.useState("root"),[D,A]=d.useState(""),[O,T]=d.useState(!1),X=Object.keys(p[s]).filter(F=>F!==g&&F!==y),B=Object.keys(p[s]).filter(F=>F!==m&&F!==y),V=Object.keys(p[s]).filter(F=>F!==m&&F!==g),U=F=>{i(F),h(null),x(null)},N=()=>{const F=[];let Q=[m,g,y];Q=Q.filter(se=>se!==null),Q.forEach(se=>{var re;const ae=(re=se==null?void 0:se.split("/"))==null?void 0:re[2];ae&&F.push(ae)});const Y={model_names:F,merged_model_name:w!==""?w:F.join("-"),alpha:j,interp:E,force:O,merge_dest_directory:M==="root"?void 0:D};r({base_model:s,body:Y}).unwrap().then(se=>{t(ct(Qt({title:e("modelManager.modelsMerged"),status:"success"})))}).catch(se=>{se&&t(ct(Qt({title:e("modelManager.modelsMergeFailed"),status:"error"})))})};return a.jsxs(L,{flexDirection:"column",rowGap:4,children:[a.jsxs(L,{sx:{flexDirection:"column",rowGap:1},children:[a.jsx(ve,{children:e("modelManager.modelMergeHeaderHelp1")}),a.jsx(ve,{fontSize:"sm",variant:"subtext",children:e("modelManager.modelMergeHeaderHelp2")})]}),a.jsxs(L,{columnGap:4,children:[a.jsx(On,{label:"Model Type",w:"100%",data:upe,value:s,onChange:U}),a.jsx(nn,{label:e("modelManager.modelOne"),w:"100%",value:m,placeholder:e("modelManager.selectModel"),data:X,onChange:F=>h(F)}),a.jsx(nn,{label:e("modelManager.modelTwo"),w:"100%",placeholder:e("modelManager.selectModel"),value:g,data:B,onChange:F=>x(F)}),a.jsx(nn,{label:e("modelManager.modelThree"),data:V,w:"100%",placeholder:e("modelManager.selectModel"),clearable:!0,onChange:F=>{F?(b(F),I("weighted_sum")):(b(null),I("add_difference"))}})]}),a.jsx(vo,{label:e("modelManager.mergedModelName"),value:w,onChange:F=>S(F.target.value)}),a.jsxs(L,{sx:{flexDirection:"column",padding:4,borderRadius:"base",gap:4,bg:"base.200",_dark:{bg:"base.800"}},children:[a.jsx(tt,{label:e("modelManager.alpha"),min:.01,max:.99,step:.01,value:j,onChange:F=>_(F),withInput:!0,withReset:!0,handleReset:()=>_(.5),withSliderMarks:!0}),a.jsx(ve,{variant:"subtext",fontSize:"sm",children:e("modelManager.modelMergeAlphaHelp")})]}),a.jsxs(L,{sx:{padding:4,borderRadius:"base",gap:4,bg:"base.200",_dark:{bg:"base.800"}},children:[a.jsx(ve,{fontWeight:500,fontSize:"sm",variant:"subtext",children:e("modelManager.interpolationType")}),a.jsx(cm,{value:E,onChange:F=>I(F),children:a.jsx(L,{columnGap:4,children:y===null?a.jsxs(a.Fragment,{children:[a.jsx(Ks,{value:"weighted_sum",children:a.jsx(ve,{fontSize:"sm",children:e("modelManager.weightedSum")})}),a.jsx(Ks,{value:"sigmoid",children:a.jsx(ve,{fontSize:"sm",children:e("modelManager.sigmoid")})}),a.jsx(Ks,{value:"inv_sigmoid",children:a.jsx(ve,{fontSize:"sm",children:e("modelManager.inverseSigmoid")})})]}):a.jsx(Ks,{value:"add_difference",children:a.jsx(Ht,{label:e("modelManager.modelMergeInterpAddDifferenceHelp"),children:a.jsx(ve,{fontSize:"sm",children:e("modelManager.addDifference")})})})})})]}),a.jsxs(L,{sx:{flexDirection:"column",padding:4,borderRadius:"base",gap:4,bg:"base.200",_dark:{bg:"base.900"}},children:[a.jsxs(L,{columnGap:4,children:[a.jsx(ve,{fontWeight:"500",fontSize:"sm",variant:"subtext",children:e("modelManager.mergedModelSaveLocation")}),a.jsx(cm,{value:M,onChange:F=>R(F),children:a.jsxs(L,{columnGap:4,children:[a.jsx(Ks,{value:"root",children:a.jsx(ve,{fontSize:"sm",children:e("modelManager.invokeAIFolder")})}),a.jsx(Ks,{value:"custom",children:a.jsx(ve,{fontSize:"sm",children:e("modelManager.custom")})})]})})]}),M==="custom"&&a.jsx(vo,{label:e("modelManager.mergedModelCustomSaveLocation"),value:D,onChange:F=>A(F.target.value)})]}),a.jsx(br,{label:e("modelManager.ignoreMismatch"),isChecked:O,onChange:F=>T(F.target.checked),fontWeight:"500"}),a.jsx(at,{onClick:N,isLoading:o,isDisabled:m===null||g===null,children:e("modelManager.merge")})]})}function fpe(e){const{model:t}=e,n=te(),{t:r}=Z(),[o,{isLoading:s}]=PT(),[i,l]=d.useState("InvokeAIRoot"),[u,p]=d.useState("");d.useEffect(()=>{l("InvokeAIRoot")},[t]);const m=()=>{l("InvokeAIRoot")},h=()=>{const g={base_model:t.base_model,model_name:t.model_name,convert_dest_directory:i==="Custom"?u:void 0};if(i==="Custom"&&u===""){n(ct(Qt({title:r("modelManager.noCustomLocationProvided"),status:"error"})));return}n(ct(Qt({title:`${r("modelManager.convertingModelBegin")}: ${t.model_name}`,status:"info"}))),o(g).unwrap().then(()=>{n(ct(Qt({title:`${r("modelManager.modelConverted")}: ${t.model_name}`,status:"success"})))}).catch(()=>{n(ct(Qt({title:`${r("modelManager.modelConversionFailed")}: ${t.model_name}`,status:"error"})))})};return a.jsxs(kg,{title:`${r("modelManager.convert")} ${t.model_name}`,acceptCallback:h,cancelCallback:m,acceptButtonText:`${r("modelManager.convert")}`,triggerComponent:a.jsxs(at,{size:"sm","aria-label":r("modelManager.convertToDiffusers"),className:" modal-close-btn",isLoading:s,children:["🧨 ",r("modelManager.convertToDiffusers")]}),motionPreset:"slideInBottom",children:[a.jsxs(L,{flexDirection:"column",rowGap:4,children:[a.jsx(ve,{children:r("modelManager.convertToDiffusersHelpText1")}),a.jsxs(Od,{children:[a.jsx(Qr,{children:r("modelManager.convertToDiffusersHelpText2")}),a.jsx(Qr,{children:r("modelManager.convertToDiffusersHelpText3")}),a.jsx(Qr,{children:r("modelManager.convertToDiffusersHelpText4")}),a.jsx(Qr,{children:r("modelManager.convertToDiffusersHelpText5")})]}),a.jsx(ve,{children:r("modelManager.convertToDiffusersHelpText6")})]}),a.jsxs(L,{flexDir:"column",gap:2,children:[a.jsxs(L,{marginTop:4,flexDir:"column",gap:2,children:[a.jsx(ve,{fontWeight:"600",children:r("modelManager.convertToDiffusersSaveLocation")}),a.jsx(cm,{value:i,onChange:g=>l(g),children:a.jsxs(L,{gap:4,children:[a.jsx(Ks,{value:"InvokeAIRoot",children:a.jsx(Ht,{label:"Save converted model in the InvokeAI root folder",children:r("modelManager.invokeRoot")})}),a.jsx(Ks,{value:"Custom",children:a.jsx(Ht,{label:"Save converted model in a custom folder",children:r("modelManager.custom")})})]})})]}),i==="Custom"&&a.jsxs(L,{flexDirection:"column",rowGap:2,children:[a.jsx(ve,{fontWeight:"500",fontSize:"sm",variant:"subtext",children:r("modelManager.customSaveLocation")}),a.jsx(vo,{value:u,onChange:g=>{p(g.target.value)},width:"full"})]})]})]})}function ppe(e){const{model:t}=e,[n,{isLoading:r}]=LI(),{data:o}=AI(),[s,i]=d.useState(!1);d.useEffect(()=>{o!=null&&o.includes(t.config)||i(!0)},[o,t.config]);const l=te(),{t:u}=Z(),p=fl({initialValues:{model_name:t.model_name?t.model_name:"",base_model:t.base_model,model_type:"main",path:t.path?t.path:"",description:t.description?t.description:"",model_format:"checkpoint",vae:t.vae?t.vae:"",config:t.config?t.config:"",variant:t.variant},validate:{path:h=>h.trim().length===0?"Must provide a path":null}}),m=d.useCallback(h=>{const g={base_model:t.base_model,model_name:t.model_name,body:h};n(g).unwrap().then(x=>{p.setValues(x),l(ct(Qt({title:u("modelManager.modelUpdated"),status:"success"})))}).catch(x=>{p.reset(),l(ct(Qt({title:u("modelManager.modelUpdateFailed"),status:"error"})))})},[p,l,t.base_model,t.model_name,u,n]);return a.jsxs(L,{flexDirection:"column",rowGap:4,width:"100%",children:[a.jsxs(L,{justifyContent:"space-between",alignItems:"center",children:[a.jsxs(L,{flexDirection:"column",children:[a.jsx(ve,{fontSize:"lg",fontWeight:"bold",children:t.model_name}),a.jsxs(ve,{fontSize:"sm",color:"base.400",children:[mn[t.base_model]," Model"]})]}),[""].includes(t.base_model)?a.jsx(Ds,{sx:{p:2,borderRadius:4,bg:"error.200",_dark:{bg:"error.400"}},children:"Conversion Not Supported"}):a.jsx(fpe,{model:t})]}),a.jsx(Yn,{}),a.jsx(L,{flexDirection:"column",maxHeight:window.innerHeight-270,overflowY:"scroll",children:a.jsx("form",{onSubmit:p.onSubmit(h=>m(h)),children:a.jsxs(L,{flexDirection:"column",overflowY:"scroll",gap:4,children:[a.jsx(_n,{label:u("modelManager.name"),...p.getInputProps("model_name")}),a.jsx(_n,{label:u("modelManager.description"),...p.getInputProps("description")}),a.jsx(Jd,{required:!0,...p.getInputProps("base_model")}),a.jsx(Tg,{required:!0,...p.getInputProps("variant")}),a.jsx(_n,{required:!0,label:u("modelManager.modelLocation"),...p.getInputProps("path")}),a.jsx(_n,{label:u("modelManager.vaeLocation"),...p.getInputProps("vae")}),a.jsxs(L,{flexDirection:"column",gap:2,children:[s?a.jsx(_n,{required:!0,label:u("modelManager.config"),...p.getInputProps("config")}):a.jsx(QO,{required:!0,...p.getInputProps("config")}),a.jsx(br,{isChecked:s,onChange:()=>i(!s),label:"Use Custom Config"})]}),a.jsx(at,{type:"submit",isLoading:r,children:u("modelManager.updateModel")})]})})})]})}function mpe(e){const{model:t}=e,[n,{isLoading:r}]=LI(),o=te(),{t:s}=Z(),i=fl({initialValues:{model_name:t.model_name?t.model_name:"",base_model:t.base_model,model_type:"main",path:t.path?t.path:"",description:t.description?t.description:"",model_format:"diffusers",vae:t.vae?t.vae:"",variant:t.variant},validate:{path:u=>u.trim().length===0?"Must provide a path":null}}),l=d.useCallback(u=>{const p={base_model:t.base_model,model_name:t.model_name,body:u};n(p).unwrap().then(m=>{i.setValues(m),o(ct(Qt({title:s("modelManager.modelUpdated"),status:"success"})))}).catch(m=>{i.reset(),o(ct(Qt({title:s("modelManager.modelUpdateFailed"),status:"error"})))})},[i,o,t.base_model,t.model_name,s,n]);return a.jsxs(L,{flexDirection:"column",rowGap:4,width:"100%",children:[a.jsxs(L,{flexDirection:"column",children:[a.jsx(ve,{fontSize:"lg",fontWeight:"bold",children:t.model_name}),a.jsxs(ve,{fontSize:"sm",color:"base.400",children:[mn[t.base_model]," Model"]})]}),a.jsx(Yn,{}),a.jsx("form",{onSubmit:i.onSubmit(u=>l(u)),children:a.jsxs(L,{flexDirection:"column",overflowY:"scroll",gap:4,children:[a.jsx(_n,{label:s("modelManager.name"),...i.getInputProps("model_name")}),a.jsx(_n,{label:s("modelManager.description"),...i.getInputProps("description")}),a.jsx(Jd,{required:!0,...i.getInputProps("base_model")}),a.jsx(Tg,{required:!0,...i.getInputProps("variant")}),a.jsx(_n,{required:!0,label:s("modelManager.modelLocation"),...i.getInputProps("path")}),a.jsx(_n,{label:s("modelManager.vaeLocation"),...i.getInputProps("vae")}),a.jsx(at,{type:"submit",isLoading:r,children:s("modelManager.updateModel")})]})})]})}function hpe(e){const{model:t}=e,[n,{isLoading:r}]=ET(),o=te(),{t:s}=Z(),i=fl({initialValues:{model_name:t.model_name?t.model_name:"",base_model:t.base_model,model_type:"lora",path:t.path?t.path:"",description:t.description?t.description:"",model_format:t.model_format},validate:{path:u=>u.trim().length===0?"Must provide a path":null}}),l=d.useCallback(u=>{const p={base_model:t.base_model,model_name:t.model_name,body:u};n(p).unwrap().then(m=>{i.setValues(m),o(ct(Qt({title:s("modelManager.modelUpdated"),status:"success"})))}).catch(m=>{i.reset(),o(ct(Qt({title:s("modelManager.modelUpdateFailed"),status:"error"})))})},[o,i,t.base_model,t.model_name,s,n]);return a.jsxs(L,{flexDirection:"column",rowGap:4,width:"100%",children:[a.jsxs(L,{flexDirection:"column",children:[a.jsx(ve,{fontSize:"lg",fontWeight:"bold",children:t.model_name}),a.jsxs(ve,{fontSize:"sm",color:"base.400",children:[mn[t.base_model]," Model ⋅"," ",MT[t.model_format]," format"]})]}),a.jsx(Yn,{}),a.jsx("form",{onSubmit:i.onSubmit(u=>l(u)),children:a.jsxs(L,{flexDirection:"column",overflowY:"scroll",gap:4,children:[a.jsx(_n,{label:s("modelManager.name"),...i.getInputProps("model_name")}),a.jsx(_n,{label:s("modelManager.description"),...i.getInputProps("description")}),a.jsx(Jd,{...i.getInputProps("base_model")}),a.jsx(_n,{label:s("modelManager.modelLocation"),...i.getInputProps("path")}),a.jsx(at,{type:"submit",isLoading:r,children:s("modelManager.updateModel")})]})})]})}function gpe(e){const{t}=Z(),n=te(),[r]=OT(),[o]=RT(),{model:s,isSelected:i,setSelectedModelId:l}=e,u=d.useCallback(()=>{l(s.id)},[s.id,l]),p=d.useCallback(()=>{const m={main:r,lora:o,onnx:r}[s.model_type];m(s).unwrap().then(h=>{n(ct(Qt({title:`${t("modelManager.modelDeleted")}: ${s.model_name}`,status:"success"})))}).catch(h=>{h&&n(ct(Qt({title:`${t("modelManager.modelDeleteFailed")}: ${s.model_name}`,status:"error"})))}),l(void 0)},[r,o,s,l,n,t]);return a.jsxs(L,{sx:{gap:2,alignItems:"center",w:"full"},children:[a.jsx(L,{as:at,isChecked:i,sx:{justifyContent:"start",p:2,borderRadius:"base",w:"full",alignItems:"center",bg:i?"accent.400":"base.100",color:i?"base.50":"base.800",_hover:{bg:i?"accent.500":"base.300",color:i?"base.50":"base.800"},_dark:{color:i?"base.50":"base.100",bg:i?"accent.600":"base.850",_hover:{color:i?"base.50":"base.100",bg:i?"accent.550":"base.700"}}},onClick:u,children:a.jsxs(L,{gap:4,alignItems:"center",children:[a.jsx(Ds,{minWidth:14,p:.5,fontSize:"sm",variant:"solid",children:DT[s.base_model]}),a.jsx(Ht,{label:s.description,hasArrow:!0,placement:"bottom",children:a.jsx(ve,{sx:{fontWeight:500},children:s.model_name})})]})}),a.jsx(kg,{title:t("modelManager.deleteModel"),acceptCallback:p,acceptButtonText:t("modelManager.delete"),triggerComponent:a.jsx(Fe,{icon:a.jsx(rne,{}),"aria-label":t("modelManager.deleteConfig"),colorScheme:"error"}),children:a.jsxs(L,{rowGap:4,flexDirection:"column",children:[a.jsx("p",{style:{fontWeight:"bold"},children:t("modelManager.deleteMsg1")}),a.jsx("p",{children:t("modelManager.deleteMsg2")})]})})]})}const vpe=e=>{const{selectedModelId:t,setSelectedModelId:n}=e,{t:r}=Z(),[o,s]=d.useState(""),[i,l]=d.useState("all"),{filteredDiffusersModels:u,isLoadingDiffusersModels:p}=Xo(Pi,{selectFromResult:({data:_,isLoading:E})=>({filteredDiffusersModels:Iu(_,"main","diffusers",o),isLoadingDiffusersModels:E})}),{filteredCheckpointModels:m,isLoadingCheckpointModels:h}=Xo(Pi,{selectFromResult:({data:_,isLoading:E})=>({filteredCheckpointModels:Iu(_,"main","checkpoint",o),isLoadingCheckpointModels:E})}),{filteredLoraModels:g,isLoadingLoraModels:x}=Cd(void 0,{selectFromResult:({data:_,isLoading:E})=>({filteredLoraModels:Iu(_,"lora",void 0,o),isLoadingLoraModels:E})}),{filteredOnnxModels:y,isLoadingOnnxModels:b}=Ku(Pi,{selectFromResult:({data:_,isLoading:E})=>({filteredOnnxModels:Iu(_,"onnx","onnx",o),isLoadingOnnxModels:E})}),{filteredOliveModels:w,isLoadingOliveModels:S}=Ku(Pi,{selectFromResult:({data:_,isLoading:E})=>({filteredOliveModels:Iu(_,"onnx","olive",o),isLoadingOliveModels:E})}),j=d.useCallback(_=>{s(_.target.value)},[]);return a.jsx(L,{flexDirection:"column",rowGap:4,width:"50%",minWidth:"50%",children:a.jsxs(L,{flexDirection:"column",gap:4,paddingInlineEnd:4,children:[a.jsxs(Vt,{isAttached:!0,children:[a.jsx(at,{onClick:()=>l("all"),isChecked:i==="all",size:"sm",children:r("modelManager.allModels")}),a.jsx(at,{size:"sm",onClick:()=>l("diffusers"),isChecked:i==="diffusers",children:r("modelManager.diffusersModels")}),a.jsx(at,{size:"sm",onClick:()=>l("checkpoint"),isChecked:i==="checkpoint",children:r("modelManager.checkpointModels")}),a.jsx(at,{size:"sm",onClick:()=>l("onnx"),isChecked:i==="onnx",children:r("modelManager.onnxModels")}),a.jsx(at,{size:"sm",onClick:()=>l("olive"),isChecked:i==="olive",children:r("modelManager.oliveModels")}),a.jsx(at,{size:"sm",onClick:()=>l("lora"),isChecked:i==="lora",children:r("modelManager.loraModels")})]}),a.jsx(vo,{onChange:j,label:r("modelManager.search"),labelPos:"side"}),a.jsxs(L,{flexDirection:"column",gap:4,maxHeight:window.innerHeight-280,overflow:"scroll",children:[p&&a.jsx(Xl,{loadingMessage:"Loading Diffusers..."}),["all","diffusers"].includes(i)&&!p&&u.length>0&&a.jsx(ql,{title:"Diffusers",modelList:u,selected:{selectedModelId:t,setSelectedModelId:n}},"diffusers"),h&&a.jsx(Xl,{loadingMessage:"Loading Checkpoints..."}),["all","checkpoint"].includes(i)&&!h&&m.length>0&&a.jsx(ql,{title:"Checkpoints",modelList:m,selected:{selectedModelId:t,setSelectedModelId:n}},"checkpoints"),x&&a.jsx(Xl,{loadingMessage:"Loading LoRAs..."}),["all","lora"].includes(i)&&!x&&g.length>0&&a.jsx(ql,{title:"LoRAs",modelList:g,selected:{selectedModelId:t,setSelectedModelId:n}},"loras"),S&&a.jsx(Xl,{loadingMessage:"Loading Olives..."}),["all","olive"].includes(i)&&!S&&w.length>0&&a.jsx(ql,{title:"Olives",modelList:w,selected:{selectedModelId:t,setSelectedModelId:n}},"olive"),b&&a.jsx(Xl,{loadingMessage:"Loading ONNX..."}),["all","onnx"].includes(i)&&!b&&y.length>0&&a.jsx(ql,{title:"ONNX",modelList:y,selected:{selectedModelId:t,setSelectedModelId:n}},"onnx")]})]})})},xpe=d.memo(vpe),Iu=(e,t,n,r)=>{const o=[];return $n(e==null?void 0:e.entities,s=>{if(!s)return;const i=s.model_name.toLowerCase().includes(r.toLowerCase()),l=n===void 0||s.model_format===n,u=s.model_type===t;i&&l&&u&&o.push(s)}),o},c2=d.memo(e=>a.jsx(L,{flexDirection:"column",gap:4,borderRadius:4,p:4,sx:{bg:"base.200",_dark:{bg:"base.800"}},children:e.children}));c2.displayName="StyledModelContainer";const ql=d.memo(e=>{const{title:t,modelList:n,selected:r}=e;return a.jsx(c2,{children:a.jsxs(L,{sx:{gap:2,flexDir:"column"},children:[a.jsx(ve,{variant:"subtext",fontSize:"sm",children:t}),n.map(o=>a.jsx(gpe,{model:o,isSelected:r.selectedModelId===o.id,setSelectedModelId:r.setSelectedModelId},o.id))]})})});ql.displayName="ModelListWrapper";const Xl=d.memo(({loadingMessage:e})=>a.jsx(c2,{children:a.jsxs(L,{justifyContent:"center",alignItems:"center",flexDirection:"column",p:4,gap:8,children:[a.jsx(fa,{}),a.jsx(ve,{variant:"subtext",children:e||"Fetching..."})]})}));Xl.displayName="FetchingModelsLoader";function bpe(){const[e,t]=d.useState(),{mainModel:n}=Xo(Pi,{selectFromResult:({data:s})=>({mainModel:e?s==null?void 0:s.entities[e]:void 0})}),{loraModel:r}=Cd(void 0,{selectFromResult:({data:s})=>({loraModel:e?s==null?void 0:s.entities[e]:void 0})}),o=n||r;return a.jsxs(L,{sx:{gap:8,w:"full",h:"full"},children:[a.jsx(xpe,{selectedModelId:e,setSelectedModelId:t}),a.jsx(ype,{model:o})]})}const ype=e=>{const{model:t}=e;return(t==null?void 0:t.model_format)==="checkpoint"?a.jsx(ppe,{model:t},t.id):(t==null?void 0:t.model_format)==="diffusers"?a.jsx(mpe,{model:t},t.id):(t==null?void 0:t.model_type)==="lora"?a.jsx(hpe,{model:t},t.id):a.jsx(L,{sx:{w:"full",h:"full",justifyContent:"center",alignItems:"center",maxH:96,userSelect:"none"},children:a.jsx(ve,{variant:"subtext",children:"No Model Selected"})})};function Cpe(){const{t:e}=Z();return a.jsxs(L,{sx:{w:"full",p:4,borderRadius:4,gap:4,justifyContent:"space-between",alignItems:"center",bg:"base.200",_dark:{bg:"base.800"}},children:[a.jsxs(L,{sx:{flexDirection:"column",gap:2},children:[a.jsx(ve,{sx:{fontWeight:600},children:e("modelManager.syncModels")}),a.jsx(ve,{fontSize:"sm",sx:{_dark:{color:"base.400"}},children:e("modelManager.syncModelsDesc")})]}),a.jsx(Gc,{})]})}function wpe(){return a.jsx(L,{children:a.jsx(Cpe,{})})}const P_=[{id:"modelManager",label:yt.t("modelManager.modelManager"),content:a.jsx(bpe,{})},{id:"importModels",label:yt.t("modelManager.importModels"),content:a.jsx(cpe,{})},{id:"mergeModels",label:yt.t("modelManager.mergeModels"),content:a.jsx(dpe,{})},{id:"settings",label:yt.t("modelManager.settings"),content:a.jsx(wpe,{})}],Spe=()=>a.jsxs(rl,{isLazy:!0,variant:"line",layerStyle:"first",sx:{w:"full",h:"full",p:4,gap:4,borderRadius:"base"},children:[a.jsx(ol,{children:P_.map(e=>a.jsx(Tr,{sx:{borderTopRadius:"base"},children:e.label},e.id))}),a.jsx(zc,{sx:{w:"full",h:"full"},children:P_.map(e=>a.jsx(So,{sx:{w:"full",h:"full"},children:e.content},e.id))})]}),kpe=d.memo(Spe),jpe={enum:"",BoardField:void 0,boolean:!1,BooleanCollection:[],BooleanPolymorphic:!1,ClipField:void 0,Collection:[],CollectionItem:void 0,ColorCollection:[],ColorField:void 0,ColorPolymorphic:void 0,ConditioningCollection:[],ConditioningField:void 0,ConditioningPolymorphic:void 0,ControlCollection:[],ControlField:void 0,ControlNetModelField:void 0,ControlPolymorphic:void 0,DenoiseMaskField:void 0,float:0,FloatCollection:[],FloatPolymorphic:0,ImageCollection:[],ImageField:void 0,ImagePolymorphic:void 0,integer:0,IntegerCollection:[],IntegerPolymorphic:0,IPAdapterField:void 0,IPAdapterModelField:void 0,LatentsCollection:[],LatentsField:void 0,LatentsPolymorphic:void 0,LoRAModelField:void 0,MainModelField:void 0,ONNXModelField:void 0,Scheduler:"euler",SDXLMainModelField:void 0,SDXLRefinerModelField:void 0,string:"",StringCollection:[],StringPolymorphic:"",UNetField:void 0,VaeField:void 0,VaeModelField:void 0},_pe=(e,t)=>{const n={id:e,name:t.name,type:t.type,label:"",fieldKind:"input"};return n.value=t.default??jpe[t.type],n},Ipe=le([e=>e.nodes],e=>e.nodeTemplates),Jv={dragHandle:`.${tl}`},Ppe=()=>{const e=W(Ipe),t=rb();return d.useCallback(n=>{var x;const r=Zs();let o=window.innerWidth/2,s=window.innerHeight/2;const i=(x=document.querySelector("#workflow-editor"))==null?void 0:x.getBoundingClientRect();i&&(o=i.width/2-g1/2,s=i.height/2-g1/2);const{x:l,y:u}=t.project({x:o,y:s});if(n==="current_image")return{...Jv,id:r,type:"current_image",position:{x:l,y:u},data:{id:r,type:"current_image",isOpen:!0,label:"Current Image"}};if(n==="notes")return{...Jv,id:r,type:"notes",position:{x:l,y:u},data:{id:r,isOpen:!0,label:"Notes",notes:"",type:"notes"}};const p=e[n];if(p===void 0){console.error(`Unable to find template ${n}.`);return}const m=Aw(p.inputs,(y,b,w)=>{const S=Zs(),j=_pe(S,b);return y[w]=j,y},{}),h=Aw(p.outputs,(y,b,w)=>{const j={id:Zs(),name:w,type:b.type,fieldKind:"output"};return y[w]=j,y},{});return{...Jv,id:r,type:"invocation",position:{x:l,y:u},data:{id:r,type:n,version:p.version,label:"",notes:"",isOpen:!0,embedWorkflow:!1,isIntermediate:n!=="save_image",inputs:m,outputs:h,useCache:p.useCache}}},[e,t])},e7=d.forwardRef(({label:e,description:t,...n},r)=>a.jsx("div",{ref:r,...n,children:a.jsxs("div",{children:[a.jsx(ve,{fontWeight:600,children:e}),a.jsx(ve,{size:"xs",sx:{color:"base.600",_dark:{color:"base.500"}},children:t})]})}));e7.displayName="AddNodePopoverSelectItem";const Epe=(e,t)=>{const n=new RegExp(e.trim().replace(/[-[\]{}()*+!<=:?./\\^$|#,]/g,"").split(" ").join(".*"),"gi");return n.test(t.label)||n.test(t.description)||t.tags.some(r=>n.test(r))},Mpe=()=>{const e=te(),t=Ppe(),n=sl(),{t:r}=Z(),o=W(w=>w.nodes.currentConnectionFieldType),s=W(w=>{var S;return(S=w.nodes.connectionStartParams)==null?void 0:S.handleType}),i=le([xe],({nodes:w})=>{const S=o?AT(w.nodeTemplates,_=>{const E=s=="source"?_.inputs:_.outputs;return Xr(E,I=>{const M=s=="source"?o:I.type,R=s=="target"?o:I.type;return ob(M,R)})}):nr(w.nodeTemplates),j=nr(S,_=>({label:_.title,value:_.type,description:_.description,tags:_.tags}));return o===null&&(j.push({label:r("nodes.currentImage"),value:"current_image",description:r("nodes.currentImageDescription"),tags:["progress"]}),j.push({label:r("nodes.notes"),value:"notes",description:r("nodes.notesDescription"),tags:["notes"]})),j.sort((_,E)=>_.label.localeCompare(E.label)),{data:j,t:r}},Se),{data:l}=W(i),u=W(w=>w.nodes.isAddNodePopoverOpen),p=d.useRef(null),m=d.useCallback(w=>{const S=t(w);if(!S){const j=r("nodes.unknownNode",{nodeType:w});n({status:"error",title:j});return}e(TT(S))},[e,t,n,r]),h=d.useCallback(w=>{w&&m(w)},[m]),g=d.useCallback(()=>{e(NT())},[e]),x=d.useCallback(()=>{e(zI())},[e]),y=d.useCallback(w=>{w.preventDefault(),x(),setTimeout(()=>{var S;(S=p.current)==null||S.focus()},0)},[x]),b=d.useCallback(()=>{g()},[g]);return et(["shift+a","space"],y),et(["escape"],b),a.jsxs(Ld,{initialFocusRef:p,isOpen:u,onClose:g,placement:"bottom",openDelay:0,closeDelay:0,closeOnBlur:!0,returnFocusOnClose:!0,children:[a.jsx(B3,{children:a.jsx(L,{sx:{position:"absolute",top:"15%",insetInlineStart:"50%",pointerEvents:"none"}})}),a.jsx(zd,{sx:{p:0,top:-1,shadow:"dark-lg",borderColor:"accent.300",borderWidth:"2px",borderStyle:"solid",_dark:{borderColor:"accent.400"}},children:a.jsx(Uh,{sx:{p:0},children:a.jsx(nn,{inputRef:p,selectOnBlur:!1,placeholder:r("nodes.nodeSearch"),value:null,data:l,maxDropdownHeight:400,nothingFound:r("nodes.noMatchingNodes"),itemComponent:e7,filter:Epe,onChange:h,hoverOnSearchChange:!0,onDropdownClose:g,sx:{width:"32rem",input:{padding:"0.5rem"}}})})})]})},Ope=d.memo(Mpe),Rpe=()=>{const e=rb(),t=W(r=>r.nodes.shouldValidateGraph);return d.useCallback(({source:r,sourceHandle:o,target:s,targetHandle:i})=>{var x,y;const l=e.getEdges(),u=e.getNodes();if(!(r&&o&&s&&i))return!1;const p=e.getNode(r),m=e.getNode(s);if(!(p&&m&&p.data&&m.data))return!1;const h=(x=p.data.outputs[o])==null?void 0:x.type,g=(y=m.data.inputs[i])==null?void 0:y.type;return!h||!g||r===s?!1:t?l.find(b=>{b.target===s&&b.targetHandle===i&&b.source===r&&b.sourceHandle})||l.find(b=>b.target===s&&b.targetHandle===i)&&g!=="CollectionItem"||!ob(h,g)?!1:FI(r,s,u,l):!0},[e,t])},hd=e=>`var(--invokeai-colors-${e.split(".").join("-")})`,Dpe=le(xe,({nodes:e})=>{const{shouldAnimateEdges:t,currentConnectionFieldType:n,shouldColorEdges:r}=e,o=hd(n&&r?wd[n].color:"base.500");let s="react-flow__custom_connection-path";return t&&(s=s.concat(" animated")),{stroke:o,className:s}}),Ape=({fromX:e,fromY:t,fromPosition:n,toX:r,toY:o,toPosition:s})=>{const{stroke:i,className:l}=W(Dpe),u={sourceX:e,sourceY:t,sourcePosition:n,targetX:r,targetY:o,targetPosition:s},[p]=sb(u);return a.jsx("g",{children:a.jsx("path",{fill:"none",stroke:i,strokeWidth:2,className:l,d:p,style:{opacity:.8}})})},Tpe=d.memo(Ape),t7=(e,t,n,r,o)=>le(xe,({nodes:s})=>{var g,x;const i=s.nodes.find(y=>y.id===e),l=s.nodes.find(y=>y.id===n),u=Mn(i)&&Mn(l),p=(i==null?void 0:i.selected)||(l==null?void 0:l.selected)||o,m=u?(x=(g=i==null?void 0:i.data)==null?void 0:g.outputs[t||""])==null?void 0:x.type:void 0,h=m&&s.shouldColorEdges?hd(wd[m].color):hd("base.500");return{isSelected:p,shouldAnimate:s.shouldAnimateEdges&&p,stroke:h}},Se),Npe=({sourceX:e,sourceY:t,targetX:n,targetY:r,sourcePosition:o,targetPosition:s,markerEnd:i,data:l,selected:u,source:p,target:m,sourceHandleId:h,targetHandleId:g})=>{const x=d.useMemo(()=>t7(p,h,m,g,u),[u,p,h,m,g]),{isSelected:y,shouldAnimate:b}=W(x),[w,S,j]=sb({sourceX:e,sourceY:t,sourcePosition:o,targetX:n,targetY:r,targetPosition:s}),{base500:_}=Wd();return a.jsxs(a.Fragment,{children:[a.jsx(BI,{path:w,markerEnd:i,style:{strokeWidth:y?3:2,stroke:_,opacity:y?.8:.5,animation:b?"dashdraw 0.5s linear infinite":void 0,strokeDasharray:b?5:"none"}}),(l==null?void 0:l.count)&&l.count>1&&a.jsx($T,{children:a.jsx(L,{sx:{position:"absolute",transform:`translate(-50%, -50%) translate(${S}px,${j}px)`},className:"nodrag nopan",children:a.jsx(Ds,{variant:"solid",sx:{bg:"base.500",opacity:y?.8:.5,boxShadow:"base"},children:l.count})})})]})},$pe=d.memo(Npe),Lpe=({sourceX:e,sourceY:t,targetX:n,targetY:r,sourcePosition:o,targetPosition:s,markerEnd:i,selected:l,source:u,target:p,sourceHandleId:m,targetHandleId:h})=>{const g=d.useMemo(()=>t7(u,m,p,h,l),[u,m,p,h,l]),{isSelected:x,shouldAnimate:y,stroke:b}=W(g),[w]=sb({sourceX:e,sourceY:t,sourcePosition:o,targetX:n,targetY:r,targetPosition:s});return a.jsx(BI,{path:w,markerEnd:i,style:{strokeWidth:x?3:2,stroke:b,opacity:x?.8:.5,animation:y?"dashdraw 0.5s linear infinite":void 0,strokeDasharray:y?5:"none"}})},zpe=d.memo(Lpe),Fpe=e=>{const{nodeId:t,width:n,children:r,selected:o}=e,{isMouseOverNode:s,handleMouseOut:i,handleMouseOver:l}=fO(t),u=d.useMemo(()=>le(xe,({nodes:j})=>{var _;return((_=j.nodeExecutionStates[t])==null?void 0:_.status)===Ys.IN_PROGRESS}),[t]),p=W(u),[m,h,g,x]=Ho("shadows",["nodeInProgress.light","nodeInProgress.dark","shadows.xl","shadows.base"]),y=te(),b=sa(m,h),w=W(j=>j.nodes.nodeOpacity),S=d.useCallback(j=>{!j.ctrlKey&&!j.altKey&&!j.metaKey&&!j.shiftKey&&y(LT(t)),y(HI())},[y,t]);return a.jsxs(Ie,{onClick:S,onMouseEnter:l,onMouseLeave:i,className:tl,sx:{h:"full",position:"relative",borderRadius:"base",w:n??g1,transitionProperty:"common",transitionDuration:"0.1s",cursor:"grab",opacity:w},children:[a.jsx(Ie,{sx:{position:"absolute",top:0,insetInlineEnd:0,bottom:0,insetInlineStart:0,borderRadius:"base",pointerEvents:"none",shadow:`${g}, ${x}, ${x}`,zIndex:-1}}),a.jsx(Ie,{sx:{position:"absolute",top:0,insetInlineEnd:0,bottom:0,insetInlineStart:0,borderRadius:"md",pointerEvents:"none",transitionProperty:"common",transitionDuration:"0.1s",opacity:.7,shadow:p?b:void 0,zIndex:-1}}),r,a.jsx(dO,{isSelected:o,isHovered:s})]})},Ng=d.memo(Fpe),Bpe=le(xe,({system:e,gallery:t})=>{var r;return{imageDTO:t.selection[t.selection.length-1],progressImage:(r=e.denoiseProgress)==null?void 0:r.progress_image}}),Hpe=e=>{const{progressImage:t,imageDTO:n}=zT(Bpe);return t?a.jsx(e1,{nodeProps:e,children:a.jsx(ga,{src:t.dataURL,sx:{w:"full",h:"full",objectFit:"contain",borderRadius:"base"}})}):n?a.jsx(e1,{nodeProps:e,children:a.jsx(ua,{imageDTO:n,isDragDisabled:!0,useThumbailFallback:!0})}):a.jsx(e1,{nodeProps:e,children:a.jsx(Zn,{})})},Vpe=d.memo(Hpe),e1=e=>{const[t,n]=d.useState(!1),r=()=>{n(!0)},o=()=>{n(!1)};return a.jsx(Ng,{nodeId:e.nodeProps.id,selected:e.nodeProps.selected,width:384,children:a.jsxs(L,{onMouseEnter:r,onMouseLeave:o,className:tl,sx:{position:"relative",flexDirection:"column"},children:[a.jsx(L,{layerStyle:"nodeHeader",sx:{borderTopRadius:"base",alignItems:"center",justifyContent:"center",h:8},children:a.jsx(ve,{sx:{fontSize:"sm",fontWeight:600,color:"base.700",_dark:{color:"base.200"}},children:"Current Image"})}),a.jsxs(L,{layerStyle:"nodeBody",sx:{w:"full",h:"full",borderBottomRadius:"base",p:2},children:[e.children,t&&a.jsx(In.div,{initial:{opacity:0},animate:{opacity:1,transition:{duration:.1}},exit:{opacity:0,transition:{duration:.1}},style:{position:"absolute",top:40,left:-2,right:-2,bottom:0,pointerEvents:"none"},children:a.jsx(GO,{})},"nextPrevButtons")]})]})})},Wpe=e=>{const t=d.useMemo(()=>le(xe,({nodes:r})=>{const o=r.nodes.find(i=>i.id===e);if(!Mn(o))return[];const s=r.nodeTemplates[o.data.type];return s?nr(s.inputs).filter(i=>(["any","direct"].includes(i.input)||ab.includes(i.type))&&VI.includes(i.type)).filter(i=>!i.ui_hidden).sort((i,l)=>(i.ui_order??0)-(l.ui_order??0)).map(i=>i.name).filter(i=>i!=="is_intermediate"):[]},Se),[e]);return W(t)},Upe=e=>{const t=d.useMemo(()=>le(xe,({nodes:r})=>{const o=r.nodes.find(i=>i.id===e);if(!Mn(o))return[];const s=r.nodeTemplates[o.data.type];return s?nr(s.inputs).filter(i=>i.input==="connection"&&!ab.includes(i.type)||!VI.includes(i.type)).filter(i=>!i.ui_hidden).sort((i,l)=>(i.ui_order??0)-(l.ui_order??0)).map(i=>i.name).filter(i=>i!=="is_intermediate"):[]},Se),[e]);return W(t)},Gpe=e=>{const t=d.useMemo(()=>le(xe,({nodes:r})=>{const o=r.nodes.find(i=>i.id===e);if(!Mn(o))return[];const s=r.nodeTemplates[o.data.type];return s?nr(s.outputs).filter(i=>!i.ui_hidden).sort((i,l)=>(i.ui_order??0)-(l.ui_order??0)).map(i=>i.name).filter(i=>i!=="is_intermediate"):[]},Se),[e]);return W(t)},Kpe=e=>{const t=d.useMemo(()=>le(xe,({nodes:r})=>{const o=r.nodes.find(s=>s.id===e);return Mn(o)?o.data.embedWorkflow:!1},Se),[e]);return W(t)},$g=e=>{const t=d.useMemo(()=>le(xe,({nodes:r})=>{const o=r.nodes.find(s=>s.id===e);return Mn(o)?Xr(o.data.outputs,s=>FT.includes(s.type)&&o.data.type!=="image"):!1},Se),[e]);return W(t)},qpe=({nodeId:e})=>{const t=te(),n=$g(e),r=Kpe(e),o=d.useCallback(s=>{t(BT({nodeId:e,embedWorkflow:s.target.checked}))},[t,e]);return n?a.jsxs(Kt,{as:L,sx:{alignItems:"center",gap:2,w:"auto"},children:[a.jsx(wn,{sx:{fontSize:"xs",mb:"1px"},children:"Workflow"}),a.jsx(Md,{className:"nopan",size:"sm",onChange:o,isChecked:r})]}):null},Xpe=d.memo(qpe),Qpe=e=>{const t=d.useMemo(()=>le(xe,({nodes:r})=>{const o=r.nodes.find(s=>s.id===e);return Mn(o)?o.data.isIntermediate:!1},Se),[e]);return W(t)},Ype=({nodeId:e})=>{const t=te(),n=$g(e),r=Qpe(e),o=d.useCallback(s=>{t(HT({nodeId:e,isIntermediate:!s.target.checked}))},[t,e]);return n?a.jsxs(Kt,{as:L,sx:{alignItems:"center",gap:2,w:"auto"},children:[a.jsx(wn,{sx:{fontSize:"xs",mb:"1px"},children:"Save to Gallery"}),a.jsx(Md,{className:"nopan",size:"sm",onChange:o,isChecked:!r})]}):null},Zpe=d.memo(Ype),Jpe=e=>{const t=d.useMemo(()=>le(xe,({nodes:r})=>{const o=r.nodes.find(s=>s.id===e);return Mn(o)?o.data.useCache:!1},Se),[e]);return W(t)},eme=({nodeId:e})=>{const t=te(),n=Jpe(e),r=d.useCallback(o=>{t(VT({nodeId:e,useCache:o.target.checked}))},[t,e]);return a.jsxs(Kt,{as:L,sx:{alignItems:"center",gap:2,w:"auto"},children:[a.jsx(wn,{sx:{fontSize:"xs",mb:"1px"},children:"Use Cache"}),a.jsx(Md,{className:"nopan",size:"sm",onChange:r,isChecked:n})]})},tme=d.memo(eme),nme=({nodeId:e})=>{const t=$g(e),n=Bt("invocationCache").isFeatureEnabled;return a.jsxs(L,{className:tl,layerStyle:"nodeFooter",sx:{w:"full",borderBottomRadius:"base",px:2,py:0,h:6,justifyContent:"space-between"},children:[n&&a.jsx(tme,{nodeId:e}),t&&a.jsx(Xpe,{nodeId:e}),t&&a.jsx(Zpe,{nodeId:e})]})},rme=d.memo(nme),ome=({nodeId:e,isOpen:t})=>{const n=te(),r=WT(),o=d.useCallback(()=>{n(UT({nodeId:e,isOpen:!t})),r(e)},[n,t,e,r]);return a.jsx(Fe,{className:"nodrag",onClick:o,"aria-label":"Minimize",sx:{minW:8,w:8,h:8,color:"base.500",_dark:{color:"base.500"},_hover:{color:"base.700",_dark:{color:"base.300"}}},variant:"link",icon:a.jsx(gg,{sx:{transform:t?"rotate(0deg)":"rotate(180deg)",transitionProperty:"common",transitionDuration:"normal"}})})},u2=d.memo(ome),n7=e=>{const t=d.useMemo(()=>le(xe,({nodes:r})=>{const o=r.nodes.find(s=>s.id===e);return Mn(o)?o.data.label:!1},Se),[e]);return W(t)},r7=e=>{const t=d.useMemo(()=>le(xe,({nodes:r})=>{const o=r.nodes.find(i=>i.id===e);if(!Mn(o))return!1;const s=o?r.nodeTemplates[o.data.type]:void 0;return s==null?void 0:s.title},Se),[e]);return W(t)},sme=({nodeId:e,title:t})=>{const n=te(),r=n7(e),o=r7(e),{t:s}=Z(),[i,l]=d.useState(""),u=d.useCallback(async m=>{n(GT({nodeId:e,label:m})),l(r||t||o||s("nodes.problemSettingTitle"))},[n,e,t,o,r,s]),p=d.useCallback(m=>{l(m)},[]);return d.useEffect(()=>{l(r||t||o||s("nodes.problemSettingTitle"))},[r,o,t,s]),a.jsx(L,{sx:{overflow:"hidden",w:"full",h:"full",alignItems:"center",justifyContent:"center",cursor:"text"},children:a.jsxs(Ih,{as:L,value:i,onChange:p,onSubmit:u,sx:{alignItems:"center",position:"relative",w:"full",h:"full"},children:[a.jsx(_h,{fontSize:"sm",sx:{p:0,w:"full"},noOfLines:1}),a.jsx(jh,{className:"nodrag",fontSize:"sm",sx:{p:0,fontWeight:700,_focusVisible:{p:0,boxShadow:"none"}}}),a.jsx(ame,{})]})})},o7=d.memo(sme);function ame(){const{isEditing:e,getEditButtonProps:t}=C5(),n=d.useCallback(r=>{const{onClick:o}=t();o&&o(r)},[t]);return e?null:a.jsx(Ie,{className:tl,onDoubleClick:n,sx:{position:"absolute",w:"full",h:"full",top:0,cursor:"grab"}})}const d2=e=>{const t=d.useMemo(()=>le(xe,({nodes:r})=>{const o=r.nodes.find(s=>s.id===e);return o==null?void 0:o.data},Se),[e]);return W(t)},ime=({nodeId:e})=>{const t=d2(e),{base400:n,base600:r}=Wd(),o=sa(n,r),s=d.useMemo(()=>({borderWidth:0,borderRadius:"3px",width:"1rem",height:"1rem",backgroundColor:o,zIndex:-1}),[o]);return em(t)?a.jsxs(a.Fragment,{children:[a.jsx(Ou,{type:"target",id:`${t.id}-collapsed-target`,isConnectable:!1,position:Ql.Left,style:{...s,left:"-0.5rem"}}),nr(t.inputs,i=>a.jsx(Ou,{type:"target",id:i.name,isConnectable:!1,position:Ql.Left,style:{visibility:"hidden"}},`${t.id}-${i.name}-collapsed-input-handle`)),a.jsx(Ou,{type:"source",id:`${t.id}-collapsed-source`,isConnectable:!1,position:Ql.Right,style:{...s,right:"-0.5rem"}}),nr(t.outputs,i=>a.jsx(Ou,{type:"source",id:i.name,isConnectable:!1,position:Ql.Right,style:{visibility:"hidden"}},`${t.id}-${i.name}-collapsed-output-handle`))]}):null},lme=d.memo(ime),cme=e=>{const t=d.useMemo(()=>le(xe,({nodes:r})=>{const o=r.nodes.find(i=>i.id===e);return r.nodeTemplates[(o==null?void 0:o.data.type)??""]},Se),[e]);return W(t)},ume=({nodeId:e})=>{const t=te(),n=d2(e),{t:r}=Z(),o=d.useCallback(s=>{t(KT({nodeId:e,notes:s.target.value}))},[t,e]);return em(n)?a.jsxs(Kt,{children:[a.jsx(wn,{children:r("nodes.notes")}),a.jsx(da,{value:n==null?void 0:n.notes,onChange:o,rows:10})]}):null},dme=d.memo(ume),fme=e=>{const t=d.useMemo(()=>le(xe,({nodes:r})=>{var i;const o=r.nodes.find(l=>l.id===e);if(!Mn(o))return!1;const s=r.nodeTemplates[(o==null?void 0:o.data.type)??""];return!(s!=null&&s.version)||!((i=o.data)!=null&&i.version)?!1:Y_(s.version,o.data.version)===0},Se),[e]);return W(t)},pme=({nodeId:e})=>{const{isOpen:t,onOpen:n,onClose:r}=Lr(),o=n7(e),s=r7(e),i=fme(e),{t:l}=Z();return a.jsxs(a.Fragment,{children:[a.jsx(Ht,{label:a.jsx(s7,{nodeId:e}),placement:"top",shouldWrapChildren:!0,children:a.jsx(L,{className:"nodrag",onClick:n,sx:{alignItems:"center",justifyContent:"center",w:8,h:8,cursor:"pointer"},children:a.jsx(Tn,{as:fM,sx:{boxSize:4,w:8,color:i?"base.400":"error.400"}})})}),a.jsxs(Ki,{isOpen:t,onClose:r,isCentered:!0,children:[a.jsx(Yo,{}),a.jsxs(qi,{children:[a.jsx(Qo,{children:o||s||l("nodes.unknownNode")}),a.jsx($d,{}),a.jsx(Zo,{children:a.jsx(dme,{nodeId:e})}),a.jsx(Ss,{})]})]})]})},mme=d.memo(pme),s7=d.memo(({nodeId:e})=>{const t=d2(e),n=cme(e),{t:r}=Z(),o=d.useMemo(()=>t!=null&&t.label&&(n!=null&&n.title)?`${t.label} (${n.title})`:t!=null&&t.label&&!n?t.label:!(t!=null&&t.label)&&n?n.title:r("nodes.unknownNode"),[t,n,r]),s=d.useMemo(()=>!em(t)||!n?null:t.version?n.version?qw(t.version,n.version,"<")?a.jsxs(ve,{as:"span",sx:{color:"error.500"},children:[r("nodes.version")," ",t.version," (",r("nodes.updateNode"),")"]}):qw(t.version,n.version,">")?a.jsxs(ve,{as:"span",sx:{color:"error.500"},children:[r("nodes.version")," ",t.version," (",r("nodes.updateApp"),")"]}):a.jsxs(ve,{as:"span",children:[r("nodes.version")," ",t.version]}):a.jsxs(ve,{as:"span",sx:{color:"error.500"},children:[r("nodes.version")," ",t.version," (",r("nodes.unknownTemplate"),")"]}):a.jsx(ve,{as:"span",sx:{color:"error.500"},children:r("nodes.versionUnknown")}),[t,n,r]);return em(t)?a.jsxs(L,{sx:{flexDir:"column"},children:[a.jsx(ve,{as:"span",sx:{fontWeight:600},children:o}),a.jsx(ve,{sx:{opacity:.7,fontStyle:"oblique 5deg"},children:n==null?void 0:n.description}),s,(t==null?void 0:t.notes)&&a.jsx(ve,{children:t.notes})]}):a.jsx(ve,{sx:{fontWeight:600},children:r("nodes.unknownNode")})});s7.displayName="TooltipContent";const t1=3,E_={circle:{transitionProperty:"none",transitionDuration:"0s"},".chakra-progress__track":{stroke:"transparent"}},hme=({nodeId:e})=>{const t=d.useMemo(()=>le(xe,({nodes:r})=>r.nodeExecutionStates[e]),[e]),n=W(t);return n?a.jsx(Ht,{label:a.jsx(a7,{nodeExecutionState:n}),placement:"top",children:a.jsx(L,{className:tl,sx:{w:5,h:"full",alignItems:"center",justifyContent:"flex-end"},children:a.jsx(i7,{nodeExecutionState:n})})}):null},gme=d.memo(hme),a7=d.memo(({nodeExecutionState:e})=>{const{status:t,progress:n,progressImage:r}=e,{t:o}=Z();return t===Ys.PENDING?a.jsx(ve,{children:"Pending"}):t===Ys.IN_PROGRESS?r?a.jsxs(L,{sx:{pos:"relative",pt:1.5,pb:.5},children:[a.jsx(ga,{src:r.dataURL,sx:{w:32,h:32,borderRadius:"base",objectFit:"contain"}}),n!==null&&a.jsxs(Ds,{variant:"solid",sx:{pos:"absolute",top:2.5,insetInlineEnd:1},children:[Math.round(n*100),"%"]})]}):n!==null?a.jsxs(ve,{children:[o("nodes.executionStateInProgress")," (",Math.round(n*100),"%)"]}):a.jsx(ve,{children:o("nodes.executionStateInProgress")}):t===Ys.COMPLETED?a.jsx(ve,{children:o("nodes.executionStateCompleted")}):t===Ys.FAILED?a.jsx(ve,{children:o("nodes.executionStateError")}):null});a7.displayName="TooltipLabel";const i7=d.memo(e=>{const{progress:t,status:n}=e.nodeExecutionState;return n===Ys.PENDING?a.jsx(Tn,{as:AJ,sx:{boxSize:t1,color:"base.600",_dark:{color:"base.300"}}}):n===Ys.IN_PROGRESS?t===null?a.jsx(B1,{isIndeterminate:!0,size:"14px",color:"base.500",thickness:14,sx:E_}):a.jsx(B1,{value:Math.round(t*100),size:"14px",color:"base.500",thickness:14,sx:E_}):n===Ys.COMPLETED?a.jsx(Tn,{as:iM,sx:{boxSize:t1,color:"ok.600",_dark:{color:"ok.300"}}}):n===Ys.FAILED?a.jsx(Tn,{as:$J,sx:{boxSize:t1,color:"error.600",_dark:{color:"error.300"}}}):null});i7.displayName="StatusIcon";const vme=({nodeId:e,isOpen:t})=>a.jsxs(L,{layerStyle:"nodeHeader",sx:{borderTopRadius:"base",borderBottomRadius:t?0:"base",alignItems:"center",justifyContent:"space-between",h:8,textAlign:"center",fontWeight:500,color:"base.700",_dark:{color:"base.200"}},children:[a.jsx(u2,{nodeId:e,isOpen:t}),a.jsx(o7,{nodeId:e}),a.jsxs(L,{alignItems:"center",children:[a.jsx(gme,{nodeId:e}),a.jsx(mme,{nodeId:e})]}),!t&&a.jsx(lme,{nodeId:e})]}),xme=d.memo(vme),bme=(e,t,n,r)=>le(xe,o=>{if(!r)return yt.t("nodes.noFieldType");const{currentConnectionFieldType:s,connectionStartParams:i,nodes:l,edges:u}=o.nodes;if(!i||!s)return yt.t("nodes.noConnectionInProgress");const{handleType:p,nodeId:m,handleId:h}=i;if(!p||!m||!h)return yt.t("nodes.noConnectionData");const g=n==="target"?r:s,x=n==="source"?r:s;if(e===m)return yt.t("nodes.cannotConnectToSelf");if(n===p)return n==="source"?yt.t("nodes.cannotConnectOutputToOutput"):yt.t("nodes.cannotConnectInputToInput");const y=n==="target"?e:m,b=n==="target"?t:h,w=n==="source"?e:m,S=n==="source"?t:h;return u.find(_=>{_.target===y&&_.targetHandle===b&&_.source===w&&_.sourceHandle})?yt.t("nodes.cannotDuplicateConnection"):u.find(_=>_.target===y&&_.targetHandle===b)&&g!=="CollectionItem"?yt.t("nodes.inputMayOnlyHaveOneConnection"):ob(x,g)?FI(p==="source"?m:e,p==="source"?e:m,l,u)?null:yt.t("nodes.connectionWouldCreateCycle"):yt.t("nodes.fieldTypesMustMatch")}),yme=(e,t,n)=>{const r=d.useMemo(()=>le(xe,({nodes:s})=>{var l;const i=s.nodes.find(u=>u.id===e);if(Mn(i))return(l=i==null?void 0:i.data[tb[n]][t])==null?void 0:l.type},Se),[t,n,e]);return W(r)},Cme=le(xe,({nodes:e})=>e.currentConnectionFieldType!==null&&e.connectionStartParams!==null),l7=({nodeId:e,fieldName:t,kind:n})=>{const r=yme(e,t,n),o=d.useMemo(()=>le(xe,({nodes:g})=>!!g.edges.filter(x=>(n==="input"?x.target:x.source)===e&&(n==="input"?x.targetHandle:x.sourceHandle)===t).length),[t,n,e]),s=d.useMemo(()=>bme(e,t,n==="input"?"target":"source",r),[e,t,n,r]),i=d.useMemo(()=>le(xe,({nodes:g})=>{var x,y,b;return((x=g.connectionStartParams)==null?void 0:x.nodeId)===e&&((y=g.connectionStartParams)==null?void 0:y.handleId)===t&&((b=g.connectionStartParams)==null?void 0:b.handleType)==={input:"target",output:"source"}[n]}),[t,n,e]),l=W(o),u=W(Cme),p=W(i),m=W(s),h=d.useMemo(()=>!!(u&&m&&!p),[m,u,p]);return{isConnected:l,isConnectionInProgress:u,isConnectionStartField:p,connectionError:m,shouldDim:h}},wme=(e,t)=>{const n=d.useMemo(()=>le(xe,({nodes:o})=>{var i;const s=o.nodes.find(l=>l.id===e);if(Mn(s))return((i=s==null?void 0:s.data.inputs[t])==null?void 0:i.value)!==void 0},Se),[t,e]);return W(n)},Sme=(e,t)=>{const n=d.useMemo(()=>le(xe,({nodes:o})=>{const s=o.nodes.find(u=>u.id===e);if(!Mn(s))return;const i=o.nodeTemplates[(s==null?void 0:s.data.type)??""],l=i==null?void 0:i.inputs[t];return l==null?void 0:l.input},Se),[t,e]);return W(n)},kme=({nodeId:e,fieldName:t,kind:n,children:r})=>{const o=te(),s=pO(e,t),i=mO(e,t,n),l=Sme(e,t),{t:u}=Z(),p=d.useCallback(w=>{w.preventDefault()},[]),m=d.useMemo(()=>le(xe,({nodes:w})=>({isExposed:!!w.workflow.exposedFields.find(j=>j.nodeId===e&&j.fieldName===t)}),Se),[t,e]),h=d.useMemo(()=>["any","direct"].includes(l??"__UNKNOWN_INPUT__"),[l]),{isExposed:g}=W(m),x=d.useCallback(()=>{o(qT({nodeId:e,fieldName:t}))},[o,t,e]),y=d.useCallback(()=>{o(_I({nodeId:e,fieldName:t}))},[o,t,e]),b=d.useMemo(()=>{const w=[];return h&&!g&&w.push(a.jsx(en,{icon:a.jsx(Vc,{}),onClick:x,children:"Add to Linear View"},`${e}.${t}.expose-field`)),h&&g&&w.push(a.jsx(en,{icon:a.jsx(qJ,{}),onClick:y,children:"Remove from Linear View"},`${e}.${t}.unexpose-field`)),w},[t,x,y,g,h,e]);return a.jsx(Ry,{menuProps:{size:"sm",isLazy:!0},menuButtonProps:{bg:"transparent",_hover:{bg:"transparent"}},renderMenu:()=>b.length?a.jsx(Ui,{sx:{visibility:"visible !important"},motionProps:vc,onContextMenu:p,children:a.jsx(td,{title:s||i||u("nodes.unknownField"),children:b})}):null,children:r})},jme=d.memo(kme),_me=e=>{const{fieldTemplate:t,handleType:n,isConnectionInProgress:r,isConnectionStartField:o,connectionError:s}=e,{name:i,type:l}=t,{color:u,title:p}=wd[l],m=d.useMemo(()=>{const g=XT.includes(l),x=ab.includes(l),y=QT.includes(l),b=hd(u),w={backgroundColor:g||x?"var(--invokeai-colors-base-900)":b,position:"absolute",width:"1rem",height:"1rem",borderWidth:g||x?4:0,borderStyle:"solid",borderColor:b,borderRadius:y?4:"100%",zIndex:1};return n==="target"?w.insetInlineStart="-1rem":w.insetInlineEnd="-1rem",r&&!o&&s&&(w.filter="opacity(0.4) grayscale(0.7)"),r&&s?o?w.cursor="grab":w.cursor="not-allowed":w.cursor="crosshair",w},[s,n,r,o,l,u]),h=d.useMemo(()=>r&&o?p:r&&s?s??p:p,[s,r,o,p]);return a.jsx(Ht,{label:h,placement:n==="target"?"start":"end",hasArrow:!0,openDelay:yh,children:a.jsx(Ou,{type:n,id:i,position:n==="target"?Ql.Left:Ql.Right,style:m})})},c7=d.memo(_me),Ime=({nodeId:e,fieldName:t})=>{const n=Pg(e,t,"input"),r=wme(e,t),{isConnected:o,isConnectionInProgress:s,isConnectionStartField:i,connectionError:l,shouldDim:u}=l7({nodeId:e,fieldName:t,kind:"input"}),p=d.useMemo(()=>{if((n==null?void 0:n.fieldKind)!=="input"||!n.required)return!1;if(!o&&n.input==="connection"||!r&&!o&&n.input==="any")return!0},[n,o,r]);return(n==null?void 0:n.fieldKind)!=="input"?a.jsx(Rx,{shouldDim:u,children:a.jsxs(Kt,{sx:{color:"error.400",textAlign:"left",fontSize:"sm"},children:["Unknown input: ",t]})}):a.jsxs(Rx,{shouldDim:u,children:[a.jsxs(Kt,{isInvalid:p,isDisabled:o,sx:{alignItems:"stretch",justifyContent:"space-between",ps:n.input==="direct"?0:2,gap:2,h:"full",w:"full"},children:[a.jsx(jme,{nodeId:e,fieldName:t,kind:"input",children:m=>a.jsx(wn,{sx:{display:"flex",alignItems:"center",h:"full",mb:0,px:1,gap:2},children:a.jsx(gO,{ref:m,nodeId:e,fieldName:t,kind:"input",isMissingInput:p,withTooltip:!0})})}),a.jsx(Ie,{children:a.jsx(PO,{nodeId:e,fieldName:t})})]}),n.input!=="direct"&&a.jsx(c7,{fieldTemplate:n,handleType:"target",isConnectionInProgress:s,isConnectionStartField:i,connectionError:l})]})},M_=d.memo(Ime),Rx=d.memo(({shouldDim:e,children:t})=>a.jsx(L,{sx:{position:"relative",minH:8,py:.5,alignItems:"center",opacity:e?.5:1,transitionProperty:"opacity",transitionDuration:"0.1s",w:"full",h:"full"},children:t}));Rx.displayName="InputFieldWrapper";const Pme=({nodeId:e,fieldName:t})=>{const n=Pg(e,t,"output"),{isConnected:r,isConnectionInProgress:o,isConnectionStartField:s,connectionError:i,shouldDim:l}=l7({nodeId:e,fieldName:t,kind:"output"});return(n==null?void 0:n.fieldKind)!=="output"?a.jsx(Dx,{shouldDim:l,children:a.jsxs(Kt,{sx:{color:"error.400",textAlign:"right",fontSize:"sm"},children:["Unknown output: ",t]})}):a.jsxs(Dx,{shouldDim:l,children:[a.jsx(Ht,{label:a.jsx(t2,{nodeId:e,fieldName:t,kind:"output"}),openDelay:yh,placement:"top",shouldWrapChildren:!0,hasArrow:!0,children:a.jsx(Kt,{isDisabled:r,pe:2,children:a.jsx(wn,{sx:{mb:0,fontWeight:500},children:n==null?void 0:n.title})})}),a.jsx(c7,{fieldTemplate:n,handleType:"source",isConnectionInProgress:o,isConnectionStartField:s,connectionError:i})]})},Eme=d.memo(Pme),Dx=d.memo(({shouldDim:e,children:t})=>a.jsx(L,{sx:{position:"relative",minH:8,py:.5,alignItems:"center",opacity:e?.5:1,transitionProperty:"opacity",transitionDuration:"0.1s",justifyContent:"flex-end"},children:t}));Dx.displayName="OutputFieldWrapper";const Mme=e=>{const t=$g(e),n=Bt("invocationCache").isFeatureEnabled;return d.useMemo(()=>t||n,[t,n])},Ome=({nodeId:e,isOpen:t,label:n,type:r,selected:o})=>{const s=Upe(e),i=Wpe(e),l=Mme(e),u=Gpe(e);return a.jsxs(Ng,{nodeId:e,selected:o,children:[a.jsx(xme,{nodeId:e,isOpen:t,label:n,selected:o,type:r}),t&&a.jsxs(a.Fragment,{children:[a.jsx(L,{layerStyle:"nodeBody",sx:{flexDirection:"column",w:"full",h:"full",py:2,gap:1,borderBottomRadius:l?0:"base"},children:a.jsxs(L,{sx:{flexDir:"column",px:2,w:"full",h:"full"},children:[a.jsxs(Ja,{gridTemplateColumns:"1fr auto",gridAutoRows:"1fr",children:[s.map((p,m)=>a.jsx(Zu,{gridColumnStart:1,gridRowStart:m+1,children:a.jsx(M_,{nodeId:e,fieldName:p})},`${e}.${p}.input-field`)),u.map((p,m)=>a.jsx(Zu,{gridColumnStart:2,gridRowStart:m+1,children:a.jsx(Eme,{nodeId:e,fieldName:p})},`${e}.${p}.output-field`))]}),i.map(p=>a.jsx(M_,{nodeId:e,fieldName:p},`${e}.${p}.input-field`))]})}),l&&a.jsx(rme,{nodeId:e})]})]})},Rme=d.memo(Ome),Dme=({nodeId:e,isOpen:t,label:n,type:r,selected:o})=>a.jsxs(Ng,{nodeId:e,selected:o,children:[a.jsxs(L,{className:tl,layerStyle:"nodeHeader",sx:{borderTopRadius:"base",borderBottomRadius:t?0:"base",alignItems:"center",h:8,fontWeight:600,fontSize:"sm"},children:[a.jsx(u2,{nodeId:e,isOpen:t}),a.jsx(ve,{sx:{w:"full",textAlign:"center",pe:8,color:"error.500",_dark:{color:"error.300"}},children:n?`${n} (${r})`:r})]}),t&&a.jsx(L,{layerStyle:"nodeBody",sx:{userSelect:"auto",flexDirection:"column",w:"full",h:"full",p:4,gap:1,borderBottomRadius:"base",fontSize:"sm"},children:a.jsxs(Ie,{children:[a.jsx(ve,{as:"span",children:"Unknown node type: "}),a.jsx(ve,{as:"span",fontWeight:600,children:r})]})})]}),Ame=d.memo(Dme),Tme=e=>{const{data:t,selected:n}=e,{id:r,type:o,isOpen:s,label:i}=t,l=d.useMemo(()=>le(xe,({nodes:p})=>!!p.nodeTemplates[o]),[o]);return W(l)?a.jsx(Rme,{nodeId:r,isOpen:s,label:i,type:o,selected:n}):a.jsx(Ame,{nodeId:r,isOpen:s,label:i,type:o,selected:n})},Nme=d.memo(Tme),$me=e=>{const{id:t,data:n,selected:r}=e,{notes:o,isOpen:s}=n,i=te(),l=d.useCallback(u=>{i(YT({nodeId:t,value:u.target.value}))},[i,t]);return a.jsxs(Ng,{nodeId:t,selected:r,children:[a.jsxs(L,{layerStyle:"nodeHeader",sx:{borderTopRadius:"base",borderBottomRadius:s?0:"base",alignItems:"center",justifyContent:"space-between",h:8},children:[a.jsx(u2,{nodeId:t,isOpen:s}),a.jsx(o7,{nodeId:t,title:"Notes"}),a.jsx(Ie,{minW:8})]}),s&&a.jsx(a.Fragment,{children:a.jsx(L,{layerStyle:"nodeBody",className:"nopan",sx:{cursor:"auto",flexDirection:"column",borderBottomRadius:"base",w:"full",h:"full",p:2,gap:1},children:a.jsx(L,{className:"nopan",sx:{flexDir:"column",w:"full",h:"full"},children:a.jsx(da,{value:o,onChange:l,rows:8,resize:"none",sx:{fontSize:"xs"}})})})})]})},Lme=d.memo($me),zme=["Delete","Backspace"],Fme={collapsed:$pe,default:zpe},Bme={invocation:Nme,current_image:Vpe,notes:Lme},Hme={hideAttribution:!0},Vme=le(xe,({nodes:e})=>{const{shouldSnapToGrid:t,selectionMode:n}=e;return{shouldSnapToGrid:t,selectionMode:n}},Se),Wme=()=>{const e=te(),t=W(O=>O.nodes.nodes),n=W(O=>O.nodes.edges),r=W(O=>O.nodes.viewport),{shouldSnapToGrid:o,selectionMode:s}=W(Vme),i=d.useRef(null),l=d.useRef(),u=Rpe(),[p]=Ho("radii",["base"]),m=d.useCallback(O=>{e(ZT(O))},[e]),h=d.useCallback(O=>{e(JT(O))},[e]),g=d.useCallback((O,T)=>{e(eN(T))},[e]),x=d.useCallback(O=>{e(Tw(O))},[e]),y=d.useCallback(()=>{e(tN({cursorPosition:l.current}))},[e]),b=d.useCallback(O=>{e(nN(O))},[e]),w=d.useCallback(O=>{e(rN(O))},[e]),S=d.useCallback(({nodes:O,edges:T})=>{e(oN(O?O.map(X=>X.id):[])),e(sN(T?T.map(X=>X.id):[]))},[e]),j=d.useCallback((O,T)=>{e(aN(T))},[e]),_=d.useCallback(()=>{e(HI())},[e]),E=d.useCallback(O=>{Nw.set(O),O.fitView()},[]),I=d.useCallback(O=>{var X,B;const T=(X=i.current)==null?void 0:X.getBoundingClientRect();if(T){const V=(B=Nw.get())==null?void 0:B.project({x:O.clientX-T.left,y:O.clientY-T.top});l.current=V}},[]),M=d.useRef(),R=d.useCallback((O,T,X)=>{M.current=O,e(iN(T.id)),e(lN())},[e]),D=d.useCallback((O,T)=>{e(Tw(T))},[e]),A=d.useCallback((O,T,X)=>{var B,V;!("touches"in O)&&((B=M.current)==null?void 0:B.clientX)===O.clientX&&((V=M.current)==null?void 0:V.clientY)===O.clientY&&e(cN(T)),M.current=void 0},[e]);return et(["Ctrl+c","Meta+c"],O=>{O.preventDefault(),e(uN())}),et(["Ctrl+a","Meta+a"],O=>{O.preventDefault(),e(dN())}),et(["Ctrl+v","Meta+v"],O=>{O.preventDefault(),e(fN({cursorPosition:l.current}))}),a.jsx(pN,{id:"workflow-editor",ref:i,defaultViewport:r,nodeTypes:Bme,edgeTypes:Fme,nodes:t,edges:n,onInit:E,onMouseMove:I,onNodesChange:m,onEdgesChange:h,onEdgesDelete:b,onEdgeUpdate:D,onEdgeUpdateStart:R,onEdgeUpdateEnd:A,onNodesDelete:w,onConnectStart:g,onConnect:x,onConnectEnd:y,onMoveEnd:j,connectionLineComponent:Tpe,onSelectionChange:S,isValidConnection:u,minZoom:.1,snapToGrid:o,snapGrid:[25,25],connectionRadius:30,proOptions:Hme,style:{borderRadius:p},onPaneClick:_,deleteKeyCode:zme,selectionMode:s,children:a.jsx(b$,{})})},Ume=()=>{const e=te(),{t}=Z(),n=d.useCallback(()=>{e(zI())},[e]);return a.jsx(L,{sx:{gap:2,position:"absolute",top:2,insetInlineStart:2},children:a.jsx(Fe,{tooltip:t("nodes.addNodeToolTip"),"aria-label":t("nodes.addNode"),icon:a.jsx(Vc,{}),onClick:n})})},Gme=d.memo(Ume),Kme=()=>{const e=te(),t=pP("nodes"),{t:n}=Z();return d.useCallback(o=>{if(!o)return;const s=new FileReader;s.onload=async()=>{const i=s.result;try{const l=JSON.parse(String(i)),u=mN.safeParse(l);if(!u.success){const{message:p}=hN(u.error,{prefix:n("nodes.workflowValidation")});t.error({error:gN(u.error)},p),e(ct(Qt({title:n("nodes.unableToValidateWorkflow"),status:"error",duration:5e3}))),s.abort();return}e(Xx(u.data)),s.abort()}catch{e(ct(Qt({title:n("nodes.unableToLoadWorkflow"),status:"error"})))}},s.readAsText(o)},[e,t,n])},qme=d.memo(e=>e.error.issues[0]?a.jsx(ve,{children:$w(e.error.issues[0],{prefix:null}).toString()}):a.jsx(Od,{children:e.error.issues.map((t,n)=>a.jsx(Qr,{children:a.jsx(ve,{children:$w(t,{prefix:null}).toString()})},n))}));qme.displayName="WorkflowValidationErrorContent";const Xme=()=>{const{t:e}=Z(),t=d.useRef(null),n=Kme();return a.jsx(AE,{resetRef:t,accept:"application/json",onChange:n,children:r=>a.jsx(Fe,{icon:a.jsx(cg,{}),tooltip:e("nodes.loadWorkflow"),"aria-label":e("nodes.loadWorkflow"),...r})})},Qme=d.memo(Xme),Yme=()=>{const{t:e}=Z(),t=te(),{isOpen:n,onOpen:r,onClose:o}=Lr(),s=d.useRef(null),i=W(u=>u.nodes.nodes.length),l=d.useCallback(()=>{t(vN()),t(ct(Qt({title:e("toast.nodesCleared"),status:"success"}))),o()},[t,e,o]);return a.jsxs(a.Fragment,{children:[a.jsx(Fe,{icon:a.jsx(Br,{}),tooltip:e("nodes.resetWorkflow"),"aria-label":e("nodes.resetWorkflow"),onClick:r,isDisabled:!i,colorScheme:"error"}),a.jsxs(Td,{isOpen:n,onClose:o,leastDestructiveRef:s,isCentered:!0,children:[a.jsx(Yo,{}),a.jsxs(Nd,{children:[a.jsx(Qo,{fontSize:"lg",fontWeight:"bold",children:e("nodes.resetWorkflow")}),a.jsx(Zo,{py:4,children:a.jsxs(L,{flexDir:"column",gap:2,children:[a.jsx(ve,{children:e("nodes.resetWorkflowDesc")}),a.jsx(ve,{variant:"subtext",children:e("nodes.resetWorkflowDesc2")})]})}),a.jsxs(Ss,{children:[a.jsx(Za,{ref:s,onClick:o,children:e("common.cancel")}),a.jsx(Za,{colorScheme:"error",ml:3,onClick:l,children:e("common.accept")})]})]})]})]})},Zme=d.memo(Yme),Jme=()=>{const{t:e}=Z(),t=uO(),n=d.useCallback(()=>{const r=new Blob([JSON.stringify(t,null,2)]),o=document.createElement("a");o.href=URL.createObjectURL(r),o.download=`${t.name||"My Workflow"}.json`,document.body.appendChild(o),o.click(),o.remove()},[t]);return a.jsx(Fe,{icon:a.jsx(ig,{}),tooltip:e("nodes.downloadWorkflow"),"aria-label":e("nodes.downloadWorkflow"),onClick:n})},ehe=d.memo(Jme),the=()=>a.jsxs(L,{sx:{gap:2,position:"absolute",top:2,insetInlineStart:"50%",transform:"translate(-50%)"},children:[a.jsx(ehe,{}),a.jsx(Qme,{}),a.jsx(Zme,{})]}),nhe=d.memo(the),rhe=()=>a.jsx(L,{sx:{gap:2,flexDir:"column"},children:nr(wd,({title:e,description:t,color:n},r)=>a.jsx(Ht,{label:t,children:a.jsx(Ds,{sx:{userSelect:"none",color:parseInt(n.split(".")[1]??"0",10)<500?"base.800":"base.50",bg:n},textAlign:"center",children:e})},r))}),ohe=d.memo(rhe),she=()=>{const{t:e}=Z(),t=te(),n=d.useCallback(()=>{t(xN())},[t]);return a.jsx(at,{leftIcon:a.jsx(oee,{}),tooltip:e("nodes.reloadNodeTemplates"),"aria-label":e("nodes.reloadNodeTemplates"),onClick:n,children:e("nodes.reloadNodeTemplates")})},ahe=d.memo(she),Pu={fontWeight:600},ihe=le(xe,({nodes:e})=>{const{shouldAnimateEdges:t,shouldValidateGraph:n,shouldSnapToGrid:r,shouldColorEdges:o,selectionMode:s}=e;return{shouldAnimateEdges:t,shouldValidateGraph:n,shouldSnapToGrid:r,shouldColorEdges:o,selectionModeIsChecked:s===bN.Full}},Se),lhe=je((e,t)=>{const{isOpen:n,onOpen:r,onClose:o}=Lr(),s=te(),{shouldAnimateEdges:i,shouldValidateGraph:l,shouldSnapToGrid:u,shouldColorEdges:p,selectionModeIsChecked:m}=W(ihe),h=d.useCallback(S=>{s(yN(S.target.checked))},[s]),g=d.useCallback(S=>{s(CN(S.target.checked))},[s]),x=d.useCallback(S=>{s(wN(S.target.checked))},[s]),y=d.useCallback(S=>{s(SN(S.target.checked))},[s]),b=d.useCallback(S=>{s(kN(S.target.checked))},[s]),{t:w}=Z();return a.jsxs(a.Fragment,{children:[a.jsx(Fe,{ref:t,"aria-label":w("nodes.workflowSettings"),tooltip:w("nodes.workflowSettings"),icon:a.jsx(cM,{}),onClick:r}),a.jsxs(Ki,{isOpen:n,onClose:o,size:"2xl",isCentered:!0,children:[a.jsx(Yo,{}),a.jsxs(qi,{children:[a.jsx(Qo,{children:w("nodes.workflowSettings")}),a.jsx($d,{}),a.jsx(Zo,{children:a.jsxs(L,{sx:{flexDirection:"column",gap:4,py:4},children:[a.jsx(cr,{size:"sm",children:"General"}),a.jsx(dn,{formLabelProps:Pu,onChange:g,isChecked:i,label:w("nodes.animatedEdges"),helperText:w("nodes.animatedEdgesHelp")}),a.jsx(Yn,{}),a.jsx(dn,{formLabelProps:Pu,isChecked:u,onChange:x,label:w("nodes.snapToGrid"),helperText:w("nodes.snapToGridHelp")}),a.jsx(Yn,{}),a.jsx(dn,{formLabelProps:Pu,isChecked:p,onChange:y,label:w("nodes.colorCodeEdges"),helperText:w("nodes.colorCodeEdgesHelp")}),a.jsx(dn,{formLabelProps:Pu,isChecked:m,onChange:b,label:w("nodes.fullyContainNodes"),helperText:w("nodes.fullyContainNodesHelp")}),a.jsx(cr,{size:"sm",pt:4,children:"Advanced"}),a.jsx(dn,{formLabelProps:Pu,isChecked:l,onChange:h,label:w("nodes.validateConnections"),helperText:w("nodes.validateConnectionsHelp")}),a.jsx(ahe,{})]})})]})]})]})}),che=d.memo(lhe),uhe=()=>{const e=W(t=>t.nodes.shouldShowFieldTypeLegend);return a.jsxs(L,{sx:{gap:2,position:"absolute",top:2,insetInlineEnd:2},children:[a.jsx(che,{}),e&&a.jsx(ohe,{})]})},dhe=d.memo(uhe);function fhe(){const e=te(),t=W(o=>o.nodes.nodeOpacity),{t:n}=Z(),r=d.useCallback(o=>{e(jN(o))},[e]);return a.jsx(L,{alignItems:"center",children:a.jsxs(Wb,{"aria-label":n("nodes.nodeOpacity"),value:t,min:.5,max:1,step:.01,onChange:r,orientation:"vertical",defaultValue:30,h:"calc(100% - 0.5rem)",children:[a.jsx(Gb,{children:a.jsx(Kb,{})}),a.jsx(Ub,{})]})})}const phe=()=>{const{t:e}=Z(),{zoomIn:t,zoomOut:n,fitView:r}=rb(),o=te(),s=W(m=>m.nodes.shouldShowMinimapPanel),i=d.useCallback(()=>{t()},[t]),l=d.useCallback(()=>{n()},[n]),u=d.useCallback(()=>{r()},[r]),p=d.useCallback(()=>{o(_N(!s))},[s,o]);return a.jsxs(Vt,{isAttached:!0,orientation:"vertical",children:[a.jsx(Fe,{tooltip:e("nodes.zoomInNodes"),"aria-label":e("nodes.zoomInNodes"),onClick:i,icon:a.jsx(yoe,{})}),a.jsx(Fe,{tooltip:e("nodes.zoomOutNodes"),"aria-label":e("nodes.zoomOutNodes"),onClick:l,icon:a.jsx(boe,{})}),a.jsx(Fe,{tooltip:e("nodes.fitViewportNodes"),"aria-label":e("nodes.fitViewportNodes"),onClick:u,icon:a.jsx(uM,{})}),a.jsx(Fe,{tooltip:e(s?"nodes.hideMinimapnodes":"nodes.showMinimapnodes"),"aria-label":e(s?"nodes.hideMinimapnodes":"nodes.showMinimapnodes"),isChecked:s,onClick:p,icon:a.jsx(KJ,{})})]})},mhe=d.memo(phe),hhe=()=>a.jsxs(L,{sx:{gap:2,position:"absolute",bottom:2,insetInlineStart:2},children:[a.jsx(mhe,{}),a.jsx(fhe,{})]}),ghe=d.memo(hhe),vhe=we(p$),xhe=()=>{const e=W(r=>r.nodes.shouldShowMinimapPanel),t=sa("var(--invokeai-colors-accent-300)","var(--invokeai-colors-accent-600)"),n=sa("var(--invokeai-colors-blackAlpha-300)","var(--invokeai-colors-blackAlpha-600)");return a.jsx(L,{sx:{gap:2,position:"absolute",bottom:2,insetInlineEnd:2},children:e&&a.jsx(vhe,{pannable:!0,zoomable:!0,nodeBorderRadius:15,sx:{m:"0 !important",backgroundColor:"base.200 !important",borderRadius:"base",_dark:{backgroundColor:"base.500 !important"},svg:{borderRadius:"inherit"}},nodeColor:t,maskColor:n})})},bhe=d.memo(xhe),yhe=()=>{const e=W(n=>n.nodes.isReady),{t}=Z();return a.jsxs(L,{layerStyle:"first",sx:{position:"relative",width:"full",height:"full",borderRadius:"base",alignItems:"center",justifyContent:"center"},children:[a.jsx(dr,{children:e&&a.jsxs(In.div,{initial:{opacity:0},animate:{opacity:1,transition:{duration:.2}},exit:{opacity:0,transition:{duration:.2}},style:{position:"relative",width:"100%",height:"100%"},children:[a.jsx(Wme,{}),a.jsx(Ope,{}),a.jsx(Gme,{}),a.jsx(nhe,{}),a.jsx(dhe,{}),a.jsx(ghe,{}),a.jsx(bhe,{})]})}),a.jsx(dr,{children:!e&&a.jsx(In.div,{initial:{opacity:0},animate:{opacity:1,transition:{duration:.2}},exit:{opacity:0,transition:{duration:.2}},style:{position:"absolute",width:"100%",height:"100%"},children:a.jsx(L,{layerStyle:"first",sx:{position:"relative",width:"full",height:"full",borderRadius:"base",alignItems:"center",justifyContent:"center",pointerEvents:"none"},children:a.jsx(Zn,{label:t("nodes.loadingNodes"),icon:Coe})})})})]})},Che=d.memo(yhe),whe=()=>a.jsx(IN,{children:a.jsx(Che,{})}),She=d.memo(whe),khe=()=>{const{t:e}=Z(),t=te(),{data:n}=kd(),r=W(u=>u.system.isConnected),[o,{isLoading:s}]=PN({fixedCacheKey:"clearInvocationCache"}),i=d.useMemo(()=>!(n!=null&&n.size)||!r,[n==null?void 0:n.size,r]);return{clearInvocationCache:d.useCallback(async()=>{if(!i)try{await o().unwrap(),t(ct({title:e("invocationCache.clearSucceeded"),status:"success"}))}catch{t(ct({title:e("invocationCache.clearFailed"),status:"error"}))}},[i,o,t,e]),isLoading:s,cacheStatus:n,isDisabled:i}},jhe=()=>{const{t:e}=Z(),{clearInvocationCache:t,isDisabled:n,isLoading:r}=khe();return a.jsx(at,{isDisabled:n,isLoading:r,onClick:t,children:e("invocationCache.clear")})},_he=d.memo(jhe),Ihe=()=>{const{t:e}=Z(),t=te(),{data:n}=kd(),r=W(u=>u.system.isConnected),[o,{isLoading:s}]=EN({fixedCacheKey:"disableInvocationCache"}),i=d.useMemo(()=>!(n!=null&&n.enabled)||!r||(n==null?void 0:n.max_size)===0,[n==null?void 0:n.enabled,n==null?void 0:n.max_size,r]);return{disableInvocationCache:d.useCallback(async()=>{if(!i)try{await o().unwrap(),t(ct({title:e("invocationCache.disableSucceeded"),status:"success"}))}catch{t(ct({title:e("invocationCache.disableFailed"),status:"error"}))}},[i,o,t,e]),isLoading:s,cacheStatus:n,isDisabled:i}},Phe=()=>{const{t:e}=Z(),t=te(),{data:n}=kd(),r=W(u=>u.system.isConnected),[o,{isLoading:s}]=MN({fixedCacheKey:"enableInvocationCache"}),i=d.useMemo(()=>(n==null?void 0:n.enabled)||!r||(n==null?void 0:n.max_size)===0,[n==null?void 0:n.enabled,n==null?void 0:n.max_size,r]);return{enableInvocationCache:d.useCallback(async()=>{if(!i)try{await o().unwrap(),t(ct({title:e("invocationCache.enableSucceeded"),status:"success"}))}catch{t(ct({title:e("invocationCache.enableFailed"),status:"error"}))}},[i,o,t,e]),isLoading:s,cacheStatus:n,isDisabled:i}},Ehe=()=>{const{t:e}=Z(),{data:t}=kd(),{enableInvocationCache:n,isDisabled:r,isLoading:o}=Phe(),{disableInvocationCache:s,isDisabled:i,isLoading:l}=Ihe();return t!=null&&t.enabled?a.jsx(at,{isDisabled:i,isLoading:l,onClick:s,children:e("invocationCache.disable")}):a.jsx(at,{isDisabled:r,isLoading:o,onClick:n,children:e("invocationCache.enable")})},Mhe=d.memo(Ehe),Ohe=({children:e,...t})=>a.jsx(iP,{alignItems:"center",justifyContent:"center",w:"full",h:"full",layerStyle:"second",borderRadius:"base",py:2,px:3,gap:6,flexWrap:"nowrap",...t,children:e}),u7=d.memo(Ohe),Rhe={'&[aria-disabled="true"]':{color:"base.400",_dark:{color:"base.500"}}},Dhe=({label:e,value:t,isDisabled:n=!1,...r})=>a.jsxs(aP,{flexGrow:1,textOverflow:"ellipsis",overflow:"hidden",whiteSpace:"nowrap","aria-disabled":n,sx:Rhe,...r,children:[a.jsx(lP,{textOverflow:"ellipsis",overflow:"hidden",whiteSpace:"nowrap",children:e}),a.jsx(cP,{children:t})]}),hs=d.memo(Dhe),Ahe=()=>{const{t:e}=Z(),{data:t}=kd(void 0);return a.jsxs(u7,{children:[a.jsx(hs,{isDisabled:!(t!=null&&t.enabled),label:e("invocationCache.cacheSize"),value:(t==null?void 0:t.size)??0}),a.jsx(hs,{isDisabled:!(t!=null&&t.enabled),label:e("invocationCache.hits"),value:(t==null?void 0:t.hits)??0}),a.jsx(hs,{isDisabled:!(t!=null&&t.enabled),label:e("invocationCache.misses"),value:(t==null?void 0:t.misses)??0}),a.jsx(hs,{isDisabled:!(t!=null&&t.enabled),label:e("invocationCache.maxCacheSize"),value:(t==null?void 0:t.max_size)??0}),a.jsxs(Vt,{w:24,orientation:"vertical",size:"xs",children:[a.jsx(_he,{}),a.jsx(Mhe,{})]})]})},The=d.memo(Ahe),d7=e=>{const t=W(l=>l.system.isConnected),[n,{isLoading:r}]=Yx(),o=te(),{t:s}=Z();return{cancelQueueItem:d.useCallback(async()=>{try{await n(e).unwrap(),o(ct({title:s("queue.cancelSucceeded"),status:"success"}))}catch{o(ct({title:s("queue.cancelFailed"),status:"error"}))}},[o,e,s,n]),isLoading:r,isDisabled:!t}},f7=(e,t)=>Number(((Date.parse(t)-Date.parse(e))/1e3).toFixed(2)),O_={pending:{colorScheme:"cyan",translationKey:"queue.pending"},in_progress:{colorScheme:"yellow",translationKey:"queue.in_progress"},completed:{colorScheme:"green",translationKey:"queue.completed"},failed:{colorScheme:"red",translationKey:"queue.failed"},canceled:{colorScheme:"orange",translationKey:"queue.canceled"}},Nhe=({status:e})=>{const{t}=Z();return a.jsx(Ds,{colorScheme:O_[e].colorScheme,children:t(O_[e].translationKey)})},$he=d.memo(Nhe),Lhe=e=>{const t=W(u=>u.system.isConnected),{isCanceled:n}=ON({batch_id:e},{selectFromResult:({data:u})=>u?{isCanceled:(u==null?void 0:u.in_progress)===0&&(u==null?void 0:u.pending)===0}:{isCanceled:!0}}),[r,{isLoading:o}]=RN({fixedCacheKey:"cancelByBatchIds"}),s=te(),{t:i}=Z();return{cancelBatch:d.useCallback(async()=>{if(!n)try{await r({batch_ids:[e]}).unwrap(),s(ct({title:i("queue.cancelBatchSucceeded"),status:"success"}))}catch{s(ct({title:i("queue.cancelBatchFailed"),status:"error"}))}},[e,s,n,i,r]),isLoading:o,isCanceled:n,isDisabled:!t}},zhe=({queueItemDTO:e})=>{const{session_id:t,batch_id:n,item_id:r}=e,{t:o}=Z(),{cancelBatch:s,isLoading:i,isCanceled:l}=Lhe(n),{cancelQueueItem:u,isLoading:p}=d7(r),{data:m}=DN(r),h=d.useMemo(()=>{if(!m)return o("common.loading");if(!m.completed_at||!m.started_at)return o(`queue.${m.status}`);const g=f7(m.started_at,m.completed_at);return m.status==="completed"?`${o("queue.completedIn")} ${g}${g===1?"":"s"}`:`${g}s`},[m,o]);return a.jsxs(L,{layerStyle:"third",flexDir:"column",p:2,pt:0,borderRadius:"base",gap:2,children:[a.jsxs(L,{layerStyle:"second",p:2,gap:2,justifyContent:"space-between",alignItems:"center",borderRadius:"base",h:20,children:[a.jsx(Ap,{label:o("queue.status"),data:h}),a.jsx(Ap,{label:o("queue.item"),data:r}),a.jsx(Ap,{label:o("queue.batch"),data:n}),a.jsx(Ap,{label:o("queue.session"),data:t}),a.jsxs(Vt,{size:"xs",orientation:"vertical",children:[a.jsx(at,{onClick:u,isLoading:p,isDisabled:m?["canceled","completed","failed"].includes(m.status):!0,"aria-label":o("queue.cancelItem"),icon:a.jsx(Ic,{}),colorScheme:"error",children:o("queue.cancelItem")}),a.jsx(at,{onClick:s,isLoading:i,isDisabled:l,"aria-label":o("queue.cancelBatch"),icon:a.jsx(Ic,{}),colorScheme:"error",children:o("queue.cancelBatch")})]})]}),(m==null?void 0:m.error)&&a.jsxs(L,{layerStyle:"second",p:3,gap:1,justifyContent:"space-between",alignItems:"flex-start",borderRadius:"base",flexDir:"column",children:[a.jsx(cr,{size:"sm",color:"error.500",_dark:{color:"error.400"},children:"Error"}),a.jsx("pre",{children:m.error})]}),a.jsx(L,{layerStyle:"second",h:512,w:"full",borderRadius:"base",alignItems:"center",justifyContent:"center",children:m?a.jsx(Zd,{children:a.jsx(Ya,{label:"Queue Item",data:m})}):a.jsx(fa,{opacity:.5})})]})},Fhe=d.memo(zhe),Ap=({label:e,data:t})=>a.jsxs(L,{flexDir:"column",justifyContent:"flex-start",p:1,gap:1,overflow:"hidden",h:"full",w:"full",children:[a.jsx(cr,{size:"md",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",children:e}),a.jsx(ve,{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",children:t})]}),vs={number:"3rem",statusBadge:"5.7rem",statusDot:2,time:"4rem",batchId:"5rem",fieldValues:"auto",actions:"auto"},R_={bg:"base.300",_dark:{bg:"base.750"}},Bhe={_hover:R_,"&[aria-selected='true']":R_},Hhe=({index:e,item:t,context:n})=>{const{t:r}=Z(),o=d.useCallback(()=>{n.toggleQueueItem(t.item_id)},[n,t.item_id]),{cancelQueueItem:s,isLoading:i}=d7(t.item_id),l=d.useCallback(h=>{h.stopPropagation(),s()},[s]),u=d.useMemo(()=>n.openQueueItems.includes(t.item_id),[n.openQueueItems,t.item_id]),p=d.useMemo(()=>!t.completed_at||!t.started_at?void 0:`${f7(t.started_at,t.completed_at)}s`,[t]),m=d.useMemo(()=>["canceled","completed","failed"].includes(t.status),[t.status]);return a.jsxs(L,{flexDir:"column","aria-selected":u,fontSize:"sm",borderRadius:"base",justifyContent:"center",sx:Bhe,"data-testid":"queue-item",children:[a.jsxs(L,{minH:9,alignItems:"center",gap:4,p:1.5,cursor:"pointer",onClick:o,children:[a.jsx(L,{w:vs.number,justifyContent:"flex-end",alignItems:"center",flexShrink:0,children:a.jsx(ve,{variant:"subtext",children:e+1})}),a.jsx(L,{w:vs.statusBadge,alignItems:"center",flexShrink:0,children:a.jsx($he,{status:t.status})}),a.jsx(L,{w:vs.time,alignItems:"center",flexShrink:0,children:p||"-"}),a.jsx(L,{w:vs.batchId,flexShrink:0,children:a.jsx(ve,{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",alignItems:"center",children:t.batch_id})}),a.jsx(L,{alignItems:"center",overflow:"hidden",flexGrow:1,children:t.field_values&&a.jsx(L,{gap:2,w:"full",whiteSpace:"nowrap",textOverflow:"ellipsis",overflow:"hidden",children:t.field_values.filter(h=>h.node_path!=="metadata_accumulator").map(({node_path:h,field_name:g,value:x})=>a.jsxs(ve,{as:"span",children:[a.jsxs(ve,{as:"span",fontWeight:600,children:[h,".",g]}),": ",x]},`${t.item_id}.${h}.${g}.${x}`))})}),a.jsx(L,{alignItems:"center",w:vs.actions,pe:3,children:a.jsx(Vt,{size:"xs",variant:"ghost",children:a.jsx(Fe,{onClick:l,isDisabled:m,isLoading:i,"aria-label":r("queue.cancelItem"),icon:a.jsx(Ic,{})})})})]}),a.jsx(Id,{in:u,transition:{enter:{duration:.1},exit:{duration:.1}},unmountOnExit:!0,children:a.jsx(Fhe,{queueItemDTO:t})})]})},Vhe=d.memo(Hhe),Whe=d.memo(je((e,t)=>a.jsx(L,{...e,ref:t,flexDirection:"column",gap:.5,children:e.children}))),Uhe=d.memo(Whe),Ghe=()=>a.jsxs(L,{alignItems:"center",gap:4,p:1,pb:2,textTransform:"uppercase",fontWeight:700,fontSize:"xs",letterSpacing:1,children:[a.jsx(L,{w:vs.number,justifyContent:"flex-end",alignItems:"center",children:a.jsx(ve,{variant:"subtext",children:"#"})}),a.jsx(L,{ps:.5,w:vs.statusBadge,alignItems:"center",children:a.jsx(ve,{variant:"subtext",children:"status"})}),a.jsx(L,{ps:.5,w:vs.time,alignItems:"center",children:a.jsx(ve,{variant:"subtext",children:"time"})}),a.jsx(L,{ps:.5,w:vs.batchId,alignItems:"center",children:a.jsx(ve,{variant:"subtext",children:"batch"})}),a.jsx(L,{ps:.5,w:vs.fieldValues,alignItems:"center",children:a.jsx(ve,{variant:"subtext",children:"batch field values"})})]}),Khe=d.memo(Ghe),qhe={defer:!0,options:{scrollbars:{visibility:"auto",autoHide:"scroll",autoHideDelay:1300,theme:"os-theme-dark"},overflow:{x:"hidden"}}},Xhe=le(xe,({queue:e})=>{const{listCursor:t,listPriority:n}=e;return{listCursor:t,listPriority:n}},Se),Qhe=(e,t)=>t.item_id,Yhe={List:Uhe},Zhe=(e,t,n)=>a.jsx(Vhe,{index:e,item:t,context:n}),Jhe=()=>{const{listCursor:e,listPriority:t}=W(Xhe),n=te(),r=d.useRef(null),[o,s]=d.useState(null),[i,l]=Ey(qhe),{t:u}=Z();d.useEffect(()=>{const{current:S}=r;return o&&S&&i({target:S,elements:{viewport:o}}),()=>{var j;return(j=l())==null?void 0:j.destroy()}},[o,i,l]);const{data:p,isLoading:m}=AN({cursor:e,priority:t}),h=d.useMemo(()=>p?TN.getSelectors().selectAll(p):[],[p]),g=d.useCallback(()=>{if(!(p!=null&&p.has_more))return;const S=h[h.length-1];S&&(n(Zx(S.item_id)),n(Jx(S.priority)))},[n,p==null?void 0:p.has_more,h]),[x,y]=d.useState([]),b=d.useCallback(S=>{y(j=>j.includes(S)?j.filter(_=>_!==S):[...j,S])},[]),w=d.useMemo(()=>({openQueueItems:x,toggleQueueItem:b}),[x,b]);return m?a.jsx($ne,{}):h.length?a.jsxs(L,{w:"full",h:"full",flexDir:"column",children:[a.jsx(Khe,{}),a.jsx(L,{ref:r,w:"full",h:"full",alignItems:"center",justifyContent:"center",children:a.jsx(qre,{data:h,endReached:g,scrollerRef:s,itemContent:Zhe,computeItemKey:Qhe,components:Yhe,context:w})})]}):a.jsx(L,{w:"full",h:"full",alignItems:"center",justifyContent:"center",children:a.jsx(cr,{color:"base.400",_dark:{color:"base.500"},children:u("queue.queueEmpty")})})},ege=d.memo(Jhe),tge=()=>{const{data:e}=va(),{t}=Z();return a.jsxs(u7,{"data-testid":"queue-status",children:[a.jsx(hs,{label:t("queue.in_progress"),value:(e==null?void 0:e.queue.in_progress)??0}),a.jsx(hs,{label:t("queue.pending"),value:(e==null?void 0:e.queue.pending)??0}),a.jsx(hs,{label:t("queue.completed"),value:(e==null?void 0:e.queue.completed)??0}),a.jsx(hs,{label:t("queue.failed"),value:(e==null?void 0:e.queue.failed)??0}),a.jsx(hs,{label:t("queue.canceled"),value:(e==null?void 0:e.queue.canceled)??0}),a.jsx(hs,{label:t("queue.total"),value:(e==null?void 0:e.queue.total)??0})]})},nge=d.memo(tge);function rge(e){return Te({tag:"svg",attr:{fill:"currentColor",viewBox:"0 0 16 16"},child:[{tag:"path",attr:{d:"M7.657 6.247c.11-.33.576-.33.686 0l.645 1.937a2.89 2.89 0 0 0 1.829 1.828l1.936.645c.33.11.33.576 0 .686l-1.937.645a2.89 2.89 0 0 0-1.828 1.829l-.645 1.936a.361.361 0 0 1-.686 0l-.645-1.937a2.89 2.89 0 0 0-1.828-1.828l-1.937-.645a.361.361 0 0 1 0-.686l1.937-.645a2.89 2.89 0 0 0 1.828-1.828l.645-1.937zM3.794 1.148a.217.217 0 0 1 .412 0l.387 1.162c.173.518.579.924 1.097 1.097l1.162.387a.217.217 0 0 1 0 .412l-1.162.387A1.734 1.734 0 0 0 4.593 5.69l-.387 1.162a.217.217 0 0 1-.412 0L3.407 5.69A1.734 1.734 0 0 0 2.31 4.593l-1.162-.387a.217.217 0 0 1 0-.412l1.162-.387A1.734 1.734 0 0 0 3.407 2.31l.387-1.162zM10.863.099a.145.145 0 0 1 .274 0l.258.774c.115.346.386.617.732.732l.774.258a.145.145 0 0 1 0 .274l-.774.258a1.156 1.156 0 0 0-.732.732l-.258.774a.145.145 0 0 1-.274 0l-.258-.774a1.156 1.156 0 0 0-.732-.732L9.1 2.137a.145.145 0 0 1 0-.274l.774-.258c.346-.115.617-.386.732-.732L10.863.1z"}}]})(e)}const oge=()=>{const e=te(),{t}=Z(),n=W(u=>u.system.isConnected),[r,{isLoading:o}]=RI({fixedCacheKey:"pruneQueue"}),{finishedCount:s}=va(void 0,{selectFromResult:({data:u})=>u?{finishedCount:u.queue.completed+u.queue.canceled+u.queue.failed}:{finishedCount:0}}),i=d.useCallback(async()=>{if(s)try{const u=await r().unwrap();e(ct({title:t("queue.pruneSucceeded",{item_count:u.deleted}),status:"success"})),e(Zx(void 0)),e(Jx(void 0))}catch{e(ct({title:t("queue.pruneFailed"),status:"error"}))}},[s,r,e,t]),l=d.useMemo(()=>!n||!s,[s,n]);return{pruneQueue:i,isLoading:o,finishedCount:s,isDisabled:l}},sge=({asIconButton:e})=>{const{t}=Z(),{pruneQueue:n,isLoading:r,finishedCount:o,isDisabled:s}=oge();return a.jsx(ul,{isDisabled:s,isLoading:r,asIconButton:e,label:t("queue.prune"),tooltip:t("queue.pruneTooltip",{item_count:o}),icon:a.jsx(rge,{}),onClick:n,colorScheme:"blue"})},age=d.memo(sge),ige=()=>{const e=Bt("pauseQueue").isFeatureEnabled,t=Bt("resumeQueue").isFeatureEnabled;return a.jsxs(L,{layerStyle:"second",borderRadius:"base",p:2,gap:2,children:[e||t?a.jsxs(Vt,{w:28,orientation:"vertical",isAttached:!0,size:"sm",children:[t?a.jsx(X8,{}):a.jsx(a.Fragment,{}),e?a.jsx(V8,{}):a.jsx(a.Fragment,{})]}):a.jsx(a.Fragment,{}),a.jsxs(Vt,{w:28,orientation:"vertical",isAttached:!0,size:"sm",children:[a.jsx(age,{}),a.jsx(qy,{})]})]})},lge=d.memo(ige),cge=()=>{const e=Bt("invocationCache").isFeatureEnabled;return a.jsxs(L,{layerStyle:"first",borderRadius:"base",w:"full",h:"full",p:2,flexDir:"column",gap:2,children:[a.jsxs(L,{gap:2,w:"full",children:[a.jsx(lge,{}),a.jsx(nge,{}),e&&a.jsx(The,{})]}),a.jsx(Ie,{layerStyle:"second",p:2,borderRadius:"base",w:"full",h:"full",children:a.jsx(ege,{})})]})},uge=d.memo(cge),dge=()=>a.jsx(uge,{}),fge=d.memo(dge),pge=()=>a.jsx(KO,{}),mge=d.memo(pge);var Ax={exports:{}};(function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.Konva=void 0;var n=Lw;Object.defineProperty(t,"Konva",{enumerable:!0,get:function(){return n.Konva}});const r=Lw;e.exports=r.Konva})(Ax,Ax.exports);var hge=Ax.exports;const gd=xd(hge);var p7={exports:{}};/** + */function zt(e,t){if(dg(e))for(let n=0;nt(e[n],n,e));return e}function ur(e,t){const n=li(t);if(ts(t)||n){let o=n?"":{};if(e){const s=window.getComputedStyle(e,null);o=n?nj(e,s,t):t.reduce((i,l)=>(i[l]=nj(e,s,l),i),o)}return o}e&&zt(ro(t),o=>Kee(e,o,t[o]))}const Fo=(e,t)=>{const{o:n,u:r,_:o}=e;let s=n,i;const l=(m,h)=>{const g=s,x=m,y=h||(r?!r(g,x):g!==x);return(y||o)&&(s=x,i=g),[s,y,i]};return[t?m=>l(t(s,i),m):l,m=>[s,!!m,i]]},Gd=()=>typeof window<"u",jM=Gd()&&Node.ELEMENT_NODE,{toString:Ree,hasOwnProperty:Rv}=Object.prototype,Ca=e=>e===void 0,ug=e=>e===null,Dee=e=>Ca(e)||ug(e)?`${e}`:Ree.call(e).replace(/^\[object (.+)\]$/,"$1").toLowerCase(),Xa=e=>typeof e=="number",li=e=>typeof e=="string",my=e=>typeof e=="boolean",es=e=>typeof e=="function",ts=e=>Array.isArray(e),ad=e=>typeof e=="object"&&!ts(e)&&!ug(e),dg=e=>{const t=!!e&&e.length,n=Xa(t)&&t>-1&&t%1==0;return ts(e)||!es(e)&&n?t>0&&ad(e)?t-1 in e:!0:!1},lx=e=>{if(!e||!ad(e)||Dee(e)!=="object")return!1;let t;const n="constructor",r=e[n],o=r&&r.prototype,s=Rv.call(e,n),i=o&&Rv.call(o,"isPrototypeOf");if(r&&!s&&!i)return!1;for(t in e);return Ca(t)||Rv.call(e,t)},Zm=e=>{const t=HTMLElement;return e?t?e instanceof t:e.nodeType===jM:!1},fg=e=>{const t=Element;return e?t?e instanceof t:e.nodeType===jM:!1},hy=(e,t,n)=>e.indexOf(t,n),Xt=(e,t,n)=>(!n&&!li(t)&&dg(t)?Array.prototype.push.apply(e,t):e.push(t),e),Yi=e=>{const t=Array.from,n=[];return t&&e?t(e):(e instanceof Set?e.forEach(r=>{Xt(n,r)}):zt(e,r=>{Xt(n,r)}),n)},gy=e=>!!e&&e.length===0,As=(e,t,n)=>{zt(e,o=>o&&o.apply(void 0,t||[])),!n&&(e.length=0)},pg=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),ro=e=>e?Object.keys(e):[],Cn=(e,t,n,r,o,s,i)=>{const l=[t,n,r,o,s,i];return(typeof e!="object"||ug(e))&&!es(e)&&(e={}),zt(l,u=>{zt(ro(u),p=>{const m=u[p];if(e===m)return!0;const h=ts(m);if(m&&(lx(m)||h)){const g=e[p];let x=g;h&&!ts(g)?x=[]:!h&&!lx(g)&&(x={}),e[p]=Cn(x,m)}else e[p]=m})}),e},vy=e=>{for(const t in e)return!1;return!0},_M=(e,t,n,r)=>{if(Ca(r))return n?n[e]:t;n&&(li(r)||Xa(r))&&(n[e]=r)},lr=(e,t,n)=>{if(Ca(n))return e?e.getAttribute(t):null;e&&e.setAttribute(t,n)},Mr=(e,t)=>{e&&e.removeAttribute(t)},Ni=(e,t,n,r)=>{if(n){const o=lr(e,t)||"",s=new Set(o.split(" "));s[r?"add":"delete"](n);const i=Yi(s).join(" ").trim();lr(e,t,i)}},Aee=(e,t,n)=>{const r=lr(e,t)||"";return new Set(r.split(" ")).has(n)},Ko=(e,t)=>_M("scrollLeft",0,e,t),na=(e,t)=>_M("scrollTop",0,e,t),cx=Gd()&&Element.prototype,IM=(e,t)=>{const n=[],r=t?fg(t)?t:null:document;return r?Xt(n,r.querySelectorAll(e)):n},Tee=(e,t)=>{const n=t?fg(t)?t:null:document;return n?n.querySelector(e):null},Jm=(e,t)=>fg(e)?(cx.matches||cx.msMatchesSelector).call(e,t):!1,xy=e=>e?Yi(e.childNodes):[],la=e=>e?e.parentElement:null,Jl=(e,t)=>{if(fg(e)){const n=cx.closest;if(n)return n.call(e,t);do{if(Jm(e,t))return e;e=la(e)}while(e)}return null},Nee=(e,t,n)=>{const r=e&&Jl(e,t),o=e&&Tee(n,r),s=Jl(o,t)===r;return r&&o?r===e||o===e||s&&Jl(Jl(e,n),t)!==r:!1},by=(e,t,n)=>{if(n&&e){let r=t,o;dg(n)?(o=document.createDocumentFragment(),zt(n,s=>{s===r&&(r=s.previousSibling),o.appendChild(s)})):o=n,t&&(r?r!==t&&(r=r.nextSibling):r=e.firstChild),e.insertBefore(o,r||null)}},xo=(e,t)=>{by(e,null,t)},$ee=(e,t)=>{by(la(e),e,t)},Jk=(e,t)=>{by(la(e),e&&e.nextSibling,t)},js=e=>{if(dg(e))zt(Yi(e),t=>js(t));else if(e){const t=la(e);t&&t.removeChild(e)}},$i=e=>{const t=document.createElement("div");return e&&lr(t,"class",e),t},PM=e=>{const t=$i();return t.innerHTML=e.trim(),zt(xy(t),n=>js(n))},ux=e=>e.charAt(0).toUpperCase()+e.slice(1),Lee=()=>$i().style,zee=["-webkit-","-moz-","-o-","-ms-"],Fee=["WebKit","Moz","O","MS","webkit","moz","o","ms"],Dv={},Av={},Bee=e=>{let t=Av[e];if(pg(Av,e))return t;const n=ux(e),r=Lee();return zt(zee,o=>{const s=o.replace(/-/g,"");return!(t=[e,o+e,s+n,ux(s)+n].find(l=>r[l]!==void 0))}),Av[e]=t||""},Kd=e=>{if(Gd()){let t=Dv[e]||window[e];return pg(Dv,e)||(zt(Fee,n=>(t=t||window[n+ux(e)],!t)),Dv[e]=t),t}},Hee=Kd("MutationObserver"),ej=Kd("IntersectionObserver"),ec=Kd("ResizeObserver"),EM=Kd("cancelAnimationFrame"),MM=Kd("requestAnimationFrame"),eh=Gd()&&window.setTimeout,dx=Gd()&&window.clearTimeout,Vee=/[^\x20\t\r\n\f]+/g,OM=(e,t,n)=>{const r=e&&e.classList;let o,s=0,i=!1;if(r&&t&&li(t)){const l=t.match(Vee)||[];for(i=l.length>0;o=l[s++];)i=!!n(r,o)&&i}return i},yy=(e,t)=>{OM(e,t,(n,r)=>n.remove(r))},ra=(e,t)=>(OM(e,t,(n,r)=>n.add(r)),yy.bind(0,e,t)),mg=(e,t,n,r)=>{if(e&&t){let o=!0;return zt(n,s=>{const i=r?r(e[s]):e[s],l=r?r(t[s]):t[s];i!==l&&(o=!1)}),o}return!1},RM=(e,t)=>mg(e,t,["w","h"]),DM=(e,t)=>mg(e,t,["x","y"]),Wee=(e,t)=>mg(e,t,["t","r","b","l"]),tj=(e,t,n)=>mg(e,t,["width","height"],n&&(r=>Math.round(r))),go=()=>{},Kl=e=>{let t;const n=e?eh:MM,r=e?dx:EM;return[o=>{r(t),t=n(o,es(e)?e():e)},()=>r(t)]},Cy=(e,t)=>{let n,r,o,s=go;const{v:i,g:l,p:u}=t||{},p=function(y){s(),dx(n),n=r=void 0,s=go,e.apply(this,y)},m=x=>u&&r?u(r,x):x,h=()=>{s!==go&&p(m(o)||o)},g=function(){const y=Yi(arguments),b=es(i)?i():i;if(Xa(b)&&b>=0){const S=es(l)?l():l,j=Xa(S)&&S>=0,_=b>0?eh:MM,E=b>0?dx:EM,M=m(y)||y,R=p.bind(0,M);s();const D=_(R,b);s=()=>E(D),j&&!n&&(n=eh(h,S)),r=o=M}else p(y)};return g.m=h,g},Uee={opacity:1,zindex:1},yp=(e,t)=>{const n=t?parseFloat(e):parseInt(e,10);return n===n?n:0},Gee=(e,t)=>!Uee[e.toLowerCase()]&&Xa(t)?`${t}px`:t,nj=(e,t,n)=>t!=null?t[n]||t.getPropertyValue(n):e.style[n],Kee=(e,t,n)=>{try{const{style:r}=e;Ca(r[t])?r.setProperty(t,n):r[t]=Gee(t,n)}catch{}},id=e=>ur(e,"direction")==="rtl",rj=(e,t,n)=>{const r=t?`${t}-`:"",o=n?`-${n}`:"",s=`${r}top${o}`,i=`${r}right${o}`,l=`${r}bottom${o}`,u=`${r}left${o}`,p=ur(e,[s,i,l,u]);return{t:yp(p[s],!0),r:yp(p[i],!0),b:yp(p[l],!0),l:yp(p[u],!0)}},{round:oj}=Math,wy={w:0,h:0},ld=e=>e?{w:e.offsetWidth,h:e.offsetHeight}:wy,Wp=e=>e?{w:e.clientWidth,h:e.clientHeight}:wy,th=e=>e?{w:e.scrollWidth,h:e.scrollHeight}:wy,nh=e=>{const t=parseFloat(ur(e,"height"))||0,n=parseFloat(ur(e,"width"))||0;return{w:n-oj(n),h:t-oj(t)}},xs=e=>e.getBoundingClientRect();let Cp;const qee=()=>{if(Ca(Cp)){Cp=!1;try{window.addEventListener("test",null,Object.defineProperty({},"passive",{get(){Cp=!0}}))}catch{}}return Cp},AM=e=>e.split(" "),Xee=(e,t,n,r)=>{zt(AM(t),o=>{e.removeEventListener(o,n,r)})},Wn=(e,t,n,r)=>{var o;const s=qee(),i=(o=s&&r&&r.S)!=null?o:s,l=r&&r.$||!1,u=r&&r.C||!1,p=[],m=s?{passive:i,capture:l}:l;return zt(AM(t),h=>{const g=u?x=>{e.removeEventListener(h,g,l),n&&n(x)}:n;Xt(p,Xee.bind(null,e,h,g,l)),e.addEventListener(h,g,m)}),As.bind(0,p)},TM=e=>e.stopPropagation(),NM=e=>e.preventDefault(),Qee={x:0,y:0},Tv=e=>{const t=e?xs(e):0;return t?{x:t.left+window.pageYOffset,y:t.top+window.pageXOffset}:Qee},sj=(e,t)=>{zt(ts(t)?t:[t],e)},Sy=e=>{const t=new Map,n=(s,i)=>{if(s){const l=t.get(s);sj(u=>{l&&l[u?"delete":"clear"](u)},i)}else t.forEach(l=>{l.clear()}),t.clear()},r=(s,i)=>{if(li(s)){const p=t.get(s)||new Set;return t.set(s,p),sj(m=>{es(m)&&p.add(m)},i),n.bind(0,s,i)}my(i)&&i&&n();const l=ro(s),u=[];return zt(l,p=>{const m=s[p];m&&Xt(u,r(p,m))}),As.bind(0,u)},o=(s,i)=>{const l=t.get(s);zt(Yi(l),u=>{i&&!gy(i)?u.apply(0,i):u()})};return r(e||{}),[r,n,o]},aj=e=>JSON.stringify(e,(t,n)=>{if(es(n))throw new Error;return n}),Yee={paddingAbsolute:!1,showNativeOverlaidScrollbars:!1,update:{elementEvents:[["img","load"]],debounce:[0,33],attributes:null,ignoreMutation:null},overflow:{x:"scroll",y:"scroll"},scrollbars:{theme:"os-theme-dark",visibility:"auto",autoHide:"never",autoHideDelay:1300,dragScroll:!0,clickScroll:!1,pointers:["mouse","touch","pen"]}},$M=(e,t)=>{const n={},r=ro(t).concat(ro(e));return zt(r,o=>{const s=e[o],i=t[o];if(ad(s)&&ad(i))Cn(n[o]={},$M(s,i)),vy(n[o])&&delete n[o];else if(pg(t,o)&&i!==s){let l=!0;if(ts(s)||ts(i))try{aj(s)===aj(i)&&(l=!1)}catch{}l&&(n[o]=i)}}),n},LM="os-environment",zM=`${LM}-flexbox-glue`,Zee=`${zM}-max`,FM="os-scrollbar-hidden",Nv="data-overlayscrollbars-initialize",Bo="data-overlayscrollbars",BM=`${Bo}-overflow-x`,HM=`${Bo}-overflow-y`,mc="overflowVisible",Jee="scrollbarHidden",ij="scrollbarPressed",rh="updating",Fa="data-overlayscrollbars-viewport",$v="arrange",VM="scrollbarHidden",hc=mc,fx="data-overlayscrollbars-padding",ete=hc,lj="data-overlayscrollbars-content",ky="os-size-observer",tte=`${ky}-appear`,nte=`${ky}-listener`,rte="os-trinsic-observer",ote="os-no-css-vars",ste="os-theme-none",Hr="os-scrollbar",ate=`${Hr}-rtl`,ite=`${Hr}-horizontal`,lte=`${Hr}-vertical`,WM=`${Hr}-track`,jy=`${Hr}-handle`,cte=`${Hr}-visible`,ute=`${Hr}-cornerless`,cj=`${Hr}-transitionless`,uj=`${Hr}-interaction`,dj=`${Hr}-unusable`,fj=`${Hr}-auto-hidden`,pj=`${Hr}-wheel`,dte=`${WM}-interactive`,fte=`${jy}-interactive`,UM={},Zi=()=>UM,pte=e=>{const t=[];return zt(ts(e)?e:[e],n=>{const r=ro(n);zt(r,o=>{Xt(t,UM[o]=n[o])})}),t},mte="__osOptionsValidationPlugin",hte="__osSizeObserverPlugin",_y="__osScrollbarsHidingPlugin",gte="__osClickScrollPlugin";let Lv;const mj=(e,t,n,r)=>{xo(e,t);const o=Wp(t),s=ld(t),i=nh(n);return r&&js(t),{x:s.h-o.h+i.h,y:s.w-o.w+i.w}},vte=e=>{let t=!1;const n=ra(e,FM);try{t=ur(e,Bee("scrollbar-width"))==="none"||window.getComputedStyle(e,"::-webkit-scrollbar").getPropertyValue("display")==="none"}catch{}return n(),t},xte=(e,t)=>{const n="hidden";ur(e,{overflowX:n,overflowY:n,direction:"rtl"}),Ko(e,0);const r=Tv(e),o=Tv(t);Ko(e,-999);const s=Tv(t);return{i:r.x===o.x,n:o.x!==s.x}},bte=(e,t)=>{const n=ra(e,zM),r=xs(e),o=xs(t),s=tj(o,r,!0),i=ra(e,Zee),l=xs(e),u=xs(t),p=tj(u,l,!0);return n(),i(),s&&p},yte=()=>{const{body:e}=document,n=PM(`
`)[0],r=n.firstChild,[o,,s]=Sy(),[i,l]=Fo({o:mj(e,n,r),u:DM},mj.bind(0,e,n,r,!0)),[u]=l(),p=vte(n),m={x:u.x===0,y:u.y===0},h={elements:{host:null,padding:!p,viewport:j=>p&&j===j.ownerDocument.body&&j,content:!1},scrollbars:{slot:!0},cancel:{nativeScrollbarsOverlaid:!1,body:null}},g=Cn({},Yee),x=Cn.bind(0,{},g),y=Cn.bind(0,{},h),b={k:u,A:m,I:p,L:ur(n,"zIndex")==="-1",B:xte(n,r),V:bte(n,r),Y:o.bind(0,"z"),j:o.bind(0,"r"),N:y,q:j=>Cn(h,j)&&y(),F:x,G:j=>Cn(g,j)&&x(),X:Cn({},h),U:Cn({},g)},w=window.addEventListener,S=Cy(j=>s(j?"z":"r"),{v:33,g:99});if(Mr(n,"style"),js(n),w("resize",S.bind(0,!1)),!p&&(!m.x||!m.y)){let j;w("resize",()=>{const _=Zi()[_y];j=j||_&&_.R(),j&&j(b,i,S.bind(0,!0))})}return b},Vr=()=>(Lv||(Lv=yte()),Lv),Iy=(e,t)=>es(t)?t.apply(0,e):t,Cte=(e,t,n,r)=>{const o=Ca(r)?n:r;return Iy(e,o)||t.apply(0,e)},GM=(e,t,n,r)=>{const o=Ca(r)?n:r,s=Iy(e,o);return!!s&&(Zm(s)?s:t.apply(0,e))},wte=(e,t,n)=>{const{nativeScrollbarsOverlaid:r,body:o}=n||{},{A:s,I:i}=Vr(),{nativeScrollbarsOverlaid:l,body:u}=t,p=r??l,m=Ca(o)?u:o,h=(s.x||s.y)&&p,g=e&&(ug(m)?!i:m);return!!h||!!g},Py=new WeakMap,Ste=(e,t)=>{Py.set(e,t)},kte=e=>{Py.delete(e)},KM=e=>Py.get(e),hj=(e,t)=>e?t.split(".").reduce((n,r)=>n&&pg(n,r)?n[r]:void 0,e):void 0,px=(e,t,n)=>r=>[hj(e,r),n||hj(t,r)!==void 0],qM=e=>{let t=e;return[()=>t,n=>{t=Cn({},t,n)}]},wp="tabindex",Sp=$i.bind(0,""),zv=e=>{xo(la(e),xy(e)),js(e)},jte=e=>{const t=Vr(),{N:n,I:r}=t,o=Zi()[_y],s=o&&o.T,{elements:i}=n(),{host:l,padding:u,viewport:p,content:m}=i,h=Zm(e),g=h?{}:e,{elements:x}=g,{host:y,padding:b,viewport:w,content:S}=x||{},j=h?e:g.target,_=Jm(j,"textarea"),E=j.ownerDocument,I=E.documentElement,M=j===E.body,R=E.defaultView,D=Cte.bind(0,[j]),A=GM.bind(0,[j]),O=Iy.bind(0,[j]),T=D.bind(0,Sp,p),X=A.bind(0,Sp,m),B=T(w),V=B===j,U=V&&M,N=!V&&X(S),$=!V&&Zm(B)&&B===N,q=$&&!!O(m),F=q?T():B,Q=q?N:X(),se=U?I:$?F:B,ae=_?D(Sp,l,y):j,re=U?se:ae,G=$?Q:N,K=E.activeElement,ee=!V&&R.top===R&&K===j,le={W:j,Z:re,J:se,K:!V&&A(Sp,u,b),tt:G,nt:!V&&!r&&s&&s(t),ot:U?I:se,st:U?E:se,et:R,ct:E,rt:_,it:M,lt:h,ut:V,dt:$,ft:(Ze,ot)=>Aee(se,V?Bo:Fa,V?ot:Ze),_t:(Ze,ot,ye)=>Ni(se,V?Bo:Fa,V?ot:Ze,ye)},J=ro(le).reduce((Ze,ot)=>{const ye=le[ot];return Xt(Ze,ye&&!la(ye)?ye:!1)},[]),ie=Ze=>Ze?hy(J,Ze)>-1:null,{W:de,Z:ge,K:Ce,J:he,tt:fe,nt:Oe}=le,_e=[()=>{Mr(ge,Bo),Mr(ge,Nv),Mr(de,Nv),M&&(Mr(I,Bo),Mr(I,Nv))}],Ne=_&&ie(ge);let nt=_?de:xy([fe,he,Ce,ge,de].find(Ze=>ie(Ze)===!1));const $e=U?de:fe||he;return[le,()=>{lr(ge,Bo,V?"viewport":"host"),lr(Ce,fx,""),lr(fe,lj,""),V||lr(he,Fa,"");const Ze=M&&!V?ra(la(j),FM):go;if(Ne&&(Jk(de,ge),Xt(_e,()=>{Jk(ge,de),js(ge)})),xo($e,nt),xo(ge,Ce),xo(Ce||ge,!V&&he),xo(he,fe),Xt(_e,()=>{Ze(),Mr(Ce,fx),Mr(fe,lj),Mr(he,BM),Mr(he,HM),Mr(he,Fa),ie(fe)&&zv(fe),ie(he)&&zv(he),ie(Ce)&&zv(Ce)}),r&&!V&&(Ni(he,Fa,VM,!0),Xt(_e,Mr.bind(0,he,Fa))),Oe&&($ee(he,Oe),Xt(_e,js.bind(0,Oe))),ee){const ot=lr(he,wp);lr(he,wp,"-1"),he.focus();const ye=()=>ot?lr(he,wp,ot):Mr(he,wp),De=Wn(E,"pointerdown keydown",()=>{ye(),De()});Xt(_e,[ye,De])}else K&&K.focus&&K.focus();nt=0},As.bind(0,_e)]},_te=(e,t)=>{const{tt:n}=e,[r]=t;return o=>{const{V:s}=Vr(),{ht:i}=r(),{vt:l}=o,u=(n||!s)&&l;return u&&ur(n,{height:i?"":"100%"}),{gt:u,wt:u}}},Ite=(e,t)=>{const[n,r]=t,{Z:o,K:s,J:i,ut:l}=e,[u,p]=Fo({u:Wee,o:rj()},rj.bind(0,o,"padding",""));return(m,h,g)=>{let[x,y]=p(g);const{I:b,V:w}=Vr(),{bt:S}=n(),{gt:j,wt:_,yt:E}=m,[I,M]=h("paddingAbsolute");(j||y||!w&&_)&&([x,y]=u(g));const D=!l&&(M||E||y);if(D){const A=!I||!s&&!b,O=x.r+x.l,T=x.t+x.b,X={marginRight:A&&!S?-O:0,marginBottom:A?-T:0,marginLeft:A&&S?-O:0,top:A?-x.t:0,right:A?S?-x.r:"auto":0,left:A?S?"auto":-x.l:0,width:A?`calc(100% + ${O}px)`:""},B={paddingTop:A?x.t:0,paddingRight:A?x.r:0,paddingBottom:A?x.b:0,paddingLeft:A?x.l:0};ur(s||i,X),ur(i,B),r({K:x,St:!A,P:s?B:Cn({},X,B)})}return{xt:D}}},{max:mx}=Math,Ba=mx.bind(0,0),XM="visible",gj="hidden",Pte=42,kp={u:RM,o:{w:0,h:0}},Ete={u:DM,o:{x:gj,y:gj}},Mte=(e,t)=>{const n=window.devicePixelRatio%1!==0?1:0,r={w:Ba(e.w-t.w),h:Ba(e.h-t.h)};return{w:r.w>n?r.w:0,h:r.h>n?r.h:0}},jp=e=>e.indexOf(XM)===0,Ote=(e,t)=>{const[n,r]=t,{Z:o,K:s,J:i,nt:l,ut:u,_t:p,it:m,et:h}=e,{k:g,V:x,I:y,A:b}=Vr(),w=Zi()[_y],S=!u&&!y&&(b.x||b.y),j=m&&u,[_,E]=Fo(kp,nh.bind(0,i)),[I,M]=Fo(kp,th.bind(0,i)),[R,D]=Fo(kp),[A,O]=Fo(kp),[T]=Fo(Ete),X=(q,F)=>{if(ur(i,{height:""}),F){const{St:Q,K:Y}=n(),{$t:se,D:ae}=q,re=nh(o),G=Wp(o),K=ur(i,"boxSizing")==="content-box",ee=Q||K?Y.b+Y.t:0,le=!(b.x&&K);ur(i,{height:G.h+re.h+(se.x&&le?ae.x:0)-ee})}},B=(q,F)=>{const Q=!y&&!q?Pte:0,Y=(ie,de,ge)=>{const Ce=ur(i,ie),fe=(F?F[ie]:Ce)==="scroll";return[Ce,fe,fe&&!y?de?Q:ge:0,de&&!!Q]},[se,ae,re,G]=Y("overflowX",b.x,g.x),[K,ee,le,J]=Y("overflowY",b.y,g.y);return{Ct:{x:se,y:K},$t:{x:ae,y:ee},D:{x:re,y:le},M:{x:G,y:J}}},V=(q,F,Q,Y)=>{const se=(ee,le)=>{const J=jp(ee),ie=le&&J&&ee.replace(`${XM}-`,"")||"";return[le&&!J?ee:"",jp(ie)?"hidden":ie]},[ae,re]=se(Q.x,F.x),[G,K]=se(Q.y,F.y);return Y.overflowX=re&&G?re:ae,Y.overflowY=K&&ae?K:G,B(q,Y)},U=(q,F,Q,Y)=>{const{D:se,M:ae}=q,{x:re,y:G}=ae,{x:K,y:ee}=se,{P:le}=n(),J=F?"marginLeft":"marginRight",ie=F?"paddingLeft":"paddingRight",de=le[J],ge=le.marginBottom,Ce=le[ie],he=le.paddingBottom;Y.width=`calc(100% + ${ee+-1*de}px)`,Y[J]=-ee+de,Y.marginBottom=-K+ge,Q&&(Y[ie]=Ce+(G?ee:0),Y.paddingBottom=he+(re?K:0))},[N,$]=w?w.H(S,x,i,l,n,B,U):[()=>S,()=>[go]];return(q,F,Q)=>{const{gt:Y,Ot:se,wt:ae,xt:re,vt:G,yt:K}=q,{ht:ee,bt:le}=n(),[J,ie]=F("showNativeOverlaidScrollbars"),[de,ge]=F("overflow"),Ce=J&&b.x&&b.y,he=!u&&!x&&(Y||ae||se||ie||G),fe=jp(de.x),Oe=jp(de.y),_e=fe||Oe;let Ne=E(Q),nt=M(Q),$e=D(Q),Pt=O(Q),Ze;if(ie&&y&&p(VM,Jee,!Ce),he&&(Ze=B(Ce),X(Ze,ee)),Y||re||ae||K||ie){_e&&p(hc,mc,!1);const[Se,Be]=$(Ce,le,Ze),[ze,Ge]=Ne=_(Q),[pt,Pn]=nt=I(Q),Dt=Wp(i);let At=pt,pr=Dt;Se(),(Pn||Ge||ie)&&Be&&!Ce&&N(Be,pt,ze,le)&&(pr=Wp(i),At=th(i));const Ln={w:Ba(mx(pt.w,At.w)+ze.w),h:Ba(mx(pt.h,At.h)+ze.h)},kn={w:Ba((j?h.innerWidth:pr.w+Ba(Dt.w-pt.w))+ze.w),h:Ba((j?h.innerHeight+ze.h:pr.h+Ba(Dt.h-pt.h))+ze.h)};Pt=A(kn),$e=R(Mte(Ln,kn),Q)}const[ot,ye]=Pt,[De,ut]=$e,[bt,be]=nt,[Je,lt]=Ne,ft={x:De.w>0,y:De.h>0},Me=fe&&Oe&&(ft.x||ft.y)||fe&&ft.x&&!ft.y||Oe&&ft.y&&!ft.x;if(re||K||lt||be||ye||ut||ge||ie||he){const Se={marginRight:0,marginBottom:0,marginLeft:0,width:"",overflowY:"",overflowX:""},Be=V(Ce,ft,de,Se),ze=N(Be,bt,Je,le);u||U(Be,le,ze,Se),he&&X(Be,ee),u?(lr(o,BM,Se.overflowX),lr(o,HM,Se.overflowY)):ur(i,Se)}Ni(o,Bo,mc,Me),Ni(s,fx,ete,Me),u||Ni(i,Fa,hc,_e);const[Le,Ut]=T(B(Ce).Ct);return r({Ct:Le,zt:{x:ot.w,y:ot.h},Tt:{x:De.w,y:De.h},Et:ft}),{It:Ut,At:ye,Lt:ut}}},vj=(e,t,n)=>{const r={},o=t||{},s=ro(e).concat(ro(o));return zt(s,i=>{const l=e[i],u=o[i];r[i]=!!(n||l||u)}),r},Rte=(e,t)=>{const{W:n,J:r,_t:o,ut:s}=e,{I:i,A:l,V:u}=Vr(),p=!i&&(l.x||l.y),m=[_te(e,t),Ite(e,t),Ote(e,t)];return(h,g,x)=>{const y=vj(Cn({gt:!1,xt:!1,yt:!1,vt:!1,At:!1,Lt:!1,It:!1,Ot:!1,wt:!1},g),{},x),b=p||!u,w=b&&Ko(r),S=b&&na(r);o("",rh,!0);let j=y;return zt(m,_=>{j=vj(j,_(j,h,!!x)||{},x)}),Ko(r,w),na(r,S),o("",rh),s||(Ko(n,0),na(n,0)),j}},Dte=(e,t,n)=>{let r,o=!1;const s=()=>{o=!0},i=l=>{if(n){const u=n.reduce((p,m)=>{if(m){const[h,g]=m,x=g&&h&&(l?l(h):IM(h,e));x&&x.length&&g&&li(g)&&Xt(p,[x,g.trim()],!0)}return p},[]);zt(u,p=>zt(p[0],m=>{const h=p[1],g=r.get(m)||[];if(e.contains(m)){const y=Wn(m,h,b=>{o?(y(),r.delete(m)):t(b)});r.set(m,Xt(g,y))}else As(g),r.delete(m)}))}};return n&&(r=new WeakMap,i()),[s,i]},xj=(e,t,n,r)=>{let o=!1;const{Ht:s,Pt:i,Dt:l,Mt:u,Rt:p,kt:m}=r||{},h=Cy(()=>{o&&n(!0)},{v:33,g:99}),[g,x]=Dte(e,h,l),y=s||[],b=i||[],w=y.concat(b),S=(_,E)=>{const I=p||go,M=m||go,R=new Set,D=new Set;let A=!1,O=!1;if(zt(_,T=>{const{attributeName:X,target:B,type:V,oldValue:U,addedNodes:N,removedNodes:$}=T,q=V==="attributes",F=V==="childList",Q=e===B,Y=q&&li(X)?lr(B,X):0,se=Y!==0&&U!==Y,ae=hy(b,X)>-1&&se;if(t&&(F||!Q)){const re=!q,G=q&&se,K=G&&u&&Jm(B,u),le=(K?!I(B,X,U,Y):re||G)&&!M(T,!!K,e,r);zt(N,J=>R.add(J)),zt($,J=>R.add(J)),O=O||le}!t&&Q&&se&&!I(B,X,U,Y)&&(D.add(X),A=A||ae)}),R.size>0&&x(T=>Yi(R).reduce((X,B)=>(Xt(X,IM(T,B)),Jm(B,T)?Xt(X,B):X),[])),t)return!E&&O&&n(!1),[!1];if(D.size>0||A){const T=[Yi(D),A];return!E&&n.apply(0,T),T}},j=new Hee(_=>S(_));return j.observe(e,{attributes:!0,attributeOldValue:!0,attributeFilter:w,subtree:t,childList:t,characterData:t}),o=!0,[()=>{o&&(g(),j.disconnect(),o=!1)},()=>{if(o){h.m();const _=j.takeRecords();return!gy(_)&&S(_,!0)}}]},_p=3333333,Ip=e=>e&&(e.height||e.width),QM=(e,t,n)=>{const{Bt:r=!1,Vt:o=!1}=n||{},s=Zi()[hte],{B:i}=Vr(),u=PM(`
`)[0],p=u.firstChild,m=id.bind(0,e),[h]=Fo({o:void 0,_:!0,u:(b,w)=>!(!b||!Ip(b)&&Ip(w))}),g=b=>{const w=ts(b)&&b.length>0&&ad(b[0]),S=!w&&my(b[0]);let j=!1,_=!1,E=!0;if(w){const[I,,M]=h(b.pop().contentRect),R=Ip(I),D=Ip(M);j=!M||!R,_=!D&&R,E=!j}else S?[,E]=b:_=b===!0;if(r&&E){const I=S?b[0]:id(u);Ko(u,I?i.n?-_p:i.i?0:_p:_p),na(u,_p)}j||t({gt:!S,Yt:S?b:void 0,Vt:!!_})},x=[];let y=o?g:!1;return[()=>{As(x),js(u)},()=>{if(ec){const b=new ec(g);b.observe(p),Xt(x,()=>{b.disconnect()})}else if(s){const[b,w]=s.O(p,g,o);y=b,Xt(x,w)}if(r){const[b]=Fo({o:void 0},m);Xt(x,Wn(u,"scroll",w=>{const S=b(),[j,_,E]=S;_&&(yy(p,"ltr rtl"),j?ra(p,"rtl"):ra(p,"ltr"),g([!!j,_,E])),TM(w)}))}y&&(ra(u,tte),Xt(x,Wn(u,"animationstart",y,{C:!!ec}))),(ec||s)&&xo(e,u)}]},Ate=e=>e.h===0||e.isIntersecting||e.intersectionRatio>0,Tte=(e,t)=>{let n;const r=$i(rte),o=[],[s]=Fo({o:!1}),i=(u,p)=>{if(u){const m=s(Ate(u)),[,h]=m;if(h)return!p&&t(m),[m]}},l=(u,p)=>{if(u&&u.length>0)return i(u.pop(),p)};return[()=>{As(o),js(r)},()=>{if(ej)n=new ej(u=>l(u),{root:e}),n.observe(r),Xt(o,()=>{n.disconnect()});else{const u=()=>{const h=ld(r);i(h)},[p,m]=QM(r,u);Xt(o,p),m(),u()}xo(e,r)},()=>{if(n)return l(n.takeRecords(),!0)}]},bj=`[${Bo}]`,Nte=`[${Fa}]`,Fv=["tabindex"],yj=["wrap","cols","rows"],Bv=["id","class","style","open"],$te=(e,t,n)=>{let r,o,s;const{Z:i,J:l,tt:u,rt:p,ut:m,ft:h,_t:g}=e,{V:x}=Vr(),[y]=Fo({u:RM,o:{w:0,h:0}},()=>{const V=h(hc,mc),U=h($v,""),N=U&&Ko(l),$=U&&na(l);g(hc,mc),g($v,""),g("",rh,!0);const q=th(u),F=th(l),Q=nh(l);return g(hc,mc,V),g($v,"",U),g("",rh),Ko(l,N),na(l,$),{w:F.w+q.w+Q.w,h:F.h+q.h+Q.h}}),b=p?yj:Bv.concat(yj),w=Cy(n,{v:()=>r,g:()=>o,p(V,U){const[N]=V,[$]=U;return[ro(N).concat(ro($)).reduce((q,F)=>(q[F]=N[F]||$[F],q),{})]}}),S=V=>{zt(V||Fv,U=>{if(hy(Fv,U)>-1){const N=lr(i,U);li(N)?lr(l,U,N):Mr(l,U)}})},j=(V,U)=>{const[N,$]=V,q={vt:$};return t({ht:N}),!U&&n(q),q},_=({gt:V,Yt:U,Vt:N})=>{const $=!V||N?n:w;let q=!1;if(U){const[F,Q]=U;q=Q,t({bt:F})}$({gt:V,yt:q})},E=(V,U)=>{const[,N]=y(),$={wt:N};return N&&!U&&(V?n:w)($),$},I=(V,U,N)=>{const $={Ot:U};return U?!N&&w($):m||S(V),$},[M,R,D]=u||!x?Tte(i,j):[go,go,go],[A,O]=m?[go,go]:QM(i,_,{Vt:!0,Bt:!0}),[T,X]=xj(i,!1,I,{Pt:Bv,Ht:Bv.concat(Fv)}),B=m&&ec&&new ec(_.bind(0,{gt:!0}));return B&&B.observe(i),S(),[()=>{M(),A(),s&&s[0](),B&&B.disconnect(),T()},()=>{O(),R()},()=>{const V={},U=X(),N=D(),$=s&&s[1]();return U&&Cn(V,I.apply(0,Xt(U,!0))),N&&Cn(V,j.apply(0,Xt(N,!0))),$&&Cn(V,E.apply(0,Xt($,!0))),V},V=>{const[U]=V("update.ignoreMutation"),[N,$]=V("update.attributes"),[q,F]=V("update.elementEvents"),[Q,Y]=V("update.debounce"),se=F||$,ae=re=>es(U)&&U(re);if(se&&(s&&(s[1](),s[0]()),s=xj(u||l,!0,E,{Ht:b.concat(N||[]),Dt:q,Mt:bj,kt:(re,G)=>{const{target:K,attributeName:ee}=re;return(!G&&ee&&!m?Nee(K,bj,Nte):!1)||!!Jl(K,`.${Hr}`)||!!ae(re)}})),Y)if(w.m(),ts(Q)){const re=Q[0],G=Q[1];r=Xa(re)&&re,o=Xa(G)&&G}else Xa(Q)?(r=Q,o=!1):(r=!1,o=!1)}]},Cj={x:0,y:0},Lte=e=>({K:{t:0,r:0,b:0,l:0},St:!1,P:{marginRight:0,marginBottom:0,marginLeft:0,paddingTop:0,paddingRight:0,paddingBottom:0,paddingLeft:0},zt:Cj,Tt:Cj,Ct:{x:"hidden",y:"hidden"},Et:{x:!1,y:!1},ht:!1,bt:id(e.Z)}),zte=(e,t)=>{const n=px(t,{}),[r,o,s]=Sy(),[i,l,u]=jte(e),p=qM(Lte(i)),[m,h]=p,g=Rte(i,p),x=(_,E,I)=>{const R=ro(_).some(D=>_[D])||!vy(E)||I;return R&&s("u",[_,E,I]),R},[y,b,w,S]=$te(i,h,_=>x(g(n,_),{},!1)),j=m.bind(0);return j.jt=_=>r("u",_),j.Nt=()=>{const{W:_,J:E}=i,I=Ko(_),M=na(_);b(),l(),Ko(E,I),na(E,M)},j.qt=i,[(_,E)=>{const I=px(t,_,E);return S(I),x(g(I,w(),E),_,!!E)},j,()=>{o(),y(),u()}]},{round:wj}=Math,Fte=e=>{const{width:t,height:n}=xs(e),{w:r,h:o}=ld(e);return{x:wj(t)/r||1,y:wj(n)/o||1}},Bte=(e,t,n)=>{const r=t.scrollbars,{button:o,isPrimary:s,pointerType:i}=e,{pointers:l}=r;return o===0&&s&&r[n?"dragScroll":"clickScroll"]&&(l||[]).includes(i)},Hte=(e,t)=>Wn(e,"mousedown",Wn.bind(0,t,"click",TM,{C:!0,$:!0}),{$:!0}),Sj="pointerup pointerleave pointercancel lostpointercapture",Vte=(e,t,n,r,o,s,i)=>{const{B:l}=Vr(),{Ft:u,Gt:p,Xt:m}=r,h=`scroll${i?"Left":"Top"}`,g=`client${i?"X":"Y"}`,x=i?"width":"height",y=i?"left":"top",b=i?"w":"h",w=i?"x":"y",S=(j,_)=>E=>{const{Tt:I}=s(),M=ld(p)[b]-ld(u)[b],D=_*E/M*I[w],O=id(m)&&i?l.n||l.i?1:-1:1;o[h]=j+D*O};return Wn(p,"pointerdown",j=>{const _=Jl(j.target,`.${jy}`)===u,E=_?u:p;if(Ni(t,Bo,ij,!0),Bte(j,e,_)){const I=!_&&j.shiftKey,M=()=>xs(u),R=()=>xs(p),D=(F,Q)=>(F||M())[y]-(Q||R())[y],A=S(o[h]||0,1/Fte(o)[w]),O=j[g],T=M(),X=R(),B=T[x],V=D(T,X)+B/2,U=O-X[y],N=_?0:U-V,$=F=>{As(q),E.releasePointerCapture(F.pointerId)},q=[Ni.bind(0,t,Bo,ij),Wn(n,Sj,$),Wn(n,"selectstart",F=>NM(F),{S:!1}),Wn(p,Sj,$),Wn(p,"pointermove",F=>{const Q=F[g]-O;(_||I)&&A(N+Q)})];if(I)A(N);else if(!_){const F=Zi()[gte];F&&Xt(q,F.O(A,D,N,B,U))}E.setPointerCapture(j.pointerId)}})},Wte=(e,t)=>(n,r,o,s,i,l)=>{const{Xt:u}=n,[p,m]=Kl(333),h=!!i.scrollBy;let g=!0;return As.bind(0,[Wn(u,"pointerenter",()=>{r(uj,!0)}),Wn(u,"pointerleave pointercancel",()=>{r(uj)}),Wn(u,"wheel",x=>{const{deltaX:y,deltaY:b,deltaMode:w}=x;h&&g&&w===0&&la(u)===s&&i.scrollBy({left:y,top:b,behavior:"smooth"}),g=!1,r(pj,!0),p(()=>{g=!0,r(pj)}),NM(x)},{S:!1,$:!0}),Hte(u,o),Vte(e,s,o,n,i,t,l),m])},{min:hx,max:kj,abs:Ute,round:Gte}=Math,YM=(e,t,n,r)=>{if(r){const l=n?"x":"y",{Tt:u,zt:p}=r,m=p[l],h=u[l];return kj(0,hx(1,m/(m+h)))}const o=n?"width":"height",s=xs(e)[o],i=xs(t)[o];return kj(0,hx(1,s/i))},Kte=(e,t,n,r,o,s)=>{const{B:i}=Vr(),l=s?"x":"y",u=s?"Left":"Top",{Tt:p}=r,m=Gte(p[l]),h=Ute(n[`scroll${u}`]),g=s&&o,x=i.i?h:m-h,b=hx(1,(g?x:h)/m),w=YM(e,t,s);return 1/w*(1-w)*b},qte=(e,t,n)=>{const{N:r,L:o}=Vr(),{scrollbars:s}=r(),{slot:i}=s,{ct:l,W:u,Z:p,J:m,lt:h,ot:g,it:x,ut:y}=t,{scrollbars:b}=h?{}:e,{slot:w}=b||{},S=GM([u,p,m],()=>y&&x?u:p,i,w),j=(N,$,q)=>{const F=q?ra:yy;zt(N,Q=>{F(Q.Xt,$)})},_=(N,$)=>{zt(N,q=>{const[F,Q]=$(q);ur(F,Q)})},E=(N,$,q)=>{_(N,F=>{const{Ft:Q,Gt:Y}=F;return[Q,{[q?"width":"height"]:`${(100*YM(Q,Y,q,$)).toFixed(3)}%`}]})},I=(N,$,q)=>{const F=q?"X":"Y";_(N,Q=>{const{Ft:Y,Gt:se,Xt:ae}=Q,re=Kte(Y,se,g,$,id(ae),q);return[Y,{transform:re===re?`translate${F}(${(100*re).toFixed(3)}%)`:""}]})},M=[],R=[],D=[],A=(N,$,q)=>{const F=my(q),Q=F?q:!0,Y=F?!q:!0;Q&&j(R,N,$),Y&&j(D,N,$)},O=N=>{E(R,N,!0),E(D,N)},T=N=>{I(R,N,!0),I(D,N)},X=N=>{const $=N?ite:lte,q=N?R:D,F=gy(q)?cj:"",Q=$i(`${Hr} ${$} ${F}`),Y=$i(WM),se=$i(jy),ae={Xt:Q,Gt:Y,Ft:se};return o||ra(Q,ote),xo(Q,Y),xo(Y,se),Xt(q,ae),Xt(M,[js.bind(0,Q),n(ae,A,l,p,g,N)]),ae},B=X.bind(0,!0),V=X.bind(0,!1),U=()=>{xo(S,R[0].Xt),xo(S,D[0].Xt),eh(()=>{A(cj)},300)};return B(),V(),[{Ut:O,Wt:T,Zt:A,Jt:{Kt:R,Qt:B,tn:_.bind(0,R)},nn:{Kt:D,Qt:V,tn:_.bind(0,D)}},U,As.bind(0,M)]},Xte=(e,t,n,r)=>{let o,s,i,l,u,p=0;const m=qM({}),[h]=m,[g,x]=Kl(),[y,b]=Kl(),[w,S]=Kl(100),[j,_]=Kl(100),[E,I]=Kl(()=>p),[M,R,D]=qte(e,n.qt,Wte(t,n)),{Z:A,J:O,ot:T,st:X,ut:B,it:V}=n.qt,{Jt:U,nn:N,Zt:$,Ut:q,Wt:F}=M,{tn:Q}=U,{tn:Y}=N,se=ee=>{const{Xt:le}=ee,J=B&&!V&&la(le)===O&≤return[J,{transform:J?`translate(${Ko(T)}px, ${na(T)}px)`:""}]},ae=(ee,le)=>{if(I(),ee)$(fj);else{const J=()=>$(fj,!0);p>0&&!le?E(J):J()}},re=()=>{l=s,l&&ae(!0)},G=[S,I,_,b,x,D,Wn(A,"pointerover",re,{C:!0}),Wn(A,"pointerenter",re),Wn(A,"pointerleave",()=>{l=!1,s&&ae(!1)}),Wn(A,"pointermove",()=>{o&&g(()=>{S(),ae(!0),j(()=>{o&&ae(!1)})})}),Wn(X,"scroll",ee=>{y(()=>{F(n()),i&&ae(!0),w(()=>{i&&!l&&ae(!1)})}),r(ee),B&&Q(se),B&&Y(se)})],K=h.bind(0);return K.qt=M,K.Nt=R,[(ee,le,J)=>{const{At:ie,Lt:de,It:ge,yt:Ce}=J,{A:he}=Vr(),fe=px(t,ee,le),Oe=n(),{Tt:_e,Ct:Ne,bt:nt}=Oe,[$e,Pt]=fe("showNativeOverlaidScrollbars"),[Ze,ot]=fe("scrollbars.theme"),[ye,De]=fe("scrollbars.visibility"),[ut,bt]=fe("scrollbars.autoHide"),[be]=fe("scrollbars.autoHideDelay"),[Je,lt]=fe("scrollbars.dragScroll"),[ft,Me]=fe("scrollbars.clickScroll"),Le=ie||de||Ce,Ut=ge||De,Se=$e&&he.x&&he.y,Be=(ze,Ge)=>{const pt=ye==="visible"||ye==="auto"&&ze==="scroll";return $(cte,pt,Ge),pt};if(p=be,Pt&&$(ste,Se),ot&&($(u),$(Ze,!0),u=Ze),bt&&(o=ut==="move",s=ut==="leave",i=ut!=="never",ae(!i,!0)),lt&&$(fte,Je),Me&&$(dte,ft),Ut){const ze=Be(Ne.x,!0),Ge=Be(Ne.y,!1);$(ute,!(ze&&Ge))}Le&&(q(Oe),F(Oe),$(dj,!_e.x,!0),$(dj,!_e.y,!1),$(ate,nt&&!V))},K,As.bind(0,G)]},ZM=(e,t,n)=>{es(e)&&e(t||void 0,n||void 0)},Ua=(e,t,n)=>{const{F:r,N:o,Y:s,j:i}=Vr(),l=Zi(),u=Zm(e),p=u?e:e.target,m=KM(p);if(t&&!m){let h=!1;const g=B=>{const V=Zi()[mte],U=V&&V.O;return U?U(B,!0):B},x=Cn({},r(),g(t)),[y,b,w]=Sy(n),[S,j,_]=zte(e,x),[E,I,M]=Xte(e,x,j,B=>w("scroll",[X,B])),R=(B,V)=>S(B,!!V),D=R.bind(0,{},!0),A=s(D),O=i(D),T=B=>{kte(p),A(),O(),M(),_(),h=!0,w("destroyed",[X,!!B]),b()},X={options(B,V){if(B){const U=V?r():{},N=$M(x,Cn(U,g(B)));vy(N)||(Cn(x,N),R(N))}return Cn({},x)},on:y,off:(B,V)=>{B&&V&&b(B,V)},state(){const{zt:B,Tt:V,Ct:U,Et:N,K:$,St:q,bt:F}=j();return Cn({},{overflowEdge:B,overflowAmount:V,overflowStyle:U,hasOverflow:N,padding:$,paddingAbsolute:q,directionRTL:F,destroyed:h})},elements(){const{W:B,Z:V,K:U,J:N,tt:$,ot:q,st:F}=j.qt,{Jt:Q,nn:Y}=I.qt,se=re=>{const{Ft:G,Gt:K,Xt:ee}=re;return{scrollbar:ee,track:K,handle:G}},ae=re=>{const{Kt:G,Qt:K}=re,ee=se(G[0]);return Cn({},ee,{clone:()=>{const le=se(K());return E({},!0,{}),le}})};return Cn({},{target:B,host:V,padding:U||N,viewport:N,content:$||N,scrollOffsetElement:q,scrollEventElement:F,scrollbarHorizontal:ae(Q),scrollbarVertical:ae(Y)})},update:B=>R({},B),destroy:T.bind(0)};return j.jt((B,V,U)=>{E(V,U,B)}),Ste(p,X),zt(ro(l),B=>ZM(l[B],0,X)),wte(j.qt.it,o().cancel,!u&&e.cancel)?(T(!0),X):(j.Nt(),I.Nt(),w("initialized",[X]),j.jt((B,V,U)=>{const{gt:N,yt:$,vt:q,At:F,Lt:Q,It:Y,wt:se,Ot:ae}=B;w("updated",[X,{updateHints:{sizeChanged:N,directionChanged:$,heightIntrinsicChanged:q,overflowEdgeChanged:F,overflowAmountChanged:Q,overflowStyleChanged:Y,contentMutation:se,hostMutation:ae},changedOptions:V,force:U}])}),X.update(!0),X)}return m};Ua.plugin=e=>{zt(pte(e),t=>ZM(t,Ua))};Ua.valid=e=>{const t=e&&e.elements,n=es(t)&&t();return lx(n)&&!!KM(n.target)};Ua.env=()=>{const{k:e,A:t,I:n,B:r,V:o,L:s,X:i,U:l,N:u,q:p,F:m,G:h}=Vr();return Cn({},{scrollbarsSize:e,scrollbarsOverlaid:t,scrollbarsHiding:n,rtlScrollBehavior:r,flexboxGlue:o,cssCustomProperties:s,staticDefaultInitialization:i,staticDefaultOptions:l,getDefaultInitialization:u,setDefaultInitialization:p,getDefaultOptions:m,setDefaultOptions:h})};const Qte=()=>{if(typeof window>"u"){const p=()=>{};return[p,p]}let e,t;const n=window,r=typeof n.requestIdleCallback=="function",o=n.requestAnimationFrame,s=n.cancelAnimationFrame,i=r?n.requestIdleCallback:o,l=r?n.cancelIdleCallback:s,u=()=>{l(e),s(t)};return[(p,m)=>{u(),e=i(r?()=>{u(),t=o(p)}:p,typeof m=="object"?m:{timeout:2233})},u]},Ey=e=>{const{options:t,events:n,defer:r}=e||{},[o,s]=d.useMemo(Qte,[]),i=d.useRef(null),l=d.useRef(r),u=d.useRef(t),p=d.useRef(n);return d.useEffect(()=>{l.current=r},[r]),d.useEffect(()=>{const{current:m}=i;u.current=t,Ua.valid(m)&&m.options(t||{},!0)},[t]),d.useEffect(()=>{const{current:m}=i;p.current=n,Ua.valid(m)&&m.on(n||{},!0)},[n]),d.useEffect(()=>()=>{var m;s(),(m=i.current)==null||m.destroy()},[]),d.useMemo(()=>[m=>{const h=i.current;if(Ua.valid(h))return;const g=l.current,x=u.current||{},y=p.current||{},b=()=>i.current=Ua(m,x,y);g?o(b,g):b()},()=>i.current],[])},Yte=(e,t)=>{const{element:n="div",options:r,events:o,defer:s,children:i,...l}=e,u=n,p=d.useRef(null),m=d.useRef(null),[h,g]=Ey({options:r,events:o,defer:s});return d.useEffect(()=>{const{current:x}=p,{current:y}=m;return x&&y&&h({target:x,elements:{viewport:y,content:y}}),()=>{var b;return(b=g())==null?void 0:b.destroy()}},[h,n]),d.useImperativeHandle(t,()=>({osInstance:g,getElement:()=>p.current}),[]),H.createElement(u,{"data-overlayscrollbars-initialize":"",ref:p,...l},H.createElement("div",{ref:m},i))},hg=d.forwardRef(Yte),Zte=e=>{const{boardToDelete:t,setBoardToDelete:n}=e,{t:r}=Z(),o=W(j=>j.config.canRestoreDeletedImagesFromBin),{currentData:s,isFetching:i}=yD((t==null?void 0:t.board_id)??$r.skipToken),l=d.useMemo(()=>ce([xe],j=>{const _=(s??[]).map(I=>rI(j,I));return{imageUsageSummary:{isInitialImage:Xr(_,I=>I.isInitialImage),isCanvasImage:Xr(_,I=>I.isCanvasImage),isNodesImage:Xr(_,I=>I.isNodesImage),isControlNetImage:Xr(_,I=>I.isControlNetImage),isIPAdapterImage:Xr(_,I=>I.isIPAdapterImage)}}}),[s]),[u,{isLoading:p}]=CD(),[m,{isLoading:h}]=wD(),{imageUsageSummary:g}=W(l),x=d.useCallback(()=>{t&&(u(t.board_id),n(void 0))},[t,u,n]),y=d.useCallback(()=>{t&&(m(t.board_id),n(void 0))},[t,m,n]),b=d.useCallback(()=>{n(void 0)},[n]),w=d.useRef(null),S=d.useMemo(()=>h||p||i,[h,p,i]);return t?a.jsx(Td,{isOpen:!!t,onClose:b,leastDestructiveRef:w,isCentered:!0,children:a.jsx(Yo,{children:a.jsxs(Nd,{children:[a.jsxs(Qo,{fontSize:"lg",fontWeight:"bold",children:["Delete ",t.board_name]}),a.jsx(Zo,{children:a.jsxs(L,{direction:"column",gap:3,children:[i?a.jsx(Gh,{children:a.jsx(L,{sx:{w:"full",h:32}})}):a.jsx(nM,{imageUsage:g,topMessage:r("boards.topMessage"),bottomMessage:r("boards.bottomMessage")}),a.jsx(ve,{children:"Deleted boards cannot be restored."}),a.jsx(ve,{children:r(o?"gallery.deleteImageBin":"gallery.deleteImagePermanent")})]})}),a.jsx(Ss,{children:a.jsxs(L,{sx:{justifyContent:"space-between",width:"full",gap:2},children:[a.jsx(at,{ref:w,onClick:b,children:"Cancel"}),a.jsx(at,{colorScheme:"warning",isLoading:S,onClick:x,children:"Delete Board Only"}),a.jsx(at,{colorScheme:"error",isLoading:S,onClick:y,children:"Delete Board and Images"})]})})]})})}):null},Jte=d.memo(Zte),ene=()=>{const{t:e}=Z(),[t,{isLoading:n}]=SD(),r=e("boards.myBoard"),o=d.useCallback(()=>{t(r)},[t,r]);return a.jsx(Fe,{icon:a.jsx(Vc,{}),isLoading:n,tooltip:e("boards.addBoard"),"aria-label":e("boards.addBoard"),onClick:o,size:"sm","data-testid":"add-board-button"})},tne=d.memo(ene);var JM=wh({displayName:"ExternalLinkIcon",path:a.jsxs("g",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeWidth:"2",children:[a.jsx("path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"}),a.jsx("path",{d:"M15 3h6v6"}),a.jsx("path",{d:"M10 14L21 3"})]})}),gg=wh({d:"M12 8l-6 6 1.41 1.41L12 10.83l4.59 4.58L18 14z",displayName:"ChevronUpIcon"}),nne=wh({displayName:"CloseIcon",d:"M.439,21.44a1.5,1.5,0,0,0,2.122,2.121L11.823,14.3a.25.25,0,0,1,.354,0l9.262,9.263a1.5,1.5,0,1,0,2.122-2.121L14.3,12.177a.25.25,0,0,1,0-.354l9.263-9.262A1.5,1.5,0,0,0,21.439.44L12.177,9.7a.25.25,0,0,1-.354,0L2.561.44A1.5,1.5,0,0,0,.439,2.561L9.7,11.823a.25.25,0,0,1,0,.354Z"}),rne=wh({displayName:"DeleteIcon",path:a.jsx("g",{fill:"currentColor",children:a.jsx("path",{d:"M19.452 7.5H4.547a.5.5 0 00-.5.545l1.287 14.136A2 2 0 007.326 24h9.347a2 2 0 001.992-1.819L19.95 8.045a.5.5 0 00-.129-.382.5.5 0 00-.369-.163zm-9.2 13a.75.75 0 01-1.5 0v-9a.75.75 0 011.5 0zm5 0a.75.75 0 01-1.5 0v-9a.75.75 0 011.5 0zM22 4h-4.75a.25.25 0 01-.25-.25V2.5A2.5 2.5 0 0014.5 0h-5A2.5 2.5 0 007 2.5v1.25a.25.25 0 01-.25.25H2a1 1 0 000 2h20a1 1 0 000-2zM9 3.75V2.5a.5.5 0 01.5-.5h5a.5.5 0 01.5.5v1.25a.25.25 0 01-.25.25h-5.5A.25.25 0 019 3.75z"})})});const one=ce([xe],({gallery:e})=>{const{boardSearchText:t}=e;return{boardSearchText:t}},je),sne=()=>{const e=te(),{boardSearchText:t}=W(one),n=d.useRef(null),{t:r}=Z(),o=d.useCallback(u=>{e(rw(u))},[e]),s=d.useCallback(()=>{e(rw(""))},[e]),i=d.useCallback(u=>{u.key==="Escape"&&s()},[s]),l=d.useCallback(u=>{o(u.target.value)},[o]);return d.useEffect(()=>{n.current&&n.current.focus()},[]),a.jsxs(l3,{children:[a.jsx(Mh,{ref:n,placeholder:r("boards.searchBoard"),value:t,onKeyDown:i,onChange:l,"data-testid":"board-search-input"}),t&&t.length&&a.jsx(Ib,{children:a.jsx(ys,{onClick:s,size:"xs",variant:"ghost","aria-label":r("boards.clearSearch"),opacity:.5,icon:a.jsx(nne,{boxSize:2})})})]})},ane=d.memo(sne);function e8(e){return kD(e)}function ine(e){return jD(e)}const t8=(e,t)=>{if(!e||!(t!=null&&t.data.current))return!1;const{actionType:n}=e,{payloadType:r}=t.data.current;if(e.id===t.data.current.id)return!1;switch(n){case"ADD_FIELD_TO_LINEAR":return r==="NODE_FIELD";case"SET_CURRENT_IMAGE":return r==="IMAGE_DTO";case"SET_INITIAL_IMAGE":return r==="IMAGE_DTO";case"SET_CONTROLNET_IMAGE":return r==="IMAGE_DTO";case"SET_IP_ADAPTER_IMAGE":return r==="IMAGE_DTO";case"SET_CANVAS_INITIAL_IMAGE":return r==="IMAGE_DTO";case"SET_NODES_IMAGE":return r==="IMAGE_DTO";case"SET_MULTI_NODES_IMAGE":return r==="IMAGE_DTO"||"IMAGE_DTOS";case"ADD_TO_BATCH":return r==="IMAGE_DTO"||"IMAGE_DTOS";case"ADD_TO_BOARD":{if(!(r==="IMAGE_DTO"||"IMAGE_DTOS"))return!1;if(r==="IMAGE_DTO"){const{imageDTO:s}=t.data.current.payload,i=s.board_id??"none",l=e.context.boardId;return i!==l}return r==="IMAGE_DTOS"}case"REMOVE_FROM_BOARD":{if(!(r==="IMAGE_DTO"||"IMAGE_DTOS"))return!1;if(r==="IMAGE_DTO"){const{imageDTO:s}=t.data.current.payload;return s.board_id!=="none"}return r==="IMAGE_DTOS"}default:return!1}},lne=e=>{const{isOver:t,label:n="Drop"}=e,r=d.useRef(Zs()),{colorMode:o}=ha();return a.jsx(In.div,{initial:{opacity:0},animate:{opacity:1,transition:{duration:.1}},exit:{opacity:0,transition:{duration:.1}},children:a.jsxs(L,{sx:{position:"absolute",top:0,insetInlineStart:0,w:"full",h:"full"},children:[a.jsx(L,{sx:{position:"absolute",top:0,insetInlineStart:0,w:"full",h:"full",bg:Ae("base.700","base.900")(o),opacity:.7,borderRadius:"base",alignItems:"center",justifyContent:"center",transitionProperty:"common",transitionDuration:"0.1s"}}),a.jsx(L,{sx:{position:"absolute",top:.5,insetInlineStart:.5,insetInlineEnd:.5,bottom:.5,opacity:1,borderWidth:2,borderColor:t?Ae("base.50","base.50")(o):Ae("base.200","base.300")(o),borderRadius:"lg",borderStyle:"dashed",transitionProperty:"common",transitionDuration:"0.1s",alignItems:"center",justifyContent:"center"},children:a.jsx(Ie,{sx:{fontSize:"2xl",fontWeight:600,transform:t?"scale(1.1)":"scale(1)",color:t?Ae("base.50","base.50")(o):Ae("base.200","base.300")(o),transitionProperty:"common",transitionDuration:"0.1s"},children:n})})]})},r.current)},n8=d.memo(lne),cne=e=>{const{dropLabel:t,data:n,disabled:r}=e,o=d.useRef(Zs()),{isOver:s,setNodeRef:i,active:l}=e8({id:o.current,disabled:r,data:n});return a.jsx(Ie,{ref:i,position:"absolute",top:0,insetInlineStart:0,w:"full",h:"full",pointerEvents:l?"auto":"none",children:a.jsx(dr,{children:t8(n,l)&&a.jsx(n8,{isOver:s,label:t})})})},My=d.memo(cne),une=({isSelected:e,isHovered:t})=>a.jsx(Ie,{className:"selection-box",sx:{position:"absolute",top:0,insetInlineEnd:0,bottom:0,insetInlineStart:0,borderRadius:"base",opacity:e?1:.7,transitionProperty:"common",transitionDuration:"0.1s",pointerEvents:"none",shadow:e?t?"hoverSelected.light":"selected.light":t?"hoverUnselected.light":void 0,_dark:{shadow:e?t?"hoverSelected.dark":"selected.dark":t?"hoverUnselected.dark":void 0}}}),Oy=d.memo(une),dne=()=>a.jsx(L,{sx:{position:"absolute",insetInlineEnd:0,top:0,p:1},children:a.jsx(Ds,{variant:"solid",sx:{bg:"accent.400",_dark:{bg:"accent.500"}},children:"auto"})}),r8=d.memo(dne);function Ry(e){const[t,n]=d.useState(!1),[r,o]=d.useState(!1),[s,i]=d.useState(!1),[l,u]=d.useState([0,0]),p=d.useRef(null),m=W(g=>g.ui.globalContextMenuCloseTrigger);d.useEffect(()=>{if(t)setTimeout(()=>{o(!0),setTimeout(()=>{i(!0)})});else{i(!1);const g=setTimeout(()=>{o(t)},1e3);return()=>clearTimeout(g)}},[t]),d.useEffect(()=>{n(!1),i(!1),o(!1)},[m]),dF("contextmenu",g=>{var x;(x=p.current)!=null&&x.contains(g.target)||g.target===p.current?(g.preventDefault(),n(!0),u([g.pageX,g.pageY])):n(!1)});const h=d.useCallback(()=>{var g,x;(x=(g=e.menuProps)==null?void 0:g.onClose)==null||x.call(g),n(!1)},[e.menuProps]);return a.jsxs(a.Fragment,{children:[e.children(p),r&&a.jsx(Ac,{...e.portalProps,children:a.jsxs(Ah,{isOpen:s,gutter:0,...e.menuProps,onClose:h,children:[a.jsx(Th,{"aria-hidden":!0,w:1,h:1,style:{position:"absolute",left:l[0],top:l[1],cursor:"default"},...e.menuButtonProps}),e.renderMenu()]})})]})}const vg=e=>{const{boardName:t}=yd(void 0,{selectFromResult:({data:n})=>{const r=n==null?void 0:n.find(s=>s.board_id===e);return{boardName:(r==null?void 0:r.board_name)||"Uncategorized"}}});return t},fne=({board:e,setBoardToDelete:t})=>{const n=d.useCallback(()=>{t&&t(e)},[e,t]);return a.jsxs(a.Fragment,{children:[e.image_count>0&&a.jsx(a.Fragment,{}),a.jsx(en,{sx:{color:"error.600",_dark:{color:"error.300"}},icon:a.jsx(Br,{}),onClick:n,children:"Delete Board"})]})},pne=d.memo(fne),mne=()=>a.jsx(a.Fragment,{}),hne=d.memo(mne),gne=({board:e,board_id:t,setBoardToDelete:n,children:r})=>{const o=te(),s=d.useMemo(()=>ce(xe,({gallery:g})=>{const x=g.autoAddBoardId===t,y=g.autoAssignBoardOnClick;return{isAutoAdd:x,autoAssignBoardOnClick:y}},je),[t]),{isAutoAdd:i,autoAssignBoardOnClick:l}=W(s),u=vg(t),p=d.useCallback(()=>{o(hh(t))},[t,o]),m=d.useCallback(g=>{g.preventDefault()},[]),{t:h}=Z();return a.jsx(Ry,{menuProps:{size:"sm",isLazy:!0},menuButtonProps:{bg:"transparent",_hover:{bg:"transparent"}},renderMenu:()=>a.jsx(Ui,{sx:{visibility:"visible !important"},motionProps:vc,onContextMenu:m,children:a.jsxs(td,{title:u,children:[a.jsx(en,{icon:a.jsx(Vc,{}),isDisabled:i||l,onClick:p,children:h("boards.menuItemAutoAdd")}),!e&&a.jsx(hne,{}),e&&a.jsx(pne,{board:e,setBoardToDelete:n})]})}),children:r})},o8=d.memo(gne),vne=({board:e,isSelected:t,setBoardToDelete:n})=>{const r=te(),o=d.useMemo(()=>ce(xe,({gallery:A})=>{const O=e.board_id===A.autoAddBoardId,T=A.autoAssignBoardOnClick;return{isSelectedForAutoAdd:O,autoAssignBoardOnClick:T}},je),[e.board_id]),{isSelectedForAutoAdd:s,autoAssignBoardOnClick:i}=W(o),[l,u]=d.useState(!1),p=d.useCallback(()=>{u(!0)},[]),m=d.useCallback(()=>{u(!1)},[]),{data:h}=cI(e.board_id),{data:g}=uI(e.board_id),x=d.useMemo(()=>{if(!(!h||!g))return`${h} image${h>1?"s":""}, ${g} asset${g>1?"s":""}`},[g,h]),{currentData:y}=to(e.cover_image_name??$r.skipToken),{board_name:b,board_id:w}=e,[S,j]=d.useState(b),_=d.useCallback(()=>{r(dI({boardId:w})),i&&r(hh(w))},[w,i,r]),[E,{isLoading:I}]=_D(),M=d.useMemo(()=>({id:w,actionType:"ADD_TO_BOARD",context:{boardId:w}}),[w]),R=d.useCallback(async A=>{if(!A.trim()){j(b);return}if(A!==b)try{const{board_name:O}=await E({board_id:w,changes:{board_name:A}}).unwrap();j(O)}catch{j(b)}},[w,b,E]),D=d.useCallback(A=>{j(A)},[]);return a.jsx(Ie,{sx:{w:"full",h:"full",touchAction:"none",userSelect:"none"},children:a.jsx(L,{onMouseOver:p,onMouseOut:m,sx:{position:"relative",justifyContent:"center",alignItems:"center",aspectRatio:"1/1",w:"full",h:"full"},children:a.jsx(o8,{board:e,board_id:w,setBoardToDelete:n,children:A=>a.jsx(Ht,{label:x,openDelay:1e3,hasArrow:!0,children:a.jsxs(L,{ref:A,onClick:_,sx:{w:"full",h:"full",position:"relative",justifyContent:"center",alignItems:"center",borderRadius:"base",cursor:"pointer",bg:"base.200",_dark:{bg:"base.800"}},children:[y!=null&&y.thumbnail_url?a.jsx(ga,{src:y==null?void 0:y.thumbnail_url,draggable:!1,sx:{objectFit:"cover",w:"full",h:"full",maxH:"full",borderRadius:"base",borderBottomRadius:"lg"}}):a.jsx(L,{sx:{w:"full",h:"full",justifyContent:"center",alignItems:"center"},children:a.jsx(Tn,{boxSize:12,as:see,sx:{mt:-6,opacity:.7,color:"base.500",_dark:{color:"base.500"}}})}),s&&a.jsx(r8,{}),a.jsx(Oy,{isSelected:t,isHovered:l}),a.jsx(L,{sx:{position:"absolute",bottom:0,left:0,p:1,justifyContent:"center",alignItems:"center",w:"full",maxW:"full",borderBottomRadius:"base",bg:t?"accent.400":"base.500",color:t?"base.50":"base.100",_dark:{bg:t?"accent.500":"base.600",color:t?"base.50":"base.100"},lineHeight:"short",fontSize:"xs"},children:a.jsxs(Ih,{value:S,isDisabled:I,submitOnBlur:!0,onChange:D,onSubmit:R,sx:{w:"full"},children:[a.jsx(_h,{sx:{p:0,fontWeight:t?700:500,textAlign:"center",overflow:"hidden",textOverflow:"ellipsis"},noOfLines:1}),a.jsx(jh,{sx:{p:0,_focusVisible:{p:0,textAlign:"center",boxShadow:"none"}}})]})}),a.jsx(My,{data:M,dropLabel:a.jsx(ve,{fontSize:"md",children:"Move"})})]})})})})})},xne=d.memo(vne),bne=ce(xe,({gallery:e})=>{const{autoAddBoardId:t,autoAssignBoardOnClick:n}=e;return{autoAddBoardId:t,autoAssignBoardOnClick:n}},je),s8=d.memo(({isSelected:e})=>{const t=te(),{autoAddBoardId:n,autoAssignBoardOnClick:r}=W(bne),o=vg("none"),s=d.useCallback(()=>{t(dI({boardId:"none"})),r&&t(hh("none"))},[t,r]),[i,l]=d.useState(!1),u=d.useCallback(()=>{l(!0)},[]),p=d.useCallback(()=>{l(!1)},[]),m=d.useMemo(()=>({id:"no_board",actionType:"REMOVE_FROM_BOARD"}),[]);return a.jsx(Ie,{sx:{w:"full",h:"full",touchAction:"none",userSelect:"none"},children:a.jsx(L,{onMouseOver:u,onMouseOut:p,sx:{position:"relative",justifyContent:"center",alignItems:"center",aspectRatio:"1/1",borderRadius:"base",w:"full",h:"full"},children:a.jsx(o8,{board_id:"none",children:h=>a.jsxs(L,{ref:h,onClick:s,sx:{w:"full",h:"full",position:"relative",justifyContent:"center",alignItems:"center",borderRadius:"base",cursor:"pointer",bg:"base.200",_dark:{bg:"base.800"}},children:[a.jsx(L,{sx:{w:"full",h:"full",justifyContent:"center",alignItems:"center"},children:a.jsx(ga,{src:Hx,alt:"invoke-ai-logo",sx:{opacity:.4,filter:"grayscale(1)",mt:-6,w:16,h:16,minW:16,minH:16,userSelect:"none"}})}),n==="none"&&a.jsx(r8,{}),a.jsx(L,{sx:{position:"absolute",bottom:0,left:0,p:1,justifyContent:"center",alignItems:"center",w:"full",maxW:"full",borderBottomRadius:"base",bg:e?"accent.400":"base.500",color:e?"base.50":"base.100",_dark:{bg:e?"accent.500":"base.600",color:e?"base.50":"base.100"},lineHeight:"short",fontSize:"xs",fontWeight:e?700:500},children:o}),a.jsx(Oy,{isSelected:e,isHovered:i}),a.jsx(My,{data:m,dropLabel:a.jsx(ve,{fontSize:"md",children:"Move"})})]})})})})});s8.displayName="HoverableBoard";const yne=d.memo(s8),Cne=ce([xe],({gallery:e})=>{const{selectedBoardId:t,boardSearchText:n}=e;return{selectedBoardId:t,boardSearchText:n}},je),wne=e=>{const{isOpen:t}=e,{selectedBoardId:n,boardSearchText:r}=W(Cne),{data:o}=yd(),s=r?o==null?void 0:o.filter(u=>u.board_name.toLowerCase().includes(r.toLowerCase())):o,[i,l]=d.useState();return a.jsxs(a.Fragment,{children:[a.jsx(Id,{in:t,animateOpacity:!0,children:a.jsxs(L,{layerStyle:"first",sx:{flexDir:"column",gap:2,p:2,mt:2,borderRadius:"base"},children:[a.jsxs(L,{sx:{gap:2,alignItems:"center"},children:[a.jsx(ane,{}),a.jsx(tne,{})]}),a.jsx(hg,{defer:!0,style:{height:"100%",width:"100%"},options:{scrollbars:{visibility:"auto",autoHide:"move",autoHideDelay:1300,theme:"os-theme-dark"}},children:a.jsxs(Ja,{className:"list-container","data-testid":"boards-list",sx:{gridTemplateColumns:"repeat(auto-fill, minmax(108px, 1fr));",maxH:346},children:[a.jsx(Zu,{sx:{p:1.5},"data-testid":"no-board",children:a.jsx(yne,{isSelected:n==="none"})}),s&&s.map((u,p)=>a.jsx(Zu,{sx:{p:1.5},"data-testid":`board-${p}`,children:a.jsx(xne,{board:u,isSelected:n===u.board_id,setBoardToDelete:l})},u.board_id))]})})]})}),a.jsx(Jte,{boardToDelete:i,setBoardToDelete:l})]})},Sne=d.memo(wne),kne=ce([xe],e=>{const{selectedBoardId:t}=e.gallery;return{selectedBoardId:t}},je),jne=e=>{const{isOpen:t,onToggle:n}=e,{selectedBoardId:r}=W(kne),o=vg(r),s=d.useMemo(()=>o.length>20?`${o.substring(0,20)}...`:o,[o]);return a.jsxs(L,{as:Za,onClick:n,size:"sm",sx:{position:"relative",gap:2,w:"full",justifyContent:"space-between",alignItems:"center",px:2},children:[a.jsx(ve,{noOfLines:1,sx:{fontWeight:600,w:"100%",textAlign:"center",color:"base.800",_dark:{color:"base.200"}},children:s}),a.jsx(gg,{sx:{transform:t?"rotate(0deg)":"rotate(180deg)",transitionProperty:"common",transitionDuration:"normal"}})]})},_ne=d.memo(jne),Ine=e=>{const{triggerComponent:t,children:n,hasArrow:r=!0,isLazy:o=!0,...s}=e;return a.jsxs(Ld,{isLazy:o,...s,children:[a.jsx(Wh,{children:t}),a.jsxs(zd,{shadow:"dark-lg",children:[r&&a.jsx(H3,{}),n]})]})},qd=d.memo(Ine);function Pne(e){return Te({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{d:"M12 16c1.671 0 3-1.331 3-3s-1.329-3-3-3-3 1.331-3 3 1.329 3 3 3z"}},{tag:"path",attr:{d:"M20.817 11.186a8.94 8.94 0 0 0-1.355-3.219 9.053 9.053 0 0 0-2.43-2.43 8.95 8.95 0 0 0-3.219-1.355 9.028 9.028 0 0 0-1.838-.18V2L8 5l3.975 3V6.002c.484-.002.968.044 1.435.14a6.961 6.961 0 0 1 2.502 1.053 7.005 7.005 0 0 1 1.892 1.892A6.967 6.967 0 0 1 19 13a7.032 7.032 0 0 1-.55 2.725 7.11 7.11 0 0 1-.644 1.188 7.2 7.2 0 0 1-.858 1.039 7.028 7.028 0 0 1-3.536 1.907 7.13 7.13 0 0 1-2.822 0 6.961 6.961 0 0 1-2.503-1.054 7.002 7.002 0 0 1-1.89-1.89A6.996 6.996 0 0 1 5 13H3a9.02 9.02 0 0 0 1.539 5.034 9.096 9.096 0 0 0 2.428 2.428A8.95 8.95 0 0 0 12 22a9.09 9.09 0 0 0 1.814-.183 9.014 9.014 0 0 0 3.218-1.355 8.886 8.886 0 0 0 1.331-1.099 9.228 9.228 0 0 0 1.1-1.332A8.952 8.952 0 0 0 21 13a9.09 9.09 0 0 0-.183-1.814z"}}]})(e)}const a8=ke((e,t)=>{const[n,r]=d.useState(!1),{label:o,value:s,min:i=1,max:l=100,step:u=1,onChange:p,tooltipSuffix:m="",withSliderMarks:h=!1,withInput:g=!1,isInteger:x=!1,inputWidth:y=16,withReset:b=!1,hideTooltip:w=!1,isCompact:S=!1,isDisabled:j=!1,sliderMarks:_,handleReset:E,sliderFormControlProps:I,sliderFormLabelProps:M,sliderMarkProps:R,sliderTrackProps:D,sliderThumbProps:A,sliderNumberInputProps:O,sliderNumberInputFieldProps:T,sliderNumberInputStepperProps:X,sliderTooltipProps:B,sliderIAIIconButtonProps:V,...U}=e,N=te(),{t:$}=Z(),[q,F]=d.useState(String(s));d.useEffect(()=>{F(s)},[s]);const Q=d.useMemo(()=>O!=null&&O.min?O.min:i,[i,O==null?void 0:O.min]),Y=d.useMemo(()=>O!=null&&O.max?O.max:l,[l,O==null?void 0:O.max]),se=d.useCallback(J=>{p(J)},[p]),ae=d.useCallback(J=>{J.target.value===""&&(J.target.value=String(Q));const ie=Fi(x?Math.floor(Number(J.target.value)):Number(q),Q,Y),de=Mu(ie,u);p(de),F(de)},[x,q,Q,Y,p,u]),re=d.useCallback(J=>{F(J)},[]),G=d.useCallback(()=>{E&&E()},[E]),K=d.useCallback(J=>{J.target instanceof HTMLDivElement&&J.target.focus()},[]),ee=d.useCallback(J=>{J.shiftKey&&N(Nr(!0))},[N]),le=d.useCallback(J=>{J.shiftKey||N(Nr(!1))},[N]);return a.jsxs(Kt,{ref:t,onClick:K,sx:S?{display:"flex",flexDirection:"row",alignItems:"center",columnGap:4,margin:0,padding:0}:{},isDisabled:j,...I,children:[o&&a.jsx(wn,{sx:g?{mb:-1.5}:{},...M,children:o}),a.jsxs(Rh,{w:"100%",gap:2,alignItems:"center",children:[a.jsxs(Wb,{"aria-label":o,value:s,min:i,max:l,step:u,onChange:se,onMouseEnter:()=>r(!0),onMouseLeave:()=>r(!1),focusThumbOnChange:!1,isDisabled:j,...U,children:[h&&!_&&a.jsxs(a.Fragment,{children:[a.jsx(Ul,{value:i,sx:{insetInlineStart:"0 !important",insetInlineEnd:"unset !important"},...R,children:i}),a.jsx(Ul,{value:l,sx:{insetInlineStart:"unset !important",insetInlineEnd:"0 !important"},...R,children:l})]}),h&&_&&a.jsx(a.Fragment,{children:_.map((J,ie)=>ie===0?a.jsx(Ul,{value:J,sx:{insetInlineStart:"0 !important",insetInlineEnd:"unset !important"},...R,children:J},J):ie===_.length-1?a.jsx(Ul,{value:J,sx:{insetInlineStart:"unset !important",insetInlineEnd:"0 !important"},...R,children:J},J):a.jsx(Ul,{value:J,sx:{transform:"translateX(-50%)"},...R,children:J},J))}),a.jsx(Gb,{...D,children:a.jsx(Kb,{})}),a.jsx(Ht,{hasArrow:!0,placement:"top",isOpen:n,label:`${s}${m}`,hidden:w,...B,children:a.jsx(Ub,{...A,zIndex:0})})]}),g&&a.jsxs(Lh,{min:Q,max:Y,step:u,value:q,onChange:re,onBlur:ae,focusInputOnChange:!1,...O,children:[a.jsx(Fh,{onKeyDown:ee,onKeyUp:le,minWidth:y,...T}),a.jsxs(zh,{...X,children:[a.jsx(Hh,{onClick:()=>p(Number(q))}),a.jsx(Bh,{onClick:()=>p(Number(q))})]})]}),b&&a.jsx(Fe,{size:"sm","aria-label":$("accessibility.reset"),tooltip:$("accessibility.reset"),icon:a.jsx(Pne,{}),isDisabled:j,onClick:G,...V})]})]})});a8.displayName="IAISlider";const tt=d.memo(a8),i8=d.forwardRef(({label:e,tooltip:t,description:n,disabled:r,...o},s)=>a.jsx(Ht,{label:t,placement:"top",hasArrow:!0,openDelay:500,children:a.jsx(Ie,{ref:s,...o,children:a.jsxs(Ie,{children:[a.jsx(wc,{children:e}),n&&a.jsx(wc,{size:"xs",color:"base.600",children:n})]})})}));i8.displayName="IAIMantineSelectItemWithTooltip";const ci=d.memo(i8),Ene=ce([xe],({gallery:e})=>{const{autoAddBoardId:t,autoAssignBoardOnClick:n}=e;return{autoAddBoardId:t,autoAssignBoardOnClick:n}},je),Mne=()=>{const e=te(),{t}=Z(),{autoAddBoardId:n,autoAssignBoardOnClick:r}=W(Ene),o=d.useRef(null),{boards:s,hasBoards:i}=yd(void 0,{selectFromResult:({data:u})=>{const p=[{label:"None",value:"none"}];return u==null||u.forEach(({board_id:m,board_name:h})=>{p.push({label:h,value:m})}),{boards:p,hasBoards:p.length>1}}}),l=d.useCallback(u=>{u&&e(hh(u))},[e]);return a.jsx(nn,{label:t("boards.autoAddBoard"),inputRef:o,autoFocus:!0,placeholder:t("boards.selectBoard"),value:n,data:s,nothingFound:t("boards.noMatching"),itemComponent:ci,disabled:!i||r,filter:(u,p)=>{var m;return((m=p.label)==null?void 0:m.toLowerCase().includes(u.toLowerCase().trim()))||p.value.toLowerCase().includes(u.toLowerCase().trim())},onChange:l})},One=d.memo(Mne),Rne=e=>{const{label:t,...n}=e,{colorMode:r}=ha();return a.jsx(Md,{colorScheme:"accent",...n,children:a.jsx(ve,{sx:{fontSize:"sm",color:Ae("base.800","base.200")(r)},children:t})})},br=d.memo(Rne),Dne=ce([xe],e=>{const{galleryImageMinimumWidth:t,shouldAutoSwitch:n,autoAssignBoardOnClick:r}=e.gallery;return{galleryImageMinimumWidth:t,shouldAutoSwitch:n,autoAssignBoardOnClick:r}},je),Ane=()=>{const e=te(),{t}=Z(),{galleryImageMinimumWidth:n,shouldAutoSwitch:r,autoAssignBoardOnClick:o}=W(Dne),s=d.useCallback(u=>{e(ow(u))},[e]),i=d.useCallback(()=>{e(ow(64))},[e]),l=d.useCallback(u=>{e(ID(u.target.checked))},[e]);return a.jsx(qd,{triggerComponent:a.jsx(Fe,{tooltip:t("gallery.gallerySettings"),"aria-label":t("gallery.gallerySettings"),size:"sm",icon:a.jsx(yM,{})}),children:a.jsxs(L,{direction:"column",gap:2,children:[a.jsx(tt,{value:n,onChange:s,min:45,max:256,hideTooltip:!0,label:t("gallery.galleryImageSize"),withReset:!0,handleReset:i}),a.jsx(dn,{label:t("gallery.autoSwitchNewImages"),isChecked:r,onChange:l}),a.jsx(br,{label:t("gallery.autoAssignBoardOnClick"),isChecked:o,onChange:u=>e(PD(u.target.checked))}),a.jsx(One,{})]})})},Tne=d.memo(Ane),Nne=e=>e.image?a.jsx(Gh,{sx:{w:`${e.image.width}px`,h:"auto",objectFit:"contain",aspectRatio:`${e.image.width}/${e.image.height}`}}):a.jsx(L,{sx:{opacity:.7,w:"full",h:"full",alignItems:"center",justifyContent:"center",borderRadius:"base",bg:"base.200",_dark:{bg:"base.900"}},children:a.jsx(fa,{size:"xl"})}),Zn=e=>{const{icon:t=Qi,boxSize:n=16,sx:r,...o}=e;return a.jsxs(L,{sx:{w:"full",h:"full",alignItems:"center",justifyContent:"center",borderRadius:"base",flexDir:"column",gap:2,userSelect:"none",opacity:.7,color:"base.700",_dark:{color:"base.500"},...r},...o,children:[t&&a.jsx(Tn,{as:t,boxSize:n,opacity:.7}),e.label&&a.jsx(ve,{textAlign:"center",children:e.label})]})},$ne=e=>{const{sx:t,...n}=e;return a.jsxs(L,{sx:{w:"full",h:"full",alignItems:"center",justifyContent:"center",borderRadius:"base",flexDir:"column",gap:2,userSelect:"none",opacity:.7,color:"base.700",_dark:{color:"base.500"},...t},...n,children:[a.jsx(fa,{size:"xl"}),e.label&&a.jsx(ve,{textAlign:"center",children:e.label})]})},xg=0,ui=1,Wc=2,l8=4;function c8(e,t){return n=>e(t(n))}function Lne(e,t){return t(e)}function u8(e,t){return n=>e(t,n)}function jj(e,t){return()=>e(t)}function bg(e,t){return t(e),e}function hn(...e){return e}function zne(e){e()}function _j(e){return()=>e}function Fne(...e){return()=>{e.map(zne)}}function Dy(e){return e!==void 0}function Uc(){}function Yt(e,t){return e(ui,t)}function wt(e,t){e(xg,t)}function Ay(e){e(Wc)}function bo(e){return e(l8)}function st(e,t){return Yt(e,u8(t,xg))}function ca(e,t){const n=e(ui,r=>{n(),t(r)});return n}function Tt(){const e=[];return(t,n)=>{switch(t){case Wc:e.splice(0,e.length);return;case ui:return e.push(n),()=>{const r=e.indexOf(n);r>-1&&e.splice(r,1)};case xg:e.slice().forEach(r=>{r(n)});return;default:throw new Error(`unrecognized action ${t}`)}}}function Ve(e){let t=e;const n=Tt();return(r,o)=>{switch(r){case ui:o(t);break;case xg:t=o;break;case l8:return t}return n(r,o)}}function Bne(e){let t,n;const r=()=>t&&t();return function(o,s){switch(o){case ui:return s?n===s?void 0:(r(),n=s,t=Yt(e,s),t):(r(),Uc);case Wc:r(),n=null;return;default:throw new Error(`unrecognized action ${o}`)}}}function Jr(e){return bg(Tt(),t=>st(e,t))}function yr(e,t){return bg(Ve(t),n=>st(e,n))}function Hne(...e){return t=>e.reduceRight(Lne,t)}function Pe(e,...t){const n=Hne(...t);return(r,o)=>{switch(r){case ui:return Yt(e,n(o));case Wc:Ay(e);return}}}function d8(e,t){return e===t}function fn(e=d8){let t;return n=>r=>{e(t,r)||(t=r,n(r))}}function gt(e){return t=>n=>{e(n)&&t(n)}}function Xe(e){return t=>c8(t,e)}function qs(e){return t=>()=>t(e)}function bs(e,t){return n=>r=>n(t=e(t,r))}function Pc(e){return t=>n=>{e>0?e--:t(n)}}function Ga(e){let t=null,n;return r=>o=>{t=o,!n&&(n=setTimeout(()=>{n=void 0,r(t)},e))}}function Ij(e){let t,n;return r=>o=>{t=o,n&&clearTimeout(n),n=setTimeout(()=>{r(t)},e)}}function _t(...e){const t=new Array(e.length);let n=0,r=null;const o=Math.pow(2,e.length)-1;return e.forEach((s,i)=>{const l=Math.pow(2,i);Yt(s,u=>{const p=n;n=n|l,t[i]=u,p!==o&&n===o&&r&&(r(),r=null)})}),s=>i=>{const l=()=>s([i].concat(t));n===o?l():r=l}}function Pj(...e){return function(t,n){switch(t){case ui:return Fne(...e.map(r=>Yt(r,n)));case Wc:return;default:throw new Error(`unrecognized action ${t}`)}}}function ht(e,t=d8){return Pe(e,fn(t))}function Qn(...e){const t=Tt(),n=new Array(e.length);let r=0;const o=Math.pow(2,e.length)-1;return e.forEach((s,i)=>{const l=Math.pow(2,i);Yt(s,u=>{n[i]=u,r=r|l,r===o&&wt(t,n)})}),function(s,i){switch(s){case ui:return r===o&&i(n),Yt(t,i);case Wc:return Ay(t);default:throw new Error(`unrecognized action ${s}`)}}}function qt(e,t=[],{singleton:n}={singleton:!0}){return{id:Vne(),constructor:e,dependencies:t,singleton:n}}const Vne=()=>Symbol();function Wne(e){const t=new Map,n=({id:r,constructor:o,dependencies:s,singleton:i})=>{if(i&&t.has(r))return t.get(r);const l=o(s.map(u=>n(u)));return i&&t.set(r,l),l};return n(e)}function Une(e,t){const n={},r={};let o=0;const s=e.length;for(;o(w[S]=j=>{const _=b[t.methods[S]];wt(_,j)},w),{})}function m(b){return i.reduce((w,S)=>(w[S]=Bne(b[t.events[S]]),w),{})}return{Component:H.forwardRef((b,w)=>{const{children:S,...j}=b,[_]=H.useState(()=>bg(Wne(e),I=>u(I,j))),[E]=H.useState(jj(m,_));return Pp(()=>{for(const I of i)I in j&&Yt(E[I],j[I]);return()=>{Object.values(E).map(Ay)}},[j,E,_]),Pp(()=>{u(_,j)}),H.useImperativeHandle(w,_j(p(_))),H.createElement(l.Provider,{value:_},n?H.createElement(n,Une([...r,...o,...i],j),S):S)}),usePublisher:b=>H.useCallback(u8(wt,H.useContext(l)[b]),[b]),useEmitterValue:b=>{const S=H.useContext(l)[b],[j,_]=H.useState(jj(bo,S));return Pp(()=>Yt(S,E=>{E!==j&&_(_j(E))}),[S,j]),j},useEmitter:(b,w)=>{const j=H.useContext(l)[b];Pp(()=>Yt(j,w),[w,j])}}}const Gne=typeof document<"u"?H.useLayoutEffect:H.useEffect,Kne=Gne;var eo=(e=>(e[e.DEBUG=0]="DEBUG",e[e.INFO=1]="INFO",e[e.WARN=2]="WARN",e[e.ERROR=3]="ERROR",e))(eo||{});const qne={0:"debug",1:"log",2:"warn",3:"error"},Xne=()=>typeof globalThis>"u"?window:globalThis,di=qt(()=>{const e=Ve(3);return{log:Ve((n,r,o=1)=>{var s;const i=(s=Xne().VIRTUOSO_LOG_LEVEL)!=null?s:bo(e);o>=i&&console[qne[o]]("%creact-virtuoso: %c%s %o","color: #0253b3; font-weight: bold","color: initial",n,r)}),logLevel:e}},[],{singleton:!0});function Ty(e,t=!0){const n=H.useRef(null);let r=o=>{};if(typeof ResizeObserver<"u"){const o=H.useMemo(()=>new ResizeObserver(s=>{const i=s[0].target;i.offsetParent!==null&&e(i)}),[e]);r=s=>{s&&t?(o.observe(s),n.current=s):(n.current&&o.unobserve(n.current),n.current=null)}}return{ref:n,callbackRef:r}}function ll(e,t=!0){return Ty(e,t).callbackRef}function Qne(e,t,n,r,o,s,i){const l=H.useCallback(u=>{const p=Yne(u.children,t,"offsetHeight",o);let m=u.parentElement;for(;!m.dataset.virtuosoScroller;)m=m.parentElement;const h=m.lastElementChild.dataset.viewportType==="window",g=i?i.scrollTop:h?window.pageYOffset||document.documentElement.scrollTop:m.scrollTop,x=i?i.scrollHeight:h?document.documentElement.scrollHeight:m.scrollHeight,y=i?i.offsetHeight:h?window.innerHeight:m.offsetHeight;r({scrollTop:Math.max(g,0),scrollHeight:x,viewportHeight:y}),s==null||s(Zne("row-gap",getComputedStyle(u).rowGap,o)),p!==null&&e(p)},[e,t,o,s,i,r]);return Ty(l,n)}function Yne(e,t,n,r){const o=e.length;if(o===0)return null;const s=[];for(let i=0;i{const g=h.target,x=g===window||g===document,y=x?window.pageYOffset||document.documentElement.scrollTop:g.scrollTop,b=x?document.documentElement.scrollHeight:g.scrollHeight,w=x?window.innerHeight:g.offsetHeight,S=()=>{e({scrollTop:Math.max(y,0),scrollHeight:b,viewportHeight:w})};h.suppressFlushSync?S():ED.flushSync(S),i.current!==null&&(y===i.current||y<=0||y===b-w)&&(i.current=null,t(!0),l.current&&(clearTimeout(l.current),l.current=null))},[e,t]);H.useEffect(()=>{const h=o||s.current;return r(o||s.current),u({target:h,suppressFlushSync:!0}),h.addEventListener("scroll",u,{passive:!0}),()=>{r(null),h.removeEventListener("scroll",u)}},[s,u,n,r,o]);function p(h){const g=s.current;if(!g||"offsetHeight"in g&&g.offsetHeight===0)return;const x=h.behavior==="smooth";let y,b,w;g===window?(b=Math.max(ri(document.documentElement,"height"),document.documentElement.scrollHeight),y=window.innerHeight,w=document.documentElement.scrollTop):(b=g.scrollHeight,y=ri(g,"height"),w=g.scrollTop);const S=b-y;if(h.top=Math.ceil(Math.max(Math.min(S,h.top),0)),p8(y,b)||h.top===w){e({scrollTop:w,scrollHeight:b,viewportHeight:y}),x&&t(!0);return}x?(i.current=h.top,l.current&&clearTimeout(l.current),l.current=setTimeout(()=>{l.current=null,i.current=null,t(!0)},1e3)):i.current=null,g.scrollTo(h)}function m(h){s.current.scrollBy(h)}return{scrollerRef:s,scrollByCallback:m,scrollToCallback:p}}const Sr=qt(()=>{const e=Tt(),t=Tt(),n=Ve(0),r=Tt(),o=Ve(0),s=Tt(),i=Tt(),l=Ve(0),u=Ve(0),p=Ve(0),m=Ve(0),h=Tt(),g=Tt(),x=Ve(!1);return st(Pe(e,Xe(({scrollTop:y})=>y)),t),st(Pe(e,Xe(({scrollHeight:y})=>y)),i),st(t,o),{scrollContainerState:e,scrollTop:t,viewportHeight:s,headerHeight:l,fixedHeaderHeight:u,fixedFooterHeight:p,footerHeight:m,scrollHeight:i,smoothScrollTargetReached:r,scrollTo:h,scrollBy:g,statefulScrollTop:o,deviation:n,scrollingInProgress:x}},[],{singleton:!0}),cd={lvl:0};function h8(e,t,n,r=cd,o=cd){return{k:e,v:t,lvl:n,l:r,r:o}}function tn(e){return e===cd}function gc(){return cd}function gx(e,t){if(tn(e))return cd;const{k:n,l:r,r:o}=e;if(t===n){if(tn(r))return o;if(tn(o))return r;{const[s,i]=g8(r);return Up(Vn(e,{k:s,v:i,l:v8(r)}))}}else return tt&&(l=l.concat(vx(s,t,n))),r>=t&&r<=n&&l.push({k:r,v:o}),r<=n&&(l=l.concat(vx(i,t,n))),l}function Ei(e){return tn(e)?[]:[...Ei(e.l),{k:e.k,v:e.v},...Ei(e.r)]}function g8(e){return tn(e.r)?[e.k,e.v]:g8(e.r)}function v8(e){return tn(e.r)?e.l:Up(Vn(e,{r:v8(e.r)}))}function Vn(e,t){return h8(t.k!==void 0?t.k:e.k,t.v!==void 0?t.v:e.v,t.lvl!==void 0?t.lvl:e.lvl,t.l!==void 0?t.l:e.l,t.r!==void 0?t.r:e.r)}function Hv(e){return tn(e)||e.lvl>e.r.lvl}function Ej(e){return xx(b8(e))}function Up(e){const{l:t,r:n,lvl:r}=e;if(n.lvl>=r-1&&t.lvl>=r-1)return e;if(r>n.lvl+1){if(Hv(t))return b8(Vn(e,{lvl:r-1}));if(!tn(t)&&!tn(t.r))return Vn(t.r,{l:Vn(t,{r:t.r.l}),r:Vn(e,{l:t.r.r,lvl:r-1}),lvl:r});throw new Error("Unexpected empty nodes")}else{if(Hv(e))return xx(Vn(e,{lvl:r-1}));if(!tn(n)&&!tn(n.l)){const o=n.l,s=Hv(o)?n.lvl-1:n.lvl;return Vn(o,{l:Vn(e,{r:o.l,lvl:r-1}),r:xx(Vn(n,{l:o.r,lvl:s})),lvl:o.lvl+1})}else throw new Error("Unexpected empty nodes")}}function yg(e,t,n){if(tn(e))return[];const r=ns(e,t)[0];return Jne(vx(e,r,n))}function x8(e,t){const n=e.length;if(n===0)return[];let{index:r,value:o}=t(e[0]);const s=[];for(let i=1;i({index:t,value:n}))}function xx(e){const{r:t,lvl:n}=e;return!tn(t)&&!tn(t.r)&&t.lvl===n&&t.r.lvl===n?Vn(t,{l:Vn(e,{r:t.l}),lvl:n+1}):e}function b8(e){const{l:t}=e;return!tn(t)&&t.lvl===e.lvl?Vn(t,{r:Vn(e,{l:t.r})}):e}function oh(e,t,n,r=0){let o=e.length-1;for(;r<=o;){const s=Math.floor((r+o)/2),i=e[s],l=n(i,t);if(l===0)return s;if(l===-1){if(o-r<2)return s-1;o=s-1}else{if(o===r)return s;r=s+1}}throw new Error(`Failed binary finding record in array - ${e.join(",")}, searched for ${t}`)}function y8(e,t,n){return e[oh(e,t,n)]}function ere(e,t,n,r){const o=oh(e,t,r),s=oh(e,n,r,o);return e.slice(o,s+1)}const Ny=qt(()=>({recalcInProgress:Ve(!1)}),[],{singleton:!0});function tre(e){const{size:t,startIndex:n,endIndex:r}=e;return o=>o.start===n&&(o.end===r||o.end===1/0)&&o.value===t}function Mj(e,t){let n=0,r=0;for(;n=m||o===g)&&(e=gx(e,m)):(p=g!==o,u=!0),h>i&&i>=m&&g!==o&&(e=Yr(e,i+1,g));p&&(e=Yr(e,s,o))}return[e,n]}function rre(){return{offsetTree:[],sizeTree:gc(),groupOffsetTree:gc(),lastIndex:0,lastOffset:0,lastSize:0,groupIndices:[]}}function $y({index:e},t){return t===e?0:t0&&(t=Math.max(t,y8(e,r,$y).offset)),x8(ere(e,t,n,ore),sre)}function bx(e,t,n,r){let o=e,s=0,i=0,l=0,u=0;if(t!==0){u=oh(o,t-1,$y),l=o[u].offset;const m=ns(n,t-1);s=m[0],i=m[1],o.length&&o[u].size===ns(n,t)[1]&&(u-=1),o=o.slice(0,u+1)}else o=[];for(const{start:p,value:m}of yg(n,t,1/0)){const h=p-s,g=h*i+l+h*r;o.push({offset:g,size:m,index:p}),s=p,l=g,i=m}return{offsetTree:o,lastIndex:s,lastOffset:l,lastSize:i}}function ire(e,[t,n,r,o]){t.length>0&&r("received item sizes",t,eo.DEBUG);const s=e.sizeTree;let i=s,l=0;if(n.length>0&&tn(s)&&t.length===2){const g=t[0].size,x=t[1].size;i=n.reduce((y,b)=>Yr(Yr(y,b,g),b+1,x),i)}else[i,l]=nre(i,t);if(i===s)return e;const{offsetTree:u,lastIndex:p,lastSize:m,lastOffset:h}=bx(e.offsetTree,l,i,o);return{sizeTree:i,offsetTree:u,lastIndex:p,lastOffset:h,lastSize:m,groupOffsetTree:n.reduce((g,x)=>Yr(g,x,dd(x,u,o)),gc()),groupIndices:n}}function dd(e,t,n){if(t.length===0)return 0;const{offset:r,index:o,size:s}=y8(t,e,$y),i=e-o,l=s*i+(i-1)*n+r;return l>0?l+n:l}function lre(e){return typeof e.groupIndex<"u"}function C8(e,t,n){if(lre(e))return t.groupIndices[e.groupIndex]+1;{const r=e.index==="LAST"?n:e.index;let o=w8(r,t);return o=Math.max(0,o,Math.min(n,o)),o}}function w8(e,t){if(!Cg(t))return e;let n=0;for(;t.groupIndices[n]<=e+n;)n++;return e+n}function Cg(e){return!tn(e.groupOffsetTree)}function cre(e){return Ei(e).map(({k:t,v:n},r,o)=>{const s=o[r+1],i=s?s.k-1:1/0;return{startIndex:t,endIndex:i,size:n}})}const ure={offsetHeight:"height",offsetWidth:"width"},Ts=qt(([{log:e},{recalcInProgress:t}])=>{const n=Tt(),r=Tt(),o=yr(r,0),s=Tt(),i=Tt(),l=Ve(0),u=Ve([]),p=Ve(void 0),m=Ve(void 0),h=Ve((I,M)=>ri(I,ure[M])),g=Ve(void 0),x=Ve(0),y=rre(),b=yr(Pe(n,_t(u,e,x),bs(ire,y),fn()),y),w=yr(Pe(u,fn(),bs((I,M)=>({prev:I.current,current:M}),{prev:[],current:[]}),Xe(({prev:I})=>I)),[]);st(Pe(u,gt(I=>I.length>0),_t(b,x),Xe(([I,M,R])=>{const D=I.reduce((A,O,T)=>Yr(A,O,dd(O,M.offsetTree,R)||T),gc());return{...M,groupIndices:I,groupOffsetTree:D}})),b),st(Pe(r,_t(b),gt(([I,{lastIndex:M}])=>I[{startIndex:I,endIndex:M,size:R}])),n),st(p,m);const S=yr(Pe(p,Xe(I=>I===void 0)),!0);st(Pe(m,gt(I=>I!==void 0&&tn(bo(b).sizeTree)),Xe(I=>[{startIndex:0,endIndex:0,size:I}])),n);const j=Jr(Pe(n,_t(b),bs(({sizes:I},[M,R])=>({changed:R!==I,sizes:R}),{changed:!1,sizes:y}),Xe(I=>I.changed)));Yt(Pe(l,bs((I,M)=>({diff:I.prev-M,prev:M}),{diff:0,prev:0}),Xe(I=>I.diff)),I=>{const{groupIndices:M}=bo(b);if(I>0)wt(t,!0),wt(s,I+Mj(I,M));else if(I<0){const R=bo(w);R.length>0&&(I-=Mj(-I,R)),wt(i,I)}}),Yt(Pe(l,_t(e)),([I,M])=>{I<0&&M("`firstItemIndex` prop should not be set to less than zero. If you don't know the total count, just use a very high value",{firstItemIndex:l},eo.ERROR)});const _=Jr(s);st(Pe(s,_t(b),Xe(([I,M])=>{const R=M.groupIndices.length>0,D=[],A=M.lastSize;if(R){const O=ud(M.sizeTree,0);let T=0,X=0;for(;T{let q=U.ranges;return U.prevSize!==0&&(q=[...U.ranges,{startIndex:U.prevIndex,endIndex:N+I-1,size:U.prevSize}]),{ranges:q,prevIndex:N+I,prevSize:$}},{ranges:D,prevIndex:I,prevSize:0}).ranges}return Ei(M.sizeTree).reduce((O,{k:T,v:X})=>({ranges:[...O.ranges,{startIndex:O.prevIndex,endIndex:T+I-1,size:O.prevSize}],prevIndex:T+I,prevSize:X}),{ranges:[],prevIndex:0,prevSize:A}).ranges})),n);const E=Jr(Pe(i,_t(b,x),Xe(([I,{offsetTree:M},R])=>{const D=-I;return dd(D,M,R)})));return st(Pe(i,_t(b,x),Xe(([I,M,R])=>{if(M.groupIndices.length>0){if(tn(M.sizeTree))return M;let A=gc();const O=bo(w);let T=0,X=0,B=0;for(;T<-I;){B=O[X];const U=O[X+1]-B-1;X++,T+=U+1}if(A=Ei(M.sizeTree).reduce((U,{k:N,v:$})=>Yr(U,Math.max(0,N+I),$),A),T!==-I){const U=ud(M.sizeTree,B);A=Yr(A,0,U);const N=ns(M.sizeTree,-I+1)[1];A=Yr(A,1,N)}return{...M,sizeTree:A,...bx(M.offsetTree,0,A,R)}}else{const A=Ei(M.sizeTree).reduce((O,{k:T,v:X})=>Yr(O,Math.max(0,T+I),X),gc());return{...M,sizeTree:A,...bx(M.offsetTree,0,A,R)}}})),b),{data:g,totalCount:r,sizeRanges:n,groupIndices:u,defaultItemSize:m,fixedItemSize:p,unshiftWith:s,shiftWith:i,shiftWithOffset:E,beforeUnshiftWith:_,firstItemIndex:l,gap:x,sizes:b,listRefresh:j,statefulTotalCount:o,trackItemSizes:S,itemSize:h}},hn(di,Ny),{singleton:!0}),dre=typeof document<"u"&&"scrollBehavior"in document.documentElement.style;function S8(e){const t=typeof e=="number"?{index:e}:e;return t.align||(t.align="start"),(!t.behavior||!dre)&&(t.behavior="auto"),t.offset||(t.offset=0),t}const Xd=qt(([{sizes:e,totalCount:t,listRefresh:n,gap:r},{scrollingInProgress:o,viewportHeight:s,scrollTo:i,smoothScrollTargetReached:l,headerHeight:u,footerHeight:p,fixedHeaderHeight:m,fixedFooterHeight:h},{log:g}])=>{const x=Tt(),y=Ve(0);let b=null,w=null,S=null;function j(){b&&(b(),b=null),S&&(S(),S=null),w&&(clearTimeout(w),w=null),wt(o,!1)}return st(Pe(x,_t(e,s,t,y,u,p,g),_t(r,m,h),Xe(([[_,E,I,M,R,D,A,O],T,X,B])=>{const V=S8(_),{align:U,behavior:N,offset:$}=V,q=M-1,F=C8(V,E,q);let Q=dd(F,E.offsetTree,T)+D;U==="end"?(Q+=X+ns(E.sizeTree,F)[1]-I+B,F===q&&(Q+=A)):U==="center"?Q+=(X+ns(E.sizeTree,F)[1]-I+B)/2:Q-=R,$&&(Q+=$);const Y=se=>{j(),se?(O("retrying to scroll to",{location:_},eo.DEBUG),wt(x,_)):O("list did not change, scroll successful",{},eo.DEBUG)};if(j(),N==="smooth"){let se=!1;S=Yt(n,ae=>{se=se||ae}),b=ca(l,()=>{Y(se)})}else b=ca(Pe(n,fre(150)),Y);return w=setTimeout(()=>{j()},1200),wt(o,!0),O("scrolling from index to",{index:F,top:Q,behavior:N},eo.DEBUG),{top:Q,behavior:N}})),i),{scrollToIndex:x,topListHeight:y}},hn(Ts,Sr,di),{singleton:!0});function fre(e){return t=>{const n=setTimeout(()=>{t(!1)},e);return r=>{r&&(t(!0),clearTimeout(n))}}}const fd="up",Hu="down",pre="none",mre={atBottom:!1,notAtBottomBecause:"NOT_SHOWING_LAST_ITEM",state:{offsetBottom:0,scrollTop:0,viewportHeight:0,scrollHeight:0}},hre=0,Qd=qt(([{scrollContainerState:e,scrollTop:t,viewportHeight:n,headerHeight:r,footerHeight:o,scrollBy:s}])=>{const i=Ve(!1),l=Ve(!0),u=Tt(),p=Tt(),m=Ve(4),h=Ve(hre),g=yr(Pe(Pj(Pe(ht(t),Pc(1),qs(!0)),Pe(ht(t),Pc(1),qs(!1),Ij(100))),fn()),!1),x=yr(Pe(Pj(Pe(s,qs(!0)),Pe(s,qs(!1),Ij(200))),fn()),!1);st(Pe(Qn(ht(t),ht(h)),Xe(([j,_])=>j<=_),fn()),l),st(Pe(l,Ga(50)),p);const y=Jr(Pe(Qn(e,ht(n),ht(r),ht(o),ht(m)),bs((j,[{scrollTop:_,scrollHeight:E},I,M,R,D])=>{const A=_+I-E>-D,O={viewportHeight:I,scrollTop:_,scrollHeight:E};if(A){let X,B;return _>j.state.scrollTop?(X="SCROLLED_DOWN",B=j.state.scrollTop-_):(X="SIZE_DECREASED",B=j.state.scrollTop-_||j.scrollTopDelta),{atBottom:!0,state:O,atBottomBecause:X,scrollTopDelta:B}}let T;return O.scrollHeight>j.state.scrollHeight?T="SIZE_INCREASED":Ij&&j.atBottom===_.atBottom))),b=yr(Pe(e,bs((j,{scrollTop:_,scrollHeight:E,viewportHeight:I})=>{if(p8(j.scrollHeight,E))return{scrollTop:_,scrollHeight:E,jump:0,changed:!1};{const M=E-(_+I)<1;return j.scrollTop!==_&&M?{scrollHeight:E,scrollTop:_,jump:j.scrollTop-_,changed:!0}:{scrollHeight:E,scrollTop:_,jump:0,changed:!0}}},{scrollHeight:0,jump:0,scrollTop:0,changed:!1}),gt(j=>j.changed),Xe(j=>j.jump)),0);st(Pe(y,Xe(j=>j.atBottom)),i),st(Pe(i,Ga(50)),u);const w=Ve(Hu);st(Pe(e,Xe(({scrollTop:j})=>j),fn(),bs((j,_)=>bo(x)?{direction:j.direction,prevScrollTop:_}:{direction:_j.direction)),w),st(Pe(e,Ga(50),qs(pre)),w);const S=Ve(0);return st(Pe(g,gt(j=>!j),qs(0)),S),st(Pe(t,Ga(100),_t(g),gt(([j,_])=>!!_),bs(([j,_],[E])=>[_,E],[0,0]),Xe(([j,_])=>_-j)),S),{isScrolling:g,isAtTop:l,isAtBottom:i,atBottomState:y,atTopStateChange:p,atBottomStateChange:u,scrollDirection:w,atBottomThreshold:m,atTopThreshold:h,scrollVelocity:S,lastJumpDueToItemResize:b}},hn(Sr)),fi=qt(([{log:e}])=>{const t=Ve(!1),n=Jr(Pe(t,gt(r=>r),fn()));return Yt(t,r=>{r&&bo(e)("props updated",{},eo.DEBUG)}),{propsReady:t,didMount:n}},hn(di),{singleton:!0});function Ly(e,t){e==0?t():requestAnimationFrame(()=>Ly(e-1,t))}function zy(e,t){const n=t-1;return typeof e=="number"?e:e.index==="LAST"?n:e.index}const Yd=qt(([{sizes:e,listRefresh:t,defaultItemSize:n},{scrollTop:r},{scrollToIndex:o},{didMount:s}])=>{const i=Ve(!0),l=Ve(0),u=Ve(!1);return st(Pe(s,_t(l),gt(([p,m])=>!!m),qs(!1)),i),Yt(Pe(Qn(t,s),_t(i,e,n,u),gt(([[,p],m,{sizeTree:h},g,x])=>p&&(!tn(h)||Dy(g))&&!m&&!x),_t(l)),([,p])=>{wt(u,!0),Ly(3,()=>{ca(r,()=>wt(i,!0)),wt(o,p)})}),{scrolledToInitialItem:i,initialTopMostItemIndex:l}},hn(Ts,Sr,Xd,fi),{singleton:!0});function Oj(e){return e?e==="smooth"?"smooth":"auto":!1}const gre=(e,t)=>typeof e=="function"?Oj(e(t)):t&&Oj(e),vre=qt(([{totalCount:e,listRefresh:t},{isAtBottom:n,atBottomState:r},{scrollToIndex:o},{scrolledToInitialItem:s},{propsReady:i,didMount:l},{log:u},{scrollingInProgress:p}])=>{const m=Ve(!1),h=Tt();let g=null;function x(b){wt(o,{index:"LAST",align:"end",behavior:b})}Yt(Pe(Qn(Pe(ht(e),Pc(1)),l),_t(ht(m),n,s,p),Xe(([[b,w],S,j,_,E])=>{let I=w&&_,M="auto";return I&&(M=gre(S,j||E),I=I&&!!M),{totalCount:b,shouldFollow:I,followOutputBehavior:M}}),gt(({shouldFollow:b})=>b)),({totalCount:b,followOutputBehavior:w})=>{g&&(g(),g=null),g=ca(t,()=>{bo(u)("following output to ",{totalCount:b},eo.DEBUG),x(w),g=null})});function y(b){const w=ca(r,S=>{b&&!S.atBottom&&S.notAtBottomBecause==="SIZE_INCREASED"&&!g&&(bo(u)("scrolling to bottom due to increased size",{},eo.DEBUG),x("auto"))});setTimeout(w,100)}return Yt(Pe(Qn(ht(m),e,i),gt(([b,,w])=>b&&w),bs(({value:b},[,w])=>({refreshed:b===w,value:w}),{refreshed:!1,value:0}),gt(({refreshed:b})=>b),_t(m,e)),([,b])=>{y(b!==!1)}),Yt(h,()=>{y(bo(m)!==!1)}),Yt(Qn(ht(m),r),([b,w])=>{b&&!w.atBottom&&w.notAtBottomBecause==="VIEWPORT_HEIGHT_DECREASING"&&x("auto")}),{followOutput:m,autoscrollToBottom:h}},hn(Ts,Qd,Xd,Yd,fi,di,Sr));function xre(e){return e.reduce((t,n)=>(t.groupIndices.push(t.totalCount),t.totalCount+=n+1,t),{totalCount:0,groupIndices:[]})}const k8=qt(([{totalCount:e,groupIndices:t,sizes:n},{scrollTop:r,headerHeight:o}])=>{const s=Tt(),i=Tt(),l=Jr(Pe(s,Xe(xre)));return st(Pe(l,Xe(u=>u.totalCount)),e),st(Pe(l,Xe(u=>u.groupIndices)),t),st(Pe(Qn(r,n,o),gt(([u,p])=>Cg(p)),Xe(([u,p,m])=>ns(p.groupOffsetTree,Math.max(u-m,0),"v")[0]),fn(),Xe(u=>[u])),i),{groupCounts:s,topItemsIndexes:i}},hn(Ts,Sr));function pd(e,t){return!!(e&&e[0]===t[0]&&e[1]===t[1])}function j8(e,t){return!!(e&&e.startIndex===t.startIndex&&e.endIndex===t.endIndex)}const sh="top",ah="bottom",Rj="none";function Dj(e,t,n){return typeof e=="number"?n===fd&&t===sh||n===Hu&&t===ah?e:0:n===fd?t===sh?e.main:e.reverse:t===ah?e.main:e.reverse}function Aj(e,t){return typeof e=="number"?e:e[t]||0}const Fy=qt(([{scrollTop:e,viewportHeight:t,deviation:n,headerHeight:r,fixedHeaderHeight:o}])=>{const s=Tt(),i=Ve(0),l=Ve(0),u=Ve(0),p=yr(Pe(Qn(ht(e),ht(t),ht(r),ht(s,pd),ht(u),ht(i),ht(o),ht(n),ht(l)),Xe(([m,h,g,[x,y],b,w,S,j,_])=>{const E=m-j,I=w+S,M=Math.max(g-E,0);let R=Rj;const D=Aj(_,sh),A=Aj(_,ah);return x-=j,x+=g+S,y+=g+S,y-=j,x>m+I-D&&(R=fd),ym!=null),fn(pd)),[0,0]);return{listBoundary:s,overscan:u,topListHeight:i,increaseViewportBy:l,visibleRange:p}},hn(Sr),{singleton:!0});function bre(e,t,n){if(Cg(t)){const r=w8(e,t);return[{index:ns(t.groupOffsetTree,r)[0],size:0,offset:0},{index:r,size:0,offset:0,data:n&&n[0]}]}return[{index:e,size:0,offset:0,data:n&&n[0]}]}const Tj={items:[],topItems:[],offsetTop:0,offsetBottom:0,top:0,bottom:0,topListHeight:0,totalCount:0,firstItemIndex:0};function Nj(e,t,n){if(e.length===0)return[];if(!Cg(t))return e.map(p=>({...p,index:p.index+n,originalIndex:p.index}));const r=e[0].index,o=e[e.length-1].index,s=[],i=yg(t.groupOffsetTree,r,o);let l,u=0;for(const p of e){(!l||l.end0){p=e[0].offset;const b=e[e.length-1];m=b.offset+b.size}const h=n-u,g=l+h*i+(h-1)*r,x=p,y=g-m;return{items:Nj(e,o,s),topItems:Nj(t,o,s),topListHeight:t.reduce((b,w)=>w.size+b,0),offsetTop:p,offsetBottom:y,top:x,bottom:m,totalCount:n,firstItemIndex:s}}const cl=qt(([{sizes:e,totalCount:t,data:n,firstItemIndex:r,gap:o},s,{visibleRange:i,listBoundary:l,topListHeight:u},{scrolledToInitialItem:p,initialTopMostItemIndex:m},{topListHeight:h},g,{didMount:x},{recalcInProgress:y}])=>{const b=Ve([]),w=Tt();st(s.topItemsIndexes,b);const S=yr(Pe(Qn(x,y,ht(i,pd),ht(t),ht(e),ht(m),p,ht(b),ht(r),ht(o),n),gt(([I,M,,R,,,,,,,D])=>{const A=D&&D.length!==R;return I&&!M&&!A}),Xe(([,,[I,M],R,D,A,O,T,X,B,V])=>{const U=D,{sizeTree:N,offsetTree:$}=U;if(R===0||I===0&&M===0)return{...Tj,totalCount:R};if(tn(N))return Gp(bre(zy(A,R),U,V),[],R,B,U,X);const q=[];if(T.length>0){const ae=T[0],re=T[T.length-1];let G=0;for(const K of yg(N,ae,re)){const ee=K.value,le=Math.max(K.start,ae),J=Math.min(K.end,re);for(let ie=le;ie<=J;ie++)q.push({index:ie,size:ee,offset:G,data:V&&V[ie]}),G+=ee}}if(!O)return Gp([],q,R,B,U,X);const F=T.length>0?T[T.length-1]+1:0,Q=are($,I,M,F);if(Q.length===0)return null;const Y=R-1,se=bg([],ae=>{for(const re of Q){const G=re.value;let K=G.offset,ee=re.start;const le=G.size;if(G.offset=M);ie++)ae.push({index:ie,size:le,offset:K,data:V&&V[ie]}),K+=le+B}});return Gp(se,q,R,B,U,X)}),gt(I=>I!==null),fn()),Tj);st(Pe(n,gt(Dy),Xe(I=>I==null?void 0:I.length)),t),st(Pe(S,Xe(I=>I.topListHeight)),h),st(h,u),st(Pe(S,Xe(I=>[I.top,I.bottom])),l),st(Pe(S,Xe(I=>I.items)),w);const j=Jr(Pe(S,gt(({items:I})=>I.length>0),_t(t,n),gt(([{items:I},M])=>I[I.length-1].originalIndex===M-1),Xe(([,I,M])=>[I-1,M]),fn(pd),Xe(([I])=>I))),_=Jr(Pe(S,Ga(200),gt(({items:I,topItems:M})=>I.length>0&&I[0].originalIndex===M.length),Xe(({items:I})=>I[0].index),fn())),E=Jr(Pe(S,gt(({items:I})=>I.length>0),Xe(({items:I})=>{let M=0,R=I.length-1;for(;I[M].type==="group"&&MM;)R--;return{startIndex:I[M].index,endIndex:I[R].index}}),fn(j8)));return{listState:S,topItemsIndexes:b,endReached:j,startReached:_,rangeChanged:E,itemsRendered:w,...g}},hn(Ts,k8,Fy,Yd,Xd,Qd,fi,Ny),{singleton:!0}),yre=qt(([{sizes:e,firstItemIndex:t,data:n,gap:r},{initialTopMostItemIndex:o},{listState:s},{didMount:i}])=>{const l=Ve(0);return st(Pe(i,_t(l),gt(([,u])=>u!==0),_t(o,e,t,r,n),Xe(([[,u],p,m,h,g,x=[]])=>{let y=0;if(m.groupIndices.length>0)for(const j of m.groupIndices){if(j-y>=u)break;y++}const b=u+y,w=zy(p,b),S=Array.from({length:b}).map((j,_)=>({index:_+w,size:0,offset:0,data:x[_+w]}));return Gp(S,[],b,g,m,h)})),s),{initialItemCount:l}},hn(Ts,Yd,cl,fi),{singleton:!0}),_8=qt(([{scrollVelocity:e}])=>{const t=Ve(!1),n=Tt(),r=Ve(!1);return st(Pe(e,_t(r,t,n),gt(([o,s])=>!!s),Xe(([o,s,i,l])=>{const{exit:u,enter:p}=s;if(i){if(u(o,l))return!1}else if(p(o,l))return!0;return i}),fn()),t),Yt(Pe(Qn(t,e,n),_t(r)),([[o,s,i],l])=>o&&l&&l.change&&l.change(s,i)),{isSeeking:t,scrollSeekConfiguration:r,scrollVelocity:e,scrollSeekRangeChanged:n}},hn(Qd),{singleton:!0}),Cre=qt(([{topItemsIndexes:e}])=>{const t=Ve(0);return st(Pe(t,gt(n=>n>0),Xe(n=>Array.from({length:n}).map((r,o)=>o))),e),{topItemCount:t}},hn(cl)),I8=qt(([{footerHeight:e,headerHeight:t,fixedHeaderHeight:n,fixedFooterHeight:r},{listState:o}])=>{const s=Tt(),i=yr(Pe(Qn(e,r,t,n,o),Xe(([l,u,p,m,h])=>l+u+p+m+h.offsetBottom+h.bottom)),0);return st(ht(i),s),{totalListHeight:i,totalListHeightChanged:s}},hn(Sr,cl),{singleton:!0});function P8(e){let t=!1,n;return()=>(t||(t=!0,n=e()),n)}const wre=P8(()=>/iP(ad|od|hone)/i.test(navigator.userAgent)&&/WebKit/i.test(navigator.userAgent)),Sre=qt(([{scrollBy:e,scrollTop:t,deviation:n,scrollingInProgress:r},{isScrolling:o,isAtBottom:s,scrollDirection:i,lastJumpDueToItemResize:l},{listState:u},{beforeUnshiftWith:p,shiftWithOffset:m,sizes:h,gap:g},{log:x},{recalcInProgress:y}])=>{const b=Jr(Pe(u,_t(l),bs(([,S,j,_],[{items:E,totalCount:I,bottom:M,offsetBottom:R},D])=>{const A=M+R;let O=0;return j===I&&S.length>0&&E.length>0&&(E[0].originalIndex===0&&S[0].originalIndex===0||(O=A-_,O!==0&&(O+=D))),[O,E,I,A]},[0,[],0,0]),gt(([S])=>S!==0),_t(t,i,r,s,x,y),gt(([,S,j,_,,,E])=>!E&&!_&&S!==0&&j===fd),Xe(([[S],,,,,j])=>(j("Upward scrolling compensation",{amount:S},eo.DEBUG),S))));function w(S){S>0?(wt(e,{top:-S,behavior:"auto"}),wt(n,0)):(wt(n,0),wt(e,{top:-S,behavior:"auto"}))}return Yt(Pe(b,_t(n,o)),([S,j,_])=>{_&&wre()?wt(n,j-S):w(-S)}),Yt(Pe(Qn(yr(o,!1),n,y),gt(([S,j,_])=>!S&&!_&&j!==0),Xe(([S,j])=>j),Ga(1)),w),st(Pe(m,Xe(S=>({top:-S}))),e),Yt(Pe(p,_t(h,g),Xe(([S,{lastSize:j,groupIndices:_,sizeTree:E},I])=>{function M(R){return R*(j+I)}if(_.length===0)return M(S);{let R=0;const D=ud(E,0);let A=0,O=0;for(;AS&&(R-=D,T=S-A+1),A+=T,R+=M(T),O++}return R}})),S=>{wt(n,S),requestAnimationFrame(()=>{wt(e,{top:S}),requestAnimationFrame(()=>{wt(n,0),wt(y,!1)})})}),{deviation:n}},hn(Sr,Qd,cl,Ts,di,Ny)),kre=qt(([{didMount:e},{scrollTo:t},{listState:n}])=>{const r=Ve(0);return Yt(Pe(e,_t(r),gt(([,o])=>o!==0),Xe(([,o])=>({top:o}))),o=>{ca(Pe(n,Pc(1),gt(s=>s.items.length>1)),()=>{requestAnimationFrame(()=>{wt(t,o)})})}),{initialScrollTop:r}},hn(fi,Sr,cl),{singleton:!0}),jre=qt(([{viewportHeight:e},{totalListHeight:t}])=>{const n=Ve(!1),r=yr(Pe(Qn(n,e,t),gt(([o])=>o),Xe(([,o,s])=>Math.max(0,o-s)),Ga(0),fn()),0);return{alignToBottom:n,paddingTopAddition:r}},hn(Sr,I8),{singleton:!0}),By=qt(([{scrollTo:e,scrollContainerState:t}])=>{const n=Tt(),r=Tt(),o=Tt(),s=Ve(!1),i=Ve(void 0);return st(Pe(Qn(n,r),Xe(([{viewportHeight:l,scrollTop:u,scrollHeight:p},{offsetTop:m}])=>({scrollTop:Math.max(0,u-m),scrollHeight:p,viewportHeight:l}))),t),st(Pe(e,_t(r),Xe(([l,{offsetTop:u}])=>({...l,top:l.top+u}))),o),{useWindowScroll:s,customScrollParent:i,windowScrollContainerState:n,windowViewportRect:r,windowScrollTo:o}},hn(Sr)),_re=({itemTop:e,itemBottom:t,viewportTop:n,viewportBottom:r,locationParams:{behavior:o,align:s,...i}})=>er?{...i,behavior:o,align:s??"end"}:null,Ire=qt(([{sizes:e,totalCount:t,gap:n},{scrollTop:r,viewportHeight:o,headerHeight:s,fixedHeaderHeight:i,fixedFooterHeight:l,scrollingInProgress:u},{scrollToIndex:p}])=>{const m=Tt();return st(Pe(m,_t(e,o,t,s,i,l,r),_t(n),Xe(([[h,g,x,y,b,w,S,j],_])=>{const{done:E,behavior:I,align:M,calculateViewLocation:R=_re,...D}=h,A=C8(h,g,y-1),O=dd(A,g.offsetTree,_)+b+w,T=O+ns(g.sizeTree,A)[1],X=j+w,B=j+x-S,V=R({itemTop:O,itemBottom:T,viewportTop:X,viewportBottom:B,locationParams:{behavior:I,align:M,...D}});return V?E&&ca(Pe(u,gt(U=>U===!1),Pc(bo(u)?1:2)),E):E&&E(),V}),gt(h=>h!==null)),p),{scrollIntoView:m}},hn(Ts,Sr,Xd,cl,di),{singleton:!0}),Pre=qt(([{sizes:e,sizeRanges:t},{scrollTop:n},{initialTopMostItemIndex:r},{didMount:o},{useWindowScroll:s,windowScrollContainerState:i,windowViewportRect:l}])=>{const u=Tt(),p=Ve(void 0),m=Ve(null),h=Ve(null);return st(i,m),st(l,h),Yt(Pe(u,_t(e,n,s,m,h)),([g,x,y,b,w,S])=>{const j=cre(x.sizeTree);b&&w!==null&&S!==null&&(y=w.scrollTop-S.offsetTop),g({ranges:j,scrollTop:y})}),st(Pe(p,gt(Dy),Xe(Ere)),r),st(Pe(o,_t(p),gt(([,g])=>g!==void 0),fn(),Xe(([,g])=>g.ranges)),t),{getState:u,restoreStateFrom:p}},hn(Ts,Sr,Yd,fi,By));function Ere(e){return{offset:e.scrollTop,index:0,align:"start"}}const Mre=qt(([e,t,n,r,o,s,i,l,u,p])=>({...e,...t,...n,...r,...o,...s,...i,...l,...u,...p}),hn(Fy,yre,fi,_8,I8,kre,jre,By,Ire,di)),Ore=qt(([{totalCount:e,sizeRanges:t,fixedItemSize:n,defaultItemSize:r,trackItemSizes:o,itemSize:s,data:i,firstItemIndex:l,groupIndices:u,statefulTotalCount:p,gap:m,sizes:h},{initialTopMostItemIndex:g,scrolledToInitialItem:x},y,b,w,{listState:S,topItemsIndexes:j,..._},{scrollToIndex:E},I,{topItemCount:M},{groupCounts:R},D])=>(st(_.rangeChanged,D.scrollSeekRangeChanged),st(Pe(D.windowViewportRect,Xe(A=>A.visibleHeight)),y.viewportHeight),{totalCount:e,data:i,firstItemIndex:l,sizeRanges:t,initialTopMostItemIndex:g,scrolledToInitialItem:x,topItemsIndexes:j,topItemCount:M,groupCounts:R,fixedItemHeight:n,defaultItemHeight:r,gap:m,...w,statefulTotalCount:p,listState:S,scrollToIndex:E,trackItemSizes:o,itemSize:s,groupIndices:u,..._,...D,...y,sizes:h,...b}),hn(Ts,Yd,Sr,Pre,vre,cl,Xd,Sre,Cre,k8,Mre)),Vv="-webkit-sticky",$j="sticky",E8=P8(()=>{if(typeof document>"u")return $j;const e=document.createElement("div");return e.style.position=Vv,e.style.position===Vv?Vv:$j});function M8(e,t){const n=H.useRef(null),r=H.useCallback(l=>{if(l===null||!l.offsetParent)return;const u=l.getBoundingClientRect(),p=u.width;let m,h;if(t){const g=t.getBoundingClientRect(),x=u.top-g.top;m=g.height-Math.max(0,x),h=x+t.scrollTop}else m=window.innerHeight-Math.max(0,u.top),h=u.top+window.pageYOffset;n.current={offsetTop:h,visibleHeight:m,visibleWidth:p},e(n.current)},[e,t]),{callbackRef:o,ref:s}=Ty(r),i=H.useCallback(()=>{r(s.current)},[r,s]);return H.useEffect(()=>{if(t){t.addEventListener("scroll",i);const l=new ResizeObserver(i);return l.observe(t),()=>{t.removeEventListener("scroll",i),l.unobserve(t)}}else return window.addEventListener("scroll",i),window.addEventListener("resize",i),()=>{window.removeEventListener("scroll",i),window.removeEventListener("resize",i)}},[i,t]),o}const O8=H.createContext(void 0),R8=H.createContext(void 0);function D8(e){return e}const Rre=qt(()=>{const e=Ve(u=>`Item ${u}`),t=Ve(null),n=Ve(u=>`Group ${u}`),r=Ve({}),o=Ve(D8),s=Ve("div"),i=Ve(Uc),l=(u,p=null)=>yr(Pe(r,Xe(m=>m[u]),fn()),p);return{context:t,itemContent:e,groupContent:n,components:r,computeItemKey:o,headerFooterTag:s,scrollerRef:i,FooterComponent:l("Footer"),HeaderComponent:l("Header"),TopItemListComponent:l("TopItemList"),ListComponent:l("List","div"),ItemComponent:l("Item","div"),GroupComponent:l("Group","div"),ScrollerComponent:l("Scroller","div"),EmptyPlaceholder:l("EmptyPlaceholder"),ScrollSeekPlaceholder:l("ScrollSeekPlaceholder")}}),Dre=qt(([e,t])=>({...e,...t}),hn(Ore,Rre)),Are=({height:e})=>H.createElement("div",{style:{height:e}}),Tre={position:E8(),zIndex:1,overflowAnchor:"none"},Nre={overflowAnchor:"none"},Lj=H.memo(function({showTopList:t=!1}){const n=Rt("listState"),r=yo("sizeRanges"),o=Rt("useWindowScroll"),s=Rt("customScrollParent"),i=yo("windowScrollContainerState"),l=yo("scrollContainerState"),u=s||o?i:l,p=Rt("itemContent"),m=Rt("context"),h=Rt("groupContent"),g=Rt("trackItemSizes"),x=Rt("itemSize"),y=Rt("log"),b=yo("gap"),{callbackRef:w}=Qne(r,x,g,t?Uc:u,y,b,s),[S,j]=H.useState(0);Hy("deviation",V=>{S!==V&&j(V)});const _=Rt("EmptyPlaceholder"),E=Rt("ScrollSeekPlaceholder")||Are,I=Rt("ListComponent"),M=Rt("ItemComponent"),R=Rt("GroupComponent"),D=Rt("computeItemKey"),A=Rt("isSeeking"),O=Rt("groupIndices").length>0,T=Rt("paddingTopAddition"),X=Rt("scrolledToInitialItem"),B=t?{}:{boxSizing:"border-box",paddingTop:n.offsetTop+T,paddingBottom:n.offsetBottom,marginTop:S,...X?{}:{visibility:"hidden"}};return!t&&n.totalCount===0&&_?H.createElement(_,Rr(_,m)):H.createElement(I,{...Rr(I,m),ref:w,style:B,"data-test-id":t?"virtuoso-top-item-list":"virtuoso-item-list"},(t?n.topItems:n.items).map(V=>{const U=V.originalIndex,N=D(U+n.firstItemIndex,V.data,m);return A?H.createElement(E,{...Rr(E,m),key:N,index:V.index,height:V.size,type:V.type||"item",...V.type==="group"?{}:{groupIndex:V.groupIndex}}):V.type==="group"?H.createElement(R,{...Rr(R,m),key:N,"data-index":U,"data-known-size":V.size,"data-item-index":V.index,style:Tre},h(V.index,m)):H.createElement(M,{...Rr(M,m),key:N,"data-index":U,"data-known-size":V.size,"data-item-index":V.index,"data-item-group-index":V.groupIndex,item:V.data,style:Nre},O?p(V.index,V.groupIndex,V.data,m):p(V.index,V.data,m))}))}),$re={height:"100%",outline:"none",overflowY:"auto",position:"relative",WebkitOverflowScrolling:"touch"},wg={width:"100%",height:"100%",position:"absolute",top:0},Lre={width:"100%",position:E8(),top:0,zIndex:1};function Rr(e,t){if(typeof e!="string")return{context:t}}const zre=H.memo(function(){const t=Rt("HeaderComponent"),n=yo("headerHeight"),r=Rt("headerFooterTag"),o=ll(i=>n(ri(i,"height"))),s=Rt("context");return t?H.createElement(r,{ref:o},H.createElement(t,Rr(t,s))):null}),Fre=H.memo(function(){const t=Rt("FooterComponent"),n=yo("footerHeight"),r=Rt("headerFooterTag"),o=ll(i=>n(ri(i,"height"))),s=Rt("context");return t?H.createElement(r,{ref:o},H.createElement(t,Rr(t,s))):null});function A8({usePublisher:e,useEmitter:t,useEmitterValue:n}){return H.memo(function({style:s,children:i,...l}){const u=e("scrollContainerState"),p=n("ScrollerComponent"),m=e("smoothScrollTargetReached"),h=n("scrollerRef"),g=n("context"),{scrollerRef:x,scrollByCallback:y,scrollToCallback:b}=m8(u,m,p,h);return t("scrollTo",b),t("scrollBy",y),H.createElement(p,{ref:x,style:{...$re,...s},"data-test-id":"virtuoso-scroller","data-virtuoso-scroller":!0,tabIndex:0,...l,...Rr(p,g)},i)})}function T8({usePublisher:e,useEmitter:t,useEmitterValue:n}){return H.memo(function({style:s,children:i,...l}){const u=e("windowScrollContainerState"),p=n("ScrollerComponent"),m=e("smoothScrollTargetReached"),h=n("totalListHeight"),g=n("deviation"),x=n("customScrollParent"),y=n("context"),{scrollerRef:b,scrollByCallback:w,scrollToCallback:S}=m8(u,m,p,Uc,x);return Kne(()=>(b.current=x||window,()=>{b.current=null}),[b,x]),t("windowScrollTo",S),t("scrollBy",w),H.createElement(p,{style:{position:"relative",...s,...h!==0?{height:h+g}:{}},"data-virtuoso-scroller":!0,...l,...Rr(p,y)},i)})}const Bre=({children:e})=>{const t=H.useContext(O8),n=yo("viewportHeight"),r=yo("fixedItemHeight"),o=ll(c8(n,s=>ri(s,"height")));return H.useEffect(()=>{t&&(n(t.viewportHeight),r(t.itemHeight))},[t,n,r]),H.createElement("div",{style:wg,ref:o,"data-viewport-type":"element"},e)},Hre=({children:e})=>{const t=H.useContext(O8),n=yo("windowViewportRect"),r=yo("fixedItemHeight"),o=Rt("customScrollParent"),s=M8(n,o);return H.useEffect(()=>{t&&(r(t.itemHeight),n({offsetTop:0,visibleHeight:t.viewportHeight,visibleWidth:100}))},[t,n,r]),H.createElement("div",{ref:s,style:wg,"data-viewport-type":"window"},e)},Vre=({children:e})=>{const t=Rt("TopItemListComponent"),n=Rt("headerHeight"),r={...Lre,marginTop:`${n}px`},o=Rt("context");return H.createElement(t||"div",{style:r,context:o},e)},Wre=H.memo(function(t){const n=Rt("useWindowScroll"),r=Rt("topItemsIndexes").length>0,o=Rt("customScrollParent"),s=o||n?Kre:Gre,i=o||n?Hre:Bre;return H.createElement(s,{...t},r&&H.createElement(Vre,null,H.createElement(Lj,{showTopList:!0})),H.createElement(i,null,H.createElement(zre,null),H.createElement(Lj,null),H.createElement(Fre,null)))}),{Component:Ure,usePublisher:yo,useEmitterValue:Rt,useEmitter:Hy}=f8(Dre,{required:{},optional:{restoreStateFrom:"restoreStateFrom",context:"context",followOutput:"followOutput",itemContent:"itemContent",groupContent:"groupContent",overscan:"overscan",increaseViewportBy:"increaseViewportBy",totalCount:"totalCount",groupCounts:"groupCounts",topItemCount:"topItemCount",firstItemIndex:"firstItemIndex",initialTopMostItemIndex:"initialTopMostItemIndex",components:"components",atBottomThreshold:"atBottomThreshold",atTopThreshold:"atTopThreshold",computeItemKey:"computeItemKey",defaultItemHeight:"defaultItemHeight",fixedItemHeight:"fixedItemHeight",itemSize:"itemSize",scrollSeekConfiguration:"scrollSeekConfiguration",headerFooterTag:"headerFooterTag",data:"data",initialItemCount:"initialItemCount",initialScrollTop:"initialScrollTop",alignToBottom:"alignToBottom",useWindowScroll:"useWindowScroll",customScrollParent:"customScrollParent",scrollerRef:"scrollerRef",logLevel:"logLevel"},methods:{scrollToIndex:"scrollToIndex",scrollIntoView:"scrollIntoView",scrollTo:"scrollTo",scrollBy:"scrollBy",autoscrollToBottom:"autoscrollToBottom",getState:"getState"},events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange",totalListHeightChanged:"totalListHeightChanged",itemsRendered:"itemsRendered",groupIndices:"groupIndices"}},Wre),Gre=A8({usePublisher:yo,useEmitterValue:Rt,useEmitter:Hy}),Kre=T8({usePublisher:yo,useEmitterValue:Rt,useEmitter:Hy}),qre=Ure,zj={items:[],offsetBottom:0,offsetTop:0,top:0,bottom:0,itemHeight:0,itemWidth:0},Xre={items:[{index:0}],offsetBottom:0,offsetTop:0,top:0,bottom:0,itemHeight:0,itemWidth:0},{round:Fj,ceil:Bj,floor:ih,min:Wv,max:Vu}=Math;function Qre(e){return{...Xre,items:e}}function Hj(e,t,n){return Array.from({length:t-e+1}).map((r,o)=>{const s=n===null?null:n[o+e];return{index:o+e,data:s}})}function Yre(e,t){return e&&e.column===t.column&&e.row===t.row}function Ep(e,t){return e&&e.width===t.width&&e.height===t.height}const Zre=qt(([{overscan:e,visibleRange:t,listBoundary:n},{scrollTop:r,viewportHeight:o,scrollBy:s,scrollTo:i,smoothScrollTargetReached:l,scrollContainerState:u,footerHeight:p,headerHeight:m},h,g,{propsReady:x,didMount:y},{windowViewportRect:b,useWindowScroll:w,customScrollParent:S,windowScrollContainerState:j,windowScrollTo:_},E])=>{const I=Ve(0),M=Ve(0),R=Ve(zj),D=Ve({height:0,width:0}),A=Ve({height:0,width:0}),O=Tt(),T=Tt(),X=Ve(0),B=Ve(null),V=Ve({row:0,column:0}),U=Tt(),N=Tt(),$=Ve(!1),q=Ve(0),F=Ve(!0),Q=Ve(!1);Yt(Pe(y,_t(q),gt(([K,ee])=>!!ee)),()=>{wt(F,!1),wt(M,0)}),Yt(Pe(Qn(y,F,A,D,q,Q),gt(([K,ee,le,J,,ie])=>K&&!ee&&le.height!==0&&J.height!==0&&!ie)),([,,,,K])=>{wt(Q,!0),Ly(1,()=>{wt(O,K)}),ca(Pe(r),()=>{wt(n,[0,0]),wt(F,!0)})}),st(Pe(N,gt(K=>K!=null&&K.scrollTop>0),qs(0)),M),Yt(Pe(y,_t(N),gt(([,K])=>K!=null)),([,K])=>{K&&(wt(D,K.viewport),wt(A,K==null?void 0:K.item),wt(V,K.gap),K.scrollTop>0&&(wt($,!0),ca(Pe(r,Pc(1)),ee=>{wt($,!1)}),wt(i,{top:K.scrollTop})))}),st(Pe(D,Xe(({height:K})=>K)),o),st(Pe(Qn(ht(D,Ep),ht(A,Ep),ht(V,(K,ee)=>K&&K.column===ee.column&&K.row===ee.row),ht(r)),Xe(([K,ee,le,J])=>({viewport:K,item:ee,gap:le,scrollTop:J}))),U),st(Pe(Qn(ht(I),t,ht(V,Yre),ht(A,Ep),ht(D,Ep),ht(B),ht(M),ht($),ht(F),ht(q)),gt(([,,,,,,,K])=>!K),Xe(([K,[ee,le],J,ie,de,ge,Ce,,he,fe])=>{const{row:Oe,column:_e}=J,{height:Ne,width:nt}=ie,{width:$e}=de;if(Ce===0&&(K===0||$e===0))return zj;if(nt===0){const lt=zy(fe,K),ft=lt===0?Math.max(Ce-1,0):lt;return Qre(Hj(lt,ft,ge))}const Pt=N8($e,nt,_e);let Ze,ot;he?ee===0&&le===0&&Ce>0?(Ze=0,ot=Ce-1):(Ze=Pt*ih((ee+Oe)/(Ne+Oe)),ot=Pt*Bj((le+Oe)/(Ne+Oe))-1,ot=Wv(K-1,Vu(ot,Pt-1)),Ze=Wv(ot,Vu(0,Ze))):(Ze=0,ot=-1);const ye=Hj(Ze,ot,ge),{top:De,bottom:ut}=Vj(de,J,ie,ye),bt=Bj(K/Pt),Je=bt*Ne+(bt-1)*Oe-ut;return{items:ye,offsetTop:De,offsetBottom:Je,top:De,bottom:ut,itemHeight:Ne,itemWidth:nt}})),R),st(Pe(B,gt(K=>K!==null),Xe(K=>K.length)),I),st(Pe(Qn(D,A,R,V),gt(([K,ee,{items:le}])=>le.length>0&&ee.height!==0&&K.height!==0),Xe(([K,ee,{items:le},J])=>{const{top:ie,bottom:de}=Vj(K,J,ee,le);return[ie,de]}),fn(pd)),n);const Y=Ve(!1);st(Pe(r,_t(Y),Xe(([K,ee])=>ee||K!==0)),Y);const se=Jr(Pe(ht(R),gt(({items:K})=>K.length>0),_t(I,Y),gt(([{items:K},ee,le])=>le&&K[K.length-1].index===ee-1),Xe(([,K])=>K-1),fn())),ae=Jr(Pe(ht(R),gt(({items:K})=>K.length>0&&K[0].index===0),qs(0),fn())),re=Jr(Pe(ht(R),_t($),gt(([{items:K},ee])=>K.length>0&&!ee),Xe(([{items:K}])=>({startIndex:K[0].index,endIndex:K[K.length-1].index})),fn(j8),Ga(0)));st(re,g.scrollSeekRangeChanged),st(Pe(O,_t(D,A,I,V),Xe(([K,ee,le,J,ie])=>{const de=S8(K),{align:ge,behavior:Ce,offset:he}=de;let fe=de.index;fe==="LAST"&&(fe=J-1),fe=Vu(0,fe,Wv(J-1,fe));let Oe=yx(ee,ie,le,fe);return ge==="end"?Oe=Fj(Oe-ee.height+le.height):ge==="center"&&(Oe=Fj(Oe-ee.height/2+le.height/2)),he&&(Oe+=he),{top:Oe,behavior:Ce}})),i);const G=yr(Pe(R,Xe(K=>K.offsetBottom+K.bottom)),0);return st(Pe(b,Xe(K=>({width:K.visibleWidth,height:K.visibleHeight}))),D),{data:B,totalCount:I,viewportDimensions:D,itemDimensions:A,scrollTop:r,scrollHeight:T,overscan:e,scrollBy:s,scrollTo:i,scrollToIndex:O,smoothScrollTargetReached:l,windowViewportRect:b,windowScrollTo:_,useWindowScroll:w,customScrollParent:S,windowScrollContainerState:j,deviation:X,scrollContainerState:u,footerHeight:p,headerHeight:m,initialItemCount:M,gap:V,restoreStateFrom:N,...g,initialTopMostItemIndex:q,gridState:R,totalListHeight:G,...h,startReached:ae,endReached:se,rangeChanged:re,stateChanged:U,propsReady:x,stateRestoreInProgress:$,...E}},hn(Fy,Sr,Qd,_8,fi,By,di));function Vj(e,t,n,r){const{height:o}=n;if(o===void 0||r.length===0)return{top:0,bottom:0};const s=yx(e,t,n,r[0].index),i=yx(e,t,n,r[r.length-1].index)+o;return{top:s,bottom:i}}function yx(e,t,n,r){const o=N8(e.width,n.width,t.column),s=ih(r/o),i=s*n.height+Vu(0,s-1)*t.row;return i>0?i+t.row:i}function N8(e,t,n){return Vu(1,ih((e+n)/(ih(t)+n)))}const Jre=qt(()=>{const e=Ve(p=>`Item ${p}`),t=Ve({}),n=Ve(null),r=Ve("virtuoso-grid-item"),o=Ve("virtuoso-grid-list"),s=Ve(D8),i=Ve("div"),l=Ve(Uc),u=(p,m=null)=>yr(Pe(t,Xe(h=>h[p]),fn()),m);return{context:n,itemContent:e,components:t,computeItemKey:s,itemClassName:r,listClassName:o,headerFooterTag:i,scrollerRef:l,FooterComponent:u("Footer"),HeaderComponent:u("Header"),ListComponent:u("List","div"),ItemComponent:u("Item","div"),ScrollerComponent:u("Scroller","div"),ScrollSeekPlaceholder:u("ScrollSeekPlaceholder","div")}}),eoe=qt(([e,t])=>({...e,...t}),hn(Zre,Jre)),toe=H.memo(function(){const t=yn("gridState"),n=yn("listClassName"),r=yn("itemClassName"),o=yn("itemContent"),s=yn("computeItemKey"),i=yn("isSeeking"),l=qo("scrollHeight"),u=yn("ItemComponent"),p=yn("ListComponent"),m=yn("ScrollSeekPlaceholder"),h=yn("context"),g=qo("itemDimensions"),x=qo("gap"),y=yn("log"),b=yn("stateRestoreInProgress"),w=ll(S=>{const j=S.parentElement.parentElement.scrollHeight;l(j);const _=S.firstChild;if(_){const{width:E,height:I}=_.getBoundingClientRect();g({width:E,height:I})}x({row:Wj("row-gap",getComputedStyle(S).rowGap,y),column:Wj("column-gap",getComputedStyle(S).columnGap,y)})});return b?null:H.createElement(p,{ref:w,className:n,...Rr(p,h),style:{paddingTop:t.offsetTop,paddingBottom:t.offsetBottom},"data-test-id":"virtuoso-item-list"},t.items.map(S=>{const j=s(S.index,S.data,h);return i?H.createElement(m,{key:j,...Rr(m,h),index:S.index,height:t.itemHeight,width:t.itemWidth}):H.createElement(u,{...Rr(u,h),className:r,"data-index":S.index,key:j},o(S.index,S.data,h))}))}),noe=H.memo(function(){const t=yn("HeaderComponent"),n=qo("headerHeight"),r=yn("headerFooterTag"),o=ll(i=>n(ri(i,"height"))),s=yn("context");return t?H.createElement(r,{ref:o},H.createElement(t,Rr(t,s))):null}),roe=H.memo(function(){const t=yn("FooterComponent"),n=qo("footerHeight"),r=yn("headerFooterTag"),o=ll(i=>n(ri(i,"height"))),s=yn("context");return t?H.createElement(r,{ref:o},H.createElement(t,Rr(t,s))):null}),ooe=({children:e})=>{const t=H.useContext(R8),n=qo("itemDimensions"),r=qo("viewportDimensions"),o=ll(s=>{r(s.getBoundingClientRect())});return H.useEffect(()=>{t&&(r({height:t.viewportHeight,width:t.viewportWidth}),n({height:t.itemHeight,width:t.itemWidth}))},[t,r,n]),H.createElement("div",{style:wg,ref:o},e)},soe=({children:e})=>{const t=H.useContext(R8),n=qo("windowViewportRect"),r=qo("itemDimensions"),o=yn("customScrollParent"),s=M8(n,o);return H.useEffect(()=>{t&&(r({height:t.itemHeight,width:t.itemWidth}),n({offsetTop:0,visibleHeight:t.viewportHeight,visibleWidth:t.viewportWidth}))},[t,n,r]),H.createElement("div",{ref:s,style:wg},e)},aoe=H.memo(function({...t}){const n=yn("useWindowScroll"),r=yn("customScrollParent"),o=r||n?coe:loe,s=r||n?soe:ooe;return H.createElement(o,{...t},H.createElement(s,null,H.createElement(noe,null),H.createElement(toe,null),H.createElement(roe,null)))}),{Component:ioe,usePublisher:qo,useEmitterValue:yn,useEmitter:$8}=f8(eoe,{optional:{context:"context",totalCount:"totalCount",overscan:"overscan",itemContent:"itemContent",components:"components",computeItemKey:"computeItemKey",data:"data",initialItemCount:"initialItemCount",scrollSeekConfiguration:"scrollSeekConfiguration",headerFooterTag:"headerFooterTag",listClassName:"listClassName",itemClassName:"itemClassName",useWindowScroll:"useWindowScroll",customScrollParent:"customScrollParent",scrollerRef:"scrollerRef",logLevel:"logLevel",restoreStateFrom:"restoreStateFrom",initialTopMostItemIndex:"initialTopMostItemIndex"},methods:{scrollTo:"scrollTo",scrollBy:"scrollBy",scrollToIndex:"scrollToIndex"},events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange",stateChanged:"stateChanged"}},aoe),loe=A8({usePublisher:qo,useEmitterValue:yn,useEmitter:$8}),coe=T8({usePublisher:qo,useEmitterValue:yn,useEmitter:$8});function Wj(e,t,n){return t!=="normal"&&!(t!=null&&t.endsWith("px"))&&n(`${e} was not resolved to pixel value correctly`,t,eo.WARN),t==="normal"?0:parseInt(t??"0",10)}const uoe=ioe,doe=e=>{const t=W(s=>s.gallery.galleryView),{data:n}=cI(e),{data:r}=uI(e),o=d.useMemo(()=>t==="images"?n:r,[t,r,n]);return{totalImages:n,totalAssets:r,currentViewTotal:o}},foe=({imageDTO:e})=>a.jsx(L,{sx:{pointerEvents:"none",flexDirection:"column",position:"absolute",top:0,insetInlineStart:0,p:2,alignItems:"flex-start",gap:2},children:a.jsxs(Ds,{variant:"solid",colorScheme:"base",children:[e.width," × ",e.height]})}),poe=d.memo(foe),Vy=({postUploadAction:e,isDisabled:t})=>{const n=W(u=>u.gallery.autoAddBoardId),[r]=nI(),o=d.useCallback(u=>{const p=u[0];p&&r({file:p,image_category:"user",is_intermediate:!1,postUploadAction:e??{type:"TOAST"},board_id:n==="none"?void 0:n})},[n,e,r]),{getRootProps:s,getInputProps:i,open:l}=Qb({accept:{"image/png":[".png"],"image/jpeg":[".jpg",".jpeg",".png"]},onDropAccepted:o,disabled:t,noDrag:!0,multiple:!1});return{getUploadButtonProps:s,getUploadInputProps:i,openUploader:l}},moe=ce(xe,({generation:e})=>{const{model:t}=e;return{model:t}}),Sg=()=>{const e=te(),t=sl(),{t:n}=Z(),{model:r}=W(moe),o=d.useCallback(()=>{t({title:n("toast.parameterSet"),status:"info",duration:2500,isClosable:!0})},[n,t]),s=d.useCallback(N=>{t({title:n("toast.parameterNotSet"),description:N,status:"warning",duration:2500,isClosable:!0})},[n,t]),i=d.useCallback(()=>{t({title:n("toast.parametersSet"),status:"info",duration:2500,isClosable:!0})},[n,t]),l=d.useCallback(N=>{t({title:n("toast.parametersNotSet"),status:"warning",description:N,duration:2500,isClosable:!0})},[n,t]),u=d.useCallback((N,$,q,F)=>{if(qf(N)||Xf($)||bu(q)||Q0(F)){qf(N)&&e(Nu(N)),Xf($)&&e($u($)),bu(q)&&e(Lu(q)),bu(F)&&e(zu(F)),o();return}s()},[e,o,s]),p=d.useCallback(N=>{if(!qf(N)){s();return}e(Nu(N)),o()},[e,o,s]),m=d.useCallback(N=>{if(!Xf(N)){s();return}e($u(N)),o()},[e,o,s]),h=d.useCallback(N=>{if(!bu(N)){s();return}e(Lu(N)),o()},[e,o,s]),g=d.useCallback(N=>{if(!Q0(N)){s();return}e(zu(N)),o()},[e,o,s]),x=d.useCallback(N=>{if(!sw(N)){s();return}e(Xp(N)),o()},[e,o,s]),y=d.useCallback(N=>{if(!Y0(N)){s();return}e(Qp(N)),o()},[e,o,s]),b=d.useCallback(N=>{if(!aw(N)){s();return}e(i1(N)),o()},[e,o,s]),w=d.useCallback(N=>{if(!Z0(N)){s();return}e(l1(N)),o()},[e,o,s]),S=d.useCallback(N=>{if(!J0(N)){s();return}e(Yp(N)),o()},[e,o,s]),j=d.useCallback(N=>{if(!iw(N)){s();return}e(Bi(N)),o()},[e,o,s]),_=d.useCallback(N=>{if(!lw(N)){s();return}e(Hi(N)),o()},[e,o,s]),E=d.useCallback(N=>{if(!cw(N)){s();return}e(Zp(N)),o()},[e,o,s]),{loras:I}=Cd(void 0,{selectFromResult:N=>({loras:N.data?MD.getSelectors().selectAll(N.data):[]})}),M=d.useCallback(N=>{if(!fI(N.lora))return{lora:null,error:"Invalid LoRA model"};const{base_model:$,model_name:q}=N.lora,F=I.find(Y=>Y.base_model===$&&Y.model_name===q);return F?(F==null?void 0:F.base_model)===(r==null?void 0:r.base_model)?{lora:F,error:null}:{lora:null,error:"LoRA incompatible with currently-selected model"}:{lora:null,error:"LoRA model is not installed"}},[I,r==null?void 0:r.base_model]),R=d.useCallback(N=>{const $=M(N);if(!$.lora){s($.error);return}e(uw({...$.lora,weight:N.weight})),o()},[M,e,o,s]),{controlnets:D}=gh(void 0,{selectFromResult:N=>({controlnets:N.data?OD.getSelectors().selectAll(N.data):[]})}),A=d.useCallback(N=>{if(!c1(N.control_model))return{controlnet:null,error:"Invalid ControlNet model"};const{image:$,control_model:q,control_weight:F,begin_step_percent:Q,end_step_percent:Y,control_mode:se,resize_mode:ae}=N,re=D.find(ie=>ie.base_model===q.base_model&&ie.model_name===q.model_name);if(!re)return{controlnet:null,error:"ControlNet model is not installed"};if(!((re==null?void 0:re.base_model)===(r==null?void 0:r.base_model)))return{controlnet:null,error:"ControlNet incompatible with currently-selected model"};const K=Zs();let ee=Ta.processorType;for(const ie in dw)if(re.model_name.includes(ie)){ee=dw[ie]||Ta.processorType;break}const le=Fr[ee].default;return{controlnet:{isEnabled:!0,model:re,weight:typeof F=="number"?F:Ta.weight,beginStepPct:Q||Ta.beginStepPct,endStepPct:Y||Ta.endStepPct,controlMode:se||Ta.controlMode,resizeMode:ae||Ta.resizeMode,controlImage:($==null?void 0:$.image_name)||null,processedControlImage:($==null?void 0:$.image_name)||null,processorType:ee,processorNode:le.type!=="none"?le:Ta.processorNode,shouldAutoConfig:!0,controlNetId:K},error:null}},[D,r==null?void 0:r.base_model]),O=d.useCallback(N=>{const $=A(N);if(!$.controlnet){s($.error);return}e(fw({...$.controlnet})),o()},[A,e,o,s]),{ipAdapters:T}=Vx(void 0,{selectFromResult:N=>({ipAdapters:N.data?RD.getSelectors().selectAll(N.data):[]})}),X=d.useCallback(N=>{if(!DD(N==null?void 0:N.ip_adapter_model))return{ipAdapter:null,error:"Invalid IP Adapter model"};const{image:$,ip_adapter_model:q,weight:F,begin_step_percent:Q,end_step_percent:Y}=N,se=T.find(G=>G.base_model===(q==null?void 0:q.base_model)&&G.model_name===(q==null?void 0:q.model_name));return se?(se==null?void 0:se.base_model)===(r==null?void 0:r.base_model)?{ipAdapter:{adapterImage:($==null?void 0:$.image_name)??null,model:se,weight:F??ev.weight,beginStepPct:Q??ev.beginStepPct,endStepPct:Y??ev.endStepPct},error:null}:{ipAdapter:null,error:"IP Adapter incompatible with currently-selected model"}:{ipAdapter:null,error:"IP Adapter model is not installed"}},[T,r==null?void 0:r.base_model]),B=d.useCallback(N=>{const $=X(N);if(!$.ipAdapter){s($.error);return}e(pw({...$.ipAdapter})),e(u1(!0)),o()},[X,e,o,s]),V=d.useCallback(N=>{e(vh(N))},[e]),U=d.useCallback(N=>{if(!N){l();return}const{cfg_scale:$,height:q,model:F,positive_prompt:Q,negative_prompt:Y,scheduler:se,seed:ae,steps:re,width:G,strength:K,positive_style_prompt:ee,negative_style_prompt:le,refiner_model:J,refiner_cfg_scale:ie,refiner_steps:de,refiner_scheduler:ge,refiner_positive_aesthetic_score:Ce,refiner_negative_aesthetic_score:he,refiner_start:fe,loras:Oe,controlnets:_e,ipAdapters:Ne}=N;Y0($)&&e(Qp($)),aw(F)&&e(i1(F)),qf(Q)&&e(Nu(Q)),Xf(Y)&&e($u(Y)),Z0(se)&&e(l1(se)),sw(ae)&&e(Xp(ae)),J0(re)&&e(Yp(re)),iw(G)&&e(Bi(G)),lw(q)&&e(Hi(q)),cw(K)&&e(Zp(K)),bu(ee)&&e(Lu(ee)),Q0(le)&&e(zu(le)),AD(J)&&e(pI(J)),J0(de)&&e(d1(de)),Y0(ie)&&e(f1(ie)),Z0(ge)&&e(mI(ge)),TD(Ce)&&e(p1(Ce)),ND(he)&&e(m1(he)),$D(fe)&&e(h1(fe)),e(LD()),Oe==null||Oe.forEach(nt=>{const $e=M(nt);$e.lora&&e(uw({...$e.lora,weight:nt.weight}))}),e(sI()),_e!=null&&_e.length&&e(zD()),_e==null||_e.forEach(nt=>{const $e=A(nt);$e.controlnet&&e(fw($e.controlnet))}),Ne!=null&&Ne.length&&e(u1(!0)),Ne==null||Ne.forEach(nt=>{const $e=X(nt);$e.ipAdapter&&e(pw($e.ipAdapter))}),i()},[l,i,e,M,A,X]);return{recallBothPrompts:u,recallPositivePrompt:p,recallNegativePrompt:m,recallSDXLPositiveStylePrompt:h,recallSDXLNegativeStylePrompt:g,recallSeed:x,recallCfgScale:y,recallModel:b,recallScheduler:w,recallSteps:S,recallWidth:j,recallHeight:_,recallStrength:E,recallLoRA:R,recallControlNet:O,recallIPAdapter:B,recallAllParameters:U,sendToImageToImage:V}},L8=()=>{const e=sl(),{t}=Z(),n=d.useMemo(()=>!!navigator.clipboard&&!!window.ClipboardItem,[]),r=d.useCallback(async o=>{n||e({title:t("toast.problemCopyingImage"),description:"Your browser doesn't support the Clipboard API.",status:"error",duration:2500,isClosable:!0});try{FD((async()=>await(await fetch(o)).blob())()),e({title:t("toast.imageCopied"),status:"success",duration:2500,isClosable:!0})}catch(s){e({title:t("toast.problemCopyingImage"),description:String(s),status:"error",duration:2500,isClosable:!0})}},[n,t,e]);return{isClipboardAPIAvailable:n,copyImageToClipboard:r}};function hoe(e){return Te({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M125.7 160H176c17.7 0 32 14.3 32 32s-14.3 32-32 32H48c-17.7 0-32-14.3-32-32V64c0-17.7 14.3-32 32-32s32 14.3 32 32v51.2L97.6 97.6c87.5-87.5 229.3-87.5 316.8 0s87.5 229.3 0 316.8s-229.3 87.5-316.8 0c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0c62.5 62.5 163.8 62.5 226.3 0s62.5-163.8 0-226.3s-163.8-62.5-226.3 0L125.7 160z"}}]})(e)}function goe(e){return Te({tag:"svg",attr:{viewBox:"0 0 384 512"},child:[{tag:"path",attr:{d:"M0 256L28.5 28c2-16 15.6-28 31.8-28H228.9c15 0 27.1 12.1 27.1 27.1c0 3.2-.6 6.5-1.7 9.5L208 160H347.3c20.2 0 36.7 16.4 36.7 36.7c0 7.4-2.2 14.6-6.4 20.7l-192.2 281c-5.9 8.6-15.6 13.7-25.9 13.7h-2.9c-15.7 0-28.5-12.8-28.5-28.5c0-2.3 .3-4.6 .9-6.9L176 288H32c-17.7 0-32-14.3-32-32z"}}]})(e)}function voe(e){return Te({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M256 512A256 256 0 1 0 256 0a256 256 0 1 0 0 512zm0-384c13.3 0 24 10.7 24 24V264c0 13.3-10.7 24-24 24s-24-10.7-24-24V152c0-13.3 10.7-24 24-24zM224 352a32 32 0 1 1 64 0 32 32 0 1 1 -64 0z"}}]})(e)}function Wy(e){return Te({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M418.4 157.9c35.3-8.3 61.6-40 61.6-77.9c0-44.2-35.8-80-80-80c-43.4 0-78.7 34.5-80 77.5L136.2 151.1C121.7 136.8 101.9 128 80 128c-44.2 0-80 35.8-80 80s35.8 80 80 80c12.2 0 23.8-2.7 34.1-7.6L259.7 407.8c-2.4 7.6-3.7 15.8-3.7 24.2c0 44.2 35.8 80 80 80s80-35.8 80-80c0-27.7-14-52.1-35.4-66.4l37.8-207.7zM156.3 232.2c2.2-6.9 3.5-14.2 3.7-21.7l183.8-73.5c3.6 3.5 7.4 6.7 11.6 9.5L317.6 354.1c-5.5 1.3-10.8 3.1-15.8 5.5L156.3 232.2z"}}]})(e)}function xoe(e){return Te({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M8 256a56 56 0 1 1 112 0A56 56 0 1 1 8 256zm160 0a56 56 0 1 1 112 0 56 56 0 1 1 -112 0zm216-56a56 56 0 1 1 0 112 56 56 0 1 1 0-112z"}}]})(e)}function boe(e){return Te({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M416 208c0 45.9-14.9 88.3-40 122.7L502.6 457.4c12.5 12.5 12.5 32.8 0 45.3s-32.8 12.5-45.3 0L330.7 376c-34.4 25.2-76.8 40-122.7 40C93.1 416 0 322.9 0 208S93.1 0 208 0S416 93.1 416 208zM136 184c-13.3 0-24 10.7-24 24s10.7 24 24 24H280c13.3 0 24-10.7 24-24s-10.7-24-24-24H136z"}}]})(e)}function yoe(e){return Te({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M416 208c0 45.9-14.9 88.3-40 122.7L502.6 457.4c12.5 12.5 12.5 32.8 0 45.3s-32.8 12.5-45.3 0L330.7 376c-34.4 25.2-76.8 40-122.7 40C93.1 416 0 322.9 0 208S93.1 0 208 0S416 93.1 416 208zM184 296c0 13.3 10.7 24 24 24s24-10.7 24-24V232h64c13.3 0 24-10.7 24-24s-10.7-24-24-24H232V120c0-13.3-10.7-24-24-24s-24 10.7-24 24v64H120c-13.3 0-24 10.7-24 24s10.7 24 24 24h64v64z"}}]})(e)}function Coe(e){return Te({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0V0z"}},{tag:"path",attr:{d:"M17 16l-4-4V8.82C14.16 8.4 15 7.3 15 6c0-1.66-1.34-3-3-3S9 4.34 9 6c0 1.3.84 2.4 2 2.82V12l-4 4H3v5h5v-3.05l4-4.2 4 4.2V21h5v-5h-4z"}}]})(e)}function woe(e){return Te({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M20 2H4c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zM8 20H4v-4h4v4zm0-6H4v-4h4v4zm0-6H4V4h4v4zm6 12h-4v-4h4v4zm0-6h-4v-4h4v4zm0-6h-4V4h4v4zm6 12h-4v-4h4v4zm0-6h-4v-4h4v4zm0-6h-4V4h4v4z"}}]})(e)}function Soe(e){return Te({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M22 16V4c0-1.1-.9-2-2-2H8c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2zm-11-4l2.03 2.71L16 11l4 5H8l3-4zM2 6v14c0 1.1.9 2 2 2h14v-2H4V6H2z"}}]})(e)}function Uy(e){return Te({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M22 9.24l-7.19-.62L12 2 9.19 8.63 2 9.24l5.46 4.73L5.82 21 12 17.27 18.18 21l-1.63-7.03L22 9.24zM12 15.4l-3.76 2.27 1-4.28-3.32-2.88 4.38-.38L12 6.1l1.71 4.04 4.38.38-3.32 2.88 1 4.28L12 15.4z"}}]})(e)}function Gy(e){return Te({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M12 17.27L18.18 21l-1.64-7.03L22 9.24l-7.19-.61L12 2 9.19 8.63 2 9.24l5.46 4.73L5.82 21z"}}]})(e)}function z8(e){return Te({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0V0z"}},{tag:"path",attr:{d:"M16 17.01V10h-2v7.01h-3L15 21l4-3.99h-3zM9 3L5 6.99h3V14h2V6.99h3L9 3zm7 14.01V10h-2v7.01h-3L15 21l4-3.99h-3zM9 3L5 6.99h3V14h2V6.99h3L9 3z"}}]})(e)}const Ky=e=>e.config;Wx("gallery/requestedBoardImagesDeletion");const koe=Wx("gallery/sentImageToCanvas"),F8=Wx("gallery/sentImageToImg2Img"),joe=e=>{const{imageDTO:t}=e,n=te(),{t:r}=Z(),o=sl(),s=Bt("unifiedCanvas").isFeatureEnabled,{shouldFetchMetadataFromApi:i}=W(Ky),l=Jh(Ux),{metadata:u,workflow:p,isLoading:m}=Gx({image:t,shouldFetchMetadataFromApi:i},{selectFromResult:B=>{var V,U;return{isLoading:B.isFetching,metadata:(V=B==null?void 0:B.currentData)==null?void 0:V.metadata,workflow:(U=B==null?void 0:B.currentData)==null?void 0:U.workflow}}}),[h]=Kx(),[g]=qx(),{isClipboardAPIAvailable:x,copyImageToClipboard:y}=L8(),b=d.useCallback(()=>{t&&n(xh([t]))},[n,t]),{recallBothPrompts:w,recallSeed:S,recallAllParameters:j}=Sg(),_=d.useCallback(()=>{w(u==null?void 0:u.positive_prompt,u==null?void 0:u.negative_prompt,u==null?void 0:u.positive_style_prompt,u==null?void 0:u.negative_style_prompt)},[u==null?void 0:u.negative_prompt,u==null?void 0:u.positive_prompt,u==null?void 0:u.positive_style_prompt,u==null?void 0:u.negative_style_prompt,w]),E=d.useCallback(()=>{S(u==null?void 0:u.seed)},[u==null?void 0:u.seed,S]),I=d.useCallback(()=>{p&&n(Xx(p))},[n,p]),M=d.useCallback(()=>{n(F8()),n(vh(t))},[n,t]),R=d.useCallback(()=>{n(koe()),qr.flushSync(()=>{n(Xs("unifiedCanvas"))}),n(hI(t)),o({title:r("toast.sentToUnifiedCanvas"),status:"success",duration:2500,isClosable:!0})},[n,t,r,o]),D=d.useCallback(()=>{j(u)},[u,j]),A=d.useCallback(()=>{n(gI([t])),n(Bx(!0))},[n,t]),O=d.useCallback(()=>{y(t.image_url)},[y,t.image_url]),T=d.useCallback(()=>{t&&h({imageDTOs:[t]})},[h,t]),X=d.useCallback(()=>{t&&g({imageDTOs:[t]})},[g,t]);return a.jsxs(a.Fragment,{children:[a.jsx(en,{as:"a",href:t.image_url,target:"_blank",icon:a.jsx(py,{}),children:r("common.openInNewTab")}),x&&a.jsx(en,{icon:a.jsx(Hc,{}),onClickCapture:O,children:r("parameters.copyImage")}),a.jsx(en,{as:"a",download:!0,href:t.image_url,target:"_blank",icon:a.jsx(ig,{}),w:"100%",children:r("parameters.downloadImage")}),a.jsx(en,{icon:m?a.jsx(Mp,{}):a.jsx(Wy,{}),onClickCapture:I,isDisabled:m||!p,children:r("nodes.loadWorkflow")}),a.jsx(en,{icon:m?a.jsx(Mp,{}):a.jsx(gM,{}),onClickCapture:_,isDisabled:m||(u==null?void 0:u.positive_prompt)===void 0&&(u==null?void 0:u.negative_prompt)===void 0,children:r("parameters.usePrompt")}),a.jsx(en,{icon:m?a.jsx(Mp,{}):a.jsx(vM,{}),onClickCapture:E,isDisabled:m||(u==null?void 0:u.seed)===void 0,children:r("parameters.useSeed")}),a.jsx(en,{icon:m?a.jsx(Mp,{}):a.jsx(aM,{}),onClickCapture:D,isDisabled:m||!u,children:r("parameters.useAll")}),a.jsx(en,{icon:a.jsx(qk,{}),onClickCapture:M,id:"send-to-img2img",children:r("parameters.sendToImg2Img")}),s&&a.jsx(en,{icon:a.jsx(qk,{}),onClickCapture:R,id:"send-to-canvas",children:r("parameters.sendToUnifiedCanvas")}),a.jsx(en,{icon:a.jsx(dM,{}),onClickCapture:A,children:"Change Board"}),t.starred?a.jsx(en,{icon:l?l.off.icon:a.jsx(Gy,{}),onClickCapture:X,children:l?l.off.text:"Unstar Image"}):a.jsx(en,{icon:l?l.on.icon:a.jsx(Uy,{}),onClickCapture:T,children:l?l.on.text:"Star Image"}),a.jsx(en,{sx:{color:"error.600",_dark:{color:"error.300"}},icon:a.jsx(Br,{}),onClickCapture:b,children:r("gallery.deleteImage")})]})},B8=d.memo(joe),Mp=()=>a.jsx(L,{w:"14px",alignItems:"center",justifyContent:"center",children:a.jsx(fa,{size:"xs"})}),_oe=()=>{const e=te(),t=W(h=>h.gallery.selection),n=Jh(Ux),[r]=Kx(),[o]=qx(),s=d.useCallback(()=>{e(gI(t)),e(Bx(!0))},[e,t]),i=d.useCallback(()=>{e(xh(t))},[e,t]),l=d.useCallback(()=>{r({imageDTOs:t})},[r,t]),u=d.useCallback(()=>{o({imageDTOs:t})},[o,t]),p=d.useMemo(()=>t.every(h=>h.starred),[t]),m=d.useMemo(()=>t.every(h=>!h.starred),[t]);return a.jsxs(a.Fragment,{children:[p&&a.jsx(en,{icon:n?n.on.icon:a.jsx(Uy,{}),onClickCapture:u,children:n?n.off.text:"Unstar All"}),(m||!p&&!m)&&a.jsx(en,{icon:n?n.on.icon:a.jsx(Gy,{}),onClickCapture:l,children:n?n.on.text:"Star All"}),a.jsx(en,{icon:a.jsx(dM,{}),onClickCapture:s,children:"Change Board"}),a.jsx(en,{sx:{color:"error.600",_dark:{color:"error.300"}},icon:a.jsx(Br,{}),onClickCapture:i,children:"Delete Selection"})]})},Ioe=d.memo(_oe),Poe=ce([xe],({gallery:e})=>({selectionCount:e.selection.length}),je),Eoe=({imageDTO:e,children:t})=>{const{selectionCount:n}=W(Poe),r=d.useCallback(o=>{o.preventDefault()},[]);return a.jsx(Ry,{menuProps:{size:"sm",isLazy:!0},menuButtonProps:{bg:"transparent",_hover:{bg:"transparent"}},renderMenu:()=>e?n>1?a.jsx(Ui,{sx:{visibility:"visible !important"},motionProps:vc,onContextMenu:r,children:a.jsx(Ioe,{})}):a.jsx(Ui,{sx:{visibility:"visible !important"},motionProps:vc,onContextMenu:r,children:a.jsx(B8,{imageDTO:e})}):null,children:t})},Moe=d.memo(Eoe),Ooe=e=>{const{data:t,disabled:n,...r}=e,o=d.useRef(Zs()),{attributes:s,listeners:i,setNodeRef:l}=ine({id:o.current,disabled:n,data:t});return a.jsx(Ie,{ref:l,position:"absolute",w:"full",h:"full",top:0,insetInlineStart:0,...s,...i,...r})},Roe=d.memo(Ooe),Doe=a.jsx(Tn,{as:cg,sx:{boxSize:16}}),Aoe=a.jsx(Zn,{icon:Qi}),Toe=e=>{const{imageDTO:t,onError:n,onClick:r,withMetadataOverlay:o=!1,isDropDisabled:s=!1,isDragDisabled:i=!1,isUploadDisabled:l=!1,minSize:u=24,postUploadAction:p,imageSx:m,fitContainer:h=!1,droppableData:g,draggableData:x,dropLabel:y,isSelected:b=!1,thumbnail:w=!1,noContentFallback:S=Aoe,uploadElement:j=Doe,useThumbailFallback:_,withHoverOverlay:E=!1,children:I,onMouseOver:M,onMouseOut:R,dataTestId:D}=e,{colorMode:A}=ha(),[O,T]=d.useState(!1),X=d.useCallback($=>{M&&M($),T(!0)},[M]),B=d.useCallback($=>{R&&R($),T(!1)},[R]),{getUploadButtonProps:V,getUploadInputProps:U}=Vy({postUploadAction:p,isDisabled:l}),N=l?{}:{cursor:"pointer",bg:Ae("base.200","base.700")(A),_hover:{bg:Ae("base.300","base.650")(A),color:Ae("base.500","base.300")(A)}};return a.jsx(Moe,{imageDTO:t,children:$=>a.jsxs(L,{ref:$,onMouseOver:X,onMouseOut:B,sx:{width:"full",height:"full",alignItems:"center",justifyContent:"center",position:"relative",minW:u||void 0,minH:u||void 0,userSelect:"none",cursor:i||!t?"default":"pointer"},children:[t&&a.jsxs(L,{sx:{w:"full",h:"full",position:h?"absolute":"relative",alignItems:"center",justifyContent:"center"},children:[a.jsx(ga,{src:w?t.thumbnail_url:t.image_url,fallbackStrategy:"beforeLoadOrError",fallbackSrc:_?t.thumbnail_url:void 0,fallback:_?void 0:a.jsx(Nne,{image:t}),onError:n,draggable:!1,sx:{w:t.width,objectFit:"contain",maxW:"full",maxH:"full",borderRadius:"base",...m},"data-testid":D}),o&&a.jsx(poe,{imageDTO:t}),a.jsx(Oy,{isSelected:b,isHovered:E?O:!1})]}),!t&&!l&&a.jsx(a.Fragment,{children:a.jsxs(L,{sx:{minH:u,w:"full",h:"full",alignItems:"center",justifyContent:"center",borderRadius:"base",transitionProperty:"common",transitionDuration:"0.1s",color:Ae("base.500","base.500")(A),...N},...V(),children:[a.jsx("input",{...U()}),j]})}),!t&&l&&S,t&&!i&&a.jsx(Roe,{data:x,disabled:i||!t,onClick:r}),I,!s&&a.jsx(My,{data:g,disabled:s,dropLabel:y})]})})},ua=d.memo(Toe),Noe=()=>a.jsx(Gh,{sx:{position:"relative",height:"full",width:"full","::before":{content:"''",display:"block",pt:"100%"}},children:a.jsx(Ie,{sx:{position:"absolute",top:0,insetInlineStart:0,height:"full",width:"full"}})}),$oe=d.memo(Noe),Loe=ce([xe,Qx],({gallery:e},t)=>{const n=e.selection;return{queryArgs:t,selection:n}},je),zoe=e=>{const t=te(),{queryArgs:n,selection:r}=W(Loe),{imageDTOs:o}=vI(n,{selectFromResult:p=>({imageDTOs:p.data?BD.selectAll(p.data):[]})}),s=Bt("multiselect").isFeatureEnabled,i=d.useCallback(p=>{var m;if(e){if(!s){t(yu([e]));return}if(p.shiftKey){const h=e.image_name,g=(m=r[r.length-1])==null?void 0:m.image_name,x=o.findIndex(b=>b.image_name===g),y=o.findIndex(b=>b.image_name===h);if(x>-1&&y>-1){const b=Math.min(x,y),w=Math.max(x,y),S=o.slice(b,w+1);t(yu(Kw(r.concat(S))))}}else p.ctrlKey||p.metaKey?r.some(h=>h.image_name===e.image_name)&&r.length>1?t(yu(r.filter(h=>h.image_name!==e.image_name))):t(yu(Kw(r.concat(e)))):t(yu([e]))}},[t,e,o,r,s]),l=d.useMemo(()=>e?r.some(p=>p.image_name===e.image_name):!1,[e,r]),u=d.useMemo(()=>r.length,[r.length]);return{selection:r,selectionCount:u,isSelected:l,handleClick:i}},Foe=e=>{const{onClick:t,tooltip:n,icon:r,styleOverrides:o}=e,s=sa("drop-shadow(0px 0px 0.1rem var(--invokeai-colors-base-600))","drop-shadow(0px 0px 0.1rem var(--invokeai-colors-base-800))");return a.jsx(Fe,{onClick:t,"aria-label":n,tooltip:n,icon:r,size:"sm",variant:"link",sx:{position:"absolute",top:1,insetInlineEnd:1,p:0,minW:0,svg:{transitionProperty:"common",transitionDuration:"normal",fill:"base.100",_hover:{fill:"base.50"},filter:s},...o},"data-testid":n})},Li=d.memo(Foe),Boe=e=>{const t=te(),{imageName:n}=e,{currentData:r}=to(n),o=W(M=>M.hotkeys.shift),{t:s}=Z(),{handleClick:i,isSelected:l,selection:u,selectionCount:p}=zoe(r),m=Jh(Ux),h=d.useCallback(M=>{M.stopPropagation(),r&&t(xh([r]))},[t,r]),g=d.useMemo(()=>{if(p>1)return{id:"gallery-image",payloadType:"IMAGE_DTOS",payload:{imageDTOs:u}};if(r)return{id:"gallery-image",payloadType:"IMAGE_DTO",payload:{imageDTO:r}}},[r,u,p]),[x]=Kx(),[y]=qx(),b=d.useCallback(()=>{r&&(r.starred&&y({imageDTOs:[r]}),r.starred||x({imageDTOs:[r]}))},[x,y,r]),[w,S]=d.useState(!1),j=d.useCallback(()=>{S(!0)},[]),_=d.useCallback(()=>{S(!1)},[]),E=d.useMemo(()=>{if(r!=null&&r.starred)return m?m.on.icon:a.jsx(Gy,{size:"20"});if(!(r!=null&&r.starred)&&w)return m?m.off.icon:a.jsx(Uy,{size:"20"})},[r==null?void 0:r.starred,w,m]),I=d.useMemo(()=>r!=null&&r.starred?m?m.off.text:"Unstar":r!=null&&r.starred?"":m?m.on.text:"Star",[r==null?void 0:r.starred,m]);return r?a.jsx(Ie,{sx:{w:"full",h:"full",touchAction:"none"},"data-testid":`image-${r.image_name}`,children:a.jsx(L,{userSelect:"none",sx:{position:"relative",justifyContent:"center",alignItems:"center",aspectRatio:"1/1"},children:a.jsx(ua,{onClick:i,imageDTO:r,draggableData:g,isSelected:l,minSize:0,imageSx:{w:"full",h:"full"},isDropDisabled:!0,isUploadDisabled:!0,thumbnail:!0,withHoverOverlay:!0,onMouseOver:j,onMouseOut:_,children:a.jsxs(a.Fragment,{children:[a.jsx(Li,{onClick:b,icon:E,tooltip:I}),w&&o&&a.jsx(Li,{onClick:h,icon:a.jsx(Br,{}),tooltip:s("gallery.deleteImage"),styleOverrides:{bottom:2,top:"auto"}})]})})})}):a.jsx($oe,{})},Hoe=d.memo(Boe),Voe=ke((e,t)=>a.jsx(Ie,{className:"item-container",ref:t,p:1.5,"data-testid":"image-item-container",children:e.children})),Woe=d.memo(Voe),Uoe=ke((e,t)=>{const n=W(r=>r.gallery.galleryImageMinimumWidth);return a.jsx(Ja,{...e,className:"list-container",ref:t,sx:{gridTemplateColumns:`repeat(auto-fill, minmax(${n}px, 1fr));`},"data-testid":"image-list-container",children:e.children})}),Goe=d.memo(Uoe),Koe={defer:!0,options:{scrollbars:{visibility:"auto",autoHide:"scroll",autoHideDelay:1300,theme:"os-theme-dark"},overflow:{x:"hidden"}}},qoe=()=>{const{t:e}=Z(),t=d.useRef(null),[n,r]=d.useState(null),[o,s]=Ey(Koe),i=W(w=>w.gallery.selectedBoardId),{currentViewTotal:l}=doe(i),u=W(Qx),{currentData:p,isFetching:m,isSuccess:h,isError:g}=vI(u),[x]=xI(),y=d.useMemo(()=>!p||!l?!1:p.ids.length{y&&x({...u,offset:(p==null?void 0:p.ids.length)??0,limit:bI})},[y,x,u,p==null?void 0:p.ids.length]);return d.useEffect(()=>{const{current:w}=t;return n&&w&&o({target:w,elements:{viewport:n}}),()=>{var S;return(S=s())==null?void 0:S.destroy()}},[n,o,s]),p?h&&(p==null?void 0:p.ids.length)===0?a.jsx(L,{sx:{w:"full",h:"full",alignItems:"center",justifyContent:"center"},children:a.jsx(Zn,{label:e("gallery.noImagesInGallery"),icon:Qi})}):h&&p?a.jsxs(a.Fragment,{children:[a.jsx(Ie,{ref:t,"data-overlayscrollbars":"",h:"100%",children:a.jsx(uoe,{style:{height:"100%"},data:p.ids,endReached:b,components:{Item:Woe,List:Goe},scrollerRef:r,itemContent:(w,S)=>a.jsx(Hoe,{imageName:S},S)})}),a.jsx(at,{onClick:b,isDisabled:!y,isLoading:m,loadingText:e("gallery.loading"),flexShrink:0,children:`Load More (${p.ids.length} of ${l})`})]}):g?a.jsx(Ie,{sx:{w:"full",h:"full"},children:a.jsx(Zn,{label:e("gallery.unableToLoad"),icon:NJ})}):null:a.jsx(L,{sx:{w:"full",h:"full",alignItems:"center",justifyContent:"center"},children:a.jsx(Zn,{label:e("gallery.loading"),icon:Qi})})},Xoe=d.memo(qoe),Qoe=ce([xe],e=>{const{galleryView:t}=e.gallery;return{galleryView:t}},je),Yoe=()=>{const e=d.useRef(null),t=d.useRef(null),{galleryView:n}=W(Qoe),r=te(),{isOpen:o,onToggle:s}=Lr({defaultIsOpen:!0}),i=d.useCallback(()=>{r(mw("images"))},[r]),l=d.useCallback(()=>{r(mw("assets"))},[r]);return a.jsxs(m3,{layerStyle:"first",sx:{flexDirection:"column",h:"full",w:"full",borderRadius:"base",p:2},children:[a.jsxs(Ie,{sx:{w:"full"},children:[a.jsxs(L,{ref:e,sx:{alignItems:"center",justifyContent:"space-between",gap:2},children:[a.jsx(_ne,{isOpen:o,onToggle:s}),a.jsx(Tne,{})]}),a.jsx(Ie,{children:a.jsx(Sne,{isOpen:o})})]}),a.jsxs(L,{ref:t,direction:"column",gap:2,h:"full",w:"full",children:[a.jsx(L,{sx:{alignItems:"center",justifyContent:"space-between",gap:2},children:a.jsx(rl,{index:n==="images"?0:1,variant:"unstyled",size:"sm",sx:{w:"full"},children:a.jsx(ol,{children:a.jsxs(Vt,{isAttached:!0,sx:{w:"full"},children:[a.jsx(Tr,{as:at,size:"sm",isChecked:n==="images",onClick:i,sx:{w:"full"},leftIcon:a.jsx(WJ,{}),"data-testid":"images-tab",children:"Images"}),a.jsx(Tr,{as:at,size:"sm",isChecked:n==="assets",onClick:l,sx:{w:"full"},leftIcon:a.jsx(nee,{}),"data-testid":"assets-tab",children:"Assets"})]})})})}),a.jsx(Xoe,{})]})]})},Zoe=d.memo(Yoe),Joe=()=>{const e=W(p=>p.system.isConnected),{data:t}=va(),[n,{isLoading:r}]=Yx(),o=te(),{t:s}=Z(),i=d.useMemo(()=>t==null?void 0:t.queue.item_id,[t==null?void 0:t.queue.item_id]),l=d.useCallback(async()=>{if(i)try{await n(i).unwrap(),o(ct({title:s("queue.cancelSucceeded"),status:"success"}))}catch{o(ct({title:s("queue.cancelFailed"),status:"error"}))}},[i,o,s,n]),u=d.useMemo(()=>!e||J9(i),[e,i]);return{cancelQueueItem:l,isLoading:r,currentQueueItemId:i,isDisabled:u}},ese=({label:e,tooltip:t,icon:n,onClick:r,isDisabled:o,colorScheme:s,asIconButton:i,isLoading:l,loadingText:u,sx:p})=>i?a.jsx(Fe,{"aria-label":e,tooltip:t,icon:n,onClick:r,isDisabled:o,colorScheme:s,isLoading:l,sx:p,"data-testid":e}):a.jsx(at,{"aria-label":e,tooltip:t,leftIcon:n,onClick:r,isDisabled:o,colorScheme:s,isLoading:l,loadingText:u??e,flexGrow:1,sx:p,"data-testid":e,children:e}),ul=d.memo(ese),tse=({asIconButton:e,sx:t})=>{const{t:n}=Z(),{cancelQueueItem:r,isLoading:o,isDisabled:s}=Joe();return a.jsx(ul,{isDisabled:s,isLoading:o,asIconButton:e,label:n("queue.cancel"),tooltip:n("queue.cancelTooltip"),icon:a.jsx(Ic,{}),onClick:r,colorScheme:"error",sx:t})},H8=d.memo(tse),nse=()=>{const{t:e}=Z(),t=te(),{data:n}=va(),r=W(u=>u.system.isConnected),[o,{isLoading:s}]=yI({fixedCacheKey:"clearQueue"}),i=d.useCallback(async()=>{if(n!=null&&n.queue.total)try{await o().unwrap(),t(ct({title:e("queue.clearSucceeded"),status:"success"})),t(Zx(void 0)),t(Jx(void 0))}catch{t(ct({title:e("queue.clearFailed"),status:"error"}))}},[n==null?void 0:n.queue.total,o,t,e]),l=d.useMemo(()=>!r||!(n!=null&&n.queue.total),[r,n==null?void 0:n.queue.total]);return{clearQueue:i,isLoading:s,queueStatus:n,isDisabled:l}},rse=ke((e,t)=>{const{t:n}=Z(),{acceptButtonText:r=n("common.accept"),acceptCallback:o,cancelButtonText:s=n("common.cancel"),cancelCallback:i,children:l,title:u,triggerComponent:p}=e,{isOpen:m,onOpen:h,onClose:g}=Lr(),x=d.useRef(null),y=()=>{o(),g()},b=()=>{i&&i(),g()};return a.jsxs(a.Fragment,{children:[d.cloneElement(p,{onClick:h,ref:t}),a.jsx(Td,{isOpen:m,leastDestructiveRef:x,onClose:g,isCentered:!0,children:a.jsx(Yo,{children:a.jsxs(Nd,{children:[a.jsx(Qo,{fontSize:"lg",fontWeight:"bold",children:u}),a.jsx(Zo,{children:l}),a.jsxs(Ss,{children:[a.jsx(at,{ref:x,onClick:b,children:s}),a.jsx(at,{colorScheme:"error",onClick:y,ml:3,children:r})]})]})})})]})}),kg=d.memo(rse),ose=({asIconButton:e,sx:t})=>{const{t:n}=Z(),{clearQueue:r,isLoading:o,isDisabled:s}=nse();return a.jsxs(kg,{title:n("queue.clearTooltip"),acceptCallback:r,acceptButtonText:n("queue.clear"),triggerComponent:a.jsx(ul,{isDisabled:s,isLoading:o,asIconButton:e,label:n("queue.clear"),tooltip:n("queue.clearTooltip"),icon:a.jsx(Br,{}),colorScheme:"error",sx:t}),children:[a.jsx(ve,{children:n("queue.clearQueueAlertDialog")}),a.jsx("br",{}),a.jsx(ve,{children:n("queue.clearQueueAlertDialog2")})]})},qy=d.memo(ose),sse=()=>{const e=te(),{t}=Z(),n=W(p=>p.system.isConnected),{data:r}=va(),[o,{isLoading:s}]=CI({fixedCacheKey:"pauseProcessor"}),i=d.useMemo(()=>!!(r!=null&&r.processor.is_started),[r==null?void 0:r.processor.is_started]),l=d.useCallback(async()=>{if(i)try{await o().unwrap(),e(ct({title:t("queue.pauseSucceeded"),status:"success"}))}catch{e(ct({title:t("queue.pauseFailed"),status:"error"}))}},[i,o,e,t]),u=d.useMemo(()=>!n||!i,[n,i]);return{pauseProcessor:l,isLoading:s,isStarted:i,isDisabled:u}},ase=({asIconButton:e})=>{const{t}=Z(),{pauseProcessor:n,isLoading:r,isDisabled:o}=sse();return a.jsx(ul,{asIconButton:e,label:t("queue.pause"),tooltip:t("queue.pauseTooltip"),isDisabled:o,isLoading:r,icon:a.jsx(QJ,{}),onClick:n,colorScheme:"gold"})},V8=d.memo(ase),ise=ce([xe,Jn],({controlNet:e,generation:t,system:n,nodes:r,dynamicPrompts:o},s)=>{const{initialImage:i,model:l}=t,{isConnected:u}=n,p=[];return u||p.push(yt.t("parameters.invoke.systemDisconnected")),s==="img2img"&&!i&&p.push(yt.t("parameters.invoke.noInitialImageSelected")),s==="nodes"?r.shouldValidateGraph&&(r.nodes.length||p.push(yt.t("parameters.invoke.noNodesInGraph")),r.nodes.forEach(m=>{if(!Mn(m))return;const h=r.nodeTemplates[m.data.type];if(!h){p.push(yt.t("parameters.invoke.missingNodeTemplate"));return}const g=HD([m],r.edges);$n(m.data.inputs,x=>{const y=h.inputs[x.name],b=g.some(w=>w.target===m.id&&w.targetHandle===x.name);if(!y){p.push(yt.t("parameters.invoke.missingFieldTemplate"));return}if(y.required&&x.value===void 0&&!b){p.push(yt.t("parameters.invoke.missingInputForField",{nodeLabel:m.data.label||h.title,fieldLabel:x.label||y.title}));return}})})):(o.prompts.length===0&&p.push(yt.t("parameters.invoke.noPrompts")),l||p.push(yt.t("parameters.invoke.noModelSelected")),e.isEnabled&&nr(e.controlNets).forEach((m,h)=>{m.isEnabled&&(m.model||p.push(yt.t("parameters.invoke.noModelForControlNet",{index:h+1})),(!m.controlImage||!m.processedControlImage&&m.processorType!=="none")&&p.push(yt.t("parameters.invoke.noControlImageForControlNet",{index:h+1})))})),{isReady:!p.length,reasons:p}},je),Xy=()=>{const{isReady:e,reasons:t}=W(ise);return{isReady:e,reasons:t}},W8=()=>{const e=te(),t=W(Jn),{isReady:n}=Xy(),[r,{isLoading:o}]=bh({fixedCacheKey:"enqueueBatch"}),s=d.useMemo(()=>!n,[n]);return{queueBack:d.useCallback(()=>{s||(e(eb()),e(wI({tabName:t,prepend:!1})))},[e,s,t]),isLoading:o,isDisabled:s}},lse=ce([xe],({gallery:e})=>{const{autoAddBoardId:t}=e;return{autoAddBoardId:t}},je),cse=({prepend:e=!1})=>{const{t}=Z(),{isReady:n,reasons:r}=Xy(),{autoAddBoardId:o}=W(lse),s=vg(o),[i,{isLoading:l}]=bh({fixedCacheKey:"enqueueBatch"}),u=d.useMemo(()=>t(l?"queue.enqueueing":n?e?"queue.queueFront":"queue.queueBack":"queue.notReady"),[l,n,e,t]);return a.jsxs(L,{flexDir:"column",gap:1,children:[a.jsx(ve,{fontWeight:600,children:u}),r.length>0&&a.jsx(Od,{children:r.map((p,m)=>a.jsx(Qr,{children:a.jsx(ve,{fontWeight:400,children:p})},`${p}.${m}`))}),a.jsx(G8,{}),a.jsxs(ve,{fontWeight:400,fontStyle:"oblique 10deg",children:["Adding images to"," ",a.jsx(ve,{as:"span",fontWeight:600,children:s||"Uncategorized"})]})]})},U8=d.memo(cse),G8=d.memo(()=>a.jsx(Yn,{opacity:.2,borderColor:"base.50",_dark:{borderColor:"base.900"}}));G8.displayName="StyledDivider";const use=()=>a.jsx(Ie,{pos:"relative",w:4,h:4,children:a.jsx(ga,{src:Hx,alt:"invoke-ai-logo",pos:"absolute",top:-.5,insetInlineStart:-.5,w:5,h:5,minW:5,minH:5,filter:"saturate(0)"})}),dse=d.memo(use),fse=({asIconButton:e,sx:t})=>{const{t:n}=Z(),{queueBack:r,isLoading:o,isDisabled:s}=W8();return a.jsx(ul,{asIconButton:e,colorScheme:"accent",label:n("parameters.invoke.invoke"),isDisabled:s,isLoading:o,onClick:r,tooltip:a.jsx(U8,{}),sx:t,icon:e?a.jsx(dse,{}):void 0})},K8=d.memo(fse),q8=()=>{const e=te(),t=W(Jn),{isReady:n}=Xy(),[r,{isLoading:o}]=bh({fixedCacheKey:"enqueueBatch"}),s=Bt("prependQueue").isFeatureEnabled,i=d.useMemo(()=>!n||!s,[n,s]);return{queueFront:d.useCallback(()=>{i||(e(eb()),e(wI({tabName:t,prepend:!0})))},[e,i,t]),isLoading:o,isDisabled:i}},pse=({asIconButton:e,sx:t})=>{const{t:n}=Z(),{queueFront:r,isLoading:o,isDisabled:s}=q8();return a.jsx(ul,{asIconButton:e,colorScheme:"base",label:n("queue.queueFront"),isDisabled:s,isLoading:o,onClick:r,tooltip:a.jsx(U8,{prepend:!0}),icon:a.jsx(goe,{}),sx:t})},mse=d.memo(pse),hse=()=>{const e=te(),t=W(p=>p.system.isConnected),{data:n}=va(),{t:r}=Z(),[o,{isLoading:s}]=SI({fixedCacheKey:"resumeProcessor"}),i=d.useMemo(()=>!!(n!=null&&n.processor.is_started),[n==null?void 0:n.processor.is_started]),l=d.useCallback(async()=>{if(!i)try{await o().unwrap(),e(ct({title:r("queue.resumeSucceeded"),status:"success"}))}catch{e(ct({title:r("queue.resumeFailed"),status:"error"}))}},[i,o,e,r]),u=d.useMemo(()=>!t||i,[t,i]);return{resumeProcessor:l,isLoading:s,isStarted:i,isDisabled:u}},gse=({asIconButton:e})=>{const{t}=Z(),{resumeProcessor:n,isLoading:r,isDisabled:o}=hse();return a.jsx(ul,{asIconButton:e,label:t("queue.resume"),tooltip:t("queue.resumeTooltip"),isDisabled:o,isLoading:r,icon:a.jsx(YJ,{}),onClick:n,colorScheme:"green"})},X8=d.memo(gse),vse=ce(xe,({system:e})=>{var t;return{isConnected:e.isConnected,hasSteps:!!e.denoiseProgress,value:(((t=e.denoiseProgress)==null?void 0:t.percentage)??0)*100}},je),xse=()=>{const{t:e}=Z(),{data:t}=va(),{hasSteps:n,value:r,isConnected:o}=W(vse);return a.jsx(K3,{value:r,"aria-label":e("accessibility.invokeProgressBar"),isIndeterminate:o&&!!(t!=null&&t.queue.in_progress)&&!n,h:"full",w:"full",borderRadius:2,colorScheme:"accent"})},bse=d.memo(xse),yse=()=>{const e=Bt("pauseQueue").isFeatureEnabled,t=Bt("resumeQueue").isFeatureEnabled,n=Bt("prependQueue").isFeatureEnabled;return a.jsxs(L,{layerStyle:"first",sx:{w:"full",position:"relative",borderRadius:"base",p:2,gap:2,flexDir:"column"},children:[a.jsxs(L,{gap:2,w:"full",children:[a.jsxs(Vt,{isAttached:!0,flexGrow:2,children:[a.jsx(K8,{}),n?a.jsx(mse,{asIconButton:!0}):a.jsx(a.Fragment,{}),a.jsx(H8,{asIconButton:!0})]}),a.jsxs(Vt,{isAttached:!0,children:[t?a.jsx(X8,{asIconButton:!0}):a.jsx(a.Fragment,{}),e?a.jsx(V8,{asIconButton:!0}):a.jsx(a.Fragment,{})]}),a.jsx(qy,{asIconButton:!0})]}),a.jsx(L,{h:3,w:"full",children:a.jsx(bse,{})}),a.jsx(Y8,{})]})},Q8=d.memo(yse),Y8=d.memo(()=>{const{t:e}=Z(),t=te(),{hasItems:n,pending:r}=va(void 0,{selectFromResult:({data:s})=>{if(!s)return{hasItems:!1,pending:0};const{pending:i,in_progress:l}=s.queue;return{hasItems:i+l>0,pending:i}}}),o=d.useCallback(()=>{t(Xs("queue"))},[t]);return a.jsxs(L,{justifyContent:"space-between",alignItems:"center",pe:1,"data-testid":"queue-count",children:[a.jsx(ba,{}),a.jsx(Za,{onClick:o,size:"sm",variant:"link",fontWeight:400,opacity:.7,fontStyle:"oblique 10deg",children:n?e("queue.queuedCount",{pending:r}):e("queue.queueEmpty")})]})});Y8.displayName="QueueCounts";const{createElement:Ec,createContext:Cse,forwardRef:Z8,useCallback:Gs,useContext:J8,useEffect:oa,useImperativeHandle:eO,useLayoutEffect:wse,useMemo:Sse,useRef:Kr,useState:Wu}=Fx,Uj=Fx["useId".toString()],Uu=wse,kse=typeof Uj=="function"?Uj:()=>null;let jse=0;function Qy(e=null){const t=kse(),n=Kr(e||t||null);return n.current===null&&(n.current=""+jse++),n.current}const jg=Cse(null);jg.displayName="PanelGroupContext";function tO({children:e=null,className:t="",collapsedSize:n=0,collapsible:r=!1,defaultSize:o=null,forwardedRef:s,id:i=null,maxSize:l=null,minSize:u,onCollapse:p=null,onResize:m=null,order:h=null,style:g={},tagName:x="div"}){const y=J8(jg);if(y===null)throw Error("Panel components must be rendered within a PanelGroup container");const b=Qy(i),{collapsePanel:w,expandPanel:S,getPanelSize:j,getPanelStyle:_,registerPanel:E,resizePanel:I,units:M,unregisterPanel:R}=y;u==null&&(M==="percentages"?u=10:u=0);const D=Kr({onCollapse:p,onResize:m});oa(()=>{D.current.onCollapse=p,D.current.onResize=m});const A=_(b,o),O=Kr({size:Gj(A)}),T=Kr({callbacksRef:D,collapsedSize:n,collapsible:r,defaultSize:o,id:b,idWasAutoGenerated:i==null,maxSize:l,minSize:u,order:h});return Uu(()=>{O.current.size=Gj(A),T.current.callbacksRef=D,T.current.collapsedSize=n,T.current.collapsible=r,T.current.defaultSize=o,T.current.id=b,T.current.idWasAutoGenerated=i==null,T.current.maxSize=l,T.current.minSize=u,T.current.order=h}),Uu(()=>(E(b,T),()=>{R(b)}),[h,b,E,R]),eO(s,()=>({collapse:()=>w(b),expand:()=>S(b),getCollapsed(){return O.current.size===0},getId(){return b},getSize(X){return j(b,X)},resize:(X,B)=>I(b,X,B)}),[w,S,j,b,I]),Ec(x,{children:e,className:t,"data-panel":"","data-panel-collapsible":r||void 0,"data-panel-id":b,"data-panel-size":parseFloat(""+A.flexGrow).toFixed(1),id:`data-panel-id-${b}`,style:{...A,...g}})}const Qa=Z8((e,t)=>Ec(tO,{...e,forwardedRef:t}));tO.displayName="Panel";Qa.displayName="forwardRef(Panel)";function Gj(e){const{flexGrow:t}=e;return typeof t=="string"?parseFloat(t):t}const Ji=10;function Du(e,t,n,r,o,s,i,l){const{id:u,panels:p,units:m}=t,h=m==="pixels"?Ha(u):NaN,{sizes:g}=l||{},x=g||s,y=Or(p),b=x.concat();let w=0;{const _=o<0?r:n,E=y.findIndex(D=>D.current.id===_),I=y[E],M=x[E],R=Cx(m,h,I,M,M+Math.abs(o),e);if(M===R)return x;R===0&&M>0&&i.set(_,M),o=o<0?M-R:R-M}let S=o<0?n:r,j=y.findIndex(_=>_.current.id===S);for(;;){const _=y[j],E=x[j],I=Math.abs(o)-Math.abs(w),M=Cx(m,h,_,E,E-I,e);if(E!==M&&(M===0&&E>0&&i.set(_.current.id,E),w+=E-M,b[j]=M,w.toPrecision(Ji).localeCompare(Math.abs(o).toPrecision(Ji),void 0,{numeric:!0})>=0))break;if(o<0){if(--j<0)break}else if(++j>=y.length)break}return w===0?x:(S=o<0?r:n,j=y.findIndex(_=>_.current.id===S),b[j]=x[j]+w,b)}function Fl(e,t,n){t.forEach((r,o)=>{const s=e[o];if(!s)return;const{callbacksRef:i,collapsedSize:l,collapsible:u,id:p}=s.current,m=n[p];if(m!==r){n[p]=r;const{onCollapse:h,onResize:g}=i.current;g&&g(r,m),u&&h&&((m==null||m===l)&&r!==l?h(!1):m!==l&&r===l&&h(!0))}})}function _se({groupId:e,panels:t,units:n}){const r=n==="pixels"?Ha(e):NaN,o=Or(t),s=Array(o.length);let i=0,l=100;for(let u=0;ui.current.id===e);if(n<0)return[null,null];const r=n===t.length-1,o=r?t[n-1].current.id:e,s=r?e:t[n+1].current.id;return[o,s]}function Ha(e){const t=md(e);if(t==null)return NaN;const n=t.getAttribute("data-panel-group-direction"),r=Yy(e);return n==="horizontal"?t.offsetWidth-r.reduce((o,s)=>o+s.offsetWidth,0):t.offsetHeight-r.reduce((o,s)=>o+s.offsetHeight,0)}function nO(e,t,n){if(e.size===1)return"100";const o=Or(e).findIndex(i=>i.current.id===t),s=n[o];return s==null?"0":s.toPrecision(Ji)}function Ise(e){const t=document.querySelector(`[data-panel-id="${e}"]`);return t||null}function md(e){const t=document.querySelector(`[data-panel-group-id="${e}"]`);return t||null}function _g(e){const t=document.querySelector(`[data-panel-resize-handle-id="${e}"]`);return t||null}function Pse(e){return rO().findIndex(r=>r.getAttribute("data-panel-resize-handle-id")===e)??null}function rO(){return Array.from(document.querySelectorAll("[data-panel-resize-handle-id]"))}function Yy(e){return Array.from(document.querySelectorAll(`[data-panel-resize-handle-id][data-panel-group-id="${e}"]`))}function Zy(e,t,n){var u,p,m,h;const r=_g(t),o=Yy(e),s=r?o.indexOf(r):-1,i=((p=(u=n[s])==null?void 0:u.current)==null?void 0:p.id)??null,l=((h=(m=n[s+1])==null?void 0:m.current)==null?void 0:h.id)??null;return[i,l]}function Or(e){return Array.from(e.values()).sort((t,n)=>{const r=t.current.order,o=n.current.order;return r==null&&o==null?0:r==null?-1:o==null?1:r-o})}function Cx(e,t,n,r,o,s=null){var m;let{collapsedSize:i,collapsible:l,maxSize:u,minSize:p}=n.current;if(e==="pixels"&&(i=i/t*100,u!=null&&(u=u/t*100),p=p/t*100),l){if(r>i){if(o<=p/2+i)return i}else if(!((m=s==null?void 0:s.type)==null?void 0:m.startsWith("key"))&&o100)&&(t.current.minSize=0),o!=null&&(o<0||e==="percentages"&&o>100)&&(t.current.maxSize=null),r!==null&&(r<0||e==="percentages"&&r>100?t.current.defaultSize=null:ro&&(t.current.defaultSize=o))}function Gv({groupId:e,panels:t,nextSizes:n,prevSizes:r,units:o}){n=[...n];const s=Or(t),i=o==="pixels"?Ha(e):NaN;let l=0;for(let u=0;u{const{direction:i,panels:l}=e.current,u=md(t);oO(u!=null,`No group found for id "${t}"`);const{height:p,width:m}=u.getBoundingClientRect(),g=Yy(t).map(x=>{const y=x.getAttribute("data-panel-resize-handle-id"),b=Or(l),[w,S]=Zy(t,y,b);if(w==null||S==null)return()=>{};let j=0,_=100,E=0,I=0;b.forEach(T=>{const{id:X,maxSize:B,minSize:V}=T.current;X===w?(j=V,_=B??100):(E+=V,I+=B??100)});const M=Math.min(_,100-E),R=Math.max(j,(b.length-1)*100-I),D=nO(l,w,o);x.setAttribute("aria-valuemax",""+Math.round(M)),x.setAttribute("aria-valuemin",""+Math.round(R)),x.setAttribute("aria-valuenow",""+Math.round(parseInt(D)));const A=T=>{if(!T.defaultPrevented)switch(T.key){case"Enter":{T.preventDefault();const X=b.findIndex(B=>B.current.id===w);if(X>=0){const B=b[X],V=o[X];if(V!=null){let U=0;V.toPrecision(Ji)<=B.current.minSize.toPrecision(Ji)?U=i==="horizontal"?m:p:U=-(i==="horizontal"?m:p);const N=Du(T,e.current,w,S,U,o,s.current,null);o!==N&&r(N)}}break}}};x.addEventListener("keydown",A);const O=Ise(w);return O!=null&&x.setAttribute("aria-controls",O.id),()=>{x.removeAttribute("aria-valuemax"),x.removeAttribute("aria-valuemin"),x.removeAttribute("aria-valuenow"),x.removeEventListener("keydown",A),O!=null&&x.removeAttribute("aria-controls")}});return()=>{g.forEach(x=>x())}},[e,t,n,s,r,o])}function Ose({disabled:e,handleId:t,resizeHandler:n}){oa(()=>{if(e||n==null)return;const r=_g(t);if(r==null)return;const o=s=>{if(!s.defaultPrevented)switch(s.key){case"ArrowDown":case"ArrowLeft":case"ArrowRight":case"ArrowUp":case"End":case"Home":{s.preventDefault(),n(s);break}case"F6":{s.preventDefault();const i=rO(),l=Pse(t);oO(l!==null);const u=s.shiftKey?l>0?l-1:i.length-1:l+1{r.removeEventListener("keydown",o)}},[e,t,n])}function Kv(e,t){if(e.length!==t.length)return!1;for(let n=0;nR.current.id===E),M=r[I];if(M.current.collapsible){const R=m[I];(R===0||R.toPrecision(Ji)===M.current.minSize.toPrecision(Ji))&&(S=S<0?-M.current.minSize*y:M.current.minSize*y)}return S}else return sO(e,n,o,l,u)}function Dse(e){return e.type==="keydown"}function wx(e){return e.type.startsWith("mouse")}function Sx(e){return e.type.startsWith("touch")}let kx=null,Mi=null;function aO(e){switch(e){case"horizontal":return"ew-resize";case"horizontal-max":return"w-resize";case"horizontal-min":return"e-resize";case"vertical":return"ns-resize";case"vertical-max":return"n-resize";case"vertical-min":return"s-resize"}}function Ase(){Mi!==null&&(document.head.removeChild(Mi),kx=null,Mi=null)}function qv(e){if(kx===e)return;kx=e;const t=aO(e);Mi===null&&(Mi=document.createElement("style"),document.head.appendChild(Mi)),Mi.innerHTML=`*{cursor: ${t}!important;}`}function Tse(e,t=10){let n=null;return(...o)=>{n!==null&&clearTimeout(n),n=setTimeout(()=>{e(...o)},t)}}function iO(e){return e.map(t=>{const{minSize:n,order:r}=t.current;return r?`${r}:${n}`:`${n}`}).sort((t,n)=>t.localeCompare(n)).join(",")}function lO(e,t){try{const n=t.getItem(`PanelGroup:sizes:${e}`);if(n){const r=JSON.parse(n);if(typeof r=="object"&&r!=null)return r}}catch{}return null}function Nse(e,t,n){const r=lO(e,n);if(r){const o=iO(t);return r[o]??null}return null}function $se(e,t,n,r){const o=iO(t),s=lO(e,r)||{};s[o]=n;try{r.setItem(`PanelGroup:sizes:${e}`,JSON.stringify(s))}catch(i){console.error(i)}}const Xv={};function Kj(e){try{if(typeof localStorage<"u")e.getItem=t=>localStorage.getItem(t),e.setItem=(t,n)=>{localStorage.setItem(t,n)};else throw new Error("localStorage not supported in this environment")}catch(t){console.error(t),e.getItem=()=>null,e.setItem=()=>{}}}const Au={getItem:e=>(Kj(Au),Au.getItem(e)),setItem:(e,t)=>{Kj(Au),Au.setItem(e,t)}};function cO({autoSaveId:e,children:t=null,className:n="",direction:r,disablePointerEventsDuringResize:o=!1,forwardedRef:s,id:i=null,onLayout:l,storage:u=Au,style:p={},tagName:m="div",units:h="percentages"}){const g=Qy(i),[x,y]=Wu(null),[b,w]=Wu(new Map),S=Kr(null);Kr({didLogDefaultSizeWarning:!1,didLogIdAndOrderWarning:!1,didLogInvalidLayoutWarning:!1,prevPanelIds:[]});const j=Kr({onLayout:l});oa(()=>{j.current.onLayout=l});const _=Kr({}),[E,I]=Wu([]),M=Kr(new Map),R=Kr(0),D=Kr({direction:r,id:g,panels:b,sizes:E,units:h});eO(s,()=>({getId:()=>g,getLayout:F=>{const{sizes:Q,units:Y}=D.current;if((F??Y)==="pixels"){const ae=Ha(g);return Q.map(re=>re/100*ae)}else return Q},setLayout:(F,Q)=>{const{id:Y,panels:se,sizes:ae,units:re}=D.current;if((Q||re)==="pixels"){const le=Ha(Y);F=F.map(J=>J/le*100)}const G=_.current,K=Or(se),ee=Gv({groupId:Y,panels:se,nextSizes:F,prevSizes:ae,units:re});Kv(ae,ee)||(I(ee),Fl(K,ee,G))}}),[g]),Uu(()=>{D.current.direction=r,D.current.id=g,D.current.panels=b,D.current.sizes=E,D.current.units=h}),Mse({committedValuesRef:D,groupId:g,panels:b,setSizes:I,sizes:E,panelSizeBeforeCollapse:M}),oa(()=>{const{onLayout:F}=j.current,{panels:Q,sizes:Y}=D.current;if(Y.length>0){F&&F(Y);const se=_.current,ae=Or(Q);Fl(ae,Y,se)}},[E]),Uu(()=>{const{id:F,sizes:Q,units:Y}=D.current;if(Q.length===b.size)return;let se=null;if(e){const ae=Or(b);se=Nse(e,ae,u)}if(se!=null){const ae=Gv({groupId:F,panels:b,nextSizes:se,prevSizes:se,units:Y});I(ae)}else{const ae=_se({groupId:F,panels:b,units:Y});I(ae)}},[e,b,u]),oa(()=>{if(e){if(E.length===0||E.length!==b.size)return;const F=Or(b);Xv[e]||(Xv[e]=Tse($se,100)),Xv[e](e,F,E,u)}},[e,b,E,u]),Uu(()=>{if(h==="pixels"){const F=new ResizeObserver(()=>{const{panels:Q,sizes:Y}=D.current,se=Gv({groupId:g,panels:Q,nextSizes:Y,prevSizes:Y,units:h});Kv(Y,se)||I(se)});return F.observe(md(g)),()=>{F.disconnect()}}},[g,h]);const A=Gs((F,Q)=>{const{panels:Y,units:se}=D.current,re=Or(Y).findIndex(ee=>ee.current.id===F),G=E[re];if((Q??se)==="pixels"){const ee=Ha(g);return G/100*ee}else return G},[g,E]),O=Gs((F,Q)=>{const{panels:Y}=D.current;return Y.size===0?{flexBasis:0,flexGrow:Q??void 0,flexShrink:1,overflow:"hidden"}:{flexBasis:0,flexGrow:nO(Y,F,E),flexShrink:1,overflow:"hidden",pointerEvents:o&&x!==null?"none":void 0}},[x,o,E]),T=Gs((F,Q)=>{const{units:Y}=D.current;Ese(Y,Q),w(se=>{if(se.has(F))return se;const ae=new Map(se);return ae.set(F,Q),ae})},[]),X=Gs(F=>Y=>{Y.preventDefault();const{direction:se,panels:ae,sizes:re}=D.current,G=Or(ae),[K,ee]=Zy(g,F,G);if(K==null||ee==null)return;let le=Rse(Y,g,F,G,se,re,S.current);if(le===0)return;const ie=md(g).getBoundingClientRect(),de=se==="horizontal";document.dir==="rtl"&&de&&(le=-le);const ge=de?ie.width:ie.height,Ce=le/ge*100,he=Du(Y,D.current,K,ee,Ce,re,M.current,S.current),fe=!Kv(re,he);if((wx(Y)||Sx(Y))&&R.current!=Ce&&qv(fe?de?"horizontal":"vertical":de?le<0?"horizontal-min":"horizontal-max":le<0?"vertical-min":"vertical-max"),fe){const Oe=_.current;I(he),Fl(G,he,Oe)}R.current=Ce},[g]),B=Gs(F=>{w(Q=>{if(!Q.has(F))return Q;const Y=new Map(Q);return Y.delete(F),Y})},[]),V=Gs(F=>{const{panels:Q,sizes:Y}=D.current,se=Q.get(F);if(se==null)return;const{collapsedSize:ae,collapsible:re}=se.current;if(!re)return;const G=Or(Q),K=G.indexOf(se);if(K<0)return;const ee=Y[K];if(ee===ae)return;M.current.set(F,ee);const[le,J]=Uv(F,G);if(le==null||J==null)return;const de=K===G.length-1?ee:ae-ee,ge=Du(null,D.current,le,J,de,Y,M.current,null);if(Y!==ge){const Ce=_.current;I(ge),Fl(G,ge,Ce)}},[]),U=Gs(F=>{const{panels:Q,sizes:Y}=D.current,se=Q.get(F);if(se==null)return;const{collapsedSize:ae,minSize:re}=se.current,G=M.current.get(F)||re;if(!G)return;const K=Or(Q),ee=K.indexOf(se);if(ee<0||Y[ee]!==ae)return;const[J,ie]=Uv(F,K);if(J==null||ie==null)return;const ge=ee===K.length-1?ae-G:G,Ce=Du(null,D.current,J,ie,ge,Y,M.current,null);if(Y!==Ce){const he=_.current;I(Ce),Fl(K,Ce,he)}},[]),N=Gs((F,Q,Y)=>{const{id:se,panels:ae,sizes:re,units:G}=D.current;if((Y||G)==="pixels"){const nt=Ha(se);Q=Q/nt*100}const K=ae.get(F);if(K==null)return;let{collapsedSize:ee,collapsible:le,maxSize:J,minSize:ie}=K.current;if(G==="pixels"){const nt=Ha(se);ie=ie/nt*100,J!=null&&(J=J/nt*100)}const de=Or(ae),ge=de.indexOf(K);if(ge<0)return;const Ce=re[ge];if(Ce===Q)return;le&&Q===ee||(Q=Math.min(J??100,Math.max(ie,Q)));const[he,fe]=Uv(F,de);if(he==null||fe==null)return;const _e=ge===de.length-1?Ce-Q:Q-Ce,Ne=Du(null,D.current,he,fe,_e,re,M.current,null);if(re!==Ne){const nt=_.current;I(Ne),Fl(de,Ne,nt)}},[]),$=Sse(()=>({activeHandleId:x,collapsePanel:V,direction:r,expandPanel:U,getPanelSize:A,getPanelStyle:O,groupId:g,registerPanel:T,registerResizeHandle:X,resizePanel:N,startDragging:(F,Q)=>{if(y(F),wx(Q)||Sx(Q)){const Y=_g(F);S.current={dragHandleRect:Y.getBoundingClientRect(),dragOffset:sO(Q,F,r),sizes:D.current.sizes}}},stopDragging:()=>{Ase(),y(null),S.current=null},units:h,unregisterPanel:B}),[x,V,r,U,A,O,g,T,X,N,h,B]),q={display:"flex",flexDirection:r==="horizontal"?"row":"column",height:"100%",overflow:"hidden",width:"100%"};return Ec(jg.Provider,{children:Ec(m,{children:t,className:n,"data-panel-group":"","data-panel-group-direction":r,"data-panel-group-id":g,"data-panel-group-units":h,style:{...q,...p}}),value:$})}const Ig=Z8((e,t)=>Ec(cO,{...e,forwardedRef:t}));cO.displayName="PanelGroup";Ig.displayName="forwardRef(PanelGroup)";function jx({children:e=null,className:t="",disabled:n=!1,id:r=null,onDragging:o,style:s={},tagName:i="div"}){const l=Kr(null),u=Kr({onDragging:o});oa(()=>{u.current.onDragging=o});const p=J8(jg);if(p===null)throw Error("PanelResizeHandle components must be rendered within a PanelGroup container");const{activeHandleId:m,direction:h,groupId:g,registerResizeHandle:x,startDragging:y,stopDragging:b}=p,w=Qy(r),S=m===w,[j,_]=Wu(!1),[E,I]=Wu(null),M=Gs(()=>{l.current.blur(),b();const{onDragging:A}=u.current;A&&A(!1)},[b]);oa(()=>{if(n)I(null);else{const D=x(w);I(()=>D)}},[n,w,x]),oa(()=>{if(n||E==null||!S)return;const D=X=>{E(X)},A=X=>{E(X)},T=l.current.ownerDocument;return T.body.addEventListener("contextmenu",M),T.body.addEventListener("mousemove",D),T.body.addEventListener("touchmove",D),T.body.addEventListener("mouseleave",A),window.addEventListener("mouseup",M),window.addEventListener("touchend",M),()=>{T.body.removeEventListener("contextmenu",M),T.body.removeEventListener("mousemove",D),T.body.removeEventListener("touchmove",D),T.body.removeEventListener("mouseleave",A),window.removeEventListener("mouseup",M),window.removeEventListener("touchend",M)}},[h,n,S,E,M]),Ose({disabled:n,handleId:w,resizeHandler:E});const R={cursor:aO(h),touchAction:"none",userSelect:"none"};return Ec(i,{children:e,className:t,"data-resize-handle-active":S?"pointer":j?"keyboard":void 0,"data-panel-group-direction":h,"data-panel-group-id":g,"data-panel-resize-handle-enabled":!n,"data-panel-resize-handle-id":w,onBlur:()=>_(!1),onFocus:()=>_(!0),onMouseDown:D=>{y(w,D.nativeEvent);const{onDragging:A}=u.current;A&&A(!0)},onMouseUp:M,onTouchCancel:M,onTouchEnd:M,onTouchStart:D=>{y(w,D.nativeEvent);const{onDragging:A}=u.current;A&&A(!0)},ref:l,role:"separator",style:{...R,...s},tabIndex:0})}jx.displayName="PanelResizeHandle";const Lse=e=>{const{direction:t="horizontal",collapsedDirection:n,isCollapsed:r=!1,...o}=e,s=sa("base.100","base.850"),i=sa("base.300","base.700");return t==="horizontal"?a.jsx(jx,{style:{visibility:r?"hidden":"visible",width:r?0:"auto"},children:a.jsx(L,{className:"resize-handle-horizontal",sx:{w:n?2.5:4,h:"full",justifyContent:n?n==="left"?"flex-start":"flex-end":"center",alignItems:"center",div:{bg:s},_hover:{div:{bg:i}}},...o,children:a.jsx(Ie,{sx:{w:1,h:"calc(100% - 1rem)",borderRadius:"base",transitionProperty:"common",transitionDuration:"normal"}})})}):a.jsx(jx,{style:{visibility:r?"hidden":"visible",width:r?0:"auto"},children:a.jsx(L,{className:"resize-handle-vertical",sx:{w:"full",h:n?2.5:4,alignItems:n?n==="top"?"flex-start":"flex-end":"center",justifyContent:"center",div:{bg:s},_hover:{div:{bg:i}}},...o,children:a.jsx(Ie,{sx:{h:1,w:"calc(100% - 1rem)",borderRadius:"base",transitionProperty:"common",transitionDuration:"normal"}})})})},lh=d.memo(Lse),Jy=()=>{const e=te(),t=W(o=>o.ui.panels),n=d.useCallback(o=>t[o]??"",[t]),r=d.useCallback((o,s)=>{e(VD({name:o,value:s}))},[e]);return{getItem:n,setItem:r}};const zse=e=>{const{label:t,data:n,fileName:r,withDownload:o=!0,withCopy:s=!0}=e,i=d.useMemo(()=>WD(n)?n:JSON.stringify(n,null,2),[n]),l=d.useCallback(()=>{navigator.clipboard.writeText(i)},[i]),u=d.useCallback(()=>{const m=new Blob([i]),h=document.createElement("a");h.href=URL.createObjectURL(m),h.download=`${r||t}.json`,document.body.appendChild(h),h.click(),h.remove()},[i,t,r]),{t:p}=Z();return a.jsxs(L,{layerStyle:"second",sx:{borderRadius:"base",flexGrow:1,w:"full",h:"full",position:"relative"},children:[a.jsx(Ie,{sx:{position:"absolute",top:0,left:0,right:0,bottom:0,overflow:"auto",p:4,fontSize:"sm"},children:a.jsx(hg,{defer:!0,style:{height:"100%",width:"100%"},options:{scrollbars:{visibility:"auto",autoHide:"scroll",autoHideDelay:1300,theme:"os-theme-dark"}},children:a.jsx("pre",{children:i})})}),a.jsxs(L,{sx:{position:"absolute",top:0,insetInlineEnd:0,p:2},children:[o&&a.jsx(Ht,{label:`${p("gallery.download")} ${t} JSON`,children:a.jsx(ys,{"aria-label":`${p("gallery.download")} ${t} JSON`,icon:a.jsx(ig,{}),variant:"ghost",opacity:.7,onClick:u})}),s&&a.jsx(Ht,{label:`${p("gallery.copy")} ${t} JSON`,children:a.jsx(ys,{"aria-label":`${p("gallery.copy")} ${t} JSON`,icon:a.jsx(Hc,{}),variant:"ghost",opacity:.7,onClick:l})})]})]})},Ya=d.memo(zse),Fse=ce(xe,({nodes:e})=>{const t=e.selectedNodes[e.selectedNodes.length-1],n=e.nodes.find(r=>r.id===t);return{data:n==null?void 0:n.data}},je),Bse=()=>{const{data:e}=W(Fse);return e?a.jsx(Ya,{data:e,label:"Node Data"}):a.jsx(Zn,{label:"No node selected",icon:null})},Hse=d.memo(Bse),Vse=({children:e,maxHeight:t})=>a.jsx(L,{sx:{w:"full",h:"full",maxHeight:t,position:"relative"},children:a.jsx(Ie,{sx:{position:"absolute",top:0,left:0,right:0,bottom:0},children:a.jsx(hg,{defer:!0,style:{height:"100%",width:"100%"},options:{scrollbars:{visibility:"auto",autoHide:"scroll",autoHideDelay:1300,theme:"os-theme-dark"},overflow:{x:"hidden"}},children:e})})}),Zd=d.memo(Vse),Wse=({output:e})=>{const{image:t}=e,{data:n}=to(t.image_name);return a.jsx(ua,{imageDTO:n})},Use=d.memo(Wse),Gse=ce(xe,({nodes:e})=>{const t=e.selectedNodes[e.selectedNodes.length-1],n=e.nodes.find(s=>s.id===t),r=n?e.nodeTemplates[n.data.type]:void 0,o=e.nodeExecutionStates[t??"__UNKNOWN_NODE__"];return{node:n,template:r,nes:o}},je),Kse=()=>{const{node:e,template:t,nes:n}=W(Gse),{t:r}=Z();return!e||!n||!Mn(e)?a.jsx(Zn,{label:r("nodes.noNodeSelected"),icon:null}):n.outputs.length===0?a.jsx(Zn,{label:r("nodes.noOutputRecorded"),icon:null}):a.jsx(Ie,{sx:{position:"relative",w:"full",h:"full"},children:a.jsx(Zd,{children:a.jsx(L,{sx:{position:"relative",flexDir:"column",alignItems:"flex-start",p:1,gap:2,h:"full",w:"full"},children:(t==null?void 0:t.outputType)==="image_output"?n.outputs.map((o,s)=>a.jsx(Use,{output:o},Xse(o,s))):a.jsx(Ya,{data:n.outputs,label:r("nodes.nodeOutputs")})})})})},qse=d.memo(Kse),Xse=(e,t)=>`${e.type}-${t}`,Qse=ce(xe,({nodes:e})=>{const t=e.selectedNodes[e.selectedNodes.length-1],n=e.nodes.find(o=>o.id===t);return{template:n?e.nodeTemplates[n.data.type]:void 0}},je),Yse=()=>{const{template:e}=W(Qse),{t}=Z();return e?a.jsx(Ya,{data:e,label:t("nodes.nodeTemplate")}):a.jsx(Zn,{label:t("nodes.noNodeSelected"),icon:null})},Zse=d.memo(Yse),Jse=()=>a.jsx(L,{layerStyle:"first",sx:{flexDir:"column",w:"full",h:"full",borderRadius:"base",p:2,gap:2},children:a.jsxs(rl,{variant:"line",sx:{display:"flex",flexDir:"column",w:"full",h:"full"},children:[a.jsxs(ol,{children:[a.jsx(Tr,{children:"Outputs"}),a.jsx(Tr,{children:"Data"}),a.jsx(Tr,{children:"Template"})]}),a.jsxs(zc,{children:[a.jsx(So,{children:a.jsx(qse,{})}),a.jsx(So,{children:a.jsx(Hse,{})}),a.jsx(So,{children:a.jsx(Zse,{})})]})]})}),eae=d.memo(Jse),e2=e=>{e.stopPropagation()},tae={display:"flex",flexDirection:"row",alignItems:"center",gap:10},nae=e=>{const{label:t="",labelPos:n="top",isDisabled:r=!1,isInvalid:o,formControlProps:s,...i}=e,l=te(),u=d.useCallback(m=>{m.shiftKey&&l(Nr(!0))},[l]),p=d.useCallback(m=>{m.shiftKey||l(Nr(!1))},[l]);return a.jsxs(Kt,{isInvalid:o,isDisabled:r,...s,style:n==="side"?tae:void 0,children:[t!==""&&a.jsx(wn,{children:t}),a.jsx(Mh,{...i,onPaste:e2,onKeyDown:u,onKeyUp:p})]})},vo=d.memo(nae),rae=ke((e,t)=>{const n=te(),r=d.useCallback(s=>{s.shiftKey&&n(Nr(!0))},[n]),o=d.useCallback(s=>{s.shiftKey||n(Nr(!1))},[n]);return a.jsx(fP,{ref:t,onPaste:e2,onKeyDown:r,onKeyUp:o,...e})}),da=d.memo(rae),oae=ce(xe,({nodes:e})=>{const{author:t,name:n,description:r,tags:o,version:s,contact:i,notes:l}=e.workflow;return{name:n,author:t,description:r,tags:o,version:s,contact:i,notes:l}},je),sae=()=>{const{author:e,name:t,description:n,tags:r,version:o,contact:s,notes:i}=W(oae),l=te(),u=d.useCallback(w=>{l(UD(w.target.value))},[l]),p=d.useCallback(w=>{l(GD(w.target.value))},[l]),m=d.useCallback(w=>{l(KD(w.target.value))},[l]),h=d.useCallback(w=>{l(qD(w.target.value))},[l]),g=d.useCallback(w=>{l(XD(w.target.value))},[l]),x=d.useCallback(w=>{l(QD(w.target.value))},[l]),y=d.useCallback(w=>{l(YD(w.target.value))},[l]),{t:b}=Z();return a.jsx(Zd,{children:a.jsxs(L,{sx:{flexDir:"column",alignItems:"flex-start",gap:2,h:"full"},children:[a.jsxs(L,{sx:{gap:2,w:"full"},children:[a.jsx(vo,{label:b("nodes.workflowName"),value:t,onChange:u}),a.jsx(vo,{label:b("nodes.workflowVersion"),value:o,onChange:h})]}),a.jsxs(L,{sx:{gap:2,w:"full"},children:[a.jsx(vo,{label:b("nodes.workflowAuthor"),value:e,onChange:p}),a.jsx(vo,{label:b("nodes.workflowContact"),value:s,onChange:m})]}),a.jsx(vo,{label:b("nodes.workflowTags"),value:r,onChange:x}),a.jsxs(Kt,{as:L,sx:{flexDir:"column"},children:[a.jsx(wn,{children:b("nodes.workflowDescription")}),a.jsx(da,{onChange:g,value:n,fontSize:"sm",sx:{resize:"none"}})]}),a.jsxs(Kt,{as:L,sx:{flexDir:"column",h:"full"},children:[a.jsx(wn,{children:b("nodes.workflowNotes")}),a.jsx(da,{onChange:y,value:i,fontSize:"sm",sx:{h:"full",resize:"none"}})]})]})})},aae=d.memo(sae);function iae(e,t,n){var r=this,o=d.useRef(null),s=d.useRef(0),i=d.useRef(null),l=d.useRef([]),u=d.useRef(),p=d.useRef(),m=d.useRef(e),h=d.useRef(!0);d.useEffect(function(){m.current=e},[e]);var g=!t&&t!==0&&typeof window<"u";if(typeof e!="function")throw new TypeError("Expected a function");t=+t||0;var x=!!(n=n||{}).leading,y=!("trailing"in n)||!!n.trailing,b="maxWait"in n,w=b?Math.max(+n.maxWait||0,t):null;d.useEffect(function(){return h.current=!0,function(){h.current=!1}},[]);var S=d.useMemo(function(){var j=function(D){var A=l.current,O=u.current;return l.current=u.current=null,s.current=D,p.current=m.current.apply(O,A)},_=function(D,A){g&&cancelAnimationFrame(i.current),i.current=g?requestAnimationFrame(D):setTimeout(D,A)},E=function(D){if(!h.current)return!1;var A=D-o.current;return!o.current||A>=t||A<0||b&&D-s.current>=w},I=function(D){return i.current=null,y&&l.current?j(D):(l.current=u.current=null,p.current)},M=function D(){var A=Date.now();if(E(A))return I(A);if(h.current){var O=t-(A-o.current),T=b?Math.min(O,w-(A-s.current)):O;_(D,T)}},R=function(){var D=Date.now(),A=E(D);if(l.current=[].slice.call(arguments),u.current=r,o.current=D,A){if(!i.current&&h.current)return s.current=o.current,_(M,t),x?j(o.current):p.current;if(b)return _(M,t),j(o.current)}return i.current||_(M,t),p.current};return R.cancel=function(){i.current&&(g?cancelAnimationFrame(i.current):clearTimeout(i.current)),s.current=0,l.current=o.current=u.current=i.current=null},R.isPending=function(){return!!i.current},R.flush=function(){return i.current?I(Date.now()):p.current},R},[x,b,t,w,y,g]);return S}function lae(e,t){return e===t}function qj(e){return typeof e=="function"?function(){return e}:e}function cae(e,t,n){var r,o,s=n&&n.equalityFn||lae,i=(r=d.useState(qj(e)),o=r[1],[r[0],d.useCallback(function(h){return o(qj(h))},[])]),l=i[0],u=i[1],p=iae(d.useCallback(function(h){return u(h)},[u]),t,n),m=d.useRef(e);return s(m.current,e)||(p(e),m.current=e),[l,p]}const uO=()=>{const e=W(r=>r.nodes),[t]=cae(e,300);return d.useMemo(()=>ZD(t),[t])},uae=()=>{const e=uO(),{t}=Z();return a.jsx(L,{sx:{flexDir:"column",alignItems:"flex-start",gap:2,h:"full"},children:a.jsx(Ya,{data:e,label:t("nodes.workflow")})})},dae=d.memo(uae),fae=({isSelected:e,isHovered:t})=>{const n=d.useMemo(()=>{if(e&&t)return"nodeHoveredSelected.light";if(e)return"nodeSelected.light";if(t)return"nodeHovered.light"},[t,e]),r=d.useMemo(()=>{if(e&&t)return"nodeHoveredSelected.dark";if(e)return"nodeSelected.dark";if(t)return"nodeHovered.dark"},[t,e]);return a.jsx(Ie,{className:"selection-box",sx:{position:"absolute",top:0,insetInlineEnd:0,bottom:0,insetInlineStart:0,borderRadius:"base",opacity:e||t?1:.5,transitionProperty:"common",transitionDuration:"0.1s",pointerEvents:"none",shadow:n,_dark:{shadow:r}}})},dO=d.memo(fae),fO=e=>{const t=te(),n=d.useMemo(()=>ce(xe,({nodes:i})=>i.mouseOverNode===e,je),[e]),r=W(n),o=d.useCallback(()=>{!r&&t(hw(e))},[t,e,r]),s=d.useCallback(()=>{r&&t(hw(null))},[t,r]);return{isMouseOverNode:r,handleMouseOver:o,handleMouseOut:s}},pO=(e,t)=>{const n=d.useMemo(()=>ce(xe,({nodes:o})=>{var i;const s=o.nodes.find(l=>l.id===e);if(Mn(s))return(i=s==null?void 0:s.data.inputs[t])==null?void 0:i.label},je),[t,e]);return W(n)},mO=(e,t,n)=>{const r=d.useMemo(()=>ce(xe,({nodes:s})=>{var u;const i=s.nodes.find(p=>p.id===e);if(!Mn(i))return;const l=s.nodeTemplates[(i==null?void 0:i.data.type)??""];return(u=l==null?void 0:l[tb[n]][t])==null?void 0:u.title},je),[t,n,e]);return W(r)},hO=(e,t)=>{const n=d.useMemo(()=>ce(xe,({nodes:o})=>{const s=o.nodes.find(i=>i.id===e);if(Mn(s))return s==null?void 0:s.data.inputs[t]},je),[t,e]);return W(n)},Pg=(e,t,n)=>{const r=d.useMemo(()=>ce(xe,({nodes:s})=>{const i=s.nodes.find(u=>u.id===e);if(!Mn(i))return;const l=s.nodeTemplates[(i==null?void 0:i.data.type)??""];return l==null?void 0:l[tb[n]][t]},je),[t,n,e]);return W(r)},pae=({nodeId:e,fieldName:t,kind:n})=>{const r=hO(e,t),o=Pg(e,t,n),s=JD(o),{t:i}=Z(),l=d.useMemo(()=>eA(r)?r.label&&(o!=null&&o.title)?`${r.label} (${o.title})`:r.label&&!o?r.label:!r.label&&o?o.title:i("nodes.unknownField"):(o==null?void 0:o.title)||i("nodes.unknownField"),[r,o,i]);return a.jsxs(L,{sx:{flexDir:"column"},children:[a.jsx(ve,{sx:{fontWeight:600},children:l}),o&&a.jsx(ve,{sx:{opacity:.7,fontStyle:"oblique 5deg"},children:o.description}),o&&a.jsxs(ve,{children:["Type: ",wd[o.type].title]}),s&&a.jsxs(ve,{children:["Input: ",tA(o.input)]})]})},t2=d.memo(pae),mae=ke((e,t)=>{const{nodeId:n,fieldName:r,kind:o,isMissingInput:s=!1,withTooltip:i=!1}=e,l=pO(n,r),u=mO(n,r,o),{t:p}=Z(),m=te(),[h,g]=d.useState(l||u||p("nodes.unknownField")),x=d.useCallback(async b=>{b&&(b===l||b===u)||(g(b||u||p("nodes.unknownField")),m(nA({nodeId:n,fieldName:r,label:b})))},[l,u,m,n,r,p]),y=d.useCallback(b=>{g(b)},[]);return d.useEffect(()=>{g(l||u||p("nodes.unknownField"))},[l,u,p]),a.jsx(Ht,{label:i?a.jsx(t2,{nodeId:n,fieldName:r,kind:"input"}):void 0,openDelay:yh,placement:"top",hasArrow:!0,children:a.jsx(L,{ref:t,sx:{position:"relative",overflow:"hidden",alignItems:"center",justifyContent:"flex-start",gap:1,h:"full"},children:a.jsxs(Ih,{value:h,onChange:y,onSubmit:x,as:L,sx:{position:"relative",alignItems:"center",h:"full"},children:[a.jsx(_h,{sx:{p:0,fontWeight:s?600:400,textAlign:"left",_hover:{fontWeight:"600 !important"}},noOfLines:1}),a.jsx(jh,{className:"nodrag",sx:{p:0,w:"full",fontWeight:600,color:"base.900",_dark:{color:"base.100"},_focusVisible:{p:0,textAlign:"left",boxShadow:"none"}}}),a.jsx(vO,{})]})})})}),gO=d.memo(mae),vO=d.memo(()=>{const{isEditing:e,getEditButtonProps:t}=C5(),n=d.useCallback(r=>{const{onClick:o}=t();o&&(o(r),r.preventDefault())},[t]);return e?null:a.jsx(L,{onClick:n,position:"absolute",w:"full",h:"full",top:0,insetInlineStart:0,cursor:"text"})});vO.displayName="EditableControls";const hae=e=>{const{nodeId:t,field:n}=e,r=te(),o=d.useCallback(s=>{r(rA({nodeId:t,fieldName:n.name,value:s.target.checked}))},[r,n.name,t]);return a.jsx(qb,{className:"nodrag",onChange:o,isChecked:n.value})},gae=d.memo(hae);function Eg(){return(Eg=Object.assign||function(e){for(var t=1;t=0||(o[n]=e[n]);return o}function _x(e){var t=d.useRef(e),n=d.useRef(function(r){t.current&&t.current(r)});return t.current=e,n.current}var Mc=function(e,t,n){return t===void 0&&(t=0),n===void 0&&(n=1),e>n?n:e0:w.buttons>0)&&o.current?s(Xj(o.current,w,l.current)):b(!1)},y=function(){return b(!1)};function b(w){var S=u.current,j=Ix(o.current),_=w?j.addEventListener:j.removeEventListener;_(S?"touchmove":"mousemove",x),_(S?"touchend":"mouseup",y)}return[function(w){var S=w.nativeEvent,j=o.current;if(j&&(Qj(S),!function(E,I){return I&&!Gu(E)}(S,u.current)&&j)){if(Gu(S)){u.current=!0;var _=S.changedTouches||[];_.length&&(l.current=_[0].identifier)}j.focus(),s(Xj(j,S,l.current)),b(!0)}},function(w){var S=w.which||w.keyCode;S<37||S>40||(w.preventDefault(),i({left:S===39?.05:S===37?-.05:0,top:S===40?.05:S===38?-.05:0}))},b]},[i,s]),m=p[0],h=p[1],g=p[2];return d.useEffect(function(){return g},[g]),H.createElement("div",Eg({},r,{onTouchStart:m,onMouseDown:m,className:"react-colorful__interactive",ref:o,onKeyDown:h,tabIndex:0,role:"slider"}))}),Mg=function(e){return e.filter(Boolean).join(" ")},r2=function(e){var t=e.color,n=e.left,r=e.top,o=r===void 0?.5:r,s=Mg(["react-colorful__pointer",e.className]);return H.createElement("div",{className:s,style:{top:100*o+"%",left:100*n+"%"}},H.createElement("div",{className:"react-colorful__pointer-fill",style:{backgroundColor:t}}))},Cr=function(e,t,n){return t===void 0&&(t=0),n===void 0&&(n=Math.pow(10,t)),Math.round(n*e)/n},bO=function(e){var t=e.s,n=e.v,r=e.a,o=(200-t)*n/100;return{h:Cr(e.h),s:Cr(o>0&&o<200?t*n/100/(o<=100?o:200-o)*100:0),l:Cr(o/2),a:Cr(r,2)}},Px=function(e){var t=bO(e);return"hsl("+t.h+", "+t.s+"%, "+t.l+"%)"},Qv=function(e){var t=bO(e);return"hsla("+t.h+", "+t.s+"%, "+t.l+"%, "+t.a+")"},vae=function(e){var t=e.h,n=e.s,r=e.v,o=e.a;t=t/360*6,n/=100,r/=100;var s=Math.floor(t),i=r*(1-n),l=r*(1-(t-s)*n),u=r*(1-(1-t+s)*n),p=s%6;return{r:Cr(255*[r,l,i,i,u,r][p]),g:Cr(255*[u,r,r,l,i,i][p]),b:Cr(255*[i,i,u,r,r,l][p]),a:Cr(o,2)}},xae=function(e){var t=e.r,n=e.g,r=e.b,o=e.a,s=Math.max(t,n,r),i=s-Math.min(t,n,r),l=i?s===t?(n-r)/i:s===n?2+(r-t)/i:4+(t-n)/i:0;return{h:Cr(60*(l<0?l+6:l)),s:Cr(s?i/s*100:0),v:Cr(s/255*100),a:o}},bae=H.memo(function(e){var t=e.hue,n=e.onChange,r=Mg(["react-colorful__hue",e.className]);return H.createElement("div",{className:r},H.createElement(n2,{onMove:function(o){n({h:360*o.left})},onKey:function(o){n({h:Mc(t+360*o.left,0,360)})},"aria-label":"Hue","aria-valuenow":Cr(t),"aria-valuemax":"360","aria-valuemin":"0"},H.createElement(r2,{className:"react-colorful__hue-pointer",left:t/360,color:Px({h:t,s:100,v:100,a:1})})))}),yae=H.memo(function(e){var t=e.hsva,n=e.onChange,r={backgroundColor:Px({h:t.h,s:100,v:100,a:1})};return H.createElement("div",{className:"react-colorful__saturation",style:r},H.createElement(n2,{onMove:function(o){n({s:100*o.left,v:100-100*o.top})},onKey:function(o){n({s:Mc(t.s+100*o.left,0,100),v:Mc(t.v-100*o.top,0,100)})},"aria-label":"Color","aria-valuetext":"Saturation "+Cr(t.s)+"%, Brightness "+Cr(t.v)+"%"},H.createElement(r2,{className:"react-colorful__saturation-pointer",top:1-t.v/100,left:t.s/100,color:Px(t)})))}),yO=function(e,t){if(e===t)return!0;for(var n in e)if(e[n]!==t[n])return!1;return!0};function Cae(e,t,n){var r=_x(n),o=d.useState(function(){return e.toHsva(t)}),s=o[0],i=o[1],l=d.useRef({color:t,hsva:s});d.useEffect(function(){if(!e.equal(t,l.current.color)){var p=e.toHsva(t);l.current={hsva:p,color:t},i(p)}},[t,e]),d.useEffect(function(){var p;yO(s,l.current.hsva)||e.equal(p=e.fromHsva(s),l.current.color)||(l.current={hsva:s,color:p},r(p))},[s,e,r]);var u=d.useCallback(function(p){i(function(m){return Object.assign({},m,p)})},[]);return[s,u]}var wae=typeof window<"u"?d.useLayoutEffect:d.useEffect,Sae=function(){return typeof __webpack_nonce__<"u"?__webpack_nonce__:void 0},Yj=new Map,kae=function(e){wae(function(){var t=e.current?e.current.ownerDocument:document;if(t!==void 0&&!Yj.has(t)){var n=t.createElement("style");n.innerHTML=`.react-colorful{position:relative;display:flex;flex-direction:column;width:200px;height:200px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;cursor:default}.react-colorful__saturation{position:relative;flex-grow:1;border-color:transparent;border-bottom:12px solid #000;border-radius:8px 8px 0 0;background-image:linear-gradient(0deg,#000,transparent),linear-gradient(90deg,#fff,hsla(0,0%,100%,0))}.react-colorful__alpha-gradient,.react-colorful__pointer-fill{content:"";position:absolute;left:0;top:0;right:0;bottom:0;pointer-events:none;border-radius:inherit}.react-colorful__alpha-gradient,.react-colorful__saturation{box-shadow:inset 0 0 0 1px rgba(0,0,0,.05)}.react-colorful__alpha,.react-colorful__hue{position:relative;height:24px}.react-colorful__hue{background:linear-gradient(90deg,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red)}.react-colorful__last-control{border-radius:0 0 8px 8px}.react-colorful__interactive{position:absolute;left:0;top:0;right:0;bottom:0;border-radius:inherit;outline:none;touch-action:none}.react-colorful__pointer{position:absolute;z-index:1;box-sizing:border-box;width:28px;height:28px;transform:translate(-50%,-50%);background-color:#fff;border:2px solid #fff;border-radius:50%;box-shadow:0 2px 4px rgba(0,0,0,.2)}.react-colorful__interactive:focus .react-colorful__pointer{transform:translate(-50%,-50%) scale(1.1)}.react-colorful__alpha,.react-colorful__alpha-pointer{background-color:#fff;background-image:url('data:image/svg+xml;charset=utf-8,')}.react-colorful__saturation-pointer{z-index:3}.react-colorful__hue-pointer{z-index:2}`,Yj.set(t,n);var r=Sae();r&&n.setAttribute("nonce",r),t.head.appendChild(n)}},[])},jae=function(e){var t=e.className,n=e.hsva,r=e.onChange,o={backgroundImage:"linear-gradient(90deg, "+Qv(Object.assign({},n,{a:0}))+", "+Qv(Object.assign({},n,{a:1}))+")"},s=Mg(["react-colorful__alpha",t]),i=Cr(100*n.a);return H.createElement("div",{className:s},H.createElement("div",{className:"react-colorful__alpha-gradient",style:o}),H.createElement(n2,{onMove:function(l){r({a:l.left})},onKey:function(l){r({a:Mc(n.a+l.left)})},"aria-label":"Alpha","aria-valuetext":i+"%","aria-valuenow":i,"aria-valuemin":"0","aria-valuemax":"100"},H.createElement(r2,{className:"react-colorful__alpha-pointer",left:n.a,color:Qv(n)})))},_ae=function(e){var t=e.className,n=e.colorModel,r=e.color,o=r===void 0?n.defaultColor:r,s=e.onChange,i=xO(e,["className","colorModel","color","onChange"]),l=d.useRef(null);kae(l);var u=Cae(n,o,s),p=u[0],m=u[1],h=Mg(["react-colorful",t]);return H.createElement("div",Eg({},i,{ref:l,className:h}),H.createElement(yae,{hsva:p,onChange:m}),H.createElement(bae,{hue:p.h,onChange:m}),H.createElement(jae,{hsva:p,onChange:m,className:"react-colorful__last-control"}))},Iae={defaultColor:{r:0,g:0,b:0,a:1},toHsva:xae,fromHsva:vae,equal:yO},CO=function(e){return H.createElement(_ae,Eg({},e,{colorModel:Iae}))};const Pae=e=>{const{nodeId:t,field:n}=e,r=te(),o=d.useCallback(s=>{r(oA({nodeId:t,fieldName:n.name,value:s}))},[r,n.name,t]);return a.jsx(CO,{className:"nodrag",color:n.value,onChange:o})},Eae=d.memo(Pae),wO=e=>{const t=el("models"),[n,r,o]=e.split("/"),s=sA.safeParse({base_model:n,model_name:o});if(!s.success){t.error({controlNetModelId:e,errors:s.error.format()},"Failed to parse ControlNet model id");return}return s.data},Mae=e=>{const{nodeId:t,field:n}=e,r=n.value,o=te(),{data:s}=gh(),i=d.useMemo(()=>(s==null?void 0:s.entities[`${r==null?void 0:r.base_model}/controlnet/${r==null?void 0:r.model_name}`])??null,[r==null?void 0:r.base_model,r==null?void 0:r.model_name,s==null?void 0:s.entities]),l=d.useMemo(()=>{if(!s)return[];const p=[];return $n(s.entities,(m,h)=>{m&&p.push({value:h,label:m.model_name,group:mn[m.base_model]})}),p},[s]),u=d.useCallback(p=>{if(!p)return;const m=wO(p);m&&o(aA({nodeId:t,fieldName:n.name,value:m}))},[o,n.name,t]);return a.jsx(On,{className:"nowheel nodrag",tooltip:i==null?void 0:i.description,value:(i==null?void 0:i.id)??null,placeholder:"Pick one",error:!i,data:l,onChange:u,sx:{width:"100%"}})},Oae=d.memo(Mae),Rae=e=>{const{nodeId:t,field:n,fieldTemplate:r}=e,o=te(),s=d.useCallback(i=>{o(iA({nodeId:t,fieldName:n.name,value:i.target.value}))},[o,n.name,t]);return a.jsx(Q3,{className:"nowheel nodrag",onChange:s,value:n.value,children:r.options.map(i=>a.jsx("option",{value:i,children:r.ui_choice_labels?r.ui_choice_labels[i]:i},i))})},Dae=d.memo(Rae),Aae=e=>{var p;const{nodeId:t,field:n}=e,r=te(),{currentData:o}=to(((p=n.value)==null?void 0:p.image_name)??$r.skipToken),s=d.useCallback(()=>{r(lA({nodeId:t,fieldName:n.name,value:void 0}))},[r,n.name,t]),i=d.useMemo(()=>{if(o)return{id:`node-${t}-${n.name}`,payloadType:"IMAGE_DTO",payload:{imageDTO:o}}},[n.name,o,t]),l=d.useMemo(()=>({id:`node-${t}-${n.name}`,actionType:"SET_NODES_IMAGE",context:{nodeId:t,fieldName:n.name}}),[n.name,t]),u=d.useMemo(()=>({type:"SET_NODES_IMAGE",nodeId:t,fieldName:n.name}),[t,n.name]);return a.jsx(L,{className:"nodrag",sx:{w:"full",h:"full",alignItems:"center",justifyContent:"center"},children:a.jsx(ua,{imageDTO:o,droppableData:l,draggableData:i,postUploadAction:u,useThumbailFallback:!0,uploadElement:a.jsx(SO,{}),dropLabel:a.jsx(kO,{}),minSize:8,children:a.jsx(Li,{onClick:s,icon:o?a.jsx(Ud,{}):void 0,tooltip:"Reset Image"})})})},Tae=d.memo(Aae),SO=d.memo(()=>a.jsx(ve,{fontSize:16,fontWeight:600,children:"Drop or Upload"}));SO.displayName="UploadElement";const kO=d.memo(()=>a.jsx(ve,{fontSize:16,fontWeight:600,children:"Drop"}));kO.displayName="DropLabel";const Nae=e=>{const t=el("models"),[n,r,o]=e.split("/"),s=cA.safeParse({base_model:n,model_name:o});if(!s.success){t.error({loraModelId:e,errors:s.error.format()},"Failed to parse LoRA model id");return}return s.data},$ae=e=>{const{nodeId:t,field:n}=e,r=n.value,o=te(),{data:s}=Cd(),{t:i}=Z(),l=d.useMemo(()=>{if(!s)return[];const m=[];return $n(s.entities,(h,g)=>{h&&m.push({value:g,label:h.model_name,group:mn[h.base_model]})}),m.sort((h,g)=>h.disabled&&!g.disabled?1:-1)},[s]),u=d.useMemo(()=>(s==null?void 0:s.entities[`${r==null?void 0:r.base_model}/lora/${r==null?void 0:r.model_name}`])??null,[s==null?void 0:s.entities,r==null?void 0:r.base_model,r==null?void 0:r.model_name]),p=d.useCallback(m=>{if(!m)return;const h=Nae(m);h&&o(uA({nodeId:t,fieldName:n.name,value:h}))},[o,n.name,t]);return(s==null?void 0:s.ids.length)===0?a.jsx(L,{sx:{justifyContent:"center",p:2},children:a.jsx(ve,{sx:{fontSize:"sm",color:"base.500",_dark:"base.700"},children:"No LoRAs Loaded"})}):a.jsx(nn,{className:"nowheel nodrag",value:(u==null?void 0:u.id)??null,placeholder:l.length>0?i("models.selectLoRA"):i("models.noLoRAsAvailable"),data:l,nothingFound:i("models.noMatchingLoRAs"),itemComponent:ci,disabled:l.length===0,filter:(m,h)=>{var g;return((g=h.label)==null?void 0:g.toLowerCase().includes(m.toLowerCase().trim()))||h.value.toLowerCase().includes(m.toLowerCase().trim())},error:!u,onChange:p,sx:{width:"100%",".mantine-Select-dropdown":{width:"16rem !important"}}})},Lae=d.memo($ae),Og=e=>{const t=el("models"),[n,r,o]=e.split("/"),s=dA.safeParse({base_model:n,model_name:o,model_type:r});if(!s.success){t.error({mainModelId:e,errors:s.error.format()},"Failed to parse main model id");return}return s.data};function Gc(e){const{iconMode:t=!1,...n}=e,r=te(),{t:o}=Z(),[s,{isLoading:i}]=fA(),l=()=>{s().unwrap().then(u=>{r(ct(Qt({title:`${o("modelManager.modelsSynced")}`,status:"success"})))}).catch(u=>{u&&r(ct(Qt({title:`${o("modelManager.modelSyncFailed")}`,status:"error"})))})};return t?a.jsx(Fe,{icon:a.jsx(bM,{}),tooltip:o("modelManager.syncModels"),"aria-label":o("modelManager.syncModels"),isLoading:i,onClick:l,size:"sm",...n}):a.jsx(at,{isLoading:i,onClick:l,minW:"max-content",...n,children:"Sync Models"})}const zae=e=>{var y,b;const{nodeId:t,field:n}=e,r=te(),o=Bt("syncModels").isFeatureEnabled,{t:s}=Z(),{data:i,isLoading:l}=Ku(gw),{data:u,isLoading:p}=Xo(gw),m=d.useMemo(()=>l||p,[l,p]),h=d.useMemo(()=>{if(!u)return[];const w=[];return $n(u.entities,(S,j)=>{S&&w.push({value:j,label:S.model_name,group:mn[S.base_model]})}),i&&$n(i.entities,(S,j)=>{S&&w.push({value:j,label:S.model_name,group:mn[S.base_model]})}),w},[u,i]),g=d.useMemo(()=>{var w,S,j,_;return((u==null?void 0:u.entities[`${(w=n.value)==null?void 0:w.base_model}/main/${(S=n.value)==null?void 0:S.model_name}`])||(i==null?void 0:i.entities[`${(j=n.value)==null?void 0:j.base_model}/onnx/${(_=n.value)==null?void 0:_.model_name}`]))??null},[(y=n.value)==null?void 0:y.base_model,(b=n.value)==null?void 0:b.model_name,u==null?void 0:u.entities,i==null?void 0:i.entities]),x=d.useCallback(w=>{if(!w)return;const S=Og(w);S&&r(kI({nodeId:t,fieldName:n.name,value:S}))},[r,n.name,t]);return a.jsxs(L,{sx:{w:"full",alignItems:"center",gap:2},children:[m?a.jsx(ve,{variant:"subtext",children:"Loading..."}):a.jsx(nn,{className:"nowheel nodrag",tooltip:g==null?void 0:g.description,value:g==null?void 0:g.id,placeholder:h.length>0?s("models.selectModel"):s("models.noModelsAvailable"),data:h,error:!g,disabled:h.length===0,onChange:x,sx:{width:"100%",".mantine-Select-dropdown":{width:"16rem !important"}}}),o&&a.jsx(Gc,{className:"nodrag",iconMode:!0})]})},Fae=d.memo(zae),ch=/^-?(0\.)?\.?$/,jO=ke((e,t)=>{const{label:n,isDisabled:r=!1,showStepper:o=!0,isInvalid:s,value:i,onChange:l,min:u,max:p,isInteger:m=!0,formControlProps:h,formLabelProps:g,numberInputFieldProps:x,numberInputStepperProps:y,tooltipProps:b,...w}=e,S=te(),[j,_]=d.useState(String(i));d.useEffect(()=>{!j.match(ch)&&i!==Number(j)&&_(String(i))},[i,j]);const E=D=>{_(D),D.match(ch)||l(m?Math.floor(Number(D)):Number(D))},I=D=>{const A=Fi(m?Math.floor(Number(D.target.value)):Number(D.target.value),u,p);_(String(A)),l(A)},M=d.useCallback(D=>{D.shiftKey&&S(Nr(!0))},[S]),R=d.useCallback(D=>{D.shiftKey||S(Nr(!1))},[S]);return a.jsx(Ht,{...b,children:a.jsxs(Kt,{ref:t,isDisabled:r,isInvalid:s,...h,children:[n&&a.jsx(wn,{...g,children:n}),a.jsxs(Lh,{value:j,min:u,max:p,keepWithinRange:!0,clampValueOnBlur:!1,onChange:E,onBlur:I,...w,onPaste:e2,children:[a.jsx(Fh,{...x,onKeyDown:M,onKeyUp:R}),o&&a.jsxs(zh,{children:[a.jsx(Hh,{...y}),a.jsx(Bh,{...y})]})]})]})})});jO.displayName="IAINumberInput";const Kc=d.memo(jO),Bae=e=>{const{nodeId:t,field:n,fieldTemplate:r}=e,o=te(),[s,i]=d.useState(String(n.value)),l=d.useMemo(()=>r.type==="integer",[r.type]),u=p=>{i(p),p.match(ch)||o(pA({nodeId:t,fieldName:n.name,value:l?Math.floor(Number(p)):Number(p)}))};return d.useEffect(()=>{!s.match(ch)&&n.value!==Number(s)&&i(String(n.value))},[n.value,s]),a.jsxs(Lh,{onChange:u,value:s,step:l?1:.1,precision:l?0:3,children:[a.jsx(Fh,{className:"nodrag"}),a.jsxs(zh,{children:[a.jsx(Hh,{}),a.jsx(Bh,{})]})]})},Hae=d.memo(Bae),Vae=e=>{var h,g;const{nodeId:t,field:n}=e,r=te(),{t:o}=Z(),s=Bt("syncModels").isFeatureEnabled,{data:i,isLoading:l}=Xo(nb),u=d.useMemo(()=>{if(!i)return[];const x=[];return $n(i.entities,(y,b)=>{y&&x.push({value:b,label:y.model_name,group:mn[y.base_model]})}),x},[i]),p=d.useMemo(()=>{var x,y;return(i==null?void 0:i.entities[`${(x=n.value)==null?void 0:x.base_model}/main/${(y=n.value)==null?void 0:y.model_name}`])??null},[(h=n.value)==null?void 0:h.base_model,(g=n.value)==null?void 0:g.model_name,i==null?void 0:i.entities]),m=d.useCallback(x=>{if(!x)return;const y=Og(x);y&&r(mA({nodeId:t,fieldName:n.name,value:y}))},[r,n.name,t]);return l?a.jsx(nn,{label:o("modelManager.model"),placeholder:o("models.loading"),disabled:!0,data:[]}):a.jsxs(L,{w:"100%",alignItems:"center",gap:2,children:[a.jsx(nn,{className:"nowheel nodrag",tooltip:p==null?void 0:p.description,value:p==null?void 0:p.id,placeholder:u.length>0?o("models.selectModel"):o("models.noModelsAvailable"),data:u,error:!p,disabled:u.length===0,onChange:m,sx:{width:"100%",".mantine-Select-dropdown":{width:"16rem !important"}}}),s&&a.jsx(Gc,{className:"nodrag",iconMode:!0})]})},Wae=d.memo(Vae),Uae=e=>{var g,x;const{nodeId:t,field:n}=e,r=te(),{t:o}=Z(),s=Bt("syncModels").isFeatureEnabled,{data:i}=Ku(vw),{data:l,isLoading:u}=Xo(vw),p=d.useMemo(()=>{if(!l)return[];const y=[];return $n(l.entities,(b,w)=>{!b||b.base_model!=="sdxl"||y.push({value:w,label:b.model_name,group:mn[b.base_model]})}),i&&$n(i.entities,(b,w)=>{!b||b.base_model!=="sdxl"||y.push({value:w,label:b.model_name,group:mn[b.base_model]})}),y},[l,i]),m=d.useMemo(()=>{var y,b,w,S;return((l==null?void 0:l.entities[`${(y=n.value)==null?void 0:y.base_model}/main/${(b=n.value)==null?void 0:b.model_name}`])||(i==null?void 0:i.entities[`${(w=n.value)==null?void 0:w.base_model}/onnx/${(S=n.value)==null?void 0:S.model_name}`]))??null},[(g=n.value)==null?void 0:g.base_model,(x=n.value)==null?void 0:x.model_name,l==null?void 0:l.entities,i==null?void 0:i.entities]),h=d.useCallback(y=>{if(!y)return;const b=Og(y);b&&r(kI({nodeId:t,fieldName:n.name,value:b}))},[r,n.name,t]);return u?a.jsx(nn,{label:o("modelManager.model"),placeholder:o("models.loading"),disabled:!0,data:[]}):a.jsxs(L,{w:"100%",alignItems:"center",gap:2,children:[a.jsx(nn,{className:"nowheel nodrag",tooltip:m==null?void 0:m.description,value:m==null?void 0:m.id,placeholder:p.length>0?o("models.selectModel"):o("models.noModelsAvailable"),data:p,error:!m,disabled:p.length===0,onChange:h,sx:{width:"100%",".mantine-Select-dropdown":{width:"16rem !important"}}}),s&&a.jsx(Gc,{className:"nodrag",iconMode:!0})]})},Gae=d.memo(Uae),Kae=ce([xe],({ui:e})=>{const{favoriteSchedulers:t}=e;return{data:nr(mh,(r,o)=>({value:o,label:r,group:t.includes(o)?"Favorites":void 0})).sort((r,o)=>r.label.localeCompare(o.label))}},je),qae=e=>{const{nodeId:t,field:n}=e,r=te(),{data:o}=W(Kae),s=d.useCallback(i=>{i&&r(hA({nodeId:t,fieldName:n.name,value:i}))},[r,n.name,t]);return a.jsx(nn,{className:"nowheel nodrag",value:n.value,data:o,onChange:s})},Xae=d.memo(qae),Qae=e=>{const{nodeId:t,field:n,fieldTemplate:r}=e,o=te(),s=d.useCallback(i=>{o(gA({nodeId:t,fieldName:n.name,value:i.target.value}))},[o,n.name,t]);return r.ui_component==="textarea"?a.jsx(da,{className:"nodrag",onChange:s,value:n.value,rows:5,resize:"none"}):a.jsx(vo,{onChange:s,value:n.value})},Yae=d.memo(Qae),_O=e=>{const t=el("models"),[n,r,o]=e.split("/"),s=vA.safeParse({base_model:n,model_name:o});if(!s.success){t.error({vaeModelId:e,errors:s.error.format()},"Failed to parse VAE model id");return}return s.data},Zae=e=>{const{nodeId:t,field:n}=e,r=n.value,o=te(),{data:s}=jI(),i=d.useMemo(()=>{if(!s)return[];const p=[{value:"default",label:"Default",group:"Default"}];return $n(s.entities,(m,h)=>{m&&p.push({value:h,label:m.model_name,group:mn[m.base_model]})}),p.sort((m,h)=>m.disabled&&!h.disabled?1:-1)},[s]),l=d.useMemo(()=>(s==null?void 0:s.entities[`${r==null?void 0:r.base_model}/vae/${r==null?void 0:r.model_name}`])??null,[s==null?void 0:s.entities,r]),u=d.useCallback(p=>{if(!p)return;const m=_O(p);m&&o(xA({nodeId:t,fieldName:n.name,value:m}))},[o,n.name,t]);return a.jsx(nn,{className:"nowheel nodrag",itemComponent:ci,tooltip:l==null?void 0:l.description,value:(l==null?void 0:l.id)??"default",placeholder:"Default",data:i,onChange:u,disabled:i.length===0,error:!l,clearable:!0,sx:{width:"100%",".mantine-Select-dropdown":{width:"16rem !important"}}})},Jae=d.memo(Zae),IO=e=>{const t=el("models"),[n,r,o]=e.split("/"),s=bA.safeParse({base_model:n,model_name:o});if(!s.success){t.error({ipAdapterModelId:e,errors:s.error.format()},"Failed to parse IP-Adapter model id");return}return s.data},eie=e=>{const{nodeId:t,field:n}=e,r=n.value,o=te(),{data:s}=Vx(),i=d.useMemo(()=>(s==null?void 0:s.entities[`${r==null?void 0:r.base_model}/ip_adapter/${r==null?void 0:r.model_name}`])??null,[r==null?void 0:r.base_model,r==null?void 0:r.model_name,s==null?void 0:s.entities]),l=d.useMemo(()=>{if(!s)return[];const p=[];return $n(s.entities,(m,h)=>{m&&p.push({value:h,label:m.model_name,group:mn[m.base_model]})}),p},[s]),u=d.useCallback(p=>{if(!p)return;const m=IO(p);m&&o(yA({nodeId:t,fieldName:n.name,value:m}))},[o,n.name,t]);return a.jsx(On,{className:"nowheel nodrag",tooltip:i==null?void 0:i.description,value:(i==null?void 0:i.id)??null,placeholder:"Pick one",error:!i,data:l,onChange:u,sx:{width:"100%"}})},tie=d.memo(eie),nie=e=>{var l;const{nodeId:t,field:n}=e,r=te(),{data:o,hasBoards:s}=yd(void 0,{selectFromResult:({data:u})=>{const p=[{label:"None",value:"none"}];return u==null||u.forEach(({board_id:m,board_name:h})=>{p.push({label:h,value:m})}),{data:p,hasBoards:p.length>1}}}),i=d.useCallback(u=>{r(CA({nodeId:t,fieldName:n.name,value:u&&u!=="none"?{board_id:u}:void 0}))},[r,n.name,t]);return a.jsx(nn,{className:"nowheel nodrag",value:((l=n.value)==null?void 0:l.board_id)??"none",data:o,onChange:i,disabled:!s})},rie=d.memo(nie),oie=({nodeId:e,fieldName:t})=>{const n=hO(e,t),r=Pg(e,t,"input");return(r==null?void 0:r.fieldKind)==="output"?a.jsxs(Ie,{p:2,children:["Output field in input: ",n==null?void 0:n.type]}):(n==null?void 0:n.type)==="string"&&(r==null?void 0:r.type)==="string"||(n==null?void 0:n.type)==="StringPolymorphic"&&(r==null?void 0:r.type)==="StringPolymorphic"?a.jsx(Yae,{nodeId:e,field:n,fieldTemplate:r}):(n==null?void 0:n.type)==="boolean"&&(r==null?void 0:r.type)==="boolean"||(n==null?void 0:n.type)==="BooleanPolymorphic"&&(r==null?void 0:r.type)==="BooleanPolymorphic"?a.jsx(gae,{nodeId:e,field:n,fieldTemplate:r}):(n==null?void 0:n.type)==="integer"&&(r==null?void 0:r.type)==="integer"||(n==null?void 0:n.type)==="float"&&(r==null?void 0:r.type)==="float"||(n==null?void 0:n.type)==="FloatPolymorphic"&&(r==null?void 0:r.type)==="FloatPolymorphic"||(n==null?void 0:n.type)==="IntegerPolymorphic"&&(r==null?void 0:r.type)==="IntegerPolymorphic"?a.jsx(Hae,{nodeId:e,field:n,fieldTemplate:r}):(n==null?void 0:n.type)==="enum"&&(r==null?void 0:r.type)==="enum"?a.jsx(Dae,{nodeId:e,field:n,fieldTemplate:r}):(n==null?void 0:n.type)==="ImageField"&&(r==null?void 0:r.type)==="ImageField"||(n==null?void 0:n.type)==="ImagePolymorphic"&&(r==null?void 0:r.type)==="ImagePolymorphic"?a.jsx(Tae,{nodeId:e,field:n,fieldTemplate:r}):(n==null?void 0:n.type)==="BoardField"&&(r==null?void 0:r.type)==="BoardField"?a.jsx(rie,{nodeId:e,field:n,fieldTemplate:r}):(n==null?void 0:n.type)==="MainModelField"&&(r==null?void 0:r.type)==="MainModelField"?a.jsx(Fae,{nodeId:e,field:n,fieldTemplate:r}):(n==null?void 0:n.type)==="SDXLRefinerModelField"&&(r==null?void 0:r.type)==="SDXLRefinerModelField"?a.jsx(Wae,{nodeId:e,field:n,fieldTemplate:r}):(n==null?void 0:n.type)==="VaeModelField"&&(r==null?void 0:r.type)==="VaeModelField"?a.jsx(Jae,{nodeId:e,field:n,fieldTemplate:r}):(n==null?void 0:n.type)==="LoRAModelField"&&(r==null?void 0:r.type)==="LoRAModelField"?a.jsx(Lae,{nodeId:e,field:n,fieldTemplate:r}):(n==null?void 0:n.type)==="ControlNetModelField"&&(r==null?void 0:r.type)==="ControlNetModelField"?a.jsx(Oae,{nodeId:e,field:n,fieldTemplate:r}):(n==null?void 0:n.type)==="IPAdapterModelField"&&(r==null?void 0:r.type)==="IPAdapterModelField"?a.jsx(tie,{nodeId:e,field:n,fieldTemplate:r}):(n==null?void 0:n.type)==="ColorField"&&(r==null?void 0:r.type)==="ColorField"?a.jsx(Eae,{nodeId:e,field:n,fieldTemplate:r}):(n==null?void 0:n.type)==="SDXLMainModelField"&&(r==null?void 0:r.type)==="SDXLMainModelField"?a.jsx(Gae,{nodeId:e,field:n,fieldTemplate:r}):(n==null?void 0:n.type)==="Scheduler"&&(r==null?void 0:r.type)==="Scheduler"?a.jsx(Xae,{nodeId:e,field:n,fieldTemplate:r}):n&&r?null:a.jsx(Ie,{p:1,children:a.jsxs(ve,{sx:{fontSize:"sm",fontWeight:600,color:"error.400",_dark:{color:"error.300"}},children:["Unknown field type: ",n==null?void 0:n.type]})})},PO=d.memo(oie),sie=({nodeId:e,fieldName:t})=>{const n=te(),{isMouseOverNode:r,handleMouseOut:o,handleMouseOver:s}=fO(e),{t:i}=Z(),l=d.useCallback(()=>{n(_I({nodeId:e,fieldName:t}))},[n,t,e]);return a.jsxs(L,{onMouseEnter:s,onMouseLeave:o,layerStyle:"second",sx:{position:"relative",borderRadius:"base",w:"full",p:2},children:[a.jsxs(Kt,{as:L,sx:{flexDir:"column",gap:1,flexShrink:1},children:[a.jsxs(wn,{sx:{display:"flex",alignItems:"center",mb:0},children:[a.jsx(gO,{nodeId:e,fieldName:t,kind:"input"}),a.jsx(ba,{}),a.jsx(Ht,{label:a.jsx(t2,{nodeId:e,fieldName:t,kind:"input"}),openDelay:yh,placement:"top",hasArrow:!0,children:a.jsx(L,{h:"full",alignItems:"center",children:a.jsx(Tn,{as:fM})})}),a.jsx(Fe,{"aria-label":i("nodes.removeLinearView"),tooltip:i("nodes.removeLinearView"),variant:"ghost",size:"sm",onClick:l,icon:a.jsx(Br,{})})]}),a.jsx(PO,{nodeId:e,fieldName:t})]}),a.jsx(dO,{isSelected:!1,isHovered:r})]})},aie=d.memo(sie),iie=ce(xe,({nodes:e})=>({fields:e.workflow.exposedFields}),je),lie=()=>{const{fields:e}=W(iie),{t}=Z();return a.jsx(Ie,{sx:{position:"relative",w:"full",h:"full"},children:a.jsx(Zd,{children:a.jsx(L,{sx:{position:"relative",flexDir:"column",alignItems:"flex-start",p:1,gap:2,h:"full",w:"full"},children:e.length?e.map(({nodeId:n,fieldName:r})=>a.jsx(aie,{nodeId:n,fieldName:r},`${n}.${r}`)):a.jsx(Zn,{label:t("nodes.noFieldsLinearview"),icon:null})})})})},cie=d.memo(lie),uie=()=>a.jsx(L,{layerStyle:"first",sx:{flexDir:"column",w:"full",h:"full",borderRadius:"base",p:2,gap:2},children:a.jsxs(rl,{variant:"line",sx:{display:"flex",flexDir:"column",w:"full",h:"full"},children:[a.jsxs(ol,{children:[a.jsx(Tr,{children:"Linear"}),a.jsx(Tr,{children:"Details"}),a.jsx(Tr,{children:"JSON"})]}),a.jsxs(zc,{children:[a.jsx(So,{children:a.jsx(cie,{})}),a.jsx(So,{children:a.jsx(aae,{})}),a.jsx(So,{children:a.jsx(dae,{})})]})]})}),die=d.memo(uie),fie={paramNegativeConditioning:{placement:"right"},controlNet:{href:"https://support.invoke.ai/support/solutions/articles/151000105880"},lora:{href:"https://support.invoke.ai/support/solutions/articles/151000159072"},compositingCoherenceMode:{href:"https://support.invoke.ai/support/solutions/articles/151000158838"},infillMethod:{href:"https://support.invoke.ai/support/solutions/articles/151000158841"},scaleBeforeProcessing:{href:"https://support.invoke.ai/support/solutions/articles/151000158841"},paramIterations:{href:"https://support.invoke.ai/support/solutions/articles/151000159073"},paramPositiveConditioning:{href:"https://support.invoke.ai/support/solutions/articles/151000096606-tips-on-crafting-prompts",placement:"right"},paramScheduler:{placement:"right",href:"https://support.invoke.ai/support/solutions/articles/151000159073"},paramModel:{placement:"right",href:"https://support.invoke.ai/support/solutions/articles/151000096601-what-is-a-model-which-should-i-use-"},paramRatio:{gutter:16},controlNetControlMode:{placement:"right"},controlNetResizeMode:{placement:"right"},paramVAE:{placement:"right"},paramVAEPrecision:{placement:"right"}},pie=1e3,mie=[{name:"preventOverflow",options:{padding:10}}],EO=ke(({feature:e,children:t,wrapperProps:n,...r},o)=>{const{t:s}=Z(),i=W(g=>g.system.shouldEnableInformationalPopovers),l=d.useMemo(()=>fie[e],[e]),u=d.useMemo(()=>wA(SA(l,["image","href","buttonLabel"]),r),[l,r]),p=d.useMemo(()=>s(`popovers.${e}.heading`),[e,s]),m=d.useMemo(()=>s(`popovers.${e}.paragraphs`,{returnObjects:!0})??[],[e,s]),h=d.useCallback(()=>{l!=null&&l.href&&window.open(l.href)},[l==null?void 0:l.href]);return i?a.jsxs(Ld,{isLazy:!0,closeOnBlur:!1,trigger:"hover",variant:"informational",openDelay:pie,modifiers:mie,placement:"top",...u,children:[a.jsx(Wh,{children:a.jsx(Ie,{ref:o,w:"full",...n,children:t})}),a.jsx(Ac,{children:a.jsxs(zd,{w:96,children:[a.jsx(V3,{}),a.jsx(Uh,{children:a.jsxs(L,{sx:{gap:2,flexDirection:"column",alignItems:"flex-start"},children:[p&&a.jsxs(a.Fragment,{children:[a.jsx(cr,{size:"sm",children:p}),a.jsx(Yn,{})]}),(l==null?void 0:l.image)&&a.jsxs(a.Fragment,{children:[a.jsx(ga,{sx:{objectFit:"contain",maxW:"60%",maxH:"60%",backgroundColor:"white"},src:l.image,alt:"Optional Image"}),a.jsx(Yn,{})]}),m.map(g=>a.jsx(ve,{children:g},g)),(l==null?void 0:l.href)&&a.jsxs(a.Fragment,{children:[a.jsx(Yn,{}),a.jsx(Za,{pt:1,onClick:h,leftIcon:a.jsx(py,{}),alignSelf:"flex-end",variant:"link",children:s("common.learnMore")??p})]})]})})]})})]}):a.jsx(Ie,{ref:o,w:"full",...n,children:t})});EO.displayName="IAIInformationalPopover";const Et=d.memo(EO),hie=ce([xe],e=>{const{initial:t,min:n,sliderMax:r,inputMax:o,fineStep:s,coarseStep:i}=e.config.sd.iterations,{iterations:l}=e.generation,{shouldUseSliders:u}=e.ui,p=e.hotkeys.shift?s:i;return{iterations:l,initial:t,min:n,sliderMax:r,inputMax:o,step:p,shouldUseSliders:u}},je),gie=({asSlider:e})=>{const{iterations:t,initial:n,min:r,sliderMax:o,inputMax:s,step:i,shouldUseSliders:l}=W(hie),u=te(),{t:p}=Z(),m=d.useCallback(g=>{u(xw(g))},[u]),h=d.useCallback(()=>{u(xw(n))},[u,n]);return e||l?a.jsx(Et,{feature:"paramIterations",children:a.jsx(tt,{label:p("parameters.iterations"),step:i,min:r,max:o,onChange:m,handleReset:h,value:t,withInput:!0,withReset:!0,withSliderMarks:!0,sliderNumberInputProps:{max:s}})}):a.jsx(Et,{feature:"paramIterations",children:a.jsx(Kc,{label:p("parameters.iterations"),step:i,min:r,max:s,onChange:m,value:t,numberInputFieldProps:{textAlign:"center"}})})},rs=d.memo(gie),vie=()=>{const[e,t]=d.useState(!1),[n,r]=d.useState(!1),o=d.useRef(null),s=Jy(),i=d.useCallback(()=>{o.current&&o.current.setLayout([50,50])},[]);return a.jsxs(L,{sx:{flexDir:"column",gap:2,height:"100%",width:"100%"},children:[a.jsx(Q8,{}),a.jsx(L,{layerStyle:"first",sx:{w:"full",position:"relative",borderRadius:"base",p:2,pb:3,gap:2,flexDir:"column"},children:a.jsx(rs,{asSlider:!0})}),a.jsxs(Ig,{ref:o,id:"workflow-panel-group",autoSaveId:"workflow-panel-group",direction:"vertical",style:{height:"100%",width:"100%"},storage:s,children:[a.jsx(Qa,{id:"workflow",collapsible:!0,onCollapse:t,minSize:25,children:a.jsx(die,{})}),a.jsx(lh,{direction:"vertical",onDoubleClick:i,collapsedDirection:e?"top":n?"bottom":void 0}),a.jsx(Qa,{id:"inspector",collapsible:!0,onCollapse:r,minSize:25,children:a.jsx(eae,{})})]})]})},xie=d.memo(vie),Zj=(e,t)=>{const n=d.useRef(null),[r,o]=d.useState(()=>{var p;return!!((p=n.current)!=null&&p.getCollapsed())}),s=d.useCallback(()=>{var p;(p=n.current)!=null&&p.getCollapsed()?qr.flushSync(()=>{var m;(m=n.current)==null||m.expand()}):qr.flushSync(()=>{var m;(m=n.current)==null||m.collapse()})},[]),i=d.useCallback(()=>{qr.flushSync(()=>{var p;(p=n.current)==null||p.expand()})},[]),l=d.useCallback(()=>{qr.flushSync(()=>{var p;(p=n.current)==null||p.collapse()})},[]),u=d.useCallback(()=>{qr.flushSync(()=>{var p;(p=n.current)==null||p.resize(e,t)})},[e,t]);return{ref:n,minSize:e,isCollapsed:r,setIsCollapsed:o,reset:u,toggle:s,expand:i,collapse:l}},bie=({isGalleryCollapsed:e,galleryPanelRef:t})=>{const{t:n}=Z(),r=()=>{var o;(o=t.current)==null||o.expand()};return e?a.jsx(Ac,{children:a.jsx(L,{pos:"absolute",transform:"translate(0, -50%)",minW:8,top:"50%",insetInlineEnd:"1.63rem",children:a.jsx(Fe,{tooltip:"Show Gallery (G)",tooltipProps:{placement:"top"},"aria-label":n("accessibility.showGalleryPanel"),onClick:r,icon:a.jsx(Soe,{}),sx:{p:0,px:3,h:48,borderEndRadius:0}})})}):null},yie=d.memo(bie),Op={borderStartRadius:0,flexGrow:1},Cie=({isSidePanelCollapsed:e,sidePanelRef:t})=>{const{t:n}=Z(),r=()=>{var o;(o=t.current)==null||o.expand()};return e?a.jsx(Ac,{children:a.jsxs(L,{pos:"absolute",transform:"translate(0, -50%)",minW:8,top:"50%",insetInlineStart:"5.13rem",direction:"column",gap:2,h:48,children:[a.jsxs(Vt,{isAttached:!0,orientation:"vertical",flexGrow:3,children:[a.jsx(Fe,{tooltip:n("parameters.showOptionsPanel"),"aria-label":n("parameters.showOptionsPanel"),onClick:r,sx:Op,icon:a.jsx(xM,{})}),a.jsx(K8,{asIconButton:!0,sx:Op}),a.jsx(H8,{asIconButton:!0,sx:Op})]}),a.jsx(qy,{asIconButton:!0,sx:Op})]})}):null},wie=d.memo(Cie),Sie=e=>{const{label:t,activeLabel:n,children:r,defaultIsOpen:o=!1}=e,{isOpen:s,onToggle:i}=Lr({defaultIsOpen:o}),{colorMode:l}=ha();return a.jsxs(Ie,{children:[a.jsxs(L,{onClick:i,sx:{alignItems:"center",p:2,px:4,gap:2,borderTopRadius:"base",borderBottomRadius:s?0:"base",bg:Ae("base.250","base.750")(l),color:Ae("base.900","base.100")(l),_hover:{bg:Ae("base.300","base.700")(l)},fontSize:"sm",fontWeight:600,cursor:"pointer",transitionProperty:"common",transitionDuration:"normal",userSelect:"none"},"data-testid":`${t} collapsible`,children:[t,a.jsx(dr,{children:n&&a.jsx(In.div,{initial:{opacity:0},animate:{opacity:1,transition:{duration:.1}},exit:{opacity:0,transition:{duration:.1}},children:a.jsx(ve,{sx:{color:"accent.500",_dark:{color:"accent.300"}},children:n})},"statusText")}),a.jsx(ba,{}),a.jsx(gg,{sx:{w:"1rem",h:"1rem",transform:s?"rotate(0deg)":"rotate(180deg)",transitionProperty:"common",transitionDuration:"normal"}})]}),a.jsx(Id,{in:s,animateOpacity:!0,style:{overflow:"unset"},children:a.jsx(Ie,{sx:{p:4,pb:4,borderBottomRadius:"base",bg:"base.150",_dark:{bg:"base.800"}},children:r})})]})},oo=d.memo(Sie),kie=ce(xe,e=>{const{maxPrompts:t,combinatorial:n}=e.dynamicPrompts,{min:r,sliderMax:o,inputMax:s}=e.config.sd.dynamicPrompts.maxPrompts;return{maxPrompts:t,min:r,sliderMax:o,inputMax:s,isDisabled:!n}},je),jie=()=>{const{maxPrompts:e,min:t,sliderMax:n,inputMax:r,isDisabled:o}=W(kie),s=te(),{t:i}=Z(),l=d.useCallback(p=>{s(kA(p))},[s]),u=d.useCallback(()=>{s(jA())},[s]);return a.jsx(Et,{feature:"dynamicPromptsMaxPrompts",children:a.jsx(tt,{label:i("dynamicPrompts.maxPrompts"),isDisabled:o,min:t,max:n,value:e,onChange:l,sliderNumberInputProps:{max:r},withSliderMarks:!0,withInput:!0,withReset:!0,handleReset:u})})},_ie=d.memo(jie),Iie=ce(xe,e=>{const{isLoading:t,isError:n,prompts:r,parsingError:o}=e.dynamicPrompts;return{prompts:r,parsingError:o,isError:n,isLoading:t}},je),Pie={"&::marker":{color:"base.500",_dark:{color:"base.500"}}},Eie=()=>{const{prompts:e,parsingError:t,isLoading:n,isError:r}=W(Iie);return r?a.jsx(Et,{feature:"dynamicPrompts",children:a.jsx(L,{w:"full",h:"full",layerStyle:"second",alignItems:"center",justifyContent:"center",p:8,children:a.jsx(Zn,{icon:voe,label:"Problem generating prompts"})})}):a.jsx(Et,{feature:"dynamicPrompts",children:a.jsxs(Kt,{isInvalid:!!t,children:[a.jsxs(wn,{whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",children:["Prompts Preview (",e.length,")",t&&` - ${t}`]}),a.jsxs(L,{h:64,pos:"relative",layerStyle:"third",borderRadius:"base",p:2,children:[a.jsx(Zd,{children:a.jsx(d3,{stylePosition:"inside",ms:0,children:e.map((o,s)=>a.jsx(Qr,{fontSize:"sm",sx:Pie,children:a.jsx(ve,{as:"span",children:o})},`${o}.${s}`))})}),n&&a.jsx(L,{pos:"absolute",w:"full",h:"full",top:0,insetInlineStart:0,layerStyle:"second",opacity:.7,alignItems:"center",justifyContent:"center",children:a.jsx(fa,{})})]})]})})},Mie=d.memo(Eie),MO=d.forwardRef(({label:e,description:t,...n},r)=>a.jsx(Ie,{ref:r,...n,children:a.jsxs(Ie,{children:[a.jsx(ve,{fontWeight:600,children:e}),t&&a.jsx(ve,{size:"xs",variant:"subtext",children:t})]})}));MO.displayName="IAIMantineSelectItemWithDescription";const Oie=d.memo(MO),Rie=()=>{const e=te(),{t}=Z(),n=W(s=>s.dynamicPrompts.seedBehaviour),r=d.useMemo(()=>[{value:"PER_ITERATION",label:t("dynamicPrompts.seedBehaviour.perIterationLabel"),description:t("dynamicPrompts.seedBehaviour.perIterationDesc")},{value:"PER_PROMPT",label:t("dynamicPrompts.seedBehaviour.perPromptLabel"),description:t("dynamicPrompts.seedBehaviour.perPromptDesc")}],[t]),o=d.useCallback(s=>{s&&e(_A(s))},[e]);return a.jsx(Et,{feature:"dynamicPromptsSeedBehaviour",children:a.jsx(On,{label:t("dynamicPrompts.seedBehaviour.label"),value:n,data:r,itemComponent:Oie,onChange:o})})},Die=d.memo(Rie),Aie=()=>{const{t:e}=Z(),t=d.useMemo(()=>ce(xe,({dynamicPrompts:o})=>{const s=o.prompts.length;return s===1?e("dynamicPrompts.promptsWithCount_one",{count:s}):e("dynamicPrompts.promptsWithCount_other",{count:s})}),[e]),n=W(t);return Bt("dynamicPrompting").isFeatureEnabled?a.jsx(oo,{label:e("dynamicPrompts.dynamicPrompts"),activeLabel:n,children:a.jsxs(L,{sx:{gap:2,flexDir:"column"},children:[a.jsx(Mie,{}),a.jsx(Die,{}),a.jsx(_ie,{})]})}):null},qc=d.memo(Aie),Tie=e=>{const t=te(),{lora:n}=e,r=d.useCallback(i=>{t(IA({id:n.id,weight:i}))},[t,n.id]),o=d.useCallback(()=>{t(PA(n.id))},[t,n.id]),s=d.useCallback(()=>{t(EA(n.id))},[t,n.id]);return a.jsx(Et,{feature:"lora",children:a.jsxs(L,{sx:{gap:2.5,alignItems:"flex-end"},children:[a.jsx(tt,{label:n.model_name,value:n.weight,onChange:r,min:-1,max:2,step:.01,withInput:!0,withReset:!0,handleReset:o,withSliderMarks:!0,sliderMarks:[-1,0,1,2],sliderNumberInputProps:{min:-50,max:50}}),a.jsx(Fe,{size:"sm",onClick:s,tooltip:"Remove LoRA","aria-label":"Remove LoRA",icon:a.jsx(Br,{}),colorScheme:"error"})]})})},Nie=d.memo(Tie),$ie=ce(xe,({lora:e})=>({lorasArray:nr(e.loras)}),je),Lie=()=>{const{lorasArray:e}=W($ie);return a.jsx(a.Fragment,{children:e.map((t,n)=>a.jsxs(L,{sx:{flexDirection:"column",gap:2},children:[n>0&&a.jsx(Yn,{pt:1}),a.jsx(Nie,{lora:t})]},t.model_name))})},zie=d.memo(Lie),Fie=ce(xe,({lora:e})=>({loras:e.loras}),je),Bie=()=>{const e=te(),{loras:t}=W(Fie),{data:n}=Cd(),r=W(i=>i.generation.model),o=d.useMemo(()=>{if(!n)return[];const i=[];return $n(n.entities,(l,u)=>{if(!l||u in t)return;const p=(r==null?void 0:r.base_model)!==l.base_model;i.push({value:u,label:l.model_name,disabled:p,group:mn[l.base_model],tooltip:p?`Incompatible base model: ${l.base_model}`:void 0})}),i.sort((l,u)=>l.label&&!u.label?1:-1),i.sort((l,u)=>l.disabled&&!u.disabled?1:-1)},[t,n,r==null?void 0:r.base_model]),s=d.useCallback(i=>{if(!i)return;const l=n==null?void 0:n.entities[i];l&&e(MA(l))},[e,n==null?void 0:n.entities]);return(n==null?void 0:n.ids.length)===0?a.jsx(L,{sx:{justifyContent:"center",p:2},children:a.jsx(ve,{sx:{fontSize:"sm",color:"base.500",_dark:"base.700"},children:"No LoRAs Loaded"})}):a.jsx(nn,{placeholder:o.length===0?"All LoRAs added":"Add LoRA",value:null,data:o,nothingFound:"No matching LoRAs",itemComponent:ci,disabled:o.length===0,filter:(i,l)=>{var u;return((u=l.label)==null?void 0:u.toLowerCase().includes(i.toLowerCase().trim()))||l.value.toLowerCase().includes(i.toLowerCase().trim())},onChange:s,"data-testid":"add-lora"})},Hie=d.memo(Bie),Vie=ce(xe,e=>{const t=II(e.lora.loras);return{activeLabel:t>0?`${t} Active`:void 0}},je),Wie=()=>{const{activeLabel:e}=W(Vie);return Bt("lora").isFeatureEnabled?a.jsx(oo,{label:"LoRA",activeLabel:e,children:a.jsxs(L,{sx:{flexDir:"column",gap:2},children:[a.jsx(Hie,{}),a.jsx(zie,{})]})}):null},Xc=d.memo(Wie),Uie=()=>{const e=te(),t=W(o=>o.generation.shouldUseCpuNoise),{t:n}=Z(),r=d.useCallback(o=>{e(OA(o.target.checked))},[e]);return a.jsx(Et,{feature:"noiseUseCPU",children:a.jsx(dn,{label:n("parameters.useCpuNoise"),isChecked:t,onChange:r})})},os=e=>e.generation,Gie=ce(os,e=>{const{seamlessXAxis:t}=e;return{seamlessXAxis:t}},je),Kie=()=>{const{t:e}=Z(),{seamlessXAxis:t}=W(Gie),n=te(),r=d.useCallback(o=>{n(RA(o.target.checked))},[n]);return a.jsx(dn,{label:e("parameters.seamlessXAxis"),"aria-label":e("parameters.seamlessXAxis"),isChecked:t,onChange:r})},qie=d.memo(Kie),Xie=ce(os,e=>{const{seamlessYAxis:t}=e;return{seamlessYAxis:t}},je),Qie=()=>{const{t:e}=Z(),{seamlessYAxis:t}=W(Xie),n=te(),r=d.useCallback(o=>{n(DA(o.target.checked))},[n]);return a.jsx(dn,{label:e("parameters.seamlessYAxis"),"aria-label":e("parameters.seamlessYAxis"),isChecked:t,onChange:r})},Yie=d.memo(Qie),Zie=()=>{const{t:e}=Z();return Bt("seamless").isFeatureEnabled?a.jsxs(Kt,{children:[a.jsx(wn,{children:e("parameters.seamlessTiling")})," ",a.jsxs(L,{sx:{gap:5},children:[a.jsx(Ie,{flexGrow:1,children:a.jsx(qie,{})}),a.jsx(Ie,{flexGrow:1,children:a.jsx(Yie,{})})]})]}):null},Jie=d.memo(Zie);function ele(){const e=W(u=>u.generation.clipSkip),{model:t}=W(u=>u.generation),n=te(),{t:r}=Z(),o=d.useCallback(u=>{n(bw(u))},[n]),s=d.useCallback(()=>{n(bw(0))},[n]),i=d.useMemo(()=>t?Qf[t.base_model].maxClip:Qf["sd-1"].maxClip,[t]),l=d.useMemo(()=>t?Qf[t.base_model].markers:Qf["sd-1"].markers,[t]);return(t==null?void 0:t.base_model)==="sdxl"?null:a.jsx(Et,{feature:"clipSkip",placement:"top",children:a.jsx(tt,{label:r("parameters.clipSkip"),"aria-label":r("parameters.clipSkip"),min:0,max:i,step:1,value:e,onChange:o,withSliderMarks:!0,sliderMarks:l,withInput:!0,withReset:!0,handleReset:s})})}const tle=ce(xe,e=>{const{clipSkip:t,model:n,seamlessXAxis:r,seamlessYAxis:o,shouldUseCpuNoise:s}=e.generation;return{clipSkip:t,model:n,seamlessXAxis:r,seamlessYAxis:o,shouldUseCpuNoise:s}},je);function Qc(){const{clipSkip:e,model:t,seamlessXAxis:n,seamlessYAxis:r,shouldUseCpuNoise:o}=W(tle),{t:s}=Z(),i=d.useMemo(()=>{const l=[];return o?l.push(s("parameters.cpuNoise")):l.push(s("parameters.gpuNoise")),e>0&&t&&t.base_model!=="sdxl"&&l.push(s("parameters.clipSkipWithLayerCount",{layerCount:e})),n&&r?l.push(s("parameters.seamlessX&Y")):n?l.push(s("parameters.seamlessX")):r&&l.push(s("parameters.seamlessY")),l.join(", ")},[e,t,n,r,o,s]);return a.jsx(oo,{label:s("common.advanced"),activeLabel:i,children:a.jsxs(L,{sx:{flexDir:"column",gap:2},children:[a.jsx(Jie,{}),a.jsx(Yn,{}),t&&(t==null?void 0:t.base_model)!=="sdxl"&&a.jsxs(a.Fragment,{children:[a.jsx(ele,{}),a.jsx(Yn,{pt:2})]}),a.jsx(Uie,{})]})})}const nle=ce(xe,({generation:e})=>{const{model:t}=e;return{mainModel:t}},je),rle=e=>{const{controlNetId:t,model:n,isEnabled:r}=e.controlNet,o=te(),{mainModel:s}=W(nle),{t:i}=Z(),{data:l}=gh(),u=d.useMemo(()=>{if(!l)return[];const h=[];return $n(l.entities,(g,x)=>{if(!g)return;const y=(g==null?void 0:g.base_model)!==(s==null?void 0:s.base_model);h.push({value:x,label:g.model_name,group:mn[g.base_model],disabled:y,tooltip:y?`${i("controlnet.incompatibleBaseModel")} ${g.base_model}`:void 0})}),h},[l,s==null?void 0:s.base_model,i]),p=d.useMemo(()=>(l==null?void 0:l.entities[`${n==null?void 0:n.base_model}/controlnet/${n==null?void 0:n.model_name}`])??null,[n==null?void 0:n.base_model,n==null?void 0:n.model_name,l==null?void 0:l.entities]),m=d.useCallback(h=>{if(!h)return;const g=wO(h);g&&o(PI({controlNetId:t,model:g}))},[t,o]);return a.jsx(nn,{itemComponent:ci,data:u,error:!p||(s==null?void 0:s.base_model)!==p.base_model,placeholder:i("controlnet.selectModel"),value:(p==null?void 0:p.id)??null,onChange:m,disabled:!r,tooltip:p==null?void 0:p.description})},ole=d.memo(rle),sle=e=>{const{weight:t,isEnabled:n,controlNetId:r}=e.controlNet,o=te(),{t:s}=Z(),i=d.useCallback(l=>{o(AA({controlNetId:r,weight:l}))},[r,o]);return a.jsx(Et,{feature:"controlNetWeight",children:a.jsx(tt,{isDisabled:!n,label:s("controlnet.weight"),value:t,onChange:i,min:0,max:2,step:.01,withSliderMarks:!0,sliderMarks:[0,1,2]})})},ale=d.memo(sle),ile=ce(xe,({controlNet:e,gallery:t})=>{const{pendingControlImages:n}=e,{autoAddBoardId:r}=t;return{pendingControlImages:n,autoAddBoardId:r}},je),lle=({isSmall:e,controlNet:t})=>{const{controlImage:n,processedControlImage:r,processorType:o,controlNetId:s}=t,i=te(),{t:l}=Z(),{pendingControlImages:u,autoAddBoardId:p}=W(ile),m=W(Jn),[h,g]=d.useState(!1),{currentData:x}=to(n??$r.skipToken),{currentData:y}=to(r??$r.skipToken),[b]=TA(),[w]=NA(),[S]=$A(),j=d.useCallback(()=>{i(LA({controlNetId:s,controlImage:null}))},[s,i]),_=d.useCallback(async()=>{y&&(await b({imageDTO:y,is_intermediate:!1}).unwrap(),p!=="none"?w({imageDTO:y,board_id:p}):S({imageDTO:y}))},[y,b,p,w,S]),E=d.useCallback(()=>{x&&(m==="unifiedCanvas"?i(Vo({width:x.width,height:x.height})):(i(Bi(x.width)),i(Hi(x.height))))},[x,m,i]),I=d.useCallback(()=>{g(!0)},[]),M=d.useCallback(()=>{g(!1)},[]),R=d.useMemo(()=>{if(x)return{id:s,payloadType:"IMAGE_DTO",payload:{imageDTO:x}}},[x,s]),D=d.useMemo(()=>({id:s,actionType:"SET_CONTROLNET_IMAGE",context:{controlNetId:s}}),[s]),A=d.useMemo(()=>({type:"SET_CONTROLNET_IMAGE",controlNetId:s}),[s]),O=x&&y&&!h&&!u.includes(s)&&o!=="none";return a.jsxs(L,{onMouseEnter:I,onMouseLeave:M,sx:{position:"relative",w:"full",h:e?28:366,alignItems:"center",justifyContent:"center"},children:[a.jsx(ua,{draggableData:R,droppableData:D,imageDTO:x,isDropDisabled:O,postUploadAction:A}),a.jsx(Ie,{sx:{position:"absolute",top:0,insetInlineStart:0,w:"full",h:"full",opacity:O?1:0,transitionProperty:"common",transitionDuration:"normal",pointerEvents:"none"},children:a.jsx(ua,{draggableData:R,droppableData:D,imageDTO:y,isUploadDisabled:!0})}),a.jsxs(a.Fragment,{children:[a.jsx(Li,{onClick:j,icon:x?a.jsx(Ud,{}):void 0,tooltip:l("controlnet.resetControlImage")}),a.jsx(Li,{onClick:_,icon:x?a.jsx(lg,{size:16}):void 0,tooltip:l("controlnet.saveControlImage"),styleOverrides:{marginTop:6}}),a.jsx(Li,{onClick:E,icon:x?a.jsx(eee,{size:16}):void 0,tooltip:l("controlnet.setControlImageDimensions"),styleOverrides:{marginTop:12}})]}),u.includes(s)&&a.jsx(L,{sx:{position:"absolute",top:0,insetInlineStart:0,w:"full",h:"full",alignItems:"center",justifyContent:"center",opacity:.8,borderRadius:"base",bg:"base.400",_dark:{bg:"base.900"}},children:a.jsx(fa,{size:"xl",sx:{color:"base.100",_dark:{color:"base.400"}}})})]})},Jj=d.memo(lle),Io=()=>{const e=te();return d.useCallback((n,r)=>{e(zA({controlNetId:n,changes:r}))},[e])};function Po(e){return a.jsx(L,{sx:{flexDirection:"column",gap:2,pb:2},children:e.children})}const e_=Fr.canny_image_processor.default,cle=e=>{const{controlNetId:t,processorNode:n,isEnabled:r}=e,{low_threshold:o,high_threshold:s}=n,i=Io(),{t:l}=Z(),u=d.useCallback(g=>{i(t,{low_threshold:g})},[t,i]),p=d.useCallback(()=>{i(t,{low_threshold:e_.low_threshold})},[t,i]),m=d.useCallback(g=>{i(t,{high_threshold:g})},[t,i]),h=d.useCallback(()=>{i(t,{high_threshold:e_.high_threshold})},[t,i]);return a.jsxs(Po,{children:[a.jsx(tt,{isDisabled:!r,label:l("controlnet.lowThreshold"),value:o,onChange:u,handleReset:p,withReset:!0,min:0,max:255,withInput:!0,withSliderMarks:!0}),a.jsx(tt,{isDisabled:!r,label:l("controlnet.highThreshold"),value:s,onChange:m,handleReset:h,withReset:!0,min:0,max:255,withInput:!0,withSliderMarks:!0})]})},ule=d.memo(cle),dle=Fr.color_map_image_processor.default,fle=e=>{const{controlNetId:t,processorNode:n,isEnabled:r}=e,{color_map_tile_size:o}=n,s=Io(),{t:i}=Z(),l=d.useCallback(p=>{s(t,{color_map_tile_size:p})},[t,s]),u=d.useCallback(()=>{s(t,{color_map_tile_size:dle.color_map_tile_size})},[t,s]);return a.jsx(Po,{children:a.jsx(tt,{isDisabled:!r,label:i("controlnet.colorMapTileSize"),value:o,onChange:l,handleReset:u,withReset:!0,min:1,max:256,step:1,withInput:!0,withSliderMarks:!0,sliderNumberInputProps:{max:4096}})})},ple=d.memo(fle),_u=Fr.content_shuffle_image_processor.default,mle=e=>{const{controlNetId:t,processorNode:n,isEnabled:r}=e,{image_resolution:o,detect_resolution:s,w:i,h:l,f:u}=n,p=Io(),{t:m}=Z(),h=d.useCallback(I=>{p(t,{detect_resolution:I})},[t,p]),g=d.useCallback(()=>{p(t,{detect_resolution:_u.detect_resolution})},[t,p]),x=d.useCallback(I=>{p(t,{image_resolution:I})},[t,p]),y=d.useCallback(()=>{p(t,{image_resolution:_u.image_resolution})},[t,p]),b=d.useCallback(I=>{p(t,{w:I})},[t,p]),w=d.useCallback(()=>{p(t,{w:_u.w})},[t,p]),S=d.useCallback(I=>{p(t,{h:I})},[t,p]),j=d.useCallback(()=>{p(t,{h:_u.h})},[t,p]),_=d.useCallback(I=>{p(t,{f:I})},[t,p]),E=d.useCallback(()=>{p(t,{f:_u.f})},[t,p]);return a.jsxs(Po,{children:[a.jsx(tt,{label:m("controlnet.detectResolution"),value:s,onChange:h,handleReset:g,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(tt,{label:m("controlnet.imageResolution"),value:o,onChange:x,handleReset:y,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(tt,{label:m("controlnet.w"),value:i,onChange:b,handleReset:w,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(tt,{label:m("controlnet.h"),value:l,onChange:S,handleReset:j,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(tt,{label:m("controlnet.f"),value:u,onChange:_,handleReset:E,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r})]})},hle=d.memo(mle),t_=Fr.hed_image_processor.default,gle=e=>{const{controlNetId:t,processorNode:{detect_resolution:n,image_resolution:r,scribble:o},isEnabled:s}=e,i=Io(),{t:l}=Z(),u=d.useCallback(x=>{i(t,{detect_resolution:x})},[t,i]),p=d.useCallback(x=>{i(t,{image_resolution:x})},[t,i]),m=d.useCallback(x=>{i(t,{scribble:x.target.checked})},[t,i]),h=d.useCallback(()=>{i(t,{detect_resolution:t_.detect_resolution})},[t,i]),g=d.useCallback(()=>{i(t,{image_resolution:t_.image_resolution})},[t,i]);return a.jsxs(Po,{children:[a.jsx(tt,{label:l("controlnet.detectResolution"),value:n,onChange:u,handleReset:h,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!s}),a.jsx(tt,{label:l("controlnet.imageResolution"),value:r,onChange:p,handleReset:g,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!s}),a.jsx(dn,{label:l("controlnet.scribble"),isChecked:o,onChange:m,isDisabled:!s})]})},vle=d.memo(gle),n_=Fr.lineart_anime_image_processor.default,xle=e=>{const{controlNetId:t,processorNode:n,isEnabled:r}=e,{image_resolution:o,detect_resolution:s}=n,i=Io(),{t:l}=Z(),u=d.useCallback(g=>{i(t,{detect_resolution:g})},[t,i]),p=d.useCallback(g=>{i(t,{image_resolution:g})},[t,i]),m=d.useCallback(()=>{i(t,{detect_resolution:n_.detect_resolution})},[t,i]),h=d.useCallback(()=>{i(t,{image_resolution:n_.image_resolution})},[t,i]);return a.jsxs(Po,{children:[a.jsx(tt,{label:l("controlnet.detectResolution"),value:s,onChange:u,handleReset:m,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(tt,{label:l("controlnet.imageResolution"),value:o,onChange:p,handleReset:h,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r})]})},ble=d.memo(xle),r_=Fr.lineart_image_processor.default,yle=e=>{const{controlNetId:t,processorNode:n,isEnabled:r}=e,{image_resolution:o,detect_resolution:s,coarse:i}=n,l=Io(),{t:u}=Z(),p=d.useCallback(y=>{l(t,{detect_resolution:y})},[t,l]),m=d.useCallback(y=>{l(t,{image_resolution:y})},[t,l]),h=d.useCallback(()=>{l(t,{detect_resolution:r_.detect_resolution})},[t,l]),g=d.useCallback(()=>{l(t,{image_resolution:r_.image_resolution})},[t,l]),x=d.useCallback(y=>{l(t,{coarse:y.target.checked})},[t,l]);return a.jsxs(Po,{children:[a.jsx(tt,{label:u("controlnet.detectResolution"),value:s,onChange:p,handleReset:h,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(tt,{label:u("controlnet.imageResolution"),value:o,onChange:m,handleReset:g,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(dn,{label:u("controlnet.coarse"),isChecked:i,onChange:x,isDisabled:!r})]})},Cle=d.memo(yle),o_=Fr.mediapipe_face_processor.default,wle=e=>{const{controlNetId:t,processorNode:n,isEnabled:r}=e,{max_faces:o,min_confidence:s}=n,i=Io(),{t:l}=Z(),u=d.useCallback(g=>{i(t,{max_faces:g})},[t,i]),p=d.useCallback(g=>{i(t,{min_confidence:g})},[t,i]),m=d.useCallback(()=>{i(t,{max_faces:o_.max_faces})},[t,i]),h=d.useCallback(()=>{i(t,{min_confidence:o_.min_confidence})},[t,i]);return a.jsxs(Po,{children:[a.jsx(tt,{label:l("controlnet.maxFaces"),value:o,onChange:u,handleReset:m,withReset:!0,min:1,max:20,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(tt,{label:l("controlnet.minConfidence"),value:s,onChange:p,handleReset:h,withReset:!0,min:0,max:1,step:.01,withInput:!0,withSliderMarks:!0,isDisabled:!r})]})},Sle=d.memo(wle),s_=Fr.midas_depth_image_processor.default,kle=e=>{const{controlNetId:t,processorNode:n,isEnabled:r}=e,{a_mult:o,bg_th:s}=n,i=Io(),{t:l}=Z(),u=d.useCallback(g=>{i(t,{a_mult:g})},[t,i]),p=d.useCallback(g=>{i(t,{bg_th:g})},[t,i]),m=d.useCallback(()=>{i(t,{a_mult:s_.a_mult})},[t,i]),h=d.useCallback(()=>{i(t,{bg_th:s_.bg_th})},[t,i]);return a.jsxs(Po,{children:[a.jsx(tt,{label:l("controlnet.amult"),value:o,onChange:u,handleReset:m,withReset:!0,min:0,max:20,step:.01,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(tt,{label:l("controlnet.bgth"),value:s,onChange:p,handleReset:h,withReset:!0,min:0,max:20,step:.01,withInput:!0,withSliderMarks:!0,isDisabled:!r})]})},jle=d.memo(kle),Rp=Fr.mlsd_image_processor.default,_le=e=>{const{controlNetId:t,processorNode:n,isEnabled:r}=e,{image_resolution:o,detect_resolution:s,thr_d:i,thr_v:l}=n,u=Io(),{t:p}=Z(),m=d.useCallback(j=>{u(t,{detect_resolution:j})},[t,u]),h=d.useCallback(j=>{u(t,{image_resolution:j})},[t,u]),g=d.useCallback(j=>{u(t,{thr_d:j})},[t,u]),x=d.useCallback(j=>{u(t,{thr_v:j})},[t,u]),y=d.useCallback(()=>{u(t,{detect_resolution:Rp.detect_resolution})},[t,u]),b=d.useCallback(()=>{u(t,{image_resolution:Rp.image_resolution})},[t,u]),w=d.useCallback(()=>{u(t,{thr_d:Rp.thr_d})},[t,u]),S=d.useCallback(()=>{u(t,{thr_v:Rp.thr_v})},[t,u]);return a.jsxs(Po,{children:[a.jsx(tt,{label:p("controlnet.detectResolution"),value:s,onChange:m,handleReset:y,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(tt,{label:p("controlnet.imageResolution"),value:o,onChange:h,handleReset:b,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(tt,{label:p("controlnet.w"),value:i,onChange:g,handleReset:w,withReset:!0,min:0,max:1,step:.01,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(tt,{label:p("controlnet.h"),value:l,onChange:x,handleReset:S,withReset:!0,min:0,max:1,step:.01,withInput:!0,withSliderMarks:!0,isDisabled:!r})]})},Ile=d.memo(_le),a_=Fr.normalbae_image_processor.default,Ple=e=>{const{controlNetId:t,processorNode:n,isEnabled:r}=e,{image_resolution:o,detect_resolution:s}=n,i=Io(),{t:l}=Z(),u=d.useCallback(g=>{i(t,{detect_resolution:g})},[t,i]),p=d.useCallback(g=>{i(t,{image_resolution:g})},[t,i]),m=d.useCallback(()=>{i(t,{detect_resolution:a_.detect_resolution})},[t,i]),h=d.useCallback(()=>{i(t,{image_resolution:a_.image_resolution})},[t,i]);return a.jsxs(Po,{children:[a.jsx(tt,{label:l("controlnet.detectResolution"),value:s,onChange:u,handleReset:m,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(tt,{label:l("controlnet.imageResolution"),value:o,onChange:p,handleReset:h,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r})]})},Ele=d.memo(Ple),i_=Fr.openpose_image_processor.default,Mle=e=>{const{controlNetId:t,processorNode:n,isEnabled:r}=e,{image_resolution:o,detect_resolution:s,hand_and_face:i}=n,l=Io(),{t:u}=Z(),p=d.useCallback(y=>{l(t,{detect_resolution:y})},[t,l]),m=d.useCallback(y=>{l(t,{image_resolution:y})},[t,l]),h=d.useCallback(()=>{l(t,{detect_resolution:i_.detect_resolution})},[t,l]),g=d.useCallback(()=>{l(t,{image_resolution:i_.image_resolution})},[t,l]),x=d.useCallback(y=>{l(t,{hand_and_face:y.target.checked})},[t,l]);return a.jsxs(Po,{children:[a.jsx(tt,{label:u("controlnet.detectResolution"),value:s,onChange:p,handleReset:h,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(tt,{label:u("controlnet.imageResolution"),value:o,onChange:m,handleReset:g,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(dn,{label:u("controlnet.handAndFace"),isChecked:i,onChange:x,isDisabled:!r})]})},Ole=d.memo(Mle),l_=Fr.pidi_image_processor.default,Rle=e=>{const{controlNetId:t,processorNode:n,isEnabled:r}=e,{image_resolution:o,detect_resolution:s,scribble:i,safe:l}=n,u=Io(),{t:p}=Z(),m=d.useCallback(w=>{u(t,{detect_resolution:w})},[t,u]),h=d.useCallback(w=>{u(t,{image_resolution:w})},[t,u]),g=d.useCallback(()=>{u(t,{detect_resolution:l_.detect_resolution})},[t,u]),x=d.useCallback(()=>{u(t,{image_resolution:l_.image_resolution})},[t,u]),y=d.useCallback(w=>{u(t,{scribble:w.target.checked})},[t,u]),b=d.useCallback(w=>{u(t,{safe:w.target.checked})},[t,u]);return a.jsxs(Po,{children:[a.jsx(tt,{label:p("controlnet.detectResolution"),value:s,onChange:m,handleReset:g,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(tt,{label:p("controlnet.imageResolution"),value:o,onChange:h,handleReset:x,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(dn,{label:p("controlnet.scribble"),isChecked:i,onChange:y}),a.jsx(dn,{label:p("controlnet.safe"),isChecked:l,onChange:b,isDisabled:!r})]})},Dle=d.memo(Rle),Ale=e=>null,Tle=d.memo(Ale),Nle=e=>{const{controlNetId:t,isEnabled:n,processorNode:r}=e.controlNet;return r.type==="canny_image_processor"?a.jsx(ule,{controlNetId:t,processorNode:r,isEnabled:n}):r.type==="color_map_image_processor"?a.jsx(ple,{controlNetId:t,processorNode:r,isEnabled:n}):r.type==="hed_image_processor"?a.jsx(vle,{controlNetId:t,processorNode:r,isEnabled:n}):r.type==="lineart_image_processor"?a.jsx(Cle,{controlNetId:t,processorNode:r,isEnabled:n}):r.type==="content_shuffle_image_processor"?a.jsx(hle,{controlNetId:t,processorNode:r,isEnabled:n}):r.type==="lineart_anime_image_processor"?a.jsx(ble,{controlNetId:t,processorNode:r,isEnabled:n}):r.type==="mediapipe_face_processor"?a.jsx(Sle,{controlNetId:t,processorNode:r,isEnabled:n}):r.type==="midas_depth_image_processor"?a.jsx(jle,{controlNetId:t,processorNode:r,isEnabled:n}):r.type==="mlsd_image_processor"?a.jsx(Ile,{controlNetId:t,processorNode:r,isEnabled:n}):r.type==="normalbae_image_processor"?a.jsx(Ele,{controlNetId:t,processorNode:r,isEnabled:n}):r.type==="openpose_image_processor"?a.jsx(Ole,{controlNetId:t,processorNode:r,isEnabled:n}):r.type==="pidi_image_processor"?a.jsx(Dle,{controlNetId:t,processorNode:r,isEnabled:n}):r.type==="zoe_depth_image_processor"?a.jsx(Tle,{controlNetId:t,processorNode:r,isEnabled:n}):null},$le=d.memo(Nle),Lle=e=>{const{controlNetId:t,isEnabled:n,shouldAutoConfig:r}=e.controlNet,o=te(),{t:s}=Z(),i=d.useCallback(()=>{o(FA({controlNetId:t}))},[t,o]);return a.jsx(dn,{label:s("controlnet.autoConfigure"),"aria-label":s("controlnet.autoConfigure"),isChecked:r,onChange:i,isDisabled:!n})},zle=d.memo(Lle),Fle=e=>{const{controlNet:t}=e,n=te(),{t:r}=Z(),o=d.useCallback(()=>{n(BA({controlNet:t}))},[t,n]),s=d.useCallback(()=>{n(HA({controlNet:t}))},[t,n]);return a.jsxs(L,{sx:{gap:2},children:[a.jsx(Fe,{size:"sm",icon:a.jsx(Qi,{}),tooltip:r("controlnet.importImageFromCanvas"),"aria-label":r("controlnet.importImageFromCanvas"),onClick:o}),a.jsx(Fe,{size:"sm",icon:a.jsx(hM,{}),tooltip:r("controlnet.importMaskFromCanvas"),"aria-label":r("controlnet.importMaskFromCanvas"),onClick:s})]})},Ble=d.memo(Fle),c_=e=>`${Math.round(e*100)}%`,Hle=e=>{const{beginStepPct:t,endStepPct:n,isEnabled:r,controlNetId:o}=e.controlNet,s=te(),{t:i}=Z(),l=d.useCallback(u=>{s(VA({controlNetId:o,beginStepPct:u[0]})),s(WA({controlNetId:o,endStepPct:u[1]}))},[o,s]);return a.jsx(Et,{feature:"controlNetBeginEnd",children:a.jsxs(Kt,{isDisabled:!r,children:[a.jsx(wn,{children:i("controlnet.beginEndStepPercent")}),a.jsx(Rh,{w:"100%",gap:2,alignItems:"center",children:a.jsxs(Bb,{"aria-label":["Begin Step %","End Step %!"],value:[t,n],onChange:l,min:0,max:1,step:.01,minStepsBetweenThumbs:5,isDisabled:!r,children:[a.jsx(Hb,{children:a.jsx(Vb,{})}),a.jsx(Ht,{label:c_(t),placement:"top",hasArrow:!0,children:a.jsx(nd,{index:0})}),a.jsx(Ht,{label:c_(n),placement:"top",hasArrow:!0,children:a.jsx(nd,{index:1})}),a.jsx(Ai,{value:0,sx:{insetInlineStart:"0 !important",insetInlineEnd:"unset !important"},children:"0%"}),a.jsx(Ai,{value:.5,sx:{insetInlineStart:"50% !important",transform:"translateX(-50%)"},children:"50%"}),a.jsx(Ai,{value:1,sx:{insetInlineStart:"unset !important",insetInlineEnd:"0 !important"},children:"100%"})]})})]})})},Vle=d.memo(Hle);function Wle(e){const{controlMode:t,isEnabled:n,controlNetId:r}=e.controlNet,o=te(),{t:s}=Z(),i=[{label:s("controlnet.balanced"),value:"balanced"},{label:s("controlnet.prompt"),value:"more_prompt"},{label:s("controlnet.control"),value:"more_control"},{label:s("controlnet.megaControl"),value:"unbalanced"}],l=d.useCallback(u=>{o(UA({controlNetId:r,controlMode:u}))},[r,o]);return a.jsx(Et,{feature:"controlNetControlMode",children:a.jsx(On,{disabled:!n,label:s("controlnet.controlMode"),data:i,value:String(t),onChange:l})})}const Ule=ce(Ky,e=>nr(Fr,n=>({value:n.type,label:n.label})).sort((n,r)=>n.value==="none"?-1:r.value==="none"?1:n.label.localeCompare(r.label)).filter(n=>!e.sd.disabledControlNetProcessors.includes(n.value)),je),Gle=e=>{const t=te(),{controlNetId:n,isEnabled:r,processorNode:o}=e.controlNet,s=W(Ule),{t:i}=Z(),l=d.useCallback(u=>{t(GA({controlNetId:n,processorType:u}))},[n,t]);return a.jsx(nn,{label:i("controlnet.processor"),value:o.type??"canny_image_processor",data:s,onChange:l,disabled:!r})},Kle=d.memo(Gle);function qle(e){const{resizeMode:t,isEnabled:n,controlNetId:r}=e.controlNet,o=te(),{t:s}=Z(),i=[{label:s("controlnet.resize"),value:"just_resize"},{label:s("controlnet.crop"),value:"crop_resize"},{label:s("controlnet.fill"),value:"fill_resize"}],l=d.useCallback(u=>{o(KA({controlNetId:r,resizeMode:u}))},[r,o]);return a.jsx(Et,{feature:"controlNetResizeMode",children:a.jsx(On,{disabled:!n,label:s("controlnet.resizeMode"),data:i,value:String(t),onChange:l})})}const Xle=e=>{const{controlNet:t}=e,{controlNetId:n}=t,r=te(),{t:o}=Z(),s=W(Jn),i=ce(xe,({controlNet:y})=>{const b=y.controlNets[n];if(!b)return{isEnabled:!1,shouldAutoConfig:!1};const{isEnabled:w,shouldAutoConfig:S}=b;return{isEnabled:w,shouldAutoConfig:S}},je),{isEnabled:l,shouldAutoConfig:u}=W(i),[p,m]=uee(!1),h=d.useCallback(()=>{r(qA({controlNetId:n}))},[n,r]),g=d.useCallback(()=>{r(XA({sourceControlNetId:n,newControlNetId:Zs()}))},[n,r]),x=d.useCallback(y=>{r(QA({controlNetId:n,isEnabled:y.target.checked}))},[n,r]);return a.jsxs(L,{sx:{flexDir:"column",gap:3,p:2,borderRadius:"base",position:"relative",bg:"base.250",_dark:{bg:"base.750"}},children:[a.jsxs(L,{sx:{gap:2,alignItems:"center"},children:[a.jsx(dn,{tooltip:o("controlnet.toggleControlNet"),"aria-label":o("controlnet.toggleControlNet"),isChecked:l,onChange:x}),a.jsx(Ie,{sx:{w:"full",minW:0,transitionProperty:"common",transitionDuration:"0.1s"},children:a.jsx(ole,{controlNet:t})}),s==="unifiedCanvas"&&a.jsx(Ble,{controlNet:t}),a.jsx(Fe,{size:"sm",tooltip:o("controlnet.duplicate"),"aria-label":o("controlnet.duplicate"),onClick:g,icon:a.jsx(Hc,{})}),a.jsx(Fe,{size:"sm",tooltip:o("controlnet.delete"),"aria-label":o("controlnet.delete"),colorScheme:"error",onClick:h,icon:a.jsx(Br,{})}),a.jsx(Fe,{size:"sm",tooltip:o(p?"controlnet.hideAdvanced":"controlnet.showAdvanced"),"aria-label":o(p?"controlnet.hideAdvanced":"controlnet.showAdvanced"),onClick:m,variant:"ghost",sx:{_hover:{bg:"none"}},icon:a.jsx(gg,{sx:{boxSize:4,color:"base.700",transform:p?"rotate(0deg)":"rotate(180deg)",transitionProperty:"common",transitionDuration:"normal",_dark:{color:"base.300"}}})}),!u&&a.jsx(Ie,{sx:{position:"absolute",w:1.5,h:1.5,borderRadius:"full",top:4,insetInlineEnd:4,bg:"accent.700",_dark:{bg:"accent.400"}}})]}),a.jsxs(L,{sx:{w:"full",flexDirection:"column",gap:3},children:[a.jsxs(L,{sx:{gap:4,w:"full",alignItems:"center"},children:[a.jsxs(L,{sx:{flexDir:"column",gap:3,h:28,w:"full",paddingInlineStart:1,paddingInlineEnd:p?1:0,pb:2,justifyContent:"space-between"},children:[a.jsx(ale,{controlNet:t}),a.jsx(Vle,{controlNet:t})]}),!p&&a.jsx(L,{sx:{alignItems:"center",justifyContent:"center",h:28,w:28,aspectRatio:"1/1"},children:a.jsx(Jj,{controlNet:t,isSmall:!0})})]}),a.jsxs(L,{sx:{gap:2},children:[a.jsx(Wle,{controlNet:t}),a.jsx(qle,{controlNet:t})]}),a.jsx(Kle,{controlNet:t})]}),p&&a.jsxs(a.Fragment,{children:[a.jsx(Jj,{controlNet:t}),a.jsx(zle,{controlNet:t}),a.jsx($le,{controlNet:t})]})]})},Qle=d.memo(Xle),u_=e=>`${Math.round(e*100)}%`,Yle=()=>{const e=W(i=>i.controlNet.isIPAdapterEnabled),t=W(i=>i.controlNet.ipAdapterInfo.beginStepPct),n=W(i=>i.controlNet.ipAdapterInfo.endStepPct),r=te(),{t:o}=Z(),s=d.useCallback(i=>{r(YA(i[0])),r(ZA(i[1]))},[r]);return a.jsxs(Kt,{isDisabled:!e,children:[a.jsx(wn,{children:o("controlnet.beginEndStepPercent")}),a.jsx(Rh,{w:"100%",gap:2,alignItems:"center",children:a.jsxs(Bb,{"aria-label":["Begin Step %","End Step %!"],value:[t,n],onChange:s,min:0,max:1,step:.01,minStepsBetweenThumbs:5,isDisabled:!e,children:[a.jsx(Hb,{children:a.jsx(Vb,{})}),a.jsx(Ht,{label:u_(t),placement:"top",hasArrow:!0,children:a.jsx(nd,{index:0})}),a.jsx(Ht,{label:u_(n),placement:"top",hasArrow:!0,children:a.jsx(nd,{index:1})}),a.jsx(Ai,{value:0,sx:{insetInlineStart:"0 !important",insetInlineEnd:"unset !important"},children:"0%"}),a.jsx(Ai,{value:.5,sx:{insetInlineStart:"50% !important",transform:"translateX(-50%)"},children:"50%"}),a.jsx(Ai,{value:1,sx:{insetInlineStart:"unset !important",insetInlineEnd:"0 !important"},children:"100%"})]})})]})},Zle=d.memo(Yle),Jle=ce(xe,e=>{const{isIPAdapterEnabled:t}=e.controlNet;return{isIPAdapterEnabled:t}},je),ece=()=>{const{isIPAdapterEnabled:e}=W(Jle),t=te(),{t:n}=Z(),r=d.useCallback(o=>{t(u1(o.target.checked))},[t]);return a.jsx(dn,{label:n("controlnet.enableIPAdapter"),isChecked:e,onChange:r,formControlProps:{width:"100%"}})},tce=d.memo(ece),nce=ce(xe,({controlNet:e})=>{const{ipAdapterInfo:t}=e;return{ipAdapterInfo:t}},je),rce=()=>{const{ipAdapterInfo:e}=W(nce),t=te(),{t:n}=Z(),{currentData:r}=to(e.adapterImage??$r.skipToken),o=d.useMemo(()=>{if(r)return{id:"ip-adapter-image",payloadType:"IMAGE_DTO",payload:{imageDTO:r}}},[r]),s=d.useMemo(()=>({id:"ip-adapter-image",actionType:"SET_IP_ADAPTER_IMAGE"}),[]),i=d.useMemo(()=>({type:"SET_IP_ADAPTER_IMAGE"}),[]);return a.jsxs(L,{layerStyle:"second",sx:{position:"relative",w:"full",alignItems:"center",justifyContent:"center",aspectRatio:"1/1",borderRadius:"base"},children:[a.jsx(ua,{imageDTO:r,droppableData:s,draggableData:o,postUploadAction:i,dropLabel:n("toast.setIPAdapterImage"),noContentFallback:a.jsx(Zn,{label:n("controlnet.ipAdapterImageFallback")})}),a.jsx(Li,{onClick:()=>t(JA(null)),icon:e.adapterImage?a.jsx(Ud,{}):void 0,tooltip:n("controlnet.resetIPAdapterImage")})]})},oce=d.memo(rce),sce=()=>{const e=W(p=>p.controlNet.isIPAdapterEnabled),t=W(p=>p.controlNet.ipAdapterInfo.model),n=W(p=>p.generation.model),r=te(),{t:o}=Z(),{data:s}=Vx(),i=d.useMemo(()=>(s==null?void 0:s.entities[`${t==null?void 0:t.base_model}/ip_adapter/${t==null?void 0:t.model_name}`])??null,[t==null?void 0:t.base_model,t==null?void 0:t.model_name,s==null?void 0:s.entities]),l=d.useMemo(()=>{if(!s)return[];const p=[];return $n(s.entities,(m,h)=>{if(!m)return;const g=(n==null?void 0:n.base_model)!==m.base_model;p.push({value:h,label:m.model_name,group:mn[m.base_model],disabled:g,tooltip:g?`Incompatible base model: ${m.base_model}`:void 0})}),p.sort((m,h)=>m.disabled&&!h.disabled?1:-1)},[s,n==null?void 0:n.base_model]),u=d.useCallback(p=>{if(!p)return;const m=IO(p);m&&r(eT(m))},[r]);return a.jsx(On,{label:o("controlnet.ipAdapterModel"),className:"nowheel nodrag",tooltip:i==null?void 0:i.description,value:(i==null?void 0:i.id)??null,placeholder:"Pick one",error:!i,data:l,onChange:u,sx:{width:"100%"},disabled:!e})},ace=d.memo(sce),ice=()=>{const e=W(i=>i.controlNet.isIPAdapterEnabled),t=W(i=>i.controlNet.ipAdapterInfo.weight),n=te(),{t:r}=Z(),o=d.useCallback(i=>{n(yw(i))},[n]),s=d.useCallback(()=>{n(yw(1))},[n]);return a.jsx(tt,{isDisabled:!e,label:r("controlnet.weight"),value:t,onChange:o,min:0,max:2,step:.01,withSliderMarks:!0,sliderMarks:[0,1,2],withReset:!0,handleReset:s})},lce=d.memo(ice),cce=()=>a.jsxs(L,{sx:{flexDir:"column",gap:3,paddingInline:3,paddingBlock:2,paddingBottom:5,borderRadius:"base",position:"relative",bg:"base.250",_dark:{bg:"base.750"}},children:[a.jsx(tce,{}),a.jsx(oce,{}),a.jsx(ace,{}),a.jsx(lce,{}),a.jsx(Zle,{})]}),uce=d.memo(cce),dce=ce(xe,e=>{const{isEnabled:t}=e.controlNet;return{isEnabled:t}},je),fce=()=>{const{isEnabled:e}=W(dce),t=te(),n=d.useCallback(()=>{t(tT())},[t]);return a.jsx(Ie,{width:"100%",children:a.jsx(Et,{feature:"controlNet",children:a.jsx(dn,{label:"Enable ControlNet",isChecked:e,onChange:n})})})},pce=d.memo(fce),mce=ce([xe],({controlNet:e})=>{const{controlNets:t,isEnabled:n,isIPAdapterEnabled:r,ipAdapterInfo:o}=e,s=nT(t),i=o.model&&o.adapterImage;let l;return n&&s.length>0&&(l=`${s.length} ControlNet`),r&&i&&(l?l=`${l}, IP Adapter`:l="IP Adapter"),{controlNetsArray:nr(t),activeLabel:l}},je),hce=()=>{const{controlNetsArray:e,activeLabel:t}=W(mce),n=Bt("controlNet").isFeatureDisabled,r=te(),{data:o}=gh(),s=d.useMemo(()=>{if(!o||!Object.keys(o.entities).length)return;const l=Object.keys(o.entities)[0];if(!l)return;const u=o.entities[l];return u||void 0},[o]),i=d.useCallback(()=>{if(!s)return;const l=Zs();r(rT({controlNetId:l})),r(PI({controlNetId:l,model:s}))},[r,s]);return n?null:a.jsx(oo,{label:"Control Adapters",activeLabel:t,children:a.jsxs(L,{sx:{flexDir:"column",gap:2},children:[a.jsxs(L,{sx:{w:"100%",gap:2,p:2,ps:3,borderRadius:"base",alignItems:"center",bg:"base.250",_dark:{bg:"base.750"}},children:[a.jsx(pce,{}),a.jsx(Fe,{tooltip:"Add ControlNet","aria-label":"Add ControlNet",icon:a.jsx(Vc,{}),isDisabled:!s,flexGrow:1,size:"sm",onClick:i,"data-testid":"add controlnet"})]}),e.map((l,u)=>a.jsxs(d.Fragment,{children:[u>0&&a.jsx(Yn,{}),a.jsx(Qle,{controlNet:l})]},l.controlNetId)),a.jsx(uce,{})]})})},Yc=d.memo(hce),gce=e=>{const{onClick:t}=e,{t:n}=Z();return a.jsx(Fe,{size:"sm","aria-label":n("embedding.addEmbedding"),tooltip:n("embedding.addEmbedding"),icon:a.jsx(lM,{}),sx:{p:2,color:"base.500",_hover:{color:"base.600"},_active:{color:"base.700"},_dark:{color:"base.500",_hover:{color:"base.400"},_active:{color:"base.300"}}},variant:"link",onClick:t})},Rg=d.memo(gce),vce="28rem",xce=e=>{const{onSelect:t,isOpen:n,onClose:r,children:o}=e,{data:s}=oT(),i=d.useRef(null),{t:l}=Z(),u=W(h=>h.generation.model),p=d.useMemo(()=>{if(!s)return[];const h=[];return $n(s.entities,(g,x)=>{if(!g)return;const y=(u==null?void 0:u.base_model)!==g.base_model;h.push({value:g.model_name,label:g.model_name,group:mn[g.base_model],disabled:y,tooltip:y?`${l("embedding.incompatibleModel")} ${g.base_model}`:void 0})}),h.sort((g,x)=>{var y;return g.label&&x.label?(y=g.label)!=null&&y.localeCompare(x.label)?-1:1:-1}),h.sort((g,x)=>g.disabled&&!x.disabled?1:-1)},[s,u==null?void 0:u.base_model,l]),m=d.useCallback(h=>{h&&t(h)},[t]);return a.jsxs(Ld,{initialFocusRef:i,isOpen:n,onClose:r,placement:"bottom",openDelay:0,closeDelay:0,closeOnBlur:!0,returnFocusOnClose:!0,children:[a.jsx(Wh,{children:o}),a.jsx(zd,{sx:{p:0,top:-1,shadow:"dark-lg",borderColor:"accent.300",borderWidth:"2px",borderStyle:"solid",_dark:{borderColor:"accent.400"}},children:a.jsx(Uh,{sx:{p:0,w:`calc(${vce} - 2rem )`},children:p.length===0?a.jsx(L,{sx:{justifyContent:"center",p:2,fontSize:"sm",color:"base.500",_dark:{color:"base.700"}},children:a.jsx(ve,{children:"No Embeddings Loaded"})}):a.jsx(nn,{inputRef:i,autoFocus:!0,placeholder:l("embedding.addEmbedding"),value:null,data:p,nothingFound:l("embedding.noMatchingEmbedding"),itemComponent:ci,disabled:p.length===0,onDropdownClose:r,filter:(h,g)=>{var x;return((x=g.label)==null?void 0:x.toLowerCase().includes(h.toLowerCase().trim()))||g.value.toLowerCase().includes(h.toLowerCase().trim())},onChange:m})})})]})},Dg=d.memo(xce),bce=()=>{const e=W(h=>h.generation.negativePrompt),t=d.useRef(null),{isOpen:n,onClose:r,onOpen:o}=Lr(),s=te(),{t:i}=Z(),l=d.useCallback(h=>{s($u(h.target.value))},[s]),u=d.useCallback(h=>{h.key==="<"&&o()},[o]),p=d.useCallback(h=>{if(!t.current)return;const g=t.current.selectionStart;if(g===void 0)return;let x=e.slice(0,g);x[x.length-1]!=="<"&&(x+="<"),x+=`${h}>`;const y=x.length;x+=e.slice(g),qr.flushSync(()=>{s($u(x))}),t.current.selectionEnd=y,r()},[s,r,e]),m=Bt("embedding").isFeatureEnabled;return a.jsxs(Kt,{children:[a.jsx(Dg,{isOpen:n,onClose:r,onSelect:p,children:a.jsx(Et,{feature:"paramNegativeConditioning",placement:"right",children:a.jsx(da,{id:"negativePrompt",name:"negativePrompt",ref:t,value:e,placeholder:i("parameters.negativePromptPlaceholder"),onChange:l,resize:"vertical",fontSize:"sm",minH:16,...m&&{onKeyDown:u}})})}),!n&&m&&a.jsx(Ie,{sx:{position:"absolute",top:0,insetInlineEnd:0},children:a.jsx(Rg,{onClick:o})})]})},OO=d.memo(bce),yce=ce([xe],({generation:e})=>({prompt:e.positivePrompt}),{memoizeOptions:{resultEqualityCheck:Ft}}),Cce=()=>{const e=te(),{prompt:t}=W(yce),n=d.useRef(null),{isOpen:r,onClose:o,onOpen:s}=Lr(),{t:i}=Z(),l=d.useCallback(h=>{e(Nu(h.target.value))},[e]);et("alt+a",()=>{var h;(h=n.current)==null||h.focus()},[]);const u=d.useCallback(h=>{if(!n.current)return;const g=n.current.selectionStart;if(g===void 0)return;let x=t.slice(0,g);x[x.length-1]!=="<"&&(x+="<"),x+=`${h}>`;const y=x.length;x+=t.slice(g),qr.flushSync(()=>{e(Nu(x))}),n.current.selectionStart=y,n.current.selectionEnd=y,o()},[e,o,t]),p=Bt("embedding").isFeatureEnabled,m=d.useCallback(h=>{p&&h.key==="<"&&s()},[s,p]);return a.jsxs(Ie,{position:"relative",children:[a.jsx(Kt,{children:a.jsx(Dg,{isOpen:r,onClose:o,onSelect:u,children:a.jsx(Et,{feature:"paramPositiveConditioning",placement:"right",children:a.jsx(da,{id:"prompt",name:"prompt",ref:n,value:t,placeholder:i("parameters.positivePromptPlaceholder"),onChange:l,onKeyDown:m,resize:"vertical",minH:32})})})}),!r&&p&&a.jsx(Ie,{sx:{position:"absolute",top:0,insetInlineEnd:0},children:a.jsx(Rg,{onClick:s})})]})},RO=d.memo(Cce);function wce(){const e=W(o=>o.sdxl.shouldConcatSDXLStylePrompt),t=te(),{t:n}=Z(),r=()=>{t(sT(!e))};return a.jsx(Fe,{"aria-label":n("sdxl.concatPromptStyle"),tooltip:n("sdxl.concatPromptStyle"),variant:"outline",isChecked:e,onClick:r,icon:a.jsx(pM,{}),size:"xs",sx:{position:"absolute",insetInlineEnd:1,top:6,border:"none",color:e?"accent.500":"base.500",_hover:{bg:"none"}}})}const d_={position:"absolute",bg:"none",w:"full",minH:2,borderRadius:0,borderLeft:"none",borderRight:"none",zIndex:2,maskImage:"radial-gradient(circle at center, black, black 65%, black 30%, black 15%, transparent)"};function DO(){return a.jsxs(L,{children:[a.jsx(Ie,{as:In.div,initial:{scaleX:0,borderWidth:0,display:"none"},animate:{display:["block","block","block","none"],scaleX:[0,.25,.5,1],borderWidth:[0,3,3,0],transition:{duration:.37,times:[0,.25,.5,1]}},sx:{top:"1px",borderTop:"none",borderColor:"base.400",...d_,_dark:{borderColor:"accent.500"}}}),a.jsx(Ie,{as:In.div,initial:{opacity:0,scale:0},animate:{opacity:[0,1,1,1],scale:[0,.75,1.5,1],transition:{duration:.42,times:[0,.25,.5,1]}},exit:{opacity:0,scale:0},sx:{zIndex:3,position:"absolute",left:"48%",top:"3px",p:1,borderRadius:4,bg:"accent.400",color:"base.50",_dark:{bg:"accent.500"}},children:a.jsx(pM,{size:12})}),a.jsx(Ie,{as:In.div,initial:{scaleX:0,borderWidth:0,display:"none"},animate:{display:["block","block","block","none"],scaleX:[0,.25,.5,1],borderWidth:[0,3,3,0],transition:{duration:.37,times:[0,.25,.5,1]}},sx:{top:"17px",borderBottom:"none",borderColor:"base.400",...d_,_dark:{borderColor:"accent.500"}}})]})}const Sce=ce([xe],({sdxl:e})=>{const{negativeStylePrompt:t,shouldConcatSDXLStylePrompt:n}=e;return{prompt:t,shouldConcatSDXLStylePrompt:n}},{memoizeOptions:{resultEqualityCheck:Ft}}),kce=()=>{const e=te(),t=d.useRef(null),{isOpen:n,onClose:r,onOpen:o}=Lr(),{t:s}=Z(),{prompt:i,shouldConcatSDXLStylePrompt:l}=W(Sce),u=d.useCallback(g=>{e(zu(g.target.value))},[e]),p=d.useCallback(g=>{if(!t.current)return;const x=t.current.selectionStart;if(x===void 0)return;let y=i.slice(0,x);y[y.length-1]!=="<"&&(y+="<"),y+=`${g}>`;const b=y.length;y+=i.slice(x),qr.flushSync(()=>{e(zu(y))}),t.current.selectionStart=b,t.current.selectionEnd=b,r()},[e,r,i]),m=Bt("embedding").isFeatureEnabled,h=d.useCallback(g=>{m&&g.key==="<"&&o()},[o,m]);return a.jsxs(Ie,{position:"relative",children:[a.jsx(dr,{children:l&&a.jsx(Ie,{sx:{position:"absolute",left:"3",w:"94%",top:"-17px"},children:a.jsx(DO,{})})}),a.jsx(Kt,{children:a.jsx(Dg,{isOpen:n,onClose:r,onSelect:p,children:a.jsx(da,{id:"prompt",name:"prompt",ref:t,value:i,placeholder:s("sdxl.negStylePrompt"),onChange:u,onKeyDown:h,resize:"vertical",fontSize:"sm",minH:16})})}),!n&&m&&a.jsx(Ie,{sx:{position:"absolute",top:0,insetInlineEnd:0},children:a.jsx(Rg,{onClick:o})})]})},jce=d.memo(kce),_ce=ce([xe],({sdxl:e})=>{const{positiveStylePrompt:t,shouldConcatSDXLStylePrompt:n}=e;return{prompt:t,shouldConcatSDXLStylePrompt:n}},{memoizeOptions:{resultEqualityCheck:Ft}}),Ice=()=>{const e=te(),t=d.useRef(null),{isOpen:n,onClose:r,onOpen:o}=Lr(),{t:s}=Z(),{prompt:i,shouldConcatSDXLStylePrompt:l}=W(_ce),u=d.useCallback(g=>{e(Lu(g.target.value))},[e]),p=d.useCallback(g=>{if(!t.current)return;const x=t.current.selectionStart;if(x===void 0)return;let y=i.slice(0,x);y[y.length-1]!=="<"&&(y+="<"),y+=`${g}>`;const b=y.length;y+=i.slice(x),qr.flushSync(()=>{e(Lu(y))}),t.current.selectionStart=b,t.current.selectionEnd=b,r()},[e,r,i]),m=Bt("embedding").isFeatureEnabled,h=d.useCallback(g=>{m&&g.key==="<"&&o()},[o,m]);return a.jsxs(Ie,{position:"relative",children:[a.jsx(dr,{children:l&&a.jsx(Ie,{sx:{position:"absolute",left:"3",w:"94%",top:"-17px"},children:a.jsx(DO,{})})}),a.jsx(Kt,{children:a.jsx(Dg,{isOpen:n,onClose:r,onSelect:p,children:a.jsx(da,{id:"prompt",name:"prompt",ref:t,value:i,placeholder:s("sdxl.posStylePrompt"),onChange:u,onKeyDown:h,resize:"vertical",minH:16})})}),!n&&m&&a.jsx(Ie,{sx:{position:"absolute",top:0,insetInlineEnd:0},children:a.jsx(Rg,{onClick:o})})]})},Pce=d.memo(Ice);function o2(){return a.jsxs(L,{sx:{flexDirection:"column",gap:2},children:[a.jsx(RO,{}),a.jsx(wce,{}),a.jsx(Pce,{}),a.jsx(OO,{}),a.jsx(jce,{})]})}const dl=()=>{const{isRefinerAvailable:e}=Xo(nb,{selectFromResult:({data:t})=>({isRefinerAvailable:t?t.ids.length>0:!1})});return e},Ece=ce([xe],({sdxl:e,ui:t,hotkeys:n})=>{const{refinerCFGScale:r}=e,{shouldUseSliders:o}=t,{shift:s}=n;return{refinerCFGScale:r,shouldUseSliders:o,shift:s}},je),Mce=()=>{const{refinerCFGScale:e,shouldUseSliders:t,shift:n}=W(Ece),r=dl(),o=te(),{t:s}=Z(),i=d.useCallback(u=>o(f1(u)),[o]),l=d.useCallback(()=>o(f1(7)),[o]);return t?a.jsx(tt,{label:s("sdxl.cfgScale"),step:n?.1:.5,min:1,max:20,onChange:i,handleReset:l,value:e,sliderNumberInputProps:{max:200},withInput:!0,withReset:!0,withSliderMarks:!0,isInteger:!1,isDisabled:!r}):a.jsx(Kc,{label:s("sdxl.cfgScale"),step:.5,min:1,max:200,onChange:i,value:e,isInteger:!1,numberInputFieldProps:{textAlign:"center"},isDisabled:!r})},Oce=d.memo(Mce),Rce=e=>{const t=el("models"),[n,r,o]=e.split("/"),s=aT.safeParse({base_model:n,model_name:o,model_type:r});if(!s.success){t.error({mainModelId:e,errors:s.error.format()},"Failed to parse main model id");return}return s.data},Dce=ce(xe,e=>({model:e.sdxl.refinerModel}),je),Ace=()=>{const e=te(),t=Bt("syncModels").isFeatureEnabled,{model:n}=W(Dce),{t:r}=Z(),{data:o,isLoading:s}=Xo(nb),i=d.useMemo(()=>{if(!o)return[];const p=[];return $n(o.entities,(m,h)=>{m&&p.push({value:h,label:m.model_name,group:mn[m.base_model]})}),p},[o]),l=d.useMemo(()=>(o==null?void 0:o.entities[`${n==null?void 0:n.base_model}/main/${n==null?void 0:n.model_name}`])??null,[o==null?void 0:o.entities,n]),u=d.useCallback(p=>{if(!p)return;const m=Rce(p);m&&e(pI(m))},[e]);return s?a.jsx(nn,{label:r("sdxl.refinermodel"),placeholder:r("sdxl.loading"),disabled:!0,data:[]}):a.jsxs(L,{w:"100%",alignItems:"center",gap:2,children:[a.jsx(nn,{tooltip:l==null?void 0:l.description,label:r("sdxl.refinermodel"),value:l==null?void 0:l.id,placeholder:i.length>0?r("sdxl.selectAModel"):r("sdxl.noModelsAvailable"),data:i,error:i.length===0,disabled:i.length===0,onChange:u,w:"100%"}),t&&a.jsx(Ie,{mt:7,children:a.jsx(Gc,{iconMode:!0})})]})},Tce=d.memo(Ace),Nce=ce([xe],({sdxl:e,hotkeys:t})=>{const{refinerNegativeAestheticScore:n}=e,{shift:r}=t;return{refinerNegativeAestheticScore:n,shift:r}},je),$ce=()=>{const{refinerNegativeAestheticScore:e,shift:t}=W(Nce),n=dl(),r=te(),{t:o}=Z(),s=d.useCallback(l=>r(m1(l)),[r]),i=d.useCallback(()=>r(m1(2.5)),[r]);return a.jsx(tt,{label:o("sdxl.negAestheticScore"),step:t?.1:.5,min:1,max:10,onChange:s,handleReset:i,value:e,sliderNumberInputProps:{max:10},withInput:!0,withReset:!0,withSliderMarks:!0,isInteger:!1,isDisabled:!n})},Lce=d.memo($ce),zce=ce([xe],({sdxl:e,hotkeys:t})=>{const{refinerPositiveAestheticScore:n}=e,{shift:r}=t;return{refinerPositiveAestheticScore:n,shift:r}},je),Fce=()=>{const{refinerPositiveAestheticScore:e,shift:t}=W(zce),n=dl(),r=te(),{t:o}=Z(),s=d.useCallback(l=>r(p1(l)),[r]),i=d.useCallback(()=>r(p1(6)),[r]);return a.jsx(tt,{label:o("sdxl.posAestheticScore"),step:t?.1:.5,min:1,max:10,onChange:s,handleReset:i,value:e,sliderNumberInputProps:{max:10},withInput:!0,withReset:!0,withSliderMarks:!0,isInteger:!1,isDisabled:!n})},Bce=d.memo(Fce),Hce=ce(xe,({ui:e,sdxl:t})=>{const{refinerScheduler:n}=t,{favoriteSchedulers:r}=e,o=nr(mh,(s,i)=>({value:i,label:s,group:r.includes(i)?"Favorites":void 0})).sort((s,i)=>s.label.localeCompare(i.label));return{refinerScheduler:n,data:o}},je),Vce=()=>{const e=te(),{t}=Z(),{refinerScheduler:n,data:r}=W(Hce),o=dl(),s=d.useCallback(i=>{i&&e(mI(i))},[e]);return a.jsx(nn,{w:"100%",label:t("sdxl.scheduler"),value:n,data:r,onChange:s,disabled:!o})},Wce=d.memo(Vce),Uce=ce([xe],({sdxl:e})=>{const{refinerStart:t}=e;return{refinerStart:t}},je),Gce=()=>{const{refinerStart:e}=W(Uce),t=te(),n=dl(),r=d.useCallback(i=>t(h1(i)),[t]),{t:o}=Z(),s=d.useCallback(()=>t(h1(.8)),[t]);return a.jsx(tt,{label:o("sdxl.refinerStart"),step:.01,min:0,max:1,onChange:r,handleReset:s,value:e,withInput:!0,withReset:!0,withSliderMarks:!0,isInteger:!1,isDisabled:!n})},Kce=d.memo(Gce),qce=ce([xe],({sdxl:e,ui:t})=>{const{refinerSteps:n}=e,{shouldUseSliders:r}=t;return{refinerSteps:n,shouldUseSliders:r}},je),Xce=()=>{const{refinerSteps:e,shouldUseSliders:t}=W(qce),n=dl(),r=te(),{t:o}=Z(),s=d.useCallback(l=>{r(d1(l))},[r]),i=d.useCallback(()=>{r(d1(20))},[r]);return t?a.jsx(tt,{label:o("sdxl.steps"),min:1,max:100,step:1,onChange:s,handleReset:i,value:e,withInput:!0,withReset:!0,withSliderMarks:!0,sliderNumberInputProps:{max:500},isDisabled:!n}):a.jsx(Kc,{label:o("sdxl.steps"),min:1,max:500,step:1,onChange:s,value:e,numberInputFieldProps:{textAlign:"center"},isDisabled:!n})},Qce=d.memo(Xce);function Yce(){const e=W(s=>s.sdxl.shouldUseSDXLRefiner),t=dl(),n=te(),{t:r}=Z(),o=s=>{n(iT(s.target.checked))};return a.jsx(dn,{label:r("sdxl.useRefiner"),isChecked:e,onChange:o,isDisabled:!t})}const Zce=ce(xe,e=>{const{shouldUseSDXLRefiner:t}=e.sdxl,{shouldUseSliders:n}=e.ui;return{activeLabel:t?"Enabled":void 0,shouldUseSliders:n}},je),Jce=()=>{const{activeLabel:e,shouldUseSliders:t}=W(Zce),{t:n}=Z();return a.jsx(oo,{label:n("sdxl.refiner"),activeLabel:e,children:a.jsxs(L,{sx:{gap:2,flexDir:"column"},children:[a.jsx(Yce,{}),a.jsx(Tce,{}),a.jsxs(L,{gap:2,flexDirection:t?"column":"row",children:[a.jsx(Qce,{}),a.jsx(Oce,{})]}),a.jsx(Wce,{}),a.jsx(Bce,{}),a.jsx(Lce,{}),a.jsx(Kce,{})]})})},s2=d.memo(Jce),eue=ce([xe],({generation:e,config:t,ui:n,hotkeys:r})=>{const{initial:o,min:s,sliderMax:i,inputMax:l}=t.sd.guidance,{cfgScale:u}=e,{shouldUseSliders:p}=n,{shift:m}=r;return{cfgScale:u,initial:o,min:s,sliderMax:i,inputMax:l,shouldUseSliders:p,shift:m}},je),tue=()=>{const{cfgScale:e,initial:t,min:n,sliderMax:r,inputMax:o,shouldUseSliders:s,shift:i}=W(eue),l=te(),{t:u}=Z(),p=d.useCallback(h=>l(Qp(h)),[l]),m=d.useCallback(()=>l(Qp(t)),[l,t]);return s?a.jsx(Et,{feature:"paramCFGScale",children:a.jsx(tt,{label:u("parameters.cfgScale"),step:i?.1:.5,min:n,max:r,onChange:p,handleReset:m,value:e,sliderNumberInputProps:{max:o},withInput:!0,withReset:!0,withSliderMarks:!0,isInteger:!1})}):a.jsx(Et,{feature:"paramCFGScale",children:a.jsx(Kc,{label:u("parameters.cfgScale"),step:.5,min:n,max:o,onChange:p,value:e,isInteger:!1,numberInputFieldProps:{textAlign:"center"}})})},_s=d.memo(tue),nue=ce(xe,e=>({model:e.generation.model}),je),rue=()=>{const e=te(),{t}=Z(),{model:n}=W(nue),r=Bt("syncModels").isFeatureEnabled,{data:o,isLoading:s}=Xo(Cw),{data:i,isLoading:l}=Ku(Cw),u=W(Jn),p=d.useMemo(()=>{if(!o)return[];const g=[];return $n(o.entities,(x,y)=>{x&&g.push({value:y,label:x.model_name,group:mn[x.base_model]})}),$n(i==null?void 0:i.entities,(x,y)=>{!x||u==="unifiedCanvas"||u==="img2img"||g.push({value:y,label:x.model_name,group:mn[x.base_model]})}),g},[o,i,u]),m=d.useMemo(()=>((o==null?void 0:o.entities[`${n==null?void 0:n.base_model}/main/${n==null?void 0:n.model_name}`])||(i==null?void 0:i.entities[`${n==null?void 0:n.base_model}/onnx/${n==null?void 0:n.model_name}`]))??null,[o==null?void 0:o.entities,n,i==null?void 0:i.entities]),h=d.useCallback(g=>{if(!g)return;const x=Og(g);x&&e(i1(x))},[e]);return s||l?a.jsx(nn,{label:t("modelManager.model"),placeholder:"Loading...",disabled:!0,data:[]}):a.jsxs(L,{w:"100%",alignItems:"center",gap:3,children:[a.jsx(Et,{feature:"paramModel",children:a.jsx(nn,{tooltip:m==null?void 0:m.description,label:t("modelManager.model"),value:m==null?void 0:m.id,placeholder:p.length>0?"Select a model":"No models available",data:p,error:p.length===0,disabled:p.length===0,onChange:h,w:"100%"})}),r&&a.jsx(Ie,{mt:6,children:a.jsx(Gc,{iconMode:!0})})]})},oue=d.memo(rue),sue=ce(xe,({generation:e})=>{const{model:t,vae:n}=e;return{model:t,vae:n}},je),aue=()=>{const e=te(),{t}=Z(),{model:n,vae:r}=W(sue),{data:o}=jI(),s=d.useMemo(()=>{if(!o)return[];const u=[{value:"default",label:"Default",group:"Default"}];return $n(o.entities,(p,m)=>{if(!p)return;const h=(n==null?void 0:n.base_model)!==p.base_model;u.push({value:m,label:p.model_name,group:mn[p.base_model],disabled:h,tooltip:h?`Incompatible base model: ${p.base_model}`:void 0})}),u.sort((p,m)=>p.disabled&&!m.disabled?1:-1)},[o,n==null?void 0:n.base_model]),i=d.useMemo(()=>(o==null?void 0:o.entities[`${r==null?void 0:r.base_model}/vae/${r==null?void 0:r.model_name}`])??null,[o==null?void 0:o.entities,r]),l=d.useCallback(u=>{if(!u||u==="default"){e(ww(null));return}const p=_O(u);p&&e(ww(p))},[e]);return a.jsx(Et,{feature:"paramVAE",children:a.jsx(nn,{itemComponent:ci,tooltip:i==null?void 0:i.description,label:t("modelManager.vae"),value:(i==null?void 0:i.id)??"default",placeholder:"Default",data:s,onChange:l,disabled:s.length===0,clearable:!0})})},iue=d.memo(aue),lue=ce([EI,os],(e,t)=>{const{scheduler:n}=t,{favoriteSchedulers:r}=e,o=nr(mh,(s,i)=>({value:i,label:s,group:r.includes(i)?"Favorites":void 0})).sort((s,i)=>s.label.localeCompare(i.label));return{scheduler:n,data:o}},je),cue=()=>{const e=te(),{t}=Z(),{scheduler:n,data:r}=W(lue),o=d.useCallback(s=>{s&&e(l1(s))},[e]);return a.jsx(Et,{feature:"paramScheduler",children:a.jsx(nn,{label:t("parameters.scheduler"),value:n,data:r,onChange:o})})},uue=d.memo(cue),due=ce(xe,({generation:e})=>{const{vaePrecision:t}=e;return{vaePrecision:t}},je),fue=["fp16","fp32"],pue=()=>{const e=te(),{vaePrecision:t}=W(due),n=d.useCallback(r=>{r&&e(lT(r))},[e]);return a.jsx(Et,{feature:"paramVAEPrecision",children:a.jsx(On,{label:"VAE Precision",value:t,data:fue,onChange:n})})},mue=d.memo(pue),hue=()=>{const e=Bt("vae").isFeatureEnabled;return a.jsxs(L,{gap:3,w:"full",flexWrap:e?"wrap":"nowrap",children:[a.jsx(Ie,{w:"full",children:a.jsx(oue,{})}),a.jsx(Ie,{w:"full",children:a.jsx(uue,{})}),e&&a.jsxs(L,{w:"full",gap:3,children:[a.jsx(iue,{}),a.jsx(mue,{})]})]})},Is=d.memo(hue),AO=[{name:"Free",value:null},{name:"2:3",value:2/3},{name:"16:9",value:16/9},{name:"1:1",value:1/1}],TO=AO.map(e=>e.value);function NO(){const e=W(o=>o.generation.aspectRatio),t=te(),n=W(o=>o.generation.shouldFitToWidthHeight),r=W(Jn);return a.jsx(Vt,{isAttached:!0,children:AO.map(o=>a.jsx(at,{size:"sm",isChecked:e===o.value,isDisabled:r==="img2img"?!n:!1,onClick:()=>{t(zo(o.value)),t(qu(!1))},children:o.name},o.name))})}const gue=ce([xe],({generation:e,hotkeys:t,config:n})=>{const{min:r,sliderMax:o,inputMax:s,fineStep:i,coarseStep:l}=n.sd.height,{model:u,height:p}=e,{aspectRatio:m}=e,h=t.shift?i:l;return{model:u,height:p,min:r,sliderMax:o,inputMax:s,step:h,aspectRatio:m}},je),vue=e=>{const{model:t,height:n,min:r,sliderMax:o,inputMax:s,step:i,aspectRatio:l}=W(gue),u=te(),{t:p}=Z(),m=["sdxl","sdxl-refiner"].includes(t==null?void 0:t.base_model)?1024:512,h=d.useCallback(x=>{if(u(Hi(x)),l){const y=wr(x*l,8);u(Bi(y))}},[u,l]),g=d.useCallback(()=>{if(u(Hi(m)),l){const x=wr(m*l,8);u(Bi(x))}},[u,m,l]);return a.jsx(tt,{label:p("parameters.height"),value:n,min:r,step:i,max:o,onChange:h,handleReset:g,withInput:!0,withReset:!0,withSliderMarks:!0,sliderNumberInputProps:{max:s},...e})},xue=d.memo(vue),bue=ce([xe],({generation:e,hotkeys:t,config:n})=>{const{min:r,sliderMax:o,inputMax:s,fineStep:i,coarseStep:l}=n.sd.width,{model:u,width:p,aspectRatio:m}=e,h=t.shift?i:l;return{model:u,width:p,min:r,sliderMax:o,inputMax:s,step:h,aspectRatio:m}},je),yue=e=>{const{model:t,width:n,min:r,sliderMax:o,inputMax:s,step:i,aspectRatio:l}=W(bue),u=te(),{t:p}=Z(),m=["sdxl","sdxl-refiner"].includes(t==null?void 0:t.base_model)?1024:512,h=d.useCallback(x=>{if(u(Bi(x)),l){const y=wr(x/l,8);u(Hi(y))}},[u,l]),g=d.useCallback(()=>{if(u(Bi(m)),l){const x=wr(m/l,8);u(Hi(x))}},[u,m,l]);return a.jsx(tt,{label:p("parameters.width"),value:n,min:r,step:i,max:o,onChange:h,handleReset:g,withInput:!0,withReset:!0,withSliderMarks:!0,sliderNumberInputProps:{max:s},...e})},Cue=d.memo(yue),wue=ce([os,Jn],(e,t)=>{const{shouldFitToWidthHeight:n,shouldLockAspectRatio:r,width:o,height:s}=e;return{activeTabName:t,shouldFitToWidthHeight:n,shouldLockAspectRatio:r,width:o,height:s}},je);function Oc(){const{t:e}=Z(),t=te(),{activeTabName:n,shouldFitToWidthHeight:r,shouldLockAspectRatio:o,width:s,height:i}=W(wue),l=d.useCallback(()=>{o?(t(qu(!1)),TO.includes(s/i)?t(zo(s/i)):t(zo(null))):(t(qu(!0)),t(zo(s/i)))},[o,s,i,t]),u=d.useCallback(()=>{t(cT()),t(zo(null)),o&&t(zo(i/s))},[t,o,s,i]);return a.jsxs(L,{sx:{gap:2,p:4,borderRadius:4,flexDirection:"column",w:"full",bg:"base.150",_dark:{bg:"base.750"}},children:[a.jsx(Et,{feature:"paramRatio",children:a.jsxs(Kt,{as:L,flexDir:"row",alignItems:"center",gap:2,children:[a.jsx(wn,{children:e("parameters.aspectRatio")}),a.jsx(ba,{}),a.jsx(NO,{}),a.jsx(Fe,{tooltip:e("ui.swapSizes"),"aria-label":e("ui.swapSizes"),size:"sm",icon:a.jsx(z8,{}),fontSize:20,isDisabled:n==="img2img"?!r:!1,onClick:u}),a.jsx(Fe,{tooltip:e("ui.lockRatio"),"aria-label":e("ui.lockRatio"),size:"sm",icon:a.jsx(mM,{}),isChecked:o,isDisabled:n==="img2img"?!r:!1,onClick:l})]})}),a.jsx(L,{gap:2,alignItems:"center",children:a.jsxs(L,{gap:2,flexDirection:"column",width:"full",children:[a.jsx(Cue,{isDisabled:n==="img2img"?!r:!1}),a.jsx(xue,{isDisabled:n==="img2img"?!r:!1})]})})]})}const Sue=ce([xe],({generation:e,config:t,ui:n,hotkeys:r})=>{const{initial:o,min:s,sliderMax:i,inputMax:l,fineStep:u,coarseStep:p}=t.sd.steps,{steps:m}=e,{shouldUseSliders:h}=n,g=r.shift?u:p;return{steps:m,initial:o,min:s,sliderMax:i,inputMax:l,step:g,shouldUseSliders:h}},je),kue=()=>{const{steps:e,initial:t,min:n,sliderMax:r,inputMax:o,step:s,shouldUseSliders:i}=W(Sue),l=te(),{t:u}=Z(),p=d.useCallback(g=>{l(Yp(g))},[l]),m=d.useCallback(()=>{l(Yp(t))},[l,t]),h=d.useCallback(()=>{l(eb())},[l]);return i?a.jsx(Et,{feature:"paramSteps",children:a.jsx(tt,{label:u("parameters.steps"),min:n,max:r,step:s,onChange:p,handleReset:m,value:e,withInput:!0,withReset:!0,withSliderMarks:!0,sliderNumberInputProps:{max:o}})}):a.jsx(Et,{feature:"paramSteps",children:a.jsx(Kc,{label:u("parameters.steps"),min:n,max:o,step:s,onChange:p,value:e,numberInputFieldProps:{textAlign:"center"},onBlur:h})})},Ps=d.memo(kue);function $O(){const e=te(),t=W(o=>o.generation.shouldFitToWidthHeight),n=o=>e(uT(o.target.checked)),{t:r}=Z();return a.jsx(dn,{label:r("parameters.imageFit"),isChecked:t,onChange:n})}function jue(){const e=W(i=>i.generation.seed),t=W(i=>i.generation.shouldRandomizeSeed),n=W(i=>i.generation.shouldGenerateVariations),{t:r}=Z(),o=te(),s=i=>o(Xp(i));return a.jsx(Kc,{label:r("parameters.seed"),step:1,precision:0,flexGrow:1,min:MI,max:OI,isDisabled:t,isInvalid:e<0&&n,onChange:s,value:e})}const _ue=(e,t)=>Math.floor(Math.random()*(t-e+1)+e);function Iue(){const e=te(),t=W(o=>o.generation.shouldRandomizeSeed),{t:n}=Z(),r=()=>e(Xp(_ue(MI,OI)));return a.jsx(Fe,{size:"sm",isDisabled:t,"aria-label":n("parameters.shuffle"),tooltip:n("parameters.shuffle"),onClick:r,icon:a.jsx(ZJ,{})})}const Pue=()=>{const e=te(),{t}=Z(),n=W(o=>o.generation.shouldRandomizeSeed),r=o=>e(dT(o.target.checked));return a.jsx(dn,{label:t("common.random"),isChecked:n,onChange:r})},Eue=d.memo(Pue),Mue=()=>a.jsx(Et,{feature:"paramSeed",children:a.jsxs(L,{sx:{gap:3,alignItems:"flex-end"},children:[a.jsx(jue,{}),a.jsx(Iue,{}),a.jsx(Eue,{})]})}),Es=d.memo(Mue),LO=ke((e,t)=>a.jsxs(L,{ref:t,sx:{flexDir:"column",gap:2,bg:"base.100",px:4,pt:2,pb:4,borderRadius:"base",_dark:{bg:"base.750"}},children:[a.jsx(ve,{fontSize:"sm",fontWeight:"bold",sx:{color:"base.600",_dark:{color:"base.300"}},children:e.label}),e.children]}));LO.displayName="SubSettingsWrapper";const Rc=d.memo(LO),Oue=ce([xe],({sdxl:e})=>{const{sdxlImg2ImgDenoisingStrength:t}=e;return{sdxlImg2ImgDenoisingStrength:t}},je),Rue=()=>{const{sdxlImg2ImgDenoisingStrength:e}=W(Oue),t=te(),{t:n}=Z(),r=d.useCallback(s=>t(Sw(s)),[t]),o=d.useCallback(()=>{t(Sw(.7))},[t]);return a.jsx(Et,{feature:"paramDenoisingStrength",children:a.jsx(Rc,{children:a.jsx(tt,{label:n("sdxl.denoisingStrength"),step:.01,min:0,max:1,onChange:r,handleReset:o,value:e,isInteger:!1,withInput:!0,withSliderMarks:!0,withReset:!0})})})},zO=d.memo(Rue),Due=ce([EI,os],(e,t)=>{const{shouldUseSliders:n}=e,{shouldRandomizeSeed:r}=t;return{shouldUseSliders:n,activeLabel:r?void 0:"Manual Seed"}},je),Aue=()=>{const{shouldUseSliders:e,activeLabel:t}=W(Due);return a.jsx(oo,{label:"General",activeLabel:t,defaultIsOpen:!0,children:a.jsxs(L,{sx:{flexDirection:"column",gap:3},children:[e?a.jsxs(a.Fragment,{children:[a.jsx(rs,{}),a.jsx(Ps,{}),a.jsx(_s,{}),a.jsx(Is,{}),a.jsx(Ie,{pt:2,children:a.jsx(Es,{})}),a.jsx(Oc,{})]}):a.jsxs(a.Fragment,{children:[a.jsxs(L,{gap:3,children:[a.jsx(rs,{}),a.jsx(Ps,{}),a.jsx(_s,{})]}),a.jsx(Is,{}),a.jsx(Ie,{pt:2,children:a.jsx(Es,{})}),a.jsx(Oc,{})]}),a.jsx(zO,{}),a.jsx($O,{})]})})},Tue=d.memo(Aue),Nue=()=>a.jsxs(a.Fragment,{children:[a.jsx(o2,{}),a.jsx(Tue,{}),a.jsx(s2,{}),a.jsx(Yc,{}),a.jsx(Xc,{}),a.jsx(qc,{}),a.jsx(Qc,{})]}),$ue=d.memo(Nue),a2=()=>{const{t:e}=Z(),t=W(i=>i.generation.shouldRandomizeSeed),n=W(i=>i.generation.iterations),r=d.useMemo(()=>n===1?e("parameters.iterationsWithCount_one",{count:1}):e("parameters.iterationsWithCount_other",{count:n}),[n,e]),o=d.useMemo(()=>e(t?"parameters.randomSeed":"parameters.manualSeed"),[t,e]);return{iterationsAndSeedLabel:d.useMemo(()=>[r,o].join(", "),[r,o]),iterationsLabel:r,seedLabel:o}},Lue=()=>{const e=W(n=>n.ui.shouldUseSliders),{iterationsAndSeedLabel:t}=a2();return a.jsx(oo,{label:"General",activeLabel:t,defaultIsOpen:!0,children:a.jsx(L,{sx:{flexDirection:"column",gap:3},children:e?a.jsxs(a.Fragment,{children:[a.jsx(rs,{}),a.jsx(Ps,{}),a.jsx(_s,{}),a.jsx(Is,{}),a.jsx(Ie,{pt:2,children:a.jsx(Es,{})}),a.jsx(Oc,{})]}):a.jsxs(a.Fragment,{children:[a.jsxs(L,{gap:3,children:[a.jsx(rs,{}),a.jsx(Ps,{}),a.jsx(_s,{})]}),a.jsx(Is,{}),a.jsx(Ie,{pt:2,children:a.jsx(Es,{})}),a.jsx(Oc,{})]})})})},FO=d.memo(Lue),zue=()=>a.jsxs(a.Fragment,{children:[a.jsx(o2,{}),a.jsx(FO,{}),a.jsx(s2,{}),a.jsx(Yc,{}),a.jsx(Xc,{}),a.jsx(qc,{}),a.jsx(Qc,{})]}),Fue=d.memo(zue),Bue=[{label:"Unmasked",value:"unmasked"},{label:"Mask",value:"mask"},{label:"Mask Edge",value:"edge"}],Hue=()=>{const e=te(),t=W(o=>o.generation.canvasCoherenceMode),{t:n}=Z(),r=o=>{o&&e(fT(o))};return a.jsx(Et,{feature:"compositingCoherenceMode",children:a.jsx(On,{label:n("parameters.coherenceMode"),data:Bue,value:t,onChange:r})})},Vue=d.memo(Hue),Wue=()=>{const e=te(),t=W(r=>r.generation.canvasCoherenceSteps),{t:n}=Z();return a.jsx(Et,{feature:"compositingCoherenceSteps",children:a.jsx(tt,{label:n("parameters.coherenceSteps"),min:1,max:100,step:1,sliderNumberInputProps:{max:999},value:t,onChange:r=>{e(kw(r))},withInput:!0,withSliderMarks:!0,withReset:!0,handleReset:()=>{e(kw(20))}})})},Uue=d.memo(Wue),Gue=()=>{const e=te(),t=W(r=>r.generation.canvasCoherenceStrength),{t:n}=Z();return a.jsx(Et,{feature:"compositingStrength",children:a.jsx(tt,{label:n("parameters.coherenceStrength"),min:0,max:1,step:.01,sliderNumberInputProps:{max:999},value:t,onChange:r=>{e(jw(r))},withInput:!0,withSliderMarks:!0,withReset:!0,handleReset:()=>{e(jw(.3))}})})},Kue=d.memo(Gue);function que(){const e=te(),t=W(r=>r.generation.maskBlur),{t:n}=Z();return a.jsx(Et,{feature:"compositingBlur",children:a.jsx(tt,{label:n("parameters.maskBlur"),min:0,max:64,sliderNumberInputProps:{max:512},value:t,onChange:r=>{e(_w(r))},withInput:!0,withSliderMarks:!0,withReset:!0,handleReset:()=>{e(_w(16))}})})}const Xue=[{label:"Box Blur",value:"box"},{label:"Gaussian Blur",value:"gaussian"}];function Que(){const e=W(o=>o.generation.maskBlurMethod),t=te(),{t:n}=Z(),r=o=>{o&&t(pT(o))};return a.jsx(Et,{feature:"compositingBlurMethod",children:a.jsx(On,{value:e,onChange:r,label:n("parameters.maskBlurMethod"),data:Xue})})}const Yue=()=>{const{t:e}=Z();return a.jsx(oo,{label:e("parameters.compositingSettingsHeader"),children:a.jsxs(L,{sx:{flexDirection:"column",gap:2},children:[a.jsxs(Rc,{label:e("parameters.coherencePassHeader"),children:[a.jsx(Vue,{}),a.jsx(Uue,{}),a.jsx(Kue,{})]}),a.jsx(Yn,{}),a.jsxs(Rc,{label:e("parameters.maskAdjustmentsHeader"),children:[a.jsx(que,{}),a.jsx(Que,{})]})]})})},BO=d.memo(Yue),Zue=ce([xe],({generation:e})=>{const{infillMethod:t}=e;return{infillMethod:t}},je),Jue=()=>{const e=te(),{infillMethod:t}=W(Zue),{data:n,isLoading:r}=iI(),o=n==null?void 0:n.infill_methods,{t:s}=Z(),i=d.useCallback(l=>{e(mT(l))},[e]);return a.jsx(Et,{feature:"infillMethod",children:a.jsx(On,{disabled:(o==null?void 0:o.length)===0,placeholder:r?"Loading...":void 0,label:s("parameters.infillMethod"),value:t,data:o??[],onChange:i})})},ede=d.memo(Jue),tde=ce([os],e=>{const{infillPatchmatchDownscaleSize:t,infillMethod:n}=e;return{infillPatchmatchDownscaleSize:t,infillMethod:n}},je),nde=()=>{const e=te(),{infillPatchmatchDownscaleSize:t,infillMethod:n}=W(tde),{t:r}=Z(),o=d.useCallback(i=>{e(Iw(i))},[e]),s=d.useCallback(()=>{e(Iw(2))},[e]);return a.jsx(tt,{isDisabled:n!=="patchmatch",label:r("parameters.patchmatchDownScaleSize"),min:1,max:10,value:t,onChange:o,withInput:!0,withSliderMarks:!0,withReset:!0,handleReset:s})},rde=d.memo(nde),ode=ce([os],e=>{const{infillTileSize:t,infillMethod:n}=e;return{infillTileSize:t,infillMethod:n}},je),sde=()=>{const e=te(),{infillTileSize:t,infillMethod:n}=W(ode),{t:r}=Z(),o=d.useCallback(i=>{e(Pw(i))},[e]),s=d.useCallback(()=>{e(Pw(32))},[e]);return a.jsx(tt,{isDisabled:n!=="tile",label:r("parameters.tileSize"),min:16,max:64,sliderNumberInputProps:{max:256},value:t,onChange:o,withInput:!0,withSliderMarks:!0,withReset:!0,handleReset:s})},ade=d.memo(sde),ide=ce([os],e=>{const{infillMethod:t}=e;return{infillMethod:t}},je);function lde(){const{infillMethod:e}=W(ide);return a.jsxs(L,{children:[e==="tile"&&a.jsx(ade,{}),e==="patchmatch"&&a.jsx(rde,{})]})}const Sn=e=>e.canvas,Eo=ce([xe],({canvas:e})=>e.batchIds.length>0),cde=ce([Sn],e=>{const{boundingBoxScaleMethod:t}=e;return{boundingBoxScale:t}},je),ude=()=>{const e=te(),{boundingBoxScale:t}=W(cde),{t:n}=Z(),r=o=>{e(gT(o))};return a.jsx(Et,{feature:"scaleBeforeProcessing",children:a.jsx(nn,{label:n("parameters.scaleBeforeProcessing"),data:hT,value:t,onChange:r})})},dde=d.memo(ude),fde=ce([os,Sn],(e,t)=>{const{scaledBoundingBoxDimensions:n,boundingBoxScaleMethod:r}=t,{model:o,aspectRatio:s}=e;return{model:o,scaledBoundingBoxDimensions:n,isManual:r==="manual",aspectRatio:s}},je),pde=()=>{const e=te(),{model:t,isManual:n,scaledBoundingBoxDimensions:r,aspectRatio:o}=W(fde),s=["sdxl","sdxl-refiner"].includes(t==null?void 0:t.base_model)?1024:512,{t:i}=Z(),l=p=>{let m=r.width;const h=Math.floor(p);o&&(m=wr(h*o,64)),e(Jp({width:m,height:h}))},u=()=>{let p=r.width;const m=Math.floor(s);o&&(p=wr(m*o,64)),e(Jp({width:p,height:m}))};return a.jsx(tt,{isDisabled:!n,label:i("parameters.scaledHeight"),min:64,max:1536,step:64,value:r.height,onChange:l,sliderNumberInputProps:{max:4096},withSliderMarks:!0,withInput:!0,withReset:!0,handleReset:u})},mde=d.memo(pde),hde=ce([Sn,os],(e,t)=>{const{boundingBoxScaleMethod:n,scaledBoundingBoxDimensions:r}=e,{model:o,aspectRatio:s}=t;return{model:o,scaledBoundingBoxDimensions:r,aspectRatio:s,isManual:n==="manual"}},je),gde=()=>{const e=te(),{model:t,isManual:n,scaledBoundingBoxDimensions:r,aspectRatio:o}=W(hde),s=["sdxl","sdxl-refiner"].includes(t==null?void 0:t.base_model)?1024:512,{t:i}=Z(),l=p=>{const m=Math.floor(p);let h=r.height;o&&(h=wr(m/o,64)),e(Jp({width:m,height:h}))},u=()=>{const p=Math.floor(s);let m=r.height;o&&(m=wr(p/o,64)),e(Jp({width:p,height:m}))};return a.jsx(tt,{isDisabled:!n,label:i("parameters.scaledWidth"),min:64,max:1536,step:64,value:r.width,onChange:l,sliderNumberInputProps:{max:4096},withSliderMarks:!0,withInput:!0,withReset:!0,handleReset:u})},vde=d.memo(gde),xde=()=>{const{t:e}=Z();return a.jsx(oo,{label:e("parameters.infillScalingHeader"),children:a.jsxs(L,{sx:{gap:2,flexDirection:"column"},children:[a.jsxs(Rc,{children:[a.jsx(ede,{}),a.jsx(lde,{})]}),a.jsx(Yn,{}),a.jsxs(Rc,{children:[a.jsx(dde,{}),a.jsx(vde,{}),a.jsx(mde,{})]})]})})},HO=d.memo(xde),bde=ce([xe,Eo],({canvas:e,generation:t},n)=>{const{boundingBoxDimensions:r}=e,{model:o,aspectRatio:s}=t;return{model:o,boundingBoxDimensions:r,isStaging:n,aspectRatio:s}},je),yde=()=>{const e=te(),{model:t,boundingBoxDimensions:n,isStaging:r,aspectRatio:o}=W(bde),{t:s}=Z(),i=["sdxl","sdxl-refiner"].includes(t==null?void 0:t.base_model)?1024:512,l=p=>{if(e(Vo({...n,height:Math.floor(p)})),o){const m=wr(p*o,64);e(Vo({width:m,height:Math.floor(p)}))}},u=()=>{if(e(Vo({...n,height:Math.floor(i)})),o){const p=wr(i*o,64);e(Vo({width:p,height:Math.floor(i)}))}};return a.jsx(tt,{label:s("parameters.boundingBoxHeight"),min:64,max:1536,step:64,value:n.height,onChange:l,isDisabled:r,sliderNumberInputProps:{max:4096},withSliderMarks:!0,withInput:!0,withReset:!0,handleReset:u})},Cde=d.memo(yde),wde=ce([xe,Eo],({canvas:e,generation:t},n)=>{const{boundingBoxDimensions:r}=e,{model:o,aspectRatio:s}=t;return{model:o,boundingBoxDimensions:r,isStaging:n,aspectRatio:s}},je),Sde=()=>{const e=te(),{model:t,boundingBoxDimensions:n,isStaging:r,aspectRatio:o}=W(wde),s=["sdxl","sdxl-refiner"].includes(t==null?void 0:t.base_model)?1024:512,{t:i}=Z(),l=p=>{if(e(Vo({...n,width:Math.floor(p)})),o){const m=wr(p/o,64);e(Vo({width:Math.floor(p),height:m}))}},u=()=>{if(e(Vo({...n,width:Math.floor(s)})),o){const p=wr(s/o,64);e(Vo({width:Math.floor(s),height:p}))}};return a.jsx(tt,{label:i("parameters.boundingBoxWidth"),min:64,max:1536,step:64,value:n.width,onChange:l,isDisabled:r,sliderNumberInputProps:{max:4096},withSliderMarks:!0,withInput:!0,withReset:!0,handleReset:u})},kde=d.memo(Sde),jde=ce([os,Sn],(e,t)=>{const{shouldFitToWidthHeight:n,shouldLockAspectRatio:r}=e,{boundingBoxDimensions:o}=t;return{shouldFitToWidthHeight:n,shouldLockAspectRatio:r,boundingBoxDimensions:o}});function uh(){const e=te(),{t}=Z(),{shouldLockAspectRatio:n,boundingBoxDimensions:r}=W(jde),o=d.useCallback(()=>{n?(e(qu(!1)),TO.includes(r.width/r.height)?e(zo(r.width/r.height)):e(zo(null))):(e(qu(!0)),e(zo(r.width/r.height)))},[n,r,e]),s=d.useCallback(()=>{e(vT()),e(zo(null)),n&&e(zo(r.height/r.width))},[e,n,r]);return a.jsxs(L,{sx:{gap:2,p:4,borderRadius:4,flexDirection:"column",w:"full",bg:"base.100",_dark:{bg:"base.750"}},children:[a.jsx(Et,{feature:"paramRatio",children:a.jsxs(Kt,{as:L,flexDir:"row",alignItems:"center",gap:2,children:[a.jsx(wn,{children:t("parameters.aspectRatio")}),a.jsx(ba,{}),a.jsx(NO,{}),a.jsx(Fe,{tooltip:t("ui.swapSizes"),"aria-label":t("ui.swapSizes"),size:"sm",icon:a.jsx(z8,{}),fontSize:20,onClick:s}),a.jsx(Fe,{tooltip:t("ui.lockRatio"),"aria-label":t("ui.lockRatio"),size:"sm",icon:a.jsx(mM,{}),isChecked:n,onClick:o})]})}),a.jsx(kde,{}),a.jsx(Cde,{})]})}const _de=ce(xe,({ui:e,generation:t})=>{const{shouldUseSliders:n}=e,{shouldRandomizeSeed:r}=t;return{shouldUseSliders:n,activeLabel:r?void 0:"Manual Seed"}},je),Ide=()=>{const{shouldUseSliders:e,activeLabel:t}=W(_de);return a.jsx(oo,{label:"General",activeLabel:t,defaultIsOpen:!0,children:a.jsxs(L,{sx:{flexDirection:"column",gap:3},children:[e?a.jsxs(a.Fragment,{children:[a.jsx(rs,{}),a.jsx(Ps,{}),a.jsx(_s,{}),a.jsx(Is,{}),a.jsx(Ie,{pt:2,children:a.jsx(Es,{})}),a.jsx(uh,{})]}):a.jsxs(a.Fragment,{children:[a.jsxs(L,{gap:3,children:[a.jsx(rs,{}),a.jsx(Ps,{}),a.jsx(_s,{})]}),a.jsx(Is,{}),a.jsx(Ie,{pt:2,children:a.jsx(Es,{})}),a.jsx(uh,{})]}),a.jsx(zO,{})]})})},Pde=d.memo(Ide);function Ede(){return a.jsxs(a.Fragment,{children:[a.jsx(o2,{}),a.jsx(Pde,{}),a.jsx(s2,{}),a.jsx(Yc,{}),a.jsx(Xc,{}),a.jsx(qc,{}),a.jsx(HO,{}),a.jsx(BO,{}),a.jsx(Qc,{})]})}function i2(){return a.jsxs(L,{sx:{flexDirection:"column",gap:2},children:[a.jsx(RO,{}),a.jsx(OO,{})]})}function Mde(){const e=W(o=>o.generation.horizontalSymmetrySteps),t=W(o=>o.generation.steps),n=te(),{t:r}=Z();return a.jsx(tt,{label:r("parameters.hSymmetryStep"),value:e,onChange:o=>n(Ew(o)),min:0,max:t,step:1,withInput:!0,withSliderMarks:!0,withReset:!0,handleReset:()=>n(Ew(0))})}function Ode(){const e=W(o=>o.generation.verticalSymmetrySteps),t=W(o=>o.generation.steps),n=te(),{t:r}=Z();return a.jsx(tt,{label:r("parameters.vSymmetryStep"),value:e,onChange:o=>n(Mw(o)),min:0,max:t,step:1,withInput:!0,withSliderMarks:!0,withReset:!0,handleReset:()=>n(Mw(0))})}function Rde(){const e=W(n=>n.generation.shouldUseSymmetry),t=te();return a.jsx(dn,{label:"Enable Symmetry",isChecked:e,onChange:n=>t(xT(n.target.checked))})}const Dde=ce(xe,e=>({activeLabel:e.generation.shouldUseSymmetry?"Enabled":void 0}),je),Ade=()=>{const{t:e}=Z(),{activeLabel:t}=W(Dde);return Bt("symmetry").isFeatureEnabled?a.jsx(oo,{label:e("parameters.symmetry"),activeLabel:t,children:a.jsxs(L,{sx:{gap:2,flexDirection:"column"},children:[a.jsx(Rde,{}),a.jsx(Mde,{}),a.jsx(Ode,{})]})}):null},l2=d.memo(Ade),Tde=ce([xe],({generation:e,hotkeys:t,config:n})=>{const{initial:r,min:o,sliderMax:s,inputMax:i,fineStep:l,coarseStep:u}=n.sd.img2imgStrength,{img2imgStrength:p}=e,m=t.shift?l:u;return{img2imgStrength:p,initial:r,min:o,sliderMax:s,inputMax:i,step:m}},je),Nde=()=>{const{img2imgStrength:e,initial:t,min:n,sliderMax:r,inputMax:o,step:s}=W(Tde),i=te(),{t:l}=Z(),u=d.useCallback(m=>i(Zp(m)),[i]),p=d.useCallback(()=>{i(Zp(t))},[i,t]);return a.jsx(Et,{feature:"paramDenoisingStrength",children:a.jsx(Rc,{children:a.jsx(tt,{label:`${l("parameters.denoisingStrength")}`,step:s,min:n,max:r,onChange:u,handleReset:p,value:e,isInteger:!1,withInput:!0,withSliderMarks:!0,withReset:!0,sliderNumberInputProps:{max:o}})})})},VO=d.memo(Nde),$de=()=>{const e=W(n=>n.ui.shouldUseSliders),{iterationsAndSeedLabel:t}=a2();return a.jsx(oo,{label:"General",activeLabel:t,defaultIsOpen:!0,children:a.jsxs(L,{sx:{flexDirection:"column",gap:3},children:[e?a.jsxs(a.Fragment,{children:[a.jsx(rs,{}),a.jsx(Ps,{}),a.jsx(_s,{}),a.jsx(Is,{}),a.jsx(Ie,{pt:2,children:a.jsx(Es,{})}),a.jsx(Oc,{})]}):a.jsxs(a.Fragment,{children:[a.jsxs(L,{gap:3,children:[a.jsx(rs,{}),a.jsx(Ps,{}),a.jsx(_s,{})]}),a.jsx(Is,{}),a.jsx(Ie,{pt:2,children:a.jsx(Es,{})}),a.jsx(Oc,{})]}),a.jsx(VO,{}),a.jsx($O,{})]})})},Lde=d.memo($de),zde=()=>a.jsxs(a.Fragment,{children:[a.jsx(i2,{}),a.jsx(Lde,{}),a.jsx(Yc,{}),a.jsx(Xc,{}),a.jsx(qc,{}),a.jsx(l2,{}),a.jsx(Qc,{})]}),Fde=d.memo(zde),Bde=()=>a.jsxs(a.Fragment,{children:[a.jsx(i2,{}),a.jsx(FO,{}),a.jsx(Yc,{}),a.jsx(Xc,{}),a.jsx(qc,{}),a.jsx(l2,{}),a.jsx(Qc,{})]}),Hde=d.memo(Bde),Vde=()=>{const e=W(n=>n.ui.shouldUseSliders),{iterationsAndSeedLabel:t}=a2();return a.jsx(oo,{label:"General",activeLabel:t,defaultIsOpen:!0,children:a.jsxs(L,{sx:{flexDirection:"column",gap:3},children:[e?a.jsxs(a.Fragment,{children:[a.jsx(rs,{}),a.jsx(Ps,{}),a.jsx(_s,{}),a.jsx(Is,{}),a.jsx(Ie,{pt:2,children:a.jsx(Es,{})}),a.jsx(uh,{})]}):a.jsxs(a.Fragment,{children:[a.jsxs(L,{gap:3,children:[a.jsx(rs,{}),a.jsx(Ps,{}),a.jsx(_s,{})]}),a.jsx(Is,{}),a.jsx(Ie,{pt:2,children:a.jsx(Es,{})}),a.jsx(uh,{})]}),a.jsx(VO,{})]})})},Wde=d.memo(Vde),Ude=()=>a.jsxs(a.Fragment,{children:[a.jsx(i2,{}),a.jsx(Wde,{}),a.jsx(Yc,{}),a.jsx(Xc,{}),a.jsx(qc,{}),a.jsx(l2,{}),a.jsx(HO,{}),a.jsx(BO,{}),a.jsx(Qc,{})]}),Gde=d.memo(Ude),Kde=()=>{const e=W(Jn),t=W(n=>n.generation.model);return e==="txt2img"?a.jsx(Kp,{children:t&&t.base_model==="sdxl"?a.jsx(Fue,{}):a.jsx(Hde,{})}):e==="img2img"?a.jsx(Kp,{children:t&&t.base_model==="sdxl"?a.jsx($ue,{}):a.jsx(Fde,{})}):e==="unifiedCanvas"?a.jsx(Kp,{children:t&&t.base_model==="sdxl"?a.jsx(Ede,{}):a.jsx(Gde,{})}):null},qde=d.memo(Kde),Kp=d.memo(e=>a.jsxs(L,{sx:{w:"full",h:"full",flexDir:"column",gap:2},children:[a.jsx(Q8,{}),a.jsx(L,{layerStyle:"first",sx:{w:"full",h:"full",position:"relative",borderRadius:"base",p:2},children:a.jsx(L,{sx:{w:"full",h:"full",position:"relative"},children:a.jsx(Ie,{sx:{position:"absolute",top:0,left:0,right:0,bottom:0},children:a.jsx(hg,{defer:!0,style:{height:"100%",width:"100%"},options:{scrollbars:{visibility:"auto",autoHide:"scroll",autoHideDelay:800,theme:"os-theme-dark"},overflow:{x:"hidden"}},children:a.jsx(L,{sx:{gap:2,flexDirection:"column",h:"full",w:"full"},children:e.children})})})})})]}));Kp.displayName="ParametersPanelWrapper";const Xde=ce([xe],e=>{const{initialImage:t}=e.generation;return{initialImage:t,isResetButtonDisabled:!t}},je),Qde=()=>{const{initialImage:e}=W(Xde),{currentData:t}=to((e==null?void 0:e.imageName)??$r.skipToken),n=d.useMemo(()=>{if(t)return{id:"initial-image",payloadType:"IMAGE_DTO",payload:{imageDTO:t}}},[t]),r=d.useMemo(()=>({id:"initial-image",actionType:"SET_INITIAL_IMAGE"}),[]);return a.jsx(ua,{imageDTO:t,droppableData:r,draggableData:n,isUploadDisabled:!0,fitContainer:!0,dropLabel:"Set as Initial Image",noContentFallback:a.jsx(Zn,{label:"No initial image selected"}),dataTestId:"initial-image"})},Yde=d.memo(Qde),Zde=ce([xe],e=>{const{initialImage:t}=e.generation;return{isResetButtonDisabled:!t}},je),Jde={type:"SET_INITIAL_IMAGE"},efe=()=>{const{isResetButtonDisabled:e}=W(Zde),t=te(),{getUploadButtonProps:n,getUploadInputProps:r}=Vy({postUploadAction:Jde}),o=d.useCallback(()=>{t(bT())},[t]);return a.jsxs(L,{layerStyle:"first",sx:{position:"relative",flexDirection:"column",height:"full",width:"full",alignItems:"center",justifyContent:"center",borderRadius:"base",p:2,gap:4},children:[a.jsxs(L,{sx:{w:"full",flexWrap:"wrap",justifyContent:"center",alignItems:"center",gap:2},children:[a.jsx(ve,{sx:{ps:2,fontWeight:600,userSelect:"none",color:"base.700",_dark:{color:"base.200"}},children:"Initial Image"}),a.jsx(ba,{}),a.jsx(Fe,{tooltip:"Upload Initial Image","aria-label":"Upload Initial Image",icon:a.jsx(cg,{}),...n()}),a.jsx(Fe,{tooltip:"Reset Initial Image","aria-label":"Reset Initial Image",icon:a.jsx(Ud,{}),onClick:o,isDisabled:e})]}),a.jsx(Yde,{}),a.jsx("input",{...r()})]})},tfe=d.memo(efe),nfe=e=>{const{onClick:t,isDisabled:n}=e,{t:r}=Z(),o=W(s=>s.system.isConnected);return a.jsx(Fe,{onClick:t,icon:a.jsx(Br,{}),tooltip:`${r("gallery.deleteImage")} (Del)`,"aria-label":`${r("gallery.deleteImage")} (Del)`,isDisabled:n||!o,colorScheme:"error"})},WO=()=>{const[e,{isLoading:t}]=bh({fixedCacheKey:"enqueueBatch"}),[n,{isLoading:r}]=yT({fixedCacheKey:"enqueueGraph"}),[o,{isLoading:s}]=SI({fixedCacheKey:"resumeProcessor"}),[i,{isLoading:l}]=CI({fixedCacheKey:"pauseProcessor"}),[u,{isLoading:p}]=Yx({fixedCacheKey:"cancelQueueItem"}),[m,{isLoading:h}]=yI({fixedCacheKey:"clearQueue"}),[g,{isLoading:x}]=RI({fixedCacheKey:"pruneQueue"});return t||r||s||l||p||h||x},rfe=[{label:"RealESRGAN x2 Plus",value:"RealESRGAN_x2plus.pth",tooltip:"Attempts to retain sharpness, low smoothing",group:"x2 Upscalers"},{label:"RealESRGAN x4 Plus",value:"RealESRGAN_x4plus.pth",tooltip:"Best for photos and highly detailed images, medium smoothing",group:"x4 Upscalers"},{label:"RealESRGAN x4 Plus (anime 6B)",value:"RealESRGAN_x4plus_anime_6B.pth",tooltip:"Best for anime/manga, high smoothing",group:"x4 Upscalers"},{label:"ESRGAN SRx4",value:"ESRGAN_SRx4_DF2KOST_official-ff704c30.pth",tooltip:"Retains sharpness, low smoothing",group:"x4 Upscalers"}];function ofe(){const e=W(r=>r.postprocessing.esrganModelName),t=te(),n=r=>t(CT(r));return a.jsx(On,{label:"ESRGAN Model",value:e,itemComponent:ci,onChange:n,data:rfe})}const sfe=e=>{const{imageDTO:t}=e,n=te(),r=WO(),{t:o}=Z(),{isOpen:s,onOpen:i,onClose:l}=Lr(),{isAllowedToUpscale:u,detail:p}=wT(t),m=d.useCallback(()=>{l(),!(!t||!u)&&n(DI({imageDTO:t}))},[n,t,u,l]);return a.jsx(qd,{isOpen:s,onClose:l,triggerComponent:a.jsx(Fe,{tooltip:o("parameters.upscale"),onClick:i,icon:a.jsx(uM,{}),"aria-label":o("parameters.upscale")}),children:a.jsxs(L,{sx:{flexDirection:"column",gap:4},children:[a.jsx(ofe,{}),a.jsx(at,{tooltip:p,size:"sm",isDisabled:!t||r||!u,onClick:m,children:o("parameters.upscaleImage")})]})})},afe=d.memo(sfe),ife=ce([xe,Jn],({gallery:e,system:t,ui:n,config:r},o)=>{const{isConnected:s,shouldConfirmOnDelete:i,denoiseProgress:l}=t,{shouldShowImageDetails:u,shouldHidePreview:p,shouldShowProgressInViewer:m}=n,{shouldFetchMetadataFromApi:h}=r,g=e.selection[e.selection.length-1];return{shouldConfirmOnDelete:i,isConnected:s,shouldDisableToolbarButtons:!!(l!=null&&l.progress_image)||!g,shouldShowImageDetails:u,activeTabName:o,shouldHidePreview:p,shouldShowProgressInViewer:m,lastSelectedImage:g,shouldFetchMetadataFromApi:h}},{memoizeOptions:{resultEqualityCheck:Ft}}),lfe=e=>{const t=te(),{isConnected:n,shouldDisableToolbarButtons:r,shouldShowImageDetails:o,lastSelectedImage:s,shouldShowProgressInViewer:i,shouldFetchMetadataFromApi:l}=W(ife),u=Bt("upscaling").isFeatureEnabled,p=WO(),m=sl(),{t:h}=Z(),{recallBothPrompts:g,recallSeed:x,recallAllParameters:y}=Sg(),{currentData:b}=to((s==null?void 0:s.image_name)??$r.skipToken),w=d.useMemo(()=>s?{image:s,shouldFetchMetadataFromApi:l}:$r.skipToken,[s,l]),{metadata:S,workflow:j,isLoading:_}=Gx(w,{selectFromResult:B=>{var V,U;return{isLoading:B.isFetching,metadata:(V=B==null?void 0:B.currentData)==null?void 0:V.metadata,workflow:(U=B==null?void 0:B.currentData)==null?void 0:U.workflow}}}),E=d.useCallback(()=>{j&&t(Xx(j))},[t,j]),I=d.useCallback(()=>{y(S)},[S,y]);et("a",()=>{},[S,y]);const M=d.useCallback(()=>{x(S==null?void 0:S.seed)},[S==null?void 0:S.seed,x]);et("s",M,[b]);const R=d.useCallback(()=>{g(S==null?void 0:S.positive_prompt,S==null?void 0:S.negative_prompt,S==null?void 0:S.positive_style_prompt,S==null?void 0:S.negative_style_prompt)},[S==null?void 0:S.negative_prompt,S==null?void 0:S.positive_prompt,S==null?void 0:S.positive_style_prompt,S==null?void 0:S.negative_style_prompt,g]);et("p",R,[b]),et("w",E,[j]);const D=d.useCallback(()=>{t(F8()),t(vh(b))},[t,b]);et("shift+i",D,[b]);const A=d.useCallback(()=>{b&&t(DI({imageDTO:b}))},[t,b]),O=d.useCallback(()=>{b&&t(xh([b]))},[t,b]);et("Shift+U",()=>{A()},{enabled:()=>!!(u&&!r&&n)},[u,b,r,n]);const T=d.useCallback(()=>t(ST(!o)),[t,o]);et("i",()=>{b?T():m({title:h("toast.metadataLoadFailed"),status:"error",duration:2500,isClosable:!0})},[b,o,m]),et("delete",()=>{O()},[t,b]);const X=d.useCallback(()=>{t(lI(!i))},[t,i]);return a.jsx(a.Fragment,{children:a.jsxs(L,{sx:{flexWrap:"wrap",justifyContent:"center",alignItems:"center",gap:2},...e,children:[a.jsx(Vt,{isAttached:!0,isDisabled:r,children:a.jsxs(Ah,{children:[a.jsx(Th,{as:Fe,"aria-label":h("parameters.imageActions"),tooltip:h("parameters.imageActions"),isDisabled:!b,icon:a.jsx(xoe,{})}),a.jsx(Ui,{motionProps:vc,children:b&&a.jsx(B8,{imageDTO:b})})]})}),a.jsxs(Vt,{isAttached:!0,isDisabled:r,children:[a.jsx(Fe,{isLoading:_,icon:a.jsx(Wy,{}),tooltip:`${h("nodes.loadWorkflow")} (W)`,"aria-label":`${h("nodes.loadWorkflow")} (W)`,isDisabled:!j,onClick:E}),a.jsx(Fe,{isLoading:_,icon:a.jsx(gM,{}),tooltip:`${h("parameters.usePrompt")} (P)`,"aria-label":`${h("parameters.usePrompt")} (P)`,isDisabled:!(S!=null&&S.positive_prompt),onClick:R}),a.jsx(Fe,{isLoading:_,icon:a.jsx(vM,{}),tooltip:`${h("parameters.useSeed")} (S)`,"aria-label":`${h("parameters.useSeed")} (S)`,isDisabled:(S==null?void 0:S.seed)===null||(S==null?void 0:S.seed)===void 0,onClick:M}),a.jsx(Fe,{isLoading:_,icon:a.jsx(aM,{}),tooltip:`${h("parameters.useAll")} (A)`,"aria-label":`${h("parameters.useAll")} (A)`,isDisabled:!S,onClick:I})]}),u&&a.jsx(Vt,{isAttached:!0,isDisabled:p,children:u&&a.jsx(afe,{imageDTO:b})}),a.jsx(Vt,{isAttached:!0,children:a.jsx(Fe,{icon:a.jsx(lM,{}),tooltip:`${h("parameters.info")} (I)`,"aria-label":`${h("parameters.info")} (I)`,isChecked:o,onClick:T})}),a.jsx(Vt,{isAttached:!0,children:a.jsx(Fe,{"aria-label":h("settings.displayInProgress"),tooltip:h("settings.displayInProgress"),icon:a.jsx(VJ,{}),isChecked:i,onClick:X})}),a.jsx(Vt,{isAttached:!0,children:a.jsx(nfe,{onClick:O})})]})})},cfe=d.memo(lfe),ufe=ce([xe,Qx],(e,t)=>{var j,_;const{data:n,status:r}=kT.endpoints.listImages.select(t)(e),{data:o}=e.gallery.galleryView==="images"?Ow.endpoints.getBoardImagesTotal.select(t.board_id??"none")(e):Ow.endpoints.getBoardAssetsTotal.select(t.board_id??"none")(e),s=e.gallery.selection[e.gallery.selection.length-1],i=r==="pending";if(!n||!s||o===0)return{isFetching:i,queryArgs:t,isOnFirstImage:!0,isOnLastImage:!0};const l={...t,offset:n.ids.length,limit:bI},u=jT.getSelectors(),p=u.selectAll(n),m=p.findIndex(E=>E.image_name===s.image_name),h=Fi(m+1,0,p.length-1),g=Fi(m-1,0,p.length-1),x=(j=p[h])==null?void 0:j.image_name,y=(_=p[g])==null?void 0:_.image_name,b=x?u.selectById(n,x):void 0,w=y?u.selectById(n,y):void 0,S=p.length;return{loadedImagesCount:p.length,currentImageIndex:m,areMoreImagesAvailable:(o??0)>S,isFetching:r==="pending",nextImage:b,prevImage:w,queryArgs:l}},{memoizeOptions:{resultEqualityCheck:Ft}}),UO=()=>{const e=te(),{nextImage:t,prevImage:n,areMoreImagesAvailable:r,isFetching:o,queryArgs:s,loadedImagesCount:i,currentImageIndex:l}=W(ufe),u=d.useCallback(()=>{n&&e(Rw(n))},[e,n]),p=d.useCallback(()=>{t&&e(Rw(t))},[e,t]),[m]=xI(),h=d.useCallback(()=>{m(s)},[m,s]);return{handlePrevImage:u,handleNextImage:p,isOnFirstImage:l===0,isOnLastImage:l!==void 0&&l===i-1,nextImage:t,prevImage:n,areMoreImagesAvailable:r,handleLoadMoreImages:h,isFetching:o}};function dfe(e){return Te({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M245.09 327.74v-37.32c57.07 0 84.51 13.47 108.58 38.68 5.4 5.65 15 1.32 14.29-6.43-5.45-61.45-34.14-117.09-122.87-117.09v-37.32a8.32 8.32 0 00-14.05-6L146.58 242a8.2 8.2 0 000 11.94L231 333.71a8.32 8.32 0 0014.09-5.97z"}},{tag:"path",attr:{fill:"none",strokeMiterlimit:"10",strokeWidth:"32",d:"M256 64C150 64 64 150 64 256s86 192 192 192 192-86 192-192S362 64 256 64z"}}]})(e)}const ffe=({label:e,value:t,onClick:n,isLink:r,labelPosition:o,withCopy:s=!1})=>{const{t:i}=Z();return t?a.jsxs(L,{gap:2,children:[n&&a.jsx(Ht,{label:`Recall ${e}`,children:a.jsx(ys,{"aria-label":i("accessibility.useThisParameter"),icon:a.jsx(dfe,{}),size:"xs",variant:"ghost",fontSize:20,onClick:n})}),s&&a.jsx(Ht,{label:`Copy ${e}`,children:a.jsx(ys,{"aria-label":`Copy ${e}`,icon:a.jsx(Hc,{}),size:"xs",variant:"ghost",fontSize:14,onClick:()=>navigator.clipboard.writeText(t.toString())})}),a.jsxs(L,{direction:o?"column":"row",children:[a.jsxs(ve,{fontWeight:"semibold",whiteSpace:"pre-wrap",pr:2,children:[e,":"]}),r?a.jsxs(Oh,{href:t.toString(),isExternal:!0,wordBreak:"break-all",children:[t.toString()," ",a.jsx(JM,{mx:"2px"})]}):a.jsx(ve,{overflowY:"scroll",wordBreak:"break-all",children:t.toString()})]})]}):null},xr=d.memo(ffe),pfe=e=>{const{metadata:t}=e,{t:n}=Z(),{recallPositivePrompt:r,recallNegativePrompt:o,recallSeed:s,recallCfgScale:i,recallModel:l,recallScheduler:u,recallSteps:p,recallWidth:m,recallHeight:h,recallStrength:g,recallLoRA:x,recallControlNet:y,recallIPAdapter:b}=Sg(),w=d.useCallback(()=>{r(t==null?void 0:t.positive_prompt)},[t==null?void 0:t.positive_prompt,r]),S=d.useCallback(()=>{o(t==null?void 0:t.negative_prompt)},[t==null?void 0:t.negative_prompt,o]),j=d.useCallback(()=>{s(t==null?void 0:t.seed)},[t==null?void 0:t.seed,s]),_=d.useCallback(()=>{l(t==null?void 0:t.model)},[t==null?void 0:t.model,l]),E=d.useCallback(()=>{m(t==null?void 0:t.width)},[t==null?void 0:t.width,m]),I=d.useCallback(()=>{h(t==null?void 0:t.height)},[t==null?void 0:t.height,h]),M=d.useCallback(()=>{u(t==null?void 0:t.scheduler)},[t==null?void 0:t.scheduler,u]),R=d.useCallback(()=>{p(t==null?void 0:t.steps)},[t==null?void 0:t.steps,p]),D=d.useCallback(()=>{i(t==null?void 0:t.cfg_scale)},[t==null?void 0:t.cfg_scale,i]),A=d.useCallback(()=>{g(t==null?void 0:t.strength)},[t==null?void 0:t.strength,g]),O=d.useCallback(U=>{x(U)},[x]),T=d.useCallback(U=>{y(U)},[y]),X=d.useCallback(U=>{b(U)},[b]),B=d.useMemo(()=>t!=null&&t.controlnets?t.controlnets.filter(U=>c1(U.control_model)):[],[t==null?void 0:t.controlnets]),V=d.useMemo(()=>t!=null&&t.ipAdapters?t.ipAdapters.filter(U=>c1(U.ip_adapter_model)):[],[t==null?void 0:t.ipAdapters]);return!t||Object.keys(t).length===0?null:a.jsxs(a.Fragment,{children:[t.created_by&&a.jsx(xr,{label:n("metadata.createdBy"),value:t.created_by}),t.generation_mode&&a.jsx(xr,{label:n("metadata.generationMode"),value:t.generation_mode}),t.positive_prompt&&a.jsx(xr,{label:n("metadata.positivePrompt"),labelPosition:"top",value:t.positive_prompt,onClick:w}),t.negative_prompt&&a.jsx(xr,{label:n("metadata.negativePrompt"),labelPosition:"top",value:t.negative_prompt,onClick:S}),t.seed!==void 0&&t.seed!==null&&a.jsx(xr,{label:n("metadata.seed"),value:t.seed,onClick:j}),t.model!==void 0&&t.model!==null&&t.model.model_name&&a.jsx(xr,{label:n("metadata.model"),value:t.model.model_name,onClick:_}),t.width&&a.jsx(xr,{label:n("metadata.width"),value:t.width,onClick:E}),t.height&&a.jsx(xr,{label:n("metadata.height"),value:t.height,onClick:I}),t.scheduler&&a.jsx(xr,{label:n("metadata.scheduler"),value:t.scheduler,onClick:M}),t.steps&&a.jsx(xr,{label:n("metadata.steps"),value:t.steps,onClick:R}),t.cfg_scale!==void 0&&t.cfg_scale!==null&&a.jsx(xr,{label:n("metadata.cfgScale"),value:t.cfg_scale,onClick:D}),t.strength&&a.jsx(xr,{label:n("metadata.strength"),value:t.strength,onClick:A}),t.loras&&t.loras.map((U,N)=>{if(fI(U.lora))return a.jsx(xr,{label:"LoRA",value:`${U.lora.model_name} - ${U.weight}`,onClick:()=>O(U)},N)}),B.map((U,N)=>{var $;return a.jsx(xr,{label:"ControlNet",value:`${($=U.control_model)==null?void 0:$.model_name} - ${U.control_weight}`,onClick:()=>T(U)},N)}),V.map((U,N)=>{var $;return a.jsx(xr,{label:"IP Adapter",value:`${($=U.ip_adapter_model)==null?void 0:$.model_name} - ${U.weight}`,onClick:()=>X(U)},N)})]})},mfe=d.memo(pfe),hfe=({image:e})=>{const{t}=Z(),{shouldFetchMetadataFromApi:n}=W(Ky),{metadata:r,workflow:o}=Gx({image:e,shouldFetchMetadataFromApi:n},{selectFromResult:s=>{var i,l;return{metadata:(i=s==null?void 0:s.currentData)==null?void 0:i.metadata,workflow:(l=s==null?void 0:s.currentData)==null?void 0:l.workflow}}});return a.jsxs(L,{layerStyle:"first",sx:{padding:4,gap:1,flexDirection:"column",width:"full",height:"full",borderRadius:"base",position:"absolute",overflow:"hidden"},children:[a.jsxs(L,{gap:2,children:[a.jsx(ve,{fontWeight:"semibold",children:"File:"}),a.jsxs(Oh,{href:e.image_url,isExternal:!0,maxW:"calc(100% - 3rem)",children:[e.image_name,a.jsx(JM,{mx:"2px"})]})]}),a.jsx(mfe,{metadata:r}),a.jsxs(rl,{variant:"line",sx:{display:"flex",flexDir:"column",w:"full",h:"full"},children:[a.jsxs(ol,{children:[a.jsx(Tr,{children:t("metadata.metadata")}),a.jsx(Tr,{children:t("metadata.imageDetails")}),a.jsx(Tr,{children:t("metadata.workflow")})]}),a.jsxs(zc,{children:[a.jsx(So,{children:r?a.jsx(Ya,{data:r,label:t("metadata.metadata")}):a.jsx(Zn,{label:t("metadata.noMetaData")})}),a.jsx(So,{children:e?a.jsx(Ya,{data:e,label:t("metadata.imageDetails")}):a.jsx(Zn,{label:t("metadata.noImageDetails")})}),a.jsx(So,{children:o?a.jsx(Ya,{data:o,label:t("metadata.workflow")}):a.jsx(Zn,{label:t("nodes.noWorkflow")})})]})]})]})},gfe=d.memo(hfe),Yv={color:"base.100",pointerEvents:"auto"},vfe=()=>{const{t:e}=Z(),{handlePrevImage:t,handleNextImage:n,isOnFirstImage:r,isOnLastImage:o,handleLoadMoreImages:s,areMoreImagesAvailable:i,isFetching:l}=UO();return a.jsxs(Ie,{sx:{position:"relative",height:"100%",width:"100%"},children:[a.jsx(Ie,{sx:{pos:"absolute",top:"50%",transform:"translate(0, -50%)",insetInlineStart:0},children:!r&&a.jsx(ys,{"aria-label":e("accessibility.previousImage"),icon:a.jsx(kJ,{size:64}),variant:"unstyled",onClick:t,boxSize:16,sx:Yv})}),a.jsxs(Ie,{sx:{pos:"absolute",top:"50%",transform:"translate(0, -50%)",insetInlineEnd:0},children:[!o&&a.jsx(ys,{"aria-label":e("accessibility.nextImage"),icon:a.jsx(jJ,{size:64}),variant:"unstyled",onClick:n,boxSize:16,sx:Yv}),o&&i&&!l&&a.jsx(ys,{"aria-label":e("accessibility.loadMore"),icon:a.jsx(SJ,{size:64}),variant:"unstyled",onClick:s,boxSize:16,sx:Yv}),o&&i&&l&&a.jsx(L,{sx:{w:16,h:16,alignItems:"center",justifyContent:"center"},children:a.jsx(fa,{opacity:.5,size:"xl"})})]})]})},GO=d.memo(vfe),xfe=ce([xe,_T],({ui:e,system:t},n)=>{const{shouldShowImageDetails:r,shouldHidePreview:o,shouldShowProgressInViewer:s}=e,{denoiseProgress:i,shouldAntialiasProgressImage:l}=t;return{shouldShowImageDetails:r,shouldHidePreview:o,imageName:n==null?void 0:n.image_name,denoiseProgress:i,shouldShowProgressInViewer:s,shouldAntialiasProgressImage:l}},{memoizeOptions:{resultEqualityCheck:Ft}}),bfe=()=>{const{shouldShowImageDetails:e,imageName:t,denoiseProgress:n,shouldShowProgressInViewer:r,shouldAntialiasProgressImage:o}=W(xfe),{handlePrevImage:s,handleNextImage:i,isOnLastImage:l,handleLoadMoreImages:u,areMoreImagesAvailable:p,isFetching:m}=UO();et("left",()=>{s()},[s]),et("right",()=>{if(l&&p&&!m){u();return}l||i()},[l,p,u,m,i]);const{currentData:h}=to(t??$r.skipToken),g=d.useMemo(()=>{if(h)return{id:"current-image",payloadType:"IMAGE_DTO",payload:{imageDTO:h}}},[h]),x=d.useMemo(()=>({id:"current-image",actionType:"SET_CURRENT_IMAGE"}),[]),[y,b]=d.useState(!1),w=d.useRef(0),{t:S}=Z(),j=d.useCallback(()=>{b(!0),window.clearTimeout(w.current)},[]),_=d.useCallback(()=>{w.current=window.setTimeout(()=>{b(!1)},500)},[]);return a.jsxs(L,{onMouseOver:j,onMouseOut:_,sx:{width:"full",height:"full",alignItems:"center",justifyContent:"center",position:"relative"},children:[n!=null&&n.progress_image&&r?a.jsx(ga,{src:n.progress_image.dataURL,width:n.progress_image.width,height:n.progress_image.height,draggable:!1,"data-testid":"progress-image",sx:{objectFit:"contain",maxWidth:"full",maxHeight:"full",height:"auto",position:"absolute",borderRadius:"base",imageRendering:o?"auto":"pixelated"}}):a.jsx(ua,{imageDTO:h,droppableData:x,draggableData:g,isUploadDisabled:!0,fitContainer:!0,useThumbailFallback:!0,dropLabel:S("gallery.setCurrentImage"),noContentFallback:a.jsx(Zn,{icon:Qi,label:"No image selected"}),dataTestId:"image-preview"}),e&&h&&a.jsx(Ie,{sx:{position:"absolute",top:"0",width:"full",height:"full",borderRadius:"base"},children:a.jsx(gfe,{image:h})}),a.jsx(dr,{children:!e&&h&&y&&a.jsx(In.div,{initial:{opacity:0},animate:{opacity:1,transition:{duration:.1}},exit:{opacity:0,transition:{duration:.1}},style:{position:"absolute",top:"0",width:"100%",height:"100%",pointerEvents:"none"},children:a.jsx(GO,{})},"nextPrevButtons")})]})},yfe=d.memo(bfe),Cfe=()=>a.jsxs(L,{sx:{position:"relative",flexDirection:"column",height:"100%",width:"100%",rowGap:4,alignItems:"center",justifyContent:"center"},children:[a.jsx(cfe,{}),a.jsx(yfe,{})]}),wfe=d.memo(Cfe),Sfe=()=>a.jsx(Ie,{layerStyle:"first",sx:{position:"relative",width:"100%",height:"100%",p:2,borderRadius:"base"},children:a.jsx(L,{sx:{width:"100%",height:"100%"},children:a.jsx(wfe,{})})}),KO=d.memo(Sfe),kfe=()=>{const e=d.useRef(null),t=d.useCallback(()=>{e.current&&e.current.setLayout([50,50])},[]),n=Jy();return a.jsx(Ie,{sx:{w:"full",h:"full"},children:a.jsxs(Ig,{ref:e,autoSaveId:"imageTab.content",direction:"horizontal",style:{height:"100%",width:"100%"},storage:n,units:"percentages",children:[a.jsx(Qa,{id:"imageTab.content.initImage",order:0,defaultSize:50,minSize:25,style:{position:"relative"},children:a.jsx(tfe,{})}),a.jsx(lh,{onDoubleClick:t}),a.jsx(Qa,{id:"imageTab.content.selectedImage",order:1,defaultSize:50,minSize:25,children:a.jsx(KO,{})})]})})},jfe=d.memo(kfe);var _fe=function e(t,n){if(t===n)return!0;if(t&&n&&typeof t=="object"&&typeof n=="object"){if(t.constructor!==n.constructor)return!1;var r,o,s;if(Array.isArray(t)){if(r=t.length,r!=n.length)return!1;for(o=r;o--!==0;)if(!e(t[o],n[o]))return!1;return!0}if(t.constructor===RegExp)return t.source===n.source&&t.flags===n.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===n.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===n.toString();if(s=Object.keys(t),r=s.length,r!==Object.keys(n).length)return!1;for(o=r;o--!==0;)if(!Object.prototype.hasOwnProperty.call(n,s[o]))return!1;for(o=r;o--!==0;){var i=s[o];if(!e(t[i],n[i]))return!1}return!0}return t!==t&&n!==n};const f_=xd(_fe);function Ex(e){return e===null||typeof e!="object"?{}:Object.keys(e).reduce((t,n)=>{const r=e[n];return r!=null&&r!==!1&&(t[n]=r),t},{})}var Ife=Object.defineProperty,p_=Object.getOwnPropertySymbols,Pfe=Object.prototype.hasOwnProperty,Efe=Object.prototype.propertyIsEnumerable,m_=(e,t,n)=>t in e?Ife(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Mfe=(e,t)=>{for(var n in t||(t={}))Pfe.call(t,n)&&m_(e,n,t[n]);if(p_)for(var n of p_(t))Efe.call(t,n)&&m_(e,n,t[n]);return e};function qO(e,t){if(t===null||typeof t!="object")return{};const n=Mfe({},t);return Object.keys(t).forEach(r=>{r.includes(`${String(e)}.`)&&delete n[r]}),n}const Ofe="__MANTINE_FORM_INDEX__";function h_(e,t){return t?typeof t=="boolean"?t:Array.isArray(t)?t.includes(e.replace(/[.][0-9]/g,`.${Ofe}`)):!1:!1}function g_(e,t,n){typeof n.value=="object"&&(n.value=tc(n.value)),!n.enumerable||n.get||n.set||!n.configurable||!n.writable||t==="__proto__"?Object.defineProperty(e,t,n):e[t]=n.value}function tc(e){if(typeof e!="object")return e;var t=0,n,r,o,s=Object.prototype.toString.call(e);if(s==="[object Object]"?o=Object.create(e.__proto__||null):s==="[object Array]"?o=Array(e.length):s==="[object Set]"?(o=new Set,e.forEach(function(i){o.add(tc(i))})):s==="[object Map]"?(o=new Map,e.forEach(function(i,l){o.set(tc(l),tc(i))})):s==="[object Date]"?o=new Date(+e):s==="[object RegExp]"?o=new RegExp(e.source,e.flags):s==="[object DataView]"?o=new e.constructor(tc(e.buffer)):s==="[object ArrayBuffer]"?o=e.slice(0):s.slice(-6)==="Array]"&&(o=new e.constructor(e)),o){for(r=Object.getOwnPropertySymbols(e);t0,errors:t}}function Mx(e,t,n="",r={}){return typeof e!="object"||e===null?r:Object.keys(e).reduce((o,s)=>{const i=e[s],l=`${n===""?"":`${n}.`}${s}`,u=Qs(l,t);let p=!1;return typeof i=="function"&&(o[l]=i(u,t,l)),typeof i=="object"&&Array.isArray(u)&&(p=!0,u.forEach((m,h)=>Mx(i,t,`${l}.${h}`,o))),typeof i=="object"&&typeof u=="object"&&u!==null&&(p||Mx(i,t,l,o)),o},r)}function Ox(e,t){return v_(typeof e=="function"?e(t):Mx(e,t))}function Dp(e,t,n){if(typeof e!="string")return{hasError:!1,error:null};const r=Ox(t,n),o=Object.keys(r.errors).find(s=>e.split(".").every((i,l)=>i===s.split(".")[l]));return{hasError:!!o,error:o?r.errors[o]:null}}function Rfe(e,{from:t,to:n},r){const o=Qs(e,r);if(!Array.isArray(o))return r;const s=[...o],i=o[t];return s.splice(t,1),s.splice(n,0,i),Ag(e,s,r)}var Dfe=Object.defineProperty,x_=Object.getOwnPropertySymbols,Afe=Object.prototype.hasOwnProperty,Tfe=Object.prototype.propertyIsEnumerable,b_=(e,t,n)=>t in e?Dfe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Nfe=(e,t)=>{for(var n in t||(t={}))Afe.call(t,n)&&b_(e,n,t[n]);if(x_)for(var n of x_(t))Tfe.call(t,n)&&b_(e,n,t[n]);return e};function $fe(e,{from:t,to:n},r){const o=`${e}.${t}`,s=`${e}.${n}`,i=Nfe({},r);return Object.keys(r).every(l=>{let u,p;if(l.startsWith(o)&&(u=l,p=l.replace(o,s)),l.startsWith(s)&&(u=l.replace(s,o),p=l),u&&p){const m=i[u],h=i[p];return h===void 0?delete i[u]:i[u]=h,m===void 0?delete i[p]:i[p]=m,!1}return!0}),i}function Lfe(e,t,n){const r=Qs(e,n);return Array.isArray(r)?Ag(e,r.filter((o,s)=>s!==t),n):n}var zfe=Object.defineProperty,y_=Object.getOwnPropertySymbols,Ffe=Object.prototype.hasOwnProperty,Bfe=Object.prototype.propertyIsEnumerable,C_=(e,t,n)=>t in e?zfe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Hfe=(e,t)=>{for(var n in t||(t={}))Ffe.call(t,n)&&C_(e,n,t[n]);if(y_)for(var n of y_(t))Bfe.call(t,n)&&C_(e,n,t[n]);return e};function w_(e,t){const n=e.substring(t.length+1).split(".")[0];return parseInt(n,10)}function S_(e,t,n,r){if(t===void 0)return n;const o=`${String(e)}`;let s=n;r===-1&&(s=qO(`${o}.${t}`,s));const i=Hfe({},s),l=new Set;return Object.entries(s).filter(([u])=>{if(!u.startsWith(`${o}.`))return!1;const p=w_(u,o);return Number.isNaN(p)?!1:p>=t}).forEach(([u,p])=>{const m=w_(u,o),h=u.replace(`${o}.${m}`,`${o}.${m+r}`);i[h]=p,l.add(h),l.has(u)||delete i[u]}),i}function Vfe(e,t,n,r){const o=Qs(e,r);if(!Array.isArray(o))return r;const s=[...o];return s.splice(typeof n=="number"?n:s.length,0,t),Ag(e,s,r)}function k_(e,t){const n=Object.keys(e);if(typeof t=="string"){const r=n.filter(o=>o.startsWith(`${t}.`));return e[t]||r.some(o=>e[o])||!1}return n.some(r=>e[r])}function Wfe(e){return t=>{if(!t)e(t);else if(typeof t=="function")e(t);else if(typeof t=="object"&&"nativeEvent"in t){const{currentTarget:n}=t;n instanceof HTMLInputElement?n.type==="checkbox"?e(n.checked):e(n.value):(n instanceof HTMLTextAreaElement||n instanceof HTMLSelectElement)&&e(n.value)}else e(t)}}var Ufe=Object.defineProperty,Gfe=Object.defineProperties,Kfe=Object.getOwnPropertyDescriptors,j_=Object.getOwnPropertySymbols,qfe=Object.prototype.hasOwnProperty,Xfe=Object.prototype.propertyIsEnumerable,__=(e,t,n)=>t in e?Ufe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,La=(e,t)=>{for(var n in t||(t={}))qfe.call(t,n)&&__(e,n,t[n]);if(j_)for(var n of j_(t))Xfe.call(t,n)&&__(e,n,t[n]);return e},Zv=(e,t)=>Gfe(e,Kfe(t));function fl({initialValues:e={},initialErrors:t={},initialDirty:n={},initialTouched:r={},clearInputErrorOnChange:o=!0,validateInputOnChange:s=!1,validateInputOnBlur:i=!1,transformValues:l=p=>p,validate:u}={}){const[p,m]=d.useState(r),[h,g]=d.useState(n),[x,y]=d.useState(e),[b,w]=d.useState(Ex(t)),S=d.useRef(e),j=G=>{S.current=G},_=d.useCallback(()=>m({}),[]),E=G=>{const K=G?La(La({},x),G):x;j(K),g({})},I=d.useCallback(G=>w(K=>Ex(typeof G=="function"?G(K):G)),[]),M=d.useCallback(()=>w({}),[]),R=d.useCallback(()=>{y(e),M(),j(e),g({}),_()},[]),D=d.useCallback((G,K)=>I(ee=>Zv(La({},ee),{[G]:K})),[]),A=d.useCallback(G=>I(K=>{if(typeof G!="string")return K;const ee=La({},K);return delete ee[G],ee}),[]),O=d.useCallback(G=>g(K=>{if(typeof G!="string")return K;const ee=qO(G,K);return delete ee[G],ee}),[]),T=d.useCallback((G,K)=>{const ee=h_(G,s);O(G),m(le=>Zv(La({},le),{[G]:!0})),y(le=>{const J=Ag(G,K,le);if(ee){const ie=Dp(G,u,J);ie.hasError?D(G,ie.error):A(G)}return J}),!ee&&o&&D(G,null)},[]),X=d.useCallback(G=>{y(K=>{const ee=typeof G=="function"?G(K):G;return La(La({},K),ee)}),o&&M()},[]),B=d.useCallback((G,K)=>{O(G),y(ee=>Rfe(G,K,ee)),w(ee=>$fe(G,K,ee))},[]),V=d.useCallback((G,K)=>{O(G),y(ee=>Lfe(G,K,ee)),w(ee=>S_(G,K,ee,-1))},[]),U=d.useCallback((G,K,ee)=>{O(G),y(le=>Vfe(G,K,ee,le)),w(le=>S_(G,ee,le,1))},[]),N=d.useCallback(()=>{const G=Ox(u,x);return w(G.errors),G},[x,u]),$=d.useCallback(G=>{const K=Dp(G,u,x);return K.hasError?D(G,K.error):A(G),K},[x,u]),q=(G,{type:K="input",withError:ee=!0,withFocus:le=!0}={})=>{const ie={onChange:Wfe(de=>T(G,de))};return ee&&(ie.error=b[G]),K==="checkbox"?ie.checked=Qs(G,x):ie.value=Qs(G,x),le&&(ie.onFocus=()=>m(de=>Zv(La({},de),{[G]:!0})),ie.onBlur=()=>{if(h_(G,i)){const de=Dp(G,u,x);de.hasError?D(G,de.error):A(G)}}),ie},F=(G,K)=>ee=>{ee==null||ee.preventDefault();const le=N();le.hasErrors?K==null||K(le.errors,x,ee):G==null||G(l(x),ee)},Q=G=>l(G||x),Y=d.useCallback(G=>{G.preventDefault(),R()},[]),se=G=>{if(G){const ee=Qs(G,h);if(typeof ee=="boolean")return ee;const le=Qs(G,x),J=Qs(G,S.current);return!f_(le,J)}return Object.keys(h).length>0?k_(h):!f_(x,S.current)},ae=d.useCallback(G=>k_(p,G),[p]),re=d.useCallback(G=>G?!Dp(G,u,x).hasError:!Ox(u,x).hasErrors,[x,u]);return{values:x,errors:b,setValues:X,setErrors:I,setFieldValue:T,setFieldError:D,clearFieldError:A,clearErrors:M,reset:R,validate:N,validateField:$,reorderListItem:B,removeListItem:V,insertListItem:U,getInputProps:q,onSubmit:F,onReset:Y,isDirty:se,isTouched:ae,setTouched:m,setDirty:g,resetTouched:_,resetDirty:E,isValid:re,getTransformedValues:Q}}function _n(e){const{...t}=e,{base50:n,base100:r,base200:o,base300:s,base800:i,base700:l,base900:u,accent500:p,accent300:m}=Wd(),{colorMode:h}=ha();return a.jsx(QE,{styles:()=>({input:{color:Ae(u,r)(h),backgroundColor:Ae(n,u)(h),borderColor:Ae(o,i)(h),borderWidth:2,outline:"none",":focus":{borderColor:Ae(m,p)(h)}},label:{color:Ae(l,s)(h),fontWeight:"normal",marginBottom:4}}),...t})}const Qfe=[{value:"sd-1",label:mn["sd-1"]},{value:"sd-2",label:mn["sd-2"]},{value:"sdxl",label:mn.sdxl},{value:"sdxl-refiner",label:mn["sdxl-refiner"]}];function Jd(e){const{...t}=e,{t:n}=Z();return a.jsx(On,{label:n("modelManager.baseModel"),data:Qfe,...t})}function QO(e){const{data:t}=AI(),{...n}=e;return a.jsx(On,{label:"Config File",placeholder:"Select A Config File",data:t||[],...n})}const Yfe=[{value:"normal",label:"Normal"},{value:"inpaint",label:"Inpaint"},{value:"depth",label:"Depth"}];function Tg(e){const{...t}=e,{t:n}=Z();return a.jsx(On,{label:n("modelManager.variant"),data:Yfe,...t})}function dh(e,t=!0){let n;t?n=new RegExp("[^\\\\/]+(?=\\.)"):n=new RegExp("[^\\\\/]+(?=[\\\\/]?$)");const r=e.match(n);return r?r[0]:""}function YO(e){const{t}=Z(),n=te(),{model_path:r}=e,o=fl({initialValues:{model_name:r?dh(r):"",base_model:"sd-1",model_type:"main",path:r||"",description:"",model_format:"checkpoint",error:void 0,vae:"",variant:"normal",config:"configs\\stable-diffusion\\v1-inference.yaml"}}),[s]=TI(),[i,l]=d.useState(!1),u=p=>{s({body:p}).unwrap().then(m=>{n(ct(Qt({title:t("modelManager.modelAdded",{modelName:p.model_name}),status:"success"}))),o.reset(),r&&n(Sd(null))}).catch(m=>{m&&n(ct(Qt({title:t("toast.modelAddFailed"),status:"error"})))})};return a.jsx("form",{onSubmit:o.onSubmit(p=>u(p)),style:{width:"100%"},children:a.jsxs(L,{flexDirection:"column",gap:2,children:[a.jsx(_n,{label:t("modelManager.model"),required:!0,...o.getInputProps("model_name")}),a.jsx(Jd,{label:t("modelManager.baseModel"),...o.getInputProps("base_model")}),a.jsx(_n,{label:t("modelManager.modelLocation"),required:!0,...o.getInputProps("path"),onBlur:p=>{if(o.values.model_name===""){const m=dh(p.currentTarget.value);m&&o.setFieldValue("model_name",m)}}}),a.jsx(_n,{label:t("modelManager.description"),...o.getInputProps("description")}),a.jsx(_n,{label:t("modelManager.vaeLocation"),...o.getInputProps("vae")}),a.jsx(Tg,{label:t("modelManager.variant"),...o.getInputProps("variant")}),a.jsxs(L,{flexDirection:"column",width:"100%",gap:2,children:[i?a.jsx(_n,{required:!0,label:t("modelManager.customConfigFileLocation"),...o.getInputProps("config")}):a.jsx(QO,{required:!0,width:"100%",...o.getInputProps("config")}),a.jsx(br,{isChecked:i,onChange:()=>l(!i),label:t("modelManager.useCustomConfig")}),a.jsx(at,{mt:2,type:"submit",children:t("modelManager.addModel")})]})]})})}function ZO(e){const{t}=Z(),n=te(),{model_path:r}=e,[o]=TI(),s=fl({initialValues:{model_name:r?dh(r,!1):"",base_model:"sd-1",model_type:"main",path:r||"",description:"",model_format:"diffusers",error:void 0,vae:"",variant:"normal"}}),i=l=>{o({body:l}).unwrap().then(u=>{n(ct(Qt({title:t("modelManager.modelAdded",{modelName:l.model_name}),status:"success"}))),s.reset(),r&&n(Sd(null))}).catch(u=>{u&&n(ct(Qt({title:t("toast.modelAddFailed"),status:"error"})))})};return a.jsx("form",{onSubmit:s.onSubmit(l=>i(l)),style:{width:"100%"},children:a.jsxs(L,{flexDirection:"column",gap:2,children:[a.jsx(_n,{required:!0,label:t("modelManager.model"),...s.getInputProps("model_name")}),a.jsx(Jd,{label:t("modelManager.baseModel"),...s.getInputProps("base_model")}),a.jsx(_n,{required:!0,label:t("modelManager.modelLocation"),placeholder:t("modelManager.modelLocationValidationMsg"),...s.getInputProps("path"),onBlur:l=>{if(s.values.model_name===""){const u=dh(l.currentTarget.value,!1);u&&s.setFieldValue("model_name",u)}}}),a.jsx(_n,{label:t("modelManager.description"),...s.getInputProps("description")}),a.jsx(_n,{label:t("modelManager.vaeLocation"),...s.getInputProps("vae")}),a.jsx(Tg,{label:t("modelManager.variant"),...s.getInputProps("variant")}),a.jsx(at,{mt:2,type:"submit",children:t("modelManager.addModel")})]})})}const JO=[{label:"Diffusers",value:"diffusers"},{label:"Checkpoint / Safetensors",value:"checkpoint"}];function Zfe(){const[e,t]=d.useState("diffusers"),{t:n}=Z();return a.jsxs(L,{flexDirection:"column",gap:4,width:"100%",children:[a.jsx(On,{label:n("modelManager.modelType"),value:e,data:JO,onChange:r=>{r&&t(r)}}),a.jsxs(L,{sx:{p:4,borderRadius:4,bg:"base.300",_dark:{bg:"base.850"}},children:[e==="diffusers"&&a.jsx(ZO,{}),e==="checkpoint"&&a.jsx(YO,{})]})]})}const Jfe=[{label:"None",value:"none"},{label:"v_prediction",value:"v_prediction"},{label:"epsilon",value:"epsilon"},{label:"sample",value:"sample"}];function epe(){const e=te(),{t}=Z(),[n,{isLoading:r}]=NI(),o=fl({initialValues:{location:"",prediction_type:void 0}}),s=i=>{const l={location:i.location,prediction_type:i.prediction_type==="none"?void 0:i.prediction_type};n({body:l}).unwrap().then(u=>{e(ct(Qt({title:t("toast.modelAddedSimple"),status:"success"}))),o.reset()}).catch(u=>{u&&e(ct(Qt({title:`${u.data.detail} `,status:"error"})))})};return a.jsx("form",{onSubmit:o.onSubmit(i=>s(i)),style:{width:"100%"},children:a.jsxs(L,{flexDirection:"column",width:"100%",gap:4,children:[a.jsx(_n,{label:t("modelManager.modelLocation"),placeholder:t("modelManager.simpleModelDesc"),w:"100%",...o.getInputProps("location")}),a.jsx(On,{label:t("modelManager.predictionType"),data:Jfe,defaultValue:"none",...o.getInputProps("prediction_type")}),a.jsx(at,{type:"submit",isLoading:r,children:t("modelManager.addModel")})]})})}function tpe(){const[e,t]=d.useState("simple");return a.jsxs(L,{flexDirection:"column",width:"100%",overflow:"scroll",maxHeight:window.innerHeight-250,gap:4,children:[a.jsxs(Vt,{isAttached:!0,children:[a.jsx(at,{size:"sm",isChecked:e=="simple",onClick:()=>t("simple"),children:"Simple"}),a.jsx(at,{size:"sm",isChecked:e=="advanced",onClick:()=>t("advanced"),children:"Advanced"})]}),a.jsxs(L,{sx:{p:4,borderRadius:4,background:"base.200",_dark:{background:"base.800"}},children:[e==="simple"&&a.jsx(epe,{}),e==="advanced"&&a.jsx(Zfe,{})]})]})}function npe(e){const{...t}=e;return a.jsx(V6,{w:"100%",...t,children:e.children})}function rpe(){const e=W(b=>b.modelmanager.searchFolder),[t,n]=d.useState(""),{data:r}=Xo(Pi),{foundModels:o,alreadyInstalled:s,filteredModels:i}=$I({search_path:e||""},{selectFromResult:({data:b})=>{const w=K9(r==null?void 0:r.entities),S=nr(w,"path"),j=W9(b,S),_=Z9(b,S);return{foundModels:b,alreadyInstalled:I_(_,t),filteredModels:I_(j,t)}}}),[l,{isLoading:u}]=NI(),p=te(),{t:m}=Z(),h=d.useCallback(b=>{const w=b.currentTarget.id.split("\\").splice(-1)[0];l({body:{location:b.currentTarget.id}}).unwrap().then(S=>{p(ct(Qt({title:`Added Model: ${w}`,status:"success"})))}).catch(S=>{S&&p(ct(Qt({title:m("toast.modelAddFailed"),status:"error"})))})},[p,l,m]),g=d.useCallback(b=>{n(b.target.value)},[]),x=({models:b,showActions:w=!0})=>b.map(S=>a.jsxs(L,{sx:{p:4,gap:4,alignItems:"center",borderRadius:4,bg:"base.200",_dark:{bg:"base.800"}},children:[a.jsxs(L,{w:"100%",sx:{flexDirection:"column",minW:"25%"},children:[a.jsx(ve,{sx:{fontWeight:600},children:S.split("\\").slice(-1)[0]}),a.jsx(ve,{sx:{fontSize:"sm",color:"base.600",_dark:{color:"base.400"}},children:S})]}),w?a.jsxs(L,{gap:2,children:[a.jsx(at,{id:S,onClick:h,isLoading:u,children:m("modelManager.quickAdd")}),a.jsx(at,{onClick:()=>p(Sd(S)),isLoading:u,children:m("modelManager.advanced")})]}):a.jsx(ve,{sx:{fontWeight:600,p:2,borderRadius:4,color:"accent.50",bg:"accent.400",_dark:{color:"accent.100",bg:"accent.600"}},children:"Installed"})]},S));return(()=>e?!o||o.length===0?a.jsx(L,{sx:{w:"full",h:"full",justifyContent:"center",alignItems:"center",height:96,userSelect:"none",bg:"base.200",_dark:{bg:"base.900"}},children:a.jsx(ve,{variant:"subtext",children:m("modelManager.noModels")})}):a.jsxs(L,{sx:{flexDirection:"column",gap:2,w:"100%",minW:"50%"},children:[a.jsx(vo,{onChange:g,label:m("modelManager.search"),labelPos:"side"}),a.jsxs(L,{p:2,gap:2,children:[a.jsxs(ve,{sx:{fontWeight:600},children:["Models Found: ",o.length]}),a.jsxs(ve,{sx:{fontWeight:600,color:"accent.500",_dark:{color:"accent.200"}},children:["Not Installed: ",i.length]})]}),a.jsx(npe,{offsetScrollbars:!0,children:a.jsxs(L,{gap:2,flexDirection:"column",children:[x({models:i}),x({models:s,showActions:!1})]})})]}):null)()}const I_=(e,t)=>{const n=[];return $n(e,r=>{if(!r)return null;r.includes(t)&&n.push(r)}),n};function ope(){const e=W(l=>l.modelmanager.advancedAddScanModel),{t}=Z(),[n,r]=d.useState("diffusers"),[o,s]=d.useState(!0);d.useEffect(()=>{e&&[".ckpt",".safetensors",".pth",".pt"].some(l=>e.endsWith(l))?r("checkpoint"):r("diffusers")},[e,r,o]);const i=te();return e?a.jsxs(Ie,{as:In.div,initial:{x:-100,opacity:0},animate:{x:0,opacity:1,transition:{duration:.2}},sx:{display:"flex",flexDirection:"column",minWidth:"40%",maxHeight:window.innerHeight-300,overflow:"scroll",p:4,gap:4,borderRadius:4,bg:"base.200",_dark:{bg:"base.800"}},children:[a.jsxs(L,{justifyContent:"space-between",alignItems:"center",children:[a.jsx(ve,{size:"xl",fontWeight:600,children:o||n==="checkpoint"?"Add Checkpoint Model":"Add Diffusers Model"}),a.jsx(Fe,{icon:a.jsx(Ic,{}),"aria-label":t("modelManager.closeAdvanced"),onClick:()=>i(Sd(null)),size:"sm"})]}),a.jsx(On,{label:t("modelManager.modelType"),value:n,data:JO,onChange:l=>{l&&(r(l),s(l==="checkpoint"))}}),o?a.jsx(YO,{model_path:e},e):a.jsx(ZO,{model_path:e},e)]}):null}function spe(){const e=te(),{t}=Z(),n=W(l=>l.modelmanager.searchFolder),{refetch:r}=$I({search_path:n||""}),o=fl({initialValues:{folder:""}}),s=d.useCallback(l=>{e(Dw(l.folder))},[e]),i=()=>{r()};return a.jsx("form",{onSubmit:o.onSubmit(l=>s(l)),style:{width:"100%"},children:a.jsxs(L,{sx:{w:"100%",gap:2,borderRadius:4,alignItems:"center"},children:[a.jsxs(L,{w:"100%",alignItems:"center",gap:4,minH:12,children:[a.jsx(ve,{sx:{fontSize:"sm",fontWeight:600,color:"base.700",minW:"max-content",_dark:{color:"base.300"}},children:"Folder"}),n?a.jsx(L,{sx:{w:"100%",p:2,px:4,bg:"base.300",borderRadius:4,fontSize:"sm",fontWeight:"bold",_dark:{bg:"base.700"}},children:n}):a.jsx(vo,{w:"100%",size:"md",...o.getInputProps("folder")})]}),a.jsxs(L,{gap:2,children:[n?a.jsx(Fe,{"aria-label":t("modelManager.scanAgain"),tooltip:t("modelManager.scanAgain"),icon:a.jsx(bM,{}),onClick:i,fontSize:18,size:"sm"}):a.jsx(Fe,{"aria-label":t("modelManager.findModels"),tooltip:t("modelManager.findModels"),icon:a.jsx(tee,{}),fontSize:18,size:"sm",type:"submit"}),a.jsx(Fe,{"aria-label":t("modelManager.clearCheckpointFolder"),tooltip:t("modelManager.clearCheckpointFolder"),icon:a.jsx(Br,{}),size:"sm",onClick:()=>{e(Dw(null)),e(Sd(null))},isDisabled:!n,colorScheme:"red"})]})]})})}const ape=d.memo(spe);function ipe(){return a.jsxs(L,{flexDirection:"column",w:"100%",gap:4,children:[a.jsx(ape,{}),a.jsxs(L,{gap:4,children:[a.jsx(L,{sx:{maxHeight:window.innerHeight-300,overflow:"scroll",gap:4,w:"100%"},children:a.jsx(rpe,{})}),a.jsx(ope,{})]})]})}function lpe(){const[e,t]=d.useState("add"),{t:n}=Z();return a.jsxs(L,{flexDirection:"column",gap:4,children:[a.jsxs(Vt,{isAttached:!0,children:[a.jsx(at,{onClick:()=>t("add"),isChecked:e=="add",size:"sm",width:"100%",children:n("modelManager.addModel")}),a.jsx(at,{onClick:()=>t("scan"),isChecked:e=="scan",size:"sm",width:"100%",children:n("modelManager.scanForModels")})]}),e=="add"&&a.jsx(tpe,{}),e=="scan"&&a.jsx(ipe,{})]})}const cpe=[{label:"Stable Diffusion 1",value:"sd-1"},{label:"Stable Diffusion 2",value:"sd-2"}];function upe(){var $,q;const{t:e}=Z(),t=te(),{data:n}=Xo(Pi),[r,{isLoading:o}]=IT(),[s,i]=d.useState("sd-1"),l=Gw(n==null?void 0:n.entities,(F,Q)=>(F==null?void 0:F.model_format)==="diffusers"&&(F==null?void 0:F.base_model)==="sd-1"),u=Gw(n==null?void 0:n.entities,(F,Q)=>(F==null?void 0:F.model_format)==="diffusers"&&(F==null?void 0:F.base_model)==="sd-2"),p=d.useMemo(()=>({"sd-1":l,"sd-2":u}),[l,u]),[m,h]=d.useState((($=Object.keys(p[s]))==null?void 0:$[0])??null),[g,x]=d.useState(((q=Object.keys(p[s]))==null?void 0:q[1])??null),[y,b]=d.useState(null),[w,S]=d.useState(""),[j,_]=d.useState(.5),[E,I]=d.useState("weighted_sum"),[M,R]=d.useState("root"),[D,A]=d.useState(""),[O,T]=d.useState(!1),X=Object.keys(p[s]).filter(F=>F!==g&&F!==y),B=Object.keys(p[s]).filter(F=>F!==m&&F!==y),V=Object.keys(p[s]).filter(F=>F!==m&&F!==g),U=F=>{i(F),h(null),x(null)},N=()=>{const F=[];let Q=[m,g,y];Q=Q.filter(se=>se!==null),Q.forEach(se=>{var re;const ae=(re=se==null?void 0:se.split("/"))==null?void 0:re[2];ae&&F.push(ae)});const Y={model_names:F,merged_model_name:w!==""?w:F.join("-"),alpha:j,interp:E,force:O,merge_dest_directory:M==="root"?void 0:D};r({base_model:s,body:Y}).unwrap().then(se=>{t(ct(Qt({title:e("modelManager.modelsMerged"),status:"success"})))}).catch(se=>{se&&t(ct(Qt({title:e("modelManager.modelsMergeFailed"),status:"error"})))})};return a.jsxs(L,{flexDirection:"column",rowGap:4,children:[a.jsxs(L,{sx:{flexDirection:"column",rowGap:1},children:[a.jsx(ve,{children:e("modelManager.modelMergeHeaderHelp1")}),a.jsx(ve,{fontSize:"sm",variant:"subtext",children:e("modelManager.modelMergeHeaderHelp2")})]}),a.jsxs(L,{columnGap:4,children:[a.jsx(On,{label:"Model Type",w:"100%",data:cpe,value:s,onChange:U}),a.jsx(nn,{label:e("modelManager.modelOne"),w:"100%",value:m,placeholder:e("modelManager.selectModel"),data:X,onChange:F=>h(F)}),a.jsx(nn,{label:e("modelManager.modelTwo"),w:"100%",placeholder:e("modelManager.selectModel"),value:g,data:B,onChange:F=>x(F)}),a.jsx(nn,{label:e("modelManager.modelThree"),data:V,w:"100%",placeholder:e("modelManager.selectModel"),clearable:!0,onChange:F=>{F?(b(F),I("weighted_sum")):(b(null),I("add_difference"))}})]}),a.jsx(vo,{label:e("modelManager.mergedModelName"),value:w,onChange:F=>S(F.target.value)}),a.jsxs(L,{sx:{flexDirection:"column",padding:4,borderRadius:"base",gap:4,bg:"base.200",_dark:{bg:"base.800"}},children:[a.jsx(tt,{label:e("modelManager.alpha"),min:.01,max:.99,step:.01,value:j,onChange:F=>_(F),withInput:!0,withReset:!0,handleReset:()=>_(.5),withSliderMarks:!0}),a.jsx(ve,{variant:"subtext",fontSize:"sm",children:e("modelManager.modelMergeAlphaHelp")})]}),a.jsxs(L,{sx:{padding:4,borderRadius:"base",gap:4,bg:"base.200",_dark:{bg:"base.800"}},children:[a.jsx(ve,{fontWeight:500,fontSize:"sm",variant:"subtext",children:e("modelManager.interpolationType")}),a.jsx(cm,{value:E,onChange:F=>I(F),children:a.jsx(L,{columnGap:4,children:y===null?a.jsxs(a.Fragment,{children:[a.jsx(Ks,{value:"weighted_sum",children:a.jsx(ve,{fontSize:"sm",children:e("modelManager.weightedSum")})}),a.jsx(Ks,{value:"sigmoid",children:a.jsx(ve,{fontSize:"sm",children:e("modelManager.sigmoid")})}),a.jsx(Ks,{value:"inv_sigmoid",children:a.jsx(ve,{fontSize:"sm",children:e("modelManager.inverseSigmoid")})})]}):a.jsx(Ks,{value:"add_difference",children:a.jsx(Ht,{label:e("modelManager.modelMergeInterpAddDifferenceHelp"),children:a.jsx(ve,{fontSize:"sm",children:e("modelManager.addDifference")})})})})})]}),a.jsxs(L,{sx:{flexDirection:"column",padding:4,borderRadius:"base",gap:4,bg:"base.200",_dark:{bg:"base.900"}},children:[a.jsxs(L,{columnGap:4,children:[a.jsx(ve,{fontWeight:"500",fontSize:"sm",variant:"subtext",children:e("modelManager.mergedModelSaveLocation")}),a.jsx(cm,{value:M,onChange:F=>R(F),children:a.jsxs(L,{columnGap:4,children:[a.jsx(Ks,{value:"root",children:a.jsx(ve,{fontSize:"sm",children:e("modelManager.invokeAIFolder")})}),a.jsx(Ks,{value:"custom",children:a.jsx(ve,{fontSize:"sm",children:e("modelManager.custom")})})]})})]}),M==="custom"&&a.jsx(vo,{label:e("modelManager.mergedModelCustomSaveLocation"),value:D,onChange:F=>A(F.target.value)})]}),a.jsx(br,{label:e("modelManager.ignoreMismatch"),isChecked:O,onChange:F=>T(F.target.checked),fontWeight:"500"}),a.jsx(at,{onClick:N,isLoading:o,isDisabled:m===null||g===null,children:e("modelManager.merge")})]})}function dpe(e){const{model:t}=e,n=te(),{t:r}=Z(),[o,{isLoading:s}]=PT(),[i,l]=d.useState("InvokeAIRoot"),[u,p]=d.useState("");d.useEffect(()=>{l("InvokeAIRoot")},[t]);const m=()=>{l("InvokeAIRoot")},h=()=>{const g={base_model:t.base_model,model_name:t.model_name,convert_dest_directory:i==="Custom"?u:void 0};if(i==="Custom"&&u===""){n(ct(Qt({title:r("modelManager.noCustomLocationProvided"),status:"error"})));return}n(ct(Qt({title:`${r("modelManager.convertingModelBegin")}: ${t.model_name}`,status:"info"}))),o(g).unwrap().then(()=>{n(ct(Qt({title:`${r("modelManager.modelConverted")}: ${t.model_name}`,status:"success"})))}).catch(()=>{n(ct(Qt({title:`${r("modelManager.modelConversionFailed")}: ${t.model_name}`,status:"error"})))})};return a.jsxs(kg,{title:`${r("modelManager.convert")} ${t.model_name}`,acceptCallback:h,cancelCallback:m,acceptButtonText:`${r("modelManager.convert")}`,triggerComponent:a.jsxs(at,{size:"sm","aria-label":r("modelManager.convertToDiffusers"),className:" modal-close-btn",isLoading:s,children:["🧨 ",r("modelManager.convertToDiffusers")]}),motionPreset:"slideInBottom",children:[a.jsxs(L,{flexDirection:"column",rowGap:4,children:[a.jsx(ve,{children:r("modelManager.convertToDiffusersHelpText1")}),a.jsxs(Od,{children:[a.jsx(Qr,{children:r("modelManager.convertToDiffusersHelpText2")}),a.jsx(Qr,{children:r("modelManager.convertToDiffusersHelpText3")}),a.jsx(Qr,{children:r("modelManager.convertToDiffusersHelpText4")}),a.jsx(Qr,{children:r("modelManager.convertToDiffusersHelpText5")})]}),a.jsx(ve,{children:r("modelManager.convertToDiffusersHelpText6")})]}),a.jsxs(L,{flexDir:"column",gap:2,children:[a.jsxs(L,{marginTop:4,flexDir:"column",gap:2,children:[a.jsx(ve,{fontWeight:"600",children:r("modelManager.convertToDiffusersSaveLocation")}),a.jsx(cm,{value:i,onChange:g=>l(g),children:a.jsxs(L,{gap:4,children:[a.jsx(Ks,{value:"InvokeAIRoot",children:a.jsx(Ht,{label:"Save converted model in the InvokeAI root folder",children:r("modelManager.invokeRoot")})}),a.jsx(Ks,{value:"Custom",children:a.jsx(Ht,{label:"Save converted model in a custom folder",children:r("modelManager.custom")})})]})})]}),i==="Custom"&&a.jsxs(L,{flexDirection:"column",rowGap:2,children:[a.jsx(ve,{fontWeight:"500",fontSize:"sm",variant:"subtext",children:r("modelManager.customSaveLocation")}),a.jsx(vo,{value:u,onChange:g=>{p(g.target.value)},width:"full"})]})]})]})}function fpe(e){const{model:t}=e,[n,{isLoading:r}]=LI(),{data:o}=AI(),[s,i]=d.useState(!1);d.useEffect(()=>{o!=null&&o.includes(t.config)||i(!0)},[o,t.config]);const l=te(),{t:u}=Z(),p=fl({initialValues:{model_name:t.model_name?t.model_name:"",base_model:t.base_model,model_type:"main",path:t.path?t.path:"",description:t.description?t.description:"",model_format:"checkpoint",vae:t.vae?t.vae:"",config:t.config?t.config:"",variant:t.variant},validate:{path:h=>h.trim().length===0?"Must provide a path":null}}),m=d.useCallback(h=>{const g={base_model:t.base_model,model_name:t.model_name,body:h};n(g).unwrap().then(x=>{p.setValues(x),l(ct(Qt({title:u("modelManager.modelUpdated"),status:"success"})))}).catch(x=>{p.reset(),l(ct(Qt({title:u("modelManager.modelUpdateFailed"),status:"error"})))})},[p,l,t.base_model,t.model_name,u,n]);return a.jsxs(L,{flexDirection:"column",rowGap:4,width:"100%",children:[a.jsxs(L,{justifyContent:"space-between",alignItems:"center",children:[a.jsxs(L,{flexDirection:"column",children:[a.jsx(ve,{fontSize:"lg",fontWeight:"bold",children:t.model_name}),a.jsxs(ve,{fontSize:"sm",color:"base.400",children:[mn[t.base_model]," Model"]})]}),[""].includes(t.base_model)?a.jsx(Ds,{sx:{p:2,borderRadius:4,bg:"error.200",_dark:{bg:"error.400"}},children:"Conversion Not Supported"}):a.jsx(dpe,{model:t})]}),a.jsx(Yn,{}),a.jsx(L,{flexDirection:"column",maxHeight:window.innerHeight-270,overflowY:"scroll",children:a.jsx("form",{onSubmit:p.onSubmit(h=>m(h)),children:a.jsxs(L,{flexDirection:"column",overflowY:"scroll",gap:4,children:[a.jsx(_n,{label:u("modelManager.name"),...p.getInputProps("model_name")}),a.jsx(_n,{label:u("modelManager.description"),...p.getInputProps("description")}),a.jsx(Jd,{required:!0,...p.getInputProps("base_model")}),a.jsx(Tg,{required:!0,...p.getInputProps("variant")}),a.jsx(_n,{required:!0,label:u("modelManager.modelLocation"),...p.getInputProps("path")}),a.jsx(_n,{label:u("modelManager.vaeLocation"),...p.getInputProps("vae")}),a.jsxs(L,{flexDirection:"column",gap:2,children:[s?a.jsx(_n,{required:!0,label:u("modelManager.config"),...p.getInputProps("config")}):a.jsx(QO,{required:!0,...p.getInputProps("config")}),a.jsx(br,{isChecked:s,onChange:()=>i(!s),label:"Use Custom Config"})]}),a.jsx(at,{type:"submit",isLoading:r,children:u("modelManager.updateModel")})]})})})]})}function ppe(e){const{model:t}=e,[n,{isLoading:r}]=LI(),o=te(),{t:s}=Z(),i=fl({initialValues:{model_name:t.model_name?t.model_name:"",base_model:t.base_model,model_type:"main",path:t.path?t.path:"",description:t.description?t.description:"",model_format:"diffusers",vae:t.vae?t.vae:"",variant:t.variant},validate:{path:u=>u.trim().length===0?"Must provide a path":null}}),l=d.useCallback(u=>{const p={base_model:t.base_model,model_name:t.model_name,body:u};n(p).unwrap().then(m=>{i.setValues(m),o(ct(Qt({title:s("modelManager.modelUpdated"),status:"success"})))}).catch(m=>{i.reset(),o(ct(Qt({title:s("modelManager.modelUpdateFailed"),status:"error"})))})},[i,o,t.base_model,t.model_name,s,n]);return a.jsxs(L,{flexDirection:"column",rowGap:4,width:"100%",children:[a.jsxs(L,{flexDirection:"column",children:[a.jsx(ve,{fontSize:"lg",fontWeight:"bold",children:t.model_name}),a.jsxs(ve,{fontSize:"sm",color:"base.400",children:[mn[t.base_model]," Model"]})]}),a.jsx(Yn,{}),a.jsx("form",{onSubmit:i.onSubmit(u=>l(u)),children:a.jsxs(L,{flexDirection:"column",overflowY:"scroll",gap:4,children:[a.jsx(_n,{label:s("modelManager.name"),...i.getInputProps("model_name")}),a.jsx(_n,{label:s("modelManager.description"),...i.getInputProps("description")}),a.jsx(Jd,{required:!0,...i.getInputProps("base_model")}),a.jsx(Tg,{required:!0,...i.getInputProps("variant")}),a.jsx(_n,{required:!0,label:s("modelManager.modelLocation"),...i.getInputProps("path")}),a.jsx(_n,{label:s("modelManager.vaeLocation"),...i.getInputProps("vae")}),a.jsx(at,{type:"submit",isLoading:r,children:s("modelManager.updateModel")})]})})]})}function mpe(e){const{model:t}=e,[n,{isLoading:r}]=ET(),o=te(),{t:s}=Z(),i=fl({initialValues:{model_name:t.model_name?t.model_name:"",base_model:t.base_model,model_type:"lora",path:t.path?t.path:"",description:t.description?t.description:"",model_format:t.model_format},validate:{path:u=>u.trim().length===0?"Must provide a path":null}}),l=d.useCallback(u=>{const p={base_model:t.base_model,model_name:t.model_name,body:u};n(p).unwrap().then(m=>{i.setValues(m),o(ct(Qt({title:s("modelManager.modelUpdated"),status:"success"})))}).catch(m=>{i.reset(),o(ct(Qt({title:s("modelManager.modelUpdateFailed"),status:"error"})))})},[o,i,t.base_model,t.model_name,s,n]);return a.jsxs(L,{flexDirection:"column",rowGap:4,width:"100%",children:[a.jsxs(L,{flexDirection:"column",children:[a.jsx(ve,{fontSize:"lg",fontWeight:"bold",children:t.model_name}),a.jsxs(ve,{fontSize:"sm",color:"base.400",children:[mn[t.base_model]," Model ⋅"," ",MT[t.model_format]," format"]})]}),a.jsx(Yn,{}),a.jsx("form",{onSubmit:i.onSubmit(u=>l(u)),children:a.jsxs(L,{flexDirection:"column",overflowY:"scroll",gap:4,children:[a.jsx(_n,{label:s("modelManager.name"),...i.getInputProps("model_name")}),a.jsx(_n,{label:s("modelManager.description"),...i.getInputProps("description")}),a.jsx(Jd,{...i.getInputProps("base_model")}),a.jsx(_n,{label:s("modelManager.modelLocation"),...i.getInputProps("path")}),a.jsx(at,{type:"submit",isLoading:r,children:s("modelManager.updateModel")})]})})]})}function hpe(e){const{t}=Z(),n=te(),[r]=OT(),[o]=RT(),{model:s,isSelected:i,setSelectedModelId:l}=e,u=d.useCallback(()=>{l(s.id)},[s.id,l]),p=d.useCallback(()=>{const m={main:r,lora:o,onnx:r}[s.model_type];m(s).unwrap().then(h=>{n(ct(Qt({title:`${t("modelManager.modelDeleted")}: ${s.model_name}`,status:"success"})))}).catch(h=>{h&&n(ct(Qt({title:`${t("modelManager.modelDeleteFailed")}: ${s.model_name}`,status:"error"})))}),l(void 0)},[r,o,s,l,n,t]);return a.jsxs(L,{sx:{gap:2,alignItems:"center",w:"full"},children:[a.jsx(L,{as:at,isChecked:i,sx:{justifyContent:"start",p:2,borderRadius:"base",w:"full",alignItems:"center",bg:i?"accent.400":"base.100",color:i?"base.50":"base.800",_hover:{bg:i?"accent.500":"base.300",color:i?"base.50":"base.800"},_dark:{color:i?"base.50":"base.100",bg:i?"accent.600":"base.850",_hover:{color:i?"base.50":"base.100",bg:i?"accent.550":"base.700"}}},onClick:u,children:a.jsxs(L,{gap:4,alignItems:"center",children:[a.jsx(Ds,{minWidth:14,p:.5,fontSize:"sm",variant:"solid",children:DT[s.base_model]}),a.jsx(Ht,{label:s.description,hasArrow:!0,placement:"bottom",children:a.jsx(ve,{sx:{fontWeight:500},children:s.model_name})})]})}),a.jsx(kg,{title:t("modelManager.deleteModel"),acceptCallback:p,acceptButtonText:t("modelManager.delete"),triggerComponent:a.jsx(Fe,{icon:a.jsx(rne,{}),"aria-label":t("modelManager.deleteConfig"),colorScheme:"error"}),children:a.jsxs(L,{rowGap:4,flexDirection:"column",children:[a.jsx("p",{style:{fontWeight:"bold"},children:t("modelManager.deleteMsg1")}),a.jsx("p",{children:t("modelManager.deleteMsg2")})]})})]})}const gpe=e=>{const{selectedModelId:t,setSelectedModelId:n}=e,{t:r}=Z(),[o,s]=d.useState(""),[i,l]=d.useState("all"),{filteredDiffusersModels:u,isLoadingDiffusersModels:p}=Xo(Pi,{selectFromResult:({data:_,isLoading:E})=>({filteredDiffusersModels:Iu(_,"main","diffusers",o),isLoadingDiffusersModels:E})}),{filteredCheckpointModels:m,isLoadingCheckpointModels:h}=Xo(Pi,{selectFromResult:({data:_,isLoading:E})=>({filteredCheckpointModels:Iu(_,"main","checkpoint",o),isLoadingCheckpointModels:E})}),{filteredLoraModels:g,isLoadingLoraModels:x}=Cd(void 0,{selectFromResult:({data:_,isLoading:E})=>({filteredLoraModels:Iu(_,"lora",void 0,o),isLoadingLoraModels:E})}),{filteredOnnxModels:y,isLoadingOnnxModels:b}=Ku(Pi,{selectFromResult:({data:_,isLoading:E})=>({filteredOnnxModels:Iu(_,"onnx","onnx",o),isLoadingOnnxModels:E})}),{filteredOliveModels:w,isLoadingOliveModels:S}=Ku(Pi,{selectFromResult:({data:_,isLoading:E})=>({filteredOliveModels:Iu(_,"onnx","olive",o),isLoadingOliveModels:E})}),j=d.useCallback(_=>{s(_.target.value)},[]);return a.jsx(L,{flexDirection:"column",rowGap:4,width:"50%",minWidth:"50%",children:a.jsxs(L,{flexDirection:"column",gap:4,paddingInlineEnd:4,children:[a.jsxs(Vt,{isAttached:!0,children:[a.jsx(at,{onClick:()=>l("all"),isChecked:i==="all",size:"sm",children:r("modelManager.allModels")}),a.jsx(at,{size:"sm",onClick:()=>l("diffusers"),isChecked:i==="diffusers",children:r("modelManager.diffusersModels")}),a.jsx(at,{size:"sm",onClick:()=>l("checkpoint"),isChecked:i==="checkpoint",children:r("modelManager.checkpointModels")}),a.jsx(at,{size:"sm",onClick:()=>l("onnx"),isChecked:i==="onnx",children:r("modelManager.onnxModels")}),a.jsx(at,{size:"sm",onClick:()=>l("olive"),isChecked:i==="olive",children:r("modelManager.oliveModels")}),a.jsx(at,{size:"sm",onClick:()=>l("lora"),isChecked:i==="lora",children:r("modelManager.loraModels")})]}),a.jsx(vo,{onChange:j,label:r("modelManager.search"),labelPos:"side"}),a.jsxs(L,{flexDirection:"column",gap:4,maxHeight:window.innerHeight-280,overflow:"scroll",children:[p&&a.jsx(Xl,{loadingMessage:"Loading Diffusers..."}),["all","diffusers"].includes(i)&&!p&&u.length>0&&a.jsx(ql,{title:"Diffusers",modelList:u,selected:{selectedModelId:t,setSelectedModelId:n}},"diffusers"),h&&a.jsx(Xl,{loadingMessage:"Loading Checkpoints..."}),["all","checkpoint"].includes(i)&&!h&&m.length>0&&a.jsx(ql,{title:"Checkpoints",modelList:m,selected:{selectedModelId:t,setSelectedModelId:n}},"checkpoints"),x&&a.jsx(Xl,{loadingMessage:"Loading LoRAs..."}),["all","lora"].includes(i)&&!x&&g.length>0&&a.jsx(ql,{title:"LoRAs",modelList:g,selected:{selectedModelId:t,setSelectedModelId:n}},"loras"),S&&a.jsx(Xl,{loadingMessage:"Loading Olives..."}),["all","olive"].includes(i)&&!S&&w.length>0&&a.jsx(ql,{title:"Olives",modelList:w,selected:{selectedModelId:t,setSelectedModelId:n}},"olive"),b&&a.jsx(Xl,{loadingMessage:"Loading ONNX..."}),["all","onnx"].includes(i)&&!b&&y.length>0&&a.jsx(ql,{title:"ONNX",modelList:y,selected:{selectedModelId:t,setSelectedModelId:n}},"onnx")]})]})})},vpe=d.memo(gpe),Iu=(e,t,n,r)=>{const o=[];return $n(e==null?void 0:e.entities,s=>{if(!s)return;const i=s.model_name.toLowerCase().includes(r.toLowerCase()),l=n===void 0||s.model_format===n,u=s.model_type===t;i&&l&&u&&o.push(s)}),o},c2=d.memo(e=>a.jsx(L,{flexDirection:"column",gap:4,borderRadius:4,p:4,sx:{bg:"base.200",_dark:{bg:"base.800"}},children:e.children}));c2.displayName="StyledModelContainer";const ql=d.memo(e=>{const{title:t,modelList:n,selected:r}=e;return a.jsx(c2,{children:a.jsxs(L,{sx:{gap:2,flexDir:"column"},children:[a.jsx(ve,{variant:"subtext",fontSize:"sm",children:t}),n.map(o=>a.jsx(hpe,{model:o,isSelected:r.selectedModelId===o.id,setSelectedModelId:r.setSelectedModelId},o.id))]})})});ql.displayName="ModelListWrapper";const Xl=d.memo(({loadingMessage:e})=>a.jsx(c2,{children:a.jsxs(L,{justifyContent:"center",alignItems:"center",flexDirection:"column",p:4,gap:8,children:[a.jsx(fa,{}),a.jsx(ve,{variant:"subtext",children:e||"Fetching..."})]})}));Xl.displayName="FetchingModelsLoader";function xpe(){const[e,t]=d.useState(),{mainModel:n}=Xo(Pi,{selectFromResult:({data:s})=>({mainModel:e?s==null?void 0:s.entities[e]:void 0})}),{loraModel:r}=Cd(void 0,{selectFromResult:({data:s})=>({loraModel:e?s==null?void 0:s.entities[e]:void 0})}),o=n||r;return a.jsxs(L,{sx:{gap:8,w:"full",h:"full"},children:[a.jsx(vpe,{selectedModelId:e,setSelectedModelId:t}),a.jsx(bpe,{model:o})]})}const bpe=e=>{const{model:t}=e;return(t==null?void 0:t.model_format)==="checkpoint"?a.jsx(fpe,{model:t},t.id):(t==null?void 0:t.model_format)==="diffusers"?a.jsx(ppe,{model:t},t.id):(t==null?void 0:t.model_type)==="lora"?a.jsx(mpe,{model:t},t.id):a.jsx(L,{sx:{w:"full",h:"full",justifyContent:"center",alignItems:"center",maxH:96,userSelect:"none"},children:a.jsx(ve,{variant:"subtext",children:"No Model Selected"})})};function ype(){const{t:e}=Z();return a.jsxs(L,{sx:{w:"full",p:4,borderRadius:4,gap:4,justifyContent:"space-between",alignItems:"center",bg:"base.200",_dark:{bg:"base.800"}},children:[a.jsxs(L,{sx:{flexDirection:"column",gap:2},children:[a.jsx(ve,{sx:{fontWeight:600},children:e("modelManager.syncModels")}),a.jsx(ve,{fontSize:"sm",sx:{_dark:{color:"base.400"}},children:e("modelManager.syncModelsDesc")})]}),a.jsx(Gc,{})]})}function Cpe(){return a.jsx(L,{children:a.jsx(ype,{})})}const P_=[{id:"modelManager",label:yt.t("modelManager.modelManager"),content:a.jsx(xpe,{})},{id:"importModels",label:yt.t("modelManager.importModels"),content:a.jsx(lpe,{})},{id:"mergeModels",label:yt.t("modelManager.mergeModels"),content:a.jsx(upe,{})},{id:"settings",label:yt.t("modelManager.settings"),content:a.jsx(Cpe,{})}],wpe=()=>a.jsxs(rl,{isLazy:!0,variant:"line",layerStyle:"first",sx:{w:"full",h:"full",p:4,gap:4,borderRadius:"base"},children:[a.jsx(ol,{children:P_.map(e=>a.jsx(Tr,{sx:{borderTopRadius:"base"},children:e.label},e.id))}),a.jsx(zc,{sx:{w:"full",h:"full"},children:P_.map(e=>a.jsx(So,{sx:{w:"full",h:"full"},children:e.content},e.id))})]}),Spe=d.memo(wpe),kpe={enum:"",BoardField:void 0,boolean:!1,BooleanCollection:[],BooleanPolymorphic:!1,ClipField:void 0,Collection:[],CollectionItem:void 0,ColorCollection:[],ColorField:void 0,ColorPolymorphic:void 0,ConditioningCollection:[],ConditioningField:void 0,ConditioningPolymorphic:void 0,ControlCollection:[],ControlField:void 0,ControlNetModelField:void 0,ControlPolymorphic:void 0,DenoiseMaskField:void 0,float:0,FloatCollection:[],FloatPolymorphic:0,ImageCollection:[],ImageField:void 0,ImagePolymorphic:void 0,integer:0,IntegerCollection:[],IntegerPolymorphic:0,IPAdapterField:void 0,IPAdapterModelField:void 0,LatentsCollection:[],LatentsField:void 0,LatentsPolymorphic:void 0,LoRAModelField:void 0,MainModelField:void 0,ONNXModelField:void 0,Scheduler:"euler",SDXLMainModelField:void 0,SDXLRefinerModelField:void 0,string:"",StringCollection:[],StringPolymorphic:"",UNetField:void 0,VaeField:void 0,VaeModelField:void 0},jpe=(e,t)=>{const n={id:e,name:t.name,type:t.type,label:"",fieldKind:"input"};return n.value=t.default??kpe[t.type],n},_pe=ce([e=>e.nodes],e=>e.nodeTemplates),Jv={dragHandle:`.${tl}`},Ipe=()=>{const e=W(_pe),t=rb();return d.useCallback(n=>{var x;const r=Zs();let o=window.innerWidth/2,s=window.innerHeight/2;const i=(x=document.querySelector("#workflow-editor"))==null?void 0:x.getBoundingClientRect();i&&(o=i.width/2-g1/2,s=i.height/2-g1/2);const{x:l,y:u}=t.project({x:o,y:s});if(n==="current_image")return{...Jv,id:r,type:"current_image",position:{x:l,y:u},data:{id:r,type:"current_image",isOpen:!0,label:"Current Image"}};if(n==="notes")return{...Jv,id:r,type:"notes",position:{x:l,y:u},data:{id:r,isOpen:!0,label:"Notes",notes:"",type:"notes"}};const p=e[n];if(p===void 0){console.error(`Unable to find template ${n}.`);return}const m=Aw(p.inputs,(y,b,w)=>{const S=Zs(),j=jpe(S,b);return y[w]=j,y},{}),h=Aw(p.outputs,(y,b,w)=>{const j={id:Zs(),name:w,type:b.type,fieldKind:"output"};return y[w]=j,y},{});return{...Jv,id:r,type:"invocation",position:{x:l,y:u},data:{id:r,type:n,version:p.version,label:"",notes:"",isOpen:!0,embedWorkflow:!1,isIntermediate:n!=="save_image",inputs:m,outputs:h,useCache:p.useCache}}},[e,t])},e7=d.forwardRef(({label:e,description:t,...n},r)=>a.jsx("div",{ref:r,...n,children:a.jsxs("div",{children:[a.jsx(ve,{fontWeight:600,children:e}),a.jsx(ve,{size:"xs",sx:{color:"base.600",_dark:{color:"base.500"}},children:t})]})}));e7.displayName="AddNodePopoverSelectItem";const Ppe=(e,t)=>{const n=new RegExp(e.trim().replace(/[-[\]{}()*+!<=:?./\\^$|#,]/g,"").split(" ").join(".*"),"gi");return n.test(t.label)||n.test(t.description)||t.tags.some(r=>n.test(r))},Epe=()=>{const e=te(),t=Ipe(),n=sl(),{t:r}=Z(),o=W(w=>w.nodes.currentConnectionFieldType),s=W(w=>{var S;return(S=w.nodes.connectionStartParams)==null?void 0:S.handleType}),i=ce([xe],({nodes:w})=>{const S=o?AT(w.nodeTemplates,_=>{const E=s=="source"?_.inputs:_.outputs;return Xr(E,I=>{const M=s=="source"?o:I.type,R=s=="target"?o:I.type;return ob(M,R)})}):nr(w.nodeTemplates),j=nr(S,_=>({label:_.title,value:_.type,description:_.description,tags:_.tags}));return o===null&&(j.push({label:r("nodes.currentImage"),value:"current_image",description:r("nodes.currentImageDescription"),tags:["progress"]}),j.push({label:r("nodes.notes"),value:"notes",description:r("nodes.notesDescription"),tags:["notes"]})),j.sort((_,E)=>_.label.localeCompare(E.label)),{data:j,t:r}},je),{data:l}=W(i),u=W(w=>w.nodes.isAddNodePopoverOpen),p=d.useRef(null),m=d.useCallback(w=>{const S=t(w);if(!S){const j=r("nodes.unknownNode",{nodeType:w});n({status:"error",title:j});return}e(TT(S))},[e,t,n,r]),h=d.useCallback(w=>{w&&m(w)},[m]),g=d.useCallback(()=>{e(NT())},[e]),x=d.useCallback(()=>{e(zI())},[e]),y=d.useCallback(w=>{w.preventDefault(),x(),setTimeout(()=>{var S;(S=p.current)==null||S.focus()},0)},[x]),b=d.useCallback(()=>{g()},[g]);return et(["shift+a","space"],y),et(["escape"],b),a.jsxs(Ld,{initialFocusRef:p,isOpen:u,onClose:g,placement:"bottom",openDelay:0,closeDelay:0,closeOnBlur:!0,returnFocusOnClose:!0,children:[a.jsx(B3,{children:a.jsx(L,{sx:{position:"absolute",top:"15%",insetInlineStart:"50%",pointerEvents:"none"}})}),a.jsx(zd,{sx:{p:0,top:-1,shadow:"dark-lg",borderColor:"accent.300",borderWidth:"2px",borderStyle:"solid",_dark:{borderColor:"accent.400"}},children:a.jsx(Uh,{sx:{p:0},children:a.jsx(nn,{inputRef:p,selectOnBlur:!1,placeholder:r("nodes.nodeSearch"),value:null,data:l,maxDropdownHeight:400,nothingFound:r("nodes.noMatchingNodes"),itemComponent:e7,filter:Ppe,onChange:h,hoverOnSearchChange:!0,onDropdownClose:g,sx:{width:"32rem",input:{padding:"0.5rem"}}})})})]})},Mpe=d.memo(Epe),Ope=()=>{const e=rb(),t=W(r=>r.nodes.shouldValidateGraph);return d.useCallback(({source:r,sourceHandle:o,target:s,targetHandle:i})=>{var x,y;const l=e.getEdges(),u=e.getNodes();if(!(r&&o&&s&&i))return!1;const p=e.getNode(r),m=e.getNode(s);if(!(p&&m&&p.data&&m.data))return!1;const h=(x=p.data.outputs[o])==null?void 0:x.type,g=(y=m.data.inputs[i])==null?void 0:y.type;return!h||!g||r===s?!1:t?l.find(b=>{b.target===s&&b.targetHandle===i&&b.source===r&&b.sourceHandle})||l.find(b=>b.target===s&&b.targetHandle===i)&&g!=="CollectionItem"||!ob(h,g)?!1:FI(r,s,u,l):!0},[e,t])},hd=e=>`var(--invokeai-colors-${e.split(".").join("-")})`,Rpe=ce(xe,({nodes:e})=>{const{shouldAnimateEdges:t,currentConnectionFieldType:n,shouldColorEdges:r}=e,o=hd(n&&r?wd[n].color:"base.500");let s="react-flow__custom_connection-path";return t&&(s=s.concat(" animated")),{stroke:o,className:s}}),Dpe=({fromX:e,fromY:t,fromPosition:n,toX:r,toY:o,toPosition:s})=>{const{stroke:i,className:l}=W(Rpe),u={sourceX:e,sourceY:t,sourcePosition:n,targetX:r,targetY:o,targetPosition:s},[p]=sb(u);return a.jsx("g",{children:a.jsx("path",{fill:"none",stroke:i,strokeWidth:2,className:l,d:p,style:{opacity:.8}})})},Ape=d.memo(Dpe),t7=(e,t,n,r,o)=>ce(xe,({nodes:s})=>{var g,x;const i=s.nodes.find(y=>y.id===e),l=s.nodes.find(y=>y.id===n),u=Mn(i)&&Mn(l),p=(i==null?void 0:i.selected)||(l==null?void 0:l.selected)||o,m=u?(x=(g=i==null?void 0:i.data)==null?void 0:g.outputs[t||""])==null?void 0:x.type:void 0,h=m&&s.shouldColorEdges?hd(wd[m].color):hd("base.500");return{isSelected:p,shouldAnimate:s.shouldAnimateEdges&&p,stroke:h}},je),Tpe=({sourceX:e,sourceY:t,targetX:n,targetY:r,sourcePosition:o,targetPosition:s,markerEnd:i,data:l,selected:u,source:p,target:m,sourceHandleId:h,targetHandleId:g})=>{const x=d.useMemo(()=>t7(p,h,m,g,u),[u,p,h,m,g]),{isSelected:y,shouldAnimate:b}=W(x),[w,S,j]=sb({sourceX:e,sourceY:t,sourcePosition:o,targetX:n,targetY:r,targetPosition:s}),{base500:_}=Wd();return a.jsxs(a.Fragment,{children:[a.jsx(BI,{path:w,markerEnd:i,style:{strokeWidth:y?3:2,stroke:_,opacity:y?.8:.5,animation:b?"dashdraw 0.5s linear infinite":void 0,strokeDasharray:b?5:"none"}}),(l==null?void 0:l.count)&&l.count>1&&a.jsx($T,{children:a.jsx(L,{sx:{position:"absolute",transform:`translate(-50%, -50%) translate(${S}px,${j}px)`},className:"nodrag nopan",children:a.jsx(Ds,{variant:"solid",sx:{bg:"base.500",opacity:y?.8:.5,boxShadow:"base"},children:l.count})})})]})},Npe=d.memo(Tpe),$pe=({sourceX:e,sourceY:t,targetX:n,targetY:r,sourcePosition:o,targetPosition:s,markerEnd:i,selected:l,source:u,target:p,sourceHandleId:m,targetHandleId:h})=>{const g=d.useMemo(()=>t7(u,m,p,h,l),[u,m,p,h,l]),{isSelected:x,shouldAnimate:y,stroke:b}=W(g),[w]=sb({sourceX:e,sourceY:t,sourcePosition:o,targetX:n,targetY:r,targetPosition:s});return a.jsx(BI,{path:w,markerEnd:i,style:{strokeWidth:x?3:2,stroke:b,opacity:x?.8:.5,animation:y?"dashdraw 0.5s linear infinite":void 0,strokeDasharray:y?5:"none"}})},Lpe=d.memo($pe),zpe=e=>{const{nodeId:t,width:n,children:r,selected:o}=e,{isMouseOverNode:s,handleMouseOut:i,handleMouseOver:l}=fO(t),u=d.useMemo(()=>ce(xe,({nodes:j})=>{var _;return((_=j.nodeExecutionStates[t])==null?void 0:_.status)===Ys.IN_PROGRESS}),[t]),p=W(u),[m,h,g,x]=Ho("shadows",["nodeInProgress.light","nodeInProgress.dark","shadows.xl","shadows.base"]),y=te(),b=sa(m,h),w=W(j=>j.nodes.nodeOpacity),S=d.useCallback(j=>{!j.ctrlKey&&!j.altKey&&!j.metaKey&&!j.shiftKey&&y(LT(t)),y(HI())},[y,t]);return a.jsxs(Ie,{onClick:S,onMouseEnter:l,onMouseLeave:i,className:tl,sx:{h:"full",position:"relative",borderRadius:"base",w:n??g1,transitionProperty:"common",transitionDuration:"0.1s",cursor:"grab",opacity:w},children:[a.jsx(Ie,{sx:{position:"absolute",top:0,insetInlineEnd:0,bottom:0,insetInlineStart:0,borderRadius:"base",pointerEvents:"none",shadow:`${g}, ${x}, ${x}`,zIndex:-1}}),a.jsx(Ie,{sx:{position:"absolute",top:0,insetInlineEnd:0,bottom:0,insetInlineStart:0,borderRadius:"md",pointerEvents:"none",transitionProperty:"common",transitionDuration:"0.1s",opacity:.7,shadow:p?b:void 0,zIndex:-1}}),r,a.jsx(dO,{isSelected:o,isHovered:s})]})},Ng=d.memo(zpe),Fpe=ce(xe,({system:e,gallery:t})=>{var r;return{imageDTO:t.selection[t.selection.length-1],progressImage:(r=e.denoiseProgress)==null?void 0:r.progress_image}}),Bpe=e=>{const{progressImage:t,imageDTO:n}=zT(Fpe);return t?a.jsx(e1,{nodeProps:e,children:a.jsx(ga,{src:t.dataURL,sx:{w:"full",h:"full",objectFit:"contain",borderRadius:"base"}})}):n?a.jsx(e1,{nodeProps:e,children:a.jsx(ua,{imageDTO:n,isDragDisabled:!0,useThumbailFallback:!0})}):a.jsx(e1,{nodeProps:e,children:a.jsx(Zn,{})})},Hpe=d.memo(Bpe),e1=e=>{const[t,n]=d.useState(!1),r=()=>{n(!0)},o=()=>{n(!1)};return a.jsx(Ng,{nodeId:e.nodeProps.id,selected:e.nodeProps.selected,width:384,children:a.jsxs(L,{onMouseEnter:r,onMouseLeave:o,className:tl,sx:{position:"relative",flexDirection:"column"},children:[a.jsx(L,{layerStyle:"nodeHeader",sx:{borderTopRadius:"base",alignItems:"center",justifyContent:"center",h:8},children:a.jsx(ve,{sx:{fontSize:"sm",fontWeight:600,color:"base.700",_dark:{color:"base.200"}},children:"Current Image"})}),a.jsxs(L,{layerStyle:"nodeBody",sx:{w:"full",h:"full",borderBottomRadius:"base",p:2},children:[e.children,t&&a.jsx(In.div,{initial:{opacity:0},animate:{opacity:1,transition:{duration:.1}},exit:{opacity:0,transition:{duration:.1}},style:{position:"absolute",top:40,left:-2,right:-2,bottom:0,pointerEvents:"none"},children:a.jsx(GO,{})},"nextPrevButtons")]})]})})},Vpe=e=>{const t=d.useMemo(()=>ce(xe,({nodes:r})=>{const o=r.nodes.find(i=>i.id===e);if(!Mn(o))return[];const s=r.nodeTemplates[o.data.type];return s?nr(s.inputs).filter(i=>(["any","direct"].includes(i.input)||ab.includes(i.type))&&VI.includes(i.type)).filter(i=>!i.ui_hidden).sort((i,l)=>(i.ui_order??0)-(l.ui_order??0)).map(i=>i.name).filter(i=>i!=="is_intermediate"):[]},je),[e]);return W(t)},Wpe=e=>{const t=d.useMemo(()=>ce(xe,({nodes:r})=>{const o=r.nodes.find(i=>i.id===e);if(!Mn(o))return[];const s=r.nodeTemplates[o.data.type];return s?nr(s.inputs).filter(i=>i.input==="connection"&&!ab.includes(i.type)||!VI.includes(i.type)).filter(i=>!i.ui_hidden).sort((i,l)=>(i.ui_order??0)-(l.ui_order??0)).map(i=>i.name).filter(i=>i!=="is_intermediate"):[]},je),[e]);return W(t)},Upe=e=>{const t=d.useMemo(()=>ce(xe,({nodes:r})=>{const o=r.nodes.find(i=>i.id===e);if(!Mn(o))return[];const s=r.nodeTemplates[o.data.type];return s?nr(s.outputs).filter(i=>!i.ui_hidden).sort((i,l)=>(i.ui_order??0)-(l.ui_order??0)).map(i=>i.name).filter(i=>i!=="is_intermediate"):[]},je),[e]);return W(t)},Gpe=e=>{const t=d.useMemo(()=>ce(xe,({nodes:r})=>{const o=r.nodes.find(s=>s.id===e);return Mn(o)?o.data.embedWorkflow:!1},je),[e]);return W(t)},$g=e=>{const t=d.useMemo(()=>ce(xe,({nodes:r})=>{const o=r.nodes.find(s=>s.id===e);return Mn(o)?Xr(o.data.outputs,s=>FT.includes(s.type)&&o.data.type!=="image"):!1},je),[e]);return W(t)},Kpe=({nodeId:e})=>{const t=te(),n=$g(e),r=Gpe(e),o=d.useCallback(s=>{t(BT({nodeId:e,embedWorkflow:s.target.checked}))},[t,e]);return n?a.jsxs(Kt,{as:L,sx:{alignItems:"center",gap:2,w:"auto"},children:[a.jsx(wn,{sx:{fontSize:"xs",mb:"1px"},children:"Workflow"}),a.jsx(Md,{className:"nopan",size:"sm",onChange:o,isChecked:r})]}):null},qpe=d.memo(Kpe),Xpe=e=>{const t=d.useMemo(()=>ce(xe,({nodes:r})=>{const o=r.nodes.find(s=>s.id===e);return Mn(o)?o.data.isIntermediate:!1},je),[e]);return W(t)},Qpe=({nodeId:e})=>{const t=te(),n=$g(e),r=Xpe(e),o=d.useCallback(s=>{t(HT({nodeId:e,isIntermediate:!s.target.checked}))},[t,e]);return n?a.jsxs(Kt,{as:L,sx:{alignItems:"center",gap:2,w:"auto"},children:[a.jsx(wn,{sx:{fontSize:"xs",mb:"1px"},children:"Save to Gallery"}),a.jsx(Md,{className:"nopan",size:"sm",onChange:o,isChecked:!r})]}):null},Ype=d.memo(Qpe),Zpe=e=>{const t=d.useMemo(()=>ce(xe,({nodes:r})=>{const o=r.nodes.find(s=>s.id===e);return Mn(o)?o.data.useCache:!1},je),[e]);return W(t)},Jpe=({nodeId:e})=>{const t=te(),n=Zpe(e),r=d.useCallback(o=>{t(VT({nodeId:e,useCache:o.target.checked}))},[t,e]);return a.jsxs(Kt,{as:L,sx:{alignItems:"center",gap:2,w:"auto"},children:[a.jsx(wn,{sx:{fontSize:"xs",mb:"1px"},children:"Use Cache"}),a.jsx(Md,{className:"nopan",size:"sm",onChange:r,isChecked:n})]})},eme=d.memo(Jpe),tme=({nodeId:e})=>{const t=$g(e),n=Bt("invocationCache").isFeatureEnabled;return a.jsxs(L,{className:tl,layerStyle:"nodeFooter",sx:{w:"full",borderBottomRadius:"base",px:2,py:0,h:6,justifyContent:"space-between"},children:[n&&a.jsx(eme,{nodeId:e}),t&&a.jsx(qpe,{nodeId:e}),t&&a.jsx(Ype,{nodeId:e})]})},nme=d.memo(tme),rme=({nodeId:e,isOpen:t})=>{const n=te(),r=WT(),o=d.useCallback(()=>{n(UT({nodeId:e,isOpen:!t})),r(e)},[n,t,e,r]);return a.jsx(Fe,{className:"nodrag",onClick:o,"aria-label":"Minimize",sx:{minW:8,w:8,h:8,color:"base.500",_dark:{color:"base.500"},_hover:{color:"base.700",_dark:{color:"base.300"}}},variant:"link",icon:a.jsx(gg,{sx:{transform:t?"rotate(0deg)":"rotate(180deg)",transitionProperty:"common",transitionDuration:"normal"}})})},u2=d.memo(rme),n7=e=>{const t=d.useMemo(()=>ce(xe,({nodes:r})=>{const o=r.nodes.find(s=>s.id===e);return Mn(o)?o.data.label:!1},je),[e]);return W(t)},r7=e=>{const t=d.useMemo(()=>ce(xe,({nodes:r})=>{const o=r.nodes.find(i=>i.id===e);if(!Mn(o))return!1;const s=o?r.nodeTemplates[o.data.type]:void 0;return s==null?void 0:s.title},je),[e]);return W(t)},ome=({nodeId:e,title:t})=>{const n=te(),r=n7(e),o=r7(e),{t:s}=Z(),[i,l]=d.useState(""),u=d.useCallback(async m=>{n(GT({nodeId:e,label:m})),l(r||t||o||s("nodes.problemSettingTitle"))},[n,e,t,o,r,s]),p=d.useCallback(m=>{l(m)},[]);return d.useEffect(()=>{l(r||t||o||s("nodes.problemSettingTitle"))},[r,o,t,s]),a.jsx(L,{sx:{overflow:"hidden",w:"full",h:"full",alignItems:"center",justifyContent:"center",cursor:"text"},children:a.jsxs(Ih,{as:L,value:i,onChange:p,onSubmit:u,sx:{alignItems:"center",position:"relative",w:"full",h:"full"},children:[a.jsx(_h,{fontSize:"sm",sx:{p:0,w:"full"},noOfLines:1}),a.jsx(jh,{className:"nodrag",fontSize:"sm",sx:{p:0,fontWeight:700,_focusVisible:{p:0,boxShadow:"none"}}}),a.jsx(sme,{})]})})},o7=d.memo(ome);function sme(){const{isEditing:e,getEditButtonProps:t}=C5(),n=d.useCallback(r=>{const{onClick:o}=t();o&&o(r)},[t]);return e?null:a.jsx(Ie,{className:tl,onDoubleClick:n,sx:{position:"absolute",w:"full",h:"full",top:0,cursor:"grab"}})}const d2=e=>{const t=d.useMemo(()=>ce(xe,({nodes:r})=>{const o=r.nodes.find(s=>s.id===e);return o==null?void 0:o.data},je),[e]);return W(t)},ame=({nodeId:e})=>{const t=d2(e),{base400:n,base600:r}=Wd(),o=sa(n,r),s=d.useMemo(()=>({borderWidth:0,borderRadius:"3px",width:"1rem",height:"1rem",backgroundColor:o,zIndex:-1}),[o]);return em(t)?a.jsxs(a.Fragment,{children:[a.jsx(Ou,{type:"target",id:`${t.id}-collapsed-target`,isConnectable:!1,position:Ql.Left,style:{...s,left:"-0.5rem"}}),nr(t.inputs,i=>a.jsx(Ou,{type:"target",id:i.name,isConnectable:!1,position:Ql.Left,style:{visibility:"hidden"}},`${t.id}-${i.name}-collapsed-input-handle`)),a.jsx(Ou,{type:"source",id:`${t.id}-collapsed-source`,isConnectable:!1,position:Ql.Right,style:{...s,right:"-0.5rem"}}),nr(t.outputs,i=>a.jsx(Ou,{type:"source",id:i.name,isConnectable:!1,position:Ql.Right,style:{visibility:"hidden"}},`${t.id}-${i.name}-collapsed-output-handle`))]}):null},ime=d.memo(ame),lme=e=>{const t=d.useMemo(()=>ce(xe,({nodes:r})=>{const o=r.nodes.find(i=>i.id===e);return r.nodeTemplates[(o==null?void 0:o.data.type)??""]},je),[e]);return W(t)},cme=({nodeId:e})=>{const t=te(),n=d2(e),{t:r}=Z(),o=d.useCallback(s=>{t(KT({nodeId:e,notes:s.target.value}))},[t,e]);return em(n)?a.jsxs(Kt,{children:[a.jsx(wn,{children:r("nodes.notes")}),a.jsx(da,{value:n==null?void 0:n.notes,onChange:o,rows:10})]}):null},ume=d.memo(cme),dme=e=>{const t=d.useMemo(()=>ce(xe,({nodes:r})=>{var i;const o=r.nodes.find(l=>l.id===e);if(!Mn(o))return!1;const s=r.nodeTemplates[(o==null?void 0:o.data.type)??""];return!(s!=null&&s.version)||!((i=o.data)!=null&&i.version)?!1:Y_(s.version,o.data.version)===0},je),[e]);return W(t)},fme=({nodeId:e})=>{const{isOpen:t,onOpen:n,onClose:r}=Lr(),o=n7(e),s=r7(e),i=dme(e),{t:l}=Z();return a.jsxs(a.Fragment,{children:[a.jsx(Ht,{label:a.jsx(s7,{nodeId:e}),placement:"top",shouldWrapChildren:!0,children:a.jsx(L,{className:"nodrag",onClick:n,sx:{alignItems:"center",justifyContent:"center",w:8,h:8,cursor:"pointer"},children:a.jsx(Tn,{as:fM,sx:{boxSize:4,w:8,color:i?"base.400":"error.400"}})})}),a.jsxs(Ki,{isOpen:t,onClose:r,isCentered:!0,children:[a.jsx(Yo,{}),a.jsxs(qi,{children:[a.jsx(Qo,{children:o||s||l("nodes.unknownNode")}),a.jsx($d,{}),a.jsx(Zo,{children:a.jsx(ume,{nodeId:e})}),a.jsx(Ss,{})]})]})]})},pme=d.memo(fme),s7=d.memo(({nodeId:e})=>{const t=d2(e),n=lme(e),{t:r}=Z(),o=d.useMemo(()=>t!=null&&t.label&&(n!=null&&n.title)?`${t.label} (${n.title})`:t!=null&&t.label&&!n?t.label:!(t!=null&&t.label)&&n?n.title:r("nodes.unknownNode"),[t,n,r]),s=d.useMemo(()=>!em(t)||!n?null:t.version?n.version?qw(t.version,n.version,"<")?a.jsxs(ve,{as:"span",sx:{color:"error.500"},children:[r("nodes.version")," ",t.version," (",r("nodes.updateNode"),")"]}):qw(t.version,n.version,">")?a.jsxs(ve,{as:"span",sx:{color:"error.500"},children:[r("nodes.version")," ",t.version," (",r("nodes.updateApp"),")"]}):a.jsxs(ve,{as:"span",children:[r("nodes.version")," ",t.version]}):a.jsxs(ve,{as:"span",sx:{color:"error.500"},children:[r("nodes.version")," ",t.version," (",r("nodes.unknownTemplate"),")"]}):a.jsx(ve,{as:"span",sx:{color:"error.500"},children:r("nodes.versionUnknown")}),[t,n,r]);return em(t)?a.jsxs(L,{sx:{flexDir:"column"},children:[a.jsx(ve,{as:"span",sx:{fontWeight:600},children:o}),a.jsx(ve,{sx:{opacity:.7,fontStyle:"oblique 5deg"},children:n==null?void 0:n.description}),s,(t==null?void 0:t.notes)&&a.jsx(ve,{children:t.notes})]}):a.jsx(ve,{sx:{fontWeight:600},children:r("nodes.unknownNode")})});s7.displayName="TooltipContent";const t1=3,E_={circle:{transitionProperty:"none",transitionDuration:"0s"},".chakra-progress__track":{stroke:"transparent"}},mme=({nodeId:e})=>{const t=d.useMemo(()=>ce(xe,({nodes:r})=>r.nodeExecutionStates[e]),[e]),n=W(t);return n?a.jsx(Ht,{label:a.jsx(a7,{nodeExecutionState:n}),placement:"top",children:a.jsx(L,{className:tl,sx:{w:5,h:"full",alignItems:"center",justifyContent:"flex-end"},children:a.jsx(i7,{nodeExecutionState:n})})}):null},hme=d.memo(mme),a7=d.memo(({nodeExecutionState:e})=>{const{status:t,progress:n,progressImage:r}=e,{t:o}=Z();return t===Ys.PENDING?a.jsx(ve,{children:"Pending"}):t===Ys.IN_PROGRESS?r?a.jsxs(L,{sx:{pos:"relative",pt:1.5,pb:.5},children:[a.jsx(ga,{src:r.dataURL,sx:{w:32,h:32,borderRadius:"base",objectFit:"contain"}}),n!==null&&a.jsxs(Ds,{variant:"solid",sx:{pos:"absolute",top:2.5,insetInlineEnd:1},children:[Math.round(n*100),"%"]})]}):n!==null?a.jsxs(ve,{children:[o("nodes.executionStateInProgress")," (",Math.round(n*100),"%)"]}):a.jsx(ve,{children:o("nodes.executionStateInProgress")}):t===Ys.COMPLETED?a.jsx(ve,{children:o("nodes.executionStateCompleted")}):t===Ys.FAILED?a.jsx(ve,{children:o("nodes.executionStateError")}):null});a7.displayName="TooltipLabel";const i7=d.memo(e=>{const{progress:t,status:n}=e.nodeExecutionState;return n===Ys.PENDING?a.jsx(Tn,{as:AJ,sx:{boxSize:t1,color:"base.600",_dark:{color:"base.300"}}}):n===Ys.IN_PROGRESS?t===null?a.jsx(B1,{isIndeterminate:!0,size:"14px",color:"base.500",thickness:14,sx:E_}):a.jsx(B1,{value:Math.round(t*100),size:"14px",color:"base.500",thickness:14,sx:E_}):n===Ys.COMPLETED?a.jsx(Tn,{as:iM,sx:{boxSize:t1,color:"ok.600",_dark:{color:"ok.300"}}}):n===Ys.FAILED?a.jsx(Tn,{as:$J,sx:{boxSize:t1,color:"error.600",_dark:{color:"error.300"}}}):null});i7.displayName="StatusIcon";const gme=({nodeId:e,isOpen:t})=>a.jsxs(L,{layerStyle:"nodeHeader",sx:{borderTopRadius:"base",borderBottomRadius:t?0:"base",alignItems:"center",justifyContent:"space-between",h:8,textAlign:"center",fontWeight:500,color:"base.700",_dark:{color:"base.200"}},children:[a.jsx(u2,{nodeId:e,isOpen:t}),a.jsx(o7,{nodeId:e}),a.jsxs(L,{alignItems:"center",children:[a.jsx(hme,{nodeId:e}),a.jsx(pme,{nodeId:e})]}),!t&&a.jsx(ime,{nodeId:e})]}),vme=d.memo(gme),xme=(e,t,n,r)=>ce(xe,o=>{if(!r)return yt.t("nodes.noFieldType");const{currentConnectionFieldType:s,connectionStartParams:i,nodes:l,edges:u}=o.nodes;if(!i||!s)return yt.t("nodes.noConnectionInProgress");const{handleType:p,nodeId:m,handleId:h}=i;if(!p||!m||!h)return yt.t("nodes.noConnectionData");const g=n==="target"?r:s,x=n==="source"?r:s;if(e===m)return yt.t("nodes.cannotConnectToSelf");if(n===p)return n==="source"?yt.t("nodes.cannotConnectOutputToOutput"):yt.t("nodes.cannotConnectInputToInput");const y=n==="target"?e:m,b=n==="target"?t:h,w=n==="source"?e:m,S=n==="source"?t:h;return u.find(_=>{_.target===y&&_.targetHandle===b&&_.source===w&&_.sourceHandle})?yt.t("nodes.cannotDuplicateConnection"):u.find(_=>_.target===y&&_.targetHandle===b)&&g!=="CollectionItem"?yt.t("nodes.inputMayOnlyHaveOneConnection"):ob(x,g)?FI(p==="source"?m:e,p==="source"?e:m,l,u)?null:yt.t("nodes.connectionWouldCreateCycle"):yt.t("nodes.fieldTypesMustMatch")}),bme=(e,t,n)=>{const r=d.useMemo(()=>ce(xe,({nodes:s})=>{var l;const i=s.nodes.find(u=>u.id===e);if(Mn(i))return(l=i==null?void 0:i.data[tb[n]][t])==null?void 0:l.type},je),[t,n,e]);return W(r)},yme=ce(xe,({nodes:e})=>e.currentConnectionFieldType!==null&&e.connectionStartParams!==null),l7=({nodeId:e,fieldName:t,kind:n})=>{const r=bme(e,t,n),o=d.useMemo(()=>ce(xe,({nodes:g})=>!!g.edges.filter(x=>(n==="input"?x.target:x.source)===e&&(n==="input"?x.targetHandle:x.sourceHandle)===t).length),[t,n,e]),s=d.useMemo(()=>xme(e,t,n==="input"?"target":"source",r),[e,t,n,r]),i=d.useMemo(()=>ce(xe,({nodes:g})=>{var x,y,b;return((x=g.connectionStartParams)==null?void 0:x.nodeId)===e&&((y=g.connectionStartParams)==null?void 0:y.handleId)===t&&((b=g.connectionStartParams)==null?void 0:b.handleType)==={input:"target",output:"source"}[n]}),[t,n,e]),l=W(o),u=W(yme),p=W(i),m=W(s),h=d.useMemo(()=>!!(u&&m&&!p),[m,u,p]);return{isConnected:l,isConnectionInProgress:u,isConnectionStartField:p,connectionError:m,shouldDim:h}},Cme=(e,t)=>{const n=d.useMemo(()=>ce(xe,({nodes:o})=>{var i;const s=o.nodes.find(l=>l.id===e);if(Mn(s))return((i=s==null?void 0:s.data.inputs[t])==null?void 0:i.value)!==void 0},je),[t,e]);return W(n)},wme=(e,t)=>{const n=d.useMemo(()=>ce(xe,({nodes:o})=>{const s=o.nodes.find(u=>u.id===e);if(!Mn(s))return;const i=o.nodeTemplates[(s==null?void 0:s.data.type)??""],l=i==null?void 0:i.inputs[t];return l==null?void 0:l.input},je),[t,e]);return W(n)},Sme=({nodeId:e,fieldName:t,kind:n,children:r})=>{const o=te(),s=pO(e,t),i=mO(e,t,n),l=wme(e,t),{t:u}=Z(),p=d.useCallback(w=>{w.preventDefault()},[]),m=d.useMemo(()=>ce(xe,({nodes:w})=>({isExposed:!!w.workflow.exposedFields.find(j=>j.nodeId===e&&j.fieldName===t)}),je),[t,e]),h=d.useMemo(()=>["any","direct"].includes(l??"__UNKNOWN_INPUT__"),[l]),{isExposed:g}=W(m),x=d.useCallback(()=>{o(qT({nodeId:e,fieldName:t}))},[o,t,e]),y=d.useCallback(()=>{o(_I({nodeId:e,fieldName:t}))},[o,t,e]),b=d.useMemo(()=>{const w=[];return h&&!g&&w.push(a.jsx(en,{icon:a.jsx(Vc,{}),onClick:x,children:"Add to Linear View"},`${e}.${t}.expose-field`)),h&&g&&w.push(a.jsx(en,{icon:a.jsx(qJ,{}),onClick:y,children:"Remove from Linear View"},`${e}.${t}.unexpose-field`)),w},[t,x,y,g,h,e]);return a.jsx(Ry,{menuProps:{size:"sm",isLazy:!0},menuButtonProps:{bg:"transparent",_hover:{bg:"transparent"}},renderMenu:()=>b.length?a.jsx(Ui,{sx:{visibility:"visible !important"},motionProps:vc,onContextMenu:p,children:a.jsx(td,{title:s||i||u("nodes.unknownField"),children:b})}):null,children:r})},kme=d.memo(Sme),jme=e=>{const{fieldTemplate:t,handleType:n,isConnectionInProgress:r,isConnectionStartField:o,connectionError:s}=e,{name:i,type:l}=t,{color:u,title:p}=wd[l],m=d.useMemo(()=>{const g=XT.includes(l),x=ab.includes(l),y=QT.includes(l),b=hd(u),w={backgroundColor:g||x?"var(--invokeai-colors-base-900)":b,position:"absolute",width:"1rem",height:"1rem",borderWidth:g||x?4:0,borderStyle:"solid",borderColor:b,borderRadius:y?4:"100%",zIndex:1};return n==="target"?w.insetInlineStart="-1rem":w.insetInlineEnd="-1rem",r&&!o&&s&&(w.filter="opacity(0.4) grayscale(0.7)"),r&&s?o?w.cursor="grab":w.cursor="not-allowed":w.cursor="crosshair",w},[s,n,r,o,l,u]),h=d.useMemo(()=>r&&o?p:r&&s?s??p:p,[s,r,o,p]);return a.jsx(Ht,{label:h,placement:n==="target"?"start":"end",hasArrow:!0,openDelay:yh,children:a.jsx(Ou,{type:n,id:i,position:n==="target"?Ql.Left:Ql.Right,style:m})})},c7=d.memo(jme),_me=({nodeId:e,fieldName:t})=>{const n=Pg(e,t,"input"),r=Cme(e,t),{isConnected:o,isConnectionInProgress:s,isConnectionStartField:i,connectionError:l,shouldDim:u}=l7({nodeId:e,fieldName:t,kind:"input"}),p=d.useMemo(()=>{if((n==null?void 0:n.fieldKind)!=="input"||!n.required)return!1;if(!o&&n.input==="connection"||!r&&!o&&n.input==="any")return!0},[n,o,r]);return(n==null?void 0:n.fieldKind)!=="input"?a.jsx(Rx,{shouldDim:u,children:a.jsxs(Kt,{sx:{color:"error.400",textAlign:"left",fontSize:"sm"},children:["Unknown input: ",t]})}):a.jsxs(Rx,{shouldDim:u,children:[a.jsxs(Kt,{isInvalid:p,isDisabled:o,sx:{alignItems:"stretch",justifyContent:"space-between",ps:n.input==="direct"?0:2,gap:2,h:"full",w:"full"},children:[a.jsx(kme,{nodeId:e,fieldName:t,kind:"input",children:m=>a.jsx(wn,{sx:{display:"flex",alignItems:"center",h:"full",mb:0,px:1,gap:2},children:a.jsx(gO,{ref:m,nodeId:e,fieldName:t,kind:"input",isMissingInput:p,withTooltip:!0})})}),a.jsx(Ie,{children:a.jsx(PO,{nodeId:e,fieldName:t})})]}),n.input!=="direct"&&a.jsx(c7,{fieldTemplate:n,handleType:"target",isConnectionInProgress:s,isConnectionStartField:i,connectionError:l})]})},M_=d.memo(_me),Rx=d.memo(({shouldDim:e,children:t})=>a.jsx(L,{sx:{position:"relative",minH:8,py:.5,alignItems:"center",opacity:e?.5:1,transitionProperty:"opacity",transitionDuration:"0.1s",w:"full",h:"full"},children:t}));Rx.displayName="InputFieldWrapper";const Ime=({nodeId:e,fieldName:t})=>{const n=Pg(e,t,"output"),{isConnected:r,isConnectionInProgress:o,isConnectionStartField:s,connectionError:i,shouldDim:l}=l7({nodeId:e,fieldName:t,kind:"output"});return(n==null?void 0:n.fieldKind)!=="output"?a.jsx(Dx,{shouldDim:l,children:a.jsxs(Kt,{sx:{color:"error.400",textAlign:"right",fontSize:"sm"},children:["Unknown output: ",t]})}):a.jsxs(Dx,{shouldDim:l,children:[a.jsx(Ht,{label:a.jsx(t2,{nodeId:e,fieldName:t,kind:"output"}),openDelay:yh,placement:"top",shouldWrapChildren:!0,hasArrow:!0,children:a.jsx(Kt,{isDisabled:r,pe:2,children:a.jsx(wn,{sx:{mb:0,fontWeight:500},children:n==null?void 0:n.title})})}),a.jsx(c7,{fieldTemplate:n,handleType:"source",isConnectionInProgress:o,isConnectionStartField:s,connectionError:i})]})},Pme=d.memo(Ime),Dx=d.memo(({shouldDim:e,children:t})=>a.jsx(L,{sx:{position:"relative",minH:8,py:.5,alignItems:"center",opacity:e?.5:1,transitionProperty:"opacity",transitionDuration:"0.1s",justifyContent:"flex-end"},children:t}));Dx.displayName="OutputFieldWrapper";const Eme=e=>{const t=$g(e),n=Bt("invocationCache").isFeatureEnabled;return d.useMemo(()=>t||n,[t,n])},Mme=({nodeId:e,isOpen:t,label:n,type:r,selected:o})=>{const s=Wpe(e),i=Vpe(e),l=Eme(e),u=Upe(e);return a.jsxs(Ng,{nodeId:e,selected:o,children:[a.jsx(vme,{nodeId:e,isOpen:t,label:n,selected:o,type:r}),t&&a.jsxs(a.Fragment,{children:[a.jsx(L,{layerStyle:"nodeBody",sx:{flexDirection:"column",w:"full",h:"full",py:2,gap:1,borderBottomRadius:l?0:"base"},children:a.jsxs(L,{sx:{flexDir:"column",px:2,w:"full",h:"full"},children:[a.jsxs(Ja,{gridTemplateColumns:"1fr auto",gridAutoRows:"1fr",children:[s.map((p,m)=>a.jsx(Zu,{gridColumnStart:1,gridRowStart:m+1,children:a.jsx(M_,{nodeId:e,fieldName:p})},`${e}.${p}.input-field`)),u.map((p,m)=>a.jsx(Zu,{gridColumnStart:2,gridRowStart:m+1,children:a.jsx(Pme,{nodeId:e,fieldName:p})},`${e}.${p}.output-field`))]}),i.map(p=>a.jsx(M_,{nodeId:e,fieldName:p},`${e}.${p}.input-field`))]})}),l&&a.jsx(nme,{nodeId:e})]})]})},Ome=d.memo(Mme),Rme=({nodeId:e,isOpen:t,label:n,type:r,selected:o})=>a.jsxs(Ng,{nodeId:e,selected:o,children:[a.jsxs(L,{className:tl,layerStyle:"nodeHeader",sx:{borderTopRadius:"base",borderBottomRadius:t?0:"base",alignItems:"center",h:8,fontWeight:600,fontSize:"sm"},children:[a.jsx(u2,{nodeId:e,isOpen:t}),a.jsx(ve,{sx:{w:"full",textAlign:"center",pe:8,color:"error.500",_dark:{color:"error.300"}},children:n?`${n} (${r})`:r})]}),t&&a.jsx(L,{layerStyle:"nodeBody",sx:{userSelect:"auto",flexDirection:"column",w:"full",h:"full",p:4,gap:1,borderBottomRadius:"base",fontSize:"sm"},children:a.jsxs(Ie,{children:[a.jsx(ve,{as:"span",children:"Unknown node type: "}),a.jsx(ve,{as:"span",fontWeight:600,children:r})]})})]}),Dme=d.memo(Rme),Ame=e=>{const{data:t,selected:n}=e,{id:r,type:o,isOpen:s,label:i}=t,l=d.useMemo(()=>ce(xe,({nodes:p})=>!!p.nodeTemplates[o]),[o]);return W(l)?a.jsx(Ome,{nodeId:r,isOpen:s,label:i,type:o,selected:n}):a.jsx(Dme,{nodeId:r,isOpen:s,label:i,type:o,selected:n})},Tme=d.memo(Ame),Nme=e=>{const{id:t,data:n,selected:r}=e,{notes:o,isOpen:s}=n,i=te(),l=d.useCallback(u=>{i(YT({nodeId:t,value:u.target.value}))},[i,t]);return a.jsxs(Ng,{nodeId:t,selected:r,children:[a.jsxs(L,{layerStyle:"nodeHeader",sx:{borderTopRadius:"base",borderBottomRadius:s?0:"base",alignItems:"center",justifyContent:"space-between",h:8},children:[a.jsx(u2,{nodeId:t,isOpen:s}),a.jsx(o7,{nodeId:t,title:"Notes"}),a.jsx(Ie,{minW:8})]}),s&&a.jsx(a.Fragment,{children:a.jsx(L,{layerStyle:"nodeBody",className:"nopan",sx:{cursor:"auto",flexDirection:"column",borderBottomRadius:"base",w:"full",h:"full",p:2,gap:1},children:a.jsx(L,{className:"nopan",sx:{flexDir:"column",w:"full",h:"full"},children:a.jsx(da,{value:o,onChange:l,rows:8,resize:"none",sx:{fontSize:"xs"}})})})})]})},$me=d.memo(Nme),Lme=["Delete","Backspace"],zme={collapsed:Npe,default:Lpe},Fme={invocation:Tme,current_image:Hpe,notes:$me},Bme={hideAttribution:!0},Hme=ce(xe,({nodes:e})=>{const{shouldSnapToGrid:t,selectionMode:n}=e;return{shouldSnapToGrid:t,selectionMode:n}},je),Vme=()=>{const e=te(),t=W(O=>O.nodes.nodes),n=W(O=>O.nodes.edges),r=W(O=>O.nodes.viewport),{shouldSnapToGrid:o,selectionMode:s}=W(Hme),i=d.useRef(null),l=d.useRef(),u=Ope(),[p]=Ho("radii",["base"]),m=d.useCallback(O=>{e(ZT(O))},[e]),h=d.useCallback(O=>{e(JT(O))},[e]),g=d.useCallback((O,T)=>{e(eN(T))},[e]),x=d.useCallback(O=>{e(Tw(O))},[e]),y=d.useCallback(()=>{e(tN({cursorPosition:l.current}))},[e]),b=d.useCallback(O=>{e(nN(O))},[e]),w=d.useCallback(O=>{e(rN(O))},[e]),S=d.useCallback(({nodes:O,edges:T})=>{e(oN(O?O.map(X=>X.id):[])),e(sN(T?T.map(X=>X.id):[]))},[e]),j=d.useCallback((O,T)=>{e(aN(T))},[e]),_=d.useCallback(()=>{e(HI())},[e]),E=d.useCallback(O=>{Nw.set(O),O.fitView()},[]),I=d.useCallback(O=>{var X,B;const T=(X=i.current)==null?void 0:X.getBoundingClientRect();if(T){const V=(B=Nw.get())==null?void 0:B.project({x:O.clientX-T.left,y:O.clientY-T.top});l.current=V}},[]),M=d.useRef(),R=d.useCallback((O,T,X)=>{M.current=O,e(iN(T.id)),e(lN())},[e]),D=d.useCallback((O,T)=>{e(Tw(T))},[e]),A=d.useCallback((O,T,X)=>{var B,V;!("touches"in O)&&((B=M.current)==null?void 0:B.clientX)===O.clientX&&((V=M.current)==null?void 0:V.clientY)===O.clientY&&e(cN(T)),M.current=void 0},[e]);return et(["Ctrl+c","Meta+c"],O=>{O.preventDefault(),e(uN())}),et(["Ctrl+a","Meta+a"],O=>{O.preventDefault(),e(dN())}),et(["Ctrl+v","Meta+v"],O=>{O.preventDefault(),e(fN({cursorPosition:l.current}))}),a.jsx(pN,{id:"workflow-editor",ref:i,defaultViewport:r,nodeTypes:Fme,edgeTypes:zme,nodes:t,edges:n,onInit:E,onMouseMove:I,onNodesChange:m,onEdgesChange:h,onEdgesDelete:b,onEdgeUpdate:D,onEdgeUpdateStart:R,onEdgeUpdateEnd:A,onNodesDelete:w,onConnectStart:g,onConnect:x,onConnectEnd:y,onMoveEnd:j,connectionLineComponent:Ape,onSelectionChange:S,isValidConnection:u,minZoom:.1,snapToGrid:o,snapGrid:[25,25],connectionRadius:30,proOptions:Bme,style:{borderRadius:p},onPaneClick:_,deleteKeyCode:Lme,selectionMode:s,children:a.jsx(b$,{})})},Wme=()=>{const e=te(),{t}=Z(),n=d.useCallback(()=>{e(zI())},[e]);return a.jsx(L,{sx:{gap:2,position:"absolute",top:2,insetInlineStart:2},children:a.jsx(Fe,{tooltip:t("nodes.addNodeToolTip"),"aria-label":t("nodes.addNode"),icon:a.jsx(Vc,{}),onClick:n})})},Ume=d.memo(Wme),Gme=()=>{const e=te(),t=pP("nodes"),{t:n}=Z();return d.useCallback(o=>{if(!o)return;const s=new FileReader;s.onload=async()=>{const i=s.result;try{const l=JSON.parse(String(i)),u=mN.safeParse(l);if(!u.success){const{message:p}=hN(u.error,{prefix:n("nodes.workflowValidation")});t.error({error:gN(u.error)},p),e(ct(Qt({title:n("nodes.unableToValidateWorkflow"),status:"error",duration:5e3}))),s.abort();return}e(Xx(u.data)),s.abort()}catch{e(ct(Qt({title:n("nodes.unableToLoadWorkflow"),status:"error"})))}},s.readAsText(o)},[e,t,n])},Kme=d.memo(e=>e.error.issues[0]?a.jsx(ve,{children:$w(e.error.issues[0],{prefix:null}).toString()}):a.jsx(Od,{children:e.error.issues.map((t,n)=>a.jsx(Qr,{children:a.jsx(ve,{children:$w(t,{prefix:null}).toString()})},n))}));Kme.displayName="WorkflowValidationErrorContent";const qme=()=>{const{t:e}=Z(),t=d.useRef(null),n=Gme();return a.jsx(AE,{resetRef:t,accept:"application/json",onChange:n,children:r=>a.jsx(Fe,{icon:a.jsx(cg,{}),tooltip:e("nodes.loadWorkflow"),"aria-label":e("nodes.loadWorkflow"),...r})})},Xme=d.memo(qme),Qme=()=>{const{t:e}=Z(),t=te(),{isOpen:n,onOpen:r,onClose:o}=Lr(),s=d.useRef(null),i=W(u=>u.nodes.nodes.length),l=d.useCallback(()=>{t(vN()),t(ct(Qt({title:e("toast.nodesCleared"),status:"success"}))),o()},[t,e,o]);return a.jsxs(a.Fragment,{children:[a.jsx(Fe,{icon:a.jsx(Br,{}),tooltip:e("nodes.resetWorkflow"),"aria-label":e("nodes.resetWorkflow"),onClick:r,isDisabled:!i,colorScheme:"error"}),a.jsxs(Td,{isOpen:n,onClose:o,leastDestructiveRef:s,isCentered:!0,children:[a.jsx(Yo,{}),a.jsxs(Nd,{children:[a.jsx(Qo,{fontSize:"lg",fontWeight:"bold",children:e("nodes.resetWorkflow")}),a.jsx(Zo,{py:4,children:a.jsxs(L,{flexDir:"column",gap:2,children:[a.jsx(ve,{children:e("nodes.resetWorkflowDesc")}),a.jsx(ve,{variant:"subtext",children:e("nodes.resetWorkflowDesc2")})]})}),a.jsxs(Ss,{children:[a.jsx(Za,{ref:s,onClick:o,children:e("common.cancel")}),a.jsx(Za,{colorScheme:"error",ml:3,onClick:l,children:e("common.accept")})]})]})]})]})},Yme=d.memo(Qme),Zme=()=>{const{t:e}=Z(),t=uO(),n=d.useCallback(()=>{const r=new Blob([JSON.stringify(t,null,2)]),o=document.createElement("a");o.href=URL.createObjectURL(r),o.download=`${t.name||"My Workflow"}.json`,document.body.appendChild(o),o.click(),o.remove()},[t]);return a.jsx(Fe,{icon:a.jsx(ig,{}),tooltip:e("nodes.downloadWorkflow"),"aria-label":e("nodes.downloadWorkflow"),onClick:n})},Jme=d.memo(Zme),ehe=()=>a.jsxs(L,{sx:{gap:2,position:"absolute",top:2,insetInlineStart:"50%",transform:"translate(-50%)"},children:[a.jsx(Jme,{}),a.jsx(Xme,{}),a.jsx(Yme,{})]}),the=d.memo(ehe),nhe=()=>a.jsx(L,{sx:{gap:2,flexDir:"column"},children:nr(wd,({title:e,description:t,color:n},r)=>a.jsx(Ht,{label:t,children:a.jsx(Ds,{sx:{userSelect:"none",color:parseInt(n.split(".")[1]??"0",10)<500?"base.800":"base.50",bg:n},textAlign:"center",children:e})},r))}),rhe=d.memo(nhe),ohe=()=>{const{t:e}=Z(),t=te(),n=d.useCallback(()=>{t(xN())},[t]);return a.jsx(at,{leftIcon:a.jsx(oee,{}),tooltip:e("nodes.reloadNodeTemplates"),"aria-label":e("nodes.reloadNodeTemplates"),onClick:n,children:e("nodes.reloadNodeTemplates")})},she=d.memo(ohe),Pu={fontWeight:600},ahe=ce(xe,({nodes:e})=>{const{shouldAnimateEdges:t,shouldValidateGraph:n,shouldSnapToGrid:r,shouldColorEdges:o,selectionMode:s}=e;return{shouldAnimateEdges:t,shouldValidateGraph:n,shouldSnapToGrid:r,shouldColorEdges:o,selectionModeIsChecked:s===bN.Full}},je),ihe=ke((e,t)=>{const{isOpen:n,onOpen:r,onClose:o}=Lr(),s=te(),{shouldAnimateEdges:i,shouldValidateGraph:l,shouldSnapToGrid:u,shouldColorEdges:p,selectionModeIsChecked:m}=W(ahe),h=d.useCallback(S=>{s(yN(S.target.checked))},[s]),g=d.useCallback(S=>{s(CN(S.target.checked))},[s]),x=d.useCallback(S=>{s(wN(S.target.checked))},[s]),y=d.useCallback(S=>{s(SN(S.target.checked))},[s]),b=d.useCallback(S=>{s(kN(S.target.checked))},[s]),{t:w}=Z();return a.jsxs(a.Fragment,{children:[a.jsx(Fe,{ref:t,"aria-label":w("nodes.workflowSettings"),tooltip:w("nodes.workflowSettings"),icon:a.jsx(cM,{}),onClick:r}),a.jsxs(Ki,{isOpen:n,onClose:o,size:"2xl",isCentered:!0,children:[a.jsx(Yo,{}),a.jsxs(qi,{children:[a.jsx(Qo,{children:w("nodes.workflowSettings")}),a.jsx($d,{}),a.jsx(Zo,{children:a.jsxs(L,{sx:{flexDirection:"column",gap:4,py:4},children:[a.jsx(cr,{size:"sm",children:"General"}),a.jsx(dn,{formLabelProps:Pu,onChange:g,isChecked:i,label:w("nodes.animatedEdges"),helperText:w("nodes.animatedEdgesHelp")}),a.jsx(Yn,{}),a.jsx(dn,{formLabelProps:Pu,isChecked:u,onChange:x,label:w("nodes.snapToGrid"),helperText:w("nodes.snapToGridHelp")}),a.jsx(Yn,{}),a.jsx(dn,{formLabelProps:Pu,isChecked:p,onChange:y,label:w("nodes.colorCodeEdges"),helperText:w("nodes.colorCodeEdgesHelp")}),a.jsx(dn,{formLabelProps:Pu,isChecked:m,onChange:b,label:w("nodes.fullyContainNodes"),helperText:w("nodes.fullyContainNodesHelp")}),a.jsx(cr,{size:"sm",pt:4,children:"Advanced"}),a.jsx(dn,{formLabelProps:Pu,isChecked:l,onChange:h,label:w("nodes.validateConnections"),helperText:w("nodes.validateConnectionsHelp")}),a.jsx(she,{})]})})]})]})]})}),lhe=d.memo(ihe),che=()=>{const e=W(t=>t.nodes.shouldShowFieldTypeLegend);return a.jsxs(L,{sx:{gap:2,position:"absolute",top:2,insetInlineEnd:2},children:[a.jsx(lhe,{}),e&&a.jsx(rhe,{})]})},uhe=d.memo(che);function dhe(){const e=te(),t=W(o=>o.nodes.nodeOpacity),{t:n}=Z(),r=d.useCallback(o=>{e(jN(o))},[e]);return a.jsx(L,{alignItems:"center",children:a.jsxs(Wb,{"aria-label":n("nodes.nodeOpacity"),value:t,min:.5,max:1,step:.01,onChange:r,orientation:"vertical",defaultValue:30,h:"calc(100% - 0.5rem)",children:[a.jsx(Gb,{children:a.jsx(Kb,{})}),a.jsx(Ub,{})]})})}const fhe=()=>{const{t:e}=Z(),{zoomIn:t,zoomOut:n,fitView:r}=rb(),o=te(),s=W(m=>m.nodes.shouldShowMinimapPanel),i=d.useCallback(()=>{t()},[t]),l=d.useCallback(()=>{n()},[n]),u=d.useCallback(()=>{r()},[r]),p=d.useCallback(()=>{o(_N(!s))},[s,o]);return a.jsxs(Vt,{isAttached:!0,orientation:"vertical",children:[a.jsx(Fe,{tooltip:e("nodes.zoomInNodes"),"aria-label":e("nodes.zoomInNodes"),onClick:i,icon:a.jsx(yoe,{})}),a.jsx(Fe,{tooltip:e("nodes.zoomOutNodes"),"aria-label":e("nodes.zoomOutNodes"),onClick:l,icon:a.jsx(boe,{})}),a.jsx(Fe,{tooltip:e("nodes.fitViewportNodes"),"aria-label":e("nodes.fitViewportNodes"),onClick:u,icon:a.jsx(uM,{})}),a.jsx(Fe,{tooltip:e(s?"nodes.hideMinimapnodes":"nodes.showMinimapnodes"),"aria-label":e(s?"nodes.hideMinimapnodes":"nodes.showMinimapnodes"),isChecked:s,onClick:p,icon:a.jsx(KJ,{})})]})},phe=d.memo(fhe),mhe=()=>a.jsxs(L,{sx:{gap:2,position:"absolute",bottom:2,insetInlineStart:2},children:[a.jsx(phe,{}),a.jsx(dhe,{})]}),hhe=d.memo(mhe),ghe=we(p$),vhe=()=>{const e=W(r=>r.nodes.shouldShowMinimapPanel),t=sa("var(--invokeai-colors-accent-300)","var(--invokeai-colors-accent-600)"),n=sa("var(--invokeai-colors-blackAlpha-300)","var(--invokeai-colors-blackAlpha-600)");return a.jsx(L,{sx:{gap:2,position:"absolute",bottom:2,insetInlineEnd:2},children:e&&a.jsx(ghe,{pannable:!0,zoomable:!0,nodeBorderRadius:15,sx:{m:"0 !important",backgroundColor:"base.200 !important",borderRadius:"base",_dark:{backgroundColor:"base.500 !important"},svg:{borderRadius:"inherit"}},nodeColor:t,maskColor:n})})},xhe=d.memo(vhe),bhe=()=>{const e=W(n=>n.nodes.isReady),{t}=Z();return a.jsxs(L,{layerStyle:"first",sx:{position:"relative",width:"full",height:"full",borderRadius:"base",alignItems:"center",justifyContent:"center"},children:[a.jsx(dr,{children:e&&a.jsxs(In.div,{initial:{opacity:0},animate:{opacity:1,transition:{duration:.2}},exit:{opacity:0,transition:{duration:.2}},style:{position:"relative",width:"100%",height:"100%"},children:[a.jsx(Vme,{}),a.jsx(Mpe,{}),a.jsx(Ume,{}),a.jsx(the,{}),a.jsx(uhe,{}),a.jsx(hhe,{}),a.jsx(xhe,{})]})}),a.jsx(dr,{children:!e&&a.jsx(In.div,{initial:{opacity:0},animate:{opacity:1,transition:{duration:.2}},exit:{opacity:0,transition:{duration:.2}},style:{position:"absolute",width:"100%",height:"100%"},children:a.jsx(L,{layerStyle:"first",sx:{position:"relative",width:"full",height:"full",borderRadius:"base",alignItems:"center",justifyContent:"center",pointerEvents:"none"},children:a.jsx(Zn,{label:t("nodes.loadingNodes"),icon:Coe})})})})]})},yhe=d.memo(bhe),Che=()=>a.jsx(IN,{children:a.jsx(yhe,{})}),whe=d.memo(Che),She=()=>{const{t:e}=Z(),t=te(),{data:n}=kd(),r=W(u=>u.system.isConnected),[o,{isLoading:s}]=PN({fixedCacheKey:"clearInvocationCache"}),i=d.useMemo(()=>!(n!=null&&n.size)||!r,[n==null?void 0:n.size,r]);return{clearInvocationCache:d.useCallback(async()=>{if(!i)try{await o().unwrap(),t(ct({title:e("invocationCache.clearSucceeded"),status:"success"}))}catch{t(ct({title:e("invocationCache.clearFailed"),status:"error"}))}},[i,o,t,e]),isLoading:s,cacheStatus:n,isDisabled:i}},khe=()=>{const{t:e}=Z(),{clearInvocationCache:t,isDisabled:n,isLoading:r}=She();return a.jsx(at,{isDisabled:n,isLoading:r,onClick:t,children:e("invocationCache.clear")})},jhe=d.memo(khe),_he=()=>{const{t:e}=Z(),t=te(),{data:n}=kd(),r=W(u=>u.system.isConnected),[o,{isLoading:s}]=EN({fixedCacheKey:"disableInvocationCache"}),i=d.useMemo(()=>!(n!=null&&n.enabled)||!r||(n==null?void 0:n.max_size)===0,[n==null?void 0:n.enabled,n==null?void 0:n.max_size,r]);return{disableInvocationCache:d.useCallback(async()=>{if(!i)try{await o().unwrap(),t(ct({title:e("invocationCache.disableSucceeded"),status:"success"}))}catch{t(ct({title:e("invocationCache.disableFailed"),status:"error"}))}},[i,o,t,e]),isLoading:s,cacheStatus:n,isDisabled:i}},Ihe=()=>{const{t:e}=Z(),t=te(),{data:n}=kd(),r=W(u=>u.system.isConnected),[o,{isLoading:s}]=MN({fixedCacheKey:"enableInvocationCache"}),i=d.useMemo(()=>(n==null?void 0:n.enabled)||!r||(n==null?void 0:n.max_size)===0,[n==null?void 0:n.enabled,n==null?void 0:n.max_size,r]);return{enableInvocationCache:d.useCallback(async()=>{if(!i)try{await o().unwrap(),t(ct({title:e("invocationCache.enableSucceeded"),status:"success"}))}catch{t(ct({title:e("invocationCache.enableFailed"),status:"error"}))}},[i,o,t,e]),isLoading:s,cacheStatus:n,isDisabled:i}},Phe=()=>{const{t:e}=Z(),{data:t}=kd(),{enableInvocationCache:n,isDisabled:r,isLoading:o}=Ihe(),{disableInvocationCache:s,isDisabled:i,isLoading:l}=_he();return t!=null&&t.enabled?a.jsx(at,{isDisabled:i,isLoading:l,onClick:s,children:e("invocationCache.disable")}):a.jsx(at,{isDisabled:r,isLoading:o,onClick:n,children:e("invocationCache.enable")})},Ehe=d.memo(Phe),Mhe=({children:e,...t})=>a.jsx(iP,{alignItems:"center",justifyContent:"center",w:"full",h:"full",layerStyle:"second",borderRadius:"base",py:2,px:3,gap:6,flexWrap:"nowrap",...t,children:e}),u7=d.memo(Mhe),Ohe={'&[aria-disabled="true"]':{color:"base.400",_dark:{color:"base.500"}}},Rhe=({label:e,value:t,isDisabled:n=!1,...r})=>a.jsxs(aP,{flexGrow:1,textOverflow:"ellipsis",overflow:"hidden",whiteSpace:"nowrap","aria-disabled":n,sx:Ohe,...r,children:[a.jsx(lP,{textOverflow:"ellipsis",overflow:"hidden",whiteSpace:"nowrap",children:e}),a.jsx(cP,{children:t})]}),hs=d.memo(Rhe),Dhe=()=>{const{t:e}=Z(),{data:t}=kd(void 0);return a.jsxs(u7,{children:[a.jsx(hs,{isDisabled:!(t!=null&&t.enabled),label:e("invocationCache.cacheSize"),value:(t==null?void 0:t.size)??0}),a.jsx(hs,{isDisabled:!(t!=null&&t.enabled),label:e("invocationCache.hits"),value:(t==null?void 0:t.hits)??0}),a.jsx(hs,{isDisabled:!(t!=null&&t.enabled),label:e("invocationCache.misses"),value:(t==null?void 0:t.misses)??0}),a.jsx(hs,{isDisabled:!(t!=null&&t.enabled),label:e("invocationCache.maxCacheSize"),value:(t==null?void 0:t.max_size)??0}),a.jsxs(Vt,{w:24,orientation:"vertical",size:"xs",children:[a.jsx(jhe,{}),a.jsx(Ehe,{})]})]})},Ahe=d.memo(Dhe),d7=e=>{const t=W(l=>l.system.isConnected),[n,{isLoading:r}]=Yx(),o=te(),{t:s}=Z();return{cancelQueueItem:d.useCallback(async()=>{try{await n(e).unwrap(),o(ct({title:s("queue.cancelSucceeded"),status:"success"}))}catch{o(ct({title:s("queue.cancelFailed"),status:"error"}))}},[o,e,s,n]),isLoading:r,isDisabled:!t}},f7=(e,t)=>Number(((Date.parse(t)-Date.parse(e))/1e3).toFixed(2)),O_={pending:{colorScheme:"cyan",translationKey:"queue.pending"},in_progress:{colorScheme:"yellow",translationKey:"queue.in_progress"},completed:{colorScheme:"green",translationKey:"queue.completed"},failed:{colorScheme:"red",translationKey:"queue.failed"},canceled:{colorScheme:"orange",translationKey:"queue.canceled"}},The=({status:e})=>{const{t}=Z();return a.jsx(Ds,{colorScheme:O_[e].colorScheme,children:t(O_[e].translationKey)})},Nhe=d.memo(The),$he=e=>{const t=W(u=>u.system.isConnected),{isCanceled:n}=ON({batch_id:e},{selectFromResult:({data:u})=>u?{isCanceled:(u==null?void 0:u.in_progress)===0&&(u==null?void 0:u.pending)===0}:{isCanceled:!0}}),[r,{isLoading:o}]=RN({fixedCacheKey:"cancelByBatchIds"}),s=te(),{t:i}=Z();return{cancelBatch:d.useCallback(async()=>{if(!n)try{await r({batch_ids:[e]}).unwrap(),s(ct({title:i("queue.cancelBatchSucceeded"),status:"success"}))}catch{s(ct({title:i("queue.cancelBatchFailed"),status:"error"}))}},[e,s,n,i,r]),isLoading:o,isCanceled:n,isDisabled:!t}},Lhe=({queueItemDTO:e})=>{const{session_id:t,batch_id:n,item_id:r}=e,{t:o}=Z(),{cancelBatch:s,isLoading:i,isCanceled:l}=$he(n),{cancelQueueItem:u,isLoading:p}=d7(r),{data:m}=DN(r),h=d.useMemo(()=>{if(!m)return o("common.loading");if(!m.completed_at||!m.started_at)return o(`queue.${m.status}`);const g=f7(m.started_at,m.completed_at);return m.status==="completed"?`${o("queue.completedIn")} ${g}${g===1?"":"s"}`:`${g}s`},[m,o]);return a.jsxs(L,{layerStyle:"third",flexDir:"column",p:2,pt:0,borderRadius:"base",gap:2,children:[a.jsxs(L,{layerStyle:"second",p:2,gap:2,justifyContent:"space-between",alignItems:"center",borderRadius:"base",h:20,children:[a.jsx(Ap,{label:o("queue.status"),data:h}),a.jsx(Ap,{label:o("queue.item"),data:r}),a.jsx(Ap,{label:o("queue.batch"),data:n}),a.jsx(Ap,{label:o("queue.session"),data:t}),a.jsxs(Vt,{size:"xs",orientation:"vertical",children:[a.jsx(at,{onClick:u,isLoading:p,isDisabled:m?["canceled","completed","failed"].includes(m.status):!0,"aria-label":o("queue.cancelItem"),icon:a.jsx(Ic,{}),colorScheme:"error",children:o("queue.cancelItem")}),a.jsx(at,{onClick:s,isLoading:i,isDisabled:l,"aria-label":o("queue.cancelBatch"),icon:a.jsx(Ic,{}),colorScheme:"error",children:o("queue.cancelBatch")})]})]}),(m==null?void 0:m.error)&&a.jsxs(L,{layerStyle:"second",p:3,gap:1,justifyContent:"space-between",alignItems:"flex-start",borderRadius:"base",flexDir:"column",children:[a.jsx(cr,{size:"sm",color:"error.500",_dark:{color:"error.400"},children:"Error"}),a.jsx("pre",{children:m.error})]}),a.jsx(L,{layerStyle:"second",h:512,w:"full",borderRadius:"base",alignItems:"center",justifyContent:"center",children:m?a.jsx(Zd,{children:a.jsx(Ya,{label:"Queue Item",data:m})}):a.jsx(fa,{opacity:.5})})]})},zhe=d.memo(Lhe),Ap=({label:e,data:t})=>a.jsxs(L,{flexDir:"column",justifyContent:"flex-start",p:1,gap:1,overflow:"hidden",h:"full",w:"full",children:[a.jsx(cr,{size:"md",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",children:e}),a.jsx(ve,{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",children:t})]}),vs={number:"3rem",statusBadge:"5.7rem",statusDot:2,time:"4rem",batchId:"5rem",fieldValues:"auto",actions:"auto"},R_={bg:"base.300",_dark:{bg:"base.750"}},Fhe={_hover:R_,"&[aria-selected='true']":R_},Bhe=({index:e,item:t,context:n})=>{const{t:r}=Z(),o=d.useCallback(()=>{n.toggleQueueItem(t.item_id)},[n,t.item_id]),{cancelQueueItem:s,isLoading:i}=d7(t.item_id),l=d.useCallback(h=>{h.stopPropagation(),s()},[s]),u=d.useMemo(()=>n.openQueueItems.includes(t.item_id),[n.openQueueItems,t.item_id]),p=d.useMemo(()=>!t.completed_at||!t.started_at?void 0:`${f7(t.started_at,t.completed_at)}s`,[t]),m=d.useMemo(()=>["canceled","completed","failed"].includes(t.status),[t.status]);return a.jsxs(L,{flexDir:"column","aria-selected":u,fontSize:"sm",borderRadius:"base",justifyContent:"center",sx:Fhe,"data-testid":"queue-item",children:[a.jsxs(L,{minH:9,alignItems:"center",gap:4,p:1.5,cursor:"pointer",onClick:o,children:[a.jsx(L,{w:vs.number,justifyContent:"flex-end",alignItems:"center",flexShrink:0,children:a.jsx(ve,{variant:"subtext",children:e+1})}),a.jsx(L,{w:vs.statusBadge,alignItems:"center",flexShrink:0,children:a.jsx(Nhe,{status:t.status})}),a.jsx(L,{w:vs.time,alignItems:"center",flexShrink:0,children:p||"-"}),a.jsx(L,{w:vs.batchId,flexShrink:0,children:a.jsx(ve,{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",alignItems:"center",children:t.batch_id})}),a.jsx(L,{alignItems:"center",overflow:"hidden",flexGrow:1,children:t.field_values&&a.jsx(L,{gap:2,w:"full",whiteSpace:"nowrap",textOverflow:"ellipsis",overflow:"hidden",children:t.field_values.filter(h=>h.node_path!=="metadata_accumulator").map(({node_path:h,field_name:g,value:x})=>a.jsxs(ve,{as:"span",children:[a.jsxs(ve,{as:"span",fontWeight:600,children:[h,".",g]}),": ",x]},`${t.item_id}.${h}.${g}.${x}`))})}),a.jsx(L,{alignItems:"center",w:vs.actions,pe:3,children:a.jsx(Vt,{size:"xs",variant:"ghost",children:a.jsx(Fe,{onClick:l,isDisabled:m,isLoading:i,"aria-label":r("queue.cancelItem"),icon:a.jsx(Ic,{})})})})]}),a.jsx(Id,{in:u,transition:{enter:{duration:.1},exit:{duration:.1}},unmountOnExit:!0,children:a.jsx(zhe,{queueItemDTO:t})})]})},Hhe=d.memo(Bhe),Vhe=d.memo(ke((e,t)=>a.jsx(L,{...e,ref:t,flexDirection:"column",gap:.5,children:e.children}))),Whe=d.memo(Vhe),Uhe=()=>a.jsxs(L,{alignItems:"center",gap:4,p:1,pb:2,textTransform:"uppercase",fontWeight:700,fontSize:"xs",letterSpacing:1,children:[a.jsx(L,{w:vs.number,justifyContent:"flex-end",alignItems:"center",children:a.jsx(ve,{variant:"subtext",children:"#"})}),a.jsx(L,{ps:.5,w:vs.statusBadge,alignItems:"center",children:a.jsx(ve,{variant:"subtext",children:"status"})}),a.jsx(L,{ps:.5,w:vs.time,alignItems:"center",children:a.jsx(ve,{variant:"subtext",children:"time"})}),a.jsx(L,{ps:.5,w:vs.batchId,alignItems:"center",children:a.jsx(ve,{variant:"subtext",children:"batch"})}),a.jsx(L,{ps:.5,w:vs.fieldValues,alignItems:"center",children:a.jsx(ve,{variant:"subtext",children:"batch field values"})})]}),Ghe=d.memo(Uhe),Khe={defer:!0,options:{scrollbars:{visibility:"auto",autoHide:"scroll",autoHideDelay:1300,theme:"os-theme-dark"},overflow:{x:"hidden"}}},qhe=ce(xe,({queue:e})=>{const{listCursor:t,listPriority:n}=e;return{listCursor:t,listPriority:n}},je),Xhe=(e,t)=>t.item_id,Qhe={List:Whe},Yhe=(e,t,n)=>a.jsx(Hhe,{index:e,item:t,context:n}),Zhe=()=>{const{listCursor:e,listPriority:t}=W(qhe),n=te(),r=d.useRef(null),[o,s]=d.useState(null),[i,l]=Ey(Khe),{t:u}=Z();d.useEffect(()=>{const{current:S}=r;return o&&S&&i({target:S,elements:{viewport:o}}),()=>{var j;return(j=l())==null?void 0:j.destroy()}},[o,i,l]);const{data:p,isLoading:m}=AN({cursor:e,priority:t}),h=d.useMemo(()=>p?TN.getSelectors().selectAll(p):[],[p]),g=d.useCallback(()=>{if(!(p!=null&&p.has_more))return;const S=h[h.length-1];S&&(n(Zx(S.item_id)),n(Jx(S.priority)))},[n,p==null?void 0:p.has_more,h]),[x,y]=d.useState([]),b=d.useCallback(S=>{y(j=>j.includes(S)?j.filter(_=>_!==S):[...j,S])},[]),w=d.useMemo(()=>({openQueueItems:x,toggleQueueItem:b}),[x,b]);return m?a.jsx($ne,{}):h.length?a.jsxs(L,{w:"full",h:"full",flexDir:"column",children:[a.jsx(Ghe,{}),a.jsx(L,{ref:r,w:"full",h:"full",alignItems:"center",justifyContent:"center",children:a.jsx(qre,{data:h,endReached:g,scrollerRef:s,itemContent:Yhe,computeItemKey:Xhe,components:Qhe,context:w})})]}):a.jsx(L,{w:"full",h:"full",alignItems:"center",justifyContent:"center",children:a.jsx(cr,{color:"base.400",_dark:{color:"base.500"},children:u("queue.queueEmpty")})})},Jhe=d.memo(Zhe),ege=()=>{const{data:e}=va(),{t}=Z();return a.jsxs(u7,{"data-testid":"queue-status",children:[a.jsx(hs,{label:t("queue.in_progress"),value:(e==null?void 0:e.queue.in_progress)??0}),a.jsx(hs,{label:t("queue.pending"),value:(e==null?void 0:e.queue.pending)??0}),a.jsx(hs,{label:t("queue.completed"),value:(e==null?void 0:e.queue.completed)??0}),a.jsx(hs,{label:t("queue.failed"),value:(e==null?void 0:e.queue.failed)??0}),a.jsx(hs,{label:t("queue.canceled"),value:(e==null?void 0:e.queue.canceled)??0}),a.jsx(hs,{label:t("queue.total"),value:(e==null?void 0:e.queue.total)??0})]})},tge=d.memo(ege);function nge(e){return Te({tag:"svg",attr:{fill:"currentColor",viewBox:"0 0 16 16"},child:[{tag:"path",attr:{d:"M7.657 6.247c.11-.33.576-.33.686 0l.645 1.937a2.89 2.89 0 0 0 1.829 1.828l1.936.645c.33.11.33.576 0 .686l-1.937.645a2.89 2.89 0 0 0-1.828 1.829l-.645 1.936a.361.361 0 0 1-.686 0l-.645-1.937a2.89 2.89 0 0 0-1.828-1.828l-1.937-.645a.361.361 0 0 1 0-.686l1.937-.645a2.89 2.89 0 0 0 1.828-1.828l.645-1.937zM3.794 1.148a.217.217 0 0 1 .412 0l.387 1.162c.173.518.579.924 1.097 1.097l1.162.387a.217.217 0 0 1 0 .412l-1.162.387A1.734 1.734 0 0 0 4.593 5.69l-.387 1.162a.217.217 0 0 1-.412 0L3.407 5.69A1.734 1.734 0 0 0 2.31 4.593l-1.162-.387a.217.217 0 0 1 0-.412l1.162-.387A1.734 1.734 0 0 0 3.407 2.31l.387-1.162zM10.863.099a.145.145 0 0 1 .274 0l.258.774c.115.346.386.617.732.732l.774.258a.145.145 0 0 1 0 .274l-.774.258a1.156 1.156 0 0 0-.732.732l-.258.774a.145.145 0 0 1-.274 0l-.258-.774a1.156 1.156 0 0 0-.732-.732L9.1 2.137a.145.145 0 0 1 0-.274l.774-.258c.346-.115.617-.386.732-.732L10.863.1z"}}]})(e)}const rge=()=>{const e=te(),{t}=Z(),n=W(u=>u.system.isConnected),[r,{isLoading:o}]=RI({fixedCacheKey:"pruneQueue"}),{finishedCount:s}=va(void 0,{selectFromResult:({data:u})=>u?{finishedCount:u.queue.completed+u.queue.canceled+u.queue.failed}:{finishedCount:0}}),i=d.useCallback(async()=>{if(s)try{const u=await r().unwrap();e(ct({title:t("queue.pruneSucceeded",{item_count:u.deleted}),status:"success"})),e(Zx(void 0)),e(Jx(void 0))}catch{e(ct({title:t("queue.pruneFailed"),status:"error"}))}},[s,r,e,t]),l=d.useMemo(()=>!n||!s,[s,n]);return{pruneQueue:i,isLoading:o,finishedCount:s,isDisabled:l}},oge=({asIconButton:e})=>{const{t}=Z(),{pruneQueue:n,isLoading:r,finishedCount:o,isDisabled:s}=rge();return a.jsx(ul,{isDisabled:s,isLoading:r,asIconButton:e,label:t("queue.prune"),tooltip:t("queue.pruneTooltip",{item_count:o}),icon:a.jsx(nge,{}),onClick:n,colorScheme:"blue"})},sge=d.memo(oge),age=()=>{const e=Bt("pauseQueue").isFeatureEnabled,t=Bt("resumeQueue").isFeatureEnabled;return a.jsxs(L,{layerStyle:"second",borderRadius:"base",p:2,gap:2,children:[e||t?a.jsxs(Vt,{w:28,orientation:"vertical",isAttached:!0,size:"sm",children:[t?a.jsx(X8,{}):a.jsx(a.Fragment,{}),e?a.jsx(V8,{}):a.jsx(a.Fragment,{})]}):a.jsx(a.Fragment,{}),a.jsxs(Vt,{w:28,orientation:"vertical",isAttached:!0,size:"sm",children:[a.jsx(sge,{}),a.jsx(qy,{})]})]})},ige=d.memo(age),lge=()=>{const e=Bt("invocationCache").isFeatureEnabled;return a.jsxs(L,{layerStyle:"first",borderRadius:"base",w:"full",h:"full",p:2,flexDir:"column",gap:2,children:[a.jsxs(L,{gap:2,w:"full",children:[a.jsx(ige,{}),a.jsx(tge,{}),e&&a.jsx(Ahe,{})]}),a.jsx(Ie,{layerStyle:"second",p:2,borderRadius:"base",w:"full",h:"full",children:a.jsx(Jhe,{})})]})},cge=d.memo(lge),uge=()=>a.jsx(cge,{}),dge=d.memo(uge),fge=()=>a.jsx(KO,{}),pge=d.memo(fge);var Ax={exports:{}};(function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.Konva=void 0;var n=Lw;Object.defineProperty(t,"Konva",{enumerable:!0,get:function(){return n.Konva}});const r=Lw;e.exports=r.Konva})(Ax,Ax.exports);var mge=Ax.exports;const gd=xd(mge);var p7={exports:{}};/** * @license React * react-reconciler.production.min.js * @@ -61,17 +61,17 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var gge=function(t){var n={},r=d,o=Tp,s=Object.assign;function i(c){for(var f="https://reactjs.org/docs/error-decoder.html?invariant="+c,v=1;vne||k[z]!==P[ne]){var pe=` `+k[z].replace(" at new "," at ");return c.displayName&&pe.includes("")&&(pe=pe.replace("",c.displayName)),pe}while(1<=z&&0<=ne);break}}}finally{Jc=!1,Error.prepareStackTrace=v}return(c=c?c.displayName||c.name:"")?mi(c):""}var Bg=Object.prototype.hasOwnProperty,_a=[],rt=-1;function Mt(c){return{current:c}}function kt(c){0>rt||(c.current=_a[rt],_a[rt]=null,rt--)}function Ot(c,f){rt++,_a[rt]=c.current,c.current=f}var rr={},rn=Mt(rr),Dn=Mt(!1),gr=rr;function vl(c,f){var v=c.type.contextTypes;if(!v)return rr;var C=c.stateNode;if(C&&C.__reactInternalMemoizedUnmaskedChildContext===f)return C.__reactInternalMemoizedMaskedChildContext;var k={},P;for(P in v)k[P]=f[P];return C&&(c=c.stateNode,c.__reactInternalMemoizedUnmaskedChildContext=f,c.__reactInternalMemoizedMaskedChildContext=k),k}function jr(c){return c=c.childContextTypes,c!=null}function nf(){kt(Dn),kt(rn)}function h2(c,f,v){if(rn.current!==rr)throw Error(i(168));Ot(rn,f),Ot(Dn,v)}function g2(c,f,v){var C=c.stateNode;if(f=f.childContextTypes,typeof C.getChildContext!="function")return v;C=C.getChildContext();for(var k in C)if(!(k in f))throw Error(i(108,D(c)||"Unknown",k));return s({},v,C)}function rf(c){return c=(c=c.stateNode)&&c.__reactInternalMemoizedMergedChildContext||rr,gr=rn.current,Ot(rn,c),Ot(Dn,Dn.current),!0}function v2(c,f,v){var C=c.stateNode;if(!C)throw Error(i(169));v?(c=g2(c,f,gr),C.__reactInternalMemoizedMergedChildContext=c,kt(Dn),kt(rn),Ot(rn,c)):kt(Dn),Ot(Dn,v)}var Oo=Math.clz32?Math.clz32:P7,_7=Math.log,I7=Math.LN2;function P7(c){return c>>>=0,c===0?32:31-(_7(c)/I7|0)|0}var of=64,sf=4194304;function tu(c){switch(c&-c){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 c&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return c&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return c}}function af(c,f){var v=c.pendingLanes;if(v===0)return 0;var C=0,k=c.suspendedLanes,P=c.pingedLanes,z=v&268435455;if(z!==0){var ne=z&~k;ne!==0?C=tu(ne):(P&=z,P!==0&&(C=tu(P)))}else z=v&~k,z!==0?C=tu(z):P!==0&&(C=tu(P));if(C===0)return 0;if(f!==0&&f!==C&&!(f&k)&&(k=C&-C,P=f&-f,k>=P||k===16&&(P&4194240)!==0))return f;if(C&4&&(C|=v&16),f=c.entangledLanes,f!==0)for(c=c.entanglements,f&=C;0v;v++)f.push(c);return f}function nu(c,f,v){c.pendingLanes|=f,f!==536870912&&(c.suspendedLanes=0,c.pingedLanes=0),c=c.eventTimes,f=31-Oo(f),c[f]=v}function O7(c,f){var v=c.pendingLanes&~f;c.pendingLanes=f,c.suspendedLanes=0,c.pingedLanes=0,c.expiredLanes&=f,c.mutableReadLanes&=f,c.entangledLanes&=f,f=c.entanglements;var C=c.eventTimes;for(c=c.expirationTimes;0>=z,k-=z,Fs=1<<32-Oo(f)+k|v<$t?(Xn=xt,xt=null):Xn=xt.sibling;var Lt=We(ue,xt,me[$t],Ue);if(Lt===null){xt===null&&(xt=Xn);break}c&&xt&&Lt.alternate===null&&f(ue,xt),oe=P(Lt,oe,$t),Ct===null?it=Lt:Ct.sibling=Lt,Ct=Lt,xt=Xn}if($t===me.length)return v(ue,xt),ln&&gi(ue,$t),it;if(xt===null){for(;$t$t?(Xn=xt,xt=null):Xn=xt.sibling;var Aa=We(ue,xt,Lt.value,Ue);if(Aa===null){xt===null&&(xt=Xn);break}c&&xt&&Aa.alternate===null&&f(ue,xt),oe=P(Aa,oe,$t),Ct===null?it=Aa:Ct.sibling=Aa,Ct=Aa,xt=Xn}if(Lt.done)return v(ue,xt),ln&&gi(ue,$t),it;if(xt===null){for(;!Lt.done;$t++,Lt=me.next())Lt=vt(ue,Lt.value,Ue),Lt!==null&&(oe=P(Lt,oe,$t),Ct===null?it=Lt:Ct.sibling=Lt,Ct=Lt);return ln&&gi(ue,$t),it}for(xt=C(ue,xt);!Lt.done;$t++,Lt=me.next())Lt=sn(xt,ue,$t,Lt.value,Ue),Lt!==null&&(c&&Lt.alternate!==null&&xt.delete(Lt.key===null?$t:Lt.key),oe=P(Lt,oe,$t),Ct===null?it=Lt:Ct.sibling=Lt,Ct=Lt);return c&&xt.forEach(function(gR){return f(ue,gR)}),ln&&gi(ue,$t),it}function Us(ue,oe,me,Ue){if(typeof me=="object"&&me!==null&&me.type===m&&me.key===null&&(me=me.props.children),typeof me=="object"&&me!==null){switch(me.$$typeof){case u:e:{for(var it=me.key,Ct=oe;Ct!==null;){if(Ct.key===it){if(it=me.type,it===m){if(Ct.tag===7){v(ue,Ct.sibling),oe=k(Ct,me.props.children),oe.return=ue,ue=oe;break e}}else if(Ct.elementType===it||typeof it=="object"&&it!==null&&it.$$typeof===_&&N2(it)===Ct.type){v(ue,Ct.sibling),oe=k(Ct,me.props),oe.ref=ou(ue,Ct,me),oe.return=ue,ue=oe;break e}v(ue,Ct);break}else f(ue,Ct);Ct=Ct.sibling}me.type===m?(oe=Si(me.props.children,ue.mode,Ue,me.key),oe.return=ue,ue=oe):(Ue=Uf(me.type,me.key,me.props,null,ue.mode,Ue),Ue.ref=ou(ue,oe,me),Ue.return=ue,ue=Ue)}return z(ue);case p:e:{for(Ct=me.key;oe!==null;){if(oe.key===Ct)if(oe.tag===4&&oe.stateNode.containerInfo===me.containerInfo&&oe.stateNode.implementation===me.implementation){v(ue,oe.sibling),oe=k(oe,me.children||[]),oe.return=ue,ue=oe;break e}else{v(ue,oe);break}else f(ue,oe);oe=oe.sibling}oe=X0(me,ue.mode,Ue),oe.return=ue,ue=oe}return z(ue);case _:return Ct=me._init,Us(ue,oe,Ct(me._payload),Ue)}if(U(me))return Zt(ue,oe,me,Ue);if(M(me))return Er(ue,oe,me,Ue);bf(ue,me)}return typeof me=="string"&&me!==""||typeof me=="number"?(me=""+me,oe!==null&&oe.tag===6?(v(ue,oe.sibling),oe=k(oe,me),oe.return=ue,ue=oe):(v(ue,oe),oe=q0(me,ue.mode,Ue),oe.return=ue,ue=oe),z(ue)):v(ue,oe)}return Us}var Sl=$2(!0),L2=$2(!1),su={},co=Mt(su),au=Mt(su),kl=Mt(su);function ls(c){if(c===su)throw Error(i(174));return c}function l0(c,f){Ot(kl,f),Ot(au,c),Ot(co,su),c=$(f),kt(co),Ot(co,c)}function jl(){kt(co),kt(au),kt(kl)}function z2(c){var f=ls(kl.current),v=ls(co.current);f=q(v,c.type,f),v!==f&&(Ot(au,c),Ot(co,f))}function c0(c){au.current===c&&(kt(co),kt(au))}var vn=Mt(0);function yf(c){for(var f=c;f!==null;){if(f.tag===13){var v=f.memoizedState;if(v!==null&&(v=v.dehydrated,v===null||$s(v)||wa(v)))return f}else if(f.tag===19&&f.memoizedProps.revealOrder!==void 0){if(f.flags&128)return f}else if(f.child!==null){f.child.return=f,f=f.child;continue}if(f===c)break;for(;f.sibling===null;){if(f.return===null||f.return===c)return null;f=f.return}f.sibling.return=f.return,f=f.sibling}return null}var u0=[];function d0(){for(var c=0;cv?v:4,c(!0);var C=f0.transition;f0.transition={};try{c(!1),f()}finally{Nt=v,f0.transition=C}}function rC(){return uo().memoizedState}function V7(c,f,v){var C=Oa(c);if(v={lane:C,action:v,hasEagerState:!1,eagerState:null,next:null},oC(c))sC(f,v);else if(v=P2(c,f,v,C),v!==null){var k=ir();fo(v,c,C,k),aC(v,f,C)}}function W7(c,f,v){var C=Oa(c),k={lane:C,action:v,hasEagerState:!1,eagerState:null,next:null};if(oC(c))sC(f,k);else{var P=c.alternate;if(c.lanes===0&&(P===null||P.lanes===0)&&(P=f.lastRenderedReducer,P!==null))try{var z=f.lastRenderedState,ne=P(z,v);if(k.hasEagerState=!0,k.eagerState=ne,Ro(ne,z)){var pe=f.interleaved;pe===null?(k.next=k,o0(f)):(k.next=pe.next,pe.next=k),f.interleaved=k;return}}catch{}finally{}v=P2(c,f,k,C),v!==null&&(k=ir(),fo(v,c,C,k),aC(v,f,C))}}function oC(c){var f=c.alternate;return c===xn||f!==null&&f===xn}function sC(c,f){iu=wf=!0;var v=c.pending;v===null?f.next=f:(f.next=v.next,v.next=f),c.pending=f}function aC(c,f,v){if(v&4194240){var C=f.lanes;C&=c.pendingLanes,v|=C,f.lanes=v,Wg(c,v)}}var jf={readContext:lo,useCallback:or,useContext:or,useEffect:or,useImperativeHandle:or,useInsertionEffect:or,useLayoutEffect:or,useMemo:or,useReducer:or,useRef:or,useState:or,useDebugValue:or,useDeferredValue:or,useTransition:or,useMutableSource:or,useSyncExternalStore:or,useId:or,unstable_isNewReconciler:!1},U7={readContext:lo,useCallback:function(c,f){return cs().memoizedState=[c,f===void 0?null:f],c},useContext:lo,useEffect:X2,useImperativeHandle:function(c,f,v){return v=v!=null?v.concat([c]):null,Sf(4194308,4,Z2.bind(null,f,c),v)},useLayoutEffect:function(c,f){return Sf(4194308,4,c,f)},useInsertionEffect:function(c,f){return Sf(4,2,c,f)},useMemo:function(c,f){var v=cs();return f=f===void 0?null:f,c=c(),v.memoizedState=[c,f],c},useReducer:function(c,f,v){var C=cs();return f=v!==void 0?v(f):f,C.memoizedState=C.baseState=f,c={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:c,lastRenderedState:f},C.queue=c,c=c.dispatch=V7.bind(null,xn,c),[C.memoizedState,c]},useRef:function(c){var f=cs();return c={current:c},f.memoizedState=c},useState:K2,useDebugValue:b0,useDeferredValue:function(c){return cs().memoizedState=c},useTransition:function(){var c=K2(!1),f=c[0];return c=H7.bind(null,c[1]),cs().memoizedState=c,[f,c]},useMutableSource:function(){},useSyncExternalStore:function(c,f,v){var C=xn,k=cs();if(ln){if(v===void 0)throw Error(i(407));v=v()}else{if(v=f(),qn===null)throw Error(i(349));xi&30||H2(C,f,v)}k.memoizedState=v;var P={value:v,getSnapshot:f};return k.queue=P,X2(W2.bind(null,C,P,c),[c]),C.flags|=2048,uu(9,V2.bind(null,C,P,v,f),void 0,null),v},useId:function(){var c=cs(),f=qn.identifierPrefix;if(ln){var v=Bs,C=Fs;v=(C&~(1<<32-Oo(C)-1)).toString(32)+v,f=":"+f+"R"+v,v=lu++,0F0&&(f.flags|=128,C=!0,pu(k,!1),f.lanes=4194304)}else{if(!C)if(c=yf(P),c!==null){if(f.flags|=128,C=!0,c=c.updateQueue,c!==null&&(f.updateQueue=c,f.flags|=4),pu(k,!0),k.tail===null&&k.tailMode==="hidden"&&!P.alternate&&!ln)return sr(f),null}else 2*Gn()-k.renderingStartTime>F0&&v!==1073741824&&(f.flags|=128,C=!0,pu(k,!1),f.lanes=4194304);k.isBackwards?(P.sibling=f.child,f.child=P):(c=k.last,c!==null?c.sibling=P:f.child=P,k.last=P)}return k.tail!==null?(f=k.tail,k.rendering=f,k.tail=f.sibling,k.renderingStartTime=Gn(),f.sibling=null,c=vn.current,Ot(vn,C?c&1|2:c&1),f):(sr(f),null);case 22:case 23:return U0(),v=f.memoizedState!==null,c!==null&&c.memoizedState!==null!==v&&(f.flags|=8192),v&&f.mode&1?Gr&1073741824&&(sr(f),de&&f.subtreeFlags&6&&(f.flags|=8192)):sr(f),null;case 24:return null;case 25:return null}throw Error(i(156,f.tag))}function J7(c,f){switch(Qg(f),f.tag){case 1:return jr(f.type)&&nf(),c=f.flags,c&65536?(f.flags=c&-65537|128,f):null;case 3:return jl(),kt(Dn),kt(rn),d0(),c=f.flags,c&65536&&!(c&128)?(f.flags=c&-65537|128,f):null;case 5:return c0(f),null;case 13:if(kt(vn),c=f.memoizedState,c!==null&&c.dehydrated!==null){if(f.alternate===null)throw Error(i(340));yl()}return c=f.flags,c&65536?(f.flags=c&-65537|128,f):null;case 19:return kt(vn),null;case 4:return jl(),null;case 10:return n0(f.type._context),null;case 22:case 23:return U0(),null;case 24:return null;default:return null}}var Mf=!1,ar=!1,eR=typeof WeakSet=="function"?WeakSet:Set,Ke=null;function Il(c,f){var v=c.ref;if(v!==null)if(typeof v=="function")try{v(null)}catch(C){cn(c,f,C)}else v.current=null}function P0(c,f,v){try{v()}catch(C){cn(c,f,C)}}var jC=!1;function tR(c,f){for(F(c.containerInfo),Ke=f;Ke!==null;)if(c=Ke,f=c.child,(c.subtreeFlags&1028)!==0&&f!==null)f.return=c,Ke=f;else for(;Ke!==null;){c=Ke;try{var v=c.alternate;if(c.flags&1024)switch(c.tag){case 0:case 11:case 15:break;case 1:if(v!==null){var C=v.memoizedProps,k=v.memoizedState,P=c.stateNode,z=P.getSnapshotBeforeUpdate(c.elementType===c.type?C:Ao(c.type,C),k);P.__reactInternalSnapshotBeforeUpdate=z}break;case 3:de&&At(c.stateNode.containerInfo);break;case 5:case 6:case 4:case 17:break;default:throw Error(i(163))}}catch(ne){cn(c,c.return,ne)}if(f=c.sibling,f!==null){f.return=c.return,Ke=f;break}Ke=c.return}return v=jC,jC=!1,v}function mu(c,f,v){var C=f.updateQueue;if(C=C!==null?C.lastEffect:null,C!==null){var k=C=C.next;do{if((k.tag&c)===c){var P=k.destroy;k.destroy=void 0,P!==void 0&&P0(f,v,P)}k=k.next}while(k!==C)}}function Of(c,f){if(f=f.updateQueue,f=f!==null?f.lastEffect:null,f!==null){var v=f=f.next;do{if((v.tag&c)===c){var C=v.create;v.destroy=C()}v=v.next}while(v!==f)}}function E0(c){var f=c.ref;if(f!==null){var v=c.stateNode;switch(c.tag){case 5:c=N(v);break;default:c=v}typeof f=="function"?f(c):f.current=c}}function _C(c){var f=c.alternate;f!==null&&(c.alternate=null,_C(f)),c.child=null,c.deletions=null,c.sibling=null,c.tag===5&&(f=c.stateNode,f!==null&&_e(f)),c.stateNode=null,c.return=null,c.dependencies=null,c.memoizedProps=null,c.memoizedState=null,c.pendingProps=null,c.stateNode=null,c.updateQueue=null}function IC(c){return c.tag===5||c.tag===3||c.tag===4}function PC(c){e:for(;;){for(;c.sibling===null;){if(c.return===null||IC(c.return))return null;c=c.return}for(c.sibling.return=c.return,c=c.sibling;c.tag!==5&&c.tag!==6&&c.tag!==18;){if(c.flags&2||c.child===null||c.tag===4)continue e;c.child.return=c,c=c.child}if(!(c.flags&2))return c.stateNode}}function M0(c,f,v){var C=c.tag;if(C===5||C===6)c=c.stateNode,f?Ut(v,c,f):Je(v,c);else if(C!==4&&(c=c.child,c!==null))for(M0(c,f,v),c=c.sibling;c!==null;)M0(c,f,v),c=c.sibling}function O0(c,f,v){var C=c.tag;if(C===5||C===6)c=c.stateNode,f?Le(v,c,f):be(v,c);else if(C!==4&&(c=c.child,c!==null))for(O0(c,f,v),c=c.sibling;c!==null;)O0(c,f,v),c=c.sibling}var er=null,To=!1;function ds(c,f,v){for(v=v.child;v!==null;)R0(c,f,v),v=v.sibling}function R0(c,f,v){if(ss&&typeof ss.onCommitFiberUnmount=="function")try{ss.onCommitFiberUnmount(lf,v)}catch{}switch(v.tag){case 5:ar||Il(v,f);case 6:if(de){var C=er,k=To;er=null,ds(c,f,v),er=C,To=k,er!==null&&(To?Be(er,v.stateNode):ke(er,v.stateNode))}else ds(c,f,v);break;case 18:de&&er!==null&&(To?Fn(er,v.stateNode):Fg(er,v.stateNode));break;case 4:de?(C=er,k=To,er=v.stateNode.containerInfo,To=!0,ds(c,f,v),er=C,To=k):(ge&&(C=v.stateNode.containerInfo,k=Ln(C),an(C,k)),ds(c,f,v));break;case 0:case 11:case 14:case 15:if(!ar&&(C=v.updateQueue,C!==null&&(C=C.lastEffect,C!==null))){k=C=C.next;do{var P=k,z=P.destroy;P=P.tag,z!==void 0&&(P&2||P&4)&&P0(v,f,z),k=k.next}while(k!==C)}ds(c,f,v);break;case 1:if(!ar&&(Il(v,f),C=v.stateNode,typeof C.componentWillUnmount=="function"))try{C.props=v.memoizedProps,C.state=v.memoizedState,C.componentWillUnmount()}catch(ne){cn(v,f,ne)}ds(c,f,v);break;case 21:ds(c,f,v);break;case 22:v.mode&1?(ar=(C=ar)||v.memoizedState!==null,ds(c,f,v),ar=C):ds(c,f,v);break;default:ds(c,f,v)}}function EC(c){var f=c.updateQueue;if(f!==null){c.updateQueue=null;var v=c.stateNode;v===null&&(v=c.stateNode=new eR),f.forEach(function(C){var k=uR.bind(null,c,C);v.has(C)||(v.add(C),C.then(k,k))})}}function No(c,f){var v=f.deletions;if(v!==null)for(var C=0;C";case Df:return":has("+(T0(c)||"")+")";case Af:return'[role="'+c.value+'"]';case Nf:return'"'+c.value+'"';case Tf:return'[data-testname="'+c.value+'"]';default:throw Error(i(365))}}function TC(c,f){var v=[];c=[c,0];for(var C=0;Ck&&(k=z),C&=~P}if(C=k,C=Gn()-C,C=(120>C?120:480>C?480:1080>C?1080:1920>C?1920:3e3>C?3e3:4320>C?4320:1960*rR(C/1960))-C,10c?16:c,Ma===null)var C=!1;else{if(c=Ma,Ma=null,Bf=0,jt&6)throw Error(i(331));var k=jt;for(jt|=4,Ke=c.current;Ke!==null;){var P=Ke,z=P.child;if(Ke.flags&16){var ne=P.deletions;if(ne!==null){for(var pe=0;peGn()-z0?yi(c,0):L0|=v),Pr(c,f)}function WC(c,f){f===0&&(c.mode&1?(f=sf,sf<<=1,!(sf&130023424)&&(sf=4194304)):f=1);var v=ir();c=is(c,f),c!==null&&(nu(c,f,v),Pr(c,v))}function cR(c){var f=c.memoizedState,v=0;f!==null&&(v=f.retryLane),WC(c,v)}function uR(c,f){var v=0;switch(c.tag){case 13:var C=c.stateNode,k=c.memoizedState;k!==null&&(v=k.retryLane);break;case 19:C=c.stateNode;break;default:throw Error(i(314))}C!==null&&C.delete(f),WC(c,v)}var UC;UC=function(c,f,v){if(c!==null)if(c.memoizedProps!==f.pendingProps||Dn.current)_r=!0;else{if(!(c.lanes&v)&&!(f.flags&128))return _r=!1,Y7(c,f,v);_r=!!(c.flags&131072)}else _r=!1,ln&&f.flags&1048576&&w2(f,df,f.index);switch(f.lanes=0,f.tag){case 2:var C=f.type;If(c,f),c=f.pendingProps;var k=vl(f,rn.current);wl(f,v),k=m0(null,f,C,c,k,v);var P=h0();return f.flags|=1,typeof k=="object"&&k!==null&&typeof k.render=="function"&&k.$$typeof===void 0?(f.tag=1,f.memoizedState=null,f.updateQueue=null,jr(C)?(P=!0,rf(f)):P=!1,f.memoizedState=k.state!==null&&k.state!==void 0?k.state:null,s0(f),k.updater=xf,f.stateNode=k,k._reactInternals=f,i0(f,C,c,v),f=S0(null,f,C,!0,P,v)):(f.tag=0,ln&&P&&Xg(f),vr(null,f,k,v),f=f.child),f;case 16:C=f.elementType;e:{switch(If(c,f),c=f.pendingProps,k=C._init,C=k(C._payload),f.type=C,k=f.tag=fR(C),c=Ao(C,c),k){case 0:f=w0(null,f,C,c,v);break e;case 1:f=vC(null,f,C,c,v);break e;case 11:f=fC(null,f,C,c,v);break e;case 14:f=pC(null,f,C,Ao(C.type,c),v);break e}throw Error(i(306,C,""))}return f;case 0:return C=f.type,k=f.pendingProps,k=f.elementType===C?k:Ao(C,k),w0(c,f,C,k,v);case 1:return C=f.type,k=f.pendingProps,k=f.elementType===C?k:Ao(C,k),vC(c,f,C,k,v);case 3:e:{if(xC(f),c===null)throw Error(i(387));C=f.pendingProps,P=f.memoizedState,k=P.element,E2(c,f),vf(f,C,null,v);var z=f.memoizedState;if(C=z.element,Ce&&P.isDehydrated)if(P={element:C,isDehydrated:!1,cache:z.cache,pendingSuspenseBoundaries:z.pendingSuspenseBoundaries,transitions:z.transitions},f.updateQueue.baseState=P,f.memoizedState=P,f.flags&256){k=_l(Error(i(423)),f),f=bC(c,f,C,v,k);break e}else if(C!==k){k=_l(Error(i(424)),f),f=bC(c,f,C,v,k);break e}else for(Ce&&(io=Qe(f.stateNode.containerInfo),Ur=f,ln=!0,Do=null,ru=!1),v=L2(f,null,C,v),f.child=v;v;)v.flags=v.flags&-3|4096,v=v.sibling;else{if(yl(),C===k){f=Vs(c,f,v);break e}vr(c,f,C,v)}f=f.child}return f;case 5:return z2(f),c===null&&Zg(f),C=f.type,k=f.pendingProps,P=c!==null?c.memoizedProps:null,z=k.children,G(C,k)?z=null:P!==null&&G(C,P)&&(f.flags|=32),gC(c,f),vr(c,f,z,v),f.child;case 6:return c===null&&Zg(f),null;case 13:return yC(c,f,v);case 4:return l0(f,f.stateNode.containerInfo),C=f.pendingProps,c===null?f.child=Sl(f,null,C,v):vr(c,f,C,v),f.child;case 11:return C=f.type,k=f.pendingProps,k=f.elementType===C?k:Ao(C,k),fC(c,f,C,k,v);case 7:return vr(c,f,f.pendingProps,v),f.child;case 8:return vr(c,f,f.pendingProps.children,v),f.child;case 12:return vr(c,f,f.pendingProps.children,v),f.child;case 10:e:{if(C=f.type._context,k=f.pendingProps,P=f.memoizedProps,z=k.value,I2(f,C,z),P!==null)if(Ro(P.value,z)){if(P.children===k.children&&!Dn.current){f=Vs(c,f,v);break e}}else for(P=f.child,P!==null&&(P.return=f);P!==null;){var ne=P.dependencies;if(ne!==null){z=P.child;for(var pe=ne.firstContext;pe!==null;){if(pe.context===C){if(P.tag===1){pe=Hs(-1,v&-v),pe.tag=2;var Ee=P.updateQueue;if(Ee!==null){Ee=Ee.shared;var qe=Ee.pending;qe===null?pe.next=pe:(pe.next=qe.next,qe.next=pe),Ee.pending=pe}}P.lanes|=v,pe=P.alternate,pe!==null&&(pe.lanes|=v),r0(P.return,v,f),ne.lanes|=v;break}pe=pe.next}}else if(P.tag===10)z=P.type===f.type?null:P.child;else if(P.tag===18){if(z=P.return,z===null)throw Error(i(341));z.lanes|=v,ne=z.alternate,ne!==null&&(ne.lanes|=v),r0(z,v,f),z=P.sibling}else z=P.child;if(z!==null)z.return=P;else for(z=P;z!==null;){if(z===f){z=null;break}if(P=z.sibling,P!==null){P.return=z.return,z=P;break}z=z.return}P=z}vr(c,f,k.children,v),f=f.child}return f;case 9:return k=f.type,C=f.pendingProps.children,wl(f,v),k=lo(k),C=C(k),f.flags|=1,vr(c,f,C,v),f.child;case 14:return C=f.type,k=Ao(C,f.pendingProps),k=Ao(C.type,k),pC(c,f,C,k,v);case 15:return mC(c,f,f.type,f.pendingProps,v);case 17:return C=f.type,k=f.pendingProps,k=f.elementType===C?k:Ao(C,k),If(c,f),f.tag=1,jr(C)?(c=!0,rf(f)):c=!1,wl(f,v),A2(f,C,k),i0(f,C,k,v),S0(null,f,C,!0,c,v);case 19:return wC(c,f,v);case 22:return hC(c,f,v)}throw Error(i(156,f.tag))};function GC(c,f){return Ug(c,f)}function dR(c,f,v,C){this.tag=c,this.key=v,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=C,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function po(c,f,v,C){return new dR(c,f,v,C)}function K0(c){return c=c.prototype,!(!c||!c.isReactComponent)}function fR(c){if(typeof c=="function")return K0(c)?1:0;if(c!=null){if(c=c.$$typeof,c===b)return 11;if(c===j)return 14}return 2}function Da(c,f){var v=c.alternate;return v===null?(v=po(c.tag,f,c.key,c.mode),v.elementType=c.elementType,v.type=c.type,v.stateNode=c.stateNode,v.alternate=c,c.alternate=v):(v.pendingProps=f,v.type=c.type,v.flags=0,v.subtreeFlags=0,v.deletions=null),v.flags=c.flags&14680064,v.childLanes=c.childLanes,v.lanes=c.lanes,v.child=c.child,v.memoizedProps=c.memoizedProps,v.memoizedState=c.memoizedState,v.updateQueue=c.updateQueue,f=c.dependencies,v.dependencies=f===null?null:{lanes:f.lanes,firstContext:f.firstContext},v.sibling=c.sibling,v.index=c.index,v.ref=c.ref,v}function Uf(c,f,v,C,k,P){var z=2;if(C=c,typeof c=="function")K0(c)&&(z=1);else if(typeof c=="string")z=5;else e:switch(c){case m:return Si(v.children,k,P,f);case h:z=8,k|=8;break;case g:return c=po(12,v,f,k|2),c.elementType=g,c.lanes=P,c;case w:return c=po(13,v,f,k),c.elementType=w,c.lanes=P,c;case S:return c=po(19,v,f,k),c.elementType=S,c.lanes=P,c;case E:return Gf(v,k,P,f);default:if(typeof c=="object"&&c!==null)switch(c.$$typeof){case x:z=10;break e;case y:z=9;break e;case b:z=11;break e;case j:z=14;break e;case _:z=16,C=null;break e}throw Error(i(130,c==null?c:typeof c,""))}return f=po(z,v,f,k),f.elementType=c,f.type=C,f.lanes=P,f}function Si(c,f,v,C){return c=po(7,c,C,f),c.lanes=v,c}function Gf(c,f,v,C){return c=po(22,c,C,f),c.elementType=E,c.lanes=v,c.stateNode={isHidden:!1},c}function q0(c,f,v){return c=po(6,c,null,f),c.lanes=v,c}function X0(c,f,v){return f=po(4,c.children!==null?c.children:[],c.key,f),f.lanes=v,f.stateNode={containerInfo:c.containerInfo,pendingChildren:null,implementation:c.implementation},f}function pR(c,f,v,C,k){this.tag=f,this.containerInfo=c,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=J,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Vg(0),this.expirationTimes=Vg(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Vg(0),this.identifierPrefix=C,this.onRecoverableError=k,Ce&&(this.mutableSourceEagerHydrationData=null)}function KC(c,f,v,C,k,P,z,ne,pe){return c=new pR(c,f,v,ne,pe),f===1?(f=1,P===!0&&(f|=8)):f=0,P=po(3,null,null,f),c.current=P,P.stateNode=c,P.memoizedState={element:C,isDehydrated:v,cache:null,transitions:null,pendingSuspenseBoundaries:null},s0(P),c}function qC(c){if(!c)return rr;c=c._reactInternals;e:{if(A(c)!==c||c.tag!==1)throw Error(i(170));var f=c;do{switch(f.tag){case 3:f=f.stateNode.context;break e;case 1:if(jr(f.type)){f=f.stateNode.__reactInternalMemoizedMergedChildContext;break e}}f=f.return}while(f!==null);throw Error(i(171))}if(c.tag===1){var v=c.type;if(jr(v))return g2(c,v,f)}return f}function XC(c){var f=c._reactInternals;if(f===void 0)throw typeof c.render=="function"?Error(i(188)):(c=Object.keys(c).join(","),Error(i(268,c)));return c=X(f),c===null?null:c.stateNode}function QC(c,f){if(c=c.memoizedState,c!==null&&c.dehydrated!==null){var v=c.retryLane;c.retryLane=v!==0&&v=Ee&&P>=vt&&k<=qe&&z<=We){c.splice(f,1);break}else if(C!==Ee||v.width!==pe.width||Wez){if(!(P!==vt||v.height!==pe.height||qek)){Ee>C&&(pe.width+=Ee-C,pe.x=C),qeP&&(pe.height+=vt-P,pe.y=P),Wev&&(v=z)),zF0&&(f.flags|=128,C=!0,pu(k,!1),f.lanes=4194304)}else{if(!C)if(c=yf(P),c!==null){if(f.flags|=128,C=!0,c=c.updateQueue,c!==null&&(f.updateQueue=c,f.flags|=4),pu(k,!0),k.tail===null&&k.tailMode==="hidden"&&!P.alternate&&!ln)return sr(f),null}else 2*Gn()-k.renderingStartTime>F0&&v!==1073741824&&(f.flags|=128,C=!0,pu(k,!1),f.lanes=4194304);k.isBackwards?(P.sibling=f.child,f.child=P):(c=k.last,c!==null?c.sibling=P:f.child=P,k.last=P)}return k.tail!==null?(f=k.tail,k.rendering=f,k.tail=f.sibling,k.renderingStartTime=Gn(),f.sibling=null,c=vn.current,Ot(vn,C?c&1|2:c&1),f):(sr(f),null);case 22:case 23:return U0(),v=f.memoizedState!==null,c!==null&&c.memoizedState!==null!==v&&(f.flags|=8192),v&&f.mode&1?Gr&1073741824&&(sr(f),de&&f.subtreeFlags&6&&(f.flags|=8192)):sr(f),null;case 24:return null;case 25:return null}throw Error(i(156,f.tag))}function J7(c,f){switch(Qg(f),f.tag){case 1:return jr(f.type)&&nf(),c=f.flags,c&65536?(f.flags=c&-65537|128,f):null;case 3:return jl(),kt(Dn),kt(rn),d0(),c=f.flags,c&65536&&!(c&128)?(f.flags=c&-65537|128,f):null;case 5:return c0(f),null;case 13:if(kt(vn),c=f.memoizedState,c!==null&&c.dehydrated!==null){if(f.alternate===null)throw Error(i(340));yl()}return c=f.flags,c&65536?(f.flags=c&-65537|128,f):null;case 19:return kt(vn),null;case 4:return jl(),null;case 10:return n0(f.type._context),null;case 22:case 23:return U0(),null;case 24:return null;default:return null}}var Mf=!1,ar=!1,eR=typeof WeakSet=="function"?WeakSet:Set,Ke=null;function Il(c,f){var v=c.ref;if(v!==null)if(typeof v=="function")try{v(null)}catch(C){cn(c,f,C)}else v.current=null}function P0(c,f,v){try{v()}catch(C){cn(c,f,C)}}var jC=!1;function tR(c,f){for(F(c.containerInfo),Ke=f;Ke!==null;)if(c=Ke,f=c.child,(c.subtreeFlags&1028)!==0&&f!==null)f.return=c,Ke=f;else for(;Ke!==null;){c=Ke;try{var v=c.alternate;if(c.flags&1024)switch(c.tag){case 0:case 11:case 15:break;case 1:if(v!==null){var C=v.memoizedProps,k=v.memoizedState,P=c.stateNode,z=P.getSnapshotBeforeUpdate(c.elementType===c.type?C:Ao(c.type,C),k);P.__reactInternalSnapshotBeforeUpdate=z}break;case 3:de&&At(c.stateNode.containerInfo);break;case 5:case 6:case 4:case 17:break;default:throw Error(i(163))}}catch(ne){cn(c,c.return,ne)}if(f=c.sibling,f!==null){f.return=c.return,Ke=f;break}Ke=c.return}return v=jC,jC=!1,v}function mu(c,f,v){var C=f.updateQueue;if(C=C!==null?C.lastEffect:null,C!==null){var k=C=C.next;do{if((k.tag&c)===c){var P=k.destroy;k.destroy=void 0,P!==void 0&&P0(f,v,P)}k=k.next}while(k!==C)}}function Of(c,f){if(f=f.updateQueue,f=f!==null?f.lastEffect:null,f!==null){var v=f=f.next;do{if((v.tag&c)===c){var C=v.create;v.destroy=C()}v=v.next}while(v!==f)}}function E0(c){var f=c.ref;if(f!==null){var v=c.stateNode;switch(c.tag){case 5:c=N(v);break;default:c=v}typeof f=="function"?f(c):f.current=c}}function _C(c){var f=c.alternate;f!==null&&(c.alternate=null,_C(f)),c.child=null,c.deletions=null,c.sibling=null,c.tag===5&&(f=c.stateNode,f!==null&&_e(f)),c.stateNode=null,c.return=null,c.dependencies=null,c.memoizedProps=null,c.memoizedState=null,c.pendingProps=null,c.stateNode=null,c.updateQueue=null}function IC(c){return c.tag===5||c.tag===3||c.tag===4}function PC(c){e:for(;;){for(;c.sibling===null;){if(c.return===null||IC(c.return))return null;c=c.return}for(c.sibling.return=c.return,c=c.sibling;c.tag!==5&&c.tag!==6&&c.tag!==18;){if(c.flags&2||c.child===null||c.tag===4)continue e;c.child.return=c,c=c.child}if(!(c.flags&2))return c.stateNode}}function M0(c,f,v){var C=c.tag;if(C===5||C===6)c=c.stateNode,f?Ut(v,c,f):Je(v,c);else if(C!==4&&(c=c.child,c!==null))for(M0(c,f,v),c=c.sibling;c!==null;)M0(c,f,v),c=c.sibling}function O0(c,f,v){var C=c.tag;if(C===5||C===6)c=c.stateNode,f?Le(v,c,f):be(v,c);else if(C!==4&&(c=c.child,c!==null))for(O0(c,f,v),c=c.sibling;c!==null;)O0(c,f,v),c=c.sibling}var er=null,To=!1;function ds(c,f,v){for(v=v.child;v!==null;)R0(c,f,v),v=v.sibling}function R0(c,f,v){if(ss&&typeof ss.onCommitFiberUnmount=="function")try{ss.onCommitFiberUnmount(lf,v)}catch{}switch(v.tag){case 5:ar||Il(v,f);case 6:if(de){var C=er,k=To;er=null,ds(c,f,v),er=C,To=k,er!==null&&(To?Be(er,v.stateNode):Se(er,v.stateNode))}else ds(c,f,v);break;case 18:de&&er!==null&&(To?Fn(er,v.stateNode):Fg(er,v.stateNode));break;case 4:de?(C=er,k=To,er=v.stateNode.containerInfo,To=!0,ds(c,f,v),er=C,To=k):(ge&&(C=v.stateNode.containerInfo,k=Ln(C),an(C,k)),ds(c,f,v));break;case 0:case 11:case 14:case 15:if(!ar&&(C=v.updateQueue,C!==null&&(C=C.lastEffect,C!==null))){k=C=C.next;do{var P=k,z=P.destroy;P=P.tag,z!==void 0&&(P&2||P&4)&&P0(v,f,z),k=k.next}while(k!==C)}ds(c,f,v);break;case 1:if(!ar&&(Il(v,f),C=v.stateNode,typeof C.componentWillUnmount=="function"))try{C.props=v.memoizedProps,C.state=v.memoizedState,C.componentWillUnmount()}catch(ne){cn(v,f,ne)}ds(c,f,v);break;case 21:ds(c,f,v);break;case 22:v.mode&1?(ar=(C=ar)||v.memoizedState!==null,ds(c,f,v),ar=C):ds(c,f,v);break;default:ds(c,f,v)}}function EC(c){var f=c.updateQueue;if(f!==null){c.updateQueue=null;var v=c.stateNode;v===null&&(v=c.stateNode=new eR),f.forEach(function(C){var k=uR.bind(null,c,C);v.has(C)||(v.add(C),C.then(k,k))})}}function No(c,f){var v=f.deletions;if(v!==null)for(var C=0;C";case Df:return":has("+(T0(c)||"")+")";case Af:return'[role="'+c.value+'"]';case Nf:return'"'+c.value+'"';case Tf:return'[data-testname="'+c.value+'"]';default:throw Error(i(365))}}function TC(c,f){var v=[];c=[c,0];for(var C=0;Ck&&(k=z),C&=~P}if(C=k,C=Gn()-C,C=(120>C?120:480>C?480:1080>C?1080:1920>C?1920:3e3>C?3e3:4320>C?4320:1960*rR(C/1960))-C,10c?16:c,Ma===null)var C=!1;else{if(c=Ma,Ma=null,Bf=0,jt&6)throw Error(i(331));var k=jt;for(jt|=4,Ke=c.current;Ke!==null;){var P=Ke,z=P.child;if(Ke.flags&16){var ne=P.deletions;if(ne!==null){for(var pe=0;peGn()-z0?yi(c,0):L0|=v),Pr(c,f)}function WC(c,f){f===0&&(c.mode&1?(f=sf,sf<<=1,!(sf&130023424)&&(sf=4194304)):f=1);var v=ir();c=is(c,f),c!==null&&(nu(c,f,v),Pr(c,v))}function cR(c){var f=c.memoizedState,v=0;f!==null&&(v=f.retryLane),WC(c,v)}function uR(c,f){var v=0;switch(c.tag){case 13:var C=c.stateNode,k=c.memoizedState;k!==null&&(v=k.retryLane);break;case 19:C=c.stateNode;break;default:throw Error(i(314))}C!==null&&C.delete(f),WC(c,v)}var UC;UC=function(c,f,v){if(c!==null)if(c.memoizedProps!==f.pendingProps||Dn.current)_r=!0;else{if(!(c.lanes&v)&&!(f.flags&128))return _r=!1,Y7(c,f,v);_r=!!(c.flags&131072)}else _r=!1,ln&&f.flags&1048576&&w2(f,df,f.index);switch(f.lanes=0,f.tag){case 2:var C=f.type;If(c,f),c=f.pendingProps;var k=vl(f,rn.current);wl(f,v),k=m0(null,f,C,c,k,v);var P=h0();return f.flags|=1,typeof k=="object"&&k!==null&&typeof k.render=="function"&&k.$$typeof===void 0?(f.tag=1,f.memoizedState=null,f.updateQueue=null,jr(C)?(P=!0,rf(f)):P=!1,f.memoizedState=k.state!==null&&k.state!==void 0?k.state:null,s0(f),k.updater=xf,f.stateNode=k,k._reactInternals=f,i0(f,C,c,v),f=S0(null,f,C,!0,P,v)):(f.tag=0,ln&&P&&Xg(f),vr(null,f,k,v),f=f.child),f;case 16:C=f.elementType;e:{switch(If(c,f),c=f.pendingProps,k=C._init,C=k(C._payload),f.type=C,k=f.tag=fR(C),c=Ao(C,c),k){case 0:f=w0(null,f,C,c,v);break e;case 1:f=vC(null,f,C,c,v);break e;case 11:f=fC(null,f,C,c,v);break e;case 14:f=pC(null,f,C,Ao(C.type,c),v);break e}throw Error(i(306,C,""))}return f;case 0:return C=f.type,k=f.pendingProps,k=f.elementType===C?k:Ao(C,k),w0(c,f,C,k,v);case 1:return C=f.type,k=f.pendingProps,k=f.elementType===C?k:Ao(C,k),vC(c,f,C,k,v);case 3:e:{if(xC(f),c===null)throw Error(i(387));C=f.pendingProps,P=f.memoizedState,k=P.element,E2(c,f),vf(f,C,null,v);var z=f.memoizedState;if(C=z.element,Ce&&P.isDehydrated)if(P={element:C,isDehydrated:!1,cache:z.cache,pendingSuspenseBoundaries:z.pendingSuspenseBoundaries,transitions:z.transitions},f.updateQueue.baseState=P,f.memoizedState=P,f.flags&256){k=_l(Error(i(423)),f),f=bC(c,f,C,v,k);break e}else if(C!==k){k=_l(Error(i(424)),f),f=bC(c,f,C,v,k);break e}else for(Ce&&(io=Qe(f.stateNode.containerInfo),Ur=f,ln=!0,Do=null,ru=!1),v=L2(f,null,C,v),f.child=v;v;)v.flags=v.flags&-3|4096,v=v.sibling;else{if(yl(),C===k){f=Vs(c,f,v);break e}vr(c,f,C,v)}f=f.child}return f;case 5:return z2(f),c===null&&Zg(f),C=f.type,k=f.pendingProps,P=c!==null?c.memoizedProps:null,z=k.children,G(C,k)?z=null:P!==null&&G(C,P)&&(f.flags|=32),gC(c,f),vr(c,f,z,v),f.child;case 6:return c===null&&Zg(f),null;case 13:return yC(c,f,v);case 4:return l0(f,f.stateNode.containerInfo),C=f.pendingProps,c===null?f.child=Sl(f,null,C,v):vr(c,f,C,v),f.child;case 11:return C=f.type,k=f.pendingProps,k=f.elementType===C?k:Ao(C,k),fC(c,f,C,k,v);case 7:return vr(c,f,f.pendingProps,v),f.child;case 8:return vr(c,f,f.pendingProps.children,v),f.child;case 12:return vr(c,f,f.pendingProps.children,v),f.child;case 10:e:{if(C=f.type._context,k=f.pendingProps,P=f.memoizedProps,z=k.value,I2(f,C,z),P!==null)if(Ro(P.value,z)){if(P.children===k.children&&!Dn.current){f=Vs(c,f,v);break e}}else for(P=f.child,P!==null&&(P.return=f);P!==null;){var ne=P.dependencies;if(ne!==null){z=P.child;for(var pe=ne.firstContext;pe!==null;){if(pe.context===C){if(P.tag===1){pe=Hs(-1,v&-v),pe.tag=2;var Ee=P.updateQueue;if(Ee!==null){Ee=Ee.shared;var qe=Ee.pending;qe===null?pe.next=pe:(pe.next=qe.next,qe.next=pe),Ee.pending=pe}}P.lanes|=v,pe=P.alternate,pe!==null&&(pe.lanes|=v),r0(P.return,v,f),ne.lanes|=v;break}pe=pe.next}}else if(P.tag===10)z=P.type===f.type?null:P.child;else if(P.tag===18){if(z=P.return,z===null)throw Error(i(341));z.lanes|=v,ne=z.alternate,ne!==null&&(ne.lanes|=v),r0(z,v,f),z=P.sibling}else z=P.child;if(z!==null)z.return=P;else for(z=P;z!==null;){if(z===f){z=null;break}if(P=z.sibling,P!==null){P.return=z.return,z=P;break}z=z.return}P=z}vr(c,f,k.children,v),f=f.child}return f;case 9:return k=f.type,C=f.pendingProps.children,wl(f,v),k=lo(k),C=C(k),f.flags|=1,vr(c,f,C,v),f.child;case 14:return C=f.type,k=Ao(C,f.pendingProps),k=Ao(C.type,k),pC(c,f,C,k,v);case 15:return mC(c,f,f.type,f.pendingProps,v);case 17:return C=f.type,k=f.pendingProps,k=f.elementType===C?k:Ao(C,k),If(c,f),f.tag=1,jr(C)?(c=!0,rf(f)):c=!1,wl(f,v),A2(f,C,k),i0(f,C,k,v),S0(null,f,C,!0,c,v);case 19:return wC(c,f,v);case 22:return hC(c,f,v)}throw Error(i(156,f.tag))};function GC(c,f){return Ug(c,f)}function dR(c,f,v,C){this.tag=c,this.key=v,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=C,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function po(c,f,v,C){return new dR(c,f,v,C)}function K0(c){return c=c.prototype,!(!c||!c.isReactComponent)}function fR(c){if(typeof c=="function")return K0(c)?1:0;if(c!=null){if(c=c.$$typeof,c===b)return 11;if(c===j)return 14}return 2}function Da(c,f){var v=c.alternate;return v===null?(v=po(c.tag,f,c.key,c.mode),v.elementType=c.elementType,v.type=c.type,v.stateNode=c.stateNode,v.alternate=c,c.alternate=v):(v.pendingProps=f,v.type=c.type,v.flags=0,v.subtreeFlags=0,v.deletions=null),v.flags=c.flags&14680064,v.childLanes=c.childLanes,v.lanes=c.lanes,v.child=c.child,v.memoizedProps=c.memoizedProps,v.memoizedState=c.memoizedState,v.updateQueue=c.updateQueue,f=c.dependencies,v.dependencies=f===null?null:{lanes:f.lanes,firstContext:f.firstContext},v.sibling=c.sibling,v.index=c.index,v.ref=c.ref,v}function Uf(c,f,v,C,k,P){var z=2;if(C=c,typeof c=="function")K0(c)&&(z=1);else if(typeof c=="string")z=5;else e:switch(c){case m:return Si(v.children,k,P,f);case h:z=8,k|=8;break;case g:return c=po(12,v,f,k|2),c.elementType=g,c.lanes=P,c;case w:return c=po(13,v,f,k),c.elementType=w,c.lanes=P,c;case S:return c=po(19,v,f,k),c.elementType=S,c.lanes=P,c;case E:return Gf(v,k,P,f);default:if(typeof c=="object"&&c!==null)switch(c.$$typeof){case x:z=10;break e;case y:z=9;break e;case b:z=11;break e;case j:z=14;break e;case _:z=16,C=null;break e}throw Error(i(130,c==null?c:typeof c,""))}return f=po(z,v,f,k),f.elementType=c,f.type=C,f.lanes=P,f}function Si(c,f,v,C){return c=po(7,c,C,f),c.lanes=v,c}function Gf(c,f,v,C){return c=po(22,c,C,f),c.elementType=E,c.lanes=v,c.stateNode={isHidden:!1},c}function q0(c,f,v){return c=po(6,c,null,f),c.lanes=v,c}function X0(c,f,v){return f=po(4,c.children!==null?c.children:[],c.key,f),f.lanes=v,f.stateNode={containerInfo:c.containerInfo,pendingChildren:null,implementation:c.implementation},f}function pR(c,f,v,C,k){this.tag=f,this.containerInfo=c,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=J,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Vg(0),this.expirationTimes=Vg(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Vg(0),this.identifierPrefix=C,this.onRecoverableError=k,Ce&&(this.mutableSourceEagerHydrationData=null)}function KC(c,f,v,C,k,P,z,ne,pe){return c=new pR(c,f,v,ne,pe),f===1?(f=1,P===!0&&(f|=8)):f=0,P=po(3,null,null,f),c.current=P,P.stateNode=c,P.memoizedState={element:C,isDehydrated:v,cache:null,transitions:null,pendingSuspenseBoundaries:null},s0(P),c}function qC(c){if(!c)return rr;c=c._reactInternals;e:{if(A(c)!==c||c.tag!==1)throw Error(i(170));var f=c;do{switch(f.tag){case 3:f=f.stateNode.context;break e;case 1:if(jr(f.type)){f=f.stateNode.__reactInternalMemoizedMergedChildContext;break e}}f=f.return}while(f!==null);throw Error(i(171))}if(c.tag===1){var v=c.type;if(jr(v))return g2(c,v,f)}return f}function XC(c){var f=c._reactInternals;if(f===void 0)throw typeof c.render=="function"?Error(i(188)):(c=Object.keys(c).join(","),Error(i(268,c)));return c=X(f),c===null?null:c.stateNode}function QC(c,f){if(c=c.memoizedState,c!==null&&c.dehydrated!==null){var v=c.retryLane;c.retryLane=v!==0&&v=Ee&&P>=vt&&k<=qe&&z<=We){c.splice(f,1);break}else if(C!==Ee||v.width!==pe.width||Wez){if(!(P!==vt||v.height!==pe.height||qek)){Ee>C&&(pe.width+=Ee-C,pe.x=C),qeP&&(pe.height+=vt-P,pe.y=P),Wev&&(v=z)),z ")+` No matching component was found for: - `)+c.join(" > ")}return null},n.getPublicRootInstance=function(c){if(c=c.current,!c.child)return null;switch(c.child.tag){case 5:return N(c.child.stateNode);default:return c.child.stateNode}},n.injectIntoDevTools=function(c){if(c={bundleType:c.bundleType,version:c.version,rendererPackageName:c.rendererPackageName,rendererConfig:c.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:l.ReactCurrentDispatcher,findHostInstanceByFiber:mR,findFiberByHostInstance:c.findFiberByHostInstance||hR,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.2.0"},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u")c=!1;else{var f=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(f.isDisabled||!f.supportsFiber)c=!0;else{try{lf=f.inject(c),ss=f}catch{}c=!!f.checkDCE}}return c},n.isAlreadyRendering=function(){return!1},n.observeVisibleRects=function(c,f,v,C){if(!$e)throw Error(i(363));c=N0(c,f);var k=bt(c,v,C).disconnect;return{disconnect:function(){k()}}},n.registerMutableSourceForHydration=function(c,f){var v=f._getVersion;v=v(f._source),c.mutableSourceEagerHydrationData==null?c.mutableSourceEagerHydrationData=[f,v]:c.mutableSourceEagerHydrationData.push(f,v)},n.runWithPriority=function(c,f){var v=Nt;try{return Nt=c,f()}finally{Nt=v}},n.shouldError=function(){return null},n.shouldSuspend=function(){return!1},n.updateContainer=function(c,f,v,C){var k=f.current,P=ir(),z=Oa(k);return v=qC(v),f.context===null?f.context=v:f.pendingContext=v,f=Hs(P,z),f.payload={element:c},C=C===void 0?null:C,C!==null&&(f.callback=C),c=Pa(k,f,z),c!==null&&(fo(c,k,z,P),gf(c,k,z)),z},n};p7.exports=gge;var vge=p7.exports;const xge=xd(vge);var m7={exports:{}},pl={};/** + `)+c.join(" > ")}return null},n.getPublicRootInstance=function(c){if(c=c.current,!c.child)return null;switch(c.child.tag){case 5:return N(c.child.stateNode);default:return c.child.stateNode}},n.injectIntoDevTools=function(c){if(c={bundleType:c.bundleType,version:c.version,rendererPackageName:c.rendererPackageName,rendererConfig:c.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:l.ReactCurrentDispatcher,findHostInstanceByFiber:mR,findFiberByHostInstance:c.findFiberByHostInstance||hR,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.2.0"},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u")c=!1;else{var f=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(f.isDisabled||!f.supportsFiber)c=!0;else{try{lf=f.inject(c),ss=f}catch{}c=!!f.checkDCE}}return c},n.isAlreadyRendering=function(){return!1},n.observeVisibleRects=function(c,f,v,C){if(!$e)throw Error(i(363));c=N0(c,f);var k=bt(c,v,C).disconnect;return{disconnect:function(){k()}}},n.registerMutableSourceForHydration=function(c,f){var v=f._getVersion;v=v(f._source),c.mutableSourceEagerHydrationData==null?c.mutableSourceEagerHydrationData=[f,v]:c.mutableSourceEagerHydrationData.push(f,v)},n.runWithPriority=function(c,f){var v=Nt;try{return Nt=c,f()}finally{Nt=v}},n.shouldError=function(){return null},n.shouldSuspend=function(){return!1},n.updateContainer=function(c,f,v,C){var k=f.current,P=ir(),z=Oa(k);return v=qC(v),f.context===null?f.context=v:f.pendingContext=v,f=Hs(P,z),f.payload={element:c},C=C===void 0?null:C,C!==null&&(f.callback=C),c=Pa(k,f,z),c!==null&&(fo(c,k,z,P),gf(c,k,z)),z},n};p7.exports=hge;var gge=p7.exports;const vge=xd(gge);var m7={exports:{}},pl={};/** * @license React * react-reconciler-constants.production.min.js * @@ -79,14 +79,14 @@ No matching component was found for: * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */pl.ConcurrentRoot=1;pl.ContinuousEventPriority=4;pl.DefaultEventPriority=16;pl.DiscreteEventPriority=1;pl.IdleEventPriority=536870912;pl.LegacyRoot=0;m7.exports=pl;var h7=m7.exports;const D_={children:!0,ref:!0,key:!0,style:!0,forwardedRef:!0,unstable_applyCache:!0,unstable_applyDrawHitFromCache:!0};let A_=!1,T_=!1;const f2=".react-konva-event",bge=`ReactKonva: You have a Konva node with draggable = true and position defined but no onDragMove or onDragEnd events are handled. + */pl.ConcurrentRoot=1;pl.ContinuousEventPriority=4;pl.DefaultEventPriority=16;pl.DiscreteEventPriority=1;pl.IdleEventPriority=536870912;pl.LegacyRoot=0;m7.exports=pl;var h7=m7.exports;const D_={children:!0,ref:!0,key:!0,style:!0,forwardedRef:!0,unstable_applyCache:!0,unstable_applyDrawHitFromCache:!0};let A_=!1,T_=!1;const f2=".react-konva-event",xge=`ReactKonva: You have a Konva node with draggable = true and position defined but no onDragMove or onDragEnd events are handled. Position of a node will be changed during drag&drop, so you should update state of the react app as well. Consider to add onDragMove or onDragEnd events. For more info see: https://github.com/konvajs/react-konva/issues/256 -`,yge=`ReactKonva: You are using "zIndex" attribute for a Konva node. +`,bge=`ReactKonva: You are using "zIndex" attribute for a Konva node. react-konva may get confused with ordering. Just define correct order of elements in your render function of a component. For more info see: https://github.com/konvajs/react-konva/issues/194 -`,Cge={};function Lg(e,t,n=Cge){if(!A_&&"zIndex"in t&&(console.warn(yge),A_=!0),!T_&&t.draggable){var r=t.x!==void 0||t.y!==void 0,o=t.onDragEnd||t.onDragMove;r&&!o&&(console.warn(bge),T_=!0)}for(var s in n)if(!D_[s]){var i=s.slice(0,2)==="on",l=n[s]!==t[s];if(i&&l){var u=s.substr(2).toLowerCase();u.substr(0,7)==="content"&&(u="content"+u.substr(7,1).toUpperCase()+u.substr(8)),e.off(u,n[s])}var p=!t.hasOwnProperty(s);p&&e.setAttr(s,void 0)}var m=t._useStrictMode,h={},g=!1;const x={};for(var s in t)if(!D_[s]){var i=s.slice(0,2)==="on",y=n[s]!==t[s];if(i&&y){var u=s.substr(2).toLowerCase();u.substr(0,7)==="content"&&(u="content"+u.substr(7,1).toUpperCase()+u.substr(8)),t[s]&&(x[u]=t[s])}!i&&(t[s]!==n[s]||m&&t[s]!==e.getAttr(s))&&(g=!0,h[s]=t[s])}g&&(e.setAttrs(h),pi(e));for(var u in x)e.on(u+f2,x[u])}function pi(e){if(!NN.Konva.autoDrawEnabled){var t=e.getLayer()||e.getStage();t&&t.batchDraw()}}const g7={},wge={};gd.Node.prototype._applyProps=Lg;function Sge(e,t){if(typeof t=="string"){console.error(`Do not use plain text as child of Konva.Node. You are using text: ${t}`);return}e.add(t),pi(e)}function kge(e,t,n){let r=gd[e];r||(console.error(`Konva has no node with the type ${e}. Group will be used instead. If you use minimal version of react-konva, just import required nodes into Konva: "import "konva/lib/shapes/${e}" If you want to render DOM elements as part of canvas tree take a look into this demo: https://konvajs.github.io/docs/react/DOM_Portal.html`),r=gd.Group);const o={},s={};for(var i in t){var l=i.slice(0,2)==="on";l?s[i]=t[i]:o[i]=t[i]}const u=new r(o);return Lg(u,s),u}function jge(e,t,n){console.error(`Text components are not supported for now in ReactKonva. Your text is: "${e}"`)}function _ge(e,t,n){return!1}function Ige(e){return e}function Pge(){return null}function Ege(){return null}function Mge(e,t,n,r){return wge}function Oge(){}function Rge(e){}function Dge(e,t){return!1}function Age(){return g7}function Tge(){return g7}const Nge=setTimeout,$ge=clearTimeout,Lge=-1;function zge(e,t){return!1}const Fge=!1,Bge=!0,Hge=!0;function Vge(e,t){t.parent===e?t.moveToTop():e.add(t),pi(e)}function Wge(e,t){t.parent===e?t.moveToTop():e.add(t),pi(e)}function v7(e,t,n){t._remove(),e.add(t),t.setZIndex(n.getZIndex()),pi(e)}function Uge(e,t,n){v7(e,t,n)}function Gge(e,t){t.destroy(),t.off(f2),pi(e)}function Kge(e,t){t.destroy(),t.off(f2),pi(e)}function qge(e,t,n){console.error(`Text components are not yet supported in ReactKonva. You text is: "${n}"`)}function Xge(e,t,n){}function Qge(e,t,n,r,o){Lg(e,o,r)}function Yge(e){e.hide(),pi(e)}function Zge(e){}function Jge(e,t){(t.visible==null||t.visible)&&e.show()}function e0e(e,t){}function t0e(e){}function n0e(){}const r0e=()=>h7.DefaultEventPriority,o0e=Object.freeze(Object.defineProperty({__proto__:null,appendChild:Vge,appendChildToContainer:Wge,appendInitialChild:Sge,cancelTimeout:$ge,clearContainer:t0e,commitMount:Xge,commitTextUpdate:qge,commitUpdate:Qge,createInstance:kge,createTextInstance:jge,detachDeletedInstance:n0e,finalizeInitialChildren:_ge,getChildHostContext:Tge,getCurrentEventPriority:r0e,getPublicInstance:Ige,getRootHostContext:Age,hideInstance:Yge,hideTextInstance:Zge,idlePriority:Tp.unstable_IdlePriority,insertBefore:v7,insertInContainerBefore:Uge,isPrimaryRenderer:Fge,noTimeout:Lge,now:Tp.unstable_now,prepareForCommit:Pge,preparePortalMount:Ege,prepareUpdate:Mge,removeChild:Gge,removeChildFromContainer:Kge,resetAfterCommit:Oge,resetTextContent:Rge,run:Tp.unstable_runWithPriority,scheduleTimeout:Nge,shouldDeprioritizeSubtree:Dge,shouldSetTextContent:zge,supportsMutation:Hge,unhideInstance:Jge,unhideTextInstance:e0e,warnsIfNotActing:Bge},Symbol.toStringTag,{value:"Module"}));var s0e=Object.defineProperty,a0e=Object.defineProperties,i0e=Object.getOwnPropertyDescriptors,N_=Object.getOwnPropertySymbols,l0e=Object.prototype.hasOwnProperty,c0e=Object.prototype.propertyIsEnumerable,$_=(e,t,n)=>t in e?s0e(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,L_=(e,t)=>{for(var n in t||(t={}))l0e.call(t,n)&&$_(e,n,t[n]);if(N_)for(var n of N_(t))c0e.call(t,n)&&$_(e,n,t[n]);return e},u0e=(e,t)=>a0e(e,i0e(t));function x7(e,t,n){if(!e)return;if(n(e)===!0)return e;let r=t?e.return:e.child;for(;r;){const o=x7(r,t,n);if(o)return o;r=t?null:r.sibling}}function b7(e){try{return Object.defineProperties(e,{_currentRenderer:{get(){return null},set(){}},_currentRenderer2:{get(){return null},set(){}}})}catch{return e}}const p2=b7(d.createContext(null));class y7 extends d.Component{render(){return d.createElement(p2.Provider,{value:this._reactInternals},this.props.children)}}const{ReactCurrentOwner:z_,ReactCurrentDispatcher:F_}=d.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function d0e(){const e=d.useContext(p2);if(e===null)throw new Error("its-fine: useFiber must be called within a !");const t=d.useId();return d.useMemo(()=>{for(const r of[z_==null?void 0:z_.current,e,e==null?void 0:e.alternate]){if(!r)continue;const o=x7(r,!1,s=>{let i=s.memoizedState;for(;i;){if(i.memoizedState===t)return!0;i=i.next}});if(o)return o}},[e,t])}function f0e(){var e,t;const n=d0e(),[r]=d.useState(()=>new Map);r.clear();let o=n;for(;o;){const s=(e=o.type)==null?void 0:e._context;s&&s!==p2&&!r.has(s)&&r.set(s,(t=F_==null?void 0:F_.current)==null?void 0:t.readContext(b7(s))),o=o.return}return r}function p0e(){const e=f0e();return d.useMemo(()=>Array.from(e.keys()).reduce((t,n)=>r=>d.createElement(t,null,d.createElement(n.Provider,u0e(L_({},r),{value:e.get(n)}))),t=>d.createElement(y7,L_({},t))),[e])}function m0e(e){const t=H.useRef({});return H.useLayoutEffect(()=>{t.current=e}),H.useLayoutEffect(()=>()=>{t.current={}},[]),t.current}const h0e=e=>{const t=H.useRef(),n=H.useRef(),r=H.useRef(),o=m0e(e),s=p0e(),i=l=>{const{forwardedRef:u}=e;u&&(typeof u=="function"?u(l):u.current=l)};return H.useLayoutEffect(()=>(n.current=new gd.Stage({width:e.width,height:e.height,container:t.current}),i(n.current),r.current=Tu.createContainer(n.current,h7.LegacyRoot,!1,null),Tu.updateContainer(H.createElement(s,{},e.children),r.current),()=>{gd.isBrowser&&(i(null),Tu.updateContainer(null,r.current,null),n.current.destroy())}),[]),H.useLayoutEffect(()=>{i(n.current),Lg(n.current,e,o),Tu.updateContainer(H.createElement(s,{},e.children),r.current,null)}),H.createElement("div",{ref:t,id:e.id,accessKey:e.accessKey,className:e.className,role:e.role,style:e.style,tabIndex:e.tabIndex,title:e.title})},Eu="Layer",Ms="Group",Os="Rect",ki="Circle",fh="Line",C7="Image",g0e="Text",v0e="Transformer",Tu=xge(o0e);Tu.injectIntoDevTools({findHostInstanceByFiber:()=>null,bundleType:0,version:H.version,rendererPackageName:"react-konva"});const x0e=H.forwardRef((e,t)=>H.createElement(y7,{},H.createElement(h0e,{...e,forwardedRef:t}))),b0e=le([Sn,Eo],(e,t)=>{const{tool:n,isMovingBoundingBox:r}=e;return{tool:n,isStaging:t,isMovingBoundingBox:r}},{memoizeOptions:{resultEqualityCheck:Ft}}),y0e=()=>{const e=te(),{tool:t,isStaging:n,isMovingBoundingBox:r}=W(b0e);return{handleDragStart:d.useCallback(()=>{(t==="move"||n)&&!r&&e(tm(!0))},[e,r,n,t]),handleDragMove:d.useCallback(o=>{if(!((t==="move"||n)&&!r))return;const s={x:o.target.x(),y:o.target.y()};e(WI(s))},[e,r,n,t]),handleDragEnd:d.useCallback(()=>{(t==="move"||n)&&!r&&e(tm(!1))},[e,r,n,t])}},C0e=le([Sn,Jn,Eo],(e,t,n)=>{const{cursorPosition:r,shouldLockBoundingBox:o,shouldShowBoundingBox:s,tool:i,isMaskEnabled:l,shouldSnapToGrid:u}=e;return{activeTabName:t,isCursorOnCanvas:!!r,shouldLockBoundingBox:o,shouldShowBoundingBox:s,tool:i,isStaging:n,isMaskEnabled:l,shouldSnapToGrid:u}},{memoizeOptions:{resultEqualityCheck:Ft}}),w0e=()=>{const e=te(),{activeTabName:t,shouldShowBoundingBox:n,tool:r,isStaging:o,isMaskEnabled:s,shouldSnapToGrid:i}=W(C0e),l=d.useRef(null),u=UI(),p=()=>e(GI());et(["shift+c"],()=>{p()},{enabled:()=>!o,preventDefault:!0},[]);const m=()=>e(ib(!s));et(["h"],()=>{m()},{enabled:()=>!o,preventDefault:!0},[s]),et(["n"],()=>{e(nm(!i))},{enabled:!0,preventDefault:!0},[i]),et("esc",()=>{e($N())},{enabled:()=>!0,preventDefault:!0}),et("shift+h",()=>{e(LN(!n))},{enabled:()=>!o,preventDefault:!0},[t,n]),et(["space"],h=>{h.repeat||(u==null||u.container().focus(),r!=="move"&&(l.current=r,e(oc("move"))),r==="move"&&l.current&&l.current!=="move"&&(e(oc(l.current)),l.current="move"))},{keyup:!0,keydown:!0,preventDefault:!0},[r,l])},m2=e=>{const t=e.getPointerPosition(),n=e.getAbsoluteTransform().copy();if(!t||!n)return;const r=n.invert().point(t);return{x:r.x,y:r.y}},w7=()=>{const e=te(),t=v1(),n=UI();return{updateColorUnderCursor:()=>{if(!n||!t)return;const r=n.getPointerPosition();if(!r)return;const o=zN.pixelRatio,[s,i,l,u]=t.getContext().getImageData(r.x*o,r.y*o,1,1).data;u&&s&&i&&l&&e(FN({r:s,g:i,b:l,a:u}))},commitColorUnderCursor:()=>{e(BN())}}},S0e=le([Jn,Sn,Eo],(e,t,n)=>{const{tool:r}=t;return{tool:r,activeTabName:e,isStaging:n}},{memoizeOptions:{resultEqualityCheck:Ft}}),k0e=e=>{const t=te(),{tool:n,isStaging:r}=W(S0e),{commitColorUnderCursor:o}=w7();return d.useCallback(s=>{if(!e.current)return;if(e.current.container().focus(),n==="move"||r){t(tm(!0));return}if(n==="colorPicker"){o();return}const i=m2(e.current);i&&(s.evt.preventDefault(),t(KI(!0)),t(HN([i.x,i.y])))},[e,n,r,t,o])},j0e=le([Jn,Sn,Eo],(e,t,n)=>{const{tool:r,isDrawing:o}=t;return{tool:r,isDrawing:o,activeTabName:e,isStaging:n}},{memoizeOptions:{resultEqualityCheck:Ft}}),_0e=(e,t,n)=>{const r=te(),{isDrawing:o,tool:s,isStaging:i}=W(j0e),{updateColorUnderCursor:l}=w7();return d.useCallback(()=>{if(!e.current)return;const u=m2(e.current);if(u){if(r(VN(u)),n.current=u,s==="colorPicker"){l();return}!o||s==="move"||i||(t.current=!0,r(qI([u.x,u.y])))}},[t,r,o,i,n,e,s,l])},I0e=()=>{const e=te();return d.useCallback(()=>{e(WN())},[e])},P0e=le([Jn,Sn,Eo],(e,t,n)=>{const{tool:r,isDrawing:o}=t;return{tool:r,isDrawing:o,activeTabName:e,isStaging:n}},{memoizeOptions:{resultEqualityCheck:Ft}}),E0e=(e,t)=>{const n=te(),{tool:r,isDrawing:o,isStaging:s}=W(P0e);return d.useCallback(()=>{if(r==="move"||s){n(tm(!1));return}if(!t.current&&o&&e.current){const i=m2(e.current);if(!i)return;n(qI([i.x,i.y]))}else t.current=!1;n(KI(!1))},[t,n,o,s,e,r])},M0e=le([Sn],e=>{const{isMoveStageKeyHeld:t,stageScale:n}=e;return{isMoveStageKeyHeld:t,stageScale:n}},{memoizeOptions:{resultEqualityCheck:Ft}}),O0e=e=>{const t=te(),{isMoveStageKeyHeld:n,stageScale:r}=W(M0e);return d.useCallback(o=>{if(!e.current||n)return;o.evt.preventDefault();const s=e.current.getPointerPosition();if(!s)return;const i={x:(s.x-e.current.x())/r,y:(s.y-e.current.y())/r};let l=o.evt.deltaY;o.evt.ctrlKey&&(l=-l);const u=Fi(r*KN**l,GN,UN),p={x:s.x-i.x*u,y:s.y-i.y*u};t(qN(u)),t(WI(p))},[e,n,r,t])},R0e=le(Sn,e=>{const{boundingBoxCoordinates:t,boundingBoxDimensions:n,stageDimensions:r,stageScale:o,shouldDarkenOutsideBoundingBox:s,stageCoordinates:i}=e;return{boundingBoxCoordinates:t,boundingBoxDimensions:n,shouldDarkenOutsideBoundingBox:s,stageCoordinates:i,stageDimensions:r,stageScale:o}},{memoizeOptions:{resultEqualityCheck:Ft}}),D0e=()=>{const{boundingBoxCoordinates:e,boundingBoxDimensions:t,shouldDarkenOutsideBoundingBox:n,stageCoordinates:r,stageDimensions:o,stageScale:s}=W(R0e);return a.jsxs(Ms,{children:[a.jsx(Os,{offsetX:r.x/s,offsetY:r.y/s,height:o.height/s,width:o.width/s,fill:"rgba(0,0,0,0.4)",listening:!1,visible:n}),a.jsx(Os,{x:e.x,y:e.y,width:t.width,height:t.height,fill:"rgb(255,255,255)",listening:!1,visible:n,globalCompositeOperation:"destination-out"})]})},A0e=d.memo(D0e),T0e=le([Sn],e=>{const{stageScale:t,stageCoordinates:n,stageDimensions:r}=e;return{stageScale:t,stageCoordinates:n,stageDimensions:r}},{memoizeOptions:{resultEqualityCheck:Ft}}),N0e=()=>{const{stageScale:e,stageCoordinates:t,stageDimensions:n}=W(T0e),{colorMode:r}=ha(),[o,s]=d.useState([]),[i,l]=Ho("colors",["base.800","base.200"]),u=d.useCallback(p=>p/e,[e]);return d.useLayoutEffect(()=>{const{width:p,height:m}=n,{x:h,y:g}=t,x={x1:0,y1:0,x2:p,y2:m,offset:{x:u(h),y:u(g)}},y={x:Math.ceil(u(h)/64)*64,y:Math.ceil(u(g)/64)*64},b={x1:-y.x,y1:-y.y,x2:u(p)-y.x+64,y2:u(m)-y.y+64},S={x1:Math.min(x.x1,b.x1),y1:Math.min(x.y1,b.y1),x2:Math.max(x.x2,b.x2),y2:Math.max(x.y2,b.y2)},j=S.x2-S.x1,_=S.y2-S.y1,E=Math.round(j/64)+1,I=Math.round(_/64)+1,M=zw(0,E).map(D=>a.jsx(fh,{x:S.x1+D*64,y:S.y1,points:[0,0,0,_],stroke:r==="dark"?i:l,strokeWidth:1},`x_${D}`)),R=zw(0,I).map(D=>a.jsx(fh,{x:S.x1,y:S.y1+D*64,points:[0,0,j,0],stroke:r==="dark"?i:l,strokeWidth:1},`y_${D}`));s(M.concat(R))},[e,t,n,u,r,i,l]),a.jsx(Ms,{children:o})},$0e=d.memo(N0e),L0e=le([xe],({system:e,canvas:t})=>{const{denoiseProgress:n}=e,{boundingBox:r}=t.layerState.stagingArea,{batchIds:o}=t;return{boundingBox:r,progressImage:n&&o.includes(n.batch_id)?n.progress_image:void 0}},{memoizeOptions:{resultEqualityCheck:Ft}}),z0e=e=>{const{...t}=e,{progressImage:n,boundingBox:r}=W(L0e),[o,s]=d.useState(null);return d.useEffect(()=>{if(!n)return;const i=new Image;i.onload=()=>{s(i)},i.src=n.dataURL},[n]),n&&r&&o?a.jsx(C7,{x:r.x,y:r.y,width:r.width,height:r.height,image:o,listening:!1,...t}):null},F0e=d.memo(z0e),zi=e=>{const{r:t,g:n,b:r,a:o}=e;return`rgba(${t}, ${n}, ${r}, ${o})`},B0e=le(Sn,e=>{const{maskColor:t,stageCoordinates:n,stageDimensions:r,stageScale:o}=e;return{stageCoordinates:n,stageDimensions:r,stageScale:o,maskColorString:zi(t)}}),B_=e=>`data:image/svg+xml;utf8, +`,yge={};function Lg(e,t,n=yge){if(!A_&&"zIndex"in t&&(console.warn(bge),A_=!0),!T_&&t.draggable){var r=t.x!==void 0||t.y!==void 0,o=t.onDragEnd||t.onDragMove;r&&!o&&(console.warn(xge),T_=!0)}for(var s in n)if(!D_[s]){var i=s.slice(0,2)==="on",l=n[s]!==t[s];if(i&&l){var u=s.substr(2).toLowerCase();u.substr(0,7)==="content"&&(u="content"+u.substr(7,1).toUpperCase()+u.substr(8)),e.off(u,n[s])}var p=!t.hasOwnProperty(s);p&&e.setAttr(s,void 0)}var m=t._useStrictMode,h={},g=!1;const x={};for(var s in t)if(!D_[s]){var i=s.slice(0,2)==="on",y=n[s]!==t[s];if(i&&y){var u=s.substr(2).toLowerCase();u.substr(0,7)==="content"&&(u="content"+u.substr(7,1).toUpperCase()+u.substr(8)),t[s]&&(x[u]=t[s])}!i&&(t[s]!==n[s]||m&&t[s]!==e.getAttr(s))&&(g=!0,h[s]=t[s])}g&&(e.setAttrs(h),pi(e));for(var u in x)e.on(u+f2,x[u])}function pi(e){if(!NN.Konva.autoDrawEnabled){var t=e.getLayer()||e.getStage();t&&t.batchDraw()}}const g7={},Cge={};gd.Node.prototype._applyProps=Lg;function wge(e,t){if(typeof t=="string"){console.error(`Do not use plain text as child of Konva.Node. You are using text: ${t}`);return}e.add(t),pi(e)}function Sge(e,t,n){let r=gd[e];r||(console.error(`Konva has no node with the type ${e}. Group will be used instead. If you use minimal version of react-konva, just import required nodes into Konva: "import "konva/lib/shapes/${e}" If you want to render DOM elements as part of canvas tree take a look into this demo: https://konvajs.github.io/docs/react/DOM_Portal.html`),r=gd.Group);const o={},s={};for(var i in t){var l=i.slice(0,2)==="on";l?s[i]=t[i]:o[i]=t[i]}const u=new r(o);return Lg(u,s),u}function kge(e,t,n){console.error(`Text components are not supported for now in ReactKonva. Your text is: "${e}"`)}function jge(e,t,n){return!1}function _ge(e){return e}function Ige(){return null}function Pge(){return null}function Ege(e,t,n,r){return Cge}function Mge(){}function Oge(e){}function Rge(e,t){return!1}function Dge(){return g7}function Age(){return g7}const Tge=setTimeout,Nge=clearTimeout,$ge=-1;function Lge(e,t){return!1}const zge=!1,Fge=!0,Bge=!0;function Hge(e,t){t.parent===e?t.moveToTop():e.add(t),pi(e)}function Vge(e,t){t.parent===e?t.moveToTop():e.add(t),pi(e)}function v7(e,t,n){t._remove(),e.add(t),t.setZIndex(n.getZIndex()),pi(e)}function Wge(e,t,n){v7(e,t,n)}function Uge(e,t){t.destroy(),t.off(f2),pi(e)}function Gge(e,t){t.destroy(),t.off(f2),pi(e)}function Kge(e,t,n){console.error(`Text components are not yet supported in ReactKonva. You text is: "${n}"`)}function qge(e,t,n){}function Xge(e,t,n,r,o){Lg(e,o,r)}function Qge(e){e.hide(),pi(e)}function Yge(e){}function Zge(e,t){(t.visible==null||t.visible)&&e.show()}function Jge(e,t){}function e0e(e){}function t0e(){}const n0e=()=>h7.DefaultEventPriority,r0e=Object.freeze(Object.defineProperty({__proto__:null,appendChild:Hge,appendChildToContainer:Vge,appendInitialChild:wge,cancelTimeout:Nge,clearContainer:e0e,commitMount:qge,commitTextUpdate:Kge,commitUpdate:Xge,createInstance:Sge,createTextInstance:kge,detachDeletedInstance:t0e,finalizeInitialChildren:jge,getChildHostContext:Age,getCurrentEventPriority:n0e,getPublicInstance:_ge,getRootHostContext:Dge,hideInstance:Qge,hideTextInstance:Yge,idlePriority:Tp.unstable_IdlePriority,insertBefore:v7,insertInContainerBefore:Wge,isPrimaryRenderer:zge,noTimeout:$ge,now:Tp.unstable_now,prepareForCommit:Ige,preparePortalMount:Pge,prepareUpdate:Ege,removeChild:Uge,removeChildFromContainer:Gge,resetAfterCommit:Mge,resetTextContent:Oge,run:Tp.unstable_runWithPriority,scheduleTimeout:Tge,shouldDeprioritizeSubtree:Rge,shouldSetTextContent:Lge,supportsMutation:Bge,unhideInstance:Zge,unhideTextInstance:Jge,warnsIfNotActing:Fge},Symbol.toStringTag,{value:"Module"}));var o0e=Object.defineProperty,s0e=Object.defineProperties,a0e=Object.getOwnPropertyDescriptors,N_=Object.getOwnPropertySymbols,i0e=Object.prototype.hasOwnProperty,l0e=Object.prototype.propertyIsEnumerable,$_=(e,t,n)=>t in e?o0e(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,L_=(e,t)=>{for(var n in t||(t={}))i0e.call(t,n)&&$_(e,n,t[n]);if(N_)for(var n of N_(t))l0e.call(t,n)&&$_(e,n,t[n]);return e},c0e=(e,t)=>s0e(e,a0e(t));function x7(e,t,n){if(!e)return;if(n(e)===!0)return e;let r=t?e.return:e.child;for(;r;){const o=x7(r,t,n);if(o)return o;r=t?null:r.sibling}}function b7(e){try{return Object.defineProperties(e,{_currentRenderer:{get(){return null},set(){}},_currentRenderer2:{get(){return null},set(){}}})}catch{return e}}const p2=b7(d.createContext(null));class y7 extends d.Component{render(){return d.createElement(p2.Provider,{value:this._reactInternals},this.props.children)}}const{ReactCurrentOwner:z_,ReactCurrentDispatcher:F_}=d.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function u0e(){const e=d.useContext(p2);if(e===null)throw new Error("its-fine: useFiber must be called within a !");const t=d.useId();return d.useMemo(()=>{for(const r of[z_==null?void 0:z_.current,e,e==null?void 0:e.alternate]){if(!r)continue;const o=x7(r,!1,s=>{let i=s.memoizedState;for(;i;){if(i.memoizedState===t)return!0;i=i.next}});if(o)return o}},[e,t])}function d0e(){var e,t;const n=u0e(),[r]=d.useState(()=>new Map);r.clear();let o=n;for(;o;){const s=(e=o.type)==null?void 0:e._context;s&&s!==p2&&!r.has(s)&&r.set(s,(t=F_==null?void 0:F_.current)==null?void 0:t.readContext(b7(s))),o=o.return}return r}function f0e(){const e=d0e();return d.useMemo(()=>Array.from(e.keys()).reduce((t,n)=>r=>d.createElement(t,null,d.createElement(n.Provider,c0e(L_({},r),{value:e.get(n)}))),t=>d.createElement(y7,L_({},t))),[e])}function p0e(e){const t=H.useRef({});return H.useLayoutEffect(()=>{t.current=e}),H.useLayoutEffect(()=>()=>{t.current={}},[]),t.current}const m0e=e=>{const t=H.useRef(),n=H.useRef(),r=H.useRef(),o=p0e(e),s=f0e(),i=l=>{const{forwardedRef:u}=e;u&&(typeof u=="function"?u(l):u.current=l)};return H.useLayoutEffect(()=>(n.current=new gd.Stage({width:e.width,height:e.height,container:t.current}),i(n.current),r.current=Tu.createContainer(n.current,h7.LegacyRoot,!1,null),Tu.updateContainer(H.createElement(s,{},e.children),r.current),()=>{gd.isBrowser&&(i(null),Tu.updateContainer(null,r.current,null),n.current.destroy())}),[]),H.useLayoutEffect(()=>{i(n.current),Lg(n.current,e,o),Tu.updateContainer(H.createElement(s,{},e.children),r.current,null)}),H.createElement("div",{ref:t,id:e.id,accessKey:e.accessKey,className:e.className,role:e.role,style:e.style,tabIndex:e.tabIndex,title:e.title})},Eu="Layer",Ms="Group",Os="Rect",ki="Circle",fh="Line",C7="Image",h0e="Text",g0e="Transformer",Tu=vge(r0e);Tu.injectIntoDevTools({findHostInstanceByFiber:()=>null,bundleType:0,version:H.version,rendererPackageName:"react-konva"});const v0e=H.forwardRef((e,t)=>H.createElement(y7,{},H.createElement(m0e,{...e,forwardedRef:t}))),x0e=ce([Sn,Eo],(e,t)=>{const{tool:n,isMovingBoundingBox:r}=e;return{tool:n,isStaging:t,isMovingBoundingBox:r}},{memoizeOptions:{resultEqualityCheck:Ft}}),b0e=()=>{const e=te(),{tool:t,isStaging:n,isMovingBoundingBox:r}=W(x0e);return{handleDragStart:d.useCallback(()=>{(t==="move"||n)&&!r&&e(tm(!0))},[e,r,n,t]),handleDragMove:d.useCallback(o=>{if(!((t==="move"||n)&&!r))return;const s={x:o.target.x(),y:o.target.y()};e(WI(s))},[e,r,n,t]),handleDragEnd:d.useCallback(()=>{(t==="move"||n)&&!r&&e(tm(!1))},[e,r,n,t])}},y0e=ce([Sn,Jn,Eo],(e,t,n)=>{const{cursorPosition:r,shouldLockBoundingBox:o,shouldShowBoundingBox:s,tool:i,isMaskEnabled:l,shouldSnapToGrid:u}=e;return{activeTabName:t,isCursorOnCanvas:!!r,shouldLockBoundingBox:o,shouldShowBoundingBox:s,tool:i,isStaging:n,isMaskEnabled:l,shouldSnapToGrid:u}},{memoizeOptions:{resultEqualityCheck:Ft}}),C0e=()=>{const e=te(),{activeTabName:t,shouldShowBoundingBox:n,tool:r,isStaging:o,isMaskEnabled:s,shouldSnapToGrid:i}=W(y0e),l=d.useRef(null),u=UI(),p=()=>e(GI());et(["shift+c"],()=>{p()},{enabled:()=>!o,preventDefault:!0},[]);const m=()=>e(ib(!s));et(["h"],()=>{m()},{enabled:()=>!o,preventDefault:!0},[s]),et(["n"],()=>{e(nm(!i))},{enabled:!0,preventDefault:!0},[i]),et("esc",()=>{e($N())},{enabled:()=>!0,preventDefault:!0}),et("shift+h",()=>{e(LN(!n))},{enabled:()=>!o,preventDefault:!0},[t,n]),et(["space"],h=>{h.repeat||(u==null||u.container().focus(),r!=="move"&&(l.current=r,e(oc("move"))),r==="move"&&l.current&&l.current!=="move"&&(e(oc(l.current)),l.current="move"))},{keyup:!0,keydown:!0,preventDefault:!0},[r,l])},m2=e=>{const t=e.getPointerPosition(),n=e.getAbsoluteTransform().copy();if(!t||!n)return;const r=n.invert().point(t);return{x:r.x,y:r.y}},w7=()=>{const e=te(),t=v1(),n=UI();return{updateColorUnderCursor:()=>{if(!n||!t)return;const r=n.getPointerPosition();if(!r)return;const o=zN.pixelRatio,[s,i,l,u]=t.getContext().getImageData(r.x*o,r.y*o,1,1).data;u&&s&&i&&l&&e(FN({r:s,g:i,b:l,a:u}))},commitColorUnderCursor:()=>{e(BN())}}},w0e=ce([Jn,Sn,Eo],(e,t,n)=>{const{tool:r}=t;return{tool:r,activeTabName:e,isStaging:n}},{memoizeOptions:{resultEqualityCheck:Ft}}),S0e=e=>{const t=te(),{tool:n,isStaging:r}=W(w0e),{commitColorUnderCursor:o}=w7();return d.useCallback(s=>{if(!e.current)return;if(e.current.container().focus(),n==="move"||r){t(tm(!0));return}if(n==="colorPicker"){o();return}const i=m2(e.current);i&&(s.evt.preventDefault(),t(KI(!0)),t(HN([i.x,i.y])))},[e,n,r,t,o])},k0e=ce([Jn,Sn,Eo],(e,t,n)=>{const{tool:r,isDrawing:o}=t;return{tool:r,isDrawing:o,activeTabName:e,isStaging:n}},{memoizeOptions:{resultEqualityCheck:Ft}}),j0e=(e,t,n)=>{const r=te(),{isDrawing:o,tool:s,isStaging:i}=W(k0e),{updateColorUnderCursor:l}=w7();return d.useCallback(()=>{if(!e.current)return;const u=m2(e.current);if(u){if(r(VN(u)),n.current=u,s==="colorPicker"){l();return}!o||s==="move"||i||(t.current=!0,r(qI([u.x,u.y])))}},[t,r,o,i,n,e,s,l])},_0e=()=>{const e=te();return d.useCallback(()=>{e(WN())},[e])},I0e=ce([Jn,Sn,Eo],(e,t,n)=>{const{tool:r,isDrawing:o}=t;return{tool:r,isDrawing:o,activeTabName:e,isStaging:n}},{memoizeOptions:{resultEqualityCheck:Ft}}),P0e=(e,t)=>{const n=te(),{tool:r,isDrawing:o,isStaging:s}=W(I0e);return d.useCallback(()=>{if(r==="move"||s){n(tm(!1));return}if(!t.current&&o&&e.current){const i=m2(e.current);if(!i)return;n(qI([i.x,i.y]))}else t.current=!1;n(KI(!1))},[t,n,o,s,e,r])},E0e=ce([Sn],e=>{const{isMoveStageKeyHeld:t,stageScale:n}=e;return{isMoveStageKeyHeld:t,stageScale:n}},{memoizeOptions:{resultEqualityCheck:Ft}}),M0e=e=>{const t=te(),{isMoveStageKeyHeld:n,stageScale:r}=W(E0e);return d.useCallback(o=>{if(!e.current||n)return;o.evt.preventDefault();const s=e.current.getPointerPosition();if(!s)return;const i={x:(s.x-e.current.x())/r,y:(s.y-e.current.y())/r};let l=o.evt.deltaY;o.evt.ctrlKey&&(l=-l);const u=Fi(r*KN**l,GN,UN),p={x:s.x-i.x*u,y:s.y-i.y*u};t(qN(u)),t(WI(p))},[e,n,r,t])},O0e=ce(Sn,e=>{const{boundingBoxCoordinates:t,boundingBoxDimensions:n,stageDimensions:r,stageScale:o,shouldDarkenOutsideBoundingBox:s,stageCoordinates:i}=e;return{boundingBoxCoordinates:t,boundingBoxDimensions:n,shouldDarkenOutsideBoundingBox:s,stageCoordinates:i,stageDimensions:r,stageScale:o}},{memoizeOptions:{resultEqualityCheck:Ft}}),R0e=()=>{const{boundingBoxCoordinates:e,boundingBoxDimensions:t,shouldDarkenOutsideBoundingBox:n,stageCoordinates:r,stageDimensions:o,stageScale:s}=W(O0e);return a.jsxs(Ms,{children:[a.jsx(Os,{offsetX:r.x/s,offsetY:r.y/s,height:o.height/s,width:o.width/s,fill:"rgba(0,0,0,0.4)",listening:!1,visible:n}),a.jsx(Os,{x:e.x,y:e.y,width:t.width,height:t.height,fill:"rgb(255,255,255)",listening:!1,visible:n,globalCompositeOperation:"destination-out"})]})},D0e=d.memo(R0e),A0e=ce([Sn],e=>{const{stageScale:t,stageCoordinates:n,stageDimensions:r}=e;return{stageScale:t,stageCoordinates:n,stageDimensions:r}},{memoizeOptions:{resultEqualityCheck:Ft}}),T0e=()=>{const{stageScale:e,stageCoordinates:t,stageDimensions:n}=W(A0e),{colorMode:r}=ha(),[o,s]=d.useState([]),[i,l]=Ho("colors",["base.800","base.200"]),u=d.useCallback(p=>p/e,[e]);return d.useLayoutEffect(()=>{const{width:p,height:m}=n,{x:h,y:g}=t,x={x1:0,y1:0,x2:p,y2:m,offset:{x:u(h),y:u(g)}},y={x:Math.ceil(u(h)/64)*64,y:Math.ceil(u(g)/64)*64},b={x1:-y.x,y1:-y.y,x2:u(p)-y.x+64,y2:u(m)-y.y+64},S={x1:Math.min(x.x1,b.x1),y1:Math.min(x.y1,b.y1),x2:Math.max(x.x2,b.x2),y2:Math.max(x.y2,b.y2)},j=S.x2-S.x1,_=S.y2-S.y1,E=Math.round(j/64)+1,I=Math.round(_/64)+1,M=zw(0,E).map(D=>a.jsx(fh,{x:S.x1+D*64,y:S.y1,points:[0,0,0,_],stroke:r==="dark"?i:l,strokeWidth:1},`x_${D}`)),R=zw(0,I).map(D=>a.jsx(fh,{x:S.x1,y:S.y1+D*64,points:[0,0,j,0],stroke:r==="dark"?i:l,strokeWidth:1},`y_${D}`));s(M.concat(R))},[e,t,n,u,r,i,l]),a.jsx(Ms,{children:o})},N0e=d.memo(T0e),$0e=ce([xe],({system:e,canvas:t})=>{const{denoiseProgress:n}=e,{boundingBox:r}=t.layerState.stagingArea,{batchIds:o}=t;return{boundingBox:r,progressImage:n&&o.includes(n.batch_id)?n.progress_image:void 0}},{memoizeOptions:{resultEqualityCheck:Ft}}),L0e=e=>{const{...t}=e,{progressImage:n,boundingBox:r}=W($0e),[o,s]=d.useState(null);return d.useEffect(()=>{if(!n)return;const i=new Image;i.onload=()=>{s(i)},i.src=n.dataURL},[n]),n&&r&&o?a.jsx(C7,{x:r.x,y:r.y,width:r.width,height:r.height,image:o,listening:!1,...t}):null},z0e=d.memo(L0e),zi=e=>{const{r:t,g:n,b:r,a:o}=e;return`rgba(${t}, ${n}, ${r}, ${o})`},F0e=ce(Sn,e=>{const{maskColor:t,stageCoordinates:n,stageDimensions:r,stageScale:o}=e;return{stageCoordinates:n,stageDimensions:r,stageScale:o,maskColorString:zi(t)}}),B_=e=>`data:image/svg+xml;utf8, @@ -164,6 +164,6 @@ For more info see: https://github.com/konvajs/react-konva/issues/194 -`.replaceAll("black",e),H0e=e=>{const{...t}=e,{maskColorString:n,stageCoordinates:r,stageDimensions:o,stageScale:s}=W(B0e),[i,l]=d.useState(null),[u,p]=d.useState(0),m=d.useRef(null),h=d.useCallback(()=>{p(u+1),setTimeout(h,500)},[u]);return d.useEffect(()=>{if(i)return;const g=new Image;g.onload=()=>{l(g)},g.src=B_(n)},[i,n]),d.useEffect(()=>{i&&(i.src=B_(n))},[i,n]),d.useEffect(()=>{const g=setInterval(()=>p(x=>(x+1)%5),50);return()=>clearInterval(g)},[]),!i||!Ml(r.x)||!Ml(r.y)||!Ml(s)||!Ml(o.width)||!Ml(o.height)?null:a.jsx(Os,{ref:m,offsetX:r.x/s,offsetY:r.y/s,height:o.height/s,width:o.width/s,fillPatternImage:i,fillPatternOffsetY:Ml(u)?u:0,fillPatternRepeat:"repeat",fillPatternScale:{x:1/s,y:1/s},listening:!0,globalCompositeOperation:"source-in",...t})},V0e=d.memo(H0e),W0e=le([Sn],e=>({objects:e.layerState.objects}),{memoizeOptions:{resultEqualityCheck:Ft}}),U0e=e=>{const{...t}=e,{objects:n}=W(W0e);return a.jsx(Ms,{listening:!1,...t,children:n.filter(XN).map((r,o)=>a.jsx(fh,{points:r.points,stroke:"rgb(0,0,0)",strokeWidth:r.strokeWidth*2,tension:0,lineCap:"round",lineJoin:"round",shadowForStrokeEnabled:!1,listening:!1,globalCompositeOperation:r.tool==="brush"?"source-over":"destination-out"},o))})},G0e=d.memo(U0e);var ji=d,K0e=function(t,n,r){const o=ji.useRef("loading"),s=ji.useRef(),[i,l]=ji.useState(0),u=ji.useRef(),p=ji.useRef(),m=ji.useRef();return(u.current!==t||p.current!==n||m.current!==r)&&(o.current="loading",s.current=void 0,u.current=t,p.current=n,m.current=r),ji.useLayoutEffect(function(){if(!t)return;var h=document.createElement("img");function g(){o.current="loaded",s.current=h,l(Math.random())}function x(){o.current="failed",s.current=void 0,l(Math.random())}return h.addEventListener("load",g),h.addEventListener("error",x),n&&(h.crossOrigin=n),r&&(h.referrerPolicy=r),h.src=t,function(){h.removeEventListener("load",g),h.removeEventListener("error",x)}},[t,n,r]),[s.current,o.current]};const q0e=xd(K0e),X0e=({canvasImage:e})=>{const[t,n,r,o]=Ho("colors",["base.400","base.500","base.700","base.900"]),s=sa(t,n),i=sa(r,o),{t:l}=Z();return a.jsxs(Ms,{children:[a.jsx(Os,{x:e.x,y:e.y,width:e.width,height:e.height,fill:s}),a.jsx(g0e,{x:e.x,y:e.y,width:e.width,height:e.height,align:"center",verticalAlign:"middle",fontFamily:'"Inter Variable", sans-serif',fontSize:e.width/16,fontStyle:"600",text:l("common.imageFailedToLoad"),fill:i})]})},Q0e=d.memo(X0e),Y0e=e=>{const{x:t,y:n,imageName:r}=e.canvasImage,{currentData:o,isError:s}=to(r??$r.skipToken),[i,l]=q0e((o==null?void 0:o.image_url)??"",QN.get()?"use-credentials":"anonymous");return s||l==="failed"?a.jsx(Q0e,{canvasImage:e.canvasImage}):a.jsx(C7,{x:t,y:n,image:i,listening:!1})},S7=d.memo(Y0e),Z0e=le([Sn],e=>{const{layerState:{objects:t}}=e;return{objects:t}},{memoizeOptions:{resultEqualityCheck:Ft}}),J0e=()=>{const{objects:e}=W(Z0e);return e?a.jsx(Ms,{name:"outpainting-objects",listening:!1,children:e.map((t,n)=>{if(YN(t))return a.jsx(S7,{canvasImage:t},n);if(ZN(t)){const r=a.jsx(fh,{points:t.points,stroke:t.color?zi(t.color):"rgb(0,0,0)",strokeWidth:t.strokeWidth*2,tension:0,lineCap:"round",lineJoin:"round",shadowForStrokeEnabled:!1,listening:!1,globalCompositeOperation:t.tool==="brush"?"source-over":"destination-out"},n);return t.clip?a.jsx(Ms,{clipX:t.clip.x,clipY:t.clip.y,clipWidth:t.clip.width,clipHeight:t.clip.height,children:r},n):r}else{if(JN(t))return a.jsx(Os,{x:t.x,y:t.y,width:t.width,height:t.height,fill:zi(t.color)},n);if(e9(t))return a.jsx(Os,{x:t.x,y:t.y,width:t.width,height:t.height,fill:"rgb(255, 255, 255)",globalCompositeOperation:"destination-out"},n)}})}):null},eve=d.memo(J0e),tve=le([Sn],e=>{const{layerState:t,shouldShowStagingImage:n,shouldShowStagingOutline:r,boundingBoxCoordinates:o,boundingBoxDimensions:s}=e,{selectedImageIndex:i,images:l,boundingBox:u}=t.stagingArea;return{currentStagingAreaImage:l.length>0&&i!==void 0?l[i]:void 0,isOnFirstImage:i===0,isOnLastImage:i===l.length-1,shouldShowStagingImage:n,shouldShowStagingOutline:r,x:(u==null?void 0:u.x)??o.x,y:(u==null?void 0:u.y)??o.y,width:(u==null?void 0:u.width)??s.width,height:(u==null?void 0:u.height)??s.height}},{memoizeOptions:{resultEqualityCheck:Ft}}),nve=e=>{const{...t}=e,{currentStagingAreaImage:n,shouldShowStagingImage:r,shouldShowStagingOutline:o,x:s,y:i,width:l,height:u}=W(tve);return a.jsxs(Ms,{...t,children:[r&&n&&a.jsx(S7,{canvasImage:n}),o&&a.jsxs(Ms,{children:[a.jsx(Os,{x:s,y:i,width:l,height:u,strokeWidth:1,stroke:"white",strokeScaleEnabled:!1}),a.jsx(Os,{x:s,y:i,width:l,height:u,dash:[4,4],strokeWidth:1,stroke:"black",strokeScaleEnabled:!1})]})]})},rve=d.memo(nve),ove=le([Sn],e=>{const{layerState:{stagingArea:{images:t,selectedImageIndex:n}},shouldShowStagingOutline:r,shouldShowStagingImage:o}=e;return{currentIndex:n,total:t.length,currentStagingAreaImage:t.length>0?t[n]:void 0,shouldShowStagingImage:o,shouldShowStagingOutline:r}},Se),sve=()=>{const e=te(),{currentStagingAreaImage:t,shouldShowStagingImage:n,currentIndex:r,total:o}=W(ove),{t:s}=Z(),i=d.useCallback(()=>{e(Fw(!0))},[e]),l=d.useCallback(()=>{e(Fw(!1))},[e]),u=d.useCallback(()=>e(t9()),[e]),p=d.useCallback(()=>e(n9()),[e]),m=d.useCallback(()=>e(r9()),[e]);et(["left"],u,{enabled:()=>!0,preventDefault:!0}),et(["right"],p,{enabled:()=>!0,preventDefault:!0}),et(["enter"],()=>m,{enabled:()=>!0,preventDefault:!0});const{data:h}=to((t==null?void 0:t.imageName)??$r.skipToken),g=d.useCallback(()=>{e(o9(!n))},[e,n]),x=d.useCallback(()=>{h&&e(s9({imageDTO:h}))},[e,h]),y=d.useCallback(()=>{e(a9())},[e]);return t?a.jsxs(L,{pos:"absolute",bottom:4,gap:2,w:"100%",align:"center",justify:"center",onMouseEnter:i,onMouseLeave:l,children:[a.jsxs(Vt,{isAttached:!0,borderRadius:"base",shadow:"dark-lg",children:[a.jsx(Fe,{tooltip:`${s("unifiedCanvas.previous")} (Left)`,"aria-label":`${s("unifiedCanvas.previous")} (Left)`,icon:a.jsx(_J,{}),onClick:u,colorScheme:"accent",isDisabled:!n}),a.jsx(at,{colorScheme:"base",pointerEvents:"none",isDisabled:!n,minW:20,children:`${r+1}/${o}`}),a.jsx(Fe,{tooltip:`${s("unifiedCanvas.next")} (Right)`,"aria-label":`${s("unifiedCanvas.next")} (Right)`,icon:a.jsx(IJ,{}),onClick:p,colorScheme:"accent",isDisabled:!n})]}),a.jsxs(Vt,{isAttached:!0,borderRadius:"base",shadow:"dark-lg",children:[a.jsx(Fe,{tooltip:`${s("unifiedCanvas.accept")} (Enter)`,"aria-label":`${s("unifiedCanvas.accept")} (Enter)`,icon:a.jsx(iM,{}),onClick:m,colorScheme:"accent"}),a.jsx(Fe,{tooltip:s(n?"unifiedCanvas.showResultsOn":"unifiedCanvas.showResultsOff"),"aria-label":s(n?"unifiedCanvas.showResultsOn":"unifiedCanvas.showResultsOff"),"data-alert":!n,icon:n?a.jsx(FJ,{}):a.jsx(zJ,{}),onClick:g,colorScheme:"accent"}),a.jsx(Fe,{tooltip:s("unifiedCanvas.saveToGallery"),"aria-label":s("unifiedCanvas.saveToGallery"),isDisabled:!h||!h.is_intermediate,icon:a.jsx(lg,{}),onClick:x,colorScheme:"accent"}),a.jsx(Fe,{tooltip:s("unifiedCanvas.discardAll"),"aria-label":s("unifiedCanvas.discardAll"),icon:a.jsx(Ic,{}),onClick:y,colorScheme:"error",fontSize:20})]})]}):null},ave=d.memo(sve),ive=()=>{const e=W(l=>l.canvas.layerState),t=W(l=>l.canvas.boundingBoxCoordinates),n=W(l=>l.canvas.boundingBoxDimensions),r=W(l=>l.canvas.isMaskEnabled),o=W(l=>l.canvas.shouldPreserveMaskedArea),[s,i]=d.useState();return d.useEffect(()=>{i(void 0)},[e,t,n,r,o]),fee(async()=>{const l=await i9(e,t,n,r,o);if(!l)return;const{baseImageData:u,maskImageData:p}=l,m=l9(u,p);i(m)},1e3,[e,t,n,r,o]),s},lve={txt2img:"Text to Image",img2img:"Image to Image",inpaint:"Inpaint",outpaint:"Inpaint"},cve=()=>{const e=ive();return a.jsxs(Ie,{children:["Mode: ",e?lve[e]:"..."]})},uve=d.memo(cve),nc=e=>Math.round(e*100)/100,dve=le([Sn],e=>{const{cursorPosition:t}=e,{cursorX:n,cursorY:r}=t?{cursorX:t.x,cursorY:t.y}:{cursorX:-1,cursorY:-1};return{cursorCoordinatesString:`(${nc(n)}, ${nc(r)})`}},{memoizeOptions:{resultEqualityCheck:Ft}});function fve(){const{cursorCoordinatesString:e}=W(dve),{t}=Z();return a.jsx(Ie,{children:`${t("unifiedCanvas.cursorPosition")}: ${e}`})}const Tx="var(--invokeai-colors-warning-500)",pve=le([Sn],e=>{const{stageDimensions:{width:t,height:n},stageCoordinates:{x:r,y:o},boundingBoxDimensions:{width:s,height:i},scaledBoundingBoxDimensions:{width:l,height:u},boundingBoxCoordinates:{x:p,y:m},stageScale:h,shouldShowCanvasDebugInfo:g,layer:x,boundingBoxScaleMethod:y,shouldPreserveMaskedArea:b}=e;let w="inherit";return(y==="none"&&(s<512||i<512)||y==="manual"&&l*u<512*512)&&(w=Tx),{activeLayerColor:x==="mask"?Tx:"inherit",activeLayerString:x.charAt(0).toUpperCase()+x.slice(1),boundingBoxColor:w,boundingBoxCoordinatesString:`(${nc(p)}, ${nc(m)})`,boundingBoxDimensionsString:`${s}×${i}`,scaledBoundingBoxDimensionsString:`${l}×${u}`,canvasCoordinatesString:`${nc(r)}×${nc(o)}`,canvasDimensionsString:`${t}×${n}`,canvasScaleString:Math.round(h*100),shouldShowCanvasDebugInfo:g,shouldShowBoundingBox:y!=="auto",shouldShowScaledBoundingBox:y!=="none",shouldPreserveMaskedArea:b}},{memoizeOptions:{resultEqualityCheck:Ft}}),mve=()=>{const{activeLayerColor:e,activeLayerString:t,boundingBoxColor:n,boundingBoxCoordinatesString:r,boundingBoxDimensionsString:o,scaledBoundingBoxDimensionsString:s,shouldShowScaledBoundingBox:i,canvasCoordinatesString:l,canvasDimensionsString:u,canvasScaleString:p,shouldShowCanvasDebugInfo:m,shouldShowBoundingBox:h,shouldPreserveMaskedArea:g}=W(pve),{t:x}=Z();return a.jsxs(L,{sx:{flexDirection:"column",position:"absolute",top:0,insetInlineStart:0,opacity:.65,display:"flex",fontSize:"sm",padding:1,px:2,minWidth:48,margin:1,borderRadius:"base",pointerEvents:"none",bg:"base.200",_dark:{bg:"base.800"}},children:[a.jsx(uve,{}),a.jsx(Ie,{style:{color:e},children:`${x("unifiedCanvas.activeLayer")}: ${t}`}),a.jsx(Ie,{children:`${x("unifiedCanvas.canvasScale")}: ${p}%`}),g&&a.jsx(Ie,{style:{color:Tx},children:"Preserve Masked Area: On"}),h&&a.jsx(Ie,{style:{color:n},children:`${x("unifiedCanvas.boundingBox")}: ${o}`}),i&&a.jsx(Ie,{style:{color:n},children:`${x("unifiedCanvas.scaledBoundingBox")}: ${s}`}),m&&a.jsxs(a.Fragment,{children:[a.jsx(Ie,{children:`${x("unifiedCanvas.boundingBoxPosition")}: ${r}`}),a.jsx(Ie,{children:`${x("unifiedCanvas.canvasDimensions")}: ${u}`}),a.jsx(Ie,{children:`${x("unifiedCanvas.canvasPosition")}: ${l}`}),a.jsx(fve,{})]})]})},hve=d.memo(mve),gve=le([xe],({canvas:e,generation:t})=>{const{boundingBoxCoordinates:n,boundingBoxDimensions:r,stageScale:o,isDrawing:s,isTransformingBoundingBox:i,isMovingBoundingBox:l,tool:u,shouldSnapToGrid:p}=e,{aspectRatio:m}=t;return{boundingBoxCoordinates:n,boundingBoxDimensions:r,isDrawing:s,isMovingBoundingBox:l,isTransformingBoundingBox:i,stageScale:o,shouldSnapToGrid:p,tool:u,hitStrokeWidth:20/o,aspectRatio:m}},{memoizeOptions:{resultEqualityCheck:Ft}}),vve=e=>{const{...t}=e,n=te(),{boundingBoxCoordinates:r,boundingBoxDimensions:o,isDrawing:s,isMovingBoundingBox:i,isTransformingBoundingBox:l,stageScale:u,shouldSnapToGrid:p,tool:m,hitStrokeWidth:h,aspectRatio:g}=W(gve),x=d.useRef(null),y=d.useRef(null),[b,w]=d.useState(!1);d.useEffect(()=>{var B;!x.current||!y.current||(x.current.nodes([y.current]),(B=x.current.getLayer())==null||B.batchDraw())},[]);const S=64*u;et("N",()=>{n(nm(!p))});const j=d.useCallback(B=>{if(!p){n(tv({x:Math.floor(B.target.x()),y:Math.floor(B.target.y())}));return}const V=B.target.x(),U=B.target.y(),N=wr(V,64),$=wr(U,64);B.target.x(N),B.target.y($),n(tv({x:N,y:$}))},[n,p]),_=d.useCallback(()=>{if(!y.current)return;const B=y.current,V=B.scaleX(),U=B.scaleY(),N=Math.round(B.width()*V),$=Math.round(B.height()*U),q=Math.round(B.x()),F=Math.round(B.y());if(g){const Q=wr(N/g,64);n(Vo({width:N,height:Q}))}else n(Vo({width:N,height:$}));n(tv({x:p?Mu(q,64):q,y:p?Mu(F,64):F})),B.scaleX(1),B.scaleY(1)},[n,p,g]),E=d.useCallback((B,V,U)=>{const N=B.x%S,$=B.y%S;return{x:Mu(V.x,S)+N,y:Mu(V.y,S)+$}},[S]),I=d.useCallback(()=>{n(nv(!0))},[n]),M=d.useCallback(()=>{n(nv(!1)),n(rv(!1)),n(Yf(!1)),w(!1)},[n]),R=d.useCallback(()=>{n(rv(!0))},[n]),D=d.useCallback(()=>{n(nv(!1)),n(rv(!1)),n(Yf(!1)),w(!1)},[n]),A=d.useCallback(()=>{w(!0)},[]),O=d.useCallback(()=>{!l&&!i&&w(!1)},[i,l]),T=d.useCallback(()=>{n(Yf(!0))},[n]),X=d.useCallback(()=>{n(Yf(!1))},[n]);return a.jsxs(Ms,{...t,children:[a.jsx(Os,{height:o.height,width:o.width,x:r.x,y:r.y,onMouseEnter:T,onMouseOver:T,onMouseLeave:X,onMouseOut:X}),a.jsx(Os,{draggable:!0,fillEnabled:!1,height:o.height,hitStrokeWidth:h,listening:!s&&m==="move",onDragStart:R,onDragEnd:D,onDragMove:j,onMouseDown:R,onMouseOut:O,onMouseOver:A,onMouseEnter:A,onMouseUp:D,onTransform:_,onTransformEnd:M,ref:y,stroke:b?"rgba(255,255,255,0.7)":"white",strokeWidth:(b?8:1)/u,width:o.width,x:r.x,y:r.y}),a.jsx(v0e,{anchorCornerRadius:3,anchorDragBoundFunc:E,anchorFill:"rgba(212,216,234,1)",anchorSize:15,anchorStroke:"rgb(42,42,42)",borderDash:[4,4],borderEnabled:!0,borderStroke:"black",draggable:!1,enabledAnchors:m==="move"?void 0:[],flipEnabled:!1,ignoreStroke:!0,keepRatio:!1,listening:!s&&m==="move",onDragStart:R,onDragEnd:D,onMouseDown:I,onMouseUp:M,onTransformEnd:M,ref:x,rotateEnabled:!1})]})},xve=d.memo(vve),bve=le(Sn,e=>{const{cursorPosition:t,brushSize:n,colorPickerColor:r,maskColor:o,brushColor:s,tool:i,layer:l,shouldShowBrush:u,isMovingBoundingBox:p,isTransformingBoundingBox:m,stageScale:h,stageDimensions:g,boundingBoxCoordinates:x,boundingBoxDimensions:y,shouldRestrictStrokesToBox:b}=e,w=b?{clipX:x.x,clipY:x.y,clipWidth:y.width,clipHeight:y.height}:{};return{cursorPosition:t,brushX:t?t.x:g.width/2,brushY:t?t.y:g.height/2,radius:n/2,colorPickerOuterRadius:Bw/h,colorPickerInnerRadius:(Bw-x1+1)/h,maskColorString:zi({...o,a:.5}),brushColorString:zi(s),colorPickerColorString:zi(r),tool:i,layer:l,shouldShowBrush:u,shouldDrawBrushPreview:!(p||m||!t)&&u,strokeWidth:1.5/h,dotRadius:1.5/h,clip:w}},{memoizeOptions:{resultEqualityCheck:Ft}}),yve=e=>{const{...t}=e,{brushX:n,brushY:r,radius:o,maskColorString:s,tool:i,layer:l,shouldDrawBrushPreview:u,dotRadius:p,strokeWidth:m,brushColorString:h,colorPickerColorString:g,colorPickerInnerRadius:x,colorPickerOuterRadius:y,clip:b}=W(bve);return u?a.jsxs(Ms,{listening:!1,...b,...t,children:[i==="colorPicker"?a.jsxs(a.Fragment,{children:[a.jsx(ki,{x:n,y:r,radius:y,stroke:h,strokeWidth:x1,strokeScaleEnabled:!1}),a.jsx(ki,{x:n,y:r,radius:x,stroke:g,strokeWidth:x1,strokeScaleEnabled:!1})]}):a.jsxs(a.Fragment,{children:[a.jsx(ki,{x:n,y:r,radius:o,fill:l==="mask"?s:h,globalCompositeOperation:i==="eraser"?"destination-out":"source-out"}),a.jsx(ki,{x:n,y:r,radius:o,stroke:"rgba(255,255,255,0.4)",strokeWidth:m*2,strokeEnabled:!0,listening:!1}),a.jsx(ki,{x:n,y:r,radius:o,stroke:"rgba(0,0,0,1)",strokeWidth:m,strokeEnabled:!0,listening:!1})]}),a.jsx(ki,{x:n,y:r,radius:p*2,fill:"rgba(255,255,255,0.4)",listening:!1}),a.jsx(ki,{x:n,y:r,radius:p,fill:"rgba(0,0,0,1)",listening:!1})]}):null},Cve=d.memo(yve),wve=le([Sn,Eo],(e,t)=>{const{isMaskEnabled:n,stageScale:r,shouldShowBoundingBox:o,isTransformingBoundingBox:s,isMouseOverBoundingBox:i,isMovingBoundingBox:l,stageDimensions:u,stageCoordinates:p,tool:m,isMovingStage:h,shouldShowIntermediates:g,shouldShowGrid:x,shouldRestrictStrokesToBox:y,shouldAntialias:b}=e;let w="none";return m==="move"||t?h?w="grabbing":w="grab":s?w=void 0:y&&!i&&(w="default"),{isMaskEnabled:n,isModifyingBoundingBox:s||l,shouldShowBoundingBox:o,shouldShowGrid:x,stageCoordinates:p,stageCursor:w,stageDimensions:u,stageScale:r,tool:m,isStaging:t,shouldShowIntermediates:g,shouldAntialias:b}},Se),Sve=we(x0e,{shouldForwardProp:e=>!["sx"].includes(e)}),kve=()=>{const{isMaskEnabled:e,isModifyingBoundingBox:t,shouldShowBoundingBox:n,shouldShowGrid:r,stageCoordinates:o,stageCursor:s,stageDimensions:i,stageScale:l,tool:u,isStaging:p,shouldShowIntermediates:m,shouldAntialias:h}=W(wve);w0e();const g=te(),x=d.useRef(null),y=d.useRef(null),b=d.useRef(null),w=d.useCallback(B=>{c9(B),y.current=B},[]),S=d.useCallback(B=>{u9(B),b.current=B},[]),j=d.useRef({x:0,y:0}),_=d.useRef(!1),E=O0e(y),I=k0e(y),M=E0e(y,_),R=_0e(y,_,j),D=I0e(),{handleDragStart:A,handleDragMove:O,handleDragEnd:T}=y0e(),X=d.useCallback(B=>B.evt.preventDefault(),[]);return d.useEffect(()=>{if(!x.current)return;const B=new ResizeObserver(N=>{for(const $ of N)if($.contentBoxSize){const{width:q,height:F}=$.contentRect;g(Hw({width:q,height:F}))}});B.observe(x.current);const{width:V,height:U}=x.current.getBoundingClientRect();return g(Hw({width:V,height:U})),()=>{B.disconnect()}},[g]),a.jsxs(L,{id:"canvas-container",ref:x,sx:{position:"relative",height:"100%",width:"100%",borderRadius:"base"},children:[a.jsx(Ie,{sx:{position:"absolute"},children:a.jsxs(Sve,{tabIndex:-1,ref:w,sx:{outline:"none",overflow:"hidden",cursor:s||void 0,canvas:{outline:"none"}},x:o.x,y:o.y,width:i.width,height:i.height,scale:{x:l,y:l},onTouchStart:I,onTouchMove:R,onTouchEnd:M,onMouseDown:I,onMouseLeave:D,onMouseMove:R,onMouseUp:M,onDragStart:A,onDragMove:O,onDragEnd:T,onContextMenu:X,onWheel:E,draggable:(u==="move"||p)&&!t,children:[a.jsx(Eu,{id:"grid",visible:r,children:a.jsx($0e,{})}),a.jsx(Eu,{id:"base",ref:S,listening:!1,imageSmoothingEnabled:h,children:a.jsx(eve,{})}),a.jsxs(Eu,{id:"mask",visible:e&&!p,listening:!1,children:[a.jsx(G0e,{visible:!0,listening:!1}),a.jsx(V0e,{listening:!1})]}),a.jsx(Eu,{children:a.jsx(A0e,{})}),a.jsxs(Eu,{id:"preview",imageSmoothingEnabled:h,children:[!p&&a.jsx(Cve,{visible:u!=="move",listening:!1}),a.jsx(rve,{visible:p}),m&&a.jsx(F0e,{}),a.jsx(xve,{visible:n&&!p})]})]})}),a.jsx(hve,{}),a.jsx(ave,{})]})},jve=d.memo(kve);function _ve(e,t,n=250){const[r,o]=d.useState(0);return d.useEffect(()=>{const s=setTimeout(()=>{r===1&&e(),o(0)},n);return r===2&&t(),()=>clearTimeout(s)},[r,e,t,n]),()=>o(s=>s+1)}const n1={width:6,height:6,borderColor:"base.100"},Ive={".react-colorful__hue-pointer":n1,".react-colorful__saturation-pointer":n1,".react-colorful__alpha-pointer":n1},Pve=e=>a.jsx(Ie,{sx:Ive,children:a.jsx(CO,{...e})}),k7=d.memo(Pve),Eve=le([Sn,Eo],(e,t)=>{const{maskColor:n,layer:r,isMaskEnabled:o,shouldPreserveMaskedArea:s}=e;return{layer:r,maskColor:n,maskColorString:zi(n),isMaskEnabled:o,shouldPreserveMaskedArea:s,isStaging:t}},{memoizeOptions:{resultEqualityCheck:Ft}}),Mve=()=>{const e=te(),{t}=Z(),{layer:n,maskColor:r,isMaskEnabled:o,shouldPreserveMaskedArea:s,isStaging:i}=W(Eve);et(["q"],()=>{l()},{enabled:()=>!i,preventDefault:!0},[n]),et(["shift+c"],()=>{u()},{enabled:()=>!i,preventDefault:!0},[]),et(["h"],()=>{p()},{enabled:()=>!i,preventDefault:!0},[o]);const l=()=>{e(XI(n==="mask"?"base":"mask"))},u=()=>e(GI()),p=()=>e(ib(!o)),m=async()=>{e(p9())};return a.jsx(qd,{triggerComponent:a.jsx(Vt,{children:a.jsx(Fe,{"aria-label":t("unifiedCanvas.maskingOptions"),tooltip:t("unifiedCanvas.maskingOptions"),icon:a.jsx(hM,{}),isChecked:n==="mask",isDisabled:i})}),children:a.jsxs(L,{direction:"column",gap:2,children:[a.jsx(br,{label:`${t("unifiedCanvas.enableMask")} (H)`,isChecked:o,onChange:p}),a.jsx(br,{label:t("unifiedCanvas.preserveMaskedArea"),isChecked:s,onChange:h=>e(d9(h.target.checked))}),a.jsx(Ie,{sx:{paddingTop:2,paddingBottom:2},children:a.jsx(k7,{color:r,onChange:h=>e(f9(h))})}),a.jsx(at,{size:"sm",leftIcon:a.jsx(lg,{}),onClick:m,children:"Save Mask"}),a.jsxs(at,{size:"sm",leftIcon:a.jsx(Br,{}),onClick:u,children:[t("unifiedCanvas.clearMask")," (Shift+C)"]})]})})},Ove=d.memo(Mve),Rve=le([xe,Jn],({canvas:e},t)=>{const{futureLayerStates:n}=e;return{canRedo:n.length>0,activeTabName:t}},{memoizeOptions:{resultEqualityCheck:Ft}});function Dve(){const e=te(),{canRedo:t,activeTabName:n}=W(Rve),{t:r}=Z(),o=()=>{e(m9())};return et(["meta+shift+z","ctrl+shift+z","control+y","meta+y"],()=>{o()},{enabled:()=>t,preventDefault:!0},[n,t]),a.jsx(Fe,{"aria-label":`${r("unifiedCanvas.redo")} (Ctrl+Shift+Z)`,tooltip:`${r("unifiedCanvas.redo")} (Ctrl+Shift+Z)`,icon:a.jsx(JJ,{}),onClick:o,isDisabled:!t})}const Ave=()=>{const e=W(Eo),t=te(),{t:n}=Z();return a.jsxs(kg,{title:n("unifiedCanvas.clearCanvasHistory"),acceptCallback:()=>t(h9()),acceptButtonText:n("unifiedCanvas.clearHistory"),triggerComponent:a.jsx(at,{size:"sm",leftIcon:a.jsx(Br,{}),isDisabled:e,children:n("unifiedCanvas.clearCanvasHistory")}),children:[a.jsx("p",{children:n("unifiedCanvas.clearCanvasHistoryMessage")}),a.jsx("br",{}),a.jsx("p",{children:n("unifiedCanvas.clearCanvasHistoryConfirm")})]})},Tve=d.memo(Ave),Nve=le([Sn],e=>{const{shouldAutoSave:t,shouldCropToBoundingBoxOnSave:n,shouldDarkenOutsideBoundingBox:r,shouldShowCanvasDebugInfo:o,shouldShowGrid:s,shouldShowIntermediates:i,shouldSnapToGrid:l,shouldRestrictStrokesToBox:u,shouldAntialias:p}=e;return{shouldAutoSave:t,shouldCropToBoundingBoxOnSave:n,shouldDarkenOutsideBoundingBox:r,shouldShowCanvasDebugInfo:o,shouldShowGrid:s,shouldShowIntermediates:i,shouldSnapToGrid:l,shouldRestrictStrokesToBox:u,shouldAntialias:p}},{memoizeOptions:{resultEqualityCheck:Ft}}),$ve=()=>{const e=te(),{t}=Z(),{shouldAutoSave:n,shouldCropToBoundingBoxOnSave:r,shouldDarkenOutsideBoundingBox:o,shouldShowCanvasDebugInfo:s,shouldShowGrid:i,shouldShowIntermediates:l,shouldSnapToGrid:u,shouldRestrictStrokesToBox:p,shouldAntialias:m}=W(Nve);et(["n"],()=>{e(nm(!u))},{enabled:!0,preventDefault:!0},[u]);const h=g=>e(nm(g.target.checked));return a.jsx(qd,{isLazy:!1,triggerComponent:a.jsx(Fe,{tooltip:t("unifiedCanvas.canvasSettings"),"aria-label":t("unifiedCanvas.canvasSettings"),icon:a.jsx(yM,{})}),children:a.jsxs(L,{direction:"column",gap:2,children:[a.jsx(br,{label:t("unifiedCanvas.showIntermediates"),isChecked:l,onChange:g=>e(g9(g.target.checked))}),a.jsx(br,{label:t("unifiedCanvas.showGrid"),isChecked:i,onChange:g=>e(v9(g.target.checked))}),a.jsx(br,{label:t("unifiedCanvas.snapToGrid"),isChecked:u,onChange:h}),a.jsx(br,{label:t("unifiedCanvas.darkenOutsideSelection"),isChecked:o,onChange:g=>e(x9(g.target.checked))}),a.jsx(br,{label:t("unifiedCanvas.autoSaveToGallery"),isChecked:n,onChange:g=>e(b9(g.target.checked))}),a.jsx(br,{label:t("unifiedCanvas.saveBoxRegionOnly"),isChecked:r,onChange:g=>e(y9(g.target.checked))}),a.jsx(br,{label:t("unifiedCanvas.limitStrokesToBox"),isChecked:p,onChange:g=>e(C9(g.target.checked))}),a.jsx(br,{label:t("unifiedCanvas.showCanvasDebugInfo"),isChecked:s,onChange:g=>e(w9(g.target.checked))}),a.jsx(br,{label:t("unifiedCanvas.antialiasing"),isChecked:m,onChange:g=>e(S9(g.target.checked))}),a.jsx(Tve,{})]})})},Lve=d.memo($ve),zve=le([xe,Eo],({canvas:e},t)=>{const{tool:n,brushColor:r,brushSize:o}=e;return{tool:n,isStaging:t,brushColor:r,brushSize:o}},{memoizeOptions:{resultEqualityCheck:Ft}}),Fve=()=>{const e=te(),{tool:t,brushColor:n,brushSize:r,isStaging:o}=W(zve),{t:s}=Z();et(["b"],()=>{i()},{enabled:()=>!o,preventDefault:!0},[]),et(["e"],()=>{l()},{enabled:()=>!o,preventDefault:!0},[t]),et(["c"],()=>{u()},{enabled:()=>!o,preventDefault:!0},[t]),et(["shift+f"],()=>{p()},{enabled:()=>!o,preventDefault:!0}),et(["delete","backspace"],()=>{m()},{enabled:()=>!o,preventDefault:!0}),et(["BracketLeft"],()=>{r-5<=5?e(Zf(Math.max(r-1,1))):e(Zf(Math.max(r-5,1)))},{enabled:()=>!o,preventDefault:!0},[r]),et(["BracketRight"],()=>{e(Zf(Math.min(r+5,500)))},{enabled:()=>!o,preventDefault:!0},[r]),et(["Shift+BracketLeft"],()=>{e(ov({...n,a:Fi(n.a-.05,.05,1)}))},{enabled:()=>!o,preventDefault:!0},[n]),et(["Shift+BracketRight"],()=>{e(ov({...n,a:Fi(n.a+.05,.05,1)}))},{enabled:()=>!o,preventDefault:!0},[n]);const i=()=>e(oc("brush")),l=()=>e(oc("eraser")),u=()=>e(oc("colorPicker")),p=()=>e(k9()),m=()=>e(j9());return a.jsxs(Vt,{isAttached:!0,children:[a.jsx(Fe,{"aria-label":`${s("unifiedCanvas.brush")} (B)`,tooltip:`${s("unifiedCanvas.brush")} (B)`,icon:a.jsx(XJ,{}),isChecked:t==="brush"&&!o,onClick:i,isDisabled:o}),a.jsx(Fe,{"aria-label":`${s("unifiedCanvas.eraser")} (E)`,tooltip:`${s("unifiedCanvas.eraser")} (E)`,icon:a.jsx(TJ,{}),isChecked:t==="eraser"&&!o,isDisabled:o,onClick:l}),a.jsx(Fe,{"aria-label":`${s("unifiedCanvas.fillBoundingBox")} (Shift+F)`,tooltip:`${s("unifiedCanvas.fillBoundingBox")} (Shift+F)`,icon:a.jsx(BJ,{}),isDisabled:o,onClick:p}),a.jsx(Fe,{"aria-label":`${s("unifiedCanvas.eraseBoundingBox")} (Del/Backspace)`,tooltip:`${s("unifiedCanvas.eraseBoundingBox")} (Del/Backspace)`,icon:a.jsx(Vc,{style:{transform:"rotate(45deg)"}}),isDisabled:o,onClick:m}),a.jsx(Fe,{"aria-label":`${s("unifiedCanvas.colorPicker")} (C)`,tooltip:`${s("unifiedCanvas.colorPicker")} (C)`,icon:a.jsx(LJ,{}),isChecked:t==="colorPicker"&&!o,isDisabled:o,onClick:u}),a.jsx(qd,{triggerComponent:a.jsx(Fe,{"aria-label":s("unifiedCanvas.brushOptions"),tooltip:s("unifiedCanvas.brushOptions"),icon:a.jsx(xM,{})}),children:a.jsxs(L,{minWidth:60,direction:"column",gap:4,width:"100%",children:[a.jsx(L,{gap:4,justifyContent:"space-between",children:a.jsx(tt,{label:s("unifiedCanvas.brushSize"),value:r,withInput:!0,onChange:h=>e(Zf(h)),sliderNumberInputProps:{max:500}})}),a.jsx(Ie,{sx:{width:"100%",paddingTop:2,paddingBottom:2},children:a.jsx(k7,{color:n,onChange:h=>e(ov(h))})})]})})]})},Bve=d.memo(Fve),Hve=le([xe,Jn],({canvas:e},t)=>{const{pastLayerStates:n}=e;return{canUndo:n.length>0,activeTabName:t}},{memoizeOptions:{resultEqualityCheck:Ft}});function Vve(){const e=te(),{t}=Z(),{canUndo:n,activeTabName:r}=W(Hve),o=()=>{e(_9())};return et(["meta+z","ctrl+z"],()=>{o()},{enabled:()=>n,preventDefault:!0},[r,n]),a.jsx(Fe,{"aria-label":`${t("unifiedCanvas.undo")} (Ctrl+Z)`,tooltip:`${t("unifiedCanvas.undo")} (Ctrl+Z)`,icon:a.jsx(Ud,{}),onClick:o,isDisabled:!n})}const Wve=le([xe,Eo],({canvas:e},t)=>{const{tool:n,shouldCropToBoundingBoxOnSave:r,layer:o,isMaskEnabled:s}=e;return{isStaging:t,isMaskEnabled:s,tool:n,layer:o,shouldCropToBoundingBoxOnSave:r}},{memoizeOptions:{resultEqualityCheck:Ft}}),Uve=()=>{const e=te(),{isStaging:t,isMaskEnabled:n,layer:r,tool:o}=W(Wve),s=v1(),{t:i}=Z(),{isClipboardAPIAvailable:l}=L8(),{getUploadButtonProps:u,getUploadInputProps:p}=Vy({postUploadAction:{type:"SET_CANVAS_INITIAL_IMAGE"}});et(["v"],()=>{m()},{enabled:()=>!t,preventDefault:!0},[]),et(["r"],()=>{g()},{enabled:()=>!0,preventDefault:!0},[s]),et(["shift+m"],()=>{y()},{enabled:()=>!t,preventDefault:!0},[s]),et(["shift+s"],()=>{b()},{enabled:()=>!t,preventDefault:!0},[s]),et(["meta+c","ctrl+c"],()=>{w()},{enabled:()=>!t&&l,preventDefault:!0},[s,l]),et(["shift+d"],()=>{S()},{enabled:()=>!t,preventDefault:!0},[s]);const m=()=>e(oc("move")),h=_ve(()=>g(!1),()=>g(!0)),g=(_=!1)=>{const E=v1();if(!E)return;const I=E.getClientRect({skipTransform:!0});e(P9({contentRect:I,shouldScaleTo1:_}))},x=()=>{e(aI())},y=()=>{e(E9())},b=()=>{e(M9())},w=()=>{l&&e(O9())},S=()=>{e(R9())},j=_=>{const E=_;e(XI(E)),E==="mask"&&!n&&e(ib(!0))};return a.jsxs(L,{sx:{alignItems:"center",gap:2,flexWrap:"wrap"},children:[a.jsx(Ie,{w:24,children:a.jsx(On,{tooltip:`${i("unifiedCanvas.layer")} (Q)`,value:r,data:I9,onChange:j,disabled:t})}),a.jsx(Ove,{}),a.jsx(Bve,{}),a.jsxs(Vt,{isAttached:!0,children:[a.jsx(Fe,{"aria-label":`${i("unifiedCanvas.move")} (V)`,tooltip:`${i("unifiedCanvas.move")} (V)`,icon:a.jsx(PJ,{}),isChecked:o==="move"||t,onClick:m}),a.jsx(Fe,{"aria-label":`${i("unifiedCanvas.resetView")} (R)`,tooltip:`${i("unifiedCanvas.resetView")} (R)`,icon:a.jsx(RJ,{}),onClick:h})]}),a.jsxs(Vt,{isAttached:!0,children:[a.jsx(Fe,{"aria-label":`${i("unifiedCanvas.mergeVisible")} (Shift+M)`,tooltip:`${i("unifiedCanvas.mergeVisible")} (Shift+M)`,icon:a.jsx(GJ,{}),onClick:y,isDisabled:t}),a.jsx(Fe,{"aria-label":`${i("unifiedCanvas.saveToGallery")} (Shift+S)`,tooltip:`${i("unifiedCanvas.saveToGallery")} (Shift+S)`,icon:a.jsx(lg,{}),onClick:b,isDisabled:t}),l&&a.jsx(Fe,{"aria-label":`${i("unifiedCanvas.copyToClipboard")} (Cmd/Ctrl+C)`,tooltip:`${i("unifiedCanvas.copyToClipboard")} (Cmd/Ctrl+C)`,icon:a.jsx(Hc,{}),onClick:w,isDisabled:t}),a.jsx(Fe,{"aria-label":`${i("unifiedCanvas.downloadAsImage")} (Shift+D)`,tooltip:`${i("unifiedCanvas.downloadAsImage")} (Shift+D)`,icon:a.jsx(ig,{}),onClick:S,isDisabled:t})]}),a.jsxs(Vt,{isAttached:!0,children:[a.jsx(Vve,{}),a.jsx(Dve,{})]}),a.jsxs(Vt,{isAttached:!0,children:[a.jsx(Fe,{"aria-label":`${i("common.upload")}`,tooltip:`${i("common.upload")}`,icon:a.jsx(cg,{}),isDisabled:t,...u()}),a.jsx("input",{...p()}),a.jsx(Fe,{"aria-label":`${i("unifiedCanvas.clearCanvas")}`,tooltip:`${i("unifiedCanvas.clearCanvas")}`,icon:a.jsx(Br,{}),onClick:x,colorScheme:"error",isDisabled:t})]}),a.jsx(Vt,{isAttached:!0,children:a.jsx(Lve,{})})]})},Gve=d.memo(Uve),H_={id:"canvas-intial-image",actionType:"SET_CANVAS_INITIAL_IMAGE"},Kve=()=>{const{isOver:e,setNodeRef:t,active:n}=e8({id:"unifiedCanvas",data:H_});return a.jsxs(L,{layerStyle:"first",ref:t,tabIndex:-1,sx:{flexDirection:"column",alignItems:"center",gap:4,p:2,borderRadius:"base",w:"full",h:"full"},children:[a.jsx(Gve,{}),a.jsx(jve,{}),t8(H_,n)&&a.jsx(n8,{isOver:e,label:"Set Canvas Initial Image"})]})},qve=d.memo(Kve),Xve=()=>a.jsx(qve,{}),Qve=d.memo(Xve),Yve=[{id:"txt2img",translationKey:"common.txt2img",icon:a.jsx(Tn,{as:HJ,sx:{boxSize:6,pointerEvents:"none"}}),content:a.jsx(mge,{})},{id:"img2img",translationKey:"common.img2img",icon:a.jsx(Tn,{as:Qi,sx:{boxSize:6,pointerEvents:"none"}}),content:a.jsx(_fe,{})},{id:"unifiedCanvas",translationKey:"common.unifiedCanvas",icon:a.jsx(Tn,{as:woe,sx:{boxSize:6,pointerEvents:"none"}}),content:a.jsx(Qve,{})},{id:"nodes",translationKey:"common.nodes",icon:a.jsx(Tn,{as:Wy,sx:{boxSize:6,pointerEvents:"none"}}),content:a.jsx(She,{})},{id:"modelManager",translationKey:"modelManager.modelManager",icon:a.jsx(Tn,{as:DJ,sx:{boxSize:6,pointerEvents:"none"}}),content:a.jsx(kpe,{})},{id:"queue",translationKey:"queue.queue",icon:a.jsx(Tn,{as:ree,sx:{boxSize:6,pointerEvents:"none"}}),content:a.jsx(fge,{})}],Zve=le([xe],({config:e})=>{const{disabledTabs:t}=e;return Yve.filter(r=>!t.includes(r.id))},{memoizeOptions:{resultEqualityCheck:Ft}}),Jve=448,e1e=448,t1e=360,n1e=["modelManager","queue"],r1e=["modelManager","queue"],o1e=()=>{const e=W(D9),t=W(Jn),n=W(Zve),{t:r}=Z(),o=te(),s=d.useCallback(O=>{O.target instanceof HTMLElement&&O.target.blur()},[]),i=d.useMemo(()=>n.map(O=>a.jsx(Ht,{hasArrow:!0,label:String(r(O.translationKey)),placement:"end",children:a.jsxs(Tr,{onClick:s,children:[a.jsx(f5,{children:String(r(O.translationKey))}),O.icon]})},O.id)),[n,r,s]),l=d.useMemo(()=>n.map(O=>a.jsx(So,{children:O.content},O.id)),[n]),u=d.useCallback(O=>{const T=n[O];T&&o(Xs(T.id))},[o,n]),{minSize:p,isCollapsed:m,setIsCollapsed:h,ref:g,reset:x,expand:y,collapse:b,toggle:w}=Zj(Jve,"pixels"),{ref:S,minSize:j,isCollapsed:_,setIsCollapsed:E,reset:I,expand:M,collapse:R,toggle:D}=Zj(t1e,"pixels");et("f",()=>{_||m?(M(),y()):(b(),R())},[o,_,m]),et(["t","o"],()=>{w()},[o]),et("g",()=>{D()},[o]);const A=Jy();return a.jsxs(rl,{variant:"appTabs",defaultIndex:e,index:e,onChange:u,sx:{flexGrow:1,gap:4},isLazy:!0,children:[a.jsxs(ol,{sx:{pt:2,gap:4,flexDir:"column"},children:[i,a.jsx(ba,{})]}),a.jsxs(Ig,{id:"app",autoSaveId:"app",direction:"horizontal",style:{height:"100%",width:"100%"},storage:A,units:"pixels",children:[!r1e.includes(t)&&a.jsxs(a.Fragment,{children:[a.jsx(Qa,{order:0,id:"side",ref:g,defaultSize:p,minSize:p,onCollapse:h,collapsible:!0,children:t==="nodes"?a.jsx(xie,{}):a.jsx(Xde,{})}),a.jsx(lh,{onDoubleClick:x,collapsedDirection:m?"left":void 0}),a.jsx(wie,{isSidePanelCollapsed:m,sidePanelRef:g})]}),a.jsx(Qa,{id:"main",order:1,minSize:e1e,children:a.jsx(zc,{style:{height:"100%",width:"100%"},children:l})}),!n1e.includes(t)&&a.jsxs(a.Fragment,{children:[a.jsx(lh,{onDoubleClick:I,collapsedDirection:_?"right":void 0}),a.jsx(Qa,{id:"gallery",ref:S,order:2,defaultSize:j,minSize:j,onCollapse:E,collapsible:!0,children:a.jsx(Zoe,{})}),a.jsx(yie,{isGalleryCollapsed:_,galleryPanelRef:S})]})]})]})},s1e=d.memo(o1e),a1e=d.createContext(null),r1={didCatch:!1,error:null};class i1e extends d.Component{constructor(t){super(t),this.resetErrorBoundary=this.resetErrorBoundary.bind(this),this.state=r1}static getDerivedStateFromError(t){return{didCatch:!0,error:t}}resetErrorBoundary(){const{error:t}=this.state;if(t!==null){for(var n,r,o=arguments.length,s=new Array(o),i=0;i0&&arguments[0]!==void 0?arguments[0]:[],t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];return e.length!==t.length||e.some((n,r)=>!Object.is(n,t[r]))}function c1e(e={}){let t;if(e.repoUrl)t=e.repoUrl;else if(e.user&&e.repo)t=`https://github.com/${e.user}/${e.repo}`;else throw new Error("You need to specify either the `repoUrl` option or both the `user` and `repo` options");const n=new URL(`${t}/issues/new`),r=["body","title","labels","template","milestone","assignee","projects"];for(const o of r){let s=e[o];if(s!==void 0){if(o==="labels"||o==="projects"){if(!Array.isArray(s))throw new TypeError(`The \`${o}\` option should be an array`);s=s.join(",")}n.searchParams.set(o,s)}}return n.toString()}const u1e=[EvalError,RangeError,ReferenceError,SyntaxError,TypeError,URIError,globalThis.DOMException,globalThis.AssertionError,globalThis.SystemError].filter(Boolean).map(e=>[e.name,e]),d1e=new Map(u1e),f1e=[{property:"name",enumerable:!1},{property:"message",enumerable:!1},{property:"stack",enumerable:!1},{property:"code",enumerable:!0},{property:"cause",enumerable:!1}],Nx=new WeakSet,p1e=e=>{Nx.add(e);const t=e.toJSON();return Nx.delete(e),t},m1e=e=>d1e.get(e)??Error,j7=({from:e,seen:t,to:n,forceEnumerable:r,maxDepth:o,depth:s,useToJSON:i,serialize:l})=>{if(!n)if(Array.isArray(e))n=[];else if(!l&&V_(e)){const p=m1e(e.name);n=new p}else n={};if(t.push(e),s>=o)return n;if(i&&typeof e.toJSON=="function"&&!Nx.has(e))return p1e(e);const u=p=>j7({from:p,seen:[...t],forceEnumerable:r,maxDepth:o,depth:s,useToJSON:i,serialize:l});for(const[p,m]of Object.entries(e)){if(typeof Buffer=="function"&&Buffer.isBuffer(m)){n[p]="[object Buffer]";continue}if(m!==null&&typeof m=="object"&&typeof m.pipe=="function"){n[p]="[object Stream]";continue}if(typeof m!="function"){if(!m||typeof m!="object"){n[p]=m;continue}if(!t.includes(e[p])){s++,n[p]=u(e[p]);continue}n[p]="[Circular]"}}for(const{property:p,enumerable:m}of f1e)typeof e[p]<"u"&&e[p]!==null&&Object.defineProperty(n,p,{value:V_(e[p])?u(e[p]):e[p],enumerable:r?!0:m,configurable:!0,writable:!0});return n};function h1e(e,t={}){const{maxDepth:n=Number.POSITIVE_INFINITY,useToJSON:r=!0}=t;return typeof e=="object"&&e!==null?j7({from:e,seen:[],forceEnumerable:!0,maxDepth:n,depth:0,useToJSON:r,serialize:!0}):typeof e=="function"?`[Function: ${e.name??"anonymous"}]`:e}function V_(e){return!!e&&typeof e=="object"&&"name"in e&&"message"in e&&"stack"in e}const g1e=({error:e,resetErrorBoundary:t})=>{const n=o5(),r=d.useCallback(()=>{const s=JSON.stringify(h1e(e),null,2);navigator.clipboard.writeText(`\`\`\` +`.replaceAll("black",e),B0e=e=>{const{...t}=e,{maskColorString:n,stageCoordinates:r,stageDimensions:o,stageScale:s}=W(F0e),[i,l]=d.useState(null),[u,p]=d.useState(0),m=d.useRef(null),h=d.useCallback(()=>{p(u+1),setTimeout(h,500)},[u]);return d.useEffect(()=>{if(i)return;const g=new Image;g.onload=()=>{l(g)},g.src=B_(n)},[i,n]),d.useEffect(()=>{i&&(i.src=B_(n))},[i,n]),d.useEffect(()=>{const g=setInterval(()=>p(x=>(x+1)%5),50);return()=>clearInterval(g)},[]),!i||!Ml(r.x)||!Ml(r.y)||!Ml(s)||!Ml(o.width)||!Ml(o.height)?null:a.jsx(Os,{ref:m,offsetX:r.x/s,offsetY:r.y/s,height:o.height/s,width:o.width/s,fillPatternImage:i,fillPatternOffsetY:Ml(u)?u:0,fillPatternRepeat:"repeat",fillPatternScale:{x:1/s,y:1/s},listening:!0,globalCompositeOperation:"source-in",...t})},H0e=d.memo(B0e),V0e=ce([Sn],e=>({objects:e.layerState.objects}),{memoizeOptions:{resultEqualityCheck:Ft}}),W0e=e=>{const{...t}=e,{objects:n}=W(V0e);return a.jsx(Ms,{listening:!1,...t,children:n.filter(XN).map((r,o)=>a.jsx(fh,{points:r.points,stroke:"rgb(0,0,0)",strokeWidth:r.strokeWidth*2,tension:0,lineCap:"round",lineJoin:"round",shadowForStrokeEnabled:!1,listening:!1,globalCompositeOperation:r.tool==="brush"?"source-over":"destination-out"},o))})},U0e=d.memo(W0e);var ji=d,G0e=function(t,n,r){const o=ji.useRef("loading"),s=ji.useRef(),[i,l]=ji.useState(0),u=ji.useRef(),p=ji.useRef(),m=ji.useRef();return(u.current!==t||p.current!==n||m.current!==r)&&(o.current="loading",s.current=void 0,u.current=t,p.current=n,m.current=r),ji.useLayoutEffect(function(){if(!t)return;var h=document.createElement("img");function g(){o.current="loaded",s.current=h,l(Math.random())}function x(){o.current="failed",s.current=void 0,l(Math.random())}return h.addEventListener("load",g),h.addEventListener("error",x),n&&(h.crossOrigin=n),r&&(h.referrerPolicy=r),h.src=t,function(){h.removeEventListener("load",g),h.removeEventListener("error",x)}},[t,n,r]),[s.current,o.current]};const K0e=xd(G0e),q0e=({canvasImage:e})=>{const[t,n,r,o]=Ho("colors",["base.400","base.500","base.700","base.900"]),s=sa(t,n),i=sa(r,o),{t:l}=Z();return a.jsxs(Ms,{children:[a.jsx(Os,{x:e.x,y:e.y,width:e.width,height:e.height,fill:s}),a.jsx(h0e,{x:e.x,y:e.y,width:e.width,height:e.height,align:"center",verticalAlign:"middle",fontFamily:'"Inter Variable", sans-serif',fontSize:e.width/16,fontStyle:"600",text:l("common.imageFailedToLoad"),fill:i})]})},X0e=d.memo(q0e),Q0e=e=>{const{x:t,y:n,imageName:r}=e.canvasImage,{currentData:o,isError:s}=to(r??$r.skipToken),[i,l]=K0e((o==null?void 0:o.image_url)??"",QN.get()?"use-credentials":"anonymous");return s||l==="failed"?a.jsx(X0e,{canvasImage:e.canvasImage}):a.jsx(C7,{x:t,y:n,image:i,listening:!1})},S7=d.memo(Q0e),Y0e=ce([Sn],e=>{const{layerState:{objects:t}}=e;return{objects:t}},{memoizeOptions:{resultEqualityCheck:Ft}}),Z0e=()=>{const{objects:e}=W(Y0e);return e?a.jsx(Ms,{name:"outpainting-objects",listening:!1,children:e.map((t,n)=>{if(YN(t))return a.jsx(S7,{canvasImage:t},n);if(ZN(t)){const r=a.jsx(fh,{points:t.points,stroke:t.color?zi(t.color):"rgb(0,0,0)",strokeWidth:t.strokeWidth*2,tension:0,lineCap:"round",lineJoin:"round",shadowForStrokeEnabled:!1,listening:!1,globalCompositeOperation:t.tool==="brush"?"source-over":"destination-out"},n);return t.clip?a.jsx(Ms,{clipX:t.clip.x,clipY:t.clip.y,clipWidth:t.clip.width,clipHeight:t.clip.height,children:r},n):r}else{if(JN(t))return a.jsx(Os,{x:t.x,y:t.y,width:t.width,height:t.height,fill:zi(t.color)},n);if(e9(t))return a.jsx(Os,{x:t.x,y:t.y,width:t.width,height:t.height,fill:"rgb(255, 255, 255)",globalCompositeOperation:"destination-out"},n)}})}):null},J0e=d.memo(Z0e),eve=ce([Sn],e=>{const{layerState:t,shouldShowStagingImage:n,shouldShowStagingOutline:r,boundingBoxCoordinates:o,boundingBoxDimensions:s}=e,{selectedImageIndex:i,images:l,boundingBox:u}=t.stagingArea;return{currentStagingAreaImage:l.length>0&&i!==void 0?l[i]:void 0,isOnFirstImage:i===0,isOnLastImage:i===l.length-1,shouldShowStagingImage:n,shouldShowStagingOutline:r,x:(u==null?void 0:u.x)??o.x,y:(u==null?void 0:u.y)??o.y,width:(u==null?void 0:u.width)??s.width,height:(u==null?void 0:u.height)??s.height}},{memoizeOptions:{resultEqualityCheck:Ft}}),tve=e=>{const{...t}=e,{currentStagingAreaImage:n,shouldShowStagingImage:r,shouldShowStagingOutline:o,x:s,y:i,width:l,height:u}=W(eve);return a.jsxs(Ms,{...t,children:[r&&n&&a.jsx(S7,{canvasImage:n}),o&&a.jsxs(Ms,{children:[a.jsx(Os,{x:s,y:i,width:l,height:u,strokeWidth:1,stroke:"white",strokeScaleEnabled:!1}),a.jsx(Os,{x:s,y:i,width:l,height:u,dash:[4,4],strokeWidth:1,stroke:"black",strokeScaleEnabled:!1})]})]})},nve=d.memo(tve),rve=ce([Sn],e=>{const{layerState:{stagingArea:{images:t,selectedImageIndex:n}},shouldShowStagingOutline:r,shouldShowStagingImage:o}=e;return{currentIndex:n,total:t.length,currentStagingAreaImage:t.length>0?t[n]:void 0,shouldShowStagingImage:o,shouldShowStagingOutline:r}},je),ove=()=>{const e=te(),{currentStagingAreaImage:t,shouldShowStagingImage:n,currentIndex:r,total:o}=W(rve),{t:s}=Z(),i=d.useCallback(()=>{e(Fw(!0))},[e]),l=d.useCallback(()=>{e(Fw(!1))},[e]),u=d.useCallback(()=>e(t9()),[e]),p=d.useCallback(()=>e(n9()),[e]),m=d.useCallback(()=>e(r9()),[e]);et(["left"],u,{enabled:()=>!0,preventDefault:!0}),et(["right"],p,{enabled:()=>!0,preventDefault:!0}),et(["enter"],()=>m,{enabled:()=>!0,preventDefault:!0});const{data:h}=to((t==null?void 0:t.imageName)??$r.skipToken),g=d.useCallback(()=>{e(o9(!n))},[e,n]),x=d.useCallback(()=>{h&&e(s9({imageDTO:h}))},[e,h]),y=d.useCallback(()=>{e(a9())},[e]);return t?a.jsxs(L,{pos:"absolute",bottom:4,gap:2,w:"100%",align:"center",justify:"center",onMouseEnter:i,onMouseLeave:l,children:[a.jsxs(Vt,{isAttached:!0,borderRadius:"base",shadow:"dark-lg",children:[a.jsx(Fe,{tooltip:`${s("unifiedCanvas.previous")} (Left)`,"aria-label":`${s("unifiedCanvas.previous")} (Left)`,icon:a.jsx(_J,{}),onClick:u,colorScheme:"accent",isDisabled:!n}),a.jsx(at,{colorScheme:"accent",pointerEvents:"none",isDisabled:!n,sx:{background:"base.600",_dark:{background:"base.800"}},children:`${r+1}/${o}`}),a.jsx(Fe,{tooltip:`${s("unifiedCanvas.next")} (Right)`,"aria-label":`${s("unifiedCanvas.next")} (Right)`,icon:a.jsx(IJ,{}),onClick:p,colorScheme:"accent",isDisabled:!n})]}),a.jsxs(Vt,{isAttached:!0,borderRadius:"base",shadow:"dark-lg",children:[a.jsx(Fe,{tooltip:`${s("unifiedCanvas.accept")} (Enter)`,"aria-label":`${s("unifiedCanvas.accept")} (Enter)`,icon:a.jsx(iM,{}),onClick:m,colorScheme:"accent"}),a.jsx(Fe,{tooltip:s(n?"unifiedCanvas.showResultsOn":"unifiedCanvas.showResultsOff"),"aria-label":s(n?"unifiedCanvas.showResultsOn":"unifiedCanvas.showResultsOff"),"data-alert":!n,icon:n?a.jsx(FJ,{}):a.jsx(zJ,{}),onClick:g,colorScheme:"accent"}),a.jsx(Fe,{tooltip:s("unifiedCanvas.saveToGallery"),"aria-label":s("unifiedCanvas.saveToGallery"),isDisabled:!h||!h.is_intermediate,icon:a.jsx(lg,{}),onClick:x,colorScheme:"accent"}),a.jsx(Fe,{tooltip:s("unifiedCanvas.discardAll"),"aria-label":s("unifiedCanvas.discardAll"),icon:a.jsx(Ic,{}),onClick:y,colorScheme:"error",fontSize:20})]})]}):null},sve=d.memo(ove),ave=()=>{const e=W(l=>l.canvas.layerState),t=W(l=>l.canvas.boundingBoxCoordinates),n=W(l=>l.canvas.boundingBoxDimensions),r=W(l=>l.canvas.isMaskEnabled),o=W(l=>l.canvas.shouldPreserveMaskedArea),[s,i]=d.useState();return d.useEffect(()=>{i(void 0)},[e,t,n,r,o]),fee(async()=>{const l=await i9(e,t,n,r,o);if(!l)return;const{baseImageData:u,maskImageData:p}=l,m=l9(u,p);i(m)},1e3,[e,t,n,r,o]),s},ive={txt2img:"Text to Image",img2img:"Image to Image",inpaint:"Inpaint",outpaint:"Inpaint"},lve=()=>{const e=ave();return a.jsxs(Ie,{children:["Mode: ",e?ive[e]:"..."]})},cve=d.memo(lve),nc=e=>Math.round(e*100)/100,uve=ce([Sn],e=>{const{cursorPosition:t}=e,{cursorX:n,cursorY:r}=t?{cursorX:t.x,cursorY:t.y}:{cursorX:-1,cursorY:-1};return{cursorCoordinatesString:`(${nc(n)}, ${nc(r)})`}},{memoizeOptions:{resultEqualityCheck:Ft}});function dve(){const{cursorCoordinatesString:e}=W(uve),{t}=Z();return a.jsx(Ie,{children:`${t("unifiedCanvas.cursorPosition")}: ${e}`})}const Tx="var(--invokeai-colors-warning-500)",fve=ce([Sn],e=>{const{stageDimensions:{width:t,height:n},stageCoordinates:{x:r,y:o},boundingBoxDimensions:{width:s,height:i},scaledBoundingBoxDimensions:{width:l,height:u},boundingBoxCoordinates:{x:p,y:m},stageScale:h,shouldShowCanvasDebugInfo:g,layer:x,boundingBoxScaleMethod:y,shouldPreserveMaskedArea:b}=e;let w="inherit";return(y==="none"&&(s<512||i<512)||y==="manual"&&l*u<512*512)&&(w=Tx),{activeLayerColor:x==="mask"?Tx:"inherit",activeLayerString:x.charAt(0).toUpperCase()+x.slice(1),boundingBoxColor:w,boundingBoxCoordinatesString:`(${nc(p)}, ${nc(m)})`,boundingBoxDimensionsString:`${s}×${i}`,scaledBoundingBoxDimensionsString:`${l}×${u}`,canvasCoordinatesString:`${nc(r)}×${nc(o)}`,canvasDimensionsString:`${t}×${n}`,canvasScaleString:Math.round(h*100),shouldShowCanvasDebugInfo:g,shouldShowBoundingBox:y!=="auto",shouldShowScaledBoundingBox:y!=="none",shouldPreserveMaskedArea:b}},{memoizeOptions:{resultEqualityCheck:Ft}}),pve=()=>{const{activeLayerColor:e,activeLayerString:t,boundingBoxColor:n,boundingBoxCoordinatesString:r,boundingBoxDimensionsString:o,scaledBoundingBoxDimensionsString:s,shouldShowScaledBoundingBox:i,canvasCoordinatesString:l,canvasDimensionsString:u,canvasScaleString:p,shouldShowCanvasDebugInfo:m,shouldShowBoundingBox:h,shouldPreserveMaskedArea:g}=W(fve),{t:x}=Z();return a.jsxs(L,{sx:{flexDirection:"column",position:"absolute",top:0,insetInlineStart:0,opacity:.65,display:"flex",fontSize:"sm",padding:1,px:2,minWidth:48,margin:1,borderRadius:"base",pointerEvents:"none",bg:"base.200",_dark:{bg:"base.800"}},children:[a.jsx(cve,{}),a.jsx(Ie,{style:{color:e},children:`${x("unifiedCanvas.activeLayer")}: ${t}`}),a.jsx(Ie,{children:`${x("unifiedCanvas.canvasScale")}: ${p}%`}),g&&a.jsx(Ie,{style:{color:Tx},children:"Preserve Masked Area: On"}),h&&a.jsx(Ie,{style:{color:n},children:`${x("unifiedCanvas.boundingBox")}: ${o}`}),i&&a.jsx(Ie,{style:{color:n},children:`${x("unifiedCanvas.scaledBoundingBox")}: ${s}`}),m&&a.jsxs(a.Fragment,{children:[a.jsx(Ie,{children:`${x("unifiedCanvas.boundingBoxPosition")}: ${r}`}),a.jsx(Ie,{children:`${x("unifiedCanvas.canvasDimensions")}: ${u}`}),a.jsx(Ie,{children:`${x("unifiedCanvas.canvasPosition")}: ${l}`}),a.jsx(dve,{})]})]})},mve=d.memo(pve),hve=ce([xe],({canvas:e,generation:t})=>{const{boundingBoxCoordinates:n,boundingBoxDimensions:r,stageScale:o,isDrawing:s,isTransformingBoundingBox:i,isMovingBoundingBox:l,tool:u,shouldSnapToGrid:p}=e,{aspectRatio:m}=t;return{boundingBoxCoordinates:n,boundingBoxDimensions:r,isDrawing:s,isMovingBoundingBox:l,isTransformingBoundingBox:i,stageScale:o,shouldSnapToGrid:p,tool:u,hitStrokeWidth:20/o,aspectRatio:m}},{memoizeOptions:{resultEqualityCheck:Ft}}),gve=e=>{const{...t}=e,n=te(),{boundingBoxCoordinates:r,boundingBoxDimensions:o,isDrawing:s,isMovingBoundingBox:i,isTransformingBoundingBox:l,stageScale:u,shouldSnapToGrid:p,tool:m,hitStrokeWidth:h,aspectRatio:g}=W(hve),x=d.useRef(null),y=d.useRef(null),[b,w]=d.useState(!1);d.useEffect(()=>{var B;!x.current||!y.current||(x.current.nodes([y.current]),(B=x.current.getLayer())==null||B.batchDraw())},[]);const S=64*u;et("N",()=>{n(nm(!p))});const j=d.useCallback(B=>{if(!p){n(tv({x:Math.floor(B.target.x()),y:Math.floor(B.target.y())}));return}const V=B.target.x(),U=B.target.y(),N=wr(V,64),$=wr(U,64);B.target.x(N),B.target.y($),n(tv({x:N,y:$}))},[n,p]),_=d.useCallback(()=>{if(!y.current)return;const B=y.current,V=B.scaleX(),U=B.scaleY(),N=Math.round(B.width()*V),$=Math.round(B.height()*U),q=Math.round(B.x()),F=Math.round(B.y());if(g){const Q=wr(N/g,64);n(Vo({width:N,height:Q}))}else n(Vo({width:N,height:$}));n(tv({x:p?Mu(q,64):q,y:p?Mu(F,64):F})),B.scaleX(1),B.scaleY(1)},[n,p,g]),E=d.useCallback((B,V,U)=>{const N=B.x%S,$=B.y%S;return{x:Mu(V.x,S)+N,y:Mu(V.y,S)+$}},[S]),I=d.useCallback(()=>{n(nv(!0))},[n]),M=d.useCallback(()=>{n(nv(!1)),n(rv(!1)),n(Yf(!1)),w(!1)},[n]),R=d.useCallback(()=>{n(rv(!0))},[n]),D=d.useCallback(()=>{n(nv(!1)),n(rv(!1)),n(Yf(!1)),w(!1)},[n]),A=d.useCallback(()=>{w(!0)},[]),O=d.useCallback(()=>{!l&&!i&&w(!1)},[i,l]),T=d.useCallback(()=>{n(Yf(!0))},[n]),X=d.useCallback(()=>{n(Yf(!1))},[n]);return a.jsxs(Ms,{...t,children:[a.jsx(Os,{height:o.height,width:o.width,x:r.x,y:r.y,onMouseEnter:T,onMouseOver:T,onMouseLeave:X,onMouseOut:X}),a.jsx(Os,{draggable:!0,fillEnabled:!1,height:o.height,hitStrokeWidth:h,listening:!s&&m==="move",onDragStart:R,onDragEnd:D,onDragMove:j,onMouseDown:R,onMouseOut:O,onMouseOver:A,onMouseEnter:A,onMouseUp:D,onTransform:_,onTransformEnd:M,ref:y,stroke:b?"rgba(255,255,255,0.7)":"white",strokeWidth:(b?8:1)/u,width:o.width,x:r.x,y:r.y}),a.jsx(g0e,{anchorCornerRadius:3,anchorDragBoundFunc:E,anchorFill:"rgba(212,216,234,1)",anchorSize:15,anchorStroke:"rgb(42,42,42)",borderDash:[4,4],borderEnabled:!0,borderStroke:"black",draggable:!1,enabledAnchors:m==="move"?void 0:[],flipEnabled:!1,ignoreStroke:!0,keepRatio:!1,listening:!s&&m==="move",onDragStart:R,onDragEnd:D,onMouseDown:I,onMouseUp:M,onTransformEnd:M,ref:x,rotateEnabled:!1})]})},vve=d.memo(gve),xve=ce(Sn,e=>{const{cursorPosition:t,brushSize:n,colorPickerColor:r,maskColor:o,brushColor:s,tool:i,layer:l,shouldShowBrush:u,isMovingBoundingBox:p,isTransformingBoundingBox:m,stageScale:h,stageDimensions:g,boundingBoxCoordinates:x,boundingBoxDimensions:y,shouldRestrictStrokesToBox:b}=e,w=b?{clipX:x.x,clipY:x.y,clipWidth:y.width,clipHeight:y.height}:{};return{cursorPosition:t,brushX:t?t.x:g.width/2,brushY:t?t.y:g.height/2,radius:n/2,colorPickerOuterRadius:Bw/h,colorPickerInnerRadius:(Bw-x1+1)/h,maskColorString:zi({...o,a:.5}),brushColorString:zi(s),colorPickerColorString:zi(r),tool:i,layer:l,shouldShowBrush:u,shouldDrawBrushPreview:!(p||m||!t)&&u,strokeWidth:1.5/h,dotRadius:1.5/h,clip:w}},{memoizeOptions:{resultEqualityCheck:Ft}}),bve=e=>{const{...t}=e,{brushX:n,brushY:r,radius:o,maskColorString:s,tool:i,layer:l,shouldDrawBrushPreview:u,dotRadius:p,strokeWidth:m,brushColorString:h,colorPickerColorString:g,colorPickerInnerRadius:x,colorPickerOuterRadius:y,clip:b}=W(xve);return u?a.jsxs(Ms,{listening:!1,...b,...t,children:[i==="colorPicker"?a.jsxs(a.Fragment,{children:[a.jsx(ki,{x:n,y:r,radius:y,stroke:h,strokeWidth:x1,strokeScaleEnabled:!1}),a.jsx(ki,{x:n,y:r,radius:x,stroke:g,strokeWidth:x1,strokeScaleEnabled:!1})]}):a.jsxs(a.Fragment,{children:[a.jsx(ki,{x:n,y:r,radius:o,fill:l==="mask"?s:h,globalCompositeOperation:i==="eraser"?"destination-out":"source-out"}),a.jsx(ki,{x:n,y:r,radius:o,stroke:"rgba(255,255,255,0.4)",strokeWidth:m*2,strokeEnabled:!0,listening:!1}),a.jsx(ki,{x:n,y:r,radius:o,stroke:"rgba(0,0,0,1)",strokeWidth:m,strokeEnabled:!0,listening:!1})]}),a.jsx(ki,{x:n,y:r,radius:p*2,fill:"rgba(255,255,255,0.4)",listening:!1}),a.jsx(ki,{x:n,y:r,radius:p,fill:"rgba(0,0,0,1)",listening:!1})]}):null},yve=d.memo(bve),Cve=ce([Sn,Eo],(e,t)=>{const{isMaskEnabled:n,stageScale:r,shouldShowBoundingBox:o,isTransformingBoundingBox:s,isMouseOverBoundingBox:i,isMovingBoundingBox:l,stageDimensions:u,stageCoordinates:p,tool:m,isMovingStage:h,shouldShowIntermediates:g,shouldShowGrid:x,shouldRestrictStrokesToBox:y,shouldAntialias:b}=e;let w="none";return m==="move"||t?h?w="grabbing":w="grab":s?w=void 0:y&&!i&&(w="default"),{isMaskEnabled:n,isModifyingBoundingBox:s||l,shouldShowBoundingBox:o,shouldShowGrid:x,stageCoordinates:p,stageCursor:w,stageDimensions:u,stageScale:r,tool:m,isStaging:t,shouldShowIntermediates:g,shouldAntialias:b}},je),wve=we(v0e,{shouldForwardProp:e=>!["sx"].includes(e)}),Sve=()=>{const{isMaskEnabled:e,isModifyingBoundingBox:t,shouldShowBoundingBox:n,shouldShowGrid:r,stageCoordinates:o,stageCursor:s,stageDimensions:i,stageScale:l,tool:u,isStaging:p,shouldShowIntermediates:m,shouldAntialias:h}=W(Cve);C0e();const g=te(),x=d.useRef(null),y=d.useRef(null),b=d.useRef(null),w=d.useCallback(B=>{c9(B),y.current=B},[]),S=d.useCallback(B=>{u9(B),b.current=B},[]),j=d.useRef({x:0,y:0}),_=d.useRef(!1),E=M0e(y),I=S0e(y),M=P0e(y,_),R=j0e(y,_,j),D=_0e(),{handleDragStart:A,handleDragMove:O,handleDragEnd:T}=b0e(),X=d.useCallback(B=>B.evt.preventDefault(),[]);return d.useEffect(()=>{if(!x.current)return;const B=new ResizeObserver(N=>{for(const $ of N)if($.contentBoxSize){const{width:q,height:F}=$.contentRect;g(Hw({width:q,height:F}))}});B.observe(x.current);const{width:V,height:U}=x.current.getBoundingClientRect();return g(Hw({width:V,height:U})),()=>{B.disconnect()}},[g]),a.jsxs(L,{id:"canvas-container",ref:x,sx:{position:"relative",height:"100%",width:"100%",borderRadius:"base"},children:[a.jsx(Ie,{sx:{position:"absolute"},children:a.jsxs(wve,{tabIndex:-1,ref:w,sx:{outline:"none",overflow:"hidden",cursor:s||void 0,canvas:{outline:"none"}},x:o.x,y:o.y,width:i.width,height:i.height,scale:{x:l,y:l},onTouchStart:I,onTouchMove:R,onTouchEnd:M,onMouseDown:I,onMouseLeave:D,onMouseMove:R,onMouseUp:M,onDragStart:A,onDragMove:O,onDragEnd:T,onContextMenu:X,onWheel:E,draggable:(u==="move"||p)&&!t,children:[a.jsx(Eu,{id:"grid",visible:r,children:a.jsx(N0e,{})}),a.jsx(Eu,{id:"base",ref:S,listening:!1,imageSmoothingEnabled:h,children:a.jsx(J0e,{})}),a.jsxs(Eu,{id:"mask",visible:e&&!p,listening:!1,children:[a.jsx(U0e,{visible:!0,listening:!1}),a.jsx(H0e,{listening:!1})]}),a.jsx(Eu,{children:a.jsx(D0e,{})}),a.jsxs(Eu,{id:"preview",imageSmoothingEnabled:h,children:[!p&&a.jsx(yve,{visible:u!=="move",listening:!1}),a.jsx(nve,{visible:p}),m&&a.jsx(z0e,{}),a.jsx(vve,{visible:n&&!p})]})]})}),a.jsx(mve,{}),a.jsx(sve,{})]})},kve=d.memo(Sve);function jve(e,t,n=250){const[r,o]=d.useState(0);return d.useEffect(()=>{const s=setTimeout(()=>{r===1&&e(),o(0)},n);return r===2&&t(),()=>clearTimeout(s)},[r,e,t,n]),()=>o(s=>s+1)}const n1={width:6,height:6,borderColor:"base.100"},_ve={".react-colorful__hue-pointer":n1,".react-colorful__saturation-pointer":n1,".react-colorful__alpha-pointer":n1},Ive=e=>a.jsx(Ie,{sx:_ve,children:a.jsx(CO,{...e})}),k7=d.memo(Ive),Pve=ce([Sn,Eo],(e,t)=>{const{maskColor:n,layer:r,isMaskEnabled:o,shouldPreserveMaskedArea:s}=e;return{layer:r,maskColor:n,maskColorString:zi(n),isMaskEnabled:o,shouldPreserveMaskedArea:s,isStaging:t}},{memoizeOptions:{resultEqualityCheck:Ft}}),Eve=()=>{const e=te(),{t}=Z(),{layer:n,maskColor:r,isMaskEnabled:o,shouldPreserveMaskedArea:s,isStaging:i}=W(Pve);et(["q"],()=>{l()},{enabled:()=>!i,preventDefault:!0},[n]),et(["shift+c"],()=>{u()},{enabled:()=>!i,preventDefault:!0},[]),et(["h"],()=>{p()},{enabled:()=>!i,preventDefault:!0},[o]);const l=()=>{e(XI(n==="mask"?"base":"mask"))},u=()=>e(GI()),p=()=>e(ib(!o)),m=async()=>{e(p9())};return a.jsx(qd,{triggerComponent:a.jsx(Vt,{children:a.jsx(Fe,{"aria-label":t("unifiedCanvas.maskingOptions"),tooltip:t("unifiedCanvas.maskingOptions"),icon:a.jsx(hM,{}),isChecked:n==="mask",isDisabled:i})}),children:a.jsxs(L,{direction:"column",gap:2,children:[a.jsx(br,{label:`${t("unifiedCanvas.enableMask")} (H)`,isChecked:o,onChange:p}),a.jsx(br,{label:t("unifiedCanvas.preserveMaskedArea"),isChecked:s,onChange:h=>e(d9(h.target.checked))}),a.jsx(Ie,{sx:{paddingTop:2,paddingBottom:2},children:a.jsx(k7,{color:r,onChange:h=>e(f9(h))})}),a.jsx(at,{size:"sm",leftIcon:a.jsx(lg,{}),onClick:m,children:"Save Mask"}),a.jsxs(at,{size:"sm",leftIcon:a.jsx(Br,{}),onClick:u,children:[t("unifiedCanvas.clearMask")," (Shift+C)"]})]})})},Mve=d.memo(Eve),Ove=ce([xe,Jn],({canvas:e},t)=>{const{futureLayerStates:n}=e;return{canRedo:n.length>0,activeTabName:t}},{memoizeOptions:{resultEqualityCheck:Ft}});function Rve(){const e=te(),{canRedo:t,activeTabName:n}=W(Ove),{t:r}=Z(),o=()=>{e(m9())};return et(["meta+shift+z","ctrl+shift+z","control+y","meta+y"],()=>{o()},{enabled:()=>t,preventDefault:!0},[n,t]),a.jsx(Fe,{"aria-label":`${r("unifiedCanvas.redo")} (Ctrl+Shift+Z)`,tooltip:`${r("unifiedCanvas.redo")} (Ctrl+Shift+Z)`,icon:a.jsx(JJ,{}),onClick:o,isDisabled:!t})}const Dve=()=>{const e=W(Eo),t=te(),{t:n}=Z();return a.jsxs(kg,{title:n("unifiedCanvas.clearCanvasHistory"),acceptCallback:()=>t(h9()),acceptButtonText:n("unifiedCanvas.clearHistory"),triggerComponent:a.jsx(at,{size:"sm",leftIcon:a.jsx(Br,{}),isDisabled:e,children:n("unifiedCanvas.clearCanvasHistory")}),children:[a.jsx("p",{children:n("unifiedCanvas.clearCanvasHistoryMessage")}),a.jsx("br",{}),a.jsx("p",{children:n("unifiedCanvas.clearCanvasHistoryConfirm")})]})},Ave=d.memo(Dve),Tve=ce([Sn],e=>{const{shouldAutoSave:t,shouldCropToBoundingBoxOnSave:n,shouldDarkenOutsideBoundingBox:r,shouldShowCanvasDebugInfo:o,shouldShowGrid:s,shouldShowIntermediates:i,shouldSnapToGrid:l,shouldRestrictStrokesToBox:u,shouldAntialias:p}=e;return{shouldAutoSave:t,shouldCropToBoundingBoxOnSave:n,shouldDarkenOutsideBoundingBox:r,shouldShowCanvasDebugInfo:o,shouldShowGrid:s,shouldShowIntermediates:i,shouldSnapToGrid:l,shouldRestrictStrokesToBox:u,shouldAntialias:p}},{memoizeOptions:{resultEqualityCheck:Ft}}),Nve=()=>{const e=te(),{t}=Z(),{shouldAutoSave:n,shouldCropToBoundingBoxOnSave:r,shouldDarkenOutsideBoundingBox:o,shouldShowCanvasDebugInfo:s,shouldShowGrid:i,shouldShowIntermediates:l,shouldSnapToGrid:u,shouldRestrictStrokesToBox:p,shouldAntialias:m}=W(Tve);et(["n"],()=>{e(nm(!u))},{enabled:!0,preventDefault:!0},[u]);const h=g=>e(nm(g.target.checked));return a.jsx(qd,{isLazy:!1,triggerComponent:a.jsx(Fe,{tooltip:t("unifiedCanvas.canvasSettings"),"aria-label":t("unifiedCanvas.canvasSettings"),icon:a.jsx(yM,{})}),children:a.jsxs(L,{direction:"column",gap:2,children:[a.jsx(br,{label:t("unifiedCanvas.showIntermediates"),isChecked:l,onChange:g=>e(g9(g.target.checked))}),a.jsx(br,{label:t("unifiedCanvas.showGrid"),isChecked:i,onChange:g=>e(v9(g.target.checked))}),a.jsx(br,{label:t("unifiedCanvas.snapToGrid"),isChecked:u,onChange:h}),a.jsx(br,{label:t("unifiedCanvas.darkenOutsideSelection"),isChecked:o,onChange:g=>e(x9(g.target.checked))}),a.jsx(br,{label:t("unifiedCanvas.autoSaveToGallery"),isChecked:n,onChange:g=>e(b9(g.target.checked))}),a.jsx(br,{label:t("unifiedCanvas.saveBoxRegionOnly"),isChecked:r,onChange:g=>e(y9(g.target.checked))}),a.jsx(br,{label:t("unifiedCanvas.limitStrokesToBox"),isChecked:p,onChange:g=>e(C9(g.target.checked))}),a.jsx(br,{label:t("unifiedCanvas.showCanvasDebugInfo"),isChecked:s,onChange:g=>e(w9(g.target.checked))}),a.jsx(br,{label:t("unifiedCanvas.antialiasing"),isChecked:m,onChange:g=>e(S9(g.target.checked))}),a.jsx(Ave,{})]})})},$ve=d.memo(Nve),Lve=ce([xe,Eo],({canvas:e},t)=>{const{tool:n,brushColor:r,brushSize:o}=e;return{tool:n,isStaging:t,brushColor:r,brushSize:o}},{memoizeOptions:{resultEqualityCheck:Ft}}),zve=()=>{const e=te(),{tool:t,brushColor:n,brushSize:r,isStaging:o}=W(Lve),{t:s}=Z();et(["b"],()=>{i()},{enabled:()=>!o,preventDefault:!0},[]),et(["e"],()=>{l()},{enabled:()=>!o,preventDefault:!0},[t]),et(["c"],()=>{u()},{enabled:()=>!o,preventDefault:!0},[t]),et(["shift+f"],()=>{p()},{enabled:()=>!o,preventDefault:!0}),et(["delete","backspace"],()=>{m()},{enabled:()=>!o,preventDefault:!0}),et(["BracketLeft"],()=>{r-5<=5?e(Zf(Math.max(r-1,1))):e(Zf(Math.max(r-5,1)))},{enabled:()=>!o,preventDefault:!0},[r]),et(["BracketRight"],()=>{e(Zf(Math.min(r+5,500)))},{enabled:()=>!o,preventDefault:!0},[r]),et(["Shift+BracketLeft"],()=>{e(ov({...n,a:Fi(n.a-.05,.05,1)}))},{enabled:()=>!o,preventDefault:!0},[n]),et(["Shift+BracketRight"],()=>{e(ov({...n,a:Fi(n.a+.05,.05,1)}))},{enabled:()=>!o,preventDefault:!0},[n]);const i=()=>e(oc("brush")),l=()=>e(oc("eraser")),u=()=>e(oc("colorPicker")),p=()=>e(k9()),m=()=>e(j9());return a.jsxs(Vt,{isAttached:!0,children:[a.jsx(Fe,{"aria-label":`${s("unifiedCanvas.brush")} (B)`,tooltip:`${s("unifiedCanvas.brush")} (B)`,icon:a.jsx(XJ,{}),isChecked:t==="brush"&&!o,onClick:i,isDisabled:o}),a.jsx(Fe,{"aria-label":`${s("unifiedCanvas.eraser")} (E)`,tooltip:`${s("unifiedCanvas.eraser")} (E)`,icon:a.jsx(TJ,{}),isChecked:t==="eraser"&&!o,isDisabled:o,onClick:l}),a.jsx(Fe,{"aria-label":`${s("unifiedCanvas.fillBoundingBox")} (Shift+F)`,tooltip:`${s("unifiedCanvas.fillBoundingBox")} (Shift+F)`,icon:a.jsx(BJ,{}),isDisabled:o,onClick:p}),a.jsx(Fe,{"aria-label":`${s("unifiedCanvas.eraseBoundingBox")} (Del/Backspace)`,tooltip:`${s("unifiedCanvas.eraseBoundingBox")} (Del/Backspace)`,icon:a.jsx(Vc,{style:{transform:"rotate(45deg)"}}),isDisabled:o,onClick:m}),a.jsx(Fe,{"aria-label":`${s("unifiedCanvas.colorPicker")} (C)`,tooltip:`${s("unifiedCanvas.colorPicker")} (C)`,icon:a.jsx(LJ,{}),isChecked:t==="colorPicker"&&!o,isDisabled:o,onClick:u}),a.jsx(qd,{triggerComponent:a.jsx(Fe,{"aria-label":s("unifiedCanvas.brushOptions"),tooltip:s("unifiedCanvas.brushOptions"),icon:a.jsx(xM,{})}),children:a.jsxs(L,{minWidth:60,direction:"column",gap:4,width:"100%",children:[a.jsx(L,{gap:4,justifyContent:"space-between",children:a.jsx(tt,{label:s("unifiedCanvas.brushSize"),value:r,withInput:!0,onChange:h=>e(Zf(h)),sliderNumberInputProps:{max:500}})}),a.jsx(Ie,{sx:{width:"100%",paddingTop:2,paddingBottom:2},children:a.jsx(k7,{color:n,onChange:h=>e(ov(h))})})]})})]})},Fve=d.memo(zve),Bve=ce([xe,Jn],({canvas:e},t)=>{const{pastLayerStates:n}=e;return{canUndo:n.length>0,activeTabName:t}},{memoizeOptions:{resultEqualityCheck:Ft}});function Hve(){const e=te(),{t}=Z(),{canUndo:n,activeTabName:r}=W(Bve),o=()=>{e(_9())};return et(["meta+z","ctrl+z"],()=>{o()},{enabled:()=>n,preventDefault:!0},[r,n]),a.jsx(Fe,{"aria-label":`${t("unifiedCanvas.undo")} (Ctrl+Z)`,tooltip:`${t("unifiedCanvas.undo")} (Ctrl+Z)`,icon:a.jsx(Ud,{}),onClick:o,isDisabled:!n})}const Vve=ce([xe,Eo],({canvas:e},t)=>{const{tool:n,shouldCropToBoundingBoxOnSave:r,layer:o,isMaskEnabled:s}=e;return{isStaging:t,isMaskEnabled:s,tool:n,layer:o,shouldCropToBoundingBoxOnSave:r}},{memoizeOptions:{resultEqualityCheck:Ft}}),Wve=()=>{const e=te(),{isStaging:t,isMaskEnabled:n,layer:r,tool:o}=W(Vve),s=v1(),{t:i}=Z(),{isClipboardAPIAvailable:l}=L8(),{getUploadButtonProps:u,getUploadInputProps:p}=Vy({postUploadAction:{type:"SET_CANVAS_INITIAL_IMAGE"}});et(["v"],()=>{m()},{enabled:()=>!t,preventDefault:!0},[]),et(["r"],()=>{g()},{enabled:()=>!0,preventDefault:!0},[s]),et(["shift+m"],()=>{y()},{enabled:()=>!t,preventDefault:!0},[s]),et(["shift+s"],()=>{b()},{enabled:()=>!t,preventDefault:!0},[s]),et(["meta+c","ctrl+c"],()=>{w()},{enabled:()=>!t&&l,preventDefault:!0},[s,l]),et(["shift+d"],()=>{S()},{enabled:()=>!t,preventDefault:!0},[s]);const m=()=>e(oc("move")),h=jve(()=>g(!1),()=>g(!0)),g=(_=!1)=>{const E=v1();if(!E)return;const I=E.getClientRect({skipTransform:!0});e(P9({contentRect:I,shouldScaleTo1:_}))},x=()=>{e(aI())},y=()=>{e(E9())},b=()=>{e(M9())},w=()=>{l&&e(O9())},S=()=>{e(R9())},j=_=>{const E=_;e(XI(E)),E==="mask"&&!n&&e(ib(!0))};return a.jsxs(L,{sx:{alignItems:"center",gap:2,flexWrap:"wrap"},children:[a.jsx(Ie,{w:24,children:a.jsx(On,{tooltip:`${i("unifiedCanvas.layer")} (Q)`,value:r,data:I9,onChange:j,disabled:t})}),a.jsx(Mve,{}),a.jsx(Fve,{}),a.jsxs(Vt,{isAttached:!0,children:[a.jsx(Fe,{"aria-label":`${i("unifiedCanvas.move")} (V)`,tooltip:`${i("unifiedCanvas.move")} (V)`,icon:a.jsx(PJ,{}),isChecked:o==="move"||t,onClick:m}),a.jsx(Fe,{"aria-label":`${i("unifiedCanvas.resetView")} (R)`,tooltip:`${i("unifiedCanvas.resetView")} (R)`,icon:a.jsx(RJ,{}),onClick:h})]}),a.jsxs(Vt,{isAttached:!0,children:[a.jsx(Fe,{"aria-label":`${i("unifiedCanvas.mergeVisible")} (Shift+M)`,tooltip:`${i("unifiedCanvas.mergeVisible")} (Shift+M)`,icon:a.jsx(GJ,{}),onClick:y,isDisabled:t}),a.jsx(Fe,{"aria-label":`${i("unifiedCanvas.saveToGallery")} (Shift+S)`,tooltip:`${i("unifiedCanvas.saveToGallery")} (Shift+S)`,icon:a.jsx(lg,{}),onClick:b,isDisabled:t}),l&&a.jsx(Fe,{"aria-label":`${i("unifiedCanvas.copyToClipboard")} (Cmd/Ctrl+C)`,tooltip:`${i("unifiedCanvas.copyToClipboard")} (Cmd/Ctrl+C)`,icon:a.jsx(Hc,{}),onClick:w,isDisabled:t}),a.jsx(Fe,{"aria-label":`${i("unifiedCanvas.downloadAsImage")} (Shift+D)`,tooltip:`${i("unifiedCanvas.downloadAsImage")} (Shift+D)`,icon:a.jsx(ig,{}),onClick:S,isDisabled:t})]}),a.jsxs(Vt,{isAttached:!0,children:[a.jsx(Hve,{}),a.jsx(Rve,{})]}),a.jsxs(Vt,{isAttached:!0,children:[a.jsx(Fe,{"aria-label":`${i("common.upload")}`,tooltip:`${i("common.upload")}`,icon:a.jsx(cg,{}),isDisabled:t,...u()}),a.jsx("input",{...p()}),a.jsx(Fe,{"aria-label":`${i("unifiedCanvas.clearCanvas")}`,tooltip:`${i("unifiedCanvas.clearCanvas")}`,icon:a.jsx(Br,{}),onClick:x,colorScheme:"error",isDisabled:t})]}),a.jsx(Vt,{isAttached:!0,children:a.jsx($ve,{})})]})},Uve=d.memo(Wve),H_={id:"canvas-intial-image",actionType:"SET_CANVAS_INITIAL_IMAGE"},Gve=()=>{const{isOver:e,setNodeRef:t,active:n}=e8({id:"unifiedCanvas",data:H_});return a.jsxs(L,{layerStyle:"first",ref:t,tabIndex:-1,sx:{flexDirection:"column",alignItems:"center",gap:4,p:2,borderRadius:"base",w:"full",h:"full"},children:[a.jsx(Uve,{}),a.jsx(kve,{}),t8(H_,n)&&a.jsx(n8,{isOver:e,label:"Set Canvas Initial Image"})]})},Kve=d.memo(Gve),qve=()=>a.jsx(Kve,{}),Xve=d.memo(qve),Qve=[{id:"txt2img",translationKey:"common.txt2img",icon:a.jsx(Tn,{as:HJ,sx:{boxSize:6,pointerEvents:"none"}}),content:a.jsx(pge,{})},{id:"img2img",translationKey:"common.img2img",icon:a.jsx(Tn,{as:Qi,sx:{boxSize:6,pointerEvents:"none"}}),content:a.jsx(jfe,{})},{id:"unifiedCanvas",translationKey:"common.unifiedCanvas",icon:a.jsx(Tn,{as:woe,sx:{boxSize:6,pointerEvents:"none"}}),content:a.jsx(Xve,{})},{id:"nodes",translationKey:"common.nodes",icon:a.jsx(Tn,{as:Wy,sx:{boxSize:6,pointerEvents:"none"}}),content:a.jsx(whe,{})},{id:"modelManager",translationKey:"modelManager.modelManager",icon:a.jsx(Tn,{as:DJ,sx:{boxSize:6,pointerEvents:"none"}}),content:a.jsx(Spe,{})},{id:"queue",translationKey:"queue.queue",icon:a.jsx(Tn,{as:ree,sx:{boxSize:6,pointerEvents:"none"}}),content:a.jsx(dge,{})}],Yve=ce([xe],({config:e})=>{const{disabledTabs:t}=e;return Qve.filter(r=>!t.includes(r.id))},{memoizeOptions:{resultEqualityCheck:Ft}}),Zve=448,Jve=448,e1e=360,t1e=["modelManager","queue"],n1e=["modelManager","queue"],r1e=()=>{const e=W(D9),t=W(Jn),n=W(Yve),{t:r}=Z(),o=te(),s=d.useCallback(O=>{O.target instanceof HTMLElement&&O.target.blur()},[]),i=d.useMemo(()=>n.map(O=>a.jsx(Ht,{hasArrow:!0,label:String(r(O.translationKey)),placement:"end",children:a.jsxs(Tr,{onClick:s,children:[a.jsx(f5,{children:String(r(O.translationKey))}),O.icon]})},O.id)),[n,r,s]),l=d.useMemo(()=>n.map(O=>a.jsx(So,{children:O.content},O.id)),[n]),u=d.useCallback(O=>{const T=n[O];T&&o(Xs(T.id))},[o,n]),{minSize:p,isCollapsed:m,setIsCollapsed:h,ref:g,reset:x,expand:y,collapse:b,toggle:w}=Zj(Zve,"pixels"),{ref:S,minSize:j,isCollapsed:_,setIsCollapsed:E,reset:I,expand:M,collapse:R,toggle:D}=Zj(e1e,"pixels");et("f",()=>{_||m?(M(),y()):(b(),R())},[o,_,m]),et(["t","o"],()=>{w()},[o]),et("g",()=>{D()},[o]);const A=Jy();return a.jsxs(rl,{variant:"appTabs",defaultIndex:e,index:e,onChange:u,sx:{flexGrow:1,gap:4},isLazy:!0,children:[a.jsxs(ol,{sx:{pt:2,gap:4,flexDir:"column"},children:[i,a.jsx(ba,{})]}),a.jsxs(Ig,{id:"app",autoSaveId:"app",direction:"horizontal",style:{height:"100%",width:"100%"},storage:A,units:"pixels",children:[!n1e.includes(t)&&a.jsxs(a.Fragment,{children:[a.jsx(Qa,{order:0,id:"side",ref:g,defaultSize:p,minSize:p,onCollapse:h,collapsible:!0,children:t==="nodes"?a.jsx(xie,{}):a.jsx(qde,{})}),a.jsx(lh,{onDoubleClick:x,collapsedDirection:m?"left":void 0}),a.jsx(wie,{isSidePanelCollapsed:m,sidePanelRef:g})]}),a.jsx(Qa,{id:"main",order:1,minSize:Jve,children:a.jsx(zc,{style:{height:"100%",width:"100%"},children:l})}),!t1e.includes(t)&&a.jsxs(a.Fragment,{children:[a.jsx(lh,{onDoubleClick:I,collapsedDirection:_?"right":void 0}),a.jsx(Qa,{id:"gallery",ref:S,order:2,defaultSize:j,minSize:j,onCollapse:E,collapsible:!0,children:a.jsx(Zoe,{})}),a.jsx(yie,{isGalleryCollapsed:_,galleryPanelRef:S})]})]})]})},o1e=d.memo(r1e),s1e=d.createContext(null),r1={didCatch:!1,error:null};class a1e extends d.Component{constructor(t){super(t),this.resetErrorBoundary=this.resetErrorBoundary.bind(this),this.state=r1}static getDerivedStateFromError(t){return{didCatch:!0,error:t}}resetErrorBoundary(){const{error:t}=this.state;if(t!==null){for(var n,r,o=arguments.length,s=new Array(o),i=0;i0&&arguments[0]!==void 0?arguments[0]:[],t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];return e.length!==t.length||e.some((n,r)=>!Object.is(n,t[r]))}function l1e(e={}){let t;if(e.repoUrl)t=e.repoUrl;else if(e.user&&e.repo)t=`https://github.com/${e.user}/${e.repo}`;else throw new Error("You need to specify either the `repoUrl` option or both the `user` and `repo` options");const n=new URL(`${t}/issues/new`),r=["body","title","labels","template","milestone","assignee","projects"];for(const o of r){let s=e[o];if(s!==void 0){if(o==="labels"||o==="projects"){if(!Array.isArray(s))throw new TypeError(`The \`${o}\` option should be an array`);s=s.join(",")}n.searchParams.set(o,s)}}return n.toString()}const c1e=[EvalError,RangeError,ReferenceError,SyntaxError,TypeError,URIError,globalThis.DOMException,globalThis.AssertionError,globalThis.SystemError].filter(Boolean).map(e=>[e.name,e]),u1e=new Map(c1e),d1e=[{property:"name",enumerable:!1},{property:"message",enumerable:!1},{property:"stack",enumerable:!1},{property:"code",enumerable:!0},{property:"cause",enumerable:!1}],Nx=new WeakSet,f1e=e=>{Nx.add(e);const t=e.toJSON();return Nx.delete(e),t},p1e=e=>u1e.get(e)??Error,j7=({from:e,seen:t,to:n,forceEnumerable:r,maxDepth:o,depth:s,useToJSON:i,serialize:l})=>{if(!n)if(Array.isArray(e))n=[];else if(!l&&V_(e)){const p=p1e(e.name);n=new p}else n={};if(t.push(e),s>=o)return n;if(i&&typeof e.toJSON=="function"&&!Nx.has(e))return f1e(e);const u=p=>j7({from:p,seen:[...t],forceEnumerable:r,maxDepth:o,depth:s,useToJSON:i,serialize:l});for(const[p,m]of Object.entries(e)){if(typeof Buffer=="function"&&Buffer.isBuffer(m)){n[p]="[object Buffer]";continue}if(m!==null&&typeof m=="object"&&typeof m.pipe=="function"){n[p]="[object Stream]";continue}if(typeof m!="function"){if(!m||typeof m!="object"){n[p]=m;continue}if(!t.includes(e[p])){s++,n[p]=u(e[p]);continue}n[p]="[Circular]"}}for(const{property:p,enumerable:m}of d1e)typeof e[p]<"u"&&e[p]!==null&&Object.defineProperty(n,p,{value:V_(e[p])?u(e[p]):e[p],enumerable:r?!0:m,configurable:!0,writable:!0});return n};function m1e(e,t={}){const{maxDepth:n=Number.POSITIVE_INFINITY,useToJSON:r=!0}=t;return typeof e=="object"&&e!==null?j7({from:e,seen:[],forceEnumerable:!0,maxDepth:n,depth:0,useToJSON:r,serialize:!0}):typeof e=="function"?`[Function: ${e.name??"anonymous"}]`:e}function V_(e){return!!e&&typeof e=="object"&&"name"in e&&"message"in e&&"stack"in e}const h1e=({error:e,resetErrorBoundary:t})=>{const n=o5(),r=d.useCallback(()=>{const s=JSON.stringify(m1e(e),null,2);navigator.clipboard.writeText(`\`\`\` ${s} -\`\`\``),n({title:"Error Copied"})},[e,n]),o=d.useMemo(()=>c1e({user:"invoke-ai",repo:"InvokeAI",template:"BUG_REPORT.yml",title:`[bug]: ${e.name}: ${e.message}`}),[e.message,e.name]);return a.jsx(L,{layerStyle:"body",sx:{w:"100vw",h:"100vh",alignItems:"center",justifyContent:"center",p:4},children:a.jsxs(L,{layerStyle:"first",sx:{flexDir:"column",borderRadius:"base",justifyContent:"center",gap:8,p:16},children:[a.jsx(cr,{children:"Something went wrong"}),a.jsx(L,{layerStyle:"second",sx:{px:8,py:4,borderRadius:"base",gap:4,justifyContent:"space-between",alignItems:"center"},children:a.jsxs(ve,{sx:{fontWeight:600,color:"error.500",_dark:{color:"error.400"}},children:[e.name,": ",e.message]})}),a.jsxs(L,{sx:{gap:4},children:[a.jsx(at,{leftIcon:a.jsx(hoe,{}),onClick:t,children:"Reset UI"}),a.jsx(at,{leftIcon:a.jsx(Hc,{}),onClick:r,children:"Copy Error"}),a.jsx(Oh,{href:o,isExternal:!0,children:a.jsx(at,{leftIcon:a.jsx(py,{}),children:"Create Issue"})})]})]})})},v1e=d.memo(g1e),x1e=le([xe],({hotkeys:e})=>{const{shift:t,ctrl:n,meta:r}=e;return{shift:t,ctrl:n,meta:r}},{memoizeOptions:{resultEqualityCheck:Ft}}),b1e=()=>{const e=te(),{shift:t,ctrl:n,meta:r}=W(x1e),{queueBack:o,isDisabled:s,isLoading:i}=W8();et(["ctrl+enter","meta+enter"],o,{enabled:()=>!s&&!i,preventDefault:!0,enableOnFormTags:["input","textarea","select"]},[o,s,i]);const{queueFront:l,isDisabled:u,isLoading:p}=q8();return et(["ctrl+shift+enter","meta+shift+enter"],l,{enabled:()=>!u&&!p,preventDefault:!0,enableOnFormTags:["input","textarea","select"]},[l,u,p]),et("*",()=>{Hp("shift")?!t&&e(Nr(!0)):t&&e(Nr(!1)),Hp("ctrl")?!n&&e(Vw(!0)):n&&e(Vw(!1)),Hp("meta")?!r&&e(Ww(!0)):r&&e(Ww(!1))},{keyup:!0,keydown:!0},[t,n,r]),et("1",()=>{e(Xs("txt2img"))}),et("2",()=>{e(Xs("img2img"))}),et("3",()=>{e(Xs("unifiedCanvas"))}),et("4",()=>{e(Xs("nodes"))}),et("5",()=>{e(Xs("modelManager"))}),null},y1e=d.memo(b1e),C1e=e=>{const t=te(),{recallAllParameters:n}=Sg(),r=sl(),{currentData:o}=to((e==null?void 0:e.imageName)??$r.skipToken),{currentData:s}=A9((e==null?void 0:e.imageName)??$r.skipToken),i=d.useCallback(()=>{o&&(t(hI(o)),t(Xs("unifiedCanvas")),r({title:T9("toast.sentToUnifiedCanvas"),status:"info",duration:2500,isClosable:!0}))},[t,r,o]),l=d.useCallback(()=>{o&&t(vh(o))},[t,o]),u=d.useCallback(()=>{s&&n(s.metadata)},[s]);return d.useEffect(()=>{e&&e.action==="sendToCanvas"&&i()},[e,i]),d.useEffect(()=>{e&&e.action==="sendToImg2Img"&&l()},[e,l]),d.useEffect(()=>{e&&e.action==="useAllParameters"&&u()},[e,u]),{handleSendToCanvas:i,handleSendToImg2Img:l,handleUseAllMetadata:u}},w1e=e=>(C1e(e.selectedImage),null),S1e=d.memo(w1e),k1e={},j1e=({config:e=k1e,selectedImage:t})=>{const n=W(SM),r=pP("system"),o=te(),s=d.useCallback(()=>(localStorage.clear(),location.reload(),!1),[]);d.useEffect(()=>{yt.changeLanguage(n)},[n]),d.useEffect(()=>{II(e)&&(r.info({config:e},"Received config"),o(N9(e)))},[o,e,r]),d.useEffect(()=>{o($9())},[o]);const i=Jh(L9);return a.jsxs(i1e,{onReset:s,FallbackComponent:v1e,children:[a.jsx(Ja,{w:"100vw",h:"100vh",position:"relative",overflow:"hidden",children:a.jsx(nG,{children:a.jsxs(Ja,{sx:{gap:4,p:4,gridAutoRows:"min-content auto",w:"full",h:"full"},children:[i||a.jsx(Oee,{}),a.jsx(L,{sx:{gap:4,w:"full",h:"full"},children:a.jsx(s1e,{})})]})})}),a.jsx(xJ,{}),a.jsx(mJ,{}),a.jsx(UW,{}),a.jsx(y1e,{}),a.jsx(S1e,{selectedImage:t})]})},O1e=d.memo(j1e);export{O1e as default}; +\`\`\``),n({title:"Error Copied"})},[e,n]),o=d.useMemo(()=>l1e({user:"invoke-ai",repo:"InvokeAI",template:"BUG_REPORT.yml",title:`[bug]: ${e.name}: ${e.message}`}),[e.message,e.name]);return a.jsx(L,{layerStyle:"body",sx:{w:"100vw",h:"100vh",alignItems:"center",justifyContent:"center",p:4},children:a.jsxs(L,{layerStyle:"first",sx:{flexDir:"column",borderRadius:"base",justifyContent:"center",gap:8,p:16},children:[a.jsx(cr,{children:"Something went wrong"}),a.jsx(L,{layerStyle:"second",sx:{px:8,py:4,borderRadius:"base",gap:4,justifyContent:"space-between",alignItems:"center"},children:a.jsxs(ve,{sx:{fontWeight:600,color:"error.500",_dark:{color:"error.400"}},children:[e.name,": ",e.message]})}),a.jsxs(L,{sx:{gap:4},children:[a.jsx(at,{leftIcon:a.jsx(hoe,{}),onClick:t,children:"Reset UI"}),a.jsx(at,{leftIcon:a.jsx(Hc,{}),onClick:r,children:"Copy Error"}),a.jsx(Oh,{href:o,isExternal:!0,children:a.jsx(at,{leftIcon:a.jsx(py,{}),children:"Create Issue"})})]})]})})},g1e=d.memo(h1e),v1e=ce([xe],({hotkeys:e})=>{const{shift:t,ctrl:n,meta:r}=e;return{shift:t,ctrl:n,meta:r}},{memoizeOptions:{resultEqualityCheck:Ft}}),x1e=()=>{const e=te(),{shift:t,ctrl:n,meta:r}=W(v1e),{queueBack:o,isDisabled:s,isLoading:i}=W8();et(["ctrl+enter","meta+enter"],o,{enabled:()=>!s&&!i,preventDefault:!0,enableOnFormTags:["input","textarea","select"]},[o,s,i]);const{queueFront:l,isDisabled:u,isLoading:p}=q8();return et(["ctrl+shift+enter","meta+shift+enter"],l,{enabled:()=>!u&&!p,preventDefault:!0,enableOnFormTags:["input","textarea","select"]},[l,u,p]),et("*",()=>{Hp("shift")?!t&&e(Nr(!0)):t&&e(Nr(!1)),Hp("ctrl")?!n&&e(Vw(!0)):n&&e(Vw(!1)),Hp("meta")?!r&&e(Ww(!0)):r&&e(Ww(!1))},{keyup:!0,keydown:!0},[t,n,r]),et("1",()=>{e(Xs("txt2img"))}),et("2",()=>{e(Xs("img2img"))}),et("3",()=>{e(Xs("unifiedCanvas"))}),et("4",()=>{e(Xs("nodes"))}),et("5",()=>{e(Xs("modelManager"))}),null},b1e=d.memo(x1e),y1e=e=>{const t=te(),{recallAllParameters:n}=Sg(),r=sl(),{currentData:o}=to((e==null?void 0:e.imageName)??$r.skipToken),{currentData:s}=A9((e==null?void 0:e.imageName)??$r.skipToken),i=d.useCallback(()=>{o&&(t(hI(o)),t(Xs("unifiedCanvas")),r({title:T9("toast.sentToUnifiedCanvas"),status:"info",duration:2500,isClosable:!0}))},[t,r,o]),l=d.useCallback(()=>{o&&t(vh(o))},[t,o]),u=d.useCallback(()=>{s&&n(s.metadata)},[s]);return d.useEffect(()=>{e&&e.action==="sendToCanvas"&&i()},[e,i]),d.useEffect(()=>{e&&e.action==="sendToImg2Img"&&l()},[e,l]),d.useEffect(()=>{e&&e.action==="useAllParameters"&&u()},[e,u]),{handleSendToCanvas:i,handleSendToImg2Img:l,handleUseAllMetadata:u}},C1e=e=>(y1e(e.selectedImage),null),w1e=d.memo(C1e),S1e={},k1e=({config:e=S1e,selectedImage:t})=>{const n=W(SM),r=pP("system"),o=te(),s=d.useCallback(()=>(localStorage.clear(),location.reload(),!1),[]);d.useEffect(()=>{yt.changeLanguage(n)},[n]),d.useEffect(()=>{II(e)&&(r.info({config:e},"Received config"),o(N9(e)))},[o,e,r]),d.useEffect(()=>{o($9())},[o]);const i=Jh(L9);return a.jsxs(a1e,{onReset:s,FallbackComponent:g1e,children:[a.jsx(Ja,{w:"100vw",h:"100vh",position:"relative",overflow:"hidden",children:a.jsx(nG,{children:a.jsxs(Ja,{sx:{gap:4,p:4,gridAutoRows:"min-content auto",w:"full",h:"full"},children:[i||a.jsx(Oee,{}),a.jsx(L,{sx:{gap:4,w:"full",h:"full"},children:a.jsx(o1e,{})})]})})}),a.jsx(xJ,{}),a.jsx(mJ,{}),a.jsx(UW,{}),a.jsx(b1e,{}),a.jsx(w1e,{selectedImage:t})]})},M1e=d.memo(k1e);export{M1e as default}; diff --git a/invokeai/frontend/web/dist/assets/MantineProvider-23f4942b.js b/invokeai/frontend/web/dist/assets/MantineProvider-a057bfc9.js similarity index 99% rename from invokeai/frontend/web/dist/assets/MantineProvider-23f4942b.js rename to invokeai/frontend/web/dist/assets/MantineProvider-a057bfc9.js index 3effb7bc01..c92a7c218a 100644 --- a/invokeai/frontend/web/dist/assets/MantineProvider-23f4942b.js +++ b/invokeai/frontend/web/dist/assets/MantineProvider-a057bfc9.js @@ -1 +1 @@ -import{aa as d,hY as _,v as h,i7 as X}from"./index-285abe50.js";const Y={dark:["#C1C2C5","#A6A7AB","#909296","#5c5f66","#373A40","#2C2E33","#25262b","#1A1B1E","#141517","#101113"],gray:["#f8f9fa","#f1f3f5","#e9ecef","#dee2e6","#ced4da","#adb5bd","#868e96","#495057","#343a40","#212529"],red:["#fff5f5","#ffe3e3","#ffc9c9","#ffa8a8","#ff8787","#ff6b6b","#fa5252","#f03e3e","#e03131","#c92a2a"],pink:["#fff0f6","#ffdeeb","#fcc2d7","#faa2c1","#f783ac","#f06595","#e64980","#d6336c","#c2255c","#a61e4d"],grape:["#f8f0fc","#f3d9fa","#eebefa","#e599f7","#da77f2","#cc5de8","#be4bdb","#ae3ec9","#9c36b5","#862e9c"],violet:["#f3f0ff","#e5dbff","#d0bfff","#b197fc","#9775fa","#845ef7","#7950f2","#7048e8","#6741d9","#5f3dc4"],indigo:["#edf2ff","#dbe4ff","#bac8ff","#91a7ff","#748ffc","#5c7cfa","#4c6ef5","#4263eb","#3b5bdb","#364fc7"],blue:["#e7f5ff","#d0ebff","#a5d8ff","#74c0fc","#4dabf7","#339af0","#228be6","#1c7ed6","#1971c2","#1864ab"],cyan:["#e3fafc","#c5f6fa","#99e9f2","#66d9e8","#3bc9db","#22b8cf","#15aabf","#1098ad","#0c8599","#0b7285"],teal:["#e6fcf5","#c3fae8","#96f2d7","#63e6be","#38d9a9","#20c997","#12b886","#0ca678","#099268","#087f5b"],green:["#ebfbee","#d3f9d8","#b2f2bb","#8ce99a","#69db7c","#51cf66","#40c057","#37b24d","#2f9e44","#2b8a3e"],lime:["#f4fce3","#e9fac8","#d8f5a2","#c0eb75","#a9e34b","#94d82d","#82c91e","#74b816","#66a80f","#5c940d"],yellow:["#fff9db","#fff3bf","#ffec99","#ffe066","#ffd43b","#fcc419","#fab005","#f59f00","#f08c00","#e67700"],orange:["#fff4e6","#ffe8cc","#ffd8a8","#ffc078","#ffa94d","#ff922b","#fd7e14","#f76707","#e8590c","#d9480f"]};function q(r){return()=>({fontFamily:r.fontFamily||"sans-serif"})}var J=Object.defineProperty,x=Object.getOwnPropertySymbols,K=Object.prototype.hasOwnProperty,Q=Object.prototype.propertyIsEnumerable,z=(r,e,o)=>e in r?J(r,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):r[e]=o,j=(r,e)=>{for(var o in e||(e={}))K.call(e,o)&&z(r,o,e[o]);if(x)for(var o of x(e))Q.call(e,o)&&z(r,o,e[o]);return r};function Z(r){return e=>({WebkitTapHighlightColor:"transparent",[e||"&:focus"]:j({},r.focusRing==="always"||r.focusRing==="auto"?r.focusRingStyles.styles(r):r.focusRingStyles.resetStyles(r)),[e?e.replace(":focus",":focus:not(:focus-visible)"):"&:focus:not(:focus-visible)"]:j({},r.focusRing==="auto"||r.focusRing==="never"?r.focusRingStyles.resetStyles(r):null)})}function y(r){return e=>typeof r.primaryShade=="number"?r.primaryShade:r.primaryShade[e||r.colorScheme]}function w(r){const e=y(r);return(o,n,a=!0,t=!0)=>{if(typeof o=="string"&&o.includes(".")){const[s,l]=o.split("."),g=parseInt(l,10);if(s in r.colors&&g>=0&&g<10)return r.colors[s][typeof n=="number"&&!t?n:g]}const i=typeof n=="number"?n:e();return o in r.colors?r.colors[o][i]:a?r.colors[r.primaryColor][i]:o}}function T(r){let e="";for(let o=1;o{const a={from:(n==null?void 0:n.from)||r.defaultGradient.from,to:(n==null?void 0:n.to)||r.defaultGradient.to,deg:(n==null?void 0:n.deg)||r.defaultGradient.deg};return`linear-gradient(${a.deg}deg, ${e(a.from,o(),!1)} 0%, ${e(a.to,o(),!1)} 100%)`}}function D(r){return e=>{if(typeof e=="number")return`${e/16}${r}`;if(typeof e=="string"){const o=e.replace("px","");if(!Number.isNaN(Number(o)))return`${Number(o)/16}${r}`}return e}}const u=D("rem"),k=D("em");function V({size:r,sizes:e,units:o}){return r in e?e[r]:typeof r=="number"?o==="em"?k(r):u(r):r||e.md}function S(r){return typeof r=="number"?r:typeof r=="string"&&r.includes("rem")?Number(r.replace("rem",""))*16:typeof r=="string"&&r.includes("em")?Number(r.replace("em",""))*16:Number(r)}function er(r){return e=>`@media (min-width: ${k(S(V({size:e,sizes:r.breakpoints})))})`}function or(r){return e=>`@media (max-width: ${k(S(V({size:e,sizes:r.breakpoints}))-1)})`}function nr(r){return/^#?([0-9A-F]{3}){1,2}$/i.test(r)}function tr(r){let e=r.replace("#","");if(e.length===3){const i=e.split("");e=[i[0],i[0],i[1],i[1],i[2],i[2]].join("")}const o=parseInt(e,16),n=o>>16&255,a=o>>8&255,t=o&255;return{r:n,g:a,b:t,a:1}}function ar(r){const[e,o,n,a]=r.replace(/[^0-9,.]/g,"").split(",").map(Number);return{r:e,g:o,b:n,a:a||1}}function C(r){return nr(r)?tr(r):r.startsWith("rgb")?ar(r):{r:0,g:0,b:0,a:1}}function p(r,e){if(typeof r!="string"||e>1||e<0)return"rgba(0, 0, 0, 1)";if(r.startsWith("var(--"))return r;const{r:o,g:n,b:a}=C(r);return`rgba(${o}, ${n}, ${a}, ${e})`}function ir(r=0){return{position:"absolute",top:u(r),right:u(r),left:u(r),bottom:u(r)}}function sr(r,e){if(typeof r=="string"&&r.startsWith("var(--"))return r;const{r:o,g:n,b:a,a:t}=C(r),i=1-e,s=l=>Math.round(l*i);return`rgba(${s(o)}, ${s(n)}, ${s(a)}, ${t})`}function lr(r,e){if(typeof r=="string"&&r.startsWith("var(--"))return r;const{r:o,g:n,b:a,a:t}=C(r),i=s=>Math.round(s+(255-s)*e);return`rgba(${i(o)}, ${i(n)}, ${i(a)}, ${t})`}function fr(r){return e=>{if(typeof e=="number")return u(e);const o=typeof r.defaultRadius=="number"?r.defaultRadius:r.radius[r.defaultRadius]||r.defaultRadius;return r.radius[e]||e||o}}function cr(r,e){if(typeof r=="string"&&r.includes(".")){const[o,n]=r.split("."),a=parseInt(n,10);if(o in e.colors&&a>=0&&a<10)return{isSplittedColor:!0,key:o,shade:a}}return{isSplittedColor:!1}}function dr(r){const e=w(r),o=y(r),n=G(r);return({variant:a,color:t,gradient:i,primaryFallback:s})=>{const l=cr(t,r);switch(a){case"light":return{border:"transparent",background:p(e(t,r.colorScheme==="dark"?8:0,s,!1),r.colorScheme==="dark"?.2:1),color:t==="dark"?r.colorScheme==="dark"?r.colors.dark[0]:r.colors.dark[9]:e(t,r.colorScheme==="dark"?2:o("light")),hover:p(e(t,r.colorScheme==="dark"?7:1,s,!1),r.colorScheme==="dark"?.25:.65)};case"subtle":return{border:"transparent",background:"transparent",color:t==="dark"?r.colorScheme==="dark"?r.colors.dark[0]:r.colors.dark[9]:e(t,r.colorScheme==="dark"?2:o("light")),hover:p(e(t,r.colorScheme==="dark"?8:0,s,!1),r.colorScheme==="dark"?.2:1)};case"outline":return{border:e(t,r.colorScheme==="dark"?5:o("light")),background:"transparent",color:e(t,r.colorScheme==="dark"?5:o("light")),hover:r.colorScheme==="dark"?p(e(t,5,s,!1),.05):p(e(t,0,s,!1),.35)};case"default":return{border:r.colorScheme==="dark"?r.colors.dark[4]:r.colors.gray[4],background:r.colorScheme==="dark"?r.colors.dark[6]:r.white,color:r.colorScheme==="dark"?r.white:r.black,hover:r.colorScheme==="dark"?r.colors.dark[5]:r.colors.gray[0]};case"white":return{border:"transparent",background:r.white,color:e(t,o()),hover:null};case"transparent":return{border:"transparent",color:t==="dark"?r.colorScheme==="dark"?r.colors.dark[0]:r.colors.dark[9]:e(t,r.colorScheme==="dark"?2:o("light")),background:"transparent",hover:null};case"gradient":return{background:n(i),color:r.white,border:"transparent",hover:null};default:{const g=o(),$=l.isSplittedColor?l.shade:g,O=l.isSplittedColor?l.key:t;return{border:"transparent",background:e(O,$,s),color:r.white,hover:e(O,$===9?8:$+1)}}}}}function ur(r){return e=>{const o=y(r)(e);return r.colors[r.primaryColor][o]}}function pr(r){return{"@media (hover: hover)":{"&:hover":r},"@media (hover: none)":{"&:active":r}}}function gr(r){return()=>({userSelect:"none",color:r.colorScheme==="dark"?r.colors.dark[3]:r.colors.gray[5]})}function br(r){return()=>r.colorScheme==="dark"?r.colors.dark[2]:r.colors.gray[6]}const f={fontStyles:q,themeColor:w,focusStyles:Z,linearGradient:B,radialGradient:rr,smallerThan:or,largerThan:er,rgba:p,cover:ir,darken:sr,lighten:lr,radius:fr,variant:dr,primaryShade:y,hover:pr,gradient:G,primaryColor:ur,placeholderStyles:gr,dimmed:br};var mr=Object.defineProperty,yr=Object.defineProperties,Sr=Object.getOwnPropertyDescriptors,R=Object.getOwnPropertySymbols,vr=Object.prototype.hasOwnProperty,_r=Object.prototype.propertyIsEnumerable,F=(r,e,o)=>e in r?mr(r,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):r[e]=o,hr=(r,e)=>{for(var o in e||(e={}))vr.call(e,o)&&F(r,o,e[o]);if(R)for(var o of R(e))_r.call(e,o)&&F(r,o,e[o]);return r},kr=(r,e)=>yr(r,Sr(e));function U(r){return kr(hr({},r),{fn:{fontStyles:f.fontStyles(r),themeColor:f.themeColor(r),focusStyles:f.focusStyles(r),largerThan:f.largerThan(r),smallerThan:f.smallerThan(r),radialGradient:f.radialGradient,linearGradient:f.linearGradient,gradient:f.gradient(r),rgba:f.rgba,cover:f.cover,lighten:f.lighten,darken:f.darken,primaryShade:f.primaryShade(r),radius:f.radius(r),variant:f.variant(r),hover:f.hover,primaryColor:f.primaryColor(r),placeholderStyles:f.placeholderStyles(r),dimmed:f.dimmed(r)}})}const $r={dir:"ltr",primaryShade:{light:6,dark:8},focusRing:"auto",loader:"oval",colorScheme:"light",white:"#fff",black:"#000",defaultRadius:"sm",transitionTimingFunction:"ease",colors:Y,lineHeight:1.55,fontFamily:"-apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica, Arial, sans-serif, Apple Color Emoji, Segoe UI Emoji",fontFamilyMonospace:"ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, Liberation Mono, Courier New, monospace",primaryColor:"blue",respectReducedMotion:!0,cursorType:"default",defaultGradient:{from:"indigo",to:"cyan",deg:45},shadows:{xs:"0 0.0625rem 0.1875rem rgba(0, 0, 0, 0.05), 0 0.0625rem 0.125rem rgba(0, 0, 0, 0.1)",sm:"0 0.0625rem 0.1875rem rgba(0, 0, 0, 0.05), rgba(0, 0, 0, 0.05) 0 0.625rem 0.9375rem -0.3125rem, rgba(0, 0, 0, 0.04) 0 0.4375rem 0.4375rem -0.3125rem",md:"0 0.0625rem 0.1875rem rgba(0, 0, 0, 0.05), rgba(0, 0, 0, 0.05) 0 1.25rem 1.5625rem -0.3125rem, rgba(0, 0, 0, 0.04) 0 0.625rem 0.625rem -0.3125rem",lg:"0 0.0625rem 0.1875rem rgba(0, 0, 0, 0.05), rgba(0, 0, 0, 0.05) 0 1.75rem 1.4375rem -0.4375rem, rgba(0, 0, 0, 0.04) 0 0.75rem 0.75rem -0.4375rem",xl:"0 0.0625rem 0.1875rem rgba(0, 0, 0, 0.05), rgba(0, 0, 0, 0.05) 0 2.25rem 1.75rem -0.4375rem, rgba(0, 0, 0, 0.04) 0 1.0625rem 1.0625rem -0.4375rem"},fontSizes:{xs:"0.75rem",sm:"0.875rem",md:"1rem",lg:"1.125rem",xl:"1.25rem"},radius:{xs:"0.125rem",sm:"0.25rem",md:"0.5rem",lg:"1rem",xl:"2rem"},spacing:{xs:"0.625rem",sm:"0.75rem",md:"1rem",lg:"1.25rem",xl:"1.5rem"},breakpoints:{xs:"36em",sm:"48em",md:"62em",lg:"75em",xl:"88em"},headings:{fontFamily:"-apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica, Arial, sans-serif, Apple Color Emoji, Segoe UI Emoji",fontWeight:700,sizes:{h1:{fontSize:"2.125rem",lineHeight:1.3,fontWeight:void 0},h2:{fontSize:"1.625rem",lineHeight:1.35,fontWeight:void 0},h3:{fontSize:"1.375rem",lineHeight:1.4,fontWeight:void 0},h4:{fontSize:"1.125rem",lineHeight:1.45,fontWeight:void 0},h5:{fontSize:"1rem",lineHeight:1.5,fontWeight:void 0},h6:{fontSize:"0.875rem",lineHeight:1.5,fontWeight:void 0}}},other:{},components:{},activeStyles:{transform:"translateY(0.0625rem)"},datesLocale:"en",globalStyles:void 0,focusRingStyles:{styles:r=>({outlineOffset:"0.125rem",outline:`0.125rem solid ${r.colors[r.primaryColor][r.colorScheme==="dark"?7:5]}`}),resetStyles:()=>({outline:"none"}),inputStyles:r=>({outline:"none",borderColor:r.colors[r.primaryColor][typeof r.primaryShade=="object"?r.primaryShade[r.colorScheme]:r.primaryShade]})}},E=U($r);var Pr=Object.defineProperty,wr=Object.defineProperties,Cr=Object.getOwnPropertyDescriptors,H=Object.getOwnPropertySymbols,Er=Object.prototype.hasOwnProperty,Or=Object.prototype.propertyIsEnumerable,M=(r,e,o)=>e in r?Pr(r,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):r[e]=o,xr=(r,e)=>{for(var o in e||(e={}))Er.call(e,o)&&M(r,o,e[o]);if(H)for(var o of H(e))Or.call(e,o)&&M(r,o,e[o]);return r},zr=(r,e)=>wr(r,Cr(e));function jr({theme:r}){return d.createElement(_,{styles:{"*, *::before, *::after":{boxSizing:"border-box"},html:{colorScheme:r.colorScheme==="dark"?"dark":"light"},body:zr(xr({},r.fn.fontStyles()),{backgroundColor:r.colorScheme==="dark"?r.colors.dark[7]:r.white,color:r.colorScheme==="dark"?r.colors.dark[0]:r.black,lineHeight:r.lineHeight,fontSize:r.fontSizes.md,WebkitFontSmoothing:"antialiased",MozOsxFontSmoothing:"grayscale"})}})}function b(r,e,o,n=u){Object.keys(e).forEach(a=>{r[`--mantine-${o}-${a}`]=n(e[a])})}function Rr({theme:r}){const e={"--mantine-color-white":r.white,"--mantine-color-black":r.black,"--mantine-transition-timing-function":r.transitionTimingFunction,"--mantine-line-height":`${r.lineHeight}`,"--mantine-font-family":r.fontFamily,"--mantine-font-family-monospace":r.fontFamilyMonospace,"--mantine-font-family-headings":r.headings.fontFamily,"--mantine-heading-font-weight":`${r.headings.fontWeight}`};b(e,r.shadows,"shadow"),b(e,r.fontSizes,"font-size"),b(e,r.radius,"radius"),b(e,r.spacing,"spacing"),b(e,r.breakpoints,"breakpoints",k),Object.keys(r.colors).forEach(n=>{r.colors[n].forEach((a,t)=>{e[`--mantine-color-${n}-${t}`]=a})});const o=r.headings.sizes;return Object.keys(o).forEach(n=>{e[`--mantine-${n}-font-size`]=o[n].fontSize,e[`--mantine-${n}-line-height`]=`${o[n].lineHeight}`}),d.createElement(_,{styles:{":root":e}})}var Fr=Object.defineProperty,Hr=Object.defineProperties,Mr=Object.getOwnPropertyDescriptors,I=Object.getOwnPropertySymbols,Ir=Object.prototype.hasOwnProperty,Ar=Object.prototype.propertyIsEnumerable,A=(r,e,o)=>e in r?Fr(r,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):r[e]=o,c=(r,e)=>{for(var o in e||(e={}))Ir.call(e,o)&&A(r,o,e[o]);if(I)for(var o of I(e))Ar.call(e,o)&&A(r,o,e[o]);return r},P=(r,e)=>Hr(r,Mr(e));function Nr(r,e){var o;if(!e)return r;const n=Object.keys(r).reduce((a,t)=>{if(t==="headings"&&e.headings){const i=e.headings.sizes?Object.keys(r.headings.sizes).reduce((s,l)=>(s[l]=c(c({},r.headings.sizes[l]),e.headings.sizes[l]),s),{}):r.headings.sizes;return P(c({},a),{headings:P(c(c({},r.headings),e.headings),{sizes:i})})}if(t==="breakpoints"&&e.breakpoints){const i=c(c({},r.breakpoints),e.breakpoints);return P(c({},a),{breakpoints:Object.fromEntries(Object.entries(i).sort((s,l)=>S(s[1])-S(l[1])))})}return a[t]=typeof e[t]=="object"?c(c({},r[t]),e[t]):typeof e[t]=="number"||typeof e[t]=="boolean"||typeof e[t]=="function"?e[t]:e[t]||r[t],a},{});if(e!=null&&e.fontFamily&&!((o=e==null?void 0:e.headings)!=null&&o.fontFamily)&&(n.headings.fontFamily=e.fontFamily),!(n.primaryColor in n.colors))throw new Error("MantineProvider: Invalid theme.primaryColor, it accepts only key of theme.colors, learn more – https://mantine.dev/theming/colors/#primary-color");return n}function Wr(r,e){return U(Nr(r,e))}function Tr(r){return Object.keys(r).reduce((e,o)=>(r[o]!==void 0&&(e[o]=r[o]),e),{})}const Gr={html:{fontFamily:"sans-serif",lineHeight:"1.15",textSizeAdjust:"100%"},body:{margin:0},"article, aside, footer, header, nav, section, figcaption, figure, main":{display:"block"},h1:{fontSize:"2em"},hr:{boxSizing:"content-box",height:0,overflow:"visible"},pre:{fontFamily:"monospace, monospace",fontSize:"1em"},a:{background:"transparent",textDecorationSkip:"objects"},"a:active, a:hover":{outlineWidth:0},"abbr[title]":{borderBottom:"none",textDecoration:"underline"},"b, strong":{fontWeight:"bolder"},"code, kbp, samp":{fontFamily:"monospace, monospace",fontSize:"1em"},dfn:{fontStyle:"italic"},mark:{backgroundColor:"#ff0",color:"#000"},small:{fontSize:"80%"},"sub, sup":{fontSize:"75%",lineHeight:0,position:"relative",verticalAlign:"baseline"},sup:{top:"-0.5em"},sub:{bottom:"-0.25em"},"audio, video":{display:"inline-block"},"audio:not([controls])":{display:"none",height:0},img:{borderStyle:"none",verticalAlign:"middle"},"svg:not(:root)":{overflow:"hidden"},"button, input, optgroup, select, textarea":{fontFamily:"sans-serif",fontSize:"100%",lineHeight:"1.15",margin:0},"button, input":{overflow:"visible"},"button, select":{textTransform:"none"},"button, [type=reset], [type=submit]":{WebkitAppearance:"button"},"button::-moz-focus-inner, [type=button]::-moz-focus-inner, [type=reset]::-moz-focus-inner, [type=submit]::-moz-focus-inner":{borderStyle:"none",padding:0},"button:-moz-focusring, [type=button]:-moz-focusring, [type=reset]:-moz-focusring, [type=submit]:-moz-focusring":{outline:`${u(1)} dotted ButtonText`},legend:{boxSizing:"border-box",color:"inherit",display:"table",maxWidth:"100%",padding:0,whiteSpace:"normal"},progress:{display:"inline-block",verticalAlign:"baseline"},textarea:{overflow:"auto"},"[type=checkbox], [type=radio]":{boxSizing:"border-box",padding:0},"[type=number]::-webkit-inner-spin-button, [type=number]::-webkit-outer-spin-button":{height:"auto"},"[type=search]":{appearance:"none"},"[type=search]::-webkit-search-cancel-button, [type=search]::-webkit-search-decoration":{appearance:"none"},"::-webkit-file-upload-button":{appearance:"button",font:"inherit"},"details, menu":{display:"block"},summary:{display:"list-item"},canvas:{display:"inline-block"},template:{display:"none"}};function Dr(){return d.createElement(_,{styles:Gr})}var Vr=Object.defineProperty,N=Object.getOwnPropertySymbols,Ur=Object.prototype.hasOwnProperty,Lr=Object.prototype.propertyIsEnumerable,W=(r,e,o)=>e in r?Vr(r,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):r[e]=o,m=(r,e)=>{for(var o in e||(e={}))Ur.call(e,o)&&W(r,o,e[o]);if(N)for(var o of N(e))Lr.call(e,o)&&W(r,o,e[o]);return r};const v=h.createContext({theme:E});function L(){var r;return((r=h.useContext(v))==null?void 0:r.theme)||E}function qr(r){const e=L(),o=n=>{var a,t,i,s;return{styles:((a=e.components[n])==null?void 0:a.styles)||{},classNames:((t=e.components[n])==null?void 0:t.classNames)||{},variants:(i=e.components[n])==null?void 0:i.variants,sizes:(s=e.components[n])==null?void 0:s.sizes}};return Array.isArray(r)?r.map(o):[o(r)]}function Jr(){var r;return(r=h.useContext(v))==null?void 0:r.emotionCache}function Kr(r,e,o){var n;const a=L(),t=(n=a.components[r])==null?void 0:n.defaultProps,i=typeof t=="function"?t(a):t;return m(m(m({},e),i),Tr(o))}function Xr({theme:r,emotionCache:e,withNormalizeCSS:o=!1,withGlobalStyles:n=!1,withCSSVariables:a=!1,inherit:t=!1,children:i}){const s=h.useContext(v),l=Wr(E,t?m(m({},s.theme),r):r);return d.createElement(X,{theme:l},d.createElement(v.Provider,{value:{theme:l,emotionCache:e}},o&&d.createElement(Dr,null),n&&d.createElement(jr,{theme:l}),a&&d.createElement(Rr,{theme:l}),typeof l.globalStyles=="function"&&d.createElement(_,{styles:l.globalStyles(l)}),i))}Xr.displayName="@mantine/core/MantineProvider";export{Xr as M,L as a,qr as b,V as c,Kr as d,Tr as f,S as g,u as r,Jr as u}; +import{aa as d,hY as _,v as h,i7 as X}from"./index-94062f76.js";const Y={dark:["#C1C2C5","#A6A7AB","#909296","#5c5f66","#373A40","#2C2E33","#25262b","#1A1B1E","#141517","#101113"],gray:["#f8f9fa","#f1f3f5","#e9ecef","#dee2e6","#ced4da","#adb5bd","#868e96","#495057","#343a40","#212529"],red:["#fff5f5","#ffe3e3","#ffc9c9","#ffa8a8","#ff8787","#ff6b6b","#fa5252","#f03e3e","#e03131","#c92a2a"],pink:["#fff0f6","#ffdeeb","#fcc2d7","#faa2c1","#f783ac","#f06595","#e64980","#d6336c","#c2255c","#a61e4d"],grape:["#f8f0fc","#f3d9fa","#eebefa","#e599f7","#da77f2","#cc5de8","#be4bdb","#ae3ec9","#9c36b5","#862e9c"],violet:["#f3f0ff","#e5dbff","#d0bfff","#b197fc","#9775fa","#845ef7","#7950f2","#7048e8","#6741d9","#5f3dc4"],indigo:["#edf2ff","#dbe4ff","#bac8ff","#91a7ff","#748ffc","#5c7cfa","#4c6ef5","#4263eb","#3b5bdb","#364fc7"],blue:["#e7f5ff","#d0ebff","#a5d8ff","#74c0fc","#4dabf7","#339af0","#228be6","#1c7ed6","#1971c2","#1864ab"],cyan:["#e3fafc","#c5f6fa","#99e9f2","#66d9e8","#3bc9db","#22b8cf","#15aabf","#1098ad","#0c8599","#0b7285"],teal:["#e6fcf5","#c3fae8","#96f2d7","#63e6be","#38d9a9","#20c997","#12b886","#0ca678","#099268","#087f5b"],green:["#ebfbee","#d3f9d8","#b2f2bb","#8ce99a","#69db7c","#51cf66","#40c057","#37b24d","#2f9e44","#2b8a3e"],lime:["#f4fce3","#e9fac8","#d8f5a2","#c0eb75","#a9e34b","#94d82d","#82c91e","#74b816","#66a80f","#5c940d"],yellow:["#fff9db","#fff3bf","#ffec99","#ffe066","#ffd43b","#fcc419","#fab005","#f59f00","#f08c00","#e67700"],orange:["#fff4e6","#ffe8cc","#ffd8a8","#ffc078","#ffa94d","#ff922b","#fd7e14","#f76707","#e8590c","#d9480f"]};function q(r){return()=>({fontFamily:r.fontFamily||"sans-serif"})}var J=Object.defineProperty,x=Object.getOwnPropertySymbols,K=Object.prototype.hasOwnProperty,Q=Object.prototype.propertyIsEnumerable,z=(r,e,o)=>e in r?J(r,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):r[e]=o,j=(r,e)=>{for(var o in e||(e={}))K.call(e,o)&&z(r,o,e[o]);if(x)for(var o of x(e))Q.call(e,o)&&z(r,o,e[o]);return r};function Z(r){return e=>({WebkitTapHighlightColor:"transparent",[e||"&:focus"]:j({},r.focusRing==="always"||r.focusRing==="auto"?r.focusRingStyles.styles(r):r.focusRingStyles.resetStyles(r)),[e?e.replace(":focus",":focus:not(:focus-visible)"):"&:focus:not(:focus-visible)"]:j({},r.focusRing==="auto"||r.focusRing==="never"?r.focusRingStyles.resetStyles(r):null)})}function y(r){return e=>typeof r.primaryShade=="number"?r.primaryShade:r.primaryShade[e||r.colorScheme]}function w(r){const e=y(r);return(o,n,a=!0,t=!0)=>{if(typeof o=="string"&&o.includes(".")){const[s,l]=o.split("."),g=parseInt(l,10);if(s in r.colors&&g>=0&&g<10)return r.colors[s][typeof n=="number"&&!t?n:g]}const i=typeof n=="number"?n:e();return o in r.colors?r.colors[o][i]:a?r.colors[r.primaryColor][i]:o}}function T(r){let e="";for(let o=1;o{const a={from:(n==null?void 0:n.from)||r.defaultGradient.from,to:(n==null?void 0:n.to)||r.defaultGradient.to,deg:(n==null?void 0:n.deg)||r.defaultGradient.deg};return`linear-gradient(${a.deg}deg, ${e(a.from,o(),!1)} 0%, ${e(a.to,o(),!1)} 100%)`}}function D(r){return e=>{if(typeof e=="number")return`${e/16}${r}`;if(typeof e=="string"){const o=e.replace("px","");if(!Number.isNaN(Number(o)))return`${Number(o)/16}${r}`}return e}}const u=D("rem"),k=D("em");function V({size:r,sizes:e,units:o}){return r in e?e[r]:typeof r=="number"?o==="em"?k(r):u(r):r||e.md}function S(r){return typeof r=="number"?r:typeof r=="string"&&r.includes("rem")?Number(r.replace("rem",""))*16:typeof r=="string"&&r.includes("em")?Number(r.replace("em",""))*16:Number(r)}function er(r){return e=>`@media (min-width: ${k(S(V({size:e,sizes:r.breakpoints})))})`}function or(r){return e=>`@media (max-width: ${k(S(V({size:e,sizes:r.breakpoints}))-1)})`}function nr(r){return/^#?([0-9A-F]{3}){1,2}$/i.test(r)}function tr(r){let e=r.replace("#","");if(e.length===3){const i=e.split("");e=[i[0],i[0],i[1],i[1],i[2],i[2]].join("")}const o=parseInt(e,16),n=o>>16&255,a=o>>8&255,t=o&255;return{r:n,g:a,b:t,a:1}}function ar(r){const[e,o,n,a]=r.replace(/[^0-9,.]/g,"").split(",").map(Number);return{r:e,g:o,b:n,a:a||1}}function C(r){return nr(r)?tr(r):r.startsWith("rgb")?ar(r):{r:0,g:0,b:0,a:1}}function p(r,e){if(typeof r!="string"||e>1||e<0)return"rgba(0, 0, 0, 1)";if(r.startsWith("var(--"))return r;const{r:o,g:n,b:a}=C(r);return`rgba(${o}, ${n}, ${a}, ${e})`}function ir(r=0){return{position:"absolute",top:u(r),right:u(r),left:u(r),bottom:u(r)}}function sr(r,e){if(typeof r=="string"&&r.startsWith("var(--"))return r;const{r:o,g:n,b:a,a:t}=C(r),i=1-e,s=l=>Math.round(l*i);return`rgba(${s(o)}, ${s(n)}, ${s(a)}, ${t})`}function lr(r,e){if(typeof r=="string"&&r.startsWith("var(--"))return r;const{r:o,g:n,b:a,a:t}=C(r),i=s=>Math.round(s+(255-s)*e);return`rgba(${i(o)}, ${i(n)}, ${i(a)}, ${t})`}function fr(r){return e=>{if(typeof e=="number")return u(e);const o=typeof r.defaultRadius=="number"?r.defaultRadius:r.radius[r.defaultRadius]||r.defaultRadius;return r.radius[e]||e||o}}function cr(r,e){if(typeof r=="string"&&r.includes(".")){const[o,n]=r.split("."),a=parseInt(n,10);if(o in e.colors&&a>=0&&a<10)return{isSplittedColor:!0,key:o,shade:a}}return{isSplittedColor:!1}}function dr(r){const e=w(r),o=y(r),n=G(r);return({variant:a,color:t,gradient:i,primaryFallback:s})=>{const l=cr(t,r);switch(a){case"light":return{border:"transparent",background:p(e(t,r.colorScheme==="dark"?8:0,s,!1),r.colorScheme==="dark"?.2:1),color:t==="dark"?r.colorScheme==="dark"?r.colors.dark[0]:r.colors.dark[9]:e(t,r.colorScheme==="dark"?2:o("light")),hover:p(e(t,r.colorScheme==="dark"?7:1,s,!1),r.colorScheme==="dark"?.25:.65)};case"subtle":return{border:"transparent",background:"transparent",color:t==="dark"?r.colorScheme==="dark"?r.colors.dark[0]:r.colors.dark[9]:e(t,r.colorScheme==="dark"?2:o("light")),hover:p(e(t,r.colorScheme==="dark"?8:0,s,!1),r.colorScheme==="dark"?.2:1)};case"outline":return{border:e(t,r.colorScheme==="dark"?5:o("light")),background:"transparent",color:e(t,r.colorScheme==="dark"?5:o("light")),hover:r.colorScheme==="dark"?p(e(t,5,s,!1),.05):p(e(t,0,s,!1),.35)};case"default":return{border:r.colorScheme==="dark"?r.colors.dark[4]:r.colors.gray[4],background:r.colorScheme==="dark"?r.colors.dark[6]:r.white,color:r.colorScheme==="dark"?r.white:r.black,hover:r.colorScheme==="dark"?r.colors.dark[5]:r.colors.gray[0]};case"white":return{border:"transparent",background:r.white,color:e(t,o()),hover:null};case"transparent":return{border:"transparent",color:t==="dark"?r.colorScheme==="dark"?r.colors.dark[0]:r.colors.dark[9]:e(t,r.colorScheme==="dark"?2:o("light")),background:"transparent",hover:null};case"gradient":return{background:n(i),color:r.white,border:"transparent",hover:null};default:{const g=o(),$=l.isSplittedColor?l.shade:g,O=l.isSplittedColor?l.key:t;return{border:"transparent",background:e(O,$,s),color:r.white,hover:e(O,$===9?8:$+1)}}}}}function ur(r){return e=>{const o=y(r)(e);return r.colors[r.primaryColor][o]}}function pr(r){return{"@media (hover: hover)":{"&:hover":r},"@media (hover: none)":{"&:active":r}}}function gr(r){return()=>({userSelect:"none",color:r.colorScheme==="dark"?r.colors.dark[3]:r.colors.gray[5]})}function br(r){return()=>r.colorScheme==="dark"?r.colors.dark[2]:r.colors.gray[6]}const f={fontStyles:q,themeColor:w,focusStyles:Z,linearGradient:B,radialGradient:rr,smallerThan:or,largerThan:er,rgba:p,cover:ir,darken:sr,lighten:lr,radius:fr,variant:dr,primaryShade:y,hover:pr,gradient:G,primaryColor:ur,placeholderStyles:gr,dimmed:br};var mr=Object.defineProperty,yr=Object.defineProperties,Sr=Object.getOwnPropertyDescriptors,R=Object.getOwnPropertySymbols,vr=Object.prototype.hasOwnProperty,_r=Object.prototype.propertyIsEnumerable,F=(r,e,o)=>e in r?mr(r,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):r[e]=o,hr=(r,e)=>{for(var o in e||(e={}))vr.call(e,o)&&F(r,o,e[o]);if(R)for(var o of R(e))_r.call(e,o)&&F(r,o,e[o]);return r},kr=(r,e)=>yr(r,Sr(e));function U(r){return kr(hr({},r),{fn:{fontStyles:f.fontStyles(r),themeColor:f.themeColor(r),focusStyles:f.focusStyles(r),largerThan:f.largerThan(r),smallerThan:f.smallerThan(r),radialGradient:f.radialGradient,linearGradient:f.linearGradient,gradient:f.gradient(r),rgba:f.rgba,cover:f.cover,lighten:f.lighten,darken:f.darken,primaryShade:f.primaryShade(r),radius:f.radius(r),variant:f.variant(r),hover:f.hover,primaryColor:f.primaryColor(r),placeholderStyles:f.placeholderStyles(r),dimmed:f.dimmed(r)}})}const $r={dir:"ltr",primaryShade:{light:6,dark:8},focusRing:"auto",loader:"oval",colorScheme:"light",white:"#fff",black:"#000",defaultRadius:"sm",transitionTimingFunction:"ease",colors:Y,lineHeight:1.55,fontFamily:"-apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica, Arial, sans-serif, Apple Color Emoji, Segoe UI Emoji",fontFamilyMonospace:"ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, Liberation Mono, Courier New, monospace",primaryColor:"blue",respectReducedMotion:!0,cursorType:"default",defaultGradient:{from:"indigo",to:"cyan",deg:45},shadows:{xs:"0 0.0625rem 0.1875rem rgba(0, 0, 0, 0.05), 0 0.0625rem 0.125rem rgba(0, 0, 0, 0.1)",sm:"0 0.0625rem 0.1875rem rgba(0, 0, 0, 0.05), rgba(0, 0, 0, 0.05) 0 0.625rem 0.9375rem -0.3125rem, rgba(0, 0, 0, 0.04) 0 0.4375rem 0.4375rem -0.3125rem",md:"0 0.0625rem 0.1875rem rgba(0, 0, 0, 0.05), rgba(0, 0, 0, 0.05) 0 1.25rem 1.5625rem -0.3125rem, rgba(0, 0, 0, 0.04) 0 0.625rem 0.625rem -0.3125rem",lg:"0 0.0625rem 0.1875rem rgba(0, 0, 0, 0.05), rgba(0, 0, 0, 0.05) 0 1.75rem 1.4375rem -0.4375rem, rgba(0, 0, 0, 0.04) 0 0.75rem 0.75rem -0.4375rem",xl:"0 0.0625rem 0.1875rem rgba(0, 0, 0, 0.05), rgba(0, 0, 0, 0.05) 0 2.25rem 1.75rem -0.4375rem, rgba(0, 0, 0, 0.04) 0 1.0625rem 1.0625rem -0.4375rem"},fontSizes:{xs:"0.75rem",sm:"0.875rem",md:"1rem",lg:"1.125rem",xl:"1.25rem"},radius:{xs:"0.125rem",sm:"0.25rem",md:"0.5rem",lg:"1rem",xl:"2rem"},spacing:{xs:"0.625rem",sm:"0.75rem",md:"1rem",lg:"1.25rem",xl:"1.5rem"},breakpoints:{xs:"36em",sm:"48em",md:"62em",lg:"75em",xl:"88em"},headings:{fontFamily:"-apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica, Arial, sans-serif, Apple Color Emoji, Segoe UI Emoji",fontWeight:700,sizes:{h1:{fontSize:"2.125rem",lineHeight:1.3,fontWeight:void 0},h2:{fontSize:"1.625rem",lineHeight:1.35,fontWeight:void 0},h3:{fontSize:"1.375rem",lineHeight:1.4,fontWeight:void 0},h4:{fontSize:"1.125rem",lineHeight:1.45,fontWeight:void 0},h5:{fontSize:"1rem",lineHeight:1.5,fontWeight:void 0},h6:{fontSize:"0.875rem",lineHeight:1.5,fontWeight:void 0}}},other:{},components:{},activeStyles:{transform:"translateY(0.0625rem)"},datesLocale:"en",globalStyles:void 0,focusRingStyles:{styles:r=>({outlineOffset:"0.125rem",outline:`0.125rem solid ${r.colors[r.primaryColor][r.colorScheme==="dark"?7:5]}`}),resetStyles:()=>({outline:"none"}),inputStyles:r=>({outline:"none",borderColor:r.colors[r.primaryColor][typeof r.primaryShade=="object"?r.primaryShade[r.colorScheme]:r.primaryShade]})}},E=U($r);var Pr=Object.defineProperty,wr=Object.defineProperties,Cr=Object.getOwnPropertyDescriptors,H=Object.getOwnPropertySymbols,Er=Object.prototype.hasOwnProperty,Or=Object.prototype.propertyIsEnumerable,M=(r,e,o)=>e in r?Pr(r,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):r[e]=o,xr=(r,e)=>{for(var o in e||(e={}))Er.call(e,o)&&M(r,o,e[o]);if(H)for(var o of H(e))Or.call(e,o)&&M(r,o,e[o]);return r},zr=(r,e)=>wr(r,Cr(e));function jr({theme:r}){return d.createElement(_,{styles:{"*, *::before, *::after":{boxSizing:"border-box"},html:{colorScheme:r.colorScheme==="dark"?"dark":"light"},body:zr(xr({},r.fn.fontStyles()),{backgroundColor:r.colorScheme==="dark"?r.colors.dark[7]:r.white,color:r.colorScheme==="dark"?r.colors.dark[0]:r.black,lineHeight:r.lineHeight,fontSize:r.fontSizes.md,WebkitFontSmoothing:"antialiased",MozOsxFontSmoothing:"grayscale"})}})}function b(r,e,o,n=u){Object.keys(e).forEach(a=>{r[`--mantine-${o}-${a}`]=n(e[a])})}function Rr({theme:r}){const e={"--mantine-color-white":r.white,"--mantine-color-black":r.black,"--mantine-transition-timing-function":r.transitionTimingFunction,"--mantine-line-height":`${r.lineHeight}`,"--mantine-font-family":r.fontFamily,"--mantine-font-family-monospace":r.fontFamilyMonospace,"--mantine-font-family-headings":r.headings.fontFamily,"--mantine-heading-font-weight":`${r.headings.fontWeight}`};b(e,r.shadows,"shadow"),b(e,r.fontSizes,"font-size"),b(e,r.radius,"radius"),b(e,r.spacing,"spacing"),b(e,r.breakpoints,"breakpoints",k),Object.keys(r.colors).forEach(n=>{r.colors[n].forEach((a,t)=>{e[`--mantine-color-${n}-${t}`]=a})});const o=r.headings.sizes;return Object.keys(o).forEach(n=>{e[`--mantine-${n}-font-size`]=o[n].fontSize,e[`--mantine-${n}-line-height`]=`${o[n].lineHeight}`}),d.createElement(_,{styles:{":root":e}})}var Fr=Object.defineProperty,Hr=Object.defineProperties,Mr=Object.getOwnPropertyDescriptors,I=Object.getOwnPropertySymbols,Ir=Object.prototype.hasOwnProperty,Ar=Object.prototype.propertyIsEnumerable,A=(r,e,o)=>e in r?Fr(r,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):r[e]=o,c=(r,e)=>{for(var o in e||(e={}))Ir.call(e,o)&&A(r,o,e[o]);if(I)for(var o of I(e))Ar.call(e,o)&&A(r,o,e[o]);return r},P=(r,e)=>Hr(r,Mr(e));function Nr(r,e){var o;if(!e)return r;const n=Object.keys(r).reduce((a,t)=>{if(t==="headings"&&e.headings){const i=e.headings.sizes?Object.keys(r.headings.sizes).reduce((s,l)=>(s[l]=c(c({},r.headings.sizes[l]),e.headings.sizes[l]),s),{}):r.headings.sizes;return P(c({},a),{headings:P(c(c({},r.headings),e.headings),{sizes:i})})}if(t==="breakpoints"&&e.breakpoints){const i=c(c({},r.breakpoints),e.breakpoints);return P(c({},a),{breakpoints:Object.fromEntries(Object.entries(i).sort((s,l)=>S(s[1])-S(l[1])))})}return a[t]=typeof e[t]=="object"?c(c({},r[t]),e[t]):typeof e[t]=="number"||typeof e[t]=="boolean"||typeof e[t]=="function"?e[t]:e[t]||r[t],a},{});if(e!=null&&e.fontFamily&&!((o=e==null?void 0:e.headings)!=null&&o.fontFamily)&&(n.headings.fontFamily=e.fontFamily),!(n.primaryColor in n.colors))throw new Error("MantineProvider: Invalid theme.primaryColor, it accepts only key of theme.colors, learn more – https://mantine.dev/theming/colors/#primary-color");return n}function Wr(r,e){return U(Nr(r,e))}function Tr(r){return Object.keys(r).reduce((e,o)=>(r[o]!==void 0&&(e[o]=r[o]),e),{})}const Gr={html:{fontFamily:"sans-serif",lineHeight:"1.15",textSizeAdjust:"100%"},body:{margin:0},"article, aside, footer, header, nav, section, figcaption, figure, main":{display:"block"},h1:{fontSize:"2em"},hr:{boxSizing:"content-box",height:0,overflow:"visible"},pre:{fontFamily:"monospace, monospace",fontSize:"1em"},a:{background:"transparent",textDecorationSkip:"objects"},"a:active, a:hover":{outlineWidth:0},"abbr[title]":{borderBottom:"none",textDecoration:"underline"},"b, strong":{fontWeight:"bolder"},"code, kbp, samp":{fontFamily:"monospace, monospace",fontSize:"1em"},dfn:{fontStyle:"italic"},mark:{backgroundColor:"#ff0",color:"#000"},small:{fontSize:"80%"},"sub, sup":{fontSize:"75%",lineHeight:0,position:"relative",verticalAlign:"baseline"},sup:{top:"-0.5em"},sub:{bottom:"-0.25em"},"audio, video":{display:"inline-block"},"audio:not([controls])":{display:"none",height:0},img:{borderStyle:"none",verticalAlign:"middle"},"svg:not(:root)":{overflow:"hidden"},"button, input, optgroup, select, textarea":{fontFamily:"sans-serif",fontSize:"100%",lineHeight:"1.15",margin:0},"button, input":{overflow:"visible"},"button, select":{textTransform:"none"},"button, [type=reset], [type=submit]":{WebkitAppearance:"button"},"button::-moz-focus-inner, [type=button]::-moz-focus-inner, [type=reset]::-moz-focus-inner, [type=submit]::-moz-focus-inner":{borderStyle:"none",padding:0},"button:-moz-focusring, [type=button]:-moz-focusring, [type=reset]:-moz-focusring, [type=submit]:-moz-focusring":{outline:`${u(1)} dotted ButtonText`},legend:{boxSizing:"border-box",color:"inherit",display:"table",maxWidth:"100%",padding:0,whiteSpace:"normal"},progress:{display:"inline-block",verticalAlign:"baseline"},textarea:{overflow:"auto"},"[type=checkbox], [type=radio]":{boxSizing:"border-box",padding:0},"[type=number]::-webkit-inner-spin-button, [type=number]::-webkit-outer-spin-button":{height:"auto"},"[type=search]":{appearance:"none"},"[type=search]::-webkit-search-cancel-button, [type=search]::-webkit-search-decoration":{appearance:"none"},"::-webkit-file-upload-button":{appearance:"button",font:"inherit"},"details, menu":{display:"block"},summary:{display:"list-item"},canvas:{display:"inline-block"},template:{display:"none"}};function Dr(){return d.createElement(_,{styles:Gr})}var Vr=Object.defineProperty,N=Object.getOwnPropertySymbols,Ur=Object.prototype.hasOwnProperty,Lr=Object.prototype.propertyIsEnumerable,W=(r,e,o)=>e in r?Vr(r,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):r[e]=o,m=(r,e)=>{for(var o in e||(e={}))Ur.call(e,o)&&W(r,o,e[o]);if(N)for(var o of N(e))Lr.call(e,o)&&W(r,o,e[o]);return r};const v=h.createContext({theme:E});function L(){var r;return((r=h.useContext(v))==null?void 0:r.theme)||E}function qr(r){const e=L(),o=n=>{var a,t,i,s;return{styles:((a=e.components[n])==null?void 0:a.styles)||{},classNames:((t=e.components[n])==null?void 0:t.classNames)||{},variants:(i=e.components[n])==null?void 0:i.variants,sizes:(s=e.components[n])==null?void 0:s.sizes}};return Array.isArray(r)?r.map(o):[o(r)]}function Jr(){var r;return(r=h.useContext(v))==null?void 0:r.emotionCache}function Kr(r,e,o){var n;const a=L(),t=(n=a.components[r])==null?void 0:n.defaultProps,i=typeof t=="function"?t(a):t;return m(m(m({},e),i),Tr(o))}function Xr({theme:r,emotionCache:e,withNormalizeCSS:o=!1,withGlobalStyles:n=!1,withCSSVariables:a=!1,inherit:t=!1,children:i}){const s=h.useContext(v),l=Wr(E,t?m(m({},s.theme),r):r);return d.createElement(X,{theme:l},d.createElement(v.Provider,{value:{theme:l,emotionCache:e}},o&&d.createElement(Dr,null),n&&d.createElement(jr,{theme:l}),a&&d.createElement(Rr,{theme:l}),typeof l.globalStyles=="function"&&d.createElement(_,{styles:l.globalStyles(l)}),i))}Xr.displayName="@mantine/core/MantineProvider";export{Xr as M,L as a,qr as b,V as c,Kr as d,Tr as f,S as g,u as r,Jr as u}; diff --git a/invokeai/frontend/web/dist/assets/ThemeLocaleProvider-d93a1448.js b/invokeai/frontend/web/dist/assets/ThemeLocaleProvider-632b3401.js similarity index 99% rename from invokeai/frontend/web/dist/assets/ThemeLocaleProvider-d93a1448.js rename to invokeai/frontend/web/dist/assets/ThemeLocaleProvider-632b3401.js index b7b7e026a0..e03863ddf1 100644 --- a/invokeai/frontend/web/dist/assets/ThemeLocaleProvider-d93a1448.js +++ b/invokeai/frontend/web/dist/assets/ThemeLocaleProvider-632b3401.js @@ -1,4 +1,4 @@ -import{w as s,hY as T,v as l,a2 as I,hZ as R,ae as V,h_ as z,h$ as j,i0 as D,i1 as F,i2 as G,i3 as W,i4 as K,aG as Y,i5 as Z,i6 as H}from"./index-285abe50.js";import{M as U}from"./MantineProvider-23f4942b.js";var P=String.raw,E=P` +import{w as s,hY as T,v as l,a2 as I,hZ as R,ae as V,h_ as z,h$ as j,i0 as D,i1 as F,i2 as G,i3 as W,i4 as K,aG as Y,i5 as Z,i6 as H}from"./index-94062f76.js";import{M as U}from"./MantineProvider-a057bfc9.js";var P=String.raw,E=P` :root, :host { --chakra-vh: 100vh; diff --git a/invokeai/frontend/web/dist/assets/index-285abe50.js b/invokeai/frontend/web/dist/assets/index-94062f76.js similarity index 50% rename from invokeai/frontend/web/dist/assets/index-285abe50.js rename to invokeai/frontend/web/dist/assets/index-94062f76.js index b7ff83a2f6..7704f5ddb4 100644 --- a/invokeai/frontend/web/dist/assets/index-285abe50.js +++ b/invokeai/frontend/web/dist/assets/index-94062f76.js @@ -1,4 +1,4 @@ -var GK=Object.defineProperty;var HK=(e,t,n)=>t in e?GK(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var _w=(e,t,n)=>(HK(e,typeof t!="symbol"?t+"":t,n),n),Sw=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)};var ae=(e,t,n)=>(Sw(e,t,"read from private field"),n?n.call(e):t.get(e)),Yn=(e,t,n)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,n)},oa=(e,t,n,r)=>(Sw(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n);var Mp=(e,t,n,r)=>({set _(i){oa(e,t,i,n)},get _(){return ae(e,t,r)}}),ps=(e,t,n)=>(Sw(e,t,"access private method"),n);function BN(e,t){for(var n=0;nr[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"]'))r(i);new MutationObserver(i=>{for(const o of i)if(o.type==="childList")for(const a of o.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&r(a)}).observe(document,{childList:!0,subtree:!0});function n(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 r(i){if(i.ep)return;i.ep=!0;const o=n(i);fetch(i.href,o)}})();var mt=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function pc(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function dS(e){if(e.__esModule)return e;var t=e.default;if(typeof t=="function"){var n=function r(){return this instanceof r?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(r){var i=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(n,r,i.get?i:{enumerable:!0,get:function(){return e[r]}})}),n}var zN={exports:{}},fS={},jN={exports:{}},Lt={};/** +var UK=Object.defineProperty;var VK=(e,t,n)=>t in e?UK(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var _w=(e,t,n)=>(VK(e,typeof t!="symbol"?t+"":t,n),n),Sw=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)};var ae=(e,t,n)=>(Sw(e,t,"read from private field"),n?n.call(e):t.get(e)),Yn=(e,t,n)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,n)},oa=(e,t,n,r)=>(Sw(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n);var Op=(e,t,n,r)=>({set _(i){oa(e,t,i,n)},get _(){return ae(e,t,r)}}),ps=(e,t,n)=>(Sw(e,t,"access private method"),n);function FN(e,t){for(var n=0;nr[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"]'))r(i);new MutationObserver(i=>{for(const o of i)if(o.type==="childList")for(const a of o.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&r(a)}).observe(document,{childList:!0,subtree:!0});function n(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 r(i){if(i.ep)return;i.ep=!0;const o=n(i);fetch(i.href,o)}})();var mt=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function pc(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function dS(e){if(e.__esModule)return e;var t=e.default;if(typeof t=="function"){var n=function r(){return this instanceof r?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(r){var i=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(n,r,i.get?i:{enumerable:!0,get:function(){return e[r]}})}),n}var BN={exports:{}},fS={},zN={exports:{}},Lt={};/** * @license React * react.production.min.js * @@ -6,7 +6,7 @@ var GK=Object.defineProperty;var HK=(e,t,n)=>t in e?GK(e,t,{enumerable:!0,config * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var U0=Symbol.for("react.element"),qK=Symbol.for("react.portal"),WK=Symbol.for("react.fragment"),KK=Symbol.for("react.strict_mode"),QK=Symbol.for("react.profiler"),XK=Symbol.for("react.provider"),YK=Symbol.for("react.context"),ZK=Symbol.for("react.forward_ref"),JK=Symbol.for("react.suspense"),eQ=Symbol.for("react.memo"),tQ=Symbol.for("react.lazy"),FP=Symbol.iterator;function nQ(e){return e===null||typeof e!="object"?null:(e=FP&&e[FP]||e["@@iterator"],typeof e=="function"?e:null)}var UN={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},VN=Object.assign,GN={};function dp(e,t,n){this.props=e,this.context=t,this.refs=GN,this.updater=n||UN}dp.prototype.isReactComponent={};dp.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=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,e,t,"setState")};dp.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function HN(){}HN.prototype=dp.prototype;function H4(e,t,n){this.props=e,this.context=t,this.refs=GN,this.updater=n||UN}var q4=H4.prototype=new HN;q4.constructor=H4;VN(q4,dp.prototype);q4.isPureReactComponent=!0;var BP=Array.isArray,qN=Object.prototype.hasOwnProperty,W4={current:null},WN={key:!0,ref:!0,__self:!0,__source:!0};function KN(e,t,n){var r,i={},o=null,a=null;if(t!=null)for(r in t.ref!==void 0&&(a=t.ref),t.key!==void 0&&(o=""+t.key),t)qN.call(t,r)&&!WN.hasOwnProperty(r)&&(i[r]=t[r]);var s=arguments.length-2;if(s===1)i.children=n;else if(1t in e?GK(e,t,{enumerable:!0,config * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var sQ=I,lQ=Symbol.for("react.element"),uQ=Symbol.for("react.fragment"),cQ=Object.prototype.hasOwnProperty,dQ=sQ.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,fQ={key:!0,ref:!0,__self:!0,__source:!0};function QN(e,t,n){var r,i={},o=null,a=null;n!==void 0&&(o=""+n),t.key!==void 0&&(o=""+t.key),t.ref!==void 0&&(a=t.ref);for(r in t)cQ.call(t,r)&&!fQ.hasOwnProperty(r)&&(i[r]=t[r]);if(e&&e.defaultProps)for(r in t=e.defaultProps,t)i[r]===void 0&&(i[r]=t[r]);return{$$typeof:lQ,type:e,key:o,ref:a,props:i,_owner:dQ.current}}fS.Fragment=uQ;fS.jsx=QN;fS.jsxs=QN;zN.exports=fS;var W=zN.exports,V5={},XN={exports:{}},ea={},YN={exports:{}},ZN={};/** + */var oQ=I,aQ=Symbol.for("react.element"),sQ=Symbol.for("react.fragment"),lQ=Object.prototype.hasOwnProperty,uQ=oQ.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,cQ={key:!0,ref:!0,__self:!0,__source:!0};function KN(e,t,n){var r,i={},o=null,a=null;n!==void 0&&(o=""+n),t.key!==void 0&&(o=""+t.key),t.ref!==void 0&&(a=t.ref);for(r in t)lQ.call(t,r)&&!cQ.hasOwnProperty(r)&&(i[r]=t[r]);if(e&&e.defaultProps)for(r in t=e.defaultProps,t)i[r]===void 0&&(i[r]=t[r]);return{$$typeof:aQ,type:e,key:o,ref:a,props:i,_owner:uQ.current}}fS.Fragment=sQ;fS.jsx=KN;fS.jsxs=KN;BN.exports=fS;var W=BN.exports,V5={},QN={exports:{}},ea={},XN={exports:{}},YN={};/** * @license React * scheduler.production.min.js * @@ -22,7 +22,7 @@ var GK=Object.defineProperty;var HK=(e,t,n)=>t in e?GK(e,t,{enumerable:!0,config * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */(function(e){function t(M,R){var N=M.length;M.push(R);e:for(;0>>1,U=M[B];if(0>>1;Bi(ee,N))Ji(j,ee)?(M[B]=j,M[J]=N,B=J):(M[B]=ee,M[Y]=N,B=Y);else if(Ji(j,N))M[B]=j,M[J]=N,B=J;else break e}}return R}function i(M,R){var N=M.sortIndex-R.sortIndex;return N!==0?N:M.id-R.id}if(typeof performance=="object"&&typeof performance.now=="function"){var o=performance;e.unstable_now=function(){return o.now()}}else{var a=Date,s=a.now();e.unstable_now=function(){return a.now()-s}}var l=[],u=[],c=1,d=null,f=3,h=!1,p=!1,m=!1,_=typeof setTimeout=="function"?setTimeout:null,b=typeof clearTimeout=="function"?clearTimeout:null,v=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function g(M){for(var R=n(u);R!==null;){if(R.callback===null)r(u);else if(R.startTime<=M)r(u),R.sortIndex=R.expirationTime,t(l,R);else break;R=n(u)}}function y(M){if(m=!1,g(M),!p)if(n(l)!==null)p=!0,D(S);else{var R=n(u);R!==null&&L(y,R.startTime-M)}}function S(M,R){p=!1,m&&(m=!1,b(C),C=-1),h=!0;var N=f;try{for(g(R),d=n(l);d!==null&&(!(d.expirationTime>R)||M&&!P());){var B=d.callback;if(typeof B=="function"){d.callback=null,f=d.priorityLevel;var U=B(d.expirationTime<=R);R=e.unstable_now(),typeof U=="function"?d.callback=U:d===n(l)&&r(l),g(R)}else r(l);d=n(l)}if(d!==null)var G=!0;else{var Y=n(u);Y!==null&&L(y,Y.startTime-R),G=!1}return G}finally{d=null,f=N,h=!1}}var w=!1,x=null,C=-1,T=5,k=-1;function P(){return!(e.unstable_now()-kM||125B?(M.sortIndex=N,t(u,M),n(l)===null&&M===n(u)&&(m?(b(C),C=-1):m=!0,L(y,N-B))):(M.sortIndex=U,t(l,M),p||h||(p=!0,D(S))),M},e.unstable_shouldYield=P,e.unstable_wrapCallback=function(M){var R=f;return function(){var N=f;f=R;try{return M.apply(this,arguments)}finally{f=N}}}})(ZN);YN.exports=ZN;var hQ=YN.exports;/** + */(function(e){function t(M,R){var N=M.length;M.push(R);e:for(;0>>1,U=M[B];if(0>>1;Bi(ee,N))Ji(j,ee)?(M[B]=j,M[J]=N,B=J):(M[B]=ee,M[Y]=N,B=Y);else if(Ji(j,N))M[B]=j,M[J]=N,B=J;else break e}}return R}function i(M,R){var N=M.sortIndex-R.sortIndex;return N!==0?N:M.id-R.id}if(typeof performance=="object"&&typeof performance.now=="function"){var o=performance;e.unstable_now=function(){return o.now()}}else{var a=Date,s=a.now();e.unstable_now=function(){return a.now()-s}}var l=[],u=[],c=1,d=null,f=3,h=!1,p=!1,m=!1,_=typeof setTimeout=="function"?setTimeout:null,b=typeof clearTimeout=="function"?clearTimeout:null,v=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function g(M){for(var R=n(u);R!==null;){if(R.callback===null)r(u);else if(R.startTime<=M)r(u),R.sortIndex=R.expirationTime,t(l,R);else break;R=n(u)}}function y(M){if(m=!1,g(M),!p)if(n(l)!==null)p=!0,D(S);else{var R=n(u);R!==null&&L(y,R.startTime-M)}}function S(M,R){p=!1,m&&(m=!1,b(C),C=-1),h=!0;var N=f;try{for(g(R),d=n(l);d!==null&&(!(d.expirationTime>R)||M&&!P());){var B=d.callback;if(typeof B=="function"){d.callback=null,f=d.priorityLevel;var U=B(d.expirationTime<=R);R=e.unstable_now(),typeof U=="function"?d.callback=U:d===n(l)&&r(l),g(R)}else r(l);d=n(l)}if(d!==null)var G=!0;else{var Y=n(u);Y!==null&&L(y,Y.startTime-R),G=!1}return G}finally{d=null,f=N,h=!1}}var w=!1,x=null,C=-1,T=5,k=-1;function P(){return!(e.unstable_now()-kM||125B?(M.sortIndex=N,t(u,M),n(l)===null&&M===n(u)&&(m?(b(C),C=-1):m=!0,L(y,N-B))):(M.sortIndex=U,t(l,M),p||h||(p=!0,D(S))),M},e.unstable_shouldYield=P,e.unstable_wrapCallback=function(M){var R=f;return function(){var N=f;f=R;try{return M.apply(this,arguments)}finally{f=N}}}})(YN);XN.exports=YN;var dQ=XN.exports;/** * @license React * react-dom.production.min.js * @@ -30,16 +30,16 @@ var GK=Object.defineProperty;var HK=(e,t,n)=>t in e?GK(e,t,{enumerable:!0,config * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var JN=I,Xo=hQ;function le(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),G5=Object.prototype.hasOwnProperty,pQ=/^[: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]*$/,UP={},VP={};function gQ(e){return G5.call(VP,e)?!0:G5.call(UP,e)?!1:pQ.test(e)?VP[e]=!0:(UP[e]=!0,!1)}function mQ(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function yQ(e,t,n,r){if(t===null||typeof t>"u"||mQ(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function so(e,t,n,r,i,o,a){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=i,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=o,this.removeEmptyString=a}var Ri={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){Ri[e]=new so(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];Ri[t]=new so(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){Ri[e]=new so(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){Ri[e]=new so(e,2,!1,e,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(e){Ri[e]=new so(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){Ri[e]=new so(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){Ri[e]=new so(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){Ri[e]=new so(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){Ri[e]=new so(e,5,!1,e.toLowerCase(),null,!1,!1)});var Q4=/[\-:]([a-z])/g;function X4(e){return e[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(e){var t=e.replace(Q4,X4);Ri[t]=new so(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(Q4,X4);Ri[t]=new so(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(Q4,X4);Ri[t]=new so(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){Ri[e]=new so(e,1,!1,e.toLowerCase(),null,!1,!1)});Ri.xlinkHref=new so("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){Ri[e]=new so(e,1,!1,e.toLowerCase(),null,!0,!0)});function Y4(e,t,n,r){var i=Ri.hasOwnProperty(t)?Ri[t]:null;(i!==null?i.type!==0:r||!(2"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),G5=Object.prototype.hasOwnProperty,fQ=/^[: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]*$/,jP={},UP={};function hQ(e){return G5.call(UP,e)?!0:G5.call(jP,e)?!1:fQ.test(e)?UP[e]=!0:(jP[e]=!0,!1)}function pQ(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function gQ(e,t,n,r){if(t===null||typeof t>"u"||pQ(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function so(e,t,n,r,i,o,a){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=i,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=o,this.removeEmptyString=a}var Ri={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){Ri[e]=new so(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];Ri[t]=new so(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){Ri[e]=new so(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){Ri[e]=new so(e,2,!1,e,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(e){Ri[e]=new so(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){Ri[e]=new so(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){Ri[e]=new so(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){Ri[e]=new so(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){Ri[e]=new so(e,5,!1,e.toLowerCase(),null,!1,!1)});var K4=/[\-:]([a-z])/g;function Q4(e){return e[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(e){var t=e.replace(K4,Q4);Ri[t]=new so(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(K4,Q4);Ri[t]=new so(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(K4,Q4);Ri[t]=new so(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){Ri[e]=new so(e,1,!1,e.toLowerCase(),null,!1,!1)});Ri.xlinkHref=new so("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){Ri[e]=new so(e,1,!1,e.toLowerCase(),null,!0,!0)});function X4(e,t,n,r){var i=Ri.hasOwnProperty(t)?Ri[t]:null;(i!==null?i.type!==0:r||!(2s||i[a]!==o[s]){var l=` -`+i[a].replace(" at new "," at ");return e.displayName&&l.includes("")&&(l=l.replace("",e.displayName)),l}while(1<=a&&0<=s);break}}}finally{Cw=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?fg(e):""}function vQ(e){switch(e.tag){case 5:return fg(e.type);case 16:return fg("Lazy");case 13:return fg("Suspense");case 19:return fg("SuspenseList");case 0:case 2:case 15:return e=Ew(e.type,!1),e;case 11:return e=Ew(e.type.render,!1),e;case 1:return e=Ew(e.type,!0),e;default:return""}}function K5(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case Pf:return"Fragment";case Af:return"Portal";case H5:return"Profiler";case Z4:return"StrictMode";case q5:return"Suspense";case W5:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case n$:return(e.displayName||"Context")+".Consumer";case t$:return(e._context.displayName||"Context")+".Provider";case J4:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case ek:return t=e.displayName||null,t!==null?t:K5(e.type)||"Memo";case gu:t=e._payload,e=e._init;try{return K5(e(t))}catch{}}return null}function bQ(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return K5(t);case 8:return t===Z4?"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 t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function Zu(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function i$(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function _Q(e){var t=i$(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var i=n.get,o=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(a){r=""+a,o.call(this,a)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(a){r=""+a},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Hy(e){e._valueTracker||(e._valueTracker=_Q(e))}function o$(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=i$(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function db(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function Q5(e,t){var n=t.checked;return cr({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function HP(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=Zu(t.value!=null?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function a$(e,t){t=t.checked,t!=null&&Y4(e,"checked",t,!1)}function X5(e,t){a$(e,t);var n=Zu(t.value),r=t.type;if(n!=null)r==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?Y5(e,t.type,n):t.hasOwnProperty("defaultValue")&&Y5(e,t.type,Zu(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function qP(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!(r!=="submit"&&r!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function Y5(e,t,n){(t!=="number"||db(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var hg=Array.isArray;function Zf(e,t,n,r){if(e=e.options,t){t={};for(var i=0;i"+t.valueOf().toString()+"",t=qy.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function um(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Og={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},SQ=["Webkit","ms","Moz","O"];Object.keys(Og).forEach(function(e){SQ.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Og[t]=Og[e]})});function c$(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||Og.hasOwnProperty(e)&&Og[e]?(""+t).trim():t+"px"}function d$(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,i=c$(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,i):e[n]=i}}var xQ=cr({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 e3(e,t){if(t){if(xQ[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(le(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(le(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(le(61))}if(t.style!=null&&typeof t.style!="object")throw Error(le(62))}}function t3(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){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 n3=null;function tk(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var r3=null,Jf=null,eh=null;function QP(e){if(e=H0(e)){if(typeof r3!="function")throw Error(le(280));var t=e.stateNode;t&&(t=yS(t),r3(e.stateNode,e.type,t))}}function f$(e){Jf?eh?eh.push(e):eh=[e]:Jf=e}function h$(){if(Jf){var e=Jf,t=eh;if(eh=Jf=null,QP(e),t)for(e=0;e>>=0,e===0?32:31-(MQ(e)/NQ|0)|0}var Wy=64,Ky=4194304;function pg(e){switch(e&-e){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 e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function gb(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,i=e.suspendedLanes,o=e.pingedLanes,a=n&268435455;if(a!==0){var s=a&~i;s!==0?r=pg(s):(o&=a,o!==0&&(r=pg(o)))}else a=n&~i,a!==0?r=pg(a):o!==0&&(r=pg(o));if(r===0)return 0;if(t!==0&&t!==r&&!(t&i)&&(i=r&-r,o=t&-t,i>=o||i===16&&(o&4194240)!==0))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0n;n++)t.push(e);return t}function V0(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Ja(t),e[t]=n}function FQ(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0=Ng),i6=String.fromCharCode(32),o6=!1;function M$(e,t){switch(e){case"keyup":return fX.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function N$(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var If=!1;function pX(e,t){switch(e){case"compositionend":return N$(t);case"keypress":return t.which!==32?null:(o6=!0,i6);case"textInput":return e=t.data,e===i6&&o6?null:e;default:return null}}function gX(e,t){if(If)return e==="compositionend"||!uk&&M$(e,t)?(e=R$(),S1=ak=Pu=null,If=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=u6(n)}}function F$(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?F$(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function B$(){for(var e=window,t=db();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=db(e.document)}return t}function ck(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function CX(e){var t=B$(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&F$(n.ownerDocument.documentElement,n)){if(r!==null&&ck(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var i=n.textContent.length,o=Math.min(r.start,i);r=r.end===void 0?o:Math.min(r.end,i),!e.extend&&o>r&&(i=r,r=o,o=i),i=c6(n,o);var a=c6(n,r);i&&a&&(e.rangeCount!==1||e.anchorNode!==i.node||e.anchorOffset!==i.offset||e.focusNode!==a.node||e.focusOffset!==a.offset)&&(t=t.createRange(),t.setStart(i.node,i.offset),e.removeAllRanges(),o>r?(e.addRange(t),e.extend(a.node,a.offset)):(t.setEnd(a.node,a.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n=document.documentMode,Rf=null,u3=null,Dg=null,c3=!1;function d6(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;c3||Rf==null||Rf!==db(r)||(r=Rf,"selectionStart"in r&&ck(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Dg&&gm(Dg,r)||(Dg=r,r=vb(u3,"onSelect"),0Nf||(e.current=m3[Nf],m3[Nf]=null,Nf--)}function Nn(e,t){Nf++,m3[Nf]=e.current,e.current=t}var Ju={},Wi=mc(Ju),Eo=mc(!1),_d=Ju;function Nh(e,t){var n=e.type.contextTypes;if(!n)return Ju;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var i={},o;for(o in n)i[o]=t[o];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=i),i}function ko(e){return e=e.childContextTypes,e!=null}function _b(){Kn(Eo),Kn(Wi)}function v6(e,t,n){if(Wi.current!==Ju)throw Error(le(168));Nn(Wi,t),Nn(Eo,n)}function K$(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var i in r)if(!(i in t))throw Error(le(108,bQ(e)||"Unknown",i));return cr({},n,r)}function Sb(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Ju,_d=Wi.current,Nn(Wi,e),Nn(Eo,Eo.current),!0}function b6(e,t,n){var r=e.stateNode;if(!r)throw Error(le(169));n?(e=K$(e,t,_d),r.__reactInternalMemoizedMergedChildContext=e,Kn(Eo),Kn(Wi),Nn(Wi,e)):Kn(Eo),Nn(Eo,n)}var vl=null,vS=!1,Bw=!1;function Q$(e){vl===null?vl=[e]:vl.push(e)}function DX(e){vS=!0,Q$(e)}function yc(){if(!Bw&&vl!==null){Bw=!0;var e=0,t=mn;try{var n=vl;for(mn=1;e>=a,i-=a,Al=1<<32-Ja(t)+i|n<C?(T=x,x=null):T=x.sibling;var k=f(b,x,g[C],y);if(k===null){x===null&&(x=T);break}e&&x&&k.alternate===null&&t(b,x),v=o(k,v,C),w===null?S=k:w.sibling=k,w=k,x=T}if(C===g.length)return n(b,x),tr&&Fc(b,C),S;if(x===null){for(;CC?(T=x,x=null):T=x.sibling;var P=f(b,x,k.value,y);if(P===null){x===null&&(x=T);break}e&&x&&P.alternate===null&&t(b,x),v=o(P,v,C),w===null?S=P:w.sibling=P,w=P,x=T}if(k.done)return n(b,x),tr&&Fc(b,C),S;if(x===null){for(;!k.done;C++,k=g.next())k=d(b,k.value,y),k!==null&&(v=o(k,v,C),w===null?S=k:w.sibling=k,w=k);return tr&&Fc(b,C),S}for(x=r(b,x);!k.done;C++,k=g.next())k=h(x,b,C,k.value,y),k!==null&&(e&&k.alternate!==null&&x.delete(k.key===null?C:k.key),v=o(k,v,C),w===null?S=k:w.sibling=k,w=k);return e&&x.forEach(function($){return t(b,$)}),tr&&Fc(b,C),S}function _(b,v,g,y){if(typeof g=="object"&&g!==null&&g.type===Pf&&g.key===null&&(g=g.props.children),typeof g=="object"&&g!==null){switch(g.$$typeof){case Gy:e:{for(var S=g.key,w=v;w!==null;){if(w.key===S){if(S=g.type,S===Pf){if(w.tag===7){n(b,w.sibling),v=i(w,g.props.children),v.return=b,b=v;break e}}else if(w.elementType===S||typeof S=="object"&&S!==null&&S.$$typeof===gu&&k6(S)===w.type){n(b,w.sibling),v=i(w,g.props),v.ref=Bp(b,w,g),v.return=b,b=v;break e}n(b,w);break}else t(b,w);w=w.sibling}g.type===Pf?(v=cd(g.props.children,b.mode,y,g.key),v.return=b,b=v):(y=P1(g.type,g.key,g.props,null,b.mode,y),y.ref=Bp(b,v,g),y.return=b,b=y)}return a(b);case Af:e:{for(w=g.key;v!==null;){if(v.key===w)if(v.tag===4&&v.stateNode.containerInfo===g.containerInfo&&v.stateNode.implementation===g.implementation){n(b,v.sibling),v=i(v,g.children||[]),v.return=b,b=v;break e}else{n(b,v);break}else t(b,v);v=v.sibling}v=Ww(g,b.mode,y),v.return=b,b=v}return a(b);case gu:return w=g._init,_(b,v,w(g._payload),y)}if(hg(g))return p(b,v,g,y);if(Np(g))return m(b,v,g,y);tv(b,g)}return typeof g=="string"&&g!==""||typeof g=="number"?(g=""+g,v!==null&&v.tag===6?(n(b,v.sibling),v=i(v,g),v.return=b,b=v):(n(b,v),v=qw(g,b.mode,y),v.return=b,b=v),a(b)):n(b,v)}return _}var Dh=rD(!0),iD=rD(!1),q0={},Fs=mc(q0),bm=mc(q0),_m=mc(q0);function Zc(e){if(e===q0)throw Error(le(174));return e}function bk(e,t){switch(Nn(_m,t),Nn(bm,e),Nn(Fs,q0),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:J5(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=J5(t,e)}Kn(Fs),Nn(Fs,t)}function Lh(){Kn(Fs),Kn(bm),Kn(_m)}function oD(e){Zc(_m.current);var t=Zc(Fs.current),n=J5(t,e.type);t!==n&&(Nn(bm,e),Nn(Fs,n))}function _k(e){bm.current===e&&(Kn(Fs),Kn(bm))}var sr=mc(0);function Tb(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||n.data==="$?"||n.data==="$!"))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==void 0){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var zw=[];function Sk(){for(var e=0;en?n:4,e(!0);var r=jw.transition;jw.transition={};try{e(!1),t()}finally{mn=n,jw.transition=r}}function SD(){return xa().memoizedState}function zX(e,t,n){var r=Uu(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},xD(e))wD(t,n);else if(n=J$(e,t,n,r),n!==null){var i=no();es(n,e,r,i),CD(n,t,r)}}function jX(e,t,n){var r=Uu(e),i={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(xD(e))wD(t,i);else{var o=e.alternate;if(e.lanes===0&&(o===null||o.lanes===0)&&(o=t.lastRenderedReducer,o!==null))try{var a=t.lastRenderedState,s=o(a,n);if(i.hasEagerState=!0,i.eagerState=s,os(s,a)){var l=t.interleaved;l===null?(i.next=i,yk(t)):(i.next=l.next,l.next=i),t.interleaved=i;return}}catch{}finally{}n=J$(e,t,i,r),n!==null&&(i=no(),es(n,e,r,i),CD(n,t,r))}}function xD(e){var t=e.alternate;return e===ur||t!==null&&t===ur}function wD(e,t){Lg=Ab=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function CD(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,rk(e,n)}}var Pb={readContext:Sa,useCallback:Li,useContext:Li,useEffect:Li,useImperativeHandle:Li,useInsertionEffect:Li,useLayoutEffect:Li,useMemo:Li,useReducer:Li,useRef:Li,useState:Li,useDebugValue:Li,useDeferredValue:Li,useTransition:Li,useMutableSource:Li,useSyncExternalStore:Li,useId:Li,unstable_isNewReconciler:!1},UX={readContext:Sa,useCallback:function(e,t){return _s().memoizedState=[e,t===void 0?null:t],e},useContext:Sa,useEffect:A6,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,E1(4194308,4,mD.bind(null,t,e),n)},useLayoutEffect:function(e,t){return E1(4194308,4,e,t)},useInsertionEffect:function(e,t){return E1(4,2,e,t)},useMemo:function(e,t){var n=_s();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=_s();return t=n!==void 0?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=zX.bind(null,ur,e),[r.memoizedState,e]},useRef:function(e){var t=_s();return e={current:e},t.memoizedState=e},useState:T6,useDebugValue:kk,useDeferredValue:function(e){return _s().memoizedState=e},useTransition:function(){var e=T6(!1),t=e[0];return e=BX.bind(null,e[1]),_s().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=ur,i=_s();if(tr){if(n===void 0)throw Error(le(407));n=n()}else{if(n=t(),di===null)throw Error(le(349));xd&30||lD(r,t,n)}i.memoizedState=n;var o={value:n,getSnapshot:t};return i.queue=o,A6(cD.bind(null,r,o,e),[e]),r.flags|=2048,wm(9,uD.bind(null,r,o,n,t),void 0,null),n},useId:function(){var e=_s(),t=di.identifierPrefix;if(tr){var n=Pl,r=Al;n=(r&~(1<<32-Ja(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=Sm++,0")&&(l=l.replace("",e.displayName)),l}while(1<=a&&0<=s);break}}}finally{Cw=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?dg(e):""}function mQ(e){switch(e.tag){case 5:return dg(e.type);case 16:return dg("Lazy");case 13:return dg("Suspense");case 19:return dg("SuspenseList");case 0:case 2:case 15:return e=Ew(e.type,!1),e;case 11:return e=Ew(e.type.render,!1),e;case 1:return e=Ew(e.type,!0),e;default:return""}}function K5(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case Pf:return"Fragment";case Af:return"Portal";case H5:return"Profiler";case Y4:return"StrictMode";case q5:return"Suspense";case W5:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case t$:return(e.displayName||"Context")+".Consumer";case e$:return(e._context.displayName||"Context")+".Provider";case Z4:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case J4:return t=e.displayName||null,t!==null?t:K5(e.type)||"Memo";case pu:t=e._payload,e=e._init;try{return K5(e(t))}catch{}}return null}function yQ(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return K5(t);case 8:return t===Y4?"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 t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function Zu(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function r$(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function vQ(e){var t=r$(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var i=n.get,o=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(a){r=""+a,o.call(this,a)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(a){r=""+a},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Hy(e){e._valueTracker||(e._valueTracker=vQ(e))}function i$(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=r$(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function db(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function Q5(e,t){var n=t.checked;return cr({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function GP(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=Zu(t.value!=null?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function o$(e,t){t=t.checked,t!=null&&X4(e,"checked",t,!1)}function X5(e,t){o$(e,t);var n=Zu(t.value),r=t.type;if(n!=null)r==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?Y5(e,t.type,n):t.hasOwnProperty("defaultValue")&&Y5(e,t.type,Zu(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function HP(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!(r!=="submit"&&r!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function Y5(e,t,n){(t!=="number"||db(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var fg=Array.isArray;function Yf(e,t,n,r){if(e=e.options,t){t={};for(var i=0;i"+t.valueOf().toString()+"",t=qy.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function um(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Rg={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},bQ=["Webkit","ms","Moz","O"];Object.keys(Rg).forEach(function(e){bQ.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Rg[t]=Rg[e]})});function u$(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||Rg.hasOwnProperty(e)&&Rg[e]?(""+t).trim():t+"px"}function c$(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,i=u$(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,i):e[n]=i}}var _Q=cr({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 e3(e,t){if(t){if(_Q[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(le(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(le(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(le(61))}if(t.style!=null&&typeof t.style!="object")throw Error(le(62))}}function t3(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){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 n3=null;function ek(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var r3=null,Zf=null,Jf=null;function KP(e){if(e=H0(e)){if(typeof r3!="function")throw Error(le(280));var t=e.stateNode;t&&(t=yS(t),r3(e.stateNode,e.type,t))}}function d$(e){Zf?Jf?Jf.push(e):Jf=[e]:Zf=e}function f$(){if(Zf){var e=Zf,t=Jf;if(Jf=Zf=null,KP(e),t)for(e=0;e>>=0,e===0?32:31-(RQ(e)/OQ|0)|0}var Wy=64,Ky=4194304;function hg(e){switch(e&-e){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 e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function gb(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,i=e.suspendedLanes,o=e.pingedLanes,a=n&268435455;if(a!==0){var s=a&~i;s!==0?r=hg(s):(o&=a,o!==0&&(r=hg(o)))}else a=n&~i,a!==0?r=hg(a):o!==0&&(r=hg(o));if(r===0)return 0;if(t!==0&&t!==r&&!(t&i)&&(i=r&-r,o=t&-t,i>=o||i===16&&(o&4194240)!==0))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0n;n++)t.push(e);return t}function V0(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Ja(t),e[t]=n}function DQ(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0=Mg),r6=String.fromCharCode(32),i6=!1;function O$(e,t){switch(e){case"keyup":return cX.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function M$(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var If=!1;function fX(e,t){switch(e){case"compositionend":return M$(t);case"keypress":return t.which!==32?null:(i6=!0,r6);case"textInput":return e=t.data,e===r6&&i6?null:e;default:return null}}function hX(e,t){if(If)return e==="compositionend"||!lk&&O$(e,t)?(e=I$(),S1=ok=Pu=null,If=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=l6(n)}}function L$(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?L$(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function F$(){for(var e=window,t=db();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=db(e.document)}return t}function uk(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function xX(e){var t=F$(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&L$(n.ownerDocument.documentElement,n)){if(r!==null&&uk(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var i=n.textContent.length,o=Math.min(r.start,i);r=r.end===void 0?o:Math.min(r.end,i),!e.extend&&o>r&&(i=r,r=o,o=i),i=u6(n,o);var a=u6(n,r);i&&a&&(e.rangeCount!==1||e.anchorNode!==i.node||e.anchorOffset!==i.offset||e.focusNode!==a.node||e.focusOffset!==a.offset)&&(t=t.createRange(),t.setStart(i.node,i.offset),e.removeAllRanges(),o>r?(e.addRange(t),e.extend(a.node,a.offset)):(t.setEnd(a.node,a.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n=document.documentMode,Rf=null,u3=null,$g=null,c3=!1;function c6(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;c3||Rf==null||Rf!==db(r)||(r=Rf,"selectionStart"in r&&uk(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),$g&&gm($g,r)||($g=r,r=vb(u3,"onSelect"),0Nf||(e.current=m3[Nf],m3[Nf]=null,Nf--)}function Nn(e,t){Nf++,m3[Nf]=e.current,e.current=t}var Ju={},Wi=mc(Ju),Eo=mc(!1),_d=Ju;function Mh(e,t){var n=e.type.contextTypes;if(!n)return Ju;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var i={},o;for(o in n)i[o]=t[o];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=i),i}function ko(e){return e=e.childContextTypes,e!=null}function _b(){Kn(Eo),Kn(Wi)}function y6(e,t,n){if(Wi.current!==Ju)throw Error(le(168));Nn(Wi,t),Nn(Eo,n)}function W$(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var i in r)if(!(i in t))throw Error(le(108,yQ(e)||"Unknown",i));return cr({},n,r)}function Sb(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Ju,_d=Wi.current,Nn(Wi,e),Nn(Eo,Eo.current),!0}function v6(e,t,n){var r=e.stateNode;if(!r)throw Error(le(169));n?(e=W$(e,t,_d),r.__reactInternalMemoizedMergedChildContext=e,Kn(Eo),Kn(Wi),Nn(Wi,e)):Kn(Eo),Nn(Eo,n)}var yl=null,vS=!1,Bw=!1;function K$(e){yl===null?yl=[e]:yl.push(e)}function NX(e){vS=!0,K$(e)}function yc(){if(!Bw&&yl!==null){Bw=!0;var e=0,t=mn;try{var n=yl;for(mn=1;e>=a,i-=a,Tl=1<<32-Ja(t)+i|n<C?(T=x,x=null):T=x.sibling;var k=f(b,x,g[C],y);if(k===null){x===null&&(x=T);break}e&&x&&k.alternate===null&&t(b,x),v=o(k,v,C),w===null?S=k:w.sibling=k,w=k,x=T}if(C===g.length)return n(b,x),tr&&Fc(b,C),S;if(x===null){for(;CC?(T=x,x=null):T=x.sibling;var P=f(b,x,k.value,y);if(P===null){x===null&&(x=T);break}e&&x&&P.alternate===null&&t(b,x),v=o(P,v,C),w===null?S=P:w.sibling=P,w=P,x=T}if(k.done)return n(b,x),tr&&Fc(b,C),S;if(x===null){for(;!k.done;C++,k=g.next())k=d(b,k.value,y),k!==null&&(v=o(k,v,C),w===null?S=k:w.sibling=k,w=k);return tr&&Fc(b,C),S}for(x=r(b,x);!k.done;C++,k=g.next())k=h(x,b,C,k.value,y),k!==null&&(e&&k.alternate!==null&&x.delete(k.key===null?C:k.key),v=o(k,v,C),w===null?S=k:w.sibling=k,w=k);return e&&x.forEach(function($){return t(b,$)}),tr&&Fc(b,C),S}function _(b,v,g,y){if(typeof g=="object"&&g!==null&&g.type===Pf&&g.key===null&&(g=g.props.children),typeof g=="object"&&g!==null){switch(g.$$typeof){case Gy:e:{for(var S=g.key,w=v;w!==null;){if(w.key===S){if(S=g.type,S===Pf){if(w.tag===7){n(b,w.sibling),v=i(w,g.props.children),v.return=b,b=v;break e}}else if(w.elementType===S||typeof S=="object"&&S!==null&&S.$$typeof===pu&&E6(S)===w.type){n(b,w.sibling),v=i(w,g.props),v.ref=Fp(b,w,g),v.return=b,b=v;break e}n(b,w);break}else t(b,w);w=w.sibling}g.type===Pf?(v=cd(g.props.children,b.mode,y,g.key),v.return=b,b=v):(y=P1(g.type,g.key,g.props,null,b.mode,y),y.ref=Fp(b,v,g),y.return=b,b=y)}return a(b);case Af:e:{for(w=g.key;v!==null;){if(v.key===w)if(v.tag===4&&v.stateNode.containerInfo===g.containerInfo&&v.stateNode.implementation===g.implementation){n(b,v.sibling),v=i(v,g.children||[]),v.return=b,b=v;break e}else{n(b,v);break}else t(b,v);v=v.sibling}v=Ww(g,b.mode,y),v.return=b,b=v}return a(b);case pu:return w=g._init,_(b,v,w(g._payload),y)}if(fg(g))return p(b,v,g,y);if(Mp(g))return m(b,v,g,y);tv(b,g)}return typeof g=="string"&&g!==""||typeof g=="number"?(g=""+g,v!==null&&v.tag===6?(n(b,v.sibling),v=i(v,g),v.return=b,b=v):(n(b,v),v=qw(g,b.mode,y),v.return=b,b=v),a(b)):n(b,v)}return _}var $h=nD(!0),rD=nD(!1),q0={},Fs=mc(q0),bm=mc(q0),_m=mc(q0);function Zc(e){if(e===q0)throw Error(le(174));return e}function vk(e,t){switch(Nn(_m,t),Nn(bm,e),Nn(Fs,q0),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:J5(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=J5(t,e)}Kn(Fs),Nn(Fs,t)}function Dh(){Kn(Fs),Kn(bm),Kn(_m)}function iD(e){Zc(_m.current);var t=Zc(Fs.current),n=J5(t,e.type);t!==n&&(Nn(bm,e),Nn(Fs,n))}function bk(e){bm.current===e&&(Kn(Fs),Kn(bm))}var sr=mc(0);function Tb(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||n.data==="$?"||n.data==="$!"))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==void 0){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var zw=[];function _k(){for(var e=0;en?n:4,e(!0);var r=jw.transition;jw.transition={};try{e(!1),t()}finally{mn=n,jw.transition=r}}function _D(){return xa().memoizedState}function FX(e,t,n){var r=Uu(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},SD(e))xD(t,n);else if(n=Z$(e,t,n,r),n!==null){var i=no();es(n,e,r,i),wD(n,t,r)}}function BX(e,t,n){var r=Uu(e),i={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(SD(e))xD(t,i);else{var o=e.alternate;if(e.lanes===0&&(o===null||o.lanes===0)&&(o=t.lastRenderedReducer,o!==null))try{var a=t.lastRenderedState,s=o(a,n);if(i.hasEagerState=!0,i.eagerState=s,os(s,a)){var l=t.interleaved;l===null?(i.next=i,mk(t)):(i.next=l.next,l.next=i),t.interleaved=i;return}}catch{}finally{}n=Z$(e,t,i,r),n!==null&&(i=no(),es(n,e,r,i),wD(n,t,r))}}function SD(e){var t=e.alternate;return e===ur||t!==null&&t===ur}function xD(e,t){Dg=Ab=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function wD(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,nk(e,n)}}var Pb={readContext:Sa,useCallback:Li,useContext:Li,useEffect:Li,useImperativeHandle:Li,useInsertionEffect:Li,useLayoutEffect:Li,useMemo:Li,useReducer:Li,useRef:Li,useState:Li,useDebugValue:Li,useDeferredValue:Li,useTransition:Li,useMutableSource:Li,useSyncExternalStore:Li,useId:Li,unstable_isNewReconciler:!1},zX={readContext:Sa,useCallback:function(e,t){return _s().memoizedState=[e,t===void 0?null:t],e},useContext:Sa,useEffect:T6,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,E1(4194308,4,gD.bind(null,t,e),n)},useLayoutEffect:function(e,t){return E1(4194308,4,e,t)},useInsertionEffect:function(e,t){return E1(4,2,e,t)},useMemo:function(e,t){var n=_s();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=_s();return t=n!==void 0?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=FX.bind(null,ur,e),[r.memoizedState,e]},useRef:function(e){var t=_s();return e={current:e},t.memoizedState=e},useState:k6,useDebugValue:Ek,useDeferredValue:function(e){return _s().memoizedState=e},useTransition:function(){var e=k6(!1),t=e[0];return e=LX.bind(null,e[1]),_s().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=ur,i=_s();if(tr){if(n===void 0)throw Error(le(407));n=n()}else{if(n=t(),di===null)throw Error(le(349));xd&30||sD(r,t,n)}i.memoizedState=n;var o={value:n,getSnapshot:t};return i.queue=o,T6(uD.bind(null,r,o,e),[e]),r.flags|=2048,wm(9,lD.bind(null,r,o,n,t),void 0,null),n},useId:function(){var e=_s(),t=di.identifierPrefix;if(tr){var n=Al,r=Tl;n=(r&~(1<<32-Ja(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=Sm++,0<\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=a.createElement(n,{is:r.is}):(e=a.createElement(n),n==="select"&&(a=e,r.multiple?a.multiple=!0:r.size&&(a.size=r.size))):e=a.createElementNS(e,n),e[As]=t,e[vm]=r,MD(e,t,!1,!1),t.stateNode=e;e:{switch(a=t3(n,r),n){case"dialog":jn("cancel",e),jn("close",e),i=r;break;case"iframe":case"object":case"embed":jn("load",e),i=r;break;case"video":case"audio":for(i=0;iBh&&(t.flags|=128,r=!0,zp(o,!1),t.lanes=4194304)}else{if(!r)if(e=Tb(a),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),zp(o,!0),o.tail===null&&o.tailMode==="hidden"&&!a.alternate&&!tr)return Fi(t),null}else 2*Cr()-o.renderingStartTime>Bh&&n!==1073741824&&(t.flags|=128,r=!0,zp(o,!1),t.lanes=4194304);o.isBackwards?(a.sibling=t.child,t.child=a):(n=o.last,n!==null?n.sibling=a:t.child=a,o.last=a)}return o.tail!==null?(t=o.tail,o.rendering=t,o.tail=t.sibling,o.renderingStartTime=Cr(),t.sibling=null,n=sr.current,Nn(sr,r?n&1|2:n&1),t):(Fi(t),null);case 22:case 23:return Ok(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?jo&1073741824&&(Fi(t),t.subtreeFlags&6&&(t.flags|=8192)):Fi(t),null;case 24:return null;case 25:return null}throw Error(le(156,t.tag))}function XX(e,t){switch(fk(t),t.tag){case 1:return ko(t.type)&&_b(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Lh(),Kn(Eo),Kn(Wi),Sk(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return _k(t),null;case 13:if(Kn(sr),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(le(340));$h()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Kn(sr),null;case 4:return Lh(),null;case 10:return mk(t.type._context),null;case 22:case 23:return Ok(),null;case 24:return null;default:return null}}var rv=!1,Gi=!1,YX=typeof WeakSet=="function"?WeakSet:Set,De=null;function Ff(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){gr(e,t,r)}else n.current=null}function A3(e,t,n){try{n()}catch(r){gr(e,t,r)}}var L6=!1;function ZX(e,t){if(d3=mb,e=B$(),ck(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var i=r.anchorOffset,o=r.focusNode;r=r.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break e}var a=0,s=-1,l=-1,u=0,c=0,d=e,f=null;t:for(;;){for(var h;d!==n||i!==0&&d.nodeType!==3||(s=a+i),d!==o||r!==0&&d.nodeType!==3||(l=a+r),d.nodeType===3&&(a+=d.nodeValue.length),(h=d.firstChild)!==null;)f=d,d=h;for(;;){if(d===e)break t;if(f===n&&++u===i&&(s=a),f===o&&++c===r&&(l=a),(h=d.nextSibling)!==null)break;d=f,f=d.parentNode}d=h}n=s===-1||l===-1?null:{start:s,end:l}}else n=null}n=n||{start:0,end:0}}else n=null;for(f3={focusedElem:e,selectionRange:n},mb=!1,De=t;De!==null;)if(t=De,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,De=e;else for(;De!==null;){t=De;try{var p=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(p!==null){var m=p.memoizedProps,_=p.memoizedState,b=t.stateNode,v=b.getSnapshotBeforeUpdate(t.elementType===t.type?m:ja(t.type,m),_);b.__reactInternalSnapshotBeforeUpdate=v}break;case 3:var g=t.stateNode.containerInfo;g.nodeType===1?g.textContent="":g.nodeType===9&&g.documentElement&&g.removeChild(g.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(le(163))}}catch(y){gr(t,t.return,y)}if(e=t.sibling,e!==null){e.return=t.return,De=e;break}De=t.return}return p=L6,L6=!1,p}function Fg(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var i=r=r.next;do{if((i.tag&e)===e){var o=i.destroy;i.destroy=void 0,o!==void 0&&A3(t,n,o)}i=i.next}while(i!==r)}}function SS(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function P3(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function DD(e){var t=e.alternate;t!==null&&(e.alternate=null,DD(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[As],delete t[vm],delete t[g3],delete t[NX],delete t[$X])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function LD(e){return e.tag===5||e.tag===3||e.tag===4}function F6(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||LD(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function I3(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=bb));else if(r!==4&&(e=e.child,e!==null))for(I3(e,t,n),e=e.sibling;e!==null;)I3(e,t,n),e=e.sibling}function R3(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(R3(e,t,n),e=e.sibling;e!==null;)R3(e,t,n),e=e.sibling}var wi=null,Va=!1;function au(e,t,n){for(n=n.child;n!==null;)FD(e,t,n),n=n.sibling}function FD(e,t,n){if(Ls&&typeof Ls.onCommitFiberUnmount=="function")try{Ls.onCommitFiberUnmount(hS,n)}catch{}switch(n.tag){case 5:Gi||Ff(n,t);case 6:var r=wi,i=Va;wi=null,au(e,t,n),wi=r,Va=i,wi!==null&&(Va?(e=wi,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):wi.removeChild(n.stateNode));break;case 18:wi!==null&&(Va?(e=wi,n=n.stateNode,e.nodeType===8?Fw(e.parentNode,n):e.nodeType===1&&Fw(e,n),hm(e)):Fw(wi,n.stateNode));break;case 4:r=wi,i=Va,wi=n.stateNode.containerInfo,Va=!0,au(e,t,n),wi=r,Va=i;break;case 0:case 11:case 14:case 15:if(!Gi&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){i=r=r.next;do{var o=i,a=o.destroy;o=o.tag,a!==void 0&&(o&2||o&4)&&A3(n,t,a),i=i.next}while(i!==r)}au(e,t,n);break;case 1:if(!Gi&&(Ff(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(s){gr(n,t,s)}au(e,t,n);break;case 21:au(e,t,n);break;case 22:n.mode&1?(Gi=(r=Gi)||n.memoizedState!==null,au(e,t,n),Gi=r):au(e,t,n);break;default:au(e,t,n)}}function B6(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new YX),t.forEach(function(r){var i=sY.bind(null,e,r);n.has(r)||(n.add(r),r.then(i,i))})}}function Fa(e,t){var n=t.deletions;if(n!==null)for(var r=0;ri&&(i=a),r&=~o}if(r=i,r=Cr()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*eY(r/1960))-r,10e?16:e,Iu===null)var r=!1;else{if(e=Iu,Iu=null,Ob=0,Ht&6)throw Error(le(331));var i=Ht;for(Ht|=4,De=e.current;De!==null;){var o=De,a=o.child;if(De.flags&16){var s=o.deletions;if(s!==null){for(var l=0;lCr()-Ik?ud(e,0):Pk|=n),To(e,t)}function qD(e,t){t===0&&(e.mode&1?(t=Ky,Ky<<=1,!(Ky&130023424)&&(Ky=4194304)):t=1);var n=no();e=Ul(e,t),e!==null&&(V0(e,t,n),To(e,n))}function aY(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),qD(e,n)}function sY(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,i=e.memoizedState;i!==null&&(n=i.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(le(314))}r!==null&&r.delete(t),qD(e,n)}var WD;WD=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||Eo.current)So=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return So=!1,KX(e,t,n);So=!!(e.flags&131072)}else So=!1,tr&&t.flags&1048576&&X$(t,wb,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;k1(e,t),e=t.pendingProps;var i=Nh(t,Wi.current);nh(t,n),i=wk(null,t,r,e,i,n);var o=Ck();return t.flags|=1,typeof i=="object"&&i!==null&&typeof i.render=="function"&&i.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,ko(r)?(o=!0,Sb(t)):o=!1,t.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,vk(t),i.updater=bS,t.stateNode=i,i._reactInternals=t,S3(t,r,e,n),t=C3(null,t,r,!0,o,n)):(t.tag=0,tr&&o&&dk(t),Ji(null,t,i,n),t=t.child),t;case 16:r=t.elementType;e:{switch(k1(e,t),e=t.pendingProps,i=r._init,r=i(r._payload),t.type=r,i=t.tag=uY(r),e=ja(r,e),i){case 0:t=w3(null,t,r,e,n);break e;case 1:t=N6(null,t,r,e,n);break e;case 11:t=O6(null,t,r,e,n);break e;case 14:t=M6(null,t,r,ja(r.type,e),n);break e}throw Error(le(306,r,""))}return t;case 0:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:ja(r,i),w3(e,t,r,i,n);case 1:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:ja(r,i),N6(e,t,r,i,n);case 3:e:{if(ID(t),e===null)throw Error(le(387));r=t.pendingProps,o=t.memoizedState,i=o.element,eD(e,t),kb(t,r,null,n);var a=t.memoizedState;if(r=a.element,o.isDehydrated)if(o={element:r,isDehydrated:!1,cache:a.cache,pendingSuspenseBoundaries:a.pendingSuspenseBoundaries,transitions:a.transitions},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){i=Fh(Error(le(423)),t),t=$6(e,t,r,n,i);break e}else if(r!==i){i=Fh(Error(le(424)),t),t=$6(e,t,r,n,i);break e}else for(Ho=Bu(t.stateNode.containerInfo.firstChild),Wo=t,tr=!0,Ha=null,n=iD(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if($h(),r===i){t=Vl(e,t,n);break e}Ji(e,t,r,n)}t=t.child}return t;case 5:return oD(t),e===null&&v3(t),r=t.type,i=t.pendingProps,o=e!==null?e.memoizedProps:null,a=i.children,h3(r,i)?a=null:o!==null&&h3(r,o)&&(t.flags|=32),PD(e,t),Ji(e,t,a,n),t.child;case 6:return e===null&&v3(t),null;case 13:return RD(e,t,n);case 4:return bk(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Dh(t,null,r,n):Ji(e,t,r,n),t.child;case 11:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:ja(r,i),O6(e,t,r,i,n);case 7:return Ji(e,t,t.pendingProps,n),t.child;case 8:return Ji(e,t,t.pendingProps.children,n),t.child;case 12:return Ji(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,i=t.pendingProps,o=t.memoizedProps,a=i.value,Nn(Cb,r._currentValue),r._currentValue=a,o!==null)if(os(o.value,a)){if(o.children===i.children&&!Eo.current){t=Vl(e,t,n);break e}}else for(o=t.child,o!==null&&(o.return=t);o!==null;){var s=o.dependencies;if(s!==null){a=o.child;for(var l=s.firstContext;l!==null;){if(l.context===r){if(o.tag===1){l=Ml(-1,n&-n),l.tag=2;var u=o.updateQueue;if(u!==null){u=u.shared;var c=u.pending;c===null?l.next=l:(l.next=c.next,c.next=l),u.pending=l}}o.lanes|=n,l=o.alternate,l!==null&&(l.lanes|=n),b3(o.return,n,t),s.lanes|=n;break}l=l.next}}else if(o.tag===10)a=o.type===t.type?null:o.child;else if(o.tag===18){if(a=o.return,a===null)throw Error(le(341));a.lanes|=n,s=a.alternate,s!==null&&(s.lanes|=n),b3(a,n,t),a=o.sibling}else a=o.child;if(a!==null)a.return=o;else for(a=o;a!==null;){if(a===t){a=null;break}if(o=a.sibling,o!==null){o.return=a.return,a=o;break}a=a.return}o=a}Ji(e,t,i.children,n),t=t.child}return t;case 9:return i=t.type,r=t.pendingProps.children,nh(t,n),i=Sa(i),r=r(i),t.flags|=1,Ji(e,t,r,n),t.child;case 14:return r=t.type,i=ja(r,t.pendingProps),i=ja(r.type,i),M6(e,t,r,i,n);case 15:return TD(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:ja(r,i),k1(e,t),t.tag=1,ko(r)?(e=!0,Sb(t)):e=!1,nh(t,n),nD(t,r,i),S3(t,r,i,n),C3(null,t,r,!0,e,n);case 19:return OD(e,t,n);case 22:return AD(e,t,n)}throw Error(le(156,t.tag))};function KD(e,t){return _$(e,t)}function lY(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function va(e,t,n,r){return new lY(e,t,n,r)}function Nk(e){return e=e.prototype,!(!e||!e.isReactComponent)}function uY(e){if(typeof e=="function")return Nk(e)?1:0;if(e!=null){if(e=e.$$typeof,e===J4)return 11;if(e===ek)return 14}return 2}function Vu(e,t){var n=e.alternate;return n===null?(n=va(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function P1(e,t,n,r,i,o){var a=2;if(r=e,typeof e=="function")Nk(e)&&(a=1);else if(typeof e=="string")a=5;else e:switch(e){case Pf:return cd(n.children,i,o,t);case Z4:a=8,i|=8;break;case H5:return e=va(12,n,t,i|2),e.elementType=H5,e.lanes=o,e;case q5:return e=va(13,n,t,i),e.elementType=q5,e.lanes=o,e;case W5:return e=va(19,n,t,i),e.elementType=W5,e.lanes=o,e;case r$:return wS(n,i,o,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case t$:a=10;break e;case n$:a=9;break e;case J4:a=11;break e;case ek:a=14;break e;case gu:a=16,r=null;break e}throw Error(le(130,e==null?e:typeof e,""))}return t=va(a,n,t,i),t.elementType=e,t.type=r,t.lanes=o,t}function cd(e,t,n,r){return e=va(7,e,r,t),e.lanes=n,e}function wS(e,t,n,r){return e=va(22,e,r,t),e.elementType=r$,e.lanes=n,e.stateNode={isHidden:!1},e}function qw(e,t,n){return e=va(6,e,null,t),e.lanes=n,e}function Ww(e,t,n){return t=va(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function cY(e,t,n,r,i){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Tw(0),this.expirationTimes=Tw(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Tw(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function $k(e,t,n,r,i,o,a,s,l){return e=new cY(e,t,n,s,l),t===1?(t=1,o===!0&&(t|=8)):t=0,o=va(3,null,null,t),e.current=o,o.stateNode=e,o.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},vk(o),e}function dY(e,t,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(ZD)}catch(e){console.error(e)}}ZD(),XN.exports=ea;var Uo=XN.exports;const Uje=pc(Uo);var W6=Uo;V5.createRoot=W6.createRoot,V5.hydrateRoot=W6.hydrateRoot;const mY="modulepreload",yY=function(e,t){return new URL(e,t).href},K6={},JD=function(t,n,r){if(!n||n.length===0)return t();const i=document.getElementsByTagName("link");return Promise.all(n.map(o=>{if(o=yY(o,r),o in K6)return;K6[o]=!0;const a=o.endsWith(".css"),s=a?'[rel="stylesheet"]':"";if(!!r)for(let c=i.length-1;c>=0;c--){const d=i[c];if(d.href===o&&(!a||d.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${o}"]${s}`))return;const u=document.createElement("link");if(u.rel=a?"stylesheet":mY,a||(u.as="script",u.crossOrigin=""),u.href=o,document.head.appendChild(u),a)return new Promise((c,d)=>{u.addEventListener("load",c),u.addEventListener("error",()=>d(new Error(`Unable to preload CSS for ${o}`)))})})).then(()=>t()).catch(o=>{const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=o,window.dispatchEvent(a),!a.defaultPrevented)throw o})};function ci(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r3?t.i-4:t.i:Array.isArray(e)?1:AS(e)?2:PS(e)?3:0}function Gu(e,t){return ec(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function I1(e,t){return ec(e)===2?e.get(t):e[t]}function eL(e,t,n){var r=ec(e);r===2?e.set(t,n):r===3?e.add(n):e[t]=n}function tL(e,t){return e===t?e!==0||1/e==1/t:e!=e&&t!=t}function AS(e){return wY&&e instanceof Map}function PS(e){return CY&&e instanceof Set}function ri(e){return e.o||e.t}function zk(e){if(Array.isArray(e))return Array.prototype.slice.call(e);var t=rL(e);delete t[St];for(var n=oh(t),r=0;r1&&(e.set=e.add=e.clear=e.delete=vY),Object.freeze(e),t&&Gl(e,function(n,r){return W0(r,!0)},!0)),e}function vY(){ci(2)}function jk(e){return e==null||typeof e!="object"||Object.isFrozen(e)}function Bs(e){var t=L3[e];return t||ci(18,e),t}function Uk(e,t){L3[e]||(L3[e]=t)}function Em(){return Tm}function Kw(e,t){t&&(Bs("Patches"),e.u=[],e.s=[],e.v=t)}function $b(e){D3(e),e.p.forEach(bY),e.p=null}function D3(e){e===Tm&&(Tm=e.l)}function Q6(e){return Tm={p:[],l:Tm,h:e,m:!0,_:0}}function bY(e){var t=e[St];t.i===0||t.i===1?t.j():t.g=!0}function Qw(e,t){t._=t.p.length;var n=t.p[0],r=e!==void 0&&e!==n;return t.h.O||Bs("ES5").S(t,e,r),r?(n[St].P&&($b(t),ci(4)),Ao(e)&&(e=Db(t,e),t.l||Lb(t,e)),t.u&&Bs("Patches").M(n[St].t,e,t.u,t.s)):e=Db(t,n,[]),$b(t),t.u&&t.v(t.u,t.s),e!==RS?e:void 0}function Db(e,t,n){if(jk(t))return t;var r=t[St];if(!r)return Gl(t,function(s,l){return X6(e,r,t,s,l,n)},!0),t;if(r.A!==e)return t;if(!r.P)return Lb(e,r.t,!0),r.t;if(!r.I){r.I=!0,r.A._--;var i=r.i===4||r.i===5?r.o=zk(r.k):r.o,o=i,a=!1;r.i===3&&(o=new Set(i),i.clear(),a=!0),Gl(o,function(s,l){return X6(e,r,i,s,l,n,a)}),Lb(e,i,!1),n&&e.u&&Bs("Patches").N(r,n,e.u,e.s)}return r.o}function X6(e,t,n,r,i,o,a){if(io(i)){var s=Db(e,i,o&&t&&t.i!==3&&!Gu(t.R,r)?o.concat(r):void 0);if(eL(n,r,s),!io(s))return;e.m=!1}else a&&n.add(i);if(Ao(i)&&!jk(i)){if(!e.h.D&&e._<1)return;Db(e,i),t&&t.A.l||Lb(e,i)}}function Lb(e,t,n){n===void 0&&(n=!1),!e.l&&e.h.D&&e.m&&W0(t,n)}function Xw(e,t){var n=e[St];return(n?ri(n):e)[t]}function Y6(e,t){if(t in e)for(var n=Object.getPrototypeOf(e);n;){var r=Object.getOwnPropertyDescriptor(n,t);if(r)return r;n=Object.getPrototypeOf(n)}}function bo(e){e.P||(e.P=!0,e.l&&bo(e.l))}function Yw(e){e.o||(e.o=zk(e.t))}function km(e,t,n){var r=AS(t)?Bs("MapSet").F(t,n):PS(t)?Bs("MapSet").T(t,n):e.O?function(i,o){var a=Array.isArray(i),s={i:a?1:0,A:o?o.A:Em(),P:!1,I:!1,R:{},l:o,t:i,k:null,o:null,j:null,C:!1},l=s,u=Am;a&&(l=[s],u=mg);var c=Proxy.revocable(l,u),d=c.revoke,f=c.proxy;return s.k=f,s.j=d,f}(t,n):Bs("ES5").J(t,n);return(n?n.A:Em()).p.push(r),r}function IS(e){return io(e)||ci(22,e),function t(n){if(!Ao(n))return n;var r,i=n[St],o=ec(n);if(i){if(!i.P&&(i.i<4||!Bs("ES5").K(i)))return i.t;i.I=!0,r=Z6(n,o),i.I=!1}else r=Z6(n,o);return Gl(r,function(a,s){i&&I1(i.t,a)===s||eL(r,a,t(s))}),o===3?new Set(r):r}(e)}function Z6(e,t){switch(t){case 2:return new Map(e);case 3:return Array.from(e)}return zk(e)}function Vk(){function e(o,a){var s=i[o];return s?s.enumerable=a:i[o]=s={configurable:!0,enumerable:a,get:function(){var l=this[St];return Am.get(l,o)},set:function(l){var u=this[St];Am.set(u,o,l)}},s}function t(o){for(var a=o.length-1;a>=0;a--){var s=o[a][St];if(!s.P)switch(s.i){case 5:r(s)&&bo(s);break;case 4:n(s)&&bo(s)}}}function n(o){for(var a=o.t,s=o.k,l=oh(s),u=l.length-1;u>=0;u--){var c=l[u];if(c!==St){var d=a[c];if(d===void 0&&!Gu(a,c))return!0;var f=s[c],h=f&&f[St];if(h?h.t!==d:!tL(f,d))return!0}}var p=!!a[St];return l.length!==oh(a).length+(p?0:1)}function r(o){var a=o.k;if(a.length!==o.t.length)return!0;var s=Object.getOwnPropertyDescriptor(a,a.length-1);if(s&&!s.get)return!0;for(var l=0;l1?b-1:0),g=1;g1?c-1:0),f=1;f=0;i--){var o=r[i];if(o.path.length===0&&o.op==="replace"){n=o.value;break}}i>-1&&(r=r.slice(i+1));var a=Bs("Patches").$;return io(n)?a(n,r):this.produce(n,function(s){return a(s,r)})},e}(),Yo=new iL,oL=Yo.produce,qk=Yo.produceWithPatches.bind(Yo),kY=Yo.setAutoFreeze.bind(Yo),TY=Yo.setUseProxies.bind(Yo),F3=Yo.applyPatches.bind(Yo),AY=Yo.createDraft.bind(Yo),PY=Yo.finishDraft.bind(Yo);const vc=oL,IY=Object.freeze(Object.defineProperty({__proto__:null,Immer:iL,applyPatches:F3,castDraft:SY,castImmutable:xY,createDraft:AY,current:IS,default:vc,enableAllPlugins:_Y,enableES5:Vk,enableMapSet:nL,enablePatches:Gk,finishDraft:PY,freeze:W0,immerable:ih,isDraft:io,isDraftable:Ao,nothing:RS,original:Bk,produce:oL,produceWithPatches:qk,setAutoFreeze:kY,setUseProxies:TY},Symbol.toStringTag,{value:"Module"}));function Pm(e){"@babel/helpers - typeof";return Pm=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},Pm(e)}function RY(e,t){if(Pm(e)!=="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(Pm(r)!=="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function OY(e){var t=RY(e,"string");return Pm(t)==="symbol"?t:String(t)}function MY(e,t,n){return t=OY(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function t8(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function n8(e){for(var t=1;t"u"&&(n=t,t=void 0),typeof n<"u"){if(typeof n!="function")throw new Error(Ci(1));return n(K0)(e,t)}if(typeof e!="function")throw new Error(Ci(2));var i=e,o=t,a=[],s=a,l=!1;function u(){s===a&&(s=a.slice())}function c(){if(l)throw new Error(Ci(3));return o}function d(m){if(typeof m!="function")throw new Error(Ci(4));if(l)throw new Error(Ci(5));var _=!0;return u(),s.push(m),function(){if(_){if(l)throw new Error(Ci(6));_=!1,u();var v=s.indexOf(m);s.splice(v,1),a=null}}}function f(m){if(!NY(m))throw new Error(Ci(7));if(typeof m.type>"u")throw new Error(Ci(8));if(l)throw new Error(Ci(9));try{l=!0,o=i(o,m)}finally{l=!1}for(var _=a=s,b=0;b<_.length;b++){var v=_[b];v()}return m}function h(m){if(typeof m!="function")throw new Error(Ci(10));i=m,f({type:zh.REPLACE})}function p(){var m,_=d;return m={subscribe:function(v){if(typeof v!="object"||v===null)throw new Error(Ci(11));function g(){v.next&&v.next(c())}g();var y=_(g);return{unsubscribe:y}}},m[r8]=function(){return this},m}return f({type:zh.INIT}),r={dispatch:f,subscribe:d,getState:c,replaceReducer:h},r[r8]=p,r}var aL=K0;function $Y(e){Object.keys(e).forEach(function(t){var n=e[t],r=n(void 0,{type:zh.INIT});if(typeof r>"u")throw new Error(Ci(12));if(typeof n(void 0,{type:zh.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(Ci(13))})}function pp(e){for(var t=Object.keys(e),n={},r=0;r"u")throw u&&u.type,new Error(Ci(14));d[h]=_,c=c||_!==m}return c=c||o.length!==Object.keys(l).length,c?d:l}}function i8(e,t){return function(){return t(e.apply(this,arguments))}}function sL(e,t){if(typeof e=="function")return i8(e,t);if(typeof e!="object"||e===null)throw new Error(Ci(16));var n={};for(var r in e){var i=e[r];typeof i=="function"&&(n[r]=i8(i,t))}return n}function jh(){for(var e=arguments.length,t=new Array(e),n=0;n-1){var u=n[l];return l>0&&(n.splice(l,1),n.unshift(u)),u.value}return Fb}function i(s,l){r(s)===Fb&&(n.unshift({key:s,value:l}),n.length>e&&n.pop())}function o(){return n}function a(){n=[]}return{get:r,put:i,getEntries:o,clear:a}}var lL=function(t,n){return t===n};function BY(e){return function(n,r){if(n===null||r===null||n.length!==r.length)return!1;for(var i=n.length,o=0;o1?t-1:0),r=1;r0&&o[o.length-1])&&(u[0]===6||u[0]===2)){n=0;continue}if(u[0]===3&&(!o||u[1]>o[0]&&u[1]",value:e};if(typeof e!="object"||e===null||o!=null&&o.has(e))return!1;for(var s=r!=null?r(e):Object.entries(e),l=i.length>0,u=function(_,b){var v=t?t+"."+_:_;if(l){var g=i.some(function(y){return y instanceof RegExp?y.test(v):v===y});if(g)return"continue"}if(!n(b))return{value:{keyPath:v,value:b}};if(typeof b=="object"&&(a=mL(b,v,n,r,i,o),a))return{value:a}},c=0,d=s;c-1}function nZ(e){return""+e}function SL(e){var t={},n=[],r,i={addCase:function(o,a){var s=typeof o=="string"?o:o.type;if(s in t)throw new Error("addCase cannot be called with two reducers for the same action type");return t[s]=a,i},addMatcher:function(o,a){return n.push({matcher:o,reducer:a}),i},addDefaultCase:function(o){return r=o,i}};return e(i),[t,n,r]}function rZ(e){return typeof e=="function"}function xL(e,t,n,r){n===void 0&&(n=[]);var i=typeof t=="function"?SL(t):[t,n,r],o=i[0],a=i[1],s=i[2],l;if(rZ(e))l=function(){return B3(e())};else{var u=B3(e);l=function(){return u}}function c(d,f){d===void 0&&(d=l());var h=tc([o[f.type]],a.filter(function(p){var m=p.matcher;return m(f)}).map(function(p){var m=p.reducer;return m}));return h.filter(function(p){return!!p}).length===0&&(h=[s]),h.reduce(function(p,m){if(m)if(io(p)){var _=p,b=m(_,f);return b===void 0?p:b}else{if(Ao(p))return vc(p,function(v){return m(v,f)});var b=m(p,f);if(b===void 0){if(p===null)return p;throw Error("A case reducer on a non-draftable value must not return undefined")}return b}return p},d)}return c.getInitialState=l,c}function iZ(e,t){return e+"/"+t}function nr(e){var t=e.name;if(!t)throw new Error("`name` is a required option for createSlice");typeof process<"u";var n=typeof e.initialState=="function"?e.initialState:B3(e.initialState),r=e.reducers||{},i=Object.keys(r),o={},a={},s={};i.forEach(function(c){var d=r[c],f=iZ(t,c),h,p;"reducer"in d?(h=d.reducer,p=d.prepare):h=d,o[c]=h,a[f]=h,s[c]=p?Ne(f,p):Ne(f)});function l(){var c=typeof e.extraReducers=="function"?SL(e.extraReducers):[e.extraReducers],d=c[0],f=d===void 0?{}:d,h=c[1],p=h===void 0?[]:h,m=c[2],_=m===void 0?void 0:m,b=xo(xo({},f),a);return xL(n,function(v){for(var g in b)v.addCase(g,b[g]);for(var y=0,S=p;y0;if(v){var g=p.filter(function(y){return u(_,y,m)}).length>0;g&&(m.ids=Object.keys(m.entities))}}function f(p,m){return h([p],m)}function h(p,m){var _=wL(p,e,m),b=_[0],v=_[1];d(v,m),n(b,m)}return{removeAll:lZ(l),addOne:xr(t),addMany:xr(n),setOne:xr(r),setMany:xr(i),setAll:xr(o),updateOne:xr(c),updateMany:xr(d),upsertOne:xr(f),upsertMany:xr(h),removeOne:xr(a),removeMany:xr(s)}}function uZ(e,t){var n=CL(e),r=n.removeOne,i=n.removeMany,o=n.removeAll;function a(v,g){return s([v],g)}function s(v,g){v=dd(v);var y=v.filter(function(S){return!(jg(S,e)in g.entities)});y.length!==0&&_(y,g)}function l(v,g){return u([v],g)}function u(v,g){v=dd(v),v.length!==0&&_(v,g)}function c(v,g){v=dd(v),g.entities={},g.ids=[],s(v,g)}function d(v,g){return f([v],g)}function f(v,g){for(var y=!1,S=0,w=v;S-1;return n&&r}function Y0(e){return typeof e[0]=="function"&&"pending"in e[0]&&"fulfilled"in e[0]&&"rejected"in e[0]}function NS(){for(var e=[],t=0;t0)for(var g=h.getState(),y=Array.from(n.values()),S=0,w=y;SMath.floor(e/t)*t,qa=(e,t)=>Math.round(e/t)*t;var AZ=typeof global=="object"&&global&&global.Object===Object&&global;const UL=AZ;var PZ=typeof self=="object"&&self&&self.Object===Object&&self,IZ=UL||PZ||Function("return this")();const el=IZ;var RZ=el.Symbol;const wa=RZ;var VL=Object.prototype,OZ=VL.hasOwnProperty,MZ=VL.toString,Up=wa?wa.toStringTag:void 0;function NZ(e){var t=OZ.call(e,Up),n=e[Up];try{e[Up]=void 0;var r=!0}catch{}var i=MZ.call(e);return r&&(t?e[Up]=n:delete e[Up]),i}var $Z=Object.prototype,DZ=$Z.toString;function LZ(e){return DZ.call(e)}var FZ="[object Null]",BZ="[object Undefined]",f8=wa?wa.toStringTag:void 0;function cs(e){return e==null?e===void 0?BZ:FZ:f8&&f8 in Object(e)?NZ(e):LZ(e)}function Po(e){return e!=null&&typeof e=="object"}var zZ="[object Symbol]";function $S(e){return typeof e=="symbol"||Po(e)&&cs(e)==zZ}function GL(e,t){for(var n=-1,r=e==null?0:e.length,i=Array(r);++n0){if(++t>=bJ)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}function wJ(e){return function(){return e}}var CJ=function(){try{var e=zd(Object,"defineProperty");return e({},"",{}),e}catch{}}();const Gb=CJ;var EJ=Gb?function(e,t){return Gb(e,"toString",{configurable:!0,enumerable:!1,value:wJ(t),writable:!0})}:DS;const kJ=EJ;var TJ=xJ(kJ);const KL=TJ;function QL(e,t){for(var n=-1,r=e==null?0:e.length;++n-1}var MJ=9007199254740991,NJ=/^(?:0|[1-9]\d*)$/;function Zk(e,t){var n=typeof e;return t=t??MJ,!!t&&(n=="number"||n!="symbol"&&NJ.test(e))&&e>-1&&e%1==0&&e-1&&e%1==0&&e<=LJ}function mp(e){return e!=null&&Jk(e.length)&&!Yk(e)}function FS(e,t,n){if(!Io(n))return!1;var r=typeof t;return(r=="number"?mp(n)&&Zk(t,n.length):r=="string"&&t in n)?ty(n[t],e):!1}function JL(e){return ZL(function(t,n){var r=-1,i=n.length,o=i>1?n[i-1]:void 0,a=i>2?n[2]:void 0;for(o=e.length>3&&typeof o=="function"?(i--,o):void 0,a&&FS(n[0],n[1],a)&&(o=i<3?void 0:o,i=1),t=Object(t);++r-1}function Zee(e,t){var n=this.__data__,r=zS(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this}function Yl(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t0&&n(s)?t>1?aF(s,t-1,n,r,i):oT(i,s):r||(i[i.length]=s)}return i}function gte(e){var t=e==null?0:e.length;return t?aF(e,1):[]}function mte(e){return KL(YL(e,void 0,gte),e+"")}var yte=iF(Object.getPrototypeOf,Object);const aT=yte;var vte="[object Object]",bte=Function.prototype,_te=Object.prototype,sF=bte.toString,Ste=_te.hasOwnProperty,xte=sF.call(Object);function lF(e){if(!Po(e)||cs(e)!=vte)return!1;var t=aT(e);if(t===null)return!0;var n=Ste.call(t,"constructor")&&t.constructor;return typeof n=="function"&&n instanceof n&&sF.call(n)==xte}function uF(e,t,n){var r=-1,i=e.length;t<0&&(t=-t>i?0:i+t),n=n>i?i:n,n<0&&(n+=i),i=t>n?0:n-t>>>0,t>>>=0;for(var o=Array(i);++r=r?e:uF(e,t,n)}var wte="\\ud800-\\udfff",Cte="\\u0300-\\u036f",Ete="\\ufe20-\\ufe2f",kte="\\u20d0-\\u20ff",Tte=Cte+Ete+kte,Ate="\\ufe0e\\ufe0f",Pte="\\u200d",Ite=RegExp("["+Pte+wte+Tte+Ate+"]");function VS(e){return Ite.test(e)}function Rte(e){return e.split("")}var dF="\\ud800-\\udfff",Ote="\\u0300-\\u036f",Mte="\\ufe20-\\ufe2f",Nte="\\u20d0-\\u20ff",$te=Ote+Mte+Nte,Dte="\\ufe0e\\ufe0f",Lte="["+dF+"]",V3="["+$te+"]",G3="\\ud83c[\\udffb-\\udfff]",Fte="(?:"+V3+"|"+G3+")",fF="[^"+dF+"]",hF="(?:\\ud83c[\\udde6-\\uddff]){2}",pF="[\\ud800-\\udbff][\\udc00-\\udfff]",Bte="\\u200d",gF=Fte+"?",mF="["+Dte+"]?",zte="(?:"+Bte+"(?:"+[fF,hF,pF].join("|")+")"+mF+gF+")*",jte=mF+gF+zte,Ute="(?:"+[fF+V3+"?",V3,hF,pF,Lte].join("|")+")",Vte=RegExp(G3+"(?="+G3+")|"+Ute+jte,"g");function Gte(e){return e.match(Vte)||[]}function yF(e){return VS(e)?Gte(e):Rte(e)}function Hte(e){return function(t){t=Vh(t);var n=VS(t)?yF(t):void 0,r=n?n[0]:t.charAt(0),i=n?cF(n,1).join(""):t.slice(1);return r[e]()+i}}var qte=Hte("toUpperCase");const vF=qte;function bF(e,t,n,r){var i=-1,o=e==null?0:e.length;for(r&&o&&(n=e[++i]);++i=t?e:t)),e}function Ru(e,t,n){return n===void 0&&(n=t,t=void 0),n!==void 0&&(n=O1(n),n=n===n?n:0),t!==void 0&&(t=O1(t),t=t===t?t:0),Dne(O1(e),t,n)}function Lne(){this.__data__=new Yl,this.size=0}function Fne(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}function Bne(e){return this.__data__.get(e)}function zne(e){return this.__data__.has(e)}var jne=200;function Une(e,t){var n=this.__data__;if(n instanceof Yl){var r=n.__data__;if(!Mm||r.lengths))return!1;var u=o.get(e),c=o.get(t);if(u&&c)return u==t&&c==e;var d=-1,f=!0,h=n&xie?new Nm:void 0;for(o.set(e,t),o.set(t,e);++d1),o}),gp(e,BF(e),n),r&&(n=Vg(n,joe|Uoe|Voe,zoe));for(var i=t.length;i--;)tB(n,t[i]);return n});const qS=Goe;var Hoe=YF("length");const qoe=Hoe;var nB="\\ud800-\\udfff",Woe="\\u0300-\\u036f",Koe="\\ufe20-\\ufe2f",Qoe="\\u20d0-\\u20ff",Xoe=Woe+Koe+Qoe,Yoe="\\ufe0e\\ufe0f",Zoe="["+nB+"]",X3="["+Xoe+"]",Y3="\\ud83c[\\udffb-\\udfff]",Joe="(?:"+X3+"|"+Y3+")",rB="[^"+nB+"]",iB="(?:\\ud83c[\\udde6-\\uddff]){2}",oB="[\\ud800-\\udbff][\\udc00-\\udfff]",eae="\\u200d",aB=Joe+"?",sB="["+Yoe+"]?",tae="(?:"+eae+"(?:"+[rB,iB,oB].join("|")+")"+sB+aB+")*",nae=sB+aB+tae,rae="(?:"+[rB+X3+"?",X3,iB,oB,Zoe].join("|")+")",W8=RegExp(Y3+"(?="+Y3+")|"+rae+nae,"g");function iae(e){for(var t=W8.lastIndex=0;W8.test(e);)++t;return t}function lB(e){return VS(e)?iae(e):qoe(e)}var oae=Math.floor,aae=Math.random;function sae(e,t){return e+oae(aae()*(t-e+1))}var lae=parseFloat,uae=Math.min,cae=Math.random;function dae(e,t,n){if(n&&typeof n!="boolean"&&FS(e,t,n)&&(t=n=void 0),n===void 0&&(typeof t=="boolean"?(n=t,t=void 0):typeof e=="boolean"&&(n=e,e=void 0)),e===void 0&&t===void 0?(e=0,t=1):(e=uh(e),t===void 0?(t=e,e=0):t=uh(t)),e>t){var r=e;e=t,t=r}if(n||e%1||t%1){var i=cae();return uae(e+i*(t-e+lae("1e-"+((i+"").length-1))),t)}return sae(e,t)}var fae=Math.ceil,hae=Math.max;function pae(e,t,n,r){for(var i=-1,o=hae(fae((t-e)/(n||1)),0),a=Array(o);o--;)a[r?o:++i]=e,e+=n;return a}function gae(e){return function(t,n,r){return r&&typeof r!="number"&&FS(t,n,r)&&(n=r=void 0),t=uh(t),n===void 0?(n=t,t=0):n=uh(n),r=r===void 0?t=o)return e;var s=n-lB(r);if(s<1)return r;var l=a?cF(a,0,s).join(""):e.slice(0,s);if(i===void 0)return l+r;if(a&&(s+=l.length-s),Doe(i)){if(e.slice(s).search(i)){var u,c=l;for(i.global||(i=RegExp(i.source,Vh(kae.exec(i))+"g")),i.lastIndex=0;u=i.exec(c);)var d=u.index;l=l.slice(0,d===void 0?s:d)}}else if(e.indexOf(Vb(i),s)!=s){var f=l.lastIndexOf(i);f>-1&&(l=l.slice(0,f))}return l+r}var Tae=1/0,Aae=dh&&1/uT(new dh([,-0]))[1]==Tae?function(e){return new dh(e)}:vJ;const Pae=Aae;var Iae=200;function Rae(e,t,n){var r=-1,i=OJ,o=e.length,a=!0,s=[],l=s;if(n)a=!1,i=voe;else if(o>=Iae){var u=t?null:Pae(e);if(u)return uT(u);a=!1,i=qF,l=new Nm}else l=t?[]:s;e:for(;++r{Boe(e,t.payload)}}}),{configChanged:Oae}=cB.actions,Mae=cB.reducer,Vje={any:"Any","sd-1":"Stable Diffusion 1.x","sd-2":"Stable Diffusion 2.x",sdxl:"Stable Diffusion XL","sdxl-refiner":"Stable Diffusion XL Refiner"},Gje={any:"Any","sd-1":"SD1","sd-2":"SD2",sdxl:"SDXL","sdxl-refiner":"SDXLR"},Nae={any:{maxClip:0,markers:[]},"sd-1":{maxClip:12,markers:[0,1,2,3,4,8,12]},"sd-2":{maxClip:24,markers:[0,1,2,3,5,10,15,20,24]},sdxl:{maxClip:24,markers:[0,1,2,3,5,10,15,20,24]},"sdxl-refiner":{maxClip:24,markers:[0,1,2,3,5,10,15,20,24]}},Hje={lycoris:"LyCORIS",diffusers:"Diffusers"},$ae=0,Gg=4294967295;var Xt;(function(e){e.assertEqual=i=>i;function t(i){}e.assertIs=t;function n(i){throw new Error}e.assertNever=n,e.arrayToEnum=i=>{const o={};for(const a of i)o[a]=a;return o},e.getValidEnumValues=i=>{const o=e.objectKeys(i).filter(s=>typeof i[i[s]]!="number"),a={};for(const s of o)a[s]=i[s];return e.objectValues(a)},e.objectValues=i=>e.objectKeys(i).map(function(o){return i[o]}),e.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{const o=[];for(const a in i)Object.prototype.hasOwnProperty.call(i,a)&&o.push(a);return o},e.find=(i,o)=>{for(const a of i)if(o(a))return a},e.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&isFinite(i)&&Math.floor(i)===i;function r(i,o=" | "){return i.map(a=>typeof a=="string"?`'${a}'`:a).join(o)}e.joinValues=r,e.jsonStringifyReplacer=(i,o)=>typeof o=="bigint"?o.toString():o})(Xt||(Xt={}));var J3;(function(e){e.mergeShapes=(t,n)=>({...t,...n})})(J3||(J3={}));const Re=Xt.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),wu=e=>{switch(typeof e){case"undefined":return Re.undefined;case"string":return Re.string;case"number":return isNaN(e)?Re.nan:Re.number;case"boolean":return Re.boolean;case"function":return Re.function;case"bigint":return Re.bigint;case"symbol":return Re.symbol;case"object":return Array.isArray(e)?Re.array:e===null?Re.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?Re.promise:typeof Map<"u"&&e instanceof Map?Re.map:typeof Set<"u"&&e instanceof Set?Re.set:typeof Date<"u"&&e instanceof Date?Re.date:Re.object;default:return Re.unknown}},he=Xt.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),Dae=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:");class ns extends Error{constructor(t){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};const n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=t}get errors(){return this.issues}format(t){const n=t||function(o){return o.message},r={_errors:[]},i=o=>{for(const a of o.issues)if(a.code==="invalid_union")a.unionErrors.map(i);else if(a.code==="invalid_return_type")i(a.returnTypeError);else if(a.code==="invalid_arguments")i(a.argumentsError);else if(a.path.length===0)r._errors.push(n(a));else{let s=r,l=0;for(;ln.message){const n={},r=[];for(const i of this.issues)i.path.length>0?(n[i.path[0]]=n[i.path[0]]||[],n[i.path[0]].push(t(i))):r.push(t(i));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}}ns.create=e=>new ns(e);const $m=(e,t)=>{let n;switch(e.code){case he.invalid_type:e.received===Re.undefined?n="Required":n=`Expected ${e.expected}, received ${e.received}`;break;case he.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,Xt.jsonStringifyReplacer)}`;break;case he.unrecognized_keys:n=`Unrecognized key(s) in object: ${Xt.joinValues(e.keys,", ")}`;break;case he.invalid_union:n="Invalid input";break;case he.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${Xt.joinValues(e.options)}`;break;case he.invalid_enum_value:n=`Invalid enum value. Expected ${Xt.joinValues(e.options)}, received '${e.received}'`;break;case he.invalid_arguments:n="Invalid function arguments";break;case he.invalid_return_type:n="Invalid function return type";break;case he.invalid_date:n="Invalid date";break;case he.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:Xt.assertNever(e.validation):e.validation!=="regex"?n=`Invalid ${e.validation}`:n="Invalid";break;case he.too_small:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:n="Invalid input";break;case he.too_big:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?n=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:n="Invalid input";break;case he.custom:n="Invalid input";break;case he.invalid_intersection_types:n="Intersection results could not be merged";break;case he.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case he.not_finite:n="Number must be finite";break;default:n=t.defaultError,Xt.assertNever(e)}return{message:n}};let dB=$m;function Lae(e){dB=e}function qb(){return dB}const Wb=e=>{const{data:t,path:n,errorMaps:r,issueData:i}=e,o=[...n,...i.path||[]],a={...i,path:o};let s="";const l=r.filter(u=>!!u).slice().reverse();for(const u of l)s=u(a,{data:t,defaultError:s}).message;return{...i,path:o,message:i.message||s}},Fae=[];function Me(e,t){const n=Wb({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,qb(),$m].filter(r=>!!r)});e.common.issues.push(n)}class Ki{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,n){const r=[];for(const i of n){if(i.status==="aborted")return yt;i.status==="dirty"&&t.dirty(),r.push(i.value)}return{status:t.value,value:r}}static async mergeObjectAsync(t,n){const r=[];for(const i of n)r.push({key:await i.key,value:await i.value});return Ki.mergeObjectSync(t,r)}static mergeObjectSync(t,n){const r={};for(const i of n){const{key:o,value:a}=i;if(o.status==="aborted"||a.status==="aborted")return yt;o.status==="dirty"&&t.dirty(),a.status==="dirty"&&t.dirty(),o.value!=="__proto__"&&(typeof a.value<"u"||i.alwaysSet)&&(r[o.value]=a.value)}return{status:t.value,value:r}}}const yt=Object.freeze({status:"aborted"}),fB=e=>({status:"dirty",value:e}),oo=e=>({status:"valid",value:e}),eE=e=>e.status==="aborted",tE=e=>e.status==="dirty",Dm=e=>e.status==="valid",Kb=e=>typeof Promise<"u"&&e instanceof Promise;var rt;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t==null?void 0:t.message})(rt||(rt={}));class Ks{constructor(t,n,r,i){this._cachedPath=[],this.parent=t,this.data=n,this._path=r,this._key=i}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const Y8=(e,t)=>{if(Dm(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const n=new ns(e.common.issues);return this._error=n,this._error}}};function xt(e){if(!e)return{};const{errorMap:t,invalid_type_error:n,required_error:r,description:i}=e;if(t&&(n||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:i}:{errorMap:(a,s)=>a.code!=="invalid_type"?{message:s.defaultError}:typeof s.data>"u"?{message:r??s.defaultError}:{message:n??s.defaultError},description:i}}class Et{constructor(t){this.spa=this.safeParseAsync,this._def=t,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(t){return wu(t.data)}_getOrReturnCtx(t,n){return n||{common:t.parent.common,data:t.data,parsedType:wu(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new Ki,ctx:{common:t.parent.common,data:t.data,parsedType:wu(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){const n=this._parse(t);if(Kb(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(t){const n=this._parse(t);return Promise.resolve(n)}parse(t,n){const r=this.safeParse(t,n);if(r.success)return r.data;throw r.error}safeParse(t,n){var r;const i={common:{issues:[],async:(r=n==null?void 0:n.async)!==null&&r!==void 0?r:!1,contextualErrorMap:n==null?void 0:n.errorMap},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:wu(t)},o=this._parseSync({data:t,path:i.path,parent:i});return Y8(i,o)}async parseAsync(t,n){const r=await this.safeParseAsync(t,n);if(r.success)return r.data;throw r.error}async safeParseAsync(t,n){const r={common:{issues:[],contextualErrorMap:n==null?void 0:n.errorMap,async:!0},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:wu(t)},i=this._parse({data:t,path:r.path,parent:r}),o=await(Kb(i)?i:Promise.resolve(i));return Y8(r,o)}refine(t,n){const r=i=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(i):n;return this._refinement((i,o)=>{const a=t(i),s=()=>o.addIssue({code:he.custom,...r(i)});return typeof Promise<"u"&&a instanceof Promise?a.then(l=>l?!0:(s(),!1)):a?!0:(s(),!1)})}refinement(t,n){return this._refinement((r,i)=>t(r)?!0:(i.addIssue(typeof n=="function"?n(r,i):n),!1))}_refinement(t){return new ss({schema:this,typeName:st.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}optional(){return Nl.create(this,this._def)}nullable(){return Ad.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return rs.create(this,this._def)}promise(){return qh.create(this,this._def)}or(t){return zm.create([this,t],this._def)}and(t){return jm.create(this,t,this._def)}transform(t){return new ss({...xt(this._def),schema:this,typeName:st.ZodEffects,effect:{type:"transform",transform:t}})}default(t){const n=typeof t=="function"?t:()=>t;return new qm({...xt(this._def),innerType:this,defaultValue:n,typeName:st.ZodDefault})}brand(){return new pB({typeName:st.ZodBranded,type:this,...xt(this._def)})}catch(t){const n=typeof t=="function"?t:()=>t;return new Zb({...xt(this._def),innerType:this,catchValue:n,typeName:st.ZodCatch})}describe(t){const n=this.constructor;return new n({...this._def,description:t})}pipe(t){return sy.create(this,t)}readonly(){return e_.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const Bae=/^c[^\s-]{8,}$/i,zae=/^[a-z][a-z0-9]*$/,jae=/[0-9A-HJKMNP-TV-Z]{26}/,Uae=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,Vae=/^([A-Z0-9_+-]+\.?)*[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Gae=/^(\p{Extended_Pictographic}|\p{Emoji_Component})+$/u,Hae=/^(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))$/,qae=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,Wae=e=>e.precision?e.offset?new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${e.precision}}(([+-]\\d{2}(:?\\d{2})?)|Z)$`):new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${e.precision}}Z$`):e.precision===0?e.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(([+-]\\d{2}(:?\\d{2})?)|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$"):e.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}(:?\\d{2})?)|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$");function Kae(e,t){return!!((t==="v4"||!t)&&Hae.test(e)||(t==="v6"||!t)&&qae.test(e))}class Ya extends Et{constructor(){super(...arguments),this._regex=(t,n,r)=>this.refinement(i=>t.test(i),{validation:n,code:he.invalid_string,...rt.errToObj(r)}),this.nonempty=t=>this.min(1,rt.errToObj(t)),this.trim=()=>new Ya({...this._def,checks:[...this._def.checks,{kind:"trim"}]}),this.toLowerCase=()=>new Ya({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]}),this.toUpperCase=()=>new Ya({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==Re.string){const o=this._getOrReturnCtx(t);return Me(o,{code:he.invalid_type,expected:Re.string,received:o.parsedType}),yt}const r=new Ki;let i;for(const o of this._def.checks)if(o.kind==="min")t.data.lengtho.value&&(i=this._getOrReturnCtx(t,i),Me(i,{code:he.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),r.dirty());else if(o.kind==="length"){const a=t.data.length>o.value,s=t.data.length"u"?null:t==null?void 0:t.precision,offset:(n=t==null?void 0:t.offset)!==null&&n!==void 0?n:!1,...rt.errToObj(t==null?void 0:t.message)})}regex(t,n){return this._addCheck({kind:"regex",regex:t,...rt.errToObj(n)})}includes(t,n){return this._addCheck({kind:"includes",value:t,position:n==null?void 0:n.position,...rt.errToObj(n==null?void 0:n.message)})}startsWith(t,n){return this._addCheck({kind:"startsWith",value:t,...rt.errToObj(n)})}endsWith(t,n){return this._addCheck({kind:"endsWith",value:t,...rt.errToObj(n)})}min(t,n){return this._addCheck({kind:"min",value:t,...rt.errToObj(n)})}max(t,n){return this._addCheck({kind:"max",value:t,...rt.errToObj(n)})}length(t,n){return this._addCheck({kind:"length",value:t,...rt.errToObj(n)})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get minLength(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxLength(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value{var t;return new Ya({checks:[],typeName:st.ZodString,coerce:(t=e==null?void 0:e.coerce)!==null&&t!==void 0?t:!1,...xt(e)})};function Qae(e,t){const n=(e.toString().split(".")[1]||"").length,r=(t.toString().split(".")[1]||"").length,i=n>r?n:r,o=parseInt(e.toFixed(i).replace(".","")),a=parseInt(t.toFixed(i).replace(".",""));return o%a/Math.pow(10,i)}class rc extends Et{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==Re.number){const o=this._getOrReturnCtx(t);return Me(o,{code:he.invalid_type,expected:Re.number,received:o.parsedType}),yt}let r;const i=new Ki;for(const o of this._def.checks)o.kind==="int"?Xt.isInteger(t.data)||(r=this._getOrReturnCtx(t,r),Me(r,{code:he.invalid_type,expected:"integer",received:"float",message:o.message}),i.dirty()):o.kind==="min"?(o.inclusive?t.datao.value:t.data>=o.value)&&(r=this._getOrReturnCtx(t,r),Me(r,{code:he.too_big,maximum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),i.dirty()):o.kind==="multipleOf"?Qae(t.data,o.value)!==0&&(r=this._getOrReturnCtx(t,r),Me(r,{code:he.not_multiple_of,multipleOf:o.value,message:o.message}),i.dirty()):o.kind==="finite"?Number.isFinite(t.data)||(r=this._getOrReturnCtx(t,r),Me(r,{code:he.not_finite,message:o.message}),i.dirty()):Xt.assertNever(o);return{status:i.value,value:t.data}}gte(t,n){return this.setLimit("min",t,!0,rt.toString(n))}gt(t,n){return this.setLimit("min",t,!1,rt.toString(n))}lte(t,n){return this.setLimit("max",t,!0,rt.toString(n))}lt(t,n){return this.setLimit("max",t,!1,rt.toString(n))}setLimit(t,n,r,i){return new rc({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:rt.toString(i)}]})}_addCheck(t){return new rc({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:rt.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:rt.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:rt.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:rt.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:rt.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:rt.toString(n)})}finite(t){return this._addCheck({kind:"finite",message:rt.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:rt.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:rt.toString(t)})}get minValue(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.valuet.kind==="int"||t.kind==="multipleOf"&&Xt.isInteger(t.value))}get isFinite(){let t=null,n=null;for(const r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(n===null||r.value>n)&&(n=r.value):r.kind==="max"&&(t===null||r.valuenew rc({checks:[],typeName:st.ZodNumber,coerce:(e==null?void 0:e.coerce)||!1,...xt(e)});class ic extends Et{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce&&(t.data=BigInt(t.data)),this._getType(t)!==Re.bigint){const o=this._getOrReturnCtx(t);return Me(o,{code:he.invalid_type,expected:Re.bigint,received:o.parsedType}),yt}let r;const i=new Ki;for(const o of this._def.checks)o.kind==="min"?(o.inclusive?t.datao.value:t.data>=o.value)&&(r=this._getOrReturnCtx(t,r),Me(r,{code:he.too_big,type:"bigint",maximum:o.value,inclusive:o.inclusive,message:o.message}),i.dirty()):o.kind==="multipleOf"?t.data%o.value!==BigInt(0)&&(r=this._getOrReturnCtx(t,r),Me(r,{code:he.not_multiple_of,multipleOf:o.value,message:o.message}),i.dirty()):Xt.assertNever(o);return{status:i.value,value:t.data}}gte(t,n){return this.setLimit("min",t,!0,rt.toString(n))}gt(t,n){return this.setLimit("min",t,!1,rt.toString(n))}lte(t,n){return this.setLimit("max",t,!0,rt.toString(n))}lt(t,n){return this.setLimit("max",t,!1,rt.toString(n))}setLimit(t,n,r,i){return new ic({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:rt.toString(i)}]})}_addCheck(t){return new ic({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:rt.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:rt.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:rt.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:rt.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:rt.toString(n)})}get minValue(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value{var t;return new ic({checks:[],typeName:st.ZodBigInt,coerce:(t=e==null?void 0:e.coerce)!==null&&t!==void 0?t:!1,...xt(e)})};class Lm extends Et{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==Re.boolean){const r=this._getOrReturnCtx(t);return Me(r,{code:he.invalid_type,expected:Re.boolean,received:r.parsedType}),yt}return oo(t.data)}}Lm.create=e=>new Lm({typeName:st.ZodBoolean,coerce:(e==null?void 0:e.coerce)||!1,...xt(e)});class kd extends Et{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==Re.date){const o=this._getOrReturnCtx(t);return Me(o,{code:he.invalid_type,expected:Re.date,received:o.parsedType}),yt}if(isNaN(t.data.getTime())){const o=this._getOrReturnCtx(t);return Me(o,{code:he.invalid_date}),yt}const r=new Ki;let i;for(const o of this._def.checks)o.kind==="min"?t.data.getTime()o.value&&(i=this._getOrReturnCtx(t,i),Me(i,{code:he.too_big,message:o.message,inclusive:!0,exact:!1,maximum:o.value,type:"date"}),r.dirty()):Xt.assertNever(o);return{status:r.value,value:new Date(t.data.getTime())}}_addCheck(t){return new kd({...this._def,checks:[...this._def.checks,t]})}min(t,n){return this._addCheck({kind:"min",value:t.getTime(),message:rt.toString(n)})}max(t,n){return this._addCheck({kind:"max",value:t.getTime(),message:rt.toString(n)})}get minDate(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.valuenew kd({checks:[],coerce:(e==null?void 0:e.coerce)||!1,typeName:st.ZodDate,...xt(e)});class Qb extends Et{_parse(t){if(this._getType(t)!==Re.symbol){const r=this._getOrReturnCtx(t);return Me(r,{code:he.invalid_type,expected:Re.symbol,received:r.parsedType}),yt}return oo(t.data)}}Qb.create=e=>new Qb({typeName:st.ZodSymbol,...xt(e)});class Fm extends Et{_parse(t){if(this._getType(t)!==Re.undefined){const r=this._getOrReturnCtx(t);return Me(r,{code:he.invalid_type,expected:Re.undefined,received:r.parsedType}),yt}return oo(t.data)}}Fm.create=e=>new Fm({typeName:st.ZodUndefined,...xt(e)});class Bm extends Et{_parse(t){if(this._getType(t)!==Re.null){const r=this._getOrReturnCtx(t);return Me(r,{code:he.invalid_type,expected:Re.null,received:r.parsedType}),yt}return oo(t.data)}}Bm.create=e=>new Bm({typeName:st.ZodNull,...xt(e)});class Hh extends Et{constructor(){super(...arguments),this._any=!0}_parse(t){return oo(t.data)}}Hh.create=e=>new Hh({typeName:st.ZodAny,...xt(e)});class fd extends Et{constructor(){super(...arguments),this._unknown=!0}_parse(t){return oo(t.data)}}fd.create=e=>new fd({typeName:st.ZodUnknown,...xt(e)});class Hl extends Et{_parse(t){const n=this._getOrReturnCtx(t);return Me(n,{code:he.invalid_type,expected:Re.never,received:n.parsedType}),yt}}Hl.create=e=>new Hl({typeName:st.ZodNever,...xt(e)});class Xb extends Et{_parse(t){if(this._getType(t)!==Re.undefined){const r=this._getOrReturnCtx(t);return Me(r,{code:he.invalid_type,expected:Re.void,received:r.parsedType}),yt}return oo(t.data)}}Xb.create=e=>new Xb({typeName:st.ZodVoid,...xt(e)});class rs extends Et{_parse(t){const{ctx:n,status:r}=this._processInputParams(t),i=this._def;if(n.parsedType!==Re.array)return Me(n,{code:he.invalid_type,expected:Re.array,received:n.parsedType}),yt;if(i.exactLength!==null){const a=n.data.length>i.exactLength.value,s=n.data.lengthi.maxLength.value&&(Me(n,{code:he.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((a,s)=>i.type._parseAsync(new Ks(n,a,n.path,s)))).then(a=>Ki.mergeArray(r,a));const o=[...n.data].map((a,s)=>i.type._parseSync(new Ks(n,a,n.path,s)));return Ki.mergeArray(r,o)}get element(){return this._def.type}min(t,n){return new rs({...this._def,minLength:{value:t,message:rt.toString(n)}})}max(t,n){return new rs({...this._def,maxLength:{value:t,message:rt.toString(n)}})}length(t,n){return new rs({...this._def,exactLength:{value:t,message:rt.toString(n)}})}nonempty(t){return this.min(1,t)}}rs.create=(e,t)=>new rs({type:e,minLength:null,maxLength:null,exactLength:null,typeName:st.ZodArray,...xt(t)});function wf(e){if(e instanceof ar){const t={};for(const n in e.shape){const r=e.shape[n];t[n]=Nl.create(wf(r))}return new ar({...e._def,shape:()=>t})}else return e instanceof rs?new rs({...e._def,type:wf(e.element)}):e instanceof Nl?Nl.create(wf(e.unwrap())):e instanceof Ad?Ad.create(wf(e.unwrap())):e instanceof Qs?Qs.create(e.items.map(t=>wf(t))):e}class ar extends Et{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const t=this._def.shape(),n=Xt.objectKeys(t);return this._cached={shape:t,keys:n}}_parse(t){if(this._getType(t)!==Re.object){const u=this._getOrReturnCtx(t);return Me(u,{code:he.invalid_type,expected:Re.object,received:u.parsedType}),yt}const{status:r,ctx:i}=this._processInputParams(t),{shape:o,keys:a}=this._getCached(),s=[];if(!(this._def.catchall instanceof Hl&&this._def.unknownKeys==="strip"))for(const u in i.data)a.includes(u)||s.push(u);const l=[];for(const u of a){const c=o[u],d=i.data[u];l.push({key:{status:"valid",value:u},value:c._parse(new Ks(i,d,i.path,u)),alwaysSet:u in i.data})}if(this._def.catchall instanceof Hl){const u=this._def.unknownKeys;if(u==="passthrough")for(const c of s)l.push({key:{status:"valid",value:c},value:{status:"valid",value:i.data[c]}});else if(u==="strict")s.length>0&&(Me(i,{code:he.unrecognized_keys,keys:s}),r.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const u=this._def.catchall;for(const c of s){const d=i.data[c];l.push({key:{status:"valid",value:c},value:u._parse(new Ks(i,d,i.path,c)),alwaysSet:c in i.data})}}return i.common.async?Promise.resolve().then(async()=>{const u=[];for(const c of l){const d=await c.key;u.push({key:d,value:await c.value,alwaysSet:c.alwaysSet})}return u}).then(u=>Ki.mergeObjectSync(r,u)):Ki.mergeObjectSync(r,l)}get shape(){return this._def.shape()}strict(t){return rt.errToObj,new ar({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(n,r)=>{var i,o,a,s;const l=(a=(o=(i=this._def).errorMap)===null||o===void 0?void 0:o.call(i,n,r).message)!==null&&a!==void 0?a:r.defaultError;return n.code==="unrecognized_keys"?{message:(s=rt.errToObj(t).message)!==null&&s!==void 0?s:l}:{message:l}}}:{}})}strip(){return new ar({...this._def,unknownKeys:"strip"})}passthrough(){return new ar({...this._def,unknownKeys:"passthrough"})}extend(t){return new ar({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new ar({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:st.ZodObject})}setKey(t,n){return this.augment({[t]:n})}catchall(t){return new ar({...this._def,catchall:t})}pick(t){const n={};return Xt.objectKeys(t).forEach(r=>{t[r]&&this.shape[r]&&(n[r]=this.shape[r])}),new ar({...this._def,shape:()=>n})}omit(t){const n={};return Xt.objectKeys(this.shape).forEach(r=>{t[r]||(n[r]=this.shape[r])}),new ar({...this._def,shape:()=>n})}deepPartial(){return wf(this)}partial(t){const n={};return Xt.objectKeys(this.shape).forEach(r=>{const i=this.shape[r];t&&!t[r]?n[r]=i:n[r]=i.optional()}),new ar({...this._def,shape:()=>n})}required(t){const n={};return Xt.objectKeys(this.shape).forEach(r=>{if(t&&!t[r])n[r]=this.shape[r];else{let o=this.shape[r];for(;o instanceof Nl;)o=o._def.innerType;n[r]=o}}),new ar({...this._def,shape:()=>n})}keyof(){return hB(Xt.objectKeys(this.shape))}}ar.create=(e,t)=>new ar({shape:()=>e,unknownKeys:"strip",catchall:Hl.create(),typeName:st.ZodObject,...xt(t)});ar.strictCreate=(e,t)=>new ar({shape:()=>e,unknownKeys:"strict",catchall:Hl.create(),typeName:st.ZodObject,...xt(t)});ar.lazycreate=(e,t)=>new ar({shape:e,unknownKeys:"strip",catchall:Hl.create(),typeName:st.ZodObject,...xt(t)});class zm extends Et{_parse(t){const{ctx:n}=this._processInputParams(t),r=this._def.options;function i(o){for(const s of o)if(s.result.status==="valid")return s.result;for(const s of o)if(s.result.status==="dirty")return n.common.issues.push(...s.ctx.common.issues),s.result;const a=o.map(s=>new ns(s.ctx.common.issues));return Me(n,{code:he.invalid_union,unionErrors:a}),yt}if(n.common.async)return Promise.all(r.map(async o=>{const a={...n,common:{...n.common,issues:[]},parent:null};return{result:await o._parseAsync({data:n.data,path:n.path,parent:a}),ctx:a}})).then(i);{let o;const a=[];for(const l of r){const u={...n,common:{...n.common,issues:[]},parent:null},c=l._parseSync({data:n.data,path:n.path,parent:u});if(c.status==="valid")return c;c.status==="dirty"&&!o&&(o={result:c,ctx:u}),u.common.issues.length&&a.push(u.common.issues)}if(o)return n.common.issues.push(...o.ctx.common.issues),o.result;const s=a.map(l=>new ns(l));return Me(n,{code:he.invalid_union,unionErrors:s}),yt}}get options(){return this._def.options}}zm.create=(e,t)=>new zm({options:e,typeName:st.ZodUnion,...xt(t)});const M1=e=>e instanceof Vm?M1(e.schema):e instanceof ss?M1(e.innerType()):e instanceof Gm?[e.value]:e instanceof oc?e.options:e instanceof Hm?Object.keys(e.enum):e instanceof qm?M1(e._def.innerType):e instanceof Fm?[void 0]:e instanceof Bm?[null]:null;class KS extends Et{_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==Re.object)return Me(n,{code:he.invalid_type,expected:Re.object,received:n.parsedType}),yt;const r=this.discriminator,i=n.data[r],o=this.optionsMap.get(i);return o?n.common.async?o._parseAsync({data:n.data,path:n.path,parent:n}):o._parseSync({data:n.data,path:n.path,parent:n}):(Me(n,{code:he.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),yt)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,n,r){const i=new Map;for(const o of n){const a=M1(o.shape[t]);if(!a)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(const s of a){if(i.has(s))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(s)}`);i.set(s,o)}}return new KS({typeName:st.ZodDiscriminatedUnion,discriminator:t,options:n,optionsMap:i,...xt(r)})}}function nE(e,t){const n=wu(e),r=wu(t);if(e===t)return{valid:!0,data:e};if(n===Re.object&&r===Re.object){const i=Xt.objectKeys(t),o=Xt.objectKeys(e).filter(s=>i.indexOf(s)!==-1),a={...e,...t};for(const s of o){const l=nE(e[s],t[s]);if(!l.valid)return{valid:!1};a[s]=l.data}return{valid:!0,data:a}}else if(n===Re.array&&r===Re.array){if(e.length!==t.length)return{valid:!1};const i=[];for(let o=0;o{if(eE(o)||eE(a))return yt;const s=nE(o.value,a.value);return s.valid?((tE(o)||tE(a))&&n.dirty(),{status:n.value,value:s.data}):(Me(r,{code:he.invalid_intersection_types}),yt)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([o,a])=>i(o,a)):i(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}jm.create=(e,t,n)=>new jm({left:e,right:t,typeName:st.ZodIntersection,...xt(n)});class Qs extends Et{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==Re.array)return Me(r,{code:he.invalid_type,expected:Re.array,received:r.parsedType}),yt;if(r.data.lengththis._def.items.length&&(Me(r,{code:he.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());const o=[...r.data].map((a,s)=>{const l=this._def.items[s]||this._def.rest;return l?l._parse(new Ks(r,a,r.path,s)):null}).filter(a=>!!a);return r.common.async?Promise.all(o).then(a=>Ki.mergeArray(n,a)):Ki.mergeArray(n,o)}get items(){return this._def.items}rest(t){return new Qs({...this._def,rest:t})}}Qs.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Qs({items:e,typeName:st.ZodTuple,rest:null,...xt(t)})};class Um extends Et{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==Re.object)return Me(r,{code:he.invalid_type,expected:Re.object,received:r.parsedType}),yt;const i=[],o=this._def.keyType,a=this._def.valueType;for(const s in r.data)i.push({key:o._parse(new Ks(r,s,r.path,s)),value:a._parse(new Ks(r,r.data[s],r.path,s))});return r.common.async?Ki.mergeObjectAsync(n,i):Ki.mergeObjectSync(n,i)}get element(){return this._def.valueType}static create(t,n,r){return n instanceof Et?new Um({keyType:t,valueType:n,typeName:st.ZodRecord,...xt(r)}):new Um({keyType:Ya.create(),valueType:t,typeName:st.ZodRecord,...xt(n)})}}class Yb extends Et{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==Re.map)return Me(r,{code:he.invalid_type,expected:Re.map,received:r.parsedType}),yt;const i=this._def.keyType,o=this._def.valueType,a=[...r.data.entries()].map(([s,l],u)=>({key:i._parse(new Ks(r,s,r.path,[u,"key"])),value:o._parse(new Ks(r,l,r.path,[u,"value"]))}));if(r.common.async){const s=new Map;return Promise.resolve().then(async()=>{for(const l of a){const u=await l.key,c=await l.value;if(u.status==="aborted"||c.status==="aborted")return yt;(u.status==="dirty"||c.status==="dirty")&&n.dirty(),s.set(u.value,c.value)}return{status:n.value,value:s}})}else{const s=new Map;for(const l of a){const u=l.key,c=l.value;if(u.status==="aborted"||c.status==="aborted")return yt;(u.status==="dirty"||c.status==="dirty")&&n.dirty(),s.set(u.value,c.value)}return{status:n.value,value:s}}}}Yb.create=(e,t,n)=>new Yb({valueType:t,keyType:e,typeName:st.ZodMap,...xt(n)});class Td extends Et{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==Re.set)return Me(r,{code:he.invalid_type,expected:Re.set,received:r.parsedType}),yt;const i=this._def;i.minSize!==null&&r.data.sizei.maxSize.value&&(Me(r,{code:he.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),n.dirty());const o=this._def.valueType;function a(l){const u=new Set;for(const c of l){if(c.status==="aborted")return yt;c.status==="dirty"&&n.dirty(),u.add(c.value)}return{status:n.value,value:u}}const s=[...r.data.values()].map((l,u)=>o._parse(new Ks(r,l,r.path,u)));return r.common.async?Promise.all(s).then(l=>a(l)):a(s)}min(t,n){return new Td({...this._def,minSize:{value:t,message:rt.toString(n)}})}max(t,n){return new Td({...this._def,maxSize:{value:t,message:rt.toString(n)}})}size(t,n){return this.min(t,n).max(t,n)}nonempty(t){return this.min(1,t)}}Td.create=(e,t)=>new Td({valueType:e,minSize:null,maxSize:null,typeName:st.ZodSet,...xt(t)});class fh extends Et{constructor(){super(...arguments),this.validate=this.implement}_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==Re.function)return Me(n,{code:he.invalid_type,expected:Re.function,received:n.parsedType}),yt;function r(s,l){return Wb({data:s,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,qb(),$m].filter(u=>!!u),issueData:{code:he.invalid_arguments,argumentsError:l}})}function i(s,l){return Wb({data:s,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,qb(),$m].filter(u=>!!u),issueData:{code:he.invalid_return_type,returnTypeError:l}})}const o={errorMap:n.common.contextualErrorMap},a=n.data;if(this._def.returns instanceof qh){const s=this;return oo(async function(...l){const u=new ns([]),c=await s._def.args.parseAsync(l,o).catch(h=>{throw u.addIssue(r(l,h)),u}),d=await Reflect.apply(a,this,c);return await s._def.returns._def.type.parseAsync(d,o).catch(h=>{throw u.addIssue(i(d,h)),u})})}else{const s=this;return oo(function(...l){const u=s._def.args.safeParse(l,o);if(!u.success)throw new ns([r(l,u.error)]);const c=Reflect.apply(a,this,u.data),d=s._def.returns.safeParse(c,o);if(!d.success)throw new ns([i(c,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new fh({...this._def,args:Qs.create(t).rest(fd.create())})}returns(t){return new fh({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,n,r){return new fh({args:t||Qs.create([]).rest(fd.create()),returns:n||fd.create(),typeName:st.ZodFunction,...xt(r)})}}class Vm extends Et{get schema(){return this._def.getter()}_parse(t){const{ctx:n}=this._processInputParams(t);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}}Vm.create=(e,t)=>new Vm({getter:e,typeName:st.ZodLazy,...xt(t)});class Gm extends Et{_parse(t){if(t.data!==this._def.value){const n=this._getOrReturnCtx(t);return Me(n,{received:n.data,code:he.invalid_literal,expected:this._def.value}),yt}return{status:"valid",value:t.data}}get value(){return this._def.value}}Gm.create=(e,t)=>new Gm({value:e,typeName:st.ZodLiteral,...xt(t)});function hB(e,t){return new oc({values:e,typeName:st.ZodEnum,...xt(t)})}class oc extends Et{_parse(t){if(typeof t.data!="string"){const n=this._getOrReturnCtx(t),r=this._def.values;return Me(n,{expected:Xt.joinValues(r),received:n.parsedType,code:he.invalid_type}),yt}if(this._def.values.indexOf(t.data)===-1){const n=this._getOrReturnCtx(t),r=this._def.values;return Me(n,{received:n.data,code:he.invalid_enum_value,options:r}),yt}return oo(t.data)}get options(){return this._def.values}get enum(){const t={};for(const n of this._def.values)t[n]=n;return t}get Values(){const t={};for(const n of this._def.values)t[n]=n;return t}get Enum(){const t={};for(const n of this._def.values)t[n]=n;return t}extract(t){return oc.create(t)}exclude(t){return oc.create(this.options.filter(n=>!t.includes(n)))}}oc.create=hB;class Hm extends Et{_parse(t){const n=Xt.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(t);if(r.parsedType!==Re.string&&r.parsedType!==Re.number){const i=Xt.objectValues(n);return Me(r,{expected:Xt.joinValues(i),received:r.parsedType,code:he.invalid_type}),yt}if(n.indexOf(t.data)===-1){const i=Xt.objectValues(n);return Me(r,{received:r.data,code:he.invalid_enum_value,options:i}),yt}return oo(t.data)}get enum(){return this._def.values}}Hm.create=(e,t)=>new Hm({values:e,typeName:st.ZodNativeEnum,...xt(t)});class qh extends Et{unwrap(){return this._def.type}_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==Re.promise&&n.common.async===!1)return Me(n,{code:he.invalid_type,expected:Re.promise,received:n.parsedType}),yt;const r=n.parsedType===Re.promise?n.data:Promise.resolve(n.data);return oo(r.then(i=>this._def.type.parseAsync(i,{path:n.path,errorMap:n.common.contextualErrorMap})))}}qh.create=(e,t)=>new qh({type:e,typeName:st.ZodPromise,...xt(t)});class ss extends Et{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===st.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){const{status:n,ctx:r}=this._processInputParams(t),i=this._def.effect||null,o={addIssue:a=>{Me(r,a),a.fatal?n.abort():n.dirty()},get path(){return r.path}};if(o.addIssue=o.addIssue.bind(o),i.type==="preprocess"){const a=i.transform(r.data,o);return r.common.issues.length?{status:"dirty",value:r.data}:r.common.async?Promise.resolve(a).then(s=>this._def.schema._parseAsync({data:s,path:r.path,parent:r})):this._def.schema._parseSync({data:a,path:r.path,parent:r})}if(i.type==="refinement"){const a=s=>{const l=i.refinement(s,o);if(r.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return s};if(r.common.async===!1){const s=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?yt:(s.status==="dirty"&&n.dirty(),a(s.value),{status:n.value,value:s.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(s=>s.status==="aborted"?yt:(s.status==="dirty"&&n.dirty(),a(s.value).then(()=>({status:n.value,value:s.value}))))}if(i.type==="transform")if(r.common.async===!1){const a=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!Dm(a))return a;const s=i.transform(a.value,o);if(s instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:s}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(a=>Dm(a)?Promise.resolve(i.transform(a.value,o)).then(s=>({status:n.value,value:s})):a);Xt.assertNever(i)}}ss.create=(e,t,n)=>new ss({schema:e,typeName:st.ZodEffects,effect:t,...xt(n)});ss.createWithPreprocess=(e,t,n)=>new ss({schema:t,effect:{type:"preprocess",transform:e},typeName:st.ZodEffects,...xt(n)});class Nl extends Et{_parse(t){return this._getType(t)===Re.undefined?oo(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}Nl.create=(e,t)=>new Nl({innerType:e,typeName:st.ZodOptional,...xt(t)});class Ad extends Et{_parse(t){return this._getType(t)===Re.null?oo(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}Ad.create=(e,t)=>new Ad({innerType:e,typeName:st.ZodNullable,...xt(t)});class qm extends Et{_parse(t){const{ctx:n}=this._processInputParams(t);let r=n.data;return n.parsedType===Re.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}}qm.create=(e,t)=>new qm({innerType:e,typeName:st.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...xt(t)});class Zb extends Et{_parse(t){const{ctx:n}=this._processInputParams(t),r={...n,common:{...n.common,issues:[]}},i=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return Kb(i)?i.then(o=>({status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new ns(r.common.issues)},input:r.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new ns(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}Zb.create=(e,t)=>new Zb({innerType:e,typeName:st.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...xt(t)});class Jb extends Et{_parse(t){if(this._getType(t)!==Re.nan){const r=this._getOrReturnCtx(t);return Me(r,{code:he.invalid_type,expected:Re.nan,received:r.parsedType}),yt}return{status:"valid",value:t.data}}}Jb.create=e=>new Jb({typeName:st.ZodNaN,...xt(e)});const Xae=Symbol("zod_brand");class pB extends Et{_parse(t){const{ctx:n}=this._processInputParams(t),r=n.data;return this._def.type._parse({data:r,path:n.path,parent:n})}unwrap(){return this._def.type}}class sy extends Et{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.common.async)return(async()=>{const o=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return o.status==="aborted"?yt:o.status==="dirty"?(n.dirty(),fB(o.value)):this._def.out._parseAsync({data:o.value,path:r.path,parent:r})})();{const i=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return i.status==="aborted"?yt:i.status==="dirty"?(n.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:r.path,parent:r})}}static create(t,n){return new sy({in:t,out:n,typeName:st.ZodPipeline})}}class e_ extends Et{_parse(t){const n=this._def.innerType._parse(t);return Dm(n)&&(n.value=Object.freeze(n.value)),n}}e_.create=(e,t)=>new e_({innerType:e,typeName:st.ZodReadonly,...xt(t)});const gB=(e,t={},n)=>e?Hh.create().superRefine((r,i)=>{var o,a;if(!e(r)){const s=typeof t=="function"?t(r):typeof t=="string"?{message:t}:t,l=(a=(o=s.fatal)!==null&&o!==void 0?o:n)!==null&&a!==void 0?a:!0,u=typeof s=="string"?{message:s}:s;i.addIssue({code:"custom",...u,fatal:l})}}):Hh.create(),Yae={object:ar.lazycreate};var st;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(st||(st={}));const Zae=(e,t={message:`Input not instance of ${e.name}`})=>gB(n=>n instanceof e,t),mB=Ya.create,yB=rc.create,Jae=Jb.create,ese=ic.create,vB=Lm.create,tse=kd.create,nse=Qb.create,rse=Fm.create,ise=Bm.create,ose=Hh.create,ase=fd.create,sse=Hl.create,lse=Xb.create,use=rs.create,cse=ar.create,dse=ar.strictCreate,fse=zm.create,hse=KS.create,pse=jm.create,gse=Qs.create,mse=Um.create,yse=Yb.create,vse=Td.create,bse=fh.create,_se=Vm.create,Sse=Gm.create,xse=oc.create,wse=Hm.create,Cse=qh.create,Z8=ss.create,Ese=Nl.create,kse=Ad.create,Tse=ss.createWithPreprocess,Ase=sy.create,Pse=()=>mB().optional(),Ise=()=>yB().optional(),Rse=()=>vB().optional(),Ose={string:e=>Ya.create({...e,coerce:!0}),number:e=>rc.create({...e,coerce:!0}),boolean:e=>Lm.create({...e,coerce:!0}),bigint:e=>ic.create({...e,coerce:!0}),date:e=>kd.create({...e,coerce:!0})},Mse=yt;var z=Object.freeze({__proto__:null,defaultErrorMap:$m,setErrorMap:Lae,getErrorMap:qb,makeIssue:Wb,EMPTY_PATH:Fae,addIssueToContext:Me,ParseStatus:Ki,INVALID:yt,DIRTY:fB,OK:oo,isAborted:eE,isDirty:tE,isValid:Dm,isAsync:Kb,get util(){return Xt},get objectUtil(){return J3},ZodParsedType:Re,getParsedType:wu,ZodType:Et,ZodString:Ya,ZodNumber:rc,ZodBigInt:ic,ZodBoolean:Lm,ZodDate:kd,ZodSymbol:Qb,ZodUndefined:Fm,ZodNull:Bm,ZodAny:Hh,ZodUnknown:fd,ZodNever:Hl,ZodVoid:Xb,ZodArray:rs,ZodObject:ar,ZodUnion:zm,ZodDiscriminatedUnion:KS,ZodIntersection:jm,ZodTuple:Qs,ZodRecord:Um,ZodMap:Yb,ZodSet:Td,ZodFunction:fh,ZodLazy:Vm,ZodLiteral:Gm,ZodEnum:oc,ZodNativeEnum:Hm,ZodPromise:qh,ZodEffects:ss,ZodTransformer:ss,ZodOptional:Nl,ZodNullable:Ad,ZodDefault:qm,ZodCatch:Zb,ZodNaN:Jb,BRAND:Xae,ZodBranded:pB,ZodPipeline:sy,ZodReadonly:e_,custom:gB,Schema:Et,ZodSchema:Et,late:Yae,get ZodFirstPartyTypeKind(){return st},coerce:Ose,any:ose,array:use,bigint:ese,boolean:vB,date:tse,discriminatedUnion:hse,effect:Z8,enum:xse,function:bse,instanceof:Zae,intersection:pse,lazy:_se,literal:Sse,map:yse,nan:Jae,nativeEnum:wse,never:sse,null:ise,nullable:kse,number:yB,object:cse,oboolean:Rse,onumber:Ise,optional:Ese,ostring:Pse,pipeline:Ase,preprocess:Tse,promise:Cse,record:mse,set:vse,strictObject:dse,string:mB,symbol:nse,transformer:Z8,tuple:gse,undefined:rse,union:fse,unknown:ase,void:lse,NEVER:Mse,ZodIssueCode:he,quotelessJson:Dae,ZodError:ns});const Nse=z.string(),qje=e=>Nse.safeParse(e).success,$se=z.string(),Wje=e=>$se.safeParse(e).success,Dse=z.string(),Kje=e=>Dse.safeParse(e).success,Lse=z.string(),Qje=e=>Lse.safeParse(e).success,Fse=z.number().int().min(1),Xje=e=>Fse.safeParse(e).success,Bse=z.number().min(1),Yje=e=>Bse.safeParse(e).success,bB=z.enum(["euler","deis","ddim","ddpm","dpmpp_2s","dpmpp_2m","dpmpp_2m_sde","dpmpp_sde","heun","kdpm_2","lms","pndm","unipc","euler_k","dpmpp_2s_k","dpmpp_2m_k","dpmpp_2m_sde_k","dpmpp_sde_k","heun_k","lms_k","euler_a","kdpm_2_a"]),Zje=e=>bB.safeParse(e).success,Jje={euler:"Euler",deis:"DEIS",ddim:"DDIM",ddpm:"DDPM",dpmpp_sde:"DPM++ SDE",dpmpp_2s:"DPM++ 2S",dpmpp_2m:"DPM++ 2M",dpmpp_2m_sde:"DPM++ 2M SDE",heun:"Heun",kdpm_2:"KDPM 2",lms:"LMS",pndm:"PNDM",unipc:"UniPC",euler_k:"Euler Karras",dpmpp_sde_k:"DPM++ SDE Karras",dpmpp_2s_k:"DPM++ 2S Karras",dpmpp_2m_k:"DPM++ 2M Karras",dpmpp_2m_sde_k:"DPM++ 2M SDE Karras",heun_k:"Heun Karras",lms_k:"LMS Karras",euler_a:"Euler Ancestral",kdpm_2_a:"KDPM 2 Ancestral"},zse=z.number().int().min(0).max(Gg),eUe=e=>zse.safeParse(e).success,jse=z.number().multipleOf(8).min(64),tUe=e=>jse.safeParse(e).success,Use=z.number().multipleOf(8).min(64),nUe=e=>Use.safeParse(e).success,jd=z.enum(["any","sd-1","sd-2","sdxl","sdxl-refiner"]),QS=z.object({model_name:z.string().min(1),base_model:jd,model_type:z.literal("main")}),rUe=e=>QS.safeParse(e).success,hT=z.object({model_name:z.string().min(1),base_model:z.literal("sdxl-refiner"),model_type:z.literal("main")}),iUe=e=>hT.safeParse(e).success,_B=z.object({model_name:z.string().min(1),base_model:jd,model_type:z.literal("onnx")}),ly=z.union([QS,_B]),Vse=z.object({model_name:z.string().min(1),base_model:jd}),Gse=z.object({model_name:z.string().min(1),base_model:jd}),oUe=e=>Gse.safeParse(e).success,Hse=z.object({model_name:z.string().min(1),base_model:jd}),aUe=e=>Hse.safeParse(e).success,qse=z.object({model_name:z.string().min(1),base_model:jd}),sUe=e=>qse.safeParse(e).success,Wse=z.number().min(0).max(1),lUe=e=>Wse.safeParse(e).success;z.enum(["fp16","fp32"]);const Kse=z.number().min(1).max(10),uUe=e=>Kse.safeParse(e).success,Qse=z.number().min(1).max(10),cUe=e=>Qse.safeParse(e).success,Xse=z.number().min(0).max(1),dUe=e=>Xse.safeParse(e).success;z.enum(["box","gaussian"]);z.enum(["unmasked","mask","edge"]);const pT={cfgScale:7.5,height:512,img2imgStrength:.75,infillMethod:"patchmatch",iterations:1,perlin:0,positivePrompt:"",negativePrompt:"",scheduler:"euler",maskBlur:16,maskBlurMethod:"box",canvasCoherenceMode:"unmasked",canvasCoherenceSteps:20,canvasCoherenceStrength:.3,seed:0,seedWeights:"",shouldFitToWidthHeight:!0,shouldGenerateVariations:!1,shouldRandomizeSeed:!0,steps:50,threshold:0,infillTileSize:32,infillPatchmatchDownscaleSize:1,variationAmount:.1,width:512,shouldUseSymmetry:!1,horizontalSymmetrySteps:0,verticalSymmetrySteps:0,model:null,vae:null,vaePrecision:"fp32",seamlessXAxis:!1,seamlessYAxis:!1,clipSkip:0,shouldUseCpuNoise:!0,shouldShowAdvancedOptions:!1,aspectRatio:null,shouldLockAspectRatio:!1},Yse=pT,SB=nr({name:"generation",initialState:Yse,reducers:{setPositivePrompt:(e,t)=>{e.positivePrompt=t.payload},setNegativePrompt:(e,t)=>{e.negativePrompt=t.payload},setIterations:(e,t)=>{e.iterations=t.payload},setSteps:(e,t)=>{e.steps=t.payload},clampSymmetrySteps:e=>{e.horizontalSymmetrySteps=Ru(e.horizontalSymmetrySteps,0,e.steps),e.verticalSymmetrySteps=Ru(e.verticalSymmetrySteps,0,e.steps)},setCfgScale:(e,t)=>{e.cfgScale=t.payload},setThreshold:(e,t)=>{e.threshold=t.payload},setPerlin:(e,t)=>{e.perlin=t.payload},setHeight:(e,t)=>{e.height=t.payload},setWidth:(e,t)=>{e.width=t.payload},toggleSize:e=>{const[t,n]=[e.width,e.height];e.width=n,e.height=t},setScheduler:(e,t)=>{e.scheduler=t.payload},setSeed:(e,t)=>{e.seed=t.payload,e.shouldRandomizeSeed=!1},setImg2imgStrength:(e,t)=>{e.img2imgStrength=t.payload},setSeamlessXAxis:(e,t)=>{e.seamlessXAxis=t.payload},setSeamlessYAxis:(e,t)=>{e.seamlessYAxis=t.payload},setShouldFitToWidthHeight:(e,t)=>{e.shouldFitToWidthHeight=t.payload},resetSeed:e=>{e.seed=-1},setShouldGenerateVariations:(e,t)=>{e.shouldGenerateVariations=t.payload},setVariationAmount:(e,t)=>{e.variationAmount=t.payload},setSeedWeights:(e,t)=>{e.seedWeights=t.payload,e.shouldGenerateVariations=!0,e.variationAmount=0},resetParametersState:e=>({...e,...pT}),setShouldRandomizeSeed:(e,t)=>{e.shouldRandomizeSeed=t.payload},clearInitialImage:e=>{e.initialImage=void 0},setMaskBlur:(e,t)=>{e.maskBlur=t.payload},setMaskBlurMethod:(e,t)=>{e.maskBlurMethod=t.payload},setCanvasCoherenceMode:(e,t)=>{e.canvasCoherenceMode=t.payload},setCanvasCoherenceSteps:(e,t)=>{e.canvasCoherenceSteps=t.payload},setCanvasCoherenceStrength:(e,t)=>{e.canvasCoherenceStrength=t.payload},setInfillMethod:(e,t)=>{e.infillMethod=t.payload},setInfillTileSize:(e,t)=>{e.infillTileSize=t.payload},setInfillPatchmatchDownscaleSize:(e,t)=>{e.infillPatchmatchDownscaleSize=t.payload},setShouldUseSymmetry:(e,t)=>{e.shouldUseSymmetry=t.payload},setHorizontalSymmetrySteps:(e,t)=>{e.horizontalSymmetrySteps=t.payload},setVerticalSymmetrySteps:(e,t)=>{e.verticalSymmetrySteps=t.payload},initialImageChanged:(e,t)=>{const{image_name:n,width:r,height:i}=t.payload;e.initialImage={imageName:n,width:r,height:i}},modelChanged:(e,t)=>{if(e.model=t.payload,e.model===null)return;const{maxClip:n}=Nae[e.model.base_model];e.clipSkip=Ru(e.clipSkip,0,n)},vaeSelected:(e,t)=>{e.vae=t.payload},vaePrecisionChanged:(e,t)=>{e.vaePrecision=t.payload},setClipSkip:(e,t)=>{e.clipSkip=t.payload},shouldUseCpuNoiseChanged:(e,t)=>{e.shouldUseCpuNoise=t.payload},setAspectRatio:(e,t)=>{const n=t.payload;e.aspectRatio=n,n&&(e.height=qa(e.width/n,8))},setShouldLockAspectRatio:(e,t)=>{e.shouldLockAspectRatio=t.payload}},extraReducers:e=>{e.addCase(Oae,(t,n)=>{var i;const r=(i=n.payload.sd)==null?void 0:i.defaultModel;if(r&&!t.model){const[o,a,s]=r.split("/"),l=QS.safeParse({model_name:s,base_model:o,model_type:a});l.success&&(t.model=l.data)}})}}),{clampSymmetrySteps:fUe,clearInitialImage:gT,resetParametersState:hUe,resetSeed:pUe,setCfgScale:gUe,setWidth:J8,setHeight:eI,toggleSize:mUe,setImg2imgStrength:yUe,setInfillMethod:Zse,setIterations:vUe,setPerlin:bUe,setPositivePrompt:Jse,setNegativePrompt:_Ue,setScheduler:SUe,setMaskBlur:xUe,setMaskBlurMethod:wUe,setCanvasCoherenceMode:CUe,setCanvasCoherenceSteps:EUe,setCanvasCoherenceStrength:kUe,setSeed:TUe,setSeedWeights:AUe,setShouldFitToWidthHeight:PUe,setShouldGenerateVariations:IUe,setShouldRandomizeSeed:RUe,setSteps:OUe,setThreshold:MUe,setInfillTileSize:NUe,setInfillPatchmatchDownscaleSize:$Ue,setVariationAmount:DUe,setShouldUseSymmetry:LUe,setHorizontalSymmetrySteps:FUe,setVerticalSymmetrySteps:BUe,initialImageChanged:XS,modelChanged:Ou,vaeSelected:xB,setSeamlessXAxis:zUe,setSeamlessYAxis:jUe,setClipSkip:UUe,shouldUseCpuNoiseChanged:VUe,setAspectRatio:ele,setShouldLockAspectRatio:GUe,vaePrecisionChanged:HUe}=SB.actions,tle=SB.reducer,uv=(e,t,n,r,i,o,a)=>{const s=Math.floor(e/2-(n+i/2)*a),l=Math.floor(t/2-(r+o/2)*a);return{x:s,y:l}},cv=(e,t,n,r,i=.95)=>{const o=e*i/n,a=t*i/r,s=Math.min(1,Math.min(o,a));return s||1},qUe=.999,WUe=.1,KUe=20,dv=.95,QUe=30,XUe=10,nle=e=>({x:Math.floor(e.x),y:Math.floor(e.y)}),af=e=>{const{width:t,height:n}=e,r={width:t,height:n},i=512*512,o=t/n;let a=t*n,s=448;for(;a1?(r.width=s,r.height=qa(s/o,64)):o<1&&(r.height=s,r.width=qa(s*o,64)),a=r.width*r.height;return r},rle=e=>({width:qa(e.width,64),height:qa(e.height,64)}),YUe=[{label:"Base",value:"base"},{label:"Mask",value:"mask"}],ZUe=[{label:"None",value:"none"},{label:"Auto",value:"auto"},{label:"Manual",value:"manual"}],wB=e=>e.kind==="line"&&e.layer==="mask",JUe=e=>e.kind==="line"&&e.layer==="base",ile=e=>e.kind==="image"&&e.layer==="base",eVe=e=>e.kind==="fillRect"&&e.layer==="base",tVe=e=>e.kind==="eraseRect"&&e.layer==="base",ole=e=>e.kind==="line",yg={objects:[],stagingArea:{images:[],selectedImageIndex:-1}},CB={boundingBoxCoordinates:{x:0,y:0},boundingBoxDimensions:{width:512,height:512},boundingBoxPreviewFill:{r:0,g:0,b:0,a:.5},boundingBoxScaleMethod:"none",brushColor:{r:90,g:90,b:255,a:1},brushSize:50,colorPickerColor:{r:90,g:90,b:255,a:1},cursorPosition:null,futureLayerStates:[],isDrawing:!1,isMaskEnabled:!0,isMouseOverBoundingBox:!1,isMoveBoundingBoxKeyHeld:!1,isMoveStageKeyHeld:!1,isMovingBoundingBox:!1,isMovingStage:!1,isTransformingBoundingBox:!1,layer:"base",layerState:yg,maskColor:{r:255,g:90,b:90,a:1},maxHistory:128,minimumStageScale:1,pastLayerStates:[],scaledBoundingBoxDimensions:{width:512,height:512},shouldAntialias:!0,shouldAutoSave:!1,shouldCropToBoundingBoxOnSave:!1,shouldDarkenOutsideBoundingBox:!1,shouldLockBoundingBox:!1,shouldPreserveMaskedArea:!1,shouldRestrictStrokesToBox:!0,shouldShowBoundingBox:!0,shouldShowBrush:!0,shouldShowBrushPreview:!1,shouldShowCanvasDebugInfo:!1,shouldShowCheckboardTransparency:!1,shouldShowGrid:!0,shouldShowIntermediates:!0,shouldShowStagingImage:!0,shouldShowStagingOutline:!0,shouldSnapToGrid:!0,stageCoordinates:{x:0,y:0},stageDimensions:{width:0,height:0},stageScale:1,tool:"brush",batchIds:[]},EB=nr({name:"canvas",initialState:CB,reducers:{setTool:(e,t)=>{const n=t.payload;e.tool=t.payload,n!=="move"&&(e.isTransformingBoundingBox=!1,e.isMouseOverBoundingBox=!1,e.isMovingBoundingBox=!1,e.isMovingStage=!1)},setLayer:(e,t)=>{e.layer=t.payload},toggleTool:e=>{const t=e.tool;t!=="move"&&(e.tool=t==="brush"?"eraser":"brush")},setMaskColor:(e,t)=>{e.maskColor=t.payload},setBrushColor:(e,t)=>{e.brushColor=t.payload},setBrushSize:(e,t)=>{e.brushSize=t.payload},clearMask:e=>{e.pastLayerStates.push(wn(e.layerState)),e.layerState.objects=e.layerState.objects.filter(t=>!wB(t)),e.futureLayerStates=[],e.shouldPreserveMaskedArea=!1},toggleShouldInvertMask:e=>{e.shouldPreserveMaskedArea=!e.shouldPreserveMaskedArea},toggleShouldShowMask:e=>{e.isMaskEnabled=!e.isMaskEnabled},setShouldPreserveMaskedArea:(e,t)=>{e.shouldPreserveMaskedArea=t.payload},setIsMaskEnabled:(e,t)=>{e.isMaskEnabled=t.payload,e.layer=t.payload?"mask":"base"},setShouldShowCheckboardTransparency:(e,t)=>{e.shouldShowCheckboardTransparency=t.payload},setShouldShowBrushPreview:(e,t)=>{e.shouldShowBrushPreview=t.payload},setShouldShowBrush:(e,t)=>{e.shouldShowBrush=t.payload},setCursorPosition:(e,t)=>{e.cursorPosition=t.payload},setInitialCanvasImage:(e,t)=>{const n=t.payload,{width:r,height:i}=n,{stageDimensions:o}=e,a={width:sv(Ru(r,64,512),64),height:sv(Ru(i,64,512),64)},s={x:qa(r/2-a.width/2,64),y:qa(i/2-a.height/2,64)};if(e.boundingBoxScaleMethod==="auto"){const c=af(a);e.scaledBoundingBoxDimensions=c}e.boundingBoxDimensions=a,e.boundingBoxCoordinates=s,e.pastLayerStates.push(wn(e.layerState)),e.layerState={...wn(yg),objects:[{kind:"image",layer:"base",x:0,y:0,width:r,height:i,imageName:n.image_name}]},e.futureLayerStates=[],e.batchIds=[];const l=cv(o.width,o.height,r,i,dv),u=uv(o.width,o.height,0,0,r,i,l);e.stageScale=l,e.stageCoordinates=u},setBoundingBoxDimensions:(e,t)=>{const n=rle(t.payload);if(e.boundingBoxDimensions=n,e.boundingBoxScaleMethod==="auto"){const r=af(n);e.scaledBoundingBoxDimensions=r}},flipBoundingBoxAxes:e=>{const[t,n]=[e.boundingBoxDimensions.width,e.boundingBoxDimensions.height],[r,i]=[e.scaledBoundingBoxDimensions.width,e.scaledBoundingBoxDimensions.height];e.boundingBoxDimensions={width:n,height:t},e.scaledBoundingBoxDimensions={width:i,height:r}},setBoundingBoxCoordinates:(e,t)=>{e.boundingBoxCoordinates=nle(t.payload)},setStageCoordinates:(e,t)=>{e.stageCoordinates=t.payload},setBoundingBoxPreviewFill:(e,t)=>{e.boundingBoxPreviewFill=t.payload},setStageScale:(e,t)=>{e.stageScale=t.payload},setShouldDarkenOutsideBoundingBox:(e,t)=>{e.shouldDarkenOutsideBoundingBox=t.payload},setIsDrawing:(e,t)=>{e.isDrawing=t.payload},clearCanvasHistory:e=>{e.pastLayerStates=[],e.futureLayerStates=[]},setShouldLockBoundingBox:(e,t)=>{e.shouldLockBoundingBox=t.payload},toggleShouldLockBoundingBox:e=>{e.shouldLockBoundingBox=!e.shouldLockBoundingBox},setShouldShowBoundingBox:(e,t)=>{e.shouldShowBoundingBox=t.payload},setIsTransformingBoundingBox:(e,t)=>{e.isTransformingBoundingBox=t.payload},setIsMovingBoundingBox:(e,t)=>{e.isMovingBoundingBox=t.payload},setIsMouseOverBoundingBox:(e,t)=>{e.isMouseOverBoundingBox=t.payload},setIsMoveBoundingBoxKeyHeld:(e,t)=>{e.isMoveBoundingBoxKeyHeld=t.payload},setIsMoveStageKeyHeld:(e,t)=>{e.isMoveStageKeyHeld=t.payload},canvasBatchIdAdded:(e,t)=>{e.batchIds.push(t.payload)},canvasBatchIdsReset:e=>{e.batchIds=[]},stagingAreaInitialized:(e,t)=>{const{boundingBox:n}=t.payload;e.layerState.stagingArea={boundingBox:n,images:[],selectedImageIndex:-1}},addImageToStagingArea:(e,t)=>{const n=t.payload;!n||!e.layerState.stagingArea.boundingBox||(e.pastLayerStates.push(wn(e.layerState)),e.pastLayerStates.length>e.maxHistory&&e.pastLayerStates.shift(),e.layerState.stagingArea.images.push({kind:"image",layer:"base",...e.layerState.stagingArea.boundingBox,imageName:n.image_name}),e.layerState.stagingArea.selectedImageIndex=e.layerState.stagingArea.images.length-1,e.futureLayerStates=[])},discardStagedImages:e=>{e.pastLayerStates.push(wn(e.layerState)),e.pastLayerStates.length>e.maxHistory&&e.pastLayerStates.shift(),e.layerState.stagingArea=wn(wn(yg)).stagingArea,e.futureLayerStates=[],e.shouldShowStagingOutline=!0,e.shouldShowStagingImage=!0,e.batchIds=[]},addFillRect:e=>{const{boundingBoxCoordinates:t,boundingBoxDimensions:n,brushColor:r}=e;e.pastLayerStates.push(wn(e.layerState)),e.pastLayerStates.length>e.maxHistory&&e.pastLayerStates.shift(),e.layerState.objects.push({kind:"fillRect",layer:"base",...t,...n,color:r}),e.futureLayerStates=[]},addEraseRect:e=>{const{boundingBoxCoordinates:t,boundingBoxDimensions:n}=e;e.pastLayerStates.push(wn(e.layerState)),e.pastLayerStates.length>e.maxHistory&&e.pastLayerStates.shift(),e.layerState.objects.push({kind:"eraseRect",layer:"base",...t,...n}),e.futureLayerStates=[]},addLine:(e,t)=>{const{tool:n,layer:r,brushColor:i,brushSize:o,shouldRestrictStrokesToBox:a}=e;if(n==="move"||n==="colorPicker")return;const s=o/2,l=r==="base"&&n==="brush"?{color:i}:{};e.pastLayerStates.push(wn(e.layerState)),e.pastLayerStates.length>e.maxHistory&&e.pastLayerStates.shift();const u={kind:"line",layer:r,tool:n,strokeWidth:s,points:t.payload,...l};a&&(u.clip={...e.boundingBoxCoordinates,...e.boundingBoxDimensions}),e.layerState.objects.push(u),e.futureLayerStates=[]},addPointToCurrentLine:(e,t)=>{const n=e.layerState.objects.findLast(ole);n&&n.points.push(...t.payload)},undo:e=>{const t=e.pastLayerStates.pop();t&&(e.futureLayerStates.unshift(wn(e.layerState)),e.futureLayerStates.length>e.maxHistory&&e.futureLayerStates.pop(),e.layerState=t)},redo:e=>{const t=e.futureLayerStates.shift();t&&(e.pastLayerStates.push(wn(e.layerState)),e.pastLayerStates.length>e.maxHistory&&e.pastLayerStates.shift(),e.layerState=t)},setShouldShowGrid:(e,t)=>{e.shouldShowGrid=t.payload},setIsMovingStage:(e,t)=>{e.isMovingStage=t.payload},setShouldSnapToGrid:(e,t)=>{e.shouldSnapToGrid=t.payload},setShouldAutoSave:(e,t)=>{e.shouldAutoSave=t.payload},setShouldShowIntermediates:(e,t)=>{e.shouldShowIntermediates=t.payload},resetCanvas:e=>{e.pastLayerStates.push(wn(e.layerState)),e.layerState=wn(yg),e.futureLayerStates=[],e.batchIds=[]},canvasResized:(e,t)=>{const{width:n,height:r}=t.payload,i={width:Math.floor(n),height:Math.floor(r)};if(e.stageDimensions=i,!e.layerState.objects.find(ile)){const o=cv(i.width,i.height,512,512,dv),a=uv(i.width,i.height,0,0,512,512,o),s={width:512,height:512};if(e.stageScale=o,e.stageCoordinates=a,e.boundingBoxCoordinates={x:0,y:0},e.boundingBoxDimensions=s,e.boundingBoxScaleMethod==="auto"){const l=af(s);e.scaledBoundingBoxDimensions=l}}},resetCanvasView:(e,t)=>{const{contentRect:n,shouldScaleTo1:r}=t.payload,{stageDimensions:{width:i,height:o}}=e,{x:a,y:s,width:l,height:u}=n;if(l!==0&&u!==0){const c=r?1:cv(i,o,l,u,dv),d=uv(i,o,a,s,l,u,c);e.stageScale=c,e.stageCoordinates=d}else{const c=cv(i,o,512,512,dv),d=uv(i,o,0,0,512,512,c),f={width:512,height:512};if(e.stageScale=c,e.stageCoordinates=d,e.boundingBoxCoordinates={x:0,y:0},e.boundingBoxDimensions=f,e.boundingBoxScaleMethod==="auto"){const h=af(f);e.scaledBoundingBoxDimensions=h}}},nextStagingAreaImage:e=>{if(!e.layerState.stagingArea.images.length)return;const t=e.layerState.stagingArea.selectedImageIndex+1,n=e.layerState.stagingArea.images.length-1;e.layerState.stagingArea.selectedImageIndex=t>n?0:t},prevStagingAreaImage:e=>{if(!e.layerState.stagingArea.images.length)return;const t=e.layerState.stagingArea.selectedImageIndex-1,n=e.layerState.stagingArea.images.length-1;e.layerState.stagingArea.selectedImageIndex=t<0?n:t},commitStagingAreaImage:e=>{if(!e.layerState.stagingArea.images.length)return;const{images:t,selectedImageIndex:n}=e.layerState.stagingArea;e.pastLayerStates.push(wn(e.layerState)),e.pastLayerStates.length>e.maxHistory&&e.pastLayerStates.shift();const r=t[n];r&&e.layerState.objects.push({...r}),e.layerState.stagingArea=wn(yg).stagingArea,e.futureLayerStates=[],e.shouldShowStagingOutline=!0,e.shouldShowStagingImage=!0,e.batchIds=[]},fitBoundingBoxToStage:e=>{const{boundingBoxDimensions:t,boundingBoxCoordinates:n,stageDimensions:r,stageScale:i}=e,o=r.width/i,a=r.height/i;if(n.x<0||n.x+t.width>o||n.y<0||n.y+t.height>a){const s={width:sv(Ru(o,64,512),64),height:sv(Ru(a,64,512),64)},l={x:qa(o/2-s.width/2,64),y:qa(a/2-s.height/2,64)};if(e.boundingBoxDimensions=s,e.boundingBoxCoordinates=l,e.boundingBoxScaleMethod==="auto"){const u=af(s);e.scaledBoundingBoxDimensions=u}}},setBoundingBoxScaleMethod:(e,t)=>{if(e.boundingBoxScaleMethod=t.payload,t.payload==="auto"){const n=af(e.boundingBoxDimensions);e.scaledBoundingBoxDimensions=n}},setScaledBoundingBoxDimensions:(e,t)=>{e.scaledBoundingBoxDimensions=t.payload},setShouldShowStagingImage:(e,t)=>{e.shouldShowStagingImage=t.payload},setShouldShowStagingOutline:(e,t)=>{e.shouldShowStagingOutline=t.payload},setShouldShowCanvasDebugInfo:(e,t)=>{e.shouldShowCanvasDebugInfo=t.payload},setShouldRestrictStrokesToBox:(e,t)=>{e.shouldRestrictStrokesToBox=t.payload},setShouldAntialias:(e,t)=>{e.shouldAntialias=t.payload},setShouldCropToBoundingBoxOnSave:(e,t)=>{e.shouldCropToBoundingBoxOnSave=t.payload},setColorPickerColor:(e,t)=>{e.colorPickerColor=t.payload},commitColorPickerColor:e=>{e.brushColor={...e.colorPickerColor,a:e.brushColor.a},e.tool="brush"},setMergedCanvas:(e,t)=>{e.pastLayerStates.push(wn(e.layerState)),e.futureLayerStates=[],e.layerState.objects=[t.payload]},resetCanvasInteractionState:e=>{e.cursorPosition=null,e.isDrawing=!1,e.isMouseOverBoundingBox=!1,e.isMoveBoundingBoxKeyHeld=!1,e.isMoveStageKeyHeld=!1,e.isMovingBoundingBox=!1,e.isMovingStage=!1,e.isTransformingBoundingBox=!1},mouseLeftCanvas:e=>{e.cursorPosition=null,e.isDrawing=!1,e.isMouseOverBoundingBox=!1,e.isMovingBoundingBox=!1,e.isTransformingBoundingBox=!1}},extraReducers:e=>{e.addCase(ele,(t,n)=>{const r=n.payload;r&&(t.boundingBoxDimensions.height=qa(t.boundingBoxDimensions.width/r,64),t.scaledBoundingBoxDimensions.height=qa(t.scaledBoundingBoxDimensions.width/r,64))})}}),{addEraseRect:nVe,addFillRect:rVe,addImageToStagingArea:ale,addLine:iVe,addPointToCurrentLine:oVe,clearCanvasHistory:aVe,clearMask:sVe,commitColorPickerColor:lVe,commitStagingAreaImage:sle,discardStagedImages:lle,fitBoundingBoxToStage:uVe,mouseLeftCanvas:cVe,nextStagingAreaImage:dVe,prevStagingAreaImage:fVe,redo:hVe,resetCanvas:mT,resetCanvasInteractionState:pVe,resetCanvasView:gVe,setBoundingBoxCoordinates:mVe,setBoundingBoxDimensions:tI,setBoundingBoxPreviewFill:yVe,setBoundingBoxScaleMethod:vVe,flipBoundingBoxAxes:bVe,setBrushColor:_Ve,setBrushSize:SVe,setColorPickerColor:xVe,setCursorPosition:wVe,setInitialCanvasImage:kB,setIsDrawing:CVe,setIsMaskEnabled:EVe,setIsMouseOverBoundingBox:kVe,setIsMoveBoundingBoxKeyHeld:TVe,setIsMoveStageKeyHeld:AVe,setIsMovingBoundingBox:PVe,setIsMovingStage:IVe,setIsTransformingBoundingBox:RVe,setLayer:OVe,setMaskColor:MVe,setMergedCanvas:ule,setShouldAutoSave:NVe,setShouldCropToBoundingBoxOnSave:$Ve,setShouldDarkenOutsideBoundingBox:DVe,setShouldLockBoundingBox:LVe,setShouldPreserveMaskedArea:FVe,setShouldShowBoundingBox:BVe,setShouldShowBrush:zVe,setShouldShowBrushPreview:jVe,setShouldShowCanvasDebugInfo:UVe,setShouldShowCheckboardTransparency:VVe,setShouldShowGrid:GVe,setShouldShowIntermediates:HVe,setShouldShowStagingImage:qVe,setShouldShowStagingOutline:WVe,setShouldSnapToGrid:KVe,setStageCoordinates:QVe,setStageScale:XVe,setTool:YVe,toggleShouldLockBoundingBox:ZVe,toggleTool:JVe,undo:eGe,setScaledBoundingBoxDimensions:tGe,setShouldRestrictStrokesToBox:nGe,stagingAreaInitialized:cle,setShouldAntialias:rGe,canvasResized:iGe,canvasBatchIdAdded:dle,canvasBatchIdsReset:fle}=EB.actions,hle=EB.reducer,ple={isModalOpen:!1,imagesToChange:[]},TB=nr({name:"changeBoardModal",initialState:ple,reducers:{isModalOpenChanged:(e,t)=>{e.isModalOpen=t.payload},imagesToChangeSelected:(e,t)=>{e.imagesToChange=t.payload},changeBoardReset:e=>{e.imagesToChange=[],e.isModalOpen=!1}}}),{isModalOpenChanged:oGe,imagesToChangeSelected:aGe,changeBoardReset:sGe}=TB.actions,gle=TB.reducer;var AB={exports:{}},PB={};const Lo=dS(TZ),Vp=dS(IY),mle=dS(UY);(function(e){var t,n,r=mt&&mt.__generator||function(q,te){var re,de,oe,je,Ge={label:0,sent:function(){if(1&oe[0])throw oe[1];return oe[1]},trys:[],ops:[]};return je={next:lt(0),throw:lt(1),return:lt(2)},typeof Symbol=="function"&&(je[Symbol.iterator]=function(){return this}),je;function lt($e){return function(He){return function(Ie){if(re)throw new TypeError("Generator is already executing.");for(;Ge;)try{if(re=1,de&&(oe=2&Ie[0]?de.return:Ie[0]?de.throw||((oe=de.return)&&oe.call(de),0):de.next)&&!(oe=oe.call(de,Ie[1])).done)return oe;switch(de=0,oe&&(Ie=[2&Ie[0],oe.value]),Ie[0]){case 0:case 1:oe=Ie;break;case 4:return Ge.label++,{value:Ie[1],done:!1};case 5:Ge.label++,de=Ie[1],Ie=[0];continue;case 7:Ie=Ge.ops.pop(),Ge.trys.pop();continue;default:if(!((oe=(oe=Ge.trys).length>0&&oe[oe.length-1])||Ie[0]!==6&&Ie[0]!==2)){Ge=0;continue}if(Ie[0]===3&&(!oe||Ie[1]>oe[0]&&Ie[1]=200&&q.status<=299},$=function(q){return/ion\/(vnd\.api\+)?json/.test(q.get("content-type")||"")};function O(q){if(!(0,T.isPlainObject)(q))return q;for(var te=_({},q),re=0,de=Object.entries(te);re"u"&&Ge===k&&console.warn("Warning: `fetch` is not available. Please supply a custom `fetchFn` property to use `fetchBaseQuery` on SSR environments."),function(wt,kt){return S(te,null,function(){var cn,dn,$i,Do,Di,_r,yi,Qn,po,La,it,fn,nn,ir,Sr,vi,_n,Mt,qt,Sn,rn,gn,xe,Je,Ue,Te,qe,dt,Ve,we,ue,Ee,fe,ge,Ce,et;return r(this,function(Qe){switch(Qe.label){case 0:return cn=kt.signal,dn=kt.getState,$i=kt.extra,Do=kt.endpoint,Di=kt.forced,_r=kt.type,po=(Qn=typeof wt=="string"?{url:wt}:wt).url,it=(La=Qn.headers)===void 0?new Headers(ct.headers):La,nn=(fn=Qn.params)===void 0?void 0:fn,Sr=(ir=Qn.responseHandler)===void 0?Ze??"json":ir,_n=(vi=Qn.validateStatus)===void 0?ut??P:vi,qt=(Mt=Qn.timeout)===void 0?Ye:Mt,Sn=g(Qn,["url","headers","params","responseHandler","validateStatus","timeout"]),rn=_(b(_({},ct),{signal:cn}),Sn),it=new Headers(O(it)),gn=rn,[4,oe(it,{getState:dn,extra:$i,endpoint:Do,forced:Di,type:_r})];case 1:gn.headers=Qe.sent()||it,xe=function(Ae){return typeof Ae=="object"&&((0,T.isPlainObject)(Ae)||Array.isArray(Ae)||typeof Ae.toJSON=="function")},!rn.headers.has("content-type")&&xe(rn.body)&&rn.headers.set("content-type",ie),xe(rn.body)&&He(rn.headers)&&(rn.body=JSON.stringify(rn.body,Se)),nn&&(Je=~po.indexOf("?")?"&":"?",Ue=lt?lt(nn):new URLSearchParams(O(nn)),po+=Je+Ue),po=function(Ae,Tt){if(!Ae)return Tt;if(!Tt)return Ae;if(function(Vt){return new RegExp("(^|:)//").test(Vt)}(Tt))return Tt;var jt=Ae.endsWith("/")||!Tt.startsWith("?")?"/":"";return Ae=function(Vt){return Vt.replace(/\/$/,"")}(Ae),""+Ae+jt+function(Vt){return Vt.replace(/^\//,"")}(Tt)}(re,po),Te=new Request(po,rn),qe=Te.clone(),yi={request:qe},Ve=!1,we=qt&&setTimeout(function(){Ve=!0,kt.abort()},qt),Qe.label=2;case 2:return Qe.trys.push([2,4,5,6]),[4,Ge(Te)];case 3:return dt=Qe.sent(),[3,6];case 4:return ue=Qe.sent(),[2,{error:{status:Ve?"TIMEOUT_ERROR":"FETCH_ERROR",error:String(ue)},meta:yi}];case 5:return we&&clearTimeout(we),[7];case 6:Ee=dt.clone(),yi.response=Ee,ge="",Qe.label=7;case 7:return Qe.trys.push([7,9,,10]),[4,Promise.all([_t(dt,Sr).then(function(Ae){return fe=Ae},function(Ae){return Ce=Ae}),Ee.text().then(function(Ae){return ge=Ae},function(){})])];case 8:if(Qe.sent(),Ce)throw Ce;return[3,10];case 9:return et=Qe.sent(),[2,{error:{status:"PARSING_ERROR",originalStatus:dt.status,data:ge,error:String(et)},meta:yi}];case 10:return[2,_n(dt,fe)?{data:fe,meta:yi}:{error:{status:dt.status,data:fe},meta:yi}]}})})};function _t(wt,kt){return S(this,null,function(){var cn;return r(this,function(dn){switch(dn.label){case 0:return typeof kt=="function"?[2,kt(wt)]:(kt==="content-type"&&(kt=He(wt.headers)?"json":"text"),kt!=="json"?[3,2]:[4,wt.text()]);case 1:return[2,(cn=dn.sent()).length?JSON.parse(cn):null];case 2:return[2,wt.text()]}})})}}var A=function(q,te){te===void 0&&(te=void 0),this.value=q,this.meta=te};function D(q,te){return q===void 0&&(q=0),te===void 0&&(te=5),S(this,null,function(){var re,de;return r(this,function(oe){switch(oe.label){case 0:return re=Math.min(q,te),de=~~((Math.random()+.4)*(300<=Ee)}var Sn=(0,Jt.createAsyncThunk)(nn+"/executeQuery",Mt,{getPendingMeta:function(){var xe;return(xe={startedTimeStamp:Date.now()})[Jt.SHOULD_AUTOBATCH]=!0,xe},condition:function(xe,Je){var Ue,Te,qe,dt=(0,Je.getState)(),Ve=(Te=(Ue=dt[nn])==null?void 0:Ue.queries)==null?void 0:Te[xe.queryCacheKey],we=Ve==null?void 0:Ve.fulfilledTimeStamp,ue=xe.originalArgs,Ee=Ve==null?void 0:Ve.originalArgs,fe=Sr[xe.endpointName];return!(!ze(xe)&&((Ve==null?void 0:Ve.status)==="pending"||!qt(xe,dt)&&(!ne(fe)||!((qe=fe==null?void 0:fe.forceRefetch)!=null&&qe.call(fe,{currentArg:ue,previousArg:Ee,endpointState:Ve,state:dt})))&&we))},dispatchConditionRejection:!0}),rn=(0,Jt.createAsyncThunk)(nn+"/executeMutation",Mt,{getPendingMeta:function(){var xe;return(xe={startedTimeStamp:Date.now()})[Jt.SHOULD_AUTOBATCH]=!0,xe}});function gn(xe){return function(Je){var Ue,Te;return((Te=(Ue=Je==null?void 0:Je.meta)==null?void 0:Ue.arg)==null?void 0:Te.endpointName)===xe}}return{queryThunk:Sn,mutationThunk:rn,prefetch:function(xe,Je,Ue){return function(Te,qe){var dt=function(fe){return"force"in fe}(Ue)&&Ue.force,Ve=function(fe){return"ifOlderThan"in fe}(Ue)&&Ue.ifOlderThan,we=function(fe){return fe===void 0&&(fe=!0),_n.endpoints[xe].initiate(Je,{forceRefetch:fe})},ue=_n.endpoints[xe].select(Je)(qe());if(dt)Te(we());else if(Ve){var Ee=ue==null?void 0:ue.fulfilledTimeStamp;if(!Ee)return void Te(we());(Number(new Date)-Number(new Date(Ee)))/1e3>=Ve&&Te(we())}else Te(we(!1))}},updateQueryData:function(xe,Je,Ue){return function(Te,qe){var dt,Ve,we=_n.endpoints[xe].select(Je)(qe()),ue={patches:[],inversePatches:[],undo:function(){return Te(_n.util.patchQueryData(xe,Je,ue.inversePatches))}};if(we.status===t.uninitialized)return ue;if("data"in we)if((0,Pe.isDraftable)(we.data)){var Ee=(0,Pe.produceWithPatches)(we.data,Ue),fe=Ee[2];(dt=ue.patches).push.apply(dt,Ee[1]),(Ve=ue.inversePatches).push.apply(Ve,fe)}else{var ge=Ue(we.data);ue.patches.push({op:"replace",path:[],value:ge}),ue.inversePatches.push({op:"replace",path:[],value:we.data})}return Te(_n.util.patchQueryData(xe,Je,ue.patches)),ue}},upsertQueryData:function(xe,Je,Ue){return function(Te){var qe;return Te(_n.endpoints[xe].initiate(Je,((qe={subscribe:!1,forceRefetch:!0})[ot]=function(){return{data:Ue}},qe)))}},patchQueryData:function(xe,Je,Ue){return function(Te){Te(_n.internalActions.queryResultPatched({queryCacheKey:vi({queryArgs:Je,endpointDefinition:Sr[xe],endpointName:xe}),patches:Ue}))}},buildMatchThunkActions:function(xe,Je){return{matchPending:(0,gt.isAllOf)((0,gt.isPending)(xe),gn(Je)),matchFulfilled:(0,gt.isAllOf)((0,gt.isFulfilled)(xe),gn(Je)),matchRejected:(0,gt.isAllOf)((0,gt.isRejected)(xe),gn(Je))}}}}({baseQuery:de,reducerPath:oe,context:re,api:q,serializeQueryArgs:je}),Se=ie.queryThunk,Ye=ie.mutationThunk,Ze=ie.patchQueryData,ut=ie.updateQueryData,ct=ie.upsertQueryData,_t=ie.prefetch,wt=ie.buildMatchThunkActions,kt=function(it){var fn=it.reducerPath,nn=it.queryThunk,ir=it.mutationThunk,Sr=it.context,vi=Sr.endpointDefinitions,_n=Sr.apiUid,Mt=Sr.extractRehydrationInfo,qt=Sr.hasRehydrationInfo,Sn=it.assertTagType,rn=it.config,gn=(0,ce.createAction)(fn+"/resetApiState"),xe=(0,ce.createSlice)({name:fn+"/queries",initialState:Jr,reducers:{removeQueryResult:{reducer:function(we,ue){delete we[ue.payload.queryCacheKey]},prepare:(0,ce.prepareAutoBatched)()},queryResultPatched:function(we,ue){var Ee=ue.payload,fe=Ee.patches;Ln(we,Ee.queryCacheKey,function(ge){ge.data=(0,en.applyPatches)(ge.data,fe.concat())})}},extraReducers:function(we){we.addCase(nn.pending,function(ue,Ee){var fe,ge=Ee.meta,Ce=Ee.meta.arg,et=ze(Ce);(Ce.subscribe||et)&&(ue[fe=Ce.queryCacheKey]!=null||(ue[fe]={status:t.uninitialized,endpointName:Ce.endpointName})),Ln(ue,Ce.queryCacheKey,function(Qe){Qe.status=t.pending,Qe.requestId=et&&Qe.requestId?Qe.requestId:ge.requestId,Ce.originalArgs!==void 0&&(Qe.originalArgs=Ce.originalArgs),Qe.startedTimeStamp=ge.startedTimeStamp})}).addCase(nn.fulfilled,function(ue,Ee){var fe=Ee.meta,ge=Ee.payload;Ln(ue,fe.arg.queryCacheKey,function(Ce){var et;if(Ce.requestId===fe.requestId||ze(fe.arg)){var Qe=vi[fe.arg.endpointName].merge;if(Ce.status=t.fulfilled,Qe)if(Ce.data!==void 0){var Ae=fe.fulfilledTimeStamp,Tt=fe.arg,jt=fe.baseQueryMeta,Vt=fe.requestId,or=(0,ce.createNextState)(Ce.data,function(pr){return Qe(pr,ge,{arg:Tt.originalArgs,baseQueryMeta:jt,fulfilledTimeStamp:Ae,requestId:Vt})});Ce.data=or}else Ce.data=ge;else Ce.data=(et=vi[fe.arg.endpointName].structuralSharing)==null||et?C((0,Tn.isDraft)(Ce.data)?(0,en.original)(Ce.data):Ce.data,ge):ge;delete Ce.error,Ce.fulfilledTimeStamp=fe.fulfilledTimeStamp}})}).addCase(nn.rejected,function(ue,Ee){var fe=Ee.meta,ge=fe.condition,Ce=fe.requestId,et=Ee.error,Qe=Ee.payload;Ln(ue,fe.arg.queryCacheKey,function(Ae){if(!ge){if(Ae.requestId!==Ce)return;Ae.status=t.rejected,Ae.error=Qe??et}})}).addMatcher(qt,function(ue,Ee){for(var fe=Mt(Ee).queries,ge=0,Ce=Object.entries(fe);ge"u"||navigator.onLine===void 0||navigator.onLine,focused:typeof document>"u"||document.visibilityState!=="hidden",middlewareRegistered:!1},rn),reducers:{middlewareRegistered:function(we,ue){we.middlewareRegistered=we.middlewareRegistered!=="conflict"&&_n===ue.payload||"conflict"}},extraReducers:function(we){we.addCase(U,function(ue){ue.online=!0}).addCase(G,function(ue){ue.online=!1}).addCase(N,function(ue){ue.focused=!0}).addCase(B,function(ue){ue.focused=!1}).addMatcher(qt,function(ue){return _({},ue)})}}),Ve=(0,ce.combineReducers)({queries:xe.reducer,mutations:Je.reducer,provided:Ue.reducer,subscriptions:qe.reducer,config:dt.reducer});return{reducer:function(we,ue){return Ve(gn.match(ue)?void 0:we,ue)},actions:b(_(_(_(_(_({},dt.actions),xe.actions),Te.actions),qe.actions),Je.actions),{unsubscribeMutationResult:Je.actions.removeMutationResult,resetApiState:gn})}}({context:re,queryThunk:Se,mutationThunk:Ye,reducerPath:oe,assertTagType:Ie,config:{refetchOnFocus:$e,refetchOnReconnect:He,refetchOnMountOrArgChange:lt,keepUnusedDataFor:Ge,reducerPath:oe}}),cn=kt.reducer,dn=kt.actions;mi(q.util,{patchQueryData:Ze,updateQueryData:ut,upsertQueryData:ct,prefetch:_t,resetApiState:dn.resetApiState}),mi(q.internalActions,dn);var $i=function(it){var fn=it.reducerPath,nn=it.queryThunk,ir=it.api,Sr=it.context,vi=Sr.apiUid,_n={invalidateTags:(0,al.createAction)(fn+"/invalidateTags")},Mt=[zr,Bn,Br,Rr,Ni,gi];return{middleware:function(Sn){var rn=!1,gn=b(_({},it),{internalState:{currentSubscriptions:{}},refetchQuery:qt}),xe=Mt.map(function(Te){return Te(gn)}),Je=function(Te){var qe=Te.api,dt=Te.queryThunk,Ve=Te.internalState,we=qe.reducerPath+"/subscriptions",ue=null,Ee=!1,fe=qe.internalActions,ge=fe.updateSubscriptionOptions,Ce=fe.unsubscribeQueryResult;return function(et,Qe){var Ae,Tt;if(ue||(ue=JSON.parse(JSON.stringify(Ve.currentSubscriptions))),qe.util.resetApiState.match(et))return ue=Ve.currentSubscriptions={},[!0,!1];if(qe.internalActions.internal_probeSubscription.match(et)){var jt=et.payload;return[!1,!!((Ae=Ve.currentSubscriptions[jt.queryCacheKey])!=null&&Ae[jt.requestId])]}var Vt=function(zn,An){var Xi,F,V,X,pe,Ct,hn,Pn,It;if(ge.match(An)){var xn=An.payload,bi=xn.queryCacheKey,Xn=xn.requestId;return(Xi=zn==null?void 0:zn[bi])!=null&&Xi[Xn]&&(zn[bi][Xn]=xn.options),!0}if(Ce.match(An)){var iu=An.payload;return Xn=iu.requestId,zn[bi=iu.queryCacheKey]&&delete zn[bi][Xn],!0}if(qe.internalActions.removeQueryResult.match(An))return delete zn[An.payload.queryCacheKey],!0;if(dt.pending.match(An)){var tf=An.meta;if(Xn=tf.requestId,(rf=tf.arg).subscribe)return(ou=(V=zn[F=rf.queryCacheKey])!=null?V:zn[F]={})[Xn]=(pe=(X=rf.subscriptionOptions)!=null?X:ou[Xn])!=null?pe:{},!0}if(dt.rejected.match(An)){var ou,nf=An.meta,rf=nf.arg;if(Xn=nf.requestId,nf.condition&&rf.subscribe)return(ou=(hn=zn[Ct=rf.queryCacheKey])!=null?hn:zn[Ct]={})[Xn]=(It=(Pn=rf.subscriptionOptions)!=null?Pn:ou[Xn])!=null?It:{},!0}return!1}(Ve.currentSubscriptions,et);if(Vt){Ee||(hs(function(){var zn=JSON.parse(JSON.stringify(Ve.currentSubscriptions)),An=(0,Da.produceWithPatches)(ue,function(){return zn});Qe.next(qe.internalActions.subscriptionsUpdated(An[1])),ue=zn,Ee=!1}),Ee=!0);var or=!!((Tt=et.type)!=null&&Tt.startsWith(we)),pr=dt.rejected.match(et)&&et.meta.condition&&!!et.meta.arg.subscribe;return[!or&&!pr,!1]}return[!0,!1]}}(gn),Ue=function(Te){var qe=Te.reducerPath,dt=Te.context,Ve=Te.refetchQuery,we=Te.internalState,ue=Te.api.internalActions.removeQueryResult;function Ee(fe,ge){var Ce=fe.getState()[qe],et=Ce.queries,Qe=we.currentSubscriptions;dt.batch(function(){for(var Ae=0,Tt=Object.keys(Qe);Ae<\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=a.createElement(n,{is:r.is}):(e=a.createElement(n),n==="select"&&(a=e,r.multiple?a.multiple=!0:r.size&&(a.size=r.size))):e=a.createElementNS(e,n),e[As]=t,e[vm]=r,OD(e,t,!1,!1),t.stateNode=e;e:{switch(a=t3(n,r),n){case"dialog":jn("cancel",e),jn("close",e),i=r;break;case"iframe":case"object":case"embed":jn("load",e),i=r;break;case"video":case"audio":for(i=0;iFh&&(t.flags|=128,r=!0,Bp(o,!1),t.lanes=4194304)}else{if(!r)if(e=Tb(a),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),Bp(o,!0),o.tail===null&&o.tailMode==="hidden"&&!a.alternate&&!tr)return Fi(t),null}else 2*Cr()-o.renderingStartTime>Fh&&n!==1073741824&&(t.flags|=128,r=!0,Bp(o,!1),t.lanes=4194304);o.isBackwards?(a.sibling=t.child,t.child=a):(n=o.last,n!==null?n.sibling=a:t.child=a,o.last=a)}return o.tail!==null?(t=o.tail,o.rendering=t,o.tail=t.sibling,o.renderingStartTime=Cr(),t.sibling=null,n=sr.current,Nn(sr,r?n&1|2:n&1),t):(Fi(t),null);case 22:case 23:return Rk(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?jo&1073741824&&(Fi(t),t.subtreeFlags&6&&(t.flags|=8192)):Fi(t),null;case 24:return null;case 25:return null}throw Error(le(156,t.tag))}function KX(e,t){switch(dk(t),t.tag){case 1:return ko(t.type)&&_b(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Dh(),Kn(Eo),Kn(Wi),_k(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return bk(t),null;case 13:if(Kn(sr),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(le(340));Nh()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Kn(sr),null;case 4:return Dh(),null;case 10:return gk(t.type._context),null;case 22:case 23:return Rk(),null;case 24:return null;default:return null}}var rv=!1,Gi=!1,QX=typeof WeakSet=="function"?WeakSet:Set,De=null;function Ff(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){gr(e,t,r)}else n.current=null}function A3(e,t,n){try{n()}catch(r){gr(e,t,r)}}var D6=!1;function XX(e,t){if(d3=mb,e=F$(),uk(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var i=r.anchorOffset,o=r.focusNode;r=r.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break e}var a=0,s=-1,l=-1,u=0,c=0,d=e,f=null;t:for(;;){for(var h;d!==n||i!==0&&d.nodeType!==3||(s=a+i),d!==o||r!==0&&d.nodeType!==3||(l=a+r),d.nodeType===3&&(a+=d.nodeValue.length),(h=d.firstChild)!==null;)f=d,d=h;for(;;){if(d===e)break t;if(f===n&&++u===i&&(s=a),f===o&&++c===r&&(l=a),(h=d.nextSibling)!==null)break;d=f,f=d.parentNode}d=h}n=s===-1||l===-1?null:{start:s,end:l}}else n=null}n=n||{start:0,end:0}}else n=null;for(f3={focusedElem:e,selectionRange:n},mb=!1,De=t;De!==null;)if(t=De,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,De=e;else for(;De!==null;){t=De;try{var p=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(p!==null){var m=p.memoizedProps,_=p.memoizedState,b=t.stateNode,v=b.getSnapshotBeforeUpdate(t.elementType===t.type?m:ja(t.type,m),_);b.__reactInternalSnapshotBeforeUpdate=v}break;case 3:var g=t.stateNode.containerInfo;g.nodeType===1?g.textContent="":g.nodeType===9&&g.documentElement&&g.removeChild(g.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(le(163))}}catch(y){gr(t,t.return,y)}if(e=t.sibling,e!==null){e.return=t.return,De=e;break}De=t.return}return p=D6,D6=!1,p}function Lg(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var i=r=r.next;do{if((i.tag&e)===e){var o=i.destroy;i.destroy=void 0,o!==void 0&&A3(t,n,o)}i=i.next}while(i!==r)}}function SS(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function P3(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function $D(e){var t=e.alternate;t!==null&&(e.alternate=null,$D(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[As],delete t[vm],delete t[g3],delete t[OX],delete t[MX])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function DD(e){return e.tag===5||e.tag===3||e.tag===4}function L6(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||DD(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function I3(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=bb));else if(r!==4&&(e=e.child,e!==null))for(I3(e,t,n),e=e.sibling;e!==null;)I3(e,t,n),e=e.sibling}function R3(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(R3(e,t,n),e=e.sibling;e!==null;)R3(e,t,n),e=e.sibling}var wi=null,Va=!1;function ou(e,t,n){for(n=n.child;n!==null;)LD(e,t,n),n=n.sibling}function LD(e,t,n){if(Ls&&typeof Ls.onCommitFiberUnmount=="function")try{Ls.onCommitFiberUnmount(hS,n)}catch{}switch(n.tag){case 5:Gi||Ff(n,t);case 6:var r=wi,i=Va;wi=null,ou(e,t,n),wi=r,Va=i,wi!==null&&(Va?(e=wi,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):wi.removeChild(n.stateNode));break;case 18:wi!==null&&(Va?(e=wi,n=n.stateNode,e.nodeType===8?Fw(e.parentNode,n):e.nodeType===1&&Fw(e,n),hm(e)):Fw(wi,n.stateNode));break;case 4:r=wi,i=Va,wi=n.stateNode.containerInfo,Va=!0,ou(e,t,n),wi=r,Va=i;break;case 0:case 11:case 14:case 15:if(!Gi&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){i=r=r.next;do{var o=i,a=o.destroy;o=o.tag,a!==void 0&&(o&2||o&4)&&A3(n,t,a),i=i.next}while(i!==r)}ou(e,t,n);break;case 1:if(!Gi&&(Ff(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(s){gr(n,t,s)}ou(e,t,n);break;case 21:ou(e,t,n);break;case 22:n.mode&1?(Gi=(r=Gi)||n.memoizedState!==null,ou(e,t,n),Gi=r):ou(e,t,n);break;default:ou(e,t,n)}}function F6(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new QX),t.forEach(function(r){var i=oY.bind(null,e,r);n.has(r)||(n.add(r),r.then(i,i))})}}function Fa(e,t){var n=t.deletions;if(n!==null)for(var r=0;ri&&(i=a),r&=~o}if(r=i,r=Cr()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*ZX(r/1960))-r,10e?16:e,Iu===null)var r=!1;else{if(e=Iu,Iu=null,Ob=0,Ht&6)throw Error(le(331));var i=Ht;for(Ht|=4,De=e.current;De!==null;){var o=De,a=o.child;if(De.flags&16){var s=o.deletions;if(s!==null){for(var l=0;lCr()-Pk?ud(e,0):Ak|=n),To(e,t)}function HD(e,t){t===0&&(e.mode&1?(t=Ky,Ky<<=1,!(Ky&130023424)&&(Ky=4194304)):t=1);var n=no();e=jl(e,t),e!==null&&(V0(e,t,n),To(e,n))}function iY(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),HD(e,n)}function oY(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,i=e.memoizedState;i!==null&&(n=i.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(le(314))}r!==null&&r.delete(t),HD(e,n)}var qD;qD=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||Eo.current)So=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return So=!1,qX(e,t,n);So=!!(e.flags&131072)}else So=!1,tr&&t.flags&1048576&&Q$(t,wb,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;k1(e,t),e=t.pendingProps;var i=Mh(t,Wi.current);th(t,n),i=xk(null,t,r,e,i,n);var o=wk();return t.flags|=1,typeof i=="object"&&i!==null&&typeof i.render=="function"&&i.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,ko(r)?(o=!0,Sb(t)):o=!1,t.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,yk(t),i.updater=bS,t.stateNode=i,i._reactInternals=t,S3(t,r,e,n),t=C3(null,t,r,!0,o,n)):(t.tag=0,tr&&o&&ck(t),Ji(null,t,i,n),t=t.child),t;case 16:r=t.elementType;e:{switch(k1(e,t),e=t.pendingProps,i=r._init,r=i(r._payload),t.type=r,i=t.tag=sY(r),e=ja(r,e),i){case 0:t=w3(null,t,r,e,n);break e;case 1:t=M6(null,t,r,e,n);break e;case 11:t=R6(null,t,r,e,n);break e;case 14:t=O6(null,t,r,ja(r.type,e),n);break e}throw Error(le(306,r,""))}return t;case 0:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:ja(r,i),w3(e,t,r,i,n);case 1:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:ja(r,i),M6(e,t,r,i,n);case 3:e:{if(PD(t),e===null)throw Error(le(387));r=t.pendingProps,o=t.memoizedState,i=o.element,J$(e,t),kb(t,r,null,n);var a=t.memoizedState;if(r=a.element,o.isDehydrated)if(o={element:r,isDehydrated:!1,cache:a.cache,pendingSuspenseBoundaries:a.pendingSuspenseBoundaries,transitions:a.transitions},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){i=Lh(Error(le(423)),t),t=N6(e,t,r,n,i);break e}else if(r!==i){i=Lh(Error(le(424)),t),t=N6(e,t,r,n,i);break e}else for(Ho=Bu(t.stateNode.containerInfo.firstChild),Wo=t,tr=!0,Ha=null,n=rD(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Nh(),r===i){t=Ul(e,t,n);break e}Ji(e,t,r,n)}t=t.child}return t;case 5:return iD(t),e===null&&v3(t),r=t.type,i=t.pendingProps,o=e!==null?e.memoizedProps:null,a=i.children,h3(r,i)?a=null:o!==null&&h3(r,o)&&(t.flags|=32),AD(e,t),Ji(e,t,a,n),t.child;case 6:return e===null&&v3(t),null;case 13:return ID(e,t,n);case 4:return vk(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=$h(t,null,r,n):Ji(e,t,r,n),t.child;case 11:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:ja(r,i),R6(e,t,r,i,n);case 7:return Ji(e,t,t.pendingProps,n),t.child;case 8:return Ji(e,t,t.pendingProps.children,n),t.child;case 12:return Ji(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,i=t.pendingProps,o=t.memoizedProps,a=i.value,Nn(Cb,r._currentValue),r._currentValue=a,o!==null)if(os(o.value,a)){if(o.children===i.children&&!Eo.current){t=Ul(e,t,n);break e}}else for(o=t.child,o!==null&&(o.return=t);o!==null;){var s=o.dependencies;if(s!==null){a=o.child;for(var l=s.firstContext;l!==null;){if(l.context===r){if(o.tag===1){l=Ol(-1,n&-n),l.tag=2;var u=o.updateQueue;if(u!==null){u=u.shared;var c=u.pending;c===null?l.next=l:(l.next=c.next,c.next=l),u.pending=l}}o.lanes|=n,l=o.alternate,l!==null&&(l.lanes|=n),b3(o.return,n,t),s.lanes|=n;break}l=l.next}}else if(o.tag===10)a=o.type===t.type?null:o.child;else if(o.tag===18){if(a=o.return,a===null)throw Error(le(341));a.lanes|=n,s=a.alternate,s!==null&&(s.lanes|=n),b3(a,n,t),a=o.sibling}else a=o.child;if(a!==null)a.return=o;else for(a=o;a!==null;){if(a===t){a=null;break}if(o=a.sibling,o!==null){o.return=a.return,a=o;break}a=a.return}o=a}Ji(e,t,i.children,n),t=t.child}return t;case 9:return i=t.type,r=t.pendingProps.children,th(t,n),i=Sa(i),r=r(i),t.flags|=1,Ji(e,t,r,n),t.child;case 14:return r=t.type,i=ja(r,t.pendingProps),i=ja(r.type,i),O6(e,t,r,i,n);case 15:return kD(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:ja(r,i),k1(e,t),t.tag=1,ko(r)?(e=!0,Sb(t)):e=!1,th(t,n),tD(t,r,i),S3(t,r,i,n),C3(null,t,r,!0,e,n);case 19:return RD(e,t,n);case 22:return TD(e,t,n)}throw Error(le(156,t.tag))};function WD(e,t){return b$(e,t)}function aY(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function va(e,t,n,r){return new aY(e,t,n,r)}function Mk(e){return e=e.prototype,!(!e||!e.isReactComponent)}function sY(e){if(typeof e=="function")return Mk(e)?1:0;if(e!=null){if(e=e.$$typeof,e===Z4)return 11;if(e===J4)return 14}return 2}function Vu(e,t){var n=e.alternate;return n===null?(n=va(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function P1(e,t,n,r,i,o){var a=2;if(r=e,typeof e=="function")Mk(e)&&(a=1);else if(typeof e=="string")a=5;else e:switch(e){case Pf:return cd(n.children,i,o,t);case Y4:a=8,i|=8;break;case H5:return e=va(12,n,t,i|2),e.elementType=H5,e.lanes=o,e;case q5:return e=va(13,n,t,i),e.elementType=q5,e.lanes=o,e;case W5:return e=va(19,n,t,i),e.elementType=W5,e.lanes=o,e;case n$:return wS(n,i,o,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case e$:a=10;break e;case t$:a=9;break e;case Z4:a=11;break e;case J4:a=14;break e;case pu:a=16,r=null;break e}throw Error(le(130,e==null?e:typeof e,""))}return t=va(a,n,t,i),t.elementType=e,t.type=r,t.lanes=o,t}function cd(e,t,n,r){return e=va(7,e,r,t),e.lanes=n,e}function wS(e,t,n,r){return e=va(22,e,r,t),e.elementType=n$,e.lanes=n,e.stateNode={isHidden:!1},e}function qw(e,t,n){return e=va(6,e,null,t),e.lanes=n,e}function Ww(e,t,n){return t=va(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function lY(e,t,n,r,i){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Tw(0),this.expirationTimes=Tw(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Tw(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function Nk(e,t,n,r,i,o,a,s,l){return e=new lY(e,t,n,s,l),t===1?(t=1,o===!0&&(t|=8)):t=0,o=va(3,null,null,t),e.current=o,o.stateNode=e,o.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},yk(o),e}function uY(e,t,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(YD)}catch(e){console.error(e)}}YD(),QN.exports=ea;var Uo=QN.exports;const jje=pc(Uo);var q6=Uo;V5.createRoot=q6.createRoot,V5.hydrateRoot=q6.hydrateRoot;const pY="modulepreload",gY=function(e,t){return new URL(e,t).href},W6={},ZD=function(t,n,r){if(!n||n.length===0)return t();const i=document.getElementsByTagName("link");return Promise.all(n.map(o=>{if(o=gY(o,r),o in W6)return;W6[o]=!0;const a=o.endsWith(".css"),s=a?'[rel="stylesheet"]':"";if(!!r)for(let c=i.length-1;c>=0;c--){const d=i[c];if(d.href===o&&(!a||d.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${o}"]${s}`))return;const u=document.createElement("link");if(u.rel=a?"stylesheet":pY,a||(u.as="script",u.crossOrigin=""),u.href=o,document.head.appendChild(u),a)return new Promise((c,d)=>{u.addEventListener("load",c),u.addEventListener("error",()=>d(new Error(`Unable to preload CSS for ${o}`)))})})).then(()=>t()).catch(o=>{const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=o,window.dispatchEvent(a),!a.defaultPrevented)throw o})};function ci(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r3?t.i-4:t.i:Array.isArray(e)?1:AS(e)?2:PS(e)?3:0}function Gu(e,t){return ec(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function I1(e,t){return ec(e)===2?e.get(t):e[t]}function JD(e,t,n){var r=ec(e);r===2?e.set(t,n):r===3?e.add(n):e[t]=n}function eL(e,t){return e===t?e!==0||1/e==1/t:e!=e&&t!=t}function AS(e){return SY&&e instanceof Map}function PS(e){return xY&&e instanceof Set}function ri(e){return e.o||e.t}function Bk(e){if(Array.isArray(e))return Array.prototype.slice.call(e);var t=nL(e);delete t[St];for(var n=ih(t),r=0;r1&&(e.set=e.add=e.clear=e.delete=mY),Object.freeze(e),t&&Vl(e,function(n,r){return W0(r,!0)},!0)),e}function mY(){ci(2)}function zk(e){return e==null||typeof e!="object"||Object.isFrozen(e)}function Bs(e){var t=L3[e];return t||ci(18,e),t}function jk(e,t){L3[e]||(L3[e]=t)}function Em(){return Tm}function Kw(e,t){t&&(Bs("Patches"),e.u=[],e.s=[],e.v=t)}function $b(e){D3(e),e.p.forEach(yY),e.p=null}function D3(e){e===Tm&&(Tm=e.l)}function K6(e){return Tm={p:[],l:Tm,h:e,m:!0,_:0}}function yY(e){var t=e[St];t.i===0||t.i===1?t.j():t.g=!0}function Qw(e,t){t._=t.p.length;var n=t.p[0],r=e!==void 0&&e!==n;return t.h.O||Bs("ES5").S(t,e,r),r?(n[St].P&&($b(t),ci(4)),Ao(e)&&(e=Db(t,e),t.l||Lb(t,e)),t.u&&Bs("Patches").M(n[St].t,e,t.u,t.s)):e=Db(t,n,[]),$b(t),t.u&&t.v(t.u,t.s),e!==RS?e:void 0}function Db(e,t,n){if(zk(t))return t;var r=t[St];if(!r)return Vl(t,function(s,l){return Q6(e,r,t,s,l,n)},!0),t;if(r.A!==e)return t;if(!r.P)return Lb(e,r.t,!0),r.t;if(!r.I){r.I=!0,r.A._--;var i=r.i===4||r.i===5?r.o=Bk(r.k):r.o,o=i,a=!1;r.i===3&&(o=new Set(i),i.clear(),a=!0),Vl(o,function(s,l){return Q6(e,r,i,s,l,n,a)}),Lb(e,i,!1),n&&e.u&&Bs("Patches").N(r,n,e.u,e.s)}return r.o}function Q6(e,t,n,r,i,o,a){if(io(i)){var s=Db(e,i,o&&t&&t.i!==3&&!Gu(t.R,r)?o.concat(r):void 0);if(JD(n,r,s),!io(s))return;e.m=!1}else a&&n.add(i);if(Ao(i)&&!zk(i)){if(!e.h.D&&e._<1)return;Db(e,i),t&&t.A.l||Lb(e,i)}}function Lb(e,t,n){n===void 0&&(n=!1),!e.l&&e.h.D&&e.m&&W0(t,n)}function Xw(e,t){var n=e[St];return(n?ri(n):e)[t]}function X6(e,t){if(t in e)for(var n=Object.getPrototypeOf(e);n;){var r=Object.getOwnPropertyDescriptor(n,t);if(r)return r;n=Object.getPrototypeOf(n)}}function bo(e){e.P||(e.P=!0,e.l&&bo(e.l))}function Yw(e){e.o||(e.o=Bk(e.t))}function km(e,t,n){var r=AS(t)?Bs("MapSet").F(t,n):PS(t)?Bs("MapSet").T(t,n):e.O?function(i,o){var a=Array.isArray(i),s={i:a?1:0,A:o?o.A:Em(),P:!1,I:!1,R:{},l:o,t:i,k:null,o:null,j:null,C:!1},l=s,u=Am;a&&(l=[s],u=gg);var c=Proxy.revocable(l,u),d=c.revoke,f=c.proxy;return s.k=f,s.j=d,f}(t,n):Bs("ES5").J(t,n);return(n?n.A:Em()).p.push(r),r}function IS(e){return io(e)||ci(22,e),function t(n){if(!Ao(n))return n;var r,i=n[St],o=ec(n);if(i){if(!i.P&&(i.i<4||!Bs("ES5").K(i)))return i.t;i.I=!0,r=Y6(n,o),i.I=!1}else r=Y6(n,o);return Vl(r,function(a,s){i&&I1(i.t,a)===s||JD(r,a,t(s))}),o===3?new Set(r):r}(e)}function Y6(e,t){switch(t){case 2:return new Map(e);case 3:return Array.from(e)}return Bk(e)}function Uk(){function e(o,a){var s=i[o];return s?s.enumerable=a:i[o]=s={configurable:!0,enumerable:a,get:function(){var l=this[St];return Am.get(l,o)},set:function(l){var u=this[St];Am.set(u,o,l)}},s}function t(o){for(var a=o.length-1;a>=0;a--){var s=o[a][St];if(!s.P)switch(s.i){case 5:r(s)&&bo(s);break;case 4:n(s)&&bo(s)}}}function n(o){for(var a=o.t,s=o.k,l=ih(s),u=l.length-1;u>=0;u--){var c=l[u];if(c!==St){var d=a[c];if(d===void 0&&!Gu(a,c))return!0;var f=s[c],h=f&&f[St];if(h?h.t!==d:!eL(f,d))return!0}}var p=!!a[St];return l.length!==ih(a).length+(p?0:1)}function r(o){var a=o.k;if(a.length!==o.t.length)return!0;var s=Object.getOwnPropertyDescriptor(a,a.length-1);if(s&&!s.get)return!0;for(var l=0;l1?b-1:0),g=1;g1?c-1:0),f=1;f=0;i--){var o=r[i];if(o.path.length===0&&o.op==="replace"){n=o.value;break}}i>-1&&(r=r.slice(i+1));var a=Bs("Patches").$;return io(n)?a(n,r):this.produce(n,function(s){return a(s,r)})},e}(),Yo=new rL,iL=Yo.produce,Hk=Yo.produceWithPatches.bind(Yo),CY=Yo.setAutoFreeze.bind(Yo),EY=Yo.setUseProxies.bind(Yo),F3=Yo.applyPatches.bind(Yo),kY=Yo.createDraft.bind(Yo),TY=Yo.finishDraft.bind(Yo);const vc=iL,AY=Object.freeze(Object.defineProperty({__proto__:null,Immer:rL,applyPatches:F3,castDraft:bY,castImmutable:_Y,createDraft:kY,current:IS,default:vc,enableAllPlugins:vY,enableES5:Uk,enableMapSet:tL,enablePatches:Vk,finishDraft:TY,freeze:W0,immerable:rh,isDraft:io,isDraftable:Ao,nothing:RS,original:Fk,produce:iL,produceWithPatches:Hk,setAutoFreeze:CY,setUseProxies:EY},Symbol.toStringTag,{value:"Module"}));function Pm(e){"@babel/helpers - typeof";return Pm=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},Pm(e)}function PY(e,t){if(Pm(e)!=="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(Pm(r)!=="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function IY(e){var t=PY(e,"string");return Pm(t)==="symbol"?t:String(t)}function RY(e,t,n){return t=IY(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function e8(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function t8(e){for(var t=1;t"u"&&(n=t,t=void 0),typeof n<"u"){if(typeof n!="function")throw new Error(Ci(1));return n(K0)(e,t)}if(typeof e!="function")throw new Error(Ci(2));var i=e,o=t,a=[],s=a,l=!1;function u(){s===a&&(s=a.slice())}function c(){if(l)throw new Error(Ci(3));return o}function d(m){if(typeof m!="function")throw new Error(Ci(4));if(l)throw new Error(Ci(5));var _=!0;return u(),s.push(m),function(){if(_){if(l)throw new Error(Ci(6));_=!1,u();var v=s.indexOf(m);s.splice(v,1),a=null}}}function f(m){if(!OY(m))throw new Error(Ci(7));if(typeof m.type>"u")throw new Error(Ci(8));if(l)throw new Error(Ci(9));try{l=!0,o=i(o,m)}finally{l=!1}for(var _=a=s,b=0;b<_.length;b++){var v=_[b];v()}return m}function h(m){if(typeof m!="function")throw new Error(Ci(10));i=m,f({type:Bh.REPLACE})}function p(){var m,_=d;return m={subscribe:function(v){if(typeof v!="object"||v===null)throw new Error(Ci(11));function g(){v.next&&v.next(c())}g();var y=_(g);return{unsubscribe:y}}},m[n8]=function(){return this},m}return f({type:Bh.INIT}),r={dispatch:f,subscribe:d,getState:c,replaceReducer:h},r[n8]=p,r}var oL=K0;function MY(e){Object.keys(e).forEach(function(t){var n=e[t],r=n(void 0,{type:Bh.INIT});if(typeof r>"u")throw new Error(Ci(12));if(typeof n(void 0,{type:Bh.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(Ci(13))})}function hp(e){for(var t=Object.keys(e),n={},r=0;r"u")throw u&&u.type,new Error(Ci(14));d[h]=_,c=c||_!==m}return c=c||o.length!==Object.keys(l).length,c?d:l}}function r8(e,t){return function(){return t(e.apply(this,arguments))}}function aL(e,t){if(typeof e=="function")return r8(e,t);if(typeof e!="object"||e===null)throw new Error(Ci(16));var n={};for(var r in e){var i=e[r];typeof i=="function"&&(n[r]=r8(i,t))}return n}function zh(){for(var e=arguments.length,t=new Array(e),n=0;n-1){var u=n[l];return l>0&&(n.splice(l,1),n.unshift(u)),u.value}return Fb}function i(s,l){r(s)===Fb&&(n.unshift({key:s,value:l}),n.length>e&&n.pop())}function o(){return n}function a(){n=[]}return{get:r,put:i,getEntries:o,clear:a}}var sL=function(t,n){return t===n};function LY(e){return function(n,r){if(n===null||r===null||n.length!==r.length)return!1;for(var i=n.length,o=0;o1?t-1:0),r=1;r0&&o[o.length-1])&&(u[0]===6||u[0]===2)){n=0;continue}if(u[0]===3&&(!o||u[1]>o[0]&&u[1]",value:e};if(typeof e!="object"||e===null||o!=null&&o.has(e))return!1;for(var s=r!=null?r(e):Object.entries(e),l=i.length>0,u=function(_,b){var v=t?t+"."+_:_;if(l){var g=i.some(function(y){return y instanceof RegExp?y.test(v):v===y});if(g)return"continue"}if(!n(b))return{value:{keyPath:v,value:b}};if(typeof b=="object"&&(a=gL(b,v,n,r,i,o),a))return{value:a}},c=0,d=s;c-1}function eZ(e){return""+e}function _L(e){var t={},n=[],r,i={addCase:function(o,a){var s=typeof o=="string"?o:o.type;if(s in t)throw new Error("addCase cannot be called with two reducers for the same action type");return t[s]=a,i},addMatcher:function(o,a){return n.push({matcher:o,reducer:a}),i},addDefaultCase:function(o){return r=o,i}};return e(i),[t,n,r]}function tZ(e){return typeof e=="function"}function SL(e,t,n,r){n===void 0&&(n=[]);var i=typeof t=="function"?_L(t):[t,n,r],o=i[0],a=i[1],s=i[2],l;if(tZ(e))l=function(){return B3(e())};else{var u=B3(e);l=function(){return u}}function c(d,f){d===void 0&&(d=l());var h=tc([o[f.type]],a.filter(function(p){var m=p.matcher;return m(f)}).map(function(p){var m=p.reducer;return m}));return h.filter(function(p){return!!p}).length===0&&(h=[s]),h.reduce(function(p,m){if(m)if(io(p)){var _=p,b=m(_,f);return b===void 0?p:b}else{if(Ao(p))return vc(p,function(v){return m(v,f)});var b=m(p,f);if(b===void 0){if(p===null)return p;throw Error("A case reducer on a non-draftable value must not return undefined")}return b}return p},d)}return c.getInitialState=l,c}function nZ(e,t){return e+"/"+t}function nr(e){var t=e.name;if(!t)throw new Error("`name` is a required option for createSlice");typeof process<"u";var n=typeof e.initialState=="function"?e.initialState:B3(e.initialState),r=e.reducers||{},i=Object.keys(r),o={},a={},s={};i.forEach(function(c){var d=r[c],f=nZ(t,c),h,p;"reducer"in d?(h=d.reducer,p=d.prepare):h=d,o[c]=h,a[f]=h,s[c]=p?Ne(f,p):Ne(f)});function l(){var c=typeof e.extraReducers=="function"?_L(e.extraReducers):[e.extraReducers],d=c[0],f=d===void 0?{}:d,h=c[1],p=h===void 0?[]:h,m=c[2],_=m===void 0?void 0:m,b=xo(xo({},f),a);return SL(n,function(v){for(var g in b)v.addCase(g,b[g]);for(var y=0,S=p;y0;if(v){var g=p.filter(function(y){return u(_,y,m)}).length>0;g&&(m.ids=Object.keys(m.entities))}}function f(p,m){return h([p],m)}function h(p,m){var _=xL(p,e,m),b=_[0],v=_[1];d(v,m),n(b,m)}return{removeAll:aZ(l),addOne:xr(t),addMany:xr(n),setOne:xr(r),setMany:xr(i),setAll:xr(o),updateOne:xr(c),updateMany:xr(d),upsertOne:xr(f),upsertMany:xr(h),removeOne:xr(a),removeMany:xr(s)}}function sZ(e,t){var n=wL(e),r=n.removeOne,i=n.removeMany,o=n.removeAll;function a(v,g){return s([v],g)}function s(v,g){v=dd(v);var y=v.filter(function(S){return!(zg(S,e)in g.entities)});y.length!==0&&_(y,g)}function l(v,g){return u([v],g)}function u(v,g){v=dd(v),v.length!==0&&_(v,g)}function c(v,g){v=dd(v),g.entities={},g.ids=[],s(v,g)}function d(v,g){return f([v],g)}function f(v,g){for(var y=!1,S=0,w=v;S-1;return n&&r}function Y0(e){return typeof e[0]=="function"&&"pending"in e[0]&&"fulfilled"in e[0]&&"rejected"in e[0]}function NS(){for(var e=[],t=0;t0)for(var g=h.getState(),y=Array.from(n.values()),S=0,w=y;SMath.floor(e/t)*t,qa=(e,t)=>Math.round(e/t)*t;var kZ=typeof global=="object"&&global&&global.Object===Object&&global;const jL=kZ;var TZ=typeof self=="object"&&self&&self.Object===Object&&self,AZ=jL||TZ||Function("return this")();const el=AZ;var PZ=el.Symbol;const wa=PZ;var UL=Object.prototype,IZ=UL.hasOwnProperty,RZ=UL.toString,jp=wa?wa.toStringTag:void 0;function OZ(e){var t=IZ.call(e,jp),n=e[jp];try{e[jp]=void 0;var r=!0}catch{}var i=RZ.call(e);return r&&(t?e[jp]=n:delete e[jp]),i}var MZ=Object.prototype,NZ=MZ.toString;function $Z(e){return NZ.call(e)}var DZ="[object Null]",LZ="[object Undefined]",d8=wa?wa.toStringTag:void 0;function cs(e){return e==null?e===void 0?LZ:DZ:d8&&d8 in Object(e)?OZ(e):$Z(e)}function Po(e){return e!=null&&typeof e=="object"}var FZ="[object Symbol]";function $S(e){return typeof e=="symbol"||Po(e)&&cs(e)==FZ}function VL(e,t){for(var n=-1,r=e==null?0:e.length,i=Array(r);++n0){if(++t>=yJ)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}function SJ(e){return function(){return e}}var xJ=function(){try{var e=zd(Object,"defineProperty");return e({},"",{}),e}catch{}}();const Gb=xJ;var wJ=Gb?function(e,t){return Gb(e,"toString",{configurable:!0,enumerable:!1,value:SJ(t),writable:!0})}:DS;const CJ=wJ;var EJ=_J(CJ);const WL=EJ;function KL(e,t){for(var n=-1,r=e==null?0:e.length;++n-1}var RJ=9007199254740991,OJ=/^(?:0|[1-9]\d*)$/;function Yk(e,t){var n=typeof e;return t=t??RJ,!!t&&(n=="number"||n!="symbol"&&OJ.test(e))&&e>-1&&e%1==0&&e-1&&e%1==0&&e<=$J}function gp(e){return e!=null&&Zk(e.length)&&!Xk(e)}function FS(e,t,n){if(!Io(n))return!1;var r=typeof t;return(r=="number"?gp(n)&&Yk(t,n.length):r=="string"&&t in n)?ty(n[t],e):!1}function ZL(e){return YL(function(t,n){var r=-1,i=n.length,o=i>1?n[i-1]:void 0,a=i>2?n[2]:void 0;for(o=e.length>3&&typeof o=="function"?(i--,o):void 0,a&&FS(n[0],n[1],a)&&(o=i<3?void 0:o,i=1),t=Object(t);++r-1}function Xee(e,t){var n=this.__data__,r=zS(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this}function Xl(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t0&&n(s)?t>1?oF(s,t-1,n,r,i):iT(i,s):r||(i[i.length]=s)}return i}function hte(e){var t=e==null?0:e.length;return t?oF(e,1):[]}function pte(e){return WL(XL(e,void 0,hte),e+"")}var gte=rF(Object.getPrototypeOf,Object);const oT=gte;var mte="[object Object]",yte=Function.prototype,vte=Object.prototype,aF=yte.toString,bte=vte.hasOwnProperty,_te=aF.call(Object);function sF(e){if(!Po(e)||cs(e)!=mte)return!1;var t=oT(e);if(t===null)return!0;var n=bte.call(t,"constructor")&&t.constructor;return typeof n=="function"&&n instanceof n&&aF.call(n)==_te}function lF(e,t,n){var r=-1,i=e.length;t<0&&(t=-t>i?0:i+t),n=n>i?i:n,n<0&&(n+=i),i=t>n?0:n-t>>>0,t>>>=0;for(var o=Array(i);++r=r?e:lF(e,t,n)}var Ste="\\ud800-\\udfff",xte="\\u0300-\\u036f",wte="\\ufe20-\\ufe2f",Cte="\\u20d0-\\u20ff",Ete=xte+wte+Cte,kte="\\ufe0e\\ufe0f",Tte="\\u200d",Ate=RegExp("["+Tte+Ste+Ete+kte+"]");function VS(e){return Ate.test(e)}function Pte(e){return e.split("")}var cF="\\ud800-\\udfff",Ite="\\u0300-\\u036f",Rte="\\ufe20-\\ufe2f",Ote="\\u20d0-\\u20ff",Mte=Ite+Rte+Ote,Nte="\\ufe0e\\ufe0f",$te="["+cF+"]",V3="["+Mte+"]",G3="\\ud83c[\\udffb-\\udfff]",Dte="(?:"+V3+"|"+G3+")",dF="[^"+cF+"]",fF="(?:\\ud83c[\\udde6-\\uddff]){2}",hF="[\\ud800-\\udbff][\\udc00-\\udfff]",Lte="\\u200d",pF=Dte+"?",gF="["+Nte+"]?",Fte="(?:"+Lte+"(?:"+[dF,fF,hF].join("|")+")"+gF+pF+")*",Bte=gF+pF+Fte,zte="(?:"+[dF+V3+"?",V3,fF,hF,$te].join("|")+")",jte=RegExp(G3+"(?="+G3+")|"+zte+Bte,"g");function Ute(e){return e.match(jte)||[]}function mF(e){return VS(e)?Ute(e):Pte(e)}function Vte(e){return function(t){t=Uh(t);var n=VS(t)?mF(t):void 0,r=n?n[0]:t.charAt(0),i=n?uF(n,1).join(""):t.slice(1);return r[e]()+i}}var Gte=Vte("toUpperCase");const yF=Gte;function vF(e,t,n,r){var i=-1,o=e==null?0:e.length;for(r&&o&&(n=e[++i]);++i=t?e:t)),e}function Ru(e,t,n){return n===void 0&&(n=t,t=void 0),n!==void 0&&(n=O1(n),n=n===n?n:0),t!==void 0&&(t=O1(t),t=t===t?t:0),Nne(O1(e),t,n)}function $ne(){this.__data__=new Xl,this.size=0}function Dne(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}function Lne(e){return this.__data__.get(e)}function Fne(e){return this.__data__.has(e)}var Bne=200;function zne(e,t){var n=this.__data__;if(n instanceof Xl){var r=n.__data__;if(!Mm||r.lengths))return!1;var u=o.get(e),c=o.get(t);if(u&&c)return u==t&&c==e;var d=-1,f=!0,h=n&_ie?new Nm:void 0;for(o.set(e,t),o.set(t,e);++d1),o}),pp(e,FF(e),n),r&&(n=Ug(n,Boe|zoe|joe,Foe));for(var i=t.length;i--;)eB(n,t[i]);return n});const qS=Uoe;var Voe=XF("length");const Goe=Voe;var tB="\\ud800-\\udfff",Hoe="\\u0300-\\u036f",qoe="\\ufe20-\\ufe2f",Woe="\\u20d0-\\u20ff",Koe=Hoe+qoe+Woe,Qoe="\\ufe0e\\ufe0f",Xoe="["+tB+"]",X3="["+Koe+"]",Y3="\\ud83c[\\udffb-\\udfff]",Yoe="(?:"+X3+"|"+Y3+")",nB="[^"+tB+"]",rB="(?:\\ud83c[\\udde6-\\uddff]){2}",iB="[\\ud800-\\udbff][\\udc00-\\udfff]",Zoe="\\u200d",oB=Yoe+"?",aB="["+Qoe+"]?",Joe="(?:"+Zoe+"(?:"+[nB,rB,iB].join("|")+")"+aB+oB+")*",eae=aB+oB+Joe,tae="(?:"+[nB+X3+"?",X3,rB,iB,Xoe].join("|")+")",q8=RegExp(Y3+"(?="+Y3+")|"+tae+eae,"g");function nae(e){for(var t=q8.lastIndex=0;q8.test(e);)++t;return t}function sB(e){return VS(e)?nae(e):Goe(e)}var rae=Math.floor,iae=Math.random;function oae(e,t){return e+rae(iae()*(t-e+1))}var aae=parseFloat,sae=Math.min,lae=Math.random;function uae(e,t,n){if(n&&typeof n!="boolean"&&FS(e,t,n)&&(t=n=void 0),n===void 0&&(typeof t=="boolean"?(n=t,t=void 0):typeof e=="boolean"&&(n=e,e=void 0)),e===void 0&&t===void 0?(e=0,t=1):(e=lh(e),t===void 0?(t=e,e=0):t=lh(t)),e>t){var r=e;e=t,t=r}if(n||e%1||t%1){var i=lae();return sae(e+i*(t-e+aae("1e-"+((i+"").length-1))),t)}return oae(e,t)}var cae=Math.ceil,dae=Math.max;function fae(e,t,n,r){for(var i=-1,o=dae(cae((t-e)/(n||1)),0),a=Array(o);o--;)a[r?o:++i]=e,e+=n;return a}function hae(e){return function(t,n,r){return r&&typeof r!="number"&&FS(t,n,r)&&(n=r=void 0),t=lh(t),n===void 0?(n=t,t=0):n=lh(n),r=r===void 0?t=o)return e;var s=n-sB(r);if(s<1)return r;var l=a?uF(a,0,s).join(""):e.slice(0,s);if(i===void 0)return l+r;if(a&&(s+=l.length-s),Noe(i)){if(e.slice(s).search(i)){var u,c=l;for(i.global||(i=RegExp(i.source,Uh(Cae.exec(i))+"g")),i.lastIndex=0;u=i.exec(c);)var d=u.index;l=l.slice(0,d===void 0?s:d)}}else if(e.indexOf(Vb(i),s)!=s){var f=l.lastIndexOf(i);f>-1&&(l=l.slice(0,f))}return l+r}var Eae=1/0,kae=ch&&1/lT(new ch([,-0]))[1]==Eae?function(e){return new ch(e)}:mJ;const Tae=kae;var Aae=200;function Pae(e,t,n){var r=-1,i=IJ,o=e.length,a=!0,s=[],l=s;if(n)a=!1,i=moe;else if(o>=Aae){var u=t?null:Tae(e);if(u)return lT(u);a=!1,i=HF,l=new Nm}else l=t?[]:s;e:for(;++r{Loe(e,t.payload)}}}),{configChanged:Iae}=uB.actions,Rae=uB.reducer,Uje={any:"Any","sd-1":"Stable Diffusion 1.x","sd-2":"Stable Diffusion 2.x",sdxl:"Stable Diffusion XL","sdxl-refiner":"Stable Diffusion XL Refiner"},Vje={any:"Any","sd-1":"SD1","sd-2":"SD2",sdxl:"SDXL","sdxl-refiner":"SDXLR"},Oae={any:{maxClip:0,markers:[]},"sd-1":{maxClip:12,markers:[0,1,2,3,4,8,12]},"sd-2":{maxClip:24,markers:[0,1,2,3,5,10,15,20,24]},sdxl:{maxClip:24,markers:[0,1,2,3,5,10,15,20,24]},"sdxl-refiner":{maxClip:24,markers:[0,1,2,3,5,10,15,20,24]}},Gje={lycoris:"LyCORIS",diffusers:"Diffusers"},Mae=0,Gg=4294967295;var Xt;(function(e){e.assertEqual=i=>i;function t(i){}e.assertIs=t;function n(i){throw new Error}e.assertNever=n,e.arrayToEnum=i=>{const o={};for(const a of i)o[a]=a;return o},e.getValidEnumValues=i=>{const o=e.objectKeys(i).filter(s=>typeof i[i[s]]!="number"),a={};for(const s of o)a[s]=i[s];return e.objectValues(a)},e.objectValues=i=>e.objectKeys(i).map(function(o){return i[o]}),e.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{const o=[];for(const a in i)Object.prototype.hasOwnProperty.call(i,a)&&o.push(a);return o},e.find=(i,o)=>{for(const a of i)if(o(a))return a},e.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&isFinite(i)&&Math.floor(i)===i;function r(i,o=" | "){return i.map(a=>typeof a=="string"?`'${a}'`:a).join(o)}e.joinValues=r,e.jsonStringifyReplacer=(i,o)=>typeof o=="bigint"?o.toString():o})(Xt||(Xt={}));var J3;(function(e){e.mergeShapes=(t,n)=>({...t,...n})})(J3||(J3={}));const Re=Xt.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),wu=e=>{switch(typeof e){case"undefined":return Re.undefined;case"string":return Re.string;case"number":return isNaN(e)?Re.nan:Re.number;case"boolean":return Re.boolean;case"function":return Re.function;case"bigint":return Re.bigint;case"symbol":return Re.symbol;case"object":return Array.isArray(e)?Re.array:e===null?Re.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?Re.promise:typeof Map<"u"&&e instanceof Map?Re.map:typeof Set<"u"&&e instanceof Set?Re.set:typeof Date<"u"&&e instanceof Date?Re.date:Re.object;default:return Re.unknown}},he=Xt.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),Nae=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:");class ns extends Error{constructor(t){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};const n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=t}get errors(){return this.issues}format(t){const n=t||function(o){return o.message},r={_errors:[]},i=o=>{for(const a of o.issues)if(a.code==="invalid_union")a.unionErrors.map(i);else if(a.code==="invalid_return_type")i(a.returnTypeError);else if(a.code==="invalid_arguments")i(a.argumentsError);else if(a.path.length===0)r._errors.push(n(a));else{let s=r,l=0;for(;ln.message){const n={},r=[];for(const i of this.issues)i.path.length>0?(n[i.path[0]]=n[i.path[0]]||[],n[i.path[0]].push(t(i))):r.push(t(i));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}}ns.create=e=>new ns(e);const $m=(e,t)=>{let n;switch(e.code){case he.invalid_type:e.received===Re.undefined?n="Required":n=`Expected ${e.expected}, received ${e.received}`;break;case he.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,Xt.jsonStringifyReplacer)}`;break;case he.unrecognized_keys:n=`Unrecognized key(s) in object: ${Xt.joinValues(e.keys,", ")}`;break;case he.invalid_union:n="Invalid input";break;case he.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${Xt.joinValues(e.options)}`;break;case he.invalid_enum_value:n=`Invalid enum value. Expected ${Xt.joinValues(e.options)}, received '${e.received}'`;break;case he.invalid_arguments:n="Invalid function arguments";break;case he.invalid_return_type:n="Invalid function return type";break;case he.invalid_date:n="Invalid date";break;case he.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:Xt.assertNever(e.validation):e.validation!=="regex"?n=`Invalid ${e.validation}`:n="Invalid";break;case he.too_small:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:n="Invalid input";break;case he.too_big:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?n=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:n="Invalid input";break;case he.custom:n="Invalid input";break;case he.invalid_intersection_types:n="Intersection results could not be merged";break;case he.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case he.not_finite:n="Number must be finite";break;default:n=t.defaultError,Xt.assertNever(e)}return{message:n}};let cB=$m;function $ae(e){cB=e}function qb(){return cB}const Wb=e=>{const{data:t,path:n,errorMaps:r,issueData:i}=e,o=[...n,...i.path||[]],a={...i,path:o};let s="";const l=r.filter(u=>!!u).slice().reverse();for(const u of l)s=u(a,{data:t,defaultError:s}).message;return{...i,path:o,message:i.message||s}},Dae=[];function Me(e,t){const n=Wb({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,qb(),$m].filter(r=>!!r)});e.common.issues.push(n)}class Ki{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,n){const r=[];for(const i of n){if(i.status==="aborted")return yt;i.status==="dirty"&&t.dirty(),r.push(i.value)}return{status:t.value,value:r}}static async mergeObjectAsync(t,n){const r=[];for(const i of n)r.push({key:await i.key,value:await i.value});return Ki.mergeObjectSync(t,r)}static mergeObjectSync(t,n){const r={};for(const i of n){const{key:o,value:a}=i;if(o.status==="aborted"||a.status==="aborted")return yt;o.status==="dirty"&&t.dirty(),a.status==="dirty"&&t.dirty(),o.value!=="__proto__"&&(typeof a.value<"u"||i.alwaysSet)&&(r[o.value]=a.value)}return{status:t.value,value:r}}}const yt=Object.freeze({status:"aborted"}),dB=e=>({status:"dirty",value:e}),oo=e=>({status:"valid",value:e}),eE=e=>e.status==="aborted",tE=e=>e.status==="dirty",Dm=e=>e.status==="valid",Kb=e=>typeof Promise<"u"&&e instanceof Promise;var rt;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t==null?void 0:t.message})(rt||(rt={}));class Ks{constructor(t,n,r,i){this._cachedPath=[],this.parent=t,this.data=n,this._path=r,this._key=i}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const X8=(e,t)=>{if(Dm(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const n=new ns(e.common.issues);return this._error=n,this._error}}};function xt(e){if(!e)return{};const{errorMap:t,invalid_type_error:n,required_error:r,description:i}=e;if(t&&(n||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:i}:{errorMap:(a,s)=>a.code!=="invalid_type"?{message:s.defaultError}:typeof s.data>"u"?{message:r??s.defaultError}:{message:n??s.defaultError},description:i}}class Et{constructor(t){this.spa=this.safeParseAsync,this._def=t,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(t){return wu(t.data)}_getOrReturnCtx(t,n){return n||{common:t.parent.common,data:t.data,parsedType:wu(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new Ki,ctx:{common:t.parent.common,data:t.data,parsedType:wu(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){const n=this._parse(t);if(Kb(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(t){const n=this._parse(t);return Promise.resolve(n)}parse(t,n){const r=this.safeParse(t,n);if(r.success)return r.data;throw r.error}safeParse(t,n){var r;const i={common:{issues:[],async:(r=n==null?void 0:n.async)!==null&&r!==void 0?r:!1,contextualErrorMap:n==null?void 0:n.errorMap},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:wu(t)},o=this._parseSync({data:t,path:i.path,parent:i});return X8(i,o)}async parseAsync(t,n){const r=await this.safeParseAsync(t,n);if(r.success)return r.data;throw r.error}async safeParseAsync(t,n){const r={common:{issues:[],contextualErrorMap:n==null?void 0:n.errorMap,async:!0},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:wu(t)},i=this._parse({data:t,path:r.path,parent:r}),o=await(Kb(i)?i:Promise.resolve(i));return X8(r,o)}refine(t,n){const r=i=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(i):n;return this._refinement((i,o)=>{const a=t(i),s=()=>o.addIssue({code:he.custom,...r(i)});return typeof Promise<"u"&&a instanceof Promise?a.then(l=>l?!0:(s(),!1)):a?!0:(s(),!1)})}refinement(t,n){return this._refinement((r,i)=>t(r)?!0:(i.addIssue(typeof n=="function"?n(r,i):n),!1))}_refinement(t){return new ss({schema:this,typeName:st.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}optional(){return Ml.create(this,this._def)}nullable(){return Ad.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return rs.create(this,this._def)}promise(){return Hh.create(this,this._def)}or(t){return zm.create([this,t],this._def)}and(t){return jm.create(this,t,this._def)}transform(t){return new ss({...xt(this._def),schema:this,typeName:st.ZodEffects,effect:{type:"transform",transform:t}})}default(t){const n=typeof t=="function"?t:()=>t;return new qm({...xt(this._def),innerType:this,defaultValue:n,typeName:st.ZodDefault})}brand(){return new hB({typeName:st.ZodBranded,type:this,...xt(this._def)})}catch(t){const n=typeof t=="function"?t:()=>t;return new Zb({...xt(this._def),innerType:this,catchValue:n,typeName:st.ZodCatch})}describe(t){const n=this.constructor;return new n({...this._def,description:t})}pipe(t){return sy.create(this,t)}readonly(){return e_.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const Lae=/^c[^\s-]{8,}$/i,Fae=/^[a-z][a-z0-9]*$/,Bae=/[0-9A-HJKMNP-TV-Z]{26}/,zae=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,jae=/^([A-Z0-9_+-]+\.?)*[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Uae=/^(\p{Extended_Pictographic}|\p{Emoji_Component})+$/u,Vae=/^(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))$/,Gae=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,Hae=e=>e.precision?e.offset?new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${e.precision}}(([+-]\\d{2}(:?\\d{2})?)|Z)$`):new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${e.precision}}Z$`):e.precision===0?e.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(([+-]\\d{2}(:?\\d{2})?)|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$"):e.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}(:?\\d{2})?)|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$");function qae(e,t){return!!((t==="v4"||!t)&&Vae.test(e)||(t==="v6"||!t)&&Gae.test(e))}class Ya extends Et{constructor(){super(...arguments),this._regex=(t,n,r)=>this.refinement(i=>t.test(i),{validation:n,code:he.invalid_string,...rt.errToObj(r)}),this.nonempty=t=>this.min(1,rt.errToObj(t)),this.trim=()=>new Ya({...this._def,checks:[...this._def.checks,{kind:"trim"}]}),this.toLowerCase=()=>new Ya({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]}),this.toUpperCase=()=>new Ya({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==Re.string){const o=this._getOrReturnCtx(t);return Me(o,{code:he.invalid_type,expected:Re.string,received:o.parsedType}),yt}const r=new Ki;let i;for(const o of this._def.checks)if(o.kind==="min")t.data.lengtho.value&&(i=this._getOrReturnCtx(t,i),Me(i,{code:he.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),r.dirty());else if(o.kind==="length"){const a=t.data.length>o.value,s=t.data.length"u"?null:t==null?void 0:t.precision,offset:(n=t==null?void 0:t.offset)!==null&&n!==void 0?n:!1,...rt.errToObj(t==null?void 0:t.message)})}regex(t,n){return this._addCheck({kind:"regex",regex:t,...rt.errToObj(n)})}includes(t,n){return this._addCheck({kind:"includes",value:t,position:n==null?void 0:n.position,...rt.errToObj(n==null?void 0:n.message)})}startsWith(t,n){return this._addCheck({kind:"startsWith",value:t,...rt.errToObj(n)})}endsWith(t,n){return this._addCheck({kind:"endsWith",value:t,...rt.errToObj(n)})}min(t,n){return this._addCheck({kind:"min",value:t,...rt.errToObj(n)})}max(t,n){return this._addCheck({kind:"max",value:t,...rt.errToObj(n)})}length(t,n){return this._addCheck({kind:"length",value:t,...rt.errToObj(n)})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get minLength(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxLength(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value{var t;return new Ya({checks:[],typeName:st.ZodString,coerce:(t=e==null?void 0:e.coerce)!==null&&t!==void 0?t:!1,...xt(e)})};function Wae(e,t){const n=(e.toString().split(".")[1]||"").length,r=(t.toString().split(".")[1]||"").length,i=n>r?n:r,o=parseInt(e.toFixed(i).replace(".","")),a=parseInt(t.toFixed(i).replace(".",""));return o%a/Math.pow(10,i)}class rc extends Et{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==Re.number){const o=this._getOrReturnCtx(t);return Me(o,{code:he.invalid_type,expected:Re.number,received:o.parsedType}),yt}let r;const i=new Ki;for(const o of this._def.checks)o.kind==="int"?Xt.isInteger(t.data)||(r=this._getOrReturnCtx(t,r),Me(r,{code:he.invalid_type,expected:"integer",received:"float",message:o.message}),i.dirty()):o.kind==="min"?(o.inclusive?t.datao.value:t.data>=o.value)&&(r=this._getOrReturnCtx(t,r),Me(r,{code:he.too_big,maximum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),i.dirty()):o.kind==="multipleOf"?Wae(t.data,o.value)!==0&&(r=this._getOrReturnCtx(t,r),Me(r,{code:he.not_multiple_of,multipleOf:o.value,message:o.message}),i.dirty()):o.kind==="finite"?Number.isFinite(t.data)||(r=this._getOrReturnCtx(t,r),Me(r,{code:he.not_finite,message:o.message}),i.dirty()):Xt.assertNever(o);return{status:i.value,value:t.data}}gte(t,n){return this.setLimit("min",t,!0,rt.toString(n))}gt(t,n){return this.setLimit("min",t,!1,rt.toString(n))}lte(t,n){return this.setLimit("max",t,!0,rt.toString(n))}lt(t,n){return this.setLimit("max",t,!1,rt.toString(n))}setLimit(t,n,r,i){return new rc({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:rt.toString(i)}]})}_addCheck(t){return new rc({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:rt.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:rt.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:rt.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:rt.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:rt.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:rt.toString(n)})}finite(t){return this._addCheck({kind:"finite",message:rt.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:rt.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:rt.toString(t)})}get minValue(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.valuet.kind==="int"||t.kind==="multipleOf"&&Xt.isInteger(t.value))}get isFinite(){let t=null,n=null;for(const r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(n===null||r.value>n)&&(n=r.value):r.kind==="max"&&(t===null||r.valuenew rc({checks:[],typeName:st.ZodNumber,coerce:(e==null?void 0:e.coerce)||!1,...xt(e)});class ic extends Et{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce&&(t.data=BigInt(t.data)),this._getType(t)!==Re.bigint){const o=this._getOrReturnCtx(t);return Me(o,{code:he.invalid_type,expected:Re.bigint,received:o.parsedType}),yt}let r;const i=new Ki;for(const o of this._def.checks)o.kind==="min"?(o.inclusive?t.datao.value:t.data>=o.value)&&(r=this._getOrReturnCtx(t,r),Me(r,{code:he.too_big,type:"bigint",maximum:o.value,inclusive:o.inclusive,message:o.message}),i.dirty()):o.kind==="multipleOf"?t.data%o.value!==BigInt(0)&&(r=this._getOrReturnCtx(t,r),Me(r,{code:he.not_multiple_of,multipleOf:o.value,message:o.message}),i.dirty()):Xt.assertNever(o);return{status:i.value,value:t.data}}gte(t,n){return this.setLimit("min",t,!0,rt.toString(n))}gt(t,n){return this.setLimit("min",t,!1,rt.toString(n))}lte(t,n){return this.setLimit("max",t,!0,rt.toString(n))}lt(t,n){return this.setLimit("max",t,!1,rt.toString(n))}setLimit(t,n,r,i){return new ic({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:rt.toString(i)}]})}_addCheck(t){return new ic({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:rt.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:rt.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:rt.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:rt.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:rt.toString(n)})}get minValue(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value{var t;return new ic({checks:[],typeName:st.ZodBigInt,coerce:(t=e==null?void 0:e.coerce)!==null&&t!==void 0?t:!1,...xt(e)})};class Lm extends Et{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==Re.boolean){const r=this._getOrReturnCtx(t);return Me(r,{code:he.invalid_type,expected:Re.boolean,received:r.parsedType}),yt}return oo(t.data)}}Lm.create=e=>new Lm({typeName:st.ZodBoolean,coerce:(e==null?void 0:e.coerce)||!1,...xt(e)});class kd extends Et{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==Re.date){const o=this._getOrReturnCtx(t);return Me(o,{code:he.invalid_type,expected:Re.date,received:o.parsedType}),yt}if(isNaN(t.data.getTime())){const o=this._getOrReturnCtx(t);return Me(o,{code:he.invalid_date}),yt}const r=new Ki;let i;for(const o of this._def.checks)o.kind==="min"?t.data.getTime()o.value&&(i=this._getOrReturnCtx(t,i),Me(i,{code:he.too_big,message:o.message,inclusive:!0,exact:!1,maximum:o.value,type:"date"}),r.dirty()):Xt.assertNever(o);return{status:r.value,value:new Date(t.data.getTime())}}_addCheck(t){return new kd({...this._def,checks:[...this._def.checks,t]})}min(t,n){return this._addCheck({kind:"min",value:t.getTime(),message:rt.toString(n)})}max(t,n){return this._addCheck({kind:"max",value:t.getTime(),message:rt.toString(n)})}get minDate(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.valuenew kd({checks:[],coerce:(e==null?void 0:e.coerce)||!1,typeName:st.ZodDate,...xt(e)});class Qb extends Et{_parse(t){if(this._getType(t)!==Re.symbol){const r=this._getOrReturnCtx(t);return Me(r,{code:he.invalid_type,expected:Re.symbol,received:r.parsedType}),yt}return oo(t.data)}}Qb.create=e=>new Qb({typeName:st.ZodSymbol,...xt(e)});class Fm extends Et{_parse(t){if(this._getType(t)!==Re.undefined){const r=this._getOrReturnCtx(t);return Me(r,{code:he.invalid_type,expected:Re.undefined,received:r.parsedType}),yt}return oo(t.data)}}Fm.create=e=>new Fm({typeName:st.ZodUndefined,...xt(e)});class Bm extends Et{_parse(t){if(this._getType(t)!==Re.null){const r=this._getOrReturnCtx(t);return Me(r,{code:he.invalid_type,expected:Re.null,received:r.parsedType}),yt}return oo(t.data)}}Bm.create=e=>new Bm({typeName:st.ZodNull,...xt(e)});class Gh extends Et{constructor(){super(...arguments),this._any=!0}_parse(t){return oo(t.data)}}Gh.create=e=>new Gh({typeName:st.ZodAny,...xt(e)});class fd extends Et{constructor(){super(...arguments),this._unknown=!0}_parse(t){return oo(t.data)}}fd.create=e=>new fd({typeName:st.ZodUnknown,...xt(e)});class Gl extends Et{_parse(t){const n=this._getOrReturnCtx(t);return Me(n,{code:he.invalid_type,expected:Re.never,received:n.parsedType}),yt}}Gl.create=e=>new Gl({typeName:st.ZodNever,...xt(e)});class Xb extends Et{_parse(t){if(this._getType(t)!==Re.undefined){const r=this._getOrReturnCtx(t);return Me(r,{code:he.invalid_type,expected:Re.void,received:r.parsedType}),yt}return oo(t.data)}}Xb.create=e=>new Xb({typeName:st.ZodVoid,...xt(e)});class rs extends Et{_parse(t){const{ctx:n,status:r}=this._processInputParams(t),i=this._def;if(n.parsedType!==Re.array)return Me(n,{code:he.invalid_type,expected:Re.array,received:n.parsedType}),yt;if(i.exactLength!==null){const a=n.data.length>i.exactLength.value,s=n.data.lengthi.maxLength.value&&(Me(n,{code:he.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((a,s)=>i.type._parseAsync(new Ks(n,a,n.path,s)))).then(a=>Ki.mergeArray(r,a));const o=[...n.data].map((a,s)=>i.type._parseSync(new Ks(n,a,n.path,s)));return Ki.mergeArray(r,o)}get element(){return this._def.type}min(t,n){return new rs({...this._def,minLength:{value:t,message:rt.toString(n)}})}max(t,n){return new rs({...this._def,maxLength:{value:t,message:rt.toString(n)}})}length(t,n){return new rs({...this._def,exactLength:{value:t,message:rt.toString(n)}})}nonempty(t){return this.min(1,t)}}rs.create=(e,t)=>new rs({type:e,minLength:null,maxLength:null,exactLength:null,typeName:st.ZodArray,...xt(t)});function wf(e){if(e instanceof ar){const t={};for(const n in e.shape){const r=e.shape[n];t[n]=Ml.create(wf(r))}return new ar({...e._def,shape:()=>t})}else return e instanceof rs?new rs({...e._def,type:wf(e.element)}):e instanceof Ml?Ml.create(wf(e.unwrap())):e instanceof Ad?Ad.create(wf(e.unwrap())):e instanceof Qs?Qs.create(e.items.map(t=>wf(t))):e}class ar extends Et{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const t=this._def.shape(),n=Xt.objectKeys(t);return this._cached={shape:t,keys:n}}_parse(t){if(this._getType(t)!==Re.object){const u=this._getOrReturnCtx(t);return Me(u,{code:he.invalid_type,expected:Re.object,received:u.parsedType}),yt}const{status:r,ctx:i}=this._processInputParams(t),{shape:o,keys:a}=this._getCached(),s=[];if(!(this._def.catchall instanceof Gl&&this._def.unknownKeys==="strip"))for(const u in i.data)a.includes(u)||s.push(u);const l=[];for(const u of a){const c=o[u],d=i.data[u];l.push({key:{status:"valid",value:u},value:c._parse(new Ks(i,d,i.path,u)),alwaysSet:u in i.data})}if(this._def.catchall instanceof Gl){const u=this._def.unknownKeys;if(u==="passthrough")for(const c of s)l.push({key:{status:"valid",value:c},value:{status:"valid",value:i.data[c]}});else if(u==="strict")s.length>0&&(Me(i,{code:he.unrecognized_keys,keys:s}),r.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const u=this._def.catchall;for(const c of s){const d=i.data[c];l.push({key:{status:"valid",value:c},value:u._parse(new Ks(i,d,i.path,c)),alwaysSet:c in i.data})}}return i.common.async?Promise.resolve().then(async()=>{const u=[];for(const c of l){const d=await c.key;u.push({key:d,value:await c.value,alwaysSet:c.alwaysSet})}return u}).then(u=>Ki.mergeObjectSync(r,u)):Ki.mergeObjectSync(r,l)}get shape(){return this._def.shape()}strict(t){return rt.errToObj,new ar({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(n,r)=>{var i,o,a,s;const l=(a=(o=(i=this._def).errorMap)===null||o===void 0?void 0:o.call(i,n,r).message)!==null&&a!==void 0?a:r.defaultError;return n.code==="unrecognized_keys"?{message:(s=rt.errToObj(t).message)!==null&&s!==void 0?s:l}:{message:l}}}:{}})}strip(){return new ar({...this._def,unknownKeys:"strip"})}passthrough(){return new ar({...this._def,unknownKeys:"passthrough"})}extend(t){return new ar({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new ar({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:st.ZodObject})}setKey(t,n){return this.augment({[t]:n})}catchall(t){return new ar({...this._def,catchall:t})}pick(t){const n={};return Xt.objectKeys(t).forEach(r=>{t[r]&&this.shape[r]&&(n[r]=this.shape[r])}),new ar({...this._def,shape:()=>n})}omit(t){const n={};return Xt.objectKeys(this.shape).forEach(r=>{t[r]||(n[r]=this.shape[r])}),new ar({...this._def,shape:()=>n})}deepPartial(){return wf(this)}partial(t){const n={};return Xt.objectKeys(this.shape).forEach(r=>{const i=this.shape[r];t&&!t[r]?n[r]=i:n[r]=i.optional()}),new ar({...this._def,shape:()=>n})}required(t){const n={};return Xt.objectKeys(this.shape).forEach(r=>{if(t&&!t[r])n[r]=this.shape[r];else{let o=this.shape[r];for(;o instanceof Ml;)o=o._def.innerType;n[r]=o}}),new ar({...this._def,shape:()=>n})}keyof(){return fB(Xt.objectKeys(this.shape))}}ar.create=(e,t)=>new ar({shape:()=>e,unknownKeys:"strip",catchall:Gl.create(),typeName:st.ZodObject,...xt(t)});ar.strictCreate=(e,t)=>new ar({shape:()=>e,unknownKeys:"strict",catchall:Gl.create(),typeName:st.ZodObject,...xt(t)});ar.lazycreate=(e,t)=>new ar({shape:e,unknownKeys:"strip",catchall:Gl.create(),typeName:st.ZodObject,...xt(t)});class zm extends Et{_parse(t){const{ctx:n}=this._processInputParams(t),r=this._def.options;function i(o){for(const s of o)if(s.result.status==="valid")return s.result;for(const s of o)if(s.result.status==="dirty")return n.common.issues.push(...s.ctx.common.issues),s.result;const a=o.map(s=>new ns(s.ctx.common.issues));return Me(n,{code:he.invalid_union,unionErrors:a}),yt}if(n.common.async)return Promise.all(r.map(async o=>{const a={...n,common:{...n.common,issues:[]},parent:null};return{result:await o._parseAsync({data:n.data,path:n.path,parent:a}),ctx:a}})).then(i);{let o;const a=[];for(const l of r){const u={...n,common:{...n.common,issues:[]},parent:null},c=l._parseSync({data:n.data,path:n.path,parent:u});if(c.status==="valid")return c;c.status==="dirty"&&!o&&(o={result:c,ctx:u}),u.common.issues.length&&a.push(u.common.issues)}if(o)return n.common.issues.push(...o.ctx.common.issues),o.result;const s=a.map(l=>new ns(l));return Me(n,{code:he.invalid_union,unionErrors:s}),yt}}get options(){return this._def.options}}zm.create=(e,t)=>new zm({options:e,typeName:st.ZodUnion,...xt(t)});const M1=e=>e instanceof Vm?M1(e.schema):e instanceof ss?M1(e.innerType()):e instanceof Gm?[e.value]:e instanceof oc?e.options:e instanceof Hm?Object.keys(e.enum):e instanceof qm?M1(e._def.innerType):e instanceof Fm?[void 0]:e instanceof Bm?[null]:null;class KS extends Et{_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==Re.object)return Me(n,{code:he.invalid_type,expected:Re.object,received:n.parsedType}),yt;const r=this.discriminator,i=n.data[r],o=this.optionsMap.get(i);return o?n.common.async?o._parseAsync({data:n.data,path:n.path,parent:n}):o._parseSync({data:n.data,path:n.path,parent:n}):(Me(n,{code:he.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),yt)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,n,r){const i=new Map;for(const o of n){const a=M1(o.shape[t]);if(!a)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(const s of a){if(i.has(s))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(s)}`);i.set(s,o)}}return new KS({typeName:st.ZodDiscriminatedUnion,discriminator:t,options:n,optionsMap:i,...xt(r)})}}function nE(e,t){const n=wu(e),r=wu(t);if(e===t)return{valid:!0,data:e};if(n===Re.object&&r===Re.object){const i=Xt.objectKeys(t),o=Xt.objectKeys(e).filter(s=>i.indexOf(s)!==-1),a={...e,...t};for(const s of o){const l=nE(e[s],t[s]);if(!l.valid)return{valid:!1};a[s]=l.data}return{valid:!0,data:a}}else if(n===Re.array&&r===Re.array){if(e.length!==t.length)return{valid:!1};const i=[];for(let o=0;o{if(eE(o)||eE(a))return yt;const s=nE(o.value,a.value);return s.valid?((tE(o)||tE(a))&&n.dirty(),{status:n.value,value:s.data}):(Me(r,{code:he.invalid_intersection_types}),yt)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([o,a])=>i(o,a)):i(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}jm.create=(e,t,n)=>new jm({left:e,right:t,typeName:st.ZodIntersection,...xt(n)});class Qs extends Et{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==Re.array)return Me(r,{code:he.invalid_type,expected:Re.array,received:r.parsedType}),yt;if(r.data.lengththis._def.items.length&&(Me(r,{code:he.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());const o=[...r.data].map((a,s)=>{const l=this._def.items[s]||this._def.rest;return l?l._parse(new Ks(r,a,r.path,s)):null}).filter(a=>!!a);return r.common.async?Promise.all(o).then(a=>Ki.mergeArray(n,a)):Ki.mergeArray(n,o)}get items(){return this._def.items}rest(t){return new Qs({...this._def,rest:t})}}Qs.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Qs({items:e,typeName:st.ZodTuple,rest:null,...xt(t)})};class Um extends Et{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==Re.object)return Me(r,{code:he.invalid_type,expected:Re.object,received:r.parsedType}),yt;const i=[],o=this._def.keyType,a=this._def.valueType;for(const s in r.data)i.push({key:o._parse(new Ks(r,s,r.path,s)),value:a._parse(new Ks(r,r.data[s],r.path,s))});return r.common.async?Ki.mergeObjectAsync(n,i):Ki.mergeObjectSync(n,i)}get element(){return this._def.valueType}static create(t,n,r){return n instanceof Et?new Um({keyType:t,valueType:n,typeName:st.ZodRecord,...xt(r)}):new Um({keyType:Ya.create(),valueType:t,typeName:st.ZodRecord,...xt(n)})}}class Yb extends Et{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==Re.map)return Me(r,{code:he.invalid_type,expected:Re.map,received:r.parsedType}),yt;const i=this._def.keyType,o=this._def.valueType,a=[...r.data.entries()].map(([s,l],u)=>({key:i._parse(new Ks(r,s,r.path,[u,"key"])),value:o._parse(new Ks(r,l,r.path,[u,"value"]))}));if(r.common.async){const s=new Map;return Promise.resolve().then(async()=>{for(const l of a){const u=await l.key,c=await l.value;if(u.status==="aborted"||c.status==="aborted")return yt;(u.status==="dirty"||c.status==="dirty")&&n.dirty(),s.set(u.value,c.value)}return{status:n.value,value:s}})}else{const s=new Map;for(const l of a){const u=l.key,c=l.value;if(u.status==="aborted"||c.status==="aborted")return yt;(u.status==="dirty"||c.status==="dirty")&&n.dirty(),s.set(u.value,c.value)}return{status:n.value,value:s}}}}Yb.create=(e,t,n)=>new Yb({valueType:t,keyType:e,typeName:st.ZodMap,...xt(n)});class Td extends Et{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==Re.set)return Me(r,{code:he.invalid_type,expected:Re.set,received:r.parsedType}),yt;const i=this._def;i.minSize!==null&&r.data.sizei.maxSize.value&&(Me(r,{code:he.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),n.dirty());const o=this._def.valueType;function a(l){const u=new Set;for(const c of l){if(c.status==="aborted")return yt;c.status==="dirty"&&n.dirty(),u.add(c.value)}return{status:n.value,value:u}}const s=[...r.data.values()].map((l,u)=>o._parse(new Ks(r,l,r.path,u)));return r.common.async?Promise.all(s).then(l=>a(l)):a(s)}min(t,n){return new Td({...this._def,minSize:{value:t,message:rt.toString(n)}})}max(t,n){return new Td({...this._def,maxSize:{value:t,message:rt.toString(n)}})}size(t,n){return this.min(t,n).max(t,n)}nonempty(t){return this.min(1,t)}}Td.create=(e,t)=>new Td({valueType:e,minSize:null,maxSize:null,typeName:st.ZodSet,...xt(t)});class dh extends Et{constructor(){super(...arguments),this.validate=this.implement}_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==Re.function)return Me(n,{code:he.invalid_type,expected:Re.function,received:n.parsedType}),yt;function r(s,l){return Wb({data:s,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,qb(),$m].filter(u=>!!u),issueData:{code:he.invalid_arguments,argumentsError:l}})}function i(s,l){return Wb({data:s,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,qb(),$m].filter(u=>!!u),issueData:{code:he.invalid_return_type,returnTypeError:l}})}const o={errorMap:n.common.contextualErrorMap},a=n.data;if(this._def.returns instanceof Hh){const s=this;return oo(async function(...l){const u=new ns([]),c=await s._def.args.parseAsync(l,o).catch(h=>{throw u.addIssue(r(l,h)),u}),d=await Reflect.apply(a,this,c);return await s._def.returns._def.type.parseAsync(d,o).catch(h=>{throw u.addIssue(i(d,h)),u})})}else{const s=this;return oo(function(...l){const u=s._def.args.safeParse(l,o);if(!u.success)throw new ns([r(l,u.error)]);const c=Reflect.apply(a,this,u.data),d=s._def.returns.safeParse(c,o);if(!d.success)throw new ns([i(c,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new dh({...this._def,args:Qs.create(t).rest(fd.create())})}returns(t){return new dh({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,n,r){return new dh({args:t||Qs.create([]).rest(fd.create()),returns:n||fd.create(),typeName:st.ZodFunction,...xt(r)})}}class Vm extends Et{get schema(){return this._def.getter()}_parse(t){const{ctx:n}=this._processInputParams(t);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}}Vm.create=(e,t)=>new Vm({getter:e,typeName:st.ZodLazy,...xt(t)});class Gm extends Et{_parse(t){if(t.data!==this._def.value){const n=this._getOrReturnCtx(t);return Me(n,{received:n.data,code:he.invalid_literal,expected:this._def.value}),yt}return{status:"valid",value:t.data}}get value(){return this._def.value}}Gm.create=(e,t)=>new Gm({value:e,typeName:st.ZodLiteral,...xt(t)});function fB(e,t){return new oc({values:e,typeName:st.ZodEnum,...xt(t)})}class oc extends Et{_parse(t){if(typeof t.data!="string"){const n=this._getOrReturnCtx(t),r=this._def.values;return Me(n,{expected:Xt.joinValues(r),received:n.parsedType,code:he.invalid_type}),yt}if(this._def.values.indexOf(t.data)===-1){const n=this._getOrReturnCtx(t),r=this._def.values;return Me(n,{received:n.data,code:he.invalid_enum_value,options:r}),yt}return oo(t.data)}get options(){return this._def.values}get enum(){const t={};for(const n of this._def.values)t[n]=n;return t}get Values(){const t={};for(const n of this._def.values)t[n]=n;return t}get Enum(){const t={};for(const n of this._def.values)t[n]=n;return t}extract(t){return oc.create(t)}exclude(t){return oc.create(this.options.filter(n=>!t.includes(n)))}}oc.create=fB;class Hm extends Et{_parse(t){const n=Xt.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(t);if(r.parsedType!==Re.string&&r.parsedType!==Re.number){const i=Xt.objectValues(n);return Me(r,{expected:Xt.joinValues(i),received:r.parsedType,code:he.invalid_type}),yt}if(n.indexOf(t.data)===-1){const i=Xt.objectValues(n);return Me(r,{received:r.data,code:he.invalid_enum_value,options:i}),yt}return oo(t.data)}get enum(){return this._def.values}}Hm.create=(e,t)=>new Hm({values:e,typeName:st.ZodNativeEnum,...xt(t)});class Hh extends Et{unwrap(){return this._def.type}_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==Re.promise&&n.common.async===!1)return Me(n,{code:he.invalid_type,expected:Re.promise,received:n.parsedType}),yt;const r=n.parsedType===Re.promise?n.data:Promise.resolve(n.data);return oo(r.then(i=>this._def.type.parseAsync(i,{path:n.path,errorMap:n.common.contextualErrorMap})))}}Hh.create=(e,t)=>new Hh({type:e,typeName:st.ZodPromise,...xt(t)});class ss extends Et{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===st.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){const{status:n,ctx:r}=this._processInputParams(t),i=this._def.effect||null,o={addIssue:a=>{Me(r,a),a.fatal?n.abort():n.dirty()},get path(){return r.path}};if(o.addIssue=o.addIssue.bind(o),i.type==="preprocess"){const a=i.transform(r.data,o);return r.common.issues.length?{status:"dirty",value:r.data}:r.common.async?Promise.resolve(a).then(s=>this._def.schema._parseAsync({data:s,path:r.path,parent:r})):this._def.schema._parseSync({data:a,path:r.path,parent:r})}if(i.type==="refinement"){const a=s=>{const l=i.refinement(s,o);if(r.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return s};if(r.common.async===!1){const s=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?yt:(s.status==="dirty"&&n.dirty(),a(s.value),{status:n.value,value:s.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(s=>s.status==="aborted"?yt:(s.status==="dirty"&&n.dirty(),a(s.value).then(()=>({status:n.value,value:s.value}))))}if(i.type==="transform")if(r.common.async===!1){const a=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!Dm(a))return a;const s=i.transform(a.value,o);if(s instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:s}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(a=>Dm(a)?Promise.resolve(i.transform(a.value,o)).then(s=>({status:n.value,value:s})):a);Xt.assertNever(i)}}ss.create=(e,t,n)=>new ss({schema:e,typeName:st.ZodEffects,effect:t,...xt(n)});ss.createWithPreprocess=(e,t,n)=>new ss({schema:t,effect:{type:"preprocess",transform:e},typeName:st.ZodEffects,...xt(n)});class Ml extends Et{_parse(t){return this._getType(t)===Re.undefined?oo(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}Ml.create=(e,t)=>new Ml({innerType:e,typeName:st.ZodOptional,...xt(t)});class Ad extends Et{_parse(t){return this._getType(t)===Re.null?oo(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}Ad.create=(e,t)=>new Ad({innerType:e,typeName:st.ZodNullable,...xt(t)});class qm extends Et{_parse(t){const{ctx:n}=this._processInputParams(t);let r=n.data;return n.parsedType===Re.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}}qm.create=(e,t)=>new qm({innerType:e,typeName:st.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...xt(t)});class Zb extends Et{_parse(t){const{ctx:n}=this._processInputParams(t),r={...n,common:{...n.common,issues:[]}},i=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return Kb(i)?i.then(o=>({status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new ns(r.common.issues)},input:r.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new ns(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}Zb.create=(e,t)=>new Zb({innerType:e,typeName:st.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...xt(t)});class Jb extends Et{_parse(t){if(this._getType(t)!==Re.nan){const r=this._getOrReturnCtx(t);return Me(r,{code:he.invalid_type,expected:Re.nan,received:r.parsedType}),yt}return{status:"valid",value:t.data}}}Jb.create=e=>new Jb({typeName:st.ZodNaN,...xt(e)});const Kae=Symbol("zod_brand");class hB extends Et{_parse(t){const{ctx:n}=this._processInputParams(t),r=n.data;return this._def.type._parse({data:r,path:n.path,parent:n})}unwrap(){return this._def.type}}class sy extends Et{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.common.async)return(async()=>{const o=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return o.status==="aborted"?yt:o.status==="dirty"?(n.dirty(),dB(o.value)):this._def.out._parseAsync({data:o.value,path:r.path,parent:r})})();{const i=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return i.status==="aborted"?yt:i.status==="dirty"?(n.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:r.path,parent:r})}}static create(t,n){return new sy({in:t,out:n,typeName:st.ZodPipeline})}}class e_ extends Et{_parse(t){const n=this._def.innerType._parse(t);return Dm(n)&&(n.value=Object.freeze(n.value)),n}}e_.create=(e,t)=>new e_({innerType:e,typeName:st.ZodReadonly,...xt(t)});const pB=(e,t={},n)=>e?Gh.create().superRefine((r,i)=>{var o,a;if(!e(r)){const s=typeof t=="function"?t(r):typeof t=="string"?{message:t}:t,l=(a=(o=s.fatal)!==null&&o!==void 0?o:n)!==null&&a!==void 0?a:!0,u=typeof s=="string"?{message:s}:s;i.addIssue({code:"custom",...u,fatal:l})}}):Gh.create(),Qae={object:ar.lazycreate};var st;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(st||(st={}));const Xae=(e,t={message:`Input not instance of ${e.name}`})=>pB(n=>n instanceof e,t),gB=Ya.create,mB=rc.create,Yae=Jb.create,Zae=ic.create,yB=Lm.create,Jae=kd.create,ese=Qb.create,tse=Fm.create,nse=Bm.create,rse=Gh.create,ise=fd.create,ose=Gl.create,ase=Xb.create,sse=rs.create,lse=ar.create,use=ar.strictCreate,cse=zm.create,dse=KS.create,fse=jm.create,hse=Qs.create,pse=Um.create,gse=Yb.create,mse=Td.create,yse=dh.create,vse=Vm.create,bse=Gm.create,_se=oc.create,Sse=Hm.create,xse=Hh.create,Y8=ss.create,wse=Ml.create,Cse=Ad.create,Ese=ss.createWithPreprocess,kse=sy.create,Tse=()=>gB().optional(),Ase=()=>mB().optional(),Pse=()=>yB().optional(),Ise={string:e=>Ya.create({...e,coerce:!0}),number:e=>rc.create({...e,coerce:!0}),boolean:e=>Lm.create({...e,coerce:!0}),bigint:e=>ic.create({...e,coerce:!0}),date:e=>kd.create({...e,coerce:!0})},Rse=yt;var z=Object.freeze({__proto__:null,defaultErrorMap:$m,setErrorMap:$ae,getErrorMap:qb,makeIssue:Wb,EMPTY_PATH:Dae,addIssueToContext:Me,ParseStatus:Ki,INVALID:yt,DIRTY:dB,OK:oo,isAborted:eE,isDirty:tE,isValid:Dm,isAsync:Kb,get util(){return Xt},get objectUtil(){return J3},ZodParsedType:Re,getParsedType:wu,ZodType:Et,ZodString:Ya,ZodNumber:rc,ZodBigInt:ic,ZodBoolean:Lm,ZodDate:kd,ZodSymbol:Qb,ZodUndefined:Fm,ZodNull:Bm,ZodAny:Gh,ZodUnknown:fd,ZodNever:Gl,ZodVoid:Xb,ZodArray:rs,ZodObject:ar,ZodUnion:zm,ZodDiscriminatedUnion:KS,ZodIntersection:jm,ZodTuple:Qs,ZodRecord:Um,ZodMap:Yb,ZodSet:Td,ZodFunction:dh,ZodLazy:Vm,ZodLiteral:Gm,ZodEnum:oc,ZodNativeEnum:Hm,ZodPromise:Hh,ZodEffects:ss,ZodTransformer:ss,ZodOptional:Ml,ZodNullable:Ad,ZodDefault:qm,ZodCatch:Zb,ZodNaN:Jb,BRAND:Kae,ZodBranded:hB,ZodPipeline:sy,ZodReadonly:e_,custom:pB,Schema:Et,ZodSchema:Et,late:Qae,get ZodFirstPartyTypeKind(){return st},coerce:Ise,any:rse,array:sse,bigint:Zae,boolean:yB,date:Jae,discriminatedUnion:dse,effect:Y8,enum:_se,function:yse,instanceof:Xae,intersection:fse,lazy:vse,literal:bse,map:gse,nan:Yae,nativeEnum:Sse,never:ose,null:nse,nullable:Cse,number:mB,object:lse,oboolean:Pse,onumber:Ase,optional:wse,ostring:Tse,pipeline:kse,preprocess:Ese,promise:xse,record:pse,set:mse,strictObject:use,string:gB,symbol:ese,transformer:Y8,tuple:hse,undefined:tse,union:cse,unknown:ise,void:ase,NEVER:Rse,ZodIssueCode:he,quotelessJson:Nae,ZodError:ns});const Ose=z.string(),Hje=e=>Ose.safeParse(e).success,Mse=z.string(),qje=e=>Mse.safeParse(e).success,Nse=z.string(),Wje=e=>Nse.safeParse(e).success,$se=z.string(),Kje=e=>$se.safeParse(e).success,Dse=z.number().int().min(1),Qje=e=>Dse.safeParse(e).success,Lse=z.number().min(1),Xje=e=>Lse.safeParse(e).success,vB=z.enum(["euler","deis","ddim","ddpm","dpmpp_2s","dpmpp_2m","dpmpp_2m_sde","dpmpp_sde","heun","kdpm_2","lms","pndm","unipc","euler_k","dpmpp_2s_k","dpmpp_2m_k","dpmpp_2m_sde_k","dpmpp_sde_k","heun_k","lms_k","euler_a","kdpm_2_a"]),Yje=e=>vB.safeParse(e).success,Zje={euler:"Euler",deis:"DEIS",ddim:"DDIM",ddpm:"DDPM",dpmpp_sde:"DPM++ SDE",dpmpp_2s:"DPM++ 2S",dpmpp_2m:"DPM++ 2M",dpmpp_2m_sde:"DPM++ 2M SDE",heun:"Heun",kdpm_2:"KDPM 2",lms:"LMS",pndm:"PNDM",unipc:"UniPC",euler_k:"Euler Karras",dpmpp_sde_k:"DPM++ SDE Karras",dpmpp_2s_k:"DPM++ 2S Karras",dpmpp_2m_k:"DPM++ 2M Karras",dpmpp_2m_sde_k:"DPM++ 2M SDE Karras",heun_k:"Heun Karras",lms_k:"LMS Karras",euler_a:"Euler Ancestral",kdpm_2_a:"KDPM 2 Ancestral"},Fse=z.number().int().min(0).max(Gg),Jje=e=>Fse.safeParse(e).success,Bse=z.number().multipleOf(8).min(64),eUe=e=>Bse.safeParse(e).success,zse=z.number().multipleOf(8).min(64),tUe=e=>zse.safeParse(e).success,jd=z.enum(["any","sd-1","sd-2","sdxl","sdxl-refiner"]),QS=z.object({model_name:z.string().min(1),base_model:jd,model_type:z.literal("main")}),nUe=e=>QS.safeParse(e).success,fT=z.object({model_name:z.string().min(1),base_model:z.literal("sdxl-refiner"),model_type:z.literal("main")}),rUe=e=>fT.safeParse(e).success,bB=z.object({model_name:z.string().min(1),base_model:jd,model_type:z.literal("onnx")}),ly=z.union([QS,bB]),jse=z.object({model_name:z.string().min(1),base_model:jd}),Use=z.object({model_name:z.string().min(1),base_model:jd}),iUe=e=>Use.safeParse(e).success,Vse=z.object({model_name:z.string().min(1),base_model:jd}),oUe=e=>Vse.safeParse(e).success,Gse=z.object({model_name:z.string().min(1),base_model:jd}),aUe=e=>Gse.safeParse(e).success,Hse=z.number().min(0).max(1),sUe=e=>Hse.safeParse(e).success;z.enum(["fp16","fp32"]);const qse=z.number().min(1).max(10),lUe=e=>qse.safeParse(e).success,Wse=z.number().min(1).max(10),uUe=e=>Wse.safeParse(e).success,Kse=z.number().min(0).max(1),cUe=e=>Kse.safeParse(e).success;z.enum(["box","gaussian"]);z.enum(["unmasked","mask","edge"]);const hT={cfgScale:7.5,height:512,img2imgStrength:.75,infillMethod:"patchmatch",iterations:1,perlin:0,positivePrompt:"",negativePrompt:"",scheduler:"euler",maskBlur:16,maskBlurMethod:"box",canvasCoherenceMode:"unmasked",canvasCoherenceSteps:20,canvasCoherenceStrength:.3,seed:0,seedWeights:"",shouldFitToWidthHeight:!0,shouldGenerateVariations:!1,shouldRandomizeSeed:!0,steps:50,threshold:0,infillTileSize:32,infillPatchmatchDownscaleSize:1,variationAmount:.1,width:512,shouldUseSymmetry:!1,horizontalSymmetrySteps:0,verticalSymmetrySteps:0,model:null,vae:null,vaePrecision:"fp32",seamlessXAxis:!1,seamlessYAxis:!1,clipSkip:0,shouldUseCpuNoise:!0,shouldShowAdvancedOptions:!1,aspectRatio:null,shouldLockAspectRatio:!1},Qse=hT,_B=nr({name:"generation",initialState:Qse,reducers:{setPositivePrompt:(e,t)=>{e.positivePrompt=t.payload},setNegativePrompt:(e,t)=>{e.negativePrompt=t.payload},setIterations:(e,t)=>{e.iterations=t.payload},setSteps:(e,t)=>{e.steps=t.payload},clampSymmetrySteps:e=>{e.horizontalSymmetrySteps=Ru(e.horizontalSymmetrySteps,0,e.steps),e.verticalSymmetrySteps=Ru(e.verticalSymmetrySteps,0,e.steps)},setCfgScale:(e,t)=>{e.cfgScale=t.payload},setThreshold:(e,t)=>{e.threshold=t.payload},setPerlin:(e,t)=>{e.perlin=t.payload},setHeight:(e,t)=>{e.height=t.payload},setWidth:(e,t)=>{e.width=t.payload},toggleSize:e=>{const[t,n]=[e.width,e.height];e.width=n,e.height=t},setScheduler:(e,t)=>{e.scheduler=t.payload},setSeed:(e,t)=>{e.seed=t.payload,e.shouldRandomizeSeed=!1},setImg2imgStrength:(e,t)=>{e.img2imgStrength=t.payload},setSeamlessXAxis:(e,t)=>{e.seamlessXAxis=t.payload},setSeamlessYAxis:(e,t)=>{e.seamlessYAxis=t.payload},setShouldFitToWidthHeight:(e,t)=>{e.shouldFitToWidthHeight=t.payload},resetSeed:e=>{e.seed=-1},setShouldGenerateVariations:(e,t)=>{e.shouldGenerateVariations=t.payload},setVariationAmount:(e,t)=>{e.variationAmount=t.payload},setSeedWeights:(e,t)=>{e.seedWeights=t.payload,e.shouldGenerateVariations=!0,e.variationAmount=0},resetParametersState:e=>({...e,...hT}),setShouldRandomizeSeed:(e,t)=>{e.shouldRandomizeSeed=t.payload},clearInitialImage:e=>{e.initialImage=void 0},setMaskBlur:(e,t)=>{e.maskBlur=t.payload},setMaskBlurMethod:(e,t)=>{e.maskBlurMethod=t.payload},setCanvasCoherenceMode:(e,t)=>{e.canvasCoherenceMode=t.payload},setCanvasCoherenceSteps:(e,t)=>{e.canvasCoherenceSteps=t.payload},setCanvasCoherenceStrength:(e,t)=>{e.canvasCoherenceStrength=t.payload},setInfillMethod:(e,t)=>{e.infillMethod=t.payload},setInfillTileSize:(e,t)=>{e.infillTileSize=t.payload},setInfillPatchmatchDownscaleSize:(e,t)=>{e.infillPatchmatchDownscaleSize=t.payload},setShouldUseSymmetry:(e,t)=>{e.shouldUseSymmetry=t.payload},setHorizontalSymmetrySteps:(e,t)=>{e.horizontalSymmetrySteps=t.payload},setVerticalSymmetrySteps:(e,t)=>{e.verticalSymmetrySteps=t.payload},initialImageChanged:(e,t)=>{const{image_name:n,width:r,height:i}=t.payload;e.initialImage={imageName:n,width:r,height:i}},modelChanged:(e,t)=>{if(e.model=t.payload,e.model===null)return;const{maxClip:n}=Oae[e.model.base_model];e.clipSkip=Ru(e.clipSkip,0,n)},vaeSelected:(e,t)=>{e.vae=t.payload},vaePrecisionChanged:(e,t)=>{e.vaePrecision=t.payload},setClipSkip:(e,t)=>{e.clipSkip=t.payload},shouldUseCpuNoiseChanged:(e,t)=>{e.shouldUseCpuNoise=t.payload},setAspectRatio:(e,t)=>{const n=t.payload;e.aspectRatio=n,n&&(e.height=qa(e.width/n,8))},setShouldLockAspectRatio:(e,t)=>{e.shouldLockAspectRatio=t.payload}},extraReducers:e=>{e.addCase(Iae,(t,n)=>{var i;const r=(i=n.payload.sd)==null?void 0:i.defaultModel;if(r&&!t.model){const[o,a,s]=r.split("/"),l=QS.safeParse({model_name:s,base_model:o,model_type:a});l.success&&(t.model=l.data)}})}}),{clampSymmetrySteps:dUe,clearInitialImage:pT,resetParametersState:fUe,resetSeed:hUe,setCfgScale:pUe,setWidth:Z8,setHeight:J8,toggleSize:gUe,setImg2imgStrength:mUe,setInfillMethod:Xse,setIterations:yUe,setPerlin:vUe,setPositivePrompt:Yse,setNegativePrompt:bUe,setScheduler:_Ue,setMaskBlur:SUe,setMaskBlurMethod:xUe,setCanvasCoherenceMode:wUe,setCanvasCoherenceSteps:CUe,setCanvasCoherenceStrength:EUe,setSeed:kUe,setSeedWeights:TUe,setShouldFitToWidthHeight:AUe,setShouldGenerateVariations:PUe,setShouldRandomizeSeed:IUe,setSteps:RUe,setThreshold:OUe,setInfillTileSize:MUe,setInfillPatchmatchDownscaleSize:NUe,setVariationAmount:$Ue,setShouldUseSymmetry:DUe,setHorizontalSymmetrySteps:LUe,setVerticalSymmetrySteps:FUe,initialImageChanged:XS,modelChanged:Ou,vaeSelected:SB,setSeamlessXAxis:BUe,setSeamlessYAxis:zUe,setClipSkip:jUe,shouldUseCpuNoiseChanged:UUe,setAspectRatio:Zse,setShouldLockAspectRatio:VUe,vaePrecisionChanged:GUe}=_B.actions,Jse=_B.reducer,uv=(e,t,n,r,i,o,a)=>{const s=Math.floor(e/2-(n+i/2)*a),l=Math.floor(t/2-(r+o/2)*a);return{x:s,y:l}},cv=(e,t,n,r,i=.95)=>{const o=e*i/n,a=t*i/r,s=Math.min(1,Math.min(o,a));return s||1},HUe=.999,qUe=.1,WUe=20,dv=.95,KUe=30,QUe=10,ele=e=>({x:Math.floor(e.x),y:Math.floor(e.y)}),af=e=>{const{width:t,height:n}=e,r={width:t,height:n},i=512*512,o=t/n;let a=t*n,s=448;for(;a1?(r.width=s,r.height=qa(s/o,64)):o<1&&(r.height=s,r.width=qa(s*o,64)),a=r.width*r.height;return r},tle=e=>({width:qa(e.width,64),height:qa(e.height,64)}),XUe=[{label:"Base",value:"base"},{label:"Mask",value:"mask"}],YUe=[{label:"None",value:"none"},{label:"Auto",value:"auto"},{label:"Manual",value:"manual"}],xB=e=>e.kind==="line"&&e.layer==="mask",ZUe=e=>e.kind==="line"&&e.layer==="base",nle=e=>e.kind==="image"&&e.layer==="base",JUe=e=>e.kind==="fillRect"&&e.layer==="base",eVe=e=>e.kind==="eraseRect"&&e.layer==="base",rle=e=>e.kind==="line",mg={objects:[],stagingArea:{images:[],selectedImageIndex:-1}},wB={boundingBoxCoordinates:{x:0,y:0},boundingBoxDimensions:{width:512,height:512},boundingBoxPreviewFill:{r:0,g:0,b:0,a:.5},boundingBoxScaleMethod:"none",brushColor:{r:90,g:90,b:255,a:1},brushSize:50,colorPickerColor:{r:90,g:90,b:255,a:1},cursorPosition:null,futureLayerStates:[],isDrawing:!1,isMaskEnabled:!0,isMouseOverBoundingBox:!1,isMoveBoundingBoxKeyHeld:!1,isMoveStageKeyHeld:!1,isMovingBoundingBox:!1,isMovingStage:!1,isTransformingBoundingBox:!1,layer:"base",layerState:mg,maskColor:{r:255,g:90,b:90,a:1},maxHistory:128,minimumStageScale:1,pastLayerStates:[],scaledBoundingBoxDimensions:{width:512,height:512},shouldAntialias:!0,shouldAutoSave:!1,shouldCropToBoundingBoxOnSave:!1,shouldDarkenOutsideBoundingBox:!1,shouldLockBoundingBox:!1,shouldPreserveMaskedArea:!1,shouldRestrictStrokesToBox:!0,shouldShowBoundingBox:!0,shouldShowBrush:!0,shouldShowBrushPreview:!1,shouldShowCanvasDebugInfo:!1,shouldShowCheckboardTransparency:!1,shouldShowGrid:!0,shouldShowIntermediates:!0,shouldShowStagingImage:!0,shouldShowStagingOutline:!0,shouldSnapToGrid:!0,stageCoordinates:{x:0,y:0},stageDimensions:{width:0,height:0},stageScale:1,tool:"brush",batchIds:[]},CB=nr({name:"canvas",initialState:wB,reducers:{setTool:(e,t)=>{const n=t.payload;e.tool=t.payload,n!=="move"&&(e.isTransformingBoundingBox=!1,e.isMouseOverBoundingBox=!1,e.isMovingBoundingBox=!1,e.isMovingStage=!1)},setLayer:(e,t)=>{e.layer=t.payload},toggleTool:e=>{const t=e.tool;t!=="move"&&(e.tool=t==="brush"?"eraser":"brush")},setMaskColor:(e,t)=>{e.maskColor=t.payload},setBrushColor:(e,t)=>{e.brushColor=t.payload},setBrushSize:(e,t)=>{e.brushSize=t.payload},clearMask:e=>{e.pastLayerStates.push(wn(e.layerState)),e.layerState.objects=e.layerState.objects.filter(t=>!xB(t)),e.futureLayerStates=[],e.shouldPreserveMaskedArea=!1},toggleShouldInvertMask:e=>{e.shouldPreserveMaskedArea=!e.shouldPreserveMaskedArea},toggleShouldShowMask:e=>{e.isMaskEnabled=!e.isMaskEnabled},setShouldPreserveMaskedArea:(e,t)=>{e.shouldPreserveMaskedArea=t.payload},setIsMaskEnabled:(e,t)=>{e.isMaskEnabled=t.payload,e.layer=t.payload?"mask":"base"},setShouldShowCheckboardTransparency:(e,t)=>{e.shouldShowCheckboardTransparency=t.payload},setShouldShowBrushPreview:(e,t)=>{e.shouldShowBrushPreview=t.payload},setShouldShowBrush:(e,t)=>{e.shouldShowBrush=t.payload},setCursorPosition:(e,t)=>{e.cursorPosition=t.payload},setInitialCanvasImage:(e,t)=>{const n=t.payload,{width:r,height:i}=n,{stageDimensions:o}=e,a={width:sv(Ru(r,64,512),64),height:sv(Ru(i,64,512),64)},s={x:qa(r/2-a.width/2,64),y:qa(i/2-a.height/2,64)};if(e.boundingBoxScaleMethod==="auto"){const c=af(a);e.scaledBoundingBoxDimensions=c}e.boundingBoxDimensions=a,e.boundingBoxCoordinates=s,e.pastLayerStates.push(wn(e.layerState)),e.layerState={...wn(mg),objects:[{kind:"image",layer:"base",x:0,y:0,width:r,height:i,imageName:n.image_name}]},e.futureLayerStates=[],e.batchIds=[];const l=cv(o.width,o.height,r,i,dv),u=uv(o.width,o.height,0,0,r,i,l);e.stageScale=l,e.stageCoordinates=u},setBoundingBoxDimensions:(e,t)=>{const n=tle(t.payload);if(e.boundingBoxDimensions=n,e.boundingBoxScaleMethod==="auto"){const r=af(n);e.scaledBoundingBoxDimensions=r}},flipBoundingBoxAxes:e=>{const[t,n]=[e.boundingBoxDimensions.width,e.boundingBoxDimensions.height],[r,i]=[e.scaledBoundingBoxDimensions.width,e.scaledBoundingBoxDimensions.height];e.boundingBoxDimensions={width:n,height:t},e.scaledBoundingBoxDimensions={width:i,height:r}},setBoundingBoxCoordinates:(e,t)=>{e.boundingBoxCoordinates=ele(t.payload)},setStageCoordinates:(e,t)=>{e.stageCoordinates=t.payload},setBoundingBoxPreviewFill:(e,t)=>{e.boundingBoxPreviewFill=t.payload},setStageScale:(e,t)=>{e.stageScale=t.payload},setShouldDarkenOutsideBoundingBox:(e,t)=>{e.shouldDarkenOutsideBoundingBox=t.payload},setIsDrawing:(e,t)=>{e.isDrawing=t.payload},clearCanvasHistory:e=>{e.pastLayerStates=[],e.futureLayerStates=[]},setShouldLockBoundingBox:(e,t)=>{e.shouldLockBoundingBox=t.payload},toggleShouldLockBoundingBox:e=>{e.shouldLockBoundingBox=!e.shouldLockBoundingBox},setShouldShowBoundingBox:(e,t)=>{e.shouldShowBoundingBox=t.payload},setIsTransformingBoundingBox:(e,t)=>{e.isTransformingBoundingBox=t.payload},setIsMovingBoundingBox:(e,t)=>{e.isMovingBoundingBox=t.payload},setIsMouseOverBoundingBox:(e,t)=>{e.isMouseOverBoundingBox=t.payload},setIsMoveBoundingBoxKeyHeld:(e,t)=>{e.isMoveBoundingBoxKeyHeld=t.payload},setIsMoveStageKeyHeld:(e,t)=>{e.isMoveStageKeyHeld=t.payload},canvasBatchIdAdded:(e,t)=>{e.batchIds.push(t.payload)},canvasBatchIdsReset:e=>{e.batchIds=[]},stagingAreaInitialized:(e,t)=>{const{boundingBox:n}=t.payload;e.layerState.stagingArea={boundingBox:n,images:[],selectedImageIndex:-1}},addImageToStagingArea:(e,t)=>{const n=t.payload;!n||!e.layerState.stagingArea.boundingBox||(e.pastLayerStates.push(wn(e.layerState)),e.pastLayerStates.length>e.maxHistory&&e.pastLayerStates.shift(),e.layerState.stagingArea.images.push({kind:"image",layer:"base",...e.layerState.stagingArea.boundingBox,imageName:n.image_name}),e.layerState.stagingArea.selectedImageIndex=e.layerState.stagingArea.images.length-1,e.futureLayerStates=[])},discardStagedImages:e=>{e.pastLayerStates.push(wn(e.layerState)),e.pastLayerStates.length>e.maxHistory&&e.pastLayerStates.shift(),e.layerState.stagingArea=wn(wn(mg)).stagingArea,e.futureLayerStates=[],e.shouldShowStagingOutline=!0,e.shouldShowStagingImage=!0,e.batchIds=[]},addFillRect:e=>{const{boundingBoxCoordinates:t,boundingBoxDimensions:n,brushColor:r}=e;e.pastLayerStates.push(wn(e.layerState)),e.pastLayerStates.length>e.maxHistory&&e.pastLayerStates.shift(),e.layerState.objects.push({kind:"fillRect",layer:"base",...t,...n,color:r}),e.futureLayerStates=[]},addEraseRect:e=>{const{boundingBoxCoordinates:t,boundingBoxDimensions:n}=e;e.pastLayerStates.push(wn(e.layerState)),e.pastLayerStates.length>e.maxHistory&&e.pastLayerStates.shift(),e.layerState.objects.push({kind:"eraseRect",layer:"base",...t,...n}),e.futureLayerStates=[]},addLine:(e,t)=>{const{tool:n,layer:r,brushColor:i,brushSize:o,shouldRestrictStrokesToBox:a}=e;if(n==="move"||n==="colorPicker")return;const s=o/2,l=r==="base"&&n==="brush"?{color:i}:{};e.pastLayerStates.push(wn(e.layerState)),e.pastLayerStates.length>e.maxHistory&&e.pastLayerStates.shift();const u={kind:"line",layer:r,tool:n,strokeWidth:s,points:t.payload,...l};a&&(u.clip={...e.boundingBoxCoordinates,...e.boundingBoxDimensions}),e.layerState.objects.push(u),e.futureLayerStates=[]},addPointToCurrentLine:(e,t)=>{const n=e.layerState.objects.findLast(rle);n&&n.points.push(...t.payload)},undo:e=>{const t=e.pastLayerStates.pop();t&&(e.futureLayerStates.unshift(wn(e.layerState)),e.futureLayerStates.length>e.maxHistory&&e.futureLayerStates.pop(),e.layerState=t)},redo:e=>{const t=e.futureLayerStates.shift();t&&(e.pastLayerStates.push(wn(e.layerState)),e.pastLayerStates.length>e.maxHistory&&e.pastLayerStates.shift(),e.layerState=t)},setShouldShowGrid:(e,t)=>{e.shouldShowGrid=t.payload},setIsMovingStage:(e,t)=>{e.isMovingStage=t.payload},setShouldSnapToGrid:(e,t)=>{e.shouldSnapToGrid=t.payload},setShouldAutoSave:(e,t)=>{e.shouldAutoSave=t.payload},setShouldShowIntermediates:(e,t)=>{e.shouldShowIntermediates=t.payload},resetCanvas:e=>{e.pastLayerStates.push(wn(e.layerState)),e.layerState=wn(mg),e.futureLayerStates=[],e.batchIds=[]},canvasResized:(e,t)=>{const{width:n,height:r}=t.payload,i={width:Math.floor(n),height:Math.floor(r)};if(e.stageDimensions=i,!e.layerState.objects.find(nle)){const o=cv(i.width,i.height,512,512,dv),a=uv(i.width,i.height,0,0,512,512,o),s={width:512,height:512};if(e.stageScale=o,e.stageCoordinates=a,e.boundingBoxCoordinates={x:0,y:0},e.boundingBoxDimensions=s,e.boundingBoxScaleMethod==="auto"){const l=af(s);e.scaledBoundingBoxDimensions=l}}},resetCanvasView:(e,t)=>{const{contentRect:n,shouldScaleTo1:r}=t.payload,{stageDimensions:{width:i,height:o}}=e,{x:a,y:s,width:l,height:u}=n;if(l!==0&&u!==0){const c=r?1:cv(i,o,l,u,dv),d=uv(i,o,a,s,l,u,c);e.stageScale=c,e.stageCoordinates=d}else{const c=cv(i,o,512,512,dv),d=uv(i,o,0,0,512,512,c),f={width:512,height:512};if(e.stageScale=c,e.stageCoordinates=d,e.boundingBoxCoordinates={x:0,y:0},e.boundingBoxDimensions=f,e.boundingBoxScaleMethod==="auto"){const h=af(f);e.scaledBoundingBoxDimensions=h}}},nextStagingAreaImage:e=>{if(!e.layerState.stagingArea.images.length)return;const t=e.layerState.stagingArea.selectedImageIndex+1,n=e.layerState.stagingArea.images.length-1;e.layerState.stagingArea.selectedImageIndex=t>n?0:t},prevStagingAreaImage:e=>{if(!e.layerState.stagingArea.images.length)return;const t=e.layerState.stagingArea.selectedImageIndex-1,n=e.layerState.stagingArea.images.length-1;e.layerState.stagingArea.selectedImageIndex=t<0?n:t},commitStagingAreaImage:e=>{if(!e.layerState.stagingArea.images.length)return;const{images:t,selectedImageIndex:n}=e.layerState.stagingArea;e.pastLayerStates.push(wn(e.layerState)),e.pastLayerStates.length>e.maxHistory&&e.pastLayerStates.shift();const r=t[n];r&&e.layerState.objects.push({...r}),e.layerState.stagingArea=wn(mg).stagingArea,e.futureLayerStates=[],e.shouldShowStagingOutline=!0,e.shouldShowStagingImage=!0,e.batchIds=[]},fitBoundingBoxToStage:e=>{const{boundingBoxDimensions:t,boundingBoxCoordinates:n,stageDimensions:r,stageScale:i}=e,o=r.width/i,a=r.height/i;if(n.x<0||n.x+t.width>o||n.y<0||n.y+t.height>a){const s={width:sv(Ru(o,64,512),64),height:sv(Ru(a,64,512),64)},l={x:qa(o/2-s.width/2,64),y:qa(a/2-s.height/2,64)};if(e.boundingBoxDimensions=s,e.boundingBoxCoordinates=l,e.boundingBoxScaleMethod==="auto"){const u=af(s);e.scaledBoundingBoxDimensions=u}}},setBoundingBoxScaleMethod:(e,t)=>{if(e.boundingBoxScaleMethod=t.payload,t.payload==="auto"){const n=af(e.boundingBoxDimensions);e.scaledBoundingBoxDimensions=n}},setScaledBoundingBoxDimensions:(e,t)=>{e.scaledBoundingBoxDimensions=t.payload},setShouldShowStagingImage:(e,t)=>{e.shouldShowStagingImage=t.payload},setShouldShowStagingOutline:(e,t)=>{e.shouldShowStagingOutline=t.payload},setShouldShowCanvasDebugInfo:(e,t)=>{e.shouldShowCanvasDebugInfo=t.payload},setShouldRestrictStrokesToBox:(e,t)=>{e.shouldRestrictStrokesToBox=t.payload},setShouldAntialias:(e,t)=>{e.shouldAntialias=t.payload},setShouldCropToBoundingBoxOnSave:(e,t)=>{e.shouldCropToBoundingBoxOnSave=t.payload},setColorPickerColor:(e,t)=>{e.colorPickerColor=t.payload},commitColorPickerColor:e=>{e.brushColor={...e.colorPickerColor,a:e.brushColor.a},e.tool="brush"},setMergedCanvas:(e,t)=>{e.pastLayerStates.push(wn(e.layerState)),e.futureLayerStates=[],e.layerState.objects=[t.payload]},resetCanvasInteractionState:e=>{e.cursorPosition=null,e.isDrawing=!1,e.isMouseOverBoundingBox=!1,e.isMoveBoundingBoxKeyHeld=!1,e.isMoveStageKeyHeld=!1,e.isMovingBoundingBox=!1,e.isMovingStage=!1,e.isTransformingBoundingBox=!1},mouseLeftCanvas:e=>{e.cursorPosition=null,e.isDrawing=!1,e.isMouseOverBoundingBox=!1,e.isMovingBoundingBox=!1,e.isTransformingBoundingBox=!1}},extraReducers:e=>{e.addCase(Zse,(t,n)=>{const r=n.payload;r&&(t.boundingBoxDimensions.height=qa(t.boundingBoxDimensions.width/r,64),t.scaledBoundingBoxDimensions.height=qa(t.scaledBoundingBoxDimensions.width/r,64))})}}),{addEraseRect:tVe,addFillRect:nVe,addImageToStagingArea:ile,addLine:rVe,addPointToCurrentLine:iVe,clearCanvasHistory:oVe,clearMask:aVe,commitColorPickerColor:sVe,commitStagingAreaImage:ole,discardStagedImages:ale,fitBoundingBoxToStage:lVe,mouseLeftCanvas:uVe,nextStagingAreaImage:cVe,prevStagingAreaImage:dVe,redo:fVe,resetCanvas:gT,resetCanvasInteractionState:hVe,resetCanvasView:pVe,setBoundingBoxCoordinates:gVe,setBoundingBoxDimensions:eI,setBoundingBoxPreviewFill:mVe,setBoundingBoxScaleMethod:yVe,flipBoundingBoxAxes:vVe,setBrushColor:bVe,setBrushSize:_Ve,setColorPickerColor:SVe,setCursorPosition:xVe,setInitialCanvasImage:EB,setIsDrawing:wVe,setIsMaskEnabled:CVe,setIsMouseOverBoundingBox:EVe,setIsMoveBoundingBoxKeyHeld:kVe,setIsMoveStageKeyHeld:TVe,setIsMovingBoundingBox:AVe,setIsMovingStage:PVe,setIsTransformingBoundingBox:IVe,setLayer:RVe,setMaskColor:OVe,setMergedCanvas:sle,setShouldAutoSave:MVe,setShouldCropToBoundingBoxOnSave:NVe,setShouldDarkenOutsideBoundingBox:$Ve,setShouldLockBoundingBox:DVe,setShouldPreserveMaskedArea:LVe,setShouldShowBoundingBox:FVe,setShouldShowBrush:BVe,setShouldShowBrushPreview:zVe,setShouldShowCanvasDebugInfo:jVe,setShouldShowCheckboardTransparency:UVe,setShouldShowGrid:VVe,setShouldShowIntermediates:GVe,setShouldShowStagingImage:HVe,setShouldShowStagingOutline:qVe,setShouldSnapToGrid:WVe,setStageCoordinates:KVe,setStageScale:QVe,setTool:XVe,toggleShouldLockBoundingBox:YVe,toggleTool:ZVe,undo:JVe,setScaledBoundingBoxDimensions:eGe,setShouldRestrictStrokesToBox:tGe,stagingAreaInitialized:lle,setShouldAntialias:nGe,canvasResized:rGe,canvasBatchIdAdded:ule,canvasBatchIdsReset:cle}=CB.actions,dle=CB.reducer,fle={isModalOpen:!1,imagesToChange:[]},kB=nr({name:"changeBoardModal",initialState:fle,reducers:{isModalOpenChanged:(e,t)=>{e.isModalOpen=t.payload},imagesToChangeSelected:(e,t)=>{e.imagesToChange=t.payload},changeBoardReset:e=>{e.imagesToChange=[],e.isModalOpen=!1}}}),{isModalOpenChanged:iGe,imagesToChangeSelected:oGe,changeBoardReset:aGe}=kB.actions,hle=kB.reducer;var TB={exports:{}},AB={};const Lo=dS(EZ),Up=dS(AY),ple=dS(zY);(function(e){var t,n,r=mt&&mt.__generator||function(q,te){var re,de,oe,je,Ge={label:0,sent:function(){if(1&oe[0])throw oe[1];return oe[1]},trys:[],ops:[]};return je={next:lt(0),throw:lt(1),return:lt(2)},typeof Symbol=="function"&&(je[Symbol.iterator]=function(){return this}),je;function lt($e){return function(He){return function(Ie){if(re)throw new TypeError("Generator is already executing.");for(;Ge;)try{if(re=1,de&&(oe=2&Ie[0]?de.return:Ie[0]?de.throw||((oe=de.return)&&oe.call(de),0):de.next)&&!(oe=oe.call(de,Ie[1])).done)return oe;switch(de=0,oe&&(Ie=[2&Ie[0],oe.value]),Ie[0]){case 0:case 1:oe=Ie;break;case 4:return Ge.label++,{value:Ie[1],done:!1};case 5:Ge.label++,de=Ie[1],Ie=[0];continue;case 7:Ie=Ge.ops.pop(),Ge.trys.pop();continue;default:if(!((oe=(oe=Ge.trys).length>0&&oe[oe.length-1])||Ie[0]!==6&&Ie[0]!==2)){Ge=0;continue}if(Ie[0]===3&&(!oe||Ie[1]>oe[0]&&Ie[1]=200&&q.status<=299},$=function(q){return/ion\/(vnd\.api\+)?json/.test(q.get("content-type")||"")};function O(q){if(!(0,T.isPlainObject)(q))return q;for(var te=_({},q),re=0,de=Object.entries(te);re"u"&&Ge===k&&console.warn("Warning: `fetch` is not available. Please supply a custom `fetchFn` property to use `fetchBaseQuery` on SSR environments."),function(wt,kt){return S(te,null,function(){var cn,dn,$i,Do,Di,_r,yi,Qn,po,La,it,fn,nn,ir,Sr,vi,_n,Mt,qt,Sn,rn,gn,Se,Je,Ue,Te,qe,dt,Ve,xe,ue,Ee,fe,ge,we,et;return r(this,function(Qe){switch(Qe.label){case 0:return cn=kt.signal,dn=kt.getState,$i=kt.extra,Do=kt.endpoint,Di=kt.forced,_r=kt.type,po=(Qn=typeof wt=="string"?{url:wt}:wt).url,it=(La=Qn.headers)===void 0?new Headers(ct.headers):La,nn=(fn=Qn.params)===void 0?void 0:fn,Sr=(ir=Qn.responseHandler)===void 0?Ze??"json":ir,_n=(vi=Qn.validateStatus)===void 0?ut??P:vi,qt=(Mt=Qn.timeout)===void 0?Ye:Mt,Sn=g(Qn,["url","headers","params","responseHandler","validateStatus","timeout"]),rn=_(b(_({},ct),{signal:cn}),Sn),it=new Headers(O(it)),gn=rn,[4,oe(it,{getState:dn,extra:$i,endpoint:Do,forced:Di,type:_r})];case 1:gn.headers=Qe.sent()||it,Se=function(Ae){return typeof Ae=="object"&&((0,T.isPlainObject)(Ae)||Array.isArray(Ae)||typeof Ae.toJSON=="function")},!rn.headers.has("content-type")&&Se(rn.body)&&rn.headers.set("content-type",ie),Se(rn.body)&&He(rn.headers)&&(rn.body=JSON.stringify(rn.body,_e)),nn&&(Je=~po.indexOf("?")?"&":"?",Ue=lt?lt(nn):new URLSearchParams(O(nn)),po+=Je+Ue),po=function(Ae,Tt){if(!Ae)return Tt;if(!Tt)return Ae;if(function(Vt){return new RegExp("(^|:)//").test(Vt)}(Tt))return Tt;var jt=Ae.endsWith("/")||!Tt.startsWith("?")?"/":"";return Ae=function(Vt){return Vt.replace(/\/$/,"")}(Ae),""+Ae+jt+function(Vt){return Vt.replace(/^\//,"")}(Tt)}(re,po),Te=new Request(po,rn),qe=Te.clone(),yi={request:qe},Ve=!1,xe=qt&&setTimeout(function(){Ve=!0,kt.abort()},qt),Qe.label=2;case 2:return Qe.trys.push([2,4,5,6]),[4,Ge(Te)];case 3:return dt=Qe.sent(),[3,6];case 4:return ue=Qe.sent(),[2,{error:{status:Ve?"TIMEOUT_ERROR":"FETCH_ERROR",error:String(ue)},meta:yi}];case 5:return xe&&clearTimeout(xe),[7];case 6:Ee=dt.clone(),yi.response=Ee,ge="",Qe.label=7;case 7:return Qe.trys.push([7,9,,10]),[4,Promise.all([_t(dt,Sr).then(function(Ae){return fe=Ae},function(Ae){return we=Ae}),Ee.text().then(function(Ae){return ge=Ae},function(){})])];case 8:if(Qe.sent(),we)throw we;return[3,10];case 9:return et=Qe.sent(),[2,{error:{status:"PARSING_ERROR",originalStatus:dt.status,data:ge,error:String(et)},meta:yi}];case 10:return[2,_n(dt,fe)?{data:fe,meta:yi}:{error:{status:dt.status,data:fe},meta:yi}]}})})};function _t(wt,kt){return S(this,null,function(){var cn;return r(this,function(dn){switch(dn.label){case 0:return typeof kt=="function"?[2,kt(wt)]:(kt==="content-type"&&(kt=He(wt.headers)?"json":"text"),kt!=="json"?[3,2]:[4,wt.text()]);case 1:return[2,(cn=dn.sent()).length?JSON.parse(cn):null];case 2:return[2,wt.text()]}})})}}var A=function(q,te){te===void 0&&(te=void 0),this.value=q,this.meta=te};function D(q,te){return q===void 0&&(q=0),te===void 0&&(te=5),S(this,null,function(){var re,de;return r(this,function(oe){switch(oe.label){case 0:return re=Math.min(q,te),de=~~((Math.random()+.4)*(300<=Ee)}var Sn=(0,Jt.createAsyncThunk)(nn+"/executeQuery",Mt,{getPendingMeta:function(){var Se;return(Se={startedTimeStamp:Date.now()})[Jt.SHOULD_AUTOBATCH]=!0,Se},condition:function(Se,Je){var Ue,Te,qe,dt=(0,Je.getState)(),Ve=(Te=(Ue=dt[nn])==null?void 0:Ue.queries)==null?void 0:Te[Se.queryCacheKey],xe=Ve==null?void 0:Ve.fulfilledTimeStamp,ue=Se.originalArgs,Ee=Ve==null?void 0:Ve.originalArgs,fe=Sr[Se.endpointName];return!(!ze(Se)&&((Ve==null?void 0:Ve.status)==="pending"||!qt(Se,dt)&&(!ne(fe)||!((qe=fe==null?void 0:fe.forceRefetch)!=null&&qe.call(fe,{currentArg:ue,previousArg:Ee,endpointState:Ve,state:dt})))&&xe))},dispatchConditionRejection:!0}),rn=(0,Jt.createAsyncThunk)(nn+"/executeMutation",Mt,{getPendingMeta:function(){var Se;return(Se={startedTimeStamp:Date.now()})[Jt.SHOULD_AUTOBATCH]=!0,Se}});function gn(Se){return function(Je){var Ue,Te;return((Te=(Ue=Je==null?void 0:Je.meta)==null?void 0:Ue.arg)==null?void 0:Te.endpointName)===Se}}return{queryThunk:Sn,mutationThunk:rn,prefetch:function(Se,Je,Ue){return function(Te,qe){var dt=function(fe){return"force"in fe}(Ue)&&Ue.force,Ve=function(fe){return"ifOlderThan"in fe}(Ue)&&Ue.ifOlderThan,xe=function(fe){return fe===void 0&&(fe=!0),_n.endpoints[Se].initiate(Je,{forceRefetch:fe})},ue=_n.endpoints[Se].select(Je)(qe());if(dt)Te(xe());else if(Ve){var Ee=ue==null?void 0:ue.fulfilledTimeStamp;if(!Ee)return void Te(xe());(Number(new Date)-Number(new Date(Ee)))/1e3>=Ve&&Te(xe())}else Te(xe(!1))}},updateQueryData:function(Se,Je,Ue){return function(Te,qe){var dt,Ve,xe=_n.endpoints[Se].select(Je)(qe()),ue={patches:[],inversePatches:[],undo:function(){return Te(_n.util.patchQueryData(Se,Je,ue.inversePatches))}};if(xe.status===t.uninitialized)return ue;if("data"in xe)if((0,Pe.isDraftable)(xe.data)){var Ee=(0,Pe.produceWithPatches)(xe.data,Ue),fe=Ee[2];(dt=ue.patches).push.apply(dt,Ee[1]),(Ve=ue.inversePatches).push.apply(Ve,fe)}else{var ge=Ue(xe.data);ue.patches.push({op:"replace",path:[],value:ge}),ue.inversePatches.push({op:"replace",path:[],value:xe.data})}return Te(_n.util.patchQueryData(Se,Je,ue.patches)),ue}},upsertQueryData:function(Se,Je,Ue){return function(Te){var qe;return Te(_n.endpoints[Se].initiate(Je,((qe={subscribe:!1,forceRefetch:!0})[ot]=function(){return{data:Ue}},qe)))}},patchQueryData:function(Se,Je,Ue){return function(Te){Te(_n.internalActions.queryResultPatched({queryCacheKey:vi({queryArgs:Je,endpointDefinition:Sr[Se],endpointName:Se}),patches:Ue}))}},buildMatchThunkActions:function(Se,Je){return{matchPending:(0,gt.isAllOf)((0,gt.isPending)(Se),gn(Je)),matchFulfilled:(0,gt.isAllOf)((0,gt.isFulfilled)(Se),gn(Je)),matchRejected:(0,gt.isAllOf)((0,gt.isRejected)(Se),gn(Je))}}}}({baseQuery:de,reducerPath:oe,context:re,api:q,serializeQueryArgs:je}),_e=ie.queryThunk,Ye=ie.mutationThunk,Ze=ie.patchQueryData,ut=ie.updateQueryData,ct=ie.upsertQueryData,_t=ie.prefetch,wt=ie.buildMatchThunkActions,kt=function(it){var fn=it.reducerPath,nn=it.queryThunk,ir=it.mutationThunk,Sr=it.context,vi=Sr.endpointDefinitions,_n=Sr.apiUid,Mt=Sr.extractRehydrationInfo,qt=Sr.hasRehydrationInfo,Sn=it.assertTagType,rn=it.config,gn=(0,ce.createAction)(fn+"/resetApiState"),Se=(0,ce.createSlice)({name:fn+"/queries",initialState:Jr,reducers:{removeQueryResult:{reducer:function(xe,ue){delete xe[ue.payload.queryCacheKey]},prepare:(0,ce.prepareAutoBatched)()},queryResultPatched:function(xe,ue){var Ee=ue.payload,fe=Ee.patches;Ln(xe,Ee.queryCacheKey,function(ge){ge.data=(0,en.applyPatches)(ge.data,fe.concat())})}},extraReducers:function(xe){xe.addCase(nn.pending,function(ue,Ee){var fe,ge=Ee.meta,we=Ee.meta.arg,et=ze(we);(we.subscribe||et)&&(ue[fe=we.queryCacheKey]!=null||(ue[fe]={status:t.uninitialized,endpointName:we.endpointName})),Ln(ue,we.queryCacheKey,function(Qe){Qe.status=t.pending,Qe.requestId=et&&Qe.requestId?Qe.requestId:ge.requestId,we.originalArgs!==void 0&&(Qe.originalArgs=we.originalArgs),Qe.startedTimeStamp=ge.startedTimeStamp})}).addCase(nn.fulfilled,function(ue,Ee){var fe=Ee.meta,ge=Ee.payload;Ln(ue,fe.arg.queryCacheKey,function(we){var et;if(we.requestId===fe.requestId||ze(fe.arg)){var Qe=vi[fe.arg.endpointName].merge;if(we.status=t.fulfilled,Qe)if(we.data!==void 0){var Ae=fe.fulfilledTimeStamp,Tt=fe.arg,jt=fe.baseQueryMeta,Vt=fe.requestId,or=(0,ce.createNextState)(we.data,function(pr){return Qe(pr,ge,{arg:Tt.originalArgs,baseQueryMeta:jt,fulfilledTimeStamp:Ae,requestId:Vt})});we.data=or}else we.data=ge;else we.data=(et=vi[fe.arg.endpointName].structuralSharing)==null||et?C((0,Tn.isDraft)(we.data)?(0,en.original)(we.data):we.data,ge):ge;delete we.error,we.fulfilledTimeStamp=fe.fulfilledTimeStamp}})}).addCase(nn.rejected,function(ue,Ee){var fe=Ee.meta,ge=fe.condition,we=fe.requestId,et=Ee.error,Qe=Ee.payload;Ln(ue,fe.arg.queryCacheKey,function(Ae){if(!ge){if(Ae.requestId!==we)return;Ae.status=t.rejected,Ae.error=Qe??et}})}).addMatcher(qt,function(ue,Ee){for(var fe=Mt(Ee).queries,ge=0,we=Object.entries(fe);ge"u"||navigator.onLine===void 0||navigator.onLine,focused:typeof document>"u"||document.visibilityState!=="hidden",middlewareRegistered:!1},rn),reducers:{middlewareRegistered:function(xe,ue){xe.middlewareRegistered=xe.middlewareRegistered!=="conflict"&&_n===ue.payload||"conflict"}},extraReducers:function(xe){xe.addCase(U,function(ue){ue.online=!0}).addCase(G,function(ue){ue.online=!1}).addCase(N,function(ue){ue.focused=!0}).addCase(B,function(ue){ue.focused=!1}).addMatcher(qt,function(ue){return _({},ue)})}}),Ve=(0,ce.combineReducers)({queries:Se.reducer,mutations:Je.reducer,provided:Ue.reducer,subscriptions:qe.reducer,config:dt.reducer});return{reducer:function(xe,ue){return Ve(gn.match(ue)?void 0:xe,ue)},actions:b(_(_(_(_(_({},dt.actions),Se.actions),Te.actions),qe.actions),Je.actions),{unsubscribeMutationResult:Je.actions.removeMutationResult,resetApiState:gn})}}({context:re,queryThunk:_e,mutationThunk:Ye,reducerPath:oe,assertTagType:Ie,config:{refetchOnFocus:$e,refetchOnReconnect:He,refetchOnMountOrArgChange:lt,keepUnusedDataFor:Ge,reducerPath:oe}}),cn=kt.reducer,dn=kt.actions;mi(q.util,{patchQueryData:Ze,updateQueryData:ut,upsertQueryData:ct,prefetch:_t,resetApiState:dn.resetApiState}),mi(q.internalActions,dn);var $i=function(it){var fn=it.reducerPath,nn=it.queryThunk,ir=it.api,Sr=it.context,vi=Sr.apiUid,_n={invalidateTags:(0,al.createAction)(fn+"/invalidateTags")},Mt=[zr,Bn,Br,Rr,Ni,gi];return{middleware:function(Sn){var rn=!1,gn=b(_({},it),{internalState:{currentSubscriptions:{}},refetchQuery:qt}),Se=Mt.map(function(Te){return Te(gn)}),Je=function(Te){var qe=Te.api,dt=Te.queryThunk,Ve=Te.internalState,xe=qe.reducerPath+"/subscriptions",ue=null,Ee=!1,fe=qe.internalActions,ge=fe.updateSubscriptionOptions,we=fe.unsubscribeQueryResult;return function(et,Qe){var Ae,Tt;if(ue||(ue=JSON.parse(JSON.stringify(Ve.currentSubscriptions))),qe.util.resetApiState.match(et))return ue=Ve.currentSubscriptions={},[!0,!1];if(qe.internalActions.internal_probeSubscription.match(et)){var jt=et.payload;return[!1,!!((Ae=Ve.currentSubscriptions[jt.queryCacheKey])!=null&&Ae[jt.requestId])]}var Vt=function(zn,An){var Xi,F,V,X,pe,Ct,hn,Pn,It;if(ge.match(An)){var xn=An.payload,bi=xn.queryCacheKey,Xn=xn.requestId;return(Xi=zn==null?void 0:zn[bi])!=null&&Xi[Xn]&&(zn[bi][Xn]=xn.options),!0}if(we.match(An)){var ru=An.payload;return Xn=ru.requestId,zn[bi=ru.queryCacheKey]&&delete zn[bi][Xn],!0}if(qe.internalActions.removeQueryResult.match(An))return delete zn[An.payload.queryCacheKey],!0;if(dt.pending.match(An)){var tf=An.meta;if(Xn=tf.requestId,(rf=tf.arg).subscribe)return(iu=(V=zn[F=rf.queryCacheKey])!=null?V:zn[F]={})[Xn]=(pe=(X=rf.subscriptionOptions)!=null?X:iu[Xn])!=null?pe:{},!0}if(dt.rejected.match(An)){var iu,nf=An.meta,rf=nf.arg;if(Xn=nf.requestId,nf.condition&&rf.subscribe)return(iu=(hn=zn[Ct=rf.queryCacheKey])!=null?hn:zn[Ct]={})[Xn]=(It=(Pn=rf.subscriptionOptions)!=null?Pn:iu[Xn])!=null?It:{},!0}return!1}(Ve.currentSubscriptions,et);if(Vt){Ee||(hs(function(){var zn=JSON.parse(JSON.stringify(Ve.currentSubscriptions)),An=(0,Da.produceWithPatches)(ue,function(){return zn});Qe.next(qe.internalActions.subscriptionsUpdated(An[1])),ue=zn,Ee=!1}),Ee=!0);var or=!!((Tt=et.type)!=null&&Tt.startsWith(xe)),pr=dt.rejected.match(et)&&et.meta.condition&&!!et.meta.arg.subscribe;return[!or&&!pr,!1]}return[!0,!1]}}(gn),Ue=function(Te){var qe=Te.reducerPath,dt=Te.context,Ve=Te.refetchQuery,xe=Te.internalState,ue=Te.api.internalActions.removeQueryResult;function Ee(fe,ge){var we=fe.getState()[qe],et=we.queries,Qe=xe.currentSubscriptions;dt.batch(function(){for(var Ae=0,Tt=Object.keys(Qe);Ae{let n=[],r={get(){return r.lc||r.listen(()=>{})(),r.value},l:t||0,lc:0,listen(i,o){return r.lc=n.push(i,o||r.l)/2,()=>{let a=n.indexOf(i);~a&&(n.splice(a,2),r.lc--,r.lc||r.off())}},notify(i){let o=!Yi.length;for(let a=0;a(e.events=e.events||{},e.events[n+pv]||(e.events[n+pv]=r(i=>{e.events[n].reduceRight((o,a)=>(a(o),o),{shared:{},...i})})),e.events[n]=e.events[n]||[],e.events[n].push(t),()=>{let i=e.events[n],o=i.indexOf(t);i.splice(o,1),i.length||(delete e.events[n],e.events[n+pv](),delete e.events[n+pv])}),Sle=1e3,xle=(e,t)=>_le(e,r=>{let i=t(r);i&&e.events[hv].push(i)},ble,r=>{let i=e.listen;e.listen=(...a)=>(!e.lc&&!e.active&&(e.active=!0,r()),i(...a));let o=e.off;return e.events[hv]=[],e.off=()=>{o(),setTimeout(()=>{if(e.active&&!e.lc){e.active=!1;for(let a of e.events[hv])a();e.events[hv]=[]}},Sle)},()=>{e.listen=i,e.off=o}}),wle=(e,t)=>{Array.isArray(e)||(e=[e]);let n,r=()=>{let o=e.map(a=>a.get());(n===void 0||o.some((a,s)=>a!==n[s]))&&(n=o,i.set(t(...o)))},i=tl(void 0,Math.max(...e.map(o=>o.l))+1);return xle(i,()=>{let o=e.map(a=>a.listen(r,i.l));return r(),()=>{for(let a of o)a()}}),i};const IB=tl(),Cle={type:"logger",log(e){this.output("log",e)},warn(e){this.output("warn",e)},error(e){this.output("error",e)},output(e,t){console&&console[e]&&console[e].apply(console,t)}};class t_{constructor(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.init(t,n)}init(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.prefix=n.prefix||"i18next:",this.logger=t||Cle,this.options=n,this.debug=n.debug}log(){for(var t=arguments.length,n=new Array(t),r=0;r{this.observers[r]=this.observers[r]||[],this.observers[r].push(n)}),this}off(t,n){if(this.observers[t]){if(!n){delete this.observers[t];return}this.observers[t]=this.observers[t].filter(r=>r!==n)}}emit(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i{a(...r)}),this.observers["*"]&&[].concat(this.observers["*"]).forEach(a=>{a.apply(a,[t,...r])})}}function Gp(){let e,t;const n=new Promise((r,i)=>{e=r,t=i});return n.resolve=e,n.reject=t,n}function nI(e){return e==null?"":""+e}function Ele(e,t,n){e.forEach(r=>{t[r]&&(n[r]=t[r])})}function yT(e,t,n){function r(a){return a&&a.indexOf("###")>-1?a.replace(/###/g,"."):a}function i(){return!e||typeof e=="string"}const o=typeof t!="string"?[].concat(t):t.split(".");for(;o.length>1;){if(i())return{};const a=r(o.shift());!e[a]&&n&&(e[a]=new n),Object.prototype.hasOwnProperty.call(e,a)?e=e[a]:e={}}return i()?{}:{obj:e,k:r(o.shift())}}function rI(e,t,n){const{obj:r,k:i}=yT(e,t,Object);r[i]=n}function kle(e,t,n,r){const{obj:i,k:o}=yT(e,t,Object);i[o]=i[o]||[],r&&(i[o]=i[o].concat(n)),r||i[o].push(n)}function n_(e,t){const{obj:n,k:r}=yT(e,t);if(n)return n[r]}function Tle(e,t,n){const r=n_(e,n);return r!==void 0?r:n_(t,n)}function RB(e,t,n){for(const r in t)r!=="__proto__"&&r!=="constructor"&&(r in e?typeof e[r]=="string"||e[r]instanceof String||typeof t[r]=="string"||t[r]instanceof String?n&&(e[r]=t[r]):RB(e[r],t[r],n):e[r]=t[r]);return e}function sf(e){return e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}var Ale={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};function Ple(e){return typeof e=="string"?e.replace(/[&<>"'\/]/g,t=>Ale[t]):e}const Ile=[" ",",","?","!",";"];function Rle(e,t,n){t=t||"",n=n||"";const r=Ile.filter(a=>t.indexOf(a)<0&&n.indexOf(a)<0);if(r.length===0)return!0;const i=new RegExp(`(${r.map(a=>a==="?"?"\\?":a).join("|")})`);let o=!i.test(e);if(!o){const a=e.indexOf(n);a>0&&!i.test(e.substring(0,a))&&(o=!0)}return o}function r_(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:".";if(!e)return;if(e[t])return e[t];const r=t.split(n);let i=e;for(let o=0;oo+a;)a++,s=r.slice(o,o+a).join(n),l=i[s];if(l===void 0)return;if(l===null)return null;if(t.endsWith(s)){if(typeof l=="string")return l;if(s&&typeof l[s]=="string")return l[s]}const u=r.slice(o+a).join(n);return u?r_(l,u,n):void 0}i=i[r[o]]}return i}function i_(e){return e&&e.indexOf("_")>0?e.replace("_","-"):e}class iI extends YS{constructor(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{ns:["translation"],defaultNS:"translation"};super(),this.data=t||{},this.options=n,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.options.ignoreJSONStructure===void 0&&(this.options.ignoreJSONStructure=!0)}addNamespaces(t){this.options.ns.indexOf(t)<0&&this.options.ns.push(t)}removeNamespaces(t){const n=this.options.ns.indexOf(t);n>-1&&this.options.ns.splice(n,1)}getResource(t,n,r){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};const o=i.keySeparator!==void 0?i.keySeparator:this.options.keySeparator,a=i.ignoreJSONStructure!==void 0?i.ignoreJSONStructure:this.options.ignoreJSONStructure;let s=[t,n];r&&typeof r!="string"&&(s=s.concat(r)),r&&typeof r=="string"&&(s=s.concat(o?r.split(o):r)),t.indexOf(".")>-1&&(s=t.split("."));const l=n_(this.data,s);return l||!a||typeof r!="string"?l:r_(this.data&&this.data[t]&&this.data[t][n],r,o)}addResource(t,n,r,i){let o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{silent:!1};const a=o.keySeparator!==void 0?o.keySeparator:this.options.keySeparator;let s=[t,n];r&&(s=s.concat(a?r.split(a):r)),t.indexOf(".")>-1&&(s=t.split("."),i=n,n=s[1]),this.addNamespaces(n),rI(this.data,s,i),o.silent||this.emit("added",t,n,r,i)}addResources(t,n,r){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{silent:!1};for(const o in r)(typeof r[o]=="string"||Object.prototype.toString.apply(r[o])==="[object Array]")&&this.addResource(t,n,o,r[o],{silent:!0});i.silent||this.emit("added",t,n,r)}addResourceBundle(t,n,r,i,o){let a=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{silent:!1},s=[t,n];t.indexOf(".")>-1&&(s=t.split("."),i=r,r=n,n=s[1]),this.addNamespaces(n);let l=n_(this.data,s)||{};i?RB(l,r,o):l={...l,...r},rI(this.data,s,l),a.silent||this.emit("added",t,n,r)}removeResourceBundle(t,n){this.hasResourceBundle(t,n)&&delete this.data[t][n],this.removeNamespaces(n),this.emit("removed",t,n)}hasResourceBundle(t,n){return this.getResource(t,n)!==void 0}getResourceBundle(t,n){return n||(n=this.options.defaultNS),this.options.compatibilityAPI==="v1"?{...this.getResource(t,n)}:this.getResource(t,n)}getDataByLanguage(t){return this.data[t]}hasLanguageSomeTranslations(t){const n=this.getDataByLanguage(t);return!!(n&&Object.keys(n)||[]).find(i=>n[i]&&Object.keys(n[i]).length>0)}toJSON(){return this.data}}var OB={processors:{},addPostProcessor(e){this.processors[e.name]=e},handle(e,t,n,r,i){return e.forEach(o=>{this.processors[o]&&(t=this.processors[o].process(t,n,r,i))}),t}};const oI={};class o_ extends YS{constructor(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(),Ele(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],t,this),this.options=n,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=Ms.create("translator")}changeLanguage(t){t&&(this.language=t)}exists(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}};if(t==null)return!1;const r=this.resolve(t,n);return r&&r.res!==void 0}extractFromKey(t,n){let r=n.nsSeparator!==void 0?n.nsSeparator:this.options.nsSeparator;r===void 0&&(r=":");const i=n.keySeparator!==void 0?n.keySeparator:this.options.keySeparator;let o=n.ns||this.options.defaultNS||[];const a=r&&t.indexOf(r)>-1,s=!this.options.userDefinedKeySeparator&&!n.keySeparator&&!this.options.userDefinedNsSeparator&&!n.nsSeparator&&!Rle(t,r,i);if(a&&!s){const l=t.match(this.interpolator.nestingRegexp);if(l&&l.length>0)return{key:t,namespaces:o};const u=t.split(r);(r!==i||r===i&&this.options.ns.indexOf(u[0])>-1)&&(o=u.shift()),t=u.join(i)}return typeof o=="string"&&(o=[o]),{key:t,namespaces:o}}translate(t,n,r){if(typeof n!="object"&&this.options.overloadTranslationOptionHandler&&(n=this.options.overloadTranslationOptionHandler(arguments)),typeof n=="object"&&(n={...n}),n||(n={}),t==null)return"";Array.isArray(t)||(t=[String(t)]);const i=n.returnDetails!==void 0?n.returnDetails:this.options.returnDetails,o=n.keySeparator!==void 0?n.keySeparator:this.options.keySeparator,{key:a,namespaces:s}=this.extractFromKey(t[t.length-1],n),l=s[s.length-1],u=n.lng||this.language,c=n.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(u&&u.toLowerCase()==="cimode"){if(c){const y=n.nsSeparator||this.options.nsSeparator;return i?{res:`${l}${y}${a}`,usedKey:a,exactUsedKey:a,usedLng:u,usedNS:l}:`${l}${y}${a}`}return i?{res:a,usedKey:a,exactUsedKey:a,usedLng:u,usedNS:l}:a}const d=this.resolve(t,n);let f=d&&d.res;const h=d&&d.usedKey||a,p=d&&d.exactUsedKey||a,m=Object.prototype.toString.apply(f),_=["[object Number]","[object Function]","[object RegExp]"],b=n.joinArrays!==void 0?n.joinArrays:this.options.joinArrays,v=!this.i18nFormat||this.i18nFormat.handleAsObject;if(v&&f&&(typeof f!="string"&&typeof f!="boolean"&&typeof f!="number")&&_.indexOf(m)<0&&!(typeof b=="string"&&m==="[object Array]")){if(!n.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const y=this.options.returnedObjectHandler?this.options.returnedObjectHandler(h,f,{...n,ns:s}):`key '${a} (${this.language})' returned an object instead of string.`;return i?(d.res=y,d):y}if(o){const y=m==="[object Array]",S=y?[]:{},w=y?p:h;for(const x in f)if(Object.prototype.hasOwnProperty.call(f,x)){const C=`${w}${o}${x}`;S[x]=this.translate(C,{...n,joinArrays:!1,ns:s}),S[x]===C&&(S[x]=f[x])}f=S}}else if(v&&typeof b=="string"&&m==="[object Array]")f=f.join(b),f&&(f=this.extendTranslation(f,t,n,r));else{let y=!1,S=!1;const w=n.count!==void 0&&typeof n.count!="string",x=o_.hasDefaultValue(n),C=w?this.pluralResolver.getSuffix(u,n.count,n):"",T=n.ordinal&&w?this.pluralResolver.getSuffix(u,n.count,{ordinal:!1}):"",k=n[`defaultValue${C}`]||n[`defaultValue${T}`]||n.defaultValue;!this.isValidLookup(f)&&x&&(y=!0,f=k),this.isValidLookup(f)||(S=!0,f=a);const $=(n.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&S?void 0:f,O=x&&k!==f&&this.options.updateMissing;if(S||y||O){if(this.logger.log(O?"updateKey":"missingKey",u,l,a,O?k:f),o){const L=this.resolve(a,{...n,keySeparator:!1});L&&L.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}let E=[];const A=this.languageUtils.getFallbackCodes(this.options.fallbackLng,n.lng||this.language);if(this.options.saveMissingTo==="fallback"&&A&&A[0])for(let L=0;L{const N=x&&R!==f?R:$;this.options.missingKeyHandler?this.options.missingKeyHandler(L,l,M,N,O,n):this.backendConnector&&this.backendConnector.saveMissing&&this.backendConnector.saveMissing(L,l,M,N,O,n),this.emit("missingKey",L,l,M,f)};this.options.saveMissing&&(this.options.saveMissingPlurals&&w?E.forEach(L=>{this.pluralResolver.getSuffixes(L,n).forEach(M=>{D([L],a+M,n[`defaultValue${M}`]||k)})}):D(E,a,k))}f=this.extendTranslation(f,t,n,d,r),S&&f===a&&this.options.appendNamespaceToMissingKey&&(f=`${l}:${a}`),(S||y)&&this.options.parseMissingKeyHandler&&(this.options.compatibilityAPI!=="v1"?f=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${l}:${a}`:a,y?f:void 0):f=this.options.parseMissingKeyHandler(f))}return i?(d.res=f,d):f}extendTranslation(t,n,r,i,o){var a=this;if(this.i18nFormat&&this.i18nFormat.parse)t=this.i18nFormat.parse(t,{...this.options.interpolation.defaultVariables,...r},i.usedLng,i.usedNS,i.usedKey,{resolved:i});else if(!r.skipInterpolation){r.interpolation&&this.interpolator.init({...r,interpolation:{...this.options.interpolation,...r.interpolation}});const u=typeof t=="string"&&(r&&r.interpolation&&r.interpolation.skipOnVariables!==void 0?r.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let c;if(u){const f=t.match(this.interpolator.nestingRegexp);c=f&&f.length}let d=r.replace&&typeof r.replace!="string"?r.replace:r;if(this.options.interpolation.defaultVariables&&(d={...this.options.interpolation.defaultVariables,...d}),t=this.interpolator.interpolate(t,d,r.lng||this.language,r),u){const f=t.match(this.interpolator.nestingRegexp),h=f&&f.length;c1&&arguments[1]!==void 0?arguments[1]:{},r,i,o,a,s;return typeof t=="string"&&(t=[t]),t.forEach(l=>{if(this.isValidLookup(r))return;const u=this.extractFromKey(l,n),c=u.key;i=c;let d=u.namespaces;this.options.fallbackNS&&(d=d.concat(this.options.fallbackNS));const f=n.count!==void 0&&typeof n.count!="string",h=f&&!n.ordinal&&n.count===0&&this.pluralResolver.shouldUseIntlApi(),p=n.context!==void 0&&(typeof n.context=="string"||typeof n.context=="number")&&n.context!=="",m=n.lngs?n.lngs:this.languageUtils.toResolveHierarchy(n.lng||this.language,n.fallbackLng);d.forEach(_=>{this.isValidLookup(r)||(s=_,!oI[`${m[0]}-${_}`]&&this.utils&&this.utils.hasLoadedNamespace&&!this.utils.hasLoadedNamespace(s)&&(oI[`${m[0]}-${_}`]=!0,this.logger.warn(`key "${i}" for languages "${m.join(", ")}" won't get resolved as namespace "${s}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),m.forEach(b=>{if(this.isValidLookup(r))return;a=b;const v=[c];if(this.i18nFormat&&this.i18nFormat.addLookupKeys)this.i18nFormat.addLookupKeys(v,c,b,_,n);else{let y;f&&(y=this.pluralResolver.getSuffix(b,n.count,n));const S=`${this.options.pluralSeparator}zero`,w=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(f&&(v.push(c+y),n.ordinal&&y.indexOf(w)===0&&v.push(c+y.replace(w,this.options.pluralSeparator)),h&&v.push(c+S)),p){const x=`${c}${this.options.contextSeparator}${n.context}`;v.push(x),f&&(v.push(x+y),n.ordinal&&y.indexOf(w)===0&&v.push(x+y.replace(w,this.options.pluralSeparator)),h&&v.push(x+S))}}let g;for(;g=v.pop();)this.isValidLookup(r)||(o=g,r=this.getResource(b,_,g,n))}))})}),{res:r,usedKey:i,exactUsedKey:o,usedLng:a,usedNS:s}}isValidLookup(t){return t!==void 0&&!(!this.options.returnNull&&t===null)&&!(!this.options.returnEmptyString&&t==="")}getResource(t,n,r){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};return this.i18nFormat&&this.i18nFormat.getResource?this.i18nFormat.getResource(t,n,r,i):this.resourceStore.getResource(t,n,r,i)}static hasDefaultValue(t){const n="defaultValue";for(const r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&n===r.substring(0,n.length)&&t[r]!==void 0)return!0;return!1}}function iC(e){return e.charAt(0).toUpperCase()+e.slice(1)}class aI{constructor(t){this.options=t,this.supportedLngs=this.options.supportedLngs||!1,this.logger=Ms.create("languageUtils")}getScriptPartFromCode(t){if(t=i_(t),!t||t.indexOf("-")<0)return null;const n=t.split("-");return n.length===2||(n.pop(),n[n.length-1].toLowerCase()==="x")?null:this.formatLanguageCode(n.join("-"))}getLanguagePartFromCode(t){if(t=i_(t),!t||t.indexOf("-")<0)return t;const n=t.split("-");return this.formatLanguageCode(n[0])}formatLanguageCode(t){if(typeof t=="string"&&t.indexOf("-")>-1){const n=["hans","hant","latn","cyrl","cans","mong","arab"];let r=t.split("-");return this.options.lowerCaseLng?r=r.map(i=>i.toLowerCase()):r.length===2?(r[0]=r[0].toLowerCase(),r[1]=r[1].toUpperCase(),n.indexOf(r[1].toLowerCase())>-1&&(r[1]=iC(r[1].toLowerCase()))):r.length===3&&(r[0]=r[0].toLowerCase(),r[1].length===2&&(r[1]=r[1].toUpperCase()),r[0]!=="sgn"&&r[2].length===2&&(r[2]=r[2].toUpperCase()),n.indexOf(r[1].toLowerCase())>-1&&(r[1]=iC(r[1].toLowerCase())),n.indexOf(r[2].toLowerCase())>-1&&(r[2]=iC(r[2].toLowerCase()))),r.join("-")}return this.options.cleanCode||this.options.lowerCaseLng?t.toLowerCase():t}isSupportedCode(t){return(this.options.load==="languageOnly"||this.options.nonExplicitSupportedLngs)&&(t=this.getLanguagePartFromCode(t)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(t)>-1}getBestMatchFromCodes(t){if(!t)return null;let n;return t.forEach(r=>{if(n)return;const i=this.formatLanguageCode(r);(!this.options.supportedLngs||this.isSupportedCode(i))&&(n=i)}),!n&&this.options.supportedLngs&&t.forEach(r=>{if(n)return;const i=this.getLanguagePartFromCode(r);if(this.isSupportedCode(i))return n=i;n=this.options.supportedLngs.find(o=>{if(o===i)return o;if(!(o.indexOf("-")<0&&i.indexOf("-")<0)&&o.indexOf(i)===0)return o})}),n||(n=this.getFallbackCodes(this.options.fallbackLng)[0]),n}getFallbackCodes(t,n){if(!t)return[];if(typeof t=="function"&&(t=t(n)),typeof t=="string"&&(t=[t]),Object.prototype.toString.apply(t)==="[object Array]")return t;if(!n)return t.default||[];let r=t[n];return r||(r=t[this.getScriptPartFromCode(n)]),r||(r=t[this.formatLanguageCode(n)]),r||(r=t[this.getLanguagePartFromCode(n)]),r||(r=t.default),r||[]}toResolveHierarchy(t,n){const r=this.getFallbackCodes(n||this.options.fallbackLng||[],t),i=[],o=a=>{a&&(this.isSupportedCode(a)?i.push(a):this.logger.warn(`rejecting language code not found in supportedLngs: ${a}`))};return typeof t=="string"&&(t.indexOf("-")>-1||t.indexOf("_")>-1)?(this.options.load!=="languageOnly"&&o(this.formatLanguageCode(t)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&o(this.getScriptPartFromCode(t)),this.options.load!=="currentOnly"&&o(this.getLanguagePartFromCode(t))):typeof t=="string"&&o(this.formatLanguageCode(t)),r.forEach(a=>{i.indexOf(a)<0&&o(this.formatLanguageCode(a))}),i}}let Ole=[{lngs:["ach","ak","am","arn","br","fil","gun","ln","mfe","mg","mi","oc","pt","pt-BR","tg","tl","ti","tr","uz","wa"],nr:[1,2],fc:1},{lngs:["af","an","ast","az","bg","bn","ca","da","de","dev","el","en","eo","es","et","eu","fi","fo","fur","fy","gl","gu","ha","hi","hu","hy","ia","it","kk","kn","ku","lb","mai","ml","mn","mr","nah","nap","nb","ne","nl","nn","no","nso","pa","pap","pms","ps","pt-PT","rm","sco","se","si","so","son","sq","sv","sw","ta","te","tk","ur","yo"],nr:[1,2],fc:2},{lngs:["ay","bo","cgg","fa","ht","id","ja","jbo","ka","km","ko","ky","lo","ms","sah","su","th","tt","ug","vi","wo","zh"],nr:[1],fc:3},{lngs:["be","bs","cnr","dz","hr","ru","sr","uk"],nr:[1,2,5],fc:4},{lngs:["ar"],nr:[0,1,2,3,11,100],fc:5},{lngs:["cs","sk"],nr:[1,2,5],fc:6},{lngs:["csb","pl"],nr:[1,2,5],fc:7},{lngs:["cy"],nr:[1,2,3,8],fc:8},{lngs:["fr"],nr:[1,2],fc:9},{lngs:["ga"],nr:[1,2,3,7,11],fc:10},{lngs:["gd"],nr:[1,2,3,20],fc:11},{lngs:["is"],nr:[1,2],fc:12},{lngs:["jv"],nr:[0,1],fc:13},{lngs:["kw"],nr:[1,2,3,4],fc:14},{lngs:["lt"],nr:[1,2,10],fc:15},{lngs:["lv"],nr:[1,2,0],fc:16},{lngs:["mk"],nr:[1,2],fc:17},{lngs:["mnk"],nr:[0,1,2],fc:18},{lngs:["mt"],nr:[1,2,11,20],fc:19},{lngs:["or"],nr:[2,1],fc:2},{lngs:["ro"],nr:[1,2,20],fc:20},{lngs:["sl"],nr:[5,1,2,3],fc:21},{lngs:["he","iw"],nr:[1,2,20,21],fc:22}],Mle={1:function(e){return+(e>1)},2:function(e){return+(e!=1)},3:function(e){return 0},4:function(e){return e%10==1&&e%100!=11?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2},5:function(e){return e==0?0:e==1?1:e==2?2:e%100>=3&&e%100<=10?3:e%100>=11?4:5},6:function(e){return e==1?0:e>=2&&e<=4?1:2},7:function(e){return e==1?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2},8:function(e){return e==1?0:e==2?1:e!=8&&e!=11?2:3},9:function(e){return+(e>=2)},10:function(e){return e==1?0:e==2?1:e<7?2:e<11?3:4},11:function(e){return e==1||e==11?0:e==2||e==12?1:e>2&&e<20?2:3},12:function(e){return+(e%10!=1||e%100==11)},13:function(e){return+(e!==0)},14:function(e){return e==1?0:e==2?1:e==3?2:3},15:function(e){return e%10==1&&e%100!=11?0:e%10>=2&&(e%100<10||e%100>=20)?1:2},16:function(e){return e%10==1&&e%100!=11?0:e!==0?1:2},17:function(e){return e==1||e%10==1&&e%100!=11?0:1},18:function(e){return e==0?0:e==1?1:2},19:function(e){return e==1?0:e==0||e%100>1&&e%100<11?1:e%100>10&&e%100<20?2:3},20:function(e){return e==1?0:e==0||e%100>0&&e%100<20?1:2},21:function(e){return e%100==1?1:e%100==2?2:e%100==3||e%100==4?3:0},22:function(e){return e==1?0:e==2?1:(e<0||e>10)&&e%10==0?2:3}};const Nle=["v1","v2","v3"],$le=["v4"],sI={zero:0,one:1,two:2,few:3,many:4,other:5};function Dle(){const e={};return Ole.forEach(t=>{t.lngs.forEach(n=>{e[n]={numbers:t.nr,plurals:Mle[t.fc]}})}),e}class Lle{constructor(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.languageUtils=t,this.options=n,this.logger=Ms.create("pluralResolver"),(!this.options.compatibilityJSON||$le.includes(this.options.compatibilityJSON))&&(typeof Intl>"u"||!Intl.PluralRules)&&(this.options.compatibilityJSON="v3",this.logger.error("Your environment seems not to be Intl API compatible, use an Intl.PluralRules polyfill. Will fallback to the compatibilityJSON v3 format handling.")),this.rules=Dle()}addRule(t,n){this.rules[t]=n}getRule(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(this.shouldUseIntlApi())try{return new Intl.PluralRules(i_(t),{type:n.ordinal?"ordinal":"cardinal"})}catch{return}return this.rules[t]||this.rules[this.languageUtils.getLanguagePartFromCode(t)]}needsPlural(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const r=this.getRule(t,n);return this.shouldUseIntlApi()?r&&r.resolvedOptions().pluralCategories.length>1:r&&r.numbers.length>1}getPluralFormsOfKey(t,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return this.getSuffixes(t,r).map(i=>`${n}${i}`)}getSuffixes(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const r=this.getRule(t,n);return r?this.shouldUseIntlApi()?r.resolvedOptions().pluralCategories.sort((i,o)=>sI[i]-sI[o]).map(i=>`${this.options.prepend}${n.ordinal?`ordinal${this.options.prepend}`:""}${i}`):r.numbers.map(i=>this.getSuffix(t,i,n)):[]}getSuffix(t,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const i=this.getRule(t,r);return i?this.shouldUseIntlApi()?`${this.options.prepend}${r.ordinal?`ordinal${this.options.prepend}`:""}${i.select(n)}`:this.getSuffixRetroCompatible(i,n):(this.logger.warn(`no plural rule found for: ${t}`),"")}getSuffixRetroCompatible(t,n){const r=t.noAbs?t.plurals(n):t.plurals(Math.abs(n));let i=t.numbers[r];this.options.simplifyPluralSuffix&&t.numbers.length===2&&t.numbers[0]===1&&(i===2?i="plural":i===1&&(i=""));const o=()=>this.options.prepend&&i.toString()?this.options.prepend+i.toString():i.toString();return this.options.compatibilityJSON==="v1"?i===1?"":typeof i=="number"?`_plural_${i.toString()}`:o():this.options.compatibilityJSON==="v2"||this.options.simplifyPluralSuffix&&t.numbers.length===2&&t.numbers[0]===1?o():this.options.prepend&&r.toString()?this.options.prepend+r.toString():r.toString()}shouldUseIntlApi(){return!Nle.includes(this.options.compatibilityJSON)}}function lI(e,t,n){let r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:".",i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,o=Tle(e,t,n);return!o&&i&&typeof n=="string"&&(o=r_(e,n,r),o===void 0&&(o=r_(t,n,r))),o}class Fle{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=Ms.create("interpolator"),this.options=t,this.format=t.interpolation&&t.interpolation.format||(n=>n),this.init(t)}init(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};t.interpolation||(t.interpolation={escapeValue:!0});const n=t.interpolation;this.escape=n.escape!==void 0?n.escape:Ple,this.escapeValue=n.escapeValue!==void 0?n.escapeValue:!0,this.useRawValueToEscape=n.useRawValueToEscape!==void 0?n.useRawValueToEscape:!1,this.prefix=n.prefix?sf(n.prefix):n.prefixEscaped||"{{",this.suffix=n.suffix?sf(n.suffix):n.suffixEscaped||"}}",this.formatSeparator=n.formatSeparator?n.formatSeparator:n.formatSeparator||",",this.unescapePrefix=n.unescapeSuffix?"":n.unescapePrefix||"-",this.unescapeSuffix=this.unescapePrefix?"":n.unescapeSuffix||"",this.nestingPrefix=n.nestingPrefix?sf(n.nestingPrefix):n.nestingPrefixEscaped||sf("$t("),this.nestingSuffix=n.nestingSuffix?sf(n.nestingSuffix):n.nestingSuffixEscaped||sf(")"),this.nestingOptionsSeparator=n.nestingOptionsSeparator?n.nestingOptionsSeparator:n.nestingOptionsSeparator||",",this.maxReplaces=n.maxReplaces?n.maxReplaces:1e3,this.alwaysFormat=n.alwaysFormat!==void 0?n.alwaysFormat:!1,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){const t=`${this.prefix}(.+?)${this.suffix}`;this.regexp=new RegExp(t,"g");const n=`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`;this.regexpUnescape=new RegExp(n,"g");const r=`${this.nestingPrefix}(.+?)${this.nestingSuffix}`;this.nestingRegexp=new RegExp(r,"g")}interpolate(t,n,r,i){let o,a,s;const l=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{};function u(p){return p.replace(/\$/g,"$$$$")}const c=p=>{if(p.indexOf(this.formatSeparator)<0){const v=lI(n,l,p,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(v,void 0,r,{...i,...n,interpolationkey:p}):v}const m=p.split(this.formatSeparator),_=m.shift().trim(),b=m.join(this.formatSeparator).trim();return this.format(lI(n,l,_,this.options.keySeparator,this.options.ignoreJSONStructure),b,r,{...i,...n,interpolationkey:_})};this.resetRegExp();const d=i&&i.missingInterpolationHandler||this.options.missingInterpolationHandler,f=i&&i.interpolation&&i.interpolation.skipOnVariables!==void 0?i.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:p=>u(p)},{regex:this.regexp,safeValue:p=>this.escapeValue?u(this.escape(p)):u(p)}].forEach(p=>{for(s=0;o=p.regex.exec(t);){const m=o[1].trim();if(a=c(m),a===void 0)if(typeof d=="function"){const b=d(t,o,i);a=typeof b=="string"?b:""}else if(i&&Object.prototype.hasOwnProperty.call(i,m))a="";else if(f){a=o[0];continue}else this.logger.warn(`missed to pass in variable ${m} for interpolating ${t}`),a="";else typeof a!="string"&&!this.useRawValueToEscape&&(a=nI(a));const _=p.safeValue(a);if(t=t.replace(o[0],_),f?(p.regex.lastIndex+=a.length,p.regex.lastIndex-=o[0].length):p.regex.lastIndex=0,s++,s>=this.maxReplaces)break}}),t}nest(t,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},i,o,a;function s(l,u){const c=this.nestingOptionsSeparator;if(l.indexOf(c)<0)return l;const d=l.split(new RegExp(`${c}[ ]*{`));let f=`{${d[1]}`;l=d[0],f=this.interpolate(f,a);const h=f.match(/'/g),p=f.match(/"/g);(h&&h.length%2===0&&!p||p.length%2!==0)&&(f=f.replace(/'/g,'"'));try{a=JSON.parse(f),u&&(a={...u,...a})}catch(m){return this.logger.warn(`failed parsing options string in nesting for key ${l}`,m),`${l}${c}${f}`}return delete a.defaultValue,l}for(;i=this.nestingRegexp.exec(t);){let l=[];a={...r},a=a.replace&&typeof a.replace!="string"?a.replace:a,a.applyPostProcessor=!1,delete a.defaultValue;let u=!1;if(i[0].indexOf(this.formatSeparator)!==-1&&!/{.*}/.test(i[1])){const c=i[1].split(this.formatSeparator).map(d=>d.trim());i[1]=c.shift(),l=c,u=!0}if(o=n(s.call(this,i[1].trim(),a),a),o&&i[0]===t&&typeof o!="string")return o;typeof o!="string"&&(o=nI(o)),o||(this.logger.warn(`missed to resolve ${i[1]} for nesting ${t}`),o=""),u&&(o=l.reduce((c,d)=>this.format(c,d,r.lng,{...r,interpolationkey:i[1].trim()}),o.trim())),t=t.replace(i[0],o),this.regexp.lastIndex=0}return t}}function Ble(e){let t=e.toLowerCase().trim();const n={};if(e.indexOf("(")>-1){const r=e.split("(");t=r[0].toLowerCase().trim();const i=r[1].substring(0,r[1].length-1);t==="currency"&&i.indexOf(":")<0?n.currency||(n.currency=i.trim()):t==="relativetime"&&i.indexOf(":")<0?n.range||(n.range=i.trim()):i.split(";").forEach(a=>{if(!a)return;const[s,...l]=a.split(":"),u=l.join(":").trim().replace(/^'+|'+$/g,"");n[s.trim()]||(n[s.trim()]=u),u==="false"&&(n[s.trim()]=!1),u==="true"&&(n[s.trim()]=!0),isNaN(u)||(n[s.trim()]=parseInt(u,10))})}return{formatName:t,formatOptions:n}}function lf(e){const t={};return function(r,i,o){const a=i+JSON.stringify(o);let s=t[a];return s||(s=e(i_(i),o),t[a]=s),s(r)}}class zle{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=Ms.create("formatter"),this.options=t,this.formats={number:lf((n,r)=>{const i=new Intl.NumberFormat(n,{...r});return o=>i.format(o)}),currency:lf((n,r)=>{const i=new Intl.NumberFormat(n,{...r,style:"currency"});return o=>i.format(o)}),datetime:lf((n,r)=>{const i=new Intl.DateTimeFormat(n,{...r});return o=>i.format(o)}),relativetime:lf((n,r)=>{const i=new Intl.RelativeTimeFormat(n,{...r});return o=>i.format(o,r.range||"day")}),list:lf((n,r)=>{const i=new Intl.ListFormat(n,{...r});return o=>i.format(o)})},this.init(t)}init(t){const r=(arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}}).interpolation;this.formatSeparator=r.formatSeparator?r.formatSeparator:r.formatSeparator||","}add(t,n){this.formats[t.toLowerCase().trim()]=n}addCached(t,n){this.formats[t.toLowerCase().trim()]=lf(n)}format(t,n,r){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};return n.split(this.formatSeparator).reduce((s,l)=>{const{formatName:u,formatOptions:c}=Ble(l);if(this.formats[u]){let d=s;try{const f=i&&i.formatParams&&i.formatParams[i.interpolationkey]||{},h=f.locale||f.lng||i.locale||i.lng||r;d=this.formats[u](s,h,{...c,...i,...f})}catch(f){this.logger.warn(f)}return d}else this.logger.warn(`there was no format function for ${u}`);return s},t)}}function jle(e,t){e.pending[t]!==void 0&&(delete e.pending[t],e.pendingCount--)}class Ule extends YS{constructor(t,n,r){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};super(),this.backend=t,this.store=n,this.services=r,this.languageUtils=r.languageUtils,this.options=i,this.logger=Ms.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=i.maxParallelReads||10,this.readingCalls=0,this.maxRetries=i.maxRetries>=0?i.maxRetries:5,this.retryTimeout=i.retryTimeout>=1?i.retryTimeout:350,this.state={},this.queue=[],this.backend&&this.backend.init&&this.backend.init(r,i.backend,i)}queueLoad(t,n,r,i){const o={},a={},s={},l={};return t.forEach(u=>{let c=!0;n.forEach(d=>{const f=`${u}|${d}`;!r.reload&&this.store.hasResourceBundle(u,d)?this.state[f]=2:this.state[f]<0||(this.state[f]===1?a[f]===void 0&&(a[f]=!0):(this.state[f]=1,c=!1,a[f]===void 0&&(a[f]=!0),o[f]===void 0&&(o[f]=!0),l[d]===void 0&&(l[d]=!0)))}),c||(s[u]=!0)}),(Object.keys(o).length||Object.keys(a).length)&&this.queue.push({pending:a,pendingCount:Object.keys(a).length,loaded:{},errors:[],callback:i}),{toLoad:Object.keys(o),pending:Object.keys(a),toLoadLanguages:Object.keys(s),toLoadNamespaces:Object.keys(l)}}loaded(t,n,r){const i=t.split("|"),o=i[0],a=i[1];n&&this.emit("failedLoading",o,a,n),r&&this.store.addResourceBundle(o,a,r),this.state[t]=n?-1:2;const s={};this.queue.forEach(l=>{kle(l.loaded,[o],a),jle(l,t),n&&l.errors.push(n),l.pendingCount===0&&!l.done&&(Object.keys(l.loaded).forEach(u=>{s[u]||(s[u]={});const c=l.loaded[u];c.length&&c.forEach(d=>{s[u][d]===void 0&&(s[u][d]=!0)})}),l.done=!0,l.errors.length?l.callback(l.errors):l.callback())}),this.emit("loaded",s),this.queue=this.queue.filter(l=>!l.done)}read(t,n,r){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:this.retryTimeout,a=arguments.length>5?arguments[5]:void 0;if(!t.length)return a(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:t,ns:n,fcName:r,tried:i,wait:o,callback:a});return}this.readingCalls++;const s=(u,c)=>{if(this.readingCalls--,this.waitingReads.length>0){const d=this.waitingReads.shift();this.read(d.lng,d.ns,d.fcName,d.tried,d.wait,d.callback)}if(u&&c&&i{this.read.call(this,t,n,r,i+1,o*2,a)},o);return}a(u,c)},l=this.backend[r].bind(this.backend);if(l.length===2){try{const u=l(t,n);u&&typeof u.then=="function"?u.then(c=>s(null,c)).catch(s):s(null,u)}catch(u){s(u)}return}return l(t,n,s)}prepareLoading(t,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},i=arguments.length>3?arguments[3]:void 0;if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),i&&i();typeof t=="string"&&(t=this.languageUtils.toResolveHierarchy(t)),typeof n=="string"&&(n=[n]);const o=this.queueLoad(t,n,r,i);if(!o.toLoad.length)return o.pending.length||i(),null;o.toLoad.forEach(a=>{this.loadOne(a)})}load(t,n,r){this.prepareLoading(t,n,{},r)}reload(t,n,r){this.prepareLoading(t,n,{reload:!0},r)}loadOne(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";const r=t.split("|"),i=r[0],o=r[1];this.read(i,o,"read",void 0,void 0,(a,s)=>{a&&this.logger.warn(`${n}loading namespace ${o} for language ${i} failed`,a),!a&&s&&this.logger.log(`${n}loaded namespace ${o} for language ${i}`,s),this.loaded(t,a,s)})}saveMissing(t,n,r,i,o){let a=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{},s=arguments.length>6&&arguments[6]!==void 0?arguments[6]:()=>{};if(this.services.utils&&this.services.utils.hasLoadedNamespace&&!this.services.utils.hasLoadedNamespace(n)){this.logger.warn(`did not save key "${r}" as the namespace "${n}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");return}if(!(r==null||r==="")){if(this.backend&&this.backend.create){const l={...a,isUpdate:o},u=this.backend.create.bind(this.backend);if(u.length<6)try{let c;u.length===5?c=u(t,n,r,i,l):c=u(t,n,r,i),c&&typeof c.then=="function"?c.then(d=>s(null,d)).catch(s):s(null,c)}catch(c){s(c)}else u(t,n,r,i,s,l)}!t||!t[0]||this.store.addResource(t[0],n,r,i)}}}function uI(){return{debug:!1,initImmediate:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!1,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:function(t){let n={};if(typeof t[1]=="object"&&(n=t[1]),typeof t[1]=="string"&&(n.defaultValue=t[1]),typeof t[2]=="string"&&(n.tDescription=t[2]),typeof t[2]=="object"||typeof t[3]=="object"){const r=t[3]||t[2];Object.keys(r).forEach(i=>{n[i]=r[i]})}return n},interpolation:{escapeValue:!0,format:(e,t,n,r)=>e,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0}}}function cI(e){return typeof e.ns=="string"&&(e.ns=[e.ns]),typeof e.fallbackLng=="string"&&(e.fallbackLng=[e.fallbackLng]),typeof e.fallbackNS=="string"&&(e.fallbackNS=[e.fallbackNS]),e.supportedLngs&&e.supportedLngs.indexOf("cimode")<0&&(e.supportedLngs=e.supportedLngs.concat(["cimode"])),e}function gv(){}function Vle(e){Object.getOwnPropertyNames(Object.getPrototypeOf(e)).forEach(n=>{typeof e[n]=="function"&&(e[n]=e[n].bind(e))})}class Wm extends YS{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;if(super(),this.options=cI(t),this.services={},this.logger=Ms,this.modules={external:[]},Vle(this),n&&!this.isInitialized&&!t.isClone){if(!this.options.initImmediate)return this.init(t,n),this;setTimeout(()=>{this.init(t,n)},0)}}init(){var t=this;let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0;typeof n=="function"&&(r=n,n={}),!n.defaultNS&&n.defaultNS!==!1&&n.ns&&(typeof n.ns=="string"?n.defaultNS=n.ns:n.ns.indexOf("translation")<0&&(n.defaultNS=n.ns[0]));const i=uI();this.options={...i,...this.options,...cI(n)},this.options.compatibilityAPI!=="v1"&&(this.options.interpolation={...i.interpolation,...this.options.interpolation}),n.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=n.keySeparator),n.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=n.nsSeparator);function o(c){return c?typeof c=="function"?new c:c:null}if(!this.options.isClone){this.modules.logger?Ms.init(o(this.modules.logger),this.options):Ms.init(null,this.options);let c;this.modules.formatter?c=this.modules.formatter:typeof Intl<"u"&&(c=zle);const d=new aI(this.options);this.store=new iI(this.options.resources,this.options);const f=this.services;f.logger=Ms,f.resourceStore=this.store,f.languageUtils=d,f.pluralResolver=new Lle(d,{prepend:this.options.pluralSeparator,compatibilityJSON:this.options.compatibilityJSON,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),c&&(!this.options.interpolation.format||this.options.interpolation.format===i.interpolation.format)&&(f.formatter=o(c),f.formatter.init(f,this.options),this.options.interpolation.format=f.formatter.format.bind(f.formatter)),f.interpolator=new Fle(this.options),f.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},f.backendConnector=new Ule(o(this.modules.backend),f.resourceStore,f,this.options),f.backendConnector.on("*",function(h){for(var p=arguments.length,m=new Array(p>1?p-1:0),_=1;_1?p-1:0),_=1;_{h.init&&h.init(this)})}if(this.format=this.options.interpolation.format,r||(r=gv),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const c=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);c.length>0&&c[0]!=="dev"&&(this.options.lng=c[0])}!this.services.languageDetector&&!this.options.lng&&this.logger.warn("init: no languageDetector is used and no lng is defined"),["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach(c=>{this[c]=function(){return t.store[c](...arguments)}}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(c=>{this[c]=function(){return t.store[c](...arguments),t}});const l=Gp(),u=()=>{const c=(d,f)=>{this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn("init: i18next is already initialized. You should call init just once!"),this.isInitialized=!0,this.options.isClone||this.logger.log("initialized",this.options),this.emit("initialized",this.options),l.resolve(f),r(d,f)};if(this.languages&&this.options.compatibilityAPI!=="v1"&&!this.isInitialized)return c(null,this.t.bind(this));this.changeLanguage(this.options.lng,c)};return this.options.resources||!this.options.initImmediate?u():setTimeout(u,0),l}loadResources(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:gv;const i=typeof t=="string"?t:this.language;if(typeof t=="function"&&(r=t),!this.options.resources||this.options.partialBundledLanguages){if(i&&i.toLowerCase()==="cimode")return r();const o=[],a=s=>{if(!s)return;this.services.languageUtils.toResolveHierarchy(s).forEach(u=>{o.indexOf(u)<0&&o.push(u)})};i?a(i):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(l=>a(l)),this.options.preload&&this.options.preload.forEach(s=>a(s)),this.services.backendConnector.load(o,this.options.ns,s=>{!s&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),r(s)})}else r(null)}reloadResources(t,n,r){const i=Gp();return t||(t=this.languages),n||(n=this.options.ns),r||(r=gv),this.services.backendConnector.reload(t,n,o=>{i.resolve(),r(o)}),i}use(t){if(!t)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!t.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return t.type==="backend"&&(this.modules.backend=t),(t.type==="logger"||t.log&&t.warn&&t.error)&&(this.modules.logger=t),t.type==="languageDetector"&&(this.modules.languageDetector=t),t.type==="i18nFormat"&&(this.modules.i18nFormat=t),t.type==="postProcessor"&&OB.addPostProcessor(t),t.type==="formatter"&&(this.modules.formatter=t),t.type==="3rdParty"&&this.modules.external.push(t),this}setResolvedLanguage(t){if(!(!t||!this.languages)&&!(["cimode","dev"].indexOf(t)>-1))for(let n=0;n-1)&&this.store.hasLanguageSomeTranslations(r)){this.resolvedLanguage=r;break}}}changeLanguage(t,n){var r=this;this.isLanguageChangingTo=t;const i=Gp();this.emit("languageChanging",t);const o=l=>{this.language=l,this.languages=this.services.languageUtils.toResolveHierarchy(l),this.resolvedLanguage=void 0,this.setResolvedLanguage(l)},a=(l,u)=>{u?(o(u),this.translator.changeLanguage(u),this.isLanguageChangingTo=void 0,this.emit("languageChanged",u),this.logger.log("languageChanged",u)):this.isLanguageChangingTo=void 0,i.resolve(function(){return r.t(...arguments)}),n&&n(l,function(){return r.t(...arguments)})},s=l=>{!t&&!l&&this.services.languageDetector&&(l=[]);const u=typeof l=="string"?l:this.services.languageUtils.getBestMatchFromCodes(l);u&&(this.language||o(u),this.translator.language||this.translator.changeLanguage(u),this.services.languageDetector&&this.services.languageDetector.cacheUserLanguage&&this.services.languageDetector.cacheUserLanguage(u)),this.loadResources(u,c=>{a(c,u)})};return!t&&this.services.languageDetector&&!this.services.languageDetector.async?s(this.services.languageDetector.detect()):!t&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(s):this.services.languageDetector.detect(s):s(t),i}getFixedT(t,n,r){var i=this;const o=function(a,s){let l;if(typeof s!="object"){for(var u=arguments.length,c=new Array(u>2?u-2:0),d=2;d`${l.keyPrefix}${f}${p}`):h=l.keyPrefix?`${l.keyPrefix}${f}${a}`:a,i.t(h,l)};return typeof t=="string"?o.lng=t:o.lngs=t,o.ns=n,o.keyPrefix=r,o}t(){return this.translator&&this.translator.translate(...arguments)}exists(){return this.translator&&this.translator.exists(...arguments)}setDefaultNamespace(t){this.options.defaultNS=t}hasLoadedNamespace(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;const r=n.lng||this.resolvedLanguage||this.languages[0],i=this.options?this.options.fallbackLng:!1,o=this.languages[this.languages.length-1];if(r.toLowerCase()==="cimode")return!0;const a=(s,l)=>{const u=this.services.backendConnector.state[`${s}|${l}`];return u===-1||u===2};if(n.precheck){const s=n.precheck(this,a);if(s!==void 0)return s}return!!(this.hasResourceBundle(r,t)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||a(r,t)&&(!i||a(o,t)))}loadNamespaces(t,n){const r=Gp();return this.options.ns?(typeof t=="string"&&(t=[t]),t.forEach(i=>{this.options.ns.indexOf(i)<0&&this.options.ns.push(i)}),this.loadResources(i=>{r.resolve(),n&&n(i)}),r):(n&&n(),Promise.resolve())}loadLanguages(t,n){const r=Gp();typeof t=="string"&&(t=[t]);const i=this.options.preload||[],o=t.filter(a=>i.indexOf(a)<0);return o.length?(this.options.preload=i.concat(o),this.loadResources(a=>{r.resolve(),n&&n(a)}),r):(n&&n(),Promise.resolve())}dir(t){if(t||(t=this.resolvedLanguage||(this.languages&&this.languages.length>0?this.languages[0]:this.language)),!t)return"rtl";const n=["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"],r=this.services&&this.services.languageUtils||new aI(uI());return n.indexOf(r.getLanguagePartFromCode(t))>-1||t.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;return new Wm(t,n)}cloneInstance(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:gv;const r=t.forkResourceStore;r&&delete t.forkResourceStore;const i={...this.options,...t,isClone:!0},o=new Wm(i);return(t.debug!==void 0||t.prefix!==void 0)&&(o.logger=o.logger.clone(t)),["store","services","language"].forEach(s=>{o[s]=this[s]}),o.services={...this.services},o.services.utils={hasLoadedNamespace:o.hasLoadedNamespace.bind(o)},r&&(o.store=new iI(this.store.data,i),o.services.resourceStore=o.store),o.translator=new o_(o.services,i),o.translator.on("*",function(s){for(var l=arguments.length,u=new Array(l>1?l-1:0),c=1;cMB.safeParse(e).success||Gle.safeParse(e).success;z.enum(["connection","direct","any"]);const NB=z.object({id:z.string().trim().min(1),name:z.string().trim().min(1),type:MB}),Hle=NB.extend({fieldKind:z.literal("output")}),vt=NB.extend({fieldKind:z.literal("input"),label:z.string()}),Ud=z.object({model_name:z.string().trim().min(1),base_model:jd}),uy=z.object({image_name:z.string().trim().min(1)}),qle=z.object({board_id:z.string().trim().min(1)}),a_=z.object({latents_name:z.string().trim().min(1),seed:z.number().int().optional()}),s_=z.object({conditioning_name:z.string().trim().min(1)}),Wle=z.object({mask_name:z.string().trim().min(1),masked_latents_name:z.string().trim().min(1).optional()}),Kle=vt.extend({type:z.literal("integer"),value:z.number().int().optional()}),Qle=vt.extend({type:z.literal("IntegerCollection"),value:z.array(z.number().int()).optional()}),Xle=vt.extend({type:z.literal("IntegerPolymorphic"),value:z.number().int().optional()}),Yle=vt.extend({type:z.literal("float"),value:z.number().optional()}),Zle=vt.extend({type:z.literal("FloatCollection"),value:z.array(z.number()).optional()}),Jle=vt.extend({type:z.literal("FloatPolymorphic"),value:z.number().optional()}),eue=vt.extend({type:z.literal("string"),value:z.string().optional()}),tue=vt.extend({type:z.literal("StringCollection"),value:z.array(z.string()).optional()}),nue=vt.extend({type:z.literal("StringPolymorphic"),value:z.string().optional()}),rue=vt.extend({type:z.literal("boolean"),value:z.boolean().optional()}),iue=vt.extend({type:z.literal("BooleanCollection"),value:z.array(z.boolean()).optional()}),oue=vt.extend({type:z.literal("BooleanPolymorphic"),value:z.boolean().optional()}),aue=vt.extend({type:z.literal("enum"),value:z.string().optional()}),sue=vt.extend({type:z.literal("LatentsField"),value:a_.optional()}),lue=vt.extend({type:z.literal("LatentsCollection"),value:z.array(a_).optional()}),uue=vt.extend({type:z.literal("LatentsPolymorphic"),value:z.union([a_,z.array(a_)]).optional()}),cue=vt.extend({type:z.literal("DenoiseMaskField"),value:Wle.optional()}),due=vt.extend({type:z.literal("ConditioningField"),value:s_.optional()}),fue=vt.extend({type:z.literal("ConditioningCollection"),value:z.array(s_).optional()}),hue=vt.extend({type:z.literal("ConditioningPolymorphic"),value:z.union([s_,z.array(s_)]).optional()}),pue=Ud,Km=z.object({image:uy,control_model:pue,control_weight:z.union([z.number(),z.array(z.number())]).optional(),begin_step_percent:z.number().optional(),end_step_percent:z.number().optional(),control_mode:z.enum(["balanced","more_prompt","more_control","unbalanced"]).optional(),resize_mode:z.enum(["just_resize","crop_resize","fill_resize","just_resize_simple"]).optional()}),gue=vt.extend({type:z.literal("ControlField"),value:Km.optional()}),mue=vt.extend({type:z.literal("ControlPolymorphic"),value:z.union([Km,z.array(Km)]).optional()}),yue=vt.extend({type:z.literal("ControlCollection"),value:z.array(Km).optional()}),$B=Ud,DB=z.object({image:uy,ip_adapter_model:$B,weight:z.number(),begin_step_percent:z.number().optional(),end_step_percent:z.number().optional()}),vue=vt.extend({type:z.literal("IPAdapterField"),value:DB.optional()}),bue=z.enum(["onnx","main","vae","lora","controlnet","embedding"]),_ue=z.enum(["unet","text_encoder","text_encoder_2","tokenizer","tokenizer_2","vae","vae_decoder","vae_encoder","scheduler","safety_checker"]),Wh=Ud.extend({model_type:bue,submodel:_ue.optional()}),LB=Wh.extend({weight:z.number().optional()}),Sue=z.object({unet:Wh,scheduler:Wh,loras:z.array(LB)}),xue=vt.extend({type:z.literal("UNetField"),value:Sue.optional()}),wue=z.object({tokenizer:Wh,text_encoder:Wh,skipped_layers:z.number(),loras:z.array(LB)}),Cue=vt.extend({type:z.literal("ClipField"),value:wue.optional()}),Eue=z.object({vae:Wh}),kue=vt.extend({type:z.literal("VaeField"),value:Eue.optional()}),Tue=vt.extend({type:z.literal("ImageField"),value:uy.optional()}),Aue=vt.extend({type:z.literal("BoardField"),value:qle.optional()}),Pue=vt.extend({type:z.literal("ImagePolymorphic"),value:uy.optional()}),Iue=vt.extend({type:z.literal("ImageCollection"),value:z.array(uy).optional()}),Rue=vt.extend({type:z.literal("MainModelField"),value:ly.optional()}),Oue=vt.extend({type:z.literal("SDXLMainModelField"),value:ly.optional()}),Mue=vt.extend({type:z.literal("SDXLRefinerModelField"),value:ly.optional()}),FB=Ud,Nue=vt.extend({type:z.literal("VaeModelField"),value:FB.optional()}),BB=Ud,$ue=vt.extend({type:z.literal("LoRAModelField"),value:BB.optional()}),Due=Ud,Lue=vt.extend({type:z.literal("ControlNetModelField"),value:Due.optional()}),Fue=Ud,Bue=vt.extend({type:z.literal("IPAdapterModelField"),value:Fue.optional()}),zue=vt.extend({type:z.literal("Collection"),value:z.array(z.any()).optional()}),jue=vt.extend({type:z.literal("CollectionItem"),value:z.any().optional()}),l_=z.object({r:z.number().int().min(0).max(255),g:z.number().int().min(0).max(255),b:z.number().int().min(0).max(255),a:z.number().int().min(0).max(255)}),Uue=vt.extend({type:z.literal("ColorField"),value:l_.optional()}),Vue=vt.extend({type:z.literal("ColorCollection"),value:z.array(l_).optional()}),Gue=vt.extend({type:z.literal("ColorPolymorphic"),value:z.union([l_,z.array(l_)]).optional()}),Hue=vt.extend({type:z.literal("Scheduler"),value:bB.optional()}),que=z.discriminatedUnion("type",[Aue,iue,rue,oue,Cue,zue,jue,Uue,Vue,Gue,due,fue,hue,gue,Lue,yue,mue,cue,aue,Zle,Yle,Jle,Iue,Pue,Tue,Qle,Xle,Kle,vue,Bue,sue,lue,uue,$ue,Rue,Hue,Oue,Mue,tue,nue,eue,xue,kue,Nue]),lGe=e=>!!(e&&e.fieldKind==="input"),uGe=e=>!!(e&&e.fieldKind==="input"),Wue=e=>!!(e&&!("$ref"in e)),fI=e=>!!(e&&!("$ref"in e)&&e.type==="array"),mv=e=>!!(e&&!("$ref"in e)&&e.type!=="array"),Hp=e=>!!(e&&"$ref"in e),Kue=e=>"class"in e&&e.class==="invocation",Que=e=>"class"in e&&e.class==="output",hI=e=>!("$ref"in e),Xue=z.object({lora:BB.deepPartial(),weight:z.number()}),Yue=Km.deepPartial(),Zue=DB.deepPartial(),zB=z.object({app_version:z.string().nullish().catch(null),generation_mode:z.string().nullish().catch(null),created_by:z.string().nullish().catch(null),positive_prompt:z.string().nullish().catch(null),negative_prompt:z.string().nullish().catch(null),width:z.number().int().nullish().catch(null),height:z.number().int().nullish().catch(null),seed:z.number().int().nullish().catch(null),rand_device:z.string().nullish().catch(null),cfg_scale:z.number().nullish().catch(null),steps:z.number().int().nullish().catch(null),scheduler:z.string().nullish().catch(null),clip_skip:z.number().int().nullish().catch(null),model:z.union([QS.deepPartial(),_B.deepPartial()]).nullish().catch(null),controlnets:z.array(Yue).nullish().catch(null),ipAdapters:z.array(Zue).nullish().catch(null),loras:z.array(Xue).nullish().catch(null),vae:FB.nullish().catch(null),strength:z.number().nullish().catch(null),init_image:z.string().nullish().catch(null),positive_style_prompt:z.string().nullish().catch(null),negative_style_prompt:z.string().nullish().catch(null),refiner_model:hT.deepPartial().nullish().catch(null),refiner_cfg_scale:z.number().nullish().catch(null),refiner_steps:z.number().int().nullish().catch(null),refiner_scheduler:z.string().nullish().catch(null),refiner_positive_aesthetic_score:z.number().nullish().catch(null),refiner_negative_aesthetic_score:z.number().nullish().catch(null),refiner_start:z.number().nullish().catch(null)}).passthrough(),vT=z.string().refine(e=>{const[t,n,r]=e.split(".");return t!==void 0&&Number.isInteger(Number(t))&&n!==void 0&&Number.isInteger(Number(n))&&r!==void 0&&Number.isInteger(Number(r))});vT.transform(e=>{const[t,n,r]=e.split(".");return{major:Number(t),minor:Number(n),patch:Number(r)}});const pI=z.object({id:z.string().trim().min(1),type:z.string().trim().min(1),inputs:z.record(que),outputs:z.record(Hle),label:z.string(),isOpen:z.boolean(),notes:z.string(),embedWorkflow:z.boolean(),isIntermediate:z.boolean(),useCache:z.boolean().optional(),version:vT.optional()}),Jue=z.preprocess(e=>{var t;try{const n=pI.parse(e);if(!koe(n,"useCache")){const r=(t=IB.get())==null?void 0:t.getState().nodes.nodeTemplates,i=r==null?void 0:r[n.type];let o=!0;i&&(o=i.useCache),Object.assign(n,{useCache:o})}return n}catch{return e}},pI.extend({useCache:z.boolean()})),ece=z.object({id:z.string().trim().min(1),type:z.literal("notes"),label:z.string(),isOpen:z.boolean(),notes:z.string()}),jB=z.object({x:z.number(),y:z.number()}).default({x:0,y:0}),u_=z.number().gt(0).nullish(),UB=z.object({id:z.string().trim().min(1),type:z.literal("invocation"),data:Jue,width:u_,height:u_,position:jB}),rE=e=>UB.safeParse(e).success,tce=z.object({id:z.string().trim().min(1),type:z.literal("notes"),data:ece,width:u_,height:u_,position:jB}),VB=z.discriminatedUnion("type",[UB,tce]),nce=z.object({source:z.string().trim().min(1),sourceHandle:z.string().trim().min(1),target:z.string().trim().min(1),targetHandle:z.string().trim().min(1),id:z.string().trim().min(1),type:z.literal("default")}),rce=z.object({source:z.string().trim().min(1),target:z.string().trim().min(1),id:z.string().trim().min(1),type:z.literal("collapsed")}),GB=z.union([nce,rce]),ice=z.object({nodeId:z.string().trim().min(1),fieldName:z.string().trim().min(1)}),oce="1.0.0",HB=z.object({name:z.string().default(""),author:z.string().default(""),description:z.string().default(""),version:z.string().default(""),contact:z.string().default(""),tags:z.string().default(""),notes:z.string().default(""),nodes:z.array(VB).default([]),edges:z.array(GB).default([]),exposedFields:z.array(ice).default([]),meta:z.object({version:vT}).default({version:oce})});HB.transform(e=>{const{nodes:t,edges:n}=e,r=[],i=t.filter(rE),o=fT(i,"id");return n.forEach((a,s)=>{const l=o[a.source],u=o[a.target],c=[];if(l?a.type==="default"&&!(a.sourceHandle in l.data.outputs)&&c.push(`${be.t("nodes.outputField")}"${a.source}.${a.sourceHandle}" ${be.t("nodes.doesNotExist")}`):c.push(`${be.t("nodes.outputNode")} ${a.source} ${be.t("nodes.doesNotExist")}`),u?a.type==="default"&&!(a.targetHandle in u.data.inputs)&&c.push(`${be.t("nodes.inputField")} "${a.target}.${a.targetHandle}" ${be.t("nodes.doesNotExist")}`):c.push(`${be.t("nodes.inputNode")} ${a.target} ${be.t("nodes.doesNotExist")}`),c.length){delete n[s];const d=a.type==="default"?a.sourceHandle:a.source,f=a.type==="default"?a.targetHandle:a.target;r.push({message:`${be.t("nodes.edge")} "${d} -> ${f}" ${be.t("nodes.skipped")}`,issues:c,data:a})}}),{workflow:e,warnings:r}});const jr=e=>!!(e&&e.type==="invocation"),cGe=e=>!!(e&&!["notes","current_image"].includes(e.type)),gI=e=>!!(e&&e.type==="notes");var Hc=(e=>(e[e.PENDING=0]="PENDING",e[e.IN_PROGRESS=1]="IN_PROGRESS",e[e.COMPLETED=2]="COMPLETED",e[e.FAILED=3]="FAILED",e))(Hc||{});/*! pako 2.1.0 https://github.com/nodeca/pako @license (MIT AND Zlib) */const ace=4,mI=0,yI=1,sce=2;function yp(e){let t=e.length;for(;--t>=0;)e[t]=0}const lce=0,qB=1,uce=2,cce=3,dce=258,bT=29,cy=256,Qm=cy+1+bT,hh=30,_T=19,WB=2*Qm+1,ed=15,oC=16,fce=7,ST=256,KB=16,QB=17,XB=18,iE=new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]),N1=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]),hce=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),YB=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),pce=512,bl=new Array((Qm+2)*2);yp(bl);const Hg=new Array(hh*2);yp(Hg);const Xm=new Array(pce);yp(Xm);const Ym=new Array(dce-cce+1);yp(Ym);const xT=new Array(bT);yp(xT);const c_=new Array(hh);yp(c_);function aC(e,t,n,r,i){this.static_tree=e,this.extra_bits=t,this.extra_base=n,this.elems=r,this.max_length=i,this.has_stree=e&&e.length}let ZB,JB,ez;function sC(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}const tz=e=>e<256?Xm[e]:Xm[256+(e>>>7)],Zm=(e,t)=>{e.pending_buf[e.pending++]=t&255,e.pending_buf[e.pending++]=t>>>8&255},wo=(e,t,n)=>{e.bi_valid>oC-n?(e.bi_buf|=t<>oC-e.bi_valid,e.bi_valid+=n-oC):(e.bi_buf|=t<{wo(e,n[t*2],n[t*2+1])},nz=(e,t)=>{let n=0;do n|=e&1,e>>>=1,n<<=1;while(--t>0);return n>>>1},gce=e=>{e.bi_valid===16?(Zm(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):e.bi_valid>=8&&(e.pending_buf[e.pending++]=e.bi_buf&255,e.bi_buf>>=8,e.bi_valid-=8)},mce=(e,t)=>{const n=t.dyn_tree,r=t.max_code,i=t.stat_desc.static_tree,o=t.stat_desc.has_stree,a=t.stat_desc.extra_bits,s=t.stat_desc.extra_base,l=t.stat_desc.max_length;let u,c,d,f,h,p,m=0;for(f=0;f<=ed;f++)e.bl_count[f]=0;for(n[e.heap[e.heap_max]*2+1]=0,u=e.heap_max+1;ul&&(f=l,m++),n[c*2+1]=f,!(c>r)&&(e.bl_count[f]++,h=0,c>=s&&(h=a[c-s]),p=n[c*2],e.opt_len+=p*(f+h),o&&(e.static_len+=p*(i[c*2+1]+h)));if(m!==0){do{for(f=l-1;e.bl_count[f]===0;)f--;e.bl_count[f]--,e.bl_count[f+1]+=2,e.bl_count[l]--,m-=2}while(m>0);for(f=l;f!==0;f--)for(c=e.bl_count[f];c!==0;)d=e.heap[--u],!(d>r)&&(n[d*2+1]!==f&&(e.opt_len+=(f-n[d*2+1])*n[d*2],n[d*2+1]=f),c--)}},rz=(e,t,n)=>{const r=new Array(ed+1);let i=0,o,a;for(o=1;o<=ed;o++)i=i+n[o-1]<<1,r[o]=i;for(a=0;a<=t;a++){let s=e[a*2+1];s!==0&&(e[a*2]=nz(r[s]++,s))}},yce=()=>{let e,t,n,r,i;const o=new Array(ed+1);for(n=0,r=0;r>=7;r{let t;for(t=0;t{e.bi_valid>8?Zm(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0},vI=(e,t,n,r)=>{const i=t*2,o=n*2;return e[i]{const r=e.heap[n];let i=n<<1;for(;i<=e.heap_len&&(i{let r,i,o=0,a,s;if(e.sym_next!==0)do r=e.pending_buf[e.sym_buf+o++]&255,r+=(e.pending_buf[e.sym_buf+o++]&255)<<8,i=e.pending_buf[e.sym_buf+o++],r===0?Ps(e,i,t):(a=Ym[i],Ps(e,a+cy+1,t),s=iE[a],s!==0&&(i-=xT[a],wo(e,i,s)),r--,a=tz(r),Ps(e,a,n),s=N1[a],s!==0&&(r-=c_[a],wo(e,r,s)));while(o{const n=t.dyn_tree,r=t.stat_desc.static_tree,i=t.stat_desc.has_stree,o=t.stat_desc.elems;let a,s,l=-1,u;for(e.heap_len=0,e.heap_max=WB,a=0;a>1;a>=1;a--)lC(e,n,a);u=o;do a=e.heap[1],e.heap[1]=e.heap[e.heap_len--],lC(e,n,1),s=e.heap[1],e.heap[--e.heap_max]=a,e.heap[--e.heap_max]=s,n[u*2]=n[a*2]+n[s*2],e.depth[u]=(e.depth[a]>=e.depth[s]?e.depth[a]:e.depth[s])+1,n[a*2+1]=n[s*2+1]=u,e.heap[1]=u++,lC(e,n,1);while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],mce(e,t),rz(n,l,e.bl_count)},_I=(e,t,n)=>{let r,i=-1,o,a=t[0*2+1],s=0,l=7,u=4;for(a===0&&(l=138,u=3),t[(n+1)*2+1]=65535,r=0;r<=n;r++)o=a,a=t[(r+1)*2+1],!(++s{let r,i=-1,o,a=t[0*2+1],s=0,l=7,u=4;for(a===0&&(l=138,u=3),r=0;r<=n;r++)if(o=a,a=t[(r+1)*2+1],!(++s{let t;for(_I(e,e.dyn_ltree,e.l_desc.max_code),_I(e,e.dyn_dtree,e.d_desc.max_code),oE(e,e.bl_desc),t=_T-1;t>=3&&e.bl_tree[YB[t]*2+1]===0;t--);return e.opt_len+=3*(t+1)+5+5+4,t},bce=(e,t,n,r)=>{let i;for(wo(e,t-257,5),wo(e,n-1,5),wo(e,r-4,4),i=0;i{let t=4093624447,n;for(n=0;n<=31;n++,t>>>=1)if(t&1&&e.dyn_ltree[n*2]!==0)return mI;if(e.dyn_ltree[9*2]!==0||e.dyn_ltree[10*2]!==0||e.dyn_ltree[13*2]!==0)return yI;for(n=32;n{xI||(yce(),xI=!0),e.l_desc=new sC(e.dyn_ltree,ZB),e.d_desc=new sC(e.dyn_dtree,JB),e.bl_desc=new sC(e.bl_tree,ez),e.bi_buf=0,e.bi_valid=0,iz(e)},az=(e,t,n,r)=>{wo(e,(lce<<1)+(r?1:0),3),oz(e),Zm(e,n),Zm(e,~n),n&&e.pending_buf.set(e.window.subarray(t,t+n),e.pending),e.pending+=n},xce=e=>{wo(e,qB<<1,3),Ps(e,ST,bl),gce(e)},wce=(e,t,n,r)=>{let i,o,a=0;e.level>0?(e.strm.data_type===sce&&(e.strm.data_type=_ce(e)),oE(e,e.l_desc),oE(e,e.d_desc),a=vce(e),i=e.opt_len+3+7>>>3,o=e.static_len+3+7>>>3,o<=i&&(i=o)):i=o=n+5,n+4<=i&&t!==-1?az(e,t,n,r):e.strategy===ace||o===i?(wo(e,(qB<<1)+(r?1:0),3),bI(e,bl,Hg)):(wo(e,(uce<<1)+(r?1:0),3),bce(e,e.l_desc.max_code+1,e.d_desc.max_code+1,a+1),bI(e,e.dyn_ltree,e.dyn_dtree)),iz(e),r&&oz(e)},Cce=(e,t,n)=>(e.pending_buf[e.sym_buf+e.sym_next++]=t,e.pending_buf[e.sym_buf+e.sym_next++]=t>>8,e.pending_buf[e.sym_buf+e.sym_next++]=n,t===0?e.dyn_ltree[n*2]++:(e.matches++,t--,e.dyn_ltree[(Ym[n]+cy+1)*2]++,e.dyn_dtree[tz(t)*2]++),e.sym_next===e.sym_end);var Ece=Sce,kce=az,Tce=wce,Ace=Cce,Pce=xce,Ice={_tr_init:Ece,_tr_stored_block:kce,_tr_flush_block:Tce,_tr_tally:Ace,_tr_align:Pce};const Rce=(e,t,n,r)=>{let i=e&65535|0,o=e>>>16&65535|0,a=0;for(;n!==0;){a=n>2e3?2e3:n,n-=a;do i=i+t[r++]|0,o=o+i|0;while(--a);i%=65521,o%=65521}return i|o<<16|0};var Jm=Rce;const Oce=()=>{let e,t=[];for(var n=0;n<256;n++){e=n;for(var r=0;r<8;r++)e=e&1?3988292384^e>>>1:e>>>1;t[n]=e}return t},Mce=new Uint32Array(Oce()),Nce=(e,t,n,r)=>{const i=Mce,o=r+n;e^=-1;for(let a=r;a>>8^i[(e^t[a])&255];return e^-1};var ai=Nce,Kh={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},dy={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8};const{_tr_init:$ce,_tr_stored_block:aE,_tr_flush_block:Dce,_tr_tally:Hu,_tr_align:Lce}=Ice,{Z_NO_FLUSH:qu,Z_PARTIAL_FLUSH:Fce,Z_FULL_FLUSH:Bce,Z_FINISH:ya,Z_BLOCK:wI,Z_OK:Ei,Z_STREAM_END:CI,Z_STREAM_ERROR:zs,Z_DATA_ERROR:zce,Z_BUF_ERROR:uC,Z_DEFAULT_COMPRESSION:jce,Z_FILTERED:Uce,Z_HUFFMAN_ONLY:yv,Z_RLE:Vce,Z_FIXED:Gce,Z_DEFAULT_STRATEGY:Hce,Z_UNKNOWN:qce,Z_DEFLATED:ZS}=dy,Wce=9,Kce=15,Qce=8,Xce=29,Yce=256,sE=Yce+1+Xce,Zce=30,Jce=19,ede=2*sE+1,tde=15,Bt=3,Nu=258,js=Nu+Bt+1,nde=32,Qh=42,wT=57,lE=69,uE=73,cE=91,dE=103,td=113,vg=666,eo=1,vp=2,Pd=3,bp=4,rde=3,nd=(e,t)=>(e.msg=Kh[t],t),EI=e=>e*2-(e>4?9:0),Cu=e=>{let t=e.length;for(;--t>=0;)e[t]=0},ide=e=>{let t,n,r,i=e.w_size;t=e.hash_size,r=t;do n=e.head[--r],e.head[r]=n>=i?n-i:0;while(--t);t=i,r=t;do n=e.prev[--r],e.prev[r]=n>=i?n-i:0;while(--t)};let ode=(e,t,n)=>(t<{const t=e.state;let n=t.pending;n>e.avail_out&&(n=e.avail_out),n!==0&&(e.output.set(t.pending_buf.subarray(t.pending_out,t.pending_out+n),e.next_out),e.next_out+=n,t.pending_out+=n,e.total_out+=n,e.avail_out-=n,t.pending-=n,t.pending===0&&(t.pending_out=0))},qo=(e,t)=>{Dce(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,Fo(e.strm)},on=(e,t)=>{e.pending_buf[e.pending++]=t},qp=(e,t)=>{e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=t&255},fE=(e,t,n,r)=>{let i=e.avail_in;return i>r&&(i=r),i===0?0:(e.avail_in-=i,t.set(e.input.subarray(e.next_in,e.next_in+i),n),e.state.wrap===1?e.adler=Jm(e.adler,t,i,n):e.state.wrap===2&&(e.adler=ai(e.adler,t,i,n)),e.next_in+=i,e.total_in+=i,i)},sz=(e,t)=>{let n=e.max_chain_length,r=e.strstart,i,o,a=e.prev_length,s=e.nice_match;const l=e.strstart>e.w_size-js?e.strstart-(e.w_size-js):0,u=e.window,c=e.w_mask,d=e.prev,f=e.strstart+Nu;let h=u[r+a-1],p=u[r+a];e.prev_length>=e.good_match&&(n>>=2),s>e.lookahead&&(s=e.lookahead);do if(i=t,!(u[i+a]!==p||u[i+a-1]!==h||u[i]!==u[r]||u[++i]!==u[r+1])){r+=2,i++;do;while(u[++r]===u[++i]&&u[++r]===u[++i]&&u[++r]===u[++i]&&u[++r]===u[++i]&&u[++r]===u[++i]&&u[++r]===u[++i]&&u[++r]===u[++i]&&u[++r]===u[++i]&&ra){if(e.match_start=t,a=o,o>=s)break;h=u[r+a-1],p=u[r+a]}}while((t=d[t&c])>l&&--n!==0);return a<=e.lookahead?a:e.lookahead},Xh=e=>{const t=e.w_size;let n,r,i;do{if(r=e.window_size-e.lookahead-e.strstart,e.strstart>=t+(t-js)&&(e.window.set(e.window.subarray(t,t+t-r),0),e.match_start-=t,e.strstart-=t,e.block_start-=t,e.insert>e.strstart&&(e.insert=e.strstart),ide(e),r+=t),e.strm.avail_in===0)break;if(n=fE(e.strm,e.window,e.strstart+e.lookahead,r),e.lookahead+=n,e.lookahead+e.insert>=Bt)for(i=e.strstart-e.insert,e.ins_h=e.window[i],e.ins_h=Wu(e,e.ins_h,e.window[i+1]);e.insert&&(e.ins_h=Wu(e,e.ins_h,e.window[i+Bt-1]),e.prev[i&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=i,i++,e.insert--,!(e.lookahead+e.insert{let n=e.pending_buf_size-5>e.w_size?e.w_size:e.pending_buf_size-5,r,i,o,a=0,s=e.strm.avail_in;do{if(r=65535,o=e.bi_valid+42>>3,e.strm.avail_outi+e.strm.avail_in&&(r=i+e.strm.avail_in),r>o&&(r=o),r>8,e.pending_buf[e.pending-2]=~r,e.pending_buf[e.pending-1]=~r>>8,Fo(e.strm),i&&(i>r&&(i=r),e.strm.output.set(e.window.subarray(e.block_start,e.block_start+i),e.strm.next_out),e.strm.next_out+=i,e.strm.avail_out-=i,e.strm.total_out+=i,e.block_start+=i,r-=i),r&&(fE(e.strm,e.strm.output,e.strm.next_out,r),e.strm.next_out+=r,e.strm.avail_out-=r,e.strm.total_out+=r)}while(a===0);return s-=e.strm.avail_in,s&&(s>=e.w_size?(e.matches=2,e.window.set(e.strm.input.subarray(e.strm.next_in-e.w_size,e.strm.next_in),0),e.strstart=e.w_size,e.insert=e.strstart):(e.window_size-e.strstart<=s&&(e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,e.insert>e.strstart&&(e.insert=e.strstart)),e.window.set(e.strm.input.subarray(e.strm.next_in-s,e.strm.next_in),e.strstart),e.strstart+=s,e.insert+=s>e.w_size-e.insert?e.w_size-e.insert:s),e.block_start=e.strstart),e.high_watero&&e.block_start>=e.w_size&&(e.block_start-=e.w_size,e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,o+=e.w_size,e.insert>e.strstart&&(e.insert=e.strstart)),o>e.strm.avail_in&&(o=e.strm.avail_in),o&&(fE(e.strm,e.window,e.strstart,o),e.strstart+=o,e.insert+=o>e.w_size-e.insert?e.w_size-e.insert:o),e.high_water>3,o=e.pending_buf_size-o>65535?65535:e.pending_buf_size-o,n=o>e.w_size?e.w_size:o,i=e.strstart-e.block_start,(i>=n||(i||t===ya)&&t!==qu&&e.strm.avail_in===0&&i<=o)&&(r=i>o?o:i,a=t===ya&&e.strm.avail_in===0&&r===i?1:0,aE(e,e.block_start,r,a),e.block_start+=r,Fo(e.strm)),a?Pd:eo)},cC=(e,t)=>{let n,r;for(;;){if(e.lookahead=Bt&&(e.ins_h=Wu(e,e.ins_h,e.window[e.strstart+Bt-1]),n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),n!==0&&e.strstart-n<=e.w_size-js&&(e.match_length=sz(e,n)),e.match_length>=Bt)if(r=Hu(e,e.strstart-e.match_start,e.match_length-Bt),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=Bt){e.match_length--;do e.strstart++,e.ins_h=Wu(e,e.ins_h,e.window[e.strstart+Bt-1]),n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart;while(--e.match_length!==0);e.strstart++}else e.strstart+=e.match_length,e.match_length=0,e.ins_h=e.window[e.strstart],e.ins_h=Wu(e,e.ins_h,e.window[e.strstart+1]);else r=Hu(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(r&&(qo(e,!1),e.strm.avail_out===0))return eo}return e.insert=e.strstart{let n,r,i;for(;;){if(e.lookahead=Bt&&(e.ins_h=Wu(e,e.ins_h,e.window[e.strstart+Bt-1]),n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),e.prev_length=e.match_length,e.prev_match=e.match_start,e.match_length=Bt-1,n!==0&&e.prev_length4096)&&(e.match_length=Bt-1)),e.prev_length>=Bt&&e.match_length<=e.prev_length){i=e.strstart+e.lookahead-Bt,r=Hu(e,e.strstart-1-e.prev_match,e.prev_length-Bt),e.lookahead-=e.prev_length-1,e.prev_length-=2;do++e.strstart<=i&&(e.ins_h=Wu(e,e.ins_h,e.window[e.strstart+Bt-1]),n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart);while(--e.prev_length!==0);if(e.match_available=0,e.match_length=Bt-1,e.strstart++,r&&(qo(e,!1),e.strm.avail_out===0))return eo}else if(e.match_available){if(r=Hu(e,0,e.window[e.strstart-1]),r&&qo(e,!1),e.strstart++,e.lookahead--,e.strm.avail_out===0)return eo}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&(r=Hu(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart{let n,r,i,o;const a=e.window;for(;;){if(e.lookahead<=Nu){if(Xh(e),e.lookahead<=Nu&&t===qu)return eo;if(e.lookahead===0)break}if(e.match_length=0,e.lookahead>=Bt&&e.strstart>0&&(i=e.strstart-1,r=a[i],r===a[++i]&&r===a[++i]&&r===a[++i])){o=e.strstart+Nu;do;while(r===a[++i]&&r===a[++i]&&r===a[++i]&&r===a[++i]&&r===a[++i]&&r===a[++i]&&r===a[++i]&&r===a[++i]&&ie.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=Bt?(n=Hu(e,1,e.match_length-Bt),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(n=Hu(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),n&&(qo(e,!1),e.strm.avail_out===0))return eo}return e.insert=0,t===ya?(qo(e,!0),e.strm.avail_out===0?Pd:bp):e.sym_next&&(qo(e,!1),e.strm.avail_out===0)?eo:vp},sde=(e,t)=>{let n;for(;;){if(e.lookahead===0&&(Xh(e),e.lookahead===0)){if(t===qu)return eo;break}if(e.match_length=0,n=Hu(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,n&&(qo(e,!1),e.strm.avail_out===0))return eo}return e.insert=0,t===ya?(qo(e,!0),e.strm.avail_out===0?Pd:bp):e.sym_next&&(qo(e,!1),e.strm.avail_out===0)?eo:vp};function ms(e,t,n,r,i){this.good_length=e,this.max_lazy=t,this.nice_length=n,this.max_chain=r,this.func=i}const bg=[new ms(0,0,0,0,lz),new ms(4,4,8,4,cC),new ms(4,5,16,8,cC),new ms(4,6,32,32,cC),new ms(4,4,16,16,uf),new ms(8,16,32,32,uf),new ms(8,16,128,128,uf),new ms(8,32,128,256,uf),new ms(32,128,258,1024,uf),new ms(32,258,258,4096,uf)],lde=e=>{e.window_size=2*e.w_size,Cu(e.head),e.max_lazy_match=bg[e.level].max_lazy,e.good_match=bg[e.level].good_length,e.nice_match=bg[e.level].nice_length,e.max_chain_length=bg[e.level].max_chain,e.strstart=0,e.block_start=0,e.lookahead=0,e.insert=0,e.match_length=e.prev_length=Bt-1,e.match_available=0,e.ins_h=0};function ude(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=ZS,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(ede*2),this.dyn_dtree=new Uint16Array((2*Zce+1)*2),this.bl_tree=new Uint16Array((2*Jce+1)*2),Cu(this.dyn_ltree),Cu(this.dyn_dtree),Cu(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(tde+1),this.heap=new Uint16Array(2*sE+1),Cu(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(2*sE+1),Cu(this.depth),this.sym_buf=0,this.lit_bufsize=0,this.sym_next=0,this.sym_end=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}const fy=e=>{if(!e)return 1;const t=e.state;return!t||t.strm!==e||t.status!==Qh&&t.status!==wT&&t.status!==lE&&t.status!==uE&&t.status!==cE&&t.status!==dE&&t.status!==td&&t.status!==vg?1:0},uz=e=>{if(fy(e))return nd(e,zs);e.total_in=e.total_out=0,e.data_type=qce;const t=e.state;return t.pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=t.wrap===2?wT:t.wrap?Qh:td,e.adler=t.wrap===2?0:1,t.last_flush=-2,$ce(t),Ei},cz=e=>{const t=uz(e);return t===Ei&&lde(e.state),t},cde=(e,t)=>fy(e)||e.state.wrap!==2?zs:(e.state.gzhead=t,Ei),dz=(e,t,n,r,i,o)=>{if(!e)return zs;let a=1;if(t===jce&&(t=6),r<0?(a=0,r=-r):r>15&&(a=2,r-=16),i<1||i>Wce||n!==ZS||r<8||r>15||t<0||t>9||o<0||o>Gce||r===8&&a!==1)return nd(e,zs);r===8&&(r=9);const s=new ude;return e.state=s,s.strm=e,s.status=Qh,s.wrap=a,s.gzhead=null,s.w_bits=r,s.w_size=1<dz(e,t,ZS,Kce,Qce,Hce),fde=(e,t)=>{if(fy(e)||t>wI||t<0)return e?nd(e,zs):zs;const n=e.state;if(!e.output||e.avail_in!==0&&!e.input||n.status===vg&&t!==ya)return nd(e,e.avail_out===0?uC:zs);const r=n.last_flush;if(n.last_flush=t,n.pending!==0){if(Fo(e),e.avail_out===0)return n.last_flush=-1,Ei}else if(e.avail_in===0&&EI(t)<=EI(r)&&t!==ya)return nd(e,uC);if(n.status===vg&&e.avail_in!==0)return nd(e,uC);if(n.status===Qh&&n.wrap===0&&(n.status=td),n.status===Qh){let i=ZS+(n.w_bits-8<<4)<<8,o=-1;if(n.strategy>=yv||n.level<2?o=0:n.level<6?o=1:n.level===6?o=2:o=3,i|=o<<6,n.strstart!==0&&(i|=nde),i+=31-i%31,qp(n,i),n.strstart!==0&&(qp(n,e.adler>>>16),qp(n,e.adler&65535)),e.adler=1,n.status=td,Fo(e),n.pending!==0)return n.last_flush=-1,Ei}if(n.status===wT){if(e.adler=0,on(n,31),on(n,139),on(n,8),n.gzhead)on(n,(n.gzhead.text?1:0)+(n.gzhead.hcrc?2:0)+(n.gzhead.extra?4:0)+(n.gzhead.name?8:0)+(n.gzhead.comment?16:0)),on(n,n.gzhead.time&255),on(n,n.gzhead.time>>8&255),on(n,n.gzhead.time>>16&255),on(n,n.gzhead.time>>24&255),on(n,n.level===9?2:n.strategy>=yv||n.level<2?4:0),on(n,n.gzhead.os&255),n.gzhead.extra&&n.gzhead.extra.length&&(on(n,n.gzhead.extra.length&255),on(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(e.adler=ai(e.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=lE;else if(on(n,0),on(n,0),on(n,0),on(n,0),on(n,0),on(n,n.level===9?2:n.strategy>=yv||n.level<2?4:0),on(n,rde),n.status=td,Fo(e),n.pending!==0)return n.last_flush=-1,Ei}if(n.status===lE){if(n.gzhead.extra){let i=n.pending,o=(n.gzhead.extra.length&65535)-n.gzindex;for(;n.pending+o>n.pending_buf_size;){let s=n.pending_buf_size-n.pending;if(n.pending_buf.set(n.gzhead.extra.subarray(n.gzindex,n.gzindex+s),n.pending),n.pending=n.pending_buf_size,n.gzhead.hcrc&&n.pending>i&&(e.adler=ai(e.adler,n.pending_buf,n.pending-i,i)),n.gzindex+=s,Fo(e),n.pending!==0)return n.last_flush=-1,Ei;i=0,o-=s}let a=new Uint8Array(n.gzhead.extra);n.pending_buf.set(a.subarray(n.gzindex,n.gzindex+o),n.pending),n.pending+=o,n.gzhead.hcrc&&n.pending>i&&(e.adler=ai(e.adler,n.pending_buf,n.pending-i,i)),n.gzindex=0}n.status=uE}if(n.status===uE){if(n.gzhead.name){let i=n.pending,o;do{if(n.pending===n.pending_buf_size){if(n.gzhead.hcrc&&n.pending>i&&(e.adler=ai(e.adler,n.pending_buf,n.pending-i,i)),Fo(e),n.pending!==0)return n.last_flush=-1,Ei;i=0}n.gzindexi&&(e.adler=ai(e.adler,n.pending_buf,n.pending-i,i)),n.gzindex=0}n.status=cE}if(n.status===cE){if(n.gzhead.comment){let i=n.pending,o;do{if(n.pending===n.pending_buf_size){if(n.gzhead.hcrc&&n.pending>i&&(e.adler=ai(e.adler,n.pending_buf,n.pending-i,i)),Fo(e),n.pending!==0)return n.last_flush=-1,Ei;i=0}n.gzindexi&&(e.adler=ai(e.adler,n.pending_buf,n.pending-i,i))}n.status=dE}if(n.status===dE){if(n.gzhead.hcrc){if(n.pending+2>n.pending_buf_size&&(Fo(e),n.pending!==0))return n.last_flush=-1,Ei;on(n,e.adler&255),on(n,e.adler>>8&255),e.adler=0}if(n.status=td,Fo(e),n.pending!==0)return n.last_flush=-1,Ei}if(e.avail_in!==0||n.lookahead!==0||t!==qu&&n.status!==vg){let i=n.level===0?lz(n,t):n.strategy===yv?sde(n,t):n.strategy===Vce?ade(n,t):bg[n.level].func(n,t);if((i===Pd||i===bp)&&(n.status=vg),i===eo||i===Pd)return e.avail_out===0&&(n.last_flush=-1),Ei;if(i===vp&&(t===Fce?Lce(n):t!==wI&&(aE(n,0,0,!1),t===Bce&&(Cu(n.head),n.lookahead===0&&(n.strstart=0,n.block_start=0,n.insert=0))),Fo(e),e.avail_out===0))return n.last_flush=-1,Ei}return t!==ya?Ei:n.wrap<=0?CI:(n.wrap===2?(on(n,e.adler&255),on(n,e.adler>>8&255),on(n,e.adler>>16&255),on(n,e.adler>>24&255),on(n,e.total_in&255),on(n,e.total_in>>8&255),on(n,e.total_in>>16&255),on(n,e.total_in>>24&255)):(qp(n,e.adler>>>16),qp(n,e.adler&65535)),Fo(e),n.wrap>0&&(n.wrap=-n.wrap),n.pending!==0?Ei:CI)},hde=e=>{if(fy(e))return zs;const t=e.state.status;return e.state=null,t===td?nd(e,zce):Ei},pde=(e,t)=>{let n=t.length;if(fy(e))return zs;const r=e.state,i=r.wrap;if(i===2||i===1&&r.status!==Qh||r.lookahead)return zs;if(i===1&&(e.adler=Jm(e.adler,t,n,0)),r.wrap=0,n>=r.w_size){i===0&&(Cu(r.head),r.strstart=0,r.block_start=0,r.insert=0);let l=new Uint8Array(r.w_size);l.set(t.subarray(n-r.w_size,n),0),t=l,n=r.w_size}const o=e.avail_in,a=e.next_in,s=e.input;for(e.avail_in=n,e.next_in=0,e.input=t,Xh(r);r.lookahead>=Bt;){let l=r.strstart,u=r.lookahead-(Bt-1);do r.ins_h=Wu(r,r.ins_h,r.window[l+Bt-1]),r.prev[l&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=l,l++;while(--u);r.strstart=l,r.lookahead=Bt-1,Xh(r)}return r.strstart+=r.lookahead,r.block_start=r.strstart,r.insert=r.lookahead,r.lookahead=0,r.match_length=r.prev_length=Bt-1,r.match_available=0,e.next_in=a,e.input=s,e.avail_in=o,r.wrap=i,Ei};var gde=dde,mde=dz,yde=cz,vde=uz,bde=cde,_de=fde,Sde=hde,xde=pde,wde="pako deflate (from Nodeca project)",qg={deflateInit:gde,deflateInit2:mde,deflateReset:yde,deflateResetKeep:vde,deflateSetHeader:bde,deflate:_de,deflateEnd:Sde,deflateSetDictionary:xde,deflateInfo:wde};const Cde=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var Ede=function(e){const t=Array.prototype.slice.call(arguments,1);for(;t.length;){const n=t.shift();if(n){if(typeof n!="object")throw new TypeError(n+"must be non-object");for(const r in n)Cde(n,r)&&(e[r]=n[r])}}return e},kde=e=>{let t=0;for(let r=0,i=e.length;r=252?6:e>=248?5:e>=240?4:e>=224?3:e>=192?2:1;e0[254]=e0[254]=1;var Tde=e=>{if(typeof TextEncoder=="function"&&TextEncoder.prototype.encode)return new TextEncoder().encode(e);let t,n,r,i,o,a=e.length,s=0;for(i=0;i>>6,t[o++]=128|n&63):n<65536?(t[o++]=224|n>>>12,t[o++]=128|n>>>6&63,t[o++]=128|n&63):(t[o++]=240|n>>>18,t[o++]=128|n>>>12&63,t[o++]=128|n>>>6&63,t[o++]=128|n&63);return t};const Ade=(e,t)=>{if(t<65534&&e.subarray&&fz)return String.fromCharCode.apply(null,e.length===t?e:e.subarray(0,t));let n="";for(let r=0;r{const n=t||e.length;if(typeof TextDecoder=="function"&&TextDecoder.prototype.decode)return new TextDecoder().decode(e.subarray(0,t));let r,i;const o=new Array(n*2);for(i=0,r=0;r4){o[i++]=65533,r+=s-1;continue}for(a&=s===2?31:s===3?15:7;s>1&&r1){o[i++]=65533;continue}a<65536?o[i++]=a:(a-=65536,o[i++]=55296|a>>10&1023,o[i++]=56320|a&1023)}return Ade(o,i)},Ide=(e,t)=>{t=t||e.length,t>e.length&&(t=e.length);let n=t-1;for(;n>=0&&(e[n]&192)===128;)n--;return n<0||n===0?t:n+e0[e[n]]>t?n:t},t0={string2buf:Tde,buf2string:Pde,utf8border:Ide};function Rde(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}var hz=Rde;const pz=Object.prototype.toString,{Z_NO_FLUSH:Ode,Z_SYNC_FLUSH:Mde,Z_FULL_FLUSH:Nde,Z_FINISH:$de,Z_OK:d_,Z_STREAM_END:Dde,Z_DEFAULT_COMPRESSION:Lde,Z_DEFAULT_STRATEGY:Fde,Z_DEFLATED:Bde}=dy;function CT(e){this.options=JS.assign({level:Lde,method:Bde,chunkSize:16384,windowBits:15,memLevel:8,strategy:Fde},e||{});let t=this.options;t.raw&&t.windowBits>0?t.windowBits=-t.windowBits:t.gzip&&t.windowBits>0&&t.windowBits<16&&(t.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new hz,this.strm.avail_out=0;let n=qg.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(n!==d_)throw new Error(Kh[n]);if(t.header&&qg.deflateSetHeader(this.strm,t.header),t.dictionary){let r;if(typeof t.dictionary=="string"?r=t0.string2buf(t.dictionary):pz.call(t.dictionary)==="[object ArrayBuffer]"?r=new Uint8Array(t.dictionary):r=t.dictionary,n=qg.deflateSetDictionary(this.strm,r),n!==d_)throw new Error(Kh[n]);this._dict_set=!0}}CT.prototype.push=function(e,t){const n=this.strm,r=this.options.chunkSize;let i,o;if(this.ended)return!1;for(t===~~t?o=t:o=t===!0?$de:Ode,typeof e=="string"?n.input=t0.string2buf(e):pz.call(e)==="[object ArrayBuffer]"?n.input=new Uint8Array(e):n.input=e,n.next_in=0,n.avail_in=n.input.length;;){if(n.avail_out===0&&(n.output=new Uint8Array(r),n.next_out=0,n.avail_out=r),(o===Mde||o===Nde)&&n.avail_out<=6){this.onData(n.output.subarray(0,n.next_out)),n.avail_out=0;continue}if(i=qg.deflate(n,o),i===Dde)return n.next_out>0&&this.onData(n.output.subarray(0,n.next_out)),i=qg.deflateEnd(this.strm),this.onEnd(i),this.ended=!0,i===d_;if(n.avail_out===0){this.onData(n.output);continue}if(o>0&&n.next_out>0){this.onData(n.output.subarray(0,n.next_out)),n.avail_out=0;continue}if(n.avail_in===0)break}return!0};CT.prototype.onData=function(e){this.chunks.push(e)};CT.prototype.onEnd=function(e){e===d_&&(this.result=JS.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};const vv=16209,zde=16191;var jde=function(t,n){let r,i,o,a,s,l,u,c,d,f,h,p,m,_,b,v,g,y,S,w,x,C,T,k;const P=t.state;r=t.next_in,T=t.input,i=r+(t.avail_in-5),o=t.next_out,k=t.output,a=o-(n-t.avail_out),s=o+(t.avail_out-257),l=P.dmax,u=P.wsize,c=P.whave,d=P.wnext,f=P.window,h=P.hold,p=P.bits,m=P.lencode,_=P.distcode,b=(1<>>24,h>>>=y,p-=y,y=g>>>16&255,y===0)k[o++]=g&65535;else if(y&16){S=g&65535,y&=15,y&&(p>>=y,p-=y),p<15&&(h+=T[r++]<>>24,h>>>=y,p-=y,y=g>>>16&255,y&16){if(w=g&65535,y&=15,pl){t.msg="invalid distance too far back",P.mode=vv;break e}if(h>>>=y,p-=y,y=o-a,w>y){if(y=w-y,y>c&&P.sane){t.msg="invalid distance too far back",P.mode=vv;break e}if(x=0,C=f,d===0){if(x+=u-y,y2;)k[o++]=C[x++],k[o++]=C[x++],k[o++]=C[x++],S-=3;S&&(k[o++]=C[x++],S>1&&(k[o++]=C[x++]))}else{x=o-w;do k[o++]=k[x++],k[o++]=k[x++],k[o++]=k[x++],S-=3;while(S>2);S&&(k[o++]=k[x++],S>1&&(k[o++]=k[x++]))}}else if(y&64){t.msg="invalid distance code",P.mode=vv;break e}else{g=_[(g&65535)+(h&(1<>3,r-=S,p-=S<<3,h&=(1<{const l=s.bits;let u=0,c=0,d=0,f=0,h=0,p=0,m=0,_=0,b=0,v=0,g,y,S,w,x,C=null,T;const k=new Uint16Array(cf+1),P=new Uint16Array(cf+1);let $=null,O,E,A;for(u=0;u<=cf;u++)k[u]=0;for(c=0;c=1&&k[f]===0;f--);if(h>f&&(h=f),f===0)return i[o++]=1<<24|64<<16|0,i[o++]=1<<24|64<<16|0,s.bits=1,0;for(d=1;d0&&(e===AI||f!==1))return-1;for(P[1]=0,u=1;ukI||e===PI&&b>TI)return 1;for(;;){O=u-m,a[c]+1=T?(E=$[a[c]-T],A=C[a[c]-T]):(E=32+64,A=0),g=1<>m)+y]=O<<24|E<<16|A|0;while(y!==0);for(g=1<>=1;if(g!==0?(v&=g-1,v+=g):v=0,c++,--k[u]===0){if(u===f)break;u=t[n+a[c]]}if(u>h&&(v&w)!==S){for(m===0&&(m=h),x+=d,p=u-m,_=1<kI||e===PI&&b>TI)return 1;S=v&w,i[S]=h<<24|p<<16|x-o|0}}return v!==0&&(i[x+v]=u-m<<24|64<<16|0),s.bits=h,0};var Wg=qde;const Wde=0,gz=1,mz=2,{Z_FINISH:II,Z_BLOCK:Kde,Z_TREES:bv,Z_OK:Id,Z_STREAM_END:Qde,Z_NEED_DICT:Xde,Z_STREAM_ERROR:Ea,Z_DATA_ERROR:yz,Z_MEM_ERROR:vz,Z_BUF_ERROR:Yde,Z_DEFLATED:RI}=dy,e2=16180,OI=16181,MI=16182,NI=16183,$I=16184,DI=16185,LI=16186,FI=16187,BI=16188,zI=16189,f_=16190,ll=16191,fC=16192,jI=16193,hC=16194,UI=16195,VI=16196,GI=16197,HI=16198,_v=16199,Sv=16200,qI=16201,WI=16202,KI=16203,QI=16204,XI=16205,pC=16206,YI=16207,ZI=16208,Zn=16209,bz=16210,_z=16211,Zde=852,Jde=592,efe=15,tfe=efe,JI=e=>(e>>>24&255)+(e>>>8&65280)+((e&65280)<<8)+((e&255)<<24);function nfe(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}const Vd=e=>{if(!e)return 1;const t=e.state;return!t||t.strm!==e||t.mode_z?1:0},Sz=e=>{if(Vd(e))return Ea;const t=e.state;return e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=t.wrap&1),t.mode=e2,t.last=0,t.havedict=0,t.flags=-1,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new Int32Array(Zde),t.distcode=t.distdyn=new Int32Array(Jde),t.sane=1,t.back=-1,Id},xz=e=>{if(Vd(e))return Ea;const t=e.state;return t.wsize=0,t.whave=0,t.wnext=0,Sz(e)},wz=(e,t)=>{let n;if(Vd(e))return Ea;const r=e.state;return t<0?(n=0,t=-t):(n=(t>>4)+5,t<48&&(t&=15)),t&&(t<8||t>15)?Ea:(r.window!==null&&r.wbits!==t&&(r.window=null),r.wrap=n,r.wbits=t,xz(e))},Cz=(e,t)=>{if(!e)return Ea;const n=new nfe;e.state=n,n.strm=e,n.window=null,n.mode=e2;const r=wz(e,t);return r!==Id&&(e.state=null),r},rfe=e=>Cz(e,tfe);let eR=!0,gC,mC;const ife=e=>{if(eR){gC=new Int32Array(512),mC=new Int32Array(32);let t=0;for(;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(Wg(gz,e.lens,0,288,gC,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;Wg(mz,e.lens,0,32,mC,0,e.work,{bits:5}),eR=!1}e.lencode=gC,e.lenbits=9,e.distcode=mC,e.distbits=5},Ez=(e,t,n,r)=>{let i;const o=e.state;return o.window===null&&(o.wsize=1<=o.wsize?(o.window.set(t.subarray(n-o.wsize,n),0),o.wnext=0,o.whave=o.wsize):(i=o.wsize-o.wnext,i>r&&(i=r),o.window.set(t.subarray(n-r,n-r+i),o.wnext),r-=i,r?(o.window.set(t.subarray(n-r,n),0),o.wnext=r,o.whave=o.wsize):(o.wnext+=i,o.wnext===o.wsize&&(o.wnext=0),o.whave{let n,r,i,o,a,s,l,u,c,d,f,h,p,m,_=0,b,v,g,y,S,w,x,C;const T=new Uint8Array(4);let k,P;const $=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(Vd(e)||!e.output||!e.input&&e.avail_in!==0)return Ea;n=e.state,n.mode===ll&&(n.mode=fC),a=e.next_out,i=e.output,l=e.avail_out,o=e.next_in,r=e.input,s=e.avail_in,u=n.hold,c=n.bits,d=s,f=l,C=Id;e:for(;;)switch(n.mode){case e2:if(n.wrap===0){n.mode=fC;break}for(;c<16;){if(s===0)break e;s--,u+=r[o++]<>>8&255,n.check=ai(n.check,T,2,0),u=0,c=0,n.mode=OI;break}if(n.head&&(n.head.done=!1),!(n.wrap&1)||(((u&255)<<8)+(u>>8))%31){e.msg="incorrect header check",n.mode=Zn;break}if((u&15)!==RI){e.msg="unknown compression method",n.mode=Zn;break}if(u>>>=4,c-=4,x=(u&15)+8,n.wbits===0&&(n.wbits=x),x>15||x>n.wbits){e.msg="invalid window size",n.mode=Zn;break}n.dmax=1<>8&1),n.flags&512&&n.wrap&4&&(T[0]=u&255,T[1]=u>>>8&255,n.check=ai(n.check,T,2,0)),u=0,c=0,n.mode=MI;case MI:for(;c<32;){if(s===0)break e;s--,u+=r[o++]<>>8&255,T[2]=u>>>16&255,T[3]=u>>>24&255,n.check=ai(n.check,T,4,0)),u=0,c=0,n.mode=NI;case NI:for(;c<16;){if(s===0)break e;s--,u+=r[o++]<>8),n.flags&512&&n.wrap&4&&(T[0]=u&255,T[1]=u>>>8&255,n.check=ai(n.check,T,2,0)),u=0,c=0,n.mode=$I;case $I:if(n.flags&1024){for(;c<16;){if(s===0)break e;s--,u+=r[o++]<>>8&255,n.check=ai(n.check,T,2,0)),u=0,c=0}else n.head&&(n.head.extra=null);n.mode=DI;case DI:if(n.flags&1024&&(h=n.length,h>s&&(h=s),h&&(n.head&&(x=n.head.extra_len-n.length,n.head.extra||(n.head.extra=new Uint8Array(n.head.extra_len)),n.head.extra.set(r.subarray(o,o+h),x)),n.flags&512&&n.wrap&4&&(n.check=ai(n.check,r,h,o)),s-=h,o+=h,n.length-=h),n.length))break e;n.length=0,n.mode=LI;case LI:if(n.flags&2048){if(s===0)break e;h=0;do x=r[o+h++],n.head&&x&&n.length<65536&&(n.head.name+=String.fromCharCode(x));while(x&&h>9&1,n.head.done=!0),e.adler=n.check=0,n.mode=ll;break;case zI:for(;c<32;){if(s===0)break e;s--,u+=r[o++]<>>=c&7,c-=c&7,n.mode=pC;break}for(;c<3;){if(s===0)break e;s--,u+=r[o++]<>>=1,c-=1,u&3){case 0:n.mode=jI;break;case 1:if(ife(n),n.mode=_v,t===bv){u>>>=2,c-=2;break e}break;case 2:n.mode=VI;break;case 3:e.msg="invalid block type",n.mode=Zn}u>>>=2,c-=2;break;case jI:for(u>>>=c&7,c-=c&7;c<32;){if(s===0)break e;s--,u+=r[o++]<>>16^65535)){e.msg="invalid stored block lengths",n.mode=Zn;break}if(n.length=u&65535,u=0,c=0,n.mode=hC,t===bv)break e;case hC:n.mode=UI;case UI:if(h=n.length,h){if(h>s&&(h=s),h>l&&(h=l),h===0)break e;i.set(r.subarray(o,o+h),a),s-=h,o+=h,l-=h,a+=h,n.length-=h;break}n.mode=ll;break;case VI:for(;c<14;){if(s===0)break e;s--,u+=r[o++]<>>=5,c-=5,n.ndist=(u&31)+1,u>>>=5,c-=5,n.ncode=(u&15)+4,u>>>=4,c-=4,n.nlen>286||n.ndist>30){e.msg="too many length or distance symbols",n.mode=Zn;break}n.have=0,n.mode=GI;case GI:for(;n.have>>=3,c-=3}for(;n.have<19;)n.lens[$[n.have++]]=0;if(n.lencode=n.lendyn,n.lenbits=7,k={bits:n.lenbits},C=Wg(Wde,n.lens,0,19,n.lencode,0,n.work,k),n.lenbits=k.bits,C){e.msg="invalid code lengths set",n.mode=Zn;break}n.have=0,n.mode=HI;case HI:for(;n.have>>24,v=_>>>16&255,g=_&65535,!(b<=c);){if(s===0)break e;s--,u+=r[o++]<>>=b,c-=b,n.lens[n.have++]=g;else{if(g===16){for(P=b+2;c>>=b,c-=b,n.have===0){e.msg="invalid bit length repeat",n.mode=Zn;break}x=n.lens[n.have-1],h=3+(u&3),u>>>=2,c-=2}else if(g===17){for(P=b+3;c>>=b,c-=b,x=0,h=3+(u&7),u>>>=3,c-=3}else{for(P=b+7;c>>=b,c-=b,x=0,h=11+(u&127),u>>>=7,c-=7}if(n.have+h>n.nlen+n.ndist){e.msg="invalid bit length repeat",n.mode=Zn;break}for(;h--;)n.lens[n.have++]=x}}if(n.mode===Zn)break;if(n.lens[256]===0){e.msg="invalid code -- missing end-of-block",n.mode=Zn;break}if(n.lenbits=9,k={bits:n.lenbits},C=Wg(gz,n.lens,0,n.nlen,n.lencode,0,n.work,k),n.lenbits=k.bits,C){e.msg="invalid literal/lengths set",n.mode=Zn;break}if(n.distbits=6,n.distcode=n.distdyn,k={bits:n.distbits},C=Wg(mz,n.lens,n.nlen,n.ndist,n.distcode,0,n.work,k),n.distbits=k.bits,C){e.msg="invalid distances set",n.mode=Zn;break}if(n.mode=_v,t===bv)break e;case _v:n.mode=Sv;case Sv:if(s>=6&&l>=258){e.next_out=a,e.avail_out=l,e.next_in=o,e.avail_in=s,n.hold=u,n.bits=c,jde(e,f),a=e.next_out,i=e.output,l=e.avail_out,o=e.next_in,r=e.input,s=e.avail_in,u=n.hold,c=n.bits,n.mode===ll&&(n.back=-1);break}for(n.back=0;_=n.lencode[u&(1<>>24,v=_>>>16&255,g=_&65535,!(b<=c);){if(s===0)break e;s--,u+=r[o++]<>y)],b=_>>>24,v=_>>>16&255,g=_&65535,!(y+b<=c);){if(s===0)break e;s--,u+=r[o++]<>>=y,c-=y,n.back+=y}if(u>>>=b,c-=b,n.back+=b,n.length=g,v===0){n.mode=XI;break}if(v&32){n.back=-1,n.mode=ll;break}if(v&64){e.msg="invalid literal/length code",n.mode=Zn;break}n.extra=v&15,n.mode=qI;case qI:if(n.extra){for(P=n.extra;c>>=n.extra,c-=n.extra,n.back+=n.extra}n.was=n.length,n.mode=WI;case WI:for(;_=n.distcode[u&(1<>>24,v=_>>>16&255,g=_&65535,!(b<=c);){if(s===0)break e;s--,u+=r[o++]<>y)],b=_>>>24,v=_>>>16&255,g=_&65535,!(y+b<=c);){if(s===0)break e;s--,u+=r[o++]<>>=y,c-=y,n.back+=y}if(u>>>=b,c-=b,n.back+=b,v&64){e.msg="invalid distance code",n.mode=Zn;break}n.offset=g,n.extra=v&15,n.mode=KI;case KI:if(n.extra){for(P=n.extra;c>>=n.extra,c-=n.extra,n.back+=n.extra}if(n.offset>n.dmax){e.msg="invalid distance too far back",n.mode=Zn;break}n.mode=QI;case QI:if(l===0)break e;if(h=f-l,n.offset>h){if(h=n.offset-h,h>n.whave&&n.sane){e.msg="invalid distance too far back",n.mode=Zn;break}h>n.wnext?(h-=n.wnext,p=n.wsize-h):p=n.wnext-h,h>n.length&&(h=n.length),m=n.window}else m=i,p=a-n.offset,h=n.length;h>l&&(h=l),l-=h,n.length-=h;do i[a++]=m[p++];while(--h);n.length===0&&(n.mode=Sv);break;case XI:if(l===0)break e;i[a++]=n.length,l--,n.mode=Sv;break;case pC:if(n.wrap){for(;c<32;){if(s===0)break e;s--,u|=r[o++]<{if(Vd(e))return Ea;let t=e.state;return t.window&&(t.window=null),e.state=null,Id},sfe=(e,t)=>{if(Vd(e))return Ea;const n=e.state;return n.wrap&2?(n.head=t,t.done=!1,Id):Ea},lfe=(e,t)=>{const n=t.length;let r,i,o;return Vd(e)||(r=e.state,r.wrap!==0&&r.mode!==f_)?Ea:r.mode===f_&&(i=1,i=Jm(i,t,n,0),i!==r.check)?yz:(o=Ez(e,t,n,n),o?(r.mode=bz,vz):(r.havedict=1,Id))};var ufe=xz,cfe=wz,dfe=Sz,ffe=rfe,hfe=Cz,pfe=ofe,gfe=afe,mfe=sfe,yfe=lfe,vfe="pako inflate (from Nodeca project)",_l={inflateReset:ufe,inflateReset2:cfe,inflateResetKeep:dfe,inflateInit:ffe,inflateInit2:hfe,inflate:pfe,inflateEnd:gfe,inflateGetHeader:mfe,inflateSetDictionary:yfe,inflateInfo:vfe};function bfe(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}var _fe=bfe;const kz=Object.prototype.toString,{Z_NO_FLUSH:Sfe,Z_FINISH:xfe,Z_OK:n0,Z_STREAM_END:yC,Z_NEED_DICT:vC,Z_STREAM_ERROR:wfe,Z_DATA_ERROR:tR,Z_MEM_ERROR:Cfe}=dy;function hy(e){this.options=JS.assign({chunkSize:1024*64,windowBits:15,to:""},e||{});const t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,t.windowBits===0&&(t.windowBits=-15)),t.windowBits>=0&&t.windowBits<16&&!(e&&e.windowBits)&&(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&(t.windowBits&15||(t.windowBits|=15)),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new hz,this.strm.avail_out=0;let n=_l.inflateInit2(this.strm,t.windowBits);if(n!==n0)throw new Error(Kh[n]);if(this.header=new _fe,_l.inflateGetHeader(this.strm,this.header),t.dictionary&&(typeof t.dictionary=="string"?t.dictionary=t0.string2buf(t.dictionary):kz.call(t.dictionary)==="[object ArrayBuffer]"&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(n=_l.inflateSetDictionary(this.strm,t.dictionary),n!==n0)))throw new Error(Kh[n])}hy.prototype.push=function(e,t){const n=this.strm,r=this.options.chunkSize,i=this.options.dictionary;let o,a,s;if(this.ended)return!1;for(t===~~t?a=t:a=t===!0?xfe:Sfe,kz.call(e)==="[object ArrayBuffer]"?n.input=new Uint8Array(e):n.input=e,n.next_in=0,n.avail_in=n.input.length;;){for(n.avail_out===0&&(n.output=new Uint8Array(r),n.next_out=0,n.avail_out=r),o=_l.inflate(n,a),o===vC&&i&&(o=_l.inflateSetDictionary(n,i),o===n0?o=_l.inflate(n,a):o===tR&&(o=vC));n.avail_in>0&&o===yC&&n.state.wrap>0&&e[n.next_in]!==0;)_l.inflateReset(n),o=_l.inflate(n,a);switch(o){case wfe:case tR:case vC:case Cfe:return this.onEnd(o),this.ended=!0,!1}if(s=n.avail_out,n.next_out&&(n.avail_out===0||o===yC))if(this.options.to==="string"){let l=t0.utf8border(n.output,n.next_out),u=n.next_out-l,c=t0.buf2string(n.output,l);n.next_out=u,n.avail_out=r-u,u&&n.output.set(n.output.subarray(l,l+u),0),this.onData(c)}else this.onData(n.output.length===n.next_out?n.output:n.output.subarray(0,n.next_out));if(!(o===n0&&s===0)){if(o===yC)return o=_l.inflateEnd(this.strm),this.onEnd(o),this.ended=!0,!0;if(n.avail_in===0)break}}return!0};hy.prototype.onData=function(e){this.chunks.push(e)};hy.prototype.onEnd=function(e){e===n0&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=JS.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};function ET(e,t){const n=new hy(t);if(n.push(e),n.err)throw n.msg||Kh[n.err];return n.result}function Efe(e,t){return t=t||{},t.raw=!0,ET(e,t)}var kfe=hy,Tfe=ET,Afe=Efe,Pfe=ET,Ife=dy,Rfe={Inflate:kfe,inflate:Tfe,inflateRaw:Afe,ungzip:Pfe,constants:Ife};const{Inflate:dGe,inflate:Ofe,inflateRaw:fGe,ungzip:hGe}=Rfe;var Tz=Ofe;const Az=[];for(let e=0;e<256;e++){let t=e;for(let n=0;n<8;n++)t&1?t=3988292384^t>>>1:t=t>>>1;Az[e]=t}function Mfe(e){let t=-1;for(let n=0;n>>8;return t^-1}var Jn;(function(e){e[e.GRAYSCALE=0]="GRAYSCALE",e[e.TRUE_COLOR=2]="TRUE_COLOR",e[e.PALETTE=3]="PALETTE",e[e.GRAYSCALE_WITH_ALPHA=4]="GRAYSCALE_WITH_ALPHA",e[e.TRUE_COLOR_WITH_ALPHA=6]="TRUE_COLOR_WITH_ALPHA"})(Jn||(Jn={}));const Nfe={[Jn.GRAYSCALE]:1,[Jn.TRUE_COLOR]:3,[Jn.PALETTE]:1,[Jn.GRAYSCALE_WITH_ALPHA]:2,[Jn.TRUE_COLOR_WITH_ALPHA]:4},$fe=1;var Vo;(function(e){e[e.NONE=0]="NONE",e[e.SUB=1]="SUB",e[e.UP=2]="UP",e[e.AVERAGE=3]="AVERAGE",e[e.PAETH=4]="PAETH"})(Vo||(Vo={}));const Dfe={[Vo.NONE](e){return e},[Vo.SUB](e,t){const n=new Uint8Array(e.length);for(let r=0;r>1;r[i]=e[i]+s}return r},[Vo.PAETH](e,t,n){const r=new Uint8Array(e.length);for(let i=0;i>7&1,i>>6&1,i>>5&1,i>>4&1,i>>3&1,i>>2&1,i>>1&1,i&1)}else if(t===2){const i=e[r++];n.push(i>>6&3,i>>4&3,i>>2&3,i&3)}else if(t===4){const i=e[r++];n.push(i>>4&15,i&15)}else if(t===8){const i=e[r++];n.push(i)}else if(t===16)n.push(e[r++]<<8|e[r++]);else throw new Error("Unsupported depth: "+t);return n}const Iz=[{x:[0],y:[0]},{x:[4],y:[0]},{x:[0,4],y:[4]},{x:[2,6],y:[0,4]},{x:[0,2,4,6],y:[2,6]},{x:[1,3,5,7],y:[0,2,4,6]},{x:[0,1,2,3,4,5,6,7],y:[1,3,5,7]}];function Ffe(e,t,n){if(!e)return[{passWidth:t,passHeight:n,passIndex:0}];const r=[];return Iz.forEach(function({x:i,y:o},a){const s=t%8,l=n%8,u=t-s>>3,c=n-l>>3;let d=u*i.length;for(let h=0;h>3||1;let p=0,m=new Uint8Array;for(let _=0;_>3)+$fe,w=u[p];if(!(w in Vo))throw new Error("Unsupported filter type: "+w);const x=Dfe[w],C=x(u.slice(p+1,p+S),h,m);m=C;let T=0;const k=Lfe(C,o);for(let $=0;$127)if(r>191&&r<224){if(t>=e.length)throw new Error("UTF-8 decode: incomplete 2-byte sequence");r=(r&31)<<6|e[t++]&63}else if(r>223&&r<240){if(t+1>=e.length)throw new Error("UTF-8 decode: incomplete 3-byte sequence");r=(r&15)<<12|(e[t++]&63)<<6|e[t++]&63}else if(r>239&&r<248){if(t+2>=e.length)throw new Error("UTF-8 decode: incomplete 4-byte sequence");r=(r&7)<<18|(e[t++]&63)<<12|(e[t++]&63)<<6|e[t++]&63}else throw new Error("UTF-8 decode: unknown multibyte start 0x"+r.toString(16)+" at index "+(t-1));if(r<=65535)n+=String.fromCharCode(r);else if(r<=1114111)r-=65536,n+=String.fromCharCode(r>>10|55296),n+=String.fromCharCode(r&1023|56320);else throw new Error("UTF-8 decode: code point 0x"+r.toString(16)+" exceeds UTF-16 reach")}return n}function Ufe(e,t){const n=new Uint8Array(e.length+t.length);return n.set(e),n.set(t,e.length),n}const su=1e5;function Vfe(e){const t=new Uint8Array(e);let n=new Uint8Array;const r={width:0,height:0,depth:0,colorType:0,compression:0,interlace:0,filter:0,data:[]};let i=0;function o(){return t[i++]<<24|t[i++]<<16|t[i++]<<8|t[i++]}function a(){return t[i++]<<8|t[i++]}function s(){return t[i++]}function l(){const M=[];let R=0;for(;(R=t[i++])!==0;)M.push(R);return new Uint8Array(M)}function u(M){const R=i+M;let N="";for(;i=0&&nR.call(t.callee)==="[object Function]"),r},SC,rR;function Wfe(){if(rR)return SC;rR=1;var e;if(!Object.keys){var t=Object.prototype.hasOwnProperty,n=Object.prototype.toString,r=Oz,i=Object.prototype.propertyIsEnumerable,o=!i.call({toString:null},"toString"),a=i.call(function(){},"prototype"),s=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],l=function(f){var h=f.constructor;return h&&h.prototype===f},u={$applicationCache:!0,$console:!0,$external:!0,$frame:!0,$frameElement:!0,$frames:!0,$innerHeight:!0,$innerWidth:!0,$onmozfullscreenchange:!0,$onmozfullscreenerror:!0,$outerHeight:!0,$outerWidth:!0,$pageXOffset:!0,$pageYOffset:!0,$parent:!0,$scrollLeft:!0,$scrollTop:!0,$scrollX:!0,$scrollY:!0,$self:!0,$webkitIndexedDB:!0,$webkitStorageInfo:!0,$window:!0},c=function(){if(typeof window>"u")return!1;for(var f in window)try{if(!u["$"+f]&&t.call(window,f)&&window[f]!==null&&typeof window[f]=="object")try{l(window[f])}catch{return!0}}catch{return!0}return!1}(),d=function(f){if(typeof window>"u"||!c)return l(f);try{return l(f)}catch{return!1}};e=function(h){var p=h!==null&&typeof h=="object",m=n.call(h)==="[object Function]",_=r(h),b=p&&n.call(h)==="[object String]",v=[];if(!p&&!m&&!_)throw new TypeError("Object.keys called on a non-object");var g=a&&m;if(b&&h.length>0&&!t.call(h,0))for(var y=0;y0)for(var S=0;S"u"||!oi?$t:oi(Uint8Array),pd={"%AggregateError%":typeof AggregateError>"u"?$t:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?$t:ArrayBuffer,"%ArrayIteratorPrototype%":df&&oi?oi([][Symbol.iterator]()):$t,"%AsyncFromSyncIteratorPrototype%":$t,"%AsyncFunction%":Cf,"%AsyncGenerator%":Cf,"%AsyncGeneratorFunction%":Cf,"%AsyncIteratorPrototype%":Cf,"%Atomics%":typeof Atomics>"u"?$t:Atomics,"%BigInt%":typeof BigInt>"u"?$t:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?$t:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?$t:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?$t:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":typeof Float32Array>"u"?$t:Float32Array,"%Float64Array%":typeof Float64Array>"u"?$t:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?$t:FinalizationRegistry,"%Function%":Nz,"%GeneratorFunction%":Cf,"%Int8Array%":typeof Int8Array>"u"?$t:Int8Array,"%Int16Array%":typeof Int16Array>"u"?$t:Int16Array,"%Int32Array%":typeof Int32Array>"u"?$t:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":df&&oi?oi(oi([][Symbol.iterator]())):$t,"%JSON%":typeof JSON=="object"?JSON:$t,"%Map%":typeof Map>"u"?$t:Map,"%MapIteratorPrototype%":typeof Map>"u"||!df||!oi?$t:oi(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?$t:Promise,"%Proxy%":typeof Proxy>"u"?$t:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":typeof Reflect>"u"?$t:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?$t:Set,"%SetIteratorPrototype%":typeof Set>"u"||!df||!oi?$t:oi(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?$t:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":df&&oi?oi(""[Symbol.iterator]()):$t,"%Symbol%":df?Symbol:$t,"%SyntaxError%":Yh,"%ThrowTypeError%":uhe,"%TypedArray%":dhe,"%TypeError%":ph,"%Uint8Array%":typeof Uint8Array>"u"?$t:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?$t:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?$t:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?$t:Uint32Array,"%URIError%":URIError,"%WeakMap%":typeof WeakMap>"u"?$t:WeakMap,"%WeakRef%":typeof WeakRef>"u"?$t:WeakRef,"%WeakSet%":typeof WeakSet>"u"?$t:WeakSet};if(oi)try{null.error}catch(e){var fhe=oi(oi(e));pd["%Error.prototype%"]=fhe}var hhe=function e(t){var n;if(t==="%AsyncFunction%")n=wC("async function () {}");else if(t==="%GeneratorFunction%")n=wC("function* () {}");else if(t==="%AsyncGeneratorFunction%")n=wC("async function* () {}");else if(t==="%AsyncGenerator%"){var r=e("%AsyncGeneratorFunction%");r&&(n=r.prototype)}else if(t==="%AsyncIteratorPrototype%"){var i=e("%AsyncGenerator%");i&&oi&&(n=oi(i.prototype))}return pd[t]=n,n},lR={"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},py=Mz,h_=lhe,phe=py.call(Function.call,Array.prototype.concat),ghe=py.call(Function.apply,Array.prototype.splice),uR=py.call(Function.call,String.prototype.replace),p_=py.call(Function.call,String.prototype.slice),mhe=py.call(Function.call,RegExp.prototype.exec),yhe=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,vhe=/\\(\\)?/g,bhe=function(t){var n=p_(t,0,1),r=p_(t,-1);if(n==="%"&&r!=="%")throw new Yh("invalid intrinsic syntax, expected closing `%`");if(r==="%"&&n!=="%")throw new Yh("invalid intrinsic syntax, expected opening `%`");var i=[];return uR(t,yhe,function(o,a,s,l){i[i.length]=s?uR(l,vhe,"$1"):a||o}),i},_he=function(t,n){var r=t,i;if(h_(lR,r)&&(i=lR[r],r="%"+i[0]+"%"),h_(pd,r)){var o=pd[r];if(o===Cf&&(o=hhe(r)),typeof o>"u"&&!n)throw new ph("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:i,name:r,value:o}}throw new Yh("intrinsic "+t+" does not exist!")},She=function(t,n){if(typeof t!="string"||t.length===0)throw new ph("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof n!="boolean")throw new ph('"allowMissing" argument must be a boolean');if(mhe(/^%?[^%]*%?$/,t)===null)throw new Yh("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var r=bhe(t),i=r.length>0?r[0]:"",o=_he("%"+i+"%",n),a=o.name,s=o.value,l=!1,u=o.alias;u&&(i=u[0],ghe(r,phe([0,1],u)));for(var c=1,d=!0;c=r.length){var m=hd(s,f);d=!!m,d&&"get"in m&&!("originalValue"in m.get)?s=m.get:s=s[f]}else d=h_(s,f),s=s[f];d&&!l&&(pd[a]=s)}}return s},xhe=She,hE=xhe("%Object.defineProperty%",!0),pE=function(){if(hE)try{return hE({},"a",{value:1}),!0}catch{return!1}return!1};pE.hasArrayLengthDefineBug=function(){if(!pE())return null;try{return hE([],"length",{value:1}).length!==1}catch{return!0}};var whe=pE,Che=Xfe,Ehe=typeof Symbol=="function"&&typeof Symbol("foo")=="symbol",khe=Object.prototype.toString,The=Array.prototype.concat,$z=Object.defineProperty,Ahe=function(e){return typeof e=="function"&&khe.call(e)==="[object Function]"},Phe=whe(),Dz=$z&&Phe,Ihe=function(e,t,n,r){if(t in e){if(r===!0){if(e[t]===n)return}else if(!Ahe(r)||!r())return}Dz?$z(e,t,{configurable:!0,enumerable:!1,value:n,writable:!0}):e[t]=n},Lz=function(e,t){var n=arguments.length>2?arguments[2]:{},r=Che(t);Ehe&&(r=The.call(r,Object.getOwnPropertySymbols(t)));for(var i=0;i":return t>e;case":<":return t=":return t>=e;case":<=":return t<=e;default:throw new Error("Unimplemented comparison operator: ".concat(n))}};l2.testComparisonRange=Yhe;var u2={};Object.defineProperty(u2,"__esModule",{value:!0});u2.testRange=void 0;var Zhe=function(e,t){return typeof e=="number"?!(et.max||e===t.max&&!t.maxInclusive):!1};u2.testRange=Zhe;(function(e){var t=mt&&mt.__assign||function(){return t=Object.assign||function(c){for(var d,f=1,h=arguments.length;f0?{path:l.path,query:new RegExp("("+l.keywords.map(function(u){return(0,tpe.escapeRegexString)(u.trim())}).join("|")+")")}:{path:l.path}})};c2.highlight=rpe;var d2={},Gz={exports:{}};(function(e){(function(t,n){e.exports?e.exports=n():t.nearley=n()})(mt,function(){function t(u,c,d){return this.id=++t.highestId,this.name=u,this.symbols=c,this.postprocess=d,this}t.highestId=0,t.prototype.toString=function(u){var c=typeof u>"u"?this.symbols.map(l).join(" "):this.symbols.slice(0,u).map(l).join(" ")+" ● "+this.symbols.slice(u).map(l).join(" ");return this.name+" → "+c};function n(u,c,d,f){this.rule=u,this.dot=c,this.reference=d,this.data=[],this.wantedBy=f,this.isComplete=this.dot===u.symbols.length}n.prototype.toString=function(){return"{"+this.rule.toString(this.dot)+"}, from: "+(this.reference||0)},n.prototype.nextState=function(u){var c=new n(this.rule,this.dot+1,this.reference,this.wantedBy);return c.left=this,c.right=u,c.isComplete&&(c.data=c.build(),c.right=void 0),c},n.prototype.build=function(){var u=[],c=this;do u.push(c.right.data),c=c.left;while(c.left);return u.reverse(),u},n.prototype.finish=function(){this.rule.postprocess&&(this.data=this.rule.postprocess(this.data,this.reference,a.fail))};function r(u,c){this.grammar=u,this.index=c,this.states=[],this.wants={},this.scannable=[],this.completed={}}r.prototype.process=function(u){for(var c=this.states,d=this.wants,f=this.completed,h=0;h{let n=[],r={get(){return r.lc||r.listen(()=>{})(),r.value},l:t||0,lc:0,listen(i,o){return r.lc=n.push(i,o||r.l)/2,()=>{let a=n.indexOf(i);~a&&(n.splice(a,2),r.lc--,r.lc||r.off())}},notify(i){let o=!Yi.length;for(let a=0;a(e.events=e.events||{},e.events[n+pv]||(e.events[n+pv]=r(i=>{e.events[n].reduceRight((o,a)=>(a(o),o),{shared:{},...i})})),e.events[n]=e.events[n]||[],e.events[n].push(t),()=>{let i=e.events[n],o=i.indexOf(t);i.splice(o,1),i.length||(delete e.events[n],e.events[n+pv](),delete e.events[n+pv])}),ble=1e3,_le=(e,t)=>vle(e,r=>{let i=t(r);i&&e.events[hv].push(i)},yle,r=>{let i=e.listen;e.listen=(...a)=>(!e.lc&&!e.active&&(e.active=!0,r()),i(...a));let o=e.off;return e.events[hv]=[],e.off=()=>{o(),setTimeout(()=>{if(e.active&&!e.lc){e.active=!1;for(let a of e.events[hv])a();e.events[hv]=[]}},ble)},()=>{e.listen=i,e.off=o}}),Sle=(e,t)=>{Array.isArray(e)||(e=[e]);let n,r=()=>{let o=e.map(a=>a.get());(n===void 0||o.some((a,s)=>a!==n[s]))&&(n=o,i.set(t(...o)))},i=tl(void 0,Math.max(...e.map(o=>o.l))+1);return _le(i,()=>{let o=e.map(a=>a.listen(r,i.l));return r(),()=>{for(let a of o)a()}}),i};const PB=tl(),xle={type:"logger",log(e){this.output("log",e)},warn(e){this.output("warn",e)},error(e){this.output("error",e)},output(e,t){console&&console[e]&&console[e].apply(console,t)}};class t_{constructor(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.init(t,n)}init(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.prefix=n.prefix||"i18next:",this.logger=t||xle,this.options=n,this.debug=n.debug}log(){for(var t=arguments.length,n=new Array(t),r=0;r{this.observers[r]=this.observers[r]||[],this.observers[r].push(n)}),this}off(t,n){if(this.observers[t]){if(!n){delete this.observers[t];return}this.observers[t]=this.observers[t].filter(r=>r!==n)}}emit(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i{a(...r)}),this.observers["*"]&&[].concat(this.observers["*"]).forEach(a=>{a.apply(a,[t,...r])})}}function Vp(){let e,t;const n=new Promise((r,i)=>{e=r,t=i});return n.resolve=e,n.reject=t,n}function tI(e){return e==null?"":""+e}function wle(e,t,n){e.forEach(r=>{t[r]&&(n[r]=t[r])})}function mT(e,t,n){function r(a){return a&&a.indexOf("###")>-1?a.replace(/###/g,"."):a}function i(){return!e||typeof e=="string"}const o=typeof t!="string"?[].concat(t):t.split(".");for(;o.length>1;){if(i())return{};const a=r(o.shift());!e[a]&&n&&(e[a]=new n),Object.prototype.hasOwnProperty.call(e,a)?e=e[a]:e={}}return i()?{}:{obj:e,k:r(o.shift())}}function nI(e,t,n){const{obj:r,k:i}=mT(e,t,Object);r[i]=n}function Cle(e,t,n,r){const{obj:i,k:o}=mT(e,t,Object);i[o]=i[o]||[],r&&(i[o]=i[o].concat(n)),r||i[o].push(n)}function n_(e,t){const{obj:n,k:r}=mT(e,t);if(n)return n[r]}function Ele(e,t,n){const r=n_(e,n);return r!==void 0?r:n_(t,n)}function IB(e,t,n){for(const r in t)r!=="__proto__"&&r!=="constructor"&&(r in e?typeof e[r]=="string"||e[r]instanceof String||typeof t[r]=="string"||t[r]instanceof String?n&&(e[r]=t[r]):IB(e[r],t[r],n):e[r]=t[r]);return e}function sf(e){return e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}var kle={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};function Tle(e){return typeof e=="string"?e.replace(/[&<>"'\/]/g,t=>kle[t]):e}const Ale=[" ",",","?","!",";"];function Ple(e,t,n){t=t||"",n=n||"";const r=Ale.filter(a=>t.indexOf(a)<0&&n.indexOf(a)<0);if(r.length===0)return!0;const i=new RegExp(`(${r.map(a=>a==="?"?"\\?":a).join("|")})`);let o=!i.test(e);if(!o){const a=e.indexOf(n);a>0&&!i.test(e.substring(0,a))&&(o=!0)}return o}function r_(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:".";if(!e)return;if(e[t])return e[t];const r=t.split(n);let i=e;for(let o=0;oo+a;)a++,s=r.slice(o,o+a).join(n),l=i[s];if(l===void 0)return;if(l===null)return null;if(t.endsWith(s)){if(typeof l=="string")return l;if(s&&typeof l[s]=="string")return l[s]}const u=r.slice(o+a).join(n);return u?r_(l,u,n):void 0}i=i[r[o]]}return i}function i_(e){return e&&e.indexOf("_")>0?e.replace("_","-"):e}class rI extends YS{constructor(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{ns:["translation"],defaultNS:"translation"};super(),this.data=t||{},this.options=n,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.options.ignoreJSONStructure===void 0&&(this.options.ignoreJSONStructure=!0)}addNamespaces(t){this.options.ns.indexOf(t)<0&&this.options.ns.push(t)}removeNamespaces(t){const n=this.options.ns.indexOf(t);n>-1&&this.options.ns.splice(n,1)}getResource(t,n,r){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};const o=i.keySeparator!==void 0?i.keySeparator:this.options.keySeparator,a=i.ignoreJSONStructure!==void 0?i.ignoreJSONStructure:this.options.ignoreJSONStructure;let s=[t,n];r&&typeof r!="string"&&(s=s.concat(r)),r&&typeof r=="string"&&(s=s.concat(o?r.split(o):r)),t.indexOf(".")>-1&&(s=t.split("."));const l=n_(this.data,s);return l||!a||typeof r!="string"?l:r_(this.data&&this.data[t]&&this.data[t][n],r,o)}addResource(t,n,r,i){let o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{silent:!1};const a=o.keySeparator!==void 0?o.keySeparator:this.options.keySeparator;let s=[t,n];r&&(s=s.concat(a?r.split(a):r)),t.indexOf(".")>-1&&(s=t.split("."),i=n,n=s[1]),this.addNamespaces(n),nI(this.data,s,i),o.silent||this.emit("added",t,n,r,i)}addResources(t,n,r){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{silent:!1};for(const o in r)(typeof r[o]=="string"||Object.prototype.toString.apply(r[o])==="[object Array]")&&this.addResource(t,n,o,r[o],{silent:!0});i.silent||this.emit("added",t,n,r)}addResourceBundle(t,n,r,i,o){let a=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{silent:!1},s=[t,n];t.indexOf(".")>-1&&(s=t.split("."),i=r,r=n,n=s[1]),this.addNamespaces(n);let l=n_(this.data,s)||{};i?IB(l,r,o):l={...l,...r},nI(this.data,s,l),a.silent||this.emit("added",t,n,r)}removeResourceBundle(t,n){this.hasResourceBundle(t,n)&&delete this.data[t][n],this.removeNamespaces(n),this.emit("removed",t,n)}hasResourceBundle(t,n){return this.getResource(t,n)!==void 0}getResourceBundle(t,n){return n||(n=this.options.defaultNS),this.options.compatibilityAPI==="v1"?{...this.getResource(t,n)}:this.getResource(t,n)}getDataByLanguage(t){return this.data[t]}hasLanguageSomeTranslations(t){const n=this.getDataByLanguage(t);return!!(n&&Object.keys(n)||[]).find(i=>n[i]&&Object.keys(n[i]).length>0)}toJSON(){return this.data}}var RB={processors:{},addPostProcessor(e){this.processors[e.name]=e},handle(e,t,n,r,i){return e.forEach(o=>{this.processors[o]&&(t=this.processors[o].process(t,n,r,i))}),t}};const iI={};class o_ extends YS{constructor(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(),wle(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],t,this),this.options=n,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=Ms.create("translator")}changeLanguage(t){t&&(this.language=t)}exists(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}};if(t==null)return!1;const r=this.resolve(t,n);return r&&r.res!==void 0}extractFromKey(t,n){let r=n.nsSeparator!==void 0?n.nsSeparator:this.options.nsSeparator;r===void 0&&(r=":");const i=n.keySeparator!==void 0?n.keySeparator:this.options.keySeparator;let o=n.ns||this.options.defaultNS||[];const a=r&&t.indexOf(r)>-1,s=!this.options.userDefinedKeySeparator&&!n.keySeparator&&!this.options.userDefinedNsSeparator&&!n.nsSeparator&&!Ple(t,r,i);if(a&&!s){const l=t.match(this.interpolator.nestingRegexp);if(l&&l.length>0)return{key:t,namespaces:o};const u=t.split(r);(r!==i||r===i&&this.options.ns.indexOf(u[0])>-1)&&(o=u.shift()),t=u.join(i)}return typeof o=="string"&&(o=[o]),{key:t,namespaces:o}}translate(t,n,r){if(typeof n!="object"&&this.options.overloadTranslationOptionHandler&&(n=this.options.overloadTranslationOptionHandler(arguments)),typeof n=="object"&&(n={...n}),n||(n={}),t==null)return"";Array.isArray(t)||(t=[String(t)]);const i=n.returnDetails!==void 0?n.returnDetails:this.options.returnDetails,o=n.keySeparator!==void 0?n.keySeparator:this.options.keySeparator,{key:a,namespaces:s}=this.extractFromKey(t[t.length-1],n),l=s[s.length-1],u=n.lng||this.language,c=n.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(u&&u.toLowerCase()==="cimode"){if(c){const y=n.nsSeparator||this.options.nsSeparator;return i?{res:`${l}${y}${a}`,usedKey:a,exactUsedKey:a,usedLng:u,usedNS:l}:`${l}${y}${a}`}return i?{res:a,usedKey:a,exactUsedKey:a,usedLng:u,usedNS:l}:a}const d=this.resolve(t,n);let f=d&&d.res;const h=d&&d.usedKey||a,p=d&&d.exactUsedKey||a,m=Object.prototype.toString.apply(f),_=["[object Number]","[object Function]","[object RegExp]"],b=n.joinArrays!==void 0?n.joinArrays:this.options.joinArrays,v=!this.i18nFormat||this.i18nFormat.handleAsObject;if(v&&f&&(typeof f!="string"&&typeof f!="boolean"&&typeof f!="number")&&_.indexOf(m)<0&&!(typeof b=="string"&&m==="[object Array]")){if(!n.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const y=this.options.returnedObjectHandler?this.options.returnedObjectHandler(h,f,{...n,ns:s}):`key '${a} (${this.language})' returned an object instead of string.`;return i?(d.res=y,d):y}if(o){const y=m==="[object Array]",S=y?[]:{},w=y?p:h;for(const x in f)if(Object.prototype.hasOwnProperty.call(f,x)){const C=`${w}${o}${x}`;S[x]=this.translate(C,{...n,joinArrays:!1,ns:s}),S[x]===C&&(S[x]=f[x])}f=S}}else if(v&&typeof b=="string"&&m==="[object Array]")f=f.join(b),f&&(f=this.extendTranslation(f,t,n,r));else{let y=!1,S=!1;const w=n.count!==void 0&&typeof n.count!="string",x=o_.hasDefaultValue(n),C=w?this.pluralResolver.getSuffix(u,n.count,n):"",T=n.ordinal&&w?this.pluralResolver.getSuffix(u,n.count,{ordinal:!1}):"",k=n[`defaultValue${C}`]||n[`defaultValue${T}`]||n.defaultValue;!this.isValidLookup(f)&&x&&(y=!0,f=k),this.isValidLookup(f)||(S=!0,f=a);const $=(n.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&S?void 0:f,O=x&&k!==f&&this.options.updateMissing;if(S||y||O){if(this.logger.log(O?"updateKey":"missingKey",u,l,a,O?k:f),o){const L=this.resolve(a,{...n,keySeparator:!1});L&&L.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}let E=[];const A=this.languageUtils.getFallbackCodes(this.options.fallbackLng,n.lng||this.language);if(this.options.saveMissingTo==="fallback"&&A&&A[0])for(let L=0;L{const N=x&&R!==f?R:$;this.options.missingKeyHandler?this.options.missingKeyHandler(L,l,M,N,O,n):this.backendConnector&&this.backendConnector.saveMissing&&this.backendConnector.saveMissing(L,l,M,N,O,n),this.emit("missingKey",L,l,M,f)};this.options.saveMissing&&(this.options.saveMissingPlurals&&w?E.forEach(L=>{this.pluralResolver.getSuffixes(L,n).forEach(M=>{D([L],a+M,n[`defaultValue${M}`]||k)})}):D(E,a,k))}f=this.extendTranslation(f,t,n,d,r),S&&f===a&&this.options.appendNamespaceToMissingKey&&(f=`${l}:${a}`),(S||y)&&this.options.parseMissingKeyHandler&&(this.options.compatibilityAPI!=="v1"?f=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${l}:${a}`:a,y?f:void 0):f=this.options.parseMissingKeyHandler(f))}return i?(d.res=f,d):f}extendTranslation(t,n,r,i,o){var a=this;if(this.i18nFormat&&this.i18nFormat.parse)t=this.i18nFormat.parse(t,{...this.options.interpolation.defaultVariables,...r},i.usedLng,i.usedNS,i.usedKey,{resolved:i});else if(!r.skipInterpolation){r.interpolation&&this.interpolator.init({...r,interpolation:{...this.options.interpolation,...r.interpolation}});const u=typeof t=="string"&&(r&&r.interpolation&&r.interpolation.skipOnVariables!==void 0?r.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let c;if(u){const f=t.match(this.interpolator.nestingRegexp);c=f&&f.length}let d=r.replace&&typeof r.replace!="string"?r.replace:r;if(this.options.interpolation.defaultVariables&&(d={...this.options.interpolation.defaultVariables,...d}),t=this.interpolator.interpolate(t,d,r.lng||this.language,r),u){const f=t.match(this.interpolator.nestingRegexp),h=f&&f.length;c1&&arguments[1]!==void 0?arguments[1]:{},r,i,o,a,s;return typeof t=="string"&&(t=[t]),t.forEach(l=>{if(this.isValidLookup(r))return;const u=this.extractFromKey(l,n),c=u.key;i=c;let d=u.namespaces;this.options.fallbackNS&&(d=d.concat(this.options.fallbackNS));const f=n.count!==void 0&&typeof n.count!="string",h=f&&!n.ordinal&&n.count===0&&this.pluralResolver.shouldUseIntlApi(),p=n.context!==void 0&&(typeof n.context=="string"||typeof n.context=="number")&&n.context!=="",m=n.lngs?n.lngs:this.languageUtils.toResolveHierarchy(n.lng||this.language,n.fallbackLng);d.forEach(_=>{this.isValidLookup(r)||(s=_,!iI[`${m[0]}-${_}`]&&this.utils&&this.utils.hasLoadedNamespace&&!this.utils.hasLoadedNamespace(s)&&(iI[`${m[0]}-${_}`]=!0,this.logger.warn(`key "${i}" for languages "${m.join(", ")}" won't get resolved as namespace "${s}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),m.forEach(b=>{if(this.isValidLookup(r))return;a=b;const v=[c];if(this.i18nFormat&&this.i18nFormat.addLookupKeys)this.i18nFormat.addLookupKeys(v,c,b,_,n);else{let y;f&&(y=this.pluralResolver.getSuffix(b,n.count,n));const S=`${this.options.pluralSeparator}zero`,w=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(f&&(v.push(c+y),n.ordinal&&y.indexOf(w)===0&&v.push(c+y.replace(w,this.options.pluralSeparator)),h&&v.push(c+S)),p){const x=`${c}${this.options.contextSeparator}${n.context}`;v.push(x),f&&(v.push(x+y),n.ordinal&&y.indexOf(w)===0&&v.push(x+y.replace(w,this.options.pluralSeparator)),h&&v.push(x+S))}}let g;for(;g=v.pop();)this.isValidLookup(r)||(o=g,r=this.getResource(b,_,g,n))}))})}),{res:r,usedKey:i,exactUsedKey:o,usedLng:a,usedNS:s}}isValidLookup(t){return t!==void 0&&!(!this.options.returnNull&&t===null)&&!(!this.options.returnEmptyString&&t==="")}getResource(t,n,r){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};return this.i18nFormat&&this.i18nFormat.getResource?this.i18nFormat.getResource(t,n,r,i):this.resourceStore.getResource(t,n,r,i)}static hasDefaultValue(t){const n="defaultValue";for(const r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&n===r.substring(0,n.length)&&t[r]!==void 0)return!0;return!1}}function iC(e){return e.charAt(0).toUpperCase()+e.slice(1)}class oI{constructor(t){this.options=t,this.supportedLngs=this.options.supportedLngs||!1,this.logger=Ms.create("languageUtils")}getScriptPartFromCode(t){if(t=i_(t),!t||t.indexOf("-")<0)return null;const n=t.split("-");return n.length===2||(n.pop(),n[n.length-1].toLowerCase()==="x")?null:this.formatLanguageCode(n.join("-"))}getLanguagePartFromCode(t){if(t=i_(t),!t||t.indexOf("-")<0)return t;const n=t.split("-");return this.formatLanguageCode(n[0])}formatLanguageCode(t){if(typeof t=="string"&&t.indexOf("-")>-1){const n=["hans","hant","latn","cyrl","cans","mong","arab"];let r=t.split("-");return this.options.lowerCaseLng?r=r.map(i=>i.toLowerCase()):r.length===2?(r[0]=r[0].toLowerCase(),r[1]=r[1].toUpperCase(),n.indexOf(r[1].toLowerCase())>-1&&(r[1]=iC(r[1].toLowerCase()))):r.length===3&&(r[0]=r[0].toLowerCase(),r[1].length===2&&(r[1]=r[1].toUpperCase()),r[0]!=="sgn"&&r[2].length===2&&(r[2]=r[2].toUpperCase()),n.indexOf(r[1].toLowerCase())>-1&&(r[1]=iC(r[1].toLowerCase())),n.indexOf(r[2].toLowerCase())>-1&&(r[2]=iC(r[2].toLowerCase()))),r.join("-")}return this.options.cleanCode||this.options.lowerCaseLng?t.toLowerCase():t}isSupportedCode(t){return(this.options.load==="languageOnly"||this.options.nonExplicitSupportedLngs)&&(t=this.getLanguagePartFromCode(t)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(t)>-1}getBestMatchFromCodes(t){if(!t)return null;let n;return t.forEach(r=>{if(n)return;const i=this.formatLanguageCode(r);(!this.options.supportedLngs||this.isSupportedCode(i))&&(n=i)}),!n&&this.options.supportedLngs&&t.forEach(r=>{if(n)return;const i=this.getLanguagePartFromCode(r);if(this.isSupportedCode(i))return n=i;n=this.options.supportedLngs.find(o=>{if(o===i)return o;if(!(o.indexOf("-")<0&&i.indexOf("-")<0)&&o.indexOf(i)===0)return o})}),n||(n=this.getFallbackCodes(this.options.fallbackLng)[0]),n}getFallbackCodes(t,n){if(!t)return[];if(typeof t=="function"&&(t=t(n)),typeof t=="string"&&(t=[t]),Object.prototype.toString.apply(t)==="[object Array]")return t;if(!n)return t.default||[];let r=t[n];return r||(r=t[this.getScriptPartFromCode(n)]),r||(r=t[this.formatLanguageCode(n)]),r||(r=t[this.getLanguagePartFromCode(n)]),r||(r=t.default),r||[]}toResolveHierarchy(t,n){const r=this.getFallbackCodes(n||this.options.fallbackLng||[],t),i=[],o=a=>{a&&(this.isSupportedCode(a)?i.push(a):this.logger.warn(`rejecting language code not found in supportedLngs: ${a}`))};return typeof t=="string"&&(t.indexOf("-")>-1||t.indexOf("_")>-1)?(this.options.load!=="languageOnly"&&o(this.formatLanguageCode(t)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&o(this.getScriptPartFromCode(t)),this.options.load!=="currentOnly"&&o(this.getLanguagePartFromCode(t))):typeof t=="string"&&o(this.formatLanguageCode(t)),r.forEach(a=>{i.indexOf(a)<0&&o(this.formatLanguageCode(a))}),i}}let Ile=[{lngs:["ach","ak","am","arn","br","fil","gun","ln","mfe","mg","mi","oc","pt","pt-BR","tg","tl","ti","tr","uz","wa"],nr:[1,2],fc:1},{lngs:["af","an","ast","az","bg","bn","ca","da","de","dev","el","en","eo","es","et","eu","fi","fo","fur","fy","gl","gu","ha","hi","hu","hy","ia","it","kk","kn","ku","lb","mai","ml","mn","mr","nah","nap","nb","ne","nl","nn","no","nso","pa","pap","pms","ps","pt-PT","rm","sco","se","si","so","son","sq","sv","sw","ta","te","tk","ur","yo"],nr:[1,2],fc:2},{lngs:["ay","bo","cgg","fa","ht","id","ja","jbo","ka","km","ko","ky","lo","ms","sah","su","th","tt","ug","vi","wo","zh"],nr:[1],fc:3},{lngs:["be","bs","cnr","dz","hr","ru","sr","uk"],nr:[1,2,5],fc:4},{lngs:["ar"],nr:[0,1,2,3,11,100],fc:5},{lngs:["cs","sk"],nr:[1,2,5],fc:6},{lngs:["csb","pl"],nr:[1,2,5],fc:7},{lngs:["cy"],nr:[1,2,3,8],fc:8},{lngs:["fr"],nr:[1,2],fc:9},{lngs:["ga"],nr:[1,2,3,7,11],fc:10},{lngs:["gd"],nr:[1,2,3,20],fc:11},{lngs:["is"],nr:[1,2],fc:12},{lngs:["jv"],nr:[0,1],fc:13},{lngs:["kw"],nr:[1,2,3,4],fc:14},{lngs:["lt"],nr:[1,2,10],fc:15},{lngs:["lv"],nr:[1,2,0],fc:16},{lngs:["mk"],nr:[1,2],fc:17},{lngs:["mnk"],nr:[0,1,2],fc:18},{lngs:["mt"],nr:[1,2,11,20],fc:19},{lngs:["or"],nr:[2,1],fc:2},{lngs:["ro"],nr:[1,2,20],fc:20},{lngs:["sl"],nr:[5,1,2,3],fc:21},{lngs:["he","iw"],nr:[1,2,20,21],fc:22}],Rle={1:function(e){return+(e>1)},2:function(e){return+(e!=1)},3:function(e){return 0},4:function(e){return e%10==1&&e%100!=11?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2},5:function(e){return e==0?0:e==1?1:e==2?2:e%100>=3&&e%100<=10?3:e%100>=11?4:5},6:function(e){return e==1?0:e>=2&&e<=4?1:2},7:function(e){return e==1?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2},8:function(e){return e==1?0:e==2?1:e!=8&&e!=11?2:3},9:function(e){return+(e>=2)},10:function(e){return e==1?0:e==2?1:e<7?2:e<11?3:4},11:function(e){return e==1||e==11?0:e==2||e==12?1:e>2&&e<20?2:3},12:function(e){return+(e%10!=1||e%100==11)},13:function(e){return+(e!==0)},14:function(e){return e==1?0:e==2?1:e==3?2:3},15:function(e){return e%10==1&&e%100!=11?0:e%10>=2&&(e%100<10||e%100>=20)?1:2},16:function(e){return e%10==1&&e%100!=11?0:e!==0?1:2},17:function(e){return e==1||e%10==1&&e%100!=11?0:1},18:function(e){return e==0?0:e==1?1:2},19:function(e){return e==1?0:e==0||e%100>1&&e%100<11?1:e%100>10&&e%100<20?2:3},20:function(e){return e==1?0:e==0||e%100>0&&e%100<20?1:2},21:function(e){return e%100==1?1:e%100==2?2:e%100==3||e%100==4?3:0},22:function(e){return e==1?0:e==2?1:(e<0||e>10)&&e%10==0?2:3}};const Ole=["v1","v2","v3"],Mle=["v4"],aI={zero:0,one:1,two:2,few:3,many:4,other:5};function Nle(){const e={};return Ile.forEach(t=>{t.lngs.forEach(n=>{e[n]={numbers:t.nr,plurals:Rle[t.fc]}})}),e}class $le{constructor(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.languageUtils=t,this.options=n,this.logger=Ms.create("pluralResolver"),(!this.options.compatibilityJSON||Mle.includes(this.options.compatibilityJSON))&&(typeof Intl>"u"||!Intl.PluralRules)&&(this.options.compatibilityJSON="v3",this.logger.error("Your environment seems not to be Intl API compatible, use an Intl.PluralRules polyfill. Will fallback to the compatibilityJSON v3 format handling.")),this.rules=Nle()}addRule(t,n){this.rules[t]=n}getRule(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(this.shouldUseIntlApi())try{return new Intl.PluralRules(i_(t),{type:n.ordinal?"ordinal":"cardinal"})}catch{return}return this.rules[t]||this.rules[this.languageUtils.getLanguagePartFromCode(t)]}needsPlural(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const r=this.getRule(t,n);return this.shouldUseIntlApi()?r&&r.resolvedOptions().pluralCategories.length>1:r&&r.numbers.length>1}getPluralFormsOfKey(t,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return this.getSuffixes(t,r).map(i=>`${n}${i}`)}getSuffixes(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const r=this.getRule(t,n);return r?this.shouldUseIntlApi()?r.resolvedOptions().pluralCategories.sort((i,o)=>aI[i]-aI[o]).map(i=>`${this.options.prepend}${n.ordinal?`ordinal${this.options.prepend}`:""}${i}`):r.numbers.map(i=>this.getSuffix(t,i,n)):[]}getSuffix(t,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const i=this.getRule(t,r);return i?this.shouldUseIntlApi()?`${this.options.prepend}${r.ordinal?`ordinal${this.options.prepend}`:""}${i.select(n)}`:this.getSuffixRetroCompatible(i,n):(this.logger.warn(`no plural rule found for: ${t}`),"")}getSuffixRetroCompatible(t,n){const r=t.noAbs?t.plurals(n):t.plurals(Math.abs(n));let i=t.numbers[r];this.options.simplifyPluralSuffix&&t.numbers.length===2&&t.numbers[0]===1&&(i===2?i="plural":i===1&&(i=""));const o=()=>this.options.prepend&&i.toString()?this.options.prepend+i.toString():i.toString();return this.options.compatibilityJSON==="v1"?i===1?"":typeof i=="number"?`_plural_${i.toString()}`:o():this.options.compatibilityJSON==="v2"||this.options.simplifyPluralSuffix&&t.numbers.length===2&&t.numbers[0]===1?o():this.options.prepend&&r.toString()?this.options.prepend+r.toString():r.toString()}shouldUseIntlApi(){return!Ole.includes(this.options.compatibilityJSON)}}function sI(e,t,n){let r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:".",i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,o=Ele(e,t,n);return!o&&i&&typeof n=="string"&&(o=r_(e,n,r),o===void 0&&(o=r_(t,n,r))),o}class Dle{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=Ms.create("interpolator"),this.options=t,this.format=t.interpolation&&t.interpolation.format||(n=>n),this.init(t)}init(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};t.interpolation||(t.interpolation={escapeValue:!0});const n=t.interpolation;this.escape=n.escape!==void 0?n.escape:Tle,this.escapeValue=n.escapeValue!==void 0?n.escapeValue:!0,this.useRawValueToEscape=n.useRawValueToEscape!==void 0?n.useRawValueToEscape:!1,this.prefix=n.prefix?sf(n.prefix):n.prefixEscaped||"{{",this.suffix=n.suffix?sf(n.suffix):n.suffixEscaped||"}}",this.formatSeparator=n.formatSeparator?n.formatSeparator:n.formatSeparator||",",this.unescapePrefix=n.unescapeSuffix?"":n.unescapePrefix||"-",this.unescapeSuffix=this.unescapePrefix?"":n.unescapeSuffix||"",this.nestingPrefix=n.nestingPrefix?sf(n.nestingPrefix):n.nestingPrefixEscaped||sf("$t("),this.nestingSuffix=n.nestingSuffix?sf(n.nestingSuffix):n.nestingSuffixEscaped||sf(")"),this.nestingOptionsSeparator=n.nestingOptionsSeparator?n.nestingOptionsSeparator:n.nestingOptionsSeparator||",",this.maxReplaces=n.maxReplaces?n.maxReplaces:1e3,this.alwaysFormat=n.alwaysFormat!==void 0?n.alwaysFormat:!1,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){const t=`${this.prefix}(.+?)${this.suffix}`;this.regexp=new RegExp(t,"g");const n=`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`;this.regexpUnescape=new RegExp(n,"g");const r=`${this.nestingPrefix}(.+?)${this.nestingSuffix}`;this.nestingRegexp=new RegExp(r,"g")}interpolate(t,n,r,i){let o,a,s;const l=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{};function u(p){return p.replace(/\$/g,"$$$$")}const c=p=>{if(p.indexOf(this.formatSeparator)<0){const v=sI(n,l,p,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(v,void 0,r,{...i,...n,interpolationkey:p}):v}const m=p.split(this.formatSeparator),_=m.shift().trim(),b=m.join(this.formatSeparator).trim();return this.format(sI(n,l,_,this.options.keySeparator,this.options.ignoreJSONStructure),b,r,{...i,...n,interpolationkey:_})};this.resetRegExp();const d=i&&i.missingInterpolationHandler||this.options.missingInterpolationHandler,f=i&&i.interpolation&&i.interpolation.skipOnVariables!==void 0?i.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:p=>u(p)},{regex:this.regexp,safeValue:p=>this.escapeValue?u(this.escape(p)):u(p)}].forEach(p=>{for(s=0;o=p.regex.exec(t);){const m=o[1].trim();if(a=c(m),a===void 0)if(typeof d=="function"){const b=d(t,o,i);a=typeof b=="string"?b:""}else if(i&&Object.prototype.hasOwnProperty.call(i,m))a="";else if(f){a=o[0];continue}else this.logger.warn(`missed to pass in variable ${m} for interpolating ${t}`),a="";else typeof a!="string"&&!this.useRawValueToEscape&&(a=tI(a));const _=p.safeValue(a);if(t=t.replace(o[0],_),f?(p.regex.lastIndex+=a.length,p.regex.lastIndex-=o[0].length):p.regex.lastIndex=0,s++,s>=this.maxReplaces)break}}),t}nest(t,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},i,o,a;function s(l,u){const c=this.nestingOptionsSeparator;if(l.indexOf(c)<0)return l;const d=l.split(new RegExp(`${c}[ ]*{`));let f=`{${d[1]}`;l=d[0],f=this.interpolate(f,a);const h=f.match(/'/g),p=f.match(/"/g);(h&&h.length%2===0&&!p||p.length%2!==0)&&(f=f.replace(/'/g,'"'));try{a=JSON.parse(f),u&&(a={...u,...a})}catch(m){return this.logger.warn(`failed parsing options string in nesting for key ${l}`,m),`${l}${c}${f}`}return delete a.defaultValue,l}for(;i=this.nestingRegexp.exec(t);){let l=[];a={...r},a=a.replace&&typeof a.replace!="string"?a.replace:a,a.applyPostProcessor=!1,delete a.defaultValue;let u=!1;if(i[0].indexOf(this.formatSeparator)!==-1&&!/{.*}/.test(i[1])){const c=i[1].split(this.formatSeparator).map(d=>d.trim());i[1]=c.shift(),l=c,u=!0}if(o=n(s.call(this,i[1].trim(),a),a),o&&i[0]===t&&typeof o!="string")return o;typeof o!="string"&&(o=tI(o)),o||(this.logger.warn(`missed to resolve ${i[1]} for nesting ${t}`),o=""),u&&(o=l.reduce((c,d)=>this.format(c,d,r.lng,{...r,interpolationkey:i[1].trim()}),o.trim())),t=t.replace(i[0],o),this.regexp.lastIndex=0}return t}}function Lle(e){let t=e.toLowerCase().trim();const n={};if(e.indexOf("(")>-1){const r=e.split("(");t=r[0].toLowerCase().trim();const i=r[1].substring(0,r[1].length-1);t==="currency"&&i.indexOf(":")<0?n.currency||(n.currency=i.trim()):t==="relativetime"&&i.indexOf(":")<0?n.range||(n.range=i.trim()):i.split(";").forEach(a=>{if(!a)return;const[s,...l]=a.split(":"),u=l.join(":").trim().replace(/^'+|'+$/g,"");n[s.trim()]||(n[s.trim()]=u),u==="false"&&(n[s.trim()]=!1),u==="true"&&(n[s.trim()]=!0),isNaN(u)||(n[s.trim()]=parseInt(u,10))})}return{formatName:t,formatOptions:n}}function lf(e){const t={};return function(r,i,o){const a=i+JSON.stringify(o);let s=t[a];return s||(s=e(i_(i),o),t[a]=s),s(r)}}class Fle{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=Ms.create("formatter"),this.options=t,this.formats={number:lf((n,r)=>{const i=new Intl.NumberFormat(n,{...r});return o=>i.format(o)}),currency:lf((n,r)=>{const i=new Intl.NumberFormat(n,{...r,style:"currency"});return o=>i.format(o)}),datetime:lf((n,r)=>{const i=new Intl.DateTimeFormat(n,{...r});return o=>i.format(o)}),relativetime:lf((n,r)=>{const i=new Intl.RelativeTimeFormat(n,{...r});return o=>i.format(o,r.range||"day")}),list:lf((n,r)=>{const i=new Intl.ListFormat(n,{...r});return o=>i.format(o)})},this.init(t)}init(t){const r=(arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}}).interpolation;this.formatSeparator=r.formatSeparator?r.formatSeparator:r.formatSeparator||","}add(t,n){this.formats[t.toLowerCase().trim()]=n}addCached(t,n){this.formats[t.toLowerCase().trim()]=lf(n)}format(t,n,r){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};return n.split(this.formatSeparator).reduce((s,l)=>{const{formatName:u,formatOptions:c}=Lle(l);if(this.formats[u]){let d=s;try{const f=i&&i.formatParams&&i.formatParams[i.interpolationkey]||{},h=f.locale||f.lng||i.locale||i.lng||r;d=this.formats[u](s,h,{...c,...i,...f})}catch(f){this.logger.warn(f)}return d}else this.logger.warn(`there was no format function for ${u}`);return s},t)}}function Ble(e,t){e.pending[t]!==void 0&&(delete e.pending[t],e.pendingCount--)}class zle extends YS{constructor(t,n,r){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};super(),this.backend=t,this.store=n,this.services=r,this.languageUtils=r.languageUtils,this.options=i,this.logger=Ms.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=i.maxParallelReads||10,this.readingCalls=0,this.maxRetries=i.maxRetries>=0?i.maxRetries:5,this.retryTimeout=i.retryTimeout>=1?i.retryTimeout:350,this.state={},this.queue=[],this.backend&&this.backend.init&&this.backend.init(r,i.backend,i)}queueLoad(t,n,r,i){const o={},a={},s={},l={};return t.forEach(u=>{let c=!0;n.forEach(d=>{const f=`${u}|${d}`;!r.reload&&this.store.hasResourceBundle(u,d)?this.state[f]=2:this.state[f]<0||(this.state[f]===1?a[f]===void 0&&(a[f]=!0):(this.state[f]=1,c=!1,a[f]===void 0&&(a[f]=!0),o[f]===void 0&&(o[f]=!0),l[d]===void 0&&(l[d]=!0)))}),c||(s[u]=!0)}),(Object.keys(o).length||Object.keys(a).length)&&this.queue.push({pending:a,pendingCount:Object.keys(a).length,loaded:{},errors:[],callback:i}),{toLoad:Object.keys(o),pending:Object.keys(a),toLoadLanguages:Object.keys(s),toLoadNamespaces:Object.keys(l)}}loaded(t,n,r){const i=t.split("|"),o=i[0],a=i[1];n&&this.emit("failedLoading",o,a,n),r&&this.store.addResourceBundle(o,a,r),this.state[t]=n?-1:2;const s={};this.queue.forEach(l=>{Cle(l.loaded,[o],a),Ble(l,t),n&&l.errors.push(n),l.pendingCount===0&&!l.done&&(Object.keys(l.loaded).forEach(u=>{s[u]||(s[u]={});const c=l.loaded[u];c.length&&c.forEach(d=>{s[u][d]===void 0&&(s[u][d]=!0)})}),l.done=!0,l.errors.length?l.callback(l.errors):l.callback())}),this.emit("loaded",s),this.queue=this.queue.filter(l=>!l.done)}read(t,n,r){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:this.retryTimeout,a=arguments.length>5?arguments[5]:void 0;if(!t.length)return a(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:t,ns:n,fcName:r,tried:i,wait:o,callback:a});return}this.readingCalls++;const s=(u,c)=>{if(this.readingCalls--,this.waitingReads.length>0){const d=this.waitingReads.shift();this.read(d.lng,d.ns,d.fcName,d.tried,d.wait,d.callback)}if(u&&c&&i{this.read.call(this,t,n,r,i+1,o*2,a)},o);return}a(u,c)},l=this.backend[r].bind(this.backend);if(l.length===2){try{const u=l(t,n);u&&typeof u.then=="function"?u.then(c=>s(null,c)).catch(s):s(null,u)}catch(u){s(u)}return}return l(t,n,s)}prepareLoading(t,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},i=arguments.length>3?arguments[3]:void 0;if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),i&&i();typeof t=="string"&&(t=this.languageUtils.toResolveHierarchy(t)),typeof n=="string"&&(n=[n]);const o=this.queueLoad(t,n,r,i);if(!o.toLoad.length)return o.pending.length||i(),null;o.toLoad.forEach(a=>{this.loadOne(a)})}load(t,n,r){this.prepareLoading(t,n,{},r)}reload(t,n,r){this.prepareLoading(t,n,{reload:!0},r)}loadOne(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";const r=t.split("|"),i=r[0],o=r[1];this.read(i,o,"read",void 0,void 0,(a,s)=>{a&&this.logger.warn(`${n}loading namespace ${o} for language ${i} failed`,a),!a&&s&&this.logger.log(`${n}loaded namespace ${o} for language ${i}`,s),this.loaded(t,a,s)})}saveMissing(t,n,r,i,o){let a=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{},s=arguments.length>6&&arguments[6]!==void 0?arguments[6]:()=>{};if(this.services.utils&&this.services.utils.hasLoadedNamespace&&!this.services.utils.hasLoadedNamespace(n)){this.logger.warn(`did not save key "${r}" as the namespace "${n}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");return}if(!(r==null||r==="")){if(this.backend&&this.backend.create){const l={...a,isUpdate:o},u=this.backend.create.bind(this.backend);if(u.length<6)try{let c;u.length===5?c=u(t,n,r,i,l):c=u(t,n,r,i),c&&typeof c.then=="function"?c.then(d=>s(null,d)).catch(s):s(null,c)}catch(c){s(c)}else u(t,n,r,i,s,l)}!t||!t[0]||this.store.addResource(t[0],n,r,i)}}}function lI(){return{debug:!1,initImmediate:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!1,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:function(t){let n={};if(typeof t[1]=="object"&&(n=t[1]),typeof t[1]=="string"&&(n.defaultValue=t[1]),typeof t[2]=="string"&&(n.tDescription=t[2]),typeof t[2]=="object"||typeof t[3]=="object"){const r=t[3]||t[2];Object.keys(r).forEach(i=>{n[i]=r[i]})}return n},interpolation:{escapeValue:!0,format:(e,t,n,r)=>e,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0}}}function uI(e){return typeof e.ns=="string"&&(e.ns=[e.ns]),typeof e.fallbackLng=="string"&&(e.fallbackLng=[e.fallbackLng]),typeof e.fallbackNS=="string"&&(e.fallbackNS=[e.fallbackNS]),e.supportedLngs&&e.supportedLngs.indexOf("cimode")<0&&(e.supportedLngs=e.supportedLngs.concat(["cimode"])),e}function gv(){}function jle(e){Object.getOwnPropertyNames(Object.getPrototypeOf(e)).forEach(n=>{typeof e[n]=="function"&&(e[n]=e[n].bind(e))})}class Wm extends YS{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;if(super(),this.options=uI(t),this.services={},this.logger=Ms,this.modules={external:[]},jle(this),n&&!this.isInitialized&&!t.isClone){if(!this.options.initImmediate)return this.init(t,n),this;setTimeout(()=>{this.init(t,n)},0)}}init(){var t=this;let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0;typeof n=="function"&&(r=n,n={}),!n.defaultNS&&n.defaultNS!==!1&&n.ns&&(typeof n.ns=="string"?n.defaultNS=n.ns:n.ns.indexOf("translation")<0&&(n.defaultNS=n.ns[0]));const i=lI();this.options={...i,...this.options,...uI(n)},this.options.compatibilityAPI!=="v1"&&(this.options.interpolation={...i.interpolation,...this.options.interpolation}),n.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=n.keySeparator),n.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=n.nsSeparator);function o(c){return c?typeof c=="function"?new c:c:null}if(!this.options.isClone){this.modules.logger?Ms.init(o(this.modules.logger),this.options):Ms.init(null,this.options);let c;this.modules.formatter?c=this.modules.formatter:typeof Intl<"u"&&(c=Fle);const d=new oI(this.options);this.store=new rI(this.options.resources,this.options);const f=this.services;f.logger=Ms,f.resourceStore=this.store,f.languageUtils=d,f.pluralResolver=new $le(d,{prepend:this.options.pluralSeparator,compatibilityJSON:this.options.compatibilityJSON,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),c&&(!this.options.interpolation.format||this.options.interpolation.format===i.interpolation.format)&&(f.formatter=o(c),f.formatter.init(f,this.options),this.options.interpolation.format=f.formatter.format.bind(f.formatter)),f.interpolator=new Dle(this.options),f.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},f.backendConnector=new zle(o(this.modules.backend),f.resourceStore,f,this.options),f.backendConnector.on("*",function(h){for(var p=arguments.length,m=new Array(p>1?p-1:0),_=1;_1?p-1:0),_=1;_{h.init&&h.init(this)})}if(this.format=this.options.interpolation.format,r||(r=gv),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const c=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);c.length>0&&c[0]!=="dev"&&(this.options.lng=c[0])}!this.services.languageDetector&&!this.options.lng&&this.logger.warn("init: no languageDetector is used and no lng is defined"),["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach(c=>{this[c]=function(){return t.store[c](...arguments)}}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(c=>{this[c]=function(){return t.store[c](...arguments),t}});const l=Vp(),u=()=>{const c=(d,f)=>{this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn("init: i18next is already initialized. You should call init just once!"),this.isInitialized=!0,this.options.isClone||this.logger.log("initialized",this.options),this.emit("initialized",this.options),l.resolve(f),r(d,f)};if(this.languages&&this.options.compatibilityAPI!=="v1"&&!this.isInitialized)return c(null,this.t.bind(this));this.changeLanguage(this.options.lng,c)};return this.options.resources||!this.options.initImmediate?u():setTimeout(u,0),l}loadResources(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:gv;const i=typeof t=="string"?t:this.language;if(typeof t=="function"&&(r=t),!this.options.resources||this.options.partialBundledLanguages){if(i&&i.toLowerCase()==="cimode")return r();const o=[],a=s=>{if(!s)return;this.services.languageUtils.toResolveHierarchy(s).forEach(u=>{o.indexOf(u)<0&&o.push(u)})};i?a(i):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(l=>a(l)),this.options.preload&&this.options.preload.forEach(s=>a(s)),this.services.backendConnector.load(o,this.options.ns,s=>{!s&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),r(s)})}else r(null)}reloadResources(t,n,r){const i=Vp();return t||(t=this.languages),n||(n=this.options.ns),r||(r=gv),this.services.backendConnector.reload(t,n,o=>{i.resolve(),r(o)}),i}use(t){if(!t)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!t.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return t.type==="backend"&&(this.modules.backend=t),(t.type==="logger"||t.log&&t.warn&&t.error)&&(this.modules.logger=t),t.type==="languageDetector"&&(this.modules.languageDetector=t),t.type==="i18nFormat"&&(this.modules.i18nFormat=t),t.type==="postProcessor"&&RB.addPostProcessor(t),t.type==="formatter"&&(this.modules.formatter=t),t.type==="3rdParty"&&this.modules.external.push(t),this}setResolvedLanguage(t){if(!(!t||!this.languages)&&!(["cimode","dev"].indexOf(t)>-1))for(let n=0;n-1)&&this.store.hasLanguageSomeTranslations(r)){this.resolvedLanguage=r;break}}}changeLanguage(t,n){var r=this;this.isLanguageChangingTo=t;const i=Vp();this.emit("languageChanging",t);const o=l=>{this.language=l,this.languages=this.services.languageUtils.toResolveHierarchy(l),this.resolvedLanguage=void 0,this.setResolvedLanguage(l)},a=(l,u)=>{u?(o(u),this.translator.changeLanguage(u),this.isLanguageChangingTo=void 0,this.emit("languageChanged",u),this.logger.log("languageChanged",u)):this.isLanguageChangingTo=void 0,i.resolve(function(){return r.t(...arguments)}),n&&n(l,function(){return r.t(...arguments)})},s=l=>{!t&&!l&&this.services.languageDetector&&(l=[]);const u=typeof l=="string"?l:this.services.languageUtils.getBestMatchFromCodes(l);u&&(this.language||o(u),this.translator.language||this.translator.changeLanguage(u),this.services.languageDetector&&this.services.languageDetector.cacheUserLanguage&&this.services.languageDetector.cacheUserLanguage(u)),this.loadResources(u,c=>{a(c,u)})};return!t&&this.services.languageDetector&&!this.services.languageDetector.async?s(this.services.languageDetector.detect()):!t&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(s):this.services.languageDetector.detect(s):s(t),i}getFixedT(t,n,r){var i=this;const o=function(a,s){let l;if(typeof s!="object"){for(var u=arguments.length,c=new Array(u>2?u-2:0),d=2;d`${l.keyPrefix}${f}${p}`):h=l.keyPrefix?`${l.keyPrefix}${f}${a}`:a,i.t(h,l)};return typeof t=="string"?o.lng=t:o.lngs=t,o.ns=n,o.keyPrefix=r,o}t(){return this.translator&&this.translator.translate(...arguments)}exists(){return this.translator&&this.translator.exists(...arguments)}setDefaultNamespace(t){this.options.defaultNS=t}hasLoadedNamespace(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;const r=n.lng||this.resolvedLanguage||this.languages[0],i=this.options?this.options.fallbackLng:!1,o=this.languages[this.languages.length-1];if(r.toLowerCase()==="cimode")return!0;const a=(s,l)=>{const u=this.services.backendConnector.state[`${s}|${l}`];return u===-1||u===2};if(n.precheck){const s=n.precheck(this,a);if(s!==void 0)return s}return!!(this.hasResourceBundle(r,t)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||a(r,t)&&(!i||a(o,t)))}loadNamespaces(t,n){const r=Vp();return this.options.ns?(typeof t=="string"&&(t=[t]),t.forEach(i=>{this.options.ns.indexOf(i)<0&&this.options.ns.push(i)}),this.loadResources(i=>{r.resolve(),n&&n(i)}),r):(n&&n(),Promise.resolve())}loadLanguages(t,n){const r=Vp();typeof t=="string"&&(t=[t]);const i=this.options.preload||[],o=t.filter(a=>i.indexOf(a)<0);return o.length?(this.options.preload=i.concat(o),this.loadResources(a=>{r.resolve(),n&&n(a)}),r):(n&&n(),Promise.resolve())}dir(t){if(t||(t=this.resolvedLanguage||(this.languages&&this.languages.length>0?this.languages[0]:this.language)),!t)return"rtl";const n=["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"],r=this.services&&this.services.languageUtils||new oI(lI());return n.indexOf(r.getLanguagePartFromCode(t))>-1||t.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;return new Wm(t,n)}cloneInstance(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:gv;const r=t.forkResourceStore;r&&delete t.forkResourceStore;const i={...this.options,...t,isClone:!0},o=new Wm(i);return(t.debug!==void 0||t.prefix!==void 0)&&(o.logger=o.logger.clone(t)),["store","services","language"].forEach(s=>{o[s]=this[s]}),o.services={...this.services},o.services.utils={hasLoadedNamespace:o.hasLoadedNamespace.bind(o)},r&&(o.store=new rI(this.store.data,i),o.services.resourceStore=o.store),o.translator=new o_(o.services,i),o.translator.on("*",function(s){for(var l=arguments.length,u=new Array(l>1?l-1:0),c=1;cOB.safeParse(e).success||Ule.safeParse(e).success;z.enum(["connection","direct","any"]);const MB=z.object({id:z.string().trim().min(1),name:z.string().trim().min(1),type:OB}),Vle=MB.extend({fieldKind:z.literal("output")}),vt=MB.extend({fieldKind:z.literal("input"),label:z.string()}),Ud=z.object({model_name:z.string().trim().min(1),base_model:jd}),uy=z.object({image_name:z.string().trim().min(1)}),Gle=z.object({board_id:z.string().trim().min(1)}),a_=z.object({latents_name:z.string().trim().min(1),seed:z.number().int().optional()}),s_=z.object({conditioning_name:z.string().trim().min(1)}),Hle=z.object({mask_name:z.string().trim().min(1),masked_latents_name:z.string().trim().min(1).optional()}),qle=vt.extend({type:z.literal("integer"),value:z.number().int().optional()}),Wle=vt.extend({type:z.literal("IntegerCollection"),value:z.array(z.number().int()).optional()}),Kle=vt.extend({type:z.literal("IntegerPolymorphic"),value:z.number().int().optional()}),Qle=vt.extend({type:z.literal("float"),value:z.number().optional()}),Xle=vt.extend({type:z.literal("FloatCollection"),value:z.array(z.number()).optional()}),Yle=vt.extend({type:z.literal("FloatPolymorphic"),value:z.number().optional()}),Zle=vt.extend({type:z.literal("string"),value:z.string().optional()}),Jle=vt.extend({type:z.literal("StringCollection"),value:z.array(z.string()).optional()}),eue=vt.extend({type:z.literal("StringPolymorphic"),value:z.string().optional()}),tue=vt.extend({type:z.literal("boolean"),value:z.boolean().optional()}),nue=vt.extend({type:z.literal("BooleanCollection"),value:z.array(z.boolean()).optional()}),rue=vt.extend({type:z.literal("BooleanPolymorphic"),value:z.boolean().optional()}),iue=vt.extend({type:z.literal("enum"),value:z.string().optional()}),oue=vt.extend({type:z.literal("LatentsField"),value:a_.optional()}),aue=vt.extend({type:z.literal("LatentsCollection"),value:z.array(a_).optional()}),sue=vt.extend({type:z.literal("LatentsPolymorphic"),value:z.union([a_,z.array(a_)]).optional()}),lue=vt.extend({type:z.literal("DenoiseMaskField"),value:Hle.optional()}),uue=vt.extend({type:z.literal("ConditioningField"),value:s_.optional()}),cue=vt.extend({type:z.literal("ConditioningCollection"),value:z.array(s_).optional()}),due=vt.extend({type:z.literal("ConditioningPolymorphic"),value:z.union([s_,z.array(s_)]).optional()}),fue=Ud,Km=z.object({image:uy,control_model:fue,control_weight:z.union([z.number(),z.array(z.number())]).optional(),begin_step_percent:z.number().optional(),end_step_percent:z.number().optional(),control_mode:z.enum(["balanced","more_prompt","more_control","unbalanced"]).optional(),resize_mode:z.enum(["just_resize","crop_resize","fill_resize","just_resize_simple"]).optional()}),hue=vt.extend({type:z.literal("ControlField"),value:Km.optional()}),pue=vt.extend({type:z.literal("ControlPolymorphic"),value:z.union([Km,z.array(Km)]).optional()}),gue=vt.extend({type:z.literal("ControlCollection"),value:z.array(Km).optional()}),mue=Ud,NB=z.object({image:uy,ip_adapter_model:mue,weight:z.number(),begin_step_percent:z.number().optional(),end_step_percent:z.number().optional()}),yue=vt.extend({type:z.literal("IPAdapterField"),value:NB.optional()}),vue=z.enum(["onnx","main","vae","lora","controlnet","embedding"]),bue=z.enum(["unet","text_encoder","text_encoder_2","tokenizer","tokenizer_2","vae","vae_decoder","vae_encoder","scheduler","safety_checker"]),qh=Ud.extend({model_type:vue,submodel:bue.optional()}),$B=qh.extend({weight:z.number().optional()}),_ue=z.object({unet:qh,scheduler:qh,loras:z.array($B)}),Sue=vt.extend({type:z.literal("UNetField"),value:_ue.optional()}),xue=z.object({tokenizer:qh,text_encoder:qh,skipped_layers:z.number(),loras:z.array($B)}),wue=vt.extend({type:z.literal("ClipField"),value:xue.optional()}),Cue=z.object({vae:qh}),Eue=vt.extend({type:z.literal("VaeField"),value:Cue.optional()}),kue=vt.extend({type:z.literal("ImageField"),value:uy.optional()}),Tue=vt.extend({type:z.literal("BoardField"),value:Gle.optional()}),Aue=vt.extend({type:z.literal("ImagePolymorphic"),value:uy.optional()}),Pue=vt.extend({type:z.literal("ImageCollection"),value:z.array(uy).optional()}),Iue=vt.extend({type:z.literal("MainModelField"),value:ly.optional()}),Rue=vt.extend({type:z.literal("SDXLMainModelField"),value:ly.optional()}),Oue=vt.extend({type:z.literal("SDXLRefinerModelField"),value:ly.optional()}),DB=Ud,Mue=vt.extend({type:z.literal("VaeModelField"),value:DB.optional()}),LB=Ud,Nue=vt.extend({type:z.literal("LoRAModelField"),value:LB.optional()}),$ue=Ud,Due=vt.extend({type:z.literal("ControlNetModelField"),value:$ue.optional()}),Lue=Ud,Fue=vt.extend({type:z.literal("IPAdapterModelField"),value:Lue.optional()}),Bue=vt.extend({type:z.literal("Collection"),value:z.array(z.any()).optional()}),zue=vt.extend({type:z.literal("CollectionItem"),value:z.any().optional()}),l_=z.object({r:z.number().int().min(0).max(255),g:z.number().int().min(0).max(255),b:z.number().int().min(0).max(255),a:z.number().int().min(0).max(255)}),jue=vt.extend({type:z.literal("ColorField"),value:l_.optional()}),Uue=vt.extend({type:z.literal("ColorCollection"),value:z.array(l_).optional()}),Vue=vt.extend({type:z.literal("ColorPolymorphic"),value:z.union([l_,z.array(l_)]).optional()}),Gue=vt.extend({type:z.literal("Scheduler"),value:vB.optional()}),Hue=z.discriminatedUnion("type",[Tue,nue,tue,rue,wue,Bue,zue,jue,Uue,Vue,uue,cue,due,hue,Due,gue,pue,lue,iue,Xle,Qle,Yle,Pue,Aue,kue,Wle,Kle,qle,yue,Fue,oue,aue,sue,Nue,Iue,Gue,Rue,Oue,Jle,eue,Zle,Sue,Eue,Mue]),sGe=e=>!!(e&&e.fieldKind==="input"),lGe=e=>!!(e&&e.fieldKind==="input"),que=e=>!!(e&&!("$ref"in e)),dI=e=>!!(e&&!("$ref"in e)&&e.type==="array"),mv=e=>!!(e&&!("$ref"in e)&&e.type!=="array"),Gp=e=>!!(e&&"$ref"in e),Wue=e=>"class"in e&&e.class==="invocation",Kue=e=>"class"in e&&e.class==="output",fI=e=>!("$ref"in e),Que=z.object({lora:LB.deepPartial(),weight:z.number()}),Xue=Km.deepPartial(),Yue=NB.deepPartial(),FB=z.object({app_version:z.string().nullish().catch(null),generation_mode:z.string().nullish().catch(null),created_by:z.string().nullish().catch(null),positive_prompt:z.string().nullish().catch(null),negative_prompt:z.string().nullish().catch(null),width:z.number().int().nullish().catch(null),height:z.number().int().nullish().catch(null),seed:z.number().int().nullish().catch(null),rand_device:z.string().nullish().catch(null),cfg_scale:z.number().nullish().catch(null),steps:z.number().int().nullish().catch(null),scheduler:z.string().nullish().catch(null),clip_skip:z.number().int().nullish().catch(null),model:z.union([QS.deepPartial(),bB.deepPartial()]).nullish().catch(null),controlnets:z.array(Xue).nullish().catch(null),ipAdapters:z.array(Yue).nullish().catch(null),loras:z.array(Que).nullish().catch(null),vae:DB.nullish().catch(null),strength:z.number().nullish().catch(null),init_image:z.string().nullish().catch(null),positive_style_prompt:z.string().nullish().catch(null),negative_style_prompt:z.string().nullish().catch(null),refiner_model:fT.deepPartial().nullish().catch(null),refiner_cfg_scale:z.number().nullish().catch(null),refiner_steps:z.number().int().nullish().catch(null),refiner_scheduler:z.string().nullish().catch(null),refiner_positive_aesthetic_score:z.number().nullish().catch(null),refiner_negative_aesthetic_score:z.number().nullish().catch(null),refiner_start:z.number().nullish().catch(null)}).passthrough(),yT=z.string().refine(e=>{const[t,n,r]=e.split(".");return t!==void 0&&Number.isInteger(Number(t))&&n!==void 0&&Number.isInteger(Number(n))&&r!==void 0&&Number.isInteger(Number(r))});yT.transform(e=>{const[t,n,r]=e.split(".");return{major:Number(t),minor:Number(n),patch:Number(r)}});const hI=z.object({id:z.string().trim().min(1),type:z.string().trim().min(1),inputs:z.record(Hue),outputs:z.record(Vle),label:z.string(),isOpen:z.boolean(),notes:z.string(),embedWorkflow:z.boolean(),isIntermediate:z.boolean(),useCache:z.boolean().optional(),version:yT.optional()}),Zue=z.preprocess(e=>{var t;try{const n=hI.parse(e);if(!Coe(n,"useCache")){const r=(t=PB.get())==null?void 0:t.getState().nodes.nodeTemplates,i=r==null?void 0:r[n.type];let o=!0;i&&(o=i.useCache),Object.assign(n,{useCache:o})}return n}catch{return e}},hI.extend({useCache:z.boolean()})),Jue=z.object({id:z.string().trim().min(1),type:z.literal("notes"),label:z.string(),isOpen:z.boolean(),notes:z.string()}),BB=z.object({x:z.number(),y:z.number()}).default({x:0,y:0}),u_=z.number().gt(0).nullish(),zB=z.object({id:z.string().trim().min(1),type:z.literal("invocation"),data:Zue,width:u_,height:u_,position:BB}),rE=e=>zB.safeParse(e).success,ece=z.object({id:z.string().trim().min(1),type:z.literal("notes"),data:Jue,width:u_,height:u_,position:BB}),jB=z.discriminatedUnion("type",[zB,ece]),tce=z.object({source:z.string().trim().min(1),sourceHandle:z.string().trim().min(1),target:z.string().trim().min(1),targetHandle:z.string().trim().min(1),id:z.string().trim().min(1),type:z.literal("default")}),nce=z.object({source:z.string().trim().min(1),target:z.string().trim().min(1),id:z.string().trim().min(1),type:z.literal("collapsed")}),UB=z.union([tce,nce]),rce=z.object({nodeId:z.string().trim().min(1),fieldName:z.string().trim().min(1)}),ice="1.0.0",VB=z.object({name:z.string().default(""),author:z.string().default(""),description:z.string().default(""),version:z.string().default(""),contact:z.string().default(""),tags:z.string().default(""),notes:z.string().default(""),nodes:z.array(jB).default([]),edges:z.array(UB).default([]),exposedFields:z.array(rce).default([]),meta:z.object({version:yT}).default({version:ice})});VB.transform(e=>{const{nodes:t,edges:n}=e,r=[],i=t.filter(rE),o=dT(i,"id");return n.forEach((a,s)=>{const l=o[a.source],u=o[a.target],c=[];if(l?a.type==="default"&&!(a.sourceHandle in l.data.outputs)&&c.push(`${be.t("nodes.outputField")}"${a.source}.${a.sourceHandle}" ${be.t("nodes.doesNotExist")}`):c.push(`${be.t("nodes.outputNode")} ${a.source} ${be.t("nodes.doesNotExist")}`),u?a.type==="default"&&!(a.targetHandle in u.data.inputs)&&c.push(`${be.t("nodes.inputField")} "${a.target}.${a.targetHandle}" ${be.t("nodes.doesNotExist")}`):c.push(`${be.t("nodes.inputNode")} ${a.target} ${be.t("nodes.doesNotExist")}`),c.length){delete n[s];const d=a.type==="default"?a.sourceHandle:a.source,f=a.type==="default"?a.targetHandle:a.target;r.push({message:`${be.t("nodes.edge")} "${d} -> ${f}" ${be.t("nodes.skipped")}`,issues:c,data:a})}}),{workflow:e,warnings:r}});const jr=e=>!!(e&&e.type==="invocation"),uGe=e=>!!(e&&!["notes","current_image"].includes(e.type)),pI=e=>!!(e&&e.type==="notes");var Hc=(e=>(e[e.PENDING=0]="PENDING",e[e.IN_PROGRESS=1]="IN_PROGRESS",e[e.COMPLETED=2]="COMPLETED",e[e.FAILED=3]="FAILED",e))(Hc||{});/*! pako 2.1.0 https://github.com/nodeca/pako @license (MIT AND Zlib) */const oce=4,gI=0,mI=1,ace=2;function mp(e){let t=e.length;for(;--t>=0;)e[t]=0}const sce=0,GB=1,lce=2,uce=3,cce=258,vT=29,cy=256,Qm=cy+1+vT,fh=30,bT=19,HB=2*Qm+1,ed=15,oC=16,dce=7,_T=256,qB=16,WB=17,KB=18,iE=new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]),N1=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]),fce=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),QB=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),hce=512,vl=new Array((Qm+2)*2);mp(vl);const Hg=new Array(fh*2);mp(Hg);const Xm=new Array(hce);mp(Xm);const Ym=new Array(cce-uce+1);mp(Ym);const ST=new Array(vT);mp(ST);const c_=new Array(fh);mp(c_);function aC(e,t,n,r,i){this.static_tree=e,this.extra_bits=t,this.extra_base=n,this.elems=r,this.max_length=i,this.has_stree=e&&e.length}let XB,YB,ZB;function sC(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}const JB=e=>e<256?Xm[e]:Xm[256+(e>>>7)],Zm=(e,t)=>{e.pending_buf[e.pending++]=t&255,e.pending_buf[e.pending++]=t>>>8&255},wo=(e,t,n)=>{e.bi_valid>oC-n?(e.bi_buf|=t<>oC-e.bi_valid,e.bi_valid+=n-oC):(e.bi_buf|=t<{wo(e,n[t*2],n[t*2+1])},ez=(e,t)=>{let n=0;do n|=e&1,e>>>=1,n<<=1;while(--t>0);return n>>>1},pce=e=>{e.bi_valid===16?(Zm(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):e.bi_valid>=8&&(e.pending_buf[e.pending++]=e.bi_buf&255,e.bi_buf>>=8,e.bi_valid-=8)},gce=(e,t)=>{const n=t.dyn_tree,r=t.max_code,i=t.stat_desc.static_tree,o=t.stat_desc.has_stree,a=t.stat_desc.extra_bits,s=t.stat_desc.extra_base,l=t.stat_desc.max_length;let u,c,d,f,h,p,m=0;for(f=0;f<=ed;f++)e.bl_count[f]=0;for(n[e.heap[e.heap_max]*2+1]=0,u=e.heap_max+1;ul&&(f=l,m++),n[c*2+1]=f,!(c>r)&&(e.bl_count[f]++,h=0,c>=s&&(h=a[c-s]),p=n[c*2],e.opt_len+=p*(f+h),o&&(e.static_len+=p*(i[c*2+1]+h)));if(m!==0){do{for(f=l-1;e.bl_count[f]===0;)f--;e.bl_count[f]--,e.bl_count[f+1]+=2,e.bl_count[l]--,m-=2}while(m>0);for(f=l;f!==0;f--)for(c=e.bl_count[f];c!==0;)d=e.heap[--u],!(d>r)&&(n[d*2+1]!==f&&(e.opt_len+=(f-n[d*2+1])*n[d*2],n[d*2+1]=f),c--)}},tz=(e,t,n)=>{const r=new Array(ed+1);let i=0,o,a;for(o=1;o<=ed;o++)i=i+n[o-1]<<1,r[o]=i;for(a=0;a<=t;a++){let s=e[a*2+1];s!==0&&(e[a*2]=ez(r[s]++,s))}},mce=()=>{let e,t,n,r,i;const o=new Array(ed+1);for(n=0,r=0;r>=7;r{let t;for(t=0;t{e.bi_valid>8?Zm(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0},yI=(e,t,n,r)=>{const i=t*2,o=n*2;return e[i]{const r=e.heap[n];let i=n<<1;for(;i<=e.heap_len&&(i{let r,i,o=0,a,s;if(e.sym_next!==0)do r=e.pending_buf[e.sym_buf+o++]&255,r+=(e.pending_buf[e.sym_buf+o++]&255)<<8,i=e.pending_buf[e.sym_buf+o++],r===0?Ps(e,i,t):(a=Ym[i],Ps(e,a+cy+1,t),s=iE[a],s!==0&&(i-=ST[a],wo(e,i,s)),r--,a=JB(r),Ps(e,a,n),s=N1[a],s!==0&&(r-=c_[a],wo(e,r,s)));while(o{const n=t.dyn_tree,r=t.stat_desc.static_tree,i=t.stat_desc.has_stree,o=t.stat_desc.elems;let a,s,l=-1,u;for(e.heap_len=0,e.heap_max=HB,a=0;a>1;a>=1;a--)lC(e,n,a);u=o;do a=e.heap[1],e.heap[1]=e.heap[e.heap_len--],lC(e,n,1),s=e.heap[1],e.heap[--e.heap_max]=a,e.heap[--e.heap_max]=s,n[u*2]=n[a*2]+n[s*2],e.depth[u]=(e.depth[a]>=e.depth[s]?e.depth[a]:e.depth[s])+1,n[a*2+1]=n[s*2+1]=u,e.heap[1]=u++,lC(e,n,1);while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],gce(e,t),tz(n,l,e.bl_count)},bI=(e,t,n)=>{let r,i=-1,o,a=t[0*2+1],s=0,l=7,u=4;for(a===0&&(l=138,u=3),t[(n+1)*2+1]=65535,r=0;r<=n;r++)o=a,a=t[(r+1)*2+1],!(++s{let r,i=-1,o,a=t[0*2+1],s=0,l=7,u=4;for(a===0&&(l=138,u=3),r=0;r<=n;r++)if(o=a,a=t[(r+1)*2+1],!(++s{let t;for(bI(e,e.dyn_ltree,e.l_desc.max_code),bI(e,e.dyn_dtree,e.d_desc.max_code),oE(e,e.bl_desc),t=bT-1;t>=3&&e.bl_tree[QB[t]*2+1]===0;t--);return e.opt_len+=3*(t+1)+5+5+4,t},vce=(e,t,n,r)=>{let i;for(wo(e,t-257,5),wo(e,n-1,5),wo(e,r-4,4),i=0;i{let t=4093624447,n;for(n=0;n<=31;n++,t>>>=1)if(t&1&&e.dyn_ltree[n*2]!==0)return gI;if(e.dyn_ltree[9*2]!==0||e.dyn_ltree[10*2]!==0||e.dyn_ltree[13*2]!==0)return mI;for(n=32;n{SI||(mce(),SI=!0),e.l_desc=new sC(e.dyn_ltree,XB),e.d_desc=new sC(e.dyn_dtree,YB),e.bl_desc=new sC(e.bl_tree,ZB),e.bi_buf=0,e.bi_valid=0,nz(e)},iz=(e,t,n,r)=>{wo(e,(sce<<1)+(r?1:0),3),rz(e),Zm(e,n),Zm(e,~n),n&&e.pending_buf.set(e.window.subarray(t,t+n),e.pending),e.pending+=n},Sce=e=>{wo(e,GB<<1,3),Ps(e,_T,vl),pce(e)},xce=(e,t,n,r)=>{let i,o,a=0;e.level>0?(e.strm.data_type===ace&&(e.strm.data_type=bce(e)),oE(e,e.l_desc),oE(e,e.d_desc),a=yce(e),i=e.opt_len+3+7>>>3,o=e.static_len+3+7>>>3,o<=i&&(i=o)):i=o=n+5,n+4<=i&&t!==-1?iz(e,t,n,r):e.strategy===oce||o===i?(wo(e,(GB<<1)+(r?1:0),3),vI(e,vl,Hg)):(wo(e,(lce<<1)+(r?1:0),3),vce(e,e.l_desc.max_code+1,e.d_desc.max_code+1,a+1),vI(e,e.dyn_ltree,e.dyn_dtree)),nz(e),r&&rz(e)},wce=(e,t,n)=>(e.pending_buf[e.sym_buf+e.sym_next++]=t,e.pending_buf[e.sym_buf+e.sym_next++]=t>>8,e.pending_buf[e.sym_buf+e.sym_next++]=n,t===0?e.dyn_ltree[n*2]++:(e.matches++,t--,e.dyn_ltree[(Ym[n]+cy+1)*2]++,e.dyn_dtree[JB(t)*2]++),e.sym_next===e.sym_end);var Cce=_ce,Ece=iz,kce=xce,Tce=wce,Ace=Sce,Pce={_tr_init:Cce,_tr_stored_block:Ece,_tr_flush_block:kce,_tr_tally:Tce,_tr_align:Ace};const Ice=(e,t,n,r)=>{let i=e&65535|0,o=e>>>16&65535|0,a=0;for(;n!==0;){a=n>2e3?2e3:n,n-=a;do i=i+t[r++]|0,o=o+i|0;while(--a);i%=65521,o%=65521}return i|o<<16|0};var Jm=Ice;const Rce=()=>{let e,t=[];for(var n=0;n<256;n++){e=n;for(var r=0;r<8;r++)e=e&1?3988292384^e>>>1:e>>>1;t[n]=e}return t},Oce=new Uint32Array(Rce()),Mce=(e,t,n,r)=>{const i=Oce,o=r+n;e^=-1;for(let a=r;a>>8^i[(e^t[a])&255];return e^-1};var ai=Mce,Wh={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},dy={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8};const{_tr_init:Nce,_tr_stored_block:aE,_tr_flush_block:$ce,_tr_tally:Hu,_tr_align:Dce}=Pce,{Z_NO_FLUSH:qu,Z_PARTIAL_FLUSH:Lce,Z_FULL_FLUSH:Fce,Z_FINISH:ya,Z_BLOCK:xI,Z_OK:Ei,Z_STREAM_END:wI,Z_STREAM_ERROR:zs,Z_DATA_ERROR:Bce,Z_BUF_ERROR:uC,Z_DEFAULT_COMPRESSION:zce,Z_FILTERED:jce,Z_HUFFMAN_ONLY:yv,Z_RLE:Uce,Z_FIXED:Vce,Z_DEFAULT_STRATEGY:Gce,Z_UNKNOWN:Hce,Z_DEFLATED:ZS}=dy,qce=9,Wce=15,Kce=8,Qce=29,Xce=256,sE=Xce+1+Qce,Yce=30,Zce=19,Jce=2*sE+1,ede=15,Bt=3,Nu=258,js=Nu+Bt+1,tde=32,Kh=42,xT=57,lE=69,uE=73,cE=91,dE=103,td=113,yg=666,eo=1,yp=2,Pd=3,vp=4,nde=3,nd=(e,t)=>(e.msg=Wh[t],t),CI=e=>e*2-(e>4?9:0),Cu=e=>{let t=e.length;for(;--t>=0;)e[t]=0},rde=e=>{let t,n,r,i=e.w_size;t=e.hash_size,r=t;do n=e.head[--r],e.head[r]=n>=i?n-i:0;while(--t);t=i,r=t;do n=e.prev[--r],e.prev[r]=n>=i?n-i:0;while(--t)};let ide=(e,t,n)=>(t<{const t=e.state;let n=t.pending;n>e.avail_out&&(n=e.avail_out),n!==0&&(e.output.set(t.pending_buf.subarray(t.pending_out,t.pending_out+n),e.next_out),e.next_out+=n,t.pending_out+=n,e.total_out+=n,e.avail_out-=n,t.pending-=n,t.pending===0&&(t.pending_out=0))},qo=(e,t)=>{$ce(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,Fo(e.strm)},on=(e,t)=>{e.pending_buf[e.pending++]=t},Hp=(e,t)=>{e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=t&255},fE=(e,t,n,r)=>{let i=e.avail_in;return i>r&&(i=r),i===0?0:(e.avail_in-=i,t.set(e.input.subarray(e.next_in,e.next_in+i),n),e.state.wrap===1?e.adler=Jm(e.adler,t,i,n):e.state.wrap===2&&(e.adler=ai(e.adler,t,i,n)),e.next_in+=i,e.total_in+=i,i)},oz=(e,t)=>{let n=e.max_chain_length,r=e.strstart,i,o,a=e.prev_length,s=e.nice_match;const l=e.strstart>e.w_size-js?e.strstart-(e.w_size-js):0,u=e.window,c=e.w_mask,d=e.prev,f=e.strstart+Nu;let h=u[r+a-1],p=u[r+a];e.prev_length>=e.good_match&&(n>>=2),s>e.lookahead&&(s=e.lookahead);do if(i=t,!(u[i+a]!==p||u[i+a-1]!==h||u[i]!==u[r]||u[++i]!==u[r+1])){r+=2,i++;do;while(u[++r]===u[++i]&&u[++r]===u[++i]&&u[++r]===u[++i]&&u[++r]===u[++i]&&u[++r]===u[++i]&&u[++r]===u[++i]&&u[++r]===u[++i]&&u[++r]===u[++i]&&ra){if(e.match_start=t,a=o,o>=s)break;h=u[r+a-1],p=u[r+a]}}while((t=d[t&c])>l&&--n!==0);return a<=e.lookahead?a:e.lookahead},Qh=e=>{const t=e.w_size;let n,r,i;do{if(r=e.window_size-e.lookahead-e.strstart,e.strstart>=t+(t-js)&&(e.window.set(e.window.subarray(t,t+t-r),0),e.match_start-=t,e.strstart-=t,e.block_start-=t,e.insert>e.strstart&&(e.insert=e.strstart),rde(e),r+=t),e.strm.avail_in===0)break;if(n=fE(e.strm,e.window,e.strstart+e.lookahead,r),e.lookahead+=n,e.lookahead+e.insert>=Bt)for(i=e.strstart-e.insert,e.ins_h=e.window[i],e.ins_h=Wu(e,e.ins_h,e.window[i+1]);e.insert&&(e.ins_h=Wu(e,e.ins_h,e.window[i+Bt-1]),e.prev[i&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=i,i++,e.insert--,!(e.lookahead+e.insert{let n=e.pending_buf_size-5>e.w_size?e.w_size:e.pending_buf_size-5,r,i,o,a=0,s=e.strm.avail_in;do{if(r=65535,o=e.bi_valid+42>>3,e.strm.avail_outi+e.strm.avail_in&&(r=i+e.strm.avail_in),r>o&&(r=o),r>8,e.pending_buf[e.pending-2]=~r,e.pending_buf[e.pending-1]=~r>>8,Fo(e.strm),i&&(i>r&&(i=r),e.strm.output.set(e.window.subarray(e.block_start,e.block_start+i),e.strm.next_out),e.strm.next_out+=i,e.strm.avail_out-=i,e.strm.total_out+=i,e.block_start+=i,r-=i),r&&(fE(e.strm,e.strm.output,e.strm.next_out,r),e.strm.next_out+=r,e.strm.avail_out-=r,e.strm.total_out+=r)}while(a===0);return s-=e.strm.avail_in,s&&(s>=e.w_size?(e.matches=2,e.window.set(e.strm.input.subarray(e.strm.next_in-e.w_size,e.strm.next_in),0),e.strstart=e.w_size,e.insert=e.strstart):(e.window_size-e.strstart<=s&&(e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,e.insert>e.strstart&&(e.insert=e.strstart)),e.window.set(e.strm.input.subarray(e.strm.next_in-s,e.strm.next_in),e.strstart),e.strstart+=s,e.insert+=s>e.w_size-e.insert?e.w_size-e.insert:s),e.block_start=e.strstart),e.high_watero&&e.block_start>=e.w_size&&(e.block_start-=e.w_size,e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,o+=e.w_size,e.insert>e.strstart&&(e.insert=e.strstart)),o>e.strm.avail_in&&(o=e.strm.avail_in),o&&(fE(e.strm,e.window,e.strstart,o),e.strstart+=o,e.insert+=o>e.w_size-e.insert?e.w_size-e.insert:o),e.high_water>3,o=e.pending_buf_size-o>65535?65535:e.pending_buf_size-o,n=o>e.w_size?e.w_size:o,i=e.strstart-e.block_start,(i>=n||(i||t===ya)&&t!==qu&&e.strm.avail_in===0&&i<=o)&&(r=i>o?o:i,a=t===ya&&e.strm.avail_in===0&&r===i?1:0,aE(e,e.block_start,r,a),e.block_start+=r,Fo(e.strm)),a?Pd:eo)},cC=(e,t)=>{let n,r;for(;;){if(e.lookahead=Bt&&(e.ins_h=Wu(e,e.ins_h,e.window[e.strstart+Bt-1]),n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),n!==0&&e.strstart-n<=e.w_size-js&&(e.match_length=oz(e,n)),e.match_length>=Bt)if(r=Hu(e,e.strstart-e.match_start,e.match_length-Bt),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=Bt){e.match_length--;do e.strstart++,e.ins_h=Wu(e,e.ins_h,e.window[e.strstart+Bt-1]),n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart;while(--e.match_length!==0);e.strstart++}else e.strstart+=e.match_length,e.match_length=0,e.ins_h=e.window[e.strstart],e.ins_h=Wu(e,e.ins_h,e.window[e.strstart+1]);else r=Hu(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(r&&(qo(e,!1),e.strm.avail_out===0))return eo}return e.insert=e.strstart{let n,r,i;for(;;){if(e.lookahead=Bt&&(e.ins_h=Wu(e,e.ins_h,e.window[e.strstart+Bt-1]),n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),e.prev_length=e.match_length,e.prev_match=e.match_start,e.match_length=Bt-1,n!==0&&e.prev_length4096)&&(e.match_length=Bt-1)),e.prev_length>=Bt&&e.match_length<=e.prev_length){i=e.strstart+e.lookahead-Bt,r=Hu(e,e.strstart-1-e.prev_match,e.prev_length-Bt),e.lookahead-=e.prev_length-1,e.prev_length-=2;do++e.strstart<=i&&(e.ins_h=Wu(e,e.ins_h,e.window[e.strstart+Bt-1]),n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart);while(--e.prev_length!==0);if(e.match_available=0,e.match_length=Bt-1,e.strstart++,r&&(qo(e,!1),e.strm.avail_out===0))return eo}else if(e.match_available){if(r=Hu(e,0,e.window[e.strstart-1]),r&&qo(e,!1),e.strstart++,e.lookahead--,e.strm.avail_out===0)return eo}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&(r=Hu(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart{let n,r,i,o;const a=e.window;for(;;){if(e.lookahead<=Nu){if(Qh(e),e.lookahead<=Nu&&t===qu)return eo;if(e.lookahead===0)break}if(e.match_length=0,e.lookahead>=Bt&&e.strstart>0&&(i=e.strstart-1,r=a[i],r===a[++i]&&r===a[++i]&&r===a[++i])){o=e.strstart+Nu;do;while(r===a[++i]&&r===a[++i]&&r===a[++i]&&r===a[++i]&&r===a[++i]&&r===a[++i]&&r===a[++i]&&r===a[++i]&&ie.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=Bt?(n=Hu(e,1,e.match_length-Bt),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(n=Hu(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),n&&(qo(e,!1),e.strm.avail_out===0))return eo}return e.insert=0,t===ya?(qo(e,!0),e.strm.avail_out===0?Pd:vp):e.sym_next&&(qo(e,!1),e.strm.avail_out===0)?eo:yp},ade=(e,t)=>{let n;for(;;){if(e.lookahead===0&&(Qh(e),e.lookahead===0)){if(t===qu)return eo;break}if(e.match_length=0,n=Hu(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,n&&(qo(e,!1),e.strm.avail_out===0))return eo}return e.insert=0,t===ya?(qo(e,!0),e.strm.avail_out===0?Pd:vp):e.sym_next&&(qo(e,!1),e.strm.avail_out===0)?eo:yp};function ms(e,t,n,r,i){this.good_length=e,this.max_lazy=t,this.nice_length=n,this.max_chain=r,this.func=i}const vg=[new ms(0,0,0,0,az),new ms(4,4,8,4,cC),new ms(4,5,16,8,cC),new ms(4,6,32,32,cC),new ms(4,4,16,16,uf),new ms(8,16,32,32,uf),new ms(8,16,128,128,uf),new ms(8,32,128,256,uf),new ms(32,128,258,1024,uf),new ms(32,258,258,4096,uf)],sde=e=>{e.window_size=2*e.w_size,Cu(e.head),e.max_lazy_match=vg[e.level].max_lazy,e.good_match=vg[e.level].good_length,e.nice_match=vg[e.level].nice_length,e.max_chain_length=vg[e.level].max_chain,e.strstart=0,e.block_start=0,e.lookahead=0,e.insert=0,e.match_length=e.prev_length=Bt-1,e.match_available=0,e.ins_h=0};function lde(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=ZS,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(Jce*2),this.dyn_dtree=new Uint16Array((2*Yce+1)*2),this.bl_tree=new Uint16Array((2*Zce+1)*2),Cu(this.dyn_ltree),Cu(this.dyn_dtree),Cu(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(ede+1),this.heap=new Uint16Array(2*sE+1),Cu(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(2*sE+1),Cu(this.depth),this.sym_buf=0,this.lit_bufsize=0,this.sym_next=0,this.sym_end=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}const fy=e=>{if(!e)return 1;const t=e.state;return!t||t.strm!==e||t.status!==Kh&&t.status!==xT&&t.status!==lE&&t.status!==uE&&t.status!==cE&&t.status!==dE&&t.status!==td&&t.status!==yg?1:0},sz=e=>{if(fy(e))return nd(e,zs);e.total_in=e.total_out=0,e.data_type=Hce;const t=e.state;return t.pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=t.wrap===2?xT:t.wrap?Kh:td,e.adler=t.wrap===2?0:1,t.last_flush=-2,Nce(t),Ei},lz=e=>{const t=sz(e);return t===Ei&&sde(e.state),t},ude=(e,t)=>fy(e)||e.state.wrap!==2?zs:(e.state.gzhead=t,Ei),uz=(e,t,n,r,i,o)=>{if(!e)return zs;let a=1;if(t===zce&&(t=6),r<0?(a=0,r=-r):r>15&&(a=2,r-=16),i<1||i>qce||n!==ZS||r<8||r>15||t<0||t>9||o<0||o>Vce||r===8&&a!==1)return nd(e,zs);r===8&&(r=9);const s=new lde;return e.state=s,s.strm=e,s.status=Kh,s.wrap=a,s.gzhead=null,s.w_bits=r,s.w_size=1<uz(e,t,ZS,Wce,Kce,Gce),dde=(e,t)=>{if(fy(e)||t>xI||t<0)return e?nd(e,zs):zs;const n=e.state;if(!e.output||e.avail_in!==0&&!e.input||n.status===yg&&t!==ya)return nd(e,e.avail_out===0?uC:zs);const r=n.last_flush;if(n.last_flush=t,n.pending!==0){if(Fo(e),e.avail_out===0)return n.last_flush=-1,Ei}else if(e.avail_in===0&&CI(t)<=CI(r)&&t!==ya)return nd(e,uC);if(n.status===yg&&e.avail_in!==0)return nd(e,uC);if(n.status===Kh&&n.wrap===0&&(n.status=td),n.status===Kh){let i=ZS+(n.w_bits-8<<4)<<8,o=-1;if(n.strategy>=yv||n.level<2?o=0:n.level<6?o=1:n.level===6?o=2:o=3,i|=o<<6,n.strstart!==0&&(i|=tde),i+=31-i%31,Hp(n,i),n.strstart!==0&&(Hp(n,e.adler>>>16),Hp(n,e.adler&65535)),e.adler=1,n.status=td,Fo(e),n.pending!==0)return n.last_flush=-1,Ei}if(n.status===xT){if(e.adler=0,on(n,31),on(n,139),on(n,8),n.gzhead)on(n,(n.gzhead.text?1:0)+(n.gzhead.hcrc?2:0)+(n.gzhead.extra?4:0)+(n.gzhead.name?8:0)+(n.gzhead.comment?16:0)),on(n,n.gzhead.time&255),on(n,n.gzhead.time>>8&255),on(n,n.gzhead.time>>16&255),on(n,n.gzhead.time>>24&255),on(n,n.level===9?2:n.strategy>=yv||n.level<2?4:0),on(n,n.gzhead.os&255),n.gzhead.extra&&n.gzhead.extra.length&&(on(n,n.gzhead.extra.length&255),on(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(e.adler=ai(e.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=lE;else if(on(n,0),on(n,0),on(n,0),on(n,0),on(n,0),on(n,n.level===9?2:n.strategy>=yv||n.level<2?4:0),on(n,nde),n.status=td,Fo(e),n.pending!==0)return n.last_flush=-1,Ei}if(n.status===lE){if(n.gzhead.extra){let i=n.pending,o=(n.gzhead.extra.length&65535)-n.gzindex;for(;n.pending+o>n.pending_buf_size;){let s=n.pending_buf_size-n.pending;if(n.pending_buf.set(n.gzhead.extra.subarray(n.gzindex,n.gzindex+s),n.pending),n.pending=n.pending_buf_size,n.gzhead.hcrc&&n.pending>i&&(e.adler=ai(e.adler,n.pending_buf,n.pending-i,i)),n.gzindex+=s,Fo(e),n.pending!==0)return n.last_flush=-1,Ei;i=0,o-=s}let a=new Uint8Array(n.gzhead.extra);n.pending_buf.set(a.subarray(n.gzindex,n.gzindex+o),n.pending),n.pending+=o,n.gzhead.hcrc&&n.pending>i&&(e.adler=ai(e.adler,n.pending_buf,n.pending-i,i)),n.gzindex=0}n.status=uE}if(n.status===uE){if(n.gzhead.name){let i=n.pending,o;do{if(n.pending===n.pending_buf_size){if(n.gzhead.hcrc&&n.pending>i&&(e.adler=ai(e.adler,n.pending_buf,n.pending-i,i)),Fo(e),n.pending!==0)return n.last_flush=-1,Ei;i=0}n.gzindexi&&(e.adler=ai(e.adler,n.pending_buf,n.pending-i,i)),n.gzindex=0}n.status=cE}if(n.status===cE){if(n.gzhead.comment){let i=n.pending,o;do{if(n.pending===n.pending_buf_size){if(n.gzhead.hcrc&&n.pending>i&&(e.adler=ai(e.adler,n.pending_buf,n.pending-i,i)),Fo(e),n.pending!==0)return n.last_flush=-1,Ei;i=0}n.gzindexi&&(e.adler=ai(e.adler,n.pending_buf,n.pending-i,i))}n.status=dE}if(n.status===dE){if(n.gzhead.hcrc){if(n.pending+2>n.pending_buf_size&&(Fo(e),n.pending!==0))return n.last_flush=-1,Ei;on(n,e.adler&255),on(n,e.adler>>8&255),e.adler=0}if(n.status=td,Fo(e),n.pending!==0)return n.last_flush=-1,Ei}if(e.avail_in!==0||n.lookahead!==0||t!==qu&&n.status!==yg){let i=n.level===0?az(n,t):n.strategy===yv?ade(n,t):n.strategy===Uce?ode(n,t):vg[n.level].func(n,t);if((i===Pd||i===vp)&&(n.status=yg),i===eo||i===Pd)return e.avail_out===0&&(n.last_flush=-1),Ei;if(i===yp&&(t===Lce?Dce(n):t!==xI&&(aE(n,0,0,!1),t===Fce&&(Cu(n.head),n.lookahead===0&&(n.strstart=0,n.block_start=0,n.insert=0))),Fo(e),e.avail_out===0))return n.last_flush=-1,Ei}return t!==ya?Ei:n.wrap<=0?wI:(n.wrap===2?(on(n,e.adler&255),on(n,e.adler>>8&255),on(n,e.adler>>16&255),on(n,e.adler>>24&255),on(n,e.total_in&255),on(n,e.total_in>>8&255),on(n,e.total_in>>16&255),on(n,e.total_in>>24&255)):(Hp(n,e.adler>>>16),Hp(n,e.adler&65535)),Fo(e),n.wrap>0&&(n.wrap=-n.wrap),n.pending!==0?Ei:wI)},fde=e=>{if(fy(e))return zs;const t=e.state.status;return e.state=null,t===td?nd(e,Bce):Ei},hde=(e,t)=>{let n=t.length;if(fy(e))return zs;const r=e.state,i=r.wrap;if(i===2||i===1&&r.status!==Kh||r.lookahead)return zs;if(i===1&&(e.adler=Jm(e.adler,t,n,0)),r.wrap=0,n>=r.w_size){i===0&&(Cu(r.head),r.strstart=0,r.block_start=0,r.insert=0);let l=new Uint8Array(r.w_size);l.set(t.subarray(n-r.w_size,n),0),t=l,n=r.w_size}const o=e.avail_in,a=e.next_in,s=e.input;for(e.avail_in=n,e.next_in=0,e.input=t,Qh(r);r.lookahead>=Bt;){let l=r.strstart,u=r.lookahead-(Bt-1);do r.ins_h=Wu(r,r.ins_h,r.window[l+Bt-1]),r.prev[l&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=l,l++;while(--u);r.strstart=l,r.lookahead=Bt-1,Qh(r)}return r.strstart+=r.lookahead,r.block_start=r.strstart,r.insert=r.lookahead,r.lookahead=0,r.match_length=r.prev_length=Bt-1,r.match_available=0,e.next_in=a,e.input=s,e.avail_in=o,r.wrap=i,Ei};var pde=cde,gde=uz,mde=lz,yde=sz,vde=ude,bde=dde,_de=fde,Sde=hde,xde="pako deflate (from Nodeca project)",qg={deflateInit:pde,deflateInit2:gde,deflateReset:mde,deflateResetKeep:yde,deflateSetHeader:vde,deflate:bde,deflateEnd:_de,deflateSetDictionary:Sde,deflateInfo:xde};const wde=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var Cde=function(e){const t=Array.prototype.slice.call(arguments,1);for(;t.length;){const n=t.shift();if(n){if(typeof n!="object")throw new TypeError(n+"must be non-object");for(const r in n)wde(n,r)&&(e[r]=n[r])}}return e},Ede=e=>{let t=0;for(let r=0,i=e.length;r=252?6:e>=248?5:e>=240?4:e>=224?3:e>=192?2:1;e0[254]=e0[254]=1;var kde=e=>{if(typeof TextEncoder=="function"&&TextEncoder.prototype.encode)return new TextEncoder().encode(e);let t,n,r,i,o,a=e.length,s=0;for(i=0;i>>6,t[o++]=128|n&63):n<65536?(t[o++]=224|n>>>12,t[o++]=128|n>>>6&63,t[o++]=128|n&63):(t[o++]=240|n>>>18,t[o++]=128|n>>>12&63,t[o++]=128|n>>>6&63,t[o++]=128|n&63);return t};const Tde=(e,t)=>{if(t<65534&&e.subarray&&cz)return String.fromCharCode.apply(null,e.length===t?e:e.subarray(0,t));let n="";for(let r=0;r{const n=t||e.length;if(typeof TextDecoder=="function"&&TextDecoder.prototype.decode)return new TextDecoder().decode(e.subarray(0,t));let r,i;const o=new Array(n*2);for(i=0,r=0;r4){o[i++]=65533,r+=s-1;continue}for(a&=s===2?31:s===3?15:7;s>1&&r1){o[i++]=65533;continue}a<65536?o[i++]=a:(a-=65536,o[i++]=55296|a>>10&1023,o[i++]=56320|a&1023)}return Tde(o,i)},Pde=(e,t)=>{t=t||e.length,t>e.length&&(t=e.length);let n=t-1;for(;n>=0&&(e[n]&192)===128;)n--;return n<0||n===0?t:n+e0[e[n]]>t?n:t},t0={string2buf:kde,buf2string:Ade,utf8border:Pde};function Ide(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}var dz=Ide;const fz=Object.prototype.toString,{Z_NO_FLUSH:Rde,Z_SYNC_FLUSH:Ode,Z_FULL_FLUSH:Mde,Z_FINISH:Nde,Z_OK:d_,Z_STREAM_END:$de,Z_DEFAULT_COMPRESSION:Dde,Z_DEFAULT_STRATEGY:Lde,Z_DEFLATED:Fde}=dy;function wT(e){this.options=JS.assign({level:Dde,method:Fde,chunkSize:16384,windowBits:15,memLevel:8,strategy:Lde},e||{});let t=this.options;t.raw&&t.windowBits>0?t.windowBits=-t.windowBits:t.gzip&&t.windowBits>0&&t.windowBits<16&&(t.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new dz,this.strm.avail_out=0;let n=qg.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(n!==d_)throw new Error(Wh[n]);if(t.header&&qg.deflateSetHeader(this.strm,t.header),t.dictionary){let r;if(typeof t.dictionary=="string"?r=t0.string2buf(t.dictionary):fz.call(t.dictionary)==="[object ArrayBuffer]"?r=new Uint8Array(t.dictionary):r=t.dictionary,n=qg.deflateSetDictionary(this.strm,r),n!==d_)throw new Error(Wh[n]);this._dict_set=!0}}wT.prototype.push=function(e,t){const n=this.strm,r=this.options.chunkSize;let i,o;if(this.ended)return!1;for(t===~~t?o=t:o=t===!0?Nde:Rde,typeof e=="string"?n.input=t0.string2buf(e):fz.call(e)==="[object ArrayBuffer]"?n.input=new Uint8Array(e):n.input=e,n.next_in=0,n.avail_in=n.input.length;;){if(n.avail_out===0&&(n.output=new Uint8Array(r),n.next_out=0,n.avail_out=r),(o===Ode||o===Mde)&&n.avail_out<=6){this.onData(n.output.subarray(0,n.next_out)),n.avail_out=0;continue}if(i=qg.deflate(n,o),i===$de)return n.next_out>0&&this.onData(n.output.subarray(0,n.next_out)),i=qg.deflateEnd(this.strm),this.onEnd(i),this.ended=!0,i===d_;if(n.avail_out===0){this.onData(n.output);continue}if(o>0&&n.next_out>0){this.onData(n.output.subarray(0,n.next_out)),n.avail_out=0;continue}if(n.avail_in===0)break}return!0};wT.prototype.onData=function(e){this.chunks.push(e)};wT.prototype.onEnd=function(e){e===d_&&(this.result=JS.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};const vv=16209,Bde=16191;var zde=function(t,n){let r,i,o,a,s,l,u,c,d,f,h,p,m,_,b,v,g,y,S,w,x,C,T,k;const P=t.state;r=t.next_in,T=t.input,i=r+(t.avail_in-5),o=t.next_out,k=t.output,a=o-(n-t.avail_out),s=o+(t.avail_out-257),l=P.dmax,u=P.wsize,c=P.whave,d=P.wnext,f=P.window,h=P.hold,p=P.bits,m=P.lencode,_=P.distcode,b=(1<>>24,h>>>=y,p-=y,y=g>>>16&255,y===0)k[o++]=g&65535;else if(y&16){S=g&65535,y&=15,y&&(p>>=y,p-=y),p<15&&(h+=T[r++]<>>24,h>>>=y,p-=y,y=g>>>16&255,y&16){if(w=g&65535,y&=15,pl){t.msg="invalid distance too far back",P.mode=vv;break e}if(h>>>=y,p-=y,y=o-a,w>y){if(y=w-y,y>c&&P.sane){t.msg="invalid distance too far back",P.mode=vv;break e}if(x=0,C=f,d===0){if(x+=u-y,y2;)k[o++]=C[x++],k[o++]=C[x++],k[o++]=C[x++],S-=3;S&&(k[o++]=C[x++],S>1&&(k[o++]=C[x++]))}else{x=o-w;do k[o++]=k[x++],k[o++]=k[x++],k[o++]=k[x++],S-=3;while(S>2);S&&(k[o++]=k[x++],S>1&&(k[o++]=k[x++]))}}else if(y&64){t.msg="invalid distance code",P.mode=vv;break e}else{g=_[(g&65535)+(h&(1<>3,r-=S,p-=S<<3,h&=(1<{const l=s.bits;let u=0,c=0,d=0,f=0,h=0,p=0,m=0,_=0,b=0,v=0,g,y,S,w,x,C=null,T;const k=new Uint16Array(cf+1),P=new Uint16Array(cf+1);let $=null,O,E,A;for(u=0;u<=cf;u++)k[u]=0;for(c=0;c=1&&k[f]===0;f--);if(h>f&&(h=f),f===0)return i[o++]=1<<24|64<<16|0,i[o++]=1<<24|64<<16|0,s.bits=1,0;for(d=1;d0&&(e===TI||f!==1))return-1;for(P[1]=0,u=1;uEI||e===AI&&b>kI)return 1;for(;;){O=u-m,a[c]+1=T?(E=$[a[c]-T],A=C[a[c]-T]):(E=32+64,A=0),g=1<>m)+y]=O<<24|E<<16|A|0;while(y!==0);for(g=1<>=1;if(g!==0?(v&=g-1,v+=g):v=0,c++,--k[u]===0){if(u===f)break;u=t[n+a[c]]}if(u>h&&(v&w)!==S){for(m===0&&(m=h),x+=d,p=u-m,_=1<EI||e===AI&&b>kI)return 1;S=v&w,i[S]=h<<24|p<<16|x-o|0}}return v!==0&&(i[x+v]=u-m<<24|64<<16|0),s.bits=h,0};var Wg=Hde;const qde=0,hz=1,pz=2,{Z_FINISH:PI,Z_BLOCK:Wde,Z_TREES:bv,Z_OK:Id,Z_STREAM_END:Kde,Z_NEED_DICT:Qde,Z_STREAM_ERROR:Ea,Z_DATA_ERROR:gz,Z_MEM_ERROR:mz,Z_BUF_ERROR:Xde,Z_DEFLATED:II}=dy,e2=16180,RI=16181,OI=16182,MI=16183,NI=16184,$I=16185,DI=16186,LI=16187,FI=16188,BI=16189,f_=16190,ll=16191,fC=16192,zI=16193,hC=16194,jI=16195,UI=16196,VI=16197,GI=16198,_v=16199,Sv=16200,HI=16201,qI=16202,WI=16203,KI=16204,QI=16205,pC=16206,XI=16207,YI=16208,Zn=16209,yz=16210,vz=16211,Yde=852,Zde=592,Jde=15,efe=Jde,ZI=e=>(e>>>24&255)+(e>>>8&65280)+((e&65280)<<8)+((e&255)<<24);function tfe(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}const Vd=e=>{if(!e)return 1;const t=e.state;return!t||t.strm!==e||t.modevz?1:0},bz=e=>{if(Vd(e))return Ea;const t=e.state;return e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=t.wrap&1),t.mode=e2,t.last=0,t.havedict=0,t.flags=-1,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new Int32Array(Yde),t.distcode=t.distdyn=new Int32Array(Zde),t.sane=1,t.back=-1,Id},_z=e=>{if(Vd(e))return Ea;const t=e.state;return t.wsize=0,t.whave=0,t.wnext=0,bz(e)},Sz=(e,t)=>{let n;if(Vd(e))return Ea;const r=e.state;return t<0?(n=0,t=-t):(n=(t>>4)+5,t<48&&(t&=15)),t&&(t<8||t>15)?Ea:(r.window!==null&&r.wbits!==t&&(r.window=null),r.wrap=n,r.wbits=t,_z(e))},xz=(e,t)=>{if(!e)return Ea;const n=new tfe;e.state=n,n.strm=e,n.window=null,n.mode=e2;const r=Sz(e,t);return r!==Id&&(e.state=null),r},nfe=e=>xz(e,efe);let JI=!0,gC,mC;const rfe=e=>{if(JI){gC=new Int32Array(512),mC=new Int32Array(32);let t=0;for(;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(Wg(hz,e.lens,0,288,gC,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;Wg(pz,e.lens,0,32,mC,0,e.work,{bits:5}),JI=!1}e.lencode=gC,e.lenbits=9,e.distcode=mC,e.distbits=5},wz=(e,t,n,r)=>{let i;const o=e.state;return o.window===null&&(o.wsize=1<=o.wsize?(o.window.set(t.subarray(n-o.wsize,n),0),o.wnext=0,o.whave=o.wsize):(i=o.wsize-o.wnext,i>r&&(i=r),o.window.set(t.subarray(n-r,n-r+i),o.wnext),r-=i,r?(o.window.set(t.subarray(n-r,n),0),o.wnext=r,o.whave=o.wsize):(o.wnext+=i,o.wnext===o.wsize&&(o.wnext=0),o.whave{let n,r,i,o,a,s,l,u,c,d,f,h,p,m,_=0,b,v,g,y,S,w,x,C;const T=new Uint8Array(4);let k,P;const $=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(Vd(e)||!e.output||!e.input&&e.avail_in!==0)return Ea;n=e.state,n.mode===ll&&(n.mode=fC),a=e.next_out,i=e.output,l=e.avail_out,o=e.next_in,r=e.input,s=e.avail_in,u=n.hold,c=n.bits,d=s,f=l,C=Id;e:for(;;)switch(n.mode){case e2:if(n.wrap===0){n.mode=fC;break}for(;c<16;){if(s===0)break e;s--,u+=r[o++]<>>8&255,n.check=ai(n.check,T,2,0),u=0,c=0,n.mode=RI;break}if(n.head&&(n.head.done=!1),!(n.wrap&1)||(((u&255)<<8)+(u>>8))%31){e.msg="incorrect header check",n.mode=Zn;break}if((u&15)!==II){e.msg="unknown compression method",n.mode=Zn;break}if(u>>>=4,c-=4,x=(u&15)+8,n.wbits===0&&(n.wbits=x),x>15||x>n.wbits){e.msg="invalid window size",n.mode=Zn;break}n.dmax=1<>8&1),n.flags&512&&n.wrap&4&&(T[0]=u&255,T[1]=u>>>8&255,n.check=ai(n.check,T,2,0)),u=0,c=0,n.mode=OI;case OI:for(;c<32;){if(s===0)break e;s--,u+=r[o++]<>>8&255,T[2]=u>>>16&255,T[3]=u>>>24&255,n.check=ai(n.check,T,4,0)),u=0,c=0,n.mode=MI;case MI:for(;c<16;){if(s===0)break e;s--,u+=r[o++]<>8),n.flags&512&&n.wrap&4&&(T[0]=u&255,T[1]=u>>>8&255,n.check=ai(n.check,T,2,0)),u=0,c=0,n.mode=NI;case NI:if(n.flags&1024){for(;c<16;){if(s===0)break e;s--,u+=r[o++]<>>8&255,n.check=ai(n.check,T,2,0)),u=0,c=0}else n.head&&(n.head.extra=null);n.mode=$I;case $I:if(n.flags&1024&&(h=n.length,h>s&&(h=s),h&&(n.head&&(x=n.head.extra_len-n.length,n.head.extra||(n.head.extra=new Uint8Array(n.head.extra_len)),n.head.extra.set(r.subarray(o,o+h),x)),n.flags&512&&n.wrap&4&&(n.check=ai(n.check,r,h,o)),s-=h,o+=h,n.length-=h),n.length))break e;n.length=0,n.mode=DI;case DI:if(n.flags&2048){if(s===0)break e;h=0;do x=r[o+h++],n.head&&x&&n.length<65536&&(n.head.name+=String.fromCharCode(x));while(x&&h>9&1,n.head.done=!0),e.adler=n.check=0,n.mode=ll;break;case BI:for(;c<32;){if(s===0)break e;s--,u+=r[o++]<>>=c&7,c-=c&7,n.mode=pC;break}for(;c<3;){if(s===0)break e;s--,u+=r[o++]<>>=1,c-=1,u&3){case 0:n.mode=zI;break;case 1:if(rfe(n),n.mode=_v,t===bv){u>>>=2,c-=2;break e}break;case 2:n.mode=UI;break;case 3:e.msg="invalid block type",n.mode=Zn}u>>>=2,c-=2;break;case zI:for(u>>>=c&7,c-=c&7;c<32;){if(s===0)break e;s--,u+=r[o++]<>>16^65535)){e.msg="invalid stored block lengths",n.mode=Zn;break}if(n.length=u&65535,u=0,c=0,n.mode=hC,t===bv)break e;case hC:n.mode=jI;case jI:if(h=n.length,h){if(h>s&&(h=s),h>l&&(h=l),h===0)break e;i.set(r.subarray(o,o+h),a),s-=h,o+=h,l-=h,a+=h,n.length-=h;break}n.mode=ll;break;case UI:for(;c<14;){if(s===0)break e;s--,u+=r[o++]<>>=5,c-=5,n.ndist=(u&31)+1,u>>>=5,c-=5,n.ncode=(u&15)+4,u>>>=4,c-=4,n.nlen>286||n.ndist>30){e.msg="too many length or distance symbols",n.mode=Zn;break}n.have=0,n.mode=VI;case VI:for(;n.have>>=3,c-=3}for(;n.have<19;)n.lens[$[n.have++]]=0;if(n.lencode=n.lendyn,n.lenbits=7,k={bits:n.lenbits},C=Wg(qde,n.lens,0,19,n.lencode,0,n.work,k),n.lenbits=k.bits,C){e.msg="invalid code lengths set",n.mode=Zn;break}n.have=0,n.mode=GI;case GI:for(;n.have>>24,v=_>>>16&255,g=_&65535,!(b<=c);){if(s===0)break e;s--,u+=r[o++]<>>=b,c-=b,n.lens[n.have++]=g;else{if(g===16){for(P=b+2;c>>=b,c-=b,n.have===0){e.msg="invalid bit length repeat",n.mode=Zn;break}x=n.lens[n.have-1],h=3+(u&3),u>>>=2,c-=2}else if(g===17){for(P=b+3;c>>=b,c-=b,x=0,h=3+(u&7),u>>>=3,c-=3}else{for(P=b+7;c>>=b,c-=b,x=0,h=11+(u&127),u>>>=7,c-=7}if(n.have+h>n.nlen+n.ndist){e.msg="invalid bit length repeat",n.mode=Zn;break}for(;h--;)n.lens[n.have++]=x}}if(n.mode===Zn)break;if(n.lens[256]===0){e.msg="invalid code -- missing end-of-block",n.mode=Zn;break}if(n.lenbits=9,k={bits:n.lenbits},C=Wg(hz,n.lens,0,n.nlen,n.lencode,0,n.work,k),n.lenbits=k.bits,C){e.msg="invalid literal/lengths set",n.mode=Zn;break}if(n.distbits=6,n.distcode=n.distdyn,k={bits:n.distbits},C=Wg(pz,n.lens,n.nlen,n.ndist,n.distcode,0,n.work,k),n.distbits=k.bits,C){e.msg="invalid distances set",n.mode=Zn;break}if(n.mode=_v,t===bv)break e;case _v:n.mode=Sv;case Sv:if(s>=6&&l>=258){e.next_out=a,e.avail_out=l,e.next_in=o,e.avail_in=s,n.hold=u,n.bits=c,zde(e,f),a=e.next_out,i=e.output,l=e.avail_out,o=e.next_in,r=e.input,s=e.avail_in,u=n.hold,c=n.bits,n.mode===ll&&(n.back=-1);break}for(n.back=0;_=n.lencode[u&(1<>>24,v=_>>>16&255,g=_&65535,!(b<=c);){if(s===0)break e;s--,u+=r[o++]<>y)],b=_>>>24,v=_>>>16&255,g=_&65535,!(y+b<=c);){if(s===0)break e;s--,u+=r[o++]<>>=y,c-=y,n.back+=y}if(u>>>=b,c-=b,n.back+=b,n.length=g,v===0){n.mode=QI;break}if(v&32){n.back=-1,n.mode=ll;break}if(v&64){e.msg="invalid literal/length code",n.mode=Zn;break}n.extra=v&15,n.mode=HI;case HI:if(n.extra){for(P=n.extra;c>>=n.extra,c-=n.extra,n.back+=n.extra}n.was=n.length,n.mode=qI;case qI:for(;_=n.distcode[u&(1<>>24,v=_>>>16&255,g=_&65535,!(b<=c);){if(s===0)break e;s--,u+=r[o++]<>y)],b=_>>>24,v=_>>>16&255,g=_&65535,!(y+b<=c);){if(s===0)break e;s--,u+=r[o++]<>>=y,c-=y,n.back+=y}if(u>>>=b,c-=b,n.back+=b,v&64){e.msg="invalid distance code",n.mode=Zn;break}n.offset=g,n.extra=v&15,n.mode=WI;case WI:if(n.extra){for(P=n.extra;c>>=n.extra,c-=n.extra,n.back+=n.extra}if(n.offset>n.dmax){e.msg="invalid distance too far back",n.mode=Zn;break}n.mode=KI;case KI:if(l===0)break e;if(h=f-l,n.offset>h){if(h=n.offset-h,h>n.whave&&n.sane){e.msg="invalid distance too far back",n.mode=Zn;break}h>n.wnext?(h-=n.wnext,p=n.wsize-h):p=n.wnext-h,h>n.length&&(h=n.length),m=n.window}else m=i,p=a-n.offset,h=n.length;h>l&&(h=l),l-=h,n.length-=h;do i[a++]=m[p++];while(--h);n.length===0&&(n.mode=Sv);break;case QI:if(l===0)break e;i[a++]=n.length,l--,n.mode=Sv;break;case pC:if(n.wrap){for(;c<32;){if(s===0)break e;s--,u|=r[o++]<{if(Vd(e))return Ea;let t=e.state;return t.window&&(t.window=null),e.state=null,Id},afe=(e,t)=>{if(Vd(e))return Ea;const n=e.state;return n.wrap&2?(n.head=t,t.done=!1,Id):Ea},sfe=(e,t)=>{const n=t.length;let r,i,o;return Vd(e)||(r=e.state,r.wrap!==0&&r.mode!==f_)?Ea:r.mode===f_&&(i=1,i=Jm(i,t,n,0),i!==r.check)?gz:(o=wz(e,t,n,n),o?(r.mode=yz,mz):(r.havedict=1,Id))};var lfe=_z,ufe=Sz,cfe=bz,dfe=nfe,ffe=xz,hfe=ife,pfe=ofe,gfe=afe,mfe=sfe,yfe="pako inflate (from Nodeca project)",bl={inflateReset:lfe,inflateReset2:ufe,inflateResetKeep:cfe,inflateInit:dfe,inflateInit2:ffe,inflate:hfe,inflateEnd:pfe,inflateGetHeader:gfe,inflateSetDictionary:mfe,inflateInfo:yfe};function vfe(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}var bfe=vfe;const Cz=Object.prototype.toString,{Z_NO_FLUSH:_fe,Z_FINISH:Sfe,Z_OK:n0,Z_STREAM_END:yC,Z_NEED_DICT:vC,Z_STREAM_ERROR:xfe,Z_DATA_ERROR:eR,Z_MEM_ERROR:wfe}=dy;function hy(e){this.options=JS.assign({chunkSize:1024*64,windowBits:15,to:""},e||{});const t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,t.windowBits===0&&(t.windowBits=-15)),t.windowBits>=0&&t.windowBits<16&&!(e&&e.windowBits)&&(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&(t.windowBits&15||(t.windowBits|=15)),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new dz,this.strm.avail_out=0;let n=bl.inflateInit2(this.strm,t.windowBits);if(n!==n0)throw new Error(Wh[n]);if(this.header=new bfe,bl.inflateGetHeader(this.strm,this.header),t.dictionary&&(typeof t.dictionary=="string"?t.dictionary=t0.string2buf(t.dictionary):Cz.call(t.dictionary)==="[object ArrayBuffer]"&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(n=bl.inflateSetDictionary(this.strm,t.dictionary),n!==n0)))throw new Error(Wh[n])}hy.prototype.push=function(e,t){const n=this.strm,r=this.options.chunkSize,i=this.options.dictionary;let o,a,s;if(this.ended)return!1;for(t===~~t?a=t:a=t===!0?Sfe:_fe,Cz.call(e)==="[object ArrayBuffer]"?n.input=new Uint8Array(e):n.input=e,n.next_in=0,n.avail_in=n.input.length;;){for(n.avail_out===0&&(n.output=new Uint8Array(r),n.next_out=0,n.avail_out=r),o=bl.inflate(n,a),o===vC&&i&&(o=bl.inflateSetDictionary(n,i),o===n0?o=bl.inflate(n,a):o===eR&&(o=vC));n.avail_in>0&&o===yC&&n.state.wrap>0&&e[n.next_in]!==0;)bl.inflateReset(n),o=bl.inflate(n,a);switch(o){case xfe:case eR:case vC:case wfe:return this.onEnd(o),this.ended=!0,!1}if(s=n.avail_out,n.next_out&&(n.avail_out===0||o===yC))if(this.options.to==="string"){let l=t0.utf8border(n.output,n.next_out),u=n.next_out-l,c=t0.buf2string(n.output,l);n.next_out=u,n.avail_out=r-u,u&&n.output.set(n.output.subarray(l,l+u),0),this.onData(c)}else this.onData(n.output.length===n.next_out?n.output:n.output.subarray(0,n.next_out));if(!(o===n0&&s===0)){if(o===yC)return o=bl.inflateEnd(this.strm),this.onEnd(o),this.ended=!0,!0;if(n.avail_in===0)break}}return!0};hy.prototype.onData=function(e){this.chunks.push(e)};hy.prototype.onEnd=function(e){e===n0&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=JS.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};function CT(e,t){const n=new hy(t);if(n.push(e),n.err)throw n.msg||Wh[n.err];return n.result}function Cfe(e,t){return t=t||{},t.raw=!0,CT(e,t)}var Efe=hy,kfe=CT,Tfe=Cfe,Afe=CT,Pfe=dy,Ife={Inflate:Efe,inflate:kfe,inflateRaw:Tfe,ungzip:Afe,constants:Pfe};const{Inflate:cGe,inflate:Rfe,inflateRaw:dGe,ungzip:fGe}=Ife;var Ez=Rfe;const kz=[];for(let e=0;e<256;e++){let t=e;for(let n=0;n<8;n++)t&1?t=3988292384^t>>>1:t=t>>>1;kz[e]=t}function Ofe(e){let t=-1;for(let n=0;n>>8;return t^-1}var Jn;(function(e){e[e.GRAYSCALE=0]="GRAYSCALE",e[e.TRUE_COLOR=2]="TRUE_COLOR",e[e.PALETTE=3]="PALETTE",e[e.GRAYSCALE_WITH_ALPHA=4]="GRAYSCALE_WITH_ALPHA",e[e.TRUE_COLOR_WITH_ALPHA=6]="TRUE_COLOR_WITH_ALPHA"})(Jn||(Jn={}));const Mfe={[Jn.GRAYSCALE]:1,[Jn.TRUE_COLOR]:3,[Jn.PALETTE]:1,[Jn.GRAYSCALE_WITH_ALPHA]:2,[Jn.TRUE_COLOR_WITH_ALPHA]:4},Nfe=1;var Vo;(function(e){e[e.NONE=0]="NONE",e[e.SUB=1]="SUB",e[e.UP=2]="UP",e[e.AVERAGE=3]="AVERAGE",e[e.PAETH=4]="PAETH"})(Vo||(Vo={}));const $fe={[Vo.NONE](e){return e},[Vo.SUB](e,t){const n=new Uint8Array(e.length);for(let r=0;r>1;r[i]=e[i]+s}return r},[Vo.PAETH](e,t,n){const r=new Uint8Array(e.length);for(let i=0;i>7&1,i>>6&1,i>>5&1,i>>4&1,i>>3&1,i>>2&1,i>>1&1,i&1)}else if(t===2){const i=e[r++];n.push(i>>6&3,i>>4&3,i>>2&3,i&3)}else if(t===4){const i=e[r++];n.push(i>>4&15,i&15)}else if(t===8){const i=e[r++];n.push(i)}else if(t===16)n.push(e[r++]<<8|e[r++]);else throw new Error("Unsupported depth: "+t);return n}const Az=[{x:[0],y:[0]},{x:[4],y:[0]},{x:[0,4],y:[4]},{x:[2,6],y:[0,4]},{x:[0,2,4,6],y:[2,6]},{x:[1,3,5,7],y:[0,2,4,6]},{x:[0,1,2,3,4,5,6,7],y:[1,3,5,7]}];function Lfe(e,t,n){if(!e)return[{passWidth:t,passHeight:n,passIndex:0}];const r=[];return Az.forEach(function({x:i,y:o},a){const s=t%8,l=n%8,u=t-s>>3,c=n-l>>3;let d=u*i.length;for(let h=0;h>3||1;let p=0,m=new Uint8Array;for(let _=0;_>3)+Nfe,w=u[p];if(!(w in Vo))throw new Error("Unsupported filter type: "+w);const x=$fe[w],C=x(u.slice(p+1,p+S),h,m);m=C;let T=0;const k=Dfe(C,o);for(let $=0;$127)if(r>191&&r<224){if(t>=e.length)throw new Error("UTF-8 decode: incomplete 2-byte sequence");r=(r&31)<<6|e[t++]&63}else if(r>223&&r<240){if(t+1>=e.length)throw new Error("UTF-8 decode: incomplete 3-byte sequence");r=(r&15)<<12|(e[t++]&63)<<6|e[t++]&63}else if(r>239&&r<248){if(t+2>=e.length)throw new Error("UTF-8 decode: incomplete 4-byte sequence");r=(r&7)<<18|(e[t++]&63)<<12|(e[t++]&63)<<6|e[t++]&63}else throw new Error("UTF-8 decode: unknown multibyte start 0x"+r.toString(16)+" at index "+(t-1));if(r<=65535)n+=String.fromCharCode(r);else if(r<=1114111)r-=65536,n+=String.fromCharCode(r>>10|55296),n+=String.fromCharCode(r&1023|56320);else throw new Error("UTF-8 decode: code point 0x"+r.toString(16)+" exceeds UTF-16 reach")}return n}function jfe(e,t){const n=new Uint8Array(e.length+t.length);return n.set(e),n.set(t,e.length),n}const au=1e5;function Ufe(e){const t=new Uint8Array(e);let n=new Uint8Array;const r={width:0,height:0,depth:0,colorType:0,compression:0,interlace:0,filter:0,data:[]};let i=0;function o(){return t[i++]<<24|t[i++]<<16|t[i++]<<8|t[i++]}function a(){return t[i++]<<8|t[i++]}function s(){return t[i++]}function l(){const M=[];let R=0;for(;(R=t[i++])!==0;)M.push(R);return new Uint8Array(M)}function u(M){const R=i+M;let N="";for(;i=0&&tR.call(t.callee)==="[object Function]"),r},SC,nR;function qfe(){if(nR)return SC;nR=1;var e;if(!Object.keys){var t=Object.prototype.hasOwnProperty,n=Object.prototype.toString,r=Iz,i=Object.prototype.propertyIsEnumerable,o=!i.call({toString:null},"toString"),a=i.call(function(){},"prototype"),s=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],l=function(f){var h=f.constructor;return h&&h.prototype===f},u={$applicationCache:!0,$console:!0,$external:!0,$frame:!0,$frameElement:!0,$frames:!0,$innerHeight:!0,$innerWidth:!0,$onmozfullscreenchange:!0,$onmozfullscreenerror:!0,$outerHeight:!0,$outerWidth:!0,$pageXOffset:!0,$pageYOffset:!0,$parent:!0,$scrollLeft:!0,$scrollTop:!0,$scrollX:!0,$scrollY:!0,$self:!0,$webkitIndexedDB:!0,$webkitStorageInfo:!0,$window:!0},c=function(){if(typeof window>"u")return!1;for(var f in window)try{if(!u["$"+f]&&t.call(window,f)&&window[f]!==null&&typeof window[f]=="object")try{l(window[f])}catch{return!0}}catch{return!0}return!1}(),d=function(f){if(typeof window>"u"||!c)return l(f);try{return l(f)}catch{return!1}};e=function(h){var p=h!==null&&typeof h=="object",m=n.call(h)==="[object Function]",_=r(h),b=p&&n.call(h)==="[object String]",v=[];if(!p&&!m&&!_)throw new TypeError("Object.keys called on a non-object");var g=a&&m;if(b&&h.length>0&&!t.call(h,0))for(var y=0;y0)for(var S=0;S"u"||!oi?$t:oi(Uint8Array),pd={"%AggregateError%":typeof AggregateError>"u"?$t:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?$t:ArrayBuffer,"%ArrayIteratorPrototype%":df&&oi?oi([][Symbol.iterator]()):$t,"%AsyncFromSyncIteratorPrototype%":$t,"%AsyncFunction%":Cf,"%AsyncGenerator%":Cf,"%AsyncGeneratorFunction%":Cf,"%AsyncIteratorPrototype%":Cf,"%Atomics%":typeof Atomics>"u"?$t:Atomics,"%BigInt%":typeof BigInt>"u"?$t:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?$t:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?$t:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?$t:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":typeof Float32Array>"u"?$t:Float32Array,"%Float64Array%":typeof Float64Array>"u"?$t:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?$t:FinalizationRegistry,"%Function%":Oz,"%GeneratorFunction%":Cf,"%Int8Array%":typeof Int8Array>"u"?$t:Int8Array,"%Int16Array%":typeof Int16Array>"u"?$t:Int16Array,"%Int32Array%":typeof Int32Array>"u"?$t:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":df&&oi?oi(oi([][Symbol.iterator]())):$t,"%JSON%":typeof JSON=="object"?JSON:$t,"%Map%":typeof Map>"u"?$t:Map,"%MapIteratorPrototype%":typeof Map>"u"||!df||!oi?$t:oi(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?$t:Promise,"%Proxy%":typeof Proxy>"u"?$t:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":typeof Reflect>"u"?$t:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?$t:Set,"%SetIteratorPrototype%":typeof Set>"u"||!df||!oi?$t:oi(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?$t:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":df&&oi?oi(""[Symbol.iterator]()):$t,"%Symbol%":df?Symbol:$t,"%SyntaxError%":Xh,"%ThrowTypeError%":lhe,"%TypedArray%":che,"%TypeError%":hh,"%Uint8Array%":typeof Uint8Array>"u"?$t:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?$t:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?$t:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?$t:Uint32Array,"%URIError%":URIError,"%WeakMap%":typeof WeakMap>"u"?$t:WeakMap,"%WeakRef%":typeof WeakRef>"u"?$t:WeakRef,"%WeakSet%":typeof WeakSet>"u"?$t:WeakSet};if(oi)try{null.error}catch(e){var dhe=oi(oi(e));pd["%Error.prototype%"]=dhe}var fhe=function e(t){var n;if(t==="%AsyncFunction%")n=wC("async function () {}");else if(t==="%GeneratorFunction%")n=wC("function* () {}");else if(t==="%AsyncGeneratorFunction%")n=wC("async function* () {}");else if(t==="%AsyncGenerator%"){var r=e("%AsyncGeneratorFunction%");r&&(n=r.prototype)}else if(t==="%AsyncIteratorPrototype%"){var i=e("%AsyncGenerator%");i&&oi&&(n=oi(i.prototype))}return pd[t]=n,n},sR={"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},py=Rz,h_=she,hhe=py.call(Function.call,Array.prototype.concat),phe=py.call(Function.apply,Array.prototype.splice),lR=py.call(Function.call,String.prototype.replace),p_=py.call(Function.call,String.prototype.slice),ghe=py.call(Function.call,RegExp.prototype.exec),mhe=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,yhe=/\\(\\)?/g,vhe=function(t){var n=p_(t,0,1),r=p_(t,-1);if(n==="%"&&r!=="%")throw new Xh("invalid intrinsic syntax, expected closing `%`");if(r==="%"&&n!=="%")throw new Xh("invalid intrinsic syntax, expected opening `%`");var i=[];return lR(t,mhe,function(o,a,s,l){i[i.length]=s?lR(l,yhe,"$1"):a||o}),i},bhe=function(t,n){var r=t,i;if(h_(sR,r)&&(i=sR[r],r="%"+i[0]+"%"),h_(pd,r)){var o=pd[r];if(o===Cf&&(o=fhe(r)),typeof o>"u"&&!n)throw new hh("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:i,name:r,value:o}}throw new Xh("intrinsic "+t+" does not exist!")},_he=function(t,n){if(typeof t!="string"||t.length===0)throw new hh("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof n!="boolean")throw new hh('"allowMissing" argument must be a boolean');if(ghe(/^%?[^%]*%?$/,t)===null)throw new Xh("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var r=vhe(t),i=r.length>0?r[0]:"",o=bhe("%"+i+"%",n),a=o.name,s=o.value,l=!1,u=o.alias;u&&(i=u[0],phe(r,hhe([0,1],u)));for(var c=1,d=!0;c=r.length){var m=hd(s,f);d=!!m,d&&"get"in m&&!("originalValue"in m.get)?s=m.get:s=s[f]}else d=h_(s,f),s=s[f];d&&!l&&(pd[a]=s)}}return s},She=_he,hE=She("%Object.defineProperty%",!0),pE=function(){if(hE)try{return hE({},"a",{value:1}),!0}catch{return!1}return!1};pE.hasArrayLengthDefineBug=function(){if(!pE())return null;try{return hE([],"length",{value:1}).length!==1}catch{return!0}};var xhe=pE,whe=Qfe,Che=typeof Symbol=="function"&&typeof Symbol("foo")=="symbol",Ehe=Object.prototype.toString,khe=Array.prototype.concat,Mz=Object.defineProperty,The=function(e){return typeof e=="function"&&Ehe.call(e)==="[object Function]"},Ahe=xhe(),Nz=Mz&&Ahe,Phe=function(e,t,n,r){if(t in e){if(r===!0){if(e[t]===n)return}else if(!The(r)||!r())return}Nz?Mz(e,t,{configurable:!0,enumerable:!1,value:n,writable:!0}):e[t]=n},$z=function(e,t){var n=arguments.length>2?arguments[2]:{},r=whe(t);Che&&(r=khe.call(r,Object.getOwnPropertySymbols(t)));for(var i=0;i":return t>e;case":<":return t=":return t>=e;case":<=":return t<=e;default:throw new Error("Unimplemented comparison operator: ".concat(n))}};l2.testComparisonRange=Xhe;var u2={};Object.defineProperty(u2,"__esModule",{value:!0});u2.testRange=void 0;var Yhe=function(e,t){return typeof e=="number"?!(et.max||e===t.max&&!t.maxInclusive):!1};u2.testRange=Yhe;(function(e){var t=mt&&mt.__assign||function(){return t=Object.assign||function(c){for(var d,f=1,h=arguments.length;f0?{path:l.path,query:new RegExp("("+l.keywords.map(function(u){return(0,epe.escapeRegexString)(u.trim())}).join("|")+")")}:{path:l.path}})};c2.highlight=npe;var d2={},Uz={exports:{}};(function(e){(function(t,n){e.exports?e.exports=n():t.nearley=n()})(mt,function(){function t(u,c,d){return this.id=++t.highestId,this.name=u,this.symbols=c,this.postprocess=d,this}t.highestId=0,t.prototype.toString=function(u){var c=typeof u>"u"?this.symbols.map(l).join(" "):this.symbols.slice(0,u).map(l).join(" ")+" ● "+this.symbols.slice(u).map(l).join(" ");return this.name+" → "+c};function n(u,c,d,f){this.rule=u,this.dot=c,this.reference=d,this.data=[],this.wantedBy=f,this.isComplete=this.dot===u.symbols.length}n.prototype.toString=function(){return"{"+this.rule.toString(this.dot)+"}, from: "+(this.reference||0)},n.prototype.nextState=function(u){var c=new n(this.rule,this.dot+1,this.reference,this.wantedBy);return c.left=this,c.right=u,c.isComplete&&(c.data=c.build(),c.right=void 0),c},n.prototype.build=function(){var u=[],c=this;do u.push(c.right.data),c=c.left;while(c.left);return u.reverse(),u},n.prototype.finish=function(){this.rule.postprocess&&(this.data=this.rule.postprocess(this.data,this.reference,a.fail))};function r(u,c){this.grammar=u,this.index=c,this.states=[],this.wants={},this.scannable=[],this.completed={}}r.prototype.process=function(u){for(var c=this.states,d=this.wants,f=this.completed,h=0;h0&&c.push(" ^ "+f+" more lines identical to this"),f=0,c.push(" "+m)),d=m}},a.prototype.getSymbolDisplay=function(u){return s(u)},a.prototype.buildFirstStateStack=function(u,c){if(c.indexOf(u)!==-1)return null;if(u.wantedBy.length===0)return[u];var d=u.wantedBy[0],f=[u].concat(c),h=this.buildFirstStateStack(d,f);return h===null?null:[u].concat(h)},a.prototype.save=function(){var u=this.table[this.current];return u.lexerState=this.lexerState,u},a.prototype.restore=function(u){var c=u.index;this.current=c,this.table[c]=u,this.table.splice(c+1),this.lexerState=u.lexerState,this.results=this.finish()},a.prototype.rewind=function(u){if(!this.options.keepHistory)throw new Error("set option `keepHistory` to enable rewinding");this.restore(this.table[u])},a.prototype.finish=function(){var u=[],c=this.grammar.start,d=this.table[this.table.length-1];return d.states.forEach(function(f){f.rule.name===c&&f.dot===f.rule.symbols.length&&f.reference===0&&f.data!==a.fail&&u.push(f)}),u.map(function(f){return f.data})};function s(u){var c=typeof u;if(c==="string")return u;if(c==="object"){if(u.literal)return JSON.stringify(u.literal);if(u instanceof RegExp)return"character matching "+u;if(u.type)return u.type+" token";if(u.test)return"token matching "+String(u.test);throw new Error("Unknown symbol type: "+u)}}function l(u){var c=typeof u;if(c==="string")return u;if(c==="object"){if(u.literal)return JSON.stringify(u.literal);if(u instanceof RegExp)return u.toString();if(u.type)return"%"+u.type;if(u.test)return"<"+String(u.test)+">";throw new Error("Unknown symbol type: "+u)}}return{Parser:a,Grammar:i,Rule:t}})})(Gz);var ipe=Gz.exports,Rd={},Hz={},_c={};_c.__esModule=void 0;_c.__esModule=!0;var ope=typeof Object.setPrototypeOf=="function",ape=typeof Object.getPrototypeOf=="function",spe=typeof Object.defineProperty=="function",lpe=typeof Object.create=="function",upe=typeof Object.prototype.hasOwnProperty=="function",cpe=function(t,n){ope?Object.setPrototypeOf(t,n):t.__proto__=n};_c.setPrototypeOf=cpe;var dpe=function(t){return ape?Object.getPrototypeOf(t):t.__proto__||t.prototype};_c.getPrototypeOf=dpe;var cR=!1,fpe=function e(t,n,r){if(spe&&!cR)try{Object.defineProperty(t,n,r)}catch{cR=!0,e(t,n,r)}else t[n]=r.value};_c.defineProperty=fpe;var qz=function(t,n){return upe?t.hasOwnProperty(t,n):t[n]===void 0};_c.hasOwnProperty=qz;var hpe=function(t,n){if(lpe)return Object.create(t,n);var r=function(){};r.prototype=t;var i=new r;if(typeof n>"u")return i;if(typeof n=="null")throw new Error("PropertyDescriptors must not be null.");if(typeof n=="object")for(var o in n)qz(n,o)&&(i[o]=n[o].value);return i};_c.objectCreate=hpe;(function(e){e.__esModule=void 0,e.__esModule=!0;var t=_c,n=t.setPrototypeOf,r=t.getPrototypeOf,i=t.defineProperty,o=t.objectCreate,a=new Error().toString()==="[object Error]",s="";function l(u){var c=this.constructor,d=c.name||function(){var _=c.toString().match(/^function\s*([^\s(]+)/);return _===null?s||"Error":_[1]}(),f=d==="Error",h=f?s:d,p=Error.apply(this,arguments);if(n(p,r(this)),!(p instanceof c)||!(p instanceof l)){var p=this;Error.apply(this,arguments),i(p,"message",{configurable:!0,enumerable:!1,value:u,writable:!0})}if(i(p,"name",{configurable:!0,enumerable:!1,value:h,writable:!0}),Error.captureStackTrace&&Error.captureStackTrace(p,f?l:c),p.stack===void 0){var m=new Error(u);m.name=p.name,p.stack=m.stack}return a&&i(p,"toString",{configurable:!0,enumerable:!1,value:function(){return(this.name||"Error")+(typeof this.message>"u"?"":": "+this.message)},writable:!0}),p}s=l.name||"ExtendableError",l.prototype=o(Error.prototype,{constructor:{value:Error,enumerable:!1,writable:!0,configurable:!0}}),e.ExtendableError=l,e.default=e.ExtendableError})(Hz);var Wz=mt&&mt.__extends||function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(r[o]=i[o])},e(t,n)};return function(t,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}();Object.defineProperty(Rd,"__esModule",{value:!0});Rd.SyntaxError=Rd.LiqeError=void 0;var ppe=Hz,Kz=function(e){Wz(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t}(ppe.ExtendableError);Rd.LiqeError=Kz;var gpe=function(e){Wz(t,e);function t(n,r,i,o){var a=e.call(this,n)||this;return a.message=n,a.offset=r,a.line=i,a.column=o,a}return t}(Kz);Rd.SyntaxError=gpe;var PT={},g_=mt&&mt.__assign||function(){return g_=Object.assign||function(e){for(var t,n=1,r=arguments.length;n"}],postprocess:function(e){return e.join("")}},{name:"comparison_operator$subexpression$1",symbols:["comparison_operator$subexpression$1$string$2"]},{name:"comparison_operator$subexpression$1$string$3",symbols:[{literal:":"},{literal:"<"}],postprocess:function(e){return e.join("")}},{name:"comparison_operator$subexpression$1",symbols:["comparison_operator$subexpression$1$string$3"]},{name:"comparison_operator$subexpression$1$string$4",symbols:[{literal:":"},{literal:">"},{literal:"="}],postprocess:function(e){return e.join("")}},{name:"comparison_operator$subexpression$1",symbols:["comparison_operator$subexpression$1$string$4"]},{name:"comparison_operator$subexpression$1$string$5",symbols:[{literal:":"},{literal:"<"},{literal:"="}],postprocess:function(e){return e.join("")}},{name:"comparison_operator$subexpression$1",symbols:["comparison_operator$subexpression$1$string$5"]},{name:"comparison_operator",symbols:["comparison_operator$subexpression$1"],postprocess:function(e,t){return{location:{start:t,end:t+e[0][0].length},type:"ComparisonOperator",operator:e[0][0]}}},{name:"regex",symbols:["regex_body","regex_flags"],postprocess:function(e){return e.join("")}},{name:"regex_body$ebnf$1",symbols:[]},{name:"regex_body$ebnf$1",symbols:["regex_body$ebnf$1","regex_body_char"],postprocess:function(e){return e[0].concat([e[1]])}},{name:"regex_body",symbols:[{literal:"/"},"regex_body$ebnf$1",{literal:"/"}],postprocess:function(e){return"/"+e[1].join("")+"/"}},{name:"regex_body_char",symbols:[/[^\\]/],postprocess:ul},{name:"regex_body_char",symbols:[{literal:"\\"},/[^\\]/],postprocess:function(e){return"\\"+e[1]}},{name:"regex_flags",symbols:[]},{name:"regex_flags$ebnf$1",symbols:[/[gmiyusd]/]},{name:"regex_flags$ebnf$1",symbols:["regex_flags$ebnf$1",/[gmiyusd]/],postprocess:function(e){return e[0].concat([e[1]])}},{name:"regex_flags",symbols:["regex_flags$ebnf$1"],postprocess:function(e){return e[0].join("")}},{name:"unquoted_value$ebnf$1",symbols:[]},{name:"unquoted_value$ebnf$1",symbols:["unquoted_value$ebnf$1",/[a-zA-Z\.\-_*@#$]/],postprocess:function(e){return e[0].concat([e[1]])}},{name:"unquoted_value",symbols:[/[a-zA-Z_*@#$]/,"unquoted_value$ebnf$1"],postprocess:function(e){return e[0]+e[1].join("")}}],ParserStart:"main"};PT.default=mpe;var Qz={},f2={},yy={};Object.defineProperty(yy,"__esModule",{value:!0});yy.isSafePath=void 0;var ype=/^(\.(?:[_a-zA-Z][a-zA-Z\d_]*|\0|[1-9]\d*))+$/u,vpe=function(e){return ype.test(e)};yy.isSafePath=vpe;Object.defineProperty(f2,"__esModule",{value:!0});f2.createGetValueFunctionBody=void 0;var bpe=yy,_pe=function(e){if(!(0,bpe.isSafePath)(e))throw new Error("Unsafe path.");var t="return subject"+e;return t.replace(/(\.(\d+))/g,".[$2]").replace(/\./g,"?.")};f2.createGetValueFunctionBody=_pe;(function(e){var t=mt&&mt.__assign||function(){return t=Object.assign||function(o){for(var a,s=1,l=arguments.length;s\d+) col (?\d+)/,kpe=function(e){if(e.trim()==="")return{location:{end:0,start:0},type:"EmptyExpression"};var t=new Yz.default.Parser(Cpe),n;try{n=t.feed(e).results}catch(o){if(typeof(o==null?void 0:o.message)=="string"&&typeof(o==null?void 0:o.offset)=="number"){var r=o.message.match(Epe);throw r?new Spe.SyntaxError("Syntax error at line ".concat(r.groups.line," column ").concat(r.groups.column),o.offset,Number(r.groups.line),Number(r.groups.column)):o}throw o}if(n.length===0)throw new Error("Found no parsings.");if(n.length>1)throw new Error("Ambiguous results.");var i=(0,wpe.hydrateAst)(n[0]);return i};d2.parse=kpe;var h2={};Object.defineProperty(h2,"__esModule",{value:!0});h2.test=void 0;var Tpe=gy,Ape=function(e,t){return(0,Tpe.filter)(e,[t]).length===1};h2.test=Ape;var Zz={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.serialize=void 0;var t=function(o,a){return a==="double"?'"'.concat(o,'"'):a==="single"?"'".concat(o,"'"):o},n=function(o){if(o.type==="LiteralExpression")return o.quoted&&typeof o.value=="string"?t(o.value,o.quotes):String(o.value);if(o.type==="RegexExpression")return String(o.value);if(o.type==="RangeExpression"){var a=o.range,s=a.min,l=a.max,u=a.minInclusive,c=a.maxInclusive;return"".concat(u?"[":"{").concat(s," TO ").concat(l).concat(c?"]":"}")}if(o.type==="EmptyExpression")return"";throw new Error("Unexpected AST type.")},r=function(o){if(o.type!=="Tag")throw new Error("Expected a tag expression.");var a=o.field,s=o.expression,l=o.operator;if(a.type==="ImplicitField")return n(s);var u=a.quoted?t(a.name,a.quotes):a.name,c=" ".repeat(s.location.start-l.location.end);return u+l.operator+c+n(s)},i=function(o){if(o.type==="ParenthesizedExpression"){if(!("location"in o.expression))throw new Error("Expected location in expression.");if(!o.location.end)throw new Error("Expected location end.");var a=" ".repeat(o.expression.location.start-(o.location.start+1)),s=" ".repeat(o.location.end-o.expression.location.end-1);return"(".concat(a).concat((0,e.serialize)(o.expression)).concat(s,")")}if(o.type==="Tag")return r(o);if(o.type==="LogicalExpression"){var l="";return o.operator.type==="BooleanOperator"?(l+=" ".repeat(o.operator.location.start-o.left.location.end),l+=o.operator.operator,l+=" ".repeat(o.right.location.start-o.operator.location.end)):l=" ".repeat(o.right.location.start-o.left.location.end),"".concat((0,e.serialize)(o.left)).concat(l).concat((0,e.serialize)(o.right))}if(o.type==="UnaryOperator")return(o.operator==="NOT"?"NOT ":o.operator)+(0,e.serialize)(o.operand);if(o.type==="EmptyExpression")return"";throw new Error("Unexpected AST type.")};e.serialize=i})(Zz);var p2={};Object.defineProperty(p2,"__esModule",{value:!0});p2.isSafeUnquotedExpression=void 0;var Ppe=function(e){return/^[#$*@A-Z_a-z][#$*.@A-Z_a-z-]*$/.test(e)};p2.isSafeUnquotedExpression=Ppe;(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.isSafeUnquotedExpression=e.serialize=e.SyntaxError=e.LiqeError=e.test=e.parse=e.highlight=e.filter=void 0;var t=gy;Object.defineProperty(e,"filter",{enumerable:!0,get:function(){return t.filter}});var n=c2;Object.defineProperty(e,"highlight",{enumerable:!0,get:function(){return n.highlight}});var r=d2;Object.defineProperty(e,"parse",{enumerable:!0,get:function(){return r.parse}});var i=h2;Object.defineProperty(e,"test",{enumerable:!0,get:function(){return i.test}});var o=Rd;Object.defineProperty(e,"LiqeError",{enumerable:!0,get:function(){return o.LiqeError}}),Object.defineProperty(e,"SyntaxError",{enumerable:!0,get:function(){return o.SyntaxError}});var a=Zz;Object.defineProperty(e,"serialize",{enumerable:!0,get:function(){return a.serialize}});var s=p2;Object.defineProperty(e,"isSafeUnquotedExpression",{enumerable:!0,get:function(){return s.isSafeUnquotedExpression}})})(Vz);var vy={},Jz={},Od={};Object.defineProperty(Od,"__esModule",{value:!0});Od.ROARR_LOG_FORMAT_VERSION=Od.ROARR_VERSION=void 0;Od.ROARR_VERSION="5.0.0";Od.ROARR_LOG_FORMAT_VERSION="2.0.0";var by={};Object.defineProperty(by,"__esModule",{value:!0});by.logLevels=void 0;by.logLevels={debug:20,error:50,fatal:60,info:30,trace:10,warn:40};var ej={},g2={};Object.defineProperty(g2,"__esModule",{value:!0});g2.hasOwnProperty=void 0;const Ipe=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);g2.hasOwnProperty=Ipe;(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.hasOwnProperty=void 0;var t=g2;Object.defineProperty(e,"hasOwnProperty",{enumerable:!0,get:function(){return t.hasOwnProperty}})})(ej);var tj={},m2={},y2={};Object.defineProperty(y2,"__esModule",{value:!0});y2.tokenize=void 0;const Rpe=/(?:%(?([+0-]|-\+))?(?\d+)?(?\d+\$)?(?\.\d+)?(?[%BCESb-iosux]))|(\\%)/g,Ope=e=>{let t;const n=[];let r=0,i=0,o=null;for(;(t=Rpe.exec(e))!==null;){t.index>i&&(o={literal:e.slice(i,t.index),type:"literal"},n.push(o));const a=t[0];i=t.index+a.length,a==="\\%"||a==="%%"?o&&o.type==="literal"?o.literal+="%":(o={literal:"%",type:"literal"},n.push(o)):t.groups&&(o={conversion:t.groups.conversion,flag:t.groups.flag||null,placeholder:a,position:t.groups.position?Number.parseInt(t.groups.position,10)-1:r++,precision:t.groups.precision?Number.parseInt(t.groups.precision.slice(1),10):null,type:"placeholder",width:t.groups.width?Number.parseInt(t.groups.width,10):null},n.push(o))}return i<=e.length-1&&(o&&o.type==="literal"?o.literal+=e.slice(i):n.push({literal:e.slice(i),type:"literal"})),n};y2.tokenize=Ope;Object.defineProperty(m2,"__esModule",{value:!0});m2.createPrintf=void 0;const dR=kT,Mpe=y2,Npe=(e,t)=>t.placeholder,$pe=e=>{var t;const n=(o,a,s)=>s==="-"?o.padEnd(a," "):s==="-+"?((Number(o)>=0?"+":"")+o).padEnd(a," "):s==="+"?((Number(o)>=0?"+":"")+o).padStart(a," "):s==="0"?o.padStart(a,"0"):o.padStart(a," "),r=(t=e==null?void 0:e.formatUnboundExpression)!==null&&t!==void 0?t:Npe,i={};return(o,...a)=>{let s=i[o];s||(s=i[o]=Mpe.tokenize(o));let l="";for(const u of s)if(u.type==="literal")l+=u.literal;else{let c=a[u.position];if(c===void 0)l+=r(o,u,a);else if(u.conversion==="b")l+=dR.boolean(c)?"true":"false";else if(u.conversion==="B")l+=dR.boolean(c)?"TRUE":"FALSE";else if(u.conversion==="c")l+=c;else if(u.conversion==="C")l+=String(c).toUpperCase();else if(u.conversion==="i"||u.conversion==="d")c=String(Math.trunc(c)),u.width!==null&&(c=n(c,u.width,u.flag)),l+=c;else if(u.conversion==="e")l+=Number(c).toExponential();else if(u.conversion==="E")l+=Number(c).toExponential().toUpperCase();else if(u.conversion==="f")u.precision!==null&&(c=Number(c).toFixed(u.precision)),u.width!==null&&(c=n(String(c),u.width,u.flag)),l+=c;else if(u.conversion==="o")l+=(Number.parseInt(String(c),10)>>>0).toString(8);else if(u.conversion==="s")u.width!==null&&(c=n(String(c),u.width,u.flag)),l+=c;else if(u.conversion==="S")u.width!==null&&(c=n(String(c),u.width,u.flag)),l+=String(c).toUpperCase();else if(u.conversion==="u")l+=Number.parseInt(String(c),10)>>>0;else if(u.conversion==="x")c=(Number.parseInt(String(c),10)>>>0).toString(16),u.width!==null&&(c=n(String(c),u.width,u.flag)),l+=c;else throw new Error("Unknown format specifier.")}return l}};m2.createPrintf=$pe;(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.printf=e.createPrintf=void 0;const t=m2;Object.defineProperty(e,"createPrintf",{enumerable:!0,get:function(){return t.createPrintf}}),e.printf=t.createPrintf()})(tj);var gE={exports:{}};(function(e,t){const{hasOwnProperty:n}=Object.prototype,r=_();r.configure=_,r.stringify=r,r.default=r,t.stringify=r,t.configure=_,e.exports=r;const i=/[\u0000-\u001f\u0022\u005c\ud800-\udfff]|[\ud800-\udbff](?![\udc00-\udfff])|(?:[^\ud800-\udbff]|^)[\udc00-\udfff]/;function o(b){return b.length<5e3&&!i.test(b)?`"${b}"`:JSON.stringify(b)}function a(b){if(b.length>200)return b.sort();for(let v=1;vg;)b[y]=b[y-1],y--;b[y]=g}return b}const s=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(Object.getPrototypeOf(new Int8Array)),Symbol.toStringTag).get;function l(b){return s.call(b)!==void 0&&b.length!==0}function u(b,v,g){b.length= 1`)}return g===void 0?1/0:g}function h(b){return b===1?"1 item":`${b} items`}function p(b){const v=new Set;for(const g of b)(typeof g=="string"||typeof g=="number")&&v.add(String(g));return v}function m(b){if(n.call(b,"strict")){const v=b.strict;if(typeof v!="boolean")throw new TypeError('The "strict" argument must be of type boolean');if(v)return g=>{let y=`Object can not safely be stringified. Received type ${typeof g}`;throw typeof g!="function"&&(y+=` (${g.toString()})`),new Error(y)}}}function _(b){b={...b};const v=m(b);v&&(b.bigint===void 0&&(b.bigint=!1),"circularValue"in b||(b.circularValue=Error));const g=c(b),y=d(b,"bigint"),S=d(b,"deterministic"),w=f(b,"maximumDepth"),x=f(b,"maximumBreadth");function C(O,E,A,D,L,M){let R=E[O];switch(typeof R=="object"&&R!==null&&typeof R.toJSON=="function"&&(R=R.toJSON(O)),R=D.call(E,O,R),typeof R){case"string":return o(R);case"object":{if(R===null)return"null";if(A.indexOf(R)!==-1)return g;let N="",B=",";const U=M;if(Array.isArray(R)){if(R.length===0)return"[]";if(w0&&c.push(" ^ "+f+" more lines identical to this"),f=0,c.push(" "+m)),d=m}},a.prototype.getSymbolDisplay=function(u){return s(u)},a.prototype.buildFirstStateStack=function(u,c){if(c.indexOf(u)!==-1)return null;if(u.wantedBy.length===0)return[u];var d=u.wantedBy[0],f=[u].concat(c),h=this.buildFirstStateStack(d,f);return h===null?null:[u].concat(h)},a.prototype.save=function(){var u=this.table[this.current];return u.lexerState=this.lexerState,u},a.prototype.restore=function(u){var c=u.index;this.current=c,this.table[c]=u,this.table.splice(c+1),this.lexerState=u.lexerState,this.results=this.finish()},a.prototype.rewind=function(u){if(!this.options.keepHistory)throw new Error("set option `keepHistory` to enable rewinding");this.restore(this.table[u])},a.prototype.finish=function(){var u=[],c=this.grammar.start,d=this.table[this.table.length-1];return d.states.forEach(function(f){f.rule.name===c&&f.dot===f.rule.symbols.length&&f.reference===0&&f.data!==a.fail&&u.push(f)}),u.map(function(f){return f.data})};function s(u){var c=typeof u;if(c==="string")return u;if(c==="object"){if(u.literal)return JSON.stringify(u.literal);if(u instanceof RegExp)return"character matching "+u;if(u.type)return u.type+" token";if(u.test)return"token matching "+String(u.test);throw new Error("Unknown symbol type: "+u)}}function l(u){var c=typeof u;if(c==="string")return u;if(c==="object"){if(u.literal)return JSON.stringify(u.literal);if(u instanceof RegExp)return u.toString();if(u.type)return"%"+u.type;if(u.test)return"<"+String(u.test)+">";throw new Error("Unknown symbol type: "+u)}}return{Parser:a,Grammar:i,Rule:t}})})(Uz);var rpe=Uz.exports,Rd={},Vz={},_c={};_c.__esModule=void 0;_c.__esModule=!0;var ipe=typeof Object.setPrototypeOf=="function",ope=typeof Object.getPrototypeOf=="function",ape=typeof Object.defineProperty=="function",spe=typeof Object.create=="function",lpe=typeof Object.prototype.hasOwnProperty=="function",upe=function(t,n){ipe?Object.setPrototypeOf(t,n):t.__proto__=n};_c.setPrototypeOf=upe;var cpe=function(t){return ope?Object.getPrototypeOf(t):t.__proto__||t.prototype};_c.getPrototypeOf=cpe;var uR=!1,dpe=function e(t,n,r){if(ape&&!uR)try{Object.defineProperty(t,n,r)}catch{uR=!0,e(t,n,r)}else t[n]=r.value};_c.defineProperty=dpe;var Gz=function(t,n){return lpe?t.hasOwnProperty(t,n):t[n]===void 0};_c.hasOwnProperty=Gz;var fpe=function(t,n){if(spe)return Object.create(t,n);var r=function(){};r.prototype=t;var i=new r;if(typeof n>"u")return i;if(typeof n=="null")throw new Error("PropertyDescriptors must not be null.");if(typeof n=="object")for(var o in n)Gz(n,o)&&(i[o]=n[o].value);return i};_c.objectCreate=fpe;(function(e){e.__esModule=void 0,e.__esModule=!0;var t=_c,n=t.setPrototypeOf,r=t.getPrototypeOf,i=t.defineProperty,o=t.objectCreate,a=new Error().toString()==="[object Error]",s="";function l(u){var c=this.constructor,d=c.name||function(){var _=c.toString().match(/^function\s*([^\s(]+)/);return _===null?s||"Error":_[1]}(),f=d==="Error",h=f?s:d,p=Error.apply(this,arguments);if(n(p,r(this)),!(p instanceof c)||!(p instanceof l)){var p=this;Error.apply(this,arguments),i(p,"message",{configurable:!0,enumerable:!1,value:u,writable:!0})}if(i(p,"name",{configurable:!0,enumerable:!1,value:h,writable:!0}),Error.captureStackTrace&&Error.captureStackTrace(p,f?l:c),p.stack===void 0){var m=new Error(u);m.name=p.name,p.stack=m.stack}return a&&i(p,"toString",{configurable:!0,enumerable:!1,value:function(){return(this.name||"Error")+(typeof this.message>"u"?"":": "+this.message)},writable:!0}),p}s=l.name||"ExtendableError",l.prototype=o(Error.prototype,{constructor:{value:Error,enumerable:!1,writable:!0,configurable:!0}}),e.ExtendableError=l,e.default=e.ExtendableError})(Vz);var Hz=mt&&mt.__extends||function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(r[o]=i[o])},e(t,n)};return function(t,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}();Object.defineProperty(Rd,"__esModule",{value:!0});Rd.SyntaxError=Rd.LiqeError=void 0;var hpe=Vz,qz=function(e){Hz(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t}(hpe.ExtendableError);Rd.LiqeError=qz;var ppe=function(e){Hz(t,e);function t(n,r,i,o){var a=e.call(this,n)||this;return a.message=n,a.offset=r,a.line=i,a.column=o,a}return t}(qz);Rd.SyntaxError=ppe;var AT={},g_=mt&&mt.__assign||function(){return g_=Object.assign||function(e){for(var t,n=1,r=arguments.length;n"}],postprocess:function(e){return e.join("")}},{name:"comparison_operator$subexpression$1",symbols:["comparison_operator$subexpression$1$string$2"]},{name:"comparison_operator$subexpression$1$string$3",symbols:[{literal:":"},{literal:"<"}],postprocess:function(e){return e.join("")}},{name:"comparison_operator$subexpression$1",symbols:["comparison_operator$subexpression$1$string$3"]},{name:"comparison_operator$subexpression$1$string$4",symbols:[{literal:":"},{literal:">"},{literal:"="}],postprocess:function(e){return e.join("")}},{name:"comparison_operator$subexpression$1",symbols:["comparison_operator$subexpression$1$string$4"]},{name:"comparison_operator$subexpression$1$string$5",symbols:[{literal:":"},{literal:"<"},{literal:"="}],postprocess:function(e){return e.join("")}},{name:"comparison_operator$subexpression$1",symbols:["comparison_operator$subexpression$1$string$5"]},{name:"comparison_operator",symbols:["comparison_operator$subexpression$1"],postprocess:function(e,t){return{location:{start:t,end:t+e[0][0].length},type:"ComparisonOperator",operator:e[0][0]}}},{name:"regex",symbols:["regex_body","regex_flags"],postprocess:function(e){return e.join("")}},{name:"regex_body$ebnf$1",symbols:[]},{name:"regex_body$ebnf$1",symbols:["regex_body$ebnf$1","regex_body_char"],postprocess:function(e){return e[0].concat([e[1]])}},{name:"regex_body",symbols:[{literal:"/"},"regex_body$ebnf$1",{literal:"/"}],postprocess:function(e){return"/"+e[1].join("")+"/"}},{name:"regex_body_char",symbols:[/[^\\]/],postprocess:ul},{name:"regex_body_char",symbols:[{literal:"\\"},/[^\\]/],postprocess:function(e){return"\\"+e[1]}},{name:"regex_flags",symbols:[]},{name:"regex_flags$ebnf$1",symbols:[/[gmiyusd]/]},{name:"regex_flags$ebnf$1",symbols:["regex_flags$ebnf$1",/[gmiyusd]/],postprocess:function(e){return e[0].concat([e[1]])}},{name:"regex_flags",symbols:["regex_flags$ebnf$1"],postprocess:function(e){return e[0].join("")}},{name:"unquoted_value$ebnf$1",symbols:[]},{name:"unquoted_value$ebnf$1",symbols:["unquoted_value$ebnf$1",/[a-zA-Z\.\-_*@#$]/],postprocess:function(e){return e[0].concat([e[1]])}},{name:"unquoted_value",symbols:[/[a-zA-Z_*@#$]/,"unquoted_value$ebnf$1"],postprocess:function(e){return e[0]+e[1].join("")}}],ParserStart:"main"};AT.default=gpe;var Wz={},f2={},yy={};Object.defineProperty(yy,"__esModule",{value:!0});yy.isSafePath=void 0;var mpe=/^(\.(?:[_a-zA-Z][a-zA-Z\d_]*|\0|[1-9]\d*))+$/u,ype=function(e){return mpe.test(e)};yy.isSafePath=ype;Object.defineProperty(f2,"__esModule",{value:!0});f2.createGetValueFunctionBody=void 0;var vpe=yy,bpe=function(e){if(!(0,vpe.isSafePath)(e))throw new Error("Unsafe path.");var t="return subject"+e;return t.replace(/(\.(\d+))/g,".[$2]").replace(/\./g,"?.")};f2.createGetValueFunctionBody=bpe;(function(e){var t=mt&&mt.__assign||function(){return t=Object.assign||function(o){for(var a,s=1,l=arguments.length;s\d+) col (?\d+)/,Epe=function(e){if(e.trim()==="")return{location:{end:0,start:0},type:"EmptyExpression"};var t=new Qz.default.Parser(wpe),n;try{n=t.feed(e).results}catch(o){if(typeof(o==null?void 0:o.message)=="string"&&typeof(o==null?void 0:o.offset)=="number"){var r=o.message.match(Cpe);throw r?new _pe.SyntaxError("Syntax error at line ".concat(r.groups.line," column ").concat(r.groups.column),o.offset,Number(r.groups.line),Number(r.groups.column)):o}throw o}if(n.length===0)throw new Error("Found no parsings.");if(n.length>1)throw new Error("Ambiguous results.");var i=(0,xpe.hydrateAst)(n[0]);return i};d2.parse=Epe;var h2={};Object.defineProperty(h2,"__esModule",{value:!0});h2.test=void 0;var kpe=gy,Tpe=function(e,t){return(0,kpe.filter)(e,[t]).length===1};h2.test=Tpe;var Xz={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.serialize=void 0;var t=function(o,a){return a==="double"?'"'.concat(o,'"'):a==="single"?"'".concat(o,"'"):o},n=function(o){if(o.type==="LiteralExpression")return o.quoted&&typeof o.value=="string"?t(o.value,o.quotes):String(o.value);if(o.type==="RegexExpression")return String(o.value);if(o.type==="RangeExpression"){var a=o.range,s=a.min,l=a.max,u=a.minInclusive,c=a.maxInclusive;return"".concat(u?"[":"{").concat(s," TO ").concat(l).concat(c?"]":"}")}if(o.type==="EmptyExpression")return"";throw new Error("Unexpected AST type.")},r=function(o){if(o.type!=="Tag")throw new Error("Expected a tag expression.");var a=o.field,s=o.expression,l=o.operator;if(a.type==="ImplicitField")return n(s);var u=a.quoted?t(a.name,a.quotes):a.name,c=" ".repeat(s.location.start-l.location.end);return u+l.operator+c+n(s)},i=function(o){if(o.type==="ParenthesizedExpression"){if(!("location"in o.expression))throw new Error("Expected location in expression.");if(!o.location.end)throw new Error("Expected location end.");var a=" ".repeat(o.expression.location.start-(o.location.start+1)),s=" ".repeat(o.location.end-o.expression.location.end-1);return"(".concat(a).concat((0,e.serialize)(o.expression)).concat(s,")")}if(o.type==="Tag")return r(o);if(o.type==="LogicalExpression"){var l="";return o.operator.type==="BooleanOperator"?(l+=" ".repeat(o.operator.location.start-o.left.location.end),l+=o.operator.operator,l+=" ".repeat(o.right.location.start-o.operator.location.end)):l=" ".repeat(o.right.location.start-o.left.location.end),"".concat((0,e.serialize)(o.left)).concat(l).concat((0,e.serialize)(o.right))}if(o.type==="UnaryOperator")return(o.operator==="NOT"?"NOT ":o.operator)+(0,e.serialize)(o.operand);if(o.type==="EmptyExpression")return"";throw new Error("Unexpected AST type.")};e.serialize=i})(Xz);var p2={};Object.defineProperty(p2,"__esModule",{value:!0});p2.isSafeUnquotedExpression=void 0;var Ape=function(e){return/^[#$*@A-Z_a-z][#$*.@A-Z_a-z-]*$/.test(e)};p2.isSafeUnquotedExpression=Ape;(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.isSafeUnquotedExpression=e.serialize=e.SyntaxError=e.LiqeError=e.test=e.parse=e.highlight=e.filter=void 0;var t=gy;Object.defineProperty(e,"filter",{enumerable:!0,get:function(){return t.filter}});var n=c2;Object.defineProperty(e,"highlight",{enumerable:!0,get:function(){return n.highlight}});var r=d2;Object.defineProperty(e,"parse",{enumerable:!0,get:function(){return r.parse}});var i=h2;Object.defineProperty(e,"test",{enumerable:!0,get:function(){return i.test}});var o=Rd;Object.defineProperty(e,"LiqeError",{enumerable:!0,get:function(){return o.LiqeError}}),Object.defineProperty(e,"SyntaxError",{enumerable:!0,get:function(){return o.SyntaxError}});var a=Xz;Object.defineProperty(e,"serialize",{enumerable:!0,get:function(){return a.serialize}});var s=p2;Object.defineProperty(e,"isSafeUnquotedExpression",{enumerable:!0,get:function(){return s.isSafeUnquotedExpression}})})(jz);var vy={},Yz={},Od={};Object.defineProperty(Od,"__esModule",{value:!0});Od.ROARR_LOG_FORMAT_VERSION=Od.ROARR_VERSION=void 0;Od.ROARR_VERSION="5.0.0";Od.ROARR_LOG_FORMAT_VERSION="2.0.0";var by={};Object.defineProperty(by,"__esModule",{value:!0});by.logLevels=void 0;by.logLevels={debug:20,error:50,fatal:60,info:30,trace:10,warn:40};var Zz={},g2={};Object.defineProperty(g2,"__esModule",{value:!0});g2.hasOwnProperty=void 0;const Ppe=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);g2.hasOwnProperty=Ppe;(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.hasOwnProperty=void 0;var t=g2;Object.defineProperty(e,"hasOwnProperty",{enumerable:!0,get:function(){return t.hasOwnProperty}})})(Zz);var Jz={},m2={},y2={};Object.defineProperty(y2,"__esModule",{value:!0});y2.tokenize=void 0;const Ipe=/(?:%(?([+0-]|-\+))?(?\d+)?(?\d+\$)?(?\.\d+)?(?[%BCESb-iosux]))|(\\%)/g,Rpe=e=>{let t;const n=[];let r=0,i=0,o=null;for(;(t=Ipe.exec(e))!==null;){t.index>i&&(o={literal:e.slice(i,t.index),type:"literal"},n.push(o));const a=t[0];i=t.index+a.length,a==="\\%"||a==="%%"?o&&o.type==="literal"?o.literal+="%":(o={literal:"%",type:"literal"},n.push(o)):t.groups&&(o={conversion:t.groups.conversion,flag:t.groups.flag||null,placeholder:a,position:t.groups.position?Number.parseInt(t.groups.position,10)-1:r++,precision:t.groups.precision?Number.parseInt(t.groups.precision.slice(1),10):null,type:"placeholder",width:t.groups.width?Number.parseInt(t.groups.width,10):null},n.push(o))}return i<=e.length-1&&(o&&o.type==="literal"?o.literal+=e.slice(i):n.push({literal:e.slice(i),type:"literal"})),n};y2.tokenize=Rpe;Object.defineProperty(m2,"__esModule",{value:!0});m2.createPrintf=void 0;const cR=ET,Ope=y2,Mpe=(e,t)=>t.placeholder,Npe=e=>{var t;const n=(o,a,s)=>s==="-"?o.padEnd(a," "):s==="-+"?((Number(o)>=0?"+":"")+o).padEnd(a," "):s==="+"?((Number(o)>=0?"+":"")+o).padStart(a," "):s==="0"?o.padStart(a,"0"):o.padStart(a," "),r=(t=e==null?void 0:e.formatUnboundExpression)!==null&&t!==void 0?t:Mpe,i={};return(o,...a)=>{let s=i[o];s||(s=i[o]=Ope.tokenize(o));let l="";for(const u of s)if(u.type==="literal")l+=u.literal;else{let c=a[u.position];if(c===void 0)l+=r(o,u,a);else if(u.conversion==="b")l+=cR.boolean(c)?"true":"false";else if(u.conversion==="B")l+=cR.boolean(c)?"TRUE":"FALSE";else if(u.conversion==="c")l+=c;else if(u.conversion==="C")l+=String(c).toUpperCase();else if(u.conversion==="i"||u.conversion==="d")c=String(Math.trunc(c)),u.width!==null&&(c=n(c,u.width,u.flag)),l+=c;else if(u.conversion==="e")l+=Number(c).toExponential();else if(u.conversion==="E")l+=Number(c).toExponential().toUpperCase();else if(u.conversion==="f")u.precision!==null&&(c=Number(c).toFixed(u.precision)),u.width!==null&&(c=n(String(c),u.width,u.flag)),l+=c;else if(u.conversion==="o")l+=(Number.parseInt(String(c),10)>>>0).toString(8);else if(u.conversion==="s")u.width!==null&&(c=n(String(c),u.width,u.flag)),l+=c;else if(u.conversion==="S")u.width!==null&&(c=n(String(c),u.width,u.flag)),l+=String(c).toUpperCase();else if(u.conversion==="u")l+=Number.parseInt(String(c),10)>>>0;else if(u.conversion==="x")c=(Number.parseInt(String(c),10)>>>0).toString(16),u.width!==null&&(c=n(String(c),u.width,u.flag)),l+=c;else throw new Error("Unknown format specifier.")}return l}};m2.createPrintf=Npe;(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.printf=e.createPrintf=void 0;const t=m2;Object.defineProperty(e,"createPrintf",{enumerable:!0,get:function(){return t.createPrintf}}),e.printf=t.createPrintf()})(Jz);var gE={exports:{}};(function(e,t){const{hasOwnProperty:n}=Object.prototype,r=_();r.configure=_,r.stringify=r,r.default=r,t.stringify=r,t.configure=_,e.exports=r;const i=/[\u0000-\u001f\u0022\u005c\ud800-\udfff]|[\ud800-\udbff](?![\udc00-\udfff])|(?:[^\ud800-\udbff]|^)[\udc00-\udfff]/;function o(b){return b.length<5e3&&!i.test(b)?`"${b}"`:JSON.stringify(b)}function a(b){if(b.length>200)return b.sort();for(let v=1;vg;)b[y]=b[y-1],y--;b[y]=g}return b}const s=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(Object.getPrototypeOf(new Int8Array)),Symbol.toStringTag).get;function l(b){return s.call(b)!==void 0&&b.length!==0}function u(b,v,g){b.length= 1`)}return g===void 0?1/0:g}function h(b){return b===1?"1 item":`${b} items`}function p(b){const v=new Set;for(const g of b)(typeof g=="string"||typeof g=="number")&&v.add(String(g));return v}function m(b){if(n.call(b,"strict")){const v=b.strict;if(typeof v!="boolean")throw new TypeError('The "strict" argument must be of type boolean');if(v)return g=>{let y=`Object can not safely be stringified. Received type ${typeof g}`;throw typeof g!="function"&&(y+=` (${g.toString()})`),new Error(y)}}}function _(b){b={...b};const v=m(b);v&&(b.bigint===void 0&&(b.bigint=!1),"circularValue"in b||(b.circularValue=Error));const g=c(b),y=d(b,"bigint"),S=d(b,"deterministic"),w=f(b,"maximumDepth"),x=f(b,"maximumBreadth");function C(O,E,A,D,L,M){let R=E[O];switch(typeof R=="object"&&R!==null&&typeof R.toJSON=="function"&&(R=R.toJSON(O)),R=D.call(E,O,R),typeof R){case"string":return o(R);case"object":{if(R===null)return"null";if(A.indexOf(R)!==-1)return g;let N="",B=",";const U=M;if(Array.isArray(R)){if(R.length===0)return"[]";if(wx){const ve=R.length-x-1;N+=`${B}"... ${h(ve)} not stringified"`}return L!==""&&(N+=` ${U}`),A.pop(),`[${N}]`}let G=Object.keys(R);const Y=G.length;if(Y===0)return"{}";if(wx){const ee=N-x;U+=`${G}"...": "${h(ee)} not stringified"`,G=B}return G!==""&&(U=` ${L}${U} -${M}`),A.pop(),`{${U}}`}case"number":return isFinite(E)?String(E):v?v(E):"null";case"boolean":return E===!0?"true":"false";case"undefined":return;case"bigint":if(y)return String(E);default:return v?v(E):void 0}}function P(O,E,A){switch(typeof E){case"string":return o(E);case"object":{if(E===null)return"null";if(typeof E.toJSON=="function"){if(E=E.toJSON(O),typeof E!="object")return P(O,E,A);if(E===null)return"null"}if(A.indexOf(E)!==-1)return g;let D="";if(Array.isArray(E)){if(E.length===0)return"[]";if(wx){const Y=E.length-x-1;D+=`,"... ${h(Y)} not stringified"`}return A.pop(),`[${D}]`}let L=Object.keys(E);const M=L.length;if(M===0)return"{}";if(wx){const B=M-x;D+=`${R}"...":"${h(B)} not stringified"`}return A.pop(),`{${D}}`}case"number":return isFinite(E)?String(E):v?v(E):"null";case"boolean":return E===!0?"true":"false";case"undefined":return;case"bigint":if(y)return String(E);default:return v?v(E):void 0}}function $(O,E,A){if(arguments.length>1){let D="";if(typeof A=="number"?D=" ".repeat(Math.min(A,10)):typeof A=="string"&&(D=A.slice(0,10)),E!=null){if(typeof E=="function")return C("",{"":O},[],E,D,"");if(Array.isArray(E))return T("",O,[],p(E),D,"")}if(D.length!==0)return k("",O,[],D,"")}return P("",O,[])}return $}})(gE,gE.exports);var Dpe=gE.exports;(function(e){var t=mt&&mt.__importDefault||function(g){return g&&g.__esModule?g:{default:g}};Object.defineProperty(e,"__esModule",{value:!0}),e.createLogger=void 0;const n=Od,r=by,i=ej,o=tj,a=t(TT),s=t(Dpe);let l=!1;const u=(0,a.default)(),c=()=>u.ROARR,d=()=>({messageContext:{},transforms:[]}),f=()=>{const g=c().asyncLocalStorage;if(!g)throw new Error("AsyncLocalContext is unavailable.");const y=g.getStore();return y||d()},h=()=>!!c().asyncLocalStorage,p=()=>{if(h()){const g=f();return(0,i.hasOwnProperty)(g,"sequenceRoot")&&(0,i.hasOwnProperty)(g,"sequence")&&typeof g.sequence=="number"?String(g.sequenceRoot)+"."+String(g.sequence++):String(c().sequence++)}return String(c().sequence++)},m=(g,y)=>(S,w,x,C,T,k,P,$,O,E)=>{g.child({logLevel:y})(S,w,x,C,T,k,P,$,O,E)},_=1e3,b=(g,y)=>(S,w,x,C,T,k,P,$,O,E)=>{const A=(0,s.default)({a:S,b:w,c:x,d:C,e:T,f:k,g:P,h:$,i:O,j:E,logLevel:y});if(!A)throw new Error("Expected key to be a string");const D=c().onceLog;D.has(A)||(D.add(A),D.size>_&&D.clear(),g.child({logLevel:y})(S,w,x,C,T,k,P,$,O,E))},v=(g,y={},S=[])=>{const w=(x,C,T,k,P,$,O,E,A,D)=>{const L=Date.now(),M=p();let R;h()?R=f():R=d();let N,B;if(typeof x=="string"?N={...R.messageContext,...y}:N={...R.messageContext,...y,...x},typeof x=="string"&&C===void 0)B=x;else if(typeof x=="string"){if(!x.includes("%"))throw new Error("When a string parameter is followed by other arguments, then it is assumed that you are attempting to format a message using printf syntax. You either forgot to add printf bindings or if you meant to add context to the log message, pass them in an object as the first parameter.");B=(0,o.printf)(x,C,T,k,P,$,O,E,A,D)}else{let G=C;if(typeof C!="string")if(C===void 0)G="";else throw new TypeError("Message must be a string. Received "+typeof C+".");B=(0,o.printf)(G,T,k,P,$,O,E,A,D)}let U={context:N,message:B,sequence:M,time:L,version:n.ROARR_LOG_FORMAT_VERSION};for(const G of[...R.transforms,...S])if(U=G(U),typeof U!="object"||U===null)throw new Error("Message transform function must return a message object.");g(U)};return w.child=x=>{let C;return h()?C=f():C=d(),typeof x=="function"?(0,e.createLogger)(g,{...C.messageContext,...y,...x},[x,...S]):(0,e.createLogger)(g,{...C.messageContext,...y,...x},S)},w.getContext=()=>{let x;return h()?x=f():x=d(),{...x.messageContext,...y}},w.adopt=async(x,C)=>{if(!h())return l===!1&&(l=!0,g({context:{logLevel:r.logLevels.warn,package:"roarr"},message:"async_hooks are unavailable; Roarr.adopt will not function as expected",sequence:p(),time:Date.now(),version:n.ROARR_LOG_FORMAT_VERSION})),x();const T=f();let k;(0,i.hasOwnProperty)(T,"sequenceRoot")&&(0,i.hasOwnProperty)(T,"sequence")&&typeof T.sequence=="number"?k=T.sequenceRoot+"."+String(T.sequence++):k=String(c().sequence++);let P={...T.messageContext};const $=[...T.transforms];typeof C=="function"?$.push(C):P={...P,...C};const O=c().asyncLocalStorage;if(!O)throw new Error("Async local context unavailable.");return O.run({messageContext:P,sequence:0,sequenceRoot:k,transforms:$},()=>x())},w.debug=m(w,r.logLevels.debug),w.debugOnce=b(w,r.logLevels.debug),w.error=m(w,r.logLevels.error),w.errorOnce=b(w,r.logLevels.error),w.fatal=m(w,r.logLevels.fatal),w.fatalOnce=b(w,r.logLevels.fatal),w.info=m(w,r.logLevels.info),w.infoOnce=b(w,r.logLevels.info),w.trace=m(w,r.logLevels.trace),w.traceOnce=b(w,r.logLevels.trace),w.warn=m(w,r.logLevels.warn),w.warnOnce=b(w,r.logLevels.warn),w};e.createLogger=v})(Jz);var v2={},Lpe=function(t,n){for(var r=t.split("."),i=n.split("."),o=0;o<3;o++){var a=Number(r[o]),s=Number(i[o]);if(a>s)return 1;if(s>a)return-1;if(!isNaN(a)&&isNaN(s))return 1;if(isNaN(a)&&!isNaN(s))return-1}return 0},Fpe=mt&&mt.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(v2,"__esModule",{value:!0});v2.createRoarrInitialGlobalStateBrowser=void 0;const fR=Od,hR=Fpe(Lpe),Bpe=e=>{const t=(e.versions||[]).concat();return t.length>1&&t.sort(hR.default),t.includes(fR.ROARR_VERSION)||t.push(fR.ROARR_VERSION),t.sort(hR.default),{sequence:0,...e,versions:t}};v2.createRoarrInitialGlobalStateBrowser=Bpe;var b2={};Object.defineProperty(b2,"__esModule",{value:!0});b2.getLogLevelName=void 0;const zpe=e=>e<=10?"trace":e<=20?"debug":e<=30?"info":e<=40?"warn":e<=50?"error":"fatal";b2.getLogLevelName=zpe;(function(e){var t=mt&&mt.__importDefault||function(d){return d&&d.__esModule?d:{default:d}};Object.defineProperty(e,"__esModule",{value:!0}),e.getLogLevelName=e.logLevels=e.Roarr=e.ROARR=void 0;const n=Jz,r=v2,o=(0,t(TT).default)(),a=(0,r.createRoarrInitialGlobalStateBrowser)(o.ROARR||{});e.ROARR=a,o.ROARR=a;const s=d=>JSON.stringify(d),l=(0,n.createLogger)(d=>{var f;a.write&&a.write(((f=a.serializeMessage)!==null&&f!==void 0?f:s)(d))});e.Roarr=l;var u=by;Object.defineProperty(e,"logLevels",{enumerable:!0,get:function(){return u.logLevels}});var c=b2;Object.defineProperty(e,"getLogLevelName",{enumerable:!0,get:function(){return c.getLogLevelName}})})(vy);var jpe=mt&&mt.__rest||function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(e);ix){const Y=E.length-x-1;D+=`,"... ${h(Y)} not stringified"`}return A.pop(),`[${D}]`}let L=Object.keys(E);const M=L.length;if(M===0)return"{}";if(wx){const B=M-x;D+=`${R}"...":"${h(B)} not stringified"`}return A.pop(),`{${D}}`}case"number":return isFinite(E)?String(E):v?v(E):"null";case"boolean":return E===!0?"true":"false";case"undefined":return;case"bigint":if(y)return String(E);default:return v?v(E):void 0}}function $(O,E,A){if(arguments.length>1){let D="";if(typeof A=="number"?D=" ".repeat(Math.min(A,10)):typeof A=="string"&&(D=A.slice(0,10)),E!=null){if(typeof E=="function")return C("",{"":O},[],E,D,"");if(Array.isArray(E))return T("",O,[],p(E),D,"")}if(D.length!==0)return k("",O,[],D,"")}return P("",O,[])}return $}})(gE,gE.exports);var $pe=gE.exports;(function(e){var t=mt&&mt.__importDefault||function(g){return g&&g.__esModule?g:{default:g}};Object.defineProperty(e,"__esModule",{value:!0}),e.createLogger=void 0;const n=Od,r=by,i=Zz,o=Jz,a=t(kT),s=t($pe);let l=!1;const u=(0,a.default)(),c=()=>u.ROARR,d=()=>({messageContext:{},transforms:[]}),f=()=>{const g=c().asyncLocalStorage;if(!g)throw new Error("AsyncLocalContext is unavailable.");const y=g.getStore();return y||d()},h=()=>!!c().asyncLocalStorage,p=()=>{if(h()){const g=f();return(0,i.hasOwnProperty)(g,"sequenceRoot")&&(0,i.hasOwnProperty)(g,"sequence")&&typeof g.sequence=="number"?String(g.sequenceRoot)+"."+String(g.sequence++):String(c().sequence++)}return String(c().sequence++)},m=(g,y)=>(S,w,x,C,T,k,P,$,O,E)=>{g.child({logLevel:y})(S,w,x,C,T,k,P,$,O,E)},_=1e3,b=(g,y)=>(S,w,x,C,T,k,P,$,O,E)=>{const A=(0,s.default)({a:S,b:w,c:x,d:C,e:T,f:k,g:P,h:$,i:O,j:E,logLevel:y});if(!A)throw new Error("Expected key to be a string");const D=c().onceLog;D.has(A)||(D.add(A),D.size>_&&D.clear(),g.child({logLevel:y})(S,w,x,C,T,k,P,$,O,E))},v=(g,y={},S=[])=>{const w=(x,C,T,k,P,$,O,E,A,D)=>{const L=Date.now(),M=p();let R;h()?R=f():R=d();let N,B;if(typeof x=="string"?N={...R.messageContext,...y}:N={...R.messageContext,...y,...x},typeof x=="string"&&C===void 0)B=x;else if(typeof x=="string"){if(!x.includes("%"))throw new Error("When a string parameter is followed by other arguments, then it is assumed that you are attempting to format a message using printf syntax. You either forgot to add printf bindings or if you meant to add context to the log message, pass them in an object as the first parameter.");B=(0,o.printf)(x,C,T,k,P,$,O,E,A,D)}else{let G=C;if(typeof C!="string")if(C===void 0)G="";else throw new TypeError("Message must be a string. Received "+typeof C+".");B=(0,o.printf)(G,T,k,P,$,O,E,A,D)}let U={context:N,message:B,sequence:M,time:L,version:n.ROARR_LOG_FORMAT_VERSION};for(const G of[...R.transforms,...S])if(U=G(U),typeof U!="object"||U===null)throw new Error("Message transform function must return a message object.");g(U)};return w.child=x=>{let C;return h()?C=f():C=d(),typeof x=="function"?(0,e.createLogger)(g,{...C.messageContext,...y,...x},[x,...S]):(0,e.createLogger)(g,{...C.messageContext,...y,...x},S)},w.getContext=()=>{let x;return h()?x=f():x=d(),{...x.messageContext,...y}},w.adopt=async(x,C)=>{if(!h())return l===!1&&(l=!0,g({context:{logLevel:r.logLevels.warn,package:"roarr"},message:"async_hooks are unavailable; Roarr.adopt will not function as expected",sequence:p(),time:Date.now(),version:n.ROARR_LOG_FORMAT_VERSION})),x();const T=f();let k;(0,i.hasOwnProperty)(T,"sequenceRoot")&&(0,i.hasOwnProperty)(T,"sequence")&&typeof T.sequence=="number"?k=T.sequenceRoot+"."+String(T.sequence++):k=String(c().sequence++);let P={...T.messageContext};const $=[...T.transforms];typeof C=="function"?$.push(C):P={...P,...C};const O=c().asyncLocalStorage;if(!O)throw new Error("Async local context unavailable.");return O.run({messageContext:P,sequence:0,sequenceRoot:k,transforms:$},()=>x())},w.debug=m(w,r.logLevels.debug),w.debugOnce=b(w,r.logLevels.debug),w.error=m(w,r.logLevels.error),w.errorOnce=b(w,r.logLevels.error),w.fatal=m(w,r.logLevels.fatal),w.fatalOnce=b(w,r.logLevels.fatal),w.info=m(w,r.logLevels.info),w.infoOnce=b(w,r.logLevels.info),w.trace=m(w,r.logLevels.trace),w.traceOnce=b(w,r.logLevels.trace),w.warn=m(w,r.logLevels.warn),w.warnOnce=b(w,r.logLevels.warn),w};e.createLogger=v})(Yz);var v2={},Dpe=function(t,n){for(var r=t.split("."),i=n.split("."),o=0;o<3;o++){var a=Number(r[o]),s=Number(i[o]);if(a>s)return 1;if(s>a)return-1;if(!isNaN(a)&&isNaN(s))return 1;if(isNaN(a)&&!isNaN(s))return-1}return 0},Lpe=mt&&mt.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(v2,"__esModule",{value:!0});v2.createRoarrInitialGlobalStateBrowser=void 0;const dR=Od,fR=Lpe(Dpe),Fpe=e=>{const t=(e.versions||[]).concat();return t.length>1&&t.sort(fR.default),t.includes(dR.ROARR_VERSION)||t.push(dR.ROARR_VERSION),t.sort(fR.default),{sequence:0,...e,versions:t}};v2.createRoarrInitialGlobalStateBrowser=Fpe;var b2={};Object.defineProperty(b2,"__esModule",{value:!0});b2.getLogLevelName=void 0;const Bpe=e=>e<=10?"trace":e<=20?"debug":e<=30?"info":e<=40?"warn":e<=50?"error":"fatal";b2.getLogLevelName=Bpe;(function(e){var t=mt&&mt.__importDefault||function(d){return d&&d.__esModule?d:{default:d}};Object.defineProperty(e,"__esModule",{value:!0}),e.getLogLevelName=e.logLevels=e.Roarr=e.ROARR=void 0;const n=Yz,r=v2,o=(0,t(kT).default)(),a=(0,r.createRoarrInitialGlobalStateBrowser)(o.ROARR||{});e.ROARR=a,o.ROARR=a;const s=d=>JSON.stringify(d),l=(0,n.createLogger)(d=>{var f;a.write&&a.write(((f=a.serializeMessage)!==null&&f!==void 0?f:s)(d))});e.Roarr=l;var u=by;Object.defineProperty(e,"logLevels",{enumerable:!0,get:function(){return u.logLevels}});var c=b2;Object.defineProperty(e,"getLogLevelName",{enumerable:!0,get:function(){return c.getLogLevelName}})})(vy);var zpe=mt&&mt.__rest||function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(e);i0?h("%c ".concat(f," %c").concat(c?" [".concat(String(c),"]:"):"","%c ").concat(s.message," %O"),m,_,b,d):h("%c ".concat(f," %c").concat(c?" [".concat(String(c),"]:"):"","%c ").concat(s.message),m,_,b)}}};t2.createLogWriter=Xpe;(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.createLogWriter=void 0;var t=t2;Object.defineProperty(e,"createLogWriter",{enumerable:!0,get:function(){return t.createLogWriter}})})(Rz);vy.ROARR.write=Rz.createLogWriter();const rj={};vy.Roarr.child(rj);const _2=tl(vy.Roarr.child(rj)),_e=e=>_2.get().child({namespace:e}),pGe=["trace","debug","info","warn","error","fatal"],gGe={trace:10,debug:20,info:30,warn:40,error:50,fatal:60},Qt=e=>{try{return JSON.parse(JSON.stringify(e))}catch{return"Error parsing object"}},Ype=async e=>{const t={},n=await e.arrayBuffer(),r=Vfe(n).text,i=ch(r,"invokeai_metadata");if(i){const a=zB.safeParse(JSON.parse(i));a.success?t.metadata=a.data:_e("system").error({error:Qt(a.error)},"Problem reading metadata from image")}const o=ch(r,"invokeai_workflow");if(o){const a=HB.safeParse(JSON.parse(o));a.success?t.workflow=a.data:_e("system").error({error:Qt(a.error)},"Problem reading workflow from image")}return t};var m_=globalThis&&globalThis.__generator||function(e,t){var n={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},r,i,o,a;return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function s(u){return function(c){return l([u,c])}}function l(u){if(r)throw new TypeError("Generator is already executing.");for(;n;)try{if(r=1,i&&(o=u[0]&2?i.return:u[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,u[1])).done)return o;switch(i=0,o&&(u=[u[0]&2,o.value]),u[0]){case 0:case 1:o=u;break;case 4:return n.label++,{value:u[1],done:!1};case 5:n.label++,i=u[1],u=[0];continue;case 7:u=n.ops.pop(),n.trys.pop();continue;default:if(o=n.trys,!(o=o.length>0&&o[o.length-1])&&(u[0]===6||u[0]===2)){n=0;continue}if(u[0]===3&&(!o||u[1]>o[0]&&u[1]"u"||navigator.onLine===void 0?!0:navigator.onLine}function sge(){return typeof document>"u"?!0:document.visibilityState!=="hidden"}var vR=as;function aj(e,t){if(e===t||!(vR(e)&&vR(t)||Array.isArray(e)&&Array.isArray(t)))return t;for(var n=Object.keys(t),r=Object.keys(e),i=n.length===r.length,o=Array.isArray(t)?[]:{},a=0,s=n;a=200&&e.status<=299},uge=function(e){return/ion\/(vnd\.api\+)?json/.test(e.get("content-type")||"")};function _R(e){if(!as(e))return e;for(var t=wr({},e),n=0,r=Object.entries(t);n"u"&&s===bR&&console.warn("Warning: `fetch` is not available. Please supply a custom `fetchFn` property to use `fetchBaseQuery` on SSR environments."),function(g,y){return b_(t,null,function(){var S,w,x,C,T,k,P,$,O,E,A,D,L,M,R,N,B,U,G,Y,ee,J,j,Q,ne,se,ve,ce,bt,ot,ze,gt,Pe,Jt,Ar,Dn;return m_(this,function(Tn){switch(Tn.label){case 0:return S=y.signal,w=y.getState,x=y.extra,C=y.endpoint,T=y.forced,k=y.type,$=typeof g=="string"?{url:g}:g,O=$.url,E=$.headers,A=E===void 0?new Headers(b.headers):E,D=$.params,L=D===void 0?void 0:D,M=$.responseHandler,R=M===void 0?m??"json":M,N=$.validateStatus,B=N===void 0?_??lge:N,U=$.timeout,G=U===void 0?p:U,Y=mR($,["url","headers","params","responseHandler","validateStatus","timeout"]),ee=wr(Ns(wr({},b),{signal:S}),Y),A=new Headers(_R(A)),J=ee,[4,o(A,{getState:w,extra:x,endpoint:C,forced:T,type:k})];case 1:J.headers=Tn.sent()||A,j=function(en){return typeof en=="object"&&(as(en)||Array.isArray(en)||typeof en.toJSON=="function")},!ee.headers.has("content-type")&&j(ee.body)&&ee.headers.set("content-type",f),j(ee.body)&&c(ee.headers)&&(ee.body=JSON.stringify(ee.body,h)),L&&(Q=~O.indexOf("?")?"&":"?",ne=l?l(L):new URLSearchParams(_R(L)),O+=Q+ne),O=oge(r,O),se=new Request(O,ee),ve=se.clone(),P={request:ve},bt=!1,ot=G&&setTimeout(function(){bt=!0,y.abort()},G),Tn.label=2;case 2:return Tn.trys.push([2,4,5,6]),[4,s(se)];case 3:return ce=Tn.sent(),[3,6];case 4:return ze=Tn.sent(),[2,{error:{status:bt?"TIMEOUT_ERROR":"FETCH_ERROR",error:String(ze)},meta:P}];case 5:return ot&&clearTimeout(ot),[7];case 6:gt=ce.clone(),P.response=gt,Jt="",Tn.label=7;case 7:return Tn.trys.push([7,9,,10]),[4,Promise.all([v(ce,R).then(function(en){return Pe=en},function(en){return Ar=en}),gt.text().then(function(en){return Jt=en},function(){})])];case 8:if(Tn.sent(),Ar)throw Ar;return[3,10];case 9:return Dn=Tn.sent(),[2,{error:{status:"PARSING_ERROR",originalStatus:ce.status,data:Jt,error:String(Dn)},meta:P}];case 10:return[2,B(ce,Pe)?{data:Pe,meta:P}:{error:{status:ce.status,data:Pe},meta:P}]}})})};function v(g,y){return b_(this,null,function(){var S;return m_(this,function(w){switch(w.label){case 0:return typeof y=="function"?[2,y(g)]:(y==="content-type"&&(y=c(g.headers)?"json":"text"),y!=="json"?[3,2]:[4,g.text()]);case 1:return S=w.sent(),[2,S.length?JSON.parse(S):null];case 2:return[2,g.text()]}})})}}var SR=function(){function e(t,n){n===void 0&&(n=void 0),this.value=t,this.meta=n}return e}(),IT=Ne("__rtkq/focused"),sj=Ne("__rtkq/unfocused"),RT=Ne("__rtkq/online"),lj=Ne("__rtkq/offline"),Xs;(function(e){e.query="query",e.mutation="mutation"})(Xs||(Xs={}));function uj(e){return e.type===Xs.query}function dge(e){return e.type===Xs.mutation}function cj(e,t,n,r,i,o){return fge(e)?e(t,n,r,i).map(mE).map(o):Array.isArray(e)?e.map(mE).map(o):[]}function fge(e){return typeof e=="function"}function mE(e){return typeof e=="string"?{type:e}:e}function kC(e){return e!=null}var r0=Symbol("forceQueryFn"),yE=function(e){return typeof e[r0]=="function"};function hge(e){var t=e.serializeQueryArgs,n=e.queryThunk,r=e.mutationThunk,i=e.api,o=e.context,a=new Map,s=new Map,l=i.internalActions,u=l.unsubscribeQueryResult,c=l.removeMutationResult,d=l.updateSubscriptionOptions;return{buildInitiateQuery:v,buildInitiateMutation:g,getRunningQueryThunk:p,getRunningMutationThunk:m,getRunningQueriesThunk:_,getRunningMutationsThunk:b,getRunningOperationPromises:h,removalWarning:f};function f(){throw new Error(`This method had to be removed due to a conceptual bug in RTK. + `;Object.keys(d).length>0?h("%c ".concat(f," %c").concat(c?" [".concat(String(c),"]:"):"","%c ").concat(s.message," %O"),m,_,b,d):h("%c ".concat(f," %c").concat(c?" [".concat(String(c),"]:"):"","%c ").concat(s.message),m,_,b)}}};t2.createLogWriter=Qpe;(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.createLogWriter=void 0;var t=t2;Object.defineProperty(e,"createLogWriter",{enumerable:!0,get:function(){return t.createLogWriter}})})(Pz);vy.ROARR.write=Pz.createLogWriter();const tj={};vy.Roarr.child(tj);const _2=tl(vy.Roarr.child(tj)),Ce=e=>_2.get().child({namespace:e}),hGe=["trace","debug","info","warn","error","fatal"],pGe={trace:10,debug:20,info:30,warn:40,error:50,fatal:60},Qt=e=>{try{return JSON.parse(JSON.stringify(e))}catch{return"Error parsing object"}},Xpe=async e=>{const t={},n=await e.arrayBuffer(),r=Ufe(n).text,i=uh(r,"invokeai_metadata");if(i){const a=FB.safeParse(JSON.parse(i));a.success?t.metadata=a.data:Ce("system").error({error:Qt(a.error)},"Problem reading metadata from image")}const o=uh(r,"invokeai_workflow");if(o){const a=VB.safeParse(JSON.parse(o));a.success?t.workflow=a.data:Ce("system").error({error:Qt(a.error)},"Problem reading workflow from image")}return t};var m_=globalThis&&globalThis.__generator||function(e,t){var n={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},r,i,o,a;return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function s(u){return function(c){return l([u,c])}}function l(u){if(r)throw new TypeError("Generator is already executing.");for(;n;)try{if(r=1,i&&(o=u[0]&2?i.return:u[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,u[1])).done)return o;switch(i=0,o&&(u=[u[0]&2,o.value]),u[0]){case 0:case 1:o=u;break;case 4:return n.label++,{value:u[1],done:!1};case 5:n.label++,i=u[1],u=[0];continue;case 7:u=n.ops.pop(),n.trys.pop();continue;default:if(o=n.trys,!(o=o.length>0&&o[o.length-1])&&(u[0]===6||u[0]===2)){n=0;continue}if(u[0]===3&&(!o||u[1]>o[0]&&u[1]"u"||navigator.onLine===void 0?!0:navigator.onLine}function age(){return typeof document>"u"?!0:document.visibilityState!=="hidden"}var yR=as;function ij(e,t){if(e===t||!(yR(e)&&yR(t)||Array.isArray(e)&&Array.isArray(t)))return t;for(var n=Object.keys(t),r=Object.keys(e),i=n.length===r.length,o=Array.isArray(t)?[]:{},a=0,s=n;a=200&&e.status<=299},lge=function(e){return/ion\/(vnd\.api\+)?json/.test(e.get("content-type")||"")};function bR(e){if(!as(e))return e;for(var t=wr({},e),n=0,r=Object.entries(t);n"u"&&s===vR&&console.warn("Warning: `fetch` is not available. Please supply a custom `fetchFn` property to use `fetchBaseQuery` on SSR environments."),function(g,y){return b_(t,null,function(){var S,w,x,C,T,k,P,$,O,E,A,D,L,M,R,N,B,U,G,Y,ee,J,j,Q,ne,se,ve,ce,bt,ot,ze,gt,Pe,Jt,Ar,Dn;return m_(this,function(Tn){switch(Tn.label){case 0:return S=y.signal,w=y.getState,x=y.extra,C=y.endpoint,T=y.forced,k=y.type,$=typeof g=="string"?{url:g}:g,O=$.url,E=$.headers,A=E===void 0?new Headers(b.headers):E,D=$.params,L=D===void 0?void 0:D,M=$.responseHandler,R=M===void 0?m??"json":M,N=$.validateStatus,B=N===void 0?_??sge:N,U=$.timeout,G=U===void 0?p:U,Y=gR($,["url","headers","params","responseHandler","validateStatus","timeout"]),ee=wr(Ns(wr({},b),{signal:S}),Y),A=new Headers(bR(A)),J=ee,[4,o(A,{getState:w,extra:x,endpoint:C,forced:T,type:k})];case 1:J.headers=Tn.sent()||A,j=function(en){return typeof en=="object"&&(as(en)||Array.isArray(en)||typeof en.toJSON=="function")},!ee.headers.has("content-type")&&j(ee.body)&&ee.headers.set("content-type",f),j(ee.body)&&c(ee.headers)&&(ee.body=JSON.stringify(ee.body,h)),L&&(Q=~O.indexOf("?")?"&":"?",ne=l?l(L):new URLSearchParams(bR(L)),O+=Q+ne),O=ige(r,O),se=new Request(O,ee),ve=se.clone(),P={request:ve},bt=!1,ot=G&&setTimeout(function(){bt=!0,y.abort()},G),Tn.label=2;case 2:return Tn.trys.push([2,4,5,6]),[4,s(se)];case 3:return ce=Tn.sent(),[3,6];case 4:return ze=Tn.sent(),[2,{error:{status:bt?"TIMEOUT_ERROR":"FETCH_ERROR",error:String(ze)},meta:P}];case 5:return ot&&clearTimeout(ot),[7];case 6:gt=ce.clone(),P.response=gt,Jt="",Tn.label=7;case 7:return Tn.trys.push([7,9,,10]),[4,Promise.all([v(ce,R).then(function(en){return Pe=en},function(en){return Ar=en}),gt.text().then(function(en){return Jt=en},function(){})])];case 8:if(Tn.sent(),Ar)throw Ar;return[3,10];case 9:return Dn=Tn.sent(),[2,{error:{status:"PARSING_ERROR",originalStatus:ce.status,data:Jt,error:String(Dn)},meta:P}];case 10:return[2,B(ce,Pe)?{data:Pe,meta:P}:{error:{status:ce.status,data:Pe},meta:P}]}})})};function v(g,y){return b_(this,null,function(){var S;return m_(this,function(w){switch(w.label){case 0:return typeof y=="function"?[2,y(g)]:(y==="content-type"&&(y=c(g.headers)?"json":"text"),y!=="json"?[3,2]:[4,g.text()]);case 1:return S=w.sent(),[2,S.length?JSON.parse(S):null];case 2:return[2,g.text()]}})})}}var _R=function(){function e(t,n){n===void 0&&(n=void 0),this.value=t,this.meta=n}return e}(),PT=Ne("__rtkq/focused"),oj=Ne("__rtkq/unfocused"),IT=Ne("__rtkq/online"),aj=Ne("__rtkq/offline"),Xs;(function(e){e.query="query",e.mutation="mutation"})(Xs||(Xs={}));function sj(e){return e.type===Xs.query}function cge(e){return e.type===Xs.mutation}function lj(e,t,n,r,i,o){return dge(e)?e(t,n,r,i).map(mE).map(o):Array.isArray(e)?e.map(mE).map(o):[]}function dge(e){return typeof e=="function"}function mE(e){return typeof e=="string"?{type:e}:e}function kC(e){return e!=null}var r0=Symbol("forceQueryFn"),yE=function(e){return typeof e[r0]=="function"};function fge(e){var t=e.serializeQueryArgs,n=e.queryThunk,r=e.mutationThunk,i=e.api,o=e.context,a=new Map,s=new Map,l=i.internalActions,u=l.unsubscribeQueryResult,c=l.removeMutationResult,d=l.updateSubscriptionOptions;return{buildInitiateQuery:v,buildInitiateMutation:g,getRunningQueryThunk:p,getRunningMutationThunk:m,getRunningQueriesThunk:_,getRunningMutationsThunk:b,getRunningOperationPromises:h,removalWarning:f};function f(){throw new Error(`This method had to be removed due to a conceptual bug in RTK. Please see https://github.com/reduxjs/redux-toolkit/pull/2481 for details. - See https://redux-toolkit.js.org/rtk-query/usage/server-side-rendering for new guidance on SSR.`)}function h(){typeof process<"u";var y=function(S){return Array.from(S.values()).flatMap(function(w){return w?Object.values(w):[]})};return y_(y_([],y(a)),y(s)).filter(kC)}function p(y,S){return function(w){var x,C=o.endpointDefinitions[y],T=t({queryArgs:S,endpointDefinition:C,endpointName:y});return(x=a.get(w))==null?void 0:x[T]}}function m(y,S){return function(w){var x;return(x=s.get(w))==null?void 0:x[S]}}function _(){return function(y){return Object.values(a.get(y)||{}).filter(kC)}}function b(){return function(y){return Object.values(s.get(y)||{}).filter(kC)}}function v(y,S){var w=function(x,C){var T=C===void 0?{}:C,k=T.subscribe,P=k===void 0?!0:k,$=T.forceRefetch,O=T.subscriptionOptions,E=r0,A=T[E];return function(D,L){var M,R,N=t({queryArgs:x,endpointDefinition:S,endpointName:y}),B=n((M={type:"query",subscribe:P,forceRefetch:$,subscriptionOptions:O,endpointName:y,originalArgs:x,queryCacheKey:N},M[r0]=A,M)),U=i.endpoints[y].select(x),G=D(B),Y=U(L()),ee=G.requestId,J=G.abort,j=Y.requestId!==ee,Q=(R=a.get(D))==null?void 0:R[N],ne=function(){return U(L())},se=Object.assign(A?G.then(ne):j&&!Q?Promise.resolve(Y):Promise.all([Q,G]).then(ne),{arg:x,requestId:ee,subscriptionOptions:O,queryCacheKey:N,abort:J,unwrap:function(){return b_(this,null,function(){var ce;return m_(this,function(bt){switch(bt.label){case 0:return[4,se];case 1:if(ce=bt.sent(),ce.isError)throw ce.error;return[2,ce.data]}})})},refetch:function(){return D(w(x,{subscribe:!1,forceRefetch:!0}))},unsubscribe:function(){P&&D(u({queryCacheKey:N,requestId:ee}))},updateSubscriptionOptions:function(ce){se.subscriptionOptions=ce,D(d({endpointName:y,requestId:ee,queryCacheKey:N,options:ce}))}});if(!Q&&!j&&!A){var ve=a.get(D)||{};ve[N]=se,a.set(D,ve),se.then(function(){delete ve[N],Object.keys(ve).length||a.delete(D)})}return se}};return w}function g(y){return function(S,w){var x=w===void 0?{}:w,C=x.track,T=C===void 0?!0:C,k=x.fixedCacheKey;return function(P,$){var O=r({type:"mutation",endpointName:y,originalArgs:S,track:T,fixedCacheKey:k}),E=P(O),A=E.requestId,D=E.abort,L=E.unwrap,M=E.unwrap().then(function(U){return{data:U}}).catch(function(U){return{error:U}}),R=function(){P(c({requestId:A,fixedCacheKey:k}))},N=Object.assign(M,{arg:E.arg,requestId:A,abort:D,unwrap:L,unsubscribe:R,reset:R}),B=s.get(P)||{};return s.set(P,B),B[A]=N,N.then(function(){delete B[A],Object.keys(B).length||s.delete(P)}),k&&(B[k]=N,N.then(function(){B[k]===N&&(delete B[k],Object.keys(B).length||s.delete(P))})),N}}}}function xR(e){return e}function pge(e){var t=this,n=e.reducerPath,r=e.baseQuery,i=e.context.endpointDefinitions,o=e.serializeQueryArgs,a=e.api,s=function(g,y,S){return function(w){var x=i[g];w(a.internalActions.queryResultPatched({queryCacheKey:o({queryArgs:y,endpointDefinition:x,endpointName:g}),patches:S}))}},l=function(g,y,S){return function(w,x){var C,T,k=a.endpoints[g].select(y)(x()),P={patches:[],inversePatches:[],undo:function(){return w(a.util.patchQueryData(g,y,P.inversePatches))}};if(k.status===er.uninitialized)return P;if("data"in k)if(Ao(k.data)){var $=qk(k.data,S),O=$[1],E=$[2];(C=P.patches).push.apply(C,O),(T=P.inversePatches).push.apply(T,E)}else{var A=S(k.data);P.patches.push({op:"replace",path:[],value:A}),P.inversePatches.push({op:"replace",path:[],value:k.data})}return w(a.util.patchQueryData(g,y,P.patches)),P}},u=function(g,y,S){return function(w){var x;return w(a.endpoints[g].initiate(y,(x={subscribe:!1,forceRefetch:!0},x[r0]=function(){return{data:S}},x)))}},c=function(g,y){return b_(t,[g,y],function(S,w){var x,C,T,k,P,$,O,E,A,D,L,M,R,N,B,U,G,Y,ee=w.signal,J=w.abort,j=w.rejectWithValue,Q=w.fulfillWithValue,ne=w.dispatch,se=w.getState,ve=w.extra;return m_(this,function(ce){switch(ce.label){case 0:x=i[S.endpointName],ce.label=1;case 1:return ce.trys.push([1,8,,13]),C=xR,T=void 0,k={signal:ee,abort:J,dispatch:ne,getState:se,extra:ve,endpoint:S.endpointName,type:S.type,forced:S.type==="query"?d(S,se()):void 0},P=S.type==="query"?S[r0]:void 0,P?(T=P(),[3,6]):[3,2];case 2:return x.query?[4,r(x.query(S.originalArgs),k,x.extraOptions)]:[3,4];case 3:return T=ce.sent(),x.transformResponse&&(C=x.transformResponse),[3,6];case 4:return[4,x.queryFn(S.originalArgs,k,x.extraOptions,function(bt){return r(bt,k,x.extraOptions)})];case 5:T=ce.sent(),ce.label=6;case 6:if(typeof process<"u",T.error)throw new SR(T.error,T.meta);return L=Q,[4,C(T.data,T.meta,S.originalArgs)];case 7:return[2,L.apply(void 0,[ce.sent(),(G={fulfilledTimeStamp:Date.now(),baseQueryMeta:T.meta},G[Jc]=!0,G)])];case 8:if(M=ce.sent(),R=M,!(R instanceof SR))return[3,12];N=xR,x.query&&x.transformErrorResponse&&(N=x.transformErrorResponse),ce.label=9;case 9:return ce.trys.push([9,11,,12]),B=j,[4,N(R.value,R.meta,S.originalArgs)];case 10:return[2,B.apply(void 0,[ce.sent(),(Y={baseQueryMeta:R.meta},Y[Jc]=!0,Y)])];case 11:return U=ce.sent(),R=U,[3,12];case 12:throw typeof process<"u",console.error(R),R;case 13:return[2]}})})};function d(g,y){var S,w,x,C,T=(w=(S=y[n])==null?void 0:S.queries)==null?void 0:w[g.queryCacheKey],k=(x=y[n])==null?void 0:x.config.refetchOnMountOrArgChange,P=T==null?void 0:T.fulfilledTimeStamp,$=(C=g.forceRefetch)!=null?C:g.subscribe&&k;return $?$===!0||(Number(new Date)-Number(P))/1e3>=$:!1}var f=zb(n+"/executeQuery",c,{getPendingMeta:function(){var g;return g={startedTimeStamp:Date.now()},g[Jc]=!0,g},condition:function(g,y){var S=y.getState,w,x,C,T=S(),k=(x=(w=T[n])==null?void 0:w.queries)==null?void 0:x[g.queryCacheKey],P=k==null?void 0:k.fulfilledTimeStamp,$=g.originalArgs,O=k==null?void 0:k.originalArgs,E=i[g.endpointName];return yE(g)?!0:(k==null?void 0:k.status)==="pending"?!1:d(g,T)||uj(E)&&((C=E==null?void 0:E.forceRefetch)!=null&&C.call(E,{currentArg:$,previousArg:O,endpointState:k,state:T}))?!0:!P},dispatchConditionRejection:!0}),h=zb(n+"/executeMutation",c,{getPendingMeta:function(){var g;return g={startedTimeStamp:Date.now()},g[Jc]=!0,g}}),p=function(g){return"force"in g},m=function(g){return"ifOlderThan"in g},_=function(g,y,S){return function(w,x){var C=p(S)&&S.force,T=m(S)&&S.ifOlderThan,k=function(E){return E===void 0&&(E=!0),a.endpoints[g].initiate(y,{forceRefetch:E})},P=a.endpoints[g].select(y)(x());if(C)w(k());else if(T){var $=P==null?void 0:P.fulfilledTimeStamp;if(!$){w(k());return}var O=(Number(new Date)-Number(new Date($)))/1e3>=T;O&&w(k())}else w(k(!1))}};function b(g){return function(y){var S,w;return((w=(S=y==null?void 0:y.meta)==null?void 0:S.arg)==null?void 0:w.endpointName)===g}}function v(g,y){return{matchPending:ah(NS(g),b(y)),matchFulfilled:ah(bc(g),b(y)),matchRejected:ah(Uh(g),b(y))}}return{queryThunk:f,mutationThunk:h,prefetch:_,updateQueryData:l,upsertQueryData:u,patchQueryData:s,buildMatchThunkActions:v}}function dj(e,t,n,r){return cj(n[e.meta.arg.endpointName][t],bc(e)?e.payload:void 0,Z0(e)?e.payload:void 0,e.meta.arg.originalArgs,"baseQueryMeta"in e.meta?e.meta.baseQueryMeta:void 0,r)}function xv(e,t,n){var r=e[t];r&&n(r)}function i0(e){var t;return(t="arg"in e?e.arg.fixedCacheKey:e.fixedCacheKey)!=null?t:e.requestId}function wR(e,t,n){var r=e[i0(t)];r&&n(r)}var Wp={};function gge(e){var t=e.reducerPath,n=e.queryThunk,r=e.mutationThunk,i=e.context,o=i.endpointDefinitions,a=i.apiUid,s=i.extractRehydrationInfo,l=i.hasRehydrationInfo,u=e.assertTagType,c=e.config,d=Ne(t+"/resetApiState"),f=nr({name:t+"/queries",initialState:Wp,reducers:{removeQueryResult:{reducer:function(S,w){var x=w.payload.queryCacheKey;delete S[x]},prepare:R1()},queryResultPatched:function(S,w){var x=w.payload,C=x.queryCacheKey,T=x.patches;xv(S,C,function(k){k.data=F3(k.data,T.concat())})}},extraReducers:function(S){S.addCase(n.pending,function(w,x){var C=x.meta,T=x.meta.arg,k,P,$=yE(T);(T.subscribe||$)&&((P=w[k=T.queryCacheKey])!=null||(w[k]={status:er.uninitialized,endpointName:T.endpointName})),xv(w,T.queryCacheKey,function(O){O.status=er.pending,O.requestId=$&&O.requestId?O.requestId:C.requestId,T.originalArgs!==void 0&&(O.originalArgs=T.originalArgs),O.startedTimeStamp=C.startedTimeStamp})}).addCase(n.fulfilled,function(w,x){var C=x.meta,T=x.payload;xv(w,C.arg.queryCacheKey,function(k){var P;if(!(k.requestId!==C.requestId&&!yE(C.arg))){var $=o[C.arg.endpointName].merge;if(k.status=er.fulfilled,$)if(k.data!==void 0){var O=C.fulfilledTimeStamp,E=C.arg,A=C.baseQueryMeta,D=C.requestId,L=vc(k.data,function(M){return $(M,T,{arg:E.originalArgs,baseQueryMeta:A,fulfilledTimeStamp:O,requestId:D})});k.data=L}else k.data=T;else k.data=(P=o[C.arg.endpointName].structuralSharing)==null||P?aj(io(k.data)?Bk(k.data):k.data,T):T;delete k.error,k.fulfilledTimeStamp=C.fulfilledTimeStamp}})}).addCase(n.rejected,function(w,x){var C=x.meta,T=C.condition,k=C.arg,P=C.requestId,$=x.error,O=x.payload;xv(w,k.queryCacheKey,function(E){if(!T){if(E.requestId!==P)return;E.status=er.rejected,E.error=O??$}})}).addMatcher(l,function(w,x){for(var C=s(x).queries,T=0,k=Object.entries(C);T=$:!1}var f=zb(n+"/executeQuery",c,{getPendingMeta:function(){var g;return g={startedTimeStamp:Date.now()},g[Jc]=!0,g},condition:function(g,y){var S=y.getState,w,x,C,T=S(),k=(x=(w=T[n])==null?void 0:w.queries)==null?void 0:x[g.queryCacheKey],P=k==null?void 0:k.fulfilledTimeStamp,$=g.originalArgs,O=k==null?void 0:k.originalArgs,E=i[g.endpointName];return yE(g)?!0:(k==null?void 0:k.status)==="pending"?!1:d(g,T)||sj(E)&&((C=E==null?void 0:E.forceRefetch)!=null&&C.call(E,{currentArg:$,previousArg:O,endpointState:k,state:T}))?!0:!P},dispatchConditionRejection:!0}),h=zb(n+"/executeMutation",c,{getPendingMeta:function(){var g;return g={startedTimeStamp:Date.now()},g[Jc]=!0,g}}),p=function(g){return"force"in g},m=function(g){return"ifOlderThan"in g},_=function(g,y,S){return function(w,x){var C=p(S)&&S.force,T=m(S)&&S.ifOlderThan,k=function(E){return E===void 0&&(E=!0),a.endpoints[g].initiate(y,{forceRefetch:E})},P=a.endpoints[g].select(y)(x());if(C)w(k());else if(T){var $=P==null?void 0:P.fulfilledTimeStamp;if(!$){w(k());return}var O=(Number(new Date)-Number(new Date($)))/1e3>=T;O&&w(k())}else w(k(!1))}};function b(g){return function(y){var S,w;return((w=(S=y==null?void 0:y.meta)==null?void 0:S.arg)==null?void 0:w.endpointName)===g}}function v(g,y){return{matchPending:oh(NS(g),b(y)),matchFulfilled:oh(bc(g),b(y)),matchRejected:oh(jh(g),b(y))}}return{queryThunk:f,mutationThunk:h,prefetch:_,updateQueryData:l,upsertQueryData:u,patchQueryData:s,buildMatchThunkActions:v}}function uj(e,t,n,r){return lj(n[e.meta.arg.endpointName][t],bc(e)?e.payload:void 0,Z0(e)?e.payload:void 0,e.meta.arg.originalArgs,"baseQueryMeta"in e.meta?e.meta.baseQueryMeta:void 0,r)}function xv(e,t,n){var r=e[t];r&&n(r)}function i0(e){var t;return(t="arg"in e?e.arg.fixedCacheKey:e.fixedCacheKey)!=null?t:e.requestId}function xR(e,t,n){var r=e[i0(t)];r&&n(r)}var qp={};function pge(e){var t=e.reducerPath,n=e.queryThunk,r=e.mutationThunk,i=e.context,o=i.endpointDefinitions,a=i.apiUid,s=i.extractRehydrationInfo,l=i.hasRehydrationInfo,u=e.assertTagType,c=e.config,d=Ne(t+"/resetApiState"),f=nr({name:t+"/queries",initialState:qp,reducers:{removeQueryResult:{reducer:function(S,w){var x=w.payload.queryCacheKey;delete S[x]},prepare:R1()},queryResultPatched:function(S,w){var x=w.payload,C=x.queryCacheKey,T=x.patches;xv(S,C,function(k){k.data=F3(k.data,T.concat())})}},extraReducers:function(S){S.addCase(n.pending,function(w,x){var C=x.meta,T=x.meta.arg,k,P,$=yE(T);(T.subscribe||$)&&((P=w[k=T.queryCacheKey])!=null||(w[k]={status:er.uninitialized,endpointName:T.endpointName})),xv(w,T.queryCacheKey,function(O){O.status=er.pending,O.requestId=$&&O.requestId?O.requestId:C.requestId,T.originalArgs!==void 0&&(O.originalArgs=T.originalArgs),O.startedTimeStamp=C.startedTimeStamp})}).addCase(n.fulfilled,function(w,x){var C=x.meta,T=x.payload;xv(w,C.arg.queryCacheKey,function(k){var P;if(!(k.requestId!==C.requestId&&!yE(C.arg))){var $=o[C.arg.endpointName].merge;if(k.status=er.fulfilled,$)if(k.data!==void 0){var O=C.fulfilledTimeStamp,E=C.arg,A=C.baseQueryMeta,D=C.requestId,L=vc(k.data,function(M){return $(M,T,{arg:E.originalArgs,baseQueryMeta:A,fulfilledTimeStamp:O,requestId:D})});k.data=L}else k.data=T;else k.data=(P=o[C.arg.endpointName].structuralSharing)==null||P?ij(io(k.data)?Fk(k.data):k.data,T):T;delete k.error,k.fulfilledTimeStamp=C.fulfilledTimeStamp}})}).addCase(n.rejected,function(w,x){var C=x.meta,T=C.condition,k=C.arg,P=C.requestId,$=x.error,O=x.payload;xv(w,k.queryCacheKey,function(E){if(!T){if(E.requestId!==P)return;E.status=er.rejected,E.error=O??$}})}).addMatcher(l,function(w,x){for(var C=s(x).queries,T=0,k=Object.entries(C);T"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?Fge:Lge;pj.useSyncExternalStore=Zh.useSyncExternalStore!==void 0?Zh.useSyncExternalStore:Bge;hj.exports=pj;var zge=hj.exports,gj={exports:{}},mj={};/** + */var Yh=I;function Ige(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Rge=typeof Object.is=="function"?Object.is:Ige,Oge=Yh.useState,Mge=Yh.useEffect,Nge=Yh.useLayoutEffect,$ge=Yh.useDebugValue;function Dge(e,t){var n=t(),r=Oge({inst:{value:n,getSnapshot:t}}),i=r[0].inst,o=r[1];return Nge(function(){i.value=n,i.getSnapshot=t,TC(i)&&o({inst:i})},[e,n,t]),Mge(function(){return TC(i)&&o({inst:i}),e(function(){TC(i)&&o({inst:i})})},[e]),$ge(n),n}function TC(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Rge(e,n)}catch{return!0}}function Lge(e,t){return t()}var Fge=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?Lge:Dge;fj.useSyncExternalStore=Yh.useSyncExternalStore!==void 0?Yh.useSyncExternalStore:Fge;dj.exports=fj;var Bge=dj.exports,hj={exports:{}},pj={};/** * @license React * use-sync-external-store-shim/with-selector.production.min.js * @@ -94,14 +94,14 @@ ${M}`),A.pop(),`{${U}}`}case"number":return isFinite(E)?String(E):v?v(E):"null"; * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var S2=I,jge=zge;function Uge(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Vge=typeof Object.is=="function"?Object.is:Uge,Gge=jge.useSyncExternalStore,Hge=S2.useRef,qge=S2.useEffect,Wge=S2.useMemo,Kge=S2.useDebugValue;mj.useSyncExternalStoreWithSelector=function(e,t,n,r,i){var o=Hge(null);if(o.current===null){var a={hasValue:!1,value:null};o.current=a}else a=o.current;o=Wge(function(){function l(h){if(!u){if(u=!0,c=h,h=r(h),i!==void 0&&a.hasValue){var p=a.value;if(i(p,h))return d=p}return d=h}if(p=d,Vge(c,h))return p;var m=r(h);return i!==void 0&&i(p,m)?p:(c=h,d=m)}var u=!1,c,d,f=n===void 0?null:n;return[function(){return l(t())},f===null?void 0:function(){return l(f())}]},[t,n,r,i]);var s=Gge(e,o[0],o[1]);return qge(function(){a.hasValue=!0,a.value=s},[s]),Kge(s),s};gj.exports=mj;var yj=gj.exports;const Qge=pc(yj);function Xge(e){e()}let vj=Xge;const Yge=e=>vj=e,Zge=()=>vj,IR=Symbol.for("react-redux-context"),RR=typeof globalThis<"u"?globalThis:{};function Jge(){var e;if(!I.createContext)return{};const t=(e=RR[IR])!=null?e:RR[IR]=new Map;let n=t.get(I.createContext);return n||(n=I.createContext(null),t.set(I.createContext,n)),n}const ac=Jge();function OT(e=ac){return function(){return I.useContext(e)}}const bj=OT(),eme=()=>{throw new Error("uSES not initialized!")};let _j=eme;const tme=e=>{_j=e},nme=(e,t)=>e===t;function rme(e=ac){const t=e===ac?bj:OT(e);return function(r,i={}){const{equalityFn:o=nme,stabilityCheck:a=void 0,noopCheck:s=void 0}=typeof i=="function"?{equalityFn:i}:i,{store:l,subscription:u,getServerState:c,stabilityCheck:d,noopCheck:f}=t();I.useRef(!0);const h=I.useCallback({[r.name](m){return r(m)}}[r.name],[r,d,a]),p=_j(u.addNestedSub,l.getState,c||l.getState,h,o);return I.useDebugValue(p),p}}const Sj=rme();function __(){return __=Object.assign?Object.assign.bind():function(e){for(var t=1;tmj=e,Yge=()=>mj,PR=Symbol.for("react-redux-context"),IR=typeof globalThis<"u"?globalThis:{};function Zge(){var e;if(!I.createContext)return{};const t=(e=IR[PR])!=null?e:IR[PR]=new Map;let n=t.get(I.createContext);return n||(n=I.createContext(null),t.set(I.createContext,n)),n}const ac=Zge();function RT(e=ac){return function(){return I.useContext(e)}}const yj=RT(),Jge=()=>{throw new Error("uSES not initialized!")};let vj=Jge;const eme=e=>{vj=e},tme=(e,t)=>e===t;function nme(e=ac){const t=e===ac?yj:RT(e);return function(r,i={}){const{equalityFn:o=tme,stabilityCheck:a=void 0,noopCheck:s=void 0}=typeof i=="function"?{equalityFn:i}:i,{store:l,subscription:u,getServerState:c,stabilityCheck:d,noopCheck:f}=t();I.useRef(!0);const h=I.useCallback({[r.name](m){return r(m)}}[r.name],[r,d,a]),p=vj(u.addNestedSub,l.getState,c||l.getState,h,o);return I.useDebugValue(p),p}}const bj=nme();function __(){return __=Object.assign?Object.assign.bind():function(e){for(var t=1;t{let r=t;for(;r;)r.callback(),r=r.next})},get(){let r=[],i=t;for(;i;)r.push(i),i=i.next;return r},subscribe(r){let i=!0,o=n={callback:r,next:null,prev:n};return o.prev?o.prev.next=o:t=o,function(){!i||t===null||(i=!1,o.next?o.next.prev=o.prev:n=o.prev,o.prev?o.prev.next=o.next:t=o.next)}}}}const OR={notify(){},get:()=>[]};function gme(e,t){let n,r=OR;function i(d){return l(),r.subscribe(d)}function o(){r.notify()}function a(){c.onStateChange&&c.onStateChange()}function s(){return!!n}function l(){n||(n=t?t.addNestedSub(a):e.subscribe(a),r=pme())}function u(){n&&(n(),n=void 0,r.clear(),r=OR)}const c={addNestedSub:i,notifyNestedSubs:o,handleChangeWrapper:a,isSubscribed:s,trySubscribe:l,tryUnsubscribe:u,getListeners:()=>r};return c}const mme=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",yme=mme?I.useLayoutEffect:I.useEffect;function MR(e,t){return e===t?e!==0||t!==0||1/e===1/t:e!==e&&t!==t}function S_(e,t){if(MR(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let i=0;i{const u=gme(e);return{store:e,subscription:u,getServerState:r?()=>r:void 0,stabilityCheck:i,noopCheck:o}},[e,r,i,o]),s=I.useMemo(()=>e.getState(),[e]);yme(()=>{const{subscription:u}=a;return u.onStateChange=u.notifyNestedSubs,u.trySubscribe(),s!==e.getState()&&u.notifyNestedSubs(),()=>{u.tryUnsubscribe(),u.onStateChange=void 0}},[a,s]);const l=t||ac;return I.createElement(l.Provider,{value:a},n)}function Tj(e=ac){const t=e===ac?bj:OT(e);return function(){const{store:r}=t();return r}}const Aj=Tj();function bme(e=ac){const t=e===ac?Aj:Tj(e);return function(){return t().dispatch}}const Pj=bme();tme(yj.useSyncExternalStoreWithSelector);Yge(Uo.unstable_batchedUpdates);var _me=globalThis&&globalThis.__spreadArray||function(e,t){for(var n=0,r=t.length,i=e.length;nFme({headers:{...e?{Authorization:`Bearer ${e}`}:{},...n?{"project-id":n}:{}},baseUrl:`${t??""}`}));const Vme=["Board","BoardImagesTotal","BoardAssetsTotal","Image","ImageNameList","ImageList","ImageMetadata","ImageMetadataFromFile","Model","SessionQueueItem","SessionQueueItemDTO","SessionQueueItemDTOList","SessionQueueStatus","SessionProcessorStatus","BatchStatus","InvocationCacheStatus"],Dt="LIST",Gme=async(e,t,n)=>{const r=o0.get(),i=Jh.get(),o=a0.get();return cge({baseUrl:`${r??""}/api/v1`,prepareHeaders:s=>(i&&s.set("Authorization",`Bearer ${i}`),o&&s.set("project-id",o),s)})(e,t,n)},ls=$me({baseQuery:Gme,reducerPath:"api",tagTypes:Vme,endpoints:()=>({})}),Hme=(e,t)=>{const n=new Date(e),r=new Date(t);return n>r?1:ne==null,Yme=e=>encodeURIComponent(e).replace(/[!'()*]/g,t=>`%${t.charCodeAt(0).toString(16).toUpperCase()}`),bE=Symbol("encodeFragmentIdentifier");function Zme(e){switch(e.arrayFormat){case"index":return t=>(n,r)=>{const i=n.length;return r===void 0||e.skipNull&&r===null||e.skipEmptyString&&r===""?n:r===null?[...n,[Mr(t,e),"[",i,"]"].join("")]:[...n,[Mr(t,e),"[",Mr(i,e),"]=",Mr(r,e)].join("")]};case"bracket":return t=>(n,r)=>r===void 0||e.skipNull&&r===null||e.skipEmptyString&&r===""?n:r===null?[...n,[Mr(t,e),"[]"].join("")]:[...n,[Mr(t,e),"[]=",Mr(r,e)].join("")];case"colon-list-separator":return t=>(n,r)=>r===void 0||e.skipNull&&r===null||e.skipEmptyString&&r===""?n:r===null?[...n,[Mr(t,e),":list="].join("")]:[...n,[Mr(t,e),":list=",Mr(r,e)].join("")];case"comma":case"separator":case"bracket-separator":{const t=e.arrayFormat==="bracket-separator"?"[]=":"=";return n=>(r,i)=>i===void 0||e.skipNull&&i===null||e.skipEmptyString&&i===""?r:(i=i===null?"":i,r.length===0?[[Mr(n,e),t,Mr(i,e)].join("")]:[[r,Mr(i,e)].join(e.arrayFormatSeparator)])}default:return t=>(n,r)=>r===void 0||e.skipNull&&r===null||e.skipEmptyString&&r===""?n:r===null?[...n,Mr(t,e)]:[...n,[Mr(t,e),"=",Mr(r,e)].join("")]}}function Jme(e){let t;switch(e.arrayFormat){case"index":return(n,r,i)=>{if(t=/\[(\d*)]$/.exec(n),n=n.replace(/\[\d*]$/,""),!t){i[n]=r;return}i[n]===void 0&&(i[n]={}),i[n][t[1]]=r};case"bracket":return(n,r,i)=>{if(t=/(\[])$/.exec(n),n=n.replace(/\[]$/,""),!t){i[n]=r;return}if(i[n]===void 0){i[n]=[r];return}i[n]=[...i[n],r]};case"colon-list-separator":return(n,r,i)=>{if(t=/(:list)$/.exec(n),n=n.replace(/:list$/,""),!t){i[n]=r;return}if(i[n]===void 0){i[n]=[r];return}i[n]=[...i[n],r]};case"comma":case"separator":return(n,r,i)=>{const o=typeof r=="string"&&r.includes(e.arrayFormatSeparator),a=typeof r=="string"&&!o&&Sl(r,e).includes(e.arrayFormatSeparator);r=a?Sl(r,e):r;const s=o||a?r.split(e.arrayFormatSeparator).map(l=>Sl(l,e)):r===null?r:Sl(r,e);i[n]=s};case"bracket-separator":return(n,r,i)=>{const o=/(\[])$/.test(n);if(n=n.replace(/\[]$/,""),!o){i[n]=r&&Sl(r,e);return}const a=r===null?[]:r.split(e.arrayFormatSeparator).map(s=>Sl(s,e));if(i[n]===void 0){i[n]=a;return}i[n]=[...i[n],...a]};default:return(n,r,i)=>{if(i[n]===void 0){i[n]=r;return}i[n]=[...[i[n]].flat(),r]}}}function Oj(e){if(typeof e!="string"||e.length!==1)throw new TypeError("arrayFormatSeparator must be single character string")}function Mr(e,t){return t.encode?t.strict?Yme(e):encodeURIComponent(e):e}function Sl(e,t){return t.decode?Kme(e):e}function Mj(e){return Array.isArray(e)?e.sort():typeof e=="object"?Mj(Object.keys(e)).sort((t,n)=>Number(t)-Number(n)).map(t=>e[t]):e}function Nj(e){const t=e.indexOf("#");return t!==-1&&(e=e.slice(0,t)),e}function e0e(e){let t="";const n=e.indexOf("#");return n!==-1&&(t=e.slice(n)),t}function BR(e,t){return t.parseNumbers&&!Number.isNaN(Number(e))&&typeof e=="string"&&e.trim()!==""?e=Number(e):t.parseBooleans&&e!==null&&(e.toLowerCase()==="true"||e.toLowerCase()==="false")&&(e=e.toLowerCase()==="true"),e}function FT(e){e=Nj(e);const t=e.indexOf("?");return t===-1?"":e.slice(t+1)}function BT(e,t){t={decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1,...t},Oj(t.arrayFormatSeparator);const n=Jme(t),r=Object.create(null);if(typeof e!="string"||(e=e.trim().replace(/^[?#&]/,""),!e))return r;for(const i of e.split("&")){if(i==="")continue;const o=t.decode?i.replace(/\+/g," "):i;let[a,s]=Rj(o,"=");a===void 0&&(a=o),s=s===void 0?null:["comma","separator","bracket-separator"].includes(t.arrayFormat)?s:Sl(s,t),n(Sl(a,t),s,r)}for(const[i,o]of Object.entries(r))if(typeof o=="object"&&o!==null)for(const[a,s]of Object.entries(o))o[a]=BR(s,t);else r[i]=BR(o,t);return t.sort===!1?r:(t.sort===!0?Object.keys(r).sort():Object.keys(r).sort(t.sort)).reduce((i,o)=>{const a=r[o];return a&&typeof a=="object"&&!Array.isArray(a)?i[o]=Mj(a):i[o]=a,i},Object.create(null))}function $j(e,t){if(!e)return"";t={encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:",",...t},Oj(t.arrayFormatSeparator);const n=a=>t.skipNull&&Xme(e[a])||t.skipEmptyString&&e[a]==="",r=Zme(t),i={};for(const[a,s]of Object.entries(e))n(a)||(i[a]=s);const o=Object.keys(i);return t.sort!==!1&&o.sort(t.sort),o.map(a=>{const s=e[a];return s===void 0?"":s===null?Mr(a,t):Array.isArray(s)?s.length===0&&t.arrayFormat==="bracket-separator"?Mr(a,t)+"[]":s.reduce(r(a),[]).join("&"):Mr(a,t)+"="+Mr(s,t)}).filter(a=>a.length>0).join("&")}function Dj(e,t){var i;t={decode:!0,...t};let[n,r]=Rj(e,"#");return n===void 0&&(n=e),{url:((i=n==null?void 0:n.split("?"))==null?void 0:i[0])??"",query:BT(FT(e),t),...t&&t.parseFragmentIdentifier&&r?{fragmentIdentifier:Sl(r,t)}:{}}}function Lj(e,t){t={encode:!0,strict:!0,[bE]:!0,...t};const n=Nj(e.url).split("?")[0]||"",r=FT(e.url),i={...BT(r,{sort:!1}),...e.query};let o=$j(i,t);o&&(o=`?${o}`);let a=e0e(e.url);if(e.fragmentIdentifier){const s=new URL(n);s.hash=e.fragmentIdentifier,a=t[bE]?s.hash:`#${e.fragmentIdentifier}`}return`${n}${o}${a}`}function Fj(e,t,n){n={parseFragmentIdentifier:!0,[bE]:!1,...n};const{url:r,query:i,fragmentIdentifier:o}=Dj(e,n);return Lj({url:r,query:Qme(i,t),fragmentIdentifier:o},n)}function t0e(e,t,n){const r=Array.isArray(t)?i=>!t.includes(i):(i,o)=>!t(i,o);return Fj(e,r,n)}const Kg=Object.freeze(Object.defineProperty({__proto__:null,exclude:t0e,extract:FT,parse:BT,parseUrl:Dj,pick:Fj,stringify:$j,stringifyUrl:Lj},Symbol.toStringTag,{value:"Module"})),Ic=(e,t)=>{if(!e)return!1;const n=s0.selectAll(e);if(n.length<=1)return!0;const r=[],i=[];for(let o=0;o=s}else{const o=i[i.length-1];if(!o)return!1;const a=new Date(t.created_at),s=new Date(o.created_at);return a>=s}},aa=e=>ii.includes(e.image_category)?ii:Mu,Vn=Js({selectId:e=>e.image_name,sortComparer:(e,t)=>e.starred&&!t.starred?-1:!e.starred&&t.starred?1:Hme(t.created_at,e.created_at)}),s0=Vn.getSelectors(),Bo=e=>`images/?${Kg.stringify(e,{arrayFormat:"none"})}`,xi=ls.injectEndpoints({endpoints:e=>({listBoards:e.query({query:t=>({url:"boards/",params:t}),providesTags:t=>{const n=[{type:"Board",id:Dt}];return t&&n.push(...t.items.map(({board_id:r})=>({type:"Board",id:r}))),n}}),listAllBoards:e.query({query:()=>({url:"boards/",params:{all:!0}}),providesTags:t=>{const n=[{type:"Board",id:Dt}];return t&&n.push(...t.map(({board_id:r})=>({type:"Board",id:r}))),n}}),listAllImageNamesForBoard:e.query({query:t=>({url:`boards/${t}/image_names`}),providesTags:(t,n,r)=>[{type:"ImageNameList",id:r}],keepUnusedDataFor:0}),getBoardImagesTotal:e.query({query:t=>({url:Bo({board_id:t??"none",categories:ii,is_intermediate:!1,limit:0,offset:0}),method:"GET"}),providesTags:(t,n,r)=>[{type:"BoardImagesTotal",id:r??"none"}],transformResponse:t=>t.total}),getBoardAssetsTotal:e.query({query:t=>({url:Bo({board_id:t??"none",categories:Mu,is_intermediate:!1,limit:0,offset:0}),method:"GET"}),providesTags:(t,n,r)=>[{type:"BoardAssetsTotal",id:r??"none"}],transformResponse:t=>t.total}),createBoard:e.mutation({query:t=>({url:"boards/",method:"POST",params:{board_name:t}}),invalidatesTags:[{type:"Board",id:Dt}]}),updateBoard:e.mutation({query:({board_id:t,changes:n})=>({url:`boards/${t}`,method:"PATCH",body:n}),invalidatesTags:(t,n,r)=>[{type:"Board",id:r.board_id}]})})}),{useListBoardsQuery:mGe,useListAllBoardsQuery:yGe,useGetBoardImagesTotalQuery:vGe,useGetBoardAssetsTotalQuery:bGe,useCreateBoardMutation:_Ge,useUpdateBoardMutation:SGe,useListAllImageNamesForBoardQuery:xGe}=xi,me=ls.injectEndpoints({endpoints:e=>({listImages:e.query({query:t=>({url:Bo(t),method:"GET"}),providesTags:(t,n,{board_id:r,categories:i})=>[{type:"ImageList",id:Bo({board_id:r,categories:i})}],serializeQueryArgs:({queryArgs:t})=>{const{board_id:n,categories:r}=t;return Bo({board_id:n,categories:r})},transformResponse(t){const{items:n}=t;return Vn.addMany(Vn.getInitialState(),n)},merge:(t,n)=>{Vn.addMany(t,s0.selectAll(n))},forceRefetch({currentArg:t,previousArg:n}){return(t==null?void 0:t.offset)!==(n==null?void 0:n.offset)},async onQueryStarted(t,{dispatch:n,queryFulfilled:r}){try{const{data:i}=await r;s0.selectAll(i).forEach(o=>{n(me.util.upsertQueryData("getImageDTO",o.image_name,o))})}catch{}},keepUnusedDataFor:86400}),getIntermediatesCount:e.query({query:()=>({url:Bo({is_intermediate:!0})}),providesTags:["IntermediatesCount"],transformResponse:t=>t.total}),getImageDTO:e.query({query:t=>({url:`images/i/${t}`}),providesTags:(t,n,r)=>[{type:"Image",id:r}],keepUnusedDataFor:86400}),getImageMetadata:e.query({query:t=>({url:`images/i/${t}/metadata`}),providesTags:(t,n,r)=>[{type:"ImageMetadata",id:r}],keepUnusedDataFor:86400}),getImageMetadataFromFile:e.query({queryFn:async(t,n,r,i)=>{var o;if(t.shouldFetchMetadataFromApi){let a;const s=await i(`images/i/${t.image.image_name}/metadata`);if(s.data){const l=zB.safeParse((o=s.data)==null?void 0:o.metadata);l.success&&(a=l.data)}return{data:{metadata:a}}}else{const a=Jh.get(),s=a0.get(),u=await yle.fetchBaseQuery({baseUrl:"",prepareHeaders:d=>(a&&d.set("Authorization",`Bearer ${a}`),s&&d.set("project-id",s),d),responseHandler:async d=>await d.blob()})(t.image.image_url,n,r);return{data:await Ype(u.data)}}},providesTags:(t,n,{image:r})=>[{type:"ImageMetadataFromFile",id:r.image_name}],keepUnusedDataFor:86400}),clearIntermediates:e.mutation({query:()=>({url:"images/clear-intermediates",method:"POST"}),invalidatesTags:["IntermediatesCount"]}),deleteImage:e.mutation({query:({image_name:t})=>({url:`images/i/${t}`,method:"DELETE"}),invalidatesTags:(t,n,{board_id:r})=>[{type:"BoardImagesTotal",id:r??"none"},{type:"BoardAssetsTotal",id:r??"none"}],async onQueryStarted(t,{dispatch:n,queryFulfilled:r}){const{image_name:i,board_id:o}=t,a={board_id:o??"none",categories:aa(t)},s=n(me.util.updateQueryData("listImages",a,l=>{Vn.removeOne(l,i)}));try{await r}catch{s.undo()}}}),deleteImages:e.mutation({query:({imageDTOs:t})=>({url:"images/delete",method:"POST",body:{image_names:t.map(r=>r.image_name)}}),invalidatesTags:(t,n,{imageDTOs:r})=>{var o;const i=(o=r[0])==null?void 0:o.board_id;return[{type:"BoardImagesTotal",id:i??"none"},{type:"BoardAssetsTotal",id:i??"none"}]},async onQueryStarted({imageDTOs:t},{dispatch:n,queryFulfilled:r}){try{const{data:i}=await r,o=fT(t,"image_name");i.deleted_images.forEach(a=>{const s=o[a];if(s){const l={board_id:s.board_id??"none",categories:aa(s)};n(me.util.updateQueryData("listImages",l,u=>{Vn.removeOne(u,a)}))}})}catch{}}}),changeImageIsIntermediate:e.mutation({query:({imageDTO:t,is_intermediate:n})=>({url:`images/i/${t.image_name}`,method:"PATCH",body:{is_intermediate:n}}),invalidatesTags:(t,n,{imageDTO:r})=>[{type:"BoardImagesTotal",id:r.board_id??"none"},{type:"BoardAssetsTotal",id:r.board_id??"none"}],async onQueryStarted({imageDTO:t,is_intermediate:n},{dispatch:r,queryFulfilled:i,getState:o}){const a=[];a.push(r(me.util.updateQueryData("getImageDTO",t.image_name,l=>{Object.assign(l,{is_intermediate:n})})));const s=aa(t);if(n)a.push(r(me.util.updateQueryData("listImages",{board_id:t.board_id??"none",categories:s},l=>{Vn.removeOne(l,t.image_name)})));else{const l={board_id:t.board_id??"none",categories:s},u=me.endpoints.listImages.select(l)(o()),{data:c}=ii.includes(t.image_category)?xi.endpoints.getBoardImagesTotal.select(t.board_id??"none")(o()):xi.endpoints.getBoardAssetsTotal.select(t.board_id??"none")(o()),d=u.data&&u.data.ids.length>=(c??0),f=Ic(u.data,t);(d||f)&&a.push(r(me.util.updateQueryData("listImages",l,h=>{Vn.upsertOne(h,t)})))}try{await i}catch{a.forEach(l=>l.undo())}}}),changeImageSessionId:e.mutation({query:({imageDTO:t,session_id:n})=>({url:`images/i/${t.image_name}`,method:"PATCH",body:{session_id:n}}),invalidatesTags:(t,n,{imageDTO:r})=>[{type:"BoardImagesTotal",id:r.board_id??"none"},{type:"BoardAssetsTotal",id:r.board_id??"none"}],async onQueryStarted({imageDTO:t,session_id:n},{dispatch:r,queryFulfilled:i}){const o=[];o.push(r(me.util.updateQueryData("getImageDTO",t.image_name,a=>{Object.assign(a,{session_id:n})})));try{await i}catch{o.forEach(a=>a.undo())}}}),starImages:e.mutation({query:({imageDTOs:t})=>({url:"images/star",method:"POST",body:{image_names:t.map(n=>n.image_name)}}),invalidatesTags:(t,n,{imageDTOs:r})=>{if(r[0]){const i=aa(r[0]),o=r[0].board_id;return[{type:"ImageList",id:Bo({board_id:o,categories:i})},{type:"Board",id:o}]}return[]},async onQueryStarted({imageDTOs:t},{dispatch:n,queryFulfilled:r,getState:i}){try{const{data:o}=await r,a=t.filter(u=>o.updated_image_names.includes(u.image_name));if(!a[0])return;const s=aa(a[0]),l=a[0].board_id;a.forEach(u=>{const{image_name:c}=u;n(me.util.updateQueryData("getImageDTO",c,_=>{_.starred=!0}));const d={board_id:l??"none",categories:s},f=me.endpoints.listImages.select(d)(i()),{data:h}=ii.includes(u.image_category)?xi.endpoints.getBoardImagesTotal.select(l??"none")(i()):xi.endpoints.getBoardAssetsTotal.select(l??"none")(i()),p=f.data&&f.data.ids.length>=(h??0),m=(h||0)>=fv?Ic(f.data,u):!0;(p||m)&&n(me.util.updateQueryData("listImages",d,_=>{Vn.upsertOne(_,{...u,starred:!0})}))})}catch{}}}),unstarImages:e.mutation({query:({imageDTOs:t})=>({url:"images/unstar",method:"POST",body:{image_names:t.map(n=>n.image_name)}}),invalidatesTags:(t,n,{imageDTOs:r})=>{if(r[0]){const i=aa(r[0]),o=r[0].board_id;return[{type:"ImageList",id:Bo({board_id:o,categories:i})},{type:"Board",id:o}]}return[]},async onQueryStarted({imageDTOs:t},{dispatch:n,queryFulfilled:r,getState:i}){try{const{data:o}=await r,a=t.filter(u=>o.updated_image_names.includes(u.image_name));if(!a[0])return;const s=aa(a[0]),l=a[0].board_id;a.forEach(u=>{const{image_name:c}=u;n(me.util.updateQueryData("getImageDTO",c,_=>{_.starred=!1}));const d={board_id:l??"none",categories:s},f=me.endpoints.listImages.select(d)(i()),{data:h}=ii.includes(u.image_category)?xi.endpoints.getBoardImagesTotal.select(l??"none")(i()):xi.endpoints.getBoardAssetsTotal.select(l??"none")(i()),p=f.data&&f.data.ids.length>=(h??0),m=(h||0)>=fv?Ic(f.data,u):!0;(p||m)&&n(me.util.updateQueryData("listImages",d,_=>{Vn.upsertOne(_,{...u,starred:!1})}))})}catch{}}}),uploadImage:e.mutation({query:({file:t,image_category:n,is_intermediate:r,session_id:i,board_id:o,crop_visible:a})=>{const s=new FormData;return s.append("file",t),{url:"images/upload",method:"POST",body:s,params:{image_category:n,is_intermediate:r,session_id:i,board_id:o==="none"?void 0:o,crop_visible:a}}},async onQueryStarted(t,{dispatch:n,queryFulfilled:r}){try{const{data:i}=await r;if(i.is_intermediate)return;n(me.util.upsertQueryData("getImageDTO",i.image_name,i));const o=aa(i);n(me.util.updateQueryData("listImages",{board_id:i.board_id??"none",categories:o},a=>{Vn.addOne(a,i)})),n(me.util.invalidateTags([{type:"BoardImagesTotal",id:i.board_id??"none"},{type:"BoardAssetsTotal",id:i.board_id??"none"}]))}catch{}}}),deleteBoard:e.mutation({query:t=>({url:`boards/${t}`,method:"DELETE"}),invalidatesTags:()=>[{type:"Board",id:Dt},{type:"ImageList",id:Bo({board_id:"none",categories:ii})},{type:"ImageList",id:Bo({board_id:"none",categories:Mu})},{type:"BoardImagesTotal",id:"none"},{type:"BoardAssetsTotal",id:"none"}],async onQueryStarted(t,{dispatch:n,queryFulfilled:r}){try{const{data:i}=await r,{deleted_board_images:o}=i;o.forEach(l=>{n(me.util.updateQueryData("getImageDTO",l,u=>{u.board_id=void 0}))});const a=[{categories:ii},{categories:Mu}],s=o.map(l=>({id:l,changes:{board_id:void 0}}));a.forEach(l=>{n(me.util.updateQueryData("listImages",l,u=>{Vn.updateMany(u,s)}))})}catch{}}}),deleteBoardAndImages:e.mutation({query:t=>({url:`boards/${t}`,method:"DELETE",params:{include_images:!0}}),invalidatesTags:()=>[{type:"Board",id:Dt},{type:"ImageList",id:Bo({board_id:"none",categories:ii})},{type:"ImageList",id:Bo({board_id:"none",categories:Mu})},{type:"BoardImagesTotal",id:"none"},{type:"BoardAssetsTotal",id:"none"}],async onQueryStarted(t,{dispatch:n,queryFulfilled:r}){try{const{data:i}=await r,{deleted_images:o}=i;[{categories:ii},{categories:Mu}].forEach(s=>{n(me.util.updateQueryData("listImages",s,l=>{Vn.removeMany(l,o)}))})}catch{}}}),addImageToBoard:e.mutation({query:({board_id:t,imageDTO:n})=>{const{image_name:r}=n;return{url:"board_images/",method:"POST",body:{board_id:t,image_name:r}}},invalidatesTags:(t,n,{board_id:r,imageDTO:i})=>[{type:"Board",id:r},{type:"BoardImagesTotal",id:r},{type:"BoardAssetsTotal",id:r},{type:"BoardImagesTotal",id:i.board_id??"none"},{type:"BoardAssetsTotal",id:i.board_id??"none"}],async onQueryStarted({board_id:t,imageDTO:n},{dispatch:r,queryFulfilled:i,getState:o}){const a=[],s=aa(n);if(a.push(r(me.util.updateQueryData("getImageDTO",n.image_name,l=>{l.board_id=t}))),!n.is_intermediate){a.push(r(me.util.updateQueryData("listImages",{board_id:n.board_id??"none",categories:s},h=>{Vn.removeOne(h,n.image_name)})));const l={board_id:t??"none",categories:s},u=me.endpoints.listImages.select(l)(o()),{data:c}=ii.includes(n.image_category)?xi.endpoints.getBoardImagesTotal.select(n.board_id??"none")(o()):xi.endpoints.getBoardAssetsTotal.select(n.board_id??"none")(o()),d=u.data&&u.data.ids.length>=(c??0),f=Ic(u.data,n);(d||f)&&a.push(r(me.util.updateQueryData("listImages",l,h=>{Vn.addOne(h,n)})))}try{await i}catch{a.forEach(l=>l.undo())}}}),removeImageFromBoard:e.mutation({query:({imageDTO:t})=>{const{image_name:n}=t;return{url:"board_images/",method:"DELETE",body:{image_name:n}}},invalidatesTags:(t,n,{imageDTO:r})=>{const{board_id:i}=r;return[{type:"Board",id:i??"none"},{type:"BoardImagesTotal",id:i??"none"},{type:"BoardAssetsTotal",id:i??"none"},{type:"BoardImagesTotal",id:"none"},{type:"BoardAssetsTotal",id:"none"}]},async onQueryStarted({imageDTO:t},{dispatch:n,queryFulfilled:r,getState:i}){const o=aa(t),a=[];a.push(n(me.util.updateQueryData("getImageDTO",t.image_name,f=>{f.board_id=void 0}))),a.push(n(me.util.updateQueryData("listImages",{board_id:t.board_id??"none",categories:o},f=>{Vn.removeOne(f,t.image_name)})));const s={board_id:"none",categories:o},l=me.endpoints.listImages.select(s)(i()),{data:u}=ii.includes(t.image_category)?xi.endpoints.getBoardImagesTotal.select(t.board_id??"none")(i()):xi.endpoints.getBoardAssetsTotal.select(t.board_id??"none")(i()),c=l.data&&l.data.ids.length>=(u??0),d=Ic(l.data,t);(c||d)&&a.push(n(me.util.updateQueryData("listImages",s,f=>{Vn.upsertOne(f,t)})));try{await r}catch{a.forEach(f=>f.undo())}}}),addImagesToBoard:e.mutation({query:({board_id:t,imageDTOs:n})=>({url:"board_images/batch",method:"POST",body:{image_names:n.map(r=>r.image_name),board_id:t}}),invalidatesTags:(t,n,{imageDTOs:r,board_id:i})=>{var a;const o=(a=r[0])==null?void 0:a.board_id;return[{type:"Board",id:i??"none"},{type:"BoardImagesTotal",id:i??"none"},{type:"BoardAssetsTotal",id:i??"none"},{type:"BoardImagesTotal",id:o??"none"},{type:"BoardAssetsTotal",id:o??"none"},{type:"BoardImagesTotal",id:"none"},{type:"BoardAssetsTotal",id:"none"}]},async onQueryStarted({board_id:t,imageDTOs:n},{dispatch:r,queryFulfilled:i,getState:o}){try{const{data:a}=await i,{added_image_names:s}=a;s.forEach(l=>{r(me.util.updateQueryData("getImageDTO",l,b=>{b.board_id=t}));const u=n.find(b=>b.image_name===l);if(!u)return;const c=aa(u),d=u.board_id;r(me.util.updateQueryData("listImages",{board_id:d??"none",categories:c},b=>{Vn.removeOne(b,u.image_name)}));const f={board_id:t,categories:c},h=me.endpoints.listImages.select(f)(o()),{data:p}=ii.includes(u.image_category)?xi.endpoints.getBoardImagesTotal.select(t??"none")(o()):xi.endpoints.getBoardAssetsTotal.select(t??"none")(o()),m=h.data&&h.data.ids.length>=(p??0),_=(p||0)>=fv?Ic(h.data,u):!0;(m||_)&&r(me.util.updateQueryData("listImages",f,b=>{Vn.upsertOne(b,{...u,board_id:t})}))})}catch{}}}),removeImagesFromBoard:e.mutation({query:({imageDTOs:t})=>({url:"board_images/batch/delete",method:"POST",body:{image_names:t.map(n=>n.image_name)}}),invalidatesTags:(t,n,{imageDTOs:r})=>{const i=[],o=[{type:"BoardImagesTotal",id:"none"},{type:"BoardAssetsTotal",id:"none"}];return t==null||t.removed_image_names.forEach(a=>{var l;const s=(l=r.find(u=>u.image_name===a))==null?void 0:l.board_id;!s||i.includes(s)||(o.push({type:"Board",id:s}),o.push({type:"BoardImagesTotal",id:s}),o.push({type:"BoardAssetsTotal",id:s}))}),o},async onQueryStarted({imageDTOs:t},{dispatch:n,queryFulfilled:r,getState:i}){try{const{data:o}=await r,{removed_image_names:a}=o;a.forEach(s=>{n(me.util.updateQueryData("getImageDTO",s,m=>{m.board_id=void 0}));const l=t.find(m=>m.image_name===s);if(!l)return;const u=aa(l);n(me.util.updateQueryData("listImages",{board_id:l.board_id??"none",categories:u},m=>{Vn.removeOne(m,l.image_name)}));const c={board_id:"none",categories:u},d=me.endpoints.listImages.select(c)(i()),{data:f}=ii.includes(l.image_category)?xi.endpoints.getBoardImagesTotal.select(l.board_id??"none")(i()):xi.endpoints.getBoardAssetsTotal.select(l.board_id??"none")(i()),h=d.data&&d.data.ids.length>=(f??0),p=(f||0)>=fv?Ic(d.data,l):!0;(h||p)&&n(me.util.updateQueryData("listImages",c,m=>{Vn.upsertOne(m,{...l,board_id:"none"})}))})}catch{}}})})}),{useGetIntermediatesCountQuery:wGe,useListImagesQuery:CGe,useLazyListImagesQuery:EGe,useGetImageDTOQuery:kGe,useGetImageMetadataQuery:TGe,useDeleteImageMutation:AGe,useDeleteImagesMutation:PGe,useUploadImageMutation:IGe,useClearIntermediatesMutation:RGe,useAddImagesToBoardMutation:OGe,useRemoveImagesFromBoardMutation:MGe,useAddImageToBoardMutation:NGe,useRemoveImageFromBoardMutation:$Ge,useChangeImageIsIntermediateMutation:DGe,useChangeImageSessionIdMutation:LGe,useDeleteBoardAndImagesMutation:FGe,useDeleteBoardMutation:BGe,useStarImagesMutation:zGe,useUnstarImagesMutation:jGe,useGetImageMetadataFromFileQuery:UGe}=me,Bj=Ne("socket/socketConnected"),zT=Ne("socket/appSocketConnected"),zj=Ne("socket/socketDisconnected"),jj=Ne("socket/appSocketDisconnected"),n0e=Ne("socket/socketSubscribedSession"),r0e=Ne("socket/appSocketSubscribedSession"),i0e=Ne("socket/socketUnsubscribedSession"),o0e=Ne("socket/appSocketUnsubscribedSession"),Uj=Ne("socket/socketInvocationStarted"),jT=Ne("socket/appSocketInvocationStarted"),UT=Ne("socket/socketInvocationComplete"),VT=Ne("socket/appSocketInvocationComplete"),Vj=Ne("socket/socketInvocationError"),U2=Ne("socket/appSocketInvocationError"),Gj=Ne("socket/socketGraphExecutionStateComplete"),Hj=Ne("socket/appSocketGraphExecutionStateComplete"),qj=Ne("socket/socketGeneratorProgress"),GT=Ne("socket/appSocketGeneratorProgress"),Wj=Ne("socket/socketModelLoadStarted"),Kj=Ne("socket/appSocketModelLoadStarted"),Qj=Ne("socket/socketModelLoadCompleted"),Xj=Ne("socket/appSocketModelLoadCompleted"),Yj=Ne("socket/socketSessionRetrievalError"),Zj=Ne("socket/appSocketSessionRetrievalError"),Jj=Ne("socket/socketInvocationRetrievalError"),eU=Ne("socket/appSocketInvocationRetrievalError"),tU=Ne("socket/socketQueueItemStatusChanged"),HT=Ne("socket/appSocketQueueItemStatusChanged"),qT=Ne("controlNet/imageProcessed"),Ef={none:{type:"none",get label(){return be.t("controlnet.none")},get description(){return be.t("controlnet.noneDescription")},default:{type:"none"}},canny_image_processor:{type:"canny_image_processor",get label(){return be.t("controlnet.canny")},get description(){return be.t("controlnet.cannyDescription")},default:{id:"canny_image_processor",type:"canny_image_processor",low_threshold:100,high_threshold:200}},color_map_image_processor:{type:"color_map_image_processor",get label(){return be.t("controlnet.colorMap")},get description(){return be.t("controlnet.colorMapDescription")},default:{id:"color_map_image_processor",type:"color_map_image_processor",color_map_tile_size:64}},content_shuffle_image_processor:{type:"content_shuffle_image_processor",get label(){return be.t("controlnet.contentShuffle")},get description(){return be.t("controlnet.contentShuffleDescription")},default:{id:"content_shuffle_image_processor",type:"content_shuffle_image_processor",detect_resolution:512,image_resolution:512,h:512,w:512,f:256}},hed_image_processor:{type:"hed_image_processor",get label(){return be.t("controlnet.hed")},get description(){return be.t("controlnet.hedDescription")},default:{id:"hed_image_processor",type:"hed_image_processor",detect_resolution:512,image_resolution:512,scribble:!1}},lineart_anime_image_processor:{type:"lineart_anime_image_processor",get label(){return be.t("controlnet.lineartAnime")},get description(){return be.t("controlnet.lineartAnimeDescription")},default:{id:"lineart_anime_image_processor",type:"lineart_anime_image_processor",detect_resolution:512,image_resolution:512}},lineart_image_processor:{type:"lineart_image_processor",get label(){return be.t("controlnet.lineart")},get description(){return be.t("controlnet.lineartDescription")},default:{id:"lineart_image_processor",type:"lineart_image_processor",detect_resolution:512,image_resolution:512,coarse:!1}},mediapipe_face_processor:{type:"mediapipe_face_processor",get label(){return be.t("controlnet.mediapipeFace")},get description(){return be.t("controlnet.mediapipeFaceDescription")},default:{id:"mediapipe_face_processor",type:"mediapipe_face_processor",max_faces:1,min_confidence:.5}},midas_depth_image_processor:{type:"midas_depth_image_processor",get label(){return be.t("controlnet.depthMidas")},get description(){return be.t("controlnet.depthMidasDescription")},default:{id:"midas_depth_image_processor",type:"midas_depth_image_processor",a_mult:2,bg_th:.1}},mlsd_image_processor:{type:"mlsd_image_processor",get label(){return be.t("controlnet.mlsd")},get description(){return be.t("controlnet.mlsdDescription")},default:{id:"mlsd_image_processor",type:"mlsd_image_processor",detect_resolution:512,image_resolution:512,thr_d:.1,thr_v:.1}},normalbae_image_processor:{type:"normalbae_image_processor",get label(){return be.t("controlnet.normalBae")},get description(){return be.t("controlnet.normalBaeDescription")},default:{id:"normalbae_image_processor",type:"normalbae_image_processor",detect_resolution:512,image_resolution:512}},openpose_image_processor:{type:"openpose_image_processor",get label(){return be.t("controlnet.openPose")},get description(){return be.t("controlnet.openPoseDescription")},default:{id:"openpose_image_processor",type:"openpose_image_processor",detect_resolution:512,image_resolution:512,hand_and_face:!1}},pidi_image_processor:{type:"pidi_image_processor",get label(){return be.t("controlnet.pidi")},get description(){return be.t("controlnet.pidiDescription")},default:{id:"pidi_image_processor",type:"pidi_image_processor",detect_resolution:512,image_resolution:512,scribble:!1,safe:!1}},zoe_depth_image_processor:{type:"zoe_depth_image_processor",get label(){return be.t("controlnet.depthZoe")},get description(){return be.t("controlnet.depthZoeDescription")},default:{id:"zoe_depth_image_processor",type:"zoe_depth_image_processor"}}},kv={canny:"canny_image_processor",mlsd:"mlsd_image_processor",depth:"midas_depth_image_processor",bae:"normalbae_image_processor",lineart:"lineart_image_processor",lineart_anime:"lineart_anime_image_processor",softedge:"hed_image_processor",shuffle:"content_shuffle_image_processor",openpose:"openpose_image_processor",mediapipe:"mediapipe_face_processor",pidi:"pidi_image_processor",zoe:"zoe_depth_image_processor",color:"color_map_image_processor"},zR={isEnabled:!0,model:null,weight:1,beginStepPct:0,endStepPct:1,controlMode:"balanced",resizeMode:"just_resize",controlImage:null,processedControlImage:null,processorType:"canny_image_processor",processorNode:Ef.canny_image_processor.default,shouldAutoConfig:!0},nU={adapterImage:null,model:null,weight:1,beginStepPct:0,endStepPct:1},_E={controlNets:{},isEnabled:!1,pendingControlImages:[],isIPAdapterEnabled:!1,ipAdapterInfo:{...nU}},rU=nr({name:"controlNet",initialState:_E,reducers:{isControlNetEnabledToggled:e=>{e.isEnabled=!e.isEnabled},controlNetEnabled:e=>{e.isEnabled=!0},controlNetAdded:(e,t)=>{const{controlNetId:n,controlNet:r}=t.payload;e.controlNets[n]={...r??zR,controlNetId:n}},controlNetRecalled:(e,t)=>{const n=t.payload;e.controlNets[n.controlNetId]={...n}},controlNetDuplicated:(e,t)=>{const{sourceControlNetId:n,newControlNetId:r}=t.payload,i=e.controlNets[n];if(!i)return;const o=wn(i);o.controlNetId=r,e.controlNets[r]=o},controlNetAddedFromImage:(e,t)=>{const{controlNetId:n,controlImage:r}=t.payload;e.controlNets[n]={...zR,controlNetId:n,controlImage:r}},controlNetRemoved:(e,t)=>{const{controlNetId:n}=t.payload;delete e.controlNets[n]},controlNetIsEnabledChanged:(e,t)=>{const{controlNetId:n,isEnabled:r}=t.payload,i=e.controlNets[n];i&&(i.isEnabled=r)},controlNetImageChanged:(e,t)=>{const{controlNetId:n,controlImage:r}=t.payload,i=e.controlNets[n];i&&(i.controlImage=r,i.processedControlImage=null,r!==null&&i.processorType!=="none"&&e.pendingControlImages.push(n))},controlNetProcessedImageChanged:(e,t)=>{const{controlNetId:n,processedControlImage:r}=t.payload,i=e.controlNets[n];i&&(i.processedControlImage=r,e.pendingControlImages=e.pendingControlImages.filter(o=>o!==n))},controlNetModelChanged:(e,t)=>{const{controlNetId:n,model:r}=t.payload,i=e.controlNets[n];if(i&&(i.model=r,i.processedControlImage=null,i.shouldAutoConfig)){let o;for(const a in kv)if(r.model_name.includes(a)){o=kv[a];break}o?(i.processorType=o,i.processorNode=Ef[o].default):(i.processorType="none",i.processorNode=Ef.none.default)}},controlNetWeightChanged:(e,t)=>{const{controlNetId:n,weight:r}=t.payload,i=e.controlNets[n];i&&(i.weight=r)},controlNetBeginStepPctChanged:(e,t)=>{const{controlNetId:n,beginStepPct:r}=t.payload,i=e.controlNets[n];i&&(i.beginStepPct=r)},controlNetEndStepPctChanged:(e,t)=>{const{controlNetId:n,endStepPct:r}=t.payload,i=e.controlNets[n];i&&(i.endStepPct=r)},controlNetControlModeChanged:(e,t)=>{const{controlNetId:n,controlMode:r}=t.payload,i=e.controlNets[n];i&&(i.controlMode=r)},controlNetResizeModeChanged:(e,t)=>{const{controlNetId:n,resizeMode:r}=t.payload,i=e.controlNets[n];i&&(i.resizeMode=r)},controlNetProcessorParamsChanged:(e,t)=>{const{controlNetId:n,changes:r}=t.payload,i=e.controlNets[n];if(!i)return;const o=i.processorNode;i.processorNode={...o,...r},i.shouldAutoConfig=!1},controlNetProcessorTypeChanged:(e,t)=>{const{controlNetId:n,processorType:r}=t.payload,i=e.controlNets[n];i&&(i.processedControlImage=null,i.processorType=r,i.processorNode=Ef[r].default,i.shouldAutoConfig=!1)},controlNetAutoConfigToggled:(e,t)=>{var o;const{controlNetId:n}=t.payload,r=e.controlNets[n];if(!r)return;const i=!r.shouldAutoConfig;if(i){let a;for(const s in kv)if((o=r.model)!=null&&o.model_name.includes(s)){a=kv[s];break}a?(r.processorType=a,r.processorNode=Ef[a].default):(r.processorType="none",r.processorNode=Ef.none.default)}r.shouldAutoConfig=i},controlNetReset:()=>({..._E}),isIPAdapterEnabledChanged:(e,t)=>{e.isIPAdapterEnabled=t.payload},ipAdapterRecalled:(e,t)=>{e.ipAdapterInfo=t.payload},ipAdapterImageChanged:(e,t)=>{e.ipAdapterInfo.adapterImage=t.payload},ipAdapterWeightChanged:(e,t)=>{e.ipAdapterInfo.weight=t.payload},ipAdapterModelChanged:(e,t)=>{e.ipAdapterInfo.model=t.payload},ipAdapterBeginStepPctChanged:(e,t)=>{e.ipAdapterInfo.beginStepPct=t.payload},ipAdapterEndStepPctChanged:(e,t)=>{e.ipAdapterInfo.endStepPct=t.payload},ipAdapterStateReset:e=>{e.isIPAdapterEnabled=!1,e.ipAdapterInfo={...nU}},clearPendingControlImages:e=>{e.pendingControlImages=[]}},extraReducers:e=>{e.addCase(qT,(t,n)=>{const r=t.controlNets[n.payload.controlNetId];r&&r.controlImage!==null&&t.pendingControlImages.push(n.payload.controlNetId)}),e.addCase(U2,t=>{t.pendingControlImages=[]}),e.addMatcher(me.endpoints.deleteImage.matchFulfilled,(t,n)=>{const{image_name:r}=n.meta.arg.originalArgs;Ca(t.controlNets,i=>{i.controlImage===r&&(i.controlImage=null,i.processedControlImage=null),i.processedControlImage===r&&(i.processedControlImage=null)})})}}),{isControlNetEnabledToggled:VGe,controlNetEnabled:GGe,controlNetAdded:HGe,controlNetRecalled:qGe,controlNetDuplicated:WGe,controlNetAddedFromImage:KGe,controlNetRemoved:iU,controlNetImageChanged:Sc,controlNetProcessedImageChanged:WT,controlNetIsEnabledChanged:oU,controlNetModelChanged:jR,controlNetWeightChanged:QGe,controlNetBeginStepPctChanged:XGe,controlNetEndStepPctChanged:YGe,controlNetControlModeChanged:ZGe,controlNetResizeModeChanged:JGe,controlNetProcessorParamsChanged:a0e,controlNetProcessorTypeChanged:s0e,controlNetReset:l0e,controlNetAutoConfigToggled:UR,isIPAdapterEnabledChanged:aU,ipAdapterRecalled:eHe,ipAdapterImageChanged:V2,ipAdapterWeightChanged:tHe,ipAdapterModelChanged:VR,ipAdapterBeginStepPctChanged:nHe,ipAdapterEndStepPctChanged:rHe,ipAdapterStateReset:sU,clearPendingControlImages:u0e}=rU.actions,c0e=rU.reducer,d0e={imagesToDelete:[],isModalOpen:!1},lU=nr({name:"deleteImageModal",initialState:d0e,reducers:{isModalOpenChanged:(e,t)=>{e.isModalOpen=t.payload},imagesToDeleteSelected:(e,t)=>{e.imagesToDelete=t.payload},imageDeletionCanceled:e=>{e.imagesToDelete=[],e.isModalOpen=!1}}}),{isModalOpenChanged:KT,imagesToDeleteSelected:f0e,imageDeletionCanceled:iHe}=lU.actions,h0e=lU.reducer,QT={maxPrompts:100,combinatorial:!0,prompts:[],parsingError:void 0,isError:!1,isLoading:!1,seedBehaviour:"PER_ITERATION"},p0e=QT,uU=nr({name:"dynamicPrompts",initialState:p0e,reducers:{maxPromptsChanged:(e,t)=>{e.maxPrompts=t.payload},maxPromptsReset:e=>{e.maxPrompts=QT.maxPrompts},combinatorialToggled:e=>{e.combinatorial=!e.combinatorial},promptsChanged:(e,t)=>{e.prompts=t.payload},parsingErrorChanged:(e,t)=>{e.parsingError=t.payload},isErrorChanged:(e,t)=>{e.isError=t.payload},isLoadingChanged:(e,t)=>{e.isLoading=t.payload},seedBehaviourChanged:(e,t)=>{e.seedBehaviour=t.payload}}}),{maxPromptsChanged:g0e,maxPromptsReset:m0e,combinatorialToggled:y0e,promptsChanged:v0e,parsingErrorChanged:b0e,isErrorChanged:GR,isLoadingChanged:RC,seedBehaviourChanged:oHe}=uU.actions,_0e=uU.reducer,cU={selection:[],shouldAutoSwitch:!0,autoAssignBoardOnClick:!0,autoAddBoardId:"none",galleryImageMinimumWidth:96,selectedBoardId:"none",galleryView:"images",boardSearchText:""},dU=nr({name:"gallery",initialState:cU,reducers:{imageSelected:(e,t)=>{e.selection=t.payload?[t.payload]:[]},selectionChanged:(e,t)=>{e.selection=t.payload},shouldAutoSwitchChanged:(e,t)=>{e.shouldAutoSwitch=t.payload},setGalleryImageMinimumWidth:(e,t)=>{e.galleryImageMinimumWidth=t.payload},autoAssignBoardOnClickChanged:(e,t)=>{e.autoAssignBoardOnClick=t.payload},boardIdSelected:(e,t)=>{e.selectedBoardId=t.payload.boardId,e.galleryView="images"},autoAddBoardIdChanged:(e,t)=>{if(!t.payload){e.autoAddBoardId="none";return}e.autoAddBoardId=t.payload},galleryViewChanged:(e,t)=>{e.galleryView=t.payload},boardSearchTextChanged:(e,t)=>{e.boardSearchText=t.payload}},extraReducers:e=>{e.addMatcher(x0e,(t,n)=>{const r=n.meta.arg.originalArgs;r===t.selectedBoardId&&(t.selectedBoardId="none",t.galleryView="images"),r===t.autoAddBoardId&&(t.autoAddBoardId="none")}),e.addMatcher(xi.endpoints.listAllBoards.matchFulfilled,(t,n)=>{const r=n.payload;t.autoAddBoardId&&(r.map(i=>i.board_id).includes(t.autoAddBoardId)||(t.autoAddBoardId="none"))})}}),{imageSelected:Us,shouldAutoSwitchChanged:aHe,autoAssignBoardOnClickChanged:sHe,setGalleryImageMinimumWidth:lHe,boardIdSelected:w_,autoAddBoardIdChanged:uHe,galleryViewChanged:SE,selectionChanged:fU,boardSearchTextChanged:cHe}=dU.actions,S0e=dU.reducer,x0e=No(me.endpoints.deleteBoard.matchFulfilled,me.endpoints.deleteBoardAndImages.matchFulfilled),HR={weight:.75},w0e={loras:{}},hU=nr({name:"lora",initialState:w0e,reducers:{loraAdded:(e,t)=>{const{model_name:n,id:r,base_model:i}=t.payload;e.loras[r]={id:r,model_name:n,base_model:i,...HR}},loraRecalled:(e,t)=>{const{model_name:n,id:r,base_model:i,weight:o}=t.payload;e.loras[r]={id:r,model_name:n,base_model:i,weight:o}},loraRemoved:(e,t)=>{const n=t.payload;delete e.loras[n]},lorasCleared:e=>{e.loras={}},loraWeightChanged:(e,t)=>{const{id:n,weight:r}=t.payload,i=e.loras[n];i&&(i.weight=r)},loraWeightReset:(e,t)=>{const n=t.payload,r=e.loras[n];r&&(r.weight=HR.weight)}}}),{loraAdded:dHe,loraRemoved:pU,loraWeightChanged:fHe,loraWeightReset:hHe,lorasCleared:pHe,loraRecalled:gHe}=hU.actions,C0e=hU.reducer;function Ta(e){if(typeof e=="string"||typeof e=="number")return""+e;let t="";if(Array.isArray(e))for(let n=0,r;n{let t;const n=new Set,r=(l,u)=>{const c=typeof l=="function"?l(t):l;if(!Object.is(c,t)){const d=t;t=u??typeof c!="object"?c:Object.assign({},t,c),n.forEach(f=>f(t,d))}},i=()=>t,s={setState:r,getState:i,subscribe:l=>(n.add(l),()=>n.delete(l)),destroy:()=>{n.clear()}};return t=e(r,i,s),s},E0e=e=>e?qR(e):qR,{useSyncExternalStoreWithSelector:k0e}=Qge;function gU(e,t=e.getState,n){const r=k0e(e.subscribe,e.getState,e.getServerState||e.getState,t,n);return I.useDebugValue(r),r}const WR=(e,t)=>{const n=E0e(e),r=(i,o=t)=>gU(n,i,o);return Object.assign(r,n),r},T0e=(e,t)=>e?WR(e,t):WR;function Ro(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[r,i]of e)if(!Object.is(i,t.get(r)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const r of e)if(!t.has(r))return!1;return!0}const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(let r=0;r{}};function G2(){for(var e=0,t=arguments.length,n={},r;e=0&&(r=n.slice(i+1),n=n.slice(0,i)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:r}})}F1.prototype=G2.prototype={constructor:F1,on:function(e,t){var n=this._,r=P0e(e+"",n),i,o=-1,a=r.length;if(arguments.length<2){for(;++o0)for(var n=new Array(i),r=0,i,o;r=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),QR.hasOwnProperty(t)?{space:QR[t],local:e}:e}function R0e(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===xE&&t.documentElement.namespaceURI===xE?t.createElement(e):t.createElementNS(n,e)}}function O0e(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function mU(e){var t=H2(e);return(t.local?O0e:R0e)(t)}function M0e(){}function XT(e){return e==null?M0e:function(){return this.querySelector(e)}}function N0e(e){typeof e!="function"&&(e=XT(e));for(var t=this._groups,n=t.length,r=new Array(n),i=0;i=g&&(g=v+1);!(S=_[g])&&++g=0;)(a=r[i])&&(o&&a.compareDocumentPosition(o)^4&&o.parentNode.insertBefore(a,o),o=a);return this}function oye(e){e||(e=aye);function t(d,f){return d&&f?e(d.__data__,f.__data__):!d-!f}for(var n=this._groups,r=n.length,i=new Array(r),o=0;ot?1:e>=t?0:NaN}function sye(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function lye(){return Array.from(this)}function uye(){for(var e=this._groups,t=0,n=e.length;t1?this.each((t==null?_ye:typeof t=="function"?xye:Sye)(e,t,n??"")):ep(this.node(),e)}function ep(e,t){return e.style.getPropertyValue(t)||SU(e).getComputedStyle(e,null).getPropertyValue(t)}function Cye(e){return function(){delete this[e]}}function Eye(e,t){return function(){this[e]=t}}function kye(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function Tye(e,t){return arguments.length>1?this.each((t==null?Cye:typeof t=="function"?kye:Eye)(e,t)):this.node()[e]}function xU(e){return e.trim().split(/^|\s+/)}function YT(e){return e.classList||new wU(e)}function wU(e){this._node=e,this._names=xU(e.getAttribute("class")||"")}wU.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function CU(e,t){for(var n=YT(e),r=-1,i=t.length;++r=0&&(n=t.slice(r+1),t=t.slice(0,r)),{type:t,name:n}})}function tve(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,i=t.length,o;n()=>e;function wE(e,{sourceEvent:t,subject:n,target:r,identifier:i,active:o,x:a,y:s,dx:l,dy:u,dispatch:c}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:i,enumerable:!0,configurable:!0},active:{value:o,enumerable:!0,configurable:!0},x:{value:a,enumerable:!0,configurable:!0},y:{value:s,enumerable:!0,configurable:!0},dx:{value:l,enumerable:!0,configurable:!0},dy:{value:u,enumerable:!0,configurable:!0},_:{value:c}})}wE.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function dve(e){return!e.ctrlKey&&!e.button}function fve(){return this.parentNode}function hve(e,t){return t??{x:e.x,y:e.y}}function pve(){return navigator.maxTouchPoints||"ontouchstart"in this}function gve(){var e=dve,t=fve,n=hve,r=pve,i={},o=G2("start","drag","end"),a=0,s,l,u,c,d=0;function f(y){y.on("mousedown.drag",h).filter(r).on("touchstart.drag",_).on("touchmove.drag",b,cve).on("touchend.drag touchcancel.drag",v).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function h(y,S){if(!(c||!e.call(this,y,S))){var w=g(this,t.call(this,y,S),y,S,"mouse");w&&(Wa(y.view).on("mousemove.drag",p,l0).on("mouseup.drag",m,l0),AU(y.view),OC(y),u=!1,s=y.clientX,l=y.clientY,w("start",y))}}function p(y){if(gh(y),!u){var S=y.clientX-s,w=y.clientY-l;u=S*S+w*w>d}i.mouse("drag",y)}function m(y){Wa(y.view).on("mousemove.drag mouseup.drag",null),PU(y.view,u),gh(y),i.mouse("end",y)}function _(y,S){if(e.call(this,y,S)){var w=y.changedTouches,x=t.call(this,y,S),C=w.length,T,k;for(T=0;T>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?Av(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?Av(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=yve.exec(e))?new Co(t[1],t[2],t[3],1):(t=vve.exec(e))?new Co(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=bve.exec(e))?Av(t[1],t[2],t[3],t[4]):(t=_ve.exec(e))?Av(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=Sve.exec(e))?n9(t[1],t[2]/100,t[3]/100,1):(t=xve.exec(e))?n9(t[1],t[2]/100,t[3]/100,t[4]):XR.hasOwnProperty(e)?JR(XR[e]):e==="transparent"?new Co(NaN,NaN,NaN,0):null}function JR(e){return new Co(e>>16&255,e>>8&255,e&255,1)}function Av(e,t,n,r){return r<=0&&(e=t=n=NaN),new Co(e,t,n,r)}function Eve(e){return e instanceof Sy||(e=d0(e)),e?(e=e.rgb(),new Co(e.r,e.g,e.b,e.opacity)):new Co}function CE(e,t,n,r){return arguments.length===1?Eve(e):new Co(e,t,n,r??1)}function Co(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}ZT(Co,CE,IU(Sy,{brighter(e){return e=e==null?E_:Math.pow(E_,e),new Co(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?u0:Math.pow(u0,e),new Co(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Co(gd(this.r),gd(this.g),gd(this.b),k_(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:e9,formatHex:e9,formatHex8:kve,formatRgb:t9,toString:t9}));function e9(){return`#${id(this.r)}${id(this.g)}${id(this.b)}`}function kve(){return`#${id(this.r)}${id(this.g)}${id(this.b)}${id((isNaN(this.opacity)?1:this.opacity)*255)}`}function t9(){const e=k_(this.opacity);return`${e===1?"rgb(":"rgba("}${gd(this.r)}, ${gd(this.g)}, ${gd(this.b)}${e===1?")":`, ${e})`}`}function k_(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function gd(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function id(e){return e=gd(e),(e<16?"0":"")+e.toString(16)}function n9(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new Ka(e,t,n,r)}function RU(e){if(e instanceof Ka)return new Ka(e.h,e.s,e.l,e.opacity);if(e instanceof Sy||(e=d0(e)),!e)return new Ka;if(e instanceof Ka)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,i=Math.min(t,n,r),o=Math.max(t,n,r),a=NaN,s=o-i,l=(o+i)/2;return s?(t===o?a=(n-r)/s+(n0&&l<1?0:a,new Ka(a,s,l,e.opacity)}function Tve(e,t,n,r){return arguments.length===1?RU(e):new Ka(e,t,n,r??1)}function Ka(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}ZT(Ka,Tve,IU(Sy,{brighter(e){return e=e==null?E_:Math.pow(E_,e),new Ka(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?u0:Math.pow(u0,e),new Ka(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,n=this.l,r=n+(n<.5?n:1-n)*t,i=2*n-r;return new Co(MC(e>=240?e-240:e+120,i,r),MC(e,i,r),MC(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new Ka(r9(this.h),Pv(this.s),Pv(this.l),k_(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=k_(this.opacity);return`${e===1?"hsl(":"hsla("}${r9(this.h)}, ${Pv(this.s)*100}%, ${Pv(this.l)*100}%${e===1?")":`, ${e})`}`}}));function r9(e){return e=(e||0)%360,e<0?e+360:e}function Pv(e){return Math.max(0,Math.min(1,e||0))}function MC(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}const OU=e=>()=>e;function Ave(e,t){return function(n){return e+n*t}}function Pve(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(r){return Math.pow(e+r*t,n)}}function Ive(e){return(e=+e)==1?MU:function(t,n){return n-t?Pve(t,n,e):OU(isNaN(t)?n:t)}}function MU(e,t){var n=t-e;return n?Ave(e,n):OU(isNaN(e)?t:e)}const i9=function e(t){var n=Ive(t);function r(i,o){var a=n((i=CE(i)).r,(o=CE(o)).r),s=n(i.g,o.g),l=n(i.b,o.b),u=MU(i.opacity,o.opacity);return function(c){return i.r=a(c),i.g=s(c),i.b=l(c),i.opacity=u(c),i+""}}return r.gamma=e,r}(1);function yu(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}var EE=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,NC=new RegExp(EE.source,"g");function Rve(e){return function(){return e}}function Ove(e){return function(t){return e(t)+""}}function Mve(e,t){var n=EE.lastIndex=NC.lastIndex=0,r,i,o,a=-1,s=[],l=[];for(e=e+"",t=t+"";(r=EE.exec(e))&&(i=NC.exec(t));)(o=i.index)>n&&(o=t.slice(n,o),s[a]?s[a]+=o:s[++a]=o),(r=r[0])===(i=i[0])?s[a]?s[a]+=i:s[++a]=i:(s[++a]=null,l.push({i:a,x:yu(r,i)})),n=NC.lastIndex;return n180?c+=360:c-u>180&&(u+=360),f.push({i:d.push(i(d)+"rotate(",null,r)-2,x:yu(u,c)})):c&&d.push(i(d)+"rotate("+c+r)}function s(u,c,d,f){u!==c?f.push({i:d.push(i(d)+"skewX(",null,r)-2,x:yu(u,c)}):c&&d.push(i(d)+"skewX("+c+r)}function l(u,c,d,f,h,p){if(u!==d||c!==f){var m=h.push(i(h)+"scale(",null,",",null,")");p.push({i:m-4,x:yu(u,d)},{i:m-2,x:yu(c,f)})}else(d!==1||f!==1)&&h.push(i(h)+"scale("+d+","+f+")")}return function(u,c){var d=[],f=[];return u=e(u),c=e(c),o(u.translateX,u.translateY,c.translateX,c.translateY,d,f),a(u.rotate,c.rotate,d,f),s(u.skewX,c.skewX,d,f),l(u.scaleX,u.scaleY,c.scaleX,c.scaleY,d,f),u=c=null,function(h){for(var p=-1,m=f.length,_;++p=0&&e._call.call(void 0,t),e=e._next;--tp}function s9(){Md=(A_=f0.now())+q2,tp=_g=0;try{Vve()}finally{tp=0,Hve(),Md=0}}function Gve(){var e=f0.now(),t=e-A_;t>DU&&(q2-=t,A_=e)}function Hve(){for(var e,t=T_,n,r=1/0;t;)t._call?(r>t._time&&(r=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:T_=n);Sg=e,TE(r)}function TE(e){if(!tp){_g&&(_g=clearTimeout(_g));var t=e-Md;t>24?(e<1/0&&(_g=setTimeout(s9,e-f0.now()-q2)),Kp&&(Kp=clearInterval(Kp))):(Kp||(A_=f0.now(),Kp=setInterval(Gve,DU)),tp=1,LU(s9))}}function l9(e,t,n){var r=new P_;return t=t==null?0:+t,r.restart(i=>{r.stop(),e(i+t)},t,n),r}var qve=G2("start","end","cancel","interrupt"),Wve=[],BU=0,u9=1,AE=2,B1=3,c9=4,PE=5,z1=6;function W2(e,t,n,r,i,o){var a=e.__transition;if(!a)e.__transition={};else if(n in a)return;Kve(e,n,{name:t,index:r,group:i,on:qve,tween:Wve,time:o.time,delay:o.delay,duration:o.duration,ease:o.ease,timer:null,state:BU})}function eA(e,t){var n=ds(e,t);if(n.state>BU)throw new Error("too late; already scheduled");return n}function nl(e,t){var n=ds(e,t);if(n.state>B1)throw new Error("too late; already running");return n}function ds(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function Kve(e,t,n){var r=e.__transition,i;r[t]=n,n.timer=FU(o,0,n.time);function o(u){n.state=u9,n.timer.restart(a,n.delay,n.time),n.delay<=u&&a(u-n.delay)}function a(u){var c,d,f,h;if(n.state!==u9)return l();for(c in r)if(h=r[c],h.name===n.name){if(h.state===B1)return l9(a);h.state===c9?(h.state=z1,h.timer.stop(),h.on.call("interrupt",e,e.__data__,h.index,h.group),delete r[c]):+cAE&&r.state=0&&(t=t.slice(0,n)),!t||t==="start"})}function C1e(e,t,n){var r,i,o=w1e(t)?eA:nl;return function(){var a=o(this,e),s=a.on;s!==r&&(i=(r=s).copy()).on(t,n),a.on=i}}function E1e(e,t){var n=this._id;return arguments.length<2?ds(this.node(),n).on.on(e):this.each(C1e(n,e,t))}function k1e(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function T1e(){return this.on("end.remove",k1e(this._id))}function A1e(e){var t=this._name,n=this._id;typeof e!="function"&&(e=XT(e));for(var r=this._groups,i=r.length,o=new Array(i),a=0;a()=>e;function J1e(e,{sourceEvent:t,target:n,transform:r,dispatch:i}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:i}})}function Il(e,t,n){this.k=e,this.x=t,this.y=n}Il.prototype={constructor:Il,scale:function(e){return e===1?this:new Il(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Il(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var Ku=new Il(1,0,0);Il.prototype;function $C(e){e.stopImmediatePropagation()}function Qp(e){e.preventDefault(),e.stopImmediatePropagation()}function ebe(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function tbe(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function d9(){return this.__zoom||Ku}function nbe(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function rbe(){return navigator.maxTouchPoints||"ontouchstart"in this}function ibe(e,t,n){var r=e.invertX(t[0][0])-n[0][0],i=e.invertX(t[1][0])-n[1][0],o=e.invertY(t[0][1])-n[0][1],a=e.invertY(t[1][1])-n[1][1];return e.translate(i>r?(r+i)/2:Math.min(0,r)||Math.max(0,i),a>o?(o+a)/2:Math.min(0,o)||Math.max(0,a))}function obe(){var e=ebe,t=tbe,n=ibe,r=nbe,i=rbe,o=[0,1/0],a=[[-1/0,-1/0],[1/0,1/0]],s=250,l=jve,u=G2("start","zoom","end"),c,d,f,h=500,p=150,m=0,_=10;function b(E){E.property("__zoom",d9).on("wheel.zoom",C,{passive:!1}).on("mousedown.zoom",T).on("dblclick.zoom",k).filter(i).on("touchstart.zoom",P).on("touchmove.zoom",$).on("touchend.zoom touchcancel.zoom",O).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}b.transform=function(E,A,D,L){var M=E.selection?E.selection():E;M.property("__zoom",d9),E!==M?S(E,A,D,L):M.interrupt().each(function(){w(this,arguments).event(L).start().zoom(null,typeof A=="function"?A.apply(this,arguments):A).end()})},b.scaleBy=function(E,A,D,L){b.scaleTo(E,function(){var M=this.__zoom.k,R=typeof A=="function"?A.apply(this,arguments):A;return M*R},D,L)},b.scaleTo=function(E,A,D,L){b.transform(E,function(){var M=t.apply(this,arguments),R=this.__zoom,N=D==null?y(M):typeof D=="function"?D.apply(this,arguments):D,B=R.invert(N),U=typeof A=="function"?A.apply(this,arguments):A;return n(g(v(R,U),N,B),M,a)},D,L)},b.translateBy=function(E,A,D,L){b.transform(E,function(){return n(this.__zoom.translate(typeof A=="function"?A.apply(this,arguments):A,typeof D=="function"?D.apply(this,arguments):D),t.apply(this,arguments),a)},null,L)},b.translateTo=function(E,A,D,L,M){b.transform(E,function(){var R=t.apply(this,arguments),N=this.__zoom,B=L==null?y(R):typeof L=="function"?L.apply(this,arguments):L;return n(Ku.translate(B[0],B[1]).scale(N.k).translate(typeof A=="function"?-A.apply(this,arguments):-A,typeof D=="function"?-D.apply(this,arguments):-D),R,a)},L,M)};function v(E,A){return A=Math.max(o[0],Math.min(o[1],A)),A===E.k?E:new Il(A,E.x,E.y)}function g(E,A,D){var L=A[0]-D[0]*E.k,M=A[1]-D[1]*E.k;return L===E.x&&M===E.y?E:new Il(E.k,L,M)}function y(E){return[(+E[0][0]+ +E[1][0])/2,(+E[0][1]+ +E[1][1])/2]}function S(E,A,D,L){E.on("start.zoom",function(){w(this,arguments).event(L).start()}).on("interrupt.zoom end.zoom",function(){w(this,arguments).event(L).end()}).tween("zoom",function(){var M=this,R=arguments,N=w(M,R).event(L),B=t.apply(M,R),U=D==null?y(B):typeof D=="function"?D.apply(M,R):D,G=Math.max(B[1][0]-B[0][0],B[1][1]-B[0][1]),Y=M.__zoom,ee=typeof A=="function"?A.apply(M,R):A,J=l(Y.invert(U).concat(G/Y.k),ee.invert(U).concat(G/ee.k));return function(j){if(j===1)j=ee;else{var Q=J(j),ne=G/Q[2];j=new Il(ne,U[0]-Q[0]*ne,U[1]-Q[1]*ne)}N.zoom(null,j)}})}function w(E,A,D){return!D&&E.__zooming||new x(E,A)}function x(E,A){this.that=E,this.args=A,this.active=0,this.sourceEvent=null,this.extent=t.apply(E,A),this.taps=0}x.prototype={event:function(E){return E&&(this.sourceEvent=E),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(E,A){return this.mouse&&E!=="mouse"&&(this.mouse[1]=A.invert(this.mouse[0])),this.touch0&&E!=="touch"&&(this.touch0[1]=A.invert(this.touch0[0])),this.touch1&&E!=="touch"&&(this.touch1[1]=A.invert(this.touch1[0])),this.that.__zoom=A,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(E){var A=Wa(this.that).datum();u.call(E,this.that,new J1e(E,{sourceEvent:this.sourceEvent,target:b,type:E,transform:this.that.__zoom,dispatch:u}),A)}};function C(E,...A){if(!e.apply(this,arguments))return;var D=w(this,A).event(E),L=this.__zoom,M=Math.max(o[0],Math.min(o[1],L.k*Math.pow(2,r.apply(this,arguments)))),R=xs(E);if(D.wheel)(D.mouse[0][0]!==R[0]||D.mouse[0][1]!==R[1])&&(D.mouse[1]=L.invert(D.mouse[0]=R)),clearTimeout(D.wheel);else{if(L.k===M)return;D.mouse=[R,L.invert(R)],j1(this),D.start()}Qp(E),D.wheel=setTimeout(N,p),D.zoom("mouse",n(g(v(L,M),D.mouse[0],D.mouse[1]),D.extent,a));function N(){D.wheel=null,D.end()}}function T(E,...A){if(f||!e.apply(this,arguments))return;var D=E.currentTarget,L=w(this,A,!0).event(E),M=Wa(E.view).on("mousemove.zoom",U,!0).on("mouseup.zoom",G,!0),R=xs(E,D),N=E.clientX,B=E.clientY;AU(E.view),$C(E),L.mouse=[R,this.__zoom.invert(R)],j1(this),L.start();function U(Y){if(Qp(Y),!L.moved){var ee=Y.clientX-N,J=Y.clientY-B;L.moved=ee*ee+J*J>m}L.event(Y).zoom("mouse",n(g(L.that.__zoom,L.mouse[0]=xs(Y,D),L.mouse[1]),L.extent,a))}function G(Y){M.on("mousemove.zoom mouseup.zoom",null),PU(Y.view,L.moved),Qp(Y),L.event(Y).end()}}function k(E,...A){if(e.apply(this,arguments)){var D=this.__zoom,L=xs(E.changedTouches?E.changedTouches[0]:E,this),M=D.invert(L),R=D.k*(E.shiftKey?.5:2),N=n(g(v(D,R),L,M),t.apply(this,A),a);Qp(E),s>0?Wa(this).transition().duration(s).call(S,N,L,E):Wa(this).call(b.transform,N,L,E)}}function P(E,...A){if(e.apply(this,arguments)){var D=E.touches,L=D.length,M=w(this,A,E.changedTouches.length===L).event(E),R,N,B,U;for($C(E),N=0;N"[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.dev/error#001",error002:()=>"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.",error003:e=>`Node type "${e}" not found. Using fallback type "default".`,error004:()=>"The React Flow parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error007:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,t)=>`Couldn't create edge for ${e?"target":"source"} handle id: "${e?t.targetHandle:t.sourceHandle}", edge id: ${t.id}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:e=>`Edge type "${e}" not found. Using fallback type "default".`,error012:e=>`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`},VU=Wl.error001();function br(e,t){const n=I.useContext(K2);if(n===null)throw new Error(VU);return gU(n,e,t)}const hi=()=>{const e=I.useContext(K2);if(e===null)throw new Error(VU);return I.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe,destroy:e.destroy}),[e])},sbe=e=>e.userSelectionActive?"none":"all";function lbe({position:e,children:t,className:n,style:r,...i}){const o=br(sbe),a=`${e}`.split("-");return W.jsx("div",{className:Ta(["react-flow__panel",n,...a]),style:{...r,pointerEvents:o},...i,children:t})}function ube({proOptions:e,position:t="bottom-right"}){return e!=null&&e.hideAttribution?null:W.jsx(lbe,{position:t,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://pro.reactflow.dev",children:W.jsx("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const cbe=({x:e,y:t,label:n,labelStyle:r={},labelShowBg:i=!0,labelBgStyle:o={},labelBgPadding:a=[2,4],labelBgBorderRadius:s=2,children:l,className:u,...c})=>{const d=I.useRef(null),[f,h]=I.useState({x:0,y:0,width:0,height:0}),p=Ta(["react-flow__edge-textwrapper",u]);return I.useEffect(()=>{if(d.current){const m=d.current.getBBox();h({x:m.x,y:m.y,width:m.width,height:m.height})}},[n]),typeof n>"u"||!n?null:W.jsxs("g",{transform:`translate(${e-f.width/2} ${t-f.height/2})`,className:p,visibility:f.width?"visible":"hidden",...c,children:[i&&W.jsx("rect",{width:f.width+2*a[0],x:-a[0],y:-a[1],height:f.height+2*a[1],className:"react-flow__edge-textbg",style:o,rx:s,ry:s}),W.jsx("text",{className:"react-flow__edge-text",y:f.height/2,dy:"0.3em",ref:d,style:r,children:n}),l]})};var dbe=I.memo(cbe);const nA=e=>({width:e.offsetWidth,height:e.offsetHeight}),np=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),rA=(e={x:0,y:0},t)=>({x:np(e.x,t[0][0],t[1][0]),y:np(e.y,t[0][1],t[1][1])}),f9=(e,t,n)=>en?-np(Math.abs(e-n),1,50)/50:0,GU=(e,t)=>{const n=f9(e.x,35,t.width-35)*20,r=f9(e.y,35,t.height-35)*20;return[n,r]},HU=e=>{var t;return((t=e.getRootNode)==null?void 0:t.call(e))||(window==null?void 0:window.document)},qU=(e,t)=>({x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x2,t.x2),y2:Math.max(e.y2,t.y2)}),h0=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),WU=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),h9=e=>({...e.positionAbsolute||{x:0,y:0},width:e.width||0,height:e.height||0}),mHe=(e,t)=>WU(qU(h0(e),h0(t))),IE=(e,t)=>{const n=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),r=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(n*r)},fbe=e=>ba(e.width)&&ba(e.height)&&ba(e.x)&&ba(e.y),ba=e=>!isNaN(e)&&isFinite(e),Kr=Symbol.for("internals"),KU=["Enter"," ","Escape"],hbe=(e,t)=>{},pbe=e=>"nativeEvent"in e;function RE(e){var i,o;const t=pbe(e)?e.nativeEvent:e,n=((o=(i=t.composedPath)==null?void 0:i.call(t))==null?void 0:o[0])||e.target;return["INPUT","SELECT","TEXTAREA"].includes(n==null?void 0:n.nodeName)||(n==null?void 0:n.hasAttribute("contenteditable"))||!!(n!=null&&n.closest(".nokey"))}const QU=e=>"clientX"in e,Qu=(e,t)=>{var o,a;const n=QU(e),r=n?e.clientX:(o=e.touches)==null?void 0:o[0].clientX,i=n?e.clientY:(a=e.touches)==null?void 0:a[0].clientY;return{x:r-((t==null?void 0:t.left)??0),y:i-((t==null?void 0:t.top)??0)}},I_=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0},xy=({id:e,path:t,labelX:n,labelY:r,label:i,labelStyle:o,labelShowBg:a,labelBgStyle:s,labelBgPadding:l,labelBgBorderRadius:u,style:c,markerEnd:d,markerStart:f,interactionWidth:h=20})=>W.jsxs(W.Fragment,{children:[W.jsx("path",{id:e,style:c,d:t,fill:"none",className:"react-flow__edge-path",markerEnd:d,markerStart:f}),h&&W.jsx("path",{d:t,fill:"none",strokeOpacity:0,strokeWidth:h,className:"react-flow__edge-interaction"}),i&&ba(n)&&ba(r)?W.jsx(dbe,{x:n,y:r,label:i,labelStyle:o,labelShowBg:a,labelBgStyle:s,labelBgPadding:l,labelBgBorderRadius:u}):null]});xy.displayName="BaseEdge";function Xp(e,t,n){return n===void 0?n:r=>{const i=t().edges.find(o=>o.id===e);i&&n(r,{...i})}}function XU({sourceX:e,sourceY:t,targetX:n,targetY:r}){const i=Math.abs(n-e)/2,o=n{const[_,b,v]=ZU({sourceX:e,sourceY:t,sourcePosition:i,targetX:n,targetY:r,targetPosition:o});return W.jsx(xy,{path:_,labelX:b,labelY:v,label:a,labelStyle:s,labelShowBg:l,labelBgStyle:u,labelBgPadding:c,labelBgBorderRadius:d,style:f,markerEnd:h,markerStart:p,interactionWidth:m})});iA.displayName="SimpleBezierEdge";const g9={[tt.Left]:{x:-1,y:0},[tt.Right]:{x:1,y:0},[tt.Top]:{x:0,y:-1},[tt.Bottom]:{x:0,y:1}},gbe=({source:e,sourcePosition:t=tt.Bottom,target:n})=>t===tt.Left||t===tt.Right?e.xMath.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function mbe({source:e,sourcePosition:t=tt.Bottom,target:n,targetPosition:r=tt.Top,center:i,offset:o}){const a=g9[t],s=g9[r],l={x:e.x+a.x*o,y:e.y+a.y*o},u={x:n.x+s.x*o,y:n.y+s.y*o},c=gbe({source:l,sourcePosition:t,target:u}),d=c.x!==0?"x":"y",f=c[d];let h=[],p,m;const _={x:0,y:0},b={x:0,y:0},[v,g,y,S]=XU({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(a[d]*s[d]===-1){p=i.x||v,m=i.y||g;const x=[{x:p,y:l.y},{x:p,y:u.y}],C=[{x:l.x,y:m},{x:u.x,y:m}];a[d]===f?h=d==="x"?x:C:h=d==="x"?C:x}else{const x=[{x:l.x,y:u.y}],C=[{x:u.x,y:l.y}];if(d==="x"?h=a.x===f?C:x:h=a.y===f?x:C,t===r){const O=Math.abs(e[d]-n[d]);if(O<=o){const E=Math.min(o-1,o-O);a[d]===f?_[d]=(l[d]>e[d]?-1:1)*E:b[d]=(u[d]>n[d]?-1:1)*E}}if(t!==r){const O=d==="x"?"y":"x",E=a[d]===s[O],A=l[O]>u[O],D=l[O]=$?(p=(T.x+k.x)/2,m=h[0].y):(p=h[0].x,m=(T.y+k.y)/2)}return[[e,{x:l.x+_.x,y:l.y+_.y},...h,{x:u.x+b.x,y:u.y+b.y},n],p,m,y,S]}function ybe(e,t,n,r){const i=Math.min(m9(e,t)/2,m9(t,n)/2,r),{x:o,y:a}=t;if(e.x===o&&o===n.x||e.y===a&&a===n.y)return`L${o} ${a}`;if(e.y===a){const u=e.x{let g="";return v>0&&v{const[b,v,g]=OE({sourceX:e,sourceY:t,sourcePosition:d,targetX:n,targetY:r,targetPosition:f,borderRadius:m==null?void 0:m.borderRadius,offset:m==null?void 0:m.offset});return W.jsx(xy,{path:b,labelX:v,labelY:g,label:i,labelStyle:o,labelShowBg:a,labelBgStyle:s,labelBgPadding:l,labelBgBorderRadius:u,style:c,markerEnd:h,markerStart:p,interactionWidth:_})});Q2.displayName="SmoothStepEdge";const oA=I.memo(e=>{var t;return W.jsx(Q2,{...e,pathOptions:I.useMemo(()=>{var n;return{borderRadius:0,offset:(n=e.pathOptions)==null?void 0:n.offset}},[(t=e.pathOptions)==null?void 0:t.offset])})});oA.displayName="StepEdge";function vbe({sourceX:e,sourceY:t,targetX:n,targetY:r}){const[i,o,a,s]=XU({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,i,o,a,s]}const aA=I.memo(({sourceX:e,sourceY:t,targetX:n,targetY:r,label:i,labelStyle:o,labelShowBg:a,labelBgStyle:s,labelBgPadding:l,labelBgBorderRadius:u,style:c,markerEnd:d,markerStart:f,interactionWidth:h})=>{const[p,m,_]=vbe({sourceX:e,sourceY:t,targetX:n,targetY:r});return W.jsx(xy,{path:p,labelX:m,labelY:_,label:i,labelStyle:o,labelShowBg:a,labelBgStyle:s,labelBgPadding:l,labelBgBorderRadius:u,style:c,markerEnd:d,markerStart:f,interactionWidth:h})});aA.displayName="StraightEdge";function Ov(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function y9({pos:e,x1:t,y1:n,x2:r,y2:i,c:o}){switch(e){case tt.Left:return[t-Ov(t-r,o),n];case tt.Right:return[t+Ov(r-t,o),n];case tt.Top:return[t,n-Ov(n-i,o)];case tt.Bottom:return[t,n+Ov(i-n,o)]}}function JU({sourceX:e,sourceY:t,sourcePosition:n=tt.Bottom,targetX:r,targetY:i,targetPosition:o=tt.Top,curvature:a=.25}){const[s,l]=y9({pos:n,x1:e,y1:t,x2:r,y2:i,c:a}),[u,c]=y9({pos:o,x1:r,y1:i,x2:e,y2:t,c:a}),[d,f,h,p]=YU({sourceX:e,sourceY:t,targetX:r,targetY:i,sourceControlX:s,sourceControlY:l,targetControlX:u,targetControlY:c});return[`M${e},${t} C${s},${l} ${u},${c} ${r},${i}`,d,f,h,p]}const O_=I.memo(({sourceX:e,sourceY:t,targetX:n,targetY:r,sourcePosition:i=tt.Bottom,targetPosition:o=tt.Top,label:a,labelStyle:s,labelShowBg:l,labelBgStyle:u,labelBgPadding:c,labelBgBorderRadius:d,style:f,markerEnd:h,markerStart:p,pathOptions:m,interactionWidth:_})=>{const[b,v,g]=JU({sourceX:e,sourceY:t,sourcePosition:i,targetX:n,targetY:r,targetPosition:o,curvature:m==null?void 0:m.curvature});return W.jsx(xy,{path:b,labelX:v,labelY:g,label:a,labelStyle:s,labelShowBg:l,labelBgStyle:u,labelBgPadding:c,labelBgBorderRadius:d,style:f,markerEnd:h,markerStart:p,interactionWidth:_})});O_.displayName="BezierEdge";const sA=I.createContext(null),bbe=sA.Provider;sA.Consumer;const _be=()=>I.useContext(sA),Sbe=e=>"id"in e&&"source"in e&&"target"in e,eV=e=>"id"in e&&!("source"in e)&&!("target"in e),xbe=(e,t,n)=>{if(!eV(e))return[];const r=n.filter(i=>i.source===e.id).map(i=>i.target);return t.filter(i=>r.includes(i.id))},wbe=(e,t,n)=>{if(!eV(e))return[];const r=n.filter(i=>i.target===e.id).map(i=>i.source);return t.filter(i=>r.includes(i.id))},tV=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`reactflow__edge-${e}${t||""}-${n}${r||""}`,ME=(e,t)=>typeof e>"u"?"":typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(r=>`${r}=${e[r]}`).join("&")}`,Cbe=(e,t)=>t.some(n=>n.source===e.source&&n.target===e.target&&(n.sourceHandle===e.sourceHandle||!n.sourceHandle&&!e.sourceHandle)&&(n.targetHandle===e.targetHandle||!n.targetHandle&&!e.targetHandle)),xg=(e,t)=>{if(!e.source||!e.target)return t;let n;return Sbe(e)?n={...e}:n={...e,id:tV(e)},Cbe(n,t)?t:t.concat(n)},Ebe=(e,t,n,r={shouldReplaceId:!0})=>{const{id:i,...o}=e;if(!t.source||!t.target||!n.find(l=>l.id===i))return n;const s={...o,id:r.shouldReplaceId?tV(t):i,source:t.source,target:t.target,sourceHandle:t.sourceHandle,targetHandle:t.targetHandle};return n.filter(l=>l.id!==i).concat(s)},nV=({x:e,y:t},[n,r,i],o,[a,s])=>{const l={x:(e-n)/i,y:(t-r)/i};return o?{x:a*Math.round(l.x/a),y:s*Math.round(l.y/s)}:l},kbe=({x:e,y:t},[n,r,i])=>({x:e*i+n,y:t*i+r}),yh=(e,t=[0,0])=>{if(!e)return{x:0,y:0,positionAbsolute:{x:0,y:0}};const n=(e.width??0)*t[0],r=(e.height??0)*t[1],i={x:e.position.x-n,y:e.position.y-r};return{...i,positionAbsolute:e.positionAbsolute?{x:e.positionAbsolute.x-n,y:e.positionAbsolute.y-r}:i}},lA=(e,t=[0,0])=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const n=e.reduce((r,i)=>{const{x:o,y:a}=yh(i,t).positionAbsolute;return qU(r,h0({x:o,y:a,width:i.width||0,height:i.height||0}))},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return WU(n)},rV=(e,t,[n,r,i]=[0,0,1],o=!1,a=!1,s=[0,0])=>{const l={x:(t.x-n)/i,y:(t.y-r)/i,width:t.width/i,height:t.height/i},u=[];return e.forEach(c=>{const{width:d,height:f,selectable:h=!0,hidden:p=!1}=c;if(a&&!h||p)return!1;const{positionAbsolute:m}=yh(c,s),_={x:m.x,y:m.y,width:d||0,height:f||0},b=IE(l,_),v=typeof d>"u"||typeof f>"u"||d===null||f===null,g=o&&b>0,y=(d||0)*(f||0);(v||g||b>=y||c.dragging)&&u.push(c)}),u},uA=(e,t)=>{const n=e.map(r=>r.id);return t.filter(r=>n.includes(r.source)||n.includes(r.target))},iV=(e,t,n,r,i,o=.1)=>{const a=t/(e.width*(1+o)),s=n/(e.height*(1+o)),l=Math.min(a,s),u=np(l,r,i),c=e.x+e.width/2,d=e.y+e.height/2,f=t/2-c*u,h=n/2-d*u;return[f,h,u]},jc=(e,t=0)=>e.transition().duration(t);function v9(e,t,n,r){return(t[n]||[]).reduce((i,o)=>{var a,s;return`${e.id}-${o.id}-${n}`!==r&&i.push({id:o.id||null,type:n,nodeId:e.id,x:(((a=e.positionAbsolute)==null?void 0:a.x)??0)+o.x+o.width/2,y:(((s=e.positionAbsolute)==null?void 0:s.y)??0)+o.y+o.height/2}),i},[])}function Tbe(e,t,n,r,i,o){const{x:a,y:s}=Qu(e),u=t.elementsFromPoint(a,s).find(p=>p.classList.contains("react-flow__handle"));if(u){const p=u.getAttribute("data-nodeid");if(p){const m=cA(void 0,u),_=u.getAttribute("data-handleid"),b=o({nodeId:p,id:_,type:m});if(b)return{handle:{id:_,type:m,nodeId:p,x:n.x,y:n.y},validHandleResult:b}}}let c=[],d=1/0;if(i.forEach(p=>{const m=Math.sqrt((p.x-n.x)**2+(p.y-n.y)**2);if(m<=r){const _=o(p);m<=d&&(mp.isValid),h=c.some(({handle:p})=>p.type==="target");return c.find(({handle:p,validHandleResult:m})=>h?p.type==="target":f?m.isValid:!0)||c[0]}const Abe={source:null,target:null,sourceHandle:null,targetHandle:null},oV=()=>({handleDomNode:null,isValid:!1,connection:Abe,endHandle:null});function aV(e,t,n,r,i,o,a){const s=i==="target",l=a.querySelector(`.react-flow__handle[data-id="${e==null?void 0:e.nodeId}-${e==null?void 0:e.id}-${e==null?void 0:e.type}"]`),u={...oV(),handleDomNode:l};if(l){const c=cA(void 0,l),d=l.getAttribute("data-nodeid"),f=l.getAttribute("data-handleid"),h=l.classList.contains("connectable"),p=l.classList.contains("connectableend"),m={source:s?d:n,sourceHandle:s?f:r,target:s?n:d,targetHandle:s?r:f};u.connection=m,h&&p&&(t===Nd.Strict?s&&c==="source"||!s&&c==="target":d!==n||f!==r)&&(u.endHandle={nodeId:d,handleId:f,type:c},u.isValid=o(m))}return u}function Pbe({nodes:e,nodeId:t,handleId:n,handleType:r}){return e.reduce((i,o)=>{if(o[Kr]){const{handleBounds:a}=o[Kr];let s=[],l=[];a&&(s=v9(o,a,"source",`${t}-${n}-${r}`),l=v9(o,a,"target",`${t}-${n}-${r}`)),i.push(...s,...l)}return i},[])}function cA(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function DC(e){e==null||e.classList.remove("valid","connecting","react-flow__handle-valid","react-flow__handle-connecting")}function Ibe(e,t){let n=null;return t?n="valid":e&&!t&&(n="invalid"),n}function sV({event:e,handleId:t,nodeId:n,onConnect:r,isTarget:i,getState:o,setState:a,isValidConnection:s,edgeUpdaterType:l,onEdgeUpdateEnd:u}){const c=HU(e.target),{connectionMode:d,domNode:f,autoPanOnConnect:h,connectionRadius:p,onConnectStart:m,panBy:_,getNodes:b,cancelConnection:v}=o();let g=0,y;const{x:S,y:w}=Qu(e),x=c==null?void 0:c.elementFromPoint(S,w),C=cA(l,x),T=f==null?void 0:f.getBoundingClientRect();if(!T||!C)return;let k,P=Qu(e,T),$=!1,O=null,E=!1,A=null;const D=Pbe({nodes:b(),nodeId:n,handleId:t,handleType:C}),L=()=>{if(!h)return;const[N,B]=GU(P,T);_({x:N,y:B}),g=requestAnimationFrame(L)};a({connectionPosition:P,connectionStatus:null,connectionNodeId:n,connectionHandleId:t,connectionHandleType:C,connectionStartHandle:{nodeId:n,handleId:t,type:C},connectionEndHandle:null}),m==null||m(e,{nodeId:n,handleId:t,handleType:C});function M(N){const{transform:B}=o();P=Qu(N,T);const{handle:U,validHandleResult:G}=Tbe(N,c,nV(P,B,!1,[1,1]),p,D,Y=>aV(Y,d,n,t,i?"target":"source",s,c));if(y=U,$||(L(),$=!0),A=G.handleDomNode,O=G.connection,E=G.isValid,a({connectionPosition:y&&E?kbe({x:y.x,y:y.y},B):P,connectionStatus:Ibe(!!y,E),connectionEndHandle:G.endHandle}),!y&&!E&&!A)return DC(k);O.source!==O.target&&A&&(DC(k),k=A,A.classList.add("connecting","react-flow__handle-connecting"),A.classList.toggle("valid",E),A.classList.toggle("react-flow__handle-valid",E))}function R(N){var B,U;(y||A)&&O&&E&&(r==null||r(O)),(U=(B=o()).onConnectEnd)==null||U.call(B,N),l&&(u==null||u(N)),DC(k),v(),cancelAnimationFrame(g),$=!1,E=!1,O=null,A=null,c.removeEventListener("mousemove",M),c.removeEventListener("mouseup",R),c.removeEventListener("touchmove",M),c.removeEventListener("touchend",R)}c.addEventListener("mousemove",M),c.addEventListener("mouseup",R),c.addEventListener("touchmove",M),c.addEventListener("touchend",R)}const b9=()=>!0,Rbe=e=>({connectionStartHandle:e.connectionStartHandle,connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName}),Obe=(e,t,n)=>r=>{const{connectionStartHandle:i,connectionEndHandle:o,connectionClickStartHandle:a}=r;return{connecting:(i==null?void 0:i.nodeId)===e&&(i==null?void 0:i.handleId)===t&&(i==null?void 0:i.type)===n||(o==null?void 0:o.nodeId)===e&&(o==null?void 0:o.handleId)===t&&(o==null?void 0:o.type)===n,clickConnecting:(a==null?void 0:a.nodeId)===e&&(a==null?void 0:a.handleId)===t&&(a==null?void 0:a.type)===n}},lV=I.forwardRef(({type:e="source",position:t=tt.Top,isValidConnection:n,isConnectable:r=!0,isConnectableStart:i=!0,isConnectableEnd:o=!0,id:a,onConnect:s,children:l,className:u,onMouseDown:c,onTouchStart:d,...f},h)=>{var T,k;const p=a||null,m=e==="target",_=hi(),b=_be(),{connectOnClick:v,noPanClassName:g}=br(Rbe,Ro),{connecting:y,clickConnecting:S}=br(Obe(b,p,e),Ro);b||(k=(T=_.getState()).onError)==null||k.call(T,"010",Wl.error010());const w=P=>{const{defaultEdgeOptions:$,onConnect:O,hasDefaultEdges:E}=_.getState(),A={...$,...P};if(E){const{edges:D,setEdges:L}=_.getState();L(xg(A,D))}O==null||O(A),s==null||s(A)},x=P=>{if(!b)return;const $=QU(P);i&&($&&P.button===0||!$)&&sV({event:P,handleId:p,nodeId:b,onConnect:w,isTarget:m,getState:_.getState,setState:_.setState,isValidConnection:n||_.getState().isValidConnection||b9}),$?c==null||c(P):d==null||d(P)},C=P=>{const{onClickConnectStart:$,onClickConnectEnd:O,connectionClickStartHandle:E,connectionMode:A,isValidConnection:D}=_.getState();if(!b||!E&&!i)return;if(!E){$==null||$(P,{nodeId:b,handleId:p,handleType:e}),_.setState({connectionClickStartHandle:{nodeId:b,type:e,handleId:p}});return}const L=HU(P.target),M=n||D||b9,{connection:R,isValid:N}=aV({nodeId:b,id:p,type:e},A,E.nodeId,E.handleId||null,E.type,M,L);N&&w(R),O==null||O(P),_.setState({connectionClickStartHandle:null})};return W.jsx("div",{"data-handleid":p,"data-nodeid":b,"data-handlepos":t,"data-id":`${b}-${p}-${e}`,className:Ta(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",g,u,{source:!m,target:m,connectable:r,connectablestart:i,connectableend:o,connecting:S,connectionindicator:r&&(i&&!y||o&&y)}]),onMouseDown:x,onTouchStart:x,onClick:v?C:void 0,ref:h,...f,children:l})});lV.displayName="Handle";var M_=I.memo(lV);const uV=({data:e,isConnectable:t,targetPosition:n=tt.Top,sourcePosition:r=tt.Bottom})=>W.jsxs(W.Fragment,{children:[W.jsx(M_,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label,W.jsx(M_,{type:"source",position:r,isConnectable:t})]});uV.displayName="DefaultNode";var NE=I.memo(uV);const cV=({data:e,isConnectable:t,sourcePosition:n=tt.Bottom})=>W.jsxs(W.Fragment,{children:[e==null?void 0:e.label,W.jsx(M_,{type:"source",position:n,isConnectable:t})]});cV.displayName="InputNode";var dV=I.memo(cV);const fV=({data:e,isConnectable:t,targetPosition:n=tt.Top})=>W.jsxs(W.Fragment,{children:[W.jsx(M_,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label]});fV.displayName="OutputNode";var hV=I.memo(fV);const dA=()=>null;dA.displayName="GroupNode";const Mbe=e=>({selectedNodes:e.getNodes().filter(t=>t.selected),selectedEdges:e.edges.filter(t=>t.selected)}),Mv=e=>e.id;function Nbe(e,t){return Ro(e.selectedNodes.map(Mv),t.selectedNodes.map(Mv))&&Ro(e.selectedEdges.map(Mv),t.selectedEdges.map(Mv))}const pV=I.memo(({onSelectionChange:e})=>{const t=hi(),{selectedNodes:n,selectedEdges:r}=br(Mbe,Nbe);return I.useEffect(()=>{var o,a;const i={nodes:n,edges:r};e==null||e(i),(a=(o=t.getState()).onSelectionChange)==null||a.call(o,i)},[n,r,e]),null});pV.displayName="SelectionListener";const $be=e=>!!e.onSelectionChange;function Dbe({onSelectionChange:e}){const t=br($be);return e||t?W.jsx(pV,{onSelectionChange:e}):null}const Lbe=e=>({setNodes:e.setNodes,setEdges:e.setEdges,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset});function ff(e,t){I.useEffect(()=>{typeof e<"u"&&t(e)},[e])}function Ot(e,t,n){I.useEffect(()=>{typeof t<"u"&&n({[e]:t})},[t])}const Fbe=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:i,onConnectStart:o,onConnectEnd:a,onClickConnectStart:s,onClickConnectEnd:l,nodesDraggable:u,nodesConnectable:c,nodesFocusable:d,edgesFocusable:f,edgesUpdatable:h,elevateNodesOnSelect:p,minZoom:m,maxZoom:_,nodeExtent:b,onNodesChange:v,onEdgesChange:g,elementsSelectable:y,connectionMode:S,snapGrid:w,snapToGrid:x,translateExtent:C,connectOnClick:T,defaultEdgeOptions:k,fitView:P,fitViewOptions:$,onNodesDelete:O,onEdgesDelete:E,onNodeDrag:A,onNodeDragStart:D,onNodeDragStop:L,onSelectionDrag:M,onSelectionDragStart:R,onSelectionDragStop:N,noPanClassName:B,nodeOrigin:U,rfId:G,autoPanOnConnect:Y,autoPanOnNodeDrag:ee,onError:J,connectionRadius:j,isValidConnection:Q})=>{const{setNodes:ne,setEdges:se,setDefaultNodesAndEdges:ve,setMinZoom:ce,setMaxZoom:bt,setTranslateExtent:ot,setNodeExtent:ze,reset:gt}=br(Lbe,Ro),Pe=hi();return I.useEffect(()=>{const Jt=r==null?void 0:r.map(Ar=>({...Ar,...k}));return ve(n,Jt),()=>{gt()}},[]),Ot("defaultEdgeOptions",k,Pe.setState),Ot("connectionMode",S,Pe.setState),Ot("onConnect",i,Pe.setState),Ot("onConnectStart",o,Pe.setState),Ot("onConnectEnd",a,Pe.setState),Ot("onClickConnectStart",s,Pe.setState),Ot("onClickConnectEnd",l,Pe.setState),Ot("nodesDraggable",u,Pe.setState),Ot("nodesConnectable",c,Pe.setState),Ot("nodesFocusable",d,Pe.setState),Ot("edgesFocusable",f,Pe.setState),Ot("edgesUpdatable",h,Pe.setState),Ot("elementsSelectable",y,Pe.setState),Ot("elevateNodesOnSelect",p,Pe.setState),Ot("snapToGrid",x,Pe.setState),Ot("snapGrid",w,Pe.setState),Ot("onNodesChange",v,Pe.setState),Ot("onEdgesChange",g,Pe.setState),Ot("connectOnClick",T,Pe.setState),Ot("fitViewOnInit",P,Pe.setState),Ot("fitViewOnInitOptions",$,Pe.setState),Ot("onNodesDelete",O,Pe.setState),Ot("onEdgesDelete",E,Pe.setState),Ot("onNodeDrag",A,Pe.setState),Ot("onNodeDragStart",D,Pe.setState),Ot("onNodeDragStop",L,Pe.setState),Ot("onSelectionDrag",M,Pe.setState),Ot("onSelectionDragStart",R,Pe.setState),Ot("onSelectionDragStop",N,Pe.setState),Ot("noPanClassName",B,Pe.setState),Ot("nodeOrigin",U,Pe.setState),Ot("rfId",G,Pe.setState),Ot("autoPanOnConnect",Y,Pe.setState),Ot("autoPanOnNodeDrag",ee,Pe.setState),Ot("onError",J,Pe.setState),Ot("connectionRadius",j,Pe.setState),Ot("isValidConnection",Q,Pe.setState),ff(e,ne),ff(t,se),ff(m,ce),ff(_,bt),ff(C,ot),ff(b,ze),null},_9={display:"none"},Bbe={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},gV="react-flow__node-desc",mV="react-flow__edge-desc",zbe="react-flow__aria-live",jbe=e=>e.ariaLiveMessage;function Ube({rfId:e}){const t=br(jbe);return W.jsx("div",{id:`${zbe}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:Bbe,children:t})}function Vbe({rfId:e,disableKeyboardA11y:t}){return W.jsxs(W.Fragment,{children:[W.jsxs("div",{id:`${gV}-${e}`,style:_9,children:["Press enter or space to select a node.",!t&&"You can then use the arrow keys to move the node around."," Press delete to remove it and escape to cancel."," "]}),W.jsx("div",{id:`${mV}-${e}`,style:_9,children:"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel."}),!t&&W.jsx(Ube,{rfId:e})]})}const Gbe=typeof document<"u"?document:null;var p0=(e=null,t={target:Gbe})=>{const[n,r]=I.useState(!1),i=I.useRef(!1),o=I.useRef(new Set([])),[a,s]=I.useMemo(()=>{if(e!==null){const u=(Array.isArray(e)?e:[e]).filter(d=>typeof d=="string").map(d=>d.split("+")),c=u.reduce((d,f)=>d.concat(...f),[]);return[u,c]}return[[],[]]},[e]);return I.useEffect(()=>{var l,u;if(e!==null){const c=h=>{if(i.current=h.ctrlKey||h.metaKey||h.shiftKey,!i.current&&RE(h))return!1;const p=x9(h.code,s);o.current.add(h[p]),S9(a,o.current,!1)&&(h.preventDefault(),r(!0))},d=h=>{if(!i.current&&RE(h))return!1;const p=x9(h.code,s);S9(a,o.current,!0)?(r(!1),o.current.clear()):o.current.delete(h[p]),h.key==="Meta"&&o.current.clear(),i.current=!1},f=()=>{o.current.clear(),r(!1)};return(l=t==null?void 0:t.target)==null||l.addEventListener("keydown",c),(u=t==null?void 0:t.target)==null||u.addEventListener("keyup",d),window.addEventListener("blur",f),()=>{var h,p;(h=t==null?void 0:t.target)==null||h.removeEventListener("keydown",c),(p=t==null?void 0:t.target)==null||p.removeEventListener("keyup",d),window.removeEventListener("blur",f)}}},[e,r]),n};function S9(e,t,n){return e.filter(r=>n||r.length===t.size).some(r=>r.every(i=>t.has(i)))}function x9(e,t){return t.includes(e)?"code":"key"}function yV(e,t,n,r){var a,s;if(!e.parentNode)return n;const i=t.get(e.parentNode),o=yh(i,r);return yV(i,t,{x:(n.x??0)+o.x,y:(n.y??0)+o.y,z:(((a=i[Kr])==null?void 0:a.z)??0)>(n.z??0)?((s=i[Kr])==null?void 0:s.z)??0:n.z??0},r)}function vV(e,t,n){e.forEach(r=>{var i;if(r.parentNode&&!e.has(r.parentNode))throw new Error(`Parent node ${r.parentNode} not found`);if(r.parentNode||n!=null&&n[r.id]){const{x:o,y:a,z:s}=yV(r,e,{...r.position,z:((i=r[Kr])==null?void 0:i.z)??0},t);r.positionAbsolute={x:o,y:a},r[Kr].z=s,n!=null&&n[r.id]&&(r[Kr].isParent=!0)}})}function LC(e,t,n,r){const i=new Map,o={},a=r?1e3:0;return e.forEach(s=>{var d;const l=(ba(s.zIndex)?s.zIndex:0)+(s.selected?a:0),u=t.get(s.id),c={width:u==null?void 0:u.width,height:u==null?void 0:u.height,...s,positionAbsolute:{x:s.position.x,y:s.position.y}};s.parentNode&&(c.parentNode=s.parentNode,o[s.parentNode]=!0),Object.defineProperty(c,Kr,{enumerable:!1,value:{handleBounds:(d=u==null?void 0:u[Kr])==null?void 0:d.handleBounds,z:l}}),i.set(s.id,c)}),vV(i,n,o),i}function bV(e,t={}){const{getNodes:n,width:r,height:i,minZoom:o,maxZoom:a,d3Zoom:s,d3Selection:l,fitViewOnInitDone:u,fitViewOnInit:c,nodeOrigin:d}=e(),f=t.initial&&!u&&c;if(s&&l&&(f||!t.initial)){const p=n().filter(_=>{var v;const b=t.includeHiddenNodes?_.width&&_.height:!_.hidden;return(v=t.nodes)!=null&&v.length?b&&t.nodes.some(g=>g.id===_.id):b}),m=p.every(_=>_.width&&_.height);if(p.length>0&&m){const _=lA(p,d),[b,v,g]=iV(_,r,i,t.minZoom??o,t.maxZoom??a,t.padding??.1),y=Ku.translate(b,v).scale(g);return typeof t.duration=="number"&&t.duration>0?s.transform(jc(l,t.duration),y):s.transform(l,y),!0}}return!1}function Hbe(e,t){return e.forEach(n=>{const r=t.get(n.id);r&&t.set(r.id,{...r,[Kr]:r[Kr],selected:n.selected})}),new Map(t)}function qbe(e,t){return t.map(n=>{const r=e.find(i=>i.id===n.id);return r&&(n.selected=r.selected),n})}function Nv({changedNodes:e,changedEdges:t,get:n,set:r}){const{nodeInternals:i,edges:o,onNodesChange:a,onEdgesChange:s,hasDefaultNodes:l,hasDefaultEdges:u}=n();e!=null&&e.length&&(l&&r({nodeInternals:Hbe(e,i)}),a==null||a(e)),t!=null&&t.length&&(u&&r({edges:qbe(t,o)}),s==null||s(t))}const hf=()=>{},Wbe={zoomIn:hf,zoomOut:hf,zoomTo:hf,getZoom:()=>1,setViewport:hf,getViewport:()=>({x:0,y:0,zoom:1}),fitView:()=>!1,setCenter:hf,fitBounds:hf,project:e=>e,viewportInitialized:!1},Kbe=e=>({d3Zoom:e.d3Zoom,d3Selection:e.d3Selection}),Qbe=()=>{const e=hi(),{d3Zoom:t,d3Selection:n}=br(Kbe,Ro);return I.useMemo(()=>n&&t?{zoomIn:i=>t.scaleBy(jc(n,i==null?void 0:i.duration),1.2),zoomOut:i=>t.scaleBy(jc(n,i==null?void 0:i.duration),1/1.2),zoomTo:(i,o)=>t.scaleTo(jc(n,o==null?void 0:o.duration),i),getZoom:()=>e.getState().transform[2],setViewport:(i,o)=>{const[a,s,l]=e.getState().transform,u=Ku.translate(i.x??a,i.y??s).scale(i.zoom??l);t.transform(jc(n,o==null?void 0:o.duration),u)},getViewport:()=>{const[i,o,a]=e.getState().transform;return{x:i,y:o,zoom:a}},fitView:i=>bV(e.getState,i),setCenter:(i,o,a)=>{const{width:s,height:l,maxZoom:u}=e.getState(),c=typeof(a==null?void 0:a.zoom)<"u"?a.zoom:u,d=s/2-i*c,f=l/2-o*c,h=Ku.translate(d,f).scale(c);t.transform(jc(n,a==null?void 0:a.duration),h)},fitBounds:(i,o)=>{const{width:a,height:s,minZoom:l,maxZoom:u}=e.getState(),[c,d,f]=iV(i,a,s,l,u,(o==null?void 0:o.padding)??.1),h=Ku.translate(c,d).scale(f);t.transform(jc(n,o==null?void 0:o.duration),h)},project:i=>{const{transform:o,snapToGrid:a,snapGrid:s}=e.getState();return nV(i,o,a,s)},viewportInitialized:!0}:Wbe,[t,n])};function _V(){const e=Qbe(),t=hi(),n=I.useCallback(()=>t.getState().getNodes().map(m=>({...m})),[]),r=I.useCallback(m=>t.getState().nodeInternals.get(m),[]),i=I.useCallback(()=>{const{edges:m=[]}=t.getState();return m.map(_=>({..._}))},[]),o=I.useCallback(m=>{const{edges:_=[]}=t.getState();return _.find(b=>b.id===m)},[]),a=I.useCallback(m=>{const{getNodes:_,setNodes:b,hasDefaultNodes:v,onNodesChange:g}=t.getState(),y=_(),S=typeof m=="function"?m(y):m;if(v)b(S);else if(g){const w=S.length===0?y.map(x=>({type:"remove",id:x.id})):S.map(x=>({item:x,type:"reset"}));g(w)}},[]),s=I.useCallback(m=>{const{edges:_=[],setEdges:b,hasDefaultEdges:v,onEdgesChange:g}=t.getState(),y=typeof m=="function"?m(_):m;if(v)b(y);else if(g){const S=y.length===0?_.map(w=>({type:"remove",id:w.id})):y.map(w=>({item:w,type:"reset"}));g(S)}},[]),l=I.useCallback(m=>{const _=Array.isArray(m)?m:[m],{getNodes:b,setNodes:v,hasDefaultNodes:g,onNodesChange:y}=t.getState();if(g){const w=[...b(),..._];v(w)}else if(y){const S=_.map(w=>({item:w,type:"add"}));y(S)}},[]),u=I.useCallback(m=>{const _=Array.isArray(m)?m:[m],{edges:b=[],setEdges:v,hasDefaultEdges:g,onEdgesChange:y}=t.getState();if(g)v([...b,..._]);else if(y){const S=_.map(w=>({item:w,type:"add"}));y(S)}},[]),c=I.useCallback(()=>{const{getNodes:m,edges:_=[],transform:b}=t.getState(),[v,g,y]=b;return{nodes:m().map(S=>({...S})),edges:_.map(S=>({...S})),viewport:{x:v,y:g,zoom:y}}},[]),d=I.useCallback(({nodes:m,edges:_})=>{const{nodeInternals:b,getNodes:v,edges:g,hasDefaultNodes:y,hasDefaultEdges:S,onNodesDelete:w,onEdgesDelete:x,onNodesChange:C,onEdgesChange:T}=t.getState(),k=(m||[]).map(A=>A.id),P=(_||[]).map(A=>A.id),$=v().reduce((A,D)=>{const L=!k.includes(D.id)&&D.parentNode&&A.find(R=>R.id===D.parentNode);return(typeof D.deletable=="boolean"?D.deletable:!0)&&(k.includes(D.id)||L)&&A.push(D),A},[]),O=g.filter(A=>typeof A.deletable=="boolean"?A.deletable:!0),E=O.filter(A=>P.includes(A.id));if($||E){const A=uA($,O),D=[...E,...A],L=D.reduce((M,R)=>(M.includes(R.id)||M.push(R.id),M),[]);if((S||y)&&(S&&t.setState({edges:g.filter(M=>!L.includes(M.id))}),y&&($.forEach(M=>{b.delete(M.id)}),t.setState({nodeInternals:new Map(b)}))),L.length>0&&(x==null||x(D),T&&T(L.map(M=>({id:M,type:"remove"})))),$.length>0&&(w==null||w($),C)){const M=$.map(R=>({id:R.id,type:"remove"}));C(M)}}},[]),f=I.useCallback(m=>{const _=fbe(m),b=_?null:t.getState().nodeInternals.get(m.id);return[_?m:h9(b),b,_]},[]),h=I.useCallback((m,_=!0,b)=>{const[v,g,y]=f(m);return v?(b||t.getState().getNodes()).filter(S=>{if(!y&&(S.id===g.id||!S.positionAbsolute))return!1;const w=h9(S),x=IE(w,v);return _&&x>0||x>=m.width*m.height}):[]},[]),p=I.useCallback((m,_,b=!0)=>{const[v]=f(m);if(!v)return!1;const g=IE(v,_);return b&&g>0||g>=m.width*m.height},[]);return I.useMemo(()=>({...e,getNodes:n,getNode:r,getEdges:i,getEdge:o,setNodes:a,setEdges:s,addNodes:l,addEdges:u,toObject:c,deleteElements:d,getIntersectingNodes:h,isNodeIntersecting:p}),[e,n,r,i,o,a,s,l,u,c,d,h,p])}var Xbe=({deleteKeyCode:e,multiSelectionKeyCode:t})=>{const n=hi(),{deleteElements:r}=_V(),i=p0(e),o=p0(t);I.useEffect(()=>{if(i){const{edges:a,getNodes:s}=n.getState(),l=s().filter(c=>c.selected),u=a.filter(c=>c.selected);r({nodes:l,edges:u}),n.setState({nodesSelectionActive:!1})}},[i]),I.useEffect(()=>{n.setState({multiSelectionActive:o})},[o])};function Ybe(e){const t=hi();I.useEffect(()=>{let n;const r=()=>{var o,a;if(!e.current)return;const i=nA(e.current);(i.height===0||i.width===0)&&((a=(o=t.getState()).onError)==null||a.call(o,"004",Wl.error004())),t.setState({width:i.width||500,height:i.height||500})};return r(),window.addEventListener("resize",r),e.current&&(n=new ResizeObserver(()=>r()),n.observe(e.current)),()=>{window.removeEventListener("resize",r),n&&e.current&&n.unobserve(e.current)}},[])}const fA={position:"absolute",width:"100%",height:"100%",top:0,left:0},Zbe=(e,t)=>e.x!==t.x||e.y!==t.y||e.zoom!==t.k,$v=e=>({x:e.x,y:e.y,zoom:e.k}),pf=(e,t)=>e.target.closest(`.${t}`),w9=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),C9=e=>{const t=e.ctrlKey&&I_()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t},Jbe=e=>({d3Zoom:e.d3Zoom,d3Selection:e.d3Selection,d3ZoomHandler:e.d3ZoomHandler,userSelectionActive:e.userSelectionActive}),e_e=({onMove:e,onMoveStart:t,onMoveEnd:n,onPaneContextMenu:r,zoomOnScroll:i=!0,zoomOnPinch:o=!0,panOnScroll:a=!1,panOnScrollSpeed:s=.5,panOnScrollMode:l=od.Free,zoomOnDoubleClick:u=!0,elementsSelectable:c,panOnDrag:d=!0,defaultViewport:f,translateExtent:h,minZoom:p,maxZoom:m,zoomActivationKeyCode:_,preventScrolling:b=!0,children:v,noWheelClassName:g,noPanClassName:y})=>{const S=I.useRef(),w=hi(),x=I.useRef(!1),C=I.useRef(!1),T=I.useRef(null),k=I.useRef({x:0,y:0,zoom:0}),{d3Zoom:P,d3Selection:$,d3ZoomHandler:O,userSelectionActive:E}=br(Jbe,Ro),A=p0(_),D=I.useRef(0),L=I.useRef(!1),M=I.useRef();return Ybe(T),I.useEffect(()=>{if(T.current){const R=T.current.getBoundingClientRect(),N=obe().scaleExtent([p,m]).translateExtent(h),B=Wa(T.current).call(N),U=Ku.translate(f.x,f.y).scale(np(f.zoom,p,m)),G=[[0,0],[R.width,R.height]],Y=N.constrain()(U,G,h);N.transform(B,Y),N.wheelDelta(C9),w.setState({d3Zoom:N,d3Selection:B,d3ZoomHandler:B.on("wheel.zoom"),transform:[Y.x,Y.y,Y.k],domNode:T.current.closest(".react-flow")})}},[]),I.useEffect(()=>{$&&P&&(a&&!A&&!E?$.on("wheel.zoom",R=>{if(pf(R,g))return!1;R.preventDefault(),R.stopImmediatePropagation();const N=$.property("__zoom").k||1,B=I_();if(R.ctrlKey&&o&&B){const ne=xs(R),se=C9(R),ve=N*Math.pow(2,se);P.scaleTo($,ve,ne,R);return}const U=R.deltaMode===1?20:1;let G=l===od.Vertical?0:R.deltaX*U,Y=l===od.Horizontal?0:R.deltaY*U;!B&&R.shiftKey&&l!==od.Vertical&&(G=R.deltaY*U,Y=0),P.translateBy($,-(G/N)*s,-(Y/N)*s,{internal:!0});const ee=$v($.property("__zoom")),{onViewportChangeStart:J,onViewportChange:j,onViewportChangeEnd:Q}=w.getState();clearTimeout(M.current),L.current||(L.current=!0,t==null||t(R,ee),J==null||J(ee)),L.current&&(e==null||e(R,ee),j==null||j(ee),M.current=setTimeout(()=>{n==null||n(R,ee),Q==null||Q(ee),L.current=!1},150))},{passive:!1}):typeof O<"u"&&$.on("wheel.zoom",function(R,N){if(!b||pf(R,g))return null;R.preventDefault(),O.call(this,R,N)},{passive:!1}))},[E,a,l,$,P,O,A,o,b,g,t,e,n]),I.useEffect(()=>{P&&P.on("start",R=>{var U,G;if(!R.sourceEvent||R.sourceEvent.internal)return null;D.current=(U=R.sourceEvent)==null?void 0:U.button;const{onViewportChangeStart:N}=w.getState(),B=$v(R.transform);x.current=!0,k.current=B,((G=R.sourceEvent)==null?void 0:G.type)==="mousedown"&&w.setState({paneDragging:!0}),N==null||N(B),t==null||t(R.sourceEvent,B)})},[P,t]),I.useEffect(()=>{P&&(E&&!x.current?P.on("zoom",null):E||P.on("zoom",R=>{var B;const{onViewportChange:N}=w.getState();if(w.setState({transform:[R.transform.x,R.transform.y,R.transform.k]}),C.current=!!(r&&w9(d,D.current??0)),(e||N)&&!((B=R.sourceEvent)!=null&&B.internal)){const U=$v(R.transform);N==null||N(U),e==null||e(R.sourceEvent,U)}}))},[E,P,e,d,r]),I.useEffect(()=>{P&&P.on("end",R=>{if(!R.sourceEvent||R.sourceEvent.internal)return null;const{onViewportChangeEnd:N}=w.getState();if(x.current=!1,w.setState({paneDragging:!1}),r&&w9(d,D.current??0)&&!C.current&&r(R.sourceEvent),C.current=!1,(n||N)&&Zbe(k.current,R.transform)){const B=$v(R.transform);k.current=B,clearTimeout(S.current),S.current=setTimeout(()=>{N==null||N(B),n==null||n(R.sourceEvent,B)},a?150:0)}})},[P,a,d,n,r]),I.useEffect(()=>{P&&P.filter(R=>{const N=A||i,B=o&&R.ctrlKey;if(R.button===1&&R.type==="mousedown"&&(pf(R,"react-flow__node")||pf(R,"react-flow__edge")))return!0;if(!d&&!N&&!a&&!u&&!o||E||!u&&R.type==="dblclick"||pf(R,g)&&R.type==="wheel"||pf(R,y)&&R.type!=="wheel"||!o&&R.ctrlKey&&R.type==="wheel"||!N&&!a&&!B&&R.type==="wheel"||!d&&(R.type==="mousedown"||R.type==="touchstart")||Array.isArray(d)&&!d.includes(R.button)&&(R.type==="mousedown"||R.type==="touchstart"))return!1;const U=Array.isArray(d)&&d.includes(R.button)||!R.button||R.button<=1;return(!R.ctrlKey||R.type==="wheel")&&U})},[E,P,i,o,a,u,d,c,A]),W.jsx("div",{className:"react-flow__renderer",ref:T,style:fA,children:v})},t_e=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function n_e(){const{userSelectionActive:e,userSelectionRect:t}=br(t_e,Ro);return e&&t?W.jsx("div",{className:"react-flow__selection react-flow__container",style:{width:t.width,height:t.height,transform:`translate(${t.x}px, ${t.y}px)`}}):null}function E9(e,t){const n=e.find(r=>r.id===t.parentNode);if(n){const r=t.position.x+t.width-n.width,i=t.position.y+t.height-n.height;if(r>0||i>0||t.position.x<0||t.position.y<0){if(n.style={...n.style},n.style.width=n.style.width??n.width,n.style.height=n.style.height??n.height,r>0&&(n.style.width+=r),i>0&&(n.style.height+=i),t.position.x<0){const o=Math.abs(t.position.x);n.position.x=n.position.x-o,n.style.width+=o,t.position.x=0}if(t.position.y<0){const o=Math.abs(t.position.y);n.position.y=n.position.y-o,n.style.height+=o,t.position.y=0}n.width=n.style.width,n.height=n.style.height}}}function SV(e,t){if(e.some(r=>r.type==="reset"))return e.filter(r=>r.type==="reset").map(r=>r.item);const n=e.filter(r=>r.type==="add").map(r=>r.item);return t.reduce((r,i)=>{const o=e.filter(s=>s.id===i.id);if(o.length===0)return r.push(i),r;const a={...i};for(const s of o)if(s)switch(s.type){case"select":{a.selected=s.selected;break}case"position":{typeof s.position<"u"&&(a.position=s.position),typeof s.positionAbsolute<"u"&&(a.positionAbsolute=s.positionAbsolute),typeof s.dragging<"u"&&(a.dragging=s.dragging),a.expandParent&&E9(r,a);break}case"dimensions":{typeof s.dimensions<"u"&&(a.width=s.dimensions.width,a.height=s.dimensions.height),typeof s.updateStyle<"u"&&(a.style={...a.style||{},...s.dimensions}),typeof s.resizing=="boolean"&&(a.resizing=s.resizing),a.expandParent&&E9(r,a);break}case"remove":return r}return r.push(a),r},n)}function Uc(e,t){return SV(e,t)}function Rc(e,t){return SV(e,t)}const vu=(e,t)=>({id:e,type:"select",selected:t});function jf(e,t){return e.reduce((n,r)=>{const i=t.includes(r.id);return!r.selected&&i?(r.selected=!0,n.push(vu(r.id,!0))):r.selected&&!i&&(r.selected=!1,n.push(vu(r.id,!1))),n},[])}const FC=(e,t)=>n=>{n.target===t.current&&(e==null||e(n))},r_e=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,dragging:e.paneDragging}),xV=I.memo(({isSelecting:e,selectionMode:t=sc.Full,panOnDrag:n,onSelectionStart:r,onSelectionEnd:i,onPaneClick:o,onPaneContextMenu:a,onPaneScroll:s,onPaneMouseEnter:l,onPaneMouseMove:u,onPaneMouseLeave:c,children:d})=>{const f=I.useRef(null),h=hi(),p=I.useRef(0),m=I.useRef(0),_=I.useRef(),{userSelectionActive:b,elementsSelectable:v,dragging:g}=br(r_e,Ro),y=()=>{h.setState({userSelectionActive:!1,userSelectionRect:null}),p.current=0,m.current=0},S=O=>{o==null||o(O),h.getState().resetSelectedElements(),h.setState({nodesSelectionActive:!1})},w=O=>{if(Array.isArray(n)&&(n!=null&&n.includes(2))){O.preventDefault();return}a==null||a(O)},x=s?O=>s(O):void 0,C=O=>{const{resetSelectedElements:E,domNode:A}=h.getState();if(_.current=A==null?void 0:A.getBoundingClientRect(),!v||!e||O.button!==0||O.target!==f.current||!_.current)return;const{x:D,y:L}=Qu(O,_.current);E(),h.setState({userSelectionRect:{width:0,height:0,startX:D,startY:L,x:D,y:L}}),r==null||r(O)},T=O=>{const{userSelectionRect:E,nodeInternals:A,edges:D,transform:L,onNodesChange:M,onEdgesChange:R,nodeOrigin:N,getNodes:B}=h.getState();if(!e||!_.current||!E)return;h.setState({userSelectionActive:!0,nodesSelectionActive:!1});const U=Qu(O,_.current),G=E.startX??0,Y=E.startY??0,ee={...E,x:U.xse.id),ne=j.map(se=>se.id);if(p.current!==ne.length){p.current=ne.length;const se=jf(J,ne);se.length&&(M==null||M(se))}if(m.current!==Q.length){m.current=Q.length;const se=jf(D,Q);se.length&&(R==null||R(se))}h.setState({userSelectionRect:ee})},k=O=>{if(O.button!==0)return;const{userSelectionRect:E}=h.getState();!b&&E&&O.target===f.current&&(S==null||S(O)),h.setState({nodesSelectionActive:p.current>0}),y(),i==null||i(O)},P=O=>{b&&(h.setState({nodesSelectionActive:p.current>0}),i==null||i(O)),y()},$=v&&(e||b);return W.jsxs("div",{className:Ta(["react-flow__pane",{dragging:g,selection:e}]),onClick:$?void 0:FC(S,f),onContextMenu:FC(w,f),onWheel:FC(x,f),onMouseEnter:$?void 0:l,onMouseDown:$?C:void 0,onMouseMove:$?T:u,onMouseUp:$?k:void 0,onMouseLeave:$?P:c,ref:f,style:fA,children:[d,W.jsx(n_e,{})]})});xV.displayName="Pane";function wV(e,t){if(!e.parentNode)return!1;const n=t.get(e.parentNode);return n?n.selected?!0:wV(n,t):!1}function k9(e,t,n){let r=e;do{if(r!=null&&r.matches(t))return!0;if(r===n.current)return!1;r=r.parentElement}while(r);return!1}function i_e(e,t,n,r){return Array.from(e.values()).filter(i=>(i.selected||i.id===r)&&(!i.parentNode||!wV(i,e))&&(i.draggable||t&&typeof i.draggable>"u")).map(i=>{var o,a;return{id:i.id,position:i.position||{x:0,y:0},positionAbsolute:i.positionAbsolute||{x:0,y:0},distance:{x:n.x-(((o=i.positionAbsolute)==null?void 0:o.x)??0),y:n.y-(((a=i.positionAbsolute)==null?void 0:a.y)??0)},delta:{x:0,y:0},extent:i.extent,parentNode:i.parentNode,width:i.width,height:i.height}})}function o_e(e,t){return!t||t==="parent"?t:[t[0],[t[1][0]-(e.width||0),t[1][1]-(e.height||0)]]}function CV(e,t,n,r,i=[0,0],o){const a=o_e(e,e.extent||r);let s=a;if(e.extent==="parent")if(e.parentNode&&e.width&&e.height){const c=n.get(e.parentNode),{x:d,y:f}=yh(c,i).positionAbsolute;s=c&&ba(d)&&ba(f)&&ba(c.width)&&ba(c.height)?[[d+e.width*i[0],f+e.height*i[1]],[d+c.width-e.width+e.width*i[0],f+c.height-e.height+e.height*i[1]]]:s}else o==null||o("005",Wl.error005()),s=a;else if(e.extent&&e.parentNode){const c=n.get(e.parentNode),{x:d,y:f}=yh(c,i).positionAbsolute;s=[[e.extent[0][0]+d,e.extent[0][1]+f],[e.extent[1][0]+d,e.extent[1][1]+f]]}let l={x:0,y:0};if(e.parentNode){const c=n.get(e.parentNode);l=yh(c,i).positionAbsolute}const u=s&&s!=="parent"?rA(t,s):t;return{position:{x:u.x-l.x,y:u.y-l.y},positionAbsolute:u}}function BC({nodeId:e,dragItems:t,nodeInternals:n}){const r=t.map(i=>({...n.get(i.id),position:i.position,positionAbsolute:i.positionAbsolute}));return[e?r.find(i=>i.id===e):r[0],r]}const T9=(e,t,n,r)=>{const i=t.querySelectorAll(e);if(!i||!i.length)return null;const o=Array.from(i),a=t.getBoundingClientRect(),s={x:a.width*r[0],y:a.height*r[1]};return o.map(l=>{const u=l.getBoundingClientRect();return{id:l.getAttribute("data-handleid"),position:l.getAttribute("data-handlepos"),x:(u.left-a.left-s.x)/n,y:(u.top-a.top-s.y)/n,...nA(l)}})};function Yp(e,t,n){return n===void 0?n:r=>{const i=t().nodeInternals.get(e);i&&n(r,{...i})}}function $E({id:e,store:t,unselect:n=!1,nodeRef:r}){const{addSelectedNodes:i,unselectNodesAndEdges:o,multiSelectionActive:a,nodeInternals:s,onError:l}=t.getState(),u=s.get(e);if(!u){l==null||l("012",Wl.error012(e));return}t.setState({nodesSelectionActive:!1}),u.selected?(n||u.selected&&a)&&(o({nodes:[u]}),requestAnimationFrame(()=>{var c;return(c=r==null?void 0:r.current)==null?void 0:c.blur()})):i([e])}function a_e(){const e=hi();return I.useCallback(({sourceEvent:n})=>{const{transform:r,snapGrid:i,snapToGrid:o}=e.getState(),a=n.touches?n.touches[0].clientX:n.clientX,s=n.touches?n.touches[0].clientY:n.clientY,l={x:(a-r[0])/r[2],y:(s-r[1])/r[2]};return{xSnapped:o?i[0]*Math.round(l.x/i[0]):l.x,ySnapped:o?i[1]*Math.round(l.y/i[1]):l.y,...l}},[])}function zC(e){return(t,n,r)=>e==null?void 0:e(t,r)}function EV({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:r,nodeId:i,isSelectable:o,selectNodesOnDrag:a}){const s=hi(),[l,u]=I.useState(!1),c=I.useRef([]),d=I.useRef({x:null,y:null}),f=I.useRef(0),h=I.useRef(null),p=I.useRef({x:0,y:0}),m=I.useRef(null),_=I.useRef(!1),b=a_e();return I.useEffect(()=>{if(e!=null&&e.current){const v=Wa(e.current),g=({x:S,y:w})=>{const{nodeInternals:x,onNodeDrag:C,onSelectionDrag:T,updateNodePositions:k,nodeExtent:P,snapGrid:$,snapToGrid:O,nodeOrigin:E,onError:A}=s.getState();d.current={x:S,y:w};let D=!1,L={x:0,y:0,x2:0,y2:0};if(c.current.length>1&&P){const R=lA(c.current,E);L=h0(R)}if(c.current=c.current.map(R=>{const N={x:S-R.distance.x,y:w-R.distance.y};O&&(N.x=$[0]*Math.round(N.x/$[0]),N.y=$[1]*Math.round(N.y/$[1]));const B=[[P[0][0],P[0][1]],[P[1][0],P[1][1]]];c.current.length>1&&P&&!R.extent&&(B[0][0]=R.positionAbsolute.x-L.x+P[0][0],B[1][0]=R.positionAbsolute.x+(R.width??0)-L.x2+P[1][0],B[0][1]=R.positionAbsolute.y-L.y+P[0][1],B[1][1]=R.positionAbsolute.y+(R.height??0)-L.y2+P[1][1]);const U=CV(R,N,x,B,E,A);return D=D||R.position.x!==U.position.x||R.position.y!==U.position.y,R.position=U.position,R.positionAbsolute=U.positionAbsolute,R}),!D)return;k(c.current,!0,!0),u(!0);const M=i?C:zC(T);if(M&&m.current){const[R,N]=BC({nodeId:i,dragItems:c.current,nodeInternals:x});M(m.current,R,N)}},y=()=>{if(!h.current)return;const[S,w]=GU(p.current,h.current);if(S!==0||w!==0){const{transform:x,panBy:C}=s.getState();d.current.x=(d.current.x??0)-S/x[2],d.current.y=(d.current.y??0)-w/x[2],C({x:S,y:w})&&g(d.current)}f.current=requestAnimationFrame(y)};if(t)v.on(".drag",null);else{const S=gve().on("start",w=>{var D;const{nodeInternals:x,multiSelectionActive:C,domNode:T,nodesDraggable:k,unselectNodesAndEdges:P,onNodeDragStart:$,onSelectionDragStart:O}=s.getState(),E=i?$:zC(O);!a&&!C&&i&&((D=x.get(i))!=null&&D.selected||P()),i&&o&&a&&$E({id:i,store:s,nodeRef:e});const A=b(w);if(d.current=A,c.current=i_e(x,k,A,i),E&&c.current){const[L,M]=BC({nodeId:i,dragItems:c.current,nodeInternals:x});E(w.sourceEvent,L,M)}h.current=(T==null?void 0:T.getBoundingClientRect())||null,p.current=Qu(w.sourceEvent,h.current)}).on("drag",w=>{const x=b(w),{autoPanOnNodeDrag:C}=s.getState();!_.current&&C&&(_.current=!0,y()),(d.current.x!==x.xSnapped||d.current.y!==x.ySnapped)&&c.current&&(m.current=w.sourceEvent,p.current=Qu(w.sourceEvent,h.current),g(x))}).on("end",w=>{if(u(!1),_.current=!1,cancelAnimationFrame(f.current),c.current){const{updateNodePositions:x,nodeInternals:C,onNodeDragStop:T,onSelectionDragStop:k}=s.getState(),P=i?T:zC(k);if(x(c.current,!1,!1),P){const[$,O]=BC({nodeId:i,dragItems:c.current,nodeInternals:C});P(w.sourceEvent,$,O)}}}).filter(w=>{const x=w.target;return!w.button&&(!n||!k9(x,`.${n}`,e))&&(!r||k9(x,r,e))});return v.call(S),()=>{v.on(".drag",null)}}}},[e,t,n,r,o,s,i,a,b]),l}function kV(){const e=hi();return I.useCallback(n=>{const{nodeInternals:r,nodeExtent:i,updateNodePositions:o,getNodes:a,snapToGrid:s,snapGrid:l,onError:u,nodesDraggable:c}=e.getState(),d=a().filter(v=>v.selected&&(v.draggable||c&&typeof v.draggable>"u")),f=s?l[0]:5,h=s?l[1]:5,p=n.isShiftPressed?4:1,m=n.x*f*p,_=n.y*h*p,b=d.map(v=>{if(v.positionAbsolute){const g={x:v.positionAbsolute.x+m,y:v.positionAbsolute.y+_};s&&(g.x=l[0]*Math.round(g.x/l[0]),g.y=l[1]*Math.round(g.y/l[1]));const{positionAbsolute:y,position:S}=CV(v,g,r,i,void 0,u);v.position=S,v.positionAbsolute=y}return v});o(b,!0,!1)},[])}const vh={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};var Zp=e=>{const t=({id:n,type:r,data:i,xPos:o,yPos:a,xPosOrigin:s,yPosOrigin:l,selected:u,onClick:c,onMouseEnter:d,onMouseMove:f,onMouseLeave:h,onContextMenu:p,onDoubleClick:m,style:_,className:b,isDraggable:v,isSelectable:g,isConnectable:y,isFocusable:S,selectNodesOnDrag:w,sourcePosition:x,targetPosition:C,hidden:T,resizeObserver:k,dragHandle:P,zIndex:$,isParent:O,noDragClassName:E,noPanClassName:A,initialized:D,disableKeyboardA11y:L,ariaLabel:M,rfId:R})=>{const N=hi(),B=I.useRef(null),U=I.useRef(x),G=I.useRef(C),Y=I.useRef(r),ee=g||v||c||d||f||h,J=kV(),j=Yp(n,N.getState,d),Q=Yp(n,N.getState,f),ne=Yp(n,N.getState,h),se=Yp(n,N.getState,p),ve=Yp(n,N.getState,m),ce=ze=>{if(g&&(!w||!v)&&$E({id:n,store:N,nodeRef:B}),c){const gt=N.getState().nodeInternals.get(n);gt&&c(ze,{...gt})}},bt=ze=>{if(!RE(ze))if(KU.includes(ze.key)&&g){const gt=ze.key==="Escape";$E({id:n,store:N,unselect:gt,nodeRef:B})}else!L&&v&&u&&Object.prototype.hasOwnProperty.call(vh,ze.key)&&(N.setState({ariaLiveMessage:`Moved selected node ${ze.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~o}, y: ${~~a}`}),J({x:vh[ze.key].x,y:vh[ze.key].y,isShiftPressed:ze.shiftKey}))};I.useEffect(()=>{if(B.current&&!T){const ze=B.current;return k==null||k.observe(ze),()=>k==null?void 0:k.unobserve(ze)}},[T]),I.useEffect(()=>{const ze=Y.current!==r,gt=U.current!==x,Pe=G.current!==C;B.current&&(ze||gt||Pe)&&(ze&&(Y.current=r),gt&&(U.current=x),Pe&&(G.current=C),N.getState().updateNodeDimensions([{id:n,nodeElement:B.current,forceUpdate:!0}]))},[n,r,x,C]);const ot=EV({nodeRef:B,disabled:T||!v,noDragClassName:E,handleSelector:P,nodeId:n,isSelectable:g,selectNodesOnDrag:w});return T?null:W.jsx("div",{className:Ta(["react-flow__node",`react-flow__node-${r}`,{[A]:v},b,{selected:u,selectable:g,parent:O,dragging:ot}]),ref:B,style:{zIndex:$,transform:`translate(${s}px,${l}px)`,pointerEvents:ee?"all":"none",visibility:D?"visible":"hidden",..._},"data-id":n,"data-testid":`rf__node-${n}`,onMouseEnter:j,onMouseMove:Q,onMouseLeave:ne,onContextMenu:se,onClick:ce,onDoubleClick:ve,onKeyDown:S?bt:void 0,tabIndex:S?0:void 0,role:S?"button":void 0,"aria-describedby":L?void 0:`${gV}-${R}`,"aria-label":M,children:W.jsx(bbe,{value:n,children:W.jsx(e,{id:n,data:i,type:r,xPos:o,yPos:a,selected:u,isConnectable:y,sourcePosition:x,targetPosition:C,dragging:ot,dragHandle:P,zIndex:$})})})};return t.displayName="NodeWrapper",I.memo(t)};const s_e=e=>{const t=e.getNodes().filter(n=>n.selected);return{...lA(t,e.nodeOrigin),transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`,userSelectionActive:e.userSelectionActive}};function l_e({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const r=hi(),{width:i,height:o,x:a,y:s,transformString:l,userSelectionActive:u}=br(s_e,Ro),c=kV(),d=I.useRef(null);if(I.useEffect(()=>{var p;n||(p=d.current)==null||p.focus({preventScroll:!0})},[n]),EV({nodeRef:d}),u||!i||!o)return null;const f=e?p=>{const m=r.getState().getNodes().filter(_=>_.selected);e(p,m)}:void 0,h=p=>{Object.prototype.hasOwnProperty.call(vh,p.key)&&c({x:vh[p.key].x,y:vh[p.key].y,isShiftPressed:p.shiftKey})};return W.jsx("div",{className:Ta(["react-flow__nodesselection","react-flow__container",t]),style:{transform:l},children:W.jsx("div",{ref:d,className:"react-flow__nodesselection-rect",onContextMenu:f,tabIndex:n?void 0:-1,onKeyDown:n?void 0:h,style:{width:i,height:o,top:s,left:a}})})}var u_e=I.memo(l_e);const c_e=e=>e.nodesSelectionActive,TV=({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:i,onPaneContextMenu:o,onPaneScroll:a,deleteKeyCode:s,onMove:l,onMoveStart:u,onMoveEnd:c,selectionKeyCode:d,selectionOnDrag:f,selectionMode:h,onSelectionStart:p,onSelectionEnd:m,multiSelectionKeyCode:_,panActivationKeyCode:b,zoomActivationKeyCode:v,elementsSelectable:g,zoomOnScroll:y,zoomOnPinch:S,panOnScroll:w,panOnScrollSpeed:x,panOnScrollMode:C,zoomOnDoubleClick:T,panOnDrag:k,defaultViewport:P,translateExtent:$,minZoom:O,maxZoom:E,preventScrolling:A,onSelectionContextMenu:D,noWheelClassName:L,noPanClassName:M,disableKeyboardA11y:R})=>{const N=br(c_e),B=p0(d),G=p0(b)||k,Y=B||f&&G!==!0;return Xbe({deleteKeyCode:s,multiSelectionKeyCode:_}),W.jsx(e_e,{onMove:l,onMoveStart:u,onMoveEnd:c,onPaneContextMenu:o,elementsSelectable:g,zoomOnScroll:y,zoomOnPinch:S,panOnScroll:w,panOnScrollSpeed:x,panOnScrollMode:C,zoomOnDoubleClick:T,panOnDrag:!B&&G,defaultViewport:P,translateExtent:$,minZoom:O,maxZoom:E,zoomActivationKeyCode:v,preventScrolling:A,noWheelClassName:L,noPanClassName:M,children:W.jsxs(xV,{onSelectionStart:p,onSelectionEnd:m,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:i,onPaneContextMenu:o,onPaneScroll:a,panOnDrag:G,isSelecting:!!Y,selectionMode:h,children:[e,N&&W.jsx(u_e,{onSelectionContextMenu:D,noPanClassName:M,disableKeyboardA11y:R})]})})};TV.displayName="FlowRenderer";var d_e=I.memo(TV);function f_e(e){return br(I.useCallback(n=>e?rV(n.nodeInternals,{x:0,y:0,width:n.width,height:n.height},n.transform,!0):n.getNodes(),[e]))}function h_e(e){const t={input:Zp(e.input||dV),default:Zp(e.default||NE),output:Zp(e.output||hV),group:Zp(e.group||dA)},n={},r=Object.keys(e).filter(i=>!["input","default","output","group"].includes(i)).reduce((i,o)=>(i[o]=Zp(e[o]||NE),i),n);return{...t,...r}}const p_e=({x:e,y:t,width:n,height:r,origin:i})=>!n||!r?{x:e,y:t}:i[0]<0||i[1]<0||i[0]>1||i[1]>1?{x:e,y:t}:{x:e-n*i[0],y:t-r*i[1]},g_e=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,updateNodeDimensions:e.updateNodeDimensions,onError:e.onError}),AV=e=>{const{nodesDraggable:t,nodesConnectable:n,nodesFocusable:r,elementsSelectable:i,updateNodeDimensions:o,onError:a}=br(g_e,Ro),s=f_e(e.onlyRenderVisibleElements),l=I.useRef(),u=I.useMemo(()=>{if(typeof ResizeObserver>"u")return null;const c=new ResizeObserver(d=>{const f=d.map(h=>({id:h.target.getAttribute("data-id"),nodeElement:h.target,forceUpdate:!0}));o(f)});return l.current=c,c},[]);return I.useEffect(()=>()=>{var c;(c=l==null?void 0:l.current)==null||c.disconnect()},[]),W.jsx("div",{className:"react-flow__nodes",style:fA,children:s.map(c=>{var S,w;let d=c.type||"default";e.nodeTypes[d]||(a==null||a("003",Wl.error003(d)),d="default");const f=e.nodeTypes[d]||e.nodeTypes.default,h=!!(c.draggable||t&&typeof c.draggable>"u"),p=!!(c.selectable||i&&typeof c.selectable>"u"),m=!!(c.connectable||n&&typeof c.connectable>"u"),_=!!(c.focusable||r&&typeof c.focusable>"u"),b=e.nodeExtent?rA(c.positionAbsolute,e.nodeExtent):c.positionAbsolute,v=(b==null?void 0:b.x)??0,g=(b==null?void 0:b.y)??0,y=p_e({x:v,y:g,width:c.width??0,height:c.height??0,origin:e.nodeOrigin});return W.jsx(f,{id:c.id,className:c.className,style:c.style,type:d,data:c.data,sourcePosition:c.sourcePosition||tt.Bottom,targetPosition:c.targetPosition||tt.Top,hidden:c.hidden,xPos:v,yPos:g,xPosOrigin:y.x,yPosOrigin:y.y,selectNodesOnDrag:e.selectNodesOnDrag,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,selected:!!c.selected,isDraggable:h,isSelectable:p,isConnectable:m,isFocusable:_,resizeObserver:u,dragHandle:c.dragHandle,zIndex:((S=c[Kr])==null?void 0:S.z)??0,isParent:!!((w=c[Kr])!=null&&w.isParent),noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,initialized:!!c.width&&!!c.height,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,ariaLabel:c.ariaLabel},c.id)})})};AV.displayName="NodeRenderer";var m_e=I.memo(AV);const y_e=(e,t,n)=>n===tt.Left?e-t:n===tt.Right?e+t:e,v_e=(e,t,n)=>n===tt.Top?e-t:n===tt.Bottom?e+t:e,A9="react-flow__edgeupdater",P9=({position:e,centerX:t,centerY:n,radius:r=10,onMouseDown:i,onMouseEnter:o,onMouseOut:a,type:s})=>W.jsx("circle",{onMouseDown:i,onMouseEnter:o,onMouseOut:a,className:Ta([A9,`${A9}-${s}`]),cx:y_e(t,r,e),cy:v_e(n,r,e),r,stroke:"transparent",fill:"transparent"}),b_e=()=>!0;var gf=e=>{const t=({id:n,className:r,type:i,data:o,onClick:a,onEdgeDoubleClick:s,selected:l,animated:u,label:c,labelStyle:d,labelShowBg:f,labelBgStyle:h,labelBgPadding:p,labelBgBorderRadius:m,style:_,source:b,target:v,sourceX:g,sourceY:y,targetX:S,targetY:w,sourcePosition:x,targetPosition:C,elementsSelectable:T,hidden:k,sourceHandleId:P,targetHandleId:$,onContextMenu:O,onMouseEnter:E,onMouseMove:A,onMouseLeave:D,edgeUpdaterRadius:L,onEdgeUpdate:M,onEdgeUpdateStart:R,onEdgeUpdateEnd:N,markerEnd:B,markerStart:U,rfId:G,ariaLabel:Y,isFocusable:ee,isUpdatable:J,pathOptions:j,interactionWidth:Q})=>{const ne=I.useRef(null),[se,ve]=I.useState(!1),[ce,bt]=I.useState(!1),ot=hi(),ze=I.useMemo(()=>`url(#${ME(U,G)})`,[U,G]),gt=I.useMemo(()=>`url(#${ME(B,G)})`,[B,G]);if(k)return null;const Pe=Fn=>{const{edges:bn,addSelectedEdges:Mi}=ot.getState();if(T&&(ot.setState({nodesSelectionActive:!1}),Mi([n])),a){const pi=bn.find(Qi=>Qi.id===n);a(Fn,pi)}},Jt=Xp(n,ot.getState,s),Ar=Xp(n,ot.getState,O),Dn=Xp(n,ot.getState,E),Tn=Xp(n,ot.getState,A),en=Xp(n,ot.getState,D),Ln=(Fn,bn)=>{if(Fn.button!==0)return;const{edges:Mi,isValidConnection:pi}=ot.getState(),Qi=bn?v:b,$a=(bn?$:P)||null,Ir=bn?"target":"source",fo=pi||b_e,ol=bn,$o=Mi.find(tn=>tn.id===n);bt(!0),R==null||R(Fn,$o,Ir);const al=tn=>{bt(!1),N==null||N(tn,$o,Ir)};sV({event:Fn,handleId:$a,nodeId:Qi,onConnect:tn=>M==null?void 0:M($o,tn),isTarget:ol,getState:ot.getState,setState:ot.setState,isValidConnection:fo,edgeUpdaterType:Ir,onEdgeUpdateEnd:al})},Pr=Fn=>Ln(Fn,!0),co=Fn=>Ln(Fn,!1),Jr=()=>ve(!0),hr=()=>ve(!1),Fr=!T&&!a,ei=Fn=>{var bn;if(KU.includes(Fn.key)&&T){const{unselectNodesAndEdges:Mi,addSelectedEdges:pi,edges:Qi}=ot.getState();Fn.key==="Escape"?((bn=ne.current)==null||bn.blur(),Mi({edges:[Qi.find(Ir=>Ir.id===n)]})):pi([n])}};return W.jsxs("g",{className:Ta(["react-flow__edge",`react-flow__edge-${i}`,r,{selected:l,animated:u,inactive:Fr,updating:se}]),onClick:Pe,onDoubleClick:Jt,onContextMenu:Ar,onMouseEnter:Dn,onMouseMove:Tn,onMouseLeave:en,onKeyDown:ee?ei:void 0,tabIndex:ee?0:void 0,role:ee?"button":"img","data-testid":`rf__edge-${n}`,"aria-label":Y===null?void 0:Y||`Edge from ${b} to ${v}`,"aria-describedby":ee?`${mV}-${G}`:void 0,ref:ne,children:[!ce&&W.jsx(e,{id:n,source:b,target:v,selected:l,animated:u,label:c,labelStyle:d,labelShowBg:f,labelBgStyle:h,labelBgPadding:p,labelBgBorderRadius:m,data:o,style:_,sourceX:g,sourceY:y,targetX:S,targetY:w,sourcePosition:x,targetPosition:C,sourceHandleId:P,targetHandleId:$,markerStart:ze,markerEnd:gt,pathOptions:j,interactionWidth:Q}),J&&W.jsxs(W.Fragment,{children:[(J==="source"||J===!0)&&W.jsx(P9,{position:x,centerX:g,centerY:y,radius:L,onMouseDown:Pr,onMouseEnter:Jr,onMouseOut:hr,type:"source"}),(J==="target"||J===!0)&&W.jsx(P9,{position:C,centerX:S,centerY:w,radius:L,onMouseDown:co,onMouseEnter:Jr,onMouseOut:hr,type:"target"})]})]})};return t.displayName="EdgeWrapper",I.memo(t)};function __e(e){const t={default:gf(e.default||O_),straight:gf(e.bezier||aA),step:gf(e.step||oA),smoothstep:gf(e.step||Q2),simplebezier:gf(e.simplebezier||iA)},n={},r=Object.keys(e).filter(i=>!["default","bezier"].includes(i)).reduce((i,o)=>(i[o]=gf(e[o]||O_),i),n);return{...t,...r}}function I9(e,t,n=null){const r=((n==null?void 0:n.x)||0)+t.x,i=((n==null?void 0:n.y)||0)+t.y,o=(n==null?void 0:n.width)||t.width,a=(n==null?void 0:n.height)||t.height;switch(e){case tt.Top:return{x:r+o/2,y:i};case tt.Right:return{x:r+o,y:i+a/2};case tt.Bottom:return{x:r+o/2,y:i+a};case tt.Left:return{x:r,y:i+a/2}}}function R9(e,t){return e?e.length===1||!t?e[0]:t&&e.find(n=>n.id===t)||null:null}const S_e=(e,t,n,r,i,o)=>{const a=I9(n,e,t),s=I9(o,r,i);return{sourceX:a.x,sourceY:a.y,targetX:s.x,targetY:s.y}};function x_e({sourcePos:e,targetPos:t,sourceWidth:n,sourceHeight:r,targetWidth:i,targetHeight:o,width:a,height:s,transform:l}){const u={x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x+n,t.x+i),y2:Math.max(e.y+r,t.y+o)};u.x===u.x2&&(u.x2+=1),u.y===u.y2&&(u.y2+=1);const c=h0({x:(0-l[0])/l[2],y:(0-l[1])/l[2],width:a/l[2],height:s/l[2]}),d=Math.max(0,Math.min(c.x2,u.x2)-Math.max(c.x,u.x)),f=Math.max(0,Math.min(c.y2,u.y2)-Math.max(c.y,u.y));return Math.ceil(d*f)>0}function O9(e){var r,i,o,a,s;const t=((r=e==null?void 0:e[Kr])==null?void 0:r.handleBounds)||null,n=t&&(e==null?void 0:e.width)&&(e==null?void 0:e.height)&&typeof((i=e==null?void 0:e.positionAbsolute)==null?void 0:i.x)<"u"&&typeof((o=e==null?void 0:e.positionAbsolute)==null?void 0:o.y)<"u";return[{x:((a=e==null?void 0:e.positionAbsolute)==null?void 0:a.x)||0,y:((s=e==null?void 0:e.positionAbsolute)==null?void 0:s.y)||0,width:(e==null?void 0:e.width)||0,height:(e==null?void 0:e.height)||0},t,!!n]}const w_e=[{level:0,isMaxLevel:!0,edges:[]}];function C_e(e,t,n=!1){let r=-1;const i=e.reduce((a,s)=>{var c,d;const l=ba(s.zIndex);let u=l?s.zIndex:0;if(n){const f=t.get(s.target),h=t.get(s.source),p=s.selected||(f==null?void 0:f.selected)||(h==null?void 0:h.selected),m=Math.max(((c=h==null?void 0:h[Kr])==null?void 0:c.z)||0,((d=f==null?void 0:f[Kr])==null?void 0:d.z)||0,1e3);u=(l?s.zIndex:0)+(p?m:0)}return a[u]?a[u].push(s):a[u]=[s],r=u>r?u:r,a},{}),o=Object.entries(i).map(([a,s])=>{const l=+a;return{edges:s,level:l,isMaxLevel:l===r}});return o.length===0?w_e:o}function E_e(e,t,n){const r=br(I.useCallback(i=>e?i.edges.filter(o=>{const a=t.get(o.source),s=t.get(o.target);return(a==null?void 0:a.width)&&(a==null?void 0:a.height)&&(s==null?void 0:s.width)&&(s==null?void 0:s.height)&&x_e({sourcePos:a.positionAbsolute||{x:0,y:0},targetPos:s.positionAbsolute||{x:0,y:0},sourceWidth:a.width,sourceHeight:a.height,targetWidth:s.width,targetHeight:s.height,width:i.width,height:i.height,transform:i.transform})}):i.edges,[e,t]));return C_e(r,t,n)}const k_e=({color:e="none",strokeWidth:t=1})=>W.jsx("polyline",{stroke:e,strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:t,fill:"none",points:"-5,-4 0,0 -5,4"}),T_e=({color:e="none",strokeWidth:t=1})=>W.jsx("polyline",{stroke:e,strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:t,fill:e,points:"-5,-4 0,0 -5,4 -5,-4"}),M9={[R_.Arrow]:k_e,[R_.ArrowClosed]:T_e};function A_e(e){const t=hi();return I.useMemo(()=>{var i,o;return Object.prototype.hasOwnProperty.call(M9,e)?M9[e]:((o=(i=t.getState()).onError)==null||o.call(i,"009",Wl.error009(e)),null)},[e])}const P_e=({id:e,type:t,color:n,width:r=12.5,height:i=12.5,markerUnits:o="strokeWidth",strokeWidth:a,orient:s="auto-start-reverse"})=>{const l=A_e(t);return l?W.jsx("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${r}`,markerHeight:`${i}`,viewBox:"-10 -10 20 20",markerUnits:o,orient:s,refX:"0",refY:"0",children:W.jsx(l,{color:n,strokeWidth:a})}):null},I_e=({defaultColor:e,rfId:t})=>n=>{const r=[];return n.edges.reduce((i,o)=>([o.markerStart,o.markerEnd].forEach(a=>{if(a&&typeof a=="object"){const s=ME(a,t);r.includes(s)||(i.push({id:s,color:a.color||e,...a}),r.push(s))}}),i),[]).sort((i,o)=>i.id.localeCompare(o.id))},PV=({defaultColor:e,rfId:t})=>{const n=br(I.useCallback(I_e({defaultColor:e,rfId:t}),[e,t]),(r,i)=>!(r.length!==i.length||r.some((o,a)=>o.id!==i[a].id)));return W.jsx("defs",{children:n.map(r=>W.jsx(P_e,{id:r.id,type:r.type,color:r.color,width:r.width,height:r.height,markerUnits:r.markerUnits,strokeWidth:r.strokeWidth,orient:r.orient},r.id))})};PV.displayName="MarkerDefinitions";var R_e=I.memo(PV);const O_e=e=>({nodesConnectable:e.nodesConnectable,edgesFocusable:e.edgesFocusable,edgesUpdatable:e.edgesUpdatable,elementsSelectable:e.elementsSelectable,width:e.width,height:e.height,connectionMode:e.connectionMode,nodeInternals:e.nodeInternals,onError:e.onError}),IV=({defaultMarkerColor:e,onlyRenderVisibleElements:t,elevateEdgesOnSelect:n,rfId:r,edgeTypes:i,noPanClassName:o,onEdgeUpdate:a,onEdgeContextMenu:s,onEdgeMouseEnter:l,onEdgeMouseMove:u,onEdgeMouseLeave:c,onEdgeClick:d,edgeUpdaterRadius:f,onEdgeDoubleClick:h,onEdgeUpdateStart:p,onEdgeUpdateEnd:m,children:_})=>{const{edgesFocusable:b,edgesUpdatable:v,elementsSelectable:g,width:y,height:S,connectionMode:w,nodeInternals:x,onError:C}=br(O_e,Ro),T=E_e(t,x,n);return y?W.jsxs(W.Fragment,{children:[T.map(({level:k,edges:P,isMaxLevel:$})=>W.jsxs("svg",{style:{zIndex:k},width:y,height:S,className:"react-flow__edges react-flow__container",children:[$&&W.jsx(R_e,{defaultColor:e,rfId:r}),W.jsx("g",{children:P.map(O=>{const[E,A,D]=O9(x.get(O.source)),[L,M,R]=O9(x.get(O.target));if(!D||!R)return null;let N=O.type||"default";i[N]||(C==null||C("011",Wl.error011(N)),N="default");const B=i[N]||i.default,U=w===Nd.Strict?M.target:(M.target??[]).concat(M.source??[]),G=R9(A.source,O.sourceHandle),Y=R9(U,O.targetHandle),ee=(G==null?void 0:G.position)||tt.Bottom,J=(Y==null?void 0:Y.position)||tt.Top,j=!!(O.focusable||b&&typeof O.focusable>"u"),Q=typeof a<"u"&&(O.updatable||v&&typeof O.updatable>"u");if(!G||!Y)return C==null||C("008",Wl.error008(G,O)),null;const{sourceX:ne,sourceY:se,targetX:ve,targetY:ce}=S_e(E,G,ee,L,Y,J);return W.jsx(B,{id:O.id,className:Ta([O.className,o]),type:N,data:O.data,selected:!!O.selected,animated:!!O.animated,hidden:!!O.hidden,label:O.label,labelStyle:O.labelStyle,labelShowBg:O.labelShowBg,labelBgStyle:O.labelBgStyle,labelBgPadding:O.labelBgPadding,labelBgBorderRadius:O.labelBgBorderRadius,style:O.style,source:O.source,target:O.target,sourceHandleId:O.sourceHandle,targetHandleId:O.targetHandle,markerEnd:O.markerEnd,markerStart:O.markerStart,sourceX:ne,sourceY:se,targetX:ve,targetY:ce,sourcePosition:ee,targetPosition:J,elementsSelectable:g,onEdgeUpdate:a,onContextMenu:s,onMouseEnter:l,onMouseMove:u,onMouseLeave:c,onClick:d,edgeUpdaterRadius:f,onEdgeDoubleClick:h,onEdgeUpdateStart:p,onEdgeUpdateEnd:m,rfId:r,ariaLabel:O.ariaLabel,isFocusable:j,isUpdatable:Q,pathOptions:"pathOptions"in O?O.pathOptions:void 0,interactionWidth:O.interactionWidth},O.id)})})]},k)),_]}):null};IV.displayName="EdgeRenderer";var M_e=I.memo(IV);const N_e=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function $_e({children:e}){const t=br(N_e);return W.jsx("div",{className:"react-flow__viewport react-flow__container",style:{transform:t},children:e})}function D_e(e){const t=_V(),n=I.useRef(!1);I.useEffect(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}const L_e={[tt.Left]:tt.Right,[tt.Right]:tt.Left,[tt.Top]:tt.Bottom,[tt.Bottom]:tt.Top},RV=({nodeId:e,handleType:t,style:n,type:r=Eu.Bezier,CustomComponent:i,connectionStatus:o})=>{var w,x,C;const{fromNode:a,handleId:s,toX:l,toY:u,connectionMode:c}=br(I.useCallback(T=>({fromNode:T.nodeInternals.get(e),handleId:T.connectionHandleId,toX:(T.connectionPosition.x-T.transform[0])/T.transform[2],toY:(T.connectionPosition.y-T.transform[1])/T.transform[2],connectionMode:T.connectionMode}),[e]),Ro),d=(w=a==null?void 0:a[Kr])==null?void 0:w.handleBounds;let f=d==null?void 0:d[t];if(c===Nd.Loose&&(f=f||(d==null?void 0:d[t==="source"?"target":"source"])),!a||!f)return null;const h=s?f.find(T=>T.id===s):f[0],p=h?h.x+h.width/2:(a.width??0)/2,m=h?h.y+h.height/2:a.height??0,_=(((x=a.positionAbsolute)==null?void 0:x.x)??0)+p,b=(((C=a.positionAbsolute)==null?void 0:C.y)??0)+m,v=h==null?void 0:h.position,g=v?L_e[v]:null;if(!v||!g)return null;if(i)return W.jsx(i,{connectionLineType:r,connectionLineStyle:n,fromNode:a,fromHandle:h,fromX:_,fromY:b,toX:l,toY:u,fromPosition:v,toPosition:g,connectionStatus:o});let y="";const S={sourceX:_,sourceY:b,sourcePosition:v,targetX:l,targetY:u,targetPosition:g};return r===Eu.Bezier?[y]=JU(S):r===Eu.Step?[y]=OE({...S,borderRadius:0}):r===Eu.SmoothStep?[y]=OE(S):r===Eu.SimpleBezier?[y]=ZU(S):y=`M${_},${b} ${l},${u}`,W.jsx("path",{d:y,fill:"none",className:"react-flow__connection-path",style:n})};RV.displayName="ConnectionLine";const F_e=e=>({nodeId:e.connectionNodeId,handleType:e.connectionHandleType,nodesConnectable:e.nodesConnectable,connectionStatus:e.connectionStatus,width:e.width,height:e.height});function B_e({containerStyle:e,style:t,type:n,component:r}){const{nodeId:i,handleType:o,nodesConnectable:a,width:s,height:l,connectionStatus:u}=br(F_e,Ro);return!(i&&o&&s&&a)?null:W.jsx("svg",{style:e,width:s,height:l,className:"react-flow__edges react-flow__connectionline react-flow__container",children:W.jsx("g",{className:Ta(["react-flow__connection",u]),children:W.jsx(RV,{nodeId:i,handleType:o,style:t,type:n,CustomComponent:r,connectionStatus:u})})})}function N9(e,t){return I.useRef(null),hi(),I.useMemo(()=>t(e),[e])}const OV=({nodeTypes:e,edgeTypes:t,onMove:n,onMoveStart:r,onMoveEnd:i,onInit:o,onNodeClick:a,onEdgeClick:s,onNodeDoubleClick:l,onEdgeDoubleClick:u,onNodeMouseEnter:c,onNodeMouseMove:d,onNodeMouseLeave:f,onNodeContextMenu:h,onSelectionContextMenu:p,onSelectionStart:m,onSelectionEnd:_,connectionLineType:b,connectionLineStyle:v,connectionLineComponent:g,connectionLineContainerStyle:y,selectionKeyCode:S,selectionOnDrag:w,selectionMode:x,multiSelectionKeyCode:C,panActivationKeyCode:T,zoomActivationKeyCode:k,deleteKeyCode:P,onlyRenderVisibleElements:$,elementsSelectable:O,selectNodesOnDrag:E,defaultViewport:A,translateExtent:D,minZoom:L,maxZoom:M,preventScrolling:R,defaultMarkerColor:N,zoomOnScroll:B,zoomOnPinch:U,panOnScroll:G,panOnScrollSpeed:Y,panOnScrollMode:ee,zoomOnDoubleClick:J,panOnDrag:j,onPaneClick:Q,onPaneMouseEnter:ne,onPaneMouseMove:se,onPaneMouseLeave:ve,onPaneScroll:ce,onPaneContextMenu:bt,onEdgeUpdate:ot,onEdgeContextMenu:ze,onEdgeMouseEnter:gt,onEdgeMouseMove:Pe,onEdgeMouseLeave:Jt,edgeUpdaterRadius:Ar,onEdgeUpdateStart:Dn,onEdgeUpdateEnd:Tn,noDragClassName:en,noWheelClassName:Ln,noPanClassName:Pr,elevateEdgesOnSelect:co,disableKeyboardA11y:Jr,nodeOrigin:hr,nodeExtent:Fr,rfId:ei})=>{const Fn=N9(e,h_e),bn=N9(t,__e);return D_e(o),W.jsx(d_e,{onPaneClick:Q,onPaneMouseEnter:ne,onPaneMouseMove:se,onPaneMouseLeave:ve,onPaneContextMenu:bt,onPaneScroll:ce,deleteKeyCode:P,selectionKeyCode:S,selectionOnDrag:w,selectionMode:x,onSelectionStart:m,onSelectionEnd:_,multiSelectionKeyCode:C,panActivationKeyCode:T,zoomActivationKeyCode:k,elementsSelectable:O,onMove:n,onMoveStart:r,onMoveEnd:i,zoomOnScroll:B,zoomOnPinch:U,zoomOnDoubleClick:J,panOnScroll:G,panOnScrollSpeed:Y,panOnScrollMode:ee,panOnDrag:j,defaultViewport:A,translateExtent:D,minZoom:L,maxZoom:M,onSelectionContextMenu:p,preventScrolling:R,noDragClassName:en,noWheelClassName:Ln,noPanClassName:Pr,disableKeyboardA11y:Jr,children:W.jsxs($_e,{children:[W.jsx(M_e,{edgeTypes:bn,onEdgeClick:s,onEdgeDoubleClick:u,onEdgeUpdate:ot,onlyRenderVisibleElements:$,onEdgeContextMenu:ze,onEdgeMouseEnter:gt,onEdgeMouseMove:Pe,onEdgeMouseLeave:Jt,onEdgeUpdateStart:Dn,onEdgeUpdateEnd:Tn,edgeUpdaterRadius:Ar,defaultMarkerColor:N,noPanClassName:Pr,elevateEdgesOnSelect:!!co,disableKeyboardA11y:Jr,rfId:ei,children:W.jsx(B_e,{style:v,type:b,component:g,containerStyle:y})}),W.jsx("div",{className:"react-flow__edgelabel-renderer"}),W.jsx(m_e,{nodeTypes:Fn,onNodeClick:a,onNodeDoubleClick:l,onNodeMouseEnter:c,onNodeMouseMove:d,onNodeMouseLeave:f,onNodeContextMenu:h,selectNodesOnDrag:E,onlyRenderVisibleElements:$,noPanClassName:Pr,noDragClassName:en,disableKeyboardA11y:Jr,nodeOrigin:hr,nodeExtent:Fr,rfId:ei})]})})};OV.displayName="GraphView";var z_e=I.memo(OV);const DE=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],uu={rfId:"1",width:0,height:0,transform:[0,0,1],nodeInternals:new Map,edges:[],onNodesChange:null,onEdgesChange:null,hasDefaultNodes:!1,hasDefaultEdges:!1,d3Zoom:null,d3Selection:null,d3ZoomHandler:void 0,minZoom:.5,maxZoom:2,translateExtent:DE,nodeExtent:DE,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionNodeId:null,connectionHandleId:null,connectionHandleType:"source",connectionPosition:{x:0,y:0},connectionStatus:null,connectionMode:Nd.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:[0,0],snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesUpdatable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,fitViewOnInit:!1,fitViewOnInitDone:!1,fitViewOnInitOptions:void 0,multiSelectionActive:!1,connectionStartHandle:null,connectionEndHandle:null,connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,connectionRadius:20,onError:hbe,isValidConnection:void 0},j_e=()=>T0e((e,t)=>({...uu,setNodes:n=>{const{nodeInternals:r,nodeOrigin:i,elevateNodesOnSelect:o}=t();e({nodeInternals:LC(n,r,i,o)})},getNodes:()=>Array.from(t().nodeInternals.values()),setEdges:n=>{const{defaultEdgeOptions:r={}}=t();e({edges:n.map(i=>({...r,...i}))})},setDefaultNodesAndEdges:(n,r)=>{const i=typeof n<"u",o=typeof r<"u",a=i?LC(n,new Map,t().nodeOrigin,t().elevateNodesOnSelect):new Map;e({nodeInternals:a,edges:o?r:[],hasDefaultNodes:i,hasDefaultEdges:o})},updateNodeDimensions:n=>{const{onNodesChange:r,nodeInternals:i,fitViewOnInit:o,fitViewOnInitDone:a,fitViewOnInitOptions:s,domNode:l,nodeOrigin:u}=t(),c=l==null?void 0:l.querySelector(".react-flow__viewport");if(!c)return;const d=window.getComputedStyle(c),{m22:f}=new window.DOMMatrixReadOnly(d.transform),h=n.reduce((m,_)=>{const b=i.get(_.id);if(b){const v=nA(_.nodeElement);!!(v.width&&v.height&&(b.width!==v.width||b.height!==v.height||_.forceUpdate))&&(i.set(b.id,{...b,[Kr]:{...b[Kr],handleBounds:{source:T9(".source",_.nodeElement,f,u),target:T9(".target",_.nodeElement,f,u)}},...v}),m.push({id:b.id,type:"dimensions",dimensions:v}))}return m},[]);vV(i,u);const p=a||o&&!a&&bV(t,{initial:!0,...s});e({nodeInternals:new Map(i),fitViewOnInitDone:p}),(h==null?void 0:h.length)>0&&(r==null||r(h))},updateNodePositions:(n,r=!0,i=!1)=>{const{triggerNodeChanges:o}=t(),a=n.map(s=>{const l={id:s.id,type:"position",dragging:i};return r&&(l.positionAbsolute=s.positionAbsolute,l.position=s.position),l});o(a)},triggerNodeChanges:n=>{const{onNodesChange:r,nodeInternals:i,hasDefaultNodes:o,nodeOrigin:a,getNodes:s,elevateNodesOnSelect:l}=t();if(n!=null&&n.length){if(o){const u=Uc(n,s()),c=LC(u,i,a,l);e({nodeInternals:c})}r==null||r(n)}},addSelectedNodes:n=>{const{multiSelectionActive:r,edges:i,getNodes:o}=t();let a,s=null;r?a=n.map(l=>vu(l,!0)):(a=jf(o(),n),s=jf(i,[])),Nv({changedNodes:a,changedEdges:s,get:t,set:e})},addSelectedEdges:n=>{const{multiSelectionActive:r,edges:i,getNodes:o}=t();let a,s=null;r?a=n.map(l=>vu(l,!0)):(a=jf(i,n),s=jf(o(),[])),Nv({changedNodes:s,changedEdges:a,get:t,set:e})},unselectNodesAndEdges:({nodes:n,edges:r}={})=>{const{edges:i,getNodes:o}=t(),a=n||o(),s=r||i,l=a.map(c=>(c.selected=!1,vu(c.id,!1))),u=s.map(c=>vu(c.id,!1));Nv({changedNodes:l,changedEdges:u,get:t,set:e})},setMinZoom:n=>{const{d3Zoom:r,maxZoom:i}=t();r==null||r.scaleExtent([n,i]),e({minZoom:n})},setMaxZoom:n=>{const{d3Zoom:r,minZoom:i}=t();r==null||r.scaleExtent([i,n]),e({maxZoom:n})},setTranslateExtent:n=>{var r;(r=t().d3Zoom)==null||r.translateExtent(n),e({translateExtent:n})},resetSelectedElements:()=>{const{edges:n,getNodes:r}=t(),o=r().filter(s=>s.selected).map(s=>vu(s.id,!1)),a=n.filter(s=>s.selected).map(s=>vu(s.id,!1));Nv({changedNodes:o,changedEdges:a,get:t,set:e})},setNodeExtent:n=>{const{nodeInternals:r}=t();r.forEach(i=>{i.positionAbsolute=rA(i.position,n)}),e({nodeExtent:n,nodeInternals:new Map(r)})},panBy:n=>{const{transform:r,width:i,height:o,d3Zoom:a,d3Selection:s,translateExtent:l}=t();if(!a||!s||!n.x&&!n.y)return!1;const u=Ku.translate(r[0]+n.x,r[1]+n.y).scale(r[2]),c=[[0,0],[i,o]],d=a==null?void 0:a.constrain()(u,c,l);return a.transform(s,d),r[0]!==d.x||r[1]!==d.y||r[2]!==d.k},cancelConnection:()=>e({connectionNodeId:uu.connectionNodeId,connectionHandleId:uu.connectionHandleId,connectionHandleType:uu.connectionHandleType,connectionStatus:uu.connectionStatus,connectionStartHandle:uu.connectionStartHandle,connectionEndHandle:uu.connectionEndHandle}),reset:()=>e({...uu})}),Object.is),MV=({children:e})=>{const t=I.useRef(null);return t.current||(t.current=j_e()),W.jsx(abe,{value:t.current,children:e})};MV.displayName="ReactFlowProvider";const NV=({children:e})=>I.useContext(K2)?W.jsx(W.Fragment,{children:e}):W.jsx(MV,{children:e});NV.displayName="ReactFlowWrapper";const U_e={input:dV,default:NE,output:hV,group:dA},V_e={default:O_,straight:aA,step:oA,smoothstep:Q2,simplebezier:iA},G_e=[0,0],H_e=[15,15],q_e={x:0,y:0,zoom:1},W_e={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0},K_e=I.forwardRef(({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,className:i,nodeTypes:o=U_e,edgeTypes:a=V_e,onNodeClick:s,onEdgeClick:l,onInit:u,onMove:c,onMoveStart:d,onMoveEnd:f,onConnect:h,onConnectStart:p,onConnectEnd:m,onClickConnectStart:_,onClickConnectEnd:b,onNodeMouseEnter:v,onNodeMouseMove:g,onNodeMouseLeave:y,onNodeContextMenu:S,onNodeDoubleClick:w,onNodeDragStart:x,onNodeDrag:C,onNodeDragStop:T,onNodesDelete:k,onEdgesDelete:P,onSelectionChange:$,onSelectionDragStart:O,onSelectionDrag:E,onSelectionDragStop:A,onSelectionContextMenu:D,onSelectionStart:L,onSelectionEnd:M,connectionMode:R=Nd.Strict,connectionLineType:N=Eu.Bezier,connectionLineStyle:B,connectionLineComponent:U,connectionLineContainerStyle:G,deleteKeyCode:Y="Backspace",selectionKeyCode:ee="Shift",selectionOnDrag:J=!1,selectionMode:j=sc.Full,panActivationKeyCode:Q="Space",multiSelectionKeyCode:ne=I_()?"Meta":"Control",zoomActivationKeyCode:se=I_()?"Meta":"Control",snapToGrid:ve=!1,snapGrid:ce=H_e,onlyRenderVisibleElements:bt=!1,selectNodesOnDrag:ot=!0,nodesDraggable:ze,nodesConnectable:gt,nodesFocusable:Pe,nodeOrigin:Jt=G_e,edgesFocusable:Ar,edgesUpdatable:Dn,elementsSelectable:Tn,defaultViewport:en=q_e,minZoom:Ln=.5,maxZoom:Pr=2,translateExtent:co=DE,preventScrolling:Jr=!0,nodeExtent:hr,defaultMarkerColor:Fr="#b1b1b7",zoomOnScroll:ei=!0,zoomOnPinch:Fn=!0,panOnScroll:bn=!1,panOnScrollSpeed:Mi=.5,panOnScrollMode:pi=od.Free,zoomOnDoubleClick:Qi=!0,panOnDrag:$a=!0,onPaneClick:Ir,onPaneMouseEnter:fo,onPaneMouseMove:ol,onPaneMouseLeave:$o,onPaneScroll:al,onPaneContextMenu:Bn,children:tn,onEdgeUpdate:Br,onEdgeContextMenu:Rr,onEdgeDoubleClick:Or,onEdgeMouseEnter:ti,onEdgeMouseMove:Ni,onEdgeMouseLeave:ho,onEdgeUpdateStart:gi,onEdgeUpdateEnd:zr,edgeUpdaterRadius:Da=10,onNodesChange:hs,onEdgesChange:mi,noDragClassName:ru="nodrag",noWheelClassName:ia="nowheel",noPanClassName:ni="nopan",fitView:sl=!1,fitViewOptions:q,connectOnClick:te=!0,attributionPosition:re,proOptions:de,defaultEdgeOptions:oe,elevateNodesOnSelect:je=!0,elevateEdgesOnSelect:Ge=!1,disableKeyboardA11y:lt=!1,autoPanOnConnect:$e=!0,autoPanOnNodeDrag:He=!0,connectionRadius:Ie=20,isValidConnection:ie,onError:Se,style:Ye,id:Ze,...ut},ct)=>{const _t=Ze||"1";return W.jsx("div",{...ut,style:{...Ye,...W_e},ref:ct,className:Ta(["react-flow",i]),"data-testid":"rf__wrapper",id:Ze,children:W.jsxs(NV,{children:[W.jsx(z_e,{onInit:u,onMove:c,onMoveStart:d,onMoveEnd:f,onNodeClick:s,onEdgeClick:l,onNodeMouseEnter:v,onNodeMouseMove:g,onNodeMouseLeave:y,onNodeContextMenu:S,onNodeDoubleClick:w,nodeTypes:o,edgeTypes:a,connectionLineType:N,connectionLineStyle:B,connectionLineComponent:U,connectionLineContainerStyle:G,selectionKeyCode:ee,selectionOnDrag:J,selectionMode:j,deleteKeyCode:Y,multiSelectionKeyCode:ne,panActivationKeyCode:Q,zoomActivationKeyCode:se,onlyRenderVisibleElements:bt,selectNodesOnDrag:ot,defaultViewport:en,translateExtent:co,minZoom:Ln,maxZoom:Pr,preventScrolling:Jr,zoomOnScroll:ei,zoomOnPinch:Fn,zoomOnDoubleClick:Qi,panOnScroll:bn,panOnScrollSpeed:Mi,panOnScrollMode:pi,panOnDrag:$a,onPaneClick:Ir,onPaneMouseEnter:fo,onPaneMouseMove:ol,onPaneMouseLeave:$o,onPaneScroll:al,onPaneContextMenu:Bn,onSelectionContextMenu:D,onSelectionStart:L,onSelectionEnd:M,onEdgeUpdate:Br,onEdgeContextMenu:Rr,onEdgeDoubleClick:Or,onEdgeMouseEnter:ti,onEdgeMouseMove:Ni,onEdgeMouseLeave:ho,onEdgeUpdateStart:gi,onEdgeUpdateEnd:zr,edgeUpdaterRadius:Da,defaultMarkerColor:Fr,noDragClassName:ru,noWheelClassName:ia,noPanClassName:ni,elevateEdgesOnSelect:Ge,rfId:_t,disableKeyboardA11y:lt,nodeOrigin:Jt,nodeExtent:hr}),W.jsx(Fbe,{nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:h,onConnectStart:p,onConnectEnd:m,onClickConnectStart:_,onClickConnectEnd:b,nodesDraggable:ze,nodesConnectable:gt,nodesFocusable:Pe,edgesFocusable:Ar,edgesUpdatable:Dn,elementsSelectable:Tn,elevateNodesOnSelect:je,minZoom:Ln,maxZoom:Pr,nodeExtent:hr,onNodesChange:hs,onEdgesChange:mi,snapToGrid:ve,snapGrid:ce,connectionMode:R,translateExtent:co,connectOnClick:te,defaultEdgeOptions:oe,fitView:sl,fitViewOptions:q,onNodesDelete:k,onEdgesDelete:P,onNodeDragStart:x,onNodeDrag:C,onNodeDragStop:T,onSelectionDrag:E,onSelectionDragStart:O,onSelectionDragStop:A,noPanClassName:ni,nodeOrigin:Jt,rfId:_t,autoPanOnConnect:$e,autoPanOnNodeDrag:He,onError:Se,connectionRadius:Ie,isValidConnection:ie}),W.jsx(Dbe,{onSelectionChange:$}),tn,W.jsx(ube,{proOptions:de,position:re}),W.jsx(Vbe,{rfId:_t,disableKeyboardA11y:lt})]})})});K_e.displayName="ReactFlow";const Q_e=e=>{var t;return(t=e.domNode)==null?void 0:t.querySelector(".react-flow__edgelabel-renderer")};function yHe({children:e}){const t=br(Q_e);return t?Uo.createPortal(e,t):null}function vHe(){const e=hi();return I.useCallback(t=>{const{domNode:n,updateNodeDimensions:r}=e.getState(),o=(Array.isArray(t)?t:[t]).reduce((a,s)=>{const l=n==null?void 0:n.querySelector(`.react-flow__node[data-id="${s}"]`);return l&&a.push({id:s,nodeElement:l,forceUpdate:!0}),a},[]);requestAnimationFrame(()=>r(o))},[])}function X_e(){const e=[];return function(t,n){if(typeof n!="object"||n===null)return n;for(;e.length>0&&e.at(-1)!==this;)e.pop();return e.includes(n)?"[Circular]":(e.push(n),n)}}const g0=zb("nodes/receivedOpenAPISchema",async(e,{rejectWithValue:t})=>{try{const n=[window.location.origin,"openapi.json"].join("/"),i=await(await fetch(n)).json();return JSON.parse(JSON.stringify(i,X_e()))}catch(n){return t({error:n})}});let Dv;const Y_e=new Uint8Array(16);function Z_e(){if(!Dv&&(Dv=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Dv))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Dv(Y_e)}const Si=[];for(let e=0;e<256;++e)Si.push((e+256).toString(16).slice(1));function J_e(e,t=0){return(Si[e[t+0]]+Si[e[t+1]]+Si[e[t+2]]+Si[e[t+3]]+"-"+Si[e[t+4]]+Si[e[t+5]]+"-"+Si[e[t+6]]+Si[e[t+7]]+"-"+Si[e[t+8]]+Si[e[t+9]]+"-"+Si[e[t+10]]+Si[e[t+11]]+Si[e[t+12]]+Si[e[t+13]]+Si[e[t+14]]+Si[e[t+15]]).toLowerCase()}const eSe=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),$9={randomUUID:eSe};function $V(e,t,n){if($9.randomUUID&&!t&&!e)return $9.randomUUID();e=e||{};const r=e.random||(e.rng||Z_e)();if(r[6]=r[6]&15|64,r[8]=r[8]&63|128,t){n=n||0;for(let i=0;i<16;++i)t[n+i]=r[i];return t}return J_e(r)}const bHe=500,_He=320,tSe="node-drag-handle",SHe=["ImageField","ImageCollection"],xHe={input:"inputs",output:"outputs"},Lv=["Collection","IntegerCollection","BooleanCollection","FloatCollection","StringCollection","ImageCollection","LatentsCollection","ConditioningCollection","ControlCollection","ColorCollection"],wg=["IntegerPolymorphic","BooleanPolymorphic","FloatPolymorphic","StringPolymorphic","ImagePolymorphic","LatentsPolymorphic","ConditioningPolymorphic","ControlPolymorphic","ColorPolymorphic"],wHe=["IPAdapterModelField","ControlNetModelField","LoRAModelField","MainModelField","ONNXModelField","SDXLMainModelField","SDXLRefinerModelField","VaeModelField","UNetField","VaeField","ClipField"],hA={integer:"IntegerCollection",boolean:"BooleanCollection",number:"FloatCollection",float:"FloatCollection",string:"StringCollection",ImageField:"ImageCollection",LatentsField:"LatentsCollection",ConditioningField:"ConditioningCollection",ControlField:"ControlCollection",ColorField:"ColorCollection"},nSe=e=>!!(e&&e in hA),DV={integer:"IntegerPolymorphic",boolean:"BooleanPolymorphic",number:"FloatPolymorphic",float:"FloatPolymorphic",string:"StringPolymorphic",ImageField:"ImagePolymorphic",LatentsField:"LatentsPolymorphic",ConditioningField:"ConditioningPolymorphic",ControlField:"ControlPolymorphic",ColorField:"ColorPolymorphic"},rSe={IntegerPolymorphic:"integer",BooleanPolymorphic:"boolean",FloatPolymorphic:"float",StringPolymorphic:"string",ImagePolymorphic:"ImageField",LatentsPolymorphic:"LatentsField",ConditioningPolymorphic:"ConditioningField",ControlPolymorphic:"ControlField",ColorPolymorphic:"ColorField"},CHe=["string","StringPolymorphic","boolean","BooleanPolymorphic","integer","float","FloatPolymorphic","IntegerPolymorphic","enum","ImageField","ImagePolymorphic","MainModelField","SDXLRefinerModelField","VaeModelField","LoRAModelField","ControlNetModelField","ColorField","SDXLMainModelField","Scheduler","IPAdapterModelField","BoardField"],iSe=e=>!!(e&&e in DV),EHe={boolean:{color:"green.500",description:Z("nodes.booleanDescription"),title:Z("nodes.boolean")},BooleanCollection:{color:"green.500",description:Z("nodes.booleanCollectionDescription"),title:Z("nodes.booleanCollection")},BooleanPolymorphic:{color:"green.500",description:Z("nodes.booleanPolymorphicDescription"),title:Z("nodes.booleanPolymorphic")},ClipField:{color:"green.500",description:Z("nodes.clipFieldDescription"),title:Z("nodes.clipField")},Collection:{color:"base.500",description:Z("nodes.collectionDescription"),title:Z("nodes.collection")},CollectionItem:{color:"base.500",description:Z("nodes.collectionItemDescription"),title:Z("nodes.collectionItem")},ColorCollection:{color:"pink.300",description:Z("nodes.colorCollectionDescription"),title:Z("nodes.colorCollection")},ColorField:{color:"pink.300",description:Z("nodes.colorFieldDescription"),title:Z("nodes.colorField")},ColorPolymorphic:{color:"pink.300",description:Z("nodes.colorPolymorphicDescription"),title:Z("nodes.colorPolymorphic")},ConditioningCollection:{color:"cyan.500",description:Z("nodes.conditioningCollectionDescription"),title:Z("nodes.conditioningCollection")},ConditioningField:{color:"cyan.500",description:Z("nodes.conditioningFieldDescription"),title:Z("nodes.conditioningField")},ConditioningPolymorphic:{color:"cyan.500",description:Z("nodes.conditioningPolymorphicDescription"),title:Z("nodes.conditioningPolymorphic")},ControlCollection:{color:"teal.500",description:Z("nodes.controlCollectionDescription"),title:Z("nodes.controlCollection")},ControlField:{color:"teal.500",description:Z("nodes.controlFieldDescription"),title:Z("nodes.controlField")},ControlNetModelField:{color:"teal.500",description:"TODO",title:"ControlNet"},ControlPolymorphic:{color:"teal.500",description:"Control info passed between nodes.",title:"Control Polymorphic"},DenoiseMaskField:{color:"blue.300",description:Z("nodes.denoiseMaskFieldDescription"),title:Z("nodes.denoiseMaskField")},enum:{color:"blue.500",description:Z("nodes.enumDescription"),title:Z("nodes.enum")},float:{color:"orange.500",description:Z("nodes.floatDescription"),title:Z("nodes.float")},FloatCollection:{color:"orange.500",description:Z("nodes.floatCollectionDescription"),title:Z("nodes.floatCollection")},FloatPolymorphic:{color:"orange.500",description:Z("nodes.floatPolymorphicDescription"),title:Z("nodes.floatPolymorphic")},ImageCollection:{color:"purple.500",description:Z("nodes.imageCollectionDescription"),title:Z("nodes.imageCollection")},ImageField:{color:"purple.500",description:Z("nodes.imageFieldDescription"),title:Z("nodes.imageField")},BoardField:{color:"purple.500",description:Z("nodes.imageFieldDescription"),title:Z("nodes.imageField")},ImagePolymorphic:{color:"purple.500",description:Z("nodes.imagePolymorphicDescription"),title:Z("nodes.imagePolymorphic")},integer:{color:"red.500",description:Z("nodes.integerDescription"),title:Z("nodes.integer")},IntegerCollection:{color:"red.500",description:Z("nodes.integerCollectionDescription"),title:Z("nodes.integerCollection")},IntegerPolymorphic:{color:"red.500",description:Z("nodes.integerPolymorphicDescription"),title:Z("nodes.integerPolymorphic")},IPAdapterField:{color:"green.300",description:"IP-Adapter info passed between nodes.",title:"IP-Adapter"},IPAdapterModelField:{color:"teal.500",description:"IP-Adapter model",title:"IP-Adapter Model"},LatentsCollection:{color:"pink.500",description:Z("nodes.latentsCollectionDescription"),title:Z("nodes.latentsCollection")},LatentsField:{color:"pink.500",description:Z("nodes.latentsFieldDescription"),title:Z("nodes.latentsField")},LatentsPolymorphic:{color:"pink.500",description:Z("nodes.latentsPolymorphicDescription"),title:Z("nodes.latentsPolymorphic")},LoRAModelField:{color:"teal.500",description:Z("nodes.loRAModelFieldDescription"),title:Z("nodes.loRAModelField")},MainModelField:{color:"teal.500",description:Z("nodes.mainModelFieldDescription"),title:Z("nodes.mainModelField")},ONNXModelField:{color:"teal.500",description:Z("nodes.oNNXModelFieldDescription"),title:Z("nodes.oNNXModelField")},Scheduler:{color:"base.500",description:Z("nodes.schedulerDescription"),title:Z("nodes.scheduler")},SDXLMainModelField:{color:"teal.500",description:Z("nodes.sDXLMainModelFieldDescription"),title:Z("nodes.sDXLMainModelField")},SDXLRefinerModelField:{color:"teal.500",description:Z("nodes.sDXLRefinerModelFieldDescription"),title:Z("nodes.sDXLRefinerModelField")},string:{color:"yellow.500",description:Z("nodes.stringDescription"),title:Z("nodes.string")},StringCollection:{color:"yellow.500",description:Z("nodes.stringCollectionDescription"),title:Z("nodes.stringCollection")},StringPolymorphic:{color:"yellow.500",description:Z("nodes.stringPolymorphicDescription"),title:Z("nodes.stringPolymorphic")},UNetField:{color:"red.500",description:Z("nodes.uNetFieldDescription"),title:Z("nodes.uNetField")},VaeField:{color:"blue.500",description:Z("nodes.vaeFieldDescription"),title:Z("nodes.vaeField")},VaeModelField:{color:"teal.500",description:Z("nodes.vaeModelFieldDescription"),title:Z("nodes.vaeModelField")}},D9=(e,t,n)=>{let r=t,i=n;for(;e.find(o=>o.position.x===r&&o.position.y===i);)r=r+50,i=i+50;return{x:r,y:i}},oSe=(e,t)=>{if(e==="Collection"&&t==="Collection")return!1;if(e===t)return!0;const n=e==="CollectionItem"&&!Lv.includes(t),r=t==="CollectionItem"&&!Lv.includes(e)&&!wg.includes(e),i=wg.includes(t)&&(()=>{if(!wg.includes(t))return!1;const u=rSe[t],c=hA[u];return e===u||e===c})(),o=e==="Collection"&&(Lv.includes(t)||wg.includes(t)),a=t==="Collection"&&Lv.includes(e);return n||r||i||o||a||e==="integer"&&t==="float"||(e==="integer"||e==="float")&&t==="string"};var aSe="\0",Oc="\0",L9="",yo,ld,zo,F0,Ah,Ph,fa,Cs,Tu,Es,Au,xl,wl,Ih,Rh,Cl,Ua,B0,LE,LN;let sSe=(LN=class{constructor(t){Yn(this,B0);Yn(this,yo,!0);Yn(this,ld,!1);Yn(this,zo,!1);Yn(this,F0,void 0);Yn(this,Ah,()=>{});Yn(this,Ph,()=>{});Yn(this,fa,{});Yn(this,Cs,{});Yn(this,Tu,{});Yn(this,Es,{});Yn(this,Au,{});Yn(this,xl,{});Yn(this,wl,{});Yn(this,Ih,0);Yn(this,Rh,0);Yn(this,Cl,void 0);Yn(this,Ua,void 0);t&&(oa(this,yo,t.hasOwnProperty("directed")?t.directed:!0),oa(this,ld,t.hasOwnProperty("multigraph")?t.multigraph:!1),oa(this,zo,t.hasOwnProperty("compound")?t.compound:!1)),ae(this,zo)&&(oa(this,Cl,{}),oa(this,Ua,{}),ae(this,Ua)[Oc]={})}isDirected(){return ae(this,yo)}isMultigraph(){return ae(this,ld)}isCompound(){return ae(this,zo)}setGraph(t){return oa(this,F0,t),this}graph(){return ae(this,F0)}setDefaultNodeLabel(t){return oa(this,Ah,t),typeof t!="function"&&oa(this,Ah,()=>t),this}nodeCount(){return ae(this,Ih)}nodes(){return Object.keys(ae(this,fa))}sources(){var t=this;return this.nodes().filter(n=>Object.keys(ae(t,Cs)[n]).length===0)}sinks(){var t=this;return this.nodes().filter(n=>Object.keys(ae(t,Es)[n]).length===0)}setNodes(t,n){var r=arguments,i=this;return t.forEach(function(o){r.length>1?i.setNode(o,n):i.setNode(o)}),this}setNode(t,n){return ae(this,fa).hasOwnProperty(t)?(arguments.length>1&&(ae(this,fa)[t]=n),this):(ae(this,fa)[t]=arguments.length>1?n:ae(this,Ah).call(this,t),ae(this,zo)&&(ae(this,Cl)[t]=Oc,ae(this,Ua)[t]={},ae(this,Ua)[Oc][t]=!0),ae(this,Cs)[t]={},ae(this,Tu)[t]={},ae(this,Es)[t]={},ae(this,Au)[t]={},++Mp(this,Ih)._,this)}node(t){return ae(this,fa)[t]}hasNode(t){return ae(this,fa).hasOwnProperty(t)}removeNode(t){var n=this;if(ae(this,fa).hasOwnProperty(t)){var r=i=>n.removeEdge(ae(n,xl)[i]);delete ae(this,fa)[t],ae(this,zo)&&(ps(this,B0,LE).call(this,t),delete ae(this,Cl)[t],this.children(t).forEach(function(i){n.setParent(i)}),delete ae(this,Ua)[t]),Object.keys(ae(this,Cs)[t]).forEach(r),delete ae(this,Cs)[t],delete ae(this,Tu)[t],Object.keys(ae(this,Es)[t]).forEach(r),delete ae(this,Es)[t],delete ae(this,Au)[t],--Mp(this,Ih)._}return this}setParent(t,n){if(!ae(this,zo))throw new Error("Cannot set parent in a non-compound graph");if(n===void 0)n=Oc;else{n+="";for(var r=n;r!==void 0;r=this.parent(r))if(r===t)throw new Error("Setting "+n+" as parent of "+t+" would create a cycle");this.setNode(n)}return this.setNode(t),ps(this,B0,LE).call(this,t),ae(this,Cl)[t]=n,ae(this,Ua)[n][t]=!0,this}parent(t){if(ae(this,zo)){var n=ae(this,Cl)[t];if(n!==Oc)return n}}children(t=Oc){if(ae(this,zo)){var n=ae(this,Ua)[t];if(n)return Object.keys(n)}else{if(t===Oc)return this.nodes();if(this.hasNode(t))return[]}}predecessors(t){var n=ae(this,Tu)[t];if(n)return Object.keys(n)}successors(t){var n=ae(this,Au)[t];if(n)return Object.keys(n)}neighbors(t){var n=this.predecessors(t);if(n){const i=new Set(n);for(var r of this.successors(t))i.add(r);return Array.from(i.values())}}isLeaf(t){var n;return this.isDirected()?n=this.successors(t):n=this.neighbors(t),n.length===0}filterNodes(t){var n=new this.constructor({directed:ae(this,yo),multigraph:ae(this,ld),compound:ae(this,zo)});n.setGraph(this.graph());var r=this;Object.entries(ae(this,fa)).forEach(function([a,s]){t(a)&&n.setNode(a,s)}),Object.values(ae(this,xl)).forEach(function(a){n.hasNode(a.v)&&n.hasNode(a.w)&&n.setEdge(a,r.edge(a))});var i={};function o(a){var s=r.parent(a);return s===void 0||n.hasNode(s)?(i[a]=s,s):s in i?i[s]:o(s)}return ae(this,zo)&&n.nodes().forEach(a=>n.setParent(a,o(a))),n}setDefaultEdgeLabel(t){return oa(this,Ph,t),typeof t!="function"&&oa(this,Ph,()=>t),this}edgeCount(){return ae(this,Rh)}edges(){return Object.values(ae(this,xl))}setPath(t,n){var r=this,i=arguments;return t.reduce(function(o,a){return i.length>1?r.setEdge(o,a,n):r.setEdge(o,a),a}),this}setEdge(){var t,n,r,i,o=!1,a=arguments[0];typeof a=="object"&&a!==null&&"v"in a?(t=a.v,n=a.w,r=a.name,arguments.length===2&&(i=arguments[1],o=!0)):(t=a,n=arguments[1],r=arguments[3],arguments.length>2&&(i=arguments[2],o=!0)),t=""+t,n=""+n,r!==void 0&&(r=""+r);var s=Cg(ae(this,yo),t,n,r);if(ae(this,wl).hasOwnProperty(s))return o&&(ae(this,wl)[s]=i),this;if(r!==void 0&&!ae(this,ld))throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(t),this.setNode(n),ae(this,wl)[s]=o?i:ae(this,Ph).call(this,t,n,r);var l=lSe(ae(this,yo),t,n,r);return t=l.v,n=l.w,Object.freeze(l),ae(this,xl)[s]=l,F9(ae(this,Tu)[n],t),F9(ae(this,Au)[t],n),ae(this,Cs)[n][s]=l,ae(this,Es)[t][s]=l,Mp(this,Rh)._++,this}edge(t,n,r){var i=arguments.length===1?jC(ae(this,yo),arguments[0]):Cg(ae(this,yo),t,n,r);return ae(this,wl)[i]}edgeAsObj(){const t=this.edge(...arguments);return typeof t!="object"?{label:t}:t}hasEdge(t,n,r){var i=arguments.length===1?jC(ae(this,yo),arguments[0]):Cg(ae(this,yo),t,n,r);return ae(this,wl).hasOwnProperty(i)}removeEdge(t,n,r){var i=arguments.length===1?jC(ae(this,yo),arguments[0]):Cg(ae(this,yo),t,n,r),o=ae(this,xl)[i];return o&&(t=o.v,n=o.w,delete ae(this,wl)[i],delete ae(this,xl)[i],B9(ae(this,Tu)[n],t),B9(ae(this,Au)[t],n),delete ae(this,Cs)[n][i],delete ae(this,Es)[t][i],Mp(this,Rh)._--),this}inEdges(t,n){var r=ae(this,Cs)[t];if(r){var i=Object.values(r);return n?i.filter(o=>o.v===n):i}}outEdges(t,n){var r=ae(this,Es)[t];if(r){var i=Object.values(r);return n?i.filter(o=>o.w===n):i}}nodeEdges(t,n){var r=this.inEdges(t,n);if(r)return r.concat(this.outEdges(t,n))}},yo=new WeakMap,ld=new WeakMap,zo=new WeakMap,F0=new WeakMap,Ah=new WeakMap,Ph=new WeakMap,fa=new WeakMap,Cs=new WeakMap,Tu=new WeakMap,Es=new WeakMap,Au=new WeakMap,xl=new WeakMap,wl=new WeakMap,Ih=new WeakMap,Rh=new WeakMap,Cl=new WeakMap,Ua=new WeakMap,B0=new WeakSet,LE=function(t){delete ae(this,Ua)[ae(this,Cl)[t]][t]},LN);function F9(e,t){e[t]?e[t]++:e[t]=1}function B9(e,t){--e[t]||delete e[t]}function Cg(e,t,n,r){var i=""+t,o=""+n;if(!e&&i>o){var a=i;i=o,o=a}return i+L9+o+L9+(r===void 0?aSe:r)}function lSe(e,t,n,r){var i=""+t,o=""+n;if(!e&&i>o){var a=i;i=o,o=a}var s={v:i,w:o};return r&&(s.name=r),s}function jC(e,t){return Cg(e,t.v,t.w,t.name)}var pA=sSe,uSe="2.1.13",cSe={Graph:pA,version:uSe},dSe=pA,fSe={write:hSe,read:mSe};function hSe(e){var t={options:{directed:e.isDirected(),multigraph:e.isMultigraph(),compound:e.isCompound()},nodes:pSe(e),edges:gSe(e)};return e.graph()!==void 0&&(t.value=structuredClone(e.graph())),t}function pSe(e){return e.nodes().map(function(t){var n=e.node(t),r=e.parent(t),i={v:t};return n!==void 0&&(i.value=n),r!==void 0&&(i.parent=r),i})}function gSe(e){return e.edges().map(function(t){var n=e.edge(t),r={v:t.v,w:t.w};return t.name!==void 0&&(r.name=t.name),n!==void 0&&(r.value=n),r})}function mSe(e){var t=new dSe(e.options).setGraph(e.value);return e.nodes.forEach(function(n){t.setNode(n.v,n.value),n.parent&&t.setParent(n.v,n.parent)}),e.edges.forEach(function(n){t.setEdge({v:n.v,w:n.w,name:n.name},n.value)}),t}var ySe=vSe;function vSe(e){var t={},n=[],r;function i(o){t.hasOwnProperty(o)||(t[o]=!0,r.push(o),e.successors(o).forEach(i),e.predecessors(o).forEach(i))}return e.nodes().forEach(function(o){r=[],i(o),r.length&&n.push(r)}),n}var zi,El,z0,FE,j0,BE,Oh,U1,FN;let bSe=(FN=class{constructor(){Yn(this,z0);Yn(this,j0);Yn(this,Oh);Yn(this,zi,[]);Yn(this,El,{})}size(){return ae(this,zi).length}keys(){return ae(this,zi).map(function(t){return t.key})}has(t){return ae(this,El).hasOwnProperty(t)}priority(t){var n=ae(this,El)[t];if(n!==void 0)return ae(this,zi)[n].priority}min(){if(this.size()===0)throw new Error("Queue underflow");return ae(this,zi)[0].key}add(t,n){var r=ae(this,El);if(t=String(t),!r.hasOwnProperty(t)){var i=ae(this,zi),o=i.length;return r[t]=o,i.push({key:t,priority:n}),ps(this,j0,BE).call(this,o),!0}return!1}removeMin(){ps(this,Oh,U1).call(this,0,ae(this,zi).length-1);var t=ae(this,zi).pop();return delete ae(this,El)[t.key],ps(this,z0,FE).call(this,0),t.key}decrease(t,n){var r=ae(this,El)[t];if(n>ae(this,zi)[r].priority)throw new Error("New priority is greater than current priority. Key: "+t+" Old: "+ae(this,zi)[r].priority+" New: "+n);ae(this,zi)[r].priority=n,ps(this,j0,BE).call(this,r)}},zi=new WeakMap,El=new WeakMap,z0=new WeakSet,FE=function(t){var n=ae(this,zi),r=2*t,i=r+1,o=t;r>1,!(n[i].priority1;function xSe(e,t,n,r){return wSe(e,String(t),n||SSe,r||function(i){return e.outEdges(i)})}function wSe(e,t,n,r){var i={},o=new _Se,a,s,l=function(u){var c=u.v!==a?u.v:u.w,d=i[c],f=n(u),h=s.distance+f;if(f<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+u+" Weight: "+f);h0&&(a=o.removeMin(),s=i[a],s.distance!==Number.POSITIVE_INFINITY);)r(a).forEach(l);return i}var CSe=FV,ESe=kSe;function kSe(e,t,n){return e.nodes().reduce(function(r,i){return r[i]=CSe(e,i,t,n),r},{})}var BV=TSe;function TSe(e){var t=0,n=[],r={},i=[];function o(a){var s=r[a]={onStack:!0,lowlink:t,index:t++};if(n.push(a),e.successors(a).forEach(function(c){r.hasOwnProperty(c)?r[c].onStack&&(s.lowlink=Math.min(s.lowlink,r[c].index)):(o(c),s.lowlink=Math.min(s.lowlink,r[c].lowlink))}),s.lowlink===s.index){var l=[],u;do u=n.pop(),r[u].onStack=!1,l.push(u);while(a!==u);i.push(l)}}return e.nodes().forEach(function(a){r.hasOwnProperty(a)||o(a)}),i}var ASe=BV,PSe=ISe;function ISe(e){return ASe(e).filter(function(t){return t.length>1||t.length===1&&e.hasEdge(t[0],t[0])})}var RSe=MSe,OSe=()=>1;function MSe(e,t,n){return NSe(e,t||OSe,n||function(r){return e.outEdges(r)})}function NSe(e,t,n){var r={},i=e.nodes();return i.forEach(function(o){r[o]={},r[o][o]={distance:0},i.forEach(function(a){o!==a&&(r[o][a]={distance:Number.POSITIVE_INFINITY})}),n(o).forEach(function(a){var s=a.v===o?a.w:a.v,l=t(a);r[o][s]={distance:l,predecessor:o}})}),i.forEach(function(o){var a=r[o];i.forEach(function(s){var l=r[s];i.forEach(function(u){var c=l[o],d=a[u],f=l[u],h=c.distance+d.distance;he.successors(s):s=>e.neighbors(s),i=n==="post"?FSe:BSe,o=[],a={};return t.forEach(s=>{if(!e.hasNode(s))throw new Error("Graph does not have node: "+s);i(s,r,a,o)}),o}function FSe(e,t,n,r){for(var i=[[e,!1]];i.length>0;){var o=i.pop();o[1]?r.push(o[0]):n.hasOwnProperty(o[0])||(n[o[0]]=!0,i.push([o[0],!0]),VV(t(o[0]),a=>i.push([a,!1])))}}function BSe(e,t,n,r){for(var i=[e];i.length>0;){var o=i.pop();n.hasOwnProperty(o)||(n[o]=!0,r.push(o),VV(t(o),a=>i.push(a)))}}function VV(e,t){for(var n=e.length;n--;)t(e[n],n,e);return e}var zSe=UV,jSe=USe;function USe(e,t){return zSe(e,t,"post")}var VSe=UV,GSe=HSe;function HSe(e,t){return VSe(e,t,"pre")}var qSe=pA,WSe=LV,KSe=QSe;function QSe(e,t){var n=new qSe,r={},i=new WSe,o;function a(l){var u=l.v===o?l.w:l.v,c=i.priority(u);if(c!==void 0){var d=t(l);d0;){if(o=i.removeMin(),r.hasOwnProperty(o))n.setEdge(o,r[o]);else{if(s)throw new Error("Input graph is not connected: "+e);s=!0}e.nodeEdges(o).forEach(a)}return n}var XSe={components:ySe,dijkstra:FV,dijkstraAll:ESe,findCycles:PSe,floydWarshall:RSe,isAcyclic:$Se,postorder:jSe,preorder:GSe,prim:KSe,tarjan:BV,topsort:jV},j9=cSe,YSe={Graph:j9.Graph,json:fSe,alg:XSe,version:j9.version};const U9=pc(YSe),V9=(e,t,n,r)=>{const i=new U9.Graph;return n.forEach(o=>{i.setNode(o.id)}),r.forEach(o=>{i.setEdge(o.source,o.target)}),i.setEdge(e,t),U9.alg.isAcyclic(i)},G9=(e,t,n,r,i)=>{let o=!0;return t==="source"?e.find(a=>a.target===r.id&&a.targetHandle===i.name)&&(o=!1):e.find(a=>a.source===r.id&&a.sourceHandle===i.name)&&(o=!1),oSe(n,i.type)||(o=!1),o},H9=(e,t,n,r,i,o,a)=>{if(e.id===r)return null;const s=o=="source"?e.data.inputs:e.data.outputs;if(s[i]){const l=s[i],u=o=="source"?r:e.id,c=o=="source"?e.id:r,d=o=="source"?i:l.name,f=o=="source"?l.name:i,h=V9(u,c,t,n),p=G9(n,o,a,e,l);if(h&&p)return{source:u,sourceHandle:d,target:c,targetHandle:f}}for(const l in s){const u=s[l],c=o=="source"?r:e.id,d=o=="source"?e.id:r,f=o=="source"?i:u.name,h=o=="source"?u.name:i,p=V9(c,d,t,n),m=G9(n,o,a,e,u);if(p&&m)return{source:c,sourceHandle:f,target:d,targetHandle:h}}return null},ZSe="1.0.0",UC={status:Hc.PENDING,error:null,progress:null,progressImage:null,outputs:[]},jE={meta:{version:ZSe},name:"",author:"",description:"",notes:"",tags:"",contact:"",version:"",exposedFields:[]},GV={nodes:[],edges:[],nodeTemplates:{},isReady:!1,connectionStartParams:null,currentConnectionFieldType:null,connectionMade:!1,modifyingEdge:!1,addNewNodePosition:null,shouldShowFieldTypeLegend:!1,shouldShowMinimapPanel:!0,shouldValidateGraph:!0,shouldAnimateEdges:!0,shouldSnapToGrid:!1,shouldColorEdges:!0,isAddNodePopoverOpen:!1,nodeOpacity:1,selectedNodes:[],selectedEdges:[],workflow:jE,nodeExecutionStates:{},viewport:{x:0,y:0,zoom:1},mouseOverField:null,mouseOverNode:null,nodesToCopy:[],edgesToCopy:[],selectionMode:sc.Partial},go=(e,t)=>{var l,u;const{nodeId:n,fieldName:r,value:i}=t.payload,o=e.nodes.findIndex(c=>c.id===n),a=(l=e.nodes)==null?void 0:l[o];if(!jr(a))return;const s=(u=a.data)==null?void 0:u.inputs[r];s&&o>-1&&(s.value=i)},HV=nr({name:"nodes",initialState:GV,reducers:{nodesChanged:(e,t)=>{e.nodes=Uc(t.payload,e.nodes)},nodeAdded:(e,t)=>{var i,o;const n=t.payload,r=D9(e.nodes,((i=e.addNewNodePosition)==null?void 0:i.x)??n.position.x,((o=e.addNewNodePosition)==null?void 0:o.y)??n.position.y);if(n.position=r,n.selected=!0,e.nodes=Uc(e.nodes.map(a=>({id:a.id,type:"select",selected:!1})),e.nodes),e.edges=Rc(e.edges.map(a=>({id:a.id,type:"select",selected:!1})),e.edges),e.nodes.push(n),!!jr(n)){if(e.nodeExecutionStates[n.id]={nodeId:n.id,...UC},e.connectionStartParams){const{nodeId:a,handleId:s,handleType:l}=e.connectionStartParams;if(a&&s&&l&&e.currentConnectionFieldType){const u=H9(n,e.nodes,e.edges,a,s,l,e.currentConnectionFieldType);u&&(e.edges=xg({...u,type:"default"},e.edges))}}e.connectionStartParams=null,e.currentConnectionFieldType=null}},edgeChangeStarted:e=>{e.modifyingEdge=!0},edgesChanged:(e,t)=>{e.edges=Rc(t.payload,e.edges)},edgeAdded:(e,t)=>{e.edges=xg(t.payload,e.edges)},edgeUpdated:(e,t)=>{const{oldEdge:n,newConnection:r}=t.payload;e.edges=Ebe(n,r,e.edges)},connectionStarted:(e,t)=>{var l;e.connectionStartParams=t.payload,e.connectionMade=e.modifyingEdge;const{nodeId:n,handleId:r,handleType:i}=t.payload;if(!n||!r)return;const o=e.nodes.findIndex(u=>u.id===n),a=(l=e.nodes)==null?void 0:l[o];if(!jr(a))return;const s=i==="source"?a.data.outputs[r]:a.data.inputs[r];e.currentConnectionFieldType=(s==null?void 0:s.type)??null},connectionMade:(e,t)=>{e.currentConnectionFieldType&&(e.edges=xg({...t.payload,type:"default"},e.edges),e.connectionMade=!0)},connectionEnded:(e,t)=>{var n;if(e.connectionMade)e.connectionStartParams=null,e.currentConnectionFieldType=null;else if(e.mouseOverNode){const r=e.nodes.findIndex(o=>o.id===e.mouseOverNode),i=(n=e.nodes)==null?void 0:n[r];if(i&&e.connectionStartParams){const{nodeId:o,handleId:a,handleType:s}=e.connectionStartParams;if(o&&a&&s&&e.currentConnectionFieldType){const l=H9(i,e.nodes,e.edges,o,a,s,e.currentConnectionFieldType);l&&(e.edges=xg({...l,type:"default"},e.edges))}}e.connectionStartParams=null,e.currentConnectionFieldType=null}else e.addNewNodePosition=t.payload.cursorPosition,e.isAddNodePopoverOpen=!0;e.modifyingEdge=!1},workflowExposedFieldAdded:(e,t)=>{e.workflow.exposedFields=Q8(e.workflow.exposedFields.concat(t.payload),n=>`${n.nodeId}-${n.fieldName}`)},workflowExposedFieldRemoved:(e,t)=>{e.workflow.exposedFields=e.workflow.exposedFields.filter(n=>!dT(n,t.payload))},fieldLabelChanged:(e,t)=>{const{nodeId:n,fieldName:r,label:i}=t.payload,o=e.nodes.find(s=>s.id===n);if(!jr(o))return;const a=o.data.inputs[r];a&&(a.label=i)},nodeEmbedWorkflowChanged:(e,t)=>{var a;const{nodeId:n,embedWorkflow:r}=t.payload,i=e.nodes.findIndex(s=>s.id===n),o=(a=e.nodes)==null?void 0:a[i];jr(o)&&(o.data.embedWorkflow=r)},nodeUseCacheChanged:(e,t)=>{var a;const{nodeId:n,useCache:r}=t.payload,i=e.nodes.findIndex(s=>s.id===n),o=(a=e.nodes)==null?void 0:a[i];jr(o)&&(o.data.useCache=r)},nodeIsIntermediateChanged:(e,t)=>{var a;const{nodeId:n,isIntermediate:r}=t.payload,i=e.nodes.findIndex(s=>s.id===n),o=(a=e.nodes)==null?void 0:a[i];jr(o)&&(o.data.isIntermediate=r)},nodeIsOpenChanged:(e,t)=>{var s;const{nodeId:n,isOpen:r}=t.payload,i=e.nodes.findIndex(l=>l.id===n),o=(s=e.nodes)==null?void 0:s[i];if(!jr(o)&&!gI(o)||(o.data.isOpen=r,!jr(o)))return;const a=uA([o],e.edges);if(r)a.forEach(l=>{delete l.hidden}),a.forEach(l=>{l.type==="collapsed"&&(e.edges=e.edges.filter(u=>u.id!==l.id))});else{const l=wbe(o,e.nodes,e.edges).filter(d=>jr(d)&&d.data.isOpen===!1),u=xbe(o,e.nodes,e.edges).filter(d=>jr(d)&&d.data.isOpen===!1),c=[];a.forEach(d=>{var f,h;if(d.target===n&&l.find(p=>p.id===d.source)){d.hidden=!0;const p=c.find(m=>m.source===d.source&&m.target===d.target);p?p.data={count:(((f=p.data)==null?void 0:f.count)??0)+1}:c.push({id:`${d.source}-${d.target}-collapsed`,source:d.source,target:d.target,type:"collapsed",data:{count:1},updatable:!1})}if(d.source===n&&u.find(p=>p.id===d.target)){const p=c.find(m=>m.source===d.source&&m.target===d.target);d.hidden=!0,p?p.data={count:(((h=p.data)==null?void 0:h.count)??0)+1}:c.push({id:`${d.source}-${d.target}-collapsed`,source:d.source,target:d.target,type:"collapsed",data:{count:1},updatable:!1})}}),c.length&&(e.edges=Rc(c.map(d=>({type:"add",item:d})),e.edges))}},edgeDeleted:(e,t)=>{e.edges=e.edges.filter(n=>n.id!==t.payload)},edgesDeleted:(e,t)=>{const r=t.payload.filter(i=>i.type==="collapsed");if(r.length){const i=[];r.forEach(o=>{e.edges.forEach(a=>{a.source===o.source&&a.target===o.target&&i.push({id:a.id,type:"remove"})})}),e.edges=Rc(i,e.edges)}},nodesDeleted:(e,t)=>{t.payload.forEach(n=>{e.workflow.exposedFields=e.workflow.exposedFields.filter(r=>r.nodeId!==n.id),jr(n)&&delete e.nodeExecutionStates[n.id]})},nodeLabelChanged:(e,t)=>{var a;const{nodeId:n,label:r}=t.payload,i=e.nodes.findIndex(s=>s.id===n),o=(a=e.nodes)==null?void 0:a[i];jr(o)&&(o.data.label=r)},nodeNotesChanged:(e,t)=>{var a;const{nodeId:n,notes:r}=t.payload,i=e.nodes.findIndex(s=>s.id===n),o=(a=e.nodes)==null?void 0:a[i];jr(o)&&(o.data.notes=r)},nodeExclusivelySelected:(e,t)=>{const n=t.payload;e.nodes=Uc(e.nodes.map(r=>({id:r.id,type:"select",selected:r.id===n})),e.nodes)},selectedNodesChanged:(e,t)=>{e.selectedNodes=t.payload},selectedEdgesChanged:(e,t)=>{e.selectedEdges=t.payload},fieldStringValueChanged:(e,t)=>{go(e,t)},fieldNumberValueChanged:(e,t)=>{go(e,t)},fieldBooleanValueChanged:(e,t)=>{go(e,t)},fieldBoardValueChanged:(e,t)=>{go(e,t)},fieldImageValueChanged:(e,t)=>{go(e,t)},fieldColorValueChanged:(e,t)=>{go(e,t)},fieldMainModelValueChanged:(e,t)=>{go(e,t)},fieldRefinerModelValueChanged:(e,t)=>{go(e,t)},fieldVaeModelValueChanged:(e,t)=>{go(e,t)},fieldLoRAModelValueChanged:(e,t)=>{go(e,t)},fieldControlNetModelValueChanged:(e,t)=>{go(e,t)},fieldIPAdapterModelValueChanged:(e,t)=>{go(e,t)},fieldEnumModelValueChanged:(e,t)=>{go(e,t)},fieldSchedulerValueChanged:(e,t)=>{go(e,t)},imageCollectionFieldValueChanged:(e,t)=>{var u,c;const{nodeId:n,fieldName:r,value:i}=t.payload,o=e.nodes.findIndex(d=>d.id===n);if(o===-1)return;const a=(u=e.nodes)==null?void 0:u[o];if(!jr(a))return;const s=(c=a.data)==null?void 0:c.inputs[r];if(!s)return;const l=wn(s.value);if(!l){s.value=i;return}s.value=Q8(l.concat(i),"image_name")},notesNodeValueChanged:(e,t)=>{var a;const{nodeId:n,value:r}=t.payload,i=e.nodes.findIndex(s=>s.id===n),o=(a=e.nodes)==null?void 0:a[i];gI(o)&&(o.data.notes=r)},shouldShowFieldTypeLegendChanged:(e,t)=>{e.shouldShowFieldTypeLegend=t.payload},shouldShowMinimapPanelChanged:(e,t)=>{e.shouldShowMinimapPanel=t.payload},nodeTemplatesBuilt:(e,t)=>{e.nodeTemplates=t.payload,e.isReady=!0},nodeEditorReset:e=>{e.nodes=[],e.edges=[],e.workflow=wn(jE)},shouldValidateGraphChanged:(e,t)=>{e.shouldValidateGraph=t.payload},shouldAnimateEdgesChanged:(e,t)=>{e.shouldAnimateEdges=t.payload},shouldSnapToGridChanged:(e,t)=>{e.shouldSnapToGrid=t.payload},shouldColorEdgesChanged:(e,t)=>{e.shouldColorEdges=t.payload},nodeOpacityChanged:(e,t)=>{e.nodeOpacity=t.payload},workflowNameChanged:(e,t)=>{e.workflow.name=t.payload},workflowDescriptionChanged:(e,t)=>{e.workflow.description=t.payload},workflowTagsChanged:(e,t)=>{e.workflow.tags=t.payload},workflowAuthorChanged:(e,t)=>{e.workflow.author=t.payload},workflowNotesChanged:(e,t)=>{e.workflow.notes=t.payload},workflowVersionChanged:(e,t)=>{e.workflow.version=t.payload},workflowContactChanged:(e,t)=>{e.workflow.contact=t.payload},workflowLoaded:(e,t)=>{const{nodes:n,edges:r,...i}=t.payload;e.workflow=i,e.nodes=Uc(n.map(o=>({item:{...o,dragHandle:`.${tSe}`},type:"add"})),[]),e.edges=Rc(r.map(o=>({item:o,type:"add"})),[]),e.nodeExecutionStates=n.reduce((o,a)=>(o[a.id]={nodeId:a.id,...UC},o),{})},workflowReset:e=>{e.workflow=wn(jE)},viewportChanged:(e,t)=>{e.viewport=t.payload},mouseOverFieldChanged:(e,t)=>{e.mouseOverField=t.payload},mouseOverNodeChanged:(e,t)=>{e.mouseOverNode=t.payload},selectedAll:e=>{e.nodes=Uc(e.nodes.map(t=>({id:t.id,type:"select",selected:!0})),e.nodes),e.edges=Rc(e.edges.map(t=>({id:t.id,type:"select",selected:!0})),e.edges)},selectionCopied:e=>{if(e.nodesToCopy=e.nodes.filter(t=>t.selected).map(wn),e.edgesToCopy=e.edges.filter(t=>t.selected).map(wn),e.nodesToCopy.length>0){const t={x:0,y:0};e.nodesToCopy.forEach(n=>{const r=.15*(n.width??0),i=.5*(n.height??0);t.x+=n.position.x+r,t.y+=n.position.y+i}),t.x/=e.nodesToCopy.length,t.y/=e.nodesToCopy.length,e.nodesToCopy.forEach(n=>{n.position.x-=t.x,n.position.y-=t.y})}},selectionPasted:(e,t)=>{const{cursorPosition:n}=t.payload,r=e.nodesToCopy.map(wn),i=r.map(c=>c.data.id),o=e.edgesToCopy.filter(c=>i.includes(c.source)&&i.includes(c.target)).map(wn);o.forEach(c=>c.selected=!0),r.forEach(c=>{const d=$V();o.forEach(h=>{h.source===c.data.id&&(h.source=d,h.id=h.id.replace(c.data.id,d)),h.target===c.data.id&&(h.target=d,h.id=h.id.replace(c.data.id,d))}),c.selected=!0,c.id=d,c.data.id=d;const f=D9(e.nodes,c.position.x+((n==null?void 0:n.x)??0),c.position.y+((n==null?void 0:n.y)??0));c.position=f});const a=r.map(c=>({item:c,type:"add"})),s=e.nodes.map(c=>({id:c.data.id,type:"select",selected:!1})),l=o.map(c=>({item:c,type:"add"})),u=e.edges.map(c=>({id:c.id,type:"select",selected:!1}));e.nodes=Uc(a.concat(s),e.nodes),e.edges=Rc(l.concat(u),e.edges),r.forEach(c=>{e.nodeExecutionStates[c.id]={nodeId:c.id,...UC}})},addNodePopoverOpened:e=>{e.addNewNodePosition=null,e.isAddNodePopoverOpen=!0},addNodePopoverClosed:e=>{e.isAddNodePopoverOpen=!1,e.connectionStartParams=null,e.currentConnectionFieldType=null},addNodePopoverToggled:e=>{e.isAddNodePopoverOpen=!e.isAddNodePopoverOpen},selectionModeChanged:(e,t)=>{e.selectionMode=t.payload?sc.Full:sc.Partial}},extraReducers:e=>{e.addCase(g0.pending,t=>{t.isReady=!1}),e.addCase(jT,(t,n)=>{const{source_node_id:r}=n.payload.data,i=t.nodeExecutionStates[r];i&&(i.status=Hc.IN_PROGRESS)}),e.addCase(VT,(t,n)=>{const{source_node_id:r,result:i}=n.payload.data,o=t.nodeExecutionStates[r];o&&(o.status=Hc.COMPLETED,o.progress!==null&&(o.progress=1),o.outputs.push(i))}),e.addCase(U2,(t,n)=>{const{source_node_id:r}=n.payload.data,i=t.nodeExecutionStates[r];i&&(i.status=Hc.FAILED,i.error=n.payload.data.error,i.progress=null,i.progressImage=null)}),e.addCase(GT,(t,n)=>{const{source_node_id:r,step:i,total_steps:o,progress_image:a}=n.payload.data,s=t.nodeExecutionStates[r];s&&(s.status=Hc.IN_PROGRESS,s.progress=(i+1)/o,s.progressImage=a??null)}),e.addCase(HT,(t,n)=>{["in_progress"].includes(n.payload.data.status)&&Ca(t.nodeExecutionStates,r=>{r.status=Hc.PENDING,r.error=null,r.progress=null,r.progressImage=null,r.outputs=[]})})}}),{addNodePopoverClosed:AHe,addNodePopoverOpened:PHe,addNodePopoverToggled:IHe,connectionEnded:RHe,connectionMade:OHe,connectionStarted:MHe,edgeDeleted:NHe,edgeChangeStarted:$He,edgesChanged:DHe,edgesDeleted:LHe,edgeUpdated:FHe,fieldBoardValueChanged:BHe,fieldBooleanValueChanged:zHe,fieldColorValueChanged:jHe,fieldControlNetModelValueChanged:UHe,fieldEnumModelValueChanged:VHe,fieldImageValueChanged:X2,fieldIPAdapterModelValueChanged:GHe,fieldLabelChanged:HHe,fieldLoRAModelValueChanged:qHe,fieldMainModelValueChanged:WHe,fieldNumberValueChanged:KHe,fieldRefinerModelValueChanged:QHe,fieldSchedulerValueChanged:XHe,fieldStringValueChanged:YHe,fieldVaeModelValueChanged:ZHe,imageCollectionFieldValueChanged:JHe,mouseOverFieldChanged:eqe,mouseOverNodeChanged:tqe,nodeAdded:nqe,nodeEditorReset:JSe,nodeEmbedWorkflowChanged:rqe,nodeExclusivelySelected:iqe,nodeIsIntermediateChanged:oqe,nodeIsOpenChanged:aqe,nodeLabelChanged:sqe,nodeNotesChanged:lqe,nodeOpacityChanged:uqe,nodesChanged:cqe,nodesDeleted:dqe,nodeTemplatesBuilt:qV,nodeUseCacheChanged:fqe,notesNodeValueChanged:hqe,selectedAll:pqe,selectedEdgesChanged:gqe,selectedNodesChanged:mqe,selectionCopied:yqe,selectionModeChanged:vqe,selectionPasted:bqe,shouldAnimateEdgesChanged:_qe,shouldColorEdgesChanged:Sqe,shouldShowFieldTypeLegendChanged:xqe,shouldShowMinimapPanelChanged:wqe,shouldSnapToGridChanged:Cqe,shouldValidateGraphChanged:Eqe,viewportChanged:kqe,workflowAuthorChanged:Tqe,workflowContactChanged:Aqe,workflowDescriptionChanged:Pqe,workflowExposedFieldAdded:e2e,workflowExposedFieldRemoved:Iqe,workflowLoaded:t2e,workflowNameChanged:Rqe,workflowNotesChanged:Oqe,workflowTagsChanged:Mqe,workflowVersionChanged:Nqe,edgeAdded:$qe}=HV.actions,n2e=HV.reducer,WV={esrganModelName:"RealESRGAN_x4plus.pth"},KV=nr({name:"postprocessing",initialState:WV,reducers:{esrganModelNameChanged:(e,t)=>{e.esrganModelName=t.payload}}}),{esrganModelNameChanged:Dqe}=KV.actions,r2e=KV.reducer,QV={positiveStylePrompt:"",negativeStylePrompt:"",shouldConcatSDXLStylePrompt:!0,shouldUseSDXLRefiner:!1,sdxlImg2ImgDenoisingStrength:.7,refinerModel:null,refinerSteps:20,refinerCFGScale:7.5,refinerScheduler:"euler",refinerPositiveAestheticScore:6,refinerNegativeAestheticScore:2.5,refinerStart:.8},XV=nr({name:"sdxl",initialState:QV,reducers:{setPositiveStylePromptSDXL:(e,t)=>{e.positiveStylePrompt=t.payload},setNegativeStylePromptSDXL:(e,t)=>{e.negativeStylePrompt=t.payload},setShouldConcatSDXLStylePrompt:(e,t)=>{e.shouldConcatSDXLStylePrompt=t.payload},setShouldUseSDXLRefiner:(e,t)=>{e.shouldUseSDXLRefiner=t.payload},setSDXLImg2ImgDenoisingStrength:(e,t)=>{e.sdxlImg2ImgDenoisingStrength=t.payload},refinerModelChanged:(e,t)=>{e.refinerModel=t.payload},setRefinerSteps:(e,t)=>{e.refinerSteps=t.payload},setRefinerCFGScale:(e,t)=>{e.refinerCFGScale=t.payload},setRefinerScheduler:(e,t)=>{e.refinerScheduler=t.payload},setRefinerPositiveAestheticScore:(e,t)=>{e.refinerPositiveAestheticScore=t.payload},setRefinerNegativeAestheticScore:(e,t)=>{e.refinerNegativeAestheticScore=t.payload},setRefinerStart:(e,t)=>{e.refinerStart=t.payload}}}),{setPositiveStylePromptSDXL:Lqe,setNegativeStylePromptSDXL:Fqe,setShouldConcatSDXLStylePrompt:Bqe,setShouldUseSDXLRefiner:i2e,setSDXLImg2ImgDenoisingStrength:zqe,refinerModelChanged:q9,setRefinerSteps:jqe,setRefinerCFGScale:Uqe,setRefinerScheduler:Vqe,setRefinerPositiveAestheticScore:Gqe,setRefinerNegativeAestheticScore:Hqe,setRefinerStart:qqe}=XV.actions,o2e=XV.reducer,a2e=(e,t,n)=>t===0?0:n===2?Math.floor((e+1+1)/2)/Math.floor((t+1)/2):(e+1+1)/(t+1),$d=e=>typeof e=="string"?{title:e,status:"info",isClosable:!0,duration:2500}:{status:"info",isClosable:!0,duration:2500,...e},YV={isInitialized:!1,isConnected:!1,shouldConfirmOnDelete:!0,enableImageDebugging:!1,toastQueue:[],denoiseProgress:null,shouldAntialiasProgressImage:!1,consoleLogLevel:"debug",shouldLogToConsole:!0,language:"en",shouldUseNSFWChecker:!1,shouldUseWatermarker:!1,shouldEnableInformationalPopovers:!1,status:"DISCONNECTED"},ZV=nr({name:"system",initialState:YV,reducers:{setShouldConfirmOnDelete:(e,t)=>{e.shouldConfirmOnDelete=t.payload},setEnableImageDebugging:(e,t)=>{e.enableImageDebugging=t.payload},addToast:(e,t)=>{e.toastQueue.push(t.payload)},clearToastQueue:e=>{e.toastQueue=[]},consoleLogLevelChanged:(e,t)=>{e.consoleLogLevel=t.payload},shouldLogToConsoleChanged:(e,t)=>{e.shouldLogToConsole=t.payload},shouldAntialiasProgressImageChanged:(e,t)=>{e.shouldAntialiasProgressImage=t.payload},languageChanged:(e,t)=>{e.language=t.payload},shouldUseNSFWCheckerChanged(e,t){e.shouldUseNSFWChecker=t.payload},shouldUseWatermarkerChanged(e,t){e.shouldUseWatermarker=t.payload},setShouldEnableInformationalPopovers(e,t){e.shouldEnableInformationalPopovers=t.payload},isInitializedChanged(e,t){e.isInitialized=t.payload}},extraReducers(e){e.addCase(zT,t=>{t.isConnected=!0,t.denoiseProgress=null,t.status="CONNECTED"}),e.addCase(jj,t=>{t.isConnected=!1,t.denoiseProgress=null,t.status="DISCONNECTED"}),e.addCase(jT,t=>{t.denoiseProgress=null,t.status="PROCESSING"}),e.addCase(GT,(t,n)=>{const{step:r,total_steps:i,order:o,progress_image:a,graph_execution_state_id:s,queue_batch_id:l}=n.payload.data;t.denoiseProgress={step:r,total_steps:i,order:o,percentage:a2e(r,i,o),progress_image:a,session_id:s,batch_id:l},t.status="PROCESSING"}),e.addCase(VT,t=>{t.denoiseProgress=null,t.status="CONNECTED"}),e.addCase(Hj,t=>{t.denoiseProgress=null,t.status="CONNECTED"}),e.addCase(Kj,t=>{t.status="LOADING_MODEL"}),e.addCase(Xj,t=>{t.status="CONNECTED"}),e.addCase(HT,(t,n)=>{["completed","canceled","failed"].includes(n.payload.data.status)&&(t.status="CONNECTED",t.denoiseProgress=null)}),e.addMatcher(d2e,(t,n)=>{t.toastQueue.push($d({title:Z("toast.serverError"),status:"error",description:wae(n.payload.data.error_type)}))})}}),{setShouldConfirmOnDelete:Wqe,setEnableImageDebugging:Kqe,addToast:Gt,clearToastQueue:Qqe,consoleLogLevelChanged:Xqe,shouldLogToConsoleChanged:Yqe,shouldAntialiasProgressImageChanged:Zqe,languageChanged:Jqe,shouldUseNSFWCheckerChanged:s2e,shouldUseWatermarkerChanged:l2e,setShouldEnableInformationalPopovers:eWe,isInitializedChanged:u2e}=ZV.actions,c2e=ZV.reducer,d2e=No(U2,Zj,eU),f2e={listCursor:void 0,listPriority:void 0,selectedQueueItem:void 0,resumeProcessorOnEnqueue:!0},h2e=f2e,JV=nr({name:"queue",initialState:h2e,reducers:{listCursorChanged:(e,t)=>{e.listCursor=t.payload},listPriorityChanged:(e,t)=>{e.listPriority=t.payload},listParamsReset:e=>{e.listCursor=void 0,e.listPriority=void 0},queueItemSelectionToggled:(e,t)=>{e.selectedQueueItem===t.payload?e.selectedQueueItem=void 0:e.selectedQueueItem=t.payload},resumeProcessorOnEnqueueChanged:(e,t)=>{e.resumeProcessorOnEnqueue=t.payload}}}),{listCursorChanged:tWe,listPriorityChanged:nWe,listParamsReset:p2e,queueItemSelectionToggled:rWe,resumeProcessorOnEnqueueChanged:iWe}=JV.actions,g2e=JV.reducer,m2e={searchFolder:null,advancedAddScanModel:null},eG=nr({name:"modelmanager",initialState:m2e,reducers:{setSearchFolder:(e,t)=>{e.searchFolder=t.payload},setAdvancedAddScanModel:(e,t)=>{e.advancedAddScanModel=t.payload}}}),{setSearchFolder:oWe,setAdvancedAddScanModel:aWe}=eG.actions,y2e=eG.reducer,tG={shift:!1,ctrl:!1,meta:!1},nG=nr({name:"hotkeys",initialState:tG,reducers:{shiftKeyPressed:(e,t)=>{e.shift=t.payload},ctrlKeyPressed:(e,t)=>{e.ctrl=t.payload},metaKeyPressed:(e,t)=>{e.meta=t.payload}}}),{shiftKeyPressed:sWe,ctrlKeyPressed:lWe,metaKeyPressed:uWe}=nG.actions,v2e=nG.reducer,rG={activeTab:"txt2img",shouldShowImageDetails:!1,shouldUseCanvasBetaLayout:!1,shouldShowExistingModelsInSearch:!1,shouldUseSliders:!1,shouldHidePreview:!1,shouldShowProgressInViewer:!0,shouldShowEmbeddingPicker:!1,shouldAutoChangeDimensions:!1,favoriteSchedulers:[],globalContextMenuCloseTrigger:0,panels:{}},iG=nr({name:"ui",initialState:rG,reducers:{setActiveTab:(e,t)=>{e.activeTab=t.payload},setShouldShowImageDetails:(e,t)=>{e.shouldShowImageDetails=t.payload},setShouldUseCanvasBetaLayout:(e,t)=>{e.shouldUseCanvasBetaLayout=t.payload},setShouldHidePreview:(e,t)=>{e.shouldHidePreview=t.payload},setShouldShowExistingModelsInSearch:(e,t)=>{e.shouldShowExistingModelsInSearch=t.payload},setShouldUseSliders:(e,t)=>{e.shouldUseSliders=t.payload},setShouldShowProgressInViewer:(e,t)=>{e.shouldShowProgressInViewer=t.payload},favoriteSchedulersChanged:(e,t)=>{e.favoriteSchedulers=t.payload},toggleEmbeddingPicker:e=>{e.shouldShowEmbeddingPicker=!e.shouldShowEmbeddingPicker},setShouldAutoChangeDimensions:(e,t)=>{e.shouldAutoChangeDimensions=t.payload},contextMenusClosed:e=>{e.globalContextMenuCloseTrigger+=1},panelsChanged:(e,t)=>{e.panels[t.payload.name]=t.payload.value}},extraReducers(e){e.addCase(XS,t=>{t.activeTab="img2img"})}}),{setActiveTab:oG,setShouldShowImageDetails:cWe,setShouldUseCanvasBetaLayout:dWe,setShouldShowExistingModelsInSearch:fWe,setShouldUseSliders:hWe,setShouldHidePreview:pWe,setShouldShowProgressInViewer:gWe,favoriteSchedulersChanged:mWe,toggleEmbeddingPicker:yWe,setShouldAutoChangeDimensions:vWe,contextMenusClosed:bWe,panelsChanged:_We}=iG.actions,b2e=iG.reducer,_2e=dS(DY);aG=UE=void 0;var S2e=_2e,x2e=function(){var t=[],n=[],r=void 0,i=function(u){return r=u,function(c){return function(d){return S2e.compose.apply(void 0,n)(c)(d)}}},o=function(){for(var u,c,d=arguments.length,f=Array(d),h=0;h=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(u){throw u},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var o=!0,a=!1,s;return{s:function(){n=n.call(e)},n:function(){var u=n.next();return o=u.done,u},e:function(u){a=!0,s=u},f:function(){try{!o&&n.return!=null&&n.return()}finally{if(a)throw s}}}}function lG(e,t){if(e){if(typeof e=="string")return K9(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return K9(e,t)}}function K9(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=arguments.length>2?arguments[2]:void 0,i=r.prefix,o=r.driver,a=r.persistWholeStore,s=r.serialize;try{var l=a?D2e:L2e;yield l(t,n,{prefix:i,driver:o,serialize:s})}catch(u){console.warn("redux-remember: persist error",u)}});return function(){return e.apply(this,arguments)}}();function Z9(e,t,n,r,i,o,a){try{var s=e[o](a),l=s.value}catch(u){n(u);return}s.done?t(l):Promise.resolve(l).then(r,i)}function J9(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function a(l){Z9(o,r,i,a,s,"next",l)}function s(l){Z9(o,r,i,a,s,"throw",l)}a(void 0)})}}var B2e=function(){var e=J9(function*(t,n,r){var i=r.prefix,o=r.driver,a=r.serialize,s=r.unserialize,l=r.persistThrottle,u=r.persistDebounce,c=r.persistWholeStore;yield R2e(t,n,{prefix:i,driver:o,unserialize:s,persistWholeStore:c});var d={},f=function(){var h=J9(function*(){var p=sG(t.getState(),n);yield F2e(p,d,{prefix:i,driver:o,serialize:a,persistWholeStore:c}),mA(p,d)||t.dispatch({type:k2e,payload:p}),d=p});return function(){return h.apply(this,arguments)}}();u&&u>0?t.subscribe(A2e(f,u)):t.subscribe(T2e(f,l))});return function(n,r,i){return e.apply(this,arguments)}}();const z2e=B2e;function m0(e){"@babel/helpers - typeof";return m0=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},m0(e)}function eO(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function HC(e){for(var t=1;t0&&arguments[0]!==void 0?arguments[0]:n.state,i=arguments.length>1?arguments[1]:void 0;i.type&&(i.type==="@@INIT"||i.type.startsWith("@@redux/INIT"))&&(n.state=HC({},r));var o=typeof t=="function"?t:pp(t);switch(i.type){case VE:{var a=HC(HC({},n.state),i.payload||{});return n.state=o(a,{type:VE,payload:a}),n.state}default:return o(r,i)}}},H2e=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},i=r.prefix,o=i===void 0?"@@remember-":i,a=r.serialize,s=a===void 0?function(_,b){return JSON.stringify(_)}:a,l=r.unserialize,u=l===void 0?function(_,b){return JSON.parse(_)}:l,c=r.persistThrottle,d=c===void 0?100:c,f=r.persistDebounce,h=r.persistWholeStore,p=h===void 0?!1:h;if(!t)throw Error("redux-remember error: driver required");if(!Array.isArray(n))throw Error("redux-remember error: rememberedKeys needs to be an array");var m=function(b){return function(v,g,y){var S=b(v,g,y);return z2e(S,n,{driver:t,prefix:o,serialize:s,unserialize:u,persistThrottle:d,persistDebounce:f,persistWholeStore:p}),S}};return m};const SWe=["chakra-ui-color-mode","i18nextLng","ROARR_FILTER","ROARR_LOG"],q2e="@@invokeai-",W2e=["cursorPosition"],K2e=["pendingControlImages"],Q2e=["prompts"],X2e=["selection","selectedBoardId","galleryView"],Y2e=["nodeTemplates","connectionStartParams","currentConnectionFieldType","selectedNodes","selectedEdges","isReady","nodesToCopy","edgesToCopy","connectionMade","modifyingEdge","addNewNodePosition"],Z2e=[],J2e=[],exe=["isInitialized","isConnected","denoiseProgress","status"],txe=["shouldShowImageDetails","globalContextMenuCloseTrigger","panels"],nxe={canvas:W2e,gallery:X2e,generation:Z2e,nodes:Y2e,postprocessing:J2e,system:exe,ui:txe,controlNet:K2e,dynamicPrompts:Q2e},rxe=(e,t)=>{const n=qS(e,nxe[t]??[]);return JSON.stringify(n)},ixe={canvas:CB,gallery:cU,generation:pT,nodes:GV,postprocessing:WV,system:YV,config:uB,ui:rG,hotkeys:tG,controlNet:_E,dynamicPrompts:QT,sdxl:QV},oxe=(e,t)=>yoe(JSON.parse(e),ixe[t]),axe=Ne("nodes/textToImageGraphBuilt"),sxe=Ne("nodes/imageToImageGraphBuilt"),cG=Ne("nodes/canvasGraphBuilt"),lxe=Ne("nodes/nodesGraphBuilt"),uxe=No(axe,sxe,cG,lxe),cxe=Ne("nodes/workflowLoadRequested"),dxe=e=>{if(uxe(e)&&e.payload.nodes){const t={};return{...e,payload:{...e.payload,nodes:t}}}return g0.fulfilled.match(e)?{...e,payload:""}:qV.match(e)?{...e,payload:""}:e},fxe=["canvas/setCursorPosition","canvas/setStageCoordinates","canvas/setStageScale","canvas/setIsDrawing","canvas/setBoundingBoxCoordinates","canvas/setBoundingBoxDimensions","canvas/setIsDrawing","canvas/addPointToCurrentLine","socket/socketGeneratorProgress","socket/appSocketGeneratorProgress","@@REMEMBER_PERSISTED"],hxe=e=>e,dG="default",Ur=tl(dG),pxe=e=>{const t=e?Kg.stringify(e,{arrayFormat:"none"}):void 0;return t?`queue/${Ur.get()}/list?${t}`:`queue/${Ur.get()}/list`},qc=Js({selectId:e=>e.item_id,sortComparer:(e,t)=>e.priority>t.priority?-1:e.priorityt.item_id?1:0}),Qr=ls.injectEndpoints({endpoints:e=>({enqueueBatch:e.mutation({query:t=>({url:`queue/${Ur.get()}/enqueue_batch`,body:t,method:"POST"}),invalidatesTags:["SessionQueueStatus","CurrentSessionQueueItem","NextSessionQueueItem"],onQueryStarted:async(t,n)=>{const{dispatch:r,queryFulfilled:i}=n;try{await i,Jp(r)}catch{}}}),enqueueGraph:e.mutation({query:t=>({url:`queue/${Ur.get()}/enqueue_graph`,body:t,method:"POST"}),invalidatesTags:["SessionQueueStatus","CurrentSessionQueueItem","NextSessionQueueItem"],onQueryStarted:async(t,n)=>{const{dispatch:r,queryFulfilled:i}=n;try{await i,Jp(r)}catch{}}}),resumeProcessor:e.mutation({query:()=>({url:`queue/${Ur.get()}/processor/resume`,method:"PUT"}),invalidatesTags:["CurrentSessionQueueItem","SessionQueueStatus"]}),pauseProcessor:e.mutation({query:()=>({url:`queue/${Ur.get()}/processor/pause`,method:"PUT"}),invalidatesTags:["CurrentSessionQueueItem","SessionQueueStatus"]}),pruneQueue:e.mutation({query:()=>({url:`queue/${Ur.get()}/prune`,method:"PUT"}),invalidatesTags:["SessionQueueStatus","BatchStatus","SessionQueueItem","SessionQueueItemDTO"],onQueryStarted:async(t,n)=>{const{dispatch:r,queryFulfilled:i}=n;try{await i,Jp(r)}catch{}}}),clearQueue:e.mutation({query:()=>({url:`queue/${Ur.get()}/clear`,method:"PUT"}),invalidatesTags:["SessionQueueStatus","SessionProcessorStatus","BatchStatus","CurrentSessionQueueItem","NextSessionQueueItem","SessionQueueItem","SessionQueueItemDTO"],onQueryStarted:async(t,n)=>{const{dispatch:r,queryFulfilled:i}=n;try{await i,Jp(r)}catch{}}}),getCurrentQueueItem:e.query({query:()=>({url:`queue/${Ur.get()}/current`,method:"GET"}),providesTags:t=>{const n=["CurrentSessionQueueItem"];return t&&n.push({type:"SessionQueueItem",id:t.item_id}),n}}),getNextQueueItem:e.query({query:()=>({url:`queue/${Ur.get()}/next`,method:"GET"}),providesTags:t=>{const n=["NextSessionQueueItem"];return t&&n.push({type:"SessionQueueItem",id:t.item_id}),n}}),getQueueStatus:e.query({query:()=>({url:`queue/${Ur.get()}/status`,method:"GET"}),providesTags:["SessionQueueStatus"]}),getBatchStatus:e.query({query:({batch_id:t})=>({url:`queue/${Ur.get()}/b/${t}/status`,method:"GET"}),providesTags:t=>t?[{type:"BatchStatus",id:t.batch_id}]:[]}),getQueueItem:e.query({query:t=>({url:`queue/${Ur.get()}/i/${t}`,method:"GET"}),providesTags:t=>t?[{type:"SessionQueueItem",id:t.item_id}]:[]}),cancelQueueItem:e.mutation({query:t=>({url:`queue/${Ur.get()}/i/${t}/cancel`,method:"PUT"}),onQueryStarted:async(t,{dispatch:n,queryFulfilled:r})=>{try{const{data:i}=await r;n(Qr.util.updateQueryData("listQueueItems",void 0,o=>{qc.updateOne(o,{id:t,changes:{status:i.status}})}))}catch{}},invalidatesTags:t=>t?[{type:"SessionQueueItem",id:t.item_id},{type:"SessionQueueItemDTO",id:t.item_id},{type:"BatchStatus",id:t.batch_id}]:[]}),cancelByBatchIds:e.mutation({query:t=>({url:`queue/${Ur.get()}/cancel_by_batch_ids`,method:"PUT",body:t}),onQueryStarted:async(t,n)=>{const{dispatch:r,queryFulfilled:i}=n;try{await i,Jp(r)}catch{}},invalidatesTags:["SessionQueueItem","SessionQueueItemDTO","BatchStatus"]}),listQueueItems:e.query({query:t=>({url:pxe(t),method:"GET"}),serializeQueryArgs:()=>`queue/${Ur.get()}/list`,transformResponse:t=>qc.addMany(qc.getInitialState({has_more:t.has_more}),t.items),merge:(t,n)=>{qc.addMany(t,qc.getSelectors().selectAll(n)),t.has_more=n.has_more},forceRefetch:({currentArg:t,previousArg:n})=>t!==n,keepUnusedDataFor:60*5})})}),{useCancelByBatchIdsMutation:xWe,useEnqueueGraphMutation:wWe,useEnqueueBatchMutation:CWe,usePauseProcessorMutation:EWe,useResumeProcessorMutation:kWe,useClearQueueMutation:TWe,usePruneQueueMutation:AWe,useGetCurrentQueueItemQuery:PWe,useGetQueueStatusQuery:IWe,useGetQueueItemQuery:RWe,useGetNextQueueItemQuery:OWe,useListQueueItemsQuery:MWe,useCancelQueueItemMutation:NWe,useGetBatchStatusQuery:$We}=Qr,Jp=e=>{e(Qr.util.updateQueryData("listQueueItems",void 0,t=>{qc.removeAll(t),t.has_more=!1})),e(p2e()),e(Qr.endpoints.listQueueItems.initiate(void 0))},gxe=No(sle,lle),mxe=()=>{Fe({matcher:gxe,effect:async(e,{dispatch:t,getState:n})=>{const r=_e("canvas"),i=n(),{batchIds:o}=i.canvas;try{const a=t(Qr.endpoints.cancelByBatchIds.initiate({batch_ids:o},{fixedCacheKey:"cancelByBatchIds"})),{canceled:s}=await a.unwrap();a.reset(),s>0&&(r.debug(`Canceled ${s} canvas batches`),t(Gt({title:Z("queue.cancelBatchSucceeded"),status:"success"}))),t(fle())}catch{r.error("Failed to cancel canvas batches"),t(Gt({title:Z("queue.cancelBatchFailed"),status:"error"}))}}})};Ne("app/appStarted");const yxe=()=>{Fe({matcher:me.endpoints.listImages.matchFulfilled,effect:async(e,{dispatch:t,unsubscribe:n,cancelActiveListeners:r})=>{if(e.meta.arg.queryCacheKey!==Bo({board_id:"none",categories:ii}))return;r(),n();const i=e.payload;if(i.ids.length>0){const o=Vn.getSelectors().selectAll(i)[0];t(Us(o??null))}}})},vxe=No(Qr.endpoints.enqueueBatch.matchFulfilled,Qr.endpoints.enqueueGraph.matchFulfilled),bxe=()=>{Fe({matcher:vxe,effect:async(e,{dispatch:t,getState:n})=>{const{data:r}=Qr.endpoints.getQueueStatus.select()(n());!r||r.processor.is_started||t(Qr.endpoints.resumeProcessor.initiate(void 0,{fixedCacheKey:"resumeProcessor"}))}})},fG=ls.injectEndpoints({endpoints:e=>({getAppVersion:e.query({query:()=>({url:"app/version",method:"GET"}),providesTags:["AppVersion"],keepUnusedDataFor:864e5}),getAppConfig:e.query({query:()=>({url:"app/config",method:"GET"}),providesTags:["AppConfig"],keepUnusedDataFor:864e5}),getInvocationCacheStatus:e.query({query:()=>({url:"app/invocation_cache/status",method:"GET"}),providesTags:["InvocationCacheStatus"]}),clearInvocationCache:e.mutation({query:()=>({url:"app/invocation_cache",method:"DELETE"}),invalidatesTags:["InvocationCacheStatus"]}),enableInvocationCache:e.mutation({query:()=>({url:"app/invocation_cache/enable",method:"PUT"}),invalidatesTags:["InvocationCacheStatus"]}),disableInvocationCache:e.mutation({query:()=>({url:"app/invocation_cache/disable",method:"PUT"}),invalidatesTags:["InvocationCacheStatus"]})})}),{useGetAppVersionQuery:DWe,useGetAppConfigQuery:LWe,useClearInvocationCacheMutation:FWe,useDisableInvocationCacheMutation:BWe,useEnableInvocationCacheMutation:zWe,useGetInvocationCacheStatusQuery:jWe}=fG,_xe=()=>{Fe({matcher:fG.endpoints.getAppConfig.matchFulfilled,effect:async(e,{getState:t,dispatch:n})=>{const{infill_methods:r=[],nsfw_methods:i=[],watermarking_methods:o=[]}=e.payload,a=t().generation.infillMethod;r.includes(a)||n(Zse(r[0])),i.includes("nsfw_checker")||n(s2e(!1)),o.includes("invisible_watermark")||n(l2e(!1))}})},Sxe=Ne("app/appStarted"),xxe=()=>{Fe({actionCreator:Sxe,effect:async(e,{unsubscribe:t,cancelActiveListeners:n})=>{n(),t()}})},Z2={memoizeOptions:{resultEqualityCheck:dT}},hG=(e,t)=>{var f;const{generation:n,canvas:r,nodes:i,controlNet:o}=e,a=((f=n.initialImage)==null?void 0:f.imageName)===t,s=r.layerState.objects.some(h=>h.kind==="image"&&h.imageName===t),l=i.nodes.filter(jr).some(h=>zf(h.data.inputs,p=>{var m;return p.type==="ImageField"&&((m=p.value)==null?void 0:m.image_name)===t})),u=zf(o.controlNets,h=>h.controlImage===t||h.processedControlImage===t),c=o.ipAdapterInfo.adapterImage===t;return{isInitialImage:a,isCanvasImage:s,isNodesImage:l,isControlNetImage:u,isIPAdapterImage:c}},wxe=Ii([e=>e],e=>{const{imagesToDelete:t}=e.deleteImageModal;return t.length?t.map(r=>hG(e,r.image_name)):[]},Z2),Cxe=()=>{Fe({matcher:me.endpoints.deleteBoardAndImages.matchFulfilled,effect:async(e,{dispatch:t,getState:n})=>{const{deleted_images:r}=e.payload;let i=!1,o=!1,a=!1,s=!1,l=!1;const u=n();r.forEach(c=>{const d=hG(u,c);d.isInitialImage&&!i&&(t(gT()),i=!0),d.isCanvasImage&&!o&&(t(mT()),o=!0),d.isNodesImage&&!a&&(t(JSe()),a=!0),d.isControlNetImage&&!s&&(t(l0e()),s=!0),d.isIPAdapterImage&&!l&&(t(sU()),l=!0)})}})},Exe=()=>{Fe({matcher:No(w_,SE),effect:async(e,{getState:t,dispatch:n,condition:r,cancelActiveListeners:i})=>{i();const o=t(),a=w_.match(e)?e.payload.boardId:o.gallery.selectedBoardId,l=(SE.match(e)?e.payload:o.gallery.galleryView)==="images"?ii:Mu,u={board_id:a??"none",categories:l};if(await r(()=>me.endpoints.listImages.select(u)(t()).isSuccess,5e3)){const{data:d}=me.endpoints.listImages.select(u)(t());if(d){const f=s0.selectAll(d)[0],h=s0.selectById(d,e.payload.selectedImageName);n(Us(h||f||null))}else n(Us(null))}else n(Us(null))}})},kxe=Ne("canvas/canvasSavedToGallery"),Txe=Ne("canvas/canvasMaskSavedToGallery"),Axe=Ne("canvas/canvasCopiedToClipboard"),Pxe=Ne("canvas/canvasDownloadedAsImage"),Ixe=Ne("canvas/canvasMerged"),Rxe=Ne("canvas/stagingAreaImageSaved"),Oxe=Ne("canvas/canvasMaskToControlNet"),Mxe=Ne("canvas/canvasImageToControlNet");let pG=null,gG=null;const UWe=e=>{pG=e},J2=()=>pG,VWe=e=>{gG=e},Nxe=()=>gG,$xe=async e=>new Promise((t,n)=>{e.toBlob(r=>{if(r){t(r);return}n("Unable to create Blob")})}),$_=async(e,t)=>await $xe(e.toCanvas(t)),ex=async(e,t=!1)=>{const n=J2();if(!n)throw new Error("Problem getting base layer blob");const{shouldCropToBoundingBoxOnSave:r,boundingBoxCoordinates:i,boundingBoxDimensions:o}=e.canvas,a=n.clone();a.scale({x:1,y:1});const s=a.getAbsolutePosition(),l=r||t?{x:i.x+s.x,y:i.y+s.y,width:o.width,height:o.height}:a.getClientRect();return $_(a,l)},Dxe=(e,t="image/png")=>{navigator.clipboard.write([new ClipboardItem({[t]:e})])},Lxe=()=>{Fe({actionCreator:Axe,effect:async(e,{dispatch:t,getState:n})=>{const r=_2.get().child({namespace:"canvasCopiedToClipboardListener"}),i=n();try{const o=ex(i);Dxe(o)}catch(o){r.error(String(o)),t(Gt({title:Z("toast.problemCopyingCanvas"),description:Z("toast.problemCopyingCanvasDesc"),status:"error"}));return}t(Gt({title:Z("toast.canvasCopiedClipboard"),status:"success"}))}})},Fxe=(e,t)=>{const n=URL.createObjectURL(e),r=document.createElement("a");r.href=n,r.download=t,document.body.appendChild(r),r.click(),document.body.removeChild(r),r.remove()},Bxe=()=>{Fe({actionCreator:Pxe,effect:async(e,{dispatch:t,getState:n})=>{const r=_2.get().child({namespace:"canvasSavedToGalleryListener"}),i=n();let o;try{o=await ex(i)}catch(a){r.error(String(a)),t(Gt({title:Z("toast.problemDownloadingCanvas"),description:Z("toast.problemDownloadingCanvasDesc"),status:"error"}));return}Fxe(o,"canvas.png"),t(Gt({title:Z("toast.canvasDownloaded"),status:"success"}))}})},zxe=()=>{Fe({actionCreator:Mxe,effect:async(e,{dispatch:t,getState:n})=>{const r=_e("canvas"),i=n();let o;try{o=await ex(i,!0)}catch(u){r.error(String(u)),t(Gt({title:Z("toast.problemSavingCanvas"),description:Z("toast.problemSavingCanvasDesc"),status:"error"}));return}const{autoAddBoardId:a}=i.gallery,s=await t(me.endpoints.uploadImage.initiate({file:new File([o],"savedCanvas.png",{type:"image/png"}),image_category:"control",is_intermediate:!1,board_id:a==="none"?void 0:a,crop_visible:!1,postUploadAction:{type:"TOAST",toastOptions:{title:Z("toast.canvasSentControlnetAssets")}}})).unwrap(),{image_name:l}=s;t(Sc({controlNetId:e.payload.controlNet.controlNetId,controlImage:l}))}})};var yA={exports:{}},tx={},mG={},Rt={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e._registerNode=e.Konva=e.glob=void 0;var t=Math.PI/180;function n(){return typeof window<"u"&&({}.toString.call(window)==="[object Window]"||{}.toString.call(window)==="[object global]")}e.glob=typeof mt<"u"?mt:typeof window<"u"?window:typeof WorkerGlobalScope<"u"?self:{},e.Konva={_global:e.glob,version:"9.2.0",isBrowser:n(),isUnminified:/param/.test((function(i){}).toString()),dblClickWindow:400,getAngle(i){return e.Konva.angleDeg?i*t:i},enableTrace:!1,pointerEventsEnabled:!0,autoDrawEnabled:!0,hitOnDragEnabled:!1,capturePointerEventsEnabled:!1,_mouseListenClick:!1,_touchListenClick:!1,_pointerListenClick:!1,_mouseInDblClickWindow:!1,_touchInDblClickWindow:!1,_pointerInDblClickWindow:!1,_mouseDblClickPointerId:null,_touchDblClickPointerId:null,_pointerDblClickPointerId:null,pixelRatio:typeof window<"u"&&window.devicePixelRatio||1,dragDistance:3,angleDeg:!0,showWarnings:!0,dragButtons:[0,1],isDragging(){return e.Konva.DD.isDragging},isDragReady(){return!!e.Konva.DD.node},releaseCanvasOnDestroy:!0,document:e.glob.document,_injectGlobal(i){e.glob.Konva=i}};const r=i=>{e.Konva[i.prototype.getClassName()]=i};e._registerNode=r,e.Konva._injectGlobal(e.Konva)})(Rt);var dr={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.Util=e.Transform=void 0;const t=Rt;class n{constructor(y=[1,0,0,1,0,0]){this.dirty=!1,this.m=y&&y.slice()||[1,0,0,1,0,0]}reset(){this.m[0]=1,this.m[1]=0,this.m[2]=0,this.m[3]=1,this.m[4]=0,this.m[5]=0}copy(){return new n(this.m)}copyInto(y){y.m[0]=this.m[0],y.m[1]=this.m[1],y.m[2]=this.m[2],y.m[3]=this.m[3],y.m[4]=this.m[4],y.m[5]=this.m[5]}point(y){var S=this.m;return{x:S[0]*y.x+S[2]*y.y+S[4],y:S[1]*y.x+S[3]*y.y+S[5]}}translate(y,S){return this.m[4]+=this.m[0]*y+this.m[2]*S,this.m[5]+=this.m[1]*y+this.m[3]*S,this}scale(y,S){return this.m[0]*=y,this.m[1]*=y,this.m[2]*=S,this.m[3]*=S,this}rotate(y){var S=Math.cos(y),w=Math.sin(y),x=this.m[0]*S+this.m[2]*w,C=this.m[1]*S+this.m[3]*w,T=this.m[0]*-w+this.m[2]*S,k=this.m[1]*-w+this.m[3]*S;return this.m[0]=x,this.m[1]=C,this.m[2]=T,this.m[3]=k,this}getTranslation(){return{x:this.m[4],y:this.m[5]}}skew(y,S){var w=this.m[0]+this.m[2]*S,x=this.m[1]+this.m[3]*S,C=this.m[2]+this.m[0]*y,T=this.m[3]+this.m[1]*y;return this.m[0]=w,this.m[1]=x,this.m[2]=C,this.m[3]=T,this}multiply(y){var S=this.m[0]*y.m[0]+this.m[2]*y.m[1],w=this.m[1]*y.m[0]+this.m[3]*y.m[1],x=this.m[0]*y.m[2]+this.m[2]*y.m[3],C=this.m[1]*y.m[2]+this.m[3]*y.m[3],T=this.m[0]*y.m[4]+this.m[2]*y.m[5]+this.m[4],k=this.m[1]*y.m[4]+this.m[3]*y.m[5]+this.m[5];return this.m[0]=S,this.m[1]=w,this.m[2]=x,this.m[3]=C,this.m[4]=T,this.m[5]=k,this}invert(){var y=1/(this.m[0]*this.m[3]-this.m[1]*this.m[2]),S=this.m[3]*y,w=-this.m[1]*y,x=-this.m[2]*y,C=this.m[0]*y,T=y*(this.m[2]*this.m[5]-this.m[3]*this.m[4]),k=y*(this.m[1]*this.m[4]-this.m[0]*this.m[5]);return this.m[0]=S,this.m[1]=w,this.m[2]=x,this.m[3]=C,this.m[4]=T,this.m[5]=k,this}getMatrix(){return this.m}decompose(){var y=this.m[0],S=this.m[1],w=this.m[2],x=this.m[3],C=this.m[4],T=this.m[5],k=y*x-S*w;let P={x:C,y:T,rotation:0,scaleX:0,scaleY:0,skewX:0,skewY:0};if(y!=0||S!=0){var $=Math.sqrt(y*y+S*S);P.rotation=S>0?Math.acos(y/$):-Math.acos(y/$),P.scaleX=$,P.scaleY=k/$,P.skewX=(y*w+S*x)/k,P.skewY=0}else if(w!=0||x!=0){var O=Math.sqrt(w*w+x*x);P.rotation=Math.PI/2-(x>0?Math.acos(-w/O):-Math.acos(w/O)),P.scaleX=k/O,P.scaleY=O,P.skewX=0,P.skewY=(y*w+S*x)/k}return P.rotation=e.Util._getRotation(P.rotation),P}}e.Transform=n;var r="[object Array]",i="[object Number]",o="[object String]",a="[object Boolean]",s=Math.PI/180,l=180/Math.PI,u="#",c="",d="0",f="Konva warning: ",h="Konva error: ",p="rgb(",m={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,132,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,255,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,203],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[119,128,144],slategrey:[119,128,144],snow:[255,255,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],transparent:[255,255,255,0],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,5]},_=/rgb\((\d{1,3}),(\d{1,3}),(\d{1,3})\)/,b=[];const v=typeof requestAnimationFrame<"u"&&requestAnimationFrame||function(g){setTimeout(g,60)};e.Util={_isElement(g){return!!(g&&g.nodeType==1)},_isFunction(g){return!!(g&&g.constructor&&g.call&&g.apply)},_isPlainObject(g){return!!g&&g.constructor===Object},_isArray(g){return Object.prototype.toString.call(g)===r},_isNumber(g){return Object.prototype.toString.call(g)===i&&!isNaN(g)&&isFinite(g)},_isString(g){return Object.prototype.toString.call(g)===o},_isBoolean(g){return Object.prototype.toString.call(g)===a},isObject(g){return g instanceof Object},isValidSelector(g){if(typeof g!="string")return!1;var y=g[0];return y==="#"||y==="."||y===y.toUpperCase()},_sign(g){return g===0||g>0?1:-1},requestAnimFrame(g){b.push(g),b.length===1&&v(function(){const y=b;b=[],y.forEach(function(S){S()})})},createCanvasElement(){var g=document.createElement("canvas");try{g.style=g.style||{}}catch{}return g},createImageElement(){return document.createElement("img")},_isInDocument(g){for(;g=g.parentNode;)if(g==document)return!0;return!1},_urlToImage(g,y){var S=e.Util.createImageElement();S.onload=function(){y(S)},S.src=g},_rgbToHex(g,y,S){return((1<<24)+(g<<16)+(y<<8)+S).toString(16).slice(1)},_hexToRgb(g){g=g.replace(u,c);var y=parseInt(g,16);return{r:y>>16&255,g:y>>8&255,b:y&255}},getRandomColor(){for(var g=(Math.random()*16777215<<0).toString(16);g.length<6;)g=d+g;return u+g},getRGB(g){var y;return g in m?(y=m[g],{r:y[0],g:y[1],b:y[2]}):g[0]===u?this._hexToRgb(g.substring(1)):g.substr(0,4)===p?(y=_.exec(g.replace(/ /g,"")),{r:parseInt(y[1],10),g:parseInt(y[2],10),b:parseInt(y[3],10)}):{r:0,g:0,b:0}},colorToRGBA(g){return g=g||"black",e.Util._namedColorToRBA(g)||e.Util._hex3ColorToRGBA(g)||e.Util._hex4ColorToRGBA(g)||e.Util._hex6ColorToRGBA(g)||e.Util._hex8ColorToRGBA(g)||e.Util._rgbColorToRGBA(g)||e.Util._rgbaColorToRGBA(g)||e.Util._hslColorToRGBA(g)},_namedColorToRBA(g){var y=m[g.toLowerCase()];return y?{r:y[0],g:y[1],b:y[2],a:1}:null},_rgbColorToRGBA(g){if(g.indexOf("rgb(")===0){g=g.match(/rgb\(([^)]+)\)/)[1];var y=g.split(/ *, */).map(Number);return{r:y[0],g:y[1],b:y[2],a:1}}},_rgbaColorToRGBA(g){if(g.indexOf("rgba(")===0){g=g.match(/rgba\(([^)]+)\)/)[1];var y=g.split(/ *, */).map((S,w)=>S.slice(-1)==="%"?w===3?parseInt(S)/100:parseInt(S)/100*255:Number(S));return{r:y[0],g:y[1],b:y[2],a:y[3]}}},_hex8ColorToRGBA(g){if(g[0]==="#"&&g.length===9)return{r:parseInt(g.slice(1,3),16),g:parseInt(g.slice(3,5),16),b:parseInt(g.slice(5,7),16),a:parseInt(g.slice(7,9),16)/255}},_hex6ColorToRGBA(g){if(g[0]==="#"&&g.length===7)return{r:parseInt(g.slice(1,3),16),g:parseInt(g.slice(3,5),16),b:parseInt(g.slice(5,7),16),a:1}},_hex4ColorToRGBA(g){if(g[0]==="#"&&g.length===5)return{r:parseInt(g[1]+g[1],16),g:parseInt(g[2]+g[2],16),b:parseInt(g[3]+g[3],16),a:parseInt(g[4]+g[4],16)/255}},_hex3ColorToRGBA(g){if(g[0]==="#"&&g.length===4)return{r:parseInt(g[1]+g[1],16),g:parseInt(g[2]+g[2],16),b:parseInt(g[3]+g[3],16),a:1}},_hslColorToRGBA(g){if(/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.test(g)){const[y,...S]=/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.exec(g),w=Number(S[0])/360,x=Number(S[1])/100,C=Number(S[2])/100;let T,k,P;if(x===0)return P=C*255,{r:Math.round(P),g:Math.round(P),b:Math.round(P),a:1};C<.5?T=C*(1+x):T=C+x-C*x;const $=2*C-T,O=[0,0,0];for(let E=0;E<3;E++)k=w+1/3*-(E-1),k<0&&k++,k>1&&k--,6*k<1?P=$+(T-$)*6*k:2*k<1?P=T:3*k<2?P=$+(T-$)*(2/3-k)*6:P=$,O[E]=P*255;return{r:Math.round(O[0]),g:Math.round(O[1]),b:Math.round(O[2]),a:1}}},haveIntersection(g,y){return!(y.x>g.x+g.width||y.x+y.widthg.y+g.height||y.y+y.height1?(T=S,k=w,P=(S-x)*(S-x)+(w-C)*(w-C)):(T=g+O*(S-g),k=y+O*(w-y),P=(T-x)*(T-x)+(k-C)*(k-C))}return[T,k,P]},_getProjectionToLine(g,y,S){var w=e.Util.cloneObject(g),x=Number.MAX_VALUE;return y.forEach(function(C,T){if(!(!S&&T===y.length-1)){var k=y[(T+1)%y.length],P=e.Util._getProjectionToSegment(C.x,C.y,k.x,k.y,g.x,g.y),$=P[0],O=P[1],E=P[2];Ey.length){var T=y;y=g,g=T}for(w=0;w{y.width=0,y.height=0})},drawRoundedRectPath(g,y,S,w){let x=0,C=0,T=0,k=0;typeof w=="number"?x=C=T=k=Math.min(w,y/2,S/2):(x=Math.min(w[0]||0,y/2,S/2),C=Math.min(w[1]||0,y/2,S/2),k=Math.min(w[2]||0,y/2,S/2),T=Math.min(w[3]||0,y/2,S/2)),g.moveTo(x,0),g.lineTo(y-C,0),g.arc(y-C,C,C,Math.PI*3/2,0,!1),g.lineTo(y,S-k),g.arc(y-k,S-k,k,0,Math.PI/2,!1),g.lineTo(T,S),g.arc(T,S-T,T,Math.PI/2,Math.PI,!1),g.lineTo(0,x),g.arc(x,x,x,Math.PI,Math.PI*3/2,!1)}}})(dr);var rr={},At={},Xe={};Object.defineProperty(Xe,"__esModule",{value:!0});Xe.getComponentValidator=Xe.getBooleanValidator=Xe.getNumberArrayValidator=Xe.getFunctionValidator=Xe.getStringOrGradientValidator=Xe.getStringValidator=Xe.getNumberOrAutoValidator=Xe.getNumberOrArrayOfNumbersValidator=Xe.getNumberValidator=Xe.alphaComponent=Xe.RGBComponent=void 0;const Jl=Rt,vr=dr;function eu(e){return vr.Util._isString(e)?'"'+e+'"':Object.prototype.toString.call(e)==="[object Number]"||vr.Util._isBoolean(e)?e:Object.prototype.toString.call(e)}function jxe(e){return e>255?255:e<0?0:Math.round(e)}Xe.RGBComponent=jxe;function Uxe(e){return e>1?1:e<1e-4?1e-4:e}Xe.alphaComponent=Uxe;function Vxe(){if(Jl.Konva.isUnminified)return function(e,t){return vr.Util._isNumber(e)||vr.Util.warn(eu(e)+' is a not valid value for "'+t+'" attribute. The value should be a number.'),e}}Xe.getNumberValidator=Vxe;function Gxe(e){if(Jl.Konva.isUnminified)return function(t,n){let r=vr.Util._isNumber(t),i=vr.Util._isArray(t)&&t.length==e;return!r&&!i&&vr.Util.warn(eu(t)+' is a not valid value for "'+n+'" attribute. The value should be a number or Array('+e+")"),t}}Xe.getNumberOrArrayOfNumbersValidator=Gxe;function Hxe(){if(Jl.Konva.isUnminified)return function(e,t){var n=vr.Util._isNumber(e),r=e==="auto";return n||r||vr.Util.warn(eu(e)+' is a not valid value for "'+t+'" attribute. The value should be a number or "auto".'),e}}Xe.getNumberOrAutoValidator=Hxe;function qxe(){if(Jl.Konva.isUnminified)return function(e,t){return vr.Util._isString(e)||vr.Util.warn(eu(e)+' is a not valid value for "'+t+'" attribute. The value should be a string.'),e}}Xe.getStringValidator=qxe;function Wxe(){if(Jl.Konva.isUnminified)return function(e,t){const n=vr.Util._isString(e),r=Object.prototype.toString.call(e)==="[object CanvasGradient]"||e&&e.addColorStop;return n||r||vr.Util.warn(eu(e)+' is a not valid value for "'+t+'" attribute. The value should be a string or a native gradient.'),e}}Xe.getStringOrGradientValidator=Wxe;function Kxe(){if(Jl.Konva.isUnminified)return function(e,t){return vr.Util._isFunction(e)||vr.Util.warn(eu(e)+' is a not valid value for "'+t+'" attribute. The value should be a function.'),e}}Xe.getFunctionValidator=Kxe;function Qxe(){if(Jl.Konva.isUnminified)return function(e,t){const n=Int8Array?Object.getPrototypeOf(Int8Array):null;return n&&e instanceof n||(vr.Util._isArray(e)?e.forEach(function(r){vr.Util._isNumber(r)||vr.Util.warn('"'+t+'" attribute has non numeric element '+r+". Make sure that all elements are numbers.")}):vr.Util.warn(eu(e)+' is a not valid value for "'+t+'" attribute. The value should be a array of numbers.')),e}}Xe.getNumberArrayValidator=Qxe;function Xxe(){if(Jl.Konva.isUnminified)return function(e,t){var n=e===!0||e===!1;return n||vr.Util.warn(eu(e)+' is a not valid value for "'+t+'" attribute. The value should be a boolean.'),e}}Xe.getBooleanValidator=Xxe;function Yxe(e){if(Jl.Konva.isUnminified)return function(t,n){return t==null||vr.Util.isObject(t)||vr.Util.warn(eu(t)+' is a not valid value for "'+n+'" attribute. The value should be an object with properties '+e),t}}Xe.getComponentValidator=Yxe;(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.Factory=void 0;const t=dr,n=Xe;var r="get",i="set";e.Factory={addGetterSetter(o,a,s,l,u){e.Factory.addGetter(o,a,s),e.Factory.addSetter(o,a,l,u),e.Factory.addOverloadedGetterSetter(o,a)},addGetter(o,a,s){var l=r+t.Util._capitalize(a);o.prototype[l]=o.prototype[l]||function(){var u=this.attrs[a];return u===void 0?s:u}},addSetter(o,a,s,l){var u=i+t.Util._capitalize(a);o.prototype[u]||e.Factory.overWriteSetter(o,a,s,l)},overWriteSetter(o,a,s,l){var u=i+t.Util._capitalize(a);o.prototype[u]=function(c){return s&&c!==void 0&&c!==null&&(c=s.call(this,c,a)),this._setAttr(a,c),l&&l.call(this),this}},addComponentsGetterSetter(o,a,s,l,u){var c=s.length,d=t.Util._capitalize,f=r+d(a),h=i+d(a),p,m;o.prototype[f]=function(){var b={};for(p=0;p{this._setAttr(a+d(y),void 0)}),this._fireChangeEvent(a,v,b),u&&u.call(this),this},e.Factory.addOverloadedGetterSetter(o,a)},addOverloadedGetterSetter(o,a){var s=t.Util._capitalize(a),l=i+s,u=r+s;o.prototype[a]=function(){return arguments.length?(this[l](arguments[0]),this):this[u]()}},addDeprecatedGetterSetter(o,a,s,l){t.Util.error("Adding deprecated "+a);var u=r+t.Util._capitalize(a),c=a+" property is deprecated and will be removed soon. Look at Konva change log for more information.";o.prototype[u]=function(){t.Util.error(c);var d=this.attrs[a];return d===void 0?s:d},e.Factory.addSetter(o,a,l,function(){t.Util.error(c)}),e.Factory.addOverloadedGetterSetter(o,a)},backCompat(o,a){t.Util.each(a,function(s,l){var u=o.prototype[l],c=r+t.Util._capitalize(s),d=i+t.Util._capitalize(s);function f(){u.apply(this,arguments),t.Util.error('"'+s+'" method is deprecated and will be removed soon. Use ""'+l+'" instead.')}o.prototype[s]=f,o.prototype[c]=f,o.prototype[d]=f})},afterSetFilter(){this._filterUpToDate=!1}}})(At);var is={},$l={};Object.defineProperty($l,"__esModule",{value:!0});$l.HitContext=$l.SceneContext=$l.Context=void 0;const yG=dr,Zxe=Rt;function Jxe(e){var t=[],n=e.length,r=yG.Util,i,o;for(i=0;itypeof c=="number"?Math.floor(c):c)),o+=ewe+u.join(tO)+twe)):(o+=s.property,t||(o+=awe+s.val)),o+=iwe;return o}clearTrace(){this.traceArr=[]}_trace(t){var n=this.traceArr,r;n.push(t),r=n.length,r>=lwe&&n.shift()}reset(){var t=this.getCanvas().getPixelRatio();this.setTransform(1*t,0,0,1*t,0,0)}getCanvas(){return this.canvas}clear(t){var n=this.getCanvas();t?this.clearRect(t.x||0,t.y||0,t.width||0,t.height||0):this.clearRect(0,0,n.getWidth()/n.pixelRatio,n.getHeight()/n.pixelRatio)}_applyLineCap(t){const n=t.attrs.lineCap;n&&this.setAttr("lineCap",n)}_applyOpacity(t){var n=t.getAbsoluteOpacity();n!==1&&this.setAttr("globalAlpha",n)}_applyLineJoin(t){const n=t.attrs.lineJoin;n&&this.setAttr("lineJoin",n)}setAttr(t,n){this._context[t]=n}arc(t,n,r,i,o,a){this._context.arc(t,n,r,i,o,a)}arcTo(t,n,r,i,o){this._context.arcTo(t,n,r,i,o)}beginPath(){this._context.beginPath()}bezierCurveTo(t,n,r,i,o,a){this._context.bezierCurveTo(t,n,r,i,o,a)}clearRect(t,n,r,i){this._context.clearRect(t,n,r,i)}clip(...t){this._context.clip.apply(this._context,t)}closePath(){this._context.closePath()}createImageData(t,n){var r=arguments;if(r.length===2)return this._context.createImageData(t,n);if(r.length===1)return this._context.createImageData(t)}createLinearGradient(t,n,r,i){return this._context.createLinearGradient(t,n,r,i)}createPattern(t,n){return this._context.createPattern(t,n)}createRadialGradient(t,n,r,i,o,a){return this._context.createRadialGradient(t,n,r,i,o,a)}drawImage(t,n,r,i,o,a,s,l,u){var c=arguments,d=this._context;c.length===3?d.drawImage(t,n,r):c.length===5?d.drawImage(t,n,r,i,o):c.length===9&&d.drawImage(t,n,r,i,o,a,s,l,u)}ellipse(t,n,r,i,o,a,s,l){this._context.ellipse(t,n,r,i,o,a,s,l)}isPointInPath(t,n,r,i){return r?this._context.isPointInPath(r,t,n,i):this._context.isPointInPath(t,n,i)}fill(...t){this._context.fill.apply(this._context,t)}fillRect(t,n,r,i){this._context.fillRect(t,n,r,i)}strokeRect(t,n,r,i){this._context.strokeRect(t,n,r,i)}fillText(t,n,r,i){i?this._context.fillText(t,n,r,i):this._context.fillText(t,n,r)}measureText(t){return this._context.measureText(t)}getImageData(t,n,r,i){return this._context.getImageData(t,n,r,i)}lineTo(t,n){this._context.lineTo(t,n)}moveTo(t,n){this._context.moveTo(t,n)}rect(t,n,r,i){this._context.rect(t,n,r,i)}putImageData(t,n,r){this._context.putImageData(t,n,r)}quadraticCurveTo(t,n,r,i){this._context.quadraticCurveTo(t,n,r,i)}restore(){this._context.restore()}rotate(t){this._context.rotate(t)}save(){this._context.save()}scale(t,n){this._context.scale(t,n)}setLineDash(t){this._context.setLineDash?this._context.setLineDash(t):"mozDash"in this._context?this._context.mozDash=t:"webkitLineDash"in this._context&&(this._context.webkitLineDash=t)}getLineDash(){return this._context.getLineDash()}setTransform(t,n,r,i,o,a){this._context.setTransform(t,n,r,i,o,a)}stroke(t){t?this._context.stroke(t):this._context.stroke()}strokeText(t,n,r,i){this._context.strokeText(t,n,r,i)}transform(t,n,r,i,o,a){this._context.transform(t,n,r,i,o,a)}translate(t,n){this._context.translate(t,n)}_enableTrace(){var t=this,n=nO.length,r=this.setAttr,i,o,a=function(s){var l=t[s],u;t[s]=function(){return o=Jxe(Array.prototype.slice.call(arguments,0)),u=l.apply(t,arguments),t._trace({method:s,args:o}),u}};for(i=0;i{i.dragStatus==="dragging"&&(r=!0)}),r},justDragged:!1,get node(){var r;return e.DD._dragElements.forEach(i=>{r=i.node}),r},_dragElements:new Map,_drag(r){const i=[];e.DD._dragElements.forEach((o,a)=>{const{node:s}=o,l=s.getStage();l.setPointersPositions(r),o.pointerId===void 0&&(o.pointerId=n.Util._getFirstPointerId(r));const u=l._changedPointerPositions.find(f=>f.id===o.pointerId);if(u){if(o.dragStatus!=="dragging"){var c=s.dragDistance(),d=Math.max(Math.abs(u.x-o.startPointerPos.x),Math.abs(u.y-o.startPointerPos.y));if(d{o.fire("dragmove",{type:"dragmove",target:o,evt:r},!0)})},_endDragBefore(r){const i=[];e.DD._dragElements.forEach(o=>{const{node:a}=o,s=a.getStage();if(r&&s.setPointersPositions(r),!s._changedPointerPositions.find(c=>c.id===o.pointerId))return;(o.dragStatus==="dragging"||o.dragStatus==="stopped")&&(e.DD.justDragged=!0,t.Konva._mouseListenClick=!1,t.Konva._touchListenClick=!1,t.Konva._pointerListenClick=!1,o.dragStatus="stopped");const u=o.node.getLayer()||o.node instanceof t.Konva.Stage&&o.node;u&&i.indexOf(u)===-1&&i.push(u)}),i.forEach(o=>{o.draw()})},_endDragAfter(r){e.DD._dragElements.forEach((i,o)=>{i.dragStatus==="stopped"&&i.node.fire("dragend",{type:"dragend",target:i.node,evt:r},!0),i.dragStatus!=="dragging"&&e.DD._dragElements.delete(o)})}},t.Konva.isBrowser&&(window.addEventListener("mouseup",e.DD._endDragBefore,!0),window.addEventListener("touchend",e.DD._endDragBefore,!0),window.addEventListener("mousemove",e.DD._drag),window.addEventListener("touchmove",e.DD._drag),window.addEventListener("mouseup",e.DD._endDragAfter,!1),window.addEventListener("touchend",e.DD._endDragAfter,!1))})(ix);Object.defineProperty(rr,"__esModule",{value:!0});rr.Node=void 0;const Nt=dr,wy=At,Bv=is,Mc=Rt,sa=ix,kr=Xe;var V1="absoluteOpacity",zv="allEventListeners",gl="absoluteTransform",rO="absoluteScale",Nc="canvas",mwe="Change",ywe="children",vwe="konva",HE="listening",iO="mouseenter",oO="mouseleave",aO="set",sO="Shape",G1=" ",lO="stage",hu="transform",bwe="Stage",qE="visible",_we=["xChange.konva","yChange.konva","scaleXChange.konva","scaleYChange.konva","skewXChange.konva","skewYChange.konva","rotationChange.konva","offsetXChange.konva","offsetYChange.konva","transformsEnabledChange.konva"].join(G1);let Swe=1;class ft{constructor(t){this._id=Swe++,this.eventListeners={},this.attrs={},this.index=0,this._allEventListeners=null,this.parent=null,this._cache=new Map,this._attachedDepsListeners=new Map,this._lastPos=null,this._batchingTransformChange=!1,this._needClearTransformCache=!1,this._filterUpToDate=!1,this._isUnderCache=!1,this._dragEventId=null,this._shouldFireChangeEvents=!1,this.setAttrs(t),this._shouldFireChangeEvents=!0}hasChildren(){return!1}_clearCache(t){(t===hu||t===gl)&&this._cache.get(t)?this._cache.get(t).dirty=!0:t?this._cache.delete(t):this._cache.clear()}_getCache(t,n){var r=this._cache.get(t),i=t===hu||t===gl,o=r===void 0||i&&r.dirty===!0;return o&&(r=n.call(this),this._cache.set(t,r)),r}_calculate(t,n,r){if(!this._attachedDepsListeners.get(t)){const i=n.map(o=>o+"Change.konva").join(G1);this.on(i,()=>{this._clearCache(t)}),this._attachedDepsListeners.set(t,!0)}return this._getCache(t,r)}_getCanvasCache(){return this._cache.get(Nc)}_clearSelfAndDescendantCache(t){this._clearCache(t),t===gl&&this.fire("absoluteTransformChange")}clearCache(){if(this._cache.has(Nc)){const{scene:t,filter:n,hit:r}=this._cache.get(Nc);Nt.Util.releaseCanvas(t,n,r),this._cache.delete(Nc)}return this._clearSelfAndDescendantCache(),this._requestDraw(),this}cache(t){var n=t||{},r={};(n.x===void 0||n.y===void 0||n.width===void 0||n.height===void 0)&&(r=this.getClientRect({skipTransform:!0,relativeTo:this.getParent()}));var i=Math.ceil(n.width||r.width),o=Math.ceil(n.height||r.height),a=n.pixelRatio,s=n.x===void 0?Math.floor(r.x):n.x,l=n.y===void 0?Math.floor(r.y):n.y,u=n.offset||0,c=n.drawBorder||!1,d=n.hitCanvasPixelRatio||1;if(!i||!o){Nt.Util.error("Can not cache the node. Width or height of the node equals 0. Caching is skipped.");return}i+=u*2+1,o+=u*2+1,s-=u,l-=u;var f=new Bv.SceneCanvas({pixelRatio:a,width:i,height:o}),h=new Bv.SceneCanvas({pixelRatio:a,width:0,height:0,willReadFrequently:!0}),p=new Bv.HitCanvas({pixelRatio:d,width:i,height:o}),m=f.getContext(),_=p.getContext();return p.isCache=!0,f.isCache=!0,this._cache.delete(Nc),this._filterUpToDate=!1,n.imageSmoothingEnabled===!1&&(f.getContext()._context.imageSmoothingEnabled=!1,h.getContext()._context.imageSmoothingEnabled=!1),m.save(),_.save(),m.translate(-s,-l),_.translate(-s,-l),this._isUnderCache=!0,this._clearSelfAndDescendantCache(V1),this._clearSelfAndDescendantCache(rO),this.drawScene(f,this),this.drawHit(p,this),this._isUnderCache=!1,m.restore(),_.restore(),c&&(m.save(),m.beginPath(),m.rect(0,0,i,o),m.closePath(),m.setAttr("strokeStyle","red"),m.setAttr("lineWidth",5),m.stroke(),m.restore()),this._cache.set(Nc,{scene:f,filter:h,hit:p,x:s,y:l}),this._requestDraw(),this}isCached(){return this._cache.has(Nc)}getClientRect(t){throw new Error('abstract "getClientRect" method call')}_transformedRect(t,n){var r=[{x:t.x,y:t.y},{x:t.x+t.width,y:t.y},{x:t.x+t.width,y:t.y+t.height},{x:t.x,y:t.y+t.height}],i,o,a,s,l=this.getAbsoluteTransform(n);return r.forEach(function(u){var c=l.point(u);i===void 0&&(i=a=c.x,o=s=c.y),i=Math.min(i,c.x),o=Math.min(o,c.y),a=Math.max(a,c.x),s=Math.max(s,c.y)}),{x:i,y:o,width:a-i,height:s-o}}_drawCachedSceneCanvas(t){t.save(),t._applyOpacity(this),t._applyGlobalCompositeOperation(this);const n=this._getCanvasCache();t.translate(n.x,n.y);var r=this._getCachedSceneCanvas(),i=r.pixelRatio;t.drawImage(r._canvas,0,0,r.width/i,r.height/i),t.restore()}_drawCachedHitCanvas(t){var n=this._getCanvasCache(),r=n.hit;t.save(),t.translate(n.x,n.y),t.drawImage(r._canvas,0,0,r.width/r.pixelRatio,r.height/r.pixelRatio),t.restore()}_getCachedSceneCanvas(){var t=this.filters(),n=this._getCanvasCache(),r=n.scene,i=n.filter,o=i.getContext(),a,s,l,u;if(t){if(!this._filterUpToDate){var c=r.pixelRatio;i.setSize(r.width/r.pixelRatio,r.height/r.pixelRatio);try{for(a=t.length,o.clear(),o.drawImage(r._canvas,0,0,r.getWidth()/c,r.getHeight()/c),s=o.getImageData(0,0,i.getWidth(),i.getHeight()),l=0;l{var n,r;if(!t)return this;for(n in t)n!==ywe&&(r=aO+Nt.Util._capitalize(n),Nt.Util._isFunction(this[r])?this[r](t[n]):this._setAttr(n,t[n]))}),this}isListening(){return this._getCache(HE,this._isListening)}_isListening(t){if(!this.listening())return!1;const r=this.getParent();return r&&r!==t&&this!==t?r._isListening(t):!0}isVisible(){return this._getCache(qE,this._isVisible)}_isVisible(t){if(!this.visible())return!1;const r=this.getParent();return r&&r!==t&&this!==t?r._isVisible(t):!0}shouldDrawHit(t,n=!1){if(t)return this._isVisible(t)&&this._isListening(t);var r=this.getLayer(),i=!1;sa.DD._dragElements.forEach(a=>{a.dragStatus==="dragging"&&(a.node.nodeType==="Stage"||a.node.getLayer()===r)&&(i=!0)});var o=!n&&!Mc.Konva.hitOnDragEnabled&&i;return this.isListening()&&this.isVisible()&&!o}show(){return this.visible(!0),this}hide(){return this.visible(!1),this}getZIndex(){return this.index||0}getAbsoluteZIndex(){var t=this.getDepth(),n=this,r=0,i,o,a,s;function l(u){for(i=[],o=u.length,a=0;a0&&i[0].getDepth()<=t&&l(i)}return n.nodeType!==bwe&&l(n.getStage().getChildren()),r}getDepth(){for(var t=0,n=this.parent;n;)t++,n=n.parent;return t}_batchTransformChanges(t){this._batchingTransformChange=!0,t(),this._batchingTransformChange=!1,this._needClearTransformCache&&(this._clearCache(hu),this._clearSelfAndDescendantCache(gl)),this._needClearTransformCache=!1}setPosition(t){return this._batchTransformChanges(()=>{this.x(t.x),this.y(t.y)}),this}getPosition(){return{x:this.x(),y:this.y()}}getRelativePointerPosition(){if(!this.getStage())return null;var t=this.getStage().getPointerPosition();if(!t)return null;var n=this.getAbsoluteTransform().copy();return n.invert(),n.point(t)}getAbsolutePosition(t){let n=!1,r=this.parent;for(;r;){if(r.isCached()){n=!0;break}r=r.parent}n&&!t&&(t=!0);var i=this.getAbsoluteTransform(t).getMatrix(),o=new Nt.Transform,a=this.offset();return o.m=i.slice(),o.translate(a.x,a.y),o.getTranslation()}setAbsolutePosition(t){var n=this._clearTransform();this.attrs.x=n.x,this.attrs.y=n.y,delete n.x,delete n.y,this._clearCache(hu);var r=this._getAbsoluteTransform().copy();return r.invert(),r.translate(t.x,t.y),t={x:this.attrs.x+r.getTranslation().x,y:this.attrs.y+r.getTranslation().y},this._setTransform(n),this.setPosition({x:t.x,y:t.y}),this._clearCache(hu),this._clearSelfAndDescendantCache(gl),this}_setTransform(t){var n;for(n in t)this.attrs[n]=t[n]}_clearTransform(){var t={x:this.x(),y:this.y(),rotation:this.rotation(),scaleX:this.scaleX(),scaleY:this.scaleY(),offsetX:this.offsetX(),offsetY:this.offsetY(),skewX:this.skewX(),skewY:this.skewY()};return this.attrs.x=0,this.attrs.y=0,this.attrs.rotation=0,this.attrs.scaleX=1,this.attrs.scaleY=1,this.attrs.offsetX=0,this.attrs.offsetY=0,this.attrs.skewX=0,this.attrs.skewY=0,t}move(t){var n=t.x,r=t.y,i=this.x(),o=this.y();return n!==void 0&&(i+=n),r!==void 0&&(o+=r),this.setPosition({x:i,y:o}),this}_eachAncestorReverse(t,n){var r=[],i=this.getParent(),o,a;if(!(n&&n._id===this._id)){for(r.unshift(this);i&&(!n||i._id!==n._id);)r.unshift(i),i=i.parent;for(o=r.length,a=0;a0?(this.parent.children.splice(t,1),this.parent.children.splice(t-1,0,this),this.parent._setChildrenIndices(),!0):!1}moveToBottom(){if(!this.parent)return Nt.Util.warn("Node has no parent. moveToBottom function is ignored."),!1;var t=this.index;return t>0?(this.parent.children.splice(t,1),this.parent.children.unshift(this),this.parent._setChildrenIndices(),!0):!1}setZIndex(t){if(!this.parent)return Nt.Util.warn("Node has no parent. zIndex parameter is ignored."),this;(t<0||t>=this.parent.children.length)&&Nt.Util.warn("Unexpected value "+t+" for zIndex property. zIndex is just index of a node in children of its parent. Expected value is from 0 to "+(this.parent.children.length-1)+".");var n=this.index;return this.parent.children.splice(n,1),this.parent.children.splice(t,0,this),this.parent._setChildrenIndices(),this}getAbsoluteOpacity(){return this._getCache(V1,this._getAbsoluteOpacity)}_getAbsoluteOpacity(){var t=this.opacity(),n=this.getParent();return n&&!n._isUnderCache&&(t*=n.getAbsoluteOpacity()),t}moveTo(t){return this.getParent()!==t&&(this._remove(),t.add(this)),this}toObject(){var t={},n=this.getAttrs(),r,i,o,a,s;t.attrs={};for(r in n)i=n[r],s=Nt.Util.isObject(i)&&!Nt.Util._isPlainObject(i)&&!Nt.Util._isArray(i),!s&&(o=typeof this[r]=="function"&&this[r],delete n[r],a=o?o.call(this):null,n[r]=i,a!==i&&(t.attrs[r]=i));return t.className=this.getClassName(),Nt.Util._prepareToStringify(t)}toJSON(){return JSON.stringify(this.toObject())}getParent(){return this.parent}findAncestors(t,n,r){var i=[];n&&this._isMatch(t)&&i.push(this);for(var o=this.parent;o;){if(o===r)return i;o._isMatch(t)&&i.push(o),o=o.parent}return i}isAncestorOf(t){return!1}findAncestor(t,n,r){return this.findAncestors(t,n,r)[0]}_isMatch(t){if(!t)return!1;if(typeof t=="function")return t(this);var n=t.replace(/ /g,"").split(","),r=n.length,i,o;for(i=0;i{try{const i=t==null?void 0:t.callback;i&&delete t.callback,Nt.Util._urlToImage(this.toDataURL(t),function(o){n(o),i==null||i(o)})}catch(i){r(i)}})}toBlob(t){return new Promise((n,r)=>{try{const i=t==null?void 0:t.callback;i&&delete t.callback,this.toCanvas(t).toBlob(o=>{n(o),i==null||i(o)})}catch(i){r(i)}})}setSize(t){return this.width(t.width),this.height(t.height),this}getSize(){return{width:this.width(),height:this.height()}}getClassName(){return this.className||this.nodeType}getType(){return this.nodeType}getDragDistance(){return this.attrs.dragDistance!==void 0?this.attrs.dragDistance:this.parent?this.parent.getDragDistance():Mc.Konva.dragDistance}_off(t,n,r){var i=this.eventListeners[t],o,a,s;for(o=0;o=0;if(r&&!this.isDragging()){var i=!1;sa.DD._dragElements.forEach(o=>{this.isAncestorOf(o.node)&&(i=!0)}),i||this._createDragElement(t)}})}_dragChange(){if(this.attrs.draggable)this._listenDrag();else{this._dragCleanup();var t=this.getStage();if(!t)return;const n=sa.DD._dragElements.get(this._id),r=n&&n.dragStatus==="dragging",i=n&&n.dragStatus==="ready";r?this.stopDrag():i&&sa.DD._dragElements.delete(this._id)}}_dragCleanup(){this.off("mousedown.konva"),this.off("touchstart.konva")}isClientRectOnScreen(t={x:0,y:0}){const n=this.getStage();if(!n)return!1;const r={x:-t.x,y:-t.y,width:n.width()+2*t.x,height:n.height()+2*t.y};return Nt.Util.haveIntersection(r,this.getClientRect())}static create(t,n){return Nt.Util._isString(t)&&(t=JSON.parse(t)),this._createNode(t,n)}static _createNode(t,n){var r=ft.prototype.getClassName.call(t),i=t.children,o,a,s;n&&(t.attrs.container=n),Mc.Konva[r]||(Nt.Util.warn('Can not find a node with class name "'+r+'". Fallback to "Shape".'),r="Shape");const l=Mc.Konva[r];if(o=new l(t.attrs),i)for(a=i.length,s=0;s0}removeChildren(){return this.getChildren().forEach(t=>{t.parent=null,t.index=0,t.remove()}),this.children=[],this._requestDraw(),this}destroyChildren(){return this.getChildren().forEach(t=>{t.parent=null,t.index=0,t.destroy()}),this.children=[],this._requestDraw(),this}add(...t){if(t.length===0)return this;if(t.length>1){for(var n=0;n0?n[0]:void 0}_generalFind(t,n){var r=[];return this._descendants(i=>{const o=i._isMatch(t);return o&&r.push(i),!!(o&&n)}),r}_descendants(t){let n=!1;const r=this.getChildren();for(const i of r){if(n=t(i),n)return!0;if(i.hasChildren()&&(n=i._descendants(t),n))return!0}return!1}toObject(){var t=qC.Node.prototype.toObject.call(this);return t.children=[],this.getChildren().forEach(n=>{t.children.push(n.toObject())}),t}isAncestorOf(t){for(var n=t.getParent();n;){if(n._id===this._id)return!0;n=n.getParent()}return!1}clone(t){var n=qC.Node.prototype.clone.call(this,t);return this.getChildren().forEach(function(r){n.add(r.clone())}),n}getAllIntersections(t){var n=[];return this.find("Shape").forEach(function(r){r.isVisible()&&r.intersects(t)&&n.push(r)}),n}_clearSelfAndDescendantCache(t){var n;super._clearSelfAndDescendantCache(t),!this.isCached()&&((n=this.children)===null||n===void 0||n.forEach(function(r){r._clearSelfAndDescendantCache(t)}))}_setChildrenIndices(){var t;(t=this.children)===null||t===void 0||t.forEach(function(n,r){n.index=r}),this._requestDraw()}drawScene(t,n){var r=this.getLayer(),i=t||r&&r.getCanvas(),o=i&&i.getContext(),a=this._getCanvasCache(),s=a&&a.scene,l=i&&i.isCache;if(!this.isVisible()&&!l)return this;if(s){o.save();var u=this.getAbsoluteTransform(n).getMatrix();o.transform(u[0],u[1],u[2],u[3],u[4],u[5]),this._drawCachedSceneCanvas(o),o.restore()}else this._drawChildren("drawScene",i,n);return this}drawHit(t,n){if(!this.shouldDrawHit(n))return this;var r=this.getLayer(),i=t||r&&r.hitCanvas,o=i&&i.getContext(),a=this._getCanvasCache(),s=a&&a.hit;if(s){o.save();var l=this.getAbsoluteTransform(n).getMatrix();o.transform(l[0],l[1],l[2],l[3],l[4],l[5]),this._drawCachedHitCanvas(o),o.restore()}else this._drawChildren("drawHit",i,n);return this}_drawChildren(t,n,r){var i,o=n&&n.getContext(),a=this.clipWidth(),s=this.clipHeight(),l=this.clipFunc(),u=a&&s||l;const c=r===this;if(u){o.save();var d=this.getAbsoluteTransform(r),f=d.getMatrix();o.transform(f[0],f[1],f[2],f[3],f[4],f[5]),o.beginPath();let _;if(l)_=l.call(this,o,this);else{var h=this.clipX(),p=this.clipY();o.rect(h,p,a,s)}o.clip.apply(o,_),f=d.copy().invert().getMatrix(),o.transform(f[0],f[1],f[2],f[3],f[4],f[5])}var m=!c&&this.globalCompositeOperation()!=="source-over"&&t==="drawScene";m&&(o.save(),o._applyGlobalCompositeOperation(this)),(i=this.children)===null||i===void 0||i.forEach(function(_){_[t](n,r)}),m&&o.restore(),u&&o.restore()}getClientRect(t){var n;t=t||{};var r=t.skipTransform,i=t.relativeTo,o,a,s,l,u={x:1/0,y:1/0,width:0,height:0},c=this;(n=this.children)===null||n===void 0||n.forEach(function(m){if(m.visible()){var _=m.getClientRect({relativeTo:c,skipShadow:t.skipShadow,skipStroke:t.skipStroke});_.width===0&&_.height===0||(o===void 0?(o=_.x,a=_.y,s=_.x+_.width,l=_.y+_.height):(o=Math.min(o,_.x),a=Math.min(a,_.y),s=Math.max(s,_.x+_.width),l=Math.max(l,_.y+_.height)))}});for(var d=this.find("Shape"),f=!1,h=0;hJ.indexOf("pointer")>=0?"pointer":J.indexOf("touch")>=0?"touch":"mouse",U=J=>{const j=B(J);if(j==="pointer")return i.Konva.pointerEventsEnabled&&N.pointer;if(j==="touch")return N.touch;if(j==="mouse")return N.mouse};function G(J={}){return(J.clipFunc||J.clipWidth||J.clipHeight)&&t.Util.warn("Stage does not support clipping. Please use clip for Layers or Groups."),J}const Y="Pointer position is missing and not registered by the stage. Looks like it is outside of the stage container. You can set it manually from event: stage.setPointersPositions(event);";e.stages=[];class ee extends r.Container{constructor(j){super(G(j)),this._pointerPositions=[],this._changedPointerPositions=[],this._buildDOM(),this._bindContentEvents(),e.stages.push(this),this.on("widthChange.konva heightChange.konva",this._resizeDOM),this.on("visibleChange.konva",this._checkVisibility),this.on("clipWidthChange.konva clipHeightChange.konva clipFuncChange.konva",()=>{G(this.attrs)}),this._checkVisibility()}_validateAdd(j){const Q=j.getType()==="Layer",ne=j.getType()==="FastLayer";Q||ne||t.Util.throw("You may only add layers to the stage.")}_checkVisibility(){if(!this.content)return;const j=this.visible()?"":"none";this.content.style.display=j}setContainer(j){if(typeof j===c){if(j.charAt(0)==="."){var Q=j.slice(1);j=document.getElementsByClassName(Q)[0]}else{var ne;j.charAt(0)!=="#"?ne=j:ne=j.slice(1),j=document.getElementById(ne)}if(!j)throw"Can not find container in document with id "+ne}return this._setAttr("container",j),this.content&&(this.content.parentElement&&this.content.parentElement.removeChild(this.content),j.appendChild(this.content)),this}shouldDrawHit(){return!0}clear(){var j=this.children,Q=j.length,ne;for(ne=0;ne-1&&e.stages.splice(Q,1),t.Util.releaseCanvas(this.bufferCanvas._canvas,this.bufferHitCanvas._canvas),this}getPointerPosition(){const j=this._pointerPositions[0]||this._changedPointerPositions[0];return j?{x:j.x,y:j.y}:(t.Util.warn(Y),null)}_getPointerById(j){return this._pointerPositions.find(Q=>Q.id===j)}getPointersPositions(){return this._pointerPositions}getStage(){return this}getContent(){return this.content}_toKonvaCanvas(j){j=j||{},j.x=j.x||0,j.y=j.y||0,j.width=j.width||this.width(),j.height=j.height||this.height();var Q=new o.SceneCanvas({width:j.width,height:j.height,pixelRatio:j.pixelRatio||1}),ne=Q.getContext()._context,se=this.children;return(j.x||j.y)&&ne.translate(-1*j.x,-1*j.y),se.forEach(function(ve){if(ve.isVisible()){var ce=ve._toKonvaCanvas(j);ne.drawImage(ce._canvas,j.x,j.y,ce.getWidth()/ce.getPixelRatio(),ce.getHeight()/ce.getPixelRatio())}}),Q}getIntersection(j){if(!j)return null;var Q=this.children,ne=Q.length,se=ne-1,ve;for(ve=se;ve>=0;ve--){const ce=Q[ve].getIntersection(j);if(ce)return ce}return null}_resizeDOM(){var j=this.width(),Q=this.height();this.content&&(this.content.style.width=j+d,this.content.style.height=Q+d),this.bufferCanvas.setSize(j,Q),this.bufferHitCanvas.setSize(j,Q),this.children.forEach(ne=>{ne.setSize({width:j,height:Q}),ne.draw()})}add(j,...Q){if(arguments.length>1){for(var ne=0;neM&&t.Util.warn("The stage has "+se+" layers. Recommended maximum number of layers is 3-5. Adding more layers into the stage may drop the performance. Rethink your tree structure, you can use Konva.Group."),j.setSize({width:this.width(),height:this.height()}),j.draw(),i.Konva.isBrowser&&this.content.appendChild(j.canvas._canvas),this}getParent(){return null}getLayer(){return null}hasPointerCapture(j){return l.hasPointerCapture(j,this)}setPointerCapture(j){l.setPointerCapture(j,this)}releaseCapture(j){l.releaseCapture(j,this)}getLayers(){return this.children}_bindContentEvents(){i.Konva.isBrowser&&R.forEach(([j,Q])=>{this.content.addEventListener(j,ne=>{this[Q](ne)},{passive:!1})})}_pointerenter(j){this.setPointersPositions(j);const Q=U(j.type);this._fire(Q.pointerenter,{evt:j,target:this,currentTarget:this})}_pointerover(j){this.setPointersPositions(j);const Q=U(j.type);this._fire(Q.pointerover,{evt:j,target:this,currentTarget:this})}_getTargetShape(j){let Q=this[j+"targetShape"];return Q&&!Q.getStage()&&(Q=null),Q}_pointerleave(j){const Q=U(j.type),ne=B(j.type);if(Q){this.setPointersPositions(j);var se=this._getTargetShape(ne),ve=!a.DD.isDragging||i.Konva.hitOnDragEnabled;se&&ve?(se._fireAndBubble(Q.pointerout,{evt:j}),se._fireAndBubble(Q.pointerleave,{evt:j}),this._fire(Q.pointerleave,{evt:j,target:this,currentTarget:this}),this[ne+"targetShape"]=null):ve&&(this._fire(Q.pointerleave,{evt:j,target:this,currentTarget:this}),this._fire(Q.pointerout,{evt:j,target:this,currentTarget:this})),this.pointerPos=void 0,this._pointerPositions=[]}}_pointerdown(j){const Q=U(j.type),ne=B(j.type);if(Q){this.setPointersPositions(j);var se=!1;this._changedPointerPositions.forEach(ve=>{var ce=this.getIntersection(ve);if(a.DD.justDragged=!1,i.Konva["_"+ne+"ListenClick"]=!0,!(ce&&ce.isListening()))return;i.Konva.capturePointerEventsEnabled&&ce.setPointerCapture(ve.id),this[ne+"ClickStartShape"]=ce,ce._fireAndBubble(Q.pointerdown,{evt:j,pointerId:ve.id}),se=!0;const ot=j.type.indexOf("touch")>=0;ce.preventDefault()&&j.cancelable&&ot&&j.preventDefault()}),se||this._fire(Q.pointerdown,{evt:j,target:this,currentTarget:this,pointerId:this._pointerPositions[0].id})}}_pointermove(j){const Q=U(j.type),ne=B(j.type);if(!Q)return;a.DD.isDragging&&a.DD.node.preventDefault()&&j.cancelable&&j.preventDefault(),this.setPointersPositions(j);var se=!a.DD.isDragging||i.Konva.hitOnDragEnabled;if(!se)return;var ve={};let ce=!1;var bt=this._getTargetShape(ne);this._changedPointerPositions.forEach(ot=>{const ze=l.getCapturedShape(ot.id)||this.getIntersection(ot),gt=ot.id,Pe={evt:j,pointerId:gt};var Jt=bt!==ze;if(Jt&&bt&&(bt._fireAndBubble(Q.pointerout,Object.assign({},Pe),ze),bt._fireAndBubble(Q.pointerleave,Object.assign({},Pe),ze)),ze){if(ve[ze._id])return;ve[ze._id]=!0}ze&&ze.isListening()?(ce=!0,Jt&&(ze._fireAndBubble(Q.pointerover,Object.assign({},Pe),bt),ze._fireAndBubble(Q.pointerenter,Object.assign({},Pe),bt),this[ne+"targetShape"]=ze),ze._fireAndBubble(Q.pointermove,Object.assign({},Pe))):bt&&(this._fire(Q.pointerover,{evt:j,target:this,currentTarget:this,pointerId:gt}),this[ne+"targetShape"]=null)}),ce||this._fire(Q.pointermove,{evt:j,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id})}_pointerup(j){const Q=U(j.type),ne=B(j.type);if(!Q)return;this.setPointersPositions(j);const se=this[ne+"ClickStartShape"],ve=this[ne+"ClickEndShape"];var ce={};let bt=!1;this._changedPointerPositions.forEach(ot=>{const ze=l.getCapturedShape(ot.id)||this.getIntersection(ot);if(ze){if(ze.releaseCapture(ot.id),ce[ze._id])return;ce[ze._id]=!0}const gt=ot.id,Pe={evt:j,pointerId:gt};let Jt=!1;i.Konva["_"+ne+"InDblClickWindow"]?(Jt=!0,clearTimeout(this[ne+"DblTimeout"])):a.DD.justDragged||(i.Konva["_"+ne+"InDblClickWindow"]=!0,clearTimeout(this[ne+"DblTimeout"])),this[ne+"DblTimeout"]=setTimeout(function(){i.Konva["_"+ne+"InDblClickWindow"]=!1},i.Konva.dblClickWindow),ze&&ze.isListening()?(bt=!0,this[ne+"ClickEndShape"]=ze,ze._fireAndBubble(Q.pointerup,Object.assign({},Pe)),i.Konva["_"+ne+"ListenClick"]&&se&&se===ze&&(ze._fireAndBubble(Q.pointerclick,Object.assign({},Pe)),Jt&&ve&&ve===ze&&ze._fireAndBubble(Q.pointerdblclick,Object.assign({},Pe)))):(this[ne+"ClickEndShape"]=null,i.Konva["_"+ne+"ListenClick"]&&this._fire(Q.pointerclick,{evt:j,target:this,currentTarget:this,pointerId:gt}),Jt&&this._fire(Q.pointerdblclick,{evt:j,target:this,currentTarget:this,pointerId:gt}))}),bt||this._fire(Q.pointerup,{evt:j,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id}),i.Konva["_"+ne+"ListenClick"]=!1,j.cancelable&&ne!=="touch"&&j.preventDefault()}_contextmenu(j){this.setPointersPositions(j);var Q=this.getIntersection(this.getPointerPosition());Q&&Q.isListening()?Q._fireAndBubble($,{evt:j}):this._fire($,{evt:j,target:this,currentTarget:this})}_wheel(j){this.setPointersPositions(j);var Q=this.getIntersection(this.getPointerPosition());Q&&Q.isListening()?Q._fireAndBubble(L,{evt:j}):this._fire(L,{evt:j,target:this,currentTarget:this})}_pointercancel(j){this.setPointersPositions(j);const Q=l.getCapturedShape(j.pointerId)||this.getIntersection(this.getPointerPosition());Q&&Q._fireAndBubble(S,l.createEvent(j)),l.releaseCapture(j.pointerId)}_lostpointercapture(j){l.releaseCapture(j.pointerId)}setPointersPositions(j){var Q=this._getContentPosition(),ne=null,se=null;j=j||window.event,j.touches!==void 0?(this._pointerPositions=[],this._changedPointerPositions=[],Array.prototype.forEach.call(j.touches,ve=>{this._pointerPositions.push({id:ve.identifier,x:(ve.clientX-Q.left)/Q.scaleX,y:(ve.clientY-Q.top)/Q.scaleY})}),Array.prototype.forEach.call(j.changedTouches||j.touches,ve=>{this._changedPointerPositions.push({id:ve.identifier,x:(ve.clientX-Q.left)/Q.scaleX,y:(ve.clientY-Q.top)/Q.scaleY})})):(ne=(j.clientX-Q.left)/Q.scaleX,se=(j.clientY-Q.top)/Q.scaleY,this.pointerPos={x:ne,y:se},this._pointerPositions=[{x:ne,y:se,id:t.Util._getFirstPointerId(j)}],this._changedPointerPositions=[{x:ne,y:se,id:t.Util._getFirstPointerId(j)}])}_setPointerPosition(j){t.Util.warn('Method _setPointerPosition is deprecated. Use "stage.setPointersPositions(event)" instead.'),this.setPointersPositions(j)}_getContentPosition(){if(!this.content||!this.content.getBoundingClientRect)return{top:0,left:0,scaleX:1,scaleY:1};var j=this.content.getBoundingClientRect();return{top:j.top,left:j.left,scaleX:j.width/this.content.clientWidth||1,scaleY:j.height/this.content.clientHeight||1}}_buildDOM(){if(this.bufferCanvas=new o.SceneCanvas({width:this.width(),height:this.height()}),this.bufferHitCanvas=new o.HitCanvas({pixelRatio:1,width:this.width(),height:this.height()}),!!i.Konva.isBrowser){var j=this.container();if(!j)throw"Stage has no container. A container is required.";j.innerHTML="",this.content=document.createElement("div"),this.content.style.position="relative",this.content.style.userSelect="none",this.content.className="konvajs-content",this.content.setAttribute("role","presentation"),j.appendChild(this.content),this._resizeDOM()}}cache(){return t.Util.warn("Cache function is not allowed for stage. You may use cache only for layers, groups and shapes."),this}clearCache(){return this}batchDraw(){return this.getChildren().forEach(function(j){j.batchDraw()}),this}}e.Stage=ee,ee.prototype.nodeType=u,(0,s._registerNode)(ee),n.Factory.addGetterSetter(ee,"container")})(_G);var Cy={},Yr={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.Shape=e.shapes=void 0;const t=Rt,n=dr,r=At,i=rr,o=Xe,a=Rt,s=Go;var l="hasShadow",u="shadowRGBA",c="patternImage",d="linearGradient",f="radialGradient";let h;function p(){return h||(h=n.Util.createCanvasElement().getContext("2d"),h)}e.shapes={};function m(T){const k=this.attrs.fillRule;k?T.fill(k):T.fill()}function _(T){T.stroke()}function b(T){T.fill()}function v(T){T.stroke()}function g(){this._clearCache(l)}function y(){this._clearCache(u)}function S(){this._clearCache(c)}function w(){this._clearCache(d)}function x(){this._clearCache(f)}class C extends i.Node{constructor(k){super(k);let P;for(;P=n.Util.getRandomColor(),!(P&&!(P in e.shapes)););this.colorKey=P,e.shapes[P]=this}getContext(){return n.Util.warn("shape.getContext() method is deprecated. Please do not use it."),this.getLayer().getContext()}getCanvas(){return n.Util.warn("shape.getCanvas() method is deprecated. Please do not use it."),this.getLayer().getCanvas()}getSceneFunc(){return this.attrs.sceneFunc||this._sceneFunc}getHitFunc(){return this.attrs.hitFunc||this._hitFunc}hasShadow(){return this._getCache(l,this._hasShadow)}_hasShadow(){return this.shadowEnabled()&&this.shadowOpacity()!==0&&!!(this.shadowColor()||this.shadowBlur()||this.shadowOffsetX()||this.shadowOffsetY())}_getFillPattern(){return this._getCache(c,this.__getFillPattern)}__getFillPattern(){if(this.fillPatternImage()){var k=p();const P=k.createPattern(this.fillPatternImage(),this.fillPatternRepeat()||"repeat");if(P&&P.setTransform){const $=new n.Transform;$.translate(this.fillPatternX(),this.fillPatternY()),$.rotate(t.Konva.getAngle(this.fillPatternRotation())),$.scale(this.fillPatternScaleX(),this.fillPatternScaleY()),$.translate(-1*this.fillPatternOffsetX(),-1*this.fillPatternOffsetY());const O=$.getMatrix(),E=typeof DOMMatrix>"u"?{a:O[0],b:O[1],c:O[2],d:O[3],e:O[4],f:O[5]}:new DOMMatrix(O);P.setTransform(E)}return P}}_getLinearGradient(){return this._getCache(d,this.__getLinearGradient)}__getLinearGradient(){var k=this.fillLinearGradientColorStops();if(k){for(var P=p(),$=this.fillLinearGradientStartPoint(),O=this.fillLinearGradientEndPoint(),E=P.createLinearGradient($.x,$.y,O.x,O.y),A=0;Athis.fillEnabled()&&!!(this.fill()||this.fillPatternImage()||this.fillLinearGradientColorStops()||this.fillRadialGradientColorStops()))}hasStroke(){return this._calculate("hasStroke",["strokeEnabled","strokeWidth","stroke","strokeLinearGradientColorStops"],()=>this.strokeEnabled()&&this.strokeWidth()&&!!(this.stroke()||this.strokeLinearGradientColorStops()))}hasHitStroke(){const k=this.hitStrokeWidth();return k==="auto"?this.hasStroke():this.strokeEnabled()&&!!k}intersects(k){var P=this.getStage(),$=P.bufferHitCanvas,O;return $.getContext().clear(),this.drawHit($,null,!0),O=$.context.getImageData(Math.round(k.x),Math.round(k.y),1,1).data,O[3]>0}destroy(){return i.Node.prototype.destroy.call(this),delete e.shapes[this.colorKey],delete this.colorKey,this}_useBufferCanvas(k){var P;if(!this.getStage()||!((P=this.attrs.perfectDrawEnabled)!==null&&P!==void 0?P:!0))return!1;const O=k||this.hasFill(),E=this.hasStroke(),A=this.getAbsoluteOpacity()!==1;if(O&&E&&A)return!0;const D=this.hasShadow(),L=this.shadowForStrokeEnabled();return!!(O&&E&&D&&L)}setStrokeHitEnabled(k){n.Util.warn("strokeHitEnabled property is deprecated. Please use hitStrokeWidth instead."),k?this.hitStrokeWidth("auto"):this.hitStrokeWidth(0)}getStrokeHitEnabled(){return this.hitStrokeWidth()!==0}getSelfRect(){var k=this.size();return{x:this._centroid?-k.width/2:0,y:this._centroid?-k.height/2:0,width:k.width,height:k.height}}getClientRect(k={}){const P=k.skipTransform,$=k.relativeTo,O=this.getSelfRect(),A=!k.skipStroke&&this.hasStroke()&&this.strokeWidth()||0,D=O.width+A,L=O.height+A,M=!k.skipShadow&&this.hasShadow(),R=M?this.shadowOffsetX():0,N=M?this.shadowOffsetY():0,B=D+Math.abs(R),U=L+Math.abs(N),G=M&&this.shadowBlur()||0,Y=B+G*2,ee=U+G*2,J={width:Y,height:ee,x:-(A/2+G)+Math.min(R,0)+O.x,y:-(A/2+G)+Math.min(N,0)+O.y};return P?J:this._transformedRect(J,$)}drawScene(k,P){var $=this.getLayer(),O=k||$.getCanvas(),E=O.getContext(),A=this._getCanvasCache(),D=this.getSceneFunc(),L=this.hasShadow(),M,R,N,B=O.isCache,U=P===this;if(!this.isVisible()&&!U)return this;if(A){E.save();var G=this.getAbsoluteTransform(P).getMatrix();return E.transform(G[0],G[1],G[2],G[3],G[4],G[5]),this._drawCachedSceneCanvas(E),E.restore(),this}if(!D)return this;if(E.save(),this._useBufferCanvas()&&!B){M=this.getStage(),R=M.bufferCanvas,N=R.getContext(),N.clear(),N.save(),N._applyLineJoin(this);var Y=this.getAbsoluteTransform(P).getMatrix();N.transform(Y[0],Y[1],Y[2],Y[3],Y[4],Y[5]),D.call(this,N,this),N.restore();var ee=R.pixelRatio;L&&E._applyShadow(this),E._applyOpacity(this),E._applyGlobalCompositeOperation(this),E.drawImage(R._canvas,0,0,R.width/ee,R.height/ee)}else{if(E._applyLineJoin(this),!U){var Y=this.getAbsoluteTransform(P).getMatrix();E.transform(Y[0],Y[1],Y[2],Y[3],Y[4],Y[5]),E._applyOpacity(this),E._applyGlobalCompositeOperation(this)}L&&E._applyShadow(this),D.call(this,E,this)}return E.restore(),this}drawHit(k,P,$=!1){if(!this.shouldDrawHit(P,$))return this;var O=this.getLayer(),E=k||O.hitCanvas,A=E&&E.getContext(),D=this.hitFunc()||this.sceneFunc(),L=this._getCanvasCache(),M=L&&L.hit;if(this.colorKey||n.Util.warn("Looks like your canvas has a destroyed shape in it. Do not reuse shape after you destroyed it. If you want to reuse shape you should call remove() instead of destroy()"),M){A.save();var R=this.getAbsoluteTransform(P).getMatrix();return A.transform(R[0],R[1],R[2],R[3],R[4],R[5]),this._drawCachedHitCanvas(A),A.restore(),this}if(!D)return this;if(A.save(),A._applyLineJoin(this),!(this===P)){var B=this.getAbsoluteTransform(P).getMatrix();A.transform(B[0],B[1],B[2],B[3],B[4],B[5])}return D.call(this,A,this),A.restore(),this}drawHitFromCache(k=0){var P=this._getCanvasCache(),$=this._getCachedSceneCanvas(),O=P.hit,E=O.getContext(),A=O.getWidth(),D=O.getHeight(),L,M,R,N,B,U;E.clear(),E.drawImage($._canvas,0,0,A,D);try{for(L=E.getImageData(0,0,A,D),M=L.data,R=M.length,N=n.Util._hexToRgb(this.colorKey),B=0;Bk?(M[B]=N.r,M[B+1]=N.g,M[B+2]=N.b,M[B+3]=255):M[B+3]=0;E.putImageData(L,0,0)}catch(G){n.Util.error("Unable to draw hit graph from cached scene canvas. "+G.message)}return this}hasPointerCapture(k){return s.hasPointerCapture(k,this)}setPointerCapture(k){s.setPointerCapture(k,this)}releaseCapture(k){s.releaseCapture(k,this)}}e.Shape=C,C.prototype._fillFunc=m,C.prototype._strokeFunc=_,C.prototype._fillFuncHit=b,C.prototype._strokeFuncHit=v,C.prototype._centroid=!1,C.prototype.nodeType="Shape",(0,a._registerNode)(C),C.prototype.eventListeners={},C.prototype.on.call(C.prototype,"shadowColorChange.konva shadowBlurChange.konva shadowOffsetChange.konva shadowOpacityChange.konva shadowEnabledChange.konva",g),C.prototype.on.call(C.prototype,"shadowColorChange.konva shadowOpacityChange.konva shadowEnabledChange.konva",y),C.prototype.on.call(C.prototype,"fillPriorityChange.konva fillPatternImageChange.konva fillPatternRepeatChange.konva fillPatternScaleXChange.konva fillPatternScaleYChange.konva fillPatternOffsetXChange.konva fillPatternOffsetYChange.konva fillPatternXChange.konva fillPatternYChange.konva fillPatternRotationChange.konva",S),C.prototype.on.call(C.prototype,"fillPriorityChange.konva fillLinearGradientColorStopsChange.konva fillLinearGradientStartPointXChange.konva fillLinearGradientStartPointYChange.konva fillLinearGradientEndPointXChange.konva fillLinearGradientEndPointYChange.konva",w),C.prototype.on.call(C.prototype,"fillPriorityChange.konva fillRadialGradientColorStopsChange.konva fillRadialGradientStartPointXChange.konva fillRadialGradientStartPointYChange.konva fillRadialGradientEndPointXChange.konva fillRadialGradientEndPointYChange.konva fillRadialGradientStartRadiusChange.konva fillRadialGradientEndRadiusChange.konva",x),r.Factory.addGetterSetter(C,"stroke",void 0,(0,o.getStringOrGradientValidator)()),r.Factory.addGetterSetter(C,"strokeWidth",2,(0,o.getNumberValidator)()),r.Factory.addGetterSetter(C,"fillAfterStrokeEnabled",!1),r.Factory.addGetterSetter(C,"hitStrokeWidth","auto",(0,o.getNumberOrAutoValidator)()),r.Factory.addGetterSetter(C,"strokeHitEnabled",!0,(0,o.getBooleanValidator)()),r.Factory.addGetterSetter(C,"perfectDrawEnabled",!0,(0,o.getBooleanValidator)()),r.Factory.addGetterSetter(C,"shadowForStrokeEnabled",!0,(0,o.getBooleanValidator)()),r.Factory.addGetterSetter(C,"lineJoin"),r.Factory.addGetterSetter(C,"lineCap"),r.Factory.addGetterSetter(C,"sceneFunc"),r.Factory.addGetterSetter(C,"hitFunc"),r.Factory.addGetterSetter(C,"dash"),r.Factory.addGetterSetter(C,"dashOffset",0,(0,o.getNumberValidator)()),r.Factory.addGetterSetter(C,"shadowColor",void 0,(0,o.getStringValidator)()),r.Factory.addGetterSetter(C,"shadowBlur",0,(0,o.getNumberValidator)()),r.Factory.addGetterSetter(C,"shadowOpacity",1,(0,o.getNumberValidator)()),r.Factory.addComponentsGetterSetter(C,"shadowOffset",["x","y"]),r.Factory.addGetterSetter(C,"shadowOffsetX",0,(0,o.getNumberValidator)()),r.Factory.addGetterSetter(C,"shadowOffsetY",0,(0,o.getNumberValidator)()),r.Factory.addGetterSetter(C,"fillPatternImage"),r.Factory.addGetterSetter(C,"fill",void 0,(0,o.getStringOrGradientValidator)()),r.Factory.addGetterSetter(C,"fillPatternX",0,(0,o.getNumberValidator)()),r.Factory.addGetterSetter(C,"fillPatternY",0,(0,o.getNumberValidator)()),r.Factory.addGetterSetter(C,"fillLinearGradientColorStops"),r.Factory.addGetterSetter(C,"strokeLinearGradientColorStops"),r.Factory.addGetterSetter(C,"fillRadialGradientStartRadius",0),r.Factory.addGetterSetter(C,"fillRadialGradientEndRadius",0),r.Factory.addGetterSetter(C,"fillRadialGradientColorStops"),r.Factory.addGetterSetter(C,"fillPatternRepeat","repeat"),r.Factory.addGetterSetter(C,"fillEnabled",!0),r.Factory.addGetterSetter(C,"strokeEnabled",!0),r.Factory.addGetterSetter(C,"shadowEnabled",!0),r.Factory.addGetterSetter(C,"dashEnabled",!0),r.Factory.addGetterSetter(C,"strokeScaleEnabled",!0),r.Factory.addGetterSetter(C,"fillPriority","color"),r.Factory.addComponentsGetterSetter(C,"fillPatternOffset",["x","y"]),r.Factory.addGetterSetter(C,"fillPatternOffsetX",0,(0,o.getNumberValidator)()),r.Factory.addGetterSetter(C,"fillPatternOffsetY",0,(0,o.getNumberValidator)()),r.Factory.addComponentsGetterSetter(C,"fillPatternScale",["x","y"]),r.Factory.addGetterSetter(C,"fillPatternScaleX",1,(0,o.getNumberValidator)()),r.Factory.addGetterSetter(C,"fillPatternScaleY",1,(0,o.getNumberValidator)()),r.Factory.addComponentsGetterSetter(C,"fillLinearGradientStartPoint",["x","y"]),r.Factory.addComponentsGetterSetter(C,"strokeLinearGradientStartPoint",["x","y"]),r.Factory.addGetterSetter(C,"fillLinearGradientStartPointX",0),r.Factory.addGetterSetter(C,"strokeLinearGradientStartPointX",0),r.Factory.addGetterSetter(C,"fillLinearGradientStartPointY",0),r.Factory.addGetterSetter(C,"strokeLinearGradientStartPointY",0),r.Factory.addComponentsGetterSetter(C,"fillLinearGradientEndPoint",["x","y"]),r.Factory.addComponentsGetterSetter(C,"strokeLinearGradientEndPoint",["x","y"]),r.Factory.addGetterSetter(C,"fillLinearGradientEndPointX",0),r.Factory.addGetterSetter(C,"strokeLinearGradientEndPointX",0),r.Factory.addGetterSetter(C,"fillLinearGradientEndPointY",0),r.Factory.addGetterSetter(C,"strokeLinearGradientEndPointY",0),r.Factory.addComponentsGetterSetter(C,"fillRadialGradientStartPoint",["x","y"]),r.Factory.addGetterSetter(C,"fillRadialGradientStartPointX",0),r.Factory.addGetterSetter(C,"fillRadialGradientStartPointY",0),r.Factory.addComponentsGetterSetter(C,"fillRadialGradientEndPoint",["x","y"]),r.Factory.addGetterSetter(C,"fillRadialGradientEndPointX",0),r.Factory.addGetterSetter(C,"fillRadialGradientEndPointY",0),r.Factory.addGetterSetter(C,"fillPatternRotation",0),r.Factory.addGetterSetter(C,"fillRule",void 0,(0,o.getStringValidator)()),r.Factory.backCompat(C,{dashArray:"dash",getDashArray:"getDash",setDashArray:"getDash",drawFunc:"sceneFunc",getDrawFunc:"getSceneFunc",setDrawFunc:"setSceneFunc",drawHitFunc:"hitFunc",getDrawHitFunc:"getHitFunc",setDrawHitFunc:"setHitFunc"})})(Yr);Object.defineProperty(Cy,"__esModule",{value:!0});Cy.Layer=void 0;const dl=dr,WC=Gd,mf=rr,bA=At,uO=is,kwe=Xe,Twe=Yr,Awe=Rt;var Pwe="#",Iwe="beforeDraw",Rwe="draw",wG=[{x:0,y:0},{x:-1,y:-1},{x:1,y:-1},{x:1,y:1},{x:-1,y:1}],Owe=wG.length;class Sp extends WC.Container{constructor(t){super(t),this.canvas=new uO.SceneCanvas,this.hitCanvas=new uO.HitCanvas({pixelRatio:1}),this._waitingForDraw=!1,this.on("visibleChange.konva",this._checkVisibility),this._checkVisibility(),this.on("imageSmoothingEnabledChange.konva",this._setSmoothEnabled),this._setSmoothEnabled()}createPNGStream(){return this.canvas._canvas.createPNGStream()}getCanvas(){return this.canvas}getNativeCanvasElement(){return this.canvas._canvas}getHitCanvas(){return this.hitCanvas}getContext(){return this.getCanvas().getContext()}clear(t){return this.getContext().clear(t),this.getHitCanvas().getContext().clear(t),this}setZIndex(t){super.setZIndex(t);var n=this.getStage();return n&&n.content&&(n.content.removeChild(this.getNativeCanvasElement()),t{this.draw(),this._waitingForDraw=!1})),this}getIntersection(t){if(!this.isListening()||!this.isVisible())return null;for(var n=1,r=!1;;){for(let i=0;i0)return{antialiased:!0};return{}}drawScene(t,n){var r=this.getLayer(),i=t||r&&r.getCanvas();return this._fire(Iwe,{node:this}),this.clearBeforeDraw()&&i.getContext().clear(),WC.Container.prototype.drawScene.call(this,i,n),this._fire(Rwe,{node:this}),this}drawHit(t,n){var r=this.getLayer(),i=t||r&&r.hitCanvas;return r&&r.clearBeforeDraw()&&r.getHitCanvas().getContext().clear(),WC.Container.prototype.drawHit.call(this,i,n),this}enableHitGraph(){return this.hitGraphEnabled(!0),this}disableHitGraph(){return this.hitGraphEnabled(!1),this}setHitGraphEnabled(t){dl.Util.warn("hitGraphEnabled method is deprecated. Please use layer.listening() instead."),this.listening(t)}getHitGraphEnabled(t){return dl.Util.warn("hitGraphEnabled method is deprecated. Please use layer.listening() instead."),this.listening()}toggleHitCanvas(){if(!(!this.parent||!this.parent.content)){var t=this.parent,n=!!this.hitCanvas._canvas.parentNode;n?t.content.removeChild(this.hitCanvas._canvas):t.content.appendChild(this.hitCanvas._canvas)}}destroy(){return dl.Util.releaseCanvas(this.getNativeCanvasElement(),this.getHitCanvas()._canvas),super.destroy()}}Cy.Layer=Sp;Sp.prototype.nodeType="Layer";(0,Awe._registerNode)(Sp);bA.Factory.addGetterSetter(Sp,"imageSmoothingEnabled",!0);bA.Factory.addGetterSetter(Sp,"clearBeforeDraw",!0);bA.Factory.addGetterSetter(Sp,"hitGraphEnabled",!0,(0,kwe.getBooleanValidator)());var ax={};Object.defineProperty(ax,"__esModule",{value:!0});ax.FastLayer=void 0;const Mwe=dr,Nwe=Cy,$we=Rt;class _A extends Nwe.Layer{constructor(t){super(t),this.listening(!1),Mwe.Util.warn('Konva.Fast layer is deprecated. Please use "new Konva.Layer({ listening: false })" instead.')}}ax.FastLayer=_A;_A.prototype.nodeType="FastLayer";(0,$we._registerNode)(_A);var xp={};Object.defineProperty(xp,"__esModule",{value:!0});xp.Group=void 0;const Dwe=dr,Lwe=Gd,Fwe=Rt;class SA extends Lwe.Container{_validateAdd(t){var n=t.getType();n!=="Group"&&n!=="Shape"&&Dwe.Util.throw("You may only add groups and shapes to groups.")}}xp.Group=SA;SA.prototype.nodeType="Group";(0,Fwe._registerNode)(SA);var wp={};Object.defineProperty(wp,"__esModule",{value:!0});wp.Animation=void 0;const KC=Rt,cO=dr;var QC=function(){return KC.glob.performance&&KC.glob.performance.now?function(){return KC.glob.performance.now()}:function(){return new Date().getTime()}}();class Is{constructor(t,n){this.id=Is.animIdCounter++,this.frame={time:0,timeDiff:0,lastTime:QC(),frameRate:0},this.func=t,this.setLayers(n)}setLayers(t){var n=[];return t?t.length>0?n=t:n=[t]:n=[],this.layers=n,this}getLayers(){return this.layers}addLayer(t){var n=this.layers,r=n.length,i;for(i=0;ithis.duration?this.yoyo?(this._time=this.duration,this.reverse()):this.finish():p<0?this.yoyo?(this._time=0,this.play()):this.reset():(this._time=p,this.update())}getTime(){return this._time}setPosition(p){this.prevPos=this._pos,this.propFunc(p),this._pos=p}getPosition(p){return p===void 0&&(p=this._time),this.func(p,this.begin,this._change,this.duration)}play(){this.state=s,this._startTime=this.getTimer()-this._time,this.onEnterFrame(),this.fire("onPlay")}reverse(){this.state=l,this._time=this.duration-this._time,this._startTime=this.getTimer()-this._time,this.onEnterFrame(),this.fire("onReverse")}seek(p){this.pause(),this._time=p,this.update(),this.fire("onSeek")}reset(){this.pause(),this._time=0,this.update(),this.fire("onReset")}finish(){this.pause(),this._time=this.duration,this.update(),this.fire("onFinish")}update(){this.setPosition(this.getPosition(this._time)),this.fire("onUpdate")}onEnterFrame(){var p=this.getTimer()-this._startTime;this.state===s?this.setTime(p):this.state===l&&this.setTime(this.duration-p)}pause(){this.state=a,this.fire("onPause")}getTimer(){return new Date().getTime()}}class f{constructor(p){var m=this,_=p.node,b=_._id,v,g=p.easing||e.Easings.Linear,y=!!p.yoyo,S;typeof p.duration>"u"?v=.3:p.duration===0?v=.001:v=p.duration,this.node=_,this._id=u++;var w=_.getLayer()||(_ instanceof i.Konva.Stage?_.getLayers():null);w||t.Util.error("Tween constructor have `node` that is not in a layer. Please add node into layer first."),this.anim=new n.Animation(function(){m.tween.onEnterFrame()},w),this.tween=new d(S,function(x){m._tweenFunc(x)},g,0,1,v*1e3,y),this._addListeners(),f.attrs[b]||(f.attrs[b]={}),f.attrs[b][this._id]||(f.attrs[b][this._id]={}),f.tweens[b]||(f.tweens[b]={});for(S in p)o[S]===void 0&&this._addAttr(S,p[S]);this.reset(),this.onFinish=p.onFinish,this.onReset=p.onReset,this.onUpdate=p.onUpdate}_addAttr(p,m){var _=this.node,b=_._id,v,g,y,S,w,x,C,T;if(y=f.tweens[b][p],y&&delete f.attrs[b][y][p],v=_.getAttr(p),t.Util._isArray(m))if(g=[],w=Math.max(m.length,v.length),p==="points"&&m.length!==v.length&&(m.length>v.length?(C=v,v=t.Util._prepareArrayForTween(v,m,_.closed())):(x=m,m=t.Util._prepareArrayForTween(m,v,_.closed()))),p.indexOf("fill")===0)for(S=0;S{this.anim.start()},this.tween.onReverse=()=>{this.anim.start()},this.tween.onPause=()=>{this.anim.stop()},this.tween.onFinish=()=>{var p=this.node,m=f.attrs[p._id][this._id];m.points&&m.points.trueEnd&&p.setAttr("points",m.points.trueEnd),this.onFinish&&this.onFinish.call(this)},this.tween.onReset=()=>{var p=this.node,m=f.attrs[p._id][this._id];m.points&&m.points.trueStart&&p.points(m.points.trueStart),this.onReset&&this.onReset()},this.tween.onUpdate=()=>{this.onUpdate&&this.onUpdate.call(this)}}play(){return this.tween.play(),this}reverse(){return this.tween.reverse(),this}reset(){return this.tween.reset(),this}seek(p){return this.tween.seek(p*1e3),this}pause(){return this.tween.pause(),this}finish(){return this.tween.finish(),this}destroy(){var p=this.node._id,m=this._id,_=f.tweens[p],b;this.pause();for(b in _)delete f.tweens[p][b];delete f.attrs[p][m]}}e.Tween=f,f.attrs={},f.tweens={},r.Node.prototype.to=function(h){var p=h.onFinish;h.node=this,h.onFinish=function(){this.destroy(),p&&p()};var m=new f(h);m.play()},e.Easings={BackEaseIn(h,p,m,_){var b=1.70158;return m*(h/=_)*h*((b+1)*h-b)+p},BackEaseOut(h,p,m,_){var b=1.70158;return m*((h=h/_-1)*h*((b+1)*h+b)+1)+p},BackEaseInOut(h,p,m,_){var b=1.70158;return(h/=_/2)<1?m/2*(h*h*(((b*=1.525)+1)*h-b))+p:m/2*((h-=2)*h*(((b*=1.525)+1)*h+b)+2)+p},ElasticEaseIn(h,p,m,_,b,v){var g=0;return h===0?p:(h/=_)===1?p+m:(v||(v=_*.3),!b||b0?t:n),c=a*n,d=s*(s>0?t:n),f=l*(l>0?n:t);return{x:u,y:r?-1*f:d,width:c-u,height:f-d}}}sx.Arc=tu;tu.prototype._centroid=!0;tu.prototype.className="Arc";tu.prototype._attrsAffectingSize=["innerRadius","outerRadius"];(0,zwe._registerNode)(tu);lx.Factory.addGetterSetter(tu,"innerRadius",0,(0,ux.getNumberValidator)());lx.Factory.addGetterSetter(tu,"outerRadius",0,(0,ux.getNumberValidator)());lx.Factory.addGetterSetter(tu,"angle",0,(0,ux.getNumberValidator)());lx.Factory.addGetterSetter(tu,"clockwise",!1,(0,ux.getBooleanValidator)());var cx={},Ey={};Object.defineProperty(Ey,"__esModule",{value:!0});Ey.Line=void 0;const dx=At,jwe=Yr,EG=Xe,Uwe=Rt;function WE(e,t,n,r,i,o,a){var s=Math.sqrt(Math.pow(n-e,2)+Math.pow(r-t,2)),l=Math.sqrt(Math.pow(i-n,2)+Math.pow(o-r,2)),u=a*s/(s+l),c=a*l/(s+l),d=n-u*(i-e),f=r-u*(o-t),h=n+c*(i-e),p=r+c*(o-t);return[d,f,h,p]}function fO(e,t){var n=e.length,r=[],i,o;for(i=2;i4){for(s=this.getTensionPoints(),l=s.length,u=o?0:4,o||t.quadraticCurveTo(s[0],s[1],s[2],s[3]);u{let u,c,d;u=l/2,c=0;for(let h=0;h<20;h++)d=u*e.tValues[20][h]+u,c+=e.cValues[20][h]*r(a,s,d);return u*c};e.getCubicArcLength=t;const n=(a,s,l)=>{l===void 0&&(l=1);const u=a[0]-2*a[1]+a[2],c=s[0]-2*s[1]+s[2],d=2*a[1]-2*a[0],f=2*s[1]-2*s[0],h=4*(u*u+c*c),p=4*(u*d+c*f),m=d*d+f*f;if(h===0)return l*Math.sqrt(Math.pow(a[2]-a[0],2)+Math.pow(s[2]-s[0],2));const _=p/(2*h),b=m/h,v=l+_,g=b-_*_,y=v*v+g>0?Math.sqrt(v*v+g):0,S=_*_+g>0?Math.sqrt(_*_+g):0,w=_+Math.sqrt(_*_+g)!==0?g*Math.log(Math.abs((v+y)/(_+S))):0;return Math.sqrt(h)/2*(v*y-_*S+w)};e.getQuadraticArcLength=n;function r(a,s,l){const u=i(1,l,a),c=i(1,l,s),d=u*u+c*c;return Math.sqrt(d)}const i=(a,s,l)=>{const u=l.length-1;let c,d;if(u===0)return 0;if(a===0){d=0;for(let f=0;f<=u;f++)d+=e.binomialCoefficients[u][f]*Math.pow(1-s,u-f)*Math.pow(s,f)*l[f];return d}else{c=new Array(u);for(let f=0;f{let u=1,c=a/s,d=(a-l(c))/s,f=0;for(;u>.001;){const h=l(c+d),p=Math.abs(a-h)/s;if(p500)break}return c};e.t2length=o})(kG);Object.defineProperty(Cp,"__esModule",{value:!0});Cp.Path=void 0;const Vwe=At,Gwe=Yr,Hwe=Rt,yf=kG;class Vr extends Gwe.Shape{constructor(t){super(t),this.dataArray=[],this.pathLength=0,this._readDataAttribute(),this.on("dataChange.konva",function(){this._readDataAttribute()})}_readDataAttribute(){this.dataArray=Vr.parsePathData(this.data()),this.pathLength=Vr.getPathLength(this.dataArray)}_sceneFunc(t){var n=this.dataArray;t.beginPath();for(var r=!1,i=0;ic?u:c,_=u>c?1:u/c,b=u>c?c/u:1;t.translate(s,l),t.rotate(h),t.scale(_,b),t.arc(0,0,m,d,d+f,1-p),t.scale(1/_,1/b),t.rotate(-h),t.translate(-s,-l);break;case"z":r=!0,t.closePath();break}}!r&&!this.hasFill()?t.strokeShape(this):t.fillStrokeShape(this)}getSelfRect(){var t=[];this.dataArray.forEach(function(u){if(u.command==="A"){var c=u.points[4],d=u.points[5],f=u.points[4]+d,h=Math.PI/180;if(Math.abs(c-f)f;p-=h){const m=Vr.getPointOnEllipticalArc(u.points[0],u.points[1],u.points[2],u.points[3],p,0);t.push(m.x,m.y)}else for(let p=c+h;pn[i].pathLength;)t-=n[i].pathLength,++i;if(i===o)return r=n[i-1].points.slice(-2),{x:r[0],y:r[1]};if(t<.01)return r=n[i].points.slice(0,2),{x:r[0],y:r[1]};var a=n[i],s=a.points;switch(a.command){case"L":return Vr.getPointOnLine(t,a.start.x,a.start.y,s[0],s[1]);case"C":return Vr.getPointOnCubicBezier((0,yf.t2length)(t,Vr.getPathLength(n),m=>(0,yf.getCubicArcLength)([a.start.x,s[0],s[2],s[4]],[a.start.y,s[1],s[3],s[5]],m)),a.start.x,a.start.y,s[0],s[1],s[2],s[3],s[4],s[5]);case"Q":return Vr.getPointOnQuadraticBezier((0,yf.t2length)(t,Vr.getPathLength(n),m=>(0,yf.getQuadraticArcLength)([a.start.x,s[0],s[2]],[a.start.y,s[1],s[3]],m)),a.start.x,a.start.y,s[0],s[1],s[2],s[3]);case"A":var l=s[0],u=s[1],c=s[2],d=s[3],f=s[4],h=s[5],p=s[6];return f+=h*t/a.pathLength,Vr.getPointOnEllipticalArc(l,u,c,d,f,p)}return null}static getPointOnLine(t,n,r,i,o,a,s){a===void 0&&(a=n),s===void 0&&(s=r);var l=(o-r)/(i-n+1e-8),u=Math.sqrt(t*t/(1+l*l));i0&&!isNaN(p[0]);){var v=null,g=[],y=l,S=u,w,x,C,T,k,P,$,O,E,A;switch(h){case"l":l+=p.shift(),u+=p.shift(),v="L",g.push(l,u);break;case"L":l=p.shift(),u=p.shift(),g.push(l,u);break;case"m":var D=p.shift(),L=p.shift();if(l+=D,u+=L,v="M",a.length>2&&a[a.length-1].command==="z"){for(var M=a.length-2;M>=0;M--)if(a[M].command==="M"){l=a[M].points[0]+D,u=a[M].points[1]+L;break}}g.push(l,u),h="l";break;case"M":l=p.shift(),u=p.shift(),v="M",g.push(l,u),h="L";break;case"h":l+=p.shift(),v="L",g.push(l,u);break;case"H":l=p.shift(),v="L",g.push(l,u);break;case"v":u+=p.shift(),v="L",g.push(l,u);break;case"V":u=p.shift(),v="L",g.push(l,u);break;case"C":g.push(p.shift(),p.shift(),p.shift(),p.shift()),l=p.shift(),u=p.shift(),g.push(l,u);break;case"c":g.push(l+p.shift(),u+p.shift(),l+p.shift(),u+p.shift()),l+=p.shift(),u+=p.shift(),v="C",g.push(l,u);break;case"S":x=l,C=u,w=a[a.length-1],w.command==="C"&&(x=l+(l-w.points[2]),C=u+(u-w.points[3])),g.push(x,C,p.shift(),p.shift()),l=p.shift(),u=p.shift(),v="C",g.push(l,u);break;case"s":x=l,C=u,w=a[a.length-1],w.command==="C"&&(x=l+(l-w.points[2]),C=u+(u-w.points[3])),g.push(x,C,l+p.shift(),u+p.shift()),l+=p.shift(),u+=p.shift(),v="C",g.push(l,u);break;case"Q":g.push(p.shift(),p.shift()),l=p.shift(),u=p.shift(),g.push(l,u);break;case"q":g.push(l+p.shift(),u+p.shift()),l+=p.shift(),u+=p.shift(),v="Q",g.push(l,u);break;case"T":x=l,C=u,w=a[a.length-1],w.command==="Q"&&(x=l+(l-w.points[0]),C=u+(u-w.points[1])),l=p.shift(),u=p.shift(),v="Q",g.push(x,C,l,u);break;case"t":x=l,C=u,w=a[a.length-1],w.command==="Q"&&(x=l+(l-w.points[0]),C=u+(u-w.points[1])),l+=p.shift(),u+=p.shift(),v="Q",g.push(x,C,l,u);break;case"A":T=p.shift(),k=p.shift(),P=p.shift(),$=p.shift(),O=p.shift(),E=l,A=u,l=p.shift(),u=p.shift(),v="A",g=this.convertEndpointToCenterParameterization(E,A,l,u,$,O,T,k,P);break;case"a":T=p.shift(),k=p.shift(),P=p.shift(),$=p.shift(),O=p.shift(),E=l,A=u,l+=p.shift(),u+=p.shift(),v="A",g=this.convertEndpointToCenterParameterization(E,A,l,u,$,O,T,k,P);break}a.push({command:v||h,points:g,start:{x:y,y:S},pathLength:this.calcLength(y,S,v||h,g)})}(h==="z"||h==="Z")&&a.push({command:"z",points:[],start:void 0,pathLength:0})}return a}static calcLength(t,n,r,i){var o,a,s,l,u=Vr;switch(r){case"L":return u.getLineLength(t,n,i[0],i[1]);case"C":return(0,yf.getCubicArcLength)([t,i[0],i[2],i[4]],[n,i[1],i[3],i[5]],1);case"Q":return(0,yf.getQuadraticArcLength)([t,i[0],i[2]],[n,i[1],i[3]],1);case"A":o=0;var c=i[4],d=i[5],f=i[4]+d,h=Math.PI/180;if(Math.abs(c-f)f;l-=h)s=u.getPointOnEllipticalArc(i[0],i[1],i[2],i[3],l,0),o+=u.getLineLength(a.x,a.y,s.x,s.y),a=s;else for(l=c+h;l1&&(s*=Math.sqrt(h),l*=Math.sqrt(h));var p=Math.sqrt((s*s*(l*l)-s*s*(f*f)-l*l*(d*d))/(s*s*(f*f)+l*l*(d*d)));o===a&&(p*=-1),isNaN(p)&&(p=0);var m=p*s*f/l,_=p*-l*d/s,b=(t+r)/2+Math.cos(c)*m-Math.sin(c)*_,v=(n+i)/2+Math.sin(c)*m+Math.cos(c)*_,g=function(k){return Math.sqrt(k[0]*k[0]+k[1]*k[1])},y=function(k,P){return(k[0]*P[0]+k[1]*P[1])/(g(k)*g(P))},S=function(k,P){return(k[0]*P[1]=1&&(T=0),a===0&&T>0&&(T=T-2*Math.PI),a===1&&T<0&&(T=T+2*Math.PI),[b,v,s,l,w,T,c,a]}}Cp.Path=Vr;Vr.prototype.className="Path";Vr.prototype._attrsAffectingSize=["data"];(0,Hwe._registerNode)(Vr);Vwe.Factory.addGetterSetter(Vr,"data");Object.defineProperty(cx,"__esModule",{value:!0});cx.Arrow=void 0;const fx=At,qwe=Ey,TG=Xe,Wwe=Rt,hO=Cp;class qd extends qwe.Line{_sceneFunc(t){super._sceneFunc(t);var n=Math.PI*2,r=this.points(),i=r,o=this.tension()!==0&&r.length>4;o&&(i=this.getTensionPoints());var a=this.pointerLength(),s=r.length,l,u;if(o){const f=[i[i.length-4],i[i.length-3],i[i.length-2],i[i.length-1],r[s-2],r[s-1]],h=hO.Path.calcLength(i[i.length-4],i[i.length-3],"C",f),p=hO.Path.getPointOnQuadraticBezier(Math.min(1,1-a/h),f[0],f[1],f[2],f[3],f[4],f[5]);l=r[s-2]-p.x,u=r[s-1]-p.y}else l=r[s-2]-r[s-4],u=r[s-1]-r[s-3];var c=(Math.atan2(u,l)+n)%n,d=this.pointerWidth();this.pointerAtEnding()&&(t.save(),t.beginPath(),t.translate(r[s-2],r[s-1]),t.rotate(c),t.moveTo(0,0),t.lineTo(-a,d/2),t.lineTo(-a,-d/2),t.closePath(),t.restore(),this.__fillStroke(t)),this.pointerAtBeginning()&&(t.save(),t.beginPath(),t.translate(r[0],r[1]),o?(l=(i[0]+i[2])/2-r[0],u=(i[1]+i[3])/2-r[1]):(l=r[2]-r[0],u=r[3]-r[1]),t.rotate((Math.atan2(-u,-l)+n)%n),t.moveTo(0,0),t.lineTo(-a,d/2),t.lineTo(-a,-d/2),t.closePath(),t.restore(),this.__fillStroke(t))}__fillStroke(t){var n=this.dashEnabled();n&&(this.attrs.dashEnabled=!1,t.setLineDash([])),t.fillStrokeShape(this),n&&(this.attrs.dashEnabled=!0)}getSelfRect(){const t=super.getSelfRect(),n=this.pointerWidth()/2;return{x:t.x-n,y:t.y-n,width:t.width+n*2,height:t.height+n*2}}}cx.Arrow=qd;qd.prototype.className="Arrow";(0,Wwe._registerNode)(qd);fx.Factory.addGetterSetter(qd,"pointerLength",10,(0,TG.getNumberValidator)());fx.Factory.addGetterSetter(qd,"pointerWidth",10,(0,TG.getNumberValidator)());fx.Factory.addGetterSetter(qd,"pointerAtBeginning",!1);fx.Factory.addGetterSetter(qd,"pointerAtEnding",!0);var hx={};Object.defineProperty(hx,"__esModule",{value:!0});hx.Circle=void 0;const Kwe=At,Qwe=Yr,Xwe=Xe,Ywe=Rt;let Ep=class extends Qwe.Shape{_sceneFunc(t){t.beginPath(),t.arc(0,0,this.attrs.radius||0,0,Math.PI*2,!1),t.closePath(),t.fillStrokeShape(this)}getWidth(){return this.radius()*2}getHeight(){return this.radius()*2}setWidth(t){this.radius()!==t/2&&this.radius(t/2)}setHeight(t){this.radius()!==t/2&&this.radius(t/2)}};hx.Circle=Ep;Ep.prototype._centroid=!0;Ep.prototype.className="Circle";Ep.prototype._attrsAffectingSize=["radius"];(0,Ywe._registerNode)(Ep);Kwe.Factory.addGetterSetter(Ep,"radius",0,(0,Xwe.getNumberValidator)());var px={};Object.defineProperty(px,"__esModule",{value:!0});px.Ellipse=void 0;const xA=At,Zwe=Yr,AG=Xe,Jwe=Rt;class wc extends Zwe.Shape{_sceneFunc(t){var n=this.radiusX(),r=this.radiusY();t.beginPath(),t.save(),n!==r&&t.scale(1,r/n),t.arc(0,0,n,0,Math.PI*2,!1),t.restore(),t.closePath(),t.fillStrokeShape(this)}getWidth(){return this.radiusX()*2}getHeight(){return this.radiusY()*2}setWidth(t){this.radiusX(t/2)}setHeight(t){this.radiusY(t/2)}}px.Ellipse=wc;wc.prototype.className="Ellipse";wc.prototype._centroid=!0;wc.prototype._attrsAffectingSize=["radiusX","radiusY"];(0,Jwe._registerNode)(wc);xA.Factory.addComponentsGetterSetter(wc,"radius",["x","y"]);xA.Factory.addGetterSetter(wc,"radiusX",0,(0,AG.getNumberValidator)());xA.Factory.addGetterSetter(wc,"radiusY",0,(0,AG.getNumberValidator)());var gx={};Object.defineProperty(gx,"__esModule",{value:!0});gx.Image=void 0;const XC=dr,Wd=At,eCe=Yr,tCe=Rt,ky=Xe;let rl=class PG extends eCe.Shape{constructor(t){super(t),this.on("imageChange.konva",()=>{this._setImageLoad()}),this._setImageLoad()}_setImageLoad(){const t=this.image();t&&t.complete||t&&t.readyState===4||t&&t.addEventListener&&t.addEventListener("load",()=>{this._requestDraw()})}_useBufferCanvas(){return super._useBufferCanvas(!0)}_sceneFunc(t){const n=this.getWidth(),r=this.getHeight(),i=this.cornerRadius(),o=this.attrs.image;let a;if(o){const s=this.attrs.cropWidth,l=this.attrs.cropHeight;s&&l?a=[o,this.cropX(),this.cropY(),s,l,0,0,n,r]:a=[o,0,0,n,r]}(this.hasFill()||this.hasStroke()||i)&&(t.beginPath(),i?XC.Util.drawRoundedRectPath(t,n,r,i):t.rect(0,0,n,r),t.closePath(),t.fillStrokeShape(this)),o&&(i&&t.clip(),t.drawImage.apply(t,a))}_hitFunc(t){var n=this.width(),r=this.height(),i=this.cornerRadius();t.beginPath(),i?XC.Util.drawRoundedRectPath(t,n,r,i):t.rect(0,0,n,r),t.closePath(),t.fillStrokeShape(this)}getWidth(){var t,n;return(t=this.attrs.width)!==null&&t!==void 0?t:(n=this.image())===null||n===void 0?void 0:n.width}getHeight(){var t,n;return(t=this.attrs.height)!==null&&t!==void 0?t:(n=this.image())===null||n===void 0?void 0:n.height}static fromURL(t,n,r=null){var i=XC.Util.createImageElement();i.onload=function(){var o=new PG({image:i});n(o)},i.onerror=r,i.crossOrigin="Anonymous",i.src=t}};gx.Image=rl;rl.prototype.className="Image";(0,tCe._registerNode)(rl);Wd.Factory.addGetterSetter(rl,"cornerRadius",0,(0,ky.getNumberOrArrayOfNumbersValidator)(4));Wd.Factory.addGetterSetter(rl,"image");Wd.Factory.addComponentsGetterSetter(rl,"crop",["x","y","width","height"]);Wd.Factory.addGetterSetter(rl,"cropX",0,(0,ky.getNumberValidator)());Wd.Factory.addGetterSetter(rl,"cropY",0,(0,ky.getNumberValidator)());Wd.Factory.addGetterSetter(rl,"cropWidth",0,(0,ky.getNumberValidator)());Wd.Factory.addGetterSetter(rl,"cropHeight",0,(0,ky.getNumberValidator)());var rp={};Object.defineProperty(rp,"__esModule",{value:!0});rp.Tag=rp.Label=void 0;const mx=At,nCe=Yr,rCe=xp,wA=Xe,IG=Rt;var RG=["fontFamily","fontSize","fontStyle","padding","lineHeight","text","width","height","pointerDirection","pointerWidth","pointerHeight"],iCe="Change.konva",oCe="none",KE="up",QE="right",XE="down",YE="left",aCe=RG.length;class CA extends rCe.Group{constructor(t){super(t),this.on("add.konva",function(n){this._addListeners(n.child),this._sync()})}getText(){return this.find("Text")[0]}getTag(){return this.find("Tag")[0]}_addListeners(t){var n=this,r,i=function(){n._sync()};for(r=0;r{n=Math.min(n,a.x),r=Math.max(r,a.x),i=Math.min(i,a.y),o=Math.max(o,a.y)}),{x:n,y:i,width:r-n,height:o-i}}getWidth(){return this.radius()*2}getHeight(){return this.radius()*2}setWidth(t){this.radius(t/2)}setHeight(t){this.radius(t/2)}}vx.RegularPolygon=Qd;Qd.prototype.className="RegularPolygon";Qd.prototype._centroid=!0;Qd.prototype._attrsAffectingSize=["radius"];(0,hCe._registerNode)(Qd);OG.Factory.addGetterSetter(Qd,"radius",0,(0,MG.getNumberValidator)());OG.Factory.addGetterSetter(Qd,"sides",0,(0,MG.getNumberValidator)());var bx={};Object.defineProperty(bx,"__esModule",{value:!0});bx.Ring=void 0;const NG=At,pCe=Yr,$G=Xe,gCe=Rt;var pO=Math.PI*2;class Xd extends pCe.Shape{_sceneFunc(t){t.beginPath(),t.arc(0,0,this.innerRadius(),0,pO,!1),t.moveTo(this.outerRadius(),0),t.arc(0,0,this.outerRadius(),pO,0,!0),t.closePath(),t.fillStrokeShape(this)}getWidth(){return this.outerRadius()*2}getHeight(){return this.outerRadius()*2}setWidth(t){this.outerRadius(t/2)}setHeight(t){this.outerRadius(t/2)}}bx.Ring=Xd;Xd.prototype.className="Ring";Xd.prototype._centroid=!0;Xd.prototype._attrsAffectingSize=["innerRadius","outerRadius"];(0,gCe._registerNode)(Xd);NG.Factory.addGetterSetter(Xd,"innerRadius",0,(0,$G.getNumberValidator)());NG.Factory.addGetterSetter(Xd,"outerRadius",0,(0,$G.getNumberValidator)());var _x={};Object.defineProperty(_x,"__esModule",{value:!0});_x.Sprite=void 0;const Yd=At,mCe=Yr,yCe=wp,DG=Xe,vCe=Rt;class il extends mCe.Shape{constructor(t){super(t),this._updated=!0,this.anim=new yCe.Animation(()=>{var n=this._updated;return this._updated=!1,n}),this.on("animationChange.konva",function(){this.frameIndex(0)}),this.on("frameIndexChange.konva",function(){this._updated=!0}),this.on("frameRateChange.konva",function(){this.anim.isRunning()&&(clearInterval(this.interval),this._setInterval())})}_sceneFunc(t){var n=this.animation(),r=this.frameIndex(),i=r*4,o=this.animations()[n],a=this.frameOffsets(),s=o[i+0],l=o[i+1],u=o[i+2],c=o[i+3],d=this.image();if((this.hasFill()||this.hasStroke())&&(t.beginPath(),t.rect(0,0,u,c),t.closePath(),t.fillStrokeShape(this)),d)if(a){var f=a[n],h=r*2;t.drawImage(d,s,l,u,c,f[h+0],f[h+1],u,c)}else t.drawImage(d,s,l,u,c,0,0,u,c)}_hitFunc(t){var n=this.animation(),r=this.frameIndex(),i=r*4,o=this.animations()[n],a=this.frameOffsets(),s=o[i+2],l=o[i+3];if(t.beginPath(),a){var u=a[n],c=r*2;t.rect(u[c+0],u[c+1],s,l)}else t.rect(0,0,s,l);t.closePath(),t.fillShape(this)}_useBufferCanvas(){return super._useBufferCanvas(!0)}_setInterval(){var t=this;this.interval=setInterval(function(){t._updateIndex()},1e3/this.frameRate())}start(){if(!this.isRunning()){var t=this.getLayer();this.anim.setLayers(t),this._setInterval(),this.anim.start()}}stop(){this.anim.stop(),clearInterval(this.interval)}isRunning(){return this.anim.isRunning()}_updateIndex(){var t=this.frameIndex(),n=this.animation(),r=this.animations(),i=r[n],o=i.length/4;t{t=t.trim();const n=t.indexOf(" ")>=0,r=t.indexOf('"')>=0||t.indexOf("'")>=0;return n&&!r&&(t=`"${t}"`),t}).join(", ")}var Uv;function ZC(){return Uv||(Uv=ZE.Util.createCanvasElement().getContext(ECe),Uv)}function DCe(e){e.fillText(this._partialText,this._partialTextX,this._partialTextY)}function LCe(e){e.setAttr("miterLimit",2),e.strokeText(this._partialText,this._partialTextX,this._partialTextY)}function FCe(e){return e=e||{},!e.fillLinearGradientColorStops&&!e.fillRadialGradientColorStops&&!e.fillPatternImage&&(e.fill=e.fill||"black"),e}let Tr=class extends SCe.Shape{constructor(t){super(FCe(t)),this._partialTextX=0,this._partialTextY=0;for(var n=0;n1&&(b+=a)}}}_hitFunc(t){var n=this.getWidth(),r=this.getHeight();t.beginPath(),t.rect(0,0,n,r),t.closePath(),t.fillStrokeShape(this)}setText(t){var n=ZE.Util._isString(t)?t:t==null?"":t+"";return this._setAttr(kCe,n),this}getWidth(){var t=this.attrs.width===vf||this.attrs.width===void 0;return t?this.getTextWidth()+this.padding()*2:this.attrs.width}getHeight(){var t=this.attrs.height===vf||this.attrs.height===void 0;return t?this.fontSize()*this.textArr.length*this.lineHeight()+this.padding()*2:this.attrs.height}getTextWidth(){return this.textWidth}getTextHeight(){return ZE.Util.warn("text.getTextHeight() method is deprecated. Use text.height() - for full height and text.fontSize() - for one line height."),this.textHeight}measureSize(t){var n=ZC(),r=this.fontSize(),i;return n.save(),n.font=this._getContextFont(),i=n.measureText(t),n.restore(),{width:i.width,height:r}}_getContextFont(){return this.fontStyle()+jv+this.fontVariant()+jv+(this.fontSize()+ICe)+$Ce(this.fontFamily())}_addTextLine(t){this.align()===eg&&(t=t.trim());var r=this._getTextWidth(t);return this.textArr.push({text:t,width:r,lastInParagraph:!1})}_getTextWidth(t){var n=this.letterSpacing(),r=t.length;return ZC().measureText(t).width+(r?n*(r-1):0)}_setTextData(){var t=this.text().split(` -`),n=+this.fontSize(),r=0,i=this.lineHeight()*n,o=this.attrs.width,a=this.attrs.height,s=o!==vf&&o!==void 0,l=a!==vf&&a!==void 0,u=this.padding(),c=o-u*2,d=a-u*2,f=0,h=this.wrap(),p=h!==yO,m=h!==MCe&&p,_=this.ellipsis();this.textArr=[],ZC().font=this._getContextFont();for(var b=_?this._getTextWidth(YC):0,v=0,g=t.length;vc)for(;y.length>0;){for(var w=0,x=y.length,C="",T=0;w>>1,P=y.slice(0,k+1),$=this._getTextWidth(P)+b;$<=c?(w=k+1,C=P,T=$):x=k}if(C){if(m){var O,E=y[C.length],A=E===jv||E===gO;A&&T<=c?O=C.length:O=Math.max(C.lastIndexOf(jv),C.lastIndexOf(gO))+1,O>0&&(w=O,C=C.slice(0,w),T=this._getTextWidth(C))}C=C.trimRight(),this._addTextLine(C),r=Math.max(r,T),f+=i;var D=this._shouldHandleEllipsis(f);if(D){this._tryToAddEllipsisToLastLine();break}if(y=y.slice(w),y=y.trimLeft(),y.length>0&&(S=this._getTextWidth(y),S<=c)){this._addTextLine(y),f+=i,r=Math.max(r,S);break}}else break}else this._addTextLine(y),f+=i,r=Math.max(r,S),this._shouldHandleEllipsis(f)&&vd)break}this.textHeight=n,this.textWidth=r}_shouldHandleEllipsis(t){var n=+this.fontSize(),r=this.lineHeight()*n,i=this.attrs.height,o=i!==vf&&i!==void 0,a=this.padding(),s=i-a*2,l=this.wrap(),u=l!==yO;return!u||o&&t+r>s}_tryToAddEllipsisToLastLine(){var t=this.attrs.width,n=t!==vf&&t!==void 0,r=this.padding(),i=t-r*2,o=this.ellipsis(),a=this.textArr[this.textArr.length-1];if(!(!a||!o)){if(n){var s=this._getTextWidth(a.text+YC)n?null:tg.Path.getPointAtLengthOfDataArray(t,this.dataArray)}_readDataAttribute(){this.dataArray=tg.Path.parsePathData(this.attrs.data),this.pathLength=this._getTextPathLength()}_sceneFunc(t){t.setAttr("font",this._getContextFont()),t.setAttr("textBaseline",this.textBaseline()),t.setAttr("textAlign","left"),t.save();var n=this.textDecoration(),r=this.fill(),i=this.fontSize(),o=this.glyphInfo;n==="underline"&&t.beginPath();for(var a=0;a=1){var r=n[0].p0;t.moveTo(r.x,r.y)}for(var i=0;ie+`.${HG}`).join(" "),_O="nodesRect",qCe=["widthChange","heightChange","scaleXChange","scaleYChange","skewXChange","skewYChange","rotationChange","offsetXChange","offsetYChange","transformsEnabledChange","strokeWidthChange"],WCe={"top-left":-45,"top-center":0,"top-right":45,"middle-right":-90,"middle-left":90,"bottom-left":-135,"bottom-center":180,"bottom-right":135};const KCe="ontouchstart"in za.Konva._global;function QCe(e,t){if(e==="rotater")return"crosshair";t+=Cn.Util.degToRad(WCe[e]||0);var n=(Cn.Util.radToDeg(t)%360+360)%360;return Cn.Util._inRange(n,315+22.5,360)||Cn.Util._inRange(n,0,22.5)?"ns-resize":Cn.Util._inRange(n,45-22.5,45+22.5)?"nesw-resize":Cn.Util._inRange(n,90-22.5,90+22.5)?"ew-resize":Cn.Util._inRange(n,135-22.5,135+22.5)?"nwse-resize":Cn.Util._inRange(n,180-22.5,180+22.5)?"ns-resize":Cn.Util._inRange(n,225-22.5,225+22.5)?"nesw-resize":Cn.Util._inRange(n,270-22.5,270+22.5)?"ew-resize":Cn.Util._inRange(n,315-22.5,315+22.5)?"nwse-resize":(Cn.Util.error("Transformer has unknown angle for cursor detection: "+n),"pointer")}var L_=["top-left","top-center","top-right","middle-right","middle-left","bottom-left","bottom-center","bottom-right"],SO=1e8;function XCe(e){return{x:e.x+e.width/2*Math.cos(e.rotation)+e.height/2*Math.sin(-e.rotation),y:e.y+e.height/2*Math.cos(e.rotation)+e.width/2*Math.sin(e.rotation)}}function qG(e,t,n){const r=n.x+(e.x-n.x)*Math.cos(t)-(e.y-n.y)*Math.sin(t),i=n.y+(e.x-n.x)*Math.sin(t)+(e.y-n.y)*Math.cos(t);return Object.assign(Object.assign({},e),{rotation:e.rotation+t,x:r,y:i})}function YCe(e,t){const n=XCe(e);return qG(e,t,n)}function ZCe(e,t,n){let r=t;for(let i=0;ii.isAncestorOf(this)?(Cn.Util.error("Konva.Transformer cannot be an a child of the node you are trying to attach"),!1):!0);this._nodes=t=n,t.length===1&&this.useSingleNodeRotation()?this.rotation(t[0].getAbsoluteRotation()):this.rotation(0),this._nodes.forEach(i=>{const o=()=>{this.nodes().length===1&&this.useSingleNodeRotation()&&this.rotation(this.nodes()[0].getAbsoluteRotation()),this._resetTransformCache(),!this._transforming&&!this.isDragging()&&this.update()},a=i._attrsAffectingSize.map(s=>s+"Change."+this._getEventNamespace()).join(" ");i.on(a,o),i.on(qCe.map(s=>s+`.${this._getEventNamespace()}`).join(" "),o),i.on(`absoluteTransformChange.${this._getEventNamespace()}`,o),this._proxyDrag(i)}),this._resetTransformCache();var r=!!this.findOne(".top-left");return r&&this.update(),this}_proxyDrag(t){let n;t.on(`dragstart.${this._getEventNamespace()}`,r=>{n=t.getAbsolutePosition(),!this.isDragging()&&t!==this.findOne(".back")&&this.startDrag(r,!1)}),t.on(`dragmove.${this._getEventNamespace()}`,r=>{if(!n)return;const i=t.getAbsolutePosition(),o=i.x-n.x,a=i.y-n.y;this.nodes().forEach(s=>{if(s===t||s.isDragging())return;const l=s.getAbsolutePosition();s.setAbsolutePosition({x:l.x+o,y:l.y+a}),s.startDrag(r)}),n=null})}getNodes(){return this._nodes||[]}getActiveAnchor(){return this._movingAnchorName}detach(){this._nodes&&this._nodes.forEach(t=>{t.off("."+this._getEventNamespace())}),this._nodes=[],this._resetTransformCache()}_resetTransformCache(){this._clearCache(_O),this._clearCache("transform"),this._clearSelfAndDescendantCache("absoluteTransform")}_getNodeRect(){return this._getCache(_O,this.__getNodeRect)}__getNodeShape(t,n=this.rotation(),r){var i=t.getClientRect({skipTransform:!0,skipShadow:!0,skipStroke:this.ignoreStroke()}),o=t.getAbsoluteScale(r),a=t.getAbsolutePosition(r),s=i.x*o.x-t.offsetX()*o.x,l=i.y*o.y-t.offsetY()*o.y;const u=(za.Konva.getAngle(t.getAbsoluteRotation())+Math.PI*2)%(Math.PI*2),c={x:a.x+s*Math.cos(u)+l*Math.sin(-u),y:a.y+l*Math.cos(u)+s*Math.sin(u),width:i.width*o.x,height:i.height*o.y,rotation:u};return qG(c,-za.Konva.getAngle(n),{x:0,y:0})}__getNodeRect(){var t=this.getNode();if(!t)return{x:-SO,y:-SO,width:0,height:0,rotation:0};const n=[];this.nodes().map(u=>{const c=u.getClientRect({skipTransform:!0,skipShadow:!0,skipStroke:this.ignoreStroke()});var d=[{x:c.x,y:c.y},{x:c.x+c.width,y:c.y},{x:c.x+c.width,y:c.y+c.height},{x:c.x,y:c.y+c.height}],f=u.getAbsoluteTransform();d.forEach(function(h){var p=f.point(h);n.push(p)})});const r=new Cn.Transform;r.rotate(-za.Konva.getAngle(this.rotation()));var i,o,a,s;n.forEach(function(u){var c=r.point(u);i===void 0&&(i=a=c.x,o=s=c.y),i=Math.min(i,c.x),o=Math.min(o,c.y),a=Math.max(a,c.x),s=Math.max(s,c.y)}),r.invert();const l=r.point({x:i,y:o});return{x:l.x,y:l.y,width:a-i,height:s-o,rotation:za.Konva.getAngle(this.rotation())}}getX(){return this._getNodeRect().x}getY(){return this._getNodeRect().y}getWidth(){return this._getNodeRect().width}getHeight(){return this._getNodeRect().height}_createElements(){this._createBack(),L_.forEach((function(t){this._createAnchor(t)}).bind(this)),this._createAnchor("rotater")}_createAnchor(t){var n=new VCe.Rect({stroke:"rgb(0, 161, 255)",fill:"white",strokeWidth:1,name:t+" _anchor",dragDistance:0,draggable:!0,hitStrokeWidth:KCe?10:"auto"}),r=this;n.on("mousedown touchstart",function(i){r._handleMouseDown(i)}),n.on("dragstart",i=>{n.stopDrag(),i.cancelBubble=!0}),n.on("dragend",i=>{i.cancelBubble=!0}),n.on("mouseenter",()=>{var i=za.Konva.getAngle(this.rotation()),o=QCe(t,i);n.getStage().content&&(n.getStage().content.style.cursor=o),this._cursorChange=!0}),n.on("mouseout",()=>{n.getStage().content&&(n.getStage().content.style.cursor=""),this._cursorChange=!1}),this.add(n)}_createBack(){var t=new UCe.Shape({name:"back",width:0,height:0,draggable:!0,sceneFunc(n){var r=this.getParent(),i=r.padding();n.beginPath(),n.rect(-i,-i,this.width()+i*2,this.height()+i*2),n.moveTo(this.width()/2,-i),r.rotateEnabled()&&n.lineTo(this.width()/2,-r.rotateAnchorOffset()*Cn.Util._sign(this.height())-i),n.fillStrokeShape(this)},hitFunc:(n,r)=>{if(this.shouldOverdrawWholeArea()){var i=this.padding();n.beginPath(),n.rect(-i,-i,r.width()+i*2,r.height()+i*2),n.fillStrokeShape(r)}}});this.add(t),this._proxyDrag(t),t.on("dragstart",n=>{n.cancelBubble=!0}),t.on("dragmove",n=>{n.cancelBubble=!0}),t.on("dragend",n=>{n.cancelBubble=!0}),this.on("dragmove",n=>{this.update()})}_handleMouseDown(t){this._movingAnchorName=t.target.name().split(" ")[0];var n=this._getNodeRect(),r=n.width,i=n.height,o=Math.sqrt(Math.pow(r,2)+Math.pow(i,2));this.sin=Math.abs(i/o),this.cos=Math.abs(r/o),typeof window<"u"&&(window.addEventListener("mousemove",this._handleMouseMove),window.addEventListener("touchmove",this._handleMouseMove),window.addEventListener("mouseup",this._handleMouseUp,!0),window.addEventListener("touchend",this._handleMouseUp,!0)),this._transforming=!0;var a=t.target.getAbsolutePosition(),s=t.target.getStage().getPointerPosition();this._anchorDragOffset={x:s.x-a.x,y:s.y-a.y},this._fire("transformstart",{evt:t.evt,target:this.getNode()}),this._nodes.forEach(l=>{l._fire("transformstart",{evt:t.evt,target:l})})}_handleMouseMove(t){var n,r,i,o=this.findOne("."+this._movingAnchorName),a=o.getStage();a.setPointersPositions(t);const s=a.getPointerPosition();let l={x:s.x-this._anchorDragOffset.x,y:s.y-this._anchorDragOffset.y};const u=o.getAbsolutePosition();this.anchorDragBoundFunc()&&(l=this.anchorDragBoundFunc()(u,l,t)),o.setAbsolutePosition(l);const c=o.getAbsolutePosition();if(!(u.x===c.x&&u.y===c.y)){if(this._movingAnchorName==="rotater"){var d=this._getNodeRect();n=o.x()-d.width/2,r=-o.y()+d.height/2;let O=Math.atan2(-r,n)+Math.PI/2;d.height<0&&(O-=Math.PI);var f=za.Konva.getAngle(this.rotation());const E=f+O,A=za.Konva.getAngle(this.rotationSnapTolerance()),L=ZCe(this.rotationSnaps(),E,A)-d.rotation,M=YCe(d,L);this._fitNodesInto(M,t);return}var h=this.shiftBehavior(),p;h==="inverted"?p=this.keepRatio()&&!t.shiftKey:h==="none"?p=this.keepRatio():p=this.keepRatio()||t.shiftKey;var g=this.centeredScaling()||t.altKey;if(this._movingAnchorName==="top-left"){if(p){var m=g?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".bottom-right").x(),y:this.findOne(".bottom-right").y()};i=Math.sqrt(Math.pow(m.x-o.x(),2)+Math.pow(m.y-o.y(),2));var _=this.findOne(".top-left").x()>m.x?-1:1,b=this.findOne(".top-left").y()>m.y?-1:1;n=i*this.cos*_,r=i*this.sin*b,this.findOne(".top-left").x(m.x-n),this.findOne(".top-left").y(m.y-r)}}else if(this._movingAnchorName==="top-center")this.findOne(".top-left").y(o.y());else if(this._movingAnchorName==="top-right"){if(p){var m=g?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".bottom-left").x(),y:this.findOne(".bottom-left").y()};i=Math.sqrt(Math.pow(o.x()-m.x,2)+Math.pow(m.y-o.y(),2));var _=this.findOne(".top-right").x()m.y?-1:1;n=i*this.cos*_,r=i*this.sin*b,this.findOne(".top-right").x(m.x+n),this.findOne(".top-right").y(m.y-r)}var v=o.position();this.findOne(".top-left").y(v.y),this.findOne(".bottom-right").x(v.x)}else if(this._movingAnchorName==="middle-left")this.findOne(".top-left").x(o.x());else if(this._movingAnchorName==="middle-right")this.findOne(".bottom-right").x(o.x());else if(this._movingAnchorName==="bottom-left"){if(p){var m=g?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".top-right").x(),y:this.findOne(".top-right").y()};i=Math.sqrt(Math.pow(m.x-o.x(),2)+Math.pow(o.y()-m.y,2));var _=m.x{r._fire("transformend",{evt:t,target:r})}),this._movingAnchorName=null}}_fitNodesInto(t,n){var r=this._getNodeRect();const i=1;if(Cn.Util._inRange(t.width,-this.padding()*2-i,i)){this.update();return}if(Cn.Util._inRange(t.height,-this.padding()*2-i,i)){this.update();return}const o=this.flipEnabled();var a=new Cn.Transform;if(a.rotate(za.Konva.getAngle(this.rotation())),this._movingAnchorName&&t.width<0&&this._movingAnchorName.indexOf("left")>=0){const d=a.point({x:-this.padding()*2,y:0});if(t.x+=d.x,t.y+=d.y,t.width+=this.padding()*2,this._movingAnchorName=this._movingAnchorName.replace("left","right"),this._anchorDragOffset.x-=d.x,this._anchorDragOffset.y-=d.y,!o){this.update();return}}else if(this._movingAnchorName&&t.width<0&&this._movingAnchorName.indexOf("right")>=0){const d=a.point({x:this.padding()*2,y:0});if(this._movingAnchorName=this._movingAnchorName.replace("right","left"),this._anchorDragOffset.x-=d.x,this._anchorDragOffset.y-=d.y,t.width+=this.padding()*2,!o){this.update();return}}if(this._movingAnchorName&&t.height<0&&this._movingAnchorName.indexOf("top")>=0){const d=a.point({x:0,y:-this.padding()*2});if(t.x+=d.x,t.y+=d.y,this._movingAnchorName=this._movingAnchorName.replace("top","bottom"),this._anchorDragOffset.x-=d.x,this._anchorDragOffset.y-=d.y,t.height+=this.padding()*2,!o){this.update();return}}else if(this._movingAnchorName&&t.height<0&&this._movingAnchorName.indexOf("bottom")>=0){const d=a.point({x:0,y:this.padding()*2});if(this._movingAnchorName=this._movingAnchorName.replace("bottom","top"),this._anchorDragOffset.x-=d.x,this._anchorDragOffset.y-=d.y,t.height+=this.padding()*2,!o){this.update();return}}if(this.boundBoxFunc()){const d=this.boundBoxFunc()(r,t);d?t=d:Cn.Util.warn("boundBoxFunc returned falsy. You should return new bound rect from it!")}const s=1e7,l=new Cn.Transform;l.translate(r.x,r.y),l.rotate(r.rotation),l.scale(r.width/s,r.height/s);const u=new Cn.Transform;u.translate(t.x,t.y),u.rotate(t.rotation),u.scale(t.width/s,t.height/s);const c=u.multiply(l.invert());this._nodes.forEach(d=>{var f;const h=d.getParent().getAbsoluteTransform(),p=d.getTransform().copy();p.translate(d.offsetX(),d.offsetY());const m=new Cn.Transform;m.multiply(h.copy().invert()).multiply(c).multiply(h).multiply(p);const _=m.decompose();d.setAttrs(_),this._fire("transform",{evt:n,target:d}),d._fire("transform",{evt:n,target:d}),(f=d.getLayer())===null||f===void 0||f.batchDraw()}),this.rotation(Cn.Util._getRotation(t.rotation)),this._resetTransformCache(),this.update(),this.getLayer().batchDraw()}forceUpdate(){this._resetTransformCache(),this.update()}_batchChangeChild(t,n){this.findOne(t).setAttrs(n)}update(){var t,n=this._getNodeRect();this.rotation(Cn.Util._getRotation(n.rotation));var r=n.width,i=n.height,o=this.enabledAnchors(),a=this.resizeEnabled(),s=this.padding(),l=this.anchorSize();const u=this.find("._anchor");u.forEach(d=>{d.setAttrs({width:l,height:l,offsetX:l/2,offsetY:l/2,stroke:this.anchorStroke(),strokeWidth:this.anchorStrokeWidth(),fill:this.anchorFill(),cornerRadius:this.anchorCornerRadius()})}),this._batchChangeChild(".top-left",{x:0,y:0,offsetX:l/2+s,offsetY:l/2+s,visible:a&&o.indexOf("top-left")>=0}),this._batchChangeChild(".top-center",{x:r/2,y:0,offsetY:l/2+s,visible:a&&o.indexOf("top-center")>=0}),this._batchChangeChild(".top-right",{x:r,y:0,offsetX:l/2-s,offsetY:l/2+s,visible:a&&o.indexOf("top-right")>=0}),this._batchChangeChild(".middle-left",{x:0,y:i/2,offsetX:l/2+s,visible:a&&o.indexOf("middle-left")>=0}),this._batchChangeChild(".middle-right",{x:r,y:i/2,offsetX:l/2-s,visible:a&&o.indexOf("middle-right")>=0}),this._batchChangeChild(".bottom-left",{x:0,y:i,offsetX:l/2+s,offsetY:l/2-s,visible:a&&o.indexOf("bottom-left")>=0}),this._batchChangeChild(".bottom-center",{x:r/2,y:i,offsetY:l/2-s,visible:a&&o.indexOf("bottom-center")>=0}),this._batchChangeChild(".bottom-right",{x:r,y:i,offsetX:l/2-s,offsetY:l/2-s,visible:a&&o.indexOf("bottom-right")>=0}),this._batchChangeChild(".rotater",{x:r/2,y:-this.rotateAnchorOffset()*Cn.Util._sign(i)-s,visible:this.rotateEnabled()}),this._batchChangeChild(".back",{width:r,height:i,visible:this.borderEnabled(),stroke:this.borderStroke(),strokeWidth:this.borderStrokeWidth(),dash:this.borderDash(),x:0,y:0});const c=this.anchorStyleFunc();c&&u.forEach(d=>{c(d)}),(t=this.getLayer())===null||t===void 0||t.batchDraw()}isTransforming(){return this._transforming}stopTransform(){if(this._transforming){this._removeEvents();var t=this.findOne("."+this._movingAnchorName);t&&t.stopDrag()}}destroy(){return this.getStage()&&this._cursorChange&&this.getStage().content&&(this.getStage().content.style.cursor=""),bO.Group.prototype.destroy.call(this),this.detach(),this._removeEvents(),this}toObject(){return vO.Node.prototype.toObject.call(this)}clone(t){var n=vO.Node.prototype.clone.call(this,t);return n}getClientRect(){return this.nodes().length>0?super.getClientRect():{x:0,y:0,width:0,height:0}}}wx.Transformer=Zt;function JCe(e){return e instanceof Array||Cn.Util.warn("enabledAnchors value should be an array"),e instanceof Array&&e.forEach(function(t){L_.indexOf(t)===-1&&Cn.Util.warn("Unknown anchor name: "+t+". Available names are: "+L_.join(", "))}),e||[]}Zt.prototype.className="Transformer";(0,GCe._registerNode)(Zt);vn.Factory.addGetterSetter(Zt,"enabledAnchors",L_,JCe);vn.Factory.addGetterSetter(Zt,"flipEnabled",!0,(0,kc.getBooleanValidator)());vn.Factory.addGetterSetter(Zt,"resizeEnabled",!0);vn.Factory.addGetterSetter(Zt,"anchorSize",10,(0,kc.getNumberValidator)());vn.Factory.addGetterSetter(Zt,"rotateEnabled",!0);vn.Factory.addGetterSetter(Zt,"rotationSnaps",[]);vn.Factory.addGetterSetter(Zt,"rotateAnchorOffset",50,(0,kc.getNumberValidator)());vn.Factory.addGetterSetter(Zt,"rotationSnapTolerance",5,(0,kc.getNumberValidator)());vn.Factory.addGetterSetter(Zt,"borderEnabled",!0);vn.Factory.addGetterSetter(Zt,"anchorStroke","rgb(0, 161, 255)");vn.Factory.addGetterSetter(Zt,"anchorStrokeWidth",1,(0,kc.getNumberValidator)());vn.Factory.addGetterSetter(Zt,"anchorFill","white");vn.Factory.addGetterSetter(Zt,"anchorCornerRadius",0,(0,kc.getNumberValidator)());vn.Factory.addGetterSetter(Zt,"borderStroke","rgb(0, 161, 255)");vn.Factory.addGetterSetter(Zt,"borderStrokeWidth",1,(0,kc.getNumberValidator)());vn.Factory.addGetterSetter(Zt,"borderDash");vn.Factory.addGetterSetter(Zt,"keepRatio",!0);vn.Factory.addGetterSetter(Zt,"shiftBehavior","default");vn.Factory.addGetterSetter(Zt,"centeredScaling",!1);vn.Factory.addGetterSetter(Zt,"ignoreStroke",!1);vn.Factory.addGetterSetter(Zt,"padding",0,(0,kc.getNumberValidator)());vn.Factory.addGetterSetter(Zt,"node");vn.Factory.addGetterSetter(Zt,"nodes");vn.Factory.addGetterSetter(Zt,"boundBoxFunc");vn.Factory.addGetterSetter(Zt,"anchorDragBoundFunc");vn.Factory.addGetterSetter(Zt,"anchorStyleFunc");vn.Factory.addGetterSetter(Zt,"shouldOverdrawWholeArea",!1);vn.Factory.addGetterSetter(Zt,"useSingleNodeRotation",!0);vn.Factory.backCompat(Zt,{lineEnabled:"borderEnabled",rotateHandlerOffset:"rotateAnchorOffset",enabledHandlers:"enabledAnchors"});var Cx={};Object.defineProperty(Cx,"__esModule",{value:!0});Cx.Wedge=void 0;const Ex=At,e5e=Yr,t5e=Rt,WG=Xe,n5e=Rt;class nu extends e5e.Shape{_sceneFunc(t){t.beginPath(),t.arc(0,0,this.radius(),0,t5e.Konva.getAngle(this.angle()),this.clockwise()),t.lineTo(0,0),t.closePath(),t.fillStrokeShape(this)}getWidth(){return this.radius()*2}getHeight(){return this.radius()*2}setWidth(t){this.radius(t/2)}setHeight(t){this.radius(t/2)}}Cx.Wedge=nu;nu.prototype.className="Wedge";nu.prototype._centroid=!0;nu.prototype._attrsAffectingSize=["radius"];(0,n5e._registerNode)(nu);Ex.Factory.addGetterSetter(nu,"radius",0,(0,WG.getNumberValidator)());Ex.Factory.addGetterSetter(nu,"angle",0,(0,WG.getNumberValidator)());Ex.Factory.addGetterSetter(nu,"clockwise",!1);Ex.Factory.backCompat(nu,{angleDeg:"angle",getAngleDeg:"getAngle",setAngleDeg:"setAngle"});var kx={};Object.defineProperty(kx,"__esModule",{value:!0});kx.Blur=void 0;const xO=At,r5e=rr,i5e=Xe;function wO(){this.r=0,this.g=0,this.b=0,this.a=0,this.next=null}var o5e=[512,512,456,512,328,456,335,512,405,328,271,456,388,335,292,512,454,405,364,328,298,271,496,456,420,388,360,335,312,292,273,512,482,454,428,405,383,364,345,328,312,298,284,271,259,496,475,456,437,420,404,388,374,360,347,335,323,312,302,292,282,273,265,512,497,482,468,454,441,428,417,405,394,383,373,364,354,345,337,328,320,312,305,298,291,284,278,271,265,259,507,496,485,475,465,456,446,437,428,420,412,404,396,388,381,374,367,360,354,347,341,335,329,323,318,312,307,302,297,292,287,282,278,273,269,265,261,512,505,497,489,482,475,468,461,454,447,441,435,428,422,417,411,405,399,394,389,383,378,373,368,364,359,354,350,345,341,337,332,328,324,320,316,312,309,305,301,298,294,291,287,284,281,278,274,271,268,265,262,259,257,507,501,496,491,485,480,475,470,465,460,456,451,446,442,437,433,428,424,420,416,412,408,404,400,396,392,388,385,381,377,374,370,367,363,360,357,354,350,347,344,341,338,335,332,329,326,323,320,318,315,312,310,307,304,302,299,297,294,292,289,287,285,282,280,278,275,273,271,269,267,265,263,261,259],a5e=[9,11,12,13,13,14,14,15,15,15,15,16,16,16,16,17,17,17,17,17,17,17,18,18,18,18,18,18,18,18,18,19,19,19,19,19,19,19,19,19,19,19,19,19,19,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24];function s5e(e,t){var n=e.data,r=e.width,i=e.height,o,a,s,l,u,c,d,f,h,p,m,_,b,v,g,y,S,w,x,C,T,k,P,$,O=t+t+1,E=r-1,A=i-1,D=t+1,L=D*(D+1)/2,M=new wO,R=null,N=M,B=null,U=null,G=o5e[t],Y=a5e[t];for(s=1;s>Y,P!==0?(P=255/P,n[c]=(f*G>>Y)*P,n[c+1]=(h*G>>Y)*P,n[c+2]=(p*G>>Y)*P):n[c]=n[c+1]=n[c+2]=0,f-=_,h-=b,p-=v,m-=g,_-=B.r,b-=B.g,v-=B.b,g-=B.a,l=d+((l=o+t+1)>Y,P>0?(P=255/P,n[l]=(f*G>>Y)*P,n[l+1]=(h*G>>Y)*P,n[l+2]=(p*G>>Y)*P):n[l]=n[l+1]=n[l+2]=0,f-=_,h-=b,p-=v,m-=g,_-=B.r,b-=B.g,v-=B.b,g-=B.a,l=o+((l=a+D)0&&s5e(t,n)};kx.Blur=l5e;xO.Factory.addGetterSetter(r5e.Node,"blurRadius",0,(0,i5e.getNumberValidator)(),xO.Factory.afterSetFilter);var Tx={};Object.defineProperty(Tx,"__esModule",{value:!0});Tx.Brighten=void 0;const CO=At,u5e=rr,c5e=Xe,d5e=function(e){var t=this.brightness()*255,n=e.data,r=n.length,i;for(i=0;i255?255:i,o=o<0?0:o>255?255:o,a=a<0?0:a>255?255:a,n[s]=i,n[s+1]=o,n[s+2]=a};Ax.Contrast=p5e;EO.Factory.addGetterSetter(f5e.Node,"contrast",0,(0,h5e.getNumberValidator)(),EO.Factory.afterSetFilter);var Px={};Object.defineProperty(Px,"__esModule",{value:!0});Px.Emboss=void 0;const lc=At,Ix=rr,g5e=dr,KG=Xe,m5e=function(e){var t=this.embossStrength()*10,n=this.embossWhiteLevel()*255,r=this.embossDirection(),i=this.embossBlend(),o=0,a=0,s=e.data,l=e.width,u=e.height,c=l*4,d=u;switch(r){case"top-left":o=-1,a=-1;break;case"top":o=-1,a=0;break;case"top-right":o=-1,a=1;break;case"right":o=0,a=1;break;case"bottom-right":o=1,a=1;break;case"bottom":o=1,a=0;break;case"bottom-left":o=1,a=-1;break;case"left":o=0,a=-1;break;default:g5e.Util.error("Unknown emboss direction: "+r)}do{var f=(d-1)*c,h=o;d+h<1&&(h=0),d+h>u&&(h=0);var p=(d-1+h)*l*4,m=l;do{var _=f+(m-1)*4,b=a;m+b<1&&(b=0),m+b>l&&(b=0);var v=p+(m-1+b)*4,g=s[_]-s[v],y=s[_+1]-s[v+1],S=s[_+2]-s[v+2],w=g,x=w>0?w:-w,C=y>0?y:-y,T=S>0?S:-S;if(C>x&&(w=y),T>x&&(w=S),w*=t,i){var k=s[_]+w,P=s[_+1]+w,$=s[_+2]+w;s[_]=k>255?255:k<0?0:k,s[_+1]=P>255?255:P<0?0:P,s[_+2]=$>255?255:$<0?0:$}else{var O=n-w;O<0?O=0:O>255&&(O=255),s[_]=s[_+1]=s[_+2]=O}}while(--m)}while(--d)};Px.Emboss=m5e;lc.Factory.addGetterSetter(Ix.Node,"embossStrength",.5,(0,KG.getNumberValidator)(),lc.Factory.afterSetFilter);lc.Factory.addGetterSetter(Ix.Node,"embossWhiteLevel",.5,(0,KG.getNumberValidator)(),lc.Factory.afterSetFilter);lc.Factory.addGetterSetter(Ix.Node,"embossDirection","top-left",null,lc.Factory.afterSetFilter);lc.Factory.addGetterSetter(Ix.Node,"embossBlend",!1,null,lc.Factory.afterSetFilter);var Rx={};Object.defineProperty(Rx,"__esModule",{value:!0});Rx.Enhance=void 0;const kO=At,y5e=rr,v5e=Xe;function t5(e,t,n,r,i){var o=n-t,a=i-r,s;return o===0?r+a/2:a===0?r:(s=(e-t)/o,s=a*s+r,s)}const b5e=function(e){var t=e.data,n=t.length,r=t[0],i=r,o,a=t[1],s=a,l,u=t[2],c=u,d,f,h=this.enhance();if(h!==0){for(f=0;fi&&(i=o),l=t[f+1],ls&&(s=l),d=t[f+2],dc&&(c=d);i===r&&(i=255,r=0),s===a&&(s=255,a=0),c===u&&(c=255,u=0);var p,m,_,b,v,g,y,S,w;for(h>0?(m=i+h*(255-i),_=r-h*(r-0),v=s+h*(255-s),g=a-h*(a-0),S=c+h*(255-c),w=u-h*(u-0)):(p=(i+r)*.5,m=i+h*(i-p),_=r+h*(r-p),b=(s+a)*.5,v=s+h*(s-b),g=a+h*(a-b),y=(c+u)*.5,S=c+h*(c-y),w=u+h*(u-y)),f=0;fb?_:b;var v=a,g=o,y,S,w=360/g*Math.PI/180,x,C;for(S=0;Sg?v:g;var y=a,S=o,w,x,C=n.polarRotation||0,T,k;for(c=0;ct&&(y=g,S=0,w=-1),i=0;i=0&&h=0&&p=0&&h=0&&p=255*4?255:0}return a}function N5e(e,t,n){for(var r=[.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111],i=Math.round(Math.sqrt(r.length)),o=Math.floor(i/2),a=[],s=0;s=0&&h=0&&p=n))for(o=m;o<_;o+=1)o>=r||(a=(n*o+i)*4,s+=y[a+0],l+=y[a+1],u+=y[a+2],c+=y[a+3],g+=1);for(s=s/g,l=l/g,u=u/g,c=c/g,i=h;i=n))for(o=m;o<_;o+=1)o>=r||(a=(n*o+i)*4,y[a+0]=s,y[a+1]=l,y[a+2]=u,y[a+3]=c)}};Bx.Pixelate=U5e;IO.Factory.addGetterSetter(z5e.Node,"pixelSize",8,(0,j5e.getNumberValidator)(),IO.Factory.afterSetFilter);var zx={};Object.defineProperty(zx,"__esModule",{value:!0});zx.Posterize=void 0;const RO=At,V5e=rr,G5e=Xe,H5e=function(e){var t=Math.round(this.levels()*254)+1,n=e.data,r=n.length,i=255/t,o;for(o=0;o255?255:e<0?0:Math.round(e)});B_.Factory.addGetterSetter(RA.Node,"green",0,function(e){return this._filterUpToDate=!1,e>255?255:e<0?0:Math.round(e)});B_.Factory.addGetterSetter(RA.Node,"blue",0,q5e.RGBComponent,B_.Factory.afterSetFilter);var Ux={};Object.defineProperty(Ux,"__esModule",{value:!0});Ux.RGBA=void 0;const v0=At,Vx=rr,K5e=Xe,Q5e=function(e){var t=e.data,n=t.length,r=this.red(),i=this.green(),o=this.blue(),a=this.alpha(),s,l;for(s=0;s255?255:e<0?0:Math.round(e)});v0.Factory.addGetterSetter(Vx.Node,"green",0,function(e){return this._filterUpToDate=!1,e>255?255:e<0?0:Math.round(e)});v0.Factory.addGetterSetter(Vx.Node,"blue",0,K5e.RGBComponent,v0.Factory.afterSetFilter);v0.Factory.addGetterSetter(Vx.Node,"alpha",1,function(e){return this._filterUpToDate=!1,e>1?1:e<0?0:e});var Gx={};Object.defineProperty(Gx,"__esModule",{value:!0});Gx.Sepia=void 0;const X5e=function(e){var t=e.data,n=t.length,r,i,o,a;for(r=0;r127&&(u=255-u),c>127&&(c=255-c),d>127&&(d=255-d),t[l]=u,t[l+1]=c,t[l+2]=d}while(--s)}while(--o)};Hx.Solarize=Y5e;var qx={};Object.defineProperty(qx,"__esModule",{value:!0});qx.Threshold=void 0;const OO=At,Z5e=rr,J5e=Xe,e3e=function(e){var t=this.threshold()*255,n=e.data,r=n.length,i;for(i=0;i{const{width:r,height:i}=t,o=document.createElement("div"),a=new rg.Stage({container:o,width:r,height:i}),s=new rg.Layer,l=new rg.Layer;return s.add(new rg.Rect({...t,fill:n?"black":"white"})),e.forEach(u=>l.add(new rg.Line({points:u.points,stroke:n?"white":"black",strokeWidth:u.strokeWidth*2,tension:0,lineCap:"round",lineJoin:"round",shadowForStrokeEnabled:!1,globalCompositeOperation:u.tool==="brush"?"source-over":"destination-out"}))),a.add(s),a.add(l),o.remove(),a},z3e=async(e,t,n)=>new Promise((r,i)=>{const o=document.createElement("canvas");o.width=t,o.height=n;const a=o.getContext("2d"),s=new Image;if(!a){o.remove(),i("Unable to get context");return}s.onload=function(){a.drawImage(s,0,0),o.remove(),r(a.getImageData(0,0,t,n))},s.src=e}),$O=async(e,t)=>{const n=e.toDataURL(t);return await z3e(n,t.width,t.height)},OA=async(e,t,n,r,i)=>{const o=_e("canvas"),a=J2(),s=Nxe();if(!a||!s){o.error("Unable to find canvas / stage");return}const l={...t,...n},u=a.clone();u.scale({x:1,y:1});const c=u.getAbsolutePosition(),d={x:l.x+c.x,y:l.y+c.y,width:l.width,height:l.height},f=await $_(u,d),h=await $O(u,d),p=await B3e(r?e.objects.filter(wB):[],l,i),m=await $_(p,l),_=await $O(p,l);return{baseBlob:f,baseImageData:h,maskBlob:m,maskImageData:_}},j3e=()=>{Fe({actionCreator:Txe,effect:async(e,{dispatch:t,getState:n})=>{const r=_e("canvas"),i=n(),o=await OA(i.canvas.layerState,i.canvas.boundingBoxCoordinates,i.canvas.boundingBoxDimensions,i.canvas.isMaskEnabled,i.canvas.shouldPreserveMaskedArea);if(!o)return;const{maskBlob:a}=o;if(!a){r.error("Problem getting mask layer blob"),t(Gt({title:Z("toast.problemSavingMask"),description:Z("toast.problemSavingMaskDesc"),status:"error"}));return}const{autoAddBoardId:s}=i.gallery;t(me.endpoints.uploadImage.initiate({file:new File([a],"canvasMaskImage.png",{type:"image/png"}),image_category:"mask",is_intermediate:!1,board_id:s==="none"?void 0:s,crop_visible:!0,postUploadAction:{type:"TOAST",toastOptions:{title:Z("toast.maskSavedAssets")}}}))}})},U3e=()=>{Fe({actionCreator:Oxe,effect:async(e,{dispatch:t,getState:n})=>{const r=_e("canvas"),i=n(),o=await OA(i.canvas.layerState,i.canvas.boundingBoxCoordinates,i.canvas.boundingBoxDimensions,i.canvas.isMaskEnabled,i.canvas.shouldPreserveMaskedArea);if(!o)return;const{maskBlob:a}=o;if(!a){r.error("Problem getting mask layer blob"),t(Gt({title:Z("toast.problemImportingMask"),description:Z("toast.problemImportingMaskDesc"),status:"error"}));return}const{autoAddBoardId:s}=i.gallery,l=await t(me.endpoints.uploadImage.initiate({file:new File([a],"canvasMaskImage.png",{type:"image/png"}),image_category:"mask",is_intermediate:!1,board_id:s==="none"?void 0:s,crop_visible:!1,postUploadAction:{type:"TOAST",toastOptions:{title:Z("toast.maskSentControlnetAssets")}}})).unwrap(),{image_name:u}=l;t(Sc({controlNetId:e.payload.controlNet.controlNetId,controlImage:u}))}})},V3e=async()=>{const e=J2();if(!e)return;const t=e.clone();return t.scale({x:1,y:1}),$_(t,t.getClientRect())},G3e=()=>{Fe({actionCreator:Ixe,effect:async(e,{dispatch:t})=>{const n=_2.get().child({namespace:"canvasCopiedToClipboardListener"}),r=await V3e();if(!r){n.error("Problem getting base layer blob"),t(Gt({title:Z("toast.problemMergingCanvas"),description:Z("toast.problemMergingCanvasDesc"),status:"error"}));return}const i=J2();if(!i){n.error("Problem getting canvas base layer"),t(Gt({title:Z("toast.problemMergingCanvas"),description:Z("toast.problemMergingCanvasDesc"),status:"error"}));return}const o=i.getClientRect({relativeTo:i.getParent()}),a=await t(me.endpoints.uploadImage.initiate({file:new File([r],"mergedCanvas.png",{type:"image/png"}),image_category:"general",is_intermediate:!0,postUploadAction:{type:"TOAST",toastOptions:{title:Z("toast.canvasMerged")}}})).unwrap(),{image_name:s}=a;t(ule({kind:"image",layer:"base",imageName:s,...o}))}})},H3e=()=>{Fe({actionCreator:kxe,effect:async(e,{dispatch:t,getState:n})=>{const r=_e("canvas"),i=n();let o;try{o=await ex(i)}catch(s){r.error(String(s)),t(Gt({title:Z("toast.problemSavingCanvas"),description:Z("toast.problemSavingCanvasDesc"),status:"error"}));return}const{autoAddBoardId:a}=i.gallery;t(me.endpoints.uploadImage.initiate({file:new File([o],"savedCanvas.png",{type:"image/png"}),image_category:"general",is_intermediate:!1,board_id:a==="none"?void 0:a,crop_visible:!0,postUploadAction:{type:"TOAST",toastOptions:{title:Z("toast.canvasSavedGallery")}}}))}})},q3e=(e,t,n)=>{var c;if(!(a0e.match(e)||jR.match(e)||Sc.match(e)||s0e.match(e)||UR.match(e))||UR.match(e)&&((c=n.controlNet.controlNets[e.payload.controlNetId])==null?void 0:c.shouldAutoConfig)===!0)return!1;const i=t.controlNet.controlNets[e.payload.controlNetId];if(!i)return!1;const{controlImage:o,processorType:a,shouldAutoConfig:s}=i;return jR.match(e)&&!s?!1:a!=="none"&&!!o},W3e=()=>{Fe({predicate:q3e,effect:async(e,{dispatch:t,cancelActiveListeners:n,delay:r})=>{const i=_e("session"),{controlNetId:o}=e.payload;n(),i.trace("ControlNet auto-process triggered"),await r(300),t(qT({controlNetId:o}))}})},Be="positive_conditioning",We="negative_conditioning",Oe="denoise_latents",Ke="latents_to_image",Za="save_image",md="nsfw_checker",Wc="invisible_watermark",Le="noise",Tc="main_model_loader",Wx="onnx_model_loader",ys="vae_loader",YG="lora_loader",Yt="clip_skip",Hn="image_to_latents",Rs="resize_image",bh="img2img_resize",ye="canvas_output",Wn="inpaint_image",Ai="inpaint_image_resize_up",Hi="inpaint_image_resize_down",Wt="inpaint_infill",$u="inpaint_infill_resize_down",qn="inpaint_create_mask",pt="canvas_coherence_denoise_latents",Ut="canvas_coherence_noise",uc="canvas_coherence_noise_increment",mr="canvas_coherence_mask_edge",zt="canvas_coherence_inpaint_create_mask",_h="tomask",Ui="mask_blur",ki="mask_combine",Mn="mask_resize_up",qi="mask_resize_down",Gv="control_net_collect",K3e="ip_adapter",ht="metadata_accumulator",n5="esrgan",Vi="sdxl_model_loader",ke="sdxl_denoise_latents",$c="sdxl_refiner_model_loader",Hv="sdxl_refiner_positive_conditioning",qv="sdxl_refiner_negative_conditioning",vs="sdxl_refiner_denoise_latents",ca="refiner_inpaint_create_mask",qr="seamless",Qa="refiner_seamless",ZG="text_to_image_graph",JE="image_to_image_graph",JG="canvas_text_to_image_graph",e4="canvas_image_to_image_graph",Kx="canvas_inpaint_graph",Qx="canvas_outpaint_graph",MA="sdxl_text_to_image_graph",z_="sxdl_image_to_image_graph",Xx="sdxl_canvas_text_to_image_graph",b0="sdxl_canvas_image_to_image_graph",cc="sdxl_canvas_inpaint_graph",dc="sdxl_canvas_outpaint_graph",eH=e=>(e==null?void 0:e.type)==="image_output",Q3e=()=>{Fe({actionCreator:qT,effect:async(e,{dispatch:t,getState:n,take:r})=>{var l;const i=_e("session"),{controlNetId:o}=e.payload,a=n().controlNet.controlNets[o];if(!(a!=null&&a.controlImage)){i.error("Unable to process ControlNet image");return}const s={nodes:{[a.processorNode.id]:{...a.processorNode,is_intermediate:!0,image:{image_name:a.controlImage}},[Za]:{id:Za,type:"save_image",is_intermediate:!0,use_cache:!1}},edges:[{source:{node_id:a.processorNode.id,field:"image"},destination:{node_id:Za,field:"image"}}]};try{const u=t(Qr.endpoints.enqueueGraph.initiate({graph:s,prepend:!0},{fixedCacheKey:"enqueueGraph"})),c=await u.unwrap();u.reset(),i.debug({enqueueResult:Qt(c)},Z("queue.graphQueued"));const[d]=await r(f=>UT.match(f)&&f.payload.data.graph_execution_state_id===c.queue_item.session_id&&f.payload.data.source_node_id===Za);if(eH(d.payload.data.result)){const{image_name:f}=d.payload.data.result.image,[{payload:h}]=await r(m=>me.endpoints.getImageDTO.matchFulfilled(m)&&m.payload.image_name===f),p=h;i.debug({controlNetId:e.payload,processedControlImage:p},"ControlNet image processed"),t(WT({controlNetId:o,processedControlImage:p.image_name}))}}catch(u){if(i.error({graph:Qt(s)},Z("queue.graphFailedToQueue")),u instanceof Object&&"data"in u&&"status"in u&&u.status===403){const c=((l=u.data)==null?void 0:l.detail)||"Unknown Error";t(Gt({title:Z("queue.graphFailedToQueue"),status:"error",description:c,duration:15e3})),t(u0e()),t(Sc({controlNetId:o,controlImage:null}));return}t(Gt({title:Z("queue.graphFailedToQueue"),status:"error"}))}}})},NA=Ne("app/enqueueRequested");Ne("app/batchEnqueued");const X3e=e=>{const t=window.open("");t&&e.forEach(n=>{const r=new Image;r.src=n.base64,t.document.write(n.caption),t.document.write("
"),t.document.write(r.outerHTML),t.document.write("

")})},DO=e=>new Promise((t,n)=>{const r=new FileReader;r.onload=i=>t(r.result),r.onerror=i=>n(r.error),r.onabort=i=>n(new Error("Read aborted")),r.readAsDataURL(e)}),Y3e=e=>{let t=!0,n=!1;const r=e.length;let i=3;for(i;i{const t=e.length;let n=0;for(n;n{const{isPartiallyTransparent:n,isFullyTransparent:r}=Y3e(e.data),i=Z3e(t.data);return n?r?"txt2img":"outpaint":i?"inpaint":"img2img"},eEe=e=>xoe(e,n=>n.isEnabled&&(!!n.processedControlImage||n.processorType==="none"&&!!n.controlImage)),Aa=(e,t,n)=>{const{isEnabled:r,controlNets:i}=e.controlNet,o=eEe(i),a=t.nodes[ht];if(r&&o.length&&o.length){const s={id:Gv,type:"collect",is_intermediate:!0};t.nodes[Gv]=s,t.edges.push({source:{node_id:Gv,field:"collection"},destination:{node_id:n,field:"control"}}),o.forEach(l=>{const{controlNetId:u,controlImage:c,processedControlImage:d,beginStepPct:f,endStepPct:h,controlMode:p,resizeMode:m,model:_,processorType:b,weight:v}=l,g={id:`control_net_${u}`,type:"controlnet",is_intermediate:!0,begin_step_percent:f,end_step_percent:h,control_mode:p,resize_mode:m,control_model:_,control_weight:v};if(d&&b!=="none")g.image={image_name:d};else if(c)g.image={image_name:c};else return;if(t.nodes[g.id]=g,a!=null&&a.controlnets){const y=qS(g,["id","type"]);a.controlnets.push(y)}t.edges.push({source:{node_id:g.id,field:"control"},destination:{node_id:Gv,field:"item"}}),pt in t.nodes&&t.edges.push({source:{node_id:g.id,field:"control"},destination:{node_id:pt,field:"control"}})})}},Pa=(e,t,n)=>{var a,s,l,u;const{isIPAdapterEnabled:r,ipAdapterInfo:i}=e.controlNet,o=t.nodes[ht];if(r&&i.model){const c={id:K3e,type:"ip_adapter",is_intermediate:!0,weight:i.weight,ip_adapter_model:{base_model:(a=i.model)==null?void 0:a.base_model,model_name:(s=i.model)==null?void 0:s.model_name},begin_step_percent:i.beginStepPct,end_step_percent:i.endStepPct};if(i.adapterImage)c.image={image_name:i.adapterImage};else return;if(t.nodes[c.id]=c,o!=null&&o.ipAdapters){const d={image:{image_name:i.adapterImage},ip_adapter_model:{base_model:(l=i.model)==null?void 0:l.base_model,model_name:(u=i.model)==null?void 0:u.model_name},weight:i.weight,begin_step_percent:i.beginStepPct,end_step_percent:i.endStepPct};o.ipAdapters.push(d)}t.edges.push({source:{node_id:c.id,field:"ip_adapter"},destination:{node_id:n,field:"ip_adapter"}}),pt in t.nodes&&t.edges.push({source:{node_id:c.id,field:"ip_adapter"},destination:{node_id:pt,field:"ip_adapter"}})}},kp=(e,t,n,r=Tc)=>{const{loras:i}=e.lora,o=WS(i),a=t.nodes[ht];o>0&&(t.edges=t.edges.filter(u=>!(u.source.node_id===r&&["unet"].includes(u.source.field))),t.edges=t.edges.filter(u=>!(u.source.node_id===Yt&&["clip"].includes(u.source.field))));let s="",l=0;Ca(i,u=>{const{model_name:c,base_model:d,weight:f}=u,h=`${YG}_${c.replace(".","_")}`,p={type:"lora_loader",id:h,is_intermediate:!0,lora:{model_name:c,base_model:d},weight:f};a!=null&&a.loras&&a.loras.push({lora:{model_name:c,base_model:d},weight:f}),t.nodes[h]=p,l===0?(t.edges.push({source:{node_id:r,field:"unet"},destination:{node_id:h,field:"unet"}}),t.edges.push({source:{node_id:Yt,field:"clip"},destination:{node_id:h,field:"clip"}})):(t.edges.push({source:{node_id:s,field:"unet"},destination:{node_id:h,field:"unet"}}),t.edges.push({source:{node_id:s,field:"clip"},destination:{node_id:h,field:"clip"}})),l===o-1&&(t.edges.push({source:{node_id:h,field:"unet"},destination:{node_id:n,field:"unet"}}),t.id&&[Kx,Qx].includes(t.id)&&t.edges.push({source:{node_id:h,field:"unet"},destination:{node_id:pt,field:"unet"}}),t.edges.push({source:{node_id:h,field:"clip"},destination:{node_id:Be,field:"clip"}}),t.edges.push({source:{node_id:h,field:"clip"},destination:{node_id:We,field:"clip"}})),s=h,l+=1})},Ia=(e,t,n=Ke)=>{const r=t.nodes[n];if(!r)return;r.is_intermediate=!0,r.use_cache=!0;const i={id:md,type:"img_nsfw",is_intermediate:!0};t.nodes[md]=i,t.edges.push({source:{node_id:n,field:"image"},destination:{node_id:md,field:"image"}})},tEe=["txt2img","img2img","unifiedCanvas","nodes","modelManager","queue"],$A=Ii(e=>e,({ui:e})=>cT(e.activeTab)?e.activeTab:"txt2img"),KWe=Ii(e=>e,({ui:e,config:t})=>{const r=tEe.filter(i=>!t.disabledTabs.includes(i)).indexOf(e.activeTab);return r===-1?0:r}),QWe=Ii(e=>e.ui,e=>e,{memoizeOptions:{equalityCheck:dT}}),Ra=(e,t)=>{const r=$A(e)==="unifiedCanvas"?!e.canvas.shouldAutoSave:!1,{autoAddBoardId:i}=e.gallery,o={id:Za,type:"save_image",is_intermediate:r,use_cache:!1,board:i==="none"?void 0:{board_id:i}};t.nodes[Za]=o,t.nodes[ht]&&t.edges.push({source:{node_id:ht,field:"metadata"},destination:{node_id:Za,field:"metadata"}});const s={node_id:Za,field:"image"};Wc in t.nodes?t.edges.push({source:{node_id:Wc,field:"image"},destination:s}):md in t.nodes?t.edges.push({source:{node_id:md,field:"image"},destination:s}):ye in t.nodes?t.edges.push({source:{node_id:ye,field:"image"},destination:s}):Ke in t.nodes&&t.edges.push({source:{node_id:Ke,field:"image"},destination:s})},Oa=(e,t,n)=>{const{seamlessXAxis:r,seamlessYAxis:i}=e.generation;t.nodes[qr]={id:qr,type:"seamless",seamless_x:r,seamless_y:i};let o=Oe;(t.id===MA||t.id===z_||t.id===Xx||t.id===b0||t.id===cc||t.id===dc)&&(o=ke),t.edges=t.edges.filter(a=>!(a.source.node_id===n&&["unet"].includes(a.source.field))&&!(a.source.node_id===n&&["vae"].includes(a.source.field))),t.edges.push({source:{node_id:n,field:"unet"},destination:{node_id:qr,field:"unet"}},{source:{node_id:n,field:"vae"},destination:{node_id:qr,field:"vae"}},{source:{node_id:qr,field:"unet"},destination:{node_id:o,field:"unet"}}),(t.id==Kx||t.id===Qx||t.id===cc||t.id===dc)&&t.edges.push({source:{node_id:qr,field:"unet"},destination:{node_id:pt,field:"unet"}})},Ma=(e,t,n=Tc)=>{const{vae:r,canvasCoherenceMode:i}=e.generation,{boundingBoxScaleMethod:o}=e.canvas,{shouldUseSDXLRefiner:a}=e.sdxl,s=["auto","manual"].includes(o),l=!r,u=t.nodes[ht];l||(t.nodes[ys]={type:"vae_loader",id:ys,is_intermediate:!0,vae_model:r});const c=n==Wx;(t.id===ZG||t.id===JE||t.id===MA||t.id===z_)&&t.edges.push({source:{node_id:l?n:ys,field:l&&c?"vae_decoder":"vae"},destination:{node_id:Ke,field:"vae"}}),(t.id===JG||t.id===e4||t.id===Xx||t.id==b0)&&t.edges.push({source:{node_id:l?n:ys,field:l&&c?"vae_decoder":"vae"},destination:{node_id:s?Ke:ye,field:"vae"}}),(t.id===JE||t.id===z_||t.id===e4||t.id===b0)&&t.edges.push({source:{node_id:l?n:ys,field:l&&c?"vae_decoder":"vae"},destination:{node_id:Hn,field:"vae"}}),(t.id===Kx||t.id===Qx||t.id===cc||t.id===dc)&&(t.edges.push({source:{node_id:l?n:ys,field:l&&c?"vae_decoder":"vae"},destination:{node_id:Wn,field:"vae"}},{source:{node_id:l?n:ys,field:l&&c?"vae_decoder":"vae"},destination:{node_id:qn,field:"vae"}},{source:{node_id:l?n:ys,field:l&&c?"vae_decoder":"vae"},destination:{node_id:Ke,field:"vae"}}),i!=="unmasked"&&t.edges.push({source:{node_id:l?n:ys,field:l&&c?"vae_decoder":"vae"},destination:{node_id:zt,field:"vae"}})),a&&(t.id===cc||t.id===dc)&&t.edges.push({source:{node_id:l?n:ys,field:l&&c?"vae_decoder":"vae"},destination:{node_id:ca,field:"vae"}}),r&&u&&(u.vae=r)},Na=(e,t,n=Ke)=>{const i=$A(e)==="unifiedCanvas"?!e.canvas.shouldAutoSave:!1,o=t.nodes[n],a=t.nodes[md],s=t.nodes[ht];if(!o)return;const l={id:Wc,type:"img_watermark",is_intermediate:i};t.nodes[Wc]=l,o.is_intermediate=!0,o.use_cache=!0,a?(a.is_intermediate=!0,t.edges.push({source:{node_id:md,field:"image"},destination:{node_id:Wc,field:"image"}})):t.edges.push({source:{node_id:n,field:"image"},destination:{node_id:Wc,field:"image"}}),s&&t.edges.push({source:{node_id:ht,field:"metadata"},destination:{node_id:Wc,field:"metadata"}})},nEe=(e,t)=>{const n=_e("nodes"),{positivePrompt:r,negativePrompt:i,model:o,cfgScale:a,scheduler:s,seed:l,steps:u,img2imgStrength:c,vaePrecision:d,clipSkip:f,shouldUseCpuNoise:h,seamlessXAxis:p,seamlessYAxis:m}=e.generation,{width:_,height:b}=e.canvas.boundingBoxDimensions,{scaledBoundingBoxDimensions:v,boundingBoxScaleMethod:g}=e.canvas,y=d==="fp32",S=!0,w=["auto","manual"].includes(g);if(!o)throw n.error("No model found in state"),new Error("No model found in state");let x=Tc;const C=h,T={id:e4,nodes:{[x]:{type:"main_model_loader",id:x,is_intermediate:S,model:o},[Yt]:{type:"clip_skip",id:Yt,is_intermediate:S,skipped_layers:f},[Be]:{type:"compel",id:Be,is_intermediate:S,prompt:r},[We]:{type:"compel",id:We,is_intermediate:S,prompt:i},[Le]:{type:"noise",id:Le,is_intermediate:S,use_cpu:C,seed:l,width:w?v.width:_,height:w?v.height:b},[Hn]:{type:"i2l",id:Hn,is_intermediate:S},[Oe]:{type:"denoise_latents",id:Oe,is_intermediate:S,cfg_scale:a,scheduler:s,steps:u,denoising_start:1-c,denoising_end:1},[ye]:{type:"l2i",id:ye,is_intermediate:S}},edges:[{source:{node_id:x,field:"unet"},destination:{node_id:Oe,field:"unet"}},{source:{node_id:x,field:"clip"},destination:{node_id:Yt,field:"clip"}},{source:{node_id:Yt,field:"clip"},destination:{node_id:Be,field:"clip"}},{source:{node_id:Yt,field:"clip"},destination:{node_id:We,field:"clip"}},{source:{node_id:Be,field:"conditioning"},destination:{node_id:Oe,field:"positive_conditioning"}},{source:{node_id:We,field:"conditioning"},destination:{node_id:Oe,field:"negative_conditioning"}},{source:{node_id:Le,field:"noise"},destination:{node_id:Oe,field:"noise"}},{source:{node_id:Hn,field:"latents"},destination:{node_id:Oe,field:"latents"}}]};return w?(T.nodes[bh]={id:bh,type:"img_resize",is_intermediate:S,image:t,width:v.width,height:v.height},T.nodes[Ke]={id:Ke,type:"l2i",is_intermediate:S,fp32:y},T.nodes[ye]={id:ye,type:"img_resize",is_intermediate:S,width:_,height:b},T.edges.push({source:{node_id:bh,field:"image"},destination:{node_id:Hn,field:"image"}},{source:{node_id:Oe,field:"latents"},destination:{node_id:Ke,field:"latents"}},{source:{node_id:Ke,field:"image"},destination:{node_id:ye,field:"image"}})):(T.nodes[ye]={type:"l2i",id:ye,is_intermediate:S,fp32:y},T.nodes[Hn].image=t,T.edges.push({source:{node_id:Oe,field:"latents"},destination:{node_id:ye,field:"latents"}})),T.nodes[ht]={id:ht,type:"metadata_accumulator",generation_mode:"img2img",cfg_scale:a,width:w?v.width:_,height:w?v.height:b,positive_prompt:r,negative_prompt:i,model:o,seed:l,steps:u,rand_device:C?"cpu":"cuda",scheduler:s,vae:void 0,controlnets:[],loras:[],ipAdapters:[],clip_skip:f,strength:c,init_image:t.image_name},(p||m)&&(Oa(e,T,x),x=qr),kp(e,T,Oe),Ma(e,T,x),Aa(e,T,Oe),Pa(e,T,Oe),e.system.shouldUseNSFWChecker&&Ia(e,T,ye),e.system.shouldUseWatermarker&&Na(e,T,ye),Ra(e,T),T},rEe=(e,t,n)=>{const r=_e("nodes"),{positivePrompt:i,negativePrompt:o,model:a,cfgScale:s,scheduler:l,steps:u,img2imgStrength:c,seed:d,vaePrecision:f,shouldUseCpuNoise:h,maskBlur:p,maskBlurMethod:m,canvasCoherenceMode:_,canvasCoherenceSteps:b,canvasCoherenceStrength:v,clipSkip:g,seamlessXAxis:y,seamlessYAxis:S}=e.generation;if(!a)throw r.error("No Image found in state"),new Error("No Image found in state");const{width:w,height:x}=e.canvas.boundingBoxDimensions,{scaledBoundingBoxDimensions:C,boundingBoxScaleMethod:T}=e.canvas,k=!0,P=f==="fp32",$=["auto","manual"].includes(T);let O=Tc;const E=h,A={id:Kx,nodes:{[O]:{type:"main_model_loader",id:O,is_intermediate:k,model:a},[Yt]:{type:"clip_skip",id:Yt,is_intermediate:k,skipped_layers:g},[Be]:{type:"compel",id:Be,is_intermediate:k,prompt:i},[We]:{type:"compel",id:We,is_intermediate:k,prompt:o},[Ui]:{type:"img_blur",id:Ui,is_intermediate:k,radius:p,blur_type:m},[Wn]:{type:"i2l",id:Wn,is_intermediate:k,fp32:P},[Le]:{type:"noise",id:Le,use_cpu:E,seed:d,is_intermediate:k},[qn]:{type:"create_denoise_mask",id:qn,is_intermediate:k,fp32:P},[Oe]:{type:"denoise_latents",id:Oe,is_intermediate:k,steps:u,cfg_scale:s,scheduler:l,denoising_start:1-c,denoising_end:1},[Ut]:{type:"noise",id:Ut,use_cpu:E,seed:d+1,is_intermediate:k},[uc]:{type:"add",id:uc,b:1,is_intermediate:k},[pt]:{type:"denoise_latents",id:pt,is_intermediate:k,steps:b,cfg_scale:s,scheduler:l,denoising_start:1-v,denoising_end:1},[Ke]:{type:"l2i",id:Ke,is_intermediate:k,fp32:P},[ye]:{type:"color_correct",id:ye,is_intermediate:k,reference:t}},edges:[{source:{node_id:O,field:"unet"},destination:{node_id:Oe,field:"unet"}},{source:{node_id:O,field:"clip"},destination:{node_id:Yt,field:"clip"}},{source:{node_id:Yt,field:"clip"},destination:{node_id:Be,field:"clip"}},{source:{node_id:Yt,field:"clip"},destination:{node_id:We,field:"clip"}},{source:{node_id:Be,field:"conditioning"},destination:{node_id:Oe,field:"positive_conditioning"}},{source:{node_id:We,field:"conditioning"},destination:{node_id:Oe,field:"negative_conditioning"}},{source:{node_id:Le,field:"noise"},destination:{node_id:Oe,field:"noise"}},{source:{node_id:Wn,field:"latents"},destination:{node_id:Oe,field:"latents"}},{source:{node_id:Ui,field:"image"},destination:{node_id:qn,field:"mask"}},{source:{node_id:qn,field:"denoise_mask"},destination:{node_id:Oe,field:"denoise_mask"}},{source:{node_id:O,field:"unet"},destination:{node_id:pt,field:"unet"}},{source:{node_id:Be,field:"conditioning"},destination:{node_id:pt,field:"positive_conditioning"}},{source:{node_id:We,field:"conditioning"},destination:{node_id:pt,field:"negative_conditioning"}},{source:{node_id:Ut,field:"noise"},destination:{node_id:pt,field:"noise"}},{source:{node_id:Oe,field:"latents"},destination:{node_id:pt,field:"latents"}},{source:{node_id:pt,field:"latents"},destination:{node_id:Ke,field:"latents"}}]};if($){const D=C.width,L=C.height;A.nodes[Ai]={type:"img_resize",id:Ai,is_intermediate:k,width:D,height:L,image:t},A.nodes[Mn]={type:"img_resize",id:Mn,is_intermediate:k,width:D,height:L,image:n},A.nodes[Hi]={type:"img_resize",id:Hi,is_intermediate:k,width:w,height:x},A.nodes[qi]={type:"img_resize",id:qi,is_intermediate:k,width:w,height:x},A.nodes[Le].width=D,A.nodes[Le].height=L,A.nodes[Ut].width=D,A.nodes[Ut].height=L,A.edges.push({source:{node_id:Ai,field:"image"},destination:{node_id:Wn,field:"image"}},{source:{node_id:Mn,field:"image"},destination:{node_id:Ui,field:"image"}},{source:{node_id:Ai,field:"image"},destination:{node_id:qn,field:"image"}},{source:{node_id:Ke,field:"image"},destination:{node_id:Hi,field:"image"}},{source:{node_id:Hi,field:"image"},destination:{node_id:ye,field:"image"}},{source:{node_id:Ui,field:"image"},destination:{node_id:qi,field:"image"}},{source:{node_id:qi,field:"image"},destination:{node_id:ye,field:"mask"}})}else A.nodes[Le].width=w,A.nodes[Le].height=x,A.nodes[Ut].width=w,A.nodes[Ut].height=x,A.nodes[Wn]={...A.nodes[Wn],image:t},A.nodes[Ui]={...A.nodes[Ui],image:n},A.nodes[qn]={...A.nodes[qn],image:t},A.edges.push({source:{node_id:Ke,field:"image"},destination:{node_id:ye,field:"image"}},{source:{node_id:Ui,field:"image"},destination:{node_id:ye,field:"mask"}});return _!=="unmasked"&&(A.nodes[zt]={type:"create_denoise_mask",id:zt,is_intermediate:k,fp32:P},$?A.edges.push({source:{node_id:Ai,field:"image"},destination:{node_id:zt,field:"image"}}):A.nodes[zt]={...A.nodes[zt],image:t},_==="mask"&&($?A.edges.push({source:{node_id:Mn,field:"image"},destination:{node_id:zt,field:"mask"}}):A.nodes[zt]={...A.nodes[zt],mask:n}),_==="edge"&&(A.nodes[mr]={type:"mask_edge",id:mr,is_intermediate:k,edge_blur:p,edge_size:p*2,low_threshold:100,high_threshold:200},$?A.edges.push({source:{node_id:Mn,field:"image"},destination:{node_id:mr,field:"image"}}):A.nodes[mr]={...A.nodes[mr],image:n},A.edges.push({source:{node_id:mr,field:"image"},destination:{node_id:zt,field:"mask"}})),A.edges.push({source:{node_id:zt,field:"denoise_mask"},destination:{node_id:pt,field:"denoise_mask"}})),(y||S)&&(Oa(e,A,O),O=qr),Ma(e,A,O),kp(e,A,Oe,O),Aa(e,A,Oe),Pa(e,A,Oe),e.system.shouldUseNSFWChecker&&Ia(e,A,ye),e.system.shouldUseWatermarker&&Na(e,A,ye),Ra(e,A),A},iEe=(e,t,n)=>{const r=_e("nodes"),{positivePrompt:i,negativePrompt:o,model:a,cfgScale:s,scheduler:l,steps:u,img2imgStrength:c,seed:d,vaePrecision:f,shouldUseCpuNoise:h,maskBlur:p,canvasCoherenceMode:m,canvasCoherenceSteps:_,canvasCoherenceStrength:b,infillTileSize:v,infillPatchmatchDownscaleSize:g,infillMethod:y,clipSkip:S,seamlessXAxis:w,seamlessYAxis:x}=e.generation;if(!a)throw r.error("No model found in state"),new Error("No model found in state");const{width:C,height:T}=e.canvas.boundingBoxDimensions,{scaledBoundingBoxDimensions:k,boundingBoxScaleMethod:P}=e.canvas,$=f==="fp32",O=!0,E=["auto","manual"].includes(P);let A=Tc;const D=h,L={id:Qx,nodes:{[A]:{type:"main_model_loader",id:A,is_intermediate:O,model:a},[Yt]:{type:"clip_skip",id:Yt,is_intermediate:O,skipped_layers:S},[Be]:{type:"compel",id:Be,is_intermediate:O,prompt:i},[We]:{type:"compel",id:We,is_intermediate:O,prompt:o},[_h]:{type:"tomask",id:_h,is_intermediate:O,image:t},[ki]:{type:"mask_combine",id:ki,is_intermediate:O,mask2:n},[Wn]:{type:"i2l",id:Wn,is_intermediate:O,fp32:$},[Le]:{type:"noise",id:Le,use_cpu:D,seed:d,is_intermediate:O},[qn]:{type:"create_denoise_mask",id:qn,is_intermediate:O,fp32:$},[Oe]:{type:"denoise_latents",id:Oe,is_intermediate:O,steps:u,cfg_scale:s,scheduler:l,denoising_start:1-c,denoising_end:1},[Ut]:{type:"noise",id:Ut,use_cpu:D,seed:d+1,is_intermediate:O},[uc]:{type:"add",id:uc,b:1,is_intermediate:O},[pt]:{type:"denoise_latents",id:pt,is_intermediate:O,steps:_,cfg_scale:s,scheduler:l,denoising_start:1-b,denoising_end:1},[Ke]:{type:"l2i",id:Ke,is_intermediate:O,fp32:$},[ye]:{type:"color_correct",id:ye,is_intermediate:O}},edges:[{source:{node_id:A,field:"unet"},destination:{node_id:Oe,field:"unet"}},{source:{node_id:A,field:"clip"},destination:{node_id:Yt,field:"clip"}},{source:{node_id:Yt,field:"clip"},destination:{node_id:Be,field:"clip"}},{source:{node_id:Yt,field:"clip"},destination:{node_id:We,field:"clip"}},{source:{node_id:Wt,field:"image"},destination:{node_id:Wn,field:"image"}},{source:{node_id:_h,field:"image"},destination:{node_id:ki,field:"mask1"}},{source:{node_id:Be,field:"conditioning"},destination:{node_id:Oe,field:"positive_conditioning"}},{source:{node_id:We,field:"conditioning"},destination:{node_id:Oe,field:"negative_conditioning"}},{source:{node_id:Le,field:"noise"},destination:{node_id:Oe,field:"noise"}},{source:{node_id:Wn,field:"latents"},destination:{node_id:Oe,field:"latents"}},{source:{node_id:E?Mn:ki,field:"image"},destination:{node_id:qn,field:"mask"}},{source:{node_id:qn,field:"denoise_mask"},destination:{node_id:Oe,field:"denoise_mask"}},{source:{node_id:A,field:"unet"},destination:{node_id:pt,field:"unet"}},{source:{node_id:Be,field:"conditioning"},destination:{node_id:pt,field:"positive_conditioning"}},{source:{node_id:We,field:"conditioning"},destination:{node_id:pt,field:"negative_conditioning"}},{source:{node_id:Ut,field:"noise"},destination:{node_id:pt,field:"noise"}},{source:{node_id:Oe,field:"latents"},destination:{node_id:pt,field:"latents"}},{source:{node_id:Wt,field:"image"},destination:{node_id:qn,field:"image"}},{source:{node_id:pt,field:"latents"},destination:{node_id:Ke,field:"latents"}}]};if(y==="patchmatch"&&(L.nodes[Wt]={type:"infill_patchmatch",id:Wt,is_intermediate:O,downscale:g}),y==="lama"&&(L.nodes[Wt]={type:"infill_lama",id:Wt,is_intermediate:O}),y==="cv2"&&(L.nodes[Wt]={type:"infill_cv2",id:Wt,is_intermediate:O}),y==="tile"&&(L.nodes[Wt]={type:"infill_tile",id:Wt,is_intermediate:O,tile_size:v}),E){const M=k.width,R=k.height;L.nodes[Ai]={type:"img_resize",id:Ai,is_intermediate:O,width:M,height:R,image:t},L.nodes[Mn]={type:"img_resize",id:Mn,is_intermediate:O,width:M,height:R},L.nodes[Hi]={type:"img_resize",id:Hi,is_intermediate:O,width:C,height:T},L.nodes[$u]={type:"img_resize",id:$u,is_intermediate:O,width:C,height:T},L.nodes[qi]={type:"img_resize",id:qi,is_intermediate:O,width:C,height:T},L.nodes[Le].width=M,L.nodes[Le].height=R,L.nodes[Ut].width=M,L.nodes[Ut].height=R,L.edges.push({source:{node_id:Ai,field:"image"},destination:{node_id:Wt,field:"image"}},{source:{node_id:ki,field:"image"},destination:{node_id:Mn,field:"image"}},{source:{node_id:Ke,field:"image"},destination:{node_id:Hi,field:"image"}},{source:{node_id:Mn,field:"image"},destination:{node_id:qi,field:"image"}},{source:{node_id:Wt,field:"image"},destination:{node_id:$u,field:"image"}},{source:{node_id:$u,field:"image"},destination:{node_id:ye,field:"reference"}},{source:{node_id:Hi,field:"image"},destination:{node_id:ye,field:"image"}},{source:{node_id:qi,field:"image"},destination:{node_id:ye,field:"mask"}})}else L.nodes[Wt]={...L.nodes[Wt],image:t},L.nodes[Le].width=C,L.nodes[Le].height=T,L.nodes[Ut].width=C,L.nodes[Ut].height=T,L.nodes[Wn]={...L.nodes[Wn],image:t},L.edges.push({source:{node_id:Wt,field:"image"},destination:{node_id:ye,field:"reference"}},{source:{node_id:Ke,field:"image"},destination:{node_id:ye,field:"image"}},{source:{node_id:ki,field:"image"},destination:{node_id:ye,field:"mask"}});return m!=="unmasked"&&(L.nodes[zt]={type:"create_denoise_mask",id:zt,is_intermediate:O,fp32:$},L.edges.push({source:{node_id:Wt,field:"image"},destination:{node_id:zt,field:"image"}}),m==="mask"&&(E?L.edges.push({source:{node_id:Mn,field:"image"},destination:{node_id:zt,field:"mask"}}):L.edges.push({source:{node_id:ki,field:"image"},destination:{node_id:zt,field:"mask"}})),m==="edge"&&(L.nodes[mr]={type:"mask_edge",id:mr,is_intermediate:O,edge_blur:p,edge_size:p*2,low_threshold:100,high_threshold:200},E?L.edges.push({source:{node_id:Mn,field:"image"},destination:{node_id:mr,field:"image"}}):L.edges.push({source:{node_id:ki,field:"image"},destination:{node_id:mr,field:"image"}}),L.edges.push({source:{node_id:mr,field:"image"},destination:{node_id:zt,field:"mask"}})),L.edges.push({source:{node_id:zt,field:"denoise_mask"},destination:{node_id:pt,field:"denoise_mask"}})),(w||x)&&(Oa(e,L,A),A=qr),Ma(e,L,A),kp(e,L,Oe,A),Aa(e,L,Oe),Pa(e,L,Oe),e.system.shouldUseNSFWChecker&&Ia(e,L,ye),e.system.shouldUseWatermarker&&Na(e,L,ye),Ra(e,L),L},Tp=(e,t,n,r=Vi)=>{const{loras:i}=e.lora,o=WS(i),a=t.nodes[ht],s=r;let l=r;[qr,ca].includes(r)&&(l=Vi),o>0&&(t.edges=t.edges.filter(d=>!(d.source.node_id===s&&["unet"].includes(d.source.field))&&!(d.source.node_id===l&&["clip"].includes(d.source.field))&&!(d.source.node_id===l&&["clip2"].includes(d.source.field))));let u="",c=0;Ca(i,d=>{const{model_name:f,base_model:h,weight:p}=d,m=`${YG}_${f.replace(".","_")}`,_={type:"sdxl_lora_loader",id:m,is_intermediate:!0,lora:{model_name:f,base_model:h},weight:p};a&&(a.loras||(a.loras=[]),a.loras.push({lora:{model_name:f,base_model:h},weight:p})),t.nodes[m]=_,c===0?(t.edges.push({source:{node_id:s,field:"unet"},destination:{node_id:m,field:"unet"}}),t.edges.push({source:{node_id:l,field:"clip"},destination:{node_id:m,field:"clip"}}),t.edges.push({source:{node_id:l,field:"clip2"},destination:{node_id:m,field:"clip2"}})):(t.edges.push({source:{node_id:u,field:"unet"},destination:{node_id:m,field:"unet"}}),t.edges.push({source:{node_id:u,field:"clip"},destination:{node_id:m,field:"clip"}}),t.edges.push({source:{node_id:u,field:"clip2"},destination:{node_id:m,field:"clip2"}})),c===o-1&&(t.edges.push({source:{node_id:m,field:"unet"},destination:{node_id:n,field:"unet"}}),t.id&&[cc,dc].includes(t.id)&&t.edges.push({source:{node_id:m,field:"unet"},destination:{node_id:pt,field:"unet"}}),t.edges.push({source:{node_id:m,field:"clip"},destination:{node_id:Be,field:"clip"}}),t.edges.push({source:{node_id:m,field:"clip"},destination:{node_id:We,field:"clip"}}),t.edges.push({source:{node_id:m,field:"clip2"},destination:{node_id:Be,field:"clip2"}}),t.edges.push({source:{node_id:m,field:"clip2"},destination:{node_id:We,field:"clip2"}})),u=m,c+=1})},Zd=(e,t)=>{const{positivePrompt:n,negativePrompt:r}=e.generation,{positiveStylePrompt:i,negativeStylePrompt:o,shouldConcatSDXLStylePrompt:a}=e.sdxl,s=a||t?[n,i].join(" "):i,l=a||t?[r,o].join(" "):o;return{joinedPositiveStylePrompt:s,joinedNegativeStylePrompt:l}},Ap=(e,t,n,r,i,o)=>{const{refinerModel:a,refinerPositiveAestheticScore:s,refinerNegativeAestheticScore:l,refinerSteps:u,refinerScheduler:c,refinerCFGScale:d,refinerStart:f}=e.sdxl,{seamlessXAxis:h,seamlessYAxis:p,vaePrecision:m}=e.generation,{boundingBoxScaleMethod:_}=e.canvas,b=m==="fp32",v=["auto","manual"].includes(_);if(!a)return;const g=t.nodes[ht];g&&(g.refiner_model=a,g.refiner_positive_aesthetic_score=s,g.refiner_negative_aesthetic_score=l,g.refiner_cfg_scale=d,g.refiner_scheduler=c,g.refiner_start=f,g.refiner_steps=u);const y=r||Vi,{joinedPositiveStylePrompt:S,joinedNegativeStylePrompt:w}=Zd(e,!0);t.edges=t.edges.filter(x=>!(x.source.node_id===n&&["latents"].includes(x.source.field))),t.edges=t.edges.filter(x=>!(x.source.node_id===y&&["vae"].includes(x.source.field))),t.nodes[$c]={type:"sdxl_refiner_model_loader",id:$c,model:a},t.nodes[Hv]={type:"sdxl_refiner_compel_prompt",id:Hv,style:S,aesthetic_score:s},t.nodes[qv]={type:"sdxl_refiner_compel_prompt",id:qv,style:w,aesthetic_score:l},t.nodes[vs]={type:"denoise_latents",id:vs,cfg_scale:d,steps:u,scheduler:c,denoising_start:f,denoising_end:1},h||p?(t.nodes[Qa]={id:Qa,type:"seamless",seamless_x:h,seamless_y:p},t.edges.push({source:{node_id:$c,field:"unet"},destination:{node_id:Qa,field:"unet"}},{source:{node_id:$c,field:"vae"},destination:{node_id:Qa,field:"vae"}},{source:{node_id:Qa,field:"unet"},destination:{node_id:vs,field:"unet"}})):t.edges.push({source:{node_id:$c,field:"unet"},destination:{node_id:vs,field:"unet"}}),t.edges.push({source:{node_id:$c,field:"clip2"},destination:{node_id:Hv,field:"clip2"}},{source:{node_id:$c,field:"clip2"},destination:{node_id:qv,field:"clip2"}},{source:{node_id:Hv,field:"conditioning"},destination:{node_id:vs,field:"positive_conditioning"}},{source:{node_id:qv,field:"conditioning"},destination:{node_id:vs,field:"negative_conditioning"}},{source:{node_id:n,field:"latents"},destination:{node_id:vs,field:"latents"}}),(t.id===cc||t.id===dc)&&(t.nodes[ca]={type:"create_denoise_mask",id:ca,is_intermediate:!0,fp32:b},v?t.edges.push({source:{node_id:Ai,field:"image"},destination:{node_id:ca,field:"image"}}):t.nodes[ca]={...t.nodes[ca],image:i},t.id===cc&&(v?t.edges.push({source:{node_id:Mn,field:"image"},destination:{node_id:ca,field:"mask"}}):t.nodes[ca]={...t.nodes[ca],mask:o}),t.id===dc&&t.edges.push({source:{node_id:v?Mn:ki,field:"image"},destination:{node_id:ca,field:"mask"}}),t.edges.push({source:{node_id:ca,field:"denoise_mask"},destination:{node_id:vs,field:"denoise_mask"}})),t.id===Xx||t.id===b0?t.edges.push({source:{node_id:vs,field:"latents"},destination:{node_id:v?Ke:ye,field:"latents"}}):t.edges.push({source:{node_id:vs,field:"latents"},destination:{node_id:Ke,field:"latents"}})},oEe=(e,t)=>{const n=_e("nodes"),{positivePrompt:r,negativePrompt:i,model:o,cfgScale:a,scheduler:s,seed:l,steps:u,vaePrecision:c,shouldUseCpuNoise:d,seamlessXAxis:f,seamlessYAxis:h}=e.generation,{shouldUseSDXLRefiner:p,refinerStart:m,sdxlImg2ImgDenoisingStrength:_}=e.sdxl,{width:b,height:v}=e.canvas.boundingBoxDimensions,{scaledBoundingBoxDimensions:g,boundingBoxScaleMethod:y}=e.canvas,S=c==="fp32",w=!0,x=["auto","manual"].includes(y);if(!o)throw n.error("No model found in state"),new Error("No model found in state");let C=Vi;const T=d,{joinedPositiveStylePrompt:k,joinedNegativeStylePrompt:P}=Zd(e),$={id:b0,nodes:{[C]:{type:"sdxl_model_loader",id:C,model:o},[Be]:{type:"sdxl_compel_prompt",id:Be,prompt:r,style:k},[We]:{type:"sdxl_compel_prompt",id:We,prompt:i,style:P},[Le]:{type:"noise",id:Le,is_intermediate:w,use_cpu:T,seed:l,width:x?g.width:b,height:x?g.height:v},[Hn]:{type:"i2l",id:Hn,is_intermediate:w,fp32:S},[ke]:{type:"denoise_latents",id:ke,is_intermediate:w,cfg_scale:a,scheduler:s,steps:u,denoising_start:p?Math.min(m,1-_):1-_,denoising_end:p?m:1}},edges:[{source:{node_id:C,field:"unet"},destination:{node_id:ke,field:"unet"}},{source:{node_id:C,field:"clip"},destination:{node_id:Be,field:"clip"}},{source:{node_id:C,field:"clip2"},destination:{node_id:Be,field:"clip2"}},{source:{node_id:C,field:"clip"},destination:{node_id:We,field:"clip"}},{source:{node_id:C,field:"clip2"},destination:{node_id:We,field:"clip2"}},{source:{node_id:Be,field:"conditioning"},destination:{node_id:ke,field:"positive_conditioning"}},{source:{node_id:We,field:"conditioning"},destination:{node_id:ke,field:"negative_conditioning"}},{source:{node_id:Le,field:"noise"},destination:{node_id:ke,field:"noise"}},{source:{node_id:Hn,field:"latents"},destination:{node_id:ke,field:"latents"}}]};return x?($.nodes[bh]={id:bh,type:"img_resize",is_intermediate:w,image:t,width:g.width,height:g.height},$.nodes[Ke]={id:Ke,type:"l2i",is_intermediate:w,fp32:S},$.nodes[ye]={id:ye,type:"img_resize",is_intermediate:w,width:b,height:v},$.edges.push({source:{node_id:bh,field:"image"},destination:{node_id:Hn,field:"image"}},{source:{node_id:ke,field:"latents"},destination:{node_id:Ke,field:"latents"}},{source:{node_id:Ke,field:"image"},destination:{node_id:ye,field:"image"}})):($.nodes[ye]={type:"l2i",id:ye,is_intermediate:w,fp32:S},$.nodes[Hn].image=t,$.edges.push({source:{node_id:ke,field:"latents"},destination:{node_id:ye,field:"latents"}})),$.nodes[ht]={id:ht,type:"metadata_accumulator",generation_mode:"img2img",cfg_scale:a,width:x?g.width:b,height:x?g.height:v,positive_prompt:r,negative_prompt:i,model:o,seed:l,steps:u,rand_device:T?"cpu":"cuda",scheduler:s,vae:void 0,controlnets:[],loras:[],ipAdapters:[],strength:_,init_image:t.image_name},$.edges.push({source:{node_id:ht,field:"metadata"},destination:{node_id:ye,field:"metadata"}}),(f||h)&&(Oa(e,$,C),C=qr),p&&(Ap(e,$,ke,C),(f||h)&&(C=Qa)),Ma(e,$,C),Tp(e,$,ke,C),Aa(e,$,ke),Pa(e,$,ke),e.system.shouldUseNSFWChecker&&Ia(e,$,ye),e.system.shouldUseWatermarker&&Na(e,$,ye),Ra(e,$),$},aEe=(e,t,n)=>{const r=_e("nodes"),{positivePrompt:i,negativePrompt:o,model:a,cfgScale:s,scheduler:l,steps:u,seed:c,vaePrecision:d,shouldUseCpuNoise:f,maskBlur:h,maskBlurMethod:p,canvasCoherenceMode:m,canvasCoherenceSteps:_,canvasCoherenceStrength:b,seamlessXAxis:v,seamlessYAxis:g}=e.generation,{sdxlImg2ImgDenoisingStrength:y,shouldUseSDXLRefiner:S,refinerStart:w}=e.sdxl;if(!a)throw r.error("No model found in state"),new Error("No model found in state");const{width:x,height:C}=e.canvas.boundingBoxDimensions,{scaledBoundingBoxDimensions:T,boundingBoxScaleMethod:k}=e.canvas,P=d==="fp32",$=!0,O=["auto","manual"].includes(k);let E=Vi;const A=f,{joinedPositiveStylePrompt:D,joinedNegativeStylePrompt:L}=Zd(e),M={id:cc,nodes:{[E]:{type:"sdxl_model_loader",id:E,model:a},[Be]:{type:"sdxl_compel_prompt",id:Be,prompt:i,style:D},[We]:{type:"sdxl_compel_prompt",id:We,prompt:o,style:L},[Ui]:{type:"img_blur",id:Ui,is_intermediate:$,radius:h,blur_type:p},[Wn]:{type:"i2l",id:Wn,is_intermediate:$,fp32:P},[Le]:{type:"noise",id:Le,use_cpu:A,seed:c,is_intermediate:$},[qn]:{type:"create_denoise_mask",id:qn,is_intermediate:$,fp32:P},[ke]:{type:"denoise_latents",id:ke,is_intermediate:$,steps:u,cfg_scale:s,scheduler:l,denoising_start:S?Math.min(w,1-y):1-y,denoising_end:S?w:1},[Ut]:{type:"noise",id:Ut,use_cpu:A,seed:c+1,is_intermediate:$},[uc]:{type:"add",id:uc,b:1,is_intermediate:$},[pt]:{type:"denoise_latents",id:pt,is_intermediate:$,steps:_,cfg_scale:s,scheduler:l,denoising_start:1-b,denoising_end:1},[Ke]:{type:"l2i",id:Ke,is_intermediate:$,fp32:P},[ye]:{type:"color_correct",id:ye,is_intermediate:$,reference:t}},edges:[{source:{node_id:E,field:"unet"},destination:{node_id:ke,field:"unet"}},{source:{node_id:E,field:"clip"},destination:{node_id:Be,field:"clip"}},{source:{node_id:E,field:"clip2"},destination:{node_id:Be,field:"clip2"}},{source:{node_id:E,field:"clip"},destination:{node_id:We,field:"clip"}},{source:{node_id:E,field:"clip2"},destination:{node_id:We,field:"clip2"}},{source:{node_id:Be,field:"conditioning"},destination:{node_id:ke,field:"positive_conditioning"}},{source:{node_id:We,field:"conditioning"},destination:{node_id:ke,field:"negative_conditioning"}},{source:{node_id:Le,field:"noise"},destination:{node_id:ke,field:"noise"}},{source:{node_id:Wn,field:"latents"},destination:{node_id:ke,field:"latents"}},{source:{node_id:Ui,field:"image"},destination:{node_id:qn,field:"mask"}},{source:{node_id:qn,field:"denoise_mask"},destination:{node_id:ke,field:"denoise_mask"}},{source:{node_id:E,field:"unet"},destination:{node_id:pt,field:"unet"}},{source:{node_id:Be,field:"conditioning"},destination:{node_id:pt,field:"positive_conditioning"}},{source:{node_id:We,field:"conditioning"},destination:{node_id:pt,field:"negative_conditioning"}},{source:{node_id:Ut,field:"noise"},destination:{node_id:pt,field:"noise"}},{source:{node_id:ke,field:"latents"},destination:{node_id:pt,field:"latents"}},{source:{node_id:pt,field:"latents"},destination:{node_id:Ke,field:"latents"}}]};if(O){const R=T.width,N=T.height;M.nodes[Ai]={type:"img_resize",id:Ai,is_intermediate:$,width:R,height:N,image:t},M.nodes[Mn]={type:"img_resize",id:Mn,is_intermediate:$,width:R,height:N,image:n},M.nodes[Hi]={type:"img_resize",id:Hi,is_intermediate:$,width:x,height:C},M.nodes[qi]={type:"img_resize",id:qi,is_intermediate:$,width:x,height:C},M.nodes[Le].width=R,M.nodes[Le].height=N,M.nodes[Ut].width=R,M.nodes[Ut].height=N,M.edges.push({source:{node_id:Ai,field:"image"},destination:{node_id:Wn,field:"image"}},{source:{node_id:Mn,field:"image"},destination:{node_id:Ui,field:"image"}},{source:{node_id:Ai,field:"image"},destination:{node_id:qn,field:"image"}},{source:{node_id:Ke,field:"image"},destination:{node_id:Hi,field:"image"}},{source:{node_id:Hi,field:"image"},destination:{node_id:ye,field:"image"}},{source:{node_id:Ui,field:"image"},destination:{node_id:qi,field:"image"}},{source:{node_id:qi,field:"image"},destination:{node_id:ye,field:"mask"}})}else M.nodes[Le].width=x,M.nodes[Le].height=C,M.nodes[Ut].width=x,M.nodes[Ut].height=C,M.nodes[Wn]={...M.nodes[Wn],image:t},M.nodes[Ui]={...M.nodes[Ui],image:n},M.nodes[qn]={...M.nodes[qn],image:t},M.edges.push({source:{node_id:Ke,field:"image"},destination:{node_id:ye,field:"image"}},{source:{node_id:Ui,field:"image"},destination:{node_id:ye,field:"mask"}});return m!=="unmasked"&&(M.nodes[zt]={type:"create_denoise_mask",id:zt,is_intermediate:$,fp32:P},O?M.edges.push({source:{node_id:Ai,field:"image"},destination:{node_id:zt,field:"image"}}):M.nodes[zt]={...M.nodes[zt],image:t},m==="mask"&&(O?M.edges.push({source:{node_id:Mn,field:"image"},destination:{node_id:zt,field:"mask"}}):M.nodes[zt]={...M.nodes[zt],mask:n}),m==="edge"&&(M.nodes[mr]={type:"mask_edge",id:mr,is_intermediate:$,edge_blur:h,edge_size:h*2,low_threshold:100,high_threshold:200},O?M.edges.push({source:{node_id:Mn,field:"image"},destination:{node_id:mr,field:"image"}}):M.nodes[mr]={...M.nodes[mr],image:n},M.edges.push({source:{node_id:mr,field:"image"},destination:{node_id:zt,field:"mask"}})),M.edges.push({source:{node_id:zt,field:"denoise_mask"},destination:{node_id:pt,field:"denoise_mask"}})),(v||g)&&(Oa(e,M,E),E=qr),S&&(Ap(e,M,pt,E,t,n),(v||g)&&(E=Qa)),Ma(e,M,E),Tp(e,M,ke,E),Aa(e,M,ke),Pa(e,M,ke),e.system.shouldUseNSFWChecker&&Ia(e,M,ye),e.system.shouldUseWatermarker&&Na(e,M,ye),Ra(e,M),M},sEe=(e,t,n)=>{const r=_e("nodes"),{positivePrompt:i,negativePrompt:o,model:a,cfgScale:s,scheduler:l,steps:u,seed:c,vaePrecision:d,shouldUseCpuNoise:f,maskBlur:h,canvasCoherenceMode:p,canvasCoherenceSteps:m,canvasCoherenceStrength:_,infillTileSize:b,infillPatchmatchDownscaleSize:v,infillMethod:g,seamlessXAxis:y,seamlessYAxis:S}=e.generation,{sdxlImg2ImgDenoisingStrength:w,shouldUseSDXLRefiner:x,refinerStart:C}=e.sdxl;if(!a)throw r.error("No model found in state"),new Error("No model found in state");const{width:T,height:k}=e.canvas.boundingBoxDimensions,{scaledBoundingBoxDimensions:P,boundingBoxScaleMethod:$}=e.canvas,O=d==="fp32",E=!0,A=["auto","manual"].includes($);let D=Vi;const L=f,{joinedPositiveStylePrompt:M,joinedNegativeStylePrompt:R}=Zd(e),N={id:dc,nodes:{[Vi]:{type:"sdxl_model_loader",id:Vi,model:a},[Be]:{type:"sdxl_compel_prompt",id:Be,prompt:i,style:M},[We]:{type:"sdxl_compel_prompt",id:We,prompt:o,style:R},[_h]:{type:"tomask",id:_h,is_intermediate:E,image:t},[ki]:{type:"mask_combine",id:ki,is_intermediate:E,mask2:n},[Wn]:{type:"i2l",id:Wn,is_intermediate:E,fp32:O},[Le]:{type:"noise",id:Le,use_cpu:L,seed:c,is_intermediate:E},[qn]:{type:"create_denoise_mask",id:qn,is_intermediate:E,fp32:O},[ke]:{type:"denoise_latents",id:ke,is_intermediate:E,steps:u,cfg_scale:s,scheduler:l,denoising_start:x?Math.min(C,1-w):1-w,denoising_end:x?C:1},[Ut]:{type:"noise",id:Ut,use_cpu:L,seed:c+1,is_intermediate:E},[uc]:{type:"add",id:uc,b:1,is_intermediate:E},[pt]:{type:"denoise_latents",id:pt,is_intermediate:E,steps:m,cfg_scale:s,scheduler:l,denoising_start:1-_,denoising_end:1},[Ke]:{type:"l2i",id:Ke,is_intermediate:E,fp32:O},[ye]:{type:"color_correct",id:ye,is_intermediate:E}},edges:[{source:{node_id:Vi,field:"unet"},destination:{node_id:ke,field:"unet"}},{source:{node_id:Vi,field:"clip"},destination:{node_id:Be,field:"clip"}},{source:{node_id:Vi,field:"clip2"},destination:{node_id:Be,field:"clip2"}},{source:{node_id:Vi,field:"clip"},destination:{node_id:We,field:"clip"}},{source:{node_id:Vi,field:"clip2"},destination:{node_id:We,field:"clip2"}},{source:{node_id:Wt,field:"image"},destination:{node_id:Wn,field:"image"}},{source:{node_id:_h,field:"image"},destination:{node_id:ki,field:"mask1"}},{source:{node_id:Be,field:"conditioning"},destination:{node_id:ke,field:"positive_conditioning"}},{source:{node_id:We,field:"conditioning"},destination:{node_id:ke,field:"negative_conditioning"}},{source:{node_id:Le,field:"noise"},destination:{node_id:ke,field:"noise"}},{source:{node_id:Wn,field:"latents"},destination:{node_id:ke,field:"latents"}},{source:{node_id:A?Mn:ki,field:"image"},destination:{node_id:qn,field:"mask"}},{source:{node_id:qn,field:"denoise_mask"},destination:{node_id:ke,field:"denoise_mask"}},{source:{node_id:D,field:"unet"},destination:{node_id:pt,field:"unet"}},{source:{node_id:Be,field:"conditioning"},destination:{node_id:pt,field:"positive_conditioning"}},{source:{node_id:We,field:"conditioning"},destination:{node_id:pt,field:"negative_conditioning"}},{source:{node_id:Ut,field:"noise"},destination:{node_id:pt,field:"noise"}},{source:{node_id:ke,field:"latents"},destination:{node_id:pt,field:"latents"}},{source:{node_id:Wt,field:"image"},destination:{node_id:qn,field:"image"}},{source:{node_id:pt,field:"latents"},destination:{node_id:Ke,field:"latents"}}]};if(g==="patchmatch"&&(N.nodes[Wt]={type:"infill_patchmatch",id:Wt,is_intermediate:E,downscale:v}),g==="lama"&&(N.nodes[Wt]={type:"infill_lama",id:Wt,is_intermediate:E}),g==="cv2"&&(N.nodes[Wt]={type:"infill_cv2",id:Wt,is_intermediate:E}),g==="tile"&&(N.nodes[Wt]={type:"infill_tile",id:Wt,is_intermediate:E,tile_size:b}),A){const B=P.width,U=P.height;N.nodes[Ai]={type:"img_resize",id:Ai,is_intermediate:E,width:B,height:U,image:t},N.nodes[Mn]={type:"img_resize",id:Mn,is_intermediate:E,width:B,height:U},N.nodes[Hi]={type:"img_resize",id:Hi,is_intermediate:E,width:T,height:k},N.nodes[$u]={type:"img_resize",id:$u,is_intermediate:E,width:T,height:k},N.nodes[qi]={type:"img_resize",id:qi,is_intermediate:E,width:T,height:k},N.nodes[Le].width=B,N.nodes[Le].height=U,N.nodes[Ut].width=B,N.nodes[Ut].height=U,N.edges.push({source:{node_id:Ai,field:"image"},destination:{node_id:Wt,field:"image"}},{source:{node_id:ki,field:"image"},destination:{node_id:Mn,field:"image"}},{source:{node_id:Ke,field:"image"},destination:{node_id:Hi,field:"image"}},{source:{node_id:Mn,field:"image"},destination:{node_id:qi,field:"image"}},{source:{node_id:Wt,field:"image"},destination:{node_id:$u,field:"image"}},{source:{node_id:$u,field:"image"},destination:{node_id:ye,field:"reference"}},{source:{node_id:Hi,field:"image"},destination:{node_id:ye,field:"image"}},{source:{node_id:qi,field:"image"},destination:{node_id:ye,field:"mask"}})}else N.nodes[Wt]={...N.nodes[Wt],image:t},N.nodes[Le].width=T,N.nodes[Le].height=k,N.nodes[Ut].width=T,N.nodes[Ut].height=k,N.nodes[Wn]={...N.nodes[Wn],image:t},N.edges.push({source:{node_id:Wt,field:"image"},destination:{node_id:ye,field:"reference"}},{source:{node_id:Ke,field:"image"},destination:{node_id:ye,field:"image"}},{source:{node_id:ki,field:"image"},destination:{node_id:ye,field:"mask"}});return p!=="unmasked"&&(N.nodes[zt]={type:"create_denoise_mask",id:zt,is_intermediate:E,fp32:O},N.edges.push({source:{node_id:Wt,field:"image"},destination:{node_id:zt,field:"image"}}),p==="mask"&&(A?N.edges.push({source:{node_id:Mn,field:"image"},destination:{node_id:zt,field:"mask"}}):N.edges.push({source:{node_id:ki,field:"image"},destination:{node_id:zt,field:"mask"}})),p==="edge"&&(N.nodes[mr]={type:"mask_edge",id:mr,is_intermediate:E,edge_blur:h,edge_size:h*2,low_threshold:100,high_threshold:200},A?N.edges.push({source:{node_id:Mn,field:"image"},destination:{node_id:mr,field:"image"}}):N.edges.push({source:{node_id:ki,field:"image"},destination:{node_id:mr,field:"image"}}),N.edges.push({source:{node_id:mr,field:"image"},destination:{node_id:zt,field:"mask"}})),N.edges.push({source:{node_id:zt,field:"denoise_mask"},destination:{node_id:pt,field:"denoise_mask"}})),(y||S)&&(Oa(e,N,D),D=qr),x&&(Ap(e,N,pt,D,t),(y||S)&&(D=Qa)),Ma(e,N,D),Tp(e,N,ke,D),Aa(e,N,ke),Pa(e,N,ke),e.system.shouldUseNSFWChecker&&Ia(e,N,ye),e.system.shouldUseWatermarker&&Na(e,N,ye),Ra(e,N),N},lEe=e=>{const t=_e("nodes"),{positivePrompt:n,negativePrompt:r,model:i,cfgScale:o,scheduler:a,seed:s,steps:l,vaePrecision:u,shouldUseCpuNoise:c,seamlessXAxis:d,seamlessYAxis:f}=e.generation,{width:h,height:p}=e.canvas.boundingBoxDimensions,{scaledBoundingBoxDimensions:m,boundingBoxScaleMethod:_}=e.canvas,b=u==="fp32",v=!0,g=["auto","manual"].includes(_),{shouldUseSDXLRefiner:y,refinerStart:S}=e.sdxl;if(!i)throw t.error("No model found in state"),new Error("No model found in state");const w=c,x=i.model_type==="onnx";let C=x?Wx:Vi;const T=x?"onnx_model_loader":"sdxl_model_loader",k=x?{type:"t2l_onnx",id:ke,is_intermediate:v,cfg_scale:o,scheduler:a,steps:l}:{type:"denoise_latents",id:ke,is_intermediate:v,cfg_scale:o,scheduler:a,steps:l,denoising_start:0,denoising_end:y?S:1},{joinedPositiveStylePrompt:P,joinedNegativeStylePrompt:$}=Zd(e),O={id:Xx,nodes:{[C]:{type:T,id:C,is_intermediate:v,model:i},[Be]:{type:x?"prompt_onnx":"sdxl_compel_prompt",id:Be,is_intermediate:v,prompt:n,style:P},[We]:{type:x?"prompt_onnx":"sdxl_compel_prompt",id:We,is_intermediate:v,prompt:r,style:$},[Le]:{type:"noise",id:Le,is_intermediate:v,seed:s,width:g?m.width:h,height:g?m.height:p,use_cpu:w},[k.id]:k},edges:[{source:{node_id:C,field:"unet"},destination:{node_id:ke,field:"unet"}},{source:{node_id:C,field:"clip"},destination:{node_id:Be,field:"clip"}},{source:{node_id:C,field:"clip2"},destination:{node_id:Be,field:"clip2"}},{source:{node_id:C,field:"clip"},destination:{node_id:We,field:"clip"}},{source:{node_id:C,field:"clip2"},destination:{node_id:We,field:"clip2"}},{source:{node_id:Be,field:"conditioning"},destination:{node_id:ke,field:"positive_conditioning"}},{source:{node_id:We,field:"conditioning"},destination:{node_id:ke,field:"negative_conditioning"}},{source:{node_id:Le,field:"noise"},destination:{node_id:ke,field:"noise"}}]};return g?(O.nodes[Ke]={id:Ke,type:x?"l2i_onnx":"l2i",is_intermediate:v,fp32:b},O.nodes[ye]={id:ye,type:"img_resize",is_intermediate:v,width:h,height:p},O.edges.push({source:{node_id:ke,field:"latents"},destination:{node_id:Ke,field:"latents"}},{source:{node_id:Ke,field:"image"},destination:{node_id:ye,field:"image"}})):(O.nodes[ye]={type:x?"l2i_onnx":"l2i",id:ye,is_intermediate:v,fp32:b},O.edges.push({source:{node_id:ke,field:"latents"},destination:{node_id:ye,field:"latents"}})),O.nodes[ht]={id:ht,type:"metadata_accumulator",generation_mode:"txt2img",cfg_scale:o,width:g?m.width:h,height:g?m.height:p,positive_prompt:n,negative_prompt:r,model:i,seed:s,steps:l,rand_device:w?"cpu":"cuda",scheduler:a,vae:void 0,controlnets:[],loras:[],ipAdapters:[]},O.edges.push({source:{node_id:ht,field:"metadata"},destination:{node_id:ye,field:"metadata"}}),(d||f)&&(Oa(e,O,C),C=qr),y&&(Ap(e,O,ke,C),(d||f)&&(C=Qa)),Tp(e,O,ke,C),Ma(e,O,C),Aa(e,O,ke),Pa(e,O,ke),e.system.shouldUseNSFWChecker&&Ia(e,O,ye),e.system.shouldUseWatermarker&&Na(e,O,ye),Ra(e,O),O},uEe=e=>{const t=_e("nodes"),{positivePrompt:n,negativePrompt:r,model:i,cfgScale:o,scheduler:a,seed:s,steps:l,vaePrecision:u,clipSkip:c,shouldUseCpuNoise:d,seamlessXAxis:f,seamlessYAxis:h}=e.generation,{width:p,height:m}=e.canvas.boundingBoxDimensions,{scaledBoundingBoxDimensions:_,boundingBoxScaleMethod:b}=e.canvas,v=u==="fp32",g=!0,y=["auto","manual"].includes(b);if(!i)throw t.error("No model found in state"),new Error("No model found in state");const S=d,w=i.model_type==="onnx";let x=w?Wx:Tc;const C=w?"onnx_model_loader":"main_model_loader",T=w?{type:"t2l_onnx",id:Oe,is_intermediate:g,cfg_scale:o,scheduler:a,steps:l}:{type:"denoise_latents",id:Oe,is_intermediate:g,cfg_scale:o,scheduler:a,steps:l,denoising_start:0,denoising_end:1},k={id:JG,nodes:{[x]:{type:C,id:x,is_intermediate:g,model:i},[Yt]:{type:"clip_skip",id:Yt,is_intermediate:g,skipped_layers:c},[Be]:{type:w?"prompt_onnx":"compel",id:Be,is_intermediate:g,prompt:n},[We]:{type:w?"prompt_onnx":"compel",id:We,is_intermediate:g,prompt:r},[Le]:{type:"noise",id:Le,is_intermediate:g,seed:s,width:y?_.width:p,height:y?_.height:m,use_cpu:S},[T.id]:T},edges:[{source:{node_id:x,field:"unet"},destination:{node_id:Oe,field:"unet"}},{source:{node_id:x,field:"clip"},destination:{node_id:Yt,field:"clip"}},{source:{node_id:Yt,field:"clip"},destination:{node_id:Be,field:"clip"}},{source:{node_id:Yt,field:"clip"},destination:{node_id:We,field:"clip"}},{source:{node_id:Be,field:"conditioning"},destination:{node_id:Oe,field:"positive_conditioning"}},{source:{node_id:We,field:"conditioning"},destination:{node_id:Oe,field:"negative_conditioning"}},{source:{node_id:Le,field:"noise"},destination:{node_id:Oe,field:"noise"}}]};return y?(k.nodes[Ke]={id:Ke,type:w?"l2i_onnx":"l2i",is_intermediate:g,fp32:v},k.nodes[ye]={id:ye,type:"img_resize",is_intermediate:g,width:p,height:m},k.edges.push({source:{node_id:Oe,field:"latents"},destination:{node_id:Ke,field:"latents"}},{source:{node_id:Ke,field:"image"},destination:{node_id:ye,field:"image"}})):(k.nodes[ye]={type:w?"l2i_onnx":"l2i",id:ye,is_intermediate:g,fp32:v},k.edges.push({source:{node_id:Oe,field:"latents"},destination:{node_id:ye,field:"latents"}})),k.nodes[ht]={id:ht,type:"metadata_accumulator",generation_mode:"txt2img",cfg_scale:o,width:y?_.width:p,height:y?_.height:m,positive_prompt:n,negative_prompt:r,model:i,seed:s,steps:l,rand_device:S?"cpu":"cuda",scheduler:a,vae:void 0,controlnets:[],loras:[],ipAdapters:[],clip_skip:c},k.edges.push({source:{node_id:ht,field:"metadata"},destination:{node_id:ye,field:"metadata"}}),(f||h)&&(Oa(e,k,x),x=qr),Ma(e,k,x),kp(e,k,Oe,x),Aa(e,k,Oe),Pa(e,k,Oe),e.system.shouldUseNSFWChecker&&Ia(e,k,ye),e.system.shouldUseWatermarker&&Na(e,k,ye),Ra(e,k),k},cEe=(e,t,n,r)=>{let i;if(t==="txt2img")e.generation.model&&e.generation.model.base_model==="sdxl"?i=lEe(e):i=uEe(e);else if(t==="img2img"){if(!n)throw new Error("Missing canvas init image");e.generation.model&&e.generation.model.base_model==="sdxl"?i=oEe(e,n):i=nEe(e,n)}else if(t==="inpaint"){if(!n||!r)throw new Error("Missing canvas init and mask images");e.generation.model&&e.generation.model.base_model==="sdxl"?i=aEe(e,n,r):i=rEe(e,n,r)}else{if(!n)throw new Error("Missing canvas init image");e.generation.model&&e.generation.model.base_model==="sdxl"?i=sEe(e,n,r):i=iEe(e,n,r)}return i},r5=({count:e,start:t,min:n=$ae,max:r=Gg})=>{const i=t??dae(n,r),o=[];for(let a=i;a{const{iterations:r,model:i,shouldRandomizeSeed:o,seed:a}=e.generation,{shouldConcatSDXLStylePrompt:s,positiveStylePrompt:l}=e.sdxl,{prompts:u,seedBehaviour:c}=e.dynamicPrompts,d=[];if(u.length===1){X8(t.nodes[ht],"seed");const h=r5({count:r,start:o?void 0:a}),p=[];t.nodes[Le]&&p.push({node_path:Le,field_name:"seed",items:h}),t.nodes[ht]&&p.push({node_path:ht,field_name:"seed",items:h}),t.nodes[Ut]&&p.push({node_path:Ut,field_name:"seed",items:h.map(m=>(m+1)%Gg)}),d.push(p)}else{const h=[],p=[];if(c==="PER_PROMPT"){const _=r5({count:u.length*r,start:o?void 0:a});t.nodes[Le]&&h.push({node_path:Le,field_name:"seed",items:_}),t.nodes[ht]&&h.push({node_path:ht,field_name:"seed",items:_}),t.nodes[Ut]&&h.push({node_path:Ut,field_name:"seed",items:_.map(b=>(b+1)%Gg)})}else{const _=r5({count:r,start:o?void 0:a});t.nodes[Le]&&p.push({node_path:Le,field_name:"seed",items:_}),t.nodes[ht]&&p.push({node_path:ht,field_name:"seed",items:_}),t.nodes[Ut]&&p.push({node_path:Ut,field_name:"seed",items:_.map(b=>(b+1)%Gg)}),d.push(p)}const m=c==="PER_PROMPT"?yae(r).flatMap(()=>u):u;if(t.nodes[Be]&&h.push({node_path:Be,field_name:"prompt",items:m}),t.nodes[ht]&&h.push({node_path:ht,field_name:"positive_prompt",items:m}),s&&(i==null?void 0:i.base_model)==="sdxl"){X8(t.nodes[ht],"positive_style_prompt");const _=m.map(b=>[b,l].join(" "));t.nodes[Be]&&h.push({node_path:Be,field_name:"style",items:_}),t.nodes[ht]&&h.push({node_path:ht,field_name:"positive_style_prompt",items:_})}d.push(h)}return{prepend:n,batch:{graph:t,runs:1,data:d}}},dEe=()=>{Fe({predicate:e=>NA.match(e)&&e.payload.tabName==="unifiedCanvas",effect:async(e,{getState:t,dispatch:n})=>{const r=_e("queue"),{prepend:i}=e.payload,o=t(),{layerState:a,boundingBoxCoordinates:s,boundingBoxDimensions:l,isMaskEnabled:u,shouldPreserveMaskedArea:c}=o.canvas,d=await OA(a,s,l,u,c);if(!d){r.error("Unable to create canvas data");return}const{baseBlob:f,baseImageData:h,maskBlob:p,maskImageData:m}=d,_=J3e(h,m);if(o.system.enableImageDebugging){const S=await DO(f),w=await DO(p);X3e([{base64:w,caption:"mask b64"},{base64:S,caption:"image b64"}])}r.debug(`Generation mode: ${_}`);let b,v;["img2img","inpaint","outpaint"].includes(_)&&(b=await n(me.endpoints.uploadImage.initiate({file:new File([f],"canvasInitImage.png",{type:"image/png"}),image_category:"general",is_intermediate:!0})).unwrap()),["inpaint","outpaint"].includes(_)&&(v=await n(me.endpoints.uploadImage.initiate({file:new File([p],"canvasMaskImage.png",{type:"image/png"}),image_category:"mask",is_intermediate:!0})).unwrap());const g=cEe(o,_,b,v);r.debug({graph:Qt(g)},"Canvas graph built"),n(cG(g));const y=tH(o,g,i);try{const S=n(Qr.endpoints.enqueueBatch.initiate(y,{fixedCacheKey:"enqueueBatch"})),w=await S.unwrap();S.reset();const x=w.batch.batch_id;o.canvas.layerState.stagingArea.boundingBox||n(cle({boundingBox:{...o.canvas.boundingBoxCoordinates,...o.canvas.boundingBoxDimensions}})),n(dle(x))}catch{}}})},fEe=e=>{const t=_e("nodes"),{positivePrompt:n,negativePrompt:r,model:i,cfgScale:o,scheduler:a,seed:s,steps:l,initialImage:u,img2imgStrength:c,shouldFitToWidthHeight:d,width:f,height:h,clipSkip:p,shouldUseCpuNoise:m,vaePrecision:_,seamlessXAxis:b,seamlessYAxis:v}=e.generation;if(!u)throw t.error("No initial image found in state"),new Error("No initial image found in state");if(!i)throw t.error("No model found in state"),new Error("No model found in state");const g=_==="fp32",y=!0;let S=Tc;const w=m,x={id:JE,nodes:{[S]:{type:"main_model_loader",id:S,model:i,is_intermediate:y},[Yt]:{type:"clip_skip",id:Yt,skipped_layers:p,is_intermediate:y},[Be]:{type:"compel",id:Be,prompt:n,is_intermediate:y},[We]:{type:"compel",id:We,prompt:r,is_intermediate:y},[Le]:{type:"noise",id:Le,use_cpu:w,seed:s,is_intermediate:y},[Ke]:{type:"l2i",id:Ke,fp32:g,is_intermediate:y},[Oe]:{type:"denoise_latents",id:Oe,cfg_scale:o,scheduler:a,steps:l,denoising_start:1-c,denoising_end:1,is_intermediate:y},[Hn]:{type:"i2l",id:Hn,fp32:g,is_intermediate:y}},edges:[{source:{node_id:S,field:"unet"},destination:{node_id:Oe,field:"unet"}},{source:{node_id:S,field:"clip"},destination:{node_id:Yt,field:"clip"}},{source:{node_id:Yt,field:"clip"},destination:{node_id:Be,field:"clip"}},{source:{node_id:Yt,field:"clip"},destination:{node_id:We,field:"clip"}},{source:{node_id:Be,field:"conditioning"},destination:{node_id:Oe,field:"positive_conditioning"}},{source:{node_id:We,field:"conditioning"},destination:{node_id:Oe,field:"negative_conditioning"}},{source:{node_id:Le,field:"noise"},destination:{node_id:Oe,field:"noise"}},{source:{node_id:Hn,field:"latents"},destination:{node_id:Oe,field:"latents"}},{source:{node_id:Oe,field:"latents"},destination:{node_id:Ke,field:"latents"}}]};if(d&&(u.width!==f||u.height!==h)){const C={id:Rs,type:"img_resize",image:{image_name:u.imageName},is_intermediate:!0,width:f,height:h};x.nodes[Rs]=C,x.edges.push({source:{node_id:Rs,field:"image"},destination:{node_id:Hn,field:"image"}}),x.edges.push({source:{node_id:Rs,field:"width"},destination:{node_id:Le,field:"width"}}),x.edges.push({source:{node_id:Rs,field:"height"},destination:{node_id:Le,field:"height"}})}else x.nodes[Hn].image={image_name:u.imageName},x.edges.push({source:{node_id:Hn,field:"width"},destination:{node_id:Le,field:"width"}}),x.edges.push({source:{node_id:Hn,field:"height"},destination:{node_id:Le,field:"height"}});return x.nodes[ht]={id:ht,type:"metadata_accumulator",generation_mode:"img2img",cfg_scale:o,height:h,width:f,positive_prompt:n,negative_prompt:r,model:i,seed:s,steps:l,rand_device:w?"cpu":"cuda",scheduler:a,vae:void 0,controlnets:[],loras:[],ipAdapters:[],clip_skip:p,strength:c,init_image:u.imageName},x.edges.push({source:{node_id:ht,field:"metadata"},destination:{node_id:Ke,field:"metadata"}}),(b||v)&&(Oa(e,x,S),S=qr),Ma(e,x,S),kp(e,x,Oe,S),Aa(e,x,Oe),Pa(e,x,Oe),e.system.shouldUseNSFWChecker&&Ia(e,x),e.system.shouldUseWatermarker&&Na(e,x),Ra(e,x),x},hEe=e=>{const t=_e("nodes"),{positivePrompt:n,negativePrompt:r,model:i,cfgScale:o,scheduler:a,seed:s,steps:l,initialImage:u,shouldFitToWidthHeight:c,width:d,height:f,shouldUseCpuNoise:h,vaePrecision:p,seamlessXAxis:m,seamlessYAxis:_}=e.generation,{positiveStylePrompt:b,negativeStylePrompt:v,shouldUseSDXLRefiner:g,refinerStart:y,sdxlImg2ImgDenoisingStrength:S}=e.sdxl;if(!u)throw t.error("No initial image found in state"),new Error("No initial image found in state");if(!i)throw t.error("No model found in state"),new Error("No model found in state");const w=p==="fp32",x=!0;let C=Vi;const T=h,{joinedPositiveStylePrompt:k,joinedNegativeStylePrompt:P}=Zd(e),$={id:z_,nodes:{[C]:{type:"sdxl_model_loader",id:C,model:i,is_intermediate:x},[Be]:{type:"sdxl_compel_prompt",id:Be,prompt:n,style:k,is_intermediate:x},[We]:{type:"sdxl_compel_prompt",id:We,prompt:r,style:P,is_intermediate:x},[Le]:{type:"noise",id:Le,use_cpu:T,seed:s,is_intermediate:x},[Ke]:{type:"l2i",id:Ke,fp32:w,is_intermediate:x},[ke]:{type:"denoise_latents",id:ke,cfg_scale:o,scheduler:a,steps:l,denoising_start:g?Math.min(y,1-S):1-S,denoising_end:g?y:1,is_intermediate:x},[Hn]:{type:"i2l",id:Hn,fp32:w,is_intermediate:x}},edges:[{source:{node_id:C,field:"unet"},destination:{node_id:ke,field:"unet"}},{source:{node_id:C,field:"clip"},destination:{node_id:Be,field:"clip"}},{source:{node_id:C,field:"clip2"},destination:{node_id:Be,field:"clip2"}},{source:{node_id:C,field:"clip"},destination:{node_id:We,field:"clip"}},{source:{node_id:C,field:"clip2"},destination:{node_id:We,field:"clip2"}},{source:{node_id:Be,field:"conditioning"},destination:{node_id:ke,field:"positive_conditioning"}},{source:{node_id:We,field:"conditioning"},destination:{node_id:ke,field:"negative_conditioning"}},{source:{node_id:Le,field:"noise"},destination:{node_id:ke,field:"noise"}},{source:{node_id:Hn,field:"latents"},destination:{node_id:ke,field:"latents"}},{source:{node_id:ke,field:"latents"},destination:{node_id:Ke,field:"latents"}}]};if(c&&(u.width!==d||u.height!==f)){const O={id:Rs,type:"img_resize",image:{image_name:u.imageName},is_intermediate:!0,width:d,height:f};$.nodes[Rs]=O,$.edges.push({source:{node_id:Rs,field:"image"},destination:{node_id:Hn,field:"image"}}),$.edges.push({source:{node_id:Rs,field:"width"},destination:{node_id:Le,field:"width"}}),$.edges.push({source:{node_id:Rs,field:"height"},destination:{node_id:Le,field:"height"}})}else $.nodes[Hn].image={image_name:u.imageName},$.edges.push({source:{node_id:Hn,field:"width"},destination:{node_id:Le,field:"width"}}),$.edges.push({source:{node_id:Hn,field:"height"},destination:{node_id:Le,field:"height"}});return $.nodes[ht]={id:ht,type:"metadata_accumulator",generation_mode:"sdxl_img2img",cfg_scale:o,height:f,width:d,positive_prompt:n,negative_prompt:r,model:i,seed:s,steps:l,rand_device:T?"cpu":"cuda",scheduler:a,vae:void 0,controlnets:[],loras:[],ipAdapters:[],strength:S,init_image:u.imageName,positive_style_prompt:b,negative_style_prompt:v},$.edges.push({source:{node_id:ht,field:"metadata"},destination:{node_id:Ke,field:"metadata"}}),(m||_)&&(Oa(e,$,C),C=qr),g&&(Ap(e,$,ke),(m||_)&&(C=Qa)),Ma(e,$,C),Tp(e,$,ke,C),Aa(e,$,ke),Pa(e,$,ke),e.system.shouldUseNSFWChecker&&Ia(e,$),e.system.shouldUseWatermarker&&Na(e,$),Ra(e,$),$},pEe=e=>{const t=_e("nodes"),{positivePrompt:n,negativePrompt:r,model:i,cfgScale:o,scheduler:a,seed:s,steps:l,width:u,height:c,shouldUseCpuNoise:d,vaePrecision:f,seamlessXAxis:h,seamlessYAxis:p}=e.generation,{positiveStylePrompt:m,negativeStylePrompt:_,shouldUseSDXLRefiner:b,refinerStart:v}=e.sdxl,g=d;if(!i)throw t.error("No model found in state"),new Error("No model found in state");const y=f==="fp32",S=!0,{joinedPositiveStylePrompt:w,joinedNegativeStylePrompt:x}=Zd(e);let C=Vi;const T={id:MA,nodes:{[C]:{type:"sdxl_model_loader",id:C,model:i,is_intermediate:S},[Be]:{type:"sdxl_compel_prompt",id:Be,prompt:n,style:w,is_intermediate:S},[We]:{type:"sdxl_compel_prompt",id:We,prompt:r,style:x,is_intermediate:S},[Le]:{type:"noise",id:Le,seed:s,width:u,height:c,use_cpu:g,is_intermediate:S},[ke]:{type:"denoise_latents",id:ke,cfg_scale:o,scheduler:a,steps:l,denoising_start:0,denoising_end:b?v:1,is_intermediate:S},[Ke]:{type:"l2i",id:Ke,fp32:y,is_intermediate:S}},edges:[{source:{node_id:C,field:"unet"},destination:{node_id:ke,field:"unet"}},{source:{node_id:C,field:"clip"},destination:{node_id:Be,field:"clip"}},{source:{node_id:C,field:"clip2"},destination:{node_id:Be,field:"clip2"}},{source:{node_id:C,field:"clip"},destination:{node_id:We,field:"clip"}},{source:{node_id:C,field:"clip2"},destination:{node_id:We,field:"clip2"}},{source:{node_id:Be,field:"conditioning"},destination:{node_id:ke,field:"positive_conditioning"}},{source:{node_id:We,field:"conditioning"},destination:{node_id:ke,field:"negative_conditioning"}},{source:{node_id:Le,field:"noise"},destination:{node_id:ke,field:"noise"}},{source:{node_id:ke,field:"latents"},destination:{node_id:Ke,field:"latents"}}]};return T.nodes[ht]={id:ht,type:"metadata_accumulator",generation_mode:"sdxl_txt2img",cfg_scale:o,height:c,width:u,positive_prompt:n,negative_prompt:r,model:i,seed:s,steps:l,rand_device:g?"cpu":"cuda",scheduler:a,vae:void 0,controlnets:[],loras:[],ipAdapters:[],positive_style_prompt:m,negative_style_prompt:_},T.edges.push({source:{node_id:ht,field:"metadata"},destination:{node_id:Ke,field:"metadata"}}),(h||p)&&(Oa(e,T,C),C=qr),b&&(Ap(e,T,ke),(h||p)&&(C=Qa)),Ma(e,T,C),Tp(e,T,ke,C),Aa(e,T,ke),Pa(e,T,ke),e.system.shouldUseNSFWChecker&&Ia(e,T),e.system.shouldUseWatermarker&&Na(e,T),Ra(e,T),T},gEe=e=>{const t=_e("nodes"),{positivePrompt:n,negativePrompt:r,model:i,cfgScale:o,scheduler:a,steps:s,width:l,height:u,clipSkip:c,shouldUseCpuNoise:d,vaePrecision:f,seamlessXAxis:h,seamlessYAxis:p,seed:m}=e.generation,_=d;if(!i)throw t.error("No model found in state"),new Error("No model found in state");const b=f==="fp32",v=!0,g=i.model_type==="onnx";let y=g?Wx:Tc;const S=g?"onnx_model_loader":"main_model_loader",w=g?{type:"t2l_onnx",id:Oe,is_intermediate:v,cfg_scale:o,scheduler:a,steps:s}:{type:"denoise_latents",id:Oe,is_intermediate:v,cfg_scale:o,scheduler:a,steps:s,denoising_start:0,denoising_end:1},x={id:ZG,nodes:{[y]:{type:S,id:y,is_intermediate:v,model:i},[Yt]:{type:"clip_skip",id:Yt,skipped_layers:c,is_intermediate:v},[Be]:{type:g?"prompt_onnx":"compel",id:Be,prompt:n,is_intermediate:v},[We]:{type:g?"prompt_onnx":"compel",id:We,prompt:r,is_intermediate:v},[Le]:{type:"noise",id:Le,seed:m,width:l,height:u,use_cpu:_,is_intermediate:v},[w.id]:w,[Ke]:{type:g?"l2i_onnx":"l2i",id:Ke,fp32:b,is_intermediate:v}},edges:[{source:{node_id:y,field:"unet"},destination:{node_id:Oe,field:"unet"}},{source:{node_id:y,field:"clip"},destination:{node_id:Yt,field:"clip"}},{source:{node_id:Yt,field:"clip"},destination:{node_id:Be,field:"clip"}},{source:{node_id:Yt,field:"clip"},destination:{node_id:We,field:"clip"}},{source:{node_id:Be,field:"conditioning"},destination:{node_id:Oe,field:"positive_conditioning"}},{source:{node_id:We,field:"conditioning"},destination:{node_id:Oe,field:"negative_conditioning"}},{source:{node_id:Le,field:"noise"},destination:{node_id:Oe,field:"noise"}},{source:{node_id:Oe,field:"latents"},destination:{node_id:Ke,field:"latents"}}]};return x.nodes[ht]={id:ht,type:"metadata_accumulator",generation_mode:"txt2img",cfg_scale:o,height:u,width:l,positive_prompt:n,negative_prompt:r,model:i,seed:m,steps:s,rand_device:_?"cpu":"cuda",scheduler:a,vae:void 0,controlnets:[],loras:[],ipAdapters:[],clip_skip:c},x.edges.push({source:{node_id:ht,field:"metadata"},destination:{node_id:Ke,field:"metadata"}}),(h||p)&&(Oa(e,x,y),y=qr),Ma(e,x,y),kp(e,x,Oe,y),Aa(e,x,Oe),Pa(e,x,Oe),e.system.shouldUseNSFWChecker&&Ia(e,x),e.system.shouldUseWatermarker&&Na(e,x),Ra(e,x),x},mEe=()=>{Fe({predicate:e=>NA.match(e)&&(e.payload.tabName==="txt2img"||e.payload.tabName==="img2img"),effect:async(e,{getState:t,dispatch:n})=>{const r=t(),i=r.generation.model,{prepend:o}=e.payload;let a;i&&i.base_model==="sdxl"?e.payload.tabName==="txt2img"?a=pEe(r):a=hEe(r):e.payload.tabName==="txt2img"?a=gEe(r):a=fEe(r);const s=tH(r,a,o);n(Qr.endpoints.enqueueBatch.initiate(s,{fixedCacheKey:"enqueueBatch"})).reset()}})},yEe=/[$_\p{ID_Start}][$\u200c\u200d\p{ID_Continue}]*/u;function vEe(e){return e.length===1?e[0].toString():e.reduce((t,n)=>{if(typeof n=="number")return t+"["+n.toString()+"]";if(n.includes('"'))return t+'["'+bEe(n)+'"]';if(!yEe.test(n))return t+'["'+n+'"]';const r=t.length===0?"":".";return t+r+n},"")}function bEe(e){return e.replace(/"/g,'\\"')}function _Ee(e){return e.length!==0}const SEe=99,nH="; ",rH=", or ",DA="Validation error",iH=": ";class oH extends Error{constructor(n,r=[]){super(n);_w(this,"details");_w(this,"name");this.details=r,this.name="ZodValidationError"}toString(){return this.message}}function LA(e,t,n){if(e.code==="invalid_union")return e.unionErrors.reduce((r,i)=>{const o=i.issues.map(a=>LA(a,t,n)).join(t);return r.includes(o)||r.push(o),r},[]).join(n);if(_Ee(e.path)){if(e.path.length===1){const r=e.path[0];if(typeof r=="number")return`${e.message} at index ${r}`}return`${e.message} at "${vEe(e.path)}"`}return e.message}function aH(e,t,n){return t!==null?e.length>0?[t,e].join(n):t:e.length>0?e:DA}function XWe(e,t={}){const{issueSeparator:n=nH,unionSeparator:r=rH,prefixSeparator:i=iH,prefix:o=DA}=t,a=LA(e,n,r),s=aH(a,o,i);return new oH(s,[e])}function LO(e,t={}){const{maxIssuesInMessage:n=SEe,issueSeparator:r=nH,unionSeparator:i=rH,prefixSeparator:o=iH,prefix:a=DA}=t,s=e.errors.slice(0,n).map(u=>LA(u,r,i)).join(r),l=aH(s,a,o);return new oH(l,e.errors)}const xEe=e=>{const{workflow:t,nodes:n,edges:r}=e,i={...t,nodes:[],edges:[]};return n.filter(o=>["invocation","notes"].includes(o.type??"__UNKNOWN_NODE_TYPE__")).forEach(o=>{const a=VB.safeParse(o);if(!a.success){const{message:s}=LO(a.error,{prefix:be.t("nodes.unableToParseNode")});_e("nodes").warn({node:Qt(o)},s);return}i.nodes.push(a.data)}),r.forEach(o=>{const a=GB.safeParse(o);if(!a.success){const{message:s}=LO(a.error,{prefix:be.t("nodes.unableToParseEdge")});_e("nodes").warn({edge:Qt(o)},s);return}i.edges.push(a.data)}),i},wEe=e=>{if(e.type==="ColorField"&&e.value){const t=wn(e.value),{r:n,g:r,b:i,a:o}=e.value,a=Math.max(0,Math.min(o*255,255));return Object.assign(t,{r:n,g:r,b:i,a}),t}return e.value},CEe=e=>{const{nodes:t,edges:n}=e,r=t.filter(jr),i=JSON.stringify(xEe(e)),o=r.reduce((u,c)=>{const{id:d,data:f}=c,{type:h,inputs:p,isIntermediate:m,embedWorkflow:_}=f,b=Z3(p,(g,y,S)=>{const w=wEe(y);return g[S]=w,g},{});b.use_cache=c.data.useCache;const v={type:h,id:d,...b,is_intermediate:m};return _&&Object.assign(v,{workflow:i}),Object.assign(u,{[d]:v}),u},{}),s=n.filter(u=>u.type!=="collapsed").reduce((u,c)=>{const{source:d,target:f,sourceHandle:h,targetHandle:p}=c;return u.push({source:{node_id:d,field:h},destination:{node_id:f,field:p}}),u},[]);return s.forEach(u=>{const c=o[u.destination.node_id],d=u.destination.field;o[u.destination.node_id]=qS(c,d)}),{id:$V(),nodes:o,edges:s}},EEe=()=>{Fe({predicate:e=>NA.match(e)&&e.payload.tabName==="nodes",effect:async(e,{getState:t,dispatch:n})=>{const r=t(),o={batch:{graph:CEe(r.nodes),runs:r.generation.iterations},prepend:e.payload.prepend};n(Qr.endpoints.enqueueBatch.initiate(o,{fixedCacheKey:"enqueueBatch"})).reset()}})},kEe=()=>{Fe({matcher:me.endpoints.addImageToBoard.matchFulfilled,effect:e=>{const t=_e("images"),{board_id:n,imageDTO:r}=e.meta.arg.originalArgs;t.debug({board_id:n,imageDTO:r},"Image added to board")}})},TEe=()=>{Fe({matcher:me.endpoints.addImageToBoard.matchRejected,effect:e=>{const t=_e("images"),{board_id:n,imageDTO:r}=e.meta.arg.originalArgs;t.debug({board_id:n,imageDTO:r},"Problem adding image to board")}})},FA=Ne("deleteImageModal/imageDeletionConfirmed"),YWe=Ii(e=>e,e=>e.gallery.selection[e.gallery.selection.length-1],Z2),sH=Ii([e=>e],e=>{const{selectedBoardId:t,galleryView:n}=e.gallery;return{board_id:t,categories:n==="images"?ii:Mu,offset:0,limit:vle,is_intermediate:!1}},Z2),AEe=()=>{Fe({actionCreator:FA,effect:async(e,{dispatch:t,getState:n,condition:r})=>{var f;const{imageDTOs:i,imagesUsage:o}=e.payload;if(i.length!==1||o.length!==1)return;const a=i[0],s=o[0];if(!a||!s)return;t(KT(!1));const l=n(),u=(f=l.gallery.selection[l.gallery.selection.length-1])==null?void 0:f.image_name;if(a&&(a==null?void 0:a.image_name)===u){const{image_name:h}=a,p=sH(l),{data:m}=me.endpoints.listImages.select(p)(l),_=m?Vn.getSelectors().selectAll(m):[],b=_.findIndex(S=>S.image_name===h),v=_.filter(S=>S.image_name!==h),g=Ru(b,0,v.length-1),y=v[g];t(Us(y||null))}s.isCanvasImage&&t(mT()),i.forEach(h=>{var p;((p=n().generation.initialImage)==null?void 0:p.imageName)===h.image_name&&t(gT()),Ca(n().controlNet.controlNets,m=>{(m.controlImage===h.image_name||m.processedControlImage===h.image_name)&&(t(Sc({controlNetId:m.controlNetId,controlImage:null})),t(WT({controlNetId:m.controlNetId,processedControlImage:null})))}),n().controlNet.ipAdapterInfo.adapterImage===h.image_name&&t(V2(null)),n().nodes.nodes.forEach(m=>{jr(m)&&Ca(m.data.inputs,_=>{var b;_.type==="ImageField"&&((b=_.value)==null?void 0:b.image_name)===h.image_name&&t(X2({nodeId:m.data.id,fieldName:_.name,value:void 0}))})})});const{requestId:c}=t(me.endpoints.deleteImage.initiate(a));await r(h=>me.endpoints.deleteImage.matchFulfilled(h)&&h.meta.requestId===c,3e4)&&t(ls.util.invalidateTags([{type:"Board",id:a.board_id}]))}})},PEe=()=>{Fe({actionCreator:FA,effect:async(e,{dispatch:t,getState:n})=>{const{imageDTOs:r,imagesUsage:i}=e.payload;if(!(r.length<=1||i.length<=1))try{await t(me.endpoints.deleteImages.initiate({imageDTOs:r})).unwrap();const o=n(),a=sH(o),{data:s}=me.endpoints.listImages.select(a)(o),l=s?Vn.getSelectors().selectAll(s)[0]:void 0;t(Us(l||null)),t(KT(!1)),i.some(u=>u.isCanvasImage)&&t(mT()),r.forEach(u=>{var c;((c=n().generation.initialImage)==null?void 0:c.imageName)===u.image_name&&t(gT()),Ca(n().controlNet.controlNets,d=>{(d.controlImage===u.image_name||d.processedControlImage===u.image_name)&&(t(Sc({controlNetId:d.controlNetId,controlImage:null})),t(WT({controlNetId:d.controlNetId,processedControlImage:null})))}),n().controlNet.ipAdapterInfo.adapterImage===u.image_name&&t(V2(null)),n().nodes.nodes.forEach(d=>{jr(d)&&Ca(d.data.inputs,f=>{var h;f.type==="ImageField"&&((h=f.value)==null?void 0:h.image_name)===u.image_name&&t(X2({nodeId:d.data.id,fieldName:f.name,value:void 0}))})})})}catch{}}})},IEe=()=>{Fe({matcher:me.endpoints.deleteImage.matchPending,effect:()=>{}})},REe=()=>{Fe({matcher:me.endpoints.deleteImage.matchFulfilled,effect:e=>{_e("images").debug({imageDTO:e.meta.arg.originalArgs},"Image deleted")}})},OEe=()=>{Fe({matcher:me.endpoints.deleteImage.matchRejected,effect:e=>{_e("images").debug({imageDTO:e.meta.arg.originalArgs},"Unable to delete image")}})},lH=Ne("dnd/dndDropped"),MEe=()=>{Fe({actionCreator:lH,effect:async(e,{dispatch:t})=>{const n=_e("dnd"),{activeData:r,overData:i}=e.payload;if(r.payloadType==="IMAGE_DTO"?n.debug({activeData:r,overData:i},"Image dropped"):r.payloadType==="IMAGE_DTOS"?n.debug({activeData:r,overData:i},`Images (${r.payload.imageDTOs.length}) dropped`):r.payloadType==="NODE_FIELD"?n.debug({activeData:Qt(r),overData:Qt(i)},"Node field dropped"):n.debug({activeData:r,overData:i},"Unknown payload dropped"),i.actionType==="ADD_FIELD_TO_LINEAR"&&r.payloadType==="NODE_FIELD"){const{nodeId:o,field:a}=r.payload;t(e2e({nodeId:o,fieldName:a.name}))}if(i.actionType==="SET_CURRENT_IMAGE"&&r.payloadType==="IMAGE_DTO"&&r.payload.imageDTO){t(Us(r.payload.imageDTO));return}if(i.actionType==="SET_INITIAL_IMAGE"&&r.payloadType==="IMAGE_DTO"&&r.payload.imageDTO){t(XS(r.payload.imageDTO));return}if(i.actionType==="SET_CONTROLNET_IMAGE"&&r.payloadType==="IMAGE_DTO"&&r.payload.imageDTO){const{controlNetId:o}=i.context;t(Sc({controlImage:r.payload.imageDTO.image_name,controlNetId:o})),t(oU({controlNetId:o,isEnabled:!0}));return}if(i.actionType==="SET_IP_ADAPTER_IMAGE"&&r.payloadType==="IMAGE_DTO"&&r.payload.imageDTO){t(V2(r.payload.imageDTO.image_name)),t(aU(!0));return}if(i.actionType==="SET_CANVAS_INITIAL_IMAGE"&&r.payloadType==="IMAGE_DTO"&&r.payload.imageDTO){t(kB(r.payload.imageDTO));return}if(i.actionType==="SET_NODES_IMAGE"&&r.payloadType==="IMAGE_DTO"&&r.payload.imageDTO){const{fieldName:o,nodeId:a}=i.context;t(X2({nodeId:a,fieldName:o,value:r.payload.imageDTO}));return}if(i.actionType==="ADD_TO_BOARD"&&r.payloadType==="IMAGE_DTO"&&r.payload.imageDTO){const{imageDTO:o}=r.payload,{boardId:a}=i.context;t(me.endpoints.addImageToBoard.initiate({imageDTO:o,board_id:a}));return}if(i.actionType==="REMOVE_FROM_BOARD"&&r.payloadType==="IMAGE_DTO"&&r.payload.imageDTO){const{imageDTO:o}=r.payload;t(me.endpoints.removeImageFromBoard.initiate({imageDTO:o}));return}if(i.actionType==="ADD_TO_BOARD"&&r.payloadType==="IMAGE_DTOS"&&r.payload.imageDTOs){const{imageDTOs:o}=r.payload,{boardId:a}=i.context;t(me.endpoints.addImagesToBoard.initiate({imageDTOs:o,board_id:a}));return}if(i.actionType==="REMOVE_FROM_BOARD"&&r.payloadType==="IMAGE_DTOS"&&r.payload.imageDTOs){const{imageDTOs:o}=r.payload;t(me.endpoints.removeImagesFromBoard.initiate({imageDTOs:o}));return}}})},NEe=()=>{Fe({matcher:me.endpoints.removeImageFromBoard.matchFulfilled,effect:e=>{const t=_e("images"),n=e.meta.arg.originalArgs;t.debug({imageDTO:n},"Image removed from board")}})},$Ee=()=>{Fe({matcher:me.endpoints.removeImageFromBoard.matchRejected,effect:e=>{const t=_e("images"),n=e.meta.arg.originalArgs;t.debug({imageDTO:n},"Problem removing image from board")}})},DEe=()=>{Fe({actionCreator:f0e,effect:async(e,{dispatch:t,getState:n})=>{const r=e.payload,i=n(),{shouldConfirmOnDelete:o}=i.system,a=wxe(n()),s=a.some(l=>l.isCanvasImage)||a.some(l=>l.isInitialImage)||a.some(l=>l.isControlNetImage)||a.some(l=>l.isIPAdapterImage)||a.some(l=>l.isNodesImage);if(o||s){t(KT(!0));return}t(FA({imageDTOs:r,imagesUsage:a}))}})},LEe=()=>{Fe({matcher:me.endpoints.uploadImage.matchFulfilled,effect:(e,{dispatch:t,getState:n})=>{const r=_e("images"),i=e.payload,o=n(),{autoAddBoardId:a}=o.gallery;r.debug({imageDTO:i},"Image uploaded");const{postUploadAction:s}=e.meta.arg.originalArgs;if(e.payload.is_intermediate&&!s)return;const l={title:Z("toast.imageUploaded"),status:"success"};if((s==null?void 0:s.type)==="TOAST"){const{toastOptions:u}=s;if(!a||a==="none")t(Gt({...l,...u}));else{t(me.endpoints.addImageToBoard.initiate({board_id:a,imageDTO:i}));const{data:c}=xi.endpoints.listAllBoards.select()(o),d=c==null?void 0:c.find(h=>h.board_id===a),f=d?`${Z("toast.addedToBoard")} ${d.board_name}`:`${Z("toast.addedToBoard")} ${a}`;t(Gt({...l,description:f}))}return}if((s==null?void 0:s.type)==="SET_CANVAS_INITIAL_IMAGE"){t(kB(i)),t(Gt({...l,description:Z("toast.setCanvasInitialImage")}));return}if((s==null?void 0:s.type)==="SET_CONTROLNET_IMAGE"){const{controlNetId:u}=s;t(oU({controlNetId:u,isEnabled:!0})),t(Sc({controlNetId:u,controlImage:i.image_name})),t(Gt({...l,description:Z("toast.setControlImage")}));return}if((s==null?void 0:s.type)==="SET_IP_ADAPTER_IMAGE"){t(V2(i.image_name)),t(aU(!0)),t(Gt({...l,description:Z("toast.setIPAdapterImage")}));return}if((s==null?void 0:s.type)==="SET_INITIAL_IMAGE"){t(XS(i)),t(Gt({...l,description:Z("toast.setInitialImage")}));return}if((s==null?void 0:s.type)==="SET_NODES_IMAGE"){const{nodeId:u,fieldName:c}=s;t(X2({nodeId:u,fieldName:c,value:i})),t(Gt({...l,description:`${Z("toast.setNodeField")} ${c}`}));return}}})},FEe=()=>{Fe({matcher:me.endpoints.uploadImage.matchRejected,effect:(e,{dispatch:t})=>{const n=_e("images"),r={arg:{...qS(e.meta.arg.originalArgs,["file","postUploadAction"]),file:""}};n.error({...r},"Image upload failed"),t(Gt({title:Z("toast.imageUploadFailed"),description:e.error.message,status:"error"}))}})},BEe=()=>{Fe({matcher:me.endpoints.starImages.matchFulfilled,effect:async(e,{dispatch:t,getState:n})=>{const{updated_image_names:r}=e.payload,i=n(),{selection:o}=i.gallery,a=[];o.forEach(s=>{r.includes(s.image_name)?a.push({...s,starred:!0}):a.push(s)}),t(fU(a))}})},zEe=()=>{Fe({matcher:me.endpoints.unstarImages.matchFulfilled,effect:async(e,{dispatch:t,getState:n})=>{const{updated_image_names:r}=e.payload,i=n(),{selection:o}=i.gallery,a=[];o.forEach(s=>{r.includes(s.image_name)?a.push({...s,starred:!1}):a.push(s)}),t(fU(a))}})},jEe=Ne("generation/initialImageSelected"),UEe=Ne("generation/modelSelected"),VEe=()=>{Fe({actionCreator:jEe,effect:(e,{dispatch:t})=>{if(!e.payload){t(Gt($d({title:Z("toast.imageNotLoadedDesc"),status:"error"})));return}t(XS(e.payload)),t(Gt($d(Z("toast.sentToImageToImage"))))}})},GEe=()=>{Fe({actionCreator:UEe,effect:(e,{getState:t,dispatch:n})=>{var l,u;const r=_e("models"),i=t(),o=ly.safeParse(e.payload);if(!o.success){r.error({error:o.error.format()},"Failed to parse main model");return}const a=o.data,{base_model:s}=a;if(((l=i.generation.model)==null?void 0:l.base_model)!==s){let c=0;Ca(i.lora.loras,(p,m)=>{p.base_model!==s&&(n(pU(m)),c+=1)});const{vae:d}=i.generation;d&&d.base_model!==s&&(n(xB(null)),c+=1);const{controlNets:f}=i.controlNet;Ca(f,(p,m)=>{var _;((_=p.model)==null?void 0:_.base_model)!==s&&(n(iU({controlNetId:m})),c+=1)});const{ipAdapterInfo:h}=i.controlNet;h.model&&h.model.base_model!==s&&(n(sU()),c+=1),c>0&&n(Gt($d({title:`${Z("toast.baseModelChangedCleared")} ${c} ${Z("toast.incompatibleSubmodel")}${c===1?"":"s"}`,status:"warning"})))}((u=i.generation.model)==null?void 0:u.base_model)!==a.base_model&&i.ui.shouldAutoChangeDimensions&&(["sdxl","sdxl-refiner"].includes(a.base_model)?(n(J8(1024)),n(eI(1024)),n(tI({width:1024,height:1024}))):(n(J8(512)),n(eI(512)),n(tI({width:512,height:512})))),n(Ou(a))}})},_0=Js({sortComparer:(e,t)=>e.model_name.localeCompare(t.model_name)}),FO=Js({sortComparer:(e,t)=>e.model_name.localeCompare(t.model_name)}),BO=Js({sortComparer:(e,t)=>e.model_name.localeCompare(t.model_name)}),zO=Js({sortComparer:(e,t)=>e.model_name.localeCompare(t.model_name)}),t4=Js({sortComparer:(e,t)=>e.model_name.localeCompare(t.model_name)}),jO=Js({sortComparer:(e,t)=>e.model_name.localeCompare(t.model_name)}),n4=Js({sortComparer:(e,t)=>e.model_name.localeCompare(t.model_name)}),HEe=({base_model:e,model_type:t,model_name:n})=>`${e}/${t}/${n}`,Dc=e=>{const t=[];return e.forEach(n=>{const r={...wn(n),id:HEe(n)};t.push(r)}),t},yl=ls.injectEndpoints({endpoints:e=>({getOnnxModels:e.query({query:t=>{const n={model_type:"onnx",base_models:t};return`models/?${Kg.stringify(n,{arrayFormat:"none"})}`},providesTags:t=>{const n=[{type:"OnnxModel",id:Dt}];return t&&n.push(...t.ids.map(r=>({type:"OnnxModel",id:r}))),n},transformResponse:t=>{const n=Dc(t.models);return FO.setAll(FO.getInitialState(),n)}}),getMainModels:e.query({query:t=>{const n={model_type:"main",base_models:t};return`models/?${Kg.stringify(n,{arrayFormat:"none"})}`},providesTags:t=>{const n=[{type:"MainModel",id:Dt}];return t&&n.push(...t.ids.map(r=>({type:"MainModel",id:r}))),n},transformResponse:t=>{const n=Dc(t.models);return _0.setAll(_0.getInitialState(),n)}}),updateMainModels:e.mutation({query:({base_model:t,model_name:n,body:r})=>({url:`models/${t}/main/${n}`,method:"PATCH",body:r}),invalidatesTags:[{type:"MainModel",id:Dt},{type:"SDXLRefinerModel",id:Dt},{type:"OnnxModel",id:Dt}]}),importMainModels:e.mutation({query:({body:t})=>({url:"models/import",method:"POST",body:t}),invalidatesTags:[{type:"MainModel",id:Dt},{type:"SDXLRefinerModel",id:Dt},{type:"OnnxModel",id:Dt}]}),addMainModels:e.mutation({query:({body:t})=>({url:"models/add",method:"POST",body:t}),invalidatesTags:[{type:"MainModel",id:Dt},{type:"SDXLRefinerModel",id:Dt},{type:"OnnxModel",id:Dt}]}),deleteMainModels:e.mutation({query:({base_model:t,model_name:n,model_type:r})=>({url:`models/${t}/${r}/${n}`,method:"DELETE"}),invalidatesTags:[{type:"MainModel",id:Dt},{type:"SDXLRefinerModel",id:Dt},{type:"OnnxModel",id:Dt}]}),convertMainModels:e.mutation({query:({base_model:t,model_name:n,convert_dest_directory:r})=>({url:`models/convert/${t}/main/${n}`,method:"PUT",params:{convert_dest_directory:r}}),invalidatesTags:[{type:"MainModel",id:Dt},{type:"SDXLRefinerModel",id:Dt},{type:"OnnxModel",id:Dt}]}),mergeMainModels:e.mutation({query:({base_model:t,body:n})=>({url:`models/merge/${t}`,method:"PUT",body:n}),invalidatesTags:[{type:"MainModel",id:Dt},{type:"SDXLRefinerModel",id:Dt},{type:"OnnxModel",id:Dt}]}),syncModels:e.mutation({query:()=>({url:"models/sync",method:"POST"}),invalidatesTags:[{type:"MainModel",id:Dt},{type:"SDXLRefinerModel",id:Dt},{type:"OnnxModel",id:Dt}]}),getLoRAModels:e.query({query:()=>({url:"models/",params:{model_type:"lora"}}),providesTags:t=>{const n=[{type:"LoRAModel",id:Dt}];return t&&n.push(...t.ids.map(r=>({type:"LoRAModel",id:r}))),n},transformResponse:t=>{const n=Dc(t.models);return BO.setAll(BO.getInitialState(),n)}}),updateLoRAModels:e.mutation({query:({base_model:t,model_name:n,body:r})=>({url:`models/${t}/lora/${n}`,method:"PATCH",body:r}),invalidatesTags:[{type:"LoRAModel",id:Dt}]}),deleteLoRAModels:e.mutation({query:({base_model:t,model_name:n})=>({url:`models/${t}/lora/${n}`,method:"DELETE"}),invalidatesTags:[{type:"LoRAModel",id:Dt}]}),getControlNetModels:e.query({query:()=>({url:"models/",params:{model_type:"controlnet"}}),providesTags:t=>{const n=[{type:"ControlNetModel",id:Dt}];return t&&n.push(...t.ids.map(r=>({type:"ControlNetModel",id:r}))),n},transformResponse:t=>{const n=Dc(t.models);return zO.setAll(zO.getInitialState(),n)}}),getIPAdapterModels:e.query({query:()=>({url:"models/",params:{model_type:"ip_adapter"}}),providesTags:t=>{const n=[{type:"IPAdapterModel",id:Dt}];return t&&n.push(...t.ids.map(r=>({type:"IPAdapterModel",id:r}))),n},transformResponse:t=>{const n=Dc(t.models);return t4.setAll(t4.getInitialState(),n)}}),getVaeModels:e.query({query:()=>({url:"models/",params:{model_type:"vae"}}),providesTags:t=>{const n=[{type:"VaeModel",id:Dt}];return t&&n.push(...t.ids.map(r=>({type:"VaeModel",id:r}))),n},transformResponse:t=>{const n=Dc(t.models);return n4.setAll(n4.getInitialState(),n)}}),getTextualInversionModels:e.query({query:()=>({url:"models/",params:{model_type:"embedding"}}),providesTags:t=>{const n=[{type:"TextualInversionModel",id:Dt}];return t&&n.push(...t.ids.map(r=>({type:"TextualInversionModel",id:r}))),n},transformResponse:t=>{const n=Dc(t.models);return jO.setAll(jO.getInitialState(),n)}}),getModelsInFolder:e.query({query:t=>({url:`/models/search?${Kg.stringify(t,{})}`}),providesTags:t=>{const n=[{type:"ScannedModels",id:Dt}];return t&&n.push(...t.map(r=>({type:"ScannedModels",id:r}))),n}}),getCheckpointConfigs:e.query({query:()=>({url:"/models/ckpt_confs"})})})}),{useGetMainModelsQuery:ZWe,useGetOnnxModelsQuery:JWe,useGetControlNetModelsQuery:eKe,useGetIPAdapterModelsQuery:tKe,useGetLoRAModelsQuery:nKe,useGetTextualInversionModelsQuery:rKe,useGetVaeModelsQuery:iKe,useUpdateMainModelsMutation:oKe,useDeleteMainModelsMutation:aKe,useImportMainModelsMutation:sKe,useAddMainModelsMutation:lKe,useConvertMainModelsMutation:uKe,useMergeMainModelsMutation:cKe,useDeleteLoRAModelsMutation:dKe,useUpdateLoRAModelsMutation:fKe,useSyncModelsMutation:hKe,useGetModelsInFolderQuery:pKe,useGetCheckpointConfigsQuery:gKe}=yl,qEe=()=>{Fe({predicate:e=>yl.endpoints.getMainModels.matchFulfilled(e)&&!e.meta.arg.originalArgs.includes("sdxl-refiner"),effect:async(e,{getState:t,dispatch:n})=>{const r=_e("models");r.info({models:e.payload.entities},`Main models loaded (${e.payload.ids.length})`);const i=t().generation.model,o=_0.getSelectors().selectAll(e.payload);if(o.length===0){n(Ou(null));return}if(i?o.some(l=>l.model_name===i.model_name&&l.base_model===i.base_model&&l.model_type===i.model_type):!1)return;const s=ly.safeParse(o[0]);if(!s.success){r.error({error:s.error.format()},"Failed to parse main model");return}n(Ou(s.data))}}),Fe({predicate:e=>yl.endpoints.getMainModels.matchFulfilled(e)&&e.meta.arg.originalArgs.includes("sdxl-refiner"),effect:async(e,{getState:t,dispatch:n})=>{const r=_e("models");r.info({models:e.payload.entities},`SDXL Refiner models loaded (${e.payload.ids.length})`);const i=t().sdxl.refinerModel,o=_0.getSelectors().selectAll(e.payload);if(o.length===0){n(q9(null)),n(i2e(!1));return}if(i?o.some(l=>l.model_name===i.model_name&&l.base_model===i.base_model&&l.model_type===i.model_type):!1)return;const s=hT.safeParse(o[0]);if(!s.success){r.error({error:s.error.format()},"Failed to parse SDXL Refiner Model");return}n(q9(s.data))}}),Fe({matcher:yl.endpoints.getVaeModels.matchFulfilled,effect:async(e,{getState:t,dispatch:n})=>{const r=_e("models");r.info({models:e.payload.entities},`VAEs loaded (${e.payload.ids.length})`);const i=t().generation.vae;if(i===null||zf(e.payload.entities,l=>(l==null?void 0:l.model_name)===(i==null?void 0:i.model_name)&&(l==null?void 0:l.base_model)===(i==null?void 0:i.base_model)))return;const a=n4.getSelectors().selectAll(e.payload)[0];if(!a){n(Ou(null));return}const s=Vse.safeParse(a);if(!s.success){r.error({error:s.error.format()},"Failed to parse VAE model");return}n(xB(s.data))}}),Fe({matcher:yl.endpoints.getLoRAModels.matchFulfilled,effect:async(e,{getState:t,dispatch:n})=>{_e("models").info({models:e.payload.entities},`LoRAs loaded (${e.payload.ids.length})`);const i=t().lora.loras;Ca(i,(o,a)=>{zf(e.payload.entities,l=>(l==null?void 0:l.model_name)===(o==null?void 0:o.model_name)&&(l==null?void 0:l.base_model)===(o==null?void 0:o.base_model))||n(pU(a))})}}),Fe({matcher:yl.endpoints.getControlNetModels.matchFulfilled,effect:async(e,{getState:t,dispatch:n})=>{_e("models").info({models:e.payload.entities},`ControlNet models loaded (${e.payload.ids.length})`);const i=t().controlNet.controlNets;Ca(i,(o,a)=>{zf(e.payload.entities,l=>{var u,c;return(l==null?void 0:l.model_name)===((u=o==null?void 0:o.model)==null?void 0:u.model_name)&&(l==null?void 0:l.base_model)===((c=o==null?void 0:o.model)==null?void 0:c.base_model)})||n(iU({controlNetId:a}))})}}),Fe({matcher:yl.endpoints.getIPAdapterModels.matchFulfilled,effect:async(e,{getState:t,dispatch:n})=>{const r=_e("models");r.info({models:e.payload.entities},`IP Adapter models loaded (${e.payload.ids.length})`);const{model:i}=t().controlNet.ipAdapterInfo;if(zf(e.payload.entities,l=>(l==null?void 0:l.model_name)===(i==null?void 0:i.model_name)&&(l==null?void 0:l.base_model)===(i==null?void 0:i.base_model)))return;const a=t4.getSelectors().selectAll(e.payload)[0];a||n(VR(null));const s=$B.safeParse(a);if(!s.success){r.error({error:s.error.format()},"Failed to parse IP Adapter model");return}n(VR(s.data))}}),Fe({matcher:yl.endpoints.getTextualInversionModels.matchFulfilled,effect:async e=>{_e("models").info({models:e.payload.entities},`Embeddings loaded (${e.payload.ids.length})`)}})},WEe=ls.injectEndpoints({endpoints:e=>({dynamicPrompts:e.query({query:t=>({url:"utilities/dynamicprompts",body:t,method:"POST"}),keepUnusedDataFor:86400})})}),KEe=No(Jse,y0e,g0e,m0e,zT),QEe=()=>{Fe({matcher:KEe,effect:async(e,{dispatch:t,getState:n,cancelActiveListeners:r,delay:i})=>{r(),await i(1e3);const o=n();if(o.config.disabledFeatures.includes("dynamicPrompting"))return;const{positivePrompt:a}=o.generation,{maxPrompts:s}=o.dynamicPrompts;t(RC(!0));try{const l=t(WEe.endpoints.dynamicPrompts.initiate({prompt:a,max_prompts:s})),u=await l.unwrap();l.unsubscribe(),t(v0e(u.prompts)),t(b0e(u.error)),t(GR(!1)),t(RC(!1))}catch{t(GR(!0)),t(RC(!1))}}})},bf=e=>e.$ref.split("/").slice(-1)[0],XEe=({schemaObject:e,baseField:t})=>{const n={...t,type:"integer",default:e.default??0};return e.multipleOf!==void 0&&(n.multipleOf=e.multipleOf),e.maximum!==void 0&&(n.maximum=e.maximum),e.exclusiveMaximum!==void 0&&(n.exclusiveMaximum=e.exclusiveMaximum),e.minimum!==void 0&&(n.minimum=e.minimum),e.exclusiveMinimum!==void 0&&(n.exclusiveMinimum=e.exclusiveMinimum),n},YEe=({schemaObject:e,baseField:t})=>{const n={...t,type:"IntegerPolymorphic",default:e.default??0};return e.multipleOf!==void 0&&(n.multipleOf=e.multipleOf),e.maximum!==void 0&&(n.maximum=e.maximum),e.exclusiveMaximum!==void 0&&(n.exclusiveMaximum=e.exclusiveMaximum),e.minimum!==void 0&&(n.minimum=e.minimum),e.exclusiveMinimum!==void 0&&(n.exclusiveMinimum=e.exclusiveMinimum),n},ZEe=({schemaObject:e,baseField:t})=>{const n=eB(e.item_default)&&Roe(e.item_default)?e.item_default:0;return{...t,type:"IntegerCollection",default:e.default??[],item_default:n}},JEe=({schemaObject:e,baseField:t})=>{const n={...t,type:"float",default:e.default??0};return e.multipleOf!==void 0&&(n.multipleOf=e.multipleOf),e.maximum!==void 0&&(n.maximum=e.maximum),e.exclusiveMaximum!==void 0&&(n.exclusiveMaximum=e.exclusiveMaximum),e.minimum!==void 0&&(n.minimum=e.minimum),e.exclusiveMinimum!==void 0&&(n.exclusiveMinimum=e.exclusiveMinimum),n},e4e=({schemaObject:e,baseField:t})=>{const n={...t,type:"FloatPolymorphic",default:e.default??0};return e.multipleOf!==void 0&&(n.multipleOf=e.multipleOf),e.maximum!==void 0&&(n.maximum=e.maximum),e.exclusiveMaximum!==void 0&&(n.exclusiveMaximum=e.exclusiveMaximum),e.minimum!==void 0&&(n.minimum=e.minimum),e.exclusiveMinimum!==void 0&&(n.exclusiveMinimum=e.exclusiveMinimum),n},t4e=({schemaObject:e,baseField:t})=>{const n=eB(e.item_default)?e.item_default:0;return{...t,type:"FloatCollection",default:e.default??[],item_default:n}},n4e=({schemaObject:e,baseField:t})=>{const n={...t,type:"string",default:e.default??""};return e.minLength!==void 0&&(n.minLength=e.minLength),e.maxLength!==void 0&&(n.maxLength=e.maxLength),e.pattern!==void 0&&(n.pattern=e.pattern),n},r4e=({schemaObject:e,baseField:t})=>{const n={...t,type:"StringPolymorphic",default:e.default??""};return e.minLength!==void 0&&(n.minLength=e.minLength),e.maxLength!==void 0&&(n.maxLength=e.maxLength),e.pattern!==void 0&&(n.pattern=e.pattern),n},i4e=({schemaObject:e,baseField:t})=>{const n=cT(e.item_default)?e.item_default:"";return{...t,type:"StringCollection",default:e.default??[],item_default:n}},o4e=({schemaObject:e,baseField:t})=>({...t,type:"boolean",default:e.default??!1}),a4e=({schemaObject:e,baseField:t})=>({...t,type:"BooleanPolymorphic",default:e.default??!1}),s4e=({schemaObject:e,baseField:t})=>{const n=e.item_default&&Ioe(e.item_default)?e.item_default:!1;return{...t,type:"BooleanCollection",default:e.default??[],item_default:n}},l4e=({schemaObject:e,baseField:t})=>({...t,type:"MainModelField",default:e.default??void 0}),u4e=({schemaObject:e,baseField:t})=>({...t,type:"SDXLMainModelField",default:e.default??void 0}),c4e=({schemaObject:e,baseField:t})=>({...t,type:"SDXLRefinerModelField",default:e.default??void 0}),d4e=({schemaObject:e,baseField:t})=>({...t,type:"VaeModelField",default:e.default??void 0}),f4e=({schemaObject:e,baseField:t})=>({...t,type:"LoRAModelField",default:e.default??void 0}),h4e=({schemaObject:e,baseField:t})=>({...t,type:"ControlNetModelField",default:e.default??void 0}),p4e=({schemaObject:e,baseField:t})=>({...t,type:"IPAdapterModelField",default:e.default??void 0}),g4e=({schemaObject:e,baseField:t})=>({...t,type:"BoardField",default:e.default??void 0}),m4e=({schemaObject:e,baseField:t})=>({...t,type:"ImageField",default:e.default??void 0}),y4e=({schemaObject:e,baseField:t})=>({...t,type:"ImagePolymorphic",default:e.default??void 0}),v4e=({schemaObject:e,baseField:t})=>({...t,type:"ImageCollection",default:e.default??[],item_default:e.item_default??void 0}),b4e=({schemaObject:e,baseField:t})=>({...t,type:"DenoiseMaskField",default:e.default??void 0}),_4e=({schemaObject:e,baseField:t})=>({...t,type:"LatentsField",default:e.default??void 0}),S4e=({schemaObject:e,baseField:t})=>({...t,type:"LatentsPolymorphic",default:e.default??void 0}),x4e=({schemaObject:e,baseField:t})=>({...t,type:"LatentsCollection",default:e.default??[],item_default:e.item_default??void 0}),w4e=({schemaObject:e,baseField:t})=>({...t,type:"ConditioningField",default:e.default??void 0}),C4e=({schemaObject:e,baseField:t})=>({...t,type:"ConditioningPolymorphic",default:e.default??void 0}),E4e=({schemaObject:e,baseField:t})=>({...t,type:"ConditioningCollection",default:e.default??[],item_default:e.item_default??void 0}),k4e=({schemaObject:e,baseField:t})=>({...t,type:"UNetField",default:e.default??void 0}),T4e=({schemaObject:e,baseField:t})=>({...t,type:"ClipField",default:e.default??void 0}),A4e=({schemaObject:e,baseField:t})=>({...t,type:"VaeField",default:e.default??void 0}),P4e=({schemaObject:e,baseField:t})=>({...t,type:"ControlField",default:e.default??void 0}),I4e=({schemaObject:e,baseField:t})=>({...t,type:"ControlPolymorphic",default:e.default??void 0}),R4e=({schemaObject:e,baseField:t})=>({...t,type:"ControlCollection",default:e.default??[],item_default:e.item_default??void 0}),O4e=({schemaObject:e,baseField:t})=>({...t,type:"IPAdapterField",default:e.default??void 0}),M4e=({schemaObject:e,baseField:t})=>{const n=e.enum??[];return{...t,type:"enum",options:n,ui_choice_labels:e.ui_choice_labels,default:e.default??n[0]}},N4e=({baseField:e})=>({...e,type:"Collection",default:[]}),$4e=({baseField:e})=>({...e,type:"CollectionItem",default:void 0}),D4e=({schemaObject:e,baseField:t})=>({...t,type:"ColorField",default:e.default??{r:127,g:127,b:127,a:255}}),L4e=({schemaObject:e,baseField:t})=>({...t,type:"ColorPolymorphic",default:e.default??{r:127,g:127,b:127,a:255}}),F4e=({schemaObject:e,baseField:t})=>({...t,type:"ColorCollection",default:e.default??[]}),B4e=({schemaObject:e,baseField:t})=>({...t,type:"Scheduler",default:e.default??"euler"}),UO=e=>{if(e!=null&&e.ui_type)return e.ui_type;if(e.type){if(e.enum)return"enum";if(e.type){if(e.type==="number")return"float";if(e.type==="array"){const t=Wue(e.items)?e.items.type:bf(e.items);return nSe(t)?hA[t]:void 0}else return e.type}}else if(e.allOf){const t=e.allOf;if(t&&t[0]&&Hp(t[0]))return bf(t[0])}else if(e.anyOf){const t=e.anyOf;let n,r;if(fI(t[0])){const i=t[0].items,o=t[1];Hp(i)&&Hp(o)?(n=bf(i),r=bf(o)):mv(i)&&mv(o)&&(n=i.type,r=o.type)}else if(fI(t[1])){const i=t[0],o=t[1].items;Hp(i)&&Hp(o)?(n=bf(i),r=bf(o)):mv(i)&&mv(o)&&(n=i.type,r=o.type)}if(n===r&&iSe(n))return DV[n]}},uH={BoardField:g4e,boolean:o4e,BooleanCollection:s4e,BooleanPolymorphic:a4e,ClipField:T4e,Collection:N4e,CollectionItem:$4e,ColorCollection:F4e,ColorField:D4e,ColorPolymorphic:L4e,ConditioningCollection:E4e,ConditioningField:w4e,ConditioningPolymorphic:C4e,ControlCollection:R4e,ControlField:P4e,ControlNetModelField:h4e,ControlPolymorphic:I4e,DenoiseMaskField:b4e,enum:M4e,float:JEe,FloatCollection:t4e,FloatPolymorphic:e4e,ImageCollection:v4e,ImageField:m4e,ImagePolymorphic:y4e,integer:XEe,IntegerCollection:ZEe,IntegerPolymorphic:YEe,IPAdapterField:O4e,IPAdapterModelField:p4e,LatentsCollection:x4e,LatentsField:_4e,LatentsPolymorphic:S4e,LoRAModelField:f4e,MainModelField:l4e,Scheduler:B4e,SDXLMainModelField:u4e,SDXLRefinerModelField:c4e,string:n4e,StringCollection:i4e,StringPolymorphic:r4e,UNetField:k4e,VaeField:A4e,VaeModelField:d4e},z4e=e=>!!(e&&e in uH),j4e=(e,t,n,r)=>{var f;const{input:i,ui_hidden:o,ui_component:a,ui_type:s,ui_order:l}=t,u={input:wg.includes(r)?"connection":i,ui_hidden:o,ui_component:a,ui_type:s,required:((f=e.required)==null?void 0:f.includes(n))??!1,ui_order:l},c={name:n,title:t.title??"",description:t.description??"",fieldKind:"input",...u};if(!z4e(r))return;const d=uH[r];if(d)return d({schemaObject:t,baseField:c})},U4e=["id","type","metadata","use_cache"],V4e=["type"],G4e=["WorkflowField","MetadataField","IsIntermediate"],H4e=["graph","metadata_accumulator"],q4e=(e,t)=>!!(U4e.includes(t)||e==="collect"&&t==="collection"||e==="iterate"&&t==="index"),W4e=e=>!!G4e.includes(e),K4e=(e,t)=>!V4e.includes(t),Q4e=e=>!H4e.includes(e.properties.type.default),X4e=(e,t=void 0,n=void 0)=>{var o;return Object.values(((o=e.components)==null?void 0:o.schemas)??{}).filter(Kue).filter(Q4e).filter(a=>t?t.includes(a.properties.type.default):!0).filter(a=>n?!n.includes(a.properties.type.default):!0).reduce((a,s)=>{var y,S;const l=s.properties.type.default,u=s.title.replace("Invocation",""),c=s.tags??[],d=s.description??"",f=s.version,h=Z3(s.properties,(w,x,C)=>{if(q4e(l,C))return _e("nodes").trace({node:l,fieldName:C,field:Qt(x)},"Skipped reserved input field"),w;if(!hI(x))return _e("nodes").warn({node:l,propertyName:C,property:Qt(x)},"Unhandled input property"),w;const T=UO(x);if(!dI(T))return _e("nodes").warn({node:l,fieldName:C,fieldType:T,field:Qt(x)},"Skipping unknown input field type"),w;if(W4e(T))return _e("nodes").trace({node:l,fieldName:C,fieldType:T,field:Qt(x)},"Skipping reserved field type"),w;const k=j4e(s,x,C,T);return k?(w[C]=k,w):(_e("nodes").debug({node:l,fieldName:C,fieldType:T,field:Qt(x)},"Skipping input field with no template"),w)},{}),p=s.output.$ref.split("/").pop();if(!p)return _e("nodes").warn({outputRefObject:Qt(s.output)},"No output schema name found in ref object"),a;const m=(S=(y=e.components)==null?void 0:y.schemas)==null?void 0:S[p];if(!m)return _e("nodes").warn({outputSchemaName:p},"Output schema not found"),a;if(!Que(m))return _e("nodes").error({outputSchema:Qt(m)},"Invalid output schema"),a;const _=m.properties.type.default,b=Z3(m.properties,(w,x,C)=>{if(!K4e(l,C))return _e("nodes").trace({type:l,propertyName:C,property:Qt(x)},"Skipped reserved output field"),w;if(!hI(x))return _e("nodes").warn({type:l,propertyName:C,property:Qt(x)},"Unhandled output property"),w;const T=UO(x);return dI(T)?(w[C]={fieldKind:"output",name:C,title:x.title??"",description:x.description??"",type:T,ui_hidden:x.ui_hidden??!1,ui_type:x.ui_type,ui_order:x.ui_order},w):(_e("nodes").warn({fieldName:C,fieldType:T,field:Qt(x)},"Skipping unknown output field type"),w)},{}),v=s.properties.use_cache.default,g={title:u,type:l,version:f,tags:c,description:d,outputType:_,inputs:h,outputs:b,useCache:v};return Object.assign(a,{[l]:g}),a},{})},Y4e=()=>{Fe({actionCreator:g0.fulfilled,effect:(e,{dispatch:t,getState:n})=>{const r=_e("system"),i=e.payload;r.debug({schemaJSON:i},"Received OpenAPI schema");const{nodesAllowlist:o,nodesDenylist:a}=n().config,s=X4e(i,o,a);r.debug({nodeTemplates:Qt(s)},`Built ${WS(s)} node templates`),t(qV(s))}}),Fe({actionCreator:g0.rejected,effect:e=>{_e("system").error({error:Qt(e.error)},"Problem retrieving OpenAPI Schema")}})},Z4e=()=>{Fe({actionCreator:Bj,effect:(e,{dispatch:t,getState:n})=>{_e("socketio").debug("Connected");const{nodes:i,config:o,system:a}=n(),{disabledTabs:s}=o;!WS(i.nodeTemplates)&&!s.includes("nodes")&&t(g0()),a.isInitialized?t(ls.util.resetApiState()):t(u2e(!0)),t(zT(e.payload))}})},J4e=()=>{Fe({actionCreator:zj,effect:(e,{dispatch:t})=>{_e("socketio").debug("Disconnected"),t(jj(e.payload))}})},eke=()=>{Fe({actionCreator:qj,effect:(e,{dispatch:t})=>{_e("socketio").trace(e.payload,"Generator progress"),t(GT(e.payload))}})},tke=()=>{Fe({actionCreator:Gj,effect:(e,{dispatch:t})=>{_e("socketio").debug(e.payload,"Session complete"),t(Hj(e.payload))}})},nke=["load_image","image"],rke=()=>{Fe({actionCreator:UT,effect:async(e,{dispatch:t,getState:n})=>{const r=_e("socketio"),{data:i}=e.payload;r.debug({data:Qt(i)},`Invocation complete (${e.payload.data.node.type})`);const{result:o,node:a,queue_batch_id:s}=i;if(eH(o)&&!nke.includes(a.type)){const{image_name:l}=o.image,{canvas:u,gallery:c}=n(),d=await t(me.endpoints.getImageDTO.initiate(l)).unwrap();if(u.batchIds.includes(s)&&[ye].includes(i.source_node_id)&&t(ale(d)),!d.is_intermediate){t(me.util.updateQueryData("listImages",{board_id:d.board_id??"none",categories:ii},h=>{Vn.addOne(h,d)})),t(me.util.invalidateTags([{type:"BoardImagesTotal",id:d.board_id},{type:"BoardAssetsTotal",id:d.board_id},{type:"Board",id:d.board_id}]));const{shouldAutoSwitch:f}=c;f&&(c.galleryView!=="images"&&t(SE("images")),d.board_id&&d.board_id!==c.selectedBoardId&&t(w_({boardId:d.board_id,selectedImageName:d.image_name})),!d.board_id&&c.selectedBoardId!=="none"&&t(w_({boardId:"none",selectedImageName:d.image_name})),t(Us(d)))}}t(VT(e.payload))}})},ike=()=>{Fe({actionCreator:Vj,effect:(e,{dispatch:t})=>{_e("socketio").error(e.payload,`Invocation error (${e.payload.data.node.type})`),t(U2(e.payload))}})},oke=()=>{Fe({actionCreator:Jj,effect:(e,{dispatch:t})=>{_e("socketio").error(e.payload,`Invocation retrieval error (${e.payload.data.graph_execution_state_id})`),t(eU(e.payload))}})},ake=()=>{Fe({actionCreator:Uj,effect:(e,{dispatch:t})=>{_e("socketio").debug(e.payload,`Invocation started (${e.payload.data.node.type})`),t(jT(e.payload))}})},ske=()=>{Fe({actionCreator:Wj,effect:(e,{dispatch:t})=>{const n=_e("socketio"),{base_model:r,model_name:i,model_type:o,submodel:a}=e.payload.data;let s=`Model load started: ${r}/${o}/${i}`;a&&(s=s.concat(`/${a}`)),n.debug(e.payload,s),t(Kj(e.payload))}}),Fe({actionCreator:Qj,effect:(e,{dispatch:t})=>{const n=_e("socketio"),{base_model:r,model_name:i,model_type:o,submodel:a}=e.payload.data;let s=`Model load complete: ${r}/${o}/${i}`;a&&(s=s.concat(`/${a}`)),n.debug(e.payload,s),t(Xj(e.payload))}})},lke=()=>{Fe({actionCreator:tU,effect:async(e,{dispatch:t})=>{const n=_e("socketio"),{queue_item_id:r,queue_batch_id:i,status:o}=e.payload.data;n.debug(e.payload,`Queue item ${r} status updated: ${o}`),t(HT(e.payload)),t(Qr.util.updateQueryData("listQueueItems",void 0,s=>{qc.updateOne(s,{id:r,changes:e.payload.data})})),t(Qr.util.invalidateTags(["CurrentSessionQueueItem","NextSessionQueueItem","InvocationCacheStatus",{type:"SessionQueueItem",id:r},{type:"SessionQueueItemDTO",id:r},{type:"BatchStatus",id:i}]));const a=t(Qr.endpoints.getQueueStatus.initiate(void 0,{forceRefetch:!0}));await a.unwrap(),a.unsubscribe()}})},uke=()=>{Fe({actionCreator:Yj,effect:(e,{dispatch:t})=>{_e("socketio").error(e.payload,`Session retrieval error (${e.payload.data.graph_execution_state_id})`),t(Zj(e.payload))}})},cke=()=>{Fe({actionCreator:n0e,effect:(e,{dispatch:t})=>{_e("socketio").debug(e.payload,"Subscribed"),t(r0e(e.payload))}})},dke=()=>{Fe({actionCreator:i0e,effect:(e,{dispatch:t})=>{_e("socketio").debug(e.payload,"Unsubscribed"),t(o0e(e.payload))}})},fke=()=>{Fe({actionCreator:Rxe,effect:async(e,{dispatch:t,getState:n})=>{const{imageDTO:r}=e.payload;try{const i=await t(me.endpoints.changeImageIsIntermediate.initiate({imageDTO:r,is_intermediate:!1})).unwrap(),{autoAddBoardId:o}=n().gallery;o&&o!=="none"&&await t(me.endpoints.addImageToBoard.initiate({imageDTO:i,board_id:o})),t(Gt({title:Z("toast.imageSaved"),status:"success"}))}catch(i){t(Gt({title:Z("toast.imageSavingFailed"),description:i==null?void 0:i.message,status:"error"}))}}})},mKe=["sd-1","sd-2","sdxl","sdxl-refiner"],hke=["sd-1","sd-2","sdxl"],yKe=["sdxl"],vKe=["sd-1","sd-2"],bKe=["sdxl-refiner"],pke=()=>{Fe({actionCreator:oG,effect:async(e,{getState:t,dispatch:n})=>{var i;if(e.payload==="unifiedCanvas"){const o=(i=t().generation.model)==null?void 0:i.base_model;if(o&&["sd-1","sd-2","sdxl"].includes(o))return;try{const a=n(yl.endpoints.getMainModels.initiate(hke)),s=await a.unwrap();if(a.unsubscribe(),!s.ids.length){n(Ou(null));return}const u=_0.getSelectors().selectAll(s).filter(h=>["sd-1","sd-2","sxdl"].includes(h.base_model))[0];if(!u){n(Ou(null));return}const{base_model:c,model_name:d,model_type:f}=u;n(Ou({base_model:c,model_name:d,model_type:f}))}catch{n(Ou(null))}}}})},gke=({image_name:e,esrganModelName:t,autoAddBoardId:n})=>{const r={id:n5,type:"esrgan",image:{image_name:e},model_name:t,is_intermediate:!0},i={id:Za,type:"save_image",use_cache:!1,is_intermediate:!1,board:n==="none"?void 0:{board_id:n}};return{id:"adhoc-esrgan-graph",nodes:{[n5]:r,[Za]:i},edges:[{source:{node_id:n5,field:"image"},destination:{node_id:Za,field:"image"}}]}},mke=()=>Pj(),cH=Sj;function yke(){if(console&&console.warn){for(var e=arguments.length,t=new Array(e),n=0;n()=>{if(e.isInitialized)t();else{const n=()=>{setTimeout(()=>{e.off("initialized",n)},0),t()};e.on("initialized",n)}};function GO(e,t,n){e.loadNamespaces(t,dH(e,n))}function HO(e,t,n,r){typeof n=="string"&&(n=[n]),n.forEach(i=>{e.options.ns.indexOf(i)<0&&e.options.ns.push(i)}),e.loadLanguages(t,dH(e,r))}function vke(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const r=t.languages[0],i=t.options?t.options.fallbackLng:!1,o=t.languages[t.languages.length-1];if(r.toLowerCase()==="cimode")return!0;const a=(s,l)=>{const u=t.services.backendConnector.state[`${s}|${l}`];return u===-1||u===2};return n.bindI18n&&n.bindI18n.indexOf("languageChanging")>-1&&t.services.backendConnector.backend&&t.isLanguageChangingTo&&!a(t.isLanguageChangingTo,e)?!1:!!(t.hasResourceBundle(r,e)||!t.services.backendConnector.backend||t.options.resources&&!t.options.partialBundledLanguages||a(r,e)&&(!i||a(o,e)))}function bke(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return!t.languages||!t.languages.length?(r4("i18n.languages were undefined or empty",t.languages),!0):t.options.ignoreJSONStructure!==void 0?t.hasLoadedNamespace(e,{lng:n.lng,precheck:(i,o)=>{if(n.bindI18n&&n.bindI18n.indexOf("languageChanging")>-1&&i.services.backendConnector.backend&&i.isLanguageChangingTo&&!o(i.isLanguageChangingTo,e))return!1}}):vke(e,t,n)}const _ke=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,Ske={"&":"&","&":"&","<":"<","<":"<",">":">",">":">","'":"'","'":"'",""":'"',""":'"'," ":" "," ":" ","©":"©","©":"©","®":"®","®":"®","…":"…","…":"…","/":"/","/":"/"},xke=e=>Ske[e],wke=e=>e.replace(_ke,xke);let i4={bindI18n:"languageChanged",bindI18nStore:"",transEmptyNodeValue:"",transSupportBasicHtmlNodes:!0,transWrapTextNodes:"",transKeepBasicHtmlNodesFor:["br","strong","i","p"],useSuspense:!0,unescape:wke};function Cke(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};i4={...i4,...e}}function Eke(){return i4}let fH;function kke(e){fH=e}function Tke(){return fH}const Ake={type:"3rdParty",init(e){Cke(e.options.react),kke(e)}},Pke=I.createContext();class Ike{constructor(){this.usedNamespaces={}}addUsedNamespaces(t){t.forEach(n=>{this.usedNamespaces[n]||(this.usedNamespaces[n]=!0)})}getUsedNamespaces(){return Object.keys(this.usedNamespaces)}}const Rke=(e,t)=>{const n=I.useRef();return I.useEffect(()=>{n.current=t?n.current:e},[e,t]),n.current};function Oke(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const{i18n:n}=t,{i18n:r,defaultNS:i}=I.useContext(Pke)||{},o=n||r||Tke();if(o&&!o.reportNamespaces&&(o.reportNamespaces=new Ike),!o){r4("You will need to pass in an i18next instance by using initReactI18next");const g=(S,w)=>typeof w=="string"?w:w&&typeof w=="object"&&typeof w.defaultValue=="string"?w.defaultValue:Array.isArray(S)?S[S.length-1]:S,y=[g,{},!1];return y.t=g,y.i18n={},y.ready=!1,y}o.options.react&&o.options.react.wait!==void 0&&r4("It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");const a={...Eke(),...o.options.react,...t},{useSuspense:s,keyPrefix:l}=a;let u=e||i||o.options&&o.options.defaultNS;u=typeof u=="string"?[u]:u||["translation"],o.reportNamespaces.addUsedNamespaces&&o.reportNamespaces.addUsedNamespaces(u);const c=(o.isInitialized||o.initializedStoreOnce)&&u.every(g=>bke(g,o,a));function d(){return o.getFixedT(t.lng||null,a.nsMode==="fallback"?u:u[0],l)}const[f,h]=I.useState(d);let p=u.join();t.lng&&(p=`${t.lng}${p}`);const m=Rke(p),_=I.useRef(!0);I.useEffect(()=>{const{bindI18n:g,bindI18nStore:y}=a;_.current=!0,!c&&!s&&(t.lng?HO(o,t.lng,u,()=>{_.current&&h(d)}):GO(o,u,()=>{_.current&&h(d)})),c&&m&&m!==p&&_.current&&h(d);function S(){_.current&&h(d)}return g&&o&&o.on(g,S),y&&o&&o.store.on(y,S),()=>{_.current=!1,g&&o&&g.split(" ").forEach(w=>o.off(w,S)),y&&o&&y.split(" ").forEach(w=>o.store.off(w,S))}},[o,p]);const b=I.useRef(!0);I.useEffect(()=>{_.current&&!b.current&&h(d),b.current=!1},[o,l]);const v=[f,o,c];if(v.t=f,v.i18n=o,v.ready=c,c||!c&&!s)return v;throw new Promise(g=>{t.lng?HO(o,t.lng,u,()=>g()):GO(o,u,()=>g())})}const Mke=(e,t)=>{if(!e||!t)return;const{width:n,height:r}=e,i=r*4*n*4,o=r*2*n*2;return{x4:i,x2:o}},Nke=(e,t)=>{if(!e||!t)return{x4:!0,x2:!0};const n={x4:!1,x2:!1};return e.x4<=t&&(n.x4=!0),e.x2<=t&&(n.x2=!0),n},$ke=(e,t)=>{if(!(!e||!t)&&!(e.x4&&e.x2)){if(!e.x2&&!e.x4)return"parameters.isAllowedToUpscale.tooLarge";if(!e.x4&&e.x2&&t===4)return"parameters.isAllowedToUpscale.useX2Model"}},hH=e=>Ii(nK,({postprocessing:t,config:n})=>{const{esrganModelName:r}=t,{maxUpscalePixels:i}=n,o=Mke(e,i),a=Nke(o,i),s=r.includes("x2")?2:4,l=$ke(a,s);return{isAllowedToUpscale:s===2?a.x2:a.x4,detailTKey:l}},Z2),_Ke=e=>{const{t}=Oke(),n=I.useMemo(()=>hH(e),[e]),{isAllowedToUpscale:r,detailTKey:i}=cH(n);return{isAllowedToUpscale:r,detail:i?t(i):void 0}},Dke=Ne("upscale/upscaleRequested"),Lke=()=>{Fe({actionCreator:Dke,effect:async(e,{dispatch:t,getState:n})=>{var f;const r=_e("session"),{imageDTO:i}=e.payload,{image_name:o}=i,a=n(),{isAllowedToUpscale:s,detailTKey:l}=hH(i)(a);if(!s){r.error({imageDTO:i},Z(l??"parameters.isAllowedToUpscale.tooLarge")),t(Gt({title:Z(l??"parameters.isAllowedToUpscale.tooLarge"),status:"error"}));return}const{esrganModelName:u}=a.postprocessing,{autoAddBoardId:c}=a.gallery,d=gke({image_name:o,esrganModelName:u,autoAddBoardId:c});try{const h=t(Qr.endpoints.enqueueGraph.initiate({graph:d,prepend:!0},{fixedCacheKey:"enqueueGraph"})),p=await h.unwrap();h.reset(),r.debug({enqueueResult:Qt(p)},Z("queue.graphQueued"))}catch(h){if(r.error({graph:Qt(d)},Z("queue.graphFailedToQueue")),h instanceof Object&&"data"in h&&"status"in h&&h.status===403){const p=((f=h.data)==null?void 0:f.detail)||"Unknown Error";t(Gt({title:Z("queue.graphFailedToQueue"),status:"error",description:p,duration:15e3}));return}t(Gt({title:Z("queue.graphFailedToQueue"),status:"error"}))}}})},Fke=tl(null),Bke=/^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z\-]+(?:\.[\da-z\-]+)*))?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?)?)?$/i,qO=e=>{if(typeof e!="string")throw new TypeError("Invalid argument expected string");const t=e.match(Bke);if(!t)throw new Error(`Invalid argument not valid semver ('${e}' received)`);return t.shift(),t},WO=e=>e==="*"||e==="x"||e==="X",KO=e=>{const t=parseInt(e,10);return isNaN(t)?e:t},zke=(e,t)=>typeof e!=typeof t?[String(e),String(t)]:[e,t],jke=(e,t)=>{if(WO(e)||WO(t))return 0;const[n,r]=zke(KO(e),KO(t));return n>r?1:n{for(let n=0;n{const n=qO(e),r=qO(t),i=n.pop(),o=r.pop(),a=QO(n,r);return a!==0?a:i&&o?QO(i.split("."),o.split(".")):i||o?i?-1:1:0},Vke=(e,t)=>{const n=wn(e),{nodes:r,edges:i}=n,o=[],a=r.filter(rE),s=fT(a,"id");return r.forEach(l=>{if(!rE(l))return;const u=t[l.data.type];if(!u){o.push({message:`${be.t("nodes.node")} "${l.data.type}" ${be.t("nodes.skipped")}`,issues:[`${be.t("nodes.nodeType")}"${l.data.type}" ${be.t("nodes.doesNotExist")}`],data:l});return}if(u.version&&l.data.version&&Uke(u.version,l.data.version)!==0){o.push({message:`${be.t("nodes.node")} "${l.data.type}" ${be.t("nodes.mismatchedVersion")}`,issues:[`${be.t("nodes.node")} "${l.data.type}" v${l.data.version} ${be.t("nodes.maybeIncompatible")} v${u.version}`],data:{node:l,nodeTemplate:Qt(u)}});return}}),i.forEach((l,u)=>{const c=s[l.source],d=s[l.target],f=[];if(c?l.type==="default"&&!(l.sourceHandle in c.data.outputs)&&f.push(`${be.t("nodes.outputNode")} "${l.source}.${l.sourceHandle}" ${be.t("nodes.doesNotExist")}`):f.push(`${be.t("nodes.outputNode")} ${l.source} ${be.t("nodes.doesNotExist")}`),d?l.type==="default"&&!(l.targetHandle in d.data.inputs)&&f.push(`${be.t("nodes.inputField")} "${l.target}.${l.targetHandle}" ${be.t("nodes.doesNotExist")}`):f.push(`${be.t("nodes.inputNode")} ${l.target} ${be.t("nodes.doesNotExist")}`),t[(c==null?void 0:c.data.type)??"__UNKNOWN_NODE_TYPE__"]||f.push(`${be.t("nodes.sourceNode")} "${l.source}" ${be.t("nodes.missingTemplate")} "${c==null?void 0:c.data.type}"`),t[(d==null?void 0:d.data.type)??"__UNKNOWN_NODE_TYPE__"]||f.push(`${be.t("nodes.sourceNode")}"${l.target}" ${be.t("nodes.missingTemplate")} "${d==null?void 0:d.data.type}"`),f.length){delete i[u];const h=l.type==="default"?l.sourceHandle:l.source,p=l.type==="default"?l.targetHandle:l.target;o.push({message:`Edge "${h} -> ${p}" skipped`,issues:f,data:l})}}),{workflow:n,errors:o}},Gke=()=>{Fe({actionCreator:cxe,effect:(e,{dispatch:t,getState:n})=>{const r=_e("nodes"),i=e.payload,o=n().nodes.nodeTemplates,{workflow:a,errors:s}=Vke(i,o);t(t2e(a)),s.length?(t(Gt($d({title:Z("toast.loadedWithWarnings"),status:"warning"}))),s.forEach(({message:l,...u})=>{r.warn(u,l)})):t(Gt($d({title:Z("toast.workflowLoaded"),status:"success"}))),t(oG("nodes")),requestAnimationFrame(()=>{var l;(l=Fke.get())==null||l.fitView()})}})};function Hke(e){if(e.sheet)return e.sheet;for(var t=0;t0?Ti(Pp,--Oo):0,ap--,$r===10&&(ap=1,Zx--),$r}function Ko(){return $r=Oo2||x0($r)>3?"":" "}function iTe(e,t){for(;--t&&Ko()&&!($r<48||$r>102||$r>57&&$r<65||$r>70&&$r<97););return Ay(e,H1()+(t<6&&Gs()==32&&Ko()==32))}function a4(e){for(;Ko();)switch($r){case e:return Oo;case 34:case 39:e!==34&&e!==39&&a4($r);break;case 40:e===41&&a4(e);break;case 92:Ko();break}return Oo}function oTe(e,t){for(;Ko()&&e+$r!==47+10;)if(e+$r===42+42&&Gs()===47)break;return"/*"+Ay(t,Oo-1)+"*"+Yx(e===47?e:Ko())}function aTe(e){for(;!x0(Gs());)Ko();return Ay(e,Oo)}function sTe(e){return bH(W1("",null,null,null,[""],e=vH(e),0,[0],e))}function W1(e,t,n,r,i,o,a,s,l){for(var u=0,c=0,d=a,f=0,h=0,p=0,m=1,_=1,b=1,v=0,g="",y=i,S=o,w=r,x=g;_;)switch(p=v,v=Ko()){case 40:if(p!=108&&Ti(x,d-1)==58){o4(x+=ln(q1(v),"&","&\f"),"&\f")!=-1&&(b=-1);break}case 34:case 39:case 91:x+=q1(v);break;case 9:case 10:case 13:case 32:x+=rTe(p);break;case 92:x+=iTe(H1()-1,7);continue;case 47:switch(Gs()){case 42:case 47:Wv(lTe(oTe(Ko(),H1()),t,n),l);break;default:x+="/"}break;case 123*m:s[u++]=ks(x)*b;case 125*m:case 59:case 0:switch(v){case 0:case 125:_=0;case 59+c:b==-1&&(x=ln(x,/\f/g,"")),h>0&&ks(x)-d&&Wv(h>32?YO(x+";",r,n,d-1):YO(ln(x," ","")+";",r,n,d-2),l);break;case 59:x+=";";default:if(Wv(w=XO(x,t,n,u,c,i,s,g,y=[],S=[],d),o),v===123)if(c===0)W1(x,t,w,w,y,o,d,s,S);else switch(f===99&&Ti(x,3)===110?100:f){case 100:case 108:case 109:case 115:W1(e,w,w,r&&Wv(XO(e,w,w,0,0,i,s,g,i,y=[],d),S),i,S,d,s,r?y:S);break;default:W1(x,w,w,w,[""],S,0,s,S)}}u=c=h=0,m=b=1,g=x="",d=a;break;case 58:d=1+ks(x),h=p;default:if(m<1){if(v==123)--m;else if(v==125&&m++==0&&nTe()==125)continue}switch(x+=Yx(v),v*m){case 38:b=c>0?1:(x+="\f",-1);break;case 44:s[u++]=(ks(x)-1)*b,b=1;break;case 64:Gs()===45&&(x+=q1(Ko())),f=Gs(),c=d=ks(g=x+=aTe(H1())),v++;break;case 45:p===45&&ks(x)==2&&(m=0)}}return o}function XO(e,t,n,r,i,o,a,s,l,u,c){for(var d=i-1,f=i===0?o:[""],h=jA(f),p=0,m=0,_=0;p0?f[b]+" "+v:ln(v,/&\f/g,f[b])))&&(l[_++]=g);return Jx(e,t,n,i===0?BA:s,l,u,c)}function lTe(e,t,n){return Jx(e,t,n,pH,Yx(tTe()),S0(e,2,-2),0)}function YO(e,t,n,r){return Jx(e,t,n,zA,S0(e,0,r),S0(e,r+1,-1),r)}function Sh(e,t){for(var n="",r=jA(e),i=0;i6)switch(Ti(e,t+1)){case 109:if(Ti(e,t+4)!==45)break;case 102:return ln(e,/(.+:)(.+)-([^]+)/,"$1"+sn+"$2-$3$1"+j_+(Ti(e,t+3)==108?"$3":"$2-$3"))+e;case 115:return~o4(e,"stretch")?SH(ln(e,"stretch","fill-available"),t)+e:e}break;case 4949:if(Ti(e,t+1)!==115)break;case 6444:switch(Ti(e,ks(e)-3-(~o4(e,"!important")&&10))){case 107:return ln(e,":",":"+sn)+e;case 101:return ln(e,/(.+:)([^;!]+)(;|!.+)?/,"$1"+sn+(Ti(e,14)===45?"inline-":"")+"box$3$1"+sn+"$2$3$1"+Bi+"$2box$3")+e}break;case 5936:switch(Ti(e,t+11)){case 114:return sn+e+Bi+ln(e,/[svh]\w+-[tblr]{2}/,"tb")+e;case 108:return sn+e+Bi+ln(e,/[svh]\w+-[tblr]{2}/,"tb-rl")+e;case 45:return sn+e+Bi+ln(e,/[svh]\w+-[tblr]{2}/,"lr")+e}return sn+e+Bi+e+e}return e}var yTe=function(t,n,r,i){if(t.length>-1&&!t.return)switch(t.type){case zA:t.return=SH(t.value,t.length);break;case gH:return Sh([ig(t,{value:ln(t.value,"@","@"+sn)})],i);case BA:if(t.length)return eTe(t.props,function(o){switch(Jke(o,/(::plac\w+|:read-\w+)/)){case":read-only":case":read-write":return Sh([ig(t,{props:[ln(o,/:(read-\w+)/,":"+j_+"$1")]})],i);case"::placeholder":return Sh([ig(t,{props:[ln(o,/:(plac\w+)/,":"+sn+"input-$1")]}),ig(t,{props:[ln(o,/:(plac\w+)/,":"+j_+"$1")]}),ig(t,{props:[ln(o,/:(plac\w+)/,Bi+"input-$1")]})],i)}return""})}},vTe=[yTe],bTe=function(t){var n=t.key;if(n==="css"){var r=document.querySelectorAll("style[data-emotion]:not([data-s])");Array.prototype.forEach.call(r,function(m){var _=m.getAttribute("data-emotion");_.indexOf(" ")!==-1&&(document.head.appendChild(m),m.setAttribute("data-s",""))})}var i=t.stylisPlugins||vTe,o={},a,s=[];a=t.container||document.head,Array.prototype.forEach.call(document.querySelectorAll('style[data-emotion^="'+n+' "]'),function(m){for(var _=m.getAttribute("data-emotion").split(" "),b=1;b<_.length;b++)o[_[b]]=!0;s.push(m)});var l,u=[gTe,mTe];{var c,d=[uTe,dTe(function(m){c.insert(m)})],f=cTe(u.concat(i,d)),h=function(_){return Sh(sTe(_),f)};l=function(_,b,v,g){c=v,h(_?_+"{"+b.styles+"}":b.styles),g&&(p.inserted[b.name]=!0)}}var p={key:n,sheet:new Wke({key:n,container:a,nonce:t.nonce,speedy:t.speedy,prepend:t.prepend,insertionPoint:t.insertionPoint}),nonce:t.nonce,inserted:o,registered:{},insert:l};return p.sheet.hydrate(s),p},_Te=!0;function STe(e,t,n){var r="";return n.split(" ").forEach(function(i){e[i]!==void 0?t.push(e[i]+";"):r+=i+" "}),r}var xH=function(t,n,r){var i=t.key+"-"+n.name;(r===!1||_Te===!1)&&t.registered[i]===void 0&&(t.registered[i]=n.styles)},wH=function(t,n,r){xH(t,n,r);var i=t.key+"-"+n.name;if(t.inserted[n.name]===void 0){var o=n;do t.insert(n===o?"."+i:"",o,t.sheet,!0),o=o.next;while(o!==void 0)}};function xTe(e){for(var t=0,n,r=0,i=e.length;i>=4;++r,i-=4)n=e.charCodeAt(r)&255|(e.charCodeAt(++r)&255)<<8|(e.charCodeAt(++r)&255)<<16|(e.charCodeAt(++r)&255)<<24,n=(n&65535)*1540483477+((n>>>16)*59797<<16),n^=n>>>24,t=(n&65535)*1540483477+((n>>>16)*59797<<16)^(t&65535)*1540483477+((t>>>16)*59797<<16);switch(i){case 3:t^=(e.charCodeAt(r+2)&255)<<16;case 2:t^=(e.charCodeAt(r+1)&255)<<8;case 1:t^=e.charCodeAt(r)&255,t=(t&65535)*1540483477+((t>>>16)*59797<<16)}return t^=t>>>13,t=(t&65535)*1540483477+((t>>>16)*59797<<16),((t^t>>>15)>>>0).toString(36)}var wTe={animationIterationCount:1,aspectRatio:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,msGridRow:1,msGridRowSpan:1,msGridColumn:1,msGridColumnSpan:1,fontWeight:1,lineHeight:1,opacity:1,order:1,orphans:1,tabSize:1,widows:1,zIndex:1,zoom:1,WebkitLineClamp:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1},CTe=/[A-Z]|^ms/g,ETe=/_EMO_([^_]+?)_([^]*?)_EMO_/g,CH=function(t){return t.charCodeAt(1)===45},eM=function(t){return t!=null&&typeof t!="boolean"},i5=_H(function(e){return CH(e)?e:e.replace(CTe,"-$&").toLowerCase()}),tM=function(t,n){switch(t){case"animation":case"animationName":if(typeof n=="string")return n.replace(ETe,function(r,i,o){return Ts={name:i,styles:o,next:Ts},i})}return wTe[t]!==1&&!CH(t)&&typeof n=="number"&&n!==0?n+"px":n};function w0(e,t,n){if(n==null)return"";if(n.__emotion_styles!==void 0)return n;switch(typeof n){case"boolean":return"";case"object":{if(n.anim===1)return Ts={name:n.name,styles:n.styles,next:Ts},n.name;if(n.styles!==void 0){var r=n.next;if(r!==void 0)for(;r!==void 0;)Ts={name:r.name,styles:r.styles,next:Ts},r=r.next;var i=n.styles+";";return i}return kTe(e,t,n)}case"function":{if(e!==void 0){var o=Ts,a=n(e);return Ts=o,w0(e,t,a)}break}}if(t==null)return n;var s=t[n];return s!==void 0?s:n}function kTe(e,t,n){var r="";if(Array.isArray(n))for(var i=0;iW.jsx("div",{className:"chakra-portal-zIndex",style:{position:"absolute",zIndex:e.zIndex,top:0,left:0,right:0},children:e.children}),jTe=e=>{const{appendToParentPortal:t,children:n}=e,[r,i]=I.useState(null),o=I.useRef(null),[,a]=I.useState({});I.useEffect(()=>a({}),[]);const s=FTe(),l=DTe();U_(()=>{if(!r)return;const c=r.ownerDocument,d=t?s??c.body:c.body;if(!d)return;o.current=c.createElement("div"),o.current.className=VA,d.appendChild(o.current),a({});const f=o.current;return()=>{d.contains(f)&&d.removeChild(f)}},[r]);const u=l!=null&&l.zIndex?W.jsx(zTe,{zIndex:l==null?void 0:l.zIndex,children:n}):n;return o.current?Uo.createPortal(W.jsx(PH,{value:o.current,children:u}),o.current):W.jsx("span",{ref:c=>{c&&i(c)}})},UTe=e=>{const{children:t,containerRef:n,appendToParentPortal:r}=e,i=n.current,o=i??(typeof window<"u"?document.body:void 0),a=I.useMemo(()=>{const l=i==null?void 0:i.ownerDocument.createElement("div");return l&&(l.className=VA),l},[i]),[,s]=I.useState({});return U_(()=>s({}),[]),U_(()=>{if(!(!a||!o))return o.appendChild(a),()=>{o.removeChild(a)}},[a,o]),o&&a?Uo.createPortal(W.jsx(PH,{value:r?a:null,children:t}),a):null};function ew(e){const t={appendToParentPortal:!0,...e},{containerRef:n,...r}=t;return n?W.jsx(UTe,{containerRef:n,...r}):W.jsx(jTe,{...r})}ew.className=VA;ew.selector=BTe;ew.displayName="Portal";function IH(){const e=I.useContext(C0);if(!e)throw Error("useTheme: `theme` is undefined. Seems you forgot to wrap your app in `` or ``");return e}var GA=I.createContext({});GA.displayName="ColorModeContext";function tw(){const e=I.useContext(GA);if(e===void 0)throw new Error("useColorMode must be used within a ColorModeProvider");return e}function SKe(e,t){const{colorMode:n}=tw();return n==="dark"?t:e}function VTe(){const e=tw(),t=IH();return{...e,theme:t}}function GTe(e,t,n){var r,i;if(t==null)return t;const o=a=>{var s,l;return(l=(s=e.__breakpoints)==null?void 0:s.asArray)==null?void 0:l[a]};return(i=(r=o(t))!=null?r:o(n))!=null?i:n}function HTe(e,t,n){var r,i;if(t==null)return t;const o=a=>{var s,l;return(l=(s=e.__cssMap)==null?void 0:s[a])==null?void 0:l.value};return(i=(r=o(t))!=null?r:o(n))!=null?i:n}function xKe(e,t,n){const r=IH();return qTe(e,t,n)(r)}function qTe(e,t,n){const r=Array.isArray(t)?t:[t],i=Array.isArray(n)?n:[n];return o=>{const a=i.filter(Boolean),s=r.map((l,u)=>{var c,d;if(e==="breakpoints")return GTe(o,l,(c=a[u])!=null?c:l);const f=`${e}.${l}`;return HTe(o,f,(d=a[u])!=null?d:l)});return Array.isArray(t)?s:s[0]}}var Ac=(...e)=>e.filter(Boolean).join(" ");function WTe(){return!1}function Hs(e){const t=typeof e;return e!=null&&(t==="object"||t==="function")&&!Array.isArray(e)}var wKe=e=>{const{condition:t,message:n}=e;t&&WTe()&&console.warn(n)};function $s(e,...t){return KTe(e)?e(...t):e}var KTe=e=>typeof e=="function",CKe=e=>e?"":void 0,EKe=e=>e?!0:void 0;function kKe(...e){return function(n){e.some(r=>(r==null||r(n),n==null?void 0:n.defaultPrevented))}}function TKe(...e){return function(n){e.forEach(r=>{r==null||r(n)})}}var V_={exports:{}};V_.exports;(function(e,t){var n=200,r="__lodash_hash_undefined__",i=800,o=16,a=9007199254740991,s="[object Arguments]",l="[object Array]",u="[object AsyncFunction]",c="[object Boolean]",d="[object Date]",f="[object Error]",h="[object Function]",p="[object GeneratorFunction]",m="[object Map]",_="[object Number]",b="[object Null]",v="[object Object]",g="[object Proxy]",y="[object RegExp]",S="[object Set]",w="[object String]",x="[object Undefined]",C="[object WeakMap]",T="[object ArrayBuffer]",k="[object DataView]",P="[object Float32Array]",$="[object Float64Array]",O="[object Int8Array]",E="[object Int16Array]",A="[object Int32Array]",D="[object Uint8Array]",L="[object Uint8ClampedArray]",M="[object Uint16Array]",R="[object Uint32Array]",N=/[\\^$.*+?()[\]{}|]/g,B=/^\[object .+?Constructor\]$/,U=/^(?:0|[1-9]\d*)$/,G={};G[P]=G[$]=G[O]=G[E]=G[A]=G[D]=G[L]=G[M]=G[R]=!0,G[s]=G[l]=G[T]=G[c]=G[k]=G[d]=G[f]=G[h]=G[m]=G[_]=G[v]=G[y]=G[S]=G[w]=G[C]=!1;var Y=typeof mt=="object"&&mt&&mt.Object===Object&&mt,ee=typeof self=="object"&&self&&self.Object===Object&&self,J=Y||ee||Function("return this")(),j=t&&!t.nodeType&&t,Q=j&&!0&&e&&!e.nodeType&&e,ne=Q&&Q.exports===j,se=ne&&Y.process,ve=function(){try{var F=Q&&Q.require&&Q.require("util").types;return F||se&&se.binding&&se.binding("util")}catch{}}(),ce=ve&&ve.isTypedArray;function bt(F,V,X){switch(X.length){case 0:return F.call(V);case 1:return F.call(V,X[0]);case 2:return F.call(V,X[0],X[1]);case 3:return F.call(V,X[0],X[1],X[2])}return F.apply(V,X)}function ot(F,V){for(var X=-1,pe=Array(F);++X-1}function ia(F,V){var X=this.__data__,pe=Ye(X,F);return pe<0?(++this.size,X.push([F,V])):X[pe][1]=V,this}zr.prototype.clear=Da,zr.prototype.delete=hs,zr.prototype.get=mi,zr.prototype.has=ru,zr.prototype.set=ia;function ni(F){var V=-1,X=F==null?0:F.length;for(this.clear();++V1?X[Ct-1]:void 0,Pn=Ct>2?X[2]:void 0;for(hn=F.length>3&&typeof hn=="function"?(Ct--,hn):void 0,Pn&&Mt(X[0],X[1],Pn)&&(hn=Ct<3?void 0:hn,Ct=1),V=Object(V);++pe-1&&F%1==0&&F0){if(++V>=i)return arguments[0]}else V=0;return F.apply(void 0,arguments)}}function dt(F){if(F!=null){try{return en.call(F)}catch{}try{return F+""}catch{}}return""}function Ve(F,V){return F===V||F!==F&&V!==V}var we=_t(function(){return arguments}())?_t:function(F){return Ae(F)&&Ln.call(F,"callee")&&!Qi.call(F,"callee")},ue=Array.isArray;function Ee(F){return F!=null&&et(F.length)&&!Ce(F)}function fe(F){return Ae(F)&&Ee(F)}var ge=ol||Xi;function Ce(F){if(!Qe(F))return!1;var V=ct(F);return V==h||V==p||V==u||V==g}function et(F){return typeof F=="number"&&F>-1&&F%1==0&&F<=a}function Qe(F){var V=typeof F;return F!=null&&(V=="object"||V=="function")}function Ae(F){return F!=null&&typeof F=="object"}function Tt(F){if(!Ae(F)||ct(F)!=v)return!1;var V=Mi(F);if(V===null)return!0;var X=Ln.call(V,"constructor")&&V.constructor;return typeof X=="function"&&X instanceof X&&en.call(X)==Jr}var jt=ce?ze(ce):kt;function Vt(F){return La(F,or(F))}function or(F){return Ee(F)?Ie(F,!0):cn(F)}var pr=it(function(F,V,X,pe){dn(F,V,X,pe)});function zn(F){return function(){return F}}function An(F){return F}function Xi(){return!1}e.exports=pr})(V_,V_.exports);var QTe=V_.exports;const Ds=pc(QTe);var XTe=e=>/!(important)?$/.test(e),iM=e=>typeof e=="string"?e.replace(/!(important)?$/,"").trim():e,YTe=(e,t)=>n=>{const r=String(t),i=XTe(r),o=iM(r),a=e?`${e}.${o}`:o;let s=Hs(n.__cssMap)&&a in n.__cssMap?n.__cssMap[a].varRef:t;return s=iM(s),i?`${s} !important`:s};function HA(e){const{scale:t,transform:n,compose:r}=e;return(o,a)=>{var s;const l=YTe(t,o)(a);let u=(s=n==null?void 0:n(l,a))!=null?s:l;return r&&(u=r(u,a)),u}}var Kv=(...e)=>t=>e.reduce((n,r)=>r(n),t);function la(e,t){return n=>{const r={property:n,scale:e};return r.transform=HA({scale:e,transform:t}),r}}var ZTe=({rtl:e,ltr:t})=>n=>n.direction==="rtl"?e:t;function JTe(e){const{property:t,scale:n,transform:r}=e;return{scale:n,property:ZTe(t),transform:n?HA({scale:n,compose:r}):r}}var RH=["rotate(var(--chakra-rotate, 0))","scaleX(var(--chakra-scale-x, 1))","scaleY(var(--chakra-scale-y, 1))","skewX(var(--chakra-skew-x, 0))","skewY(var(--chakra-skew-y, 0))"];function eAe(){return["translateX(var(--chakra-translate-x, 0))","translateY(var(--chakra-translate-y, 0))",...RH].join(" ")}function tAe(){return["translate3d(var(--chakra-translate-x, 0), var(--chakra-translate-y, 0), 0)",...RH].join(" ")}var nAe={"--chakra-blur":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-brightness":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-contrast":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-grayscale":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-hue-rotate":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-invert":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-saturate":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-sepia":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-drop-shadow":"var(--chakra-empty,/*!*/ /*!*/)",filter:["var(--chakra-blur)","var(--chakra-brightness)","var(--chakra-contrast)","var(--chakra-grayscale)","var(--chakra-hue-rotate)","var(--chakra-invert)","var(--chakra-saturate)","var(--chakra-sepia)","var(--chakra-drop-shadow)"].join(" ")},rAe={backdropFilter:["var(--chakra-backdrop-blur)","var(--chakra-backdrop-brightness)","var(--chakra-backdrop-contrast)","var(--chakra-backdrop-grayscale)","var(--chakra-backdrop-hue-rotate)","var(--chakra-backdrop-invert)","var(--chakra-backdrop-opacity)","var(--chakra-backdrop-saturate)","var(--chakra-backdrop-sepia)"].join(" "),"--chakra-backdrop-blur":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-backdrop-brightness":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-backdrop-contrast":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-backdrop-grayscale":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-backdrop-hue-rotate":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-backdrop-invert":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-backdrop-opacity":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-backdrop-saturate":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-backdrop-sepia":"var(--chakra-empty,/*!*/ /*!*/)"};function iAe(e){return{"--chakra-ring-offset-shadow":"var(--chakra-ring-inset) 0 0 0 var(--chakra-ring-offset-width) var(--chakra-ring-offset-color)","--chakra-ring-shadow":"var(--chakra-ring-inset) 0 0 0 calc(var(--chakra-ring-width) + var(--chakra-ring-offset-width)) var(--chakra-ring-color)","--chakra-ring-width":e,boxShadow:["var(--chakra-ring-offset-shadow)","var(--chakra-ring-shadow)","var(--chakra-shadow, 0 0 #0000)"].join(", ")}}var oAe={"row-reverse":{space:"--chakra-space-x-reverse",divide:"--chakra-divide-x-reverse"},"column-reverse":{space:"--chakra-space-y-reverse",divide:"--chakra-divide-y-reverse"}},s4={"to-t":"to top","to-tr":"to top right","to-r":"to right","to-br":"to bottom right","to-b":"to bottom","to-bl":"to bottom left","to-l":"to left","to-tl":"to top left"},aAe=new Set(Object.values(s4)),l4=new Set(["none","-moz-initial","inherit","initial","revert","unset"]),sAe=e=>e.trim();function lAe(e,t){if(e==null||l4.has(e))return e;if(!(u4(e)||l4.has(e)))return`url('${e}')`;const i=/(^[a-z-A-Z]+)\((.*)\)/g.exec(e),o=i==null?void 0:i[1],a=i==null?void 0:i[2];if(!o||!a)return e;const s=o.includes("-gradient")?o:`${o}-gradient`,[l,...u]=a.split(",").map(sAe).filter(Boolean);if((u==null?void 0:u.length)===0)return e;const c=l in s4?s4[l]:l;u.unshift(c);const d=u.map(f=>{if(aAe.has(f))return f;const h=f.indexOf(" "),[p,m]=h!==-1?[f.substr(0,h),f.substr(h+1)]:[f],_=u4(m)?m:m&&m.split(" "),b=`colors.${p}`,v=b in t.__cssMap?t.__cssMap[b].varRef:p;return _?[v,...Array.isArray(_)?_:[_]].join(" "):v});return`${s}(${d.join(", ")})`}var u4=e=>typeof e=="string"&&e.includes("(")&&e.includes(")"),uAe=(e,t)=>lAe(e,t??{});function cAe(e){return/^var\(--.+\)$/.test(e)}var dAe=e=>{const t=parseFloat(e.toString()),n=e.toString().replace(String(t),"");return{unitless:!n,value:t,unit:n}},bs=e=>t=>`${e}(${t})`,Kt={filter(e){return e!=="auto"?e:nAe},backdropFilter(e){return e!=="auto"?e:rAe},ring(e){return iAe(Kt.px(e))},bgClip(e){return e==="text"?{color:"transparent",backgroundClip:"text"}:{backgroundClip:e}},transform(e){return e==="auto"?eAe():e==="auto-gpu"?tAe():e},vh(e){return e==="$100vh"?"var(--chakra-vh)":e},px(e){if(e==null)return e;const{unitless:t}=dAe(e);return t||typeof e=="number"?`${e}px`:e},fraction(e){return typeof e!="number"||e>1?e:`${e*100}%`},float(e,t){const n={left:"right",right:"left"};return t.direction==="rtl"?n[e]:e},degree(e){if(cAe(e)||e==null)return e;const t=typeof e=="string"&&!e.endsWith("deg");return typeof e=="number"||t?`${e}deg`:e},gradient:uAe,blur:bs("blur"),opacity:bs("opacity"),brightness:bs("brightness"),contrast:bs("contrast"),dropShadow:bs("drop-shadow"),grayscale:bs("grayscale"),hueRotate:bs("hue-rotate"),invert:bs("invert"),saturate:bs("saturate"),sepia:bs("sepia"),bgImage(e){return e==null||u4(e)||l4.has(e)?e:`url(${e})`},outline(e){const t=String(e)==="0"||String(e)==="none";return e!==null&&t?{outline:"2px solid transparent",outlineOffset:"2px"}:{outline:e}},flexDirection(e){var t;const{space:n,divide:r}=(t=oAe[e])!=null?t:{},i={flexDirection:e};return n&&(i[n]=1),r&&(i[r]=1),i}},H={borderWidths:la("borderWidths"),borderStyles:la("borderStyles"),colors:la("colors"),borders:la("borders"),gradients:la("gradients",Kt.gradient),radii:la("radii",Kt.px),space:la("space",Kv(Kt.vh,Kt.px)),spaceT:la("space",Kv(Kt.vh,Kt.px)),degreeT(e){return{property:e,transform:Kt.degree}},prop(e,t,n){return{property:e,scale:t,...t&&{transform:HA({scale:t,transform:n})}}},propT(e,t){return{property:e,transform:t}},sizes:la("sizes",Kv(Kt.vh,Kt.px)),sizesT:la("sizes",Kv(Kt.vh,Kt.fraction)),shadows:la("shadows"),logical:JTe,blur:la("blur",Kt.blur)},K1={background:H.colors("background"),backgroundColor:H.colors("backgroundColor"),backgroundImage:H.gradients("backgroundImage"),backgroundSize:!0,backgroundPosition:!0,backgroundRepeat:!0,backgroundAttachment:!0,backgroundClip:{transform:Kt.bgClip},bgSize:H.prop("backgroundSize"),bgPosition:H.prop("backgroundPosition"),bg:H.colors("background"),bgColor:H.colors("backgroundColor"),bgPos:H.prop("backgroundPosition"),bgRepeat:H.prop("backgroundRepeat"),bgAttachment:H.prop("backgroundAttachment"),bgGradient:H.gradients("backgroundImage"),bgClip:{transform:Kt.bgClip}};Object.assign(K1,{bgImage:K1.backgroundImage,bgImg:K1.backgroundImage});var an={border:H.borders("border"),borderWidth:H.borderWidths("borderWidth"),borderStyle:H.borderStyles("borderStyle"),borderColor:H.colors("borderColor"),borderRadius:H.radii("borderRadius"),borderTop:H.borders("borderTop"),borderBlockStart:H.borders("borderBlockStart"),borderTopLeftRadius:H.radii("borderTopLeftRadius"),borderStartStartRadius:H.logical({scale:"radii",property:{ltr:"borderTopLeftRadius",rtl:"borderTopRightRadius"}}),borderEndStartRadius:H.logical({scale:"radii",property:{ltr:"borderBottomLeftRadius",rtl:"borderBottomRightRadius"}}),borderTopRightRadius:H.radii("borderTopRightRadius"),borderStartEndRadius:H.logical({scale:"radii",property:{ltr:"borderTopRightRadius",rtl:"borderTopLeftRadius"}}),borderEndEndRadius:H.logical({scale:"radii",property:{ltr:"borderBottomRightRadius",rtl:"borderBottomLeftRadius"}}),borderRight:H.borders("borderRight"),borderInlineEnd:H.borders("borderInlineEnd"),borderBottom:H.borders("borderBottom"),borderBlockEnd:H.borders("borderBlockEnd"),borderBottomLeftRadius:H.radii("borderBottomLeftRadius"),borderBottomRightRadius:H.radii("borderBottomRightRadius"),borderLeft:H.borders("borderLeft"),borderInlineStart:{property:"borderInlineStart",scale:"borders"},borderInlineStartRadius:H.logical({scale:"radii",property:{ltr:["borderTopLeftRadius","borderBottomLeftRadius"],rtl:["borderTopRightRadius","borderBottomRightRadius"]}}),borderInlineEndRadius:H.logical({scale:"radii",property:{ltr:["borderTopRightRadius","borderBottomRightRadius"],rtl:["borderTopLeftRadius","borderBottomLeftRadius"]}}),borderX:H.borders(["borderLeft","borderRight"]),borderInline:H.borders("borderInline"),borderY:H.borders(["borderTop","borderBottom"]),borderBlock:H.borders("borderBlock"),borderTopWidth:H.borderWidths("borderTopWidth"),borderBlockStartWidth:H.borderWidths("borderBlockStartWidth"),borderTopColor:H.colors("borderTopColor"),borderBlockStartColor:H.colors("borderBlockStartColor"),borderTopStyle:H.borderStyles("borderTopStyle"),borderBlockStartStyle:H.borderStyles("borderBlockStartStyle"),borderBottomWidth:H.borderWidths("borderBottomWidth"),borderBlockEndWidth:H.borderWidths("borderBlockEndWidth"),borderBottomColor:H.colors("borderBottomColor"),borderBlockEndColor:H.colors("borderBlockEndColor"),borderBottomStyle:H.borderStyles("borderBottomStyle"),borderBlockEndStyle:H.borderStyles("borderBlockEndStyle"),borderLeftWidth:H.borderWidths("borderLeftWidth"),borderInlineStartWidth:H.borderWidths("borderInlineStartWidth"),borderLeftColor:H.colors("borderLeftColor"),borderInlineStartColor:H.colors("borderInlineStartColor"),borderLeftStyle:H.borderStyles("borderLeftStyle"),borderInlineStartStyle:H.borderStyles("borderInlineStartStyle"),borderRightWidth:H.borderWidths("borderRightWidth"),borderInlineEndWidth:H.borderWidths("borderInlineEndWidth"),borderRightColor:H.colors("borderRightColor"),borderInlineEndColor:H.colors("borderInlineEndColor"),borderRightStyle:H.borderStyles("borderRightStyle"),borderInlineEndStyle:H.borderStyles("borderInlineEndStyle"),borderTopRadius:H.radii(["borderTopLeftRadius","borderTopRightRadius"]),borderBottomRadius:H.radii(["borderBottomLeftRadius","borderBottomRightRadius"]),borderLeftRadius:H.radii(["borderTopLeftRadius","borderBottomLeftRadius"]),borderRightRadius:H.radii(["borderTopRightRadius","borderBottomRightRadius"])};Object.assign(an,{rounded:an.borderRadius,roundedTop:an.borderTopRadius,roundedTopLeft:an.borderTopLeftRadius,roundedTopRight:an.borderTopRightRadius,roundedTopStart:an.borderStartStartRadius,roundedTopEnd:an.borderStartEndRadius,roundedBottom:an.borderBottomRadius,roundedBottomLeft:an.borderBottomLeftRadius,roundedBottomRight:an.borderBottomRightRadius,roundedBottomStart:an.borderEndStartRadius,roundedBottomEnd:an.borderEndEndRadius,roundedLeft:an.borderLeftRadius,roundedRight:an.borderRightRadius,roundedStart:an.borderInlineStartRadius,roundedEnd:an.borderInlineEndRadius,borderStart:an.borderInlineStart,borderEnd:an.borderInlineEnd,borderTopStartRadius:an.borderStartStartRadius,borderTopEndRadius:an.borderStartEndRadius,borderBottomStartRadius:an.borderEndStartRadius,borderBottomEndRadius:an.borderEndEndRadius,borderStartRadius:an.borderInlineStartRadius,borderEndRadius:an.borderInlineEndRadius,borderStartWidth:an.borderInlineStartWidth,borderEndWidth:an.borderInlineEndWidth,borderStartColor:an.borderInlineStartColor,borderEndColor:an.borderInlineEndColor,borderStartStyle:an.borderInlineStartStyle,borderEndStyle:an.borderInlineEndStyle});var fAe={color:H.colors("color"),textColor:H.colors("color"),fill:H.colors("fill"),stroke:H.colors("stroke")},c4={boxShadow:H.shadows("boxShadow"),mixBlendMode:!0,blendMode:H.prop("mixBlendMode"),backgroundBlendMode:!0,bgBlendMode:H.prop("backgroundBlendMode"),opacity:!0};Object.assign(c4,{shadow:c4.boxShadow});var hAe={filter:{transform:Kt.filter},blur:H.blur("--chakra-blur"),brightness:H.propT("--chakra-brightness",Kt.brightness),contrast:H.propT("--chakra-contrast",Kt.contrast),hueRotate:H.degreeT("--chakra-hue-rotate"),invert:H.propT("--chakra-invert",Kt.invert),saturate:H.propT("--chakra-saturate",Kt.saturate),dropShadow:H.propT("--chakra-drop-shadow",Kt.dropShadow),backdropFilter:{transform:Kt.backdropFilter},backdropBlur:H.blur("--chakra-backdrop-blur"),backdropBrightness:H.propT("--chakra-backdrop-brightness",Kt.brightness),backdropContrast:H.propT("--chakra-backdrop-contrast",Kt.contrast),backdropHueRotate:H.degreeT("--chakra-backdrop-hue-rotate"),backdropInvert:H.propT("--chakra-backdrop-invert",Kt.invert),backdropSaturate:H.propT("--chakra-backdrop-saturate",Kt.saturate)},G_={alignItems:!0,alignContent:!0,justifyItems:!0,justifyContent:!0,flexWrap:!0,flexDirection:{transform:Kt.flexDirection},flex:!0,flexFlow:!0,flexGrow:!0,flexShrink:!0,flexBasis:H.sizes("flexBasis"),justifySelf:!0,alignSelf:!0,order:!0,placeItems:!0,placeContent:!0,placeSelf:!0,gap:H.space("gap"),rowGap:H.space("rowGap"),columnGap:H.space("columnGap")};Object.assign(G_,{flexDir:G_.flexDirection});var OH={gridGap:H.space("gridGap"),gridColumnGap:H.space("gridColumnGap"),gridRowGap:H.space("gridRowGap"),gridColumn:!0,gridRow:!0,gridAutoFlow:!0,gridAutoColumns:!0,gridColumnStart:!0,gridColumnEnd:!0,gridRowStart:!0,gridRowEnd:!0,gridAutoRows:!0,gridTemplate:!0,gridTemplateColumns:!0,gridTemplateRows:!0,gridTemplateAreas:!0,gridArea:!0},pAe={appearance:!0,cursor:!0,resize:!0,userSelect:!0,pointerEvents:!0,outline:{transform:Kt.outline},outlineOffset:!0,outlineColor:H.colors("outlineColor")},da={width:H.sizesT("width"),inlineSize:H.sizesT("inlineSize"),height:H.sizes("height"),blockSize:H.sizes("blockSize"),boxSize:H.sizes(["width","height"]),minWidth:H.sizes("minWidth"),minInlineSize:H.sizes("minInlineSize"),minHeight:H.sizes("minHeight"),minBlockSize:H.sizes("minBlockSize"),maxWidth:H.sizes("maxWidth"),maxInlineSize:H.sizes("maxInlineSize"),maxHeight:H.sizes("maxHeight"),maxBlockSize:H.sizes("maxBlockSize"),overflow:!0,overflowX:!0,overflowY:!0,overscrollBehavior:!0,overscrollBehaviorX:!0,overscrollBehaviorY:!0,display:!0,aspectRatio:!0,hideFrom:{scale:"breakpoints",transform:(e,t)=>{var n,r,i;return{[`@media screen and (min-width: ${(i=(r=(n=t.__breakpoints)==null?void 0:n.get(e))==null?void 0:r.minW)!=null?i:e})`]:{display:"none"}}}},hideBelow:{scale:"breakpoints",transform:(e,t)=>{var n,r,i;return{[`@media screen and (max-width: ${(i=(r=(n=t.__breakpoints)==null?void 0:n.get(e))==null?void 0:r._minW)!=null?i:e})`]:{display:"none"}}}},verticalAlign:!0,boxSizing:!0,boxDecorationBreak:!0,float:H.propT("float",Kt.float),objectFit:!0,objectPosition:!0,visibility:!0,isolation:!0};Object.assign(da,{w:da.width,h:da.height,minW:da.minWidth,maxW:da.maxWidth,minH:da.minHeight,maxH:da.maxHeight,overscroll:da.overscrollBehavior,overscrollX:da.overscrollBehaviorX,overscrollY:da.overscrollBehaviorY});var gAe={listStyleType:!0,listStylePosition:!0,listStylePos:H.prop("listStylePosition"),listStyleImage:!0,listStyleImg:H.prop("listStyleImage")};function mAe(e,t,n,r){const i=typeof t=="string"?t.split("."):[t];for(r=0;r{const t=new WeakMap;return(r,i,o,a)=>{if(typeof r>"u")return e(r,i,o);t.has(r)||t.set(r,new Map);const s=t.get(r);if(s.has(i))return s.get(i);const l=e(r,i,o,a);return s.set(i,l),l}},vAe=yAe(mAe),bAe={border:"0px",clip:"rect(0, 0, 0, 0)",width:"1px",height:"1px",margin:"-1px",padding:"0px",overflow:"hidden",whiteSpace:"nowrap",position:"absolute"},_Ae={position:"static",width:"auto",height:"auto",clip:"auto",padding:"0",margin:"0",overflow:"visible",whiteSpace:"normal"},o5=(e,t,n)=>{const r={},i=vAe(e,t,{});for(const o in i)o in n&&n[o]!=null||(r[o]=i[o]);return r},SAe={srOnly:{transform(e){return e===!0?bAe:e==="focusable"?_Ae:{}}},layerStyle:{processResult:!0,transform:(e,t,n)=>o5(t,`layerStyles.${e}`,n)},textStyle:{processResult:!0,transform:(e,t,n)=>o5(t,`textStyles.${e}`,n)},apply:{processResult:!0,transform:(e,t,n)=>o5(t,e,n)}},Qg={position:!0,pos:H.prop("position"),zIndex:H.prop("zIndex","zIndices"),inset:H.spaceT("inset"),insetX:H.spaceT(["left","right"]),insetInline:H.spaceT("insetInline"),insetY:H.spaceT(["top","bottom"]),insetBlock:H.spaceT("insetBlock"),top:H.spaceT("top"),insetBlockStart:H.spaceT("insetBlockStart"),bottom:H.spaceT("bottom"),insetBlockEnd:H.spaceT("insetBlockEnd"),left:H.spaceT("left"),insetInlineStart:H.logical({scale:"space",property:{ltr:"left",rtl:"right"}}),right:H.spaceT("right"),insetInlineEnd:H.logical({scale:"space",property:{ltr:"right",rtl:"left"}})};Object.assign(Qg,{insetStart:Qg.insetInlineStart,insetEnd:Qg.insetInlineEnd});var xAe={ring:{transform:Kt.ring},ringColor:H.colors("--chakra-ring-color"),ringOffset:H.prop("--chakra-ring-offset-width"),ringOffsetColor:H.colors("--chakra-ring-offset-color"),ringInset:H.prop("--chakra-ring-inset")},Un={margin:H.spaceT("margin"),marginTop:H.spaceT("marginTop"),marginBlockStart:H.spaceT("marginBlockStart"),marginRight:H.spaceT("marginRight"),marginInlineEnd:H.spaceT("marginInlineEnd"),marginBottom:H.spaceT("marginBottom"),marginBlockEnd:H.spaceT("marginBlockEnd"),marginLeft:H.spaceT("marginLeft"),marginInlineStart:H.spaceT("marginInlineStart"),marginX:H.spaceT(["marginInlineStart","marginInlineEnd"]),marginInline:H.spaceT("marginInline"),marginY:H.spaceT(["marginTop","marginBottom"]),marginBlock:H.spaceT("marginBlock"),padding:H.space("padding"),paddingTop:H.space("paddingTop"),paddingBlockStart:H.space("paddingBlockStart"),paddingRight:H.space("paddingRight"),paddingBottom:H.space("paddingBottom"),paddingBlockEnd:H.space("paddingBlockEnd"),paddingLeft:H.space("paddingLeft"),paddingInlineStart:H.space("paddingInlineStart"),paddingInlineEnd:H.space("paddingInlineEnd"),paddingX:H.space(["paddingInlineStart","paddingInlineEnd"]),paddingInline:H.space("paddingInline"),paddingY:H.space(["paddingTop","paddingBottom"]),paddingBlock:H.space("paddingBlock")};Object.assign(Un,{m:Un.margin,mt:Un.marginTop,mr:Un.marginRight,me:Un.marginInlineEnd,marginEnd:Un.marginInlineEnd,mb:Un.marginBottom,ml:Un.marginLeft,ms:Un.marginInlineStart,marginStart:Un.marginInlineStart,mx:Un.marginX,my:Un.marginY,p:Un.padding,pt:Un.paddingTop,py:Un.paddingY,px:Un.paddingX,pb:Un.paddingBottom,pl:Un.paddingLeft,ps:Un.paddingInlineStart,paddingStart:Un.paddingInlineStart,pr:Un.paddingRight,pe:Un.paddingInlineEnd,paddingEnd:Un.paddingInlineEnd});var wAe={textDecorationColor:H.colors("textDecorationColor"),textDecoration:!0,textDecor:{property:"textDecoration"},textDecorationLine:!0,textDecorationStyle:!0,textDecorationThickness:!0,textUnderlineOffset:!0,textShadow:H.shadows("textShadow")},CAe={clipPath:!0,transform:H.propT("transform",Kt.transform),transformOrigin:!0,translateX:H.spaceT("--chakra-translate-x"),translateY:H.spaceT("--chakra-translate-y"),skewX:H.degreeT("--chakra-skew-x"),skewY:H.degreeT("--chakra-skew-y"),scaleX:H.prop("--chakra-scale-x"),scaleY:H.prop("--chakra-scale-y"),scale:H.prop(["--chakra-scale-x","--chakra-scale-y"]),rotate:H.degreeT("--chakra-rotate")},EAe={transition:!0,transitionDelay:!0,animation:!0,willChange:!0,transitionDuration:H.prop("transitionDuration","transition.duration"),transitionProperty:H.prop("transitionProperty","transition.property"),transitionTimingFunction:H.prop("transitionTimingFunction","transition.easing")},kAe={fontFamily:H.prop("fontFamily","fonts"),fontSize:H.prop("fontSize","fontSizes",Kt.px),fontWeight:H.prop("fontWeight","fontWeights"),lineHeight:H.prop("lineHeight","lineHeights"),letterSpacing:H.prop("letterSpacing","letterSpacings"),textAlign:!0,fontStyle:!0,textIndent:!0,wordBreak:!0,overflowWrap:!0,textOverflow:!0,textTransform:!0,whiteSpace:!0,isTruncated:{transform(e){if(e===!0)return{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}}},noOfLines:{static:{overflow:"hidden",textOverflow:"ellipsis",display:"-webkit-box",WebkitBoxOrient:"vertical",WebkitLineClamp:"var(--chakra-line-clamp)"},property:"--chakra-line-clamp"}},TAe={scrollBehavior:!0,scrollSnapAlign:!0,scrollSnapStop:!0,scrollSnapType:!0,scrollMargin:H.spaceT("scrollMargin"),scrollMarginTop:H.spaceT("scrollMarginTop"),scrollMarginBottom:H.spaceT("scrollMarginBottom"),scrollMarginLeft:H.spaceT("scrollMarginLeft"),scrollMarginRight:H.spaceT("scrollMarginRight"),scrollMarginX:H.spaceT(["scrollMarginLeft","scrollMarginRight"]),scrollMarginY:H.spaceT(["scrollMarginTop","scrollMarginBottom"]),scrollPadding:H.spaceT("scrollPadding"),scrollPaddingTop:H.spaceT("scrollPaddingTop"),scrollPaddingBottom:H.spaceT("scrollPaddingBottom"),scrollPaddingLeft:H.spaceT("scrollPaddingLeft"),scrollPaddingRight:H.spaceT("scrollPaddingRight"),scrollPaddingX:H.spaceT(["scrollPaddingLeft","scrollPaddingRight"]),scrollPaddingY:H.spaceT(["scrollPaddingTop","scrollPaddingBottom"])};function MH(e){return Hs(e)&&e.reference?e.reference:String(e)}var nw=(e,...t)=>t.map(MH).join(` ${e} `).replace(/calc/g,""),oM=(...e)=>`calc(${nw("+",...e)})`,aM=(...e)=>`calc(${nw("-",...e)})`,d4=(...e)=>`calc(${nw("*",...e)})`,sM=(...e)=>`calc(${nw("/",...e)})`,lM=e=>{const t=MH(e);return t!=null&&!Number.isNaN(parseFloat(t))?String(t).startsWith("-")?String(t).slice(1):`-${t}`:d4(t,-1)},Kc=Object.assign(e=>({add:(...t)=>Kc(oM(e,...t)),subtract:(...t)=>Kc(aM(e,...t)),multiply:(...t)=>Kc(d4(e,...t)),divide:(...t)=>Kc(sM(e,...t)),negate:()=>Kc(lM(e)),toString:()=>e.toString()}),{add:oM,subtract:aM,multiply:d4,divide:sM,negate:lM});function AAe(e,t="-"){return e.replace(/\s+/g,t)}function PAe(e){const t=AAe(e.toString());return RAe(IAe(t))}function IAe(e){return e.includes("\\.")?e:!Number.isInteger(parseFloat(e.toString()))?e.replace(".","\\."):e}function RAe(e){return e.replace(/[!-,/:-@[-^`{-~]/g,"\\$&")}function OAe(e,t=""){return[t,e].filter(Boolean).join("-")}function MAe(e,t){return`var(${e}${t?`, ${t}`:""})`}function NAe(e,t=""){return PAe(`--${OAe(e,t)}`)}function nt(e,t,n){const r=NAe(e,n);return{variable:r,reference:MAe(r,t)}}function $Ae(e,t){const n={};for(const r of t){if(Array.isArray(r)){const[i,o]=r;n[i]=nt(`${e}-${i}`,o);continue}n[r]=nt(`${e}-${r}`)}return n}function DAe(e){const t=e==null?0:e.length;return t?e[t-1]:void 0}function LAe(e){const t=parseFloat(e.toString()),n=e.toString().replace(String(t),"");return{unitless:!n,value:t,unit:n}}function f4(e){if(e==null)return e;const{unitless:t}=LAe(e);return t||typeof e=="number"?`${e}px`:e}var NH=(e,t)=>parseInt(e[1],10)>parseInt(t[1],10)?1:-1,qA=e=>Object.fromEntries(Object.entries(e).sort(NH));function uM(e){const t=qA(e);return Object.assign(Object.values(t),t)}function FAe(e){const t=Object.keys(qA(e));return new Set(t)}function cM(e){var t;if(!e)return e;e=(t=f4(e))!=null?t:e;const n=-.02;return typeof e=="number"?`${e+n}`:e.replace(/(\d+\.?\d*)/u,r=>`${parseFloat(r)+n}`)}function Eg(e,t){const n=["@media screen"];return e&&n.push("and",`(min-width: ${f4(e)})`),t&&n.push("and",`(max-width: ${f4(t)})`),n.join(" ")}function BAe(e){var t;if(!e)return null;e.base=(t=e.base)!=null?t:"0px";const n=uM(e),r=Object.entries(e).sort(NH).map(([a,s],l,u)=>{var c;let[,d]=(c=u[l+1])!=null?c:[];return d=parseFloat(d)>0?cM(d):void 0,{_minW:cM(s),breakpoint:a,minW:s,maxW:d,maxWQuery:Eg(null,d),minWQuery:Eg(s),minMaxQuery:Eg(s,d)}}),i=FAe(e),o=Array.from(i.values());return{keys:i,normalized:n,isResponsive(a){const s=Object.keys(a);return s.length>0&&s.every(l=>i.has(l))},asObject:qA(e),asArray:uM(e),details:r,get(a){return r.find(s=>s.breakpoint===a)},media:[null,...n.map(a=>Eg(a)).slice(1)],toArrayValue(a){if(!Hs(a))throw new Error("toArrayValue: value must be an object");const s=o.map(l=>{var u;return(u=a[l])!=null?u:null});for(;DAe(s)===null;)s.pop();return s},toObjectValue(a){if(!Array.isArray(a))throw new Error("toObjectValue: value must be an array");return a.reduce((s,l,u)=>{const c=o[u];return c!=null&&l!=null&&(s[c]=l),s},{})}}}var _i={hover:(e,t)=>`${e}:hover ${t}, ${e}[data-hover] ${t}`,focus:(e,t)=>`${e}:focus ${t}, ${e}[data-focus] ${t}`,focusVisible:(e,t)=>`${e}:focus-visible ${t}`,focusWithin:(e,t)=>`${e}:focus-within ${t}`,active:(e,t)=>`${e}:active ${t}, ${e}[data-active] ${t}`,disabled:(e,t)=>`${e}:disabled ${t}, ${e}[data-disabled] ${t}`,invalid:(e,t)=>`${e}:invalid ${t}, ${e}[data-invalid] ${t}`,checked:(e,t)=>`${e}:checked ${t}, ${e}[data-checked] ${t}`,indeterminate:(e,t)=>`${e}:indeterminate ${t}, ${e}[aria-checked=mixed] ${t}, ${e}[data-indeterminate] ${t}`,readOnly:(e,t)=>`${e}:read-only ${t}, ${e}[readonly] ${t}, ${e}[data-read-only] ${t}`,expanded:(e,t)=>`${e}:read-only ${t}, ${e}[aria-expanded=true] ${t}, ${e}[data-expanded] ${t}`,placeholderShown:(e,t)=>`${e}:placeholder-shown ${t}`},cu=e=>$H(t=>e(t,"&"),"[role=group]","[data-group]",".group"),fl=e=>$H(t=>e(t,"~ &"),"[data-peer]",".peer"),$H=(e,...t)=>t.map(e).join(", "),rw={_hover:"&:hover, &[data-hover]",_active:"&:active, &[data-active]",_focus:"&:focus, &[data-focus]",_highlighted:"&[data-highlighted]",_focusWithin:"&:focus-within",_focusVisible:"&:focus-visible, &[data-focus-visible]",_disabled:"&:disabled, &[disabled], &[aria-disabled=true], &[data-disabled]",_readOnly:"&[aria-readonly=true], &[readonly], &[data-readonly]",_before:"&::before",_after:"&::after",_empty:"&:empty",_expanded:"&[aria-expanded=true], &[data-expanded]",_checked:"&[aria-checked=true], &[data-checked]",_grabbed:"&[aria-grabbed=true], &[data-grabbed]",_pressed:"&[aria-pressed=true], &[data-pressed]",_invalid:"&[aria-invalid=true], &[data-invalid]",_valid:"&[data-valid], &[data-state=valid]",_loading:"&[data-loading], &[aria-busy=true]",_selected:"&[aria-selected=true], &[data-selected]",_hidden:"&[hidden], &[data-hidden]",_autofill:"&:-webkit-autofill",_even:"&:nth-of-type(even)",_odd:"&:nth-of-type(odd)",_first:"&:first-of-type",_firstLetter:"&::first-letter",_last:"&:last-of-type",_notFirst:"&:not(:first-of-type)",_notLast:"&:not(:last-of-type)",_visited:"&:visited",_activeLink:"&[aria-current=page]",_activeStep:"&[aria-current=step]",_indeterminate:"&:indeterminate, &[aria-checked=mixed], &[data-indeterminate]",_groupHover:cu(_i.hover),_peerHover:fl(_i.hover),_groupFocus:cu(_i.focus),_peerFocus:fl(_i.focus),_groupFocusVisible:cu(_i.focusVisible),_peerFocusVisible:fl(_i.focusVisible),_groupActive:cu(_i.active),_peerActive:fl(_i.active),_groupDisabled:cu(_i.disabled),_peerDisabled:fl(_i.disabled),_groupInvalid:cu(_i.invalid),_peerInvalid:fl(_i.invalid),_groupChecked:cu(_i.checked),_peerChecked:fl(_i.checked),_groupFocusWithin:cu(_i.focusWithin),_peerFocusWithin:fl(_i.focusWithin),_peerPlaceholderShown:fl(_i.placeholderShown),_placeholder:"&::placeholder",_placeholderShown:"&:placeholder-shown",_fullScreen:"&:fullscreen",_selection:"&::selection",_rtl:"[dir=rtl] &, &[dir=rtl]",_ltr:"[dir=ltr] &, &[dir=ltr]",_mediaDark:"@media (prefers-color-scheme: dark)",_mediaReduceMotion:"@media (prefers-reduced-motion: reduce)",_dark:".chakra-ui-dark &:not([data-theme]),[data-theme=dark] &:not([data-theme]),&[data-theme=dark]",_light:".chakra-ui-light &:not([data-theme]),[data-theme=light] &:not([data-theme]),&[data-theme=light]",_horizontal:"&[data-orientation=horizontal]",_vertical:"&[data-orientation=vertical]"},DH=Object.keys(rw);function dM(e,t){return nt(String(e).replace(/\./g,"-"),void 0,t)}function zAe(e,t){let n={};const r={};for(const[i,o]of Object.entries(e)){const{isSemantic:a,value:s}=o,{variable:l,reference:u}=dM(i,t==null?void 0:t.cssVarPrefix);if(!a){if(i.startsWith("space")){const f=i.split("."),[h,...p]=f,m=`${h}.-${p.join(".")}`,_=Kc.negate(s),b=Kc.negate(u);r[m]={value:_,var:l,varRef:b}}n[l]=s,r[i]={value:s,var:l,varRef:u};continue}const c=f=>{const p=[String(i).split(".")[0],f].join(".");if(!e[p])return f;const{reference:_}=dM(p,t==null?void 0:t.cssVarPrefix);return _},d=Hs(s)?s:{default:s};n=Ds(n,Object.entries(d).reduce((f,[h,p])=>{var m,_;if(!p)return f;const b=c(`${p}`);if(h==="default")return f[l]=b,f;const v=(_=(m=rw)==null?void 0:m[h])!=null?_:h;return f[v]={[l]:b},f},{})),r[i]={value:u,var:l,varRef:u}}return{cssVars:n,cssMap:r}}function jAe(e,t=[]){const n=Object.assign({},e);for(const r of t)r in n&&delete n[r];return n}function UAe(e,t){const n={};for(const r of t)r in e&&(n[r]=e[r]);return n}function VAe(e){return typeof e=="object"&&e!=null&&!Array.isArray(e)}function fM(e,t,n={}){const{stop:r,getKey:i}=n;function o(a,s=[]){var l;if(VAe(a)||Array.isArray(a)){const u={};for(const[c,d]of Object.entries(a)){const f=(l=i==null?void 0:i(c))!=null?l:c,h=[...s,f];if(r!=null&&r(a,h))return t(a,s);u[f]=o(d,h)}return u}return t(a,s)}return o(e)}var GAe=["colors","borders","borderWidths","borderStyles","fonts","fontSizes","fontWeights","gradients","letterSpacings","lineHeights","radii","space","shadows","sizes","zIndices","transition","blur","breakpoints"];function HAe(e){return UAe(e,GAe)}function qAe(e){return e.semanticTokens}function WAe(e){const{__cssMap:t,__cssVars:n,__breakpoints:r,...i}=e;return i}var KAe=e=>DH.includes(e)||e==="default";function QAe({tokens:e,semanticTokens:t}){const n={};return fM(e,(r,i)=>{r!=null&&(n[i.join(".")]={isSemantic:!1,value:r})}),fM(t,(r,i)=>{r!=null&&(n[i.join(".")]={isSemantic:!0,value:r})},{stop:r=>Object.keys(r).every(KAe)}),n}function XAe(e){var t;const n=WAe(e),r=HAe(n),i=qAe(n),o=QAe({tokens:r,semanticTokens:i}),a=(t=n.config)==null?void 0:t.cssVarPrefix,{cssMap:s,cssVars:l}=zAe(o,{cssVarPrefix:a});return Object.assign(n,{__cssVars:{...{"--chakra-ring-inset":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-ring-offset-width":"0px","--chakra-ring-offset-color":"#fff","--chakra-ring-color":"rgba(66, 153, 225, 0.6)","--chakra-ring-offset-shadow":"0 0 #0000","--chakra-ring-shadow":"0 0 #0000","--chakra-space-x-reverse":"0","--chakra-space-y-reverse":"0"},...l},__cssMap:s,__breakpoints:BAe(n.breakpoints)}),n}var WA=Ds({},K1,an,fAe,G_,da,hAe,xAe,pAe,OH,SAe,Qg,c4,Un,TAe,kAe,wAe,CAe,gAe,EAe),YAe=Object.assign({},Un,da,G_,OH,Qg),AKe=Object.keys(YAe),ZAe=[...Object.keys(WA),...DH],JAe={...WA,...rw},ePe=e=>e in JAe,tPe=e=>t=>{if(!t.__breakpoints)return e;const{isResponsive:n,toArrayValue:r,media:i}=t.__breakpoints,o={};for(const a in e){let s=$s(e[a],t);if(s==null)continue;if(s=Hs(s)&&n(s)?r(s):s,!Array.isArray(s)){o[a]=s;continue}const l=s.slice(0,i.length).length;for(let u=0;ue.startsWith("--")&&typeof t=="string"&&!rPe(t),oPe=(e,t)=>{var n,r;if(t==null)return t;const i=l=>{var u,c;return(c=(u=e.__cssMap)==null?void 0:u[l])==null?void 0:c.varRef},o=l=>{var u;return(u=i(l))!=null?u:l},[a,s]=nPe(t);return t=(r=(n=i(a))!=null?n:o(s))!=null?r:o(t),t};function aPe(e){const{configs:t={},pseudos:n={},theme:r}=e,i=(o,a=!1)=>{var s,l,u;const c=$s(o,r),d=tPe(c)(r);let f={};for(let h in d){const p=d[h];let m=$s(p,r);h in n&&(h=n[h]),iPe(h,m)&&(m=oPe(r,m));let _=t[h];if(_===!0&&(_={property:h}),Hs(m)){f[h]=(s=f[h])!=null?s:{},f[h]=Ds({},f[h],i(m,!0));continue}let b=(u=(l=_==null?void 0:_.transform)==null?void 0:l.call(_,m,r,c))!=null?u:m;b=_!=null&&_.processResult?i(b,!0):b;const v=$s(_==null?void 0:_.property,r);if(!a&&(_!=null&&_.static)){const g=$s(_.static,r);f=Ds({},f,g)}if(v&&Array.isArray(v)){for(const g of v)f[g]=b;continue}if(v){v==="&"&&Hs(b)?f=Ds({},f,b):f[v]=b;continue}if(Hs(b)){f=Ds({},f,b);continue}f[h]=b}return f};return i}var LH=e=>t=>aPe({theme:t,pseudos:rw,configs:WA})(e);function Pt(e){return{definePartsStyle(t){return t},defineMultiStyleConfig(t){return{parts:e,...t}}}}function sPe(e,t){if(Array.isArray(e))return e;if(Hs(e))return t(e);if(e!=null)return[e]}function lPe(e,t){for(let n=t+1;n{Ds(u,{[g]:f?v[g]:{[b]:v[g]}})});continue}if(!h){f?Ds(u,v):u[b]=v;continue}u[b]=v}}return u}}function cPe(e){return t=>{var n;const{variant:r,size:i,theme:o}=t,a=uPe(o);return Ds({},$s((n=e.baseStyle)!=null?n:{},t),a(e,"sizes",i,t),a(e,"variants",r,t))}}function PKe(e,t,n){var r,i,o;return(o=(i=(r=e.__cssMap)==null?void 0:r[`${t}.${n}`])==null?void 0:i.varRef)!=null?o:n}function Iy(e){return jAe(e,["styleConfig","size","variant","colorScheme"])}var dPe={common:"background-color, border-color, color, fill, stroke, opacity, box-shadow, transform",colors:"background-color, border-color, color, fill, stroke",dimensions:"width, height",position:"left, right, top, bottom",background:"background-color, background-image, background-position"},fPe={"ease-in":"cubic-bezier(0.4, 0, 1, 1)","ease-out":"cubic-bezier(0, 0, 0.2, 1)","ease-in-out":"cubic-bezier(0.4, 0, 0.2, 1)"},hPe={"ultra-fast":"50ms",faster:"100ms",fast:"150ms",normal:"200ms",slow:"300ms",slower:"400ms","ultra-slow":"500ms"},pPe={property:dPe,easing:fPe,duration:hPe},gPe=pPe,mPe={hide:-1,auto:"auto",base:0,docked:10,dropdown:1e3,sticky:1100,banner:1200,overlay:1300,modal:1400,popover:1500,skipLink:1600,toast:1700,tooltip:1800},yPe=mPe,vPe={none:0,"1px":"1px solid","2px":"2px solid","4px":"4px solid","8px":"8px solid"},bPe=vPe,_Pe={base:"0em",sm:"30em",md:"48em",lg:"62em",xl:"80em","2xl":"96em"},SPe=_Pe,xPe={transparent:"transparent",current:"currentColor",black:"#000000",white:"#FFFFFF",whiteAlpha:{50:"rgba(255, 255, 255, 0.04)",100:"rgba(255, 255, 255, 0.06)",200:"rgba(255, 255, 255, 0.08)",300:"rgba(255, 255, 255, 0.16)",400:"rgba(255, 255, 255, 0.24)",500:"rgba(255, 255, 255, 0.36)",600:"rgba(255, 255, 255, 0.48)",700:"rgba(255, 255, 255, 0.64)",800:"rgba(255, 255, 255, 0.80)",900:"rgba(255, 255, 255, 0.92)"},blackAlpha:{50:"rgba(0, 0, 0, 0.04)",100:"rgba(0, 0, 0, 0.06)",200:"rgba(0, 0, 0, 0.08)",300:"rgba(0, 0, 0, 0.16)",400:"rgba(0, 0, 0, 0.24)",500:"rgba(0, 0, 0, 0.36)",600:"rgba(0, 0, 0, 0.48)",700:"rgba(0, 0, 0, 0.64)",800:"rgba(0, 0, 0, 0.80)",900:"rgba(0, 0, 0, 0.92)"},gray:{50:"#F7FAFC",100:"#EDF2F7",200:"#E2E8F0",300:"#CBD5E0",400:"#A0AEC0",500:"#718096",600:"#4A5568",700:"#2D3748",800:"#1A202C",900:"#171923"},red:{50:"#FFF5F5",100:"#FED7D7",200:"#FEB2B2",300:"#FC8181",400:"#F56565",500:"#E53E3E",600:"#C53030",700:"#9B2C2C",800:"#822727",900:"#63171B"},orange:{50:"#FFFAF0",100:"#FEEBC8",200:"#FBD38D",300:"#F6AD55",400:"#ED8936",500:"#DD6B20",600:"#C05621",700:"#9C4221",800:"#7B341E",900:"#652B19"},yellow:{50:"#FFFFF0",100:"#FEFCBF",200:"#FAF089",300:"#F6E05E",400:"#ECC94B",500:"#D69E2E",600:"#B7791F",700:"#975A16",800:"#744210",900:"#5F370E"},green:{50:"#F0FFF4",100:"#C6F6D5",200:"#9AE6B4",300:"#68D391",400:"#48BB78",500:"#38A169",600:"#2F855A",700:"#276749",800:"#22543D",900:"#1C4532"},teal:{50:"#E6FFFA",100:"#B2F5EA",200:"#81E6D9",300:"#4FD1C5",400:"#38B2AC",500:"#319795",600:"#2C7A7B",700:"#285E61",800:"#234E52",900:"#1D4044"},blue:{50:"#ebf8ff",100:"#bee3f8",200:"#90cdf4",300:"#63b3ed",400:"#4299e1",500:"#3182ce",600:"#2b6cb0",700:"#2c5282",800:"#2a4365",900:"#1A365D"},cyan:{50:"#EDFDFD",100:"#C4F1F9",200:"#9DECF9",300:"#76E4F7",400:"#0BC5EA",500:"#00B5D8",600:"#00A3C4",700:"#0987A0",800:"#086F83",900:"#065666"},purple:{50:"#FAF5FF",100:"#E9D8FD",200:"#D6BCFA",300:"#B794F4",400:"#9F7AEA",500:"#805AD5",600:"#6B46C1",700:"#553C9A",800:"#44337A",900:"#322659"},pink:{50:"#FFF5F7",100:"#FED7E2",200:"#FBB6CE",300:"#F687B3",400:"#ED64A6",500:"#D53F8C",600:"#B83280",700:"#97266D",800:"#702459",900:"#521B41"},linkedin:{50:"#E8F4F9",100:"#CFEDFB",200:"#9BDAF3",300:"#68C7EC",400:"#34B3E4",500:"#00A0DC",600:"#008CC9",700:"#0077B5",800:"#005E93",900:"#004471"},facebook:{50:"#E8F4F9",100:"#D9DEE9",200:"#B7C2DA",300:"#6482C0",400:"#4267B2",500:"#385898",600:"#314E89",700:"#29487D",800:"#223B67",900:"#1E355B"},messenger:{50:"#D0E6FF",100:"#B9DAFF",200:"#A2CDFF",300:"#7AB8FF",400:"#2E90FF",500:"#0078FF",600:"#0063D1",700:"#0052AC",800:"#003C7E",900:"#002C5C"},whatsapp:{50:"#dffeec",100:"#b9f5d0",200:"#90edb3",300:"#65e495",400:"#3cdd78",500:"#22c35e",600:"#179848",700:"#0c6c33",800:"#01421c",900:"#001803"},twitter:{50:"#E5F4FD",100:"#C8E9FB",200:"#A8DCFA",300:"#83CDF7",400:"#57BBF5",500:"#1DA1F2",600:"#1A94DA",700:"#1681BF",800:"#136B9E",900:"#0D4D71"},telegram:{50:"#E3F2F9",100:"#C5E4F3",200:"#A2D4EC",300:"#7AC1E4",400:"#47A9DA",500:"#0088CC",600:"#007AB8",700:"#006BA1",800:"#005885",900:"#003F5E"}},wPe=xPe,CPe={none:"0",sm:"0.125rem",base:"0.25rem",md:"0.375rem",lg:"0.5rem",xl:"0.75rem","2xl":"1rem","3xl":"1.5rem",full:"9999px"},EPe=CPe,kPe={xs:"0 0 0 1px rgba(0, 0, 0, 0.05)",sm:"0 1px 2px 0 rgba(0, 0, 0, 0.05)",base:"0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06)",md:"0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)",lg:"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)",xl:"0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04)","2xl":"0 25px 50px -12px rgba(0, 0, 0, 0.25)",outline:"0 0 0 3px rgba(66, 153, 225, 0.6)",inner:"inset 0 2px 4px 0 rgba(0,0,0,0.06)",none:"none","dark-lg":"rgba(0, 0, 0, 0.1) 0px 0px 0px 1px, rgba(0, 0, 0, 0.2) 0px 5px 10px, rgba(0, 0, 0, 0.4) 0px 15px 40px"},TPe=kPe,APe={none:0,sm:"4px",base:"8px",md:"12px",lg:"16px",xl:"24px","2xl":"40px","3xl":"64px"},PPe=APe,IPe={letterSpacings:{tighter:"-0.05em",tight:"-0.025em",normal:"0",wide:"0.025em",wider:"0.05em",widest:"0.1em"},lineHeights:{normal:"normal",none:1,shorter:1.25,short:1.375,base:1.5,tall:1.625,taller:"2",3:".75rem",4:"1rem",5:"1.25rem",6:"1.5rem",7:"1.75rem",8:"2rem",9:"2.25rem",10:"2.5rem"},fontWeights:{hairline:100,thin:200,light:300,normal:400,medium:500,semibold:600,bold:700,extrabold:800,black:900},fonts:{heading:'-apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"',body:'-apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"',mono:'SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace'},fontSizes:{"3xs":"0.45rem","2xs":"0.625rem",xs:"0.75rem",sm:"0.875rem",md:"1rem",lg:"1.125rem",xl:"1.25rem","2xl":"1.5rem","3xl":"1.875rem","4xl":"2.25rem","5xl":"3rem","6xl":"3.75rem","7xl":"4.5rem","8xl":"6rem","9xl":"8rem"}},FH=IPe,BH={px:"1px",.5:"0.125rem",1:"0.25rem",1.5:"0.375rem",2:"0.5rem",2.5:"0.625rem",3:"0.75rem",3.5:"0.875rem",4:"1rem",5:"1.25rem",6:"1.5rem",7:"1.75rem",8:"2rem",9:"2.25rem",10:"2.5rem",12:"3rem",14:"3.5rem",16:"4rem",20:"5rem",24:"6rem",28:"7rem",32:"8rem",36:"9rem",40:"10rem",44:"11rem",48:"12rem",52:"13rem",56:"14rem",60:"15rem",64:"16rem",72:"18rem",80:"20rem",96:"24rem"},RPe={max:"max-content",min:"min-content",full:"100%","3xs":"14rem","2xs":"16rem",xs:"20rem",sm:"24rem",md:"28rem",lg:"32rem",xl:"36rem","2xl":"42rem","3xl":"48rem","4xl":"56rem","5xl":"64rem","6xl":"72rem","7xl":"80rem","8xl":"90rem",prose:"60ch"},OPe={sm:"640px",md:"768px",lg:"1024px",xl:"1280px"},MPe={...BH,...RPe,container:OPe},zH=MPe,NPe={breakpoints:SPe,zIndices:yPe,radii:EPe,blur:PPe,colors:wPe,...FH,sizes:zH,shadows:TPe,space:BH,borders:bPe,transition:gPe},{defineMultiStyleConfig:$Pe,definePartsStyle:kg}=Pt(["stepper","step","title","description","indicator","separator","icon","number"]),kl=nt("stepper-indicator-size"),Uf=nt("stepper-icon-size"),Vf=nt("stepper-title-font-size"),Tg=nt("stepper-description-font-size"),og=nt("stepper-accent-color"),DPe=kg(({colorScheme:e})=>({stepper:{display:"flex",justifyContent:"space-between",gap:"4","&[data-orientation=vertical]":{flexDirection:"column",alignItems:"flex-start"},"&[data-orientation=horizontal]":{flexDirection:"row",alignItems:"center"},[og.variable]:`colors.${e}.500`,_dark:{[og.variable]:`colors.${e}.200`}},title:{fontSize:Vf.reference,fontWeight:"medium"},description:{fontSize:Tg.reference,color:"chakra-subtle-text"},number:{fontSize:Vf.reference},step:{flexShrink:0,position:"relative",display:"flex",gap:"2","&[data-orientation=horizontal]":{alignItems:"center"},flex:"1","&:last-of-type:not([data-stretch])":{flex:"initial"}},icon:{flexShrink:0,width:Uf.reference,height:Uf.reference},indicator:{flexShrink:0,borderRadius:"full",width:kl.reference,height:kl.reference,display:"flex",justifyContent:"center",alignItems:"center","&[data-status=active]":{borderWidth:"2px",borderColor:og.reference},"&[data-status=complete]":{bg:og.reference,color:"chakra-inverse-text"},"&[data-status=incomplete]":{borderWidth:"2px"}},separator:{bg:"chakra-border-color",flex:"1","&[data-status=complete]":{bg:og.reference},"&[data-orientation=horizontal]":{width:"100%",height:"2px",marginStart:"2"},"&[data-orientation=vertical]":{width:"2px",position:"absolute",height:"100%",maxHeight:`calc(100% - ${kl.reference} - 8px)`,top:`calc(${kl.reference} + 4px)`,insetStart:`calc(${kl.reference} / 2 - 1px)`}}})),LPe=$Pe({baseStyle:DPe,sizes:{xs:kg({stepper:{[kl.variable]:"sizes.4",[Uf.variable]:"sizes.3",[Vf.variable]:"fontSizes.xs",[Tg.variable]:"fontSizes.xs"}}),sm:kg({stepper:{[kl.variable]:"sizes.6",[Uf.variable]:"sizes.4",[Vf.variable]:"fontSizes.sm",[Tg.variable]:"fontSizes.xs"}}),md:kg({stepper:{[kl.variable]:"sizes.8",[Uf.variable]:"sizes.5",[Vf.variable]:"fontSizes.md",[Tg.variable]:"fontSizes.sm"}}),lg:kg({stepper:{[kl.variable]:"sizes.10",[Uf.variable]:"sizes.6",[Vf.variable]:"fontSizes.lg",[Tg.variable]:"fontSizes.md"}})},defaultProps:{size:"md",colorScheme:"blue"}});function pn(e,t={}){let n=!1;function r(){if(!n){n=!0;return}throw new Error("[anatomy] .part(...) should only be called once. Did you mean to use .extend(...) ?")}function i(...c){r();for(const d of c)t[d]=l(d);return pn(e,t)}function o(...c){for(const d of c)d in t||(t[d]=l(d));return pn(e,t)}function a(){return Object.fromEntries(Object.entries(t).map(([d,f])=>[d,f.selector]))}function s(){return Object.fromEntries(Object.entries(t).map(([d,f])=>[d,f.className]))}function l(c){const h=`chakra-${(["container","root"].includes(c??"")?[e]:[e,c]).filter(Boolean).join("__")}`;return{className:h,selector:`.${h}`,toString:()=>c}}return{parts:i,toPart:l,extend:o,selectors:a,classnames:s,get keys(){return Object.keys(t)},__type:{}}}var jH=pn("accordion").parts("root","container","button","panel").extend("icon"),FPe=pn("alert").parts("title","description","container").extend("icon","spinner"),BPe=pn("avatar").parts("label","badge","container").extend("excessLabel","group"),zPe=pn("breadcrumb").parts("link","item","container").extend("separator");pn("button").parts();var UH=pn("checkbox").parts("control","icon","container").extend("label");pn("progress").parts("track","filledTrack").extend("label");var jPe=pn("drawer").parts("overlay","dialogContainer","dialog").extend("header","closeButton","body","footer"),VH=pn("editable").parts("preview","input","textarea"),UPe=pn("form").parts("container","requiredIndicator","helperText"),VPe=pn("formError").parts("text","icon"),GH=pn("input").parts("addon","field","element","group"),GPe=pn("list").parts("container","item","icon"),HH=pn("menu").parts("button","list","item").extend("groupTitle","icon","command","divider"),qH=pn("modal").parts("overlay","dialogContainer","dialog").extend("header","closeButton","body","footer"),WH=pn("numberinput").parts("root","field","stepperGroup","stepper");pn("pininput").parts("field");var KH=pn("popover").parts("content","header","body","footer").extend("popper","arrow","closeButton"),QH=pn("progress").parts("label","filledTrack","track"),HPe=pn("radio").parts("container","control","label"),XH=pn("select").parts("field","icon"),YH=pn("slider").parts("container","track","thumb","filledTrack","mark"),qPe=pn("stat").parts("container","label","helpText","number","icon"),ZH=pn("switch").parts("container","track","thumb"),WPe=pn("table").parts("table","thead","tbody","tr","th","td","tfoot","caption"),JH=pn("tabs").parts("root","tab","tablist","tabpanel","tabpanels","indicator"),KPe=pn("tag").parts("container","label","closeButton"),QPe=pn("card").parts("container","header","body","footer");function ad(e,t,n){return Math.min(Math.max(e,n),t)}class XPe extends Error{constructor(t){super(`Failed to parse color: "${t}"`)}}var Ag=XPe;function KA(e){if(typeof e!="string")throw new Ag(e);if(e.trim().toLowerCase()==="transparent")return[0,0,0,0];let t=e.trim();t=i6e.test(e)?JPe(e):e;const n=e6e.exec(t);if(n){const a=Array.from(n).slice(1);return[...a.slice(0,3).map(s=>parseInt(E0(s,2),16)),parseInt(E0(a[3]||"f",2),16)/255]}const r=t6e.exec(t);if(r){const a=Array.from(r).slice(1);return[...a.slice(0,3).map(s=>parseInt(s,16)),parseInt(a[3]||"ff",16)/255]}const i=n6e.exec(t);if(i){const a=Array.from(i).slice(1);return[...a.slice(0,3).map(s=>parseInt(s,10)),parseFloat(a[3]||"1")]}const o=r6e.exec(t);if(o){const[a,s,l,u]=Array.from(o).slice(1).map(parseFloat);if(ad(0,100,s)!==s)throw new Ag(e);if(ad(0,100,l)!==l)throw new Ag(e);return[...o6e(a,s,l),Number.isNaN(u)?1:u]}throw new Ag(e)}function YPe(e){let t=5381,n=e.length;for(;n;)t=t*33^e.charCodeAt(--n);return(t>>>0)%2341}const hM=e=>parseInt(e.replace(/_/g,""),36),ZPe="1q29ehhb 1n09sgk7 1kl1ekf_ _yl4zsno 16z9eiv3 1p29lhp8 _bd9zg04 17u0____ _iw9zhe5 _to73___ _r45e31e _7l6g016 _jh8ouiv _zn3qba8 1jy4zshs 11u87k0u 1ro9yvyo 1aj3xael 1gz9zjz0 _3w8l4xo 1bf1ekf_ _ke3v___ _4rrkb__ 13j776yz _646mbhl _nrjr4__ _le6mbhl 1n37ehkb _m75f91n _qj3bzfz 1939yygw 11i5z6x8 _1k5f8xs 1509441m 15t5lwgf _ae2th1n _tg1ugcv 1lp1ugcv 16e14up_ _h55rw7n _ny9yavn _7a11xb_ 1ih442g9 _pv442g9 1mv16xof 14e6y7tu 1oo9zkds 17d1cisi _4v9y70f _y98m8kc 1019pq0v 12o9zda8 _348j4f4 1et50i2o _8epa8__ _ts6senj 1o350i2o 1mi9eiuo 1259yrp0 1ln80gnw _632xcoy 1cn9zldc _f29edu4 1n490c8q _9f9ziet 1b94vk74 _m49zkct 1kz6s73a 1eu9dtog _q58s1rz 1dy9sjiq __u89jo3 _aj5nkwg _ld89jo3 13h9z6wx _qa9z2ii _l119xgq _bs5arju 1hj4nwk9 1qt4nwk9 1ge6wau6 14j9zlcw 11p1edc_ _ms1zcxe _439shk6 _jt9y70f _754zsow 1la40eju _oq5p___ _x279qkz 1fa5r3rv _yd2d9ip _424tcku _8y1di2_ _zi2uabw _yy7rn9h 12yz980_ __39ljp6 1b59zg0x _n39zfzp 1fy9zest _b33k___ _hp9wq92 1il50hz4 _io472ub _lj9z3eo 19z9ykg0 _8t8iu3a 12b9bl4a 1ak5yw0o _896v4ku _tb8k8lv _s59zi6t _c09ze0p 1lg80oqn 1id9z8wb _238nba5 1kq6wgdi _154zssg _tn3zk49 _da9y6tc 1sg7cv4f _r12jvtt 1gq5fmkz 1cs9rvci _lp9jn1c _xw1tdnb 13f9zje6 16f6973h _vo7ir40 _bt5arjf _rc45e4t _hr4e100 10v4e100 _hc9zke2 _w91egv_ _sj2r1kk 13c87yx8 _vqpds__ _ni8ggk8 _tj9yqfb 1ia2j4r4 _7x9b10u 1fc9ld4j 1eq9zldr _5j9lhpx _ez9zl6o _md61fzm".split(" ").reduce((e,t)=>{const n=hM(t.substring(0,3)),r=hM(t.substring(3)).toString(16);let i="";for(let o=0;o<6-r.length;o++)i+="0";return e[n]=`${i}${r}`,e},{});function JPe(e){const t=e.toLowerCase().trim(),n=ZPe[YPe(t)];if(!n)throw new Ag(e);return`#${n}`}const E0=(e,t)=>Array.from(Array(t)).map(()=>e).join(""),e6e=new RegExp(`^#${E0("([a-f0-9])",3)}([a-f0-9])?$`,"i"),t6e=new RegExp(`^#${E0("([a-f0-9]{2})",3)}([a-f0-9]{2})?$`,"i"),n6e=new RegExp(`^rgba?\\(\\s*(\\d+)\\s*${E0(",\\s*(\\d+)\\s*",2)}(?:,\\s*([\\d.]+))?\\s*\\)$`,"i"),r6e=/^hsla?\(\s*([\d.]+)\s*,\s*([\d.]+)%\s*,\s*([\d.]+)%(?:\s*,\s*([\d.]+))?\s*\)$/i,i6e=/^[a-z]+$/i,pM=e=>Math.round(e*255),o6e=(e,t,n)=>{let r=n/100;if(t===0)return[r,r,r].map(pM);const i=(e%360+360)%360/60,o=(1-Math.abs(2*r-1))*(t/100),a=o*(1-Math.abs(i%2-1));let s=0,l=0,u=0;i>=0&&i<1?(s=o,l=a):i>=1&&i<2?(s=a,l=o):i>=2&&i<3?(l=o,u=a):i>=3&&i<4?(l=a,u=o):i>=4&&i<5?(s=a,u=o):i>=5&&i<6&&(s=o,u=a);const c=r-o/2,d=s+c,f=l+c,h=u+c;return[d,f,h].map(pM)};function a6e(e,t,n,r){return`rgba(${ad(0,255,e).toFixed()}, ${ad(0,255,t).toFixed()}, ${ad(0,255,n).toFixed()}, ${parseFloat(ad(0,1,r).toFixed(3))})`}function s6e(e,t){const[n,r,i,o]=KA(e);return a6e(n,r,i,o-t)}function l6e(e){const[t,n,r,i]=KA(e);let o=a=>{const s=ad(0,255,a).toString(16);return s.length===1?`0${s}`:s};return`#${o(t)}${o(n)}${o(r)}${i<1?o(Math.round(i*255)):""}`}function u6e(e,t,n,r,i){for(t=t.split?t.split("."):t,r=0;rObject.keys(e).length===0,to=(e,t,n)=>{const r=u6e(e,`colors.${t}`,t);try{return l6e(r),r}catch{return n??"#000000"}},d6e=e=>{const[t,n,r]=KA(e);return(t*299+n*587+r*114)/1e3},f6e=e=>t=>{const n=to(t,e);return d6e(n)<128?"dark":"light"},h6e=e=>t=>f6e(e)(t)==="dark",sp=(e,t)=>n=>{const r=to(n,e);return s6e(r,1-t)};function gM(e="1rem",t="rgba(255, 255, 255, 0.15)"){return{backgroundImage:`linear-gradient( + */var $T=Symbol.for("react.element"),DT=Symbol.for("react.portal"),O2=Symbol.for("react.fragment"),M2=Symbol.for("react.strict_mode"),N2=Symbol.for("react.profiler"),$2=Symbol.for("react.provider"),D2=Symbol.for("react.context"),dme=Symbol.for("react.server_context"),L2=Symbol.for("react.forward_ref"),F2=Symbol.for("react.suspense"),B2=Symbol.for("react.suspense_list"),z2=Symbol.for("react.memo"),j2=Symbol.for("react.lazy"),fme=Symbol.for("react.offscreen"),Cj;Cj=Symbol.for("react.module.reference");function ka(e){if(typeof e=="object"&&e!==null){var t=e.$$typeof;switch(t){case $T:switch(e=e.type,e){case O2:case N2:case M2:case F2:case B2:return e;default:switch(e=e&&e.$$typeof,e){case dme:case D2:case L2:case j2:case z2:case $2:return e;default:return t}}case DT:return t}}}kn.ContextConsumer=D2;kn.ContextProvider=$2;kn.Element=$T;kn.ForwardRef=L2;kn.Fragment=O2;kn.Lazy=j2;kn.Memo=z2;kn.Portal=DT;kn.Profiler=N2;kn.StrictMode=M2;kn.Suspense=F2;kn.SuspenseList=B2;kn.isAsyncMode=function(){return!1};kn.isConcurrentMode=function(){return!1};kn.isContextConsumer=function(e){return ka(e)===D2};kn.isContextProvider=function(e){return ka(e)===$2};kn.isElement=function(e){return typeof e=="object"&&e!==null&&e.$$typeof===$T};kn.isForwardRef=function(e){return ka(e)===L2};kn.isFragment=function(e){return ka(e)===O2};kn.isLazy=function(e){return ka(e)===j2};kn.isMemo=function(e){return ka(e)===z2};kn.isPortal=function(e){return ka(e)===DT};kn.isProfiler=function(e){return ka(e)===N2};kn.isStrictMode=function(e){return ka(e)===M2};kn.isSuspense=function(e){return ka(e)===F2};kn.isSuspenseList=function(e){return ka(e)===B2};kn.isValidElementType=function(e){return typeof e=="string"||typeof e=="function"||e===O2||e===N2||e===M2||e===F2||e===B2||e===fme||typeof e=="object"&&e!==null&&(e.$$typeof===j2||e.$$typeof===z2||e.$$typeof===$2||e.$$typeof===D2||e.$$typeof===L2||e.$$typeof===Cj||e.getModuleId!==void 0)};kn.typeOf=ka;function hme(){const e=Yge();let t=null,n=null;return{clear(){t=null,n=null},notify(){e(()=>{let r=t;for(;r;)r.callback(),r=r.next})},get(){let r=[],i=t;for(;i;)r.push(i),i=i.next;return r},subscribe(r){let i=!0,o=n={callback:r,next:null,prev:n};return o.prev?o.prev.next=o:t=o,function(){!i||t===null||(i=!1,o.next?o.next.prev=o.prev:n=o.prev,o.prev?o.prev.next=o.next:t=o.next)}}}}const RR={notify(){},get:()=>[]};function pme(e,t){let n,r=RR;function i(d){return l(),r.subscribe(d)}function o(){r.notify()}function a(){c.onStateChange&&c.onStateChange()}function s(){return!!n}function l(){n||(n=t?t.addNestedSub(a):e.subscribe(a),r=hme())}function u(){n&&(n(),n=void 0,r.clear(),r=RR)}const c={addNestedSub:i,notifyNestedSubs:o,handleChangeWrapper:a,isSubscribed:s,trySubscribe:l,tryUnsubscribe:u,getListeners:()=>r};return c}const gme=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",mme=gme?I.useLayoutEffect:I.useEffect;function OR(e,t){return e===t?e!==0||t!==0||1/e===1/t:e!==e&&t!==t}function S_(e,t){if(OR(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let i=0;i{const u=pme(e);return{store:e,subscription:u,getServerState:r?()=>r:void 0,stabilityCheck:i,noopCheck:o}},[e,r,i,o]),s=I.useMemo(()=>e.getState(),[e]);mme(()=>{const{subscription:u}=a;return u.onStateChange=u.notifyNestedSubs,u.trySubscribe(),s!==e.getState()&&u.notifyNestedSubs(),()=>{u.tryUnsubscribe(),u.onStateChange=void 0}},[a,s]);const l=t||ac;return I.createElement(l.Provider,{value:a},n)}function Ej(e=ac){const t=e===ac?yj:RT(e);return function(){const{store:r}=t();return r}}const kj=Ej();function vme(e=ac){const t=e===ac?kj:Ej(e);return function(){return t().dispatch}}const Tj=vme();eme(gj.useSyncExternalStoreWithSelector);Xge(Uo.unstable_batchedUpdates);var bme=globalThis&&globalThis.__spreadArray||function(e,t){for(var n=0,r=t.length,i=e.length;nLme({headers:{...e?{Authorization:`Bearer ${e}`}:{},...n?{"project-id":n}:{}},baseUrl:`${t??""}`}));const Ume=["Board","BoardImagesTotal","BoardAssetsTotal","Image","ImageNameList","ImageList","ImageMetadata","ImageMetadataFromFile","Model","SessionQueueItem","SessionQueueItemDTO","SessionQueueItemDTOList","SessionQueueStatus","SessionProcessorStatus","BatchStatus","InvocationCacheStatus"],Dt="LIST",Vme=async(e,t,n)=>{const r=o0.get(),i=Zh.get(),o=a0.get();return uge({baseUrl:`${r??""}/api/v1`,prepareHeaders:s=>(i&&s.set("Authorization",`Bearer ${i}`),o&&s.set("project-id",o),s)})(e,t,n)},ls=Nme({baseQuery:Vme,reducerPath:"api",tagTypes:Ume,endpoints:()=>({})}),Gme=(e,t)=>{const n=new Date(e),r=new Date(t);return n>r?1:ne==null,Xme=e=>encodeURIComponent(e).replace(/[!'()*]/g,t=>`%${t.charCodeAt(0).toString(16).toUpperCase()}`),bE=Symbol("encodeFragmentIdentifier");function Yme(e){switch(e.arrayFormat){case"index":return t=>(n,r)=>{const i=n.length;return r===void 0||e.skipNull&&r===null||e.skipEmptyString&&r===""?n:r===null?[...n,[Mr(t,e),"[",i,"]"].join("")]:[...n,[Mr(t,e),"[",Mr(i,e),"]=",Mr(r,e)].join("")]};case"bracket":return t=>(n,r)=>r===void 0||e.skipNull&&r===null||e.skipEmptyString&&r===""?n:r===null?[...n,[Mr(t,e),"[]"].join("")]:[...n,[Mr(t,e),"[]=",Mr(r,e)].join("")];case"colon-list-separator":return t=>(n,r)=>r===void 0||e.skipNull&&r===null||e.skipEmptyString&&r===""?n:r===null?[...n,[Mr(t,e),":list="].join("")]:[...n,[Mr(t,e),":list=",Mr(r,e)].join("")];case"comma":case"separator":case"bracket-separator":{const t=e.arrayFormat==="bracket-separator"?"[]=":"=";return n=>(r,i)=>i===void 0||e.skipNull&&i===null||e.skipEmptyString&&i===""?r:(i=i===null?"":i,r.length===0?[[Mr(n,e),t,Mr(i,e)].join("")]:[[r,Mr(i,e)].join(e.arrayFormatSeparator)])}default:return t=>(n,r)=>r===void 0||e.skipNull&&r===null||e.skipEmptyString&&r===""?n:r===null?[...n,Mr(t,e)]:[...n,[Mr(t,e),"=",Mr(r,e)].join("")]}}function Zme(e){let t;switch(e.arrayFormat){case"index":return(n,r,i)=>{if(t=/\[(\d*)]$/.exec(n),n=n.replace(/\[\d*]$/,""),!t){i[n]=r;return}i[n]===void 0&&(i[n]={}),i[n][t[1]]=r};case"bracket":return(n,r,i)=>{if(t=/(\[])$/.exec(n),n=n.replace(/\[]$/,""),!t){i[n]=r;return}if(i[n]===void 0){i[n]=[r];return}i[n]=[...i[n],r]};case"colon-list-separator":return(n,r,i)=>{if(t=/(:list)$/.exec(n),n=n.replace(/:list$/,""),!t){i[n]=r;return}if(i[n]===void 0){i[n]=[r];return}i[n]=[...i[n],r]};case"comma":case"separator":return(n,r,i)=>{const o=typeof r=="string"&&r.includes(e.arrayFormatSeparator),a=typeof r=="string"&&!o&&_l(r,e).includes(e.arrayFormatSeparator);r=a?_l(r,e):r;const s=o||a?r.split(e.arrayFormatSeparator).map(l=>_l(l,e)):r===null?r:_l(r,e);i[n]=s};case"bracket-separator":return(n,r,i)=>{const o=/(\[])$/.test(n);if(n=n.replace(/\[]$/,""),!o){i[n]=r&&_l(r,e);return}const a=r===null?[]:r.split(e.arrayFormatSeparator).map(s=>_l(s,e));if(i[n]===void 0){i[n]=a;return}i[n]=[...i[n],...a]};default:return(n,r,i)=>{if(i[n]===void 0){i[n]=r;return}i[n]=[...[i[n]].flat(),r]}}}function Ij(e){if(typeof e!="string"||e.length!==1)throw new TypeError("arrayFormatSeparator must be single character string")}function Mr(e,t){return t.encode?t.strict?Xme(e):encodeURIComponent(e):e}function _l(e,t){return t.decode?Wme(e):e}function Rj(e){return Array.isArray(e)?e.sort():typeof e=="object"?Rj(Object.keys(e)).sort((t,n)=>Number(t)-Number(n)).map(t=>e[t]):e}function Oj(e){const t=e.indexOf("#");return t!==-1&&(e=e.slice(0,t)),e}function Jme(e){let t="";const n=e.indexOf("#");return n!==-1&&(t=e.slice(n)),t}function FR(e,t){return t.parseNumbers&&!Number.isNaN(Number(e))&&typeof e=="string"&&e.trim()!==""?e=Number(e):t.parseBooleans&&e!==null&&(e.toLowerCase()==="true"||e.toLowerCase()==="false")&&(e=e.toLowerCase()==="true"),e}function LT(e){e=Oj(e);const t=e.indexOf("?");return t===-1?"":e.slice(t+1)}function FT(e,t){t={decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1,...t},Ij(t.arrayFormatSeparator);const n=Zme(t),r=Object.create(null);if(typeof e!="string"||(e=e.trim().replace(/^[?#&]/,""),!e))return r;for(const i of e.split("&")){if(i==="")continue;const o=t.decode?i.replace(/\+/g," "):i;let[a,s]=Pj(o,"=");a===void 0&&(a=o),s=s===void 0?null:["comma","separator","bracket-separator"].includes(t.arrayFormat)?s:_l(s,t),n(_l(a,t),s,r)}for(const[i,o]of Object.entries(r))if(typeof o=="object"&&o!==null)for(const[a,s]of Object.entries(o))o[a]=FR(s,t);else r[i]=FR(o,t);return t.sort===!1?r:(t.sort===!0?Object.keys(r).sort():Object.keys(r).sort(t.sort)).reduce((i,o)=>{const a=r[o];return a&&typeof a=="object"&&!Array.isArray(a)?i[o]=Rj(a):i[o]=a,i},Object.create(null))}function Mj(e,t){if(!e)return"";t={encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:",",...t},Ij(t.arrayFormatSeparator);const n=a=>t.skipNull&&Qme(e[a])||t.skipEmptyString&&e[a]==="",r=Yme(t),i={};for(const[a,s]of Object.entries(e))n(a)||(i[a]=s);const o=Object.keys(i);return t.sort!==!1&&o.sort(t.sort),o.map(a=>{const s=e[a];return s===void 0?"":s===null?Mr(a,t):Array.isArray(s)?s.length===0&&t.arrayFormat==="bracket-separator"?Mr(a,t)+"[]":s.reduce(r(a),[]).join("&"):Mr(a,t)+"="+Mr(s,t)}).filter(a=>a.length>0).join("&")}function Nj(e,t){var i;t={decode:!0,...t};let[n,r]=Pj(e,"#");return n===void 0&&(n=e),{url:((i=n==null?void 0:n.split("?"))==null?void 0:i[0])??"",query:FT(LT(e),t),...t&&t.parseFragmentIdentifier&&r?{fragmentIdentifier:_l(r,t)}:{}}}function $j(e,t){t={encode:!0,strict:!0,[bE]:!0,...t};const n=Oj(e.url).split("?")[0]||"",r=LT(e.url),i={...FT(r,{sort:!1}),...e.query};let o=Mj(i,t);o&&(o=`?${o}`);let a=Jme(e.url);if(e.fragmentIdentifier){const s=new URL(n);s.hash=e.fragmentIdentifier,a=t[bE]?s.hash:`#${e.fragmentIdentifier}`}return`${n}${o}${a}`}function Dj(e,t,n){n={parseFragmentIdentifier:!0,[bE]:!1,...n};const{url:r,query:i,fragmentIdentifier:o}=Nj(e,n);return $j({url:r,query:Kme(i,t),fragmentIdentifier:o},n)}function e0e(e,t,n){const r=Array.isArray(t)?i=>!t.includes(i):(i,o)=>!t(i,o);return Dj(e,r,n)}const Kg=Object.freeze(Object.defineProperty({__proto__:null,exclude:e0e,extract:LT,parse:FT,parseUrl:Nj,pick:Dj,stringify:Mj,stringifyUrl:$j},Symbol.toStringTag,{value:"Module"})),Ic=(e,t)=>{if(!e)return!1;const n=s0.selectAll(e);if(n.length<=1)return!0;const r=[],i=[];for(let o=0;o=s}else{const o=i[i.length-1];if(!o)return!1;const a=new Date(t.created_at),s=new Date(o.created_at);return a>=s}},aa=e=>ii.includes(e.image_category)?ii:Mu,Vn=Js({selectId:e=>e.image_name,sortComparer:(e,t)=>e.starred&&!t.starred?-1:!e.starred&&t.starred?1:Gme(t.created_at,e.created_at)}),s0=Vn.getSelectors(),Bo=e=>`images/?${Kg.stringify(e,{arrayFormat:"none"})}`,xi=ls.injectEndpoints({endpoints:e=>({listBoards:e.query({query:t=>({url:"boards/",params:t}),providesTags:t=>{const n=[{type:"Board",id:Dt}];return t&&n.push(...t.items.map(({board_id:r})=>({type:"Board",id:r}))),n}}),listAllBoards:e.query({query:()=>({url:"boards/",params:{all:!0}}),providesTags:t=>{const n=[{type:"Board",id:Dt}];return t&&n.push(...t.map(({board_id:r})=>({type:"Board",id:r}))),n}}),listAllImageNamesForBoard:e.query({query:t=>({url:`boards/${t}/image_names`}),providesTags:(t,n,r)=>[{type:"ImageNameList",id:r}],keepUnusedDataFor:0}),getBoardImagesTotal:e.query({query:t=>({url:Bo({board_id:t??"none",categories:ii,is_intermediate:!1,limit:0,offset:0}),method:"GET"}),providesTags:(t,n,r)=>[{type:"BoardImagesTotal",id:r??"none"}],transformResponse:t=>t.total}),getBoardAssetsTotal:e.query({query:t=>({url:Bo({board_id:t??"none",categories:Mu,is_intermediate:!1,limit:0,offset:0}),method:"GET"}),providesTags:(t,n,r)=>[{type:"BoardAssetsTotal",id:r??"none"}],transformResponse:t=>t.total}),createBoard:e.mutation({query:t=>({url:"boards/",method:"POST",params:{board_name:t}}),invalidatesTags:[{type:"Board",id:Dt}]}),updateBoard:e.mutation({query:({board_id:t,changes:n})=>({url:`boards/${t}`,method:"PATCH",body:n}),invalidatesTags:(t,n,r)=>[{type:"Board",id:r.board_id}]})})}),{useListBoardsQuery:gGe,useListAllBoardsQuery:mGe,useGetBoardImagesTotalQuery:yGe,useGetBoardAssetsTotalQuery:vGe,useCreateBoardMutation:bGe,useUpdateBoardMutation:_Ge,useListAllImageNamesForBoardQuery:SGe}=xi,me=ls.injectEndpoints({endpoints:e=>({listImages:e.query({query:t=>({url:Bo(t),method:"GET"}),providesTags:(t,n,{board_id:r,categories:i})=>[{type:"ImageList",id:Bo({board_id:r,categories:i})}],serializeQueryArgs:({queryArgs:t})=>{const{board_id:n,categories:r}=t;return Bo({board_id:n,categories:r})},transformResponse(t){const{items:n}=t;return Vn.addMany(Vn.getInitialState(),n)},merge:(t,n)=>{Vn.addMany(t,s0.selectAll(n))},forceRefetch({currentArg:t,previousArg:n}){return(t==null?void 0:t.offset)!==(n==null?void 0:n.offset)},async onQueryStarted(t,{dispatch:n,queryFulfilled:r}){try{const{data:i}=await r;s0.selectAll(i).forEach(o=>{n(me.util.upsertQueryData("getImageDTO",o.image_name,o))})}catch{}},keepUnusedDataFor:86400}),getIntermediatesCount:e.query({query:()=>({url:Bo({is_intermediate:!0})}),providesTags:["IntermediatesCount"],transformResponse:t=>t.total}),getImageDTO:e.query({query:t=>({url:`images/i/${t}`}),providesTags:(t,n,r)=>[{type:"Image",id:r}],keepUnusedDataFor:86400}),getImageMetadata:e.query({query:t=>({url:`images/i/${t}/metadata`}),providesTags:(t,n,r)=>[{type:"ImageMetadata",id:r}],keepUnusedDataFor:86400}),getImageMetadataFromFile:e.query({queryFn:async(t,n,r,i)=>{var o;if(t.shouldFetchMetadataFromApi){let a;const s=await i(`images/i/${t.image.image_name}/metadata`);if(s.data){const l=FB.safeParse((o=s.data)==null?void 0:o.metadata);l.success&&(a=l.data)}return{data:{metadata:a}}}else{const a=Zh.get(),s=a0.get(),u=await gle.fetchBaseQuery({baseUrl:"",prepareHeaders:d=>(a&&d.set("Authorization",`Bearer ${a}`),s&&d.set("project-id",s),d),responseHandler:async d=>await d.blob()})(t.image.image_url,n,r);return{data:await Xpe(u.data)}}},providesTags:(t,n,{image:r})=>[{type:"ImageMetadataFromFile",id:r.image_name}],keepUnusedDataFor:86400}),clearIntermediates:e.mutation({query:()=>({url:"images/clear-intermediates",method:"POST"}),invalidatesTags:["IntermediatesCount"]}),deleteImage:e.mutation({query:({image_name:t})=>({url:`images/i/${t}`,method:"DELETE"}),invalidatesTags:(t,n,{board_id:r})=>[{type:"BoardImagesTotal",id:r??"none"},{type:"BoardAssetsTotal",id:r??"none"}],async onQueryStarted(t,{dispatch:n,queryFulfilled:r}){const{image_name:i,board_id:o}=t,a={board_id:o??"none",categories:aa(t)},s=n(me.util.updateQueryData("listImages",a,l=>{Vn.removeOne(l,i)}));try{await r}catch{s.undo()}}}),deleteImages:e.mutation({query:({imageDTOs:t})=>({url:"images/delete",method:"POST",body:{image_names:t.map(r=>r.image_name)}}),invalidatesTags:(t,n,{imageDTOs:r})=>{var o;const i=(o=r[0])==null?void 0:o.board_id;return[{type:"BoardImagesTotal",id:i??"none"},{type:"BoardAssetsTotal",id:i??"none"}]},async onQueryStarted({imageDTOs:t},{dispatch:n,queryFulfilled:r}){try{const{data:i}=await r,o=dT(t,"image_name");i.deleted_images.forEach(a=>{const s=o[a];if(s){const l={board_id:s.board_id??"none",categories:aa(s)};n(me.util.updateQueryData("listImages",l,u=>{Vn.removeOne(u,a)}))}})}catch{}}}),changeImageIsIntermediate:e.mutation({query:({imageDTO:t,is_intermediate:n})=>({url:`images/i/${t.image_name}`,method:"PATCH",body:{is_intermediate:n}}),invalidatesTags:(t,n,{imageDTO:r})=>[{type:"BoardImagesTotal",id:r.board_id??"none"},{type:"BoardAssetsTotal",id:r.board_id??"none"}],async onQueryStarted({imageDTO:t,is_intermediate:n},{dispatch:r,queryFulfilled:i,getState:o}){const a=[];a.push(r(me.util.updateQueryData("getImageDTO",t.image_name,l=>{Object.assign(l,{is_intermediate:n})})));const s=aa(t);if(n)a.push(r(me.util.updateQueryData("listImages",{board_id:t.board_id??"none",categories:s},l=>{Vn.removeOne(l,t.image_name)})));else{const l={board_id:t.board_id??"none",categories:s},u=me.endpoints.listImages.select(l)(o()),{data:c}=ii.includes(t.image_category)?xi.endpoints.getBoardImagesTotal.select(t.board_id??"none")(o()):xi.endpoints.getBoardAssetsTotal.select(t.board_id??"none")(o()),d=u.data&&u.data.ids.length>=(c??0),f=Ic(u.data,t);(d||f)&&a.push(r(me.util.updateQueryData("listImages",l,h=>{Vn.upsertOne(h,t)})))}try{await i}catch{a.forEach(l=>l.undo())}}}),changeImageSessionId:e.mutation({query:({imageDTO:t,session_id:n})=>({url:`images/i/${t.image_name}`,method:"PATCH",body:{session_id:n}}),invalidatesTags:(t,n,{imageDTO:r})=>[{type:"BoardImagesTotal",id:r.board_id??"none"},{type:"BoardAssetsTotal",id:r.board_id??"none"}],async onQueryStarted({imageDTO:t,session_id:n},{dispatch:r,queryFulfilled:i}){const o=[];o.push(r(me.util.updateQueryData("getImageDTO",t.image_name,a=>{Object.assign(a,{session_id:n})})));try{await i}catch{o.forEach(a=>a.undo())}}}),starImages:e.mutation({query:({imageDTOs:t})=>({url:"images/star",method:"POST",body:{image_names:t.map(n=>n.image_name)}}),invalidatesTags:(t,n,{imageDTOs:r})=>{if(r[0]){const i=aa(r[0]),o=r[0].board_id;return[{type:"ImageList",id:Bo({board_id:o,categories:i})}]}return[]},async onQueryStarted({imageDTOs:t},{dispatch:n,queryFulfilled:r,getState:i}){try{const{data:o}=await r,a=t.filter(u=>o.updated_image_names.includes(u.image_name));if(!a[0])return;const s=aa(a[0]),l=a[0].board_id;a.forEach(u=>{const{image_name:c}=u;n(me.util.updateQueryData("getImageDTO",c,_=>{_.starred=!0}));const d={board_id:l??"none",categories:s},f=me.endpoints.listImages.select(d)(i()),{data:h}=ii.includes(u.image_category)?xi.endpoints.getBoardImagesTotal.select(l??"none")(i()):xi.endpoints.getBoardAssetsTotal.select(l??"none")(i()),p=f.data&&f.data.ids.length>=(h??0),m=(h||0)>=fv?Ic(f.data,u):!0;(p||m)&&n(me.util.updateQueryData("listImages",d,_=>{Vn.upsertOne(_,{...u,starred:!0})}))})}catch{}}}),unstarImages:e.mutation({query:({imageDTOs:t})=>({url:"images/unstar",method:"POST",body:{image_names:t.map(n=>n.image_name)}}),invalidatesTags:(t,n,{imageDTOs:r})=>{if(r[0]){const i=aa(r[0]),o=r[0].board_id;return[{type:"ImageList",id:Bo({board_id:o,categories:i})}]}return[]},async onQueryStarted({imageDTOs:t},{dispatch:n,queryFulfilled:r,getState:i}){try{const{data:o}=await r,a=t.filter(u=>o.updated_image_names.includes(u.image_name));if(!a[0])return;const s=aa(a[0]),l=a[0].board_id;a.forEach(u=>{const{image_name:c}=u;n(me.util.updateQueryData("getImageDTO",c,_=>{_.starred=!1}));const d={board_id:l??"none",categories:s},f=me.endpoints.listImages.select(d)(i()),{data:h}=ii.includes(u.image_category)?xi.endpoints.getBoardImagesTotal.select(l??"none")(i()):xi.endpoints.getBoardAssetsTotal.select(l??"none")(i()),p=f.data&&f.data.ids.length>=(h??0),m=(h||0)>=fv?Ic(f.data,u):!0;(p||m)&&n(me.util.updateQueryData("listImages",d,_=>{Vn.upsertOne(_,{...u,starred:!1})}))})}catch{}}}),uploadImage:e.mutation({query:({file:t,image_category:n,is_intermediate:r,session_id:i,board_id:o,crop_visible:a})=>{const s=new FormData;return s.append("file",t),{url:"images/upload",method:"POST",body:s,params:{image_category:n,is_intermediate:r,session_id:i,board_id:o==="none"?void 0:o,crop_visible:a}}},async onQueryStarted(t,{dispatch:n,queryFulfilled:r}){try{const{data:i}=await r;if(i.is_intermediate)return;n(me.util.upsertQueryData("getImageDTO",i.image_name,i));const o=aa(i);n(me.util.updateQueryData("listImages",{board_id:i.board_id??"none",categories:o},a=>{Vn.addOne(a,i)})),n(me.util.invalidateTags([{type:"BoardImagesTotal",id:i.board_id??"none"},{type:"BoardAssetsTotal",id:i.board_id??"none"}]))}catch{}}}),deleteBoard:e.mutation({query:t=>({url:`boards/${t}`,method:"DELETE"}),invalidatesTags:()=>[{type:"Board",id:Dt},{type:"ImageList",id:Bo({board_id:"none",categories:ii})},{type:"ImageList",id:Bo({board_id:"none",categories:Mu})},{type:"BoardImagesTotal",id:"none"},{type:"BoardAssetsTotal",id:"none"}],async onQueryStarted(t,{dispatch:n,queryFulfilled:r}){try{const{data:i}=await r,{deleted_board_images:o}=i;o.forEach(l=>{n(me.util.updateQueryData("getImageDTO",l,u=>{u.board_id=void 0}))});const a=[{categories:ii},{categories:Mu}],s=o.map(l=>({id:l,changes:{board_id:void 0}}));a.forEach(l=>{n(me.util.updateQueryData("listImages",l,u=>{Vn.updateMany(u,s)}))})}catch{}}}),deleteBoardAndImages:e.mutation({query:t=>({url:`boards/${t}`,method:"DELETE",params:{include_images:!0}}),invalidatesTags:()=>[{type:"Board",id:Dt},{type:"ImageList",id:Bo({board_id:"none",categories:ii})},{type:"ImageList",id:Bo({board_id:"none",categories:Mu})},{type:"BoardImagesTotal",id:"none"},{type:"BoardAssetsTotal",id:"none"}],async onQueryStarted(t,{dispatch:n,queryFulfilled:r}){try{const{data:i}=await r,{deleted_images:o}=i;[{categories:ii},{categories:Mu}].forEach(s=>{n(me.util.updateQueryData("listImages",s,l=>{Vn.removeMany(l,o)}))})}catch{}}}),addImageToBoard:e.mutation({query:({board_id:t,imageDTO:n})=>{const{image_name:r}=n;return{url:"board_images/",method:"POST",body:{board_id:t,image_name:r}}},invalidatesTags:(t,n,{board_id:r,imageDTO:i})=>[{type:"Board",id:r},{type:"BoardImagesTotal",id:r},{type:"BoardAssetsTotal",id:r},{type:"BoardImagesTotal",id:i.board_id??"none"},{type:"BoardAssetsTotal",id:i.board_id??"none"}],async onQueryStarted({board_id:t,imageDTO:n},{dispatch:r,queryFulfilled:i,getState:o}){const a=[],s=aa(n);if(a.push(r(me.util.updateQueryData("getImageDTO",n.image_name,l=>{l.board_id=t}))),!n.is_intermediate){a.push(r(me.util.updateQueryData("listImages",{board_id:n.board_id??"none",categories:s},h=>{Vn.removeOne(h,n.image_name)})));const l={board_id:t??"none",categories:s},u=me.endpoints.listImages.select(l)(o()),{data:c}=ii.includes(n.image_category)?xi.endpoints.getBoardImagesTotal.select(n.board_id??"none")(o()):xi.endpoints.getBoardAssetsTotal.select(n.board_id??"none")(o()),d=u.data&&u.data.ids.length>=(c??0),f=Ic(u.data,n);(d||f)&&a.push(r(me.util.updateQueryData("listImages",l,h=>{Vn.addOne(h,n)})))}try{await i}catch{a.forEach(l=>l.undo())}}}),removeImageFromBoard:e.mutation({query:({imageDTO:t})=>{const{image_name:n}=t;return{url:"board_images/",method:"DELETE",body:{image_name:n}}},invalidatesTags:(t,n,{imageDTO:r})=>{const{board_id:i}=r;return[{type:"Board",id:i??"none"},{type:"BoardImagesTotal",id:i??"none"},{type:"BoardAssetsTotal",id:i??"none"},{type:"BoardImagesTotal",id:"none"},{type:"BoardAssetsTotal",id:"none"}]},async onQueryStarted({imageDTO:t},{dispatch:n,queryFulfilled:r,getState:i}){const o=aa(t),a=[];a.push(n(me.util.updateQueryData("getImageDTO",t.image_name,f=>{f.board_id=void 0}))),a.push(n(me.util.updateQueryData("listImages",{board_id:t.board_id??"none",categories:o},f=>{Vn.removeOne(f,t.image_name)})));const s={board_id:"none",categories:o},l=me.endpoints.listImages.select(s)(i()),{data:u}=ii.includes(t.image_category)?xi.endpoints.getBoardImagesTotal.select(t.board_id??"none")(i()):xi.endpoints.getBoardAssetsTotal.select(t.board_id??"none")(i()),c=l.data&&l.data.ids.length>=(u??0),d=Ic(l.data,t);(c||d)&&a.push(n(me.util.updateQueryData("listImages",s,f=>{Vn.upsertOne(f,t)})));try{await r}catch{a.forEach(f=>f.undo())}}}),addImagesToBoard:e.mutation({query:({board_id:t,imageDTOs:n})=>({url:"board_images/batch",method:"POST",body:{image_names:n.map(r=>r.image_name),board_id:t}}),invalidatesTags:(t,n,{imageDTOs:r,board_id:i})=>{var a;const o=(a=r[0])==null?void 0:a.board_id;return[{type:"Board",id:i??"none"},{type:"BoardImagesTotal",id:i??"none"},{type:"BoardAssetsTotal",id:i??"none"},{type:"BoardImagesTotal",id:o??"none"},{type:"BoardAssetsTotal",id:o??"none"},{type:"BoardImagesTotal",id:"none"},{type:"BoardAssetsTotal",id:"none"}]},async onQueryStarted({board_id:t,imageDTOs:n},{dispatch:r,queryFulfilled:i,getState:o}){try{const{data:a}=await i,{added_image_names:s}=a;s.forEach(l=>{r(me.util.updateQueryData("getImageDTO",l,b=>{b.board_id=t}));const u=n.find(b=>b.image_name===l);if(!u)return;const c=aa(u),d=u.board_id;r(me.util.updateQueryData("listImages",{board_id:d??"none",categories:c},b=>{Vn.removeOne(b,u.image_name)}));const f={board_id:t,categories:c},h=me.endpoints.listImages.select(f)(o()),{data:p}=ii.includes(u.image_category)?xi.endpoints.getBoardImagesTotal.select(t??"none")(o()):xi.endpoints.getBoardAssetsTotal.select(t??"none")(o()),m=h.data&&h.data.ids.length>=(p??0),_=(p||0)>=fv?Ic(h.data,u):!0;(m||_)&&r(me.util.updateQueryData("listImages",f,b=>{Vn.upsertOne(b,{...u,board_id:t})}))})}catch{}}}),removeImagesFromBoard:e.mutation({query:({imageDTOs:t})=>({url:"board_images/batch/delete",method:"POST",body:{image_names:t.map(n=>n.image_name)}}),invalidatesTags:(t,n,{imageDTOs:r})=>{const i=[],o=[{type:"BoardImagesTotal",id:"none"},{type:"BoardAssetsTotal",id:"none"}];return t==null||t.removed_image_names.forEach(a=>{var l;const s=(l=r.find(u=>u.image_name===a))==null?void 0:l.board_id;!s||i.includes(s)||(o.push({type:"Board",id:s}),o.push({type:"BoardImagesTotal",id:s}),o.push({type:"BoardAssetsTotal",id:s}))}),o},async onQueryStarted({imageDTOs:t},{dispatch:n,queryFulfilled:r,getState:i}){try{const{data:o}=await r,{removed_image_names:a}=o;a.forEach(s=>{n(me.util.updateQueryData("getImageDTO",s,m=>{m.board_id=void 0}));const l=t.find(m=>m.image_name===s);if(!l)return;const u=aa(l);n(me.util.updateQueryData("listImages",{board_id:l.board_id??"none",categories:u},m=>{Vn.removeOne(m,l.image_name)}));const c={board_id:"none",categories:u},d=me.endpoints.listImages.select(c)(i()),{data:f}=ii.includes(l.image_category)?xi.endpoints.getBoardImagesTotal.select(l.board_id??"none")(i()):xi.endpoints.getBoardAssetsTotal.select(l.board_id??"none")(i()),h=d.data&&d.data.ids.length>=(f??0),p=(f||0)>=fv?Ic(d.data,l):!0;(h||p)&&n(me.util.updateQueryData("listImages",c,m=>{Vn.upsertOne(m,{...l,board_id:"none"})}))})}catch{}}})})}),{useGetIntermediatesCountQuery:xGe,useListImagesQuery:wGe,useLazyListImagesQuery:CGe,useGetImageDTOQuery:EGe,useGetImageMetadataQuery:kGe,useDeleteImageMutation:TGe,useDeleteImagesMutation:AGe,useUploadImageMutation:PGe,useClearIntermediatesMutation:IGe,useAddImagesToBoardMutation:RGe,useRemoveImagesFromBoardMutation:OGe,useAddImageToBoardMutation:MGe,useRemoveImageFromBoardMutation:NGe,useChangeImageIsIntermediateMutation:$Ge,useChangeImageSessionIdMutation:DGe,useDeleteBoardAndImagesMutation:LGe,useDeleteBoardMutation:FGe,useStarImagesMutation:BGe,useUnstarImagesMutation:zGe,useGetImageMetadataFromFileQuery:jGe}=me,Lj=Ne("socket/socketConnected"),BT=Ne("socket/appSocketConnected"),Fj=Ne("socket/socketDisconnected"),Bj=Ne("socket/appSocketDisconnected"),t0e=Ne("socket/socketSubscribedSession"),n0e=Ne("socket/appSocketSubscribedSession"),r0e=Ne("socket/socketUnsubscribedSession"),i0e=Ne("socket/appSocketUnsubscribedSession"),zj=Ne("socket/socketInvocationStarted"),zT=Ne("socket/appSocketInvocationStarted"),jT=Ne("socket/socketInvocationComplete"),UT=Ne("socket/appSocketInvocationComplete"),jj=Ne("socket/socketInvocationError"),U2=Ne("socket/appSocketInvocationError"),Uj=Ne("socket/socketGraphExecutionStateComplete"),Vj=Ne("socket/appSocketGraphExecutionStateComplete"),Gj=Ne("socket/socketGeneratorProgress"),VT=Ne("socket/appSocketGeneratorProgress"),Hj=Ne("socket/socketModelLoadStarted"),qj=Ne("socket/appSocketModelLoadStarted"),Wj=Ne("socket/socketModelLoadCompleted"),Kj=Ne("socket/appSocketModelLoadCompleted"),Qj=Ne("socket/socketSessionRetrievalError"),Xj=Ne("socket/appSocketSessionRetrievalError"),Yj=Ne("socket/socketInvocationRetrievalError"),Zj=Ne("socket/appSocketInvocationRetrievalError"),Jj=Ne("socket/socketQueueItemStatusChanged"),GT=Ne("socket/appSocketQueueItemStatusChanged"),HT=Ne("controlNet/imageProcessed"),Ef={none:{type:"none",get label(){return be.t("controlnet.none")},get description(){return be.t("controlnet.noneDescription")},default:{type:"none"}},canny_image_processor:{type:"canny_image_processor",get label(){return be.t("controlnet.canny")},get description(){return be.t("controlnet.cannyDescription")},default:{id:"canny_image_processor",type:"canny_image_processor",low_threshold:100,high_threshold:200}},color_map_image_processor:{type:"color_map_image_processor",get label(){return be.t("controlnet.colorMap")},get description(){return be.t("controlnet.colorMapDescription")},default:{id:"color_map_image_processor",type:"color_map_image_processor",color_map_tile_size:64}},content_shuffle_image_processor:{type:"content_shuffle_image_processor",get label(){return be.t("controlnet.contentShuffle")},get description(){return be.t("controlnet.contentShuffleDescription")},default:{id:"content_shuffle_image_processor",type:"content_shuffle_image_processor",detect_resolution:512,image_resolution:512,h:512,w:512,f:256}},hed_image_processor:{type:"hed_image_processor",get label(){return be.t("controlnet.hed")},get description(){return be.t("controlnet.hedDescription")},default:{id:"hed_image_processor",type:"hed_image_processor",detect_resolution:512,image_resolution:512,scribble:!1}},lineart_anime_image_processor:{type:"lineart_anime_image_processor",get label(){return be.t("controlnet.lineartAnime")},get description(){return be.t("controlnet.lineartAnimeDescription")},default:{id:"lineart_anime_image_processor",type:"lineart_anime_image_processor",detect_resolution:512,image_resolution:512}},lineart_image_processor:{type:"lineart_image_processor",get label(){return be.t("controlnet.lineart")},get description(){return be.t("controlnet.lineartDescription")},default:{id:"lineart_image_processor",type:"lineart_image_processor",detect_resolution:512,image_resolution:512,coarse:!1}},mediapipe_face_processor:{type:"mediapipe_face_processor",get label(){return be.t("controlnet.mediapipeFace")},get description(){return be.t("controlnet.mediapipeFaceDescription")},default:{id:"mediapipe_face_processor",type:"mediapipe_face_processor",max_faces:1,min_confidence:.5}},midas_depth_image_processor:{type:"midas_depth_image_processor",get label(){return be.t("controlnet.depthMidas")},get description(){return be.t("controlnet.depthMidasDescription")},default:{id:"midas_depth_image_processor",type:"midas_depth_image_processor",a_mult:2,bg_th:.1}},mlsd_image_processor:{type:"mlsd_image_processor",get label(){return be.t("controlnet.mlsd")},get description(){return be.t("controlnet.mlsdDescription")},default:{id:"mlsd_image_processor",type:"mlsd_image_processor",detect_resolution:512,image_resolution:512,thr_d:.1,thr_v:.1}},normalbae_image_processor:{type:"normalbae_image_processor",get label(){return be.t("controlnet.normalBae")},get description(){return be.t("controlnet.normalBaeDescription")},default:{id:"normalbae_image_processor",type:"normalbae_image_processor",detect_resolution:512,image_resolution:512}},openpose_image_processor:{type:"openpose_image_processor",get label(){return be.t("controlnet.openPose")},get description(){return be.t("controlnet.openPoseDescription")},default:{id:"openpose_image_processor",type:"openpose_image_processor",detect_resolution:512,image_resolution:512,hand_and_face:!1}},pidi_image_processor:{type:"pidi_image_processor",get label(){return be.t("controlnet.pidi")},get description(){return be.t("controlnet.pidiDescription")},default:{id:"pidi_image_processor",type:"pidi_image_processor",detect_resolution:512,image_resolution:512,scribble:!1,safe:!1}},zoe_depth_image_processor:{type:"zoe_depth_image_processor",get label(){return be.t("controlnet.depthZoe")},get description(){return be.t("controlnet.depthZoeDescription")},default:{id:"zoe_depth_image_processor",type:"zoe_depth_image_processor"}}},kv={canny:"canny_image_processor",mlsd:"mlsd_image_processor",depth:"midas_depth_image_processor",bae:"normalbae_image_processor",lineart:"lineart_image_processor",lineart_anime:"lineart_anime_image_processor",softedge:"hed_image_processor",shuffle:"content_shuffle_image_processor",openpose:"openpose_image_processor",mediapipe:"mediapipe_face_processor",pidi:"pidi_image_processor",zoe:"zoe_depth_image_processor",color:"color_map_image_processor"},BR={isEnabled:!0,model:null,weight:1,beginStepPct:0,endStepPct:1,controlMode:"balanced",resizeMode:"just_resize",controlImage:null,processedControlImage:null,processorType:"canny_image_processor",processorNode:Ef.canny_image_processor.default,shouldAutoConfig:!0},eU={adapterImage:null,model:null,weight:1,beginStepPct:0,endStepPct:1},_E={controlNets:{},isEnabled:!1,pendingControlImages:[],isIPAdapterEnabled:!1,ipAdapterInfo:{...eU}},tU=nr({name:"controlNet",initialState:_E,reducers:{isControlNetEnabledToggled:e=>{e.isEnabled=!e.isEnabled},controlNetEnabled:e=>{e.isEnabled=!0},controlNetAdded:(e,t)=>{const{controlNetId:n,controlNet:r}=t.payload;e.controlNets[n]={...r??BR,controlNetId:n}},controlNetRecalled:(e,t)=>{const n=t.payload;e.controlNets[n.controlNetId]={...n}},controlNetDuplicated:(e,t)=>{const{sourceControlNetId:n,newControlNetId:r}=t.payload,i=e.controlNets[n];if(!i)return;const o=wn(i);o.controlNetId=r,e.controlNets[r]=o},controlNetAddedFromImage:(e,t)=>{const{controlNetId:n,controlImage:r}=t.payload;e.controlNets[n]={...BR,controlNetId:n,controlImage:r}},controlNetRemoved:(e,t)=>{const{controlNetId:n}=t.payload;delete e.controlNets[n]},controlNetIsEnabledChanged:(e,t)=>{const{controlNetId:n,isEnabled:r}=t.payload,i=e.controlNets[n];i&&(i.isEnabled=r)},controlNetImageChanged:(e,t)=>{const{controlNetId:n,controlImage:r}=t.payload,i=e.controlNets[n];i&&(i.controlImage=r,i.processedControlImage=null,r!==null&&i.processorType!=="none"&&e.pendingControlImages.push(n))},controlNetProcessedImageChanged:(e,t)=>{const{controlNetId:n,processedControlImage:r}=t.payload,i=e.controlNets[n];i&&(i.processedControlImage=r,e.pendingControlImages=e.pendingControlImages.filter(o=>o!==n))},controlNetModelChanged:(e,t)=>{const{controlNetId:n,model:r}=t.payload,i=e.controlNets[n];if(i&&(i.model=r,i.processedControlImage=null,i.shouldAutoConfig)){let o;for(const a in kv)if(r.model_name.includes(a)){o=kv[a];break}o?(i.processorType=o,i.processorNode=Ef[o].default):(i.processorType="none",i.processorNode=Ef.none.default)}},controlNetWeightChanged:(e,t)=>{const{controlNetId:n,weight:r}=t.payload,i=e.controlNets[n];i&&(i.weight=r)},controlNetBeginStepPctChanged:(e,t)=>{const{controlNetId:n,beginStepPct:r}=t.payload,i=e.controlNets[n];i&&(i.beginStepPct=r)},controlNetEndStepPctChanged:(e,t)=>{const{controlNetId:n,endStepPct:r}=t.payload,i=e.controlNets[n];i&&(i.endStepPct=r)},controlNetControlModeChanged:(e,t)=>{const{controlNetId:n,controlMode:r}=t.payload,i=e.controlNets[n];i&&(i.controlMode=r)},controlNetResizeModeChanged:(e,t)=>{const{controlNetId:n,resizeMode:r}=t.payload,i=e.controlNets[n];i&&(i.resizeMode=r)},controlNetProcessorParamsChanged:(e,t)=>{const{controlNetId:n,changes:r}=t.payload,i=e.controlNets[n];if(!i)return;const o=i.processorNode;i.processorNode={...o,...r},i.shouldAutoConfig=!1},controlNetProcessorTypeChanged:(e,t)=>{const{controlNetId:n,processorType:r}=t.payload,i=e.controlNets[n];i&&(i.processedControlImage=null,i.processorType=r,i.processorNode=Ef[r].default,i.shouldAutoConfig=!1)},controlNetAutoConfigToggled:(e,t)=>{var o;const{controlNetId:n}=t.payload,r=e.controlNets[n];if(!r)return;const i=!r.shouldAutoConfig;if(i){let a;for(const s in kv)if((o=r.model)!=null&&o.model_name.includes(s)){a=kv[s];break}a?(r.processorType=a,r.processorNode=Ef[a].default):(r.processorType="none",r.processorNode=Ef.none.default)}r.shouldAutoConfig=i},controlNetReset:()=>({..._E}),isIPAdapterEnabledChanged:(e,t)=>{e.isIPAdapterEnabled=t.payload},ipAdapterRecalled:(e,t)=>{e.ipAdapterInfo=t.payload},ipAdapterImageChanged:(e,t)=>{e.ipAdapterInfo.adapterImage=t.payload},ipAdapterWeightChanged:(e,t)=>{e.ipAdapterInfo.weight=t.payload},ipAdapterModelChanged:(e,t)=>{e.ipAdapterInfo.model=t.payload},ipAdapterBeginStepPctChanged:(e,t)=>{e.ipAdapterInfo.beginStepPct=t.payload},ipAdapterEndStepPctChanged:(e,t)=>{e.ipAdapterInfo.endStepPct=t.payload},ipAdapterStateReset:e=>{e.isIPAdapterEnabled=!1,e.ipAdapterInfo={...eU}},clearPendingControlImages:e=>{e.pendingControlImages=[]}},extraReducers:e=>{e.addCase(HT,(t,n)=>{const r=t.controlNets[n.payload.controlNetId];r&&r.controlImage!==null&&t.pendingControlImages.push(n.payload.controlNetId)}),e.addCase(U2,t=>{t.pendingControlImages=[]}),e.addMatcher(me.endpoints.deleteImage.matchFulfilled,(t,n)=>{const{image_name:r}=n.meta.arg.originalArgs;Ca(t.controlNets,i=>{i.controlImage===r&&(i.controlImage=null,i.processedControlImage=null),i.processedControlImage===r&&(i.processedControlImage=null)})})}}),{isControlNetEnabledToggled:UGe,controlNetEnabled:VGe,controlNetAdded:GGe,controlNetRecalled:HGe,controlNetDuplicated:qGe,controlNetAddedFromImage:WGe,controlNetRemoved:nU,controlNetImageChanged:Sc,controlNetProcessedImageChanged:qT,controlNetIsEnabledChanged:rU,controlNetModelChanged:zR,controlNetWeightChanged:KGe,controlNetBeginStepPctChanged:QGe,controlNetEndStepPctChanged:XGe,controlNetControlModeChanged:YGe,controlNetResizeModeChanged:ZGe,controlNetProcessorParamsChanged:o0e,controlNetProcessorTypeChanged:a0e,controlNetReset:s0e,controlNetAutoConfigToggled:jR,isIPAdapterEnabledChanged:iU,ipAdapterRecalled:JGe,ipAdapterImageChanged:V2,ipAdapterWeightChanged:eHe,ipAdapterModelChanged:tHe,ipAdapterBeginStepPctChanged:nHe,ipAdapterEndStepPctChanged:rHe,ipAdapterStateReset:oU,clearPendingControlImages:l0e}=tU.actions,u0e=tU.reducer,c0e={imagesToDelete:[],isModalOpen:!1},aU=nr({name:"deleteImageModal",initialState:c0e,reducers:{isModalOpenChanged:(e,t)=>{e.isModalOpen=t.payload},imagesToDeleteSelected:(e,t)=>{e.imagesToDelete=t.payload},imageDeletionCanceled:e=>{e.imagesToDelete=[],e.isModalOpen=!1}}}),{isModalOpenChanged:WT,imagesToDeleteSelected:d0e,imageDeletionCanceled:iHe}=aU.actions,f0e=aU.reducer,KT={maxPrompts:100,combinatorial:!0,prompts:[],parsingError:void 0,isError:!1,isLoading:!1,seedBehaviour:"PER_ITERATION"},h0e=KT,sU=nr({name:"dynamicPrompts",initialState:h0e,reducers:{maxPromptsChanged:(e,t)=>{e.maxPrompts=t.payload},maxPromptsReset:e=>{e.maxPrompts=KT.maxPrompts},combinatorialToggled:e=>{e.combinatorial=!e.combinatorial},promptsChanged:(e,t)=>{e.prompts=t.payload},parsingErrorChanged:(e,t)=>{e.parsingError=t.payload},isErrorChanged:(e,t)=>{e.isError=t.payload},isLoadingChanged:(e,t)=>{e.isLoading=t.payload},seedBehaviourChanged:(e,t)=>{e.seedBehaviour=t.payload}}}),{maxPromptsChanged:p0e,maxPromptsReset:g0e,combinatorialToggled:m0e,promptsChanged:y0e,parsingErrorChanged:v0e,isErrorChanged:UR,isLoadingChanged:RC,seedBehaviourChanged:oHe}=sU.actions,b0e=sU.reducer,lU={selection:[],shouldAutoSwitch:!0,autoAssignBoardOnClick:!0,autoAddBoardId:"none",galleryImageMinimumWidth:96,selectedBoardId:"none",galleryView:"images",boardSearchText:""},uU=nr({name:"gallery",initialState:lU,reducers:{imageSelected:(e,t)=>{e.selection=t.payload?[t.payload]:[]},selectionChanged:(e,t)=>{e.selection=t.payload},shouldAutoSwitchChanged:(e,t)=>{e.shouldAutoSwitch=t.payload},setGalleryImageMinimumWidth:(e,t)=>{e.galleryImageMinimumWidth=t.payload},autoAssignBoardOnClickChanged:(e,t)=>{e.autoAssignBoardOnClick=t.payload},boardIdSelected:(e,t)=>{e.selectedBoardId=t.payload.boardId,e.galleryView="images"},autoAddBoardIdChanged:(e,t)=>{if(!t.payload){e.autoAddBoardId="none";return}e.autoAddBoardId=t.payload},galleryViewChanged:(e,t)=>{e.galleryView=t.payload},boardSearchTextChanged:(e,t)=>{e.boardSearchText=t.payload}},extraReducers:e=>{e.addMatcher(S0e,(t,n)=>{const r=n.meta.arg.originalArgs;r===t.selectedBoardId&&(t.selectedBoardId="none",t.galleryView="images"),r===t.autoAddBoardId&&(t.autoAddBoardId="none")}),e.addMatcher(xi.endpoints.listAllBoards.matchFulfilled,(t,n)=>{const r=n.payload;t.autoAddBoardId&&(r.map(i=>i.board_id).includes(t.autoAddBoardId)||(t.autoAddBoardId="none"))})}}),{imageSelected:Us,shouldAutoSwitchChanged:aHe,autoAssignBoardOnClickChanged:sHe,setGalleryImageMinimumWidth:lHe,boardIdSelected:w_,autoAddBoardIdChanged:uHe,galleryViewChanged:SE,selectionChanged:cU,boardSearchTextChanged:cHe}=uU.actions,_0e=uU.reducer,S0e=No(me.endpoints.deleteBoard.matchFulfilled,me.endpoints.deleteBoardAndImages.matchFulfilled),VR={weight:.75},x0e={loras:{}},dU=nr({name:"lora",initialState:x0e,reducers:{loraAdded:(e,t)=>{const{model_name:n,id:r,base_model:i}=t.payload;e.loras[r]={id:r,model_name:n,base_model:i,...VR}},loraRecalled:(e,t)=>{const{model_name:n,id:r,base_model:i,weight:o}=t.payload;e.loras[r]={id:r,model_name:n,base_model:i,weight:o}},loraRemoved:(e,t)=>{const n=t.payload;delete e.loras[n]},lorasCleared:e=>{e.loras={}},loraWeightChanged:(e,t)=>{const{id:n,weight:r}=t.payload,i=e.loras[n];i&&(i.weight=r)},loraWeightReset:(e,t)=>{const n=t.payload,r=e.loras[n];r&&(r.weight=VR.weight)}}}),{loraAdded:dHe,loraRemoved:fU,loraWeightChanged:fHe,loraWeightReset:hHe,lorasCleared:pHe,loraRecalled:gHe}=dU.actions,w0e=dU.reducer;function Ta(e){if(typeof e=="string"||typeof e=="number")return""+e;let t="";if(Array.isArray(e))for(let n=0,r;n{let t;const n=new Set,r=(l,u)=>{const c=typeof l=="function"?l(t):l;if(!Object.is(c,t)){const d=t;t=u??typeof c!="object"?c:Object.assign({},t,c),n.forEach(f=>f(t,d))}},i=()=>t,s={setState:r,getState:i,subscribe:l=>(n.add(l),()=>n.delete(l)),destroy:()=>{n.clear()}};return t=e(r,i,s),s},C0e=e=>e?GR(e):GR,{useSyncExternalStoreWithSelector:E0e}=Kge;function hU(e,t=e.getState,n){const r=E0e(e.subscribe,e.getState,e.getServerState||e.getState,t,n);return I.useDebugValue(r),r}const HR=(e,t)=>{const n=C0e(e),r=(i,o=t)=>hU(n,i,o);return Object.assign(r,n),r},k0e=(e,t)=>e?HR(e,t):HR;function Ro(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[r,i]of e)if(!Object.is(i,t.get(r)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const r of e)if(!t.has(r))return!1;return!0}const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(let r=0;r{}};function G2(){for(var e=0,t=arguments.length,n={},r;e=0&&(r=n.slice(i+1),n=n.slice(0,i)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:r}})}F1.prototype=G2.prototype={constructor:F1,on:function(e,t){var n=this._,r=A0e(e+"",n),i,o=-1,a=r.length;if(arguments.length<2){for(;++o0)for(var n=new Array(i),r=0,i,o;r=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),WR.hasOwnProperty(t)?{space:WR[t],local:e}:e}function I0e(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===xE&&t.documentElement.namespaceURI===xE?t.createElement(e):t.createElementNS(n,e)}}function R0e(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function pU(e){var t=H2(e);return(t.local?R0e:I0e)(t)}function O0e(){}function QT(e){return e==null?O0e:function(){return this.querySelector(e)}}function M0e(e){typeof e!="function"&&(e=QT(e));for(var t=this._groups,n=t.length,r=new Array(n),i=0;i=g&&(g=v+1);!(S=_[g])&&++g=0;)(a=r[i])&&(o&&a.compareDocumentPosition(o)^4&&o.parentNode.insertBefore(a,o),o=a);return this}function iye(e){e||(e=oye);function t(d,f){return d&&f?e(d.__data__,f.__data__):!d-!f}for(var n=this._groups,r=n.length,i=new Array(r),o=0;ot?1:e>=t?0:NaN}function aye(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function sye(){return Array.from(this)}function lye(){for(var e=this._groups,t=0,n=e.length;t1?this.each((t==null?bye:typeof t=="function"?Sye:_ye)(e,t,n??"")):Jh(this.node(),e)}function Jh(e,t){return e.style.getPropertyValue(t)||bU(e).getComputedStyle(e,null).getPropertyValue(t)}function wye(e){return function(){delete this[e]}}function Cye(e,t){return function(){this[e]=t}}function Eye(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function kye(e,t){return arguments.length>1?this.each((t==null?wye:typeof t=="function"?Eye:Cye)(e,t)):this.node()[e]}function _U(e){return e.trim().split(/^|\s+/)}function XT(e){return e.classList||new SU(e)}function SU(e){this._node=e,this._names=_U(e.getAttribute("class")||"")}SU.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function xU(e,t){for(var n=XT(e),r=-1,i=t.length;++r=0&&(n=t.slice(r+1),t=t.slice(0,r)),{type:t,name:n}})}function eve(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,i=t.length,o;n()=>e;function wE(e,{sourceEvent:t,subject:n,target:r,identifier:i,active:o,x:a,y:s,dx:l,dy:u,dispatch:c}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:i,enumerable:!0,configurable:!0},active:{value:o,enumerable:!0,configurable:!0},x:{value:a,enumerable:!0,configurable:!0},y:{value:s,enumerable:!0,configurable:!0},dx:{value:l,enumerable:!0,configurable:!0},dy:{value:u,enumerable:!0,configurable:!0},_:{value:c}})}wE.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function cve(e){return!e.ctrlKey&&!e.button}function dve(){return this.parentNode}function fve(e,t){return t??{x:e.x,y:e.y}}function hve(){return navigator.maxTouchPoints||"ontouchstart"in this}function pve(){var e=cve,t=dve,n=fve,r=hve,i={},o=G2("start","drag","end"),a=0,s,l,u,c,d=0;function f(y){y.on("mousedown.drag",h).filter(r).on("touchstart.drag",_).on("touchmove.drag",b,uve).on("touchend.drag touchcancel.drag",v).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function h(y,S){if(!(c||!e.call(this,y,S))){var w=g(this,t.call(this,y,S),y,S,"mouse");w&&(Wa(y.view).on("mousemove.drag",p,l0).on("mouseup.drag",m,l0),kU(y.view),OC(y),u=!1,s=y.clientX,l=y.clientY,w("start",y))}}function p(y){if(ph(y),!u){var S=y.clientX-s,w=y.clientY-l;u=S*S+w*w>d}i.mouse("drag",y)}function m(y){Wa(y.view).on("mousemove.drag mouseup.drag",null),TU(y.view,u),ph(y),i.mouse("end",y)}function _(y,S){if(e.call(this,y,S)){var w=y.changedTouches,x=t.call(this,y,S),C=w.length,T,k;for(T=0;T>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?Av(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?Av(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=mve.exec(e))?new Co(t[1],t[2],t[3],1):(t=yve.exec(e))?new Co(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=vve.exec(e))?Av(t[1],t[2],t[3],t[4]):(t=bve.exec(e))?Av(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=_ve.exec(e))?e9(t[1],t[2]/100,t[3]/100,1):(t=Sve.exec(e))?e9(t[1],t[2]/100,t[3]/100,t[4]):KR.hasOwnProperty(e)?YR(KR[e]):e==="transparent"?new Co(NaN,NaN,NaN,0):null}function YR(e){return new Co(e>>16&255,e>>8&255,e&255,1)}function Av(e,t,n,r){return r<=0&&(e=t=n=NaN),new Co(e,t,n,r)}function Cve(e){return e instanceof Sy||(e=d0(e)),e?(e=e.rgb(),new Co(e.r,e.g,e.b,e.opacity)):new Co}function CE(e,t,n,r){return arguments.length===1?Cve(e):new Co(e,t,n,r??1)}function Co(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}YT(Co,CE,AU(Sy,{brighter(e){return e=e==null?E_:Math.pow(E_,e),new Co(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?u0:Math.pow(u0,e),new Co(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Co(gd(this.r),gd(this.g),gd(this.b),k_(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:ZR,formatHex:ZR,formatHex8:Eve,formatRgb:JR,toString:JR}));function ZR(){return`#${id(this.r)}${id(this.g)}${id(this.b)}`}function Eve(){return`#${id(this.r)}${id(this.g)}${id(this.b)}${id((isNaN(this.opacity)?1:this.opacity)*255)}`}function JR(){const e=k_(this.opacity);return`${e===1?"rgb(":"rgba("}${gd(this.r)}, ${gd(this.g)}, ${gd(this.b)}${e===1?")":`, ${e})`}`}function k_(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function gd(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function id(e){return e=gd(e),(e<16?"0":"")+e.toString(16)}function e9(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new Ka(e,t,n,r)}function PU(e){if(e instanceof Ka)return new Ka(e.h,e.s,e.l,e.opacity);if(e instanceof Sy||(e=d0(e)),!e)return new Ka;if(e instanceof Ka)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,i=Math.min(t,n,r),o=Math.max(t,n,r),a=NaN,s=o-i,l=(o+i)/2;return s?(t===o?a=(n-r)/s+(n0&&l<1?0:a,new Ka(a,s,l,e.opacity)}function kve(e,t,n,r){return arguments.length===1?PU(e):new Ka(e,t,n,r??1)}function Ka(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}YT(Ka,kve,AU(Sy,{brighter(e){return e=e==null?E_:Math.pow(E_,e),new Ka(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?u0:Math.pow(u0,e),new Ka(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,n=this.l,r=n+(n<.5?n:1-n)*t,i=2*n-r;return new Co(MC(e>=240?e-240:e+120,i,r),MC(e,i,r),MC(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new Ka(t9(this.h),Pv(this.s),Pv(this.l),k_(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=k_(this.opacity);return`${e===1?"hsl(":"hsla("}${t9(this.h)}, ${Pv(this.s)*100}%, ${Pv(this.l)*100}%${e===1?")":`, ${e})`}`}}));function t9(e){return e=(e||0)%360,e<0?e+360:e}function Pv(e){return Math.max(0,Math.min(1,e||0))}function MC(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}const IU=e=>()=>e;function Tve(e,t){return function(n){return e+n*t}}function Ave(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(r){return Math.pow(e+r*t,n)}}function Pve(e){return(e=+e)==1?RU:function(t,n){return n-t?Ave(t,n,e):IU(isNaN(t)?n:t)}}function RU(e,t){var n=t-e;return n?Tve(e,n):IU(isNaN(e)?t:e)}const n9=function e(t){var n=Pve(t);function r(i,o){var a=n((i=CE(i)).r,(o=CE(o)).r),s=n(i.g,o.g),l=n(i.b,o.b),u=RU(i.opacity,o.opacity);return function(c){return i.r=a(c),i.g=s(c),i.b=l(c),i.opacity=u(c),i+""}}return r.gamma=e,r}(1);function mu(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}var EE=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,NC=new RegExp(EE.source,"g");function Ive(e){return function(){return e}}function Rve(e){return function(t){return e(t)+""}}function Ove(e,t){var n=EE.lastIndex=NC.lastIndex=0,r,i,o,a=-1,s=[],l=[];for(e=e+"",t=t+"";(r=EE.exec(e))&&(i=NC.exec(t));)(o=i.index)>n&&(o=t.slice(n,o),s[a]?s[a]+=o:s[++a]=o),(r=r[0])===(i=i[0])?s[a]?s[a]+=i:s[++a]=i:(s[++a]=null,l.push({i:a,x:mu(r,i)})),n=NC.lastIndex;return n180?c+=360:c-u>180&&(u+=360),f.push({i:d.push(i(d)+"rotate(",null,r)-2,x:mu(u,c)})):c&&d.push(i(d)+"rotate("+c+r)}function s(u,c,d,f){u!==c?f.push({i:d.push(i(d)+"skewX(",null,r)-2,x:mu(u,c)}):c&&d.push(i(d)+"skewX("+c+r)}function l(u,c,d,f,h,p){if(u!==d||c!==f){var m=h.push(i(h)+"scale(",null,",",null,")");p.push({i:m-4,x:mu(u,d)},{i:m-2,x:mu(c,f)})}else(d!==1||f!==1)&&h.push(i(h)+"scale("+d+","+f+")")}return function(u,c){var d=[],f=[];return u=e(u),c=e(c),o(u.translateX,u.translateY,c.translateX,c.translateY,d,f),a(u.rotate,c.rotate,d,f),s(u.skewX,c.skewX,d,f),l(u.scaleX,u.scaleY,c.scaleX,c.scaleY,d,f),u=c=null,function(h){for(var p=-1,m=f.length,_;++p=0&&e._call.call(void 0,t),e=e._next;--ep}function o9(){Md=(A_=f0.now())+q2,ep=bg=0;try{Uve()}finally{ep=0,Gve(),Md=0}}function Vve(){var e=f0.now(),t=e-A_;t>NU&&(q2-=t,A_=e)}function Gve(){for(var e,t=T_,n,r=1/0;t;)t._call?(r>t._time&&(r=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:T_=n);_g=e,TE(r)}function TE(e){if(!ep){bg&&(bg=clearTimeout(bg));var t=e-Md;t>24?(e<1/0&&(bg=setTimeout(o9,e-f0.now()-q2)),Wp&&(Wp=clearInterval(Wp))):(Wp||(A_=f0.now(),Wp=setInterval(Vve,NU)),ep=1,$U(o9))}}function a9(e,t,n){var r=new P_;return t=t==null?0:+t,r.restart(i=>{r.stop(),e(i+t)},t,n),r}var Hve=G2("start","end","cancel","interrupt"),qve=[],LU=0,s9=1,AE=2,B1=3,l9=4,PE=5,z1=6;function W2(e,t,n,r,i,o){var a=e.__transition;if(!a)e.__transition={};else if(n in a)return;Wve(e,n,{name:t,index:r,group:i,on:Hve,tween:qve,time:o.time,delay:o.delay,duration:o.duration,ease:o.ease,timer:null,state:LU})}function JT(e,t){var n=ds(e,t);if(n.state>LU)throw new Error("too late; already scheduled");return n}function nl(e,t){var n=ds(e,t);if(n.state>B1)throw new Error("too late; already running");return n}function ds(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function Wve(e,t,n){var r=e.__transition,i;r[t]=n,n.timer=DU(o,0,n.time);function o(u){n.state=s9,n.timer.restart(a,n.delay,n.time),n.delay<=u&&a(u-n.delay)}function a(u){var c,d,f,h;if(n.state!==s9)return l();for(c in r)if(h=r[c],h.name===n.name){if(h.state===B1)return a9(a);h.state===l9?(h.state=z1,h.timer.stop(),h.on.call("interrupt",e,e.__data__,h.index,h.group),delete r[c]):+cAE&&r.state=0&&(t=t.slice(0,n)),!t||t==="start"})}function w1e(e,t,n){var r,i,o=x1e(t)?JT:nl;return function(){var a=o(this,e),s=a.on;s!==r&&(i=(r=s).copy()).on(t,n),a.on=i}}function C1e(e,t){var n=this._id;return arguments.length<2?ds(this.node(),n).on.on(e):this.each(w1e(n,e,t))}function E1e(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function k1e(){return this.on("end.remove",E1e(this._id))}function T1e(e){var t=this._name,n=this._id;typeof e!="function"&&(e=QT(e));for(var r=this._groups,i=r.length,o=new Array(i),a=0;a()=>e;function Z1e(e,{sourceEvent:t,target:n,transform:r,dispatch:i}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:i}})}function Pl(e,t,n){this.k=e,this.x=t,this.y=n}Pl.prototype={constructor:Pl,scale:function(e){return e===1?this:new Pl(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Pl(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var Ku=new Pl(1,0,0);Pl.prototype;function $C(e){e.stopImmediatePropagation()}function Kp(e){e.preventDefault(),e.stopImmediatePropagation()}function J1e(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function ebe(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function u9(){return this.__zoom||Ku}function tbe(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function nbe(){return navigator.maxTouchPoints||"ontouchstart"in this}function rbe(e,t,n){var r=e.invertX(t[0][0])-n[0][0],i=e.invertX(t[1][0])-n[1][0],o=e.invertY(t[0][1])-n[0][1],a=e.invertY(t[1][1])-n[1][1];return e.translate(i>r?(r+i)/2:Math.min(0,r)||Math.max(0,i),a>o?(o+a)/2:Math.min(0,o)||Math.max(0,a))}function ibe(){var e=J1e,t=ebe,n=rbe,r=tbe,i=nbe,o=[0,1/0],a=[[-1/0,-1/0],[1/0,1/0]],s=250,l=zve,u=G2("start","zoom","end"),c,d,f,h=500,p=150,m=0,_=10;function b(E){E.property("__zoom",u9).on("wheel.zoom",C,{passive:!1}).on("mousedown.zoom",T).on("dblclick.zoom",k).filter(i).on("touchstart.zoom",P).on("touchmove.zoom",$).on("touchend.zoom touchcancel.zoom",O).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}b.transform=function(E,A,D,L){var M=E.selection?E.selection():E;M.property("__zoom",u9),E!==M?S(E,A,D,L):M.interrupt().each(function(){w(this,arguments).event(L).start().zoom(null,typeof A=="function"?A.apply(this,arguments):A).end()})},b.scaleBy=function(E,A,D,L){b.scaleTo(E,function(){var M=this.__zoom.k,R=typeof A=="function"?A.apply(this,arguments):A;return M*R},D,L)},b.scaleTo=function(E,A,D,L){b.transform(E,function(){var M=t.apply(this,arguments),R=this.__zoom,N=D==null?y(M):typeof D=="function"?D.apply(this,arguments):D,B=R.invert(N),U=typeof A=="function"?A.apply(this,arguments):A;return n(g(v(R,U),N,B),M,a)},D,L)},b.translateBy=function(E,A,D,L){b.transform(E,function(){return n(this.__zoom.translate(typeof A=="function"?A.apply(this,arguments):A,typeof D=="function"?D.apply(this,arguments):D),t.apply(this,arguments),a)},null,L)},b.translateTo=function(E,A,D,L,M){b.transform(E,function(){var R=t.apply(this,arguments),N=this.__zoom,B=L==null?y(R):typeof L=="function"?L.apply(this,arguments):L;return n(Ku.translate(B[0],B[1]).scale(N.k).translate(typeof A=="function"?-A.apply(this,arguments):-A,typeof D=="function"?-D.apply(this,arguments):-D),R,a)},L,M)};function v(E,A){return A=Math.max(o[0],Math.min(o[1],A)),A===E.k?E:new Pl(A,E.x,E.y)}function g(E,A,D){var L=A[0]-D[0]*E.k,M=A[1]-D[1]*E.k;return L===E.x&&M===E.y?E:new Pl(E.k,L,M)}function y(E){return[(+E[0][0]+ +E[1][0])/2,(+E[0][1]+ +E[1][1])/2]}function S(E,A,D,L){E.on("start.zoom",function(){w(this,arguments).event(L).start()}).on("interrupt.zoom end.zoom",function(){w(this,arguments).event(L).end()}).tween("zoom",function(){var M=this,R=arguments,N=w(M,R).event(L),B=t.apply(M,R),U=D==null?y(B):typeof D=="function"?D.apply(M,R):D,G=Math.max(B[1][0]-B[0][0],B[1][1]-B[0][1]),Y=M.__zoom,ee=typeof A=="function"?A.apply(M,R):A,J=l(Y.invert(U).concat(G/Y.k),ee.invert(U).concat(G/ee.k));return function(j){if(j===1)j=ee;else{var Q=J(j),ne=G/Q[2];j=new Pl(ne,U[0]-Q[0]*ne,U[1]-Q[1]*ne)}N.zoom(null,j)}})}function w(E,A,D){return!D&&E.__zooming||new x(E,A)}function x(E,A){this.that=E,this.args=A,this.active=0,this.sourceEvent=null,this.extent=t.apply(E,A),this.taps=0}x.prototype={event:function(E){return E&&(this.sourceEvent=E),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(E,A){return this.mouse&&E!=="mouse"&&(this.mouse[1]=A.invert(this.mouse[0])),this.touch0&&E!=="touch"&&(this.touch0[1]=A.invert(this.touch0[0])),this.touch1&&E!=="touch"&&(this.touch1[1]=A.invert(this.touch1[0])),this.that.__zoom=A,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(E){var A=Wa(this.that).datum();u.call(E,this.that,new Z1e(E,{sourceEvent:this.sourceEvent,target:b,type:E,transform:this.that.__zoom,dispatch:u}),A)}};function C(E,...A){if(!e.apply(this,arguments))return;var D=w(this,A).event(E),L=this.__zoom,M=Math.max(o[0],Math.min(o[1],L.k*Math.pow(2,r.apply(this,arguments)))),R=xs(E);if(D.wheel)(D.mouse[0][0]!==R[0]||D.mouse[0][1]!==R[1])&&(D.mouse[1]=L.invert(D.mouse[0]=R)),clearTimeout(D.wheel);else{if(L.k===M)return;D.mouse=[R,L.invert(R)],j1(this),D.start()}Kp(E),D.wheel=setTimeout(N,p),D.zoom("mouse",n(g(v(L,M),D.mouse[0],D.mouse[1]),D.extent,a));function N(){D.wheel=null,D.end()}}function T(E,...A){if(f||!e.apply(this,arguments))return;var D=E.currentTarget,L=w(this,A,!0).event(E),M=Wa(E.view).on("mousemove.zoom",U,!0).on("mouseup.zoom",G,!0),R=xs(E,D),N=E.clientX,B=E.clientY;kU(E.view),$C(E),L.mouse=[R,this.__zoom.invert(R)],j1(this),L.start();function U(Y){if(Kp(Y),!L.moved){var ee=Y.clientX-N,J=Y.clientY-B;L.moved=ee*ee+J*J>m}L.event(Y).zoom("mouse",n(g(L.that.__zoom,L.mouse[0]=xs(Y,D),L.mouse[1]),L.extent,a))}function G(Y){M.on("mousemove.zoom mouseup.zoom",null),TU(Y.view,L.moved),Kp(Y),L.event(Y).end()}}function k(E,...A){if(e.apply(this,arguments)){var D=this.__zoom,L=xs(E.changedTouches?E.changedTouches[0]:E,this),M=D.invert(L),R=D.k*(E.shiftKey?.5:2),N=n(g(v(D,R),L,M),t.apply(this,A),a);Kp(E),s>0?Wa(this).transition().duration(s).call(S,N,L,E):Wa(this).call(b.transform,N,L,E)}}function P(E,...A){if(e.apply(this,arguments)){var D=E.touches,L=D.length,M=w(this,A,E.changedTouches.length===L).event(E),R,N,B,U;for($C(E),N=0;N"[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.dev/error#001",error002:()=>"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.",error003:e=>`Node type "${e}" not found. Using fallback type "default".`,error004:()=>"The React Flow parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error007:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,t)=>`Couldn't create edge for ${e?"target":"source"} handle id: "${e?t.targetHandle:t.sourceHandle}", edge id: ${t.id}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:e=>`Edge type "${e}" not found. Using fallback type "default".`,error012:e=>`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`},jU=ql.error001();function br(e,t){const n=I.useContext(K2);if(n===null)throw new Error(jU);return hU(n,e,t)}const hi=()=>{const e=I.useContext(K2);if(e===null)throw new Error(jU);return I.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe,destroy:e.destroy}),[e])},abe=e=>e.userSelectionActive?"none":"all";function sbe({position:e,children:t,className:n,style:r,...i}){const o=br(abe),a=`${e}`.split("-");return W.jsx("div",{className:Ta(["react-flow__panel",n,...a]),style:{...r,pointerEvents:o},...i,children:t})}function lbe({proOptions:e,position:t="bottom-right"}){return e!=null&&e.hideAttribution?null:W.jsx(sbe,{position:t,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://pro.reactflow.dev",children:W.jsx("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const ube=({x:e,y:t,label:n,labelStyle:r={},labelShowBg:i=!0,labelBgStyle:o={},labelBgPadding:a=[2,4],labelBgBorderRadius:s=2,children:l,className:u,...c})=>{const d=I.useRef(null),[f,h]=I.useState({x:0,y:0,width:0,height:0}),p=Ta(["react-flow__edge-textwrapper",u]);return I.useEffect(()=>{if(d.current){const m=d.current.getBBox();h({x:m.x,y:m.y,width:m.width,height:m.height})}},[n]),typeof n>"u"||!n?null:W.jsxs("g",{transform:`translate(${e-f.width/2} ${t-f.height/2})`,className:p,visibility:f.width?"visible":"hidden",...c,children:[i&&W.jsx("rect",{width:f.width+2*a[0],x:-a[0],y:-a[1],height:f.height+2*a[1],className:"react-flow__edge-textbg",style:o,rx:s,ry:s}),W.jsx("text",{className:"react-flow__edge-text",y:f.height/2,dy:"0.3em",ref:d,style:r,children:n}),l]})};var cbe=I.memo(ube);const tA=e=>({width:e.offsetWidth,height:e.offsetHeight}),tp=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),nA=(e={x:0,y:0},t)=>({x:tp(e.x,t[0][0],t[1][0]),y:tp(e.y,t[0][1],t[1][1])}),c9=(e,t,n)=>en?-tp(Math.abs(e-n),1,50)/50:0,UU=(e,t)=>{const n=c9(e.x,35,t.width-35)*20,r=c9(e.y,35,t.height-35)*20;return[n,r]},VU=e=>{var t;return((t=e.getRootNode)==null?void 0:t.call(e))||(window==null?void 0:window.document)},GU=(e,t)=>({x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x2,t.x2),y2:Math.max(e.y2,t.y2)}),h0=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),HU=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),d9=e=>({...e.positionAbsolute||{x:0,y:0},width:e.width||0,height:e.height||0}),mHe=(e,t)=>HU(GU(h0(e),h0(t))),IE=(e,t)=>{const n=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),r=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(n*r)},dbe=e=>ba(e.width)&&ba(e.height)&&ba(e.x)&&ba(e.y),ba=e=>!isNaN(e)&&isFinite(e),Kr=Symbol.for("internals"),qU=["Enter"," ","Escape"],fbe=(e,t)=>{},hbe=e=>"nativeEvent"in e;function RE(e){var i,o;const t=hbe(e)?e.nativeEvent:e,n=((o=(i=t.composedPath)==null?void 0:i.call(t))==null?void 0:o[0])||e.target;return["INPUT","SELECT","TEXTAREA"].includes(n==null?void 0:n.nodeName)||(n==null?void 0:n.hasAttribute("contenteditable"))||!!(n!=null&&n.closest(".nokey"))}const WU=e=>"clientX"in e,Qu=(e,t)=>{var o,a;const n=WU(e),r=n?e.clientX:(o=e.touches)==null?void 0:o[0].clientX,i=n?e.clientY:(a=e.touches)==null?void 0:a[0].clientY;return{x:r-((t==null?void 0:t.left)??0),y:i-((t==null?void 0:t.top)??0)}},I_=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0},xy=({id:e,path:t,labelX:n,labelY:r,label:i,labelStyle:o,labelShowBg:a,labelBgStyle:s,labelBgPadding:l,labelBgBorderRadius:u,style:c,markerEnd:d,markerStart:f,interactionWidth:h=20})=>W.jsxs(W.Fragment,{children:[W.jsx("path",{id:e,style:c,d:t,fill:"none",className:"react-flow__edge-path",markerEnd:d,markerStart:f}),h&&W.jsx("path",{d:t,fill:"none",strokeOpacity:0,strokeWidth:h,className:"react-flow__edge-interaction"}),i&&ba(n)&&ba(r)?W.jsx(cbe,{x:n,y:r,label:i,labelStyle:o,labelShowBg:a,labelBgStyle:s,labelBgPadding:l,labelBgBorderRadius:u}):null]});xy.displayName="BaseEdge";function Qp(e,t,n){return n===void 0?n:r=>{const i=t().edges.find(o=>o.id===e);i&&n(r,{...i})}}function KU({sourceX:e,sourceY:t,targetX:n,targetY:r}){const i=Math.abs(n-e)/2,o=n{const[_,b,v]=XU({sourceX:e,sourceY:t,sourcePosition:i,targetX:n,targetY:r,targetPosition:o});return W.jsx(xy,{path:_,labelX:b,labelY:v,label:a,labelStyle:s,labelShowBg:l,labelBgStyle:u,labelBgPadding:c,labelBgBorderRadius:d,style:f,markerEnd:h,markerStart:p,interactionWidth:m})});rA.displayName="SimpleBezierEdge";const h9={[tt.Left]:{x:-1,y:0},[tt.Right]:{x:1,y:0},[tt.Top]:{x:0,y:-1},[tt.Bottom]:{x:0,y:1}},pbe=({source:e,sourcePosition:t=tt.Bottom,target:n})=>t===tt.Left||t===tt.Right?e.xMath.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function gbe({source:e,sourcePosition:t=tt.Bottom,target:n,targetPosition:r=tt.Top,center:i,offset:o}){const a=h9[t],s=h9[r],l={x:e.x+a.x*o,y:e.y+a.y*o},u={x:n.x+s.x*o,y:n.y+s.y*o},c=pbe({source:l,sourcePosition:t,target:u}),d=c.x!==0?"x":"y",f=c[d];let h=[],p,m;const _={x:0,y:0},b={x:0,y:0},[v,g,y,S]=KU({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(a[d]*s[d]===-1){p=i.x||v,m=i.y||g;const x=[{x:p,y:l.y},{x:p,y:u.y}],C=[{x:l.x,y:m},{x:u.x,y:m}];a[d]===f?h=d==="x"?x:C:h=d==="x"?C:x}else{const x=[{x:l.x,y:u.y}],C=[{x:u.x,y:l.y}];if(d==="x"?h=a.x===f?C:x:h=a.y===f?x:C,t===r){const O=Math.abs(e[d]-n[d]);if(O<=o){const E=Math.min(o-1,o-O);a[d]===f?_[d]=(l[d]>e[d]?-1:1)*E:b[d]=(u[d]>n[d]?-1:1)*E}}if(t!==r){const O=d==="x"?"y":"x",E=a[d]===s[O],A=l[O]>u[O],D=l[O]=$?(p=(T.x+k.x)/2,m=h[0].y):(p=h[0].x,m=(T.y+k.y)/2)}return[[e,{x:l.x+_.x,y:l.y+_.y},...h,{x:u.x+b.x,y:u.y+b.y},n],p,m,y,S]}function mbe(e,t,n,r){const i=Math.min(p9(e,t)/2,p9(t,n)/2,r),{x:o,y:a}=t;if(e.x===o&&o===n.x||e.y===a&&a===n.y)return`L${o} ${a}`;if(e.y===a){const u=e.x{let g="";return v>0&&v{const[b,v,g]=OE({sourceX:e,sourceY:t,sourcePosition:d,targetX:n,targetY:r,targetPosition:f,borderRadius:m==null?void 0:m.borderRadius,offset:m==null?void 0:m.offset});return W.jsx(xy,{path:b,labelX:v,labelY:g,label:i,labelStyle:o,labelShowBg:a,labelBgStyle:s,labelBgPadding:l,labelBgBorderRadius:u,style:c,markerEnd:h,markerStart:p,interactionWidth:_})});Q2.displayName="SmoothStepEdge";const iA=I.memo(e=>{var t;return W.jsx(Q2,{...e,pathOptions:I.useMemo(()=>{var n;return{borderRadius:0,offset:(n=e.pathOptions)==null?void 0:n.offset}},[(t=e.pathOptions)==null?void 0:t.offset])})});iA.displayName="StepEdge";function ybe({sourceX:e,sourceY:t,targetX:n,targetY:r}){const[i,o,a,s]=KU({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,i,o,a,s]}const oA=I.memo(({sourceX:e,sourceY:t,targetX:n,targetY:r,label:i,labelStyle:o,labelShowBg:a,labelBgStyle:s,labelBgPadding:l,labelBgBorderRadius:u,style:c,markerEnd:d,markerStart:f,interactionWidth:h})=>{const[p,m,_]=ybe({sourceX:e,sourceY:t,targetX:n,targetY:r});return W.jsx(xy,{path:p,labelX:m,labelY:_,label:i,labelStyle:o,labelShowBg:a,labelBgStyle:s,labelBgPadding:l,labelBgBorderRadius:u,style:c,markerEnd:d,markerStart:f,interactionWidth:h})});oA.displayName="StraightEdge";function Ov(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function g9({pos:e,x1:t,y1:n,x2:r,y2:i,c:o}){switch(e){case tt.Left:return[t-Ov(t-r,o),n];case tt.Right:return[t+Ov(r-t,o),n];case tt.Top:return[t,n-Ov(n-i,o)];case tt.Bottom:return[t,n+Ov(i-n,o)]}}function YU({sourceX:e,sourceY:t,sourcePosition:n=tt.Bottom,targetX:r,targetY:i,targetPosition:o=tt.Top,curvature:a=.25}){const[s,l]=g9({pos:n,x1:e,y1:t,x2:r,y2:i,c:a}),[u,c]=g9({pos:o,x1:r,y1:i,x2:e,y2:t,c:a}),[d,f,h,p]=QU({sourceX:e,sourceY:t,targetX:r,targetY:i,sourceControlX:s,sourceControlY:l,targetControlX:u,targetControlY:c});return[`M${e},${t} C${s},${l} ${u},${c} ${r},${i}`,d,f,h,p]}const O_=I.memo(({sourceX:e,sourceY:t,targetX:n,targetY:r,sourcePosition:i=tt.Bottom,targetPosition:o=tt.Top,label:a,labelStyle:s,labelShowBg:l,labelBgStyle:u,labelBgPadding:c,labelBgBorderRadius:d,style:f,markerEnd:h,markerStart:p,pathOptions:m,interactionWidth:_})=>{const[b,v,g]=YU({sourceX:e,sourceY:t,sourcePosition:i,targetX:n,targetY:r,targetPosition:o,curvature:m==null?void 0:m.curvature});return W.jsx(xy,{path:b,labelX:v,labelY:g,label:a,labelStyle:s,labelShowBg:l,labelBgStyle:u,labelBgPadding:c,labelBgBorderRadius:d,style:f,markerEnd:h,markerStart:p,interactionWidth:_})});O_.displayName="BezierEdge";const aA=I.createContext(null),vbe=aA.Provider;aA.Consumer;const bbe=()=>I.useContext(aA),_be=e=>"id"in e&&"source"in e&&"target"in e,ZU=e=>"id"in e&&!("source"in e)&&!("target"in e),Sbe=(e,t,n)=>{if(!ZU(e))return[];const r=n.filter(i=>i.source===e.id).map(i=>i.target);return t.filter(i=>r.includes(i.id))},xbe=(e,t,n)=>{if(!ZU(e))return[];const r=n.filter(i=>i.target===e.id).map(i=>i.source);return t.filter(i=>r.includes(i.id))},JU=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`reactflow__edge-${e}${t||""}-${n}${r||""}`,ME=(e,t)=>typeof e>"u"?"":typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(r=>`${r}=${e[r]}`).join("&")}`,wbe=(e,t)=>t.some(n=>n.source===e.source&&n.target===e.target&&(n.sourceHandle===e.sourceHandle||!n.sourceHandle&&!e.sourceHandle)&&(n.targetHandle===e.targetHandle||!n.targetHandle&&!e.targetHandle)),Sg=(e,t)=>{if(!e.source||!e.target)return t;let n;return _be(e)?n={...e}:n={...e,id:JU(e)},wbe(n,t)?t:t.concat(n)},Cbe=(e,t,n,r={shouldReplaceId:!0})=>{const{id:i,...o}=e;if(!t.source||!t.target||!n.find(l=>l.id===i))return n;const s={...o,id:r.shouldReplaceId?JU(t):i,source:t.source,target:t.target,sourceHandle:t.sourceHandle,targetHandle:t.targetHandle};return n.filter(l=>l.id!==i).concat(s)},eV=({x:e,y:t},[n,r,i],o,[a,s])=>{const l={x:(e-n)/i,y:(t-r)/i};return o?{x:a*Math.round(l.x/a),y:s*Math.round(l.y/s)}:l},Ebe=({x:e,y:t},[n,r,i])=>({x:e*i+n,y:t*i+r}),mh=(e,t=[0,0])=>{if(!e)return{x:0,y:0,positionAbsolute:{x:0,y:0}};const n=(e.width??0)*t[0],r=(e.height??0)*t[1],i={x:e.position.x-n,y:e.position.y-r};return{...i,positionAbsolute:e.positionAbsolute?{x:e.positionAbsolute.x-n,y:e.positionAbsolute.y-r}:i}},sA=(e,t=[0,0])=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const n=e.reduce((r,i)=>{const{x:o,y:a}=mh(i,t).positionAbsolute;return GU(r,h0({x:o,y:a,width:i.width||0,height:i.height||0}))},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return HU(n)},tV=(e,t,[n,r,i]=[0,0,1],o=!1,a=!1,s=[0,0])=>{const l={x:(t.x-n)/i,y:(t.y-r)/i,width:t.width/i,height:t.height/i},u=[];return e.forEach(c=>{const{width:d,height:f,selectable:h=!0,hidden:p=!1}=c;if(a&&!h||p)return!1;const{positionAbsolute:m}=mh(c,s),_={x:m.x,y:m.y,width:d||0,height:f||0},b=IE(l,_),v=typeof d>"u"||typeof f>"u"||d===null||f===null,g=o&&b>0,y=(d||0)*(f||0);(v||g||b>=y||c.dragging)&&u.push(c)}),u},lA=(e,t)=>{const n=e.map(r=>r.id);return t.filter(r=>n.includes(r.source)||n.includes(r.target))},nV=(e,t,n,r,i,o=.1)=>{const a=t/(e.width*(1+o)),s=n/(e.height*(1+o)),l=Math.min(a,s),u=tp(l,r,i),c=e.x+e.width/2,d=e.y+e.height/2,f=t/2-c*u,h=n/2-d*u;return[f,h,u]},jc=(e,t=0)=>e.transition().duration(t);function m9(e,t,n,r){return(t[n]||[]).reduce((i,o)=>{var a,s;return`${e.id}-${o.id}-${n}`!==r&&i.push({id:o.id||null,type:n,nodeId:e.id,x:(((a=e.positionAbsolute)==null?void 0:a.x)??0)+o.x+o.width/2,y:(((s=e.positionAbsolute)==null?void 0:s.y)??0)+o.y+o.height/2}),i},[])}function kbe(e,t,n,r,i,o){const{x:a,y:s}=Qu(e),u=t.elementsFromPoint(a,s).find(p=>p.classList.contains("react-flow__handle"));if(u){const p=u.getAttribute("data-nodeid");if(p){const m=uA(void 0,u),_=u.getAttribute("data-handleid"),b=o({nodeId:p,id:_,type:m});if(b)return{handle:{id:_,type:m,nodeId:p,x:n.x,y:n.y},validHandleResult:b}}}let c=[],d=1/0;if(i.forEach(p=>{const m=Math.sqrt((p.x-n.x)**2+(p.y-n.y)**2);if(m<=r){const _=o(p);m<=d&&(mp.isValid),h=c.some(({handle:p})=>p.type==="target");return c.find(({handle:p,validHandleResult:m})=>h?p.type==="target":f?m.isValid:!0)||c[0]}const Tbe={source:null,target:null,sourceHandle:null,targetHandle:null},rV=()=>({handleDomNode:null,isValid:!1,connection:Tbe,endHandle:null});function iV(e,t,n,r,i,o,a){const s=i==="target",l=a.querySelector(`.react-flow__handle[data-id="${e==null?void 0:e.nodeId}-${e==null?void 0:e.id}-${e==null?void 0:e.type}"]`),u={...rV(),handleDomNode:l};if(l){const c=uA(void 0,l),d=l.getAttribute("data-nodeid"),f=l.getAttribute("data-handleid"),h=l.classList.contains("connectable"),p=l.classList.contains("connectableend"),m={source:s?d:n,sourceHandle:s?f:r,target:s?n:d,targetHandle:s?r:f};u.connection=m,h&&p&&(t===Nd.Strict?s&&c==="source"||!s&&c==="target":d!==n||f!==r)&&(u.endHandle={nodeId:d,handleId:f,type:c},u.isValid=o(m))}return u}function Abe({nodes:e,nodeId:t,handleId:n,handleType:r}){return e.reduce((i,o)=>{if(o[Kr]){const{handleBounds:a}=o[Kr];let s=[],l=[];a&&(s=m9(o,a,"source",`${t}-${n}-${r}`),l=m9(o,a,"target",`${t}-${n}-${r}`)),i.push(...s,...l)}return i},[])}function uA(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function DC(e){e==null||e.classList.remove("valid","connecting","react-flow__handle-valid","react-flow__handle-connecting")}function Pbe(e,t){let n=null;return t?n="valid":e&&!t&&(n="invalid"),n}function oV({event:e,handleId:t,nodeId:n,onConnect:r,isTarget:i,getState:o,setState:a,isValidConnection:s,edgeUpdaterType:l,onEdgeUpdateEnd:u}){const c=VU(e.target),{connectionMode:d,domNode:f,autoPanOnConnect:h,connectionRadius:p,onConnectStart:m,panBy:_,getNodes:b,cancelConnection:v}=o();let g=0,y;const{x:S,y:w}=Qu(e),x=c==null?void 0:c.elementFromPoint(S,w),C=uA(l,x),T=f==null?void 0:f.getBoundingClientRect();if(!T||!C)return;let k,P=Qu(e,T),$=!1,O=null,E=!1,A=null;const D=Abe({nodes:b(),nodeId:n,handleId:t,handleType:C}),L=()=>{if(!h)return;const[N,B]=UU(P,T);_({x:N,y:B}),g=requestAnimationFrame(L)};a({connectionPosition:P,connectionStatus:null,connectionNodeId:n,connectionHandleId:t,connectionHandleType:C,connectionStartHandle:{nodeId:n,handleId:t,type:C},connectionEndHandle:null}),m==null||m(e,{nodeId:n,handleId:t,handleType:C});function M(N){const{transform:B}=o();P=Qu(N,T);const{handle:U,validHandleResult:G}=kbe(N,c,eV(P,B,!1,[1,1]),p,D,Y=>iV(Y,d,n,t,i?"target":"source",s,c));if(y=U,$||(L(),$=!0),A=G.handleDomNode,O=G.connection,E=G.isValid,a({connectionPosition:y&&E?Ebe({x:y.x,y:y.y},B):P,connectionStatus:Pbe(!!y,E),connectionEndHandle:G.endHandle}),!y&&!E&&!A)return DC(k);O.source!==O.target&&A&&(DC(k),k=A,A.classList.add("connecting","react-flow__handle-connecting"),A.classList.toggle("valid",E),A.classList.toggle("react-flow__handle-valid",E))}function R(N){var B,U;(y||A)&&O&&E&&(r==null||r(O)),(U=(B=o()).onConnectEnd)==null||U.call(B,N),l&&(u==null||u(N)),DC(k),v(),cancelAnimationFrame(g),$=!1,E=!1,O=null,A=null,c.removeEventListener("mousemove",M),c.removeEventListener("mouseup",R),c.removeEventListener("touchmove",M),c.removeEventListener("touchend",R)}c.addEventListener("mousemove",M),c.addEventListener("mouseup",R),c.addEventListener("touchmove",M),c.addEventListener("touchend",R)}const y9=()=>!0,Ibe=e=>({connectionStartHandle:e.connectionStartHandle,connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName}),Rbe=(e,t,n)=>r=>{const{connectionStartHandle:i,connectionEndHandle:o,connectionClickStartHandle:a}=r;return{connecting:(i==null?void 0:i.nodeId)===e&&(i==null?void 0:i.handleId)===t&&(i==null?void 0:i.type)===n||(o==null?void 0:o.nodeId)===e&&(o==null?void 0:o.handleId)===t&&(o==null?void 0:o.type)===n,clickConnecting:(a==null?void 0:a.nodeId)===e&&(a==null?void 0:a.handleId)===t&&(a==null?void 0:a.type)===n}},aV=I.forwardRef(({type:e="source",position:t=tt.Top,isValidConnection:n,isConnectable:r=!0,isConnectableStart:i=!0,isConnectableEnd:o=!0,id:a,onConnect:s,children:l,className:u,onMouseDown:c,onTouchStart:d,...f},h)=>{var T,k;const p=a||null,m=e==="target",_=hi(),b=bbe(),{connectOnClick:v,noPanClassName:g}=br(Ibe,Ro),{connecting:y,clickConnecting:S}=br(Rbe(b,p,e),Ro);b||(k=(T=_.getState()).onError)==null||k.call(T,"010",ql.error010());const w=P=>{const{defaultEdgeOptions:$,onConnect:O,hasDefaultEdges:E}=_.getState(),A={...$,...P};if(E){const{edges:D,setEdges:L}=_.getState();L(Sg(A,D))}O==null||O(A),s==null||s(A)},x=P=>{if(!b)return;const $=WU(P);i&&($&&P.button===0||!$)&&oV({event:P,handleId:p,nodeId:b,onConnect:w,isTarget:m,getState:_.getState,setState:_.setState,isValidConnection:n||_.getState().isValidConnection||y9}),$?c==null||c(P):d==null||d(P)},C=P=>{const{onClickConnectStart:$,onClickConnectEnd:O,connectionClickStartHandle:E,connectionMode:A,isValidConnection:D}=_.getState();if(!b||!E&&!i)return;if(!E){$==null||$(P,{nodeId:b,handleId:p,handleType:e}),_.setState({connectionClickStartHandle:{nodeId:b,type:e,handleId:p}});return}const L=VU(P.target),M=n||D||y9,{connection:R,isValid:N}=iV({nodeId:b,id:p,type:e},A,E.nodeId,E.handleId||null,E.type,M,L);N&&w(R),O==null||O(P),_.setState({connectionClickStartHandle:null})};return W.jsx("div",{"data-handleid":p,"data-nodeid":b,"data-handlepos":t,"data-id":`${b}-${p}-${e}`,className:Ta(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",g,u,{source:!m,target:m,connectable:r,connectablestart:i,connectableend:o,connecting:S,connectionindicator:r&&(i&&!y||o&&y)}]),onMouseDown:x,onTouchStart:x,onClick:v?C:void 0,ref:h,...f,children:l})});aV.displayName="Handle";var M_=I.memo(aV);const sV=({data:e,isConnectable:t,targetPosition:n=tt.Top,sourcePosition:r=tt.Bottom})=>W.jsxs(W.Fragment,{children:[W.jsx(M_,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label,W.jsx(M_,{type:"source",position:r,isConnectable:t})]});sV.displayName="DefaultNode";var NE=I.memo(sV);const lV=({data:e,isConnectable:t,sourcePosition:n=tt.Bottom})=>W.jsxs(W.Fragment,{children:[e==null?void 0:e.label,W.jsx(M_,{type:"source",position:n,isConnectable:t})]});lV.displayName="InputNode";var uV=I.memo(lV);const cV=({data:e,isConnectable:t,targetPosition:n=tt.Top})=>W.jsxs(W.Fragment,{children:[W.jsx(M_,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label]});cV.displayName="OutputNode";var dV=I.memo(cV);const cA=()=>null;cA.displayName="GroupNode";const Obe=e=>({selectedNodes:e.getNodes().filter(t=>t.selected),selectedEdges:e.edges.filter(t=>t.selected)}),Mv=e=>e.id;function Mbe(e,t){return Ro(e.selectedNodes.map(Mv),t.selectedNodes.map(Mv))&&Ro(e.selectedEdges.map(Mv),t.selectedEdges.map(Mv))}const fV=I.memo(({onSelectionChange:e})=>{const t=hi(),{selectedNodes:n,selectedEdges:r}=br(Obe,Mbe);return I.useEffect(()=>{var o,a;const i={nodes:n,edges:r};e==null||e(i),(a=(o=t.getState()).onSelectionChange)==null||a.call(o,i)},[n,r,e]),null});fV.displayName="SelectionListener";const Nbe=e=>!!e.onSelectionChange;function $be({onSelectionChange:e}){const t=br(Nbe);return e||t?W.jsx(fV,{onSelectionChange:e}):null}const Dbe=e=>({setNodes:e.setNodes,setEdges:e.setEdges,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset});function ff(e,t){I.useEffect(()=>{typeof e<"u"&&t(e)},[e])}function Ot(e,t,n){I.useEffect(()=>{typeof t<"u"&&n({[e]:t})},[t])}const Lbe=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:i,onConnectStart:o,onConnectEnd:a,onClickConnectStart:s,onClickConnectEnd:l,nodesDraggable:u,nodesConnectable:c,nodesFocusable:d,edgesFocusable:f,edgesUpdatable:h,elevateNodesOnSelect:p,minZoom:m,maxZoom:_,nodeExtent:b,onNodesChange:v,onEdgesChange:g,elementsSelectable:y,connectionMode:S,snapGrid:w,snapToGrid:x,translateExtent:C,connectOnClick:T,defaultEdgeOptions:k,fitView:P,fitViewOptions:$,onNodesDelete:O,onEdgesDelete:E,onNodeDrag:A,onNodeDragStart:D,onNodeDragStop:L,onSelectionDrag:M,onSelectionDragStart:R,onSelectionDragStop:N,noPanClassName:B,nodeOrigin:U,rfId:G,autoPanOnConnect:Y,autoPanOnNodeDrag:ee,onError:J,connectionRadius:j,isValidConnection:Q})=>{const{setNodes:ne,setEdges:se,setDefaultNodesAndEdges:ve,setMinZoom:ce,setMaxZoom:bt,setTranslateExtent:ot,setNodeExtent:ze,reset:gt}=br(Dbe,Ro),Pe=hi();return I.useEffect(()=>{const Jt=r==null?void 0:r.map(Ar=>({...Ar,...k}));return ve(n,Jt),()=>{gt()}},[]),Ot("defaultEdgeOptions",k,Pe.setState),Ot("connectionMode",S,Pe.setState),Ot("onConnect",i,Pe.setState),Ot("onConnectStart",o,Pe.setState),Ot("onConnectEnd",a,Pe.setState),Ot("onClickConnectStart",s,Pe.setState),Ot("onClickConnectEnd",l,Pe.setState),Ot("nodesDraggable",u,Pe.setState),Ot("nodesConnectable",c,Pe.setState),Ot("nodesFocusable",d,Pe.setState),Ot("edgesFocusable",f,Pe.setState),Ot("edgesUpdatable",h,Pe.setState),Ot("elementsSelectable",y,Pe.setState),Ot("elevateNodesOnSelect",p,Pe.setState),Ot("snapToGrid",x,Pe.setState),Ot("snapGrid",w,Pe.setState),Ot("onNodesChange",v,Pe.setState),Ot("onEdgesChange",g,Pe.setState),Ot("connectOnClick",T,Pe.setState),Ot("fitViewOnInit",P,Pe.setState),Ot("fitViewOnInitOptions",$,Pe.setState),Ot("onNodesDelete",O,Pe.setState),Ot("onEdgesDelete",E,Pe.setState),Ot("onNodeDrag",A,Pe.setState),Ot("onNodeDragStart",D,Pe.setState),Ot("onNodeDragStop",L,Pe.setState),Ot("onSelectionDrag",M,Pe.setState),Ot("onSelectionDragStart",R,Pe.setState),Ot("onSelectionDragStop",N,Pe.setState),Ot("noPanClassName",B,Pe.setState),Ot("nodeOrigin",U,Pe.setState),Ot("rfId",G,Pe.setState),Ot("autoPanOnConnect",Y,Pe.setState),Ot("autoPanOnNodeDrag",ee,Pe.setState),Ot("onError",J,Pe.setState),Ot("connectionRadius",j,Pe.setState),Ot("isValidConnection",Q,Pe.setState),ff(e,ne),ff(t,se),ff(m,ce),ff(_,bt),ff(C,ot),ff(b,ze),null},v9={display:"none"},Fbe={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},hV="react-flow__node-desc",pV="react-flow__edge-desc",Bbe="react-flow__aria-live",zbe=e=>e.ariaLiveMessage;function jbe({rfId:e}){const t=br(zbe);return W.jsx("div",{id:`${Bbe}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:Fbe,children:t})}function Ube({rfId:e,disableKeyboardA11y:t}){return W.jsxs(W.Fragment,{children:[W.jsxs("div",{id:`${hV}-${e}`,style:v9,children:["Press enter or space to select a node.",!t&&"You can then use the arrow keys to move the node around."," Press delete to remove it and escape to cancel."," "]}),W.jsx("div",{id:`${pV}-${e}`,style:v9,children:"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel."}),!t&&W.jsx(jbe,{rfId:e})]})}const Vbe=typeof document<"u"?document:null;var p0=(e=null,t={target:Vbe})=>{const[n,r]=I.useState(!1),i=I.useRef(!1),o=I.useRef(new Set([])),[a,s]=I.useMemo(()=>{if(e!==null){const u=(Array.isArray(e)?e:[e]).filter(d=>typeof d=="string").map(d=>d.split("+")),c=u.reduce((d,f)=>d.concat(...f),[]);return[u,c]}return[[],[]]},[e]);return I.useEffect(()=>{var l,u;if(e!==null){const c=h=>{if(i.current=h.ctrlKey||h.metaKey||h.shiftKey,!i.current&&RE(h))return!1;const p=_9(h.code,s);o.current.add(h[p]),b9(a,o.current,!1)&&(h.preventDefault(),r(!0))},d=h=>{if(!i.current&&RE(h))return!1;const p=_9(h.code,s);b9(a,o.current,!0)?(r(!1),o.current.clear()):o.current.delete(h[p]),h.key==="Meta"&&o.current.clear(),i.current=!1},f=()=>{o.current.clear(),r(!1)};return(l=t==null?void 0:t.target)==null||l.addEventListener("keydown",c),(u=t==null?void 0:t.target)==null||u.addEventListener("keyup",d),window.addEventListener("blur",f),()=>{var h,p;(h=t==null?void 0:t.target)==null||h.removeEventListener("keydown",c),(p=t==null?void 0:t.target)==null||p.removeEventListener("keyup",d),window.removeEventListener("blur",f)}}},[e,r]),n};function b9(e,t,n){return e.filter(r=>n||r.length===t.size).some(r=>r.every(i=>t.has(i)))}function _9(e,t){return t.includes(e)?"code":"key"}function gV(e,t,n,r){var a,s;if(!e.parentNode)return n;const i=t.get(e.parentNode),o=mh(i,r);return gV(i,t,{x:(n.x??0)+o.x,y:(n.y??0)+o.y,z:(((a=i[Kr])==null?void 0:a.z)??0)>(n.z??0)?((s=i[Kr])==null?void 0:s.z)??0:n.z??0},r)}function mV(e,t,n){e.forEach(r=>{var i;if(r.parentNode&&!e.has(r.parentNode))throw new Error(`Parent node ${r.parentNode} not found`);if(r.parentNode||n!=null&&n[r.id]){const{x:o,y:a,z:s}=gV(r,e,{...r.position,z:((i=r[Kr])==null?void 0:i.z)??0},t);r.positionAbsolute={x:o,y:a},r[Kr].z=s,n!=null&&n[r.id]&&(r[Kr].isParent=!0)}})}function LC(e,t,n,r){const i=new Map,o={},a=r?1e3:0;return e.forEach(s=>{var d;const l=(ba(s.zIndex)?s.zIndex:0)+(s.selected?a:0),u=t.get(s.id),c={width:u==null?void 0:u.width,height:u==null?void 0:u.height,...s,positionAbsolute:{x:s.position.x,y:s.position.y}};s.parentNode&&(c.parentNode=s.parentNode,o[s.parentNode]=!0),Object.defineProperty(c,Kr,{enumerable:!1,value:{handleBounds:(d=u==null?void 0:u[Kr])==null?void 0:d.handleBounds,z:l}}),i.set(s.id,c)}),mV(i,n,o),i}function yV(e,t={}){const{getNodes:n,width:r,height:i,minZoom:o,maxZoom:a,d3Zoom:s,d3Selection:l,fitViewOnInitDone:u,fitViewOnInit:c,nodeOrigin:d}=e(),f=t.initial&&!u&&c;if(s&&l&&(f||!t.initial)){const p=n().filter(_=>{var v;const b=t.includeHiddenNodes?_.width&&_.height:!_.hidden;return(v=t.nodes)!=null&&v.length?b&&t.nodes.some(g=>g.id===_.id):b}),m=p.every(_=>_.width&&_.height);if(p.length>0&&m){const _=sA(p,d),[b,v,g]=nV(_,r,i,t.minZoom??o,t.maxZoom??a,t.padding??.1),y=Ku.translate(b,v).scale(g);return typeof t.duration=="number"&&t.duration>0?s.transform(jc(l,t.duration),y):s.transform(l,y),!0}}return!1}function Gbe(e,t){return e.forEach(n=>{const r=t.get(n.id);r&&t.set(r.id,{...r,[Kr]:r[Kr],selected:n.selected})}),new Map(t)}function Hbe(e,t){return t.map(n=>{const r=e.find(i=>i.id===n.id);return r&&(n.selected=r.selected),n})}function Nv({changedNodes:e,changedEdges:t,get:n,set:r}){const{nodeInternals:i,edges:o,onNodesChange:a,onEdgesChange:s,hasDefaultNodes:l,hasDefaultEdges:u}=n();e!=null&&e.length&&(l&&r({nodeInternals:Gbe(e,i)}),a==null||a(e)),t!=null&&t.length&&(u&&r({edges:Hbe(t,o)}),s==null||s(t))}const hf=()=>{},qbe={zoomIn:hf,zoomOut:hf,zoomTo:hf,getZoom:()=>1,setViewport:hf,getViewport:()=>({x:0,y:0,zoom:1}),fitView:()=>!1,setCenter:hf,fitBounds:hf,project:e=>e,viewportInitialized:!1},Wbe=e=>({d3Zoom:e.d3Zoom,d3Selection:e.d3Selection}),Kbe=()=>{const e=hi(),{d3Zoom:t,d3Selection:n}=br(Wbe,Ro);return I.useMemo(()=>n&&t?{zoomIn:i=>t.scaleBy(jc(n,i==null?void 0:i.duration),1.2),zoomOut:i=>t.scaleBy(jc(n,i==null?void 0:i.duration),1/1.2),zoomTo:(i,o)=>t.scaleTo(jc(n,o==null?void 0:o.duration),i),getZoom:()=>e.getState().transform[2],setViewport:(i,o)=>{const[a,s,l]=e.getState().transform,u=Ku.translate(i.x??a,i.y??s).scale(i.zoom??l);t.transform(jc(n,o==null?void 0:o.duration),u)},getViewport:()=>{const[i,o,a]=e.getState().transform;return{x:i,y:o,zoom:a}},fitView:i=>yV(e.getState,i),setCenter:(i,o,a)=>{const{width:s,height:l,maxZoom:u}=e.getState(),c=typeof(a==null?void 0:a.zoom)<"u"?a.zoom:u,d=s/2-i*c,f=l/2-o*c,h=Ku.translate(d,f).scale(c);t.transform(jc(n,a==null?void 0:a.duration),h)},fitBounds:(i,o)=>{const{width:a,height:s,minZoom:l,maxZoom:u}=e.getState(),[c,d,f]=nV(i,a,s,l,u,(o==null?void 0:o.padding)??.1),h=Ku.translate(c,d).scale(f);t.transform(jc(n,o==null?void 0:o.duration),h)},project:i=>{const{transform:o,snapToGrid:a,snapGrid:s}=e.getState();return eV(i,o,a,s)},viewportInitialized:!0}:qbe,[t,n])};function vV(){const e=Kbe(),t=hi(),n=I.useCallback(()=>t.getState().getNodes().map(m=>({...m})),[]),r=I.useCallback(m=>t.getState().nodeInternals.get(m),[]),i=I.useCallback(()=>{const{edges:m=[]}=t.getState();return m.map(_=>({..._}))},[]),o=I.useCallback(m=>{const{edges:_=[]}=t.getState();return _.find(b=>b.id===m)},[]),a=I.useCallback(m=>{const{getNodes:_,setNodes:b,hasDefaultNodes:v,onNodesChange:g}=t.getState(),y=_(),S=typeof m=="function"?m(y):m;if(v)b(S);else if(g){const w=S.length===0?y.map(x=>({type:"remove",id:x.id})):S.map(x=>({item:x,type:"reset"}));g(w)}},[]),s=I.useCallback(m=>{const{edges:_=[],setEdges:b,hasDefaultEdges:v,onEdgesChange:g}=t.getState(),y=typeof m=="function"?m(_):m;if(v)b(y);else if(g){const S=y.length===0?_.map(w=>({type:"remove",id:w.id})):y.map(w=>({item:w,type:"reset"}));g(S)}},[]),l=I.useCallback(m=>{const _=Array.isArray(m)?m:[m],{getNodes:b,setNodes:v,hasDefaultNodes:g,onNodesChange:y}=t.getState();if(g){const w=[...b(),..._];v(w)}else if(y){const S=_.map(w=>({item:w,type:"add"}));y(S)}},[]),u=I.useCallback(m=>{const _=Array.isArray(m)?m:[m],{edges:b=[],setEdges:v,hasDefaultEdges:g,onEdgesChange:y}=t.getState();if(g)v([...b,..._]);else if(y){const S=_.map(w=>({item:w,type:"add"}));y(S)}},[]),c=I.useCallback(()=>{const{getNodes:m,edges:_=[],transform:b}=t.getState(),[v,g,y]=b;return{nodes:m().map(S=>({...S})),edges:_.map(S=>({...S})),viewport:{x:v,y:g,zoom:y}}},[]),d=I.useCallback(({nodes:m,edges:_})=>{const{nodeInternals:b,getNodes:v,edges:g,hasDefaultNodes:y,hasDefaultEdges:S,onNodesDelete:w,onEdgesDelete:x,onNodesChange:C,onEdgesChange:T}=t.getState(),k=(m||[]).map(A=>A.id),P=(_||[]).map(A=>A.id),$=v().reduce((A,D)=>{const L=!k.includes(D.id)&&D.parentNode&&A.find(R=>R.id===D.parentNode);return(typeof D.deletable=="boolean"?D.deletable:!0)&&(k.includes(D.id)||L)&&A.push(D),A},[]),O=g.filter(A=>typeof A.deletable=="boolean"?A.deletable:!0),E=O.filter(A=>P.includes(A.id));if($||E){const A=lA($,O),D=[...E,...A],L=D.reduce((M,R)=>(M.includes(R.id)||M.push(R.id),M),[]);if((S||y)&&(S&&t.setState({edges:g.filter(M=>!L.includes(M.id))}),y&&($.forEach(M=>{b.delete(M.id)}),t.setState({nodeInternals:new Map(b)}))),L.length>0&&(x==null||x(D),T&&T(L.map(M=>({id:M,type:"remove"})))),$.length>0&&(w==null||w($),C)){const M=$.map(R=>({id:R.id,type:"remove"}));C(M)}}},[]),f=I.useCallback(m=>{const _=dbe(m),b=_?null:t.getState().nodeInternals.get(m.id);return[_?m:d9(b),b,_]},[]),h=I.useCallback((m,_=!0,b)=>{const[v,g,y]=f(m);return v?(b||t.getState().getNodes()).filter(S=>{if(!y&&(S.id===g.id||!S.positionAbsolute))return!1;const w=d9(S),x=IE(w,v);return _&&x>0||x>=m.width*m.height}):[]},[]),p=I.useCallback((m,_,b=!0)=>{const[v]=f(m);if(!v)return!1;const g=IE(v,_);return b&&g>0||g>=m.width*m.height},[]);return I.useMemo(()=>({...e,getNodes:n,getNode:r,getEdges:i,getEdge:o,setNodes:a,setEdges:s,addNodes:l,addEdges:u,toObject:c,deleteElements:d,getIntersectingNodes:h,isNodeIntersecting:p}),[e,n,r,i,o,a,s,l,u,c,d,h,p])}var Qbe=({deleteKeyCode:e,multiSelectionKeyCode:t})=>{const n=hi(),{deleteElements:r}=vV(),i=p0(e),o=p0(t);I.useEffect(()=>{if(i){const{edges:a,getNodes:s}=n.getState(),l=s().filter(c=>c.selected),u=a.filter(c=>c.selected);r({nodes:l,edges:u}),n.setState({nodesSelectionActive:!1})}},[i]),I.useEffect(()=>{n.setState({multiSelectionActive:o})},[o])};function Xbe(e){const t=hi();I.useEffect(()=>{let n;const r=()=>{var o,a;if(!e.current)return;const i=tA(e.current);(i.height===0||i.width===0)&&((a=(o=t.getState()).onError)==null||a.call(o,"004",ql.error004())),t.setState({width:i.width||500,height:i.height||500})};return r(),window.addEventListener("resize",r),e.current&&(n=new ResizeObserver(()=>r()),n.observe(e.current)),()=>{window.removeEventListener("resize",r),n&&e.current&&n.unobserve(e.current)}},[])}const dA={position:"absolute",width:"100%",height:"100%",top:0,left:0},Ybe=(e,t)=>e.x!==t.x||e.y!==t.y||e.zoom!==t.k,$v=e=>({x:e.x,y:e.y,zoom:e.k}),pf=(e,t)=>e.target.closest(`.${t}`),S9=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),x9=e=>{const t=e.ctrlKey&&I_()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t},Zbe=e=>({d3Zoom:e.d3Zoom,d3Selection:e.d3Selection,d3ZoomHandler:e.d3ZoomHandler,userSelectionActive:e.userSelectionActive}),Jbe=({onMove:e,onMoveStart:t,onMoveEnd:n,onPaneContextMenu:r,zoomOnScroll:i=!0,zoomOnPinch:o=!0,panOnScroll:a=!1,panOnScrollSpeed:s=.5,panOnScrollMode:l=od.Free,zoomOnDoubleClick:u=!0,elementsSelectable:c,panOnDrag:d=!0,defaultViewport:f,translateExtent:h,minZoom:p,maxZoom:m,zoomActivationKeyCode:_,preventScrolling:b=!0,children:v,noWheelClassName:g,noPanClassName:y})=>{const S=I.useRef(),w=hi(),x=I.useRef(!1),C=I.useRef(!1),T=I.useRef(null),k=I.useRef({x:0,y:0,zoom:0}),{d3Zoom:P,d3Selection:$,d3ZoomHandler:O,userSelectionActive:E}=br(Zbe,Ro),A=p0(_),D=I.useRef(0),L=I.useRef(!1),M=I.useRef();return Xbe(T),I.useEffect(()=>{if(T.current){const R=T.current.getBoundingClientRect(),N=ibe().scaleExtent([p,m]).translateExtent(h),B=Wa(T.current).call(N),U=Ku.translate(f.x,f.y).scale(tp(f.zoom,p,m)),G=[[0,0],[R.width,R.height]],Y=N.constrain()(U,G,h);N.transform(B,Y),N.wheelDelta(x9),w.setState({d3Zoom:N,d3Selection:B,d3ZoomHandler:B.on("wheel.zoom"),transform:[Y.x,Y.y,Y.k],domNode:T.current.closest(".react-flow")})}},[]),I.useEffect(()=>{$&&P&&(a&&!A&&!E?$.on("wheel.zoom",R=>{if(pf(R,g))return!1;R.preventDefault(),R.stopImmediatePropagation();const N=$.property("__zoom").k||1,B=I_();if(R.ctrlKey&&o&&B){const ne=xs(R),se=x9(R),ve=N*Math.pow(2,se);P.scaleTo($,ve,ne,R);return}const U=R.deltaMode===1?20:1;let G=l===od.Vertical?0:R.deltaX*U,Y=l===od.Horizontal?0:R.deltaY*U;!B&&R.shiftKey&&l!==od.Vertical&&(G=R.deltaY*U,Y=0),P.translateBy($,-(G/N)*s,-(Y/N)*s,{internal:!0});const ee=$v($.property("__zoom")),{onViewportChangeStart:J,onViewportChange:j,onViewportChangeEnd:Q}=w.getState();clearTimeout(M.current),L.current||(L.current=!0,t==null||t(R,ee),J==null||J(ee)),L.current&&(e==null||e(R,ee),j==null||j(ee),M.current=setTimeout(()=>{n==null||n(R,ee),Q==null||Q(ee),L.current=!1},150))},{passive:!1}):typeof O<"u"&&$.on("wheel.zoom",function(R,N){if(!b||pf(R,g))return null;R.preventDefault(),O.call(this,R,N)},{passive:!1}))},[E,a,l,$,P,O,A,o,b,g,t,e,n]),I.useEffect(()=>{P&&P.on("start",R=>{var U,G;if(!R.sourceEvent||R.sourceEvent.internal)return null;D.current=(U=R.sourceEvent)==null?void 0:U.button;const{onViewportChangeStart:N}=w.getState(),B=$v(R.transform);x.current=!0,k.current=B,((G=R.sourceEvent)==null?void 0:G.type)==="mousedown"&&w.setState({paneDragging:!0}),N==null||N(B),t==null||t(R.sourceEvent,B)})},[P,t]),I.useEffect(()=>{P&&(E&&!x.current?P.on("zoom",null):E||P.on("zoom",R=>{var B;const{onViewportChange:N}=w.getState();if(w.setState({transform:[R.transform.x,R.transform.y,R.transform.k]}),C.current=!!(r&&S9(d,D.current??0)),(e||N)&&!((B=R.sourceEvent)!=null&&B.internal)){const U=$v(R.transform);N==null||N(U),e==null||e(R.sourceEvent,U)}}))},[E,P,e,d,r]),I.useEffect(()=>{P&&P.on("end",R=>{if(!R.sourceEvent||R.sourceEvent.internal)return null;const{onViewportChangeEnd:N}=w.getState();if(x.current=!1,w.setState({paneDragging:!1}),r&&S9(d,D.current??0)&&!C.current&&r(R.sourceEvent),C.current=!1,(n||N)&&Ybe(k.current,R.transform)){const B=$v(R.transform);k.current=B,clearTimeout(S.current),S.current=setTimeout(()=>{N==null||N(B),n==null||n(R.sourceEvent,B)},a?150:0)}})},[P,a,d,n,r]),I.useEffect(()=>{P&&P.filter(R=>{const N=A||i,B=o&&R.ctrlKey;if(R.button===1&&R.type==="mousedown"&&(pf(R,"react-flow__node")||pf(R,"react-flow__edge")))return!0;if(!d&&!N&&!a&&!u&&!o||E||!u&&R.type==="dblclick"||pf(R,g)&&R.type==="wheel"||pf(R,y)&&R.type!=="wheel"||!o&&R.ctrlKey&&R.type==="wheel"||!N&&!a&&!B&&R.type==="wheel"||!d&&(R.type==="mousedown"||R.type==="touchstart")||Array.isArray(d)&&!d.includes(R.button)&&(R.type==="mousedown"||R.type==="touchstart"))return!1;const U=Array.isArray(d)&&d.includes(R.button)||!R.button||R.button<=1;return(!R.ctrlKey||R.type==="wheel")&&U})},[E,P,i,o,a,u,d,c,A]),W.jsx("div",{className:"react-flow__renderer",ref:T,style:dA,children:v})},e_e=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function t_e(){const{userSelectionActive:e,userSelectionRect:t}=br(e_e,Ro);return e&&t?W.jsx("div",{className:"react-flow__selection react-flow__container",style:{width:t.width,height:t.height,transform:`translate(${t.x}px, ${t.y}px)`}}):null}function w9(e,t){const n=e.find(r=>r.id===t.parentNode);if(n){const r=t.position.x+t.width-n.width,i=t.position.y+t.height-n.height;if(r>0||i>0||t.position.x<0||t.position.y<0){if(n.style={...n.style},n.style.width=n.style.width??n.width,n.style.height=n.style.height??n.height,r>0&&(n.style.width+=r),i>0&&(n.style.height+=i),t.position.x<0){const o=Math.abs(t.position.x);n.position.x=n.position.x-o,n.style.width+=o,t.position.x=0}if(t.position.y<0){const o=Math.abs(t.position.y);n.position.y=n.position.y-o,n.style.height+=o,t.position.y=0}n.width=n.style.width,n.height=n.style.height}}}function bV(e,t){if(e.some(r=>r.type==="reset"))return e.filter(r=>r.type==="reset").map(r=>r.item);const n=e.filter(r=>r.type==="add").map(r=>r.item);return t.reduce((r,i)=>{const o=e.filter(s=>s.id===i.id);if(o.length===0)return r.push(i),r;const a={...i};for(const s of o)if(s)switch(s.type){case"select":{a.selected=s.selected;break}case"position":{typeof s.position<"u"&&(a.position=s.position),typeof s.positionAbsolute<"u"&&(a.positionAbsolute=s.positionAbsolute),typeof s.dragging<"u"&&(a.dragging=s.dragging),a.expandParent&&w9(r,a);break}case"dimensions":{typeof s.dimensions<"u"&&(a.width=s.dimensions.width,a.height=s.dimensions.height),typeof s.updateStyle<"u"&&(a.style={...a.style||{},...s.dimensions}),typeof s.resizing=="boolean"&&(a.resizing=s.resizing),a.expandParent&&w9(r,a);break}case"remove":return r}return r.push(a),r},n)}function Uc(e,t){return bV(e,t)}function Rc(e,t){return bV(e,t)}const yu=(e,t)=>({id:e,type:"select",selected:t});function zf(e,t){return e.reduce((n,r)=>{const i=t.includes(r.id);return!r.selected&&i?(r.selected=!0,n.push(yu(r.id,!0))):r.selected&&!i&&(r.selected=!1,n.push(yu(r.id,!1))),n},[])}const FC=(e,t)=>n=>{n.target===t.current&&(e==null||e(n))},n_e=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,dragging:e.paneDragging}),_V=I.memo(({isSelecting:e,selectionMode:t=sc.Full,panOnDrag:n,onSelectionStart:r,onSelectionEnd:i,onPaneClick:o,onPaneContextMenu:a,onPaneScroll:s,onPaneMouseEnter:l,onPaneMouseMove:u,onPaneMouseLeave:c,children:d})=>{const f=I.useRef(null),h=hi(),p=I.useRef(0),m=I.useRef(0),_=I.useRef(),{userSelectionActive:b,elementsSelectable:v,dragging:g}=br(n_e,Ro),y=()=>{h.setState({userSelectionActive:!1,userSelectionRect:null}),p.current=0,m.current=0},S=O=>{o==null||o(O),h.getState().resetSelectedElements(),h.setState({nodesSelectionActive:!1})},w=O=>{if(Array.isArray(n)&&(n!=null&&n.includes(2))){O.preventDefault();return}a==null||a(O)},x=s?O=>s(O):void 0,C=O=>{const{resetSelectedElements:E,domNode:A}=h.getState();if(_.current=A==null?void 0:A.getBoundingClientRect(),!v||!e||O.button!==0||O.target!==f.current||!_.current)return;const{x:D,y:L}=Qu(O,_.current);E(),h.setState({userSelectionRect:{width:0,height:0,startX:D,startY:L,x:D,y:L}}),r==null||r(O)},T=O=>{const{userSelectionRect:E,nodeInternals:A,edges:D,transform:L,onNodesChange:M,onEdgesChange:R,nodeOrigin:N,getNodes:B}=h.getState();if(!e||!_.current||!E)return;h.setState({userSelectionActive:!0,nodesSelectionActive:!1});const U=Qu(O,_.current),G=E.startX??0,Y=E.startY??0,ee={...E,x:U.xse.id),ne=j.map(se=>se.id);if(p.current!==ne.length){p.current=ne.length;const se=zf(J,ne);se.length&&(M==null||M(se))}if(m.current!==Q.length){m.current=Q.length;const se=zf(D,Q);se.length&&(R==null||R(se))}h.setState({userSelectionRect:ee})},k=O=>{if(O.button!==0)return;const{userSelectionRect:E}=h.getState();!b&&E&&O.target===f.current&&(S==null||S(O)),h.setState({nodesSelectionActive:p.current>0}),y(),i==null||i(O)},P=O=>{b&&(h.setState({nodesSelectionActive:p.current>0}),i==null||i(O)),y()},$=v&&(e||b);return W.jsxs("div",{className:Ta(["react-flow__pane",{dragging:g,selection:e}]),onClick:$?void 0:FC(S,f),onContextMenu:FC(w,f),onWheel:FC(x,f),onMouseEnter:$?void 0:l,onMouseDown:$?C:void 0,onMouseMove:$?T:u,onMouseUp:$?k:void 0,onMouseLeave:$?P:c,ref:f,style:dA,children:[d,W.jsx(t_e,{})]})});_V.displayName="Pane";function SV(e,t){if(!e.parentNode)return!1;const n=t.get(e.parentNode);return n?n.selected?!0:SV(n,t):!1}function C9(e,t,n){let r=e;do{if(r!=null&&r.matches(t))return!0;if(r===n.current)return!1;r=r.parentElement}while(r);return!1}function r_e(e,t,n,r){return Array.from(e.values()).filter(i=>(i.selected||i.id===r)&&(!i.parentNode||!SV(i,e))&&(i.draggable||t&&typeof i.draggable>"u")).map(i=>{var o,a;return{id:i.id,position:i.position||{x:0,y:0},positionAbsolute:i.positionAbsolute||{x:0,y:0},distance:{x:n.x-(((o=i.positionAbsolute)==null?void 0:o.x)??0),y:n.y-(((a=i.positionAbsolute)==null?void 0:a.y)??0)},delta:{x:0,y:0},extent:i.extent,parentNode:i.parentNode,width:i.width,height:i.height}})}function i_e(e,t){return!t||t==="parent"?t:[t[0],[t[1][0]-(e.width||0),t[1][1]-(e.height||0)]]}function xV(e,t,n,r,i=[0,0],o){const a=i_e(e,e.extent||r);let s=a;if(e.extent==="parent")if(e.parentNode&&e.width&&e.height){const c=n.get(e.parentNode),{x:d,y:f}=mh(c,i).positionAbsolute;s=c&&ba(d)&&ba(f)&&ba(c.width)&&ba(c.height)?[[d+e.width*i[0],f+e.height*i[1]],[d+c.width-e.width+e.width*i[0],f+c.height-e.height+e.height*i[1]]]:s}else o==null||o("005",ql.error005()),s=a;else if(e.extent&&e.parentNode){const c=n.get(e.parentNode),{x:d,y:f}=mh(c,i).positionAbsolute;s=[[e.extent[0][0]+d,e.extent[0][1]+f],[e.extent[1][0]+d,e.extent[1][1]+f]]}let l={x:0,y:0};if(e.parentNode){const c=n.get(e.parentNode);l=mh(c,i).positionAbsolute}const u=s&&s!=="parent"?nA(t,s):t;return{position:{x:u.x-l.x,y:u.y-l.y},positionAbsolute:u}}function BC({nodeId:e,dragItems:t,nodeInternals:n}){const r=t.map(i=>({...n.get(i.id),position:i.position,positionAbsolute:i.positionAbsolute}));return[e?r.find(i=>i.id===e):r[0],r]}const E9=(e,t,n,r)=>{const i=t.querySelectorAll(e);if(!i||!i.length)return null;const o=Array.from(i),a=t.getBoundingClientRect(),s={x:a.width*r[0],y:a.height*r[1]};return o.map(l=>{const u=l.getBoundingClientRect();return{id:l.getAttribute("data-handleid"),position:l.getAttribute("data-handlepos"),x:(u.left-a.left-s.x)/n,y:(u.top-a.top-s.y)/n,...tA(l)}})};function Xp(e,t,n){return n===void 0?n:r=>{const i=t().nodeInternals.get(e);i&&n(r,{...i})}}function $E({id:e,store:t,unselect:n=!1,nodeRef:r}){const{addSelectedNodes:i,unselectNodesAndEdges:o,multiSelectionActive:a,nodeInternals:s,onError:l}=t.getState(),u=s.get(e);if(!u){l==null||l("012",ql.error012(e));return}t.setState({nodesSelectionActive:!1}),u.selected?(n||u.selected&&a)&&(o({nodes:[u]}),requestAnimationFrame(()=>{var c;return(c=r==null?void 0:r.current)==null?void 0:c.blur()})):i([e])}function o_e(){const e=hi();return I.useCallback(({sourceEvent:n})=>{const{transform:r,snapGrid:i,snapToGrid:o}=e.getState(),a=n.touches?n.touches[0].clientX:n.clientX,s=n.touches?n.touches[0].clientY:n.clientY,l={x:(a-r[0])/r[2],y:(s-r[1])/r[2]};return{xSnapped:o?i[0]*Math.round(l.x/i[0]):l.x,ySnapped:o?i[1]*Math.round(l.y/i[1]):l.y,...l}},[])}function zC(e){return(t,n,r)=>e==null?void 0:e(t,r)}function wV({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:r,nodeId:i,isSelectable:o,selectNodesOnDrag:a}){const s=hi(),[l,u]=I.useState(!1),c=I.useRef([]),d=I.useRef({x:null,y:null}),f=I.useRef(0),h=I.useRef(null),p=I.useRef({x:0,y:0}),m=I.useRef(null),_=I.useRef(!1),b=o_e();return I.useEffect(()=>{if(e!=null&&e.current){const v=Wa(e.current),g=({x:S,y:w})=>{const{nodeInternals:x,onNodeDrag:C,onSelectionDrag:T,updateNodePositions:k,nodeExtent:P,snapGrid:$,snapToGrid:O,nodeOrigin:E,onError:A}=s.getState();d.current={x:S,y:w};let D=!1,L={x:0,y:0,x2:0,y2:0};if(c.current.length>1&&P){const R=sA(c.current,E);L=h0(R)}if(c.current=c.current.map(R=>{const N={x:S-R.distance.x,y:w-R.distance.y};O&&(N.x=$[0]*Math.round(N.x/$[0]),N.y=$[1]*Math.round(N.y/$[1]));const B=[[P[0][0],P[0][1]],[P[1][0],P[1][1]]];c.current.length>1&&P&&!R.extent&&(B[0][0]=R.positionAbsolute.x-L.x+P[0][0],B[1][0]=R.positionAbsolute.x+(R.width??0)-L.x2+P[1][0],B[0][1]=R.positionAbsolute.y-L.y+P[0][1],B[1][1]=R.positionAbsolute.y+(R.height??0)-L.y2+P[1][1]);const U=xV(R,N,x,B,E,A);return D=D||R.position.x!==U.position.x||R.position.y!==U.position.y,R.position=U.position,R.positionAbsolute=U.positionAbsolute,R}),!D)return;k(c.current,!0,!0),u(!0);const M=i?C:zC(T);if(M&&m.current){const[R,N]=BC({nodeId:i,dragItems:c.current,nodeInternals:x});M(m.current,R,N)}},y=()=>{if(!h.current)return;const[S,w]=UU(p.current,h.current);if(S!==0||w!==0){const{transform:x,panBy:C}=s.getState();d.current.x=(d.current.x??0)-S/x[2],d.current.y=(d.current.y??0)-w/x[2],C({x:S,y:w})&&g(d.current)}f.current=requestAnimationFrame(y)};if(t)v.on(".drag",null);else{const S=pve().on("start",w=>{var D;const{nodeInternals:x,multiSelectionActive:C,domNode:T,nodesDraggable:k,unselectNodesAndEdges:P,onNodeDragStart:$,onSelectionDragStart:O}=s.getState(),E=i?$:zC(O);!a&&!C&&i&&((D=x.get(i))!=null&&D.selected||P()),i&&o&&a&&$E({id:i,store:s,nodeRef:e});const A=b(w);if(d.current=A,c.current=r_e(x,k,A,i),E&&c.current){const[L,M]=BC({nodeId:i,dragItems:c.current,nodeInternals:x});E(w.sourceEvent,L,M)}h.current=(T==null?void 0:T.getBoundingClientRect())||null,p.current=Qu(w.sourceEvent,h.current)}).on("drag",w=>{const x=b(w),{autoPanOnNodeDrag:C}=s.getState();!_.current&&C&&(_.current=!0,y()),(d.current.x!==x.xSnapped||d.current.y!==x.ySnapped)&&c.current&&(m.current=w.sourceEvent,p.current=Qu(w.sourceEvent,h.current),g(x))}).on("end",w=>{if(u(!1),_.current=!1,cancelAnimationFrame(f.current),c.current){const{updateNodePositions:x,nodeInternals:C,onNodeDragStop:T,onSelectionDragStop:k}=s.getState(),P=i?T:zC(k);if(x(c.current,!1,!1),P){const[$,O]=BC({nodeId:i,dragItems:c.current,nodeInternals:C});P(w.sourceEvent,$,O)}}}).filter(w=>{const x=w.target;return!w.button&&(!n||!C9(x,`.${n}`,e))&&(!r||C9(x,r,e))});return v.call(S),()=>{v.on(".drag",null)}}}},[e,t,n,r,o,s,i,a,b]),l}function CV(){const e=hi();return I.useCallback(n=>{const{nodeInternals:r,nodeExtent:i,updateNodePositions:o,getNodes:a,snapToGrid:s,snapGrid:l,onError:u,nodesDraggable:c}=e.getState(),d=a().filter(v=>v.selected&&(v.draggable||c&&typeof v.draggable>"u")),f=s?l[0]:5,h=s?l[1]:5,p=n.isShiftPressed?4:1,m=n.x*f*p,_=n.y*h*p,b=d.map(v=>{if(v.positionAbsolute){const g={x:v.positionAbsolute.x+m,y:v.positionAbsolute.y+_};s&&(g.x=l[0]*Math.round(g.x/l[0]),g.y=l[1]*Math.round(g.y/l[1]));const{positionAbsolute:y,position:S}=xV(v,g,r,i,void 0,u);v.position=S,v.positionAbsolute=y}return v});o(b,!0,!1)},[])}const yh={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};var Yp=e=>{const t=({id:n,type:r,data:i,xPos:o,yPos:a,xPosOrigin:s,yPosOrigin:l,selected:u,onClick:c,onMouseEnter:d,onMouseMove:f,onMouseLeave:h,onContextMenu:p,onDoubleClick:m,style:_,className:b,isDraggable:v,isSelectable:g,isConnectable:y,isFocusable:S,selectNodesOnDrag:w,sourcePosition:x,targetPosition:C,hidden:T,resizeObserver:k,dragHandle:P,zIndex:$,isParent:O,noDragClassName:E,noPanClassName:A,initialized:D,disableKeyboardA11y:L,ariaLabel:M,rfId:R})=>{const N=hi(),B=I.useRef(null),U=I.useRef(x),G=I.useRef(C),Y=I.useRef(r),ee=g||v||c||d||f||h,J=CV(),j=Xp(n,N.getState,d),Q=Xp(n,N.getState,f),ne=Xp(n,N.getState,h),se=Xp(n,N.getState,p),ve=Xp(n,N.getState,m),ce=ze=>{if(g&&(!w||!v)&&$E({id:n,store:N,nodeRef:B}),c){const gt=N.getState().nodeInternals.get(n);gt&&c(ze,{...gt})}},bt=ze=>{if(!RE(ze))if(qU.includes(ze.key)&&g){const gt=ze.key==="Escape";$E({id:n,store:N,unselect:gt,nodeRef:B})}else!L&&v&&u&&Object.prototype.hasOwnProperty.call(yh,ze.key)&&(N.setState({ariaLiveMessage:`Moved selected node ${ze.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~o}, y: ${~~a}`}),J({x:yh[ze.key].x,y:yh[ze.key].y,isShiftPressed:ze.shiftKey}))};I.useEffect(()=>{if(B.current&&!T){const ze=B.current;return k==null||k.observe(ze),()=>k==null?void 0:k.unobserve(ze)}},[T]),I.useEffect(()=>{const ze=Y.current!==r,gt=U.current!==x,Pe=G.current!==C;B.current&&(ze||gt||Pe)&&(ze&&(Y.current=r),gt&&(U.current=x),Pe&&(G.current=C),N.getState().updateNodeDimensions([{id:n,nodeElement:B.current,forceUpdate:!0}]))},[n,r,x,C]);const ot=wV({nodeRef:B,disabled:T||!v,noDragClassName:E,handleSelector:P,nodeId:n,isSelectable:g,selectNodesOnDrag:w});return T?null:W.jsx("div",{className:Ta(["react-flow__node",`react-flow__node-${r}`,{[A]:v},b,{selected:u,selectable:g,parent:O,dragging:ot}]),ref:B,style:{zIndex:$,transform:`translate(${s}px,${l}px)`,pointerEvents:ee?"all":"none",visibility:D?"visible":"hidden",..._},"data-id":n,"data-testid":`rf__node-${n}`,onMouseEnter:j,onMouseMove:Q,onMouseLeave:ne,onContextMenu:se,onClick:ce,onDoubleClick:ve,onKeyDown:S?bt:void 0,tabIndex:S?0:void 0,role:S?"button":void 0,"aria-describedby":L?void 0:`${hV}-${R}`,"aria-label":M,children:W.jsx(vbe,{value:n,children:W.jsx(e,{id:n,data:i,type:r,xPos:o,yPos:a,selected:u,isConnectable:y,sourcePosition:x,targetPosition:C,dragging:ot,dragHandle:P,zIndex:$})})})};return t.displayName="NodeWrapper",I.memo(t)};const a_e=e=>{const t=e.getNodes().filter(n=>n.selected);return{...sA(t,e.nodeOrigin),transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`,userSelectionActive:e.userSelectionActive}};function s_e({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const r=hi(),{width:i,height:o,x:a,y:s,transformString:l,userSelectionActive:u}=br(a_e,Ro),c=CV(),d=I.useRef(null);if(I.useEffect(()=>{var p;n||(p=d.current)==null||p.focus({preventScroll:!0})},[n]),wV({nodeRef:d}),u||!i||!o)return null;const f=e?p=>{const m=r.getState().getNodes().filter(_=>_.selected);e(p,m)}:void 0,h=p=>{Object.prototype.hasOwnProperty.call(yh,p.key)&&c({x:yh[p.key].x,y:yh[p.key].y,isShiftPressed:p.shiftKey})};return W.jsx("div",{className:Ta(["react-flow__nodesselection","react-flow__container",t]),style:{transform:l},children:W.jsx("div",{ref:d,className:"react-flow__nodesselection-rect",onContextMenu:f,tabIndex:n?void 0:-1,onKeyDown:n?void 0:h,style:{width:i,height:o,top:s,left:a}})})}var l_e=I.memo(s_e);const u_e=e=>e.nodesSelectionActive,EV=({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:i,onPaneContextMenu:o,onPaneScroll:a,deleteKeyCode:s,onMove:l,onMoveStart:u,onMoveEnd:c,selectionKeyCode:d,selectionOnDrag:f,selectionMode:h,onSelectionStart:p,onSelectionEnd:m,multiSelectionKeyCode:_,panActivationKeyCode:b,zoomActivationKeyCode:v,elementsSelectable:g,zoomOnScroll:y,zoomOnPinch:S,panOnScroll:w,panOnScrollSpeed:x,panOnScrollMode:C,zoomOnDoubleClick:T,panOnDrag:k,defaultViewport:P,translateExtent:$,minZoom:O,maxZoom:E,preventScrolling:A,onSelectionContextMenu:D,noWheelClassName:L,noPanClassName:M,disableKeyboardA11y:R})=>{const N=br(u_e),B=p0(d),G=p0(b)||k,Y=B||f&&G!==!0;return Qbe({deleteKeyCode:s,multiSelectionKeyCode:_}),W.jsx(Jbe,{onMove:l,onMoveStart:u,onMoveEnd:c,onPaneContextMenu:o,elementsSelectable:g,zoomOnScroll:y,zoomOnPinch:S,panOnScroll:w,panOnScrollSpeed:x,panOnScrollMode:C,zoomOnDoubleClick:T,panOnDrag:!B&&G,defaultViewport:P,translateExtent:$,minZoom:O,maxZoom:E,zoomActivationKeyCode:v,preventScrolling:A,noWheelClassName:L,noPanClassName:M,children:W.jsxs(_V,{onSelectionStart:p,onSelectionEnd:m,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:i,onPaneContextMenu:o,onPaneScroll:a,panOnDrag:G,isSelecting:!!Y,selectionMode:h,children:[e,N&&W.jsx(l_e,{onSelectionContextMenu:D,noPanClassName:M,disableKeyboardA11y:R})]})})};EV.displayName="FlowRenderer";var c_e=I.memo(EV);function d_e(e){return br(I.useCallback(n=>e?tV(n.nodeInternals,{x:0,y:0,width:n.width,height:n.height},n.transform,!0):n.getNodes(),[e]))}function f_e(e){const t={input:Yp(e.input||uV),default:Yp(e.default||NE),output:Yp(e.output||dV),group:Yp(e.group||cA)},n={},r=Object.keys(e).filter(i=>!["input","default","output","group"].includes(i)).reduce((i,o)=>(i[o]=Yp(e[o]||NE),i),n);return{...t,...r}}const h_e=({x:e,y:t,width:n,height:r,origin:i})=>!n||!r?{x:e,y:t}:i[0]<0||i[1]<0||i[0]>1||i[1]>1?{x:e,y:t}:{x:e-n*i[0],y:t-r*i[1]},p_e=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,updateNodeDimensions:e.updateNodeDimensions,onError:e.onError}),kV=e=>{const{nodesDraggable:t,nodesConnectable:n,nodesFocusable:r,elementsSelectable:i,updateNodeDimensions:o,onError:a}=br(p_e,Ro),s=d_e(e.onlyRenderVisibleElements),l=I.useRef(),u=I.useMemo(()=>{if(typeof ResizeObserver>"u")return null;const c=new ResizeObserver(d=>{const f=d.map(h=>({id:h.target.getAttribute("data-id"),nodeElement:h.target,forceUpdate:!0}));o(f)});return l.current=c,c},[]);return I.useEffect(()=>()=>{var c;(c=l==null?void 0:l.current)==null||c.disconnect()},[]),W.jsx("div",{className:"react-flow__nodes",style:dA,children:s.map(c=>{var S,w;let d=c.type||"default";e.nodeTypes[d]||(a==null||a("003",ql.error003(d)),d="default");const f=e.nodeTypes[d]||e.nodeTypes.default,h=!!(c.draggable||t&&typeof c.draggable>"u"),p=!!(c.selectable||i&&typeof c.selectable>"u"),m=!!(c.connectable||n&&typeof c.connectable>"u"),_=!!(c.focusable||r&&typeof c.focusable>"u"),b=e.nodeExtent?nA(c.positionAbsolute,e.nodeExtent):c.positionAbsolute,v=(b==null?void 0:b.x)??0,g=(b==null?void 0:b.y)??0,y=h_e({x:v,y:g,width:c.width??0,height:c.height??0,origin:e.nodeOrigin});return W.jsx(f,{id:c.id,className:c.className,style:c.style,type:d,data:c.data,sourcePosition:c.sourcePosition||tt.Bottom,targetPosition:c.targetPosition||tt.Top,hidden:c.hidden,xPos:v,yPos:g,xPosOrigin:y.x,yPosOrigin:y.y,selectNodesOnDrag:e.selectNodesOnDrag,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,selected:!!c.selected,isDraggable:h,isSelectable:p,isConnectable:m,isFocusable:_,resizeObserver:u,dragHandle:c.dragHandle,zIndex:((S=c[Kr])==null?void 0:S.z)??0,isParent:!!((w=c[Kr])!=null&&w.isParent),noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,initialized:!!c.width&&!!c.height,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,ariaLabel:c.ariaLabel},c.id)})})};kV.displayName="NodeRenderer";var g_e=I.memo(kV);const m_e=(e,t,n)=>n===tt.Left?e-t:n===tt.Right?e+t:e,y_e=(e,t,n)=>n===tt.Top?e-t:n===tt.Bottom?e+t:e,k9="react-flow__edgeupdater",T9=({position:e,centerX:t,centerY:n,radius:r=10,onMouseDown:i,onMouseEnter:o,onMouseOut:a,type:s})=>W.jsx("circle",{onMouseDown:i,onMouseEnter:o,onMouseOut:a,className:Ta([k9,`${k9}-${s}`]),cx:m_e(t,r,e),cy:y_e(n,r,e),r,stroke:"transparent",fill:"transparent"}),v_e=()=>!0;var gf=e=>{const t=({id:n,className:r,type:i,data:o,onClick:a,onEdgeDoubleClick:s,selected:l,animated:u,label:c,labelStyle:d,labelShowBg:f,labelBgStyle:h,labelBgPadding:p,labelBgBorderRadius:m,style:_,source:b,target:v,sourceX:g,sourceY:y,targetX:S,targetY:w,sourcePosition:x,targetPosition:C,elementsSelectable:T,hidden:k,sourceHandleId:P,targetHandleId:$,onContextMenu:O,onMouseEnter:E,onMouseMove:A,onMouseLeave:D,edgeUpdaterRadius:L,onEdgeUpdate:M,onEdgeUpdateStart:R,onEdgeUpdateEnd:N,markerEnd:B,markerStart:U,rfId:G,ariaLabel:Y,isFocusable:ee,isUpdatable:J,pathOptions:j,interactionWidth:Q})=>{const ne=I.useRef(null),[se,ve]=I.useState(!1),[ce,bt]=I.useState(!1),ot=hi(),ze=I.useMemo(()=>`url(#${ME(U,G)})`,[U,G]),gt=I.useMemo(()=>`url(#${ME(B,G)})`,[B,G]);if(k)return null;const Pe=Fn=>{const{edges:bn,addSelectedEdges:Mi}=ot.getState();if(T&&(ot.setState({nodesSelectionActive:!1}),Mi([n])),a){const pi=bn.find(Qi=>Qi.id===n);a(Fn,pi)}},Jt=Qp(n,ot.getState,s),Ar=Qp(n,ot.getState,O),Dn=Qp(n,ot.getState,E),Tn=Qp(n,ot.getState,A),en=Qp(n,ot.getState,D),Ln=(Fn,bn)=>{if(Fn.button!==0)return;const{edges:Mi,isValidConnection:pi}=ot.getState(),Qi=bn?v:b,$a=(bn?$:P)||null,Ir=bn?"target":"source",fo=pi||v_e,ol=bn,$o=Mi.find(tn=>tn.id===n);bt(!0),R==null||R(Fn,$o,Ir);const al=tn=>{bt(!1),N==null||N(tn,$o,Ir)};oV({event:Fn,handleId:$a,nodeId:Qi,onConnect:tn=>M==null?void 0:M($o,tn),isTarget:ol,getState:ot.getState,setState:ot.setState,isValidConnection:fo,edgeUpdaterType:Ir,onEdgeUpdateEnd:al})},Pr=Fn=>Ln(Fn,!0),co=Fn=>Ln(Fn,!1),Jr=()=>ve(!0),hr=()=>ve(!1),Fr=!T&&!a,ei=Fn=>{var bn;if(qU.includes(Fn.key)&&T){const{unselectNodesAndEdges:Mi,addSelectedEdges:pi,edges:Qi}=ot.getState();Fn.key==="Escape"?((bn=ne.current)==null||bn.blur(),Mi({edges:[Qi.find(Ir=>Ir.id===n)]})):pi([n])}};return W.jsxs("g",{className:Ta(["react-flow__edge",`react-flow__edge-${i}`,r,{selected:l,animated:u,inactive:Fr,updating:se}]),onClick:Pe,onDoubleClick:Jt,onContextMenu:Ar,onMouseEnter:Dn,onMouseMove:Tn,onMouseLeave:en,onKeyDown:ee?ei:void 0,tabIndex:ee?0:void 0,role:ee?"button":"img","data-testid":`rf__edge-${n}`,"aria-label":Y===null?void 0:Y||`Edge from ${b} to ${v}`,"aria-describedby":ee?`${pV}-${G}`:void 0,ref:ne,children:[!ce&&W.jsx(e,{id:n,source:b,target:v,selected:l,animated:u,label:c,labelStyle:d,labelShowBg:f,labelBgStyle:h,labelBgPadding:p,labelBgBorderRadius:m,data:o,style:_,sourceX:g,sourceY:y,targetX:S,targetY:w,sourcePosition:x,targetPosition:C,sourceHandleId:P,targetHandleId:$,markerStart:ze,markerEnd:gt,pathOptions:j,interactionWidth:Q}),J&&W.jsxs(W.Fragment,{children:[(J==="source"||J===!0)&&W.jsx(T9,{position:x,centerX:g,centerY:y,radius:L,onMouseDown:Pr,onMouseEnter:Jr,onMouseOut:hr,type:"source"}),(J==="target"||J===!0)&&W.jsx(T9,{position:C,centerX:S,centerY:w,radius:L,onMouseDown:co,onMouseEnter:Jr,onMouseOut:hr,type:"target"})]})]})};return t.displayName="EdgeWrapper",I.memo(t)};function b_e(e){const t={default:gf(e.default||O_),straight:gf(e.bezier||oA),step:gf(e.step||iA),smoothstep:gf(e.step||Q2),simplebezier:gf(e.simplebezier||rA)},n={},r=Object.keys(e).filter(i=>!["default","bezier"].includes(i)).reduce((i,o)=>(i[o]=gf(e[o]||O_),i),n);return{...t,...r}}function A9(e,t,n=null){const r=((n==null?void 0:n.x)||0)+t.x,i=((n==null?void 0:n.y)||0)+t.y,o=(n==null?void 0:n.width)||t.width,a=(n==null?void 0:n.height)||t.height;switch(e){case tt.Top:return{x:r+o/2,y:i};case tt.Right:return{x:r+o,y:i+a/2};case tt.Bottom:return{x:r+o/2,y:i+a};case tt.Left:return{x:r,y:i+a/2}}}function P9(e,t){return e?e.length===1||!t?e[0]:t&&e.find(n=>n.id===t)||null:null}const __e=(e,t,n,r,i,o)=>{const a=A9(n,e,t),s=A9(o,r,i);return{sourceX:a.x,sourceY:a.y,targetX:s.x,targetY:s.y}};function S_e({sourcePos:e,targetPos:t,sourceWidth:n,sourceHeight:r,targetWidth:i,targetHeight:o,width:a,height:s,transform:l}){const u={x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x+n,t.x+i),y2:Math.max(e.y+r,t.y+o)};u.x===u.x2&&(u.x2+=1),u.y===u.y2&&(u.y2+=1);const c=h0({x:(0-l[0])/l[2],y:(0-l[1])/l[2],width:a/l[2],height:s/l[2]}),d=Math.max(0,Math.min(c.x2,u.x2)-Math.max(c.x,u.x)),f=Math.max(0,Math.min(c.y2,u.y2)-Math.max(c.y,u.y));return Math.ceil(d*f)>0}function I9(e){var r,i,o,a,s;const t=((r=e==null?void 0:e[Kr])==null?void 0:r.handleBounds)||null,n=t&&(e==null?void 0:e.width)&&(e==null?void 0:e.height)&&typeof((i=e==null?void 0:e.positionAbsolute)==null?void 0:i.x)<"u"&&typeof((o=e==null?void 0:e.positionAbsolute)==null?void 0:o.y)<"u";return[{x:((a=e==null?void 0:e.positionAbsolute)==null?void 0:a.x)||0,y:((s=e==null?void 0:e.positionAbsolute)==null?void 0:s.y)||0,width:(e==null?void 0:e.width)||0,height:(e==null?void 0:e.height)||0},t,!!n]}const x_e=[{level:0,isMaxLevel:!0,edges:[]}];function w_e(e,t,n=!1){let r=-1;const i=e.reduce((a,s)=>{var c,d;const l=ba(s.zIndex);let u=l?s.zIndex:0;if(n){const f=t.get(s.target),h=t.get(s.source),p=s.selected||(f==null?void 0:f.selected)||(h==null?void 0:h.selected),m=Math.max(((c=h==null?void 0:h[Kr])==null?void 0:c.z)||0,((d=f==null?void 0:f[Kr])==null?void 0:d.z)||0,1e3);u=(l?s.zIndex:0)+(p?m:0)}return a[u]?a[u].push(s):a[u]=[s],r=u>r?u:r,a},{}),o=Object.entries(i).map(([a,s])=>{const l=+a;return{edges:s,level:l,isMaxLevel:l===r}});return o.length===0?x_e:o}function C_e(e,t,n){const r=br(I.useCallback(i=>e?i.edges.filter(o=>{const a=t.get(o.source),s=t.get(o.target);return(a==null?void 0:a.width)&&(a==null?void 0:a.height)&&(s==null?void 0:s.width)&&(s==null?void 0:s.height)&&S_e({sourcePos:a.positionAbsolute||{x:0,y:0},targetPos:s.positionAbsolute||{x:0,y:0},sourceWidth:a.width,sourceHeight:a.height,targetWidth:s.width,targetHeight:s.height,width:i.width,height:i.height,transform:i.transform})}):i.edges,[e,t]));return w_e(r,t,n)}const E_e=({color:e="none",strokeWidth:t=1})=>W.jsx("polyline",{stroke:e,strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:t,fill:"none",points:"-5,-4 0,0 -5,4"}),k_e=({color:e="none",strokeWidth:t=1})=>W.jsx("polyline",{stroke:e,strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:t,fill:e,points:"-5,-4 0,0 -5,4 -5,-4"}),R9={[R_.Arrow]:E_e,[R_.ArrowClosed]:k_e};function T_e(e){const t=hi();return I.useMemo(()=>{var i,o;return Object.prototype.hasOwnProperty.call(R9,e)?R9[e]:((o=(i=t.getState()).onError)==null||o.call(i,"009",ql.error009(e)),null)},[e])}const A_e=({id:e,type:t,color:n,width:r=12.5,height:i=12.5,markerUnits:o="strokeWidth",strokeWidth:a,orient:s="auto-start-reverse"})=>{const l=T_e(t);return l?W.jsx("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${r}`,markerHeight:`${i}`,viewBox:"-10 -10 20 20",markerUnits:o,orient:s,refX:"0",refY:"0",children:W.jsx(l,{color:n,strokeWidth:a})}):null},P_e=({defaultColor:e,rfId:t})=>n=>{const r=[];return n.edges.reduce((i,o)=>([o.markerStart,o.markerEnd].forEach(a=>{if(a&&typeof a=="object"){const s=ME(a,t);r.includes(s)||(i.push({id:s,color:a.color||e,...a}),r.push(s))}}),i),[]).sort((i,o)=>i.id.localeCompare(o.id))},TV=({defaultColor:e,rfId:t})=>{const n=br(I.useCallback(P_e({defaultColor:e,rfId:t}),[e,t]),(r,i)=>!(r.length!==i.length||r.some((o,a)=>o.id!==i[a].id)));return W.jsx("defs",{children:n.map(r=>W.jsx(A_e,{id:r.id,type:r.type,color:r.color,width:r.width,height:r.height,markerUnits:r.markerUnits,strokeWidth:r.strokeWidth,orient:r.orient},r.id))})};TV.displayName="MarkerDefinitions";var I_e=I.memo(TV);const R_e=e=>({nodesConnectable:e.nodesConnectable,edgesFocusable:e.edgesFocusable,edgesUpdatable:e.edgesUpdatable,elementsSelectable:e.elementsSelectable,width:e.width,height:e.height,connectionMode:e.connectionMode,nodeInternals:e.nodeInternals,onError:e.onError}),AV=({defaultMarkerColor:e,onlyRenderVisibleElements:t,elevateEdgesOnSelect:n,rfId:r,edgeTypes:i,noPanClassName:o,onEdgeUpdate:a,onEdgeContextMenu:s,onEdgeMouseEnter:l,onEdgeMouseMove:u,onEdgeMouseLeave:c,onEdgeClick:d,edgeUpdaterRadius:f,onEdgeDoubleClick:h,onEdgeUpdateStart:p,onEdgeUpdateEnd:m,children:_})=>{const{edgesFocusable:b,edgesUpdatable:v,elementsSelectable:g,width:y,height:S,connectionMode:w,nodeInternals:x,onError:C}=br(R_e,Ro),T=C_e(t,x,n);return y?W.jsxs(W.Fragment,{children:[T.map(({level:k,edges:P,isMaxLevel:$})=>W.jsxs("svg",{style:{zIndex:k},width:y,height:S,className:"react-flow__edges react-flow__container",children:[$&&W.jsx(I_e,{defaultColor:e,rfId:r}),W.jsx("g",{children:P.map(O=>{const[E,A,D]=I9(x.get(O.source)),[L,M,R]=I9(x.get(O.target));if(!D||!R)return null;let N=O.type||"default";i[N]||(C==null||C("011",ql.error011(N)),N="default");const B=i[N]||i.default,U=w===Nd.Strict?M.target:(M.target??[]).concat(M.source??[]),G=P9(A.source,O.sourceHandle),Y=P9(U,O.targetHandle),ee=(G==null?void 0:G.position)||tt.Bottom,J=(Y==null?void 0:Y.position)||tt.Top,j=!!(O.focusable||b&&typeof O.focusable>"u"),Q=typeof a<"u"&&(O.updatable||v&&typeof O.updatable>"u");if(!G||!Y)return C==null||C("008",ql.error008(G,O)),null;const{sourceX:ne,sourceY:se,targetX:ve,targetY:ce}=__e(E,G,ee,L,Y,J);return W.jsx(B,{id:O.id,className:Ta([O.className,o]),type:N,data:O.data,selected:!!O.selected,animated:!!O.animated,hidden:!!O.hidden,label:O.label,labelStyle:O.labelStyle,labelShowBg:O.labelShowBg,labelBgStyle:O.labelBgStyle,labelBgPadding:O.labelBgPadding,labelBgBorderRadius:O.labelBgBorderRadius,style:O.style,source:O.source,target:O.target,sourceHandleId:O.sourceHandle,targetHandleId:O.targetHandle,markerEnd:O.markerEnd,markerStart:O.markerStart,sourceX:ne,sourceY:se,targetX:ve,targetY:ce,sourcePosition:ee,targetPosition:J,elementsSelectable:g,onEdgeUpdate:a,onContextMenu:s,onMouseEnter:l,onMouseMove:u,onMouseLeave:c,onClick:d,edgeUpdaterRadius:f,onEdgeDoubleClick:h,onEdgeUpdateStart:p,onEdgeUpdateEnd:m,rfId:r,ariaLabel:O.ariaLabel,isFocusable:j,isUpdatable:Q,pathOptions:"pathOptions"in O?O.pathOptions:void 0,interactionWidth:O.interactionWidth},O.id)})})]},k)),_]}):null};AV.displayName="EdgeRenderer";var O_e=I.memo(AV);const M_e=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function N_e({children:e}){const t=br(M_e);return W.jsx("div",{className:"react-flow__viewport react-flow__container",style:{transform:t},children:e})}function $_e(e){const t=vV(),n=I.useRef(!1);I.useEffect(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}const D_e={[tt.Left]:tt.Right,[tt.Right]:tt.Left,[tt.Top]:tt.Bottom,[tt.Bottom]:tt.Top},PV=({nodeId:e,handleType:t,style:n,type:r=Eu.Bezier,CustomComponent:i,connectionStatus:o})=>{var w,x,C;const{fromNode:a,handleId:s,toX:l,toY:u,connectionMode:c}=br(I.useCallback(T=>({fromNode:T.nodeInternals.get(e),handleId:T.connectionHandleId,toX:(T.connectionPosition.x-T.transform[0])/T.transform[2],toY:(T.connectionPosition.y-T.transform[1])/T.transform[2],connectionMode:T.connectionMode}),[e]),Ro),d=(w=a==null?void 0:a[Kr])==null?void 0:w.handleBounds;let f=d==null?void 0:d[t];if(c===Nd.Loose&&(f=f||(d==null?void 0:d[t==="source"?"target":"source"])),!a||!f)return null;const h=s?f.find(T=>T.id===s):f[0],p=h?h.x+h.width/2:(a.width??0)/2,m=h?h.y+h.height/2:a.height??0,_=(((x=a.positionAbsolute)==null?void 0:x.x)??0)+p,b=(((C=a.positionAbsolute)==null?void 0:C.y)??0)+m,v=h==null?void 0:h.position,g=v?D_e[v]:null;if(!v||!g)return null;if(i)return W.jsx(i,{connectionLineType:r,connectionLineStyle:n,fromNode:a,fromHandle:h,fromX:_,fromY:b,toX:l,toY:u,fromPosition:v,toPosition:g,connectionStatus:o});let y="";const S={sourceX:_,sourceY:b,sourcePosition:v,targetX:l,targetY:u,targetPosition:g};return r===Eu.Bezier?[y]=YU(S):r===Eu.Step?[y]=OE({...S,borderRadius:0}):r===Eu.SmoothStep?[y]=OE(S):r===Eu.SimpleBezier?[y]=XU(S):y=`M${_},${b} ${l},${u}`,W.jsx("path",{d:y,fill:"none",className:"react-flow__connection-path",style:n})};PV.displayName="ConnectionLine";const L_e=e=>({nodeId:e.connectionNodeId,handleType:e.connectionHandleType,nodesConnectable:e.nodesConnectable,connectionStatus:e.connectionStatus,width:e.width,height:e.height});function F_e({containerStyle:e,style:t,type:n,component:r}){const{nodeId:i,handleType:o,nodesConnectable:a,width:s,height:l,connectionStatus:u}=br(L_e,Ro);return!(i&&o&&s&&a)?null:W.jsx("svg",{style:e,width:s,height:l,className:"react-flow__edges react-flow__connectionline react-flow__container",children:W.jsx("g",{className:Ta(["react-flow__connection",u]),children:W.jsx(PV,{nodeId:i,handleType:o,style:t,type:n,CustomComponent:r,connectionStatus:u})})})}function O9(e,t){return I.useRef(null),hi(),I.useMemo(()=>t(e),[e])}const IV=({nodeTypes:e,edgeTypes:t,onMove:n,onMoveStart:r,onMoveEnd:i,onInit:o,onNodeClick:a,onEdgeClick:s,onNodeDoubleClick:l,onEdgeDoubleClick:u,onNodeMouseEnter:c,onNodeMouseMove:d,onNodeMouseLeave:f,onNodeContextMenu:h,onSelectionContextMenu:p,onSelectionStart:m,onSelectionEnd:_,connectionLineType:b,connectionLineStyle:v,connectionLineComponent:g,connectionLineContainerStyle:y,selectionKeyCode:S,selectionOnDrag:w,selectionMode:x,multiSelectionKeyCode:C,panActivationKeyCode:T,zoomActivationKeyCode:k,deleteKeyCode:P,onlyRenderVisibleElements:$,elementsSelectable:O,selectNodesOnDrag:E,defaultViewport:A,translateExtent:D,minZoom:L,maxZoom:M,preventScrolling:R,defaultMarkerColor:N,zoomOnScroll:B,zoomOnPinch:U,panOnScroll:G,panOnScrollSpeed:Y,panOnScrollMode:ee,zoomOnDoubleClick:J,panOnDrag:j,onPaneClick:Q,onPaneMouseEnter:ne,onPaneMouseMove:se,onPaneMouseLeave:ve,onPaneScroll:ce,onPaneContextMenu:bt,onEdgeUpdate:ot,onEdgeContextMenu:ze,onEdgeMouseEnter:gt,onEdgeMouseMove:Pe,onEdgeMouseLeave:Jt,edgeUpdaterRadius:Ar,onEdgeUpdateStart:Dn,onEdgeUpdateEnd:Tn,noDragClassName:en,noWheelClassName:Ln,noPanClassName:Pr,elevateEdgesOnSelect:co,disableKeyboardA11y:Jr,nodeOrigin:hr,nodeExtent:Fr,rfId:ei})=>{const Fn=O9(e,f_e),bn=O9(t,b_e);return $_e(o),W.jsx(c_e,{onPaneClick:Q,onPaneMouseEnter:ne,onPaneMouseMove:se,onPaneMouseLeave:ve,onPaneContextMenu:bt,onPaneScroll:ce,deleteKeyCode:P,selectionKeyCode:S,selectionOnDrag:w,selectionMode:x,onSelectionStart:m,onSelectionEnd:_,multiSelectionKeyCode:C,panActivationKeyCode:T,zoomActivationKeyCode:k,elementsSelectable:O,onMove:n,onMoveStart:r,onMoveEnd:i,zoomOnScroll:B,zoomOnPinch:U,zoomOnDoubleClick:J,panOnScroll:G,panOnScrollSpeed:Y,panOnScrollMode:ee,panOnDrag:j,defaultViewport:A,translateExtent:D,minZoom:L,maxZoom:M,onSelectionContextMenu:p,preventScrolling:R,noDragClassName:en,noWheelClassName:Ln,noPanClassName:Pr,disableKeyboardA11y:Jr,children:W.jsxs(N_e,{children:[W.jsx(O_e,{edgeTypes:bn,onEdgeClick:s,onEdgeDoubleClick:u,onEdgeUpdate:ot,onlyRenderVisibleElements:$,onEdgeContextMenu:ze,onEdgeMouseEnter:gt,onEdgeMouseMove:Pe,onEdgeMouseLeave:Jt,onEdgeUpdateStart:Dn,onEdgeUpdateEnd:Tn,edgeUpdaterRadius:Ar,defaultMarkerColor:N,noPanClassName:Pr,elevateEdgesOnSelect:!!co,disableKeyboardA11y:Jr,rfId:ei,children:W.jsx(F_e,{style:v,type:b,component:g,containerStyle:y})}),W.jsx("div",{className:"react-flow__edgelabel-renderer"}),W.jsx(g_e,{nodeTypes:Fn,onNodeClick:a,onNodeDoubleClick:l,onNodeMouseEnter:c,onNodeMouseMove:d,onNodeMouseLeave:f,onNodeContextMenu:h,selectNodesOnDrag:E,onlyRenderVisibleElements:$,noPanClassName:Pr,noDragClassName:en,disableKeyboardA11y:Jr,nodeOrigin:hr,nodeExtent:Fr,rfId:ei})]})})};IV.displayName="GraphView";var B_e=I.memo(IV);const DE=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],lu={rfId:"1",width:0,height:0,transform:[0,0,1],nodeInternals:new Map,edges:[],onNodesChange:null,onEdgesChange:null,hasDefaultNodes:!1,hasDefaultEdges:!1,d3Zoom:null,d3Selection:null,d3ZoomHandler:void 0,minZoom:.5,maxZoom:2,translateExtent:DE,nodeExtent:DE,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionNodeId:null,connectionHandleId:null,connectionHandleType:"source",connectionPosition:{x:0,y:0},connectionStatus:null,connectionMode:Nd.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:[0,0],snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesUpdatable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,fitViewOnInit:!1,fitViewOnInitDone:!1,fitViewOnInitOptions:void 0,multiSelectionActive:!1,connectionStartHandle:null,connectionEndHandle:null,connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,connectionRadius:20,onError:fbe,isValidConnection:void 0},z_e=()=>k0e((e,t)=>({...lu,setNodes:n=>{const{nodeInternals:r,nodeOrigin:i,elevateNodesOnSelect:o}=t();e({nodeInternals:LC(n,r,i,o)})},getNodes:()=>Array.from(t().nodeInternals.values()),setEdges:n=>{const{defaultEdgeOptions:r={}}=t();e({edges:n.map(i=>({...r,...i}))})},setDefaultNodesAndEdges:(n,r)=>{const i=typeof n<"u",o=typeof r<"u",a=i?LC(n,new Map,t().nodeOrigin,t().elevateNodesOnSelect):new Map;e({nodeInternals:a,edges:o?r:[],hasDefaultNodes:i,hasDefaultEdges:o})},updateNodeDimensions:n=>{const{onNodesChange:r,nodeInternals:i,fitViewOnInit:o,fitViewOnInitDone:a,fitViewOnInitOptions:s,domNode:l,nodeOrigin:u}=t(),c=l==null?void 0:l.querySelector(".react-flow__viewport");if(!c)return;const d=window.getComputedStyle(c),{m22:f}=new window.DOMMatrixReadOnly(d.transform),h=n.reduce((m,_)=>{const b=i.get(_.id);if(b){const v=tA(_.nodeElement);!!(v.width&&v.height&&(b.width!==v.width||b.height!==v.height||_.forceUpdate))&&(i.set(b.id,{...b,[Kr]:{...b[Kr],handleBounds:{source:E9(".source",_.nodeElement,f,u),target:E9(".target",_.nodeElement,f,u)}},...v}),m.push({id:b.id,type:"dimensions",dimensions:v}))}return m},[]);mV(i,u);const p=a||o&&!a&&yV(t,{initial:!0,...s});e({nodeInternals:new Map(i),fitViewOnInitDone:p}),(h==null?void 0:h.length)>0&&(r==null||r(h))},updateNodePositions:(n,r=!0,i=!1)=>{const{triggerNodeChanges:o}=t(),a=n.map(s=>{const l={id:s.id,type:"position",dragging:i};return r&&(l.positionAbsolute=s.positionAbsolute,l.position=s.position),l});o(a)},triggerNodeChanges:n=>{const{onNodesChange:r,nodeInternals:i,hasDefaultNodes:o,nodeOrigin:a,getNodes:s,elevateNodesOnSelect:l}=t();if(n!=null&&n.length){if(o){const u=Uc(n,s()),c=LC(u,i,a,l);e({nodeInternals:c})}r==null||r(n)}},addSelectedNodes:n=>{const{multiSelectionActive:r,edges:i,getNodes:o}=t();let a,s=null;r?a=n.map(l=>yu(l,!0)):(a=zf(o(),n),s=zf(i,[])),Nv({changedNodes:a,changedEdges:s,get:t,set:e})},addSelectedEdges:n=>{const{multiSelectionActive:r,edges:i,getNodes:o}=t();let a,s=null;r?a=n.map(l=>yu(l,!0)):(a=zf(i,n),s=zf(o(),[])),Nv({changedNodes:s,changedEdges:a,get:t,set:e})},unselectNodesAndEdges:({nodes:n,edges:r}={})=>{const{edges:i,getNodes:o}=t(),a=n||o(),s=r||i,l=a.map(c=>(c.selected=!1,yu(c.id,!1))),u=s.map(c=>yu(c.id,!1));Nv({changedNodes:l,changedEdges:u,get:t,set:e})},setMinZoom:n=>{const{d3Zoom:r,maxZoom:i}=t();r==null||r.scaleExtent([n,i]),e({minZoom:n})},setMaxZoom:n=>{const{d3Zoom:r,minZoom:i}=t();r==null||r.scaleExtent([i,n]),e({maxZoom:n})},setTranslateExtent:n=>{var r;(r=t().d3Zoom)==null||r.translateExtent(n),e({translateExtent:n})},resetSelectedElements:()=>{const{edges:n,getNodes:r}=t(),o=r().filter(s=>s.selected).map(s=>yu(s.id,!1)),a=n.filter(s=>s.selected).map(s=>yu(s.id,!1));Nv({changedNodes:o,changedEdges:a,get:t,set:e})},setNodeExtent:n=>{const{nodeInternals:r}=t();r.forEach(i=>{i.positionAbsolute=nA(i.position,n)}),e({nodeExtent:n,nodeInternals:new Map(r)})},panBy:n=>{const{transform:r,width:i,height:o,d3Zoom:a,d3Selection:s,translateExtent:l}=t();if(!a||!s||!n.x&&!n.y)return!1;const u=Ku.translate(r[0]+n.x,r[1]+n.y).scale(r[2]),c=[[0,0],[i,o]],d=a==null?void 0:a.constrain()(u,c,l);return a.transform(s,d),r[0]!==d.x||r[1]!==d.y||r[2]!==d.k},cancelConnection:()=>e({connectionNodeId:lu.connectionNodeId,connectionHandleId:lu.connectionHandleId,connectionHandleType:lu.connectionHandleType,connectionStatus:lu.connectionStatus,connectionStartHandle:lu.connectionStartHandle,connectionEndHandle:lu.connectionEndHandle}),reset:()=>e({...lu})}),Object.is),RV=({children:e})=>{const t=I.useRef(null);return t.current||(t.current=z_e()),W.jsx(obe,{value:t.current,children:e})};RV.displayName="ReactFlowProvider";const OV=({children:e})=>I.useContext(K2)?W.jsx(W.Fragment,{children:e}):W.jsx(RV,{children:e});OV.displayName="ReactFlowWrapper";const j_e={input:uV,default:NE,output:dV,group:cA},U_e={default:O_,straight:oA,step:iA,smoothstep:Q2,simplebezier:rA},V_e=[0,0],G_e=[15,15],H_e={x:0,y:0,zoom:1},q_e={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0},W_e=I.forwardRef(({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,className:i,nodeTypes:o=j_e,edgeTypes:a=U_e,onNodeClick:s,onEdgeClick:l,onInit:u,onMove:c,onMoveStart:d,onMoveEnd:f,onConnect:h,onConnectStart:p,onConnectEnd:m,onClickConnectStart:_,onClickConnectEnd:b,onNodeMouseEnter:v,onNodeMouseMove:g,onNodeMouseLeave:y,onNodeContextMenu:S,onNodeDoubleClick:w,onNodeDragStart:x,onNodeDrag:C,onNodeDragStop:T,onNodesDelete:k,onEdgesDelete:P,onSelectionChange:$,onSelectionDragStart:O,onSelectionDrag:E,onSelectionDragStop:A,onSelectionContextMenu:D,onSelectionStart:L,onSelectionEnd:M,connectionMode:R=Nd.Strict,connectionLineType:N=Eu.Bezier,connectionLineStyle:B,connectionLineComponent:U,connectionLineContainerStyle:G,deleteKeyCode:Y="Backspace",selectionKeyCode:ee="Shift",selectionOnDrag:J=!1,selectionMode:j=sc.Full,panActivationKeyCode:Q="Space",multiSelectionKeyCode:ne=I_()?"Meta":"Control",zoomActivationKeyCode:se=I_()?"Meta":"Control",snapToGrid:ve=!1,snapGrid:ce=G_e,onlyRenderVisibleElements:bt=!1,selectNodesOnDrag:ot=!0,nodesDraggable:ze,nodesConnectable:gt,nodesFocusable:Pe,nodeOrigin:Jt=V_e,edgesFocusable:Ar,edgesUpdatable:Dn,elementsSelectable:Tn,defaultViewport:en=H_e,minZoom:Ln=.5,maxZoom:Pr=2,translateExtent:co=DE,preventScrolling:Jr=!0,nodeExtent:hr,defaultMarkerColor:Fr="#b1b1b7",zoomOnScroll:ei=!0,zoomOnPinch:Fn=!0,panOnScroll:bn=!1,panOnScrollSpeed:Mi=.5,panOnScrollMode:pi=od.Free,zoomOnDoubleClick:Qi=!0,panOnDrag:$a=!0,onPaneClick:Ir,onPaneMouseEnter:fo,onPaneMouseMove:ol,onPaneMouseLeave:$o,onPaneScroll:al,onPaneContextMenu:Bn,children:tn,onEdgeUpdate:Br,onEdgeContextMenu:Rr,onEdgeDoubleClick:Or,onEdgeMouseEnter:ti,onEdgeMouseMove:Ni,onEdgeMouseLeave:ho,onEdgeUpdateStart:gi,onEdgeUpdateEnd:zr,edgeUpdaterRadius:Da=10,onNodesChange:hs,onEdgesChange:mi,noDragClassName:nu="nodrag",noWheelClassName:ia="nowheel",noPanClassName:ni="nopan",fitView:sl=!1,fitViewOptions:q,connectOnClick:te=!0,attributionPosition:re,proOptions:de,defaultEdgeOptions:oe,elevateNodesOnSelect:je=!0,elevateEdgesOnSelect:Ge=!1,disableKeyboardA11y:lt=!1,autoPanOnConnect:$e=!0,autoPanOnNodeDrag:He=!0,connectionRadius:Ie=20,isValidConnection:ie,onError:_e,style:Ye,id:Ze,...ut},ct)=>{const _t=Ze||"1";return W.jsx("div",{...ut,style:{...Ye,...q_e},ref:ct,className:Ta(["react-flow",i]),"data-testid":"rf__wrapper",id:Ze,children:W.jsxs(OV,{children:[W.jsx(B_e,{onInit:u,onMove:c,onMoveStart:d,onMoveEnd:f,onNodeClick:s,onEdgeClick:l,onNodeMouseEnter:v,onNodeMouseMove:g,onNodeMouseLeave:y,onNodeContextMenu:S,onNodeDoubleClick:w,nodeTypes:o,edgeTypes:a,connectionLineType:N,connectionLineStyle:B,connectionLineComponent:U,connectionLineContainerStyle:G,selectionKeyCode:ee,selectionOnDrag:J,selectionMode:j,deleteKeyCode:Y,multiSelectionKeyCode:ne,panActivationKeyCode:Q,zoomActivationKeyCode:se,onlyRenderVisibleElements:bt,selectNodesOnDrag:ot,defaultViewport:en,translateExtent:co,minZoom:Ln,maxZoom:Pr,preventScrolling:Jr,zoomOnScroll:ei,zoomOnPinch:Fn,zoomOnDoubleClick:Qi,panOnScroll:bn,panOnScrollSpeed:Mi,panOnScrollMode:pi,panOnDrag:$a,onPaneClick:Ir,onPaneMouseEnter:fo,onPaneMouseMove:ol,onPaneMouseLeave:$o,onPaneScroll:al,onPaneContextMenu:Bn,onSelectionContextMenu:D,onSelectionStart:L,onSelectionEnd:M,onEdgeUpdate:Br,onEdgeContextMenu:Rr,onEdgeDoubleClick:Or,onEdgeMouseEnter:ti,onEdgeMouseMove:Ni,onEdgeMouseLeave:ho,onEdgeUpdateStart:gi,onEdgeUpdateEnd:zr,edgeUpdaterRadius:Da,defaultMarkerColor:Fr,noDragClassName:nu,noWheelClassName:ia,noPanClassName:ni,elevateEdgesOnSelect:Ge,rfId:_t,disableKeyboardA11y:lt,nodeOrigin:Jt,nodeExtent:hr}),W.jsx(Lbe,{nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:h,onConnectStart:p,onConnectEnd:m,onClickConnectStart:_,onClickConnectEnd:b,nodesDraggable:ze,nodesConnectable:gt,nodesFocusable:Pe,edgesFocusable:Ar,edgesUpdatable:Dn,elementsSelectable:Tn,elevateNodesOnSelect:je,minZoom:Ln,maxZoom:Pr,nodeExtent:hr,onNodesChange:hs,onEdgesChange:mi,snapToGrid:ve,snapGrid:ce,connectionMode:R,translateExtent:co,connectOnClick:te,defaultEdgeOptions:oe,fitView:sl,fitViewOptions:q,onNodesDelete:k,onEdgesDelete:P,onNodeDragStart:x,onNodeDrag:C,onNodeDragStop:T,onSelectionDrag:E,onSelectionDragStart:O,onSelectionDragStop:A,noPanClassName:ni,nodeOrigin:Jt,rfId:_t,autoPanOnConnect:$e,autoPanOnNodeDrag:He,onError:_e,connectionRadius:Ie,isValidConnection:ie}),W.jsx($be,{onSelectionChange:$}),tn,W.jsx(lbe,{proOptions:de,position:re}),W.jsx(Ube,{rfId:_t,disableKeyboardA11y:lt})]})})});W_e.displayName="ReactFlow";const K_e=e=>{var t;return(t=e.domNode)==null?void 0:t.querySelector(".react-flow__edgelabel-renderer")};function yHe({children:e}){const t=br(K_e);return t?Uo.createPortal(e,t):null}function vHe(){const e=hi();return I.useCallback(t=>{const{domNode:n,updateNodeDimensions:r}=e.getState(),o=(Array.isArray(t)?t:[t]).reduce((a,s)=>{const l=n==null?void 0:n.querySelector(`.react-flow__node[data-id="${s}"]`);return l&&a.push({id:s,nodeElement:l,forceUpdate:!0}),a},[]);requestAnimationFrame(()=>r(o))},[])}function Q_e(){const e=[];return function(t,n){if(typeof n!="object"||n===null)return n;for(;e.length>0&&e.at(-1)!==this;)e.pop();return e.includes(n)?"[Circular]":(e.push(n),n)}}const g0=zb("nodes/receivedOpenAPISchema",async(e,{rejectWithValue:t})=>{try{const n=[window.location.origin,"openapi.json"].join("/"),i=await(await fetch(n)).json();return JSON.parse(JSON.stringify(i,Q_e()))}catch(n){return t({error:n})}});let Dv;const X_e=new Uint8Array(16);function Y_e(){if(!Dv&&(Dv=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Dv))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Dv(X_e)}const Si=[];for(let e=0;e<256;++e)Si.push((e+256).toString(16).slice(1));function Z_e(e,t=0){return(Si[e[t+0]]+Si[e[t+1]]+Si[e[t+2]]+Si[e[t+3]]+"-"+Si[e[t+4]]+Si[e[t+5]]+"-"+Si[e[t+6]]+Si[e[t+7]]+"-"+Si[e[t+8]]+Si[e[t+9]]+"-"+Si[e[t+10]]+Si[e[t+11]]+Si[e[t+12]]+Si[e[t+13]]+Si[e[t+14]]+Si[e[t+15]]).toLowerCase()}const J_e=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),M9={randomUUID:J_e};function MV(e,t,n){if(M9.randomUUID&&!t&&!e)return M9.randomUUID();e=e||{};const r=e.random||(e.rng||Y_e)();if(r[6]=r[6]&15|64,r[8]=r[8]&63|128,t){n=n||0;for(let i=0;i<16;++i)t[n+i]=r[i];return t}return Z_e(r)}const bHe=500,_He=320,eSe="node-drag-handle",SHe=["ImageField","ImageCollection"],xHe={input:"inputs",output:"outputs"},Lv=["Collection","IntegerCollection","BooleanCollection","FloatCollection","StringCollection","ImageCollection","LatentsCollection","ConditioningCollection","ControlCollection","ColorCollection"],xg=["IntegerPolymorphic","BooleanPolymorphic","FloatPolymorphic","StringPolymorphic","ImagePolymorphic","LatentsPolymorphic","ConditioningPolymorphic","ControlPolymorphic","ColorPolymorphic"],wHe=["IPAdapterModelField","ControlNetModelField","LoRAModelField","MainModelField","ONNXModelField","SDXLMainModelField","SDXLRefinerModelField","VaeModelField","UNetField","VaeField","ClipField"],fA={integer:"IntegerCollection",boolean:"BooleanCollection",number:"FloatCollection",float:"FloatCollection",string:"StringCollection",ImageField:"ImageCollection",LatentsField:"LatentsCollection",ConditioningField:"ConditioningCollection",ControlField:"ControlCollection",ColorField:"ColorCollection"},tSe=e=>!!(e&&e in fA),NV={integer:"IntegerPolymorphic",boolean:"BooleanPolymorphic",number:"FloatPolymorphic",float:"FloatPolymorphic",string:"StringPolymorphic",ImageField:"ImagePolymorphic",LatentsField:"LatentsPolymorphic",ConditioningField:"ConditioningPolymorphic",ControlField:"ControlPolymorphic",ColorField:"ColorPolymorphic"},nSe={IntegerPolymorphic:"integer",BooleanPolymorphic:"boolean",FloatPolymorphic:"float",StringPolymorphic:"string",ImagePolymorphic:"ImageField",LatentsPolymorphic:"LatentsField",ConditioningPolymorphic:"ConditioningField",ControlPolymorphic:"ControlField",ColorPolymorphic:"ColorField"},CHe=["string","StringPolymorphic","boolean","BooleanPolymorphic","integer","float","FloatPolymorphic","IntegerPolymorphic","enum","ImageField","ImagePolymorphic","MainModelField","SDXLRefinerModelField","VaeModelField","LoRAModelField","ControlNetModelField","ColorField","SDXLMainModelField","Scheduler","IPAdapterModelField","BoardField"],rSe=e=>!!(e&&e in NV),EHe={boolean:{color:"green.500",description:Z("nodes.booleanDescription"),title:Z("nodes.boolean")},BooleanCollection:{color:"green.500",description:Z("nodes.booleanCollectionDescription"),title:Z("nodes.booleanCollection")},BooleanPolymorphic:{color:"green.500",description:Z("nodes.booleanPolymorphicDescription"),title:Z("nodes.booleanPolymorphic")},ClipField:{color:"green.500",description:Z("nodes.clipFieldDescription"),title:Z("nodes.clipField")},Collection:{color:"base.500",description:Z("nodes.collectionDescription"),title:Z("nodes.collection")},CollectionItem:{color:"base.500",description:Z("nodes.collectionItemDescription"),title:Z("nodes.collectionItem")},ColorCollection:{color:"pink.300",description:Z("nodes.colorCollectionDescription"),title:Z("nodes.colorCollection")},ColorField:{color:"pink.300",description:Z("nodes.colorFieldDescription"),title:Z("nodes.colorField")},ColorPolymorphic:{color:"pink.300",description:Z("nodes.colorPolymorphicDescription"),title:Z("nodes.colorPolymorphic")},ConditioningCollection:{color:"cyan.500",description:Z("nodes.conditioningCollectionDescription"),title:Z("nodes.conditioningCollection")},ConditioningField:{color:"cyan.500",description:Z("nodes.conditioningFieldDescription"),title:Z("nodes.conditioningField")},ConditioningPolymorphic:{color:"cyan.500",description:Z("nodes.conditioningPolymorphicDescription"),title:Z("nodes.conditioningPolymorphic")},ControlCollection:{color:"teal.500",description:Z("nodes.controlCollectionDescription"),title:Z("nodes.controlCollection")},ControlField:{color:"teal.500",description:Z("nodes.controlFieldDescription"),title:Z("nodes.controlField")},ControlNetModelField:{color:"teal.500",description:"TODO",title:"ControlNet"},ControlPolymorphic:{color:"teal.500",description:"Control info passed between nodes.",title:"Control Polymorphic"},DenoiseMaskField:{color:"blue.300",description:Z("nodes.denoiseMaskFieldDescription"),title:Z("nodes.denoiseMaskField")},enum:{color:"blue.500",description:Z("nodes.enumDescription"),title:Z("nodes.enum")},float:{color:"orange.500",description:Z("nodes.floatDescription"),title:Z("nodes.float")},FloatCollection:{color:"orange.500",description:Z("nodes.floatCollectionDescription"),title:Z("nodes.floatCollection")},FloatPolymorphic:{color:"orange.500",description:Z("nodes.floatPolymorphicDescription"),title:Z("nodes.floatPolymorphic")},ImageCollection:{color:"purple.500",description:Z("nodes.imageCollectionDescription"),title:Z("nodes.imageCollection")},ImageField:{color:"purple.500",description:Z("nodes.imageFieldDescription"),title:Z("nodes.imageField")},BoardField:{color:"purple.500",description:Z("nodes.imageFieldDescription"),title:Z("nodes.imageField")},ImagePolymorphic:{color:"purple.500",description:Z("nodes.imagePolymorphicDescription"),title:Z("nodes.imagePolymorphic")},integer:{color:"red.500",description:Z("nodes.integerDescription"),title:Z("nodes.integer")},IntegerCollection:{color:"red.500",description:Z("nodes.integerCollectionDescription"),title:Z("nodes.integerCollection")},IntegerPolymorphic:{color:"red.500",description:Z("nodes.integerPolymorphicDescription"),title:Z("nodes.integerPolymorphic")},IPAdapterField:{color:"green.300",description:"IP-Adapter info passed between nodes.",title:"IP-Adapter"},IPAdapterModelField:{color:"teal.500",description:"IP-Adapter model",title:"IP-Adapter Model"},LatentsCollection:{color:"pink.500",description:Z("nodes.latentsCollectionDescription"),title:Z("nodes.latentsCollection")},LatentsField:{color:"pink.500",description:Z("nodes.latentsFieldDescription"),title:Z("nodes.latentsField")},LatentsPolymorphic:{color:"pink.500",description:Z("nodes.latentsPolymorphicDescription"),title:Z("nodes.latentsPolymorphic")},LoRAModelField:{color:"teal.500",description:Z("nodes.loRAModelFieldDescription"),title:Z("nodes.loRAModelField")},MainModelField:{color:"teal.500",description:Z("nodes.mainModelFieldDescription"),title:Z("nodes.mainModelField")},ONNXModelField:{color:"teal.500",description:Z("nodes.oNNXModelFieldDescription"),title:Z("nodes.oNNXModelField")},Scheduler:{color:"base.500",description:Z("nodes.schedulerDescription"),title:Z("nodes.scheduler")},SDXLMainModelField:{color:"teal.500",description:Z("nodes.sDXLMainModelFieldDescription"),title:Z("nodes.sDXLMainModelField")},SDXLRefinerModelField:{color:"teal.500",description:Z("nodes.sDXLRefinerModelFieldDescription"),title:Z("nodes.sDXLRefinerModelField")},string:{color:"yellow.500",description:Z("nodes.stringDescription"),title:Z("nodes.string")},StringCollection:{color:"yellow.500",description:Z("nodes.stringCollectionDescription"),title:Z("nodes.stringCollection")},StringPolymorphic:{color:"yellow.500",description:Z("nodes.stringPolymorphicDescription"),title:Z("nodes.stringPolymorphic")},UNetField:{color:"red.500",description:Z("nodes.uNetFieldDescription"),title:Z("nodes.uNetField")},VaeField:{color:"blue.500",description:Z("nodes.vaeFieldDescription"),title:Z("nodes.vaeField")},VaeModelField:{color:"teal.500",description:Z("nodes.vaeModelFieldDescription"),title:Z("nodes.vaeModelField")}},N9=(e,t,n)=>{let r=t,i=n;for(;e.find(o=>o.position.x===r&&o.position.y===i);)r=r+50,i=i+50;return{x:r,y:i}},iSe=(e,t)=>{if(e==="Collection"&&t==="Collection")return!1;if(e===t)return!0;const n=e==="CollectionItem"&&!Lv.includes(t),r=t==="CollectionItem"&&!Lv.includes(e)&&!xg.includes(e),i=xg.includes(t)&&(()=>{if(!xg.includes(t))return!1;const u=nSe[t],c=fA[u];return e===u||e===c})(),o=e==="Collection"&&(Lv.includes(t)||xg.includes(t)),a=t==="Collection"&&Lv.includes(e);return n||r||i||o||a||e==="integer"&&t==="float"||(e==="integer"||e==="float")&&t==="string"};var oSe="\0",Oc="\0",$9="",yo,ld,zo,F0,Th,Ah,fa,Cs,Tu,Es,Au,Sl,xl,Ph,Ih,wl,Ua,B0,LE,DN;let aSe=(DN=class{constructor(t){Yn(this,B0);Yn(this,yo,!0);Yn(this,ld,!1);Yn(this,zo,!1);Yn(this,F0,void 0);Yn(this,Th,()=>{});Yn(this,Ah,()=>{});Yn(this,fa,{});Yn(this,Cs,{});Yn(this,Tu,{});Yn(this,Es,{});Yn(this,Au,{});Yn(this,Sl,{});Yn(this,xl,{});Yn(this,Ph,0);Yn(this,Ih,0);Yn(this,wl,void 0);Yn(this,Ua,void 0);t&&(oa(this,yo,t.hasOwnProperty("directed")?t.directed:!0),oa(this,ld,t.hasOwnProperty("multigraph")?t.multigraph:!1),oa(this,zo,t.hasOwnProperty("compound")?t.compound:!1)),ae(this,zo)&&(oa(this,wl,{}),oa(this,Ua,{}),ae(this,Ua)[Oc]={})}isDirected(){return ae(this,yo)}isMultigraph(){return ae(this,ld)}isCompound(){return ae(this,zo)}setGraph(t){return oa(this,F0,t),this}graph(){return ae(this,F0)}setDefaultNodeLabel(t){return oa(this,Th,t),typeof t!="function"&&oa(this,Th,()=>t),this}nodeCount(){return ae(this,Ph)}nodes(){return Object.keys(ae(this,fa))}sources(){var t=this;return this.nodes().filter(n=>Object.keys(ae(t,Cs)[n]).length===0)}sinks(){var t=this;return this.nodes().filter(n=>Object.keys(ae(t,Es)[n]).length===0)}setNodes(t,n){var r=arguments,i=this;return t.forEach(function(o){r.length>1?i.setNode(o,n):i.setNode(o)}),this}setNode(t,n){return ae(this,fa).hasOwnProperty(t)?(arguments.length>1&&(ae(this,fa)[t]=n),this):(ae(this,fa)[t]=arguments.length>1?n:ae(this,Th).call(this,t),ae(this,zo)&&(ae(this,wl)[t]=Oc,ae(this,Ua)[t]={},ae(this,Ua)[Oc][t]=!0),ae(this,Cs)[t]={},ae(this,Tu)[t]={},ae(this,Es)[t]={},ae(this,Au)[t]={},++Op(this,Ph)._,this)}node(t){return ae(this,fa)[t]}hasNode(t){return ae(this,fa).hasOwnProperty(t)}removeNode(t){var n=this;if(ae(this,fa).hasOwnProperty(t)){var r=i=>n.removeEdge(ae(n,Sl)[i]);delete ae(this,fa)[t],ae(this,zo)&&(ps(this,B0,LE).call(this,t),delete ae(this,wl)[t],this.children(t).forEach(function(i){n.setParent(i)}),delete ae(this,Ua)[t]),Object.keys(ae(this,Cs)[t]).forEach(r),delete ae(this,Cs)[t],delete ae(this,Tu)[t],Object.keys(ae(this,Es)[t]).forEach(r),delete ae(this,Es)[t],delete ae(this,Au)[t],--Op(this,Ph)._}return this}setParent(t,n){if(!ae(this,zo))throw new Error("Cannot set parent in a non-compound graph");if(n===void 0)n=Oc;else{n+="";for(var r=n;r!==void 0;r=this.parent(r))if(r===t)throw new Error("Setting "+n+" as parent of "+t+" would create a cycle");this.setNode(n)}return this.setNode(t),ps(this,B0,LE).call(this,t),ae(this,wl)[t]=n,ae(this,Ua)[n][t]=!0,this}parent(t){if(ae(this,zo)){var n=ae(this,wl)[t];if(n!==Oc)return n}}children(t=Oc){if(ae(this,zo)){var n=ae(this,Ua)[t];if(n)return Object.keys(n)}else{if(t===Oc)return this.nodes();if(this.hasNode(t))return[]}}predecessors(t){var n=ae(this,Tu)[t];if(n)return Object.keys(n)}successors(t){var n=ae(this,Au)[t];if(n)return Object.keys(n)}neighbors(t){var n=this.predecessors(t);if(n){const i=new Set(n);for(var r of this.successors(t))i.add(r);return Array.from(i.values())}}isLeaf(t){var n;return this.isDirected()?n=this.successors(t):n=this.neighbors(t),n.length===0}filterNodes(t){var n=new this.constructor({directed:ae(this,yo),multigraph:ae(this,ld),compound:ae(this,zo)});n.setGraph(this.graph());var r=this;Object.entries(ae(this,fa)).forEach(function([a,s]){t(a)&&n.setNode(a,s)}),Object.values(ae(this,Sl)).forEach(function(a){n.hasNode(a.v)&&n.hasNode(a.w)&&n.setEdge(a,r.edge(a))});var i={};function o(a){var s=r.parent(a);return s===void 0||n.hasNode(s)?(i[a]=s,s):s in i?i[s]:o(s)}return ae(this,zo)&&n.nodes().forEach(a=>n.setParent(a,o(a))),n}setDefaultEdgeLabel(t){return oa(this,Ah,t),typeof t!="function"&&oa(this,Ah,()=>t),this}edgeCount(){return ae(this,Ih)}edges(){return Object.values(ae(this,Sl))}setPath(t,n){var r=this,i=arguments;return t.reduce(function(o,a){return i.length>1?r.setEdge(o,a,n):r.setEdge(o,a),a}),this}setEdge(){var t,n,r,i,o=!1,a=arguments[0];typeof a=="object"&&a!==null&&"v"in a?(t=a.v,n=a.w,r=a.name,arguments.length===2&&(i=arguments[1],o=!0)):(t=a,n=arguments[1],r=arguments[3],arguments.length>2&&(i=arguments[2],o=!0)),t=""+t,n=""+n,r!==void 0&&(r=""+r);var s=wg(ae(this,yo),t,n,r);if(ae(this,xl).hasOwnProperty(s))return o&&(ae(this,xl)[s]=i),this;if(r!==void 0&&!ae(this,ld))throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(t),this.setNode(n),ae(this,xl)[s]=o?i:ae(this,Ah).call(this,t,n,r);var l=sSe(ae(this,yo),t,n,r);return t=l.v,n=l.w,Object.freeze(l),ae(this,Sl)[s]=l,D9(ae(this,Tu)[n],t),D9(ae(this,Au)[t],n),ae(this,Cs)[n][s]=l,ae(this,Es)[t][s]=l,Op(this,Ih)._++,this}edge(t,n,r){var i=arguments.length===1?jC(ae(this,yo),arguments[0]):wg(ae(this,yo),t,n,r);return ae(this,xl)[i]}edgeAsObj(){const t=this.edge(...arguments);return typeof t!="object"?{label:t}:t}hasEdge(t,n,r){var i=arguments.length===1?jC(ae(this,yo),arguments[0]):wg(ae(this,yo),t,n,r);return ae(this,xl).hasOwnProperty(i)}removeEdge(t,n,r){var i=arguments.length===1?jC(ae(this,yo),arguments[0]):wg(ae(this,yo),t,n,r),o=ae(this,Sl)[i];return o&&(t=o.v,n=o.w,delete ae(this,xl)[i],delete ae(this,Sl)[i],L9(ae(this,Tu)[n],t),L9(ae(this,Au)[t],n),delete ae(this,Cs)[n][i],delete ae(this,Es)[t][i],Op(this,Ih)._--),this}inEdges(t,n){var r=ae(this,Cs)[t];if(r){var i=Object.values(r);return n?i.filter(o=>o.v===n):i}}outEdges(t,n){var r=ae(this,Es)[t];if(r){var i=Object.values(r);return n?i.filter(o=>o.w===n):i}}nodeEdges(t,n){var r=this.inEdges(t,n);if(r)return r.concat(this.outEdges(t,n))}},yo=new WeakMap,ld=new WeakMap,zo=new WeakMap,F0=new WeakMap,Th=new WeakMap,Ah=new WeakMap,fa=new WeakMap,Cs=new WeakMap,Tu=new WeakMap,Es=new WeakMap,Au=new WeakMap,Sl=new WeakMap,xl=new WeakMap,Ph=new WeakMap,Ih=new WeakMap,wl=new WeakMap,Ua=new WeakMap,B0=new WeakSet,LE=function(t){delete ae(this,Ua)[ae(this,wl)[t]][t]},DN);function D9(e,t){e[t]?e[t]++:e[t]=1}function L9(e,t){--e[t]||delete e[t]}function wg(e,t,n,r){var i=""+t,o=""+n;if(!e&&i>o){var a=i;i=o,o=a}return i+$9+o+$9+(r===void 0?oSe:r)}function sSe(e,t,n,r){var i=""+t,o=""+n;if(!e&&i>o){var a=i;i=o,o=a}var s={v:i,w:o};return r&&(s.name=r),s}function jC(e,t){return wg(e,t.v,t.w,t.name)}var hA=aSe,lSe="2.1.13",uSe={Graph:hA,version:lSe},cSe=hA,dSe={write:fSe,read:gSe};function fSe(e){var t={options:{directed:e.isDirected(),multigraph:e.isMultigraph(),compound:e.isCompound()},nodes:hSe(e),edges:pSe(e)};return e.graph()!==void 0&&(t.value=structuredClone(e.graph())),t}function hSe(e){return e.nodes().map(function(t){var n=e.node(t),r=e.parent(t),i={v:t};return n!==void 0&&(i.value=n),r!==void 0&&(i.parent=r),i})}function pSe(e){return e.edges().map(function(t){var n=e.edge(t),r={v:t.v,w:t.w};return t.name!==void 0&&(r.name=t.name),n!==void 0&&(r.value=n),r})}function gSe(e){var t=new cSe(e.options).setGraph(e.value);return e.nodes.forEach(function(n){t.setNode(n.v,n.value),n.parent&&t.setParent(n.v,n.parent)}),e.edges.forEach(function(n){t.setEdge({v:n.v,w:n.w,name:n.name},n.value)}),t}var mSe=ySe;function ySe(e){var t={},n=[],r;function i(o){t.hasOwnProperty(o)||(t[o]=!0,r.push(o),e.successors(o).forEach(i),e.predecessors(o).forEach(i))}return e.nodes().forEach(function(o){r=[],i(o),r.length&&n.push(r)}),n}var zi,Cl,z0,FE,j0,BE,Rh,U1,LN;let vSe=(LN=class{constructor(){Yn(this,z0);Yn(this,j0);Yn(this,Rh);Yn(this,zi,[]);Yn(this,Cl,{})}size(){return ae(this,zi).length}keys(){return ae(this,zi).map(function(t){return t.key})}has(t){return ae(this,Cl).hasOwnProperty(t)}priority(t){var n=ae(this,Cl)[t];if(n!==void 0)return ae(this,zi)[n].priority}min(){if(this.size()===0)throw new Error("Queue underflow");return ae(this,zi)[0].key}add(t,n){var r=ae(this,Cl);if(t=String(t),!r.hasOwnProperty(t)){var i=ae(this,zi),o=i.length;return r[t]=o,i.push({key:t,priority:n}),ps(this,j0,BE).call(this,o),!0}return!1}removeMin(){ps(this,Rh,U1).call(this,0,ae(this,zi).length-1);var t=ae(this,zi).pop();return delete ae(this,Cl)[t.key],ps(this,z0,FE).call(this,0),t.key}decrease(t,n){var r=ae(this,Cl)[t];if(n>ae(this,zi)[r].priority)throw new Error("New priority is greater than current priority. Key: "+t+" Old: "+ae(this,zi)[r].priority+" New: "+n);ae(this,zi)[r].priority=n,ps(this,j0,BE).call(this,r)}},zi=new WeakMap,Cl=new WeakMap,z0=new WeakSet,FE=function(t){var n=ae(this,zi),r=2*t,i=r+1,o=t;r>1,!(n[i].priority1;function SSe(e,t,n,r){return xSe(e,String(t),n||_Se,r||function(i){return e.outEdges(i)})}function xSe(e,t,n,r){var i={},o=new bSe,a,s,l=function(u){var c=u.v!==a?u.v:u.w,d=i[c],f=n(u),h=s.distance+f;if(f<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+u+" Weight: "+f);h0&&(a=o.removeMin(),s=i[a],s.distance!==Number.POSITIVE_INFINITY);)r(a).forEach(l);return i}var wSe=DV,CSe=ESe;function ESe(e,t,n){return e.nodes().reduce(function(r,i){return r[i]=wSe(e,i,t,n),r},{})}var LV=kSe;function kSe(e){var t=0,n=[],r={},i=[];function o(a){var s=r[a]={onStack:!0,lowlink:t,index:t++};if(n.push(a),e.successors(a).forEach(function(c){r.hasOwnProperty(c)?r[c].onStack&&(s.lowlink=Math.min(s.lowlink,r[c].index)):(o(c),s.lowlink=Math.min(s.lowlink,r[c].lowlink))}),s.lowlink===s.index){var l=[],u;do u=n.pop(),r[u].onStack=!1,l.push(u);while(a!==u);i.push(l)}}return e.nodes().forEach(function(a){r.hasOwnProperty(a)||o(a)}),i}var TSe=LV,ASe=PSe;function PSe(e){return TSe(e).filter(function(t){return t.length>1||t.length===1&&e.hasEdge(t[0],t[0])})}var ISe=OSe,RSe=()=>1;function OSe(e,t,n){return MSe(e,t||RSe,n||function(r){return e.outEdges(r)})}function MSe(e,t,n){var r={},i=e.nodes();return i.forEach(function(o){r[o]={},r[o][o]={distance:0},i.forEach(function(a){o!==a&&(r[o][a]={distance:Number.POSITIVE_INFINITY})}),n(o).forEach(function(a){var s=a.v===o?a.w:a.v,l=t(a);r[o][s]={distance:l,predecessor:o}})}),i.forEach(function(o){var a=r[o];i.forEach(function(s){var l=r[s];i.forEach(function(u){var c=l[o],d=a[u],f=l[u],h=c.distance+d.distance;he.successors(s):s=>e.neighbors(s),i=n==="post"?LSe:FSe,o=[],a={};return t.forEach(s=>{if(!e.hasNode(s))throw new Error("Graph does not have node: "+s);i(s,r,a,o)}),o}function LSe(e,t,n,r){for(var i=[[e,!1]];i.length>0;){var o=i.pop();o[1]?r.push(o[0]):n.hasOwnProperty(o[0])||(n[o[0]]=!0,i.push([o[0],!0]),jV(t(o[0]),a=>i.push([a,!1])))}}function FSe(e,t,n,r){for(var i=[e];i.length>0;){var o=i.pop();n.hasOwnProperty(o)||(n[o]=!0,r.push(o),jV(t(o),a=>i.push(a)))}}function jV(e,t){for(var n=e.length;n--;)t(e[n],n,e);return e}var BSe=zV,zSe=jSe;function jSe(e,t){return BSe(e,t,"post")}var USe=zV,VSe=GSe;function GSe(e,t){return USe(e,t,"pre")}var HSe=hA,qSe=$V,WSe=KSe;function KSe(e,t){var n=new HSe,r={},i=new qSe,o;function a(l){var u=l.v===o?l.w:l.v,c=i.priority(u);if(c!==void 0){var d=t(l);d0;){if(o=i.removeMin(),r.hasOwnProperty(o))n.setEdge(o,r[o]);else{if(s)throw new Error("Input graph is not connected: "+e);s=!0}e.nodeEdges(o).forEach(a)}return n}var QSe={components:mSe,dijkstra:DV,dijkstraAll:CSe,findCycles:ASe,floydWarshall:ISe,isAcyclic:NSe,postorder:zSe,preorder:VSe,prim:WSe,tarjan:LV,topsort:BV},B9=uSe,XSe={Graph:B9.Graph,json:dSe,alg:QSe,version:B9.version};const z9=pc(XSe),j9=(e,t,n,r)=>{const i=new z9.Graph;return n.forEach(o=>{i.setNode(o.id)}),r.forEach(o=>{i.setEdge(o.source,o.target)}),i.setEdge(e,t),z9.alg.isAcyclic(i)},U9=(e,t,n,r,i)=>{let o=!0;return t==="source"?e.find(a=>a.target===r.id&&a.targetHandle===i.name)&&(o=!1):e.find(a=>a.source===r.id&&a.sourceHandle===i.name)&&(o=!1),iSe(n,i.type)||(o=!1),o},V9=(e,t,n,r,i,o,a)=>{if(e.id===r)return null;const s=o=="source"?e.data.inputs:e.data.outputs;if(s[i]){const l=s[i],u=o=="source"?r:e.id,c=o=="source"?e.id:r,d=o=="source"?i:l.name,f=o=="source"?l.name:i,h=j9(u,c,t,n),p=U9(n,o,a,e,l);if(h&&p)return{source:u,sourceHandle:d,target:c,targetHandle:f}}for(const l in s){const u=s[l],c=o=="source"?r:e.id,d=o=="source"?e.id:r,f=o=="source"?i:u.name,h=o=="source"?u.name:i,p=j9(c,d,t,n),m=U9(n,o,a,e,u);if(p&&m)return{source:c,sourceHandle:f,target:d,targetHandle:h}}return null},YSe="1.0.0",UC={status:Hc.PENDING,error:null,progress:null,progressImage:null,outputs:[]},jE={meta:{version:YSe},name:"",author:"",description:"",notes:"",tags:"",contact:"",version:"",exposedFields:[]},UV={nodes:[],edges:[],nodeTemplates:{},isReady:!1,connectionStartParams:null,currentConnectionFieldType:null,connectionMade:!1,modifyingEdge:!1,addNewNodePosition:null,shouldShowFieldTypeLegend:!1,shouldShowMinimapPanel:!0,shouldValidateGraph:!0,shouldAnimateEdges:!0,shouldSnapToGrid:!1,shouldColorEdges:!0,isAddNodePopoverOpen:!1,nodeOpacity:1,selectedNodes:[],selectedEdges:[],workflow:jE,nodeExecutionStates:{},viewport:{x:0,y:0,zoom:1},mouseOverField:null,mouseOverNode:null,nodesToCopy:[],edgesToCopy:[],selectionMode:sc.Partial},go=(e,t)=>{var l,u;const{nodeId:n,fieldName:r,value:i}=t.payload,o=e.nodes.findIndex(c=>c.id===n),a=(l=e.nodes)==null?void 0:l[o];if(!jr(a))return;const s=(u=a.data)==null?void 0:u.inputs[r];s&&o>-1&&(s.value=i)},VV=nr({name:"nodes",initialState:UV,reducers:{nodesChanged:(e,t)=>{e.nodes=Uc(t.payload,e.nodes)},nodeAdded:(e,t)=>{var i,o;const n=t.payload,r=N9(e.nodes,((i=e.addNewNodePosition)==null?void 0:i.x)??n.position.x,((o=e.addNewNodePosition)==null?void 0:o.y)??n.position.y);if(n.position=r,n.selected=!0,e.nodes=Uc(e.nodes.map(a=>({id:a.id,type:"select",selected:!1})),e.nodes),e.edges=Rc(e.edges.map(a=>({id:a.id,type:"select",selected:!1})),e.edges),e.nodes.push(n),!!jr(n)){if(e.nodeExecutionStates[n.id]={nodeId:n.id,...UC},e.connectionStartParams){const{nodeId:a,handleId:s,handleType:l}=e.connectionStartParams;if(a&&s&&l&&e.currentConnectionFieldType){const u=V9(n,e.nodes,e.edges,a,s,l,e.currentConnectionFieldType);u&&(e.edges=Sg({...u,type:"default"},e.edges))}}e.connectionStartParams=null,e.currentConnectionFieldType=null}},edgeChangeStarted:e=>{e.modifyingEdge=!0},edgesChanged:(e,t)=>{e.edges=Rc(t.payload,e.edges)},edgeAdded:(e,t)=>{e.edges=Sg(t.payload,e.edges)},edgeUpdated:(e,t)=>{const{oldEdge:n,newConnection:r}=t.payload;e.edges=Cbe(n,r,e.edges)},connectionStarted:(e,t)=>{var l;e.connectionStartParams=t.payload,e.connectionMade=e.modifyingEdge;const{nodeId:n,handleId:r,handleType:i}=t.payload;if(!n||!r)return;const o=e.nodes.findIndex(u=>u.id===n),a=(l=e.nodes)==null?void 0:l[o];if(!jr(a))return;const s=i==="source"?a.data.outputs[r]:a.data.inputs[r];e.currentConnectionFieldType=(s==null?void 0:s.type)??null},connectionMade:(e,t)=>{e.currentConnectionFieldType&&(e.edges=Sg({...t.payload,type:"default"},e.edges),e.connectionMade=!0)},connectionEnded:(e,t)=>{var n;if(e.connectionMade)e.connectionStartParams=null,e.currentConnectionFieldType=null;else if(e.mouseOverNode){const r=e.nodes.findIndex(o=>o.id===e.mouseOverNode),i=(n=e.nodes)==null?void 0:n[r];if(i&&e.connectionStartParams){const{nodeId:o,handleId:a,handleType:s}=e.connectionStartParams;if(o&&a&&s&&e.currentConnectionFieldType){const l=V9(i,e.nodes,e.edges,o,a,s,e.currentConnectionFieldType);l&&(e.edges=Sg({...l,type:"default"},e.edges))}}e.connectionStartParams=null,e.currentConnectionFieldType=null}else e.addNewNodePosition=t.payload.cursorPosition,e.isAddNodePopoverOpen=!0;e.modifyingEdge=!1},workflowExposedFieldAdded:(e,t)=>{e.workflow.exposedFields=K8(e.workflow.exposedFields.concat(t.payload),n=>`${n.nodeId}-${n.fieldName}`)},workflowExposedFieldRemoved:(e,t)=>{e.workflow.exposedFields=e.workflow.exposedFields.filter(n=>!cT(n,t.payload))},fieldLabelChanged:(e,t)=>{const{nodeId:n,fieldName:r,label:i}=t.payload,o=e.nodes.find(s=>s.id===n);if(!jr(o))return;const a=o.data.inputs[r];a&&(a.label=i)},nodeEmbedWorkflowChanged:(e,t)=>{var a;const{nodeId:n,embedWorkflow:r}=t.payload,i=e.nodes.findIndex(s=>s.id===n),o=(a=e.nodes)==null?void 0:a[i];jr(o)&&(o.data.embedWorkflow=r)},nodeUseCacheChanged:(e,t)=>{var a;const{nodeId:n,useCache:r}=t.payload,i=e.nodes.findIndex(s=>s.id===n),o=(a=e.nodes)==null?void 0:a[i];jr(o)&&(o.data.useCache=r)},nodeIsIntermediateChanged:(e,t)=>{var a;const{nodeId:n,isIntermediate:r}=t.payload,i=e.nodes.findIndex(s=>s.id===n),o=(a=e.nodes)==null?void 0:a[i];jr(o)&&(o.data.isIntermediate=r)},nodeIsOpenChanged:(e,t)=>{var s;const{nodeId:n,isOpen:r}=t.payload,i=e.nodes.findIndex(l=>l.id===n),o=(s=e.nodes)==null?void 0:s[i];if(!jr(o)&&!pI(o)||(o.data.isOpen=r,!jr(o)))return;const a=lA([o],e.edges);if(r)a.forEach(l=>{delete l.hidden}),a.forEach(l=>{l.type==="collapsed"&&(e.edges=e.edges.filter(u=>u.id!==l.id))});else{const l=xbe(o,e.nodes,e.edges).filter(d=>jr(d)&&d.data.isOpen===!1),u=Sbe(o,e.nodes,e.edges).filter(d=>jr(d)&&d.data.isOpen===!1),c=[];a.forEach(d=>{var f,h;if(d.target===n&&l.find(p=>p.id===d.source)){d.hidden=!0;const p=c.find(m=>m.source===d.source&&m.target===d.target);p?p.data={count:(((f=p.data)==null?void 0:f.count)??0)+1}:c.push({id:`${d.source}-${d.target}-collapsed`,source:d.source,target:d.target,type:"collapsed",data:{count:1},updatable:!1})}if(d.source===n&&u.find(p=>p.id===d.target)){const p=c.find(m=>m.source===d.source&&m.target===d.target);d.hidden=!0,p?p.data={count:(((h=p.data)==null?void 0:h.count)??0)+1}:c.push({id:`${d.source}-${d.target}-collapsed`,source:d.source,target:d.target,type:"collapsed",data:{count:1},updatable:!1})}}),c.length&&(e.edges=Rc(c.map(d=>({type:"add",item:d})),e.edges))}},edgeDeleted:(e,t)=>{e.edges=e.edges.filter(n=>n.id!==t.payload)},edgesDeleted:(e,t)=>{const r=t.payload.filter(i=>i.type==="collapsed");if(r.length){const i=[];r.forEach(o=>{e.edges.forEach(a=>{a.source===o.source&&a.target===o.target&&i.push({id:a.id,type:"remove"})})}),e.edges=Rc(i,e.edges)}},nodesDeleted:(e,t)=>{t.payload.forEach(n=>{e.workflow.exposedFields=e.workflow.exposedFields.filter(r=>r.nodeId!==n.id),jr(n)&&delete e.nodeExecutionStates[n.id]})},nodeLabelChanged:(e,t)=>{var a;const{nodeId:n,label:r}=t.payload,i=e.nodes.findIndex(s=>s.id===n),o=(a=e.nodes)==null?void 0:a[i];jr(o)&&(o.data.label=r)},nodeNotesChanged:(e,t)=>{var a;const{nodeId:n,notes:r}=t.payload,i=e.nodes.findIndex(s=>s.id===n),o=(a=e.nodes)==null?void 0:a[i];jr(o)&&(o.data.notes=r)},nodeExclusivelySelected:(e,t)=>{const n=t.payload;e.nodes=Uc(e.nodes.map(r=>({id:r.id,type:"select",selected:r.id===n})),e.nodes)},selectedNodesChanged:(e,t)=>{e.selectedNodes=t.payload},selectedEdgesChanged:(e,t)=>{e.selectedEdges=t.payload},fieldStringValueChanged:(e,t)=>{go(e,t)},fieldNumberValueChanged:(e,t)=>{go(e,t)},fieldBooleanValueChanged:(e,t)=>{go(e,t)},fieldBoardValueChanged:(e,t)=>{go(e,t)},fieldImageValueChanged:(e,t)=>{go(e,t)},fieldColorValueChanged:(e,t)=>{go(e,t)},fieldMainModelValueChanged:(e,t)=>{go(e,t)},fieldRefinerModelValueChanged:(e,t)=>{go(e,t)},fieldVaeModelValueChanged:(e,t)=>{go(e,t)},fieldLoRAModelValueChanged:(e,t)=>{go(e,t)},fieldControlNetModelValueChanged:(e,t)=>{go(e,t)},fieldIPAdapterModelValueChanged:(e,t)=>{go(e,t)},fieldEnumModelValueChanged:(e,t)=>{go(e,t)},fieldSchedulerValueChanged:(e,t)=>{go(e,t)},imageCollectionFieldValueChanged:(e,t)=>{var u,c;const{nodeId:n,fieldName:r,value:i}=t.payload,o=e.nodes.findIndex(d=>d.id===n);if(o===-1)return;const a=(u=e.nodes)==null?void 0:u[o];if(!jr(a))return;const s=(c=a.data)==null?void 0:c.inputs[r];if(!s)return;const l=wn(s.value);if(!l){s.value=i;return}s.value=K8(l.concat(i),"image_name")},notesNodeValueChanged:(e,t)=>{var a;const{nodeId:n,value:r}=t.payload,i=e.nodes.findIndex(s=>s.id===n),o=(a=e.nodes)==null?void 0:a[i];pI(o)&&(o.data.notes=r)},shouldShowFieldTypeLegendChanged:(e,t)=>{e.shouldShowFieldTypeLegend=t.payload},shouldShowMinimapPanelChanged:(e,t)=>{e.shouldShowMinimapPanel=t.payload},nodeTemplatesBuilt:(e,t)=>{e.nodeTemplates=t.payload,e.isReady=!0},nodeEditorReset:e=>{e.nodes=[],e.edges=[],e.workflow=wn(jE)},shouldValidateGraphChanged:(e,t)=>{e.shouldValidateGraph=t.payload},shouldAnimateEdgesChanged:(e,t)=>{e.shouldAnimateEdges=t.payload},shouldSnapToGridChanged:(e,t)=>{e.shouldSnapToGrid=t.payload},shouldColorEdgesChanged:(e,t)=>{e.shouldColorEdges=t.payload},nodeOpacityChanged:(e,t)=>{e.nodeOpacity=t.payload},workflowNameChanged:(e,t)=>{e.workflow.name=t.payload},workflowDescriptionChanged:(e,t)=>{e.workflow.description=t.payload},workflowTagsChanged:(e,t)=>{e.workflow.tags=t.payload},workflowAuthorChanged:(e,t)=>{e.workflow.author=t.payload},workflowNotesChanged:(e,t)=>{e.workflow.notes=t.payload},workflowVersionChanged:(e,t)=>{e.workflow.version=t.payload},workflowContactChanged:(e,t)=>{e.workflow.contact=t.payload},workflowLoaded:(e,t)=>{const{nodes:n,edges:r,...i}=t.payload;e.workflow=i,e.nodes=Uc(n.map(o=>({item:{...o,dragHandle:`.${eSe}`},type:"add"})),[]),e.edges=Rc(r.map(o=>({item:o,type:"add"})),[]),e.nodeExecutionStates=n.reduce((o,a)=>(o[a.id]={nodeId:a.id,...UC},o),{})},workflowReset:e=>{e.workflow=wn(jE)},viewportChanged:(e,t)=>{e.viewport=t.payload},mouseOverFieldChanged:(e,t)=>{e.mouseOverField=t.payload},mouseOverNodeChanged:(e,t)=>{e.mouseOverNode=t.payload},selectedAll:e=>{e.nodes=Uc(e.nodes.map(t=>({id:t.id,type:"select",selected:!0})),e.nodes),e.edges=Rc(e.edges.map(t=>({id:t.id,type:"select",selected:!0})),e.edges)},selectionCopied:e=>{if(e.nodesToCopy=e.nodes.filter(t=>t.selected).map(wn),e.edgesToCopy=e.edges.filter(t=>t.selected).map(wn),e.nodesToCopy.length>0){const t={x:0,y:0};e.nodesToCopy.forEach(n=>{const r=.15*(n.width??0),i=.5*(n.height??0);t.x+=n.position.x+r,t.y+=n.position.y+i}),t.x/=e.nodesToCopy.length,t.y/=e.nodesToCopy.length,e.nodesToCopy.forEach(n=>{n.position.x-=t.x,n.position.y-=t.y})}},selectionPasted:(e,t)=>{const{cursorPosition:n}=t.payload,r=e.nodesToCopy.map(wn),i=r.map(c=>c.data.id),o=e.edgesToCopy.filter(c=>i.includes(c.source)&&i.includes(c.target)).map(wn);o.forEach(c=>c.selected=!0),r.forEach(c=>{const d=MV();o.forEach(h=>{h.source===c.data.id&&(h.source=d,h.id=h.id.replace(c.data.id,d)),h.target===c.data.id&&(h.target=d,h.id=h.id.replace(c.data.id,d))}),c.selected=!0,c.id=d,c.data.id=d;const f=N9(e.nodes,c.position.x+((n==null?void 0:n.x)??0),c.position.y+((n==null?void 0:n.y)??0));c.position=f});const a=r.map(c=>({item:c,type:"add"})),s=e.nodes.map(c=>({id:c.data.id,type:"select",selected:!1})),l=o.map(c=>({item:c,type:"add"})),u=e.edges.map(c=>({id:c.id,type:"select",selected:!1}));e.nodes=Uc(a.concat(s),e.nodes),e.edges=Rc(l.concat(u),e.edges),r.forEach(c=>{e.nodeExecutionStates[c.id]={nodeId:c.id,...UC}})},addNodePopoverOpened:e=>{e.addNewNodePosition=null,e.isAddNodePopoverOpen=!0},addNodePopoverClosed:e=>{e.isAddNodePopoverOpen=!1,e.connectionStartParams=null,e.currentConnectionFieldType=null},addNodePopoverToggled:e=>{e.isAddNodePopoverOpen=!e.isAddNodePopoverOpen},selectionModeChanged:(e,t)=>{e.selectionMode=t.payload?sc.Full:sc.Partial}},extraReducers:e=>{e.addCase(g0.pending,t=>{t.isReady=!1}),e.addCase(zT,(t,n)=>{const{source_node_id:r}=n.payload.data,i=t.nodeExecutionStates[r];i&&(i.status=Hc.IN_PROGRESS)}),e.addCase(UT,(t,n)=>{const{source_node_id:r,result:i}=n.payload.data,o=t.nodeExecutionStates[r];o&&(o.status=Hc.COMPLETED,o.progress!==null&&(o.progress=1),o.outputs.push(i))}),e.addCase(U2,(t,n)=>{const{source_node_id:r}=n.payload.data,i=t.nodeExecutionStates[r];i&&(i.status=Hc.FAILED,i.error=n.payload.data.error,i.progress=null,i.progressImage=null)}),e.addCase(VT,(t,n)=>{const{source_node_id:r,step:i,total_steps:o,progress_image:a}=n.payload.data,s=t.nodeExecutionStates[r];s&&(s.status=Hc.IN_PROGRESS,s.progress=(i+1)/o,s.progressImage=a??null)}),e.addCase(GT,(t,n)=>{["in_progress"].includes(n.payload.data.status)&&Ca(t.nodeExecutionStates,r=>{r.status=Hc.PENDING,r.error=null,r.progress=null,r.progressImage=null,r.outputs=[]})})}}),{addNodePopoverClosed:AHe,addNodePopoverOpened:PHe,addNodePopoverToggled:IHe,connectionEnded:RHe,connectionMade:OHe,connectionStarted:MHe,edgeDeleted:NHe,edgeChangeStarted:$He,edgesChanged:DHe,edgesDeleted:LHe,edgeUpdated:FHe,fieldBoardValueChanged:BHe,fieldBooleanValueChanged:zHe,fieldColorValueChanged:jHe,fieldControlNetModelValueChanged:UHe,fieldEnumModelValueChanged:VHe,fieldImageValueChanged:X2,fieldIPAdapterModelValueChanged:GHe,fieldLabelChanged:HHe,fieldLoRAModelValueChanged:qHe,fieldMainModelValueChanged:WHe,fieldNumberValueChanged:KHe,fieldRefinerModelValueChanged:QHe,fieldSchedulerValueChanged:XHe,fieldStringValueChanged:YHe,fieldVaeModelValueChanged:ZHe,imageCollectionFieldValueChanged:JHe,mouseOverFieldChanged:eqe,mouseOverNodeChanged:tqe,nodeAdded:nqe,nodeEditorReset:ZSe,nodeEmbedWorkflowChanged:rqe,nodeExclusivelySelected:iqe,nodeIsIntermediateChanged:oqe,nodeIsOpenChanged:aqe,nodeLabelChanged:sqe,nodeNotesChanged:lqe,nodeOpacityChanged:uqe,nodesChanged:cqe,nodesDeleted:dqe,nodeTemplatesBuilt:GV,nodeUseCacheChanged:fqe,notesNodeValueChanged:hqe,selectedAll:pqe,selectedEdgesChanged:gqe,selectedNodesChanged:mqe,selectionCopied:yqe,selectionModeChanged:vqe,selectionPasted:bqe,shouldAnimateEdgesChanged:_qe,shouldColorEdgesChanged:Sqe,shouldShowFieldTypeLegendChanged:xqe,shouldShowMinimapPanelChanged:wqe,shouldSnapToGridChanged:Cqe,shouldValidateGraphChanged:Eqe,viewportChanged:kqe,workflowAuthorChanged:Tqe,workflowContactChanged:Aqe,workflowDescriptionChanged:Pqe,workflowExposedFieldAdded:JSe,workflowExposedFieldRemoved:Iqe,workflowLoaded:e2e,workflowNameChanged:Rqe,workflowNotesChanged:Oqe,workflowTagsChanged:Mqe,workflowVersionChanged:Nqe,edgeAdded:$qe}=VV.actions,t2e=VV.reducer,HV={esrganModelName:"RealESRGAN_x4plus.pth"},qV=nr({name:"postprocessing",initialState:HV,reducers:{esrganModelNameChanged:(e,t)=>{e.esrganModelName=t.payload}}}),{esrganModelNameChanged:Dqe}=qV.actions,n2e=qV.reducer,WV={positiveStylePrompt:"",negativeStylePrompt:"",shouldConcatSDXLStylePrompt:!0,shouldUseSDXLRefiner:!1,sdxlImg2ImgDenoisingStrength:.7,refinerModel:null,refinerSteps:20,refinerCFGScale:7.5,refinerScheduler:"euler",refinerPositiveAestheticScore:6,refinerNegativeAestheticScore:2.5,refinerStart:.8},KV=nr({name:"sdxl",initialState:WV,reducers:{setPositiveStylePromptSDXL:(e,t)=>{e.positiveStylePrompt=t.payload},setNegativeStylePromptSDXL:(e,t)=>{e.negativeStylePrompt=t.payload},setShouldConcatSDXLStylePrompt:(e,t)=>{e.shouldConcatSDXLStylePrompt=t.payload},setShouldUseSDXLRefiner:(e,t)=>{e.shouldUseSDXLRefiner=t.payload},setSDXLImg2ImgDenoisingStrength:(e,t)=>{e.sdxlImg2ImgDenoisingStrength=t.payload},refinerModelChanged:(e,t)=>{e.refinerModel=t.payload},setRefinerSteps:(e,t)=>{e.refinerSteps=t.payload},setRefinerCFGScale:(e,t)=>{e.refinerCFGScale=t.payload},setRefinerScheduler:(e,t)=>{e.refinerScheduler=t.payload},setRefinerPositiveAestheticScore:(e,t)=>{e.refinerPositiveAestheticScore=t.payload},setRefinerNegativeAestheticScore:(e,t)=>{e.refinerNegativeAestheticScore=t.payload},setRefinerStart:(e,t)=>{e.refinerStart=t.payload}}}),{setPositiveStylePromptSDXL:Lqe,setNegativeStylePromptSDXL:Fqe,setShouldConcatSDXLStylePrompt:Bqe,setShouldUseSDXLRefiner:r2e,setSDXLImg2ImgDenoisingStrength:zqe,refinerModelChanged:G9,setRefinerSteps:jqe,setRefinerCFGScale:Uqe,setRefinerScheduler:Vqe,setRefinerPositiveAestheticScore:Gqe,setRefinerNegativeAestheticScore:Hqe,setRefinerStart:qqe}=KV.actions,i2e=KV.reducer,o2e=(e,t,n)=>t===0?0:n===2?Math.floor((e+1+1)/2)/Math.floor((t+1)/2):(e+1+1)/(t+1),$d=e=>typeof e=="string"?{title:e,status:"info",isClosable:!0,duration:2500}:{status:"info",isClosable:!0,duration:2500,...e},QV={isInitialized:!1,isConnected:!1,shouldConfirmOnDelete:!0,enableImageDebugging:!1,toastQueue:[],denoiseProgress:null,shouldAntialiasProgressImage:!1,consoleLogLevel:"debug",shouldLogToConsole:!0,language:"en",shouldUseNSFWChecker:!1,shouldUseWatermarker:!1,shouldEnableInformationalPopovers:!1,status:"DISCONNECTED"},XV=nr({name:"system",initialState:QV,reducers:{setShouldConfirmOnDelete:(e,t)=>{e.shouldConfirmOnDelete=t.payload},setEnableImageDebugging:(e,t)=>{e.enableImageDebugging=t.payload},addToast:(e,t)=>{e.toastQueue.push(t.payload)},clearToastQueue:e=>{e.toastQueue=[]},consoleLogLevelChanged:(e,t)=>{e.consoleLogLevel=t.payload},shouldLogToConsoleChanged:(e,t)=>{e.shouldLogToConsole=t.payload},shouldAntialiasProgressImageChanged:(e,t)=>{e.shouldAntialiasProgressImage=t.payload},languageChanged:(e,t)=>{e.language=t.payload},shouldUseNSFWCheckerChanged(e,t){e.shouldUseNSFWChecker=t.payload},shouldUseWatermarkerChanged(e,t){e.shouldUseWatermarker=t.payload},setShouldEnableInformationalPopovers(e,t){e.shouldEnableInformationalPopovers=t.payload},isInitializedChanged(e,t){e.isInitialized=t.payload}},extraReducers(e){e.addCase(BT,t=>{t.isConnected=!0,t.denoiseProgress=null,t.status="CONNECTED"}),e.addCase(Bj,t=>{t.isConnected=!1,t.denoiseProgress=null,t.status="DISCONNECTED"}),e.addCase(zT,t=>{t.denoiseProgress=null,t.status="PROCESSING"}),e.addCase(VT,(t,n)=>{const{step:r,total_steps:i,order:o,progress_image:a,graph_execution_state_id:s,queue_batch_id:l}=n.payload.data;t.denoiseProgress={step:r,total_steps:i,order:o,percentage:o2e(r,i,o),progress_image:a,session_id:s,batch_id:l},t.status="PROCESSING"}),e.addCase(UT,t=>{t.denoiseProgress=null,t.status="CONNECTED"}),e.addCase(Vj,t=>{t.denoiseProgress=null,t.status="CONNECTED"}),e.addCase(qj,t=>{t.status="LOADING_MODEL"}),e.addCase(Kj,t=>{t.status="CONNECTED"}),e.addCase(GT,(t,n)=>{["completed","canceled","failed"].includes(n.payload.data.status)&&(t.status="CONNECTED",t.denoiseProgress=null)}),e.addMatcher(c2e,(t,n)=>{t.toastQueue.push($d({title:Z("toast.serverError"),status:"error",description:Sae(n.payload.data.error_type)}))})}}),{setShouldConfirmOnDelete:Wqe,setEnableImageDebugging:Kqe,addToast:Gt,clearToastQueue:Qqe,consoleLogLevelChanged:Xqe,shouldLogToConsoleChanged:Yqe,shouldAntialiasProgressImageChanged:Zqe,languageChanged:Jqe,shouldUseNSFWCheckerChanged:a2e,shouldUseWatermarkerChanged:s2e,setShouldEnableInformationalPopovers:eWe,isInitializedChanged:l2e}=XV.actions,u2e=XV.reducer,c2e=No(U2,Xj,Zj),d2e={listCursor:void 0,listPriority:void 0,selectedQueueItem:void 0,resumeProcessorOnEnqueue:!0},f2e=d2e,YV=nr({name:"queue",initialState:f2e,reducers:{listCursorChanged:(e,t)=>{e.listCursor=t.payload},listPriorityChanged:(e,t)=>{e.listPriority=t.payload},listParamsReset:e=>{e.listCursor=void 0,e.listPriority=void 0},queueItemSelectionToggled:(e,t)=>{e.selectedQueueItem===t.payload?e.selectedQueueItem=void 0:e.selectedQueueItem=t.payload},resumeProcessorOnEnqueueChanged:(e,t)=>{e.resumeProcessorOnEnqueue=t.payload}}}),{listCursorChanged:tWe,listPriorityChanged:nWe,listParamsReset:h2e,queueItemSelectionToggled:rWe,resumeProcessorOnEnqueueChanged:iWe}=YV.actions,p2e=YV.reducer,g2e={searchFolder:null,advancedAddScanModel:null},ZV=nr({name:"modelmanager",initialState:g2e,reducers:{setSearchFolder:(e,t)=>{e.searchFolder=t.payload},setAdvancedAddScanModel:(e,t)=>{e.advancedAddScanModel=t.payload}}}),{setSearchFolder:oWe,setAdvancedAddScanModel:aWe}=ZV.actions,m2e=ZV.reducer,JV={shift:!1,ctrl:!1,meta:!1},eG=nr({name:"hotkeys",initialState:JV,reducers:{shiftKeyPressed:(e,t)=>{e.shift=t.payload},ctrlKeyPressed:(e,t)=>{e.ctrl=t.payload},metaKeyPressed:(e,t)=>{e.meta=t.payload}}}),{shiftKeyPressed:sWe,ctrlKeyPressed:lWe,metaKeyPressed:uWe}=eG.actions,y2e=eG.reducer,tG={activeTab:"txt2img",shouldShowImageDetails:!1,shouldUseCanvasBetaLayout:!1,shouldShowExistingModelsInSearch:!1,shouldUseSliders:!1,shouldHidePreview:!1,shouldShowProgressInViewer:!0,shouldShowEmbeddingPicker:!1,shouldAutoChangeDimensions:!1,favoriteSchedulers:[],globalContextMenuCloseTrigger:0,panels:{}},nG=nr({name:"ui",initialState:tG,reducers:{setActiveTab:(e,t)=>{e.activeTab=t.payload},setShouldShowImageDetails:(e,t)=>{e.shouldShowImageDetails=t.payload},setShouldUseCanvasBetaLayout:(e,t)=>{e.shouldUseCanvasBetaLayout=t.payload},setShouldHidePreview:(e,t)=>{e.shouldHidePreview=t.payload},setShouldShowExistingModelsInSearch:(e,t)=>{e.shouldShowExistingModelsInSearch=t.payload},setShouldUseSliders:(e,t)=>{e.shouldUseSliders=t.payload},setShouldShowProgressInViewer:(e,t)=>{e.shouldShowProgressInViewer=t.payload},favoriteSchedulersChanged:(e,t)=>{e.favoriteSchedulers=t.payload},toggleEmbeddingPicker:e=>{e.shouldShowEmbeddingPicker=!e.shouldShowEmbeddingPicker},setShouldAutoChangeDimensions:(e,t)=>{e.shouldAutoChangeDimensions=t.payload},contextMenusClosed:e=>{e.globalContextMenuCloseTrigger+=1},panelsChanged:(e,t)=>{e.panels[t.payload.name]=t.payload.value}},extraReducers(e){e.addCase(XS,t=>{t.activeTab="img2img"})}}),{setActiveTab:rG,setShouldShowImageDetails:cWe,setShouldUseCanvasBetaLayout:dWe,setShouldShowExistingModelsInSearch:fWe,setShouldUseSliders:hWe,setShouldHidePreview:pWe,setShouldShowProgressInViewer:gWe,favoriteSchedulersChanged:mWe,toggleEmbeddingPicker:yWe,setShouldAutoChangeDimensions:vWe,contextMenusClosed:bWe,panelsChanged:_We}=nG.actions,v2e=nG.reducer,b2e=dS(NY);iG=UE=void 0;var _2e=b2e,S2e=function(){var t=[],n=[],r=void 0,i=function(u){return r=u,function(c){return function(d){return _2e.compose.apply(void 0,n)(c)(d)}}},o=function(){for(var u,c,d=arguments.length,f=Array(d),h=0;h=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(u){throw u},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var o=!0,a=!1,s;return{s:function(){n=n.call(e)},n:function(){var u=n.next();return o=u.done,u},e:function(u){a=!0,s=u},f:function(){try{!o&&n.return!=null&&n.return()}finally{if(a)throw s}}}}function aG(e,t){if(e){if(typeof e=="string")return q9(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return q9(e,t)}}function q9(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=arguments.length>2?arguments[2]:void 0,i=r.prefix,o=r.driver,a=r.persistWholeStore,s=r.serialize;try{var l=a?$2e:D2e;yield l(t,n,{prefix:i,driver:o,serialize:s})}catch(u){console.warn("redux-remember: persist error",u)}});return function(){return e.apply(this,arguments)}}();function X9(e,t,n,r,i,o,a){try{var s=e[o](a),l=s.value}catch(u){n(u);return}s.done?t(l):Promise.resolve(l).then(r,i)}function Y9(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function a(l){X9(o,r,i,a,s,"next",l)}function s(l){X9(o,r,i,a,s,"throw",l)}a(void 0)})}}var F2e=function(){var e=Y9(function*(t,n,r){var i=r.prefix,o=r.driver,a=r.serialize,s=r.unserialize,l=r.persistThrottle,u=r.persistDebounce,c=r.persistWholeStore;yield I2e(t,n,{prefix:i,driver:o,unserialize:s,persistWholeStore:c});var d={},f=function(){var h=Y9(function*(){var p=oG(t.getState(),n);yield L2e(p,d,{prefix:i,driver:o,serialize:a,persistWholeStore:c}),gA(p,d)||t.dispatch({type:E2e,payload:p}),d=p});return function(){return h.apply(this,arguments)}}();u&&u>0?t.subscribe(T2e(f,u)):t.subscribe(k2e(f,l))});return function(n,r,i){return e.apply(this,arguments)}}();const B2e=F2e;function m0(e){"@babel/helpers - typeof";return m0=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},m0(e)}function Z9(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function HC(e){for(var t=1;t0&&arguments[0]!==void 0?arguments[0]:n.state,i=arguments.length>1?arguments[1]:void 0;i.type&&(i.type==="@@INIT"||i.type.startsWith("@@redux/INIT"))&&(n.state=HC({},r));var o=typeof t=="function"?t:hp(t);switch(i.type){case VE:{var a=HC(HC({},n.state),i.payload||{});return n.state=o(a,{type:VE,payload:a}),n.state}default:return o(r,i)}}},G2e=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},i=r.prefix,o=i===void 0?"@@remember-":i,a=r.serialize,s=a===void 0?function(_,b){return JSON.stringify(_)}:a,l=r.unserialize,u=l===void 0?function(_,b){return JSON.parse(_)}:l,c=r.persistThrottle,d=c===void 0?100:c,f=r.persistDebounce,h=r.persistWholeStore,p=h===void 0?!1:h;if(!t)throw Error("redux-remember error: driver required");if(!Array.isArray(n))throw Error("redux-remember error: rememberedKeys needs to be an array");var m=function(b){return function(v,g,y){var S=b(v,g,y);return B2e(S,n,{driver:t,prefix:o,serialize:s,unserialize:u,persistThrottle:d,persistDebounce:f,persistWholeStore:p}),S}};return m};const SWe=["chakra-ui-color-mode","i18nextLng","ROARR_FILTER","ROARR_LOG"],H2e="@@invokeai-",q2e=["cursorPosition"],W2e=["pendingControlImages"],K2e=["prompts"],Q2e=["selection","selectedBoardId","galleryView"],X2e=["nodeTemplates","connectionStartParams","currentConnectionFieldType","selectedNodes","selectedEdges","isReady","nodesToCopy","edgesToCopy","connectionMade","modifyingEdge","addNewNodePosition"],Y2e=[],Z2e=[],J2e=["isInitialized","isConnected","denoiseProgress","status"],exe=["shouldShowImageDetails","globalContextMenuCloseTrigger","panels"],txe={canvas:q2e,gallery:Q2e,generation:Y2e,nodes:X2e,postprocessing:Z2e,system:J2e,ui:exe,controlNet:W2e,dynamicPrompts:K2e},nxe=(e,t)=>{const n=qS(e,txe[t]??[]);return JSON.stringify(n)},rxe={canvas:wB,gallery:lU,generation:hT,nodes:UV,postprocessing:HV,system:QV,config:lB,ui:tG,hotkeys:JV,controlNet:_E,dynamicPrompts:KT,sdxl:WV},ixe=(e,t)=>goe(JSON.parse(e),rxe[t]),oxe=Ne("nodes/textToImageGraphBuilt"),axe=Ne("nodes/imageToImageGraphBuilt"),lG=Ne("nodes/canvasGraphBuilt"),sxe=Ne("nodes/nodesGraphBuilt"),lxe=No(oxe,axe,lG,sxe),uxe=Ne("nodes/workflowLoadRequested"),cxe=e=>{if(lxe(e)&&e.payload.nodes){const t={};return{...e,payload:{...e.payload,nodes:t}}}return g0.fulfilled.match(e)?{...e,payload:""}:GV.match(e)?{...e,payload:""}:e},dxe=["canvas/setCursorPosition","canvas/setStageCoordinates","canvas/setStageScale","canvas/setIsDrawing","canvas/setBoundingBoxCoordinates","canvas/setBoundingBoxDimensions","canvas/setIsDrawing","canvas/addPointToCurrentLine","socket/socketGeneratorProgress","socket/appSocketGeneratorProgress","@@REMEMBER_PERSISTED"],fxe=e=>e,uG="default",Ur=tl(uG),hxe=e=>{const t=e?Kg.stringify(e,{arrayFormat:"none"}):void 0;return t?`queue/${Ur.get()}/list?${t}`:`queue/${Ur.get()}/list`},qc=Js({selectId:e=>e.item_id,sortComparer:(e,t)=>e.priority>t.priority?-1:e.priorityt.item_id?1:0}),Qr=ls.injectEndpoints({endpoints:e=>({enqueueBatch:e.mutation({query:t=>({url:`queue/${Ur.get()}/enqueue_batch`,body:t,method:"POST"}),invalidatesTags:["SessionQueueStatus","CurrentSessionQueueItem","NextSessionQueueItem"],onQueryStarted:async(t,n)=>{const{dispatch:r,queryFulfilled:i}=n;try{await i,Zp(r)}catch{}}}),enqueueGraph:e.mutation({query:t=>({url:`queue/${Ur.get()}/enqueue_graph`,body:t,method:"POST"}),invalidatesTags:["SessionQueueStatus","CurrentSessionQueueItem","NextSessionQueueItem"],onQueryStarted:async(t,n)=>{const{dispatch:r,queryFulfilled:i}=n;try{await i,Zp(r)}catch{}}}),resumeProcessor:e.mutation({query:()=>({url:`queue/${Ur.get()}/processor/resume`,method:"PUT"}),invalidatesTags:["CurrentSessionQueueItem","SessionQueueStatus"]}),pauseProcessor:e.mutation({query:()=>({url:`queue/${Ur.get()}/processor/pause`,method:"PUT"}),invalidatesTags:["CurrentSessionQueueItem","SessionQueueStatus"]}),pruneQueue:e.mutation({query:()=>({url:`queue/${Ur.get()}/prune`,method:"PUT"}),invalidatesTags:["SessionQueueStatus","BatchStatus","SessionQueueItem","SessionQueueItemDTO"],onQueryStarted:async(t,n)=>{const{dispatch:r,queryFulfilled:i}=n;try{await i,Zp(r)}catch{}}}),clearQueue:e.mutation({query:()=>({url:`queue/${Ur.get()}/clear`,method:"PUT"}),invalidatesTags:["SessionQueueStatus","SessionProcessorStatus","BatchStatus","CurrentSessionQueueItem","NextSessionQueueItem","SessionQueueItem","SessionQueueItemDTO"],onQueryStarted:async(t,n)=>{const{dispatch:r,queryFulfilled:i}=n;try{await i,Zp(r)}catch{}}}),getCurrentQueueItem:e.query({query:()=>({url:`queue/${Ur.get()}/current`,method:"GET"}),providesTags:t=>{const n=["CurrentSessionQueueItem"];return t&&n.push({type:"SessionQueueItem",id:t.item_id}),n}}),getNextQueueItem:e.query({query:()=>({url:`queue/${Ur.get()}/next`,method:"GET"}),providesTags:t=>{const n=["NextSessionQueueItem"];return t&&n.push({type:"SessionQueueItem",id:t.item_id}),n}}),getQueueStatus:e.query({query:()=>({url:`queue/${Ur.get()}/status`,method:"GET"}),providesTags:["SessionQueueStatus"]}),getBatchStatus:e.query({query:({batch_id:t})=>({url:`queue/${Ur.get()}/b/${t}/status`,method:"GET"}),providesTags:t=>t?[{type:"BatchStatus",id:t.batch_id}]:[]}),getQueueItem:e.query({query:t=>({url:`queue/${Ur.get()}/i/${t}`,method:"GET"}),providesTags:t=>t?[{type:"SessionQueueItem",id:t.item_id}]:[]}),cancelQueueItem:e.mutation({query:t=>({url:`queue/${Ur.get()}/i/${t}/cancel`,method:"PUT"}),onQueryStarted:async(t,{dispatch:n,queryFulfilled:r})=>{try{const{data:i}=await r;n(Qr.util.updateQueryData("listQueueItems",void 0,o=>{qc.updateOne(o,{id:t,changes:{status:i.status}})}))}catch{}},invalidatesTags:t=>t?[{type:"SessionQueueItem",id:t.item_id},{type:"SessionQueueItemDTO",id:t.item_id},{type:"BatchStatus",id:t.batch_id}]:[]}),cancelByBatchIds:e.mutation({query:t=>({url:`queue/${Ur.get()}/cancel_by_batch_ids`,method:"PUT",body:t}),onQueryStarted:async(t,n)=>{const{dispatch:r,queryFulfilled:i}=n;try{await i,Zp(r)}catch{}},invalidatesTags:["SessionQueueItem","SessionQueueItemDTO","BatchStatus"]}),listQueueItems:e.query({query:t=>({url:hxe(t),method:"GET"}),serializeQueryArgs:()=>`queue/${Ur.get()}/list`,transformResponse:t=>qc.addMany(qc.getInitialState({has_more:t.has_more}),t.items),merge:(t,n)=>{qc.addMany(t,qc.getSelectors().selectAll(n)),t.has_more=n.has_more},forceRefetch:({currentArg:t,previousArg:n})=>t!==n,keepUnusedDataFor:60*5})})}),{useCancelByBatchIdsMutation:xWe,useEnqueueGraphMutation:wWe,useEnqueueBatchMutation:CWe,usePauseProcessorMutation:EWe,useResumeProcessorMutation:kWe,useClearQueueMutation:TWe,usePruneQueueMutation:AWe,useGetCurrentQueueItemQuery:PWe,useGetQueueStatusQuery:IWe,useGetQueueItemQuery:RWe,useGetNextQueueItemQuery:OWe,useListQueueItemsQuery:MWe,useCancelQueueItemMutation:NWe,useGetBatchStatusQuery:$We}=Qr,Zp=e=>{e(Qr.util.updateQueryData("listQueueItems",void 0,t=>{qc.removeAll(t),t.has_more=!1})),e(h2e()),e(Qr.endpoints.listQueueItems.initiate(void 0))},pxe=No(ole,ale),gxe=()=>{Be({matcher:pxe,effect:async(e,{dispatch:t,getState:n})=>{const r=Ce("canvas"),i=n(),{batchIds:o}=i.canvas;try{const a=t(Qr.endpoints.cancelByBatchIds.initiate({batch_ids:o},{fixedCacheKey:"cancelByBatchIds"})),{canceled:s}=await a.unwrap();a.reset(),s>0&&(r.debug(`Canceled ${s} canvas batches`),t(Gt({title:Z("queue.cancelBatchSucceeded"),status:"success"}))),t(cle())}catch{r.error("Failed to cancel canvas batches"),t(Gt({title:Z("queue.cancelBatchFailed"),status:"error"}))}}})};Ne("app/appStarted");const mxe=()=>{Be({matcher:me.endpoints.listImages.matchFulfilled,effect:async(e,{dispatch:t,unsubscribe:n,cancelActiveListeners:r})=>{if(e.meta.arg.queryCacheKey!==Bo({board_id:"none",categories:ii}))return;r(),n();const i=e.payload;if(i.ids.length>0){const o=Vn.getSelectors().selectAll(i)[0];t(Us(o??null))}}})},yxe=No(Qr.endpoints.enqueueBatch.matchFulfilled,Qr.endpoints.enqueueGraph.matchFulfilled),vxe=()=>{Be({matcher:yxe,effect:async(e,{dispatch:t,getState:n})=>{const{data:r}=Qr.endpoints.getQueueStatus.select()(n());!r||r.processor.is_started||t(Qr.endpoints.resumeProcessor.initiate(void 0,{fixedCacheKey:"resumeProcessor"}))}})},cG=ls.injectEndpoints({endpoints:e=>({getAppVersion:e.query({query:()=>({url:"app/version",method:"GET"}),providesTags:["AppVersion"],keepUnusedDataFor:864e5}),getAppConfig:e.query({query:()=>({url:"app/config",method:"GET"}),providesTags:["AppConfig"],keepUnusedDataFor:864e5}),getInvocationCacheStatus:e.query({query:()=>({url:"app/invocation_cache/status",method:"GET"}),providesTags:["InvocationCacheStatus"]}),clearInvocationCache:e.mutation({query:()=>({url:"app/invocation_cache",method:"DELETE"}),invalidatesTags:["InvocationCacheStatus"]}),enableInvocationCache:e.mutation({query:()=>({url:"app/invocation_cache/enable",method:"PUT"}),invalidatesTags:["InvocationCacheStatus"]}),disableInvocationCache:e.mutation({query:()=>({url:"app/invocation_cache/disable",method:"PUT"}),invalidatesTags:["InvocationCacheStatus"]})})}),{useGetAppVersionQuery:DWe,useGetAppConfigQuery:LWe,useClearInvocationCacheMutation:FWe,useDisableInvocationCacheMutation:BWe,useEnableInvocationCacheMutation:zWe,useGetInvocationCacheStatusQuery:jWe}=cG,bxe=()=>{Be({matcher:cG.endpoints.getAppConfig.matchFulfilled,effect:async(e,{getState:t,dispatch:n})=>{const{infill_methods:r=[],nsfw_methods:i=[],watermarking_methods:o=[]}=e.payload,a=t().generation.infillMethod;r.includes(a)||n(Xse(r[0])),i.includes("nsfw_checker")||n(a2e(!1)),o.includes("invisible_watermark")||n(s2e(!1))}})},_xe=Ne("app/appStarted"),Sxe=()=>{Be({actionCreator:_xe,effect:async(e,{unsubscribe:t,cancelActiveListeners:n})=>{n(),t()}})},Z2={memoizeOptions:{resultEqualityCheck:cT}},dG=(e,t)=>{var f;const{generation:n,canvas:r,nodes:i,controlNet:o}=e,a=((f=n.initialImage)==null?void 0:f.imageName)===t,s=r.layerState.objects.some(h=>h.kind==="image"&&h.imageName===t),l=i.nodes.filter(jr).some(h=>Vg(h.data.inputs,p=>{var m;return p.type==="ImageField"&&((m=p.value)==null?void 0:m.image_name)===t})),u=Vg(o.controlNets,h=>h.controlImage===t||h.processedControlImage===t),c=o.ipAdapterInfo.adapterImage===t;return{isInitialImage:a,isCanvasImage:s,isNodesImage:l,isControlNetImage:u,isIPAdapterImage:c}},xxe=Ii([e=>e],e=>{const{imagesToDelete:t}=e.deleteImageModal;return t.length?t.map(r=>dG(e,r.image_name)):[]},Z2),wxe=()=>{Be({matcher:me.endpoints.deleteBoardAndImages.matchFulfilled,effect:async(e,{dispatch:t,getState:n})=>{const{deleted_images:r}=e.payload;let i=!1,o=!1,a=!1,s=!1,l=!1;const u=n();r.forEach(c=>{const d=dG(u,c);d.isInitialImage&&!i&&(t(pT()),i=!0),d.isCanvasImage&&!o&&(t(gT()),o=!0),d.isNodesImage&&!a&&(t(ZSe()),a=!0),d.isControlNetImage&&!s&&(t(s0e()),s=!0),d.isIPAdapterImage&&!l&&(t(oU()),l=!0)})}})},Cxe=()=>{Be({matcher:No(w_,SE),effect:async(e,{getState:t,dispatch:n,condition:r,cancelActiveListeners:i})=>{i();const o=t(),a=w_.match(e)?e.payload.boardId:o.gallery.selectedBoardId,l=(SE.match(e)?e.payload:o.gallery.galleryView)==="images"?ii:Mu,u={board_id:a??"none",categories:l};if(await r(()=>me.endpoints.listImages.select(u)(t()).isSuccess,5e3)){const{data:d}=me.endpoints.listImages.select(u)(t());if(d){const f=s0.selectAll(d)[0],h=s0.selectById(d,e.payload.selectedImageName);n(Us(h||f||null))}else n(Us(null))}else n(Us(null))}})},Exe=Ne("canvas/canvasSavedToGallery"),kxe=Ne("canvas/canvasMaskSavedToGallery"),Txe=Ne("canvas/canvasCopiedToClipboard"),Axe=Ne("canvas/canvasDownloadedAsImage"),Pxe=Ne("canvas/canvasMerged"),Ixe=Ne("canvas/stagingAreaImageSaved"),Rxe=Ne("canvas/canvasMaskToControlNet"),Oxe=Ne("canvas/canvasImageToControlNet");let fG=null,hG=null;const UWe=e=>{fG=e},J2=()=>fG,VWe=e=>{hG=e},Mxe=()=>hG,Nxe=async e=>new Promise((t,n)=>{e.toBlob(r=>{if(r){t(r);return}n("Unable to create Blob")})}),$_=async(e,t)=>await Nxe(e.toCanvas(t)),ex=async(e,t=!1)=>{const n=J2();if(!n)throw new Error("Problem getting base layer blob");const{shouldCropToBoundingBoxOnSave:r,boundingBoxCoordinates:i,boundingBoxDimensions:o}=e.canvas,a=n.clone();a.scale({x:1,y:1});const s=a.getAbsolutePosition(),l=r||t?{x:i.x+s.x,y:i.y+s.y,width:o.width,height:o.height}:a.getClientRect();return $_(a,l)},$xe=(e,t="image/png")=>{navigator.clipboard.write([new ClipboardItem({[t]:e})])},Dxe=()=>{Be({actionCreator:Txe,effect:async(e,{dispatch:t,getState:n})=>{const r=_2.get().child({namespace:"canvasCopiedToClipboardListener"}),i=n();try{const o=ex(i);$xe(o)}catch(o){r.error(String(o)),t(Gt({title:Z("toast.problemCopyingCanvas"),description:Z("toast.problemCopyingCanvasDesc"),status:"error"}));return}t(Gt({title:Z("toast.canvasCopiedClipboard"),status:"success"}))}})},Lxe=(e,t)=>{const n=URL.createObjectURL(e),r=document.createElement("a");r.href=n,r.download=t,document.body.appendChild(r),r.click(),document.body.removeChild(r),r.remove()},Fxe=()=>{Be({actionCreator:Axe,effect:async(e,{dispatch:t,getState:n})=>{const r=_2.get().child({namespace:"canvasSavedToGalleryListener"}),i=n();let o;try{o=await ex(i)}catch(a){r.error(String(a)),t(Gt({title:Z("toast.problemDownloadingCanvas"),description:Z("toast.problemDownloadingCanvasDesc"),status:"error"}));return}Lxe(o,"canvas.png"),t(Gt({title:Z("toast.canvasDownloaded"),status:"success"}))}})},Bxe=()=>{Be({actionCreator:Oxe,effect:async(e,{dispatch:t,getState:n})=>{const r=Ce("canvas"),i=n();let o;try{o=await ex(i,!0)}catch(u){r.error(String(u)),t(Gt({title:Z("toast.problemSavingCanvas"),description:Z("toast.problemSavingCanvasDesc"),status:"error"}));return}const{autoAddBoardId:a}=i.gallery,s=await t(me.endpoints.uploadImage.initiate({file:new File([o],"savedCanvas.png",{type:"image/png"}),image_category:"control",is_intermediate:!1,board_id:a==="none"?void 0:a,crop_visible:!1,postUploadAction:{type:"TOAST",toastOptions:{title:Z("toast.canvasSentControlnetAssets")}}})).unwrap(),{image_name:l}=s;t(Sc({controlNetId:e.payload.controlNet.controlNetId,controlImage:l}))}})};var mA={exports:{}},tx={},pG={},Rt={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e._registerNode=e.Konva=e.glob=void 0;var t=Math.PI/180;function n(){return typeof window<"u"&&({}.toString.call(window)==="[object Window]"||{}.toString.call(window)==="[object global]")}e.glob=typeof mt<"u"?mt:typeof window<"u"?window:typeof WorkerGlobalScope<"u"?self:{},e.Konva={_global:e.glob,version:"9.2.0",isBrowser:n(),isUnminified:/param/.test((function(i){}).toString()),dblClickWindow:400,getAngle(i){return e.Konva.angleDeg?i*t:i},enableTrace:!1,pointerEventsEnabled:!0,autoDrawEnabled:!0,hitOnDragEnabled:!1,capturePointerEventsEnabled:!1,_mouseListenClick:!1,_touchListenClick:!1,_pointerListenClick:!1,_mouseInDblClickWindow:!1,_touchInDblClickWindow:!1,_pointerInDblClickWindow:!1,_mouseDblClickPointerId:null,_touchDblClickPointerId:null,_pointerDblClickPointerId:null,pixelRatio:typeof window<"u"&&window.devicePixelRatio||1,dragDistance:3,angleDeg:!0,showWarnings:!0,dragButtons:[0,1],isDragging(){return e.Konva.DD.isDragging},isDragReady(){return!!e.Konva.DD.node},releaseCanvasOnDestroy:!0,document:e.glob.document,_injectGlobal(i){e.glob.Konva=i}};const r=i=>{e.Konva[i.prototype.getClassName()]=i};e._registerNode=r,e.Konva._injectGlobal(e.Konva)})(Rt);var dr={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.Util=e.Transform=void 0;const t=Rt;class n{constructor(y=[1,0,0,1,0,0]){this.dirty=!1,this.m=y&&y.slice()||[1,0,0,1,0,0]}reset(){this.m[0]=1,this.m[1]=0,this.m[2]=0,this.m[3]=1,this.m[4]=0,this.m[5]=0}copy(){return new n(this.m)}copyInto(y){y.m[0]=this.m[0],y.m[1]=this.m[1],y.m[2]=this.m[2],y.m[3]=this.m[3],y.m[4]=this.m[4],y.m[5]=this.m[5]}point(y){var S=this.m;return{x:S[0]*y.x+S[2]*y.y+S[4],y:S[1]*y.x+S[3]*y.y+S[5]}}translate(y,S){return this.m[4]+=this.m[0]*y+this.m[2]*S,this.m[5]+=this.m[1]*y+this.m[3]*S,this}scale(y,S){return this.m[0]*=y,this.m[1]*=y,this.m[2]*=S,this.m[3]*=S,this}rotate(y){var S=Math.cos(y),w=Math.sin(y),x=this.m[0]*S+this.m[2]*w,C=this.m[1]*S+this.m[3]*w,T=this.m[0]*-w+this.m[2]*S,k=this.m[1]*-w+this.m[3]*S;return this.m[0]=x,this.m[1]=C,this.m[2]=T,this.m[3]=k,this}getTranslation(){return{x:this.m[4],y:this.m[5]}}skew(y,S){var w=this.m[0]+this.m[2]*S,x=this.m[1]+this.m[3]*S,C=this.m[2]+this.m[0]*y,T=this.m[3]+this.m[1]*y;return this.m[0]=w,this.m[1]=x,this.m[2]=C,this.m[3]=T,this}multiply(y){var S=this.m[0]*y.m[0]+this.m[2]*y.m[1],w=this.m[1]*y.m[0]+this.m[3]*y.m[1],x=this.m[0]*y.m[2]+this.m[2]*y.m[3],C=this.m[1]*y.m[2]+this.m[3]*y.m[3],T=this.m[0]*y.m[4]+this.m[2]*y.m[5]+this.m[4],k=this.m[1]*y.m[4]+this.m[3]*y.m[5]+this.m[5];return this.m[0]=S,this.m[1]=w,this.m[2]=x,this.m[3]=C,this.m[4]=T,this.m[5]=k,this}invert(){var y=1/(this.m[0]*this.m[3]-this.m[1]*this.m[2]),S=this.m[3]*y,w=-this.m[1]*y,x=-this.m[2]*y,C=this.m[0]*y,T=y*(this.m[2]*this.m[5]-this.m[3]*this.m[4]),k=y*(this.m[1]*this.m[4]-this.m[0]*this.m[5]);return this.m[0]=S,this.m[1]=w,this.m[2]=x,this.m[3]=C,this.m[4]=T,this.m[5]=k,this}getMatrix(){return this.m}decompose(){var y=this.m[0],S=this.m[1],w=this.m[2],x=this.m[3],C=this.m[4],T=this.m[5],k=y*x-S*w;let P={x:C,y:T,rotation:0,scaleX:0,scaleY:0,skewX:0,skewY:0};if(y!=0||S!=0){var $=Math.sqrt(y*y+S*S);P.rotation=S>0?Math.acos(y/$):-Math.acos(y/$),P.scaleX=$,P.scaleY=k/$,P.skewX=(y*w+S*x)/k,P.skewY=0}else if(w!=0||x!=0){var O=Math.sqrt(w*w+x*x);P.rotation=Math.PI/2-(x>0?Math.acos(-w/O):-Math.acos(w/O)),P.scaleX=k/O,P.scaleY=O,P.skewX=0,P.skewY=(y*w+S*x)/k}return P.rotation=e.Util._getRotation(P.rotation),P}}e.Transform=n;var r="[object Array]",i="[object Number]",o="[object String]",a="[object Boolean]",s=Math.PI/180,l=180/Math.PI,u="#",c="",d="0",f="Konva warning: ",h="Konva error: ",p="rgb(",m={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,132,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,255,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,203],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[119,128,144],slategrey:[119,128,144],snow:[255,255,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],transparent:[255,255,255,0],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,5]},_=/rgb\((\d{1,3}),(\d{1,3}),(\d{1,3})\)/,b=[];const v=typeof requestAnimationFrame<"u"&&requestAnimationFrame||function(g){setTimeout(g,60)};e.Util={_isElement(g){return!!(g&&g.nodeType==1)},_isFunction(g){return!!(g&&g.constructor&&g.call&&g.apply)},_isPlainObject(g){return!!g&&g.constructor===Object},_isArray(g){return Object.prototype.toString.call(g)===r},_isNumber(g){return Object.prototype.toString.call(g)===i&&!isNaN(g)&&isFinite(g)},_isString(g){return Object.prototype.toString.call(g)===o},_isBoolean(g){return Object.prototype.toString.call(g)===a},isObject(g){return g instanceof Object},isValidSelector(g){if(typeof g!="string")return!1;var y=g[0];return y==="#"||y==="."||y===y.toUpperCase()},_sign(g){return g===0||g>0?1:-1},requestAnimFrame(g){b.push(g),b.length===1&&v(function(){const y=b;b=[],y.forEach(function(S){S()})})},createCanvasElement(){var g=document.createElement("canvas");try{g.style=g.style||{}}catch{}return g},createImageElement(){return document.createElement("img")},_isInDocument(g){for(;g=g.parentNode;)if(g==document)return!0;return!1},_urlToImage(g,y){var S=e.Util.createImageElement();S.onload=function(){y(S)},S.src=g},_rgbToHex(g,y,S){return((1<<24)+(g<<16)+(y<<8)+S).toString(16).slice(1)},_hexToRgb(g){g=g.replace(u,c);var y=parseInt(g,16);return{r:y>>16&255,g:y>>8&255,b:y&255}},getRandomColor(){for(var g=(Math.random()*16777215<<0).toString(16);g.length<6;)g=d+g;return u+g},getRGB(g){var y;return g in m?(y=m[g],{r:y[0],g:y[1],b:y[2]}):g[0]===u?this._hexToRgb(g.substring(1)):g.substr(0,4)===p?(y=_.exec(g.replace(/ /g,"")),{r:parseInt(y[1],10),g:parseInt(y[2],10),b:parseInt(y[3],10)}):{r:0,g:0,b:0}},colorToRGBA(g){return g=g||"black",e.Util._namedColorToRBA(g)||e.Util._hex3ColorToRGBA(g)||e.Util._hex4ColorToRGBA(g)||e.Util._hex6ColorToRGBA(g)||e.Util._hex8ColorToRGBA(g)||e.Util._rgbColorToRGBA(g)||e.Util._rgbaColorToRGBA(g)||e.Util._hslColorToRGBA(g)},_namedColorToRBA(g){var y=m[g.toLowerCase()];return y?{r:y[0],g:y[1],b:y[2],a:1}:null},_rgbColorToRGBA(g){if(g.indexOf("rgb(")===0){g=g.match(/rgb\(([^)]+)\)/)[1];var y=g.split(/ *, */).map(Number);return{r:y[0],g:y[1],b:y[2],a:1}}},_rgbaColorToRGBA(g){if(g.indexOf("rgba(")===0){g=g.match(/rgba\(([^)]+)\)/)[1];var y=g.split(/ *, */).map((S,w)=>S.slice(-1)==="%"?w===3?parseInt(S)/100:parseInt(S)/100*255:Number(S));return{r:y[0],g:y[1],b:y[2],a:y[3]}}},_hex8ColorToRGBA(g){if(g[0]==="#"&&g.length===9)return{r:parseInt(g.slice(1,3),16),g:parseInt(g.slice(3,5),16),b:parseInt(g.slice(5,7),16),a:parseInt(g.slice(7,9),16)/255}},_hex6ColorToRGBA(g){if(g[0]==="#"&&g.length===7)return{r:parseInt(g.slice(1,3),16),g:parseInt(g.slice(3,5),16),b:parseInt(g.slice(5,7),16),a:1}},_hex4ColorToRGBA(g){if(g[0]==="#"&&g.length===5)return{r:parseInt(g[1]+g[1],16),g:parseInt(g[2]+g[2],16),b:parseInt(g[3]+g[3],16),a:parseInt(g[4]+g[4],16)/255}},_hex3ColorToRGBA(g){if(g[0]==="#"&&g.length===4)return{r:parseInt(g[1]+g[1],16),g:parseInt(g[2]+g[2],16),b:parseInt(g[3]+g[3],16),a:1}},_hslColorToRGBA(g){if(/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.test(g)){const[y,...S]=/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.exec(g),w=Number(S[0])/360,x=Number(S[1])/100,C=Number(S[2])/100;let T,k,P;if(x===0)return P=C*255,{r:Math.round(P),g:Math.round(P),b:Math.round(P),a:1};C<.5?T=C*(1+x):T=C+x-C*x;const $=2*C-T,O=[0,0,0];for(let E=0;E<3;E++)k=w+1/3*-(E-1),k<0&&k++,k>1&&k--,6*k<1?P=$+(T-$)*6*k:2*k<1?P=T:3*k<2?P=$+(T-$)*(2/3-k)*6:P=$,O[E]=P*255;return{r:Math.round(O[0]),g:Math.round(O[1]),b:Math.round(O[2]),a:1}}},haveIntersection(g,y){return!(y.x>g.x+g.width||y.x+y.widthg.y+g.height||y.y+y.height1?(T=S,k=w,P=(S-x)*(S-x)+(w-C)*(w-C)):(T=g+O*(S-g),k=y+O*(w-y),P=(T-x)*(T-x)+(k-C)*(k-C))}return[T,k,P]},_getProjectionToLine(g,y,S){var w=e.Util.cloneObject(g),x=Number.MAX_VALUE;return y.forEach(function(C,T){if(!(!S&&T===y.length-1)){var k=y[(T+1)%y.length],P=e.Util._getProjectionToSegment(C.x,C.y,k.x,k.y,g.x,g.y),$=P[0],O=P[1],E=P[2];Ey.length){var T=y;y=g,g=T}for(w=0;w{y.width=0,y.height=0})},drawRoundedRectPath(g,y,S,w){let x=0,C=0,T=0,k=0;typeof w=="number"?x=C=T=k=Math.min(w,y/2,S/2):(x=Math.min(w[0]||0,y/2,S/2),C=Math.min(w[1]||0,y/2,S/2),k=Math.min(w[2]||0,y/2,S/2),T=Math.min(w[3]||0,y/2,S/2)),g.moveTo(x,0),g.lineTo(y-C,0),g.arc(y-C,C,C,Math.PI*3/2,0,!1),g.lineTo(y,S-k),g.arc(y-k,S-k,k,0,Math.PI/2,!1),g.lineTo(T,S),g.arc(T,S-T,T,Math.PI/2,Math.PI,!1),g.lineTo(0,x),g.arc(x,x,x,Math.PI,Math.PI*3/2,!1)}}})(dr);var rr={},At={},Xe={};Object.defineProperty(Xe,"__esModule",{value:!0});Xe.getComponentValidator=Xe.getBooleanValidator=Xe.getNumberArrayValidator=Xe.getFunctionValidator=Xe.getStringOrGradientValidator=Xe.getStringValidator=Xe.getNumberOrAutoValidator=Xe.getNumberOrArrayOfNumbersValidator=Xe.getNumberValidator=Xe.alphaComponent=Xe.RGBComponent=void 0;const Zl=Rt,vr=dr;function Jl(e){return vr.Util._isString(e)?'"'+e+'"':Object.prototype.toString.call(e)==="[object Number]"||vr.Util._isBoolean(e)?e:Object.prototype.toString.call(e)}function zxe(e){return e>255?255:e<0?0:Math.round(e)}Xe.RGBComponent=zxe;function jxe(e){return e>1?1:e<1e-4?1e-4:e}Xe.alphaComponent=jxe;function Uxe(){if(Zl.Konva.isUnminified)return function(e,t){return vr.Util._isNumber(e)||vr.Util.warn(Jl(e)+' is a not valid value for "'+t+'" attribute. The value should be a number.'),e}}Xe.getNumberValidator=Uxe;function Vxe(e){if(Zl.Konva.isUnminified)return function(t,n){let r=vr.Util._isNumber(t),i=vr.Util._isArray(t)&&t.length==e;return!r&&!i&&vr.Util.warn(Jl(t)+' is a not valid value for "'+n+'" attribute. The value should be a number or Array('+e+")"),t}}Xe.getNumberOrArrayOfNumbersValidator=Vxe;function Gxe(){if(Zl.Konva.isUnminified)return function(e,t){var n=vr.Util._isNumber(e),r=e==="auto";return n||r||vr.Util.warn(Jl(e)+' is a not valid value for "'+t+'" attribute. The value should be a number or "auto".'),e}}Xe.getNumberOrAutoValidator=Gxe;function Hxe(){if(Zl.Konva.isUnminified)return function(e,t){return vr.Util._isString(e)||vr.Util.warn(Jl(e)+' is a not valid value for "'+t+'" attribute. The value should be a string.'),e}}Xe.getStringValidator=Hxe;function qxe(){if(Zl.Konva.isUnminified)return function(e,t){const n=vr.Util._isString(e),r=Object.prototype.toString.call(e)==="[object CanvasGradient]"||e&&e.addColorStop;return n||r||vr.Util.warn(Jl(e)+' is a not valid value for "'+t+'" attribute. The value should be a string or a native gradient.'),e}}Xe.getStringOrGradientValidator=qxe;function Wxe(){if(Zl.Konva.isUnminified)return function(e,t){return vr.Util._isFunction(e)||vr.Util.warn(Jl(e)+' is a not valid value for "'+t+'" attribute. The value should be a function.'),e}}Xe.getFunctionValidator=Wxe;function Kxe(){if(Zl.Konva.isUnminified)return function(e,t){const n=Int8Array?Object.getPrototypeOf(Int8Array):null;return n&&e instanceof n||(vr.Util._isArray(e)?e.forEach(function(r){vr.Util._isNumber(r)||vr.Util.warn('"'+t+'" attribute has non numeric element '+r+". Make sure that all elements are numbers.")}):vr.Util.warn(Jl(e)+' is a not valid value for "'+t+'" attribute. The value should be a array of numbers.')),e}}Xe.getNumberArrayValidator=Kxe;function Qxe(){if(Zl.Konva.isUnminified)return function(e,t){var n=e===!0||e===!1;return n||vr.Util.warn(Jl(e)+' is a not valid value for "'+t+'" attribute. The value should be a boolean.'),e}}Xe.getBooleanValidator=Qxe;function Xxe(e){if(Zl.Konva.isUnminified)return function(t,n){return t==null||vr.Util.isObject(t)||vr.Util.warn(Jl(t)+' is a not valid value for "'+n+'" attribute. The value should be an object with properties '+e),t}}Xe.getComponentValidator=Xxe;(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.Factory=void 0;const t=dr,n=Xe;var r="get",i="set";e.Factory={addGetterSetter(o,a,s,l,u){e.Factory.addGetter(o,a,s),e.Factory.addSetter(o,a,l,u),e.Factory.addOverloadedGetterSetter(o,a)},addGetter(o,a,s){var l=r+t.Util._capitalize(a);o.prototype[l]=o.prototype[l]||function(){var u=this.attrs[a];return u===void 0?s:u}},addSetter(o,a,s,l){var u=i+t.Util._capitalize(a);o.prototype[u]||e.Factory.overWriteSetter(o,a,s,l)},overWriteSetter(o,a,s,l){var u=i+t.Util._capitalize(a);o.prototype[u]=function(c){return s&&c!==void 0&&c!==null&&(c=s.call(this,c,a)),this._setAttr(a,c),l&&l.call(this),this}},addComponentsGetterSetter(o,a,s,l,u){var c=s.length,d=t.Util._capitalize,f=r+d(a),h=i+d(a),p,m;o.prototype[f]=function(){var b={};for(p=0;p{this._setAttr(a+d(y),void 0)}),this._fireChangeEvent(a,v,b),u&&u.call(this),this},e.Factory.addOverloadedGetterSetter(o,a)},addOverloadedGetterSetter(o,a){var s=t.Util._capitalize(a),l=i+s,u=r+s;o.prototype[a]=function(){return arguments.length?(this[l](arguments[0]),this):this[u]()}},addDeprecatedGetterSetter(o,a,s,l){t.Util.error("Adding deprecated "+a);var u=r+t.Util._capitalize(a),c=a+" property is deprecated and will be removed soon. Look at Konva change log for more information.";o.prototype[u]=function(){t.Util.error(c);var d=this.attrs[a];return d===void 0?s:d},e.Factory.addSetter(o,a,l,function(){t.Util.error(c)}),e.Factory.addOverloadedGetterSetter(o,a)},backCompat(o,a){t.Util.each(a,function(s,l){var u=o.prototype[l],c=r+t.Util._capitalize(s),d=i+t.Util._capitalize(s);function f(){u.apply(this,arguments),t.Util.error('"'+s+'" method is deprecated and will be removed soon. Use ""'+l+'" instead.')}o.prototype[s]=f,o.prototype[c]=f,o.prototype[d]=f})},afterSetFilter(){this._filterUpToDate=!1}}})(At);var is={},Nl={};Object.defineProperty(Nl,"__esModule",{value:!0});Nl.HitContext=Nl.SceneContext=Nl.Context=void 0;const gG=dr,Yxe=Rt;function Zxe(e){var t=[],n=e.length,r=gG.Util,i,o;for(i=0;itypeof c=="number"?Math.floor(c):c)),o+=Jxe+u.join(J9)+ewe)):(o+=s.property,t||(o+=owe+s.val)),o+=rwe;return o}clearTrace(){this.traceArr=[]}_trace(t){var n=this.traceArr,r;n.push(t),r=n.length,r>=swe&&n.shift()}reset(){var t=this.getCanvas().getPixelRatio();this.setTransform(1*t,0,0,1*t,0,0)}getCanvas(){return this.canvas}clear(t){var n=this.getCanvas();t?this.clearRect(t.x||0,t.y||0,t.width||0,t.height||0):this.clearRect(0,0,n.getWidth()/n.pixelRatio,n.getHeight()/n.pixelRatio)}_applyLineCap(t){const n=t.attrs.lineCap;n&&this.setAttr("lineCap",n)}_applyOpacity(t){var n=t.getAbsoluteOpacity();n!==1&&this.setAttr("globalAlpha",n)}_applyLineJoin(t){const n=t.attrs.lineJoin;n&&this.setAttr("lineJoin",n)}setAttr(t,n){this._context[t]=n}arc(t,n,r,i,o,a){this._context.arc(t,n,r,i,o,a)}arcTo(t,n,r,i,o){this._context.arcTo(t,n,r,i,o)}beginPath(){this._context.beginPath()}bezierCurveTo(t,n,r,i,o,a){this._context.bezierCurveTo(t,n,r,i,o,a)}clearRect(t,n,r,i){this._context.clearRect(t,n,r,i)}clip(...t){this._context.clip.apply(this._context,t)}closePath(){this._context.closePath()}createImageData(t,n){var r=arguments;if(r.length===2)return this._context.createImageData(t,n);if(r.length===1)return this._context.createImageData(t)}createLinearGradient(t,n,r,i){return this._context.createLinearGradient(t,n,r,i)}createPattern(t,n){return this._context.createPattern(t,n)}createRadialGradient(t,n,r,i,o,a){return this._context.createRadialGradient(t,n,r,i,o,a)}drawImage(t,n,r,i,o,a,s,l,u){var c=arguments,d=this._context;c.length===3?d.drawImage(t,n,r):c.length===5?d.drawImage(t,n,r,i,o):c.length===9&&d.drawImage(t,n,r,i,o,a,s,l,u)}ellipse(t,n,r,i,o,a,s,l){this._context.ellipse(t,n,r,i,o,a,s,l)}isPointInPath(t,n,r,i){return r?this._context.isPointInPath(r,t,n,i):this._context.isPointInPath(t,n,i)}fill(...t){this._context.fill.apply(this._context,t)}fillRect(t,n,r,i){this._context.fillRect(t,n,r,i)}strokeRect(t,n,r,i){this._context.strokeRect(t,n,r,i)}fillText(t,n,r,i){i?this._context.fillText(t,n,r,i):this._context.fillText(t,n,r)}measureText(t){return this._context.measureText(t)}getImageData(t,n,r,i){return this._context.getImageData(t,n,r,i)}lineTo(t,n){this._context.lineTo(t,n)}moveTo(t,n){this._context.moveTo(t,n)}rect(t,n,r,i){this._context.rect(t,n,r,i)}putImageData(t,n,r){this._context.putImageData(t,n,r)}quadraticCurveTo(t,n,r,i){this._context.quadraticCurveTo(t,n,r,i)}restore(){this._context.restore()}rotate(t){this._context.rotate(t)}save(){this._context.save()}scale(t,n){this._context.scale(t,n)}setLineDash(t){this._context.setLineDash?this._context.setLineDash(t):"mozDash"in this._context?this._context.mozDash=t:"webkitLineDash"in this._context&&(this._context.webkitLineDash=t)}getLineDash(){return this._context.getLineDash()}setTransform(t,n,r,i,o,a){this._context.setTransform(t,n,r,i,o,a)}stroke(t){t?this._context.stroke(t):this._context.stroke()}strokeText(t,n,r,i){this._context.strokeText(t,n,r,i)}transform(t,n,r,i,o,a){this._context.transform(t,n,r,i,o,a)}translate(t,n){this._context.translate(t,n)}_enableTrace(){var t=this,n=eO.length,r=this.setAttr,i,o,a=function(s){var l=t[s],u;t[s]=function(){return o=Zxe(Array.prototype.slice.call(arguments,0)),u=l.apply(t,arguments),t._trace({method:s,args:o}),u}};for(i=0;i{i.dragStatus==="dragging"&&(r=!0)}),r},justDragged:!1,get node(){var r;return e.DD._dragElements.forEach(i=>{r=i.node}),r},_dragElements:new Map,_drag(r){const i=[];e.DD._dragElements.forEach((o,a)=>{const{node:s}=o,l=s.getStage();l.setPointersPositions(r),o.pointerId===void 0&&(o.pointerId=n.Util._getFirstPointerId(r));const u=l._changedPointerPositions.find(f=>f.id===o.pointerId);if(u){if(o.dragStatus!=="dragging"){var c=s.dragDistance(),d=Math.max(Math.abs(u.x-o.startPointerPos.x),Math.abs(u.y-o.startPointerPos.y));if(d{o.fire("dragmove",{type:"dragmove",target:o,evt:r},!0)})},_endDragBefore(r){const i=[];e.DD._dragElements.forEach(o=>{const{node:a}=o,s=a.getStage();if(r&&s.setPointersPositions(r),!s._changedPointerPositions.find(c=>c.id===o.pointerId))return;(o.dragStatus==="dragging"||o.dragStatus==="stopped")&&(e.DD.justDragged=!0,t.Konva._mouseListenClick=!1,t.Konva._touchListenClick=!1,t.Konva._pointerListenClick=!1,o.dragStatus="stopped");const u=o.node.getLayer()||o.node instanceof t.Konva.Stage&&o.node;u&&i.indexOf(u)===-1&&i.push(u)}),i.forEach(o=>{o.draw()})},_endDragAfter(r){e.DD._dragElements.forEach((i,o)=>{i.dragStatus==="stopped"&&i.node.fire("dragend",{type:"dragend",target:i.node,evt:r},!0),i.dragStatus!=="dragging"&&e.DD._dragElements.delete(o)})}},t.Konva.isBrowser&&(window.addEventListener("mouseup",e.DD._endDragBefore,!0),window.addEventListener("touchend",e.DD._endDragBefore,!0),window.addEventListener("mousemove",e.DD._drag),window.addEventListener("touchmove",e.DD._drag),window.addEventListener("mouseup",e.DD._endDragAfter,!1),window.addEventListener("touchend",e.DD._endDragAfter,!1))})(ix);Object.defineProperty(rr,"__esModule",{value:!0});rr.Node=void 0;const Nt=dr,wy=At,Bv=is,Mc=Rt,sa=ix,kr=Xe;var V1="absoluteOpacity",zv="allEventListeners",gl="absoluteTransform",tO="absoluteScale",Nc="canvas",gwe="Change",mwe="children",ywe="konva",HE="listening",nO="mouseenter",rO="mouseleave",iO="set",oO="Shape",G1=" ",aO="stage",fu="transform",vwe="Stage",qE="visible",bwe=["xChange.konva","yChange.konva","scaleXChange.konva","scaleYChange.konva","skewXChange.konva","skewYChange.konva","rotationChange.konva","offsetXChange.konva","offsetYChange.konva","transformsEnabledChange.konva"].join(G1);let _we=1;class ft{constructor(t){this._id=_we++,this.eventListeners={},this.attrs={},this.index=0,this._allEventListeners=null,this.parent=null,this._cache=new Map,this._attachedDepsListeners=new Map,this._lastPos=null,this._batchingTransformChange=!1,this._needClearTransformCache=!1,this._filterUpToDate=!1,this._isUnderCache=!1,this._dragEventId=null,this._shouldFireChangeEvents=!1,this.setAttrs(t),this._shouldFireChangeEvents=!0}hasChildren(){return!1}_clearCache(t){(t===fu||t===gl)&&this._cache.get(t)?this._cache.get(t).dirty=!0:t?this._cache.delete(t):this._cache.clear()}_getCache(t,n){var r=this._cache.get(t),i=t===fu||t===gl,o=r===void 0||i&&r.dirty===!0;return o&&(r=n.call(this),this._cache.set(t,r)),r}_calculate(t,n,r){if(!this._attachedDepsListeners.get(t)){const i=n.map(o=>o+"Change.konva").join(G1);this.on(i,()=>{this._clearCache(t)}),this._attachedDepsListeners.set(t,!0)}return this._getCache(t,r)}_getCanvasCache(){return this._cache.get(Nc)}_clearSelfAndDescendantCache(t){this._clearCache(t),t===gl&&this.fire("absoluteTransformChange")}clearCache(){if(this._cache.has(Nc)){const{scene:t,filter:n,hit:r}=this._cache.get(Nc);Nt.Util.releaseCanvas(t,n,r),this._cache.delete(Nc)}return this._clearSelfAndDescendantCache(),this._requestDraw(),this}cache(t){var n=t||{},r={};(n.x===void 0||n.y===void 0||n.width===void 0||n.height===void 0)&&(r=this.getClientRect({skipTransform:!0,relativeTo:this.getParent()}));var i=Math.ceil(n.width||r.width),o=Math.ceil(n.height||r.height),a=n.pixelRatio,s=n.x===void 0?Math.floor(r.x):n.x,l=n.y===void 0?Math.floor(r.y):n.y,u=n.offset||0,c=n.drawBorder||!1,d=n.hitCanvasPixelRatio||1;if(!i||!o){Nt.Util.error("Can not cache the node. Width or height of the node equals 0. Caching is skipped.");return}i+=u*2+1,o+=u*2+1,s-=u,l-=u;var f=new Bv.SceneCanvas({pixelRatio:a,width:i,height:o}),h=new Bv.SceneCanvas({pixelRatio:a,width:0,height:0,willReadFrequently:!0}),p=new Bv.HitCanvas({pixelRatio:d,width:i,height:o}),m=f.getContext(),_=p.getContext();return p.isCache=!0,f.isCache=!0,this._cache.delete(Nc),this._filterUpToDate=!1,n.imageSmoothingEnabled===!1&&(f.getContext()._context.imageSmoothingEnabled=!1,h.getContext()._context.imageSmoothingEnabled=!1),m.save(),_.save(),m.translate(-s,-l),_.translate(-s,-l),this._isUnderCache=!0,this._clearSelfAndDescendantCache(V1),this._clearSelfAndDescendantCache(tO),this.drawScene(f,this),this.drawHit(p,this),this._isUnderCache=!1,m.restore(),_.restore(),c&&(m.save(),m.beginPath(),m.rect(0,0,i,o),m.closePath(),m.setAttr("strokeStyle","red"),m.setAttr("lineWidth",5),m.stroke(),m.restore()),this._cache.set(Nc,{scene:f,filter:h,hit:p,x:s,y:l}),this._requestDraw(),this}isCached(){return this._cache.has(Nc)}getClientRect(t){throw new Error('abstract "getClientRect" method call')}_transformedRect(t,n){var r=[{x:t.x,y:t.y},{x:t.x+t.width,y:t.y},{x:t.x+t.width,y:t.y+t.height},{x:t.x,y:t.y+t.height}],i,o,a,s,l=this.getAbsoluteTransform(n);return r.forEach(function(u){var c=l.point(u);i===void 0&&(i=a=c.x,o=s=c.y),i=Math.min(i,c.x),o=Math.min(o,c.y),a=Math.max(a,c.x),s=Math.max(s,c.y)}),{x:i,y:o,width:a-i,height:s-o}}_drawCachedSceneCanvas(t){t.save(),t._applyOpacity(this),t._applyGlobalCompositeOperation(this);const n=this._getCanvasCache();t.translate(n.x,n.y);var r=this._getCachedSceneCanvas(),i=r.pixelRatio;t.drawImage(r._canvas,0,0,r.width/i,r.height/i),t.restore()}_drawCachedHitCanvas(t){var n=this._getCanvasCache(),r=n.hit;t.save(),t.translate(n.x,n.y),t.drawImage(r._canvas,0,0,r.width/r.pixelRatio,r.height/r.pixelRatio),t.restore()}_getCachedSceneCanvas(){var t=this.filters(),n=this._getCanvasCache(),r=n.scene,i=n.filter,o=i.getContext(),a,s,l,u;if(t){if(!this._filterUpToDate){var c=r.pixelRatio;i.setSize(r.width/r.pixelRatio,r.height/r.pixelRatio);try{for(a=t.length,o.clear(),o.drawImage(r._canvas,0,0,r.getWidth()/c,r.getHeight()/c),s=o.getImageData(0,0,i.getWidth(),i.getHeight()),l=0;l{var n,r;if(!t)return this;for(n in t)n!==mwe&&(r=iO+Nt.Util._capitalize(n),Nt.Util._isFunction(this[r])?this[r](t[n]):this._setAttr(n,t[n]))}),this}isListening(){return this._getCache(HE,this._isListening)}_isListening(t){if(!this.listening())return!1;const r=this.getParent();return r&&r!==t&&this!==t?r._isListening(t):!0}isVisible(){return this._getCache(qE,this._isVisible)}_isVisible(t){if(!this.visible())return!1;const r=this.getParent();return r&&r!==t&&this!==t?r._isVisible(t):!0}shouldDrawHit(t,n=!1){if(t)return this._isVisible(t)&&this._isListening(t);var r=this.getLayer(),i=!1;sa.DD._dragElements.forEach(a=>{a.dragStatus==="dragging"&&(a.node.nodeType==="Stage"||a.node.getLayer()===r)&&(i=!0)});var o=!n&&!Mc.Konva.hitOnDragEnabled&&i;return this.isListening()&&this.isVisible()&&!o}show(){return this.visible(!0),this}hide(){return this.visible(!1),this}getZIndex(){return this.index||0}getAbsoluteZIndex(){var t=this.getDepth(),n=this,r=0,i,o,a,s;function l(u){for(i=[],o=u.length,a=0;a0&&i[0].getDepth()<=t&&l(i)}return n.nodeType!==vwe&&l(n.getStage().getChildren()),r}getDepth(){for(var t=0,n=this.parent;n;)t++,n=n.parent;return t}_batchTransformChanges(t){this._batchingTransformChange=!0,t(),this._batchingTransformChange=!1,this._needClearTransformCache&&(this._clearCache(fu),this._clearSelfAndDescendantCache(gl)),this._needClearTransformCache=!1}setPosition(t){return this._batchTransformChanges(()=>{this.x(t.x),this.y(t.y)}),this}getPosition(){return{x:this.x(),y:this.y()}}getRelativePointerPosition(){if(!this.getStage())return null;var t=this.getStage().getPointerPosition();if(!t)return null;var n=this.getAbsoluteTransform().copy();return n.invert(),n.point(t)}getAbsolutePosition(t){let n=!1,r=this.parent;for(;r;){if(r.isCached()){n=!0;break}r=r.parent}n&&!t&&(t=!0);var i=this.getAbsoluteTransform(t).getMatrix(),o=new Nt.Transform,a=this.offset();return o.m=i.slice(),o.translate(a.x,a.y),o.getTranslation()}setAbsolutePosition(t){var n=this._clearTransform();this.attrs.x=n.x,this.attrs.y=n.y,delete n.x,delete n.y,this._clearCache(fu);var r=this._getAbsoluteTransform().copy();return r.invert(),r.translate(t.x,t.y),t={x:this.attrs.x+r.getTranslation().x,y:this.attrs.y+r.getTranslation().y},this._setTransform(n),this.setPosition({x:t.x,y:t.y}),this._clearCache(fu),this._clearSelfAndDescendantCache(gl),this}_setTransform(t){var n;for(n in t)this.attrs[n]=t[n]}_clearTransform(){var t={x:this.x(),y:this.y(),rotation:this.rotation(),scaleX:this.scaleX(),scaleY:this.scaleY(),offsetX:this.offsetX(),offsetY:this.offsetY(),skewX:this.skewX(),skewY:this.skewY()};return this.attrs.x=0,this.attrs.y=0,this.attrs.rotation=0,this.attrs.scaleX=1,this.attrs.scaleY=1,this.attrs.offsetX=0,this.attrs.offsetY=0,this.attrs.skewX=0,this.attrs.skewY=0,t}move(t){var n=t.x,r=t.y,i=this.x(),o=this.y();return n!==void 0&&(i+=n),r!==void 0&&(o+=r),this.setPosition({x:i,y:o}),this}_eachAncestorReverse(t,n){var r=[],i=this.getParent(),o,a;if(!(n&&n._id===this._id)){for(r.unshift(this);i&&(!n||i._id!==n._id);)r.unshift(i),i=i.parent;for(o=r.length,a=0;a0?(this.parent.children.splice(t,1),this.parent.children.splice(t-1,0,this),this.parent._setChildrenIndices(),!0):!1}moveToBottom(){if(!this.parent)return Nt.Util.warn("Node has no parent. moveToBottom function is ignored."),!1;var t=this.index;return t>0?(this.parent.children.splice(t,1),this.parent.children.unshift(this),this.parent._setChildrenIndices(),!0):!1}setZIndex(t){if(!this.parent)return Nt.Util.warn("Node has no parent. zIndex parameter is ignored."),this;(t<0||t>=this.parent.children.length)&&Nt.Util.warn("Unexpected value "+t+" for zIndex property. zIndex is just index of a node in children of its parent. Expected value is from 0 to "+(this.parent.children.length-1)+".");var n=this.index;return this.parent.children.splice(n,1),this.parent.children.splice(t,0,this),this.parent._setChildrenIndices(),this}getAbsoluteOpacity(){return this._getCache(V1,this._getAbsoluteOpacity)}_getAbsoluteOpacity(){var t=this.opacity(),n=this.getParent();return n&&!n._isUnderCache&&(t*=n.getAbsoluteOpacity()),t}moveTo(t){return this.getParent()!==t&&(this._remove(),t.add(this)),this}toObject(){var t={},n=this.getAttrs(),r,i,o,a,s;t.attrs={};for(r in n)i=n[r],s=Nt.Util.isObject(i)&&!Nt.Util._isPlainObject(i)&&!Nt.Util._isArray(i),!s&&(o=typeof this[r]=="function"&&this[r],delete n[r],a=o?o.call(this):null,n[r]=i,a!==i&&(t.attrs[r]=i));return t.className=this.getClassName(),Nt.Util._prepareToStringify(t)}toJSON(){return JSON.stringify(this.toObject())}getParent(){return this.parent}findAncestors(t,n,r){var i=[];n&&this._isMatch(t)&&i.push(this);for(var o=this.parent;o;){if(o===r)return i;o._isMatch(t)&&i.push(o),o=o.parent}return i}isAncestorOf(t){return!1}findAncestor(t,n,r){return this.findAncestors(t,n,r)[0]}_isMatch(t){if(!t)return!1;if(typeof t=="function")return t(this);var n=t.replace(/ /g,"").split(","),r=n.length,i,o;for(i=0;i{try{const i=t==null?void 0:t.callback;i&&delete t.callback,Nt.Util._urlToImage(this.toDataURL(t),function(o){n(o),i==null||i(o)})}catch(i){r(i)}})}toBlob(t){return new Promise((n,r)=>{try{const i=t==null?void 0:t.callback;i&&delete t.callback,this.toCanvas(t).toBlob(o=>{n(o),i==null||i(o)})}catch(i){r(i)}})}setSize(t){return this.width(t.width),this.height(t.height),this}getSize(){return{width:this.width(),height:this.height()}}getClassName(){return this.className||this.nodeType}getType(){return this.nodeType}getDragDistance(){return this.attrs.dragDistance!==void 0?this.attrs.dragDistance:this.parent?this.parent.getDragDistance():Mc.Konva.dragDistance}_off(t,n,r){var i=this.eventListeners[t],o,a,s;for(o=0;o=0;if(r&&!this.isDragging()){var i=!1;sa.DD._dragElements.forEach(o=>{this.isAncestorOf(o.node)&&(i=!0)}),i||this._createDragElement(t)}})}_dragChange(){if(this.attrs.draggable)this._listenDrag();else{this._dragCleanup();var t=this.getStage();if(!t)return;const n=sa.DD._dragElements.get(this._id),r=n&&n.dragStatus==="dragging",i=n&&n.dragStatus==="ready";r?this.stopDrag():i&&sa.DD._dragElements.delete(this._id)}}_dragCleanup(){this.off("mousedown.konva"),this.off("touchstart.konva")}isClientRectOnScreen(t={x:0,y:0}){const n=this.getStage();if(!n)return!1;const r={x:-t.x,y:-t.y,width:n.width()+2*t.x,height:n.height()+2*t.y};return Nt.Util.haveIntersection(r,this.getClientRect())}static create(t,n){return Nt.Util._isString(t)&&(t=JSON.parse(t)),this._createNode(t,n)}static _createNode(t,n){var r=ft.prototype.getClassName.call(t),i=t.children,o,a,s;n&&(t.attrs.container=n),Mc.Konva[r]||(Nt.Util.warn('Can not find a node with class name "'+r+'". Fallback to "Shape".'),r="Shape");const l=Mc.Konva[r];if(o=new l(t.attrs),i)for(a=i.length,s=0;s0}removeChildren(){return this.getChildren().forEach(t=>{t.parent=null,t.index=0,t.remove()}),this.children=[],this._requestDraw(),this}destroyChildren(){return this.getChildren().forEach(t=>{t.parent=null,t.index=0,t.destroy()}),this.children=[],this._requestDraw(),this}add(...t){if(t.length===0)return this;if(t.length>1){for(var n=0;n0?n[0]:void 0}_generalFind(t,n){var r=[];return this._descendants(i=>{const o=i._isMatch(t);return o&&r.push(i),!!(o&&n)}),r}_descendants(t){let n=!1;const r=this.getChildren();for(const i of r){if(n=t(i),n)return!0;if(i.hasChildren()&&(n=i._descendants(t),n))return!0}return!1}toObject(){var t=qC.Node.prototype.toObject.call(this);return t.children=[],this.getChildren().forEach(n=>{t.children.push(n.toObject())}),t}isAncestorOf(t){for(var n=t.getParent();n;){if(n._id===this._id)return!0;n=n.getParent()}return!1}clone(t){var n=qC.Node.prototype.clone.call(this,t);return this.getChildren().forEach(function(r){n.add(r.clone())}),n}getAllIntersections(t){var n=[];return this.find("Shape").forEach(function(r){r.isVisible()&&r.intersects(t)&&n.push(r)}),n}_clearSelfAndDescendantCache(t){var n;super._clearSelfAndDescendantCache(t),!this.isCached()&&((n=this.children)===null||n===void 0||n.forEach(function(r){r._clearSelfAndDescendantCache(t)}))}_setChildrenIndices(){var t;(t=this.children)===null||t===void 0||t.forEach(function(n,r){n.index=r}),this._requestDraw()}drawScene(t,n){var r=this.getLayer(),i=t||r&&r.getCanvas(),o=i&&i.getContext(),a=this._getCanvasCache(),s=a&&a.scene,l=i&&i.isCache;if(!this.isVisible()&&!l)return this;if(s){o.save();var u=this.getAbsoluteTransform(n).getMatrix();o.transform(u[0],u[1],u[2],u[3],u[4],u[5]),this._drawCachedSceneCanvas(o),o.restore()}else this._drawChildren("drawScene",i,n);return this}drawHit(t,n){if(!this.shouldDrawHit(n))return this;var r=this.getLayer(),i=t||r&&r.hitCanvas,o=i&&i.getContext(),a=this._getCanvasCache(),s=a&&a.hit;if(s){o.save();var l=this.getAbsoluteTransform(n).getMatrix();o.transform(l[0],l[1],l[2],l[3],l[4],l[5]),this._drawCachedHitCanvas(o),o.restore()}else this._drawChildren("drawHit",i,n);return this}_drawChildren(t,n,r){var i,o=n&&n.getContext(),a=this.clipWidth(),s=this.clipHeight(),l=this.clipFunc(),u=a&&s||l;const c=r===this;if(u){o.save();var d=this.getAbsoluteTransform(r),f=d.getMatrix();o.transform(f[0],f[1],f[2],f[3],f[4],f[5]),o.beginPath();let _;if(l)_=l.call(this,o,this);else{var h=this.clipX(),p=this.clipY();o.rect(h,p,a,s)}o.clip.apply(o,_),f=d.copy().invert().getMatrix(),o.transform(f[0],f[1],f[2],f[3],f[4],f[5])}var m=!c&&this.globalCompositeOperation()!=="source-over"&&t==="drawScene";m&&(o.save(),o._applyGlobalCompositeOperation(this)),(i=this.children)===null||i===void 0||i.forEach(function(_){_[t](n,r)}),m&&o.restore(),u&&o.restore()}getClientRect(t){var n;t=t||{};var r=t.skipTransform,i=t.relativeTo,o,a,s,l,u={x:1/0,y:1/0,width:0,height:0},c=this;(n=this.children)===null||n===void 0||n.forEach(function(m){if(m.visible()){var _=m.getClientRect({relativeTo:c,skipShadow:t.skipShadow,skipStroke:t.skipStroke});_.width===0&&_.height===0||(o===void 0?(o=_.x,a=_.y,s=_.x+_.width,l=_.y+_.height):(o=Math.min(o,_.x),a=Math.min(a,_.y),s=Math.max(s,_.x+_.width),l=Math.max(l,_.y+_.height)))}});for(var d=this.find("Shape"),f=!1,h=0;hJ.indexOf("pointer")>=0?"pointer":J.indexOf("touch")>=0?"touch":"mouse",U=J=>{const j=B(J);if(j==="pointer")return i.Konva.pointerEventsEnabled&&N.pointer;if(j==="touch")return N.touch;if(j==="mouse")return N.mouse};function G(J={}){return(J.clipFunc||J.clipWidth||J.clipHeight)&&t.Util.warn("Stage does not support clipping. Please use clip for Layers or Groups."),J}const Y="Pointer position is missing and not registered by the stage. Looks like it is outside of the stage container. You can set it manually from event: stage.setPointersPositions(event);";e.stages=[];class ee extends r.Container{constructor(j){super(G(j)),this._pointerPositions=[],this._changedPointerPositions=[],this._buildDOM(),this._bindContentEvents(),e.stages.push(this),this.on("widthChange.konva heightChange.konva",this._resizeDOM),this.on("visibleChange.konva",this._checkVisibility),this.on("clipWidthChange.konva clipHeightChange.konva clipFuncChange.konva",()=>{G(this.attrs)}),this._checkVisibility()}_validateAdd(j){const Q=j.getType()==="Layer",ne=j.getType()==="FastLayer";Q||ne||t.Util.throw("You may only add layers to the stage.")}_checkVisibility(){if(!this.content)return;const j=this.visible()?"":"none";this.content.style.display=j}setContainer(j){if(typeof j===c){if(j.charAt(0)==="."){var Q=j.slice(1);j=document.getElementsByClassName(Q)[0]}else{var ne;j.charAt(0)!=="#"?ne=j:ne=j.slice(1),j=document.getElementById(ne)}if(!j)throw"Can not find container in document with id "+ne}return this._setAttr("container",j),this.content&&(this.content.parentElement&&this.content.parentElement.removeChild(this.content),j.appendChild(this.content)),this}shouldDrawHit(){return!0}clear(){var j=this.children,Q=j.length,ne;for(ne=0;ne-1&&e.stages.splice(Q,1),t.Util.releaseCanvas(this.bufferCanvas._canvas,this.bufferHitCanvas._canvas),this}getPointerPosition(){const j=this._pointerPositions[0]||this._changedPointerPositions[0];return j?{x:j.x,y:j.y}:(t.Util.warn(Y),null)}_getPointerById(j){return this._pointerPositions.find(Q=>Q.id===j)}getPointersPositions(){return this._pointerPositions}getStage(){return this}getContent(){return this.content}_toKonvaCanvas(j){j=j||{},j.x=j.x||0,j.y=j.y||0,j.width=j.width||this.width(),j.height=j.height||this.height();var Q=new o.SceneCanvas({width:j.width,height:j.height,pixelRatio:j.pixelRatio||1}),ne=Q.getContext()._context,se=this.children;return(j.x||j.y)&&ne.translate(-1*j.x,-1*j.y),se.forEach(function(ve){if(ve.isVisible()){var ce=ve._toKonvaCanvas(j);ne.drawImage(ce._canvas,j.x,j.y,ce.getWidth()/ce.getPixelRatio(),ce.getHeight()/ce.getPixelRatio())}}),Q}getIntersection(j){if(!j)return null;var Q=this.children,ne=Q.length,se=ne-1,ve;for(ve=se;ve>=0;ve--){const ce=Q[ve].getIntersection(j);if(ce)return ce}return null}_resizeDOM(){var j=this.width(),Q=this.height();this.content&&(this.content.style.width=j+d,this.content.style.height=Q+d),this.bufferCanvas.setSize(j,Q),this.bufferHitCanvas.setSize(j,Q),this.children.forEach(ne=>{ne.setSize({width:j,height:Q}),ne.draw()})}add(j,...Q){if(arguments.length>1){for(var ne=0;neM&&t.Util.warn("The stage has "+se+" layers. Recommended maximum number of layers is 3-5. Adding more layers into the stage may drop the performance. Rethink your tree structure, you can use Konva.Group."),j.setSize({width:this.width(),height:this.height()}),j.draw(),i.Konva.isBrowser&&this.content.appendChild(j.canvas._canvas),this}getParent(){return null}getLayer(){return null}hasPointerCapture(j){return l.hasPointerCapture(j,this)}setPointerCapture(j){l.setPointerCapture(j,this)}releaseCapture(j){l.releaseCapture(j,this)}getLayers(){return this.children}_bindContentEvents(){i.Konva.isBrowser&&R.forEach(([j,Q])=>{this.content.addEventListener(j,ne=>{this[Q](ne)},{passive:!1})})}_pointerenter(j){this.setPointersPositions(j);const Q=U(j.type);this._fire(Q.pointerenter,{evt:j,target:this,currentTarget:this})}_pointerover(j){this.setPointersPositions(j);const Q=U(j.type);this._fire(Q.pointerover,{evt:j,target:this,currentTarget:this})}_getTargetShape(j){let Q=this[j+"targetShape"];return Q&&!Q.getStage()&&(Q=null),Q}_pointerleave(j){const Q=U(j.type),ne=B(j.type);if(Q){this.setPointersPositions(j);var se=this._getTargetShape(ne),ve=!a.DD.isDragging||i.Konva.hitOnDragEnabled;se&&ve?(se._fireAndBubble(Q.pointerout,{evt:j}),se._fireAndBubble(Q.pointerleave,{evt:j}),this._fire(Q.pointerleave,{evt:j,target:this,currentTarget:this}),this[ne+"targetShape"]=null):ve&&(this._fire(Q.pointerleave,{evt:j,target:this,currentTarget:this}),this._fire(Q.pointerout,{evt:j,target:this,currentTarget:this})),this.pointerPos=void 0,this._pointerPositions=[]}}_pointerdown(j){const Q=U(j.type),ne=B(j.type);if(Q){this.setPointersPositions(j);var se=!1;this._changedPointerPositions.forEach(ve=>{var ce=this.getIntersection(ve);if(a.DD.justDragged=!1,i.Konva["_"+ne+"ListenClick"]=!0,!(ce&&ce.isListening()))return;i.Konva.capturePointerEventsEnabled&&ce.setPointerCapture(ve.id),this[ne+"ClickStartShape"]=ce,ce._fireAndBubble(Q.pointerdown,{evt:j,pointerId:ve.id}),se=!0;const ot=j.type.indexOf("touch")>=0;ce.preventDefault()&&j.cancelable&&ot&&j.preventDefault()}),se||this._fire(Q.pointerdown,{evt:j,target:this,currentTarget:this,pointerId:this._pointerPositions[0].id})}}_pointermove(j){const Q=U(j.type),ne=B(j.type);if(!Q)return;a.DD.isDragging&&a.DD.node.preventDefault()&&j.cancelable&&j.preventDefault(),this.setPointersPositions(j);var se=!a.DD.isDragging||i.Konva.hitOnDragEnabled;if(!se)return;var ve={};let ce=!1;var bt=this._getTargetShape(ne);this._changedPointerPositions.forEach(ot=>{const ze=l.getCapturedShape(ot.id)||this.getIntersection(ot),gt=ot.id,Pe={evt:j,pointerId:gt};var Jt=bt!==ze;if(Jt&&bt&&(bt._fireAndBubble(Q.pointerout,Object.assign({},Pe),ze),bt._fireAndBubble(Q.pointerleave,Object.assign({},Pe),ze)),ze){if(ve[ze._id])return;ve[ze._id]=!0}ze&&ze.isListening()?(ce=!0,Jt&&(ze._fireAndBubble(Q.pointerover,Object.assign({},Pe),bt),ze._fireAndBubble(Q.pointerenter,Object.assign({},Pe),bt),this[ne+"targetShape"]=ze),ze._fireAndBubble(Q.pointermove,Object.assign({},Pe))):bt&&(this._fire(Q.pointerover,{evt:j,target:this,currentTarget:this,pointerId:gt}),this[ne+"targetShape"]=null)}),ce||this._fire(Q.pointermove,{evt:j,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id})}_pointerup(j){const Q=U(j.type),ne=B(j.type);if(!Q)return;this.setPointersPositions(j);const se=this[ne+"ClickStartShape"],ve=this[ne+"ClickEndShape"];var ce={};let bt=!1;this._changedPointerPositions.forEach(ot=>{const ze=l.getCapturedShape(ot.id)||this.getIntersection(ot);if(ze){if(ze.releaseCapture(ot.id),ce[ze._id])return;ce[ze._id]=!0}const gt=ot.id,Pe={evt:j,pointerId:gt};let Jt=!1;i.Konva["_"+ne+"InDblClickWindow"]?(Jt=!0,clearTimeout(this[ne+"DblTimeout"])):a.DD.justDragged||(i.Konva["_"+ne+"InDblClickWindow"]=!0,clearTimeout(this[ne+"DblTimeout"])),this[ne+"DblTimeout"]=setTimeout(function(){i.Konva["_"+ne+"InDblClickWindow"]=!1},i.Konva.dblClickWindow),ze&&ze.isListening()?(bt=!0,this[ne+"ClickEndShape"]=ze,ze._fireAndBubble(Q.pointerup,Object.assign({},Pe)),i.Konva["_"+ne+"ListenClick"]&&se&&se===ze&&(ze._fireAndBubble(Q.pointerclick,Object.assign({},Pe)),Jt&&ve&&ve===ze&&ze._fireAndBubble(Q.pointerdblclick,Object.assign({},Pe)))):(this[ne+"ClickEndShape"]=null,i.Konva["_"+ne+"ListenClick"]&&this._fire(Q.pointerclick,{evt:j,target:this,currentTarget:this,pointerId:gt}),Jt&&this._fire(Q.pointerdblclick,{evt:j,target:this,currentTarget:this,pointerId:gt}))}),bt||this._fire(Q.pointerup,{evt:j,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id}),i.Konva["_"+ne+"ListenClick"]=!1,j.cancelable&&ne!=="touch"&&j.preventDefault()}_contextmenu(j){this.setPointersPositions(j);var Q=this.getIntersection(this.getPointerPosition());Q&&Q.isListening()?Q._fireAndBubble($,{evt:j}):this._fire($,{evt:j,target:this,currentTarget:this})}_wheel(j){this.setPointersPositions(j);var Q=this.getIntersection(this.getPointerPosition());Q&&Q.isListening()?Q._fireAndBubble(L,{evt:j}):this._fire(L,{evt:j,target:this,currentTarget:this})}_pointercancel(j){this.setPointersPositions(j);const Q=l.getCapturedShape(j.pointerId)||this.getIntersection(this.getPointerPosition());Q&&Q._fireAndBubble(S,l.createEvent(j)),l.releaseCapture(j.pointerId)}_lostpointercapture(j){l.releaseCapture(j.pointerId)}setPointersPositions(j){var Q=this._getContentPosition(),ne=null,se=null;j=j||window.event,j.touches!==void 0?(this._pointerPositions=[],this._changedPointerPositions=[],Array.prototype.forEach.call(j.touches,ve=>{this._pointerPositions.push({id:ve.identifier,x:(ve.clientX-Q.left)/Q.scaleX,y:(ve.clientY-Q.top)/Q.scaleY})}),Array.prototype.forEach.call(j.changedTouches||j.touches,ve=>{this._changedPointerPositions.push({id:ve.identifier,x:(ve.clientX-Q.left)/Q.scaleX,y:(ve.clientY-Q.top)/Q.scaleY})})):(ne=(j.clientX-Q.left)/Q.scaleX,se=(j.clientY-Q.top)/Q.scaleY,this.pointerPos={x:ne,y:se},this._pointerPositions=[{x:ne,y:se,id:t.Util._getFirstPointerId(j)}],this._changedPointerPositions=[{x:ne,y:se,id:t.Util._getFirstPointerId(j)}])}_setPointerPosition(j){t.Util.warn('Method _setPointerPosition is deprecated. Use "stage.setPointersPositions(event)" instead.'),this.setPointersPositions(j)}_getContentPosition(){if(!this.content||!this.content.getBoundingClientRect)return{top:0,left:0,scaleX:1,scaleY:1};var j=this.content.getBoundingClientRect();return{top:j.top,left:j.left,scaleX:j.width/this.content.clientWidth||1,scaleY:j.height/this.content.clientHeight||1}}_buildDOM(){if(this.bufferCanvas=new o.SceneCanvas({width:this.width(),height:this.height()}),this.bufferHitCanvas=new o.HitCanvas({pixelRatio:1,width:this.width(),height:this.height()}),!!i.Konva.isBrowser){var j=this.container();if(!j)throw"Stage has no container. A container is required.";j.innerHTML="",this.content=document.createElement("div"),this.content.style.position="relative",this.content.style.userSelect="none",this.content.className="konvajs-content",this.content.setAttribute("role","presentation"),j.appendChild(this.content),this._resizeDOM()}}cache(){return t.Util.warn("Cache function is not allowed for stage. You may use cache only for layers, groups and shapes."),this}clearCache(){return this}batchDraw(){return this.getChildren().forEach(function(j){j.batchDraw()}),this}}e.Stage=ee,ee.prototype.nodeType=u,(0,s._registerNode)(ee),n.Factory.addGetterSetter(ee,"container")})(vG);var Cy={},Yr={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.Shape=e.shapes=void 0;const t=Rt,n=dr,r=At,i=rr,o=Xe,a=Rt,s=Go;var l="hasShadow",u="shadowRGBA",c="patternImage",d="linearGradient",f="radialGradient";let h;function p(){return h||(h=n.Util.createCanvasElement().getContext("2d"),h)}e.shapes={};function m(T){const k=this.attrs.fillRule;k?T.fill(k):T.fill()}function _(T){T.stroke()}function b(T){T.fill()}function v(T){T.stroke()}function g(){this._clearCache(l)}function y(){this._clearCache(u)}function S(){this._clearCache(c)}function w(){this._clearCache(d)}function x(){this._clearCache(f)}class C extends i.Node{constructor(k){super(k);let P;for(;P=n.Util.getRandomColor(),!(P&&!(P in e.shapes)););this.colorKey=P,e.shapes[P]=this}getContext(){return n.Util.warn("shape.getContext() method is deprecated. Please do not use it."),this.getLayer().getContext()}getCanvas(){return n.Util.warn("shape.getCanvas() method is deprecated. Please do not use it."),this.getLayer().getCanvas()}getSceneFunc(){return this.attrs.sceneFunc||this._sceneFunc}getHitFunc(){return this.attrs.hitFunc||this._hitFunc}hasShadow(){return this._getCache(l,this._hasShadow)}_hasShadow(){return this.shadowEnabled()&&this.shadowOpacity()!==0&&!!(this.shadowColor()||this.shadowBlur()||this.shadowOffsetX()||this.shadowOffsetY())}_getFillPattern(){return this._getCache(c,this.__getFillPattern)}__getFillPattern(){if(this.fillPatternImage()){var k=p();const P=k.createPattern(this.fillPatternImage(),this.fillPatternRepeat()||"repeat");if(P&&P.setTransform){const $=new n.Transform;$.translate(this.fillPatternX(),this.fillPatternY()),$.rotate(t.Konva.getAngle(this.fillPatternRotation())),$.scale(this.fillPatternScaleX(),this.fillPatternScaleY()),$.translate(-1*this.fillPatternOffsetX(),-1*this.fillPatternOffsetY());const O=$.getMatrix(),E=typeof DOMMatrix>"u"?{a:O[0],b:O[1],c:O[2],d:O[3],e:O[4],f:O[5]}:new DOMMatrix(O);P.setTransform(E)}return P}}_getLinearGradient(){return this._getCache(d,this.__getLinearGradient)}__getLinearGradient(){var k=this.fillLinearGradientColorStops();if(k){for(var P=p(),$=this.fillLinearGradientStartPoint(),O=this.fillLinearGradientEndPoint(),E=P.createLinearGradient($.x,$.y,O.x,O.y),A=0;Athis.fillEnabled()&&!!(this.fill()||this.fillPatternImage()||this.fillLinearGradientColorStops()||this.fillRadialGradientColorStops()))}hasStroke(){return this._calculate("hasStroke",["strokeEnabled","strokeWidth","stroke","strokeLinearGradientColorStops"],()=>this.strokeEnabled()&&this.strokeWidth()&&!!(this.stroke()||this.strokeLinearGradientColorStops()))}hasHitStroke(){const k=this.hitStrokeWidth();return k==="auto"?this.hasStroke():this.strokeEnabled()&&!!k}intersects(k){var P=this.getStage(),$=P.bufferHitCanvas,O;return $.getContext().clear(),this.drawHit($,null,!0),O=$.context.getImageData(Math.round(k.x),Math.round(k.y),1,1).data,O[3]>0}destroy(){return i.Node.prototype.destroy.call(this),delete e.shapes[this.colorKey],delete this.colorKey,this}_useBufferCanvas(k){var P;if(!this.getStage()||!((P=this.attrs.perfectDrawEnabled)!==null&&P!==void 0?P:!0))return!1;const O=k||this.hasFill(),E=this.hasStroke(),A=this.getAbsoluteOpacity()!==1;if(O&&E&&A)return!0;const D=this.hasShadow(),L=this.shadowForStrokeEnabled();return!!(O&&E&&D&&L)}setStrokeHitEnabled(k){n.Util.warn("strokeHitEnabled property is deprecated. Please use hitStrokeWidth instead."),k?this.hitStrokeWidth("auto"):this.hitStrokeWidth(0)}getStrokeHitEnabled(){return this.hitStrokeWidth()!==0}getSelfRect(){var k=this.size();return{x:this._centroid?-k.width/2:0,y:this._centroid?-k.height/2:0,width:k.width,height:k.height}}getClientRect(k={}){const P=k.skipTransform,$=k.relativeTo,O=this.getSelfRect(),A=!k.skipStroke&&this.hasStroke()&&this.strokeWidth()||0,D=O.width+A,L=O.height+A,M=!k.skipShadow&&this.hasShadow(),R=M?this.shadowOffsetX():0,N=M?this.shadowOffsetY():0,B=D+Math.abs(R),U=L+Math.abs(N),G=M&&this.shadowBlur()||0,Y=B+G*2,ee=U+G*2,J={width:Y,height:ee,x:-(A/2+G)+Math.min(R,0)+O.x,y:-(A/2+G)+Math.min(N,0)+O.y};return P?J:this._transformedRect(J,$)}drawScene(k,P){var $=this.getLayer(),O=k||$.getCanvas(),E=O.getContext(),A=this._getCanvasCache(),D=this.getSceneFunc(),L=this.hasShadow(),M,R,N,B=O.isCache,U=P===this;if(!this.isVisible()&&!U)return this;if(A){E.save();var G=this.getAbsoluteTransform(P).getMatrix();return E.transform(G[0],G[1],G[2],G[3],G[4],G[5]),this._drawCachedSceneCanvas(E),E.restore(),this}if(!D)return this;if(E.save(),this._useBufferCanvas()&&!B){M=this.getStage(),R=M.bufferCanvas,N=R.getContext(),N.clear(),N.save(),N._applyLineJoin(this);var Y=this.getAbsoluteTransform(P).getMatrix();N.transform(Y[0],Y[1],Y[2],Y[3],Y[4],Y[5]),D.call(this,N,this),N.restore();var ee=R.pixelRatio;L&&E._applyShadow(this),E._applyOpacity(this),E._applyGlobalCompositeOperation(this),E.drawImage(R._canvas,0,0,R.width/ee,R.height/ee)}else{if(E._applyLineJoin(this),!U){var Y=this.getAbsoluteTransform(P).getMatrix();E.transform(Y[0],Y[1],Y[2],Y[3],Y[4],Y[5]),E._applyOpacity(this),E._applyGlobalCompositeOperation(this)}L&&E._applyShadow(this),D.call(this,E,this)}return E.restore(),this}drawHit(k,P,$=!1){if(!this.shouldDrawHit(P,$))return this;var O=this.getLayer(),E=k||O.hitCanvas,A=E&&E.getContext(),D=this.hitFunc()||this.sceneFunc(),L=this._getCanvasCache(),M=L&&L.hit;if(this.colorKey||n.Util.warn("Looks like your canvas has a destroyed shape in it. Do not reuse shape after you destroyed it. If you want to reuse shape you should call remove() instead of destroy()"),M){A.save();var R=this.getAbsoluteTransform(P).getMatrix();return A.transform(R[0],R[1],R[2],R[3],R[4],R[5]),this._drawCachedHitCanvas(A),A.restore(),this}if(!D)return this;if(A.save(),A._applyLineJoin(this),!(this===P)){var B=this.getAbsoluteTransform(P).getMatrix();A.transform(B[0],B[1],B[2],B[3],B[4],B[5])}return D.call(this,A,this),A.restore(),this}drawHitFromCache(k=0){var P=this._getCanvasCache(),$=this._getCachedSceneCanvas(),O=P.hit,E=O.getContext(),A=O.getWidth(),D=O.getHeight(),L,M,R,N,B,U;E.clear(),E.drawImage($._canvas,0,0,A,D);try{for(L=E.getImageData(0,0,A,D),M=L.data,R=M.length,N=n.Util._hexToRgb(this.colorKey),B=0;Bk?(M[B]=N.r,M[B+1]=N.g,M[B+2]=N.b,M[B+3]=255):M[B+3]=0;E.putImageData(L,0,0)}catch(G){n.Util.error("Unable to draw hit graph from cached scene canvas. "+G.message)}return this}hasPointerCapture(k){return s.hasPointerCapture(k,this)}setPointerCapture(k){s.setPointerCapture(k,this)}releaseCapture(k){s.releaseCapture(k,this)}}e.Shape=C,C.prototype._fillFunc=m,C.prototype._strokeFunc=_,C.prototype._fillFuncHit=b,C.prototype._strokeFuncHit=v,C.prototype._centroid=!1,C.prototype.nodeType="Shape",(0,a._registerNode)(C),C.prototype.eventListeners={},C.prototype.on.call(C.prototype,"shadowColorChange.konva shadowBlurChange.konva shadowOffsetChange.konva shadowOpacityChange.konva shadowEnabledChange.konva",g),C.prototype.on.call(C.prototype,"shadowColorChange.konva shadowOpacityChange.konva shadowEnabledChange.konva",y),C.prototype.on.call(C.prototype,"fillPriorityChange.konva fillPatternImageChange.konva fillPatternRepeatChange.konva fillPatternScaleXChange.konva fillPatternScaleYChange.konva fillPatternOffsetXChange.konva fillPatternOffsetYChange.konva fillPatternXChange.konva fillPatternYChange.konva fillPatternRotationChange.konva",S),C.prototype.on.call(C.prototype,"fillPriorityChange.konva fillLinearGradientColorStopsChange.konva fillLinearGradientStartPointXChange.konva fillLinearGradientStartPointYChange.konva fillLinearGradientEndPointXChange.konva fillLinearGradientEndPointYChange.konva",w),C.prototype.on.call(C.prototype,"fillPriorityChange.konva fillRadialGradientColorStopsChange.konva fillRadialGradientStartPointXChange.konva fillRadialGradientStartPointYChange.konva fillRadialGradientEndPointXChange.konva fillRadialGradientEndPointYChange.konva fillRadialGradientStartRadiusChange.konva fillRadialGradientEndRadiusChange.konva",x),r.Factory.addGetterSetter(C,"stroke",void 0,(0,o.getStringOrGradientValidator)()),r.Factory.addGetterSetter(C,"strokeWidth",2,(0,o.getNumberValidator)()),r.Factory.addGetterSetter(C,"fillAfterStrokeEnabled",!1),r.Factory.addGetterSetter(C,"hitStrokeWidth","auto",(0,o.getNumberOrAutoValidator)()),r.Factory.addGetterSetter(C,"strokeHitEnabled",!0,(0,o.getBooleanValidator)()),r.Factory.addGetterSetter(C,"perfectDrawEnabled",!0,(0,o.getBooleanValidator)()),r.Factory.addGetterSetter(C,"shadowForStrokeEnabled",!0,(0,o.getBooleanValidator)()),r.Factory.addGetterSetter(C,"lineJoin"),r.Factory.addGetterSetter(C,"lineCap"),r.Factory.addGetterSetter(C,"sceneFunc"),r.Factory.addGetterSetter(C,"hitFunc"),r.Factory.addGetterSetter(C,"dash"),r.Factory.addGetterSetter(C,"dashOffset",0,(0,o.getNumberValidator)()),r.Factory.addGetterSetter(C,"shadowColor",void 0,(0,o.getStringValidator)()),r.Factory.addGetterSetter(C,"shadowBlur",0,(0,o.getNumberValidator)()),r.Factory.addGetterSetter(C,"shadowOpacity",1,(0,o.getNumberValidator)()),r.Factory.addComponentsGetterSetter(C,"shadowOffset",["x","y"]),r.Factory.addGetterSetter(C,"shadowOffsetX",0,(0,o.getNumberValidator)()),r.Factory.addGetterSetter(C,"shadowOffsetY",0,(0,o.getNumberValidator)()),r.Factory.addGetterSetter(C,"fillPatternImage"),r.Factory.addGetterSetter(C,"fill",void 0,(0,o.getStringOrGradientValidator)()),r.Factory.addGetterSetter(C,"fillPatternX",0,(0,o.getNumberValidator)()),r.Factory.addGetterSetter(C,"fillPatternY",0,(0,o.getNumberValidator)()),r.Factory.addGetterSetter(C,"fillLinearGradientColorStops"),r.Factory.addGetterSetter(C,"strokeLinearGradientColorStops"),r.Factory.addGetterSetter(C,"fillRadialGradientStartRadius",0),r.Factory.addGetterSetter(C,"fillRadialGradientEndRadius",0),r.Factory.addGetterSetter(C,"fillRadialGradientColorStops"),r.Factory.addGetterSetter(C,"fillPatternRepeat","repeat"),r.Factory.addGetterSetter(C,"fillEnabled",!0),r.Factory.addGetterSetter(C,"strokeEnabled",!0),r.Factory.addGetterSetter(C,"shadowEnabled",!0),r.Factory.addGetterSetter(C,"dashEnabled",!0),r.Factory.addGetterSetter(C,"strokeScaleEnabled",!0),r.Factory.addGetterSetter(C,"fillPriority","color"),r.Factory.addComponentsGetterSetter(C,"fillPatternOffset",["x","y"]),r.Factory.addGetterSetter(C,"fillPatternOffsetX",0,(0,o.getNumberValidator)()),r.Factory.addGetterSetter(C,"fillPatternOffsetY",0,(0,o.getNumberValidator)()),r.Factory.addComponentsGetterSetter(C,"fillPatternScale",["x","y"]),r.Factory.addGetterSetter(C,"fillPatternScaleX",1,(0,o.getNumberValidator)()),r.Factory.addGetterSetter(C,"fillPatternScaleY",1,(0,o.getNumberValidator)()),r.Factory.addComponentsGetterSetter(C,"fillLinearGradientStartPoint",["x","y"]),r.Factory.addComponentsGetterSetter(C,"strokeLinearGradientStartPoint",["x","y"]),r.Factory.addGetterSetter(C,"fillLinearGradientStartPointX",0),r.Factory.addGetterSetter(C,"strokeLinearGradientStartPointX",0),r.Factory.addGetterSetter(C,"fillLinearGradientStartPointY",0),r.Factory.addGetterSetter(C,"strokeLinearGradientStartPointY",0),r.Factory.addComponentsGetterSetter(C,"fillLinearGradientEndPoint",["x","y"]),r.Factory.addComponentsGetterSetter(C,"strokeLinearGradientEndPoint",["x","y"]),r.Factory.addGetterSetter(C,"fillLinearGradientEndPointX",0),r.Factory.addGetterSetter(C,"strokeLinearGradientEndPointX",0),r.Factory.addGetterSetter(C,"fillLinearGradientEndPointY",0),r.Factory.addGetterSetter(C,"strokeLinearGradientEndPointY",0),r.Factory.addComponentsGetterSetter(C,"fillRadialGradientStartPoint",["x","y"]),r.Factory.addGetterSetter(C,"fillRadialGradientStartPointX",0),r.Factory.addGetterSetter(C,"fillRadialGradientStartPointY",0),r.Factory.addComponentsGetterSetter(C,"fillRadialGradientEndPoint",["x","y"]),r.Factory.addGetterSetter(C,"fillRadialGradientEndPointX",0),r.Factory.addGetterSetter(C,"fillRadialGradientEndPointY",0),r.Factory.addGetterSetter(C,"fillPatternRotation",0),r.Factory.addGetterSetter(C,"fillRule",void 0,(0,o.getStringValidator)()),r.Factory.backCompat(C,{dashArray:"dash",getDashArray:"getDash",setDashArray:"getDash",drawFunc:"sceneFunc",getDrawFunc:"getSceneFunc",setDrawFunc:"setSceneFunc",drawHitFunc:"hitFunc",getDrawHitFunc:"getHitFunc",setDrawHitFunc:"setHitFunc"})})(Yr);Object.defineProperty(Cy,"__esModule",{value:!0});Cy.Layer=void 0;const dl=dr,WC=Gd,mf=rr,vA=At,sO=is,Ewe=Xe,kwe=Yr,Twe=Rt;var Awe="#",Pwe="beforeDraw",Iwe="draw",SG=[{x:0,y:0},{x:-1,y:-1},{x:1,y:-1},{x:1,y:1},{x:-1,y:1}],Rwe=SG.length;class _p extends WC.Container{constructor(t){super(t),this.canvas=new sO.SceneCanvas,this.hitCanvas=new sO.HitCanvas({pixelRatio:1}),this._waitingForDraw=!1,this.on("visibleChange.konva",this._checkVisibility),this._checkVisibility(),this.on("imageSmoothingEnabledChange.konva",this._setSmoothEnabled),this._setSmoothEnabled()}createPNGStream(){return this.canvas._canvas.createPNGStream()}getCanvas(){return this.canvas}getNativeCanvasElement(){return this.canvas._canvas}getHitCanvas(){return this.hitCanvas}getContext(){return this.getCanvas().getContext()}clear(t){return this.getContext().clear(t),this.getHitCanvas().getContext().clear(t),this}setZIndex(t){super.setZIndex(t);var n=this.getStage();return n&&n.content&&(n.content.removeChild(this.getNativeCanvasElement()),t{this.draw(),this._waitingForDraw=!1})),this}getIntersection(t){if(!this.isListening()||!this.isVisible())return null;for(var n=1,r=!1;;){for(let i=0;i0)return{antialiased:!0};return{}}drawScene(t,n){var r=this.getLayer(),i=t||r&&r.getCanvas();return this._fire(Pwe,{node:this}),this.clearBeforeDraw()&&i.getContext().clear(),WC.Container.prototype.drawScene.call(this,i,n),this._fire(Iwe,{node:this}),this}drawHit(t,n){var r=this.getLayer(),i=t||r&&r.hitCanvas;return r&&r.clearBeforeDraw()&&r.getHitCanvas().getContext().clear(),WC.Container.prototype.drawHit.call(this,i,n),this}enableHitGraph(){return this.hitGraphEnabled(!0),this}disableHitGraph(){return this.hitGraphEnabled(!1),this}setHitGraphEnabled(t){dl.Util.warn("hitGraphEnabled method is deprecated. Please use layer.listening() instead."),this.listening(t)}getHitGraphEnabled(t){return dl.Util.warn("hitGraphEnabled method is deprecated. Please use layer.listening() instead."),this.listening()}toggleHitCanvas(){if(!(!this.parent||!this.parent.content)){var t=this.parent,n=!!this.hitCanvas._canvas.parentNode;n?t.content.removeChild(this.hitCanvas._canvas):t.content.appendChild(this.hitCanvas._canvas)}}destroy(){return dl.Util.releaseCanvas(this.getNativeCanvasElement(),this.getHitCanvas()._canvas),super.destroy()}}Cy.Layer=_p;_p.prototype.nodeType="Layer";(0,Twe._registerNode)(_p);vA.Factory.addGetterSetter(_p,"imageSmoothingEnabled",!0);vA.Factory.addGetterSetter(_p,"clearBeforeDraw",!0);vA.Factory.addGetterSetter(_p,"hitGraphEnabled",!0,(0,Ewe.getBooleanValidator)());var ax={};Object.defineProperty(ax,"__esModule",{value:!0});ax.FastLayer=void 0;const Owe=dr,Mwe=Cy,Nwe=Rt;class bA extends Mwe.Layer{constructor(t){super(t),this.listening(!1),Owe.Util.warn('Konva.Fast layer is deprecated. Please use "new Konva.Layer({ listening: false })" instead.')}}ax.FastLayer=bA;bA.prototype.nodeType="FastLayer";(0,Nwe._registerNode)(bA);var Sp={};Object.defineProperty(Sp,"__esModule",{value:!0});Sp.Group=void 0;const $we=dr,Dwe=Gd,Lwe=Rt;class _A extends Dwe.Container{_validateAdd(t){var n=t.getType();n!=="Group"&&n!=="Shape"&&$we.Util.throw("You may only add groups and shapes to groups.")}}Sp.Group=_A;_A.prototype.nodeType="Group";(0,Lwe._registerNode)(_A);var xp={};Object.defineProperty(xp,"__esModule",{value:!0});xp.Animation=void 0;const KC=Rt,lO=dr;var QC=function(){return KC.glob.performance&&KC.glob.performance.now?function(){return KC.glob.performance.now()}:function(){return new Date().getTime()}}();class Is{constructor(t,n){this.id=Is.animIdCounter++,this.frame={time:0,timeDiff:0,lastTime:QC(),frameRate:0},this.func=t,this.setLayers(n)}setLayers(t){var n=[];return t?t.length>0?n=t:n=[t]:n=[],this.layers=n,this}getLayers(){return this.layers}addLayer(t){var n=this.layers,r=n.length,i;for(i=0;ithis.duration?this.yoyo?(this._time=this.duration,this.reverse()):this.finish():p<0?this.yoyo?(this._time=0,this.play()):this.reset():(this._time=p,this.update())}getTime(){return this._time}setPosition(p){this.prevPos=this._pos,this.propFunc(p),this._pos=p}getPosition(p){return p===void 0&&(p=this._time),this.func(p,this.begin,this._change,this.duration)}play(){this.state=s,this._startTime=this.getTimer()-this._time,this.onEnterFrame(),this.fire("onPlay")}reverse(){this.state=l,this._time=this.duration-this._time,this._startTime=this.getTimer()-this._time,this.onEnterFrame(),this.fire("onReverse")}seek(p){this.pause(),this._time=p,this.update(),this.fire("onSeek")}reset(){this.pause(),this._time=0,this.update(),this.fire("onReset")}finish(){this.pause(),this._time=this.duration,this.update(),this.fire("onFinish")}update(){this.setPosition(this.getPosition(this._time)),this.fire("onUpdate")}onEnterFrame(){var p=this.getTimer()-this._startTime;this.state===s?this.setTime(p):this.state===l&&this.setTime(this.duration-p)}pause(){this.state=a,this.fire("onPause")}getTimer(){return new Date().getTime()}}class f{constructor(p){var m=this,_=p.node,b=_._id,v,g=p.easing||e.Easings.Linear,y=!!p.yoyo,S;typeof p.duration>"u"?v=.3:p.duration===0?v=.001:v=p.duration,this.node=_,this._id=u++;var w=_.getLayer()||(_ instanceof i.Konva.Stage?_.getLayers():null);w||t.Util.error("Tween constructor have `node` that is not in a layer. Please add node into layer first."),this.anim=new n.Animation(function(){m.tween.onEnterFrame()},w),this.tween=new d(S,function(x){m._tweenFunc(x)},g,0,1,v*1e3,y),this._addListeners(),f.attrs[b]||(f.attrs[b]={}),f.attrs[b][this._id]||(f.attrs[b][this._id]={}),f.tweens[b]||(f.tweens[b]={});for(S in p)o[S]===void 0&&this._addAttr(S,p[S]);this.reset(),this.onFinish=p.onFinish,this.onReset=p.onReset,this.onUpdate=p.onUpdate}_addAttr(p,m){var _=this.node,b=_._id,v,g,y,S,w,x,C,T;if(y=f.tweens[b][p],y&&delete f.attrs[b][y][p],v=_.getAttr(p),t.Util._isArray(m))if(g=[],w=Math.max(m.length,v.length),p==="points"&&m.length!==v.length&&(m.length>v.length?(C=v,v=t.Util._prepareArrayForTween(v,m,_.closed())):(x=m,m=t.Util._prepareArrayForTween(m,v,_.closed()))),p.indexOf("fill")===0)for(S=0;S{this.anim.start()},this.tween.onReverse=()=>{this.anim.start()},this.tween.onPause=()=>{this.anim.stop()},this.tween.onFinish=()=>{var p=this.node,m=f.attrs[p._id][this._id];m.points&&m.points.trueEnd&&p.setAttr("points",m.points.trueEnd),this.onFinish&&this.onFinish.call(this)},this.tween.onReset=()=>{var p=this.node,m=f.attrs[p._id][this._id];m.points&&m.points.trueStart&&p.points(m.points.trueStart),this.onReset&&this.onReset()},this.tween.onUpdate=()=>{this.onUpdate&&this.onUpdate.call(this)}}play(){return this.tween.play(),this}reverse(){return this.tween.reverse(),this}reset(){return this.tween.reset(),this}seek(p){return this.tween.seek(p*1e3),this}pause(){return this.tween.pause(),this}finish(){return this.tween.finish(),this}destroy(){var p=this.node._id,m=this._id,_=f.tweens[p],b;this.pause();for(b in _)delete f.tweens[p][b];delete f.attrs[p][m]}}e.Tween=f,f.attrs={},f.tweens={},r.Node.prototype.to=function(h){var p=h.onFinish;h.node=this,h.onFinish=function(){this.destroy(),p&&p()};var m=new f(h);m.play()},e.Easings={BackEaseIn(h,p,m,_){var b=1.70158;return m*(h/=_)*h*((b+1)*h-b)+p},BackEaseOut(h,p,m,_){var b=1.70158;return m*((h=h/_-1)*h*((b+1)*h+b)+1)+p},BackEaseInOut(h,p,m,_){var b=1.70158;return(h/=_/2)<1?m/2*(h*h*(((b*=1.525)+1)*h-b))+p:m/2*((h-=2)*h*(((b*=1.525)+1)*h+b)+2)+p},ElasticEaseIn(h,p,m,_,b,v){var g=0;return h===0?p:(h/=_)===1?p+m:(v||(v=_*.3),!b||b0?t:n),c=a*n,d=s*(s>0?t:n),f=l*(l>0?n:t);return{x:u,y:r?-1*f:d,width:c-u,height:f-d}}}sx.Arc=eu;eu.prototype._centroid=!0;eu.prototype.className="Arc";eu.prototype._attrsAffectingSize=["innerRadius","outerRadius"];(0,Bwe._registerNode)(eu);lx.Factory.addGetterSetter(eu,"innerRadius",0,(0,ux.getNumberValidator)());lx.Factory.addGetterSetter(eu,"outerRadius",0,(0,ux.getNumberValidator)());lx.Factory.addGetterSetter(eu,"angle",0,(0,ux.getNumberValidator)());lx.Factory.addGetterSetter(eu,"clockwise",!1,(0,ux.getBooleanValidator)());var cx={},Ey={};Object.defineProperty(Ey,"__esModule",{value:!0});Ey.Line=void 0;const dx=At,zwe=Yr,wG=Xe,jwe=Rt;function WE(e,t,n,r,i,o,a){var s=Math.sqrt(Math.pow(n-e,2)+Math.pow(r-t,2)),l=Math.sqrt(Math.pow(i-n,2)+Math.pow(o-r,2)),u=a*s/(s+l),c=a*l/(s+l),d=n-u*(i-e),f=r-u*(o-t),h=n+c*(i-e),p=r+c*(o-t);return[d,f,h,p]}function cO(e,t){var n=e.length,r=[],i,o;for(i=2;i4){for(s=this.getTensionPoints(),l=s.length,u=o?0:4,o||t.quadraticCurveTo(s[0],s[1],s[2],s[3]);u{let u,c,d;u=l/2,c=0;for(let h=0;h<20;h++)d=u*e.tValues[20][h]+u,c+=e.cValues[20][h]*r(a,s,d);return u*c};e.getCubicArcLength=t;const n=(a,s,l)=>{l===void 0&&(l=1);const u=a[0]-2*a[1]+a[2],c=s[0]-2*s[1]+s[2],d=2*a[1]-2*a[0],f=2*s[1]-2*s[0],h=4*(u*u+c*c),p=4*(u*d+c*f),m=d*d+f*f;if(h===0)return l*Math.sqrt(Math.pow(a[2]-a[0],2)+Math.pow(s[2]-s[0],2));const _=p/(2*h),b=m/h,v=l+_,g=b-_*_,y=v*v+g>0?Math.sqrt(v*v+g):0,S=_*_+g>0?Math.sqrt(_*_+g):0,w=_+Math.sqrt(_*_+g)!==0?g*Math.log(Math.abs((v+y)/(_+S))):0;return Math.sqrt(h)/2*(v*y-_*S+w)};e.getQuadraticArcLength=n;function r(a,s,l){const u=i(1,l,a),c=i(1,l,s),d=u*u+c*c;return Math.sqrt(d)}const i=(a,s,l)=>{const u=l.length-1;let c,d;if(u===0)return 0;if(a===0){d=0;for(let f=0;f<=u;f++)d+=e.binomialCoefficients[u][f]*Math.pow(1-s,u-f)*Math.pow(s,f)*l[f];return d}else{c=new Array(u);for(let f=0;f{let u=1,c=a/s,d=(a-l(c))/s,f=0;for(;u>.001;){const h=l(c+d),p=Math.abs(a-h)/s;if(p500)break}return c};e.t2length=o})(CG);Object.defineProperty(wp,"__esModule",{value:!0});wp.Path=void 0;const Uwe=At,Vwe=Yr,Gwe=Rt,yf=CG;class Vr extends Vwe.Shape{constructor(t){super(t),this.dataArray=[],this.pathLength=0,this._readDataAttribute(),this.on("dataChange.konva",function(){this._readDataAttribute()})}_readDataAttribute(){this.dataArray=Vr.parsePathData(this.data()),this.pathLength=Vr.getPathLength(this.dataArray)}_sceneFunc(t){var n=this.dataArray;t.beginPath();for(var r=!1,i=0;ic?u:c,_=u>c?1:u/c,b=u>c?c/u:1;t.translate(s,l),t.rotate(h),t.scale(_,b),t.arc(0,0,m,d,d+f,1-p),t.scale(1/_,1/b),t.rotate(-h),t.translate(-s,-l);break;case"z":r=!0,t.closePath();break}}!r&&!this.hasFill()?t.strokeShape(this):t.fillStrokeShape(this)}getSelfRect(){var t=[];this.dataArray.forEach(function(u){if(u.command==="A"){var c=u.points[4],d=u.points[5],f=u.points[4]+d,h=Math.PI/180;if(Math.abs(c-f)f;p-=h){const m=Vr.getPointOnEllipticalArc(u.points[0],u.points[1],u.points[2],u.points[3],p,0);t.push(m.x,m.y)}else for(let p=c+h;pn[i].pathLength;)t-=n[i].pathLength,++i;if(i===o)return r=n[i-1].points.slice(-2),{x:r[0],y:r[1]};if(t<.01)return r=n[i].points.slice(0,2),{x:r[0],y:r[1]};var a=n[i],s=a.points;switch(a.command){case"L":return Vr.getPointOnLine(t,a.start.x,a.start.y,s[0],s[1]);case"C":return Vr.getPointOnCubicBezier((0,yf.t2length)(t,Vr.getPathLength(n),m=>(0,yf.getCubicArcLength)([a.start.x,s[0],s[2],s[4]],[a.start.y,s[1],s[3],s[5]],m)),a.start.x,a.start.y,s[0],s[1],s[2],s[3],s[4],s[5]);case"Q":return Vr.getPointOnQuadraticBezier((0,yf.t2length)(t,Vr.getPathLength(n),m=>(0,yf.getQuadraticArcLength)([a.start.x,s[0],s[2]],[a.start.y,s[1],s[3]],m)),a.start.x,a.start.y,s[0],s[1],s[2],s[3]);case"A":var l=s[0],u=s[1],c=s[2],d=s[3],f=s[4],h=s[5],p=s[6];return f+=h*t/a.pathLength,Vr.getPointOnEllipticalArc(l,u,c,d,f,p)}return null}static getPointOnLine(t,n,r,i,o,a,s){a===void 0&&(a=n),s===void 0&&(s=r);var l=(o-r)/(i-n+1e-8),u=Math.sqrt(t*t/(1+l*l));i0&&!isNaN(p[0]);){var v=null,g=[],y=l,S=u,w,x,C,T,k,P,$,O,E,A;switch(h){case"l":l+=p.shift(),u+=p.shift(),v="L",g.push(l,u);break;case"L":l=p.shift(),u=p.shift(),g.push(l,u);break;case"m":var D=p.shift(),L=p.shift();if(l+=D,u+=L,v="M",a.length>2&&a[a.length-1].command==="z"){for(var M=a.length-2;M>=0;M--)if(a[M].command==="M"){l=a[M].points[0]+D,u=a[M].points[1]+L;break}}g.push(l,u),h="l";break;case"M":l=p.shift(),u=p.shift(),v="M",g.push(l,u),h="L";break;case"h":l+=p.shift(),v="L",g.push(l,u);break;case"H":l=p.shift(),v="L",g.push(l,u);break;case"v":u+=p.shift(),v="L",g.push(l,u);break;case"V":u=p.shift(),v="L",g.push(l,u);break;case"C":g.push(p.shift(),p.shift(),p.shift(),p.shift()),l=p.shift(),u=p.shift(),g.push(l,u);break;case"c":g.push(l+p.shift(),u+p.shift(),l+p.shift(),u+p.shift()),l+=p.shift(),u+=p.shift(),v="C",g.push(l,u);break;case"S":x=l,C=u,w=a[a.length-1],w.command==="C"&&(x=l+(l-w.points[2]),C=u+(u-w.points[3])),g.push(x,C,p.shift(),p.shift()),l=p.shift(),u=p.shift(),v="C",g.push(l,u);break;case"s":x=l,C=u,w=a[a.length-1],w.command==="C"&&(x=l+(l-w.points[2]),C=u+(u-w.points[3])),g.push(x,C,l+p.shift(),u+p.shift()),l+=p.shift(),u+=p.shift(),v="C",g.push(l,u);break;case"Q":g.push(p.shift(),p.shift()),l=p.shift(),u=p.shift(),g.push(l,u);break;case"q":g.push(l+p.shift(),u+p.shift()),l+=p.shift(),u+=p.shift(),v="Q",g.push(l,u);break;case"T":x=l,C=u,w=a[a.length-1],w.command==="Q"&&(x=l+(l-w.points[0]),C=u+(u-w.points[1])),l=p.shift(),u=p.shift(),v="Q",g.push(x,C,l,u);break;case"t":x=l,C=u,w=a[a.length-1],w.command==="Q"&&(x=l+(l-w.points[0]),C=u+(u-w.points[1])),l+=p.shift(),u+=p.shift(),v="Q",g.push(x,C,l,u);break;case"A":T=p.shift(),k=p.shift(),P=p.shift(),$=p.shift(),O=p.shift(),E=l,A=u,l=p.shift(),u=p.shift(),v="A",g=this.convertEndpointToCenterParameterization(E,A,l,u,$,O,T,k,P);break;case"a":T=p.shift(),k=p.shift(),P=p.shift(),$=p.shift(),O=p.shift(),E=l,A=u,l+=p.shift(),u+=p.shift(),v="A",g=this.convertEndpointToCenterParameterization(E,A,l,u,$,O,T,k,P);break}a.push({command:v||h,points:g,start:{x:y,y:S},pathLength:this.calcLength(y,S,v||h,g)})}(h==="z"||h==="Z")&&a.push({command:"z",points:[],start:void 0,pathLength:0})}return a}static calcLength(t,n,r,i){var o,a,s,l,u=Vr;switch(r){case"L":return u.getLineLength(t,n,i[0],i[1]);case"C":return(0,yf.getCubicArcLength)([t,i[0],i[2],i[4]],[n,i[1],i[3],i[5]],1);case"Q":return(0,yf.getQuadraticArcLength)([t,i[0],i[2]],[n,i[1],i[3]],1);case"A":o=0;var c=i[4],d=i[5],f=i[4]+d,h=Math.PI/180;if(Math.abs(c-f)f;l-=h)s=u.getPointOnEllipticalArc(i[0],i[1],i[2],i[3],l,0),o+=u.getLineLength(a.x,a.y,s.x,s.y),a=s;else for(l=c+h;l1&&(s*=Math.sqrt(h),l*=Math.sqrt(h));var p=Math.sqrt((s*s*(l*l)-s*s*(f*f)-l*l*(d*d))/(s*s*(f*f)+l*l*(d*d)));o===a&&(p*=-1),isNaN(p)&&(p=0);var m=p*s*f/l,_=p*-l*d/s,b=(t+r)/2+Math.cos(c)*m-Math.sin(c)*_,v=(n+i)/2+Math.sin(c)*m+Math.cos(c)*_,g=function(k){return Math.sqrt(k[0]*k[0]+k[1]*k[1])},y=function(k,P){return(k[0]*P[0]+k[1]*P[1])/(g(k)*g(P))},S=function(k,P){return(k[0]*P[1]=1&&(T=0),a===0&&T>0&&(T=T-2*Math.PI),a===1&&T<0&&(T=T+2*Math.PI),[b,v,s,l,w,T,c,a]}}wp.Path=Vr;Vr.prototype.className="Path";Vr.prototype._attrsAffectingSize=["data"];(0,Gwe._registerNode)(Vr);Uwe.Factory.addGetterSetter(Vr,"data");Object.defineProperty(cx,"__esModule",{value:!0});cx.Arrow=void 0;const fx=At,Hwe=Ey,EG=Xe,qwe=Rt,dO=wp;class qd extends Hwe.Line{_sceneFunc(t){super._sceneFunc(t);var n=Math.PI*2,r=this.points(),i=r,o=this.tension()!==0&&r.length>4;o&&(i=this.getTensionPoints());var a=this.pointerLength(),s=r.length,l,u;if(o){const f=[i[i.length-4],i[i.length-3],i[i.length-2],i[i.length-1],r[s-2],r[s-1]],h=dO.Path.calcLength(i[i.length-4],i[i.length-3],"C",f),p=dO.Path.getPointOnQuadraticBezier(Math.min(1,1-a/h),f[0],f[1],f[2],f[3],f[4],f[5]);l=r[s-2]-p.x,u=r[s-1]-p.y}else l=r[s-2]-r[s-4],u=r[s-1]-r[s-3];var c=(Math.atan2(u,l)+n)%n,d=this.pointerWidth();this.pointerAtEnding()&&(t.save(),t.beginPath(),t.translate(r[s-2],r[s-1]),t.rotate(c),t.moveTo(0,0),t.lineTo(-a,d/2),t.lineTo(-a,-d/2),t.closePath(),t.restore(),this.__fillStroke(t)),this.pointerAtBeginning()&&(t.save(),t.beginPath(),t.translate(r[0],r[1]),o?(l=(i[0]+i[2])/2-r[0],u=(i[1]+i[3])/2-r[1]):(l=r[2]-r[0],u=r[3]-r[1]),t.rotate((Math.atan2(-u,-l)+n)%n),t.moveTo(0,0),t.lineTo(-a,d/2),t.lineTo(-a,-d/2),t.closePath(),t.restore(),this.__fillStroke(t))}__fillStroke(t){var n=this.dashEnabled();n&&(this.attrs.dashEnabled=!1,t.setLineDash([])),t.fillStrokeShape(this),n&&(this.attrs.dashEnabled=!0)}getSelfRect(){const t=super.getSelfRect(),n=this.pointerWidth()/2;return{x:t.x-n,y:t.y-n,width:t.width+n*2,height:t.height+n*2}}}cx.Arrow=qd;qd.prototype.className="Arrow";(0,qwe._registerNode)(qd);fx.Factory.addGetterSetter(qd,"pointerLength",10,(0,EG.getNumberValidator)());fx.Factory.addGetterSetter(qd,"pointerWidth",10,(0,EG.getNumberValidator)());fx.Factory.addGetterSetter(qd,"pointerAtBeginning",!1);fx.Factory.addGetterSetter(qd,"pointerAtEnding",!0);var hx={};Object.defineProperty(hx,"__esModule",{value:!0});hx.Circle=void 0;const Wwe=At,Kwe=Yr,Qwe=Xe,Xwe=Rt;let Cp=class extends Kwe.Shape{_sceneFunc(t){t.beginPath(),t.arc(0,0,this.attrs.radius||0,0,Math.PI*2,!1),t.closePath(),t.fillStrokeShape(this)}getWidth(){return this.radius()*2}getHeight(){return this.radius()*2}setWidth(t){this.radius()!==t/2&&this.radius(t/2)}setHeight(t){this.radius()!==t/2&&this.radius(t/2)}};hx.Circle=Cp;Cp.prototype._centroid=!0;Cp.prototype.className="Circle";Cp.prototype._attrsAffectingSize=["radius"];(0,Xwe._registerNode)(Cp);Wwe.Factory.addGetterSetter(Cp,"radius",0,(0,Qwe.getNumberValidator)());var px={};Object.defineProperty(px,"__esModule",{value:!0});px.Ellipse=void 0;const SA=At,Ywe=Yr,kG=Xe,Zwe=Rt;class wc extends Ywe.Shape{_sceneFunc(t){var n=this.radiusX(),r=this.radiusY();t.beginPath(),t.save(),n!==r&&t.scale(1,r/n),t.arc(0,0,n,0,Math.PI*2,!1),t.restore(),t.closePath(),t.fillStrokeShape(this)}getWidth(){return this.radiusX()*2}getHeight(){return this.radiusY()*2}setWidth(t){this.radiusX(t/2)}setHeight(t){this.radiusY(t/2)}}px.Ellipse=wc;wc.prototype.className="Ellipse";wc.prototype._centroid=!0;wc.prototype._attrsAffectingSize=["radiusX","radiusY"];(0,Zwe._registerNode)(wc);SA.Factory.addComponentsGetterSetter(wc,"radius",["x","y"]);SA.Factory.addGetterSetter(wc,"radiusX",0,(0,kG.getNumberValidator)());SA.Factory.addGetterSetter(wc,"radiusY",0,(0,kG.getNumberValidator)());var gx={};Object.defineProperty(gx,"__esModule",{value:!0});gx.Image=void 0;const XC=dr,Wd=At,Jwe=Yr,eCe=Rt,ky=Xe;let rl=class TG extends Jwe.Shape{constructor(t){super(t),this.on("imageChange.konva",()=>{this._setImageLoad()}),this._setImageLoad()}_setImageLoad(){const t=this.image();t&&t.complete||t&&t.readyState===4||t&&t.addEventListener&&t.addEventListener("load",()=>{this._requestDraw()})}_useBufferCanvas(){return super._useBufferCanvas(!0)}_sceneFunc(t){const n=this.getWidth(),r=this.getHeight(),i=this.cornerRadius(),o=this.attrs.image;let a;if(o){const s=this.attrs.cropWidth,l=this.attrs.cropHeight;s&&l?a=[o,this.cropX(),this.cropY(),s,l,0,0,n,r]:a=[o,0,0,n,r]}(this.hasFill()||this.hasStroke()||i)&&(t.beginPath(),i?XC.Util.drawRoundedRectPath(t,n,r,i):t.rect(0,0,n,r),t.closePath(),t.fillStrokeShape(this)),o&&(i&&t.clip(),t.drawImage.apply(t,a))}_hitFunc(t){var n=this.width(),r=this.height(),i=this.cornerRadius();t.beginPath(),i?XC.Util.drawRoundedRectPath(t,n,r,i):t.rect(0,0,n,r),t.closePath(),t.fillStrokeShape(this)}getWidth(){var t,n;return(t=this.attrs.width)!==null&&t!==void 0?t:(n=this.image())===null||n===void 0?void 0:n.width}getHeight(){var t,n;return(t=this.attrs.height)!==null&&t!==void 0?t:(n=this.image())===null||n===void 0?void 0:n.height}static fromURL(t,n,r=null){var i=XC.Util.createImageElement();i.onload=function(){var o=new TG({image:i});n(o)},i.onerror=r,i.crossOrigin="Anonymous",i.src=t}};gx.Image=rl;rl.prototype.className="Image";(0,eCe._registerNode)(rl);Wd.Factory.addGetterSetter(rl,"cornerRadius",0,(0,ky.getNumberOrArrayOfNumbersValidator)(4));Wd.Factory.addGetterSetter(rl,"image");Wd.Factory.addComponentsGetterSetter(rl,"crop",["x","y","width","height"]);Wd.Factory.addGetterSetter(rl,"cropX",0,(0,ky.getNumberValidator)());Wd.Factory.addGetterSetter(rl,"cropY",0,(0,ky.getNumberValidator)());Wd.Factory.addGetterSetter(rl,"cropWidth",0,(0,ky.getNumberValidator)());Wd.Factory.addGetterSetter(rl,"cropHeight",0,(0,ky.getNumberValidator)());var np={};Object.defineProperty(np,"__esModule",{value:!0});np.Tag=np.Label=void 0;const mx=At,tCe=Yr,nCe=Sp,xA=Xe,AG=Rt;var PG=["fontFamily","fontSize","fontStyle","padding","lineHeight","text","width","height","pointerDirection","pointerWidth","pointerHeight"],rCe="Change.konva",iCe="none",KE="up",QE="right",XE="down",YE="left",oCe=PG.length;class wA extends nCe.Group{constructor(t){super(t),this.on("add.konva",function(n){this._addListeners(n.child),this._sync()})}getText(){return this.find("Text")[0]}getTag(){return this.find("Tag")[0]}_addListeners(t){var n=this,r,i=function(){n._sync()};for(r=0;r{n=Math.min(n,a.x),r=Math.max(r,a.x),i=Math.min(i,a.y),o=Math.max(o,a.y)}),{x:n,y:i,width:r-n,height:o-i}}getWidth(){return this.radius()*2}getHeight(){return this.radius()*2}setWidth(t){this.radius(t/2)}setHeight(t){this.radius(t/2)}}vx.RegularPolygon=Qd;Qd.prototype.className="RegularPolygon";Qd.prototype._centroid=!0;Qd.prototype._attrsAffectingSize=["radius"];(0,fCe._registerNode)(Qd);IG.Factory.addGetterSetter(Qd,"radius",0,(0,RG.getNumberValidator)());IG.Factory.addGetterSetter(Qd,"sides",0,(0,RG.getNumberValidator)());var bx={};Object.defineProperty(bx,"__esModule",{value:!0});bx.Ring=void 0;const OG=At,hCe=Yr,MG=Xe,pCe=Rt;var fO=Math.PI*2;class Xd extends hCe.Shape{_sceneFunc(t){t.beginPath(),t.arc(0,0,this.innerRadius(),0,fO,!1),t.moveTo(this.outerRadius(),0),t.arc(0,0,this.outerRadius(),fO,0,!0),t.closePath(),t.fillStrokeShape(this)}getWidth(){return this.outerRadius()*2}getHeight(){return this.outerRadius()*2}setWidth(t){this.outerRadius(t/2)}setHeight(t){this.outerRadius(t/2)}}bx.Ring=Xd;Xd.prototype.className="Ring";Xd.prototype._centroid=!0;Xd.prototype._attrsAffectingSize=["innerRadius","outerRadius"];(0,pCe._registerNode)(Xd);OG.Factory.addGetterSetter(Xd,"innerRadius",0,(0,MG.getNumberValidator)());OG.Factory.addGetterSetter(Xd,"outerRadius",0,(0,MG.getNumberValidator)());var _x={};Object.defineProperty(_x,"__esModule",{value:!0});_x.Sprite=void 0;const Yd=At,gCe=Yr,mCe=xp,NG=Xe,yCe=Rt;class il extends gCe.Shape{constructor(t){super(t),this._updated=!0,this.anim=new mCe.Animation(()=>{var n=this._updated;return this._updated=!1,n}),this.on("animationChange.konva",function(){this.frameIndex(0)}),this.on("frameIndexChange.konva",function(){this._updated=!0}),this.on("frameRateChange.konva",function(){this.anim.isRunning()&&(clearInterval(this.interval),this._setInterval())})}_sceneFunc(t){var n=this.animation(),r=this.frameIndex(),i=r*4,o=this.animations()[n],a=this.frameOffsets(),s=o[i+0],l=o[i+1],u=o[i+2],c=o[i+3],d=this.image();if((this.hasFill()||this.hasStroke())&&(t.beginPath(),t.rect(0,0,u,c),t.closePath(),t.fillStrokeShape(this)),d)if(a){var f=a[n],h=r*2;t.drawImage(d,s,l,u,c,f[h+0],f[h+1],u,c)}else t.drawImage(d,s,l,u,c,0,0,u,c)}_hitFunc(t){var n=this.animation(),r=this.frameIndex(),i=r*4,o=this.animations()[n],a=this.frameOffsets(),s=o[i+2],l=o[i+3];if(t.beginPath(),a){var u=a[n],c=r*2;t.rect(u[c+0],u[c+1],s,l)}else t.rect(0,0,s,l);t.closePath(),t.fillShape(this)}_useBufferCanvas(){return super._useBufferCanvas(!0)}_setInterval(){var t=this;this.interval=setInterval(function(){t._updateIndex()},1e3/this.frameRate())}start(){if(!this.isRunning()){var t=this.getLayer();this.anim.setLayers(t),this._setInterval(),this.anim.start()}}stop(){this.anim.stop(),clearInterval(this.interval)}isRunning(){return this.anim.isRunning()}_updateIndex(){var t=this.frameIndex(),n=this.animation(),r=this.animations(),i=r[n],o=i.length/4;t{t=t.trim();const n=t.indexOf(" ")>=0,r=t.indexOf('"')>=0||t.indexOf("'")>=0;return n&&!r&&(t=`"${t}"`),t}).join(", ")}var Uv;function ZC(){return Uv||(Uv=ZE.Util.createCanvasElement().getContext(CCe),Uv)}function $Ce(e){e.fillText(this._partialText,this._partialTextX,this._partialTextY)}function DCe(e){e.setAttr("miterLimit",2),e.strokeText(this._partialText,this._partialTextX,this._partialTextY)}function LCe(e){return e=e||{},!e.fillLinearGradientColorStops&&!e.fillRadialGradientColorStops&&!e.fillPatternImage&&(e.fill=e.fill||"black"),e}let Tr=class extends _Ce.Shape{constructor(t){super(LCe(t)),this._partialTextX=0,this._partialTextY=0;for(var n=0;n1&&(b+=a)}}}_hitFunc(t){var n=this.getWidth(),r=this.getHeight();t.beginPath(),t.rect(0,0,n,r),t.closePath(),t.fillStrokeShape(this)}setText(t){var n=ZE.Util._isString(t)?t:t==null?"":t+"";return this._setAttr(ECe,n),this}getWidth(){var t=this.attrs.width===vf||this.attrs.width===void 0;return t?this.getTextWidth()+this.padding()*2:this.attrs.width}getHeight(){var t=this.attrs.height===vf||this.attrs.height===void 0;return t?this.fontSize()*this.textArr.length*this.lineHeight()+this.padding()*2:this.attrs.height}getTextWidth(){return this.textWidth}getTextHeight(){return ZE.Util.warn("text.getTextHeight() method is deprecated. Use text.height() - for full height and text.fontSize() - for one line height."),this.textHeight}measureSize(t){var n=ZC(),r=this.fontSize(),i;return n.save(),n.font=this._getContextFont(),i=n.measureText(t),n.restore(),{width:i.width,height:r}}_getContextFont(){return this.fontStyle()+jv+this.fontVariant()+jv+(this.fontSize()+PCe)+NCe(this.fontFamily())}_addTextLine(t){this.align()===Jp&&(t=t.trim());var r=this._getTextWidth(t);return this.textArr.push({text:t,width:r,lastInParagraph:!1})}_getTextWidth(t){var n=this.letterSpacing(),r=t.length;return ZC().measureText(t).width+(r?n*(r-1):0)}_setTextData(){var t=this.text().split(` +`),n=+this.fontSize(),r=0,i=this.lineHeight()*n,o=this.attrs.width,a=this.attrs.height,s=o!==vf&&o!==void 0,l=a!==vf&&a!==void 0,u=this.padding(),c=o-u*2,d=a-u*2,f=0,h=this.wrap(),p=h!==gO,m=h!==OCe&&p,_=this.ellipsis();this.textArr=[],ZC().font=this._getContextFont();for(var b=_?this._getTextWidth(YC):0,v=0,g=t.length;vc)for(;y.length>0;){for(var w=0,x=y.length,C="",T=0;w>>1,P=y.slice(0,k+1),$=this._getTextWidth(P)+b;$<=c?(w=k+1,C=P,T=$):x=k}if(C){if(m){var O,E=y[C.length],A=E===jv||E===hO;A&&T<=c?O=C.length:O=Math.max(C.lastIndexOf(jv),C.lastIndexOf(hO))+1,O>0&&(w=O,C=C.slice(0,w),T=this._getTextWidth(C))}C=C.trimRight(),this._addTextLine(C),r=Math.max(r,T),f+=i;var D=this._shouldHandleEllipsis(f);if(D){this._tryToAddEllipsisToLastLine();break}if(y=y.slice(w),y=y.trimLeft(),y.length>0&&(S=this._getTextWidth(y),S<=c)){this._addTextLine(y),f+=i,r=Math.max(r,S);break}}else break}else this._addTextLine(y),f+=i,r=Math.max(r,S),this._shouldHandleEllipsis(f)&&vd)break}this.textHeight=n,this.textWidth=r}_shouldHandleEllipsis(t){var n=+this.fontSize(),r=this.lineHeight()*n,i=this.attrs.height,o=i!==vf&&i!==void 0,a=this.padding(),s=i-a*2,l=this.wrap(),u=l!==gO;return!u||o&&t+r>s}_tryToAddEllipsisToLastLine(){var t=this.attrs.width,n=t!==vf&&t!==void 0,r=this.padding(),i=t-r*2,o=this.ellipsis(),a=this.textArr[this.textArr.length-1];if(!(!a||!o)){if(n){var s=this._getTextWidth(a.text+YC)n?null:eg.Path.getPointAtLengthOfDataArray(t,this.dataArray)}_readDataAttribute(){this.dataArray=eg.Path.parsePathData(this.attrs.data),this.pathLength=this._getTextPathLength()}_sceneFunc(t){t.setAttr("font",this._getContextFont()),t.setAttr("textBaseline",this.textBaseline()),t.setAttr("textAlign","left"),t.save();var n=this.textDecoration(),r=this.fill(),i=this.fontSize(),o=this.glyphInfo;n==="underline"&&t.beginPath();for(var a=0;a=1){var r=n[0].p0;t.moveTo(r.x,r.y)}for(var i=0;ie+`.${VG}`).join(" "),vO="nodesRect",HCe=["widthChange","heightChange","scaleXChange","scaleYChange","skewXChange","skewYChange","rotationChange","offsetXChange","offsetYChange","transformsEnabledChange","strokeWidthChange"],qCe={"top-left":-45,"top-center":0,"top-right":45,"middle-right":-90,"middle-left":90,"bottom-left":-135,"bottom-center":180,"bottom-right":135};const WCe="ontouchstart"in za.Konva._global;function KCe(e,t){if(e==="rotater")return"crosshair";t+=Cn.Util.degToRad(qCe[e]||0);var n=(Cn.Util.radToDeg(t)%360+360)%360;return Cn.Util._inRange(n,315+22.5,360)||Cn.Util._inRange(n,0,22.5)?"ns-resize":Cn.Util._inRange(n,45-22.5,45+22.5)?"nesw-resize":Cn.Util._inRange(n,90-22.5,90+22.5)?"ew-resize":Cn.Util._inRange(n,135-22.5,135+22.5)?"nwse-resize":Cn.Util._inRange(n,180-22.5,180+22.5)?"ns-resize":Cn.Util._inRange(n,225-22.5,225+22.5)?"nesw-resize":Cn.Util._inRange(n,270-22.5,270+22.5)?"ew-resize":Cn.Util._inRange(n,315-22.5,315+22.5)?"nwse-resize":(Cn.Util.error("Transformer has unknown angle for cursor detection: "+n),"pointer")}var L_=["top-left","top-center","top-right","middle-right","middle-left","bottom-left","bottom-center","bottom-right"],bO=1e8;function QCe(e){return{x:e.x+e.width/2*Math.cos(e.rotation)+e.height/2*Math.sin(-e.rotation),y:e.y+e.height/2*Math.cos(e.rotation)+e.width/2*Math.sin(e.rotation)}}function GG(e,t,n){const r=n.x+(e.x-n.x)*Math.cos(t)-(e.y-n.y)*Math.sin(t),i=n.y+(e.x-n.x)*Math.sin(t)+(e.y-n.y)*Math.cos(t);return Object.assign(Object.assign({},e),{rotation:e.rotation+t,x:r,y:i})}function XCe(e,t){const n=QCe(e);return GG(e,t,n)}function YCe(e,t,n){let r=t;for(let i=0;ii.isAncestorOf(this)?(Cn.Util.error("Konva.Transformer cannot be an a child of the node you are trying to attach"),!1):!0);this._nodes=t=n,t.length===1&&this.useSingleNodeRotation()?this.rotation(t[0].getAbsoluteRotation()):this.rotation(0),this._nodes.forEach(i=>{const o=()=>{this.nodes().length===1&&this.useSingleNodeRotation()&&this.rotation(this.nodes()[0].getAbsoluteRotation()),this._resetTransformCache(),!this._transforming&&!this.isDragging()&&this.update()},a=i._attrsAffectingSize.map(s=>s+"Change."+this._getEventNamespace()).join(" ");i.on(a,o),i.on(HCe.map(s=>s+`.${this._getEventNamespace()}`).join(" "),o),i.on(`absoluteTransformChange.${this._getEventNamespace()}`,o),this._proxyDrag(i)}),this._resetTransformCache();var r=!!this.findOne(".top-left");return r&&this.update(),this}_proxyDrag(t){let n;t.on(`dragstart.${this._getEventNamespace()}`,r=>{n=t.getAbsolutePosition(),!this.isDragging()&&t!==this.findOne(".back")&&this.startDrag(r,!1)}),t.on(`dragmove.${this._getEventNamespace()}`,r=>{if(!n)return;const i=t.getAbsolutePosition(),o=i.x-n.x,a=i.y-n.y;this.nodes().forEach(s=>{if(s===t||s.isDragging())return;const l=s.getAbsolutePosition();s.setAbsolutePosition({x:l.x+o,y:l.y+a}),s.startDrag(r)}),n=null})}getNodes(){return this._nodes||[]}getActiveAnchor(){return this._movingAnchorName}detach(){this._nodes&&this._nodes.forEach(t=>{t.off("."+this._getEventNamespace())}),this._nodes=[],this._resetTransformCache()}_resetTransformCache(){this._clearCache(vO),this._clearCache("transform"),this._clearSelfAndDescendantCache("absoluteTransform")}_getNodeRect(){return this._getCache(vO,this.__getNodeRect)}__getNodeShape(t,n=this.rotation(),r){var i=t.getClientRect({skipTransform:!0,skipShadow:!0,skipStroke:this.ignoreStroke()}),o=t.getAbsoluteScale(r),a=t.getAbsolutePosition(r),s=i.x*o.x-t.offsetX()*o.x,l=i.y*o.y-t.offsetY()*o.y;const u=(za.Konva.getAngle(t.getAbsoluteRotation())+Math.PI*2)%(Math.PI*2),c={x:a.x+s*Math.cos(u)+l*Math.sin(-u),y:a.y+l*Math.cos(u)+s*Math.sin(u),width:i.width*o.x,height:i.height*o.y,rotation:u};return GG(c,-za.Konva.getAngle(n),{x:0,y:0})}__getNodeRect(){var t=this.getNode();if(!t)return{x:-bO,y:-bO,width:0,height:0,rotation:0};const n=[];this.nodes().map(u=>{const c=u.getClientRect({skipTransform:!0,skipShadow:!0,skipStroke:this.ignoreStroke()});var d=[{x:c.x,y:c.y},{x:c.x+c.width,y:c.y},{x:c.x+c.width,y:c.y+c.height},{x:c.x,y:c.y+c.height}],f=u.getAbsoluteTransform();d.forEach(function(h){var p=f.point(h);n.push(p)})});const r=new Cn.Transform;r.rotate(-za.Konva.getAngle(this.rotation()));var i,o,a,s;n.forEach(function(u){var c=r.point(u);i===void 0&&(i=a=c.x,o=s=c.y),i=Math.min(i,c.x),o=Math.min(o,c.y),a=Math.max(a,c.x),s=Math.max(s,c.y)}),r.invert();const l=r.point({x:i,y:o});return{x:l.x,y:l.y,width:a-i,height:s-o,rotation:za.Konva.getAngle(this.rotation())}}getX(){return this._getNodeRect().x}getY(){return this._getNodeRect().y}getWidth(){return this._getNodeRect().width}getHeight(){return this._getNodeRect().height}_createElements(){this._createBack(),L_.forEach((function(t){this._createAnchor(t)}).bind(this)),this._createAnchor("rotater")}_createAnchor(t){var n=new UCe.Rect({stroke:"rgb(0, 161, 255)",fill:"white",strokeWidth:1,name:t+" _anchor",dragDistance:0,draggable:!0,hitStrokeWidth:WCe?10:"auto"}),r=this;n.on("mousedown touchstart",function(i){r._handleMouseDown(i)}),n.on("dragstart",i=>{n.stopDrag(),i.cancelBubble=!0}),n.on("dragend",i=>{i.cancelBubble=!0}),n.on("mouseenter",()=>{var i=za.Konva.getAngle(this.rotation()),o=KCe(t,i);n.getStage().content&&(n.getStage().content.style.cursor=o),this._cursorChange=!0}),n.on("mouseout",()=>{n.getStage().content&&(n.getStage().content.style.cursor=""),this._cursorChange=!1}),this.add(n)}_createBack(){var t=new jCe.Shape({name:"back",width:0,height:0,draggable:!0,sceneFunc(n){var r=this.getParent(),i=r.padding();n.beginPath(),n.rect(-i,-i,this.width()+i*2,this.height()+i*2),n.moveTo(this.width()/2,-i),r.rotateEnabled()&&n.lineTo(this.width()/2,-r.rotateAnchorOffset()*Cn.Util._sign(this.height())-i),n.fillStrokeShape(this)},hitFunc:(n,r)=>{if(this.shouldOverdrawWholeArea()){var i=this.padding();n.beginPath(),n.rect(-i,-i,r.width()+i*2,r.height()+i*2),n.fillStrokeShape(r)}}});this.add(t),this._proxyDrag(t),t.on("dragstart",n=>{n.cancelBubble=!0}),t.on("dragmove",n=>{n.cancelBubble=!0}),t.on("dragend",n=>{n.cancelBubble=!0}),this.on("dragmove",n=>{this.update()})}_handleMouseDown(t){this._movingAnchorName=t.target.name().split(" ")[0];var n=this._getNodeRect(),r=n.width,i=n.height,o=Math.sqrt(Math.pow(r,2)+Math.pow(i,2));this.sin=Math.abs(i/o),this.cos=Math.abs(r/o),typeof window<"u"&&(window.addEventListener("mousemove",this._handleMouseMove),window.addEventListener("touchmove",this._handleMouseMove),window.addEventListener("mouseup",this._handleMouseUp,!0),window.addEventListener("touchend",this._handleMouseUp,!0)),this._transforming=!0;var a=t.target.getAbsolutePosition(),s=t.target.getStage().getPointerPosition();this._anchorDragOffset={x:s.x-a.x,y:s.y-a.y},this._fire("transformstart",{evt:t.evt,target:this.getNode()}),this._nodes.forEach(l=>{l._fire("transformstart",{evt:t.evt,target:l})})}_handleMouseMove(t){var n,r,i,o=this.findOne("."+this._movingAnchorName),a=o.getStage();a.setPointersPositions(t);const s=a.getPointerPosition();let l={x:s.x-this._anchorDragOffset.x,y:s.y-this._anchorDragOffset.y};const u=o.getAbsolutePosition();this.anchorDragBoundFunc()&&(l=this.anchorDragBoundFunc()(u,l,t)),o.setAbsolutePosition(l);const c=o.getAbsolutePosition();if(!(u.x===c.x&&u.y===c.y)){if(this._movingAnchorName==="rotater"){var d=this._getNodeRect();n=o.x()-d.width/2,r=-o.y()+d.height/2;let O=Math.atan2(-r,n)+Math.PI/2;d.height<0&&(O-=Math.PI);var f=za.Konva.getAngle(this.rotation());const E=f+O,A=za.Konva.getAngle(this.rotationSnapTolerance()),L=YCe(this.rotationSnaps(),E,A)-d.rotation,M=XCe(d,L);this._fitNodesInto(M,t);return}var h=this.shiftBehavior(),p;h==="inverted"?p=this.keepRatio()&&!t.shiftKey:h==="none"?p=this.keepRatio():p=this.keepRatio()||t.shiftKey;var g=this.centeredScaling()||t.altKey;if(this._movingAnchorName==="top-left"){if(p){var m=g?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".bottom-right").x(),y:this.findOne(".bottom-right").y()};i=Math.sqrt(Math.pow(m.x-o.x(),2)+Math.pow(m.y-o.y(),2));var _=this.findOne(".top-left").x()>m.x?-1:1,b=this.findOne(".top-left").y()>m.y?-1:1;n=i*this.cos*_,r=i*this.sin*b,this.findOne(".top-left").x(m.x-n),this.findOne(".top-left").y(m.y-r)}}else if(this._movingAnchorName==="top-center")this.findOne(".top-left").y(o.y());else if(this._movingAnchorName==="top-right"){if(p){var m=g?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".bottom-left").x(),y:this.findOne(".bottom-left").y()};i=Math.sqrt(Math.pow(o.x()-m.x,2)+Math.pow(m.y-o.y(),2));var _=this.findOne(".top-right").x()m.y?-1:1;n=i*this.cos*_,r=i*this.sin*b,this.findOne(".top-right").x(m.x+n),this.findOne(".top-right").y(m.y-r)}var v=o.position();this.findOne(".top-left").y(v.y),this.findOne(".bottom-right").x(v.x)}else if(this._movingAnchorName==="middle-left")this.findOne(".top-left").x(o.x());else if(this._movingAnchorName==="middle-right")this.findOne(".bottom-right").x(o.x());else if(this._movingAnchorName==="bottom-left"){if(p){var m=g?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".top-right").x(),y:this.findOne(".top-right").y()};i=Math.sqrt(Math.pow(m.x-o.x(),2)+Math.pow(o.y()-m.y,2));var _=m.x{r._fire("transformend",{evt:t,target:r})}),this._movingAnchorName=null}}_fitNodesInto(t,n){var r=this._getNodeRect();const i=1;if(Cn.Util._inRange(t.width,-this.padding()*2-i,i)){this.update();return}if(Cn.Util._inRange(t.height,-this.padding()*2-i,i)){this.update();return}const o=this.flipEnabled();var a=new Cn.Transform;if(a.rotate(za.Konva.getAngle(this.rotation())),this._movingAnchorName&&t.width<0&&this._movingAnchorName.indexOf("left")>=0){const d=a.point({x:-this.padding()*2,y:0});if(t.x+=d.x,t.y+=d.y,t.width+=this.padding()*2,this._movingAnchorName=this._movingAnchorName.replace("left","right"),this._anchorDragOffset.x-=d.x,this._anchorDragOffset.y-=d.y,!o){this.update();return}}else if(this._movingAnchorName&&t.width<0&&this._movingAnchorName.indexOf("right")>=0){const d=a.point({x:this.padding()*2,y:0});if(this._movingAnchorName=this._movingAnchorName.replace("right","left"),this._anchorDragOffset.x-=d.x,this._anchorDragOffset.y-=d.y,t.width+=this.padding()*2,!o){this.update();return}}if(this._movingAnchorName&&t.height<0&&this._movingAnchorName.indexOf("top")>=0){const d=a.point({x:0,y:-this.padding()*2});if(t.x+=d.x,t.y+=d.y,this._movingAnchorName=this._movingAnchorName.replace("top","bottom"),this._anchorDragOffset.x-=d.x,this._anchorDragOffset.y-=d.y,t.height+=this.padding()*2,!o){this.update();return}}else if(this._movingAnchorName&&t.height<0&&this._movingAnchorName.indexOf("bottom")>=0){const d=a.point({x:0,y:this.padding()*2});if(this._movingAnchorName=this._movingAnchorName.replace("bottom","top"),this._anchorDragOffset.x-=d.x,this._anchorDragOffset.y-=d.y,t.height+=this.padding()*2,!o){this.update();return}}if(this.boundBoxFunc()){const d=this.boundBoxFunc()(r,t);d?t=d:Cn.Util.warn("boundBoxFunc returned falsy. You should return new bound rect from it!")}const s=1e7,l=new Cn.Transform;l.translate(r.x,r.y),l.rotate(r.rotation),l.scale(r.width/s,r.height/s);const u=new Cn.Transform;u.translate(t.x,t.y),u.rotate(t.rotation),u.scale(t.width/s,t.height/s);const c=u.multiply(l.invert());this._nodes.forEach(d=>{var f;const h=d.getParent().getAbsoluteTransform(),p=d.getTransform().copy();p.translate(d.offsetX(),d.offsetY());const m=new Cn.Transform;m.multiply(h.copy().invert()).multiply(c).multiply(h).multiply(p);const _=m.decompose();d.setAttrs(_),this._fire("transform",{evt:n,target:d}),d._fire("transform",{evt:n,target:d}),(f=d.getLayer())===null||f===void 0||f.batchDraw()}),this.rotation(Cn.Util._getRotation(t.rotation)),this._resetTransformCache(),this.update(),this.getLayer().batchDraw()}forceUpdate(){this._resetTransformCache(),this.update()}_batchChangeChild(t,n){this.findOne(t).setAttrs(n)}update(){var t,n=this._getNodeRect();this.rotation(Cn.Util._getRotation(n.rotation));var r=n.width,i=n.height,o=this.enabledAnchors(),a=this.resizeEnabled(),s=this.padding(),l=this.anchorSize();const u=this.find("._anchor");u.forEach(d=>{d.setAttrs({width:l,height:l,offsetX:l/2,offsetY:l/2,stroke:this.anchorStroke(),strokeWidth:this.anchorStrokeWidth(),fill:this.anchorFill(),cornerRadius:this.anchorCornerRadius()})}),this._batchChangeChild(".top-left",{x:0,y:0,offsetX:l/2+s,offsetY:l/2+s,visible:a&&o.indexOf("top-left")>=0}),this._batchChangeChild(".top-center",{x:r/2,y:0,offsetY:l/2+s,visible:a&&o.indexOf("top-center")>=0}),this._batchChangeChild(".top-right",{x:r,y:0,offsetX:l/2-s,offsetY:l/2+s,visible:a&&o.indexOf("top-right")>=0}),this._batchChangeChild(".middle-left",{x:0,y:i/2,offsetX:l/2+s,visible:a&&o.indexOf("middle-left")>=0}),this._batchChangeChild(".middle-right",{x:r,y:i/2,offsetX:l/2-s,visible:a&&o.indexOf("middle-right")>=0}),this._batchChangeChild(".bottom-left",{x:0,y:i,offsetX:l/2+s,offsetY:l/2-s,visible:a&&o.indexOf("bottom-left")>=0}),this._batchChangeChild(".bottom-center",{x:r/2,y:i,offsetY:l/2-s,visible:a&&o.indexOf("bottom-center")>=0}),this._batchChangeChild(".bottom-right",{x:r,y:i,offsetX:l/2-s,offsetY:l/2-s,visible:a&&o.indexOf("bottom-right")>=0}),this._batchChangeChild(".rotater",{x:r/2,y:-this.rotateAnchorOffset()*Cn.Util._sign(i)-s,visible:this.rotateEnabled()}),this._batchChangeChild(".back",{width:r,height:i,visible:this.borderEnabled(),stroke:this.borderStroke(),strokeWidth:this.borderStrokeWidth(),dash:this.borderDash(),x:0,y:0});const c=this.anchorStyleFunc();c&&u.forEach(d=>{c(d)}),(t=this.getLayer())===null||t===void 0||t.batchDraw()}isTransforming(){return this._transforming}stopTransform(){if(this._transforming){this._removeEvents();var t=this.findOne("."+this._movingAnchorName);t&&t.stopDrag()}}destroy(){return this.getStage()&&this._cursorChange&&this.getStage().content&&(this.getStage().content.style.cursor=""),yO.Group.prototype.destroy.call(this),this.detach(),this._removeEvents(),this}toObject(){return mO.Node.prototype.toObject.call(this)}clone(t){var n=mO.Node.prototype.clone.call(this,t);return n}getClientRect(){return this.nodes().length>0?super.getClientRect():{x:0,y:0,width:0,height:0}}}wx.Transformer=Zt;function ZCe(e){return e instanceof Array||Cn.Util.warn("enabledAnchors value should be an array"),e instanceof Array&&e.forEach(function(t){L_.indexOf(t)===-1&&Cn.Util.warn("Unknown anchor name: "+t+". Available names are: "+L_.join(", "))}),e||[]}Zt.prototype.className="Transformer";(0,VCe._registerNode)(Zt);vn.Factory.addGetterSetter(Zt,"enabledAnchors",L_,ZCe);vn.Factory.addGetterSetter(Zt,"flipEnabled",!0,(0,kc.getBooleanValidator)());vn.Factory.addGetterSetter(Zt,"resizeEnabled",!0);vn.Factory.addGetterSetter(Zt,"anchorSize",10,(0,kc.getNumberValidator)());vn.Factory.addGetterSetter(Zt,"rotateEnabled",!0);vn.Factory.addGetterSetter(Zt,"rotationSnaps",[]);vn.Factory.addGetterSetter(Zt,"rotateAnchorOffset",50,(0,kc.getNumberValidator)());vn.Factory.addGetterSetter(Zt,"rotationSnapTolerance",5,(0,kc.getNumberValidator)());vn.Factory.addGetterSetter(Zt,"borderEnabled",!0);vn.Factory.addGetterSetter(Zt,"anchorStroke","rgb(0, 161, 255)");vn.Factory.addGetterSetter(Zt,"anchorStrokeWidth",1,(0,kc.getNumberValidator)());vn.Factory.addGetterSetter(Zt,"anchorFill","white");vn.Factory.addGetterSetter(Zt,"anchorCornerRadius",0,(0,kc.getNumberValidator)());vn.Factory.addGetterSetter(Zt,"borderStroke","rgb(0, 161, 255)");vn.Factory.addGetterSetter(Zt,"borderStrokeWidth",1,(0,kc.getNumberValidator)());vn.Factory.addGetterSetter(Zt,"borderDash");vn.Factory.addGetterSetter(Zt,"keepRatio",!0);vn.Factory.addGetterSetter(Zt,"shiftBehavior","default");vn.Factory.addGetterSetter(Zt,"centeredScaling",!1);vn.Factory.addGetterSetter(Zt,"ignoreStroke",!1);vn.Factory.addGetterSetter(Zt,"padding",0,(0,kc.getNumberValidator)());vn.Factory.addGetterSetter(Zt,"node");vn.Factory.addGetterSetter(Zt,"nodes");vn.Factory.addGetterSetter(Zt,"boundBoxFunc");vn.Factory.addGetterSetter(Zt,"anchorDragBoundFunc");vn.Factory.addGetterSetter(Zt,"anchorStyleFunc");vn.Factory.addGetterSetter(Zt,"shouldOverdrawWholeArea",!1);vn.Factory.addGetterSetter(Zt,"useSingleNodeRotation",!0);vn.Factory.backCompat(Zt,{lineEnabled:"borderEnabled",rotateHandlerOffset:"rotateAnchorOffset",enabledHandlers:"enabledAnchors"});var Cx={};Object.defineProperty(Cx,"__esModule",{value:!0});Cx.Wedge=void 0;const Ex=At,JCe=Yr,e5e=Rt,HG=Xe,t5e=Rt;class tu extends JCe.Shape{_sceneFunc(t){t.beginPath(),t.arc(0,0,this.radius(),0,e5e.Konva.getAngle(this.angle()),this.clockwise()),t.lineTo(0,0),t.closePath(),t.fillStrokeShape(this)}getWidth(){return this.radius()*2}getHeight(){return this.radius()*2}setWidth(t){this.radius(t/2)}setHeight(t){this.radius(t/2)}}Cx.Wedge=tu;tu.prototype.className="Wedge";tu.prototype._centroid=!0;tu.prototype._attrsAffectingSize=["radius"];(0,t5e._registerNode)(tu);Ex.Factory.addGetterSetter(tu,"radius",0,(0,HG.getNumberValidator)());Ex.Factory.addGetterSetter(tu,"angle",0,(0,HG.getNumberValidator)());Ex.Factory.addGetterSetter(tu,"clockwise",!1);Ex.Factory.backCompat(tu,{angleDeg:"angle",getAngleDeg:"getAngle",setAngleDeg:"setAngle"});var kx={};Object.defineProperty(kx,"__esModule",{value:!0});kx.Blur=void 0;const _O=At,n5e=rr,r5e=Xe;function SO(){this.r=0,this.g=0,this.b=0,this.a=0,this.next=null}var i5e=[512,512,456,512,328,456,335,512,405,328,271,456,388,335,292,512,454,405,364,328,298,271,496,456,420,388,360,335,312,292,273,512,482,454,428,405,383,364,345,328,312,298,284,271,259,496,475,456,437,420,404,388,374,360,347,335,323,312,302,292,282,273,265,512,497,482,468,454,441,428,417,405,394,383,373,364,354,345,337,328,320,312,305,298,291,284,278,271,265,259,507,496,485,475,465,456,446,437,428,420,412,404,396,388,381,374,367,360,354,347,341,335,329,323,318,312,307,302,297,292,287,282,278,273,269,265,261,512,505,497,489,482,475,468,461,454,447,441,435,428,422,417,411,405,399,394,389,383,378,373,368,364,359,354,350,345,341,337,332,328,324,320,316,312,309,305,301,298,294,291,287,284,281,278,274,271,268,265,262,259,257,507,501,496,491,485,480,475,470,465,460,456,451,446,442,437,433,428,424,420,416,412,408,404,400,396,392,388,385,381,377,374,370,367,363,360,357,354,350,347,344,341,338,335,332,329,326,323,320,318,315,312,310,307,304,302,299,297,294,292,289,287,285,282,280,278,275,273,271,269,267,265,263,261,259],o5e=[9,11,12,13,13,14,14,15,15,15,15,16,16,16,16,17,17,17,17,17,17,17,18,18,18,18,18,18,18,18,18,19,19,19,19,19,19,19,19,19,19,19,19,19,19,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24];function a5e(e,t){var n=e.data,r=e.width,i=e.height,o,a,s,l,u,c,d,f,h,p,m,_,b,v,g,y,S,w,x,C,T,k,P,$,O=t+t+1,E=r-1,A=i-1,D=t+1,L=D*(D+1)/2,M=new SO,R=null,N=M,B=null,U=null,G=i5e[t],Y=o5e[t];for(s=1;s>Y,P!==0?(P=255/P,n[c]=(f*G>>Y)*P,n[c+1]=(h*G>>Y)*P,n[c+2]=(p*G>>Y)*P):n[c]=n[c+1]=n[c+2]=0,f-=_,h-=b,p-=v,m-=g,_-=B.r,b-=B.g,v-=B.b,g-=B.a,l=d+((l=o+t+1)>Y,P>0?(P=255/P,n[l]=(f*G>>Y)*P,n[l+1]=(h*G>>Y)*P,n[l+2]=(p*G>>Y)*P):n[l]=n[l+1]=n[l+2]=0,f-=_,h-=b,p-=v,m-=g,_-=B.r,b-=B.g,v-=B.b,g-=B.a,l=o+((l=a+D)0&&a5e(t,n)};kx.Blur=s5e;_O.Factory.addGetterSetter(n5e.Node,"blurRadius",0,(0,r5e.getNumberValidator)(),_O.Factory.afterSetFilter);var Tx={};Object.defineProperty(Tx,"__esModule",{value:!0});Tx.Brighten=void 0;const xO=At,l5e=rr,u5e=Xe,c5e=function(e){var t=this.brightness()*255,n=e.data,r=n.length,i;for(i=0;i255?255:i,o=o<0?0:o>255?255:o,a=a<0?0:a>255?255:a,n[s]=i,n[s+1]=o,n[s+2]=a};Ax.Contrast=h5e;wO.Factory.addGetterSetter(d5e.Node,"contrast",0,(0,f5e.getNumberValidator)(),wO.Factory.afterSetFilter);var Px={};Object.defineProperty(Px,"__esModule",{value:!0});Px.Emboss=void 0;const lc=At,Ix=rr,p5e=dr,qG=Xe,g5e=function(e){var t=this.embossStrength()*10,n=this.embossWhiteLevel()*255,r=this.embossDirection(),i=this.embossBlend(),o=0,a=0,s=e.data,l=e.width,u=e.height,c=l*4,d=u;switch(r){case"top-left":o=-1,a=-1;break;case"top":o=-1,a=0;break;case"top-right":o=-1,a=1;break;case"right":o=0,a=1;break;case"bottom-right":o=1,a=1;break;case"bottom":o=1,a=0;break;case"bottom-left":o=1,a=-1;break;case"left":o=0,a=-1;break;default:p5e.Util.error("Unknown emboss direction: "+r)}do{var f=(d-1)*c,h=o;d+h<1&&(h=0),d+h>u&&(h=0);var p=(d-1+h)*l*4,m=l;do{var _=f+(m-1)*4,b=a;m+b<1&&(b=0),m+b>l&&(b=0);var v=p+(m-1+b)*4,g=s[_]-s[v],y=s[_+1]-s[v+1],S=s[_+2]-s[v+2],w=g,x=w>0?w:-w,C=y>0?y:-y,T=S>0?S:-S;if(C>x&&(w=y),T>x&&(w=S),w*=t,i){var k=s[_]+w,P=s[_+1]+w,$=s[_+2]+w;s[_]=k>255?255:k<0?0:k,s[_+1]=P>255?255:P<0?0:P,s[_+2]=$>255?255:$<0?0:$}else{var O=n-w;O<0?O=0:O>255&&(O=255),s[_]=s[_+1]=s[_+2]=O}}while(--m)}while(--d)};Px.Emboss=g5e;lc.Factory.addGetterSetter(Ix.Node,"embossStrength",.5,(0,qG.getNumberValidator)(),lc.Factory.afterSetFilter);lc.Factory.addGetterSetter(Ix.Node,"embossWhiteLevel",.5,(0,qG.getNumberValidator)(),lc.Factory.afterSetFilter);lc.Factory.addGetterSetter(Ix.Node,"embossDirection","top-left",null,lc.Factory.afterSetFilter);lc.Factory.addGetterSetter(Ix.Node,"embossBlend",!1,null,lc.Factory.afterSetFilter);var Rx={};Object.defineProperty(Rx,"__esModule",{value:!0});Rx.Enhance=void 0;const CO=At,m5e=rr,y5e=Xe;function t5(e,t,n,r,i){var o=n-t,a=i-r,s;return o===0?r+a/2:a===0?r:(s=(e-t)/o,s=a*s+r,s)}const v5e=function(e){var t=e.data,n=t.length,r=t[0],i=r,o,a=t[1],s=a,l,u=t[2],c=u,d,f,h=this.enhance();if(h!==0){for(f=0;fi&&(i=o),l=t[f+1],ls&&(s=l),d=t[f+2],dc&&(c=d);i===r&&(i=255,r=0),s===a&&(s=255,a=0),c===u&&(c=255,u=0);var p,m,_,b,v,g,y,S,w;for(h>0?(m=i+h*(255-i),_=r-h*(r-0),v=s+h*(255-s),g=a-h*(a-0),S=c+h*(255-c),w=u-h*(u-0)):(p=(i+r)*.5,m=i+h*(i-p),_=r+h*(r-p),b=(s+a)*.5,v=s+h*(s-b),g=a+h*(a-b),y=(c+u)*.5,S=c+h*(c-y),w=u+h*(u-y)),f=0;fb?_:b;var v=a,g=o,y,S,w=360/g*Math.PI/180,x,C;for(S=0;Sg?v:g;var y=a,S=o,w,x,C=n.polarRotation||0,T,k;for(c=0;ct&&(y=g,S=0,w=-1),i=0;i=0&&h=0&&p=0&&h=0&&p=255*4?255:0}return a}function M5e(e,t,n){for(var r=[.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111],i=Math.round(Math.sqrt(r.length)),o=Math.floor(i/2),a=[],s=0;s=0&&h=0&&p=n))for(o=m;o<_;o+=1)o>=r||(a=(n*o+i)*4,s+=y[a+0],l+=y[a+1],u+=y[a+2],c+=y[a+3],g+=1);for(s=s/g,l=l/g,u=u/g,c=c/g,i=h;i=n))for(o=m;o<_;o+=1)o>=r||(a=(n*o+i)*4,y[a+0]=s,y[a+1]=l,y[a+2]=u,y[a+3]=c)}};Bx.Pixelate=j5e;AO.Factory.addGetterSetter(B5e.Node,"pixelSize",8,(0,z5e.getNumberValidator)(),AO.Factory.afterSetFilter);var zx={};Object.defineProperty(zx,"__esModule",{value:!0});zx.Posterize=void 0;const PO=At,U5e=rr,V5e=Xe,G5e=function(e){var t=Math.round(this.levels()*254)+1,n=e.data,r=n.length,i=255/t,o;for(o=0;o255?255:e<0?0:Math.round(e)});B_.Factory.addGetterSetter(IA.Node,"green",0,function(e){return this._filterUpToDate=!1,e>255?255:e<0?0:Math.round(e)});B_.Factory.addGetterSetter(IA.Node,"blue",0,H5e.RGBComponent,B_.Factory.afterSetFilter);var Ux={};Object.defineProperty(Ux,"__esModule",{value:!0});Ux.RGBA=void 0;const v0=At,Vx=rr,W5e=Xe,K5e=function(e){var t=e.data,n=t.length,r=this.red(),i=this.green(),o=this.blue(),a=this.alpha(),s,l;for(s=0;s255?255:e<0?0:Math.round(e)});v0.Factory.addGetterSetter(Vx.Node,"green",0,function(e){return this._filterUpToDate=!1,e>255?255:e<0?0:Math.round(e)});v0.Factory.addGetterSetter(Vx.Node,"blue",0,W5e.RGBComponent,v0.Factory.afterSetFilter);v0.Factory.addGetterSetter(Vx.Node,"alpha",1,function(e){return this._filterUpToDate=!1,e>1?1:e<0?0:e});var Gx={};Object.defineProperty(Gx,"__esModule",{value:!0});Gx.Sepia=void 0;const Q5e=function(e){var t=e.data,n=t.length,r,i,o,a;for(r=0;r127&&(u=255-u),c>127&&(c=255-c),d>127&&(d=255-d),t[l]=u,t[l+1]=c,t[l+2]=d}while(--s)}while(--o)};Hx.Solarize=X5e;var qx={};Object.defineProperty(qx,"__esModule",{value:!0});qx.Threshold=void 0;const IO=At,Y5e=rr,Z5e=Xe,J5e=function(e){var t=this.threshold()*255,n=e.data,r=n.length,i;for(i=0;i{const{width:r,height:i}=t,o=document.createElement("div"),a=new ng.Stage({container:o,width:r,height:i}),s=new ng.Layer,l=new ng.Layer;return s.add(new ng.Rect({...t,fill:n?"black":"white"})),e.forEach(u=>l.add(new ng.Line({points:u.points,stroke:n?"white":"black",strokeWidth:u.strokeWidth*2,tension:0,lineCap:"round",lineJoin:"round",shadowForStrokeEnabled:!1,globalCompositeOperation:u.tool==="brush"?"source-over":"destination-out"}))),a.add(s),a.add(l),o.remove(),a},B3e=async(e,t,n)=>new Promise((r,i)=>{const o=document.createElement("canvas");o.width=t,o.height=n;const a=o.getContext("2d"),s=new Image;if(!a){o.remove(),i("Unable to get context");return}s.onload=function(){a.drawImage(s,0,0),o.remove(),r(a.getImageData(0,0,t,n))},s.src=e}),MO=async(e,t)=>{const n=e.toDataURL(t);return await B3e(n,t.width,t.height)},RA=async(e,t,n,r,i)=>{const o=Ce("canvas"),a=J2(),s=Mxe();if(!a||!s){o.error("Unable to find canvas / stage");return}const l={...t,...n},u=a.clone();u.scale({x:1,y:1});const c=u.getAbsolutePosition(),d={x:l.x+c.x,y:l.y+c.y,width:l.width,height:l.height},f=await $_(u,d),h=await MO(u,d),p=await F3e(r?e.objects.filter(xB):[],l,i),m=await $_(p,l),_=await MO(p,l);return{baseBlob:f,baseImageData:h,maskBlob:m,maskImageData:_}},z3e=()=>{Be({actionCreator:kxe,effect:async(e,{dispatch:t,getState:n})=>{const r=Ce("canvas"),i=n(),o=await RA(i.canvas.layerState,i.canvas.boundingBoxCoordinates,i.canvas.boundingBoxDimensions,i.canvas.isMaskEnabled,i.canvas.shouldPreserveMaskedArea);if(!o)return;const{maskBlob:a}=o;if(!a){r.error("Problem getting mask layer blob"),t(Gt({title:Z("toast.problemSavingMask"),description:Z("toast.problemSavingMaskDesc"),status:"error"}));return}const{autoAddBoardId:s}=i.gallery;t(me.endpoints.uploadImage.initiate({file:new File([a],"canvasMaskImage.png",{type:"image/png"}),image_category:"mask",is_intermediate:!1,board_id:s==="none"?void 0:s,crop_visible:!0,postUploadAction:{type:"TOAST",toastOptions:{title:Z("toast.maskSavedAssets")}}}))}})},j3e=()=>{Be({actionCreator:Rxe,effect:async(e,{dispatch:t,getState:n})=>{const r=Ce("canvas"),i=n(),o=await RA(i.canvas.layerState,i.canvas.boundingBoxCoordinates,i.canvas.boundingBoxDimensions,i.canvas.isMaskEnabled,i.canvas.shouldPreserveMaskedArea);if(!o)return;const{maskBlob:a}=o;if(!a){r.error("Problem getting mask layer blob"),t(Gt({title:Z("toast.problemImportingMask"),description:Z("toast.problemImportingMaskDesc"),status:"error"}));return}const{autoAddBoardId:s}=i.gallery,l=await t(me.endpoints.uploadImage.initiate({file:new File([a],"canvasMaskImage.png",{type:"image/png"}),image_category:"mask",is_intermediate:!1,board_id:s==="none"?void 0:s,crop_visible:!1,postUploadAction:{type:"TOAST",toastOptions:{title:Z("toast.maskSentControlnetAssets")}}})).unwrap(),{image_name:u}=l;t(Sc({controlNetId:e.payload.controlNet.controlNetId,controlImage:u}))}})},U3e=async()=>{const e=J2();if(!e)return;const t=e.clone();return t.scale({x:1,y:1}),$_(t,t.getClientRect())},V3e=()=>{Be({actionCreator:Pxe,effect:async(e,{dispatch:t})=>{const n=_2.get().child({namespace:"canvasCopiedToClipboardListener"}),r=await U3e();if(!r){n.error("Problem getting base layer blob"),t(Gt({title:Z("toast.problemMergingCanvas"),description:Z("toast.problemMergingCanvasDesc"),status:"error"}));return}const i=J2();if(!i){n.error("Problem getting canvas base layer"),t(Gt({title:Z("toast.problemMergingCanvas"),description:Z("toast.problemMergingCanvasDesc"),status:"error"}));return}const o=i.getClientRect({relativeTo:i.getParent()}),a=await t(me.endpoints.uploadImage.initiate({file:new File([r],"mergedCanvas.png",{type:"image/png"}),image_category:"general",is_intermediate:!0,postUploadAction:{type:"TOAST",toastOptions:{title:Z("toast.canvasMerged")}}})).unwrap(),{image_name:s}=a;t(sle({kind:"image",layer:"base",imageName:s,...o}))}})},G3e=()=>{Be({actionCreator:Exe,effect:async(e,{dispatch:t,getState:n})=>{const r=Ce("canvas"),i=n();let o;try{o=await ex(i)}catch(s){r.error(String(s)),t(Gt({title:Z("toast.problemSavingCanvas"),description:Z("toast.problemSavingCanvasDesc"),status:"error"}));return}const{autoAddBoardId:a}=i.gallery;t(me.endpoints.uploadImage.initiate({file:new File([o],"savedCanvas.png",{type:"image/png"}),image_category:"general",is_intermediate:!1,board_id:a==="none"?void 0:a,crop_visible:!0,postUploadAction:{type:"TOAST",toastOptions:{title:Z("toast.canvasSavedGallery")}}}))}})},H3e=(e,t,n)=>{var c;if(!(o0e.match(e)||zR.match(e)||Sc.match(e)||a0e.match(e)||jR.match(e))||jR.match(e)&&((c=n.controlNet.controlNets[e.payload.controlNetId])==null?void 0:c.shouldAutoConfig)===!0)return!1;const i=t.controlNet.controlNets[e.payload.controlNetId];if(!i)return!1;const{controlImage:o,processorType:a,shouldAutoConfig:s}=i;return zR.match(e)&&!s?!1:a!=="none"&&!!o},q3e=()=>{Be({predicate:H3e,effect:async(e,{dispatch:t,cancelActiveListeners:n,delay:r})=>{const i=Ce("session"),{controlNetId:o}=e.payload;n(),i.trace("ControlNet auto-process triggered"),await r(300),t(HT({controlNetId:o}))}})},Fe="positive_conditioning",We="negative_conditioning",Oe="denoise_latents",Ke="latents_to_image",Za="save_image",md="nsfw_checker",Wc="invisible_watermark",Le="noise",Tc="main_model_loader",Wx="onnx_model_loader",ys="vae_loader",QG="lora_loader",Yt="clip_skip",Hn="image_to_latents",Rs="resize_image",vh="img2img_resize",ye="canvas_output",Wn="inpaint_image",Ai="inpaint_image_resize_up",Hi="inpaint_image_resize_down",Wt="inpaint_infill",$u="inpaint_infill_resize_down",qn="inpaint_create_mask",pt="canvas_coherence_denoise_latents",Ut="canvas_coherence_noise",uc="canvas_coherence_noise_increment",mr="canvas_coherence_mask_edge",zt="canvas_coherence_inpaint_create_mask",bh="tomask",Ui="mask_blur",ki="mask_combine",Mn="mask_resize_up",qi="mask_resize_down",Gv="control_net_collect",W3e="ip_adapter",ht="metadata_accumulator",n5="esrgan",Vi="sdxl_model_loader",ke="sdxl_denoise_latents",$c="sdxl_refiner_model_loader",Hv="sdxl_refiner_positive_conditioning",qv="sdxl_refiner_negative_conditioning",vs="sdxl_refiner_denoise_latents",ca="refiner_inpaint_create_mask",qr="seamless",Qa="refiner_seamless",XG="text_to_image_graph",JE="image_to_image_graph",YG="canvas_text_to_image_graph",e4="canvas_image_to_image_graph",Kx="canvas_inpaint_graph",Qx="canvas_outpaint_graph",OA="sdxl_text_to_image_graph",z_="sxdl_image_to_image_graph",Xx="sdxl_canvas_text_to_image_graph",b0="sdxl_canvas_image_to_image_graph",cc="sdxl_canvas_inpaint_graph",dc="sdxl_canvas_outpaint_graph",ZG=e=>(e==null?void 0:e.type)==="image_output",K3e=()=>{Be({actionCreator:HT,effect:async(e,{dispatch:t,getState:n,take:r})=>{var l;const i=Ce("session"),{controlNetId:o}=e.payload,a=n().controlNet.controlNets[o];if(!(a!=null&&a.controlImage)){i.error("Unable to process ControlNet image");return}const s={nodes:{[a.processorNode.id]:{...a.processorNode,is_intermediate:!0,image:{image_name:a.controlImage}},[Za]:{id:Za,type:"save_image",is_intermediate:!0,use_cache:!1}},edges:[{source:{node_id:a.processorNode.id,field:"image"},destination:{node_id:Za,field:"image"}}]};try{const u=t(Qr.endpoints.enqueueGraph.initiate({graph:s,prepend:!0},{fixedCacheKey:"enqueueGraph"})),c=await u.unwrap();u.reset(),i.debug({enqueueResult:Qt(c)},Z("queue.graphQueued"));const[d]=await r(f=>jT.match(f)&&f.payload.data.graph_execution_state_id===c.queue_item.session_id&&f.payload.data.source_node_id===Za);if(ZG(d.payload.data.result)){const{image_name:f}=d.payload.data.result.image,[{payload:h}]=await r(m=>me.endpoints.getImageDTO.matchFulfilled(m)&&m.payload.image_name===f),p=h;i.debug({controlNetId:e.payload,processedControlImage:p},"ControlNet image processed"),t(qT({controlNetId:o,processedControlImage:p.image_name}))}}catch(u){if(i.error({graph:Qt(s)},Z("queue.graphFailedToQueue")),u instanceof Object&&"data"in u&&"status"in u&&u.status===403){const c=((l=u.data)==null?void 0:l.detail)||"Unknown Error";t(Gt({title:Z("queue.graphFailedToQueue"),status:"error",description:c,duration:15e3})),t(l0e()),t(Sc({controlNetId:o,controlImage:null}));return}t(Gt({title:Z("queue.graphFailedToQueue"),status:"error"}))}}})},MA=Ne("app/enqueueRequested");Ne("app/batchEnqueued");const Q3e=e=>{const t=window.open("");t&&e.forEach(n=>{const r=new Image;r.src=n.base64,t.document.write(n.caption),t.document.write("
"),t.document.write(r.outerHTML),t.document.write("

")})},NO=e=>new Promise((t,n)=>{const r=new FileReader;r.onload=i=>t(r.result),r.onerror=i=>n(r.error),r.onabort=i=>n(new Error("Read aborted")),r.readAsDataURL(e)}),X3e=e=>{let t=!0,n=!1;const r=e.length;let i=3;for(i;i{const t=e.length;let n=0;for(n;n{const{isPartiallyTransparent:n,isFullyTransparent:r}=X3e(e.data),i=Y3e(t.data);return n?r?"txt2img":"outpaint":i?"inpaint":"img2img"},J3e=e=>_oe(e,n=>n.isEnabled&&(!!n.processedControlImage||n.processorType==="none"&&!!n.controlImage)),Aa=(e,t,n)=>{const{isEnabled:r,controlNets:i}=e.controlNet,o=J3e(i),a=t.nodes[ht];if(r&&o.length&&o.length){const s={id:Gv,type:"collect",is_intermediate:!0};t.nodes[Gv]=s,t.edges.push({source:{node_id:Gv,field:"collection"},destination:{node_id:n,field:"control"}}),o.forEach(l=>{const{controlNetId:u,controlImage:c,processedControlImage:d,beginStepPct:f,endStepPct:h,controlMode:p,resizeMode:m,model:_,processorType:b,weight:v}=l,g={id:`control_net_${u}`,type:"controlnet",is_intermediate:!0,begin_step_percent:f,end_step_percent:h,control_mode:p,resize_mode:m,control_model:_,control_weight:v};if(d&&b!=="none")g.image={image_name:d};else if(c)g.image={image_name:c};else return;if(t.nodes[g.id]=g,a!=null&&a.controlnets){const y=qS(g,["id","type"]);a.controlnets.push(y)}t.edges.push({source:{node_id:g.id,field:"control"},destination:{node_id:Gv,field:"item"}}),pt in t.nodes&&t.edges.push({source:{node_id:g.id,field:"control"},destination:{node_id:pt,field:"control"}})})}},Pa=(e,t,n)=>{var a,s,l,u;const{isIPAdapterEnabled:r,ipAdapterInfo:i}=e.controlNet,o=t.nodes[ht];if(r&&i.model){const c={id:W3e,type:"ip_adapter",is_intermediate:!0,weight:i.weight,ip_adapter_model:{base_model:(a=i.model)==null?void 0:a.base_model,model_name:(s=i.model)==null?void 0:s.model_name},begin_step_percent:i.beginStepPct,end_step_percent:i.endStepPct};if(i.adapterImage)c.image={image_name:i.adapterImage};else return;if(t.nodes[c.id]=c,o!=null&&o.ipAdapters){const d={image:{image_name:i.adapterImage},ip_adapter_model:{base_model:(l=i.model)==null?void 0:l.base_model,model_name:(u=i.model)==null?void 0:u.model_name},weight:i.weight,begin_step_percent:i.beginStepPct,end_step_percent:i.endStepPct};o.ipAdapters.push(d)}t.edges.push({source:{node_id:c.id,field:"ip_adapter"},destination:{node_id:n,field:"ip_adapter"}}),pt in t.nodes&&t.edges.push({source:{node_id:c.id,field:"ip_adapter"},destination:{node_id:pt,field:"ip_adapter"}})}},Ep=(e,t,n,r=Tc)=>{const{loras:i}=e.lora,o=WS(i),a=t.nodes[ht];o>0&&(t.edges=t.edges.filter(u=>!(u.source.node_id===r&&["unet"].includes(u.source.field))),t.edges=t.edges.filter(u=>!(u.source.node_id===Yt&&["clip"].includes(u.source.field))));let s="",l=0;Ca(i,u=>{const{model_name:c,base_model:d,weight:f}=u,h=`${QG}_${c.replace(".","_")}`,p={type:"lora_loader",id:h,is_intermediate:!0,lora:{model_name:c,base_model:d},weight:f};a!=null&&a.loras&&a.loras.push({lora:{model_name:c,base_model:d},weight:f}),t.nodes[h]=p,l===0?(t.edges.push({source:{node_id:r,field:"unet"},destination:{node_id:h,field:"unet"}}),t.edges.push({source:{node_id:Yt,field:"clip"},destination:{node_id:h,field:"clip"}})):(t.edges.push({source:{node_id:s,field:"unet"},destination:{node_id:h,field:"unet"}}),t.edges.push({source:{node_id:s,field:"clip"},destination:{node_id:h,field:"clip"}})),l===o-1&&(t.edges.push({source:{node_id:h,field:"unet"},destination:{node_id:n,field:"unet"}}),t.id&&[Kx,Qx].includes(t.id)&&t.edges.push({source:{node_id:h,field:"unet"},destination:{node_id:pt,field:"unet"}}),t.edges.push({source:{node_id:h,field:"clip"},destination:{node_id:Fe,field:"clip"}}),t.edges.push({source:{node_id:h,field:"clip"},destination:{node_id:We,field:"clip"}})),s=h,l+=1})},Ia=(e,t,n=Ke)=>{const r=t.nodes[n];if(!r)return;r.is_intermediate=!0,r.use_cache=!0;const i={id:md,type:"img_nsfw",is_intermediate:!0};t.nodes[md]=i,t.edges.push({source:{node_id:n,field:"image"},destination:{node_id:md,field:"image"}})},eEe=["txt2img","img2img","unifiedCanvas","nodes","modelManager","queue"],NA=Ii(e=>e,({ui:e})=>uT(e.activeTab)?e.activeTab:"txt2img"),KWe=Ii(e=>e,({ui:e,config:t})=>{const r=eEe.filter(i=>!t.disabledTabs.includes(i)).indexOf(e.activeTab);return r===-1?0:r}),QWe=Ii(e=>e.ui,e=>e,{memoizeOptions:{equalityCheck:cT}}),Ra=(e,t)=>{const r=NA(e)==="unifiedCanvas"?!e.canvas.shouldAutoSave:!1,{autoAddBoardId:i}=e.gallery,o={id:Za,type:"save_image",is_intermediate:r,use_cache:!1,board:i==="none"?void 0:{board_id:i}};t.nodes[Za]=o,t.nodes[ht]&&t.edges.push({source:{node_id:ht,field:"metadata"},destination:{node_id:Za,field:"metadata"}});const s={node_id:Za,field:"image"};Wc in t.nodes?t.edges.push({source:{node_id:Wc,field:"image"},destination:s}):md in t.nodes?t.edges.push({source:{node_id:md,field:"image"},destination:s}):ye in t.nodes?t.edges.push({source:{node_id:ye,field:"image"},destination:s}):Ke in t.nodes&&t.edges.push({source:{node_id:Ke,field:"image"},destination:s})},Oa=(e,t,n)=>{const{seamlessXAxis:r,seamlessYAxis:i}=e.generation;t.nodes[qr]={id:qr,type:"seamless",seamless_x:r,seamless_y:i};let o=Oe;(t.id===OA||t.id===z_||t.id===Xx||t.id===b0||t.id===cc||t.id===dc)&&(o=ke),t.edges=t.edges.filter(a=>!(a.source.node_id===n&&["unet"].includes(a.source.field))&&!(a.source.node_id===n&&["vae"].includes(a.source.field))),t.edges.push({source:{node_id:n,field:"unet"},destination:{node_id:qr,field:"unet"}},{source:{node_id:n,field:"vae"},destination:{node_id:qr,field:"vae"}},{source:{node_id:qr,field:"unet"},destination:{node_id:o,field:"unet"}}),(t.id==Kx||t.id===Qx||t.id===cc||t.id===dc)&&t.edges.push({source:{node_id:qr,field:"unet"},destination:{node_id:pt,field:"unet"}})},Ma=(e,t,n=Tc)=>{const{vae:r,canvasCoherenceMode:i}=e.generation,{boundingBoxScaleMethod:o}=e.canvas,{shouldUseSDXLRefiner:a}=e.sdxl,s=["auto","manual"].includes(o),l=!r,u=t.nodes[ht];l||(t.nodes[ys]={type:"vae_loader",id:ys,is_intermediate:!0,vae_model:r});const c=n==Wx;(t.id===XG||t.id===JE||t.id===OA||t.id===z_)&&t.edges.push({source:{node_id:l?n:ys,field:l&&c?"vae_decoder":"vae"},destination:{node_id:Ke,field:"vae"}}),(t.id===YG||t.id===e4||t.id===Xx||t.id==b0)&&t.edges.push({source:{node_id:l?n:ys,field:l&&c?"vae_decoder":"vae"},destination:{node_id:s?Ke:ye,field:"vae"}}),(t.id===JE||t.id===z_||t.id===e4||t.id===b0)&&t.edges.push({source:{node_id:l?n:ys,field:l&&c?"vae_decoder":"vae"},destination:{node_id:Hn,field:"vae"}}),(t.id===Kx||t.id===Qx||t.id===cc||t.id===dc)&&(t.edges.push({source:{node_id:l?n:ys,field:l&&c?"vae_decoder":"vae"},destination:{node_id:Wn,field:"vae"}},{source:{node_id:l?n:ys,field:l&&c?"vae_decoder":"vae"},destination:{node_id:qn,field:"vae"}},{source:{node_id:l?n:ys,field:l&&c?"vae_decoder":"vae"},destination:{node_id:Ke,field:"vae"}}),i!=="unmasked"&&t.edges.push({source:{node_id:l?n:ys,field:l&&c?"vae_decoder":"vae"},destination:{node_id:zt,field:"vae"}})),a&&(t.id===cc||t.id===dc)&&t.edges.push({source:{node_id:l?n:ys,field:l&&c?"vae_decoder":"vae"},destination:{node_id:ca,field:"vae"}}),r&&u&&(u.vae=r)},Na=(e,t,n=Ke)=>{const i=NA(e)==="unifiedCanvas"?!e.canvas.shouldAutoSave:!1,o=t.nodes[n],a=t.nodes[md],s=t.nodes[ht];if(!o)return;const l={id:Wc,type:"img_watermark",is_intermediate:i};t.nodes[Wc]=l,o.is_intermediate=!0,o.use_cache=!0,a?(a.is_intermediate=!0,t.edges.push({source:{node_id:md,field:"image"},destination:{node_id:Wc,field:"image"}})):t.edges.push({source:{node_id:n,field:"image"},destination:{node_id:Wc,field:"image"}}),s&&t.edges.push({source:{node_id:ht,field:"metadata"},destination:{node_id:Wc,field:"metadata"}})},tEe=(e,t)=>{const n=Ce("nodes"),{positivePrompt:r,negativePrompt:i,model:o,cfgScale:a,scheduler:s,seed:l,steps:u,img2imgStrength:c,vaePrecision:d,clipSkip:f,shouldUseCpuNoise:h,seamlessXAxis:p,seamlessYAxis:m}=e.generation,{width:_,height:b}=e.canvas.boundingBoxDimensions,{scaledBoundingBoxDimensions:v,boundingBoxScaleMethod:g}=e.canvas,y=d==="fp32",S=!0,w=["auto","manual"].includes(g);if(!o)throw n.error("No model found in state"),new Error("No model found in state");let x=Tc;const C=h,T={id:e4,nodes:{[x]:{type:"main_model_loader",id:x,is_intermediate:S,model:o},[Yt]:{type:"clip_skip",id:Yt,is_intermediate:S,skipped_layers:f},[Fe]:{type:"compel",id:Fe,is_intermediate:S,prompt:r},[We]:{type:"compel",id:We,is_intermediate:S,prompt:i},[Le]:{type:"noise",id:Le,is_intermediate:S,use_cpu:C,seed:l,width:w?v.width:_,height:w?v.height:b},[Hn]:{type:"i2l",id:Hn,is_intermediate:S},[Oe]:{type:"denoise_latents",id:Oe,is_intermediate:S,cfg_scale:a,scheduler:s,steps:u,denoising_start:1-c,denoising_end:1},[ye]:{type:"l2i",id:ye,is_intermediate:S}},edges:[{source:{node_id:x,field:"unet"},destination:{node_id:Oe,field:"unet"}},{source:{node_id:x,field:"clip"},destination:{node_id:Yt,field:"clip"}},{source:{node_id:Yt,field:"clip"},destination:{node_id:Fe,field:"clip"}},{source:{node_id:Yt,field:"clip"},destination:{node_id:We,field:"clip"}},{source:{node_id:Fe,field:"conditioning"},destination:{node_id:Oe,field:"positive_conditioning"}},{source:{node_id:We,field:"conditioning"},destination:{node_id:Oe,field:"negative_conditioning"}},{source:{node_id:Le,field:"noise"},destination:{node_id:Oe,field:"noise"}},{source:{node_id:Hn,field:"latents"},destination:{node_id:Oe,field:"latents"}}]};return w?(T.nodes[vh]={id:vh,type:"img_resize",is_intermediate:S,image:t,width:v.width,height:v.height},T.nodes[Ke]={id:Ke,type:"l2i",is_intermediate:S,fp32:y},T.nodes[ye]={id:ye,type:"img_resize",is_intermediate:S,width:_,height:b},T.edges.push({source:{node_id:vh,field:"image"},destination:{node_id:Hn,field:"image"}},{source:{node_id:Oe,field:"latents"},destination:{node_id:Ke,field:"latents"}},{source:{node_id:Ke,field:"image"},destination:{node_id:ye,field:"image"}})):(T.nodes[ye]={type:"l2i",id:ye,is_intermediate:S,fp32:y},T.nodes[Hn].image=t,T.edges.push({source:{node_id:Oe,field:"latents"},destination:{node_id:ye,field:"latents"}})),T.nodes[ht]={id:ht,type:"metadata_accumulator",generation_mode:"img2img",cfg_scale:a,width:w?v.width:_,height:w?v.height:b,positive_prompt:r,negative_prompt:i,model:o,seed:l,steps:u,rand_device:C?"cpu":"cuda",scheduler:s,vae:void 0,controlnets:[],loras:[],ipAdapters:[],clip_skip:f,strength:c,init_image:t.image_name},(p||m)&&(Oa(e,T,x),x=qr),Ep(e,T,Oe),Ma(e,T,x),Aa(e,T,Oe),Pa(e,T,Oe),e.system.shouldUseNSFWChecker&&Ia(e,T,ye),e.system.shouldUseWatermarker&&Na(e,T,ye),Ra(e,T),T},nEe=(e,t,n)=>{const r=Ce("nodes"),{positivePrompt:i,negativePrompt:o,model:a,cfgScale:s,scheduler:l,steps:u,img2imgStrength:c,seed:d,vaePrecision:f,shouldUseCpuNoise:h,maskBlur:p,maskBlurMethod:m,canvasCoherenceMode:_,canvasCoherenceSteps:b,canvasCoherenceStrength:v,clipSkip:g,seamlessXAxis:y,seamlessYAxis:S}=e.generation;if(!a)throw r.error("No Image found in state"),new Error("No Image found in state");const{width:w,height:x}=e.canvas.boundingBoxDimensions,{scaledBoundingBoxDimensions:C,boundingBoxScaleMethod:T}=e.canvas,k=!0,P=f==="fp32",$=["auto","manual"].includes(T);let O=Tc;const E=h,A={id:Kx,nodes:{[O]:{type:"main_model_loader",id:O,is_intermediate:k,model:a},[Yt]:{type:"clip_skip",id:Yt,is_intermediate:k,skipped_layers:g},[Fe]:{type:"compel",id:Fe,is_intermediate:k,prompt:i},[We]:{type:"compel",id:We,is_intermediate:k,prompt:o},[Ui]:{type:"img_blur",id:Ui,is_intermediate:k,radius:p,blur_type:m},[Wn]:{type:"i2l",id:Wn,is_intermediate:k,fp32:P},[Le]:{type:"noise",id:Le,use_cpu:E,seed:d,is_intermediate:k},[qn]:{type:"create_denoise_mask",id:qn,is_intermediate:k,fp32:P},[Oe]:{type:"denoise_latents",id:Oe,is_intermediate:k,steps:u,cfg_scale:s,scheduler:l,denoising_start:1-c,denoising_end:1},[Ut]:{type:"noise",id:Ut,use_cpu:E,seed:d+1,is_intermediate:k},[uc]:{type:"add",id:uc,b:1,is_intermediate:k},[pt]:{type:"denoise_latents",id:pt,is_intermediate:k,steps:b,cfg_scale:s,scheduler:l,denoising_start:1-v,denoising_end:1},[Ke]:{type:"l2i",id:Ke,is_intermediate:k,fp32:P},[ye]:{type:"color_correct",id:ye,is_intermediate:k,reference:t}},edges:[{source:{node_id:O,field:"unet"},destination:{node_id:Oe,field:"unet"}},{source:{node_id:O,field:"clip"},destination:{node_id:Yt,field:"clip"}},{source:{node_id:Yt,field:"clip"},destination:{node_id:Fe,field:"clip"}},{source:{node_id:Yt,field:"clip"},destination:{node_id:We,field:"clip"}},{source:{node_id:Fe,field:"conditioning"},destination:{node_id:Oe,field:"positive_conditioning"}},{source:{node_id:We,field:"conditioning"},destination:{node_id:Oe,field:"negative_conditioning"}},{source:{node_id:Le,field:"noise"},destination:{node_id:Oe,field:"noise"}},{source:{node_id:Wn,field:"latents"},destination:{node_id:Oe,field:"latents"}},{source:{node_id:Ui,field:"image"},destination:{node_id:qn,field:"mask"}},{source:{node_id:qn,field:"denoise_mask"},destination:{node_id:Oe,field:"denoise_mask"}},{source:{node_id:O,field:"unet"},destination:{node_id:pt,field:"unet"}},{source:{node_id:Fe,field:"conditioning"},destination:{node_id:pt,field:"positive_conditioning"}},{source:{node_id:We,field:"conditioning"},destination:{node_id:pt,field:"negative_conditioning"}},{source:{node_id:Ut,field:"noise"},destination:{node_id:pt,field:"noise"}},{source:{node_id:Oe,field:"latents"},destination:{node_id:pt,field:"latents"}},{source:{node_id:pt,field:"latents"},destination:{node_id:Ke,field:"latents"}}]};if($){const D=C.width,L=C.height;A.nodes[Ai]={type:"img_resize",id:Ai,is_intermediate:k,width:D,height:L,image:t},A.nodes[Mn]={type:"img_resize",id:Mn,is_intermediate:k,width:D,height:L,image:n},A.nodes[Hi]={type:"img_resize",id:Hi,is_intermediate:k,width:w,height:x},A.nodes[qi]={type:"img_resize",id:qi,is_intermediate:k,width:w,height:x},A.nodes[Le].width=D,A.nodes[Le].height=L,A.nodes[Ut].width=D,A.nodes[Ut].height=L,A.edges.push({source:{node_id:Ai,field:"image"},destination:{node_id:Wn,field:"image"}},{source:{node_id:Mn,field:"image"},destination:{node_id:Ui,field:"image"}},{source:{node_id:Ai,field:"image"},destination:{node_id:qn,field:"image"}},{source:{node_id:Ke,field:"image"},destination:{node_id:Hi,field:"image"}},{source:{node_id:Hi,field:"image"},destination:{node_id:ye,field:"image"}},{source:{node_id:Ui,field:"image"},destination:{node_id:qi,field:"image"}},{source:{node_id:qi,field:"image"},destination:{node_id:ye,field:"mask"}})}else A.nodes[Le].width=w,A.nodes[Le].height=x,A.nodes[Ut].width=w,A.nodes[Ut].height=x,A.nodes[Wn]={...A.nodes[Wn],image:t},A.nodes[Ui]={...A.nodes[Ui],image:n},A.nodes[qn]={...A.nodes[qn],image:t},A.edges.push({source:{node_id:Ke,field:"image"},destination:{node_id:ye,field:"image"}},{source:{node_id:Ui,field:"image"},destination:{node_id:ye,field:"mask"}});return _!=="unmasked"&&(A.nodes[zt]={type:"create_denoise_mask",id:zt,is_intermediate:k,fp32:P},$?A.edges.push({source:{node_id:Ai,field:"image"},destination:{node_id:zt,field:"image"}}):A.nodes[zt]={...A.nodes[zt],image:t},_==="mask"&&($?A.edges.push({source:{node_id:Mn,field:"image"},destination:{node_id:zt,field:"mask"}}):A.nodes[zt]={...A.nodes[zt],mask:n}),_==="edge"&&(A.nodes[mr]={type:"mask_edge",id:mr,is_intermediate:k,edge_blur:p,edge_size:p*2,low_threshold:100,high_threshold:200},$?A.edges.push({source:{node_id:Mn,field:"image"},destination:{node_id:mr,field:"image"}}):A.nodes[mr]={...A.nodes[mr],image:n},A.edges.push({source:{node_id:mr,field:"image"},destination:{node_id:zt,field:"mask"}})),A.edges.push({source:{node_id:zt,field:"denoise_mask"},destination:{node_id:pt,field:"denoise_mask"}})),(y||S)&&(Oa(e,A,O),O=qr),Ma(e,A,O),Ep(e,A,Oe,O),Aa(e,A,Oe),Pa(e,A,Oe),e.system.shouldUseNSFWChecker&&Ia(e,A,ye),e.system.shouldUseWatermarker&&Na(e,A,ye),Ra(e,A),A},rEe=(e,t,n)=>{const r=Ce("nodes"),{positivePrompt:i,negativePrompt:o,model:a,cfgScale:s,scheduler:l,steps:u,img2imgStrength:c,seed:d,vaePrecision:f,shouldUseCpuNoise:h,maskBlur:p,canvasCoherenceMode:m,canvasCoherenceSteps:_,canvasCoherenceStrength:b,infillTileSize:v,infillPatchmatchDownscaleSize:g,infillMethod:y,clipSkip:S,seamlessXAxis:w,seamlessYAxis:x}=e.generation;if(!a)throw r.error("No model found in state"),new Error("No model found in state");const{width:C,height:T}=e.canvas.boundingBoxDimensions,{scaledBoundingBoxDimensions:k,boundingBoxScaleMethod:P}=e.canvas,$=f==="fp32",O=!0,E=["auto","manual"].includes(P);let A=Tc;const D=h,L={id:Qx,nodes:{[A]:{type:"main_model_loader",id:A,is_intermediate:O,model:a},[Yt]:{type:"clip_skip",id:Yt,is_intermediate:O,skipped_layers:S},[Fe]:{type:"compel",id:Fe,is_intermediate:O,prompt:i},[We]:{type:"compel",id:We,is_intermediate:O,prompt:o},[bh]:{type:"tomask",id:bh,is_intermediate:O,image:t},[ki]:{type:"mask_combine",id:ki,is_intermediate:O,mask2:n},[Wn]:{type:"i2l",id:Wn,is_intermediate:O,fp32:$},[Le]:{type:"noise",id:Le,use_cpu:D,seed:d,is_intermediate:O},[qn]:{type:"create_denoise_mask",id:qn,is_intermediate:O,fp32:$},[Oe]:{type:"denoise_latents",id:Oe,is_intermediate:O,steps:u,cfg_scale:s,scheduler:l,denoising_start:1-c,denoising_end:1},[Ut]:{type:"noise",id:Ut,use_cpu:D,seed:d+1,is_intermediate:O},[uc]:{type:"add",id:uc,b:1,is_intermediate:O},[pt]:{type:"denoise_latents",id:pt,is_intermediate:O,steps:_,cfg_scale:s,scheduler:l,denoising_start:1-b,denoising_end:1},[Ke]:{type:"l2i",id:Ke,is_intermediate:O,fp32:$},[ye]:{type:"color_correct",id:ye,is_intermediate:O}},edges:[{source:{node_id:A,field:"unet"},destination:{node_id:Oe,field:"unet"}},{source:{node_id:A,field:"clip"},destination:{node_id:Yt,field:"clip"}},{source:{node_id:Yt,field:"clip"},destination:{node_id:Fe,field:"clip"}},{source:{node_id:Yt,field:"clip"},destination:{node_id:We,field:"clip"}},{source:{node_id:Wt,field:"image"},destination:{node_id:Wn,field:"image"}},{source:{node_id:bh,field:"image"},destination:{node_id:ki,field:"mask1"}},{source:{node_id:Fe,field:"conditioning"},destination:{node_id:Oe,field:"positive_conditioning"}},{source:{node_id:We,field:"conditioning"},destination:{node_id:Oe,field:"negative_conditioning"}},{source:{node_id:Le,field:"noise"},destination:{node_id:Oe,field:"noise"}},{source:{node_id:Wn,field:"latents"},destination:{node_id:Oe,field:"latents"}},{source:{node_id:E?Mn:ki,field:"image"},destination:{node_id:qn,field:"mask"}},{source:{node_id:qn,field:"denoise_mask"},destination:{node_id:Oe,field:"denoise_mask"}},{source:{node_id:A,field:"unet"},destination:{node_id:pt,field:"unet"}},{source:{node_id:Fe,field:"conditioning"},destination:{node_id:pt,field:"positive_conditioning"}},{source:{node_id:We,field:"conditioning"},destination:{node_id:pt,field:"negative_conditioning"}},{source:{node_id:Ut,field:"noise"},destination:{node_id:pt,field:"noise"}},{source:{node_id:Oe,field:"latents"},destination:{node_id:pt,field:"latents"}},{source:{node_id:Wt,field:"image"},destination:{node_id:qn,field:"image"}},{source:{node_id:pt,field:"latents"},destination:{node_id:Ke,field:"latents"}}]};if(y==="patchmatch"&&(L.nodes[Wt]={type:"infill_patchmatch",id:Wt,is_intermediate:O,downscale:g}),y==="lama"&&(L.nodes[Wt]={type:"infill_lama",id:Wt,is_intermediate:O}),y==="cv2"&&(L.nodes[Wt]={type:"infill_cv2",id:Wt,is_intermediate:O}),y==="tile"&&(L.nodes[Wt]={type:"infill_tile",id:Wt,is_intermediate:O,tile_size:v}),E){const M=k.width,R=k.height;L.nodes[Ai]={type:"img_resize",id:Ai,is_intermediate:O,width:M,height:R,image:t},L.nodes[Mn]={type:"img_resize",id:Mn,is_intermediate:O,width:M,height:R},L.nodes[Hi]={type:"img_resize",id:Hi,is_intermediate:O,width:C,height:T},L.nodes[$u]={type:"img_resize",id:$u,is_intermediate:O,width:C,height:T},L.nodes[qi]={type:"img_resize",id:qi,is_intermediate:O,width:C,height:T},L.nodes[Le].width=M,L.nodes[Le].height=R,L.nodes[Ut].width=M,L.nodes[Ut].height=R,L.edges.push({source:{node_id:Ai,field:"image"},destination:{node_id:Wt,field:"image"}},{source:{node_id:ki,field:"image"},destination:{node_id:Mn,field:"image"}},{source:{node_id:Ke,field:"image"},destination:{node_id:Hi,field:"image"}},{source:{node_id:Mn,field:"image"},destination:{node_id:qi,field:"image"}},{source:{node_id:Wt,field:"image"},destination:{node_id:$u,field:"image"}},{source:{node_id:$u,field:"image"},destination:{node_id:ye,field:"reference"}},{source:{node_id:Hi,field:"image"},destination:{node_id:ye,field:"image"}},{source:{node_id:qi,field:"image"},destination:{node_id:ye,field:"mask"}})}else L.nodes[Wt]={...L.nodes[Wt],image:t},L.nodes[Le].width=C,L.nodes[Le].height=T,L.nodes[Ut].width=C,L.nodes[Ut].height=T,L.nodes[Wn]={...L.nodes[Wn],image:t},L.edges.push({source:{node_id:Wt,field:"image"},destination:{node_id:ye,field:"reference"}},{source:{node_id:Ke,field:"image"},destination:{node_id:ye,field:"image"}},{source:{node_id:ki,field:"image"},destination:{node_id:ye,field:"mask"}});return m!=="unmasked"&&(L.nodes[zt]={type:"create_denoise_mask",id:zt,is_intermediate:O,fp32:$},L.edges.push({source:{node_id:Wt,field:"image"},destination:{node_id:zt,field:"image"}}),m==="mask"&&(E?L.edges.push({source:{node_id:Mn,field:"image"},destination:{node_id:zt,field:"mask"}}):L.edges.push({source:{node_id:ki,field:"image"},destination:{node_id:zt,field:"mask"}})),m==="edge"&&(L.nodes[mr]={type:"mask_edge",id:mr,is_intermediate:O,edge_blur:p,edge_size:p*2,low_threshold:100,high_threshold:200},E?L.edges.push({source:{node_id:Mn,field:"image"},destination:{node_id:mr,field:"image"}}):L.edges.push({source:{node_id:ki,field:"image"},destination:{node_id:mr,field:"image"}}),L.edges.push({source:{node_id:mr,field:"image"},destination:{node_id:zt,field:"mask"}})),L.edges.push({source:{node_id:zt,field:"denoise_mask"},destination:{node_id:pt,field:"denoise_mask"}})),(w||x)&&(Oa(e,L,A),A=qr),Ma(e,L,A),Ep(e,L,Oe,A),Aa(e,L,Oe),Pa(e,L,Oe),e.system.shouldUseNSFWChecker&&Ia(e,L,ye),e.system.shouldUseWatermarker&&Na(e,L,ye),Ra(e,L),L},kp=(e,t,n,r=Vi)=>{const{loras:i}=e.lora,o=WS(i),a=t.nodes[ht],s=r;let l=r;[qr,ca].includes(r)&&(l=Vi),o>0&&(t.edges=t.edges.filter(d=>!(d.source.node_id===s&&["unet"].includes(d.source.field))&&!(d.source.node_id===l&&["clip"].includes(d.source.field))&&!(d.source.node_id===l&&["clip2"].includes(d.source.field))));let u="",c=0;Ca(i,d=>{const{model_name:f,base_model:h,weight:p}=d,m=`${QG}_${f.replace(".","_")}`,_={type:"sdxl_lora_loader",id:m,is_intermediate:!0,lora:{model_name:f,base_model:h},weight:p};a&&(a.loras||(a.loras=[]),a.loras.push({lora:{model_name:f,base_model:h},weight:p})),t.nodes[m]=_,c===0?(t.edges.push({source:{node_id:s,field:"unet"},destination:{node_id:m,field:"unet"}}),t.edges.push({source:{node_id:l,field:"clip"},destination:{node_id:m,field:"clip"}}),t.edges.push({source:{node_id:l,field:"clip2"},destination:{node_id:m,field:"clip2"}})):(t.edges.push({source:{node_id:u,field:"unet"},destination:{node_id:m,field:"unet"}}),t.edges.push({source:{node_id:u,field:"clip"},destination:{node_id:m,field:"clip"}}),t.edges.push({source:{node_id:u,field:"clip2"},destination:{node_id:m,field:"clip2"}})),c===o-1&&(t.edges.push({source:{node_id:m,field:"unet"},destination:{node_id:n,field:"unet"}}),t.id&&[cc,dc].includes(t.id)&&t.edges.push({source:{node_id:m,field:"unet"},destination:{node_id:pt,field:"unet"}}),t.edges.push({source:{node_id:m,field:"clip"},destination:{node_id:Fe,field:"clip"}}),t.edges.push({source:{node_id:m,field:"clip"},destination:{node_id:We,field:"clip"}}),t.edges.push({source:{node_id:m,field:"clip2"},destination:{node_id:Fe,field:"clip2"}}),t.edges.push({source:{node_id:m,field:"clip2"},destination:{node_id:We,field:"clip2"}})),u=m,c+=1})},Zd=(e,t)=>{const{positivePrompt:n,negativePrompt:r}=e.generation,{positiveStylePrompt:i,negativeStylePrompt:o,shouldConcatSDXLStylePrompt:a}=e.sdxl,s=a||t?[n,i].join(" "):i,l=a||t?[r,o].join(" "):o;return{joinedPositiveStylePrompt:s,joinedNegativeStylePrompt:l}},Tp=(e,t,n,r,i,o)=>{const{refinerModel:a,refinerPositiveAestheticScore:s,refinerNegativeAestheticScore:l,refinerSteps:u,refinerScheduler:c,refinerCFGScale:d,refinerStart:f}=e.sdxl,{seamlessXAxis:h,seamlessYAxis:p,vaePrecision:m}=e.generation,{boundingBoxScaleMethod:_}=e.canvas,b=m==="fp32",v=["auto","manual"].includes(_);if(!a)return;const g=t.nodes[ht];g&&(g.refiner_model=a,g.refiner_positive_aesthetic_score=s,g.refiner_negative_aesthetic_score=l,g.refiner_cfg_scale=d,g.refiner_scheduler=c,g.refiner_start=f,g.refiner_steps=u);const y=r||Vi,{joinedPositiveStylePrompt:S,joinedNegativeStylePrompt:w}=Zd(e,!0);t.edges=t.edges.filter(x=>!(x.source.node_id===n&&["latents"].includes(x.source.field))),t.edges=t.edges.filter(x=>!(x.source.node_id===y&&["vae"].includes(x.source.field))),t.nodes[$c]={type:"sdxl_refiner_model_loader",id:$c,model:a},t.nodes[Hv]={type:"sdxl_refiner_compel_prompt",id:Hv,style:S,aesthetic_score:s},t.nodes[qv]={type:"sdxl_refiner_compel_prompt",id:qv,style:w,aesthetic_score:l},t.nodes[vs]={type:"denoise_latents",id:vs,cfg_scale:d,steps:u,scheduler:c,denoising_start:f,denoising_end:1},h||p?(t.nodes[Qa]={id:Qa,type:"seamless",seamless_x:h,seamless_y:p},t.edges.push({source:{node_id:$c,field:"unet"},destination:{node_id:Qa,field:"unet"}},{source:{node_id:$c,field:"vae"},destination:{node_id:Qa,field:"vae"}},{source:{node_id:Qa,field:"unet"},destination:{node_id:vs,field:"unet"}})):t.edges.push({source:{node_id:$c,field:"unet"},destination:{node_id:vs,field:"unet"}}),t.edges.push({source:{node_id:$c,field:"clip2"},destination:{node_id:Hv,field:"clip2"}},{source:{node_id:$c,field:"clip2"},destination:{node_id:qv,field:"clip2"}},{source:{node_id:Hv,field:"conditioning"},destination:{node_id:vs,field:"positive_conditioning"}},{source:{node_id:qv,field:"conditioning"},destination:{node_id:vs,field:"negative_conditioning"}},{source:{node_id:n,field:"latents"},destination:{node_id:vs,field:"latents"}}),(t.id===cc||t.id===dc)&&(t.nodes[ca]={type:"create_denoise_mask",id:ca,is_intermediate:!0,fp32:b},v?t.edges.push({source:{node_id:Ai,field:"image"},destination:{node_id:ca,field:"image"}}):t.nodes[ca]={...t.nodes[ca],image:i},t.id===cc&&(v?t.edges.push({source:{node_id:Mn,field:"image"},destination:{node_id:ca,field:"mask"}}):t.nodes[ca]={...t.nodes[ca],mask:o}),t.id===dc&&t.edges.push({source:{node_id:v?Mn:ki,field:"image"},destination:{node_id:ca,field:"mask"}}),t.edges.push({source:{node_id:ca,field:"denoise_mask"},destination:{node_id:vs,field:"denoise_mask"}})),t.id===Xx||t.id===b0?t.edges.push({source:{node_id:vs,field:"latents"},destination:{node_id:v?Ke:ye,field:"latents"}}):t.edges.push({source:{node_id:vs,field:"latents"},destination:{node_id:Ke,field:"latents"}})},iEe=(e,t)=>{const n=Ce("nodes"),{positivePrompt:r,negativePrompt:i,model:o,cfgScale:a,scheduler:s,seed:l,steps:u,vaePrecision:c,shouldUseCpuNoise:d,seamlessXAxis:f,seamlessYAxis:h}=e.generation,{shouldUseSDXLRefiner:p,refinerStart:m,sdxlImg2ImgDenoisingStrength:_}=e.sdxl,{width:b,height:v}=e.canvas.boundingBoxDimensions,{scaledBoundingBoxDimensions:g,boundingBoxScaleMethod:y}=e.canvas,S=c==="fp32",w=!0,x=["auto","manual"].includes(y);if(!o)throw n.error("No model found in state"),new Error("No model found in state");let C=Vi;const T=d,{joinedPositiveStylePrompt:k,joinedNegativeStylePrompt:P}=Zd(e),$={id:b0,nodes:{[C]:{type:"sdxl_model_loader",id:C,model:o},[Fe]:{type:"sdxl_compel_prompt",id:Fe,prompt:r,style:k},[We]:{type:"sdxl_compel_prompt",id:We,prompt:i,style:P},[Le]:{type:"noise",id:Le,is_intermediate:w,use_cpu:T,seed:l,width:x?g.width:b,height:x?g.height:v},[Hn]:{type:"i2l",id:Hn,is_intermediate:w,fp32:S},[ke]:{type:"denoise_latents",id:ke,is_intermediate:w,cfg_scale:a,scheduler:s,steps:u,denoising_start:p?Math.min(m,1-_):1-_,denoising_end:p?m:1}},edges:[{source:{node_id:C,field:"unet"},destination:{node_id:ke,field:"unet"}},{source:{node_id:C,field:"clip"},destination:{node_id:Fe,field:"clip"}},{source:{node_id:C,field:"clip2"},destination:{node_id:Fe,field:"clip2"}},{source:{node_id:C,field:"clip"},destination:{node_id:We,field:"clip"}},{source:{node_id:C,field:"clip2"},destination:{node_id:We,field:"clip2"}},{source:{node_id:Fe,field:"conditioning"},destination:{node_id:ke,field:"positive_conditioning"}},{source:{node_id:We,field:"conditioning"},destination:{node_id:ke,field:"negative_conditioning"}},{source:{node_id:Le,field:"noise"},destination:{node_id:ke,field:"noise"}},{source:{node_id:Hn,field:"latents"},destination:{node_id:ke,field:"latents"}}]};return x?($.nodes[vh]={id:vh,type:"img_resize",is_intermediate:w,image:t,width:g.width,height:g.height},$.nodes[Ke]={id:Ke,type:"l2i",is_intermediate:w,fp32:S},$.nodes[ye]={id:ye,type:"img_resize",is_intermediate:w,width:b,height:v},$.edges.push({source:{node_id:vh,field:"image"},destination:{node_id:Hn,field:"image"}},{source:{node_id:ke,field:"latents"},destination:{node_id:Ke,field:"latents"}},{source:{node_id:Ke,field:"image"},destination:{node_id:ye,field:"image"}})):($.nodes[ye]={type:"l2i",id:ye,is_intermediate:w,fp32:S},$.nodes[Hn].image=t,$.edges.push({source:{node_id:ke,field:"latents"},destination:{node_id:ye,field:"latents"}})),$.nodes[ht]={id:ht,type:"metadata_accumulator",generation_mode:"img2img",cfg_scale:a,width:x?g.width:b,height:x?g.height:v,positive_prompt:r,negative_prompt:i,model:o,seed:l,steps:u,rand_device:T?"cpu":"cuda",scheduler:s,vae:void 0,controlnets:[],loras:[],ipAdapters:[],strength:_,init_image:t.image_name},$.edges.push({source:{node_id:ht,field:"metadata"},destination:{node_id:ye,field:"metadata"}}),(f||h)&&(Oa(e,$,C),C=qr),p&&(Tp(e,$,ke,C),(f||h)&&(C=Qa)),Ma(e,$,C),kp(e,$,ke,C),Aa(e,$,ke),Pa(e,$,ke),e.system.shouldUseNSFWChecker&&Ia(e,$,ye),e.system.shouldUseWatermarker&&Na(e,$,ye),Ra(e,$),$},oEe=(e,t,n)=>{const r=Ce("nodes"),{positivePrompt:i,negativePrompt:o,model:a,cfgScale:s,scheduler:l,steps:u,seed:c,vaePrecision:d,shouldUseCpuNoise:f,maskBlur:h,maskBlurMethod:p,canvasCoherenceMode:m,canvasCoherenceSteps:_,canvasCoherenceStrength:b,seamlessXAxis:v,seamlessYAxis:g}=e.generation,{sdxlImg2ImgDenoisingStrength:y,shouldUseSDXLRefiner:S,refinerStart:w}=e.sdxl;if(!a)throw r.error("No model found in state"),new Error("No model found in state");const{width:x,height:C}=e.canvas.boundingBoxDimensions,{scaledBoundingBoxDimensions:T,boundingBoxScaleMethod:k}=e.canvas,P=d==="fp32",$=!0,O=["auto","manual"].includes(k);let E=Vi;const A=f,{joinedPositiveStylePrompt:D,joinedNegativeStylePrompt:L}=Zd(e),M={id:cc,nodes:{[E]:{type:"sdxl_model_loader",id:E,model:a},[Fe]:{type:"sdxl_compel_prompt",id:Fe,prompt:i,style:D},[We]:{type:"sdxl_compel_prompt",id:We,prompt:o,style:L},[Ui]:{type:"img_blur",id:Ui,is_intermediate:$,radius:h,blur_type:p},[Wn]:{type:"i2l",id:Wn,is_intermediate:$,fp32:P},[Le]:{type:"noise",id:Le,use_cpu:A,seed:c,is_intermediate:$},[qn]:{type:"create_denoise_mask",id:qn,is_intermediate:$,fp32:P},[ke]:{type:"denoise_latents",id:ke,is_intermediate:$,steps:u,cfg_scale:s,scheduler:l,denoising_start:S?Math.min(w,1-y):1-y,denoising_end:S?w:1},[Ut]:{type:"noise",id:Ut,use_cpu:A,seed:c+1,is_intermediate:$},[uc]:{type:"add",id:uc,b:1,is_intermediate:$},[pt]:{type:"denoise_latents",id:pt,is_intermediate:$,steps:_,cfg_scale:s,scheduler:l,denoising_start:1-b,denoising_end:1},[Ke]:{type:"l2i",id:Ke,is_intermediate:$,fp32:P},[ye]:{type:"color_correct",id:ye,is_intermediate:$,reference:t}},edges:[{source:{node_id:E,field:"unet"},destination:{node_id:ke,field:"unet"}},{source:{node_id:E,field:"clip"},destination:{node_id:Fe,field:"clip"}},{source:{node_id:E,field:"clip2"},destination:{node_id:Fe,field:"clip2"}},{source:{node_id:E,field:"clip"},destination:{node_id:We,field:"clip"}},{source:{node_id:E,field:"clip2"},destination:{node_id:We,field:"clip2"}},{source:{node_id:Fe,field:"conditioning"},destination:{node_id:ke,field:"positive_conditioning"}},{source:{node_id:We,field:"conditioning"},destination:{node_id:ke,field:"negative_conditioning"}},{source:{node_id:Le,field:"noise"},destination:{node_id:ke,field:"noise"}},{source:{node_id:Wn,field:"latents"},destination:{node_id:ke,field:"latents"}},{source:{node_id:Ui,field:"image"},destination:{node_id:qn,field:"mask"}},{source:{node_id:qn,field:"denoise_mask"},destination:{node_id:ke,field:"denoise_mask"}},{source:{node_id:E,field:"unet"},destination:{node_id:pt,field:"unet"}},{source:{node_id:Fe,field:"conditioning"},destination:{node_id:pt,field:"positive_conditioning"}},{source:{node_id:We,field:"conditioning"},destination:{node_id:pt,field:"negative_conditioning"}},{source:{node_id:Ut,field:"noise"},destination:{node_id:pt,field:"noise"}},{source:{node_id:ke,field:"latents"},destination:{node_id:pt,field:"latents"}},{source:{node_id:pt,field:"latents"},destination:{node_id:Ke,field:"latents"}}]};if(O){const R=T.width,N=T.height;M.nodes[Ai]={type:"img_resize",id:Ai,is_intermediate:$,width:R,height:N,image:t},M.nodes[Mn]={type:"img_resize",id:Mn,is_intermediate:$,width:R,height:N,image:n},M.nodes[Hi]={type:"img_resize",id:Hi,is_intermediate:$,width:x,height:C},M.nodes[qi]={type:"img_resize",id:qi,is_intermediate:$,width:x,height:C},M.nodes[Le].width=R,M.nodes[Le].height=N,M.nodes[Ut].width=R,M.nodes[Ut].height=N,M.edges.push({source:{node_id:Ai,field:"image"},destination:{node_id:Wn,field:"image"}},{source:{node_id:Mn,field:"image"},destination:{node_id:Ui,field:"image"}},{source:{node_id:Ai,field:"image"},destination:{node_id:qn,field:"image"}},{source:{node_id:Ke,field:"image"},destination:{node_id:Hi,field:"image"}},{source:{node_id:Hi,field:"image"},destination:{node_id:ye,field:"image"}},{source:{node_id:Ui,field:"image"},destination:{node_id:qi,field:"image"}},{source:{node_id:qi,field:"image"},destination:{node_id:ye,field:"mask"}})}else M.nodes[Le].width=x,M.nodes[Le].height=C,M.nodes[Ut].width=x,M.nodes[Ut].height=C,M.nodes[Wn]={...M.nodes[Wn],image:t},M.nodes[Ui]={...M.nodes[Ui],image:n},M.nodes[qn]={...M.nodes[qn],image:t},M.edges.push({source:{node_id:Ke,field:"image"},destination:{node_id:ye,field:"image"}},{source:{node_id:Ui,field:"image"},destination:{node_id:ye,field:"mask"}});return m!=="unmasked"&&(M.nodes[zt]={type:"create_denoise_mask",id:zt,is_intermediate:$,fp32:P},O?M.edges.push({source:{node_id:Ai,field:"image"},destination:{node_id:zt,field:"image"}}):M.nodes[zt]={...M.nodes[zt],image:t},m==="mask"&&(O?M.edges.push({source:{node_id:Mn,field:"image"},destination:{node_id:zt,field:"mask"}}):M.nodes[zt]={...M.nodes[zt],mask:n}),m==="edge"&&(M.nodes[mr]={type:"mask_edge",id:mr,is_intermediate:$,edge_blur:h,edge_size:h*2,low_threshold:100,high_threshold:200},O?M.edges.push({source:{node_id:Mn,field:"image"},destination:{node_id:mr,field:"image"}}):M.nodes[mr]={...M.nodes[mr],image:n},M.edges.push({source:{node_id:mr,field:"image"},destination:{node_id:zt,field:"mask"}})),M.edges.push({source:{node_id:zt,field:"denoise_mask"},destination:{node_id:pt,field:"denoise_mask"}})),(v||g)&&(Oa(e,M,E),E=qr),S&&(Tp(e,M,pt,E,t,n),(v||g)&&(E=Qa)),Ma(e,M,E),kp(e,M,ke,E),Aa(e,M,ke),Pa(e,M,ke),e.system.shouldUseNSFWChecker&&Ia(e,M,ye),e.system.shouldUseWatermarker&&Na(e,M,ye),Ra(e,M),M},aEe=(e,t,n)=>{const r=Ce("nodes"),{positivePrompt:i,negativePrompt:o,model:a,cfgScale:s,scheduler:l,steps:u,seed:c,vaePrecision:d,shouldUseCpuNoise:f,maskBlur:h,canvasCoherenceMode:p,canvasCoherenceSteps:m,canvasCoherenceStrength:_,infillTileSize:b,infillPatchmatchDownscaleSize:v,infillMethod:g,seamlessXAxis:y,seamlessYAxis:S}=e.generation,{sdxlImg2ImgDenoisingStrength:w,shouldUseSDXLRefiner:x,refinerStart:C}=e.sdxl;if(!a)throw r.error("No model found in state"),new Error("No model found in state");const{width:T,height:k}=e.canvas.boundingBoxDimensions,{scaledBoundingBoxDimensions:P,boundingBoxScaleMethod:$}=e.canvas,O=d==="fp32",E=!0,A=["auto","manual"].includes($);let D=Vi;const L=f,{joinedPositiveStylePrompt:M,joinedNegativeStylePrompt:R}=Zd(e),N={id:dc,nodes:{[Vi]:{type:"sdxl_model_loader",id:Vi,model:a},[Fe]:{type:"sdxl_compel_prompt",id:Fe,prompt:i,style:M},[We]:{type:"sdxl_compel_prompt",id:We,prompt:o,style:R},[bh]:{type:"tomask",id:bh,is_intermediate:E,image:t},[ki]:{type:"mask_combine",id:ki,is_intermediate:E,mask2:n},[Wn]:{type:"i2l",id:Wn,is_intermediate:E,fp32:O},[Le]:{type:"noise",id:Le,use_cpu:L,seed:c,is_intermediate:E},[qn]:{type:"create_denoise_mask",id:qn,is_intermediate:E,fp32:O},[ke]:{type:"denoise_latents",id:ke,is_intermediate:E,steps:u,cfg_scale:s,scheduler:l,denoising_start:x?Math.min(C,1-w):1-w,denoising_end:x?C:1},[Ut]:{type:"noise",id:Ut,use_cpu:L,seed:c+1,is_intermediate:E},[uc]:{type:"add",id:uc,b:1,is_intermediate:E},[pt]:{type:"denoise_latents",id:pt,is_intermediate:E,steps:m,cfg_scale:s,scheduler:l,denoising_start:1-_,denoising_end:1},[Ke]:{type:"l2i",id:Ke,is_intermediate:E,fp32:O},[ye]:{type:"color_correct",id:ye,is_intermediate:E}},edges:[{source:{node_id:Vi,field:"unet"},destination:{node_id:ke,field:"unet"}},{source:{node_id:Vi,field:"clip"},destination:{node_id:Fe,field:"clip"}},{source:{node_id:Vi,field:"clip2"},destination:{node_id:Fe,field:"clip2"}},{source:{node_id:Vi,field:"clip"},destination:{node_id:We,field:"clip"}},{source:{node_id:Vi,field:"clip2"},destination:{node_id:We,field:"clip2"}},{source:{node_id:Wt,field:"image"},destination:{node_id:Wn,field:"image"}},{source:{node_id:bh,field:"image"},destination:{node_id:ki,field:"mask1"}},{source:{node_id:Fe,field:"conditioning"},destination:{node_id:ke,field:"positive_conditioning"}},{source:{node_id:We,field:"conditioning"},destination:{node_id:ke,field:"negative_conditioning"}},{source:{node_id:Le,field:"noise"},destination:{node_id:ke,field:"noise"}},{source:{node_id:Wn,field:"latents"},destination:{node_id:ke,field:"latents"}},{source:{node_id:A?Mn:ki,field:"image"},destination:{node_id:qn,field:"mask"}},{source:{node_id:qn,field:"denoise_mask"},destination:{node_id:ke,field:"denoise_mask"}},{source:{node_id:D,field:"unet"},destination:{node_id:pt,field:"unet"}},{source:{node_id:Fe,field:"conditioning"},destination:{node_id:pt,field:"positive_conditioning"}},{source:{node_id:We,field:"conditioning"},destination:{node_id:pt,field:"negative_conditioning"}},{source:{node_id:Ut,field:"noise"},destination:{node_id:pt,field:"noise"}},{source:{node_id:ke,field:"latents"},destination:{node_id:pt,field:"latents"}},{source:{node_id:Wt,field:"image"},destination:{node_id:qn,field:"image"}},{source:{node_id:pt,field:"latents"},destination:{node_id:Ke,field:"latents"}}]};if(g==="patchmatch"&&(N.nodes[Wt]={type:"infill_patchmatch",id:Wt,is_intermediate:E,downscale:v}),g==="lama"&&(N.nodes[Wt]={type:"infill_lama",id:Wt,is_intermediate:E}),g==="cv2"&&(N.nodes[Wt]={type:"infill_cv2",id:Wt,is_intermediate:E}),g==="tile"&&(N.nodes[Wt]={type:"infill_tile",id:Wt,is_intermediate:E,tile_size:b}),A){const B=P.width,U=P.height;N.nodes[Ai]={type:"img_resize",id:Ai,is_intermediate:E,width:B,height:U,image:t},N.nodes[Mn]={type:"img_resize",id:Mn,is_intermediate:E,width:B,height:U},N.nodes[Hi]={type:"img_resize",id:Hi,is_intermediate:E,width:T,height:k},N.nodes[$u]={type:"img_resize",id:$u,is_intermediate:E,width:T,height:k},N.nodes[qi]={type:"img_resize",id:qi,is_intermediate:E,width:T,height:k},N.nodes[Le].width=B,N.nodes[Le].height=U,N.nodes[Ut].width=B,N.nodes[Ut].height=U,N.edges.push({source:{node_id:Ai,field:"image"},destination:{node_id:Wt,field:"image"}},{source:{node_id:ki,field:"image"},destination:{node_id:Mn,field:"image"}},{source:{node_id:Ke,field:"image"},destination:{node_id:Hi,field:"image"}},{source:{node_id:Mn,field:"image"},destination:{node_id:qi,field:"image"}},{source:{node_id:Wt,field:"image"},destination:{node_id:$u,field:"image"}},{source:{node_id:$u,field:"image"},destination:{node_id:ye,field:"reference"}},{source:{node_id:Hi,field:"image"},destination:{node_id:ye,field:"image"}},{source:{node_id:qi,field:"image"},destination:{node_id:ye,field:"mask"}})}else N.nodes[Wt]={...N.nodes[Wt],image:t},N.nodes[Le].width=T,N.nodes[Le].height=k,N.nodes[Ut].width=T,N.nodes[Ut].height=k,N.nodes[Wn]={...N.nodes[Wn],image:t},N.edges.push({source:{node_id:Wt,field:"image"},destination:{node_id:ye,field:"reference"}},{source:{node_id:Ke,field:"image"},destination:{node_id:ye,field:"image"}},{source:{node_id:ki,field:"image"},destination:{node_id:ye,field:"mask"}});return p!=="unmasked"&&(N.nodes[zt]={type:"create_denoise_mask",id:zt,is_intermediate:E,fp32:O},N.edges.push({source:{node_id:Wt,field:"image"},destination:{node_id:zt,field:"image"}}),p==="mask"&&(A?N.edges.push({source:{node_id:Mn,field:"image"},destination:{node_id:zt,field:"mask"}}):N.edges.push({source:{node_id:ki,field:"image"},destination:{node_id:zt,field:"mask"}})),p==="edge"&&(N.nodes[mr]={type:"mask_edge",id:mr,is_intermediate:E,edge_blur:h,edge_size:h*2,low_threshold:100,high_threshold:200},A?N.edges.push({source:{node_id:Mn,field:"image"},destination:{node_id:mr,field:"image"}}):N.edges.push({source:{node_id:ki,field:"image"},destination:{node_id:mr,field:"image"}}),N.edges.push({source:{node_id:mr,field:"image"},destination:{node_id:zt,field:"mask"}})),N.edges.push({source:{node_id:zt,field:"denoise_mask"},destination:{node_id:pt,field:"denoise_mask"}})),(y||S)&&(Oa(e,N,D),D=qr),x&&(Tp(e,N,pt,D,t),(y||S)&&(D=Qa)),Ma(e,N,D),kp(e,N,ke,D),Aa(e,N,ke),Pa(e,N,ke),e.system.shouldUseNSFWChecker&&Ia(e,N,ye),e.system.shouldUseWatermarker&&Na(e,N,ye),Ra(e,N),N},sEe=e=>{const t=Ce("nodes"),{positivePrompt:n,negativePrompt:r,model:i,cfgScale:o,scheduler:a,seed:s,steps:l,vaePrecision:u,shouldUseCpuNoise:c,seamlessXAxis:d,seamlessYAxis:f}=e.generation,{width:h,height:p}=e.canvas.boundingBoxDimensions,{scaledBoundingBoxDimensions:m,boundingBoxScaleMethod:_}=e.canvas,b=u==="fp32",v=!0,g=["auto","manual"].includes(_),{shouldUseSDXLRefiner:y,refinerStart:S}=e.sdxl;if(!i)throw t.error("No model found in state"),new Error("No model found in state");const w=c,x=i.model_type==="onnx";let C=x?Wx:Vi;const T=x?"onnx_model_loader":"sdxl_model_loader",k=x?{type:"t2l_onnx",id:ke,is_intermediate:v,cfg_scale:o,scheduler:a,steps:l}:{type:"denoise_latents",id:ke,is_intermediate:v,cfg_scale:o,scheduler:a,steps:l,denoising_start:0,denoising_end:y?S:1},{joinedPositiveStylePrompt:P,joinedNegativeStylePrompt:$}=Zd(e),O={id:Xx,nodes:{[C]:{type:T,id:C,is_intermediate:v,model:i},[Fe]:{type:x?"prompt_onnx":"sdxl_compel_prompt",id:Fe,is_intermediate:v,prompt:n,style:P},[We]:{type:x?"prompt_onnx":"sdxl_compel_prompt",id:We,is_intermediate:v,prompt:r,style:$},[Le]:{type:"noise",id:Le,is_intermediate:v,seed:s,width:g?m.width:h,height:g?m.height:p,use_cpu:w},[k.id]:k},edges:[{source:{node_id:C,field:"unet"},destination:{node_id:ke,field:"unet"}},{source:{node_id:C,field:"clip"},destination:{node_id:Fe,field:"clip"}},{source:{node_id:C,field:"clip2"},destination:{node_id:Fe,field:"clip2"}},{source:{node_id:C,field:"clip"},destination:{node_id:We,field:"clip"}},{source:{node_id:C,field:"clip2"},destination:{node_id:We,field:"clip2"}},{source:{node_id:Fe,field:"conditioning"},destination:{node_id:ke,field:"positive_conditioning"}},{source:{node_id:We,field:"conditioning"},destination:{node_id:ke,field:"negative_conditioning"}},{source:{node_id:Le,field:"noise"},destination:{node_id:ke,field:"noise"}}]};return g?(O.nodes[Ke]={id:Ke,type:x?"l2i_onnx":"l2i",is_intermediate:v,fp32:b},O.nodes[ye]={id:ye,type:"img_resize",is_intermediate:v,width:h,height:p},O.edges.push({source:{node_id:ke,field:"latents"},destination:{node_id:Ke,field:"latents"}},{source:{node_id:Ke,field:"image"},destination:{node_id:ye,field:"image"}})):(O.nodes[ye]={type:x?"l2i_onnx":"l2i",id:ye,is_intermediate:v,fp32:b},O.edges.push({source:{node_id:ke,field:"latents"},destination:{node_id:ye,field:"latents"}})),O.nodes[ht]={id:ht,type:"metadata_accumulator",generation_mode:"txt2img",cfg_scale:o,width:g?m.width:h,height:g?m.height:p,positive_prompt:n,negative_prompt:r,model:i,seed:s,steps:l,rand_device:w?"cpu":"cuda",scheduler:a,vae:void 0,controlnets:[],loras:[],ipAdapters:[]},O.edges.push({source:{node_id:ht,field:"metadata"},destination:{node_id:ye,field:"metadata"}}),(d||f)&&(Oa(e,O,C),C=qr),y&&(Tp(e,O,ke,C),(d||f)&&(C=Qa)),kp(e,O,ke,C),Ma(e,O,C),Aa(e,O,ke),Pa(e,O,ke),e.system.shouldUseNSFWChecker&&Ia(e,O,ye),e.system.shouldUseWatermarker&&Na(e,O,ye),Ra(e,O),O},lEe=e=>{const t=Ce("nodes"),{positivePrompt:n,negativePrompt:r,model:i,cfgScale:o,scheduler:a,seed:s,steps:l,vaePrecision:u,clipSkip:c,shouldUseCpuNoise:d,seamlessXAxis:f,seamlessYAxis:h}=e.generation,{width:p,height:m}=e.canvas.boundingBoxDimensions,{scaledBoundingBoxDimensions:_,boundingBoxScaleMethod:b}=e.canvas,v=u==="fp32",g=!0,y=["auto","manual"].includes(b);if(!i)throw t.error("No model found in state"),new Error("No model found in state");const S=d,w=i.model_type==="onnx";let x=w?Wx:Tc;const C=w?"onnx_model_loader":"main_model_loader",T=w?{type:"t2l_onnx",id:Oe,is_intermediate:g,cfg_scale:o,scheduler:a,steps:l}:{type:"denoise_latents",id:Oe,is_intermediate:g,cfg_scale:o,scheduler:a,steps:l,denoising_start:0,denoising_end:1},k={id:YG,nodes:{[x]:{type:C,id:x,is_intermediate:g,model:i},[Yt]:{type:"clip_skip",id:Yt,is_intermediate:g,skipped_layers:c},[Fe]:{type:w?"prompt_onnx":"compel",id:Fe,is_intermediate:g,prompt:n},[We]:{type:w?"prompt_onnx":"compel",id:We,is_intermediate:g,prompt:r},[Le]:{type:"noise",id:Le,is_intermediate:g,seed:s,width:y?_.width:p,height:y?_.height:m,use_cpu:S},[T.id]:T},edges:[{source:{node_id:x,field:"unet"},destination:{node_id:Oe,field:"unet"}},{source:{node_id:x,field:"clip"},destination:{node_id:Yt,field:"clip"}},{source:{node_id:Yt,field:"clip"},destination:{node_id:Fe,field:"clip"}},{source:{node_id:Yt,field:"clip"},destination:{node_id:We,field:"clip"}},{source:{node_id:Fe,field:"conditioning"},destination:{node_id:Oe,field:"positive_conditioning"}},{source:{node_id:We,field:"conditioning"},destination:{node_id:Oe,field:"negative_conditioning"}},{source:{node_id:Le,field:"noise"},destination:{node_id:Oe,field:"noise"}}]};return y?(k.nodes[Ke]={id:Ke,type:w?"l2i_onnx":"l2i",is_intermediate:g,fp32:v},k.nodes[ye]={id:ye,type:"img_resize",is_intermediate:g,width:p,height:m},k.edges.push({source:{node_id:Oe,field:"latents"},destination:{node_id:Ke,field:"latents"}},{source:{node_id:Ke,field:"image"},destination:{node_id:ye,field:"image"}})):(k.nodes[ye]={type:w?"l2i_onnx":"l2i",id:ye,is_intermediate:g,fp32:v},k.edges.push({source:{node_id:Oe,field:"latents"},destination:{node_id:ye,field:"latents"}})),k.nodes[ht]={id:ht,type:"metadata_accumulator",generation_mode:"txt2img",cfg_scale:o,width:y?_.width:p,height:y?_.height:m,positive_prompt:n,negative_prompt:r,model:i,seed:s,steps:l,rand_device:S?"cpu":"cuda",scheduler:a,vae:void 0,controlnets:[],loras:[],ipAdapters:[],clip_skip:c},k.edges.push({source:{node_id:ht,field:"metadata"},destination:{node_id:ye,field:"metadata"}}),(f||h)&&(Oa(e,k,x),x=qr),Ma(e,k,x),Ep(e,k,Oe,x),Aa(e,k,Oe),Pa(e,k,Oe),e.system.shouldUseNSFWChecker&&Ia(e,k,ye),e.system.shouldUseWatermarker&&Na(e,k,ye),Ra(e,k),k},uEe=(e,t,n,r)=>{let i;if(t==="txt2img")e.generation.model&&e.generation.model.base_model==="sdxl"?i=sEe(e):i=lEe(e);else if(t==="img2img"){if(!n)throw new Error("Missing canvas init image");e.generation.model&&e.generation.model.base_model==="sdxl"?i=iEe(e,n):i=tEe(e,n)}else if(t==="inpaint"){if(!n||!r)throw new Error("Missing canvas init and mask images");e.generation.model&&e.generation.model.base_model==="sdxl"?i=oEe(e,n,r):i=nEe(e,n,r)}else{if(!n)throw new Error("Missing canvas init image");e.generation.model&&e.generation.model.base_model==="sdxl"?i=aEe(e,n,r):i=rEe(e,n,r)}return i},r5=({count:e,start:t,min:n=Mae,max:r=Gg})=>{const i=t??uae(n,r),o=[];for(let a=i;a{const{iterations:r,model:i,shouldRandomizeSeed:o,seed:a}=e.generation,{shouldConcatSDXLStylePrompt:s,positiveStylePrompt:l}=e.sdxl,{prompts:u,seedBehaviour:c}=e.dynamicPrompts,d=[];if(u.length===1){Q8(t.nodes[ht],"seed");const h=r5({count:r,start:o?void 0:a}),p=[];t.nodes[Le]&&p.push({node_path:Le,field_name:"seed",items:h}),t.nodes[ht]&&p.push({node_path:ht,field_name:"seed",items:h}),t.nodes[Ut]&&p.push({node_path:Ut,field_name:"seed",items:h.map(m=>(m+1)%Gg)}),d.push(p)}else{const h=[],p=[];if(c==="PER_PROMPT"){const _=r5({count:u.length*r,start:o?void 0:a});t.nodes[Le]&&h.push({node_path:Le,field_name:"seed",items:_}),t.nodes[ht]&&h.push({node_path:ht,field_name:"seed",items:_}),t.nodes[Ut]&&h.push({node_path:Ut,field_name:"seed",items:_.map(b=>(b+1)%Gg)})}else{const _=r5({count:r,start:o?void 0:a});t.nodes[Le]&&p.push({node_path:Le,field_name:"seed",items:_}),t.nodes[ht]&&p.push({node_path:ht,field_name:"seed",items:_}),t.nodes[Ut]&&p.push({node_path:Ut,field_name:"seed",items:_.map(b=>(b+1)%Gg)}),d.push(p)}const m=c==="PER_PROMPT"?gae(r).flatMap(()=>u):u;if(t.nodes[Fe]&&h.push({node_path:Fe,field_name:"prompt",items:m}),t.nodes[ht]&&h.push({node_path:ht,field_name:"positive_prompt",items:m}),s&&(i==null?void 0:i.base_model)==="sdxl"){Q8(t.nodes[ht],"positive_style_prompt");const _=m.map(b=>[b,l].join(" "));t.nodes[Fe]&&h.push({node_path:Fe,field_name:"style",items:_}),t.nodes[ht]&&h.push({node_path:ht,field_name:"positive_style_prompt",items:_})}d.push(h)}return{prepend:n,batch:{graph:t,runs:1,data:d}}},cEe=()=>{Be({predicate:e=>MA.match(e)&&e.payload.tabName==="unifiedCanvas",effect:async(e,{getState:t,dispatch:n})=>{const r=Ce("queue"),{prepend:i}=e.payload,o=t(),{layerState:a,boundingBoxCoordinates:s,boundingBoxDimensions:l,isMaskEnabled:u,shouldPreserveMaskedArea:c}=o.canvas,d=await RA(a,s,l,u,c);if(!d){r.error("Unable to create canvas data");return}const{baseBlob:f,baseImageData:h,maskBlob:p,maskImageData:m}=d,_=Z3e(h,m);if(o.system.enableImageDebugging){const S=await NO(f),w=await NO(p);Q3e([{base64:w,caption:"mask b64"},{base64:S,caption:"image b64"}])}r.debug(`Generation mode: ${_}`);let b,v;["img2img","inpaint","outpaint"].includes(_)&&(b=await n(me.endpoints.uploadImage.initiate({file:new File([f],"canvasInitImage.png",{type:"image/png"}),image_category:"general",is_intermediate:!0})).unwrap()),["inpaint","outpaint"].includes(_)&&(v=await n(me.endpoints.uploadImage.initiate({file:new File([p],"canvasMaskImage.png",{type:"image/png"}),image_category:"mask",is_intermediate:!0})).unwrap());const g=uEe(o,_,b,v);r.debug({graph:Qt(g)},"Canvas graph built"),n(lG(g));const y=JG(o,g,i);try{const S=n(Qr.endpoints.enqueueBatch.initiate(y,{fixedCacheKey:"enqueueBatch"})),w=await S.unwrap();S.reset();const x=w.batch.batch_id;o.canvas.layerState.stagingArea.boundingBox||n(lle({boundingBox:{...o.canvas.boundingBoxCoordinates,...o.canvas.boundingBoxDimensions}})),n(ule(x))}catch{}}})},dEe=e=>{const t=Ce("nodes"),{positivePrompt:n,negativePrompt:r,model:i,cfgScale:o,scheduler:a,seed:s,steps:l,initialImage:u,img2imgStrength:c,shouldFitToWidthHeight:d,width:f,height:h,clipSkip:p,shouldUseCpuNoise:m,vaePrecision:_,seamlessXAxis:b,seamlessYAxis:v}=e.generation;if(!u)throw t.error("No initial image found in state"),new Error("No initial image found in state");if(!i)throw t.error("No model found in state"),new Error("No model found in state");const g=_==="fp32",y=!0;let S=Tc;const w=m,x={id:JE,nodes:{[S]:{type:"main_model_loader",id:S,model:i,is_intermediate:y},[Yt]:{type:"clip_skip",id:Yt,skipped_layers:p,is_intermediate:y},[Fe]:{type:"compel",id:Fe,prompt:n,is_intermediate:y},[We]:{type:"compel",id:We,prompt:r,is_intermediate:y},[Le]:{type:"noise",id:Le,use_cpu:w,seed:s,is_intermediate:y},[Ke]:{type:"l2i",id:Ke,fp32:g,is_intermediate:y},[Oe]:{type:"denoise_latents",id:Oe,cfg_scale:o,scheduler:a,steps:l,denoising_start:1-c,denoising_end:1,is_intermediate:y},[Hn]:{type:"i2l",id:Hn,fp32:g,is_intermediate:y}},edges:[{source:{node_id:S,field:"unet"},destination:{node_id:Oe,field:"unet"}},{source:{node_id:S,field:"clip"},destination:{node_id:Yt,field:"clip"}},{source:{node_id:Yt,field:"clip"},destination:{node_id:Fe,field:"clip"}},{source:{node_id:Yt,field:"clip"},destination:{node_id:We,field:"clip"}},{source:{node_id:Fe,field:"conditioning"},destination:{node_id:Oe,field:"positive_conditioning"}},{source:{node_id:We,field:"conditioning"},destination:{node_id:Oe,field:"negative_conditioning"}},{source:{node_id:Le,field:"noise"},destination:{node_id:Oe,field:"noise"}},{source:{node_id:Hn,field:"latents"},destination:{node_id:Oe,field:"latents"}},{source:{node_id:Oe,field:"latents"},destination:{node_id:Ke,field:"latents"}}]};if(d&&(u.width!==f||u.height!==h)){const C={id:Rs,type:"img_resize",image:{image_name:u.imageName},is_intermediate:!0,width:f,height:h};x.nodes[Rs]=C,x.edges.push({source:{node_id:Rs,field:"image"},destination:{node_id:Hn,field:"image"}}),x.edges.push({source:{node_id:Rs,field:"width"},destination:{node_id:Le,field:"width"}}),x.edges.push({source:{node_id:Rs,field:"height"},destination:{node_id:Le,field:"height"}})}else x.nodes[Hn].image={image_name:u.imageName},x.edges.push({source:{node_id:Hn,field:"width"},destination:{node_id:Le,field:"width"}}),x.edges.push({source:{node_id:Hn,field:"height"},destination:{node_id:Le,field:"height"}});return x.nodes[ht]={id:ht,type:"metadata_accumulator",generation_mode:"img2img",cfg_scale:o,height:h,width:f,positive_prompt:n,negative_prompt:r,model:i,seed:s,steps:l,rand_device:w?"cpu":"cuda",scheduler:a,vae:void 0,controlnets:[],loras:[],ipAdapters:[],clip_skip:p,strength:c,init_image:u.imageName},x.edges.push({source:{node_id:ht,field:"metadata"},destination:{node_id:Ke,field:"metadata"}}),(b||v)&&(Oa(e,x,S),S=qr),Ma(e,x,S),Ep(e,x,Oe,S),Aa(e,x,Oe),Pa(e,x,Oe),e.system.shouldUseNSFWChecker&&Ia(e,x),e.system.shouldUseWatermarker&&Na(e,x),Ra(e,x),x},fEe=e=>{const t=Ce("nodes"),{positivePrompt:n,negativePrompt:r,model:i,cfgScale:o,scheduler:a,seed:s,steps:l,initialImage:u,shouldFitToWidthHeight:c,width:d,height:f,shouldUseCpuNoise:h,vaePrecision:p,seamlessXAxis:m,seamlessYAxis:_}=e.generation,{positiveStylePrompt:b,negativeStylePrompt:v,shouldUseSDXLRefiner:g,refinerStart:y,sdxlImg2ImgDenoisingStrength:S}=e.sdxl;if(!u)throw t.error("No initial image found in state"),new Error("No initial image found in state");if(!i)throw t.error("No model found in state"),new Error("No model found in state");const w=p==="fp32",x=!0;let C=Vi;const T=h,{joinedPositiveStylePrompt:k,joinedNegativeStylePrompt:P}=Zd(e),$={id:z_,nodes:{[C]:{type:"sdxl_model_loader",id:C,model:i,is_intermediate:x},[Fe]:{type:"sdxl_compel_prompt",id:Fe,prompt:n,style:k,is_intermediate:x},[We]:{type:"sdxl_compel_prompt",id:We,prompt:r,style:P,is_intermediate:x},[Le]:{type:"noise",id:Le,use_cpu:T,seed:s,is_intermediate:x},[Ke]:{type:"l2i",id:Ke,fp32:w,is_intermediate:x},[ke]:{type:"denoise_latents",id:ke,cfg_scale:o,scheduler:a,steps:l,denoising_start:g?Math.min(y,1-S):1-S,denoising_end:g?y:1,is_intermediate:x},[Hn]:{type:"i2l",id:Hn,fp32:w,is_intermediate:x}},edges:[{source:{node_id:C,field:"unet"},destination:{node_id:ke,field:"unet"}},{source:{node_id:C,field:"clip"},destination:{node_id:Fe,field:"clip"}},{source:{node_id:C,field:"clip2"},destination:{node_id:Fe,field:"clip2"}},{source:{node_id:C,field:"clip"},destination:{node_id:We,field:"clip"}},{source:{node_id:C,field:"clip2"},destination:{node_id:We,field:"clip2"}},{source:{node_id:Fe,field:"conditioning"},destination:{node_id:ke,field:"positive_conditioning"}},{source:{node_id:We,field:"conditioning"},destination:{node_id:ke,field:"negative_conditioning"}},{source:{node_id:Le,field:"noise"},destination:{node_id:ke,field:"noise"}},{source:{node_id:Hn,field:"latents"},destination:{node_id:ke,field:"latents"}},{source:{node_id:ke,field:"latents"},destination:{node_id:Ke,field:"latents"}}]};if(c&&(u.width!==d||u.height!==f)){const O={id:Rs,type:"img_resize",image:{image_name:u.imageName},is_intermediate:!0,width:d,height:f};$.nodes[Rs]=O,$.edges.push({source:{node_id:Rs,field:"image"},destination:{node_id:Hn,field:"image"}}),$.edges.push({source:{node_id:Rs,field:"width"},destination:{node_id:Le,field:"width"}}),$.edges.push({source:{node_id:Rs,field:"height"},destination:{node_id:Le,field:"height"}})}else $.nodes[Hn].image={image_name:u.imageName},$.edges.push({source:{node_id:Hn,field:"width"},destination:{node_id:Le,field:"width"}}),$.edges.push({source:{node_id:Hn,field:"height"},destination:{node_id:Le,field:"height"}});return $.nodes[ht]={id:ht,type:"metadata_accumulator",generation_mode:"sdxl_img2img",cfg_scale:o,height:f,width:d,positive_prompt:n,negative_prompt:r,model:i,seed:s,steps:l,rand_device:T?"cpu":"cuda",scheduler:a,vae:void 0,controlnets:[],loras:[],ipAdapters:[],strength:S,init_image:u.imageName,positive_style_prompt:b,negative_style_prompt:v},$.edges.push({source:{node_id:ht,field:"metadata"},destination:{node_id:Ke,field:"metadata"}}),(m||_)&&(Oa(e,$,C),C=qr),g&&(Tp(e,$,ke),(m||_)&&(C=Qa)),Ma(e,$,C),kp(e,$,ke,C),Aa(e,$,ke),Pa(e,$,ke),e.system.shouldUseNSFWChecker&&Ia(e,$),e.system.shouldUseWatermarker&&Na(e,$),Ra(e,$),$},hEe=e=>{const t=Ce("nodes"),{positivePrompt:n,negativePrompt:r,model:i,cfgScale:o,scheduler:a,seed:s,steps:l,width:u,height:c,shouldUseCpuNoise:d,vaePrecision:f,seamlessXAxis:h,seamlessYAxis:p}=e.generation,{positiveStylePrompt:m,negativeStylePrompt:_,shouldUseSDXLRefiner:b,refinerStart:v}=e.sdxl,g=d;if(!i)throw t.error("No model found in state"),new Error("No model found in state");const y=f==="fp32",S=!0,{joinedPositiveStylePrompt:w,joinedNegativeStylePrompt:x}=Zd(e);let C=Vi;const T={id:OA,nodes:{[C]:{type:"sdxl_model_loader",id:C,model:i,is_intermediate:S},[Fe]:{type:"sdxl_compel_prompt",id:Fe,prompt:n,style:w,is_intermediate:S},[We]:{type:"sdxl_compel_prompt",id:We,prompt:r,style:x,is_intermediate:S},[Le]:{type:"noise",id:Le,seed:s,width:u,height:c,use_cpu:g,is_intermediate:S},[ke]:{type:"denoise_latents",id:ke,cfg_scale:o,scheduler:a,steps:l,denoising_start:0,denoising_end:b?v:1,is_intermediate:S},[Ke]:{type:"l2i",id:Ke,fp32:y,is_intermediate:S}},edges:[{source:{node_id:C,field:"unet"},destination:{node_id:ke,field:"unet"}},{source:{node_id:C,field:"clip"},destination:{node_id:Fe,field:"clip"}},{source:{node_id:C,field:"clip2"},destination:{node_id:Fe,field:"clip2"}},{source:{node_id:C,field:"clip"},destination:{node_id:We,field:"clip"}},{source:{node_id:C,field:"clip2"},destination:{node_id:We,field:"clip2"}},{source:{node_id:Fe,field:"conditioning"},destination:{node_id:ke,field:"positive_conditioning"}},{source:{node_id:We,field:"conditioning"},destination:{node_id:ke,field:"negative_conditioning"}},{source:{node_id:Le,field:"noise"},destination:{node_id:ke,field:"noise"}},{source:{node_id:ke,field:"latents"},destination:{node_id:Ke,field:"latents"}}]};return T.nodes[ht]={id:ht,type:"metadata_accumulator",generation_mode:"sdxl_txt2img",cfg_scale:o,height:c,width:u,positive_prompt:n,negative_prompt:r,model:i,seed:s,steps:l,rand_device:g?"cpu":"cuda",scheduler:a,vae:void 0,controlnets:[],loras:[],ipAdapters:[],positive_style_prompt:m,negative_style_prompt:_},T.edges.push({source:{node_id:ht,field:"metadata"},destination:{node_id:Ke,field:"metadata"}}),(h||p)&&(Oa(e,T,C),C=qr),b&&(Tp(e,T,ke),(h||p)&&(C=Qa)),Ma(e,T,C),kp(e,T,ke,C),Aa(e,T,ke),Pa(e,T,ke),e.system.shouldUseNSFWChecker&&Ia(e,T),e.system.shouldUseWatermarker&&Na(e,T),Ra(e,T),T},pEe=e=>{const t=Ce("nodes"),{positivePrompt:n,negativePrompt:r,model:i,cfgScale:o,scheduler:a,steps:s,width:l,height:u,clipSkip:c,shouldUseCpuNoise:d,vaePrecision:f,seamlessXAxis:h,seamlessYAxis:p,seed:m}=e.generation,_=d;if(!i)throw t.error("No model found in state"),new Error("No model found in state");const b=f==="fp32",v=!0,g=i.model_type==="onnx";let y=g?Wx:Tc;const S=g?"onnx_model_loader":"main_model_loader",w=g?{type:"t2l_onnx",id:Oe,is_intermediate:v,cfg_scale:o,scheduler:a,steps:s}:{type:"denoise_latents",id:Oe,is_intermediate:v,cfg_scale:o,scheduler:a,steps:s,denoising_start:0,denoising_end:1},x={id:XG,nodes:{[y]:{type:S,id:y,is_intermediate:v,model:i},[Yt]:{type:"clip_skip",id:Yt,skipped_layers:c,is_intermediate:v},[Fe]:{type:g?"prompt_onnx":"compel",id:Fe,prompt:n,is_intermediate:v},[We]:{type:g?"prompt_onnx":"compel",id:We,prompt:r,is_intermediate:v},[Le]:{type:"noise",id:Le,seed:m,width:l,height:u,use_cpu:_,is_intermediate:v},[w.id]:w,[Ke]:{type:g?"l2i_onnx":"l2i",id:Ke,fp32:b,is_intermediate:v}},edges:[{source:{node_id:y,field:"unet"},destination:{node_id:Oe,field:"unet"}},{source:{node_id:y,field:"clip"},destination:{node_id:Yt,field:"clip"}},{source:{node_id:Yt,field:"clip"},destination:{node_id:Fe,field:"clip"}},{source:{node_id:Yt,field:"clip"},destination:{node_id:We,field:"clip"}},{source:{node_id:Fe,field:"conditioning"},destination:{node_id:Oe,field:"positive_conditioning"}},{source:{node_id:We,field:"conditioning"},destination:{node_id:Oe,field:"negative_conditioning"}},{source:{node_id:Le,field:"noise"},destination:{node_id:Oe,field:"noise"}},{source:{node_id:Oe,field:"latents"},destination:{node_id:Ke,field:"latents"}}]};return x.nodes[ht]={id:ht,type:"metadata_accumulator",generation_mode:"txt2img",cfg_scale:o,height:u,width:l,positive_prompt:n,negative_prompt:r,model:i,seed:m,steps:s,rand_device:_?"cpu":"cuda",scheduler:a,vae:void 0,controlnets:[],loras:[],ipAdapters:[],clip_skip:c},x.edges.push({source:{node_id:ht,field:"metadata"},destination:{node_id:Ke,field:"metadata"}}),(h||p)&&(Oa(e,x,y),y=qr),Ma(e,x,y),Ep(e,x,Oe,y),Aa(e,x,Oe),Pa(e,x,Oe),e.system.shouldUseNSFWChecker&&Ia(e,x),e.system.shouldUseWatermarker&&Na(e,x),Ra(e,x),x},gEe=()=>{Be({predicate:e=>MA.match(e)&&(e.payload.tabName==="txt2img"||e.payload.tabName==="img2img"),effect:async(e,{getState:t,dispatch:n})=>{const r=t(),i=r.generation.model,{prepend:o}=e.payload;let a;i&&i.base_model==="sdxl"?e.payload.tabName==="txt2img"?a=hEe(r):a=fEe(r):e.payload.tabName==="txt2img"?a=pEe(r):a=dEe(r);const s=JG(r,a,o);n(Qr.endpoints.enqueueBatch.initiate(s,{fixedCacheKey:"enqueueBatch"})).reset()}})},mEe=/[$_\p{ID_Start}][$\u200c\u200d\p{ID_Continue}]*/u;function yEe(e){return e.length===1?e[0].toString():e.reduce((t,n)=>{if(typeof n=="number")return t+"["+n.toString()+"]";if(n.includes('"'))return t+'["'+vEe(n)+'"]';if(!mEe.test(n))return t+'["'+n+'"]';const r=t.length===0?"":".";return t+r+n},"")}function vEe(e){return e.replace(/"/g,'\\"')}function bEe(e){return e.length!==0}const _Ee=99,eH="; ",tH=", or ",$A="Validation error",nH=": ";class rH extends Error{constructor(n,r=[]){super(n);_w(this,"details");_w(this,"name");this.details=r,this.name="ZodValidationError"}toString(){return this.message}}function DA(e,t,n){if(e.code==="invalid_union")return e.unionErrors.reduce((r,i)=>{const o=i.issues.map(a=>DA(a,t,n)).join(t);return r.includes(o)||r.push(o),r},[]).join(n);if(bEe(e.path)){if(e.path.length===1){const r=e.path[0];if(typeof r=="number")return`${e.message} at index ${r}`}return`${e.message} at "${yEe(e.path)}"`}return e.message}function iH(e,t,n){return t!==null?e.length>0?[t,e].join(n):t:e.length>0?e:$A}function XWe(e,t={}){const{issueSeparator:n=eH,unionSeparator:r=tH,prefixSeparator:i=nH,prefix:o=$A}=t,a=DA(e,n,r),s=iH(a,o,i);return new rH(s,[e])}function $O(e,t={}){const{maxIssuesInMessage:n=_Ee,issueSeparator:r=eH,unionSeparator:i=tH,prefixSeparator:o=nH,prefix:a=$A}=t,s=e.errors.slice(0,n).map(u=>DA(u,r,i)).join(r),l=iH(s,a,o);return new rH(l,e.errors)}const SEe=e=>{const{workflow:t,nodes:n,edges:r}=e,i={...t,nodes:[],edges:[]};return n.filter(o=>["invocation","notes"].includes(o.type??"__UNKNOWN_NODE_TYPE__")).forEach(o=>{const a=jB.safeParse(o);if(!a.success){const{message:s}=$O(a.error,{prefix:be.t("nodes.unableToParseNode")});Ce("nodes").warn({node:Qt(o)},s);return}i.nodes.push(a.data)}),r.forEach(o=>{const a=UB.safeParse(o);if(!a.success){const{message:s}=$O(a.error,{prefix:be.t("nodes.unableToParseEdge")});Ce("nodes").warn({edge:Qt(o)},s);return}i.edges.push(a.data)}),i},xEe=e=>{if(e.type==="ColorField"&&e.value){const t=wn(e.value),{r:n,g:r,b:i,a:o}=e.value,a=Math.max(0,Math.min(o*255,255));return Object.assign(t,{r:n,g:r,b:i,a}),t}return e.value},wEe=e=>{const{nodes:t,edges:n}=e,r=t.filter(jr),i=JSON.stringify(SEe(e)),o=r.reduce((u,c)=>{const{id:d,data:f}=c,{type:h,inputs:p,isIntermediate:m,embedWorkflow:_}=f,b=Z3(p,(g,y,S)=>{const w=xEe(y);return g[S]=w,g},{});b.use_cache=c.data.useCache;const v={type:h,id:d,...b,is_intermediate:m};return _&&Object.assign(v,{workflow:i}),Object.assign(u,{[d]:v}),u},{}),s=n.filter(u=>u.type!=="collapsed").reduce((u,c)=>{const{source:d,target:f,sourceHandle:h,targetHandle:p}=c;return u.push({source:{node_id:d,field:h},destination:{node_id:f,field:p}}),u},[]);return s.forEach(u=>{const c=o[u.destination.node_id],d=u.destination.field;o[u.destination.node_id]=qS(c,d)}),{id:MV(),nodes:o,edges:s}},CEe=()=>{Be({predicate:e=>MA.match(e)&&e.payload.tabName==="nodes",effect:async(e,{getState:t,dispatch:n})=>{const r=t(),o={batch:{graph:wEe(r.nodes),runs:r.generation.iterations},prepend:e.payload.prepend};n(Qr.endpoints.enqueueBatch.initiate(o,{fixedCacheKey:"enqueueBatch"})).reset()}})},EEe=()=>{Be({matcher:me.endpoints.addImageToBoard.matchFulfilled,effect:e=>{const t=Ce("images"),{board_id:n,imageDTO:r}=e.meta.arg.originalArgs;t.debug({board_id:n,imageDTO:r},"Image added to board")}})},kEe=()=>{Be({matcher:me.endpoints.addImageToBoard.matchRejected,effect:e=>{const t=Ce("images"),{board_id:n,imageDTO:r}=e.meta.arg.originalArgs;t.debug({board_id:n,imageDTO:r},"Problem adding image to board")}})},LA=Ne("deleteImageModal/imageDeletionConfirmed"),YWe=Ii(e=>e,e=>e.gallery.selection[e.gallery.selection.length-1],Z2),oH=Ii([e=>e],e=>{const{selectedBoardId:t,galleryView:n}=e.gallery;return{board_id:t,categories:n==="images"?ii:Mu,offset:0,limit:mle,is_intermediate:!1}},Z2),TEe=()=>{Be({actionCreator:LA,effect:async(e,{dispatch:t,getState:n,condition:r})=>{var f;const{imageDTOs:i,imagesUsage:o}=e.payload;if(i.length!==1||o.length!==1)return;const a=i[0],s=o[0];if(!a||!s)return;t(WT(!1));const l=n(),u=(f=l.gallery.selection[l.gallery.selection.length-1])==null?void 0:f.image_name;if(a&&(a==null?void 0:a.image_name)===u){const{image_name:h}=a,p=oH(l),{data:m}=me.endpoints.listImages.select(p)(l),_=m?Vn.getSelectors().selectAll(m):[],b=_.findIndex(S=>S.image_name===h),v=_.filter(S=>S.image_name!==h),g=Ru(b,0,v.length-1),y=v[g];t(Us(y||null))}s.isCanvasImage&&t(gT()),i.forEach(h=>{var p;((p=n().generation.initialImage)==null?void 0:p.imageName)===h.image_name&&t(pT()),Ca(n().controlNet.controlNets,m=>{(m.controlImage===h.image_name||m.processedControlImage===h.image_name)&&(t(Sc({controlNetId:m.controlNetId,controlImage:null})),t(qT({controlNetId:m.controlNetId,processedControlImage:null})))}),n().controlNet.ipAdapterInfo.adapterImage===h.image_name&&t(V2(null)),n().nodes.nodes.forEach(m=>{jr(m)&&Ca(m.data.inputs,_=>{var b;_.type==="ImageField"&&((b=_.value)==null?void 0:b.image_name)===h.image_name&&t(X2({nodeId:m.data.id,fieldName:_.name,value:void 0}))})})});const{requestId:c}=t(me.endpoints.deleteImage.initiate(a));await r(h=>me.endpoints.deleteImage.matchFulfilled(h)&&h.meta.requestId===c,3e4)&&t(ls.util.invalidateTags([{type:"Board",id:a.board_id}]))}})},AEe=()=>{Be({actionCreator:LA,effect:async(e,{dispatch:t,getState:n})=>{const{imageDTOs:r,imagesUsage:i}=e.payload;if(!(r.length<=1||i.length<=1))try{await t(me.endpoints.deleteImages.initiate({imageDTOs:r})).unwrap();const o=n(),a=oH(o),{data:s}=me.endpoints.listImages.select(a)(o),l=s?Vn.getSelectors().selectAll(s)[0]:void 0;t(Us(l||null)),t(WT(!1)),i.some(u=>u.isCanvasImage)&&t(gT()),r.forEach(u=>{var c;((c=n().generation.initialImage)==null?void 0:c.imageName)===u.image_name&&t(pT()),Ca(n().controlNet.controlNets,d=>{(d.controlImage===u.image_name||d.processedControlImage===u.image_name)&&(t(Sc({controlNetId:d.controlNetId,controlImage:null})),t(qT({controlNetId:d.controlNetId,processedControlImage:null})))}),n().controlNet.ipAdapterInfo.adapterImage===u.image_name&&t(V2(null)),n().nodes.nodes.forEach(d=>{jr(d)&&Ca(d.data.inputs,f=>{var h;f.type==="ImageField"&&((h=f.value)==null?void 0:h.image_name)===u.image_name&&t(X2({nodeId:d.data.id,fieldName:f.name,value:void 0}))})})})}catch{}}})},PEe=()=>{Be({matcher:me.endpoints.deleteImage.matchPending,effect:()=>{}})},IEe=()=>{Be({matcher:me.endpoints.deleteImage.matchFulfilled,effect:e=>{Ce("images").debug({imageDTO:e.meta.arg.originalArgs},"Image deleted")}})},REe=()=>{Be({matcher:me.endpoints.deleteImage.matchRejected,effect:e=>{Ce("images").debug({imageDTO:e.meta.arg.originalArgs},"Unable to delete image")}})},aH=Ne("dnd/dndDropped"),OEe=()=>{Be({actionCreator:aH,effect:async(e,{dispatch:t})=>{const n=Ce("dnd"),{activeData:r,overData:i}=e.payload;if(r.payloadType==="IMAGE_DTO"?n.debug({activeData:r,overData:i},"Image dropped"):r.payloadType==="IMAGE_DTOS"?n.debug({activeData:r,overData:i},`Images (${r.payload.imageDTOs.length}) dropped`):r.payloadType==="NODE_FIELD"?n.debug({activeData:Qt(r),overData:Qt(i)},"Node field dropped"):n.debug({activeData:r,overData:i},"Unknown payload dropped"),i.actionType==="ADD_FIELD_TO_LINEAR"&&r.payloadType==="NODE_FIELD"){const{nodeId:o,field:a}=r.payload;t(JSe({nodeId:o,fieldName:a.name}))}if(i.actionType==="SET_CURRENT_IMAGE"&&r.payloadType==="IMAGE_DTO"&&r.payload.imageDTO){t(Us(r.payload.imageDTO));return}if(i.actionType==="SET_INITIAL_IMAGE"&&r.payloadType==="IMAGE_DTO"&&r.payload.imageDTO){t(XS(r.payload.imageDTO));return}if(i.actionType==="SET_CONTROLNET_IMAGE"&&r.payloadType==="IMAGE_DTO"&&r.payload.imageDTO){const{controlNetId:o}=i.context;t(Sc({controlImage:r.payload.imageDTO.image_name,controlNetId:o})),t(rU({controlNetId:o,isEnabled:!0}));return}if(i.actionType==="SET_IP_ADAPTER_IMAGE"&&r.payloadType==="IMAGE_DTO"&&r.payload.imageDTO){t(V2(r.payload.imageDTO.image_name)),t(iU(!0));return}if(i.actionType==="SET_CANVAS_INITIAL_IMAGE"&&r.payloadType==="IMAGE_DTO"&&r.payload.imageDTO){t(EB(r.payload.imageDTO));return}if(i.actionType==="SET_NODES_IMAGE"&&r.payloadType==="IMAGE_DTO"&&r.payload.imageDTO){const{fieldName:o,nodeId:a}=i.context;t(X2({nodeId:a,fieldName:o,value:r.payload.imageDTO}));return}if(i.actionType==="ADD_TO_BOARD"&&r.payloadType==="IMAGE_DTO"&&r.payload.imageDTO){const{imageDTO:o}=r.payload,{boardId:a}=i.context;t(me.endpoints.addImageToBoard.initiate({imageDTO:o,board_id:a}));return}if(i.actionType==="REMOVE_FROM_BOARD"&&r.payloadType==="IMAGE_DTO"&&r.payload.imageDTO){const{imageDTO:o}=r.payload;t(me.endpoints.removeImageFromBoard.initiate({imageDTO:o}));return}if(i.actionType==="ADD_TO_BOARD"&&r.payloadType==="IMAGE_DTOS"&&r.payload.imageDTOs){const{imageDTOs:o}=r.payload,{boardId:a}=i.context;t(me.endpoints.addImagesToBoard.initiate({imageDTOs:o,board_id:a}));return}if(i.actionType==="REMOVE_FROM_BOARD"&&r.payloadType==="IMAGE_DTOS"&&r.payload.imageDTOs){const{imageDTOs:o}=r.payload;t(me.endpoints.removeImagesFromBoard.initiate({imageDTOs:o}));return}}})},MEe=()=>{Be({matcher:me.endpoints.removeImageFromBoard.matchFulfilled,effect:e=>{const t=Ce("images"),n=e.meta.arg.originalArgs;t.debug({imageDTO:n},"Image removed from board")}})},NEe=()=>{Be({matcher:me.endpoints.removeImageFromBoard.matchRejected,effect:e=>{const t=Ce("images"),n=e.meta.arg.originalArgs;t.debug({imageDTO:n},"Problem removing image from board")}})},$Ee=()=>{Be({actionCreator:d0e,effect:async(e,{dispatch:t,getState:n})=>{const r=e.payload,i=n(),{shouldConfirmOnDelete:o}=i.system,a=xxe(n()),s=a.some(l=>l.isCanvasImage)||a.some(l=>l.isInitialImage)||a.some(l=>l.isControlNetImage)||a.some(l=>l.isIPAdapterImage)||a.some(l=>l.isNodesImage);if(o||s){t(WT(!0));return}t(LA({imageDTOs:r,imagesUsage:a}))}})},DEe=()=>{Be({matcher:me.endpoints.uploadImage.matchFulfilled,effect:(e,{dispatch:t,getState:n})=>{const r=Ce("images"),i=e.payload,o=n(),{autoAddBoardId:a}=o.gallery;r.debug({imageDTO:i},"Image uploaded");const{postUploadAction:s}=e.meta.arg.originalArgs;if(e.payload.is_intermediate&&!s)return;const l={title:Z("toast.imageUploaded"),status:"success"};if((s==null?void 0:s.type)==="TOAST"){const{toastOptions:u}=s;if(!a||a==="none")t(Gt({...l,...u}));else{t(me.endpoints.addImageToBoard.initiate({board_id:a,imageDTO:i}));const{data:c}=xi.endpoints.listAllBoards.select()(o),d=c==null?void 0:c.find(h=>h.board_id===a),f=d?`${Z("toast.addedToBoard")} ${d.board_name}`:`${Z("toast.addedToBoard")} ${a}`;t(Gt({...l,description:f}))}return}if((s==null?void 0:s.type)==="SET_CANVAS_INITIAL_IMAGE"){t(EB(i)),t(Gt({...l,description:Z("toast.setCanvasInitialImage")}));return}if((s==null?void 0:s.type)==="SET_CONTROLNET_IMAGE"){const{controlNetId:u}=s;t(rU({controlNetId:u,isEnabled:!0})),t(Sc({controlNetId:u,controlImage:i.image_name})),t(Gt({...l,description:Z("toast.setControlImage")}));return}if((s==null?void 0:s.type)==="SET_IP_ADAPTER_IMAGE"){t(V2(i.image_name)),t(iU(!0)),t(Gt({...l,description:Z("toast.setIPAdapterImage")}));return}if((s==null?void 0:s.type)==="SET_INITIAL_IMAGE"){t(XS(i)),t(Gt({...l,description:Z("toast.setInitialImage")}));return}if((s==null?void 0:s.type)==="SET_NODES_IMAGE"){const{nodeId:u,fieldName:c}=s;t(X2({nodeId:u,fieldName:c,value:i})),t(Gt({...l,description:`${Z("toast.setNodeField")} ${c}`}));return}}})},LEe=()=>{Be({matcher:me.endpoints.uploadImage.matchRejected,effect:(e,{dispatch:t})=>{const n=Ce("images"),r={arg:{...qS(e.meta.arg.originalArgs,["file","postUploadAction"]),file:""}};n.error({...r},"Image upload failed"),t(Gt({title:Z("toast.imageUploadFailed"),description:e.error.message,status:"error"}))}})},FEe=()=>{Be({matcher:me.endpoints.starImages.matchFulfilled,effect:async(e,{dispatch:t,getState:n})=>{const{updated_image_names:r}=e.payload,i=n(),{selection:o}=i.gallery,a=[];o.forEach(s=>{r.includes(s.image_name)?a.push({...s,starred:!0}):a.push(s)}),t(cU(a))}})},BEe=()=>{Be({matcher:me.endpoints.unstarImages.matchFulfilled,effect:async(e,{dispatch:t,getState:n})=>{const{updated_image_names:r}=e.payload,i=n(),{selection:o}=i.gallery,a=[];o.forEach(s=>{r.includes(s.image_name)?a.push({...s,starred:!1}):a.push(s)}),t(cU(a))}})},zEe=Ne("generation/initialImageSelected"),jEe=Ne("generation/modelSelected"),UEe=()=>{Be({actionCreator:zEe,effect:(e,{dispatch:t})=>{if(!e.payload){t(Gt($d({title:Z("toast.imageNotLoadedDesc"),status:"error"})));return}t(XS(e.payload)),t(Gt($d(Z("toast.sentToImageToImage"))))}})},VEe=()=>{Be({actionCreator:jEe,effect:(e,{getState:t,dispatch:n})=>{var l,u;const r=Ce("models"),i=t(),o=ly.safeParse(e.payload);if(!o.success){r.error({error:o.error.format()},"Failed to parse main model");return}const a=o.data,{base_model:s}=a;if(((l=i.generation.model)==null?void 0:l.base_model)!==s){let c=0;Ca(i.lora.loras,(p,m)=>{p.base_model!==s&&(n(fU(m)),c+=1)});const{vae:d}=i.generation;d&&d.base_model!==s&&(n(SB(null)),c+=1);const{controlNets:f}=i.controlNet;Ca(f,(p,m)=>{var _;((_=p.model)==null?void 0:_.base_model)!==s&&(n(nU({controlNetId:m})),c+=1)});const{ipAdapterInfo:h}=i.controlNet;h.model&&h.model.base_model!==s&&(n(oU()),c+=1),c>0&&n(Gt($d({title:`${Z("toast.baseModelChangedCleared")} ${c} ${Z("toast.incompatibleSubmodel")}${c===1?"":"s"}`,status:"warning"})))}((u=i.generation.model)==null?void 0:u.base_model)!==a.base_model&&i.ui.shouldAutoChangeDimensions&&(["sdxl","sdxl-refiner"].includes(a.base_model)?(n(Z8(1024)),n(J8(1024)),n(eI({width:1024,height:1024}))):(n(Z8(512)),n(J8(512)),n(eI({width:512,height:512})))),n(Ou(a))}})},_0=Js({sortComparer:(e,t)=>e.model_name.localeCompare(t.model_name)}),DO=Js({sortComparer:(e,t)=>e.model_name.localeCompare(t.model_name)}),LO=Js({sortComparer:(e,t)=>e.model_name.localeCompare(t.model_name)}),FO=Js({sortComparer:(e,t)=>e.model_name.localeCompare(t.model_name)}),BO=Js({sortComparer:(e,t)=>e.model_name.localeCompare(t.model_name)}),zO=Js({sortComparer:(e,t)=>e.model_name.localeCompare(t.model_name)}),t4=Js({sortComparer:(e,t)=>e.model_name.localeCompare(t.model_name)}),GEe=({base_model:e,model_type:t,model_name:n})=>`${e}/${t}/${n}`,Dc=e=>{const t=[];return e.forEach(n=>{const r={...wn(n),id:GEe(n)};t.push(r)}),t},vu=ls.injectEndpoints({endpoints:e=>({getOnnxModels:e.query({query:t=>{const n={model_type:"onnx",base_models:t};return`models/?${Kg.stringify(n,{arrayFormat:"none"})}`},providesTags:t=>{const n=[{type:"OnnxModel",id:Dt}];return t&&n.push(...t.ids.map(r=>({type:"OnnxModel",id:r}))),n},transformResponse:t=>{const n=Dc(t.models);return DO.setAll(DO.getInitialState(),n)}}),getMainModels:e.query({query:t=>{const n={model_type:"main",base_models:t};return`models/?${Kg.stringify(n,{arrayFormat:"none"})}`},providesTags:t=>{const n=[{type:"MainModel",id:Dt}];return t&&n.push(...t.ids.map(r=>({type:"MainModel",id:r}))),n},transformResponse:t=>{const n=Dc(t.models);return _0.setAll(_0.getInitialState(),n)}}),updateMainModels:e.mutation({query:({base_model:t,model_name:n,body:r})=>({url:`models/${t}/main/${n}`,method:"PATCH",body:r}),invalidatesTags:[{type:"MainModel",id:Dt},{type:"SDXLRefinerModel",id:Dt},{type:"OnnxModel",id:Dt}]}),importMainModels:e.mutation({query:({body:t})=>({url:"models/import",method:"POST",body:t}),invalidatesTags:[{type:"MainModel",id:Dt},{type:"SDXLRefinerModel",id:Dt},{type:"OnnxModel",id:Dt}]}),addMainModels:e.mutation({query:({body:t})=>({url:"models/add",method:"POST",body:t}),invalidatesTags:[{type:"MainModel",id:Dt},{type:"SDXLRefinerModel",id:Dt},{type:"OnnxModel",id:Dt}]}),deleteMainModels:e.mutation({query:({base_model:t,model_name:n,model_type:r})=>({url:`models/${t}/${r}/${n}`,method:"DELETE"}),invalidatesTags:[{type:"MainModel",id:Dt},{type:"SDXLRefinerModel",id:Dt},{type:"OnnxModel",id:Dt}]}),convertMainModels:e.mutation({query:({base_model:t,model_name:n,convert_dest_directory:r})=>({url:`models/convert/${t}/main/${n}`,method:"PUT",params:{convert_dest_directory:r}}),invalidatesTags:[{type:"MainModel",id:Dt},{type:"SDXLRefinerModel",id:Dt},{type:"OnnxModel",id:Dt}]}),mergeMainModels:e.mutation({query:({base_model:t,body:n})=>({url:`models/merge/${t}`,method:"PUT",body:n}),invalidatesTags:[{type:"MainModel",id:Dt},{type:"SDXLRefinerModel",id:Dt},{type:"OnnxModel",id:Dt}]}),syncModels:e.mutation({query:()=>({url:"models/sync",method:"POST"}),invalidatesTags:[{type:"MainModel",id:Dt},{type:"SDXLRefinerModel",id:Dt},{type:"OnnxModel",id:Dt}]}),getLoRAModels:e.query({query:()=>({url:"models/",params:{model_type:"lora"}}),providesTags:t=>{const n=[{type:"LoRAModel",id:Dt}];return t&&n.push(...t.ids.map(r=>({type:"LoRAModel",id:r}))),n},transformResponse:t=>{const n=Dc(t.models);return LO.setAll(LO.getInitialState(),n)}}),updateLoRAModels:e.mutation({query:({base_model:t,model_name:n,body:r})=>({url:`models/${t}/lora/${n}`,method:"PATCH",body:r}),invalidatesTags:[{type:"LoRAModel",id:Dt}]}),deleteLoRAModels:e.mutation({query:({base_model:t,model_name:n})=>({url:`models/${t}/lora/${n}`,method:"DELETE"}),invalidatesTags:[{type:"LoRAModel",id:Dt}]}),getControlNetModels:e.query({query:()=>({url:"models/",params:{model_type:"controlnet"}}),providesTags:t=>{const n=[{type:"ControlNetModel",id:Dt}];return t&&n.push(...t.ids.map(r=>({type:"ControlNetModel",id:r}))),n},transformResponse:t=>{const n=Dc(t.models);return FO.setAll(FO.getInitialState(),n)}}),getIPAdapterModels:e.query({query:()=>({url:"models/",params:{model_type:"ip_adapter"}}),providesTags:t=>{const n=[{type:"IPAdapterModel",id:Dt}];return t&&n.push(...t.ids.map(r=>({type:"IPAdapterModel",id:r}))),n},transformResponse:t=>{const n=Dc(t.models);return BO.setAll(BO.getInitialState(),n)}}),getVaeModels:e.query({query:()=>({url:"models/",params:{model_type:"vae"}}),providesTags:t=>{const n=[{type:"VaeModel",id:Dt}];return t&&n.push(...t.ids.map(r=>({type:"VaeModel",id:r}))),n},transformResponse:t=>{const n=Dc(t.models);return t4.setAll(t4.getInitialState(),n)}}),getTextualInversionModels:e.query({query:()=>({url:"models/",params:{model_type:"embedding"}}),providesTags:t=>{const n=[{type:"TextualInversionModel",id:Dt}];return t&&n.push(...t.ids.map(r=>({type:"TextualInversionModel",id:r}))),n},transformResponse:t=>{const n=Dc(t.models);return zO.setAll(zO.getInitialState(),n)}}),getModelsInFolder:e.query({query:t=>({url:`/models/search?${Kg.stringify(t,{})}`}),providesTags:t=>{const n=[{type:"ScannedModels",id:Dt}];return t&&n.push(...t.map(r=>({type:"ScannedModels",id:r}))),n}}),getCheckpointConfigs:e.query({query:()=>({url:"/models/ckpt_confs"})})})}),{useGetMainModelsQuery:ZWe,useGetOnnxModelsQuery:JWe,useGetControlNetModelsQuery:eKe,useGetIPAdapterModelsQuery:tKe,useGetLoRAModelsQuery:nKe,useGetTextualInversionModelsQuery:rKe,useGetVaeModelsQuery:iKe,useUpdateMainModelsMutation:oKe,useDeleteMainModelsMutation:aKe,useImportMainModelsMutation:sKe,useAddMainModelsMutation:lKe,useConvertMainModelsMutation:uKe,useMergeMainModelsMutation:cKe,useDeleteLoRAModelsMutation:dKe,useUpdateLoRAModelsMutation:fKe,useSyncModelsMutation:hKe,useGetModelsInFolderQuery:pKe,useGetCheckpointConfigsQuery:gKe}=vu,HEe=()=>{Be({predicate:e=>vu.endpoints.getMainModels.matchFulfilled(e)&&!e.meta.arg.originalArgs.includes("sdxl-refiner"),effect:async(e,{getState:t,dispatch:n})=>{const r=Ce("models");r.info({models:e.payload.entities},`Main models loaded (${e.payload.ids.length})`);const i=t().generation.model,o=_0.getSelectors().selectAll(e.payload);if(o.length===0){n(Ou(null));return}if(i?o.some(l=>l.model_name===i.model_name&&l.base_model===i.base_model&&l.model_type===i.model_type):!1)return;const s=ly.safeParse(o[0]);if(!s.success){r.error({error:s.error.format()},"Failed to parse main model");return}n(Ou(s.data))}}),Be({predicate:e=>vu.endpoints.getMainModels.matchFulfilled(e)&&e.meta.arg.originalArgs.includes("sdxl-refiner"),effect:async(e,{getState:t,dispatch:n})=>{const r=Ce("models");r.info({models:e.payload.entities},`SDXL Refiner models loaded (${e.payload.ids.length})`);const i=t().sdxl.refinerModel,o=_0.getSelectors().selectAll(e.payload);if(o.length===0){n(G9(null)),n(r2e(!1));return}if(i?o.some(l=>l.model_name===i.model_name&&l.base_model===i.base_model&&l.model_type===i.model_type):!1)return;const s=fT.safeParse(o[0]);if(!s.success){r.error({error:s.error.format()},"Failed to parse SDXL Refiner Model");return}n(G9(s.data))}}),Be({matcher:vu.endpoints.getVaeModels.matchFulfilled,effect:async(e,{getState:t,dispatch:n})=>{const r=Ce("models");r.info({models:e.payload.entities},`VAEs loaded (${e.payload.ids.length})`);const i=t().generation.vae;if(i===null||Vg(e.payload.entities,l=>(l==null?void 0:l.model_name)===(i==null?void 0:i.model_name)&&(l==null?void 0:l.base_model)===(i==null?void 0:i.base_model)))return;const a=t4.getSelectors().selectAll(e.payload)[0];if(!a){n(Ou(null));return}const s=jse.safeParse(a);if(!s.success){r.error({error:s.error.format()},"Failed to parse VAE model");return}n(SB(s.data))}}),Be({matcher:vu.endpoints.getLoRAModels.matchFulfilled,effect:async(e,{getState:t,dispatch:n})=>{Ce("models").info({models:e.payload.entities},`LoRAs loaded (${e.payload.ids.length})`);const i=t().lora.loras;Ca(i,(o,a)=>{Vg(e.payload.entities,l=>(l==null?void 0:l.model_name)===(o==null?void 0:o.model_name)&&(l==null?void 0:l.base_model)===(o==null?void 0:o.base_model))||n(fU(a))})}}),Be({matcher:vu.endpoints.getControlNetModels.matchFulfilled,effect:async(e,{getState:t,dispatch:n})=>{Ce("models").info({models:e.payload.entities},`ControlNet models loaded (${e.payload.ids.length})`);const i=t().controlNet.controlNets;Ca(i,(o,a)=>{Vg(e.payload.entities,l=>{var u,c;return(l==null?void 0:l.model_name)===((u=o==null?void 0:o.model)==null?void 0:u.model_name)&&(l==null?void 0:l.base_model)===((c=o==null?void 0:o.model)==null?void 0:c.base_model)})||n(nU({controlNetId:a}))})}}),Be({matcher:vu.endpoints.getTextualInversionModels.matchFulfilled,effect:async e=>{Ce("models").info({models:e.payload.entities},`Embeddings loaded (${e.payload.ids.length})`)}})},qEe=ls.injectEndpoints({endpoints:e=>({dynamicPrompts:e.query({query:t=>({url:"utilities/dynamicprompts",body:t,method:"POST"}),keepUnusedDataFor:86400})})}),WEe=No(Yse,m0e,p0e,g0e,BT),KEe=()=>{Be({matcher:WEe,effect:async(e,{dispatch:t,getState:n,cancelActiveListeners:r,delay:i})=>{r(),await i(1e3);const o=n();if(o.config.disabledFeatures.includes("dynamicPrompting"))return;const{positivePrompt:a}=o.generation,{maxPrompts:s}=o.dynamicPrompts;t(RC(!0));try{const l=t(qEe.endpoints.dynamicPrompts.initiate({prompt:a,max_prompts:s})),u=await l.unwrap();l.unsubscribe(),t(y0e(u.prompts)),t(v0e(u.error)),t(UR(!1)),t(RC(!1))}catch{t(UR(!0)),t(RC(!1))}}})},bf=e=>e.$ref.split("/").slice(-1)[0],QEe=({schemaObject:e,baseField:t})=>{const n={...t,type:"integer",default:e.default??0};return e.multipleOf!==void 0&&(n.multipleOf=e.multipleOf),e.maximum!==void 0&&(n.maximum=e.maximum),e.exclusiveMaximum!==void 0&&(n.exclusiveMaximum=e.exclusiveMaximum),e.minimum!==void 0&&(n.minimum=e.minimum),e.exclusiveMinimum!==void 0&&(n.exclusiveMinimum=e.exclusiveMinimum),n},XEe=({schemaObject:e,baseField:t})=>{const n={...t,type:"IntegerPolymorphic",default:e.default??0};return e.multipleOf!==void 0&&(n.multipleOf=e.multipleOf),e.maximum!==void 0&&(n.maximum=e.maximum),e.exclusiveMaximum!==void 0&&(n.exclusiveMaximum=e.exclusiveMaximum),e.minimum!==void 0&&(n.minimum=e.minimum),e.exclusiveMinimum!==void 0&&(n.exclusiveMinimum=e.exclusiveMinimum),n},YEe=({schemaObject:e,baseField:t})=>{const n=JF(e.item_default)&&Poe(e.item_default)?e.item_default:0;return{...t,type:"IntegerCollection",default:e.default??[],item_default:n}},ZEe=({schemaObject:e,baseField:t})=>{const n={...t,type:"float",default:e.default??0};return e.multipleOf!==void 0&&(n.multipleOf=e.multipleOf),e.maximum!==void 0&&(n.maximum=e.maximum),e.exclusiveMaximum!==void 0&&(n.exclusiveMaximum=e.exclusiveMaximum),e.minimum!==void 0&&(n.minimum=e.minimum),e.exclusiveMinimum!==void 0&&(n.exclusiveMinimum=e.exclusiveMinimum),n},JEe=({schemaObject:e,baseField:t})=>{const n={...t,type:"FloatPolymorphic",default:e.default??0};return e.multipleOf!==void 0&&(n.multipleOf=e.multipleOf),e.maximum!==void 0&&(n.maximum=e.maximum),e.exclusiveMaximum!==void 0&&(n.exclusiveMaximum=e.exclusiveMaximum),e.minimum!==void 0&&(n.minimum=e.minimum),e.exclusiveMinimum!==void 0&&(n.exclusiveMinimum=e.exclusiveMinimum),n},e4e=({schemaObject:e,baseField:t})=>{const n=JF(e.item_default)?e.item_default:0;return{...t,type:"FloatCollection",default:e.default??[],item_default:n}},t4e=({schemaObject:e,baseField:t})=>{const n={...t,type:"string",default:e.default??""};return e.minLength!==void 0&&(n.minLength=e.minLength),e.maxLength!==void 0&&(n.maxLength=e.maxLength),e.pattern!==void 0&&(n.pattern=e.pattern),n},n4e=({schemaObject:e,baseField:t})=>{const n={...t,type:"StringPolymorphic",default:e.default??""};return e.minLength!==void 0&&(n.minLength=e.minLength),e.maxLength!==void 0&&(n.maxLength=e.maxLength),e.pattern!==void 0&&(n.pattern=e.pattern),n},r4e=({schemaObject:e,baseField:t})=>{const n=uT(e.item_default)?e.item_default:"";return{...t,type:"StringCollection",default:e.default??[],item_default:n}},i4e=({schemaObject:e,baseField:t})=>({...t,type:"boolean",default:e.default??!1}),o4e=({schemaObject:e,baseField:t})=>({...t,type:"BooleanPolymorphic",default:e.default??!1}),a4e=({schemaObject:e,baseField:t})=>{const n=e.item_default&&Aoe(e.item_default)?e.item_default:!1;return{...t,type:"BooleanCollection",default:e.default??[],item_default:n}},s4e=({schemaObject:e,baseField:t})=>({...t,type:"MainModelField",default:e.default??void 0}),l4e=({schemaObject:e,baseField:t})=>({...t,type:"SDXLMainModelField",default:e.default??void 0}),u4e=({schemaObject:e,baseField:t})=>({...t,type:"SDXLRefinerModelField",default:e.default??void 0}),c4e=({schemaObject:e,baseField:t})=>({...t,type:"VaeModelField",default:e.default??void 0}),d4e=({schemaObject:e,baseField:t})=>({...t,type:"LoRAModelField",default:e.default??void 0}),f4e=({schemaObject:e,baseField:t})=>({...t,type:"ControlNetModelField",default:e.default??void 0}),h4e=({schemaObject:e,baseField:t})=>({...t,type:"IPAdapterModelField",default:e.default??void 0}),p4e=({schemaObject:e,baseField:t})=>({...t,type:"BoardField",default:e.default??void 0}),g4e=({schemaObject:e,baseField:t})=>({...t,type:"ImageField",default:e.default??void 0}),m4e=({schemaObject:e,baseField:t})=>({...t,type:"ImagePolymorphic",default:e.default??void 0}),y4e=({schemaObject:e,baseField:t})=>({...t,type:"ImageCollection",default:e.default??[],item_default:e.item_default??void 0}),v4e=({schemaObject:e,baseField:t})=>({...t,type:"DenoiseMaskField",default:e.default??void 0}),b4e=({schemaObject:e,baseField:t})=>({...t,type:"LatentsField",default:e.default??void 0}),_4e=({schemaObject:e,baseField:t})=>({...t,type:"LatentsPolymorphic",default:e.default??void 0}),S4e=({schemaObject:e,baseField:t})=>({...t,type:"LatentsCollection",default:e.default??[],item_default:e.item_default??void 0}),x4e=({schemaObject:e,baseField:t})=>({...t,type:"ConditioningField",default:e.default??void 0}),w4e=({schemaObject:e,baseField:t})=>({...t,type:"ConditioningPolymorphic",default:e.default??void 0}),C4e=({schemaObject:e,baseField:t})=>({...t,type:"ConditioningCollection",default:e.default??[],item_default:e.item_default??void 0}),E4e=({schemaObject:e,baseField:t})=>({...t,type:"UNetField",default:e.default??void 0}),k4e=({schemaObject:e,baseField:t})=>({...t,type:"ClipField",default:e.default??void 0}),T4e=({schemaObject:e,baseField:t})=>({...t,type:"VaeField",default:e.default??void 0}),A4e=({schemaObject:e,baseField:t})=>({...t,type:"ControlField",default:e.default??void 0}),P4e=({schemaObject:e,baseField:t})=>({...t,type:"ControlPolymorphic",default:e.default??void 0}),I4e=({schemaObject:e,baseField:t})=>({...t,type:"ControlCollection",default:e.default??[],item_default:e.item_default??void 0}),R4e=({schemaObject:e,baseField:t})=>({...t,type:"IPAdapterField",default:e.default??void 0}),O4e=({schemaObject:e,baseField:t})=>{const n=e.enum??[];return{...t,type:"enum",options:n,ui_choice_labels:e.ui_choice_labels,default:e.default??n[0]}},M4e=({baseField:e})=>({...e,type:"Collection",default:[]}),N4e=({baseField:e})=>({...e,type:"CollectionItem",default:void 0}),$4e=({schemaObject:e,baseField:t})=>({...t,type:"ColorField",default:e.default??{r:127,g:127,b:127,a:255}}),D4e=({schemaObject:e,baseField:t})=>({...t,type:"ColorPolymorphic",default:e.default??{r:127,g:127,b:127,a:255}}),L4e=({schemaObject:e,baseField:t})=>({...t,type:"ColorCollection",default:e.default??[]}),F4e=({schemaObject:e,baseField:t})=>({...t,type:"Scheduler",default:e.default??"euler"}),jO=e=>{if(e!=null&&e.ui_type)return e.ui_type;if(e.type){if(e.enum)return"enum";if(e.type){if(e.type==="number")return"float";if(e.type==="array"){const t=que(e.items)?e.items.type:bf(e.items);return tSe(t)?fA[t]:void 0}else return e.type}}else if(e.allOf){const t=e.allOf;if(t&&t[0]&&Gp(t[0]))return bf(t[0])}else if(e.anyOf){const t=e.anyOf;let n,r;if(dI(t[0])){const i=t[0].items,o=t[1];Gp(i)&&Gp(o)?(n=bf(i),r=bf(o)):mv(i)&&mv(o)&&(n=i.type,r=o.type)}else if(dI(t[1])){const i=t[0],o=t[1].items;Gp(i)&&Gp(o)?(n=bf(i),r=bf(o)):mv(i)&&mv(o)&&(n=i.type,r=o.type)}if(n===r&&rSe(n))return NV[n]}},sH={BoardField:p4e,boolean:i4e,BooleanCollection:a4e,BooleanPolymorphic:o4e,ClipField:k4e,Collection:M4e,CollectionItem:N4e,ColorCollection:L4e,ColorField:$4e,ColorPolymorphic:D4e,ConditioningCollection:C4e,ConditioningField:x4e,ConditioningPolymorphic:w4e,ControlCollection:I4e,ControlField:A4e,ControlNetModelField:f4e,ControlPolymorphic:P4e,DenoiseMaskField:v4e,enum:O4e,float:ZEe,FloatCollection:e4e,FloatPolymorphic:JEe,ImageCollection:y4e,ImageField:g4e,ImagePolymorphic:m4e,integer:QEe,IntegerCollection:YEe,IntegerPolymorphic:XEe,IPAdapterField:R4e,IPAdapterModelField:h4e,LatentsCollection:S4e,LatentsField:b4e,LatentsPolymorphic:_4e,LoRAModelField:d4e,MainModelField:s4e,Scheduler:F4e,SDXLMainModelField:l4e,SDXLRefinerModelField:u4e,string:t4e,StringCollection:r4e,StringPolymorphic:n4e,UNetField:E4e,VaeField:T4e,VaeModelField:c4e},B4e=e=>!!(e&&e in sH),z4e=(e,t,n,r)=>{var f;const{input:i,ui_hidden:o,ui_component:a,ui_type:s,ui_order:l}=t,u={input:xg.includes(r)?"connection":i,ui_hidden:o,ui_component:a,ui_type:s,required:((f=e.required)==null?void 0:f.includes(n))??!1,ui_order:l},c={name:n,title:t.title??"",description:t.description??"",fieldKind:"input",...u};if(!B4e(r))return;const d=sH[r];if(d)return d({schemaObject:t,baseField:c})},j4e=["id","type","metadata","use_cache"],U4e=["type"],V4e=["WorkflowField","MetadataField","IsIntermediate"],G4e=["graph","metadata_accumulator"],H4e=(e,t)=>!!(j4e.includes(t)||e==="collect"&&t==="collection"||e==="iterate"&&t==="index"),q4e=e=>!!V4e.includes(e),W4e=(e,t)=>!U4e.includes(t),K4e=e=>!G4e.includes(e.properties.type.default),Q4e=(e,t=void 0,n=void 0)=>{var o;return Object.values(((o=e.components)==null?void 0:o.schemas)??{}).filter(Wue).filter(K4e).filter(a=>t?t.includes(a.properties.type.default):!0).filter(a=>n?!n.includes(a.properties.type.default):!0).reduce((a,s)=>{var y,S;const l=s.properties.type.default,u=s.title.replace("Invocation",""),c=s.tags??[],d=s.description??"",f=s.version,h=Z3(s.properties,(w,x,C)=>{if(H4e(l,C))return Ce("nodes").trace({node:l,fieldName:C,field:Qt(x)},"Skipped reserved input field"),w;if(!fI(x))return Ce("nodes").warn({node:l,propertyName:C,property:Qt(x)},"Unhandled input property"),w;const T=jO(x);if(!cI(T))return Ce("nodes").warn({node:l,fieldName:C,fieldType:T,field:Qt(x)},"Skipping unknown input field type"),w;if(q4e(T))return Ce("nodes").trace({node:l,fieldName:C,fieldType:T,field:Qt(x)},"Skipping reserved field type"),w;const k=z4e(s,x,C,T);return k?(w[C]=k,w):(Ce("nodes").debug({node:l,fieldName:C,fieldType:T,field:Qt(x)},"Skipping input field with no template"),w)},{}),p=s.output.$ref.split("/").pop();if(!p)return Ce("nodes").warn({outputRefObject:Qt(s.output)},"No output schema name found in ref object"),a;const m=(S=(y=e.components)==null?void 0:y.schemas)==null?void 0:S[p];if(!m)return Ce("nodes").warn({outputSchemaName:p},"Output schema not found"),a;if(!Kue(m))return Ce("nodes").error({outputSchema:Qt(m)},"Invalid output schema"),a;const _=m.properties.type.default,b=Z3(m.properties,(w,x,C)=>{if(!W4e(l,C))return Ce("nodes").trace({type:l,propertyName:C,property:Qt(x)},"Skipped reserved output field"),w;if(!fI(x))return Ce("nodes").warn({type:l,propertyName:C,property:Qt(x)},"Unhandled output property"),w;const T=jO(x);return cI(T)?(w[C]={fieldKind:"output",name:C,title:x.title??"",description:x.description??"",type:T,ui_hidden:x.ui_hidden??!1,ui_type:x.ui_type,ui_order:x.ui_order},w):(Ce("nodes").warn({fieldName:C,fieldType:T,field:Qt(x)},"Skipping unknown output field type"),w)},{}),v=s.properties.use_cache.default,g={title:u,type:l,version:f,tags:c,description:d,outputType:_,inputs:h,outputs:b,useCache:v};return Object.assign(a,{[l]:g}),a},{})},X4e=()=>{Be({actionCreator:g0.fulfilled,effect:(e,{dispatch:t,getState:n})=>{const r=Ce("system"),i=e.payload;r.debug({schemaJSON:i},"Received OpenAPI schema");const{nodesAllowlist:o,nodesDenylist:a}=n().config,s=Q4e(i,o,a);r.debug({nodeTemplates:Qt(s)},`Built ${WS(s)} node templates`),t(GV(s))}}),Be({actionCreator:g0.rejected,effect:e=>{Ce("system").error({error:Qt(e.error)},"Problem retrieving OpenAPI Schema")}})},Y4e=()=>{Be({actionCreator:Lj,effect:(e,{dispatch:t,getState:n})=>{Ce("socketio").debug("Connected");const{nodes:i,config:o,system:a}=n(),{disabledTabs:s}=o;!WS(i.nodeTemplates)&&!s.includes("nodes")&&t(g0()),a.isInitialized?t(ls.util.resetApiState()):t(l2e(!0)),t(BT(e.payload))}})},Z4e=()=>{Be({actionCreator:Fj,effect:(e,{dispatch:t})=>{Ce("socketio").debug("Disconnected"),t(Bj(e.payload))}})},J4e=()=>{Be({actionCreator:Gj,effect:(e,{dispatch:t})=>{Ce("socketio").trace(e.payload,"Generator progress"),t(VT(e.payload))}})},eke=()=>{Be({actionCreator:Uj,effect:(e,{dispatch:t})=>{Ce("socketio").debug(e.payload,"Session complete"),t(Vj(e.payload))}})},tke=["load_image","image"],nke=()=>{Be({actionCreator:jT,effect:async(e,{dispatch:t,getState:n})=>{const r=Ce("socketio"),{data:i}=e.payload;r.debug({data:Qt(i)},`Invocation complete (${e.payload.data.node.type})`);const{result:o,node:a,queue_batch_id:s}=i;if(ZG(o)&&!tke.includes(a.type)){const{image_name:l}=o.image,{canvas:u,gallery:c}=n(),d=await t(me.endpoints.getImageDTO.initiate(l)).unwrap();if(u.batchIds.includes(s)&&[ye].includes(i.source_node_id)&&t(ile(d)),!d.is_intermediate){t(me.util.updateQueryData("listImages",{board_id:d.board_id??"none",categories:ii},h=>{Vn.addOne(h,d)})),t(me.util.invalidateTags([{type:"BoardImagesTotal",id:d.board_id},{type:"BoardAssetsTotal",id:d.board_id},{type:"Board",id:d.board_id}]));const{shouldAutoSwitch:f}=c;f&&(c.galleryView!=="images"&&t(SE("images")),d.board_id&&d.board_id!==c.selectedBoardId&&t(w_({boardId:d.board_id,selectedImageName:d.image_name})),!d.board_id&&c.selectedBoardId!=="none"&&t(w_({boardId:"none",selectedImageName:d.image_name})),t(Us(d)))}}t(UT(e.payload))}})},rke=()=>{Be({actionCreator:jj,effect:(e,{dispatch:t})=>{Ce("socketio").error(e.payload,`Invocation error (${e.payload.data.node.type})`),t(U2(e.payload))}})},ike=()=>{Be({actionCreator:Yj,effect:(e,{dispatch:t})=>{Ce("socketio").error(e.payload,`Invocation retrieval error (${e.payload.data.graph_execution_state_id})`),t(Zj(e.payload))}})},oke=()=>{Be({actionCreator:zj,effect:(e,{dispatch:t})=>{Ce("socketio").debug(e.payload,`Invocation started (${e.payload.data.node.type})`),t(zT(e.payload))}})},ake=()=>{Be({actionCreator:Hj,effect:(e,{dispatch:t})=>{const n=Ce("socketio"),{base_model:r,model_name:i,model_type:o,submodel:a}=e.payload.data;let s=`Model load started: ${r}/${o}/${i}`;a&&(s=s.concat(`/${a}`)),n.debug(e.payload,s),t(qj(e.payload))}}),Be({actionCreator:Wj,effect:(e,{dispatch:t})=>{const n=Ce("socketio"),{base_model:r,model_name:i,model_type:o,submodel:a}=e.payload.data;let s=`Model load complete: ${r}/${o}/${i}`;a&&(s=s.concat(`/${a}`)),n.debug(e.payload,s),t(Kj(e.payload))}})},ske=()=>{Be({actionCreator:Jj,effect:async(e,{dispatch:t})=>{const n=Ce("socketio"),{queue_item_id:r,queue_batch_id:i,status:o}=e.payload.data;n.debug(e.payload,`Queue item ${r} status updated: ${o}`),t(GT(e.payload)),t(Qr.util.updateQueryData("listQueueItems",void 0,s=>{qc.updateOne(s,{id:r,changes:e.payload.data})})),t(Qr.util.invalidateTags(["CurrentSessionQueueItem","NextSessionQueueItem","InvocationCacheStatus",{type:"SessionQueueItem",id:r},{type:"SessionQueueItemDTO",id:r},{type:"BatchStatus",id:i}]));const a=t(Qr.endpoints.getQueueStatus.initiate(void 0,{forceRefetch:!0}));await a.unwrap(),a.unsubscribe()}})},lke=()=>{Be({actionCreator:Qj,effect:(e,{dispatch:t})=>{Ce("socketio").error(e.payload,`Session retrieval error (${e.payload.data.graph_execution_state_id})`),t(Xj(e.payload))}})},uke=()=>{Be({actionCreator:t0e,effect:(e,{dispatch:t})=>{Ce("socketio").debug(e.payload,"Subscribed"),t(n0e(e.payload))}})},cke=()=>{Be({actionCreator:r0e,effect:(e,{dispatch:t})=>{Ce("socketio").debug(e.payload,"Unsubscribed"),t(i0e(e.payload))}})},dke=()=>{Be({actionCreator:Ixe,effect:async(e,{dispatch:t,getState:n})=>{const{imageDTO:r}=e.payload;try{const i=await t(me.endpoints.changeImageIsIntermediate.initiate({imageDTO:r,is_intermediate:!1})).unwrap(),{autoAddBoardId:o}=n().gallery;o&&o!=="none"&&await t(me.endpoints.addImageToBoard.initiate({imageDTO:i,board_id:o})),t(Gt({title:Z("toast.imageSaved"),status:"success"}))}catch(i){t(Gt({title:Z("toast.imageSavingFailed"),description:i==null?void 0:i.message,status:"error"}))}}})},mKe=["sd-1","sd-2","sdxl","sdxl-refiner"],fke=["sd-1","sd-2","sdxl"],yKe=["sdxl"],vKe=["sd-1","sd-2"],bKe=["sdxl-refiner"],hke=()=>{Be({actionCreator:rG,effect:async(e,{getState:t,dispatch:n})=>{var i;if(e.payload==="unifiedCanvas"){const o=(i=t().generation.model)==null?void 0:i.base_model;if(o&&["sd-1","sd-2","sdxl"].includes(o))return;try{const a=n(vu.endpoints.getMainModels.initiate(fke)),s=await a.unwrap();if(a.unsubscribe(),!s.ids.length){n(Ou(null));return}const u=_0.getSelectors().selectAll(s).filter(h=>["sd-1","sd-2","sxdl"].includes(h.base_model))[0];if(!u){n(Ou(null));return}const{base_model:c,model_name:d,model_type:f}=u;n(Ou({base_model:c,model_name:d,model_type:f}))}catch{n(Ou(null))}}}})},pke=({image_name:e,esrganModelName:t,autoAddBoardId:n})=>{const r={id:n5,type:"esrgan",image:{image_name:e},model_name:t,is_intermediate:!0},i={id:Za,type:"save_image",use_cache:!1,is_intermediate:!1,board:n==="none"?void 0:{board_id:n}};return{id:"adhoc-esrgan-graph",nodes:{[n5]:r,[Za]:i},edges:[{source:{node_id:n5,field:"image"},destination:{node_id:Za,field:"image"}}]}},gke=()=>Tj(),lH=bj;function mke(){if(console&&console.warn){for(var e=arguments.length,t=new Array(e),n=0;n()=>{if(e.isInitialized)t();else{const n=()=>{setTimeout(()=>{e.off("initialized",n)},0),t()};e.on("initialized",n)}};function VO(e,t,n){e.loadNamespaces(t,uH(e,n))}function GO(e,t,n,r){typeof n=="string"&&(n=[n]),n.forEach(i=>{e.options.ns.indexOf(i)<0&&e.options.ns.push(i)}),e.loadLanguages(t,uH(e,r))}function yke(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const r=t.languages[0],i=t.options?t.options.fallbackLng:!1,o=t.languages[t.languages.length-1];if(r.toLowerCase()==="cimode")return!0;const a=(s,l)=>{const u=t.services.backendConnector.state[`${s}|${l}`];return u===-1||u===2};return n.bindI18n&&n.bindI18n.indexOf("languageChanging")>-1&&t.services.backendConnector.backend&&t.isLanguageChangingTo&&!a(t.isLanguageChangingTo,e)?!1:!!(t.hasResourceBundle(r,e)||!t.services.backendConnector.backend||t.options.resources&&!t.options.partialBundledLanguages||a(r,e)&&(!i||a(o,e)))}function vke(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return!t.languages||!t.languages.length?(n4("i18n.languages were undefined or empty",t.languages),!0):t.options.ignoreJSONStructure!==void 0?t.hasLoadedNamespace(e,{lng:n.lng,precheck:(i,o)=>{if(n.bindI18n&&n.bindI18n.indexOf("languageChanging")>-1&&i.services.backendConnector.backend&&i.isLanguageChangingTo&&!o(i.isLanguageChangingTo,e))return!1}}):yke(e,t,n)}const bke=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,_ke={"&":"&","&":"&","<":"<","<":"<",">":">",">":">","'":"'","'":"'",""":'"',""":'"'," ":" "," ":" ","©":"©","©":"©","®":"®","®":"®","…":"…","…":"…","/":"/","/":"/"},Ske=e=>_ke[e],xke=e=>e.replace(bke,Ske);let r4={bindI18n:"languageChanged",bindI18nStore:"",transEmptyNodeValue:"",transSupportBasicHtmlNodes:!0,transWrapTextNodes:"",transKeepBasicHtmlNodesFor:["br","strong","i","p"],useSuspense:!0,unescape:xke};function wke(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};r4={...r4,...e}}function Cke(){return r4}let cH;function Eke(e){cH=e}function kke(){return cH}const Tke={type:"3rdParty",init(e){wke(e.options.react),Eke(e)}},Ake=I.createContext();class Pke{constructor(){this.usedNamespaces={}}addUsedNamespaces(t){t.forEach(n=>{this.usedNamespaces[n]||(this.usedNamespaces[n]=!0)})}getUsedNamespaces(){return Object.keys(this.usedNamespaces)}}const Ike=(e,t)=>{const n=I.useRef();return I.useEffect(()=>{n.current=t?n.current:e},[e,t]),n.current};function Rke(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const{i18n:n}=t,{i18n:r,defaultNS:i}=I.useContext(Ake)||{},o=n||r||kke();if(o&&!o.reportNamespaces&&(o.reportNamespaces=new Pke),!o){n4("You will need to pass in an i18next instance by using initReactI18next");const g=(S,w)=>typeof w=="string"?w:w&&typeof w=="object"&&typeof w.defaultValue=="string"?w.defaultValue:Array.isArray(S)?S[S.length-1]:S,y=[g,{},!1];return y.t=g,y.i18n={},y.ready=!1,y}o.options.react&&o.options.react.wait!==void 0&&n4("It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");const a={...Cke(),...o.options.react,...t},{useSuspense:s,keyPrefix:l}=a;let u=e||i||o.options&&o.options.defaultNS;u=typeof u=="string"?[u]:u||["translation"],o.reportNamespaces.addUsedNamespaces&&o.reportNamespaces.addUsedNamespaces(u);const c=(o.isInitialized||o.initializedStoreOnce)&&u.every(g=>vke(g,o,a));function d(){return o.getFixedT(t.lng||null,a.nsMode==="fallback"?u:u[0],l)}const[f,h]=I.useState(d);let p=u.join();t.lng&&(p=`${t.lng}${p}`);const m=Ike(p),_=I.useRef(!0);I.useEffect(()=>{const{bindI18n:g,bindI18nStore:y}=a;_.current=!0,!c&&!s&&(t.lng?GO(o,t.lng,u,()=>{_.current&&h(d)}):VO(o,u,()=>{_.current&&h(d)})),c&&m&&m!==p&&_.current&&h(d);function S(){_.current&&h(d)}return g&&o&&o.on(g,S),y&&o&&o.store.on(y,S),()=>{_.current=!1,g&&o&&g.split(" ").forEach(w=>o.off(w,S)),y&&o&&y.split(" ").forEach(w=>o.store.off(w,S))}},[o,p]);const b=I.useRef(!0);I.useEffect(()=>{_.current&&!b.current&&h(d),b.current=!1},[o,l]);const v=[f,o,c];if(v.t=f,v.i18n=o,v.ready=c,c||!c&&!s)return v;throw new Promise(g=>{t.lng?GO(o,t.lng,u,()=>g()):VO(o,u,()=>g())})}const Oke=(e,t)=>{if(!e||!t)return;const{width:n,height:r}=e,i=r*4*n*4,o=r*2*n*2;return{x4:i,x2:o}},Mke=(e,t)=>{if(!e||!t)return{x4:!0,x2:!0};const n={x4:!1,x2:!1};return e.x4<=t&&(n.x4=!0),e.x2<=t&&(n.x2=!0),n},Nke=(e,t)=>{if(!(!e||!t)&&!(e.x4&&e.x2)){if(!e.x2&&!e.x4)return"parameters.isAllowedToUpscale.tooLarge";if(!e.x4&&e.x2&&t===4)return"parameters.isAllowedToUpscale.useX2Model"}},dH=e=>Ii(eK,({postprocessing:t,config:n})=>{const{esrganModelName:r}=t,{maxUpscalePixels:i}=n,o=Oke(e,i),a=Mke(o,i),s=r.includes("x2")?2:4,l=Nke(a,s);return{isAllowedToUpscale:s===2?a.x2:a.x4,detailTKey:l}},Z2),_Ke=e=>{const{t}=Rke(),n=I.useMemo(()=>dH(e),[e]),{isAllowedToUpscale:r,detailTKey:i}=lH(n);return{isAllowedToUpscale:r,detail:i?t(i):void 0}},$ke=Ne("upscale/upscaleRequested"),Dke=()=>{Be({actionCreator:$ke,effect:async(e,{dispatch:t,getState:n})=>{var f;const r=Ce("session"),{imageDTO:i}=e.payload,{image_name:o}=i,a=n(),{isAllowedToUpscale:s,detailTKey:l}=dH(i)(a);if(!s){r.error({imageDTO:i},Z(l??"parameters.isAllowedToUpscale.tooLarge")),t(Gt({title:Z(l??"parameters.isAllowedToUpscale.tooLarge"),status:"error"}));return}const{esrganModelName:u}=a.postprocessing,{autoAddBoardId:c}=a.gallery,d=pke({image_name:o,esrganModelName:u,autoAddBoardId:c});try{const h=t(Qr.endpoints.enqueueGraph.initiate({graph:d,prepend:!0},{fixedCacheKey:"enqueueGraph"})),p=await h.unwrap();h.reset(),r.debug({enqueueResult:Qt(p)},Z("queue.graphQueued"))}catch(h){if(r.error({graph:Qt(d)},Z("queue.graphFailedToQueue")),h instanceof Object&&"data"in h&&"status"in h&&h.status===403){const p=((f=h.data)==null?void 0:f.detail)||"Unknown Error";t(Gt({title:Z("queue.graphFailedToQueue"),status:"error",description:p,duration:15e3}));return}t(Gt({title:Z("queue.graphFailedToQueue"),status:"error"}))}}})},Lke=tl(null),Fke=/^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z\-]+(?:\.[\da-z\-]+)*))?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?)?)?$/i,HO=e=>{if(typeof e!="string")throw new TypeError("Invalid argument expected string");const t=e.match(Fke);if(!t)throw new Error(`Invalid argument not valid semver ('${e}' received)`);return t.shift(),t},qO=e=>e==="*"||e==="x"||e==="X",WO=e=>{const t=parseInt(e,10);return isNaN(t)?e:t},Bke=(e,t)=>typeof e!=typeof t?[String(e),String(t)]:[e,t],zke=(e,t)=>{if(qO(e)||qO(t))return 0;const[n,r]=Bke(WO(e),WO(t));return n>r?1:n{for(let n=0;n{const n=HO(e),r=HO(t),i=n.pop(),o=r.pop(),a=KO(n,r);return a!==0?a:i&&o?KO(i.split("."),o.split(".")):i||o?i?-1:1:0},Uke=(e,t)=>{const n=wn(e),{nodes:r,edges:i}=n,o=[],a=r.filter(rE),s=dT(a,"id");return r.forEach(l=>{if(!rE(l))return;const u=t[l.data.type];if(!u){o.push({message:`${be.t("nodes.node")} "${l.data.type}" ${be.t("nodes.skipped")}`,issues:[`${be.t("nodes.nodeType")}"${l.data.type}" ${be.t("nodes.doesNotExist")}`],data:l});return}if(u.version&&l.data.version&&jke(u.version,l.data.version)!==0){o.push({message:`${be.t("nodes.node")} "${l.data.type}" ${be.t("nodes.mismatchedVersion")}`,issues:[`${be.t("nodes.node")} "${l.data.type}" v${l.data.version} ${be.t("nodes.maybeIncompatible")} v${u.version}`],data:{node:l,nodeTemplate:Qt(u)}});return}}),i.forEach((l,u)=>{const c=s[l.source],d=s[l.target],f=[];if(c?l.type==="default"&&!(l.sourceHandle in c.data.outputs)&&f.push(`${be.t("nodes.outputNode")} "${l.source}.${l.sourceHandle}" ${be.t("nodes.doesNotExist")}`):f.push(`${be.t("nodes.outputNode")} ${l.source} ${be.t("nodes.doesNotExist")}`),d?l.type==="default"&&!(l.targetHandle in d.data.inputs)&&f.push(`${be.t("nodes.inputField")} "${l.target}.${l.targetHandle}" ${be.t("nodes.doesNotExist")}`):f.push(`${be.t("nodes.inputNode")} ${l.target} ${be.t("nodes.doesNotExist")}`),t[(c==null?void 0:c.data.type)??"__UNKNOWN_NODE_TYPE__"]||f.push(`${be.t("nodes.sourceNode")} "${l.source}" ${be.t("nodes.missingTemplate")} "${c==null?void 0:c.data.type}"`),t[(d==null?void 0:d.data.type)??"__UNKNOWN_NODE_TYPE__"]||f.push(`${be.t("nodes.sourceNode")}"${l.target}" ${be.t("nodes.missingTemplate")} "${d==null?void 0:d.data.type}"`),f.length){delete i[u];const h=l.type==="default"?l.sourceHandle:l.source,p=l.type==="default"?l.targetHandle:l.target;o.push({message:`Edge "${h} -> ${p}" skipped`,issues:f,data:l})}}),{workflow:n,errors:o}},Vke=()=>{Be({actionCreator:uxe,effect:(e,{dispatch:t,getState:n})=>{const r=Ce("nodes"),i=e.payload,o=n().nodes.nodeTemplates,{workflow:a,errors:s}=Uke(i,o);t(e2e(a)),s.length?(t(Gt($d({title:Z("toast.loadedWithWarnings"),status:"warning"}))),s.forEach(({message:l,...u})=>{r.warn(u,l)})):t(Gt($d({title:Z("toast.workflowLoaded"),status:"success"}))),t(rG("nodes")),requestAnimationFrame(()=>{var l;(l=Lke.get())==null||l.fitView()})}})};function Gke(e){if(e.sheet)return e.sheet;for(var t=0;t0?Ti(Ap,--Oo):0,op--,$r===10&&(op=1,Zx--),$r}function Ko(){return $r=Oo2||x0($r)>3?"":" "}function rTe(e,t){for(;--t&&Ko()&&!($r<48||$r>102||$r>57&&$r<65||$r>70&&$r<97););return Ay(e,H1()+(t<6&&Gs()==32&&Ko()==32))}function o4(e){for(;Ko();)switch($r){case e:return Oo;case 34:case 39:e!==34&&e!==39&&o4($r);break;case 40:e===41&&o4(e);break;case 92:Ko();break}return Oo}function iTe(e,t){for(;Ko()&&e+$r!==47+10;)if(e+$r===42+42&&Gs()===47)break;return"/*"+Ay(t,Oo-1)+"*"+Yx(e===47?e:Ko())}function oTe(e){for(;!x0(Gs());)Ko();return Ay(e,Oo)}function aTe(e){return yH(W1("",null,null,null,[""],e=mH(e),0,[0],e))}function W1(e,t,n,r,i,o,a,s,l){for(var u=0,c=0,d=a,f=0,h=0,p=0,m=1,_=1,b=1,v=0,g="",y=i,S=o,w=r,x=g;_;)switch(p=v,v=Ko()){case 40:if(p!=108&&Ti(x,d-1)==58){i4(x+=ln(q1(v),"&","&\f"),"&\f")!=-1&&(b=-1);break}case 34:case 39:case 91:x+=q1(v);break;case 9:case 10:case 13:case 32:x+=nTe(p);break;case 92:x+=rTe(H1()-1,7);continue;case 47:switch(Gs()){case 42:case 47:Wv(sTe(iTe(Ko(),H1()),t,n),l);break;default:x+="/"}break;case 123*m:s[u++]=ks(x)*b;case 125*m:case 59:case 0:switch(v){case 0:case 125:_=0;case 59+c:b==-1&&(x=ln(x,/\f/g,"")),h>0&&ks(x)-d&&Wv(h>32?XO(x+";",r,n,d-1):XO(ln(x," ","")+";",r,n,d-2),l);break;case 59:x+=";";default:if(Wv(w=QO(x,t,n,u,c,i,s,g,y=[],S=[],d),o),v===123)if(c===0)W1(x,t,w,w,y,o,d,s,S);else switch(f===99&&Ti(x,3)===110?100:f){case 100:case 108:case 109:case 115:W1(e,w,w,r&&Wv(QO(e,w,w,0,0,i,s,g,i,y=[],d),S),i,S,d,s,r?y:S);break;default:W1(x,w,w,w,[""],S,0,s,S)}}u=c=h=0,m=b=1,g=x="",d=a;break;case 58:d=1+ks(x),h=p;default:if(m<1){if(v==123)--m;else if(v==125&&m++==0&&tTe()==125)continue}switch(x+=Yx(v),v*m){case 38:b=c>0?1:(x+="\f",-1);break;case 44:s[u++]=(ks(x)-1)*b,b=1;break;case 64:Gs()===45&&(x+=q1(Ko())),f=Gs(),c=d=ks(g=x+=oTe(H1())),v++;break;case 45:p===45&&ks(x)==2&&(m=0)}}return o}function QO(e,t,n,r,i,o,a,s,l,u,c){for(var d=i-1,f=i===0?o:[""],h=zA(f),p=0,m=0,_=0;p0?f[b]+" "+v:ln(v,/&\f/g,f[b])))&&(l[_++]=g);return Jx(e,t,n,i===0?FA:s,l,u,c)}function sTe(e,t,n){return Jx(e,t,n,fH,Yx(eTe()),S0(e,2,-2),0)}function XO(e,t,n,r){return Jx(e,t,n,BA,S0(e,0,r),S0(e,r+1,-1),r)}function _h(e,t){for(var n="",r=zA(e),i=0;i6)switch(Ti(e,t+1)){case 109:if(Ti(e,t+4)!==45)break;case 102:return ln(e,/(.+:)(.+)-([^]+)/,"$1"+sn+"$2-$3$1"+j_+(Ti(e,t+3)==108?"$3":"$2-$3"))+e;case 115:return~i4(e,"stretch")?bH(ln(e,"stretch","fill-available"),t)+e:e}break;case 4949:if(Ti(e,t+1)!==115)break;case 6444:switch(Ti(e,ks(e)-3-(~i4(e,"!important")&&10))){case 107:return ln(e,":",":"+sn)+e;case 101:return ln(e,/(.+:)([^;!]+)(;|!.+)?/,"$1"+sn+(Ti(e,14)===45?"inline-":"")+"box$3$1"+sn+"$2$3$1"+Bi+"$2box$3")+e}break;case 5936:switch(Ti(e,t+11)){case 114:return sn+e+Bi+ln(e,/[svh]\w+-[tblr]{2}/,"tb")+e;case 108:return sn+e+Bi+ln(e,/[svh]\w+-[tblr]{2}/,"tb-rl")+e;case 45:return sn+e+Bi+ln(e,/[svh]\w+-[tblr]{2}/,"lr")+e}return sn+e+Bi+e+e}return e}var mTe=function(t,n,r,i){if(t.length>-1&&!t.return)switch(t.type){case BA:t.return=bH(t.value,t.length);break;case hH:return _h([rg(t,{value:ln(t.value,"@","@"+sn)})],i);case FA:if(t.length)return Jke(t.props,function(o){switch(Zke(o,/(::plac\w+|:read-\w+)/)){case":read-only":case":read-write":return _h([rg(t,{props:[ln(o,/:(read-\w+)/,":"+j_+"$1")]})],i);case"::placeholder":return _h([rg(t,{props:[ln(o,/:(plac\w+)/,":"+sn+"input-$1")]}),rg(t,{props:[ln(o,/:(plac\w+)/,":"+j_+"$1")]}),rg(t,{props:[ln(o,/:(plac\w+)/,Bi+"input-$1")]})],i)}return""})}},yTe=[mTe],vTe=function(t){var n=t.key;if(n==="css"){var r=document.querySelectorAll("style[data-emotion]:not([data-s])");Array.prototype.forEach.call(r,function(m){var _=m.getAttribute("data-emotion");_.indexOf(" ")!==-1&&(document.head.appendChild(m),m.setAttribute("data-s",""))})}var i=t.stylisPlugins||yTe,o={},a,s=[];a=t.container||document.head,Array.prototype.forEach.call(document.querySelectorAll('style[data-emotion^="'+n+' "]'),function(m){for(var _=m.getAttribute("data-emotion").split(" "),b=1;b<_.length;b++)o[_[b]]=!0;s.push(m)});var l,u=[pTe,gTe];{var c,d=[lTe,cTe(function(m){c.insert(m)})],f=uTe(u.concat(i,d)),h=function(_){return _h(aTe(_),f)};l=function(_,b,v,g){c=v,h(_?_+"{"+b.styles+"}":b.styles),g&&(p.inserted[b.name]=!0)}}var p={key:n,sheet:new qke({key:n,container:a,nonce:t.nonce,speedy:t.speedy,prepend:t.prepend,insertionPoint:t.insertionPoint}),nonce:t.nonce,inserted:o,registered:{},insert:l};return p.sheet.hydrate(s),p},bTe=!0;function _Te(e,t,n){var r="";return n.split(" ").forEach(function(i){e[i]!==void 0?t.push(e[i]+";"):r+=i+" "}),r}var _H=function(t,n,r){var i=t.key+"-"+n.name;(r===!1||bTe===!1)&&t.registered[i]===void 0&&(t.registered[i]=n.styles)},SH=function(t,n,r){_H(t,n,r);var i=t.key+"-"+n.name;if(t.inserted[n.name]===void 0){var o=n;do t.insert(n===o?"."+i:"",o,t.sheet,!0),o=o.next;while(o!==void 0)}};function STe(e){for(var t=0,n,r=0,i=e.length;i>=4;++r,i-=4)n=e.charCodeAt(r)&255|(e.charCodeAt(++r)&255)<<8|(e.charCodeAt(++r)&255)<<16|(e.charCodeAt(++r)&255)<<24,n=(n&65535)*1540483477+((n>>>16)*59797<<16),n^=n>>>24,t=(n&65535)*1540483477+((n>>>16)*59797<<16)^(t&65535)*1540483477+((t>>>16)*59797<<16);switch(i){case 3:t^=(e.charCodeAt(r+2)&255)<<16;case 2:t^=(e.charCodeAt(r+1)&255)<<8;case 1:t^=e.charCodeAt(r)&255,t=(t&65535)*1540483477+((t>>>16)*59797<<16)}return t^=t>>>13,t=(t&65535)*1540483477+((t>>>16)*59797<<16),((t^t>>>15)>>>0).toString(36)}var xTe={animationIterationCount:1,aspectRatio:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,msGridRow:1,msGridRowSpan:1,msGridColumn:1,msGridColumnSpan:1,fontWeight:1,lineHeight:1,opacity:1,order:1,orphans:1,tabSize:1,widows:1,zIndex:1,zoom:1,WebkitLineClamp:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1},wTe=/[A-Z]|^ms/g,CTe=/_EMO_([^_]+?)_([^]*?)_EMO_/g,xH=function(t){return t.charCodeAt(1)===45},JO=function(t){return t!=null&&typeof t!="boolean"},i5=vH(function(e){return xH(e)?e:e.replace(wTe,"-$&").toLowerCase()}),eM=function(t,n){switch(t){case"animation":case"animationName":if(typeof n=="string")return n.replace(CTe,function(r,i,o){return Ts={name:i,styles:o,next:Ts},i})}return xTe[t]!==1&&!xH(t)&&typeof n=="number"&&n!==0?n+"px":n};function w0(e,t,n){if(n==null)return"";if(n.__emotion_styles!==void 0)return n;switch(typeof n){case"boolean":return"";case"object":{if(n.anim===1)return Ts={name:n.name,styles:n.styles,next:Ts},n.name;if(n.styles!==void 0){var r=n.next;if(r!==void 0)for(;r!==void 0;)Ts={name:r.name,styles:r.styles,next:Ts},r=r.next;var i=n.styles+";";return i}return ETe(e,t,n)}case"function":{if(e!==void 0){var o=Ts,a=n(e);return Ts=o,w0(e,t,a)}break}}if(t==null)return n;var s=t[n];return s!==void 0?s:n}function ETe(e,t,n){var r="";if(Array.isArray(n))for(var i=0;iW.jsx("div",{className:"chakra-portal-zIndex",style:{position:"absolute",zIndex:e.zIndex,top:0,left:0,right:0},children:e.children}),zTe=e=>{const{appendToParentPortal:t,children:n}=e,[r,i]=I.useState(null),o=I.useRef(null),[,a]=I.useState({});I.useEffect(()=>a({}),[]);const s=LTe(),l=$Te();U_(()=>{if(!r)return;const c=r.ownerDocument,d=t?s??c.body:c.body;if(!d)return;o.current=c.createElement("div"),o.current.className=UA,d.appendChild(o.current),a({});const f=o.current;return()=>{d.contains(f)&&d.removeChild(f)}},[r]);const u=l!=null&&l.zIndex?W.jsx(BTe,{zIndex:l==null?void 0:l.zIndex,children:n}):n;return o.current?Uo.createPortal(W.jsx(TH,{value:o.current,children:u}),o.current):W.jsx("span",{ref:c=>{c&&i(c)}})},jTe=e=>{const{children:t,containerRef:n,appendToParentPortal:r}=e,i=n.current,o=i??(typeof window<"u"?document.body:void 0),a=I.useMemo(()=>{const l=i==null?void 0:i.ownerDocument.createElement("div");return l&&(l.className=UA),l},[i]),[,s]=I.useState({});return U_(()=>s({}),[]),U_(()=>{if(!(!a||!o))return o.appendChild(a),()=>{o.removeChild(a)}},[a,o]),o&&a?Uo.createPortal(W.jsx(TH,{value:r?a:null,children:t}),a):null};function ew(e){const t={appendToParentPortal:!0,...e},{containerRef:n,...r}=t;return n?W.jsx(jTe,{containerRef:n,...r}):W.jsx(zTe,{...r})}ew.className=UA;ew.selector=FTe;ew.displayName="Portal";function AH(){const e=I.useContext(C0);if(!e)throw Error("useTheme: `theme` is undefined. Seems you forgot to wrap your app in `` or ``");return e}var VA=I.createContext({});VA.displayName="ColorModeContext";function tw(){const e=I.useContext(VA);if(e===void 0)throw new Error("useColorMode must be used within a ColorModeProvider");return e}function SKe(e,t){const{colorMode:n}=tw();return n==="dark"?t:e}function UTe(){const e=tw(),t=AH();return{...e,theme:t}}function VTe(e,t,n){var r,i;if(t==null)return t;const o=a=>{var s,l;return(l=(s=e.__breakpoints)==null?void 0:s.asArray)==null?void 0:l[a]};return(i=(r=o(t))!=null?r:o(n))!=null?i:n}function GTe(e,t,n){var r,i;if(t==null)return t;const o=a=>{var s,l;return(l=(s=e.__cssMap)==null?void 0:s[a])==null?void 0:l.value};return(i=(r=o(t))!=null?r:o(n))!=null?i:n}function xKe(e,t,n){const r=AH();return HTe(e,t,n)(r)}function HTe(e,t,n){const r=Array.isArray(t)?t:[t],i=Array.isArray(n)?n:[n];return o=>{const a=i.filter(Boolean),s=r.map((l,u)=>{var c,d;if(e==="breakpoints")return VTe(o,l,(c=a[u])!=null?c:l);const f=`${e}.${l}`;return GTe(o,f,(d=a[u])!=null?d:l)});return Array.isArray(t)?s:s[0]}}var Ac=(...e)=>e.filter(Boolean).join(" ");function qTe(){return!1}function Hs(e){const t=typeof e;return e!=null&&(t==="object"||t==="function")&&!Array.isArray(e)}var wKe=e=>{const{condition:t,message:n}=e;t&&qTe()&&console.warn(n)};function $s(e,...t){return WTe(e)?e(...t):e}var WTe=e=>typeof e=="function",CKe=e=>e?"":void 0,EKe=e=>e?!0:void 0;function kKe(...e){return function(n){e.some(r=>(r==null||r(n),n==null?void 0:n.defaultPrevented))}}function TKe(...e){return function(n){e.forEach(r=>{r==null||r(n)})}}var V_={exports:{}};V_.exports;(function(e,t){var n=200,r="__lodash_hash_undefined__",i=800,o=16,a=9007199254740991,s="[object Arguments]",l="[object Array]",u="[object AsyncFunction]",c="[object Boolean]",d="[object Date]",f="[object Error]",h="[object Function]",p="[object GeneratorFunction]",m="[object Map]",_="[object Number]",b="[object Null]",v="[object Object]",g="[object Proxy]",y="[object RegExp]",S="[object Set]",w="[object String]",x="[object Undefined]",C="[object WeakMap]",T="[object ArrayBuffer]",k="[object DataView]",P="[object Float32Array]",$="[object Float64Array]",O="[object Int8Array]",E="[object Int16Array]",A="[object Int32Array]",D="[object Uint8Array]",L="[object Uint8ClampedArray]",M="[object Uint16Array]",R="[object Uint32Array]",N=/[\\^$.*+?()[\]{}|]/g,B=/^\[object .+?Constructor\]$/,U=/^(?:0|[1-9]\d*)$/,G={};G[P]=G[$]=G[O]=G[E]=G[A]=G[D]=G[L]=G[M]=G[R]=!0,G[s]=G[l]=G[T]=G[c]=G[k]=G[d]=G[f]=G[h]=G[m]=G[_]=G[v]=G[y]=G[S]=G[w]=G[C]=!1;var Y=typeof mt=="object"&&mt&&mt.Object===Object&&mt,ee=typeof self=="object"&&self&&self.Object===Object&&self,J=Y||ee||Function("return this")(),j=t&&!t.nodeType&&t,Q=j&&!0&&e&&!e.nodeType&&e,ne=Q&&Q.exports===j,se=ne&&Y.process,ve=function(){try{var F=Q&&Q.require&&Q.require("util").types;return F||se&&se.binding&&se.binding("util")}catch{}}(),ce=ve&&ve.isTypedArray;function bt(F,V,X){switch(X.length){case 0:return F.call(V);case 1:return F.call(V,X[0]);case 2:return F.call(V,X[0],X[1]);case 3:return F.call(V,X[0],X[1],X[2])}return F.apply(V,X)}function ot(F,V){for(var X=-1,pe=Array(F);++X-1}function ia(F,V){var X=this.__data__,pe=Ye(X,F);return pe<0?(++this.size,X.push([F,V])):X[pe][1]=V,this}zr.prototype.clear=Da,zr.prototype.delete=hs,zr.prototype.get=mi,zr.prototype.has=nu,zr.prototype.set=ia;function ni(F){var V=-1,X=F==null?0:F.length;for(this.clear();++V1?X[Ct-1]:void 0,Pn=Ct>2?X[2]:void 0;for(hn=F.length>3&&typeof hn=="function"?(Ct--,hn):void 0,Pn&&Mt(X[0],X[1],Pn)&&(hn=Ct<3?void 0:hn,Ct=1),V=Object(V);++pe-1&&F%1==0&&F0){if(++V>=i)return arguments[0]}else V=0;return F.apply(void 0,arguments)}}function dt(F){if(F!=null){try{return en.call(F)}catch{}try{return F+""}catch{}}return""}function Ve(F,V){return F===V||F!==F&&V!==V}var xe=_t(function(){return arguments}())?_t:function(F){return Ae(F)&&Ln.call(F,"callee")&&!Qi.call(F,"callee")},ue=Array.isArray;function Ee(F){return F!=null&&et(F.length)&&!we(F)}function fe(F){return Ae(F)&&Ee(F)}var ge=ol||Xi;function we(F){if(!Qe(F))return!1;var V=ct(F);return V==h||V==p||V==u||V==g}function et(F){return typeof F=="number"&&F>-1&&F%1==0&&F<=a}function Qe(F){var V=typeof F;return F!=null&&(V=="object"||V=="function")}function Ae(F){return F!=null&&typeof F=="object"}function Tt(F){if(!Ae(F)||ct(F)!=v)return!1;var V=Mi(F);if(V===null)return!0;var X=Ln.call(V,"constructor")&&V.constructor;return typeof X=="function"&&X instanceof X&&en.call(X)==Jr}var jt=ce?ze(ce):kt;function Vt(F){return La(F,or(F))}function or(F){return Ee(F)?Ie(F,!0):cn(F)}var pr=it(function(F,V,X,pe){dn(F,V,X,pe)});function zn(F){return function(){return F}}function An(F){return F}function Xi(){return!1}e.exports=pr})(V_,V_.exports);var KTe=V_.exports;const Ds=pc(KTe);var QTe=e=>/!(important)?$/.test(e),rM=e=>typeof e=="string"?e.replace(/!(important)?$/,"").trim():e,XTe=(e,t)=>n=>{const r=String(t),i=QTe(r),o=rM(r),a=e?`${e}.${o}`:o;let s=Hs(n.__cssMap)&&a in n.__cssMap?n.__cssMap[a].varRef:t;return s=rM(s),i?`${s} !important`:s};function GA(e){const{scale:t,transform:n,compose:r}=e;return(o,a)=>{var s;const l=XTe(t,o)(a);let u=(s=n==null?void 0:n(l,a))!=null?s:l;return r&&(u=r(u,a)),u}}var Kv=(...e)=>t=>e.reduce((n,r)=>r(n),t);function la(e,t){return n=>{const r={property:n,scale:e};return r.transform=GA({scale:e,transform:t}),r}}var YTe=({rtl:e,ltr:t})=>n=>n.direction==="rtl"?e:t;function ZTe(e){const{property:t,scale:n,transform:r}=e;return{scale:n,property:YTe(t),transform:n?GA({scale:n,compose:r}):r}}var PH=["rotate(var(--chakra-rotate, 0))","scaleX(var(--chakra-scale-x, 1))","scaleY(var(--chakra-scale-y, 1))","skewX(var(--chakra-skew-x, 0))","skewY(var(--chakra-skew-y, 0))"];function JTe(){return["translateX(var(--chakra-translate-x, 0))","translateY(var(--chakra-translate-y, 0))",...PH].join(" ")}function eAe(){return["translate3d(var(--chakra-translate-x, 0), var(--chakra-translate-y, 0), 0)",...PH].join(" ")}var tAe={"--chakra-blur":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-brightness":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-contrast":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-grayscale":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-hue-rotate":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-invert":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-saturate":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-sepia":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-drop-shadow":"var(--chakra-empty,/*!*/ /*!*/)",filter:["var(--chakra-blur)","var(--chakra-brightness)","var(--chakra-contrast)","var(--chakra-grayscale)","var(--chakra-hue-rotate)","var(--chakra-invert)","var(--chakra-saturate)","var(--chakra-sepia)","var(--chakra-drop-shadow)"].join(" ")},nAe={backdropFilter:["var(--chakra-backdrop-blur)","var(--chakra-backdrop-brightness)","var(--chakra-backdrop-contrast)","var(--chakra-backdrop-grayscale)","var(--chakra-backdrop-hue-rotate)","var(--chakra-backdrop-invert)","var(--chakra-backdrop-opacity)","var(--chakra-backdrop-saturate)","var(--chakra-backdrop-sepia)"].join(" "),"--chakra-backdrop-blur":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-backdrop-brightness":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-backdrop-contrast":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-backdrop-grayscale":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-backdrop-hue-rotate":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-backdrop-invert":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-backdrop-opacity":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-backdrop-saturate":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-backdrop-sepia":"var(--chakra-empty,/*!*/ /*!*/)"};function rAe(e){return{"--chakra-ring-offset-shadow":"var(--chakra-ring-inset) 0 0 0 var(--chakra-ring-offset-width) var(--chakra-ring-offset-color)","--chakra-ring-shadow":"var(--chakra-ring-inset) 0 0 0 calc(var(--chakra-ring-width) + var(--chakra-ring-offset-width)) var(--chakra-ring-color)","--chakra-ring-width":e,boxShadow:["var(--chakra-ring-offset-shadow)","var(--chakra-ring-shadow)","var(--chakra-shadow, 0 0 #0000)"].join(", ")}}var iAe={"row-reverse":{space:"--chakra-space-x-reverse",divide:"--chakra-divide-x-reverse"},"column-reverse":{space:"--chakra-space-y-reverse",divide:"--chakra-divide-y-reverse"}},a4={"to-t":"to top","to-tr":"to top right","to-r":"to right","to-br":"to bottom right","to-b":"to bottom","to-bl":"to bottom left","to-l":"to left","to-tl":"to top left"},oAe=new Set(Object.values(a4)),s4=new Set(["none","-moz-initial","inherit","initial","revert","unset"]),aAe=e=>e.trim();function sAe(e,t){if(e==null||s4.has(e))return e;if(!(l4(e)||s4.has(e)))return`url('${e}')`;const i=/(^[a-z-A-Z]+)\((.*)\)/g.exec(e),o=i==null?void 0:i[1],a=i==null?void 0:i[2];if(!o||!a)return e;const s=o.includes("-gradient")?o:`${o}-gradient`,[l,...u]=a.split(",").map(aAe).filter(Boolean);if((u==null?void 0:u.length)===0)return e;const c=l in a4?a4[l]:l;u.unshift(c);const d=u.map(f=>{if(oAe.has(f))return f;const h=f.indexOf(" "),[p,m]=h!==-1?[f.substr(0,h),f.substr(h+1)]:[f],_=l4(m)?m:m&&m.split(" "),b=`colors.${p}`,v=b in t.__cssMap?t.__cssMap[b].varRef:p;return _?[v,...Array.isArray(_)?_:[_]].join(" "):v});return`${s}(${d.join(", ")})`}var l4=e=>typeof e=="string"&&e.includes("(")&&e.includes(")"),lAe=(e,t)=>sAe(e,t??{});function uAe(e){return/^var\(--.+\)$/.test(e)}var cAe=e=>{const t=parseFloat(e.toString()),n=e.toString().replace(String(t),"");return{unitless:!n,value:t,unit:n}},bs=e=>t=>`${e}(${t})`,Kt={filter(e){return e!=="auto"?e:tAe},backdropFilter(e){return e!=="auto"?e:nAe},ring(e){return rAe(Kt.px(e))},bgClip(e){return e==="text"?{color:"transparent",backgroundClip:"text"}:{backgroundClip:e}},transform(e){return e==="auto"?JTe():e==="auto-gpu"?eAe():e},vh(e){return e==="$100vh"?"var(--chakra-vh)":e},px(e){if(e==null)return e;const{unitless:t}=cAe(e);return t||typeof e=="number"?`${e}px`:e},fraction(e){return typeof e!="number"||e>1?e:`${e*100}%`},float(e,t){const n={left:"right",right:"left"};return t.direction==="rtl"?n[e]:e},degree(e){if(uAe(e)||e==null)return e;const t=typeof e=="string"&&!e.endsWith("deg");return typeof e=="number"||t?`${e}deg`:e},gradient:lAe,blur:bs("blur"),opacity:bs("opacity"),brightness:bs("brightness"),contrast:bs("contrast"),dropShadow:bs("drop-shadow"),grayscale:bs("grayscale"),hueRotate:bs("hue-rotate"),invert:bs("invert"),saturate:bs("saturate"),sepia:bs("sepia"),bgImage(e){return e==null||l4(e)||s4.has(e)?e:`url(${e})`},outline(e){const t=String(e)==="0"||String(e)==="none";return e!==null&&t?{outline:"2px solid transparent",outlineOffset:"2px"}:{outline:e}},flexDirection(e){var t;const{space:n,divide:r}=(t=iAe[e])!=null?t:{},i={flexDirection:e};return n&&(i[n]=1),r&&(i[r]=1),i}},H={borderWidths:la("borderWidths"),borderStyles:la("borderStyles"),colors:la("colors"),borders:la("borders"),gradients:la("gradients",Kt.gradient),radii:la("radii",Kt.px),space:la("space",Kv(Kt.vh,Kt.px)),spaceT:la("space",Kv(Kt.vh,Kt.px)),degreeT(e){return{property:e,transform:Kt.degree}},prop(e,t,n){return{property:e,scale:t,...t&&{transform:GA({scale:t,transform:n})}}},propT(e,t){return{property:e,transform:t}},sizes:la("sizes",Kv(Kt.vh,Kt.px)),sizesT:la("sizes",Kv(Kt.vh,Kt.fraction)),shadows:la("shadows"),logical:ZTe,blur:la("blur",Kt.blur)},K1={background:H.colors("background"),backgroundColor:H.colors("backgroundColor"),backgroundImage:H.gradients("backgroundImage"),backgroundSize:!0,backgroundPosition:!0,backgroundRepeat:!0,backgroundAttachment:!0,backgroundClip:{transform:Kt.bgClip},bgSize:H.prop("backgroundSize"),bgPosition:H.prop("backgroundPosition"),bg:H.colors("background"),bgColor:H.colors("backgroundColor"),bgPos:H.prop("backgroundPosition"),bgRepeat:H.prop("backgroundRepeat"),bgAttachment:H.prop("backgroundAttachment"),bgGradient:H.gradients("backgroundImage"),bgClip:{transform:Kt.bgClip}};Object.assign(K1,{bgImage:K1.backgroundImage,bgImg:K1.backgroundImage});var an={border:H.borders("border"),borderWidth:H.borderWidths("borderWidth"),borderStyle:H.borderStyles("borderStyle"),borderColor:H.colors("borderColor"),borderRadius:H.radii("borderRadius"),borderTop:H.borders("borderTop"),borderBlockStart:H.borders("borderBlockStart"),borderTopLeftRadius:H.radii("borderTopLeftRadius"),borderStartStartRadius:H.logical({scale:"radii",property:{ltr:"borderTopLeftRadius",rtl:"borderTopRightRadius"}}),borderEndStartRadius:H.logical({scale:"radii",property:{ltr:"borderBottomLeftRadius",rtl:"borderBottomRightRadius"}}),borderTopRightRadius:H.radii("borderTopRightRadius"),borderStartEndRadius:H.logical({scale:"radii",property:{ltr:"borderTopRightRadius",rtl:"borderTopLeftRadius"}}),borderEndEndRadius:H.logical({scale:"radii",property:{ltr:"borderBottomRightRadius",rtl:"borderBottomLeftRadius"}}),borderRight:H.borders("borderRight"),borderInlineEnd:H.borders("borderInlineEnd"),borderBottom:H.borders("borderBottom"),borderBlockEnd:H.borders("borderBlockEnd"),borderBottomLeftRadius:H.radii("borderBottomLeftRadius"),borderBottomRightRadius:H.radii("borderBottomRightRadius"),borderLeft:H.borders("borderLeft"),borderInlineStart:{property:"borderInlineStart",scale:"borders"},borderInlineStartRadius:H.logical({scale:"radii",property:{ltr:["borderTopLeftRadius","borderBottomLeftRadius"],rtl:["borderTopRightRadius","borderBottomRightRadius"]}}),borderInlineEndRadius:H.logical({scale:"radii",property:{ltr:["borderTopRightRadius","borderBottomRightRadius"],rtl:["borderTopLeftRadius","borderBottomLeftRadius"]}}),borderX:H.borders(["borderLeft","borderRight"]),borderInline:H.borders("borderInline"),borderY:H.borders(["borderTop","borderBottom"]),borderBlock:H.borders("borderBlock"),borderTopWidth:H.borderWidths("borderTopWidth"),borderBlockStartWidth:H.borderWidths("borderBlockStartWidth"),borderTopColor:H.colors("borderTopColor"),borderBlockStartColor:H.colors("borderBlockStartColor"),borderTopStyle:H.borderStyles("borderTopStyle"),borderBlockStartStyle:H.borderStyles("borderBlockStartStyle"),borderBottomWidth:H.borderWidths("borderBottomWidth"),borderBlockEndWidth:H.borderWidths("borderBlockEndWidth"),borderBottomColor:H.colors("borderBottomColor"),borderBlockEndColor:H.colors("borderBlockEndColor"),borderBottomStyle:H.borderStyles("borderBottomStyle"),borderBlockEndStyle:H.borderStyles("borderBlockEndStyle"),borderLeftWidth:H.borderWidths("borderLeftWidth"),borderInlineStartWidth:H.borderWidths("borderInlineStartWidth"),borderLeftColor:H.colors("borderLeftColor"),borderInlineStartColor:H.colors("borderInlineStartColor"),borderLeftStyle:H.borderStyles("borderLeftStyle"),borderInlineStartStyle:H.borderStyles("borderInlineStartStyle"),borderRightWidth:H.borderWidths("borderRightWidth"),borderInlineEndWidth:H.borderWidths("borderInlineEndWidth"),borderRightColor:H.colors("borderRightColor"),borderInlineEndColor:H.colors("borderInlineEndColor"),borderRightStyle:H.borderStyles("borderRightStyle"),borderInlineEndStyle:H.borderStyles("borderInlineEndStyle"),borderTopRadius:H.radii(["borderTopLeftRadius","borderTopRightRadius"]),borderBottomRadius:H.radii(["borderBottomLeftRadius","borderBottomRightRadius"]),borderLeftRadius:H.radii(["borderTopLeftRadius","borderBottomLeftRadius"]),borderRightRadius:H.radii(["borderTopRightRadius","borderBottomRightRadius"])};Object.assign(an,{rounded:an.borderRadius,roundedTop:an.borderTopRadius,roundedTopLeft:an.borderTopLeftRadius,roundedTopRight:an.borderTopRightRadius,roundedTopStart:an.borderStartStartRadius,roundedTopEnd:an.borderStartEndRadius,roundedBottom:an.borderBottomRadius,roundedBottomLeft:an.borderBottomLeftRadius,roundedBottomRight:an.borderBottomRightRadius,roundedBottomStart:an.borderEndStartRadius,roundedBottomEnd:an.borderEndEndRadius,roundedLeft:an.borderLeftRadius,roundedRight:an.borderRightRadius,roundedStart:an.borderInlineStartRadius,roundedEnd:an.borderInlineEndRadius,borderStart:an.borderInlineStart,borderEnd:an.borderInlineEnd,borderTopStartRadius:an.borderStartStartRadius,borderTopEndRadius:an.borderStartEndRadius,borderBottomStartRadius:an.borderEndStartRadius,borderBottomEndRadius:an.borderEndEndRadius,borderStartRadius:an.borderInlineStartRadius,borderEndRadius:an.borderInlineEndRadius,borderStartWidth:an.borderInlineStartWidth,borderEndWidth:an.borderInlineEndWidth,borderStartColor:an.borderInlineStartColor,borderEndColor:an.borderInlineEndColor,borderStartStyle:an.borderInlineStartStyle,borderEndStyle:an.borderInlineEndStyle});var dAe={color:H.colors("color"),textColor:H.colors("color"),fill:H.colors("fill"),stroke:H.colors("stroke")},u4={boxShadow:H.shadows("boxShadow"),mixBlendMode:!0,blendMode:H.prop("mixBlendMode"),backgroundBlendMode:!0,bgBlendMode:H.prop("backgroundBlendMode"),opacity:!0};Object.assign(u4,{shadow:u4.boxShadow});var fAe={filter:{transform:Kt.filter},blur:H.blur("--chakra-blur"),brightness:H.propT("--chakra-brightness",Kt.brightness),contrast:H.propT("--chakra-contrast",Kt.contrast),hueRotate:H.degreeT("--chakra-hue-rotate"),invert:H.propT("--chakra-invert",Kt.invert),saturate:H.propT("--chakra-saturate",Kt.saturate),dropShadow:H.propT("--chakra-drop-shadow",Kt.dropShadow),backdropFilter:{transform:Kt.backdropFilter},backdropBlur:H.blur("--chakra-backdrop-blur"),backdropBrightness:H.propT("--chakra-backdrop-brightness",Kt.brightness),backdropContrast:H.propT("--chakra-backdrop-contrast",Kt.contrast),backdropHueRotate:H.degreeT("--chakra-backdrop-hue-rotate"),backdropInvert:H.propT("--chakra-backdrop-invert",Kt.invert),backdropSaturate:H.propT("--chakra-backdrop-saturate",Kt.saturate)},G_={alignItems:!0,alignContent:!0,justifyItems:!0,justifyContent:!0,flexWrap:!0,flexDirection:{transform:Kt.flexDirection},flex:!0,flexFlow:!0,flexGrow:!0,flexShrink:!0,flexBasis:H.sizes("flexBasis"),justifySelf:!0,alignSelf:!0,order:!0,placeItems:!0,placeContent:!0,placeSelf:!0,gap:H.space("gap"),rowGap:H.space("rowGap"),columnGap:H.space("columnGap")};Object.assign(G_,{flexDir:G_.flexDirection});var IH={gridGap:H.space("gridGap"),gridColumnGap:H.space("gridColumnGap"),gridRowGap:H.space("gridRowGap"),gridColumn:!0,gridRow:!0,gridAutoFlow:!0,gridAutoColumns:!0,gridColumnStart:!0,gridColumnEnd:!0,gridRowStart:!0,gridRowEnd:!0,gridAutoRows:!0,gridTemplate:!0,gridTemplateColumns:!0,gridTemplateRows:!0,gridTemplateAreas:!0,gridArea:!0},hAe={appearance:!0,cursor:!0,resize:!0,userSelect:!0,pointerEvents:!0,outline:{transform:Kt.outline},outlineOffset:!0,outlineColor:H.colors("outlineColor")},da={width:H.sizesT("width"),inlineSize:H.sizesT("inlineSize"),height:H.sizes("height"),blockSize:H.sizes("blockSize"),boxSize:H.sizes(["width","height"]),minWidth:H.sizes("minWidth"),minInlineSize:H.sizes("minInlineSize"),minHeight:H.sizes("minHeight"),minBlockSize:H.sizes("minBlockSize"),maxWidth:H.sizes("maxWidth"),maxInlineSize:H.sizes("maxInlineSize"),maxHeight:H.sizes("maxHeight"),maxBlockSize:H.sizes("maxBlockSize"),overflow:!0,overflowX:!0,overflowY:!0,overscrollBehavior:!0,overscrollBehaviorX:!0,overscrollBehaviorY:!0,display:!0,aspectRatio:!0,hideFrom:{scale:"breakpoints",transform:(e,t)=>{var n,r,i;return{[`@media screen and (min-width: ${(i=(r=(n=t.__breakpoints)==null?void 0:n.get(e))==null?void 0:r.minW)!=null?i:e})`]:{display:"none"}}}},hideBelow:{scale:"breakpoints",transform:(e,t)=>{var n,r,i;return{[`@media screen and (max-width: ${(i=(r=(n=t.__breakpoints)==null?void 0:n.get(e))==null?void 0:r._minW)!=null?i:e})`]:{display:"none"}}}},verticalAlign:!0,boxSizing:!0,boxDecorationBreak:!0,float:H.propT("float",Kt.float),objectFit:!0,objectPosition:!0,visibility:!0,isolation:!0};Object.assign(da,{w:da.width,h:da.height,minW:da.minWidth,maxW:da.maxWidth,minH:da.minHeight,maxH:da.maxHeight,overscroll:da.overscrollBehavior,overscrollX:da.overscrollBehaviorX,overscrollY:da.overscrollBehaviorY});var pAe={listStyleType:!0,listStylePosition:!0,listStylePos:H.prop("listStylePosition"),listStyleImage:!0,listStyleImg:H.prop("listStyleImage")};function gAe(e,t,n,r){const i=typeof t=="string"?t.split("."):[t];for(r=0;r{const t=new WeakMap;return(r,i,o,a)=>{if(typeof r>"u")return e(r,i,o);t.has(r)||t.set(r,new Map);const s=t.get(r);if(s.has(i))return s.get(i);const l=e(r,i,o,a);return s.set(i,l),l}},yAe=mAe(gAe),vAe={border:"0px",clip:"rect(0, 0, 0, 0)",width:"1px",height:"1px",margin:"-1px",padding:"0px",overflow:"hidden",whiteSpace:"nowrap",position:"absolute"},bAe={position:"static",width:"auto",height:"auto",clip:"auto",padding:"0",margin:"0",overflow:"visible",whiteSpace:"normal"},o5=(e,t,n)=>{const r={},i=yAe(e,t,{});for(const o in i)o in n&&n[o]!=null||(r[o]=i[o]);return r},_Ae={srOnly:{transform(e){return e===!0?vAe:e==="focusable"?bAe:{}}},layerStyle:{processResult:!0,transform:(e,t,n)=>o5(t,`layerStyles.${e}`,n)},textStyle:{processResult:!0,transform:(e,t,n)=>o5(t,`textStyles.${e}`,n)},apply:{processResult:!0,transform:(e,t,n)=>o5(t,e,n)}},Qg={position:!0,pos:H.prop("position"),zIndex:H.prop("zIndex","zIndices"),inset:H.spaceT("inset"),insetX:H.spaceT(["left","right"]),insetInline:H.spaceT("insetInline"),insetY:H.spaceT(["top","bottom"]),insetBlock:H.spaceT("insetBlock"),top:H.spaceT("top"),insetBlockStart:H.spaceT("insetBlockStart"),bottom:H.spaceT("bottom"),insetBlockEnd:H.spaceT("insetBlockEnd"),left:H.spaceT("left"),insetInlineStart:H.logical({scale:"space",property:{ltr:"left",rtl:"right"}}),right:H.spaceT("right"),insetInlineEnd:H.logical({scale:"space",property:{ltr:"right",rtl:"left"}})};Object.assign(Qg,{insetStart:Qg.insetInlineStart,insetEnd:Qg.insetInlineEnd});var SAe={ring:{transform:Kt.ring},ringColor:H.colors("--chakra-ring-color"),ringOffset:H.prop("--chakra-ring-offset-width"),ringOffsetColor:H.colors("--chakra-ring-offset-color"),ringInset:H.prop("--chakra-ring-inset")},Un={margin:H.spaceT("margin"),marginTop:H.spaceT("marginTop"),marginBlockStart:H.spaceT("marginBlockStart"),marginRight:H.spaceT("marginRight"),marginInlineEnd:H.spaceT("marginInlineEnd"),marginBottom:H.spaceT("marginBottom"),marginBlockEnd:H.spaceT("marginBlockEnd"),marginLeft:H.spaceT("marginLeft"),marginInlineStart:H.spaceT("marginInlineStart"),marginX:H.spaceT(["marginInlineStart","marginInlineEnd"]),marginInline:H.spaceT("marginInline"),marginY:H.spaceT(["marginTop","marginBottom"]),marginBlock:H.spaceT("marginBlock"),padding:H.space("padding"),paddingTop:H.space("paddingTop"),paddingBlockStart:H.space("paddingBlockStart"),paddingRight:H.space("paddingRight"),paddingBottom:H.space("paddingBottom"),paddingBlockEnd:H.space("paddingBlockEnd"),paddingLeft:H.space("paddingLeft"),paddingInlineStart:H.space("paddingInlineStart"),paddingInlineEnd:H.space("paddingInlineEnd"),paddingX:H.space(["paddingInlineStart","paddingInlineEnd"]),paddingInline:H.space("paddingInline"),paddingY:H.space(["paddingTop","paddingBottom"]),paddingBlock:H.space("paddingBlock")};Object.assign(Un,{m:Un.margin,mt:Un.marginTop,mr:Un.marginRight,me:Un.marginInlineEnd,marginEnd:Un.marginInlineEnd,mb:Un.marginBottom,ml:Un.marginLeft,ms:Un.marginInlineStart,marginStart:Un.marginInlineStart,mx:Un.marginX,my:Un.marginY,p:Un.padding,pt:Un.paddingTop,py:Un.paddingY,px:Un.paddingX,pb:Un.paddingBottom,pl:Un.paddingLeft,ps:Un.paddingInlineStart,paddingStart:Un.paddingInlineStart,pr:Un.paddingRight,pe:Un.paddingInlineEnd,paddingEnd:Un.paddingInlineEnd});var xAe={textDecorationColor:H.colors("textDecorationColor"),textDecoration:!0,textDecor:{property:"textDecoration"},textDecorationLine:!0,textDecorationStyle:!0,textDecorationThickness:!0,textUnderlineOffset:!0,textShadow:H.shadows("textShadow")},wAe={clipPath:!0,transform:H.propT("transform",Kt.transform),transformOrigin:!0,translateX:H.spaceT("--chakra-translate-x"),translateY:H.spaceT("--chakra-translate-y"),skewX:H.degreeT("--chakra-skew-x"),skewY:H.degreeT("--chakra-skew-y"),scaleX:H.prop("--chakra-scale-x"),scaleY:H.prop("--chakra-scale-y"),scale:H.prop(["--chakra-scale-x","--chakra-scale-y"]),rotate:H.degreeT("--chakra-rotate")},CAe={transition:!0,transitionDelay:!0,animation:!0,willChange:!0,transitionDuration:H.prop("transitionDuration","transition.duration"),transitionProperty:H.prop("transitionProperty","transition.property"),transitionTimingFunction:H.prop("transitionTimingFunction","transition.easing")},EAe={fontFamily:H.prop("fontFamily","fonts"),fontSize:H.prop("fontSize","fontSizes",Kt.px),fontWeight:H.prop("fontWeight","fontWeights"),lineHeight:H.prop("lineHeight","lineHeights"),letterSpacing:H.prop("letterSpacing","letterSpacings"),textAlign:!0,fontStyle:!0,textIndent:!0,wordBreak:!0,overflowWrap:!0,textOverflow:!0,textTransform:!0,whiteSpace:!0,isTruncated:{transform(e){if(e===!0)return{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}}},noOfLines:{static:{overflow:"hidden",textOverflow:"ellipsis",display:"-webkit-box",WebkitBoxOrient:"vertical",WebkitLineClamp:"var(--chakra-line-clamp)"},property:"--chakra-line-clamp"}},kAe={scrollBehavior:!0,scrollSnapAlign:!0,scrollSnapStop:!0,scrollSnapType:!0,scrollMargin:H.spaceT("scrollMargin"),scrollMarginTop:H.spaceT("scrollMarginTop"),scrollMarginBottom:H.spaceT("scrollMarginBottom"),scrollMarginLeft:H.spaceT("scrollMarginLeft"),scrollMarginRight:H.spaceT("scrollMarginRight"),scrollMarginX:H.spaceT(["scrollMarginLeft","scrollMarginRight"]),scrollMarginY:H.spaceT(["scrollMarginTop","scrollMarginBottom"]),scrollPadding:H.spaceT("scrollPadding"),scrollPaddingTop:H.spaceT("scrollPaddingTop"),scrollPaddingBottom:H.spaceT("scrollPaddingBottom"),scrollPaddingLeft:H.spaceT("scrollPaddingLeft"),scrollPaddingRight:H.spaceT("scrollPaddingRight"),scrollPaddingX:H.spaceT(["scrollPaddingLeft","scrollPaddingRight"]),scrollPaddingY:H.spaceT(["scrollPaddingTop","scrollPaddingBottom"])};function RH(e){return Hs(e)&&e.reference?e.reference:String(e)}var nw=(e,...t)=>t.map(RH).join(` ${e} `).replace(/calc/g,""),iM=(...e)=>`calc(${nw("+",...e)})`,oM=(...e)=>`calc(${nw("-",...e)})`,c4=(...e)=>`calc(${nw("*",...e)})`,aM=(...e)=>`calc(${nw("/",...e)})`,sM=e=>{const t=RH(e);return t!=null&&!Number.isNaN(parseFloat(t))?String(t).startsWith("-")?String(t).slice(1):`-${t}`:c4(t,-1)},Kc=Object.assign(e=>({add:(...t)=>Kc(iM(e,...t)),subtract:(...t)=>Kc(oM(e,...t)),multiply:(...t)=>Kc(c4(e,...t)),divide:(...t)=>Kc(aM(e,...t)),negate:()=>Kc(sM(e)),toString:()=>e.toString()}),{add:iM,subtract:oM,multiply:c4,divide:aM,negate:sM});function TAe(e,t="-"){return e.replace(/\s+/g,t)}function AAe(e){const t=TAe(e.toString());return IAe(PAe(t))}function PAe(e){return e.includes("\\.")?e:!Number.isInteger(parseFloat(e.toString()))?e.replace(".","\\."):e}function IAe(e){return e.replace(/[!-,/:-@[-^`{-~]/g,"\\$&")}function RAe(e,t=""){return[t,e].filter(Boolean).join("-")}function OAe(e,t){return`var(${e}${t?`, ${t}`:""})`}function MAe(e,t=""){return AAe(`--${RAe(e,t)}`)}function nt(e,t,n){const r=MAe(e,n);return{variable:r,reference:OAe(r,t)}}function NAe(e,t){const n={};for(const r of t){if(Array.isArray(r)){const[i,o]=r;n[i]=nt(`${e}-${i}`,o);continue}n[r]=nt(`${e}-${r}`)}return n}function $Ae(e){const t=e==null?0:e.length;return t?e[t-1]:void 0}function DAe(e){const t=parseFloat(e.toString()),n=e.toString().replace(String(t),"");return{unitless:!n,value:t,unit:n}}function d4(e){if(e==null)return e;const{unitless:t}=DAe(e);return t||typeof e=="number"?`${e}px`:e}var OH=(e,t)=>parseInt(e[1],10)>parseInt(t[1],10)?1:-1,HA=e=>Object.fromEntries(Object.entries(e).sort(OH));function lM(e){const t=HA(e);return Object.assign(Object.values(t),t)}function LAe(e){const t=Object.keys(HA(e));return new Set(t)}function uM(e){var t;if(!e)return e;e=(t=d4(e))!=null?t:e;const n=-.02;return typeof e=="number"?`${e+n}`:e.replace(/(\d+\.?\d*)/u,r=>`${parseFloat(r)+n}`)}function Cg(e,t){const n=["@media screen"];return e&&n.push("and",`(min-width: ${d4(e)})`),t&&n.push("and",`(max-width: ${d4(t)})`),n.join(" ")}function FAe(e){var t;if(!e)return null;e.base=(t=e.base)!=null?t:"0px";const n=lM(e),r=Object.entries(e).sort(OH).map(([a,s],l,u)=>{var c;let[,d]=(c=u[l+1])!=null?c:[];return d=parseFloat(d)>0?uM(d):void 0,{_minW:uM(s),breakpoint:a,minW:s,maxW:d,maxWQuery:Cg(null,d),minWQuery:Cg(s),minMaxQuery:Cg(s,d)}}),i=LAe(e),o=Array.from(i.values());return{keys:i,normalized:n,isResponsive(a){const s=Object.keys(a);return s.length>0&&s.every(l=>i.has(l))},asObject:HA(e),asArray:lM(e),details:r,get(a){return r.find(s=>s.breakpoint===a)},media:[null,...n.map(a=>Cg(a)).slice(1)],toArrayValue(a){if(!Hs(a))throw new Error("toArrayValue: value must be an object");const s=o.map(l=>{var u;return(u=a[l])!=null?u:null});for(;$Ae(s)===null;)s.pop();return s},toObjectValue(a){if(!Array.isArray(a))throw new Error("toObjectValue: value must be an array");return a.reduce((s,l,u)=>{const c=o[u];return c!=null&&l!=null&&(s[c]=l),s},{})}}}var _i={hover:(e,t)=>`${e}:hover ${t}, ${e}[data-hover] ${t}`,focus:(e,t)=>`${e}:focus ${t}, ${e}[data-focus] ${t}`,focusVisible:(e,t)=>`${e}:focus-visible ${t}`,focusWithin:(e,t)=>`${e}:focus-within ${t}`,active:(e,t)=>`${e}:active ${t}, ${e}[data-active] ${t}`,disabled:(e,t)=>`${e}:disabled ${t}, ${e}[data-disabled] ${t}`,invalid:(e,t)=>`${e}:invalid ${t}, ${e}[data-invalid] ${t}`,checked:(e,t)=>`${e}:checked ${t}, ${e}[data-checked] ${t}`,indeterminate:(e,t)=>`${e}:indeterminate ${t}, ${e}[aria-checked=mixed] ${t}, ${e}[data-indeterminate] ${t}`,readOnly:(e,t)=>`${e}:read-only ${t}, ${e}[readonly] ${t}, ${e}[data-read-only] ${t}`,expanded:(e,t)=>`${e}:read-only ${t}, ${e}[aria-expanded=true] ${t}, ${e}[data-expanded] ${t}`,placeholderShown:(e,t)=>`${e}:placeholder-shown ${t}`},uu=e=>MH(t=>e(t,"&"),"[role=group]","[data-group]",".group"),fl=e=>MH(t=>e(t,"~ &"),"[data-peer]",".peer"),MH=(e,...t)=>t.map(e).join(", "),rw={_hover:"&:hover, &[data-hover]",_active:"&:active, &[data-active]",_focus:"&:focus, &[data-focus]",_highlighted:"&[data-highlighted]",_focusWithin:"&:focus-within",_focusVisible:"&:focus-visible, &[data-focus-visible]",_disabled:"&:disabled, &[disabled], &[aria-disabled=true], &[data-disabled]",_readOnly:"&[aria-readonly=true], &[readonly], &[data-readonly]",_before:"&::before",_after:"&::after",_empty:"&:empty",_expanded:"&[aria-expanded=true], &[data-expanded]",_checked:"&[aria-checked=true], &[data-checked]",_grabbed:"&[aria-grabbed=true], &[data-grabbed]",_pressed:"&[aria-pressed=true], &[data-pressed]",_invalid:"&[aria-invalid=true], &[data-invalid]",_valid:"&[data-valid], &[data-state=valid]",_loading:"&[data-loading], &[aria-busy=true]",_selected:"&[aria-selected=true], &[data-selected]",_hidden:"&[hidden], &[data-hidden]",_autofill:"&:-webkit-autofill",_even:"&:nth-of-type(even)",_odd:"&:nth-of-type(odd)",_first:"&:first-of-type",_firstLetter:"&::first-letter",_last:"&:last-of-type",_notFirst:"&:not(:first-of-type)",_notLast:"&:not(:last-of-type)",_visited:"&:visited",_activeLink:"&[aria-current=page]",_activeStep:"&[aria-current=step]",_indeterminate:"&:indeterminate, &[aria-checked=mixed], &[data-indeterminate]",_groupHover:uu(_i.hover),_peerHover:fl(_i.hover),_groupFocus:uu(_i.focus),_peerFocus:fl(_i.focus),_groupFocusVisible:uu(_i.focusVisible),_peerFocusVisible:fl(_i.focusVisible),_groupActive:uu(_i.active),_peerActive:fl(_i.active),_groupDisabled:uu(_i.disabled),_peerDisabled:fl(_i.disabled),_groupInvalid:uu(_i.invalid),_peerInvalid:fl(_i.invalid),_groupChecked:uu(_i.checked),_peerChecked:fl(_i.checked),_groupFocusWithin:uu(_i.focusWithin),_peerFocusWithin:fl(_i.focusWithin),_peerPlaceholderShown:fl(_i.placeholderShown),_placeholder:"&::placeholder",_placeholderShown:"&:placeholder-shown",_fullScreen:"&:fullscreen",_selection:"&::selection",_rtl:"[dir=rtl] &, &[dir=rtl]",_ltr:"[dir=ltr] &, &[dir=ltr]",_mediaDark:"@media (prefers-color-scheme: dark)",_mediaReduceMotion:"@media (prefers-reduced-motion: reduce)",_dark:".chakra-ui-dark &:not([data-theme]),[data-theme=dark] &:not([data-theme]),&[data-theme=dark]",_light:".chakra-ui-light &:not([data-theme]),[data-theme=light] &:not([data-theme]),&[data-theme=light]",_horizontal:"&[data-orientation=horizontal]",_vertical:"&[data-orientation=vertical]"},NH=Object.keys(rw);function cM(e,t){return nt(String(e).replace(/\./g,"-"),void 0,t)}function BAe(e,t){let n={};const r={};for(const[i,o]of Object.entries(e)){const{isSemantic:a,value:s}=o,{variable:l,reference:u}=cM(i,t==null?void 0:t.cssVarPrefix);if(!a){if(i.startsWith("space")){const f=i.split("."),[h,...p]=f,m=`${h}.-${p.join(".")}`,_=Kc.negate(s),b=Kc.negate(u);r[m]={value:_,var:l,varRef:b}}n[l]=s,r[i]={value:s,var:l,varRef:u};continue}const c=f=>{const p=[String(i).split(".")[0],f].join(".");if(!e[p])return f;const{reference:_}=cM(p,t==null?void 0:t.cssVarPrefix);return _},d=Hs(s)?s:{default:s};n=Ds(n,Object.entries(d).reduce((f,[h,p])=>{var m,_;if(!p)return f;const b=c(`${p}`);if(h==="default")return f[l]=b,f;const v=(_=(m=rw)==null?void 0:m[h])!=null?_:h;return f[v]={[l]:b},f},{})),r[i]={value:u,var:l,varRef:u}}return{cssVars:n,cssMap:r}}function zAe(e,t=[]){const n=Object.assign({},e);for(const r of t)r in n&&delete n[r];return n}function jAe(e,t){const n={};for(const r of t)r in e&&(n[r]=e[r]);return n}function UAe(e){return typeof e=="object"&&e!=null&&!Array.isArray(e)}function dM(e,t,n={}){const{stop:r,getKey:i}=n;function o(a,s=[]){var l;if(UAe(a)||Array.isArray(a)){const u={};for(const[c,d]of Object.entries(a)){const f=(l=i==null?void 0:i(c))!=null?l:c,h=[...s,f];if(r!=null&&r(a,h))return t(a,s);u[f]=o(d,h)}return u}return t(a,s)}return o(e)}var VAe=["colors","borders","borderWidths","borderStyles","fonts","fontSizes","fontWeights","gradients","letterSpacings","lineHeights","radii","space","shadows","sizes","zIndices","transition","blur","breakpoints"];function GAe(e){return jAe(e,VAe)}function HAe(e){return e.semanticTokens}function qAe(e){const{__cssMap:t,__cssVars:n,__breakpoints:r,...i}=e;return i}var WAe=e=>NH.includes(e)||e==="default";function KAe({tokens:e,semanticTokens:t}){const n={};return dM(e,(r,i)=>{r!=null&&(n[i.join(".")]={isSemantic:!1,value:r})}),dM(t,(r,i)=>{r!=null&&(n[i.join(".")]={isSemantic:!0,value:r})},{stop:r=>Object.keys(r).every(WAe)}),n}function QAe(e){var t;const n=qAe(e),r=GAe(n),i=HAe(n),o=KAe({tokens:r,semanticTokens:i}),a=(t=n.config)==null?void 0:t.cssVarPrefix,{cssMap:s,cssVars:l}=BAe(o,{cssVarPrefix:a});return Object.assign(n,{__cssVars:{...{"--chakra-ring-inset":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-ring-offset-width":"0px","--chakra-ring-offset-color":"#fff","--chakra-ring-color":"rgba(66, 153, 225, 0.6)","--chakra-ring-offset-shadow":"0 0 #0000","--chakra-ring-shadow":"0 0 #0000","--chakra-space-x-reverse":"0","--chakra-space-y-reverse":"0"},...l},__cssMap:s,__breakpoints:FAe(n.breakpoints)}),n}var qA=Ds({},K1,an,dAe,G_,da,fAe,SAe,hAe,IH,_Ae,Qg,u4,Un,kAe,EAe,xAe,wAe,pAe,CAe),XAe=Object.assign({},Un,da,G_,IH,Qg),AKe=Object.keys(XAe),YAe=[...Object.keys(qA),...NH],ZAe={...qA,...rw},JAe=e=>e in ZAe,ePe=e=>t=>{if(!t.__breakpoints)return e;const{isResponsive:n,toArrayValue:r,media:i}=t.__breakpoints,o={};for(const a in e){let s=$s(e[a],t);if(s==null)continue;if(s=Hs(s)&&n(s)?r(s):s,!Array.isArray(s)){o[a]=s;continue}const l=s.slice(0,i.length).length;for(let u=0;ue.startsWith("--")&&typeof t=="string"&&!nPe(t),iPe=(e,t)=>{var n,r;if(t==null)return t;const i=l=>{var u,c;return(c=(u=e.__cssMap)==null?void 0:u[l])==null?void 0:c.varRef},o=l=>{var u;return(u=i(l))!=null?u:l},[a,s]=tPe(t);return t=(r=(n=i(a))!=null?n:o(s))!=null?r:o(t),t};function oPe(e){const{configs:t={},pseudos:n={},theme:r}=e,i=(o,a=!1)=>{var s,l,u;const c=$s(o,r),d=ePe(c)(r);let f={};for(let h in d){const p=d[h];let m=$s(p,r);h in n&&(h=n[h]),rPe(h,m)&&(m=iPe(r,m));let _=t[h];if(_===!0&&(_={property:h}),Hs(m)){f[h]=(s=f[h])!=null?s:{},f[h]=Ds({},f[h],i(m,!0));continue}let b=(u=(l=_==null?void 0:_.transform)==null?void 0:l.call(_,m,r,c))!=null?u:m;b=_!=null&&_.processResult?i(b,!0):b;const v=$s(_==null?void 0:_.property,r);if(!a&&(_!=null&&_.static)){const g=$s(_.static,r);f=Ds({},f,g)}if(v&&Array.isArray(v)){for(const g of v)f[g]=b;continue}if(v){v==="&"&&Hs(b)?f=Ds({},f,b):f[v]=b;continue}if(Hs(b)){f=Ds({},f,b);continue}f[h]=b}return f};return i}var $H=e=>t=>oPe({theme:t,pseudos:rw,configs:qA})(e);function Pt(e){return{definePartsStyle(t){return t},defineMultiStyleConfig(t){return{parts:e,...t}}}}function aPe(e,t){if(Array.isArray(e))return e;if(Hs(e))return t(e);if(e!=null)return[e]}function sPe(e,t){for(let n=t+1;n{Ds(u,{[g]:f?v[g]:{[b]:v[g]}})});continue}if(!h){f?Ds(u,v):u[b]=v;continue}u[b]=v}}return u}}function uPe(e){return t=>{var n;const{variant:r,size:i,theme:o}=t,a=lPe(o);return Ds({},$s((n=e.baseStyle)!=null?n:{},t),a(e,"sizes",i,t),a(e,"variants",r,t))}}function PKe(e,t,n){var r,i,o;return(o=(i=(r=e.__cssMap)==null?void 0:r[`${t}.${n}`])==null?void 0:i.varRef)!=null?o:n}function Iy(e){return zAe(e,["styleConfig","size","variant","colorScheme"])}var cPe={common:"background-color, border-color, color, fill, stroke, opacity, box-shadow, transform",colors:"background-color, border-color, color, fill, stroke",dimensions:"width, height",position:"left, right, top, bottom",background:"background-color, background-image, background-position"},dPe={"ease-in":"cubic-bezier(0.4, 0, 1, 1)","ease-out":"cubic-bezier(0, 0, 0.2, 1)","ease-in-out":"cubic-bezier(0.4, 0, 0.2, 1)"},fPe={"ultra-fast":"50ms",faster:"100ms",fast:"150ms",normal:"200ms",slow:"300ms",slower:"400ms","ultra-slow":"500ms"},hPe={property:cPe,easing:dPe,duration:fPe},pPe=hPe,gPe={hide:-1,auto:"auto",base:0,docked:10,dropdown:1e3,sticky:1100,banner:1200,overlay:1300,modal:1400,popover:1500,skipLink:1600,toast:1700,tooltip:1800},mPe=gPe,yPe={none:0,"1px":"1px solid","2px":"2px solid","4px":"4px solid","8px":"8px solid"},vPe=yPe,bPe={base:"0em",sm:"30em",md:"48em",lg:"62em",xl:"80em","2xl":"96em"},_Pe=bPe,SPe={transparent:"transparent",current:"currentColor",black:"#000000",white:"#FFFFFF",whiteAlpha:{50:"rgba(255, 255, 255, 0.04)",100:"rgba(255, 255, 255, 0.06)",200:"rgba(255, 255, 255, 0.08)",300:"rgba(255, 255, 255, 0.16)",400:"rgba(255, 255, 255, 0.24)",500:"rgba(255, 255, 255, 0.36)",600:"rgba(255, 255, 255, 0.48)",700:"rgba(255, 255, 255, 0.64)",800:"rgba(255, 255, 255, 0.80)",900:"rgba(255, 255, 255, 0.92)"},blackAlpha:{50:"rgba(0, 0, 0, 0.04)",100:"rgba(0, 0, 0, 0.06)",200:"rgba(0, 0, 0, 0.08)",300:"rgba(0, 0, 0, 0.16)",400:"rgba(0, 0, 0, 0.24)",500:"rgba(0, 0, 0, 0.36)",600:"rgba(0, 0, 0, 0.48)",700:"rgba(0, 0, 0, 0.64)",800:"rgba(0, 0, 0, 0.80)",900:"rgba(0, 0, 0, 0.92)"},gray:{50:"#F7FAFC",100:"#EDF2F7",200:"#E2E8F0",300:"#CBD5E0",400:"#A0AEC0",500:"#718096",600:"#4A5568",700:"#2D3748",800:"#1A202C",900:"#171923"},red:{50:"#FFF5F5",100:"#FED7D7",200:"#FEB2B2",300:"#FC8181",400:"#F56565",500:"#E53E3E",600:"#C53030",700:"#9B2C2C",800:"#822727",900:"#63171B"},orange:{50:"#FFFAF0",100:"#FEEBC8",200:"#FBD38D",300:"#F6AD55",400:"#ED8936",500:"#DD6B20",600:"#C05621",700:"#9C4221",800:"#7B341E",900:"#652B19"},yellow:{50:"#FFFFF0",100:"#FEFCBF",200:"#FAF089",300:"#F6E05E",400:"#ECC94B",500:"#D69E2E",600:"#B7791F",700:"#975A16",800:"#744210",900:"#5F370E"},green:{50:"#F0FFF4",100:"#C6F6D5",200:"#9AE6B4",300:"#68D391",400:"#48BB78",500:"#38A169",600:"#2F855A",700:"#276749",800:"#22543D",900:"#1C4532"},teal:{50:"#E6FFFA",100:"#B2F5EA",200:"#81E6D9",300:"#4FD1C5",400:"#38B2AC",500:"#319795",600:"#2C7A7B",700:"#285E61",800:"#234E52",900:"#1D4044"},blue:{50:"#ebf8ff",100:"#bee3f8",200:"#90cdf4",300:"#63b3ed",400:"#4299e1",500:"#3182ce",600:"#2b6cb0",700:"#2c5282",800:"#2a4365",900:"#1A365D"},cyan:{50:"#EDFDFD",100:"#C4F1F9",200:"#9DECF9",300:"#76E4F7",400:"#0BC5EA",500:"#00B5D8",600:"#00A3C4",700:"#0987A0",800:"#086F83",900:"#065666"},purple:{50:"#FAF5FF",100:"#E9D8FD",200:"#D6BCFA",300:"#B794F4",400:"#9F7AEA",500:"#805AD5",600:"#6B46C1",700:"#553C9A",800:"#44337A",900:"#322659"},pink:{50:"#FFF5F7",100:"#FED7E2",200:"#FBB6CE",300:"#F687B3",400:"#ED64A6",500:"#D53F8C",600:"#B83280",700:"#97266D",800:"#702459",900:"#521B41"},linkedin:{50:"#E8F4F9",100:"#CFEDFB",200:"#9BDAF3",300:"#68C7EC",400:"#34B3E4",500:"#00A0DC",600:"#008CC9",700:"#0077B5",800:"#005E93",900:"#004471"},facebook:{50:"#E8F4F9",100:"#D9DEE9",200:"#B7C2DA",300:"#6482C0",400:"#4267B2",500:"#385898",600:"#314E89",700:"#29487D",800:"#223B67",900:"#1E355B"},messenger:{50:"#D0E6FF",100:"#B9DAFF",200:"#A2CDFF",300:"#7AB8FF",400:"#2E90FF",500:"#0078FF",600:"#0063D1",700:"#0052AC",800:"#003C7E",900:"#002C5C"},whatsapp:{50:"#dffeec",100:"#b9f5d0",200:"#90edb3",300:"#65e495",400:"#3cdd78",500:"#22c35e",600:"#179848",700:"#0c6c33",800:"#01421c",900:"#001803"},twitter:{50:"#E5F4FD",100:"#C8E9FB",200:"#A8DCFA",300:"#83CDF7",400:"#57BBF5",500:"#1DA1F2",600:"#1A94DA",700:"#1681BF",800:"#136B9E",900:"#0D4D71"},telegram:{50:"#E3F2F9",100:"#C5E4F3",200:"#A2D4EC",300:"#7AC1E4",400:"#47A9DA",500:"#0088CC",600:"#007AB8",700:"#006BA1",800:"#005885",900:"#003F5E"}},xPe=SPe,wPe={none:"0",sm:"0.125rem",base:"0.25rem",md:"0.375rem",lg:"0.5rem",xl:"0.75rem","2xl":"1rem","3xl":"1.5rem",full:"9999px"},CPe=wPe,EPe={xs:"0 0 0 1px rgba(0, 0, 0, 0.05)",sm:"0 1px 2px 0 rgba(0, 0, 0, 0.05)",base:"0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06)",md:"0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)",lg:"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)",xl:"0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04)","2xl":"0 25px 50px -12px rgba(0, 0, 0, 0.25)",outline:"0 0 0 3px rgba(66, 153, 225, 0.6)",inner:"inset 0 2px 4px 0 rgba(0,0,0,0.06)",none:"none","dark-lg":"rgba(0, 0, 0, 0.1) 0px 0px 0px 1px, rgba(0, 0, 0, 0.2) 0px 5px 10px, rgba(0, 0, 0, 0.4) 0px 15px 40px"},kPe=EPe,TPe={none:0,sm:"4px",base:"8px",md:"12px",lg:"16px",xl:"24px","2xl":"40px","3xl":"64px"},APe=TPe,PPe={letterSpacings:{tighter:"-0.05em",tight:"-0.025em",normal:"0",wide:"0.025em",wider:"0.05em",widest:"0.1em"},lineHeights:{normal:"normal",none:1,shorter:1.25,short:1.375,base:1.5,tall:1.625,taller:"2",3:".75rem",4:"1rem",5:"1.25rem",6:"1.5rem",7:"1.75rem",8:"2rem",9:"2.25rem",10:"2.5rem"},fontWeights:{hairline:100,thin:200,light:300,normal:400,medium:500,semibold:600,bold:700,extrabold:800,black:900},fonts:{heading:'-apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"',body:'-apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"',mono:'SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace'},fontSizes:{"3xs":"0.45rem","2xs":"0.625rem",xs:"0.75rem",sm:"0.875rem",md:"1rem",lg:"1.125rem",xl:"1.25rem","2xl":"1.5rem","3xl":"1.875rem","4xl":"2.25rem","5xl":"3rem","6xl":"3.75rem","7xl":"4.5rem","8xl":"6rem","9xl":"8rem"}},DH=PPe,LH={px:"1px",.5:"0.125rem",1:"0.25rem",1.5:"0.375rem",2:"0.5rem",2.5:"0.625rem",3:"0.75rem",3.5:"0.875rem",4:"1rem",5:"1.25rem",6:"1.5rem",7:"1.75rem",8:"2rem",9:"2.25rem",10:"2.5rem",12:"3rem",14:"3.5rem",16:"4rem",20:"5rem",24:"6rem",28:"7rem",32:"8rem",36:"9rem",40:"10rem",44:"11rem",48:"12rem",52:"13rem",56:"14rem",60:"15rem",64:"16rem",72:"18rem",80:"20rem",96:"24rem"},IPe={max:"max-content",min:"min-content",full:"100%","3xs":"14rem","2xs":"16rem",xs:"20rem",sm:"24rem",md:"28rem",lg:"32rem",xl:"36rem","2xl":"42rem","3xl":"48rem","4xl":"56rem","5xl":"64rem","6xl":"72rem","7xl":"80rem","8xl":"90rem",prose:"60ch"},RPe={sm:"640px",md:"768px",lg:"1024px",xl:"1280px"},OPe={...LH,...IPe,container:RPe},FH=OPe,MPe={breakpoints:_Pe,zIndices:mPe,radii:CPe,blur:APe,colors:xPe,...DH,sizes:FH,shadows:kPe,space:LH,borders:vPe,transition:pPe},{defineMultiStyleConfig:NPe,definePartsStyle:Eg}=Pt(["stepper","step","title","description","indicator","separator","icon","number"]),El=nt("stepper-indicator-size"),jf=nt("stepper-icon-size"),Uf=nt("stepper-title-font-size"),kg=nt("stepper-description-font-size"),ig=nt("stepper-accent-color"),$Pe=Eg(({colorScheme:e})=>({stepper:{display:"flex",justifyContent:"space-between",gap:"4","&[data-orientation=vertical]":{flexDirection:"column",alignItems:"flex-start"},"&[data-orientation=horizontal]":{flexDirection:"row",alignItems:"center"},[ig.variable]:`colors.${e}.500`,_dark:{[ig.variable]:`colors.${e}.200`}},title:{fontSize:Uf.reference,fontWeight:"medium"},description:{fontSize:kg.reference,color:"chakra-subtle-text"},number:{fontSize:Uf.reference},step:{flexShrink:0,position:"relative",display:"flex",gap:"2","&[data-orientation=horizontal]":{alignItems:"center"},flex:"1","&:last-of-type:not([data-stretch])":{flex:"initial"}},icon:{flexShrink:0,width:jf.reference,height:jf.reference},indicator:{flexShrink:0,borderRadius:"full",width:El.reference,height:El.reference,display:"flex",justifyContent:"center",alignItems:"center","&[data-status=active]":{borderWidth:"2px",borderColor:ig.reference},"&[data-status=complete]":{bg:ig.reference,color:"chakra-inverse-text"},"&[data-status=incomplete]":{borderWidth:"2px"}},separator:{bg:"chakra-border-color",flex:"1","&[data-status=complete]":{bg:ig.reference},"&[data-orientation=horizontal]":{width:"100%",height:"2px",marginStart:"2"},"&[data-orientation=vertical]":{width:"2px",position:"absolute",height:"100%",maxHeight:`calc(100% - ${El.reference} - 8px)`,top:`calc(${El.reference} + 4px)`,insetStart:`calc(${El.reference} / 2 - 1px)`}}})),DPe=NPe({baseStyle:$Pe,sizes:{xs:Eg({stepper:{[El.variable]:"sizes.4",[jf.variable]:"sizes.3",[Uf.variable]:"fontSizes.xs",[kg.variable]:"fontSizes.xs"}}),sm:Eg({stepper:{[El.variable]:"sizes.6",[jf.variable]:"sizes.4",[Uf.variable]:"fontSizes.sm",[kg.variable]:"fontSizes.xs"}}),md:Eg({stepper:{[El.variable]:"sizes.8",[jf.variable]:"sizes.5",[Uf.variable]:"fontSizes.md",[kg.variable]:"fontSizes.sm"}}),lg:Eg({stepper:{[El.variable]:"sizes.10",[jf.variable]:"sizes.6",[Uf.variable]:"fontSizes.lg",[kg.variable]:"fontSizes.md"}})},defaultProps:{size:"md",colorScheme:"blue"}});function pn(e,t={}){let n=!1;function r(){if(!n){n=!0;return}throw new Error("[anatomy] .part(...) should only be called once. Did you mean to use .extend(...) ?")}function i(...c){r();for(const d of c)t[d]=l(d);return pn(e,t)}function o(...c){for(const d of c)d in t||(t[d]=l(d));return pn(e,t)}function a(){return Object.fromEntries(Object.entries(t).map(([d,f])=>[d,f.selector]))}function s(){return Object.fromEntries(Object.entries(t).map(([d,f])=>[d,f.className]))}function l(c){const h=`chakra-${(["container","root"].includes(c??"")?[e]:[e,c]).filter(Boolean).join("__")}`;return{className:h,selector:`.${h}`,toString:()=>c}}return{parts:i,toPart:l,extend:o,selectors:a,classnames:s,get keys(){return Object.keys(t)},__type:{}}}var BH=pn("accordion").parts("root","container","button","panel").extend("icon"),LPe=pn("alert").parts("title","description","container").extend("icon","spinner"),FPe=pn("avatar").parts("label","badge","container").extend("excessLabel","group"),BPe=pn("breadcrumb").parts("link","item","container").extend("separator");pn("button").parts();var zH=pn("checkbox").parts("control","icon","container").extend("label");pn("progress").parts("track","filledTrack").extend("label");var zPe=pn("drawer").parts("overlay","dialogContainer","dialog").extend("header","closeButton","body","footer"),jH=pn("editable").parts("preview","input","textarea"),jPe=pn("form").parts("container","requiredIndicator","helperText"),UPe=pn("formError").parts("text","icon"),UH=pn("input").parts("addon","field","element","group"),VPe=pn("list").parts("container","item","icon"),VH=pn("menu").parts("button","list","item").extend("groupTitle","icon","command","divider"),GH=pn("modal").parts("overlay","dialogContainer","dialog").extend("header","closeButton","body","footer"),HH=pn("numberinput").parts("root","field","stepperGroup","stepper");pn("pininput").parts("field");var qH=pn("popover").parts("content","header","body","footer").extend("popper","arrow","closeButton"),WH=pn("progress").parts("label","filledTrack","track"),GPe=pn("radio").parts("container","control","label"),KH=pn("select").parts("field","icon"),QH=pn("slider").parts("container","track","thumb","filledTrack","mark"),HPe=pn("stat").parts("container","label","helpText","number","icon"),XH=pn("switch").parts("container","track","thumb"),qPe=pn("table").parts("table","thead","tbody","tr","th","td","tfoot","caption"),YH=pn("tabs").parts("root","tab","tablist","tabpanel","tabpanels","indicator"),WPe=pn("tag").parts("container","label","closeButton"),KPe=pn("card").parts("container","header","body","footer");function ad(e,t,n){return Math.min(Math.max(e,n),t)}class QPe extends Error{constructor(t){super(`Failed to parse color: "${t}"`)}}var Tg=QPe;function WA(e){if(typeof e!="string")throw new Tg(e);if(e.trim().toLowerCase()==="transparent")return[0,0,0,0];let t=e.trim();t=r6e.test(e)?ZPe(e):e;const n=JPe.exec(t);if(n){const a=Array.from(n).slice(1);return[...a.slice(0,3).map(s=>parseInt(E0(s,2),16)),parseInt(E0(a[3]||"f",2),16)/255]}const r=e6e.exec(t);if(r){const a=Array.from(r).slice(1);return[...a.slice(0,3).map(s=>parseInt(s,16)),parseInt(a[3]||"ff",16)/255]}const i=t6e.exec(t);if(i){const a=Array.from(i).slice(1);return[...a.slice(0,3).map(s=>parseInt(s,10)),parseFloat(a[3]||"1")]}const o=n6e.exec(t);if(o){const[a,s,l,u]=Array.from(o).slice(1).map(parseFloat);if(ad(0,100,s)!==s)throw new Tg(e);if(ad(0,100,l)!==l)throw new Tg(e);return[...i6e(a,s,l),Number.isNaN(u)?1:u]}throw new Tg(e)}function XPe(e){let t=5381,n=e.length;for(;n;)t=t*33^e.charCodeAt(--n);return(t>>>0)%2341}const fM=e=>parseInt(e.replace(/_/g,""),36),YPe="1q29ehhb 1n09sgk7 1kl1ekf_ _yl4zsno 16z9eiv3 1p29lhp8 _bd9zg04 17u0____ _iw9zhe5 _to73___ _r45e31e _7l6g016 _jh8ouiv _zn3qba8 1jy4zshs 11u87k0u 1ro9yvyo 1aj3xael 1gz9zjz0 _3w8l4xo 1bf1ekf_ _ke3v___ _4rrkb__ 13j776yz _646mbhl _nrjr4__ _le6mbhl 1n37ehkb _m75f91n _qj3bzfz 1939yygw 11i5z6x8 _1k5f8xs 1509441m 15t5lwgf _ae2th1n _tg1ugcv 1lp1ugcv 16e14up_ _h55rw7n _ny9yavn _7a11xb_ 1ih442g9 _pv442g9 1mv16xof 14e6y7tu 1oo9zkds 17d1cisi _4v9y70f _y98m8kc 1019pq0v 12o9zda8 _348j4f4 1et50i2o _8epa8__ _ts6senj 1o350i2o 1mi9eiuo 1259yrp0 1ln80gnw _632xcoy 1cn9zldc _f29edu4 1n490c8q _9f9ziet 1b94vk74 _m49zkct 1kz6s73a 1eu9dtog _q58s1rz 1dy9sjiq __u89jo3 _aj5nkwg _ld89jo3 13h9z6wx _qa9z2ii _l119xgq _bs5arju 1hj4nwk9 1qt4nwk9 1ge6wau6 14j9zlcw 11p1edc_ _ms1zcxe _439shk6 _jt9y70f _754zsow 1la40eju _oq5p___ _x279qkz 1fa5r3rv _yd2d9ip _424tcku _8y1di2_ _zi2uabw _yy7rn9h 12yz980_ __39ljp6 1b59zg0x _n39zfzp 1fy9zest _b33k___ _hp9wq92 1il50hz4 _io472ub _lj9z3eo 19z9ykg0 _8t8iu3a 12b9bl4a 1ak5yw0o _896v4ku _tb8k8lv _s59zi6t _c09ze0p 1lg80oqn 1id9z8wb _238nba5 1kq6wgdi _154zssg _tn3zk49 _da9y6tc 1sg7cv4f _r12jvtt 1gq5fmkz 1cs9rvci _lp9jn1c _xw1tdnb 13f9zje6 16f6973h _vo7ir40 _bt5arjf _rc45e4t _hr4e100 10v4e100 _hc9zke2 _w91egv_ _sj2r1kk 13c87yx8 _vqpds__ _ni8ggk8 _tj9yqfb 1ia2j4r4 _7x9b10u 1fc9ld4j 1eq9zldr _5j9lhpx _ez9zl6o _md61fzm".split(" ").reduce((e,t)=>{const n=fM(t.substring(0,3)),r=fM(t.substring(3)).toString(16);let i="";for(let o=0;o<6-r.length;o++)i+="0";return e[n]=`${i}${r}`,e},{});function ZPe(e){const t=e.toLowerCase().trim(),n=YPe[XPe(t)];if(!n)throw new Tg(e);return`#${n}`}const E0=(e,t)=>Array.from(Array(t)).map(()=>e).join(""),JPe=new RegExp(`^#${E0("([a-f0-9])",3)}([a-f0-9])?$`,"i"),e6e=new RegExp(`^#${E0("([a-f0-9]{2})",3)}([a-f0-9]{2})?$`,"i"),t6e=new RegExp(`^rgba?\\(\\s*(\\d+)\\s*${E0(",\\s*(\\d+)\\s*",2)}(?:,\\s*([\\d.]+))?\\s*\\)$`,"i"),n6e=/^hsla?\(\s*([\d.]+)\s*,\s*([\d.]+)%\s*,\s*([\d.]+)%(?:\s*,\s*([\d.]+))?\s*\)$/i,r6e=/^[a-z]+$/i,hM=e=>Math.round(e*255),i6e=(e,t,n)=>{let r=n/100;if(t===0)return[r,r,r].map(hM);const i=(e%360+360)%360/60,o=(1-Math.abs(2*r-1))*(t/100),a=o*(1-Math.abs(i%2-1));let s=0,l=0,u=0;i>=0&&i<1?(s=o,l=a):i>=1&&i<2?(s=a,l=o):i>=2&&i<3?(l=o,u=a):i>=3&&i<4?(l=a,u=o):i>=4&&i<5?(s=a,u=o):i>=5&&i<6&&(s=o,u=a);const c=r-o/2,d=s+c,f=l+c,h=u+c;return[d,f,h].map(hM)};function o6e(e,t,n,r){return`rgba(${ad(0,255,e).toFixed()}, ${ad(0,255,t).toFixed()}, ${ad(0,255,n).toFixed()}, ${parseFloat(ad(0,1,r).toFixed(3))})`}function a6e(e,t){const[n,r,i,o]=WA(e);return o6e(n,r,i,o-t)}function s6e(e){const[t,n,r,i]=WA(e);let o=a=>{const s=ad(0,255,a).toString(16);return s.length===1?`0${s}`:s};return`#${o(t)}${o(n)}${o(r)}${i<1?o(Math.round(i*255)):""}`}function l6e(e,t,n,r,i){for(t=t.split?t.split("."):t,r=0;rObject.keys(e).length===0,to=(e,t,n)=>{const r=l6e(e,`colors.${t}`,t);try{return s6e(r),r}catch{return n??"#000000"}},c6e=e=>{const[t,n,r]=WA(e);return(t*299+n*587+r*114)/1e3},d6e=e=>t=>{const n=to(t,e);return c6e(n)<128?"dark":"light"},f6e=e=>t=>d6e(e)(t)==="dark",ap=(e,t)=>n=>{const r=to(n,e);return a6e(r,1-t)};function pM(e="1rem",t="rgba(255, 255, 255, 0.15)"){return{backgroundImage:`linear-gradient( 45deg, ${t} 25%, transparent 25%, @@ -121,12 +121,12 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho ${t} 75%, transparent 75%, transparent - )`,backgroundSize:`${e} ${e}`}}var p6e=()=>`#${Math.floor(Math.random()*16777215).toString(16).padEnd(6,"0")}`;function g6e(e){const t=p6e();return!e||c6e(e)?t:e.string&&e.colors?y6e(e.string,e.colors):e.string&&!e.colors?m6e(e.string):e.colors&&!e.string?v6e(e.colors):t}function m6e(e){let t=0;if(e.length===0)return t.toString();for(let r=0;r>r*8&255;n+=`00${i.toString(16)}`.substr(-2)}return n}function y6e(e,t){let n=0;if(e.length===0)return t[0];for(let r=0;rn.colorMode==="dark"?t:e}function QA(e){const{orientation:t,vertical:n,horizontal:r}=e;return t?t==="vertical"?n:r:{}}function eq(e){return Hs(e)&&e.reference?e.reference:String(e)}var iw=(e,...t)=>t.map(eq).join(` ${e} `).replace(/calc/g,""),mM=(...e)=>`calc(${iw("+",...e)})`,yM=(...e)=>`calc(${iw("-",...e)})`,h4=(...e)=>`calc(${iw("*",...e)})`,vM=(...e)=>`calc(${iw("/",...e)})`,bM=e=>{const t=eq(e);return t!=null&&!Number.isNaN(parseFloat(t))?String(t).startsWith("-")?String(t).slice(1):`-${t}`:h4(t,-1)},Tl=Object.assign(e=>({add:(...t)=>Tl(mM(e,...t)),subtract:(...t)=>Tl(yM(e,...t)),multiply:(...t)=>Tl(h4(e,...t)),divide:(...t)=>Tl(vM(e,...t)),negate:()=>Tl(bM(e)),toString:()=>e.toString()}),{add:mM,subtract:yM,multiply:h4,divide:vM,negate:bM});function b6e(e){return!Number.isInteger(parseFloat(e.toString()))}function _6e(e,t="-"){return e.replace(/\s+/g,t)}function tq(e){const t=_6e(e.toString());return t.includes("\\.")?e:b6e(e)?t.replace(".","\\."):e}function S6e(e,t=""){return[t,tq(e)].filter(Boolean).join("-")}function x6e(e,t){return`var(${tq(e)}${t?`, ${t}`:""})`}function w6e(e,t=""){return`--${S6e(e,t)}`}function fr(e,t){const n=w6e(e,t==null?void 0:t.prefix);return{variable:n,reference:x6e(n,C6e(t==null?void 0:t.fallback))}}function C6e(e){return typeof e=="string"?e:e==null?void 0:e.reference}var{defineMultiStyleConfig:E6e,definePartsStyle:Q1}=Pt(ZH.keys),Xg=fr("switch-track-width"),yd=fr("switch-track-height"),a5=fr("switch-track-diff"),k6e=Tl.subtract(Xg,yd),p4=fr("switch-thumb-x"),ag=fr("switch-bg"),T6e=e=>{const{colorScheme:t}=e;return{borderRadius:"full",p:"0.5",width:[Xg.reference],height:[yd.reference],transitionProperty:"common",transitionDuration:"fast",[ag.variable]:"colors.gray.300",_dark:{[ag.variable]:"colors.whiteAlpha.400"},_focusVisible:{boxShadow:"outline"},_disabled:{opacity:.4,cursor:"not-allowed"},_checked:{[ag.variable]:`colors.${t}.500`,_dark:{[ag.variable]:`colors.${t}.200`}},bg:ag.reference}},A6e={bg:"white",transitionProperty:"transform",transitionDuration:"normal",borderRadius:"inherit",width:[yd.reference],height:[yd.reference],_checked:{transform:`translateX(${p4.reference})`}},P6e=Q1(e=>({container:{[a5.variable]:k6e,[p4.variable]:a5.reference,_rtl:{[p4.variable]:Tl(a5).negate().toString()}},track:T6e(e),thumb:A6e})),I6e={sm:Q1({container:{[Xg.variable]:"1.375rem",[yd.variable]:"sizes.3"}}),md:Q1({container:{[Xg.variable]:"1.875rem",[yd.variable]:"sizes.4"}}),lg:Q1({container:{[Xg.variable]:"2.875rem",[yd.variable]:"sizes.6"}})},R6e=E6e({baseStyle:P6e,sizes:I6e,defaultProps:{size:"md",colorScheme:"blue"}}),{defineMultiStyleConfig:O6e,definePartsStyle:xh}=Pt(WPe.keys),M6e=xh({table:{fontVariantNumeric:"lining-nums tabular-nums",borderCollapse:"collapse",width:"full"},th:{fontFamily:"heading",fontWeight:"bold",textTransform:"uppercase",letterSpacing:"wider",textAlign:"start"},td:{textAlign:"start"},caption:{mt:4,fontFamily:"heading",textAlign:"center",fontWeight:"medium"}}),H_={"&[data-is-numeric=true]":{textAlign:"end"}},N6e=xh(e=>{const{colorScheme:t}=e;return{th:{color:K("gray.600","gray.400")(e),borderBottom:"1px",borderColor:K(`${t}.100`,`${t}.700`)(e),...H_},td:{borderBottom:"1px",borderColor:K(`${t}.100`,`${t}.700`)(e),...H_},caption:{color:K("gray.600","gray.100")(e)},tfoot:{tr:{"&:last-of-type":{th:{borderBottomWidth:0}}}}}}),$6e=xh(e=>{const{colorScheme:t}=e;return{th:{color:K("gray.600","gray.400")(e),borderBottom:"1px",borderColor:K(`${t}.100`,`${t}.700`)(e),...H_},td:{borderBottom:"1px",borderColor:K(`${t}.100`,`${t}.700`)(e),...H_},caption:{color:K("gray.600","gray.100")(e)},tbody:{tr:{"&:nth-of-type(odd)":{"th, td":{borderBottomWidth:"1px",borderColor:K(`${t}.100`,`${t}.700`)(e)},td:{background:K(`${t}.100`,`${t}.700`)(e)}}}},tfoot:{tr:{"&:last-of-type":{th:{borderBottomWidth:0}}}}}}),D6e={simple:N6e,striped:$6e,unstyled:{}},L6e={sm:xh({th:{px:"4",py:"1",lineHeight:"4",fontSize:"xs"},td:{px:"4",py:"2",fontSize:"sm",lineHeight:"4"},caption:{px:"4",py:"2",fontSize:"xs"}}),md:xh({th:{px:"6",py:"3",lineHeight:"4",fontSize:"xs"},td:{px:"6",py:"4",lineHeight:"5"},caption:{px:"6",py:"2",fontSize:"sm"}}),lg:xh({th:{px:"8",py:"4",lineHeight:"5",fontSize:"sm"},td:{px:"8",py:"5",lineHeight:"6"},caption:{px:"6",py:"2",fontSize:"md"}})},F6e=O6e({baseStyle:M6e,variants:D6e,sizes:L6e,defaultProps:{variant:"simple",size:"md",colorScheme:"gray"}}),_o=nt("tabs-color"),Xa=nt("tabs-bg"),Qv=nt("tabs-border-color"),{defineMultiStyleConfig:B6e,definePartsStyle:qs}=Pt(JH.keys),z6e=e=>{const{orientation:t}=e;return{display:t==="vertical"?"flex":"block"}},j6e=e=>{const{isFitted:t}=e;return{flex:t?1:void 0,transitionProperty:"common",transitionDuration:"normal",_focusVisible:{zIndex:1,boxShadow:"outline"},_disabled:{cursor:"not-allowed",opacity:.4}}},U6e=e=>{const{align:t="start",orientation:n}=e;return{justifyContent:{end:"flex-end",center:"center",start:"flex-start"}[t],flexDirection:n==="vertical"?"column":"row"}},V6e={p:4},G6e=qs(e=>({root:z6e(e),tab:j6e(e),tablist:U6e(e),tabpanel:V6e})),H6e={sm:qs({tab:{py:1,px:4,fontSize:"sm"}}),md:qs({tab:{fontSize:"md",py:2,px:4}}),lg:qs({tab:{fontSize:"lg",py:3,px:4}})},q6e=qs(e=>{const{colorScheme:t,orientation:n}=e,r=n==="vertical",i=r?"borderStart":"borderBottom",o=r?"marginStart":"marginBottom";return{tablist:{[i]:"2px solid",borderColor:"inherit"},tab:{[i]:"2px solid",borderColor:"transparent",[o]:"-2px",_selected:{[_o.variable]:`colors.${t}.600`,_dark:{[_o.variable]:`colors.${t}.300`},borderColor:"currentColor"},_active:{[Xa.variable]:"colors.gray.200",_dark:{[Xa.variable]:"colors.whiteAlpha.300"}},_disabled:{_active:{bg:"none"}},color:_o.reference,bg:Xa.reference}}}),W6e=qs(e=>{const{colorScheme:t}=e;return{tab:{borderTopRadius:"md",border:"1px solid",borderColor:"transparent",mb:"-1px",[Qv.variable]:"transparent",_selected:{[_o.variable]:`colors.${t}.600`,[Qv.variable]:"colors.white",_dark:{[_o.variable]:`colors.${t}.300`,[Qv.variable]:"colors.gray.800"},borderColor:"inherit",borderBottomColor:Qv.reference},color:_o.reference},tablist:{mb:"-1px",borderBottom:"1px solid",borderColor:"inherit"}}}),K6e=qs(e=>{const{colorScheme:t}=e;return{tab:{border:"1px solid",borderColor:"inherit",[Xa.variable]:"colors.gray.50",_dark:{[Xa.variable]:"colors.whiteAlpha.50"},mb:"-1px",_notLast:{marginEnd:"-1px"},_selected:{[Xa.variable]:"colors.white",[_o.variable]:`colors.${t}.600`,_dark:{[Xa.variable]:"colors.gray.800",[_o.variable]:`colors.${t}.300`},borderColor:"inherit",borderTopColor:"currentColor",borderBottomColor:"transparent"},color:_o.reference,bg:Xa.reference},tablist:{mb:"-1px",borderBottom:"1px solid",borderColor:"inherit"}}}),Q6e=qs(e=>{const{colorScheme:t,theme:n}=e;return{tab:{borderRadius:"full",fontWeight:"semibold",color:"gray.600",_selected:{color:to(n,`${t}.700`),bg:to(n,`${t}.100`)}}}}),X6e=qs(e=>{const{colorScheme:t}=e;return{tab:{borderRadius:"full",fontWeight:"semibold",[_o.variable]:"colors.gray.600",_dark:{[_o.variable]:"inherit"},_selected:{[_o.variable]:"colors.white",[Xa.variable]:`colors.${t}.600`,_dark:{[_o.variable]:"colors.gray.800",[Xa.variable]:`colors.${t}.300`}},color:_o.reference,bg:Xa.reference}}}),Y6e=qs({}),Z6e={line:q6e,enclosed:W6e,"enclosed-colored":K6e,"soft-rounded":Q6e,"solid-rounded":X6e,unstyled:Y6e},J6e=B6e({baseStyle:G6e,sizes:H6e,variants:Z6e,defaultProps:{size:"md",variant:"line",colorScheme:"blue"}}),Er=$Ae("badge",["bg","color","shadow"]),e8e={px:1,textTransform:"uppercase",fontSize:"xs",borderRadius:"sm",fontWeight:"bold",bg:Er.bg.reference,color:Er.color.reference,boxShadow:Er.shadow.reference},t8e=e=>{const{colorScheme:t,theme:n}=e,r=sp(`${t}.500`,.6)(n);return{[Er.bg.variable]:`colors.${t}.500`,[Er.color.variable]:"colors.white",_dark:{[Er.bg.variable]:r,[Er.color.variable]:"colors.whiteAlpha.800"}}},n8e=e=>{const{colorScheme:t,theme:n}=e,r=sp(`${t}.200`,.16)(n);return{[Er.bg.variable]:`colors.${t}.100`,[Er.color.variable]:`colors.${t}.800`,_dark:{[Er.bg.variable]:r,[Er.color.variable]:`colors.${t}.200`}}},r8e=e=>{const{colorScheme:t,theme:n}=e,r=sp(`${t}.200`,.8)(n);return{[Er.color.variable]:`colors.${t}.500`,_dark:{[Er.color.variable]:r},[Er.shadow.variable]:`inset 0 0 0px 1px ${Er.color.reference}`}},i8e={solid:t8e,subtle:n8e,outline:r8e},Yg={baseStyle:e8e,variants:i8e,defaultProps:{variant:"subtle",colorScheme:"gray"}},{defineMultiStyleConfig:o8e,definePartsStyle:vd}=Pt(KPe.keys),_M=nt("tag-bg"),SM=nt("tag-color"),s5=nt("tag-shadow"),X1=nt("tag-min-height"),Y1=nt("tag-min-width"),Z1=nt("tag-font-size"),J1=nt("tag-padding-inline"),a8e={fontWeight:"medium",lineHeight:1.2,outline:0,[SM.variable]:Er.color.reference,[_M.variable]:Er.bg.reference,[s5.variable]:Er.shadow.reference,color:SM.reference,bg:_M.reference,boxShadow:s5.reference,borderRadius:"md",minH:X1.reference,minW:Y1.reference,fontSize:Z1.reference,px:J1.reference,_focusVisible:{[s5.variable]:"shadows.outline"}},s8e={lineHeight:1.2,overflow:"visible"},l8e={fontSize:"lg",w:"5",h:"5",transitionProperty:"common",transitionDuration:"normal",borderRadius:"full",marginStart:"1.5",marginEnd:"-1",opacity:.5,_disabled:{opacity:.4},_focusVisible:{boxShadow:"outline",bg:"rgba(0, 0, 0, 0.14)"},_hover:{opacity:.8},_active:{opacity:1}},u8e=vd({container:a8e,label:s8e,closeButton:l8e}),c8e={sm:vd({container:{[X1.variable]:"sizes.5",[Y1.variable]:"sizes.5",[Z1.variable]:"fontSizes.xs",[J1.variable]:"space.2"},closeButton:{marginEnd:"-2px",marginStart:"0.35rem"}}),md:vd({container:{[X1.variable]:"sizes.6",[Y1.variable]:"sizes.6",[Z1.variable]:"fontSizes.sm",[J1.variable]:"space.2"}}),lg:vd({container:{[X1.variable]:"sizes.8",[Y1.variable]:"sizes.8",[Z1.variable]:"fontSizes.md",[J1.variable]:"space.3"}})},d8e={subtle:vd(e=>{var t;return{container:(t=Yg.variants)==null?void 0:t.subtle(e)}}),solid:vd(e=>{var t;return{container:(t=Yg.variants)==null?void 0:t.solid(e)}}),outline:vd(e=>{var t;return{container:(t=Yg.variants)==null?void 0:t.outline(e)}})},f8e=o8e({variants:d8e,baseStyle:u8e,sizes:c8e,defaultProps:{size:"md",variant:"subtle",colorScheme:"gray"}}),{definePartsStyle:Rl,defineMultiStyleConfig:h8e}=Pt(GH.keys),Gf=nt("input-height"),Hf=nt("input-font-size"),qf=nt("input-padding"),Wf=nt("input-border-radius"),p8e=Rl({addon:{height:Gf.reference,fontSize:Hf.reference,px:qf.reference,borderRadius:Wf.reference},field:{width:"100%",height:Gf.reference,fontSize:Hf.reference,px:qf.reference,borderRadius:Wf.reference,minWidth:0,outline:0,position:"relative",appearance:"none",transitionProperty:"common",transitionDuration:"normal",_disabled:{opacity:.4,cursor:"not-allowed"}}}),du={lg:{[Hf.variable]:"fontSizes.lg",[qf.variable]:"space.4",[Wf.variable]:"radii.md",[Gf.variable]:"sizes.12"},md:{[Hf.variable]:"fontSizes.md",[qf.variable]:"space.4",[Wf.variable]:"radii.md",[Gf.variable]:"sizes.10"},sm:{[Hf.variable]:"fontSizes.sm",[qf.variable]:"space.3",[Wf.variable]:"radii.sm",[Gf.variable]:"sizes.8"},xs:{[Hf.variable]:"fontSizes.xs",[qf.variable]:"space.2",[Wf.variable]:"radii.sm",[Gf.variable]:"sizes.6"}},g8e={lg:Rl({field:du.lg,group:du.lg}),md:Rl({field:du.md,group:du.md}),sm:Rl({field:du.sm,group:du.sm}),xs:Rl({field:du.xs,group:du.xs})};function XA(e){const{focusBorderColor:t,errorBorderColor:n}=e;return{focusBorderColor:t||K("blue.500","blue.300")(e),errorBorderColor:n||K("red.500","red.300")(e)}}var m8e=Rl(e=>{const{theme:t}=e,{focusBorderColor:n,errorBorderColor:r}=XA(e);return{field:{border:"1px solid",borderColor:"inherit",bg:"inherit",_hover:{borderColor:K("gray.300","whiteAlpha.400")(e)},_readOnly:{boxShadow:"none !important",userSelect:"all"},_invalid:{borderColor:to(t,r),boxShadow:`0 0 0 1px ${to(t,r)}`},_focusVisible:{zIndex:1,borderColor:to(t,n),boxShadow:`0 0 0 1px ${to(t,n)}`}},addon:{border:"1px solid",borderColor:K("inherit","whiteAlpha.50")(e),bg:K("gray.100","whiteAlpha.300")(e)}}}),y8e=Rl(e=>{const{theme:t}=e,{focusBorderColor:n,errorBorderColor:r}=XA(e);return{field:{border:"2px solid",borderColor:"transparent",bg:K("gray.100","whiteAlpha.50")(e),_hover:{bg:K("gray.200","whiteAlpha.100")(e)},_readOnly:{boxShadow:"none !important",userSelect:"all"},_invalid:{borderColor:to(t,r)},_focusVisible:{bg:"transparent",borderColor:to(t,n)}},addon:{border:"2px solid",borderColor:"transparent",bg:K("gray.100","whiteAlpha.50")(e)}}}),v8e=Rl(e=>{const{theme:t}=e,{focusBorderColor:n,errorBorderColor:r}=XA(e);return{field:{borderBottom:"1px solid",borderColor:"inherit",borderRadius:"0",px:"0",bg:"transparent",_readOnly:{boxShadow:"none !important",userSelect:"all"},_invalid:{borderColor:to(t,r),boxShadow:`0px 1px 0px 0px ${to(t,r)}`},_focusVisible:{borderColor:to(t,n),boxShadow:`0px 1px 0px 0px ${to(t,n)}`}},addon:{borderBottom:"2px solid",borderColor:"inherit",borderRadius:"0",px:"0",bg:"transparent"}}}),b8e=Rl({field:{bg:"transparent",px:"0",height:"auto"},addon:{bg:"transparent",px:"0",height:"auto"}}),_8e={outline:m8e,filled:y8e,flushed:v8e,unstyled:b8e},un=h8e({baseStyle:p8e,sizes:g8e,variants:_8e,defaultProps:{size:"md",variant:"outline"}}),xM,S8e={...(xM=un.baseStyle)==null?void 0:xM.field,paddingY:"2",minHeight:"20",lineHeight:"short",verticalAlign:"top"},wM,CM,x8e={outline:e=>{var t,n;return(n=(t=un.variants)==null?void 0:t.outline(e).field)!=null?n:{}},flushed:e=>{var t,n;return(n=(t=un.variants)==null?void 0:t.flushed(e).field)!=null?n:{}},filled:e=>{var t,n;return(n=(t=un.variants)==null?void 0:t.filled(e).field)!=null?n:{}},unstyled:(CM=(wM=un.variants)==null?void 0:wM.unstyled.field)!=null?CM:{}},EM,kM,TM,AM,PM,IM,RM,OM,w8e={xs:(kM=(EM=un.sizes)==null?void 0:EM.xs.field)!=null?kM:{},sm:(AM=(TM=un.sizes)==null?void 0:TM.sm.field)!=null?AM:{},md:(IM=(PM=un.sizes)==null?void 0:PM.md.field)!=null?IM:{},lg:(OM=(RM=un.sizes)==null?void 0:RM.lg.field)!=null?OM:{}},C8e={baseStyle:S8e,sizes:w8e,variants:x8e,defaultProps:{size:"md",variant:"outline"}},Xv=fr("tooltip-bg"),l5=fr("tooltip-fg"),E8e=fr("popper-arrow-bg"),k8e={bg:Xv.reference,color:l5.reference,[Xv.variable]:"colors.gray.700",[l5.variable]:"colors.whiteAlpha.900",_dark:{[Xv.variable]:"colors.gray.300",[l5.variable]:"colors.gray.900"},[E8e.variable]:Xv.reference,px:"2",py:"0.5",borderRadius:"sm",fontWeight:"medium",fontSize:"sm",boxShadow:"md",maxW:"xs",zIndex:"tooltip"},T8e={baseStyle:k8e},{defineMultiStyleConfig:A8e,definePartsStyle:Pg}=Pt(QH.keys),P8e=e=>{const{colorScheme:t,theme:n,isIndeterminate:r,hasStripe:i}=e,o=K(gM(),gM("1rem","rgba(0,0,0,0.1)"))(e),a=K(`${t}.500`,`${t}.200`)(e),s=`linear-gradient( + )`,backgroundSize:`${e} ${e}`}}var h6e=()=>`#${Math.floor(Math.random()*16777215).toString(16).padEnd(6,"0")}`;function p6e(e){const t=h6e();return!e||u6e(e)?t:e.string&&e.colors?m6e(e.string,e.colors):e.string&&!e.colors?g6e(e.string):e.colors&&!e.string?y6e(e.colors):t}function g6e(e){let t=0;if(e.length===0)return t.toString();for(let r=0;r>r*8&255;n+=`00${i.toString(16)}`.substr(-2)}return n}function m6e(e,t){let n=0;if(e.length===0)return t[0];for(let r=0;rn.colorMode==="dark"?t:e}function KA(e){const{orientation:t,vertical:n,horizontal:r}=e;return t?t==="vertical"?n:r:{}}function ZH(e){return Hs(e)&&e.reference?e.reference:String(e)}var iw=(e,...t)=>t.map(ZH).join(` ${e} `).replace(/calc/g,""),gM=(...e)=>`calc(${iw("+",...e)})`,mM=(...e)=>`calc(${iw("-",...e)})`,f4=(...e)=>`calc(${iw("*",...e)})`,yM=(...e)=>`calc(${iw("/",...e)})`,vM=e=>{const t=ZH(e);return t!=null&&!Number.isNaN(parseFloat(t))?String(t).startsWith("-")?String(t).slice(1):`-${t}`:f4(t,-1)},kl=Object.assign(e=>({add:(...t)=>kl(gM(e,...t)),subtract:(...t)=>kl(mM(e,...t)),multiply:(...t)=>kl(f4(e,...t)),divide:(...t)=>kl(yM(e,...t)),negate:()=>kl(vM(e)),toString:()=>e.toString()}),{add:gM,subtract:mM,multiply:f4,divide:yM,negate:vM});function v6e(e){return!Number.isInteger(parseFloat(e.toString()))}function b6e(e,t="-"){return e.replace(/\s+/g,t)}function JH(e){const t=b6e(e.toString());return t.includes("\\.")?e:v6e(e)?t.replace(".","\\."):e}function _6e(e,t=""){return[t,JH(e)].filter(Boolean).join("-")}function S6e(e,t){return`var(${JH(e)}${t?`, ${t}`:""})`}function x6e(e,t=""){return`--${_6e(e,t)}`}function fr(e,t){const n=x6e(e,t==null?void 0:t.prefix);return{variable:n,reference:S6e(n,w6e(t==null?void 0:t.fallback))}}function w6e(e){return typeof e=="string"?e:e==null?void 0:e.reference}var{defineMultiStyleConfig:C6e,definePartsStyle:Q1}=Pt(XH.keys),Xg=fr("switch-track-width"),yd=fr("switch-track-height"),a5=fr("switch-track-diff"),E6e=kl.subtract(Xg,yd),h4=fr("switch-thumb-x"),og=fr("switch-bg"),k6e=e=>{const{colorScheme:t}=e;return{borderRadius:"full",p:"0.5",width:[Xg.reference],height:[yd.reference],transitionProperty:"common",transitionDuration:"fast",[og.variable]:"colors.gray.300",_dark:{[og.variable]:"colors.whiteAlpha.400"},_focusVisible:{boxShadow:"outline"},_disabled:{opacity:.4,cursor:"not-allowed"},_checked:{[og.variable]:`colors.${t}.500`,_dark:{[og.variable]:`colors.${t}.200`}},bg:og.reference}},T6e={bg:"white",transitionProperty:"transform",transitionDuration:"normal",borderRadius:"inherit",width:[yd.reference],height:[yd.reference],_checked:{transform:`translateX(${h4.reference})`}},A6e=Q1(e=>({container:{[a5.variable]:E6e,[h4.variable]:a5.reference,_rtl:{[h4.variable]:kl(a5).negate().toString()}},track:k6e(e),thumb:T6e})),P6e={sm:Q1({container:{[Xg.variable]:"1.375rem",[yd.variable]:"sizes.3"}}),md:Q1({container:{[Xg.variable]:"1.875rem",[yd.variable]:"sizes.4"}}),lg:Q1({container:{[Xg.variable]:"2.875rem",[yd.variable]:"sizes.6"}})},I6e=C6e({baseStyle:A6e,sizes:P6e,defaultProps:{size:"md",colorScheme:"blue"}}),{defineMultiStyleConfig:R6e,definePartsStyle:Sh}=Pt(qPe.keys),O6e=Sh({table:{fontVariantNumeric:"lining-nums tabular-nums",borderCollapse:"collapse",width:"full"},th:{fontFamily:"heading",fontWeight:"bold",textTransform:"uppercase",letterSpacing:"wider",textAlign:"start"},td:{textAlign:"start"},caption:{mt:4,fontFamily:"heading",textAlign:"center",fontWeight:"medium"}}),H_={"&[data-is-numeric=true]":{textAlign:"end"}},M6e=Sh(e=>{const{colorScheme:t}=e;return{th:{color:K("gray.600","gray.400")(e),borderBottom:"1px",borderColor:K(`${t}.100`,`${t}.700`)(e),...H_},td:{borderBottom:"1px",borderColor:K(`${t}.100`,`${t}.700`)(e),...H_},caption:{color:K("gray.600","gray.100")(e)},tfoot:{tr:{"&:last-of-type":{th:{borderBottomWidth:0}}}}}}),N6e=Sh(e=>{const{colorScheme:t}=e;return{th:{color:K("gray.600","gray.400")(e),borderBottom:"1px",borderColor:K(`${t}.100`,`${t}.700`)(e),...H_},td:{borderBottom:"1px",borderColor:K(`${t}.100`,`${t}.700`)(e),...H_},caption:{color:K("gray.600","gray.100")(e)},tbody:{tr:{"&:nth-of-type(odd)":{"th, td":{borderBottomWidth:"1px",borderColor:K(`${t}.100`,`${t}.700`)(e)},td:{background:K(`${t}.100`,`${t}.700`)(e)}}}},tfoot:{tr:{"&:last-of-type":{th:{borderBottomWidth:0}}}}}}),$6e={simple:M6e,striped:N6e,unstyled:{}},D6e={sm:Sh({th:{px:"4",py:"1",lineHeight:"4",fontSize:"xs"},td:{px:"4",py:"2",fontSize:"sm",lineHeight:"4"},caption:{px:"4",py:"2",fontSize:"xs"}}),md:Sh({th:{px:"6",py:"3",lineHeight:"4",fontSize:"xs"},td:{px:"6",py:"4",lineHeight:"5"},caption:{px:"6",py:"2",fontSize:"sm"}}),lg:Sh({th:{px:"8",py:"4",lineHeight:"5",fontSize:"sm"},td:{px:"8",py:"5",lineHeight:"6"},caption:{px:"6",py:"2",fontSize:"md"}})},L6e=R6e({baseStyle:O6e,variants:$6e,sizes:D6e,defaultProps:{variant:"simple",size:"md",colorScheme:"gray"}}),_o=nt("tabs-color"),Xa=nt("tabs-bg"),Qv=nt("tabs-border-color"),{defineMultiStyleConfig:F6e,definePartsStyle:qs}=Pt(YH.keys),B6e=e=>{const{orientation:t}=e;return{display:t==="vertical"?"flex":"block"}},z6e=e=>{const{isFitted:t}=e;return{flex:t?1:void 0,transitionProperty:"common",transitionDuration:"normal",_focusVisible:{zIndex:1,boxShadow:"outline"},_disabled:{cursor:"not-allowed",opacity:.4}}},j6e=e=>{const{align:t="start",orientation:n}=e;return{justifyContent:{end:"flex-end",center:"center",start:"flex-start"}[t],flexDirection:n==="vertical"?"column":"row"}},U6e={p:4},V6e=qs(e=>({root:B6e(e),tab:z6e(e),tablist:j6e(e),tabpanel:U6e})),G6e={sm:qs({tab:{py:1,px:4,fontSize:"sm"}}),md:qs({tab:{fontSize:"md",py:2,px:4}}),lg:qs({tab:{fontSize:"lg",py:3,px:4}})},H6e=qs(e=>{const{colorScheme:t,orientation:n}=e,r=n==="vertical",i=r?"borderStart":"borderBottom",o=r?"marginStart":"marginBottom";return{tablist:{[i]:"2px solid",borderColor:"inherit"},tab:{[i]:"2px solid",borderColor:"transparent",[o]:"-2px",_selected:{[_o.variable]:`colors.${t}.600`,_dark:{[_o.variable]:`colors.${t}.300`},borderColor:"currentColor"},_active:{[Xa.variable]:"colors.gray.200",_dark:{[Xa.variable]:"colors.whiteAlpha.300"}},_disabled:{_active:{bg:"none"}},color:_o.reference,bg:Xa.reference}}}),q6e=qs(e=>{const{colorScheme:t}=e;return{tab:{borderTopRadius:"md",border:"1px solid",borderColor:"transparent",mb:"-1px",[Qv.variable]:"transparent",_selected:{[_o.variable]:`colors.${t}.600`,[Qv.variable]:"colors.white",_dark:{[_o.variable]:`colors.${t}.300`,[Qv.variable]:"colors.gray.800"},borderColor:"inherit",borderBottomColor:Qv.reference},color:_o.reference},tablist:{mb:"-1px",borderBottom:"1px solid",borderColor:"inherit"}}}),W6e=qs(e=>{const{colorScheme:t}=e;return{tab:{border:"1px solid",borderColor:"inherit",[Xa.variable]:"colors.gray.50",_dark:{[Xa.variable]:"colors.whiteAlpha.50"},mb:"-1px",_notLast:{marginEnd:"-1px"},_selected:{[Xa.variable]:"colors.white",[_o.variable]:`colors.${t}.600`,_dark:{[Xa.variable]:"colors.gray.800",[_o.variable]:`colors.${t}.300`},borderColor:"inherit",borderTopColor:"currentColor",borderBottomColor:"transparent"},color:_o.reference,bg:Xa.reference},tablist:{mb:"-1px",borderBottom:"1px solid",borderColor:"inherit"}}}),K6e=qs(e=>{const{colorScheme:t,theme:n}=e;return{tab:{borderRadius:"full",fontWeight:"semibold",color:"gray.600",_selected:{color:to(n,`${t}.700`),bg:to(n,`${t}.100`)}}}}),Q6e=qs(e=>{const{colorScheme:t}=e;return{tab:{borderRadius:"full",fontWeight:"semibold",[_o.variable]:"colors.gray.600",_dark:{[_o.variable]:"inherit"},_selected:{[_o.variable]:"colors.white",[Xa.variable]:`colors.${t}.600`,_dark:{[_o.variable]:"colors.gray.800",[Xa.variable]:`colors.${t}.300`}},color:_o.reference,bg:Xa.reference}}}),X6e=qs({}),Y6e={line:H6e,enclosed:q6e,"enclosed-colored":W6e,"soft-rounded":K6e,"solid-rounded":Q6e,unstyled:X6e},Z6e=F6e({baseStyle:V6e,sizes:G6e,variants:Y6e,defaultProps:{size:"md",variant:"line",colorScheme:"blue"}}),Er=NAe("badge",["bg","color","shadow"]),J6e={px:1,textTransform:"uppercase",fontSize:"xs",borderRadius:"sm",fontWeight:"bold",bg:Er.bg.reference,color:Er.color.reference,boxShadow:Er.shadow.reference},e8e=e=>{const{colorScheme:t,theme:n}=e,r=ap(`${t}.500`,.6)(n);return{[Er.bg.variable]:`colors.${t}.500`,[Er.color.variable]:"colors.white",_dark:{[Er.bg.variable]:r,[Er.color.variable]:"colors.whiteAlpha.800"}}},t8e=e=>{const{colorScheme:t,theme:n}=e,r=ap(`${t}.200`,.16)(n);return{[Er.bg.variable]:`colors.${t}.100`,[Er.color.variable]:`colors.${t}.800`,_dark:{[Er.bg.variable]:r,[Er.color.variable]:`colors.${t}.200`}}},n8e=e=>{const{colorScheme:t,theme:n}=e,r=ap(`${t}.200`,.8)(n);return{[Er.color.variable]:`colors.${t}.500`,_dark:{[Er.color.variable]:r},[Er.shadow.variable]:`inset 0 0 0px 1px ${Er.color.reference}`}},r8e={solid:e8e,subtle:t8e,outline:n8e},Yg={baseStyle:J6e,variants:r8e,defaultProps:{variant:"subtle",colorScheme:"gray"}},{defineMultiStyleConfig:i8e,definePartsStyle:vd}=Pt(WPe.keys),bM=nt("tag-bg"),_M=nt("tag-color"),s5=nt("tag-shadow"),X1=nt("tag-min-height"),Y1=nt("tag-min-width"),Z1=nt("tag-font-size"),J1=nt("tag-padding-inline"),o8e={fontWeight:"medium",lineHeight:1.2,outline:0,[_M.variable]:Er.color.reference,[bM.variable]:Er.bg.reference,[s5.variable]:Er.shadow.reference,color:_M.reference,bg:bM.reference,boxShadow:s5.reference,borderRadius:"md",minH:X1.reference,minW:Y1.reference,fontSize:Z1.reference,px:J1.reference,_focusVisible:{[s5.variable]:"shadows.outline"}},a8e={lineHeight:1.2,overflow:"visible"},s8e={fontSize:"lg",w:"5",h:"5",transitionProperty:"common",transitionDuration:"normal",borderRadius:"full",marginStart:"1.5",marginEnd:"-1",opacity:.5,_disabled:{opacity:.4},_focusVisible:{boxShadow:"outline",bg:"rgba(0, 0, 0, 0.14)"},_hover:{opacity:.8},_active:{opacity:1}},l8e=vd({container:o8e,label:a8e,closeButton:s8e}),u8e={sm:vd({container:{[X1.variable]:"sizes.5",[Y1.variable]:"sizes.5",[Z1.variable]:"fontSizes.xs",[J1.variable]:"space.2"},closeButton:{marginEnd:"-2px",marginStart:"0.35rem"}}),md:vd({container:{[X1.variable]:"sizes.6",[Y1.variable]:"sizes.6",[Z1.variable]:"fontSizes.sm",[J1.variable]:"space.2"}}),lg:vd({container:{[X1.variable]:"sizes.8",[Y1.variable]:"sizes.8",[Z1.variable]:"fontSizes.md",[J1.variable]:"space.3"}})},c8e={subtle:vd(e=>{var t;return{container:(t=Yg.variants)==null?void 0:t.subtle(e)}}),solid:vd(e=>{var t;return{container:(t=Yg.variants)==null?void 0:t.solid(e)}}),outline:vd(e=>{var t;return{container:(t=Yg.variants)==null?void 0:t.outline(e)}})},d8e=i8e({variants:c8e,baseStyle:l8e,sizes:u8e,defaultProps:{size:"md",variant:"subtle",colorScheme:"gray"}}),{definePartsStyle:Il,defineMultiStyleConfig:f8e}=Pt(UH.keys),Vf=nt("input-height"),Gf=nt("input-font-size"),Hf=nt("input-padding"),qf=nt("input-border-radius"),h8e=Il({addon:{height:Vf.reference,fontSize:Gf.reference,px:Hf.reference,borderRadius:qf.reference},field:{width:"100%",height:Vf.reference,fontSize:Gf.reference,px:Hf.reference,borderRadius:qf.reference,minWidth:0,outline:0,position:"relative",appearance:"none",transitionProperty:"common",transitionDuration:"normal",_disabled:{opacity:.4,cursor:"not-allowed"}}}),cu={lg:{[Gf.variable]:"fontSizes.lg",[Hf.variable]:"space.4",[qf.variable]:"radii.md",[Vf.variable]:"sizes.12"},md:{[Gf.variable]:"fontSizes.md",[Hf.variable]:"space.4",[qf.variable]:"radii.md",[Vf.variable]:"sizes.10"},sm:{[Gf.variable]:"fontSizes.sm",[Hf.variable]:"space.3",[qf.variable]:"radii.sm",[Vf.variable]:"sizes.8"},xs:{[Gf.variable]:"fontSizes.xs",[Hf.variable]:"space.2",[qf.variable]:"radii.sm",[Vf.variable]:"sizes.6"}},p8e={lg:Il({field:cu.lg,group:cu.lg}),md:Il({field:cu.md,group:cu.md}),sm:Il({field:cu.sm,group:cu.sm}),xs:Il({field:cu.xs,group:cu.xs})};function QA(e){const{focusBorderColor:t,errorBorderColor:n}=e;return{focusBorderColor:t||K("blue.500","blue.300")(e),errorBorderColor:n||K("red.500","red.300")(e)}}var g8e=Il(e=>{const{theme:t}=e,{focusBorderColor:n,errorBorderColor:r}=QA(e);return{field:{border:"1px solid",borderColor:"inherit",bg:"inherit",_hover:{borderColor:K("gray.300","whiteAlpha.400")(e)},_readOnly:{boxShadow:"none !important",userSelect:"all"},_invalid:{borderColor:to(t,r),boxShadow:`0 0 0 1px ${to(t,r)}`},_focusVisible:{zIndex:1,borderColor:to(t,n),boxShadow:`0 0 0 1px ${to(t,n)}`}},addon:{border:"1px solid",borderColor:K("inherit","whiteAlpha.50")(e),bg:K("gray.100","whiteAlpha.300")(e)}}}),m8e=Il(e=>{const{theme:t}=e,{focusBorderColor:n,errorBorderColor:r}=QA(e);return{field:{border:"2px solid",borderColor:"transparent",bg:K("gray.100","whiteAlpha.50")(e),_hover:{bg:K("gray.200","whiteAlpha.100")(e)},_readOnly:{boxShadow:"none !important",userSelect:"all"},_invalid:{borderColor:to(t,r)},_focusVisible:{bg:"transparent",borderColor:to(t,n)}},addon:{border:"2px solid",borderColor:"transparent",bg:K("gray.100","whiteAlpha.50")(e)}}}),y8e=Il(e=>{const{theme:t}=e,{focusBorderColor:n,errorBorderColor:r}=QA(e);return{field:{borderBottom:"1px solid",borderColor:"inherit",borderRadius:"0",px:"0",bg:"transparent",_readOnly:{boxShadow:"none !important",userSelect:"all"},_invalid:{borderColor:to(t,r),boxShadow:`0px 1px 0px 0px ${to(t,r)}`},_focusVisible:{borderColor:to(t,n),boxShadow:`0px 1px 0px 0px ${to(t,n)}`}},addon:{borderBottom:"2px solid",borderColor:"inherit",borderRadius:"0",px:"0",bg:"transparent"}}}),v8e=Il({field:{bg:"transparent",px:"0",height:"auto"},addon:{bg:"transparent",px:"0",height:"auto"}}),b8e={outline:g8e,filled:m8e,flushed:y8e,unstyled:v8e},un=f8e({baseStyle:h8e,sizes:p8e,variants:b8e,defaultProps:{size:"md",variant:"outline"}}),SM,_8e={...(SM=un.baseStyle)==null?void 0:SM.field,paddingY:"2",minHeight:"20",lineHeight:"short",verticalAlign:"top"},xM,wM,S8e={outline:e=>{var t,n;return(n=(t=un.variants)==null?void 0:t.outline(e).field)!=null?n:{}},flushed:e=>{var t,n;return(n=(t=un.variants)==null?void 0:t.flushed(e).field)!=null?n:{}},filled:e=>{var t,n;return(n=(t=un.variants)==null?void 0:t.filled(e).field)!=null?n:{}},unstyled:(wM=(xM=un.variants)==null?void 0:xM.unstyled.field)!=null?wM:{}},CM,EM,kM,TM,AM,PM,IM,RM,x8e={xs:(EM=(CM=un.sizes)==null?void 0:CM.xs.field)!=null?EM:{},sm:(TM=(kM=un.sizes)==null?void 0:kM.sm.field)!=null?TM:{},md:(PM=(AM=un.sizes)==null?void 0:AM.md.field)!=null?PM:{},lg:(RM=(IM=un.sizes)==null?void 0:IM.lg.field)!=null?RM:{}},w8e={baseStyle:_8e,sizes:x8e,variants:S8e,defaultProps:{size:"md",variant:"outline"}},Xv=fr("tooltip-bg"),l5=fr("tooltip-fg"),C8e=fr("popper-arrow-bg"),E8e={bg:Xv.reference,color:l5.reference,[Xv.variable]:"colors.gray.700",[l5.variable]:"colors.whiteAlpha.900",_dark:{[Xv.variable]:"colors.gray.300",[l5.variable]:"colors.gray.900"},[C8e.variable]:Xv.reference,px:"2",py:"0.5",borderRadius:"sm",fontWeight:"medium",fontSize:"sm",boxShadow:"md",maxW:"xs",zIndex:"tooltip"},k8e={baseStyle:E8e},{defineMultiStyleConfig:T8e,definePartsStyle:Ag}=Pt(WH.keys),A8e=e=>{const{colorScheme:t,theme:n,isIndeterminate:r,hasStripe:i}=e,o=K(pM(),pM("1rem","rgba(0,0,0,0.1)"))(e),a=K(`${t}.500`,`${t}.200`)(e),s=`linear-gradient( to right, transparent 0%, ${to(n,a)} 50%, transparent 100% - )`;return{...!r&&i&&o,...r?{bgImage:s}:{bgColor:a}}},I8e={lineHeight:"1",fontSize:"0.25em",fontWeight:"bold",color:"white"},R8e=e=>({bg:K("gray.100","whiteAlpha.300")(e)}),O8e=e=>({transitionProperty:"common",transitionDuration:"slow",...P8e(e)}),M8e=Pg(e=>({label:I8e,filledTrack:O8e(e),track:R8e(e)})),N8e={xs:Pg({track:{h:"1"}}),sm:Pg({track:{h:"2"}}),md:Pg({track:{h:"3"}}),lg:Pg({track:{h:"4"}})},$8e=A8e({sizes:N8e,baseStyle:M8e,defaultProps:{size:"md",colorScheme:"blue"}}),D8e=e=>typeof e=="function";function ro(e,...t){return D8e(e)?e(...t):e}var{definePartsStyle:eb,defineMultiStyleConfig:L8e}=Pt(UH.keys),Zg=nt("checkbox-size"),F8e=e=>{const{colorScheme:t}=e;return{w:Zg.reference,h:Zg.reference,transitionProperty:"box-shadow",transitionDuration:"normal",border:"2px solid",borderRadius:"sm",borderColor:"inherit",color:"white",_checked:{bg:K(`${t}.500`,`${t}.200`)(e),borderColor:K(`${t}.500`,`${t}.200`)(e),color:K("white","gray.900")(e),_hover:{bg:K(`${t}.600`,`${t}.300`)(e),borderColor:K(`${t}.600`,`${t}.300`)(e)},_disabled:{borderColor:K("gray.200","transparent")(e),bg:K("gray.200","whiteAlpha.300")(e),color:K("gray.500","whiteAlpha.500")(e)}},_indeterminate:{bg:K(`${t}.500`,`${t}.200`)(e),borderColor:K(`${t}.500`,`${t}.200`)(e),color:K("white","gray.900")(e)},_disabled:{bg:K("gray.100","whiteAlpha.100")(e),borderColor:K("gray.100","transparent")(e)},_focusVisible:{boxShadow:"outline"},_invalid:{borderColor:K("red.500","red.300")(e)}}},B8e={_disabled:{cursor:"not-allowed"}},z8e={userSelect:"none",_disabled:{opacity:.4}},j8e={transitionProperty:"transform",transitionDuration:"normal"},U8e=eb(e=>({icon:j8e,container:B8e,control:ro(F8e,e),label:z8e})),V8e={sm:eb({control:{[Zg.variable]:"sizes.3"},label:{fontSize:"sm"},icon:{fontSize:"3xs"}}),md:eb({control:{[Zg.variable]:"sizes.4"},label:{fontSize:"md"},icon:{fontSize:"2xs"}}),lg:eb({control:{[Zg.variable]:"sizes.5"},label:{fontSize:"lg"},icon:{fontSize:"2xs"}})},q_=L8e({baseStyle:U8e,sizes:V8e,defaultProps:{size:"md",colorScheme:"blue"}}),{defineMultiStyleConfig:G8e,definePartsStyle:tb}=Pt(HPe.keys),H8e=e=>{var t;const n=(t=ro(q_.baseStyle,e))==null?void 0:t.control;return{...n,borderRadius:"full",_checked:{...n==null?void 0:n._checked,_before:{content:'""',display:"inline-block",pos:"relative",w:"50%",h:"50%",borderRadius:"50%",bg:"currentColor"}}}},q8e=tb(e=>{var t,n,r,i;return{label:(n=(t=q_).baseStyle)==null?void 0:n.call(t,e).label,container:(i=(r=q_).baseStyle)==null?void 0:i.call(r,e).container,control:H8e(e)}}),W8e={md:tb({control:{w:"4",h:"4"},label:{fontSize:"md"}}),lg:tb({control:{w:"5",h:"5"},label:{fontSize:"lg"}}),sm:tb({control:{width:"3",height:"3"},label:{fontSize:"sm"}})},K8e=G8e({baseStyle:q8e,sizes:W8e,defaultProps:{size:"md",colorScheme:"blue"}}),{defineMultiStyleConfig:Q8e,definePartsStyle:X8e}=Pt(XH.keys),Yv=nt("select-bg"),MM,Y8e={...(MM=un.baseStyle)==null?void 0:MM.field,appearance:"none",paddingBottom:"1px",lineHeight:"normal",bg:Yv.reference,[Yv.variable]:"colors.white",_dark:{[Yv.variable]:"colors.gray.700"},"> option, > optgroup":{bg:Yv.reference}},Z8e={width:"6",height:"100%",insetEnd:"2",position:"relative",color:"currentColor",fontSize:"xl",_disabled:{opacity:.5}},J8e=X8e({field:Y8e,icon:Z8e}),Zv={paddingInlineEnd:"8"},NM,$M,DM,LM,FM,BM,zM,jM,eIe={lg:{...(NM=un.sizes)==null?void 0:NM.lg,field:{...($M=un.sizes)==null?void 0:$M.lg.field,...Zv}},md:{...(DM=un.sizes)==null?void 0:DM.md,field:{...(LM=un.sizes)==null?void 0:LM.md.field,...Zv}},sm:{...(FM=un.sizes)==null?void 0:FM.sm,field:{...(BM=un.sizes)==null?void 0:BM.sm.field,...Zv}},xs:{...(zM=un.sizes)==null?void 0:zM.xs,field:{...(jM=un.sizes)==null?void 0:jM.xs.field,...Zv},icon:{insetEnd:"1"}}},tIe=Q8e({baseStyle:J8e,sizes:eIe,variants:un.variants,defaultProps:un.defaultProps}),u5=nt("skeleton-start-color"),c5=nt("skeleton-end-color"),nIe={[u5.variable]:"colors.gray.100",[c5.variable]:"colors.gray.400",_dark:{[u5.variable]:"colors.gray.800",[c5.variable]:"colors.gray.600"},background:u5.reference,borderColor:c5.reference,opacity:.7,borderRadius:"sm"},rIe={baseStyle:nIe},d5=nt("skip-link-bg"),iIe={borderRadius:"md",fontWeight:"semibold",_focusVisible:{boxShadow:"outline",padding:"4",position:"fixed",top:"6",insetStart:"6",[d5.variable]:"colors.white",_dark:{[d5.variable]:"colors.gray.700"},bg:d5.reference}},oIe={baseStyle:iIe},{defineMultiStyleConfig:aIe,definePartsStyle:ow}=Pt(YH.keys),k0=nt("slider-thumb-size"),T0=nt("slider-track-size"),ku=nt("slider-bg"),sIe=e=>{const{orientation:t}=e;return{display:"inline-block",position:"relative",cursor:"pointer",_disabled:{opacity:.6,cursor:"default",pointerEvents:"none"},...QA({orientation:t,vertical:{h:"100%"},horizontal:{w:"100%"}})}},lIe=e=>({...QA({orientation:e.orientation,horizontal:{h:T0.reference},vertical:{w:T0.reference}}),overflow:"hidden",borderRadius:"sm",[ku.variable]:"colors.gray.200",_dark:{[ku.variable]:"colors.whiteAlpha.200"},_disabled:{[ku.variable]:"colors.gray.300",_dark:{[ku.variable]:"colors.whiteAlpha.300"}},bg:ku.reference}),uIe=e=>{const{orientation:t}=e;return{...QA({orientation:t,vertical:{left:"50%",transform:"translateX(-50%)",_active:{transform:"translateX(-50%) scale(1.15)"}},horizontal:{top:"50%",transform:"translateY(-50%)",_active:{transform:"translateY(-50%) scale(1.15)"}}}),w:k0.reference,h:k0.reference,display:"flex",alignItems:"center",justifyContent:"center",position:"absolute",outline:0,zIndex:1,borderRadius:"full",bg:"white",boxShadow:"base",border:"1px solid",borderColor:"transparent",transitionProperty:"transform",transitionDuration:"normal",_focusVisible:{boxShadow:"outline"},_disabled:{bg:"gray.300"}}},cIe=e=>{const{colorScheme:t}=e;return{width:"inherit",height:"inherit",[ku.variable]:`colors.${t}.500`,_dark:{[ku.variable]:`colors.${t}.200`},bg:ku.reference}},dIe=ow(e=>({container:sIe(e),track:lIe(e),thumb:uIe(e),filledTrack:cIe(e)})),fIe=ow({container:{[k0.variable]:"sizes.4",[T0.variable]:"sizes.1"}}),hIe=ow({container:{[k0.variable]:"sizes.3.5",[T0.variable]:"sizes.1"}}),pIe=ow({container:{[k0.variable]:"sizes.2.5",[T0.variable]:"sizes.0.5"}}),gIe={lg:fIe,md:hIe,sm:pIe},mIe=aIe({baseStyle:dIe,sizes:gIe,defaultProps:{size:"md",colorScheme:"blue"}}),Qc=fr("spinner-size"),yIe={width:[Qc.reference],height:[Qc.reference]},vIe={xs:{[Qc.variable]:"sizes.3"},sm:{[Qc.variable]:"sizes.4"},md:{[Qc.variable]:"sizes.6"},lg:{[Qc.variable]:"sizes.8"},xl:{[Qc.variable]:"sizes.12"}},bIe={baseStyle:yIe,sizes:vIe,defaultProps:{size:"md"}},{defineMultiStyleConfig:_Ie,definePartsStyle:nq}=Pt(qPe.keys),SIe={fontWeight:"medium"},xIe={opacity:.8,marginBottom:"2"},wIe={verticalAlign:"baseline",fontWeight:"semibold"},CIe={marginEnd:1,w:"3.5",h:"3.5",verticalAlign:"middle"},EIe=nq({container:{},label:SIe,helpText:xIe,number:wIe,icon:CIe}),kIe={md:nq({label:{fontSize:"sm"},helpText:{fontSize:"sm"},number:{fontSize:"2xl"}})},TIe=_Ie({baseStyle:EIe,sizes:kIe,defaultProps:{size:"md"}}),f5=nt("kbd-bg"),AIe={[f5.variable]:"colors.gray.100",_dark:{[f5.variable]:"colors.whiteAlpha.100"},bg:f5.reference,borderRadius:"md",borderWidth:"1px",borderBottomWidth:"3px",fontSize:"0.8em",fontWeight:"bold",lineHeight:"normal",px:"0.4em",whiteSpace:"nowrap"},PIe={baseStyle:AIe},IIe={transitionProperty:"common",transitionDuration:"fast",transitionTimingFunction:"ease-out",cursor:"pointer",textDecoration:"none",outline:"none",color:"inherit",_hover:{textDecoration:"underline"},_focusVisible:{boxShadow:"outline"}},RIe={baseStyle:IIe},{defineMultiStyleConfig:OIe,definePartsStyle:MIe}=Pt(GPe.keys),NIe={marginEnd:"2",display:"inline",verticalAlign:"text-bottom"},$Ie=MIe({icon:NIe}),DIe=OIe({baseStyle:$Ie}),{defineMultiStyleConfig:LIe,definePartsStyle:FIe}=Pt(HH.keys),ws=nt("menu-bg"),h5=nt("menu-shadow"),BIe={[ws.variable]:"#fff",[h5.variable]:"shadows.sm",_dark:{[ws.variable]:"colors.gray.700",[h5.variable]:"shadows.dark-lg"},color:"inherit",minW:"3xs",py:"2",zIndex:1,borderRadius:"md",borderWidth:"1px",bg:ws.reference,boxShadow:h5.reference},zIe={py:"1.5",px:"3",transitionProperty:"background",transitionDuration:"ultra-fast",transitionTimingFunction:"ease-in",_focus:{[ws.variable]:"colors.gray.100",_dark:{[ws.variable]:"colors.whiteAlpha.100"}},_active:{[ws.variable]:"colors.gray.200",_dark:{[ws.variable]:"colors.whiteAlpha.200"}},_expanded:{[ws.variable]:"colors.gray.100",_dark:{[ws.variable]:"colors.whiteAlpha.100"}},_disabled:{opacity:.4,cursor:"not-allowed"},bg:ws.reference},jIe={mx:4,my:2,fontWeight:"semibold",fontSize:"sm"},UIe={display:"inline-flex",alignItems:"center",justifyContent:"center",flexShrink:0},VIe={opacity:.6},GIe={border:0,borderBottom:"1px solid",borderColor:"inherit",my:"2",opacity:.6},HIe={transitionProperty:"common",transitionDuration:"normal"},qIe=FIe({button:HIe,list:BIe,item:zIe,groupTitle:jIe,icon:UIe,command:VIe,divider:GIe}),WIe=LIe({baseStyle:qIe}),{defineMultiStyleConfig:KIe,definePartsStyle:g4}=Pt(qH.keys),p5=nt("modal-bg"),g5=nt("modal-shadow"),QIe={bg:"blackAlpha.600",zIndex:"modal"},XIe=e=>{const{isCentered:t,scrollBehavior:n}=e;return{display:"flex",zIndex:"modal",justifyContent:"center",alignItems:t?"center":"flex-start",overflow:n==="inside"?"hidden":"auto",overscrollBehaviorY:"none"}},YIe=e=>{const{isCentered:t,scrollBehavior:n}=e;return{borderRadius:"md",color:"inherit",my:t?"auto":"16",mx:t?"auto":void 0,zIndex:"modal",maxH:n==="inside"?"calc(100% - 7.5rem)":void 0,[p5.variable]:"colors.white",[g5.variable]:"shadows.lg",_dark:{[p5.variable]:"colors.gray.700",[g5.variable]:"shadows.dark-lg"},bg:p5.reference,boxShadow:g5.reference}},ZIe={px:"6",py:"4",fontSize:"xl",fontWeight:"semibold"},JIe={position:"absolute",top:"2",insetEnd:"3"},eRe=e=>{const{scrollBehavior:t}=e;return{px:"6",py:"2",flex:"1",overflow:t==="inside"?"auto":void 0}},tRe={px:"6",py:"4"},nRe=g4(e=>({overlay:QIe,dialogContainer:ro(XIe,e),dialog:ro(YIe,e),header:ZIe,closeButton:JIe,body:ro(eRe,e),footer:tRe}));function Ba(e){return g4(e==="full"?{dialog:{maxW:"100vw",minH:"$100vh",my:"0",borderRadius:"0"}}:{dialog:{maxW:e}})}var rRe={xs:Ba("xs"),sm:Ba("sm"),md:Ba("md"),lg:Ba("lg"),xl:Ba("xl"),"2xl":Ba("2xl"),"3xl":Ba("3xl"),"4xl":Ba("4xl"),"5xl":Ba("5xl"),"6xl":Ba("6xl"),full:Ba("full")},iRe=KIe({baseStyle:nRe,sizes:rRe,defaultProps:{size:"md"}}),{defineMultiStyleConfig:oRe,definePartsStyle:rq}=Pt(WH.keys),YA=fr("number-input-stepper-width"),iq=fr("number-input-input-padding"),aRe=Tl(YA).add("0.5rem").toString(),m5=fr("number-input-bg"),y5=fr("number-input-color"),v5=fr("number-input-border-color"),sRe={[YA.variable]:"sizes.6",[iq.variable]:aRe},lRe=e=>{var t,n;return(n=(t=ro(un.baseStyle,e))==null?void 0:t.field)!=null?n:{}},uRe={width:YA.reference},cRe={borderStart:"1px solid",borderStartColor:v5.reference,color:y5.reference,bg:m5.reference,[y5.variable]:"colors.chakra-body-text",[v5.variable]:"colors.chakra-border-color",_dark:{[y5.variable]:"colors.whiteAlpha.800",[v5.variable]:"colors.whiteAlpha.300"},_active:{[m5.variable]:"colors.gray.200",_dark:{[m5.variable]:"colors.whiteAlpha.300"}},_disabled:{opacity:.4,cursor:"not-allowed"}},dRe=rq(e=>{var t;return{root:sRe,field:(t=ro(lRe,e))!=null?t:{},stepperGroup:uRe,stepper:cRe}});function Jv(e){var t,n,r;const i=(t=un.sizes)==null?void 0:t[e],o={lg:"md",md:"md",sm:"sm",xs:"sm"},a=(r=(n=i.field)==null?void 0:n.fontSize)!=null?r:"md",s=FH.fontSizes[a];return rq({field:{...i.field,paddingInlineEnd:iq.reference,verticalAlign:"top"},stepper:{fontSize:Tl(s).multiply(.75).toString(),_first:{borderTopEndRadius:o[e]},_last:{borderBottomEndRadius:o[e],mt:"-1px",borderTopWidth:1}}})}var fRe={xs:Jv("xs"),sm:Jv("sm"),md:Jv("md"),lg:Jv("lg")},hRe=oRe({baseStyle:dRe,sizes:fRe,variants:un.variants,defaultProps:un.defaultProps}),UM,pRe={...(UM=un.baseStyle)==null?void 0:UM.field,textAlign:"center"},gRe={lg:{fontSize:"lg",w:12,h:12,borderRadius:"md"},md:{fontSize:"md",w:10,h:10,borderRadius:"md"},sm:{fontSize:"sm",w:8,h:8,borderRadius:"sm"},xs:{fontSize:"xs",w:6,h:6,borderRadius:"sm"}},VM,GM,mRe={outline:e=>{var t,n,r;return(r=(n=ro((t=un.variants)==null?void 0:t.outline,e))==null?void 0:n.field)!=null?r:{}},flushed:e=>{var t,n,r;return(r=(n=ro((t=un.variants)==null?void 0:t.flushed,e))==null?void 0:n.field)!=null?r:{}},filled:e=>{var t,n,r;return(r=(n=ro((t=un.variants)==null?void 0:t.filled,e))==null?void 0:n.field)!=null?r:{}},unstyled:(GM=(VM=un.variants)==null?void 0:VM.unstyled.field)!=null?GM:{}},yRe={baseStyle:pRe,sizes:gRe,variants:mRe,defaultProps:un.defaultProps},{defineMultiStyleConfig:vRe,definePartsStyle:bRe}=Pt(KH.keys),e1=fr("popper-bg"),_Re=fr("popper-arrow-bg"),HM=fr("popper-arrow-shadow-color"),SRe={zIndex:10},xRe={[e1.variable]:"colors.white",bg:e1.reference,[_Re.variable]:e1.reference,[HM.variable]:"colors.gray.200",_dark:{[e1.variable]:"colors.gray.700",[HM.variable]:"colors.whiteAlpha.300"},width:"xs",border:"1px solid",borderColor:"inherit",borderRadius:"md",boxShadow:"sm",zIndex:"inherit",_focusVisible:{outline:0,boxShadow:"outline"}},wRe={px:3,py:2,borderBottomWidth:"1px"},CRe={px:3,py:2},ERe={px:3,py:2,borderTopWidth:"1px"},kRe={position:"absolute",borderRadius:"md",top:1,insetEnd:2,padding:2},TRe=bRe({popper:SRe,content:xRe,header:wRe,body:CRe,footer:ERe,closeButton:kRe}),ARe=vRe({baseStyle:TRe}),{definePartsStyle:m4,defineMultiStyleConfig:PRe}=Pt(jPe.keys),b5=nt("drawer-bg"),_5=nt("drawer-box-shadow");function _f(e){return m4(e==="full"?{dialog:{maxW:"100vw",h:"100vh"}}:{dialog:{maxW:e}})}var IRe={bg:"blackAlpha.600",zIndex:"overlay"},RRe={display:"flex",zIndex:"modal",justifyContent:"center"},ORe=e=>{const{isFullHeight:t}=e;return{...t&&{height:"100vh"},zIndex:"modal",maxH:"100vh",color:"inherit",[b5.variable]:"colors.white",[_5.variable]:"shadows.lg",_dark:{[b5.variable]:"colors.gray.700",[_5.variable]:"shadows.dark-lg"},bg:b5.reference,boxShadow:_5.reference}},MRe={px:"6",py:"4",fontSize:"xl",fontWeight:"semibold"},NRe={position:"absolute",top:"2",insetEnd:"3"},$Re={px:"6",py:"2",flex:"1",overflow:"auto"},DRe={px:"6",py:"4"},LRe=m4(e=>({overlay:IRe,dialogContainer:RRe,dialog:ro(ORe,e),header:MRe,closeButton:NRe,body:$Re,footer:DRe})),FRe={xs:_f("xs"),sm:_f("md"),md:_f("lg"),lg:_f("2xl"),xl:_f("4xl"),full:_f("full")},BRe=PRe({baseStyle:LRe,sizes:FRe,defaultProps:{size:"xs"}}),{definePartsStyle:zRe,defineMultiStyleConfig:jRe}=Pt(VH.keys),URe={borderRadius:"md",py:"1",transitionProperty:"common",transitionDuration:"normal"},VRe={borderRadius:"md",py:"1",transitionProperty:"common",transitionDuration:"normal",width:"full",_focusVisible:{boxShadow:"outline"},_placeholder:{opacity:.6}},GRe={borderRadius:"md",py:"1",transitionProperty:"common",transitionDuration:"normal",width:"full",_focusVisible:{boxShadow:"outline"},_placeholder:{opacity:.6}},HRe=zRe({preview:URe,input:VRe,textarea:GRe}),qRe=jRe({baseStyle:HRe}),{definePartsStyle:WRe,defineMultiStyleConfig:KRe}=Pt(UPe.keys),wh=nt("form-control-color"),QRe={marginStart:"1",[wh.variable]:"colors.red.500",_dark:{[wh.variable]:"colors.red.300"},color:wh.reference},XRe={mt:"2",[wh.variable]:"colors.gray.600",_dark:{[wh.variable]:"colors.whiteAlpha.600"},color:wh.reference,lineHeight:"normal",fontSize:"sm"},YRe=WRe({container:{width:"100%",position:"relative"},requiredIndicator:QRe,helperText:XRe}),ZRe=KRe({baseStyle:YRe}),{definePartsStyle:JRe,defineMultiStyleConfig:e9e}=Pt(VPe.keys),Ch=nt("form-error-color"),t9e={[Ch.variable]:"colors.red.500",_dark:{[Ch.variable]:"colors.red.300"},color:Ch.reference,mt:"2",fontSize:"sm",lineHeight:"normal"},n9e={marginEnd:"0.5em",[Ch.variable]:"colors.red.500",_dark:{[Ch.variable]:"colors.red.300"},color:Ch.reference},r9e=JRe({text:t9e,icon:n9e}),i9e=e9e({baseStyle:r9e}),o9e={fontSize:"md",marginEnd:"3",mb:"2",fontWeight:"medium",transitionProperty:"common",transitionDuration:"normal",opacity:1,_disabled:{opacity:.4}},a9e={baseStyle:o9e},s9e={fontFamily:"heading",fontWeight:"bold"},l9e={"4xl":{fontSize:["6xl",null,"7xl"],lineHeight:1},"3xl":{fontSize:["5xl",null,"6xl"],lineHeight:1},"2xl":{fontSize:["4xl",null,"5xl"],lineHeight:[1.2,null,1]},xl:{fontSize:["3xl",null,"4xl"],lineHeight:[1.33,null,1.2]},lg:{fontSize:["2xl",null,"3xl"],lineHeight:[1.33,null,1.2]},md:{fontSize:"xl",lineHeight:1.2},sm:{fontSize:"md",lineHeight:1.2},xs:{fontSize:"sm",lineHeight:1.2}},u9e={baseStyle:s9e,sizes:l9e,defaultProps:{size:"xl"}},{defineMultiStyleConfig:c9e,definePartsStyle:d9e}=Pt(zPe.keys),S5=nt("breadcrumb-link-decor"),f9e={transitionProperty:"common",transitionDuration:"fast",transitionTimingFunction:"ease-out",outline:"none",color:"inherit",textDecoration:S5.reference,[S5.variable]:"none","&:not([aria-current=page])":{cursor:"pointer",_hover:{[S5.variable]:"underline"},_focusVisible:{boxShadow:"outline"}}},h9e=d9e({link:f9e}),p9e=c9e({baseStyle:h9e}),g9e={lineHeight:"1.2",borderRadius:"md",fontWeight:"semibold",transitionProperty:"common",transitionDuration:"normal",_focusVisible:{boxShadow:"outline"},_disabled:{opacity:.4,cursor:"not-allowed",boxShadow:"none"},_hover:{_disabled:{bg:"initial"}}},oq=e=>{const{colorScheme:t,theme:n}=e;if(t==="gray")return{color:K("gray.800","whiteAlpha.900")(e),_hover:{bg:K("gray.100","whiteAlpha.200")(e)},_active:{bg:K("gray.200","whiteAlpha.300")(e)}};const r=sp(`${t}.200`,.12)(n),i=sp(`${t}.200`,.24)(n);return{color:K(`${t}.600`,`${t}.200`)(e),bg:"transparent",_hover:{bg:K(`${t}.50`,r)(e)},_active:{bg:K(`${t}.100`,i)(e)}}},m9e=e=>{const{colorScheme:t}=e,n=K("gray.200","whiteAlpha.300")(e);return{border:"1px solid",borderColor:t==="gray"?n:"currentColor",".chakra-button__group[data-attached][data-orientation=horizontal] > &:not(:last-of-type)":{marginEnd:"-1px"},".chakra-button__group[data-attached][data-orientation=vertical] > &:not(:last-of-type)":{marginBottom:"-1px"},...ro(oq,e)}},y9e={yellow:{bg:"yellow.400",color:"black",hoverBg:"yellow.500",activeBg:"yellow.600"},cyan:{bg:"cyan.400",color:"black",hoverBg:"cyan.500",activeBg:"cyan.600"}},v9e=e=>{var t;const{colorScheme:n}=e;if(n==="gray"){const l=K("gray.100","whiteAlpha.200")(e);return{bg:l,color:K("gray.800","whiteAlpha.900")(e),_hover:{bg:K("gray.200","whiteAlpha.300")(e),_disabled:{bg:l}},_active:{bg:K("gray.300","whiteAlpha.400")(e)}}}const{bg:r=`${n}.500`,color:i="white",hoverBg:o=`${n}.600`,activeBg:a=`${n}.700`}=(t=y9e[n])!=null?t:{},s=K(r,`${n}.200`)(e);return{bg:s,color:K(i,"gray.800")(e),_hover:{bg:K(o,`${n}.300`)(e),_disabled:{bg:s}},_active:{bg:K(a,`${n}.400`)(e)}}},b9e=e=>{const{colorScheme:t}=e;return{padding:0,height:"auto",lineHeight:"normal",verticalAlign:"baseline",color:K(`${t}.500`,`${t}.200`)(e),_hover:{textDecoration:"underline",_disabled:{textDecoration:"none"}},_active:{color:K(`${t}.700`,`${t}.500`)(e)}}},_9e={bg:"none",color:"inherit",display:"inline",lineHeight:"inherit",m:"0",p:"0"},S9e={ghost:oq,outline:m9e,solid:v9e,link:b9e,unstyled:_9e},x9e={lg:{h:"12",minW:"12",fontSize:"lg",px:"6"},md:{h:"10",minW:"10",fontSize:"md",px:"4"},sm:{h:"8",minW:"8",fontSize:"sm",px:"3"},xs:{h:"6",minW:"6",fontSize:"xs",px:"2"}},w9e={baseStyle:g9e,variants:S9e,sizes:x9e,defaultProps:{variant:"solid",size:"md",colorScheme:"gray"}},{definePartsStyle:bd,defineMultiStyleConfig:C9e}=Pt(QPe.keys),W_=nt("card-bg"),Dl=nt("card-padding"),aq=nt("card-shadow"),nb=nt("card-radius"),sq=nt("card-border-width","0"),lq=nt("card-border-color"),E9e=bd({container:{[W_.variable]:"colors.chakra-body-bg",backgroundColor:W_.reference,boxShadow:aq.reference,borderRadius:nb.reference,color:"chakra-body-text",borderWidth:sq.reference,borderColor:lq.reference},body:{padding:Dl.reference,flex:"1 1 0%"},header:{padding:Dl.reference},footer:{padding:Dl.reference}}),k9e={sm:bd({container:{[nb.variable]:"radii.base",[Dl.variable]:"space.3"}}),md:bd({container:{[nb.variable]:"radii.md",[Dl.variable]:"space.5"}}),lg:bd({container:{[nb.variable]:"radii.xl",[Dl.variable]:"space.7"}})},T9e={elevated:bd({container:{[aq.variable]:"shadows.base",_dark:{[W_.variable]:"colors.gray.700"}}}),outline:bd({container:{[sq.variable]:"1px",[lq.variable]:"colors.chakra-border-color"}}),filled:bd({container:{[W_.variable]:"colors.chakra-subtle-bg"}}),unstyled:{body:{[Dl.variable]:0},header:{[Dl.variable]:0},footer:{[Dl.variable]:0}}},A9e=C9e({baseStyle:E9e,variants:T9e,sizes:k9e,defaultProps:{variant:"elevated",size:"md"}}),Jg=fr("close-button-size"),sg=fr("close-button-bg"),P9e={w:[Jg.reference],h:[Jg.reference],borderRadius:"md",transitionProperty:"common",transitionDuration:"normal",_disabled:{opacity:.4,cursor:"not-allowed",boxShadow:"none"},_hover:{[sg.variable]:"colors.blackAlpha.100",_dark:{[sg.variable]:"colors.whiteAlpha.100"}},_active:{[sg.variable]:"colors.blackAlpha.200",_dark:{[sg.variable]:"colors.whiteAlpha.200"}},_focusVisible:{boxShadow:"outline"},bg:sg.reference},I9e={lg:{[Jg.variable]:"sizes.10",fontSize:"md"},md:{[Jg.variable]:"sizes.8",fontSize:"xs"},sm:{[Jg.variable]:"sizes.6",fontSize:"2xs"}},R9e={baseStyle:P9e,sizes:I9e,defaultProps:{size:"md"}},{variants:O9e,defaultProps:M9e}=Yg,N9e={fontFamily:"mono",fontSize:"sm",px:"0.2em",borderRadius:"sm",bg:Er.bg.reference,color:Er.color.reference,boxShadow:Er.shadow.reference},$9e={baseStyle:N9e,variants:O9e,defaultProps:M9e},D9e={w:"100%",mx:"auto",maxW:"prose",px:"4"},L9e={baseStyle:D9e},F9e={opacity:.6,borderColor:"inherit"},B9e={borderStyle:"solid"},z9e={borderStyle:"dashed"},j9e={solid:B9e,dashed:z9e},U9e={baseStyle:F9e,variants:j9e,defaultProps:{variant:"solid"}},{definePartsStyle:V9e,defineMultiStyleConfig:G9e}=Pt(jH.keys),H9e={borderTopWidth:"1px",borderColor:"inherit",_last:{borderBottomWidth:"1px"}},q9e={transitionProperty:"common",transitionDuration:"normal",fontSize:"md",_focusVisible:{boxShadow:"outline"},_hover:{bg:"blackAlpha.50"},_disabled:{opacity:.4,cursor:"not-allowed"},px:"4",py:"2"},W9e={pt:"2",px:"4",pb:"5"},K9e={fontSize:"1.25em"},Q9e=V9e({container:H9e,button:q9e,panel:W9e,icon:K9e}),X9e=G9e({baseStyle:Q9e}),{definePartsStyle:Ry,defineMultiStyleConfig:Y9e}=Pt(FPe.keys),Qo=nt("alert-fg"),Kl=nt("alert-bg"),Z9e=Ry({container:{bg:Kl.reference,px:"4",py:"3"},title:{fontWeight:"bold",lineHeight:"6",marginEnd:"2"},description:{lineHeight:"6"},icon:{color:Qo.reference,flexShrink:0,marginEnd:"3",w:"5",h:"6"},spinner:{color:Qo.reference,flexShrink:0,marginEnd:"3",w:"5",h:"5"}});function ZA(e){const{theme:t,colorScheme:n}=e,r=sp(`${n}.200`,.16)(t);return{light:`colors.${n}.100`,dark:r}}var J9e=Ry(e=>{const{colorScheme:t}=e,n=ZA(e);return{container:{[Qo.variable]:`colors.${t}.500`,[Kl.variable]:n.light,_dark:{[Qo.variable]:`colors.${t}.200`,[Kl.variable]:n.dark}}}}),eOe=Ry(e=>{const{colorScheme:t}=e,n=ZA(e);return{container:{[Qo.variable]:`colors.${t}.500`,[Kl.variable]:n.light,_dark:{[Qo.variable]:`colors.${t}.200`,[Kl.variable]:n.dark},paddingStart:"3",borderStartWidth:"4px",borderStartColor:Qo.reference}}}),tOe=Ry(e=>{const{colorScheme:t}=e,n=ZA(e);return{container:{[Qo.variable]:`colors.${t}.500`,[Kl.variable]:n.light,_dark:{[Qo.variable]:`colors.${t}.200`,[Kl.variable]:n.dark},pt:"2",borderTopWidth:"4px",borderTopColor:Qo.reference}}}),nOe=Ry(e=>{const{colorScheme:t}=e;return{container:{[Qo.variable]:"colors.white",[Kl.variable]:`colors.${t}.500`,_dark:{[Qo.variable]:"colors.gray.900",[Kl.variable]:`colors.${t}.200`},color:Qo.reference}}}),rOe={subtle:J9e,"left-accent":eOe,"top-accent":tOe,solid:nOe},iOe=Y9e({baseStyle:Z9e,variants:rOe,defaultProps:{variant:"subtle",colorScheme:"blue"}}),{definePartsStyle:uq,defineMultiStyleConfig:oOe}=Pt(BPe.keys),Eh=nt("avatar-border-color"),em=nt("avatar-bg"),A0=nt("avatar-font-size"),lp=nt("avatar-size"),aOe={borderRadius:"full",border:"0.2em solid",borderColor:Eh.reference,[Eh.variable]:"white",_dark:{[Eh.variable]:"colors.gray.800"}},sOe={bg:em.reference,fontSize:A0.reference,width:lp.reference,height:lp.reference,lineHeight:"1",[em.variable]:"colors.gray.200",_dark:{[em.variable]:"colors.whiteAlpha.400"}},lOe=e=>{const{name:t,theme:n}=e,r=t?g6e({string:t}):"colors.gray.400",i=h6e(r)(n);let o="white";return i||(o="gray.800"),{bg:em.reference,fontSize:A0.reference,color:o,borderColor:Eh.reference,verticalAlign:"top",width:lp.reference,height:lp.reference,"&:not([data-loaded])":{[em.variable]:r},[Eh.variable]:"colors.white",_dark:{[Eh.variable]:"colors.gray.800"}}},uOe={fontSize:A0.reference,lineHeight:"1"},cOe=uq(e=>({badge:ro(aOe,e),excessLabel:ro(sOe,e),container:ro(lOe,e),label:uOe}));function fu(e){const t=e!=="100%"?zH[e]:void 0;return uq({container:{[lp.variable]:t??e,[A0.variable]:`calc(${t??e} / 2.5)`},excessLabel:{[lp.variable]:t??e,[A0.variable]:`calc(${t??e} / 2.5)`}})}var dOe={"2xs":fu(4),xs:fu(6),sm:fu(8),md:fu(12),lg:fu(16),xl:fu(24),"2xl":fu(32),full:fu("100%")},fOe=oOe({baseStyle:cOe,sizes:dOe,defaultProps:{size:"md"}}),hOe={Accordion:X9e,Alert:iOe,Avatar:fOe,Badge:Yg,Breadcrumb:p9e,Button:w9e,Checkbox:q_,CloseButton:R9e,Code:$9e,Container:L9e,Divider:U9e,Drawer:BRe,Editable:qRe,Form:ZRe,FormError:i9e,FormLabel:a9e,Heading:u9e,Input:un,Kbd:PIe,Link:RIe,List:DIe,Menu:WIe,Modal:iRe,NumberInput:hRe,PinInput:yRe,Popover:ARe,Progress:$8e,Radio:K8e,Select:tIe,Skeleton:rIe,SkipLink:oIe,Slider:mIe,Spinner:bIe,Stat:TIe,Switch:R6e,Table:F6e,Tabs:J6e,Tag:f8e,Textarea:C8e,Tooltip:T8e,Card:A9e,Stepper:LPe},pOe={colors:{"chakra-body-text":{_light:"gray.800",_dark:"whiteAlpha.900"},"chakra-body-bg":{_light:"white",_dark:"gray.800"},"chakra-border-color":{_light:"gray.200",_dark:"whiteAlpha.300"},"chakra-inverse-text":{_light:"white",_dark:"gray.800"},"chakra-subtle-bg":{_light:"gray.100",_dark:"gray.700"},"chakra-subtle-text":{_light:"gray.600",_dark:"gray.400"},"chakra-placeholder-color":{_light:"gray.500",_dark:"whiteAlpha.400"}}},gOe={global:{body:{fontFamily:"body",color:"chakra-body-text",bg:"chakra-body-bg",transitionProperty:"background-color",transitionDuration:"normal",lineHeight:"base"},"*::placeholder":{color:"chakra-placeholder-color"},"*, *::before, &::after":{borderColor:"chakra-border-color"}}},mOe="ltr",yOe={useSystemColorMode:!1,initialColorMode:"light",cssVarPrefix:"chakra"},vOe={semanticTokens:pOe,direction:mOe,...NPe,components:hOe,styles:gOe,config:yOe},bOe=vOe;function _Oe(e,t){const n={};return Object.keys(e).forEach(r=>{t.includes(r)||(n[r]=e[r])}),n}function SOe(e,t,n,r){const i=typeof t=="string"?t.split("."):[t];for(r=0;r{const t=new WeakMap;return(r,i,o,a)=>{if(typeof r>"u")return e(r,i,o);t.has(r)||t.set(r,new Map);const s=t.get(r);if(s.has(i))return s.get(i);const l=e(r,i,o,a);return s.set(i,l),l}},cq=xOe(SOe);function dq(e,t){const n={};return Object.keys(e).forEach(r=>{const i=e[r];t(i,r,e)&&(n[r]=i)}),n}var fq=e=>dq(e,t=>t!=null);function wOe(e){return typeof e=="function"}function hq(e,...t){return wOe(e)?e(...t):e}function IKe(...e){return function(n){e.some(r=>(r==null||r(n),n==null?void 0:n.defaultPrevented))}}var COe=typeof Element<"u",EOe=typeof Map=="function",kOe=typeof Set=="function",TOe=typeof ArrayBuffer=="function"&&!!ArrayBuffer.isView;function rb(e,t){if(e===t)return!0;if(e&&t&&typeof e=="object"&&typeof t=="object"){if(e.constructor!==t.constructor)return!1;var n,r,i;if(Array.isArray(e)){if(n=e.length,n!=t.length)return!1;for(r=n;r--!==0;)if(!rb(e[r],t[r]))return!1;return!0}var o;if(EOe&&e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(o=e.entries();!(r=o.next()).done;)if(!t.has(r.value[0]))return!1;for(o=e.entries();!(r=o.next()).done;)if(!rb(r.value[1],t.get(r.value[0])))return!1;return!0}if(kOe&&e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(o=e.entries();!(r=o.next()).done;)if(!t.has(r.value[0]))return!1;return!0}if(TOe&&ArrayBuffer.isView(e)&&ArrayBuffer.isView(t)){if(n=e.length,n!=t.length)return!1;for(r=n;r--!==0;)if(e[r]!==t[r])return!1;return!0}if(e.constructor===RegExp)return e.source===t.source&&e.flags===t.flags;if(e.valueOf!==Object.prototype.valueOf&&typeof e.valueOf=="function"&&typeof t.valueOf=="function")return e.valueOf()===t.valueOf();if(e.toString!==Object.prototype.toString&&typeof e.toString=="function"&&typeof t.toString=="function")return e.toString()===t.toString();if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!Object.prototype.hasOwnProperty.call(t,i[r]))return!1;if(COe&&e instanceof Element)return!1;for(r=n;r--!==0;)if(!((i[r]==="_owner"||i[r]==="__v"||i[r]==="__o")&&e.$$typeof)&&!rb(e[i[r]],t[i[r]]))return!1;return!0}return e!==e&&t!==t}var AOe=function(t,n){try{return rb(t,n)}catch(r){if((r.message||"").match(/stack|recursion/i))return console.warn("react-fast-compare cannot handle circular refs"),!1;throw r}};const POe=pc(AOe);function pq(e,t={}){var n;const{styleConfig:r,...i}=t,{theme:o,colorMode:a}=VTe(),s=e?cq(o,`components.${e}`):void 0,l=r||s,u=Ds({theme:o,colorMode:a},(n=l==null?void 0:l.defaultProps)!=null?n:{},fq(_Oe(i,["children"]))),c=I.useRef({});if(l){const f=cPe(l)(u);POe(c.current,f)||(c.current=f)}return c.current}function Oy(e,t={}){return pq(e,t)}function IOe(e,t={}){return pq(e,t)}var ROe=new Set([...ZAe,"textStyle","layerStyle","apply","noOfLines","focusBorderColor","errorBorderColor","as","__css","css","sx"]),OOe=new Set(["htmlWidth","htmlHeight","htmlSize","htmlTranslate"]);function MOe(e){return OOe.has(e)||!ROe.has(e)}function NOe(e,...t){if(e==null)throw new TypeError("Cannot convert undefined or null to object");const n={...e};for(const r of t)if(r!=null)for(const i in r)Object.prototype.hasOwnProperty.call(r,i)&&(i in n&&delete n[i],n[i]=r[i]);return n}function $Oe(e){const t=Object.assign({},e);for(let n in t)t[n]===void 0&&delete t[n];return t}var DOe=/^((children|dangerouslySetInnerHTML|key|ref|autoFocus|defaultValue|defaultChecked|innerHTML|suppressContentEditableWarning|suppressHydrationWarning|valueLink|abbr|accept|acceptCharset|accessKey|action|allow|allowUserMedia|allowPaymentRequest|allowFullScreen|allowTransparency|alt|async|autoComplete|autoPlay|capture|cellPadding|cellSpacing|challenge|charSet|checked|cite|classID|className|cols|colSpan|content|contentEditable|contextMenu|controls|controlsList|coords|crossOrigin|data|dateTime|decoding|default|defer|dir|disabled|disablePictureInPicture|download|draggable|encType|enterKeyHint|form|formAction|formEncType|formMethod|formNoValidate|formTarget|frameBorder|headers|height|hidden|high|href|hrefLang|htmlFor|httpEquiv|id|inputMode|integrity|is|keyParams|keyType|kind|label|lang|list|loading|loop|low|marginHeight|marginWidth|max|maxLength|media|mediaGroup|method|min|minLength|multiple|muted|name|nonce|noValidate|open|optimum|pattern|placeholder|playsInline|poster|preload|profile|radioGroup|readOnly|referrerPolicy|rel|required|reversed|role|rows|rowSpan|sandbox|scope|scoped|scrolling|seamless|selected|shape|size|sizes|slot|span|spellCheck|src|srcDoc|srcLang|srcSet|start|step|style|summary|tabIndex|target|title|translate|type|useMap|value|width|wmode|wrap|about|datatype|inlist|prefix|property|resource|typeof|vocab|autoCapitalize|autoCorrect|autoSave|color|incremental|fallback|inert|itemProp|itemScope|itemType|itemID|itemRef|on|option|results|security|unselectable|accentHeight|accumulate|additive|alignmentBaseline|allowReorder|alphabetic|amplitude|arabicForm|ascent|attributeName|attributeType|autoReverse|azimuth|baseFrequency|baselineShift|baseProfile|bbox|begin|bias|by|calcMode|capHeight|clip|clipPathUnits|clipPath|clipRule|colorInterpolation|colorInterpolationFilters|colorProfile|colorRendering|contentScriptType|contentStyleType|cursor|cx|cy|d|decelerate|descent|diffuseConstant|direction|display|divisor|dominantBaseline|dur|dx|dy|edgeMode|elevation|enableBackground|end|exponent|externalResourcesRequired|fill|fillOpacity|fillRule|filter|filterRes|filterUnits|floodColor|floodOpacity|focusable|fontFamily|fontSize|fontSizeAdjust|fontStretch|fontStyle|fontVariant|fontWeight|format|from|fr|fx|fy|g1|g2|glyphName|glyphOrientationHorizontal|glyphOrientationVertical|glyphRef|gradientTransform|gradientUnits|hanging|horizAdvX|horizOriginX|ideographic|imageRendering|in|in2|intercept|k|k1|k2|k3|k4|kernelMatrix|kernelUnitLength|kerning|keyPoints|keySplines|keyTimes|lengthAdjust|letterSpacing|lightingColor|limitingConeAngle|local|markerEnd|markerMid|markerStart|markerHeight|markerUnits|markerWidth|mask|maskContentUnits|maskUnits|mathematical|mode|numOctaves|offset|opacity|operator|order|orient|orientation|origin|overflow|overlinePosition|overlineThickness|panose1|paintOrder|pathLength|patternContentUnits|patternTransform|patternUnits|pointerEvents|points|pointsAtX|pointsAtY|pointsAtZ|preserveAlpha|preserveAspectRatio|primitiveUnits|r|radius|refX|refY|renderingIntent|repeatCount|repeatDur|requiredExtensions|requiredFeatures|restart|result|rotate|rx|ry|scale|seed|shapeRendering|slope|spacing|specularConstant|specularExponent|speed|spreadMethod|startOffset|stdDeviation|stemh|stemv|stitchTiles|stopColor|stopOpacity|strikethroughPosition|strikethroughThickness|string|stroke|strokeDasharray|strokeDashoffset|strokeLinecap|strokeLinejoin|strokeMiterlimit|strokeOpacity|strokeWidth|surfaceScale|systemLanguage|tableValues|targetX|targetY|textAnchor|textDecoration|textRendering|textLength|to|transform|u1|u2|underlinePosition|underlineThickness|unicode|unicodeBidi|unicodeRange|unitsPerEm|vAlphabetic|vHanging|vIdeographic|vMathematical|values|vectorEffect|version|vertAdvY|vertOriginX|vertOriginY|viewBox|viewTarget|visibility|widths|wordSpacing|writingMode|x|xHeight|x1|x2|xChannelSelector|xlinkActuate|xlinkArcrole|xlinkHref|xlinkRole|xlinkShow|xlinkTitle|xlinkType|xmlBase|xmlns|xmlnsXlink|xmlLang|xmlSpace|y|y1|y2|yChannelSelector|z|zoomAndPan|for|class|autofocus)|(([Dd][Aa][Tt][Aa]|[Aa][Rr][Ii][Aa]|x)-.*))$/,LOe=_H(function(e){return DOe.test(e)||e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&e.charCodeAt(2)<91}),FOe=LOe,BOe=function(t){return t!=="theme"},qM=function(t){return typeof t=="string"&&t.charCodeAt(0)>96?FOe:BOe},WM=function(t,n,r){var i;if(n){var o=n.shouldForwardProp;i=t.__emotion_forwardProp&&o?function(a){return t.__emotion_forwardProp(a)&&o(a)}:o}return typeof i!="function"&&r&&(i=t.__emotion_forwardProp),i},zOe=function(t){var n=t.cache,r=t.serialized,i=t.isStringTag;return xH(n,r,i),ATe(function(){return wH(n,r,i)}),null},jOe=function e(t,n){var r=t.__emotion_real===t,i=r&&t.__emotion_base||t,o,a;n!==void 0&&(o=n.label,a=n.target);var s=WM(t,n,r),l=s||qM(i),u=!l("as");return function(){var c=arguments,d=r&&t.__emotion_styles!==void 0?t.__emotion_styles.slice(0):[];if(o!==void 0&&d.push("label:"+o+";"),c[0]==null||c[0].raw===void 0)d.push.apply(d,c);else{d.push(c[0][0]);for(var f=c.length,h=1;ht=>{const{theme:n,css:r,__css:i,sx:o,...a}=t,s=dq(a,(d,f)=>ePe(f)),l=hq(e,t),u=NOe({},i,l,fq(s),o),c=LH(u)(t.theme);return r?[c,r]:c};function x5(e,t){const{baseStyle:n,...r}=t??{};r.shouldForwardProp||(r.shouldForwardProp=MOe);const i=GOe({baseStyle:n}),o=VOe(e,r)(i);return En.forwardRef(function(l,u){const{colorMode:c,forced:d}=tw();return En.createElement(o,{ref:u,"data-theme":d?c:void 0,...l})})}function HOe(){const e=new Map;return new Proxy(x5,{apply(t,n,r){return x5(...r)},get(t,n){return e.has(n)||e.set(n,x5(n)),e.get(n)}})}var Oi=HOe();function ra(e){return I.forwardRef(e)}function qOe(e={}){const{strict:t=!0,errorMessage:n="useContext: `context` is undefined. Seems you forgot to wrap component within the Provider",name:r}=e,i=I.createContext(void 0);i.displayName=r;function o(){var a;const s=I.useContext(i);if(!s&&t){const l=new Error(n);throw l.name="ContextError",(a=Error.captureStackTrace)==null||a.call(Error,l,o),l}return s}return[i.Provider,o,i]}function WOe(e){const{cssVarsRoot:t,theme:n,children:r}=e,i=I.useMemo(()=>XAe(n),[n]);return W.jsxs(RTe,{theme:i,children:[W.jsx(KOe,{root:t}),r]})}function KOe({root:e=":host, :root"}){const t=[e,"[data-theme]"].join(",");return W.jsx(AH,{styles:n=>({[t]:n.__cssVars})})}qOe({name:"StylesContext",errorMessage:"useStyles: `styles` is undefined. Seems you forgot to wrap the components in `` "});function RKe(){const{colorMode:e}=tw();return W.jsx(AH,{styles:t=>{const n=cq(t,"styles.global"),r=hq(n,{theme:t,colorMode:e});return r?LH(r)(t):void 0}})}var QOe=(e,t)=>e.find(n=>n.id===t);function QM(e,t){const n=gq(e,t),r=n?e[n].findIndex(i=>i.id===t):-1;return{position:n,index:r}}function gq(e,t){for(const[n,r]of Object.entries(e))if(QOe(r,t))return n}function XOe(e){const t=e.includes("right"),n=e.includes("left");let r="center";return t&&(r="flex-end"),n&&(r="flex-start"),{display:"flex",flexDirection:"column",alignItems:r}}function YOe(e){const n=e==="top"||e==="bottom"?"0 auto":void 0,r=e.includes("top")?"env(safe-area-inset-top, 0px)":void 0,i=e.includes("bottom")?"env(safe-area-inset-bottom, 0px)":void 0,o=e.includes("left")?void 0:"env(safe-area-inset-right, 0px)",a=e.includes("right")?void 0:"env(safe-area-inset-left, 0px)";return{position:"fixed",zIndex:"var(--toast-z-index, 5500)",pointerEvents:"none",display:"flex",flexDirection:"column",margin:n,top:r,bottom:i,right:o,left:a}}function ZOe(e,t=[]){const n=I.useRef(e);return I.useEffect(()=>{n.current=e}),I.useCallback((...r)=>{var i;return(i=n.current)==null?void 0:i.call(n,...r)},t)}function JOe(e,t){const n=ZOe(e);I.useEffect(()=>{if(t==null)return;let r=null;return r=window.setTimeout(()=>{n()},t),()=>{r&&window.clearTimeout(r)}},[t,n])}function XM(e,t){const n=I.useRef(!1),r=I.useRef(!1);I.useEffect(()=>{if(n.current&&r.current)return e();r.current=!0},t),I.useEffect(()=>(n.current=!0,()=>{n.current=!1}),[])}const mq=I.createContext({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"}),aw=I.createContext({}),My=I.createContext(null),sw=typeof document<"u",JA=sw?I.useLayoutEffect:I.useEffect,yq=I.createContext({strict:!1});function eMe(e,t,n,r){const{visualElement:i}=I.useContext(aw),o=I.useContext(yq),a=I.useContext(My),s=I.useContext(mq).reducedMotion,l=I.useRef();r=r||o.renderer,!l.current&&r&&(l.current=r(e,{visualState:t,parent:i,props:n,presenceContext:a,blockInitialAnimation:a?a.initial===!1:!1,reducedMotionConfig:s}));const u=l.current;I.useInsertionEffect(()=>{u&&u.update(n,a)});const c=I.useRef(!!window.HandoffAppearAnimations);return JA(()=>{u&&(u.render(),c.current&&u.animationState&&u.animationState.animateChanges())}),I.useEffect(()=>{u&&(u.updateFeatures(),!c.current&&u.animationState&&u.animationState.animateChanges(),window.HandoffAppearAnimations=void 0,c.current=!1)}),u}function Kf(e){return typeof e=="object"&&Object.prototype.hasOwnProperty.call(e,"current")}function tMe(e,t,n){return I.useCallback(r=>{r&&e.mount&&e.mount(r),t&&(r?t.mount(r):t.unmount()),n&&(typeof n=="function"?n(r):Kf(n)&&(n.current=r))},[t])}function P0(e){return typeof e=="string"||Array.isArray(e)}function lw(e){return typeof e=="object"&&typeof e.start=="function"}const eP=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],tP=["initial",...eP];function uw(e){return lw(e.animate)||tP.some(t=>P0(e[t]))}function vq(e){return!!(uw(e)||e.variants)}function nMe(e,t){if(uw(e)){const{initial:n,animate:r}=e;return{initial:n===!1||P0(n)?n:void 0,animate:P0(r)?r:void 0}}return e.inherit!==!1?t:{}}function rMe(e){const{initial:t,animate:n}=nMe(e,I.useContext(aw));return I.useMemo(()=>({initial:t,animate:n}),[YM(t),YM(n)])}function YM(e){return Array.isArray(e)?e.join(" "):e}const ZM={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]},I0={};for(const e in ZM)I0[e]={isEnabled:t=>ZM[e].some(n=>!!t[n])};function iMe(e){for(const t in e)I0[t]={...I0[t],...e[t]}}const nP=I.createContext({}),bq=I.createContext({}),oMe=Symbol.for("motionComponentSymbol");function aMe({preloadedFeatures:e,createVisualElement:t,useRender:n,useVisualState:r,Component:i}){e&&iMe(e);function o(s,l){let u;const c={...I.useContext(mq),...s,layoutId:sMe(s)},{isStatic:d}=c,f=rMe(s),h=r(s,d);if(!d&&sw){f.visualElement=eMe(i,h,c,t);const p=I.useContext(bq),m=I.useContext(yq).strict;f.visualElement&&(u=f.visualElement.loadFeatures(c,m,e,p))}return I.createElement(aw.Provider,{value:f},u&&f.visualElement?I.createElement(u,{visualElement:f.visualElement,...c}):null,n(i,s,tMe(h,f.visualElement,l),h,d,f.visualElement))}const a=I.forwardRef(o);return a[oMe]=i,a}function sMe({layoutId:e}){const t=I.useContext(nP).id;return t&&e!==void 0?t+"-"+e:e}function lMe(e){function t(r,i={}){return aMe(e(r,i))}if(typeof Proxy>"u")return t;const n=new Map;return new Proxy(t,{get:(r,i)=>(n.has(i)||n.set(i,t(i)),n.get(i))})}const uMe=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function rP(e){return typeof e!="string"||e.includes("-")?!1:!!(uMe.indexOf(e)>-1||/[A-Z]/.test(e))}const Q_={};function cMe(e){Object.assign(Q_,e)}const Ny=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],Jd=new Set(Ny);function _q(e,{layout:t,layoutId:n}){return Jd.has(e)||e.startsWith("origin")||(t||n!==void 0)&&(!!Q_[e]||e==="opacity")}const Mo=e=>!!(e&&e.getVelocity),dMe={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},fMe=Ny.length;function hMe(e,{enableHardwareAcceleration:t=!0,allowTransformNone:n=!0},r,i){let o="";for(let a=0;at=>typeof t=="string"&&t.startsWith(e),xq=Sq("--"),y4=Sq("var(--"),pMe=/var\s*\(\s*--[\w-]+(\s*,\s*(?:(?:[^)(]|\((?:[^)(]+|\([^)(]*\))*\))*)+)?\s*\)/g,gMe=(e,t)=>t&&typeof e=="number"?t.transform(e):e,fc=(e,t,n)=>Math.min(Math.max(n,e),t),ef={test:e=>typeof e=="number",parse:parseFloat,transform:e=>e},tm={...ef,transform:e=>fc(0,1,e)},t1={...ef,default:1},nm=e=>Math.round(e*1e5)/1e5,cw=/(-)?([\d]*\.?[\d])+/g,wq=/(#[0-9a-f]{3,8}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2}(-?[\d\.]+%?)\s*[\,\/]?\s*[\d\.]*%?\))/gi,mMe=/^(#[0-9a-f]{3,8}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2}(-?[\d\.]+%?)\s*[\,\/]?\s*[\d\.]*%?\))$/i;function $y(e){return typeof e=="string"}const Dy=e=>({test:t=>$y(t)&&t.endsWith(e)&&t.split(" ").length===1,parse:parseFloat,transform:t=>`${t}${e}`}),pu=Dy("deg"),Ws=Dy("%"),at=Dy("px"),yMe=Dy("vh"),vMe=Dy("vw"),JM={...Ws,parse:e=>Ws.parse(e)/100,transform:e=>Ws.transform(e*100)},e7={...ef,transform:Math.round},Cq={borderWidth:at,borderTopWidth:at,borderRightWidth:at,borderBottomWidth:at,borderLeftWidth:at,borderRadius:at,radius:at,borderTopLeftRadius:at,borderTopRightRadius:at,borderBottomRightRadius:at,borderBottomLeftRadius:at,width:at,maxWidth:at,height:at,maxHeight:at,size:at,top:at,right:at,bottom:at,left:at,padding:at,paddingTop:at,paddingRight:at,paddingBottom:at,paddingLeft:at,margin:at,marginTop:at,marginRight:at,marginBottom:at,marginLeft:at,rotate:pu,rotateX:pu,rotateY:pu,rotateZ:pu,scale:t1,scaleX:t1,scaleY:t1,scaleZ:t1,skew:pu,skewX:pu,skewY:pu,distance:at,translateX:at,translateY:at,translateZ:at,x:at,y:at,z:at,perspective:at,transformPerspective:at,opacity:tm,originX:JM,originY:JM,originZ:at,zIndex:e7,fillOpacity:tm,strokeOpacity:tm,numOctaves:e7};function iP(e,t,n,r){const{style:i,vars:o,transform:a,transformOrigin:s}=e;let l=!1,u=!1,c=!0;for(const d in t){const f=t[d];if(xq(d)){o[d]=f;continue}const h=Cq[d],p=gMe(f,h);if(Jd.has(d)){if(l=!0,a[d]=p,!c)continue;f!==(h.default||0)&&(c=!1)}else d.startsWith("origin")?(u=!0,s[d]=p):i[d]=p}if(t.transform||(l||r?i.transform=hMe(e.transform,n,c,r):i.transform&&(i.transform="none")),u){const{originX:d="50%",originY:f="50%",originZ:h=0}=s;i.transformOrigin=`${d} ${f} ${h}`}}const oP=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function Eq(e,t,n){for(const r in t)!Mo(t[r])&&!_q(r,n)&&(e[r]=t[r])}function bMe({transformTemplate:e},t,n){return I.useMemo(()=>{const r=oP();return iP(r,t,{enableHardwareAcceleration:!n},e),Object.assign({},r.vars,r.style)},[t])}function _Me(e,t,n){const r=e.style||{},i={};return Eq(i,r,e),Object.assign(i,bMe(e,t,n)),e.transformValues?e.transformValues(i):i}function SMe(e,t,n){const r={},i=_Me(e,t,n);return e.drag&&e.dragListener!==!1&&(r.draggable=!1,i.userSelect=i.WebkitUserSelect=i.WebkitTouchCallout="none",i.touchAction=e.drag===!0?"none":`pan-${e.drag==="x"?"y":"x"}`),e.tabIndex===void 0&&(e.onTap||e.onTapStart||e.whileTap)&&(r.tabIndex=0),r.style=i,r}const xMe=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","transformValues","custom","inherit","onLayoutAnimationStart","onLayoutAnimationComplete","onLayoutMeasure","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","ignoreStrict","viewport"]);function X_(e){return e.startsWith("while")||e.startsWith("drag")&&e!=="draggable"||e.startsWith("layout")||e.startsWith("onTap")||e.startsWith("onPan")||xMe.has(e)}let kq=e=>!X_(e);function wMe(e){e&&(kq=t=>t.startsWith("on")?!X_(t):e(t))}try{wMe(require("@emotion/is-prop-valid").default)}catch{}function CMe(e,t,n){const r={};for(const i in e)i==="values"&&typeof e.values=="object"||(kq(i)||n===!0&&X_(i)||!t&&!X_(i)||e.draggable&&i.startsWith("onDrag"))&&(r[i]=e[i]);return r}function t7(e,t,n){return typeof e=="string"?e:at.transform(t+n*e)}function EMe(e,t,n){const r=t7(t,e.x,e.width),i=t7(n,e.y,e.height);return`${r} ${i}`}const kMe={offset:"stroke-dashoffset",array:"stroke-dasharray"},TMe={offset:"strokeDashoffset",array:"strokeDasharray"};function AMe(e,t,n=1,r=0,i=!0){e.pathLength=1;const o=i?kMe:TMe;e[o.offset]=at.transform(-r);const a=at.transform(t),s=at.transform(n);e[o.array]=`${a} ${s}`}function aP(e,{attrX:t,attrY:n,attrScale:r,originX:i,originY:o,pathLength:a,pathSpacing:s=1,pathOffset:l=0,...u},c,d,f){if(iP(e,u,c,f),d){e.style.viewBox&&(e.attrs.viewBox=e.style.viewBox);return}e.attrs=e.style,e.style={};const{attrs:h,style:p,dimensions:m}=e;h.transform&&(m&&(p.transform=h.transform),delete h.transform),m&&(i!==void 0||o!==void 0||p.transform)&&(p.transformOrigin=EMe(m,i!==void 0?i:.5,o!==void 0?o:.5)),t!==void 0&&(h.x=t),n!==void 0&&(h.y=n),r!==void 0&&(h.scale=r),a!==void 0&&AMe(h,a,s,l,!1)}const Tq=()=>({...oP(),attrs:{}}),sP=e=>typeof e=="string"&&e.toLowerCase()==="svg";function PMe(e,t,n,r){const i=I.useMemo(()=>{const o=Tq();return aP(o,t,{enableHardwareAcceleration:!1},sP(r),e.transformTemplate),{...o.attrs,style:{...o.style}}},[t]);if(e.style){const o={};Eq(o,e.style,e),i.style={...o,...i.style}}return i}function IMe(e=!1){return(n,r,i,{latestValues:o},a)=>{const l=(rP(n)?PMe:SMe)(r,o,a,n),c={...CMe(r,typeof n=="string",e),...l,ref:i},{children:d}=r,f=I.useMemo(()=>Mo(d)?d.get():d,[d]);return I.createElement(n,{...c,children:f})}}const lP=e=>e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase();function Aq(e,{style:t,vars:n},r,i){Object.assign(e.style,t,i&&i.getProjectionStyles(r));for(const o in n)e.style.setProperty(o,n[o])}const Pq=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]);function Iq(e,t,n,r){Aq(e,t,void 0,r);for(const i in t.attrs)e.setAttribute(Pq.has(i)?i:lP(i),t.attrs[i])}function uP(e,t){const{style:n}=e,r={};for(const i in n)(Mo(n[i])||t.style&&Mo(t.style[i])||_q(i,e))&&(r[i]=n[i]);return r}function Rq(e,t){const n=uP(e,t);for(const r in e)if(Mo(e[r])||Mo(t[r])){const i=Ny.indexOf(r)!==-1?"attr"+r.charAt(0).toUpperCase()+r.substring(1):r;n[i]=e[r]}return n}function cP(e,t,n,r={},i={}){return typeof t=="function"&&(t=t(n!==void 0?n:e.custom,r,i)),typeof t=="string"&&(t=e.variants&&e.variants[t]),typeof t=="function"&&(t=t(n!==void 0?n:e.custom,r,i)),t}function Oq(e){const t=I.useRef(null);return t.current===null&&(t.current=e()),t.current}const Y_=e=>Array.isArray(e),RMe=e=>!!(e&&typeof e=="object"&&e.mix&&e.toValue),OMe=e=>Y_(e)?e[e.length-1]||0:e;function ib(e){const t=Mo(e)?e.get():e;return RMe(t)?t.toValue():t}function MMe({scrapeMotionValuesFromProps:e,createRenderState:t,onMount:n},r,i,o){const a={latestValues:NMe(r,i,o,e),renderState:t()};return n&&(a.mount=s=>n(r,s,a)),a}const Mq=e=>(t,n)=>{const r=I.useContext(aw),i=I.useContext(My),o=()=>MMe(e,t,r,i);return n?o():Oq(o)};function NMe(e,t,n,r){const i={},o=r(e,{});for(const f in o)i[f]=ib(o[f]);let{initial:a,animate:s}=e;const l=uw(e),u=vq(e);t&&u&&!l&&e.inherit!==!1&&(a===void 0&&(a=t.initial),s===void 0&&(s=t.animate));let c=n?n.initial===!1:!1;c=c||a===!1;const d=c?s:a;return d&&typeof d!="boolean"&&!lw(d)&&(Array.isArray(d)?d:[d]).forEach(h=>{const p=cP(e,h);if(!p)return;const{transitionEnd:m,transition:_,...b}=p;for(const v in b){let g=b[v];if(Array.isArray(g)){const y=c?g.length-1:0;g=g[y]}g!==null&&(i[v]=g)}for(const v in m)i[v]=m[v]}),i}const yr=e=>e;function $Me(e){let t=[],n=[],r=0,i=!1,o=!1;const a=new WeakSet,s={schedule:(l,u=!1,c=!1)=>{const d=c&&i,f=d?t:n;return u&&a.add(l),f.indexOf(l)===-1&&(f.push(l),d&&i&&(r=t.length)),l},cancel:l=>{const u=n.indexOf(l);u!==-1&&n.splice(u,1),a.delete(l)},process:l=>{if(i){o=!0;return}if(i=!0,[t,n]=[n,t],n.length=0,r=t.length,r)for(let u=0;u(d[f]=$Me(()=>n=!0),d),{}),a=d=>o[d].process(i),s=()=>{const d=performance.now();n=!1,i.delta=r?1e3/60:Math.max(Math.min(d-i.timestamp,DMe),1),i.timestamp=d,i.isProcessing=!0,n1.forEach(a),i.isProcessing=!1,n&&t&&(r=!1,e(s))},l=()=>{n=!0,r=!0,i.isProcessing||e(s)};return{schedule:n1.reduce((d,f)=>{const h=o[f];return d[f]=(p,m=!1,_=!1)=>(n||l(),h.schedule(p,m,_)),d},{}),cancel:d=>n1.forEach(f=>o[f].cancel(d)),state:i,steps:o}}const{schedule:$n,cancel:Ql,state:ji,steps:w5}=LMe(typeof requestAnimationFrame<"u"?requestAnimationFrame:yr,!0),FMe={useVisualState:Mq({scrapeMotionValuesFromProps:Rq,createRenderState:Tq,onMount:(e,t,{renderState:n,latestValues:r})=>{$n.read(()=>{try{n.dimensions=typeof t.getBBox=="function"?t.getBBox():t.getBoundingClientRect()}catch{n.dimensions={x:0,y:0,width:0,height:0}}}),$n.render(()=>{aP(n,r,{enableHardwareAcceleration:!1},sP(t.tagName),e.transformTemplate),Iq(t,n)})}})},BMe={useVisualState:Mq({scrapeMotionValuesFromProps:uP,createRenderState:oP})};function zMe(e,{forwardMotionProps:t=!1},n,r){return{...rP(e)?FMe:BMe,preloadedFeatures:n,useRender:IMe(t),createVisualElement:r,Component:e}}function Ol(e,t,n,r={passive:!0}){return e.addEventListener(t,n,r),()=>e.removeEventListener(t,n)}const Nq=e=>e.pointerType==="mouse"?typeof e.button!="number"||e.button<=0:e.isPrimary!==!1;function dw(e,t="page"){return{point:{x:e[t+"X"],y:e[t+"Y"]}}}const jMe=e=>t=>Nq(t)&&e(t,dw(t));function Ll(e,t,n,r){return Ol(e,t,jMe(n),r)}const UMe=(e,t)=>n=>t(e(n)),Xu=(...e)=>e.reduce(UMe);function $q(e){let t=null;return()=>{const n=()=>{t=null};return t===null?(t=e,n):!1}}const n7=$q("dragHorizontal"),r7=$q("dragVertical");function Dq(e){let t=!1;if(e==="y")t=r7();else if(e==="x")t=n7();else{const n=n7(),r=r7();n&&r?t=()=>{n(),r()}:(n&&n(),r&&r())}return t}function Lq(){const e=Dq(!0);return e?(e(),!1):!0}class Pc{constructor(t){this.isMounted=!1,this.node=t}update(){}}function i7(e,t){const n="pointer"+(t?"enter":"leave"),r="onHover"+(t?"Start":"End"),i=(o,a)=>{if(o.type==="touch"||Lq())return;const s=e.getProps();e.animationState&&s.whileHover&&e.animationState.setActive("whileHover",t),s[r]&&$n.update(()=>s[r](o,a))};return Ll(e.current,n,i,{passive:!e.getProps()[r]})}class VMe extends Pc{mount(){this.unmount=Xu(i7(this.node,!0),i7(this.node,!1))}unmount(){}}class GMe extends Pc{constructor(){super(...arguments),this.isActive=!1}onFocus(){let t=!1;try{t=this.node.current.matches(":focus-visible")}catch{t=!0}!t||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=Xu(Ol(this.node.current,"focus",()=>this.onFocus()),Ol(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}const Fq=(e,t)=>t?e===t?!0:Fq(e,t.parentElement):!1;function C5(e,t){if(!t)return;const n=new PointerEvent("pointer"+e);t(n,dw(n))}class HMe extends Pc{constructor(){super(...arguments),this.removeStartListeners=yr,this.removeEndListeners=yr,this.removeAccessibleListeners=yr,this.startPointerPress=(t,n)=>{if(this.removeEndListeners(),this.isPressing)return;const r=this.node.getProps(),o=Ll(window,"pointerup",(s,l)=>{if(!this.checkPressEnd())return;const{onTap:u,onTapCancel:c}=this.node.getProps();$n.update(()=>{Fq(this.node.current,s.target)?u&&u(s,l):c&&c(s,l)})},{passive:!(r.onTap||r.onPointerUp)}),a=Ll(window,"pointercancel",(s,l)=>this.cancelPress(s,l),{passive:!(r.onTapCancel||r.onPointerCancel)});this.removeEndListeners=Xu(o,a),this.startPress(t,n)},this.startAccessiblePress=()=>{const t=o=>{if(o.key!=="Enter"||this.isPressing)return;const a=s=>{s.key!=="Enter"||!this.checkPressEnd()||C5("up",(l,u)=>{const{onTap:c}=this.node.getProps();c&&$n.update(()=>c(l,u))})};this.removeEndListeners(),this.removeEndListeners=Ol(this.node.current,"keyup",a),C5("down",(s,l)=>{this.startPress(s,l)})},n=Ol(this.node.current,"keydown",t),r=()=>{this.isPressing&&C5("cancel",(o,a)=>this.cancelPress(o,a))},i=Ol(this.node.current,"blur",r);this.removeAccessibleListeners=Xu(n,i)}}startPress(t,n){this.isPressing=!0;const{onTapStart:r,whileTap:i}=this.node.getProps();i&&this.node.animationState&&this.node.animationState.setActive("whileTap",!0),r&&$n.update(()=>r(t,n))}checkPressEnd(){return this.removeEndListeners(),this.isPressing=!1,this.node.getProps().whileTap&&this.node.animationState&&this.node.animationState.setActive("whileTap",!1),!Lq()}cancelPress(t,n){if(!this.checkPressEnd())return;const{onTapCancel:r}=this.node.getProps();r&&$n.update(()=>r(t,n))}mount(){const t=this.node.getProps(),n=Ll(this.node.current,"pointerdown",this.startPointerPress,{passive:!(t.onTapStart||t.onPointerStart)}),r=Ol(this.node.current,"focus",this.startAccessiblePress);this.removeStartListeners=Xu(n,r)}unmount(){this.removeStartListeners(),this.removeEndListeners(),this.removeAccessibleListeners()}}const v4=new WeakMap,E5=new WeakMap,qMe=e=>{const t=v4.get(e.target);t&&t(e)},WMe=e=>{e.forEach(qMe)};function KMe({root:e,...t}){const n=e||document;E5.has(n)||E5.set(n,{});const r=E5.get(n),i=JSON.stringify(t);return r[i]||(r[i]=new IntersectionObserver(WMe,{root:e,...t})),r[i]}function QMe(e,t,n){const r=KMe(t);return v4.set(e,n),r.observe(e),()=>{v4.delete(e),r.unobserve(e)}}const XMe={some:0,all:1};class YMe extends Pc{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:t={}}=this.node.getProps(),{root:n,margin:r,amount:i="some",once:o}=t,a={root:n?n.current:void 0,rootMargin:r,threshold:typeof i=="number"?i:XMe[i]},s=l=>{const{isIntersecting:u}=l;if(this.isInView===u||(this.isInView=u,o&&!u&&this.hasEnteredView))return;u&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",u);const{onViewportEnter:c,onViewportLeave:d}=this.node.getProps(),f=u?c:d;f&&f(l)};return QMe(this.node.current,a,s)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:t,prevProps:n}=this.node;["amount","margin","root"].some(ZMe(t,n))&&this.startObserver()}unmount(){}}function ZMe({viewport:e={}},{viewport:t={}}={}){return n=>e[n]!==t[n]}const JMe={inView:{Feature:YMe},tap:{Feature:HMe},focus:{Feature:GMe},hover:{Feature:VMe}};function Bq(e,t){if(!Array.isArray(t))return!1;const n=t.length;if(n!==e.length)return!1;for(let r=0;rt[r]=n.get()),t}function t7e(e){const t={};return e.values.forEach((n,r)=>t[r]=n.getVelocity()),t}function fw(e,t,n){const r=e.getProps();return cP(r,t,n!==void 0?n:r.custom,e7e(e),t7e(e))}const n7e="framerAppearId",r7e="data-"+lP(n7e);let i7e=yr,dP=yr;const Yu=e=>e*1e3,Fl=e=>e/1e3,o7e={current:!1},zq=e=>Array.isArray(e)&&typeof e[0]=="number";function jq(e){return!!(!e||typeof e=="string"&&Uq[e]||zq(e)||Array.isArray(e)&&e.every(jq))}const Ig=([e,t,n,r])=>`cubic-bezier(${e}, ${t}, ${n}, ${r})`,Uq={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:Ig([0,.65,.55,1]),circOut:Ig([.55,0,1,.45]),backIn:Ig([.31,.01,.66,-.59]),backOut:Ig([.33,1.53,.69,.99])};function Vq(e){if(e)return zq(e)?Ig(e):Array.isArray(e)?e.map(Vq):Uq[e]}function a7e(e,t,n,{delay:r=0,duration:i,repeat:o=0,repeatType:a="loop",ease:s,times:l}={}){const u={[t]:n};l&&(u.offset=l);const c=Vq(s);return Array.isArray(c)&&(u.easing=c),e.animate(u,{delay:r,duration:i,easing:Array.isArray(c)?"linear":c,fill:"both",iterations:o+1,direction:a==="reverse"?"alternate":"normal"})}function s7e(e,{repeat:t,repeatType:n="loop"}){const r=t&&n!=="loop"&&t%2===1?0:e.length-1;return e[r]}const Gq=(e,t,n)=>(((1-3*n+3*t)*e+(3*n-6*t))*e+3*t)*e,l7e=1e-7,u7e=12;function c7e(e,t,n,r,i){let o,a,s=0;do a=t+(n-t)/2,o=Gq(a,r,i)-e,o>0?n=a:t=a;while(Math.abs(o)>l7e&&++sc7e(o,0,1,e,n);return o=>o===0||o===1?o:Gq(i(o),t,r)}const d7e=Ly(.42,0,1,1),f7e=Ly(0,0,.58,1),Hq=Ly(.42,0,.58,1),h7e=e=>Array.isArray(e)&&typeof e[0]!="number",qq=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,Wq=e=>t=>1-e(1-t),Kq=e=>1-Math.sin(Math.acos(e)),fP=Wq(Kq),p7e=qq(fP),Qq=Ly(.33,1.53,.69,.99),hP=Wq(Qq),g7e=qq(hP),m7e=e=>(e*=2)<1?.5*hP(e):.5*(2-Math.pow(2,-10*(e-1))),y7e={linear:yr,easeIn:d7e,easeInOut:Hq,easeOut:f7e,circIn:Kq,circInOut:p7e,circOut:fP,backIn:hP,backInOut:g7e,backOut:Qq,anticipate:m7e},o7=e=>{if(Array.isArray(e)){dP(e.length===4);const[t,n,r,i]=e;return Ly(t,n,r,i)}else if(typeof e=="string")return y7e[e];return e},pP=(e,t)=>n=>!!($y(n)&&mMe.test(n)&&n.startsWith(e)||t&&Object.prototype.hasOwnProperty.call(n,t)),Xq=(e,t,n)=>r=>{if(!$y(r))return r;const[i,o,a,s]=r.match(cw);return{[e]:parseFloat(i),[t]:parseFloat(o),[n]:parseFloat(a),alpha:s!==void 0?parseFloat(s):1}},v7e=e=>fc(0,255,e),k5={...ef,transform:e=>Math.round(v7e(e))},sd={test:pP("rgb","red"),parse:Xq("red","green","blue"),transform:({red:e,green:t,blue:n,alpha:r=1})=>"rgba("+k5.transform(e)+", "+k5.transform(t)+", "+k5.transform(n)+", "+nm(tm.transform(r))+")"};function b7e(e){let t="",n="",r="",i="";return e.length>5?(t=e.substring(1,3),n=e.substring(3,5),r=e.substring(5,7),i=e.substring(7,9)):(t=e.substring(1,2),n=e.substring(2,3),r=e.substring(3,4),i=e.substring(4,5),t+=t,n+=n,r+=r,i+=i),{red:parseInt(t,16),green:parseInt(n,16),blue:parseInt(r,16),alpha:i?parseInt(i,16)/255:1}}const b4={test:pP("#"),parse:b7e,transform:sd.transform},Qf={test:pP("hsl","hue"),parse:Xq("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:n,alpha:r=1})=>"hsla("+Math.round(e)+", "+Ws.transform(nm(t))+", "+Ws.transform(nm(n))+", "+nm(tm.transform(r))+")"},Zi={test:e=>sd.test(e)||b4.test(e)||Qf.test(e),parse:e=>sd.test(e)?sd.parse(e):Qf.test(e)?Qf.parse(e):b4.parse(e),transform:e=>$y(e)?e:e.hasOwnProperty("red")?sd.transform(e):Qf.transform(e)},lr=(e,t,n)=>-n*e+n*t+e;function T5(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e}function _7e({hue:e,saturation:t,lightness:n,alpha:r}){e/=360,t/=100,n/=100;let i=0,o=0,a=0;if(!t)i=o=a=n;else{const s=n<.5?n*(1+t):n+t-n*t,l=2*n-s;i=T5(l,s,e+1/3),o=T5(l,s,e),a=T5(l,s,e-1/3)}return{red:Math.round(i*255),green:Math.round(o*255),blue:Math.round(a*255),alpha:r}}const A5=(e,t,n)=>{const r=e*e;return Math.sqrt(Math.max(0,n*(t*t-r)+r))},S7e=[b4,sd,Qf],x7e=e=>S7e.find(t=>t.test(e));function a7(e){const t=x7e(e);let n=t.parse(e);return t===Qf&&(n=_7e(n)),n}const Yq=(e,t)=>{const n=a7(e),r=a7(t),i={...n};return o=>(i.red=A5(n.red,r.red,o),i.green=A5(n.green,r.green,o),i.blue=A5(n.blue,r.blue,o),i.alpha=lr(n.alpha,r.alpha,o),sd.transform(i))};function w7e(e){var t,n;return isNaN(e)&&$y(e)&&(((t=e.match(cw))===null||t===void 0?void 0:t.length)||0)+(((n=e.match(wq))===null||n===void 0?void 0:n.length)||0)>0}const Zq={regex:pMe,countKey:"Vars",token:"${v}",parse:yr},Jq={regex:wq,countKey:"Colors",token:"${c}",parse:Zi.parse},eW={regex:cw,countKey:"Numbers",token:"${n}",parse:ef.parse};function P5(e,{regex:t,countKey:n,token:r,parse:i}){const o=e.tokenised.match(t);o&&(e["num"+n]=o.length,e.tokenised=e.tokenised.replace(t,r),e.values.push(...o.map(i)))}function Z_(e){const t=e.toString(),n={value:t,tokenised:t,values:[],numVars:0,numColors:0,numNumbers:0};return n.value.includes("var(--")&&P5(n,Zq),P5(n,Jq),P5(n,eW),n}function tW(e){return Z_(e).values}function nW(e){const{values:t,numColors:n,numVars:r,tokenised:i}=Z_(e),o=t.length;return a=>{let s=i;for(let l=0;ltypeof e=="number"?0:e;function E7e(e){const t=tW(e);return nW(e)(t.map(C7e))}const hc={test:w7e,parse:tW,createTransformer:nW,getAnimatableNone:E7e},rW=(e,t)=>n=>`${n>0?t:e}`;function iW(e,t){return typeof e=="number"?n=>lr(e,t,n):Zi.test(e)?Yq(e,t):e.startsWith("var(")?rW(e,t):aW(e,t)}const oW=(e,t)=>{const n=[...e],r=n.length,i=e.map((o,a)=>iW(o,t[a]));return o=>{for(let a=0;a{const n={...e,...t},r={};for(const i in n)e[i]!==void 0&&t[i]!==void 0&&(r[i]=iW(e[i],t[i]));return i=>{for(const o in r)n[o]=r[o](i);return n}},aW=(e,t)=>{const n=hc.createTransformer(t),r=Z_(e),i=Z_(t);return r.numVars===i.numVars&&r.numColors===i.numColors&&r.numNumbers>=i.numNumbers?Xu(oW(r.values,i.values),n):rW(e,t)},R0=(e,t,n)=>{const r=t-e;return r===0?1:(n-e)/r},s7=(e,t)=>n=>lr(e,t,n);function T7e(e){return typeof e=="number"?s7:typeof e=="string"?Zi.test(e)?Yq:aW:Array.isArray(e)?oW:typeof e=="object"?k7e:s7}function A7e(e,t,n){const r=[],i=n||T7e(e[0]),o=e.length-1;for(let a=0;at[0];e[0]>e[o-1]&&(e=[...e].reverse(),t=[...t].reverse());const a=A7e(t,r,i),s=a.length,l=u=>{let c=0;if(s>1)for(;cl(fc(e[0],e[o-1],u)):l}function P7e(e,t){const n=e[e.length-1];for(let r=1;r<=t;r++){const i=R0(0,t,r);e.push(lr(n,1,i))}}function I7e(e){const t=[0];return P7e(t,e.length-1),t}function R7e(e,t){return e.map(n=>n*t)}function O7e(e,t){return e.map(()=>t||Hq).splice(0,e.length-1)}function J_({duration:e=300,keyframes:t,times:n,ease:r="easeInOut"}){const i=h7e(r)?r.map(o7):o7(r),o={done:!1,value:t[0]},a=R7e(n&&n.length===t.length?n:I7e(t),e),s=sW(a,t,{ease:Array.isArray(i)?i:O7e(t,i)});return{calculatedDuration:e,next:l=>(o.value=s(l),o.done=l>=e,o)}}function lW(e,t){return t?e*(1e3/t):0}const M7e=5;function uW(e,t,n){const r=Math.max(t-M7e,0);return lW(n-e(r),t-r)}const I5=.001,N7e=.01,l7=10,$7e=.05,D7e=1;function L7e({duration:e=800,bounce:t=.25,velocity:n=0,mass:r=1}){let i,o;i7e(e<=Yu(l7));let a=1-t;a=fc($7e,D7e,a),e=fc(N7e,l7,Fl(e)),a<1?(i=u=>{const c=u*a,d=c*e,f=c-n,h=_4(u,a),p=Math.exp(-d);return I5-f/h*p},o=u=>{const d=u*a*e,f=d*n+n,h=Math.pow(a,2)*Math.pow(u,2)*e,p=Math.exp(-d),m=_4(Math.pow(u,2),a);return(-i(u)+I5>0?-1:1)*((f-h)*p)/m}):(i=u=>{const c=Math.exp(-u*e),d=(u-n)*e+1;return-I5+c*d},o=u=>{const c=Math.exp(-u*e),d=(n-u)*(e*e);return c*d});const s=5/e,l=B7e(i,o,s);if(e=Yu(e),isNaN(l))return{stiffness:100,damping:10,duration:e};{const u=Math.pow(l,2)*r;return{stiffness:u,damping:a*2*Math.sqrt(r*u),duration:e}}}const F7e=12;function B7e(e,t,n){let r=n;for(let i=1;ie[n]!==void 0)}function U7e(e){let t={velocity:0,stiffness:100,damping:10,mass:1,isResolvedFromDuration:!1,...e};if(!u7(e,j7e)&&u7(e,z7e)){const n=L7e(e);t={...t,...n,velocity:0,mass:1},t.isResolvedFromDuration=!0}return t}function cW({keyframes:e,restDelta:t,restSpeed:n,...r}){const i=e[0],o=e[e.length-1],a={done:!1,value:i},{stiffness:s,damping:l,mass:u,velocity:c,duration:d,isResolvedFromDuration:f}=U7e(r),h=c?-Fl(c):0,p=l/(2*Math.sqrt(s*u)),m=o-i,_=Fl(Math.sqrt(s/u)),b=Math.abs(m)<5;n||(n=b?.01:2),t||(t=b?.005:.5);let v;if(p<1){const g=_4(_,p);v=y=>{const S=Math.exp(-p*_*y);return o-S*((h+p*_*m)/g*Math.sin(g*y)+m*Math.cos(g*y))}}else if(p===1)v=g=>o-Math.exp(-_*g)*(m+(h+_*m)*g);else{const g=_*Math.sqrt(p*p-1);v=y=>{const S=Math.exp(-p*_*y),w=Math.min(g*y,300);return o-S*((h+p*_*m)*Math.sinh(w)+g*m*Math.cosh(w))/g}}return{calculatedDuration:f&&d||null,next:g=>{const y=v(g);if(f)a.done=g>=d;else{let S=h;g!==0&&(p<1?S=uW(v,g,y):S=0);const w=Math.abs(S)<=n,x=Math.abs(o-y)<=t;a.done=w&&x}return a.value=a.done?o:y,a}}}function c7({keyframes:e,velocity:t=0,power:n=.8,timeConstant:r=325,bounceDamping:i=10,bounceStiffness:o=500,modifyTarget:a,min:s,max:l,restDelta:u=.5,restSpeed:c}){const d=e[0],f={done:!1,value:d},h=C=>s!==void 0&&Cl,p=C=>s===void 0?l:l===void 0||Math.abs(s-C)-m*Math.exp(-C/r),g=C=>b+v(C),y=C=>{const T=v(C),k=g(C);f.done=Math.abs(T)<=u,f.value=f.done?b:k};let S,w;const x=C=>{h(f.value)&&(S=C,w=cW({keyframes:[f.value,p(f.value)],velocity:uW(g,C,f.value),damping:i,stiffness:o,restDelta:u,restSpeed:c}))};return x(0),{calculatedDuration:null,next:C=>{let T=!1;return!w&&S===void 0&&(T=!0,y(C),x(C)),S!==void 0&&C>S?w.next(C-S):(!T&&y(C),f)}}}const V7e=e=>{const t=({timestamp:n})=>e(n);return{start:()=>$n.update(t,!0),stop:()=>Ql(t),now:()=>ji.isProcessing?ji.timestamp:performance.now()}},d7=2e4;function f7(e){let t=0;const n=50;let r=e.next(t);for(;!r.done&&t=d7?1/0:t}const G7e={decay:c7,inertia:c7,tween:J_,keyframes:J_,spring:cW};function eS({autoplay:e=!0,delay:t=0,driver:n=V7e,keyframes:r,type:i="keyframes",repeat:o=0,repeatDelay:a=0,repeatType:s="loop",onPlay:l,onStop:u,onComplete:c,onUpdate:d,...f}){let h=1,p=!1,m,_;const b=()=>{_=new Promise(B=>{m=B})};b();let v;const g=G7e[i]||J_;let y;g!==J_&&typeof r[0]!="number"&&(y=sW([0,100],r,{clamp:!1}),r=[0,100]);const S=g({...f,keyframes:r});let w;s==="mirror"&&(w=g({...f,keyframes:[...r].reverse(),velocity:-(f.velocity||0)}));let x="idle",C=null,T=null,k=null;S.calculatedDuration===null&&o&&(S.calculatedDuration=f7(S));const{calculatedDuration:P}=S;let $=1/0,O=1/0;P!==null&&($=P+a,O=$*(o+1)-a);let E=0;const A=B=>{if(T===null)return;h>0&&(T=Math.min(T,B)),h<0&&(T=Math.min(B-O/h,T)),C!==null?E=C:E=Math.round(B-T)*h;const U=E-t*(h>=0?1:-1),G=h>=0?U<0:U>O;E=Math.max(U,0),x==="finished"&&C===null&&(E=O);let Y=E,ee=S;if(o){const ne=E/$;let se=Math.floor(ne),ve=ne%1;!ve&&ne>=1&&(ve=1),ve===1&&se--,se=Math.min(se,o+1);const ce=!!(se%2);ce&&(s==="reverse"?(ve=1-ve,a&&(ve-=a/$)):s==="mirror"&&(ee=w));let bt=fc(0,1,ve);E>O&&(bt=s==="reverse"&&ce?1:0),Y=bt*$}const J=G?{done:!1,value:r[0]}:ee.next(Y);y&&(J.value=y(J.value));let{done:j}=J;!G&&P!==null&&(j=h>=0?E>=O:E<=0);const Q=C===null&&(x==="finished"||x==="running"&&j);return d&&d(J.value),Q&&M(),J},D=()=>{v&&v.stop(),v=void 0},L=()=>{x="idle",D(),m(),b(),T=k=null},M=()=>{x="finished",c&&c(),D(),m()},R=()=>{if(p)return;v||(v=n(A));const B=v.now();l&&l(),C!==null?T=B-C:(!T||x==="finished")&&(T=B),x==="finished"&&b(),k=T,C=null,x="running",v.start()};e&&R();const N={then(B,U){return _.then(B,U)},get time(){return Fl(E)},set time(B){B=Yu(B),E=B,C!==null||!v||h===0?C=B:T=v.now()-B/h},get duration(){const B=S.calculatedDuration===null?f7(S):S.calculatedDuration;return Fl(B)},get speed(){return h},set speed(B){B===h||!v||(h=B,N.time=Fl(E))},get state(){return x},play:R,pause:()=>{x="paused",C=E},stop:()=>{p=!0,x!=="idle"&&(x="idle",u&&u(),L())},cancel:()=>{k!==null&&A(k),L()},complete:()=>{x="finished"},sample:B=>(T=0,A(B))};return N}function H7e(e){let t;return()=>(t===void 0&&(t=e()),t)}const q7e=H7e(()=>Object.hasOwnProperty.call(Element.prototype,"animate")),W7e=new Set(["opacity","clipPath","filter","transform","backgroundColor"]),r1=10,K7e=2e4,Q7e=(e,t)=>t.type==="spring"||e==="backgroundColor"||!jq(t.ease);function X7e(e,t,{onUpdate:n,onComplete:r,...i}){if(!(q7e()&&W7e.has(t)&&!i.repeatDelay&&i.repeatType!=="mirror"&&i.damping!==0&&i.type!=="inertia"))return!1;let a=!1,s,l;const u=()=>{l=new Promise(v=>{s=v})};u();let{keyframes:c,duration:d=300,ease:f,times:h}=i;if(Q7e(t,i)){const v=eS({...i,repeat:0,delay:0});let g={done:!1,value:c[0]};const y=[];let S=0;for(;!g.done&&Sp.cancel(),_=()=>{$n.update(m),s(),u()};return p.onfinish=()=>{e.set(s7e(c,i)),r&&r(),_()},{then(v,g){return l.then(v,g)},attachTimeline(v){return p.timeline=v,p.onfinish=null,yr},get time(){return Fl(p.currentTime||0)},set time(v){p.currentTime=Yu(v)},get speed(){return p.playbackRate},set speed(v){p.playbackRate=v},get duration(){return Fl(d)},play:()=>{a||(p.play(),Ql(m))},pause:()=>p.pause(),stop:()=>{if(a=!0,p.playState==="idle")return;const{currentTime:v}=p;if(v){const g=eS({...i,autoplay:!1});e.setWithVelocity(g.sample(v-r1).value,g.sample(v).value,r1)}_()},complete:()=>p.finish(),cancel:_}}function Y7e({keyframes:e,delay:t,onUpdate:n,onComplete:r}){const i=()=>(n&&n(e[e.length-1]),r&&r(),{time:0,speed:1,duration:0,play:yr,pause:yr,stop:yr,then:o=>(o(),Promise.resolve()),cancel:yr,complete:yr});return t?eS({keyframes:[0,1],duration:0,delay:t,onComplete:i}):i()}const Z7e={type:"spring",stiffness:500,damping:25,restSpeed:10},J7e=e=>({type:"spring",stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),eNe={type:"keyframes",duration:.8},tNe={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},nNe=(e,{keyframes:t})=>t.length>2?eNe:Jd.has(e)?e.startsWith("scale")?J7e(t[1]):Z7e:tNe,S4=(e,t)=>e==="zIndex"?!1:!!(typeof t=="number"||Array.isArray(t)||typeof t=="string"&&(hc.test(t)||t==="0")&&!t.startsWith("url(")),rNe=new Set(["brightness","contrast","saturate","opacity"]);function iNe(e){const[t,n]=e.slice(0,-1).split("(");if(t==="drop-shadow")return e;const[r]=n.match(cw)||[];if(!r)return e;const i=n.replace(r,"");let o=rNe.has(t)?1:0;return r!==n&&(o*=100),t+"("+o+i+")"}const oNe=/([a-z-]*)\(.*?\)/g,x4={...hc,getAnimatableNone:e=>{const t=e.match(oNe);return t?t.map(iNe).join(" "):e}},aNe={...Cq,color:Zi,backgroundColor:Zi,outlineColor:Zi,fill:Zi,stroke:Zi,borderColor:Zi,borderTopColor:Zi,borderRightColor:Zi,borderBottomColor:Zi,borderLeftColor:Zi,filter:x4,WebkitFilter:x4},gP=e=>aNe[e];function dW(e,t){let n=gP(e);return n!==x4&&(n=hc),n.getAnimatableNone?n.getAnimatableNone(t):void 0}const fW=e=>/^0[^.\s]+$/.test(e);function sNe(e){if(typeof e=="number")return e===0;if(e!==null)return e==="none"||e==="0"||fW(e)}function lNe(e,t,n,r){const i=S4(t,n);let o;Array.isArray(n)?o=[...n]:o=[null,n];const a=r.from!==void 0?r.from:e.get();let s;const l=[];for(let u=0;ui=>{const o=hW(r,e)||{},a=o.delay||r.delay||0;let{elapsed:s=0}=r;s=s-Yu(a);const l=lNe(t,e,n,o),u=l[0],c=l[l.length-1],d=S4(e,u),f=S4(e,c);let h={keyframes:l,velocity:t.getVelocity(),ease:"easeOut",...o,delay:-s,onUpdate:p=>{t.set(p),o.onUpdate&&o.onUpdate(p)},onComplete:()=>{i(),o.onComplete&&o.onComplete()}};if(uNe(o)||(h={...h,...nNe(e,h)}),h.duration&&(h.duration=Yu(h.duration)),h.repeatDelay&&(h.repeatDelay=Yu(h.repeatDelay)),!d||!f||o7e.current||o.type===!1)return Y7e(h);if(t.owner&&t.owner.current instanceof HTMLElement&&!t.owner.getProps().onUpdate){const p=X7e(t,e,h);if(p)return p}return eS(h)};function tS(e){return!!(Mo(e)&&e.add)}const pW=e=>/^\-?\d*\.?\d+$/.test(e);function yP(e,t){e.indexOf(t)===-1&&e.push(t)}function vP(e,t){const n=e.indexOf(t);n>-1&&e.splice(n,1)}class bP{constructor(){this.subscriptions=[]}add(t){return yP(this.subscriptions,t),()=>vP(this.subscriptions,t)}notify(t,n,r){const i=this.subscriptions.length;if(i)if(i===1)this.subscriptions[0](t,n,r);else for(let o=0;o!isNaN(parseFloat(e));class dNe{constructor(t,n={}){this.version="10.16.1",this.timeDelta=0,this.lastUpdated=0,this.canTrackVelocity=!1,this.events={},this.updateAndNotify=(r,i=!0)=>{this.prev=this.current,this.current=r;const{delta:o,timestamp:a}=ji;this.lastUpdated!==a&&(this.timeDelta=o,this.lastUpdated=a,$n.postRender(this.scheduleVelocityCheck)),this.prev!==this.current&&this.events.change&&this.events.change.notify(this.current),this.events.velocityChange&&this.events.velocityChange.notify(this.getVelocity()),i&&this.events.renderRequest&&this.events.renderRequest.notify(this.current)},this.scheduleVelocityCheck=()=>$n.postRender(this.velocityCheck),this.velocityCheck=({timestamp:r})=>{r!==this.lastUpdated&&(this.prev=this.current,this.events.velocityChange&&this.events.velocityChange.notify(this.getVelocity()))},this.hasAnimated=!1,this.prev=this.current=t,this.canTrackVelocity=cNe(this.current),this.owner=n.owner}onChange(t){return this.on("change",t)}on(t,n){this.events[t]||(this.events[t]=new bP);const r=this.events[t].add(n);return t==="change"?()=>{r(),$n.read(()=>{this.events.change.getSize()||this.stop()})}:r}clearListeners(){for(const t in this.events)this.events[t].clear()}attach(t,n){this.passiveEffect=t,this.stopPassiveEffect=n}set(t,n=!0){!n||!this.passiveEffect?this.updateAndNotify(t,n):this.passiveEffect(t,this.updateAndNotify)}setWithVelocity(t,n,r){this.set(n),this.prev=t,this.timeDelta=r}jump(t){this.updateAndNotify(t),this.prev=t,this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}get(){return this.current}getPrevious(){return this.prev}getVelocity(){return this.canTrackVelocity?lW(parseFloat(this.current)-parseFloat(this.prev),this.timeDelta):0}start(t){return this.stop(),new Promise(n=>{this.hasAnimated=!0,this.animation=t(n),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function up(e,t){return new dNe(e,t)}const gW=e=>t=>t.test(e),fNe={test:e=>e==="auto",parse:e=>e},mW=[ef,at,Ws,pu,vMe,yMe,fNe],lg=e=>mW.find(gW(e)),hNe=[...mW,Zi,hc],pNe=e=>hNe.find(gW(e));function gNe(e,t,n){e.hasValue(t)?e.getValue(t).set(n):e.addValue(t,up(n))}function mNe(e,t){const n=fw(e,t);let{transitionEnd:r={},transition:i={},...o}=n?e.makeTargetAnimatable(n,!1):{};o={...o,...r};for(const a in o){const s=OMe(o[a]);gNe(e,a,s)}}function yNe(e,t,n){var r,i;const o=Object.keys(t).filter(s=>!e.hasValue(s)),a=o.length;if(a)for(let s=0;sl.remove(d))),u.push(m)}return a&&Promise.all(u).then(()=>{a&&mNe(e,a)}),u}function w4(e,t,n={}){const r=fw(e,t,n.custom);let{transition:i=e.getDefaultTransition()||{}}=r||{};n.transitionOverride&&(i=n.transitionOverride);const o=r?()=>Promise.all(yW(e,r,n)):()=>Promise.resolve(),a=e.variantChildren&&e.variantChildren.size?(l=0)=>{const{delayChildren:u=0,staggerChildren:c,staggerDirection:d}=i;return SNe(e,t,u+l,c,d,n)}:()=>Promise.resolve(),{when:s}=i;if(s){const[l,u]=s==="beforeChildren"?[o,a]:[a,o];return l().then(()=>u())}else return Promise.all([o(),a(n.delay)])}function SNe(e,t,n=0,r=0,i=1,o){const a=[],s=(e.variantChildren.size-1)*r,l=i===1?(u=0)=>u*r:(u=0)=>s-u*r;return Array.from(e.variantChildren).sort(xNe).forEach((u,c)=>{u.notify("AnimationStart",t),a.push(w4(u,t,{...o,delay:n+l(c)}).then(()=>u.notify("AnimationComplete",t)))}),Promise.all(a)}function xNe(e,t){return e.sortNodePosition(t)}function wNe(e,t,n={}){e.notify("AnimationStart",t);let r;if(Array.isArray(t)){const i=t.map(o=>w4(e,o,n));r=Promise.all(i)}else if(typeof t=="string")r=w4(e,t,n);else{const i=typeof t=="function"?fw(e,t,n.custom):t;r=Promise.all(yW(e,i,n))}return r.then(()=>e.notify("AnimationComplete",t))}const CNe=[...eP].reverse(),ENe=eP.length;function kNe(e){return t=>Promise.all(t.map(({animation:n,options:r})=>wNe(e,n,r)))}function TNe(e){let t=kNe(e);const n=PNe();let r=!0;const i=(l,u)=>{const c=fw(e,u);if(c){const{transition:d,transitionEnd:f,...h}=c;l={...l,...h,...f}}return l};function o(l){t=l(e)}function a(l,u){const c=e.getProps(),d=e.getVariantContext(!0)||{},f=[],h=new Set;let p={},m=1/0;for(let b=0;bm&&S;const k=Array.isArray(y)?y:[y];let P=k.reduce(i,{});w===!1&&(P={});const{prevResolvedValues:$={}}=g,O={...$,...P},E=A=>{T=!0,h.delete(A),g.needsAnimating[A]=!0};for(const A in O){const D=P[A],L=$[A];p.hasOwnProperty(A)||(D!==L?Y_(D)&&Y_(L)?!Bq(D,L)||C?E(A):g.protectedKeys[A]=!0:D!==void 0?E(A):h.add(A):D!==void 0&&h.has(A)?E(A):g.protectedKeys[A]=!0)}g.prevProp=y,g.prevResolvedValues=P,g.isActive&&(p={...p,...P}),r&&e.blockInitialAnimation&&(T=!1),T&&!x&&f.push(...k.map(A=>({animation:A,options:{type:v,...l}})))}if(h.size){const b={};h.forEach(v=>{const g=e.getBaseTarget(v);g!==void 0&&(b[v]=g)}),f.push({animation:b})}let _=!!f.length;return r&&c.initial===!1&&!e.manuallyAnimateOnMount&&(_=!1),r=!1,_?t(f):Promise.resolve()}function s(l,u,c){var d;if(n[l].isActive===u)return Promise.resolve();(d=e.variantChildren)===null||d===void 0||d.forEach(h=>{var p;return(p=h.animationState)===null||p===void 0?void 0:p.setActive(l,u)}),n[l].isActive=u;const f=a(c,l);for(const h in n)n[h].protectedKeys={};return f}return{animateChanges:a,setActive:s,setAnimateFunction:o,getState:()=>n}}function ANe(e,t){return typeof t=="string"?t!==e:Array.isArray(t)?!Bq(t,e):!1}function Lc(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function PNe(){return{animate:Lc(!0),whileInView:Lc(),whileHover:Lc(),whileTap:Lc(),whileDrag:Lc(),whileFocus:Lc(),exit:Lc()}}class INe extends Pc{constructor(t){super(t),t.animationState||(t.animationState=TNe(t))}updateAnimationControlsSubscription(){const{animate:t}=this.node.getProps();this.unmount(),lw(t)&&(this.unmount=t.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:t}=this.node.getProps(),{animate:n}=this.node.prevProps||{};t!==n&&this.updateAnimationControlsSubscription()}unmount(){}}let RNe=0;class ONe extends Pc{constructor(){super(...arguments),this.id=RNe++}update(){if(!this.node.presenceContext)return;const{isPresent:t,onExitComplete:n,custom:r}=this.node.presenceContext,{isPresent:i}=this.node.prevPresenceContext||{};if(!this.node.animationState||t===i)return;const o=this.node.animationState.setActive("exit",!t,{custom:r??this.node.getProps().custom});n&&!t&&o.then(()=>n(this.id))}mount(){const{register:t}=this.node.presenceContext||{};t&&(this.unmount=t(this.id))}unmount(){}}const MNe={animation:{Feature:INe},exit:{Feature:ONe}},h7=(e,t)=>Math.abs(e-t);function NNe(e,t){const n=h7(e.x,t.x),r=h7(e.y,t.y);return Math.sqrt(n**2+r**2)}class vW{constructor(t,n,{transformPagePoint:r}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const u=O5(this.lastMoveEventInfo,this.history),c=this.startEvent!==null,d=NNe(u.offset,{x:0,y:0})>=3;if(!c&&!d)return;const{point:f}=u,{timestamp:h}=ji;this.history.push({...f,timestamp:h});const{onStart:p,onMove:m}=this.handlers;c||(p&&p(this.lastMoveEvent,u),this.startEvent=this.lastMoveEvent),m&&m(this.lastMoveEvent,u)},this.handlePointerMove=(u,c)=>{this.lastMoveEvent=u,this.lastMoveEventInfo=R5(c,this.transformPagePoint),$n.update(this.updatePoint,!0)},this.handlePointerUp=(u,c)=>{if(this.end(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const{onEnd:d,onSessionEnd:f}=this.handlers,h=O5(u.type==="pointercancel"?this.lastMoveEventInfo:R5(c,this.transformPagePoint),this.history);this.startEvent&&d&&d(u,h),f&&f(u,h)},!Nq(t))return;this.handlers=n,this.transformPagePoint=r;const i=dw(t),o=R5(i,this.transformPagePoint),{point:a}=o,{timestamp:s}=ji;this.history=[{...a,timestamp:s}];const{onSessionStart:l}=n;l&&l(t,O5(o,this.history)),this.removeListeners=Xu(Ll(window,"pointermove",this.handlePointerMove),Ll(window,"pointerup",this.handlePointerUp),Ll(window,"pointercancel",this.handlePointerUp))}updateHandlers(t){this.handlers=t}end(){this.removeListeners&&this.removeListeners(),Ql(this.updatePoint)}}function R5(e,t){return t?{point:t(e.point)}:e}function p7(e,t){return{x:e.x-t.x,y:e.y-t.y}}function O5({point:e},t){return{point:e,delta:p7(e,bW(t)),offset:p7(e,$Ne(t)),velocity:DNe(t,.1)}}function $Ne(e){return e[0]}function bW(e){return e[e.length-1]}function DNe(e,t){if(e.length<2)return{x:0,y:0};let n=e.length-1,r=null;const i=bW(e);for(;n>=0&&(r=e[n],!(i.timestamp-r.timestamp>Yu(t)));)n--;if(!r)return{x:0,y:0};const o=Fl(i.timestamp-r.timestamp);if(o===0)return{x:0,y:0};const a={x:(i.x-r.x)/o,y:(i.y-r.y)/o};return a.x===1/0&&(a.x=0),a.y===1/0&&(a.y=0),a}function Jo(e){return e.max-e.min}function C4(e,t=0,n=.01){return Math.abs(e-t)<=n}function g7(e,t,n,r=.5){e.origin=r,e.originPoint=lr(t.min,t.max,e.origin),e.scale=Jo(n)/Jo(t),(C4(e.scale,1,1e-4)||isNaN(e.scale))&&(e.scale=1),e.translate=lr(n.min,n.max,e.origin)-e.originPoint,(C4(e.translate)||isNaN(e.translate))&&(e.translate=0)}function rm(e,t,n,r){g7(e.x,t.x,n.x,r?r.originX:void 0),g7(e.y,t.y,n.y,r?r.originY:void 0)}function m7(e,t,n){e.min=n.min+t.min,e.max=e.min+Jo(t)}function LNe(e,t,n){m7(e.x,t.x,n.x),m7(e.y,t.y,n.y)}function y7(e,t,n){e.min=t.min-n.min,e.max=e.min+Jo(t)}function im(e,t,n){y7(e.x,t.x,n.x),y7(e.y,t.y,n.y)}function FNe(e,{min:t,max:n},r){return t!==void 0&&en&&(e=r?lr(n,e,r.max):Math.min(e,n)),e}function v7(e,t,n){return{min:t!==void 0?e.min+t:void 0,max:n!==void 0?e.max+n-(e.max-e.min):void 0}}function BNe(e,{top:t,left:n,bottom:r,right:i}){return{x:v7(e.x,n,i),y:v7(e.y,t,r)}}function b7(e,t){let n=t.min-e.min,r=t.max-e.max;return t.max-t.minr?n=R0(t.min,t.max-r,e.min):r>i&&(n=R0(e.min,e.max-i,t.min)),fc(0,1,n)}function UNe(e,t){const n={};return t.min!==void 0&&(n.min=t.min-e.min),t.max!==void 0&&(n.max=t.max-e.min),n}const E4=.35;function VNe(e=E4){return e===!1?e=0:e===!0&&(e=E4),{x:_7(e,"left","right"),y:_7(e,"top","bottom")}}function _7(e,t,n){return{min:S7(e,t),max:S7(e,n)}}function S7(e,t){return typeof e=="number"?e:e[t]||0}const x7=()=>({translate:0,scale:1,origin:0,originPoint:0}),Xf=()=>({x:x7(),y:x7()}),w7=()=>({min:0,max:0}),Nr=()=>({x:w7(),y:w7()});function Ss(e){return[e("x"),e("y")]}function _W({top:e,left:t,right:n,bottom:r}){return{x:{min:t,max:n},y:{min:e,max:r}}}function GNe({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}function HNe(e,t){if(!t)return e;const n=t({x:e.left,y:e.top}),r=t({x:e.right,y:e.bottom});return{top:n.y,left:n.x,bottom:r.y,right:r.x}}function M5(e){return e===void 0||e===1}function k4({scale:e,scaleX:t,scaleY:n}){return!M5(e)||!M5(t)||!M5(n)}function Vc(e){return k4(e)||SW(e)||e.z||e.rotate||e.rotateX||e.rotateY}function SW(e){return C7(e.x)||C7(e.y)}function C7(e){return e&&e!=="0%"}function nS(e,t,n){const r=e-n,i=t*r;return n+i}function E7(e,t,n,r,i){return i!==void 0&&(e=nS(e,i,r)),nS(e,n,r)+t}function T4(e,t=0,n=1,r,i){e.min=E7(e.min,t,n,r,i),e.max=E7(e.max,t,n,r,i)}function xW(e,{x:t,y:n}){T4(e.x,t.translate,t.scale,t.originPoint),T4(e.y,n.translate,n.scale,n.originPoint)}function qNe(e,t,n,r=!1){const i=n.length;if(!i)return;t.x=t.y=1;let o,a;for(let s=0;s1.0000000000001||e<.999999999999?e:1}function bu(e,t){e.min=e.min+t,e.max=e.max+t}function T7(e,t,[n,r,i]){const o=t[i]!==void 0?t[i]:.5,a=lr(e.min,e.max,o);T4(e,t[n],t[r],a,t.scale)}const WNe=["x","scaleX","originX"],KNe=["y","scaleY","originY"];function Yf(e,t){T7(e.x,t,WNe),T7(e.y,t,KNe)}function wW(e,t){return _W(HNe(e.getBoundingClientRect(),t))}function QNe(e,t,n){const r=wW(e,n),{scroll:i}=t;return i&&(bu(r.x,i.offset.x),bu(r.y,i.offset.y)),r}const XNe=new WeakMap;class YNe{constructor(t){this.openGlobalLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=Nr(),this.visualElement=t}start(t,{snapToCursor:n=!1}={}){const{presenceContext:r}=this.visualElement;if(r&&r.isPresent===!1)return;const i=l=>{this.stopAnimation(),n&&this.snapToCursor(dw(l,"page").point)},o=(l,u)=>{const{drag:c,dragPropagation:d,onDragStart:f}=this.getProps();if(c&&!d&&(this.openGlobalLock&&this.openGlobalLock(),this.openGlobalLock=Dq(c),!this.openGlobalLock))return;this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),Ss(p=>{let m=this.getAxisMotionValue(p).get()||0;if(Ws.test(m)){const{projection:_}=this.visualElement;if(_&&_.layout){const b=_.layout.layoutBox[p];b&&(m=Jo(b)*(parseFloat(m)/100))}}this.originPoint[p]=m}),f&&$n.update(()=>f(l,u),!1,!0);const{animationState:h}=this.visualElement;h&&h.setActive("whileDrag",!0)},a=(l,u)=>{const{dragPropagation:c,dragDirectionLock:d,onDirectionLock:f,onDrag:h}=this.getProps();if(!c&&!this.openGlobalLock)return;const{offset:p}=u;if(d&&this.currentDirection===null){this.currentDirection=ZNe(p),this.currentDirection!==null&&f&&f(this.currentDirection);return}this.updateAxis("x",u.point,p),this.updateAxis("y",u.point,p),this.visualElement.render(),h&&h(l,u)},s=(l,u)=>this.stop(l,u);this.panSession=new vW(t,{onSessionStart:i,onStart:o,onMove:a,onSessionEnd:s},{transformPagePoint:this.visualElement.getTransformPagePoint()})}stop(t,n){const r=this.isDragging;if(this.cancel(),!r)return;const{velocity:i}=n;this.startAnimation(i);const{onDragEnd:o}=this.getProps();o&&$n.update(()=>o(t,n))}cancel(){this.isDragging=!1;const{projection:t,animationState:n}=this.visualElement;t&&(t.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;const{dragPropagation:r}=this.getProps();!r&&this.openGlobalLock&&(this.openGlobalLock(),this.openGlobalLock=null),n&&n.setActive("whileDrag",!1)}updateAxis(t,n,r){const{drag:i}=this.getProps();if(!r||!i1(t,i,this.currentDirection))return;const o=this.getAxisMotionValue(t);let a=this.originPoint[t]+r[t];this.constraints&&this.constraints[t]&&(a=FNe(a,this.constraints[t],this.elastic[t])),o.set(a)}resolveConstraints(){const{dragConstraints:t,dragElastic:n}=this.getProps(),{layout:r}=this.visualElement.projection||{},i=this.constraints;t&&Kf(t)?this.constraints||(this.constraints=this.resolveRefConstraints()):t&&r?this.constraints=BNe(r.layoutBox,t):this.constraints=!1,this.elastic=VNe(n),i!==this.constraints&&r&&this.constraints&&!this.hasMutatedConstraints&&Ss(o=>{this.getAxisMotionValue(o)&&(this.constraints[o]=UNe(r.layoutBox[o],this.constraints[o]))})}resolveRefConstraints(){const{dragConstraints:t,onMeasureDragConstraints:n}=this.getProps();if(!t||!Kf(t))return!1;const r=t.current,{projection:i}=this.visualElement;if(!i||!i.layout)return!1;const o=QNe(r,i.root,this.visualElement.getTransformPagePoint());let a=zNe(i.layout.layoutBox,o);if(n){const s=n(GNe(a));this.hasMutatedConstraints=!!s,s&&(a=_W(s))}return a}startAnimation(t){const{drag:n,dragMomentum:r,dragElastic:i,dragTransition:o,dragSnapToOrigin:a,onDragTransitionEnd:s}=this.getProps(),l=this.constraints||{},u=Ss(c=>{if(!i1(c,n,this.currentDirection))return;let d=l&&l[c]||{};a&&(d={min:0,max:0});const f=i?200:1e6,h=i?40:1e7,p={type:"inertia",velocity:r?t[c]:0,bounceStiffness:f,bounceDamping:h,timeConstant:750,restDelta:1,restSpeed:10,...o,...d};return this.startAxisValueAnimation(c,p)});return Promise.all(u).then(s)}startAxisValueAnimation(t,n){const r=this.getAxisMotionValue(t);return r.start(mP(t,r,0,n))}stopAnimation(){Ss(t=>this.getAxisMotionValue(t).stop())}getAxisMotionValue(t){const n="_drag"+t.toUpperCase(),r=this.visualElement.getProps(),i=r[n];return i||this.visualElement.getValue(t,(r.initial?r.initial[t]:void 0)||0)}snapToCursor(t){Ss(n=>{const{drag:r}=this.getProps();if(!i1(n,r,this.currentDirection))return;const{projection:i}=this.visualElement,o=this.getAxisMotionValue(n);if(i&&i.layout){const{min:a,max:s}=i.layout.layoutBox[n];o.set(t[n]-lr(a,s,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:t,dragConstraints:n}=this.getProps(),{projection:r}=this.visualElement;if(!Kf(n)||!r||!this.constraints)return;this.stopAnimation();const i={x:0,y:0};Ss(a=>{const s=this.getAxisMotionValue(a);if(s){const l=s.get();i[a]=jNe({min:l,max:l},this.constraints[a])}});const{transformTemplate:o}=this.visualElement.getProps();this.visualElement.current.style.transform=o?o({},""):"none",r.root&&r.root.updateScroll(),r.updateLayout(),this.resolveConstraints(),Ss(a=>{if(!i1(a,t,null))return;const s=this.getAxisMotionValue(a),{min:l,max:u}=this.constraints[a];s.set(lr(l,u,i[a]))})}addListeners(){if(!this.visualElement.current)return;XNe.set(this.visualElement,this);const t=this.visualElement.current,n=Ll(t,"pointerdown",l=>{const{drag:u,dragListener:c=!0}=this.getProps();u&&c&&this.start(l)}),r=()=>{const{dragConstraints:l}=this.getProps();Kf(l)&&(this.constraints=this.resolveRefConstraints())},{projection:i}=this.visualElement,o=i.addEventListener("measure",r);i&&!i.layout&&(i.root&&i.root.updateScroll(),i.updateLayout()),r();const a=Ol(window,"resize",()=>this.scalePositionWithinConstraints()),s=i.addEventListener("didUpdate",({delta:l,hasLayoutChanged:u})=>{this.isDragging&&u&&(Ss(c=>{const d=this.getAxisMotionValue(c);d&&(this.originPoint[c]+=l[c].translate,d.set(d.get()+l[c].translate))}),this.visualElement.render())});return()=>{a(),n(),o(),s&&s()}}getProps(){const t=this.visualElement.getProps(),{drag:n=!1,dragDirectionLock:r=!1,dragPropagation:i=!1,dragConstraints:o=!1,dragElastic:a=E4,dragMomentum:s=!0}=t;return{...t,drag:n,dragDirectionLock:r,dragPropagation:i,dragConstraints:o,dragElastic:a,dragMomentum:s}}}function i1(e,t,n){return(t===!0||t===e)&&(n===null||n===e)}function ZNe(e,t=10){let n=null;return Math.abs(e.y)>t?n="y":Math.abs(e.x)>t&&(n="x"),n}class JNe extends Pc{constructor(t){super(t),this.removeGroupControls=yr,this.removeListeners=yr,this.controls=new YNe(t)}mount(){const{dragControls:t}=this.node.getProps();t&&(this.removeGroupControls=t.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||yr}unmount(){this.removeGroupControls(),this.removeListeners()}}const A7=e=>(t,n)=>{e&&$n.update(()=>e(t,n))};class e$e extends Pc{constructor(){super(...arguments),this.removePointerDownListener=yr}onPointerDown(t){this.session=new vW(t,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint()})}createPanHandlers(){const{onPanSessionStart:t,onPanStart:n,onPan:r,onPanEnd:i}=this.node.getProps();return{onSessionStart:A7(t),onStart:A7(n),onMove:r,onEnd:(o,a)=>{delete this.session,i&&$n.update(()=>i(o,a))}}}mount(){this.removePointerDownListener=Ll(this.node.current,"pointerdown",t=>this.onPointerDown(t))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}function t$e(){const e=I.useContext(My);if(e===null)return[!0,null];const{isPresent:t,onExitComplete:n,register:r}=e,i=I.useId();return I.useEffect(()=>r(i),[]),!t&&n?[!1,()=>n&&n(i)]:[!0]}function n$e(){return r$e(I.useContext(My))}function r$e(e){return e===null?!0:e.isPresent}const ob={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function P7(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}const ug={correct:(e,t)=>{if(!t.target)return e;if(typeof e=="string")if(at.test(e))e=parseFloat(e);else return e;const n=P7(e,t.target.x),r=P7(e,t.target.y);return`${n}% ${r}%`}},i$e={correct:(e,{treeScale:t,projectionDelta:n})=>{const r=e,i=hc.parse(e);if(i.length>5)return r;const o=hc.createTransformer(e),a=typeof i[0]!="number"?1:0,s=n.x.scale*t.x,l=n.y.scale*t.y;i[0+a]/=s,i[1+a]/=l;const u=lr(s,l,.5);return typeof i[2+a]=="number"&&(i[2+a]/=u),typeof i[3+a]=="number"&&(i[3+a]/=u),o(i)}};class o$e extends En.Component{componentDidMount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:r,layoutId:i}=this.props,{projection:o}=t;cMe(a$e),o&&(n.group&&n.group.add(o),r&&r.register&&i&&r.register(o),o.root.didUpdate(),o.addEventListener("animationComplete",()=>{this.safeToRemove()}),o.setOptions({...o.options,onExitComplete:()=>this.safeToRemove()})),ob.hasEverUpdated=!0}getSnapshotBeforeUpdate(t){const{layoutDependency:n,visualElement:r,drag:i,isPresent:o}=this.props,a=r.projection;return a&&(a.isPresent=o,i||t.layoutDependency!==n||n===void 0?a.willUpdate():this.safeToRemove(),t.isPresent!==o&&(o?a.promote():a.relegate()||$n.postRender(()=>{const s=a.getStack();(!s||!s.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:t}=this.props.visualElement;t&&(t.root.didUpdate(),queueMicrotask(()=>{!t.currentAnimation&&t.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:r}=this.props,{projection:i}=t;i&&(i.scheduleCheckAfterUnmount(),n&&n.group&&n.group.remove(i),r&&r.deregister&&r.deregister(i))}safeToRemove(){const{safeToRemove:t}=this.props;t&&t()}render(){return null}}function CW(e){const[t,n]=t$e(),r=I.useContext(nP);return En.createElement(o$e,{...e,layoutGroup:r,switchLayoutGroup:I.useContext(bq),isPresent:t,safeToRemove:n})}const a$e={borderRadius:{...ug,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:ug,borderTopRightRadius:ug,borderBottomLeftRadius:ug,borderBottomRightRadius:ug,boxShadow:i$e},EW=["TopLeft","TopRight","BottomLeft","BottomRight"],s$e=EW.length,I7=e=>typeof e=="string"?parseFloat(e):e,R7=e=>typeof e=="number"||at.test(e);function l$e(e,t,n,r,i,o){i?(e.opacity=lr(0,n.opacity!==void 0?n.opacity:1,u$e(r)),e.opacityExit=lr(t.opacity!==void 0?t.opacity:1,0,c$e(r))):o&&(e.opacity=lr(t.opacity!==void 0?t.opacity:1,n.opacity!==void 0?n.opacity:1,r));for(let a=0;art?1:n(R0(e,t,r))}function M7(e,t){e.min=t.min,e.max=t.max}function ua(e,t){M7(e.x,t.x),M7(e.y,t.y)}function N7(e,t,n,r,i){return e-=t,e=nS(e,1/n,r),i!==void 0&&(e=nS(e,1/i,r)),e}function d$e(e,t=0,n=1,r=.5,i,o=e,a=e){if(Ws.test(t)&&(t=parseFloat(t),t=lr(a.min,a.max,t/100)-a.min),typeof t!="number")return;let s=lr(o.min,o.max,r);e===o&&(s-=t),e.min=N7(e.min,t,n,s,i),e.max=N7(e.max,t,n,s,i)}function $7(e,t,[n,r,i],o,a){d$e(e,t[n],t[r],t[i],t.scale,o,a)}const f$e=["x","scaleX","originX"],h$e=["y","scaleY","originY"];function D7(e,t,n,r){$7(e.x,t,f$e,n?n.x:void 0,r?r.x:void 0),$7(e.y,t,h$e,n?n.y:void 0,r?r.y:void 0)}function L7(e){return e.translate===0&&e.scale===1}function TW(e){return L7(e.x)&&L7(e.y)}function p$e(e,t){return e.x.min===t.x.min&&e.x.max===t.x.max&&e.y.min===t.y.min&&e.y.max===t.y.max}function AW(e,t){return Math.round(e.x.min)===Math.round(t.x.min)&&Math.round(e.x.max)===Math.round(t.x.max)&&Math.round(e.y.min)===Math.round(t.y.min)&&Math.round(e.y.max)===Math.round(t.y.max)}function F7(e){return Jo(e.x)/Jo(e.y)}class g$e{constructor(){this.members=[]}add(t){yP(this.members,t),t.scheduleRender()}remove(t){if(vP(this.members,t),t===this.prevLead&&(this.prevLead=void 0),t===this.lead){const n=this.members[this.members.length-1];n&&this.promote(n)}}relegate(t){const n=this.members.findIndex(i=>t===i);if(n===0)return!1;let r;for(let i=n;i>=0;i--){const o=this.members[i];if(o.isPresent!==!1){r=o;break}}return r?(this.promote(r),!0):!1}promote(t,n){const r=this.lead;if(t!==r&&(this.prevLead=r,this.lead=t,t.show(),r)){r.instance&&r.scheduleRender(),t.scheduleRender(),t.resumeFrom=r,n&&(t.resumeFrom.preserveOpacity=!0),r.snapshot&&(t.snapshot=r.snapshot,t.snapshot.latestValues=r.animationValues||r.latestValues),t.root&&t.root.isUpdating&&(t.isLayoutDirty=!0);const{crossfade:i}=t.options;i===!1&&r.hide()}}exitAnimationComplete(){this.members.forEach(t=>{const{options:n,resumingFrom:r}=t;n.onExitComplete&&n.onExitComplete(),r&&r.options.onExitComplete&&r.options.onExitComplete()})}scheduleRender(){this.members.forEach(t=>{t.instance&&t.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}function B7(e,t,n){let r="";const i=e.x.translate/t.x,o=e.y.translate/t.y;if((i||o)&&(r=`translate3d(${i}px, ${o}px, 0) `),(t.x!==1||t.y!==1)&&(r+=`scale(${1/t.x}, ${1/t.y}) `),n){const{rotate:l,rotateX:u,rotateY:c}=n;l&&(r+=`rotate(${l}deg) `),u&&(r+=`rotateX(${u}deg) `),c&&(r+=`rotateY(${c}deg) `)}const a=e.x.scale*t.x,s=e.y.scale*t.y;return(a!==1||s!==1)&&(r+=`scale(${a}, ${s})`),r||"none"}const m$e=(e,t)=>e.depth-t.depth;class y$e{constructor(){this.children=[],this.isDirty=!1}add(t){yP(this.children,t),this.isDirty=!0}remove(t){vP(this.children,t),this.isDirty=!0}forEach(t){this.isDirty&&this.children.sort(m$e),this.isDirty=!1,this.children.forEach(t)}}function v$e(e,t){const n=performance.now(),r=({timestamp:i})=>{const o=i-n;o>=t&&(Ql(r),e(o-t))};return $n.read(r,!0),()=>Ql(r)}function b$e(e){window.MotionDebug&&window.MotionDebug.record(e)}function _$e(e){return e instanceof SVGElement&&e.tagName!=="svg"}function S$e(e,t,n){const r=Mo(e)?e:up(e);return r.start(mP("",r,t,n)),r.animation}const z7=["","X","Y","Z"],j7=1e3;let x$e=0;const Gc={type:"projectionFrame",totalNodes:0,resolvedTargetDeltas:0,recalculatedProjection:0};function PW({attachResizeListener:e,defaultParent:t,measureScroll:n,checkIsScrollRoot:r,resetTransform:i}){return class{constructor(a={},s=t==null?void 0:t()){this.id=x$e++,this.animationId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.updateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{Gc.totalNodes=Gc.resolvedTargetDeltas=Gc.recalculatedProjection=0,this.nodes.forEach(E$e),this.nodes.forEach(I$e),this.nodes.forEach(R$e),this.nodes.forEach(k$e),b$e(Gc)},this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=a,this.root=s?s.root||s:this,this.path=s?[...s.path,s]:[],this.parent=s,this.depth=s?s.depth+1:0;for(let l=0;lthis.root.updateBlockedByResize=!1;e(a,()=>{this.root.updateBlockedByResize=!0,d&&d(),d=v$e(f,250),ob.hasAnimatedSinceResize&&(ob.hasAnimatedSinceResize=!1,this.nodes.forEach(V7))})}l&&this.root.registerSharedNode(l,this),this.options.animate!==!1&&c&&(l||u)&&this.addEventListener("didUpdate",({delta:d,hasLayoutChanged:f,hasRelativeTargetChanged:h,layout:p})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const m=this.options.transition||c.getDefaultTransition()||D$e,{onLayoutAnimationStart:_,onLayoutAnimationComplete:b}=c.getProps(),v=!this.targetLayout||!AW(this.targetLayout,p)||h,g=!f&&h;if(this.options.layoutRoot||this.resumeFrom&&this.resumeFrom.instance||g||f&&(v||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0),this.setAnimationOrigin(d,g);const y={...hW(m,"layout"),onPlay:_,onComplete:b};(c.shouldReduceMotion||this.options.layoutRoot)&&(y.delay=0,y.type=!1),this.startAnimation(y)}else f||V7(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=p})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const a=this.getStack();a&&a.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,Ql(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(O$e),this.animationId++)}getTransformTemplate(){const{visualElement:a}=this.options;return a&&a.getProps().transformTemplate}willUpdate(a=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let c=0;cthis.update()))}clearAllSnapshots(){this.nodes.forEach(T$e),this.sharedNodes.forEach(M$e)}scheduleUpdateProjection(){$n.preRender(this.updateProjection,!1,!0)}scheduleCheckAfterUnmount(){$n.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure())}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let l=0;l{const S=y/1e3;G7(d.x,a.x,S),G7(d.y,a.y,S),this.setTargetDelta(d),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(im(f,this.layout.layoutBox,this.relativeParent.layout.layoutBox),N$e(this.relativeTarget,this.relativeTargetOrigin,f,S),g&&p$e(this.relativeTarget,g)&&(this.isProjectionDirty=!1),g||(g=Nr()),ua(g,this.relativeTarget)),m&&(this.animationValues=c,l$e(c,u,this.latestValues,S,v,b)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=S},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(a){this.notifyListeners("animationStart"),this.currentAnimation&&this.currentAnimation.stop(),this.resumingFrom&&this.resumingFrom.currentAnimation&&this.resumingFrom.currentAnimation.stop(),this.pendingAnimation&&(Ql(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=$n.update(()=>{ob.hasAnimatedSinceResize=!0,this.currentAnimation=S$e(0,j7,{...a,onUpdate:s=>{this.mixTargetDelta(s),a.onUpdate&&a.onUpdate(s)},onComplete:()=>{a.onComplete&&a.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const a=this.getStack();a&&a.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(j7),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const a=this.getLead();let{targetWithTransforms:s,target:l,layout:u,latestValues:c}=a;if(!(!s||!l||!u)){if(this!==a&&this.layout&&u&&IW(this.options.animationType,this.layout.layoutBox,u.layoutBox)){l=this.target||Nr();const d=Jo(this.layout.layoutBox.x);l.x.min=a.target.x.min,l.x.max=l.x.min+d;const f=Jo(this.layout.layoutBox.y);l.y.min=a.target.y.min,l.y.max=l.y.min+f}ua(s,l),Yf(s,c),rm(this.projectionDeltaWithTransform,this.layoutCorrected,s,c)}}registerSharedNode(a,s){this.sharedNodes.has(a)||this.sharedNodes.set(a,new g$e),this.sharedNodes.get(a).add(s);const u=s.options.initialPromotionConfig;s.promote({transition:u?u.transition:void 0,preserveFollowOpacity:u&&u.shouldPreserveFollowOpacity?u.shouldPreserveFollowOpacity(s):void 0})}isLead(){const a=this.getStack();return a?a.lead===this:!0}getLead(){var a;const{layoutId:s}=this.options;return s?((a=this.getStack())===null||a===void 0?void 0:a.lead)||this:this}getPrevLead(){var a;const{layoutId:s}=this.options;return s?(a=this.getStack())===null||a===void 0?void 0:a.prevLead:void 0}getStack(){const{layoutId:a}=this.options;if(a)return this.root.sharedNodes.get(a)}promote({needsReset:a,transition:s,preserveFollowOpacity:l}={}){const u=this.getStack();u&&u.promote(this,l),a&&(this.projectionDelta=void 0,this.needsReset=!0),s&&this.setOptions({transition:s})}relegate(){const a=this.getStack();return a?a.relegate(this):!1}resetRotation(){const{visualElement:a}=this.options;if(!a)return;let s=!1;const{latestValues:l}=a;if((l.rotate||l.rotateX||l.rotateY||l.rotateZ)&&(s=!0),!s)return;const u={};for(let c=0;c{var s;return(s=a.currentAnimation)===null||s===void 0?void 0:s.stop()}),this.root.nodes.forEach(U7),this.root.sharedNodes.clear()}}}function w$e(e){e.updateLayout()}function C$e(e){var t;const n=((t=e.resumeFrom)===null||t===void 0?void 0:t.snapshot)||e.snapshot;if(e.isLead()&&e.layout&&n&&e.hasListeners("didUpdate")){const{layoutBox:r,measuredBox:i}=e.layout,{animationType:o}=e.options,a=n.source!==e.layout.source;o==="size"?Ss(d=>{const f=a?n.measuredBox[d]:n.layoutBox[d],h=Jo(f);f.min=r[d].min,f.max=f.min+h}):IW(o,n.layoutBox,r)&&Ss(d=>{const f=a?n.measuredBox[d]:n.layoutBox[d],h=Jo(r[d]);f.max=f.min+h,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[d].max=e.relativeTarget[d].min+h)});const s=Xf();rm(s,r,n.layoutBox);const l=Xf();a?rm(l,e.applyTransform(i,!0),n.measuredBox):rm(l,r,n.layoutBox);const u=!TW(s);let c=!1;if(!e.resumeFrom){const d=e.getClosestProjectingParent();if(d&&!d.resumeFrom){const{snapshot:f,layout:h}=d;if(f&&h){const p=Nr();im(p,n.layoutBox,f.layoutBox);const m=Nr();im(m,r,h.layoutBox),AW(p,m)||(c=!0),d.options.layoutRoot&&(e.relativeTarget=m,e.relativeTargetOrigin=p,e.relativeParent=d)}}}e.notifyListeners("didUpdate",{layout:r,snapshot:n,delta:l,layoutDelta:s,hasLayoutChanged:u,hasRelativeTargetChanged:c})}else if(e.isLead()){const{onExitComplete:r}=e.options;r&&r()}e.options.transition=void 0}function E$e(e){Gc.totalNodes++,e.parent&&(e.isProjecting()||(e.isProjectionDirty=e.parent.isProjectionDirty),e.isSharedProjectionDirty||(e.isSharedProjectionDirty=!!(e.isProjectionDirty||e.parent.isProjectionDirty||e.parent.isSharedProjectionDirty)),e.isTransformDirty||(e.isTransformDirty=e.parent.isTransformDirty))}function k$e(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function T$e(e){e.clearSnapshot()}function U7(e){e.clearMeasurements()}function A$e(e){e.isLayoutDirty=!1}function P$e(e){const{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify("BeforeLayoutMeasure"),e.resetTransform()}function V7(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function I$e(e){e.resolveTargetDelta()}function R$e(e){e.calcProjection()}function O$e(e){e.resetRotation()}function M$e(e){e.removeLeadSnapshot()}function G7(e,t,n){e.translate=lr(t.translate,0,n),e.scale=lr(t.scale,1,n),e.origin=t.origin,e.originPoint=t.originPoint}function H7(e,t,n,r){e.min=lr(t.min,n.min,r),e.max=lr(t.max,n.max,r)}function N$e(e,t,n,r){H7(e.x,t.x,n.x,r),H7(e.y,t.y,n.y,r)}function $$e(e){return e.animationValues&&e.animationValues.opacityExit!==void 0}const D$e={duration:.45,ease:[.4,0,.1,1]},q7=e=>typeof navigator<"u"&&navigator.userAgent.toLowerCase().includes(e),W7=q7("applewebkit/")&&!q7("chrome/")?Math.round:yr;function K7(e){e.min=W7(e.min),e.max=W7(e.max)}function L$e(e){K7(e.x),K7(e.y)}function IW(e,t,n){return e==="position"||e==="preserve-aspect"&&!C4(F7(t),F7(n),.2)}const F$e=PW({attachResizeListener:(e,t)=>Ol(e,"resize",t),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),N5={current:void 0},RW=PW({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!N5.current){const e=new F$e({});e.mount(window),e.setOptions({layoutScroll:!0}),N5.current=e}return N5.current},resetTransform:(e,t)=>{e.style.transform=t!==void 0?t:"none"},checkIsScrollRoot:e=>window.getComputedStyle(e).position==="fixed"}),B$e={pan:{Feature:e$e},drag:{Feature:JNe,ProjectionNode:RW,MeasureLayout:CW}},z$e=/var\((--[a-zA-Z0-9-_]+),? ?([a-zA-Z0-9 ()%#.,-]+)?\)/;function j$e(e){const t=z$e.exec(e);if(!t)return[,];const[,n,r]=t;return[n,r]}function A4(e,t,n=1){const[r,i]=j$e(e);if(!r)return;const o=window.getComputedStyle(t).getPropertyValue(r);if(o){const a=o.trim();return pW(a)?parseFloat(a):a}else return y4(i)?A4(i,t,n+1):i}function U$e(e,{...t},n){const r=e.current;if(!(r instanceof Element))return{target:t,transitionEnd:n};n&&(n={...n}),e.values.forEach(i=>{const o=i.get();if(!y4(o))return;const a=A4(o,r);a&&i.set(a)});for(const i in t){const o=t[i];if(!y4(o))continue;const a=A4(o,r);a&&(t[i]=a,n||(n={}),n[i]===void 0&&(n[i]=o))}return{target:t,transitionEnd:n}}const V$e=new Set(["width","height","top","left","right","bottom","x","y","translateX","translateY"]),OW=e=>V$e.has(e),G$e=e=>Object.keys(e).some(OW),Q7=e=>e===ef||e===at,X7=(e,t)=>parseFloat(e.split(", ")[t]),Y7=(e,t)=>(n,{transform:r})=>{if(r==="none"||!r)return 0;const i=r.match(/^matrix3d\((.+)\)$/);if(i)return X7(i[1],t);{const o=r.match(/^matrix\((.+)\)$/);return o?X7(o[1],e):0}},H$e=new Set(["x","y","z"]),q$e=Ny.filter(e=>!H$e.has(e));function W$e(e){const t=[];return q$e.forEach(n=>{const r=e.getValue(n);r!==void 0&&(t.push([n,r.get()]),r.set(n.startsWith("scale")?1:0))}),t.length&&e.render(),t}const cp={width:({x:e},{paddingLeft:t="0",paddingRight:n="0"})=>e.max-e.min-parseFloat(t)-parseFloat(n),height:({y:e},{paddingTop:t="0",paddingBottom:n="0"})=>e.max-e.min-parseFloat(t)-parseFloat(n),top:(e,{top:t})=>parseFloat(t),left:(e,{left:t})=>parseFloat(t),bottom:({y:e},{top:t})=>parseFloat(t)+(e.max-e.min),right:({x:e},{left:t})=>parseFloat(t)+(e.max-e.min),x:Y7(4,13),y:Y7(5,14)};cp.translateX=cp.x;cp.translateY=cp.y;const K$e=(e,t,n)=>{const r=t.measureViewportBox(),i=t.current,o=getComputedStyle(i),{display:a}=o,s={};a==="none"&&t.setStaticValue("display",e.display||"block"),n.forEach(u=>{s[u]=cp[u](r,o)}),t.render();const l=t.measureViewportBox();return n.forEach(u=>{const c=t.getValue(u);c&&c.jump(s[u]),e[u]=cp[u](l,o)}),e},Q$e=(e,t,n={},r={})=>{t={...t},r={...r};const i=Object.keys(t).filter(OW);let o=[],a=!1;const s=[];if(i.forEach(l=>{const u=e.getValue(l);if(!e.hasValue(l))return;let c=n[l],d=lg(c);const f=t[l];let h;if(Y_(f)){const p=f.length,m=f[0]===null?1:0;c=f[m],d=lg(c);for(let _=m;_=0?window.pageYOffset:null,u=K$e(t,e,s);return o.length&&o.forEach(([c,d])=>{e.getValue(c).set(d)}),e.render(),sw&&l!==null&&window.scrollTo({top:l}),{target:u,transitionEnd:r}}else return{target:t,transitionEnd:r}};function X$e(e,t,n,r){return G$e(t)?Q$e(e,t,n,r):{target:t,transitionEnd:r}}const Y$e=(e,t,n,r)=>{const i=U$e(e,t,r);return t=i.target,r=i.transitionEnd,X$e(e,t,n,r)},P4={current:null},MW={current:!1};function Z$e(){if(MW.current=!0,!!sw)if(window.matchMedia){const e=window.matchMedia("(prefers-reduced-motion)"),t=()=>P4.current=e.matches;e.addListener(t),t()}else P4.current=!1}function J$e(e,t,n){const{willChange:r}=t;for(const i in t){const o=t[i],a=n[i];if(Mo(o))e.addValue(i,o),tS(r)&&r.add(i);else if(Mo(a))e.addValue(i,up(o,{owner:e})),tS(r)&&r.remove(i);else if(a!==o)if(e.hasValue(i)){const s=e.getValue(i);!s.hasAnimated&&s.set(o)}else{const s=e.getStaticValue(i);e.addValue(i,up(s!==void 0?s:o,{owner:e}))}}for(const i in n)t[i]===void 0&&e.removeValue(i);return t}const Z7=new WeakMap,NW=Object.keys(I0),eDe=NW.length,J7=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"],tDe=tP.length;class nDe{constructor({parent:t,props:n,presenceContext:r,reducedMotionConfig:i,visualState:o},a={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.scheduleRender=()=>$n.render(this.render,!1,!0);const{latestValues:s,renderState:l}=o;this.latestValues=s,this.baseTarget={...s},this.initialValues=n.initial?{...s}:{},this.renderState=l,this.parent=t,this.props=n,this.presenceContext=r,this.depth=t?t.depth+1:0,this.reducedMotionConfig=i,this.options=a,this.isControllingVariants=uw(n),this.isVariantNode=vq(n),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(t&&t.current);const{willChange:u,...c}=this.scrapeMotionValuesFromProps(n,{});for(const d in c){const f=c[d];s[d]!==void 0&&Mo(f)&&(f.set(s[d],!1),tS(u)&&u.add(d))}}scrapeMotionValuesFromProps(t,n){return{}}mount(t){this.current=t,Z7.set(t,this),this.projection&&!this.projection.instance&&this.projection.mount(t),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((n,r)=>this.bindToMotionValue(r,n)),MW.current||Z$e(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:P4.current,this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){Z7.delete(this.current),this.projection&&this.projection.unmount(),Ql(this.notifyUpdate),Ql(this.render),this.valueSubscriptions.forEach(t=>t()),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent&&this.parent.children.delete(this);for(const t in this.events)this.events[t].clear();for(const t in this.features)this.features[t].unmount();this.current=null}bindToMotionValue(t,n){const r=Jd.has(t),i=n.on("change",a=>{this.latestValues[t]=a,this.props.onUpdate&&$n.update(this.notifyUpdate,!1,!0),r&&this.projection&&(this.projection.isTransformDirty=!0)}),o=n.on("renderRequest",this.scheduleRender);this.valueSubscriptions.set(t,()=>{i(),o()})}sortNodePosition(t){return!this.current||!this.sortInstanceNodePosition||this.type!==t.type?0:this.sortInstanceNodePosition(this.current,t.current)}loadFeatures({children:t,...n},r,i,o){let a,s;for(let l=0;lthis.scheduleRender(),animationType:typeof u=="string"?u:"both",initialPromotionConfig:o,layoutScroll:f,layoutRoot:h})}return s}updateFeatures(){for(const t in this.features){const n=this.features[t];n.isMounted?n.update():(n.mount(),n.isMounted=!0)}}triggerBuild(){this.build(this.renderState,this.latestValues,this.options,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):Nr()}getStaticValue(t){return this.latestValues[t]}setStaticValue(t,n){this.latestValues[t]=n}makeTargetAnimatable(t,n=!0){return this.makeTargetAnimatableFromInstance(t,this.props,n)}update(t,n){(t.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=t,this.prevPresenceContext=this.presenceContext,this.presenceContext=n;for(let r=0;rn.variantChildren.delete(t)}addValue(t,n){n!==this.values.get(t)&&(this.removeValue(t),this.bindToMotionValue(t,n)),this.values.set(t,n),this.latestValues[t]=n.get()}removeValue(t){this.values.delete(t);const n=this.valueSubscriptions.get(t);n&&(n(),this.valueSubscriptions.delete(t)),delete this.latestValues[t],this.removeValueFromRenderState(t,this.renderState)}hasValue(t){return this.values.has(t)}getValue(t,n){if(this.props.values&&this.props.values[t])return this.props.values[t];let r=this.values.get(t);return r===void 0&&n!==void 0&&(r=up(n,{owner:this}),this.addValue(t,r)),r}readValue(t){var n;return this.latestValues[t]!==void 0||!this.current?this.latestValues[t]:(n=this.getBaseTargetFromProps(this.props,t))!==null&&n!==void 0?n:this.readValueFromInstance(this.current,t,this.options)}setBaseTarget(t,n){this.baseTarget[t]=n}getBaseTarget(t){var n;const{initial:r}=this.props,i=typeof r=="string"||typeof r=="object"?(n=cP(this.props,r))===null||n===void 0?void 0:n[t]:void 0;if(r&&i!==void 0)return i;const o=this.getBaseTargetFromProps(this.props,t);return o!==void 0&&!Mo(o)?o:this.initialValues[t]!==void 0&&i===void 0?void 0:this.baseTarget[t]}on(t,n){return this.events[t]||(this.events[t]=new bP),this.events[t].add(n)}notify(t,...n){this.events[t]&&this.events[t].notify(...n)}}class $W extends nDe{sortInstanceNodePosition(t,n){return t.compareDocumentPosition(n)&2?1:-1}getBaseTargetFromProps(t,n){return t.style?t.style[n]:void 0}removeValueFromRenderState(t,{vars:n,style:r}){delete n[t],delete r[t]}makeTargetAnimatableFromInstance({transition:t,transitionEnd:n,...r},{transformValues:i},o){let a=bNe(r,t||{},this);if(i&&(n&&(n=i(n)),r&&(r=i(r)),a&&(a=i(a))),o){yNe(this,r,a);const s=Y$e(this,r,a,n);n=s.transitionEnd,r=s.target}return{transition:t,transitionEnd:n,...r}}}function rDe(e){return window.getComputedStyle(e)}class iDe extends $W{readValueFromInstance(t,n){if(Jd.has(n)){const r=gP(n);return r&&r.default||0}else{const r=rDe(t),i=(xq(n)?r.getPropertyValue(n):r[n])||0;return typeof i=="string"?i.trim():i}}measureInstanceViewportBox(t,{transformPagePoint:n}){return wW(t,n)}build(t,n,r,i){iP(t,n,r,i.transformTemplate)}scrapeMotionValuesFromProps(t,n){return uP(t,n)}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:t}=this.props;Mo(t)&&(this.childSubscription=t.on("change",n=>{this.current&&(this.current.textContent=`${n}`)}))}renderInstance(t,n,r,i){Aq(t,n,r,i)}}class oDe extends $W{constructor(){super(...arguments),this.isSVGTag=!1}getBaseTargetFromProps(t,n){return t[n]}readValueFromInstance(t,n){if(Jd.has(n)){const r=gP(n);return r&&r.default||0}return n=Pq.has(n)?n:lP(n),t.getAttribute(n)}measureInstanceViewportBox(){return Nr()}scrapeMotionValuesFromProps(t,n){return Rq(t,n)}build(t,n,r,i){aP(t,n,r,this.isSVGTag,i.transformTemplate)}renderInstance(t,n,r,i){Iq(t,n,r,i)}mount(t){this.isSVGTag=sP(t.tagName),super.mount(t)}}const aDe=(e,t)=>rP(e)?new oDe(t,{enableHardwareAcceleration:!1}):new iDe(t,{enableHardwareAcceleration:!0}),sDe={layout:{ProjectionNode:RW,MeasureLayout:CW}},lDe={...MNe,...JMe,...B$e,...sDe},DW=lMe((e,t)=>zMe(e,t,lDe,aDe));function LW(){const e=I.useRef(!1);return JA(()=>(e.current=!0,()=>{e.current=!1}),[]),e}function uDe(){const e=LW(),[t,n]=I.useState(0),r=I.useCallback(()=>{e.current&&n(t+1)},[t]);return[I.useCallback(()=>$n.postRender(r),[r]),t]}class cDe extends I.Component{getSnapshotBeforeUpdate(t){const n=this.props.childRef.current;if(n&&t.isPresent&&!this.props.isPresent){const r=this.props.sizeRef.current;r.height=n.offsetHeight||0,r.width=n.offsetWidth||0,r.top=n.offsetTop,r.left=n.offsetLeft}return null}componentDidUpdate(){}render(){return this.props.children}}function dDe({children:e,isPresent:t}){const n=I.useId(),r=I.useRef(null),i=I.useRef({width:0,height:0,top:0,left:0});return I.useInsertionEffect(()=>{const{width:o,height:a,top:s,left:l}=i.current;if(t||!r.current||!o||!a)return;r.current.dataset.motionPopId=n;const u=document.createElement("style");return document.head.appendChild(u),u.sheet&&u.sheet.insertRule(` + )`;return{...!r&&i&&o,...r?{bgImage:s}:{bgColor:a}}},P8e={lineHeight:"1",fontSize:"0.25em",fontWeight:"bold",color:"white"},I8e=e=>({bg:K("gray.100","whiteAlpha.300")(e)}),R8e=e=>({transitionProperty:"common",transitionDuration:"slow",...A8e(e)}),O8e=Ag(e=>({label:P8e,filledTrack:R8e(e),track:I8e(e)})),M8e={xs:Ag({track:{h:"1"}}),sm:Ag({track:{h:"2"}}),md:Ag({track:{h:"3"}}),lg:Ag({track:{h:"4"}})},N8e=T8e({sizes:M8e,baseStyle:O8e,defaultProps:{size:"md",colorScheme:"blue"}}),$8e=e=>typeof e=="function";function ro(e,...t){return $8e(e)?e(...t):e}var{definePartsStyle:eb,defineMultiStyleConfig:D8e}=Pt(zH.keys),Zg=nt("checkbox-size"),L8e=e=>{const{colorScheme:t}=e;return{w:Zg.reference,h:Zg.reference,transitionProperty:"box-shadow",transitionDuration:"normal",border:"2px solid",borderRadius:"sm",borderColor:"inherit",color:"white",_checked:{bg:K(`${t}.500`,`${t}.200`)(e),borderColor:K(`${t}.500`,`${t}.200`)(e),color:K("white","gray.900")(e),_hover:{bg:K(`${t}.600`,`${t}.300`)(e),borderColor:K(`${t}.600`,`${t}.300`)(e)},_disabled:{borderColor:K("gray.200","transparent")(e),bg:K("gray.200","whiteAlpha.300")(e),color:K("gray.500","whiteAlpha.500")(e)}},_indeterminate:{bg:K(`${t}.500`,`${t}.200`)(e),borderColor:K(`${t}.500`,`${t}.200`)(e),color:K("white","gray.900")(e)},_disabled:{bg:K("gray.100","whiteAlpha.100")(e),borderColor:K("gray.100","transparent")(e)},_focusVisible:{boxShadow:"outline"},_invalid:{borderColor:K("red.500","red.300")(e)}}},F8e={_disabled:{cursor:"not-allowed"}},B8e={userSelect:"none",_disabled:{opacity:.4}},z8e={transitionProperty:"transform",transitionDuration:"normal"},j8e=eb(e=>({icon:z8e,container:F8e,control:ro(L8e,e),label:B8e})),U8e={sm:eb({control:{[Zg.variable]:"sizes.3"},label:{fontSize:"sm"},icon:{fontSize:"3xs"}}),md:eb({control:{[Zg.variable]:"sizes.4"},label:{fontSize:"md"},icon:{fontSize:"2xs"}}),lg:eb({control:{[Zg.variable]:"sizes.5"},label:{fontSize:"lg"},icon:{fontSize:"2xs"}})},q_=D8e({baseStyle:j8e,sizes:U8e,defaultProps:{size:"md",colorScheme:"blue"}}),{defineMultiStyleConfig:V8e,definePartsStyle:tb}=Pt(GPe.keys),G8e=e=>{var t;const n=(t=ro(q_.baseStyle,e))==null?void 0:t.control;return{...n,borderRadius:"full",_checked:{...n==null?void 0:n._checked,_before:{content:'""',display:"inline-block",pos:"relative",w:"50%",h:"50%",borderRadius:"50%",bg:"currentColor"}}}},H8e=tb(e=>{var t,n,r,i;return{label:(n=(t=q_).baseStyle)==null?void 0:n.call(t,e).label,container:(i=(r=q_).baseStyle)==null?void 0:i.call(r,e).container,control:G8e(e)}}),q8e={md:tb({control:{w:"4",h:"4"},label:{fontSize:"md"}}),lg:tb({control:{w:"5",h:"5"},label:{fontSize:"lg"}}),sm:tb({control:{width:"3",height:"3"},label:{fontSize:"sm"}})},W8e=V8e({baseStyle:H8e,sizes:q8e,defaultProps:{size:"md",colorScheme:"blue"}}),{defineMultiStyleConfig:K8e,definePartsStyle:Q8e}=Pt(KH.keys),Yv=nt("select-bg"),OM,X8e={...(OM=un.baseStyle)==null?void 0:OM.field,appearance:"none",paddingBottom:"1px",lineHeight:"normal",bg:Yv.reference,[Yv.variable]:"colors.white",_dark:{[Yv.variable]:"colors.gray.700"},"> option, > optgroup":{bg:Yv.reference}},Y8e={width:"6",height:"100%",insetEnd:"2",position:"relative",color:"currentColor",fontSize:"xl",_disabled:{opacity:.5}},Z8e=Q8e({field:X8e,icon:Y8e}),Zv={paddingInlineEnd:"8"},MM,NM,$M,DM,LM,FM,BM,zM,J8e={lg:{...(MM=un.sizes)==null?void 0:MM.lg,field:{...(NM=un.sizes)==null?void 0:NM.lg.field,...Zv}},md:{...($M=un.sizes)==null?void 0:$M.md,field:{...(DM=un.sizes)==null?void 0:DM.md.field,...Zv}},sm:{...(LM=un.sizes)==null?void 0:LM.sm,field:{...(FM=un.sizes)==null?void 0:FM.sm.field,...Zv}},xs:{...(BM=un.sizes)==null?void 0:BM.xs,field:{...(zM=un.sizes)==null?void 0:zM.xs.field,...Zv},icon:{insetEnd:"1"}}},eIe=K8e({baseStyle:Z8e,sizes:J8e,variants:un.variants,defaultProps:un.defaultProps}),u5=nt("skeleton-start-color"),c5=nt("skeleton-end-color"),tIe={[u5.variable]:"colors.gray.100",[c5.variable]:"colors.gray.400",_dark:{[u5.variable]:"colors.gray.800",[c5.variable]:"colors.gray.600"},background:u5.reference,borderColor:c5.reference,opacity:.7,borderRadius:"sm"},nIe={baseStyle:tIe},d5=nt("skip-link-bg"),rIe={borderRadius:"md",fontWeight:"semibold",_focusVisible:{boxShadow:"outline",padding:"4",position:"fixed",top:"6",insetStart:"6",[d5.variable]:"colors.white",_dark:{[d5.variable]:"colors.gray.700"},bg:d5.reference}},iIe={baseStyle:rIe},{defineMultiStyleConfig:oIe,definePartsStyle:ow}=Pt(QH.keys),k0=nt("slider-thumb-size"),T0=nt("slider-track-size"),ku=nt("slider-bg"),aIe=e=>{const{orientation:t}=e;return{display:"inline-block",position:"relative",cursor:"pointer",_disabled:{opacity:.6,cursor:"default",pointerEvents:"none"},...KA({orientation:t,vertical:{h:"100%"},horizontal:{w:"100%"}})}},sIe=e=>({...KA({orientation:e.orientation,horizontal:{h:T0.reference},vertical:{w:T0.reference}}),overflow:"hidden",borderRadius:"sm",[ku.variable]:"colors.gray.200",_dark:{[ku.variable]:"colors.whiteAlpha.200"},_disabled:{[ku.variable]:"colors.gray.300",_dark:{[ku.variable]:"colors.whiteAlpha.300"}},bg:ku.reference}),lIe=e=>{const{orientation:t}=e;return{...KA({orientation:t,vertical:{left:"50%",transform:"translateX(-50%)",_active:{transform:"translateX(-50%) scale(1.15)"}},horizontal:{top:"50%",transform:"translateY(-50%)",_active:{transform:"translateY(-50%) scale(1.15)"}}}),w:k0.reference,h:k0.reference,display:"flex",alignItems:"center",justifyContent:"center",position:"absolute",outline:0,zIndex:1,borderRadius:"full",bg:"white",boxShadow:"base",border:"1px solid",borderColor:"transparent",transitionProperty:"transform",transitionDuration:"normal",_focusVisible:{boxShadow:"outline"},_disabled:{bg:"gray.300"}}},uIe=e=>{const{colorScheme:t}=e;return{width:"inherit",height:"inherit",[ku.variable]:`colors.${t}.500`,_dark:{[ku.variable]:`colors.${t}.200`},bg:ku.reference}},cIe=ow(e=>({container:aIe(e),track:sIe(e),thumb:lIe(e),filledTrack:uIe(e)})),dIe=ow({container:{[k0.variable]:"sizes.4",[T0.variable]:"sizes.1"}}),fIe=ow({container:{[k0.variable]:"sizes.3.5",[T0.variable]:"sizes.1"}}),hIe=ow({container:{[k0.variable]:"sizes.2.5",[T0.variable]:"sizes.0.5"}}),pIe={lg:dIe,md:fIe,sm:hIe},gIe=oIe({baseStyle:cIe,sizes:pIe,defaultProps:{size:"md",colorScheme:"blue"}}),Qc=fr("spinner-size"),mIe={width:[Qc.reference],height:[Qc.reference]},yIe={xs:{[Qc.variable]:"sizes.3"},sm:{[Qc.variable]:"sizes.4"},md:{[Qc.variable]:"sizes.6"},lg:{[Qc.variable]:"sizes.8"},xl:{[Qc.variable]:"sizes.12"}},vIe={baseStyle:mIe,sizes:yIe,defaultProps:{size:"md"}},{defineMultiStyleConfig:bIe,definePartsStyle:eq}=Pt(HPe.keys),_Ie={fontWeight:"medium"},SIe={opacity:.8,marginBottom:"2"},xIe={verticalAlign:"baseline",fontWeight:"semibold"},wIe={marginEnd:1,w:"3.5",h:"3.5",verticalAlign:"middle"},CIe=eq({container:{},label:_Ie,helpText:SIe,number:xIe,icon:wIe}),EIe={md:eq({label:{fontSize:"sm"},helpText:{fontSize:"sm"},number:{fontSize:"2xl"}})},kIe=bIe({baseStyle:CIe,sizes:EIe,defaultProps:{size:"md"}}),f5=nt("kbd-bg"),TIe={[f5.variable]:"colors.gray.100",_dark:{[f5.variable]:"colors.whiteAlpha.100"},bg:f5.reference,borderRadius:"md",borderWidth:"1px",borderBottomWidth:"3px",fontSize:"0.8em",fontWeight:"bold",lineHeight:"normal",px:"0.4em",whiteSpace:"nowrap"},AIe={baseStyle:TIe},PIe={transitionProperty:"common",transitionDuration:"fast",transitionTimingFunction:"ease-out",cursor:"pointer",textDecoration:"none",outline:"none",color:"inherit",_hover:{textDecoration:"underline"},_focusVisible:{boxShadow:"outline"}},IIe={baseStyle:PIe},{defineMultiStyleConfig:RIe,definePartsStyle:OIe}=Pt(VPe.keys),MIe={marginEnd:"2",display:"inline",verticalAlign:"text-bottom"},NIe=OIe({icon:MIe}),$Ie=RIe({baseStyle:NIe}),{defineMultiStyleConfig:DIe,definePartsStyle:LIe}=Pt(VH.keys),ws=nt("menu-bg"),h5=nt("menu-shadow"),FIe={[ws.variable]:"#fff",[h5.variable]:"shadows.sm",_dark:{[ws.variable]:"colors.gray.700",[h5.variable]:"shadows.dark-lg"},color:"inherit",minW:"3xs",py:"2",zIndex:1,borderRadius:"md",borderWidth:"1px",bg:ws.reference,boxShadow:h5.reference},BIe={py:"1.5",px:"3",transitionProperty:"background",transitionDuration:"ultra-fast",transitionTimingFunction:"ease-in",_focus:{[ws.variable]:"colors.gray.100",_dark:{[ws.variable]:"colors.whiteAlpha.100"}},_active:{[ws.variable]:"colors.gray.200",_dark:{[ws.variable]:"colors.whiteAlpha.200"}},_expanded:{[ws.variable]:"colors.gray.100",_dark:{[ws.variable]:"colors.whiteAlpha.100"}},_disabled:{opacity:.4,cursor:"not-allowed"},bg:ws.reference},zIe={mx:4,my:2,fontWeight:"semibold",fontSize:"sm"},jIe={display:"inline-flex",alignItems:"center",justifyContent:"center",flexShrink:0},UIe={opacity:.6},VIe={border:0,borderBottom:"1px solid",borderColor:"inherit",my:"2",opacity:.6},GIe={transitionProperty:"common",transitionDuration:"normal"},HIe=LIe({button:GIe,list:FIe,item:BIe,groupTitle:zIe,icon:jIe,command:UIe,divider:VIe}),qIe=DIe({baseStyle:HIe}),{defineMultiStyleConfig:WIe,definePartsStyle:p4}=Pt(GH.keys),p5=nt("modal-bg"),g5=nt("modal-shadow"),KIe={bg:"blackAlpha.600",zIndex:"modal"},QIe=e=>{const{isCentered:t,scrollBehavior:n}=e;return{display:"flex",zIndex:"modal",justifyContent:"center",alignItems:t?"center":"flex-start",overflow:n==="inside"?"hidden":"auto",overscrollBehaviorY:"none"}},XIe=e=>{const{isCentered:t,scrollBehavior:n}=e;return{borderRadius:"md",color:"inherit",my:t?"auto":"16",mx:t?"auto":void 0,zIndex:"modal",maxH:n==="inside"?"calc(100% - 7.5rem)":void 0,[p5.variable]:"colors.white",[g5.variable]:"shadows.lg",_dark:{[p5.variable]:"colors.gray.700",[g5.variable]:"shadows.dark-lg"},bg:p5.reference,boxShadow:g5.reference}},YIe={px:"6",py:"4",fontSize:"xl",fontWeight:"semibold"},ZIe={position:"absolute",top:"2",insetEnd:"3"},JIe=e=>{const{scrollBehavior:t}=e;return{px:"6",py:"2",flex:"1",overflow:t==="inside"?"auto":void 0}},eRe={px:"6",py:"4"},tRe=p4(e=>({overlay:KIe,dialogContainer:ro(QIe,e),dialog:ro(XIe,e),header:YIe,closeButton:ZIe,body:ro(JIe,e),footer:eRe}));function Ba(e){return p4(e==="full"?{dialog:{maxW:"100vw",minH:"$100vh",my:"0",borderRadius:"0"}}:{dialog:{maxW:e}})}var nRe={xs:Ba("xs"),sm:Ba("sm"),md:Ba("md"),lg:Ba("lg"),xl:Ba("xl"),"2xl":Ba("2xl"),"3xl":Ba("3xl"),"4xl":Ba("4xl"),"5xl":Ba("5xl"),"6xl":Ba("6xl"),full:Ba("full")},rRe=WIe({baseStyle:tRe,sizes:nRe,defaultProps:{size:"md"}}),{defineMultiStyleConfig:iRe,definePartsStyle:tq}=Pt(HH.keys),XA=fr("number-input-stepper-width"),nq=fr("number-input-input-padding"),oRe=kl(XA).add("0.5rem").toString(),m5=fr("number-input-bg"),y5=fr("number-input-color"),v5=fr("number-input-border-color"),aRe={[XA.variable]:"sizes.6",[nq.variable]:oRe},sRe=e=>{var t,n;return(n=(t=ro(un.baseStyle,e))==null?void 0:t.field)!=null?n:{}},lRe={width:XA.reference},uRe={borderStart:"1px solid",borderStartColor:v5.reference,color:y5.reference,bg:m5.reference,[y5.variable]:"colors.chakra-body-text",[v5.variable]:"colors.chakra-border-color",_dark:{[y5.variable]:"colors.whiteAlpha.800",[v5.variable]:"colors.whiteAlpha.300"},_active:{[m5.variable]:"colors.gray.200",_dark:{[m5.variable]:"colors.whiteAlpha.300"}},_disabled:{opacity:.4,cursor:"not-allowed"}},cRe=tq(e=>{var t;return{root:aRe,field:(t=ro(sRe,e))!=null?t:{},stepperGroup:lRe,stepper:uRe}});function Jv(e){var t,n,r;const i=(t=un.sizes)==null?void 0:t[e],o={lg:"md",md:"md",sm:"sm",xs:"sm"},a=(r=(n=i.field)==null?void 0:n.fontSize)!=null?r:"md",s=DH.fontSizes[a];return tq({field:{...i.field,paddingInlineEnd:nq.reference,verticalAlign:"top"},stepper:{fontSize:kl(s).multiply(.75).toString(),_first:{borderTopEndRadius:o[e]},_last:{borderBottomEndRadius:o[e],mt:"-1px",borderTopWidth:1}}})}var dRe={xs:Jv("xs"),sm:Jv("sm"),md:Jv("md"),lg:Jv("lg")},fRe=iRe({baseStyle:cRe,sizes:dRe,variants:un.variants,defaultProps:un.defaultProps}),jM,hRe={...(jM=un.baseStyle)==null?void 0:jM.field,textAlign:"center"},pRe={lg:{fontSize:"lg",w:12,h:12,borderRadius:"md"},md:{fontSize:"md",w:10,h:10,borderRadius:"md"},sm:{fontSize:"sm",w:8,h:8,borderRadius:"sm"},xs:{fontSize:"xs",w:6,h:6,borderRadius:"sm"}},UM,VM,gRe={outline:e=>{var t,n,r;return(r=(n=ro((t=un.variants)==null?void 0:t.outline,e))==null?void 0:n.field)!=null?r:{}},flushed:e=>{var t,n,r;return(r=(n=ro((t=un.variants)==null?void 0:t.flushed,e))==null?void 0:n.field)!=null?r:{}},filled:e=>{var t,n,r;return(r=(n=ro((t=un.variants)==null?void 0:t.filled,e))==null?void 0:n.field)!=null?r:{}},unstyled:(VM=(UM=un.variants)==null?void 0:UM.unstyled.field)!=null?VM:{}},mRe={baseStyle:hRe,sizes:pRe,variants:gRe,defaultProps:un.defaultProps},{defineMultiStyleConfig:yRe,definePartsStyle:vRe}=Pt(qH.keys),e1=fr("popper-bg"),bRe=fr("popper-arrow-bg"),GM=fr("popper-arrow-shadow-color"),_Re={zIndex:10},SRe={[e1.variable]:"colors.white",bg:e1.reference,[bRe.variable]:e1.reference,[GM.variable]:"colors.gray.200",_dark:{[e1.variable]:"colors.gray.700",[GM.variable]:"colors.whiteAlpha.300"},width:"xs",border:"1px solid",borderColor:"inherit",borderRadius:"md",boxShadow:"sm",zIndex:"inherit",_focusVisible:{outline:0,boxShadow:"outline"}},xRe={px:3,py:2,borderBottomWidth:"1px"},wRe={px:3,py:2},CRe={px:3,py:2,borderTopWidth:"1px"},ERe={position:"absolute",borderRadius:"md",top:1,insetEnd:2,padding:2},kRe=vRe({popper:_Re,content:SRe,header:xRe,body:wRe,footer:CRe,closeButton:ERe}),TRe=yRe({baseStyle:kRe}),{definePartsStyle:g4,defineMultiStyleConfig:ARe}=Pt(zPe.keys),b5=nt("drawer-bg"),_5=nt("drawer-box-shadow");function _f(e){return g4(e==="full"?{dialog:{maxW:"100vw",h:"100vh"}}:{dialog:{maxW:e}})}var PRe={bg:"blackAlpha.600",zIndex:"overlay"},IRe={display:"flex",zIndex:"modal",justifyContent:"center"},RRe=e=>{const{isFullHeight:t}=e;return{...t&&{height:"100vh"},zIndex:"modal",maxH:"100vh",color:"inherit",[b5.variable]:"colors.white",[_5.variable]:"shadows.lg",_dark:{[b5.variable]:"colors.gray.700",[_5.variable]:"shadows.dark-lg"},bg:b5.reference,boxShadow:_5.reference}},ORe={px:"6",py:"4",fontSize:"xl",fontWeight:"semibold"},MRe={position:"absolute",top:"2",insetEnd:"3"},NRe={px:"6",py:"2",flex:"1",overflow:"auto"},$Re={px:"6",py:"4"},DRe=g4(e=>({overlay:PRe,dialogContainer:IRe,dialog:ro(RRe,e),header:ORe,closeButton:MRe,body:NRe,footer:$Re})),LRe={xs:_f("xs"),sm:_f("md"),md:_f("lg"),lg:_f("2xl"),xl:_f("4xl"),full:_f("full")},FRe=ARe({baseStyle:DRe,sizes:LRe,defaultProps:{size:"xs"}}),{definePartsStyle:BRe,defineMultiStyleConfig:zRe}=Pt(jH.keys),jRe={borderRadius:"md",py:"1",transitionProperty:"common",transitionDuration:"normal"},URe={borderRadius:"md",py:"1",transitionProperty:"common",transitionDuration:"normal",width:"full",_focusVisible:{boxShadow:"outline"},_placeholder:{opacity:.6}},VRe={borderRadius:"md",py:"1",transitionProperty:"common",transitionDuration:"normal",width:"full",_focusVisible:{boxShadow:"outline"},_placeholder:{opacity:.6}},GRe=BRe({preview:jRe,input:URe,textarea:VRe}),HRe=zRe({baseStyle:GRe}),{definePartsStyle:qRe,defineMultiStyleConfig:WRe}=Pt(jPe.keys),xh=nt("form-control-color"),KRe={marginStart:"1",[xh.variable]:"colors.red.500",_dark:{[xh.variable]:"colors.red.300"},color:xh.reference},QRe={mt:"2",[xh.variable]:"colors.gray.600",_dark:{[xh.variable]:"colors.whiteAlpha.600"},color:xh.reference,lineHeight:"normal",fontSize:"sm"},XRe=qRe({container:{width:"100%",position:"relative"},requiredIndicator:KRe,helperText:QRe}),YRe=WRe({baseStyle:XRe}),{definePartsStyle:ZRe,defineMultiStyleConfig:JRe}=Pt(UPe.keys),wh=nt("form-error-color"),e9e={[wh.variable]:"colors.red.500",_dark:{[wh.variable]:"colors.red.300"},color:wh.reference,mt:"2",fontSize:"sm",lineHeight:"normal"},t9e={marginEnd:"0.5em",[wh.variable]:"colors.red.500",_dark:{[wh.variable]:"colors.red.300"},color:wh.reference},n9e=ZRe({text:e9e,icon:t9e}),r9e=JRe({baseStyle:n9e}),i9e={fontSize:"md",marginEnd:"3",mb:"2",fontWeight:"medium",transitionProperty:"common",transitionDuration:"normal",opacity:1,_disabled:{opacity:.4}},o9e={baseStyle:i9e},a9e={fontFamily:"heading",fontWeight:"bold"},s9e={"4xl":{fontSize:["6xl",null,"7xl"],lineHeight:1},"3xl":{fontSize:["5xl",null,"6xl"],lineHeight:1},"2xl":{fontSize:["4xl",null,"5xl"],lineHeight:[1.2,null,1]},xl:{fontSize:["3xl",null,"4xl"],lineHeight:[1.33,null,1.2]},lg:{fontSize:["2xl",null,"3xl"],lineHeight:[1.33,null,1.2]},md:{fontSize:"xl",lineHeight:1.2},sm:{fontSize:"md",lineHeight:1.2},xs:{fontSize:"sm",lineHeight:1.2}},l9e={baseStyle:a9e,sizes:s9e,defaultProps:{size:"xl"}},{defineMultiStyleConfig:u9e,definePartsStyle:c9e}=Pt(BPe.keys),S5=nt("breadcrumb-link-decor"),d9e={transitionProperty:"common",transitionDuration:"fast",transitionTimingFunction:"ease-out",outline:"none",color:"inherit",textDecoration:S5.reference,[S5.variable]:"none","&:not([aria-current=page])":{cursor:"pointer",_hover:{[S5.variable]:"underline"},_focusVisible:{boxShadow:"outline"}}},f9e=c9e({link:d9e}),h9e=u9e({baseStyle:f9e}),p9e={lineHeight:"1.2",borderRadius:"md",fontWeight:"semibold",transitionProperty:"common",transitionDuration:"normal",_focusVisible:{boxShadow:"outline"},_disabled:{opacity:.4,cursor:"not-allowed",boxShadow:"none"},_hover:{_disabled:{bg:"initial"}}},rq=e=>{const{colorScheme:t,theme:n}=e;if(t==="gray")return{color:K("gray.800","whiteAlpha.900")(e),_hover:{bg:K("gray.100","whiteAlpha.200")(e)},_active:{bg:K("gray.200","whiteAlpha.300")(e)}};const r=ap(`${t}.200`,.12)(n),i=ap(`${t}.200`,.24)(n);return{color:K(`${t}.600`,`${t}.200`)(e),bg:"transparent",_hover:{bg:K(`${t}.50`,r)(e)},_active:{bg:K(`${t}.100`,i)(e)}}},g9e=e=>{const{colorScheme:t}=e,n=K("gray.200","whiteAlpha.300")(e);return{border:"1px solid",borderColor:t==="gray"?n:"currentColor",".chakra-button__group[data-attached][data-orientation=horizontal] > &:not(:last-of-type)":{marginEnd:"-1px"},".chakra-button__group[data-attached][data-orientation=vertical] > &:not(:last-of-type)":{marginBottom:"-1px"},...ro(rq,e)}},m9e={yellow:{bg:"yellow.400",color:"black",hoverBg:"yellow.500",activeBg:"yellow.600"},cyan:{bg:"cyan.400",color:"black",hoverBg:"cyan.500",activeBg:"cyan.600"}},y9e=e=>{var t;const{colorScheme:n}=e;if(n==="gray"){const l=K("gray.100","whiteAlpha.200")(e);return{bg:l,color:K("gray.800","whiteAlpha.900")(e),_hover:{bg:K("gray.200","whiteAlpha.300")(e),_disabled:{bg:l}},_active:{bg:K("gray.300","whiteAlpha.400")(e)}}}const{bg:r=`${n}.500`,color:i="white",hoverBg:o=`${n}.600`,activeBg:a=`${n}.700`}=(t=m9e[n])!=null?t:{},s=K(r,`${n}.200`)(e);return{bg:s,color:K(i,"gray.800")(e),_hover:{bg:K(o,`${n}.300`)(e),_disabled:{bg:s}},_active:{bg:K(a,`${n}.400`)(e)}}},v9e=e=>{const{colorScheme:t}=e;return{padding:0,height:"auto",lineHeight:"normal",verticalAlign:"baseline",color:K(`${t}.500`,`${t}.200`)(e),_hover:{textDecoration:"underline",_disabled:{textDecoration:"none"}},_active:{color:K(`${t}.700`,`${t}.500`)(e)}}},b9e={bg:"none",color:"inherit",display:"inline",lineHeight:"inherit",m:"0",p:"0"},_9e={ghost:rq,outline:g9e,solid:y9e,link:v9e,unstyled:b9e},S9e={lg:{h:"12",minW:"12",fontSize:"lg",px:"6"},md:{h:"10",minW:"10",fontSize:"md",px:"4"},sm:{h:"8",minW:"8",fontSize:"sm",px:"3"},xs:{h:"6",minW:"6",fontSize:"xs",px:"2"}},x9e={baseStyle:p9e,variants:_9e,sizes:S9e,defaultProps:{variant:"solid",size:"md",colorScheme:"gray"}},{definePartsStyle:bd,defineMultiStyleConfig:w9e}=Pt(KPe.keys),W_=nt("card-bg"),$l=nt("card-padding"),iq=nt("card-shadow"),nb=nt("card-radius"),oq=nt("card-border-width","0"),aq=nt("card-border-color"),C9e=bd({container:{[W_.variable]:"colors.chakra-body-bg",backgroundColor:W_.reference,boxShadow:iq.reference,borderRadius:nb.reference,color:"chakra-body-text",borderWidth:oq.reference,borderColor:aq.reference},body:{padding:$l.reference,flex:"1 1 0%"},header:{padding:$l.reference},footer:{padding:$l.reference}}),E9e={sm:bd({container:{[nb.variable]:"radii.base",[$l.variable]:"space.3"}}),md:bd({container:{[nb.variable]:"radii.md",[$l.variable]:"space.5"}}),lg:bd({container:{[nb.variable]:"radii.xl",[$l.variable]:"space.7"}})},k9e={elevated:bd({container:{[iq.variable]:"shadows.base",_dark:{[W_.variable]:"colors.gray.700"}}}),outline:bd({container:{[oq.variable]:"1px",[aq.variable]:"colors.chakra-border-color"}}),filled:bd({container:{[W_.variable]:"colors.chakra-subtle-bg"}}),unstyled:{body:{[$l.variable]:0},header:{[$l.variable]:0},footer:{[$l.variable]:0}}},T9e=w9e({baseStyle:C9e,variants:k9e,sizes:E9e,defaultProps:{variant:"elevated",size:"md"}}),Jg=fr("close-button-size"),ag=fr("close-button-bg"),A9e={w:[Jg.reference],h:[Jg.reference],borderRadius:"md",transitionProperty:"common",transitionDuration:"normal",_disabled:{opacity:.4,cursor:"not-allowed",boxShadow:"none"},_hover:{[ag.variable]:"colors.blackAlpha.100",_dark:{[ag.variable]:"colors.whiteAlpha.100"}},_active:{[ag.variable]:"colors.blackAlpha.200",_dark:{[ag.variable]:"colors.whiteAlpha.200"}},_focusVisible:{boxShadow:"outline"},bg:ag.reference},P9e={lg:{[Jg.variable]:"sizes.10",fontSize:"md"},md:{[Jg.variable]:"sizes.8",fontSize:"xs"},sm:{[Jg.variable]:"sizes.6",fontSize:"2xs"}},I9e={baseStyle:A9e,sizes:P9e,defaultProps:{size:"md"}},{variants:R9e,defaultProps:O9e}=Yg,M9e={fontFamily:"mono",fontSize:"sm",px:"0.2em",borderRadius:"sm",bg:Er.bg.reference,color:Er.color.reference,boxShadow:Er.shadow.reference},N9e={baseStyle:M9e,variants:R9e,defaultProps:O9e},$9e={w:"100%",mx:"auto",maxW:"prose",px:"4"},D9e={baseStyle:$9e},L9e={opacity:.6,borderColor:"inherit"},F9e={borderStyle:"solid"},B9e={borderStyle:"dashed"},z9e={solid:F9e,dashed:B9e},j9e={baseStyle:L9e,variants:z9e,defaultProps:{variant:"solid"}},{definePartsStyle:U9e,defineMultiStyleConfig:V9e}=Pt(BH.keys),G9e={borderTopWidth:"1px",borderColor:"inherit",_last:{borderBottomWidth:"1px"}},H9e={transitionProperty:"common",transitionDuration:"normal",fontSize:"md",_focusVisible:{boxShadow:"outline"},_hover:{bg:"blackAlpha.50"},_disabled:{opacity:.4,cursor:"not-allowed"},px:"4",py:"2"},q9e={pt:"2",px:"4",pb:"5"},W9e={fontSize:"1.25em"},K9e=U9e({container:G9e,button:H9e,panel:q9e,icon:W9e}),Q9e=V9e({baseStyle:K9e}),{definePartsStyle:Ry,defineMultiStyleConfig:X9e}=Pt(LPe.keys),Qo=nt("alert-fg"),Wl=nt("alert-bg"),Y9e=Ry({container:{bg:Wl.reference,px:"4",py:"3"},title:{fontWeight:"bold",lineHeight:"6",marginEnd:"2"},description:{lineHeight:"6"},icon:{color:Qo.reference,flexShrink:0,marginEnd:"3",w:"5",h:"6"},spinner:{color:Qo.reference,flexShrink:0,marginEnd:"3",w:"5",h:"5"}});function YA(e){const{theme:t,colorScheme:n}=e,r=ap(`${n}.200`,.16)(t);return{light:`colors.${n}.100`,dark:r}}var Z9e=Ry(e=>{const{colorScheme:t}=e,n=YA(e);return{container:{[Qo.variable]:`colors.${t}.500`,[Wl.variable]:n.light,_dark:{[Qo.variable]:`colors.${t}.200`,[Wl.variable]:n.dark}}}}),J9e=Ry(e=>{const{colorScheme:t}=e,n=YA(e);return{container:{[Qo.variable]:`colors.${t}.500`,[Wl.variable]:n.light,_dark:{[Qo.variable]:`colors.${t}.200`,[Wl.variable]:n.dark},paddingStart:"3",borderStartWidth:"4px",borderStartColor:Qo.reference}}}),eOe=Ry(e=>{const{colorScheme:t}=e,n=YA(e);return{container:{[Qo.variable]:`colors.${t}.500`,[Wl.variable]:n.light,_dark:{[Qo.variable]:`colors.${t}.200`,[Wl.variable]:n.dark},pt:"2",borderTopWidth:"4px",borderTopColor:Qo.reference}}}),tOe=Ry(e=>{const{colorScheme:t}=e;return{container:{[Qo.variable]:"colors.white",[Wl.variable]:`colors.${t}.500`,_dark:{[Qo.variable]:"colors.gray.900",[Wl.variable]:`colors.${t}.200`},color:Qo.reference}}}),nOe={subtle:Z9e,"left-accent":J9e,"top-accent":eOe,solid:tOe},rOe=X9e({baseStyle:Y9e,variants:nOe,defaultProps:{variant:"subtle",colorScheme:"blue"}}),{definePartsStyle:sq,defineMultiStyleConfig:iOe}=Pt(FPe.keys),Ch=nt("avatar-border-color"),em=nt("avatar-bg"),A0=nt("avatar-font-size"),sp=nt("avatar-size"),oOe={borderRadius:"full",border:"0.2em solid",borderColor:Ch.reference,[Ch.variable]:"white",_dark:{[Ch.variable]:"colors.gray.800"}},aOe={bg:em.reference,fontSize:A0.reference,width:sp.reference,height:sp.reference,lineHeight:"1",[em.variable]:"colors.gray.200",_dark:{[em.variable]:"colors.whiteAlpha.400"}},sOe=e=>{const{name:t,theme:n}=e,r=t?p6e({string:t}):"colors.gray.400",i=f6e(r)(n);let o="white";return i||(o="gray.800"),{bg:em.reference,fontSize:A0.reference,color:o,borderColor:Ch.reference,verticalAlign:"top",width:sp.reference,height:sp.reference,"&:not([data-loaded])":{[em.variable]:r},[Ch.variable]:"colors.white",_dark:{[Ch.variable]:"colors.gray.800"}}},lOe={fontSize:A0.reference,lineHeight:"1"},uOe=sq(e=>({badge:ro(oOe,e),excessLabel:ro(aOe,e),container:ro(sOe,e),label:lOe}));function du(e){const t=e!=="100%"?FH[e]:void 0;return sq({container:{[sp.variable]:t??e,[A0.variable]:`calc(${t??e} / 2.5)`},excessLabel:{[sp.variable]:t??e,[A0.variable]:`calc(${t??e} / 2.5)`}})}var cOe={"2xs":du(4),xs:du(6),sm:du(8),md:du(12),lg:du(16),xl:du(24),"2xl":du(32),full:du("100%")},dOe=iOe({baseStyle:uOe,sizes:cOe,defaultProps:{size:"md"}}),fOe={Accordion:Q9e,Alert:rOe,Avatar:dOe,Badge:Yg,Breadcrumb:h9e,Button:x9e,Checkbox:q_,CloseButton:I9e,Code:N9e,Container:D9e,Divider:j9e,Drawer:FRe,Editable:HRe,Form:YRe,FormError:r9e,FormLabel:o9e,Heading:l9e,Input:un,Kbd:AIe,Link:IIe,List:$Ie,Menu:qIe,Modal:rRe,NumberInput:fRe,PinInput:mRe,Popover:TRe,Progress:N8e,Radio:W8e,Select:eIe,Skeleton:nIe,SkipLink:iIe,Slider:gIe,Spinner:vIe,Stat:kIe,Switch:I6e,Table:L6e,Tabs:Z6e,Tag:d8e,Textarea:w8e,Tooltip:k8e,Card:T9e,Stepper:DPe},hOe={colors:{"chakra-body-text":{_light:"gray.800",_dark:"whiteAlpha.900"},"chakra-body-bg":{_light:"white",_dark:"gray.800"},"chakra-border-color":{_light:"gray.200",_dark:"whiteAlpha.300"},"chakra-inverse-text":{_light:"white",_dark:"gray.800"},"chakra-subtle-bg":{_light:"gray.100",_dark:"gray.700"},"chakra-subtle-text":{_light:"gray.600",_dark:"gray.400"},"chakra-placeholder-color":{_light:"gray.500",_dark:"whiteAlpha.400"}}},pOe={global:{body:{fontFamily:"body",color:"chakra-body-text",bg:"chakra-body-bg",transitionProperty:"background-color",transitionDuration:"normal",lineHeight:"base"},"*::placeholder":{color:"chakra-placeholder-color"},"*, *::before, &::after":{borderColor:"chakra-border-color"}}},gOe="ltr",mOe={useSystemColorMode:!1,initialColorMode:"light",cssVarPrefix:"chakra"},yOe={semanticTokens:hOe,direction:gOe,...MPe,components:fOe,styles:pOe,config:mOe},vOe=yOe;function bOe(e,t){const n={};return Object.keys(e).forEach(r=>{t.includes(r)||(n[r]=e[r])}),n}function _Oe(e,t,n,r){const i=typeof t=="string"?t.split("."):[t];for(r=0;r{const t=new WeakMap;return(r,i,o,a)=>{if(typeof r>"u")return e(r,i,o);t.has(r)||t.set(r,new Map);const s=t.get(r);if(s.has(i))return s.get(i);const l=e(r,i,o,a);return s.set(i,l),l}},lq=SOe(_Oe);function uq(e,t){const n={};return Object.keys(e).forEach(r=>{const i=e[r];t(i,r,e)&&(n[r]=i)}),n}var cq=e=>uq(e,t=>t!=null);function xOe(e){return typeof e=="function"}function dq(e,...t){return xOe(e)?e(...t):e}function IKe(...e){return function(n){e.some(r=>(r==null||r(n),n==null?void 0:n.defaultPrevented))}}var wOe=typeof Element<"u",COe=typeof Map=="function",EOe=typeof Set=="function",kOe=typeof ArrayBuffer=="function"&&!!ArrayBuffer.isView;function rb(e,t){if(e===t)return!0;if(e&&t&&typeof e=="object"&&typeof t=="object"){if(e.constructor!==t.constructor)return!1;var n,r,i;if(Array.isArray(e)){if(n=e.length,n!=t.length)return!1;for(r=n;r--!==0;)if(!rb(e[r],t[r]))return!1;return!0}var o;if(COe&&e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(o=e.entries();!(r=o.next()).done;)if(!t.has(r.value[0]))return!1;for(o=e.entries();!(r=o.next()).done;)if(!rb(r.value[1],t.get(r.value[0])))return!1;return!0}if(EOe&&e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(o=e.entries();!(r=o.next()).done;)if(!t.has(r.value[0]))return!1;return!0}if(kOe&&ArrayBuffer.isView(e)&&ArrayBuffer.isView(t)){if(n=e.length,n!=t.length)return!1;for(r=n;r--!==0;)if(e[r]!==t[r])return!1;return!0}if(e.constructor===RegExp)return e.source===t.source&&e.flags===t.flags;if(e.valueOf!==Object.prototype.valueOf&&typeof e.valueOf=="function"&&typeof t.valueOf=="function")return e.valueOf()===t.valueOf();if(e.toString!==Object.prototype.toString&&typeof e.toString=="function"&&typeof t.toString=="function")return e.toString()===t.toString();if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!Object.prototype.hasOwnProperty.call(t,i[r]))return!1;if(wOe&&e instanceof Element)return!1;for(r=n;r--!==0;)if(!((i[r]==="_owner"||i[r]==="__v"||i[r]==="__o")&&e.$$typeof)&&!rb(e[i[r]],t[i[r]]))return!1;return!0}return e!==e&&t!==t}var TOe=function(t,n){try{return rb(t,n)}catch(r){if((r.message||"").match(/stack|recursion/i))return console.warn("react-fast-compare cannot handle circular refs"),!1;throw r}};const AOe=pc(TOe);function fq(e,t={}){var n;const{styleConfig:r,...i}=t,{theme:o,colorMode:a}=UTe(),s=e?lq(o,`components.${e}`):void 0,l=r||s,u=Ds({theme:o,colorMode:a},(n=l==null?void 0:l.defaultProps)!=null?n:{},cq(bOe(i,["children"]))),c=I.useRef({});if(l){const f=uPe(l)(u);AOe(c.current,f)||(c.current=f)}return c.current}function Oy(e,t={}){return fq(e,t)}function POe(e,t={}){return fq(e,t)}var IOe=new Set([...YAe,"textStyle","layerStyle","apply","noOfLines","focusBorderColor","errorBorderColor","as","__css","css","sx"]),ROe=new Set(["htmlWidth","htmlHeight","htmlSize","htmlTranslate"]);function OOe(e){return ROe.has(e)||!IOe.has(e)}function MOe(e,...t){if(e==null)throw new TypeError("Cannot convert undefined or null to object");const n={...e};for(const r of t)if(r!=null)for(const i in r)Object.prototype.hasOwnProperty.call(r,i)&&(i in n&&delete n[i],n[i]=r[i]);return n}function NOe(e){const t=Object.assign({},e);for(let n in t)t[n]===void 0&&delete t[n];return t}var $Oe=/^((children|dangerouslySetInnerHTML|key|ref|autoFocus|defaultValue|defaultChecked|innerHTML|suppressContentEditableWarning|suppressHydrationWarning|valueLink|abbr|accept|acceptCharset|accessKey|action|allow|allowUserMedia|allowPaymentRequest|allowFullScreen|allowTransparency|alt|async|autoComplete|autoPlay|capture|cellPadding|cellSpacing|challenge|charSet|checked|cite|classID|className|cols|colSpan|content|contentEditable|contextMenu|controls|controlsList|coords|crossOrigin|data|dateTime|decoding|default|defer|dir|disabled|disablePictureInPicture|download|draggable|encType|enterKeyHint|form|formAction|formEncType|formMethod|formNoValidate|formTarget|frameBorder|headers|height|hidden|high|href|hrefLang|htmlFor|httpEquiv|id|inputMode|integrity|is|keyParams|keyType|kind|label|lang|list|loading|loop|low|marginHeight|marginWidth|max|maxLength|media|mediaGroup|method|min|minLength|multiple|muted|name|nonce|noValidate|open|optimum|pattern|placeholder|playsInline|poster|preload|profile|radioGroup|readOnly|referrerPolicy|rel|required|reversed|role|rows|rowSpan|sandbox|scope|scoped|scrolling|seamless|selected|shape|size|sizes|slot|span|spellCheck|src|srcDoc|srcLang|srcSet|start|step|style|summary|tabIndex|target|title|translate|type|useMap|value|width|wmode|wrap|about|datatype|inlist|prefix|property|resource|typeof|vocab|autoCapitalize|autoCorrect|autoSave|color|incremental|fallback|inert|itemProp|itemScope|itemType|itemID|itemRef|on|option|results|security|unselectable|accentHeight|accumulate|additive|alignmentBaseline|allowReorder|alphabetic|amplitude|arabicForm|ascent|attributeName|attributeType|autoReverse|azimuth|baseFrequency|baselineShift|baseProfile|bbox|begin|bias|by|calcMode|capHeight|clip|clipPathUnits|clipPath|clipRule|colorInterpolation|colorInterpolationFilters|colorProfile|colorRendering|contentScriptType|contentStyleType|cursor|cx|cy|d|decelerate|descent|diffuseConstant|direction|display|divisor|dominantBaseline|dur|dx|dy|edgeMode|elevation|enableBackground|end|exponent|externalResourcesRequired|fill|fillOpacity|fillRule|filter|filterRes|filterUnits|floodColor|floodOpacity|focusable|fontFamily|fontSize|fontSizeAdjust|fontStretch|fontStyle|fontVariant|fontWeight|format|from|fr|fx|fy|g1|g2|glyphName|glyphOrientationHorizontal|glyphOrientationVertical|glyphRef|gradientTransform|gradientUnits|hanging|horizAdvX|horizOriginX|ideographic|imageRendering|in|in2|intercept|k|k1|k2|k3|k4|kernelMatrix|kernelUnitLength|kerning|keyPoints|keySplines|keyTimes|lengthAdjust|letterSpacing|lightingColor|limitingConeAngle|local|markerEnd|markerMid|markerStart|markerHeight|markerUnits|markerWidth|mask|maskContentUnits|maskUnits|mathematical|mode|numOctaves|offset|opacity|operator|order|orient|orientation|origin|overflow|overlinePosition|overlineThickness|panose1|paintOrder|pathLength|patternContentUnits|patternTransform|patternUnits|pointerEvents|points|pointsAtX|pointsAtY|pointsAtZ|preserveAlpha|preserveAspectRatio|primitiveUnits|r|radius|refX|refY|renderingIntent|repeatCount|repeatDur|requiredExtensions|requiredFeatures|restart|result|rotate|rx|ry|scale|seed|shapeRendering|slope|spacing|specularConstant|specularExponent|speed|spreadMethod|startOffset|stdDeviation|stemh|stemv|stitchTiles|stopColor|stopOpacity|strikethroughPosition|strikethroughThickness|string|stroke|strokeDasharray|strokeDashoffset|strokeLinecap|strokeLinejoin|strokeMiterlimit|strokeOpacity|strokeWidth|surfaceScale|systemLanguage|tableValues|targetX|targetY|textAnchor|textDecoration|textRendering|textLength|to|transform|u1|u2|underlinePosition|underlineThickness|unicode|unicodeBidi|unicodeRange|unitsPerEm|vAlphabetic|vHanging|vIdeographic|vMathematical|values|vectorEffect|version|vertAdvY|vertOriginX|vertOriginY|viewBox|viewTarget|visibility|widths|wordSpacing|writingMode|x|xHeight|x1|x2|xChannelSelector|xlinkActuate|xlinkArcrole|xlinkHref|xlinkRole|xlinkShow|xlinkTitle|xlinkType|xmlBase|xmlns|xmlnsXlink|xmlLang|xmlSpace|y|y1|y2|yChannelSelector|z|zoomAndPan|for|class|autofocus)|(([Dd][Aa][Tt][Aa]|[Aa][Rr][Ii][Aa]|x)-.*))$/,DOe=vH(function(e){return $Oe.test(e)||e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&e.charCodeAt(2)<91}),LOe=DOe,FOe=function(t){return t!=="theme"},HM=function(t){return typeof t=="string"&&t.charCodeAt(0)>96?LOe:FOe},qM=function(t,n,r){var i;if(n){var o=n.shouldForwardProp;i=t.__emotion_forwardProp&&o?function(a){return t.__emotion_forwardProp(a)&&o(a)}:o}return typeof i!="function"&&r&&(i=t.__emotion_forwardProp),i},BOe=function(t){var n=t.cache,r=t.serialized,i=t.isStringTag;return _H(n,r,i),TTe(function(){return SH(n,r,i)}),null},zOe=function e(t,n){var r=t.__emotion_real===t,i=r&&t.__emotion_base||t,o,a;n!==void 0&&(o=n.label,a=n.target);var s=qM(t,n,r),l=s||HM(i),u=!l("as");return function(){var c=arguments,d=r&&t.__emotion_styles!==void 0?t.__emotion_styles.slice(0):[];if(o!==void 0&&d.push("label:"+o+";"),c[0]==null||c[0].raw===void 0)d.push.apply(d,c);else{d.push(c[0][0]);for(var f=c.length,h=1;ht=>{const{theme:n,css:r,__css:i,sx:o,...a}=t,s=uq(a,(d,f)=>JAe(f)),l=dq(e,t),u=MOe({},i,l,cq(s),o),c=$H(u)(t.theme);return r?[c,r]:c};function x5(e,t){const{baseStyle:n,...r}=t??{};r.shouldForwardProp||(r.shouldForwardProp=OOe);const i=VOe({baseStyle:n}),o=UOe(e,r)(i);return En.forwardRef(function(l,u){const{colorMode:c,forced:d}=tw();return En.createElement(o,{ref:u,"data-theme":d?c:void 0,...l})})}function GOe(){const e=new Map;return new Proxy(x5,{apply(t,n,r){return x5(...r)},get(t,n){return e.has(n)||e.set(n,x5(n)),e.get(n)}})}var Oi=GOe();function ra(e){return I.forwardRef(e)}function HOe(e={}){const{strict:t=!0,errorMessage:n="useContext: `context` is undefined. Seems you forgot to wrap component within the Provider",name:r}=e,i=I.createContext(void 0);i.displayName=r;function o(){var a;const s=I.useContext(i);if(!s&&t){const l=new Error(n);throw l.name="ContextError",(a=Error.captureStackTrace)==null||a.call(Error,l,o),l}return s}return[i.Provider,o,i]}function qOe(e){const{cssVarsRoot:t,theme:n,children:r}=e,i=I.useMemo(()=>QAe(n),[n]);return W.jsxs(ITe,{theme:i,children:[W.jsx(WOe,{root:t}),r]})}function WOe({root:e=":host, :root"}){const t=[e,"[data-theme]"].join(",");return W.jsx(kH,{styles:n=>({[t]:n.__cssVars})})}HOe({name:"StylesContext",errorMessage:"useStyles: `styles` is undefined. Seems you forgot to wrap the components in `` "});function RKe(){const{colorMode:e}=tw();return W.jsx(kH,{styles:t=>{const n=lq(t,"styles.global"),r=dq(n,{theme:t,colorMode:e});return r?$H(r)(t):void 0}})}var KOe=(e,t)=>e.find(n=>n.id===t);function KM(e,t){const n=hq(e,t),r=n?e[n].findIndex(i=>i.id===t):-1;return{position:n,index:r}}function hq(e,t){for(const[n,r]of Object.entries(e))if(KOe(r,t))return n}function QOe(e){const t=e.includes("right"),n=e.includes("left");let r="center";return t&&(r="flex-end"),n&&(r="flex-start"),{display:"flex",flexDirection:"column",alignItems:r}}function XOe(e){const n=e==="top"||e==="bottom"?"0 auto":void 0,r=e.includes("top")?"env(safe-area-inset-top, 0px)":void 0,i=e.includes("bottom")?"env(safe-area-inset-bottom, 0px)":void 0,o=e.includes("left")?void 0:"env(safe-area-inset-right, 0px)",a=e.includes("right")?void 0:"env(safe-area-inset-left, 0px)";return{position:"fixed",zIndex:"var(--toast-z-index, 5500)",pointerEvents:"none",display:"flex",flexDirection:"column",margin:n,top:r,bottom:i,right:o,left:a}}function YOe(e,t=[]){const n=I.useRef(e);return I.useEffect(()=>{n.current=e}),I.useCallback((...r)=>{var i;return(i=n.current)==null?void 0:i.call(n,...r)},t)}function ZOe(e,t){const n=YOe(e);I.useEffect(()=>{if(t==null)return;let r=null;return r=window.setTimeout(()=>{n()},t),()=>{r&&window.clearTimeout(r)}},[t,n])}function QM(e,t){const n=I.useRef(!1),r=I.useRef(!1);I.useEffect(()=>{if(n.current&&r.current)return e();r.current=!0},t),I.useEffect(()=>(n.current=!0,()=>{n.current=!1}),[])}const pq=I.createContext({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"}),aw=I.createContext({}),My=I.createContext(null),sw=typeof document<"u",ZA=sw?I.useLayoutEffect:I.useEffect,gq=I.createContext({strict:!1});function JOe(e,t,n,r){const{visualElement:i}=I.useContext(aw),o=I.useContext(gq),a=I.useContext(My),s=I.useContext(pq).reducedMotion,l=I.useRef();r=r||o.renderer,!l.current&&r&&(l.current=r(e,{visualState:t,parent:i,props:n,presenceContext:a,blockInitialAnimation:a?a.initial===!1:!1,reducedMotionConfig:s}));const u=l.current;I.useInsertionEffect(()=>{u&&u.update(n,a)});const c=I.useRef(!!window.HandoffAppearAnimations);return ZA(()=>{u&&(u.render(),c.current&&u.animationState&&u.animationState.animateChanges())}),I.useEffect(()=>{u&&(u.updateFeatures(),!c.current&&u.animationState&&u.animationState.animateChanges(),window.HandoffAppearAnimations=void 0,c.current=!1)}),u}function Wf(e){return typeof e=="object"&&Object.prototype.hasOwnProperty.call(e,"current")}function eMe(e,t,n){return I.useCallback(r=>{r&&e.mount&&e.mount(r),t&&(r?t.mount(r):t.unmount()),n&&(typeof n=="function"?n(r):Wf(n)&&(n.current=r))},[t])}function P0(e){return typeof e=="string"||Array.isArray(e)}function lw(e){return typeof e=="object"&&typeof e.start=="function"}const JA=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],eP=["initial",...JA];function uw(e){return lw(e.animate)||eP.some(t=>P0(e[t]))}function mq(e){return!!(uw(e)||e.variants)}function tMe(e,t){if(uw(e)){const{initial:n,animate:r}=e;return{initial:n===!1||P0(n)?n:void 0,animate:P0(r)?r:void 0}}return e.inherit!==!1?t:{}}function nMe(e){const{initial:t,animate:n}=tMe(e,I.useContext(aw));return I.useMemo(()=>({initial:t,animate:n}),[XM(t),XM(n)])}function XM(e){return Array.isArray(e)?e.join(" "):e}const YM={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]},I0={};for(const e in YM)I0[e]={isEnabled:t=>YM[e].some(n=>!!t[n])};function rMe(e){for(const t in e)I0[t]={...I0[t],...e[t]}}const tP=I.createContext({}),yq=I.createContext({}),iMe=Symbol.for("motionComponentSymbol");function oMe({preloadedFeatures:e,createVisualElement:t,useRender:n,useVisualState:r,Component:i}){e&&rMe(e);function o(s,l){let u;const c={...I.useContext(pq),...s,layoutId:aMe(s)},{isStatic:d}=c,f=nMe(s),h=r(s,d);if(!d&&sw){f.visualElement=JOe(i,h,c,t);const p=I.useContext(yq),m=I.useContext(gq).strict;f.visualElement&&(u=f.visualElement.loadFeatures(c,m,e,p))}return I.createElement(aw.Provider,{value:f},u&&f.visualElement?I.createElement(u,{visualElement:f.visualElement,...c}):null,n(i,s,eMe(h,f.visualElement,l),h,d,f.visualElement))}const a=I.forwardRef(o);return a[iMe]=i,a}function aMe({layoutId:e}){const t=I.useContext(tP).id;return t&&e!==void 0?t+"-"+e:e}function sMe(e){function t(r,i={}){return oMe(e(r,i))}if(typeof Proxy>"u")return t;const n=new Map;return new Proxy(t,{get:(r,i)=>(n.has(i)||n.set(i,t(i)),n.get(i))})}const lMe=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function nP(e){return typeof e!="string"||e.includes("-")?!1:!!(lMe.indexOf(e)>-1||/[A-Z]/.test(e))}const Q_={};function uMe(e){Object.assign(Q_,e)}const Ny=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],Jd=new Set(Ny);function vq(e,{layout:t,layoutId:n}){return Jd.has(e)||e.startsWith("origin")||(t||n!==void 0)&&(!!Q_[e]||e==="opacity")}const Mo=e=>!!(e&&e.getVelocity),cMe={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},dMe=Ny.length;function fMe(e,{enableHardwareAcceleration:t=!0,allowTransformNone:n=!0},r,i){let o="";for(let a=0;at=>typeof t=="string"&&t.startsWith(e),_q=bq("--"),m4=bq("var(--"),hMe=/var\s*\(\s*--[\w-]+(\s*,\s*(?:(?:[^)(]|\((?:[^)(]+|\([^)(]*\))*\))*)+)?\s*\)/g,pMe=(e,t)=>t&&typeof e=="number"?t.transform(e):e,fc=(e,t,n)=>Math.min(Math.max(n,e),t),ef={test:e=>typeof e=="number",parse:parseFloat,transform:e=>e},tm={...ef,transform:e=>fc(0,1,e)},t1={...ef,default:1},nm=e=>Math.round(e*1e5)/1e5,cw=/(-)?([\d]*\.?[\d])+/g,Sq=/(#[0-9a-f]{3,8}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2}(-?[\d\.]+%?)\s*[\,\/]?\s*[\d\.]*%?\))/gi,gMe=/^(#[0-9a-f]{3,8}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2}(-?[\d\.]+%?)\s*[\,\/]?\s*[\d\.]*%?\))$/i;function $y(e){return typeof e=="string"}const Dy=e=>({test:t=>$y(t)&&t.endsWith(e)&&t.split(" ").length===1,parse:parseFloat,transform:t=>`${t}${e}`}),hu=Dy("deg"),Ws=Dy("%"),at=Dy("px"),mMe=Dy("vh"),yMe=Dy("vw"),ZM={...Ws,parse:e=>Ws.parse(e)/100,transform:e=>Ws.transform(e*100)},JM={...ef,transform:Math.round},xq={borderWidth:at,borderTopWidth:at,borderRightWidth:at,borderBottomWidth:at,borderLeftWidth:at,borderRadius:at,radius:at,borderTopLeftRadius:at,borderTopRightRadius:at,borderBottomRightRadius:at,borderBottomLeftRadius:at,width:at,maxWidth:at,height:at,maxHeight:at,size:at,top:at,right:at,bottom:at,left:at,padding:at,paddingTop:at,paddingRight:at,paddingBottom:at,paddingLeft:at,margin:at,marginTop:at,marginRight:at,marginBottom:at,marginLeft:at,rotate:hu,rotateX:hu,rotateY:hu,rotateZ:hu,scale:t1,scaleX:t1,scaleY:t1,scaleZ:t1,skew:hu,skewX:hu,skewY:hu,distance:at,translateX:at,translateY:at,translateZ:at,x:at,y:at,z:at,perspective:at,transformPerspective:at,opacity:tm,originX:ZM,originY:ZM,originZ:at,zIndex:JM,fillOpacity:tm,strokeOpacity:tm,numOctaves:JM};function rP(e,t,n,r){const{style:i,vars:o,transform:a,transformOrigin:s}=e;let l=!1,u=!1,c=!0;for(const d in t){const f=t[d];if(_q(d)){o[d]=f;continue}const h=xq[d],p=pMe(f,h);if(Jd.has(d)){if(l=!0,a[d]=p,!c)continue;f!==(h.default||0)&&(c=!1)}else d.startsWith("origin")?(u=!0,s[d]=p):i[d]=p}if(t.transform||(l||r?i.transform=fMe(e.transform,n,c,r):i.transform&&(i.transform="none")),u){const{originX:d="50%",originY:f="50%",originZ:h=0}=s;i.transformOrigin=`${d} ${f} ${h}`}}const iP=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function wq(e,t,n){for(const r in t)!Mo(t[r])&&!vq(r,n)&&(e[r]=t[r])}function vMe({transformTemplate:e},t,n){return I.useMemo(()=>{const r=iP();return rP(r,t,{enableHardwareAcceleration:!n},e),Object.assign({},r.vars,r.style)},[t])}function bMe(e,t,n){const r=e.style||{},i={};return wq(i,r,e),Object.assign(i,vMe(e,t,n)),e.transformValues?e.transformValues(i):i}function _Me(e,t,n){const r={},i=bMe(e,t,n);return e.drag&&e.dragListener!==!1&&(r.draggable=!1,i.userSelect=i.WebkitUserSelect=i.WebkitTouchCallout="none",i.touchAction=e.drag===!0?"none":`pan-${e.drag==="x"?"y":"x"}`),e.tabIndex===void 0&&(e.onTap||e.onTapStart||e.whileTap)&&(r.tabIndex=0),r.style=i,r}const SMe=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","transformValues","custom","inherit","onLayoutAnimationStart","onLayoutAnimationComplete","onLayoutMeasure","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","ignoreStrict","viewport"]);function X_(e){return e.startsWith("while")||e.startsWith("drag")&&e!=="draggable"||e.startsWith("layout")||e.startsWith("onTap")||e.startsWith("onPan")||SMe.has(e)}let Cq=e=>!X_(e);function xMe(e){e&&(Cq=t=>t.startsWith("on")?!X_(t):e(t))}try{xMe(require("@emotion/is-prop-valid").default)}catch{}function wMe(e,t,n){const r={};for(const i in e)i==="values"&&typeof e.values=="object"||(Cq(i)||n===!0&&X_(i)||!t&&!X_(i)||e.draggable&&i.startsWith("onDrag"))&&(r[i]=e[i]);return r}function e7(e,t,n){return typeof e=="string"?e:at.transform(t+n*e)}function CMe(e,t,n){const r=e7(t,e.x,e.width),i=e7(n,e.y,e.height);return`${r} ${i}`}const EMe={offset:"stroke-dashoffset",array:"stroke-dasharray"},kMe={offset:"strokeDashoffset",array:"strokeDasharray"};function TMe(e,t,n=1,r=0,i=!0){e.pathLength=1;const o=i?EMe:kMe;e[o.offset]=at.transform(-r);const a=at.transform(t),s=at.transform(n);e[o.array]=`${a} ${s}`}function oP(e,{attrX:t,attrY:n,attrScale:r,originX:i,originY:o,pathLength:a,pathSpacing:s=1,pathOffset:l=0,...u},c,d,f){if(rP(e,u,c,f),d){e.style.viewBox&&(e.attrs.viewBox=e.style.viewBox);return}e.attrs=e.style,e.style={};const{attrs:h,style:p,dimensions:m}=e;h.transform&&(m&&(p.transform=h.transform),delete h.transform),m&&(i!==void 0||o!==void 0||p.transform)&&(p.transformOrigin=CMe(m,i!==void 0?i:.5,o!==void 0?o:.5)),t!==void 0&&(h.x=t),n!==void 0&&(h.y=n),r!==void 0&&(h.scale=r),a!==void 0&&TMe(h,a,s,l,!1)}const Eq=()=>({...iP(),attrs:{}}),aP=e=>typeof e=="string"&&e.toLowerCase()==="svg";function AMe(e,t,n,r){const i=I.useMemo(()=>{const o=Eq();return oP(o,t,{enableHardwareAcceleration:!1},aP(r),e.transformTemplate),{...o.attrs,style:{...o.style}}},[t]);if(e.style){const o={};wq(o,e.style,e),i.style={...o,...i.style}}return i}function PMe(e=!1){return(n,r,i,{latestValues:o},a)=>{const l=(nP(n)?AMe:_Me)(r,o,a,n),c={...wMe(r,typeof n=="string",e),...l,ref:i},{children:d}=r,f=I.useMemo(()=>Mo(d)?d.get():d,[d]);return I.createElement(n,{...c,children:f})}}const sP=e=>e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase();function kq(e,{style:t,vars:n},r,i){Object.assign(e.style,t,i&&i.getProjectionStyles(r));for(const o in n)e.style.setProperty(o,n[o])}const Tq=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]);function Aq(e,t,n,r){kq(e,t,void 0,r);for(const i in t.attrs)e.setAttribute(Tq.has(i)?i:sP(i),t.attrs[i])}function lP(e,t){const{style:n}=e,r={};for(const i in n)(Mo(n[i])||t.style&&Mo(t.style[i])||vq(i,e))&&(r[i]=n[i]);return r}function Pq(e,t){const n=lP(e,t);for(const r in e)if(Mo(e[r])||Mo(t[r])){const i=Ny.indexOf(r)!==-1?"attr"+r.charAt(0).toUpperCase()+r.substring(1):r;n[i]=e[r]}return n}function uP(e,t,n,r={},i={}){return typeof t=="function"&&(t=t(n!==void 0?n:e.custom,r,i)),typeof t=="string"&&(t=e.variants&&e.variants[t]),typeof t=="function"&&(t=t(n!==void 0?n:e.custom,r,i)),t}function Iq(e){const t=I.useRef(null);return t.current===null&&(t.current=e()),t.current}const Y_=e=>Array.isArray(e),IMe=e=>!!(e&&typeof e=="object"&&e.mix&&e.toValue),RMe=e=>Y_(e)?e[e.length-1]||0:e;function ib(e){const t=Mo(e)?e.get():e;return IMe(t)?t.toValue():t}function OMe({scrapeMotionValuesFromProps:e,createRenderState:t,onMount:n},r,i,o){const a={latestValues:MMe(r,i,o,e),renderState:t()};return n&&(a.mount=s=>n(r,s,a)),a}const Rq=e=>(t,n)=>{const r=I.useContext(aw),i=I.useContext(My),o=()=>OMe(e,t,r,i);return n?o():Iq(o)};function MMe(e,t,n,r){const i={},o=r(e,{});for(const f in o)i[f]=ib(o[f]);let{initial:a,animate:s}=e;const l=uw(e),u=mq(e);t&&u&&!l&&e.inherit!==!1&&(a===void 0&&(a=t.initial),s===void 0&&(s=t.animate));let c=n?n.initial===!1:!1;c=c||a===!1;const d=c?s:a;return d&&typeof d!="boolean"&&!lw(d)&&(Array.isArray(d)?d:[d]).forEach(h=>{const p=uP(e,h);if(!p)return;const{transitionEnd:m,transition:_,...b}=p;for(const v in b){let g=b[v];if(Array.isArray(g)){const y=c?g.length-1:0;g=g[y]}g!==null&&(i[v]=g)}for(const v in m)i[v]=m[v]}),i}const yr=e=>e;function NMe(e){let t=[],n=[],r=0,i=!1,o=!1;const a=new WeakSet,s={schedule:(l,u=!1,c=!1)=>{const d=c&&i,f=d?t:n;return u&&a.add(l),f.indexOf(l)===-1&&(f.push(l),d&&i&&(r=t.length)),l},cancel:l=>{const u=n.indexOf(l);u!==-1&&n.splice(u,1),a.delete(l)},process:l=>{if(i){o=!0;return}if(i=!0,[t,n]=[n,t],n.length=0,r=t.length,r)for(let u=0;u(d[f]=NMe(()=>n=!0),d),{}),a=d=>o[d].process(i),s=()=>{const d=performance.now();n=!1,i.delta=r?1e3/60:Math.max(Math.min(d-i.timestamp,$Me),1),i.timestamp=d,i.isProcessing=!0,n1.forEach(a),i.isProcessing=!1,n&&t&&(r=!1,e(s))},l=()=>{n=!0,r=!0,i.isProcessing||e(s)};return{schedule:n1.reduce((d,f)=>{const h=o[f];return d[f]=(p,m=!1,_=!1)=>(n||l(),h.schedule(p,m,_)),d},{}),cancel:d=>n1.forEach(f=>o[f].cancel(d)),state:i,steps:o}}const{schedule:$n,cancel:Kl,state:ji,steps:w5}=DMe(typeof requestAnimationFrame<"u"?requestAnimationFrame:yr,!0),LMe={useVisualState:Rq({scrapeMotionValuesFromProps:Pq,createRenderState:Eq,onMount:(e,t,{renderState:n,latestValues:r})=>{$n.read(()=>{try{n.dimensions=typeof t.getBBox=="function"?t.getBBox():t.getBoundingClientRect()}catch{n.dimensions={x:0,y:0,width:0,height:0}}}),$n.render(()=>{oP(n,r,{enableHardwareAcceleration:!1},aP(t.tagName),e.transformTemplate),Aq(t,n)})}})},FMe={useVisualState:Rq({scrapeMotionValuesFromProps:lP,createRenderState:iP})};function BMe(e,{forwardMotionProps:t=!1},n,r){return{...nP(e)?LMe:FMe,preloadedFeatures:n,useRender:PMe(t),createVisualElement:r,Component:e}}function Rl(e,t,n,r={passive:!0}){return e.addEventListener(t,n,r),()=>e.removeEventListener(t,n)}const Oq=e=>e.pointerType==="mouse"?typeof e.button!="number"||e.button<=0:e.isPrimary!==!1;function dw(e,t="page"){return{point:{x:e[t+"X"],y:e[t+"Y"]}}}const zMe=e=>t=>Oq(t)&&e(t,dw(t));function Dl(e,t,n,r){return Rl(e,t,zMe(n),r)}const jMe=(e,t)=>n=>t(e(n)),Xu=(...e)=>e.reduce(jMe);function Mq(e){let t=null;return()=>{const n=()=>{t=null};return t===null?(t=e,n):!1}}const t7=Mq("dragHorizontal"),n7=Mq("dragVertical");function Nq(e){let t=!1;if(e==="y")t=n7();else if(e==="x")t=t7();else{const n=t7(),r=n7();n&&r?t=()=>{n(),r()}:(n&&n(),r&&r())}return t}function $q(){const e=Nq(!0);return e?(e(),!1):!0}class Pc{constructor(t){this.isMounted=!1,this.node=t}update(){}}function r7(e,t){const n="pointer"+(t?"enter":"leave"),r="onHover"+(t?"Start":"End"),i=(o,a)=>{if(o.type==="touch"||$q())return;const s=e.getProps();e.animationState&&s.whileHover&&e.animationState.setActive("whileHover",t),s[r]&&$n.update(()=>s[r](o,a))};return Dl(e.current,n,i,{passive:!e.getProps()[r]})}class UMe extends Pc{mount(){this.unmount=Xu(r7(this.node,!0),r7(this.node,!1))}unmount(){}}class VMe extends Pc{constructor(){super(...arguments),this.isActive=!1}onFocus(){let t=!1;try{t=this.node.current.matches(":focus-visible")}catch{t=!0}!t||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=Xu(Rl(this.node.current,"focus",()=>this.onFocus()),Rl(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}const Dq=(e,t)=>t?e===t?!0:Dq(e,t.parentElement):!1;function C5(e,t){if(!t)return;const n=new PointerEvent("pointer"+e);t(n,dw(n))}class GMe extends Pc{constructor(){super(...arguments),this.removeStartListeners=yr,this.removeEndListeners=yr,this.removeAccessibleListeners=yr,this.startPointerPress=(t,n)=>{if(this.removeEndListeners(),this.isPressing)return;const r=this.node.getProps(),o=Dl(window,"pointerup",(s,l)=>{if(!this.checkPressEnd())return;const{onTap:u,onTapCancel:c}=this.node.getProps();$n.update(()=>{Dq(this.node.current,s.target)?u&&u(s,l):c&&c(s,l)})},{passive:!(r.onTap||r.onPointerUp)}),a=Dl(window,"pointercancel",(s,l)=>this.cancelPress(s,l),{passive:!(r.onTapCancel||r.onPointerCancel)});this.removeEndListeners=Xu(o,a),this.startPress(t,n)},this.startAccessiblePress=()=>{const t=o=>{if(o.key!=="Enter"||this.isPressing)return;const a=s=>{s.key!=="Enter"||!this.checkPressEnd()||C5("up",(l,u)=>{const{onTap:c}=this.node.getProps();c&&$n.update(()=>c(l,u))})};this.removeEndListeners(),this.removeEndListeners=Rl(this.node.current,"keyup",a),C5("down",(s,l)=>{this.startPress(s,l)})},n=Rl(this.node.current,"keydown",t),r=()=>{this.isPressing&&C5("cancel",(o,a)=>this.cancelPress(o,a))},i=Rl(this.node.current,"blur",r);this.removeAccessibleListeners=Xu(n,i)}}startPress(t,n){this.isPressing=!0;const{onTapStart:r,whileTap:i}=this.node.getProps();i&&this.node.animationState&&this.node.animationState.setActive("whileTap",!0),r&&$n.update(()=>r(t,n))}checkPressEnd(){return this.removeEndListeners(),this.isPressing=!1,this.node.getProps().whileTap&&this.node.animationState&&this.node.animationState.setActive("whileTap",!1),!$q()}cancelPress(t,n){if(!this.checkPressEnd())return;const{onTapCancel:r}=this.node.getProps();r&&$n.update(()=>r(t,n))}mount(){const t=this.node.getProps(),n=Dl(this.node.current,"pointerdown",this.startPointerPress,{passive:!(t.onTapStart||t.onPointerStart)}),r=Rl(this.node.current,"focus",this.startAccessiblePress);this.removeStartListeners=Xu(n,r)}unmount(){this.removeStartListeners(),this.removeEndListeners(),this.removeAccessibleListeners()}}const y4=new WeakMap,E5=new WeakMap,HMe=e=>{const t=y4.get(e.target);t&&t(e)},qMe=e=>{e.forEach(HMe)};function WMe({root:e,...t}){const n=e||document;E5.has(n)||E5.set(n,{});const r=E5.get(n),i=JSON.stringify(t);return r[i]||(r[i]=new IntersectionObserver(qMe,{root:e,...t})),r[i]}function KMe(e,t,n){const r=WMe(t);return y4.set(e,n),r.observe(e),()=>{y4.delete(e),r.unobserve(e)}}const QMe={some:0,all:1};class XMe extends Pc{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:t={}}=this.node.getProps(),{root:n,margin:r,amount:i="some",once:o}=t,a={root:n?n.current:void 0,rootMargin:r,threshold:typeof i=="number"?i:QMe[i]},s=l=>{const{isIntersecting:u}=l;if(this.isInView===u||(this.isInView=u,o&&!u&&this.hasEnteredView))return;u&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",u);const{onViewportEnter:c,onViewportLeave:d}=this.node.getProps(),f=u?c:d;f&&f(l)};return KMe(this.node.current,a,s)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:t,prevProps:n}=this.node;["amount","margin","root"].some(YMe(t,n))&&this.startObserver()}unmount(){}}function YMe({viewport:e={}},{viewport:t={}}={}){return n=>e[n]!==t[n]}const ZMe={inView:{Feature:XMe},tap:{Feature:GMe},focus:{Feature:VMe},hover:{Feature:UMe}};function Lq(e,t){if(!Array.isArray(t))return!1;const n=t.length;if(n!==e.length)return!1;for(let r=0;rt[r]=n.get()),t}function e7e(e){const t={};return e.values.forEach((n,r)=>t[r]=n.getVelocity()),t}function fw(e,t,n){const r=e.getProps();return uP(r,t,n!==void 0?n:r.custom,JMe(e),e7e(e))}const t7e="framerAppearId",n7e="data-"+sP(t7e);let r7e=yr,cP=yr;const Yu=e=>e*1e3,Ll=e=>e/1e3,i7e={current:!1},Fq=e=>Array.isArray(e)&&typeof e[0]=="number";function Bq(e){return!!(!e||typeof e=="string"&&zq[e]||Fq(e)||Array.isArray(e)&&e.every(Bq))}const Pg=([e,t,n,r])=>`cubic-bezier(${e}, ${t}, ${n}, ${r})`,zq={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:Pg([0,.65,.55,1]),circOut:Pg([.55,0,1,.45]),backIn:Pg([.31,.01,.66,-.59]),backOut:Pg([.33,1.53,.69,.99])};function jq(e){if(e)return Fq(e)?Pg(e):Array.isArray(e)?e.map(jq):zq[e]}function o7e(e,t,n,{delay:r=0,duration:i,repeat:o=0,repeatType:a="loop",ease:s,times:l}={}){const u={[t]:n};l&&(u.offset=l);const c=jq(s);return Array.isArray(c)&&(u.easing=c),e.animate(u,{delay:r,duration:i,easing:Array.isArray(c)?"linear":c,fill:"both",iterations:o+1,direction:a==="reverse"?"alternate":"normal"})}function a7e(e,{repeat:t,repeatType:n="loop"}){const r=t&&n!=="loop"&&t%2===1?0:e.length-1;return e[r]}const Uq=(e,t,n)=>(((1-3*n+3*t)*e+(3*n-6*t))*e+3*t)*e,s7e=1e-7,l7e=12;function u7e(e,t,n,r,i){let o,a,s=0;do a=t+(n-t)/2,o=Uq(a,r,i)-e,o>0?n=a:t=a;while(Math.abs(o)>s7e&&++su7e(o,0,1,e,n);return o=>o===0||o===1?o:Uq(i(o),t,r)}const c7e=Ly(.42,0,1,1),d7e=Ly(0,0,.58,1),Vq=Ly(.42,0,.58,1),f7e=e=>Array.isArray(e)&&typeof e[0]!="number",Gq=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,Hq=e=>t=>1-e(1-t),qq=e=>1-Math.sin(Math.acos(e)),dP=Hq(qq),h7e=Gq(dP),Wq=Ly(.33,1.53,.69,.99),fP=Hq(Wq),p7e=Gq(fP),g7e=e=>(e*=2)<1?.5*fP(e):.5*(2-Math.pow(2,-10*(e-1))),m7e={linear:yr,easeIn:c7e,easeInOut:Vq,easeOut:d7e,circIn:qq,circInOut:h7e,circOut:dP,backIn:fP,backInOut:p7e,backOut:Wq,anticipate:g7e},i7=e=>{if(Array.isArray(e)){cP(e.length===4);const[t,n,r,i]=e;return Ly(t,n,r,i)}else if(typeof e=="string")return m7e[e];return e},hP=(e,t)=>n=>!!($y(n)&&gMe.test(n)&&n.startsWith(e)||t&&Object.prototype.hasOwnProperty.call(n,t)),Kq=(e,t,n)=>r=>{if(!$y(r))return r;const[i,o,a,s]=r.match(cw);return{[e]:parseFloat(i),[t]:parseFloat(o),[n]:parseFloat(a),alpha:s!==void 0?parseFloat(s):1}},y7e=e=>fc(0,255,e),k5={...ef,transform:e=>Math.round(y7e(e))},sd={test:hP("rgb","red"),parse:Kq("red","green","blue"),transform:({red:e,green:t,blue:n,alpha:r=1})=>"rgba("+k5.transform(e)+", "+k5.transform(t)+", "+k5.transform(n)+", "+nm(tm.transform(r))+")"};function v7e(e){let t="",n="",r="",i="";return e.length>5?(t=e.substring(1,3),n=e.substring(3,5),r=e.substring(5,7),i=e.substring(7,9)):(t=e.substring(1,2),n=e.substring(2,3),r=e.substring(3,4),i=e.substring(4,5),t+=t,n+=n,r+=r,i+=i),{red:parseInt(t,16),green:parseInt(n,16),blue:parseInt(r,16),alpha:i?parseInt(i,16)/255:1}}const v4={test:hP("#"),parse:v7e,transform:sd.transform},Kf={test:hP("hsl","hue"),parse:Kq("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:n,alpha:r=1})=>"hsla("+Math.round(e)+", "+Ws.transform(nm(t))+", "+Ws.transform(nm(n))+", "+nm(tm.transform(r))+")"},Zi={test:e=>sd.test(e)||v4.test(e)||Kf.test(e),parse:e=>sd.test(e)?sd.parse(e):Kf.test(e)?Kf.parse(e):v4.parse(e),transform:e=>$y(e)?e:e.hasOwnProperty("red")?sd.transform(e):Kf.transform(e)},lr=(e,t,n)=>-n*e+n*t+e;function T5(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e}function b7e({hue:e,saturation:t,lightness:n,alpha:r}){e/=360,t/=100,n/=100;let i=0,o=0,a=0;if(!t)i=o=a=n;else{const s=n<.5?n*(1+t):n+t-n*t,l=2*n-s;i=T5(l,s,e+1/3),o=T5(l,s,e),a=T5(l,s,e-1/3)}return{red:Math.round(i*255),green:Math.round(o*255),blue:Math.round(a*255),alpha:r}}const A5=(e,t,n)=>{const r=e*e;return Math.sqrt(Math.max(0,n*(t*t-r)+r))},_7e=[v4,sd,Kf],S7e=e=>_7e.find(t=>t.test(e));function o7(e){const t=S7e(e);let n=t.parse(e);return t===Kf&&(n=b7e(n)),n}const Qq=(e,t)=>{const n=o7(e),r=o7(t),i={...n};return o=>(i.red=A5(n.red,r.red,o),i.green=A5(n.green,r.green,o),i.blue=A5(n.blue,r.blue,o),i.alpha=lr(n.alpha,r.alpha,o),sd.transform(i))};function x7e(e){var t,n;return isNaN(e)&&$y(e)&&(((t=e.match(cw))===null||t===void 0?void 0:t.length)||0)+(((n=e.match(Sq))===null||n===void 0?void 0:n.length)||0)>0}const Xq={regex:hMe,countKey:"Vars",token:"${v}",parse:yr},Yq={regex:Sq,countKey:"Colors",token:"${c}",parse:Zi.parse},Zq={regex:cw,countKey:"Numbers",token:"${n}",parse:ef.parse};function P5(e,{regex:t,countKey:n,token:r,parse:i}){const o=e.tokenised.match(t);o&&(e["num"+n]=o.length,e.tokenised=e.tokenised.replace(t,r),e.values.push(...o.map(i)))}function Z_(e){const t=e.toString(),n={value:t,tokenised:t,values:[],numVars:0,numColors:0,numNumbers:0};return n.value.includes("var(--")&&P5(n,Xq),P5(n,Yq),P5(n,Zq),n}function Jq(e){return Z_(e).values}function eW(e){const{values:t,numColors:n,numVars:r,tokenised:i}=Z_(e),o=t.length;return a=>{let s=i;for(let l=0;ltypeof e=="number"?0:e;function C7e(e){const t=Jq(e);return eW(e)(t.map(w7e))}const hc={test:x7e,parse:Jq,createTransformer:eW,getAnimatableNone:C7e},tW=(e,t)=>n=>`${n>0?t:e}`;function nW(e,t){return typeof e=="number"?n=>lr(e,t,n):Zi.test(e)?Qq(e,t):e.startsWith("var(")?tW(e,t):iW(e,t)}const rW=(e,t)=>{const n=[...e],r=n.length,i=e.map((o,a)=>nW(o,t[a]));return o=>{for(let a=0;a{const n={...e,...t},r={};for(const i in n)e[i]!==void 0&&t[i]!==void 0&&(r[i]=nW(e[i],t[i]));return i=>{for(const o in r)n[o]=r[o](i);return n}},iW=(e,t)=>{const n=hc.createTransformer(t),r=Z_(e),i=Z_(t);return r.numVars===i.numVars&&r.numColors===i.numColors&&r.numNumbers>=i.numNumbers?Xu(rW(r.values,i.values),n):tW(e,t)},R0=(e,t,n)=>{const r=t-e;return r===0?1:(n-e)/r},a7=(e,t)=>n=>lr(e,t,n);function k7e(e){return typeof e=="number"?a7:typeof e=="string"?Zi.test(e)?Qq:iW:Array.isArray(e)?rW:typeof e=="object"?E7e:a7}function T7e(e,t,n){const r=[],i=n||k7e(e[0]),o=e.length-1;for(let a=0;at[0];e[0]>e[o-1]&&(e=[...e].reverse(),t=[...t].reverse());const a=T7e(t,r,i),s=a.length,l=u=>{let c=0;if(s>1)for(;cl(fc(e[0],e[o-1],u)):l}function A7e(e,t){const n=e[e.length-1];for(let r=1;r<=t;r++){const i=R0(0,t,r);e.push(lr(n,1,i))}}function P7e(e){const t=[0];return A7e(t,e.length-1),t}function I7e(e,t){return e.map(n=>n*t)}function R7e(e,t){return e.map(()=>t||Vq).splice(0,e.length-1)}function J_({duration:e=300,keyframes:t,times:n,ease:r="easeInOut"}){const i=f7e(r)?r.map(i7):i7(r),o={done:!1,value:t[0]},a=I7e(n&&n.length===t.length?n:P7e(t),e),s=oW(a,t,{ease:Array.isArray(i)?i:R7e(t,i)});return{calculatedDuration:e,next:l=>(o.value=s(l),o.done=l>=e,o)}}function aW(e,t){return t?e*(1e3/t):0}const O7e=5;function sW(e,t,n){const r=Math.max(t-O7e,0);return aW(n-e(r),t-r)}const I5=.001,M7e=.01,s7=10,N7e=.05,$7e=1;function D7e({duration:e=800,bounce:t=.25,velocity:n=0,mass:r=1}){let i,o;r7e(e<=Yu(s7));let a=1-t;a=fc(N7e,$7e,a),e=fc(M7e,s7,Ll(e)),a<1?(i=u=>{const c=u*a,d=c*e,f=c-n,h=b4(u,a),p=Math.exp(-d);return I5-f/h*p},o=u=>{const d=u*a*e,f=d*n+n,h=Math.pow(a,2)*Math.pow(u,2)*e,p=Math.exp(-d),m=b4(Math.pow(u,2),a);return(-i(u)+I5>0?-1:1)*((f-h)*p)/m}):(i=u=>{const c=Math.exp(-u*e),d=(u-n)*e+1;return-I5+c*d},o=u=>{const c=Math.exp(-u*e),d=(n-u)*(e*e);return c*d});const s=5/e,l=F7e(i,o,s);if(e=Yu(e),isNaN(l))return{stiffness:100,damping:10,duration:e};{const u=Math.pow(l,2)*r;return{stiffness:u,damping:a*2*Math.sqrt(r*u),duration:e}}}const L7e=12;function F7e(e,t,n){let r=n;for(let i=1;ie[n]!==void 0)}function j7e(e){let t={velocity:0,stiffness:100,damping:10,mass:1,isResolvedFromDuration:!1,...e};if(!l7(e,z7e)&&l7(e,B7e)){const n=D7e(e);t={...t,...n,velocity:0,mass:1},t.isResolvedFromDuration=!0}return t}function lW({keyframes:e,restDelta:t,restSpeed:n,...r}){const i=e[0],o=e[e.length-1],a={done:!1,value:i},{stiffness:s,damping:l,mass:u,velocity:c,duration:d,isResolvedFromDuration:f}=j7e(r),h=c?-Ll(c):0,p=l/(2*Math.sqrt(s*u)),m=o-i,_=Ll(Math.sqrt(s/u)),b=Math.abs(m)<5;n||(n=b?.01:2),t||(t=b?.005:.5);let v;if(p<1){const g=b4(_,p);v=y=>{const S=Math.exp(-p*_*y);return o-S*((h+p*_*m)/g*Math.sin(g*y)+m*Math.cos(g*y))}}else if(p===1)v=g=>o-Math.exp(-_*g)*(m+(h+_*m)*g);else{const g=_*Math.sqrt(p*p-1);v=y=>{const S=Math.exp(-p*_*y),w=Math.min(g*y,300);return o-S*((h+p*_*m)*Math.sinh(w)+g*m*Math.cosh(w))/g}}return{calculatedDuration:f&&d||null,next:g=>{const y=v(g);if(f)a.done=g>=d;else{let S=h;g!==0&&(p<1?S=sW(v,g,y):S=0);const w=Math.abs(S)<=n,x=Math.abs(o-y)<=t;a.done=w&&x}return a.value=a.done?o:y,a}}}function u7({keyframes:e,velocity:t=0,power:n=.8,timeConstant:r=325,bounceDamping:i=10,bounceStiffness:o=500,modifyTarget:a,min:s,max:l,restDelta:u=.5,restSpeed:c}){const d=e[0],f={done:!1,value:d},h=C=>s!==void 0&&Cl,p=C=>s===void 0?l:l===void 0||Math.abs(s-C)-m*Math.exp(-C/r),g=C=>b+v(C),y=C=>{const T=v(C),k=g(C);f.done=Math.abs(T)<=u,f.value=f.done?b:k};let S,w;const x=C=>{h(f.value)&&(S=C,w=lW({keyframes:[f.value,p(f.value)],velocity:sW(g,C,f.value),damping:i,stiffness:o,restDelta:u,restSpeed:c}))};return x(0),{calculatedDuration:null,next:C=>{let T=!1;return!w&&S===void 0&&(T=!0,y(C),x(C)),S!==void 0&&C>S?w.next(C-S):(!T&&y(C),f)}}}const U7e=e=>{const t=({timestamp:n})=>e(n);return{start:()=>$n.update(t,!0),stop:()=>Kl(t),now:()=>ji.isProcessing?ji.timestamp:performance.now()}},c7=2e4;function d7(e){let t=0;const n=50;let r=e.next(t);for(;!r.done&&t=c7?1/0:t}const V7e={decay:u7,inertia:u7,tween:J_,keyframes:J_,spring:lW};function eS({autoplay:e=!0,delay:t=0,driver:n=U7e,keyframes:r,type:i="keyframes",repeat:o=0,repeatDelay:a=0,repeatType:s="loop",onPlay:l,onStop:u,onComplete:c,onUpdate:d,...f}){let h=1,p=!1,m,_;const b=()=>{_=new Promise(B=>{m=B})};b();let v;const g=V7e[i]||J_;let y;g!==J_&&typeof r[0]!="number"&&(y=oW([0,100],r,{clamp:!1}),r=[0,100]);const S=g({...f,keyframes:r});let w;s==="mirror"&&(w=g({...f,keyframes:[...r].reverse(),velocity:-(f.velocity||0)}));let x="idle",C=null,T=null,k=null;S.calculatedDuration===null&&o&&(S.calculatedDuration=d7(S));const{calculatedDuration:P}=S;let $=1/0,O=1/0;P!==null&&($=P+a,O=$*(o+1)-a);let E=0;const A=B=>{if(T===null)return;h>0&&(T=Math.min(T,B)),h<0&&(T=Math.min(B-O/h,T)),C!==null?E=C:E=Math.round(B-T)*h;const U=E-t*(h>=0?1:-1),G=h>=0?U<0:U>O;E=Math.max(U,0),x==="finished"&&C===null&&(E=O);let Y=E,ee=S;if(o){const ne=E/$;let se=Math.floor(ne),ve=ne%1;!ve&&ne>=1&&(ve=1),ve===1&&se--,se=Math.min(se,o+1);const ce=!!(se%2);ce&&(s==="reverse"?(ve=1-ve,a&&(ve-=a/$)):s==="mirror"&&(ee=w));let bt=fc(0,1,ve);E>O&&(bt=s==="reverse"&&ce?1:0),Y=bt*$}const J=G?{done:!1,value:r[0]}:ee.next(Y);y&&(J.value=y(J.value));let{done:j}=J;!G&&P!==null&&(j=h>=0?E>=O:E<=0);const Q=C===null&&(x==="finished"||x==="running"&&j);return d&&d(J.value),Q&&M(),J},D=()=>{v&&v.stop(),v=void 0},L=()=>{x="idle",D(),m(),b(),T=k=null},M=()=>{x="finished",c&&c(),D(),m()},R=()=>{if(p)return;v||(v=n(A));const B=v.now();l&&l(),C!==null?T=B-C:(!T||x==="finished")&&(T=B),x==="finished"&&b(),k=T,C=null,x="running",v.start()};e&&R();const N={then(B,U){return _.then(B,U)},get time(){return Ll(E)},set time(B){B=Yu(B),E=B,C!==null||!v||h===0?C=B:T=v.now()-B/h},get duration(){const B=S.calculatedDuration===null?d7(S):S.calculatedDuration;return Ll(B)},get speed(){return h},set speed(B){B===h||!v||(h=B,N.time=Ll(E))},get state(){return x},play:R,pause:()=>{x="paused",C=E},stop:()=>{p=!0,x!=="idle"&&(x="idle",u&&u(),L())},cancel:()=>{k!==null&&A(k),L()},complete:()=>{x="finished"},sample:B=>(T=0,A(B))};return N}function G7e(e){let t;return()=>(t===void 0&&(t=e()),t)}const H7e=G7e(()=>Object.hasOwnProperty.call(Element.prototype,"animate")),q7e=new Set(["opacity","clipPath","filter","transform","backgroundColor"]),r1=10,W7e=2e4,K7e=(e,t)=>t.type==="spring"||e==="backgroundColor"||!Bq(t.ease);function Q7e(e,t,{onUpdate:n,onComplete:r,...i}){if(!(H7e()&&q7e.has(t)&&!i.repeatDelay&&i.repeatType!=="mirror"&&i.damping!==0&&i.type!=="inertia"))return!1;let a=!1,s,l;const u=()=>{l=new Promise(v=>{s=v})};u();let{keyframes:c,duration:d=300,ease:f,times:h}=i;if(K7e(t,i)){const v=eS({...i,repeat:0,delay:0});let g={done:!1,value:c[0]};const y=[];let S=0;for(;!g.done&&Sp.cancel(),_=()=>{$n.update(m),s(),u()};return p.onfinish=()=>{e.set(a7e(c,i)),r&&r(),_()},{then(v,g){return l.then(v,g)},attachTimeline(v){return p.timeline=v,p.onfinish=null,yr},get time(){return Ll(p.currentTime||0)},set time(v){p.currentTime=Yu(v)},get speed(){return p.playbackRate},set speed(v){p.playbackRate=v},get duration(){return Ll(d)},play:()=>{a||(p.play(),Kl(m))},pause:()=>p.pause(),stop:()=>{if(a=!0,p.playState==="idle")return;const{currentTime:v}=p;if(v){const g=eS({...i,autoplay:!1});e.setWithVelocity(g.sample(v-r1).value,g.sample(v).value,r1)}_()},complete:()=>p.finish(),cancel:_}}function X7e({keyframes:e,delay:t,onUpdate:n,onComplete:r}){const i=()=>(n&&n(e[e.length-1]),r&&r(),{time:0,speed:1,duration:0,play:yr,pause:yr,stop:yr,then:o=>(o(),Promise.resolve()),cancel:yr,complete:yr});return t?eS({keyframes:[0,1],duration:0,delay:t,onComplete:i}):i()}const Y7e={type:"spring",stiffness:500,damping:25,restSpeed:10},Z7e=e=>({type:"spring",stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),J7e={type:"keyframes",duration:.8},eNe={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},tNe=(e,{keyframes:t})=>t.length>2?J7e:Jd.has(e)?e.startsWith("scale")?Z7e(t[1]):Y7e:eNe,_4=(e,t)=>e==="zIndex"?!1:!!(typeof t=="number"||Array.isArray(t)||typeof t=="string"&&(hc.test(t)||t==="0")&&!t.startsWith("url(")),nNe=new Set(["brightness","contrast","saturate","opacity"]);function rNe(e){const[t,n]=e.slice(0,-1).split("(");if(t==="drop-shadow")return e;const[r]=n.match(cw)||[];if(!r)return e;const i=n.replace(r,"");let o=nNe.has(t)?1:0;return r!==n&&(o*=100),t+"("+o+i+")"}const iNe=/([a-z-]*)\(.*?\)/g,S4={...hc,getAnimatableNone:e=>{const t=e.match(iNe);return t?t.map(rNe).join(" "):e}},oNe={...xq,color:Zi,backgroundColor:Zi,outlineColor:Zi,fill:Zi,stroke:Zi,borderColor:Zi,borderTopColor:Zi,borderRightColor:Zi,borderBottomColor:Zi,borderLeftColor:Zi,filter:S4,WebkitFilter:S4},pP=e=>oNe[e];function uW(e,t){let n=pP(e);return n!==S4&&(n=hc),n.getAnimatableNone?n.getAnimatableNone(t):void 0}const cW=e=>/^0[^.\s]+$/.test(e);function aNe(e){if(typeof e=="number")return e===0;if(e!==null)return e==="none"||e==="0"||cW(e)}function sNe(e,t,n,r){const i=_4(t,n);let o;Array.isArray(n)?o=[...n]:o=[null,n];const a=r.from!==void 0?r.from:e.get();let s;const l=[];for(let u=0;ui=>{const o=dW(r,e)||{},a=o.delay||r.delay||0;let{elapsed:s=0}=r;s=s-Yu(a);const l=sNe(t,e,n,o),u=l[0],c=l[l.length-1],d=_4(e,u),f=_4(e,c);let h={keyframes:l,velocity:t.getVelocity(),ease:"easeOut",...o,delay:-s,onUpdate:p=>{t.set(p),o.onUpdate&&o.onUpdate(p)},onComplete:()=>{i(),o.onComplete&&o.onComplete()}};if(lNe(o)||(h={...h,...tNe(e,h)}),h.duration&&(h.duration=Yu(h.duration)),h.repeatDelay&&(h.repeatDelay=Yu(h.repeatDelay)),!d||!f||i7e.current||o.type===!1)return X7e(h);if(t.owner&&t.owner.current instanceof HTMLElement&&!t.owner.getProps().onUpdate){const p=Q7e(t,e,h);if(p)return p}return eS(h)};function tS(e){return!!(Mo(e)&&e.add)}const fW=e=>/^\-?\d*\.?\d+$/.test(e);function mP(e,t){e.indexOf(t)===-1&&e.push(t)}function yP(e,t){const n=e.indexOf(t);n>-1&&e.splice(n,1)}class vP{constructor(){this.subscriptions=[]}add(t){return mP(this.subscriptions,t),()=>yP(this.subscriptions,t)}notify(t,n,r){const i=this.subscriptions.length;if(i)if(i===1)this.subscriptions[0](t,n,r);else for(let o=0;o!isNaN(parseFloat(e));class cNe{constructor(t,n={}){this.version="10.16.1",this.timeDelta=0,this.lastUpdated=0,this.canTrackVelocity=!1,this.events={},this.updateAndNotify=(r,i=!0)=>{this.prev=this.current,this.current=r;const{delta:o,timestamp:a}=ji;this.lastUpdated!==a&&(this.timeDelta=o,this.lastUpdated=a,$n.postRender(this.scheduleVelocityCheck)),this.prev!==this.current&&this.events.change&&this.events.change.notify(this.current),this.events.velocityChange&&this.events.velocityChange.notify(this.getVelocity()),i&&this.events.renderRequest&&this.events.renderRequest.notify(this.current)},this.scheduleVelocityCheck=()=>$n.postRender(this.velocityCheck),this.velocityCheck=({timestamp:r})=>{r!==this.lastUpdated&&(this.prev=this.current,this.events.velocityChange&&this.events.velocityChange.notify(this.getVelocity()))},this.hasAnimated=!1,this.prev=this.current=t,this.canTrackVelocity=uNe(this.current),this.owner=n.owner}onChange(t){return this.on("change",t)}on(t,n){this.events[t]||(this.events[t]=new vP);const r=this.events[t].add(n);return t==="change"?()=>{r(),$n.read(()=>{this.events.change.getSize()||this.stop()})}:r}clearListeners(){for(const t in this.events)this.events[t].clear()}attach(t,n){this.passiveEffect=t,this.stopPassiveEffect=n}set(t,n=!0){!n||!this.passiveEffect?this.updateAndNotify(t,n):this.passiveEffect(t,this.updateAndNotify)}setWithVelocity(t,n,r){this.set(n),this.prev=t,this.timeDelta=r}jump(t){this.updateAndNotify(t),this.prev=t,this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}get(){return this.current}getPrevious(){return this.prev}getVelocity(){return this.canTrackVelocity?aW(parseFloat(this.current)-parseFloat(this.prev),this.timeDelta):0}start(t){return this.stop(),new Promise(n=>{this.hasAnimated=!0,this.animation=t(n),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function lp(e,t){return new cNe(e,t)}const hW=e=>t=>t.test(e),dNe={test:e=>e==="auto",parse:e=>e},pW=[ef,at,Ws,hu,yMe,mMe,dNe],sg=e=>pW.find(hW(e)),fNe=[...pW,Zi,hc],hNe=e=>fNe.find(hW(e));function pNe(e,t,n){e.hasValue(t)?e.getValue(t).set(n):e.addValue(t,lp(n))}function gNe(e,t){const n=fw(e,t);let{transitionEnd:r={},transition:i={},...o}=n?e.makeTargetAnimatable(n,!1):{};o={...o,...r};for(const a in o){const s=RMe(o[a]);pNe(e,a,s)}}function mNe(e,t,n){var r,i;const o=Object.keys(t).filter(s=>!e.hasValue(s)),a=o.length;if(a)for(let s=0;sl.remove(d))),u.push(m)}return a&&Promise.all(u).then(()=>{a&&gNe(e,a)}),u}function x4(e,t,n={}){const r=fw(e,t,n.custom);let{transition:i=e.getDefaultTransition()||{}}=r||{};n.transitionOverride&&(i=n.transitionOverride);const o=r?()=>Promise.all(gW(e,r,n)):()=>Promise.resolve(),a=e.variantChildren&&e.variantChildren.size?(l=0)=>{const{delayChildren:u=0,staggerChildren:c,staggerDirection:d}=i;return _Ne(e,t,u+l,c,d,n)}:()=>Promise.resolve(),{when:s}=i;if(s){const[l,u]=s==="beforeChildren"?[o,a]:[a,o];return l().then(()=>u())}else return Promise.all([o(),a(n.delay)])}function _Ne(e,t,n=0,r=0,i=1,o){const a=[],s=(e.variantChildren.size-1)*r,l=i===1?(u=0)=>u*r:(u=0)=>s-u*r;return Array.from(e.variantChildren).sort(SNe).forEach((u,c)=>{u.notify("AnimationStart",t),a.push(x4(u,t,{...o,delay:n+l(c)}).then(()=>u.notify("AnimationComplete",t)))}),Promise.all(a)}function SNe(e,t){return e.sortNodePosition(t)}function xNe(e,t,n={}){e.notify("AnimationStart",t);let r;if(Array.isArray(t)){const i=t.map(o=>x4(e,o,n));r=Promise.all(i)}else if(typeof t=="string")r=x4(e,t,n);else{const i=typeof t=="function"?fw(e,t,n.custom):t;r=Promise.all(gW(e,i,n))}return r.then(()=>e.notify("AnimationComplete",t))}const wNe=[...JA].reverse(),CNe=JA.length;function ENe(e){return t=>Promise.all(t.map(({animation:n,options:r})=>xNe(e,n,r)))}function kNe(e){let t=ENe(e);const n=ANe();let r=!0;const i=(l,u)=>{const c=fw(e,u);if(c){const{transition:d,transitionEnd:f,...h}=c;l={...l,...h,...f}}return l};function o(l){t=l(e)}function a(l,u){const c=e.getProps(),d=e.getVariantContext(!0)||{},f=[],h=new Set;let p={},m=1/0;for(let b=0;bm&&S;const k=Array.isArray(y)?y:[y];let P=k.reduce(i,{});w===!1&&(P={});const{prevResolvedValues:$={}}=g,O={...$,...P},E=A=>{T=!0,h.delete(A),g.needsAnimating[A]=!0};for(const A in O){const D=P[A],L=$[A];p.hasOwnProperty(A)||(D!==L?Y_(D)&&Y_(L)?!Lq(D,L)||C?E(A):g.protectedKeys[A]=!0:D!==void 0?E(A):h.add(A):D!==void 0&&h.has(A)?E(A):g.protectedKeys[A]=!0)}g.prevProp=y,g.prevResolvedValues=P,g.isActive&&(p={...p,...P}),r&&e.blockInitialAnimation&&(T=!1),T&&!x&&f.push(...k.map(A=>({animation:A,options:{type:v,...l}})))}if(h.size){const b={};h.forEach(v=>{const g=e.getBaseTarget(v);g!==void 0&&(b[v]=g)}),f.push({animation:b})}let _=!!f.length;return r&&c.initial===!1&&!e.manuallyAnimateOnMount&&(_=!1),r=!1,_?t(f):Promise.resolve()}function s(l,u,c){var d;if(n[l].isActive===u)return Promise.resolve();(d=e.variantChildren)===null||d===void 0||d.forEach(h=>{var p;return(p=h.animationState)===null||p===void 0?void 0:p.setActive(l,u)}),n[l].isActive=u;const f=a(c,l);for(const h in n)n[h].protectedKeys={};return f}return{animateChanges:a,setActive:s,setAnimateFunction:o,getState:()=>n}}function TNe(e,t){return typeof t=="string"?t!==e:Array.isArray(t)?!Lq(t,e):!1}function Lc(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function ANe(){return{animate:Lc(!0),whileInView:Lc(),whileHover:Lc(),whileTap:Lc(),whileDrag:Lc(),whileFocus:Lc(),exit:Lc()}}class PNe extends Pc{constructor(t){super(t),t.animationState||(t.animationState=kNe(t))}updateAnimationControlsSubscription(){const{animate:t}=this.node.getProps();this.unmount(),lw(t)&&(this.unmount=t.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:t}=this.node.getProps(),{animate:n}=this.node.prevProps||{};t!==n&&this.updateAnimationControlsSubscription()}unmount(){}}let INe=0;class RNe extends Pc{constructor(){super(...arguments),this.id=INe++}update(){if(!this.node.presenceContext)return;const{isPresent:t,onExitComplete:n,custom:r}=this.node.presenceContext,{isPresent:i}=this.node.prevPresenceContext||{};if(!this.node.animationState||t===i)return;const o=this.node.animationState.setActive("exit",!t,{custom:r??this.node.getProps().custom});n&&!t&&o.then(()=>n(this.id))}mount(){const{register:t}=this.node.presenceContext||{};t&&(this.unmount=t(this.id))}unmount(){}}const ONe={animation:{Feature:PNe},exit:{Feature:RNe}},f7=(e,t)=>Math.abs(e-t);function MNe(e,t){const n=f7(e.x,t.x),r=f7(e.y,t.y);return Math.sqrt(n**2+r**2)}class mW{constructor(t,n,{transformPagePoint:r}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const u=O5(this.lastMoveEventInfo,this.history),c=this.startEvent!==null,d=MNe(u.offset,{x:0,y:0})>=3;if(!c&&!d)return;const{point:f}=u,{timestamp:h}=ji;this.history.push({...f,timestamp:h});const{onStart:p,onMove:m}=this.handlers;c||(p&&p(this.lastMoveEvent,u),this.startEvent=this.lastMoveEvent),m&&m(this.lastMoveEvent,u)},this.handlePointerMove=(u,c)=>{this.lastMoveEvent=u,this.lastMoveEventInfo=R5(c,this.transformPagePoint),$n.update(this.updatePoint,!0)},this.handlePointerUp=(u,c)=>{if(this.end(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const{onEnd:d,onSessionEnd:f}=this.handlers,h=O5(u.type==="pointercancel"?this.lastMoveEventInfo:R5(c,this.transformPagePoint),this.history);this.startEvent&&d&&d(u,h),f&&f(u,h)},!Oq(t))return;this.handlers=n,this.transformPagePoint=r;const i=dw(t),o=R5(i,this.transformPagePoint),{point:a}=o,{timestamp:s}=ji;this.history=[{...a,timestamp:s}];const{onSessionStart:l}=n;l&&l(t,O5(o,this.history)),this.removeListeners=Xu(Dl(window,"pointermove",this.handlePointerMove),Dl(window,"pointerup",this.handlePointerUp),Dl(window,"pointercancel",this.handlePointerUp))}updateHandlers(t){this.handlers=t}end(){this.removeListeners&&this.removeListeners(),Kl(this.updatePoint)}}function R5(e,t){return t?{point:t(e.point)}:e}function h7(e,t){return{x:e.x-t.x,y:e.y-t.y}}function O5({point:e},t){return{point:e,delta:h7(e,yW(t)),offset:h7(e,NNe(t)),velocity:$Ne(t,.1)}}function NNe(e){return e[0]}function yW(e){return e[e.length-1]}function $Ne(e,t){if(e.length<2)return{x:0,y:0};let n=e.length-1,r=null;const i=yW(e);for(;n>=0&&(r=e[n],!(i.timestamp-r.timestamp>Yu(t)));)n--;if(!r)return{x:0,y:0};const o=Ll(i.timestamp-r.timestamp);if(o===0)return{x:0,y:0};const a={x:(i.x-r.x)/o,y:(i.y-r.y)/o};return a.x===1/0&&(a.x=0),a.y===1/0&&(a.y=0),a}function Jo(e){return e.max-e.min}function w4(e,t=0,n=.01){return Math.abs(e-t)<=n}function p7(e,t,n,r=.5){e.origin=r,e.originPoint=lr(t.min,t.max,e.origin),e.scale=Jo(n)/Jo(t),(w4(e.scale,1,1e-4)||isNaN(e.scale))&&(e.scale=1),e.translate=lr(n.min,n.max,e.origin)-e.originPoint,(w4(e.translate)||isNaN(e.translate))&&(e.translate=0)}function rm(e,t,n,r){p7(e.x,t.x,n.x,r?r.originX:void 0),p7(e.y,t.y,n.y,r?r.originY:void 0)}function g7(e,t,n){e.min=n.min+t.min,e.max=e.min+Jo(t)}function DNe(e,t,n){g7(e.x,t.x,n.x),g7(e.y,t.y,n.y)}function m7(e,t,n){e.min=t.min-n.min,e.max=e.min+Jo(t)}function im(e,t,n){m7(e.x,t.x,n.x),m7(e.y,t.y,n.y)}function LNe(e,{min:t,max:n},r){return t!==void 0&&en&&(e=r?lr(n,e,r.max):Math.min(e,n)),e}function y7(e,t,n){return{min:t!==void 0?e.min+t:void 0,max:n!==void 0?e.max+n-(e.max-e.min):void 0}}function FNe(e,{top:t,left:n,bottom:r,right:i}){return{x:y7(e.x,n,i),y:y7(e.y,t,r)}}function v7(e,t){let n=t.min-e.min,r=t.max-e.max;return t.max-t.minr?n=R0(t.min,t.max-r,e.min):r>i&&(n=R0(e.min,e.max-i,t.min)),fc(0,1,n)}function jNe(e,t){const n={};return t.min!==void 0&&(n.min=t.min-e.min),t.max!==void 0&&(n.max=t.max-e.min),n}const C4=.35;function UNe(e=C4){return e===!1?e=0:e===!0&&(e=C4),{x:b7(e,"left","right"),y:b7(e,"top","bottom")}}function b7(e,t,n){return{min:_7(e,t),max:_7(e,n)}}function _7(e,t){return typeof e=="number"?e:e[t]||0}const S7=()=>({translate:0,scale:1,origin:0,originPoint:0}),Qf=()=>({x:S7(),y:S7()}),x7=()=>({min:0,max:0}),Nr=()=>({x:x7(),y:x7()});function Ss(e){return[e("x"),e("y")]}function vW({top:e,left:t,right:n,bottom:r}){return{x:{min:t,max:n},y:{min:e,max:r}}}function VNe({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}function GNe(e,t){if(!t)return e;const n=t({x:e.left,y:e.top}),r=t({x:e.right,y:e.bottom});return{top:n.y,left:n.x,bottom:r.y,right:r.x}}function M5(e){return e===void 0||e===1}function E4({scale:e,scaleX:t,scaleY:n}){return!M5(e)||!M5(t)||!M5(n)}function Vc(e){return E4(e)||bW(e)||e.z||e.rotate||e.rotateX||e.rotateY}function bW(e){return w7(e.x)||w7(e.y)}function w7(e){return e&&e!=="0%"}function nS(e,t,n){const r=e-n,i=t*r;return n+i}function C7(e,t,n,r,i){return i!==void 0&&(e=nS(e,i,r)),nS(e,n,r)+t}function k4(e,t=0,n=1,r,i){e.min=C7(e.min,t,n,r,i),e.max=C7(e.max,t,n,r,i)}function _W(e,{x:t,y:n}){k4(e.x,t.translate,t.scale,t.originPoint),k4(e.y,n.translate,n.scale,n.originPoint)}function HNe(e,t,n,r=!1){const i=n.length;if(!i)return;t.x=t.y=1;let o,a;for(let s=0;s1.0000000000001||e<.999999999999?e:1}function bu(e,t){e.min=e.min+t,e.max=e.max+t}function k7(e,t,[n,r,i]){const o=t[i]!==void 0?t[i]:.5,a=lr(e.min,e.max,o);k4(e,t[n],t[r],a,t.scale)}const qNe=["x","scaleX","originX"],WNe=["y","scaleY","originY"];function Xf(e,t){k7(e.x,t,qNe),k7(e.y,t,WNe)}function SW(e,t){return vW(GNe(e.getBoundingClientRect(),t))}function KNe(e,t,n){const r=SW(e,n),{scroll:i}=t;return i&&(bu(r.x,i.offset.x),bu(r.y,i.offset.y)),r}const QNe=new WeakMap;class XNe{constructor(t){this.openGlobalLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=Nr(),this.visualElement=t}start(t,{snapToCursor:n=!1}={}){const{presenceContext:r}=this.visualElement;if(r&&r.isPresent===!1)return;const i=l=>{this.stopAnimation(),n&&this.snapToCursor(dw(l,"page").point)},o=(l,u)=>{const{drag:c,dragPropagation:d,onDragStart:f}=this.getProps();if(c&&!d&&(this.openGlobalLock&&this.openGlobalLock(),this.openGlobalLock=Nq(c),!this.openGlobalLock))return;this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),Ss(p=>{let m=this.getAxisMotionValue(p).get()||0;if(Ws.test(m)){const{projection:_}=this.visualElement;if(_&&_.layout){const b=_.layout.layoutBox[p];b&&(m=Jo(b)*(parseFloat(m)/100))}}this.originPoint[p]=m}),f&&$n.update(()=>f(l,u),!1,!0);const{animationState:h}=this.visualElement;h&&h.setActive("whileDrag",!0)},a=(l,u)=>{const{dragPropagation:c,dragDirectionLock:d,onDirectionLock:f,onDrag:h}=this.getProps();if(!c&&!this.openGlobalLock)return;const{offset:p}=u;if(d&&this.currentDirection===null){this.currentDirection=YNe(p),this.currentDirection!==null&&f&&f(this.currentDirection);return}this.updateAxis("x",u.point,p),this.updateAxis("y",u.point,p),this.visualElement.render(),h&&h(l,u)},s=(l,u)=>this.stop(l,u);this.panSession=new mW(t,{onSessionStart:i,onStart:o,onMove:a,onSessionEnd:s},{transformPagePoint:this.visualElement.getTransformPagePoint()})}stop(t,n){const r=this.isDragging;if(this.cancel(),!r)return;const{velocity:i}=n;this.startAnimation(i);const{onDragEnd:o}=this.getProps();o&&$n.update(()=>o(t,n))}cancel(){this.isDragging=!1;const{projection:t,animationState:n}=this.visualElement;t&&(t.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;const{dragPropagation:r}=this.getProps();!r&&this.openGlobalLock&&(this.openGlobalLock(),this.openGlobalLock=null),n&&n.setActive("whileDrag",!1)}updateAxis(t,n,r){const{drag:i}=this.getProps();if(!r||!i1(t,i,this.currentDirection))return;const o=this.getAxisMotionValue(t);let a=this.originPoint[t]+r[t];this.constraints&&this.constraints[t]&&(a=LNe(a,this.constraints[t],this.elastic[t])),o.set(a)}resolveConstraints(){const{dragConstraints:t,dragElastic:n}=this.getProps(),{layout:r}=this.visualElement.projection||{},i=this.constraints;t&&Wf(t)?this.constraints||(this.constraints=this.resolveRefConstraints()):t&&r?this.constraints=FNe(r.layoutBox,t):this.constraints=!1,this.elastic=UNe(n),i!==this.constraints&&r&&this.constraints&&!this.hasMutatedConstraints&&Ss(o=>{this.getAxisMotionValue(o)&&(this.constraints[o]=jNe(r.layoutBox[o],this.constraints[o]))})}resolveRefConstraints(){const{dragConstraints:t,onMeasureDragConstraints:n}=this.getProps();if(!t||!Wf(t))return!1;const r=t.current,{projection:i}=this.visualElement;if(!i||!i.layout)return!1;const o=KNe(r,i.root,this.visualElement.getTransformPagePoint());let a=BNe(i.layout.layoutBox,o);if(n){const s=n(VNe(a));this.hasMutatedConstraints=!!s,s&&(a=vW(s))}return a}startAnimation(t){const{drag:n,dragMomentum:r,dragElastic:i,dragTransition:o,dragSnapToOrigin:a,onDragTransitionEnd:s}=this.getProps(),l=this.constraints||{},u=Ss(c=>{if(!i1(c,n,this.currentDirection))return;let d=l&&l[c]||{};a&&(d={min:0,max:0});const f=i?200:1e6,h=i?40:1e7,p={type:"inertia",velocity:r?t[c]:0,bounceStiffness:f,bounceDamping:h,timeConstant:750,restDelta:1,restSpeed:10,...o,...d};return this.startAxisValueAnimation(c,p)});return Promise.all(u).then(s)}startAxisValueAnimation(t,n){const r=this.getAxisMotionValue(t);return r.start(gP(t,r,0,n))}stopAnimation(){Ss(t=>this.getAxisMotionValue(t).stop())}getAxisMotionValue(t){const n="_drag"+t.toUpperCase(),r=this.visualElement.getProps(),i=r[n];return i||this.visualElement.getValue(t,(r.initial?r.initial[t]:void 0)||0)}snapToCursor(t){Ss(n=>{const{drag:r}=this.getProps();if(!i1(n,r,this.currentDirection))return;const{projection:i}=this.visualElement,o=this.getAxisMotionValue(n);if(i&&i.layout){const{min:a,max:s}=i.layout.layoutBox[n];o.set(t[n]-lr(a,s,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:t,dragConstraints:n}=this.getProps(),{projection:r}=this.visualElement;if(!Wf(n)||!r||!this.constraints)return;this.stopAnimation();const i={x:0,y:0};Ss(a=>{const s=this.getAxisMotionValue(a);if(s){const l=s.get();i[a]=zNe({min:l,max:l},this.constraints[a])}});const{transformTemplate:o}=this.visualElement.getProps();this.visualElement.current.style.transform=o?o({},""):"none",r.root&&r.root.updateScroll(),r.updateLayout(),this.resolveConstraints(),Ss(a=>{if(!i1(a,t,null))return;const s=this.getAxisMotionValue(a),{min:l,max:u}=this.constraints[a];s.set(lr(l,u,i[a]))})}addListeners(){if(!this.visualElement.current)return;QNe.set(this.visualElement,this);const t=this.visualElement.current,n=Dl(t,"pointerdown",l=>{const{drag:u,dragListener:c=!0}=this.getProps();u&&c&&this.start(l)}),r=()=>{const{dragConstraints:l}=this.getProps();Wf(l)&&(this.constraints=this.resolveRefConstraints())},{projection:i}=this.visualElement,o=i.addEventListener("measure",r);i&&!i.layout&&(i.root&&i.root.updateScroll(),i.updateLayout()),r();const a=Rl(window,"resize",()=>this.scalePositionWithinConstraints()),s=i.addEventListener("didUpdate",({delta:l,hasLayoutChanged:u})=>{this.isDragging&&u&&(Ss(c=>{const d=this.getAxisMotionValue(c);d&&(this.originPoint[c]+=l[c].translate,d.set(d.get()+l[c].translate))}),this.visualElement.render())});return()=>{a(),n(),o(),s&&s()}}getProps(){const t=this.visualElement.getProps(),{drag:n=!1,dragDirectionLock:r=!1,dragPropagation:i=!1,dragConstraints:o=!1,dragElastic:a=C4,dragMomentum:s=!0}=t;return{...t,drag:n,dragDirectionLock:r,dragPropagation:i,dragConstraints:o,dragElastic:a,dragMomentum:s}}}function i1(e,t,n){return(t===!0||t===e)&&(n===null||n===e)}function YNe(e,t=10){let n=null;return Math.abs(e.y)>t?n="y":Math.abs(e.x)>t&&(n="x"),n}class ZNe extends Pc{constructor(t){super(t),this.removeGroupControls=yr,this.removeListeners=yr,this.controls=new XNe(t)}mount(){const{dragControls:t}=this.node.getProps();t&&(this.removeGroupControls=t.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||yr}unmount(){this.removeGroupControls(),this.removeListeners()}}const T7=e=>(t,n)=>{e&&$n.update(()=>e(t,n))};class JNe extends Pc{constructor(){super(...arguments),this.removePointerDownListener=yr}onPointerDown(t){this.session=new mW(t,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint()})}createPanHandlers(){const{onPanSessionStart:t,onPanStart:n,onPan:r,onPanEnd:i}=this.node.getProps();return{onSessionStart:T7(t),onStart:T7(n),onMove:r,onEnd:(o,a)=>{delete this.session,i&&$n.update(()=>i(o,a))}}}mount(){this.removePointerDownListener=Dl(this.node.current,"pointerdown",t=>this.onPointerDown(t))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}function e$e(){const e=I.useContext(My);if(e===null)return[!0,null];const{isPresent:t,onExitComplete:n,register:r}=e,i=I.useId();return I.useEffect(()=>r(i),[]),!t&&n?[!1,()=>n&&n(i)]:[!0]}function t$e(){return n$e(I.useContext(My))}function n$e(e){return e===null?!0:e.isPresent}const ob={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function A7(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}const lg={correct:(e,t)=>{if(!t.target)return e;if(typeof e=="string")if(at.test(e))e=parseFloat(e);else return e;const n=A7(e,t.target.x),r=A7(e,t.target.y);return`${n}% ${r}%`}},r$e={correct:(e,{treeScale:t,projectionDelta:n})=>{const r=e,i=hc.parse(e);if(i.length>5)return r;const o=hc.createTransformer(e),a=typeof i[0]!="number"?1:0,s=n.x.scale*t.x,l=n.y.scale*t.y;i[0+a]/=s,i[1+a]/=l;const u=lr(s,l,.5);return typeof i[2+a]=="number"&&(i[2+a]/=u),typeof i[3+a]=="number"&&(i[3+a]/=u),o(i)}};class i$e extends En.Component{componentDidMount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:r,layoutId:i}=this.props,{projection:o}=t;uMe(o$e),o&&(n.group&&n.group.add(o),r&&r.register&&i&&r.register(o),o.root.didUpdate(),o.addEventListener("animationComplete",()=>{this.safeToRemove()}),o.setOptions({...o.options,onExitComplete:()=>this.safeToRemove()})),ob.hasEverUpdated=!0}getSnapshotBeforeUpdate(t){const{layoutDependency:n,visualElement:r,drag:i,isPresent:o}=this.props,a=r.projection;return a&&(a.isPresent=o,i||t.layoutDependency!==n||n===void 0?a.willUpdate():this.safeToRemove(),t.isPresent!==o&&(o?a.promote():a.relegate()||$n.postRender(()=>{const s=a.getStack();(!s||!s.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:t}=this.props.visualElement;t&&(t.root.didUpdate(),queueMicrotask(()=>{!t.currentAnimation&&t.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:r}=this.props,{projection:i}=t;i&&(i.scheduleCheckAfterUnmount(),n&&n.group&&n.group.remove(i),r&&r.deregister&&r.deregister(i))}safeToRemove(){const{safeToRemove:t}=this.props;t&&t()}render(){return null}}function xW(e){const[t,n]=e$e(),r=I.useContext(tP);return En.createElement(i$e,{...e,layoutGroup:r,switchLayoutGroup:I.useContext(yq),isPresent:t,safeToRemove:n})}const o$e={borderRadius:{...lg,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:lg,borderTopRightRadius:lg,borderBottomLeftRadius:lg,borderBottomRightRadius:lg,boxShadow:r$e},wW=["TopLeft","TopRight","BottomLeft","BottomRight"],a$e=wW.length,P7=e=>typeof e=="string"?parseFloat(e):e,I7=e=>typeof e=="number"||at.test(e);function s$e(e,t,n,r,i,o){i?(e.opacity=lr(0,n.opacity!==void 0?n.opacity:1,l$e(r)),e.opacityExit=lr(t.opacity!==void 0?t.opacity:1,0,u$e(r))):o&&(e.opacity=lr(t.opacity!==void 0?t.opacity:1,n.opacity!==void 0?n.opacity:1,r));for(let a=0;art?1:n(R0(e,t,r))}function O7(e,t){e.min=t.min,e.max=t.max}function ua(e,t){O7(e.x,t.x),O7(e.y,t.y)}function M7(e,t,n,r,i){return e-=t,e=nS(e,1/n,r),i!==void 0&&(e=nS(e,1/i,r)),e}function c$e(e,t=0,n=1,r=.5,i,o=e,a=e){if(Ws.test(t)&&(t=parseFloat(t),t=lr(a.min,a.max,t/100)-a.min),typeof t!="number")return;let s=lr(o.min,o.max,r);e===o&&(s-=t),e.min=M7(e.min,t,n,s,i),e.max=M7(e.max,t,n,s,i)}function N7(e,t,[n,r,i],o,a){c$e(e,t[n],t[r],t[i],t.scale,o,a)}const d$e=["x","scaleX","originX"],f$e=["y","scaleY","originY"];function $7(e,t,n,r){N7(e.x,t,d$e,n?n.x:void 0,r?r.x:void 0),N7(e.y,t,f$e,n?n.y:void 0,r?r.y:void 0)}function D7(e){return e.translate===0&&e.scale===1}function EW(e){return D7(e.x)&&D7(e.y)}function h$e(e,t){return e.x.min===t.x.min&&e.x.max===t.x.max&&e.y.min===t.y.min&&e.y.max===t.y.max}function kW(e,t){return Math.round(e.x.min)===Math.round(t.x.min)&&Math.round(e.x.max)===Math.round(t.x.max)&&Math.round(e.y.min)===Math.round(t.y.min)&&Math.round(e.y.max)===Math.round(t.y.max)}function L7(e){return Jo(e.x)/Jo(e.y)}class p$e{constructor(){this.members=[]}add(t){mP(this.members,t),t.scheduleRender()}remove(t){if(yP(this.members,t),t===this.prevLead&&(this.prevLead=void 0),t===this.lead){const n=this.members[this.members.length-1];n&&this.promote(n)}}relegate(t){const n=this.members.findIndex(i=>t===i);if(n===0)return!1;let r;for(let i=n;i>=0;i--){const o=this.members[i];if(o.isPresent!==!1){r=o;break}}return r?(this.promote(r),!0):!1}promote(t,n){const r=this.lead;if(t!==r&&(this.prevLead=r,this.lead=t,t.show(),r)){r.instance&&r.scheduleRender(),t.scheduleRender(),t.resumeFrom=r,n&&(t.resumeFrom.preserveOpacity=!0),r.snapshot&&(t.snapshot=r.snapshot,t.snapshot.latestValues=r.animationValues||r.latestValues),t.root&&t.root.isUpdating&&(t.isLayoutDirty=!0);const{crossfade:i}=t.options;i===!1&&r.hide()}}exitAnimationComplete(){this.members.forEach(t=>{const{options:n,resumingFrom:r}=t;n.onExitComplete&&n.onExitComplete(),r&&r.options.onExitComplete&&r.options.onExitComplete()})}scheduleRender(){this.members.forEach(t=>{t.instance&&t.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}function F7(e,t,n){let r="";const i=e.x.translate/t.x,o=e.y.translate/t.y;if((i||o)&&(r=`translate3d(${i}px, ${o}px, 0) `),(t.x!==1||t.y!==1)&&(r+=`scale(${1/t.x}, ${1/t.y}) `),n){const{rotate:l,rotateX:u,rotateY:c}=n;l&&(r+=`rotate(${l}deg) `),u&&(r+=`rotateX(${u}deg) `),c&&(r+=`rotateY(${c}deg) `)}const a=e.x.scale*t.x,s=e.y.scale*t.y;return(a!==1||s!==1)&&(r+=`scale(${a}, ${s})`),r||"none"}const g$e=(e,t)=>e.depth-t.depth;class m$e{constructor(){this.children=[],this.isDirty=!1}add(t){mP(this.children,t),this.isDirty=!0}remove(t){yP(this.children,t),this.isDirty=!0}forEach(t){this.isDirty&&this.children.sort(g$e),this.isDirty=!1,this.children.forEach(t)}}function y$e(e,t){const n=performance.now(),r=({timestamp:i})=>{const o=i-n;o>=t&&(Kl(r),e(o-t))};return $n.read(r,!0),()=>Kl(r)}function v$e(e){window.MotionDebug&&window.MotionDebug.record(e)}function b$e(e){return e instanceof SVGElement&&e.tagName!=="svg"}function _$e(e,t,n){const r=Mo(e)?e:lp(e);return r.start(gP("",r,t,n)),r.animation}const B7=["","X","Y","Z"],z7=1e3;let S$e=0;const Gc={type:"projectionFrame",totalNodes:0,resolvedTargetDeltas:0,recalculatedProjection:0};function TW({attachResizeListener:e,defaultParent:t,measureScroll:n,checkIsScrollRoot:r,resetTransform:i}){return class{constructor(a={},s=t==null?void 0:t()){this.id=S$e++,this.animationId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.updateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{Gc.totalNodes=Gc.resolvedTargetDeltas=Gc.recalculatedProjection=0,this.nodes.forEach(C$e),this.nodes.forEach(P$e),this.nodes.forEach(I$e),this.nodes.forEach(E$e),v$e(Gc)},this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=a,this.root=s?s.root||s:this,this.path=s?[...s.path,s]:[],this.parent=s,this.depth=s?s.depth+1:0;for(let l=0;lthis.root.updateBlockedByResize=!1;e(a,()=>{this.root.updateBlockedByResize=!0,d&&d(),d=y$e(f,250),ob.hasAnimatedSinceResize&&(ob.hasAnimatedSinceResize=!1,this.nodes.forEach(U7))})}l&&this.root.registerSharedNode(l,this),this.options.animate!==!1&&c&&(l||u)&&this.addEventListener("didUpdate",({delta:d,hasLayoutChanged:f,hasRelativeTargetChanged:h,layout:p})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const m=this.options.transition||c.getDefaultTransition()||$$e,{onLayoutAnimationStart:_,onLayoutAnimationComplete:b}=c.getProps(),v=!this.targetLayout||!kW(this.targetLayout,p)||h,g=!f&&h;if(this.options.layoutRoot||this.resumeFrom&&this.resumeFrom.instance||g||f&&(v||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0),this.setAnimationOrigin(d,g);const y={...dW(m,"layout"),onPlay:_,onComplete:b};(c.shouldReduceMotion||this.options.layoutRoot)&&(y.delay=0,y.type=!1),this.startAnimation(y)}else f||U7(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=p})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const a=this.getStack();a&&a.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,Kl(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(R$e),this.animationId++)}getTransformTemplate(){const{visualElement:a}=this.options;return a&&a.getProps().transformTemplate}willUpdate(a=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let c=0;cthis.update()))}clearAllSnapshots(){this.nodes.forEach(k$e),this.sharedNodes.forEach(O$e)}scheduleUpdateProjection(){$n.preRender(this.updateProjection,!1,!0)}scheduleCheckAfterUnmount(){$n.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure())}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let l=0;l{const S=y/1e3;V7(d.x,a.x,S),V7(d.y,a.y,S),this.setTargetDelta(d),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(im(f,this.layout.layoutBox,this.relativeParent.layout.layoutBox),M$e(this.relativeTarget,this.relativeTargetOrigin,f,S),g&&h$e(this.relativeTarget,g)&&(this.isProjectionDirty=!1),g||(g=Nr()),ua(g,this.relativeTarget)),m&&(this.animationValues=c,s$e(c,u,this.latestValues,S,v,b)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=S},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(a){this.notifyListeners("animationStart"),this.currentAnimation&&this.currentAnimation.stop(),this.resumingFrom&&this.resumingFrom.currentAnimation&&this.resumingFrom.currentAnimation.stop(),this.pendingAnimation&&(Kl(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=$n.update(()=>{ob.hasAnimatedSinceResize=!0,this.currentAnimation=_$e(0,z7,{...a,onUpdate:s=>{this.mixTargetDelta(s),a.onUpdate&&a.onUpdate(s)},onComplete:()=>{a.onComplete&&a.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const a=this.getStack();a&&a.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(z7),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const a=this.getLead();let{targetWithTransforms:s,target:l,layout:u,latestValues:c}=a;if(!(!s||!l||!u)){if(this!==a&&this.layout&&u&&AW(this.options.animationType,this.layout.layoutBox,u.layoutBox)){l=this.target||Nr();const d=Jo(this.layout.layoutBox.x);l.x.min=a.target.x.min,l.x.max=l.x.min+d;const f=Jo(this.layout.layoutBox.y);l.y.min=a.target.y.min,l.y.max=l.y.min+f}ua(s,l),Xf(s,c),rm(this.projectionDeltaWithTransform,this.layoutCorrected,s,c)}}registerSharedNode(a,s){this.sharedNodes.has(a)||this.sharedNodes.set(a,new p$e),this.sharedNodes.get(a).add(s);const u=s.options.initialPromotionConfig;s.promote({transition:u?u.transition:void 0,preserveFollowOpacity:u&&u.shouldPreserveFollowOpacity?u.shouldPreserveFollowOpacity(s):void 0})}isLead(){const a=this.getStack();return a?a.lead===this:!0}getLead(){var a;const{layoutId:s}=this.options;return s?((a=this.getStack())===null||a===void 0?void 0:a.lead)||this:this}getPrevLead(){var a;const{layoutId:s}=this.options;return s?(a=this.getStack())===null||a===void 0?void 0:a.prevLead:void 0}getStack(){const{layoutId:a}=this.options;if(a)return this.root.sharedNodes.get(a)}promote({needsReset:a,transition:s,preserveFollowOpacity:l}={}){const u=this.getStack();u&&u.promote(this,l),a&&(this.projectionDelta=void 0,this.needsReset=!0),s&&this.setOptions({transition:s})}relegate(){const a=this.getStack();return a?a.relegate(this):!1}resetRotation(){const{visualElement:a}=this.options;if(!a)return;let s=!1;const{latestValues:l}=a;if((l.rotate||l.rotateX||l.rotateY||l.rotateZ)&&(s=!0),!s)return;const u={};for(let c=0;c{var s;return(s=a.currentAnimation)===null||s===void 0?void 0:s.stop()}),this.root.nodes.forEach(j7),this.root.sharedNodes.clear()}}}function x$e(e){e.updateLayout()}function w$e(e){var t;const n=((t=e.resumeFrom)===null||t===void 0?void 0:t.snapshot)||e.snapshot;if(e.isLead()&&e.layout&&n&&e.hasListeners("didUpdate")){const{layoutBox:r,measuredBox:i}=e.layout,{animationType:o}=e.options,a=n.source!==e.layout.source;o==="size"?Ss(d=>{const f=a?n.measuredBox[d]:n.layoutBox[d],h=Jo(f);f.min=r[d].min,f.max=f.min+h}):AW(o,n.layoutBox,r)&&Ss(d=>{const f=a?n.measuredBox[d]:n.layoutBox[d],h=Jo(r[d]);f.max=f.min+h,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[d].max=e.relativeTarget[d].min+h)});const s=Qf();rm(s,r,n.layoutBox);const l=Qf();a?rm(l,e.applyTransform(i,!0),n.measuredBox):rm(l,r,n.layoutBox);const u=!EW(s);let c=!1;if(!e.resumeFrom){const d=e.getClosestProjectingParent();if(d&&!d.resumeFrom){const{snapshot:f,layout:h}=d;if(f&&h){const p=Nr();im(p,n.layoutBox,f.layoutBox);const m=Nr();im(m,r,h.layoutBox),kW(p,m)||(c=!0),d.options.layoutRoot&&(e.relativeTarget=m,e.relativeTargetOrigin=p,e.relativeParent=d)}}}e.notifyListeners("didUpdate",{layout:r,snapshot:n,delta:l,layoutDelta:s,hasLayoutChanged:u,hasRelativeTargetChanged:c})}else if(e.isLead()){const{onExitComplete:r}=e.options;r&&r()}e.options.transition=void 0}function C$e(e){Gc.totalNodes++,e.parent&&(e.isProjecting()||(e.isProjectionDirty=e.parent.isProjectionDirty),e.isSharedProjectionDirty||(e.isSharedProjectionDirty=!!(e.isProjectionDirty||e.parent.isProjectionDirty||e.parent.isSharedProjectionDirty)),e.isTransformDirty||(e.isTransformDirty=e.parent.isTransformDirty))}function E$e(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function k$e(e){e.clearSnapshot()}function j7(e){e.clearMeasurements()}function T$e(e){e.isLayoutDirty=!1}function A$e(e){const{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify("BeforeLayoutMeasure"),e.resetTransform()}function U7(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function P$e(e){e.resolveTargetDelta()}function I$e(e){e.calcProjection()}function R$e(e){e.resetRotation()}function O$e(e){e.removeLeadSnapshot()}function V7(e,t,n){e.translate=lr(t.translate,0,n),e.scale=lr(t.scale,1,n),e.origin=t.origin,e.originPoint=t.originPoint}function G7(e,t,n,r){e.min=lr(t.min,n.min,r),e.max=lr(t.max,n.max,r)}function M$e(e,t,n,r){G7(e.x,t.x,n.x,r),G7(e.y,t.y,n.y,r)}function N$e(e){return e.animationValues&&e.animationValues.opacityExit!==void 0}const $$e={duration:.45,ease:[.4,0,.1,1]},H7=e=>typeof navigator<"u"&&navigator.userAgent.toLowerCase().includes(e),q7=H7("applewebkit/")&&!H7("chrome/")?Math.round:yr;function W7(e){e.min=q7(e.min),e.max=q7(e.max)}function D$e(e){W7(e.x),W7(e.y)}function AW(e,t,n){return e==="position"||e==="preserve-aspect"&&!w4(L7(t),L7(n),.2)}const L$e=TW({attachResizeListener:(e,t)=>Rl(e,"resize",t),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),N5={current:void 0},PW=TW({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!N5.current){const e=new L$e({});e.mount(window),e.setOptions({layoutScroll:!0}),N5.current=e}return N5.current},resetTransform:(e,t)=>{e.style.transform=t!==void 0?t:"none"},checkIsScrollRoot:e=>window.getComputedStyle(e).position==="fixed"}),F$e={pan:{Feature:JNe},drag:{Feature:ZNe,ProjectionNode:PW,MeasureLayout:xW}},B$e=/var\((--[a-zA-Z0-9-_]+),? ?([a-zA-Z0-9 ()%#.,-]+)?\)/;function z$e(e){const t=B$e.exec(e);if(!t)return[,];const[,n,r]=t;return[n,r]}function T4(e,t,n=1){const[r,i]=z$e(e);if(!r)return;const o=window.getComputedStyle(t).getPropertyValue(r);if(o){const a=o.trim();return fW(a)?parseFloat(a):a}else return m4(i)?T4(i,t,n+1):i}function j$e(e,{...t},n){const r=e.current;if(!(r instanceof Element))return{target:t,transitionEnd:n};n&&(n={...n}),e.values.forEach(i=>{const o=i.get();if(!m4(o))return;const a=T4(o,r);a&&i.set(a)});for(const i in t){const o=t[i];if(!m4(o))continue;const a=T4(o,r);a&&(t[i]=a,n||(n={}),n[i]===void 0&&(n[i]=o))}return{target:t,transitionEnd:n}}const U$e=new Set(["width","height","top","left","right","bottom","x","y","translateX","translateY"]),IW=e=>U$e.has(e),V$e=e=>Object.keys(e).some(IW),K7=e=>e===ef||e===at,Q7=(e,t)=>parseFloat(e.split(", ")[t]),X7=(e,t)=>(n,{transform:r})=>{if(r==="none"||!r)return 0;const i=r.match(/^matrix3d\((.+)\)$/);if(i)return Q7(i[1],t);{const o=r.match(/^matrix\((.+)\)$/);return o?Q7(o[1],e):0}},G$e=new Set(["x","y","z"]),H$e=Ny.filter(e=>!G$e.has(e));function q$e(e){const t=[];return H$e.forEach(n=>{const r=e.getValue(n);r!==void 0&&(t.push([n,r.get()]),r.set(n.startsWith("scale")?1:0))}),t.length&&e.render(),t}const up={width:({x:e},{paddingLeft:t="0",paddingRight:n="0"})=>e.max-e.min-parseFloat(t)-parseFloat(n),height:({y:e},{paddingTop:t="0",paddingBottom:n="0"})=>e.max-e.min-parseFloat(t)-parseFloat(n),top:(e,{top:t})=>parseFloat(t),left:(e,{left:t})=>parseFloat(t),bottom:({y:e},{top:t})=>parseFloat(t)+(e.max-e.min),right:({x:e},{left:t})=>parseFloat(t)+(e.max-e.min),x:X7(4,13),y:X7(5,14)};up.translateX=up.x;up.translateY=up.y;const W$e=(e,t,n)=>{const r=t.measureViewportBox(),i=t.current,o=getComputedStyle(i),{display:a}=o,s={};a==="none"&&t.setStaticValue("display",e.display||"block"),n.forEach(u=>{s[u]=up[u](r,o)}),t.render();const l=t.measureViewportBox();return n.forEach(u=>{const c=t.getValue(u);c&&c.jump(s[u]),e[u]=up[u](l,o)}),e},K$e=(e,t,n={},r={})=>{t={...t},r={...r};const i=Object.keys(t).filter(IW);let o=[],a=!1;const s=[];if(i.forEach(l=>{const u=e.getValue(l);if(!e.hasValue(l))return;let c=n[l],d=sg(c);const f=t[l];let h;if(Y_(f)){const p=f.length,m=f[0]===null?1:0;c=f[m],d=sg(c);for(let _=m;_=0?window.pageYOffset:null,u=W$e(t,e,s);return o.length&&o.forEach(([c,d])=>{e.getValue(c).set(d)}),e.render(),sw&&l!==null&&window.scrollTo({top:l}),{target:u,transitionEnd:r}}else return{target:t,transitionEnd:r}};function Q$e(e,t,n,r){return V$e(t)?K$e(e,t,n,r):{target:t,transitionEnd:r}}const X$e=(e,t,n,r)=>{const i=j$e(e,t,r);return t=i.target,r=i.transitionEnd,Q$e(e,t,n,r)},A4={current:null},RW={current:!1};function Y$e(){if(RW.current=!0,!!sw)if(window.matchMedia){const e=window.matchMedia("(prefers-reduced-motion)"),t=()=>A4.current=e.matches;e.addListener(t),t()}else A4.current=!1}function Z$e(e,t,n){const{willChange:r}=t;for(const i in t){const o=t[i],a=n[i];if(Mo(o))e.addValue(i,o),tS(r)&&r.add(i);else if(Mo(a))e.addValue(i,lp(o,{owner:e})),tS(r)&&r.remove(i);else if(a!==o)if(e.hasValue(i)){const s=e.getValue(i);!s.hasAnimated&&s.set(o)}else{const s=e.getStaticValue(i);e.addValue(i,lp(s!==void 0?s:o,{owner:e}))}}for(const i in n)t[i]===void 0&&e.removeValue(i);return t}const Y7=new WeakMap,OW=Object.keys(I0),J$e=OW.length,Z7=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"],eDe=eP.length;class tDe{constructor({parent:t,props:n,presenceContext:r,reducedMotionConfig:i,visualState:o},a={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.scheduleRender=()=>$n.render(this.render,!1,!0);const{latestValues:s,renderState:l}=o;this.latestValues=s,this.baseTarget={...s},this.initialValues=n.initial?{...s}:{},this.renderState=l,this.parent=t,this.props=n,this.presenceContext=r,this.depth=t?t.depth+1:0,this.reducedMotionConfig=i,this.options=a,this.isControllingVariants=uw(n),this.isVariantNode=mq(n),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(t&&t.current);const{willChange:u,...c}=this.scrapeMotionValuesFromProps(n,{});for(const d in c){const f=c[d];s[d]!==void 0&&Mo(f)&&(f.set(s[d],!1),tS(u)&&u.add(d))}}scrapeMotionValuesFromProps(t,n){return{}}mount(t){this.current=t,Y7.set(t,this),this.projection&&!this.projection.instance&&this.projection.mount(t),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((n,r)=>this.bindToMotionValue(r,n)),RW.current||Y$e(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:A4.current,this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){Y7.delete(this.current),this.projection&&this.projection.unmount(),Kl(this.notifyUpdate),Kl(this.render),this.valueSubscriptions.forEach(t=>t()),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent&&this.parent.children.delete(this);for(const t in this.events)this.events[t].clear();for(const t in this.features)this.features[t].unmount();this.current=null}bindToMotionValue(t,n){const r=Jd.has(t),i=n.on("change",a=>{this.latestValues[t]=a,this.props.onUpdate&&$n.update(this.notifyUpdate,!1,!0),r&&this.projection&&(this.projection.isTransformDirty=!0)}),o=n.on("renderRequest",this.scheduleRender);this.valueSubscriptions.set(t,()=>{i(),o()})}sortNodePosition(t){return!this.current||!this.sortInstanceNodePosition||this.type!==t.type?0:this.sortInstanceNodePosition(this.current,t.current)}loadFeatures({children:t,...n},r,i,o){let a,s;for(let l=0;lthis.scheduleRender(),animationType:typeof u=="string"?u:"both",initialPromotionConfig:o,layoutScroll:f,layoutRoot:h})}return s}updateFeatures(){for(const t in this.features){const n=this.features[t];n.isMounted?n.update():(n.mount(),n.isMounted=!0)}}triggerBuild(){this.build(this.renderState,this.latestValues,this.options,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):Nr()}getStaticValue(t){return this.latestValues[t]}setStaticValue(t,n){this.latestValues[t]=n}makeTargetAnimatable(t,n=!0){return this.makeTargetAnimatableFromInstance(t,this.props,n)}update(t,n){(t.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=t,this.prevPresenceContext=this.presenceContext,this.presenceContext=n;for(let r=0;rn.variantChildren.delete(t)}addValue(t,n){n!==this.values.get(t)&&(this.removeValue(t),this.bindToMotionValue(t,n)),this.values.set(t,n),this.latestValues[t]=n.get()}removeValue(t){this.values.delete(t);const n=this.valueSubscriptions.get(t);n&&(n(),this.valueSubscriptions.delete(t)),delete this.latestValues[t],this.removeValueFromRenderState(t,this.renderState)}hasValue(t){return this.values.has(t)}getValue(t,n){if(this.props.values&&this.props.values[t])return this.props.values[t];let r=this.values.get(t);return r===void 0&&n!==void 0&&(r=lp(n,{owner:this}),this.addValue(t,r)),r}readValue(t){var n;return this.latestValues[t]!==void 0||!this.current?this.latestValues[t]:(n=this.getBaseTargetFromProps(this.props,t))!==null&&n!==void 0?n:this.readValueFromInstance(this.current,t,this.options)}setBaseTarget(t,n){this.baseTarget[t]=n}getBaseTarget(t){var n;const{initial:r}=this.props,i=typeof r=="string"||typeof r=="object"?(n=uP(this.props,r))===null||n===void 0?void 0:n[t]:void 0;if(r&&i!==void 0)return i;const o=this.getBaseTargetFromProps(this.props,t);return o!==void 0&&!Mo(o)?o:this.initialValues[t]!==void 0&&i===void 0?void 0:this.baseTarget[t]}on(t,n){return this.events[t]||(this.events[t]=new vP),this.events[t].add(n)}notify(t,...n){this.events[t]&&this.events[t].notify(...n)}}class MW extends tDe{sortInstanceNodePosition(t,n){return t.compareDocumentPosition(n)&2?1:-1}getBaseTargetFromProps(t,n){return t.style?t.style[n]:void 0}removeValueFromRenderState(t,{vars:n,style:r}){delete n[t],delete r[t]}makeTargetAnimatableFromInstance({transition:t,transitionEnd:n,...r},{transformValues:i},o){let a=vNe(r,t||{},this);if(i&&(n&&(n=i(n)),r&&(r=i(r)),a&&(a=i(a))),o){mNe(this,r,a);const s=X$e(this,r,a,n);n=s.transitionEnd,r=s.target}return{transition:t,transitionEnd:n,...r}}}function nDe(e){return window.getComputedStyle(e)}class rDe extends MW{readValueFromInstance(t,n){if(Jd.has(n)){const r=pP(n);return r&&r.default||0}else{const r=nDe(t),i=(_q(n)?r.getPropertyValue(n):r[n])||0;return typeof i=="string"?i.trim():i}}measureInstanceViewportBox(t,{transformPagePoint:n}){return SW(t,n)}build(t,n,r,i){rP(t,n,r,i.transformTemplate)}scrapeMotionValuesFromProps(t,n){return lP(t,n)}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:t}=this.props;Mo(t)&&(this.childSubscription=t.on("change",n=>{this.current&&(this.current.textContent=`${n}`)}))}renderInstance(t,n,r,i){kq(t,n,r,i)}}class iDe extends MW{constructor(){super(...arguments),this.isSVGTag=!1}getBaseTargetFromProps(t,n){return t[n]}readValueFromInstance(t,n){if(Jd.has(n)){const r=pP(n);return r&&r.default||0}return n=Tq.has(n)?n:sP(n),t.getAttribute(n)}measureInstanceViewportBox(){return Nr()}scrapeMotionValuesFromProps(t,n){return Pq(t,n)}build(t,n,r,i){oP(t,n,r,this.isSVGTag,i.transformTemplate)}renderInstance(t,n,r,i){Aq(t,n,r,i)}mount(t){this.isSVGTag=aP(t.tagName),super.mount(t)}}const oDe=(e,t)=>nP(e)?new iDe(t,{enableHardwareAcceleration:!1}):new rDe(t,{enableHardwareAcceleration:!0}),aDe={layout:{ProjectionNode:PW,MeasureLayout:xW}},sDe={...ONe,...ZMe,...F$e,...aDe},NW=sMe((e,t)=>BMe(e,t,sDe,oDe));function $W(){const e=I.useRef(!1);return ZA(()=>(e.current=!0,()=>{e.current=!1}),[]),e}function lDe(){const e=$W(),[t,n]=I.useState(0),r=I.useCallback(()=>{e.current&&n(t+1)},[t]);return[I.useCallback(()=>$n.postRender(r),[r]),t]}class uDe extends I.Component{getSnapshotBeforeUpdate(t){const n=this.props.childRef.current;if(n&&t.isPresent&&!this.props.isPresent){const r=this.props.sizeRef.current;r.height=n.offsetHeight||0,r.width=n.offsetWidth||0,r.top=n.offsetTop,r.left=n.offsetLeft}return null}componentDidUpdate(){}render(){return this.props.children}}function cDe({children:e,isPresent:t}){const n=I.useId(),r=I.useRef(null),i=I.useRef({width:0,height:0,top:0,left:0});return I.useInsertionEffect(()=>{const{width:o,height:a,top:s,left:l}=i.current;if(t||!r.current||!o||!a)return;r.current.dataset.motionPopId=n;const u=document.createElement("style");return document.head.appendChild(u),u.sheet&&u.sheet.insertRule(` [data-motion-pop-id="${n}"] { position: absolute !important; width: ${o}px !important; @@ -134,7 +134,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho top: ${s}px !important; left: ${l}px !important; } - `),()=>{document.head.removeChild(u)}},[t]),I.createElement(cDe,{isPresent:t,childRef:r,sizeRef:i},I.cloneElement(e,{ref:r}))}const $5=({children:e,initial:t,isPresent:n,onExitComplete:r,custom:i,presenceAffectsLayout:o,mode:a})=>{const s=Oq(fDe),l=I.useId(),u=I.useMemo(()=>({id:l,initial:t,isPresent:n,custom:i,onExitComplete:c=>{s.set(c,!0);for(const d of s.values())if(!d)return;r&&r()},register:c=>(s.set(c,!1),()=>s.delete(c))}),o?void 0:[n]);return I.useMemo(()=>{s.forEach((c,d)=>s.set(d,!1))},[n]),I.useEffect(()=>{!n&&!s.size&&r&&r()},[n]),a==="popLayout"&&(e=I.createElement(dDe,{isPresent:n},e)),I.createElement(My.Provider,{value:u},e)};function fDe(){return new Map}function hDe(e){return I.useEffect(()=>()=>e(),[])}const kf=e=>e.key||"";function pDe(e,t){e.forEach(n=>{const r=kf(n);t.set(r,n)})}function gDe(e){const t=[];return I.Children.forEach(e,n=>{I.isValidElement(n)&&t.push(n)}),t}const FW=({children:e,custom:t,initial:n=!0,onExitComplete:r,exitBeforeEnter:i,presenceAffectsLayout:o=!0,mode:a="sync"})=>{const s=I.useContext(nP).forceRender||uDe()[0],l=LW(),u=gDe(e);let c=u;const d=I.useRef(new Map).current,f=I.useRef(c),h=I.useRef(new Map).current,p=I.useRef(!0);if(JA(()=>{p.current=!1,pDe(u,h),f.current=c}),hDe(()=>{p.current=!0,h.clear(),d.clear()}),p.current)return I.createElement(I.Fragment,null,c.map(v=>I.createElement($5,{key:kf(v),isPresent:!0,initial:n?void 0:!1,presenceAffectsLayout:o,mode:a},v)));c=[...c];const m=f.current.map(kf),_=u.map(kf),b=m.length;for(let v=0;v{if(_.indexOf(g)!==-1)return;const y=h.get(g);if(!y)return;const S=m.indexOf(g);let w=v;if(!w){const x=()=>{h.delete(g),d.delete(g);const C=f.current.findIndex(T=>T.key===g);if(f.current.splice(C,1),!d.size){if(f.current=u,l.current===!1)return;s(),r&&r()}};w=I.createElement($5,{key:kf(y),isPresent:!1,onExitComplete:x,custom:t,presenceAffectsLayout:o,mode:a},y),d.set(g,w)}c.splice(S,0,w)}),c=c.map(v=>{const g=v.key;return d.has(g)?v:I.createElement($5,{key:kf(v),isPresent:!0,presenceAffectsLayout:o,mode:a},v)}),I.createElement(I.Fragment,null,d.size?c:c.map(v=>I.cloneElement(v)))};var mDe={initial:e=>{const{position:t}=e,n=["top","bottom"].includes(t)?"y":"x";let r=["top-right","bottom-right"].includes(t)?1:-1;return t==="bottom"&&(r=1),{opacity:0,[n]:r*24}},animate:{opacity:1,y:0,x:0,scale:1,transition:{duration:.4,ease:[.4,0,.2,1]}},exit:{opacity:0,scale:.85,transition:{duration:.2,ease:[.4,0,1,1]}}},BW=I.memo(e=>{const{id:t,message:n,onCloseComplete:r,onRequestRemove:i,requestClose:o=!1,position:a="bottom",duration:s=5e3,containerStyle:l,motionVariants:u=mDe,toastSpacing:c="0.5rem"}=e,[d,f]=I.useState(s),h=n$e();XM(()=>{h||r==null||r()},[h]),XM(()=>{f(s)},[s]);const p=()=>f(null),m=()=>f(s),_=()=>{h&&i()};I.useEffect(()=>{h&&o&&i()},[h,o,i]),JOe(_,d);const b=I.useMemo(()=>({pointerEvents:"auto",maxWidth:560,minWidth:300,margin:c,...l}),[l,c]),v=I.useMemo(()=>XOe(a),[a]);return W.jsx(DW.div,{layout:!0,className:"chakra-toast",variants:u,initial:"initial",animate:"animate",exit:"exit",onHoverStart:p,onHoverEnd:m,custom:{position:a},style:v,children:W.jsx(Oi.div,{role:"status","aria-atomic":"true",className:"chakra-toast__inner",__css:b,children:$s(n,{id:t,onClose:_})})})});BW.displayName="ToastComponent";function yDe(e,t){var n;const r=e??"bottom",o={"top-start":{ltr:"top-left",rtl:"top-right"},"top-end":{ltr:"top-right",rtl:"top-left"},"bottom-start":{ltr:"bottom-left",rtl:"bottom-right"},"bottom-end":{ltr:"bottom-right",rtl:"bottom-left"}}[r];return(n=o==null?void 0:o[t])!=null?n:r}var eN={path:W.jsxs("g",{stroke:"currentColor",strokeWidth:"1.5",children:[W.jsx("path",{strokeLinecap:"round",fill:"none",d:"M9,9a3,3,0,1,1,4,2.829,1.5,1.5,0,0,0-1,1.415V14.25"}),W.jsx("path",{fill:"currentColor",strokeLinecap:"round",d:"M12,17.25a.375.375,0,1,0,.375.375A.375.375,0,0,0,12,17.25h0"}),W.jsx("circle",{fill:"none",strokeMiterlimit:"10",cx:"12",cy:"12",r:"11.25"})]}),viewBox:"0 0 24 24"},Fy=ra((e,t)=>{const{as:n,viewBox:r,color:i="currentColor",focusable:o=!1,children:a,className:s,__css:l,...u}=e,c=Ac("chakra-icon",s),d=Oy("Icon",e),f={w:"1em",h:"1em",display:"inline-block",lineHeight:"1em",flexShrink:0,color:i,...l,...d},h={ref:t,focusable:o,className:c,__css:f},p=r??eN.viewBox;if(n&&typeof n!="string")return W.jsx(Oi.svg,{as:n,...h,...u});const m=a??eN.path;return W.jsx(Oi.svg,{verticalAlign:"middle",viewBox:p,...h,...u,children:m})});Fy.displayName="Icon";function vDe(e){return W.jsx(Fy,{viewBox:"0 0 24 24",...e,children:W.jsx("path",{fill:"currentColor",d:"M12,0A12,12,0,1,0,24,12,12.014,12.014,0,0,0,12,0Zm6.927,8.2-6.845,9.289a1.011,1.011,0,0,1-1.43.188L5.764,13.769a1,1,0,1,1,1.25-1.562l4.076,3.261,6.227-8.451A1,1,0,1,1,18.927,8.2Z"})})}function bDe(e){return W.jsx(Fy,{viewBox:"0 0 24 24",...e,children:W.jsx("path",{fill:"currentColor",d:"M12,0A12,12,0,1,0,24,12,12.013,12.013,0,0,0,12,0Zm.25,5a1.5,1.5,0,1,1-1.5,1.5A1.5,1.5,0,0,1,12.25,5ZM14.5,18.5h-4a1,1,0,0,1,0-2h.75a.25.25,0,0,0,.25-.25v-4.5a.25.25,0,0,0-.25-.25H10.5a1,1,0,0,1,0-2h1a2,2,0,0,1,2,2v4.75a.25.25,0,0,0,.25.25h.75a1,1,0,1,1,0,2Z"})})}function tN(e){return W.jsx(Fy,{viewBox:"0 0 24 24",...e,children:W.jsx("path",{fill:"currentColor",d:"M11.983,0a12.206,12.206,0,0,0-8.51,3.653A11.8,11.8,0,0,0,0,12.207,11.779,11.779,0,0,0,11.8,24h.214A12.111,12.111,0,0,0,24,11.791h0A11.766,11.766,0,0,0,11.983,0ZM10.5,16.542a1.476,1.476,0,0,1,1.449-1.53h.027a1.527,1.527,0,0,1,1.523,1.47,1.475,1.475,0,0,1-1.449,1.53h-.027A1.529,1.529,0,0,1,10.5,16.542ZM11,12.5v-6a1,1,0,0,1,2,0v6a1,1,0,1,1-2,0Z"})})}var _De=MTe({"0%":{transform:"rotate(0deg)"},"100%":{transform:"rotate(360deg)"}}),_P=ra((e,t)=>{const n=Oy("Spinner",e),{label:r="Loading...",thickness:i="2px",speed:o="0.45s",emptyColor:a="transparent",className:s,...l}=Iy(e),u=Ac("chakra-spinner",s),c={display:"inline-block",borderColor:"currentColor",borderStyle:"solid",borderRadius:"99999px",borderWidth:i,borderBottomColor:a,borderLeftColor:a,animation:`${_De} ${o} linear infinite`,...n};return W.jsx(Oi.div,{ref:t,__css:c,className:u,...l,children:r&&W.jsx(Oi.span,{srOnly:!0,children:r})})});_P.displayName="Spinner";var[SDe,SP]=Py({name:"AlertContext",hookName:"useAlertContext",providerName:""}),[xDe,xP]=Py({name:"AlertStylesContext",hookName:"useAlertStyles",providerName:""}),zW={info:{icon:bDe,colorScheme:"blue"},warning:{icon:tN,colorScheme:"orange"},success:{icon:vDe,colorScheme:"green"},error:{icon:tN,colorScheme:"red"},loading:{icon:_P,colorScheme:"blue"}};function wDe(e){return zW[e].colorScheme}function CDe(e){return zW[e].icon}var jW=ra(function(t,n){const r=xP(),{status:i}=SP(),o={display:"inline",...r.description};return W.jsx(Oi.div,{ref:n,"data-status":i,...t,className:Ac("chakra-alert__desc",t.className),__css:o})});jW.displayName="AlertDescription";function UW(e){const{status:t}=SP(),n=CDe(t),r=xP(),i=t==="loading"?r.spinner:r.icon;return W.jsx(Oi.span,{display:"inherit","data-status":t,...e,className:Ac("chakra-alert__icon",e.className),__css:i,children:e.children||W.jsx(n,{h:"100%",w:"100%"})})}UW.displayName="AlertIcon";var VW=ra(function(t,n){const r=xP(),{status:i}=SP();return W.jsx(Oi.div,{ref:n,"data-status":i,...t,className:Ac("chakra-alert__title",t.className),__css:r.title})});VW.displayName="AlertTitle";var GW=ra(function(t,n){var r;const{status:i="info",addRole:o=!0,...a}=Iy(t),s=(r=t.colorScheme)!=null?r:wDe(i),l=IOe("Alert",{...t,colorScheme:s}),u={width:"100%",display:"flex",alignItems:"center",position:"relative",overflow:"hidden",...l.container};return W.jsx(SDe,{value:{status:i},children:W.jsx(xDe,{value:l,children:W.jsx(Oi.div,{"data-status":i,role:o?"alert":void 0,ref:n,...a,className:Ac("chakra-alert",t.className),__css:u})})})});GW.displayName="Alert";function EDe(e){return W.jsx(Fy,{focusable:"false","aria-hidden":!0,...e,children:W.jsx("path",{fill:"currentColor",d:"M.439,21.44a1.5,1.5,0,0,0,2.122,2.121L11.823,14.3a.25.25,0,0,1,.354,0l9.262,9.263a1.5,1.5,0,1,0,2.122-2.121L14.3,12.177a.25.25,0,0,1,0-.354l9.263-9.262A1.5,1.5,0,0,0,21.439.44L12.177,9.7a.25.25,0,0,1-.354,0L2.561.44A1.5,1.5,0,0,0,.439,2.561L9.7,11.823a.25.25,0,0,1,0,.354Z"})})}var HW=ra(function(t,n){const r=Oy("CloseButton",t),{children:i,isDisabled:o,__css:a,...s}=Iy(t),l={outline:0,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0};return W.jsx(Oi.button,{type:"button","aria-label":"Close",ref:n,disabled:o,__css:{...l,...r,...a},...s,children:i||W.jsx(EDe,{width:"1em",height:"1em"})})});HW.displayName="CloseButton";var kDe={top:[],"top-left":[],"top-right":[],"bottom-left":[],bottom:[],"bottom-right":[]},Os=TDe(kDe);function TDe(e){let t=e;const n=new Set,r=i=>{t=i(t),n.forEach(o=>o())};return{getState:()=>t,subscribe:i=>(n.add(i),()=>{r(()=>e),n.delete(i)}),removeToast:(i,o)=>{r(a=>({...a,[o]:a[o].filter(s=>s.id!=i)}))},notify:(i,o)=>{const a=ADe(i,o),{position:s,id:l}=a;return r(u=>{var c,d;const h=s.includes("top")?[a,...(c=u[s])!=null?c:[]]:[...(d=u[s])!=null?d:[],a];return{...u,[s]:h}}),l},update:(i,o)=>{i&&r(a=>{const s={...a},{position:l,index:u}=QM(s,i);return l&&u!==-1&&(s[l][u]={...s[l][u],...o,message:qW(o)}),s})},closeAll:({positions:i}={})=>{r(o=>(i??["bottom","bottom-right","bottom-left","top","top-left","top-right"]).reduce((l,u)=>(l[u]=o[u].map(c=>({...c,requestClose:!0})),l),{...o}))},close:i=>{r(o=>{const a=gq(o,i);return a?{...o,[a]:o[a].map(s=>s.id==i?{...s,requestClose:!0}:s)}:o})},isActive:i=>!!QM(Os.getState(),i).position}}var nN=0;function ADe(e,t={}){var n,r;nN+=1;const i=(n=t.id)!=null?n:nN,o=(r=t.position)!=null?r:"bottom";return{id:i,message:e,position:o,duration:t.duration,onCloseComplete:t.onCloseComplete,onRequestRemove:()=>Os.removeToast(String(i),o),status:t.status,requestClose:!1,containerStyle:t.containerStyle}}var PDe=e=>{const{status:t,variant:n="solid",id:r,title:i,isClosable:o,onClose:a,description:s,colorScheme:l,icon:u}=e,c=r?{root:`toast-${r}`,title:`toast-${r}-title`,description:`toast-${r}-description`}:void 0;return W.jsxs(GW,{addRole:!1,status:t,variant:n,id:c==null?void 0:c.root,alignItems:"start",borderRadius:"md",boxShadow:"lg",paddingEnd:8,textAlign:"start",width:"auto",colorScheme:l,children:[W.jsx(UW,{children:u}),W.jsxs(Oi.div,{flex:"1",maxWidth:"100%",children:[i&&W.jsx(VW,{id:c==null?void 0:c.title,children:i}),s&&W.jsx(jW,{id:c==null?void 0:c.description,display:"block",children:s})]}),o&&W.jsx(HW,{size:"sm",onClick:a,position:"absolute",insetEnd:1,top:1})]})};function qW(e={}){const{render:t,toastComponent:n=PDe}=e;return i=>typeof t=="function"?t({...i,...e}):W.jsx(n,{...i,...e})}function IDe(e,t){const n=i=>{var o;return{...t,...i,position:yDe((o=i==null?void 0:i.position)!=null?o:t==null?void 0:t.position,e)}},r=i=>{const o=n(i),a=qW(o);return Os.notify(a,o)};return r.update=(i,o)=>{Os.update(i,n(o))},r.promise=(i,o)=>{const a=r({...o.loading,status:"loading",duration:null});i.then(s=>r.update(a,{status:"success",duration:5e3,...$s(o.success,s)})).catch(s=>r.update(a,{status:"error",duration:5e3,...$s(o.error,s)}))},r.closeAll=Os.closeAll,r.close=Os.close,r.isActive=Os.isActive,r}var[MKe,NKe]=Py({name:"ToastOptionsContext",strict:!1}),RDe=e=>{const t=I.useSyncExternalStore(Os.subscribe,Os.getState,Os.getState),{motionVariants:n,component:r=BW,portalProps:i}=e,a=Object.keys(t).map(s=>{const l=t[s];return W.jsx("div",{role:"region","aria-live":"polite","aria-label":"Notifications",id:`chakra-toast-manager-${s}`,style:YOe(s),children:W.jsx(FW,{initial:!1,children:l.map(u=>W.jsx(r,{motionVariants:n,...u},u.id))})},s)});return W.jsx(ew,{...i,children:a})},ODe={duration:5e3,variant:"solid"},Sf={theme:bOe,colorMode:"light",toggleColorMode:()=>{},setColorMode:()=>{},defaultOptions:ODe,forced:!1};function MDe({theme:e=Sf.theme,colorMode:t=Sf.colorMode,toggleColorMode:n=Sf.toggleColorMode,setColorMode:r=Sf.setColorMode,defaultOptions:i=Sf.defaultOptions,motionVariants:o,toastSpacing:a,component:s,forced:l}=Sf){const u={colorMode:t,setColorMode:r,toggleColorMode:n,forced:l};return{ToastContainer:()=>W.jsx(WOe,{theme:e,children:W.jsx(GA.Provider,{value:u,children:W.jsx(RDe,{defaultOptions:i,motionVariants:o,toastSpacing:a,component:s})})}),toast:IDe(e.direction,i)}}var I4=ra(function(t,n){const{htmlWidth:r,htmlHeight:i,alt:o,...a}=t;return W.jsx("img",{width:r,height:i,ref:n,alt:o,...a})});I4.displayName="NativeImage";function NDe(e){const{loading:t,src:n,srcSet:r,onLoad:i,onError:o,crossOrigin:a,sizes:s,ignoreFallback:l}=e,[u,c]=I.useState("pending");I.useEffect(()=>{c(n?"loading":"pending")},[n]);const d=I.useRef(),f=I.useCallback(()=>{if(!n)return;h();const p=new Image;p.src=n,a&&(p.crossOrigin=a),r&&(p.srcset=r),s&&(p.sizes=s),t&&(p.loading=t),p.onload=m=>{h(),c("loaded"),i==null||i(m)},p.onerror=m=>{h(),c("failed"),o==null||o(m)},d.current=p},[n,a,r,s,i,o,t]),h=()=>{d.current&&(d.current.onload=null,d.current.onerror=null,d.current=null)};return U_(()=>{if(!l)return u==="loading"&&f(),()=>{h()}},[u,f,l]),l?"loaded":u}var $De=(e,t)=>e!=="loaded"&&t==="beforeLoadOrError"||e==="failed"&&t==="onError";function DDe(e,t=[]){const n=Object.assign({},e);for(const r of t)r in n&&delete n[r];return n}var wP=ra(function(t,n){const{fallbackSrc:r,fallback:i,src:o,srcSet:a,align:s,fit:l,loading:u,ignoreFallback:c,crossOrigin:d,fallbackStrategy:f="beforeLoadOrError",referrerPolicy:h,...p}=t,m=r!==void 0||i!==void 0,_=u!=null||c||!m,b=NDe({...t,crossOrigin:d,ignoreFallback:_}),v=$De(b,f),g={ref:n,objectFit:l,objectPosition:s,..._?p:DDe(p,["onError","onLoad"])};return v?i||W.jsx(Oi.img,{as:I4,className:"chakra-image__placeholder",src:r,...g}):W.jsx(Oi.img,{as:I4,src:o,srcSet:a,crossOrigin:d,loading:u,referrerPolicy:h,className:"chakra-image",...g})});wP.displayName="Image";var WW=ra(function(t,n){const r=Oy("Text",t),{className:i,align:o,decoration:a,casing:s,...l}=Iy(t),u=$Oe({textAlign:t.align,textDecoration:t.decoration,textTransform:t.casing});return W.jsx(Oi.p,{ref:n,className:Ac("chakra-text",t.className),...u,...l,__css:r})});WW.displayName="Text";var R4=ra(function(t,n){const r=Oy("Heading",t),{className:i,...o}=Iy(t);return W.jsx(Oi.h2,{ref:n,className:Ac("chakra-heading",t.className),...o,__css:r})});R4.displayName="Heading";var rS=Oi("div");rS.displayName="Box";var KW=ra(function(t,n){const{size:r,centerContent:i=!0,...o}=t,a=i?{display:"flex",alignItems:"center",justifyContent:"center"}:{};return W.jsx(rS,{ref:n,boxSize:r,__css:{...a,flexShrink:0,flexGrow:0},...o})});KW.displayName="Square";var LDe=ra(function(t,n){const{size:r,...i}=t;return W.jsx(KW,{size:r,ref:n,borderRadius:"9999px",...i})});LDe.displayName="Circle";var CP=ra(function(t,n){const{direction:r,align:i,justify:o,wrap:a,basis:s,grow:l,shrink:u,...c}=t,d={display:"flex",flexDirection:r,alignItems:i,justifyContent:o,flexWrap:a,flexBasis:s,flexGrow:l,flexShrink:u};return W.jsx(Oi.div,{ref:n,__css:d,...c})});CP.displayName="Flex";const FDe=z.object({status:z.literal(422),data:z.object({detail:z.array(z.object({loc:z.array(z.string()),msg:z.string(),type:z.string()}))})});function mo(e,t,n=!1){e=String(e),t=String(t);const r=Array.from({length:21},(a,s)=>s*50),i=[0,5,10,15,20,25,30,35,40,45,50,55,59,64,68,73,77,82,86,95,100];return r.reduce((a,s,l)=>{const u=n?i[l]/100:1,c=n?50:i[r.length-1-l];return a[s]=`hsl(${e} ${t}% ${c}% / ${u})`,a},{})}const o1={H:220,S:16},a1={H:250,S:42},s1={H:47,S:42},l1={H:40,S:70},u1={H:28,S:42},c1={H:113,S:42},d1={H:0,S:42},BDe={base:mo(o1.H,o1.S),baseAlpha:mo(o1.H,o1.S,!0),accent:mo(a1.H,a1.S),accentAlpha:mo(a1.H,a1.S,!0),working:mo(s1.H,s1.S),workingAlpha:mo(s1.H,s1.S,!0),gold:mo(l1.H,l1.S),goldAlpha:mo(l1.H,l1.S,!0),warning:mo(u1.H,u1.S),warningAlpha:mo(u1.H,u1.S,!0),ok:mo(c1.H,c1.S),okAlpha:mo(c1.H,c1.S,!0),error:mo(d1.H,d1.S),errorAlpha:mo(d1.H,d1.S,!0)},{definePartsStyle:zDe,defineMultiStyleConfig:jDe}=Pt(jH.keys),UDe={border:"none"},VDe=e=>{const{colorScheme:t}=e;return{fontWeight:"600",fontSize:"sm",border:"none",borderRadius:"base",bg:K(`${t}.200`,`${t}.700`)(e),color:K(`${t}.900`,`${t}.100`)(e),_hover:{bg:K(`${t}.250`,`${t}.650`)(e)},_expanded:{bg:K(`${t}.250`,`${t}.650`)(e),borderBottomRadius:"none",_hover:{bg:K(`${t}.300`,`${t}.600`)(e)}}}},GDe=e=>{const{colorScheme:t}=e;return{bg:K(`${t}.100`,`${t}.800`)(e),borderRadius:"base",borderTopRadius:"none"}},HDe={},qDe=zDe(e=>({container:UDe,button:VDe(e),panel:GDe(e),icon:HDe})),WDe=jDe({variants:{invokeAI:qDe},defaultProps:{variant:"invokeAI",colorScheme:"base"}}),KDe=e=>{const{colorScheme:t}=e;if(t==="base"){const r={bg:K("base.150","base.700")(e),color:K("base.300","base.500")(e),svg:{fill:K("base.300","base.500")(e)},opacity:1},i={bg:"none",color:K("base.300","base.500")(e),svg:{fill:K("base.500","base.500")(e)},opacity:1};return{bg:K("base.250","base.600")(e),color:K("base.850","base.100")(e),borderRadius:"base",svg:{fill:K("base.850","base.100")(e)},_hover:{bg:K("base.300","base.500")(e),color:K("base.900","base.50")(e),svg:{fill:K("base.900","base.50")(e)},_disabled:r},_disabled:r,'&[data-progress="true"]':{...i,_hover:i}}}const n={bg:K(`${t}.400`,`${t}.700`)(e),color:K(`${t}.600`,`${t}.500`)(e),svg:{fill:K(`${t}.600`,`${t}.500`)(e),filter:"unset"},opacity:.7,filter:"saturate(65%)"};return{bg:K(`${t}.400`,`${t}.600`)(e),color:K("base.50","base.100")(e),borderRadius:"base",svg:{fill:K("base.50","base.100")(e)},_disabled:n,_hover:{bg:K(`${t}.500`,`${t}.500`)(e),color:K("white","base.50")(e),svg:{fill:K("white","base.50")(e)},_disabled:n}}},QDe=e=>{const{colorScheme:t}=e,n=K("gray.200","whiteAlpha.300")(e);return{border:"1px solid",borderColor:t==="gray"?n:"currentColor",_hover:{bg:K(`${t}.500`,`${t}.500`)(e),color:K("white","base.50")(e),svg:{fill:K("white","base.50")(e)}},".chakra-button__group[data-attached][data-orientation=horizontal] > &:not(:last-of-type)":{marginEnd:"-1px"},".chakra-button__group[data-attached][data-orientation=vertical] > &:not(:last-of-type)":{marginBottom:"-1px"}}},XDe={variants:{invokeAI:KDe,invokeAIOutline:QDe},defaultProps:{variant:"invokeAI",colorScheme:"base"}},{definePartsStyle:YDe,defineMultiStyleConfig:ZDe}=Pt(UH.keys),JDe=e=>{const{colorScheme:t}=e;return{bg:K("base.200","base.700")(e),borderColor:K("base.300","base.600")(e),color:K("base.900","base.100")(e),_checked:{bg:K(`${t}.300`,`${t}.500`)(e),borderColor:K(`${t}.300`,`${t}.500`)(e),color:K(`${t}.900`,`${t}.100`)(e),_hover:{bg:K(`${t}.400`,`${t}.500`)(e),borderColor:K(`${t}.400`,`${t}.500`)(e)},_disabled:{borderColor:"transparent",bg:"whiteAlpha.300",color:"whiteAlpha.500"}},_indeterminate:{bg:K(`${t}.300`,`${t}.600`)(e),borderColor:K(`${t}.300`,`${t}.600`)(e),color:K(`${t}.900`,`${t}.100`)(e)},_disabled:{bg:"whiteAlpha.100",borderColor:"transparent"},_focusVisible:{boxShadow:"none",outline:"none"},_invalid:{borderColor:K("error.600","error.300")(e)}}},eLe=YDe(e=>({control:JDe(e)})),tLe=ZDe({variants:{invokeAI:eLe},defaultProps:{variant:"invokeAI",colorScheme:"accent"}}),{definePartsStyle:nLe,defineMultiStyleConfig:rLe}=Pt(VH.keys),iLe={borderRadius:"md",py:"1",transitionProperty:"common",transitionDuration:"normal"},oLe=e=>({borderRadius:"md",py:"1",transitionProperty:"common",transitionDuration:"normal",width:"full",_focusVisible:{boxShadow:"outline"},_placeholder:{opacity:.6},"::selection":{color:K("accent.900","accent.50")(e),bg:K("accent.200","accent.400")(e)}}),aLe={borderRadius:"md",py:"1",transitionProperty:"common",transitionDuration:"normal",width:"full",_focusVisible:{boxShadow:"outline"},_placeholder:{opacity:.6}},sLe=nLe(e=>({preview:iLe,input:oLe(e),textarea:aLe})),lLe=rLe({variants:{invokeAI:sLe},defaultProps:{size:"sm",variant:"invokeAI"}}),uLe=e=>({fontSize:"sm",marginEnd:0,mb:1,fontWeight:"400",transitionProperty:"common",transitionDuration:"normal",whiteSpace:"nowrap",_disabled:{opacity:.4},color:K("base.700","base.300")(e),_invalid:{color:K("error.500","error.300")(e)}}),cLe={variants:{invokeAI:uLe},defaultProps:{variant:"invokeAI"}},hw=e=>({outline:"none",borderWidth:2,borderStyle:"solid",borderColor:K("base.200","base.800")(e),bg:K("base.50","base.900")(e),borderRadius:"base",color:K("base.900","base.100")(e),boxShadow:"none",_hover:{borderColor:K("base.300","base.600")(e)},_focus:{borderColor:K("accent.200","accent.600")(e),boxShadow:"none",_hover:{borderColor:K("accent.300","accent.500")(e)}},_invalid:{borderColor:K("error.300","error.600")(e),boxShadow:"none",_hover:{borderColor:K("error.400","error.500")(e)}},_disabled:{borderColor:K("base.300","base.700")(e),bg:K("base.300","base.700")(e),color:K("base.600","base.400")(e),_hover:{borderColor:K("base.300","base.700")(e)}},_placeholder:{color:K("base.700","base.400")(e)},"::selection":{bg:K("accent.200","accent.400")(e)}}),{definePartsStyle:dLe,defineMultiStyleConfig:fLe}=Pt(GH.keys),hLe=dLe(e=>({field:hw(e)})),pLe=fLe({variants:{invokeAI:hLe},defaultProps:{size:"sm",variant:"invokeAI"}}),{definePartsStyle:gLe,defineMultiStyleConfig:mLe}=Pt(HH.keys),yLe=gLe(e=>({button:{fontWeight:500,bg:K("base.300","base.500")(e),color:K("base.900","base.100")(e),_hover:{bg:K("base.400","base.600")(e),color:K("base.900","base.50")(e),fontWeight:600}},list:{zIndex:9999,color:K("base.900","base.150")(e),bg:K("base.200","base.800")(e),shadow:"dark-lg",border:"none"},item:{fontSize:"sm",bg:K("base.200","base.800")(e),_hover:{bg:K("base.300","base.700")(e),svg:{opacity:1}},_focus:{bg:K("base.400","base.600")(e)},svg:{opacity:.7,fontSize:14}}})),vLe=mLe({variants:{invokeAI:yLe},defaultProps:{variant:"invokeAI"}}),$Ke={variants:{enter:{visibility:"visible",opacity:1,scale:1,transition:{duration:.07,ease:[.4,0,.2,1]}},exit:{transitionEnd:{visibility:"hidden"},opacity:0,scale:.8,transition:{duration:.07,easings:"easeOut"}}}},{defineMultiStyleConfig:bLe,definePartsStyle:_Le}=Pt(qH.keys),SLe=e=>({bg:K("blackAlpha.700","blackAlpha.700")(e)}),xLe={},wLe=()=>({layerStyle:"first",maxH:"80vh"}),CLe=()=>({fontWeight:"600",fontSize:"lg",layerStyle:"first",borderTopRadius:"base",borderInlineEndRadius:"base"}),ELe={},kLe={overflowY:"scroll"},TLe={},ALe=_Le(e=>({overlay:SLe(e),dialogContainer:xLe,dialog:wLe(),header:CLe(),closeButton:ELe,body:kLe,footer:TLe})),PLe=bLe({variants:{invokeAI:ALe},defaultProps:{variant:"invokeAI",size:"lg"}}),{defineMultiStyleConfig:ILe,definePartsStyle:RLe}=Pt(WH.keys),OLe=e=>({height:8}),MLe=e=>({border:"none",fontWeight:"600",height:"auto",py:1,ps:2,pe:6,...hw(e)}),NLe=e=>({display:"flex"}),$Le=e=>({border:"none",px:2,py:0,mx:-2,my:0,svg:{color:K("base.700","base.300")(e),width:2.5,height:2.5,_hover:{color:K("base.900","base.100")(e)}}}),DLe=RLe(e=>({root:OLe(e),field:MLe(e),stepperGroup:NLe(e),stepper:$Le(e)})),LLe=ILe({variants:{invokeAI:DLe},defaultProps:{size:"sm",variant:"invokeAI"}}),{defineMultiStyleConfig:FLe,definePartsStyle:QW}=Pt(KH.keys),XW=fr("popper-bg"),YW=fr("popper-arrow-bg"),ZW=fr("popper-arrow-shadow-color"),BLe=e=>({[YW.variable]:K("colors.base.100","colors.base.800")(e),[XW.variable]:K("colors.base.100","colors.base.800")(e),[ZW.variable]:K("colors.base.400","colors.base.600")(e),minW:"unset",width:"unset",p:4,bg:K("base.100","base.800")(e),border:"none",shadow:"dark-lg"}),zLe=e=>({[YW.variable]:K("colors.base.100","colors.base.700")(e),[XW.variable]:K("colors.base.100","colors.base.700")(e),[ZW.variable]:K("colors.base.400","colors.base.400")(e),p:4,bg:K("base.100","base.700")(e),border:"none",shadow:"dark-lg"}),jLe=QW(e=>({content:BLe(e),body:{padding:0}})),ULe=QW(e=>({content:zLe(e),body:{padding:0}})),VLe=FLe({variants:{invokeAI:jLe,informational:ULe},defaultProps:{variant:"invokeAI"}}),{defineMultiStyleConfig:GLe,definePartsStyle:HLe}=Pt(QH.keys),qLe=e=>({bg:"accentAlpha.700"}),WLe=e=>{const{colorScheme:t}=e;return{bg:K(`${t}.200`,`${t}.700`)(e)}},KLe=HLe(e=>({filledTrack:qLe(e),track:WLe(e)})),QLe=GLe({variants:{invokeAI:KLe},defaultProps:{variant:"invokeAI"}}),XLe={"::-webkit-scrollbar":{display:"none"},scrollbarWidth:"none"},{definePartsStyle:YLe,defineMultiStyleConfig:ZLe}=Pt(XH.keys),JLe=e=>({color:K("base.200","base.300")(e)}),eFe=e=>({fontWeight:"600",...hw(e)}),tFe=YLe(e=>({field:eFe(e),icon:JLe(e)})),nFe=ZLe({variants:{invokeAI:tFe},defaultProps:{size:"sm",variant:"invokeAI"}}),rN=nt("skeleton-start-color"),iN=nt("skeleton-end-color"),rFe={borderRadius:"base",maxW:"full",maxH:"full",_light:{[rN.variable]:"colors.base.250",[iN.variable]:"colors.base.450"},_dark:{[rN.variable]:"colors.base.700",[iN.variable]:"colors.base.500"}},iFe={variants:{invokeAI:rFe},defaultProps:{variant:"invokeAI"}},{definePartsStyle:oFe,defineMultiStyleConfig:aFe}=Pt(YH.keys),sFe=e=>({bg:K("base.400","base.600")(e),h:1.5}),lFe=e=>{const{colorScheme:t}=e;return{bg:K(`${t}.400`,`${t}.600`)(e),h:1.5}},uFe=e=>({w:e.orientation==="horizontal"?2:4,h:e.orientation==="horizontal"?4:2,bg:K("base.50","base.100")(e)}),cFe=e=>({fontSize:"2xs",fontWeight:"500",color:K("base.700","base.400")(e),mt:2,insetInlineStart:"unset"}),dFe=oFe(e=>({container:{_disabled:{opacity:.6,cursor:"default",pointerEvents:"none"}},track:sFe(e),filledTrack:lFe(e),thumb:uFe(e),mark:cFe(e)})),fFe=aFe({variants:{invokeAI:dFe},defaultProps:{variant:"invokeAI",colorScheme:"accent"}}),{defineMultiStyleConfig:hFe,definePartsStyle:pFe}=Pt(ZH.keys),gFe=e=>{const{colorScheme:t}=e;return{bg:K("base.300","base.600")(e),_focusVisible:{boxShadow:"none"},_checked:{bg:K(`${t}.400`,`${t}.500`)(e)}}},mFe=e=>{const{colorScheme:t}=e;return{bg:K(`${t}.50`,`${t}.50`)(e)}},yFe=pFe(e=>({container:{},track:gFe(e),thumb:mFe(e)})),vFe=hFe({variants:{invokeAI:yFe},defaultProps:{size:"md",variant:"invokeAI",colorScheme:"accent"}}),{defineMultiStyleConfig:bFe,definePartsStyle:JW}=Pt(JH.keys),_Fe=e=>({display:"flex",columnGap:4}),SFe=e=>({}),xFe=e=>{const{colorScheme:t}=e;return{display:"flex",flexDirection:"column",gap:1,color:K("base.700","base.400")(e),button:{fontSize:"sm",padding:2,borderRadius:"base",textShadow:K("0 0 0.3rem var(--invokeai-colors-accent-100)","0 0 0.3rem var(--invokeai-colors-accent-900)")(e),svg:{fill:K("base.700","base.300")(e)},_selected:{bg:K("accent.400","accent.600")(e),color:K("base.50","base.100")(e),svg:{fill:K("base.50","base.100")(e),filter:K(`drop-shadow(0px 0px 0.3rem var(--invokeai-colors-${t}-600))`,`drop-shadow(0px 0px 0.3rem var(--invokeai-colors-${t}-800))`)(e)},_hover:{bg:K("accent.500","accent.500")(e),color:K("white","base.50")(e),svg:{fill:K("white","base.50")(e)}}},_hover:{bg:K("base.100","base.800")(e),color:K("base.900","base.50")(e),svg:{fill:K("base.800","base.100")(e)}}}}},wFe=e=>({padding:0,height:"100%"}),CFe=JW(e=>({root:_Fe(e),tab:SFe(e),tablist:xFe(e),tabpanel:wFe(e)})),EFe=JW(e=>({tab:{borderTopRadius:"base",px:4,py:1,fontSize:"sm",color:K("base.600","base.400")(e),fontWeight:500,_selected:{color:K("accent.600","accent.400")(e)}},tabpanel:{p:0,pt:4,w:"full",h:"full"},tabpanels:{w:"full",h:"full"}})),kFe=bFe({variants:{line:EFe,appTabs:CFe},defaultProps:{variant:"appTabs",colorScheme:"accent"}}),TFe=e=>({color:K("base.500","base.400")(e)}),AFe={variants:{subtext:TFe}},PFe=e=>({...hw(e),"::-webkit-scrollbar":{display:"initial"},"::-webkit-resizer":{backgroundImage:`linear-gradient(135deg, + `),()=>{document.head.removeChild(u)}},[t]),I.createElement(uDe,{isPresent:t,childRef:r,sizeRef:i},I.cloneElement(e,{ref:r}))}const $5=({children:e,initial:t,isPresent:n,onExitComplete:r,custom:i,presenceAffectsLayout:o,mode:a})=>{const s=Iq(dDe),l=I.useId(),u=I.useMemo(()=>({id:l,initial:t,isPresent:n,custom:i,onExitComplete:c=>{s.set(c,!0);for(const d of s.values())if(!d)return;r&&r()},register:c=>(s.set(c,!1),()=>s.delete(c))}),o?void 0:[n]);return I.useMemo(()=>{s.forEach((c,d)=>s.set(d,!1))},[n]),I.useEffect(()=>{!n&&!s.size&&r&&r()},[n]),a==="popLayout"&&(e=I.createElement(cDe,{isPresent:n},e)),I.createElement(My.Provider,{value:u},e)};function dDe(){return new Map}function fDe(e){return I.useEffect(()=>()=>e(),[])}const kf=e=>e.key||"";function hDe(e,t){e.forEach(n=>{const r=kf(n);t.set(r,n)})}function pDe(e){const t=[];return I.Children.forEach(e,n=>{I.isValidElement(n)&&t.push(n)}),t}const DW=({children:e,custom:t,initial:n=!0,onExitComplete:r,exitBeforeEnter:i,presenceAffectsLayout:o=!0,mode:a="sync"})=>{const s=I.useContext(tP).forceRender||lDe()[0],l=$W(),u=pDe(e);let c=u;const d=I.useRef(new Map).current,f=I.useRef(c),h=I.useRef(new Map).current,p=I.useRef(!0);if(ZA(()=>{p.current=!1,hDe(u,h),f.current=c}),fDe(()=>{p.current=!0,h.clear(),d.clear()}),p.current)return I.createElement(I.Fragment,null,c.map(v=>I.createElement($5,{key:kf(v),isPresent:!0,initial:n?void 0:!1,presenceAffectsLayout:o,mode:a},v)));c=[...c];const m=f.current.map(kf),_=u.map(kf),b=m.length;for(let v=0;v{if(_.indexOf(g)!==-1)return;const y=h.get(g);if(!y)return;const S=m.indexOf(g);let w=v;if(!w){const x=()=>{h.delete(g),d.delete(g);const C=f.current.findIndex(T=>T.key===g);if(f.current.splice(C,1),!d.size){if(f.current=u,l.current===!1)return;s(),r&&r()}};w=I.createElement($5,{key:kf(y),isPresent:!1,onExitComplete:x,custom:t,presenceAffectsLayout:o,mode:a},y),d.set(g,w)}c.splice(S,0,w)}),c=c.map(v=>{const g=v.key;return d.has(g)?v:I.createElement($5,{key:kf(v),isPresent:!0,presenceAffectsLayout:o,mode:a},v)}),I.createElement(I.Fragment,null,d.size?c:c.map(v=>I.cloneElement(v)))};var gDe={initial:e=>{const{position:t}=e,n=["top","bottom"].includes(t)?"y":"x";let r=["top-right","bottom-right"].includes(t)?1:-1;return t==="bottom"&&(r=1),{opacity:0,[n]:r*24}},animate:{opacity:1,y:0,x:0,scale:1,transition:{duration:.4,ease:[.4,0,.2,1]}},exit:{opacity:0,scale:.85,transition:{duration:.2,ease:[.4,0,1,1]}}},LW=I.memo(e=>{const{id:t,message:n,onCloseComplete:r,onRequestRemove:i,requestClose:o=!1,position:a="bottom",duration:s=5e3,containerStyle:l,motionVariants:u=gDe,toastSpacing:c="0.5rem"}=e,[d,f]=I.useState(s),h=t$e();QM(()=>{h||r==null||r()},[h]),QM(()=>{f(s)},[s]);const p=()=>f(null),m=()=>f(s),_=()=>{h&&i()};I.useEffect(()=>{h&&o&&i()},[h,o,i]),ZOe(_,d);const b=I.useMemo(()=>({pointerEvents:"auto",maxWidth:560,minWidth:300,margin:c,...l}),[l,c]),v=I.useMemo(()=>QOe(a),[a]);return W.jsx(NW.div,{layout:!0,className:"chakra-toast",variants:u,initial:"initial",animate:"animate",exit:"exit",onHoverStart:p,onHoverEnd:m,custom:{position:a},style:v,children:W.jsx(Oi.div,{role:"status","aria-atomic":"true",className:"chakra-toast__inner",__css:b,children:$s(n,{id:t,onClose:_})})})});LW.displayName="ToastComponent";function mDe(e,t){var n;const r=e??"bottom",o={"top-start":{ltr:"top-left",rtl:"top-right"},"top-end":{ltr:"top-right",rtl:"top-left"},"bottom-start":{ltr:"bottom-left",rtl:"bottom-right"},"bottom-end":{ltr:"bottom-right",rtl:"bottom-left"}}[r];return(n=o==null?void 0:o[t])!=null?n:r}var J7={path:W.jsxs("g",{stroke:"currentColor",strokeWidth:"1.5",children:[W.jsx("path",{strokeLinecap:"round",fill:"none",d:"M9,9a3,3,0,1,1,4,2.829,1.5,1.5,0,0,0-1,1.415V14.25"}),W.jsx("path",{fill:"currentColor",strokeLinecap:"round",d:"M12,17.25a.375.375,0,1,0,.375.375A.375.375,0,0,0,12,17.25h0"}),W.jsx("circle",{fill:"none",strokeMiterlimit:"10",cx:"12",cy:"12",r:"11.25"})]}),viewBox:"0 0 24 24"},Fy=ra((e,t)=>{const{as:n,viewBox:r,color:i="currentColor",focusable:o=!1,children:a,className:s,__css:l,...u}=e,c=Ac("chakra-icon",s),d=Oy("Icon",e),f={w:"1em",h:"1em",display:"inline-block",lineHeight:"1em",flexShrink:0,color:i,...l,...d},h={ref:t,focusable:o,className:c,__css:f},p=r??J7.viewBox;if(n&&typeof n!="string")return W.jsx(Oi.svg,{as:n,...h,...u});const m=a??J7.path;return W.jsx(Oi.svg,{verticalAlign:"middle",viewBox:p,...h,...u,children:m})});Fy.displayName="Icon";function yDe(e){return W.jsx(Fy,{viewBox:"0 0 24 24",...e,children:W.jsx("path",{fill:"currentColor",d:"M12,0A12,12,0,1,0,24,12,12.014,12.014,0,0,0,12,0Zm6.927,8.2-6.845,9.289a1.011,1.011,0,0,1-1.43.188L5.764,13.769a1,1,0,1,1,1.25-1.562l4.076,3.261,6.227-8.451A1,1,0,1,1,18.927,8.2Z"})})}function vDe(e){return W.jsx(Fy,{viewBox:"0 0 24 24",...e,children:W.jsx("path",{fill:"currentColor",d:"M12,0A12,12,0,1,0,24,12,12.013,12.013,0,0,0,12,0Zm.25,5a1.5,1.5,0,1,1-1.5,1.5A1.5,1.5,0,0,1,12.25,5ZM14.5,18.5h-4a1,1,0,0,1,0-2h.75a.25.25,0,0,0,.25-.25v-4.5a.25.25,0,0,0-.25-.25H10.5a1,1,0,0,1,0-2h1a2,2,0,0,1,2,2v4.75a.25.25,0,0,0,.25.25h.75a1,1,0,1,1,0,2Z"})})}function eN(e){return W.jsx(Fy,{viewBox:"0 0 24 24",...e,children:W.jsx("path",{fill:"currentColor",d:"M11.983,0a12.206,12.206,0,0,0-8.51,3.653A11.8,11.8,0,0,0,0,12.207,11.779,11.779,0,0,0,11.8,24h.214A12.111,12.111,0,0,0,24,11.791h0A11.766,11.766,0,0,0,11.983,0ZM10.5,16.542a1.476,1.476,0,0,1,1.449-1.53h.027a1.527,1.527,0,0,1,1.523,1.47,1.475,1.475,0,0,1-1.449,1.53h-.027A1.529,1.529,0,0,1,10.5,16.542ZM11,12.5v-6a1,1,0,0,1,2,0v6a1,1,0,1,1-2,0Z"})})}var bDe=OTe({"0%":{transform:"rotate(0deg)"},"100%":{transform:"rotate(360deg)"}}),bP=ra((e,t)=>{const n=Oy("Spinner",e),{label:r="Loading...",thickness:i="2px",speed:o="0.45s",emptyColor:a="transparent",className:s,...l}=Iy(e),u=Ac("chakra-spinner",s),c={display:"inline-block",borderColor:"currentColor",borderStyle:"solid",borderRadius:"99999px",borderWidth:i,borderBottomColor:a,borderLeftColor:a,animation:`${bDe} ${o} linear infinite`,...n};return W.jsx(Oi.div,{ref:t,__css:c,className:u,...l,children:r&&W.jsx(Oi.span,{srOnly:!0,children:r})})});bP.displayName="Spinner";var[_De,_P]=Py({name:"AlertContext",hookName:"useAlertContext",providerName:""}),[SDe,SP]=Py({name:"AlertStylesContext",hookName:"useAlertStyles",providerName:""}),FW={info:{icon:vDe,colorScheme:"blue"},warning:{icon:eN,colorScheme:"orange"},success:{icon:yDe,colorScheme:"green"},error:{icon:eN,colorScheme:"red"},loading:{icon:bP,colorScheme:"blue"}};function xDe(e){return FW[e].colorScheme}function wDe(e){return FW[e].icon}var BW=ra(function(t,n){const r=SP(),{status:i}=_P(),o={display:"inline",...r.description};return W.jsx(Oi.div,{ref:n,"data-status":i,...t,className:Ac("chakra-alert__desc",t.className),__css:o})});BW.displayName="AlertDescription";function zW(e){const{status:t}=_P(),n=wDe(t),r=SP(),i=t==="loading"?r.spinner:r.icon;return W.jsx(Oi.span,{display:"inherit","data-status":t,...e,className:Ac("chakra-alert__icon",e.className),__css:i,children:e.children||W.jsx(n,{h:"100%",w:"100%"})})}zW.displayName="AlertIcon";var jW=ra(function(t,n){const r=SP(),{status:i}=_P();return W.jsx(Oi.div,{ref:n,"data-status":i,...t,className:Ac("chakra-alert__title",t.className),__css:r.title})});jW.displayName="AlertTitle";var UW=ra(function(t,n){var r;const{status:i="info",addRole:o=!0,...a}=Iy(t),s=(r=t.colorScheme)!=null?r:xDe(i),l=POe("Alert",{...t,colorScheme:s}),u={width:"100%",display:"flex",alignItems:"center",position:"relative",overflow:"hidden",...l.container};return W.jsx(_De,{value:{status:i},children:W.jsx(SDe,{value:l,children:W.jsx(Oi.div,{"data-status":i,role:o?"alert":void 0,ref:n,...a,className:Ac("chakra-alert",t.className),__css:u})})})});UW.displayName="Alert";function CDe(e){return W.jsx(Fy,{focusable:"false","aria-hidden":!0,...e,children:W.jsx("path",{fill:"currentColor",d:"M.439,21.44a1.5,1.5,0,0,0,2.122,2.121L11.823,14.3a.25.25,0,0,1,.354,0l9.262,9.263a1.5,1.5,0,1,0,2.122-2.121L14.3,12.177a.25.25,0,0,1,0-.354l9.263-9.262A1.5,1.5,0,0,0,21.439.44L12.177,9.7a.25.25,0,0,1-.354,0L2.561.44A1.5,1.5,0,0,0,.439,2.561L9.7,11.823a.25.25,0,0,1,0,.354Z"})})}var VW=ra(function(t,n){const r=Oy("CloseButton",t),{children:i,isDisabled:o,__css:a,...s}=Iy(t),l={outline:0,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0};return W.jsx(Oi.button,{type:"button","aria-label":"Close",ref:n,disabled:o,__css:{...l,...r,...a},...s,children:i||W.jsx(CDe,{width:"1em",height:"1em"})})});VW.displayName="CloseButton";var EDe={top:[],"top-left":[],"top-right":[],"bottom-left":[],bottom:[],"bottom-right":[]},Os=kDe(EDe);function kDe(e){let t=e;const n=new Set,r=i=>{t=i(t),n.forEach(o=>o())};return{getState:()=>t,subscribe:i=>(n.add(i),()=>{r(()=>e),n.delete(i)}),removeToast:(i,o)=>{r(a=>({...a,[o]:a[o].filter(s=>s.id!=i)}))},notify:(i,o)=>{const a=TDe(i,o),{position:s,id:l}=a;return r(u=>{var c,d;const h=s.includes("top")?[a,...(c=u[s])!=null?c:[]]:[...(d=u[s])!=null?d:[],a];return{...u,[s]:h}}),l},update:(i,o)=>{i&&r(a=>{const s={...a},{position:l,index:u}=KM(s,i);return l&&u!==-1&&(s[l][u]={...s[l][u],...o,message:GW(o)}),s})},closeAll:({positions:i}={})=>{r(o=>(i??["bottom","bottom-right","bottom-left","top","top-left","top-right"]).reduce((l,u)=>(l[u]=o[u].map(c=>({...c,requestClose:!0})),l),{...o}))},close:i=>{r(o=>{const a=hq(o,i);return a?{...o,[a]:o[a].map(s=>s.id==i?{...s,requestClose:!0}:s)}:o})},isActive:i=>!!KM(Os.getState(),i).position}}var tN=0;function TDe(e,t={}){var n,r;tN+=1;const i=(n=t.id)!=null?n:tN,o=(r=t.position)!=null?r:"bottom";return{id:i,message:e,position:o,duration:t.duration,onCloseComplete:t.onCloseComplete,onRequestRemove:()=>Os.removeToast(String(i),o),status:t.status,requestClose:!1,containerStyle:t.containerStyle}}var ADe=e=>{const{status:t,variant:n="solid",id:r,title:i,isClosable:o,onClose:a,description:s,colorScheme:l,icon:u}=e,c=r?{root:`toast-${r}`,title:`toast-${r}-title`,description:`toast-${r}-description`}:void 0;return W.jsxs(UW,{addRole:!1,status:t,variant:n,id:c==null?void 0:c.root,alignItems:"start",borderRadius:"md",boxShadow:"lg",paddingEnd:8,textAlign:"start",width:"auto",colorScheme:l,children:[W.jsx(zW,{children:u}),W.jsxs(Oi.div,{flex:"1",maxWidth:"100%",children:[i&&W.jsx(jW,{id:c==null?void 0:c.title,children:i}),s&&W.jsx(BW,{id:c==null?void 0:c.description,display:"block",children:s})]}),o&&W.jsx(VW,{size:"sm",onClick:a,position:"absolute",insetEnd:1,top:1})]})};function GW(e={}){const{render:t,toastComponent:n=ADe}=e;return i=>typeof t=="function"?t({...i,...e}):W.jsx(n,{...i,...e})}function PDe(e,t){const n=i=>{var o;return{...t,...i,position:mDe((o=i==null?void 0:i.position)!=null?o:t==null?void 0:t.position,e)}},r=i=>{const o=n(i),a=GW(o);return Os.notify(a,o)};return r.update=(i,o)=>{Os.update(i,n(o))},r.promise=(i,o)=>{const a=r({...o.loading,status:"loading",duration:null});i.then(s=>r.update(a,{status:"success",duration:5e3,...$s(o.success,s)})).catch(s=>r.update(a,{status:"error",duration:5e3,...$s(o.error,s)}))},r.closeAll=Os.closeAll,r.close=Os.close,r.isActive=Os.isActive,r}var[MKe,NKe]=Py({name:"ToastOptionsContext",strict:!1}),IDe=e=>{const t=I.useSyncExternalStore(Os.subscribe,Os.getState,Os.getState),{motionVariants:n,component:r=LW,portalProps:i}=e,a=Object.keys(t).map(s=>{const l=t[s];return W.jsx("div",{role:"region","aria-live":"polite","aria-label":"Notifications",id:`chakra-toast-manager-${s}`,style:XOe(s),children:W.jsx(DW,{initial:!1,children:l.map(u=>W.jsx(r,{motionVariants:n,...u},u.id))})},s)});return W.jsx(ew,{...i,children:a})},RDe={duration:5e3,variant:"solid"},Sf={theme:vOe,colorMode:"light",toggleColorMode:()=>{},setColorMode:()=>{},defaultOptions:RDe,forced:!1};function ODe({theme:e=Sf.theme,colorMode:t=Sf.colorMode,toggleColorMode:n=Sf.toggleColorMode,setColorMode:r=Sf.setColorMode,defaultOptions:i=Sf.defaultOptions,motionVariants:o,toastSpacing:a,component:s,forced:l}=Sf){const u={colorMode:t,setColorMode:r,toggleColorMode:n,forced:l};return{ToastContainer:()=>W.jsx(qOe,{theme:e,children:W.jsx(VA.Provider,{value:u,children:W.jsx(IDe,{defaultOptions:i,motionVariants:o,toastSpacing:a,component:s})})}),toast:PDe(e.direction,i)}}var P4=ra(function(t,n){const{htmlWidth:r,htmlHeight:i,alt:o,...a}=t;return W.jsx("img",{width:r,height:i,ref:n,alt:o,...a})});P4.displayName="NativeImage";function MDe(e){const{loading:t,src:n,srcSet:r,onLoad:i,onError:o,crossOrigin:a,sizes:s,ignoreFallback:l}=e,[u,c]=I.useState("pending");I.useEffect(()=>{c(n?"loading":"pending")},[n]);const d=I.useRef(),f=I.useCallback(()=>{if(!n)return;h();const p=new Image;p.src=n,a&&(p.crossOrigin=a),r&&(p.srcset=r),s&&(p.sizes=s),t&&(p.loading=t),p.onload=m=>{h(),c("loaded"),i==null||i(m)},p.onerror=m=>{h(),c("failed"),o==null||o(m)},d.current=p},[n,a,r,s,i,o,t]),h=()=>{d.current&&(d.current.onload=null,d.current.onerror=null,d.current=null)};return U_(()=>{if(!l)return u==="loading"&&f(),()=>{h()}},[u,f,l]),l?"loaded":u}var NDe=(e,t)=>e!=="loaded"&&t==="beforeLoadOrError"||e==="failed"&&t==="onError";function $De(e,t=[]){const n=Object.assign({},e);for(const r of t)r in n&&delete n[r];return n}var xP=ra(function(t,n){const{fallbackSrc:r,fallback:i,src:o,srcSet:a,align:s,fit:l,loading:u,ignoreFallback:c,crossOrigin:d,fallbackStrategy:f="beforeLoadOrError",referrerPolicy:h,...p}=t,m=r!==void 0||i!==void 0,_=u!=null||c||!m,b=MDe({...t,crossOrigin:d,ignoreFallback:_}),v=NDe(b,f),g={ref:n,objectFit:l,objectPosition:s,..._?p:$De(p,["onError","onLoad"])};return v?i||W.jsx(Oi.img,{as:P4,className:"chakra-image__placeholder",src:r,...g}):W.jsx(Oi.img,{as:P4,src:o,srcSet:a,crossOrigin:d,loading:u,referrerPolicy:h,className:"chakra-image",...g})});xP.displayName="Image";var HW=ra(function(t,n){const r=Oy("Text",t),{className:i,align:o,decoration:a,casing:s,...l}=Iy(t),u=NOe({textAlign:t.align,textDecoration:t.decoration,textTransform:t.casing});return W.jsx(Oi.p,{ref:n,className:Ac("chakra-text",t.className),...u,...l,__css:r})});HW.displayName="Text";var I4=ra(function(t,n){const r=Oy("Heading",t),{className:i,...o}=Iy(t);return W.jsx(Oi.h2,{ref:n,className:Ac("chakra-heading",t.className),...o,__css:r})});I4.displayName="Heading";var rS=Oi("div");rS.displayName="Box";var qW=ra(function(t,n){const{size:r,centerContent:i=!0,...o}=t,a=i?{display:"flex",alignItems:"center",justifyContent:"center"}:{};return W.jsx(rS,{ref:n,boxSize:r,__css:{...a,flexShrink:0,flexGrow:0},...o})});qW.displayName="Square";var DDe=ra(function(t,n){const{size:r,...i}=t;return W.jsx(qW,{size:r,ref:n,borderRadius:"9999px",...i})});DDe.displayName="Circle";var wP=ra(function(t,n){const{direction:r,align:i,justify:o,wrap:a,basis:s,grow:l,shrink:u,...c}=t,d={display:"flex",flexDirection:r,alignItems:i,justifyContent:o,flexWrap:a,flexBasis:s,flexGrow:l,flexShrink:u};return W.jsx(Oi.div,{ref:n,__css:d,...c})});wP.displayName="Flex";const LDe=z.object({status:z.literal(422),data:z.object({detail:z.array(z.object({loc:z.array(z.string()),msg:z.string(),type:z.string()}))})});function mo(e,t,n=!1){e=String(e),t=String(t);const r=Array.from({length:21},(a,s)=>s*50),i=[0,5,10,15,20,25,30,35,40,45,50,55,59,64,68,73,77,82,86,95,100];return r.reduce((a,s,l)=>{const u=n?i[l]/100:1,c=n?50:i[r.length-1-l];return a[s]=`hsl(${e} ${t}% ${c}% / ${u})`,a},{})}const o1={H:220,S:16},a1={H:250,S:42},s1={H:47,S:42},l1={H:40,S:70},u1={H:28,S:42},c1={H:113,S:42},d1={H:0,S:42},FDe={base:mo(o1.H,o1.S),baseAlpha:mo(o1.H,o1.S,!0),accent:mo(a1.H,a1.S),accentAlpha:mo(a1.H,a1.S,!0),working:mo(s1.H,s1.S),workingAlpha:mo(s1.H,s1.S,!0),gold:mo(l1.H,l1.S),goldAlpha:mo(l1.H,l1.S,!0),warning:mo(u1.H,u1.S),warningAlpha:mo(u1.H,u1.S,!0),ok:mo(c1.H,c1.S),okAlpha:mo(c1.H,c1.S,!0),error:mo(d1.H,d1.S),errorAlpha:mo(d1.H,d1.S,!0)},{definePartsStyle:BDe,defineMultiStyleConfig:zDe}=Pt(BH.keys),jDe={border:"none"},UDe=e=>{const{colorScheme:t}=e;return{fontWeight:"600",fontSize:"sm",border:"none",borderRadius:"base",bg:K(`${t}.200`,`${t}.700`)(e),color:K(`${t}.900`,`${t}.100`)(e),_hover:{bg:K(`${t}.250`,`${t}.650`)(e)},_expanded:{bg:K(`${t}.250`,`${t}.650`)(e),borderBottomRadius:"none",_hover:{bg:K(`${t}.300`,`${t}.600`)(e)}}}},VDe=e=>{const{colorScheme:t}=e;return{bg:K(`${t}.100`,`${t}.800`)(e),borderRadius:"base",borderTopRadius:"none"}},GDe={},HDe=BDe(e=>({container:jDe,button:UDe(e),panel:VDe(e),icon:GDe})),qDe=zDe({variants:{invokeAI:HDe},defaultProps:{variant:"invokeAI",colorScheme:"base"}}),WDe=e=>{const{colorScheme:t}=e;if(t==="base"){const r={bg:K("base.150","base.700")(e),color:K("base.300","base.500")(e),svg:{fill:K("base.300","base.500")(e)},opacity:1},i={bg:"none",color:K("base.300","base.500")(e),svg:{fill:K("base.500","base.500")(e)},opacity:1};return{bg:K("base.250","base.600")(e),color:K("base.850","base.100")(e),borderRadius:"base",svg:{fill:K("base.850","base.100")(e)},_hover:{bg:K("base.300","base.500")(e),color:K("base.900","base.50")(e),svg:{fill:K("base.900","base.50")(e)},_disabled:r},_disabled:r,'&[data-progress="true"]':{...i,_hover:i}}}const n={bg:K(`${t}.400`,`${t}.700`)(e),color:K(`${t}.600`,`${t}.500`)(e),svg:{fill:K(`${t}.600`,`${t}.500`)(e),filter:"unset"},opacity:.7,filter:"saturate(65%)"};return{bg:K(`${t}.400`,`${t}.600`)(e),color:K("base.50","base.100")(e),borderRadius:"base",svg:{fill:K("base.50","base.100")(e)},_disabled:n,_hover:{bg:K(`${t}.500`,`${t}.500`)(e),color:K("white","base.50")(e),svg:{fill:K("white","base.50")(e)},_disabled:n}}},KDe=e=>{const{colorScheme:t}=e,n=K("gray.200","whiteAlpha.300")(e);return{border:"1px solid",borderColor:t==="gray"?n:"currentColor",_hover:{bg:K(`${t}.500`,`${t}.500`)(e),color:K("white","base.50")(e),svg:{fill:K("white","base.50")(e)}},".chakra-button__group[data-attached][data-orientation=horizontal] > &:not(:last-of-type)":{marginEnd:"-1px"},".chakra-button__group[data-attached][data-orientation=vertical] > &:not(:last-of-type)":{marginBottom:"-1px"}}},QDe={variants:{invokeAI:WDe,invokeAIOutline:KDe},defaultProps:{variant:"invokeAI",colorScheme:"base"}},{definePartsStyle:XDe,defineMultiStyleConfig:YDe}=Pt(zH.keys),ZDe=e=>{const{colorScheme:t}=e;return{bg:K("base.200","base.700")(e),borderColor:K("base.300","base.600")(e),color:K("base.900","base.100")(e),_checked:{bg:K(`${t}.300`,`${t}.500`)(e),borderColor:K(`${t}.300`,`${t}.500`)(e),color:K(`${t}.900`,`${t}.100`)(e),_hover:{bg:K(`${t}.400`,`${t}.500`)(e),borderColor:K(`${t}.400`,`${t}.500`)(e)},_disabled:{borderColor:"transparent",bg:"whiteAlpha.300",color:"whiteAlpha.500"}},_indeterminate:{bg:K(`${t}.300`,`${t}.600`)(e),borderColor:K(`${t}.300`,`${t}.600`)(e),color:K(`${t}.900`,`${t}.100`)(e)},_disabled:{bg:"whiteAlpha.100",borderColor:"transparent"},_focusVisible:{boxShadow:"none",outline:"none"},_invalid:{borderColor:K("error.600","error.300")(e)}}},JDe=XDe(e=>({control:ZDe(e)})),eLe=YDe({variants:{invokeAI:JDe},defaultProps:{variant:"invokeAI",colorScheme:"accent"}}),{definePartsStyle:tLe,defineMultiStyleConfig:nLe}=Pt(jH.keys),rLe={borderRadius:"md",py:"1",transitionProperty:"common",transitionDuration:"normal"},iLe=e=>({borderRadius:"md",py:"1",transitionProperty:"common",transitionDuration:"normal",width:"full",_focusVisible:{boxShadow:"outline"},_placeholder:{opacity:.6},"::selection":{color:K("accent.900","accent.50")(e),bg:K("accent.200","accent.400")(e)}}),oLe={borderRadius:"md",py:"1",transitionProperty:"common",transitionDuration:"normal",width:"full",_focusVisible:{boxShadow:"outline"},_placeholder:{opacity:.6}},aLe=tLe(e=>({preview:rLe,input:iLe(e),textarea:oLe})),sLe=nLe({variants:{invokeAI:aLe},defaultProps:{size:"sm",variant:"invokeAI"}}),lLe=e=>({fontSize:"sm",marginEnd:0,mb:1,fontWeight:"400",transitionProperty:"common",transitionDuration:"normal",whiteSpace:"nowrap",_disabled:{opacity:.4},color:K("base.700","base.300")(e),_invalid:{color:K("error.500","error.300")(e)}}),uLe={variants:{invokeAI:lLe},defaultProps:{variant:"invokeAI"}},hw=e=>({outline:"none",borderWidth:2,borderStyle:"solid",borderColor:K("base.200","base.800")(e),bg:K("base.50","base.900")(e),borderRadius:"base",color:K("base.900","base.100")(e),boxShadow:"none",_hover:{borderColor:K("base.300","base.600")(e)},_focus:{borderColor:K("accent.200","accent.600")(e),boxShadow:"none",_hover:{borderColor:K("accent.300","accent.500")(e)}},_invalid:{borderColor:K("error.300","error.600")(e),boxShadow:"none",_hover:{borderColor:K("error.400","error.500")(e)}},_disabled:{borderColor:K("base.300","base.700")(e),bg:K("base.300","base.700")(e),color:K("base.600","base.400")(e),_hover:{borderColor:K("base.300","base.700")(e)}},_placeholder:{color:K("base.700","base.400")(e)},"::selection":{bg:K("accent.200","accent.400")(e)}}),{definePartsStyle:cLe,defineMultiStyleConfig:dLe}=Pt(UH.keys),fLe=cLe(e=>({field:hw(e)})),hLe=dLe({variants:{invokeAI:fLe},defaultProps:{size:"sm",variant:"invokeAI"}}),{definePartsStyle:pLe,defineMultiStyleConfig:gLe}=Pt(VH.keys),mLe=pLe(e=>({button:{fontWeight:500,bg:K("base.300","base.500")(e),color:K("base.900","base.100")(e),_hover:{bg:K("base.400","base.600")(e),color:K("base.900","base.50")(e),fontWeight:600}},list:{zIndex:9999,color:K("base.900","base.150")(e),bg:K("base.200","base.800")(e),shadow:"dark-lg",border:"none"},item:{fontSize:"sm",bg:K("base.200","base.800")(e),_hover:{bg:K("base.300","base.700")(e),svg:{opacity:1}},_focus:{bg:K("base.400","base.600")(e)},svg:{opacity:.7,fontSize:14}}})),yLe=gLe({variants:{invokeAI:mLe},defaultProps:{variant:"invokeAI"}}),$Ke={variants:{enter:{visibility:"visible",opacity:1,scale:1,transition:{duration:.07,ease:[.4,0,.2,1]}},exit:{transitionEnd:{visibility:"hidden"},opacity:0,scale:.8,transition:{duration:.07,easings:"easeOut"}}}},{defineMultiStyleConfig:vLe,definePartsStyle:bLe}=Pt(GH.keys),_Le=e=>({bg:K("blackAlpha.700","blackAlpha.700")(e)}),SLe={},xLe=()=>({layerStyle:"first",maxH:"80vh"}),wLe=()=>({fontWeight:"600",fontSize:"lg",layerStyle:"first",borderTopRadius:"base",borderInlineEndRadius:"base"}),CLe={},ELe={overflowY:"scroll"},kLe={},TLe=bLe(e=>({overlay:_Le(e),dialogContainer:SLe,dialog:xLe(),header:wLe(),closeButton:CLe,body:ELe,footer:kLe})),ALe=vLe({variants:{invokeAI:TLe},defaultProps:{variant:"invokeAI",size:"lg"}}),{defineMultiStyleConfig:PLe,definePartsStyle:ILe}=Pt(HH.keys),RLe=e=>({height:8}),OLe=e=>({border:"none",fontWeight:"600",height:"auto",py:1,ps:2,pe:6,...hw(e)}),MLe=e=>({display:"flex"}),NLe=e=>({border:"none",px:2,py:0,mx:-2,my:0,svg:{color:K("base.700","base.300")(e),width:2.5,height:2.5,_hover:{color:K("base.900","base.100")(e)}}}),$Le=ILe(e=>({root:RLe(e),field:OLe(e),stepperGroup:MLe(e),stepper:NLe(e)})),DLe=PLe({variants:{invokeAI:$Le},defaultProps:{size:"sm",variant:"invokeAI"}}),{defineMultiStyleConfig:LLe,definePartsStyle:WW}=Pt(qH.keys),KW=fr("popper-bg"),QW=fr("popper-arrow-bg"),XW=fr("popper-arrow-shadow-color"),FLe=e=>({[QW.variable]:K("colors.base.100","colors.base.800")(e),[KW.variable]:K("colors.base.100","colors.base.800")(e),[XW.variable]:K("colors.base.400","colors.base.600")(e),minW:"unset",width:"unset",p:4,bg:K("base.100","base.800")(e),border:"none",shadow:"dark-lg"}),BLe=e=>({[QW.variable]:K("colors.base.100","colors.base.700")(e),[KW.variable]:K("colors.base.100","colors.base.700")(e),[XW.variable]:K("colors.base.400","colors.base.400")(e),p:4,bg:K("base.100","base.700")(e),border:"none",shadow:"dark-lg"}),zLe=WW(e=>({content:FLe(e),body:{padding:0}})),jLe=WW(e=>({content:BLe(e),body:{padding:0}})),ULe=LLe({variants:{invokeAI:zLe,informational:jLe},defaultProps:{variant:"invokeAI"}}),{defineMultiStyleConfig:VLe,definePartsStyle:GLe}=Pt(WH.keys),HLe=e=>({bg:"accentAlpha.700"}),qLe=e=>{const{colorScheme:t}=e;return{bg:K(`${t}.200`,`${t}.700`)(e)}},WLe=GLe(e=>({filledTrack:HLe(e),track:qLe(e)})),KLe=VLe({variants:{invokeAI:WLe},defaultProps:{variant:"invokeAI"}}),QLe={"::-webkit-scrollbar":{display:"none"},scrollbarWidth:"none"},{definePartsStyle:XLe,defineMultiStyleConfig:YLe}=Pt(KH.keys),ZLe=e=>({color:K("base.200","base.300")(e)}),JLe=e=>({fontWeight:"600",...hw(e)}),eFe=XLe(e=>({field:JLe(e),icon:ZLe(e)})),tFe=YLe({variants:{invokeAI:eFe},defaultProps:{size:"sm",variant:"invokeAI"}}),nN=nt("skeleton-start-color"),rN=nt("skeleton-end-color"),nFe={borderRadius:"base",maxW:"full",maxH:"full",_light:{[nN.variable]:"colors.base.250",[rN.variable]:"colors.base.450"},_dark:{[nN.variable]:"colors.base.700",[rN.variable]:"colors.base.500"}},rFe={variants:{invokeAI:nFe},defaultProps:{variant:"invokeAI"}},{definePartsStyle:iFe,defineMultiStyleConfig:oFe}=Pt(QH.keys),aFe=e=>({bg:K("base.400","base.600")(e),h:1.5}),sFe=e=>{const{colorScheme:t}=e;return{bg:K(`${t}.400`,`${t}.600`)(e),h:1.5}},lFe=e=>({w:e.orientation==="horizontal"?2:4,h:e.orientation==="horizontal"?4:2,bg:K("base.50","base.100")(e)}),uFe=e=>({fontSize:"2xs",fontWeight:"500",color:K("base.700","base.400")(e),mt:2,insetInlineStart:"unset"}),cFe=iFe(e=>({container:{_disabled:{opacity:.6,cursor:"default",pointerEvents:"none"}},track:aFe(e),filledTrack:sFe(e),thumb:lFe(e),mark:uFe(e)})),dFe=oFe({variants:{invokeAI:cFe},defaultProps:{variant:"invokeAI",colorScheme:"accent"}}),{defineMultiStyleConfig:fFe,definePartsStyle:hFe}=Pt(XH.keys),pFe=e=>{const{colorScheme:t}=e;return{bg:K("base.300","base.600")(e),_focusVisible:{boxShadow:"none"},_checked:{bg:K(`${t}.400`,`${t}.500`)(e)}}},gFe=e=>{const{colorScheme:t}=e;return{bg:K(`${t}.50`,`${t}.50`)(e)}},mFe=hFe(e=>({container:{},track:pFe(e),thumb:gFe(e)})),yFe=fFe({variants:{invokeAI:mFe},defaultProps:{size:"md",variant:"invokeAI",colorScheme:"accent"}}),{defineMultiStyleConfig:vFe,definePartsStyle:YW}=Pt(YH.keys),bFe=e=>({display:"flex",columnGap:4}),_Fe=e=>({}),SFe=e=>{const{colorScheme:t}=e;return{display:"flex",flexDirection:"column",gap:1,color:K("base.700","base.400")(e),button:{fontSize:"sm",padding:2,borderRadius:"base",textShadow:K("0 0 0.3rem var(--invokeai-colors-accent-100)","0 0 0.3rem var(--invokeai-colors-accent-900)")(e),svg:{fill:K("base.700","base.300")(e)},_selected:{bg:K("accent.400","accent.600")(e),color:K("base.50","base.100")(e),svg:{fill:K("base.50","base.100")(e),filter:K(`drop-shadow(0px 0px 0.3rem var(--invokeai-colors-${t}-600))`,`drop-shadow(0px 0px 0.3rem var(--invokeai-colors-${t}-800))`)(e)},_hover:{bg:K("accent.500","accent.500")(e),color:K("white","base.50")(e),svg:{fill:K("white","base.50")(e)}}},_hover:{bg:K("base.100","base.800")(e),color:K("base.900","base.50")(e),svg:{fill:K("base.800","base.100")(e)}}}}},xFe=e=>({padding:0,height:"100%"}),wFe=YW(e=>({root:bFe(e),tab:_Fe(e),tablist:SFe(e),tabpanel:xFe(e)})),CFe=YW(e=>({tab:{borderTopRadius:"base",px:4,py:1,fontSize:"sm",color:K("base.600","base.400")(e),fontWeight:500,_selected:{color:K("accent.600","accent.400")(e)}},tabpanel:{p:0,pt:4,w:"full",h:"full"},tabpanels:{w:"full",h:"full"}})),EFe=vFe({variants:{line:CFe,appTabs:wFe},defaultProps:{variant:"appTabs",colorScheme:"accent"}}),kFe=e=>({color:K("base.500","base.400")(e)}),TFe={variants:{subtext:kFe}},AFe=e=>({...hw(e),"::-webkit-scrollbar":{display:"initial"},"::-webkit-resizer":{backgroundImage:`linear-gradient(135deg, var(--invokeai-colors-base-50) 0%, var(--invokeai-colors-base-50) 70%, var(--invokeai-colors-base-200) 70%, @@ -150,9 +150,9 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho var(--invokeai-colors-base-900) 0%, var(--invokeai-colors-base-900) 70%, var(--invokeai-colors-base-800) 70%, - var(--invokeai-colors-base-800) 100%)`}}},p:2}),IFe={variants:{invokeAI:PFe},defaultProps:{size:"md",variant:"invokeAI"}},RFe=fr("popper-arrow-bg"),OFe=e=>({borderRadius:"base",shadow:"dark-lg",bg:K("base.700","base.200")(e),[RFe.variable]:K("colors.base.700","colors.base.200")(e),pb:1.5}),MFe={baseStyle:OFe},oN={backgroundColor:"accentAlpha.150 !important",borderColor:"accentAlpha.700 !important",borderRadius:"base !important",borderStyle:"dashed !important",_dark:{borderColor:"accent.400 !important"}},NFe={".react-flow__nodesselection-rect":{...oN,padding:"1rem !important",boxSizing:"content-box !important",transform:"translate(-1rem, -1rem) !important"},".react-flow__selection":oN},$Fe={config:{cssVarPrefix:"invokeai",initialColorMode:"dark",useSystemColorMode:!1},layerStyles:{body:{bg:"base.50",color:"base.900",".chakra-ui-dark &":{bg:"base.900",color:"base.50"}},first:{bg:"base.100",color:"base.900",".chakra-ui-dark &":{bg:"base.850",color:"base.100"}},second:{bg:"base.200",color:"base.900",".chakra-ui-dark &":{bg:"base.800",color:"base.100"}},third:{bg:"base.300",color:"base.900",".chakra-ui-dark &":{bg:"base.750",color:"base.100"}},nodeBody:{bg:"base.100",color:"base.900",".chakra-ui-dark &":{bg:"base.800",color:"base.100"}},nodeHeader:{bg:"base.200",color:"base.900",".chakra-ui-dark &":{bg:"base.900",color:"base.100"}},nodeFooter:{bg:"base.200",color:"base.900",".chakra-ui-dark &":{bg:"base.900",color:"base.100"}}},styles:{global:()=>({layerStyle:"body","*":{...XLe},...NFe})},direction:"ltr",fonts:{body:"'Inter Variable', sans-serif",heading:"'Inter Variable', sans-serif"},shadows:{light:{accent:"0 0 10px 0 var(--invokeai-colors-accent-300)",accentHover:"0 0 10px 0 var(--invokeai-colors-accent-400)",ok:"0 0 7px var(--invokeai-colors-ok-600)",working:"0 0 7px var(--invokeai-colors-working-600)",error:"0 0 7px var(--invokeai-colors-error-600)"},dark:{accent:"0 0 10px 0 var(--invokeai-colors-accent-600)",accentHover:"0 0 10px 0 var(--invokeai-colors-accent-500)",ok:"0 0 7px var(--invokeai-colors-ok-400)",working:"0 0 7px var(--invokeai-colors-working-400)",error:"0 0 7px var(--invokeai-colors-error-400)"},selected:{light:"0px 0px 0px 1px var(--invokeai-colors-base-150), 0px 0px 0px 4px var(--invokeai-colors-accent-400)",dark:"0px 0px 0px 1px var(--invokeai-colors-base-900), 0px 0px 0px 4px var(--invokeai-colors-accent-500)"},hoverSelected:{light:"0px 0px 0px 1px var(--invokeai-colors-base-150), 0px 0px 0px 4px var(--invokeai-colors-accent-500)",dark:"0px 0px 0px 1px var(--invokeai-colors-base-900), 0px 0px 0px 4px var(--invokeai-colors-accent-400)"},hoverUnselected:{light:"0px 0px 0px 1px var(--invokeai-colors-base-150), 0px 0px 0px 3px var(--invokeai-colors-accent-500)",dark:"0px 0px 0px 1px var(--invokeai-colors-base-900), 0px 0px 0px 3px var(--invokeai-colors-accent-400)"},nodeSelected:{light:"0 0 0 3px var(--invokeai-colors-accent-400)",dark:"0 0 0 3px var(--invokeai-colors-accent-500)"},nodeHovered:{light:"0 0 0 2px var(--invokeai-colors-accent-500)",dark:"0 0 0 2px var(--invokeai-colors-accent-400)"},nodeHoveredSelected:{light:"0 0 0 3px var(--invokeai-colors-accent-500)",dark:"0 0 0 3px var(--invokeai-colors-accent-400)"},nodeInProgress:{light:"0 0 0 2px var(--invokeai-colors-accent-500), 0 0 10px 2px var(--invokeai-colors-accent-600)",dark:"0 0 0 2px var(--invokeai-colors-yellow-400), 0 0 20px 2px var(--invokeai-colors-orange-700)"}},colors:BDe,components:{Button:XDe,Input:pLe,Editable:lLe,Textarea:IFe,Tabs:kFe,Progress:QLe,Accordion:WDe,FormLabel:cLe,Switch:vFe,NumberInput:LLe,Select:nFe,Skeleton:iFe,Slider:fFe,Popover:VLe,Modal:PLe,Checkbox:tLe,Menu:vLe,Text:AFe,Tooltip:MFe}},DFe={defaultOptions:{isClosable:!0}},{toast:cg}=MDe({theme:$Fe,defaultOptions:DFe.defaultOptions}),LFe=()=>{Fe({matcher:Qr.endpoints.enqueueBatch.matchFulfilled,effect:async e=>{const t=e.payload,n=e.meta.arg.originalArgs;_e("queue").debug({enqueueResult:Qt(t)},"Batch enqueued"),cg.isActive("batch-queued")||cg({id:"batch-queued",title:Z("queue.batchQueued"),description:Z("queue.batchQueuedDesc",{item_count:t.enqueued,direction:n.prepend?Z("queue.front"):Z("queue.back")}),duration:1e3,status:"success"})}}),Fe({matcher:Qr.endpoints.enqueueBatch.matchRejected,effect:async e=>{const t=e.payload,n=e.meta.arg.originalArgs;if(!t){cg({title:Z("queue.batchFailedToQueue"),status:"error",description:"Unknown Error"}),_e("queue").error({batchConfig:Qt(n),error:Qt(t)},Z("queue.batchFailedToQueue"));return}const r=FDe.safeParse(t);if(r.success)r.data.data.detail.map(i=>{cg({id:"batch-failed-to-queue",title:K8(vF(i.msg),{length:128}),status:"error",description:K8(`Path: - ${i.loc.join(".")}`,{length:128})})});else{let i="Unknown Error",o;t.status===403&&"body"in t?i=ch(t,"body.detail","Unknown Error"):t.status===403&&"error"in t?i=ch(t,"error.detail","Unknown Error"):t.status===403&&"data"in t&&(i=ch(t,"data.detail","Unknown Error"),o=15e3),cg({title:Z("queue.batchFailedToQueue"),status:"error",description:i,...o?{duration:o}:{}})}_e("queue").error({batchConfig:Qt(n),error:Qt(t)},Z("queue.batchFailedToQueue"))}})},eK=BL(),Fe=eK.startListening;LEe();FEe();VEe();AEe();PEe();IEe();REe();OEe();Cxe();DEe();BEe();zEe();dEe();EEe();mEe();bxe();LFe();H3e();j3e();zxe();U3e();Bxe();Lxe();G3e();fke();mxe();eke();tke();rke();ike();ake();Z4e();J4e();cke();dke();ske();uke();oke();lke();Q3e();W3e();kEe();TEe();NEe();$Ee();Exe();Y4e();Gke();MEe();GEe();xxe();qEe();_xe();yxe();Lke();pke();QEe();const FFe={canvas:hle,gallery:S0e,generation:tle,nodes:n2e,postprocessing:r2e,system:c2e,config:Mae,ui:b2e,hotkeys:v2e,controlNet:c0e,dynamicPrompts:_0e,deleteImageModal:h0e,changeBoardModal:gle,lora:C0e,modelmanager:y2e,sdxl:o2e,queue:g2e,[ls.reducerPath]:ls.reducer},BFe=pp(FFe),zFe=G2e(BFe),jFe=["canvas","gallery","generation","sdxl","nodes","postprocessing","system","ui","controlNet","dynamicPrompts","lora","modelmanager"],tK=bL({reducer:zFe,enhancers:e=>e.concat(H2e(window.localStorage,jFe,{persistDebounce:300,serialize:rxe,unserialize:oxe,prefix:q2e})).concat(jL()),middleware:e=>e({serializableCheck:!1,immutableCheck:!1}).concat(ls.middleware).concat(w2e).prepend(eK.middleware),devTools:{actionSanitizer:dxe,stateSanitizer:hxe,trace:!0,predicate:(e,t)=>!fxe.includes(t.type)}}),nK=e=>e;IB.set(tK);const UFe=e=>{const{socket:t,storeApi:n}=e,{dispatch:r}=n;t.on("connect",()=>{_e("socketio").debug("Connected"),r(Bj());const o=Ur.get();t.emit("subscribe_queue",{queue_id:o})}),t.on("connect_error",i=>{i&&i.message&&i.data==="ERR_UNAUTHENTICATED"&&r(Gt($d({title:i.message,status:"error",duration:1e4})))}),t.on("disconnect",()=>{r(zj())}),t.on("invocation_started",i=>{r(Uj({data:i}))}),t.on("generator_progress",i=>{r(qj({data:i}))}),t.on("invocation_error",i=>{r(Vj({data:i}))}),t.on("invocation_complete",i=>{r(UT({data:i}))}),t.on("graph_execution_state_complete",i=>{r(Gj({data:i}))}),t.on("model_load_started",i=>{r(Wj({data:i}))}),t.on("model_load_completed",i=>{r(Qj({data:i}))}),t.on("session_retrieval_error",i=>{r(Yj({data:i}))}),t.on("invocation_retrieval_error",i=>{r(Jj({data:i}))}),t.on("queue_item_status_changed",i=>{r(tU({data:i}))})},Ys=Object.create(null);Ys.open="0";Ys.close="1";Ys.ping="2";Ys.pong="3";Ys.message="4";Ys.upgrade="5";Ys.noop="6";const ab=Object.create(null);Object.keys(Ys).forEach(e=>{ab[Ys[e]]=e});const O4={type:"error",data:"parser error"},rK=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",iK=typeof ArrayBuffer=="function",oK=e=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer,EP=({type:e,data:t},n,r)=>rK&&t instanceof Blob?n?r(t):aN(t,r):iK&&(t instanceof ArrayBuffer||oK(t))?n?r(t):aN(new Blob([t]),r):r(Ys[e]+(t||"")),aN=(e,t)=>{const n=new FileReader;return n.onload=function(){const r=n.result.split(",")[1];t("b"+(r||""))},n.readAsDataURL(e)};function sN(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}let D5;function VFe(e,t){if(rK&&e.data instanceof Blob)return e.data.arrayBuffer().then(sN).then(t);if(iK&&(e.data instanceof ArrayBuffer||oK(e.data)))return t(sN(e.data));EP(e,!1,n=>{D5||(D5=new TextEncoder),t(D5.encode(n))})}const lN="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Rg=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let e=0;e{let t=e.length*.75,n=e.length,r,i=0,o,a,s,l;e[e.length-1]==="="&&(t--,e[e.length-2]==="="&&t--);const u=new ArrayBuffer(t),c=new Uint8Array(u);for(r=0;r>4,c[i++]=(a&15)<<4|s>>2,c[i++]=(s&3)<<6|l&63;return u},HFe=typeof ArrayBuffer=="function",kP=(e,t)=>{if(typeof e!="string")return{type:"message",data:aK(e,t)};const n=e.charAt(0);return n==="b"?{type:"message",data:qFe(e.substring(1),t)}:ab[n]?e.length>1?{type:ab[n],data:e.substring(1)}:{type:ab[n]}:O4},qFe=(e,t)=>{if(HFe){const n=GFe(e);return aK(n,t)}else return{base64:!0,data:e}},aK=(e,t)=>{switch(t){case"blob":return e instanceof Blob?e:new Blob([e]);case"arraybuffer":default:return e instanceof ArrayBuffer?e:e.buffer}},sK=String.fromCharCode(30),WFe=(e,t)=>{const n=e.length,r=new Array(n);let i=0;e.forEach((o,a)=>{EP(o,!1,s=>{r[a]=s,++i===n&&t(r.join(sK))})})},KFe=(e,t)=>{const n=e.split(sK),r=[];for(let i=0;i{const r=n.length;let i;if(r<126)i=new Uint8Array(1),new DataView(i.buffer).setUint8(0,r);else if(r<65536){i=new Uint8Array(3);const o=new DataView(i.buffer);o.setUint8(0,126),o.setUint16(1,r)}else{i=new Uint8Array(9);const o=new DataView(i.buffer);o.setUint8(0,127),o.setBigUint64(1,BigInt(r))}e.data&&typeof e.data!="string"&&(i[0]|=128),t.enqueue(i),t.enqueue(n)})}})}let L5;function f1(e){return e.reduce((t,n)=>t+n.length,0)}function h1(e,t){if(e[0].length===t)return e.shift();const n=new Uint8Array(t);let r=0;for(let i=0;iMath.pow(2,53-32)-1){s.enqueue(O4);break}i=c*Math.pow(2,32)+u.getUint32(4),r=3}else{if(f1(n)e){s.enqueue(O4);break}}}})}const lK=4;function Lr(e){if(e)return YFe(e)}function YFe(e){for(var t in Lr.prototype)e[t]=Lr.prototype[t];return e}Lr.prototype.on=Lr.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this};Lr.prototype.once=function(e,t){function n(){this.off(e,n),t.apply(this,arguments)}return n.fn=t,this.on(e,n),this};Lr.prototype.off=Lr.prototype.removeListener=Lr.prototype.removeAllListeners=Lr.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var n=this._callbacks["$"+e];if(!n)return this;if(arguments.length==1)return delete this._callbacks["$"+e],this;for(var r,i=0;itypeof self<"u"?self:typeof window<"u"?window:Function("return this")())();function uK(e,...t){return t.reduce((n,r)=>(e.hasOwnProperty(r)&&(n[r]=e[r]),n),{})}const ZFe=ma.setTimeout,JFe=ma.clearTimeout;function pw(e,t){t.useNativeTimers?(e.setTimeoutFn=ZFe.bind(ma),e.clearTimeoutFn=JFe.bind(ma)):(e.setTimeoutFn=ma.setTimeout.bind(ma),e.clearTimeoutFn=ma.clearTimeout.bind(ma))}const eBe=1.33;function tBe(e){return typeof e=="string"?nBe(e):Math.ceil((e.byteLength||e.size)*eBe)}function nBe(e){let t=0,n=0;for(let r=0,i=e.length;r=57344?n+=3:(r++,n+=4);return n}function rBe(e){let t="";for(let n in e)e.hasOwnProperty(n)&&(t.length&&(t+="&"),t+=encodeURIComponent(n)+"="+encodeURIComponent(e[n]));return t}function iBe(e){let t={},n=e.split("&");for(let r=0,i=n.length;r0);return t}function dK(){const e=dN(+new Date);return e!==cN?(uN=0,cN=e):e+"."+dN(uN++)}for(;p1{this.readyState="paused",t()};if(this.polling||!this.writable){let r=0;this.polling&&(r++,this.once("pollComplete",function(){--r||n()})),this.writable||(r++,this.once("drain",function(){--r||n()}))}else n()}poll(){this.polling=!0,this.doPoll(),this.emitReserved("poll")}onData(t){const n=r=>{if(this.readyState==="opening"&&r.type==="open"&&this.onOpen(),r.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(r)};KFe(t,this.socket.binaryType).forEach(n),this.readyState!=="closed"&&(this.polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this.poll())}doClose(){const t=()=>{this.write([{type:"close"}])};this.readyState==="open"?t():this.once("open",t)}write(t){this.writable=!1,WFe(t,n=>{this.doWrite(n,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const t=this.opts.secure?"https":"http",n=this.query||{};return this.opts.timestampRequests!==!1&&(n[this.opts.timestampParam]=dK()),!this.supportsBinary&&!n.sid&&(n.b64=1),this.createUri(t,n)}request(t={}){return Object.assign(t,{xd:this.xd,cookieJar:this.cookieJar},this.opts),new kh(this.uri(),t)}doWrite(t,n){const r=this.request({method:"POST",data:t});r.on("success",n),r.on("error",(i,o)=>{this.onError("xhr post error",i,o)})}doPoll(){const t=this.request();t.on("data",this.onData.bind(this)),t.on("error",(n,r)=>{this.onError("xhr poll error",n,r)}),this.pollXhr=t}}let kh=class sb extends Lr{constructor(t,n){super(),pw(this,n),this.opts=n,this.method=n.method||"GET",this.uri=t,this.data=n.data!==void 0?n.data:null,this.create()}create(){var t;const n=uK(this.opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");n.xdomain=!!this.opts.xd;const r=this.xhr=new hK(n);try{r.open(this.method,this.uri,!0);try{if(this.opts.extraHeaders){r.setDisableHeaderCheck&&r.setDisableHeaderCheck(!0);for(let i in this.opts.extraHeaders)this.opts.extraHeaders.hasOwnProperty(i)&&r.setRequestHeader(i,this.opts.extraHeaders[i])}}catch{}if(this.method==="POST")try{r.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{r.setRequestHeader("Accept","*/*")}catch{}(t=this.opts.cookieJar)===null||t===void 0||t.addCookies(r),"withCredentials"in r&&(r.withCredentials=this.opts.withCredentials),this.opts.requestTimeout&&(r.timeout=this.opts.requestTimeout),r.onreadystatechange=()=>{var i;r.readyState===3&&((i=this.opts.cookieJar)===null||i===void 0||i.parseCookies(r)),r.readyState===4&&(r.status===200||r.status===1223?this.onLoad():this.setTimeoutFn(()=>{this.onError(typeof r.status=="number"?r.status:0)},0))},r.send(this.data)}catch(i){this.setTimeoutFn(()=>{this.onError(i)},0);return}typeof document<"u"&&(this.index=sb.requestsCount++,sb.requests[this.index]=this)}onError(t){this.emitReserved("error",t,this.xhr),this.cleanup(!0)}cleanup(t){if(!(typeof this.xhr>"u"||this.xhr===null)){if(this.xhr.onreadystatechange=lBe,t)try{this.xhr.abort()}catch{}typeof document<"u"&&delete sb.requests[this.index],this.xhr=null}}onLoad(){const t=this.xhr.responseText;t!==null&&(this.emitReserved("data",t),this.emitReserved("success"),this.cleanup())}abort(){this.cleanup()}};kh.requestsCount=0;kh.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",fN);else if(typeof addEventListener=="function"){const e="onpagehide"in ma?"pagehide":"unload";addEventListener(e,fN,!1)}}function fN(){for(let e in kh.requests)kh.requests.hasOwnProperty(e)&&kh.requests[e].abort()}const AP=(()=>typeof Promise=="function"&&typeof Promise.resolve=="function"?t=>Promise.resolve().then(t):(t,n)=>n(t,0))(),g1=ma.WebSocket||ma.MozWebSocket,hN=!0,dBe="arraybuffer",pN=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class fBe extends TP{constructor(t){super(t),this.supportsBinary=!t.forceBase64}get name(){return"websocket"}doOpen(){if(!this.check())return;const t=this.uri(),n=this.opts.protocols,r=pN?{}:uK(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(r.headers=this.opts.extraHeaders);try{this.ws=hN&&!pN?n?new g1(t,n):new g1(t):new g1(t,n,r)}catch(i){return this.emitReserved("error",i)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=t=>this.onClose({description:"websocket connection closed",context:t}),this.ws.onmessage=t=>this.onData(t.data),this.ws.onerror=t=>this.onError("websocket error",t)}write(t){this.writable=!1;for(let n=0;n{const a={};try{hN&&this.ws.send(o)}catch{}i&&AP(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.close(),this.ws=null)}uri(){const t=this.opts.secure?"wss":"ws",n=this.query||{};return this.opts.timestampRequests&&(n[this.opts.timestampParam]=dK()),this.supportsBinary||(n.b64=1),this.createUri(t,n)}check(){return!!g1}}class hBe extends TP{get name(){return"webtransport"}doOpen(){typeof WebTransport=="function"&&(this.transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name]),this.transport.closed.then(()=>{this.onClose()}).catch(t=>{this.onError("webtransport error",t)}),this.transport.ready.then(()=>{this.transport.createBidirectionalStream().then(t=>{const n=XFe(Number.MAX_SAFE_INTEGER,this.socket.binaryType),r=t.readable.pipeThrough(n).getReader(),i=QFe();i.readable.pipeTo(t.writable),this.writer=i.writable.getWriter();const o=()=>{r.read().then(({done:s,value:l})=>{s||(this.onPacket(l),o())}).catch(s=>{})};o();const a={type:"open"};this.query.sid&&(a.data=`{"sid":"${this.query.sid}"}`),this.writer.write(a).then(()=>this.onOpen())})}))}write(t){this.writable=!1;for(let n=0;n{i&&AP(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var t;(t=this.transport)===null||t===void 0||t.close()}}const pBe={websocket:fBe,webtransport:hBe,polling:cBe},gBe=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,mBe=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function N4(e){const t=e,n=e.indexOf("["),r=e.indexOf("]");n!=-1&&r!=-1&&(e=e.substring(0,n)+e.substring(n,r).replace(/:/g,";")+e.substring(r,e.length));let i=gBe.exec(e||""),o={},a=14;for(;a--;)o[mBe[a]]=i[a]||"";return n!=-1&&r!=-1&&(o.source=t,o.host=o.host.substring(1,o.host.length-1).replace(/;/g,":"),o.authority=o.authority.replace("[","").replace("]","").replace(/;/g,":"),o.ipv6uri=!0),o.pathNames=yBe(o,o.path),o.queryKey=vBe(o,o.query),o}function yBe(e,t){const n=/\/{2,9}/g,r=t.replace(n,"/").split("/");return(t.slice(0,1)=="/"||t.length===0)&&r.splice(0,1),t.slice(-1)=="/"&&r.splice(r.length-1,1),r}function vBe(e,t){const n={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(r,i,o){i&&(n[i]=o)}),n}let pK=class Tf extends Lr{constructor(t,n={}){super(),this.binaryType=dBe,this.writeBuffer=[],t&&typeof t=="object"&&(n=t,t=null),t?(t=N4(t),n.hostname=t.host,n.secure=t.protocol==="https"||t.protocol==="wss",n.port=t.port,t.query&&(n.query=t.query)):n.host&&(n.hostname=N4(n.host).host),pw(this,n),this.secure=n.secure!=null?n.secure:typeof location<"u"&&location.protocol==="https:",n.hostname&&!n.port&&(n.port=this.secure?"443":"80"),this.hostname=n.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=n.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=n.transports||["polling","websocket","webtransport"],this.writeBuffer=[],this.prevBufferLen=0,this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},n),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=iBe(this.opts.query)),this.id=null,this.upgrades=null,this.pingInterval=null,this.pingTimeout=null,this.pingTimeoutTimer=null,typeof addEventListener=="function"&&(this.opts.closeOnBeforeunload&&(this.beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this.beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this.offlineEventListener=()=>{this.onClose("transport close",{description:"network connection lost"})},addEventListener("offline",this.offlineEventListener,!1))),this.open()}createTransport(t){const n=Object.assign({},this.opts.query);n.EIO=lK,n.transport=t,this.id&&(n.sid=this.id);const r=Object.assign({},this.opts,{query:n,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[t]);return new pBe[t](r)}open(){let t;if(this.opts.rememberUpgrade&&Tf.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1)t="websocket";else if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}else t=this.transports[0];this.readyState="opening";try{t=this.createTransport(t)}catch{this.transports.shift(),this.open();return}t.open(),this.setTransport(t)}setTransport(t){this.transport&&this.transport.removeAllListeners(),this.transport=t,t.on("drain",this.onDrain.bind(this)).on("packet",this.onPacket.bind(this)).on("error",this.onError.bind(this)).on("close",n=>this.onClose("transport close",n))}probe(t){let n=this.createTransport(t),r=!1;Tf.priorWebsocketSuccess=!1;const i=()=>{r||(n.send([{type:"ping",data:"probe"}]),n.once("packet",d=>{if(!r)if(d.type==="pong"&&d.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",n),!n)return;Tf.priorWebsocketSuccess=n.name==="websocket",this.transport.pause(()=>{r||this.readyState!=="closed"&&(c(),this.setTransport(n),n.send([{type:"upgrade"}]),this.emitReserved("upgrade",n),n=null,this.upgrading=!1,this.flush())})}else{const f=new Error("probe error");f.transport=n.name,this.emitReserved("upgradeError",f)}}))};function o(){r||(r=!0,c(),n.close(),n=null)}const a=d=>{const f=new Error("probe error: "+d);f.transport=n.name,o(),this.emitReserved("upgradeError",f)};function s(){a("transport closed")}function l(){a("socket closed")}function u(d){n&&d.name!==n.name&&o()}const c=()=>{n.removeListener("open",i),n.removeListener("error",a),n.removeListener("close",s),this.off("close",l),this.off("upgrading",u)};n.once("open",i),n.once("error",a),n.once("close",s),this.once("close",l),this.once("upgrading",u),this.upgrades.indexOf("webtransport")!==-1&&t!=="webtransport"?this.setTimeoutFn(()=>{r||n.open()},200):n.open()}onOpen(){if(this.readyState="open",Tf.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush(),this.readyState==="open"&&this.opts.upgrade){let t=0;const n=this.upgrades.length;for(;t{this.onClose("ping timeout")},this.pingInterval+this.pingTimeout),this.opts.autoUnref&&this.pingTimeoutTimer.unref()}onDrain(){this.writeBuffer.splice(0,this.prevBufferLen),this.prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const t=this.getWritablePackets();this.transport.send(t),this.prevBufferLen=t.length,this.emitReserved("flush")}}getWritablePackets(){if(!(this.maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let n=1;for(let r=0;r0&&n>this.maxPayload)return this.writeBuffer.slice(0,r);n+=2}return this.writeBuffer}write(t,n,r){return this.sendPacket("message",t,n,r),this}send(t,n,r){return this.sendPacket("message",t,n,r),this}sendPacket(t,n,r,i){if(typeof n=="function"&&(i=n,n=void 0),typeof r=="function"&&(i=r,r=null),this.readyState==="closing"||this.readyState==="closed")return;r=r||{},r.compress=r.compress!==!1;const o={type:t,data:n,options:r};this.emitReserved("packetCreate",o),this.writeBuffer.push(o),i&&this.once("flush",i),this.flush()}close(){const t=()=>{this.onClose("forced close"),this.transport.close()},n=()=>{this.off("upgrade",n),this.off("upgradeError",n),t()},r=()=>{this.once("upgrade",n),this.once("upgradeError",n)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?r():t()}):this.upgrading?r():t()),this}onError(t){Tf.priorWebsocketSuccess=!1,this.emitReserved("error",t),this.onClose("transport error",t)}onClose(t,n){(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")&&(this.clearTimeoutFn(this.pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),typeof removeEventListener=="function"&&(removeEventListener("beforeunload",this.beforeunloadEventListener,!1),removeEventListener("offline",this.offlineEventListener,!1)),this.readyState="closed",this.id=null,this.emitReserved("close",t,n),this.writeBuffer=[],this.prevBufferLen=0)}filterUpgrades(t){const n=[];let r=0;const i=t.length;for(;rtypeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer,gK=Object.prototype.toString,xBe=typeof Blob=="function"||typeof Blob<"u"&&gK.call(Blob)==="[object BlobConstructor]",wBe=typeof File=="function"||typeof File<"u"&&gK.call(File)==="[object FileConstructor]";function PP(e){return _Be&&(e instanceof ArrayBuffer||SBe(e))||xBe&&e instanceof Blob||wBe&&e instanceof File}function lb(e,t){if(!e||typeof e!="object")return!1;if(Array.isArray(e)){for(let n=0,r=e.length;n=0&&e.num{delete this.acks[t];for(let a=0;a{this.io.clearTimeoutFn(o),n.apply(this,[null,...a])}}emitWithAck(t,...n){const r=this.flags.timeout!==void 0||this._opts.ackTimeout!==void 0;return new Promise((i,o)=>{n.push((a,s)=>r?a?o(a):i(s):i(a)),this.emit(t,...n)})}_addToQueue(t){let n;typeof t[t.length-1]=="function"&&(n=t.pop());const r={id:this._queueSeq++,tryCount:0,pending:!1,args:t,flags:Object.assign({fromQueue:!0},this.flags)};t.push((i,...o)=>r!==this._queue[0]?void 0:(i!==null?r.tryCount>this._opts.retries&&(this._queue.shift(),n&&n(i)):(this._queue.shift(),n&&n(null,...o)),r.pending=!1,this._drainQueue())),this._queue.push(r),this._drainQueue()}_drainQueue(t=!1){if(!this.connected||this._queue.length===0)return;const n=this._queue[0];n.pending&&!t||(n.pending=!0,n.tryCount++,this.flags=n.flags,this.emit.apply(this,n.args))}packet(t){t.nsp=this.nsp,this.io._packet(t)}onopen(){typeof this.auth=="function"?this.auth(t=>{this._sendConnectPacket(t)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(t){this.packet({type:Ft.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},t):t})}onerror(t){this.connected||this.emitReserved("connect_error",t)}onclose(t,n){this.connected=!1,delete this.id,this.emitReserved("disconnect",t,n)}onpacket(t){if(t.nsp===this.nsp)switch(t.type){case Ft.CONNECT:t.data&&t.data.sid?this.onconnect(t.data.sid,t.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case Ft.EVENT:case Ft.BINARY_EVENT:this.onevent(t);break;case Ft.ACK:case Ft.BINARY_ACK:this.onack(t);break;case Ft.DISCONNECT:this.ondisconnect();break;case Ft.CONNECT_ERROR:this.destroy();const r=new Error(t.data.message);r.data=t.data.data,this.emitReserved("connect_error",r);break}}onevent(t){const n=t.data||[];t.id!=null&&n.push(this.ack(t.id)),this.connected?this.emitEvent(n):this.receiveBuffer.push(Object.freeze(n))}emitEvent(t){if(this._anyListeners&&this._anyListeners.length){const n=this._anyListeners.slice();for(const r of n)r.apply(this,t)}super.emit.apply(this,t),this._pid&&t.length&&typeof t[t.length-1]=="string"&&(this._lastOffset=t[t.length-1])}ack(t){const n=this;let r=!1;return function(...i){r||(r=!0,n.packet({type:Ft.ACK,id:t,data:i}))}}onack(t){const n=this.acks[t.id];typeof n=="function"&&(n.apply(this,t.data),delete this.acks[t.id])}onconnect(t,n){this.id=t,this.recovered=n&&this._pid===n,this._pid=n,this.connected=!0,this.emitBuffered(),this.emitReserved("connect"),this._drainQueue(!0)}emitBuffered(){this.receiveBuffer.forEach(t=>this.emitEvent(t)),this.receiveBuffer=[],this.sendBuffer.forEach(t=>{this.notifyOutgoingListeners(t),this.packet(t)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(t=>t()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:Ft.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(t){return this.flags.compress=t,this}get volatile(){return this.flags.volatile=!0,this}timeout(t){return this.flags.timeout=t,this}onAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(t),this}prependAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(t),this}offAny(t){if(!this._anyListeners)return this;if(t){const n=this._anyListeners;for(let r=0;r0&&e.jitter<=1?e.jitter:0,this.attempts=0}Ip.prototype.duration=function(){var e=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var t=Math.random(),n=Math.floor(t*this.jitter*e);e=Math.floor(t*10)&1?e+n:e-n}return Math.min(e,this.max)|0};Ip.prototype.reset=function(){this.attempts=0};Ip.prototype.setMin=function(e){this.ms=e};Ip.prototype.setMax=function(e){this.max=e};Ip.prototype.setJitter=function(e){this.jitter=e};class L4 extends Lr{constructor(t,n){var r;super(),this.nsps={},this.subs=[],t&&typeof t=="object"&&(n=t,t=void 0),n=n||{},n.path=n.path||"/socket.io",this.opts=n,pw(this,n),this.reconnection(n.reconnection!==!1),this.reconnectionAttempts(n.reconnectionAttempts||1/0),this.reconnectionDelay(n.reconnectionDelay||1e3),this.reconnectionDelayMax(n.reconnectionDelayMax||5e3),this.randomizationFactor((r=n.randomizationFactor)!==null&&r!==void 0?r:.5),this.backoff=new Ip({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(n.timeout==null?2e4:n.timeout),this._readyState="closed",this.uri=t;const i=n.parser||IBe;this.encoder=new i.Encoder,this.decoder=new i.Decoder,this._autoConnect=n.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(t){return arguments.length?(this._reconnection=!!t,this):this._reconnection}reconnectionAttempts(t){return t===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=t,this)}reconnectionDelay(t){var n;return t===void 0?this._reconnectionDelay:(this._reconnectionDelay=t,(n=this.backoff)===null||n===void 0||n.setMin(t),this)}randomizationFactor(t){var n;return t===void 0?this._randomizationFactor:(this._randomizationFactor=t,(n=this.backoff)===null||n===void 0||n.setJitter(t),this)}reconnectionDelayMax(t){var n;return t===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=t,(n=this.backoff)===null||n===void 0||n.setMax(t),this)}timeout(t){return arguments.length?(this._timeout=t,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(t){if(~this._readyState.indexOf("open"))return this;this.engine=new pK(this.uri,this.opts);const n=this.engine,r=this;this._readyState="opening",this.skipReconnect=!1;const i=Ga(n,"open",function(){r.onopen(),t&&t()}),o=s=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",s),t?t(s):this.maybeReconnectOnOpen()},a=Ga(n,"error",o);if(this._timeout!==!1){const s=this._timeout,l=this.setTimeoutFn(()=>{i(),o(new Error("timeout")),n.close()},s);this.opts.autoUnref&&l.unref(),this.subs.push(()=>{this.clearTimeoutFn(l)})}return this.subs.push(i),this.subs.push(a),this}connect(t){return this.open(t)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const t=this.engine;this.subs.push(Ga(t,"ping",this.onping.bind(this)),Ga(t,"data",this.ondata.bind(this)),Ga(t,"error",this.onerror.bind(this)),Ga(t,"close",this.onclose.bind(this)),Ga(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(t){try{this.decoder.add(t)}catch(n){this.onclose("parse error",n)}}ondecoded(t){AP(()=>{this.emitReserved("packet",t)},this.setTimeoutFn)}onerror(t){this.emitReserved("error",t)}socket(t,n){let r=this.nsps[t];return r?this._autoConnect&&!r.active&&r.connect():(r=new mK(this,t,n),this.nsps[t]=r),r}_destroy(t){const n=Object.keys(this.nsps);for(const r of n)if(this.nsps[r].active)return;this._close()}_packet(t){const n=this.encoder.encode(t);for(let r=0;rt()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close"),this.engine&&this.engine.close()}disconnect(){return this._close()}onclose(t,n){this.cleanup(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",t,n),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const t=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const n=this.backoff.duration();this._reconnecting=!0;const r=this.setTimeoutFn(()=>{t.skipReconnect||(this.emitReserved("reconnect_attempt",t.backoff.attempts),!t.skipReconnect&&t.open(i=>{i?(t._reconnecting=!1,t.reconnect(),this.emitReserved("reconnect_error",i)):t.onreconnect()}))},n);this.opts.autoUnref&&r.unref(),this.subs.push(()=>{this.clearTimeoutFn(r)})}}onreconnect(){const t=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",t)}}const dg={};function ub(e,t){typeof e=="object"&&(t=e,e=void 0),t=t||{};const n=bBe(e,t.path||"/socket.io"),r=n.source,i=n.id,o=n.path,a=dg[i]&&o in dg[i].nsps,s=t.forceNew||t["force new connection"]||t.multiplex===!1||a;let l;return s?l=new L4(r,t):(dg[i]||(dg[i]=new L4(r,t)),l=dg[i]),n.query&&!t.query&&(t.query=n.queryKey),l.socket(n.path,t)}Object.assign(ub,{Manager:L4,Socket:mK,io:ub,connect:ub});const mN=()=>{let e=!1,n=`${window.location.protocol==="https:"?"wss":"ws"}://${window.location.host}`;const r={timeout:6e4,path:"/ws/socket.io",autoConnect:!1};if(["nodes","package"].includes("production")){const a=o0.get();a&&(n=a.replace(/^https?\:\/\//i,""));const s=Jh.get();s&&(r.auth={token:s}),r.transports=["websocket","polling"]}const i=ub(n,r);return a=>s=>l=>{e||(UFe({storeApi:a,socket:i}),e=!0,i.connect()),s(l)}},OBe=""+new URL("logo-13003d72.png",import.meta.url).href,MBe=()=>W.jsxs(CP,{position:"relative",width:"100vw",height:"100vh",alignItems:"center",justifyContent:"center",bg:"#151519",children:[W.jsx(wP,{src:OBe,w:"8rem",h:"8rem"}),W.jsx(_P,{label:"Loading",color:"grey",position:"absolute",size:"sm",width:"24px !important",height:"24px !important",right:"1.5rem",bottom:"1.5rem"})]}),NBe=I.memo(MBe);function F4(e){"@babel/helpers - typeof";return F4=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},F4(e)}var yK=[],$Be=yK.forEach,DBe=yK.slice;function B4(e){return $Be.call(DBe.call(arguments,1),function(t){if(t)for(var n in t)e[n]===void 0&&(e[n]=t[n])}),e}function vK(){return typeof XMLHttpRequest=="function"||(typeof XMLHttpRequest>"u"?"undefined":F4(XMLHttpRequest))==="object"}function LBe(e){return!!e&&typeof e.then=="function"}function FBe(e){return LBe(e)?e:Promise.resolve(e)}function BBe(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var z4={exports:{}},m1={exports:{}},yN;function zBe(){return yN||(yN=1,function(e,t){var n=typeof self<"u"?self:mt,r=function(){function o(){this.fetch=!1,this.DOMException=n.DOMException}return o.prototype=n,new o}();(function(o){(function(a){var s={searchParams:"URLSearchParams"in o,iterable:"Symbol"in o&&"iterator"in Symbol,blob:"FileReader"in o&&"Blob"in o&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in o,arrayBuffer:"ArrayBuffer"in o};function l(E){return E&&DataView.prototype.isPrototypeOf(E)}if(s.arrayBuffer)var u=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],c=ArrayBuffer.isView||function(E){return E&&u.indexOf(Object.prototype.toString.call(E))>-1};function d(E){if(typeof E!="string"&&(E=String(E)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(E))throw new TypeError("Invalid character in header field name");return E.toLowerCase()}function f(E){return typeof E!="string"&&(E=String(E)),E}function h(E){var A={next:function(){var D=E.shift();return{done:D===void 0,value:D}}};return s.iterable&&(A[Symbol.iterator]=function(){return A}),A}function p(E){this.map={},E instanceof p?E.forEach(function(A,D){this.append(D,A)},this):Array.isArray(E)?E.forEach(function(A){this.append(A[0],A[1])},this):E&&Object.getOwnPropertyNames(E).forEach(function(A){this.append(A,E[A])},this)}p.prototype.append=function(E,A){E=d(E),A=f(A);var D=this.map[E];this.map[E]=D?D+", "+A:A},p.prototype.delete=function(E){delete this.map[d(E)]},p.prototype.get=function(E){return E=d(E),this.has(E)?this.map[E]:null},p.prototype.has=function(E){return this.map.hasOwnProperty(d(E))},p.prototype.set=function(E,A){this.map[d(E)]=f(A)},p.prototype.forEach=function(E,A){for(var D in this.map)this.map.hasOwnProperty(D)&&E.call(A,this.map[D],D,this)},p.prototype.keys=function(){var E=[];return this.forEach(function(A,D){E.push(D)}),h(E)},p.prototype.values=function(){var E=[];return this.forEach(function(A){E.push(A)}),h(E)},p.prototype.entries=function(){var E=[];return this.forEach(function(A,D){E.push([D,A])}),h(E)},s.iterable&&(p.prototype[Symbol.iterator]=p.prototype.entries);function m(E){if(E.bodyUsed)return Promise.reject(new TypeError("Already read"));E.bodyUsed=!0}function _(E){return new Promise(function(A,D){E.onload=function(){A(E.result)},E.onerror=function(){D(E.error)}})}function b(E){var A=new FileReader,D=_(A);return A.readAsArrayBuffer(E),D}function v(E){var A=new FileReader,D=_(A);return A.readAsText(E),D}function g(E){for(var A=new Uint8Array(E),D=new Array(A.length),L=0;L-1?A:E}function C(E,A){A=A||{};var D=A.body;if(E instanceof C){if(E.bodyUsed)throw new TypeError("Already read");this.url=E.url,this.credentials=E.credentials,A.headers||(this.headers=new p(E.headers)),this.method=E.method,this.mode=E.mode,this.signal=E.signal,!D&&E._bodyInit!=null&&(D=E._bodyInit,E.bodyUsed=!0)}else this.url=String(E);if(this.credentials=A.credentials||this.credentials||"same-origin",(A.headers||!this.headers)&&(this.headers=new p(A.headers)),this.method=x(A.method||this.method||"GET"),this.mode=A.mode||this.mode||null,this.signal=A.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&D)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(D)}C.prototype.clone=function(){return new C(this,{body:this._bodyInit})};function T(E){var A=new FormData;return E.trim().split("&").forEach(function(D){if(D){var L=D.split("="),M=L.shift().replace(/\+/g," "),R=L.join("=").replace(/\+/g," ");A.append(decodeURIComponent(M),decodeURIComponent(R))}}),A}function k(E){var A=new p,D=E.replace(/\r?\n[\t ]+/g," ");return D.split(/\r?\n/).forEach(function(L){var M=L.split(":"),R=M.shift().trim();if(R){var N=M.join(":").trim();A.append(R,N)}}),A}S.call(C.prototype);function P(E,A){A||(A={}),this.type="default",this.status=A.status===void 0?200:A.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in A?A.statusText:"OK",this.headers=new p(A.headers),this.url=A.url||"",this._initBody(E)}S.call(P.prototype),P.prototype.clone=function(){return new P(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new p(this.headers),url:this.url})},P.error=function(){var E=new P(null,{status:0,statusText:""});return E.type="error",E};var $=[301,302,303,307,308];P.redirect=function(E,A){if($.indexOf(A)===-1)throw new RangeError("Invalid status code");return new P(null,{status:A,headers:{location:E}})},a.DOMException=o.DOMException;try{new a.DOMException}catch{a.DOMException=function(A,D){this.message=A,this.name=D;var L=Error(A);this.stack=L.stack},a.DOMException.prototype=Object.create(Error.prototype),a.DOMException.prototype.constructor=a.DOMException}function O(E,A){return new Promise(function(D,L){var M=new C(E,A);if(M.signal&&M.signal.aborted)return L(new a.DOMException("Aborted","AbortError"));var R=new XMLHttpRequest;function N(){R.abort()}R.onload=function(){var B={status:R.status,statusText:R.statusText,headers:k(R.getAllResponseHeaders()||"")};B.url="responseURL"in R?R.responseURL:B.headers.get("X-Request-URL");var U="response"in R?R.response:R.responseText;D(new P(U,B))},R.onerror=function(){L(new TypeError("Network request failed"))},R.ontimeout=function(){L(new TypeError("Network request failed"))},R.onabort=function(){L(new a.DOMException("Aborted","AbortError"))},R.open(M.method,M.url,!0),M.credentials==="include"?R.withCredentials=!0:M.credentials==="omit"&&(R.withCredentials=!1),"responseType"in R&&s.blob&&(R.responseType="blob"),M.headers.forEach(function(B,U){R.setRequestHeader(U,B)}),M.signal&&(M.signal.addEventListener("abort",N),R.onreadystatechange=function(){R.readyState===4&&M.signal.removeEventListener("abort",N)}),R.send(typeof M._bodyInit>"u"?null:M._bodyInit)})}return O.polyfill=!0,o.fetch||(o.fetch=O,o.Headers=p,o.Request=C,o.Response=P),a.Headers=p,a.Request=C,a.Response=P,a.fetch=O,Object.defineProperty(a,"__esModule",{value:!0}),a})({})})(r),r.fetch.ponyfill=!0,delete r.fetch.polyfill;var i=r;t=i.fetch,t.default=i.fetch,t.fetch=i.fetch,t.Headers=i.Headers,t.Request=i.Request,t.Response=i.Response,e.exports=t}(m1,m1.exports)),m1.exports}(function(e,t){var n;if(typeof fetch=="function"&&(typeof mt<"u"&&mt.fetch?n=mt.fetch:typeof window<"u"&&window.fetch?n=window.fetch:n=fetch),typeof BBe<"u"&&(typeof window>"u"||typeof window.document>"u")){var r=n||zBe();r.default&&(r=r.default),t.default=r,e.exports=t.default}})(z4,z4.exports);var bK=z4.exports;const _K=pc(bK),vN=BN({__proto__:null,default:_K},[bK]);function iS(e){"@babel/helpers - typeof";return iS=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},iS(e)}var Bl;typeof fetch=="function"&&(typeof global<"u"&&global.fetch?Bl=global.fetch:typeof window<"u"&&window.fetch?Bl=window.fetch:Bl=fetch);var O0;vK()&&(typeof global<"u"&&global.XMLHttpRequest?O0=global.XMLHttpRequest:typeof window<"u"&&window.XMLHttpRequest&&(O0=window.XMLHttpRequest));var oS;typeof ActiveXObject=="function"&&(typeof global<"u"&&global.ActiveXObject?oS=global.ActiveXObject:typeof window<"u"&&window.ActiveXObject&&(oS=window.ActiveXObject));!Bl&&vN&&!O0&&!oS&&(Bl=_K||vN);typeof Bl!="function"&&(Bl=void 0);var j4=function(t,n){if(n&&iS(n)==="object"){var r="";for(var i in n)r+="&"+encodeURIComponent(i)+"="+encodeURIComponent(n[i]);if(!r)return t;t=t+(t.indexOf("?")!==-1?"&":"?")+r.slice(1)}return t},bN=function(t,n,r){Bl(t,n).then(function(i){if(!i.ok)return r(i.statusText||"Error",{status:i.status});i.text().then(function(o){r(null,{status:i.status,data:o})}).catch(r)}).catch(r)},_N=!1,jBe=function(t,n,r,i){t.queryStringParams&&(n=j4(n,t.queryStringParams));var o=B4({},typeof t.customHeaders=="function"?t.customHeaders():t.customHeaders);r&&(o["Content-Type"]="application/json");var a=typeof t.requestOptions=="function"?t.requestOptions(r):t.requestOptions,s=B4({method:r?"POST":"GET",body:r?t.stringify(r):void 0,headers:o},_N?{}:a);try{bN(n,s,i)}catch(l){if(!a||Object.keys(a).length===0||!l.message||l.message.indexOf("not implemented")<0)return i(l);try{Object.keys(a).forEach(function(u){delete s[u]}),bN(n,s,i),_N=!0}catch(u){i(u)}}},UBe=function(t,n,r,i){r&&iS(r)==="object"&&(r=j4("",r).slice(1)),t.queryStringParams&&(n=j4(n,t.queryStringParams));try{var o;O0?o=new O0:o=new oS("MSXML2.XMLHTTP.3.0"),o.open(r?"POST":"GET",n,1),t.crossDomain||o.setRequestHeader("X-Requested-With","XMLHttpRequest"),o.withCredentials=!!t.withCredentials,r&&o.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),o.overrideMimeType&&o.overrideMimeType("application/json");var a=t.customHeaders;if(a=typeof a=="function"?a():a,a)for(var s in a)o.setRequestHeader(s,a[s]);o.onreadystatechange=function(){o.readyState>3&&i(o.status>=400?o.statusText:null,{status:o.status,data:o.responseText})},o.send(r)}catch(l){console&&console.log(l)}},VBe=function(t,n,r,i){if(typeof r=="function"&&(i=r,r=void 0),i=i||function(){},Bl&&n.indexOf("file:")!==0)return jBe(t,n,r,i);if(vK()||typeof ActiveXObject=="function")return UBe(t,n,r,i);i(new Error("No fetch and no xhr implementation found!"))};function M0(e){"@babel/helpers - typeof";return M0=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},M0(e)}function GBe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function SN(e,t){for(var n=0;n1&&arguments[1]!==void 0?arguments[1]:{},r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};GBe(this,e),this.services=t,this.options=n,this.allOptions=r,this.type="backend",this.init(t,n,r)}return HBe(e,[{key:"init",value:function(n){var r=this,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};this.services=n,this.options=B4(i,this.options||{},KBe()),this.allOptions=o,this.services&&this.options.reloadInterval&&setInterval(function(){return r.reload()},this.options.reloadInterval)}},{key:"readMulti",value:function(n,r,i){this._readAny(n,n,r,r,i)}},{key:"read",value:function(n,r,i){this._readAny([n],n,[r],r,i)}},{key:"_readAny",value:function(n,r,i,o,a){var s=this,l=this.options.loadPath;typeof this.options.loadPath=="function"&&(l=this.options.loadPath(n,i)),l=FBe(l),l.then(function(u){if(!u)return a(null,{});var c=s.services.interpolator.interpolate(u,{lng:n.join("+"),ns:i.join("+")});s.loadUrl(c,a,r,o)})}},{key:"loadUrl",value:function(n,r,i,o){var a=this,s=typeof i=="string"?[i]:i,l=typeof o=="string"?[o]:o,u=this.options.parseLoadPayload(s,l);this.options.request(this.options,n,u,function(c,d){if(d&&(d.status>=500&&d.status<600||!d.status))return r("failed loading "+n+"; status code: "+d.status,!0);if(d&&d.status>=400&&d.status<500)return r("failed loading "+n+"; status code: "+d.status,!1);if(!d&&c&&c.message&&c.message.indexOf("Failed to fetch")>-1)return r("failed loading "+n+": "+c.message,!0);if(c)return r(c,!1);var f,h;try{typeof d.data=="string"?f=a.options.parse(d.data,i,o):f=d.data}catch{h="failed parsing "+n+" to json"}if(h)return r(h,!1);r(null,f)})}},{key:"create",value:function(n,r,i,o,a){var s=this;if(this.options.addPath){typeof n=="string"&&(n=[n]);var l=this.options.parsePayload(r,i,o),u=0,c=[],d=[];n.forEach(function(f){var h=s.options.addPath;typeof s.options.addPath=="function"&&(h=s.options.addPath(f,r));var p=s.services.interpolator.interpolate(h,{lng:f,ns:r});s.options.request(s.options,p,l,function(m,_){u+=1,c.push(m),d.push(_),u===n.length&&typeof a=="function"&&a(c,d)})})}}},{key:"reload",value:function(){var n=this,r=this.services,i=r.backendConnector,o=r.languageUtils,a=r.logger,s=i.language;if(!(s&&s.toLowerCase()==="cimode")){var l=[],u=function(d){var f=o.toResolveHierarchy(d);f.forEach(function(h){l.indexOf(h)<0&&l.push(h)})};u(s),this.allOptions.preload&&this.allOptions.preload.forEach(function(c){return u(c)}),l.forEach(function(c){n.allOptions.ns.forEach(function(d){i.read(c,d,"read",null,null,function(f,h){f&&a.warn("loading namespace ".concat(d," for language ").concat(c," failed"),f),!f&&h&&a.log("loaded namespace ".concat(d," for language ").concat(c),h),i.loaded("".concat(c,"|").concat(d),f,h)})})})}}}]),e}();xK.type="backend";be.use(xK).use(Ake).init({fallbackLng:"en",debug:!1,backend:{loadPath:"/locales/{{lng}}.json"},interpolation:{escapeValue:!1},returnNull:!1});const gw=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Rp(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function RP(e){return"nodeType"in e}function uo(e){var t,n;return e?Rp(e)?e:RP(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function OP(e){const{Document:t}=uo(e);return e instanceof t}function By(e){return Rp(e)?!1:e instanceof uo(e).HTMLElement}function QBe(e){return e instanceof uo(e).SVGElement}function Op(e){return e?Rp(e)?e.document:RP(e)?OP(e)?e:By(e)?e.ownerDocument:document:document:document}const Zs=gw?I.useLayoutEffect:I.useEffect;function mw(e){const t=I.useRef(e);return Zs(()=>{t.current=e}),I.useCallback(function(){for(var n=arguments.length,r=new Array(n),i=0;i{e.current=setInterval(r,i)},[]),n=I.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,n]}function N0(e,t){t===void 0&&(t=[e]);const n=I.useRef(e);return Zs(()=>{n.current!==e&&(n.current=e)},t),n}function zy(e,t){const n=I.useRef();return I.useMemo(()=>{const r=e(n.current);return n.current=r,r},[...t])}function aS(e){const t=mw(e),n=I.useRef(null),r=I.useCallback(i=>{i!==n.current&&(t==null||t(i,n.current)),n.current=i},[]);return[n,r]}function sS(e){const t=I.useRef();return I.useEffect(()=>{t.current=e},[e]),t.current}let F5={};function yw(e,t){return I.useMemo(()=>{if(t)return t;const n=F5[e]==null?0:F5[e]+1;return F5[e]=n,e+"-"+n},[e,t])}function wK(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i{const s=Object.entries(a);for(const[l,u]of s){const c=o[l];c!=null&&(o[l]=c+e*u)}return o},{...t})}}const Th=wK(1),lS=wK(-1);function YBe(e){return"clientX"in e&&"clientY"in e}function MP(e){if(!e)return!1;const{KeyboardEvent:t}=uo(e.target);return t&&e instanceof t}function ZBe(e){if(!e)return!1;const{TouchEvent:t}=uo(e.target);return t&&e instanceof t}function $0(e){if(ZBe(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return YBe(e)?{x:e.clientX,y:e.clientY}:null}const D0=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:n}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:n}=e;return"scaleX("+t+") scaleY("+n+")"}},Transform:{toString(e){if(e)return[D0.Translate.toString(e),D0.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+" "+n+"ms "+r}}}),xN="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function JBe(e){return e.matches(xN)?e:e.querySelector(xN)}const eze={display:"none"};function tze(e){let{id:t,value:n}=e;return En.createElement("div",{id:t,style:eze},n)}const nze={position:"fixed",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};function rze(e){let{id:t,announcement:n}=e;return En.createElement("div",{id:t,style:nze,role:"status","aria-live":"assertive","aria-atomic":!0},n)}function ize(){const[e,t]=I.useState("");return{announce:I.useCallback(r=>{r!=null&&t(r)},[]),announcement:e}}const CK=I.createContext(null);function oze(e){const t=I.useContext(CK);I.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of ");return t(e)},[e,t])}function aze(){const[e]=I.useState(()=>new Set),t=I.useCallback(r=>(e.add(r),()=>e.delete(r)),[e]);return[I.useCallback(r=>{let{type:i,event:o}=r;e.forEach(a=>{var s;return(s=a[i])==null?void 0:s.call(a,o)})},[e]),t]}const sze={draggable:` + var(--invokeai-colors-base-800) 100%)`}}},p:2}),PFe={variants:{invokeAI:AFe},defaultProps:{size:"md",variant:"invokeAI"}},IFe=fr("popper-arrow-bg"),RFe=e=>({borderRadius:"base",shadow:"dark-lg",bg:K("base.700","base.200")(e),[IFe.variable]:K("colors.base.700","colors.base.200")(e),pb:1.5}),OFe={baseStyle:RFe},iN={backgroundColor:"accentAlpha.150 !important",borderColor:"accentAlpha.700 !important",borderRadius:"base !important",borderStyle:"dashed !important",_dark:{borderColor:"accent.400 !important"}},MFe={".react-flow__nodesselection-rect":{...iN,padding:"1rem !important",boxSizing:"content-box !important",transform:"translate(-1rem, -1rem) !important"},".react-flow__selection":iN},NFe={config:{cssVarPrefix:"invokeai",initialColorMode:"dark",useSystemColorMode:!1},layerStyles:{body:{bg:"base.50",color:"base.900",".chakra-ui-dark &":{bg:"base.900",color:"base.50"}},first:{bg:"base.100",color:"base.900",".chakra-ui-dark &":{bg:"base.850",color:"base.100"}},second:{bg:"base.200",color:"base.900",".chakra-ui-dark &":{bg:"base.800",color:"base.100"}},third:{bg:"base.300",color:"base.900",".chakra-ui-dark &":{bg:"base.750",color:"base.100"}},nodeBody:{bg:"base.100",color:"base.900",".chakra-ui-dark &":{bg:"base.800",color:"base.100"}},nodeHeader:{bg:"base.200",color:"base.900",".chakra-ui-dark &":{bg:"base.900",color:"base.100"}},nodeFooter:{bg:"base.200",color:"base.900",".chakra-ui-dark &":{bg:"base.900",color:"base.100"}}},styles:{global:()=>({layerStyle:"body","*":{...QLe},...MFe})},direction:"ltr",fonts:{body:"'Inter Variable', sans-serif",heading:"'Inter Variable', sans-serif"},shadows:{light:{accent:"0 0 10px 0 var(--invokeai-colors-accent-300)",accentHover:"0 0 10px 0 var(--invokeai-colors-accent-400)",ok:"0 0 7px var(--invokeai-colors-ok-600)",working:"0 0 7px var(--invokeai-colors-working-600)",error:"0 0 7px var(--invokeai-colors-error-600)"},dark:{accent:"0 0 10px 0 var(--invokeai-colors-accent-600)",accentHover:"0 0 10px 0 var(--invokeai-colors-accent-500)",ok:"0 0 7px var(--invokeai-colors-ok-400)",working:"0 0 7px var(--invokeai-colors-working-400)",error:"0 0 7px var(--invokeai-colors-error-400)"},selected:{light:"0px 0px 0px 1px var(--invokeai-colors-base-150), 0px 0px 0px 4px var(--invokeai-colors-accent-400)",dark:"0px 0px 0px 1px var(--invokeai-colors-base-900), 0px 0px 0px 4px var(--invokeai-colors-accent-500)"},hoverSelected:{light:"0px 0px 0px 1px var(--invokeai-colors-base-150), 0px 0px 0px 4px var(--invokeai-colors-accent-500)",dark:"0px 0px 0px 1px var(--invokeai-colors-base-900), 0px 0px 0px 4px var(--invokeai-colors-accent-400)"},hoverUnselected:{light:"0px 0px 0px 1px var(--invokeai-colors-base-150), 0px 0px 0px 3px var(--invokeai-colors-accent-500)",dark:"0px 0px 0px 1px var(--invokeai-colors-base-900), 0px 0px 0px 3px var(--invokeai-colors-accent-400)"},nodeSelected:{light:"0 0 0 3px var(--invokeai-colors-accent-400)",dark:"0 0 0 3px var(--invokeai-colors-accent-500)"},nodeHovered:{light:"0 0 0 2px var(--invokeai-colors-accent-500)",dark:"0 0 0 2px var(--invokeai-colors-accent-400)"},nodeHoveredSelected:{light:"0 0 0 3px var(--invokeai-colors-accent-500)",dark:"0 0 0 3px var(--invokeai-colors-accent-400)"},nodeInProgress:{light:"0 0 0 2px var(--invokeai-colors-accent-500), 0 0 10px 2px var(--invokeai-colors-accent-600)",dark:"0 0 0 2px var(--invokeai-colors-yellow-400), 0 0 20px 2px var(--invokeai-colors-orange-700)"}},colors:FDe,components:{Button:QDe,Input:hLe,Editable:sLe,Textarea:PFe,Tabs:EFe,Progress:KLe,Accordion:qDe,FormLabel:uLe,Switch:yFe,NumberInput:DLe,Select:tFe,Skeleton:rFe,Slider:dFe,Popover:ULe,Modal:ALe,Checkbox:eLe,Menu:yLe,Text:TFe,Tooltip:OFe}},$Fe={defaultOptions:{isClosable:!0}},{toast:ug}=ODe({theme:NFe,defaultOptions:$Fe.defaultOptions}),DFe=()=>{Be({matcher:Qr.endpoints.enqueueBatch.matchFulfilled,effect:async e=>{const t=e.payload,n=e.meta.arg.originalArgs;Ce("queue").debug({enqueueResult:Qt(t)},"Batch enqueued"),ug.isActive("batch-queued")||ug({id:"batch-queued",title:Z("queue.batchQueued"),description:Z("queue.batchQueuedDesc",{item_count:t.enqueued,direction:n.prepend?Z("queue.front"):Z("queue.back")}),duration:1e3,status:"success"})}}),Be({matcher:Qr.endpoints.enqueueBatch.matchRejected,effect:async e=>{const t=e.payload,n=e.meta.arg.originalArgs;if(!t){ug({title:Z("queue.batchFailedToQueue"),status:"error",description:"Unknown Error"}),Ce("queue").error({batchConfig:Qt(n),error:Qt(t)},Z("queue.batchFailedToQueue"));return}const r=LDe.safeParse(t);if(r.success)r.data.data.detail.map(i=>{ug({id:"batch-failed-to-queue",title:W8(yF(i.msg),{length:128}),status:"error",description:W8(`Path: + ${i.loc.join(".")}`,{length:128})})});else{let i="Unknown Error",o;t.status===403&&"body"in t?i=uh(t,"body.detail","Unknown Error"):t.status===403&&"error"in t?i=uh(t,"error.detail","Unknown Error"):t.status===403&&"data"in t&&(i=uh(t,"data.detail","Unknown Error"),o=15e3),ug({title:Z("queue.batchFailedToQueue"),status:"error",description:i,...o?{duration:o}:{}})}Ce("queue").error({batchConfig:Qt(n),error:Qt(t)},Z("queue.batchFailedToQueue"))}})},ZW=FL(),Be=ZW.startListening;DEe();LEe();UEe();TEe();AEe();PEe();IEe();REe();wxe();$Ee();FEe();BEe();cEe();CEe();gEe();vxe();DFe();G3e();z3e();Bxe();j3e();Fxe();Dxe();V3e();dke();gxe();J4e();eke();nke();rke();oke();Y4e();Z4e();uke();cke();ake();lke();ike();ske();K3e();q3e();EEe();kEe();MEe();NEe();Cxe();X4e();Vke();OEe();VEe();Sxe();HEe();bxe();mxe();Dke();hke();KEe();const LFe={canvas:dle,gallery:_0e,generation:Jse,nodes:t2e,postprocessing:n2e,system:u2e,config:Rae,ui:v2e,hotkeys:y2e,controlNet:u0e,dynamicPrompts:b0e,deleteImageModal:f0e,changeBoardModal:hle,lora:w0e,modelmanager:m2e,sdxl:i2e,queue:p2e,[ls.reducerPath]:ls.reducer},FFe=hp(LFe),BFe=V2e(FFe),zFe=["canvas","gallery","generation","sdxl","nodes","postprocessing","system","ui","controlNet","dynamicPrompts","lora","modelmanager"],JW=vL({reducer:BFe,enhancers:e=>e.concat(G2e(window.localStorage,zFe,{persistDebounce:300,serialize:nxe,unserialize:ixe,prefix:H2e})).concat(zL()),middleware:e=>e({serializableCheck:!1,immutableCheck:!1}).concat(ls.middleware).concat(x2e).prepend(ZW.middleware),devTools:{actionSanitizer:cxe,stateSanitizer:fxe,trace:!0,predicate:(e,t)=>!dxe.includes(t.type)}}),eK=e=>e;PB.set(JW);const jFe=e=>{const{socket:t,storeApi:n}=e,{dispatch:r}=n;t.on("connect",()=>{Ce("socketio").debug("Connected"),r(Lj());const o=Ur.get();t.emit("subscribe_queue",{queue_id:o})}),t.on("connect_error",i=>{i&&i.message&&i.data==="ERR_UNAUTHENTICATED"&&r(Gt($d({title:i.message,status:"error",duration:1e4})))}),t.on("disconnect",()=>{r(Fj())}),t.on("invocation_started",i=>{r(zj({data:i}))}),t.on("generator_progress",i=>{r(Gj({data:i}))}),t.on("invocation_error",i=>{r(jj({data:i}))}),t.on("invocation_complete",i=>{r(jT({data:i}))}),t.on("graph_execution_state_complete",i=>{r(Uj({data:i}))}),t.on("model_load_started",i=>{r(Hj({data:i}))}),t.on("model_load_completed",i=>{r(Wj({data:i}))}),t.on("session_retrieval_error",i=>{r(Qj({data:i}))}),t.on("invocation_retrieval_error",i=>{r(Yj({data:i}))}),t.on("queue_item_status_changed",i=>{r(Jj({data:i}))})},Ys=Object.create(null);Ys.open="0";Ys.close="1";Ys.ping="2";Ys.pong="3";Ys.message="4";Ys.upgrade="5";Ys.noop="6";const ab=Object.create(null);Object.keys(Ys).forEach(e=>{ab[Ys[e]]=e});const R4={type:"error",data:"parser error"},tK=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",nK=typeof ArrayBuffer=="function",rK=e=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer,CP=({type:e,data:t},n,r)=>tK&&t instanceof Blob?n?r(t):oN(t,r):nK&&(t instanceof ArrayBuffer||rK(t))?n?r(t):oN(new Blob([t]),r):r(Ys[e]+(t||"")),oN=(e,t)=>{const n=new FileReader;return n.onload=function(){const r=n.result.split(",")[1];t("b"+(r||""))},n.readAsDataURL(e)};function aN(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}let D5;function UFe(e,t){if(tK&&e.data instanceof Blob)return e.data.arrayBuffer().then(aN).then(t);if(nK&&(e.data instanceof ArrayBuffer||rK(e.data)))return t(aN(e.data));CP(e,!1,n=>{D5||(D5=new TextEncoder),t(D5.encode(n))})}const sN="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Ig=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let e=0;e{let t=e.length*.75,n=e.length,r,i=0,o,a,s,l;e[e.length-1]==="="&&(t--,e[e.length-2]==="="&&t--);const u=new ArrayBuffer(t),c=new Uint8Array(u);for(r=0;r>4,c[i++]=(a&15)<<4|s>>2,c[i++]=(s&3)<<6|l&63;return u},GFe=typeof ArrayBuffer=="function",EP=(e,t)=>{if(typeof e!="string")return{type:"message",data:iK(e,t)};const n=e.charAt(0);return n==="b"?{type:"message",data:HFe(e.substring(1),t)}:ab[n]?e.length>1?{type:ab[n],data:e.substring(1)}:{type:ab[n]}:R4},HFe=(e,t)=>{if(GFe){const n=VFe(e);return iK(n,t)}else return{base64:!0,data:e}},iK=(e,t)=>{switch(t){case"blob":return e instanceof Blob?e:new Blob([e]);case"arraybuffer":default:return e instanceof ArrayBuffer?e:e.buffer}},oK=String.fromCharCode(30),qFe=(e,t)=>{const n=e.length,r=new Array(n);let i=0;e.forEach((o,a)=>{CP(o,!1,s=>{r[a]=s,++i===n&&t(r.join(oK))})})},WFe=(e,t)=>{const n=e.split(oK),r=[];for(let i=0;i{const r=n.length;let i;if(r<126)i=new Uint8Array(1),new DataView(i.buffer).setUint8(0,r);else if(r<65536){i=new Uint8Array(3);const o=new DataView(i.buffer);o.setUint8(0,126),o.setUint16(1,r)}else{i=new Uint8Array(9);const o=new DataView(i.buffer);o.setUint8(0,127),o.setBigUint64(1,BigInt(r))}e.data&&typeof e.data!="string"&&(i[0]|=128),t.enqueue(i),t.enqueue(n)})}})}let L5;function f1(e){return e.reduce((t,n)=>t+n.length,0)}function h1(e,t){if(e[0].length===t)return e.shift();const n=new Uint8Array(t);let r=0;for(let i=0;iMath.pow(2,53-32)-1){s.enqueue(R4);break}i=c*Math.pow(2,32)+u.getUint32(4),r=3}else{if(f1(n)e){s.enqueue(R4);break}}}})}const aK=4;function Lr(e){if(e)return XFe(e)}function XFe(e){for(var t in Lr.prototype)e[t]=Lr.prototype[t];return e}Lr.prototype.on=Lr.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this};Lr.prototype.once=function(e,t){function n(){this.off(e,n),t.apply(this,arguments)}return n.fn=t,this.on(e,n),this};Lr.prototype.off=Lr.prototype.removeListener=Lr.prototype.removeAllListeners=Lr.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var n=this._callbacks["$"+e];if(!n)return this;if(arguments.length==1)return delete this._callbacks["$"+e],this;for(var r,i=0;itypeof self<"u"?self:typeof window<"u"?window:Function("return this")())();function sK(e,...t){return t.reduce((n,r)=>(e.hasOwnProperty(r)&&(n[r]=e[r]),n),{})}const YFe=ma.setTimeout,ZFe=ma.clearTimeout;function pw(e,t){t.useNativeTimers?(e.setTimeoutFn=YFe.bind(ma),e.clearTimeoutFn=ZFe.bind(ma)):(e.setTimeoutFn=ma.setTimeout.bind(ma),e.clearTimeoutFn=ma.clearTimeout.bind(ma))}const JFe=1.33;function eBe(e){return typeof e=="string"?tBe(e):Math.ceil((e.byteLength||e.size)*JFe)}function tBe(e){let t=0,n=0;for(let r=0,i=e.length;r=57344?n+=3:(r++,n+=4);return n}function nBe(e){let t="";for(let n in e)e.hasOwnProperty(n)&&(t.length&&(t+="&"),t+=encodeURIComponent(n)+"="+encodeURIComponent(e[n]));return t}function rBe(e){let t={},n=e.split("&");for(let r=0,i=n.length;r0);return t}function uK(){const e=cN(+new Date);return e!==uN?(lN=0,uN=e):e+"."+cN(lN++)}for(;p1{this.readyState="paused",t()};if(this.polling||!this.writable){let r=0;this.polling&&(r++,this.once("pollComplete",function(){--r||n()})),this.writable||(r++,this.once("drain",function(){--r||n()}))}else n()}poll(){this.polling=!0,this.doPoll(),this.emitReserved("poll")}onData(t){const n=r=>{if(this.readyState==="opening"&&r.type==="open"&&this.onOpen(),r.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(r)};WFe(t,this.socket.binaryType).forEach(n),this.readyState!=="closed"&&(this.polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this.poll())}doClose(){const t=()=>{this.write([{type:"close"}])};this.readyState==="open"?t():this.once("open",t)}write(t){this.writable=!1,qFe(t,n=>{this.doWrite(n,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const t=this.opts.secure?"https":"http",n=this.query||{};return this.opts.timestampRequests!==!1&&(n[this.opts.timestampParam]=uK()),!this.supportsBinary&&!n.sid&&(n.b64=1),this.createUri(t,n)}request(t={}){return Object.assign(t,{xd:this.xd,cookieJar:this.cookieJar},this.opts),new Eh(this.uri(),t)}doWrite(t,n){const r=this.request({method:"POST",data:t});r.on("success",n),r.on("error",(i,o)=>{this.onError("xhr post error",i,o)})}doPoll(){const t=this.request();t.on("data",this.onData.bind(this)),t.on("error",(n,r)=>{this.onError("xhr poll error",n,r)}),this.pollXhr=t}}let Eh=class sb extends Lr{constructor(t,n){super(),pw(this,n),this.opts=n,this.method=n.method||"GET",this.uri=t,this.data=n.data!==void 0?n.data:null,this.create()}create(){var t;const n=sK(this.opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");n.xdomain=!!this.opts.xd;const r=this.xhr=new dK(n);try{r.open(this.method,this.uri,!0);try{if(this.opts.extraHeaders){r.setDisableHeaderCheck&&r.setDisableHeaderCheck(!0);for(let i in this.opts.extraHeaders)this.opts.extraHeaders.hasOwnProperty(i)&&r.setRequestHeader(i,this.opts.extraHeaders[i])}}catch{}if(this.method==="POST")try{r.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{r.setRequestHeader("Accept","*/*")}catch{}(t=this.opts.cookieJar)===null||t===void 0||t.addCookies(r),"withCredentials"in r&&(r.withCredentials=this.opts.withCredentials),this.opts.requestTimeout&&(r.timeout=this.opts.requestTimeout),r.onreadystatechange=()=>{var i;r.readyState===3&&((i=this.opts.cookieJar)===null||i===void 0||i.parseCookies(r)),r.readyState===4&&(r.status===200||r.status===1223?this.onLoad():this.setTimeoutFn(()=>{this.onError(typeof r.status=="number"?r.status:0)},0))},r.send(this.data)}catch(i){this.setTimeoutFn(()=>{this.onError(i)},0);return}typeof document<"u"&&(this.index=sb.requestsCount++,sb.requests[this.index]=this)}onError(t){this.emitReserved("error",t,this.xhr),this.cleanup(!0)}cleanup(t){if(!(typeof this.xhr>"u"||this.xhr===null)){if(this.xhr.onreadystatechange=sBe,t)try{this.xhr.abort()}catch{}typeof document<"u"&&delete sb.requests[this.index],this.xhr=null}}onLoad(){const t=this.xhr.responseText;t!==null&&(this.emitReserved("data",t),this.emitReserved("success"),this.cleanup())}abort(){this.cleanup()}};Eh.requestsCount=0;Eh.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",dN);else if(typeof addEventListener=="function"){const e="onpagehide"in ma?"pagehide":"unload";addEventListener(e,dN,!1)}}function dN(){for(let e in Eh.requests)Eh.requests.hasOwnProperty(e)&&Eh.requests[e].abort()}const TP=(()=>typeof Promise=="function"&&typeof Promise.resolve=="function"?t=>Promise.resolve().then(t):(t,n)=>n(t,0))(),g1=ma.WebSocket||ma.MozWebSocket,fN=!0,cBe="arraybuffer",hN=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class dBe extends kP{constructor(t){super(t),this.supportsBinary=!t.forceBase64}get name(){return"websocket"}doOpen(){if(!this.check())return;const t=this.uri(),n=this.opts.protocols,r=hN?{}:sK(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(r.headers=this.opts.extraHeaders);try{this.ws=fN&&!hN?n?new g1(t,n):new g1(t):new g1(t,n,r)}catch(i){return this.emitReserved("error",i)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=t=>this.onClose({description:"websocket connection closed",context:t}),this.ws.onmessage=t=>this.onData(t.data),this.ws.onerror=t=>this.onError("websocket error",t)}write(t){this.writable=!1;for(let n=0;n{const a={};try{fN&&this.ws.send(o)}catch{}i&&TP(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.close(),this.ws=null)}uri(){const t=this.opts.secure?"wss":"ws",n=this.query||{};return this.opts.timestampRequests&&(n[this.opts.timestampParam]=uK()),this.supportsBinary||(n.b64=1),this.createUri(t,n)}check(){return!!g1}}class fBe extends kP{get name(){return"webtransport"}doOpen(){typeof WebTransport=="function"&&(this.transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name]),this.transport.closed.then(()=>{this.onClose()}).catch(t=>{this.onError("webtransport error",t)}),this.transport.ready.then(()=>{this.transport.createBidirectionalStream().then(t=>{const n=QFe(Number.MAX_SAFE_INTEGER,this.socket.binaryType),r=t.readable.pipeThrough(n).getReader(),i=KFe();i.readable.pipeTo(t.writable),this.writer=i.writable.getWriter();const o=()=>{r.read().then(({done:s,value:l})=>{s||(this.onPacket(l),o())}).catch(s=>{})};o();const a={type:"open"};this.query.sid&&(a.data=`{"sid":"${this.query.sid}"}`),this.writer.write(a).then(()=>this.onOpen())})}))}write(t){this.writable=!1;for(let n=0;n{i&&TP(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var t;(t=this.transport)===null||t===void 0||t.close()}}const hBe={websocket:dBe,webtransport:fBe,polling:uBe},pBe=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,gBe=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function M4(e){const t=e,n=e.indexOf("["),r=e.indexOf("]");n!=-1&&r!=-1&&(e=e.substring(0,n)+e.substring(n,r).replace(/:/g,";")+e.substring(r,e.length));let i=pBe.exec(e||""),o={},a=14;for(;a--;)o[gBe[a]]=i[a]||"";return n!=-1&&r!=-1&&(o.source=t,o.host=o.host.substring(1,o.host.length-1).replace(/;/g,":"),o.authority=o.authority.replace("[","").replace("]","").replace(/;/g,":"),o.ipv6uri=!0),o.pathNames=mBe(o,o.path),o.queryKey=yBe(o,o.query),o}function mBe(e,t){const n=/\/{2,9}/g,r=t.replace(n,"/").split("/");return(t.slice(0,1)=="/"||t.length===0)&&r.splice(0,1),t.slice(-1)=="/"&&r.splice(r.length-1,1),r}function yBe(e,t){const n={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(r,i,o){i&&(n[i]=o)}),n}let fK=class Tf extends Lr{constructor(t,n={}){super(),this.binaryType=cBe,this.writeBuffer=[],t&&typeof t=="object"&&(n=t,t=null),t?(t=M4(t),n.hostname=t.host,n.secure=t.protocol==="https"||t.protocol==="wss",n.port=t.port,t.query&&(n.query=t.query)):n.host&&(n.hostname=M4(n.host).host),pw(this,n),this.secure=n.secure!=null?n.secure:typeof location<"u"&&location.protocol==="https:",n.hostname&&!n.port&&(n.port=this.secure?"443":"80"),this.hostname=n.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=n.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=n.transports||["polling","websocket","webtransport"],this.writeBuffer=[],this.prevBufferLen=0,this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},n),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=rBe(this.opts.query)),this.id=null,this.upgrades=null,this.pingInterval=null,this.pingTimeout=null,this.pingTimeoutTimer=null,typeof addEventListener=="function"&&(this.opts.closeOnBeforeunload&&(this.beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this.beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this.offlineEventListener=()=>{this.onClose("transport close",{description:"network connection lost"})},addEventListener("offline",this.offlineEventListener,!1))),this.open()}createTransport(t){const n=Object.assign({},this.opts.query);n.EIO=aK,n.transport=t,this.id&&(n.sid=this.id);const r=Object.assign({},this.opts,{query:n,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[t]);return new hBe[t](r)}open(){let t;if(this.opts.rememberUpgrade&&Tf.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1)t="websocket";else if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}else t=this.transports[0];this.readyState="opening";try{t=this.createTransport(t)}catch{this.transports.shift(),this.open();return}t.open(),this.setTransport(t)}setTransport(t){this.transport&&this.transport.removeAllListeners(),this.transport=t,t.on("drain",this.onDrain.bind(this)).on("packet",this.onPacket.bind(this)).on("error",this.onError.bind(this)).on("close",n=>this.onClose("transport close",n))}probe(t){let n=this.createTransport(t),r=!1;Tf.priorWebsocketSuccess=!1;const i=()=>{r||(n.send([{type:"ping",data:"probe"}]),n.once("packet",d=>{if(!r)if(d.type==="pong"&&d.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",n),!n)return;Tf.priorWebsocketSuccess=n.name==="websocket",this.transport.pause(()=>{r||this.readyState!=="closed"&&(c(),this.setTransport(n),n.send([{type:"upgrade"}]),this.emitReserved("upgrade",n),n=null,this.upgrading=!1,this.flush())})}else{const f=new Error("probe error");f.transport=n.name,this.emitReserved("upgradeError",f)}}))};function o(){r||(r=!0,c(),n.close(),n=null)}const a=d=>{const f=new Error("probe error: "+d);f.transport=n.name,o(),this.emitReserved("upgradeError",f)};function s(){a("transport closed")}function l(){a("socket closed")}function u(d){n&&d.name!==n.name&&o()}const c=()=>{n.removeListener("open",i),n.removeListener("error",a),n.removeListener("close",s),this.off("close",l),this.off("upgrading",u)};n.once("open",i),n.once("error",a),n.once("close",s),this.once("close",l),this.once("upgrading",u),this.upgrades.indexOf("webtransport")!==-1&&t!=="webtransport"?this.setTimeoutFn(()=>{r||n.open()},200):n.open()}onOpen(){if(this.readyState="open",Tf.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush(),this.readyState==="open"&&this.opts.upgrade){let t=0;const n=this.upgrades.length;for(;t{this.onClose("ping timeout")},this.pingInterval+this.pingTimeout),this.opts.autoUnref&&this.pingTimeoutTimer.unref()}onDrain(){this.writeBuffer.splice(0,this.prevBufferLen),this.prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const t=this.getWritablePackets();this.transport.send(t),this.prevBufferLen=t.length,this.emitReserved("flush")}}getWritablePackets(){if(!(this.maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let n=1;for(let r=0;r0&&n>this.maxPayload)return this.writeBuffer.slice(0,r);n+=2}return this.writeBuffer}write(t,n,r){return this.sendPacket("message",t,n,r),this}send(t,n,r){return this.sendPacket("message",t,n,r),this}sendPacket(t,n,r,i){if(typeof n=="function"&&(i=n,n=void 0),typeof r=="function"&&(i=r,r=null),this.readyState==="closing"||this.readyState==="closed")return;r=r||{},r.compress=r.compress!==!1;const o={type:t,data:n,options:r};this.emitReserved("packetCreate",o),this.writeBuffer.push(o),i&&this.once("flush",i),this.flush()}close(){const t=()=>{this.onClose("forced close"),this.transport.close()},n=()=>{this.off("upgrade",n),this.off("upgradeError",n),t()},r=()=>{this.once("upgrade",n),this.once("upgradeError",n)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?r():t()}):this.upgrading?r():t()),this}onError(t){Tf.priorWebsocketSuccess=!1,this.emitReserved("error",t),this.onClose("transport error",t)}onClose(t,n){(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")&&(this.clearTimeoutFn(this.pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),typeof removeEventListener=="function"&&(removeEventListener("beforeunload",this.beforeunloadEventListener,!1),removeEventListener("offline",this.offlineEventListener,!1)),this.readyState="closed",this.id=null,this.emitReserved("close",t,n),this.writeBuffer=[],this.prevBufferLen=0)}filterUpgrades(t){const n=[];let r=0;const i=t.length;for(;rtypeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer,hK=Object.prototype.toString,SBe=typeof Blob=="function"||typeof Blob<"u"&&hK.call(Blob)==="[object BlobConstructor]",xBe=typeof File=="function"||typeof File<"u"&&hK.call(File)==="[object FileConstructor]";function AP(e){return bBe&&(e instanceof ArrayBuffer||_Be(e))||SBe&&e instanceof Blob||xBe&&e instanceof File}function lb(e,t){if(!e||typeof e!="object")return!1;if(Array.isArray(e)){for(let n=0,r=e.length;n=0&&e.num{delete this.acks[t];for(let a=0;a{this.io.clearTimeoutFn(o),n.apply(this,[null,...a])}}emitWithAck(t,...n){const r=this.flags.timeout!==void 0||this._opts.ackTimeout!==void 0;return new Promise((i,o)=>{n.push((a,s)=>r?a?o(a):i(s):i(a)),this.emit(t,...n)})}_addToQueue(t){let n;typeof t[t.length-1]=="function"&&(n=t.pop());const r={id:this._queueSeq++,tryCount:0,pending:!1,args:t,flags:Object.assign({fromQueue:!0},this.flags)};t.push((i,...o)=>r!==this._queue[0]?void 0:(i!==null?r.tryCount>this._opts.retries&&(this._queue.shift(),n&&n(i)):(this._queue.shift(),n&&n(null,...o)),r.pending=!1,this._drainQueue())),this._queue.push(r),this._drainQueue()}_drainQueue(t=!1){if(!this.connected||this._queue.length===0)return;const n=this._queue[0];n.pending&&!t||(n.pending=!0,n.tryCount++,this.flags=n.flags,this.emit.apply(this,n.args))}packet(t){t.nsp=this.nsp,this.io._packet(t)}onopen(){typeof this.auth=="function"?this.auth(t=>{this._sendConnectPacket(t)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(t){this.packet({type:Ft.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},t):t})}onerror(t){this.connected||this.emitReserved("connect_error",t)}onclose(t,n){this.connected=!1,delete this.id,this.emitReserved("disconnect",t,n)}onpacket(t){if(t.nsp===this.nsp)switch(t.type){case Ft.CONNECT:t.data&&t.data.sid?this.onconnect(t.data.sid,t.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case Ft.EVENT:case Ft.BINARY_EVENT:this.onevent(t);break;case Ft.ACK:case Ft.BINARY_ACK:this.onack(t);break;case Ft.DISCONNECT:this.ondisconnect();break;case Ft.CONNECT_ERROR:this.destroy();const r=new Error(t.data.message);r.data=t.data.data,this.emitReserved("connect_error",r);break}}onevent(t){const n=t.data||[];t.id!=null&&n.push(this.ack(t.id)),this.connected?this.emitEvent(n):this.receiveBuffer.push(Object.freeze(n))}emitEvent(t){if(this._anyListeners&&this._anyListeners.length){const n=this._anyListeners.slice();for(const r of n)r.apply(this,t)}super.emit.apply(this,t),this._pid&&t.length&&typeof t[t.length-1]=="string"&&(this._lastOffset=t[t.length-1])}ack(t){const n=this;let r=!1;return function(...i){r||(r=!0,n.packet({type:Ft.ACK,id:t,data:i}))}}onack(t){const n=this.acks[t.id];typeof n=="function"&&(n.apply(this,t.data),delete this.acks[t.id])}onconnect(t,n){this.id=t,this.recovered=n&&this._pid===n,this._pid=n,this.connected=!0,this.emitBuffered(),this.emitReserved("connect"),this._drainQueue(!0)}emitBuffered(){this.receiveBuffer.forEach(t=>this.emitEvent(t)),this.receiveBuffer=[],this.sendBuffer.forEach(t=>{this.notifyOutgoingListeners(t),this.packet(t)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(t=>t()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:Ft.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(t){return this.flags.compress=t,this}get volatile(){return this.flags.volatile=!0,this}timeout(t){return this.flags.timeout=t,this}onAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(t),this}prependAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(t),this}offAny(t){if(!this._anyListeners)return this;if(t){const n=this._anyListeners;for(let r=0;r0&&e.jitter<=1?e.jitter:0,this.attempts=0}Pp.prototype.duration=function(){var e=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var t=Math.random(),n=Math.floor(t*this.jitter*e);e=Math.floor(t*10)&1?e+n:e-n}return Math.min(e,this.max)|0};Pp.prototype.reset=function(){this.attempts=0};Pp.prototype.setMin=function(e){this.ms=e};Pp.prototype.setMax=function(e){this.max=e};Pp.prototype.setJitter=function(e){this.jitter=e};class D4 extends Lr{constructor(t,n){var r;super(),this.nsps={},this.subs=[],t&&typeof t=="object"&&(n=t,t=void 0),n=n||{},n.path=n.path||"/socket.io",this.opts=n,pw(this,n),this.reconnection(n.reconnection!==!1),this.reconnectionAttempts(n.reconnectionAttempts||1/0),this.reconnectionDelay(n.reconnectionDelay||1e3),this.reconnectionDelayMax(n.reconnectionDelayMax||5e3),this.randomizationFactor((r=n.randomizationFactor)!==null&&r!==void 0?r:.5),this.backoff=new Pp({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(n.timeout==null?2e4:n.timeout),this._readyState="closed",this.uri=t;const i=n.parser||PBe;this.encoder=new i.Encoder,this.decoder=new i.Decoder,this._autoConnect=n.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(t){return arguments.length?(this._reconnection=!!t,this):this._reconnection}reconnectionAttempts(t){return t===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=t,this)}reconnectionDelay(t){var n;return t===void 0?this._reconnectionDelay:(this._reconnectionDelay=t,(n=this.backoff)===null||n===void 0||n.setMin(t),this)}randomizationFactor(t){var n;return t===void 0?this._randomizationFactor:(this._randomizationFactor=t,(n=this.backoff)===null||n===void 0||n.setJitter(t),this)}reconnectionDelayMax(t){var n;return t===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=t,(n=this.backoff)===null||n===void 0||n.setMax(t),this)}timeout(t){return arguments.length?(this._timeout=t,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(t){if(~this._readyState.indexOf("open"))return this;this.engine=new fK(this.uri,this.opts);const n=this.engine,r=this;this._readyState="opening",this.skipReconnect=!1;const i=Ga(n,"open",function(){r.onopen(),t&&t()}),o=s=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",s),t?t(s):this.maybeReconnectOnOpen()},a=Ga(n,"error",o);if(this._timeout!==!1){const s=this._timeout,l=this.setTimeoutFn(()=>{i(),o(new Error("timeout")),n.close()},s);this.opts.autoUnref&&l.unref(),this.subs.push(()=>{this.clearTimeoutFn(l)})}return this.subs.push(i),this.subs.push(a),this}connect(t){return this.open(t)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const t=this.engine;this.subs.push(Ga(t,"ping",this.onping.bind(this)),Ga(t,"data",this.ondata.bind(this)),Ga(t,"error",this.onerror.bind(this)),Ga(t,"close",this.onclose.bind(this)),Ga(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(t){try{this.decoder.add(t)}catch(n){this.onclose("parse error",n)}}ondecoded(t){TP(()=>{this.emitReserved("packet",t)},this.setTimeoutFn)}onerror(t){this.emitReserved("error",t)}socket(t,n){let r=this.nsps[t];return r?this._autoConnect&&!r.active&&r.connect():(r=new pK(this,t,n),this.nsps[t]=r),r}_destroy(t){const n=Object.keys(this.nsps);for(const r of n)if(this.nsps[r].active)return;this._close()}_packet(t){const n=this.encoder.encode(t);for(let r=0;rt()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close"),this.engine&&this.engine.close()}disconnect(){return this._close()}onclose(t,n){this.cleanup(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",t,n),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const t=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const n=this.backoff.duration();this._reconnecting=!0;const r=this.setTimeoutFn(()=>{t.skipReconnect||(this.emitReserved("reconnect_attempt",t.backoff.attempts),!t.skipReconnect&&t.open(i=>{i?(t._reconnecting=!1,t.reconnect(),this.emitReserved("reconnect_error",i)):t.onreconnect()}))},n);this.opts.autoUnref&&r.unref(),this.subs.push(()=>{this.clearTimeoutFn(r)})}}onreconnect(){const t=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",t)}}const cg={};function ub(e,t){typeof e=="object"&&(t=e,e=void 0),t=t||{};const n=vBe(e,t.path||"/socket.io"),r=n.source,i=n.id,o=n.path,a=cg[i]&&o in cg[i].nsps,s=t.forceNew||t["force new connection"]||t.multiplex===!1||a;let l;return s?l=new D4(r,t):(cg[i]||(cg[i]=new D4(r,t)),l=cg[i]),n.query&&!t.query&&(t.query=n.queryKey),l.socket(n.path,t)}Object.assign(ub,{Manager:D4,Socket:pK,io:ub,connect:ub});const gN=()=>{let e=!1,n=`${window.location.protocol==="https:"?"wss":"ws"}://${window.location.host}`;const r={timeout:6e4,path:"/ws/socket.io",autoConnect:!1};if(["nodes","package"].includes("production")){const a=o0.get();a&&(n=a.replace(/^https?\:\/\//i,""));const s=Zh.get();s&&(r.auth={token:s}),r.transports=["websocket","polling"]}const i=ub(n,r);return a=>s=>l=>{e||(jFe({storeApi:a,socket:i}),e=!0,i.connect()),s(l)}},RBe=""+new URL("logo-13003d72.png",import.meta.url).href,OBe=()=>W.jsxs(wP,{position:"relative",width:"100vw",height:"100vh",alignItems:"center",justifyContent:"center",bg:"#151519",children:[W.jsx(xP,{src:RBe,w:"8rem",h:"8rem"}),W.jsx(bP,{label:"Loading",color:"grey",position:"absolute",size:"sm",width:"24px !important",height:"24px !important",right:"1.5rem",bottom:"1.5rem"})]}),MBe=I.memo(OBe);function L4(e){"@babel/helpers - typeof";return L4=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},L4(e)}var gK=[],NBe=gK.forEach,$Be=gK.slice;function F4(e){return NBe.call($Be.call(arguments,1),function(t){if(t)for(var n in t)e[n]===void 0&&(e[n]=t[n])}),e}function mK(){return typeof XMLHttpRequest=="function"||(typeof XMLHttpRequest>"u"?"undefined":L4(XMLHttpRequest))==="object"}function DBe(e){return!!e&&typeof e.then=="function"}function LBe(e){return DBe(e)?e:Promise.resolve(e)}function FBe(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var B4={exports:{}},m1={exports:{}},mN;function BBe(){return mN||(mN=1,function(e,t){var n=typeof self<"u"?self:mt,r=function(){function o(){this.fetch=!1,this.DOMException=n.DOMException}return o.prototype=n,new o}();(function(o){(function(a){var s={searchParams:"URLSearchParams"in o,iterable:"Symbol"in o&&"iterator"in Symbol,blob:"FileReader"in o&&"Blob"in o&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in o,arrayBuffer:"ArrayBuffer"in o};function l(E){return E&&DataView.prototype.isPrototypeOf(E)}if(s.arrayBuffer)var u=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],c=ArrayBuffer.isView||function(E){return E&&u.indexOf(Object.prototype.toString.call(E))>-1};function d(E){if(typeof E!="string"&&(E=String(E)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(E))throw new TypeError("Invalid character in header field name");return E.toLowerCase()}function f(E){return typeof E!="string"&&(E=String(E)),E}function h(E){var A={next:function(){var D=E.shift();return{done:D===void 0,value:D}}};return s.iterable&&(A[Symbol.iterator]=function(){return A}),A}function p(E){this.map={},E instanceof p?E.forEach(function(A,D){this.append(D,A)},this):Array.isArray(E)?E.forEach(function(A){this.append(A[0],A[1])},this):E&&Object.getOwnPropertyNames(E).forEach(function(A){this.append(A,E[A])},this)}p.prototype.append=function(E,A){E=d(E),A=f(A);var D=this.map[E];this.map[E]=D?D+", "+A:A},p.prototype.delete=function(E){delete this.map[d(E)]},p.prototype.get=function(E){return E=d(E),this.has(E)?this.map[E]:null},p.prototype.has=function(E){return this.map.hasOwnProperty(d(E))},p.prototype.set=function(E,A){this.map[d(E)]=f(A)},p.prototype.forEach=function(E,A){for(var D in this.map)this.map.hasOwnProperty(D)&&E.call(A,this.map[D],D,this)},p.prototype.keys=function(){var E=[];return this.forEach(function(A,D){E.push(D)}),h(E)},p.prototype.values=function(){var E=[];return this.forEach(function(A){E.push(A)}),h(E)},p.prototype.entries=function(){var E=[];return this.forEach(function(A,D){E.push([D,A])}),h(E)},s.iterable&&(p.prototype[Symbol.iterator]=p.prototype.entries);function m(E){if(E.bodyUsed)return Promise.reject(new TypeError("Already read"));E.bodyUsed=!0}function _(E){return new Promise(function(A,D){E.onload=function(){A(E.result)},E.onerror=function(){D(E.error)}})}function b(E){var A=new FileReader,D=_(A);return A.readAsArrayBuffer(E),D}function v(E){var A=new FileReader,D=_(A);return A.readAsText(E),D}function g(E){for(var A=new Uint8Array(E),D=new Array(A.length),L=0;L-1?A:E}function C(E,A){A=A||{};var D=A.body;if(E instanceof C){if(E.bodyUsed)throw new TypeError("Already read");this.url=E.url,this.credentials=E.credentials,A.headers||(this.headers=new p(E.headers)),this.method=E.method,this.mode=E.mode,this.signal=E.signal,!D&&E._bodyInit!=null&&(D=E._bodyInit,E.bodyUsed=!0)}else this.url=String(E);if(this.credentials=A.credentials||this.credentials||"same-origin",(A.headers||!this.headers)&&(this.headers=new p(A.headers)),this.method=x(A.method||this.method||"GET"),this.mode=A.mode||this.mode||null,this.signal=A.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&D)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(D)}C.prototype.clone=function(){return new C(this,{body:this._bodyInit})};function T(E){var A=new FormData;return E.trim().split("&").forEach(function(D){if(D){var L=D.split("="),M=L.shift().replace(/\+/g," "),R=L.join("=").replace(/\+/g," ");A.append(decodeURIComponent(M),decodeURIComponent(R))}}),A}function k(E){var A=new p,D=E.replace(/\r?\n[\t ]+/g," ");return D.split(/\r?\n/).forEach(function(L){var M=L.split(":"),R=M.shift().trim();if(R){var N=M.join(":").trim();A.append(R,N)}}),A}S.call(C.prototype);function P(E,A){A||(A={}),this.type="default",this.status=A.status===void 0?200:A.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in A?A.statusText:"OK",this.headers=new p(A.headers),this.url=A.url||"",this._initBody(E)}S.call(P.prototype),P.prototype.clone=function(){return new P(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new p(this.headers),url:this.url})},P.error=function(){var E=new P(null,{status:0,statusText:""});return E.type="error",E};var $=[301,302,303,307,308];P.redirect=function(E,A){if($.indexOf(A)===-1)throw new RangeError("Invalid status code");return new P(null,{status:A,headers:{location:E}})},a.DOMException=o.DOMException;try{new a.DOMException}catch{a.DOMException=function(A,D){this.message=A,this.name=D;var L=Error(A);this.stack=L.stack},a.DOMException.prototype=Object.create(Error.prototype),a.DOMException.prototype.constructor=a.DOMException}function O(E,A){return new Promise(function(D,L){var M=new C(E,A);if(M.signal&&M.signal.aborted)return L(new a.DOMException("Aborted","AbortError"));var R=new XMLHttpRequest;function N(){R.abort()}R.onload=function(){var B={status:R.status,statusText:R.statusText,headers:k(R.getAllResponseHeaders()||"")};B.url="responseURL"in R?R.responseURL:B.headers.get("X-Request-URL");var U="response"in R?R.response:R.responseText;D(new P(U,B))},R.onerror=function(){L(new TypeError("Network request failed"))},R.ontimeout=function(){L(new TypeError("Network request failed"))},R.onabort=function(){L(new a.DOMException("Aborted","AbortError"))},R.open(M.method,M.url,!0),M.credentials==="include"?R.withCredentials=!0:M.credentials==="omit"&&(R.withCredentials=!1),"responseType"in R&&s.blob&&(R.responseType="blob"),M.headers.forEach(function(B,U){R.setRequestHeader(U,B)}),M.signal&&(M.signal.addEventListener("abort",N),R.onreadystatechange=function(){R.readyState===4&&M.signal.removeEventListener("abort",N)}),R.send(typeof M._bodyInit>"u"?null:M._bodyInit)})}return O.polyfill=!0,o.fetch||(o.fetch=O,o.Headers=p,o.Request=C,o.Response=P),a.Headers=p,a.Request=C,a.Response=P,a.fetch=O,Object.defineProperty(a,"__esModule",{value:!0}),a})({})})(r),r.fetch.ponyfill=!0,delete r.fetch.polyfill;var i=r;t=i.fetch,t.default=i.fetch,t.fetch=i.fetch,t.Headers=i.Headers,t.Request=i.Request,t.Response=i.Response,e.exports=t}(m1,m1.exports)),m1.exports}(function(e,t){var n;if(typeof fetch=="function"&&(typeof mt<"u"&&mt.fetch?n=mt.fetch:typeof window<"u"&&window.fetch?n=window.fetch:n=fetch),typeof FBe<"u"&&(typeof window>"u"||typeof window.document>"u")){var r=n||BBe();r.default&&(r=r.default),t.default=r,e.exports=t.default}})(B4,B4.exports);var yK=B4.exports;const vK=pc(yK),yN=FN({__proto__:null,default:vK},[yK]);function iS(e){"@babel/helpers - typeof";return iS=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},iS(e)}var Fl;typeof fetch=="function"&&(typeof global<"u"&&global.fetch?Fl=global.fetch:typeof window<"u"&&window.fetch?Fl=window.fetch:Fl=fetch);var O0;mK()&&(typeof global<"u"&&global.XMLHttpRequest?O0=global.XMLHttpRequest:typeof window<"u"&&window.XMLHttpRequest&&(O0=window.XMLHttpRequest));var oS;typeof ActiveXObject=="function"&&(typeof global<"u"&&global.ActiveXObject?oS=global.ActiveXObject:typeof window<"u"&&window.ActiveXObject&&(oS=window.ActiveXObject));!Fl&&yN&&!O0&&!oS&&(Fl=vK||yN);typeof Fl!="function"&&(Fl=void 0);var z4=function(t,n){if(n&&iS(n)==="object"){var r="";for(var i in n)r+="&"+encodeURIComponent(i)+"="+encodeURIComponent(n[i]);if(!r)return t;t=t+(t.indexOf("?")!==-1?"&":"?")+r.slice(1)}return t},vN=function(t,n,r){Fl(t,n).then(function(i){if(!i.ok)return r(i.statusText||"Error",{status:i.status});i.text().then(function(o){r(null,{status:i.status,data:o})}).catch(r)}).catch(r)},bN=!1,zBe=function(t,n,r,i){t.queryStringParams&&(n=z4(n,t.queryStringParams));var o=F4({},typeof t.customHeaders=="function"?t.customHeaders():t.customHeaders);r&&(o["Content-Type"]="application/json");var a=typeof t.requestOptions=="function"?t.requestOptions(r):t.requestOptions,s=F4({method:r?"POST":"GET",body:r?t.stringify(r):void 0,headers:o},bN?{}:a);try{vN(n,s,i)}catch(l){if(!a||Object.keys(a).length===0||!l.message||l.message.indexOf("not implemented")<0)return i(l);try{Object.keys(a).forEach(function(u){delete s[u]}),vN(n,s,i),bN=!0}catch(u){i(u)}}},jBe=function(t,n,r,i){r&&iS(r)==="object"&&(r=z4("",r).slice(1)),t.queryStringParams&&(n=z4(n,t.queryStringParams));try{var o;O0?o=new O0:o=new oS("MSXML2.XMLHTTP.3.0"),o.open(r?"POST":"GET",n,1),t.crossDomain||o.setRequestHeader("X-Requested-With","XMLHttpRequest"),o.withCredentials=!!t.withCredentials,r&&o.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),o.overrideMimeType&&o.overrideMimeType("application/json");var a=t.customHeaders;if(a=typeof a=="function"?a():a,a)for(var s in a)o.setRequestHeader(s,a[s]);o.onreadystatechange=function(){o.readyState>3&&i(o.status>=400?o.statusText:null,{status:o.status,data:o.responseText})},o.send(r)}catch(l){console&&console.log(l)}},UBe=function(t,n,r,i){if(typeof r=="function"&&(i=r,r=void 0),i=i||function(){},Fl&&n.indexOf("file:")!==0)return zBe(t,n,r,i);if(mK()||typeof ActiveXObject=="function")return jBe(t,n,r,i);i(new Error("No fetch and no xhr implementation found!"))};function M0(e){"@babel/helpers - typeof";return M0=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},M0(e)}function VBe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _N(e,t){for(var n=0;n1&&arguments[1]!==void 0?arguments[1]:{},r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};VBe(this,e),this.services=t,this.options=n,this.allOptions=r,this.type="backend",this.init(t,n,r)}return GBe(e,[{key:"init",value:function(n){var r=this,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};this.services=n,this.options=F4(i,this.options||{},WBe()),this.allOptions=o,this.services&&this.options.reloadInterval&&setInterval(function(){return r.reload()},this.options.reloadInterval)}},{key:"readMulti",value:function(n,r,i){this._readAny(n,n,r,r,i)}},{key:"read",value:function(n,r,i){this._readAny([n],n,[r],r,i)}},{key:"_readAny",value:function(n,r,i,o,a){var s=this,l=this.options.loadPath;typeof this.options.loadPath=="function"&&(l=this.options.loadPath(n,i)),l=LBe(l),l.then(function(u){if(!u)return a(null,{});var c=s.services.interpolator.interpolate(u,{lng:n.join("+"),ns:i.join("+")});s.loadUrl(c,a,r,o)})}},{key:"loadUrl",value:function(n,r,i,o){var a=this,s=typeof i=="string"?[i]:i,l=typeof o=="string"?[o]:o,u=this.options.parseLoadPayload(s,l);this.options.request(this.options,n,u,function(c,d){if(d&&(d.status>=500&&d.status<600||!d.status))return r("failed loading "+n+"; status code: "+d.status,!0);if(d&&d.status>=400&&d.status<500)return r("failed loading "+n+"; status code: "+d.status,!1);if(!d&&c&&c.message&&c.message.indexOf("Failed to fetch")>-1)return r("failed loading "+n+": "+c.message,!0);if(c)return r(c,!1);var f,h;try{typeof d.data=="string"?f=a.options.parse(d.data,i,o):f=d.data}catch{h="failed parsing "+n+" to json"}if(h)return r(h,!1);r(null,f)})}},{key:"create",value:function(n,r,i,o,a){var s=this;if(this.options.addPath){typeof n=="string"&&(n=[n]);var l=this.options.parsePayload(r,i,o),u=0,c=[],d=[];n.forEach(function(f){var h=s.options.addPath;typeof s.options.addPath=="function"&&(h=s.options.addPath(f,r));var p=s.services.interpolator.interpolate(h,{lng:f,ns:r});s.options.request(s.options,p,l,function(m,_){u+=1,c.push(m),d.push(_),u===n.length&&typeof a=="function"&&a(c,d)})})}}},{key:"reload",value:function(){var n=this,r=this.services,i=r.backendConnector,o=r.languageUtils,a=r.logger,s=i.language;if(!(s&&s.toLowerCase()==="cimode")){var l=[],u=function(d){var f=o.toResolveHierarchy(d);f.forEach(function(h){l.indexOf(h)<0&&l.push(h)})};u(s),this.allOptions.preload&&this.allOptions.preload.forEach(function(c){return u(c)}),l.forEach(function(c){n.allOptions.ns.forEach(function(d){i.read(c,d,"read",null,null,function(f,h){f&&a.warn("loading namespace ".concat(d," for language ").concat(c," failed"),f),!f&&h&&a.log("loaded namespace ".concat(d," for language ").concat(c),h),i.loaded("".concat(c,"|").concat(d),f,h)})})})}}}]),e}();_K.type="backend";be.use(_K).use(Tke).init({fallbackLng:"en",debug:!1,backend:{loadPath:"/locales/{{lng}}.json"},interpolation:{escapeValue:!1},returnNull:!1});const gw=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Ip(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function IP(e){return"nodeType"in e}function uo(e){var t,n;return e?Ip(e)?e:IP(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function RP(e){const{Document:t}=uo(e);return e instanceof t}function By(e){return Ip(e)?!1:e instanceof uo(e).HTMLElement}function KBe(e){return e instanceof uo(e).SVGElement}function Rp(e){return e?Ip(e)?e.document:IP(e)?RP(e)?e:By(e)?e.ownerDocument:document:document:document}const Zs=gw?I.useLayoutEffect:I.useEffect;function mw(e){const t=I.useRef(e);return Zs(()=>{t.current=e}),I.useCallback(function(){for(var n=arguments.length,r=new Array(n),i=0;i{e.current=setInterval(r,i)},[]),n=I.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,n]}function N0(e,t){t===void 0&&(t=[e]);const n=I.useRef(e);return Zs(()=>{n.current!==e&&(n.current=e)},t),n}function zy(e,t){const n=I.useRef();return I.useMemo(()=>{const r=e(n.current);return n.current=r,r},[...t])}function aS(e){const t=mw(e),n=I.useRef(null),r=I.useCallback(i=>{i!==n.current&&(t==null||t(i,n.current)),n.current=i},[]);return[n,r]}function sS(e){const t=I.useRef();return I.useEffect(()=>{t.current=e},[e]),t.current}let F5={};function yw(e,t){return I.useMemo(()=>{if(t)return t;const n=F5[e]==null?0:F5[e]+1;return F5[e]=n,e+"-"+n},[e,t])}function SK(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i{const s=Object.entries(a);for(const[l,u]of s){const c=o[l];c!=null&&(o[l]=c+e*u)}return o},{...t})}}const kh=SK(1),lS=SK(-1);function XBe(e){return"clientX"in e&&"clientY"in e}function OP(e){if(!e)return!1;const{KeyboardEvent:t}=uo(e.target);return t&&e instanceof t}function YBe(e){if(!e)return!1;const{TouchEvent:t}=uo(e.target);return t&&e instanceof t}function $0(e){if(YBe(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return XBe(e)?{x:e.clientX,y:e.clientY}:null}const D0=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:n}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:n}=e;return"scaleX("+t+") scaleY("+n+")"}},Transform:{toString(e){if(e)return[D0.Translate.toString(e),D0.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+" "+n+"ms "+r}}}),SN="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function ZBe(e){return e.matches(SN)?e:e.querySelector(SN)}const JBe={display:"none"};function eze(e){let{id:t,value:n}=e;return En.createElement("div",{id:t,style:JBe},n)}const tze={position:"fixed",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};function nze(e){let{id:t,announcement:n}=e;return En.createElement("div",{id:t,style:tze,role:"status","aria-live":"assertive","aria-atomic":!0},n)}function rze(){const[e,t]=I.useState("");return{announce:I.useCallback(r=>{r!=null&&t(r)},[]),announcement:e}}const xK=I.createContext(null);function ize(e){const t=I.useContext(xK);I.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of ");return t(e)},[e,t])}function oze(){const[e]=I.useState(()=>new Set),t=I.useCallback(r=>(e.add(r),()=>e.delete(r)),[e]);return[I.useCallback(r=>{let{type:i,event:o}=r;e.forEach(a=>{var s;return(s=a[i])==null?void 0:s.call(a,o)})},[e]),t]}const aze={draggable:` To pick up a draggable item, press the space bar. While dragging, use the arrow keys to move the item. Press space again to drop the item in its new position, or press escape to cancel. - `},lze={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was moved over droppable area "+n.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was dropped over droppable area "+n.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function uze(e){let{announcements:t=lze,container:n,hiddenTextDescribedById:r,screenReaderInstructions:i=sze}=e;const{announce:o,announcement:a}=ize(),s=yw("DndLiveRegion"),[l,u]=I.useState(!1);if(I.useEffect(()=>{u(!0)},[]),oze(I.useMemo(()=>({onDragStart(d){let{active:f}=d;o(t.onDragStart({active:f}))},onDragMove(d){let{active:f,over:h}=d;t.onDragMove&&o(t.onDragMove({active:f,over:h}))},onDragOver(d){let{active:f,over:h}=d;o(t.onDragOver({active:f,over:h}))},onDragEnd(d){let{active:f,over:h}=d;o(t.onDragEnd({active:f,over:h}))},onDragCancel(d){let{active:f,over:h}=d;o(t.onDragCancel({active:f,over:h}))}}),[o,t])),!l)return null;const c=En.createElement(En.Fragment,null,En.createElement(tze,{id:r,value:i.draggable}),En.createElement(rze,{id:s,announcement:a}));return n?Uo.createPortal(c,n):c}var Hr;(function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"})(Hr||(Hr={}));function uS(){}function wN(e,t){return I.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function cze(){for(var e=arguments.length,t=new Array(e),n=0;n[...t].filter(r=>r!=null),[...t])}const us=Object.freeze({x:0,y:0});function dze(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function fze(e,t){const n=$0(e);if(!n)return"0 0";const r={x:(n.x-t.left)/t.width*100,y:(n.y-t.top)/t.height*100};return r.x+"% "+r.y+"%"}function hze(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function pze(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function gze(e){let{left:t,top:n,height:r,width:i}=e;return[{x:t,y:n},{x:t+i,y:n},{x:t,y:n+r},{x:t+i,y:n+r}]}function mze(e,t){if(!e||e.length===0)return null;const[n]=e;return t?n[t]:n}function yze(e,t){const n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),i=Math.min(t.left+t.width,e.left+e.width),o=Math.min(t.top+t.height,e.top+e.height),a=i-r,s=o-n;if(r{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const i=[];for(const o of r){const{id:a}=o,s=n.get(a);if(s){const l=yze(s,t);l>0&&i.push({id:a,data:{droppableContainer:o,value:l}})}}return i.sort(pze)};function bze(e,t){const{top:n,left:r,bottom:i,right:o}=t;return n<=e.y&&e.y<=i&&r<=e.x&&e.x<=o}const _ze=e=>{let{droppableContainers:t,droppableRects:n,pointerCoordinates:r}=e;if(!r)return[];const i=[];for(const o of t){const{id:a}=o,s=n.get(a);if(s&&bze(r,s)){const u=gze(s).reduce((d,f)=>d+dze(r,f),0),c=Number((u/4).toFixed(4));i.push({id:a,data:{droppableContainer:o,value:c}})}}return i.sort(hze)};function Sze(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function EK(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:us}function xze(e){return function(n){for(var r=arguments.length,i=new Array(r>1?r-1:0),o=1;o({...a,top:a.top+e*s.y,bottom:a.bottom+e*s.y,left:a.left+e*s.x,right:a.right+e*s.x}),{...n})}}const wze=xze(1);function kK(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function Cze(e,t,n){const r=kK(t);if(!r)return e;const{scaleX:i,scaleY:o,x:a,y:s}=r,l=e.left-a-(1-i)*parseFloat(n),u=e.top-s-(1-o)*parseFloat(n.slice(n.indexOf(" ")+1)),c=i?e.width/i:e.width,d=o?e.height/o:e.height;return{width:c,height:d,top:u,right:l+c,bottom:u+d,left:l}}const Eze={ignoreTransform:!1};function jy(e,t){t===void 0&&(t=Eze);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:u,transformOrigin:c}=uo(e).getComputedStyle(e);u&&(n=Cze(n,u,c))}const{top:r,left:i,width:o,height:a,bottom:s,right:l}=n;return{top:r,left:i,width:o,height:a,bottom:s,right:l}}function CN(e){return jy(e,{ignoreTransform:!0})}function kze(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function Tze(e,t){return t===void 0&&(t=uo(e).getComputedStyle(e)),t.position==="fixed"}function Aze(e,t){t===void 0&&(t=uo(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(i=>{const o=t[i];return typeof o=="string"?n.test(o):!1})}function NP(e,t){const n=[];function r(i){if(t!=null&&n.length>=t||!i)return n;if(OP(i)&&i.scrollingElement!=null&&!n.includes(i.scrollingElement))return n.push(i.scrollingElement),n;if(!By(i)||QBe(i)||n.includes(i))return n;const o=uo(e).getComputedStyle(i);return i!==e&&Aze(i,o)&&n.push(i),Tze(i,o)?n:r(i.parentNode)}return e?r(e):n}function TK(e){const[t]=NP(e,1);return t??null}function B5(e){return!gw||!e?null:Rp(e)?e:RP(e)?OP(e)||e===Op(e).scrollingElement?window:By(e)?e:null:null}function AK(e){return Rp(e)?e.scrollX:e.scrollLeft}function PK(e){return Rp(e)?e.scrollY:e.scrollTop}function U4(e){return{x:AK(e),y:PK(e)}}var ui;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(ui||(ui={}));function IK(e){return!gw||!e?!1:e===document.scrollingElement}function RK(e){const t={x:0,y:0},n=IK(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height},i=e.scrollTop<=t.y,o=e.scrollLeft<=t.x,a=e.scrollTop>=r.y,s=e.scrollLeft>=r.x;return{isTop:i,isLeft:o,isBottom:a,isRight:s,maxScroll:r,minScroll:t}}const Pze={x:.2,y:.2};function Ize(e,t,n,r,i){let{top:o,left:a,right:s,bottom:l}=n;r===void 0&&(r=10),i===void 0&&(i=Pze);const{isTop:u,isBottom:c,isLeft:d,isRight:f}=RK(e),h={x:0,y:0},p={x:0,y:0},m={height:t.height*i.y,width:t.width*i.x};return!u&&o<=t.top+m.height?(h.y=ui.Backward,p.y=r*Math.abs((t.top+m.height-o)/m.height)):!c&&l>=t.bottom-m.height&&(h.y=ui.Forward,p.y=r*Math.abs((t.bottom-m.height-l)/m.height)),!f&&s>=t.right-m.width?(h.x=ui.Forward,p.x=r*Math.abs((t.right-m.width-s)/m.width)):!d&&a<=t.left+m.width&&(h.x=ui.Backward,p.x=r*Math.abs((t.left+m.width-a)/m.width)),{direction:h,speed:p}}function Rze(e){if(e===document.scrollingElement){const{innerWidth:o,innerHeight:a}=window;return{top:0,left:0,right:o,bottom:a,width:o,height:a}}const{top:t,left:n,right:r,bottom:i}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:i,width:e.clientWidth,height:e.clientHeight}}function OK(e){return e.reduce((t,n)=>Th(t,U4(n)),us)}function Oze(e){return e.reduce((t,n)=>t+AK(n),0)}function Mze(e){return e.reduce((t,n)=>t+PK(n),0)}function MK(e,t){if(t===void 0&&(t=jy),!e)return;const{top:n,left:r,bottom:i,right:o}=t(e);TK(e)&&(i<=0||o<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const Nze=[["x",["left","right"],Oze],["y",["top","bottom"],Mze]];class $P{constructor(t,n){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const r=NP(n),i=OK(r);this.rect={...t},this.width=t.width,this.height=t.height;for(const[o,a,s]of Nze)for(const l of a)Object.defineProperty(this,l,{get:()=>{const u=s(r),c=i[o]-u;return this.rect[l]+c},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class om{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var r;return(r=this.target)==null?void 0:r.removeEventListener(...n)})},this.target=t}add(t,n,r){var i;(i=this.target)==null||i.addEventListener(t,n,r),this.listeners.push([t,n,r])}}function $ze(e){const{EventTarget:t}=uo(e);return e instanceof t?e:Op(e)}function z5(e,t){const n=Math.abs(e.x),r=Math.abs(e.y);return typeof t=="number"?Math.sqrt(n**2+r**2)>t:"x"in t&&"y"in t?n>t.x&&r>t.y:"x"in t?n>t.x:"y"in t?r>t.y:!1}var ha;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(ha||(ha={}));function EN(e){e.preventDefault()}function Dze(e){e.stopPropagation()}var On;(function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter"})(On||(On={}));const NK={start:[On.Space,On.Enter],cancel:[On.Esc],end:[On.Space,On.Enter]},Lze=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case On.Right:return{...n,x:n.x+25};case On.Left:return{...n,x:n.x-25};case On.Down:return{...n,y:n.y+25};case On.Up:return{...n,y:n.y-25}}};class $K{constructor(t){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=t;const{event:{target:n}}=t;this.props=t,this.listeners=new om(Op(n)),this.windowListeners=new om(uo(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(ha.Resize,this.handleCancel),this.windowListeners.add(ha.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(ha.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,r=t.node.current;r&&MK(r),n(us)}handleKeyDown(t){if(MP(t)){const{active:n,context:r,options:i}=this.props,{keyboardCodes:o=NK,coordinateGetter:a=Lze,scrollBehavior:s="smooth"}=i,{code:l}=t;if(o.end.includes(l)){this.handleEnd(t);return}if(o.cancel.includes(l)){this.handleCancel(t);return}const{collisionRect:u}=r.current,c=u?{x:u.left,y:u.top}:us;this.referenceCoordinates||(this.referenceCoordinates=c);const d=a(t,{active:n,context:r.current,currentCoordinates:c});if(d){const f=lS(d,c),h={x:0,y:0},{scrollableAncestors:p}=r.current;for(const m of p){const _=t.code,{isTop:b,isRight:v,isLeft:g,isBottom:y,maxScroll:S,minScroll:w}=RK(m),x=Rze(m),C={x:Math.min(_===On.Right?x.right-x.width/2:x.right,Math.max(_===On.Right?x.left:x.left+x.width/2,d.x)),y:Math.min(_===On.Down?x.bottom-x.height/2:x.bottom,Math.max(_===On.Down?x.top:x.top+x.height/2,d.y))},T=_===On.Right&&!v||_===On.Left&&!g,k=_===On.Down&&!y||_===On.Up&&!b;if(T&&C.x!==d.x){const P=m.scrollLeft+f.x,$=_===On.Right&&P<=S.x||_===On.Left&&P>=w.x;if($&&!f.y){m.scrollTo({left:P,behavior:s});return}$?h.x=m.scrollLeft-P:h.x=_===On.Right?m.scrollLeft-S.x:m.scrollLeft-w.x,h.x&&m.scrollBy({left:-h.x,behavior:s});break}else if(k&&C.y!==d.y){const P=m.scrollTop+f.y,$=_===On.Down&&P<=S.y||_===On.Up&&P>=w.y;if($&&!f.x){m.scrollTo({top:P,behavior:s});return}$?h.y=m.scrollTop-P:h.y=_===On.Down?m.scrollTop-S.y:m.scrollTop-w.y,h.y&&m.scrollBy({top:-h.y,behavior:s});break}}this.handleMove(t,Th(lS(d,this.referenceCoordinates),h))}}}handleMove(t,n){const{onMove:r}=this.props;t.preventDefault(),r(n)}handleEnd(t){const{onEnd:n}=this.props;t.preventDefault(),this.detach(),n()}handleCancel(t){const{onCancel:n}=this.props;t.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}$K.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:r=NK,onActivation:i}=t,{active:o}=n;const{code:a}=e.nativeEvent;if(r.start.includes(a)){const s=o.activatorNode.current;return s&&e.target!==s?!1:(e.preventDefault(),i==null||i({event:e.nativeEvent}),!0)}return!1}}];function kN(e){return!!(e&&"distance"in e)}function TN(e){return!!(e&&"delay"in e)}class DP{constructor(t,n,r){var i;r===void 0&&(r=$ze(t.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=t,this.events=n;const{event:o}=t,{target:a}=o;this.props=t,this.events=n,this.document=Op(a),this.documentListeners=new om(this.document),this.listeners=new om(r),this.windowListeners=new om(uo(a)),this.initialCoordinates=(i=$0(o))!=null?i:us,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:t,props:{options:{activationConstraint:n}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),this.windowListeners.add(ha.Resize,this.handleCancel),this.windowListeners.add(ha.DragStart,EN),this.windowListeners.add(ha.VisibilityChange,this.handleCancel),this.windowListeners.add(ha.ContextMenu,EN),this.documentListeners.add(ha.Keydown,this.handleKeydown),n){if(kN(n))return;if(TN(n)){this.timeoutId=setTimeout(this.handleStart,n.delay);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handleStart(){const{initialCoordinates:t}=this,{onStart:n}=this.props;t&&(this.activated=!0,this.documentListeners.add(ha.Click,Dze,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(ha.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){var n;const{activated:r,initialCoordinates:i,props:o}=this,{onMove:a,options:{activationConstraint:s}}=o;if(!i)return;const l=(n=$0(t))!=null?n:us,u=lS(i,l);if(!r&&s){if(TN(s))return z5(u,s.tolerance)?this.handleCancel():void 0;if(kN(s))return s.tolerance!=null&&z5(u,s.tolerance)?this.handleCancel():z5(u,s.distance)?this.handleStart():void 0}t.cancelable&&t.preventDefault(),a(l)}handleEnd(){const{onEnd:t}=this.props;this.detach(),t()}handleCancel(){const{onCancel:t}=this.props;this.detach(),t()}handleKeydown(t){t.code===On.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const Fze={move:{name:"pointermove"},end:{name:"pointerup"}};class DK extends DP{constructor(t){const{event:n}=t,r=Op(n.target);super(t,Fze,r)}}DK.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r==null||r({event:n}),!0)}}];const Bze={move:{name:"mousemove"},end:{name:"mouseup"}};var V4;(function(e){e[e.RightClick=2]="RightClick"})(V4||(V4={}));class LK extends DP{constructor(t){super(t,Bze,Op(t.event.target))}}LK.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===V4.RightClick?!1:(r==null||r({event:n}),!0)}}];const j5={move:{name:"touchmove"},end:{name:"touchend"}};class FK extends DP{constructor(t){super(t,j5)}static setup(){return window.addEventListener(j5.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(j5.move.name,t)};function t(){}}}FK.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;const{touches:i}=n;return i.length>1?!1:(r==null||r({event:n}),!0)}}];var am;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(am||(am={}));var cS;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(cS||(cS={}));function zze(e){let{acceleration:t,activator:n=am.Pointer,canScroll:r,draggingRect:i,enabled:o,interval:a=5,order:s=cS.TreeOrder,pointerCoordinates:l,scrollableAncestors:u,scrollableAncestorRects:c,delta:d,threshold:f}=e;const h=Uze({delta:d,disabled:!o}),[p,m]=XBe(),_=I.useRef({x:0,y:0}),b=I.useRef({x:0,y:0}),v=I.useMemo(()=>{switch(n){case am.Pointer:return l?{top:l.y,bottom:l.y,left:l.x,right:l.x}:null;case am.DraggableRect:return i}},[n,i,l]),g=I.useRef(null),y=I.useCallback(()=>{const w=g.current;if(!w)return;const x=_.current.x*b.current.x,C=_.current.y*b.current.y;w.scrollBy(x,C)},[]),S=I.useMemo(()=>s===cS.TreeOrder?[...u].reverse():u,[s,u]);I.useEffect(()=>{if(!o||!u.length||!v){m();return}for(const w of S){if((r==null?void 0:r(w))===!1)continue;const x=u.indexOf(w),C=c[x];if(!C)continue;const{direction:T,speed:k}=Ize(w,C,v,t,f);for(const P of["x","y"])h[P][T[P]]||(k[P]=0,T[P]=0);if(k.x>0||k.y>0){m(),g.current=w,p(y,a),_.current=k,b.current=T;return}}_.current={x:0,y:0},b.current={x:0,y:0},m()},[t,y,r,m,o,a,JSON.stringify(v),JSON.stringify(h),p,u,S,c,JSON.stringify(f)])}const jze={x:{[ui.Backward]:!1,[ui.Forward]:!1},y:{[ui.Backward]:!1,[ui.Forward]:!1}};function Uze(e){let{delta:t,disabled:n}=e;const r=sS(t);return zy(i=>{if(n||!r||!i)return jze;const o={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[ui.Backward]:i.x[ui.Backward]||o.x===-1,[ui.Forward]:i.x[ui.Forward]||o.x===1},y:{[ui.Backward]:i.y[ui.Backward]||o.y===-1,[ui.Forward]:i.y[ui.Forward]||o.y===1}}},[n,t,r])}function Vze(e,t){const n=t!==null?e.get(t):void 0,r=n?n.node.current:null;return zy(i=>{var o;return t===null?null:(o=r??i)!=null?o:null},[r,t])}function Gze(e,t){return I.useMemo(()=>e.reduce((n,r)=>{const{sensor:i}=r,o=i.activators.map(a=>({eventName:a.eventName,handler:t(a.handler,r)}));return[...n,...o]},[]),[e,t])}var L0;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(L0||(L0={}));var G4;(function(e){e.Optimized="optimized"})(G4||(G4={}));const AN=new Map;function Hze(e,t){let{dragging:n,dependencies:r,config:i}=t;const[o,a]=I.useState(null),{frequency:s,measure:l,strategy:u}=i,c=I.useRef(e),d=_(),f=N0(d),h=I.useCallback(function(b){b===void 0&&(b=[]),!f.current&&a(v=>v===null?b:v.concat(b.filter(g=>!v.includes(g))))},[f]),p=I.useRef(null),m=zy(b=>{if(d&&!n)return AN;if(!b||b===AN||c.current!==e||o!=null){const v=new Map;for(let g of e){if(!g)continue;if(o&&o.length>0&&!o.includes(g.id)&&g.rect.current){v.set(g.id,g.rect.current);continue}const y=g.node.current,S=y?new $P(l(y),y):null;g.rect.current=S,S&&v.set(g.id,S)}return v}return b},[e,o,n,d,l]);return I.useEffect(()=>{c.current=e},[e]),I.useEffect(()=>{d||h()},[n,d]),I.useEffect(()=>{o&&o.length>0&&a(null)},[JSON.stringify(o)]),I.useEffect(()=>{d||typeof s!="number"||p.current!==null||(p.current=setTimeout(()=>{h(),p.current=null},s))},[s,d,h,...r]),{droppableRects:m,measureDroppableContainers:h,measuringScheduled:o!=null};function _(){switch(u){case L0.Always:return!1;case L0.BeforeDragging:return n;default:return!n}}}function LP(e,t){return zy(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function qze(e,t){return LP(e,t)}function Wze(e){let{callback:t,disabled:n}=e;const r=mw(t),i=I.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:o}=window;return new o(r)},[r,n]);return I.useEffect(()=>()=>i==null?void 0:i.disconnect(),[i]),i}function vw(e){let{callback:t,disabled:n}=e;const r=mw(t),i=I.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:o}=window;return new o(r)},[n]);return I.useEffect(()=>()=>i==null?void 0:i.disconnect(),[i]),i}function Kze(e){return new $P(jy(e),e)}function PN(e,t,n){t===void 0&&(t=Kze);const[r,i]=I.useReducer(s,null),o=Wze({callback(l){if(e)for(const u of l){const{type:c,target:d}=u;if(c==="childList"&&d instanceof HTMLElement&&d.contains(e)){i();break}}}}),a=vw({callback:i});return Zs(()=>{i(),e?(a==null||a.observe(e),o==null||o.observe(document.body,{childList:!0,subtree:!0})):(a==null||a.disconnect(),o==null||o.disconnect())},[e]),r;function s(l){if(!e)return null;if(e.isConnected===!1){var u;return(u=l??n)!=null?u:null}const c=t(e);return JSON.stringify(l)===JSON.stringify(c)?l:c}}function Qze(e){const t=LP(e);return EK(e,t)}const IN=[];function Xze(e){const t=I.useRef(e),n=zy(r=>e?r&&r!==IN&&e&&t.current&&e.parentNode===t.current.parentNode?r:NP(e):IN,[e]);return I.useEffect(()=>{t.current=e},[e]),n}function Yze(e){const[t,n]=I.useState(null),r=I.useRef(e),i=I.useCallback(o=>{const a=B5(o.target);a&&n(s=>s?(s.set(a,U4(a)),new Map(s)):null)},[]);return I.useEffect(()=>{const o=r.current;if(e!==o){a(o);const s=e.map(l=>{const u=B5(l);return u?(u.addEventListener("scroll",i,{passive:!0}),[u,U4(u)]):null}).filter(l=>l!=null);n(s.length?new Map(s):null),r.current=e}return()=>{a(e),a(o)};function a(s){s.forEach(l=>{const u=B5(l);u==null||u.removeEventListener("scroll",i)})}},[i,e]),I.useMemo(()=>e.length?t?Array.from(t.values()).reduce((o,a)=>Th(o,a),us):OK(e):us,[e,t])}function RN(e,t){t===void 0&&(t=[]);const n=I.useRef(null);return I.useEffect(()=>{n.current=null},t),I.useEffect(()=>{const r=e!==us;r&&!n.current&&(n.current=e),!r&&n.current&&(n.current=null)},[e]),n.current?lS(e,n.current):us}function Zze(e){I.useEffect(()=>{if(!gw)return;const t=e.map(n=>{let{sensor:r}=n;return r.setup==null?void 0:r.setup()});return()=>{for(const n of t)n==null||n()}},e.map(t=>{let{sensor:n}=t;return n}))}function Jze(e,t){return I.useMemo(()=>e.reduce((n,r)=>{let{eventName:i,handler:o}=r;return n[i]=a=>{o(a,t)},n},{}),[e,t])}function BK(e){return I.useMemo(()=>e?kze(e):null,[e])}const U5=[];function eje(e,t){t===void 0&&(t=jy);const[n]=e,r=BK(n?uo(n):null),[i,o]=I.useReducer(s,U5),a=vw({callback:o});return e.length>0&&i===U5&&o(),Zs(()=>{e.length?e.forEach(l=>a==null?void 0:a.observe(l)):(a==null||a.disconnect(),o())},[e]),i;function s(){return e.length?e.map(l=>IK(l)?r:new $P(t(l),l)):U5}}function zK(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return By(t)?t:e}function tje(e){let{measure:t}=e;const[n,r]=I.useState(null),i=I.useCallback(u=>{for(const{target:c}of u)if(By(c)){r(d=>{const f=t(c);return d?{...d,width:f.width,height:f.height}:f});break}},[t]),o=vw({callback:i}),a=I.useCallback(u=>{const c=zK(u);o==null||o.disconnect(),c&&(o==null||o.observe(c)),r(c?t(c):null)},[t,o]),[s,l]=aS(a);return I.useMemo(()=>({nodeRef:s,rect:n,setRef:l}),[n,s,l])}const nje=[{sensor:DK,options:{}},{sensor:$K,options:{}}],rje={current:{}},cb={draggable:{measure:CN},droppable:{measure:CN,strategy:L0.WhileDragging,frequency:G4.Optimized},dragOverlay:{measure:jy}};class sm extends Map{get(t){var n;return t!=null&&(n=super.get(t))!=null?n:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:n}=t;return!n})}getNodeFor(t){var n,r;return(n=(r=this.get(t))==null?void 0:r.node.current)!=null?n:void 0}}const ije={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new sm,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:uS},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:cb,measureDroppableContainers:uS,windowRect:null,measuringScheduled:!1},jK={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:uS,draggableNodes:new Map,over:null,measureDroppableContainers:uS},Uy=I.createContext(jK),UK=I.createContext(ije);function oje(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new sm}}}function aje(e,t){switch(t.type){case Hr.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case Hr.DragMove:return e.draggable.active?{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}}:e;case Hr.DragEnd:case Hr.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case Hr.RegisterDroppable:{const{element:n}=t,{id:r}=n,i=new sm(e.droppable.containers);return i.set(r,n),{...e,droppable:{...e.droppable,containers:i}}}case Hr.SetDroppableDisabled:{const{id:n,key:r,disabled:i}=t,o=e.droppable.containers.get(n);if(!o||r!==o.key)return e;const a=new sm(e.droppable.containers);return a.set(n,{...o,disabled:i}),{...e,droppable:{...e.droppable,containers:a}}}case Hr.UnregisterDroppable:{const{id:n,key:r}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;const o=new sm(e.droppable.containers);return o.delete(n),{...e,droppable:{...e.droppable,containers:o}}}default:return e}}function sje(e){let{disabled:t}=e;const{active:n,activatorEvent:r,draggableNodes:i}=I.useContext(Uy),o=sS(r),a=sS(n==null?void 0:n.id);return I.useEffect(()=>{if(!t&&!r&&o&&a!=null){if(!MP(o)||document.activeElement===o.target)return;const s=i.get(a);if(!s)return;const{activatorNode:l,node:u}=s;if(!l.current&&!u.current)return;requestAnimationFrame(()=>{for(const c of[l.current,u.current]){if(!c)continue;const d=JBe(c);if(d){d.focus();break}}})}},[r,t,i,a,o]),null}function VK(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((i,o)=>o({transform:i,...r}),n):n}function lje(e){return I.useMemo(()=>({draggable:{...cb.draggable,...e==null?void 0:e.draggable},droppable:{...cb.droppable,...e==null?void 0:e.droppable},dragOverlay:{...cb.dragOverlay,...e==null?void 0:e.dragOverlay}}),[e==null?void 0:e.draggable,e==null?void 0:e.droppable,e==null?void 0:e.dragOverlay])}function uje(e){let{activeNode:t,measure:n,initialRect:r,config:i=!0}=e;const o=I.useRef(!1),{x:a,y:s}=typeof i=="boolean"?{x:i,y:i}:i;Zs(()=>{if(!a&&!s||!t){o.current=!1;return}if(o.current||!r)return;const u=t==null?void 0:t.node.current;if(!u||u.isConnected===!1)return;const c=n(u),d=EK(c,r);if(a||(d.x=0),s||(d.y=0),o.current=!0,Math.abs(d.x)>0||Math.abs(d.y)>0){const f=TK(u);f&&f.scrollBy({top:d.y,left:d.x})}},[t,a,s,r,n])}const bw=I.createContext({...us,scaleX:1,scaleY:1});var _u;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(_u||(_u={}));const cje=I.memo(function(t){var n,r,i,o;let{id:a,accessibility:s,autoScroll:l=!0,children:u,sensors:c=nje,collisionDetection:d=vze,measuring:f,modifiers:h,...p}=t;const m=I.useReducer(aje,void 0,oje),[_,b]=m,[v,g]=aze(),[y,S]=I.useState(_u.Uninitialized),w=y===_u.Initialized,{draggable:{active:x,nodes:C,translate:T},droppable:{containers:k}}=_,P=x?C.get(x):null,$=I.useRef({initial:null,translated:null}),O=I.useMemo(()=>{var Bn;return x!=null?{id:x,data:(Bn=P==null?void 0:P.data)!=null?Bn:rje,rect:$}:null},[x,P]),E=I.useRef(null),[A,D]=I.useState(null),[L,M]=I.useState(null),R=N0(p,Object.values(p)),N=yw("DndDescribedBy",a),B=I.useMemo(()=>k.getEnabled(),[k]),U=lje(f),{droppableRects:G,measureDroppableContainers:Y,measuringScheduled:ee}=Hze(B,{dragging:w,dependencies:[T.x,T.y],config:U.droppable}),J=Vze(C,x),j=I.useMemo(()=>L?$0(L):null,[L]),Q=al(),ne=qze(J,U.draggable.measure);uje({activeNode:x?C.get(x):null,config:Q.layoutShiftCompensation,initialRect:ne,measure:U.draggable.measure});const se=PN(J,U.draggable.measure,ne),ve=PN(J?J.parentElement:null),ce=I.useRef({activatorEvent:null,active:null,activeNode:J,collisionRect:null,collisions:null,droppableRects:G,draggableNodes:C,draggingNode:null,draggingNodeRect:null,droppableContainers:k,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),bt=k.getNodeFor((n=ce.current.over)==null?void 0:n.id),ot=tje({measure:U.dragOverlay.measure}),ze=(r=ot.nodeRef.current)!=null?r:J,gt=w?(i=ot.rect)!=null?i:se:null,Pe=!!(ot.nodeRef.current&&ot.rect),Jt=Qze(Pe?null:se),Ar=BK(ze?uo(ze):null),Dn=Xze(w?bt??J:null),Tn=eje(Dn),en=VK(h,{transform:{x:T.x-Jt.x,y:T.y-Jt.y,scaleX:1,scaleY:1},activatorEvent:L,active:O,activeNodeRect:se,containerNodeRect:ve,draggingNodeRect:gt,over:ce.current.over,overlayNodeRect:ot.rect,scrollableAncestors:Dn,scrollableAncestorRects:Tn,windowRect:Ar}),Ln=j?Th(j,T):null,Pr=Yze(Dn),co=RN(Pr),Jr=RN(Pr,[se]),hr=Th(en,co),Fr=gt?wze(gt,en):null,ei=O&&Fr?d({active:O,collisionRect:Fr,droppableRects:G,droppableContainers:B,pointerCoordinates:Ln}):null,Fn=mze(ei,"id"),[bn,Mi]=I.useState(null),pi=Pe?en:Th(en,Jr),Qi=Sze(pi,(o=bn==null?void 0:bn.rect)!=null?o:null,se),$a=I.useCallback((Bn,tn)=>{let{sensor:Br,options:Rr}=tn;if(E.current==null)return;const Or=C.get(E.current);if(!Or)return;const ti=Bn.nativeEvent,Ni=new Br({active:E.current,activeNode:Or,event:ti,options:Rr,context:ce,onStart(gi){const zr=E.current;if(zr==null)return;const Da=C.get(zr);if(!Da)return;const{onDragStart:hs}=R.current,mi={active:{id:zr,data:Da.data,rect:$}};Uo.unstable_batchedUpdates(()=>{hs==null||hs(mi),S(_u.Initializing),b({type:Hr.DragStart,initialCoordinates:gi,active:zr}),v({type:"onDragStart",event:mi})})},onMove(gi){b({type:Hr.DragMove,coordinates:gi})},onEnd:ho(Hr.DragEnd),onCancel:ho(Hr.DragCancel)});Uo.unstable_batchedUpdates(()=>{D(Ni),M(Bn.nativeEvent)});function ho(gi){return async function(){const{active:Da,collisions:hs,over:mi,scrollAdjustedTranslate:ru}=ce.current;let ia=null;if(Da&&ru){const{cancelDrop:ni}=R.current;ia={activatorEvent:ti,active:Da,collisions:hs,delta:ru,over:mi},gi===Hr.DragEnd&&typeof ni=="function"&&await Promise.resolve(ni(ia))&&(gi=Hr.DragCancel)}E.current=null,Uo.unstable_batchedUpdates(()=>{b({type:gi}),S(_u.Uninitialized),Mi(null),D(null),M(null);const ni=gi===Hr.DragEnd?"onDragEnd":"onDragCancel";if(ia){const sl=R.current[ni];sl==null||sl(ia),v({type:ni,event:ia})}})}}},[C]),Ir=I.useCallback((Bn,tn)=>(Br,Rr)=>{const Or=Br.nativeEvent,ti=C.get(Rr);if(E.current!==null||!ti||Or.dndKit||Or.defaultPrevented)return;const Ni={active:ti};Bn(Br,tn.options,Ni)===!0&&(Or.dndKit={capturedBy:tn.sensor},E.current=Rr,$a(Br,tn))},[C,$a]),fo=Gze(c,Ir);Zze(c),Zs(()=>{se&&y===_u.Initializing&&S(_u.Initialized)},[se,y]),I.useEffect(()=>{const{onDragMove:Bn}=R.current,{active:tn,activatorEvent:Br,collisions:Rr,over:Or}=ce.current;if(!tn||!Br)return;const ti={active:tn,activatorEvent:Br,collisions:Rr,delta:{x:hr.x,y:hr.y},over:Or};Uo.unstable_batchedUpdates(()=>{Bn==null||Bn(ti),v({type:"onDragMove",event:ti})})},[hr.x,hr.y]),I.useEffect(()=>{const{active:Bn,activatorEvent:tn,collisions:Br,droppableContainers:Rr,scrollAdjustedTranslate:Or}=ce.current;if(!Bn||E.current==null||!tn||!Or)return;const{onDragOver:ti}=R.current,Ni=Rr.get(Fn),ho=Ni&&Ni.rect.current?{id:Ni.id,rect:Ni.rect.current,data:Ni.data,disabled:Ni.disabled}:null,gi={active:Bn,activatorEvent:tn,collisions:Br,delta:{x:Or.x,y:Or.y},over:ho};Uo.unstable_batchedUpdates(()=>{Mi(ho),ti==null||ti(gi),v({type:"onDragOver",event:gi})})},[Fn]),Zs(()=>{ce.current={activatorEvent:L,active:O,activeNode:J,collisionRect:Fr,collisions:ei,droppableRects:G,draggableNodes:C,draggingNode:ze,draggingNodeRect:gt,droppableContainers:k,over:bn,scrollableAncestors:Dn,scrollAdjustedTranslate:hr},$.current={initial:gt,translated:Fr}},[O,J,ei,Fr,C,ze,gt,G,k,bn,Dn,hr]),zze({...Q,delta:T,draggingRect:Fr,pointerCoordinates:Ln,scrollableAncestors:Dn,scrollableAncestorRects:Tn});const ol=I.useMemo(()=>({active:O,activeNode:J,activeNodeRect:se,activatorEvent:L,collisions:ei,containerNodeRect:ve,dragOverlay:ot,draggableNodes:C,droppableContainers:k,droppableRects:G,over:bn,measureDroppableContainers:Y,scrollableAncestors:Dn,scrollableAncestorRects:Tn,measuringConfiguration:U,measuringScheduled:ee,windowRect:Ar}),[O,J,se,L,ei,ve,ot,C,k,G,bn,Y,Dn,Tn,U,ee,Ar]),$o=I.useMemo(()=>({activatorEvent:L,activators:fo,active:O,activeNodeRect:se,ariaDescribedById:{draggable:N},dispatch:b,draggableNodes:C,over:bn,measureDroppableContainers:Y}),[L,fo,O,se,b,N,C,bn,Y]);return En.createElement(CK.Provider,{value:g},En.createElement(Uy.Provider,{value:$o},En.createElement(UK.Provider,{value:ol},En.createElement(bw.Provider,{value:Qi},u)),En.createElement(sje,{disabled:(s==null?void 0:s.restoreFocus)===!1})),En.createElement(uze,{...s,hiddenTextDescribedById:N}));function al(){const Bn=(A==null?void 0:A.autoScrollEnabled)===!1,tn=typeof l=="object"?l.enabled===!1:l===!1,Br=w&&!Bn&&!tn;return typeof l=="object"?{...l,enabled:Br}:{enabled:Br}}}),dje=I.createContext(null),ON="button",fje="Droppable";function DKe(e){let{id:t,data:n,disabled:r=!1,attributes:i}=e;const o=yw(fje),{activators:a,activatorEvent:s,active:l,activeNodeRect:u,ariaDescribedById:c,draggableNodes:d,over:f}=I.useContext(Uy),{role:h=ON,roleDescription:p="draggable",tabIndex:m=0}=i??{},_=(l==null?void 0:l.id)===t,b=I.useContext(_?bw:dje),[v,g]=aS(),[y,S]=aS(),w=Jze(a,t),x=N0(n);Zs(()=>(d.set(t,{id:t,key:o,node:v,activatorNode:y,data:x}),()=>{const T=d.get(t);T&&T.key===o&&d.delete(t)}),[d,t]);const C=I.useMemo(()=>({role:h,tabIndex:m,"aria-disabled":r,"aria-pressed":_&&h===ON?!0:void 0,"aria-roledescription":p,"aria-describedby":c.draggable}),[r,h,m,_,p,c.draggable]);return{active:l,activatorEvent:s,activeNodeRect:u,attributes:C,isDragging:_,listeners:r?void 0:w,node:v,over:f,setNodeRef:g,setActivatorNodeRef:S,transform:b}}function hje(){return I.useContext(UK)}const pje="Droppable",gje={timeout:25};function LKe(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:i}=e;const o=yw(pje),{active:a,dispatch:s,over:l,measureDroppableContainers:u}=I.useContext(Uy),c=I.useRef({disabled:n}),d=I.useRef(!1),f=I.useRef(null),h=I.useRef(null),{disabled:p,updateMeasurementsFor:m,timeout:_}={...gje,...i},b=N0(m??r),v=I.useCallback(()=>{if(!d.current){d.current=!0;return}h.current!=null&&clearTimeout(h.current),h.current=setTimeout(()=>{u(Array.isArray(b.current)?b.current:[b.current]),h.current=null},_)},[_]),g=vw({callback:v,disabled:p||!a}),y=I.useCallback((C,T)=>{g&&(T&&(g.unobserve(T),d.current=!1),C&&g.observe(C))},[g]),[S,w]=aS(y),x=N0(t);return I.useEffect(()=>{!g||!S.current||(g.disconnect(),d.current=!1,g.observe(S.current))},[S,g]),Zs(()=>(s({type:Hr.RegisterDroppable,element:{id:r,key:o,disabled:n,node:S,rect:f,data:x}}),()=>s({type:Hr.UnregisterDroppable,key:o,id:r})),[r]),I.useEffect(()=>{n!==c.current.disabled&&(s({type:Hr.SetDroppableDisabled,id:r,key:o,disabled:n}),c.current.disabled=n)},[r,o,n,s]),{active:a,rect:f,isOver:(l==null?void 0:l.id)===r,node:S,over:l,setNodeRef:w}}function mje(e){let{animation:t,children:n}=e;const[r,i]=I.useState(null),[o,a]=I.useState(null),s=sS(n);return!n&&!r&&s&&i(s),Zs(()=>{if(!o)return;const l=r==null?void 0:r.key,u=r==null?void 0:r.props.id;if(l==null||u==null){i(null);return}Promise.resolve(t(u,o)).then(()=>{i(null)})},[t,r,o]),En.createElement(En.Fragment,null,n,r?I.cloneElement(r,{ref:a}):null)}const yje={x:0,y:0,scaleX:1,scaleY:1};function vje(e){let{children:t}=e;return En.createElement(Uy.Provider,{value:jK},En.createElement(bw.Provider,{value:yje},t))}const bje={position:"fixed",touchAction:"none"},_je=e=>MP(e)?"transform 250ms ease":void 0,Sje=I.forwardRef((e,t)=>{let{as:n,activatorEvent:r,adjustScale:i,children:o,className:a,rect:s,style:l,transform:u,transition:c=_je}=e;if(!s)return null;const d=i?u:{...u,scaleX:1,scaleY:1},f={...bje,width:s.width,height:s.height,top:s.top,left:s.left,transform:D0.Transform.toString(d),transformOrigin:i&&r?fze(r,s):void 0,transition:typeof c=="function"?c(r):c,...l};return En.createElement(n,{className:a,style:f,ref:t},o)}),xje=e=>t=>{let{active:n,dragOverlay:r}=t;const i={},{styles:o,className:a}=e;if(o!=null&&o.active)for(const[s,l]of Object.entries(o.active))l!==void 0&&(i[s]=n.node.style.getPropertyValue(s),n.node.style.setProperty(s,l));if(o!=null&&o.dragOverlay)for(const[s,l]of Object.entries(o.dragOverlay))l!==void 0&&r.node.style.setProperty(s,l);return a!=null&&a.active&&n.node.classList.add(a.active),a!=null&&a.dragOverlay&&r.node.classList.add(a.dragOverlay),function(){for(const[l,u]of Object.entries(i))n.node.style.setProperty(l,u);a!=null&&a.active&&n.node.classList.remove(a.active)}},wje=e=>{let{transform:{initial:t,final:n}}=e;return[{transform:D0.Transform.toString(t)},{transform:D0.Transform.toString(n)}]},Cje={duration:250,easing:"ease",keyframes:wje,sideEffects:xje({styles:{active:{opacity:"0"}}})};function Eje(e){let{config:t,draggableNodes:n,droppableContainers:r,measuringConfiguration:i}=e;return mw((o,a)=>{if(t===null)return;const s=n.get(o);if(!s)return;const l=s.node.current;if(!l)return;const u=zK(a);if(!u)return;const{transform:c}=uo(a).getComputedStyle(a),d=kK(c);if(!d)return;const f=typeof t=="function"?t:kje(t);return MK(l,i.draggable.measure),f({active:{id:o,data:s.data,node:l,rect:i.draggable.measure(l)},draggableNodes:n,dragOverlay:{node:a,rect:i.dragOverlay.measure(u)},droppableContainers:r,measuringConfiguration:i,transform:d})})}function kje(e){const{duration:t,easing:n,sideEffects:r,keyframes:i}={...Cje,...e};return o=>{let{active:a,dragOverlay:s,transform:l,...u}=o;if(!t)return;const c={x:s.rect.left-a.rect.left,y:s.rect.top-a.rect.top},d={scaleX:l.scaleX!==1?a.rect.width*l.scaleX/s.rect.width:1,scaleY:l.scaleY!==1?a.rect.height*l.scaleY/s.rect.height:1},f={x:l.x-c.x,y:l.y-c.y,...d},h=i({...u,active:a,dragOverlay:s,transform:{initial:l,final:f}}),[p]=h,m=h[h.length-1];if(JSON.stringify(p)===JSON.stringify(m))return;const _=r==null?void 0:r({active:a,dragOverlay:s,...u}),b=s.node.animate(h,{duration:t,easing:n,fill:"forwards"});return new Promise(v=>{b.onfinish=()=>{_==null||_(),v()}})}}let MN=0;function Tje(e){return I.useMemo(()=>{if(e!=null)return MN++,MN},[e])}const Aje=En.memo(e=>{let{adjustScale:t=!1,children:n,dropAnimation:r,style:i,transition:o,modifiers:a,wrapperElement:s="div",className:l,zIndex:u=999}=e;const{activatorEvent:c,active:d,activeNodeRect:f,containerNodeRect:h,draggableNodes:p,droppableContainers:m,dragOverlay:_,over:b,measuringConfiguration:v,scrollableAncestors:g,scrollableAncestorRects:y,windowRect:S}=hje(),w=I.useContext(bw),x=Tje(d==null?void 0:d.id),C=VK(a,{activatorEvent:c,active:d,activeNodeRect:f,containerNodeRect:h,draggingNodeRect:_.rect,over:b,overlayNodeRect:_.rect,scrollableAncestors:g,scrollableAncestorRects:y,transform:w,windowRect:S}),T=LP(f),k=Eje({config:r,draggableNodes:p,droppableContainers:m,measuringConfiguration:v}),P=T?_.setRef:void 0;return En.createElement(vje,null,En.createElement(mje,{animation:k},d&&x?En.createElement(Sje,{key:x,id:d.id,ref:P,as:s,activatorEvent:c,adjustScale:t,className:l,transition:o,rect:T,style:{zIndex:u,...i},transform:C},n):null))}),Pje=Ii([nK,$A],({nodes:e},t)=>t==="nodes"?e.viewport.zoom:1),Ije=()=>{const e=cH(Pje);return I.useCallback(({activatorEvent:n,draggingNodeRect:r,transform:i})=>{if(r&&n){const o=$0(n);if(!o)return i;const a=o.x-r.left,s=o.y-r.top,l=i.x+a-r.width/2,u=i.y+s-r.height/2,c=i.scaleX*e,d=i.scaleY*e;return{x:l,y:u,scaleX:c,scaleY:d}}return i},[e])},Rje=e=>{if(!e.pointerCoordinates)return[];const t=document.elementsFromPoint(e.pointerCoordinates.x,e.pointerCoordinates.y),n=e.droppableContainers.filter(r=>r.node.current?t.includes(r.node.current):!1);return _ze({...e,droppableContainers:n})};function Oje(e){return W.jsx(cje,{...e})}const y1=28,NN={w:y1,h:y1,maxW:y1,maxH:y1,shadow:"dark-lg",borderRadius:"lg",opacity:.3,bg:"base.800",color:"base.50",_dark:{borderColor:"base.200",bg:"base.900",color:"base.100"}},Mje=e=>{if(!e.dragData)return null;if(e.dragData.payloadType==="NODE_FIELD"){const{field:t,fieldTemplate:n}=e.dragData.payload;return W.jsx(rS,{sx:{position:"relative",p:2,px:3,opacity:.7,bg:"base.300",borderRadius:"base",boxShadow:"dark-lg",whiteSpace:"nowrap",fontSize:"sm"},children:W.jsx(WW,{children:t.label||n.title})})}if(e.dragData.payloadType==="IMAGE_DTO"){const{thumbnail_url:t,width:n,height:r}=e.dragData.payload.imageDTO;return W.jsx(rS,{sx:{position:"relative",width:"full",height:"full",display:"flex",alignItems:"center",justifyContent:"center"},children:W.jsx(wP,{sx:{...NN},objectFit:"contain",src:t,width:n,height:r})})}return e.dragData.payloadType==="IMAGE_DTOS"?W.jsxs(CP,{sx:{position:"relative",alignItems:"center",justifyContent:"center",flexDir:"column",...NN},children:[W.jsx(R4,{children:e.dragData.payload.imageDTOs.length}),W.jsx(R4,{size:"sm",children:"Images"})]}):null},Nje=I.memo(Mje),$je=e=>{const[t,n]=I.useState(null),r=_e("images"),i=mke(),o=I.useCallback(d=>{r.trace({dragData:Qt(d.active.data.current)},"Drag started");const f=d.active.data.current;f&&n(f)},[r]),a=I.useCallback(d=>{var h;r.trace({dragData:Qt(d.active.data.current)},"Drag ended");const f=(h=d.over)==null?void 0:h.data.current;!t||!f||(i(lH({overData:f,activeData:t})),n(null))},[t,i,r]),s=wN(LK,{activationConstraint:{distance:10}}),l=wN(FK,{activationConstraint:{distance:10}}),u=cze(s,l),c=Ije();return W.jsxs(Oje,{onDragStart:o,onDragEnd:a,sensors:u,collisionDetection:Rje,autoScroll:!1,children:[e.children,W.jsx(Aje,{dropAnimation:null,modifiers:[c],style:{width:"min-content",height:"min-content",cursor:"grabbing",userSelect:"none",padding:"10rem"},children:W.jsx(FW,{children:t&&W.jsx(DW.div,{layout:!0,initial:{opacity:0,scale:.7},animate:{opacity:1,scale:1,transition:{duration:.1}},children:W.jsx(Nje,{dragData:t})},"overlay-drag-image")})})]})},Dje=I.memo($je),$N=tl(void 0),DN=tl(void 0),Lje=I.lazy(()=>JD(()=>import("./App-eaffaaa1.js"),["./App-eaffaaa1.js","./MantineProvider-23f4942b.js","./App-6125620a.css"],import.meta.url)),Fje=I.lazy(()=>JD(()=>import("./ThemeLocaleProvider-d93a1448.js"),["./ThemeLocaleProvider-d93a1448.js","./MantineProvider-23f4942b.js","./ThemeLocaleProvider-90f0fcd3.css"],import.meta.url)),Bje=({apiUrl:e,token:t,config:n,headerComponent:r,middleware:i,projectId:o,queueId:a,selectedImage:s,customStarUi:l})=>(I.useEffect(()=>(t&&Jh.set(t),e&&o0.set(e),o&&a0.set(o),a&&Ur.set(a),aG(),i&&i.length>0?UE(mN(),...i):UE(mN()),()=>{o0.set(void 0),Jh.set(void 0),a0.set(void 0),Ur.set(dG)}),[e,t,i,o,a]),I.useEffect(()=>(l&&$N.set(l),()=>{$N.set(void 0)}),[l]),I.useEffect(()=>(r&&DN.set(r),()=>{DN.set(void 0)}),[r]),W.jsx(En.StrictMode,{children:W.jsx(vme,{store:tK,children:W.jsx(En.Suspense,{fallback:W.jsx(NBe,{}),children:W.jsx(Fje,{children:W.jsx(Dje,{children:W.jsx(Lje,{config:n,selectedImage:s})})})})})})),zje=I.memo(Bje);V5.createRoot(document.getElementById("root")).render(W.jsx(zje,{}));export{Oy as $,hi as A,Wa as B,obe as C,Ro as D,Ku as E,xs as F,mHe as G,lA as H,Uke as I,ra as J,Fy as K,VTe as L,NKe as M,IDe as N,Py as O,lbe as P,Oi as Q,Ac as R,Nm as S,ZOe as T,kKe as U,wKe as V,FW as W,DW as X,IOe as Y,Iy as Z,_P as _,GL as a,KT as a$,CKe as a0,EKe as a1,U_ as a2,XM as a3,MTe as a4,TKe as a5,$s as a6,pc as a7,__ as a8,MY as a9,$d as aA,rS as aB,CP as aC,R4 as aD,$A as aE,Z2 as aF,Oke as aG,IGe as aH,bTe as aI,UA as aJ,wH as aK,STe as aL,Uo as aM,jP as aN,tw as aO,sWe as aP,yGe as aQ,OGe as aR,MGe as aS,sGe as aT,oGe as aU,WW as aV,zf as aW,wxe as aX,hG as aY,Wqe as aZ,iHe as a_,En as aa,hq as ab,IKe as ac,$Oe as ad,Hs as ae,IH as af,ew as ag,t$e as ah,HW as ai,AKe as aj,nt as ak,xKe as al,PKe as am,Ii as an,nK as ao,dT as ap,cH as aq,gGe as ar,vy as as,Rz as at,rj as au,_2 as av,_e as aw,mke as ax,Qqe as ay,Gt as az,BS as b,Zje as b$,FA as b0,DWe as b1,wP as b2,OBe as b3,be as b4,wGe as b5,RGe as b6,l0e as b7,mT as b8,Jje as b9,$V as bA,uHe as bB,vGe as bC,bGe as bD,kGe as bE,w_ as bF,SGe as bG,Ru as bH,sv as bI,lHe as bJ,aHe as bK,sHe as bL,Uje as bM,qje as bN,Wje as bO,Kje as bP,Qje as bQ,Jse as bR,_Ue as bS,Lqe as bT,Fqe as bU,eUe as bV,TUe as bW,Yje as bX,gUe as bY,rUe as bZ,UEe as b_,mWe as ba,Yqe as bb,LWe as bc,SWe as bd,q2e as be,Xqe as bf,Jqe as bg,s2e as bh,l2e as bi,hWe as bj,gWe as bk,Zqe as bl,vWe as bm,eWe as bn,pGe as bo,Kqe as bp,IWe as bq,$Ke as br,xGe as bs,yle as bt,BGe as bu,FGe as bv,_Ge as bw,cHe as bx,LKe as by,DKe as bz,OJ as c,EWe as c$,SUe as c0,Xje as c1,OUe as c2,tUe as c3,J8 as c4,nUe as c5,eI as c6,lUe as c7,yUe as c8,nKe as c9,dUe as cA,qqe as cB,pHe as cC,GGe as cD,Dxe as cE,Ne as cF,$N as cG,UGe as cH,zGe as cI,jGe as cJ,f0e as cK,cxe as cL,oG as cM,kB as cN,aGe as cO,sH as cP,CGe as cQ,s0 as cR,fU as cS,SKe as cT,EGe as cU,fv as cV,SE as cW,NWe as cX,TWe as cY,tWe as cZ,nWe as c_,BO as ca,oUe as cb,gHe as cc,eKe as cd,zO as ce,aUe as cf,kv as cg,Ef as ch,zR as ci,qGe as cj,tKe as ck,t4 as cl,sUe as cm,nU as cn,eHe as co,aU as cp,jEe as cq,iUe as cr,q9 as cs,jqe as ct,Uqe as cu,Vqe as cv,uUe as cw,Gqe as cx,cUe as cy,Hqe as cz,voe as d,dHe as d$,jr as d0,uA as d1,Ca as d2,CWe as d3,fUe as d4,NA as d5,kWe as d6,_We as d7,cT as d8,Rqe as d9,hKe as dA,JWe as dB,vKe as dC,ZWe as dD,WHe as dE,KHe as dF,bKe as dG,QHe as dH,yKe as dI,XHe as dJ,YHe as dK,Vse as dL,iKe as dM,ZHe as dN,qse as dO,GHe as dP,BHe as dQ,Iqe as dR,Boe as dS,qS as dT,vUe as dU,g0e as dV,m0e as dW,oHe as dX,fHe as dY,hHe as dZ,pU as d_,Tqe as da,Aqe as db,Nqe as dc,Pqe as dd,Mqe as de,Oqe as df,xEe as dg,tqe as dh,xHe as di,uGe as dj,lGe as dk,EHe as dl,wae as dm,HHe as dn,bHe as dp,zHe as dq,jHe as dr,Hse as ds,UHe as dt,Vje as du,VHe as dv,X2 as dw,Gse as dx,qHe as dy,ly as dz,qF as e,BUe as e$,WS as e0,VUe as e1,zUe as e2,jUe as e3,UUe as e4,Nae as e5,jR as e6,QGe as e7,DGe as e8,NGe as e9,i2e as eA,hke as eB,xB as eC,QWe as eD,HUe as eE,ele as eF,GUe as eG,qa as eH,mUe as eI,PUe as eJ,$ae as eK,Gg as eL,RUe as eM,zqe as eN,CUe as eO,EUe as eP,kUe as eQ,xUe as eR,wUe as eS,Zse as eT,$Ue as eU,NUe as eV,ZUe as eW,vVe as eX,tGe as eY,bVe as eZ,FUe as e_,$Ge as ea,Sc as eb,tI as ec,a0e as ed,UR as ee,Mxe as ef,Oxe as eg,XGe as eh,YGe as ei,ZGe as ej,s0e as ek,JGe as el,iU as em,WGe as en,oU as eo,nHe as ep,rHe as eq,V2 as er,VR as es,tHe as et,VGe as eu,eEe as ev,HGe as ew,rKe as ex,Bqe as ey,hT as ez,ZL as f,DHe as f$,LUe as f0,gT as f1,wWe as f2,AWe as f3,Dqe as f4,_Ke as f5,Dke as f6,cWe as f7,me as f8,xi as f9,oSe as fA,V9 as fB,JU as fC,xy as fD,yHe as fE,Hc as fF,iqe as fG,bWe as fH,Sj as fI,wg as fJ,CHe as fK,SHe as fL,rqe as fM,oqe as fN,fqe as fO,vHe as fP,aqe as fQ,sqe as fR,cGe as fS,M_ as fT,tt as fU,lqe as fV,e2e as fW,Lv as fX,wHe as fY,hqe as fZ,cqe as f_,Vn as fa,Us as fb,YWe as fc,gKe as fd,lKe as fe,aWe as ff,sKe as fg,mKe as fh,pKe as fi,oWe as fj,cKe as fk,uKe as fl,oKe as fm,fKe as fn,Hje as fo,aKe as fp,dKe as fq,Gje as fr,_V as fs,_He as ft,Z3 as fu,tSe as fv,xoe as fw,nqe as fx,AHe as fy,PHe as fz,aF as g,qUe as g$,MHe as g0,OHe as g1,RHe as g2,LHe as g3,dqe as g4,mqe as g5,gqe as g6,kqe as g7,Fke as g8,NHe as g9,xWe as gA,RWe as gB,MWe as gC,qc as gD,mG as gE,hQ as gF,Rt as gG,IVe as gH,QVe as gI,KVe as gJ,pVe as gK,BVe as gL,YVe as gM,Nxe as gN,sVe as gO,EVe as gP,rg as gQ,xVe as gR,lVe as gS,J2 as gT,CVe as gU,iVe as gV,wVe as gW,oVe as gX,cVe as gY,KUe as gZ,WUe as g_,$He as ga,$qe as gb,yqe as gc,pqe as gd,bqe as ge,K_e as gf,XWe as gg,HB as gh,LO as gi,Qt as gj,JSe as gk,g0 as gl,sc as gm,Eqe as gn,_qe as go,Cqe as gp,Sqe as gq,vqe as gr,uqe as gs,wqe as gt,MV as gu,jWe as gv,FWe as gw,BWe as gx,zWe as gy,$We as gz,mp as h,vOe as h$,XVe as h0,yae as h1,eB as h2,wB as h3,Jh as h4,ile as h5,JUe as h6,eVe as h7,tVe as h8,WVe as h9,NVe as hA,$Ve as hB,nGe as hC,UVe as hD,rGe as hE,SVe as hF,_Ve as hG,rVe as hH,nVe as hI,eGe as hJ,YUe as hK,gVe as hL,Ixe as hM,kxe as hN,Axe as hO,Pxe as hP,KWe as hQ,lWe as hR,uWe as hS,TGe as hT,Z as hU,Oae as hV,Sxe as hW,DN as hX,AH as hY,GA as hZ,Ds as h_,fVe as ha,dVe as hb,sle as hc,qVe as hd,Rxe as he,lle as hf,OA as hg,J3e as hh,mVe as hi,RVe as hj,PVe as hk,kVe as hl,QUe as hm,XUe as hn,iGe as ho,VWe as hp,UWe as hq,FVe as hr,MVe as hs,OVe as ht,Txe as hu,hVe as hv,aVe as hw,HVe as hx,GVe as hy,DVe as hz,doe as i,WOe as i0,RKe as i1,LTe as i2,MKe as i3,RDe as i4,$Fe as i5,DFe as i6,RTe as i7,ay as j,Xr as k,oy as l,ny as m,Io as n,US as o,Zk as p,XL as q,iT as r,BF as s,iy as t,Rae as u,I as v,W as w,Ta as x,br as y,yh as z}; + `},sze={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was moved over droppable area "+n.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was dropped over droppable area "+n.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function lze(e){let{announcements:t=sze,container:n,hiddenTextDescribedById:r,screenReaderInstructions:i=aze}=e;const{announce:o,announcement:a}=rze(),s=yw("DndLiveRegion"),[l,u]=I.useState(!1);if(I.useEffect(()=>{u(!0)},[]),ize(I.useMemo(()=>({onDragStart(d){let{active:f}=d;o(t.onDragStart({active:f}))},onDragMove(d){let{active:f,over:h}=d;t.onDragMove&&o(t.onDragMove({active:f,over:h}))},onDragOver(d){let{active:f,over:h}=d;o(t.onDragOver({active:f,over:h}))},onDragEnd(d){let{active:f,over:h}=d;o(t.onDragEnd({active:f,over:h}))},onDragCancel(d){let{active:f,over:h}=d;o(t.onDragCancel({active:f,over:h}))}}),[o,t])),!l)return null;const c=En.createElement(En.Fragment,null,En.createElement(eze,{id:r,value:i.draggable}),En.createElement(nze,{id:s,announcement:a}));return n?Uo.createPortal(c,n):c}var Hr;(function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"})(Hr||(Hr={}));function uS(){}function xN(e,t){return I.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function uze(){for(var e=arguments.length,t=new Array(e),n=0;n[...t].filter(r=>r!=null),[...t])}const us=Object.freeze({x:0,y:0});function cze(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function dze(e,t){const n=$0(e);if(!n)return"0 0";const r={x:(n.x-t.left)/t.width*100,y:(n.y-t.top)/t.height*100};return r.x+"% "+r.y+"%"}function fze(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function hze(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function pze(e){let{left:t,top:n,height:r,width:i}=e;return[{x:t,y:n},{x:t+i,y:n},{x:t,y:n+r},{x:t+i,y:n+r}]}function gze(e,t){if(!e||e.length===0)return null;const[n]=e;return t?n[t]:n}function mze(e,t){const n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),i=Math.min(t.left+t.width,e.left+e.width),o=Math.min(t.top+t.height,e.top+e.height),a=i-r,s=o-n;if(r{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const i=[];for(const o of r){const{id:a}=o,s=n.get(a);if(s){const l=mze(s,t);l>0&&i.push({id:a,data:{droppableContainer:o,value:l}})}}return i.sort(hze)};function vze(e,t){const{top:n,left:r,bottom:i,right:o}=t;return n<=e.y&&e.y<=i&&r<=e.x&&e.x<=o}const bze=e=>{let{droppableContainers:t,droppableRects:n,pointerCoordinates:r}=e;if(!r)return[];const i=[];for(const o of t){const{id:a}=o,s=n.get(a);if(s&&vze(r,s)){const u=pze(s).reduce((d,f)=>d+cze(r,f),0),c=Number((u/4).toFixed(4));i.push({id:a,data:{droppableContainer:o,value:c}})}}return i.sort(fze)};function _ze(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function wK(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:us}function Sze(e){return function(n){for(var r=arguments.length,i=new Array(r>1?r-1:0),o=1;o({...a,top:a.top+e*s.y,bottom:a.bottom+e*s.y,left:a.left+e*s.x,right:a.right+e*s.x}),{...n})}}const xze=Sze(1);function CK(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function wze(e,t,n){const r=CK(t);if(!r)return e;const{scaleX:i,scaleY:o,x:a,y:s}=r,l=e.left-a-(1-i)*parseFloat(n),u=e.top-s-(1-o)*parseFloat(n.slice(n.indexOf(" ")+1)),c=i?e.width/i:e.width,d=o?e.height/o:e.height;return{width:c,height:d,top:u,right:l+c,bottom:u+d,left:l}}const Cze={ignoreTransform:!1};function jy(e,t){t===void 0&&(t=Cze);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:u,transformOrigin:c}=uo(e).getComputedStyle(e);u&&(n=wze(n,u,c))}const{top:r,left:i,width:o,height:a,bottom:s,right:l}=n;return{top:r,left:i,width:o,height:a,bottom:s,right:l}}function wN(e){return jy(e,{ignoreTransform:!0})}function Eze(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function kze(e,t){return t===void 0&&(t=uo(e).getComputedStyle(e)),t.position==="fixed"}function Tze(e,t){t===void 0&&(t=uo(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(i=>{const o=t[i];return typeof o=="string"?n.test(o):!1})}function MP(e,t){const n=[];function r(i){if(t!=null&&n.length>=t||!i)return n;if(RP(i)&&i.scrollingElement!=null&&!n.includes(i.scrollingElement))return n.push(i.scrollingElement),n;if(!By(i)||KBe(i)||n.includes(i))return n;const o=uo(e).getComputedStyle(i);return i!==e&&Tze(i,o)&&n.push(i),kze(i,o)?n:r(i.parentNode)}return e?r(e):n}function EK(e){const[t]=MP(e,1);return t??null}function B5(e){return!gw||!e?null:Ip(e)?e:IP(e)?RP(e)||e===Rp(e).scrollingElement?window:By(e)?e:null:null}function kK(e){return Ip(e)?e.scrollX:e.scrollLeft}function TK(e){return Ip(e)?e.scrollY:e.scrollTop}function j4(e){return{x:kK(e),y:TK(e)}}var ui;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(ui||(ui={}));function AK(e){return!gw||!e?!1:e===document.scrollingElement}function PK(e){const t={x:0,y:0},n=AK(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height},i=e.scrollTop<=t.y,o=e.scrollLeft<=t.x,a=e.scrollTop>=r.y,s=e.scrollLeft>=r.x;return{isTop:i,isLeft:o,isBottom:a,isRight:s,maxScroll:r,minScroll:t}}const Aze={x:.2,y:.2};function Pze(e,t,n,r,i){let{top:o,left:a,right:s,bottom:l}=n;r===void 0&&(r=10),i===void 0&&(i=Aze);const{isTop:u,isBottom:c,isLeft:d,isRight:f}=PK(e),h={x:0,y:0},p={x:0,y:0},m={height:t.height*i.y,width:t.width*i.x};return!u&&o<=t.top+m.height?(h.y=ui.Backward,p.y=r*Math.abs((t.top+m.height-o)/m.height)):!c&&l>=t.bottom-m.height&&(h.y=ui.Forward,p.y=r*Math.abs((t.bottom-m.height-l)/m.height)),!f&&s>=t.right-m.width?(h.x=ui.Forward,p.x=r*Math.abs((t.right-m.width-s)/m.width)):!d&&a<=t.left+m.width&&(h.x=ui.Backward,p.x=r*Math.abs((t.left+m.width-a)/m.width)),{direction:h,speed:p}}function Ize(e){if(e===document.scrollingElement){const{innerWidth:o,innerHeight:a}=window;return{top:0,left:0,right:o,bottom:a,width:o,height:a}}const{top:t,left:n,right:r,bottom:i}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:i,width:e.clientWidth,height:e.clientHeight}}function IK(e){return e.reduce((t,n)=>kh(t,j4(n)),us)}function Rze(e){return e.reduce((t,n)=>t+kK(n),0)}function Oze(e){return e.reduce((t,n)=>t+TK(n),0)}function RK(e,t){if(t===void 0&&(t=jy),!e)return;const{top:n,left:r,bottom:i,right:o}=t(e);EK(e)&&(i<=0||o<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const Mze=[["x",["left","right"],Rze],["y",["top","bottom"],Oze]];class NP{constructor(t,n){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const r=MP(n),i=IK(r);this.rect={...t},this.width=t.width,this.height=t.height;for(const[o,a,s]of Mze)for(const l of a)Object.defineProperty(this,l,{get:()=>{const u=s(r),c=i[o]-u;return this.rect[l]+c},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class om{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var r;return(r=this.target)==null?void 0:r.removeEventListener(...n)})},this.target=t}add(t,n,r){var i;(i=this.target)==null||i.addEventListener(t,n,r),this.listeners.push([t,n,r])}}function Nze(e){const{EventTarget:t}=uo(e);return e instanceof t?e:Rp(e)}function z5(e,t){const n=Math.abs(e.x),r=Math.abs(e.y);return typeof t=="number"?Math.sqrt(n**2+r**2)>t:"x"in t&&"y"in t?n>t.x&&r>t.y:"x"in t?n>t.x:"y"in t?r>t.y:!1}var ha;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(ha||(ha={}));function CN(e){e.preventDefault()}function $ze(e){e.stopPropagation()}var On;(function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter"})(On||(On={}));const OK={start:[On.Space,On.Enter],cancel:[On.Esc],end:[On.Space,On.Enter]},Dze=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case On.Right:return{...n,x:n.x+25};case On.Left:return{...n,x:n.x-25};case On.Down:return{...n,y:n.y+25};case On.Up:return{...n,y:n.y-25}}};class MK{constructor(t){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=t;const{event:{target:n}}=t;this.props=t,this.listeners=new om(Rp(n)),this.windowListeners=new om(uo(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(ha.Resize,this.handleCancel),this.windowListeners.add(ha.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(ha.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,r=t.node.current;r&&RK(r),n(us)}handleKeyDown(t){if(OP(t)){const{active:n,context:r,options:i}=this.props,{keyboardCodes:o=OK,coordinateGetter:a=Dze,scrollBehavior:s="smooth"}=i,{code:l}=t;if(o.end.includes(l)){this.handleEnd(t);return}if(o.cancel.includes(l)){this.handleCancel(t);return}const{collisionRect:u}=r.current,c=u?{x:u.left,y:u.top}:us;this.referenceCoordinates||(this.referenceCoordinates=c);const d=a(t,{active:n,context:r.current,currentCoordinates:c});if(d){const f=lS(d,c),h={x:0,y:0},{scrollableAncestors:p}=r.current;for(const m of p){const _=t.code,{isTop:b,isRight:v,isLeft:g,isBottom:y,maxScroll:S,minScroll:w}=PK(m),x=Ize(m),C={x:Math.min(_===On.Right?x.right-x.width/2:x.right,Math.max(_===On.Right?x.left:x.left+x.width/2,d.x)),y:Math.min(_===On.Down?x.bottom-x.height/2:x.bottom,Math.max(_===On.Down?x.top:x.top+x.height/2,d.y))},T=_===On.Right&&!v||_===On.Left&&!g,k=_===On.Down&&!y||_===On.Up&&!b;if(T&&C.x!==d.x){const P=m.scrollLeft+f.x,$=_===On.Right&&P<=S.x||_===On.Left&&P>=w.x;if($&&!f.y){m.scrollTo({left:P,behavior:s});return}$?h.x=m.scrollLeft-P:h.x=_===On.Right?m.scrollLeft-S.x:m.scrollLeft-w.x,h.x&&m.scrollBy({left:-h.x,behavior:s});break}else if(k&&C.y!==d.y){const P=m.scrollTop+f.y,$=_===On.Down&&P<=S.y||_===On.Up&&P>=w.y;if($&&!f.x){m.scrollTo({top:P,behavior:s});return}$?h.y=m.scrollTop-P:h.y=_===On.Down?m.scrollTop-S.y:m.scrollTop-w.y,h.y&&m.scrollBy({top:-h.y,behavior:s});break}}this.handleMove(t,kh(lS(d,this.referenceCoordinates),h))}}}handleMove(t,n){const{onMove:r}=this.props;t.preventDefault(),r(n)}handleEnd(t){const{onEnd:n}=this.props;t.preventDefault(),this.detach(),n()}handleCancel(t){const{onCancel:n}=this.props;t.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}MK.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:r=OK,onActivation:i}=t,{active:o}=n;const{code:a}=e.nativeEvent;if(r.start.includes(a)){const s=o.activatorNode.current;return s&&e.target!==s?!1:(e.preventDefault(),i==null||i({event:e.nativeEvent}),!0)}return!1}}];function EN(e){return!!(e&&"distance"in e)}function kN(e){return!!(e&&"delay"in e)}class $P{constructor(t,n,r){var i;r===void 0&&(r=Nze(t.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=t,this.events=n;const{event:o}=t,{target:a}=o;this.props=t,this.events=n,this.document=Rp(a),this.documentListeners=new om(this.document),this.listeners=new om(r),this.windowListeners=new om(uo(a)),this.initialCoordinates=(i=$0(o))!=null?i:us,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:t,props:{options:{activationConstraint:n}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),this.windowListeners.add(ha.Resize,this.handleCancel),this.windowListeners.add(ha.DragStart,CN),this.windowListeners.add(ha.VisibilityChange,this.handleCancel),this.windowListeners.add(ha.ContextMenu,CN),this.documentListeners.add(ha.Keydown,this.handleKeydown),n){if(EN(n))return;if(kN(n)){this.timeoutId=setTimeout(this.handleStart,n.delay);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handleStart(){const{initialCoordinates:t}=this,{onStart:n}=this.props;t&&(this.activated=!0,this.documentListeners.add(ha.Click,$ze,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(ha.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){var n;const{activated:r,initialCoordinates:i,props:o}=this,{onMove:a,options:{activationConstraint:s}}=o;if(!i)return;const l=(n=$0(t))!=null?n:us,u=lS(i,l);if(!r&&s){if(kN(s))return z5(u,s.tolerance)?this.handleCancel():void 0;if(EN(s))return s.tolerance!=null&&z5(u,s.tolerance)?this.handleCancel():z5(u,s.distance)?this.handleStart():void 0}t.cancelable&&t.preventDefault(),a(l)}handleEnd(){const{onEnd:t}=this.props;this.detach(),t()}handleCancel(){const{onCancel:t}=this.props;this.detach(),t()}handleKeydown(t){t.code===On.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const Lze={move:{name:"pointermove"},end:{name:"pointerup"}};class NK extends $P{constructor(t){const{event:n}=t,r=Rp(n.target);super(t,Lze,r)}}NK.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r==null||r({event:n}),!0)}}];const Fze={move:{name:"mousemove"},end:{name:"mouseup"}};var U4;(function(e){e[e.RightClick=2]="RightClick"})(U4||(U4={}));class $K extends $P{constructor(t){super(t,Fze,Rp(t.event.target))}}$K.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===U4.RightClick?!1:(r==null||r({event:n}),!0)}}];const j5={move:{name:"touchmove"},end:{name:"touchend"}};class DK extends $P{constructor(t){super(t,j5)}static setup(){return window.addEventListener(j5.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(j5.move.name,t)};function t(){}}}DK.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;const{touches:i}=n;return i.length>1?!1:(r==null||r({event:n}),!0)}}];var am;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(am||(am={}));var cS;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(cS||(cS={}));function Bze(e){let{acceleration:t,activator:n=am.Pointer,canScroll:r,draggingRect:i,enabled:o,interval:a=5,order:s=cS.TreeOrder,pointerCoordinates:l,scrollableAncestors:u,scrollableAncestorRects:c,delta:d,threshold:f}=e;const h=jze({delta:d,disabled:!o}),[p,m]=QBe(),_=I.useRef({x:0,y:0}),b=I.useRef({x:0,y:0}),v=I.useMemo(()=>{switch(n){case am.Pointer:return l?{top:l.y,bottom:l.y,left:l.x,right:l.x}:null;case am.DraggableRect:return i}},[n,i,l]),g=I.useRef(null),y=I.useCallback(()=>{const w=g.current;if(!w)return;const x=_.current.x*b.current.x,C=_.current.y*b.current.y;w.scrollBy(x,C)},[]),S=I.useMemo(()=>s===cS.TreeOrder?[...u].reverse():u,[s,u]);I.useEffect(()=>{if(!o||!u.length||!v){m();return}for(const w of S){if((r==null?void 0:r(w))===!1)continue;const x=u.indexOf(w),C=c[x];if(!C)continue;const{direction:T,speed:k}=Pze(w,C,v,t,f);for(const P of["x","y"])h[P][T[P]]||(k[P]=0,T[P]=0);if(k.x>0||k.y>0){m(),g.current=w,p(y,a),_.current=k,b.current=T;return}}_.current={x:0,y:0},b.current={x:0,y:0},m()},[t,y,r,m,o,a,JSON.stringify(v),JSON.stringify(h),p,u,S,c,JSON.stringify(f)])}const zze={x:{[ui.Backward]:!1,[ui.Forward]:!1},y:{[ui.Backward]:!1,[ui.Forward]:!1}};function jze(e){let{delta:t,disabled:n}=e;const r=sS(t);return zy(i=>{if(n||!r||!i)return zze;const o={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[ui.Backward]:i.x[ui.Backward]||o.x===-1,[ui.Forward]:i.x[ui.Forward]||o.x===1},y:{[ui.Backward]:i.y[ui.Backward]||o.y===-1,[ui.Forward]:i.y[ui.Forward]||o.y===1}}},[n,t,r])}function Uze(e,t){const n=t!==null?e.get(t):void 0,r=n?n.node.current:null;return zy(i=>{var o;return t===null?null:(o=r??i)!=null?o:null},[r,t])}function Vze(e,t){return I.useMemo(()=>e.reduce((n,r)=>{const{sensor:i}=r,o=i.activators.map(a=>({eventName:a.eventName,handler:t(a.handler,r)}));return[...n,...o]},[]),[e,t])}var L0;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(L0||(L0={}));var V4;(function(e){e.Optimized="optimized"})(V4||(V4={}));const TN=new Map;function Gze(e,t){let{dragging:n,dependencies:r,config:i}=t;const[o,a]=I.useState(null),{frequency:s,measure:l,strategy:u}=i,c=I.useRef(e),d=_(),f=N0(d),h=I.useCallback(function(b){b===void 0&&(b=[]),!f.current&&a(v=>v===null?b:v.concat(b.filter(g=>!v.includes(g))))},[f]),p=I.useRef(null),m=zy(b=>{if(d&&!n)return TN;if(!b||b===TN||c.current!==e||o!=null){const v=new Map;for(let g of e){if(!g)continue;if(o&&o.length>0&&!o.includes(g.id)&&g.rect.current){v.set(g.id,g.rect.current);continue}const y=g.node.current,S=y?new NP(l(y),y):null;g.rect.current=S,S&&v.set(g.id,S)}return v}return b},[e,o,n,d,l]);return I.useEffect(()=>{c.current=e},[e]),I.useEffect(()=>{d||h()},[n,d]),I.useEffect(()=>{o&&o.length>0&&a(null)},[JSON.stringify(o)]),I.useEffect(()=>{d||typeof s!="number"||p.current!==null||(p.current=setTimeout(()=>{h(),p.current=null},s))},[s,d,h,...r]),{droppableRects:m,measureDroppableContainers:h,measuringScheduled:o!=null};function _(){switch(u){case L0.Always:return!1;case L0.BeforeDragging:return n;default:return!n}}}function DP(e,t){return zy(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function Hze(e,t){return DP(e,t)}function qze(e){let{callback:t,disabled:n}=e;const r=mw(t),i=I.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:o}=window;return new o(r)},[r,n]);return I.useEffect(()=>()=>i==null?void 0:i.disconnect(),[i]),i}function vw(e){let{callback:t,disabled:n}=e;const r=mw(t),i=I.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:o}=window;return new o(r)},[n]);return I.useEffect(()=>()=>i==null?void 0:i.disconnect(),[i]),i}function Wze(e){return new NP(jy(e),e)}function AN(e,t,n){t===void 0&&(t=Wze);const[r,i]=I.useReducer(s,null),o=qze({callback(l){if(e)for(const u of l){const{type:c,target:d}=u;if(c==="childList"&&d instanceof HTMLElement&&d.contains(e)){i();break}}}}),a=vw({callback:i});return Zs(()=>{i(),e?(a==null||a.observe(e),o==null||o.observe(document.body,{childList:!0,subtree:!0})):(a==null||a.disconnect(),o==null||o.disconnect())},[e]),r;function s(l){if(!e)return null;if(e.isConnected===!1){var u;return(u=l??n)!=null?u:null}const c=t(e);return JSON.stringify(l)===JSON.stringify(c)?l:c}}function Kze(e){const t=DP(e);return wK(e,t)}const PN=[];function Qze(e){const t=I.useRef(e),n=zy(r=>e?r&&r!==PN&&e&&t.current&&e.parentNode===t.current.parentNode?r:MP(e):PN,[e]);return I.useEffect(()=>{t.current=e},[e]),n}function Xze(e){const[t,n]=I.useState(null),r=I.useRef(e),i=I.useCallback(o=>{const a=B5(o.target);a&&n(s=>s?(s.set(a,j4(a)),new Map(s)):null)},[]);return I.useEffect(()=>{const o=r.current;if(e!==o){a(o);const s=e.map(l=>{const u=B5(l);return u?(u.addEventListener("scroll",i,{passive:!0}),[u,j4(u)]):null}).filter(l=>l!=null);n(s.length?new Map(s):null),r.current=e}return()=>{a(e),a(o)};function a(s){s.forEach(l=>{const u=B5(l);u==null||u.removeEventListener("scroll",i)})}},[i,e]),I.useMemo(()=>e.length?t?Array.from(t.values()).reduce((o,a)=>kh(o,a),us):IK(e):us,[e,t])}function IN(e,t){t===void 0&&(t=[]);const n=I.useRef(null);return I.useEffect(()=>{n.current=null},t),I.useEffect(()=>{const r=e!==us;r&&!n.current&&(n.current=e),!r&&n.current&&(n.current=null)},[e]),n.current?lS(e,n.current):us}function Yze(e){I.useEffect(()=>{if(!gw)return;const t=e.map(n=>{let{sensor:r}=n;return r.setup==null?void 0:r.setup()});return()=>{for(const n of t)n==null||n()}},e.map(t=>{let{sensor:n}=t;return n}))}function Zze(e,t){return I.useMemo(()=>e.reduce((n,r)=>{let{eventName:i,handler:o}=r;return n[i]=a=>{o(a,t)},n},{}),[e,t])}function LK(e){return I.useMemo(()=>e?Eze(e):null,[e])}const U5=[];function Jze(e,t){t===void 0&&(t=jy);const[n]=e,r=LK(n?uo(n):null),[i,o]=I.useReducer(s,U5),a=vw({callback:o});return e.length>0&&i===U5&&o(),Zs(()=>{e.length?e.forEach(l=>a==null?void 0:a.observe(l)):(a==null||a.disconnect(),o())},[e]),i;function s(){return e.length?e.map(l=>AK(l)?r:new NP(t(l),l)):U5}}function FK(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return By(t)?t:e}function eje(e){let{measure:t}=e;const[n,r]=I.useState(null),i=I.useCallback(u=>{for(const{target:c}of u)if(By(c)){r(d=>{const f=t(c);return d?{...d,width:f.width,height:f.height}:f});break}},[t]),o=vw({callback:i}),a=I.useCallback(u=>{const c=FK(u);o==null||o.disconnect(),c&&(o==null||o.observe(c)),r(c?t(c):null)},[t,o]),[s,l]=aS(a);return I.useMemo(()=>({nodeRef:s,rect:n,setRef:l}),[n,s,l])}const tje=[{sensor:NK,options:{}},{sensor:MK,options:{}}],nje={current:{}},cb={draggable:{measure:wN},droppable:{measure:wN,strategy:L0.WhileDragging,frequency:V4.Optimized},dragOverlay:{measure:jy}};class sm extends Map{get(t){var n;return t!=null&&(n=super.get(t))!=null?n:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:n}=t;return!n})}getNodeFor(t){var n,r;return(n=(r=this.get(t))==null?void 0:r.node.current)!=null?n:void 0}}const rje={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new sm,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:uS},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:cb,measureDroppableContainers:uS,windowRect:null,measuringScheduled:!1},BK={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:uS,draggableNodes:new Map,over:null,measureDroppableContainers:uS},Uy=I.createContext(BK),zK=I.createContext(rje);function ije(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new sm}}}function oje(e,t){switch(t.type){case Hr.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case Hr.DragMove:return e.draggable.active?{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}}:e;case Hr.DragEnd:case Hr.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case Hr.RegisterDroppable:{const{element:n}=t,{id:r}=n,i=new sm(e.droppable.containers);return i.set(r,n),{...e,droppable:{...e.droppable,containers:i}}}case Hr.SetDroppableDisabled:{const{id:n,key:r,disabled:i}=t,o=e.droppable.containers.get(n);if(!o||r!==o.key)return e;const a=new sm(e.droppable.containers);return a.set(n,{...o,disabled:i}),{...e,droppable:{...e.droppable,containers:a}}}case Hr.UnregisterDroppable:{const{id:n,key:r}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;const o=new sm(e.droppable.containers);return o.delete(n),{...e,droppable:{...e.droppable,containers:o}}}default:return e}}function aje(e){let{disabled:t}=e;const{active:n,activatorEvent:r,draggableNodes:i}=I.useContext(Uy),o=sS(r),a=sS(n==null?void 0:n.id);return I.useEffect(()=>{if(!t&&!r&&o&&a!=null){if(!OP(o)||document.activeElement===o.target)return;const s=i.get(a);if(!s)return;const{activatorNode:l,node:u}=s;if(!l.current&&!u.current)return;requestAnimationFrame(()=>{for(const c of[l.current,u.current]){if(!c)continue;const d=ZBe(c);if(d){d.focus();break}}})}},[r,t,i,a,o]),null}function jK(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((i,o)=>o({transform:i,...r}),n):n}function sje(e){return I.useMemo(()=>({draggable:{...cb.draggable,...e==null?void 0:e.draggable},droppable:{...cb.droppable,...e==null?void 0:e.droppable},dragOverlay:{...cb.dragOverlay,...e==null?void 0:e.dragOverlay}}),[e==null?void 0:e.draggable,e==null?void 0:e.droppable,e==null?void 0:e.dragOverlay])}function lje(e){let{activeNode:t,measure:n,initialRect:r,config:i=!0}=e;const o=I.useRef(!1),{x:a,y:s}=typeof i=="boolean"?{x:i,y:i}:i;Zs(()=>{if(!a&&!s||!t){o.current=!1;return}if(o.current||!r)return;const u=t==null?void 0:t.node.current;if(!u||u.isConnected===!1)return;const c=n(u),d=wK(c,r);if(a||(d.x=0),s||(d.y=0),o.current=!0,Math.abs(d.x)>0||Math.abs(d.y)>0){const f=EK(u);f&&f.scrollBy({top:d.y,left:d.x})}},[t,a,s,r,n])}const bw=I.createContext({...us,scaleX:1,scaleY:1});var _u;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(_u||(_u={}));const uje=I.memo(function(t){var n,r,i,o;let{id:a,accessibility:s,autoScroll:l=!0,children:u,sensors:c=tje,collisionDetection:d=yze,measuring:f,modifiers:h,...p}=t;const m=I.useReducer(oje,void 0,ije),[_,b]=m,[v,g]=oze(),[y,S]=I.useState(_u.Uninitialized),w=y===_u.Initialized,{draggable:{active:x,nodes:C,translate:T},droppable:{containers:k}}=_,P=x?C.get(x):null,$=I.useRef({initial:null,translated:null}),O=I.useMemo(()=>{var Bn;return x!=null?{id:x,data:(Bn=P==null?void 0:P.data)!=null?Bn:nje,rect:$}:null},[x,P]),E=I.useRef(null),[A,D]=I.useState(null),[L,M]=I.useState(null),R=N0(p,Object.values(p)),N=yw("DndDescribedBy",a),B=I.useMemo(()=>k.getEnabled(),[k]),U=sje(f),{droppableRects:G,measureDroppableContainers:Y,measuringScheduled:ee}=Gze(B,{dragging:w,dependencies:[T.x,T.y],config:U.droppable}),J=Uze(C,x),j=I.useMemo(()=>L?$0(L):null,[L]),Q=al(),ne=Hze(J,U.draggable.measure);lje({activeNode:x?C.get(x):null,config:Q.layoutShiftCompensation,initialRect:ne,measure:U.draggable.measure});const se=AN(J,U.draggable.measure,ne),ve=AN(J?J.parentElement:null),ce=I.useRef({activatorEvent:null,active:null,activeNode:J,collisionRect:null,collisions:null,droppableRects:G,draggableNodes:C,draggingNode:null,draggingNodeRect:null,droppableContainers:k,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),bt=k.getNodeFor((n=ce.current.over)==null?void 0:n.id),ot=eje({measure:U.dragOverlay.measure}),ze=(r=ot.nodeRef.current)!=null?r:J,gt=w?(i=ot.rect)!=null?i:se:null,Pe=!!(ot.nodeRef.current&&ot.rect),Jt=Kze(Pe?null:se),Ar=LK(ze?uo(ze):null),Dn=Qze(w?bt??J:null),Tn=Jze(Dn),en=jK(h,{transform:{x:T.x-Jt.x,y:T.y-Jt.y,scaleX:1,scaleY:1},activatorEvent:L,active:O,activeNodeRect:se,containerNodeRect:ve,draggingNodeRect:gt,over:ce.current.over,overlayNodeRect:ot.rect,scrollableAncestors:Dn,scrollableAncestorRects:Tn,windowRect:Ar}),Ln=j?kh(j,T):null,Pr=Xze(Dn),co=IN(Pr),Jr=IN(Pr,[se]),hr=kh(en,co),Fr=gt?xze(gt,en):null,ei=O&&Fr?d({active:O,collisionRect:Fr,droppableRects:G,droppableContainers:B,pointerCoordinates:Ln}):null,Fn=gze(ei,"id"),[bn,Mi]=I.useState(null),pi=Pe?en:kh(en,Jr),Qi=_ze(pi,(o=bn==null?void 0:bn.rect)!=null?o:null,se),$a=I.useCallback((Bn,tn)=>{let{sensor:Br,options:Rr}=tn;if(E.current==null)return;const Or=C.get(E.current);if(!Or)return;const ti=Bn.nativeEvent,Ni=new Br({active:E.current,activeNode:Or,event:ti,options:Rr,context:ce,onStart(gi){const zr=E.current;if(zr==null)return;const Da=C.get(zr);if(!Da)return;const{onDragStart:hs}=R.current,mi={active:{id:zr,data:Da.data,rect:$}};Uo.unstable_batchedUpdates(()=>{hs==null||hs(mi),S(_u.Initializing),b({type:Hr.DragStart,initialCoordinates:gi,active:zr}),v({type:"onDragStart",event:mi})})},onMove(gi){b({type:Hr.DragMove,coordinates:gi})},onEnd:ho(Hr.DragEnd),onCancel:ho(Hr.DragCancel)});Uo.unstable_batchedUpdates(()=>{D(Ni),M(Bn.nativeEvent)});function ho(gi){return async function(){const{active:Da,collisions:hs,over:mi,scrollAdjustedTranslate:nu}=ce.current;let ia=null;if(Da&&nu){const{cancelDrop:ni}=R.current;ia={activatorEvent:ti,active:Da,collisions:hs,delta:nu,over:mi},gi===Hr.DragEnd&&typeof ni=="function"&&await Promise.resolve(ni(ia))&&(gi=Hr.DragCancel)}E.current=null,Uo.unstable_batchedUpdates(()=>{b({type:gi}),S(_u.Uninitialized),Mi(null),D(null),M(null);const ni=gi===Hr.DragEnd?"onDragEnd":"onDragCancel";if(ia){const sl=R.current[ni];sl==null||sl(ia),v({type:ni,event:ia})}})}}},[C]),Ir=I.useCallback((Bn,tn)=>(Br,Rr)=>{const Or=Br.nativeEvent,ti=C.get(Rr);if(E.current!==null||!ti||Or.dndKit||Or.defaultPrevented)return;const Ni={active:ti};Bn(Br,tn.options,Ni)===!0&&(Or.dndKit={capturedBy:tn.sensor},E.current=Rr,$a(Br,tn))},[C,$a]),fo=Vze(c,Ir);Yze(c),Zs(()=>{se&&y===_u.Initializing&&S(_u.Initialized)},[se,y]),I.useEffect(()=>{const{onDragMove:Bn}=R.current,{active:tn,activatorEvent:Br,collisions:Rr,over:Or}=ce.current;if(!tn||!Br)return;const ti={active:tn,activatorEvent:Br,collisions:Rr,delta:{x:hr.x,y:hr.y},over:Or};Uo.unstable_batchedUpdates(()=>{Bn==null||Bn(ti),v({type:"onDragMove",event:ti})})},[hr.x,hr.y]),I.useEffect(()=>{const{active:Bn,activatorEvent:tn,collisions:Br,droppableContainers:Rr,scrollAdjustedTranslate:Or}=ce.current;if(!Bn||E.current==null||!tn||!Or)return;const{onDragOver:ti}=R.current,Ni=Rr.get(Fn),ho=Ni&&Ni.rect.current?{id:Ni.id,rect:Ni.rect.current,data:Ni.data,disabled:Ni.disabled}:null,gi={active:Bn,activatorEvent:tn,collisions:Br,delta:{x:Or.x,y:Or.y},over:ho};Uo.unstable_batchedUpdates(()=>{Mi(ho),ti==null||ti(gi),v({type:"onDragOver",event:gi})})},[Fn]),Zs(()=>{ce.current={activatorEvent:L,active:O,activeNode:J,collisionRect:Fr,collisions:ei,droppableRects:G,draggableNodes:C,draggingNode:ze,draggingNodeRect:gt,droppableContainers:k,over:bn,scrollableAncestors:Dn,scrollAdjustedTranslate:hr},$.current={initial:gt,translated:Fr}},[O,J,ei,Fr,C,ze,gt,G,k,bn,Dn,hr]),Bze({...Q,delta:T,draggingRect:Fr,pointerCoordinates:Ln,scrollableAncestors:Dn,scrollableAncestorRects:Tn});const ol=I.useMemo(()=>({active:O,activeNode:J,activeNodeRect:se,activatorEvent:L,collisions:ei,containerNodeRect:ve,dragOverlay:ot,draggableNodes:C,droppableContainers:k,droppableRects:G,over:bn,measureDroppableContainers:Y,scrollableAncestors:Dn,scrollableAncestorRects:Tn,measuringConfiguration:U,measuringScheduled:ee,windowRect:Ar}),[O,J,se,L,ei,ve,ot,C,k,G,bn,Y,Dn,Tn,U,ee,Ar]),$o=I.useMemo(()=>({activatorEvent:L,activators:fo,active:O,activeNodeRect:se,ariaDescribedById:{draggable:N},dispatch:b,draggableNodes:C,over:bn,measureDroppableContainers:Y}),[L,fo,O,se,b,N,C,bn,Y]);return En.createElement(xK.Provider,{value:g},En.createElement(Uy.Provider,{value:$o},En.createElement(zK.Provider,{value:ol},En.createElement(bw.Provider,{value:Qi},u)),En.createElement(aje,{disabled:(s==null?void 0:s.restoreFocus)===!1})),En.createElement(lze,{...s,hiddenTextDescribedById:N}));function al(){const Bn=(A==null?void 0:A.autoScrollEnabled)===!1,tn=typeof l=="object"?l.enabled===!1:l===!1,Br=w&&!Bn&&!tn;return typeof l=="object"?{...l,enabled:Br}:{enabled:Br}}}),cje=I.createContext(null),RN="button",dje="Droppable";function DKe(e){let{id:t,data:n,disabled:r=!1,attributes:i}=e;const o=yw(dje),{activators:a,activatorEvent:s,active:l,activeNodeRect:u,ariaDescribedById:c,draggableNodes:d,over:f}=I.useContext(Uy),{role:h=RN,roleDescription:p="draggable",tabIndex:m=0}=i??{},_=(l==null?void 0:l.id)===t,b=I.useContext(_?bw:cje),[v,g]=aS(),[y,S]=aS(),w=Zze(a,t),x=N0(n);Zs(()=>(d.set(t,{id:t,key:o,node:v,activatorNode:y,data:x}),()=>{const T=d.get(t);T&&T.key===o&&d.delete(t)}),[d,t]);const C=I.useMemo(()=>({role:h,tabIndex:m,"aria-disabled":r,"aria-pressed":_&&h===RN?!0:void 0,"aria-roledescription":p,"aria-describedby":c.draggable}),[r,h,m,_,p,c.draggable]);return{active:l,activatorEvent:s,activeNodeRect:u,attributes:C,isDragging:_,listeners:r?void 0:w,node:v,over:f,setNodeRef:g,setActivatorNodeRef:S,transform:b}}function fje(){return I.useContext(zK)}const hje="Droppable",pje={timeout:25};function LKe(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:i}=e;const o=yw(hje),{active:a,dispatch:s,over:l,measureDroppableContainers:u}=I.useContext(Uy),c=I.useRef({disabled:n}),d=I.useRef(!1),f=I.useRef(null),h=I.useRef(null),{disabled:p,updateMeasurementsFor:m,timeout:_}={...pje,...i},b=N0(m??r),v=I.useCallback(()=>{if(!d.current){d.current=!0;return}h.current!=null&&clearTimeout(h.current),h.current=setTimeout(()=>{u(Array.isArray(b.current)?b.current:[b.current]),h.current=null},_)},[_]),g=vw({callback:v,disabled:p||!a}),y=I.useCallback((C,T)=>{g&&(T&&(g.unobserve(T),d.current=!1),C&&g.observe(C))},[g]),[S,w]=aS(y),x=N0(t);return I.useEffect(()=>{!g||!S.current||(g.disconnect(),d.current=!1,g.observe(S.current))},[S,g]),Zs(()=>(s({type:Hr.RegisterDroppable,element:{id:r,key:o,disabled:n,node:S,rect:f,data:x}}),()=>s({type:Hr.UnregisterDroppable,key:o,id:r})),[r]),I.useEffect(()=>{n!==c.current.disabled&&(s({type:Hr.SetDroppableDisabled,id:r,key:o,disabled:n}),c.current.disabled=n)},[r,o,n,s]),{active:a,rect:f,isOver:(l==null?void 0:l.id)===r,node:S,over:l,setNodeRef:w}}function gje(e){let{animation:t,children:n}=e;const[r,i]=I.useState(null),[o,a]=I.useState(null),s=sS(n);return!n&&!r&&s&&i(s),Zs(()=>{if(!o)return;const l=r==null?void 0:r.key,u=r==null?void 0:r.props.id;if(l==null||u==null){i(null);return}Promise.resolve(t(u,o)).then(()=>{i(null)})},[t,r,o]),En.createElement(En.Fragment,null,n,r?I.cloneElement(r,{ref:a}):null)}const mje={x:0,y:0,scaleX:1,scaleY:1};function yje(e){let{children:t}=e;return En.createElement(Uy.Provider,{value:BK},En.createElement(bw.Provider,{value:mje},t))}const vje={position:"fixed",touchAction:"none"},bje=e=>OP(e)?"transform 250ms ease":void 0,_je=I.forwardRef((e,t)=>{let{as:n,activatorEvent:r,adjustScale:i,children:o,className:a,rect:s,style:l,transform:u,transition:c=bje}=e;if(!s)return null;const d=i?u:{...u,scaleX:1,scaleY:1},f={...vje,width:s.width,height:s.height,top:s.top,left:s.left,transform:D0.Transform.toString(d),transformOrigin:i&&r?dze(r,s):void 0,transition:typeof c=="function"?c(r):c,...l};return En.createElement(n,{className:a,style:f,ref:t},o)}),Sje=e=>t=>{let{active:n,dragOverlay:r}=t;const i={},{styles:o,className:a}=e;if(o!=null&&o.active)for(const[s,l]of Object.entries(o.active))l!==void 0&&(i[s]=n.node.style.getPropertyValue(s),n.node.style.setProperty(s,l));if(o!=null&&o.dragOverlay)for(const[s,l]of Object.entries(o.dragOverlay))l!==void 0&&r.node.style.setProperty(s,l);return a!=null&&a.active&&n.node.classList.add(a.active),a!=null&&a.dragOverlay&&r.node.classList.add(a.dragOverlay),function(){for(const[l,u]of Object.entries(i))n.node.style.setProperty(l,u);a!=null&&a.active&&n.node.classList.remove(a.active)}},xje=e=>{let{transform:{initial:t,final:n}}=e;return[{transform:D0.Transform.toString(t)},{transform:D0.Transform.toString(n)}]},wje={duration:250,easing:"ease",keyframes:xje,sideEffects:Sje({styles:{active:{opacity:"0"}}})};function Cje(e){let{config:t,draggableNodes:n,droppableContainers:r,measuringConfiguration:i}=e;return mw((o,a)=>{if(t===null)return;const s=n.get(o);if(!s)return;const l=s.node.current;if(!l)return;const u=FK(a);if(!u)return;const{transform:c}=uo(a).getComputedStyle(a),d=CK(c);if(!d)return;const f=typeof t=="function"?t:Eje(t);return RK(l,i.draggable.measure),f({active:{id:o,data:s.data,node:l,rect:i.draggable.measure(l)},draggableNodes:n,dragOverlay:{node:a,rect:i.dragOverlay.measure(u)},droppableContainers:r,measuringConfiguration:i,transform:d})})}function Eje(e){const{duration:t,easing:n,sideEffects:r,keyframes:i}={...wje,...e};return o=>{let{active:a,dragOverlay:s,transform:l,...u}=o;if(!t)return;const c={x:s.rect.left-a.rect.left,y:s.rect.top-a.rect.top},d={scaleX:l.scaleX!==1?a.rect.width*l.scaleX/s.rect.width:1,scaleY:l.scaleY!==1?a.rect.height*l.scaleY/s.rect.height:1},f={x:l.x-c.x,y:l.y-c.y,...d},h=i({...u,active:a,dragOverlay:s,transform:{initial:l,final:f}}),[p]=h,m=h[h.length-1];if(JSON.stringify(p)===JSON.stringify(m))return;const _=r==null?void 0:r({active:a,dragOverlay:s,...u}),b=s.node.animate(h,{duration:t,easing:n,fill:"forwards"});return new Promise(v=>{b.onfinish=()=>{_==null||_(),v()}})}}let ON=0;function kje(e){return I.useMemo(()=>{if(e!=null)return ON++,ON},[e])}const Tje=En.memo(e=>{let{adjustScale:t=!1,children:n,dropAnimation:r,style:i,transition:o,modifiers:a,wrapperElement:s="div",className:l,zIndex:u=999}=e;const{activatorEvent:c,active:d,activeNodeRect:f,containerNodeRect:h,draggableNodes:p,droppableContainers:m,dragOverlay:_,over:b,measuringConfiguration:v,scrollableAncestors:g,scrollableAncestorRects:y,windowRect:S}=fje(),w=I.useContext(bw),x=kje(d==null?void 0:d.id),C=jK(a,{activatorEvent:c,active:d,activeNodeRect:f,containerNodeRect:h,draggingNodeRect:_.rect,over:b,overlayNodeRect:_.rect,scrollableAncestors:g,scrollableAncestorRects:y,transform:w,windowRect:S}),T=DP(f),k=Cje({config:r,draggableNodes:p,droppableContainers:m,measuringConfiguration:v}),P=T?_.setRef:void 0;return En.createElement(yje,null,En.createElement(gje,{animation:k},d&&x?En.createElement(_je,{key:x,id:d.id,ref:P,as:s,activatorEvent:c,adjustScale:t,className:l,transition:o,rect:T,style:{zIndex:u,...i},transform:C},n):null))}),Aje=Ii([eK,NA],({nodes:e},t)=>t==="nodes"?e.viewport.zoom:1),Pje=()=>{const e=lH(Aje);return I.useCallback(({activatorEvent:n,draggingNodeRect:r,transform:i})=>{if(r&&n){const o=$0(n);if(!o)return i;const a=o.x-r.left,s=o.y-r.top,l=i.x+a-r.width/2,u=i.y+s-r.height/2,c=i.scaleX*e,d=i.scaleY*e;return{x:l,y:u,scaleX:c,scaleY:d}}return i},[e])},Ije=e=>{if(!e.pointerCoordinates)return[];const t=document.elementsFromPoint(e.pointerCoordinates.x,e.pointerCoordinates.y),n=e.droppableContainers.filter(r=>r.node.current?t.includes(r.node.current):!1);return bze({...e,droppableContainers:n})};function Rje(e){return W.jsx(uje,{...e})}const y1=28,MN={w:y1,h:y1,maxW:y1,maxH:y1,shadow:"dark-lg",borderRadius:"lg",opacity:.3,bg:"base.800",color:"base.50",_dark:{borderColor:"base.200",bg:"base.900",color:"base.100"}},Oje=e=>{if(!e.dragData)return null;if(e.dragData.payloadType==="NODE_FIELD"){const{field:t,fieldTemplate:n}=e.dragData.payload;return W.jsx(rS,{sx:{position:"relative",p:2,px:3,opacity:.7,bg:"base.300",borderRadius:"base",boxShadow:"dark-lg",whiteSpace:"nowrap",fontSize:"sm"},children:W.jsx(HW,{children:t.label||n.title})})}if(e.dragData.payloadType==="IMAGE_DTO"){const{thumbnail_url:t,width:n,height:r}=e.dragData.payload.imageDTO;return W.jsx(rS,{sx:{position:"relative",width:"full",height:"full",display:"flex",alignItems:"center",justifyContent:"center"},children:W.jsx(xP,{sx:{...MN},objectFit:"contain",src:t,width:n,height:r})})}return e.dragData.payloadType==="IMAGE_DTOS"?W.jsxs(wP,{sx:{position:"relative",alignItems:"center",justifyContent:"center",flexDir:"column",...MN},children:[W.jsx(I4,{children:e.dragData.payload.imageDTOs.length}),W.jsx(I4,{size:"sm",children:"Images"})]}):null},Mje=I.memo(Oje),Nje=e=>{const[t,n]=I.useState(null),r=Ce("images"),i=gke(),o=I.useCallback(d=>{r.trace({dragData:Qt(d.active.data.current)},"Drag started");const f=d.active.data.current;f&&n(f)},[r]),a=I.useCallback(d=>{var h;r.trace({dragData:Qt(d.active.data.current)},"Drag ended");const f=(h=d.over)==null?void 0:h.data.current;!t||!f||(i(aH({overData:f,activeData:t})),n(null))},[t,i,r]),s=xN($K,{activationConstraint:{distance:10}}),l=xN(DK,{activationConstraint:{distance:10}}),u=uze(s,l),c=Pje();return W.jsxs(Rje,{onDragStart:o,onDragEnd:a,sensors:u,collisionDetection:Ije,autoScroll:!1,children:[e.children,W.jsx(Tje,{dropAnimation:null,modifiers:[c],style:{width:"min-content",height:"min-content",cursor:"grabbing",userSelect:"none",padding:"10rem"},children:W.jsx(DW,{children:t&&W.jsx(NW.div,{layout:!0,initial:{opacity:0,scale:.7},animate:{opacity:1,scale:1,transition:{duration:.1}},children:W.jsx(Mje,{dragData:t})},"overlay-drag-image")})})]})},$je=I.memo(Nje),NN=tl(void 0),$N=tl(void 0),Dje=I.lazy(()=>ZD(()=>import("./App-ba2d118a.js"),["./App-ba2d118a.js","./MantineProvider-a057bfc9.js","./App-6125620a.css"],import.meta.url)),Lje=I.lazy(()=>ZD(()=>import("./ThemeLocaleProvider-632b3401.js"),["./ThemeLocaleProvider-632b3401.js","./MantineProvider-a057bfc9.js","./ThemeLocaleProvider-90f0fcd3.css"],import.meta.url)),Fje=({apiUrl:e,token:t,config:n,headerComponent:r,middleware:i,projectId:o,queueId:a,selectedImage:s,customStarUi:l})=>(I.useEffect(()=>(t&&Zh.set(t),e&&o0.set(e),o&&a0.set(o),a&&Ur.set(a),iG(),i&&i.length>0?UE(gN(),...i):UE(gN()),()=>{o0.set(void 0),Zh.set(void 0),a0.set(void 0),Ur.set(uG)}),[e,t,i,o,a]),I.useEffect(()=>(l&&NN.set(l),()=>{NN.set(void 0)}),[l]),I.useEffect(()=>(r&&$N.set(r),()=>{$N.set(void 0)}),[r]),W.jsx(En.StrictMode,{children:W.jsx(yme,{store:JW,children:W.jsx(En.Suspense,{fallback:W.jsx(MBe,{}),children:W.jsx(Lje,{children:W.jsx($je,{children:W.jsx(Dje,{config:n,selectedImage:s})})})})})})),Bje=I.memo(Fje);V5.createRoot(document.getElementById("root")).render(W.jsx(Bje,{}));export{Oy as $,hi as A,Wa as B,ibe as C,Ro as D,Ku as E,xs as F,mHe as G,sA as H,jke as I,ra as J,Fy as K,UTe as L,NKe as M,PDe as N,Py as O,sbe as P,Oi as Q,Ac as R,Nm as S,YOe as T,kKe as U,wKe as V,DW as W,NW as X,POe as Y,Iy as Z,bP as _,VL as a,WT as a$,CKe as a0,EKe as a1,U_ as a2,QM as a3,OTe as a4,TKe as a5,$s as a6,pc as a7,__ as a8,RY as a9,$d as aA,rS as aB,wP as aC,I4 as aD,NA as aE,Z2 as aF,Rke as aG,PGe as aH,vTe as aI,jA as aJ,SH as aK,_Te as aL,Uo as aM,zP as aN,tw as aO,sWe as aP,mGe as aQ,RGe as aR,OGe as aS,aGe as aT,iGe as aU,HW as aV,Vg as aW,xxe as aX,dG as aY,Wqe as aZ,iHe as a_,En as aa,dq as ab,IKe as ac,NOe as ad,Hs as ae,AH as af,ew as ag,e$e as ah,VW as ai,AKe as aj,nt as ak,xKe as al,PKe as am,Ii as an,eK as ao,cT as ap,lH as aq,pGe as ar,vy as as,Pz as at,tj as au,_2 as av,Ce as aw,gke as ax,Qqe as ay,Gt as az,BS as b,Yje as b$,LA as b0,DWe as b1,xP as b2,RBe as b3,be as b4,xGe as b5,IGe as b6,s0e as b7,gT as b8,Zje as b9,MV as bA,uHe as bB,yGe as bC,vGe as bD,EGe as bE,w_ as bF,_Ge as bG,Ru as bH,sv as bI,lHe as bJ,aHe as bK,sHe as bL,jje as bM,Hje as bN,qje as bO,Wje as bP,Kje as bQ,Yse as bR,bUe as bS,Lqe as bT,Fqe as bU,Jje as bV,kUe as bW,Xje as bX,pUe as bY,nUe as bZ,jEe as b_,mWe as ba,Yqe as bb,LWe as bc,SWe as bd,H2e as be,Xqe as bf,Jqe as bg,a2e as bh,s2e as bi,hWe as bj,gWe as bk,Zqe as bl,vWe as bm,eWe as bn,hGe as bo,Kqe as bp,IWe as bq,$Ke as br,SGe as bs,gle as bt,FGe as bu,LGe as bv,bGe as bw,cHe as bx,LKe as by,DKe as bz,IJ as c,EWe as c$,_Ue as c0,Qje as c1,RUe as c2,eUe as c3,Z8 as c4,tUe as c5,J8 as c6,sUe as c7,mUe as c8,nKe as c9,cUe as cA,qqe as cB,pHe as cC,VGe as cD,$xe as cE,Ne as cF,NN as cG,jGe as cH,BGe as cI,zGe as cJ,d0e as cK,uxe as cL,rG as cM,EB as cN,oGe as cO,oH as cP,wGe as cQ,s0 as cR,cU as cS,SKe as cT,CGe as cU,fv as cV,SE as cW,NWe as cX,TWe as cY,tWe as cZ,nWe as c_,LO as ca,iUe as cb,gHe as cc,eKe as cd,FO as ce,oUe as cf,kv as cg,Ef as ch,BR as ci,HGe as cj,tKe as ck,BO as cl,aUe as cm,eU as cn,JGe as co,iU as cp,zEe as cq,rUe as cr,G9 as cs,jqe as ct,Uqe as cu,Vqe as cv,lUe as cw,Gqe as cx,uUe as cy,Hqe as cz,moe as d,dHe as d$,jr as d0,lA as d1,Ca as d2,CWe as d3,dUe as d4,MA as d5,kWe as d6,_We as d7,uT as d8,Rqe as d9,hKe as dA,JWe as dB,vKe as dC,ZWe as dD,WHe as dE,KHe as dF,bKe as dG,QHe as dH,yKe as dI,XHe as dJ,YHe as dK,jse as dL,iKe as dM,ZHe as dN,Gse as dO,GHe as dP,BHe as dQ,Iqe as dR,Loe as dS,qS as dT,yUe as dU,p0e as dV,g0e as dW,oHe as dX,fHe as dY,hHe as dZ,fU as d_,Tqe as da,Aqe as db,Nqe as dc,Pqe as dd,Mqe as de,Oqe as df,SEe as dg,tqe as dh,xHe as di,lGe as dj,sGe as dk,EHe as dl,Sae as dm,HHe as dn,bHe as dp,zHe as dq,jHe as dr,Vse as ds,UHe as dt,Uje as du,VHe as dv,X2 as dw,Use as dx,qHe as dy,ly as dz,HF as e,FUe as e$,WS as e0,UUe as e1,BUe as e2,zUe as e3,jUe as e4,Oae as e5,zR as e6,KGe as e7,$Ge as e8,MGe as e9,r2e as eA,fke as eB,SB as eC,QWe as eD,GUe as eE,Zse as eF,VUe as eG,qa as eH,gUe as eI,AUe as eJ,Mae as eK,Gg as eL,IUe as eM,zqe as eN,wUe as eO,CUe as eP,EUe as eQ,SUe as eR,xUe as eS,Xse as eT,NUe as eU,MUe as eV,YUe as eW,yVe as eX,eGe as eY,vVe as eZ,LUe as e_,NGe as ea,Sc as eb,eI as ec,o0e as ed,jR as ee,Oxe as ef,Rxe as eg,QGe as eh,XGe as ei,YGe as ej,a0e as ek,ZGe as el,nU as em,qGe as en,rU as eo,nHe as ep,rHe as eq,V2 as er,tHe as es,eHe as et,UGe as eu,J3e as ev,GGe as ew,rKe as ex,Bqe as ey,fT as ez,YL as f,DHe as f$,DUe as f0,pT as f1,wWe as f2,AWe as f3,Dqe as f4,_Ke as f5,$ke as f6,cWe as f7,me as f8,xi as f9,iSe as fA,j9 as fB,YU as fC,xy as fD,yHe as fE,Hc as fF,iqe as fG,bWe as fH,bj as fI,xg as fJ,CHe as fK,SHe as fL,rqe as fM,oqe as fN,fqe as fO,vHe as fP,aqe as fQ,sqe as fR,uGe as fS,M_ as fT,tt as fU,lqe as fV,JSe as fW,Lv as fX,wHe as fY,hqe as fZ,cqe as f_,Vn as fa,Us as fb,YWe as fc,gKe as fd,lKe as fe,aWe as ff,sKe as fg,mKe as fh,pKe as fi,oWe as fj,cKe as fk,uKe as fl,oKe as fm,fKe as fn,Gje as fo,aKe as fp,dKe as fq,Vje as fr,vV as fs,_He as ft,Z3 as fu,eSe as fv,_oe as fw,nqe as fx,AHe as fy,PHe as fz,oF as g,HUe as g$,MHe as g0,OHe as g1,RHe as g2,LHe as g3,dqe as g4,mqe as g5,gqe as g6,kqe as g7,Lke as g8,NHe as g9,xWe as gA,RWe as gB,MWe as gC,qc as gD,pG as gE,dQ as gF,Rt as gG,PVe as gH,KVe as gI,WVe as gJ,hVe as gK,FVe as gL,XVe as gM,Mxe as gN,aVe as gO,CVe as gP,ng as gQ,SVe as gR,sVe as gS,J2 as gT,wVe as gU,rVe as gV,xVe as gW,iVe as gX,uVe as gY,WUe as gZ,qUe as g_,$He as ga,$qe as gb,yqe as gc,pqe as gd,bqe as ge,W_e as gf,XWe as gg,VB as gh,$O as gi,Qt as gj,ZSe as gk,g0 as gl,sc as gm,Eqe as gn,_qe as go,Cqe as gp,Sqe as gq,vqe as gr,uqe as gs,wqe as gt,RV as gu,jWe as gv,FWe as gw,BWe as gx,zWe as gy,$We as gz,gp as h,yOe as h$,QVe as h0,gae as h1,JF as h2,xB as h3,Zh as h4,nle as h5,ZUe as h6,JUe as h7,eVe as h8,qVe as h9,MVe as hA,NVe as hB,tGe as hC,jVe as hD,nGe as hE,_Ve as hF,bVe as hG,nVe as hH,tVe as hI,JVe as hJ,XUe as hK,pVe as hL,Pxe as hM,Exe as hN,Txe as hO,Axe as hP,KWe as hQ,lWe as hR,uWe as hS,kGe as hT,Z as hU,Iae as hV,_xe as hW,$N as hX,kH as hY,VA as hZ,Ds as h_,dVe as ha,cVe as hb,ole as hc,HVe as hd,Ixe as he,ale as hf,RA as hg,Z3e as hh,gVe as hi,IVe as hj,AVe as hk,EVe as hl,KUe as hm,QUe as hn,rGe as ho,VWe as hp,UWe as hq,LVe as hr,OVe as hs,RVe as ht,kxe as hu,fVe as hv,oVe as hw,GVe as hx,VVe as hy,$Ve as hz,uoe as i,qOe as i0,RKe as i1,DTe as i2,MKe as i3,IDe as i4,NFe as i5,$Fe as i6,ITe as i7,ay as j,Xr as k,oy as l,ny as m,Io as n,US as o,Yk as p,QL as q,rT as r,FF as s,iy as t,Pae as u,I as v,W as w,Ta as x,br as y,mh as z}; diff --git a/invokeai/frontend/web/dist/index.html b/invokeai/frontend/web/dist/index.html index b4f7794229..87cb562c9d 100644 --- a/invokeai/frontend/web/dist/index.html +++ b/invokeai/frontend/web/dist/index.html @@ -3,9 +3,6 @@ - - - InvokeAI - A Stable Diffusion Toolkit - + diff --git a/invokeai/frontend/web/dist/locales/en.json b/invokeai/frontend/web/dist/locales/en.json index b635db997a..34e4dd79d6 100644 --- a/invokeai/frontend/web/dist/locales/en.json +++ b/invokeai/frontend/web/dist/locales/en.json @@ -697,7 +697,7 @@ "noLoRAsAvailable": "No LoRAs available", "noMatchingLoRAs": "No matching LoRAs", "noMatchingModels": "No matching Models", - "noModelsAvailable": "No models available", + "noModelsAvailable": "No Modelss available", "selectLoRA": "Select a LoRA", "selectModel": "Select a Model" }, From 2acc93eb8e0901b78f26f02a19874886a23de2ce Mon Sep 17 00:00:00 2001 From: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed, 4 Oct 2023 20:32:04 +1100 Subject: [PATCH 12/31] feat(ui): remove all calls to getBoardImagesTotals/getBoardAssetsTotals This caused a crapload of network requests any time an image was generated. The counts are necessary to handle the logic for inserting images into existing image list caches; we have to keep track of the counts. Replace tag invalidation with manual cache updates in all cases, except the initial request (which is necessary to get the initial image counts). One subtle change is to make the counts an object instead of a number. This is required for `immer` to handle draft states. This should be raised as a bug with RTK Query, as no error is thrown when attempting to update a primitive immer draft. --- .../socketio/socketInvocationComplete.ts | 17 +- .../Boards/BoardsList/GalleryBoard.tsx | 8 +- .../Boards/BoardsList/NoBoardBoard.tsx | 140 ++++--- .../gallery/hooks/useNextPrevImage.ts | 6 +- .../web/src/services/api/endpoints/boards.ts | 8 +- .../web/src/services/api/endpoints/images.ts | 362 +++++++++++++----- .../src/services/api/hooks/useBoardTotal.ts | 2 +- 7 files changed, 370 insertions(+), 173 deletions(-) diff --git a/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/socketio/socketInvocationComplete.ts b/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/socketio/socketInvocationComplete.ts index 928deb6933..007a829bf9 100644 --- a/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/socketio/socketInvocationComplete.ts +++ b/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/socketio/socketInvocationComplete.ts @@ -8,6 +8,7 @@ import { } from 'features/gallery/store/gallerySlice'; import { IMAGE_CATEGORIES } from 'features/gallery/store/types'; import { CANVAS_OUTPUT } from 'features/nodes/util/graphBuilders/constants'; +import { boardsApi } from 'services/api/endpoints/boards'; import { imagesApi } from 'services/api/endpoints/images'; import { isImageOutput } from 'services/api/guards'; import { imagesAdapter } from 'services/api/util'; @@ -70,11 +71,21 @@ export const addInvocationCompleteEventListener = () => { ) ); + // update the total images for the board + dispatch( + boardsApi.util.updateQueryData( + 'getBoardImagesTotal', + imageDTO.board_id ?? 'none', + (draft) => { + // eslint-disable-next-line @typescript-eslint/no-unused-vars + draft.total += 1; + } + ) + ); + dispatch( imagesApi.util.invalidateTags([ - { type: 'BoardImagesTotal', id: imageDTO.board_id }, - { type: 'BoardAssetsTotal', id: imageDTO.board_id }, - { type: 'Board', id: imageDTO.board_id }, + { type: 'Board', id: imageDTO.board_id ?? 'none' }, ]) ); diff --git a/invokeai/frontend/web/src/features/gallery/components/Boards/BoardsList/GalleryBoard.tsx b/invokeai/frontend/web/src/features/gallery/components/Boards/BoardsList/GalleryBoard.tsx index 104512a9c6..33f5a7c5b3 100644 --- a/invokeai/frontend/web/src/features/gallery/components/Boards/BoardsList/GalleryBoard.tsx +++ b/invokeai/frontend/web/src/features/gallery/components/Boards/BoardsList/GalleryBoard.tsx @@ -77,12 +77,12 @@ const GalleryBoard = ({ const { data: imagesTotal } = useGetBoardImagesTotalQuery(board.board_id); const { data: assetsTotal } = useGetBoardAssetsTotalQuery(board.board_id); const tooltip = useMemo(() => { - if (!imagesTotal || !assetsTotal) { + if (!imagesTotal?.total || !assetsTotal?.total) { return undefined; } - return `${imagesTotal} image${ - imagesTotal > 1 ? 's' : '' - }, ${assetsTotal} asset${assetsTotal > 1 ? 's' : ''}`; + return `${imagesTotal.total} image${imagesTotal.total > 1 ? 's' : ''}, ${ + assetsTotal.total + } asset${assetsTotal.total > 1 ? 's' : ''}`; }, [assetsTotal, imagesTotal]); const { currentData: coverImage } = useGetImageDTOQuery( diff --git a/invokeai/frontend/web/src/features/gallery/components/Boards/BoardsList/NoBoardBoard.tsx b/invokeai/frontend/web/src/features/gallery/components/Boards/BoardsList/NoBoardBoard.tsx index 6cea7d3eac..2d2d116928 100644 --- a/invokeai/frontend/web/src/features/gallery/components/Boards/BoardsList/NoBoardBoard.tsx +++ b/invokeai/frontend/web/src/features/gallery/components/Boards/BoardsList/NoBoardBoard.tsx @@ -1,4 +1,4 @@ -import { Box, Flex, Image, Text } from '@chakra-ui/react'; +import { Box, Flex, Image, Text, Tooltip } from '@chakra-ui/react'; import { createSelector } from '@reduxjs/toolkit'; import { stateSelector } from 'app/store/store'; import { useAppDispatch, useAppSelector } from 'app/store/storeHooks'; @@ -15,6 +15,10 @@ import { memo, useCallback, useMemo, useState } from 'react'; import { useBoardName } from 'services/api/hooks/useBoardName'; import AutoAddIcon from '../AutoAddIcon'; import BoardContextMenu from '../BoardContextMenu'; +import { + useGetBoardAssetsTotalQuery, + useGetBoardImagesTotalQuery, +} from 'services/api/endpoints/boards'; interface Props { isSelected: boolean; @@ -41,6 +45,17 @@ const NoBoardBoard = memo(({ isSelected }: Props) => { }, [dispatch, autoAssignBoardOnClick]); const [isHovered, setIsHovered] = useState(false); + const { data: imagesTotal } = useGetBoardImagesTotalQuery('none'); + const { data: assetsTotal } = useGetBoardAssetsTotalQuery('none'); + const tooltip = useMemo(() => { + if (!imagesTotal?.total || !assetsTotal?.total) { + return undefined; + } + return `${imagesTotal.total} image${imagesTotal.total > 1 ? 's' : ''}, ${ + assetsTotal.total + } asset${assetsTotal.total > 1 ? 's' : ''}`; + }, [assetsTotal, imagesTotal]); + const handleMouseOver = useCallback(() => { setIsHovered(true); }, []); @@ -74,77 +89,82 @@ const NoBoardBoard = memo(({ isSelected }: Props) => { > {(ref) => ( - + - invoke-ai-logo + invoke-ai-logo + + {autoAddBoardId === 'none' && } + + {boardName} + + + Move} /> - {autoAddBoardId === 'none' && } - - {boardName} - - - Move} - /> - + )} diff --git a/invokeai/frontend/web/src/features/gallery/hooks/useNextPrevImage.ts b/invokeai/frontend/web/src/features/gallery/hooks/useNextPrevImage.ts index 670dd7ee9f..fe30f0a7a7 100644 --- a/invokeai/frontend/web/src/features/gallery/hooks/useNextPrevImage.ts +++ b/invokeai/frontend/web/src/features/gallery/hooks/useNextPrevImage.ts @@ -20,7 +20,7 @@ export const nextPrevImageButtonsSelector = createSelector( const { data, status } = imagesApi.endpoints.listImages.select(baseQueryArgs)(state); - const { data: total } = + const { data: totalsData } = state.gallery.galleryView === 'images' ? boardsApi.endpoints.getBoardImagesTotal.select( baseQueryArgs.board_id ?? 'none' @@ -34,7 +34,7 @@ export const nextPrevImageButtonsSelector = createSelector( const isFetching = status === 'pending'; - if (!data || !lastSelectedImage || total === 0) { + if (!data || !lastSelectedImage || totalsData?.total === 0) { return { isFetching, queryArgs: baseQueryArgs, @@ -74,7 +74,7 @@ export const nextPrevImageButtonsSelector = createSelector( return { loadedImagesCount: images.length, currentImageIndex, - areMoreImagesAvailable: (total ?? 0) > imagesLength, + areMoreImagesAvailable: (totalsData?.total ?? 0) > imagesLength, isFetching: status === 'pending', nextImage, prevImage, diff --git a/invokeai/frontend/web/src/services/api/endpoints/boards.ts b/invokeai/frontend/web/src/services/api/endpoints/boards.ts index 53b3bfd59d..2e269be124 100644 --- a/invokeai/frontend/web/src/services/api/endpoints/boards.ts +++ b/invokeai/frontend/web/src/services/api/endpoints/boards.ts @@ -70,7 +70,7 @@ export const boardsApi = api.injectEndpoints({ keepUnusedDataFor: 0, }), - getBoardImagesTotal: build.query({ + getBoardImagesTotal: build.query<{ total: number }, string | undefined>({ query: (board_id) => ({ url: getListImagesUrl({ board_id: board_id ?? 'none', @@ -85,11 +85,11 @@ export const boardsApi = api.injectEndpoints({ { type: 'BoardImagesTotal', id: arg ?? 'none' }, ], transformResponse: (response: OffsetPaginatedResults_ImageDTO_) => { - return response.total; + return { total: response.total }; }, }), - getBoardAssetsTotal: build.query({ + getBoardAssetsTotal: build.query<{ total: number }, string | undefined>({ query: (board_id) => ({ url: getListImagesUrl({ board_id: board_id ?? 'none', @@ -104,7 +104,7 @@ export const boardsApi = api.injectEndpoints({ { type: 'BoardAssetsTotal', id: arg ?? 'none' }, ], transformResponse: (response: OffsetPaginatedResults_ImageDTO_) => { - return response.total; + return { total: response.total }; }, }), diff --git a/invokeai/frontend/web/src/services/api/endpoints/images.ts b/invokeai/frontend/web/src/services/api/endpoints/images.ts index 239dfaa982..ce9207144d 100644 --- a/invokeai/frontend/web/src/services/api/endpoints/images.ts +++ b/invokeai/frontend/web/src/services/api/endpoints/images.ts @@ -103,6 +103,9 @@ export const imagesApi = api.injectEndpoints({ query: () => ({ url: getListImagesUrl({ is_intermediate: true }) }), providesTags: ['IntermediatesCount'], transformResponse: (response: OffsetPaginatedResults_ImageDTO_) => { + // TODO: This is storing a primitive value in the cache. `immer` cannot track state changes, so + // attempts to use manual cache updates on this value will fail. This should be changed into an + // object. return response.total; }, }), @@ -191,35 +194,51 @@ export const imagesApi = api.injectEndpoints({ url: `images/i/${image_name}`, method: 'DELETE', }), - invalidatesTags: (result, error, { board_id }) => [ - { type: 'BoardImagesTotal', id: board_id ?? 'none' }, - { type: 'BoardAssetsTotal', id: board_id ?? 'none' }, - ], async onQueryStarted(imageDTO, { dispatch, queryFulfilled }) { /** * Cache changes for `deleteImage`: * - NOT POSSIBLE: *remove* from getImageDTO * - $cache = [board_id|no_board]/[images|assets] * - *remove* from $cache + * - decrement the image's board's total */ const { image_name, board_id } = imageDTO; + const isAsset = ASSETS_CATEGORIES.includes(imageDTO.image_category); const queryArg = { board_id: board_id ?? 'none', categories: getCategories(imageDTO), }; - const patch = dispatch( - imagesApi.util.updateQueryData('listImages', queryArg, (draft) => { - imagesAdapter.removeOne(draft, image_name); - }) + const patches: PatchCollection[] = []; + + patches.push( + dispatch( + imagesApi.util.updateQueryData('listImages', queryArg, (draft) => { + imagesAdapter.removeOne(draft, image_name); + }) + ) ); + patches.push( + dispatch( + boardsApi.util.updateQueryData( + isAsset ? 'getBoardAssetsTotal' : 'getBoardImagesTotal', + imageDTO.board_id ?? 'none', + (draft) => { + draft.total = Math.max(draft.total - 1, 0); + } + ) + ) + ); // decrement the image board's total + try { await queryFulfilled; } catch { - patch.undo(); + patches.forEach((patch) => { + patch.undo(); + }); } }, }), @@ -237,18 +256,11 @@ export const imagesApi = api.injectEndpoints({ }, }; }, - invalidatesTags: (result, error, { imageDTOs }) => { - // for now, assume bulk delete is all on one board - const boardId = imageDTOs[0]?.board_id; - return [ - { type: 'BoardImagesTotal', id: boardId ?? 'none' }, - { type: 'BoardAssetsTotal', id: boardId ?? 'none' }, - ]; - }, async onQueryStarted({ imageDTOs }, { dispatch, queryFulfilled }) { /** * Cache changes for `deleteImages`: * - *remove* the deleted images from their boards + * - decrement the images' board's totals * * Unfortunately we cannot do an optimistic update here due to how immer handles patching * arrays. You have to undo *all* patches, else the entity adapter's `ids` array is borked. @@ -279,6 +291,21 @@ export const imagesApi = api.injectEndpoints({ } ) ); + + const isAsset = ASSETS_CATEGORIES.includes( + imageDTO.image_category + ); + + // decrement the image board's total + dispatch( + boardsApi.util.updateQueryData( + isAsset ? 'getBoardAssetsTotal' : 'getBoardImagesTotal', + imageDTO.board_id ?? 'none', + (draft) => { + draft.total = Math.max(draft.total - 1, 0); + } + ) + ); } }); } catch { @@ -298,10 +325,6 @@ export const imagesApi = api.injectEndpoints({ method: 'PATCH', body: { is_intermediate }, }), - invalidatesTags: (result, error, { imageDTO }) => [ - { type: 'BoardImagesTotal', id: imageDTO.board_id ?? 'none' }, - { type: 'BoardAssetsTotal', id: imageDTO.board_id ?? 'none' }, - ], async onQueryStarted( { imageDTO, is_intermediate }, { dispatch, queryFulfilled, getState } @@ -312,9 +335,11 @@ export const imagesApi = api.injectEndpoints({ * - $cache = [board_id|no_board]/[images|assets] * - IF it is being changed to an intermediate: * - remove from $cache + * - decrement the image's board's total * - ELSE (it is being changed to a non-intermediate): * - IF it eligible for insertion into existing $cache: * - *upsert* to $cache + * - increment the image's board's total */ // Store patches so we can undo if the query fails @@ -335,6 +360,7 @@ export const imagesApi = api.injectEndpoints({ // $cache = [board_id|no_board]/[images|assets] const categories = getCategories(imageDTO); + const isAsset = ASSETS_CATEGORIES.includes(imageDTO.image_category); if (is_intermediate) { // IF it is being changed to an intermediate: @@ -350,8 +376,35 @@ export const imagesApi = api.injectEndpoints({ ) ) ); + + // decrement the image board's total + patches.push( + dispatch( + boardsApi.util.updateQueryData( + isAsset ? 'getBoardAssetsTotal' : 'getBoardImagesTotal', + imageDTO.board_id ?? 'none', + (draft) => { + draft.total = Math.max(draft.total - 1, 0); + } + ) + ) + ); } else { // ELSE (it is being changed to a non-intermediate): + + // increment the image board's total + patches.push( + dispatch( + boardsApi.util.updateQueryData( + isAsset ? 'getBoardAssetsTotal' : 'getBoardImagesTotal', + imageDTO.board_id ?? 'none', + (draft) => { + draft.total += 1; + } + ) + ) + ); + const queryArgs = { board_id: imageDTO.board_id ?? 'none', categories, @@ -361,9 +414,7 @@ export const imagesApi = api.injectEndpoints({ getState() ); - const { data: total } = IMAGE_CATEGORIES.includes( - imageDTO.image_category - ) + const { data } = IMAGE_CATEGORIES.includes(imageDTO.image_category) ? boardsApi.endpoints.getBoardImagesTotal.select( imageDTO.board_id ?? 'none' )(getState()) @@ -378,7 +429,8 @@ export const imagesApi = api.injectEndpoints({ // - The image's `created_at` is within the range of the cached images const isCacheFullyPopulated = - currentCache.data && currentCache.data.ids.length >= (total ?? 0); + currentCache.data && + currentCache.data.ids.length >= (data?.total ?? 0); const isInDateRange = getIsImageInDateRange( currentCache.data, @@ -420,10 +472,6 @@ export const imagesApi = api.injectEndpoints({ method: 'PATCH', body: { session_id }, }), - invalidatesTags: (result, error, { imageDTO }) => [ - { type: 'BoardImagesTotal', id: imageDTO.board_id ?? 'none' }, - { type: 'BoardAssetsTotal', id: imageDTO.board_id ?? 'none' }, - ], async onQueryStarted( { imageDTO, session_id }, { dispatch, queryFulfilled } @@ -535,9 +583,7 @@ export const imagesApi = api.injectEndpoints({ queryArgs )(getState()); - const { data: previousTotal } = IMAGE_CATEGORIES.includes( - imageDTO.image_category - ) + const { data } = IMAGE_CATEGORIES.includes(imageDTO.image_category) ? boardsApi.endpoints.getBoardImagesTotal.select( boardId ?? 'none' )(getState()) @@ -547,10 +593,10 @@ export const imagesApi = api.injectEndpoints({ const isCacheFullyPopulated = currentCache.data && - currentCache.data.ids.length >= (previousTotal ?? 0); + currentCache.data.ids.length >= (data?.total ?? 0); const isInDateRange = - (previousTotal || 0) >= IMAGE_LIMIT + (data?.total ?? 0) >= IMAGE_LIMIT ? getIsImageInDateRange(currentCache.data, imageDTO) : true; @@ -652,9 +698,7 @@ export const imagesApi = api.injectEndpoints({ queryArgs )(getState()); - const { data: previousTotal } = IMAGE_CATEGORIES.includes( - imageDTO.image_category - ) + const { data } = IMAGE_CATEGORIES.includes(imageDTO.image_category) ? boardsApi.endpoints.getBoardImagesTotal.select( boardId ?? 'none' )(getState()) @@ -664,10 +708,10 @@ export const imagesApi = api.injectEndpoints({ const isCacheFullyPopulated = currentCache.data && - currentCache.data.ids.length >= (previousTotal ?? 0); + currentCache.data.ids.length >= (data?.total ?? 0); const isInDateRange = - (previousTotal || 0) >= IMAGE_LIMIT + (data?.total ?? 0) >= IMAGE_LIMIT ? getIsImageInDateRange(currentCache.data, imageDTO) : true; @@ -736,6 +780,7 @@ export const imagesApi = api.injectEndpoints({ * - BAIL OUT * - *add* to `getImageDTO` * - *add* to no_board/assets + * - update the image's board's assets total */ const { data: imageDTO } = await queryFulfilled; @@ -770,11 +815,15 @@ export const imagesApi = api.injectEndpoints({ ) ); + // increment new board's total dispatch( - imagesApi.util.invalidateTags([ - { type: 'BoardImagesTotal', id: imageDTO.board_id ?? 'none' }, - { type: 'BoardAssetsTotal', id: imageDTO.board_id ?? 'none' }, - ]) + boardsApi.util.updateQueryData( + 'getBoardAssetsTotal', + imageDTO.board_id ?? 'none', + (draft) => { + draft.total += 1; + } + ) ); } catch { // query failed, no action needed @@ -801,8 +850,6 @@ export const imagesApi = api.injectEndpoints({ categories: ASSETS_CATEGORIES, }), }, - { type: 'BoardImagesTotal', id: 'none' }, - { type: 'BoardAssetsTotal', id: 'none' }, ], async onQueryStarted(board_id, { dispatch, queryFulfilled }) { /** @@ -815,6 +862,7 @@ export const imagesApi = api.injectEndpoints({ * have access to the deleted images DTOs - only the names, and a network request * for all of a board's DTOs could be very large. Instead, we invalidate the 'No Board' * cache. + * - set the board's totals to zero */ try { @@ -834,6 +882,28 @@ export const imagesApi = api.injectEndpoints({ ); }); + // set the board's asset total to 0 (feels unnecessary since we are deleting it?) + dispatch( + boardsApi.util.updateQueryData( + 'getBoardAssetsTotal', + board_id, + (draft) => { + draft.total = 0; + } + ) + ); + + // set the board's images total to 0 (feels unnecessary since we are deleting it?) + dispatch( + boardsApi.util.updateQueryData( + 'getBoardImagesTotal', + board_id, + (draft) => { + draft.total = 0; + } + ) + ); + // update 'All Images' & 'All Assets' caches const queryArgsToUpdate = [ { @@ -890,8 +960,6 @@ export const imagesApi = api.injectEndpoints({ categories: ASSETS_CATEGORIES, }), }, - { type: 'BoardImagesTotal', id: 'none' }, - { type: 'BoardAssetsTotal', id: 'none' }, ], async onQueryStarted(board_id, { dispatch, queryFulfilled }) { /** @@ -901,6 +969,7 @@ export const imagesApi = api.injectEndpoints({ * Instead, we rely on the UI to remove all components that use the deleted images. * - Remove every image in the 'All Images' cache that has the board_id * - Remove every image in the 'All Assets' cache that has the board_id + * - set the board's totals to zero */ try { @@ -928,6 +997,28 @@ export const imagesApi = api.injectEndpoints({ ) ); }); + + // set the board's asset total to 0 (feels unnecessary since we are deleting it?) + dispatch( + boardsApi.util.updateQueryData( + 'getBoardAssetsTotal', + board_id, + (draft) => { + draft.total = 0; + } + ) + ); + + // set the board's images total to 0 (feels unnecessary since we are deleting it?) + dispatch( + boardsApi.util.updateQueryData( + 'getBoardImagesTotal', + board_id, + (draft) => { + draft.total = 0; + } + ) + ); } catch { //no-op } @@ -945,15 +1036,9 @@ export const imagesApi = api.injectEndpoints({ body: { board_id, image_name }, }; }, - invalidatesTags: (result, error, { board_id, imageDTO }) => [ + invalidatesTags: (result, error, { board_id }) => [ // refresh the board itself { type: 'Board', id: board_id }, - // update old board totals - { type: 'BoardImagesTotal', id: board_id }, - { type: 'BoardAssetsTotal', id: board_id }, - // update new board totals - { type: 'BoardImagesTotal', id: imageDTO.board_id ?? 'none' }, - { type: 'BoardAssetsTotal', id: imageDTO.board_id ?? 'none' }, ], async onQueryStarted( { board_id, imageDTO }, @@ -970,11 +1055,13 @@ export const imagesApi = api.injectEndpoints({ * - $cache = board_id/[images|assets] * - IF it eligible for insertion into existing $cache: * - THEN *add* to $cache + * - decrement both old board's total + * - increment the new board's total */ const patches: PatchCollection[] = []; const categories = getCategories(imageDTO); - + const isAsset = ASSETS_CATEGORIES.includes(imageDTO.image_category); // *update* getImageDTO patches.push( dispatch( @@ -1005,6 +1092,32 @@ export const imagesApi = api.injectEndpoints({ ) ); + // decrement old board's total + patches.push( + dispatch( + boardsApi.util.updateQueryData( + isAsset ? 'getBoardAssetsTotal' : 'getBoardImagesTotal', + imageDTO.board_id ?? 'none', + (draft) => { + draft.total = Math.max(draft.total - 1, 0); + } + ) + ) + ); + + // increment new board's total + patches.push( + dispatch( + boardsApi.util.updateQueryData( + isAsset ? 'getBoardAssetsTotal' : 'getBoardImagesTotal', + board_id ?? 'none', + (draft) => { + draft.total += 1; + } + ) + ) + ); + // $cache = board_id/[images|assets] const queryArgs = { board_id: board_id ?? 'none', categories }; const currentCache = imagesApi.endpoints.listImages.select(queryArgs)( @@ -1017,9 +1130,7 @@ export const imagesApi = api.injectEndpoints({ // OR // - The image's `created_at` is within the range of the cached images - const { data: total } = IMAGE_CATEGORIES.includes( - imageDTO.image_category - ) + const { data } = IMAGE_CATEGORIES.includes(imageDTO.image_category) ? boardsApi.endpoints.getBoardImagesTotal.select( imageDTO.board_id ?? 'none' )(getState()) @@ -1028,7 +1139,8 @@ export const imagesApi = api.injectEndpoints({ )(getState()); const isCacheFullyPopulated = - currentCache.data && currentCache.data.ids.length >= (total ?? 0); + currentCache.data && + currentCache.data.ids.length >= (data?.total ?? 0); const isInDateRange = getIsImageInDateRange( currentCache.data, @@ -1072,12 +1184,6 @@ export const imagesApi = api.injectEndpoints({ return [ // invalidate the image's old board { type: 'Board', id: board_id ?? 'none' }, - // update old board totals - { type: 'BoardImagesTotal', id: board_id ?? 'none' }, - { type: 'BoardAssetsTotal', id: board_id ?? 'none' }, - // update the no_board totals - { type: 'BoardImagesTotal', id: 'none' }, - { type: 'BoardAssetsTotal', id: 'none' }, ]; }, async onQueryStarted( @@ -1091,10 +1197,13 @@ export const imagesApi = api.injectEndpoints({ * - $cache = no_board/[images|assets] * - IF it eligible for insertion into existing $cache: * - THEN *upsert* to $cache + * - decrement old board's total + * - increment the new board's total (no board) */ const categories = getCategories(imageDTO); const patches: PatchCollection[] = []; + const isAsset = ASSETS_CATEGORIES.includes(imageDTO.image_category); // *update* getImageDTO patches.push( @@ -1125,6 +1234,32 @@ export const imagesApi = api.injectEndpoints({ ) ); + // decrement old board's total + patches.push( + dispatch( + boardsApi.util.updateQueryData( + isAsset ? 'getBoardAssetsTotal' : 'getBoardImagesTotal', + imageDTO.board_id ?? 'none', + (draft) => { + draft.total = Math.max(draft.total - 1, 0); + } + ) + ) + ); + + // increment new board's total (no board) + patches.push( + dispatch( + boardsApi.util.updateQueryData( + isAsset ? 'getBoardAssetsTotal' : 'getBoardImagesTotal', + 'none', + (draft) => { + draft.total += 1; + } + ) + ) + ); + // $cache = no_board/[images|assets] const queryArgs = { board_id: 'none', categories }; const currentCache = imagesApi.endpoints.listImages.select(queryArgs)( @@ -1137,9 +1272,7 @@ export const imagesApi = api.injectEndpoints({ // OR // - The image's `created_at` is within the range of the cached images - const { data: total } = IMAGE_CATEGORIES.includes( - imageDTO.image_category - ) + const { data } = IMAGE_CATEGORIES.includes(imageDTO.image_category) ? boardsApi.endpoints.getBoardImagesTotal.select( imageDTO.board_id ?? 'none' )(getState()) @@ -1148,7 +1281,8 @@ export const imagesApi = api.injectEndpoints({ )(getState()); const isCacheFullyPopulated = - currentCache.data && currentCache.data.ids.length >= (total ?? 0); + currentCache.data && + currentCache.data.ids.length >= (data?.total ?? 0); const isInDateRange = getIsImageInDateRange( currentCache.data, @@ -1192,21 +1326,10 @@ export const imagesApi = api.injectEndpoints({ board_id, }, }), - invalidatesTags: (result, error, { imageDTOs, board_id }) => { - //assume all images are being moved from one board for now - const oldBoardId = imageDTOs[0]?.board_id; + invalidatesTags: (result, error, { board_id }) => { return [ // update the destination board { type: 'Board', id: board_id ?? 'none' }, - // update new board totals - { type: 'BoardImagesTotal', id: board_id ?? 'none' }, - { type: 'BoardAssetsTotal', id: board_id ?? 'none' }, - // update old board totals - { type: 'BoardImagesTotal', id: oldBoardId ?? 'none' }, - { type: 'BoardAssetsTotal', id: oldBoardId ?? 'none' }, - // update the no_board totals - { type: 'BoardImagesTotal', id: 'none' }, - { type: 'BoardAssetsTotal', id: 'none' }, ]; }, async onQueryStarted( @@ -1222,6 +1345,8 @@ export const imagesApi = api.injectEndpoints({ * - *update* getImageDTO for each image * - *add* to board_id/[images|assets] * - *remove* from [old_board_id|no_board]/[images|assets] + * - decrement old board's totals for each image + * - increment new board's totals for each image */ added_image_names.forEach((image_name) => { @@ -1230,7 +1355,8 @@ export const imagesApi = api.injectEndpoints({ 'getImageDTO', image_name, (draft) => { - draft.board_id = new_board_id; + draft.board_id = + new_board_id === 'none' ? undefined : new_board_id; } ) ); @@ -1243,6 +1369,7 @@ export const imagesApi = api.injectEndpoints({ const categories = getCategories(imageDTO); const old_board_id = imageDTO.board_id; + const isAsset = ASSETS_CATEGORIES.includes(imageDTO.image_category); // remove from the old board dispatch( @@ -1255,6 +1382,28 @@ export const imagesApi = api.injectEndpoints({ ) ); + // decrement old board's total + dispatch( + boardsApi.util.updateQueryData( + isAsset ? 'getBoardAssetsTotal' : 'getBoardImagesTotal', + old_board_id ?? 'none', + (draft) => { + draft.total = Math.max(draft.total - 1, 0); + } + ) + ); + + // increment new board's total + dispatch( + boardsApi.util.updateQueryData( + isAsset ? 'getBoardAssetsTotal' : 'getBoardImagesTotal', + new_board_id ?? 'none', + (draft) => { + draft.total += 1; + } + ) + ); + const queryArgs = { board_id: new_board_id, categories, @@ -1264,9 +1413,7 @@ export const imagesApi = api.injectEndpoints({ queryArgs )(getState()); - const { data: previousTotal } = IMAGE_CATEGORIES.includes( - imageDTO.image_category - ) + const { data } = IMAGE_CATEGORIES.includes(imageDTO.image_category) ? boardsApi.endpoints.getBoardImagesTotal.select( new_board_id ?? 'none' )(getState()) @@ -1276,10 +1423,10 @@ export const imagesApi = api.injectEndpoints({ const isCacheFullyPopulated = currentCache.data && - currentCache.data.ids.length >= (previousTotal ?? 0); + currentCache.data.ids.length >= (data?.total ?? 0); const isInDateRange = - (previousTotal || 0) >= IMAGE_LIMIT + (data?.total ?? 0) >= IMAGE_LIMIT ? getIsImageInDateRange(currentCache.data, imageDTO) : true; @@ -1319,10 +1466,7 @@ export const imagesApi = api.injectEndpoints({ }), invalidatesTags: (result, error, { imageDTOs }) => { const touchedBoardIds: string[] = []; - const tags: ApiTagDescription[] = [ - { type: 'BoardImagesTotal', id: 'none' }, - { type: 'BoardAssetsTotal', id: 'none' }, - ]; + const tags: ApiTagDescription[] = []; result?.removed_image_names.forEach((image_name) => { const board_id = imageDTOs.find((i) => i.image_name === image_name) @@ -1333,8 +1477,6 @@ export const imagesApi = api.injectEndpoints({ } tags.push({ type: 'Board', id: board_id }); - tags.push({ type: 'BoardImagesTotal', id: board_id }); - tags.push({ type: 'BoardAssetsTotal', id: board_id }); }); return tags; @@ -1352,6 +1494,8 @@ export const imagesApi = api.injectEndpoints({ * - *update* getImageDTO for each image * - *remove* from old_board_id/[images|assets] * - *add* to no_board/[images|assets] + * - decrement old board's totals for each image + * - increment new board's (no board) totals for each image */ removed_image_names.forEach((image_name) => { @@ -1372,6 +1516,7 @@ export const imagesApi = api.injectEndpoints({ } const categories = getCategories(imageDTO); + const isAsset = ASSETS_CATEGORIES.includes(imageDTO.image_category); // remove from the old board dispatch( @@ -1384,6 +1529,28 @@ export const imagesApi = api.injectEndpoints({ ) ); + // decrement old board's total + dispatch( + boardsApi.util.updateQueryData( + isAsset ? 'getBoardAssetsTotal' : 'getBoardImagesTotal', + imageDTO.board_id ?? 'none', + (draft) => { + draft.total = Math.max(draft.total - 1, 0); + } + ) + ); + + // increment new board's total (no board) + dispatch( + boardsApi.util.updateQueryData( + isAsset ? 'getBoardAssetsTotal' : 'getBoardImagesTotal', + 'none', + (draft) => { + draft.total += 1; + } + ) + ); + // add to `no_board` const queryArgs = { board_id: 'none', @@ -1394,9 +1561,7 @@ export const imagesApi = api.injectEndpoints({ queryArgs )(getState()); - const { data: total } = IMAGE_CATEGORIES.includes( - imageDTO.image_category - ) + const { data } = IMAGE_CATEGORIES.includes(imageDTO.image_category) ? boardsApi.endpoints.getBoardImagesTotal.select( imageDTO.board_id ?? 'none' )(getState()) @@ -1405,10 +1570,11 @@ export const imagesApi = api.injectEndpoints({ )(getState()); const isCacheFullyPopulated = - currentCache.data && currentCache.data.ids.length >= (total ?? 0); + currentCache.data && + currentCache.data.ids.length >= (data?.total ?? 0); const isInDateRange = - (total || 0) >= IMAGE_LIMIT + (data?.total ?? 0) >= IMAGE_LIMIT ? getIsImageInDateRange(currentCache.data, imageDTO) : true; diff --git a/invokeai/frontend/web/src/services/api/hooks/useBoardTotal.ts b/invokeai/frontend/web/src/services/api/hooks/useBoardTotal.ts index a350979b89..29162597c5 100644 --- a/invokeai/frontend/web/src/services/api/hooks/useBoardTotal.ts +++ b/invokeai/frontend/web/src/services/api/hooks/useBoardTotal.ts @@ -13,7 +13,7 @@ export const useBoardTotal = (board_id: BoardId) => { const { data: totalAssets } = useGetBoardAssetsTotalQuery(board_id); const currentViewTotal = useMemo( - () => (galleryView === 'images' ? totalImages : totalAssets), + () => (galleryView === 'images' ? totalImages?.total : totalAssets?.total), [galleryView, totalAssets, totalImages] ); From 3e8d62b1d132f2a30827897a23d1a70b2d6cd0d6 Mon Sep 17 00:00:00 2001 From: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed, 4 Oct 2023 21:27:41 +1100 Subject: [PATCH 13/31] fix(ui): fix duplicate image selection Selections were not being `uniqBy()`'d, or were `uniqBy()`'d without a proper iteratee. This results in duplicate images in selections in certain situations. Add correct `uniqBy()` to the reducer to prevent this in the future. --- .../web/src/features/gallery/hooks/useMultiselect.ts | 7 +++---- .../web/src/features/gallery/store/gallerySlice.ts | 3 ++- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/invokeai/frontend/web/src/features/gallery/hooks/useMultiselect.ts b/invokeai/frontend/web/src/features/gallery/hooks/useMultiselect.ts index a162c6788d..d9ba0639ac 100644 --- a/invokeai/frontend/web/src/features/gallery/hooks/useMultiselect.ts +++ b/invokeai/frontend/web/src/features/gallery/hooks/useMultiselect.ts @@ -3,13 +3,12 @@ import { stateSelector } from 'app/store/store'; import { useAppDispatch, useAppSelector } from 'app/store/storeHooks'; import { defaultSelectorOptions } from 'app/store/util/defaultMemoizeOptions'; import { selectListImagesBaseQueryArgs } from 'features/gallery/store/gallerySelectors'; -import { uniq } from 'lodash-es'; import { MouseEvent, useCallback, useMemo } from 'react'; import { useListImagesQuery } from 'services/api/endpoints/images'; import { ImageDTO } from 'services/api/types'; -import { selectionChanged } from '../store/gallerySlice'; import { imagesSelectors } from 'services/api/util'; import { useFeatureStatus } from '../../system/hooks/useFeatureStatus'; +import { selectionChanged } from '../store/gallerySlice'; const selector = createSelector( [stateSelector, selectListImagesBaseQueryArgs], @@ -60,7 +59,7 @@ export const useMultiselect = (imageDTO?: ImageDTO) => { const start = Math.min(lastClickedIndex, currentClickedIndex); const end = Math.max(lastClickedIndex, currentClickedIndex); const imagesToSelect = imageDTOs.slice(start, end + 1); - dispatch(selectionChanged(uniq(selection.concat(imagesToSelect)))); + dispatch(selectionChanged(selection.concat(imagesToSelect))); } } else if (e.ctrlKey || e.metaKey) { if ( @@ -73,7 +72,7 @@ export const useMultiselect = (imageDTO?: ImageDTO) => { ) ); } else { - dispatch(selectionChanged(uniq(selection.concat(imageDTO)))); + dispatch(selectionChanged(selection.concat(imageDTO))); } } else { dispatch(selectionChanged([imageDTO])); diff --git a/invokeai/frontend/web/src/features/gallery/store/gallerySlice.ts b/invokeai/frontend/web/src/features/gallery/store/gallerySlice.ts index c78b22dd78..c9fd3607d3 100644 --- a/invokeai/frontend/web/src/features/gallery/store/gallerySlice.ts +++ b/invokeai/frontend/web/src/features/gallery/store/gallerySlice.ts @@ -4,6 +4,7 @@ import { boardsApi } from 'services/api/endpoints/boards'; import { imagesApi } from 'services/api/endpoints/images'; import { ImageDTO } from 'services/api/types'; import { BoardId, GalleryState, GalleryView } from './types'; +import { uniqBy } from 'lodash-es'; export const initialGalleryState: GalleryState = { selection: [], @@ -24,7 +25,7 @@ export const gallerySlice = createSlice({ state.selection = action.payload ? [action.payload] : []; }, selectionChanged: (state, action: PayloadAction) => { - state.selection = action.payload; + state.selection = uniqBy(action.payload, (i) => i.image_name); }, shouldAutoSwitchChanged: (state, action: PayloadAction) => { state.shouldAutoSwitch = action.payload; From 95838e5559c9eed0ac0db7f96dbf53985f17f97a Mon Sep 17 00:00:00 2001 From: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed, 4 Oct 2023 21:31:18 +1100 Subject: [PATCH 14/31] fix(ui): fix remove from board dnd validation This is fired when the dnd image is moved over the 'none' board. Weren't defaulting to 'none' for the image's board_id, resulting in it being possible to drag a 'none' image onto 'none'. --- invokeai/frontend/web/src/features/dnd/util/isValidDrop.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/invokeai/frontend/web/src/features/dnd/util/isValidDrop.ts b/invokeai/frontend/web/src/features/dnd/util/isValidDrop.ts index b040caf83d..e094627ab9 100644 --- a/invokeai/frontend/web/src/features/dnd/util/isValidDrop.ts +++ b/invokeai/frontend/web/src/features/dnd/util/isValidDrop.ts @@ -71,7 +71,7 @@ export const isValidDrop = ( // Check if the image's board is the board we are dragging onto if (payloadType === 'IMAGE_DTO') { const { imageDTO } = active.data.current.payload; - const currentBoard = imageDTO.board_id; + const currentBoard = imageDTO.board_id ?? 'none'; return currentBoard !== 'none'; } From 16f48a816f80724e3ccbd02da569fbd3190e28e1 Mon Sep 17 00:00:00 2001 From: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed, 4 Oct 2023 21:33:29 +1100 Subject: [PATCH 15/31] fix(ui): add dnd validation logic for multi-select board move --- .../web/src/features/dnd/util/isValidDrop.ts | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/invokeai/frontend/web/src/features/dnd/util/isValidDrop.ts b/invokeai/frontend/web/src/features/dnd/util/isValidDrop.ts index e094627ab9..620a1897d0 100644 --- a/invokeai/frontend/web/src/features/dnd/util/isValidDrop.ts +++ b/invokeai/frontend/web/src/features/dnd/util/isValidDrop.ts @@ -53,8 +53,12 @@ export const isValidDrop = ( } if (payloadType === 'IMAGE_DTOS') { - // TODO (multi-select) - return true; + // Assume all images are on the same board - this is true for the moment + const { imageDTOs } = active.data.current.payload; + const currentBoard = imageDTOs[0]?.board_id ?? 'none'; + const destinationBoard = overData.context.boardId; + + return currentBoard !== destinationBoard; } return false; @@ -77,8 +81,11 @@ export const isValidDrop = ( } if (payloadType === 'IMAGE_DTOS') { - // TODO (multi-select) - return true; + // Assume all images are on the same board - this is true for the moment + const { imageDTOs } = active.data.current.payload; + const currentBoard = imageDTOs[0]?.board_id ?? 'none'; + + return currentBoard !== 'none'; } return false; From eadbe6abf7ed2a5042dd7525849e36b7494860fe Mon Sep 17 00:00:00 2001 From: Mary Hipp Date: Wed, 4 Oct 2023 10:02:21 -0400 Subject: [PATCH 16/31] handle 0 images/assets --- .../gallery/components/Boards/BoardsList/GalleryBoard.tsx | 6 +++--- .../gallery/components/Boards/BoardsList/NoBoardBoard.tsx | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/invokeai/frontend/web/src/features/gallery/components/Boards/BoardsList/GalleryBoard.tsx b/invokeai/frontend/web/src/features/gallery/components/Boards/BoardsList/GalleryBoard.tsx index 33f5a7c5b3..90fa6d6425 100644 --- a/invokeai/frontend/web/src/features/gallery/components/Boards/BoardsList/GalleryBoard.tsx +++ b/invokeai/frontend/web/src/features/gallery/components/Boards/BoardsList/GalleryBoard.tsx @@ -77,12 +77,12 @@ const GalleryBoard = ({ const { data: imagesTotal } = useGetBoardImagesTotalQuery(board.board_id); const { data: assetsTotal } = useGetBoardAssetsTotalQuery(board.board_id); const tooltip = useMemo(() => { - if (!imagesTotal?.total || !assetsTotal?.total) { + if (imagesTotal?.total === undefined || assetsTotal?.total === undefined) { return undefined; } - return `${imagesTotal.total} image${imagesTotal.total > 1 ? 's' : ''}, ${ + return `${imagesTotal.total} image${imagesTotal.total === 1 ? '' : 's'}, ${ assetsTotal.total - } asset${assetsTotal.total > 1 ? 's' : ''}`; + } asset${assetsTotal.total === 1 ? '' : 's'}`; }, [assetsTotal, imagesTotal]); const { currentData: coverImage } = useGetImageDTOQuery( diff --git a/invokeai/frontend/web/src/features/gallery/components/Boards/BoardsList/NoBoardBoard.tsx b/invokeai/frontend/web/src/features/gallery/components/Boards/BoardsList/NoBoardBoard.tsx index 2d2d116928..2bcc466108 100644 --- a/invokeai/frontend/web/src/features/gallery/components/Boards/BoardsList/NoBoardBoard.tsx +++ b/invokeai/frontend/web/src/features/gallery/components/Boards/BoardsList/NoBoardBoard.tsx @@ -48,12 +48,12 @@ const NoBoardBoard = memo(({ isSelected }: Props) => { const { data: imagesTotal } = useGetBoardImagesTotalQuery('none'); const { data: assetsTotal } = useGetBoardAssetsTotalQuery('none'); const tooltip = useMemo(() => { - if (!imagesTotal?.total || !assetsTotal?.total) { + if (imagesTotal?.total === undefined || assetsTotal?.total === undefined) { return undefined; } - return `${imagesTotal.total} image${imagesTotal.total > 1 ? 's' : ''}, ${ + return `${imagesTotal.total} image${imagesTotal.total === 1 ? '' : 's'}, ${ assetsTotal.total - } asset${assetsTotal.total > 1 ? 's' : ''}`; + } asset${assetsTotal.total === 1 ? '' : 's'}`; }, [assetsTotal, imagesTotal]); const handleMouseOver = useCallback(() => { From 51b5de799a34c9c9d20bdce293ca7542979c5e95 Mon Sep 17 00:00:00 2001 From: Darren Ringer Date: Tue, 3 Oct 2023 20:36:09 -0400 Subject: [PATCH 17/31] Update upscale.py to support tile kwarg of RealESRGANer Adds tile_size field to the ESRGAN Upscaler node, which sends the tile kwarg to RealESRGANer's constructor, enabling tiled upscaling (default=512) --- invokeai/app/invocations/upscale.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/invokeai/app/invocations/upscale.py b/invokeai/app/invocations/upscale.py index 9dc2eed2c1..c93c325bb3 100644 --- a/invokeai/app/invocations/upscale.py +++ b/invokeai/app/invocations/upscale.py @@ -23,12 +23,13 @@ ESRGAN_MODELS = Literal[ ] -@invocation("esrgan", title="Upscale (RealESRGAN)", tags=["esrgan", "upscale"], category="esrgan", version="1.0.0") +@invocation("esrgan", title="Upscale (RealESRGAN)", tags=["esrgan", "upscale"], category="esrgan", version="1.0.1") class ESRGANInvocation(BaseInvocation): """Upscales an image using RealESRGAN.""" image: ImageField = InputField(description="The input image") model_name: ESRGAN_MODELS = InputField(default="RealESRGAN_x4plus.pth", description="The Real-ESRGAN model to use") + tile_size: int = InputField(default=512, ge=0, description="Tile size for tiled ESRGAN upscaling (0=tiling disabled)") def invoke(self, context: InvocationContext) -> ImageOutput: image = context.services.images.get_pil_image(self.image.image_name) @@ -86,6 +87,7 @@ class ESRGANInvocation(BaseInvocation): model_path=str(models_path / esrgan_model_path), model=rrdbnet_model, half=False, + tile=self.tile_size, ) # prepare image - Real-ESRGAN uses cv2 internally, and cv2 uses BGR vs RGB for PIL From 37121a3a245296260dc7ed42825a1a3ab41c10eb Mon Sep 17 00:00:00 2001 From: Darren Ringer Date: Tue, 3 Oct 2023 20:57:09 -0400 Subject: [PATCH 18/31] Add tile_size parameter to ESERGAN node in buildAdHocUpscaleGraph.ts Adds tile_size parameter to support the changed ESRGAN node in invokeai/app/invocations/upscale.py --- .../features/nodes/util/graphBuilders/buildAdHocUpscaleGraph.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/invokeai/frontend/web/src/features/nodes/util/graphBuilders/buildAdHocUpscaleGraph.ts b/invokeai/frontend/web/src/features/nodes/util/graphBuilders/buildAdHocUpscaleGraph.ts index c612e88598..09d742c0cd 100644 --- a/invokeai/frontend/web/src/features/nodes/util/graphBuilders/buildAdHocUpscaleGraph.ts +++ b/invokeai/frontend/web/src/features/nodes/util/graphBuilders/buildAdHocUpscaleGraph.ts @@ -24,6 +24,7 @@ export const buildAdHocUpscaleGraph = ({ type: 'esrgan', image: { image_name }, model_name: esrganModelName, + tile_size: 512, is_intermediate: true, }; From dfc635223c74fadcaec68a29d057ea636d32436f Mon Sep 17 00:00:00 2001 From: Darren Ringer Date: Tue, 3 Oct 2023 21:43:16 -0400 Subject: [PATCH 19/31] Update upscale.py with minor style correction --- invokeai/app/invocations/upscale.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/invokeai/app/invocations/upscale.py b/invokeai/app/invocations/upscale.py index c93c325bb3..7cb074a041 100644 --- a/invokeai/app/invocations/upscale.py +++ b/invokeai/app/invocations/upscale.py @@ -29,7 +29,9 @@ class ESRGANInvocation(BaseInvocation): image: ImageField = InputField(description="The input image") model_name: ESRGAN_MODELS = InputField(default="RealESRGAN_x4plus.pth", description="The Real-ESRGAN model to use") - tile_size: int = InputField(default=512, ge=0, description="Tile size for tiled ESRGAN upscaling (0=tiling disabled)") + tile_size: int = InputField( + default=512, ge=0, description="Tile size for tiled ESRGAN upscaling (0=tiling disabled)" + ) def invoke(self, context: InvocationContext) -> ImageOutput: image = context.services.images.get_pil_image(self.image.image_name) From 010c8e8038f70a0740bac86a3ad184129f2ed512 Mon Sep 17 00:00:00 2001 From: Darren Ringer Date: Tue, 3 Oct 2023 21:48:09 -0400 Subject: [PATCH 20/31] Roll back change to buildAdHocUpscaleGraph.ts Undo the change made here which was causing automated tests to fail. --- .../features/nodes/util/graphBuilders/buildAdHocUpscaleGraph.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/invokeai/frontend/web/src/features/nodes/util/graphBuilders/buildAdHocUpscaleGraph.ts b/invokeai/frontend/web/src/features/nodes/util/graphBuilders/buildAdHocUpscaleGraph.ts index 09d742c0cd..c612e88598 100644 --- a/invokeai/frontend/web/src/features/nodes/util/graphBuilders/buildAdHocUpscaleGraph.ts +++ b/invokeai/frontend/web/src/features/nodes/util/graphBuilders/buildAdHocUpscaleGraph.ts @@ -24,7 +24,6 @@ export const buildAdHocUpscaleGraph = ({ type: 'esrgan', image: { image_name }, model_name: esrganModelName, - tile_size: 512, is_intermediate: true, }; From 23a06fd06dd5c5bec65e5cda4fba34f1d2c2b6a5 Mon Sep 17 00:00:00 2001 From: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed, 4 Oct 2023 15:23:31 +1100 Subject: [PATCH 21/31] feat(nodes): clear torch cache after upscaling This can use many GB of VRAM, so we need to clean up after ourselves. --- invokeai/app/invocations/upscale.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/invokeai/app/invocations/upscale.py b/invokeai/app/invocations/upscale.py index 7cb074a041..eeca83b17e 100644 --- a/invokeai/app/invocations/upscale.py +++ b/invokeai/app/invocations/upscale.py @@ -7,9 +7,11 @@ import numpy as np from basicsr.archs.rrdbnet_arch import RRDBNet from PIL import Image from realesrgan import RealESRGANer +import torch from invokeai.app.invocations.primitives import ImageField, ImageOutput from invokeai.app.models.image import ImageCategory, ResourceOrigin +from invokeai.backend.util.devices import choose_torch_device from .baseinvocation import BaseInvocation, InputField, InvocationContext, invocation @@ -22,6 +24,9 @@ ESRGAN_MODELS = Literal[ "RealESRGAN_x2plus.pth", ] +if choose_torch_device() == torch.device("mps"): + from torch import mps + @invocation("esrgan", title="Upscale (RealESRGAN)", tags=["esrgan", "upscale"], category="esrgan", version="1.0.1") class ESRGANInvocation(BaseInvocation): @@ -30,7 +35,7 @@ class ESRGANInvocation(BaseInvocation): image: ImageField = InputField(description="The input image") model_name: ESRGAN_MODELS = InputField(default="RealESRGAN_x4plus.pth", description="The Real-ESRGAN model to use") tile_size: int = InputField( - default=512, ge=0, description="Tile size for tiled ESRGAN upscaling (0=tiling disabled)" + default=400, ge=0, description="Tile size for tiled ESRGAN upscaling (0=tiling disabled)" ) def invoke(self, context: InvocationContext) -> ImageOutput: @@ -93,6 +98,7 @@ class ESRGANInvocation(BaseInvocation): ) # prepare image - Real-ESRGAN uses cv2 internally, and cv2 uses BGR vs RGB for PIL + # TODO: This strips the alpha... is that okay? cv_image = cv.cvtColor(np.array(image.convert("RGB")), cv.COLOR_RGB2BGR) # We can pass an `outscale` value here, but it just resizes the image by that factor after @@ -103,6 +109,10 @@ class ESRGANInvocation(BaseInvocation): # back to PIL pil_image = Image.fromarray(cv.cvtColor(upscaled_image, cv.COLOR_BGR2RGB)).convert("RGBA") + torch.cuda.empty_cache() + if choose_torch_device() == torch.device("mps"): + mps.empty_cache() + image_dto = context.services.images.create( image=pil_image, image_origin=ResourceOrigin.INTERNAL, From 17d451eaa7c143fd7a5a3fa41876ac5ad6039f73 Mon Sep 17 00:00:00 2001 From: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed, 4 Oct 2023 15:26:32 +1100 Subject: [PATCH 22/31] feat(images): add `png_compress_level` config The compress_level setting of PIL.Image.save(), used for PNG encoding. All settings are lossless. 0 = fastest, largest filesize, 9 = slowest, smallest filesize Closes #4786 --- invokeai/app/services/config/invokeai_config.py | 1 + invokeai/app/services/image_file_storage.py | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/invokeai/app/services/config/invokeai_config.py b/invokeai/app/services/config/invokeai_config.py index 8ea703f39a..d8b598815d 100644 --- a/invokeai/app/services/config/invokeai_config.py +++ b/invokeai/app/services/config/invokeai_config.py @@ -255,6 +255,7 @@ class InvokeAIAppConfig(InvokeAISettings): attention_slice_size: Literal["auto", "balanced", "max", 1, 2, 3, 4, 5, 6, 7, 8] = Field(default="auto", description='Slice size, valid when attention_type=="sliced"', category="Generation", ) force_tiled_decode : bool = Field(default=False, description="Whether to enable tiled VAE decode (reduces memory consumption with some performance penalty)", category="Generation",) force_tiled_decode: bool = Field(default=False, description="Whether to enable tiled VAE decode (reduces memory consumption with some performance penalty)", category="Generation",) + png_compress_level : int = Field(default=6, description="The compress_level setting of PIL.Image.save(), used for PNG encoding. All settings are lossless. 0 = fastest, largest filesize, 9 = slowest, smallest filesize", category="Generation", ) # QUEUE max_queue_size : int = Field(default=10000, gt=0, description="Maximum number of items in the session queue", category="Queue", ) diff --git a/invokeai/app/services/image_file_storage.py b/invokeai/app/services/image_file_storage.py index 75a5888175..cddc32c6d2 100644 --- a/invokeai/app/services/image_file_storage.py +++ b/invokeai/app/services/image_file_storage.py @@ -8,6 +8,7 @@ from typing import Dict, Optional, Union from PIL import Image, PngImagePlugin from PIL.Image import Image as PILImageType from send2trash import send2trash +from invokeai.app.services.config.invokeai_config import InvokeAIAppConfig from invokeai.app.util.thumbnails import get_thumbnail_name, make_thumbnail @@ -79,6 +80,7 @@ class DiskImageFileStorage(ImageFileStorageBase): __cache_ids: Queue # TODO: this is an incredibly naive cache __cache: Dict[Path, PILImageType] __max_cache_size: int + __compress_level: int def __init__(self, output_folder: Union[str, Path]): self.__cache = dict() @@ -87,7 +89,7 @@ class DiskImageFileStorage(ImageFileStorageBase): self.__output_folder: Path = output_folder if isinstance(output_folder, Path) else Path(output_folder) self.__thumbnails_folder = self.__output_folder / "thumbnails" - + self.__compress_level = InvokeAIAppConfig.get_config().png_compress_level # Validate required output folders at launch self.__validate_storage_folders() @@ -134,7 +136,7 @@ class DiskImageFileStorage(ImageFileStorageBase): if original_workflow is not None: pnginfo.add_text("invokeai_workflow", original_workflow) - image.save(image_path, "PNG", pnginfo=pnginfo) + image.save(image_path, "PNG", pnginfo=pnginfo, compress_level=self.__compress_level) thumbnail_name = get_thumbnail_name(image_name) thumbnail_path = self.get_path(thumbnail_name, thumbnail=True) From 8c59d2e5af9cce4aede397e800cac1e6e2835b63 Mon Sep 17 00:00:00 2001 From: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed, 4 Oct 2023 15:29:21 +1100 Subject: [PATCH 23/31] chore: isort --- invokeai/app/invocations/upscale.py | 2 +- invokeai/app/services/image_file_storage.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/invokeai/app/invocations/upscale.py b/invokeai/app/invocations/upscale.py index eeca83b17e..846c92a087 100644 --- a/invokeai/app/invocations/upscale.py +++ b/invokeai/app/invocations/upscale.py @@ -4,10 +4,10 @@ from typing import Literal import cv2 as cv import numpy as np +import torch from basicsr.archs.rrdbnet_arch import RRDBNet from PIL import Image from realesrgan import RealESRGANer -import torch from invokeai.app.invocations.primitives import ImageField, ImageOutput from invokeai.app.models.image import ImageCategory, ResourceOrigin diff --git a/invokeai/app/services/image_file_storage.py b/invokeai/app/services/image_file_storage.py index cddc32c6d2..7f32671a8c 100644 --- a/invokeai/app/services/image_file_storage.py +++ b/invokeai/app/services/image_file_storage.py @@ -8,8 +8,8 @@ from typing import Dict, Optional, Union from PIL import Image, PngImagePlugin from PIL.Image import Image as PILImageType from send2trash import send2trash -from invokeai.app.services.config.invokeai_config import InvokeAIAppConfig +from invokeai.app.services.config.invokeai_config import InvokeAIAppConfig from invokeai.app.util.thumbnails import get_thumbnail_name, make_thumbnail From 020d4302d13330255ceaa3998ec39267d02404c0 Mon Sep 17 00:00:00 2001 From: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed, 4 Oct 2023 19:12:44 +1100 Subject: [PATCH 24/31] Change version bump from patch to minor Because this adds a new field, it's a minor version bump --- invokeai/app/invocations/upscale.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/invokeai/app/invocations/upscale.py b/invokeai/app/invocations/upscale.py index 846c92a087..a1f3d2691a 100644 --- a/invokeai/app/invocations/upscale.py +++ b/invokeai/app/invocations/upscale.py @@ -28,7 +28,7 @@ if choose_torch_device() == torch.device("mps"): from torch import mps -@invocation("esrgan", title="Upscale (RealESRGAN)", tags=["esrgan", "upscale"], category="esrgan", version="1.0.1") +@invocation("esrgan", title="Upscale (RealESRGAN)", tags=["esrgan", "upscale"], category="esrgan", version="1.1.0") class ESRGANInvocation(BaseInvocation): """Upscales an image using RealESRGAN.""" From 421021cede9875f366434b6b467a1442b6f19a31 Mon Sep 17 00:00:00 2001 From: Jordan Hewitt <1633901+src-r-r@users.noreply.github.com> Date: Wed, 4 Oct 2023 14:41:21 -0700 Subject: [PATCH 25/31] Add 'make 3d' plugin / community node (#4794) * Add 'make 3d' plugin. * Update communityNodes.md Updated to Repo Link --------- Co-authored-by: Jordan Co-authored-by: Kent Keirsey <31807370+hipsterusername@users.noreply.github.com> Co-authored-by: Millun Atluri --- docs/nodes/communityNodes.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/docs/nodes/communityNodes.md b/docs/nodes/communityNodes.md index e14af07d17..47ed407695 100644 --- a/docs/nodes/communityNodes.md +++ b/docs/nodes/communityNodes.md @@ -10,6 +10,20 @@ To use a community workflow, download the the `.json` node graph file and load i -------------------------------- +-------------------------------- +### Make 3D + +**Description:** Create compelling 3D stereo images from 2D originals. + +**Node Link:** [https://gitlab.com/srcrr/shift3d/-/raw/main/make3d.py](https://gitlab.com/srcrr/shift3d) + +**Example Node Graph:** https://gitlab.com/srcrr/shift3d/-/raw/main/example-workflow.json?ref_type=heads&inline=false + +**Output Examples** + +![Painting of a cozy delapidated house](https://gitlab.com/srcrr/shift3d/-/raw/main/example-1.png){: style="height:512px;width:512px"} +![Photo of cute puppies](https://gitlab.com/srcrr/shift3d/-/raw/main/example-2.png){: style="height:512px;width:512px"} + -------------------------------- ### Ideal Size From 421440cae0fa17bc9769cdd2652d4b67f9f1aa7b Mon Sep 17 00:00:00 2001 From: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue, 3 Oct 2023 23:26:52 +1100 Subject: [PATCH 26/31] feat(nodes): exhaustive graph validation Makes graph validation logic more rigorous, validating graphs when they are created as part of a session or batch. `validate_self()` method added to `Graph` model. It does all the validation that `is_valid()` did, plus a few extras: - unique `node.id` values across graph - node ids match their key in `Graph.nodes` - recursively validate subgraphs - validate all edges - validate graph is acyclical The new method is required because `is_valid()` just returned a boolean. That behaviour is retained, but `validate_self()` now raises appropriate exceptions for validation errors. This are then surfaced to the client. The function is named `validate_self()` because pydantic reserves `validate()`. There are two main places where graphs are created - in batches and in sessions. Field validators are added to each of these for their `graph` fields, which call the new validation logic. **Closes #4744** In this issue, a batch is enqueued with an invalid graph. The output field is typed as optional while the input field is required. The field types themselves are not relevant - this change addresses the case where an invalid graph was created. The mismatched types problem is not noticed until we attempt to invoke the graph, because the graph was never *fully* validated. An error is raised during the call to `graph_execution_state.next()` in `invoker.py`. This function prepares the edges and validates them, raising an exception due to the mismatched types. This exception is caught by the session processor, but it doesn't handle this situation well - the graph is not marked as having an error and the queue item status is never changed. The queue item is therefore forever `in_progress`, so no new queue items are popped - the app won't do anything until the queue item is canceled manually. This commit addresses this by preventing invalid graphs from being created in the first place, addressing a substantial number of fail cases. --- invokeai/app/services/graph.py | 194 ++++++++++-------- .../session_queue/session_queue_common.py | 5 + 2 files changed, 112 insertions(+), 87 deletions(-) diff --git a/invokeai/app/services/graph.py b/invokeai/app/services/graph.py index 9dccd14026..ffe737024d 100644 --- a/invokeai/app/services/graph.py +++ b/invokeai/app/services/graph.py @@ -170,6 +170,18 @@ class NodeIdMismatchError(ValueError): pass +class InvalidSubGraphError(ValueError): + pass + + +class CyclicalGraphError(ValueError): + pass + + +class UnknownGraphValidationError(ValueError): + pass + + # TODO: Create and use an Empty output? @invocation_output("graph_output") class GraphInvocationOutput(BaseInvocationOutput): @@ -254,59 +266,6 @@ class Graph(BaseModel): default_factory=list, ) - @root_validator - def validate_nodes_and_edges(cls, values): - """Validates that all edges match nodes in the graph""" - nodes = cast(Optional[dict[str, BaseInvocation]], values.get("nodes")) - edges = cast(Optional[list[Edge]], values.get("edges")) - - if nodes is not None: - # Validate that all node ids are unique - node_ids = [n.id for n in nodes.values()] - duplicate_node_ids = set([node_id for node_id in node_ids if node_ids.count(node_id) >= 2]) - if duplicate_node_ids: - raise DuplicateNodeIdError(f"Node ids must be unique, found duplicates {duplicate_node_ids}") - - # Validate that all node ids match the keys in the nodes dict - for k, v in nodes.items(): - if k != v.id: - raise NodeIdMismatchError(f"Node ids must match, got {k} and {v.id}") - - if edges is not None and nodes is not None: - # Validate that all edges match nodes in the graph - node_ids = set([e.source.node_id for e in edges] + [e.destination.node_id for e in edges]) - missing_node_ids = [node_id for node_id in node_ids if node_id not in nodes] - if missing_node_ids: - raise NodeNotFoundError( - f"All edges must reference nodes in the graph, missing nodes: {missing_node_ids}" - ) - - # Validate that all edge fields match node fields in the graph - for edge in edges: - source_node = nodes.get(edge.source.node_id, None) - if source_node is None: - raise NodeFieldNotFoundError(f"Edge source node {edge.source.node_id} does not exist in the graph") - - destination_node = nodes.get(edge.destination.node_id, None) - if destination_node is None: - raise NodeFieldNotFoundError( - f"Edge destination node {edge.destination.node_id} does not exist in the graph" - ) - - # output fields are not on the node object directly, they are on the output type - if edge.source.field not in source_node.get_output_type().__fields__: - raise NodeFieldNotFoundError( - f"Edge source field {edge.source.field} does not exist in node {edge.source.node_id}" - ) - - # input fields are on the node - if edge.destination.field not in destination_node.__fields__: - raise NodeFieldNotFoundError( - f"Edge destination field {edge.destination.field} does not exist in node {edge.destination.node_id}" - ) - - return values - def add_node(self, node: BaseInvocation) -> None: """Adds a node to a graph @@ -377,53 +336,108 @@ class Graph(BaseModel): except KeyError: pass - def is_valid(self) -> bool: - """Validates the graph.""" + def validate_self(self) -> None: + """ + Validates the graph. + + Raises an exception if the graph is invalid: + - `DuplicateNodeIdError` + - `NodeIdMismatchError` + - `InvalidSubGraphError` + - `NodeNotFoundError` + - `NodeFieldNotFoundError` + - `CyclicalGraphError` + - `InvalidEdgeError` + """ + + # Validate that all node ids are unique + node_ids = [n.id for n in self.nodes.values()] + duplicate_node_ids = set([node_id for node_id in node_ids if node_ids.count(node_id) >= 2]) + if duplicate_node_ids: + raise DuplicateNodeIdError(f"Node ids must be unique, found duplicates {duplicate_node_ids}") + + # Validate that all node ids match the keys in the nodes dict + for k, v in self.nodes.items(): + if k != v.id: + raise NodeIdMismatchError(f"Node ids must match, got {k} and {v.id}") # Validate all subgraphs for gn in (n for n in self.nodes.values() if isinstance(n, GraphInvocation)): - if not gn.graph.is_valid(): - return False + try: + gn.graph.validate_self() + except Exception as e: + raise InvalidSubGraphError(f"Subgraph {gn.id} is invalid") from e - # Validate all edges reference nodes in the graph - node_ids = set([e.source.node_id for e in self.edges] + [e.destination.node_id for e in self.edges]) - if not all((self.has_node(node_id) for node_id in node_ids)): - return False + # Validate that all edges match nodes and fields in the graph + for edge in self.edges: + source_node = self.nodes.get(edge.source.node_id, None) + if source_node is None: + raise NodeNotFoundError(f"Edge source node {edge.source.node_id} does not exist in the graph") + + destination_node = self.nodes.get(edge.destination.node_id, None) + if destination_node is None: + raise NodeNotFoundError(f"Edge destination node {edge.destination.node_id} does not exist in the graph") + + # output fields are not on the node object directly, they are on the output type + if edge.source.field not in source_node.get_output_type().__fields__: + raise NodeFieldNotFoundError( + f"Edge source field {edge.source.field} does not exist in node {edge.source.node_id}" + ) + + # input fields are on the node + if edge.destination.field not in destination_node.__fields__: + raise NodeFieldNotFoundError( + f"Edge destination field {edge.destination.field} does not exist in node {edge.destination.node_id}" + ) # Validate there are no cycles g = self.nx_graph_flat() if not nx.is_directed_acyclic_graph(g): - return False + raise CyclicalGraphError("Graph contains cycles") # Validate all edge connections are valid - if not all( - ( - are_connections_compatible( - self.get_node(e.source.node_id), - e.source.field, - self.get_node(e.destination.node_id), - e.destination.field, + for e in self.edges: + if not are_connections_compatible( + self.get_node(e.source.node_id), + e.source.field, + self.get_node(e.destination.node_id), + e.destination.field, + ): + raise InvalidEdgeError( + f"Invalid edge from {e.source.node_id}.{e.source.field} to {e.destination.node_id}.{e.destination.field}" ) - for e in self.edges - ) + + # Validate all iterators & collectors + # TODO: may need to validate all iterators & collectors in subgraphs so edge connections in parent graphs will be available + for n in self.nodes.values(): + if isinstance(n, IterateInvocation) and not self._is_iterator_connection_valid(n.id): + raise InvalidEdgeError(f"Invalid iterator node {n.id}") + if isinstance(n, CollectInvocation) and not self._is_collector_connection_valid(n.id): + raise InvalidEdgeError(f"Invalid collector node {n.id}") + + return None + + def is_valid(self) -> bool: + """ + Checks if the graph is valid. + + Raises `UnknownGraphValidationError` if there is a problem validating the graph (not a validation error). + """ + try: + self.validate_self() + return True + except ( + DuplicateNodeIdError, + NodeIdMismatchError, + InvalidSubGraphError, + NodeNotFoundError, + NodeFieldNotFoundError, + CyclicalGraphError, + InvalidEdgeError, ): return False - - # Validate all iterators - # TODO: may need to validate all iterators in subgraphs so edge connections in parent graphs will be available - if not all( - (self._is_iterator_connection_valid(n.id) for n in self.nodes.values() if isinstance(n, IterateInvocation)) - ): - return False - - # Validate all collectors - # TODO: may need to validate all collectors in subgraphs so edge connections in parent graphs will be available - if not all( - (self._is_collector_connection_valid(n.id) for n in self.nodes.values() if isinstance(n, CollectInvocation)) - ): - return False - - return True + except Exception as e: + raise UnknownGraphValidationError(f"Problem validating graph {e}") from e def _validate_edge(self, edge: Edge): """Validates that a new edge doesn't create a cycle in the graph""" @@ -804,6 +818,12 @@ class GraphExecutionState(BaseModel): default_factory=dict, ) + @validator("graph") + def graph_is_valid(cls, v: Graph): + """Validates that the graph is valid""" + v.validate_self() + return v + class Config: schema_extra = { "required": [ diff --git a/invokeai/app/services/session_queue/session_queue_common.py b/invokeai/app/services/session_queue/session_queue_common.py index 905e568fa1..a1eada6523 100644 --- a/invokeai/app/services/session_queue/session_queue_common.py +++ b/invokeai/app/services/session_queue/session_queue_common.py @@ -123,6 +123,11 @@ class Batch(BaseModel): raise NodeNotFoundError(f"Field {batch_data.field_name} not found in node {batch_data.node_path}") return values + @validator("graph") + def validate_graph(cls, v: Graph): + v.validate_self() + return v + class Config: schema_extra = { "required": [ From 88e16ce051a4eb6d3692b6b85570ab656aa06593 Mon Sep 17 00:00:00 2001 From: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue, 3 Oct 2023 23:35:06 +1100 Subject: [PATCH 27/31] fix(nodes): mark session queue items failed on processor error When the processor has an error and it has a queue item, mark that item failed. This addresses processor errors resulting in `in_progress` queue items, which create a soft lock of the processor, requiring the user to cancel the `in_progress` item before anything else processes. --- .../services/session_processor/session_processor_default.py | 5 +++++ invokeai/app/services/session_queue/session_queue_base.py | 2 +- invokeai/app/services/session_queue/session_queue_sqlite.py | 5 +++-- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/invokeai/app/services/session_processor/session_processor_default.py b/invokeai/app/services/session_processor/session_processor_default.py index d5d08cc779..065b80e1a9 100644 --- a/invokeai/app/services/session_processor/session_processor_default.py +++ b/invokeai/app/services/session_processor/session_processor_default.py @@ -1,3 +1,4 @@ +import traceback from threading import BoundedSemaphore from threading import Event as ThreadEvent from threading import Thread @@ -123,6 +124,10 @@ class DefaultSessionProcessor(SessionProcessorBase): continue except Exception as e: self.__invoker.services.logger.error(f"Error in session processor: {e}") + if queue_item is not None: + self.__invoker.services.session_queue.cancel_queue_item( + queue_item.item_id, error=traceback.format_exc() + ) poll_now_event.wait(POLLING_INTERVAL) continue except Exception as e: diff --git a/invokeai/app/services/session_queue/session_queue_base.py b/invokeai/app/services/session_queue/session_queue_base.py index 0961759baa..cbc16f8283 100644 --- a/invokeai/app/services/session_queue/session_queue_base.py +++ b/invokeai/app/services/session_queue/session_queue_base.py @@ -80,7 +80,7 @@ class SessionQueueBase(ABC): pass @abstractmethod - def cancel_queue_item(self, item_id: int) -> SessionQueueItem: + def cancel_queue_item(self, item_id: int, error: Optional[str] = None) -> SessionQueueItem: """Cancels a session queue item""" pass diff --git a/invokeai/app/services/session_queue/session_queue_sqlite.py b/invokeai/app/services/session_queue/session_queue_sqlite.py index a13e13050e..19a5346e10 100644 --- a/invokeai/app/services/session_queue/session_queue_sqlite.py +++ b/invokeai/app/services/session_queue/session_queue_sqlite.py @@ -555,10 +555,11 @@ class SqliteSessionQueue(SessionQueueBase): self.__lock.release() return PruneResult(deleted=count) - def cancel_queue_item(self, item_id: int) -> SessionQueueItem: + def cancel_queue_item(self, item_id: int, error: Optional[str] = None) -> SessionQueueItem: queue_item = self.get_queue_item(item_id) if queue_item.status not in ["canceled", "failed", "completed"]: - queue_item = self._set_queue_item_status(item_id=item_id, status="canceled") + status = "failed" if error is not None else "canceled" + queue_item = self._set_queue_item_status(item_id=item_id, status=status, error=error) self.__invoker.services.queue.cancel(queue_item.session_id) self.__invoker.services.events.emit_session_canceled( queue_item_id=queue_item.item_id, From 8b7f8eaea290a788e02b4ec03ecb731ee9b96524 Mon Sep 17 00:00:00 2001 From: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue, 3 Oct 2023 23:37:49 +1100 Subject: [PATCH 28/31] chore: flake8 --- invokeai/app/services/graph.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/invokeai/app/services/graph.py b/invokeai/app/services/graph.py index ffe737024d..ab479300fc 100644 --- a/invokeai/app/services/graph.py +++ b/invokeai/app/services/graph.py @@ -2,7 +2,7 @@ import copy import itertools -from typing import Annotated, Any, Optional, Union, cast, get_args, get_origin, get_type_hints +from typing import Annotated, Any, Optional, Union, get_args, get_origin, get_type_hints import networkx as nx from pydantic import BaseModel, root_validator, validator From 3f4ea073d16c38cb519ce318c22831c38c661c52 Mon Sep 17 00:00:00 2001 From: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Thu, 5 Oct 2023 08:03:21 +1100 Subject: [PATCH 29/31] fix(ui): throw on fetch err when copying image --- .../web/src/features/ui/hooks/useCopyImageToClipboard.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/invokeai/frontend/web/src/features/ui/hooks/useCopyImageToClipboard.ts b/invokeai/frontend/web/src/features/ui/hooks/useCopyImageToClipboard.ts index cefbf3d14e..4b42a45e93 100644 --- a/invokeai/frontend/web/src/features/ui/hooks/useCopyImageToClipboard.ts +++ b/invokeai/frontend/web/src/features/ui/hooks/useCopyImageToClipboard.ts @@ -25,6 +25,9 @@ export const useCopyImageToClipboard = () => { try { const getImageBlob = async () => { const response = await fetch(image_url); + if (!response.ok) { + throw new Error(`Problem retrieving image data`); + } return await response.blob(); }; From fbe6452c4578d9794d47416092d16eb5d113e809 Mon Sep 17 00:00:00 2001 From: Ryan Dick Date: Wed, 4 Oct 2023 17:55:19 -0400 Subject: [PATCH 30/31] Add support for IPAdapterPlusXL based on https://github.com/tencent-ailab/IP-Adapter/commit/6219530507cb4696a0496f10c0e5a4f1dbdc7672. --- invokeai/backend/ip_adapter/ip_adapter.py | 24 ++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/invokeai/backend/ip_adapter/ip_adapter.py b/invokeai/backend/ip_adapter/ip_adapter.py index 94f3202ba0..4c846ecf00 100644 --- a/invokeai/backend/ip_adapter/ip_adapter.py +++ b/invokeai/backend/ip_adapter/ip_adapter.py @@ -218,6 +218,20 @@ class IPAdapterPlus(IPAdapter): return image_prompt_embeds, uncond_image_prompt_embeds +class IPAdapterPlusXL(IPAdapterPlus): + """IP-Adapter Plus for SDXL.""" + + def _init_image_proj_model(self, state_dict): + return Resampler.from_state_dict( + state_dict=state_dict, + depth=4, + dim_head=64, + heads=20, + num_queries=self._num_tokens, + ff_mult=4, + ).to(self.device, dtype=self.dtype) + + def build_ip_adapter( ip_adapter_ckpt_path: str, device: torch.device, dtype: torch.dtype = torch.float16 ) -> Union[IPAdapter, IPAdapterPlus]: @@ -228,6 +242,14 @@ def build_ip_adapter( is_plus = "proj.weight" not in state_dict["image_proj"] if is_plus: - return IPAdapterPlus(state_dict, device=device, dtype=dtype) + cross_attention_dim = state_dict["ip_adapter"]["1.to_k_ip.weight"].shape[-1] + if cross_attention_dim == 768: + # SD1 IP-Adapter Plus + return IPAdapterPlus(state_dict, device=device, dtype=dtype) + elif cross_attention_dim == 2048: + # SDXL IP-Adapter Plus + return IPAdapterPlusXL(state_dict, device=device, dtype=dtype) + else: + raise Exception(f"Unsupported IP-Adapter Plus cross-attention dimension: {cross_attention_dim}.") else: return IPAdapter(state_dict, device=device, dtype=dtype) From 78377469dbddd8456b12e830aa2f8cc19620f916 Mon Sep 17 00:00:00 2001 From: Ryan Dick Date: Thu, 5 Oct 2023 01:29:16 -0400 Subject: [PATCH 31/31] Add support for T2I-Adapter in node workflows (#4612) * Bump diffusers to 0.21.2. * Add T2IAdapterInvocation boilerplate. * Add T2I-Adapter model to model-management. * (minor) Tidy prepare_control_image(...). * Add logic to run the T2I-Adapter models at the start of the DenoiseLatentsInvocation. * Add logic for applying T2I-Adapter weights and accumulating. * Add T2IAdapter to MODEL_CLASSES map. * yarn typegen * Add model probes for T2I-Adapter models. * Add all of the frontend boilerplate required to use T2I-Adapter in the nodes editor. * Add T2IAdapterModel.convert_if_required(...). * Fix errors in T2I-Adapter input image sizing logic. * Fix bug with handling of multiple T2I-Adapters. * black / flake8 * Fix typo * yarn build * Add num_channels param to prepare_control_image(...). * Link to upstream diffusers bugfix PR that currently requires a workaround. * feat: Add Color Map Preprocessor Needed for the color T2I Adapter * feat: Add Color Map Preprocessor to Linear UI * Revert "feat: Add Color Map Preprocessor" This reverts commit a1119a00bf4af74a3f5f4f57a872a6d06055f677. * Revert "feat: Add Color Map Preprocessor to Linear UI" This reverts commit bd8a9b82d888cb0c8a04e83170b1dce2a8ceaac1. * Fix T2I-Adapter field rendering in workflow editor. * yarn build, yarn typegen --------- Co-authored-by: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Co-authored-by: psychedelicious <4822129+psychedelicious@users.noreply.github.com> --- invokeai/app/invocations/baseinvocation.py | 1 + invokeai/app/invocations/latent.py | 106 +++- invokeai/app/invocations/t2i_adapter.py | 83 +++ invokeai/app/util/controlnet_utils.py | 53 +- .../backend/model_management/model_probe.py | 28 + .../model_management/models/__init__.py | 6 + .../backend/model_management/models/base.py | 1 + .../model_management/models/t2i_adapter.py | 102 +++ .../stable_diffusion/diffusers_pipeline.py | 59 +- .../{App-ba2d118a.js => App-c6eb6a29.js} | 44 +- ...057bfc9.js => MantineProvider-2072a471.js} | 2 +- ...401.js => ThemeLocaleProvider-bbfac5eb.js} | 4 +- .../web/dist/assets/index-6f7e7659.js | 158 +++++ .../web/dist/assets/index-94062f76.js | 158 ----- invokeai/frontend/web/dist/index.html | 5 +- invokeai/frontend/web/dist/locales/en.json | 2 +- .../Invocation/fields/InputFieldRenderer.tsx | 13 + .../fields/inputs/T2IAdapterInputField.tsx | 19 + .../inputs/T2IAdapterModelInputField.tsx | 100 +++ .../src/features/nodes/store/nodesSlice.ts | 8 + .../web/src/features/nodes/types/constants.ts | 29 +- .../web/src/features/nodes/types/types.ts | 88 +++ .../nodes/util/fieldTemplateBuilders.ts | 62 ++ .../features/nodes/util/fieldValueBuilders.ts | 4 + .../parameters/types/parameterSchemas.ts | 11 + .../util/modelIdToT2IAdapterModelParam.ts | 29 + .../web/src/services/api/endpoints/models.ts | 42 ++ .../frontend/web/src/services/api/schema.d.ts | 594 ++++++++++++++++-- .../frontend/web/src/services/api/types.ts | 5 + tests/app/__init__.py | 0 tests/app/util/__init__.py | 0 tests/app/util/test_controlnet_utils.py | 42 ++ 32 files changed, 1610 insertions(+), 248 deletions(-) create mode 100644 invokeai/app/invocations/t2i_adapter.py create mode 100644 invokeai/backend/model_management/models/t2i_adapter.py rename invokeai/frontend/web/dist/assets/{App-ba2d118a.js => App-c6eb6a29.js} (53%) rename invokeai/frontend/web/dist/assets/{MantineProvider-a057bfc9.js => MantineProvider-2072a471.js} (99%) rename invokeai/frontend/web/dist/assets/{ThemeLocaleProvider-632b3401.js => ThemeLocaleProvider-bbfac5eb.js} (95%) create mode 100644 invokeai/frontend/web/dist/assets/index-6f7e7659.js delete mode 100644 invokeai/frontend/web/dist/assets/index-94062f76.js create mode 100644 invokeai/frontend/web/src/features/nodes/components/flow/nodes/Invocation/fields/inputs/T2IAdapterInputField.tsx create mode 100644 invokeai/frontend/web/src/features/nodes/components/flow/nodes/Invocation/fields/inputs/T2IAdapterModelInputField.tsx create mode 100644 invokeai/frontend/web/src/features/parameters/util/modelIdToT2IAdapterModelParam.ts create mode 100644 tests/app/__init__.py create mode 100644 tests/app/util/__init__.py create mode 100644 tests/app/util/test_controlnet_utils.py diff --git a/invokeai/app/invocations/baseinvocation.py b/invokeai/app/invocations/baseinvocation.py index 3285de3d5a..497dafa102 100644 --- a/invokeai/app/invocations/baseinvocation.py +++ b/invokeai/app/invocations/baseinvocation.py @@ -68,6 +68,7 @@ class FieldDescriptions: height = "Height of output (px)" control = "ControlNet(s) to apply" ip_adapter = "IP-Adapter to apply" + t2i_adapter = "T2I-Adapter(s) to apply" denoised_latents = "Denoised latents tensor" latents = "Latents tensor" strength = "Strength of denoising (proportional to steps)" diff --git a/invokeai/app/invocations/latent.py b/invokeai/app/invocations/latent.py index 10caeee67a..8842ba7bad 100644 --- a/invokeai/app/invocations/latent.py +++ b/invokeai/app/invocations/latent.py @@ -11,6 +11,7 @@ import torchvision.transforms as T from diffusers import AutoencoderKL, AutoencoderTiny from diffusers.image_processor import VaeImageProcessor from diffusers.models import UNet2DConditionModel +from diffusers.models.adapter import FullAdapterXL, T2IAdapter from diffusers.models.attention_processor import ( AttnProcessor2_0, LoRAAttnProcessor2_0, @@ -33,6 +34,7 @@ from invokeai.app.invocations.primitives import ( LatentsOutput, build_latents_output, ) +from invokeai.app.invocations.t2i_adapter import T2IAdapterField from invokeai.app.util.controlnet_utils import prepare_control_image from invokeai.app.util.step_callback import stable_diffusion_step_callback from invokeai.backend.ip_adapter.ip_adapter import IPAdapter, IPAdapterPlus @@ -47,6 +49,7 @@ from ...backend.stable_diffusion.diffusers_pipeline import ( ControlNetData, IPAdapterData, StableDiffusionGeneratorPipeline, + T2IAdapterData, image_resized_to_grid_as_tensor, ) from ...backend.stable_diffusion.diffusion.shared_invokeai_diffusion import PostprocessingSettings @@ -196,7 +199,7 @@ def get_scheduler( title="Denoise Latents", tags=["latents", "denoise", "txt2img", "t2i", "t2l", "img2img", "i2i", "l2l"], category="latents", - version="1.1.0", + version="1.2.0", ) class DenoiseLatentsInvocation(BaseInvocation): """Denoises noisy latents to decodable images""" @@ -226,9 +229,12 @@ class DenoiseLatentsInvocation(BaseInvocation): ip_adapter: Optional[IPAdapterField] = InputField( description=FieldDescriptions.ip_adapter, title="IP-Adapter", default=None, input=Input.Connection, ui_order=6 ) + t2i_adapter: Union[T2IAdapterField, list[T2IAdapterField]] = InputField( + description=FieldDescriptions.t2i_adapter, title="T2I-Adapter", default=None, input=Input.Connection, ui_order=7 + ) latents: Optional[LatentsField] = InputField(description=FieldDescriptions.latents, input=Input.Connection) denoise_mask: Optional[DenoiseMaskField] = InputField( - default=None, description=FieldDescriptions.mask, input=Input.Connection, ui_order=7 + default=None, description=FieldDescriptions.mask, input=Input.Connection, ui_order=8 ) @validator("cfg_scale") @@ -451,6 +457,91 @@ class DenoiseLatentsInvocation(BaseInvocation): end_step_percent=ip_adapter.end_step_percent, ) + def run_t2i_adapters( + self, + context: InvocationContext, + t2i_adapter: Optional[Union[T2IAdapterField, list[T2IAdapterField]]], + latents_shape: list[int], + do_classifier_free_guidance: bool, + ) -> Optional[list[T2IAdapterData]]: + if t2i_adapter is None: + return None + + # Handle the possibility that t2i_adapter could be a list or a single T2IAdapterField. + if isinstance(t2i_adapter, T2IAdapterField): + t2i_adapter = [t2i_adapter] + + if len(t2i_adapter) == 0: + return None + + t2i_adapter_data = [] + for t2i_adapter_field in t2i_adapter: + t2i_adapter_model_info = context.services.model_manager.get_model( + model_name=t2i_adapter_field.t2i_adapter_model.model_name, + model_type=ModelType.T2IAdapter, + base_model=t2i_adapter_field.t2i_adapter_model.base_model, + context=context, + ) + image = context.services.images.get_pil_image(t2i_adapter_field.image.image_name) + + # The max_unet_downscale is the maximum amount that the UNet model downscales the latent image internally. + if t2i_adapter_field.t2i_adapter_model.base_model == BaseModelType.StableDiffusion1: + max_unet_downscale = 8 + elif t2i_adapter_field.t2i_adapter_model.base_model == BaseModelType.StableDiffusionXL: + max_unet_downscale = 4 + else: + raise ValueError( + f"Unexpected T2I-Adapter base model type: '{t2i_adapter_field.t2i_adapter_model.base_model}'." + ) + + t2i_adapter_model: T2IAdapter + with t2i_adapter_model_info as t2i_adapter_model: + total_downscale_factor = t2i_adapter_model.total_downscale_factor + if isinstance(t2i_adapter_model.adapter, FullAdapterXL): + # HACK(ryand): Work around a bug in FullAdapterXL. This is being addressed upstream in diffusers by + # this PR: https://github.com/huggingface/diffusers/pull/5134. + total_downscale_factor = total_downscale_factor // 2 + + # Resize the T2I-Adapter input image. + # We select the resize dimensions so that after the T2I-Adapter's total_downscale_factor is applied, the + # result will match the latent image's dimensions after max_unet_downscale is applied. + t2i_input_height = latents_shape[2] // max_unet_downscale * total_downscale_factor + t2i_input_width = latents_shape[3] // max_unet_downscale * total_downscale_factor + + # Note: We have hard-coded `do_classifier_free_guidance=False`. This is because we only want to prepare + # a single image. If CFG is enabled, we will duplicate the resultant tensor after applying the + # T2I-Adapter model. + # + # Note: We re-use the `prepare_control_image(...)` from ControlNet for T2I-Adapter, because it has many + # of the same requirements (e.g. preserving binary masks during resize). + t2i_image = prepare_control_image( + image=image, + do_classifier_free_guidance=False, + width=t2i_input_width, + height=t2i_input_height, + num_channels=t2i_adapter_model.config.in_channels, + device=t2i_adapter_model.device, + dtype=t2i_adapter_model.dtype, + resize_mode=t2i_adapter_field.resize_mode, + ) + + adapter_state = t2i_adapter_model(t2i_image) + + if do_classifier_free_guidance: + for idx, value in enumerate(adapter_state): + adapter_state[idx] = torch.cat([value] * 2, dim=0) + + t2i_adapter_data.append( + T2IAdapterData( + adapter_state=adapter_state, + weight=t2i_adapter_field.weight, + begin_step_percent=t2i_adapter_field.begin_step_percent, + end_step_percent=t2i_adapter_field.end_step_percent, + ) + ) + + return t2i_adapter_data + # original idea by https://github.com/AmericanPresidentJimmyCarter # TODO: research more for second order schedulers timesteps def init_scheduler(self, scheduler, device, steps, denoising_start, denoising_end): @@ -522,6 +613,12 @@ class DenoiseLatentsInvocation(BaseInvocation): mask, masked_latents = self.prep_inpaint_mask(context, latents) + # TODO(ryand): I have hard-coded `do_classifier_free_guidance=True` to mirror the behaviour of ControlNets, + # below. Investigate whether this is appropriate. + t2i_adapter_data = self.run_t2i_adapters( + context, self.t2i_adapter, latents.shape, do_classifier_free_guidance=True + ) + # Get the source node id (we are invoking the prepared node) graph_execution_state = context.services.graph_execution_manager.get(context.graph_execution_state_id) source_node_id = graph_execution_state.prepared_source_mapping[self.id] @@ -602,8 +699,9 @@ class DenoiseLatentsInvocation(BaseInvocation): masked_latents=masked_latents, num_inference_steps=num_inference_steps, conditioning_data=conditioning_data, - control_data=controlnet_data, # list[ControlNetData], - ip_adapter_data=ip_adapter_data, # IPAdapterData, + control_data=controlnet_data, + ip_adapter_data=ip_adapter_data, + t2i_adapter_data=t2i_adapter_data, callback=step_callback, ) diff --git a/invokeai/app/invocations/t2i_adapter.py b/invokeai/app/invocations/t2i_adapter.py new file mode 100644 index 0000000000..aea6ab5c4e --- /dev/null +++ b/invokeai/app/invocations/t2i_adapter.py @@ -0,0 +1,83 @@ +from typing import Union + +from pydantic import BaseModel, Field + +from invokeai.app.invocations.baseinvocation import ( + BaseInvocation, + BaseInvocationOutput, + FieldDescriptions, + Input, + InputField, + InvocationContext, + OutputField, + UIType, + invocation, + invocation_output, +) +from invokeai.app.invocations.controlnet_image_processors import CONTROLNET_RESIZE_VALUES +from invokeai.app.invocations.primitives import ImageField +from invokeai.backend.model_management.models.base import BaseModelType + + +class T2IAdapterModelField(BaseModel): + model_name: str = Field(description="Name of the T2I-Adapter model") + base_model: BaseModelType = Field(description="Base model") + + +class T2IAdapterField(BaseModel): + image: ImageField = Field(description="The T2I-Adapter image prompt.") + t2i_adapter_model: T2IAdapterModelField = Field(description="The T2I-Adapter model to use.") + weight: Union[float, list[float]] = Field(default=1, description="The weight given to the T2I-Adapter") + begin_step_percent: float = Field( + default=0, ge=0, le=1, description="When the T2I-Adapter is first applied (% of total steps)" + ) + end_step_percent: float = Field( + default=1, ge=0, le=1, description="When the T2I-Adapter is last applied (% of total steps)" + ) + resize_mode: CONTROLNET_RESIZE_VALUES = Field(default="just_resize", description="The resize mode to use") + + +@invocation_output("t2i_adapter_output") +class T2IAdapterOutput(BaseInvocationOutput): + t2i_adapter: T2IAdapterField = OutputField(description=FieldDescriptions.t2i_adapter, title="T2I Adapter") + + +@invocation( + "t2i_adapter", title="T2I-Adapter", tags=["t2i_adapter", "control"], category="t2i_adapter", version="1.0.0" +) +class T2IAdapterInvocation(BaseInvocation): + """Collects T2I-Adapter info to pass to other nodes.""" + + # Inputs + image: ImageField = InputField(description="The IP-Adapter image prompt.") + ip_adapter_model: T2IAdapterModelField = InputField( + description="The T2I-Adapter model.", + title="T2I-Adapter Model", + input=Input.Direct, + ui_order=-1, + ) + weight: Union[float, list[float]] = InputField( + default=1, ge=0, description="The weight given to the T2I-Adapter", ui_type=UIType.Float, title="Weight" + ) + begin_step_percent: float = InputField( + default=0, ge=-1, le=2, description="When the T2I-Adapter is first applied (% of total steps)" + ) + end_step_percent: float = InputField( + default=1, ge=0, le=1, description="When the T2I-Adapter is last applied (% of total steps)" + ) + resize_mode: CONTROLNET_RESIZE_VALUES = InputField( + default="just_resize", + description="The resize mode applied to the T2I-Adapter input image so that it matches the target output size.", + ) + + def invoke(self, context: InvocationContext) -> T2IAdapterOutput: + return T2IAdapterOutput( + t2i_adapter=T2IAdapterField( + image=self.image, + t2i_adapter_model=self.ip_adapter_model, + weight=self.weight, + begin_step_percent=self.begin_step_percent, + end_step_percent=self.end_step_percent, + resize_mode=self.resize_mode, + ) + ) diff --git a/invokeai/app/util/controlnet_utils.py b/invokeai/app/util/controlnet_utils.py index 8516fa8917..e6f34a4c44 100644 --- a/invokeai/app/util/controlnet_utils.py +++ b/invokeai/app/util/controlnet_utils.py @@ -265,22 +265,41 @@ def np_img_resize(np_img: np.ndarray, resize_mode: str, h: int, w: int, device: def prepare_control_image( - # image used to be Union[PIL.Image.Image, List[PIL.Image.Image], torch.Tensor, List[torch.Tensor]] - # but now should be able to assume that image is a single PIL.Image, which simplifies things image: Image, - # FIXME: need to fix hardwiring of width and height, change to basing on latents dimensions? - # latents_to_match_resolution, # TorchTensor of shape (batch_size, 3, height, width) - width=512, # should be 8 * latent.shape[3] - height=512, # should be 8 * latent height[2] - # batch_size=1, # currently no batching - # num_images_per_prompt=1, # currently only single image + width: int, + height: int, + num_channels: int = 3, device="cuda", dtype=torch.float16, do_classifier_free_guidance=True, control_mode="balanced", resize_mode="just_resize_simple", ): - # FIXME: implement "crop_resize_simple" and "fill_resize_simple", or pull them out + """Pre-process images for ControlNets or T2I-Adapters. + + Args: + image (Image): The PIL image to pre-process. + width (int): The target width in pixels. + height (int): The target height in pixels. + num_channels (int, optional): The target number of image channels. This is achieved by converting the input + image to RGB, then naively taking the first `num_channels` channels. The primary use case is converting a + RGB image to a single-channel grayscale image. Raises if `num_channels` cannot be achieved. Defaults to 3. + device (str, optional): The target device for the output image. Defaults to "cuda". + dtype (_type_, optional): The dtype for the output image. Defaults to torch.float16. + do_classifier_free_guidance (bool, optional): If True, repeat the output image along the batch dimension. + Defaults to True. + control_mode (str, optional): Defaults to "balanced". + resize_mode (str, optional): Defaults to "just_resize_simple". + + Raises: + NotImplementedError: If resize_mode == "crop_resize_simple". + NotImplementedError: If resize_mode == "fill_resize_simple". + ValueError: If `resize_mode` is not recognized. + ValueError: If `num_channels` is out of range. + + Returns: + torch.Tensor: The pre-processed input tensor. + """ if ( resize_mode == "just_resize_simple" or resize_mode == "crop_resize_simple" @@ -289,10 +308,10 @@ def prepare_control_image( image = image.convert("RGB") if resize_mode == "just_resize_simple": image = image.resize((width, height), resample=PIL_INTERPOLATION["lanczos"]) - elif resize_mode == "crop_resize_simple": # not yet implemented - pass - elif resize_mode == "fill_resize_simple": # not yet implemented - pass + elif resize_mode == "crop_resize_simple": + raise NotImplementedError(f"prepare_control_image is not implemented for resize_mode='{resize_mode}'.") + elif resize_mode == "fill_resize_simple": + raise NotImplementedError(f"prepare_control_image is not implemented for resize_mode='{resize_mode}'.") nimage = np.array(image) nimage = nimage[None, :] nimage = np.concatenate([nimage], axis=0) @@ -313,9 +332,11 @@ def prepare_control_image( device=device, ) else: - pass - print("ERROR: invalid resize_mode ==> ", resize_mode) - exit(1) + raise ValueError(f"Unsupported resize_mode: '{resize_mode}'.") + + if timage.shape[1] < num_channels or num_channels <= 0: + raise ValueError(f"Cannot achieve the target of num_channels={num_channels}.") + timage = timage[:, :num_channels, :, :] timage = timage.to(device=device, dtype=dtype) cfg_injection = control_mode == "more_control" or control_mode == "unbalanced" diff --git a/invokeai/backend/model_management/model_probe.py b/invokeai/backend/model_management/model_probe.py index 7821971b38..19d64b035f 100644 --- a/invokeai/backend/model_management/model_probe.py +++ b/invokeai/backend/model_management/model_probe.py @@ -57,6 +57,7 @@ class ModelProbe(object): "AutoencoderTiny": ModelType.Vae, "ControlNetModel": ModelType.ControlNet, "CLIPVisionModelWithProjection": ModelType.CLIPVision, + "T2IAdapter": ModelType.T2IAdapter, } @classmethod @@ -408,6 +409,11 @@ class CLIPVisionCheckpointProbe(CheckpointProbeBase): raise NotImplementedError() +class T2IAdapterCheckpointProbe(CheckpointProbeBase): + def get_base_type(self) -> BaseModelType: + raise NotImplementedError() + + ######################################################## # classes for probing folders ####################################################### @@ -595,6 +601,26 @@ class CLIPVisionFolderProbe(FolderProbeBase): return BaseModelType.Any +class T2IAdapterFolderProbe(FolderProbeBase): + def get_base_type(self) -> BaseModelType: + config_file = self.folder_path / "config.json" + if not config_file.exists(): + raise InvalidModelException(f"Cannot determine base type for {self.folder_path}") + with open(config_file, "r") as file: + config = json.load(file) + + adapter_type = config.get("adapter_type", None) + if adapter_type == "full_adapter_xl": + return BaseModelType.StableDiffusionXL + elif adapter_type == "full_adapter" or "light_adapter": + # I haven't seen any T2I adapter models for SD2, so assume that this is an SD1 adapter. + return BaseModelType.StableDiffusion1 + else: + raise InvalidModelException( + f"Unable to determine base model for '{self.folder_path}' (adapter_type = {adapter_type})." + ) + + ############## register probe classes ###### ModelProbe.register_probe("diffusers", ModelType.Main, PipelineFolderProbe) ModelProbe.register_probe("diffusers", ModelType.Vae, VaeFolderProbe) @@ -603,6 +629,7 @@ ModelProbe.register_probe("diffusers", ModelType.TextualInversion, TextualInvers ModelProbe.register_probe("diffusers", ModelType.ControlNet, ControlNetFolderProbe) ModelProbe.register_probe("diffusers", ModelType.IPAdapter, IPAdapterFolderProbe) ModelProbe.register_probe("diffusers", ModelType.CLIPVision, CLIPVisionFolderProbe) +ModelProbe.register_probe("diffusers", ModelType.T2IAdapter, T2IAdapterFolderProbe) ModelProbe.register_probe("checkpoint", ModelType.Main, PipelineCheckpointProbe) ModelProbe.register_probe("checkpoint", ModelType.Vae, VaeCheckpointProbe) @@ -611,5 +638,6 @@ ModelProbe.register_probe("checkpoint", ModelType.TextualInversion, TextualInver ModelProbe.register_probe("checkpoint", ModelType.ControlNet, ControlNetCheckpointProbe) ModelProbe.register_probe("checkpoint", ModelType.IPAdapter, IPAdapterCheckpointProbe) ModelProbe.register_probe("checkpoint", ModelType.CLIPVision, CLIPVisionCheckpointProbe) +ModelProbe.register_probe("checkpoint", ModelType.T2IAdapter, T2IAdapterCheckpointProbe) ModelProbe.register_probe("onnx", ModelType.ONNX, ONNXFolderProbe) diff --git a/invokeai/backend/model_management/models/__init__.py b/invokeai/backend/model_management/models/__init__.py index d361301554..bf4b208395 100644 --- a/invokeai/backend/model_management/models/__init__.py +++ b/invokeai/backend/model_management/models/__init__.py @@ -25,6 +25,7 @@ from .lora import LoRAModel from .sdxl import StableDiffusionXLModel from .stable_diffusion import StableDiffusion1Model, StableDiffusion2Model from .stable_diffusion_onnx import ONNXStableDiffusion1Model, ONNXStableDiffusion2Model +from .t2i_adapter import T2IAdapterModel from .textual_inversion import TextualInversionModel from .vae import VaeModel @@ -38,6 +39,7 @@ MODEL_CLASSES = { ModelType.TextualInversion: TextualInversionModel, ModelType.IPAdapter: IPAdapterModel, ModelType.CLIPVision: CLIPVisionModel, + ModelType.T2IAdapter: T2IAdapterModel, }, BaseModelType.StableDiffusion2: { ModelType.ONNX: ONNXStableDiffusion2Model, @@ -48,6 +50,7 @@ MODEL_CLASSES = { ModelType.TextualInversion: TextualInversionModel, ModelType.IPAdapter: IPAdapterModel, ModelType.CLIPVision: CLIPVisionModel, + ModelType.T2IAdapter: T2IAdapterModel, }, BaseModelType.StableDiffusionXL: { ModelType.Main: StableDiffusionXLModel, @@ -59,6 +62,7 @@ MODEL_CLASSES = { ModelType.ONNX: ONNXStableDiffusion2Model, ModelType.IPAdapter: IPAdapterModel, ModelType.CLIPVision: CLIPVisionModel, + ModelType.T2IAdapter: T2IAdapterModel, }, BaseModelType.StableDiffusionXLRefiner: { ModelType.Main: StableDiffusionXLModel, @@ -70,6 +74,7 @@ MODEL_CLASSES = { ModelType.ONNX: ONNXStableDiffusion2Model, ModelType.IPAdapter: IPAdapterModel, ModelType.CLIPVision: CLIPVisionModel, + ModelType.T2IAdapter: T2IAdapterModel, }, BaseModelType.Any: { ModelType.CLIPVision: CLIPVisionModel, @@ -81,6 +86,7 @@ MODEL_CLASSES = { ModelType.ControlNet: ControlNetModel, ModelType.TextualInversion: TextualInversionModel, ModelType.IPAdapter: IPAdapterModel, + ModelType.T2IAdapter: T2IAdapterModel, }, # BaseModelType.Kandinsky2_1: { # ModelType.Main: Kandinsky2_1Model, diff --git a/invokeai/backend/model_management/models/base.py b/invokeai/backend/model_management/models/base.py index 45b018af90..6e507735d4 100644 --- a/invokeai/backend/model_management/models/base.py +++ b/invokeai/backend/model_management/models/base.py @@ -53,6 +53,7 @@ class ModelType(str, Enum): TextualInversion = "embedding" IPAdapter = "ip_adapter" CLIPVision = "clip_vision" + T2IAdapter = "t2i_adapter" class SubModelType(str, Enum): diff --git a/invokeai/backend/model_management/models/t2i_adapter.py b/invokeai/backend/model_management/models/t2i_adapter.py new file mode 100644 index 0000000000..4adb9901f9 --- /dev/null +++ b/invokeai/backend/model_management/models/t2i_adapter.py @@ -0,0 +1,102 @@ +import os +from enum import Enum +from typing import Literal, Optional + +import torch +from diffusers import T2IAdapter + +from invokeai.backend.model_management.models.base import ( + BaseModelType, + EmptyConfigLoader, + InvalidModelException, + ModelBase, + ModelConfigBase, + ModelNotFoundException, + ModelType, + SubModelType, + calc_model_size_by_data, + calc_model_size_by_fs, + classproperty, +) + + +class T2IAdapterModelFormat(str, Enum): + Diffusers = "diffusers" + + +class T2IAdapterModel(ModelBase): + class DiffusersConfig(ModelConfigBase): + model_format: Literal[T2IAdapterModelFormat.Diffusers] + + def __init__(self, model_path: str, base_model: BaseModelType, model_type: ModelType): + assert model_type == ModelType.T2IAdapter + super().__init__(model_path, base_model, model_type) + + config = EmptyConfigLoader.load_config(self.model_path, config_name="config.json") + + model_class_name = config.get("_class_name", None) + if model_class_name not in {"T2IAdapter"}: + raise InvalidModelException(f"Invalid T2I-Adapter model. Unknown _class_name: '{model_class_name}'.") + + self.model_class = self._hf_definition_to_type(["diffusers", model_class_name]) + self.model_size = calc_model_size_by_fs(self.model_path) + + def get_size(self, child_type: Optional[SubModelType] = None): + if child_type is not None: + raise ValueError(f"T2I-Adapters do not have child models. Invalid child type: '{child_type}'.") + return self.model_size + + def get_model( + self, + torch_dtype: Optional[torch.dtype], + child_type: Optional[SubModelType] = None, + ) -> T2IAdapter: + if child_type is not None: + raise ValueError(f"T2I-Adapters do not have child models. Invalid child type: '{child_type}'.") + + model = None + for variant in ["fp16", None]: + try: + model = self.model_class.from_pretrained( + self.model_path, + torch_dtype=torch_dtype, + variant=variant, + ) + break + except Exception: + pass + if not model: + raise ModelNotFoundException() + + # Calculate a more accurate size after loading the model into memory. + self.model_size = calc_model_size_by_data(model) + return model + + @classproperty + def save_to_config(cls) -> bool: + return False + + @classmethod + def detect_format(cls, path: str): + if not os.path.exists(path): + raise ModelNotFoundException(f"Model not found at '{path}'.") + + if os.path.isdir(path): + if os.path.exists(os.path.join(path, "config.json")): + return T2IAdapterModelFormat.Diffusers + + raise InvalidModelException(f"Unsupported T2I-Adapter format: '{path}'.") + + @classmethod + def convert_if_required( + cls, + model_path: str, + output_path: str, + config: ModelConfigBase, + base_model: BaseModelType, + ) -> str: + format = cls.detect_format(model_path) + if format == T2IAdapterModelFormat.Diffusers: + return model_path + else: + raise ValueError(f"Unsupported format: '{format}'.") diff --git a/invokeai/backend/stable_diffusion/diffusers_pipeline.py b/invokeai/backend/stable_diffusion/diffusers_pipeline.py index 150481747a..faac4fadaa 100644 --- a/invokeai/backend/stable_diffusion/diffusers_pipeline.py +++ b/invokeai/backend/stable_diffusion/diffusers_pipeline.py @@ -173,6 +173,16 @@ class IPAdapterData: end_step_percent: float = Field(default=1.0) +@dataclass +class T2IAdapterData: + """A structure containing the information required to apply conditioning from a single T2I-Adapter model.""" + + adapter_state: dict[torch.Tensor] = Field() + weight: Union[float, list[float]] = Field(default=1.0) + begin_step_percent: float = Field(default=0.0) + end_step_percent: float = Field(default=1.0) + + @dataclass class InvokeAIStableDiffusionPipelineOutput(StableDiffusionPipelineOutput): r""" @@ -327,6 +337,7 @@ class StableDiffusionGeneratorPipeline(StableDiffusionPipeline): callback: Callable[[PipelineIntermediateState], None] = None, control_data: List[ControlNetData] = None, ip_adapter_data: Optional[IPAdapterData] = None, + t2i_adapter_data: Optional[list[T2IAdapterData]] = None, mask: Optional[torch.Tensor] = None, masked_latents: Optional[torch.Tensor] = None, seed: Optional[int] = None, @@ -379,6 +390,7 @@ class StableDiffusionGeneratorPipeline(StableDiffusionPipeline): additional_guidance=additional_guidance, control_data=control_data, ip_adapter_data=ip_adapter_data, + t2i_adapter_data=t2i_adapter_data, callback=callback, ) finally: @@ -399,6 +411,7 @@ class StableDiffusionGeneratorPipeline(StableDiffusionPipeline): additional_guidance: List[Callable] = None, control_data: List[ControlNetData] = None, ip_adapter_data: Optional[IPAdapterData] = None, + t2i_adapter_data: Optional[list[T2IAdapterData]] = None, callback: Callable[[PipelineIntermediateState], None] = None, ): self._adjust_memory_efficient_attention(latents) @@ -454,6 +467,7 @@ class StableDiffusionGeneratorPipeline(StableDiffusionPipeline): additional_guidance=additional_guidance, control_data=control_data, ip_adapter_data=ip_adapter_data, + t2i_adapter_data=t2i_adapter_data, ) latents = step_output.prev_sample @@ -500,6 +514,7 @@ class StableDiffusionGeneratorPipeline(StableDiffusionPipeline): additional_guidance: List[Callable] = None, control_data: List[ControlNetData] = None, ip_adapter_data: Optional[IPAdapterData] = None, + t2i_adapter_data: Optional[list[T2IAdapterData]] = None, ): # invokeai_diffuser has batched timesteps, but diffusers schedulers expect a single value timestep = t[0] @@ -527,11 +542,15 @@ class StableDiffusionGeneratorPipeline(StableDiffusionPipeline): # otherwise, set IP-Adapter scale to 0, so it has no effect ip_adapter_data.ip_adapter_model.set_scale(0.0) - # handle ControlNet(s) - # default is no controlnet, so set controlnet processing output to None - controlnet_down_block_samples, controlnet_mid_block_sample = None, None - if control_data is not None: - controlnet_down_block_samples, controlnet_mid_block_sample = self.invokeai_diffuser.do_controlnet_step( + # Handle ControlNet(s) and T2I-Adapter(s) + down_block_additional_residuals = None + mid_block_additional_residual = None + if control_data is not None and t2i_adapter_data is not None: + # TODO(ryand): This is a limitation of the UNet2DConditionModel API, not a fundamental incompatibility + # between ControlNets and T2I-Adapters. We will try to fix this upstream in diffusers. + raise Exception("ControlNet(s) and T2I-Adapter(s) cannot be used simultaneously (yet).") + elif control_data is not None: + down_block_additional_residuals, mid_block_additional_residual = self.invokeai_diffuser.do_controlnet_step( control_data=control_data, sample=latent_model_input, timestep=timestep, @@ -539,6 +558,32 @@ class StableDiffusionGeneratorPipeline(StableDiffusionPipeline): total_step_count=total_step_count, conditioning_data=conditioning_data, ) + elif t2i_adapter_data is not None: + accum_adapter_state = None + for single_t2i_adapter_data in t2i_adapter_data: + # Determine the T2I-Adapter weights for the current denoising step. + first_t2i_adapter_step = math.floor(single_t2i_adapter_data.begin_step_percent * total_step_count) + last_t2i_adapter_step = math.ceil(single_t2i_adapter_data.end_step_percent * total_step_count) + t2i_adapter_weight = ( + single_t2i_adapter_data.weight[step_index] + if isinstance(single_t2i_adapter_data.weight, list) + else single_t2i_adapter_data.weight + ) + if step_index < first_t2i_adapter_step or step_index > last_t2i_adapter_step: + # If the current step is outside of the T2I-Adapter's begin/end step range, then set its weight to 0 + # so it has no effect. + t2i_adapter_weight = 0.0 + + # Apply the t2i_adapter_weight, and accumulate. + if accum_adapter_state is None: + # Handle the first T2I-Adapter. + accum_adapter_state = [val * t2i_adapter_weight for val in single_t2i_adapter_data.adapter_state] + else: + # Add to the previous adapter states. + for idx, value in enumerate(single_t2i_adapter_data.adapter_state): + accum_adapter_state[idx] += value * t2i_adapter_weight + + down_block_additional_residuals = accum_adapter_state uc_noise_pred, c_noise_pred = self.invokeai_diffuser.do_unet_step( sample=latent_model_input, @@ -547,8 +592,8 @@ class StableDiffusionGeneratorPipeline(StableDiffusionPipeline): total_step_count=total_step_count, conditioning_data=conditioning_data, # extra: - down_block_additional_residuals=controlnet_down_block_samples, # from controlnet(s) - mid_block_additional_residual=controlnet_mid_block_sample, # from controlnet(s) + down_block_additional_residuals=down_block_additional_residuals, + mid_block_additional_residual=mid_block_additional_residual, ) guidance_scale = conditioning_data.guidance_scale diff --git a/invokeai/frontend/web/dist/assets/App-ba2d118a.js b/invokeai/frontend/web/dist/assets/App-c6eb6a29.js similarity index 53% rename from invokeai/frontend/web/dist/assets/App-ba2d118a.js rename to invokeai/frontend/web/dist/assets/App-c6eb6a29.js index 6ab7aae3d7..d496e16994 100644 --- a/invokeai/frontend/web/dist/assets/App-ba2d118a.js +++ b/invokeai/frontend/web/dist/assets/App-c6eb6a29.js @@ -1,7 +1,7 @@ -import{a as Dc,b as W_,S as U_,c as G_,d as K_,e as o1,f as q_,i as s1,g as vR,h as xR,j as bR,k as yR,l as X_,m as CR,n as YC,o as Q_,t as wR,p as SR,q as kR,r as jR,s as _R,u as IR,v as d,w as a,x as $x,y as qp,z as PR,A as ER,B as MR,C as OR,P as RR,D as Lx,E as DR,F as AR,G as TR,H as NR,I as Y_,J as ke,K as Tn,L as $R,M as LR,N as zR,O as Wt,Q as we,R as Ye,T as un,U as He,V as vd,W as dr,X as In,Y as Un,Z as on,_ as fa,$ as oi,a0 as dt,a1 as Co,a2 as rc,a3 as pa,a4 as ma,a5 as ph,a6 as zx,a7 as xd,a8 as pn,a9 as FR,aa as H,ab as ZC,ac as BR,ad as Z_,ae as a1,af as bd,ag as Ac,ah as HR,ai as J_,aj as eI,ak as tI,al as Ho,am as VR,an as ce,ao as xe,ap as Ft,aq as W,ar as WR,as as JC,at as UR,au as GR,av as KR,aw as el,ax as te,ay as qR,az as ct,aA as Qt,aB as Ie,aC as L,aD as cr,aE as Jn,aF as je,aG as Z,aH as nI,aI as XR,aJ as QR,aK as YR,aL as ZR,aM as qr,aN as Fx,aO as ha,aP as Nr,aQ as yd,aR as JR,aS as eD,aT as ew,aU as Bx,aV as ve,aW as Xr,aX as tD,aY as rI,aZ as oI,a_ as tw,a$ as nD,b0 as rD,b1 as oD,b2 as ga,b3 as Hx,b4 as yt,b5 as sD,b6 as aD,b7 as sI,b8 as aI,b9 as mh,ba as iD,bb as nw,bc as iI,bd as lD,be as cD,bf as uD,bg as dD,bh as fD,bi as pD,bj as mD,bk as lI,bl as hD,bm as gD,bn as vD,bo as xD,bp as bD,bq as va,br as vc,bs as yD,bt as $r,bu as CD,bv as wD,bw as SD,bx as rw,by as kD,bz as jD,bA as Zs,bB as hh,bC as cI,bD as uI,bE as to,bF as dI,bG as _D,bH as Fi,bI as Mu,bJ as ow,bK as ID,bL as PD,bM as ED,bN as qf,bO as Xf,bP as bu,bQ as Q0,bR as Nu,bS as $u,bT as Lu,bU as zu,bV as sw,bW as Xp,bX as Y0,bY as Qp,bZ as aw,b_ as i1,b$ as Z0,c0 as l1,c1 as J0,c2 as Yp,c3 as iw,c4 as Bi,c5 as lw,c6 as Hi,c7 as cw,c8 as Zp,c9 as Cd,ca as MD,cb as fI,cc as uw,cd as gh,ce as OD,cf as c1,cg as dw,ch as Fr,ci as Ta,cj as fw,ck as Vx,cl as RD,cm as DD,cn as ev,co as pw,cp as u1,cq as vh,cr as AD,cs as pI,ct as d1,cu as f1,cv as mI,cw as TD,cx as p1,cy as ND,cz as m1,cA as $D,cB as h1,cC as LD,cD as zD,cE as FD,cF as Wx,cG as Ux,cH as Gx,cI as Kx,cJ as qx,cK as xh,cL as Xx,cM as Xs,cN as hI,cO as gI,cP as Qx,cQ as vI,cR as BD,cS as yu,cT as sa,cU as xI,cV as bI,cW as mw,cX as Yx,cY as yI,cZ as Zx,c_ as Jx,c$ as CI,d0 as Mn,d1 as HD,d2 as $n,d3 as bh,d4 as eb,d5 as wI,d6 as SI,d7 as VD,d8 as WD,d9 as UD,da as GD,db as KD,dc as qD,dd as XD,de as QD,df as YD,dg as ZD,dh as hw,di as tb,dj as JD,dk as eA,dl as wd,dm as tA,dn as nA,dp as yh,dq as rA,dr as oA,ds as sA,dt as aA,du as mn,dv as iA,dw as lA,dx as cA,dy as uA,dz as dA,dA as fA,dB as Ku,dC as gw,dD as Xo,dE as kI,dF as pA,dG as nb,dH as mA,dI as vw,dJ as hA,dK as gA,dL as vA,dM as jI,dN as xA,dO as bA,dP as yA,dQ as CA,dR as _I,dS as wA,dT as SA,dU as xw,dV as kA,dW as jA,dX as _A,dY as IA,dZ as PA,d_ as EA,d$ as MA,e0 as II,e1 as OA,e2 as RA,e3 as DA,e4 as bw,e5 as Qf,e6 as PI,e7 as AA,e8 as TA,e9 as NA,ea as $A,eb as LA,ec as Vo,ed as zA,ee as FA,ef as BA,eg as HA,eh as VA,ei as WA,ej as UA,ek as GA,el as KA,em as qA,en as XA,eo as QA,ep as YA,eq as ZA,er as JA,es as eT,et as yw,eu as tT,ev as nT,ew as rT,ex as oT,ey as sT,ez as aT,eA as iT,eB as Cw,eC as ww,eD as EI,eE as lT,eF as zo,eG as qu,eH as wr,eI as cT,eJ as uT,eK as MI,eL as OI,eM as dT,eN as Sw,eO as fT,eP as kw,eQ as jw,eR as _w,eS as pT,eT as mT,eU as Iw,eV as Pw,eW as hT,eX as gT,eY as Jp,eZ as vT,e_ as Ew,e$ as Mw,f0 as xT,f1 as bT,f2 as yT,f3 as RI,f4 as CT,f5 as wT,f6 as DI,f7 as ST,f8 as kT,f9 as Ow,fa as jT,fb as Rw,fc as _T,fd as AI,fe as TI,ff as Sd,fg as NI,fh as Pi,fi as $I,fj as Dw,fk as IT,fl as PT,fm as LI,fn as ET,fo as MT,fp as OT,fq as RT,fr as DT,fs as rb,ft as g1,fu as Aw,fv as tl,fw as AT,fx as TT,fy as NT,fz as zI,fA as ob,fB as FI,fC as sb,fD as BI,fE as $T,fF as Ys,fG as LT,fH as HI,fI as zT,fJ as ab,fK as VI,fL as FT,fM as BT,fN as HT,fO as VT,fP as WT,fQ as UT,fR as GT,fS as em,fT as Ou,fU as Ql,fV as KT,fW as qT,fX as XT,fY as QT,fZ as YT,f_ as ZT,f$ as JT,g0 as eN,g1 as Tw,g2 as tN,g3 as nN,g4 as rN,g5 as oN,g6 as sN,g7 as aN,g8 as Nw,g9 as iN,ga as lN,gb as cN,gc as uN,gd as dN,ge as fN,gf as pN,gg as $w,gh as mN,gi as hN,gj as gN,gk as vN,gl as xN,gm as bN,gn as yN,go as CN,gp as wN,gq as SN,gr as kN,gs as jN,gt as _N,gu as IN,gv as kd,gw as PN,gx as EN,gy as MN,gz as ON,gA as RN,gB as DN,gC as AN,gD as TN,gE as Lw,gF as Tp,gG as NN,gH as tm,gI as WI,gJ as nm,gK as $N,gL as LN,gM as oc,gN as UI,gO as GI,gP as ib,gQ as zN,gR as FN,gS as BN,gT as v1,gU as KI,gV as HN,gW as VN,gX as qI,gY as WN,gZ as UN,g_ as GN,g$ as KN,h0 as qN,h1 as zw,h2 as Ml,h3 as XN,h4 as QN,h5 as YN,h6 as ZN,h7 as JN,h8 as e9,h9 as Fw,ha as t9,hb as n9,hc as r9,hd as o9,he as s9,hf as a9,hg as i9,hh as l9,hi as tv,hj as nv,hk as rv,hl as Yf,hm as Bw,hn as x1,ho as Hw,hp as c9,hq as u9,hr as d9,hs as f9,ht as XI,hu as p9,hv as m9,hw as h9,hx as g9,hy as v9,hz as x9,hA as b9,hB as y9,hC as C9,hD as w9,hE as S9,hF as Zf,hG as ov,hH as k9,hI as j9,hJ as _9,hK as I9,hL as P9,hM as E9,hN as M9,hO as O9,hP as R9,hQ as D9,hR as Vw,hS as Ww,hT as A9,hU as T9,hV as N9,hW as $9,hX as L9}from"./index-94062f76.js";import{u as QI,a as xa,b as z9,r as Re,f as F9,g as Uw,c as mt,d as Rn}from"./MantineProvider-a057bfc9.js";var B9=200;function H9(e,t,n,r){var o=-1,s=G_,i=!0,l=e.length,u=[],p=t.length;if(!l)return u;n&&(t=Dc(t,W_(n))),r?(s=K_,i=!1):t.length>=B9&&(s=o1,i=!1,t=new U_(t));e:for(;++o=120&&m.length>=120)?new U_(i&&m):void 0}m=e[0];var h=-1,g=l[0];e:for(;++h{r.has(s)&&n(o,s)})}function r$(e,t){if(e==null)return{};var n={},r=Object.keys(e),o,s;for(s=0;s=0)&&(n[o]=e[o]);return n}const YI=({id:e,x:t,y:n,width:r,height:o,style:s,color:i,strokeColor:l,strokeWidth:u,className:p,borderRadius:m,shapeRendering:h,onClick:g,selected:x})=>{const{background:y,backgroundColor:b}=s||{},w=i||y||b;return a.jsx("rect",{className:$x(["react-flow__minimap-node",{selected:x},p]),x:t,y:n,rx:m,ry:m,width:r,height:o,fill:w,stroke:l,strokeWidth:u,shapeRendering:h,onClick:g?S=>g(S,e):void 0})};YI.displayName="MiniMapNode";var o$=d.memo(YI);const s$=e=>e.nodeOrigin,a$=e=>e.getNodes().filter(t=>!t.hidden&&t.width&&t.height),sv=e=>e instanceof Function?e:()=>e;function i$({nodeStrokeColor:e="transparent",nodeColor:t="#e2e2e2",nodeClassName:n="",nodeBorderRadius:r=5,nodeStrokeWidth:o=2,nodeComponent:s=o$,onClick:i}){const l=qp(a$,Lx),u=qp(s$),p=sv(t),m=sv(e),h=sv(n),g=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return a.jsx(a.Fragment,{children:l.map(x=>{const{x:y,y:b}=PR(x,u).positionAbsolute;return a.jsx(s,{x:y,y:b,width:x.width,height:x.height,style:x.style,selected:x.selected,className:h(x),color:p(x),borderRadius:r,strokeColor:m(x),strokeWidth:o,shapeRendering:g,onClick:i,id:x.id},x.id)})})}var l$=d.memo(i$);const c$=200,u$=150,d$=e=>{const t=e.getNodes(),n={x:-e.transform[0]/e.transform[2],y:-e.transform[1]/e.transform[2],width:e.width/e.transform[2],height:e.height/e.transform[2]};return{viewBB:n,boundingRect:t.length>0?TR(NR(t,e.nodeOrigin),n):n,rfId:e.rfId}},f$="react-flow__minimap-desc";function ZI({style:e,className:t,nodeStrokeColor:n="transparent",nodeColor:r="#e2e2e2",nodeClassName:o="",nodeBorderRadius:s=5,nodeStrokeWidth:i=2,nodeComponent:l,maskColor:u="rgb(240, 240, 240, 0.6)",maskStrokeColor:p="none",maskStrokeWidth:m=1,position:h="bottom-right",onClick:g,onNodeClick:x,pannable:y=!1,zoomable:b=!1,ariaLabel:w="React Flow mini map",inversePan:S=!1,zoomStep:j=10,offsetScale:_=5}){const E=ER(),I=d.useRef(null),{boundingRect:M,viewBB:R,rfId:D}=qp(d$,Lx),A=(e==null?void 0:e.width)??c$,O=(e==null?void 0:e.height)??u$,T=M.width/A,X=M.height/O,B=Math.max(T,X),V=B*A,U=B*O,N=_*B,$=M.x-(V-M.width)/2-N,q=M.y-(U-M.height)/2-N,F=V+N*2,Q=U+N*2,Y=`${f$}-${D}`,se=d.useRef(0);se.current=B,d.useEffect(()=>{if(I.current){const G=MR(I.current),K=J=>{const{transform:ie,d3Selection:de,d3Zoom:ge}=E.getState();if(J.sourceEvent.type!=="wheel"||!de||!ge)return;const Ce=-J.sourceEvent.deltaY*(J.sourceEvent.deltaMode===1?.05:J.sourceEvent.deltaMode?1:.002)*j,he=ie[2]*Math.pow(2,Ce);ge.scaleTo(de,he)},ee=J=>{const{transform:ie,d3Selection:de,d3Zoom:ge,translateExtent:Ce,width:he,height:fe}=E.getState();if(J.sourceEvent.type!=="mousemove"||!de||!ge)return;const Oe=se.current*Math.max(1,ie[2])*(S?-1:1),_e={x:ie[0]-J.sourceEvent.movementX*Oe,y:ie[1]-J.sourceEvent.movementY*Oe},Ne=[[0,0],[he,fe]],nt=DR.translate(_e.x,_e.y).scale(ie[2]),$e=ge.constrain()(nt,Ne,Ce);ge.transform(de,$e)},le=OR().on("zoom",y?ee:null).on("zoom.wheel",b?K:null);return G.call(le),()=>{G.on("zoom",null)}}},[y,b,S,j]);const ae=g?G=>{const K=AR(G);g(G,{x:K[0],y:K[1]})}:void 0,re=x?(G,K)=>{const ee=E.getState().nodeInternals.get(K);x(G,ee)}:void 0;return a.jsx(RR,{position:h,style:e,className:$x(["react-flow__minimap",t]),"data-testid":"rf__minimap",children:a.jsxs("svg",{width:A,height:O,viewBox:`${$} ${q} ${F} ${Q}`,role:"img","aria-labelledby":Y,ref:I,onClick:ae,children:[w&&a.jsx("title",{id:Y,children:w}),a.jsx(l$,{onClick:re,nodeColor:r,nodeStrokeColor:n,nodeBorderRadius:s,nodeClassName:o,nodeStrokeWidth:i,nodeComponent:l}),a.jsx("path",{className:"react-flow__minimap-mask",d:`M${$-N},${q-N}h${F+N*2}v${Q+N*2}h${-F-N*2}z - M${R.x},${R.y}h${R.width}v${R.height}h${-R.width}z`,fill:u,fillRule:"evenodd",stroke:p,strokeWidth:m,pointerEvents:"none"})]})})}ZI.displayName="MiniMap";var p$=d.memo(ZI),Wo;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(Wo||(Wo={}));function m$({color:e,dimensions:t,lineWidth:n}){return a.jsx("path",{stroke:e,strokeWidth:n,d:`M${t[0]/2} 0 V${t[1]} M0 ${t[1]/2} H${t[0]}`})}function h$({color:e,radius:t}){return a.jsx("circle",{cx:t,cy:t,r:t,fill:e})}const g$={[Wo.Dots]:"#91919a",[Wo.Lines]:"#eee",[Wo.Cross]:"#e2e2e2"},v$={[Wo.Dots]:1,[Wo.Lines]:1,[Wo.Cross]:6},x$=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function JI({id:e,variant:t=Wo.Dots,gap:n=20,size:r,lineWidth:o=1,offset:s=2,color:i,style:l,className:u}){const p=d.useRef(null),{transform:m,patternId:h}=qp(x$,Lx),g=i||g$[t],x=r||v$[t],y=t===Wo.Dots,b=t===Wo.Cross,w=Array.isArray(n)?n:[n,n],S=[w[0]*m[2]||1,w[1]*m[2]||1],j=x*m[2],_=b?[j,j]:S,E=y?[j/s,j/s]:[_[0]/s,_[1]/s];return a.jsxs("svg",{className:$x(["react-flow__background",u]),style:{...l,position:"absolute",width:"100%",height:"100%",top:0,left:0},ref:p,"data-testid":"rf__background",children:[a.jsx("pattern",{id:h+e,x:m[0]%S[0],y:m[1]%S[1],width:S[0],height:S[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${E[0]},-${E[1]})`,children:y?a.jsx(h$,{color:g,radius:j/s}):a.jsx(m$,{dimensions:_,color:g,lineWidth:o})}),a.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${h+e})`})]})}JI.displayName="Background";var b$=d.memo(JI);const qw=(e,t,n)=>{y$(n);const r=Y_(e,t);return e5[n].includes(r)},e5={">":[1],">=":[0,1],"=":[0],"<=":[-1,0],"<":[-1],"!=":[-1,1]},Xw=Object.keys(e5),y$=e=>{if(typeof e!="string")throw new TypeError(`Invalid operator type, expected string but got ${typeof e}`);if(Xw.indexOf(e)===-1)throw new Error(`Invalid operator, expected one of ${Xw.join("|")}`)};function C$(){return!!(typeof window<"u"&&window.document&&window.document.createElement)}var w$=C$();const t5=1/60*1e3,S$=typeof performance<"u"?()=>performance.now():()=>Date.now(),n5=typeof window<"u"?e=>window.requestAnimationFrame(e):e=>setTimeout(()=>e(S$()),t5);function k$(e){let t=[],n=[],r=0,o=!1,s=!1;const i=new WeakSet,l={schedule:(u,p=!1,m=!1)=>{const h=m&&o,g=h?t:n;return p&&i.add(u),g.indexOf(u)===-1&&(g.push(u),h&&o&&(r=t.length)),u},cancel:u=>{const p=n.indexOf(u);p!==-1&&n.splice(p,1),i.delete(u)},process:u=>{if(o){s=!0;return}if(o=!0,[t,n]=[n,t],n.length=0,r=t.length,r)for(let p=0;p(e[t]=k$(()=>Xu=!0),e),{}),_$=jd.reduce((e,t)=>{const n=Ch[t];return e[t]=(r,o=!1,s=!1)=>(Xu||E$(),n.schedule(r,o,s)),e},{}),I$=jd.reduce((e,t)=>(e[t]=Ch[t].cancel,e),{});jd.reduce((e,t)=>(e[t]=()=>Ch[t].process(sc),e),{});const P$=e=>Ch[e].process(sc),r5=e=>{Xu=!1,sc.delta=b1?t5:Math.max(Math.min(e-sc.timestamp,j$),1),sc.timestamp=e,y1=!0,jd.forEach(P$),y1=!1,Xu&&(b1=!1,n5(r5))},E$=()=>{Xu=!0,b1=!0,y1||n5(r5)},Qw=()=>sc;function wh(e){const{viewBox:t="0 0 24 24",d:n,displayName:r,defaultProps:o={}}=e,s=d.Children.toArray(e.path),i=ke((l,u)=>a.jsx(Tn,{ref:u,viewBox:t,...o,...l,children:s.length?s:a.jsx("path",{fill:"currentColor",d:n})}));return i.displayName=r,i}function o5(e){const{theme:t}=$R(),n=LR();return d.useMemo(()=>zR(t.direction,{...n,...e}),[e,t.direction,n])}var M$=Object.defineProperty,O$=(e,t,n)=>t in e?M$(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,jn=(e,t,n)=>(O$(e,typeof t!="symbol"?t+"":t,n),n);function Yw(e){return e.sort((t,n)=>{const r=t.compareDocumentPosition(n);if(r&Node.DOCUMENT_POSITION_FOLLOWING||r&Node.DOCUMENT_POSITION_CONTAINED_BY)return-1;if(r&Node.DOCUMENT_POSITION_PRECEDING||r&Node.DOCUMENT_POSITION_CONTAINS)return 1;if(r&Node.DOCUMENT_POSITION_DISCONNECTED||r&Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC)throw Error("Cannot sort the given nodes.");return 0})}var R$=e=>typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.ELEMENT_NODE;function Zw(e,t,n){let r=e+1;return n&&r>=t&&(r=0),r}function Jw(e,t,n){let r=e-1;return n&&r<0&&(r=t),r}var C1=typeof window<"u"?d.useLayoutEffect:d.useEffect,rm=e=>e,D$=class{constructor(){jn(this,"descendants",new Map),jn(this,"register",e=>{if(e!=null)return R$(e)?this.registerNode(e):t=>{this.registerNode(t,e)}}),jn(this,"unregister",e=>{this.descendants.delete(e);const t=Yw(Array.from(this.descendants.keys()));this.assignIndex(t)}),jn(this,"destroy",()=>{this.descendants.clear()}),jn(this,"assignIndex",e=>{this.descendants.forEach(t=>{const n=e.indexOf(t.node);t.index=n,t.node.dataset.index=t.index.toString()})}),jn(this,"count",()=>this.descendants.size),jn(this,"enabledCount",()=>this.enabledValues().length),jn(this,"values",()=>Array.from(this.descendants.values()).sort((t,n)=>t.index-n.index)),jn(this,"enabledValues",()=>this.values().filter(e=>!e.disabled)),jn(this,"item",e=>{if(this.count()!==0)return this.values()[e]}),jn(this,"enabledItem",e=>{if(this.enabledCount()!==0)return this.enabledValues()[e]}),jn(this,"first",()=>this.item(0)),jn(this,"firstEnabled",()=>this.enabledItem(0)),jn(this,"last",()=>this.item(this.descendants.size-1)),jn(this,"lastEnabled",()=>{const e=this.enabledValues().length-1;return this.enabledItem(e)}),jn(this,"indexOf",e=>{var t,n;return e&&(n=(t=this.descendants.get(e))==null?void 0:t.index)!=null?n:-1}),jn(this,"enabledIndexOf",e=>e==null?-1:this.enabledValues().findIndex(t=>t.node.isSameNode(e))),jn(this,"next",(e,t=!0)=>{const n=Zw(e,this.count(),t);return this.item(n)}),jn(this,"nextEnabled",(e,t=!0)=>{const n=this.item(e);if(!n)return;const r=this.enabledIndexOf(n.node),o=Zw(r,this.enabledCount(),t);return this.enabledItem(o)}),jn(this,"prev",(e,t=!0)=>{const n=Jw(e,this.count()-1,t);return this.item(n)}),jn(this,"prevEnabled",(e,t=!0)=>{const n=this.item(e);if(!n)return;const r=this.enabledIndexOf(n.node),o=Jw(r,this.enabledCount()-1,t);return this.enabledItem(o)}),jn(this,"registerNode",(e,t)=>{if(!e||this.descendants.has(e))return;const n=Array.from(this.descendants.keys()).concat(e),r=Yw(n);t!=null&&t.disabled&&(t.disabled=!!t.disabled);const o={node:e,index:-1,...t};this.descendants.set(e,o),this.assignIndex(r)})}};function A$(e,t){if(e!=null){if(typeof e=="function"){e(t);return}try{e.current=t}catch{throw new Error(`Cannot assign value '${t}' to ref '${e}'`)}}}function It(...e){return t=>{e.forEach(n=>{A$(n,t)})}}function T$(...e){return d.useMemo(()=>It(...e),e)}function N$(){const e=d.useRef(new D$);return C1(()=>()=>e.current.destroy()),e.current}var[$$,s5]=Wt({name:"DescendantsProvider",errorMessage:"useDescendantsContext must be used within DescendantsProvider"});function L$(e){const t=s5(),[n,r]=d.useState(-1),o=d.useRef(null);C1(()=>()=>{o.current&&t.unregister(o.current)},[]),C1(()=>{if(!o.current)return;const i=Number(o.current.dataset.index);n!=i&&!Number.isNaN(i)&&r(i)});const s=rm(e?t.register(e):t.register);return{descendants:t,index:n,enabledIndex:t.enabledIndexOf(o.current),register:It(s,o)}}function lb(){return[rm($$),()=>rm(s5()),()=>N$(),o=>L$(o)]}var[z$,Sh]=Wt({name:"AccordionStylesContext",hookName:"useAccordionStyles",providerName:""}),[F$,cb]=Wt({name:"AccordionItemContext",hookName:"useAccordionItemContext",providerName:""}),[B$,I1e,H$,V$]=lb(),Bl=ke(function(t,n){const{getButtonProps:r}=cb(),o=r(t,n),i={display:"flex",alignItems:"center",width:"100%",outline:0,...Sh().button};return a.jsx(we.button,{...o,className:Ye("chakra-accordion__button",t.className),__css:i})});Bl.displayName="AccordionButton";function _d(e){const{value:t,defaultValue:n,onChange:r,shouldUpdate:o=(g,x)=>g!==x}=e,s=un(r),i=un(o),[l,u]=d.useState(n),p=t!==void 0,m=p?t:l,h=un(g=>{const y=typeof g=="function"?g(m):g;i(m,y)&&(p||u(y),s(y))},[p,s,m,i]);return[m,h]}function W$(e){const{onChange:t,defaultIndex:n,index:r,allowMultiple:o,allowToggle:s,...i}=e;K$(e),q$(e);const l=H$(),[u,p]=d.useState(-1);d.useEffect(()=>()=>{p(-1)},[]);const[m,h]=_d({value:r,defaultValue(){return o?n??[]:n??-1},onChange:t});return{index:m,setIndex:h,htmlProps:i,getAccordionItemProps:x=>{let y=!1;return x!==null&&(y=Array.isArray(m)?m.includes(x):m===x),{isOpen:y,onChange:w=>{if(x!==null)if(o&&Array.isArray(m)){const S=w?m.concat(x):m.filter(j=>j!==x);h(S)}else w?h(x):s&&h(-1)}}},focusedIndex:u,setFocusedIndex:p,descendants:l}}var[U$,ub]=Wt({name:"AccordionContext",hookName:"useAccordionContext",providerName:"Accordion"});function G$(e){const{isDisabled:t,isFocusable:n,id:r,...o}=e,{getAccordionItemProps:s,setFocusedIndex:i}=ub(),l=d.useRef(null),u=d.useId(),p=r??u,m=`accordion-button-${p}`,h=`accordion-panel-${p}`;X$(e);const{register:g,index:x,descendants:y}=V$({disabled:t&&!n}),{isOpen:b,onChange:w}=s(x===-1?null:x);Q$({isOpen:b,isDisabled:t});const S=()=>{w==null||w(!0)},j=()=>{w==null||w(!1)},_=d.useCallback(()=>{w==null||w(!b),i(x)},[x,i,b,w]),E=d.useCallback(D=>{const O={ArrowDown:()=>{const T=y.nextEnabled(x);T==null||T.node.focus()},ArrowUp:()=>{const T=y.prevEnabled(x);T==null||T.node.focus()},Home:()=>{const T=y.firstEnabled();T==null||T.node.focus()},End:()=>{const T=y.lastEnabled();T==null||T.node.focus()}}[D.key];O&&(D.preventDefault(),O(D))},[y,x]),I=d.useCallback(()=>{i(x)},[i,x]),M=d.useCallback(function(A={},O=null){return{...A,type:"button",ref:It(g,l,O),id:m,disabled:!!t,"aria-expanded":!!b,"aria-controls":h,onClick:He(A.onClick,_),onFocus:He(A.onFocus,I),onKeyDown:He(A.onKeyDown,E)}},[m,t,b,_,I,E,h,g]),R=d.useCallback(function(A={},O=null){return{...A,ref:O,role:"region",id:h,"aria-labelledby":m,hidden:!b}},[m,b,h]);return{isOpen:b,isDisabled:t,isFocusable:n,onOpen:S,onClose:j,getButtonProps:M,getPanelProps:R,htmlProps:o}}function K$(e){const t=e.index||e.defaultIndex,n=t!=null&&!Array.isArray(t)&&e.allowMultiple;vd({condition:!!n,message:`If 'allowMultiple' is passed, then 'index' or 'defaultIndex' must be an array. You passed: ${typeof t},`})}function q$(e){vd({condition:!!(e.allowMultiple&&e.allowToggle),message:"If 'allowMultiple' is passed, 'allowToggle' will be ignored. Either remove 'allowToggle' or 'allowMultiple' depending on whether you want multiple accordions visible or not"})}function X$(e){vd({condition:!!(e.isFocusable&&!e.isDisabled),message:`Using only 'isFocusable', this prop is reserved for situations where you pass 'isDisabled' but you still want the element to receive focus (A11y). Either remove it or pass 'isDisabled' as well. - `})}function Q$(e){vd({condition:e.isOpen&&!!e.isDisabled,message:"Cannot open a disabled accordion item"})}function Hl(e){const{isOpen:t,isDisabled:n}=cb(),{reduceMotion:r}=ub(),o=Ye("chakra-accordion__icon",e.className),s=Sh(),i={opacity:n?.4:1,transform:t?"rotate(-180deg)":void 0,transition:r?void 0:"transform 0.2s",transformOrigin:"center",...s.icon};return a.jsx(Tn,{viewBox:"0 0 24 24","aria-hidden":!0,className:o,__css:i,...e,children:a.jsx("path",{fill:"currentColor",d:"M16.59 8.59L12 13.17 7.41 8.59 6 10l6 6 6-6z"})})}Hl.displayName="AccordionIcon";var Vl=ke(function(t,n){const{children:r,className:o}=t,{htmlProps:s,...i}=G$(t),u={...Sh().container,overflowAnchor:"none"},p=d.useMemo(()=>i,[i]);return a.jsx(F$,{value:p,children:a.jsx(we.div,{ref:n,...s,className:Ye("chakra-accordion__item",o),__css:u,children:typeof r=="function"?r({isExpanded:!!i.isOpen,isDisabled:!!i.isDisabled}):r})})});Vl.displayName="AccordionItem";var Yl={ease:[.25,.1,.25,1],easeIn:[.4,0,1,1],easeOut:[0,0,.2,1],easeInOut:[.4,0,.2,1]},Oi={enter:{duration:.2,ease:Yl.easeOut},exit:{duration:.1,ease:Yl.easeIn}},Js={enter:(e,t)=>({...e,delay:typeof t=="number"?t:t==null?void 0:t.enter}),exit:(e,t)=>({...e,delay:typeof t=="number"?t:t==null?void 0:t.exit})},Y$=e=>e!=null&&parseInt(e.toString(),10)>0,eS={exit:{height:{duration:.2,ease:Yl.ease},opacity:{duration:.3,ease:Yl.ease}},enter:{height:{duration:.3,ease:Yl.ease},opacity:{duration:.4,ease:Yl.ease}}},Z$={exit:({animateOpacity:e,startingHeight:t,transition:n,transitionEnd:r,delay:o})=>{var s;return{...e&&{opacity:Y$(t)?1:0},height:t,transitionEnd:r==null?void 0:r.exit,transition:(s=n==null?void 0:n.exit)!=null?s:Js.exit(eS.exit,o)}},enter:({animateOpacity:e,endingHeight:t,transition:n,transitionEnd:r,delay:o})=>{var s;return{...e&&{opacity:1},height:t,transitionEnd:r==null?void 0:r.enter,transition:(s=n==null?void 0:n.enter)!=null?s:Js.enter(eS.enter,o)}}},Id=d.forwardRef((e,t)=>{const{in:n,unmountOnExit:r,animateOpacity:o=!0,startingHeight:s=0,endingHeight:i="auto",style:l,className:u,transition:p,transitionEnd:m,...h}=e,[g,x]=d.useState(!1);d.useEffect(()=>{const j=setTimeout(()=>{x(!0)});return()=>clearTimeout(j)},[]),vd({condition:Number(s)>0&&!!r,message:"startingHeight and unmountOnExit are mutually exclusive. You can't use them together"});const y=parseFloat(s.toString())>0,b={startingHeight:s,endingHeight:i,animateOpacity:o,transition:g?p:{enter:{duration:0}},transitionEnd:{enter:m==null?void 0:m.enter,exit:r?m==null?void 0:m.exit:{...m==null?void 0:m.exit,display:y?"block":"none"}}},w=r?n:!0,S=n||r?"enter":"exit";return a.jsx(dr,{initial:!1,custom:b,children:w&&a.jsx(In.div,{ref:t,...h,className:Ye("chakra-collapse",u),style:{overflow:"hidden",display:"block",...l},custom:b,variants:Z$,initial:r?"exit":!1,animate:S,exit:"exit"})})});Id.displayName="Collapse";var J$={enter:({transition:e,transitionEnd:t,delay:n}={})=>{var r;return{opacity:1,transition:(r=e==null?void 0:e.enter)!=null?r:Js.enter(Oi.enter,n),transitionEnd:t==null?void 0:t.enter}},exit:({transition:e,transitionEnd:t,delay:n}={})=>{var r;return{opacity:0,transition:(r=e==null?void 0:e.exit)!=null?r:Js.exit(Oi.exit,n),transitionEnd:t==null?void 0:t.exit}}},a5={initial:"exit",animate:"enter",exit:"exit",variants:J$},eL=d.forwardRef(function(t,n){const{unmountOnExit:r,in:o,className:s,transition:i,transitionEnd:l,delay:u,...p}=t,m=o||r?"enter":"exit",h=r?o&&r:!0,g={transition:i,transitionEnd:l,delay:u};return a.jsx(dr,{custom:g,children:h&&a.jsx(In.div,{ref:n,className:Ye("chakra-fade",s),custom:g,...a5,animate:m,...p})})});eL.displayName="Fade";var tL={exit:({reverse:e,initialScale:t,transition:n,transitionEnd:r,delay:o})=>{var s;return{opacity:0,...e?{scale:t,transitionEnd:r==null?void 0:r.exit}:{transitionEnd:{scale:t,...r==null?void 0:r.exit}},transition:(s=n==null?void 0:n.exit)!=null?s:Js.exit(Oi.exit,o)}},enter:({transitionEnd:e,transition:t,delay:n})=>{var r;return{opacity:1,scale:1,transition:(r=t==null?void 0:t.enter)!=null?r:Js.enter(Oi.enter,n),transitionEnd:e==null?void 0:e.enter}}},i5={initial:"exit",animate:"enter",exit:"exit",variants:tL},nL=d.forwardRef(function(t,n){const{unmountOnExit:r,in:o,reverse:s=!0,initialScale:i=.95,className:l,transition:u,transitionEnd:p,delay:m,...h}=t,g=r?o&&r:!0,x=o||r?"enter":"exit",y={initialScale:i,reverse:s,transition:u,transitionEnd:p,delay:m};return a.jsx(dr,{custom:y,children:g&&a.jsx(In.div,{ref:n,className:Ye("chakra-offset-slide",l),...i5,animate:x,custom:y,...h})})});nL.displayName="ScaleFade";var rL={initial:({offsetX:e,offsetY:t,transition:n,transitionEnd:r,delay:o})=>{var s;return{opacity:0,x:e,y:t,transition:(s=n==null?void 0:n.exit)!=null?s:Js.exit(Oi.exit,o),transitionEnd:r==null?void 0:r.exit}},enter:({transition:e,transitionEnd:t,delay:n})=>{var r;return{opacity:1,x:0,y:0,transition:(r=e==null?void 0:e.enter)!=null?r:Js.enter(Oi.enter,n),transitionEnd:t==null?void 0:t.enter}},exit:({offsetY:e,offsetX:t,transition:n,transitionEnd:r,reverse:o,delay:s})=>{var i;const l={x:t,y:e};return{opacity:0,transition:(i=n==null?void 0:n.exit)!=null?i:Js.exit(Oi.exit,s),...o?{...l,transitionEnd:r==null?void 0:r.exit}:{transitionEnd:{...l,...r==null?void 0:r.exit}}}}},w1={initial:"initial",animate:"enter",exit:"exit",variants:rL},oL=d.forwardRef(function(t,n){const{unmountOnExit:r,in:o,reverse:s=!0,className:i,offsetX:l=0,offsetY:u=8,transition:p,transitionEnd:m,delay:h,...g}=t,x=r?o&&r:!0,y=o||r?"enter":"exit",b={offsetX:l,offsetY:u,reverse:s,transition:p,transitionEnd:m,delay:h};return a.jsx(dr,{custom:b,children:x&&a.jsx(In.div,{ref:n,className:Ye("chakra-offset-slide",i),custom:b,...w1,animate:y,...g})})});oL.displayName="SlideFade";var Wl=ke(function(t,n){const{className:r,motionProps:o,...s}=t,{reduceMotion:i}=ub(),{getPanelProps:l,isOpen:u}=cb(),p=l(s,n),m=Ye("chakra-accordion__panel",r),h=Sh();i||delete p.hidden;const g=a.jsx(we.div,{...p,__css:h.panel,className:m});return i?g:a.jsx(Id,{in:u,...o,children:g})});Wl.displayName="AccordionPanel";var l5=ke(function({children:t,reduceMotion:n,...r},o){const s=Un("Accordion",r),i=on(r),{htmlProps:l,descendants:u,...p}=W$(i),m=d.useMemo(()=>({...p,reduceMotion:!!n}),[p,n]);return a.jsx(B$,{value:u,children:a.jsx(U$,{value:m,children:a.jsx(z$,{value:s,children:a.jsx(we.div,{ref:o,...l,className:Ye("chakra-accordion",r.className),__css:s.root,children:t})})})})});l5.displayName="Accordion";function kh(e){return d.Children.toArray(e).filter(t=>d.isValidElement(t))}var[sL,aL]=Wt({strict:!1,name:"ButtonGroupContext"}),iL={horizontal:{"> *:first-of-type:not(:last-of-type)":{borderEndRadius:0},"> *:not(:first-of-type):not(:last-of-type)":{borderRadius:0},"> *:not(:first-of-type):last-of-type":{borderStartRadius:0}},vertical:{"> *:first-of-type:not(:last-of-type)":{borderBottomRadius:0},"> *:not(:first-of-type):not(:last-of-type)":{borderRadius:0},"> *:not(:first-of-type):last-of-type":{borderTopRadius:0}}},lL={horizontal:e=>({"& > *:not(style) ~ *:not(style)":{marginStart:e}}),vertical:e=>({"& > *:not(style) ~ *:not(style)":{marginTop:e}})},Vt=ke(function(t,n){const{size:r,colorScheme:o,variant:s,className:i,spacing:l="0.5rem",isAttached:u,isDisabled:p,orientation:m="horizontal",...h}=t,g=Ye("chakra-button__group",i),x=d.useMemo(()=>({size:r,colorScheme:o,variant:s,isDisabled:p}),[r,o,s,p]);let y={display:"inline-flex",...u?iL[m]:lL[m](l)};const b=m==="vertical";return a.jsx(sL,{value:x,children:a.jsx(we.div,{ref:n,role:"group",__css:y,className:g,"data-attached":u?"":void 0,"data-orientation":m,flexDir:b?"column":void 0,...h})})});Vt.displayName="ButtonGroup";function cL(e){const[t,n]=d.useState(!e);return{ref:d.useCallback(s=>{s&&n(s.tagName==="BUTTON")},[]),type:t?"button":void 0}}function S1(e){const{children:t,className:n,...r}=e,o=d.isValidElement(t)?d.cloneElement(t,{"aria-hidden":!0,focusable:!1}):t,s=Ye("chakra-button__icon",n);return a.jsx(we.span,{display:"inline-flex",alignSelf:"center",flexShrink:0,...r,className:s,children:o})}S1.displayName="ButtonIcon";function k1(e){const{label:t,placement:n,spacing:r="0.5rem",children:o=a.jsx(fa,{color:"currentColor",width:"1em",height:"1em"}),className:s,__css:i,...l}=e,u=Ye("chakra-button__spinner",s),p=n==="start"?"marginEnd":"marginStart",m=d.useMemo(()=>({display:"flex",alignItems:"center",position:t?"relative":"absolute",[p]:t?r:0,fontSize:"1em",lineHeight:"normal",...i}),[i,t,p,r]);return a.jsx(we.div,{className:u,...l,__css:m,children:o})}k1.displayName="ButtonSpinner";var Za=ke((e,t)=>{const n=aL(),r=oi("Button",{...n,...e}),{isDisabled:o=n==null?void 0:n.isDisabled,isLoading:s,isActive:i,children:l,leftIcon:u,rightIcon:p,loadingText:m,iconSpacing:h="0.5rem",type:g,spinner:x,spinnerPlacement:y="start",className:b,as:w,...S}=on(e),j=d.useMemo(()=>{const M={...r==null?void 0:r._focus,zIndex:1};return{display:"inline-flex",appearance:"none",alignItems:"center",justifyContent:"center",userSelect:"none",position:"relative",whiteSpace:"nowrap",verticalAlign:"middle",outline:"none",...r,...!!n&&{_focus:M}}},[r,n]),{ref:_,type:E}=cL(w),I={rightIcon:p,leftIcon:u,iconSpacing:h,children:l};return a.jsxs(we.button,{ref:T$(t,_),as:w,type:g??E,"data-active":dt(i),"data-loading":dt(s),__css:j,className:Ye("chakra-button",b),...S,disabled:o||s,children:[s&&y==="start"&&a.jsx(k1,{className:"chakra-button__spinner--start",label:m,placement:"start",spacing:h,children:x}),s?m||a.jsx(we.span,{opacity:0,children:a.jsx(tS,{...I})}):a.jsx(tS,{...I}),s&&y==="end"&&a.jsx(k1,{className:"chakra-button__spinner--end",label:m,placement:"end",spacing:h,children:x})]})});Za.displayName="Button";function tS(e){const{leftIcon:t,rightIcon:n,children:r,iconSpacing:o}=e;return a.jsxs(a.Fragment,{children:[t&&a.jsx(S1,{marginEnd:o,children:t}),r,n&&a.jsx(S1,{marginStart:o,children:n})]})}var ys=ke((e,t)=>{const{icon:n,children:r,isRound:o,"aria-label":s,...i}=e,l=n||r,u=d.isValidElement(l)?d.cloneElement(l,{"aria-hidden":!0,focusable:!1}):null;return a.jsx(Za,{padding:"0",borderRadius:o?"full":void 0,ref:t,"aria-label":s,...i,children:u})});ys.displayName="IconButton";var[P1e,uL]=Wt({name:"CheckboxGroupContext",strict:!1});function dL(e){const[t,n]=d.useState(e),[r,o]=d.useState(!1);return e!==t&&(o(!0),n(e)),r}function fL(e){return a.jsx(we.svg,{width:"1.2em",viewBox:"0 0 12 10",style:{fill:"none",strokeWidth:2,stroke:"currentColor",strokeDasharray:16},...e,children:a.jsx("polyline",{points:"1.5 6 4.5 9 10.5 1"})})}function pL(e){return a.jsx(we.svg,{width:"1.2em",viewBox:"0 0 24 24",style:{stroke:"currentColor",strokeWidth:4},...e,children:a.jsx("line",{x1:"21",x2:"3",y1:"12",y2:"12"})})}function mL(e){const{isIndeterminate:t,isChecked:n,...r}=e,o=t?pL:fL;return n||t?a.jsx(we.div,{style:{display:"flex",alignItems:"center",justifyContent:"center",height:"100%"},children:a.jsx(o,{...r})}):null}var[hL,c5]=Wt({name:"FormControlStylesContext",errorMessage:`useFormControlStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),[gL,Pd]=Wt({strict:!1,name:"FormControlContext"});function vL(e){const{id:t,isRequired:n,isInvalid:r,isDisabled:o,isReadOnly:s,...i}=e,l=d.useId(),u=t||`field-${l}`,p=`${u}-label`,m=`${u}-feedback`,h=`${u}-helptext`,[g,x]=d.useState(!1),[y,b]=d.useState(!1),[w,S]=d.useState(!1),j=d.useCallback((R={},D=null)=>({id:h,...R,ref:It(D,A=>{A&&b(!0)})}),[h]),_=d.useCallback((R={},D=null)=>({...R,ref:D,"data-focus":dt(w),"data-disabled":dt(o),"data-invalid":dt(r),"data-readonly":dt(s),id:R.id!==void 0?R.id:p,htmlFor:R.htmlFor!==void 0?R.htmlFor:u}),[u,o,w,r,s,p]),E=d.useCallback((R={},D=null)=>({id:m,...R,ref:It(D,A=>{A&&x(!0)}),"aria-live":"polite"}),[m]),I=d.useCallback((R={},D=null)=>({...R,...i,ref:D,role:"group"}),[i]),M=d.useCallback((R={},D=null)=>({...R,ref:D,role:"presentation","aria-hidden":!0,children:R.children||"*"}),[]);return{isRequired:!!n,isInvalid:!!r,isReadOnly:!!s,isDisabled:!!o,isFocused:!!w,onFocus:()=>S(!0),onBlur:()=>S(!1),hasFeedbackText:g,setHasFeedbackText:x,hasHelpText:y,setHasHelpText:b,id:u,labelId:p,feedbackId:m,helpTextId:h,htmlProps:i,getHelpTextProps:j,getErrorMessageProps:E,getRootProps:I,getLabelProps:_,getRequiredIndicatorProps:M}}var Kt=ke(function(t,n){const r=Un("Form",t),o=on(t),{getRootProps:s,htmlProps:i,...l}=vL(o),u=Ye("chakra-form-control",t.className);return a.jsx(gL,{value:l,children:a.jsx(hL,{value:r,children:a.jsx(we.div,{...s({},n),className:u,__css:r.container})})})});Kt.displayName="FormControl";var u5=ke(function(t,n){const r=Pd(),o=c5(),s=Ye("chakra-form__helper-text",t.className);return a.jsx(we.div,{...r==null?void 0:r.getHelpTextProps(t,n),__css:o.helperText,className:s})});u5.displayName="FormHelperText";var wn=ke(function(t,n){var r;const o=oi("FormLabel",t),s=on(t),{className:i,children:l,requiredIndicator:u=a.jsx(d5,{}),optionalIndicator:p=null,...m}=s,h=Pd(),g=(r=h==null?void 0:h.getLabelProps(m,n))!=null?r:{ref:n,...m};return a.jsxs(we.label,{...g,className:Ye("chakra-form__label",s.className),__css:{display:"block",textAlign:"start",...o},children:[l,h!=null&&h.isRequired?u:p]})});wn.displayName="FormLabel";var d5=ke(function(t,n){const r=Pd(),o=c5();if(!(r!=null&&r.isRequired))return null;const s=Ye("chakra-form__required-indicator",t.className);return a.jsx(we.span,{...r==null?void 0:r.getRequiredIndicatorProps(t,n),__css:o.requiredIndicator,className:s})});d5.displayName="RequiredIndicator";function db(e){const{isDisabled:t,isInvalid:n,isReadOnly:r,isRequired:o,...s}=fb(e);return{...s,disabled:t,readOnly:r,required:o,"aria-invalid":Co(n),"aria-required":Co(o),"aria-readonly":Co(r)}}function fb(e){var t,n,r;const o=Pd(),{id:s,disabled:i,readOnly:l,required:u,isRequired:p,isInvalid:m,isReadOnly:h,isDisabled:g,onFocus:x,onBlur:y,...b}=e,w=e["aria-describedby"]?[e["aria-describedby"]]:[];return o!=null&&o.hasFeedbackText&&(o!=null&&o.isInvalid)&&w.push(o.feedbackId),o!=null&&o.hasHelpText&&w.push(o.helpTextId),{...b,"aria-describedby":w.join(" ")||void 0,id:s??(o==null?void 0:o.id),isDisabled:(t=i??g)!=null?t:o==null?void 0:o.isDisabled,isReadOnly:(n=l??h)!=null?n:o==null?void 0:o.isReadOnly,isRequired:(r=u??p)!=null?r:o==null?void 0:o.isRequired,isInvalid:m??(o==null?void 0:o.isInvalid),onFocus:He(o==null?void 0:o.onFocus,x),onBlur:He(o==null?void 0:o.onBlur,y)}}var pb={border:"0",clip:"rect(0, 0, 0, 0)",height:"1px",width:"1px",margin:"-1px",padding:"0",overflow:"hidden",whiteSpace:"nowrap",position:"absolute"},f5=we("span",{baseStyle:pb});f5.displayName="VisuallyHidden";var xL=we("input",{baseStyle:pb});xL.displayName="VisuallyHiddenInput";const bL=()=>typeof document<"u";let nS=!1,Ed=null,Vi=!1,j1=!1;const _1=new Set;function mb(e,t){_1.forEach(n=>n(e,t))}const yL=typeof window<"u"&&window.navigator!=null?/^Mac/.test(window.navigator.platform):!1;function CL(e){return!(e.metaKey||!yL&&e.altKey||e.ctrlKey||e.key==="Control"||e.key==="Shift"||e.key==="Meta")}function rS(e){Vi=!0,CL(e)&&(Ed="keyboard",mb("keyboard",e))}function Ol(e){if(Ed="pointer",e.type==="mousedown"||e.type==="pointerdown"){Vi=!0;const t=e.composedPath?e.composedPath()[0]:e.target;let n=!1;try{n=t.matches(":focus-visible")}catch{}if(n)return;mb("pointer",e)}}function wL(e){return e.mozInputSource===0&&e.isTrusted?!0:e.detail===0&&!e.pointerType}function SL(e){wL(e)&&(Vi=!0,Ed="virtual")}function kL(e){e.target===window||e.target===document||(!Vi&&!j1&&(Ed="virtual",mb("virtual",e)),Vi=!1,j1=!1)}function jL(){Vi=!1,j1=!0}function oS(){return Ed!=="pointer"}function _L(){if(!bL()||nS)return;const{focus:e}=HTMLElement.prototype;HTMLElement.prototype.focus=function(...n){Vi=!0,e.apply(this,n)},document.addEventListener("keydown",rS,!0),document.addEventListener("keyup",rS,!0),document.addEventListener("click",SL,!0),window.addEventListener("focus",kL,!0),window.addEventListener("blur",jL,!1),typeof PointerEvent<"u"?(document.addEventListener("pointerdown",Ol,!0),document.addEventListener("pointermove",Ol,!0),document.addEventListener("pointerup",Ol,!0)):(document.addEventListener("mousedown",Ol,!0),document.addEventListener("mousemove",Ol,!0),document.addEventListener("mouseup",Ol,!0)),nS=!0}function p5(e){_L(),e(oS());const t=()=>e(oS());return _1.add(t),()=>{_1.delete(t)}}function IL(e,t=[]){const n=Object.assign({},e);for(const r of t)r in n&&delete n[r];return n}function m5(e={}){const t=fb(e),{isDisabled:n,isReadOnly:r,isRequired:o,isInvalid:s,id:i,onBlur:l,onFocus:u,"aria-describedby":p}=t,{defaultChecked:m,isChecked:h,isFocusable:g,onChange:x,isIndeterminate:y,name:b,value:w,tabIndex:S=void 0,"aria-label":j,"aria-labelledby":_,"aria-invalid":E,...I}=e,M=IL(I,["isDisabled","isReadOnly","isRequired","isInvalid","id","onBlur","onFocus","aria-describedby"]),R=un(x),D=un(l),A=un(u),[O,T]=d.useState(!1),[X,B]=d.useState(!1),[V,U]=d.useState(!1),[N,$]=d.useState(!1);d.useEffect(()=>p5(T),[]);const q=d.useRef(null),[F,Q]=d.useState(!0),[Y,se]=d.useState(!!m),ae=h!==void 0,re=ae?h:Y,G=d.useCallback(fe=>{if(r||n){fe.preventDefault();return}ae||se(re?fe.target.checked:y?!0:fe.target.checked),R==null||R(fe)},[r,n,re,ae,y,R]);rc(()=>{q.current&&(q.current.indeterminate=!!y)},[y]),pa(()=>{n&&B(!1)},[n,B]),rc(()=>{const fe=q.current;if(!(fe!=null&&fe.form))return;const Oe=()=>{se(!!m)};return fe.form.addEventListener("reset",Oe),()=>{var _e;return(_e=fe.form)==null?void 0:_e.removeEventListener("reset",Oe)}},[]);const K=n&&!g,ee=d.useCallback(fe=>{fe.key===" "&&$(!0)},[$]),le=d.useCallback(fe=>{fe.key===" "&&$(!1)},[$]);rc(()=>{if(!q.current)return;q.current.checked!==re&&se(q.current.checked)},[q.current]);const J=d.useCallback((fe={},Oe=null)=>{const _e=Ne=>{X&&Ne.preventDefault(),$(!0)};return{...fe,ref:Oe,"data-active":dt(N),"data-hover":dt(V),"data-checked":dt(re),"data-focus":dt(X),"data-focus-visible":dt(X&&O),"data-indeterminate":dt(y),"data-disabled":dt(n),"data-invalid":dt(s),"data-readonly":dt(r),"aria-hidden":!0,onMouseDown:He(fe.onMouseDown,_e),onMouseUp:He(fe.onMouseUp,()=>$(!1)),onMouseEnter:He(fe.onMouseEnter,()=>U(!0)),onMouseLeave:He(fe.onMouseLeave,()=>U(!1))}},[N,re,n,X,O,V,y,s,r]),ie=d.useCallback((fe={},Oe=null)=>({...fe,ref:Oe,"data-active":dt(N),"data-hover":dt(V),"data-checked":dt(re),"data-focus":dt(X),"data-focus-visible":dt(X&&O),"data-indeterminate":dt(y),"data-disabled":dt(n),"data-invalid":dt(s),"data-readonly":dt(r)}),[N,re,n,X,O,V,y,s,r]),de=d.useCallback((fe={},Oe=null)=>({...M,...fe,ref:It(Oe,_e=>{_e&&Q(_e.tagName==="LABEL")}),onClick:He(fe.onClick,()=>{var _e;F||((_e=q.current)==null||_e.click(),requestAnimationFrame(()=>{var Ne;(Ne=q.current)==null||Ne.focus({preventScroll:!0})}))}),"data-disabled":dt(n),"data-checked":dt(re),"data-invalid":dt(s)}),[M,n,re,s,F]),ge=d.useCallback((fe={},Oe=null)=>({...fe,ref:It(q,Oe),type:"checkbox",name:b,value:w,id:i,tabIndex:S,onChange:He(fe.onChange,G),onBlur:He(fe.onBlur,D,()=>B(!1)),onFocus:He(fe.onFocus,A,()=>B(!0)),onKeyDown:He(fe.onKeyDown,ee),onKeyUp:He(fe.onKeyUp,le),required:o,checked:re,disabled:K,readOnly:r,"aria-label":j,"aria-labelledby":_,"aria-invalid":E?!!E:s,"aria-describedby":p,"aria-disabled":n,style:pb}),[b,w,i,G,D,A,ee,le,o,re,K,r,j,_,E,s,p,n,S]),Ce=d.useCallback((fe={},Oe=null)=>({...fe,ref:Oe,onMouseDown:He(fe.onMouseDown,PL),"data-disabled":dt(n),"data-checked":dt(re),"data-invalid":dt(s)}),[re,n,s]);return{state:{isInvalid:s,isFocused:X,isChecked:re,isActive:N,isHovered:V,isIndeterminate:y,isDisabled:n,isReadOnly:r,isRequired:o},getRootProps:de,getCheckboxProps:J,getIndicatorProps:ie,getInputProps:ge,getLabelProps:Ce,htmlProps:M}}function PL(e){e.preventDefault(),e.stopPropagation()}var EL={display:"inline-flex",alignItems:"center",justifyContent:"center",verticalAlign:"top",userSelect:"none",flexShrink:0},ML={cursor:"pointer",display:"inline-flex",alignItems:"center",verticalAlign:"top",position:"relative"},OL=ma({from:{opacity:0,strokeDashoffset:16,transform:"scale(0.95)"},to:{opacity:1,strokeDashoffset:0,transform:"scale(1)"}}),RL=ma({from:{opacity:0},to:{opacity:1}}),DL=ma({from:{transform:"scaleX(0.65)"},to:{transform:"scaleX(1)"}}),Md=ke(function(t,n){const r=uL(),o={...r,...t},s=Un("Checkbox",o),i=on(t),{spacing:l="0.5rem",className:u,children:p,iconColor:m,iconSize:h,icon:g=a.jsx(mL,{}),isChecked:x,isDisabled:y=r==null?void 0:r.isDisabled,onChange:b,inputProps:w,...S}=i;let j=x;r!=null&&r.value&&i.value&&(j=r.value.includes(i.value));let _=b;r!=null&&r.onChange&&i.value&&(_=ph(r.onChange,b));const{state:E,getInputProps:I,getCheckboxProps:M,getLabelProps:R,getRootProps:D}=m5({...S,isDisabled:y,isChecked:j,onChange:_}),A=dL(E.isChecked),O=d.useMemo(()=>({animation:A?E.isIndeterminate?`${RL} 20ms linear, ${DL} 200ms linear`:`${OL} 200ms linear`:void 0,fontSize:h,color:m,...s.icon}),[m,h,A,E.isIndeterminate,s.icon]),T=d.cloneElement(g,{__css:O,isIndeterminate:E.isIndeterminate,isChecked:E.isChecked});return a.jsxs(we.label,{__css:{...ML,...s.container},className:Ye("chakra-checkbox",u),...D(),children:[a.jsx("input",{className:"chakra-checkbox__input",...I(w,n)}),a.jsx(we.span,{__css:{...EL,...s.control},className:"chakra-checkbox__control",...M(),children:T}),p&&a.jsx(we.span,{className:"chakra-checkbox__label",...R(),__css:{marginStart:l,...s.label},children:p})]})});Md.displayName="Checkbox";function AL(e){const t=parseFloat(e);return typeof t!="number"||Number.isNaN(t)?0:t}function hb(e,t){let n=AL(e);const r=10**(t??10);return n=Math.round(n*r)/r,t?n.toFixed(t):n.toString()}function I1(e){if(!Number.isFinite(e))return 0;let t=1,n=0;for(;Math.round(e*t)/t!==e;)t*=10,n+=1;return n}function om(e,t,n){return(e-t)*100/(n-t)}function h5(e,t,n){return(n-t)*e+t}function P1(e,t,n){const r=Math.round((e-t)/n)*n+t,o=I1(n);return hb(r,o)}function ac(e,t,n){return e==null?e:(n{var O;return r==null?"":(O=av(r,s,n))!=null?O:""}),g=typeof o<"u",x=g?o:m,y=g5(za(x),s),b=n??y,w=d.useCallback(O=>{O!==x&&(g||h(O.toString()),p==null||p(O.toString(),za(O)))},[p,g,x]),S=d.useCallback(O=>{let T=O;return u&&(T=ac(T,i,l)),hb(T,b)},[b,u,l,i]),j=d.useCallback((O=s)=>{let T;x===""?T=za(O):T=za(x)+O,T=S(T),w(T)},[S,s,w,x]),_=d.useCallback((O=s)=>{let T;x===""?T=za(-O):T=za(x)-O,T=S(T),w(T)},[S,s,w,x]),E=d.useCallback(()=>{var O;let T;r==null?T="":T=(O=av(r,s,n))!=null?O:i,w(T)},[r,n,s,w,i]),I=d.useCallback(O=>{var T;const X=(T=av(O,s,b))!=null?T:i;w(X)},[b,s,w,i]),M=za(x);return{isOutOfRange:M>l||M" `}),[$L,gb]=Wt({name:"EditableContext",errorMessage:"useEditableContext: context is undefined. Seems you forgot to wrap the editable components in ``"}),x5={fontSize:"inherit",fontWeight:"inherit",textAlign:"inherit",bg:"transparent"},jh=ke(function(t,n){const{getInputProps:r}=gb(),o=v5(),s=r(t,n),i=Ye("chakra-editable__input",t.className);return a.jsx(we.input,{...s,__css:{outline:0,...x5,...o.input},className:i})});jh.displayName="EditableInput";var _h=ke(function(t,n){const{getPreviewProps:r}=gb(),o=v5(),s=r(t,n),i=Ye("chakra-editable__preview",t.className);return a.jsx(we.span,{...s,__css:{cursor:"text",display:"inline-block",...x5,...o.preview},className:i})});_h.displayName="EditablePreview";function Ri(e,t,n,r){const o=un(n);return d.useEffect(()=>{const s=typeof e=="function"?e():e??document;if(!(!n||!s))return s.addEventListener(t,o,r),()=>{s.removeEventListener(t,o,r)}},[t,e,r,o,n]),()=>{const s=typeof e=="function"?e():e??document;s==null||s.removeEventListener(t,o,r)}}function LL(e){return"current"in e}var b5=()=>typeof window<"u";function zL(){var e;const t=navigator.userAgentData;return(e=t==null?void 0:t.platform)!=null?e:navigator.platform}var FL=e=>b5()&&e.test(navigator.vendor),BL=e=>b5()&&e.test(zL()),HL=()=>BL(/mac|iphone|ipad|ipod/i),VL=()=>HL()&&FL(/apple/i);function y5(e){const{ref:t,elements:n,enabled:r}=e,o=()=>{var s,i;return(i=(s=t.current)==null?void 0:s.ownerDocument)!=null?i:document};Ri(o,"pointerdown",s=>{if(!VL()||!r)return;const i=s.target,u=(n??[t]).some(p=>{const m=LL(p)?p.current:p;return(m==null?void 0:m.contains(i))||m===i});o().activeElement!==i&&u&&(s.preventDefault(),i.focus())})}function sS(e,t){return e?e===t||e.contains(t):!1}function WL(e={}){const{onChange:t,onCancel:n,onSubmit:r,onBlur:o,value:s,isDisabled:i,defaultValue:l,startWithEditView:u,isPreviewFocusable:p=!0,submitOnBlur:m=!0,selectAllOnFocus:h=!0,placeholder:g,onEdit:x,finalFocusRef:y,...b}=e,w=un(x),S=!!(u&&!i),[j,_]=d.useState(S),[E,I]=_d({defaultValue:l||"",value:s,onChange:t}),[M,R]=d.useState(E),D=d.useRef(null),A=d.useRef(null),O=d.useRef(null),T=d.useRef(null),X=d.useRef(null);y5({ref:D,enabled:j,elements:[T,X]});const B=!j&&!i;rc(()=>{var J,ie;j&&((J=D.current)==null||J.focus(),h&&((ie=D.current)==null||ie.select()))},[]),pa(()=>{var J,ie,de,ge;if(!j){y?(J=y.current)==null||J.focus():(ie=O.current)==null||ie.focus();return}(de=D.current)==null||de.focus(),h&&((ge=D.current)==null||ge.select()),w==null||w()},[j,w,h]);const V=d.useCallback(()=>{B&&_(!0)},[B]),U=d.useCallback(()=>{R(E)},[E]),N=d.useCallback(()=>{_(!1),I(M),n==null||n(M),o==null||o(M)},[n,o,I,M]),$=d.useCallback(()=>{_(!1),R(E),r==null||r(E),o==null||o(M)},[E,r,o,M]);d.useEffect(()=>{if(j)return;const J=D.current;(J==null?void 0:J.ownerDocument.activeElement)===J&&(J==null||J.blur())},[j]);const q=d.useCallback(J=>{I(J.currentTarget.value)},[I]),F=d.useCallback(J=>{const ie=J.key,ge={Escape:N,Enter:Ce=>{!Ce.shiftKey&&!Ce.metaKey&&$()}}[ie];ge&&(J.preventDefault(),ge(J))},[N,$]),Q=d.useCallback(J=>{const ie=J.key,ge={Escape:N}[ie];ge&&(J.preventDefault(),ge(J))},[N]),Y=E.length===0,se=d.useCallback(J=>{var ie;if(!j)return;const de=J.currentTarget.ownerDocument,ge=(ie=J.relatedTarget)!=null?ie:de.activeElement,Ce=sS(T.current,ge),he=sS(X.current,ge);!Ce&&!he&&(m?$():N())},[m,$,N,j]),ae=d.useCallback((J={},ie=null)=>{const de=B&&p?0:void 0;return{...J,ref:It(ie,A),children:Y?g:E,hidden:j,"aria-disabled":Co(i),tabIndex:de,onFocus:He(J.onFocus,V,U)}},[i,j,B,p,Y,V,U,g,E]),re=d.useCallback((J={},ie=null)=>({...J,hidden:!j,placeholder:g,ref:It(ie,D),disabled:i,"aria-disabled":Co(i),value:E,onBlur:He(J.onBlur,se),onChange:He(J.onChange,q),onKeyDown:He(J.onKeyDown,F),onFocus:He(J.onFocus,U)}),[i,j,se,q,F,U,g,E]),G=d.useCallback((J={},ie=null)=>({...J,hidden:!j,placeholder:g,ref:It(ie,D),disabled:i,"aria-disabled":Co(i),value:E,onBlur:He(J.onBlur,se),onChange:He(J.onChange,q),onKeyDown:He(J.onKeyDown,Q),onFocus:He(J.onFocus,U)}),[i,j,se,q,Q,U,g,E]),K=d.useCallback((J={},ie=null)=>({"aria-label":"Edit",...J,type:"button",onClick:He(J.onClick,V),ref:It(ie,O),disabled:i}),[V,i]),ee=d.useCallback((J={},ie=null)=>({...J,"aria-label":"Submit",ref:It(X,ie),type:"button",onClick:He(J.onClick,$),disabled:i}),[$,i]),le=d.useCallback((J={},ie=null)=>({"aria-label":"Cancel",id:"cancel",...J,ref:It(T,ie),type:"button",onClick:He(J.onClick,N),disabled:i}),[N,i]);return{isEditing:j,isDisabled:i,isValueEmpty:Y,value:E,onEdit:V,onCancel:N,onSubmit:$,getPreviewProps:ae,getInputProps:re,getTextareaProps:G,getEditButtonProps:K,getSubmitButtonProps:ee,getCancelButtonProps:le,htmlProps:b}}var Ih=ke(function(t,n){const r=Un("Editable",t),o=on(t),{htmlProps:s,...i}=WL(o),{isEditing:l,onSubmit:u,onCancel:p,onEdit:m}=i,h=Ye("chakra-editable",t.className),g=zx(t.children,{isEditing:l,onSubmit:u,onCancel:p,onEdit:m});return a.jsx($L,{value:i,children:a.jsx(NL,{value:r,children:a.jsx(we.div,{ref:n,...s,className:h,children:g})})})});Ih.displayName="Editable";function C5(){const{isEditing:e,getEditButtonProps:t,getCancelButtonProps:n,getSubmitButtonProps:r}=gb();return{isEditing:e,getEditButtonProps:t,getCancelButtonProps:n,getSubmitButtonProps:r}}var w5={exports:{}},UL="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",GL=UL,KL=GL;function S5(){}function k5(){}k5.resetWarningCache=S5;var qL=function(){function e(r,o,s,i,l,u){if(u!==KL){var p=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw p.name="Invariant Violation",p}}e.isRequired=e;function t(){return e}var n={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:k5,resetWarningCache:S5};return n.PropTypes=n,n};w5.exports=qL();var XL=w5.exports;const Jt=xd(XL);var E1="data-focus-lock",j5="data-focus-lock-disabled",QL="data-no-focus-lock",YL="data-autofocus-inside",ZL="data-no-autofocus";function JL(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function ez(e,t){var n=d.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(r){var o=n.value;o!==r&&(n.value=r,n.callback(r,o))}}}})[0];return n.callback=t,n.facade}function _5(e,t){return ez(t||null,function(n){return e.forEach(function(r){return JL(r,n)})})}var iv={width:"1px",height:"0px",padding:0,overflow:"hidden",position:"fixed",top:"1px",left:"1px"},gs=function(){return gs=Object.assign||function(t){for(var n,r=1,o=arguments.length;r0&&s[s.length-1])&&(p[0]===6||p[0]===2)){n=0;continue}if(p[0]===3&&(!s||p[1]>s[0]&&p[1]0)&&!(o=r.next()).done;)s.push(o.value)}catch(l){i={error:l}}finally{try{o&&!o.done&&(n=r.return)&&n.call(r)}finally{if(i)throw i.error}}return s}function M1(e,t,n){if(n||arguments.length===2)for(var r=0,o=t.length,s;r=0}).sort(mz)},hz=["button:enabled","select:enabled","textarea:enabled","input:enabled","a[href]","area[href]","summary","iframe","object","embed","audio[controls]","video[controls]","[tabindex]","[contenteditable]","[autofocus]"],yb=hz.join(","),gz="".concat(yb,", [data-focus-guard]"),W5=function(e,t){return Rs((e.shadowRoot||e).children).reduce(function(n,r){return n.concat(r.matches(t?gz:yb)?[r]:[],W5(r))},[])},vz=function(e,t){var n;return e instanceof HTMLIFrameElement&&(!((n=e.contentDocument)===null||n===void 0)&&n.body)?Ph([e.contentDocument.body],t):[e]},Ph=function(e,t){return e.reduce(function(n,r){var o,s=W5(r,t),i=(o=[]).concat.apply(o,s.map(function(l){return vz(l,t)}));return n.concat(i,r.parentNode?Rs(r.parentNode.querySelectorAll(yb)).filter(function(l){return l===r}):[])},[])},xz=function(e){var t=e.querySelectorAll("[".concat(YL,"]"));return Rs(t).map(function(n){return Ph([n])}).reduce(function(n,r){return n.concat(r)},[])},Cb=function(e,t){return Rs(e).filter(function(n){return L5(t,n)}).filter(function(n){return dz(n)})},iS=function(e,t){return t===void 0&&(t=new Map),Rs(e).filter(function(n){return z5(t,n)})},R1=function(e,t,n){return V5(Cb(Ph(e,n),t),!0,n)},lS=function(e,t){return V5(Cb(Ph(e),t),!1)},bz=function(e,t){return Cb(xz(e),t)},ic=function(e,t){return e.shadowRoot?ic(e.shadowRoot,t):Object.getPrototypeOf(e).contains!==void 0&&Object.getPrototypeOf(e).contains.call(e,t)?!0:Rs(e.children).some(function(n){var r;if(n instanceof HTMLIFrameElement){var o=(r=n.contentDocument)===null||r===void 0?void 0:r.body;return o?ic(o,t):!1}return ic(n,t)})},yz=function(e){for(var t=new Set,n=e.length,r=0;r0&&t.add(o),(s&Node.DOCUMENT_POSITION_CONTAINS)>0&&t.add(r)}return e.filter(function(i,l){return!t.has(l)})},U5=function(e){return e.parentNode?U5(e.parentNode):e},wb=function(e){var t=sm(e);return t.filter(Boolean).reduce(function(n,r){var o=r.getAttribute(E1);return n.push.apply(n,o?yz(Rs(U5(r).querySelectorAll("[".concat(E1,'="').concat(o,'"]:not([').concat(j5,'="disabled"])')))):[r]),n},[])},Cz=function(e){try{return e()}catch{return}},Qu=function(e){if(e===void 0&&(e=document),!(!e||!e.activeElement)){var t=e.activeElement;return t.shadowRoot?Qu(t.shadowRoot):t instanceof HTMLIFrameElement&&Cz(function(){return t.contentWindow.document})?Qu(t.contentWindow.document):t}},wz=function(e,t){return e===t},Sz=function(e,t){return!!Rs(e.querySelectorAll("iframe")).some(function(n){return wz(n,t)})},G5=function(e,t){return t===void 0&&(t=Qu(T5(e).ownerDocument)),!t||t.dataset&&t.dataset.focusGuard?!1:wb(e).some(function(n){return ic(n,t)||Sz(n,t)})},kz=function(e){e===void 0&&(e=document);var t=Qu(e);return t?Rs(e.querySelectorAll("[".concat(QL,"]"))).some(function(n){return ic(n,t)}):!1},jz=function(e,t){return t.filter(H5).filter(function(n){return n.name===e.name}).filter(function(n){return n.checked})[0]||e},Sb=function(e,t){return H5(e)&&e.name?jz(e,t):e},_z=function(e){var t=new Set;return e.forEach(function(n){return t.add(Sb(n,e))}),e.filter(function(n){return t.has(n)})},cS=function(e){return e[0]&&e.length>1?Sb(e[0],e):e[0]},uS=function(e,t){return e.length>1?e.indexOf(Sb(e[t],e)):t},K5="NEW_FOCUS",Iz=function(e,t,n,r){var o=e.length,s=e[0],i=e[o-1],l=bb(n);if(!(n&&e.indexOf(n)>=0)){var u=n!==void 0?t.indexOf(n):-1,p=r?t.indexOf(r):u,m=r?e.indexOf(r):-1,h=u-p,g=t.indexOf(s),x=t.indexOf(i),y=_z(t),b=n!==void 0?y.indexOf(n):-1,w=b-(r?y.indexOf(r):u),S=uS(e,0),j=uS(e,o-1);if(u===-1||m===-1)return K5;if(!h&&m>=0)return m;if(u<=g&&l&&Math.abs(h)>1)return j;if(u>=x&&l&&Math.abs(h)>1)return S;if(h&&Math.abs(w)>1)return m;if(u<=g)return j;if(u>x)return S;if(h)return Math.abs(h)>1?m:(o+m+h)%o}},Pz=function(e){return function(t){var n,r=(n=F5(t))===null||n===void 0?void 0:n.autofocus;return t.autofocus||r!==void 0&&r!=="false"||e.indexOf(t)>=0}},Ez=function(e,t,n){var r=e.map(function(s){var i=s.node;return i}),o=iS(r.filter(Pz(n)));return o&&o.length?cS(o):cS(iS(t))},D1=function(e,t){return t===void 0&&(t=[]),t.push(e),e.parentNode&&D1(e.parentNode.host||e.parentNode,t),t},lv=function(e,t){for(var n=D1(e),r=D1(t),o=0;o=0)return s}return!1},q5=function(e,t,n){var r=sm(e),o=sm(t),s=r[0],i=!1;return o.filter(Boolean).forEach(function(l){i=lv(i||l,l)||i,n.filter(Boolean).forEach(function(u){var p=lv(s,u);p&&(!i||ic(p,i)?i=p:i=lv(p,i))})}),i},Mz=function(e,t){return e.reduce(function(n,r){return n.concat(bz(r,t))},[])},Oz=function(e,t){var n=new Map;return t.forEach(function(r){return n.set(r.node,r)}),e.map(function(r){return n.get(r)}).filter(pz)},Rz=function(e,t){var n=Qu(sm(e).length>0?document:T5(e).ownerDocument),r=wb(e).filter(am),o=q5(n||e,e,r),s=new Map,i=lS(r,s),l=R1(r,s).filter(function(x){var y=x.node;return am(y)});if(!(!l[0]&&(l=i,!l[0]))){var u=lS([o],s).map(function(x){var y=x.node;return y}),p=Oz(u,l),m=p.map(function(x){var y=x.node;return y}),h=Iz(m,u,n,t);if(h===K5){var g=Ez(i,m,Mz(r,s));if(g)return{node:g};console.warn("focus-lock: cannot find any node to move focus into");return}return h===void 0?h:p[h]}},Dz=function(e){var t=wb(e).filter(am),n=q5(e,e,t),r=new Map,o=R1([n],r,!0),s=R1(t,r).filter(function(i){var l=i.node;return am(l)}).map(function(i){var l=i.node;return l});return o.map(function(i){var l=i.node,u=i.index;return{node:l,index:u,lockItem:s.indexOf(l)>=0,guard:bb(l)}})},Az=function(e,t){"focus"in e&&e.focus(t),"contentWindow"in e&&e.contentWindow&&e.contentWindow.focus()},cv=0,uv=!1,X5=function(e,t,n){n===void 0&&(n={});var r=Rz(e,t);if(!uv&&r){if(cv>2){console.error("FocusLock: focus-fighting detected. Only one focus management system could be active. See https://github.com/theKashey/focus-lock/#focus-fighting"),uv=!0,setTimeout(function(){uv=!1},1);return}cv++,Az(r.node,n.focusOptions),cv--}};function kb(e){setTimeout(e,1)}var Tz=function(){return document&&document.activeElement===document.body},Nz=function(){return Tz()||kz()},lc=null,Zl=null,cc=null,Yu=!1,$z=function(){return!0},Lz=function(t){return(lc.whiteList||$z)(t)},zz=function(t,n){cc={observerNode:t,portaledElement:n}},Fz=function(t){return cc&&cc.portaledElement===t};function dS(e,t,n,r){var o=null,s=e;do{var i=r[s];if(i.guard)i.node.dataset.focusAutoGuard&&(o=i);else if(i.lockItem){if(s!==e)return;o=null}else break}while((s+=n)!==t);o&&(o.node.tabIndex=0)}var Bz=function(t){return t&&"current"in t?t.current:t},Hz=function(t){return t?!!Yu:Yu==="meanwhile"},Vz=function e(t,n,r){return n&&(n.host===t&&(!n.activeElement||r.contains(n.activeElement))||n.parentNode&&e(t,n.parentNode,r))},Wz=function(t,n){return n.some(function(r){return Vz(t,r,r)})},im=function(){var t=!1;if(lc){var n=lc,r=n.observed,o=n.persistentFocus,s=n.autoFocus,i=n.shards,l=n.crossFrame,u=n.focusOptions,p=r||cc&&cc.portaledElement,m=document&&document.activeElement;if(p){var h=[p].concat(i.map(Bz).filter(Boolean));if((!m||Lz(m))&&(o||Hz(l)||!Nz()||!Zl&&s)&&(p&&!(G5(h)||m&&Wz(m,h)||Fz(m))&&(document&&!Zl&&m&&!s?(m.blur&&m.blur(),document.body.focus()):(t=X5(h,Zl,{focusOptions:u}),cc={})),Yu=!1,Zl=document&&document.activeElement),document){var g=document&&document.activeElement,x=Dz(h),y=x.map(function(b){var w=b.node;return w}).indexOf(g);y>-1&&(x.filter(function(b){var w=b.guard,S=b.node;return w&&S.dataset.focusAutoGuard}).forEach(function(b){var w=b.node;return w.removeAttribute("tabIndex")}),dS(y,x.length,1,x),dS(y,-1,-1,x))}}}return t},Q5=function(t){im()&&t&&(t.stopPropagation(),t.preventDefault())},jb=function(){return kb(im)},Uz=function(t){var n=t.target,r=t.currentTarget;r.contains(n)||zz(r,n)},Gz=function(){return null},Y5=function(){Yu="just",kb(function(){Yu="meanwhile"})},Kz=function(){document.addEventListener("focusin",Q5),document.addEventListener("focusout",jb),window.addEventListener("blur",Y5)},qz=function(){document.removeEventListener("focusin",Q5),document.removeEventListener("focusout",jb),window.removeEventListener("blur",Y5)};function Xz(e){return e.filter(function(t){var n=t.disabled;return!n})}function Qz(e){var t=e.slice(-1)[0];t&&!lc&&Kz();var n=lc,r=n&&t&&t.id===n.id;lc=t,n&&!r&&(n.onDeactivation(),e.filter(function(o){var s=o.id;return s===n.id}).length||n.returnFocus(!t)),t?(Zl=null,(!r||n.observed!==t.observed)&&t.onActivation(),im(),kb(im)):(qz(),Zl=null)}R5.assignSyncMedium(Uz);D5.assignMedium(jb);nz.assignMedium(function(e){return e({moveFocusInside:X5,focusInside:G5})});const Yz=az(Xz,Qz)(Gz);var Z5=d.forwardRef(function(t,n){return d.createElement(A5,pn({sideCar:Yz,ref:n},t))}),J5=A5.propTypes||{};J5.sideCar;r$(J5,["sideCar"]);Z5.propTypes={};const fS=Z5;function e3(e){return e!=null&&typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.ELEMENT_NODE}function _b(e){var t;if(!e3(e))return!1;const n=(t=e.ownerDocument.defaultView)!=null?t:window;return e instanceof n.HTMLElement}function Zz(e){var t,n;return(n=(t=t3(e))==null?void 0:t.defaultView)!=null?n:window}function t3(e){return e3(e)?e.ownerDocument:document}function Jz(e){return t3(e).activeElement}function eF(e){const t=e.ownerDocument.defaultView||window,{overflow:n,overflowX:r,overflowY:o}=t.getComputedStyle(e);return/auto|scroll|overlay|hidden/.test(n+o+r)}function tF(e){return e.localName==="html"?e:e.assignedSlot||e.parentElement||e.ownerDocument.documentElement}function n3(e){return["html","body","#document"].includes(e.localName)?e.ownerDocument.body:_b(e)&&eF(e)?e:n3(tF(e))}var r3=e=>e.hasAttribute("tabindex"),nF=e=>r3(e)&&e.tabIndex===-1;function rF(e){return!!e.getAttribute("disabled")||!!e.getAttribute("aria-disabled")}function o3(e){return e.parentElement&&o3(e.parentElement)?!0:e.hidden}function oF(e){const t=e.getAttribute("contenteditable");return t!=="false"&&t!=null}function s3(e){if(!_b(e)||o3(e)||rF(e))return!1;const{localName:t}=e;if(["input","select","textarea","button"].indexOf(t)>=0)return!0;const r={a:()=>e.hasAttribute("href"),audio:()=>e.hasAttribute("controls"),video:()=>e.hasAttribute("controls")};return t in r?r[t]():oF(e)?!0:r3(e)}function sF(e){return e?_b(e)&&s3(e)&&!nF(e):!1}var aF=["input:not(:disabled):not([disabled])","select:not(:disabled):not([disabled])","textarea:not(:disabled):not([disabled])","embed","iframe","object","a[href]","area[href]","button:not(:disabled):not([disabled])","[tabindex]","audio[controls]","video[controls]","*[tabindex]:not([aria-disabled])","*[contenteditable]"],iF=aF.join(),lF=e=>e.offsetWidth>0&&e.offsetHeight>0;function a3(e){const t=Array.from(e.querySelectorAll(iF));return t.unshift(e),t.filter(n=>s3(n)&&lF(n))}var pS,cF=(pS=fS.default)!=null?pS:fS,i3=e=>{const{initialFocusRef:t,finalFocusRef:n,contentRef:r,restoreFocus:o,children:s,isDisabled:i,autoFocus:l,persistentFocus:u,lockFocusAcrossFrames:p}=e,m=d.useCallback(()=>{t!=null&&t.current?t.current.focus():r!=null&&r.current&&a3(r.current).length===0&&requestAnimationFrame(()=>{var y;(y=r.current)==null||y.focus()})},[t,r]),h=d.useCallback(()=>{var x;(x=n==null?void 0:n.current)==null||x.focus()},[n]),g=o&&!n;return a.jsx(cF,{crossFrame:p,persistentFocus:u,autoFocus:l,disabled:i,onActivation:m,onDeactivation:h,returnFocus:g,children:s})};i3.displayName="FocusLock";var uF=w$?d.useLayoutEffect:d.useEffect;function A1(e,t=[]){const n=d.useRef(e);return uF(()=>{n.current=e}),d.useCallback((...r)=>{var o;return(o=n.current)==null?void 0:o.call(n,...r)},t)}function dF(e,t,n,r){const o=A1(t);return d.useEffect(()=>{var s;const i=(s=ZC(n))!=null?s:document;if(t)return i.addEventListener(e,o,r),()=>{i.removeEventListener(e,o,r)}},[e,n,r,o,t]),()=>{var s;((s=ZC(n))!=null?s:document).removeEventListener(e,o,r)}}function fF(e,t){const n=d.useId();return d.useMemo(()=>e||[t,n].filter(Boolean).join("-"),[e,t,n])}function pF(e,t){const n=e!==void 0;return[n,n&&typeof e<"u"?e:t]}function Lr(e={}){const{onClose:t,onOpen:n,isOpen:r,id:o}=e,s=A1(n),i=A1(t),[l,u]=d.useState(e.defaultIsOpen||!1),[p,m]=pF(r,l),h=fF(o,"disclosure"),g=d.useCallback(()=>{p||u(!1),i==null||i()},[p,i]),x=d.useCallback(()=>{p||u(!0),s==null||s()},[p,s]),y=d.useCallback(()=>{(m?g:x)()},[m,x,g]);return{isOpen:!!m,onOpen:x,onClose:g,onToggle:y,isControlled:p,getButtonProps:(b={})=>({...b,"aria-expanded":m,"aria-controls":h,onClick:BR(b.onClick,y)}),getDisclosureProps:(b={})=>({...b,hidden:!m,id:h})}}var[mF,hF]=Wt({name:"InputGroupStylesContext",errorMessage:`useInputGroupStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),l3=ke(function(t,n){const r=Un("Input",t),{children:o,className:s,...i}=on(t),l=Ye("chakra-input__group",s),u={},p=kh(o),m=r.field;p.forEach(g=>{var x,y;r&&(m&&g.type.id==="InputLeftElement"&&(u.paddingStart=(x=m.height)!=null?x:m.h),m&&g.type.id==="InputRightElement"&&(u.paddingEnd=(y=m.height)!=null?y:m.h),g.type.id==="InputRightAddon"&&(u.borderEndRadius=0),g.type.id==="InputLeftAddon"&&(u.borderStartRadius=0))});const h=p.map(g=>{var x,y;const b=Z_({size:((x=g.props)==null?void 0:x.size)||t.size,variant:((y=g.props)==null?void 0:y.variant)||t.variant});return g.type.id!=="Input"?d.cloneElement(g,b):d.cloneElement(g,Object.assign(b,u,g.props))});return a.jsx(we.div,{className:l,ref:n,__css:{width:"100%",display:"flex",position:"relative",isolation:"isolate",...r.group},"data-group":!0,...i,children:a.jsx(mF,{value:r,children:h})})});l3.displayName="InputGroup";var gF=we("div",{baseStyle:{display:"flex",alignItems:"center",justifyContent:"center",position:"absolute",top:"0",zIndex:2}}),Eh=ke(function(t,n){var r,o;const{placement:s="left",...i}=t,l=hF(),u=l.field,m={[s==="left"?"insetStart":"insetEnd"]:"0",width:(r=u==null?void 0:u.height)!=null?r:u==null?void 0:u.h,height:(o=u==null?void 0:u.height)!=null?o:u==null?void 0:u.h,fontSize:u==null?void 0:u.fontSize,...l.element};return a.jsx(gF,{ref:n,__css:m,...i})});Eh.id="InputElement";Eh.displayName="InputElement";var c3=ke(function(t,n){const{className:r,...o}=t,s=Ye("chakra-input__left-element",r);return a.jsx(Eh,{ref:n,placement:"left",className:s,...o})});c3.id="InputLeftElement";c3.displayName="InputLeftElement";var Ib=ke(function(t,n){const{className:r,...o}=t,s=Ye("chakra-input__right-element",r);return a.jsx(Eh,{ref:n,placement:"right",className:s,...o})});Ib.id="InputRightElement";Ib.displayName="InputRightElement";var Mh=ke(function(t,n){const{htmlSize:r,...o}=t,s=Un("Input",o),i=on(o),l=db(i),u=Ye("chakra-input",t.className);return a.jsx(we.input,{size:r,...l,__css:s.field,ref:n,className:u})});Mh.displayName="Input";Mh.id="Input";var Oh=ke(function(t,n){const r=oi("Link",t),{className:o,isExternal:s,...i}=on(t);return a.jsx(we.a,{target:s?"_blank":void 0,rel:s?"noopener":void 0,ref:n,className:Ye("chakra-link",o),...i,__css:r})});Oh.displayName="Link";var[vF,u3]=Wt({name:"ListStylesContext",errorMessage:`useListStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),Pb=ke(function(t,n){const r=Un("List",t),{children:o,styleType:s="none",stylePosition:i,spacing:l,...u}=on(t),p=kh(o),h=l?{["& > *:not(style) ~ *:not(style)"]:{mt:l}}:{};return a.jsx(vF,{value:r,children:a.jsx(we.ul,{ref:n,listStyleType:s,listStylePosition:i,role:"list",__css:{...r.container,...h},...u,children:p})})});Pb.displayName="List";var d3=ke((e,t)=>{const{as:n,...r}=e;return a.jsx(Pb,{ref:t,as:"ol",styleType:"decimal",marginStart:"1em",...r})});d3.displayName="OrderedList";var Od=ke(function(t,n){const{as:r,...o}=t;return a.jsx(Pb,{ref:n,as:"ul",styleType:"initial",marginStart:"1em",...o})});Od.displayName="UnorderedList";var Qr=ke(function(t,n){const r=u3();return a.jsx(we.li,{ref:n,...t,__css:r.item})});Qr.displayName="ListItem";var xF=ke(function(t,n){const r=u3();return a.jsx(Tn,{ref:n,role:"presentation",...t,__css:r.icon})});xF.displayName="ListIcon";var Ja=ke(function(t,n){const{templateAreas:r,gap:o,rowGap:s,columnGap:i,column:l,row:u,autoFlow:p,autoRows:m,templateRows:h,autoColumns:g,templateColumns:x,...y}=t,b={display:"grid",gridTemplateAreas:r,gridGap:o,gridRowGap:s,gridColumnGap:i,gridAutoColumns:g,gridColumn:l,gridRow:u,gridAutoFlow:p,gridAutoRows:m,gridTemplateRows:h,gridTemplateColumns:x};return a.jsx(we.div,{ref:n,__css:b,...y})});Ja.displayName="Grid";function f3(e,t){return Array.isArray(e)?e.map(n=>n===null?null:t(n)):a1(e)?Object.keys(e).reduce((n,r)=>(n[r]=t(e[r]),n),{}):e!=null?t(e):null}var ba=we("div",{baseStyle:{flex:1,justifySelf:"stretch",alignSelf:"stretch"}});ba.displayName="Spacer";var p3=e=>a.jsx(we.div,{className:"chakra-stack__item",...e,__css:{display:"inline-block",flex:"0 0 auto",minWidth:0,...e.__css}});p3.displayName="StackItem";function bF(e){const{spacing:t,direction:n}=e,r={column:{my:t,mx:0,borderLeftWidth:0,borderBottomWidth:"1px"},"column-reverse":{my:t,mx:0,borderLeftWidth:0,borderBottomWidth:"1px"},row:{mx:t,my:0,borderLeftWidth:"1px",borderBottomWidth:0},"row-reverse":{mx:t,my:0,borderLeftWidth:"1px",borderBottomWidth:0}};return{"&":f3(n,o=>r[o])}}var Eb=ke((e,t)=>{const{isInline:n,direction:r,align:o,justify:s,spacing:i="0.5rem",wrap:l,children:u,divider:p,className:m,shouldWrapChildren:h,...g}=e,x=n?"row":r??"column",y=d.useMemo(()=>bF({spacing:i,direction:x}),[i,x]),b=!!p,w=!h&&!b,S=d.useMemo(()=>{const _=kh(u);return w?_:_.map((E,I)=>{const M=typeof E.key<"u"?E.key:I,R=I+1===_.length,A=h?a.jsx(p3,{children:E},M):E;if(!b)return A;const O=d.cloneElement(p,{__css:y}),T=R?null:O;return a.jsxs(d.Fragment,{children:[A,T]},M)})},[p,y,b,w,h,u]),j=Ye("chakra-stack",m);return a.jsx(we.div,{ref:t,display:"flex",alignItems:o,justifyContent:s,flexDirection:x,flexWrap:l,gap:b?void 0:i,className:j,...g,children:S})});Eb.displayName="Stack";var m3=ke((e,t)=>a.jsx(Eb,{align:"center",...e,direction:"column",ref:t}));m3.displayName="VStack";var Rh=ke((e,t)=>a.jsx(Eb,{align:"center",...e,direction:"row",ref:t}));Rh.displayName="HStack";function mS(e){return f3(e,t=>t==="auto"?"auto":`span ${t}/span ${t}`)}var Zu=ke(function(t,n){const{area:r,colSpan:o,colStart:s,colEnd:i,rowEnd:l,rowSpan:u,rowStart:p,...m}=t,h=Z_({gridArea:r,gridColumn:mS(o),gridRow:mS(u),gridColumnStart:s,gridColumnEnd:i,gridRowStart:p,gridRowEnd:l});return a.jsx(we.div,{ref:n,__css:h,...m})});Zu.displayName="GridItem";var Ds=ke(function(t,n){const r=oi("Badge",t),{className:o,...s}=on(t);return a.jsx(we.span,{ref:n,className:Ye("chakra-badge",t.className),...s,__css:{display:"inline-block",whiteSpace:"nowrap",verticalAlign:"middle",...r}})});Ds.displayName="Badge";var Yn=ke(function(t,n){const{borderLeftWidth:r,borderBottomWidth:o,borderTopWidth:s,borderRightWidth:i,borderWidth:l,borderStyle:u,borderColor:p,...m}=oi("Divider",t),{className:h,orientation:g="horizontal",__css:x,...y}=on(t),b={vertical:{borderLeftWidth:r||i||l||"1px",height:"100%"},horizontal:{borderBottomWidth:o||s||l||"1px",width:"100%"}};return a.jsx(we.hr,{ref:n,"aria-orientation":g,...y,__css:{...m,border:"0",borderColor:p,borderStyle:u,...b[g],...x},className:Ye("chakra-divider",h)})});Yn.displayName="Divider";function yF(e){const{key:t}=e;return t.length===1||t.length>1&&/[^a-zA-Z0-9]/.test(t)}function CF(e={}){const{timeout:t=300,preventDefault:n=()=>!0}=e,[r,o]=d.useState([]),s=d.useRef(),i=()=>{s.current&&(clearTimeout(s.current),s.current=null)},l=()=>{i(),s.current=setTimeout(()=>{o([]),s.current=null},t)};d.useEffect(()=>i,[]);function u(p){return m=>{if(m.key==="Backspace"){const h=[...r];h.pop(),o(h);return}if(yF(m)){const h=r.concat(m.key);n(m)&&(m.preventDefault(),m.stopPropagation()),o(h),p(h.join("")),l()}}}return u}function wF(e,t,n,r){if(t==null)return r;if(!r)return e.find(i=>n(i).toLowerCase().startsWith(t.toLowerCase()));const o=e.filter(s=>n(s).toLowerCase().startsWith(t.toLowerCase()));if(o.length>0){let s;return o.includes(r)?(s=o.indexOf(r)+1,s===o.length&&(s=0),o[s]):(s=e.indexOf(o[0]),e[s])}return r}function SF(){const e=d.useRef(new Map),t=e.current,n=d.useCallback((o,s,i,l)=>{e.current.set(i,{type:s,el:o,options:l}),o.addEventListener(s,i,l)},[]),r=d.useCallback((o,s,i,l)=>{o.removeEventListener(s,i,l),e.current.delete(i)},[]);return d.useEffect(()=>()=>{t.forEach((o,s)=>{r(o.el,o.type,s,o.options)})},[r,t]),{add:n,remove:r}}function dv(e){const t=e.target,{tagName:n,isContentEditable:r}=t;return n!=="INPUT"&&n!=="TEXTAREA"&&r!==!0}function h3(e={}){const{ref:t,isDisabled:n,isFocusable:r,clickOnEnter:o=!0,clickOnSpace:s=!0,onMouseDown:i,onMouseUp:l,onClick:u,onKeyDown:p,onKeyUp:m,tabIndex:h,onMouseOver:g,onMouseLeave:x,...y}=e,[b,w]=d.useState(!0),[S,j]=d.useState(!1),_=SF(),E=$=>{$&&$.tagName!=="BUTTON"&&w(!1)},I=b?h:h||0,M=n&&!r,R=d.useCallback($=>{if(n){$.stopPropagation(),$.preventDefault();return}$.currentTarget.focus(),u==null||u($)},[n,u]),D=d.useCallback($=>{S&&dv($)&&($.preventDefault(),$.stopPropagation(),j(!1),_.remove(document,"keyup",D,!1))},[S,_]),A=d.useCallback($=>{if(p==null||p($),n||$.defaultPrevented||$.metaKey||!dv($.nativeEvent)||b)return;const q=o&&$.key==="Enter";s&&$.key===" "&&($.preventDefault(),j(!0)),q&&($.preventDefault(),$.currentTarget.click()),_.add(document,"keyup",D,!1)},[n,b,p,o,s,_,D]),O=d.useCallback($=>{if(m==null||m($),n||$.defaultPrevented||$.metaKey||!dv($.nativeEvent)||b)return;s&&$.key===" "&&($.preventDefault(),j(!1),$.currentTarget.click())},[s,b,n,m]),T=d.useCallback($=>{$.button===0&&(j(!1),_.remove(document,"mouseup",T,!1))},[_]),X=d.useCallback($=>{if($.button!==0)return;if(n){$.stopPropagation(),$.preventDefault();return}b||j(!0),$.currentTarget.focus({preventScroll:!0}),_.add(document,"mouseup",T,!1),i==null||i($)},[n,b,i,_,T]),B=d.useCallback($=>{$.button===0&&(b||j(!1),l==null||l($))},[l,b]),V=d.useCallback($=>{if(n){$.preventDefault();return}g==null||g($)},[n,g]),U=d.useCallback($=>{S&&($.preventDefault(),j(!1)),x==null||x($)},[S,x]),N=It(t,E);return b?{...y,ref:N,type:"button","aria-disabled":M?void 0:n,disabled:M,onClick:R,onMouseDown:i,onMouseUp:l,onKeyUp:m,onKeyDown:p,onMouseOver:g,onMouseLeave:x}:{...y,ref:N,role:"button","data-active":dt(S),"aria-disabled":n?"true":void 0,tabIndex:M?void 0:I,onClick:R,onMouseDown:X,onMouseUp:B,onKeyUp:O,onKeyDown:A,onMouseOver:V,onMouseLeave:U}}function kF(e){const t=e.current;if(!t)return!1;const n=Jz(t);return!n||t.contains(n)?!1:!!sF(n)}function g3(e,t){const{shouldFocus:n,visible:r,focusRef:o}=t,s=n&&!r;pa(()=>{if(!s||kF(e))return;const i=(o==null?void 0:o.current)||e.current;let l;if(i)return l=requestAnimationFrame(()=>{i.focus({preventScroll:!0})}),()=>{cancelAnimationFrame(l)}},[s,e,o])}var jF={preventScroll:!0,shouldFocus:!1};function _F(e,t=jF){const{focusRef:n,preventScroll:r,shouldFocus:o,visible:s}=t,i=IF(e)?e.current:e,l=o&&s,u=d.useRef(l),p=d.useRef(s);rc(()=>{!p.current&&s&&(u.current=l),p.current=s},[s,l]);const m=d.useCallback(()=>{if(!(!s||!i||!u.current)&&(u.current=!1,!i.contains(document.activeElement)))if(n!=null&&n.current)requestAnimationFrame(()=>{var h;(h=n.current)==null||h.focus({preventScroll:r})});else{const h=a3(i);h.length>0&&requestAnimationFrame(()=>{h[0].focus({preventScroll:r})})}},[s,r,i,n]);pa(()=>{m()},[m]),Ri(i,"transitionend",m)}function IF(e){return"current"in e}var Rl=(e,t)=>({var:e,varRef:t?`var(${e}, ${t})`:`var(${e})`}),Nn={arrowShadowColor:Rl("--popper-arrow-shadow-color"),arrowSize:Rl("--popper-arrow-size","8px"),arrowSizeHalf:Rl("--popper-arrow-size-half"),arrowBg:Rl("--popper-arrow-bg"),transformOrigin:Rl("--popper-transform-origin"),arrowOffset:Rl("--popper-arrow-offset")};function PF(e){if(e.includes("top"))return"1px 1px 0px 0 var(--popper-arrow-shadow-color)";if(e.includes("bottom"))return"-1px -1px 0px 0 var(--popper-arrow-shadow-color)";if(e.includes("right"))return"-1px 1px 0px 0 var(--popper-arrow-shadow-color)";if(e.includes("left"))return"1px -1px 0px 0 var(--popper-arrow-shadow-color)"}var EF={top:"bottom center","top-start":"bottom left","top-end":"bottom right",bottom:"top center","bottom-start":"top left","bottom-end":"top right",left:"right center","left-start":"right top","left-end":"right bottom",right:"left center","right-start":"left top","right-end":"left bottom"},MF=e=>EF[e],hS={scroll:!0,resize:!0};function OF(e){let t;return typeof e=="object"?t={enabled:!0,options:{...hS,...e}}:t={enabled:e,options:hS},t}var RF={name:"matchWidth",enabled:!0,phase:"beforeWrite",requires:["computeStyles"],fn:({state:e})=>{e.styles.popper.width=`${e.rects.reference.width}px`},effect:({state:e})=>()=>{const t=e.elements.reference;e.elements.popper.style.width=`${t.offsetWidth}px`}},DF={name:"transformOrigin",enabled:!0,phase:"write",fn:({state:e})=>{gS(e)},effect:({state:e})=>()=>{gS(e)}},gS=e=>{e.elements.popper.style.setProperty(Nn.transformOrigin.var,MF(e.placement))},AF={name:"positionArrow",enabled:!0,phase:"afterWrite",fn:({state:e})=>{TF(e)}},TF=e=>{var t;if(!e.placement)return;const n=NF(e.placement);if((t=e.elements)!=null&&t.arrow&&n){Object.assign(e.elements.arrow.style,{[n.property]:n.value,width:Nn.arrowSize.varRef,height:Nn.arrowSize.varRef,zIndex:-1});const r={[Nn.arrowSizeHalf.var]:`calc(${Nn.arrowSize.varRef} / 2 - 1px)`,[Nn.arrowOffset.var]:`calc(${Nn.arrowSizeHalf.varRef} * -1)`};for(const o in r)e.elements.arrow.style.setProperty(o,r[o])}},NF=e=>{if(e.startsWith("top"))return{property:"bottom",value:Nn.arrowOffset.varRef};if(e.startsWith("bottom"))return{property:"top",value:Nn.arrowOffset.varRef};if(e.startsWith("left"))return{property:"right",value:Nn.arrowOffset.varRef};if(e.startsWith("right"))return{property:"left",value:Nn.arrowOffset.varRef}},$F={name:"innerArrow",enabled:!0,phase:"main",requires:["arrow"],fn:({state:e})=>{vS(e)},effect:({state:e})=>()=>{vS(e)}},vS=e=>{if(!e.elements.arrow)return;const t=e.elements.arrow.querySelector("[data-popper-arrow-inner]");if(!t)return;const n=PF(e.placement);n&&t.style.setProperty("--popper-arrow-default-shadow",n),Object.assign(t.style,{transform:"rotate(45deg)",background:Nn.arrowBg.varRef,top:0,left:0,width:"100%",height:"100%",position:"absolute",zIndex:"inherit",boxShadow:"var(--popper-arrow-shadow, var(--popper-arrow-default-shadow))"})},LF={"start-start":{ltr:"left-start",rtl:"right-start"},"start-end":{ltr:"left-end",rtl:"right-end"},"end-start":{ltr:"right-start",rtl:"left-start"},"end-end":{ltr:"right-end",rtl:"left-end"},start:{ltr:"left",rtl:"right"},end:{ltr:"right",rtl:"left"}},zF={"auto-start":"auto-end","auto-end":"auto-start","top-start":"top-end","top-end":"top-start","bottom-start":"bottom-end","bottom-end":"bottom-start"};function FF(e,t="ltr"){var n,r;const o=((n=LF[e])==null?void 0:n[t])||e;return t==="ltr"?o:(r=zF[e])!=null?r:o}var Dr="top",ko="bottom",jo="right",Ar="left",Mb="auto",Rd=[Dr,ko,jo,Ar],xc="start",Ju="end",BF="clippingParents",v3="viewport",Cu="popper",HF="reference",xS=Rd.reduce(function(e,t){return e.concat([t+"-"+xc,t+"-"+Ju])},[]),x3=[].concat(Rd,[Mb]).reduce(function(e,t){return e.concat([t,t+"-"+xc,t+"-"+Ju])},[]),VF="beforeRead",WF="read",UF="afterRead",GF="beforeMain",KF="main",qF="afterMain",XF="beforeWrite",QF="write",YF="afterWrite",ZF=[VF,WF,UF,GF,KF,qF,XF,QF,YF];function ws(e){return e?(e.nodeName||"").toLowerCase():null}function no(e){if(e==null)return window;if(e.toString()!=="[object Window]"){var t=e.ownerDocument;return t&&t.defaultView||window}return e}function Wi(e){var t=no(e).Element;return e instanceof t||e instanceof Element}function wo(e){var t=no(e).HTMLElement;return e instanceof t||e instanceof HTMLElement}function Ob(e){if(typeof ShadowRoot>"u")return!1;var t=no(e).ShadowRoot;return e instanceof t||e instanceof ShadowRoot}function JF(e){var t=e.state;Object.keys(t.elements).forEach(function(n){var r=t.styles[n]||{},o=t.attributes[n]||{},s=t.elements[n];!wo(s)||!ws(s)||(Object.assign(s.style,r),Object.keys(o).forEach(function(i){var l=o[i];l===!1?s.removeAttribute(i):s.setAttribute(i,l===!0?"":l)}))})}function eB(e){var t=e.state,n={popper:{position:t.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(t.elements.popper.style,n.popper),t.styles=n,t.elements.arrow&&Object.assign(t.elements.arrow.style,n.arrow),function(){Object.keys(t.elements).forEach(function(r){var o=t.elements[r],s=t.attributes[r]||{},i=Object.keys(t.styles.hasOwnProperty(r)?t.styles[r]:n[r]),l=i.reduce(function(u,p){return u[p]="",u},{});!wo(o)||!ws(o)||(Object.assign(o.style,l),Object.keys(s).forEach(function(u){o.removeAttribute(u)}))})}}const tB={name:"applyStyles",enabled:!0,phase:"write",fn:JF,effect:eB,requires:["computeStyles"]};function Cs(e){return e.split("-")[0]}var Di=Math.max,lm=Math.min,bc=Math.round;function T1(){var e=navigator.userAgentData;return e!=null&&e.brands&&Array.isArray(e.brands)?e.brands.map(function(t){return t.brand+"/"+t.version}).join(" "):navigator.userAgent}function b3(){return!/^((?!chrome|android).)*safari/i.test(T1())}function yc(e,t,n){t===void 0&&(t=!1),n===void 0&&(n=!1);var r=e.getBoundingClientRect(),o=1,s=1;t&&wo(e)&&(o=e.offsetWidth>0&&bc(r.width)/e.offsetWidth||1,s=e.offsetHeight>0&&bc(r.height)/e.offsetHeight||1);var i=Wi(e)?no(e):window,l=i.visualViewport,u=!b3()&&n,p=(r.left+(u&&l?l.offsetLeft:0))/o,m=(r.top+(u&&l?l.offsetTop:0))/s,h=r.width/o,g=r.height/s;return{width:h,height:g,top:m,right:p+h,bottom:m+g,left:p,x:p,y:m}}function Rb(e){var t=yc(e),n=e.offsetWidth,r=e.offsetHeight;return Math.abs(t.width-n)<=1&&(n=t.width),Math.abs(t.height-r)<=1&&(r=t.height),{x:e.offsetLeft,y:e.offsetTop,width:n,height:r}}function y3(e,t){var n=t.getRootNode&&t.getRootNode();if(e.contains(t))return!0;if(n&&Ob(n)){var r=t;do{if(r&&e.isSameNode(r))return!0;r=r.parentNode||r.host}while(r)}return!1}function aa(e){return no(e).getComputedStyle(e)}function nB(e){return["table","td","th"].indexOf(ws(e))>=0}function si(e){return((Wi(e)?e.ownerDocument:e.document)||window.document).documentElement}function Dh(e){return ws(e)==="html"?e:e.assignedSlot||e.parentNode||(Ob(e)?e.host:null)||si(e)}function bS(e){return!wo(e)||aa(e).position==="fixed"?null:e.offsetParent}function rB(e){var t=/firefox/i.test(T1()),n=/Trident/i.test(T1());if(n&&wo(e)){var r=aa(e);if(r.position==="fixed")return null}var o=Dh(e);for(Ob(o)&&(o=o.host);wo(o)&&["html","body"].indexOf(ws(o))<0;){var s=aa(o);if(s.transform!=="none"||s.perspective!=="none"||s.contain==="paint"||["transform","perspective"].indexOf(s.willChange)!==-1||t&&s.willChange==="filter"||t&&s.filter&&s.filter!=="none")return o;o=o.parentNode}return null}function Dd(e){for(var t=no(e),n=bS(e);n&&nB(n)&&aa(n).position==="static";)n=bS(n);return n&&(ws(n)==="html"||ws(n)==="body"&&aa(n).position==="static")?t:n||rB(e)||t}function Db(e){return["top","bottom"].indexOf(e)>=0?"x":"y"}function Fu(e,t,n){return Di(e,lm(t,n))}function oB(e,t,n){var r=Fu(e,t,n);return r>n?n:r}function C3(){return{top:0,right:0,bottom:0,left:0}}function w3(e){return Object.assign({},C3(),e)}function S3(e,t){return t.reduce(function(n,r){return n[r]=e,n},{})}var sB=function(t,n){return t=typeof t=="function"?t(Object.assign({},n.rects,{placement:n.placement})):t,w3(typeof t!="number"?t:S3(t,Rd))};function aB(e){var t,n=e.state,r=e.name,o=e.options,s=n.elements.arrow,i=n.modifiersData.popperOffsets,l=Cs(n.placement),u=Db(l),p=[Ar,jo].indexOf(l)>=0,m=p?"height":"width";if(!(!s||!i)){var h=sB(o.padding,n),g=Rb(s),x=u==="y"?Dr:Ar,y=u==="y"?ko:jo,b=n.rects.reference[m]+n.rects.reference[u]-i[u]-n.rects.popper[m],w=i[u]-n.rects.reference[u],S=Dd(s),j=S?u==="y"?S.clientHeight||0:S.clientWidth||0:0,_=b/2-w/2,E=h[x],I=j-g[m]-h[y],M=j/2-g[m]/2+_,R=Fu(E,M,I),D=u;n.modifiersData[r]=(t={},t[D]=R,t.centerOffset=R-M,t)}}function iB(e){var t=e.state,n=e.options,r=n.element,o=r===void 0?"[data-popper-arrow]":r;o!=null&&(typeof o=="string"&&(o=t.elements.popper.querySelector(o),!o)||y3(t.elements.popper,o)&&(t.elements.arrow=o))}const lB={name:"arrow",enabled:!0,phase:"main",fn:aB,effect:iB,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function Cc(e){return e.split("-")[1]}var cB={top:"auto",right:"auto",bottom:"auto",left:"auto"};function uB(e,t){var n=e.x,r=e.y,o=t.devicePixelRatio||1;return{x:bc(n*o)/o||0,y:bc(r*o)/o||0}}function yS(e){var t,n=e.popper,r=e.popperRect,o=e.placement,s=e.variation,i=e.offsets,l=e.position,u=e.gpuAcceleration,p=e.adaptive,m=e.roundOffsets,h=e.isFixed,g=i.x,x=g===void 0?0:g,y=i.y,b=y===void 0?0:y,w=typeof m=="function"?m({x,y:b}):{x,y:b};x=w.x,b=w.y;var S=i.hasOwnProperty("x"),j=i.hasOwnProperty("y"),_=Ar,E=Dr,I=window;if(p){var M=Dd(n),R="clientHeight",D="clientWidth";if(M===no(n)&&(M=si(n),aa(M).position!=="static"&&l==="absolute"&&(R="scrollHeight",D="scrollWidth")),M=M,o===Dr||(o===Ar||o===jo)&&s===Ju){E=ko;var A=h&&M===I&&I.visualViewport?I.visualViewport.height:M[R];b-=A-r.height,b*=u?1:-1}if(o===Ar||(o===Dr||o===ko)&&s===Ju){_=jo;var O=h&&M===I&&I.visualViewport?I.visualViewport.width:M[D];x-=O-r.width,x*=u?1:-1}}var T=Object.assign({position:l},p&&cB),X=m===!0?uB({x,y:b},no(n)):{x,y:b};if(x=X.x,b=X.y,u){var B;return Object.assign({},T,(B={},B[E]=j?"0":"",B[_]=S?"0":"",B.transform=(I.devicePixelRatio||1)<=1?"translate("+x+"px, "+b+"px)":"translate3d("+x+"px, "+b+"px, 0)",B))}return Object.assign({},T,(t={},t[E]=j?b+"px":"",t[_]=S?x+"px":"",t.transform="",t))}function dB(e){var t=e.state,n=e.options,r=n.gpuAcceleration,o=r===void 0?!0:r,s=n.adaptive,i=s===void 0?!0:s,l=n.roundOffsets,u=l===void 0?!0:l,p={placement:Cs(t.placement),variation:Cc(t.placement),popper:t.elements.popper,popperRect:t.rects.popper,gpuAcceleration:o,isFixed:t.options.strategy==="fixed"};t.modifiersData.popperOffsets!=null&&(t.styles.popper=Object.assign({},t.styles.popper,yS(Object.assign({},p,{offsets:t.modifiersData.popperOffsets,position:t.options.strategy,adaptive:i,roundOffsets:u})))),t.modifiersData.arrow!=null&&(t.styles.arrow=Object.assign({},t.styles.arrow,yS(Object.assign({},p,{offsets:t.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:u})))),t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-placement":t.placement})}const fB={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:dB,data:{}};var Jf={passive:!0};function pB(e){var t=e.state,n=e.instance,r=e.options,o=r.scroll,s=o===void 0?!0:o,i=r.resize,l=i===void 0?!0:i,u=no(t.elements.popper),p=[].concat(t.scrollParents.reference,t.scrollParents.popper);return s&&p.forEach(function(m){m.addEventListener("scroll",n.update,Jf)}),l&&u.addEventListener("resize",n.update,Jf),function(){s&&p.forEach(function(m){m.removeEventListener("scroll",n.update,Jf)}),l&&u.removeEventListener("resize",n.update,Jf)}}const mB={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:pB,data:{}};var hB={left:"right",right:"left",bottom:"top",top:"bottom"};function Np(e){return e.replace(/left|right|bottom|top/g,function(t){return hB[t]})}var gB={start:"end",end:"start"};function CS(e){return e.replace(/start|end/g,function(t){return gB[t]})}function Ab(e){var t=no(e),n=t.pageXOffset,r=t.pageYOffset;return{scrollLeft:n,scrollTop:r}}function Tb(e){return yc(si(e)).left+Ab(e).scrollLeft}function vB(e,t){var n=no(e),r=si(e),o=n.visualViewport,s=r.clientWidth,i=r.clientHeight,l=0,u=0;if(o){s=o.width,i=o.height;var p=b3();(p||!p&&t==="fixed")&&(l=o.offsetLeft,u=o.offsetTop)}return{width:s,height:i,x:l+Tb(e),y:u}}function xB(e){var t,n=si(e),r=Ab(e),o=(t=e.ownerDocument)==null?void 0:t.body,s=Di(n.scrollWidth,n.clientWidth,o?o.scrollWidth:0,o?o.clientWidth:0),i=Di(n.scrollHeight,n.clientHeight,o?o.scrollHeight:0,o?o.clientHeight:0),l=-r.scrollLeft+Tb(e),u=-r.scrollTop;return aa(o||n).direction==="rtl"&&(l+=Di(n.clientWidth,o?o.clientWidth:0)-s),{width:s,height:i,x:l,y:u}}function Nb(e){var t=aa(e),n=t.overflow,r=t.overflowX,o=t.overflowY;return/auto|scroll|overlay|hidden/.test(n+o+r)}function k3(e){return["html","body","#document"].indexOf(ws(e))>=0?e.ownerDocument.body:wo(e)&&Nb(e)?e:k3(Dh(e))}function Bu(e,t){var n;t===void 0&&(t=[]);var r=k3(e),o=r===((n=e.ownerDocument)==null?void 0:n.body),s=no(r),i=o?[s].concat(s.visualViewport||[],Nb(r)?r:[]):r,l=t.concat(i);return o?l:l.concat(Bu(Dh(i)))}function N1(e){return Object.assign({},e,{left:e.x,top:e.y,right:e.x+e.width,bottom:e.y+e.height})}function bB(e,t){var n=yc(e,!1,t==="fixed");return n.top=n.top+e.clientTop,n.left=n.left+e.clientLeft,n.bottom=n.top+e.clientHeight,n.right=n.left+e.clientWidth,n.width=e.clientWidth,n.height=e.clientHeight,n.x=n.left,n.y=n.top,n}function wS(e,t,n){return t===v3?N1(vB(e,n)):Wi(t)?bB(t,n):N1(xB(si(e)))}function yB(e){var t=Bu(Dh(e)),n=["absolute","fixed"].indexOf(aa(e).position)>=0,r=n&&wo(e)?Dd(e):e;return Wi(r)?t.filter(function(o){return Wi(o)&&y3(o,r)&&ws(o)!=="body"}):[]}function CB(e,t,n,r){var o=t==="clippingParents"?yB(e):[].concat(t),s=[].concat(o,[n]),i=s[0],l=s.reduce(function(u,p){var m=wS(e,p,r);return u.top=Di(m.top,u.top),u.right=lm(m.right,u.right),u.bottom=lm(m.bottom,u.bottom),u.left=Di(m.left,u.left),u},wS(e,i,r));return l.width=l.right-l.left,l.height=l.bottom-l.top,l.x=l.left,l.y=l.top,l}function j3(e){var t=e.reference,n=e.element,r=e.placement,o=r?Cs(r):null,s=r?Cc(r):null,i=t.x+t.width/2-n.width/2,l=t.y+t.height/2-n.height/2,u;switch(o){case Dr:u={x:i,y:t.y-n.height};break;case ko:u={x:i,y:t.y+t.height};break;case jo:u={x:t.x+t.width,y:l};break;case Ar:u={x:t.x-n.width,y:l};break;default:u={x:t.x,y:t.y}}var p=o?Db(o):null;if(p!=null){var m=p==="y"?"height":"width";switch(s){case xc:u[p]=u[p]-(t[m]/2-n[m]/2);break;case Ju:u[p]=u[p]+(t[m]/2-n[m]/2);break}}return u}function ed(e,t){t===void 0&&(t={});var n=t,r=n.placement,o=r===void 0?e.placement:r,s=n.strategy,i=s===void 0?e.strategy:s,l=n.boundary,u=l===void 0?BF:l,p=n.rootBoundary,m=p===void 0?v3:p,h=n.elementContext,g=h===void 0?Cu:h,x=n.altBoundary,y=x===void 0?!1:x,b=n.padding,w=b===void 0?0:b,S=w3(typeof w!="number"?w:S3(w,Rd)),j=g===Cu?HF:Cu,_=e.rects.popper,E=e.elements[y?j:g],I=CB(Wi(E)?E:E.contextElement||si(e.elements.popper),u,m,i),M=yc(e.elements.reference),R=j3({reference:M,element:_,strategy:"absolute",placement:o}),D=N1(Object.assign({},_,R)),A=g===Cu?D:M,O={top:I.top-A.top+S.top,bottom:A.bottom-I.bottom+S.bottom,left:I.left-A.left+S.left,right:A.right-I.right+S.right},T=e.modifiersData.offset;if(g===Cu&&T){var X=T[o];Object.keys(O).forEach(function(B){var V=[jo,ko].indexOf(B)>=0?1:-1,U=[Dr,ko].indexOf(B)>=0?"y":"x";O[B]+=X[U]*V})}return O}function wB(e,t){t===void 0&&(t={});var n=t,r=n.placement,o=n.boundary,s=n.rootBoundary,i=n.padding,l=n.flipVariations,u=n.allowedAutoPlacements,p=u===void 0?x3:u,m=Cc(r),h=m?l?xS:xS.filter(function(y){return Cc(y)===m}):Rd,g=h.filter(function(y){return p.indexOf(y)>=0});g.length===0&&(g=h);var x=g.reduce(function(y,b){return y[b]=ed(e,{placement:b,boundary:o,rootBoundary:s,padding:i})[Cs(b)],y},{});return Object.keys(x).sort(function(y,b){return x[y]-x[b]})}function SB(e){if(Cs(e)===Mb)return[];var t=Np(e);return[CS(e),t,CS(t)]}function kB(e){var t=e.state,n=e.options,r=e.name;if(!t.modifiersData[r]._skip){for(var o=n.mainAxis,s=o===void 0?!0:o,i=n.altAxis,l=i===void 0?!0:i,u=n.fallbackPlacements,p=n.padding,m=n.boundary,h=n.rootBoundary,g=n.altBoundary,x=n.flipVariations,y=x===void 0?!0:x,b=n.allowedAutoPlacements,w=t.options.placement,S=Cs(w),j=S===w,_=u||(j||!y?[Np(w)]:SB(w)),E=[w].concat(_).reduce(function(re,G){return re.concat(Cs(G)===Mb?wB(t,{placement:G,boundary:m,rootBoundary:h,padding:p,flipVariations:y,allowedAutoPlacements:b}):G)},[]),I=t.rects.reference,M=t.rects.popper,R=new Map,D=!0,A=E[0],O=0;O=0,U=V?"width":"height",N=ed(t,{placement:T,boundary:m,rootBoundary:h,altBoundary:g,padding:p}),$=V?B?jo:Ar:B?ko:Dr;I[U]>M[U]&&($=Np($));var q=Np($),F=[];if(s&&F.push(N[X]<=0),l&&F.push(N[$]<=0,N[q]<=0),F.every(function(re){return re})){A=T,D=!1;break}R.set(T,F)}if(D)for(var Q=y?3:1,Y=function(G){var K=E.find(function(ee){var le=R.get(ee);if(le)return le.slice(0,G).every(function(J){return J})});if(K)return A=K,"break"},se=Q;se>0;se--){var ae=Y(se);if(ae==="break")break}t.placement!==A&&(t.modifiersData[r]._skip=!0,t.placement=A,t.reset=!0)}}const jB={name:"flip",enabled:!0,phase:"main",fn:kB,requiresIfExists:["offset"],data:{_skip:!1}};function SS(e,t,n){return n===void 0&&(n={x:0,y:0}),{top:e.top-t.height-n.y,right:e.right-t.width+n.x,bottom:e.bottom-t.height+n.y,left:e.left-t.width-n.x}}function kS(e){return[Dr,jo,ko,Ar].some(function(t){return e[t]>=0})}function _B(e){var t=e.state,n=e.name,r=t.rects.reference,o=t.rects.popper,s=t.modifiersData.preventOverflow,i=ed(t,{elementContext:"reference"}),l=ed(t,{altBoundary:!0}),u=SS(i,r),p=SS(l,o,s),m=kS(u),h=kS(p);t.modifiersData[n]={referenceClippingOffsets:u,popperEscapeOffsets:p,isReferenceHidden:m,hasPopperEscaped:h},t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-reference-hidden":m,"data-popper-escaped":h})}const IB={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:_B};function PB(e,t,n){var r=Cs(e),o=[Ar,Dr].indexOf(r)>=0?-1:1,s=typeof n=="function"?n(Object.assign({},t,{placement:e})):n,i=s[0],l=s[1];return i=i||0,l=(l||0)*o,[Ar,jo].indexOf(r)>=0?{x:l,y:i}:{x:i,y:l}}function EB(e){var t=e.state,n=e.options,r=e.name,o=n.offset,s=o===void 0?[0,0]:o,i=x3.reduce(function(m,h){return m[h]=PB(h,t.rects,s),m},{}),l=i[t.placement],u=l.x,p=l.y;t.modifiersData.popperOffsets!=null&&(t.modifiersData.popperOffsets.x+=u,t.modifiersData.popperOffsets.y+=p),t.modifiersData[r]=i}const MB={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:EB};function OB(e){var t=e.state,n=e.name;t.modifiersData[n]=j3({reference:t.rects.reference,element:t.rects.popper,strategy:"absolute",placement:t.placement})}const RB={name:"popperOffsets",enabled:!0,phase:"read",fn:OB,data:{}};function DB(e){return e==="x"?"y":"x"}function AB(e){var t=e.state,n=e.options,r=e.name,o=n.mainAxis,s=o===void 0?!0:o,i=n.altAxis,l=i===void 0?!1:i,u=n.boundary,p=n.rootBoundary,m=n.altBoundary,h=n.padding,g=n.tether,x=g===void 0?!0:g,y=n.tetherOffset,b=y===void 0?0:y,w=ed(t,{boundary:u,rootBoundary:p,padding:h,altBoundary:m}),S=Cs(t.placement),j=Cc(t.placement),_=!j,E=Db(S),I=DB(E),M=t.modifiersData.popperOffsets,R=t.rects.reference,D=t.rects.popper,A=typeof b=="function"?b(Object.assign({},t.rects,{placement:t.placement})):b,O=typeof A=="number"?{mainAxis:A,altAxis:A}:Object.assign({mainAxis:0,altAxis:0},A),T=t.modifiersData.offset?t.modifiersData.offset[t.placement]:null,X={x:0,y:0};if(M){if(s){var B,V=E==="y"?Dr:Ar,U=E==="y"?ko:jo,N=E==="y"?"height":"width",$=M[E],q=$+w[V],F=$-w[U],Q=x?-D[N]/2:0,Y=j===xc?R[N]:D[N],se=j===xc?-D[N]:-R[N],ae=t.elements.arrow,re=x&&ae?Rb(ae):{width:0,height:0},G=t.modifiersData["arrow#persistent"]?t.modifiersData["arrow#persistent"].padding:C3(),K=G[V],ee=G[U],le=Fu(0,R[N],re[N]),J=_?R[N]/2-Q-le-K-O.mainAxis:Y-le-K-O.mainAxis,ie=_?-R[N]/2+Q+le+ee+O.mainAxis:se+le+ee+O.mainAxis,de=t.elements.arrow&&Dd(t.elements.arrow),ge=de?E==="y"?de.clientTop||0:de.clientLeft||0:0,Ce=(B=T==null?void 0:T[E])!=null?B:0,he=$+J-Ce-ge,fe=$+ie-Ce,Oe=Fu(x?lm(q,he):q,$,x?Di(F,fe):F);M[E]=Oe,X[E]=Oe-$}if(l){var _e,Ne=E==="x"?Dr:Ar,nt=E==="x"?ko:jo,$e=M[I],Pt=I==="y"?"height":"width",Ze=$e+w[Ne],ot=$e-w[nt],ye=[Dr,Ar].indexOf(S)!==-1,De=(_e=T==null?void 0:T[I])!=null?_e:0,ut=ye?Ze:$e-R[Pt]-D[Pt]-De+O.altAxis,bt=ye?$e+R[Pt]+D[Pt]-De-O.altAxis:ot,be=x&&ye?oB(ut,$e,bt):Fu(x?ut:Ze,$e,x?bt:ot);M[I]=be,X[I]=be-$e}t.modifiersData[r]=X}}const TB={name:"preventOverflow",enabled:!0,phase:"main",fn:AB,requiresIfExists:["offset"]};function NB(e){return{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}}function $B(e){return e===no(e)||!wo(e)?Ab(e):NB(e)}function LB(e){var t=e.getBoundingClientRect(),n=bc(t.width)/e.offsetWidth||1,r=bc(t.height)/e.offsetHeight||1;return n!==1||r!==1}function zB(e,t,n){n===void 0&&(n=!1);var r=wo(t),o=wo(t)&&LB(t),s=si(t),i=yc(e,o,n),l={scrollLeft:0,scrollTop:0},u={x:0,y:0};return(r||!r&&!n)&&((ws(t)!=="body"||Nb(s))&&(l=$B(t)),wo(t)?(u=yc(t,!0),u.x+=t.clientLeft,u.y+=t.clientTop):s&&(u.x=Tb(s))),{x:i.left+l.scrollLeft-u.x,y:i.top+l.scrollTop-u.y,width:i.width,height:i.height}}function FB(e){var t=new Map,n=new Set,r=[];e.forEach(function(s){t.set(s.name,s)});function o(s){n.add(s.name);var i=[].concat(s.requires||[],s.requiresIfExists||[]);i.forEach(function(l){if(!n.has(l)){var u=t.get(l);u&&o(u)}}),r.push(s)}return e.forEach(function(s){n.has(s.name)||o(s)}),r}function BB(e){var t=FB(e);return ZF.reduce(function(n,r){return n.concat(t.filter(function(o){return o.phase===r}))},[])}function HB(e){var t;return function(){return t||(t=new Promise(function(n){Promise.resolve().then(function(){t=void 0,n(e())})})),t}}function VB(e){var t=e.reduce(function(n,r){var o=n[r.name];return n[r.name]=o?Object.assign({},o,r,{options:Object.assign({},o.options,r.options),data:Object.assign({},o.data,r.data)}):r,n},{});return Object.keys(t).map(function(n){return t[n]})}var jS={placement:"bottom",modifiers:[],strategy:"absolute"};function _S(){for(var e=arguments.length,t=new Array(e),n=0;n{}),_=d.useCallback(()=>{var O;!t||!y.current||!b.current||((O=j.current)==null||O.call(j),w.current=GB(y.current,b.current,{placement:S,modifiers:[$F,AF,DF,{...RF,enabled:!!g},{name:"eventListeners",...OF(i)},{name:"arrow",options:{padding:s}},{name:"offset",options:{offset:l??[0,u]}},{name:"flip",enabled:!!p,options:{padding:8}},{name:"preventOverflow",enabled:!!h,options:{boundary:m}},...n??[]],strategy:o}),w.current.forceUpdate(),j.current=w.current.destroy)},[S,t,n,g,i,s,l,u,p,h,m,o]);d.useEffect(()=>()=>{var O;!y.current&&!b.current&&((O=w.current)==null||O.destroy(),w.current=null)},[]);const E=d.useCallback(O=>{y.current=O,_()},[_]),I=d.useCallback((O={},T=null)=>({...O,ref:It(E,T)}),[E]),M=d.useCallback(O=>{b.current=O,_()},[_]),R=d.useCallback((O={},T=null)=>({...O,ref:It(M,T),style:{...O.style,position:o,minWidth:g?void 0:"max-content",inset:"0 auto auto 0"}}),[o,M,g]),D=d.useCallback((O={},T=null)=>{const{size:X,shadowColor:B,bg:V,style:U,...N}=O;return{...N,ref:T,"data-popper-arrow":"",style:KB(O)}},[]),A=d.useCallback((O={},T=null)=>({...O,ref:T,"data-popper-arrow-inner":""}),[]);return{update(){var O;(O=w.current)==null||O.update()},forceUpdate(){var O;(O=w.current)==null||O.forceUpdate()},transformOrigin:Nn.transformOrigin.varRef,referenceRef:E,popperRef:M,getPopperProps:R,getArrowProps:D,getArrowInnerProps:A,getReferenceProps:I}}function KB(e){const{size:t,shadowColor:n,bg:r,style:o}=e,s={...o,position:"absolute"};return t&&(s["--popper-arrow-size"]=t),n&&(s["--popper-arrow-shadow-color"]=n),r&&(s["--popper-arrow-bg"]=r),s}function Lb(e={}){const{onClose:t,onOpen:n,isOpen:r,id:o}=e,s=un(n),i=un(t),[l,u]=d.useState(e.defaultIsOpen||!1),p=r!==void 0?r:l,m=r!==void 0,h=d.useId(),g=o??`disclosure-${h}`,x=d.useCallback(()=>{m||u(!1),i==null||i()},[m,i]),y=d.useCallback(()=>{m||u(!0),s==null||s()},[m,s]),b=d.useCallback(()=>{p?x():y()},[p,y,x]);function w(j={}){return{...j,"aria-expanded":p,"aria-controls":g,onClick(_){var E;(E=j.onClick)==null||E.call(j,_),b()}}}function S(j={}){return{...j,hidden:!p,id:g}}return{isOpen:p,onOpen:y,onClose:x,onToggle:b,isControlled:m,getButtonProps:w,getDisclosureProps:S}}function qB(e){const{ref:t,handler:n,enabled:r=!0}=e,o=un(n),i=d.useRef({isPointerDown:!1,ignoreEmulatedMouseEvents:!1}).current;d.useEffect(()=>{if(!r)return;const l=h=>{fv(h,t)&&(i.isPointerDown=!0)},u=h=>{if(i.ignoreEmulatedMouseEvents){i.ignoreEmulatedMouseEvents=!1;return}i.isPointerDown&&n&&fv(h,t)&&(i.isPointerDown=!1,o(h))},p=h=>{i.ignoreEmulatedMouseEvents=!0,n&&i.isPointerDown&&fv(h,t)&&(i.isPointerDown=!1,o(h))},m=_3(t.current);return m.addEventListener("mousedown",l,!0),m.addEventListener("mouseup",u,!0),m.addEventListener("touchstart",l,!0),m.addEventListener("touchend",p,!0),()=>{m.removeEventListener("mousedown",l,!0),m.removeEventListener("mouseup",u,!0),m.removeEventListener("touchstart",l,!0),m.removeEventListener("touchend",p,!0)}},[n,t,o,i,r])}function fv(e,t){var n;const r=e.target;return r&&!_3(r).contains(r)?!1:!((n=t.current)!=null&&n.contains(r))}function _3(e){var t;return(t=e==null?void 0:e.ownerDocument)!=null?t:document}function I3(e){const{isOpen:t,ref:n}=e,[r,o]=d.useState(t),[s,i]=d.useState(!1);return d.useEffect(()=>{s||(o(t),i(!0))},[t,s,r]),Ri(()=>n.current,"animationend",()=>{o(t)}),{present:!(t?!1:!r),onComplete(){var u;const p=Zz(n.current),m=new p.CustomEvent("animationend",{bubbles:!0});(u=n.current)==null||u.dispatchEvent(m)}}}function zb(e){const{wasSelected:t,enabled:n,isSelected:r,mode:o="unmount"}=e;return!!(!n||r||o==="keepMounted"&&t)}var[XB,QB,YB,ZB]=lb(),[JB,Ad]=Wt({strict:!1,name:"MenuContext"});function eH(e,...t){const n=d.useId(),r=e||n;return d.useMemo(()=>t.map(o=>`${o}-${r}`),[r,t])}function P3(e){var t;return(t=e==null?void 0:e.ownerDocument)!=null?t:document}function IS(e){return P3(e).activeElement===e}function tH(e={}){const{id:t,closeOnSelect:n=!0,closeOnBlur:r=!0,initialFocusRef:o,autoSelect:s=!0,isLazy:i,isOpen:l,defaultIsOpen:u,onClose:p,onOpen:m,placement:h="bottom-start",lazyBehavior:g="unmount",direction:x,computePositionOnMount:y=!1,...b}=e,w=d.useRef(null),S=d.useRef(null),j=YB(),_=d.useCallback(()=>{requestAnimationFrame(()=>{var ae;(ae=w.current)==null||ae.focus({preventScroll:!1})})},[]),E=d.useCallback(()=>{const ae=setTimeout(()=>{var re;if(o)(re=o.current)==null||re.focus();else{const G=j.firstEnabled();G&&B(G.index)}});q.current.add(ae)},[j,o]),I=d.useCallback(()=>{const ae=setTimeout(()=>{const re=j.lastEnabled();re&&B(re.index)});q.current.add(ae)},[j]),M=d.useCallback(()=>{m==null||m(),s?E():_()},[s,E,_,m]),{isOpen:R,onOpen:D,onClose:A,onToggle:O}=Lb({isOpen:l,defaultIsOpen:u,onClose:p,onOpen:M});qB({enabled:R&&r,ref:w,handler:ae=>{var re;(re=S.current)!=null&&re.contains(ae.target)||A()}});const T=$b({...b,enabled:R||y,placement:h,direction:x}),[X,B]=d.useState(-1);pa(()=>{R||B(-1)},[R]),g3(w,{focusRef:S,visible:R,shouldFocus:!0});const V=I3({isOpen:R,ref:w}),[U,N]=eH(t,"menu-button","menu-list"),$=d.useCallback(()=>{D(),_()},[D,_]),q=d.useRef(new Set([]));lH(()=>{q.current.forEach(ae=>clearTimeout(ae)),q.current.clear()});const F=d.useCallback(()=>{D(),E()},[E,D]),Q=d.useCallback(()=>{D(),I()},[D,I]),Y=d.useCallback(()=>{var ae,re;const G=P3(w.current),K=(ae=w.current)==null?void 0:ae.contains(G.activeElement);if(!(R&&!K))return;const le=(re=j.item(X))==null?void 0:re.node;le==null||le.focus()},[R,X,j]),se=d.useRef(null);return{openAndFocusMenu:$,openAndFocusFirstItem:F,openAndFocusLastItem:Q,onTransitionEnd:Y,unstable__animationState:V,descendants:j,popper:T,buttonId:U,menuId:N,forceUpdate:T.forceUpdate,orientation:"vertical",isOpen:R,onToggle:O,onOpen:D,onClose:A,menuRef:w,buttonRef:S,focusedIndex:X,closeOnSelect:n,closeOnBlur:r,autoSelect:s,setFocusedIndex:B,isLazy:i,lazyBehavior:g,initialFocusRef:o,rafId:se}}function nH(e={},t=null){const n=Ad(),{onToggle:r,popper:o,openAndFocusFirstItem:s,openAndFocusLastItem:i}=n,l=d.useCallback(u=>{const p=u.key,h={Enter:s,ArrowDown:s,ArrowUp:i}[p];h&&(u.preventDefault(),u.stopPropagation(),h(u))},[s,i]);return{...e,ref:It(n.buttonRef,t,o.referenceRef),id:n.buttonId,"data-active":dt(n.isOpen),"aria-expanded":n.isOpen,"aria-haspopup":"menu","aria-controls":n.menuId,onClick:He(e.onClick,r),onKeyDown:He(e.onKeyDown,l)}}function $1(e){var t;return aH(e)&&!!((t=e==null?void 0:e.getAttribute("role"))!=null&&t.startsWith("menuitem"))}function rH(e={},t=null){const n=Ad();if(!n)throw new Error("useMenuContext: context is undefined. Seems you forgot to wrap component within ");const{focusedIndex:r,setFocusedIndex:o,menuRef:s,isOpen:i,onClose:l,menuId:u,isLazy:p,lazyBehavior:m,unstable__animationState:h}=n,g=QB(),x=CF({preventDefault:S=>S.key!==" "&&$1(S.target)}),y=d.useCallback(S=>{if(!S.currentTarget.contains(S.target))return;const j=S.key,E={Tab:M=>M.preventDefault(),Escape:l,ArrowDown:()=>{const M=g.nextEnabled(r);M&&o(M.index)},ArrowUp:()=>{const M=g.prevEnabled(r);M&&o(M.index)}}[j];if(E){S.preventDefault(),E(S);return}const I=x(M=>{const R=wF(g.values(),M,D=>{var A,O;return(O=(A=D==null?void 0:D.node)==null?void 0:A.textContent)!=null?O:""},g.item(r));if(R){const D=g.indexOf(R.node);o(D)}});$1(S.target)&&I(S)},[g,r,x,l,o]),b=d.useRef(!1);i&&(b.current=!0);const w=zb({wasSelected:b.current,enabled:p,mode:m,isSelected:h.present});return{...e,ref:It(s,t),children:w?e.children:null,tabIndex:-1,role:"menu",id:u,style:{...e.style,transformOrigin:"var(--popper-transform-origin)"},"aria-orientation":"vertical",onKeyDown:He(e.onKeyDown,y)}}function oH(e={}){const{popper:t,isOpen:n}=Ad();return t.getPopperProps({...e,style:{visibility:n?"visible":"hidden",...e.style}})}function sH(e={},t=null){const{onMouseEnter:n,onMouseMove:r,onMouseLeave:o,onClick:s,onFocus:i,isDisabled:l,isFocusable:u,closeOnSelect:p,type:m,...h}=e,g=Ad(),{setFocusedIndex:x,focusedIndex:y,closeOnSelect:b,onClose:w,menuRef:S,isOpen:j,menuId:_,rafId:E}=g,I=d.useRef(null),M=`${_}-menuitem-${d.useId()}`,{index:R,register:D}=ZB({disabled:l&&!u}),A=d.useCallback($=>{n==null||n($),!l&&x(R)},[x,R,l,n]),O=d.useCallback($=>{r==null||r($),I.current&&!IS(I.current)&&A($)},[A,r]),T=d.useCallback($=>{o==null||o($),!l&&x(-1)},[x,l,o]),X=d.useCallback($=>{s==null||s($),$1($.currentTarget)&&(p??b)&&w()},[w,s,b,p]),B=d.useCallback($=>{i==null||i($),x(R)},[x,i,R]),V=R===y,U=l&&!u;pa(()=>{j&&(V&&!U&&I.current?(E.current&&cancelAnimationFrame(E.current),E.current=requestAnimationFrame(()=>{var $;($=I.current)==null||$.focus(),E.current=null})):S.current&&!IS(S.current)&&S.current.focus({preventScroll:!0}))},[V,U,S,j]);const N=h3({onClick:X,onFocus:B,onMouseEnter:A,onMouseMove:O,onMouseLeave:T,ref:It(D,I,t),isDisabled:l,isFocusable:u});return{...h,...N,type:m??N.type,id:M,role:"menuitem",tabIndex:V?0:-1}}function aH(e){var t;if(!iH(e))return!1;const n=(t=e.ownerDocument.defaultView)!=null?t:window;return e instanceof n.HTMLElement}function iH(e){return e!=null&&typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.ELEMENT_NODE}function lH(e,t=[]){return d.useEffect(()=>()=>e(),t)}var[cH,$c]=Wt({name:"MenuStylesContext",errorMessage:`useMenuStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),Ah=e=>{const{children:t}=e,n=Un("Menu",e),r=on(e),{direction:o}=bd(),{descendants:s,...i}=tH({...r,direction:o}),l=d.useMemo(()=>i,[i]),{isOpen:u,onClose:p,forceUpdate:m}=l;return a.jsx(XB,{value:s,children:a.jsx(JB,{value:l,children:a.jsx(cH,{value:n,children:zx(t,{isOpen:u,onClose:p,forceUpdate:m})})})})};Ah.displayName="Menu";var E3=ke((e,t)=>{const n=$c();return a.jsx(we.span,{ref:t,...e,__css:n.command,className:"chakra-menu__command"})});E3.displayName="MenuCommand";var uH=ke((e,t)=>{const{type:n,...r}=e,o=$c(),s=r.as||n?n??void 0:"button",i=d.useMemo(()=>({textDecoration:"none",color:"inherit",userSelect:"none",display:"flex",width:"100%",alignItems:"center",textAlign:"start",flex:"0 0 auto",outline:0,...o.item}),[o.item]);return a.jsx(we.button,{ref:t,type:s,...r,__css:i})}),M3=e=>{const{className:t,children:n,...r}=e,o=$c(),s=d.Children.only(n),i=d.isValidElement(s)?d.cloneElement(s,{focusable:"false","aria-hidden":!0,className:Ye("chakra-menu__icon",s.props.className)}):null,l=Ye("chakra-menu__icon-wrapper",t);return a.jsx(we.span,{className:l,...r,__css:o.icon,children:i})};M3.displayName="MenuIcon";var en=ke((e,t)=>{const{icon:n,iconSpacing:r="0.75rem",command:o,commandSpacing:s="0.75rem",children:i,...l}=e,u=sH(l,t),m=n||o?a.jsx("span",{style:{pointerEvents:"none",flex:1},children:i}):i;return a.jsxs(uH,{...u,className:Ye("chakra-menu__menuitem",u.className),children:[n&&a.jsx(M3,{fontSize:"0.8em",marginEnd:r,children:n}),m,o&&a.jsx(E3,{marginStart:s,children:o})]})});en.displayName="MenuItem";var dH={enter:{visibility:"visible",opacity:1,scale:1,transition:{duration:.2,ease:[.4,0,.2,1]}},exit:{transitionEnd:{visibility:"hidden"},opacity:0,scale:.8,transition:{duration:.1,easings:"easeOut"}}},fH=we(In.div),Ui=ke(function(t,n){var r,o;const{rootProps:s,motionProps:i,...l}=t,{isOpen:u,onTransitionEnd:p,unstable__animationState:m}=Ad(),h=rH(l,n),g=oH(s),x=$c();return a.jsx(we.div,{...g,__css:{zIndex:(o=t.zIndex)!=null?o:(r=x.list)==null?void 0:r.zIndex},children:a.jsx(fH,{variants:dH,initial:!1,animate:u?"enter":"exit",__css:{outline:0,...x.list},...i,className:Ye("chakra-menu__menu-list",h.className),...h,onUpdate:p,onAnimationComplete:ph(m.onComplete,h.onAnimationComplete)})})});Ui.displayName="MenuList";var td=ke((e,t)=>{const{title:n,children:r,className:o,...s}=e,i=Ye("chakra-menu__group__title",o),l=$c();return a.jsxs("div",{ref:t,className:"chakra-menu__group",role:"group",children:[n&&a.jsx(we.p,{className:i,...s,__css:l.groupTitle,children:n}),r]})});td.displayName="MenuGroup";var pH=ke((e,t)=>{const n=$c();return a.jsx(we.button,{ref:t,...e,__css:{display:"inline-flex",appearance:"none",alignItems:"center",outline:0,...n.button}})}),Th=ke((e,t)=>{const{children:n,as:r,...o}=e,s=nH(o,t),i=r||pH;return a.jsx(i,{...s,className:Ye("chakra-menu__menu-button",e.className),children:a.jsx(we.span,{__css:{pointerEvents:"none",flex:"1 1 auto",minW:0},children:e.children})})});Th.displayName="MenuButton";var mH={slideInBottom:{...w1,custom:{offsetY:16,reverse:!0}},slideInRight:{...w1,custom:{offsetX:16,reverse:!0}},scale:{...i5,custom:{initialScale:.95,reverse:!0}},none:{}},hH=we(In.section),gH=e=>mH[e||"none"],O3=d.forwardRef((e,t)=>{const{preset:n,motionProps:r=gH(n),...o}=e;return a.jsx(hH,{ref:t,...r,...o})});O3.displayName="ModalTransition";var vH=Object.defineProperty,xH=(e,t,n)=>t in e?vH(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,bH=(e,t,n)=>(xH(e,typeof t!="symbol"?t+"":t,n),n),yH=class{constructor(){bH(this,"modals"),this.modals=new Map}add(e){return this.modals.set(e,this.modals.size+1),this.modals.size}remove(e){this.modals.delete(e)}isTopModal(e){return e?this.modals.get(e)===this.modals.size:!1}},L1=new yH;function R3(e,t){const[n,r]=d.useState(0);return d.useEffect(()=>{const o=e.current;if(o){if(t){const s=L1.add(o);r(s)}return()=>{L1.remove(o),r(0)}}},[t,e]),n}var CH=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Dl=new WeakMap,ep=new WeakMap,tp={},pv=0,D3=function(e){return e&&(e.host||D3(e.parentNode))},wH=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=D3(n);return r&&e.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},SH=function(e,t,n,r){var o=wH(t,Array.isArray(e)?e:[e]);tp[n]||(tp[n]=new WeakMap);var s=tp[n],i=[],l=new Set,u=new Set(o),p=function(h){!h||l.has(h)||(l.add(h),p(h.parentNode))};o.forEach(p);var m=function(h){!h||u.has(h)||Array.prototype.forEach.call(h.children,function(g){if(l.has(g))m(g);else{var x=g.getAttribute(r),y=x!==null&&x!=="false",b=(Dl.get(g)||0)+1,w=(s.get(g)||0)+1;Dl.set(g,b),s.set(g,w),i.push(g),b===1&&y&&ep.set(g,!0),w===1&&g.setAttribute(n,"true"),y||g.setAttribute(r,"true")}})};return m(t),l.clear(),pv++,function(){i.forEach(function(h){var g=Dl.get(h)-1,x=s.get(h)-1;Dl.set(h,g),s.set(h,x),g||(ep.has(h)||h.removeAttribute(r),ep.delete(h)),x||h.removeAttribute(n)}),pv--,pv||(Dl=new WeakMap,Dl=new WeakMap,ep=new WeakMap,tp={})}},kH=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),o=t||CH(e);return o?(r.push.apply(r,Array.from(o.querySelectorAll("[aria-live]"))),SH(r,o,n,"aria-hidden")):function(){return null}};function jH(e){const{isOpen:t,onClose:n,id:r,closeOnOverlayClick:o=!0,closeOnEsc:s=!0,useInert:i=!0,onOverlayClick:l,onEsc:u}=e,p=d.useRef(null),m=d.useRef(null),[h,g,x]=IH(r,"chakra-modal","chakra-modal--header","chakra-modal--body");_H(p,t&&i);const y=R3(p,t),b=d.useRef(null),w=d.useCallback(A=>{b.current=A.target},[]),S=d.useCallback(A=>{A.key==="Escape"&&(A.stopPropagation(),s&&(n==null||n()),u==null||u())},[s,n,u]),[j,_]=d.useState(!1),[E,I]=d.useState(!1),M=d.useCallback((A={},O=null)=>({role:"dialog",...A,ref:It(O,p),id:h,tabIndex:-1,"aria-modal":!0,"aria-labelledby":j?g:void 0,"aria-describedby":E?x:void 0,onClick:He(A.onClick,T=>T.stopPropagation())}),[x,E,h,g,j]),R=d.useCallback(A=>{A.stopPropagation(),b.current===A.target&&L1.isTopModal(p.current)&&(o&&(n==null||n()),l==null||l())},[n,o,l]),D=d.useCallback((A={},O=null)=>({...A,ref:It(O,m),onClick:He(A.onClick,R),onKeyDown:He(A.onKeyDown,S),onMouseDown:He(A.onMouseDown,w)}),[S,w,R]);return{isOpen:t,onClose:n,headerId:g,bodyId:x,setBodyMounted:I,setHeaderMounted:_,dialogRef:p,overlayRef:m,getDialogProps:M,getDialogContainerProps:D,index:y}}function _H(e,t){const n=e.current;d.useEffect(()=>{if(!(!e.current||!t))return kH(e.current)},[t,e,n])}function IH(e,...t){const n=d.useId(),r=e||n;return d.useMemo(()=>t.map(o=>`${o}-${r}`),[r,t])}var[PH,Lc]=Wt({name:"ModalStylesContext",errorMessage:`useModalStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),[EH,Gi]=Wt({strict:!0,name:"ModalContext",errorMessage:"useModalContext: `context` is undefined. Seems you forgot to wrap modal components in ``"}),Ki=e=>{const t={scrollBehavior:"outside",autoFocus:!0,trapFocus:!0,returnFocusOnClose:!0,blockScrollOnMount:!0,allowPinchZoom:!1,motionPreset:"scale",lockFocusAcrossFrames:!0,...e},{portalProps:n,children:r,autoFocus:o,trapFocus:s,initialFocusRef:i,finalFocusRef:l,returnFocusOnClose:u,blockScrollOnMount:p,allowPinchZoom:m,preserveScrollBarGap:h,motionPreset:g,lockFocusAcrossFrames:x,onCloseComplete:y}=t,b=Un("Modal",t),S={...jH(t),autoFocus:o,trapFocus:s,initialFocusRef:i,finalFocusRef:l,returnFocusOnClose:u,blockScrollOnMount:p,allowPinchZoom:m,preserveScrollBarGap:h,motionPreset:g,lockFocusAcrossFrames:x};return a.jsx(EH,{value:S,children:a.jsx(PH,{value:b,children:a.jsx(dr,{onExitComplete:y,children:S.isOpen&&a.jsx(Ac,{...n,children:r})})})})};Ki.displayName="Modal";var $p="right-scroll-bar-position",Lp="width-before-scroll-bar",MH="with-scroll-bars-hidden",OH="--removed-body-scroll-bar-size",A3=M5(),mv=function(){},Nh=d.forwardRef(function(e,t){var n=d.useRef(null),r=d.useState({onScrollCapture:mv,onWheelCapture:mv,onTouchMoveCapture:mv}),o=r[0],s=r[1],i=e.forwardProps,l=e.children,u=e.className,p=e.removeScrollBar,m=e.enabled,h=e.shards,g=e.sideCar,x=e.noIsolation,y=e.inert,b=e.allowPinchZoom,w=e.as,S=w===void 0?"div":w,j=e.gapMode,_=I5(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noIsolation","inert","allowPinchZoom","as","gapMode"]),E=g,I=_5([n,t]),M=gs(gs({},_),o);return d.createElement(d.Fragment,null,m&&d.createElement(E,{sideCar:A3,removeScrollBar:p,shards:h,noIsolation:x,inert:y,setCallbacks:s,allowPinchZoom:!!b,lockRef:n,gapMode:j}),i?d.cloneElement(d.Children.only(l),gs(gs({},M),{ref:I})):d.createElement(S,gs({},M,{className:u,ref:I}),l))});Nh.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Nh.classNames={fullWidth:Lp,zeroRight:$p};var PS,RH=function(){if(PS)return PS;if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function DH(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=RH();return t&&e.setAttribute("nonce",t),e}function AH(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function TH(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var NH=function(){var e=0,t=null;return{add:function(n){e==0&&(t=DH())&&(AH(t,n),TH(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},$H=function(){var e=NH();return function(t,n){d.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},T3=function(){var e=$H(),t=function(n){var r=n.styles,o=n.dynamic;return e(r,o),null};return t},LH={left:0,top:0,right:0,gap:0},hv=function(e){return parseInt(e||"",10)||0},zH=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],r=t[e==="padding"?"paddingTop":"marginTop"],o=t[e==="padding"?"paddingRight":"marginRight"];return[hv(n),hv(r),hv(o)]},FH=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return LH;var t=zH(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},BH=T3(),HH=function(e,t,n,r){var o=e.left,s=e.top,i=e.right,l=e.gap;return n===void 0&&(n="margin"),` - .`.concat(MH,` { +import{a as Dc,b as W_,S as U_,c as G_,d as K_,e as o1,f as q_,i as s1,g as vR,h as xR,j as bR,k as yR,l as X_,m as CR,n as YC,o as Q_,t as wR,p as SR,q as kR,r as jR,s as _R,u as IR,v as d,w as a,x as $x,y as qp,z as PR,A as ER,B as MR,C as OR,P as RR,D as Lx,E as DR,F as AR,G as TR,H as NR,I as Y_,J as je,K as Nn,L as $R,M as LR,N as zR,O as Wt,Q as we,R as Ye,T as dn,U as He,V as vd,W as dr,X as In,Y as Un,Z as on,_ as fa,$ as oi,a0 as dt,a1 as Co,a2 as rc,a3 as pa,a4 as ma,a5 as ph,a6 as zx,a7 as xd,a8 as mn,a9 as FR,aa as H,ab as ZC,ac as BR,ad as Z_,ae as a1,af as bd,ag as Ac,ah as HR,ai as J_,aj as eI,ak as tI,al as Ho,am as VR,an as le,ao as xe,ap as Ft,aq as W,ar as WR,as as JC,at as UR,au as GR,av as KR,aw as si,ax as te,ay as qR,az as ct,aA as Qt,aB as Ie,aC as L,aD as cr,aE as Jn,aF as Se,aG as Z,aH as nI,aI as XR,aJ as QR,aK as YR,aL as ZR,aM as qr,aN as Fx,aO as ha,aP as Nr,aQ as yd,aR as JR,aS as eD,aT as ew,aU as Bx,aV as ve,aW as Xr,aX as tD,aY as rI,aZ as oI,a_ as tw,a$ as nD,b0 as rD,b1 as oD,b2 as ga,b3 as Hx,b4 as yt,b5 as sD,b6 as aD,b7 as sI,b8 as aI,b9 as mh,ba as iD,bb as nw,bc as iI,bd as lD,be as cD,bf as uD,bg as dD,bh as fD,bi as pD,bj as mD,bk as lI,bl as hD,bm as gD,bn as vD,bo as xD,bp as bD,bq as va,br as vc,bs as yD,bt as $r,bu as CD,bv as wD,bw as SD,bx as rw,by as kD,bz as jD,bA as Zs,bB as hh,bC as cI,bD as uI,bE as to,bF as dI,bG as _D,bH as Bi,bI as Mu,bJ as ow,bK as ID,bL as PD,bM as ED,bN as qf,bO as Xf,bP as bu,bQ as Q0,bR as Nu,bS as $u,bT as Lu,bU as zu,bV as sw,bW as Xp,bX as Y0,bY as Qp,bZ as aw,b_ as i1,b$ as Z0,c0 as l1,c1 as J0,c2 as Yp,c3 as iw,c4 as Hi,c5 as lw,c6 as Vi,c7 as cw,c8 as Zp,c9 as Cd,ca as MD,cb as fI,cc as uw,cd as gh,ce as OD,cf as c1,cg as dw,ch as Fr,ci as Ta,cj as fw,ck as Vx,cl as RD,cm as DD,cn as ev,co as pw,cp as u1,cq as vh,cr as AD,cs as pI,ct as d1,cu as f1,cv as mI,cw as TD,cx as p1,cy as ND,cz as m1,cA as $D,cB as h1,cC as LD,cD as zD,cE as FD,cF as Wx,cG as Ux,cH as Gx,cI as Kx,cJ as qx,cK as xh,cL as Xx,cM as Xs,cN as hI,cO as gI,cP as Qx,cQ as vI,cR as BD,cS as yu,cT as sa,cU as xI,cV as bI,cW as mw,cX as Yx,cY as yI,cZ as Zx,c_ as Jx,c$ as CI,d0 as On,d1 as HD,d2 as Rn,d3 as bh,d4 as eb,d5 as wI,d6 as SI,d7 as VD,d8 as WD,d9 as UD,da as GD,db as KD,dc as qD,dd as XD,de as QD,df as YD,dg as ZD,dh as hw,di as tb,dj as JD,dk as eA,dl as wd,dm as tA,dn as nA,dp as yh,dq as rA,dr as oA,ds as sA,dt as aA,du as an,dv as iA,dw as lA,dx as cA,dy as uA,dz as dA,dA as fA,dB as Ku,dC as gw,dD as Xo,dE as kI,dF as pA,dG as nb,dH as mA,dI as vw,dJ as hA,dK as gA,dL as vA,dM as jI,dN as xA,dO as bA,dP as yA,dQ as CA,dR as wA,dS as SA,dT as kA,dU as _I,dV as jA,dW as _A,dX as xw,dY as IA,dZ as PA,d_ as EA,d$ as MA,e0 as OA,e1 as RA,e2 as DA,e3 as II,e4 as AA,e5 as TA,e6 as NA,e7 as bw,e8 as Qf,e9 as PI,ea as $A,eb as LA,ec as zA,ed as FA,ee as BA,ef as Vo,eg as HA,eh as VA,ei as WA,ej as UA,ek as GA,el as KA,em as qA,en as XA,eo as QA,ep as YA,eq as ZA,er as JA,es as eT,et as tT,eu as nT,ev as rT,ew as yw,ex as oT,ey as sT,ez as aT,eA as iT,eB as lT,eC as cT,eD as uT,eE as Cw,eF as ww,eG as EI,eH as dT,eI as zo,eJ as qu,eK as wr,eL as fT,eM as pT,eN as MI,eO as OI,eP as mT,eQ as Sw,eR as hT,eS as kw,eT as jw,eU as _w,eV as gT,eW as vT,eX as Iw,eY as Pw,eZ as xT,e_ as bT,e$ as Jp,f0 as yT,f1 as Ew,f2 as Mw,f3 as CT,f4 as wT,f5 as ST,f6 as RI,f7 as kT,f8 as jT,f9 as DI,fa as _T,fb as IT,fc as Ow,fd as PT,fe as Rw,ff as ET,fg as AI,fh as TI,fi as Sd,fj as NI,fk as Ei,fl as $I,fm as Dw,fn as MT,fo as OT,fp as LI,fq as RT,fr as DT,fs as AT,ft as TT,fu as NT,fv as rb,fw as g1,fx as Aw,fy as tl,fz as $T,fA as LT,fB as zT,fC as zI,fD as ob,fE as FI,fF as sb,fG as BI,fH as FT,fI as Ys,fJ as BT,fK as HI,fL as HT,fM as ab,fN as VI,fO as VT,fP as WT,fQ as UT,fR as GT,fS as KT,fT as qT,fU as XT,fV as em,fW as Ou,fX as Ql,fY as QT,fZ as YT,f_ as ZT,f$ as JT,g0 as eN,g1 as tN,g2 as nN,g3 as rN,g4 as Tw,g5 as oN,g6 as sN,g7 as aN,g8 as iN,g9 as lN,ga as cN,gb as Nw,gc as uN,gd as dN,ge as fN,gf as pN,gg as mN,gh as hN,gi as gN,gj as $w,gk as vN,gl as xN,gm as bN,gn as yN,go as CN,gp as wN,gq as SN,gr as kN,gs as jN,gt as _N,gu as IN,gv as PN,gw as EN,gx as MN,gy as kd,gz as ON,gA as RN,gB as DN,gC as AN,gD as TN,gE as NN,gF as $N,gG as LN,gH as Lw,gI as Tp,gJ as zN,gK as tm,gL as WI,gM as nm,gN as FN,gO as BN,gP as oc,gQ as UI,gR as GI,gS as ib,gT as HN,gU as VN,gV as WN,gW as v1,gX as KI,gY as UN,gZ as GN,g_ as qI,g$ as KN,h0 as qN,h1 as XN,h2 as QN,h3 as YN,h4 as zw,h5 as Ml,h6 as ZN,h7 as JN,h8 as e9,h9 as t9,ha as n9,hb as r9,hc as Fw,hd as o9,he as s9,hf as a9,hg as i9,hh as l9,hi as c9,hj as u9,hk as d9,hl as tv,hm as nv,hn as rv,ho as Yf,hp as Bw,hq as x1,hr as Hw,hs as f9,ht as p9,hu as m9,hv as h9,hw as XI,hx as g9,hy as v9,hz as x9,hA as b9,hB as y9,hC as C9,hD as w9,hE as S9,hF as k9,hG as j9,hH as _9,hI as Zf,hJ as ov,hK as I9,hL as P9,hM as E9,hN as M9,hO as O9,hP as R9,hQ as D9,hR as A9,hS as T9,hT as N9,hU as Vw,hV as Ww,hW as $9,hX as L9,hY as z9,hZ as F9,h_ as B9}from"./index-6f7e7659.js";import{u as QI,a as xa,b as H9,r as Re,f as V9,g as Uw,c as mt,d as Dn}from"./MantineProvider-2072a471.js";var W9=200;function U9(e,t,n,r){var o=-1,s=G_,i=!0,l=e.length,u=[],p=t.length;if(!l)return u;n&&(t=Dc(t,W_(n))),r?(s=K_,i=!1):t.length>=W9&&(s=o1,i=!1,t=new U_(t));e:for(;++o=120&&m.length>=120)?new U_(i&&m):void 0}m=e[0];var h=-1,g=l[0];e:for(;++h{r.has(s)&&n(o,s)})}function a$(e,t){if(e==null)return{};var n={},r=Object.keys(e),o,s;for(s=0;s=0)&&(n[o]=e[o]);return n}const YI=({id:e,x:t,y:n,width:r,height:o,style:s,color:i,strokeColor:l,strokeWidth:u,className:p,borderRadius:m,shapeRendering:h,onClick:g,selected:x})=>{const{background:y,backgroundColor:b}=s||{},w=i||y||b;return a.jsx("rect",{className:$x(["react-flow__minimap-node",{selected:x},p]),x:t,y:n,rx:m,ry:m,width:r,height:o,fill:w,stroke:l,strokeWidth:u,shapeRendering:h,onClick:g?S=>g(S,e):void 0})};YI.displayName="MiniMapNode";var i$=d.memo(YI);const l$=e=>e.nodeOrigin,c$=e=>e.getNodes().filter(t=>!t.hidden&&t.width&&t.height),sv=e=>e instanceof Function?e:()=>e;function u$({nodeStrokeColor:e="transparent",nodeColor:t="#e2e2e2",nodeClassName:n="",nodeBorderRadius:r=5,nodeStrokeWidth:o=2,nodeComponent:s=i$,onClick:i}){const l=qp(c$,Lx),u=qp(l$),p=sv(t),m=sv(e),h=sv(n),g=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return a.jsx(a.Fragment,{children:l.map(x=>{const{x:y,y:b}=PR(x,u).positionAbsolute;return a.jsx(s,{x:y,y:b,width:x.width,height:x.height,style:x.style,selected:x.selected,className:h(x),color:p(x),borderRadius:r,strokeColor:m(x),strokeWidth:o,shapeRendering:g,onClick:i,id:x.id},x.id)})})}var d$=d.memo(u$);const f$=200,p$=150,m$=e=>{const t=e.getNodes(),n={x:-e.transform[0]/e.transform[2],y:-e.transform[1]/e.transform[2],width:e.width/e.transform[2],height:e.height/e.transform[2]};return{viewBB:n,boundingRect:t.length>0?TR(NR(t,e.nodeOrigin),n):n,rfId:e.rfId}},h$="react-flow__minimap-desc";function ZI({style:e,className:t,nodeStrokeColor:n="transparent",nodeColor:r="#e2e2e2",nodeClassName:o="",nodeBorderRadius:s=5,nodeStrokeWidth:i=2,nodeComponent:l,maskColor:u="rgb(240, 240, 240, 0.6)",maskStrokeColor:p="none",maskStrokeWidth:m=1,position:h="bottom-right",onClick:g,onNodeClick:x,pannable:y=!1,zoomable:b=!1,ariaLabel:w="React Flow mini map",inversePan:S=!1,zoomStep:j=10,offsetScale:_=5}){const E=ER(),I=d.useRef(null),{boundingRect:M,viewBB:R,rfId:D}=qp(m$,Lx),A=(e==null?void 0:e.width)??f$,O=(e==null?void 0:e.height)??p$,T=M.width/A,X=M.height/O,B=Math.max(T,X),V=B*A,U=B*O,N=_*B,$=M.x-(V-M.width)/2-N,q=M.y-(U-M.height)/2-N,F=V+N*2,Q=U+N*2,Y=`${h$}-${D}`,se=d.useRef(0);se.current=B,d.useEffect(()=>{if(I.current){const G=MR(I.current),K=J=>{const{transform:ie,d3Selection:de,d3Zoom:ge}=E.getState();if(J.sourceEvent.type!=="wheel"||!de||!ge)return;const Ce=-J.sourceEvent.deltaY*(J.sourceEvent.deltaMode===1?.05:J.sourceEvent.deltaMode?1:.002)*j,he=ie[2]*Math.pow(2,Ce);ge.scaleTo(de,he)},ee=J=>{const{transform:ie,d3Selection:de,d3Zoom:ge,translateExtent:Ce,width:he,height:fe}=E.getState();if(J.sourceEvent.type!=="mousemove"||!de||!ge)return;const Oe=se.current*Math.max(1,ie[2])*(S?-1:1),_e={x:ie[0]-J.sourceEvent.movementX*Oe,y:ie[1]-J.sourceEvent.movementY*Oe},Ne=[[0,0],[he,fe]],nt=DR.translate(_e.x,_e.y).scale(ie[2]),$e=ge.constrain()(nt,Ne,Ce);ge.transform(de,$e)},ce=OR().on("zoom",y?ee:null).on("zoom.wheel",b?K:null);return G.call(ce),()=>{G.on("zoom",null)}}},[y,b,S,j]);const ae=g?G=>{const K=AR(G);g(G,{x:K[0],y:K[1]})}:void 0,re=x?(G,K)=>{const ee=E.getState().nodeInternals.get(K);x(G,ee)}:void 0;return a.jsx(RR,{position:h,style:e,className:$x(["react-flow__minimap",t]),"data-testid":"rf__minimap",children:a.jsxs("svg",{width:A,height:O,viewBox:`${$} ${q} ${F} ${Q}`,role:"img","aria-labelledby":Y,ref:I,onClick:ae,children:[w&&a.jsx("title",{id:Y,children:w}),a.jsx(d$,{onClick:re,nodeColor:r,nodeStrokeColor:n,nodeBorderRadius:s,nodeClassName:o,nodeStrokeWidth:i,nodeComponent:l}),a.jsx("path",{className:"react-flow__minimap-mask",d:`M${$-N},${q-N}h${F+N*2}v${Q+N*2}h${-F-N*2}z + M${R.x},${R.y}h${R.width}v${R.height}h${-R.width}z`,fill:u,fillRule:"evenodd",stroke:p,strokeWidth:m,pointerEvents:"none"})]})})}ZI.displayName="MiniMap";var g$=d.memo(ZI),Wo;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(Wo||(Wo={}));function v$({color:e,dimensions:t,lineWidth:n}){return a.jsx("path",{stroke:e,strokeWidth:n,d:`M${t[0]/2} 0 V${t[1]} M0 ${t[1]/2} H${t[0]}`})}function x$({color:e,radius:t}){return a.jsx("circle",{cx:t,cy:t,r:t,fill:e})}const b$={[Wo.Dots]:"#91919a",[Wo.Lines]:"#eee",[Wo.Cross]:"#e2e2e2"},y$={[Wo.Dots]:1,[Wo.Lines]:1,[Wo.Cross]:6},C$=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function JI({id:e,variant:t=Wo.Dots,gap:n=20,size:r,lineWidth:o=1,offset:s=2,color:i,style:l,className:u}){const p=d.useRef(null),{transform:m,patternId:h}=qp(C$,Lx),g=i||b$[t],x=r||y$[t],y=t===Wo.Dots,b=t===Wo.Cross,w=Array.isArray(n)?n:[n,n],S=[w[0]*m[2]||1,w[1]*m[2]||1],j=x*m[2],_=b?[j,j]:S,E=y?[j/s,j/s]:[_[0]/s,_[1]/s];return a.jsxs("svg",{className:$x(["react-flow__background",u]),style:{...l,position:"absolute",width:"100%",height:"100%",top:0,left:0},ref:p,"data-testid":"rf__background",children:[a.jsx("pattern",{id:h+e,x:m[0]%S[0],y:m[1]%S[1],width:S[0],height:S[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${E[0]},-${E[1]})`,children:y?a.jsx(x$,{color:g,radius:j/s}):a.jsx(v$,{dimensions:_,color:g,lineWidth:o})}),a.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${h+e})`})]})}JI.displayName="Background";var w$=d.memo(JI);const qw=(e,t,n)=>{S$(n);const r=Y_(e,t);return e5[n].includes(r)},e5={">":[1],">=":[0,1],"=":[0],"<=":[-1,0],"<":[-1],"!=":[-1,1]},Xw=Object.keys(e5),S$=e=>{if(typeof e!="string")throw new TypeError(`Invalid operator type, expected string but got ${typeof e}`);if(Xw.indexOf(e)===-1)throw new Error(`Invalid operator, expected one of ${Xw.join("|")}`)};function k$(){return!!(typeof window<"u"&&window.document&&window.document.createElement)}var j$=k$();const t5=1/60*1e3,_$=typeof performance<"u"?()=>performance.now():()=>Date.now(),n5=typeof window<"u"?e=>window.requestAnimationFrame(e):e=>setTimeout(()=>e(_$()),t5);function I$(e){let t=[],n=[],r=0,o=!1,s=!1;const i=new WeakSet,l={schedule:(u,p=!1,m=!1)=>{const h=m&&o,g=h?t:n;return p&&i.add(u),g.indexOf(u)===-1&&(g.push(u),h&&o&&(r=t.length)),u},cancel:u=>{const p=n.indexOf(u);p!==-1&&n.splice(p,1),i.delete(u)},process:u=>{if(o){s=!0;return}if(o=!0,[t,n]=[n,t],n.length=0,r=t.length,r)for(let p=0;p(e[t]=I$(()=>Xu=!0),e),{}),E$=jd.reduce((e,t)=>{const n=Ch[t];return e[t]=(r,o=!1,s=!1)=>(Xu||R$(),n.schedule(r,o,s)),e},{}),M$=jd.reduce((e,t)=>(e[t]=Ch[t].cancel,e),{});jd.reduce((e,t)=>(e[t]=()=>Ch[t].process(sc),e),{});const O$=e=>Ch[e].process(sc),r5=e=>{Xu=!1,sc.delta=b1?t5:Math.max(Math.min(e-sc.timestamp,P$),1),sc.timestamp=e,y1=!0,jd.forEach(O$),y1=!1,Xu&&(b1=!1,n5(r5))},R$=()=>{Xu=!0,b1=!0,y1||n5(r5)},Qw=()=>sc;function wh(e){const{viewBox:t="0 0 24 24",d:n,displayName:r,defaultProps:o={}}=e,s=d.Children.toArray(e.path),i=je((l,u)=>a.jsx(Nn,{ref:u,viewBox:t,...o,...l,children:s.length?s:a.jsx("path",{fill:"currentColor",d:n})}));return i.displayName=r,i}function o5(e){const{theme:t}=$R(),n=LR();return d.useMemo(()=>zR(t.direction,{...n,...e}),[e,t.direction,n])}var D$=Object.defineProperty,A$=(e,t,n)=>t in e?D$(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,jn=(e,t,n)=>(A$(e,typeof t!="symbol"?t+"":t,n),n);function Yw(e){return e.sort((t,n)=>{const r=t.compareDocumentPosition(n);if(r&Node.DOCUMENT_POSITION_FOLLOWING||r&Node.DOCUMENT_POSITION_CONTAINED_BY)return-1;if(r&Node.DOCUMENT_POSITION_PRECEDING||r&Node.DOCUMENT_POSITION_CONTAINS)return 1;if(r&Node.DOCUMENT_POSITION_DISCONNECTED||r&Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC)throw Error("Cannot sort the given nodes.");return 0})}var T$=e=>typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.ELEMENT_NODE;function Zw(e,t,n){let r=e+1;return n&&r>=t&&(r=0),r}function Jw(e,t,n){let r=e-1;return n&&r<0&&(r=t),r}var C1=typeof window<"u"?d.useLayoutEffect:d.useEffect,rm=e=>e,N$=class{constructor(){jn(this,"descendants",new Map),jn(this,"register",e=>{if(e!=null)return T$(e)?this.registerNode(e):t=>{this.registerNode(t,e)}}),jn(this,"unregister",e=>{this.descendants.delete(e);const t=Yw(Array.from(this.descendants.keys()));this.assignIndex(t)}),jn(this,"destroy",()=>{this.descendants.clear()}),jn(this,"assignIndex",e=>{this.descendants.forEach(t=>{const n=e.indexOf(t.node);t.index=n,t.node.dataset.index=t.index.toString()})}),jn(this,"count",()=>this.descendants.size),jn(this,"enabledCount",()=>this.enabledValues().length),jn(this,"values",()=>Array.from(this.descendants.values()).sort((t,n)=>t.index-n.index)),jn(this,"enabledValues",()=>this.values().filter(e=>!e.disabled)),jn(this,"item",e=>{if(this.count()!==0)return this.values()[e]}),jn(this,"enabledItem",e=>{if(this.enabledCount()!==0)return this.enabledValues()[e]}),jn(this,"first",()=>this.item(0)),jn(this,"firstEnabled",()=>this.enabledItem(0)),jn(this,"last",()=>this.item(this.descendants.size-1)),jn(this,"lastEnabled",()=>{const e=this.enabledValues().length-1;return this.enabledItem(e)}),jn(this,"indexOf",e=>{var t,n;return e&&(n=(t=this.descendants.get(e))==null?void 0:t.index)!=null?n:-1}),jn(this,"enabledIndexOf",e=>e==null?-1:this.enabledValues().findIndex(t=>t.node.isSameNode(e))),jn(this,"next",(e,t=!0)=>{const n=Zw(e,this.count(),t);return this.item(n)}),jn(this,"nextEnabled",(e,t=!0)=>{const n=this.item(e);if(!n)return;const r=this.enabledIndexOf(n.node),o=Zw(r,this.enabledCount(),t);return this.enabledItem(o)}),jn(this,"prev",(e,t=!0)=>{const n=Jw(e,this.count()-1,t);return this.item(n)}),jn(this,"prevEnabled",(e,t=!0)=>{const n=this.item(e);if(!n)return;const r=this.enabledIndexOf(n.node),o=Jw(r,this.enabledCount()-1,t);return this.enabledItem(o)}),jn(this,"registerNode",(e,t)=>{if(!e||this.descendants.has(e))return;const n=Array.from(this.descendants.keys()).concat(e),r=Yw(n);t!=null&&t.disabled&&(t.disabled=!!t.disabled);const o={node:e,index:-1,...t};this.descendants.set(e,o),this.assignIndex(r)})}};function $$(e,t){if(e!=null){if(typeof e=="function"){e(t);return}try{e.current=t}catch{throw new Error(`Cannot assign value '${t}' to ref '${e}'`)}}}function It(...e){return t=>{e.forEach(n=>{$$(n,t)})}}function L$(...e){return d.useMemo(()=>It(...e),e)}function z$(){const e=d.useRef(new N$);return C1(()=>()=>e.current.destroy()),e.current}var[F$,s5]=Wt({name:"DescendantsProvider",errorMessage:"useDescendantsContext must be used within DescendantsProvider"});function B$(e){const t=s5(),[n,r]=d.useState(-1),o=d.useRef(null);C1(()=>()=>{o.current&&t.unregister(o.current)},[]),C1(()=>{if(!o.current)return;const i=Number(o.current.dataset.index);n!=i&&!Number.isNaN(i)&&r(i)});const s=rm(e?t.register(e):t.register);return{descendants:t,index:n,enabledIndex:t.enabledIndexOf(o.current),register:It(s,o)}}function lb(){return[rm(F$),()=>rm(s5()),()=>z$(),o=>B$(o)]}var[H$,Sh]=Wt({name:"AccordionStylesContext",hookName:"useAccordionStyles",providerName:""}),[V$,cb]=Wt({name:"AccordionItemContext",hookName:"useAccordionItemContext",providerName:""}),[W$,A1e,U$,G$]=lb(),Bl=je(function(t,n){const{getButtonProps:r}=cb(),o=r(t,n),i={display:"flex",alignItems:"center",width:"100%",outline:0,...Sh().button};return a.jsx(we.button,{...o,className:Ye("chakra-accordion__button",t.className),__css:i})});Bl.displayName="AccordionButton";function _d(e){const{value:t,defaultValue:n,onChange:r,shouldUpdate:o=(g,x)=>g!==x}=e,s=dn(r),i=dn(o),[l,u]=d.useState(n),p=t!==void 0,m=p?t:l,h=dn(g=>{const y=typeof g=="function"?g(m):g;i(m,y)&&(p||u(y),s(y))},[p,s,m,i]);return[m,h]}function K$(e){const{onChange:t,defaultIndex:n,index:r,allowMultiple:o,allowToggle:s,...i}=e;Q$(e),Y$(e);const l=U$(),[u,p]=d.useState(-1);d.useEffect(()=>()=>{p(-1)},[]);const[m,h]=_d({value:r,defaultValue(){return o?n??[]:n??-1},onChange:t});return{index:m,setIndex:h,htmlProps:i,getAccordionItemProps:x=>{let y=!1;return x!==null&&(y=Array.isArray(m)?m.includes(x):m===x),{isOpen:y,onChange:w=>{if(x!==null)if(o&&Array.isArray(m)){const S=w?m.concat(x):m.filter(j=>j!==x);h(S)}else w?h(x):s&&h(-1)}}},focusedIndex:u,setFocusedIndex:p,descendants:l}}var[q$,ub]=Wt({name:"AccordionContext",hookName:"useAccordionContext",providerName:"Accordion"});function X$(e){const{isDisabled:t,isFocusable:n,id:r,...o}=e,{getAccordionItemProps:s,setFocusedIndex:i}=ub(),l=d.useRef(null),u=d.useId(),p=r??u,m=`accordion-button-${p}`,h=`accordion-panel-${p}`;Z$(e);const{register:g,index:x,descendants:y}=G$({disabled:t&&!n}),{isOpen:b,onChange:w}=s(x===-1?null:x);J$({isOpen:b,isDisabled:t});const S=()=>{w==null||w(!0)},j=()=>{w==null||w(!1)},_=d.useCallback(()=>{w==null||w(!b),i(x)},[x,i,b,w]),E=d.useCallback(D=>{const O={ArrowDown:()=>{const T=y.nextEnabled(x);T==null||T.node.focus()},ArrowUp:()=>{const T=y.prevEnabled(x);T==null||T.node.focus()},Home:()=>{const T=y.firstEnabled();T==null||T.node.focus()},End:()=>{const T=y.lastEnabled();T==null||T.node.focus()}}[D.key];O&&(D.preventDefault(),O(D))},[y,x]),I=d.useCallback(()=>{i(x)},[i,x]),M=d.useCallback(function(A={},O=null){return{...A,type:"button",ref:It(g,l,O),id:m,disabled:!!t,"aria-expanded":!!b,"aria-controls":h,onClick:He(A.onClick,_),onFocus:He(A.onFocus,I),onKeyDown:He(A.onKeyDown,E)}},[m,t,b,_,I,E,h,g]),R=d.useCallback(function(A={},O=null){return{...A,ref:O,role:"region",id:h,"aria-labelledby":m,hidden:!b}},[m,b,h]);return{isOpen:b,isDisabled:t,isFocusable:n,onOpen:S,onClose:j,getButtonProps:M,getPanelProps:R,htmlProps:o}}function Q$(e){const t=e.index||e.defaultIndex,n=t!=null&&!Array.isArray(t)&&e.allowMultiple;vd({condition:!!n,message:`If 'allowMultiple' is passed, then 'index' or 'defaultIndex' must be an array. You passed: ${typeof t},`})}function Y$(e){vd({condition:!!(e.allowMultiple&&e.allowToggle),message:"If 'allowMultiple' is passed, 'allowToggle' will be ignored. Either remove 'allowToggle' or 'allowMultiple' depending on whether you want multiple accordions visible or not"})}function Z$(e){vd({condition:!!(e.isFocusable&&!e.isDisabled),message:`Using only 'isFocusable', this prop is reserved for situations where you pass 'isDisabled' but you still want the element to receive focus (A11y). Either remove it or pass 'isDisabled' as well. + `})}function J$(e){vd({condition:e.isOpen&&!!e.isDisabled,message:"Cannot open a disabled accordion item"})}function Hl(e){const{isOpen:t,isDisabled:n}=cb(),{reduceMotion:r}=ub(),o=Ye("chakra-accordion__icon",e.className),s=Sh(),i={opacity:n?.4:1,transform:t?"rotate(-180deg)":void 0,transition:r?void 0:"transform 0.2s",transformOrigin:"center",...s.icon};return a.jsx(Nn,{viewBox:"0 0 24 24","aria-hidden":!0,className:o,__css:i,...e,children:a.jsx("path",{fill:"currentColor",d:"M16.59 8.59L12 13.17 7.41 8.59 6 10l6 6 6-6z"})})}Hl.displayName="AccordionIcon";var Vl=je(function(t,n){const{children:r,className:o}=t,{htmlProps:s,...i}=X$(t),u={...Sh().container,overflowAnchor:"none"},p=d.useMemo(()=>i,[i]);return a.jsx(V$,{value:p,children:a.jsx(we.div,{ref:n,...s,className:Ye("chakra-accordion__item",o),__css:u,children:typeof r=="function"?r({isExpanded:!!i.isOpen,isDisabled:!!i.isDisabled}):r})})});Vl.displayName="AccordionItem";var Yl={ease:[.25,.1,.25,1],easeIn:[.4,0,1,1],easeOut:[0,0,.2,1],easeInOut:[.4,0,.2,1]},Ri={enter:{duration:.2,ease:Yl.easeOut},exit:{duration:.1,ease:Yl.easeIn}},Js={enter:(e,t)=>({...e,delay:typeof t=="number"?t:t==null?void 0:t.enter}),exit:(e,t)=>({...e,delay:typeof t=="number"?t:t==null?void 0:t.exit})},eL=e=>e!=null&&parseInt(e.toString(),10)>0,eS={exit:{height:{duration:.2,ease:Yl.ease},opacity:{duration:.3,ease:Yl.ease}},enter:{height:{duration:.3,ease:Yl.ease},opacity:{duration:.4,ease:Yl.ease}}},tL={exit:({animateOpacity:e,startingHeight:t,transition:n,transitionEnd:r,delay:o})=>{var s;return{...e&&{opacity:eL(t)?1:0},height:t,transitionEnd:r==null?void 0:r.exit,transition:(s=n==null?void 0:n.exit)!=null?s:Js.exit(eS.exit,o)}},enter:({animateOpacity:e,endingHeight:t,transition:n,transitionEnd:r,delay:o})=>{var s;return{...e&&{opacity:1},height:t,transitionEnd:r==null?void 0:r.enter,transition:(s=n==null?void 0:n.enter)!=null?s:Js.enter(eS.enter,o)}}},Id=d.forwardRef((e,t)=>{const{in:n,unmountOnExit:r,animateOpacity:o=!0,startingHeight:s=0,endingHeight:i="auto",style:l,className:u,transition:p,transitionEnd:m,...h}=e,[g,x]=d.useState(!1);d.useEffect(()=>{const j=setTimeout(()=>{x(!0)});return()=>clearTimeout(j)},[]),vd({condition:Number(s)>0&&!!r,message:"startingHeight and unmountOnExit are mutually exclusive. You can't use them together"});const y=parseFloat(s.toString())>0,b={startingHeight:s,endingHeight:i,animateOpacity:o,transition:g?p:{enter:{duration:0}},transitionEnd:{enter:m==null?void 0:m.enter,exit:r?m==null?void 0:m.exit:{...m==null?void 0:m.exit,display:y?"block":"none"}}},w=r?n:!0,S=n||r?"enter":"exit";return a.jsx(dr,{initial:!1,custom:b,children:w&&a.jsx(In.div,{ref:t,...h,className:Ye("chakra-collapse",u),style:{overflow:"hidden",display:"block",...l},custom:b,variants:tL,initial:r?"exit":!1,animate:S,exit:"exit"})})});Id.displayName="Collapse";var nL={enter:({transition:e,transitionEnd:t,delay:n}={})=>{var r;return{opacity:1,transition:(r=e==null?void 0:e.enter)!=null?r:Js.enter(Ri.enter,n),transitionEnd:t==null?void 0:t.enter}},exit:({transition:e,transitionEnd:t,delay:n}={})=>{var r;return{opacity:0,transition:(r=e==null?void 0:e.exit)!=null?r:Js.exit(Ri.exit,n),transitionEnd:t==null?void 0:t.exit}}},a5={initial:"exit",animate:"enter",exit:"exit",variants:nL},rL=d.forwardRef(function(t,n){const{unmountOnExit:r,in:o,className:s,transition:i,transitionEnd:l,delay:u,...p}=t,m=o||r?"enter":"exit",h=r?o&&r:!0,g={transition:i,transitionEnd:l,delay:u};return a.jsx(dr,{custom:g,children:h&&a.jsx(In.div,{ref:n,className:Ye("chakra-fade",s),custom:g,...a5,animate:m,...p})})});rL.displayName="Fade";var oL={exit:({reverse:e,initialScale:t,transition:n,transitionEnd:r,delay:o})=>{var s;return{opacity:0,...e?{scale:t,transitionEnd:r==null?void 0:r.exit}:{transitionEnd:{scale:t,...r==null?void 0:r.exit}},transition:(s=n==null?void 0:n.exit)!=null?s:Js.exit(Ri.exit,o)}},enter:({transitionEnd:e,transition:t,delay:n})=>{var r;return{opacity:1,scale:1,transition:(r=t==null?void 0:t.enter)!=null?r:Js.enter(Ri.enter,n),transitionEnd:e==null?void 0:e.enter}}},i5={initial:"exit",animate:"enter",exit:"exit",variants:oL},sL=d.forwardRef(function(t,n){const{unmountOnExit:r,in:o,reverse:s=!0,initialScale:i=.95,className:l,transition:u,transitionEnd:p,delay:m,...h}=t,g=r?o&&r:!0,x=o||r?"enter":"exit",y={initialScale:i,reverse:s,transition:u,transitionEnd:p,delay:m};return a.jsx(dr,{custom:y,children:g&&a.jsx(In.div,{ref:n,className:Ye("chakra-offset-slide",l),...i5,animate:x,custom:y,...h})})});sL.displayName="ScaleFade";var aL={initial:({offsetX:e,offsetY:t,transition:n,transitionEnd:r,delay:o})=>{var s;return{opacity:0,x:e,y:t,transition:(s=n==null?void 0:n.exit)!=null?s:Js.exit(Ri.exit,o),transitionEnd:r==null?void 0:r.exit}},enter:({transition:e,transitionEnd:t,delay:n})=>{var r;return{opacity:1,x:0,y:0,transition:(r=e==null?void 0:e.enter)!=null?r:Js.enter(Ri.enter,n),transitionEnd:t==null?void 0:t.enter}},exit:({offsetY:e,offsetX:t,transition:n,transitionEnd:r,reverse:o,delay:s})=>{var i;const l={x:t,y:e};return{opacity:0,transition:(i=n==null?void 0:n.exit)!=null?i:Js.exit(Ri.exit,s),...o?{...l,transitionEnd:r==null?void 0:r.exit}:{transitionEnd:{...l,...r==null?void 0:r.exit}}}}},w1={initial:"initial",animate:"enter",exit:"exit",variants:aL},iL=d.forwardRef(function(t,n){const{unmountOnExit:r,in:o,reverse:s=!0,className:i,offsetX:l=0,offsetY:u=8,transition:p,transitionEnd:m,delay:h,...g}=t,x=r?o&&r:!0,y=o||r?"enter":"exit",b={offsetX:l,offsetY:u,reverse:s,transition:p,transitionEnd:m,delay:h};return a.jsx(dr,{custom:b,children:x&&a.jsx(In.div,{ref:n,className:Ye("chakra-offset-slide",i),custom:b,...w1,animate:y,...g})})});iL.displayName="SlideFade";var Wl=je(function(t,n){const{className:r,motionProps:o,...s}=t,{reduceMotion:i}=ub(),{getPanelProps:l,isOpen:u}=cb(),p=l(s,n),m=Ye("chakra-accordion__panel",r),h=Sh();i||delete p.hidden;const g=a.jsx(we.div,{...p,__css:h.panel,className:m});return i?g:a.jsx(Id,{in:u,...o,children:g})});Wl.displayName="AccordionPanel";var l5=je(function({children:t,reduceMotion:n,...r},o){const s=Un("Accordion",r),i=on(r),{htmlProps:l,descendants:u,...p}=K$(i),m=d.useMemo(()=>({...p,reduceMotion:!!n}),[p,n]);return a.jsx(W$,{value:u,children:a.jsx(q$,{value:m,children:a.jsx(H$,{value:s,children:a.jsx(we.div,{ref:o,...l,className:Ye("chakra-accordion",r.className),__css:s.root,children:t})})})})});l5.displayName="Accordion";function kh(e){return d.Children.toArray(e).filter(t=>d.isValidElement(t))}var[lL,cL]=Wt({strict:!1,name:"ButtonGroupContext"}),uL={horizontal:{"> *:first-of-type:not(:last-of-type)":{borderEndRadius:0},"> *:not(:first-of-type):not(:last-of-type)":{borderRadius:0},"> *:not(:first-of-type):last-of-type":{borderStartRadius:0}},vertical:{"> *:first-of-type:not(:last-of-type)":{borderBottomRadius:0},"> *:not(:first-of-type):not(:last-of-type)":{borderRadius:0},"> *:not(:first-of-type):last-of-type":{borderTopRadius:0}}},dL={horizontal:e=>({"& > *:not(style) ~ *:not(style)":{marginStart:e}}),vertical:e=>({"& > *:not(style) ~ *:not(style)":{marginTop:e}})},Vt=je(function(t,n){const{size:r,colorScheme:o,variant:s,className:i,spacing:l="0.5rem",isAttached:u,isDisabled:p,orientation:m="horizontal",...h}=t,g=Ye("chakra-button__group",i),x=d.useMemo(()=>({size:r,colorScheme:o,variant:s,isDisabled:p}),[r,o,s,p]);let y={display:"inline-flex",...u?uL[m]:dL[m](l)};const b=m==="vertical";return a.jsx(lL,{value:x,children:a.jsx(we.div,{ref:n,role:"group",__css:y,className:g,"data-attached":u?"":void 0,"data-orientation":m,flexDir:b?"column":void 0,...h})})});Vt.displayName="ButtonGroup";function fL(e){const[t,n]=d.useState(!e);return{ref:d.useCallback(s=>{s&&n(s.tagName==="BUTTON")},[]),type:t?"button":void 0}}function S1(e){const{children:t,className:n,...r}=e,o=d.isValidElement(t)?d.cloneElement(t,{"aria-hidden":!0,focusable:!1}):t,s=Ye("chakra-button__icon",n);return a.jsx(we.span,{display:"inline-flex",alignSelf:"center",flexShrink:0,...r,className:s,children:o})}S1.displayName="ButtonIcon";function k1(e){const{label:t,placement:n,spacing:r="0.5rem",children:o=a.jsx(fa,{color:"currentColor",width:"1em",height:"1em"}),className:s,__css:i,...l}=e,u=Ye("chakra-button__spinner",s),p=n==="start"?"marginEnd":"marginStart",m=d.useMemo(()=>({display:"flex",alignItems:"center",position:t?"relative":"absolute",[p]:t?r:0,fontSize:"1em",lineHeight:"normal",...i}),[i,t,p,r]);return a.jsx(we.div,{className:u,...l,__css:m,children:o})}k1.displayName="ButtonSpinner";var Za=je((e,t)=>{const n=cL(),r=oi("Button",{...n,...e}),{isDisabled:o=n==null?void 0:n.isDisabled,isLoading:s,isActive:i,children:l,leftIcon:u,rightIcon:p,loadingText:m,iconSpacing:h="0.5rem",type:g,spinner:x,spinnerPlacement:y="start",className:b,as:w,...S}=on(e),j=d.useMemo(()=>{const M={...r==null?void 0:r._focus,zIndex:1};return{display:"inline-flex",appearance:"none",alignItems:"center",justifyContent:"center",userSelect:"none",position:"relative",whiteSpace:"nowrap",verticalAlign:"middle",outline:"none",...r,...!!n&&{_focus:M}}},[r,n]),{ref:_,type:E}=fL(w),I={rightIcon:p,leftIcon:u,iconSpacing:h,children:l};return a.jsxs(we.button,{ref:L$(t,_),as:w,type:g??E,"data-active":dt(i),"data-loading":dt(s),__css:j,className:Ye("chakra-button",b),...S,disabled:o||s,children:[s&&y==="start"&&a.jsx(k1,{className:"chakra-button__spinner--start",label:m,placement:"start",spacing:h,children:x}),s?m||a.jsx(we.span,{opacity:0,children:a.jsx(tS,{...I})}):a.jsx(tS,{...I}),s&&y==="end"&&a.jsx(k1,{className:"chakra-button__spinner--end",label:m,placement:"end",spacing:h,children:x})]})});Za.displayName="Button";function tS(e){const{leftIcon:t,rightIcon:n,children:r,iconSpacing:o}=e;return a.jsxs(a.Fragment,{children:[t&&a.jsx(S1,{marginEnd:o,children:t}),r,n&&a.jsx(S1,{marginStart:o,children:n})]})}var ys=je((e,t)=>{const{icon:n,children:r,isRound:o,"aria-label":s,...i}=e,l=n||r,u=d.isValidElement(l)?d.cloneElement(l,{"aria-hidden":!0,focusable:!1}):null;return a.jsx(Za,{padding:"0",borderRadius:o?"full":void 0,ref:t,"aria-label":s,...i,children:u})});ys.displayName="IconButton";var[T1e,pL]=Wt({name:"CheckboxGroupContext",strict:!1});function mL(e){const[t,n]=d.useState(e),[r,o]=d.useState(!1);return e!==t&&(o(!0),n(e)),r}function hL(e){return a.jsx(we.svg,{width:"1.2em",viewBox:"0 0 12 10",style:{fill:"none",strokeWidth:2,stroke:"currentColor",strokeDasharray:16},...e,children:a.jsx("polyline",{points:"1.5 6 4.5 9 10.5 1"})})}function gL(e){return a.jsx(we.svg,{width:"1.2em",viewBox:"0 0 24 24",style:{stroke:"currentColor",strokeWidth:4},...e,children:a.jsx("line",{x1:"21",x2:"3",y1:"12",y2:"12"})})}function vL(e){const{isIndeterminate:t,isChecked:n,...r}=e,o=t?gL:hL;return n||t?a.jsx(we.div,{style:{display:"flex",alignItems:"center",justifyContent:"center",height:"100%"},children:a.jsx(o,{...r})}):null}var[xL,c5]=Wt({name:"FormControlStylesContext",errorMessage:`useFormControlStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),[bL,Pd]=Wt({strict:!1,name:"FormControlContext"});function yL(e){const{id:t,isRequired:n,isInvalid:r,isDisabled:o,isReadOnly:s,...i}=e,l=d.useId(),u=t||`field-${l}`,p=`${u}-label`,m=`${u}-feedback`,h=`${u}-helptext`,[g,x]=d.useState(!1),[y,b]=d.useState(!1),[w,S]=d.useState(!1),j=d.useCallback((R={},D=null)=>({id:h,...R,ref:It(D,A=>{A&&b(!0)})}),[h]),_=d.useCallback((R={},D=null)=>({...R,ref:D,"data-focus":dt(w),"data-disabled":dt(o),"data-invalid":dt(r),"data-readonly":dt(s),id:R.id!==void 0?R.id:p,htmlFor:R.htmlFor!==void 0?R.htmlFor:u}),[u,o,w,r,s,p]),E=d.useCallback((R={},D=null)=>({id:m,...R,ref:It(D,A=>{A&&x(!0)}),"aria-live":"polite"}),[m]),I=d.useCallback((R={},D=null)=>({...R,...i,ref:D,role:"group"}),[i]),M=d.useCallback((R={},D=null)=>({...R,ref:D,role:"presentation","aria-hidden":!0,children:R.children||"*"}),[]);return{isRequired:!!n,isInvalid:!!r,isReadOnly:!!s,isDisabled:!!o,isFocused:!!w,onFocus:()=>S(!0),onBlur:()=>S(!1),hasFeedbackText:g,setHasFeedbackText:x,hasHelpText:y,setHasHelpText:b,id:u,labelId:p,feedbackId:m,helpTextId:h,htmlProps:i,getHelpTextProps:j,getErrorMessageProps:E,getRootProps:I,getLabelProps:_,getRequiredIndicatorProps:M}}var Kt=je(function(t,n){const r=Un("Form",t),o=on(t),{getRootProps:s,htmlProps:i,...l}=yL(o),u=Ye("chakra-form-control",t.className);return a.jsx(bL,{value:l,children:a.jsx(xL,{value:r,children:a.jsx(we.div,{...s({},n),className:u,__css:r.container})})})});Kt.displayName="FormControl";var u5=je(function(t,n){const r=Pd(),o=c5(),s=Ye("chakra-form__helper-text",t.className);return a.jsx(we.div,{...r==null?void 0:r.getHelpTextProps(t,n),__css:o.helperText,className:s})});u5.displayName="FormHelperText";var wn=je(function(t,n){var r;const o=oi("FormLabel",t),s=on(t),{className:i,children:l,requiredIndicator:u=a.jsx(d5,{}),optionalIndicator:p=null,...m}=s,h=Pd(),g=(r=h==null?void 0:h.getLabelProps(m,n))!=null?r:{ref:n,...m};return a.jsxs(we.label,{...g,className:Ye("chakra-form__label",s.className),__css:{display:"block",textAlign:"start",...o},children:[l,h!=null&&h.isRequired?u:p]})});wn.displayName="FormLabel";var d5=je(function(t,n){const r=Pd(),o=c5();if(!(r!=null&&r.isRequired))return null;const s=Ye("chakra-form__required-indicator",t.className);return a.jsx(we.span,{...r==null?void 0:r.getRequiredIndicatorProps(t,n),__css:o.requiredIndicator,className:s})});d5.displayName="RequiredIndicator";function db(e){const{isDisabled:t,isInvalid:n,isReadOnly:r,isRequired:o,...s}=fb(e);return{...s,disabled:t,readOnly:r,required:o,"aria-invalid":Co(n),"aria-required":Co(o),"aria-readonly":Co(r)}}function fb(e){var t,n,r;const o=Pd(),{id:s,disabled:i,readOnly:l,required:u,isRequired:p,isInvalid:m,isReadOnly:h,isDisabled:g,onFocus:x,onBlur:y,...b}=e,w=e["aria-describedby"]?[e["aria-describedby"]]:[];return o!=null&&o.hasFeedbackText&&(o!=null&&o.isInvalid)&&w.push(o.feedbackId),o!=null&&o.hasHelpText&&w.push(o.helpTextId),{...b,"aria-describedby":w.join(" ")||void 0,id:s??(o==null?void 0:o.id),isDisabled:(t=i??g)!=null?t:o==null?void 0:o.isDisabled,isReadOnly:(n=l??h)!=null?n:o==null?void 0:o.isReadOnly,isRequired:(r=u??p)!=null?r:o==null?void 0:o.isRequired,isInvalid:m??(o==null?void 0:o.isInvalid),onFocus:He(o==null?void 0:o.onFocus,x),onBlur:He(o==null?void 0:o.onBlur,y)}}var pb={border:"0",clip:"rect(0, 0, 0, 0)",height:"1px",width:"1px",margin:"-1px",padding:"0",overflow:"hidden",whiteSpace:"nowrap",position:"absolute"},f5=we("span",{baseStyle:pb});f5.displayName="VisuallyHidden";var CL=we("input",{baseStyle:pb});CL.displayName="VisuallyHiddenInput";const wL=()=>typeof document<"u";let nS=!1,Ed=null,Wi=!1,j1=!1;const _1=new Set;function mb(e,t){_1.forEach(n=>n(e,t))}const SL=typeof window<"u"&&window.navigator!=null?/^Mac/.test(window.navigator.platform):!1;function kL(e){return!(e.metaKey||!SL&&e.altKey||e.ctrlKey||e.key==="Control"||e.key==="Shift"||e.key==="Meta")}function rS(e){Wi=!0,kL(e)&&(Ed="keyboard",mb("keyboard",e))}function Ol(e){if(Ed="pointer",e.type==="mousedown"||e.type==="pointerdown"){Wi=!0;const t=e.composedPath?e.composedPath()[0]:e.target;let n=!1;try{n=t.matches(":focus-visible")}catch{}if(n)return;mb("pointer",e)}}function jL(e){return e.mozInputSource===0&&e.isTrusted?!0:e.detail===0&&!e.pointerType}function _L(e){jL(e)&&(Wi=!0,Ed="virtual")}function IL(e){e.target===window||e.target===document||(!Wi&&!j1&&(Ed="virtual",mb("virtual",e)),Wi=!1,j1=!1)}function PL(){Wi=!1,j1=!0}function oS(){return Ed!=="pointer"}function EL(){if(!wL()||nS)return;const{focus:e}=HTMLElement.prototype;HTMLElement.prototype.focus=function(...n){Wi=!0,e.apply(this,n)},document.addEventListener("keydown",rS,!0),document.addEventListener("keyup",rS,!0),document.addEventListener("click",_L,!0),window.addEventListener("focus",IL,!0),window.addEventListener("blur",PL,!1),typeof PointerEvent<"u"?(document.addEventListener("pointerdown",Ol,!0),document.addEventListener("pointermove",Ol,!0),document.addEventListener("pointerup",Ol,!0)):(document.addEventListener("mousedown",Ol,!0),document.addEventListener("mousemove",Ol,!0),document.addEventListener("mouseup",Ol,!0)),nS=!0}function p5(e){EL(),e(oS());const t=()=>e(oS());return _1.add(t),()=>{_1.delete(t)}}function ML(e,t=[]){const n=Object.assign({},e);for(const r of t)r in n&&delete n[r];return n}function m5(e={}){const t=fb(e),{isDisabled:n,isReadOnly:r,isRequired:o,isInvalid:s,id:i,onBlur:l,onFocus:u,"aria-describedby":p}=t,{defaultChecked:m,isChecked:h,isFocusable:g,onChange:x,isIndeterminate:y,name:b,value:w,tabIndex:S=void 0,"aria-label":j,"aria-labelledby":_,"aria-invalid":E,...I}=e,M=ML(I,["isDisabled","isReadOnly","isRequired","isInvalid","id","onBlur","onFocus","aria-describedby"]),R=dn(x),D=dn(l),A=dn(u),[O,T]=d.useState(!1),[X,B]=d.useState(!1),[V,U]=d.useState(!1),[N,$]=d.useState(!1);d.useEffect(()=>p5(T),[]);const q=d.useRef(null),[F,Q]=d.useState(!0),[Y,se]=d.useState(!!m),ae=h!==void 0,re=ae?h:Y,G=d.useCallback(fe=>{if(r||n){fe.preventDefault();return}ae||se(re?fe.target.checked:y?!0:fe.target.checked),R==null||R(fe)},[r,n,re,ae,y,R]);rc(()=>{q.current&&(q.current.indeterminate=!!y)},[y]),pa(()=>{n&&B(!1)},[n,B]),rc(()=>{const fe=q.current;if(!(fe!=null&&fe.form))return;const Oe=()=>{se(!!m)};return fe.form.addEventListener("reset",Oe),()=>{var _e;return(_e=fe.form)==null?void 0:_e.removeEventListener("reset",Oe)}},[]);const K=n&&!g,ee=d.useCallback(fe=>{fe.key===" "&&$(!0)},[$]),ce=d.useCallback(fe=>{fe.key===" "&&$(!1)},[$]);rc(()=>{if(!q.current)return;q.current.checked!==re&&se(q.current.checked)},[q.current]);const J=d.useCallback((fe={},Oe=null)=>{const _e=Ne=>{X&&Ne.preventDefault(),$(!0)};return{...fe,ref:Oe,"data-active":dt(N),"data-hover":dt(V),"data-checked":dt(re),"data-focus":dt(X),"data-focus-visible":dt(X&&O),"data-indeterminate":dt(y),"data-disabled":dt(n),"data-invalid":dt(s),"data-readonly":dt(r),"aria-hidden":!0,onMouseDown:He(fe.onMouseDown,_e),onMouseUp:He(fe.onMouseUp,()=>$(!1)),onMouseEnter:He(fe.onMouseEnter,()=>U(!0)),onMouseLeave:He(fe.onMouseLeave,()=>U(!1))}},[N,re,n,X,O,V,y,s,r]),ie=d.useCallback((fe={},Oe=null)=>({...fe,ref:Oe,"data-active":dt(N),"data-hover":dt(V),"data-checked":dt(re),"data-focus":dt(X),"data-focus-visible":dt(X&&O),"data-indeterminate":dt(y),"data-disabled":dt(n),"data-invalid":dt(s),"data-readonly":dt(r)}),[N,re,n,X,O,V,y,s,r]),de=d.useCallback((fe={},Oe=null)=>({...M,...fe,ref:It(Oe,_e=>{_e&&Q(_e.tagName==="LABEL")}),onClick:He(fe.onClick,()=>{var _e;F||((_e=q.current)==null||_e.click(),requestAnimationFrame(()=>{var Ne;(Ne=q.current)==null||Ne.focus({preventScroll:!0})}))}),"data-disabled":dt(n),"data-checked":dt(re),"data-invalid":dt(s)}),[M,n,re,s,F]),ge=d.useCallback((fe={},Oe=null)=>({...fe,ref:It(q,Oe),type:"checkbox",name:b,value:w,id:i,tabIndex:S,onChange:He(fe.onChange,G),onBlur:He(fe.onBlur,D,()=>B(!1)),onFocus:He(fe.onFocus,A,()=>B(!0)),onKeyDown:He(fe.onKeyDown,ee),onKeyUp:He(fe.onKeyUp,ce),required:o,checked:re,disabled:K,readOnly:r,"aria-label":j,"aria-labelledby":_,"aria-invalid":E?!!E:s,"aria-describedby":p,"aria-disabled":n,style:pb}),[b,w,i,G,D,A,ee,ce,o,re,K,r,j,_,E,s,p,n,S]),Ce=d.useCallback((fe={},Oe=null)=>({...fe,ref:Oe,onMouseDown:He(fe.onMouseDown,OL),"data-disabled":dt(n),"data-checked":dt(re),"data-invalid":dt(s)}),[re,n,s]);return{state:{isInvalid:s,isFocused:X,isChecked:re,isActive:N,isHovered:V,isIndeterminate:y,isDisabled:n,isReadOnly:r,isRequired:o},getRootProps:de,getCheckboxProps:J,getIndicatorProps:ie,getInputProps:ge,getLabelProps:Ce,htmlProps:M}}function OL(e){e.preventDefault(),e.stopPropagation()}var RL={display:"inline-flex",alignItems:"center",justifyContent:"center",verticalAlign:"top",userSelect:"none",flexShrink:0},DL={cursor:"pointer",display:"inline-flex",alignItems:"center",verticalAlign:"top",position:"relative"},AL=ma({from:{opacity:0,strokeDashoffset:16,transform:"scale(0.95)"},to:{opacity:1,strokeDashoffset:0,transform:"scale(1)"}}),TL=ma({from:{opacity:0},to:{opacity:1}}),NL=ma({from:{transform:"scaleX(0.65)"},to:{transform:"scaleX(1)"}}),Md=je(function(t,n){const r=pL(),o={...r,...t},s=Un("Checkbox",o),i=on(t),{spacing:l="0.5rem",className:u,children:p,iconColor:m,iconSize:h,icon:g=a.jsx(vL,{}),isChecked:x,isDisabled:y=r==null?void 0:r.isDisabled,onChange:b,inputProps:w,...S}=i;let j=x;r!=null&&r.value&&i.value&&(j=r.value.includes(i.value));let _=b;r!=null&&r.onChange&&i.value&&(_=ph(r.onChange,b));const{state:E,getInputProps:I,getCheckboxProps:M,getLabelProps:R,getRootProps:D}=m5({...S,isDisabled:y,isChecked:j,onChange:_}),A=mL(E.isChecked),O=d.useMemo(()=>({animation:A?E.isIndeterminate?`${TL} 20ms linear, ${NL} 200ms linear`:`${AL} 200ms linear`:void 0,fontSize:h,color:m,...s.icon}),[m,h,A,E.isIndeterminate,s.icon]),T=d.cloneElement(g,{__css:O,isIndeterminate:E.isIndeterminate,isChecked:E.isChecked});return a.jsxs(we.label,{__css:{...DL,...s.container},className:Ye("chakra-checkbox",u),...D(),children:[a.jsx("input",{className:"chakra-checkbox__input",...I(w,n)}),a.jsx(we.span,{__css:{...RL,...s.control},className:"chakra-checkbox__control",...M(),children:T}),p&&a.jsx(we.span,{className:"chakra-checkbox__label",...R(),__css:{marginStart:l,...s.label},children:p})]})});Md.displayName="Checkbox";function $L(e){const t=parseFloat(e);return typeof t!="number"||Number.isNaN(t)?0:t}function hb(e,t){let n=$L(e);const r=10**(t??10);return n=Math.round(n*r)/r,t?n.toFixed(t):n.toString()}function I1(e){if(!Number.isFinite(e))return 0;let t=1,n=0;for(;Math.round(e*t)/t!==e;)t*=10,n+=1;return n}function om(e,t,n){return(e-t)*100/(n-t)}function h5(e,t,n){return(n-t)*e+t}function P1(e,t,n){const r=Math.round((e-t)/n)*n+t,o=I1(n);return hb(r,o)}function ac(e,t,n){return e==null?e:(n{var O;return r==null?"":(O=av(r,s,n))!=null?O:""}),g=typeof o<"u",x=g?o:m,y=g5(za(x),s),b=n??y,w=d.useCallback(O=>{O!==x&&(g||h(O.toString()),p==null||p(O.toString(),za(O)))},[p,g,x]),S=d.useCallback(O=>{let T=O;return u&&(T=ac(T,i,l)),hb(T,b)},[b,u,l,i]),j=d.useCallback((O=s)=>{let T;x===""?T=za(O):T=za(x)+O,T=S(T),w(T)},[S,s,w,x]),_=d.useCallback((O=s)=>{let T;x===""?T=za(-O):T=za(x)-O,T=S(T),w(T)},[S,s,w,x]),E=d.useCallback(()=>{var O;let T;r==null?T="":T=(O=av(r,s,n))!=null?O:i,w(T)},[r,n,s,w,i]),I=d.useCallback(O=>{var T;const X=(T=av(O,s,b))!=null?T:i;w(X)},[b,s,w,i]),M=za(x);return{isOutOfRange:M>l||M" `}),[FL,gb]=Wt({name:"EditableContext",errorMessage:"useEditableContext: context is undefined. Seems you forgot to wrap the editable components in ``"}),x5={fontSize:"inherit",fontWeight:"inherit",textAlign:"inherit",bg:"transparent"},jh=je(function(t,n){const{getInputProps:r}=gb(),o=v5(),s=r(t,n),i=Ye("chakra-editable__input",t.className);return a.jsx(we.input,{...s,__css:{outline:0,...x5,...o.input},className:i})});jh.displayName="EditableInput";var _h=je(function(t,n){const{getPreviewProps:r}=gb(),o=v5(),s=r(t,n),i=Ye("chakra-editable__preview",t.className);return a.jsx(we.span,{...s,__css:{cursor:"text",display:"inline-block",...x5,...o.preview},className:i})});_h.displayName="EditablePreview";function Di(e,t,n,r){const o=dn(n);return d.useEffect(()=>{const s=typeof e=="function"?e():e??document;if(!(!n||!s))return s.addEventListener(t,o,r),()=>{s.removeEventListener(t,o,r)}},[t,e,r,o,n]),()=>{const s=typeof e=="function"?e():e??document;s==null||s.removeEventListener(t,o,r)}}function BL(e){return"current"in e}var b5=()=>typeof window<"u";function HL(){var e;const t=navigator.userAgentData;return(e=t==null?void 0:t.platform)!=null?e:navigator.platform}var VL=e=>b5()&&e.test(navigator.vendor),WL=e=>b5()&&e.test(HL()),UL=()=>WL(/mac|iphone|ipad|ipod/i),GL=()=>UL()&&VL(/apple/i);function y5(e){const{ref:t,elements:n,enabled:r}=e,o=()=>{var s,i;return(i=(s=t.current)==null?void 0:s.ownerDocument)!=null?i:document};Di(o,"pointerdown",s=>{if(!GL()||!r)return;const i=s.target,u=(n??[t]).some(p=>{const m=BL(p)?p.current:p;return(m==null?void 0:m.contains(i))||m===i});o().activeElement!==i&&u&&(s.preventDefault(),i.focus())})}function sS(e,t){return e?e===t||e.contains(t):!1}function KL(e={}){const{onChange:t,onCancel:n,onSubmit:r,onBlur:o,value:s,isDisabled:i,defaultValue:l,startWithEditView:u,isPreviewFocusable:p=!0,submitOnBlur:m=!0,selectAllOnFocus:h=!0,placeholder:g,onEdit:x,finalFocusRef:y,...b}=e,w=dn(x),S=!!(u&&!i),[j,_]=d.useState(S),[E,I]=_d({defaultValue:l||"",value:s,onChange:t}),[M,R]=d.useState(E),D=d.useRef(null),A=d.useRef(null),O=d.useRef(null),T=d.useRef(null),X=d.useRef(null);y5({ref:D,enabled:j,elements:[T,X]});const B=!j&&!i;rc(()=>{var J,ie;j&&((J=D.current)==null||J.focus(),h&&((ie=D.current)==null||ie.select()))},[]),pa(()=>{var J,ie,de,ge;if(!j){y?(J=y.current)==null||J.focus():(ie=O.current)==null||ie.focus();return}(de=D.current)==null||de.focus(),h&&((ge=D.current)==null||ge.select()),w==null||w()},[j,w,h]);const V=d.useCallback(()=>{B&&_(!0)},[B]),U=d.useCallback(()=>{R(E)},[E]),N=d.useCallback(()=>{_(!1),I(M),n==null||n(M),o==null||o(M)},[n,o,I,M]),$=d.useCallback(()=>{_(!1),R(E),r==null||r(E),o==null||o(M)},[E,r,o,M]);d.useEffect(()=>{if(j)return;const J=D.current;(J==null?void 0:J.ownerDocument.activeElement)===J&&(J==null||J.blur())},[j]);const q=d.useCallback(J=>{I(J.currentTarget.value)},[I]),F=d.useCallback(J=>{const ie=J.key,ge={Escape:N,Enter:Ce=>{!Ce.shiftKey&&!Ce.metaKey&&$()}}[ie];ge&&(J.preventDefault(),ge(J))},[N,$]),Q=d.useCallback(J=>{const ie=J.key,ge={Escape:N}[ie];ge&&(J.preventDefault(),ge(J))},[N]),Y=E.length===0,se=d.useCallback(J=>{var ie;if(!j)return;const de=J.currentTarget.ownerDocument,ge=(ie=J.relatedTarget)!=null?ie:de.activeElement,Ce=sS(T.current,ge),he=sS(X.current,ge);!Ce&&!he&&(m?$():N())},[m,$,N,j]),ae=d.useCallback((J={},ie=null)=>{const de=B&&p?0:void 0;return{...J,ref:It(ie,A),children:Y?g:E,hidden:j,"aria-disabled":Co(i),tabIndex:de,onFocus:He(J.onFocus,V,U)}},[i,j,B,p,Y,V,U,g,E]),re=d.useCallback((J={},ie=null)=>({...J,hidden:!j,placeholder:g,ref:It(ie,D),disabled:i,"aria-disabled":Co(i),value:E,onBlur:He(J.onBlur,se),onChange:He(J.onChange,q),onKeyDown:He(J.onKeyDown,F),onFocus:He(J.onFocus,U)}),[i,j,se,q,F,U,g,E]),G=d.useCallback((J={},ie=null)=>({...J,hidden:!j,placeholder:g,ref:It(ie,D),disabled:i,"aria-disabled":Co(i),value:E,onBlur:He(J.onBlur,se),onChange:He(J.onChange,q),onKeyDown:He(J.onKeyDown,Q),onFocus:He(J.onFocus,U)}),[i,j,se,q,Q,U,g,E]),K=d.useCallback((J={},ie=null)=>({"aria-label":"Edit",...J,type:"button",onClick:He(J.onClick,V),ref:It(ie,O),disabled:i}),[V,i]),ee=d.useCallback((J={},ie=null)=>({...J,"aria-label":"Submit",ref:It(X,ie),type:"button",onClick:He(J.onClick,$),disabled:i}),[$,i]),ce=d.useCallback((J={},ie=null)=>({"aria-label":"Cancel",id:"cancel",...J,ref:It(T,ie),type:"button",onClick:He(J.onClick,N),disabled:i}),[N,i]);return{isEditing:j,isDisabled:i,isValueEmpty:Y,value:E,onEdit:V,onCancel:N,onSubmit:$,getPreviewProps:ae,getInputProps:re,getTextareaProps:G,getEditButtonProps:K,getSubmitButtonProps:ee,getCancelButtonProps:ce,htmlProps:b}}var Ih=je(function(t,n){const r=Un("Editable",t),o=on(t),{htmlProps:s,...i}=KL(o),{isEditing:l,onSubmit:u,onCancel:p,onEdit:m}=i,h=Ye("chakra-editable",t.className),g=zx(t.children,{isEditing:l,onSubmit:u,onCancel:p,onEdit:m});return a.jsx(FL,{value:i,children:a.jsx(zL,{value:r,children:a.jsx(we.div,{ref:n,...s,className:h,children:g})})})});Ih.displayName="Editable";function C5(){const{isEditing:e,getEditButtonProps:t,getCancelButtonProps:n,getSubmitButtonProps:r}=gb();return{isEditing:e,getEditButtonProps:t,getCancelButtonProps:n,getSubmitButtonProps:r}}var w5={exports:{}},qL="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",XL=qL,QL=XL;function S5(){}function k5(){}k5.resetWarningCache=S5;var YL=function(){function e(r,o,s,i,l,u){if(u!==QL){var p=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw p.name="Invariant Violation",p}}e.isRequired=e;function t(){return e}var n={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:k5,resetWarningCache:S5};return n.PropTypes=n,n};w5.exports=YL();var ZL=w5.exports;const Jt=xd(ZL);var E1="data-focus-lock",j5="data-focus-lock-disabled",JL="data-no-focus-lock",ez="data-autofocus-inside",tz="data-no-autofocus";function nz(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function rz(e,t){var n=d.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(r){var o=n.value;o!==r&&(n.value=r,n.callback(r,o))}}}})[0];return n.callback=t,n.facade}function _5(e,t){return rz(t||null,function(n){return e.forEach(function(r){return nz(r,n)})})}var iv={width:"1px",height:"0px",padding:0,overflow:"hidden",position:"fixed",top:"1px",left:"1px"},gs=function(){return gs=Object.assign||function(t){for(var n,r=1,o=arguments.length;r0&&s[s.length-1])&&(p[0]===6||p[0]===2)){n=0;continue}if(p[0]===3&&(!s||p[1]>s[0]&&p[1]0)&&!(o=r.next()).done;)s.push(o.value)}catch(l){i={error:l}}finally{try{o&&!o.done&&(n=r.return)&&n.call(r)}finally{if(i)throw i.error}}return s}function M1(e,t,n){if(n||arguments.length===2)for(var r=0,o=t.length,s;r=0}).sort(vz)},xz=["button:enabled","select:enabled","textarea:enabled","input:enabled","a[href]","area[href]","summary","iframe","object","embed","audio[controls]","video[controls]","[tabindex]","[contenteditable]","[autofocus]"],yb=xz.join(","),bz="".concat(yb,", [data-focus-guard]"),W5=function(e,t){return Rs((e.shadowRoot||e).children).reduce(function(n,r){return n.concat(r.matches(t?bz:yb)?[r]:[],W5(r))},[])},yz=function(e,t){var n;return e instanceof HTMLIFrameElement&&(!((n=e.contentDocument)===null||n===void 0)&&n.body)?Ph([e.contentDocument.body],t):[e]},Ph=function(e,t){return e.reduce(function(n,r){var o,s=W5(r,t),i=(o=[]).concat.apply(o,s.map(function(l){return yz(l,t)}));return n.concat(i,r.parentNode?Rs(r.parentNode.querySelectorAll(yb)).filter(function(l){return l===r}):[])},[])},Cz=function(e){var t=e.querySelectorAll("[".concat(ez,"]"));return Rs(t).map(function(n){return Ph([n])}).reduce(function(n,r){return n.concat(r)},[])},Cb=function(e,t){return Rs(e).filter(function(n){return L5(t,n)}).filter(function(n){return mz(n)})},iS=function(e,t){return t===void 0&&(t=new Map),Rs(e).filter(function(n){return z5(t,n)})},R1=function(e,t,n){return V5(Cb(Ph(e,n),t),!0,n)},lS=function(e,t){return V5(Cb(Ph(e),t),!1)},wz=function(e,t){return Cb(Cz(e),t)},ic=function(e,t){return e.shadowRoot?ic(e.shadowRoot,t):Object.getPrototypeOf(e).contains!==void 0&&Object.getPrototypeOf(e).contains.call(e,t)?!0:Rs(e.children).some(function(n){var r;if(n instanceof HTMLIFrameElement){var o=(r=n.contentDocument)===null||r===void 0?void 0:r.body;return o?ic(o,t):!1}return ic(n,t)})},Sz=function(e){for(var t=new Set,n=e.length,r=0;r0&&t.add(o),(s&Node.DOCUMENT_POSITION_CONTAINS)>0&&t.add(r)}return e.filter(function(i,l){return!t.has(l)})},U5=function(e){return e.parentNode?U5(e.parentNode):e},wb=function(e){var t=sm(e);return t.filter(Boolean).reduce(function(n,r){var o=r.getAttribute(E1);return n.push.apply(n,o?Sz(Rs(U5(r).querySelectorAll("[".concat(E1,'="').concat(o,'"]:not([').concat(j5,'="disabled"])')))):[r]),n},[])},kz=function(e){try{return e()}catch{return}},Qu=function(e){if(e===void 0&&(e=document),!(!e||!e.activeElement)){var t=e.activeElement;return t.shadowRoot?Qu(t.shadowRoot):t instanceof HTMLIFrameElement&&kz(function(){return t.contentWindow.document})?Qu(t.contentWindow.document):t}},jz=function(e,t){return e===t},_z=function(e,t){return!!Rs(e.querySelectorAll("iframe")).some(function(n){return jz(n,t)})},G5=function(e,t){return t===void 0&&(t=Qu(T5(e).ownerDocument)),!t||t.dataset&&t.dataset.focusGuard?!1:wb(e).some(function(n){return ic(n,t)||_z(n,t)})},Iz=function(e){e===void 0&&(e=document);var t=Qu(e);return t?Rs(e.querySelectorAll("[".concat(JL,"]"))).some(function(n){return ic(n,t)}):!1},Pz=function(e,t){return t.filter(H5).filter(function(n){return n.name===e.name}).filter(function(n){return n.checked})[0]||e},Sb=function(e,t){return H5(e)&&e.name?Pz(e,t):e},Ez=function(e){var t=new Set;return e.forEach(function(n){return t.add(Sb(n,e))}),e.filter(function(n){return t.has(n)})},cS=function(e){return e[0]&&e.length>1?Sb(e[0],e):e[0]},uS=function(e,t){return e.length>1?e.indexOf(Sb(e[t],e)):t},K5="NEW_FOCUS",Mz=function(e,t,n,r){var o=e.length,s=e[0],i=e[o-1],l=bb(n);if(!(n&&e.indexOf(n)>=0)){var u=n!==void 0?t.indexOf(n):-1,p=r?t.indexOf(r):u,m=r?e.indexOf(r):-1,h=u-p,g=t.indexOf(s),x=t.indexOf(i),y=Ez(t),b=n!==void 0?y.indexOf(n):-1,w=b-(r?y.indexOf(r):u),S=uS(e,0),j=uS(e,o-1);if(u===-1||m===-1)return K5;if(!h&&m>=0)return m;if(u<=g&&l&&Math.abs(h)>1)return j;if(u>=x&&l&&Math.abs(h)>1)return S;if(h&&Math.abs(w)>1)return m;if(u<=g)return j;if(u>x)return S;if(h)return Math.abs(h)>1?m:(o+m+h)%o}},Oz=function(e){return function(t){var n,r=(n=F5(t))===null||n===void 0?void 0:n.autofocus;return t.autofocus||r!==void 0&&r!=="false"||e.indexOf(t)>=0}},Rz=function(e,t,n){var r=e.map(function(s){var i=s.node;return i}),o=iS(r.filter(Oz(n)));return o&&o.length?cS(o):cS(iS(t))},D1=function(e,t){return t===void 0&&(t=[]),t.push(e),e.parentNode&&D1(e.parentNode.host||e.parentNode,t),t},lv=function(e,t){for(var n=D1(e),r=D1(t),o=0;o=0)return s}return!1},q5=function(e,t,n){var r=sm(e),o=sm(t),s=r[0],i=!1;return o.filter(Boolean).forEach(function(l){i=lv(i||l,l)||i,n.filter(Boolean).forEach(function(u){var p=lv(s,u);p&&(!i||ic(p,i)?i=p:i=lv(p,i))})}),i},Dz=function(e,t){return e.reduce(function(n,r){return n.concat(wz(r,t))},[])},Az=function(e,t){var n=new Map;return t.forEach(function(r){return n.set(r.node,r)}),e.map(function(r){return n.get(r)}).filter(gz)},Tz=function(e,t){var n=Qu(sm(e).length>0?document:T5(e).ownerDocument),r=wb(e).filter(am),o=q5(n||e,e,r),s=new Map,i=lS(r,s),l=R1(r,s).filter(function(x){var y=x.node;return am(y)});if(!(!l[0]&&(l=i,!l[0]))){var u=lS([o],s).map(function(x){var y=x.node;return y}),p=Az(u,l),m=p.map(function(x){var y=x.node;return y}),h=Mz(m,u,n,t);if(h===K5){var g=Rz(i,m,Dz(r,s));if(g)return{node:g};console.warn("focus-lock: cannot find any node to move focus into");return}return h===void 0?h:p[h]}},Nz=function(e){var t=wb(e).filter(am),n=q5(e,e,t),r=new Map,o=R1([n],r,!0),s=R1(t,r).filter(function(i){var l=i.node;return am(l)}).map(function(i){var l=i.node;return l});return o.map(function(i){var l=i.node,u=i.index;return{node:l,index:u,lockItem:s.indexOf(l)>=0,guard:bb(l)}})},$z=function(e,t){"focus"in e&&e.focus(t),"contentWindow"in e&&e.contentWindow&&e.contentWindow.focus()},cv=0,uv=!1,X5=function(e,t,n){n===void 0&&(n={});var r=Tz(e,t);if(!uv&&r){if(cv>2){console.error("FocusLock: focus-fighting detected. Only one focus management system could be active. See https://github.com/theKashey/focus-lock/#focus-fighting"),uv=!0,setTimeout(function(){uv=!1},1);return}cv++,$z(r.node,n.focusOptions),cv--}};function kb(e){setTimeout(e,1)}var Lz=function(){return document&&document.activeElement===document.body},zz=function(){return Lz()||Iz()},lc=null,Zl=null,cc=null,Yu=!1,Fz=function(){return!0},Bz=function(t){return(lc.whiteList||Fz)(t)},Hz=function(t,n){cc={observerNode:t,portaledElement:n}},Vz=function(t){return cc&&cc.portaledElement===t};function dS(e,t,n,r){var o=null,s=e;do{var i=r[s];if(i.guard)i.node.dataset.focusAutoGuard&&(o=i);else if(i.lockItem){if(s!==e)return;o=null}else break}while((s+=n)!==t);o&&(o.node.tabIndex=0)}var Wz=function(t){return t&&"current"in t?t.current:t},Uz=function(t){return t?!!Yu:Yu==="meanwhile"},Gz=function e(t,n,r){return n&&(n.host===t&&(!n.activeElement||r.contains(n.activeElement))||n.parentNode&&e(t,n.parentNode,r))},Kz=function(t,n){return n.some(function(r){return Gz(t,r,r)})},im=function(){var t=!1;if(lc){var n=lc,r=n.observed,o=n.persistentFocus,s=n.autoFocus,i=n.shards,l=n.crossFrame,u=n.focusOptions,p=r||cc&&cc.portaledElement,m=document&&document.activeElement;if(p){var h=[p].concat(i.map(Wz).filter(Boolean));if((!m||Bz(m))&&(o||Uz(l)||!zz()||!Zl&&s)&&(p&&!(G5(h)||m&&Kz(m,h)||Vz(m))&&(document&&!Zl&&m&&!s?(m.blur&&m.blur(),document.body.focus()):(t=X5(h,Zl,{focusOptions:u}),cc={})),Yu=!1,Zl=document&&document.activeElement),document){var g=document&&document.activeElement,x=Nz(h),y=x.map(function(b){var w=b.node;return w}).indexOf(g);y>-1&&(x.filter(function(b){var w=b.guard,S=b.node;return w&&S.dataset.focusAutoGuard}).forEach(function(b){var w=b.node;return w.removeAttribute("tabIndex")}),dS(y,x.length,1,x),dS(y,-1,-1,x))}}}return t},Q5=function(t){im()&&t&&(t.stopPropagation(),t.preventDefault())},jb=function(){return kb(im)},qz=function(t){var n=t.target,r=t.currentTarget;r.contains(n)||Hz(r,n)},Xz=function(){return null},Y5=function(){Yu="just",kb(function(){Yu="meanwhile"})},Qz=function(){document.addEventListener("focusin",Q5),document.addEventListener("focusout",jb),window.addEventListener("blur",Y5)},Yz=function(){document.removeEventListener("focusin",Q5),document.removeEventListener("focusout",jb),window.removeEventListener("blur",Y5)};function Zz(e){return e.filter(function(t){var n=t.disabled;return!n})}function Jz(e){var t=e.slice(-1)[0];t&&!lc&&Qz();var n=lc,r=n&&t&&t.id===n.id;lc=t,n&&!r&&(n.onDeactivation(),e.filter(function(o){var s=o.id;return s===n.id}).length||n.returnFocus(!t)),t?(Zl=null,(!r||n.observed!==t.observed)&&t.onActivation(),im(),kb(im)):(Yz(),Zl=null)}R5.assignSyncMedium(qz);D5.assignMedium(jb);sz.assignMedium(function(e){return e({moveFocusInside:X5,focusInside:G5})});const eF=cz(Zz,Jz)(Xz);var Z5=d.forwardRef(function(t,n){return d.createElement(A5,mn({sideCar:eF,ref:n},t))}),J5=A5.propTypes||{};J5.sideCar;a$(J5,["sideCar"]);Z5.propTypes={};const fS=Z5;function e3(e){return e!=null&&typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.ELEMENT_NODE}function _b(e){var t;if(!e3(e))return!1;const n=(t=e.ownerDocument.defaultView)!=null?t:window;return e instanceof n.HTMLElement}function tF(e){var t,n;return(n=(t=t3(e))==null?void 0:t.defaultView)!=null?n:window}function t3(e){return e3(e)?e.ownerDocument:document}function nF(e){return t3(e).activeElement}function rF(e){const t=e.ownerDocument.defaultView||window,{overflow:n,overflowX:r,overflowY:o}=t.getComputedStyle(e);return/auto|scroll|overlay|hidden/.test(n+o+r)}function oF(e){return e.localName==="html"?e:e.assignedSlot||e.parentElement||e.ownerDocument.documentElement}function n3(e){return["html","body","#document"].includes(e.localName)?e.ownerDocument.body:_b(e)&&rF(e)?e:n3(oF(e))}var r3=e=>e.hasAttribute("tabindex"),sF=e=>r3(e)&&e.tabIndex===-1;function aF(e){return!!e.getAttribute("disabled")||!!e.getAttribute("aria-disabled")}function o3(e){return e.parentElement&&o3(e.parentElement)?!0:e.hidden}function iF(e){const t=e.getAttribute("contenteditable");return t!=="false"&&t!=null}function s3(e){if(!_b(e)||o3(e)||aF(e))return!1;const{localName:t}=e;if(["input","select","textarea","button"].indexOf(t)>=0)return!0;const r={a:()=>e.hasAttribute("href"),audio:()=>e.hasAttribute("controls"),video:()=>e.hasAttribute("controls")};return t in r?r[t]():iF(e)?!0:r3(e)}function lF(e){return e?_b(e)&&s3(e)&&!sF(e):!1}var cF=["input:not(:disabled):not([disabled])","select:not(:disabled):not([disabled])","textarea:not(:disabled):not([disabled])","embed","iframe","object","a[href]","area[href]","button:not(:disabled):not([disabled])","[tabindex]","audio[controls]","video[controls]","*[tabindex]:not([aria-disabled])","*[contenteditable]"],uF=cF.join(),dF=e=>e.offsetWidth>0&&e.offsetHeight>0;function a3(e){const t=Array.from(e.querySelectorAll(uF));return t.unshift(e),t.filter(n=>s3(n)&&dF(n))}var pS,fF=(pS=fS.default)!=null?pS:fS,i3=e=>{const{initialFocusRef:t,finalFocusRef:n,contentRef:r,restoreFocus:o,children:s,isDisabled:i,autoFocus:l,persistentFocus:u,lockFocusAcrossFrames:p}=e,m=d.useCallback(()=>{t!=null&&t.current?t.current.focus():r!=null&&r.current&&a3(r.current).length===0&&requestAnimationFrame(()=>{var y;(y=r.current)==null||y.focus()})},[t,r]),h=d.useCallback(()=>{var x;(x=n==null?void 0:n.current)==null||x.focus()},[n]),g=o&&!n;return a.jsx(fF,{crossFrame:p,persistentFocus:u,autoFocus:l,disabled:i,onActivation:m,onDeactivation:h,returnFocus:g,children:s})};i3.displayName="FocusLock";var pF=j$?d.useLayoutEffect:d.useEffect;function A1(e,t=[]){const n=d.useRef(e);return pF(()=>{n.current=e}),d.useCallback((...r)=>{var o;return(o=n.current)==null?void 0:o.call(n,...r)},t)}function mF(e,t,n,r){const o=A1(t);return d.useEffect(()=>{var s;const i=(s=ZC(n))!=null?s:document;if(t)return i.addEventListener(e,o,r),()=>{i.removeEventListener(e,o,r)}},[e,n,r,o,t]),()=>{var s;((s=ZC(n))!=null?s:document).removeEventListener(e,o,r)}}function hF(e,t){const n=d.useId();return d.useMemo(()=>e||[t,n].filter(Boolean).join("-"),[e,t,n])}function gF(e,t){const n=e!==void 0;return[n,n&&typeof e<"u"?e:t]}function Lr(e={}){const{onClose:t,onOpen:n,isOpen:r,id:o}=e,s=A1(n),i=A1(t),[l,u]=d.useState(e.defaultIsOpen||!1),[p,m]=gF(r,l),h=hF(o,"disclosure"),g=d.useCallback(()=>{p||u(!1),i==null||i()},[p,i]),x=d.useCallback(()=>{p||u(!0),s==null||s()},[p,s]),y=d.useCallback(()=>{(m?g:x)()},[m,x,g]);return{isOpen:!!m,onOpen:x,onClose:g,onToggle:y,isControlled:p,getButtonProps:(b={})=>({...b,"aria-expanded":m,"aria-controls":h,onClick:BR(b.onClick,y)}),getDisclosureProps:(b={})=>({...b,hidden:!m,id:h})}}var[vF,xF]=Wt({name:"InputGroupStylesContext",errorMessage:`useInputGroupStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),l3=je(function(t,n){const r=Un("Input",t),{children:o,className:s,...i}=on(t),l=Ye("chakra-input__group",s),u={},p=kh(o),m=r.field;p.forEach(g=>{var x,y;r&&(m&&g.type.id==="InputLeftElement"&&(u.paddingStart=(x=m.height)!=null?x:m.h),m&&g.type.id==="InputRightElement"&&(u.paddingEnd=(y=m.height)!=null?y:m.h),g.type.id==="InputRightAddon"&&(u.borderEndRadius=0),g.type.id==="InputLeftAddon"&&(u.borderStartRadius=0))});const h=p.map(g=>{var x,y;const b=Z_({size:((x=g.props)==null?void 0:x.size)||t.size,variant:((y=g.props)==null?void 0:y.variant)||t.variant});return g.type.id!=="Input"?d.cloneElement(g,b):d.cloneElement(g,Object.assign(b,u,g.props))});return a.jsx(we.div,{className:l,ref:n,__css:{width:"100%",display:"flex",position:"relative",isolation:"isolate",...r.group},"data-group":!0,...i,children:a.jsx(vF,{value:r,children:h})})});l3.displayName="InputGroup";var bF=we("div",{baseStyle:{display:"flex",alignItems:"center",justifyContent:"center",position:"absolute",top:"0",zIndex:2}}),Eh=je(function(t,n){var r,o;const{placement:s="left",...i}=t,l=xF(),u=l.field,m={[s==="left"?"insetStart":"insetEnd"]:"0",width:(r=u==null?void 0:u.height)!=null?r:u==null?void 0:u.h,height:(o=u==null?void 0:u.height)!=null?o:u==null?void 0:u.h,fontSize:u==null?void 0:u.fontSize,...l.element};return a.jsx(bF,{ref:n,__css:m,...i})});Eh.id="InputElement";Eh.displayName="InputElement";var c3=je(function(t,n){const{className:r,...o}=t,s=Ye("chakra-input__left-element",r);return a.jsx(Eh,{ref:n,placement:"left",className:s,...o})});c3.id="InputLeftElement";c3.displayName="InputLeftElement";var Ib=je(function(t,n){const{className:r,...o}=t,s=Ye("chakra-input__right-element",r);return a.jsx(Eh,{ref:n,placement:"right",className:s,...o})});Ib.id="InputRightElement";Ib.displayName="InputRightElement";var Mh=je(function(t,n){const{htmlSize:r,...o}=t,s=Un("Input",o),i=on(o),l=db(i),u=Ye("chakra-input",t.className);return a.jsx(we.input,{size:r,...l,__css:s.field,ref:n,className:u})});Mh.displayName="Input";Mh.id="Input";var Oh=je(function(t,n){const r=oi("Link",t),{className:o,isExternal:s,...i}=on(t);return a.jsx(we.a,{target:s?"_blank":void 0,rel:s?"noopener":void 0,ref:n,className:Ye("chakra-link",o),...i,__css:r})});Oh.displayName="Link";var[yF,u3]=Wt({name:"ListStylesContext",errorMessage:`useListStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),Pb=je(function(t,n){const r=Un("List",t),{children:o,styleType:s="none",stylePosition:i,spacing:l,...u}=on(t),p=kh(o),h=l?{["& > *:not(style) ~ *:not(style)"]:{mt:l}}:{};return a.jsx(yF,{value:r,children:a.jsx(we.ul,{ref:n,listStyleType:s,listStylePosition:i,role:"list",__css:{...r.container,...h},...u,children:p})})});Pb.displayName="List";var d3=je((e,t)=>{const{as:n,...r}=e;return a.jsx(Pb,{ref:t,as:"ol",styleType:"decimal",marginStart:"1em",...r})});d3.displayName="OrderedList";var Od=je(function(t,n){const{as:r,...o}=t;return a.jsx(Pb,{ref:n,as:"ul",styleType:"initial",marginStart:"1em",...o})});Od.displayName="UnorderedList";var Qr=je(function(t,n){const r=u3();return a.jsx(we.li,{ref:n,...t,__css:r.item})});Qr.displayName="ListItem";var CF=je(function(t,n){const r=u3();return a.jsx(Nn,{ref:n,role:"presentation",...t,__css:r.icon})});CF.displayName="ListIcon";var Ja=je(function(t,n){const{templateAreas:r,gap:o,rowGap:s,columnGap:i,column:l,row:u,autoFlow:p,autoRows:m,templateRows:h,autoColumns:g,templateColumns:x,...y}=t,b={display:"grid",gridTemplateAreas:r,gridGap:o,gridRowGap:s,gridColumnGap:i,gridAutoColumns:g,gridColumn:l,gridRow:u,gridAutoFlow:p,gridAutoRows:m,gridTemplateRows:h,gridTemplateColumns:x};return a.jsx(we.div,{ref:n,__css:b,...y})});Ja.displayName="Grid";function f3(e,t){return Array.isArray(e)?e.map(n=>n===null?null:t(n)):a1(e)?Object.keys(e).reduce((n,r)=>(n[r]=t(e[r]),n),{}):e!=null?t(e):null}var ba=we("div",{baseStyle:{flex:1,justifySelf:"stretch",alignSelf:"stretch"}});ba.displayName="Spacer";var p3=e=>a.jsx(we.div,{className:"chakra-stack__item",...e,__css:{display:"inline-block",flex:"0 0 auto",minWidth:0,...e.__css}});p3.displayName="StackItem";function wF(e){const{spacing:t,direction:n}=e,r={column:{my:t,mx:0,borderLeftWidth:0,borderBottomWidth:"1px"},"column-reverse":{my:t,mx:0,borderLeftWidth:0,borderBottomWidth:"1px"},row:{mx:t,my:0,borderLeftWidth:"1px",borderBottomWidth:0},"row-reverse":{mx:t,my:0,borderLeftWidth:"1px",borderBottomWidth:0}};return{"&":f3(n,o=>r[o])}}var Eb=je((e,t)=>{const{isInline:n,direction:r,align:o,justify:s,spacing:i="0.5rem",wrap:l,children:u,divider:p,className:m,shouldWrapChildren:h,...g}=e,x=n?"row":r??"column",y=d.useMemo(()=>wF({spacing:i,direction:x}),[i,x]),b=!!p,w=!h&&!b,S=d.useMemo(()=>{const _=kh(u);return w?_:_.map((E,I)=>{const M=typeof E.key<"u"?E.key:I,R=I+1===_.length,A=h?a.jsx(p3,{children:E},M):E;if(!b)return A;const O=d.cloneElement(p,{__css:y}),T=R?null:O;return a.jsxs(d.Fragment,{children:[A,T]},M)})},[p,y,b,w,h,u]),j=Ye("chakra-stack",m);return a.jsx(we.div,{ref:t,display:"flex",alignItems:o,justifyContent:s,flexDirection:x,flexWrap:l,gap:b?void 0:i,className:j,...g,children:S})});Eb.displayName="Stack";var m3=je((e,t)=>a.jsx(Eb,{align:"center",...e,direction:"column",ref:t}));m3.displayName="VStack";var Rh=je((e,t)=>a.jsx(Eb,{align:"center",...e,direction:"row",ref:t}));Rh.displayName="HStack";function mS(e){return f3(e,t=>t==="auto"?"auto":`span ${t}/span ${t}`)}var Zu=je(function(t,n){const{area:r,colSpan:o,colStart:s,colEnd:i,rowEnd:l,rowSpan:u,rowStart:p,...m}=t,h=Z_({gridArea:r,gridColumn:mS(o),gridRow:mS(u),gridColumnStart:s,gridColumnEnd:i,gridRowStart:p,gridRowEnd:l});return a.jsx(we.div,{ref:n,__css:h,...m})});Zu.displayName="GridItem";var Ds=je(function(t,n){const r=oi("Badge",t),{className:o,...s}=on(t);return a.jsx(we.span,{ref:n,className:Ye("chakra-badge",t.className),...s,__css:{display:"inline-block",whiteSpace:"nowrap",verticalAlign:"middle",...r}})});Ds.displayName="Badge";var Yn=je(function(t,n){const{borderLeftWidth:r,borderBottomWidth:o,borderTopWidth:s,borderRightWidth:i,borderWidth:l,borderStyle:u,borderColor:p,...m}=oi("Divider",t),{className:h,orientation:g="horizontal",__css:x,...y}=on(t),b={vertical:{borderLeftWidth:r||i||l||"1px",height:"100%"},horizontal:{borderBottomWidth:o||s||l||"1px",width:"100%"}};return a.jsx(we.hr,{ref:n,"aria-orientation":g,...y,__css:{...m,border:"0",borderColor:p,borderStyle:u,...b[g],...x},className:Ye("chakra-divider",h)})});Yn.displayName="Divider";function SF(e){const{key:t}=e;return t.length===1||t.length>1&&/[^a-zA-Z0-9]/.test(t)}function kF(e={}){const{timeout:t=300,preventDefault:n=()=>!0}=e,[r,o]=d.useState([]),s=d.useRef(),i=()=>{s.current&&(clearTimeout(s.current),s.current=null)},l=()=>{i(),s.current=setTimeout(()=>{o([]),s.current=null},t)};d.useEffect(()=>i,[]);function u(p){return m=>{if(m.key==="Backspace"){const h=[...r];h.pop(),o(h);return}if(SF(m)){const h=r.concat(m.key);n(m)&&(m.preventDefault(),m.stopPropagation()),o(h),p(h.join("")),l()}}}return u}function jF(e,t,n,r){if(t==null)return r;if(!r)return e.find(i=>n(i).toLowerCase().startsWith(t.toLowerCase()));const o=e.filter(s=>n(s).toLowerCase().startsWith(t.toLowerCase()));if(o.length>0){let s;return o.includes(r)?(s=o.indexOf(r)+1,s===o.length&&(s=0),o[s]):(s=e.indexOf(o[0]),e[s])}return r}function _F(){const e=d.useRef(new Map),t=e.current,n=d.useCallback((o,s,i,l)=>{e.current.set(i,{type:s,el:o,options:l}),o.addEventListener(s,i,l)},[]),r=d.useCallback((o,s,i,l)=>{o.removeEventListener(s,i,l),e.current.delete(i)},[]);return d.useEffect(()=>()=>{t.forEach((o,s)=>{r(o.el,o.type,s,o.options)})},[r,t]),{add:n,remove:r}}function dv(e){const t=e.target,{tagName:n,isContentEditable:r}=t;return n!=="INPUT"&&n!=="TEXTAREA"&&r!==!0}function h3(e={}){const{ref:t,isDisabled:n,isFocusable:r,clickOnEnter:o=!0,clickOnSpace:s=!0,onMouseDown:i,onMouseUp:l,onClick:u,onKeyDown:p,onKeyUp:m,tabIndex:h,onMouseOver:g,onMouseLeave:x,...y}=e,[b,w]=d.useState(!0),[S,j]=d.useState(!1),_=_F(),E=$=>{$&&$.tagName!=="BUTTON"&&w(!1)},I=b?h:h||0,M=n&&!r,R=d.useCallback($=>{if(n){$.stopPropagation(),$.preventDefault();return}$.currentTarget.focus(),u==null||u($)},[n,u]),D=d.useCallback($=>{S&&dv($)&&($.preventDefault(),$.stopPropagation(),j(!1),_.remove(document,"keyup",D,!1))},[S,_]),A=d.useCallback($=>{if(p==null||p($),n||$.defaultPrevented||$.metaKey||!dv($.nativeEvent)||b)return;const q=o&&$.key==="Enter";s&&$.key===" "&&($.preventDefault(),j(!0)),q&&($.preventDefault(),$.currentTarget.click()),_.add(document,"keyup",D,!1)},[n,b,p,o,s,_,D]),O=d.useCallback($=>{if(m==null||m($),n||$.defaultPrevented||$.metaKey||!dv($.nativeEvent)||b)return;s&&$.key===" "&&($.preventDefault(),j(!1),$.currentTarget.click())},[s,b,n,m]),T=d.useCallback($=>{$.button===0&&(j(!1),_.remove(document,"mouseup",T,!1))},[_]),X=d.useCallback($=>{if($.button!==0)return;if(n){$.stopPropagation(),$.preventDefault();return}b||j(!0),$.currentTarget.focus({preventScroll:!0}),_.add(document,"mouseup",T,!1),i==null||i($)},[n,b,i,_,T]),B=d.useCallback($=>{$.button===0&&(b||j(!1),l==null||l($))},[l,b]),V=d.useCallback($=>{if(n){$.preventDefault();return}g==null||g($)},[n,g]),U=d.useCallback($=>{S&&($.preventDefault(),j(!1)),x==null||x($)},[S,x]),N=It(t,E);return b?{...y,ref:N,type:"button","aria-disabled":M?void 0:n,disabled:M,onClick:R,onMouseDown:i,onMouseUp:l,onKeyUp:m,onKeyDown:p,onMouseOver:g,onMouseLeave:x}:{...y,ref:N,role:"button","data-active":dt(S),"aria-disabled":n?"true":void 0,tabIndex:M?void 0:I,onClick:R,onMouseDown:X,onMouseUp:B,onKeyUp:O,onKeyDown:A,onMouseOver:V,onMouseLeave:U}}function IF(e){const t=e.current;if(!t)return!1;const n=nF(t);return!n||t.contains(n)?!1:!!lF(n)}function g3(e,t){const{shouldFocus:n,visible:r,focusRef:o}=t,s=n&&!r;pa(()=>{if(!s||IF(e))return;const i=(o==null?void 0:o.current)||e.current;let l;if(i)return l=requestAnimationFrame(()=>{i.focus({preventScroll:!0})}),()=>{cancelAnimationFrame(l)}},[s,e,o])}var PF={preventScroll:!0,shouldFocus:!1};function EF(e,t=PF){const{focusRef:n,preventScroll:r,shouldFocus:o,visible:s}=t,i=MF(e)?e.current:e,l=o&&s,u=d.useRef(l),p=d.useRef(s);rc(()=>{!p.current&&s&&(u.current=l),p.current=s},[s,l]);const m=d.useCallback(()=>{if(!(!s||!i||!u.current)&&(u.current=!1,!i.contains(document.activeElement)))if(n!=null&&n.current)requestAnimationFrame(()=>{var h;(h=n.current)==null||h.focus({preventScroll:r})});else{const h=a3(i);h.length>0&&requestAnimationFrame(()=>{h[0].focus({preventScroll:r})})}},[s,r,i,n]);pa(()=>{m()},[m]),Di(i,"transitionend",m)}function MF(e){return"current"in e}var Rl=(e,t)=>({var:e,varRef:t?`var(${e}, ${t})`:`var(${e})`}),$n={arrowShadowColor:Rl("--popper-arrow-shadow-color"),arrowSize:Rl("--popper-arrow-size","8px"),arrowSizeHalf:Rl("--popper-arrow-size-half"),arrowBg:Rl("--popper-arrow-bg"),transformOrigin:Rl("--popper-transform-origin"),arrowOffset:Rl("--popper-arrow-offset")};function OF(e){if(e.includes("top"))return"1px 1px 0px 0 var(--popper-arrow-shadow-color)";if(e.includes("bottom"))return"-1px -1px 0px 0 var(--popper-arrow-shadow-color)";if(e.includes("right"))return"-1px 1px 0px 0 var(--popper-arrow-shadow-color)";if(e.includes("left"))return"1px -1px 0px 0 var(--popper-arrow-shadow-color)"}var RF={top:"bottom center","top-start":"bottom left","top-end":"bottom right",bottom:"top center","bottom-start":"top left","bottom-end":"top right",left:"right center","left-start":"right top","left-end":"right bottom",right:"left center","right-start":"left top","right-end":"left bottom"},DF=e=>RF[e],hS={scroll:!0,resize:!0};function AF(e){let t;return typeof e=="object"?t={enabled:!0,options:{...hS,...e}}:t={enabled:e,options:hS},t}var TF={name:"matchWidth",enabled:!0,phase:"beforeWrite",requires:["computeStyles"],fn:({state:e})=>{e.styles.popper.width=`${e.rects.reference.width}px`},effect:({state:e})=>()=>{const t=e.elements.reference;e.elements.popper.style.width=`${t.offsetWidth}px`}},NF={name:"transformOrigin",enabled:!0,phase:"write",fn:({state:e})=>{gS(e)},effect:({state:e})=>()=>{gS(e)}},gS=e=>{e.elements.popper.style.setProperty($n.transformOrigin.var,DF(e.placement))},$F={name:"positionArrow",enabled:!0,phase:"afterWrite",fn:({state:e})=>{LF(e)}},LF=e=>{var t;if(!e.placement)return;const n=zF(e.placement);if((t=e.elements)!=null&&t.arrow&&n){Object.assign(e.elements.arrow.style,{[n.property]:n.value,width:$n.arrowSize.varRef,height:$n.arrowSize.varRef,zIndex:-1});const r={[$n.arrowSizeHalf.var]:`calc(${$n.arrowSize.varRef} / 2 - 1px)`,[$n.arrowOffset.var]:`calc(${$n.arrowSizeHalf.varRef} * -1)`};for(const o in r)e.elements.arrow.style.setProperty(o,r[o])}},zF=e=>{if(e.startsWith("top"))return{property:"bottom",value:$n.arrowOffset.varRef};if(e.startsWith("bottom"))return{property:"top",value:$n.arrowOffset.varRef};if(e.startsWith("left"))return{property:"right",value:$n.arrowOffset.varRef};if(e.startsWith("right"))return{property:"left",value:$n.arrowOffset.varRef}},FF={name:"innerArrow",enabled:!0,phase:"main",requires:["arrow"],fn:({state:e})=>{vS(e)},effect:({state:e})=>()=>{vS(e)}},vS=e=>{if(!e.elements.arrow)return;const t=e.elements.arrow.querySelector("[data-popper-arrow-inner]");if(!t)return;const n=OF(e.placement);n&&t.style.setProperty("--popper-arrow-default-shadow",n),Object.assign(t.style,{transform:"rotate(45deg)",background:$n.arrowBg.varRef,top:0,left:0,width:"100%",height:"100%",position:"absolute",zIndex:"inherit",boxShadow:"var(--popper-arrow-shadow, var(--popper-arrow-default-shadow))"})},BF={"start-start":{ltr:"left-start",rtl:"right-start"},"start-end":{ltr:"left-end",rtl:"right-end"},"end-start":{ltr:"right-start",rtl:"left-start"},"end-end":{ltr:"right-end",rtl:"left-end"},start:{ltr:"left",rtl:"right"},end:{ltr:"right",rtl:"left"}},HF={"auto-start":"auto-end","auto-end":"auto-start","top-start":"top-end","top-end":"top-start","bottom-start":"bottom-end","bottom-end":"bottom-start"};function VF(e,t="ltr"){var n,r;const o=((n=BF[e])==null?void 0:n[t])||e;return t==="ltr"?o:(r=HF[e])!=null?r:o}var Dr="top",ko="bottom",jo="right",Ar="left",Mb="auto",Rd=[Dr,ko,jo,Ar],xc="start",Ju="end",WF="clippingParents",v3="viewport",Cu="popper",UF="reference",xS=Rd.reduce(function(e,t){return e.concat([t+"-"+xc,t+"-"+Ju])},[]),x3=[].concat(Rd,[Mb]).reduce(function(e,t){return e.concat([t,t+"-"+xc,t+"-"+Ju])},[]),GF="beforeRead",KF="read",qF="afterRead",XF="beforeMain",QF="main",YF="afterMain",ZF="beforeWrite",JF="write",eB="afterWrite",tB=[GF,KF,qF,XF,QF,YF,ZF,JF,eB];function ws(e){return e?(e.nodeName||"").toLowerCase():null}function no(e){if(e==null)return window;if(e.toString()!=="[object Window]"){var t=e.ownerDocument;return t&&t.defaultView||window}return e}function Ui(e){var t=no(e).Element;return e instanceof t||e instanceof Element}function wo(e){var t=no(e).HTMLElement;return e instanceof t||e instanceof HTMLElement}function Ob(e){if(typeof ShadowRoot>"u")return!1;var t=no(e).ShadowRoot;return e instanceof t||e instanceof ShadowRoot}function nB(e){var t=e.state;Object.keys(t.elements).forEach(function(n){var r=t.styles[n]||{},o=t.attributes[n]||{},s=t.elements[n];!wo(s)||!ws(s)||(Object.assign(s.style,r),Object.keys(o).forEach(function(i){var l=o[i];l===!1?s.removeAttribute(i):s.setAttribute(i,l===!0?"":l)}))})}function rB(e){var t=e.state,n={popper:{position:t.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(t.elements.popper.style,n.popper),t.styles=n,t.elements.arrow&&Object.assign(t.elements.arrow.style,n.arrow),function(){Object.keys(t.elements).forEach(function(r){var o=t.elements[r],s=t.attributes[r]||{},i=Object.keys(t.styles.hasOwnProperty(r)?t.styles[r]:n[r]),l=i.reduce(function(u,p){return u[p]="",u},{});!wo(o)||!ws(o)||(Object.assign(o.style,l),Object.keys(s).forEach(function(u){o.removeAttribute(u)}))})}}const oB={name:"applyStyles",enabled:!0,phase:"write",fn:nB,effect:rB,requires:["computeStyles"]};function Cs(e){return e.split("-")[0]}var Ai=Math.max,lm=Math.min,bc=Math.round;function T1(){var e=navigator.userAgentData;return e!=null&&e.brands&&Array.isArray(e.brands)?e.brands.map(function(t){return t.brand+"/"+t.version}).join(" "):navigator.userAgent}function b3(){return!/^((?!chrome|android).)*safari/i.test(T1())}function yc(e,t,n){t===void 0&&(t=!1),n===void 0&&(n=!1);var r=e.getBoundingClientRect(),o=1,s=1;t&&wo(e)&&(o=e.offsetWidth>0&&bc(r.width)/e.offsetWidth||1,s=e.offsetHeight>0&&bc(r.height)/e.offsetHeight||1);var i=Ui(e)?no(e):window,l=i.visualViewport,u=!b3()&&n,p=(r.left+(u&&l?l.offsetLeft:0))/o,m=(r.top+(u&&l?l.offsetTop:0))/s,h=r.width/o,g=r.height/s;return{width:h,height:g,top:m,right:p+h,bottom:m+g,left:p,x:p,y:m}}function Rb(e){var t=yc(e),n=e.offsetWidth,r=e.offsetHeight;return Math.abs(t.width-n)<=1&&(n=t.width),Math.abs(t.height-r)<=1&&(r=t.height),{x:e.offsetLeft,y:e.offsetTop,width:n,height:r}}function y3(e,t){var n=t.getRootNode&&t.getRootNode();if(e.contains(t))return!0;if(n&&Ob(n)){var r=t;do{if(r&&e.isSameNode(r))return!0;r=r.parentNode||r.host}while(r)}return!1}function aa(e){return no(e).getComputedStyle(e)}function sB(e){return["table","td","th"].indexOf(ws(e))>=0}function ai(e){return((Ui(e)?e.ownerDocument:e.document)||window.document).documentElement}function Dh(e){return ws(e)==="html"?e:e.assignedSlot||e.parentNode||(Ob(e)?e.host:null)||ai(e)}function bS(e){return!wo(e)||aa(e).position==="fixed"?null:e.offsetParent}function aB(e){var t=/firefox/i.test(T1()),n=/Trident/i.test(T1());if(n&&wo(e)){var r=aa(e);if(r.position==="fixed")return null}var o=Dh(e);for(Ob(o)&&(o=o.host);wo(o)&&["html","body"].indexOf(ws(o))<0;){var s=aa(o);if(s.transform!=="none"||s.perspective!=="none"||s.contain==="paint"||["transform","perspective"].indexOf(s.willChange)!==-1||t&&s.willChange==="filter"||t&&s.filter&&s.filter!=="none")return o;o=o.parentNode}return null}function Dd(e){for(var t=no(e),n=bS(e);n&&sB(n)&&aa(n).position==="static";)n=bS(n);return n&&(ws(n)==="html"||ws(n)==="body"&&aa(n).position==="static")?t:n||aB(e)||t}function Db(e){return["top","bottom"].indexOf(e)>=0?"x":"y"}function Fu(e,t,n){return Ai(e,lm(t,n))}function iB(e,t,n){var r=Fu(e,t,n);return r>n?n:r}function C3(){return{top:0,right:0,bottom:0,left:0}}function w3(e){return Object.assign({},C3(),e)}function S3(e,t){return t.reduce(function(n,r){return n[r]=e,n},{})}var lB=function(t,n){return t=typeof t=="function"?t(Object.assign({},n.rects,{placement:n.placement})):t,w3(typeof t!="number"?t:S3(t,Rd))};function cB(e){var t,n=e.state,r=e.name,o=e.options,s=n.elements.arrow,i=n.modifiersData.popperOffsets,l=Cs(n.placement),u=Db(l),p=[Ar,jo].indexOf(l)>=0,m=p?"height":"width";if(!(!s||!i)){var h=lB(o.padding,n),g=Rb(s),x=u==="y"?Dr:Ar,y=u==="y"?ko:jo,b=n.rects.reference[m]+n.rects.reference[u]-i[u]-n.rects.popper[m],w=i[u]-n.rects.reference[u],S=Dd(s),j=S?u==="y"?S.clientHeight||0:S.clientWidth||0:0,_=b/2-w/2,E=h[x],I=j-g[m]-h[y],M=j/2-g[m]/2+_,R=Fu(E,M,I),D=u;n.modifiersData[r]=(t={},t[D]=R,t.centerOffset=R-M,t)}}function uB(e){var t=e.state,n=e.options,r=n.element,o=r===void 0?"[data-popper-arrow]":r;o!=null&&(typeof o=="string"&&(o=t.elements.popper.querySelector(o),!o)||y3(t.elements.popper,o)&&(t.elements.arrow=o))}const dB={name:"arrow",enabled:!0,phase:"main",fn:cB,effect:uB,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function Cc(e){return e.split("-")[1]}var fB={top:"auto",right:"auto",bottom:"auto",left:"auto"};function pB(e,t){var n=e.x,r=e.y,o=t.devicePixelRatio||1;return{x:bc(n*o)/o||0,y:bc(r*o)/o||0}}function yS(e){var t,n=e.popper,r=e.popperRect,o=e.placement,s=e.variation,i=e.offsets,l=e.position,u=e.gpuAcceleration,p=e.adaptive,m=e.roundOffsets,h=e.isFixed,g=i.x,x=g===void 0?0:g,y=i.y,b=y===void 0?0:y,w=typeof m=="function"?m({x,y:b}):{x,y:b};x=w.x,b=w.y;var S=i.hasOwnProperty("x"),j=i.hasOwnProperty("y"),_=Ar,E=Dr,I=window;if(p){var M=Dd(n),R="clientHeight",D="clientWidth";if(M===no(n)&&(M=ai(n),aa(M).position!=="static"&&l==="absolute"&&(R="scrollHeight",D="scrollWidth")),M=M,o===Dr||(o===Ar||o===jo)&&s===Ju){E=ko;var A=h&&M===I&&I.visualViewport?I.visualViewport.height:M[R];b-=A-r.height,b*=u?1:-1}if(o===Ar||(o===Dr||o===ko)&&s===Ju){_=jo;var O=h&&M===I&&I.visualViewport?I.visualViewport.width:M[D];x-=O-r.width,x*=u?1:-1}}var T=Object.assign({position:l},p&&fB),X=m===!0?pB({x,y:b},no(n)):{x,y:b};if(x=X.x,b=X.y,u){var B;return Object.assign({},T,(B={},B[E]=j?"0":"",B[_]=S?"0":"",B.transform=(I.devicePixelRatio||1)<=1?"translate("+x+"px, "+b+"px)":"translate3d("+x+"px, "+b+"px, 0)",B))}return Object.assign({},T,(t={},t[E]=j?b+"px":"",t[_]=S?x+"px":"",t.transform="",t))}function mB(e){var t=e.state,n=e.options,r=n.gpuAcceleration,o=r===void 0?!0:r,s=n.adaptive,i=s===void 0?!0:s,l=n.roundOffsets,u=l===void 0?!0:l,p={placement:Cs(t.placement),variation:Cc(t.placement),popper:t.elements.popper,popperRect:t.rects.popper,gpuAcceleration:o,isFixed:t.options.strategy==="fixed"};t.modifiersData.popperOffsets!=null&&(t.styles.popper=Object.assign({},t.styles.popper,yS(Object.assign({},p,{offsets:t.modifiersData.popperOffsets,position:t.options.strategy,adaptive:i,roundOffsets:u})))),t.modifiersData.arrow!=null&&(t.styles.arrow=Object.assign({},t.styles.arrow,yS(Object.assign({},p,{offsets:t.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:u})))),t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-placement":t.placement})}const hB={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:mB,data:{}};var Jf={passive:!0};function gB(e){var t=e.state,n=e.instance,r=e.options,o=r.scroll,s=o===void 0?!0:o,i=r.resize,l=i===void 0?!0:i,u=no(t.elements.popper),p=[].concat(t.scrollParents.reference,t.scrollParents.popper);return s&&p.forEach(function(m){m.addEventListener("scroll",n.update,Jf)}),l&&u.addEventListener("resize",n.update,Jf),function(){s&&p.forEach(function(m){m.removeEventListener("scroll",n.update,Jf)}),l&&u.removeEventListener("resize",n.update,Jf)}}const vB={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:gB,data:{}};var xB={left:"right",right:"left",bottom:"top",top:"bottom"};function Np(e){return e.replace(/left|right|bottom|top/g,function(t){return xB[t]})}var bB={start:"end",end:"start"};function CS(e){return e.replace(/start|end/g,function(t){return bB[t]})}function Ab(e){var t=no(e),n=t.pageXOffset,r=t.pageYOffset;return{scrollLeft:n,scrollTop:r}}function Tb(e){return yc(ai(e)).left+Ab(e).scrollLeft}function yB(e,t){var n=no(e),r=ai(e),o=n.visualViewport,s=r.clientWidth,i=r.clientHeight,l=0,u=0;if(o){s=o.width,i=o.height;var p=b3();(p||!p&&t==="fixed")&&(l=o.offsetLeft,u=o.offsetTop)}return{width:s,height:i,x:l+Tb(e),y:u}}function CB(e){var t,n=ai(e),r=Ab(e),o=(t=e.ownerDocument)==null?void 0:t.body,s=Ai(n.scrollWidth,n.clientWidth,o?o.scrollWidth:0,o?o.clientWidth:0),i=Ai(n.scrollHeight,n.clientHeight,o?o.scrollHeight:0,o?o.clientHeight:0),l=-r.scrollLeft+Tb(e),u=-r.scrollTop;return aa(o||n).direction==="rtl"&&(l+=Ai(n.clientWidth,o?o.clientWidth:0)-s),{width:s,height:i,x:l,y:u}}function Nb(e){var t=aa(e),n=t.overflow,r=t.overflowX,o=t.overflowY;return/auto|scroll|overlay|hidden/.test(n+o+r)}function k3(e){return["html","body","#document"].indexOf(ws(e))>=0?e.ownerDocument.body:wo(e)&&Nb(e)?e:k3(Dh(e))}function Bu(e,t){var n;t===void 0&&(t=[]);var r=k3(e),o=r===((n=e.ownerDocument)==null?void 0:n.body),s=no(r),i=o?[s].concat(s.visualViewport||[],Nb(r)?r:[]):r,l=t.concat(i);return o?l:l.concat(Bu(Dh(i)))}function N1(e){return Object.assign({},e,{left:e.x,top:e.y,right:e.x+e.width,bottom:e.y+e.height})}function wB(e,t){var n=yc(e,!1,t==="fixed");return n.top=n.top+e.clientTop,n.left=n.left+e.clientLeft,n.bottom=n.top+e.clientHeight,n.right=n.left+e.clientWidth,n.width=e.clientWidth,n.height=e.clientHeight,n.x=n.left,n.y=n.top,n}function wS(e,t,n){return t===v3?N1(yB(e,n)):Ui(t)?wB(t,n):N1(CB(ai(e)))}function SB(e){var t=Bu(Dh(e)),n=["absolute","fixed"].indexOf(aa(e).position)>=0,r=n&&wo(e)?Dd(e):e;return Ui(r)?t.filter(function(o){return Ui(o)&&y3(o,r)&&ws(o)!=="body"}):[]}function kB(e,t,n,r){var o=t==="clippingParents"?SB(e):[].concat(t),s=[].concat(o,[n]),i=s[0],l=s.reduce(function(u,p){var m=wS(e,p,r);return u.top=Ai(m.top,u.top),u.right=lm(m.right,u.right),u.bottom=lm(m.bottom,u.bottom),u.left=Ai(m.left,u.left),u},wS(e,i,r));return l.width=l.right-l.left,l.height=l.bottom-l.top,l.x=l.left,l.y=l.top,l}function j3(e){var t=e.reference,n=e.element,r=e.placement,o=r?Cs(r):null,s=r?Cc(r):null,i=t.x+t.width/2-n.width/2,l=t.y+t.height/2-n.height/2,u;switch(o){case Dr:u={x:i,y:t.y-n.height};break;case ko:u={x:i,y:t.y+t.height};break;case jo:u={x:t.x+t.width,y:l};break;case Ar:u={x:t.x-n.width,y:l};break;default:u={x:t.x,y:t.y}}var p=o?Db(o):null;if(p!=null){var m=p==="y"?"height":"width";switch(s){case xc:u[p]=u[p]-(t[m]/2-n[m]/2);break;case Ju:u[p]=u[p]+(t[m]/2-n[m]/2);break}}return u}function ed(e,t){t===void 0&&(t={});var n=t,r=n.placement,o=r===void 0?e.placement:r,s=n.strategy,i=s===void 0?e.strategy:s,l=n.boundary,u=l===void 0?WF:l,p=n.rootBoundary,m=p===void 0?v3:p,h=n.elementContext,g=h===void 0?Cu:h,x=n.altBoundary,y=x===void 0?!1:x,b=n.padding,w=b===void 0?0:b,S=w3(typeof w!="number"?w:S3(w,Rd)),j=g===Cu?UF:Cu,_=e.rects.popper,E=e.elements[y?j:g],I=kB(Ui(E)?E:E.contextElement||ai(e.elements.popper),u,m,i),M=yc(e.elements.reference),R=j3({reference:M,element:_,strategy:"absolute",placement:o}),D=N1(Object.assign({},_,R)),A=g===Cu?D:M,O={top:I.top-A.top+S.top,bottom:A.bottom-I.bottom+S.bottom,left:I.left-A.left+S.left,right:A.right-I.right+S.right},T=e.modifiersData.offset;if(g===Cu&&T){var X=T[o];Object.keys(O).forEach(function(B){var V=[jo,ko].indexOf(B)>=0?1:-1,U=[Dr,ko].indexOf(B)>=0?"y":"x";O[B]+=X[U]*V})}return O}function jB(e,t){t===void 0&&(t={});var n=t,r=n.placement,o=n.boundary,s=n.rootBoundary,i=n.padding,l=n.flipVariations,u=n.allowedAutoPlacements,p=u===void 0?x3:u,m=Cc(r),h=m?l?xS:xS.filter(function(y){return Cc(y)===m}):Rd,g=h.filter(function(y){return p.indexOf(y)>=0});g.length===0&&(g=h);var x=g.reduce(function(y,b){return y[b]=ed(e,{placement:b,boundary:o,rootBoundary:s,padding:i})[Cs(b)],y},{});return Object.keys(x).sort(function(y,b){return x[y]-x[b]})}function _B(e){if(Cs(e)===Mb)return[];var t=Np(e);return[CS(e),t,CS(t)]}function IB(e){var t=e.state,n=e.options,r=e.name;if(!t.modifiersData[r]._skip){for(var o=n.mainAxis,s=o===void 0?!0:o,i=n.altAxis,l=i===void 0?!0:i,u=n.fallbackPlacements,p=n.padding,m=n.boundary,h=n.rootBoundary,g=n.altBoundary,x=n.flipVariations,y=x===void 0?!0:x,b=n.allowedAutoPlacements,w=t.options.placement,S=Cs(w),j=S===w,_=u||(j||!y?[Np(w)]:_B(w)),E=[w].concat(_).reduce(function(re,G){return re.concat(Cs(G)===Mb?jB(t,{placement:G,boundary:m,rootBoundary:h,padding:p,flipVariations:y,allowedAutoPlacements:b}):G)},[]),I=t.rects.reference,M=t.rects.popper,R=new Map,D=!0,A=E[0],O=0;O=0,U=V?"width":"height",N=ed(t,{placement:T,boundary:m,rootBoundary:h,altBoundary:g,padding:p}),$=V?B?jo:Ar:B?ko:Dr;I[U]>M[U]&&($=Np($));var q=Np($),F=[];if(s&&F.push(N[X]<=0),l&&F.push(N[$]<=0,N[q]<=0),F.every(function(re){return re})){A=T,D=!1;break}R.set(T,F)}if(D)for(var Q=y?3:1,Y=function(G){var K=E.find(function(ee){var ce=R.get(ee);if(ce)return ce.slice(0,G).every(function(J){return J})});if(K)return A=K,"break"},se=Q;se>0;se--){var ae=Y(se);if(ae==="break")break}t.placement!==A&&(t.modifiersData[r]._skip=!0,t.placement=A,t.reset=!0)}}const PB={name:"flip",enabled:!0,phase:"main",fn:IB,requiresIfExists:["offset"],data:{_skip:!1}};function SS(e,t,n){return n===void 0&&(n={x:0,y:0}),{top:e.top-t.height-n.y,right:e.right-t.width+n.x,bottom:e.bottom-t.height+n.y,left:e.left-t.width-n.x}}function kS(e){return[Dr,jo,ko,Ar].some(function(t){return e[t]>=0})}function EB(e){var t=e.state,n=e.name,r=t.rects.reference,o=t.rects.popper,s=t.modifiersData.preventOverflow,i=ed(t,{elementContext:"reference"}),l=ed(t,{altBoundary:!0}),u=SS(i,r),p=SS(l,o,s),m=kS(u),h=kS(p);t.modifiersData[n]={referenceClippingOffsets:u,popperEscapeOffsets:p,isReferenceHidden:m,hasPopperEscaped:h},t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-reference-hidden":m,"data-popper-escaped":h})}const MB={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:EB};function OB(e,t,n){var r=Cs(e),o=[Ar,Dr].indexOf(r)>=0?-1:1,s=typeof n=="function"?n(Object.assign({},t,{placement:e})):n,i=s[0],l=s[1];return i=i||0,l=(l||0)*o,[Ar,jo].indexOf(r)>=0?{x:l,y:i}:{x:i,y:l}}function RB(e){var t=e.state,n=e.options,r=e.name,o=n.offset,s=o===void 0?[0,0]:o,i=x3.reduce(function(m,h){return m[h]=OB(h,t.rects,s),m},{}),l=i[t.placement],u=l.x,p=l.y;t.modifiersData.popperOffsets!=null&&(t.modifiersData.popperOffsets.x+=u,t.modifiersData.popperOffsets.y+=p),t.modifiersData[r]=i}const DB={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:RB};function AB(e){var t=e.state,n=e.name;t.modifiersData[n]=j3({reference:t.rects.reference,element:t.rects.popper,strategy:"absolute",placement:t.placement})}const TB={name:"popperOffsets",enabled:!0,phase:"read",fn:AB,data:{}};function NB(e){return e==="x"?"y":"x"}function $B(e){var t=e.state,n=e.options,r=e.name,o=n.mainAxis,s=o===void 0?!0:o,i=n.altAxis,l=i===void 0?!1:i,u=n.boundary,p=n.rootBoundary,m=n.altBoundary,h=n.padding,g=n.tether,x=g===void 0?!0:g,y=n.tetherOffset,b=y===void 0?0:y,w=ed(t,{boundary:u,rootBoundary:p,padding:h,altBoundary:m}),S=Cs(t.placement),j=Cc(t.placement),_=!j,E=Db(S),I=NB(E),M=t.modifiersData.popperOffsets,R=t.rects.reference,D=t.rects.popper,A=typeof b=="function"?b(Object.assign({},t.rects,{placement:t.placement})):b,O=typeof A=="number"?{mainAxis:A,altAxis:A}:Object.assign({mainAxis:0,altAxis:0},A),T=t.modifiersData.offset?t.modifiersData.offset[t.placement]:null,X={x:0,y:0};if(M){if(s){var B,V=E==="y"?Dr:Ar,U=E==="y"?ko:jo,N=E==="y"?"height":"width",$=M[E],q=$+w[V],F=$-w[U],Q=x?-D[N]/2:0,Y=j===xc?R[N]:D[N],se=j===xc?-D[N]:-R[N],ae=t.elements.arrow,re=x&&ae?Rb(ae):{width:0,height:0},G=t.modifiersData["arrow#persistent"]?t.modifiersData["arrow#persistent"].padding:C3(),K=G[V],ee=G[U],ce=Fu(0,R[N],re[N]),J=_?R[N]/2-Q-ce-K-O.mainAxis:Y-ce-K-O.mainAxis,ie=_?-R[N]/2+Q+ce+ee+O.mainAxis:se+ce+ee+O.mainAxis,de=t.elements.arrow&&Dd(t.elements.arrow),ge=de?E==="y"?de.clientTop||0:de.clientLeft||0:0,Ce=(B=T==null?void 0:T[E])!=null?B:0,he=$+J-Ce-ge,fe=$+ie-Ce,Oe=Fu(x?lm(q,he):q,$,x?Ai(F,fe):F);M[E]=Oe,X[E]=Oe-$}if(l){var _e,Ne=E==="x"?Dr:Ar,nt=E==="x"?ko:jo,$e=M[I],Pt=I==="y"?"height":"width",Ze=$e+w[Ne],ot=$e-w[nt],ye=[Dr,Ar].indexOf(S)!==-1,De=(_e=T==null?void 0:T[I])!=null?_e:0,ut=ye?Ze:$e-R[Pt]-D[Pt]-De+O.altAxis,bt=ye?$e+R[Pt]+D[Pt]-De-O.altAxis:ot,be=x&&ye?iB(ut,$e,bt):Fu(x?ut:Ze,$e,x?bt:ot);M[I]=be,X[I]=be-$e}t.modifiersData[r]=X}}const LB={name:"preventOverflow",enabled:!0,phase:"main",fn:$B,requiresIfExists:["offset"]};function zB(e){return{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}}function FB(e){return e===no(e)||!wo(e)?Ab(e):zB(e)}function BB(e){var t=e.getBoundingClientRect(),n=bc(t.width)/e.offsetWidth||1,r=bc(t.height)/e.offsetHeight||1;return n!==1||r!==1}function HB(e,t,n){n===void 0&&(n=!1);var r=wo(t),o=wo(t)&&BB(t),s=ai(t),i=yc(e,o,n),l={scrollLeft:0,scrollTop:0},u={x:0,y:0};return(r||!r&&!n)&&((ws(t)!=="body"||Nb(s))&&(l=FB(t)),wo(t)?(u=yc(t,!0),u.x+=t.clientLeft,u.y+=t.clientTop):s&&(u.x=Tb(s))),{x:i.left+l.scrollLeft-u.x,y:i.top+l.scrollTop-u.y,width:i.width,height:i.height}}function VB(e){var t=new Map,n=new Set,r=[];e.forEach(function(s){t.set(s.name,s)});function o(s){n.add(s.name);var i=[].concat(s.requires||[],s.requiresIfExists||[]);i.forEach(function(l){if(!n.has(l)){var u=t.get(l);u&&o(u)}}),r.push(s)}return e.forEach(function(s){n.has(s.name)||o(s)}),r}function WB(e){var t=VB(e);return tB.reduce(function(n,r){return n.concat(t.filter(function(o){return o.phase===r}))},[])}function UB(e){var t;return function(){return t||(t=new Promise(function(n){Promise.resolve().then(function(){t=void 0,n(e())})})),t}}function GB(e){var t=e.reduce(function(n,r){var o=n[r.name];return n[r.name]=o?Object.assign({},o,r,{options:Object.assign({},o.options,r.options),data:Object.assign({},o.data,r.data)}):r,n},{});return Object.keys(t).map(function(n){return t[n]})}var jS={placement:"bottom",modifiers:[],strategy:"absolute"};function _S(){for(var e=arguments.length,t=new Array(e),n=0;n{}),_=d.useCallback(()=>{var O;!t||!y.current||!b.current||((O=j.current)==null||O.call(j),w.current=XB(y.current,b.current,{placement:S,modifiers:[FF,$F,NF,{...TF,enabled:!!g},{name:"eventListeners",...AF(i)},{name:"arrow",options:{padding:s}},{name:"offset",options:{offset:l??[0,u]}},{name:"flip",enabled:!!p,options:{padding:8}},{name:"preventOverflow",enabled:!!h,options:{boundary:m}},...n??[]],strategy:o}),w.current.forceUpdate(),j.current=w.current.destroy)},[S,t,n,g,i,s,l,u,p,h,m,o]);d.useEffect(()=>()=>{var O;!y.current&&!b.current&&((O=w.current)==null||O.destroy(),w.current=null)},[]);const E=d.useCallback(O=>{y.current=O,_()},[_]),I=d.useCallback((O={},T=null)=>({...O,ref:It(E,T)}),[E]),M=d.useCallback(O=>{b.current=O,_()},[_]),R=d.useCallback((O={},T=null)=>({...O,ref:It(M,T),style:{...O.style,position:o,minWidth:g?void 0:"max-content",inset:"0 auto auto 0"}}),[o,M,g]),D=d.useCallback((O={},T=null)=>{const{size:X,shadowColor:B,bg:V,style:U,...N}=O;return{...N,ref:T,"data-popper-arrow":"",style:QB(O)}},[]),A=d.useCallback((O={},T=null)=>({...O,ref:T,"data-popper-arrow-inner":""}),[]);return{update(){var O;(O=w.current)==null||O.update()},forceUpdate(){var O;(O=w.current)==null||O.forceUpdate()},transformOrigin:$n.transformOrigin.varRef,referenceRef:E,popperRef:M,getPopperProps:R,getArrowProps:D,getArrowInnerProps:A,getReferenceProps:I}}function QB(e){const{size:t,shadowColor:n,bg:r,style:o}=e,s={...o,position:"absolute"};return t&&(s["--popper-arrow-size"]=t),n&&(s["--popper-arrow-shadow-color"]=n),r&&(s["--popper-arrow-bg"]=r),s}function Lb(e={}){const{onClose:t,onOpen:n,isOpen:r,id:o}=e,s=dn(n),i=dn(t),[l,u]=d.useState(e.defaultIsOpen||!1),p=r!==void 0?r:l,m=r!==void 0,h=d.useId(),g=o??`disclosure-${h}`,x=d.useCallback(()=>{m||u(!1),i==null||i()},[m,i]),y=d.useCallback(()=>{m||u(!0),s==null||s()},[m,s]),b=d.useCallback(()=>{p?x():y()},[p,y,x]);function w(j={}){return{...j,"aria-expanded":p,"aria-controls":g,onClick(_){var E;(E=j.onClick)==null||E.call(j,_),b()}}}function S(j={}){return{...j,hidden:!p,id:g}}return{isOpen:p,onOpen:y,onClose:x,onToggle:b,isControlled:m,getButtonProps:w,getDisclosureProps:S}}function YB(e){const{ref:t,handler:n,enabled:r=!0}=e,o=dn(n),i=d.useRef({isPointerDown:!1,ignoreEmulatedMouseEvents:!1}).current;d.useEffect(()=>{if(!r)return;const l=h=>{fv(h,t)&&(i.isPointerDown=!0)},u=h=>{if(i.ignoreEmulatedMouseEvents){i.ignoreEmulatedMouseEvents=!1;return}i.isPointerDown&&n&&fv(h,t)&&(i.isPointerDown=!1,o(h))},p=h=>{i.ignoreEmulatedMouseEvents=!0,n&&i.isPointerDown&&fv(h,t)&&(i.isPointerDown=!1,o(h))},m=_3(t.current);return m.addEventListener("mousedown",l,!0),m.addEventListener("mouseup",u,!0),m.addEventListener("touchstart",l,!0),m.addEventListener("touchend",p,!0),()=>{m.removeEventListener("mousedown",l,!0),m.removeEventListener("mouseup",u,!0),m.removeEventListener("touchstart",l,!0),m.removeEventListener("touchend",p,!0)}},[n,t,o,i,r])}function fv(e,t){var n;const r=e.target;return r&&!_3(r).contains(r)?!1:!((n=t.current)!=null&&n.contains(r))}function _3(e){var t;return(t=e==null?void 0:e.ownerDocument)!=null?t:document}function I3(e){const{isOpen:t,ref:n}=e,[r,o]=d.useState(t),[s,i]=d.useState(!1);return d.useEffect(()=>{s||(o(t),i(!0))},[t,s,r]),Di(()=>n.current,"animationend",()=>{o(t)}),{present:!(t?!1:!r),onComplete(){var u;const p=tF(n.current),m=new p.CustomEvent("animationend",{bubbles:!0});(u=n.current)==null||u.dispatchEvent(m)}}}function zb(e){const{wasSelected:t,enabled:n,isSelected:r,mode:o="unmount"}=e;return!!(!n||r||o==="keepMounted"&&t)}var[ZB,JB,eH,tH]=lb(),[nH,Ad]=Wt({strict:!1,name:"MenuContext"});function rH(e,...t){const n=d.useId(),r=e||n;return d.useMemo(()=>t.map(o=>`${o}-${r}`),[r,t])}function P3(e){var t;return(t=e==null?void 0:e.ownerDocument)!=null?t:document}function IS(e){return P3(e).activeElement===e}function oH(e={}){const{id:t,closeOnSelect:n=!0,closeOnBlur:r=!0,initialFocusRef:o,autoSelect:s=!0,isLazy:i,isOpen:l,defaultIsOpen:u,onClose:p,onOpen:m,placement:h="bottom-start",lazyBehavior:g="unmount",direction:x,computePositionOnMount:y=!1,...b}=e,w=d.useRef(null),S=d.useRef(null),j=eH(),_=d.useCallback(()=>{requestAnimationFrame(()=>{var ae;(ae=w.current)==null||ae.focus({preventScroll:!1})})},[]),E=d.useCallback(()=>{const ae=setTimeout(()=>{var re;if(o)(re=o.current)==null||re.focus();else{const G=j.firstEnabled();G&&B(G.index)}});q.current.add(ae)},[j,o]),I=d.useCallback(()=>{const ae=setTimeout(()=>{const re=j.lastEnabled();re&&B(re.index)});q.current.add(ae)},[j]),M=d.useCallback(()=>{m==null||m(),s?E():_()},[s,E,_,m]),{isOpen:R,onOpen:D,onClose:A,onToggle:O}=Lb({isOpen:l,defaultIsOpen:u,onClose:p,onOpen:M});YB({enabled:R&&r,ref:w,handler:ae=>{var re;(re=S.current)!=null&&re.contains(ae.target)||A()}});const T=$b({...b,enabled:R||y,placement:h,direction:x}),[X,B]=d.useState(-1);pa(()=>{R||B(-1)},[R]),g3(w,{focusRef:S,visible:R,shouldFocus:!0});const V=I3({isOpen:R,ref:w}),[U,N]=rH(t,"menu-button","menu-list"),$=d.useCallback(()=>{D(),_()},[D,_]),q=d.useRef(new Set([]));dH(()=>{q.current.forEach(ae=>clearTimeout(ae)),q.current.clear()});const F=d.useCallback(()=>{D(),E()},[E,D]),Q=d.useCallback(()=>{D(),I()},[D,I]),Y=d.useCallback(()=>{var ae,re;const G=P3(w.current),K=(ae=w.current)==null?void 0:ae.contains(G.activeElement);if(!(R&&!K))return;const ce=(re=j.item(X))==null?void 0:re.node;ce==null||ce.focus()},[R,X,j]),se=d.useRef(null);return{openAndFocusMenu:$,openAndFocusFirstItem:F,openAndFocusLastItem:Q,onTransitionEnd:Y,unstable__animationState:V,descendants:j,popper:T,buttonId:U,menuId:N,forceUpdate:T.forceUpdate,orientation:"vertical",isOpen:R,onToggle:O,onOpen:D,onClose:A,menuRef:w,buttonRef:S,focusedIndex:X,closeOnSelect:n,closeOnBlur:r,autoSelect:s,setFocusedIndex:B,isLazy:i,lazyBehavior:g,initialFocusRef:o,rafId:se}}function sH(e={},t=null){const n=Ad(),{onToggle:r,popper:o,openAndFocusFirstItem:s,openAndFocusLastItem:i}=n,l=d.useCallback(u=>{const p=u.key,h={Enter:s,ArrowDown:s,ArrowUp:i}[p];h&&(u.preventDefault(),u.stopPropagation(),h(u))},[s,i]);return{...e,ref:It(n.buttonRef,t,o.referenceRef),id:n.buttonId,"data-active":dt(n.isOpen),"aria-expanded":n.isOpen,"aria-haspopup":"menu","aria-controls":n.menuId,onClick:He(e.onClick,r),onKeyDown:He(e.onKeyDown,l)}}function $1(e){var t;return cH(e)&&!!((t=e==null?void 0:e.getAttribute("role"))!=null&&t.startsWith("menuitem"))}function aH(e={},t=null){const n=Ad();if(!n)throw new Error("useMenuContext: context is undefined. Seems you forgot to wrap component within ");const{focusedIndex:r,setFocusedIndex:o,menuRef:s,isOpen:i,onClose:l,menuId:u,isLazy:p,lazyBehavior:m,unstable__animationState:h}=n,g=JB(),x=kF({preventDefault:S=>S.key!==" "&&$1(S.target)}),y=d.useCallback(S=>{if(!S.currentTarget.contains(S.target))return;const j=S.key,E={Tab:M=>M.preventDefault(),Escape:l,ArrowDown:()=>{const M=g.nextEnabled(r);M&&o(M.index)},ArrowUp:()=>{const M=g.prevEnabled(r);M&&o(M.index)}}[j];if(E){S.preventDefault(),E(S);return}const I=x(M=>{const R=jF(g.values(),M,D=>{var A,O;return(O=(A=D==null?void 0:D.node)==null?void 0:A.textContent)!=null?O:""},g.item(r));if(R){const D=g.indexOf(R.node);o(D)}});$1(S.target)&&I(S)},[g,r,x,l,o]),b=d.useRef(!1);i&&(b.current=!0);const w=zb({wasSelected:b.current,enabled:p,mode:m,isSelected:h.present});return{...e,ref:It(s,t),children:w?e.children:null,tabIndex:-1,role:"menu",id:u,style:{...e.style,transformOrigin:"var(--popper-transform-origin)"},"aria-orientation":"vertical",onKeyDown:He(e.onKeyDown,y)}}function iH(e={}){const{popper:t,isOpen:n}=Ad();return t.getPopperProps({...e,style:{visibility:n?"visible":"hidden",...e.style}})}function lH(e={},t=null){const{onMouseEnter:n,onMouseMove:r,onMouseLeave:o,onClick:s,onFocus:i,isDisabled:l,isFocusable:u,closeOnSelect:p,type:m,...h}=e,g=Ad(),{setFocusedIndex:x,focusedIndex:y,closeOnSelect:b,onClose:w,menuRef:S,isOpen:j,menuId:_,rafId:E}=g,I=d.useRef(null),M=`${_}-menuitem-${d.useId()}`,{index:R,register:D}=tH({disabled:l&&!u}),A=d.useCallback($=>{n==null||n($),!l&&x(R)},[x,R,l,n]),O=d.useCallback($=>{r==null||r($),I.current&&!IS(I.current)&&A($)},[A,r]),T=d.useCallback($=>{o==null||o($),!l&&x(-1)},[x,l,o]),X=d.useCallback($=>{s==null||s($),$1($.currentTarget)&&(p??b)&&w()},[w,s,b,p]),B=d.useCallback($=>{i==null||i($),x(R)},[x,i,R]),V=R===y,U=l&&!u;pa(()=>{j&&(V&&!U&&I.current?(E.current&&cancelAnimationFrame(E.current),E.current=requestAnimationFrame(()=>{var $;($=I.current)==null||$.focus(),E.current=null})):S.current&&!IS(S.current)&&S.current.focus({preventScroll:!0}))},[V,U,S,j]);const N=h3({onClick:X,onFocus:B,onMouseEnter:A,onMouseMove:O,onMouseLeave:T,ref:It(D,I,t),isDisabled:l,isFocusable:u});return{...h,...N,type:m??N.type,id:M,role:"menuitem",tabIndex:V?0:-1}}function cH(e){var t;if(!uH(e))return!1;const n=(t=e.ownerDocument.defaultView)!=null?t:window;return e instanceof n.HTMLElement}function uH(e){return e!=null&&typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.ELEMENT_NODE}function dH(e,t=[]){return d.useEffect(()=>()=>e(),t)}var[fH,$c]=Wt({name:"MenuStylesContext",errorMessage:`useMenuStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),Ah=e=>{const{children:t}=e,n=Un("Menu",e),r=on(e),{direction:o}=bd(),{descendants:s,...i}=oH({...r,direction:o}),l=d.useMemo(()=>i,[i]),{isOpen:u,onClose:p,forceUpdate:m}=l;return a.jsx(ZB,{value:s,children:a.jsx(nH,{value:l,children:a.jsx(fH,{value:n,children:zx(t,{isOpen:u,onClose:p,forceUpdate:m})})})})};Ah.displayName="Menu";var E3=je((e,t)=>{const n=$c();return a.jsx(we.span,{ref:t,...e,__css:n.command,className:"chakra-menu__command"})});E3.displayName="MenuCommand";var pH=je((e,t)=>{const{type:n,...r}=e,o=$c(),s=r.as||n?n??void 0:"button",i=d.useMemo(()=>({textDecoration:"none",color:"inherit",userSelect:"none",display:"flex",width:"100%",alignItems:"center",textAlign:"start",flex:"0 0 auto",outline:0,...o.item}),[o.item]);return a.jsx(we.button,{ref:t,type:s,...r,__css:i})}),M3=e=>{const{className:t,children:n,...r}=e,o=$c(),s=d.Children.only(n),i=d.isValidElement(s)?d.cloneElement(s,{focusable:"false","aria-hidden":!0,className:Ye("chakra-menu__icon",s.props.className)}):null,l=Ye("chakra-menu__icon-wrapper",t);return a.jsx(we.span,{className:l,...r,__css:o.icon,children:i})};M3.displayName="MenuIcon";var en=je((e,t)=>{const{icon:n,iconSpacing:r="0.75rem",command:o,commandSpacing:s="0.75rem",children:i,...l}=e,u=lH(l,t),m=n||o?a.jsx("span",{style:{pointerEvents:"none",flex:1},children:i}):i;return a.jsxs(pH,{...u,className:Ye("chakra-menu__menuitem",u.className),children:[n&&a.jsx(M3,{fontSize:"0.8em",marginEnd:r,children:n}),m,o&&a.jsx(E3,{marginStart:s,children:o})]})});en.displayName="MenuItem";var mH={enter:{visibility:"visible",opacity:1,scale:1,transition:{duration:.2,ease:[.4,0,.2,1]}},exit:{transitionEnd:{visibility:"hidden"},opacity:0,scale:.8,transition:{duration:.1,easings:"easeOut"}}},hH=we(In.div),Gi=je(function(t,n){var r,o;const{rootProps:s,motionProps:i,...l}=t,{isOpen:u,onTransitionEnd:p,unstable__animationState:m}=Ad(),h=aH(l,n),g=iH(s),x=$c();return a.jsx(we.div,{...g,__css:{zIndex:(o=t.zIndex)!=null?o:(r=x.list)==null?void 0:r.zIndex},children:a.jsx(hH,{variants:mH,initial:!1,animate:u?"enter":"exit",__css:{outline:0,...x.list},...i,className:Ye("chakra-menu__menu-list",h.className),...h,onUpdate:p,onAnimationComplete:ph(m.onComplete,h.onAnimationComplete)})})});Gi.displayName="MenuList";var td=je((e,t)=>{const{title:n,children:r,className:o,...s}=e,i=Ye("chakra-menu__group__title",o),l=$c();return a.jsxs("div",{ref:t,className:"chakra-menu__group",role:"group",children:[n&&a.jsx(we.p,{className:i,...s,__css:l.groupTitle,children:n}),r]})});td.displayName="MenuGroup";var gH=je((e,t)=>{const n=$c();return a.jsx(we.button,{ref:t,...e,__css:{display:"inline-flex",appearance:"none",alignItems:"center",outline:0,...n.button}})}),Th=je((e,t)=>{const{children:n,as:r,...o}=e,s=sH(o,t),i=r||gH;return a.jsx(i,{...s,className:Ye("chakra-menu__menu-button",e.className),children:a.jsx(we.span,{__css:{pointerEvents:"none",flex:"1 1 auto",minW:0},children:e.children})})});Th.displayName="MenuButton";var vH={slideInBottom:{...w1,custom:{offsetY:16,reverse:!0}},slideInRight:{...w1,custom:{offsetX:16,reverse:!0}},scale:{...i5,custom:{initialScale:.95,reverse:!0}},none:{}},xH=we(In.section),bH=e=>vH[e||"none"],O3=d.forwardRef((e,t)=>{const{preset:n,motionProps:r=bH(n),...o}=e;return a.jsx(xH,{ref:t,...r,...o})});O3.displayName="ModalTransition";var yH=Object.defineProperty,CH=(e,t,n)=>t in e?yH(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,wH=(e,t,n)=>(CH(e,typeof t!="symbol"?t+"":t,n),n),SH=class{constructor(){wH(this,"modals"),this.modals=new Map}add(e){return this.modals.set(e,this.modals.size+1),this.modals.size}remove(e){this.modals.delete(e)}isTopModal(e){return e?this.modals.get(e)===this.modals.size:!1}},L1=new SH;function R3(e,t){const[n,r]=d.useState(0);return d.useEffect(()=>{const o=e.current;if(o){if(t){const s=L1.add(o);r(s)}return()=>{L1.remove(o),r(0)}}},[t,e]),n}var kH=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Dl=new WeakMap,ep=new WeakMap,tp={},pv=0,D3=function(e){return e&&(e.host||D3(e.parentNode))},jH=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=D3(n);return r&&e.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},_H=function(e,t,n,r){var o=jH(t,Array.isArray(e)?e:[e]);tp[n]||(tp[n]=new WeakMap);var s=tp[n],i=[],l=new Set,u=new Set(o),p=function(h){!h||l.has(h)||(l.add(h),p(h.parentNode))};o.forEach(p);var m=function(h){!h||u.has(h)||Array.prototype.forEach.call(h.children,function(g){if(l.has(g))m(g);else{var x=g.getAttribute(r),y=x!==null&&x!=="false",b=(Dl.get(g)||0)+1,w=(s.get(g)||0)+1;Dl.set(g,b),s.set(g,w),i.push(g),b===1&&y&&ep.set(g,!0),w===1&&g.setAttribute(n,"true"),y||g.setAttribute(r,"true")}})};return m(t),l.clear(),pv++,function(){i.forEach(function(h){var g=Dl.get(h)-1,x=s.get(h)-1;Dl.set(h,g),s.set(h,x),g||(ep.has(h)||h.removeAttribute(r),ep.delete(h)),x||h.removeAttribute(n)}),pv--,pv||(Dl=new WeakMap,Dl=new WeakMap,ep=new WeakMap,tp={})}},IH=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),o=t||kH(e);return o?(r.push.apply(r,Array.from(o.querySelectorAll("[aria-live]"))),_H(r,o,n,"aria-hidden")):function(){return null}};function PH(e){const{isOpen:t,onClose:n,id:r,closeOnOverlayClick:o=!0,closeOnEsc:s=!0,useInert:i=!0,onOverlayClick:l,onEsc:u}=e,p=d.useRef(null),m=d.useRef(null),[h,g,x]=MH(r,"chakra-modal","chakra-modal--header","chakra-modal--body");EH(p,t&&i);const y=R3(p,t),b=d.useRef(null),w=d.useCallback(A=>{b.current=A.target},[]),S=d.useCallback(A=>{A.key==="Escape"&&(A.stopPropagation(),s&&(n==null||n()),u==null||u())},[s,n,u]),[j,_]=d.useState(!1),[E,I]=d.useState(!1),M=d.useCallback((A={},O=null)=>({role:"dialog",...A,ref:It(O,p),id:h,tabIndex:-1,"aria-modal":!0,"aria-labelledby":j?g:void 0,"aria-describedby":E?x:void 0,onClick:He(A.onClick,T=>T.stopPropagation())}),[x,E,h,g,j]),R=d.useCallback(A=>{A.stopPropagation(),b.current===A.target&&L1.isTopModal(p.current)&&(o&&(n==null||n()),l==null||l())},[n,o,l]),D=d.useCallback((A={},O=null)=>({...A,ref:It(O,m),onClick:He(A.onClick,R),onKeyDown:He(A.onKeyDown,S),onMouseDown:He(A.onMouseDown,w)}),[S,w,R]);return{isOpen:t,onClose:n,headerId:g,bodyId:x,setBodyMounted:I,setHeaderMounted:_,dialogRef:p,overlayRef:m,getDialogProps:M,getDialogContainerProps:D,index:y}}function EH(e,t){const n=e.current;d.useEffect(()=>{if(!(!e.current||!t))return IH(e.current)},[t,e,n])}function MH(e,...t){const n=d.useId(),r=e||n;return d.useMemo(()=>t.map(o=>`${o}-${r}`),[r,t])}var[OH,Lc]=Wt({name:"ModalStylesContext",errorMessage:`useModalStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),[RH,Ki]=Wt({strict:!0,name:"ModalContext",errorMessage:"useModalContext: `context` is undefined. Seems you forgot to wrap modal components in ``"}),qi=e=>{const t={scrollBehavior:"outside",autoFocus:!0,trapFocus:!0,returnFocusOnClose:!0,blockScrollOnMount:!0,allowPinchZoom:!1,motionPreset:"scale",lockFocusAcrossFrames:!0,...e},{portalProps:n,children:r,autoFocus:o,trapFocus:s,initialFocusRef:i,finalFocusRef:l,returnFocusOnClose:u,blockScrollOnMount:p,allowPinchZoom:m,preserveScrollBarGap:h,motionPreset:g,lockFocusAcrossFrames:x,onCloseComplete:y}=t,b=Un("Modal",t),S={...PH(t),autoFocus:o,trapFocus:s,initialFocusRef:i,finalFocusRef:l,returnFocusOnClose:u,blockScrollOnMount:p,allowPinchZoom:m,preserveScrollBarGap:h,motionPreset:g,lockFocusAcrossFrames:x};return a.jsx(RH,{value:S,children:a.jsx(OH,{value:b,children:a.jsx(dr,{onExitComplete:y,children:S.isOpen&&a.jsx(Ac,{...n,children:r})})})})};qi.displayName="Modal";var $p="right-scroll-bar-position",Lp="width-before-scroll-bar",DH="with-scroll-bars-hidden",AH="--removed-body-scroll-bar-size",A3=M5(),mv=function(){},Nh=d.forwardRef(function(e,t){var n=d.useRef(null),r=d.useState({onScrollCapture:mv,onWheelCapture:mv,onTouchMoveCapture:mv}),o=r[0],s=r[1],i=e.forwardProps,l=e.children,u=e.className,p=e.removeScrollBar,m=e.enabled,h=e.shards,g=e.sideCar,x=e.noIsolation,y=e.inert,b=e.allowPinchZoom,w=e.as,S=w===void 0?"div":w,j=e.gapMode,_=I5(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noIsolation","inert","allowPinchZoom","as","gapMode"]),E=g,I=_5([n,t]),M=gs(gs({},_),o);return d.createElement(d.Fragment,null,m&&d.createElement(E,{sideCar:A3,removeScrollBar:p,shards:h,noIsolation:x,inert:y,setCallbacks:s,allowPinchZoom:!!b,lockRef:n,gapMode:j}),i?d.cloneElement(d.Children.only(l),gs(gs({},M),{ref:I})):d.createElement(S,gs({},M,{className:u,ref:I}),l))});Nh.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Nh.classNames={fullWidth:Lp,zeroRight:$p};var PS,TH=function(){if(PS)return PS;if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function NH(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=TH();return t&&e.setAttribute("nonce",t),e}function $H(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function LH(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var zH=function(){var e=0,t=null;return{add:function(n){e==0&&(t=NH())&&($H(t,n),LH(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},FH=function(){var e=zH();return function(t,n){d.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},T3=function(){var e=FH(),t=function(n){var r=n.styles,o=n.dynamic;return e(r,o),null};return t},BH={left:0,top:0,right:0,gap:0},hv=function(e){return parseInt(e||"",10)||0},HH=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],r=t[e==="padding"?"paddingTop":"marginTop"],o=t[e==="padding"?"paddingRight":"marginRight"];return[hv(n),hv(r),hv(o)]},VH=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return BH;var t=HH(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},WH=T3(),UH=function(e,t,n,r){var o=e.left,s=e.top,i=e.right,l=e.gap;return n===void 0&&(n="margin"),` + .`.concat(DH,` { overflow: hidden `).concat(r,`; padding-right: `).concat(l,"px ").concat(r,`; } @@ -35,17 +35,17 @@ import{a as Dc,b as W_,S as U_,c as G_,d as K_,e as o1,f as q_,i as s1,g as vR,h } body { - `).concat(OH,": ").concat(l,`px; + `).concat(AH,": ").concat(l,`px; } -`)},VH=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,o=r===void 0?"margin":r,s=d.useMemo(function(){return FH(o)},[o]);return d.createElement(BH,{styles:HH(s,!t,o,n?"":"!important")})},z1=!1;if(typeof window<"u")try{var np=Object.defineProperty({},"passive",{get:function(){return z1=!0,!0}});window.addEventListener("test",np,np),window.removeEventListener("test",np,np)}catch{z1=!1}var Al=z1?{passive:!1}:!1,WH=function(e){return e.tagName==="TEXTAREA"},N3=function(e,t){var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!WH(e)&&n[t]==="visible")},UH=function(e){return N3(e,"overflowY")},GH=function(e){return N3(e,"overflowX")},ES=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var o=$3(e,r);if(o){var s=L3(e,r),i=s[1],l=s[2];if(i>l)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},KH=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},qH=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},$3=function(e,t){return e==="v"?UH(t):GH(t)},L3=function(e,t){return e==="v"?KH(t):qH(t)},XH=function(e,t){return e==="h"&&t==="rtl"?-1:1},QH=function(e,t,n,r,o){var s=XH(e,window.getComputedStyle(t).direction),i=s*r,l=n.target,u=t.contains(l),p=!1,m=i>0,h=0,g=0;do{var x=L3(e,l),y=x[0],b=x[1],w=x[2],S=b-w-s*y;(y||S)&&$3(e,l)&&(h+=S,g+=y),l=l.parentNode}while(!u&&l!==document.body||u&&(t.contains(l)||t===l));return(m&&(o&&h===0||!o&&i>h)||!m&&(o&&g===0||!o&&-i>g))&&(p=!0),p},rp=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},MS=function(e){return[e.deltaX,e.deltaY]},OS=function(e){return e&&"current"in e?e.current:e},YH=function(e,t){return e[0]===t[0]&&e[1]===t[1]},ZH=function(e){return` +`)},GH=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,o=r===void 0?"margin":r,s=d.useMemo(function(){return VH(o)},[o]);return d.createElement(WH,{styles:UH(s,!t,o,n?"":"!important")})},z1=!1;if(typeof window<"u")try{var np=Object.defineProperty({},"passive",{get:function(){return z1=!0,!0}});window.addEventListener("test",np,np),window.removeEventListener("test",np,np)}catch{z1=!1}var Al=z1?{passive:!1}:!1,KH=function(e){return e.tagName==="TEXTAREA"},N3=function(e,t){var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!KH(e)&&n[t]==="visible")},qH=function(e){return N3(e,"overflowY")},XH=function(e){return N3(e,"overflowX")},ES=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var o=$3(e,r);if(o){var s=L3(e,r),i=s[1],l=s[2];if(i>l)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},QH=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},YH=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},$3=function(e,t){return e==="v"?qH(t):XH(t)},L3=function(e,t){return e==="v"?QH(t):YH(t)},ZH=function(e,t){return e==="h"&&t==="rtl"?-1:1},JH=function(e,t,n,r,o){var s=ZH(e,window.getComputedStyle(t).direction),i=s*r,l=n.target,u=t.contains(l),p=!1,m=i>0,h=0,g=0;do{var x=L3(e,l),y=x[0],b=x[1],w=x[2],S=b-w-s*y;(y||S)&&$3(e,l)&&(h+=S,g+=y),l=l.parentNode}while(!u&&l!==document.body||u&&(t.contains(l)||t===l));return(m&&(o&&h===0||!o&&i>h)||!m&&(o&&g===0||!o&&-i>g))&&(p=!0),p},rp=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},MS=function(e){return[e.deltaX,e.deltaY]},OS=function(e){return e&&"current"in e?e.current:e},eV=function(e,t){return e[0]===t[0]&&e[1]===t[1]},tV=function(e){return` .block-interactivity-`.concat(e,` {pointer-events: none;} .allow-interactivity-`).concat(e,` {pointer-events: all;} -`)},JH=0,Tl=[];function eV(e){var t=d.useRef([]),n=d.useRef([0,0]),r=d.useRef(),o=d.useState(JH++)[0],s=d.useState(T3)[0],i=d.useRef(e);d.useEffect(function(){i.current=e},[e]),d.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(o));var b=M1([e.lockRef.current],(e.shards||[]).map(OS),!0).filter(Boolean);return b.forEach(function(w){return w.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),b.forEach(function(w){return w.classList.remove("allow-interactivity-".concat(o))})}}},[e.inert,e.lockRef.current,e.shards]);var l=d.useCallback(function(b,w){if("touches"in b&&b.touches.length===2)return!i.current.allowPinchZoom;var S=rp(b),j=n.current,_="deltaX"in b?b.deltaX:j[0]-S[0],E="deltaY"in b?b.deltaY:j[1]-S[1],I,M=b.target,R=Math.abs(_)>Math.abs(E)?"h":"v";if("touches"in b&&R==="h"&&M.type==="range")return!1;var D=ES(R,M);if(!D)return!0;if(D?I=R:(I=R==="v"?"h":"v",D=ES(R,M)),!D)return!1;if(!r.current&&"changedTouches"in b&&(_||E)&&(r.current=I),!I)return!0;var A=r.current||I;return QH(A,w,b,A==="h"?_:E,!0)},[]),u=d.useCallback(function(b){var w=b;if(!(!Tl.length||Tl[Tl.length-1]!==s)){var S="deltaY"in w?MS(w):rp(w),j=t.current.filter(function(I){return I.name===w.type&&I.target===w.target&&YH(I.delta,S)})[0];if(j&&j.should){w.cancelable&&w.preventDefault();return}if(!j){var _=(i.current.shards||[]).map(OS).filter(Boolean).filter(function(I){return I.contains(w.target)}),E=_.length>0?l(w,_[0]):!i.current.noIsolation;E&&w.cancelable&&w.preventDefault()}}},[]),p=d.useCallback(function(b,w,S,j){var _={name:b,delta:w,target:S,should:j};t.current.push(_),setTimeout(function(){t.current=t.current.filter(function(E){return E!==_})},1)},[]),m=d.useCallback(function(b){n.current=rp(b),r.current=void 0},[]),h=d.useCallback(function(b){p(b.type,MS(b),b.target,l(b,e.lockRef.current))},[]),g=d.useCallback(function(b){p(b.type,rp(b),b.target,l(b,e.lockRef.current))},[]);d.useEffect(function(){return Tl.push(s),e.setCallbacks({onScrollCapture:h,onWheelCapture:h,onTouchMoveCapture:g}),document.addEventListener("wheel",u,Al),document.addEventListener("touchmove",u,Al),document.addEventListener("touchstart",m,Al),function(){Tl=Tl.filter(function(b){return b!==s}),document.removeEventListener("wheel",u,Al),document.removeEventListener("touchmove",u,Al),document.removeEventListener("touchstart",m,Al)}},[]);var x=e.removeScrollBar,y=e.inert;return d.createElement(d.Fragment,null,y?d.createElement(s,{styles:ZH(o)}):null,x?d.createElement(VH,{gapMode:e.gapMode}):null)}const tV=tz(A3,eV);var z3=d.forwardRef(function(e,t){return d.createElement(Nh,gs({},e,{ref:t,sideCar:tV}))});z3.classNames=Nh.classNames;const nV=z3;function rV(e){const{autoFocus:t,trapFocus:n,dialogRef:r,initialFocusRef:o,blockScrollOnMount:s,allowPinchZoom:i,finalFocusRef:l,returnFocusOnClose:u,preserveScrollBarGap:p,lockFocusAcrossFrames:m,isOpen:h}=Gi(),[g,x]=HR();d.useEffect(()=>{!g&&x&&setTimeout(x)},[g,x]);const y=R3(r,h);return a.jsx(i3,{autoFocus:t,isDisabled:!n,initialFocusRef:o,finalFocusRef:l,restoreFocus:u,contentRef:r,lockFocusAcrossFrames:m,children:a.jsx(nV,{removeScrollBar:!p,allowPinchZoom:i,enabled:y===1&&s,forwardProps:!0,children:e.children})})}var qi=ke((e,t)=>{const{className:n,children:r,containerProps:o,motionProps:s,...i}=e,{getDialogProps:l,getDialogContainerProps:u}=Gi(),p=l(i,t),m=u(o),h=Ye("chakra-modal__content",n),g=Lc(),x={display:"flex",flexDirection:"column",position:"relative",width:"100%",outline:0,...g.dialog},y={display:"flex",width:"100vw",height:"$100vh",position:"fixed",left:0,top:0,...g.dialogContainer},{motionPreset:b}=Gi();return a.jsx(rV,{children:a.jsx(we.div,{...m,className:"chakra-modal__content-container",tabIndex:-1,__css:y,children:a.jsx(O3,{preset:b,motionProps:s,className:h,...p,__css:x,children:r})})})});qi.displayName="ModalContent";function Td(e){const{leastDestructiveRef:t,...n}=e;return a.jsx(Ki,{...n,initialFocusRef:t})}var Nd=ke((e,t)=>a.jsx(qi,{ref:t,role:"alertdialog",...e})),Ss=ke((e,t)=>{const{className:n,...r}=e,o=Ye("chakra-modal__footer",n),i={display:"flex",alignItems:"center",justifyContent:"flex-end",...Lc().footer};return a.jsx(we.footer,{ref:t,...r,__css:i,className:o})});Ss.displayName="ModalFooter";var Qo=ke((e,t)=>{const{className:n,...r}=e,{headerId:o,setHeaderMounted:s}=Gi();d.useEffect(()=>(s(!0),()=>s(!1)),[s]);const i=Ye("chakra-modal__header",n),u={flex:0,...Lc().header};return a.jsx(we.header,{ref:t,className:i,id:o,...r,__css:u})});Qo.displayName="ModalHeader";var oV=we(In.div),Yo=ke((e,t)=>{const{className:n,transition:r,motionProps:o,...s}=e,i=Ye("chakra-modal__overlay",n),u={pos:"fixed",left:"0",top:"0",w:"100vw",h:"100vh",...Lc().overlay},{motionPreset:p}=Gi(),h=o||(p==="none"?{}:a5);return a.jsx(oV,{...h,__css:u,ref:t,className:i,...s})});Yo.displayName="ModalOverlay";var Zo=ke((e,t)=>{const{className:n,...r}=e,{bodyId:o,setBodyMounted:s}=Gi();d.useEffect(()=>(s(!0),()=>s(!1)),[s]);const i=Ye("chakra-modal__body",n),l=Lc();return a.jsx(we.div,{ref:t,className:i,id:o,...r,__css:l.body})});Zo.displayName="ModalBody";var $d=ke((e,t)=>{const{onClick:n,className:r,...o}=e,{onClose:s}=Gi(),i=Ye("chakra-modal__close-btn",r),l=Lc();return a.jsx(J_,{ref:t,__css:l.closeButton,className:i,onClick:He(n,u=>{u.stopPropagation(),s()}),...o})});$d.displayName="ModalCloseButton";var sV=e=>a.jsx(Tn,{viewBox:"0 0 24 24",...e,children:a.jsx("path",{fill:"currentColor",d:"M21,5H3C2.621,5,2.275,5.214,2.105,5.553C1.937,5.892,1.973,6.297,2.2,6.6l9,12 c0.188,0.252,0.485,0.4,0.8,0.4s0.611-0.148,0.8-0.4l9-12c0.228-0.303,0.264-0.708,0.095-1.047C21.725,5.214,21.379,5,21,5z"})}),aV=e=>a.jsx(Tn,{viewBox:"0 0 24 24",...e,children:a.jsx("path",{fill:"currentColor",d:"M12.8,5.4c-0.377-0.504-1.223-0.504-1.6,0l-9,12c-0.228,0.303-0.264,0.708-0.095,1.047 C2.275,18.786,2.621,19,3,19h18c0.379,0,0.725-0.214,0.895-0.553c0.169-0.339,0.133-0.744-0.095-1.047L12.8,5.4z"})});function RS(e,t,n,r){d.useEffect(()=>{var o;if(!e.current||!r)return;const s=(o=e.current.ownerDocument.defaultView)!=null?o:window,i=Array.isArray(t)?t:[t],l=new s.MutationObserver(u=>{for(const p of u)p.type==="attributes"&&p.attributeName&&i.includes(p.attributeName)&&n(p)});return l.observe(e.current,{attributes:!0,attributeFilter:i}),()=>l.disconnect()})}function iV(e,t){const n=un(e);d.useEffect(()=>{let r=null;const o=()=>n();return t!==null&&(r=window.setInterval(o,t)),()=>{r&&window.clearInterval(r)}},[t,n])}var lV=50,DS=300;function cV(e,t){const[n,r]=d.useState(!1),[o,s]=d.useState(null),[i,l]=d.useState(!0),u=d.useRef(null),p=()=>clearTimeout(u.current);iV(()=>{o==="increment"&&e(),o==="decrement"&&t()},n?lV:null);const m=d.useCallback(()=>{i&&e(),u.current=setTimeout(()=>{l(!1),r(!0),s("increment")},DS)},[e,i]),h=d.useCallback(()=>{i&&t(),u.current=setTimeout(()=>{l(!1),r(!0),s("decrement")},DS)},[t,i]),g=d.useCallback(()=>{l(!0),r(!1),p()},[]);return d.useEffect(()=>()=>p(),[]),{up:m,down:h,stop:g,isSpinning:n}}var uV=/^[Ee0-9+\-.]$/;function dV(e){return uV.test(e)}function fV(e,t){if(e.key==null)return!0;const n=e.ctrlKey||e.altKey||e.metaKey;return!(e.key.length===1)||n?!0:t(e.key)}function pV(e={}){const{focusInputOnChange:t=!0,clampValueOnBlur:n=!0,keepWithinRange:r=!0,min:o=Number.MIN_SAFE_INTEGER,max:s=Number.MAX_SAFE_INTEGER,step:i=1,isReadOnly:l,isDisabled:u,isRequired:p,isInvalid:m,pattern:h="[0-9]*(.[0-9]+)?",inputMode:g="decimal",allowMouseWheel:x,id:y,onChange:b,precision:w,name:S,"aria-describedby":j,"aria-label":_,"aria-labelledby":E,onFocus:I,onBlur:M,onInvalid:R,getAriaValueText:D,isValidCharacter:A,format:O,parse:T,...X}=e,B=un(I),V=un(M),U=un(R),N=un(A??dV),$=un(D),q=TL(e),{update:F,increment:Q,decrement:Y}=q,[se,ae]=d.useState(!1),re=!(l||u),G=d.useRef(null),K=d.useRef(null),ee=d.useRef(null),le=d.useRef(null),J=d.useCallback(be=>be.split("").filter(N).join(""),[N]),ie=d.useCallback(be=>{var Je;return(Je=T==null?void 0:T(be))!=null?Je:be},[T]),de=d.useCallback(be=>{var Je;return((Je=O==null?void 0:O(be))!=null?Je:be).toString()},[O]);pa(()=>{(q.valueAsNumber>s||q.valueAsNumber{if(!G.current)return;if(G.current.value!=q.value){const Je=ie(G.current.value);q.setValue(J(Je))}},[ie,J]);const ge=d.useCallback((be=i)=>{re&&Q(be)},[Q,re,i]),Ce=d.useCallback((be=i)=>{re&&Y(be)},[Y,re,i]),he=cV(ge,Ce);RS(ee,"disabled",he.stop,he.isSpinning),RS(le,"disabled",he.stop,he.isSpinning);const fe=d.useCallback(be=>{if(be.nativeEvent.isComposing)return;const lt=ie(be.currentTarget.value);F(J(lt)),K.current={start:be.currentTarget.selectionStart,end:be.currentTarget.selectionEnd}},[F,J,ie]),Oe=d.useCallback(be=>{var Je,lt,ft;B==null||B(be),K.current&&(be.target.selectionStart=(lt=K.current.start)!=null?lt:(Je=be.currentTarget.value)==null?void 0:Je.length,be.currentTarget.selectionEnd=(ft=K.current.end)!=null?ft:be.currentTarget.selectionStart)},[B]),_e=d.useCallback(be=>{if(be.nativeEvent.isComposing)return;fV(be,N)||be.preventDefault();const Je=Ne(be)*i,lt=be.key,Me={ArrowUp:()=>ge(Je),ArrowDown:()=>Ce(Je),Home:()=>F(o),End:()=>F(s)}[lt];Me&&(be.preventDefault(),Me(be))},[N,i,ge,Ce,F,o,s]),Ne=be=>{let Je=1;return(be.metaKey||be.ctrlKey)&&(Je=.1),be.shiftKey&&(Je=10),Je},nt=d.useMemo(()=>{const be=$==null?void 0:$(q.value);if(be!=null)return be;const Je=q.value.toString();return Je||void 0},[q.value,$]),$e=d.useCallback(()=>{let be=q.value;if(q.value==="")return;/^[eE]/.test(q.value.toString())?q.setValue(""):(q.valueAsNumbers&&(be=s),q.cast(be))},[q,s,o]),Pt=d.useCallback(()=>{ae(!1),n&&$e()},[n,ae,$e]),Ze=d.useCallback(()=>{t&&requestAnimationFrame(()=>{var be;(be=G.current)==null||be.focus()})},[t]),ot=d.useCallback(be=>{be.preventDefault(),he.up(),Ze()},[Ze,he]),ye=d.useCallback(be=>{be.preventDefault(),he.down(),Ze()},[Ze,he]);Ri(()=>G.current,"wheel",be=>{var Je,lt;const Me=((lt=(Je=G.current)==null?void 0:Je.ownerDocument)!=null?lt:document).activeElement===G.current;if(!x||!Me)return;be.preventDefault();const Le=Ne(be)*i,Ut=Math.sign(be.deltaY);Ut===-1?ge(Le):Ut===1&&Ce(Le)},{passive:!1});const De=d.useCallback((be={},Je=null)=>{const lt=u||r&&q.isAtMax;return{...be,ref:It(Je,ee),role:"button",tabIndex:-1,onPointerDown:He(be.onPointerDown,ft=>{ft.button!==0||lt||ot(ft)}),onPointerLeave:He(be.onPointerLeave,he.stop),onPointerUp:He(be.onPointerUp,he.stop),disabled:lt,"aria-disabled":Co(lt)}},[q.isAtMax,r,ot,he.stop,u]),ut=d.useCallback((be={},Je=null)=>{const lt=u||r&&q.isAtMin;return{...be,ref:It(Je,le),role:"button",tabIndex:-1,onPointerDown:He(be.onPointerDown,ft=>{ft.button!==0||lt||ye(ft)}),onPointerLeave:He(be.onPointerLeave,he.stop),onPointerUp:He(be.onPointerUp,he.stop),disabled:lt,"aria-disabled":Co(lt)}},[q.isAtMin,r,ye,he.stop,u]),bt=d.useCallback((be={},Je=null)=>{var lt,ft,Me,Le;return{name:S,inputMode:g,type:"text",pattern:h,"aria-labelledby":E,"aria-label":_,"aria-describedby":j,id:y,disabled:u,...be,readOnly:(lt=be.readOnly)!=null?lt:l,"aria-readonly":(ft=be.readOnly)!=null?ft:l,"aria-required":(Me=be.required)!=null?Me:p,required:(Le=be.required)!=null?Le:p,ref:It(G,Je),value:de(q.value),role:"spinbutton","aria-valuemin":o,"aria-valuemax":s,"aria-valuenow":Number.isNaN(q.valueAsNumber)?void 0:q.valueAsNumber,"aria-invalid":Co(m??q.isOutOfRange),"aria-valuetext":nt,autoComplete:"off",autoCorrect:"off",onChange:He(be.onChange,fe),onKeyDown:He(be.onKeyDown,_e),onFocus:He(be.onFocus,Oe,()=>ae(!0)),onBlur:He(be.onBlur,V,Pt)}},[S,g,h,E,_,de,j,y,u,p,l,m,q.value,q.valueAsNumber,q.isOutOfRange,o,s,nt,fe,_e,Oe,V,Pt]);return{value:de(q.value),valueAsNumber:q.valueAsNumber,isFocused:se,isDisabled:u,isReadOnly:l,getIncrementButtonProps:De,getDecrementButtonProps:ut,getInputProps:bt,htmlProps:X}}var[mV,$h]=Wt({name:"NumberInputStylesContext",errorMessage:`useNumberInputStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),[hV,Fb]=Wt({name:"NumberInputContext",errorMessage:"useNumberInputContext: `context` is undefined. Seems you forgot to wrap number-input's components within "}),Lh=ke(function(t,n){const r=Un("NumberInput",t),o=on(t),s=fb(o),{htmlProps:i,...l}=pV(s),u=d.useMemo(()=>l,[l]);return a.jsx(hV,{value:u,children:a.jsx(mV,{value:r,children:a.jsx(we.div,{...i,ref:n,className:Ye("chakra-numberinput",t.className),__css:{position:"relative",zIndex:0,...r.root}})})})});Lh.displayName="NumberInput";var zh=ke(function(t,n){const r=$h();return a.jsx(we.div,{"aria-hidden":!0,ref:n,...t,__css:{display:"flex",flexDirection:"column",position:"absolute",top:"0",insetEnd:"0px",margin:"1px",height:"calc(100% - 2px)",zIndex:1,...r.stepperGroup}})});zh.displayName="NumberInputStepper";var Fh=ke(function(t,n){const{getInputProps:r}=Fb(),o=r(t,n),s=$h();return a.jsx(we.input,{...o,className:Ye("chakra-numberinput__field",t.className),__css:{width:"100%",...s.field}})});Fh.displayName="NumberInputField";var F3=we("div",{baseStyle:{display:"flex",justifyContent:"center",alignItems:"center",flex:1,transitionProperty:"common",transitionDuration:"normal",userSelect:"none",cursor:"pointer",lineHeight:"normal"}}),Bh=ke(function(t,n){var r;const o=$h(),{getDecrementButtonProps:s}=Fb(),i=s(t,n);return a.jsx(F3,{...i,__css:o.stepper,children:(r=t.children)!=null?r:a.jsx(sV,{})})});Bh.displayName="NumberDecrementStepper";var Hh=ke(function(t,n){var r;const{getIncrementButtonProps:o}=Fb(),s=o(t,n),i=$h();return a.jsx(F3,{...s,__css:i.stepper,children:(r=t.children)!=null?r:a.jsx(aV,{})})});Hh.displayName="NumberIncrementStepper";var[gV,nl]=Wt({name:"PopoverContext",errorMessage:"usePopoverContext: `context` is undefined. Seems you forgot to wrap all popover components within ``"}),[vV,Vh]=Wt({name:"PopoverStylesContext",errorMessage:`usePopoverStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `});function Wh(e){const t=d.Children.only(e.children),{getTriggerProps:n}=nl();return d.cloneElement(t,n(t.props,t.ref))}Wh.displayName="PopoverTrigger";var Nl={click:"click",hover:"hover"};function xV(e={}){const{closeOnBlur:t=!0,closeOnEsc:n=!0,initialFocusRef:r,id:o,returnFocusOnClose:s=!0,autoFocus:i=!0,arrowSize:l,arrowShadowColor:u,trigger:p=Nl.click,openDelay:m=200,closeDelay:h=200,isLazy:g,lazyBehavior:x="unmount",computePositionOnMount:y,...b}=e,{isOpen:w,onClose:S,onOpen:j,onToggle:_}=Lb(e),E=d.useRef(null),I=d.useRef(null),M=d.useRef(null),R=d.useRef(!1),D=d.useRef(!1);w&&(D.current=!0);const[A,O]=d.useState(!1),[T,X]=d.useState(!1),B=d.useId(),V=o??B,[U,N,$,q]=["popover-trigger","popover-content","popover-header","popover-body"].map(fe=>`${fe}-${V}`),{referenceRef:F,getArrowProps:Q,getPopperProps:Y,getArrowInnerProps:se,forceUpdate:ae}=$b({...b,enabled:w||!!y}),re=I3({isOpen:w,ref:M});y5({enabled:w,ref:I}),g3(M,{focusRef:I,visible:w,shouldFocus:s&&p===Nl.click}),_F(M,{focusRef:r,visible:w,shouldFocus:i&&p===Nl.click});const G=zb({wasSelected:D.current,enabled:g,mode:x,isSelected:re.present}),K=d.useCallback((fe={},Oe=null)=>{const _e={...fe,style:{...fe.style,transformOrigin:Nn.transformOrigin.varRef,[Nn.arrowSize.var]:l?`${l}px`:void 0,[Nn.arrowShadowColor.var]:u},ref:It(M,Oe),children:G?fe.children:null,id:N,tabIndex:-1,role:"dialog",onKeyDown:He(fe.onKeyDown,Ne=>{n&&Ne.key==="Escape"&&S()}),onBlur:He(fe.onBlur,Ne=>{const nt=AS(Ne),$e=gv(M.current,nt),Pt=gv(I.current,nt);w&&t&&(!$e&&!Pt)&&S()}),"aria-labelledby":A?$:void 0,"aria-describedby":T?q:void 0};return p===Nl.hover&&(_e.role="tooltip",_e.onMouseEnter=He(fe.onMouseEnter,()=>{R.current=!0}),_e.onMouseLeave=He(fe.onMouseLeave,Ne=>{Ne.nativeEvent.relatedTarget!==null&&(R.current=!1,setTimeout(()=>S(),h))})),_e},[G,N,A,$,T,q,p,n,S,w,t,h,u,l]),ee=d.useCallback((fe={},Oe=null)=>Y({...fe,style:{visibility:w?"visible":"hidden",...fe.style}},Oe),[w,Y]),le=d.useCallback((fe,Oe=null)=>({...fe,ref:It(Oe,E,F)}),[E,F]),J=d.useRef(),ie=d.useRef(),de=d.useCallback(fe=>{E.current==null&&F(fe)},[F]),ge=d.useCallback((fe={},Oe=null)=>{const _e={...fe,ref:It(I,Oe,de),id:U,"aria-haspopup":"dialog","aria-expanded":w,"aria-controls":N};return p===Nl.click&&(_e.onClick=He(fe.onClick,_)),p===Nl.hover&&(_e.onFocus=He(fe.onFocus,()=>{J.current===void 0&&j()}),_e.onBlur=He(fe.onBlur,Ne=>{const nt=AS(Ne),$e=!gv(M.current,nt);w&&t&&$e&&S()}),_e.onKeyDown=He(fe.onKeyDown,Ne=>{Ne.key==="Escape"&&S()}),_e.onMouseEnter=He(fe.onMouseEnter,()=>{R.current=!0,J.current=window.setTimeout(()=>j(),m)}),_e.onMouseLeave=He(fe.onMouseLeave,()=>{R.current=!1,J.current&&(clearTimeout(J.current),J.current=void 0),ie.current=window.setTimeout(()=>{R.current===!1&&S()},h)})),_e},[U,w,N,p,de,_,j,t,S,m,h]);d.useEffect(()=>()=>{J.current&&clearTimeout(J.current),ie.current&&clearTimeout(ie.current)},[]);const Ce=d.useCallback((fe={},Oe=null)=>({...fe,id:$,ref:It(Oe,_e=>{O(!!_e)})}),[$]),he=d.useCallback((fe={},Oe=null)=>({...fe,id:q,ref:It(Oe,_e=>{X(!!_e)})}),[q]);return{forceUpdate:ae,isOpen:w,onAnimationComplete:re.onComplete,onClose:S,getAnchorProps:le,getArrowProps:Q,getArrowInnerProps:se,getPopoverPositionerProps:ee,getPopoverProps:K,getTriggerProps:ge,getHeaderProps:Ce,getBodyProps:he}}function gv(e,t){return e===t||(e==null?void 0:e.contains(t))}function AS(e){var t;const n=e.currentTarget.ownerDocument.activeElement;return(t=e.relatedTarget)!=null?t:n}function Ld(e){const t=Un("Popover",e),{children:n,...r}=on(e),o=bd(),s=xV({...r,direction:o.direction});return a.jsx(gV,{value:s,children:a.jsx(vV,{value:t,children:zx(n,{isOpen:s.isOpen,onClose:s.onClose,forceUpdate:s.forceUpdate})})})}Ld.displayName="Popover";function B3(e){const t=d.Children.only(e.children),{getAnchorProps:n}=nl();return d.cloneElement(t,n(t.props,t.ref))}B3.displayName="PopoverAnchor";var vv=(e,t)=>t?`${e}.${t}, ${t}`:void 0;function H3(e){var t;const{bg:n,bgColor:r,backgroundColor:o,shadow:s,boxShadow:i,shadowColor:l}=e,{getArrowProps:u,getArrowInnerProps:p}=nl(),m=Vh(),h=(t=n??r)!=null?t:o,g=s??i;return a.jsx(we.div,{...u(),className:"chakra-popover__arrow-positioner",children:a.jsx(we.div,{className:Ye("chakra-popover__arrow",e.className),...p(e),__css:{"--popper-arrow-shadow-color":vv("colors",l),"--popper-arrow-bg":vv("colors",h),"--popper-arrow-shadow":vv("shadows",g),...m.arrow}})})}H3.displayName="PopoverArrow";var Uh=ke(function(t,n){const{getBodyProps:r}=nl(),o=Vh();return a.jsx(we.div,{...r(t,n),className:Ye("chakra-popover__body",t.className),__css:o.body})});Uh.displayName="PopoverBody";var V3=ke(function(t,n){const{onClose:r}=nl(),o=Vh();return a.jsx(J_,{size:"sm",onClick:r,className:Ye("chakra-popover__close-btn",t.className),__css:o.closeButton,ref:n,...t})});V3.displayName="PopoverCloseButton";function bV(e){if(e)return{enter:{...e.enter,visibility:"visible"},exit:{...e.exit,transitionEnd:{visibility:"hidden"}}}}var yV={exit:{opacity:0,scale:.95,transition:{duration:.1,ease:[.4,0,1,1]}},enter:{scale:1,opacity:1,transition:{duration:.15,ease:[0,0,.2,1]}}},CV=we(In.section),W3=ke(function(t,n){const{variants:r=yV,...o}=t,{isOpen:s}=nl();return a.jsx(CV,{ref:n,variants:bV(r),initial:!1,animate:s?"enter":"exit",...o})});W3.displayName="PopoverTransition";var zd=ke(function(t,n){const{rootProps:r,motionProps:o,...s}=t,{getPopoverProps:i,getPopoverPositionerProps:l,onAnimationComplete:u}=nl(),p=Vh(),m={position:"relative",display:"flex",flexDirection:"column",...p.content};return a.jsx(we.div,{...l(r),__css:p.popper,className:"chakra-popover__popper",children:a.jsx(W3,{...o,...i(s,n),onAnimationComplete:ph(u,s.onAnimationComplete),className:Ye("chakra-popover__content",t.className),__css:m})})});zd.displayName="PopoverContent";var F1=e=>a.jsx(we.circle,{cx:50,cy:50,r:42,fill:"transparent",...e});F1.displayName="Circle";function wV(e,t,n){return(e-t)*100/(n-t)}var SV=ma({"0%":{strokeDasharray:"1, 400",strokeDashoffset:"0"},"50%":{strokeDasharray:"400, 400",strokeDashoffset:"-100"},"100%":{strokeDasharray:"400, 400",strokeDashoffset:"-260"}}),kV=ma({"0%":{transform:"rotate(0deg)"},"100%":{transform:"rotate(360deg)"}}),jV=ma({"0%":{left:"-40%"},"100%":{left:"100%"}}),_V=ma({from:{backgroundPosition:"1rem 0"},to:{backgroundPosition:"0 0"}});function U3(e){const{value:t=0,min:n,max:r,valueText:o,getValueText:s,isIndeterminate:i,role:l="progressbar"}=e,u=wV(t,n,r);return{bind:{"data-indeterminate":i?"":void 0,"aria-valuemax":r,"aria-valuemin":n,"aria-valuenow":i?void 0:t,"aria-valuetext":(()=>{if(t!=null)return typeof s=="function"?s(t,u):o})(),role:l},percent:u,value:t}}var G3=e=>{const{size:t,isIndeterminate:n,...r}=e;return a.jsx(we.svg,{viewBox:"0 0 100 100",__css:{width:t,height:t,animation:n?`${kV} 2s linear infinite`:void 0},...r})};G3.displayName="Shape";var B1=ke((e,t)=>{var n;const{size:r="48px",max:o=100,min:s=0,valueText:i,getValueText:l,value:u,capIsRound:p,children:m,thickness:h="10px",color:g="#0078d4",trackColor:x="#edebe9",isIndeterminate:y,...b}=e,w=U3({min:s,max:o,value:u,valueText:i,getValueText:l,isIndeterminate:y}),S=y?void 0:((n=w.percent)!=null?n:0)*2.64,j=S==null?void 0:`${S} ${264-S}`,_=y?{css:{animation:`${SV} 1.5s linear infinite`}}:{strokeDashoffset:66,strokeDasharray:j,transitionProperty:"stroke-dasharray, stroke",transitionDuration:"0.6s",transitionTimingFunction:"ease"},E={display:"inline-block",position:"relative",verticalAlign:"middle",fontSize:r};return a.jsxs(we.div,{ref:t,className:"chakra-progress",...w.bind,...b,__css:E,children:[a.jsxs(G3,{size:r,isIndeterminate:y,children:[a.jsx(F1,{stroke:x,strokeWidth:h,className:"chakra-progress__track"}),a.jsx(F1,{stroke:g,strokeWidth:h,className:"chakra-progress__indicator",strokeLinecap:p?"round":void 0,opacity:w.value===0&&!y?0:void 0,..._})]}),m]})});B1.displayName="CircularProgress";var[IV,PV]=Wt({name:"ProgressStylesContext",errorMessage:`useProgressStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),EV=ke((e,t)=>{const{min:n,max:r,value:o,isIndeterminate:s,role:i,...l}=e,u=U3({value:o,min:n,max:r,isIndeterminate:s,role:i}),m={height:"100%",...PV().filledTrack};return a.jsx(we.div,{ref:t,style:{width:`${u.percent}%`,...l.style},...u.bind,...l,__css:m})}),K3=ke((e,t)=>{var n;const{value:r,min:o=0,max:s=100,hasStripe:i,isAnimated:l,children:u,borderRadius:p,isIndeterminate:m,"aria-label":h,"aria-labelledby":g,"aria-valuetext":x,title:y,role:b,...w}=on(e),S=Un("Progress",e),j=p??((n=S.track)==null?void 0:n.borderRadius),_={animation:`${_V} 1s linear infinite`},M={...!m&&i&&l&&_,...m&&{position:"absolute",willChange:"left",minWidth:"50%",animation:`${jV} 1s ease infinite normal none running`}},R={overflow:"hidden",position:"relative",...S.track};return a.jsx(we.div,{ref:t,borderRadius:j,__css:R,...w,children:a.jsxs(IV,{value:S,children:[a.jsx(EV,{"aria-label":h,"aria-labelledby":g,"aria-valuetext":x,min:o,max:s,value:r,isIndeterminate:m,css:M,borderRadius:j,title:y,role:b}),u]})})});K3.displayName="Progress";function MV(e){return e&&a1(e)&&a1(e.target)}function OV(e={}){const{onChange:t,value:n,defaultValue:r,name:o,isDisabled:s,isFocusable:i,isNative:l,...u}=e,[p,m]=d.useState(r||""),h=typeof n<"u",g=h?n:p,x=d.useRef(null),y=d.useCallback(()=>{const I=x.current;if(!I)return;let M="input:not(:disabled):checked";const R=I.querySelector(M);if(R){R.focus();return}M="input:not(:disabled)";const D=I.querySelector(M);D==null||D.focus()},[]),w=`radio-${d.useId()}`,S=o||w,j=d.useCallback(I=>{const M=MV(I)?I.target.value:I;h||m(M),t==null||t(String(M))},[t,h]),_=d.useCallback((I={},M=null)=>({...I,ref:It(M,x),role:"radiogroup"}),[]),E=d.useCallback((I={},M=null)=>({...I,ref:M,name:S,[l?"checked":"isChecked"]:g!=null?I.value===g:void 0,onChange(D){j(D)},"data-radiogroup":!0}),[l,S,j,g]);return{getRootProps:_,getRadioProps:E,name:S,ref:x,focus:y,setValue:m,value:g,onChange:j,isDisabled:s,isFocusable:i,htmlProps:u}}var[RV,q3]=Wt({name:"RadioGroupContext",strict:!1}),cm=ke((e,t)=>{const{colorScheme:n,size:r,variant:o,children:s,className:i,isDisabled:l,isFocusable:u,...p}=e,{value:m,onChange:h,getRootProps:g,name:x,htmlProps:y}=OV(p),b=d.useMemo(()=>({name:x,size:r,onChange:h,colorScheme:n,value:m,variant:o,isDisabled:l,isFocusable:u}),[x,r,h,n,m,o,l,u]);return a.jsx(RV,{value:b,children:a.jsx(we.div,{...g(y,t),className:Ye("chakra-radio-group",i),children:s})})});cm.displayName="RadioGroup";var DV={border:"0",clip:"rect(0, 0, 0, 0)",height:"1px",width:"1px",margin:"-1px",padding:"0",overflow:"hidden",whiteSpace:"nowrap",position:"absolute"};function AV(e={}){const{defaultChecked:t,isChecked:n,isFocusable:r,isDisabled:o,isReadOnly:s,isRequired:i,onChange:l,isInvalid:u,name:p,value:m,id:h,"data-radiogroup":g,"aria-describedby":x,...y}=e,b=`radio-${d.useId()}`,w=Pd(),j=!!q3()||!!g;let E=!!w&&!j?w.id:b;E=h??E;const I=o??(w==null?void 0:w.isDisabled),M=s??(w==null?void 0:w.isReadOnly),R=i??(w==null?void 0:w.isRequired),D=u??(w==null?void 0:w.isInvalid),[A,O]=d.useState(!1),[T,X]=d.useState(!1),[B,V]=d.useState(!1),[U,N]=d.useState(!1),[$,q]=d.useState(!!t),F=typeof n<"u",Q=F?n:$;d.useEffect(()=>p5(O),[]);const Y=d.useCallback(de=>{if(M||I){de.preventDefault();return}F||q(de.target.checked),l==null||l(de)},[F,I,M,l]),se=d.useCallback(de=>{de.key===" "&&N(!0)},[N]),ae=d.useCallback(de=>{de.key===" "&&N(!1)},[N]),re=d.useCallback((de={},ge=null)=>({...de,ref:ge,"data-active":dt(U),"data-hover":dt(B),"data-disabled":dt(I),"data-invalid":dt(D),"data-checked":dt(Q),"data-focus":dt(T),"data-focus-visible":dt(T&&A),"data-readonly":dt(M),"aria-hidden":!0,onMouseDown:He(de.onMouseDown,()=>N(!0)),onMouseUp:He(de.onMouseUp,()=>N(!1)),onMouseEnter:He(de.onMouseEnter,()=>V(!0)),onMouseLeave:He(de.onMouseLeave,()=>V(!1))}),[U,B,I,D,Q,T,M,A]),{onFocus:G,onBlur:K}=w??{},ee=d.useCallback((de={},ge=null)=>{const Ce=I&&!r;return{...de,id:E,ref:ge,type:"radio",name:p,value:m,onChange:He(de.onChange,Y),onBlur:He(K,de.onBlur,()=>X(!1)),onFocus:He(G,de.onFocus,()=>X(!0)),onKeyDown:He(de.onKeyDown,se),onKeyUp:He(de.onKeyUp,ae),checked:Q,disabled:Ce,readOnly:M,required:R,"aria-invalid":Co(D),"aria-disabled":Co(Ce),"aria-required":Co(R),"data-readonly":dt(M),"aria-describedby":x,style:DV}},[I,r,E,p,m,Y,K,G,se,ae,Q,M,R,D,x]);return{state:{isInvalid:D,isFocused:T,isChecked:Q,isActive:U,isHovered:B,isDisabled:I,isReadOnly:M,isRequired:R},getCheckboxProps:re,getRadioProps:re,getInputProps:ee,getLabelProps:(de={},ge=null)=>({...de,ref:ge,onMouseDown:He(de.onMouseDown,TV),"data-disabled":dt(I),"data-checked":dt(Q),"data-invalid":dt(D)}),getRootProps:(de,ge=null)=>({...de,ref:ge,"data-disabled":dt(I),"data-checked":dt(Q),"data-invalid":dt(D)}),htmlProps:y}}function TV(e){e.preventDefault(),e.stopPropagation()}function NV(e,t){const n={},r={};for(const[o,s]of Object.entries(e))t.includes(o)?n[o]=s:r[o]=s;return[n,r]}var Ks=ke((e,t)=>{var n;const r=q3(),{onChange:o,value:s}=e,i=Un("Radio",{...r,...e}),l=on(e),{spacing:u="0.5rem",children:p,isDisabled:m=r==null?void 0:r.isDisabled,isFocusable:h=r==null?void 0:r.isFocusable,inputProps:g,...x}=l;let y=e.isChecked;(r==null?void 0:r.value)!=null&&s!=null&&(y=r.value===s);let b=o;r!=null&&r.onChange&&s!=null&&(b=ph(r.onChange,o));const w=(n=e==null?void 0:e.name)!=null?n:r==null?void 0:r.name,{getInputProps:S,getCheckboxProps:j,getLabelProps:_,getRootProps:E,htmlProps:I}=AV({...x,isChecked:y,isFocusable:h,isDisabled:m,onChange:b,name:w}),[M,R]=NV(I,eI),D=j(R),A=S(g,t),O=_(),T=Object.assign({},M,E()),X={display:"inline-flex",alignItems:"center",verticalAlign:"top",cursor:"pointer",position:"relative",...i.container},B={display:"inline-flex",alignItems:"center",justifyContent:"center",flexShrink:0,...i.control},V={userSelect:"none",marginStart:u,...i.label};return a.jsxs(we.label,{className:"chakra-radio",...T,__css:X,children:[a.jsx("input",{className:"chakra-radio__input",...A}),a.jsx(we.span,{className:"chakra-radio__control",...D,__css:B}),p&&a.jsx(we.span,{className:"chakra-radio__label",...O,__css:V,children:p})]})});Ks.displayName="Radio";var X3=ke(function(t,n){const{children:r,placeholder:o,className:s,...i}=t;return a.jsxs(we.select,{...i,ref:n,className:Ye("chakra-select",s),children:[o&&a.jsx("option",{value:"",children:o}),r]})});X3.displayName="SelectField";function $V(e,t){const n={},r={};for(const[o,s]of Object.entries(e))t.includes(o)?n[o]=s:r[o]=s;return[n,r]}var Q3=ke((e,t)=>{var n;const r=Un("Select",e),{rootProps:o,placeholder:s,icon:i,color:l,height:u,h:p,minH:m,minHeight:h,iconColor:g,iconSize:x,...y}=on(e),[b,w]=$V(y,eI),S=db(w),j={width:"100%",height:"fit-content",position:"relative",color:l},_={paddingEnd:"2rem",...r.field,_focus:{zIndex:"unset",...(n=r.field)==null?void 0:n._focus}};return a.jsxs(we.div,{className:"chakra-select__wrapper",__css:j,...b,...o,children:[a.jsx(X3,{ref:t,height:p??u,minH:m??h,placeholder:s,...S,__css:_,children:e.children}),a.jsx(Y3,{"data-disabled":dt(S.disabled),...(g||l)&&{color:g||l},__css:r.icon,...x&&{fontSize:x},children:i})]})});Q3.displayName="Select";var LV=e=>a.jsx("svg",{viewBox:"0 0 24 24",...e,children:a.jsx("path",{fill:"currentColor",d:"M16.59 8.59L12 13.17 7.41 8.59 6 10l6 6 6-6z"})}),zV=we("div",{baseStyle:{position:"absolute",display:"inline-flex",alignItems:"center",justifyContent:"center",pointerEvents:"none",top:"50%",transform:"translateY(-50%)"}}),Y3=e=>{const{children:t=a.jsx(LV,{}),...n}=e,r=d.cloneElement(t,{role:"presentation",className:"chakra-select__icon",focusable:!1,"aria-hidden":!0,style:{width:"1em",height:"1em",color:"currentColor"}});return a.jsx(zV,{...n,className:"chakra-select__icon-wrapper",children:d.isValidElement(t)?r:null})};Y3.displayName="SelectIcon";function FV(){const e=d.useRef(!0);return d.useEffect(()=>{e.current=!1},[]),e.current}function BV(e){const t=d.useRef();return d.useEffect(()=>{t.current=e},[e]),t.current}var HV=we("div",{baseStyle:{boxShadow:"none",backgroundClip:"padding-box",cursor:"default",color:"transparent",pointerEvents:"none",userSelect:"none","&::before, &::after, *":{visibility:"hidden"}}}),H1=tI("skeleton-start-color"),V1=tI("skeleton-end-color"),VV=ma({from:{opacity:0},to:{opacity:1}}),WV=ma({from:{borderColor:H1.reference,background:H1.reference},to:{borderColor:V1.reference,background:V1.reference}}),Gh=ke((e,t)=>{const n={...e,fadeDuration:typeof e.fadeDuration=="number"?e.fadeDuration:.4,speed:typeof e.speed=="number"?e.speed:.8},r=oi("Skeleton",n),o=FV(),{startColor:s="",endColor:i="",isLoaded:l,fadeDuration:u,speed:p,className:m,fitContent:h,...g}=on(n),[x,y]=Ho("colors",[s,i]),b=BV(l),w=Ye("chakra-skeleton",m),S={...x&&{[H1.variable]:x},...y&&{[V1.variable]:y}};if(l){const j=o||b?"none":`${VV} ${u}s`;return a.jsx(we.div,{ref:t,className:w,__css:{animation:j},...g})}return a.jsx(HV,{ref:t,className:w,...g,__css:{width:h?"fit-content":void 0,...r,...S,_dark:{...r._dark,...S},animation:`${p}s linear infinite alternate ${WV}`}})});Gh.displayName="Skeleton";var ho=e=>e?"":void 0,uc=e=>e?!0:void 0,ai=(...e)=>e.filter(Boolean).join(" ");function dc(...e){return function(n){e.some(r=>(r==null||r(n),n==null?void 0:n.defaultPrevented))}}function UV(e){return{root:`slider-root-${e}`,getThumb:t=>`slider-thumb-${e}-${t}`,getInput:t=>`slider-input-${e}-${t}`,track:`slider-track-${e}`,innerTrack:`slider-filled-track-${e}`,getMarker:t=>`slider-marker-${e}-${t}`,output:`slider-output-${e}`}}function Ru(e){const{orientation:t,vertical:n,horizontal:r}=e;return t==="vertical"?n:r}var zp={width:0,height:0},op=e=>e||zp;function Z3(e){const{orientation:t,thumbPercents:n,thumbRects:r,isReversed:o}=e,s=b=>{var w;const S=(w=r[b])!=null?w:zp;return{position:"absolute",userSelect:"none",WebkitUserSelect:"none",MozUserSelect:"none",msUserSelect:"none",touchAction:"none",...Ru({orientation:t,vertical:{bottom:`calc(${n[b]}% - ${S.height/2}px)`},horizontal:{left:`calc(${n[b]}% - ${S.width/2}px)`}})}},i=t==="vertical"?r.reduce((b,w)=>op(b).height>op(w).height?b:w,zp):r.reduce((b,w)=>op(b).width>op(w).width?b:w,zp),l={position:"relative",touchAction:"none",WebkitTapHighlightColor:"rgba(0,0,0,0)",userSelect:"none",outline:0,...Ru({orientation:t,vertical:i?{paddingLeft:i.width/2,paddingRight:i.width/2}:{},horizontal:i?{paddingTop:i.height/2,paddingBottom:i.height/2}:{}})},u={position:"absolute",...Ru({orientation:t,vertical:{left:"50%",transform:"translateX(-50%)",height:"100%"},horizontal:{top:"50%",transform:"translateY(-50%)",width:"100%"}})},p=n.length===1,m=[0,o?100-n[0]:n[0]],h=p?m:n;let g=h[0];!p&&o&&(g=100-g);const x=Math.abs(h[h.length-1]-h[0]),y={...u,...Ru({orientation:t,vertical:o?{height:`${x}%`,top:`${g}%`}:{height:`${x}%`,bottom:`${g}%`},horizontal:o?{width:`${x}%`,right:`${g}%`}:{width:`${x}%`,left:`${g}%`}})};return{trackStyle:u,innerTrackStyle:y,rootStyle:l,getThumbStyle:s}}function J3(e){const{isReversed:t,direction:n,orientation:r}=e;return n==="ltr"||r==="vertical"?t:!t}function GV(e,t,n,r){return e.addEventListener(t,n,r),()=>{e.removeEventListener(t,n,r)}}function KV(e){const t=XV(e);return typeof t.PointerEvent<"u"&&e instanceof t.PointerEvent?e.pointerType==="mouse":e instanceof t.MouseEvent}function eP(e){return!!e.touches}function qV(e){return eP(e)&&e.touches.length>1}function XV(e){var t;return(t=e.view)!=null?t:window}function QV(e,t="page"){const n=e.touches[0]||e.changedTouches[0];return{x:n[`${t}X`],y:n[`${t}Y`]}}function YV(e,t="page"){return{x:e[`${t}X`],y:e[`${t}Y`]}}function tP(e,t="page"){return eP(e)?QV(e,t):YV(e,t)}function ZV(e){return t=>{const n=KV(t);(!n||n&&t.button===0)&&e(t)}}function JV(e,t=!1){function n(o){e(o,{point:tP(o)})}return t?ZV(n):n}function Fp(e,t,n,r){return GV(e,t,JV(n,t==="pointerdown"),r)}var eW=Object.defineProperty,tW=(e,t,n)=>t in e?eW(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,$o=(e,t,n)=>(tW(e,typeof t!="symbol"?t+"":t,n),n),nW=class{constructor(e,t,n){$o(this,"history",[]),$o(this,"startEvent",null),$o(this,"lastEvent",null),$o(this,"lastEventInfo",null),$o(this,"handlers",{}),$o(this,"removeListeners",()=>{}),$o(this,"threshold",3),$o(this,"win"),$o(this,"updatePoint",()=>{if(!(this.lastEvent&&this.lastEventInfo))return;const l=xv(this.lastEventInfo,this.history),u=this.startEvent!==null,p=aW(l.offset,{x:0,y:0})>=this.threshold;if(!u&&!p)return;const{timestamp:m}=Qw();this.history.push({...l.point,timestamp:m});const{onStart:h,onMove:g}=this.handlers;u||(h==null||h(this.lastEvent,l),this.startEvent=this.lastEvent),g==null||g(this.lastEvent,l)}),$o(this,"onPointerMove",(l,u)=>{this.lastEvent=l,this.lastEventInfo=u,_$.update(this.updatePoint,!0)}),$o(this,"onPointerUp",(l,u)=>{const p=xv(u,this.history),{onEnd:m,onSessionEnd:h}=this.handlers;h==null||h(l,p),this.end(),!(!m||!this.startEvent)&&(m==null||m(l,p))});var r;if(this.win=(r=e.view)!=null?r:window,qV(e))return;this.handlers=t,n&&(this.threshold=n),e.stopPropagation(),e.preventDefault();const o={point:tP(e)},{timestamp:s}=Qw();this.history=[{...o.point,timestamp:s}];const{onSessionStart:i}=t;i==null||i(e,xv(o,this.history)),this.removeListeners=sW(Fp(this.win,"pointermove",this.onPointerMove),Fp(this.win,"pointerup",this.onPointerUp),Fp(this.win,"pointercancel",this.onPointerUp))}updateHandlers(e){this.handlers=e}end(){var e;(e=this.removeListeners)==null||e.call(this),I$.update(this.updatePoint)}};function TS(e,t){return{x:e.x-t.x,y:e.y-t.y}}function xv(e,t){return{point:e.point,delta:TS(e.point,t[t.length-1]),offset:TS(e.point,t[0]),velocity:oW(t,.1)}}var rW=e=>e*1e3;function oW(e,t){if(e.length<2)return{x:0,y:0};let n=e.length-1,r=null;const o=e[e.length-1];for(;n>=0&&(r=e[n],!(o.timestamp-r.timestamp>rW(t)));)n--;if(!r)return{x:0,y:0};const s=(o.timestamp-r.timestamp)/1e3;if(s===0)return{x:0,y:0};const i={x:(o.x-r.x)/s,y:(o.y-r.y)/s};return i.x===1/0&&(i.x=0),i.y===1/0&&(i.y=0),i}function sW(...e){return t=>e.reduce((n,r)=>r(n),t)}function bv(e,t){return Math.abs(e-t)}function NS(e){return"x"in e&&"y"in e}function aW(e,t){if(typeof e=="number"&&typeof t=="number")return bv(e,t);if(NS(e)&&NS(t)){const n=bv(e.x,t.x),r=bv(e.y,t.y);return Math.sqrt(n**2+r**2)}return 0}function nP(e){const t=d.useRef(null);return t.current=e,t}function rP(e,t){const{onPan:n,onPanStart:r,onPanEnd:o,onPanSessionStart:s,onPanSessionEnd:i,threshold:l}=t,u=!!(n||r||o||s||i),p=d.useRef(null),m=nP({onSessionStart:s,onSessionEnd:i,onStart:r,onMove:n,onEnd(h,g){p.current=null,o==null||o(h,g)}});d.useEffect(()=>{var h;(h=p.current)==null||h.updateHandlers(m.current)}),d.useEffect(()=>{const h=e.current;if(!h||!u)return;function g(x){p.current=new nW(x,m.current,l)}return Fp(h,"pointerdown",g)},[e,u,m,l]),d.useEffect(()=>()=>{var h;(h=p.current)==null||h.end(),p.current=null},[])}function iW(e,t){if(!e){t(void 0);return}t({width:e.offsetWidth,height:e.offsetHeight});const n=e.ownerDocument.defaultView??window,r=new n.ResizeObserver(o=>{if(!Array.isArray(o)||!o.length)return;const[s]=o;let i,l;if("borderBoxSize"in s){const u=s.borderBoxSize,p=Array.isArray(u)?u[0]:u;i=p.inlineSize,l=p.blockSize}else i=e.offsetWidth,l=e.offsetHeight;t({width:i,height:l})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}var lW=globalThis!=null&&globalThis.document?d.useLayoutEffect:d.useEffect;function cW(e,t){var n,r;if(!e||!e.parentElement)return;const o=(r=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?r:window,s=new o.MutationObserver(()=>{t()});return s.observe(e.parentElement,{childList:!0}),()=>{s.disconnect()}}function oP({getNodes:e,observeMutation:t=!0}){const[n,r]=d.useState([]),[o,s]=d.useState(0);return lW(()=>{const i=e(),l=i.map((u,p)=>iW(u,m=>{r(h=>[...h.slice(0,p),m,...h.slice(p+1)])}));if(t){const u=i[0];l.push(cW(u,()=>{s(p=>p+1)}))}return()=>{l.forEach(u=>{u==null||u()})}},[o]),n}function uW(e){return typeof e=="object"&&e!==null&&"current"in e}function dW(e){const[t]=oP({observeMutation:!1,getNodes(){return[uW(e)?e.current:e]}});return t}function fW(e){const{min:t=0,max:n=100,onChange:r,value:o,defaultValue:s,isReversed:i,direction:l="ltr",orientation:u="horizontal",id:p,isDisabled:m,isReadOnly:h,onChangeStart:g,onChangeEnd:x,step:y=1,getAriaValueText:b,"aria-valuetext":w,"aria-label":S,"aria-labelledby":j,name:_,focusThumbOnChange:E=!0,minStepsBetweenThumbs:I=0,...M}=e,R=un(g),D=un(x),A=un(b),O=J3({isReversed:i,direction:l,orientation:u}),[T,X]=_d({value:o,defaultValue:s??[25,75],onChange:r});if(!Array.isArray(T))throw new TypeError(`[range-slider] You passed an invalid value for \`value\` or \`defaultValue\`, expected \`Array\` but got \`${typeof T}\``);const[B,V]=d.useState(!1),[U,N]=d.useState(!1),[$,q]=d.useState(-1),F=!(m||h),Q=d.useRef(T),Y=T.map(Se=>ac(Se,t,n)),se=I*y,ae=pW(Y,t,n,se),re=d.useRef({eventSource:null,value:[],valueBounds:[]});re.current.value=Y,re.current.valueBounds=ae;const G=Y.map(Se=>n-Se+t),ee=(O?G:Y).map(Se=>om(Se,t,n)),le=u==="vertical",J=d.useRef(null),ie=d.useRef(null),de=oP({getNodes(){const Se=ie.current,Be=Se==null?void 0:Se.querySelectorAll("[role=slider]");return Be?Array.from(Be):[]}}),ge=d.useId(),he=UV(p??ge),fe=d.useCallback(Se=>{var Be,ze;if(!J.current)return;re.current.eventSource="pointer";const Ge=J.current.getBoundingClientRect(),{clientX:pt,clientY:Pn}=(ze=(Be=Se.touches)==null?void 0:Be[0])!=null?ze:Se,Dt=le?Ge.bottom-Pn:pt-Ge.left,At=le?Ge.height:Ge.width;let pr=Dt/At;return O&&(pr=1-pr),h5(pr,t,n)},[le,O,n,t]),Oe=(n-t)/10,_e=y||(n-t)/100,Ne=d.useMemo(()=>({setValueAtIndex(Se,Be){if(!F)return;const ze=re.current.valueBounds[Se];Be=parseFloat(P1(Be,ze.min,_e)),Be=ac(Be,ze.min,ze.max);const Ge=[...re.current.value];Ge[Se]=Be,X(Ge)},setActiveIndex:q,stepUp(Se,Be=_e){const ze=re.current.value[Se],Ge=O?ze-Be:ze+Be;Ne.setValueAtIndex(Se,Ge)},stepDown(Se,Be=_e){const ze=re.current.value[Se],Ge=O?ze+Be:ze-Be;Ne.setValueAtIndex(Se,Ge)},reset(){X(Q.current)}}),[_e,O,X,F]),nt=d.useCallback(Se=>{const Be=Se.key,Ge={ArrowRight:()=>Ne.stepUp($),ArrowUp:()=>Ne.stepUp($),ArrowLeft:()=>Ne.stepDown($),ArrowDown:()=>Ne.stepDown($),PageUp:()=>Ne.stepUp($,Oe),PageDown:()=>Ne.stepDown($,Oe),Home:()=>{const{min:pt}=ae[$];Ne.setValueAtIndex($,pt)},End:()=>{const{max:pt}=ae[$];Ne.setValueAtIndex($,pt)}}[Be];Ge&&(Se.preventDefault(),Se.stopPropagation(),Ge(Se),re.current.eventSource="keyboard")},[Ne,$,Oe,ae]),{getThumbStyle:$e,rootStyle:Pt,trackStyle:Ze,innerTrackStyle:ot}=d.useMemo(()=>Z3({isReversed:O,orientation:u,thumbRects:de,thumbPercents:ee}),[O,u,ee,de]),ye=d.useCallback(Se=>{var Be;const ze=Se??$;if(ze!==-1&&E){const Ge=he.getThumb(ze),pt=(Be=ie.current)==null?void 0:Be.ownerDocument.getElementById(Ge);pt&&setTimeout(()=>pt.focus())}},[E,$,he]);pa(()=>{re.current.eventSource==="keyboard"&&(D==null||D(re.current.value))},[Y,D]);const De=Se=>{const Be=fe(Se)||0,ze=re.current.value.map(At=>Math.abs(At-Be)),Ge=Math.min(...ze);let pt=ze.indexOf(Ge);const Pn=ze.filter(At=>At===Ge);Pn.length>1&&Be>re.current.value[pt]&&(pt=pt+Pn.length-1),q(pt),Ne.setValueAtIndex(pt,Be),ye(pt)},ut=Se=>{if($==-1)return;const Be=fe(Se)||0;q($),Ne.setValueAtIndex($,Be),ye($)};rP(ie,{onPanSessionStart(Se){F&&(V(!0),De(Se),R==null||R(re.current.value))},onPanSessionEnd(){F&&(V(!1),D==null||D(re.current.value))},onPan(Se){F&&ut(Se)}});const bt=d.useCallback((Se={},Be=null)=>({...Se,...M,id:he.root,ref:It(Be,ie),tabIndex:-1,"aria-disabled":uc(m),"data-focused":ho(U),style:{...Se.style,...Pt}}),[M,m,U,Pt,he]),be=d.useCallback((Se={},Be=null)=>({...Se,ref:It(Be,J),id:he.track,"data-disabled":ho(m),style:{...Se.style,...Ze}}),[m,Ze,he]),Je=d.useCallback((Se={},Be=null)=>({...Se,ref:Be,id:he.innerTrack,style:{...Se.style,...ot}}),[ot,he]),lt=d.useCallback((Se,Be=null)=>{var ze;const{index:Ge,...pt}=Se,Pn=Y[Ge];if(Pn==null)throw new TypeError(`[range-slider > thumb] Cannot find value at index \`${Ge}\`. The \`value\` or \`defaultValue\` length is : ${Y.length}`);const Dt=ae[Ge];return{...pt,ref:Be,role:"slider",tabIndex:F?0:void 0,id:he.getThumb(Ge),"data-active":ho(B&&$===Ge),"aria-valuetext":(ze=A==null?void 0:A(Pn))!=null?ze:w==null?void 0:w[Ge],"aria-valuemin":Dt.min,"aria-valuemax":Dt.max,"aria-valuenow":Pn,"aria-orientation":u,"aria-disabled":uc(m),"aria-readonly":uc(h),"aria-label":S==null?void 0:S[Ge],"aria-labelledby":S!=null&&S[Ge]||j==null?void 0:j[Ge],style:{...Se.style,...$e(Ge)},onKeyDown:dc(Se.onKeyDown,nt),onFocus:dc(Se.onFocus,()=>{N(!0),q(Ge)}),onBlur:dc(Se.onBlur,()=>{N(!1),q(-1)})}},[he,Y,ae,F,B,$,A,w,u,m,h,S,j,$e,nt,N]),ft=d.useCallback((Se={},Be=null)=>({...Se,ref:Be,id:he.output,htmlFor:Y.map((ze,Ge)=>he.getThumb(Ge)).join(" "),"aria-live":"off"}),[he,Y]),Me=d.useCallback((Se,Be=null)=>{const{value:ze,...Ge}=Se,pt=!(zen),Pn=ze>=Y[0]&&ze<=Y[Y.length-1];let Dt=om(ze,t,n);Dt=O?100-Dt:Dt;const At={position:"absolute",pointerEvents:"none",...Ru({orientation:u,vertical:{bottom:`${Dt}%`},horizontal:{left:`${Dt}%`}})};return{...Ge,ref:Be,id:he.getMarker(Se.value),role:"presentation","aria-hidden":!0,"data-disabled":ho(m),"data-invalid":ho(!pt),"data-highlighted":ho(Pn),style:{...Se.style,...At}}},[m,O,n,t,u,Y,he]),Le=d.useCallback((Se,Be=null)=>{const{index:ze,...Ge}=Se;return{...Ge,ref:Be,id:he.getInput(ze),type:"hidden",value:Y[ze],name:Array.isArray(_)?_[ze]:`${_}-${ze}`}},[_,Y,he]);return{state:{value:Y,isFocused:U,isDragging:B,getThumbPercent:Se=>ee[Se],getThumbMinValue:Se=>ae[Se].min,getThumbMaxValue:Se=>ae[Se].max},actions:Ne,getRootProps:bt,getTrackProps:be,getInnerTrackProps:Je,getThumbProps:lt,getMarkerProps:Me,getInputProps:Le,getOutputProps:ft}}function pW(e,t,n,r){return e.map((o,s)=>{const i=s===0?t:e[s-1]+r,l=s===e.length-1?n:e[s+1]-r;return{min:i,max:l}})}var[mW,Kh]=Wt({name:"SliderContext",errorMessage:"useSliderContext: `context` is undefined. Seems you forgot to wrap all slider components within "}),[hW,qh]=Wt({name:"RangeSliderStylesContext",errorMessage:`useRangeSliderStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),Bb=ke(function(t,n){const r={orientation:"horizontal",...t},o=Un("Slider",r),s=on(r),{direction:i}=bd();s.direction=i;const{getRootProps:l,...u}=fW(s),p=d.useMemo(()=>({...u,name:r.name}),[u,r.name]);return a.jsx(mW,{value:p,children:a.jsx(hW,{value:o,children:a.jsx(we.div,{...l({},n),className:"chakra-slider",__css:o.container,children:r.children})})})});Bb.displayName="RangeSlider";var nd=ke(function(t,n){const{getThumbProps:r,getInputProps:o,name:s}=Kh(),i=qh(),l=r(t,n);return a.jsxs(we.div,{...l,className:ai("chakra-slider__thumb",t.className),__css:i.thumb,children:[l.children,s&&a.jsx("input",{...o({index:t.index})})]})});nd.displayName="RangeSliderThumb";var Hb=ke(function(t,n){const{getTrackProps:r}=Kh(),o=qh(),s=r(t,n);return a.jsx(we.div,{...s,className:ai("chakra-slider__track",t.className),__css:o.track,"data-testid":"chakra-range-slider-track"})});Hb.displayName="RangeSliderTrack";var Vb=ke(function(t,n){const{getInnerTrackProps:r}=Kh(),o=qh(),s=r(t,n);return a.jsx(we.div,{...s,className:"chakra-slider__filled-track",__css:o.filledTrack})});Vb.displayName="RangeSliderFilledTrack";var Ai=ke(function(t,n){const{getMarkerProps:r}=Kh(),o=qh(),s=r(t,n);return a.jsx(we.div,{...s,className:ai("chakra-slider__marker",t.className),__css:o.mark})});Ai.displayName="RangeSliderMark";function gW(e){var t;const{min:n=0,max:r=100,onChange:o,value:s,defaultValue:i,isReversed:l,direction:u="ltr",orientation:p="horizontal",id:m,isDisabled:h,isReadOnly:g,onChangeStart:x,onChangeEnd:y,step:b=1,getAriaValueText:w,"aria-valuetext":S,"aria-label":j,"aria-labelledby":_,name:E,focusThumbOnChange:I=!0,...M}=e,R=un(x),D=un(y),A=un(w),O=J3({isReversed:l,direction:u,orientation:p}),[T,X]=_d({value:s,defaultValue:i??xW(n,r),onChange:o}),[B,V]=d.useState(!1),[U,N]=d.useState(!1),$=!(h||g),q=(r-n)/10,F=b||(r-n)/100,Q=ac(T,n,r),Y=r-Q+n,ae=om(O?Y:Q,n,r),re=p==="vertical",G=nP({min:n,max:r,step:b,isDisabled:h,value:Q,isInteractive:$,isReversed:O,isVertical:re,eventSource:null,focusThumbOnChange:I,orientation:p}),K=d.useRef(null),ee=d.useRef(null),le=d.useRef(null),J=d.useId(),ie=m??J,[de,ge]=[`slider-thumb-${ie}`,`slider-track-${ie}`],Ce=d.useCallback(Me=>{var Le,Ut;if(!K.current)return;const Se=G.current;Se.eventSource="pointer";const Be=K.current.getBoundingClientRect(),{clientX:ze,clientY:Ge}=(Ut=(Le=Me.touches)==null?void 0:Le[0])!=null?Ut:Me,pt=re?Be.bottom-Ge:ze-Be.left,Pn=re?Be.height:Be.width;let Dt=pt/Pn;O&&(Dt=1-Dt);let At=h5(Dt,Se.min,Se.max);return Se.step&&(At=parseFloat(P1(At,Se.min,Se.step))),At=ac(At,Se.min,Se.max),At},[re,O,G]),he=d.useCallback(Me=>{const Le=G.current;Le.isInteractive&&(Me=parseFloat(P1(Me,Le.min,F)),Me=ac(Me,Le.min,Le.max),X(Me))},[F,X,G]),fe=d.useMemo(()=>({stepUp(Me=F){const Le=O?Q-Me:Q+Me;he(Le)},stepDown(Me=F){const Le=O?Q+Me:Q-Me;he(Le)},reset(){he(i||0)},stepTo(Me){he(Me)}}),[he,O,Q,F,i]),Oe=d.useCallback(Me=>{const Le=G.current,Se={ArrowRight:()=>fe.stepUp(),ArrowUp:()=>fe.stepUp(),ArrowLeft:()=>fe.stepDown(),ArrowDown:()=>fe.stepDown(),PageUp:()=>fe.stepUp(q),PageDown:()=>fe.stepDown(q),Home:()=>he(Le.min),End:()=>he(Le.max)}[Me.key];Se&&(Me.preventDefault(),Me.stopPropagation(),Se(Me),Le.eventSource="keyboard")},[fe,he,q,G]),_e=(t=A==null?void 0:A(Q))!=null?t:S,Ne=dW(ee),{getThumbStyle:nt,rootStyle:$e,trackStyle:Pt,innerTrackStyle:Ze}=d.useMemo(()=>{const Me=G.current,Le=Ne??{width:0,height:0};return Z3({isReversed:O,orientation:Me.orientation,thumbRects:[Le],thumbPercents:[ae]})},[O,Ne,ae,G]),ot=d.useCallback(()=>{G.current.focusThumbOnChange&&setTimeout(()=>{var Le;return(Le=ee.current)==null?void 0:Le.focus()})},[G]);pa(()=>{const Me=G.current;ot(),Me.eventSource==="keyboard"&&(D==null||D(Me.value))},[Q,D]);function ye(Me){const Le=Ce(Me);Le!=null&&Le!==G.current.value&&X(Le)}rP(le,{onPanSessionStart(Me){const Le=G.current;Le.isInteractive&&(V(!0),ot(),ye(Me),R==null||R(Le.value))},onPanSessionEnd(){const Me=G.current;Me.isInteractive&&(V(!1),D==null||D(Me.value))},onPan(Me){G.current.isInteractive&&ye(Me)}});const De=d.useCallback((Me={},Le=null)=>({...Me,...M,ref:It(Le,le),tabIndex:-1,"aria-disabled":uc(h),"data-focused":ho(U),style:{...Me.style,...$e}}),[M,h,U,$e]),ut=d.useCallback((Me={},Le=null)=>({...Me,ref:It(Le,K),id:ge,"data-disabled":ho(h),style:{...Me.style,...Pt}}),[h,ge,Pt]),bt=d.useCallback((Me={},Le=null)=>({...Me,ref:Le,style:{...Me.style,...Ze}}),[Ze]),be=d.useCallback((Me={},Le=null)=>({...Me,ref:It(Le,ee),role:"slider",tabIndex:$?0:void 0,id:de,"data-active":ho(B),"aria-valuetext":_e,"aria-valuemin":n,"aria-valuemax":r,"aria-valuenow":Q,"aria-orientation":p,"aria-disabled":uc(h),"aria-readonly":uc(g),"aria-label":j,"aria-labelledby":j?void 0:_,style:{...Me.style,...nt(0)},onKeyDown:dc(Me.onKeyDown,Oe),onFocus:dc(Me.onFocus,()=>N(!0)),onBlur:dc(Me.onBlur,()=>N(!1))}),[$,de,B,_e,n,r,Q,p,h,g,j,_,nt,Oe]),Je=d.useCallback((Me,Le=null)=>{const Ut=!(Me.valuer),Se=Q>=Me.value,Be=om(Me.value,n,r),ze={position:"absolute",pointerEvents:"none",...vW({orientation:p,vertical:{bottom:O?`${100-Be}%`:`${Be}%`},horizontal:{left:O?`${100-Be}%`:`${Be}%`}})};return{...Me,ref:Le,role:"presentation","aria-hidden":!0,"data-disabled":ho(h),"data-invalid":ho(!Ut),"data-highlighted":ho(Se),style:{...Me.style,...ze}}},[h,O,r,n,p,Q]),lt=d.useCallback((Me={},Le=null)=>({...Me,ref:Le,type:"hidden",value:Q,name:E}),[E,Q]);return{state:{value:Q,isFocused:U,isDragging:B},actions:fe,getRootProps:De,getTrackProps:ut,getInnerTrackProps:bt,getThumbProps:be,getMarkerProps:Je,getInputProps:lt}}function vW(e){const{orientation:t,vertical:n,horizontal:r}=e;return t==="vertical"?n:r}function xW(e,t){return t"}),[yW,Qh]=Wt({name:"SliderStylesContext",hookName:"useSliderStyles",providerName:""}),Wb=ke((e,t)=>{var n;const r={...e,orientation:(n=e==null?void 0:e.orientation)!=null?n:"horizontal"},o=Un("Slider",r),s=on(r),{direction:i}=bd();s.direction=i;const{getInputProps:l,getRootProps:u,...p}=gW(s),m=u(),h=l({},t);return a.jsx(bW,{value:p,children:a.jsx(yW,{value:o,children:a.jsxs(we.div,{...m,className:ai("chakra-slider",r.className),__css:o.container,children:[r.children,a.jsx("input",{...h})]})})})});Wb.displayName="Slider";var Ub=ke((e,t)=>{const{getThumbProps:n}=Xh(),r=Qh(),o=n(e,t);return a.jsx(we.div,{...o,className:ai("chakra-slider__thumb",e.className),__css:r.thumb})});Ub.displayName="SliderThumb";var Gb=ke((e,t)=>{const{getTrackProps:n}=Xh(),r=Qh(),o=n(e,t);return a.jsx(we.div,{...o,className:ai("chakra-slider__track",e.className),__css:r.track})});Gb.displayName="SliderTrack";var Kb=ke((e,t)=>{const{getInnerTrackProps:n}=Xh(),r=Qh(),o=n(e,t);return a.jsx(we.div,{...o,className:ai("chakra-slider__filled-track",e.className),__css:r.filledTrack})});Kb.displayName="SliderFilledTrack";var Ul=ke((e,t)=>{const{getMarkerProps:n}=Xh(),r=Qh(),o=n(e,t);return a.jsx(we.div,{...o,className:ai("chakra-slider__marker",e.className),__css:r.mark})});Ul.displayName="SliderMark";var[CW,sP]=Wt({name:"StatStylesContext",errorMessage:`useStatStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),aP=ke(function(t,n){const r=Un("Stat",t),o={position:"relative",flex:"1 1 0%",...r.container},{className:s,children:i,...l}=on(t);return a.jsx(CW,{value:r,children:a.jsx(we.div,{ref:n,...l,className:Ye("chakra-stat",s),__css:o,children:a.jsx("dl",{children:i})})})});aP.displayName="Stat";var iP=ke(function(t,n){return a.jsx(we.div,{...t,ref:n,role:"group",className:Ye("chakra-stat__group",t.className),__css:{display:"flex",flexWrap:"wrap",justifyContent:"space-around",alignItems:"flex-start"}})});iP.displayName="StatGroup";var lP=ke(function(t,n){const r=sP();return a.jsx(we.dt,{ref:n,...t,className:Ye("chakra-stat__label",t.className),__css:r.label})});lP.displayName="StatLabel";var cP=ke(function(t,n){const r=sP();return a.jsx(we.dd,{ref:n,...t,className:Ye("chakra-stat__number",t.className),__css:{...r.number,fontFeatureSettings:"pnum",fontVariantNumeric:"proportional-nums"}})});cP.displayName="StatNumber";var qb=ke(function(t,n){const r=Un("Switch",t),{spacing:o="0.5rem",children:s,...i}=on(t),{getIndicatorProps:l,getInputProps:u,getCheckboxProps:p,getRootProps:m,getLabelProps:h}=m5(i),g=d.useMemo(()=>({display:"inline-block",position:"relative",verticalAlign:"middle",lineHeight:0,...r.container}),[r.container]),x=d.useMemo(()=>({display:"inline-flex",flexShrink:0,justifyContent:"flex-start",boxSizing:"content-box",cursor:"pointer",...r.track}),[r.track]),y=d.useMemo(()=>({userSelect:"none",marginStart:o,...r.label}),[o,r.label]);return a.jsxs(we.label,{...m(),className:Ye("chakra-switch",t.className),__css:g,children:[a.jsx("input",{className:"chakra-switch__input",...u({},n)}),a.jsx(we.span,{...p(),className:"chakra-switch__track",__css:x,children:a.jsx(we.span,{__css:r.thumb,className:"chakra-switch__thumb",...l()})}),s&&a.jsx(we.span,{className:"chakra-switch__label",...h(),__css:y,children:s})]})});qb.displayName="Switch";var[wW,SW,kW,jW]=lb();function _W(e){var t;const{defaultIndex:n,onChange:r,index:o,isManual:s,isLazy:i,lazyBehavior:l="unmount",orientation:u="horizontal",direction:p="ltr",...m}=e,[h,g]=d.useState(n??0),[x,y]=_d({defaultValue:n??0,value:o,onChange:r});d.useEffect(()=>{o!=null&&g(o)},[o]);const b=kW(),w=d.useId();return{id:`tabs-${(t=e.id)!=null?t:w}`,selectedIndex:x,focusedIndex:h,setSelectedIndex:y,setFocusedIndex:g,isManual:s,isLazy:i,lazyBehavior:l,orientation:u,descendants:b,direction:p,htmlProps:m}}var[IW,Yh]=Wt({name:"TabsContext",errorMessage:"useTabsContext: `context` is undefined. Seems you forgot to wrap all tabs components within "});function PW(e){const{focusedIndex:t,orientation:n,direction:r}=Yh(),o=SW(),s=d.useCallback(i=>{const l=()=>{var j;const _=o.nextEnabled(t);_&&((j=_.node)==null||j.focus())},u=()=>{var j;const _=o.prevEnabled(t);_&&((j=_.node)==null||j.focus())},p=()=>{var j;const _=o.firstEnabled();_&&((j=_.node)==null||j.focus())},m=()=>{var j;const _=o.lastEnabled();_&&((j=_.node)==null||j.focus())},h=n==="horizontal",g=n==="vertical",x=i.key,y=r==="ltr"?"ArrowLeft":"ArrowRight",b=r==="ltr"?"ArrowRight":"ArrowLeft",S={[y]:()=>h&&u(),[b]:()=>h&&l(),ArrowDown:()=>g&&l(),ArrowUp:()=>g&&u(),Home:p,End:m}[x];S&&(i.preventDefault(),S(i))},[o,t,n,r]);return{...e,role:"tablist","aria-orientation":n,onKeyDown:He(e.onKeyDown,s)}}function EW(e){const{isDisabled:t=!1,isFocusable:n=!1,...r}=e,{setSelectedIndex:o,isManual:s,id:i,setFocusedIndex:l,selectedIndex:u}=Yh(),{index:p,register:m}=jW({disabled:t&&!n}),h=p===u,g=()=>{o(p)},x=()=>{l(p),!s&&!(t&&n)&&o(p)},y=h3({...r,ref:It(m,e.ref),isDisabled:t,isFocusable:n,onClick:He(e.onClick,g)}),b="button";return{...y,id:uP(i,p),role:"tab",tabIndex:h?0:-1,type:b,"aria-selected":h,"aria-controls":dP(i,p),onFocus:t?void 0:He(e.onFocus,x)}}var[MW,OW]=Wt({});function RW(e){const t=Yh(),{id:n,selectedIndex:r}=t,s=kh(e.children).map((i,l)=>d.createElement(MW,{key:l,value:{isSelected:l===r,id:dP(n,l),tabId:uP(n,l),selectedIndex:r}},i));return{...e,children:s}}function DW(e){const{children:t,...n}=e,{isLazy:r,lazyBehavior:o}=Yh(),{isSelected:s,id:i,tabId:l}=OW(),u=d.useRef(!1);s&&(u.current=!0);const p=zb({wasSelected:u.current,isSelected:s,enabled:r,mode:o});return{tabIndex:0,...n,children:p?t:null,role:"tabpanel","aria-labelledby":l,hidden:!s,id:i}}function uP(e,t){return`${e}--tab-${t}`}function dP(e,t){return`${e}--tabpanel-${t}`}var[AW,Zh]=Wt({name:"TabsStylesContext",errorMessage:`useTabsStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),rl=ke(function(t,n){const r=Un("Tabs",t),{children:o,className:s,...i}=on(t),{htmlProps:l,descendants:u,...p}=_W(i),m=d.useMemo(()=>p,[p]),{isFitted:h,...g}=l;return a.jsx(wW,{value:u,children:a.jsx(IW,{value:m,children:a.jsx(AW,{value:r,children:a.jsx(we.div,{className:Ye("chakra-tabs",s),ref:n,...g,__css:r.root,children:o})})})})});rl.displayName="Tabs";var ol=ke(function(t,n){const r=PW({...t,ref:n}),s={display:"flex",...Zh().tablist};return a.jsx(we.div,{...r,className:Ye("chakra-tabs__tablist",t.className),__css:s})});ol.displayName="TabList";var So=ke(function(t,n){const r=DW({...t,ref:n}),o=Zh();return a.jsx(we.div,{outline:"0",...r,className:Ye("chakra-tabs__tab-panel",t.className),__css:o.tabpanel})});So.displayName="TabPanel";var zc=ke(function(t,n){const r=RW(t),o=Zh();return a.jsx(we.div,{...r,width:"100%",ref:n,className:Ye("chakra-tabs__tab-panels",t.className),__css:o.tabpanels})});zc.displayName="TabPanels";var Tr=ke(function(t,n){const r=Zh(),o=EW({...t,ref:n}),s={outline:"0",display:"flex",alignItems:"center",justifyContent:"center",...r.tab};return a.jsx(we.button,{...o,className:Ye("chakra-tabs__tab",t.className),__css:s})});Tr.displayName="Tab";function TW(e,t=[]){const n=Object.assign({},e);for(const r of t)r in n&&delete n[r];return n}var NW=["h","minH","height","minHeight"],fP=ke((e,t)=>{const n=oi("Textarea",e),{className:r,rows:o,...s}=on(e),i=db(s),l=o?TW(n,NW):n;return a.jsx(we.textarea,{ref:t,rows:o,...i,className:Ye("chakra-textarea",r),__css:l})});fP.displayName="Textarea";var $W={exit:{scale:.85,opacity:0,transition:{opacity:{duration:.15,easings:"easeInOut"},scale:{duration:.2,easings:"easeInOut"}}},enter:{scale:1,opacity:1,transition:{opacity:{easings:"easeOut",duration:.2},scale:{duration:.2,ease:[.175,.885,.4,1.1]}}}},W1=e=>{var t;return((t=e.current)==null?void 0:t.ownerDocument)||document},Bp=e=>{var t,n;return((n=(t=e.current)==null?void 0:t.ownerDocument)==null?void 0:n.defaultView)||window};function LW(e={}){const{openDelay:t=0,closeDelay:n=0,closeOnClick:r=!0,closeOnMouseDown:o,closeOnScroll:s,closeOnPointerDown:i=o,closeOnEsc:l=!0,onOpen:u,onClose:p,placement:m,id:h,isOpen:g,defaultIsOpen:x,arrowSize:y=10,arrowShadowColor:b,arrowPadding:w,modifiers:S,isDisabled:j,gutter:_,offset:E,direction:I,...M}=e,{isOpen:R,onOpen:D,onClose:A}=Lb({isOpen:g,defaultIsOpen:x,onOpen:u,onClose:p}),{referenceRef:O,getPopperProps:T,getArrowInnerProps:X,getArrowProps:B}=$b({enabled:R,placement:m,arrowPadding:w,modifiers:S,gutter:_,offset:E,direction:I}),V=d.useId(),N=`tooltip-${h??V}`,$=d.useRef(null),q=d.useRef(),F=d.useCallback(()=>{q.current&&(clearTimeout(q.current),q.current=void 0)},[]),Q=d.useRef(),Y=d.useCallback(()=>{Q.current&&(clearTimeout(Q.current),Q.current=void 0)},[]),se=d.useCallback(()=>{Y(),A()},[A,Y]),ae=zW($,se),re=d.useCallback(()=>{if(!j&&!q.current){R&&ae();const ge=Bp($);q.current=ge.setTimeout(D,t)}},[ae,j,R,D,t]),G=d.useCallback(()=>{F();const ge=Bp($);Q.current=ge.setTimeout(se,n)},[n,se,F]),K=d.useCallback(()=>{R&&r&&G()},[r,G,R]),ee=d.useCallback(()=>{R&&i&&G()},[i,G,R]),le=d.useCallback(ge=>{R&&ge.key==="Escape"&&G()},[R,G]);Ri(()=>W1($),"keydown",l?le:void 0),Ri(()=>{const ge=$.current;if(!ge)return null;const Ce=n3(ge);return Ce.localName==="body"?Bp($):Ce},"scroll",()=>{R&&s&&se()},{passive:!0,capture:!0}),d.useEffect(()=>{j&&(F(),R&&A())},[j,R,A,F]),d.useEffect(()=>()=>{F(),Y()},[F,Y]),Ri(()=>$.current,"pointerleave",G);const J=d.useCallback((ge={},Ce=null)=>({...ge,ref:It($,Ce,O),onPointerEnter:He(ge.onPointerEnter,fe=>{fe.pointerType!=="touch"&&re()}),onClick:He(ge.onClick,K),onPointerDown:He(ge.onPointerDown,ee),onFocus:He(ge.onFocus,re),onBlur:He(ge.onBlur,G),"aria-describedby":R?N:void 0}),[re,G,ee,R,N,K,O]),ie=d.useCallback((ge={},Ce=null)=>T({...ge,style:{...ge.style,[Nn.arrowSize.var]:y?`${y}px`:void 0,[Nn.arrowShadowColor.var]:b}},Ce),[T,y,b]),de=d.useCallback((ge={},Ce=null)=>{const he={...ge.style,position:"relative",transformOrigin:Nn.transformOrigin.varRef};return{ref:Ce,...M,...ge,id:N,role:"tooltip",style:he}},[M,N]);return{isOpen:R,show:re,hide:G,getTriggerProps:J,getTooltipProps:de,getTooltipPositionerProps:ie,getArrowProps:B,getArrowInnerProps:X}}var yv="chakra-ui:close-tooltip";function zW(e,t){return d.useEffect(()=>{const n=W1(e);return n.addEventListener(yv,t),()=>n.removeEventListener(yv,t)},[t,e]),()=>{const n=W1(e),r=Bp(e);n.dispatchEvent(new r.CustomEvent(yv))}}function FW(e,t=[]){const n=Object.assign({},e);for(const r of t)r in n&&delete n[r];return n}function BW(e,t){const n={};for(const r of t)r in e&&(n[r]=e[r]);return n}var HW=we(In.div),Ht=ke((e,t)=>{var n,r;const o=oi("Tooltip",e),s=on(e),i=bd(),{children:l,label:u,shouldWrapChildren:p,"aria-label":m,hasArrow:h,bg:g,portalProps:x,background:y,backgroundColor:b,bgColor:w,motionProps:S,...j}=s,_=(r=(n=y??b)!=null?n:g)!=null?r:w;if(_){o.bg=_;const T=VR(i,"colors",_);o[Nn.arrowBg.var]=T}const E=LW({...j,direction:i.direction}),I=typeof l=="string"||p;let M;if(I)M=a.jsx(we.span,{display:"inline-block",tabIndex:0,...E.getTriggerProps(),children:l});else{const T=d.Children.only(l);M=d.cloneElement(T,E.getTriggerProps(T.props,T.ref))}const R=!!m,D=E.getTooltipProps({},t),A=R?FW(D,["role","id"]):D,O=BW(D,["role","id"]);return u?a.jsxs(a.Fragment,{children:[M,a.jsx(dr,{children:E.isOpen&&a.jsx(Ac,{...x,children:a.jsx(we.div,{...E.getTooltipPositionerProps(),__css:{zIndex:o.zIndex,pointerEvents:"none"},children:a.jsxs(HW,{variants:$W,initial:"exit",animate:"enter",exit:"exit",...S,...A,__css:o,children:[u,R&&a.jsx(we.span,{srOnly:!0,...O,children:m}),h&&a.jsx(we.div,{"data-popper-arrow":!0,className:"chakra-tooltip__arrow-wrapper",children:a.jsx(we.div,{"data-popper-arrow-inner":!0,className:"chakra-tooltip__arrow",__css:{bg:o.bg}})})]})})})})]}):a.jsx(a.Fragment,{children:l})});Ht.displayName="Tooltip";function Jh(e,t={}){let n=d.useCallback(o=>t.keys?n$(e,t.keys,o):e.listen(o),[t.keys,e]),r=e.get.bind(e);return d.useSyncExternalStore(n,r,r)}const VW=ce(xe,({system:e})=>{const{consoleLogLevel:t,shouldLogToConsole:n}=e;return{consoleLogLevel:t,shouldLogToConsole:n}},{memoizeOptions:{resultEqualityCheck:Ft}}),pP=e=>{const{consoleLogLevel:t,shouldLogToConsole:n}=W(VW);return d.useEffect(()=>{n?(localStorage.setItem("ROARR_LOG","true"),localStorage.setItem("ROARR_FILTER",`context.logLevel:>=${WR[t]}`)):localStorage.setItem("ROARR_LOG","false"),JC.ROARR.write=UR.createLogWriter()},[t,n]),d.useEffect(()=>{const o={...GR};KR.set(JC.Roarr.child(o))},[]),d.useMemo(()=>el(e),[e])},WW=()=>{const e=te(),t=W(r=>r.system.toastQueue),n=o5();return d.useEffect(()=>{t.forEach(r=>{n(r)}),t.length>0&&e(qR())},[e,n,t]),null},sl=()=>{const e=te();return d.useCallback(n=>e(ct(Qt(n))),[e])},UW=d.memo(WW);var GW=new Map([["aac","audio/aac"],["abw","application/x-abiword"],["arc","application/x-freearc"],["avif","image/avif"],["avi","video/x-msvideo"],["azw","application/vnd.amazon.ebook"],["bin","application/octet-stream"],["bmp","image/bmp"],["bz","application/x-bzip"],["bz2","application/x-bzip2"],["cda","application/x-cdf"],["csh","application/x-csh"],["css","text/css"],["csv","text/csv"],["doc","application/msword"],["docx","application/vnd.openxmlformats-officedocument.wordprocessingml.document"],["eot","application/vnd.ms-fontobject"],["epub","application/epub+zip"],["gz","application/gzip"],["gif","image/gif"],["heic","image/heic"],["heif","image/heif"],["htm","text/html"],["html","text/html"],["ico","image/vnd.microsoft.icon"],["ics","text/calendar"],["jar","application/java-archive"],["jpeg","image/jpeg"],["jpg","image/jpeg"],["js","text/javascript"],["json","application/json"],["jsonld","application/ld+json"],["mid","audio/midi"],["midi","audio/midi"],["mjs","text/javascript"],["mp3","audio/mpeg"],["mp4","video/mp4"],["mpeg","video/mpeg"],["mpkg","application/vnd.apple.installer+xml"],["odp","application/vnd.oasis.opendocument.presentation"],["ods","application/vnd.oasis.opendocument.spreadsheet"],["odt","application/vnd.oasis.opendocument.text"],["oga","audio/ogg"],["ogv","video/ogg"],["ogx","application/ogg"],["opus","audio/opus"],["otf","font/otf"],["png","image/png"],["pdf","application/pdf"],["php","application/x-httpd-php"],["ppt","application/vnd.ms-powerpoint"],["pptx","application/vnd.openxmlformats-officedocument.presentationml.presentation"],["rar","application/vnd.rar"],["rtf","application/rtf"],["sh","application/x-sh"],["svg","image/svg+xml"],["swf","application/x-shockwave-flash"],["tar","application/x-tar"],["tif","image/tiff"],["tiff","image/tiff"],["ts","video/mp2t"],["ttf","font/ttf"],["txt","text/plain"],["vsd","application/vnd.visio"],["wav","audio/wav"],["weba","audio/webm"],["webm","video/webm"],["webp","image/webp"],["woff","font/woff"],["woff2","font/woff2"],["xhtml","application/xhtml+xml"],["xls","application/vnd.ms-excel"],["xlsx","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"],["xml","application/xml"],["xul","application/vnd.mozilla.xul+xml"],["zip","application/zip"],["7z","application/x-7z-compressed"],["mkv","video/x-matroska"],["mov","video/quicktime"],["msg","application/vnd.ms-outlook"]]);function Fd(e,t){var n=KW(e);if(typeof n.path!="string"){var r=e.webkitRelativePath;Object.defineProperty(n,"path",{value:typeof t=="string"?t:typeof r=="string"&&r.length>0?r:e.name,writable:!1,configurable:!1,enumerable:!0})}return n}function KW(e){var t=e.name,n=t&&t.lastIndexOf(".")!==-1;if(n&&!e.type){var r=t.split(".").pop().toLowerCase(),o=GW.get(r);o&&Object.defineProperty(e,"type",{value:o,writable:!1,configurable:!1,enumerable:!0})}return e}var qW=[".DS_Store","Thumbs.db"];function XW(e){return Tc(this,void 0,void 0,function(){return Nc(this,function(t){return um(e)&&QW(e.dataTransfer)?[2,eU(e.dataTransfer,e.type)]:YW(e)?[2,ZW(e)]:Array.isArray(e)&&e.every(function(n){return"getFile"in n&&typeof n.getFile=="function"})?[2,JW(e)]:[2,[]]})})}function QW(e){return um(e)}function YW(e){return um(e)&&um(e.target)}function um(e){return typeof e=="object"&&e!==null}function ZW(e){return U1(e.target.files).map(function(t){return Fd(t)})}function JW(e){return Tc(this,void 0,void 0,function(){var t;return Nc(this,function(n){switch(n.label){case 0:return[4,Promise.all(e.map(function(r){return r.getFile()}))];case 1:return t=n.sent(),[2,t.map(function(r){return Fd(r)})]}})})}function eU(e,t){return Tc(this,void 0,void 0,function(){var n,r;return Nc(this,function(o){switch(o.label){case 0:return e.items?(n=U1(e.items).filter(function(s){return s.kind==="file"}),t!=="drop"?[2,n]:[4,Promise.all(n.map(tU))]):[3,2];case 1:return r=o.sent(),[2,$S(mP(r))];case 2:return[2,$S(U1(e.files).map(function(s){return Fd(s)}))]}})})}function $S(e){return e.filter(function(t){return qW.indexOf(t.name)===-1})}function U1(e){if(e===null)return[];for(var t=[],n=0;ne.length)&&(t=e.length);for(var n=0,r=new Array(t);nn)return[!1,HS(n)];if(e.sizen)return[!1,HS(n)]}return[!0,null]}function _i(e){return e!=null}function vU(e){var t=e.files,n=e.accept,r=e.minSize,o=e.maxSize,s=e.multiple,i=e.maxFiles,l=e.validator;return!s&&t.length>1||s&&i>=1&&t.length>i?!1:t.every(function(u){var p=xP(u,n),m=rd(p,1),h=m[0],g=bP(u,r,o),x=rd(g,1),y=x[0],b=l?l(u):null;return h&&y&&!b})}function dm(e){return typeof e.isPropagationStopped=="function"?e.isPropagationStopped():typeof e.cancelBubble<"u"?e.cancelBubble:!1}function sp(e){return e.dataTransfer?Array.prototype.some.call(e.dataTransfer.types,function(t){return t==="Files"||t==="application/x-moz-file"}):!!e.target&&!!e.target.files}function WS(e){e.preventDefault()}function xU(e){return e.indexOf("MSIE")!==-1||e.indexOf("Trident/")!==-1}function bU(e){return e.indexOf("Edge/")!==-1}function yU(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:window.navigator.userAgent;return xU(e)||bU(e)}function ps(){for(var e=arguments.length,t=new Array(e),n=0;n1?o-1:0),i=1;ie.length)&&(t=e.length);for(var n=0,r=new Array(t);n=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function $U(e,t){if(e==null)return{};var n={},r=Object.keys(e),o,s;for(s=0;s=0)&&(n[o]=e[o]);return n}var Xb=d.forwardRef(function(e,t){var n=e.children,r=fm(e,_U),o=Qb(r),s=o.open,i=fm(o,IU);return d.useImperativeHandle(t,function(){return{open:s}},[s]),H.createElement(d.Fragment,null,n(bn(bn({},i),{},{open:s})))});Xb.displayName="Dropzone";var SP={disabled:!1,getFilesFromEvent:XW,maxSize:1/0,minSize:0,multiple:!0,maxFiles:0,preventDropOnDocument:!0,noClick:!1,noKeyboard:!1,noDrag:!1,noDragEventsBubbling:!1,validator:null,useFsAccessApi:!0,autoFocus:!1};Xb.defaultProps=SP;Xb.propTypes={children:Jt.func,accept:Jt.objectOf(Jt.arrayOf(Jt.string)),multiple:Jt.bool,preventDropOnDocument:Jt.bool,noClick:Jt.bool,noKeyboard:Jt.bool,noDrag:Jt.bool,noDragEventsBubbling:Jt.bool,minSize:Jt.number,maxSize:Jt.number,maxFiles:Jt.number,disabled:Jt.bool,getFilesFromEvent:Jt.func,onFileDialogCancel:Jt.func,onFileDialogOpen:Jt.func,useFsAccessApi:Jt.bool,autoFocus:Jt.bool,onDragEnter:Jt.func,onDragLeave:Jt.func,onDragOver:Jt.func,onDrop:Jt.func,onDropAccepted:Jt.func,onDropRejected:Jt.func,onError:Jt.func,validator:Jt.func};var X1={isFocused:!1,isFileDialogActive:!1,isDragActive:!1,isDragAccept:!1,isDragReject:!1,acceptedFiles:[],fileRejections:[]};function Qb(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=bn(bn({},SP),e),n=t.accept,r=t.disabled,o=t.getFilesFromEvent,s=t.maxSize,i=t.minSize,l=t.multiple,u=t.maxFiles,p=t.onDragEnter,m=t.onDragLeave,h=t.onDragOver,g=t.onDrop,x=t.onDropAccepted,y=t.onDropRejected,b=t.onFileDialogCancel,w=t.onFileDialogOpen,S=t.useFsAccessApi,j=t.autoFocus,_=t.preventDropOnDocument,E=t.noClick,I=t.noKeyboard,M=t.noDrag,R=t.noDragEventsBubbling,D=t.onError,A=t.validator,O=d.useMemo(function(){return SU(n)},[n]),T=d.useMemo(function(){return wU(n)},[n]),X=d.useMemo(function(){return typeof w=="function"?w:GS},[w]),B=d.useMemo(function(){return typeof b=="function"?b:GS},[b]),V=d.useRef(null),U=d.useRef(null),N=d.useReducer(LU,X1),$=Cv(N,2),q=$[0],F=$[1],Q=q.isFocused,Y=q.isFileDialogActive,se=d.useRef(typeof window<"u"&&window.isSecureContext&&S&&CU()),ae=function(){!se.current&&Y&&setTimeout(function(){if(U.current){var De=U.current.files;De.length||(F({type:"closeDialog"}),B())}},300)};d.useEffect(function(){return window.addEventListener("focus",ae,!1),function(){window.removeEventListener("focus",ae,!1)}},[U,Y,B,se]);var re=d.useRef([]),G=function(De){V.current&&V.current.contains(De.target)||(De.preventDefault(),re.current=[])};d.useEffect(function(){return _&&(document.addEventListener("dragover",WS,!1),document.addEventListener("drop",G,!1)),function(){_&&(document.removeEventListener("dragover",WS),document.removeEventListener("drop",G))}},[V,_]),d.useEffect(function(){return!r&&j&&V.current&&V.current.focus(),function(){}},[V,j,r]);var K=d.useCallback(function(ye){D?D(ye):console.error(ye)},[D]),ee=d.useCallback(function(ye){ye.preventDefault(),ye.persist(),$e(ye),re.current=[].concat(MU(re.current),[ye.target]),sp(ye)&&Promise.resolve(o(ye)).then(function(De){if(!(dm(ye)&&!R)){var ut=De.length,bt=ut>0&&vU({files:De,accept:O,minSize:i,maxSize:s,multiple:l,maxFiles:u,validator:A}),be=ut>0&&!bt;F({isDragAccept:bt,isDragReject:be,isDragActive:!0,type:"setDraggedFiles"}),p&&p(ye)}}).catch(function(De){return K(De)})},[o,p,K,R,O,i,s,l,u,A]),le=d.useCallback(function(ye){ye.preventDefault(),ye.persist(),$e(ye);var De=sp(ye);if(De&&ye.dataTransfer)try{ye.dataTransfer.dropEffect="copy"}catch{}return De&&h&&h(ye),!1},[h,R]),J=d.useCallback(function(ye){ye.preventDefault(),ye.persist(),$e(ye);var De=re.current.filter(function(bt){return V.current&&V.current.contains(bt)}),ut=De.indexOf(ye.target);ut!==-1&&De.splice(ut,1),re.current=De,!(De.length>0)&&(F({type:"setDraggedFiles",isDragActive:!1,isDragAccept:!1,isDragReject:!1}),sp(ye)&&m&&m(ye))},[V,m,R]),ie=d.useCallback(function(ye,De){var ut=[],bt=[];ye.forEach(function(be){var Je=xP(be,O),lt=Cv(Je,2),ft=lt[0],Me=lt[1],Le=bP(be,i,s),Ut=Cv(Le,2),Se=Ut[0],Be=Ut[1],ze=A?A(be):null;if(ft&&Se&&!ze)ut.push(be);else{var Ge=[Me,Be];ze&&(Ge=Ge.concat(ze)),bt.push({file:be,errors:Ge.filter(function(pt){return pt})})}}),(!l&&ut.length>1||l&&u>=1&&ut.length>u)&&(ut.forEach(function(be){bt.push({file:be,errors:[gU]})}),ut.splice(0)),F({acceptedFiles:ut,fileRejections:bt,type:"setFiles"}),g&&g(ut,bt,De),bt.length>0&&y&&y(bt,De),ut.length>0&&x&&x(ut,De)},[F,l,O,i,s,u,g,x,y,A]),de=d.useCallback(function(ye){ye.preventDefault(),ye.persist(),$e(ye),re.current=[],sp(ye)&&Promise.resolve(o(ye)).then(function(De){dm(ye)&&!R||ie(De,ye)}).catch(function(De){return K(De)}),F({type:"reset"})},[o,ie,K,R]),ge=d.useCallback(function(){if(se.current){F({type:"openDialog"}),X();var ye={multiple:l,types:T};window.showOpenFilePicker(ye).then(function(De){return o(De)}).then(function(De){ie(De,null),F({type:"closeDialog"})}).catch(function(De){kU(De)?(B(De),F({type:"closeDialog"})):jU(De)?(se.current=!1,U.current?(U.current.value=null,U.current.click()):K(new Error("Cannot open the file picker because the https://developer.mozilla.org/en-US/docs/Web/API/File_System_Access_API is not supported and no was provided."))):K(De)});return}U.current&&(F({type:"openDialog"}),X(),U.current.value=null,U.current.click())},[F,X,B,S,ie,K,T,l]),Ce=d.useCallback(function(ye){!V.current||!V.current.isEqualNode(ye.target)||(ye.key===" "||ye.key==="Enter"||ye.keyCode===32||ye.keyCode===13)&&(ye.preventDefault(),ge())},[V,ge]),he=d.useCallback(function(){F({type:"focus"})},[]),fe=d.useCallback(function(){F({type:"blur"})},[]),Oe=d.useCallback(function(){E||(yU()?setTimeout(ge,0):ge())},[E,ge]),_e=function(De){return r?null:De},Ne=function(De){return I?null:_e(De)},nt=function(De){return M?null:_e(De)},$e=function(De){R&&De.stopPropagation()},Pt=d.useMemo(function(){return function(){var ye=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},De=ye.refKey,ut=De===void 0?"ref":De,bt=ye.role,be=ye.onKeyDown,Je=ye.onFocus,lt=ye.onBlur,ft=ye.onClick,Me=ye.onDragEnter,Le=ye.onDragOver,Ut=ye.onDragLeave,Se=ye.onDrop,Be=fm(ye,PU);return bn(bn(q1({onKeyDown:Ne(ps(be,Ce)),onFocus:Ne(ps(Je,he)),onBlur:Ne(ps(lt,fe)),onClick:_e(ps(ft,Oe)),onDragEnter:nt(ps(Me,ee)),onDragOver:nt(ps(Le,le)),onDragLeave:nt(ps(Ut,J)),onDrop:nt(ps(Se,de)),role:typeof bt=="string"&&bt!==""?bt:"presentation"},ut,V),!r&&!I?{tabIndex:0}:{}),Be)}},[V,Ce,he,fe,Oe,ee,le,J,de,I,M,r]),Ze=d.useCallback(function(ye){ye.stopPropagation()},[]),ot=d.useMemo(function(){return function(){var ye=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},De=ye.refKey,ut=De===void 0?"ref":De,bt=ye.onChange,be=ye.onClick,Je=fm(ye,EU),lt=q1({accept:O,multiple:l,type:"file",style:{display:"none"},onChange:_e(ps(bt,de)),onClick:_e(ps(be,Ze)),tabIndex:-1},ut,U);return bn(bn({},lt),Je)}},[U,n,l,de,r]);return bn(bn({},q),{},{isFocused:Q&&!r,getRootProps:Pt,getInputProps:ot,rootRef:V,inputRef:U,open:_e(ge)})}function LU(e,t){switch(t.type){case"focus":return bn(bn({},e),{},{isFocused:!0});case"blur":return bn(bn({},e),{},{isFocused:!1});case"openDialog":return bn(bn({},X1),{},{isFileDialogActive:!0});case"closeDialog":return bn(bn({},e),{},{isFileDialogActive:!1});case"setDraggedFiles":return bn(bn({},e),{},{isDragActive:t.isDragActive,isDragAccept:t.isDragAccept,isDragReject:t.isDragReject});case"setFiles":return bn(bn({},e),{},{acceptedFiles:t.acceptedFiles,fileRejections:t.fileRejections});case"reset":return bn({},X1);default:return e}}function GS(){}function Q1(){return Q1=Object.assign?Object.assign.bind():function(e){for(var t=1;t'),!0):t?e.some(function(n){return t.includes(n)})||e.includes("*"):!0}var UU=function(t,n,r){r===void 0&&(r=!1);var o=n.alt,s=n.meta,i=n.mod,l=n.shift,u=n.ctrl,p=n.keys,m=t.key,h=t.code,g=t.ctrlKey,x=t.metaKey,y=t.shiftKey,b=t.altKey,w=Va(h),S=m.toLowerCase();if(!r){if(o===!b&&S!=="alt"||l===!y&&S!=="shift")return!1;if(i){if(!x&&!g)return!1}else if(s===!x&&S!=="meta"&&S!=="os"||u===!g&&S!=="ctrl"&&S!=="control")return!1}return p&&p.length===1&&(p.includes(S)||p.includes(w))?!0:p?Hp(p):!p},GU=d.createContext(void 0),KU=function(){return d.useContext(GU)};function PP(e,t){return e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(e).length===Object.keys(t).length&&Object.keys(e).reduce(function(n,r){return n&&PP(e[r],t[r])},!0):e===t}var qU=d.createContext({hotkeys:[],enabledScopes:[],toggleScope:function(){},enableScope:function(){},disableScope:function(){}}),XU=function(){return d.useContext(qU)};function QU(e){var t=d.useRef(void 0);return PP(t.current,e)||(t.current=e),t.current}var KS=function(t){t.stopPropagation(),t.preventDefault(),t.stopImmediatePropagation()},YU=typeof window<"u"?d.useLayoutEffect:d.useEffect;function et(e,t,n,r){var o=d.useRef(null),s=d.useRef(!1),i=n instanceof Array?r instanceof Array?void 0:r:n,l=Yb(e)?e.join(i==null?void 0:i.splitKey):e,u=n instanceof Array?n:r instanceof Array?r:void 0,p=d.useCallback(t,u??[]),m=d.useRef(p);u?m.current=p:m.current=t;var h=QU(i),g=XU(),x=g.enabledScopes,y=KU();return YU(function(){if(!((h==null?void 0:h.enabled)===!1||!WU(x,h==null?void 0:h.scopes))){var b=function(E,I){var M;if(I===void 0&&(I=!1),!(VU(E)&&!IP(E,h==null?void 0:h.enableOnFormTags))&&!(h!=null&&h.ignoreEventWhen!=null&&h.ignoreEventWhen(E))){if(o.current!==null&&document.activeElement!==o.current&&!o.current.contains(document.activeElement)){KS(E);return}(M=E.target)!=null&&M.isContentEditable&&!(h!=null&&h.enableOnContentEditable)||wv(l,h==null?void 0:h.splitKey).forEach(function(R){var D,A=Sv(R,h==null?void 0:h.combinationKey);if(UU(E,A,h==null?void 0:h.ignoreModifiers)||(D=A.keys)!=null&&D.includes("*")){if(I&&s.current)return;if(BU(E,A,h==null?void 0:h.preventDefault),!HU(E,A,h==null?void 0:h.enabled)){KS(E);return}m.current(E,A),I||(s.current=!0)}})}},w=function(E){E.key!==void 0&&(jP(Va(E.code)),((h==null?void 0:h.keydown)===void 0&&(h==null?void 0:h.keyup)!==!0||h!=null&&h.keydown)&&b(E))},S=function(E){E.key!==void 0&&(_P(Va(E.code)),s.current=!1,h!=null&&h.keyup&&b(E,!0))},j=o.current||(i==null?void 0:i.document)||document;return j.addEventListener("keyup",S),j.addEventListener("keydown",w),y&&wv(l,h==null?void 0:h.splitKey).forEach(function(_){return y.addHotkey(Sv(_,h==null?void 0:h.combinationKey,h==null?void 0:h.description))}),function(){j.removeEventListener("keyup",S),j.removeEventListener("keydown",w),y&&wv(l,h==null?void 0:h.splitKey).forEach(function(_){return y.removeHotkey(Sv(_,h==null?void 0:h.combinationKey,h==null?void 0:h.description))})}}},[l,h,x]),o}const ZU=e=>{const{isDragAccept:t,isDragReject:n,setIsHandlingUpload:r}=e;return et("esc",()=>{r(!1)}),a.jsxs(Ie,{sx:{position:"absolute",top:0,insetInlineStart:0,width:"100vw",height:"100vh",zIndex:999,backdropFilter:"blur(20px)"},children:[a.jsx(L,{sx:{position:"absolute",top:0,insetInlineStart:0,w:"full",h:"full",bg:"base.700",_dark:{bg:"base.900"},opacity:.7,alignItems:"center",justifyContent:"center",transitionProperty:"common",transitionDuration:"0.1s"}}),a.jsx(L,{sx:{position:"absolute",top:0,insetInlineStart:0,width:"full",height:"full",alignItems:"center",justifyContent:"center",p:4},children:a.jsx(L,{sx:{width:"full",height:"full",alignItems:"center",justifyContent:"center",flexDir:"column",gap:4,borderWidth:3,borderRadius:"xl",borderStyle:"dashed",color:"base.100",borderColor:"base.100",_dark:{borderColor:"base.200"}},children:t?a.jsx(cr,{size:"lg",children:"Drop to Upload"}):a.jsxs(a.Fragment,{children:[a.jsx(cr,{size:"lg",children:"Invalid Upload"}),a.jsx(cr,{size:"md",children:"Must be single JPEG or PNG image"})]})})})]})},JU=d.memo(ZU),eG=ce([xe,Jn],({gallery:e},t)=>{let n={type:"TOAST"};t==="unifiedCanvas"&&(n={type:"SET_CANVAS_INITIAL_IMAGE"}),t==="img2img"&&(n={type:"SET_INITIAL_IMAGE"});const{autoAddBoardId:r}=e;return{autoAddBoardId:r,postUploadAction:n}},je),tG=e=>{const{children:t}=e,{autoAddBoardId:n,postUploadAction:r}=W(eG),o=sl(),{t:s}=Z(),[i,l]=d.useState(!1),[u]=nI(),p=d.useCallback(_=>{l(!0),o({title:s("toast.uploadFailed"),description:_.errors.map(E=>E.message).join(` -`),status:"error"})},[s,o]),m=d.useCallback(async _=>{u({file:_,image_category:"user",is_intermediate:!1,postUploadAction:r,board_id:n==="none"?void 0:n})},[n,r,u]),h=d.useCallback((_,E)=>{if(E.length>1){o({title:s("toast.uploadFailed"),description:s("toast.uploadFailedInvalidUploadDesc"),status:"error"});return}E.forEach(I=>{p(I)}),_.forEach(I=>{m(I)})},[s,o,m,p]),g=d.useCallback(()=>{l(!0)},[]),{getRootProps:x,getInputProps:y,isDragAccept:b,isDragReject:w,isDragActive:S,inputRef:j}=Qb({accept:{"image/png":[".png"],"image/jpeg":[".jpg",".jpeg",".png"]},noClick:!0,onDrop:h,onDragOver:g,multiple:!1});return d.useEffect(()=>{const _=async E=>{var I,M;j.current&&(I=E.clipboardData)!=null&&I.files&&(j.current.files=E.clipboardData.files,(M=j.current)==null||M.dispatchEvent(new Event("change",{bubbles:!0})))};return document.addEventListener("paste",_),()=>{document.removeEventListener("paste",_)}},[j]),a.jsxs(Ie,{...x({style:{}}),onKeyDown:_=>{_.key},children:[a.jsx("input",{...y()}),t,a.jsx(dr,{children:S&&i&&a.jsx(In.div,{initial:{opacity:0},animate:{opacity:1,transition:{duration:.1}},exit:{opacity:0,transition:{duration:.1}},children:a.jsx(JU,{isDragAccept:b,isDragReject:w,setIsHandlingUpload:l})},"image-upload-overlay")})]})},nG=d.memo(tG),rG=ke((e,t)=>{const{children:n,tooltip:r="",tooltipProps:{placement:o="top",hasArrow:s=!0,...i}={},isChecked:l,...u}=e;return a.jsx(Ht,{label:r,placement:o,hasArrow:s,...i,children:a.jsx(Za,{ref:t,colorScheme:l?"accent":"base",...u,children:n})})}),at=d.memo(rG);function oG(e){const t=d.createContext(null);return[({children:o,value:s})=>H.createElement(t.Provider,{value:s},o),()=>{const o=d.useContext(t);if(o===null)throw new Error(e);return o}]}function EP(e){return Array.isArray(e)?e:[e]}const sG=()=>{};function aG(e,t={active:!0}){return typeof e!="function"||!t.active?t.onKeyDown||sG:n=>{var r;n.key==="Escape"&&(e(n),(r=t.onTrigger)==null||r.call(t))}}function MP({data:e}){const t=[],n=[],r=e.reduce((o,s,i)=>(s.group?o[s.group]?o[s.group].push(i):o[s.group]=[i]:n.push(i),o),{});return Object.keys(r).forEach(o=>{t.push(...r[o].map(s=>e[s]))}),t.push(...n.map(o=>e[o])),t}function OP(e){return Array.isArray(e)||e===null?!1:typeof e=="object"?e.type!==H.Fragment:!1}function RP(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e))for(t=0;tr===t[o]).indexOf(!1)>=0)&&(n.current={v:e(),prevDeps:[...t]}),n.current.v}const cG=XR({key:"mantine",prepend:!0});function uG(){return QI()||cG}var dG=Object.defineProperty,qS=Object.getOwnPropertySymbols,fG=Object.prototype.hasOwnProperty,pG=Object.prototype.propertyIsEnumerable,XS=(e,t,n)=>t in e?dG(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,mG=(e,t)=>{for(var n in t||(t={}))fG.call(t,n)&&XS(e,n,t[n]);if(qS)for(var n of qS(t))pG.call(t,n)&&XS(e,n,t[n]);return e};const kv="ref";function hG(e){let t;if(e.length!==1)return{args:e,ref:t};const[n]=e;if(!(n instanceof Object))return{args:e,ref:t};if(!(kv in n))return{args:e,ref:t};t=n[kv];const r=mG({},n);return delete r[kv],{args:[r],ref:t}}const{cssFactory:gG}=(()=>{function e(n,r,o){const s=[],i=ZR(n,s,o);return s.length<2?o:i+r(s)}function t(n){const{cache:r}=n,o=(...i)=>{const{ref:l,args:u}=hG(i),p=QR(u,r.registered);return YR(r,p,!1),`${r.key}-${p.name}${l===void 0?"":` ${l}`}`};return{css:o,cx:(...i)=>e(r.registered,o,DP(i))}}return{cssFactory:t}})();function AP(){const e=uG();return lG(()=>gG({cache:e}),[e])}function vG({cx:e,classes:t,context:n,classNames:r,name:o,cache:s}){const i=n.reduce((l,u)=>(Object.keys(u.classNames).forEach(p=>{typeof l[p]!="string"?l[p]=`${u.classNames[p]}`:l[p]=`${l[p]} ${u.classNames[p]}`}),l),{});return Object.keys(t).reduce((l,u)=>(l[u]=e(t[u],i[u],r!=null&&r[u],Array.isArray(o)?o.filter(Boolean).map(p=>`${(s==null?void 0:s.key)||"mantine"}-${p}-${u}`).join(" "):o?`${(s==null?void 0:s.key)||"mantine"}-${o}-${u}`:null),l),{})}var xG=Object.defineProperty,QS=Object.getOwnPropertySymbols,bG=Object.prototype.hasOwnProperty,yG=Object.prototype.propertyIsEnumerable,YS=(e,t,n)=>t in e?xG(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,jv=(e,t)=>{for(var n in t||(t={}))bG.call(t,n)&&YS(e,n,t[n]);if(QS)for(var n of QS(t))yG.call(t,n)&&YS(e,n,t[n]);return e};function Y1(e,t){return t&&Object.keys(t).forEach(n=>{e[n]?e[n]=jv(jv({},e[n]),t[n]):e[n]=jv({},t[n])}),e}function ZS(e,t,n,r){const o=s=>typeof s=="function"?s(t,n||{},r):s||{};return Array.isArray(e)?e.map(s=>o(s.styles)).reduce((s,i)=>Y1(s,i),{}):o(e)}function CG({ctx:e,theme:t,params:n,variant:r,size:o}){return e.reduce((s,i)=>(i.variants&&r in i.variants&&Y1(s,i.variants[r](t,n,{variant:r,size:o})),i.sizes&&o in i.sizes&&Y1(s,i.sizes[o](t,n,{variant:r,size:o})),s),{})}function fr(e){const t=typeof e=="function"?e:()=>e;function n(r,o){const s=xa(),i=z9(o==null?void 0:o.name),l=QI(),u={variant:o==null?void 0:o.variant,size:o==null?void 0:o.size},{css:p,cx:m}=AP(),h=t(s,r,u),g=ZS(o==null?void 0:o.styles,s,r,u),x=ZS(i,s,r,u),y=CG({ctx:i,theme:s,params:r,variant:o==null?void 0:o.variant,size:o==null?void 0:o.size}),b=Object.fromEntries(Object.keys(h).map(w=>{const S=m({[p(h[w])]:!(o!=null&&o.unstyled)},p(y[w]),p(x[w]),p(g[w]));return[w,S]}));return{classes:vG({cx:m,classes:b,context:i,classNames:o==null?void 0:o.classNames,name:o==null?void 0:o.name,cache:l}),cx:m,theme:s}}return n}function JS(e){return`___ref-${e||""}`}var wG=Object.defineProperty,SG=Object.defineProperties,kG=Object.getOwnPropertyDescriptors,e4=Object.getOwnPropertySymbols,jG=Object.prototype.hasOwnProperty,_G=Object.prototype.propertyIsEnumerable,t4=(e,t,n)=>t in e?wG(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,wu=(e,t)=>{for(var n in t||(t={}))jG.call(t,n)&&t4(e,n,t[n]);if(e4)for(var n of e4(t))_G.call(t,n)&&t4(e,n,t[n]);return e},Su=(e,t)=>SG(e,kG(t));const ku={in:{opacity:1,transform:"scale(1)"},out:{opacity:0,transform:`scale(.9) translateY(${Re(10)})`},transitionProperty:"transform, opacity"},ap={fade:{in:{opacity:1},out:{opacity:0},transitionProperty:"opacity"},scale:{in:{opacity:1,transform:"scale(1)"},out:{opacity:0,transform:"scale(0)"},common:{transformOrigin:"top"},transitionProperty:"transform, opacity"},"scale-y":{in:{opacity:1,transform:"scaleY(1)"},out:{opacity:0,transform:"scaleY(0)"},common:{transformOrigin:"top"},transitionProperty:"transform, opacity"},"scale-x":{in:{opacity:1,transform:"scaleX(1)"},out:{opacity:0,transform:"scaleX(0)"},common:{transformOrigin:"left"},transitionProperty:"transform, opacity"},"skew-up":{in:{opacity:1,transform:"translateY(0) skew(0deg, 0deg)"},out:{opacity:0,transform:`translateY(-${Re(20)}) skew(-10deg, -5deg)`},common:{transformOrigin:"top"},transitionProperty:"transform, opacity"},"skew-down":{in:{opacity:1,transform:"translateY(0) skew(0deg, 0deg)"},out:{opacity:0,transform:`translateY(${Re(20)}) skew(-10deg, -5deg)`},common:{transformOrigin:"bottom"},transitionProperty:"transform, opacity"},"rotate-left":{in:{opacity:1,transform:"translateY(0) rotate(0deg)"},out:{opacity:0,transform:`translateY(${Re(20)}) rotate(-5deg)`},common:{transformOrigin:"bottom"},transitionProperty:"transform, opacity"},"rotate-right":{in:{opacity:1,transform:"translateY(0) rotate(0deg)"},out:{opacity:0,transform:`translateY(${Re(20)}) rotate(5deg)`},common:{transformOrigin:"top"},transitionProperty:"transform, opacity"},"slide-down":{in:{opacity:1,transform:"translateY(0)"},out:{opacity:0,transform:"translateY(-100%)"},common:{transformOrigin:"top"},transitionProperty:"transform, opacity"},"slide-up":{in:{opacity:1,transform:"translateY(0)"},out:{opacity:0,transform:"translateY(100%)"},common:{transformOrigin:"bottom"},transitionProperty:"transform, opacity"},"slide-left":{in:{opacity:1,transform:"translateX(0)"},out:{opacity:0,transform:"translateX(100%)"},common:{transformOrigin:"left"},transitionProperty:"transform, opacity"},"slide-right":{in:{opacity:1,transform:"translateX(0)"},out:{opacity:0,transform:"translateX(-100%)"},common:{transformOrigin:"right"},transitionProperty:"transform, opacity"},pop:Su(wu({},ku),{common:{transformOrigin:"center center"}}),"pop-bottom-left":Su(wu({},ku),{common:{transformOrigin:"bottom left"}}),"pop-bottom-right":Su(wu({},ku),{common:{transformOrigin:"bottom right"}}),"pop-top-left":Su(wu({},ku),{common:{transformOrigin:"top left"}}),"pop-top-right":Su(wu({},ku),{common:{transformOrigin:"top right"}})},n4=["mousedown","touchstart"];function IG(e,t,n){const r=d.useRef();return d.useEffect(()=>{const o=s=>{const{target:i}=s??{};if(Array.isArray(n)){const l=(i==null?void 0:i.hasAttribute("data-ignore-outside-clicks"))||!document.body.contains(i)&&i.tagName!=="HTML";n.every(p=>!!p&&!s.composedPath().includes(p))&&!l&&e()}else r.current&&!r.current.contains(i)&&e()};return(t||n4).forEach(s=>document.addEventListener(s,o)),()=>{(t||n4).forEach(s=>document.removeEventListener(s,o))}},[r,e,n]),r}function PG(e,t){try{return e.addEventListener("change",t),()=>e.removeEventListener("change",t)}catch{return e.addListener(t),()=>e.removeListener(t)}}function EG(e,t){return typeof t=="boolean"?t:typeof window<"u"&&"matchMedia"in window?window.matchMedia(e).matches:!1}function MG(e,t,{getInitialValueInEffect:n}={getInitialValueInEffect:!0}){const[r,o]=d.useState(n?t:EG(e,t)),s=d.useRef();return d.useEffect(()=>{if("matchMedia"in window)return s.current=window.matchMedia(e),o(s.current.matches),PG(s.current,i=>o(i.matches))},[e]),r}const TP=typeof document<"u"?d.useLayoutEffect:d.useEffect;function Uo(e,t){const n=d.useRef(!1);d.useEffect(()=>()=>{n.current=!1},[]),d.useEffect(()=>{if(n.current)return e();n.current=!0},t)}function OG({opened:e,shouldReturnFocus:t=!0}){const n=d.useRef(),r=()=>{var o;n.current&&"focus"in n.current&&typeof n.current.focus=="function"&&((o=n.current)==null||o.focus({preventScroll:!0}))};return Uo(()=>{let o=-1;const s=i=>{i.key==="Tab"&&window.clearTimeout(o)};return document.addEventListener("keydown",s),e?n.current=document.activeElement:t&&(o=window.setTimeout(r,10)),()=>{window.clearTimeout(o),document.removeEventListener("keydown",s)}},[e,t]),r}const RG=/input|select|textarea|button|object/,NP="a, input, select, textarea, button, object, [tabindex]";function DG(e){return e.style.display==="none"}function AG(e){if(e.getAttribute("aria-hidden")||e.getAttribute("hidden")||e.getAttribute("type")==="hidden")return!1;let n=e;for(;n&&!(n===document.body||n.nodeType===11);){if(DG(n))return!1;n=n.parentNode}return!0}function $P(e){let t=e.getAttribute("tabindex");return t===null&&(t=void 0),parseInt(t,10)}function Z1(e){const t=e.nodeName.toLowerCase(),n=!Number.isNaN($P(e));return(RG.test(t)&&!e.disabled||e instanceof HTMLAnchorElement&&e.href||n)&&AG(e)}function LP(e){const t=$P(e);return(Number.isNaN(t)||t>=0)&&Z1(e)}function TG(e){return Array.from(e.querySelectorAll(NP)).filter(LP)}function NG(e,t){const n=TG(e);if(!n.length){t.preventDefault();return}const r=n[t.shiftKey?0:n.length-1],o=e.getRootNode();if(!(r===o.activeElement||e===o.activeElement))return;t.preventDefault();const i=n[t.shiftKey?n.length-1:0];i&&i.focus()}function Jb(){return`mantine-${Math.random().toString(36).slice(2,11)}`}function $G(e,t="body > :not(script)"){const n=Jb(),r=Array.from(document.querySelectorAll(t)).map(o=>{var s;if((s=o==null?void 0:o.shadowRoot)!=null&&s.contains(e)||o.contains(e))return;const i=o.getAttribute("aria-hidden"),l=o.getAttribute("data-hidden"),u=o.getAttribute("data-focus-id");return o.setAttribute("data-focus-id",n),i===null||i==="false"?o.setAttribute("aria-hidden","true"):!l&&!u&&o.setAttribute("data-hidden",i),{node:o,ariaHidden:l||null}});return()=>{r.forEach(o=>{!o||n!==o.node.getAttribute("data-focus-id")||(o.ariaHidden===null?o.node.removeAttribute("aria-hidden"):o.node.setAttribute("aria-hidden",o.ariaHidden),o.node.removeAttribute("data-focus-id"),o.node.removeAttribute("data-hidden"))})}}function LG(e=!0){const t=d.useRef(),n=d.useRef(null),r=s=>{let i=s.querySelector("[data-autofocus]");if(!i){const l=Array.from(s.querySelectorAll(NP));i=l.find(LP)||l.find(Z1)||null,!i&&Z1(s)&&(i=s)}i&&i.focus({preventScroll:!0})},o=d.useCallback(s=>{if(e){if(s===null){n.current&&(n.current(),n.current=null);return}n.current=$G(s),t.current!==s&&(s?(setTimeout(()=>{s.getRootNode()&&r(s)}),t.current=s):t.current=null)}},[e]);return d.useEffect(()=>{if(!e)return;t.current&&setTimeout(()=>r(t.current));const s=i=>{i.key==="Tab"&&t.current&&NG(t.current,i)};return document.addEventListener("keydown",s),()=>{document.removeEventListener("keydown",s),n.current&&n.current()}},[e]),o}const zG=H["useId".toString()]||(()=>{});function FG(){const e=zG();return e?`mantine-${e.replace(/:/g,"")}`:""}function ey(e){const t=FG(),[n,r]=d.useState(t);return TP(()=>{r(Jb())},[]),typeof e=="string"?e:typeof window>"u"?t:n}function r4(e,t,n){d.useEffect(()=>(window.addEventListener(e,t,n),()=>window.removeEventListener(e,t,n)),[e,t])}function zP(e,t){typeof e=="function"?e(t):typeof e=="object"&&e!==null&&"current"in e&&(e.current=t)}function BG(...e){return t=>{e.forEach(n=>zP(n,t))}}function Bd(...e){return d.useCallback(BG(...e),e)}function od({value:e,defaultValue:t,finalValue:n,onChange:r=()=>{}}){const[o,s]=d.useState(t!==void 0?t:n),i=l=>{s(l),r==null||r(l)};return e!==void 0?[e,r,!0]:[o,i,!1]}function FP(e,t){return MG("(prefers-reduced-motion: reduce)",e,t)}const HG=e=>e<.5?2*e*e:-1+(4-2*e)*e,VG=({axis:e,target:t,parent:n,alignment:r,offset:o,isList:s})=>{if(!t||!n&&typeof document>"u")return 0;const i=!!n,u=(n||document.body).getBoundingClientRect(),p=t.getBoundingClientRect(),m=h=>p[h]-u[h];if(e==="y"){const h=m("top");if(h===0)return 0;if(r==="start"){const x=h-o;return x<=p.height*(s?0:1)||!s?x:0}const g=i?u.height:window.innerHeight;if(r==="end"){const x=h+o-g+p.height;return x>=-p.height*(s?0:1)||!s?x:0}return r==="center"?h-g/2+p.height/2:0}if(e==="x"){const h=m("left");if(h===0)return 0;if(r==="start"){const x=h-o;return x<=p.width||!s?x:0}const g=i?u.width:window.innerWidth;if(r==="end"){const x=h+o-g+p.width;return x>=-p.width||!s?x:0}return r==="center"?h-g/2+p.width/2:0}return 0},WG=({axis:e,parent:t})=>{if(!t&&typeof document>"u")return 0;const n=e==="y"?"scrollTop":"scrollLeft";if(t)return t[n];const{body:r,documentElement:o}=document;return r[n]+o[n]},UG=({axis:e,parent:t,distance:n})=>{if(!t&&typeof document>"u")return;const r=e==="y"?"scrollTop":"scrollLeft";if(t)t[r]=n;else{const{body:o,documentElement:s}=document;o[r]=n,s[r]=n}};function BP({duration:e=1250,axis:t="y",onScrollFinish:n,easing:r=HG,offset:o=0,cancelable:s=!0,isList:i=!1}={}){const l=d.useRef(0),u=d.useRef(0),p=d.useRef(!1),m=d.useRef(null),h=d.useRef(null),g=FP(),x=()=>{l.current&&cancelAnimationFrame(l.current)},y=d.useCallback(({alignment:w="start"}={})=>{var S;p.current=!1,l.current&&x();const j=(S=WG({parent:m.current,axis:t}))!=null?S:0,_=VG({parent:m.current,target:h.current,axis:t,alignment:w,offset:o,isList:i})-(m.current?0:j);function E(){u.current===0&&(u.current=performance.now());const M=performance.now()-u.current,R=g||e===0?1:M/e,D=j+_*r(R);UG({parent:m.current,axis:t,distance:D}),!p.current&&R<1?l.current=requestAnimationFrame(E):(typeof n=="function"&&n(),u.current=0,l.current=0,x())}E()},[t,e,r,i,o,n,g]),b=()=>{s&&(p.current=!0)};return r4("wheel",b,{passive:!0}),r4("touchmove",b,{passive:!0}),d.useEffect(()=>x,[]),{scrollableRef:m,targetRef:h,scrollIntoView:y,cancel:x}}var o4=Object.getOwnPropertySymbols,GG=Object.prototype.hasOwnProperty,KG=Object.prototype.propertyIsEnumerable,qG=(e,t)=>{var n={};for(var r in e)GG.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&o4)for(var r of o4(e))t.indexOf(r)<0&&KG.call(e,r)&&(n[r]=e[r]);return n};function eg(e){const t=e,{m:n,mx:r,my:o,mt:s,mb:i,ml:l,mr:u,p,px:m,py:h,pt:g,pb:x,pl:y,pr:b,bg:w,c:S,opacity:j,ff:_,fz:E,fw:I,lts:M,ta:R,lh:D,fs:A,tt:O,td:T,w:X,miw:B,maw:V,h:U,mih:N,mah:$,bgsz:q,bgp:F,bgr:Q,bga:Y,pos:se,top:ae,left:re,bottom:G,right:K,inset:ee,display:le}=t,J=qG(t,["m","mx","my","mt","mb","ml","mr","p","px","py","pt","pb","pl","pr","bg","c","opacity","ff","fz","fw","lts","ta","lh","fs","tt","td","w","miw","maw","h","mih","mah","bgsz","bgp","bgr","bga","pos","top","left","bottom","right","inset","display"]);return{systemStyles:F9({m:n,mx:r,my:o,mt:s,mb:i,ml:l,mr:u,p,px:m,py:h,pt:g,pb:x,pl:y,pr:b,bg:w,c:S,opacity:j,ff:_,fz:E,fw:I,lts:M,ta:R,lh:D,fs:A,tt:O,td:T,w:X,miw:B,maw:V,h:U,mih:N,mah:$,bgsz:q,bgp:F,bgr:Q,bga:Y,pos:se,top:ae,left:re,bottom:G,right:K,inset:ee,display:le}),rest:J}}function XG(e,t){const n=Object.keys(e).filter(r=>r!=="base").sort((r,o)=>Uw(mt({size:r,sizes:t.breakpoints}))-Uw(mt({size:o,sizes:t.breakpoints})));return"base"in e?["base",...n]:n}function QG({value:e,theme:t,getValue:n,property:r}){if(e==null)return;if(typeof e=="object")return XG(e,t).reduce((i,l)=>{if(l==="base"&&e.base!==void 0){const p=n(e.base,t);return Array.isArray(r)?(r.forEach(m=>{i[m]=p}),i):(i[r]=p,i)}const u=n(e[l],t);return Array.isArray(r)?(i[t.fn.largerThan(l)]={},r.forEach(p=>{i[t.fn.largerThan(l)][p]=u}),i):(i[t.fn.largerThan(l)]={[r]:u},i)},{});const o=n(e,t);return Array.isArray(r)?r.reduce((s,i)=>(s[i]=o,s),{}):{[r]:o}}function YG(e,t){return e==="dimmed"?t.colorScheme==="dark"?t.colors.dark[2]:t.colors.gray[6]:t.fn.variant({variant:"filled",color:e,primaryFallback:!1}).background}function ZG(e){return Re(e)}function JG(e){return e}function eK(e,t){return mt({size:e,sizes:t.fontSizes})}const tK=["-xs","-sm","-md","-lg","-xl"];function nK(e,t){return tK.includes(e)?`calc(${mt({size:e.replace("-",""),sizes:t.spacing})} * -1)`:mt({size:e,sizes:t.spacing})}const rK={identity:JG,color:YG,size:ZG,fontSize:eK,spacing:nK},oK={m:{type:"spacing",property:"margin"},mt:{type:"spacing",property:"marginTop"},mb:{type:"spacing",property:"marginBottom"},ml:{type:"spacing",property:"marginLeft"},mr:{type:"spacing",property:"marginRight"},mx:{type:"spacing",property:["marginRight","marginLeft"]},my:{type:"spacing",property:["marginTop","marginBottom"]},p:{type:"spacing",property:"padding"},pt:{type:"spacing",property:"paddingTop"},pb:{type:"spacing",property:"paddingBottom"},pl:{type:"spacing",property:"paddingLeft"},pr:{type:"spacing",property:"paddingRight"},px:{type:"spacing",property:["paddingRight","paddingLeft"]},py:{type:"spacing",property:["paddingTop","paddingBottom"]},bg:{type:"color",property:"background"},c:{type:"color",property:"color"},opacity:{type:"identity",property:"opacity"},ff:{type:"identity",property:"fontFamily"},fz:{type:"fontSize",property:"fontSize"},fw:{type:"identity",property:"fontWeight"},lts:{type:"size",property:"letterSpacing"},ta:{type:"identity",property:"textAlign"},lh:{type:"identity",property:"lineHeight"},fs:{type:"identity",property:"fontStyle"},tt:{type:"identity",property:"textTransform"},td:{type:"identity",property:"textDecoration"},w:{type:"spacing",property:"width"},miw:{type:"spacing",property:"minWidth"},maw:{type:"spacing",property:"maxWidth"},h:{type:"spacing",property:"height"},mih:{type:"spacing",property:"minHeight"},mah:{type:"spacing",property:"maxHeight"},bgsz:{type:"size",property:"backgroundSize"},bgp:{type:"identity",property:"backgroundPosition"},bgr:{type:"identity",property:"backgroundRepeat"},bga:{type:"identity",property:"backgroundAttachment"},pos:{type:"identity",property:"position"},top:{type:"identity",property:"top"},left:{type:"size",property:"left"},bottom:{type:"size",property:"bottom"},right:{type:"size",property:"right"},inset:{type:"size",property:"inset"},display:{type:"identity",property:"display"}};var sK=Object.defineProperty,s4=Object.getOwnPropertySymbols,aK=Object.prototype.hasOwnProperty,iK=Object.prototype.propertyIsEnumerable,a4=(e,t,n)=>t in e?sK(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,i4=(e,t)=>{for(var n in t||(t={}))aK.call(t,n)&&a4(e,n,t[n]);if(s4)for(var n of s4(t))iK.call(t,n)&&a4(e,n,t[n]);return e};function l4(e,t,n=oK){return Object.keys(n).reduce((o,s)=>(s in e&&e[s]!==void 0&&o.push(QG({value:e[s],getValue:rK[n[s].type],property:n[s].property,theme:t})),o),[]).reduce((o,s)=>(Object.keys(s).forEach(i=>{typeof s[i]=="object"&&s[i]!==null&&i in o?o[i]=i4(i4({},o[i]),s[i]):o[i]=s[i]}),o),{})}function c4(e,t){return typeof e=="function"?e(t):e}function lK(e,t,n){const r=xa(),{css:o,cx:s}=AP();return Array.isArray(e)?s(n,o(l4(t,r)),e.map(i=>o(c4(i,r)))):s(n,o(c4(e,r)),o(l4(t,r)))}var cK=Object.defineProperty,pm=Object.getOwnPropertySymbols,HP=Object.prototype.hasOwnProperty,VP=Object.prototype.propertyIsEnumerable,u4=(e,t,n)=>t in e?cK(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,uK=(e,t)=>{for(var n in t||(t={}))HP.call(t,n)&&u4(e,n,t[n]);if(pm)for(var n of pm(t))VP.call(t,n)&&u4(e,n,t[n]);return e},dK=(e,t)=>{var n={};for(var r in e)HP.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&pm)for(var r of pm(e))t.indexOf(r)<0&&VP.call(e,r)&&(n[r]=e[r]);return n};const WP=d.forwardRef((e,t)=>{var n=e,{className:r,component:o,style:s,sx:i}=n,l=dK(n,["className","component","style","sx"]);const{systemStyles:u,rest:p}=eg(l),m=o||"div";return H.createElement(m,uK({ref:t,className:lK(i,u,r),style:s},p))});WP.displayName="@mantine/core/Box";const zr=WP;var fK=Object.defineProperty,pK=Object.defineProperties,mK=Object.getOwnPropertyDescriptors,d4=Object.getOwnPropertySymbols,hK=Object.prototype.hasOwnProperty,gK=Object.prototype.propertyIsEnumerable,f4=(e,t,n)=>t in e?fK(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,p4=(e,t)=>{for(var n in t||(t={}))hK.call(t,n)&&f4(e,n,t[n]);if(d4)for(var n of d4(t))gK.call(t,n)&&f4(e,n,t[n]);return e},vK=(e,t)=>pK(e,mK(t)),xK=fr(e=>({root:vK(p4(p4({},e.fn.focusStyles()),e.fn.fontStyles()),{cursor:"pointer",border:0,padding:0,appearance:"none",fontSize:e.fontSizes.md,backgroundColor:"transparent",textAlign:"left",color:e.colorScheme==="dark"?e.colors.dark[0]:e.black,textDecoration:"none",boxSizing:"border-box"})}));const bK=xK;var yK=Object.defineProperty,mm=Object.getOwnPropertySymbols,UP=Object.prototype.hasOwnProperty,GP=Object.prototype.propertyIsEnumerable,m4=(e,t,n)=>t in e?yK(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,CK=(e,t)=>{for(var n in t||(t={}))UP.call(t,n)&&m4(e,n,t[n]);if(mm)for(var n of mm(t))GP.call(t,n)&&m4(e,n,t[n]);return e},wK=(e,t)=>{var n={};for(var r in e)UP.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&mm)for(var r of mm(e))t.indexOf(r)<0&&GP.call(e,r)&&(n[r]=e[r]);return n};const KP=d.forwardRef((e,t)=>{const n=Rn("UnstyledButton",{},e),{className:r,component:o="button",unstyled:s,variant:i}=n,l=wK(n,["className","component","unstyled","variant"]),{classes:u,cx:p}=bK(null,{name:"UnstyledButton",unstyled:s,variant:i});return H.createElement(zr,CK({component:o,ref:t,className:p(u.root,r),type:o==="button"?"button":void 0},l))});KP.displayName="@mantine/core/UnstyledButton";const SK=KP;var kK=Object.defineProperty,jK=Object.defineProperties,_K=Object.getOwnPropertyDescriptors,h4=Object.getOwnPropertySymbols,IK=Object.prototype.hasOwnProperty,PK=Object.prototype.propertyIsEnumerable,g4=(e,t,n)=>t in e?kK(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,J1=(e,t)=>{for(var n in t||(t={}))IK.call(t,n)&&g4(e,n,t[n]);if(h4)for(var n of h4(t))PK.call(t,n)&&g4(e,n,t[n]);return e},v4=(e,t)=>jK(e,_K(t));const EK=["subtle","filled","outline","light","default","transparent","gradient"],ip={xs:Re(18),sm:Re(22),md:Re(28),lg:Re(34),xl:Re(44)};function MK({variant:e,theme:t,color:n,gradient:r}){const o=t.fn.variant({color:n,variant:e,gradient:r});return e==="gradient"?{border:0,backgroundImage:o.background,color:o.color,"&:hover":t.fn.hover({backgroundSize:"200%"})}:EK.includes(e)?J1({border:`${Re(1)} solid ${o.border}`,backgroundColor:o.background,color:o.color},t.fn.hover({backgroundColor:o.hover})):null}var OK=fr((e,{radius:t,color:n,gradient:r},{variant:o,size:s})=>({root:v4(J1({position:"relative",borderRadius:e.fn.radius(t),padding:0,lineHeight:1,display:"flex",alignItems:"center",justifyContent:"center",height:mt({size:s,sizes:ip}),minHeight:mt({size:s,sizes:ip}),width:mt({size:s,sizes:ip}),minWidth:mt({size:s,sizes:ip})},MK({variant:o,theme:e,color:n,gradient:r})),{"&:active":e.activeStyles,"& [data-action-icon-loader]":{maxWidth:"70%"},"&:disabled, &[data-disabled]":{color:e.colors.gray[e.colorScheme==="dark"?6:4],cursor:"not-allowed",backgroundColor:o==="transparent"?void 0:e.fn.themeColor("gray",e.colorScheme==="dark"?8:1),borderColor:o==="transparent"?void 0:e.fn.themeColor("gray",e.colorScheme==="dark"?8:1),backgroundImage:"none",pointerEvents:"none","&:active":{transform:"none"}},"&[data-loading]":{pointerEvents:"none","&::before":v4(J1({content:'""'},e.fn.cover(Re(-1))),{backgroundColor:e.colorScheme==="dark"?e.fn.rgba(e.colors.dark[7],.5):"rgba(255, 255, 255, .5)",borderRadius:e.fn.radius(t),cursor:"not-allowed"})}})}));const RK=OK;var DK=Object.defineProperty,hm=Object.getOwnPropertySymbols,qP=Object.prototype.hasOwnProperty,XP=Object.prototype.propertyIsEnumerable,x4=(e,t,n)=>t in e?DK(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,b4=(e,t)=>{for(var n in t||(t={}))qP.call(t,n)&&x4(e,n,t[n]);if(hm)for(var n of hm(t))XP.call(t,n)&&x4(e,n,t[n]);return e},y4=(e,t)=>{var n={};for(var r in e)qP.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&hm)for(var r of hm(e))t.indexOf(r)<0&&XP.call(e,r)&&(n[r]=e[r]);return n};function AK(e){var t=e,{size:n,color:r}=t,o=y4(t,["size","color"]);const s=o,{style:i}=s,l=y4(s,["style"]);return H.createElement("svg",b4({viewBox:"0 0 135 140",xmlns:"http://www.w3.org/2000/svg",fill:r,style:b4({width:n},i)},l),H.createElement("rect",{y:"10",width:"15",height:"120",rx:"6"},H.createElement("animate",{attributeName:"height",begin:"0.5s",dur:"1s",values:"120;110;100;90;80;70;60;50;40;140;120",calcMode:"linear",repeatCount:"indefinite"}),H.createElement("animate",{attributeName:"y",begin:"0.5s",dur:"1s",values:"10;15;20;25;30;35;40;45;50;0;10",calcMode:"linear",repeatCount:"indefinite"})),H.createElement("rect",{x:"30",y:"10",width:"15",height:"120",rx:"6"},H.createElement("animate",{attributeName:"height",begin:"0.25s",dur:"1s",values:"120;110;100;90;80;70;60;50;40;140;120",calcMode:"linear",repeatCount:"indefinite"}),H.createElement("animate",{attributeName:"y",begin:"0.25s",dur:"1s",values:"10;15;20;25;30;35;40;45;50;0;10",calcMode:"linear",repeatCount:"indefinite"})),H.createElement("rect",{x:"60",width:"15",height:"140",rx:"6"},H.createElement("animate",{attributeName:"height",begin:"0s",dur:"1s",values:"120;110;100;90;80;70;60;50;40;140;120",calcMode:"linear",repeatCount:"indefinite"}),H.createElement("animate",{attributeName:"y",begin:"0s",dur:"1s",values:"10;15;20;25;30;35;40;45;50;0;10",calcMode:"linear",repeatCount:"indefinite"})),H.createElement("rect",{x:"90",y:"10",width:"15",height:"120",rx:"6"},H.createElement("animate",{attributeName:"height",begin:"0.25s",dur:"1s",values:"120;110;100;90;80;70;60;50;40;140;120",calcMode:"linear",repeatCount:"indefinite"}),H.createElement("animate",{attributeName:"y",begin:"0.25s",dur:"1s",values:"10;15;20;25;30;35;40;45;50;0;10",calcMode:"linear",repeatCount:"indefinite"})),H.createElement("rect",{x:"120",y:"10",width:"15",height:"120",rx:"6"},H.createElement("animate",{attributeName:"height",begin:"0.5s",dur:"1s",values:"120;110;100;90;80;70;60;50;40;140;120",calcMode:"linear",repeatCount:"indefinite"}),H.createElement("animate",{attributeName:"y",begin:"0.5s",dur:"1s",values:"10;15;20;25;30;35;40;45;50;0;10",calcMode:"linear",repeatCount:"indefinite"})))}var TK=Object.defineProperty,gm=Object.getOwnPropertySymbols,QP=Object.prototype.hasOwnProperty,YP=Object.prototype.propertyIsEnumerable,C4=(e,t,n)=>t in e?TK(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,w4=(e,t)=>{for(var n in t||(t={}))QP.call(t,n)&&C4(e,n,t[n]);if(gm)for(var n of gm(t))YP.call(t,n)&&C4(e,n,t[n]);return e},S4=(e,t)=>{var n={};for(var r in e)QP.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&gm)for(var r of gm(e))t.indexOf(r)<0&&YP.call(e,r)&&(n[r]=e[r]);return n};function NK(e){var t=e,{size:n,color:r}=t,o=S4(t,["size","color"]);const s=o,{style:i}=s,l=S4(s,["style"]);return H.createElement("svg",w4({viewBox:"0 0 38 38",xmlns:"http://www.w3.org/2000/svg",stroke:r,style:w4({width:n,height:n},i)},l),H.createElement("g",{fill:"none",fillRule:"evenodd"},H.createElement("g",{transform:"translate(2.5 2.5)",strokeWidth:"5"},H.createElement("circle",{strokeOpacity:".5",cx:"16",cy:"16",r:"16"}),H.createElement("path",{d:"M32 16c0-9.94-8.06-16-16-16"},H.createElement("animateTransform",{attributeName:"transform",type:"rotate",from:"0 16 16",to:"360 16 16",dur:"1s",repeatCount:"indefinite"})))))}var $K=Object.defineProperty,vm=Object.getOwnPropertySymbols,ZP=Object.prototype.hasOwnProperty,JP=Object.prototype.propertyIsEnumerable,k4=(e,t,n)=>t in e?$K(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,j4=(e,t)=>{for(var n in t||(t={}))ZP.call(t,n)&&k4(e,n,t[n]);if(vm)for(var n of vm(t))JP.call(t,n)&&k4(e,n,t[n]);return e},_4=(e,t)=>{var n={};for(var r in e)ZP.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&vm)for(var r of vm(e))t.indexOf(r)<0&&JP.call(e,r)&&(n[r]=e[r]);return n};function LK(e){var t=e,{size:n,color:r}=t,o=_4(t,["size","color"]);const s=o,{style:i}=s,l=_4(s,["style"]);return H.createElement("svg",j4({viewBox:"0 0 120 30",xmlns:"http://www.w3.org/2000/svg",fill:r,style:j4({width:n},i)},l),H.createElement("circle",{cx:"15",cy:"15",r:"15"},H.createElement("animate",{attributeName:"r",from:"15",to:"15",begin:"0s",dur:"0.8s",values:"15;9;15",calcMode:"linear",repeatCount:"indefinite"}),H.createElement("animate",{attributeName:"fill-opacity",from:"1",to:"1",begin:"0s",dur:"0.8s",values:"1;.5;1",calcMode:"linear",repeatCount:"indefinite"})),H.createElement("circle",{cx:"60",cy:"15",r:"9",fillOpacity:"0.3"},H.createElement("animate",{attributeName:"r",from:"9",to:"9",begin:"0s",dur:"0.8s",values:"9;15;9",calcMode:"linear",repeatCount:"indefinite"}),H.createElement("animate",{attributeName:"fill-opacity",from:"0.5",to:"0.5",begin:"0s",dur:"0.8s",values:".5;1;.5",calcMode:"linear",repeatCount:"indefinite"})),H.createElement("circle",{cx:"105",cy:"15",r:"15"},H.createElement("animate",{attributeName:"r",from:"15",to:"15",begin:"0s",dur:"0.8s",values:"15;9;15",calcMode:"linear",repeatCount:"indefinite"}),H.createElement("animate",{attributeName:"fill-opacity",from:"1",to:"1",begin:"0s",dur:"0.8s",values:"1;.5;1",calcMode:"linear",repeatCount:"indefinite"})))}var zK=Object.defineProperty,xm=Object.getOwnPropertySymbols,e6=Object.prototype.hasOwnProperty,t6=Object.prototype.propertyIsEnumerable,I4=(e,t,n)=>t in e?zK(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,FK=(e,t)=>{for(var n in t||(t={}))e6.call(t,n)&&I4(e,n,t[n]);if(xm)for(var n of xm(t))t6.call(t,n)&&I4(e,n,t[n]);return e},BK=(e,t)=>{var n={};for(var r in e)e6.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&xm)for(var r of xm(e))t.indexOf(r)<0&&t6.call(e,r)&&(n[r]=e[r]);return n};const _v={bars:AK,oval:NK,dots:LK},HK={xs:Re(18),sm:Re(22),md:Re(36),lg:Re(44),xl:Re(58)},VK={size:"md"};function n6(e){const t=Rn("Loader",VK,e),{size:n,color:r,variant:o}=t,s=BK(t,["size","color","variant"]),i=xa(),l=o in _v?o:i.loader;return H.createElement(zr,FK({role:"presentation",component:_v[l]||_v.bars,size:mt({size:n,sizes:HK}),color:i.fn.variant({variant:"filled",primaryFallback:!1,color:r||i.primaryColor}).background},s))}n6.displayName="@mantine/core/Loader";var WK=Object.defineProperty,bm=Object.getOwnPropertySymbols,r6=Object.prototype.hasOwnProperty,o6=Object.prototype.propertyIsEnumerable,P4=(e,t,n)=>t in e?WK(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,E4=(e,t)=>{for(var n in t||(t={}))r6.call(t,n)&&P4(e,n,t[n]);if(bm)for(var n of bm(t))o6.call(t,n)&&P4(e,n,t[n]);return e},UK=(e,t)=>{var n={};for(var r in e)r6.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&bm)for(var r of bm(e))t.indexOf(r)<0&&o6.call(e,r)&&(n[r]=e[r]);return n};const GK={color:"gray",size:"md",variant:"subtle"},s6=d.forwardRef((e,t)=>{const n=Rn("ActionIcon",GK,e),{className:r,color:o,children:s,radius:i,size:l,variant:u,gradient:p,disabled:m,loaderProps:h,loading:g,unstyled:x,__staticSelector:y}=n,b=UK(n,["className","color","children","radius","size","variant","gradient","disabled","loaderProps","loading","unstyled","__staticSelector"]),{classes:w,cx:S,theme:j}=RK({radius:i,color:o,gradient:p},{name:["ActionIcon",y],unstyled:x,size:l,variant:u}),_=H.createElement(n6,E4({color:j.fn.variant({color:o,variant:u}).color,size:"100%","data-action-icon-loader":!0},h));return H.createElement(SK,E4({className:S(w.root,r),ref:t,disabled:m,"data-disabled":m||void 0,"data-loading":g||void 0,unstyled:x},b),g?_:s)});s6.displayName="@mantine/core/ActionIcon";const KK=s6;var qK=Object.defineProperty,XK=Object.defineProperties,QK=Object.getOwnPropertyDescriptors,ym=Object.getOwnPropertySymbols,a6=Object.prototype.hasOwnProperty,i6=Object.prototype.propertyIsEnumerable,M4=(e,t,n)=>t in e?qK(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,YK=(e,t)=>{for(var n in t||(t={}))a6.call(t,n)&&M4(e,n,t[n]);if(ym)for(var n of ym(t))i6.call(t,n)&&M4(e,n,t[n]);return e},ZK=(e,t)=>XK(e,QK(t)),JK=(e,t)=>{var n={};for(var r in e)a6.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&ym)for(var r of ym(e))t.indexOf(r)<0&&i6.call(e,r)&&(n[r]=e[r]);return n};function l6(e){const t=Rn("Portal",{},e),{children:n,target:r,className:o,innerRef:s}=t,i=JK(t,["children","target","className","innerRef"]),l=xa(),[u,p]=d.useState(!1),m=d.useRef();return TP(()=>(p(!0),m.current=r?typeof r=="string"?document.querySelector(r):r:document.createElement("div"),r||document.body.appendChild(m.current),()=>{!r&&document.body.removeChild(m.current)}),[r]),u?qr.createPortal(H.createElement("div",ZK(YK({className:o,dir:l.dir},i),{ref:s}),n),m.current):null}l6.displayName="@mantine/core/Portal";var eq=Object.defineProperty,Cm=Object.getOwnPropertySymbols,c6=Object.prototype.hasOwnProperty,u6=Object.prototype.propertyIsEnumerable,O4=(e,t,n)=>t in e?eq(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,tq=(e,t)=>{for(var n in t||(t={}))c6.call(t,n)&&O4(e,n,t[n]);if(Cm)for(var n of Cm(t))u6.call(t,n)&&O4(e,n,t[n]);return e},nq=(e,t)=>{var n={};for(var r in e)c6.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Cm)for(var r of Cm(e))t.indexOf(r)<0&&u6.call(e,r)&&(n[r]=e[r]);return n};function d6(e){var t=e,{withinPortal:n=!0,children:r}=t,o=nq(t,["withinPortal","children"]);return n?H.createElement(l6,tq({},o),r):H.createElement(H.Fragment,null,r)}d6.displayName="@mantine/core/OptionalPortal";var rq=Object.defineProperty,wm=Object.getOwnPropertySymbols,f6=Object.prototype.hasOwnProperty,p6=Object.prototype.propertyIsEnumerable,R4=(e,t,n)=>t in e?rq(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,D4=(e,t)=>{for(var n in t||(t={}))f6.call(t,n)&&R4(e,n,t[n]);if(wm)for(var n of wm(t))p6.call(t,n)&&R4(e,n,t[n]);return e},oq=(e,t)=>{var n={};for(var r in e)f6.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&wm)for(var r of wm(e))t.indexOf(r)<0&&p6.call(e,r)&&(n[r]=e[r]);return n};function m6(e){const t=e,{width:n,height:r,style:o}=t,s=oq(t,["width","height","style"]);return H.createElement("svg",D4({viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:D4({width:n,height:r},o)},s),H.createElement("path",{d:"M11.7816 4.03157C12.0062 3.80702 12.0062 3.44295 11.7816 3.2184C11.5571 2.99385 11.193 2.99385 10.9685 3.2184L7.50005 6.68682L4.03164 3.2184C3.80708 2.99385 3.44301 2.99385 3.21846 3.2184C2.99391 3.44295 2.99391 3.80702 3.21846 4.03157L6.68688 7.49999L3.21846 10.9684C2.99391 11.193 2.99391 11.557 3.21846 11.7816C3.44301 12.0061 3.80708 12.0061 4.03164 11.7816L7.50005 8.31316L10.9685 11.7816C11.193 12.0061 11.5571 12.0061 11.7816 11.7816C12.0062 11.557 12.0062 11.193 11.7816 10.9684L8.31322 7.49999L11.7816 4.03157Z",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd"}))}m6.displayName="@mantine/core/CloseIcon";var sq=Object.defineProperty,Sm=Object.getOwnPropertySymbols,h6=Object.prototype.hasOwnProperty,g6=Object.prototype.propertyIsEnumerable,A4=(e,t,n)=>t in e?sq(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,aq=(e,t)=>{for(var n in t||(t={}))h6.call(t,n)&&A4(e,n,t[n]);if(Sm)for(var n of Sm(t))g6.call(t,n)&&A4(e,n,t[n]);return e},iq=(e,t)=>{var n={};for(var r in e)h6.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Sm)for(var r of Sm(e))t.indexOf(r)<0&&g6.call(e,r)&&(n[r]=e[r]);return n};const lq={xs:Re(12),sm:Re(16),md:Re(20),lg:Re(28),xl:Re(34)},cq={size:"sm"},v6=d.forwardRef((e,t)=>{const n=Rn("CloseButton",cq,e),{iconSize:r,size:o,children:s}=n,i=iq(n,["iconSize","size","children"]),l=Re(r||lq[o]);return H.createElement(KK,aq({ref:t,__staticSelector:"CloseButton",size:o},i),s||H.createElement(m6,{width:l,height:l}))});v6.displayName="@mantine/core/CloseButton";const x6=v6;var uq=Object.defineProperty,dq=Object.defineProperties,fq=Object.getOwnPropertyDescriptors,T4=Object.getOwnPropertySymbols,pq=Object.prototype.hasOwnProperty,mq=Object.prototype.propertyIsEnumerable,N4=(e,t,n)=>t in e?uq(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,lp=(e,t)=>{for(var n in t||(t={}))pq.call(t,n)&&N4(e,n,t[n]);if(T4)for(var n of T4(t))mq.call(t,n)&&N4(e,n,t[n]);return e},hq=(e,t)=>dq(e,fq(t));function gq({underline:e,strikethrough:t}){const n=[];return e&&n.push("underline"),t&&n.push("line-through"),n.length>0?n.join(" "):"none"}function vq({theme:e,color:t}){return t==="dimmed"?e.fn.dimmed():typeof t=="string"&&(t in e.colors||t.split(".")[0]in e.colors)?e.fn.variant({variant:"filled",color:t}).background:t||"inherit"}function xq(e){return typeof e=="number"?{overflow:"hidden",textOverflow:"ellipsis",display:"-webkit-box",WebkitLineClamp:e,WebkitBoxOrient:"vertical"}:null}function bq({theme:e,truncate:t}){return t==="start"?{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",direction:e.dir==="ltr"?"rtl":"ltr",textAlign:e.dir==="ltr"?"right":"left"}:t?{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}:null}var yq=fr((e,{color:t,lineClamp:n,truncate:r,inline:o,inherit:s,underline:i,gradient:l,weight:u,transform:p,align:m,strikethrough:h,italic:g},{size:x})=>{const y=e.fn.variant({variant:"gradient",gradient:l});return{root:hq(lp(lp(lp(lp({},e.fn.fontStyles()),e.fn.focusStyles()),xq(n)),bq({theme:e,truncate:r})),{color:vq({color:t,theme:e}),fontFamily:s?"inherit":e.fontFamily,fontSize:s||x===void 0?"inherit":mt({size:x,sizes:e.fontSizes}),lineHeight:s?"inherit":o?1:e.lineHeight,textDecoration:gq({underline:i,strikethrough:h}),WebkitTapHighlightColor:"transparent",fontWeight:s?"inherit":u,textTransform:p,textAlign:m,fontStyle:g?"italic":void 0}),gradient:{backgroundImage:y.background,WebkitBackgroundClip:"text",WebkitTextFillColor:"transparent"}}});const Cq=yq;var wq=Object.defineProperty,km=Object.getOwnPropertySymbols,b6=Object.prototype.hasOwnProperty,y6=Object.prototype.propertyIsEnumerable,$4=(e,t,n)=>t in e?wq(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Sq=(e,t)=>{for(var n in t||(t={}))b6.call(t,n)&&$4(e,n,t[n]);if(km)for(var n of km(t))y6.call(t,n)&&$4(e,n,t[n]);return e},kq=(e,t)=>{var n={};for(var r in e)b6.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&km)for(var r of km(e))t.indexOf(r)<0&&y6.call(e,r)&&(n[r]=e[r]);return n};const jq={variant:"text"},C6=d.forwardRef((e,t)=>{const n=Rn("Text",jq,e),{className:r,size:o,weight:s,transform:i,color:l,align:u,variant:p,lineClamp:m,truncate:h,gradient:g,inline:x,inherit:y,underline:b,strikethrough:w,italic:S,classNames:j,styles:_,unstyled:E,span:I,__staticSelector:M}=n,R=kq(n,["className","size","weight","transform","color","align","variant","lineClamp","truncate","gradient","inline","inherit","underline","strikethrough","italic","classNames","styles","unstyled","span","__staticSelector"]),{classes:D,cx:A}=Cq({color:l,lineClamp:m,truncate:h,inline:x,inherit:y,underline:b,strikethrough:w,italic:S,weight:s,transform:i,align:u,gradient:g},{unstyled:E,name:M||"Text",variant:p,size:o});return H.createElement(zr,Sq({ref:t,className:A(D.root,{[D.gradient]:p==="gradient"},r),component:I?"span":"div"},R))});C6.displayName="@mantine/core/Text";const wc=C6,cp={xs:Re(1),sm:Re(2),md:Re(3),lg:Re(4),xl:Re(5)};function up(e,t){const n=e.fn.variant({variant:"outline",color:t}).border;return typeof t=="string"&&(t in e.colors||t.split(".")[0]in e.colors)?n:t===void 0?e.colorScheme==="dark"?e.colors.dark[4]:e.colors.gray[4]:t}var _q=fr((e,{color:t},{size:n,variant:r})=>({root:{},withLabel:{borderTop:"0 !important"},left:{"&::before":{display:"none"}},right:{"&::after":{display:"none"}},label:{display:"flex",alignItems:"center","&::before":{content:'""',flex:1,height:Re(1),borderTop:`${mt({size:n,sizes:cp})} ${r} ${up(e,t)}`,marginRight:e.spacing.xs},"&::after":{content:'""',flex:1,borderTop:`${mt({size:n,sizes:cp})} ${r} ${up(e,t)}`,marginLeft:e.spacing.xs}},labelDefaultStyles:{color:t==="dark"?e.colors.dark[1]:e.fn.themeColor(t,e.colorScheme==="dark"?5:e.fn.primaryShade(),!1)},horizontal:{border:0,borderTopWidth:Re(mt({size:n,sizes:cp})),borderTopColor:up(e,t),borderTopStyle:r,margin:0},vertical:{border:0,alignSelf:"stretch",height:"auto",borderLeftWidth:Re(mt({size:n,sizes:cp})),borderLeftColor:up(e,t),borderLeftStyle:r}}));const Iq=_q;var Pq=Object.defineProperty,Eq=Object.defineProperties,Mq=Object.getOwnPropertyDescriptors,jm=Object.getOwnPropertySymbols,w6=Object.prototype.hasOwnProperty,S6=Object.prototype.propertyIsEnumerable,L4=(e,t,n)=>t in e?Pq(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,z4=(e,t)=>{for(var n in t||(t={}))w6.call(t,n)&&L4(e,n,t[n]);if(jm)for(var n of jm(t))S6.call(t,n)&&L4(e,n,t[n]);return e},Oq=(e,t)=>Eq(e,Mq(t)),Rq=(e,t)=>{var n={};for(var r in e)w6.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&jm)for(var r of jm(e))t.indexOf(r)<0&&S6.call(e,r)&&(n[r]=e[r]);return n};const Dq={orientation:"horizontal",size:"xs",labelPosition:"left",variant:"solid"},ex=d.forwardRef((e,t)=>{const n=Rn("Divider",Dq,e),{className:r,color:o,orientation:s,size:i,label:l,labelPosition:u,labelProps:p,variant:m,styles:h,classNames:g,unstyled:x}=n,y=Rq(n,["className","color","orientation","size","label","labelPosition","labelProps","variant","styles","classNames","unstyled"]),{classes:b,cx:w}=Iq({color:o},{classNames:g,styles:h,unstyled:x,name:"Divider",variant:m,size:i}),S=s==="vertical",j=s==="horizontal",_=!!l&&j,E=!(p!=null&&p.color);return H.createElement(zr,z4({ref:t,className:w(b.root,{[b.vertical]:S,[b.horizontal]:j,[b.withLabel]:_},r),role:"separator"},y),_&&H.createElement(wc,Oq(z4({},p),{size:(p==null?void 0:p.size)||"xs",mt:Re(2),className:w(b.label,b[u],{[b.labelDefaultStyles]:E})}),l))});ex.displayName="@mantine/core/Divider";var Aq=Object.defineProperty,Tq=Object.defineProperties,Nq=Object.getOwnPropertyDescriptors,F4=Object.getOwnPropertySymbols,$q=Object.prototype.hasOwnProperty,Lq=Object.prototype.propertyIsEnumerable,B4=(e,t,n)=>t in e?Aq(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,H4=(e,t)=>{for(var n in t||(t={}))$q.call(t,n)&&B4(e,n,t[n]);if(F4)for(var n of F4(t))Lq.call(t,n)&&B4(e,n,t[n]);return e},zq=(e,t)=>Tq(e,Nq(t)),Fq=fr((e,t,{size:n})=>({item:zq(H4({},e.fn.fontStyles()),{boxSizing:"border-box",wordBreak:"break-all",textAlign:"left",width:"100%",padding:`calc(${mt({size:n,sizes:e.spacing})} / 1.5) ${mt({size:n,sizes:e.spacing})}`,cursor:"pointer",fontSize:mt({size:n,sizes:e.fontSizes}),color:e.colorScheme==="dark"?e.colors.dark[0]:e.black,borderRadius:e.fn.radius(),"&[data-hovered]":{backgroundColor:e.colorScheme==="dark"?e.colors.dark[4]:e.colors.gray[1]},"&[data-selected]":H4({backgroundColor:e.fn.variant({variant:"filled"}).background,color:e.fn.variant({variant:"filled"}).color},e.fn.hover({backgroundColor:e.fn.variant({variant:"filled"}).hover})),"&[data-disabled]":{cursor:"default",color:e.colors.dark[2]}}),nothingFound:{boxSizing:"border-box",color:e.colors.gray[6],paddingTop:`calc(${mt({size:n,sizes:e.spacing})} / 2)`,paddingBottom:`calc(${mt({size:n,sizes:e.spacing})} / 2)`,textAlign:"center"},separator:{boxSizing:"border-box",textAlign:"left",width:"100%",padding:`calc(${mt({size:n,sizes:e.spacing})} / 1.5) ${mt({size:n,sizes:e.spacing})}`},separatorLabel:{color:e.colorScheme==="dark"?e.colors.dark[3]:e.colors.gray[5]}}));const Bq=Fq;var Hq=Object.defineProperty,V4=Object.getOwnPropertySymbols,Vq=Object.prototype.hasOwnProperty,Wq=Object.prototype.propertyIsEnumerable,W4=(e,t,n)=>t in e?Hq(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Uq=(e,t)=>{for(var n in t||(t={}))Vq.call(t,n)&&W4(e,n,t[n]);if(V4)for(var n of V4(t))Wq.call(t,n)&&W4(e,n,t[n]);return e};function ty({data:e,hovered:t,classNames:n,styles:r,isItemSelected:o,uuid:s,__staticSelector:i,onItemHover:l,onItemSelect:u,itemsRefs:p,itemComponent:m,size:h,nothingFound:g,creatable:x,createLabel:y,unstyled:b,variant:w}){const{classes:S}=Bq(null,{classNames:n,styles:r,unstyled:b,name:i,variant:w,size:h}),j=[],_=[];let E=null;const I=(R,D)=>{const A=typeof o=="function"?o(R.value):!1;return H.createElement(m,Uq({key:R.value,className:S.item,"data-disabled":R.disabled||void 0,"data-hovered":!R.disabled&&t===D||void 0,"data-selected":!R.disabled&&A||void 0,selected:A,onMouseEnter:()=>l(D),id:`${s}-${D}`,role:"option",tabIndex:-1,"aria-selected":t===D,ref:O=>{p&&p.current&&(p.current[R.value]=O)},onMouseDown:R.disabled?null:O=>{O.preventDefault(),u(R)},disabled:R.disabled,variant:w},R))};let M=null;if(e.forEach((R,D)=>{R.creatable?E=D:R.group?(M!==R.group&&(M=R.group,_.push(H.createElement("div",{className:S.separator,key:`__mantine-divider-${D}`},H.createElement(ex,{classNames:{label:S.separatorLabel},label:R.group})))),_.push(I(R,D))):j.push(I(R,D))}),x){const R=e[E];j.push(H.createElement("div",{key:Jb(),className:S.item,"data-hovered":t===E||void 0,onMouseEnter:()=>l(E),onMouseDown:D=>{D.preventDefault(),u(R)},tabIndex:-1,ref:D=>{p&&p.current&&(p.current[R.value]=D)}},y))}return _.length>0&&j.length>0&&j.unshift(H.createElement("div",{className:S.separator,key:"empty-group-separator"},H.createElement(ex,null))),_.length>0||j.length>0?H.createElement(H.Fragment,null,_,j):H.createElement(wc,{size:h,unstyled:b,className:S.nothingFound},g)}ty.displayName="@mantine/core/SelectItems";var Gq=Object.defineProperty,_m=Object.getOwnPropertySymbols,k6=Object.prototype.hasOwnProperty,j6=Object.prototype.propertyIsEnumerable,U4=(e,t,n)=>t in e?Gq(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Kq=(e,t)=>{for(var n in t||(t={}))k6.call(t,n)&&U4(e,n,t[n]);if(_m)for(var n of _m(t))j6.call(t,n)&&U4(e,n,t[n]);return e},qq=(e,t)=>{var n={};for(var r in e)k6.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&_m)for(var r of _m(e))t.indexOf(r)<0&&j6.call(e,r)&&(n[r]=e[r]);return n};const ny=d.forwardRef((e,t)=>{var n=e,{label:r,value:o}=n,s=qq(n,["label","value"]);return H.createElement("div",Kq({ref:t},s),r||o)});ny.displayName="@mantine/core/DefaultItem";function Xq(e,t){typeof e=="function"?e(t):e!=null&&(e.current=t)}function _6(...e){return t=>e.forEach(n=>Xq(n,t))}function al(...e){return d.useCallback(_6(...e),e)}const I6=d.forwardRef((e,t)=>{const{children:n,...r}=e,o=d.Children.toArray(n),s=o.find(Yq);if(s){const i=s.props.children,l=o.map(u=>u===s?d.Children.count(i)>1?d.Children.only(null):d.isValidElement(i)?i.props.children:null:u);return d.createElement(tx,pn({},r,{ref:t}),d.isValidElement(i)?d.cloneElement(i,void 0,l):null)}return d.createElement(tx,pn({},r,{ref:t}),n)});I6.displayName="Slot";const tx=d.forwardRef((e,t)=>{const{children:n,...r}=e;return d.isValidElement(n)?d.cloneElement(n,{...Zq(r,n.props),ref:_6(t,n.ref)}):d.Children.count(n)>1?d.Children.only(null):null});tx.displayName="SlotClone";const Qq=({children:e})=>d.createElement(d.Fragment,null,e);function Yq(e){return d.isValidElement(e)&&e.type===Qq}function Zq(e,t){const n={...t};for(const r in t){const o=e[r],s=t[r];/^on[A-Z]/.test(r)?o&&s?n[r]=(...l)=>{s(...l),o(...l)}:o&&(n[r]=o):r==="style"?n[r]={...o,...s}:r==="className"&&(n[r]=[o,s].filter(Boolean).join(" "))}return{...e,...n}}const Jq=["a","button","div","h2","h3","img","label","li","nav","ol","p","span","svg","ul"],Hd=Jq.reduce((e,t)=>{const n=d.forwardRef((r,o)=>{const{asChild:s,...i}=r,l=s?I6:t;return d.useEffect(()=>{window[Symbol.for("radix-ui")]=!0},[]),d.createElement(l,pn({},i,{ref:o}))});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{}),nx=globalThis!=null&&globalThis.document?d.useLayoutEffect:()=>{};function eX(e,t){return d.useReducer((n,r)=>{const o=t[n][r];return o??n},e)}const Vd=e=>{const{present:t,children:n}=e,r=tX(t),o=typeof n=="function"?n({present:r.isPresent}):d.Children.only(n),s=al(r.ref,o.ref);return typeof n=="function"||r.isPresent?d.cloneElement(o,{ref:s}):null};Vd.displayName="Presence";function tX(e){const[t,n]=d.useState(),r=d.useRef({}),o=d.useRef(e),s=d.useRef("none"),i=e?"mounted":"unmounted",[l,u]=eX(i,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return d.useEffect(()=>{const p=dp(r.current);s.current=l==="mounted"?p:"none"},[l]),nx(()=>{const p=r.current,m=o.current;if(m!==e){const g=s.current,x=dp(p);e?u("MOUNT"):x==="none"||(p==null?void 0:p.display)==="none"?u("UNMOUNT"):u(m&&g!==x?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,u]),nx(()=>{if(t){const p=h=>{const x=dp(r.current).includes(h.animationName);h.target===t&&x&&qr.flushSync(()=>u("ANIMATION_END"))},m=h=>{h.target===t&&(s.current=dp(r.current))};return t.addEventListener("animationstart",m),t.addEventListener("animationcancel",p),t.addEventListener("animationend",p),()=>{t.removeEventListener("animationstart",m),t.removeEventListener("animationcancel",p),t.removeEventListener("animationend",p)}}else u("ANIMATION_END")},[t,u]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:d.useCallback(p=>{p&&(r.current=getComputedStyle(p)),n(p)},[])}}function dp(e){return(e==null?void 0:e.animationName)||"none"}function nX(e,t=[]){let n=[];function r(s,i){const l=d.createContext(i),u=n.length;n=[...n,i];function p(h){const{scope:g,children:x,...y}=h,b=(g==null?void 0:g[e][u])||l,w=d.useMemo(()=>y,Object.values(y));return d.createElement(b.Provider,{value:w},x)}function m(h,g){const x=(g==null?void 0:g[e][u])||l,y=d.useContext(x);if(y)return y;if(i!==void 0)return i;throw new Error(`\`${h}\` must be used within \`${s}\``)}return p.displayName=s+"Provider",[p,m]}const o=()=>{const s=n.map(i=>d.createContext(i));return function(l){const u=(l==null?void 0:l[e])||s;return d.useMemo(()=>({[`__scope${e}`]:{...l,[e]:u}}),[l,u])}};return o.scopeName=e,[r,rX(o,...t)]}function rX(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(s){const i=r.reduce((l,{useScope:u,scopeName:p})=>{const h=u(s)[`__scope${p}`];return{...l,...h}},{});return d.useMemo(()=>({[`__scope${t.scopeName}`]:i}),[i])}};return n.scopeName=t.scopeName,n}function Ii(e){const t=d.useRef(e);return d.useEffect(()=>{t.current=e}),d.useMemo(()=>(...n)=>{var r;return(r=t.current)===null||r===void 0?void 0:r.call(t,...n)},[])}const oX=d.createContext(void 0);function sX(e){const t=d.useContext(oX);return e||t||"ltr"}function aX(e,[t,n]){return Math.min(n,Math.max(t,e))}function Ti(e,t,{checkForDefaultPrevented:n=!0}={}){return function(o){if(e==null||e(o),n===!1||!o.defaultPrevented)return t==null?void 0:t(o)}}function iX(e,t){return d.useReducer((n,r)=>{const o=t[n][r];return o??n},e)}const P6="ScrollArea",[E6,E1e]=nX(P6),[lX,_o]=E6(P6),cX=d.forwardRef((e,t)=>{const{__scopeScrollArea:n,type:r="hover",dir:o,scrollHideDelay:s=600,...i}=e,[l,u]=d.useState(null),[p,m]=d.useState(null),[h,g]=d.useState(null),[x,y]=d.useState(null),[b,w]=d.useState(null),[S,j]=d.useState(0),[_,E]=d.useState(0),[I,M]=d.useState(!1),[R,D]=d.useState(!1),A=al(t,T=>u(T)),O=sX(o);return d.createElement(lX,{scope:n,type:r,dir:O,scrollHideDelay:s,scrollArea:l,viewport:p,onViewportChange:m,content:h,onContentChange:g,scrollbarX:x,onScrollbarXChange:y,scrollbarXEnabled:I,onScrollbarXEnabledChange:M,scrollbarY:b,onScrollbarYChange:w,scrollbarYEnabled:R,onScrollbarYEnabledChange:D,onCornerWidthChange:j,onCornerHeightChange:E},d.createElement(Hd.div,pn({dir:O},i,{ref:A,style:{position:"relative","--radix-scroll-area-corner-width":S+"px","--radix-scroll-area-corner-height":_+"px",...e.style}})))}),uX="ScrollAreaViewport",dX=d.forwardRef((e,t)=>{const{__scopeScrollArea:n,children:r,...o}=e,s=_o(uX,n),i=d.useRef(null),l=al(t,i,s.onViewportChange);return d.createElement(d.Fragment,null,d.createElement("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}"}}),d.createElement(Hd.div,pn({"data-radix-scroll-area-viewport":""},o,{ref:l,style:{overflowX:s.scrollbarXEnabled?"scroll":"hidden",overflowY:s.scrollbarYEnabled?"scroll":"hidden",...e.style}}),d.createElement("div",{ref:s.onContentChange,style:{minWidth:"100%",display:"table"}},r)))}),ya="ScrollAreaScrollbar",fX=d.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=_o(ya,e.__scopeScrollArea),{onScrollbarXEnabledChange:s,onScrollbarYEnabledChange:i}=o,l=e.orientation==="horizontal";return d.useEffect(()=>(l?s(!0):i(!0),()=>{l?s(!1):i(!1)}),[l,s,i]),o.type==="hover"?d.createElement(pX,pn({},r,{ref:t,forceMount:n})):o.type==="scroll"?d.createElement(mX,pn({},r,{ref:t,forceMount:n})):o.type==="auto"?d.createElement(M6,pn({},r,{ref:t,forceMount:n})):o.type==="always"?d.createElement(ry,pn({},r,{ref:t})):null}),pX=d.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=_o(ya,e.__scopeScrollArea),[s,i]=d.useState(!1);return d.useEffect(()=>{const l=o.scrollArea;let u=0;if(l){const p=()=>{window.clearTimeout(u),i(!0)},m=()=>{u=window.setTimeout(()=>i(!1),o.scrollHideDelay)};return l.addEventListener("pointerenter",p),l.addEventListener("pointerleave",m),()=>{window.clearTimeout(u),l.removeEventListener("pointerenter",p),l.removeEventListener("pointerleave",m)}}},[o.scrollArea,o.scrollHideDelay]),d.createElement(Vd,{present:n||s},d.createElement(M6,pn({"data-state":s?"visible":"hidden"},r,{ref:t})))}),mX=d.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=_o(ya,e.__scopeScrollArea),s=e.orientation==="horizontal",i=ng(()=>u("SCROLL_END"),100),[l,u]=iX("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 d.useEffect(()=>{if(l==="idle"){const p=window.setTimeout(()=>u("HIDE"),o.scrollHideDelay);return()=>window.clearTimeout(p)}},[l,o.scrollHideDelay,u]),d.useEffect(()=>{const p=o.viewport,m=s?"scrollLeft":"scrollTop";if(p){let h=p[m];const g=()=>{const x=p[m];h!==x&&(u("SCROLL"),i()),h=x};return p.addEventListener("scroll",g),()=>p.removeEventListener("scroll",g)}},[o.viewport,s,u,i]),d.createElement(Vd,{present:n||l!=="hidden"},d.createElement(ry,pn({"data-state":l==="hidden"?"hidden":"visible"},r,{ref:t,onPointerEnter:Ti(e.onPointerEnter,()=>u("POINTER_ENTER")),onPointerLeave:Ti(e.onPointerLeave,()=>u("POINTER_LEAVE"))})))}),M6=d.forwardRef((e,t)=>{const n=_o(ya,e.__scopeScrollArea),{forceMount:r,...o}=e,[s,i]=d.useState(!1),l=e.orientation==="horizontal",u=ng(()=>{if(n.viewport){const p=n.viewport.offsetWidth{const{orientation:n="vertical",...r}=e,o=_o(ya,e.__scopeScrollArea),s=d.useRef(null),i=d.useRef(0),[l,u]=d.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),p=A6(l.viewport,l.content),m={...r,sizes:l,onSizesChange:u,hasThumb:p>0&&p<1,onThumbChange:g=>s.current=g,onThumbPointerUp:()=>i.current=0,onThumbPointerDown:g=>i.current=g};function h(g,x){return wX(g,i.current,l,x)}return n==="horizontal"?d.createElement(hX,pn({},m,{ref:t,onThumbPositionChange:()=>{if(o.viewport&&s.current){const g=o.viewport.scrollLeft,x=G4(g,l,o.dir);s.current.style.transform=`translate3d(${x}px, 0, 0)`}},onWheelScroll:g=>{o.viewport&&(o.viewport.scrollLeft=g)},onDragScroll:g=>{o.viewport&&(o.viewport.scrollLeft=h(g,o.dir))}})):n==="vertical"?d.createElement(gX,pn({},m,{ref:t,onThumbPositionChange:()=>{if(o.viewport&&s.current){const g=o.viewport.scrollTop,x=G4(g,l);s.current.style.transform=`translate3d(0, ${x}px, 0)`}},onWheelScroll:g=>{o.viewport&&(o.viewport.scrollTop=g)},onDragScroll:g=>{o.viewport&&(o.viewport.scrollTop=h(g))}})):null}),hX=d.forwardRef((e,t)=>{const{sizes:n,onSizesChange:r,...o}=e,s=_o(ya,e.__scopeScrollArea),[i,l]=d.useState(),u=d.useRef(null),p=al(t,u,s.onScrollbarXChange);return d.useEffect(()=>{u.current&&l(getComputedStyle(u.current))},[u]),d.createElement(R6,pn({"data-orientation":"horizontal"},o,{ref:p,sizes:n,style:{bottom:0,left:s.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:s.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":tg(n)+"px",...e.style},onThumbPointerDown:m=>e.onThumbPointerDown(m.x),onDragScroll:m=>e.onDragScroll(m.x),onWheelScroll:(m,h)=>{if(s.viewport){const g=s.viewport.scrollLeft+m.deltaX;e.onWheelScroll(g),N6(g,h)&&m.preventDefault()}},onResize:()=>{u.current&&s.viewport&&i&&r({content:s.viewport.scrollWidth,viewport:s.viewport.offsetWidth,scrollbar:{size:u.current.clientWidth,paddingStart:Im(i.paddingLeft),paddingEnd:Im(i.paddingRight)}})}}))}),gX=d.forwardRef((e,t)=>{const{sizes:n,onSizesChange:r,...o}=e,s=_o(ya,e.__scopeScrollArea),[i,l]=d.useState(),u=d.useRef(null),p=al(t,u,s.onScrollbarYChange);return d.useEffect(()=>{u.current&&l(getComputedStyle(u.current))},[u]),d.createElement(R6,pn({"data-orientation":"vertical"},o,{ref:p,sizes:n,style:{top:0,right:s.dir==="ltr"?0:void 0,left:s.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":tg(n)+"px",...e.style},onThumbPointerDown:m=>e.onThumbPointerDown(m.y),onDragScroll:m=>e.onDragScroll(m.y),onWheelScroll:(m,h)=>{if(s.viewport){const g=s.viewport.scrollTop+m.deltaY;e.onWheelScroll(g),N6(g,h)&&m.preventDefault()}},onResize:()=>{u.current&&s.viewport&&i&&r({content:s.viewport.scrollHeight,viewport:s.viewport.offsetHeight,scrollbar:{size:u.current.clientHeight,paddingStart:Im(i.paddingTop),paddingEnd:Im(i.paddingBottom)}})}}))}),[vX,O6]=E6(ya),R6=d.forwardRef((e,t)=>{const{__scopeScrollArea:n,sizes:r,hasThumb:o,onThumbChange:s,onThumbPointerUp:i,onThumbPointerDown:l,onThumbPositionChange:u,onDragScroll:p,onWheelScroll:m,onResize:h,...g}=e,x=_o(ya,n),[y,b]=d.useState(null),w=al(t,A=>b(A)),S=d.useRef(null),j=d.useRef(""),_=x.viewport,E=r.content-r.viewport,I=Ii(m),M=Ii(u),R=ng(h,10);function D(A){if(S.current){const O=A.clientX-S.current.left,T=A.clientY-S.current.top;p({x:O,y:T})}}return d.useEffect(()=>{const A=O=>{const T=O.target;(y==null?void 0:y.contains(T))&&I(O,E)};return document.addEventListener("wheel",A,{passive:!1}),()=>document.removeEventListener("wheel",A,{passive:!1})},[_,y,E,I]),d.useEffect(M,[r,M]),Sc(y,R),Sc(x.content,R),d.createElement(vX,{scope:n,scrollbar:y,hasThumb:o,onThumbChange:Ii(s),onThumbPointerUp:Ii(i),onThumbPositionChange:M,onThumbPointerDown:Ii(l)},d.createElement(Hd.div,pn({},g,{ref:w,style:{position:"absolute",...g.style},onPointerDown:Ti(e.onPointerDown,A=>{A.button===0&&(A.target.setPointerCapture(A.pointerId),S.current=y.getBoundingClientRect(),j.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",D(A))}),onPointerMove:Ti(e.onPointerMove,D),onPointerUp:Ti(e.onPointerUp,A=>{const O=A.target;O.hasPointerCapture(A.pointerId)&&O.releasePointerCapture(A.pointerId),document.body.style.webkitUserSelect=j.current,S.current=null})})))}),rx="ScrollAreaThumb",xX=d.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=O6(rx,e.__scopeScrollArea);return d.createElement(Vd,{present:n||o.hasThumb},d.createElement(bX,pn({ref:t},r)))}),bX=d.forwardRef((e,t)=>{const{__scopeScrollArea:n,style:r,...o}=e,s=_o(rx,n),i=O6(rx,n),{onThumbPositionChange:l}=i,u=al(t,h=>i.onThumbChange(h)),p=d.useRef(),m=ng(()=>{p.current&&(p.current(),p.current=void 0)},100);return d.useEffect(()=>{const h=s.viewport;if(h){const g=()=>{if(m(),!p.current){const x=SX(h,l);p.current=x,l()}};return l(),h.addEventListener("scroll",g),()=>h.removeEventListener("scroll",g)}},[s.viewport,m,l]),d.createElement(Hd.div,pn({"data-state":i.hasThumb?"visible":"hidden"},o,{ref:u,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...r},onPointerDownCapture:Ti(e.onPointerDownCapture,h=>{const x=h.target.getBoundingClientRect(),y=h.clientX-x.left,b=h.clientY-x.top;i.onThumbPointerDown({x:y,y:b})}),onPointerUp:Ti(e.onPointerUp,i.onThumbPointerUp)}))}),D6="ScrollAreaCorner",yX=d.forwardRef((e,t)=>{const n=_o(D6,e.__scopeScrollArea),r=!!(n.scrollbarX&&n.scrollbarY);return n.type!=="scroll"&&r?d.createElement(CX,pn({},e,{ref:t})):null}),CX=d.forwardRef((e,t)=>{const{__scopeScrollArea:n,...r}=e,o=_o(D6,n),[s,i]=d.useState(0),[l,u]=d.useState(0),p=!!(s&&l);return Sc(o.scrollbarX,()=>{var m;const h=((m=o.scrollbarX)===null||m===void 0?void 0:m.offsetHeight)||0;o.onCornerHeightChange(h),u(h)}),Sc(o.scrollbarY,()=>{var m;const h=((m=o.scrollbarY)===null||m===void 0?void 0:m.offsetWidth)||0;o.onCornerWidthChange(h),i(h)}),p?d.createElement(Hd.div,pn({},r,{ref:t,style:{width:s,height:l,position:"absolute",right:o.dir==="ltr"?0:void 0,left:o.dir==="rtl"?0:void 0,bottom:0,...e.style}})):null});function Im(e){return e?parseInt(e,10):0}function A6(e,t){const n=e/t;return isNaN(n)?0:n}function tg(e){const t=A6(e.viewport,e.content),n=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,r=(e.scrollbar.size-n)*t;return Math.max(r,18)}function wX(e,t,n,r="ltr"){const o=tg(n),s=o/2,i=t||s,l=o-i,u=n.scrollbar.paddingStart+i,p=n.scrollbar.size-n.scrollbar.paddingEnd-l,m=n.content-n.viewport,h=r==="ltr"?[0,m]:[m*-1,0];return T6([u,p],h)(e)}function G4(e,t,n="ltr"){const r=tg(t),o=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,s=t.scrollbar.size-o,i=t.content-t.viewport,l=s-r,u=n==="ltr"?[0,i]:[i*-1,0],p=aX(e,u);return T6([0,i],[0,l])(p)}function T6(e,t){return n=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const r=(t[1]-t[0])/(e[1]-e[0]);return t[0]+r*(n-e[0])}}function N6(e,t){return e>0&&e{})=>{let n={left:e.scrollLeft,top:e.scrollTop},r=0;return function o(){const s={left:e.scrollLeft,top:e.scrollTop},i=n.left!==s.left,l=n.top!==s.top;(i||l)&&t(),n=s,r=window.requestAnimationFrame(o)}(),()=>window.cancelAnimationFrame(r)};function ng(e,t){const n=Ii(e),r=d.useRef(0);return d.useEffect(()=>()=>window.clearTimeout(r.current),[]),d.useCallback(()=>{window.clearTimeout(r.current),r.current=window.setTimeout(n,t)},[n,t])}function Sc(e,t){const n=Ii(t);nx(()=>{let r=0;if(e){const o=new ResizeObserver(()=>{cancelAnimationFrame(r),r=window.requestAnimationFrame(n)});return o.observe(e),()=>{window.cancelAnimationFrame(r),o.unobserve(e)}}},[e,n])}const kX=cX,jX=dX,K4=fX,q4=xX,_X=yX;var IX=fr((e,{scrollbarSize:t,offsetScrollbars:n,scrollbarHovered:r,hidden:o})=>({root:{overflow:"hidden"},viewport:{width:"100%",height:"100%",paddingRight:n?Re(t):void 0,paddingBottom:n?Re(t):void 0},scrollbar:{display:o?"none":"flex",userSelect:"none",touchAction:"none",boxSizing:"border-box",padding:`calc(${Re(t)} / 5)`,transition:"background-color 150ms ease, opacity 150ms ease","&:hover":{backgroundColor:e.colorScheme==="dark"?e.colors.dark[8]:e.colors.gray[0],[`& .${JS("thumb")}`]:{backgroundColor:e.colorScheme==="dark"?e.fn.rgba(e.white,.5):e.fn.rgba(e.black,.5)}},'&[data-orientation="vertical"]':{width:Re(t)},'&[data-orientation="horizontal"]':{flexDirection:"column",height:Re(t)},'&[data-state="hidden"]':{display:"none",opacity:0}},thumb:{ref:JS("thumb"),flex:1,backgroundColor:e.colorScheme==="dark"?e.fn.rgba(e.white,.4):e.fn.rgba(e.black,.4),borderRadius:Re(t),position:"relative",transition:"background-color 150ms ease",display:o?"none":void 0,overflow:"hidden","&::before":{content:'""',position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",width:"100%",height:"100%",minWidth:Re(44),minHeight:Re(44)}},corner:{backgroundColor:e.colorScheme==="dark"?e.colors.dark[6]:e.colors.gray[0],transition:"opacity 150ms ease",opacity:r?1:0,display:o?"none":void 0}}));const PX=IX;var EX=Object.defineProperty,MX=Object.defineProperties,OX=Object.getOwnPropertyDescriptors,Pm=Object.getOwnPropertySymbols,$6=Object.prototype.hasOwnProperty,L6=Object.prototype.propertyIsEnumerable,X4=(e,t,n)=>t in e?EX(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ox=(e,t)=>{for(var n in t||(t={}))$6.call(t,n)&&X4(e,n,t[n]);if(Pm)for(var n of Pm(t))L6.call(t,n)&&X4(e,n,t[n]);return e},z6=(e,t)=>MX(e,OX(t)),F6=(e,t)=>{var n={};for(var r in e)$6.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Pm)for(var r of Pm(e))t.indexOf(r)<0&&L6.call(e,r)&&(n[r]=e[r]);return n};const B6={scrollbarSize:12,scrollHideDelay:1e3,type:"hover",offsetScrollbars:!1},rg=d.forwardRef((e,t)=>{const n=Rn("ScrollArea",B6,e),{children:r,className:o,classNames:s,styles:i,scrollbarSize:l,scrollHideDelay:u,type:p,dir:m,offsetScrollbars:h,viewportRef:g,onScrollPositionChange:x,unstyled:y,variant:b,viewportProps:w}=n,S=F6(n,["children","className","classNames","styles","scrollbarSize","scrollHideDelay","type","dir","offsetScrollbars","viewportRef","onScrollPositionChange","unstyled","variant","viewportProps"]),[j,_]=d.useState(!1),E=xa(),{classes:I,cx:M}=PX({scrollbarSize:l,offsetScrollbars:h,scrollbarHovered:j,hidden:p==="never"},{name:"ScrollArea",classNames:s,styles:i,unstyled:y,variant:b});return H.createElement(kX,{type:p==="never"?"always":p,scrollHideDelay:u,dir:m||E.dir,ref:t,asChild:!0},H.createElement(zr,ox({className:M(I.root,o)},S),H.createElement(jX,z6(ox({},w),{className:I.viewport,ref:g,onScroll:typeof x=="function"?({currentTarget:R})=>x({x:R.scrollLeft,y:R.scrollTop}):void 0}),r),H.createElement(K4,{orientation:"horizontal",className:I.scrollbar,forceMount:!0,onMouseEnter:()=>_(!0),onMouseLeave:()=>_(!1)},H.createElement(q4,{className:I.thumb})),H.createElement(K4,{orientation:"vertical",className:I.scrollbar,forceMount:!0,onMouseEnter:()=>_(!0),onMouseLeave:()=>_(!1)},H.createElement(q4,{className:I.thumb})),H.createElement(_X,{className:I.corner})))}),H6=d.forwardRef((e,t)=>{const n=Rn("ScrollAreaAutosize",B6,e),{children:r,classNames:o,styles:s,scrollbarSize:i,scrollHideDelay:l,type:u,dir:p,offsetScrollbars:m,viewportRef:h,onScrollPositionChange:g,unstyled:x,sx:y,variant:b,viewportProps:w}=n,S=F6(n,["children","classNames","styles","scrollbarSize","scrollHideDelay","type","dir","offsetScrollbars","viewportRef","onScrollPositionChange","unstyled","sx","variant","viewportProps"]);return H.createElement(zr,z6(ox({},S),{ref:t,sx:[{display:"flex"},...EP(y)]}),H.createElement(zr,{sx:{display:"flex",flexDirection:"column",flex:1}},H.createElement(rg,{classNames:o,styles:s,scrollHideDelay:l,scrollbarSize:i,type:u,dir:p,offsetScrollbars:m,viewportRef:h,onScrollPositionChange:g,unstyled:x,variant:b,viewportProps:w},r)))});H6.displayName="@mantine/core/ScrollAreaAutosize";rg.displayName="@mantine/core/ScrollArea";rg.Autosize=H6;const V6=rg;var RX=Object.defineProperty,DX=Object.defineProperties,AX=Object.getOwnPropertyDescriptors,Em=Object.getOwnPropertySymbols,W6=Object.prototype.hasOwnProperty,U6=Object.prototype.propertyIsEnumerable,Q4=(e,t,n)=>t in e?RX(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Y4=(e,t)=>{for(var n in t||(t={}))W6.call(t,n)&&Q4(e,n,t[n]);if(Em)for(var n of Em(t))U6.call(t,n)&&Q4(e,n,t[n]);return e},TX=(e,t)=>DX(e,AX(t)),NX=(e,t)=>{var n={};for(var r in e)W6.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Em)for(var r of Em(e))t.indexOf(r)<0&&U6.call(e,r)&&(n[r]=e[r]);return n};const og=d.forwardRef((e,t)=>{var n=e,{style:r}=n,o=NX(n,["style"]);return H.createElement(V6,TX(Y4({},o),{style:Y4({width:"100%"},r),viewportProps:{tabIndex:-1},viewportRef:t}),o.children)});og.displayName="@mantine/core/SelectScrollArea";var $X=fr(()=>({dropdown:{},itemsWrapper:{padding:Re(4),display:"flex",width:"100%",boxSizing:"border-box"}}));const LX=$X;function Fc(e){return e.split("-")[1]}function oy(e){return e==="y"?"height":"width"}function Go(e){return e.split("-")[0]}function ii(e){return["top","bottom"].includes(Go(e))?"x":"y"}function Z4(e,t,n){let{reference:r,floating:o}=e;const s=r.x+r.width/2-o.width/2,i=r.y+r.height/2-o.height/2,l=ii(t),u=oy(l),p=r[u]/2-o[u]/2,m=l==="x";let h;switch(Go(t)){case"top":h={x:s,y:r.y-o.height};break;case"bottom":h={x:s,y:r.y+r.height};break;case"right":h={x:r.x+r.width,y:i};break;case"left":h={x:r.x-o.width,y:i};break;default:h={x:r.x,y:r.y}}switch(Fc(t)){case"start":h[l]-=p*(n&&m?-1:1);break;case"end":h[l]+=p*(n&&m?-1:1)}return h}const zX=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:s=[],platform:i}=n,l=s.filter(Boolean),u=await(i.isRTL==null?void 0:i.isRTL(t));let p=await i.getElementRects({reference:e,floating:t,strategy:o}),{x:m,y:h}=Z4(p,r,u),g=r,x={},y=0;for(let b=0;b({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:s,platform:i,elements:l}=t,{element:u,padding:p=0}=ia(e,t)||{};if(u==null)return{};const m=sy(p),h={x:n,y:r},g=ii(o),x=oy(g),y=await i.getDimensions(u),b=g==="y",w=b?"top":"left",S=b?"bottom":"right",j=b?"clientHeight":"clientWidth",_=s.reference[x]+s.reference[g]-h[g]-s.floating[x],E=h[g]-s.reference[g],I=await(i.getOffsetParent==null?void 0:i.getOffsetParent(u));let M=I?I[j]:0;M&&await(i.isElement==null?void 0:i.isElement(I))||(M=l.floating[j]||s.floating[x]);const R=_/2-E/2,D=M/2-y[x]/2-1,A=ei(m[w],D),O=ei(m[S],D),T=A,X=M-y[x]-O,B=M/2-y[x]/2+R,V=sx(T,B,X),U=Fc(o)!=null&&B!=V&&s.reference[x]/2-(Be.concat(t,t+"-start",t+"-end"),[]);const BX={left:"right",right:"left",bottom:"top",top:"bottom"};function Mm(e){return e.replace(/left|right|bottom|top/g,t=>BX[t])}function HX(e,t,n){n===void 0&&(n=!1);const r=Fc(e),o=ii(e),s=oy(o);let i=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(i=Mm(i)),{main:i,cross:Mm(i)}}const VX={start:"end",end:"start"};function Iv(e){return e.replace(/start|end/g,t=>VX[t])}const WX=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n;const{placement:r,middlewareData:o,rects:s,initialPlacement:i,platform:l,elements:u}=t,{mainAxis:p=!0,crossAxis:m=!0,fallbackPlacements:h,fallbackStrategy:g="bestFit",fallbackAxisSideDirection:x="none",flipAlignment:y=!0,...b}=ia(e,t),w=Go(r),S=Go(i)===i,j=await(l.isRTL==null?void 0:l.isRTL(u.floating)),_=h||(S||!y?[Mm(i)]:function(T){const X=Mm(T);return[Iv(T),X,Iv(X)]}(i));h||x==="none"||_.push(...function(T,X,B,V){const U=Fc(T);let N=function($,q,F){const Q=["left","right"],Y=["right","left"],se=["top","bottom"],ae=["bottom","top"];switch($){case"top":case"bottom":return F?q?Y:Q:q?Q:Y;case"left":case"right":return q?se:ae;default:return[]}}(Go(T),B==="start",V);return U&&(N=N.map($=>$+"-"+U),X&&(N=N.concat(N.map(Iv)))),N}(i,y,x,j));const E=[i,..._],I=await ay(t,b),M=[];let R=((n=o.flip)==null?void 0:n.overflows)||[];if(p&&M.push(I[w]),m){const{main:T,cross:X}=HX(r,s,j);M.push(I[T],I[X])}if(R=[...R,{placement:r,overflows:M}],!M.every(T=>T<=0)){var D,A;const T=(((D=o.flip)==null?void 0:D.index)||0)+1,X=E[T];if(X)return{data:{index:T,overflows:R},reset:{placement:X}};let B=(A=R.filter(V=>V.overflows[0]<=0).sort((V,U)=>V.overflows[1]-U.overflows[1])[0])==null?void 0:A.placement;if(!B)switch(g){case"bestFit":{var O;const V=(O=R.map(U=>[U.placement,U.overflows.filter(N=>N>0).reduce((N,$)=>N+$,0)]).sort((U,N)=>U[1]-N[1])[0])==null?void 0:O[0];V&&(B=V);break}case"initialPlacement":B=i}if(r!==B)return{reset:{placement:B}}}return{}}}};function ek(e){const t=ei(...e.map(r=>r.left)),n=ei(...e.map(r=>r.top));return{x:t,y:n,width:ms(...e.map(r=>r.right))-t,height:ms(...e.map(r=>r.bottom))-n}}const UX=function(e){return e===void 0&&(e={}),{name:"inline",options:e,async fn(t){const{placement:n,elements:r,rects:o,platform:s,strategy:i}=t,{padding:l=2,x:u,y:p}=ia(e,t),m=Array.from(await(s.getClientRects==null?void 0:s.getClientRects(r.reference))||[]),h=function(b){const w=b.slice().sort((_,E)=>_.y-E.y),S=[];let j=null;for(let _=0;_j.height/2?S.push([E]):S[S.length-1].push(E),j=E}return S.map(_=>kc(ek(_)))}(m),g=kc(ek(m)),x=sy(l),y=await s.getElementRects({reference:{getBoundingClientRect:function(){if(h.length===2&&h[0].left>h[1].right&&u!=null&&p!=null)return h.find(b=>u>b.left-x.left&&ub.top-x.top&&p=2){if(ii(n)==="x"){const I=h[0],M=h[h.length-1],R=Go(n)==="top",D=I.top,A=M.bottom,O=R?I.left:M.left,T=R?I.right:M.right;return{top:D,bottom:A,left:O,right:T,width:T-O,height:A-D,x:O,y:D}}const b=Go(n)==="left",w=ms(...h.map(I=>I.right)),S=ei(...h.map(I=>I.left)),j=h.filter(I=>b?I.left===S:I.right===w),_=j[0].top,E=j[j.length-1].bottom;return{top:_,bottom:E,left:S,right:w,width:w-S,height:E-_,x:S,y:_}}return g}},floating:r.floating,strategy:i});return o.reference.x!==y.reference.x||o.reference.y!==y.reference.y||o.reference.width!==y.reference.width||o.reference.height!==y.reference.height?{reset:{rects:y}}:{}}}},GX=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){const{x:n,y:r}=t,o=await async function(s,i){const{placement:l,platform:u,elements:p}=s,m=await(u.isRTL==null?void 0:u.isRTL(p.floating)),h=Go(l),g=Fc(l),x=ii(l)==="x",y=["left","top"].includes(h)?-1:1,b=m&&x?-1:1,w=ia(i,s);let{mainAxis:S,crossAxis:j,alignmentAxis:_}=typeof w=="number"?{mainAxis:w,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...w};return g&&typeof _=="number"&&(j=g==="end"?-1*_:_),x?{x:j*b,y:S*y}:{x:S*y,y:j*b}}(t,e);return{x:n+o.x,y:r+o.y,data:o}}}};function G6(e){return e==="x"?"y":"x"}const KX=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o}=t,{mainAxis:s=!0,crossAxis:i=!1,limiter:l={fn:w=>{let{x:S,y:j}=w;return{x:S,y:j}}},...u}=ia(e,t),p={x:n,y:r},m=await ay(t,u),h=ii(Go(o)),g=G6(h);let x=p[h],y=p[g];if(s){const w=h==="y"?"bottom":"right";x=sx(x+m[h==="y"?"top":"left"],x,x-m[w])}if(i){const w=g==="y"?"bottom":"right";y=sx(y+m[g==="y"?"top":"left"],y,y-m[w])}const b=l.fn({...t,[h]:x,[g]:y});return{...b,data:{x:b.x-n,y:b.y-r}}}}},qX=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:o,rects:s,middlewareData:i}=t,{offset:l=0,mainAxis:u=!0,crossAxis:p=!0}=ia(e,t),m={x:n,y:r},h=ii(o),g=G6(h);let x=m[h],y=m[g];const b=ia(l,t),w=typeof b=="number"?{mainAxis:b,crossAxis:0}:{mainAxis:0,crossAxis:0,...b};if(u){const _=h==="y"?"height":"width",E=s.reference[h]-s.floating[_]+w.mainAxis,I=s.reference[h]+s.reference[_]-w.mainAxis;xI&&(x=I)}if(p){var S,j;const _=h==="y"?"width":"height",E=["top","left"].includes(Go(o)),I=s.reference[g]-s.floating[_]+(E&&((S=i.offset)==null?void 0:S[g])||0)+(E?0:w.crossAxis),M=s.reference[g]+s.reference[_]+(E?0:((j=i.offset)==null?void 0:j[g])||0)-(E?w.crossAxis:0);yM&&(y=M)}return{[h]:x,[g]:y}}}},XX=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){const{placement:n,rects:r,platform:o,elements:s}=t,{apply:i=()=>{},...l}=ia(e,t),u=await ay(t,l),p=Go(n),m=Fc(n),h=ii(n)==="x",{width:g,height:x}=r.floating;let y,b;p==="top"||p==="bottom"?(y=p,b=m===(await(o.isRTL==null?void 0:o.isRTL(s.floating))?"start":"end")?"left":"right"):(b=p,y=m==="end"?"top":"bottom");const w=x-u[y],S=g-u[b],j=!t.middlewareData.shift;let _=w,E=S;if(h){const M=g-u.left-u.right;E=m||j?ei(S,M):M}else{const M=x-u.top-u.bottom;_=m||j?ei(w,M):M}if(j&&!m){const M=ms(u.left,0),R=ms(u.right,0),D=ms(u.top,0),A=ms(u.bottom,0);h?E=g-2*(M!==0||R!==0?M+R:ms(u.left,u.right)):_=x-2*(D!==0||A!==0?D+A:ms(u.top,u.bottom))}await i({...t,availableWidth:E,availableHeight:_});const I=await o.getDimensions(s.floating);return g!==I.width||x!==I.height?{reset:{rects:!0}}:{}}}};function Zr(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function ks(e){return Zr(e).getComputedStyle(e)}function K6(e){return e instanceof Zr(e).Node}function ti(e){return K6(e)?(e.nodeName||"").toLowerCase():"#document"}function Jo(e){return e instanceof HTMLElement||e instanceof Zr(e).HTMLElement}function tk(e){return typeof ShadowRoot<"u"&&(e instanceof Zr(e).ShadowRoot||e instanceof ShadowRoot)}function sd(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=ks(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!["inline","contents"].includes(o)}function QX(e){return["table","td","th"].includes(ti(e))}function ax(e){const t=iy(),n=ks(e);return n.transform!=="none"||n.perspective!=="none"||!!n.containerType&&n.containerType!=="normal"||!t&&!!n.backdropFilter&&n.backdropFilter!=="none"||!t&&!!n.filter&&n.filter!=="none"||["transform","perspective","filter"].some(r=>(n.willChange||"").includes(r))||["paint","layout","strict","content"].some(r=>(n.contain||"").includes(r))}function iy(){return!(typeof CSS>"u"||!CSS.supports)&&CSS.supports("-webkit-backdrop-filter","none")}function sg(e){return["html","body","#document"].includes(ti(e))}const ix=Math.min,fc=Math.max,Om=Math.round,fp=Math.floor,ni=e=>({x:e,y:e});function q6(e){const t=ks(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=Jo(e),s=o?e.offsetWidth:n,i=o?e.offsetHeight:r,l=Om(n)!==s||Om(r)!==i;return l&&(n=s,r=i),{width:n,height:r,$:l}}function ea(e){return e instanceof Element||e instanceof Zr(e).Element}function ly(e){return ea(e)?e:e.contextElement}function pc(e){const t=ly(e);if(!Jo(t))return ni(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:s}=q6(t);let i=(s?Om(n.width):n.width)/r,l=(s?Om(n.height):n.height)/o;return i&&Number.isFinite(i)||(i=1),l&&Number.isFinite(l)||(l=1),{x:i,y:l}}const YX=ni(0);function X6(e){const t=Zr(e);return iy()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:YX}function Xi(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),s=ly(e);let i=ni(1);t&&(r?ea(r)&&(i=pc(r)):i=pc(e));const l=function(g,x,y){return x===void 0&&(x=!1),!(!y||x&&y!==Zr(g))&&x}(s,n,r)?X6(s):ni(0);let u=(o.left+l.x)/i.x,p=(o.top+l.y)/i.y,m=o.width/i.x,h=o.height/i.y;if(s){const g=Zr(s),x=r&&ea(r)?Zr(r):r;let y=g.frameElement;for(;y&&r&&x!==g;){const b=pc(y),w=y.getBoundingClientRect(),S=getComputedStyle(y),j=w.left+(y.clientLeft+parseFloat(S.paddingLeft))*b.x,_=w.top+(y.clientTop+parseFloat(S.paddingTop))*b.y;u*=b.x,p*=b.y,m*=b.x,h*=b.y,u+=j,p+=_,y=Zr(y).frameElement}}return kc({width:m,height:h,x:u,y:p})}function ag(e){return ea(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.pageXOffset,scrollTop:e.pageYOffset}}function ta(e){var t;return(t=(K6(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Q6(e){return Xi(ta(e)).left+ag(e).scrollLeft}function jc(e){if(ti(e)==="html")return e;const t=e.assignedSlot||e.parentNode||tk(e)&&e.host||ta(e);return tk(t)?t.host:t}function Y6(e){const t=jc(e);return sg(t)?e.ownerDocument?e.ownerDocument.body:e.body:Jo(t)&&sd(t)?t:Y6(t)}function Rm(e,t){var n;t===void 0&&(t=[]);const r=Y6(e),o=r===((n=e.ownerDocument)==null?void 0:n.body),s=Zr(r);return o?t.concat(s,s.visualViewport||[],sd(r)?r:[]):t.concat(r,Rm(r))}function nk(e,t,n){let r;if(t==="viewport")r=function(o,s){const i=Zr(o),l=ta(o),u=i.visualViewport;let p=l.clientWidth,m=l.clientHeight,h=0,g=0;if(u){p=u.width,m=u.height;const x=iy();(!x||x&&s==="fixed")&&(h=u.offsetLeft,g=u.offsetTop)}return{width:p,height:m,x:h,y:g}}(e,n);else if(t==="document")r=function(o){const s=ta(o),i=ag(o),l=o.ownerDocument.body,u=fc(s.scrollWidth,s.clientWidth,l.scrollWidth,l.clientWidth),p=fc(s.scrollHeight,s.clientHeight,l.scrollHeight,l.clientHeight);let m=-i.scrollLeft+Q6(o);const h=-i.scrollTop;return ks(l).direction==="rtl"&&(m+=fc(s.clientWidth,l.clientWidth)-u),{width:u,height:p,x:m,y:h}}(ta(e));else if(ea(t))r=function(o,s){const i=Xi(o,!0,s==="fixed"),l=i.top+o.clientTop,u=i.left+o.clientLeft,p=Jo(o)?pc(o):ni(1);return{width:o.clientWidth*p.x,height:o.clientHeight*p.y,x:u*p.x,y:l*p.y}}(t,n);else{const o=X6(e);r={...t,x:t.x-o.x,y:t.y-o.y}}return kc(r)}function Z6(e,t){const n=jc(e);return!(n===t||!ea(n)||sg(n))&&(ks(n).position==="fixed"||Z6(n,t))}function ZX(e,t,n){const r=Jo(t),o=ta(t),s=n==="fixed",i=Xi(e,!0,s,t);let l={scrollLeft:0,scrollTop:0};const u=ni(0);if(r||!r&&!s)if((ti(t)!=="body"||sd(o))&&(l=ag(t)),Jo(t)){const p=Xi(t,!0,s,t);u.x=p.x+t.clientLeft,u.y=p.y+t.clientTop}else o&&(u.x=Q6(o));return{x:i.left+l.scrollLeft-u.x,y:i.top+l.scrollTop-u.y,width:i.width,height:i.height}}function rk(e,t){return Jo(e)&&ks(e).position!=="fixed"?t?t(e):e.offsetParent:null}function ok(e,t){const n=Zr(e);if(!Jo(e))return n;let r=rk(e,t);for(;r&&QX(r)&&ks(r).position==="static";)r=rk(r,t);return r&&(ti(r)==="html"||ti(r)==="body"&&ks(r).position==="static"&&!ax(r))?n:r||function(o){let s=jc(o);for(;Jo(s)&&!sg(s);){if(ax(s))return s;s=jc(s)}return null}(e)||n}const JX={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{rect:t,offsetParent:n,strategy:r}=e;const o=Jo(n),s=ta(n);if(n===s)return t;let i={scrollLeft:0,scrollTop:0},l=ni(1);const u=ni(0);if((o||!o&&r!=="fixed")&&((ti(n)!=="body"||sd(s))&&(i=ag(n)),Jo(n))){const p=Xi(n);l=pc(n),u.x=p.x+n.clientLeft,u.y=p.y+n.clientTop}return{width:t.width*l.x,height:t.height*l.y,x:t.x*l.x-i.scrollLeft*l.x+u.x,y:t.y*l.y-i.scrollTop*l.y+u.y}},getDocumentElement:ta,getClippingRect:function(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const s=[...n==="clippingAncestors"?function(u,p){const m=p.get(u);if(m)return m;let h=Rm(u).filter(b=>ea(b)&&ti(b)!=="body"),g=null;const x=ks(u).position==="fixed";let y=x?jc(u):u;for(;ea(y)&&!sg(y);){const b=ks(y),w=ax(y);w||b.position!=="fixed"||(g=null),(x?!w&&!g:!w&&b.position==="static"&&g&&["absolute","fixed"].includes(g.position)||sd(y)&&!w&&Z6(u,y))?h=h.filter(S=>S!==y):g=b,y=jc(y)}return p.set(u,h),h}(t,this._c):[].concat(n),r],i=s[0],l=s.reduce((u,p)=>{const m=nk(t,p,o);return u.top=fc(m.top,u.top),u.right=ix(m.right,u.right),u.bottom=ix(m.bottom,u.bottom),u.left=fc(m.left,u.left),u},nk(t,i,o));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}},getOffsetParent:ok,getElementRects:async function(e){let{reference:t,floating:n,strategy:r}=e;const o=this.getOffsetParent||ok,s=this.getDimensions;return{reference:ZX(t,await o(n),r),floating:{x:0,y:0,...await s(n)}}},getClientRects:function(e){return Array.from(e.getClientRects())},getDimensions:function(e){return q6(e)},getScale:pc,isElement:ea,isRTL:function(e){return getComputedStyle(e).direction==="rtl"}};function eQ(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:s=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:u=!1}=r,p=ly(e),m=o||s?[...p?Rm(p):[],...Rm(t)]:[];m.forEach(w=>{o&&w.addEventListener("scroll",n,{passive:!0}),s&&w.addEventListener("resize",n)});const h=p&&l?function(w,S){let j,_=null;const E=ta(w);function I(){clearTimeout(j),_&&_.disconnect(),_=null}return function M(R,D){R===void 0&&(R=!1),D===void 0&&(D=1),I();const{left:A,top:O,width:T,height:X}=w.getBoundingClientRect();if(R||S(),!T||!X)return;const B={rootMargin:-fp(O)+"px "+-fp(E.clientWidth-(A+T))+"px "+-fp(E.clientHeight-(O+X))+"px "+-fp(A)+"px",threshold:fc(0,ix(1,D))||1};let V=!0;function U(N){const $=N[0].intersectionRatio;if($!==D){if(!V)return M();$?M(!1,$):j=setTimeout(()=>{M(!1,1e-7)},100)}V=!1}try{_=new IntersectionObserver(U,{...B,root:E.ownerDocument})}catch{_=new IntersectionObserver(U,B)}_.observe(w)}(!0),I}(p,n):null;let g,x=-1,y=null;i&&(y=new ResizeObserver(w=>{let[S]=w;S&&S.target===p&&y&&(y.unobserve(t),cancelAnimationFrame(x),x=requestAnimationFrame(()=>{y&&y.observe(t)})),n()}),p&&!u&&y.observe(p),y.observe(t));let b=u?Xi(e):null;return u&&function w(){const S=Xi(e);!b||S.x===b.x&&S.y===b.y&&S.width===b.width&&S.height===b.height||n(),b=S,g=requestAnimationFrame(w)}(),n(),()=>{m.forEach(w=>{o&&w.removeEventListener("scroll",n),s&&w.removeEventListener("resize",n)}),h&&h(),y&&y.disconnect(),y=null,u&&cancelAnimationFrame(g)}}const tQ=(e,t,n)=>{const r=new Map,o={platform:JX,...n},s={...o.platform,_c:r};return zX(e,t,{...o,platform:s})},nQ=e=>{const{element:t,padding:n}=e;function r(o){return Object.prototype.hasOwnProperty.call(o,"current")}return{name:"arrow",options:e,fn(o){return r(t)?t.current!=null?J4({element:t.current,padding:n}).fn(o):{}:t?J4({element:t,padding:n}).fn(o):{}}}};var Vp=typeof document<"u"?d.useLayoutEffect:d.useEffect;function Dm(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 n,r,o;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!=t.length)return!1;for(r=n;r--!==0;)if(!Dm(e[r],t[r]))return!1;return!0}if(o=Object.keys(e),n=o.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!Object.prototype.hasOwnProperty.call(t,o[r]))return!1;for(r=n;r--!==0;){const s=o[r];if(!(s==="_owner"&&e.$$typeof)&&!Dm(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function sk(e){const t=d.useRef(e);return Vp(()=>{t.current=e}),t}function rQ(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:o,whileElementsMounted:s,open:i}=e,[l,u]=d.useState({x:null,y:null,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[p,m]=d.useState(r);Dm(p,r)||m(r);const h=d.useRef(null),g=d.useRef(null),x=d.useRef(l),y=sk(s),b=sk(o),[w,S]=d.useState(null),[j,_]=d.useState(null),E=d.useCallback(O=>{h.current!==O&&(h.current=O,S(O))},[]),I=d.useCallback(O=>{g.current!==O&&(g.current=O,_(O))},[]),M=d.useCallback(()=>{if(!h.current||!g.current)return;const O={placement:t,strategy:n,middleware:p};b.current&&(O.platform=b.current),tQ(h.current,g.current,O).then(T=>{const X={...T,isPositioned:!0};R.current&&!Dm(x.current,X)&&(x.current=X,qr.flushSync(()=>{u(X)}))})},[p,t,n,b]);Vp(()=>{i===!1&&x.current.isPositioned&&(x.current.isPositioned=!1,u(O=>({...O,isPositioned:!1})))},[i]);const R=d.useRef(!1);Vp(()=>(R.current=!0,()=>{R.current=!1}),[]),Vp(()=>{if(w&&j){if(y.current)return y.current(w,j,M);M()}},[w,j,M,y]);const D=d.useMemo(()=>({reference:h,floating:g,setReference:E,setFloating:I}),[E,I]),A=d.useMemo(()=>({reference:w,floating:j}),[w,j]);return d.useMemo(()=>({...l,update:M,refs:D,elements:A,reference:E,floating:I}),[l,M,D,A,E,I])}var oQ=typeof document<"u"?d.useLayoutEffect:d.useEffect;function sQ(){const e=new Map;return{emit(t,n){var r;(r=e.get(t))==null||r.forEach(o=>o(n))},on(t,n){e.set(t,[...e.get(t)||[],n])},off(t,n){e.set(t,(e.get(t)||[]).filter(r=>r!==n))}}}const aQ=d.createContext(null),iQ=()=>d.useContext(aQ);function lQ(e){return(e==null?void 0:e.ownerDocument)||document}function cQ(e){return lQ(e).defaultView||window}function pp(e){return e?e instanceof cQ(e).Element:!1}const uQ=Fx["useInsertionEffect".toString()],dQ=uQ||(e=>e());function fQ(e){const t=d.useRef(()=>{});return dQ(()=>{t.current=e}),d.useCallback(function(){for(var n=arguments.length,r=new Array(n),o=0;osQ())[0],[p,m]=d.useState(null),h=d.useCallback(S=>{const j=pp(S)?{getBoundingClientRect:()=>S.getBoundingClientRect(),contextElement:S}:S;o.refs.setReference(j)},[o.refs]),g=d.useCallback(S=>{(pp(S)||S===null)&&(i.current=S,m(S)),(pp(o.refs.reference.current)||o.refs.reference.current===null||S!==null&&!pp(S))&&o.refs.setReference(S)},[o.refs]),x=d.useMemo(()=>({...o.refs,setReference:g,setPositionReference:h,domReference:i}),[o.refs,g,h]),y=d.useMemo(()=>({...o.elements,domReference:p}),[o.elements,p]),b=fQ(n),w=d.useMemo(()=>({...o,refs:x,elements:y,dataRef:l,nodeId:r,events:u,open:t,onOpenChange:b}),[o,r,u,t,b,x,y]);return oQ(()=>{const S=s==null?void 0:s.nodesRef.current.find(j=>j.id===r);S&&(S.context=w)}),d.useMemo(()=>({...o,context:w,refs:x,reference:g,positionReference:h}),[o,x,w,g,h])}function mQ({opened:e,floating:t,position:n,positionDependencies:r}){const[o,s]=d.useState(0);d.useEffect(()=>{if(t.refs.reference.current&&t.refs.floating.current)return eQ(t.refs.reference.current,t.refs.floating.current,t.update)},[t.refs.reference.current,t.refs.floating.current,e,o,n]),Uo(()=>{t.update()},r),Uo(()=>{s(i=>i+1)},[e])}function hQ(e){const t=[GX(e.offset)];return e.middlewares.shift&&t.push(KX({limiter:qX()})),e.middlewares.flip&&t.push(WX()),e.middlewares.inline&&t.push(UX()),t.push(nQ({element:e.arrowRef,padding:e.arrowOffset})),t}function gQ(e){const[t,n]=od({value:e.opened,defaultValue:e.defaultOpened,finalValue:!1,onChange:e.onChange}),r=()=>{var i;(i=e.onClose)==null||i.call(e),n(!1)},o=()=>{var i,l;t?((i=e.onClose)==null||i.call(e),n(!1)):((l=e.onOpen)==null||l.call(e),n(!0))},s=pQ({placement:e.position,middleware:[...hQ(e),...e.width==="target"?[XX({apply({rects:i}){var l,u;Object.assign((u=(l=s.refs.floating.current)==null?void 0:l.style)!=null?u:{},{width:`${i.reference.width}px`})}})]:[]]});return mQ({opened:e.opened,position:e.position,positionDependencies:e.positionDependencies,floating:s}),Uo(()=>{var i;(i=e.onPositionChange)==null||i.call(e,s.placement)},[s.placement]),Uo(()=>{var i,l;e.opened?(l=e.onOpen)==null||l.call(e):(i=e.onClose)==null||i.call(e)},[e.opened]),{floating:s,controlled:typeof e.opened=="boolean",opened:t,onClose:r,onToggle:o}}const J6={context:"Popover component was not found in the tree",children:"Popover.Target component children should be an element or a component that accepts ref. Fragments, strings, numbers and other primitive values are not supported"},[vQ,eE]=oG(J6.context);var xQ=Object.defineProperty,bQ=Object.defineProperties,yQ=Object.getOwnPropertyDescriptors,Am=Object.getOwnPropertySymbols,tE=Object.prototype.hasOwnProperty,nE=Object.prototype.propertyIsEnumerable,ak=(e,t,n)=>t in e?xQ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,mp=(e,t)=>{for(var n in t||(t={}))tE.call(t,n)&&ak(e,n,t[n]);if(Am)for(var n of Am(t))nE.call(t,n)&&ak(e,n,t[n]);return e},CQ=(e,t)=>bQ(e,yQ(t)),wQ=(e,t)=>{var n={};for(var r in e)tE.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Am)for(var r of Am(e))t.indexOf(r)<0&&nE.call(e,r)&&(n[r]=e[r]);return n};const SQ={refProp:"ref",popupType:"dialog"},rE=d.forwardRef((e,t)=>{const n=Rn("PopoverTarget",SQ,e),{children:r,refProp:o,popupType:s}=n,i=wQ(n,["children","refProp","popupType"]);if(!OP(r))throw new Error(J6.children);const l=i,u=eE(),p=Bd(u.reference,r.ref,t),m=u.withRoles?{"aria-haspopup":s,"aria-expanded":u.opened,"aria-controls":u.getDropdownId(),id:u.getTargetId()}:{};return d.cloneElement(r,mp(CQ(mp(mp(mp({},l),m),u.targetProps),{className:DP(u.targetProps.className,l.className,r.props.className),[o]:p}),u.controlled?null:{onClick:u.onToggle}))});rE.displayName="@mantine/core/PopoverTarget";var kQ=fr((e,{radius:t,shadow:n})=>({dropdown:{position:"absolute",backgroundColor:e.white,background:e.colorScheme==="dark"?e.colors.dark[6]:e.white,border:`${Re(1)} solid ${e.colorScheme==="dark"?e.colors.dark[4]:e.colors.gray[2]}`,padding:`${e.spacing.sm} ${e.spacing.md}`,boxShadow:e.shadows[n]||n||"none",borderRadius:e.fn.radius(t),"&:focus":{outline:0}},arrow:{backgroundColor:"inherit",border:`${Re(1)} solid ${e.colorScheme==="dark"?e.colors.dark[4]:e.colors.gray[2]}`,zIndex:1}}));const jQ=kQ;var _Q=Object.defineProperty,ik=Object.getOwnPropertySymbols,IQ=Object.prototype.hasOwnProperty,PQ=Object.prototype.propertyIsEnumerable,lk=(e,t,n)=>t in e?_Q(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,$l=(e,t)=>{for(var n in t||(t={}))IQ.call(t,n)&&lk(e,n,t[n]);if(ik)for(var n of ik(t))PQ.call(t,n)&&lk(e,n,t[n]);return e};const ck={entering:"in",entered:"in",exiting:"out",exited:"out","pre-exiting":"out","pre-entering":"out"};function EQ({transition:e,state:t,duration:n,timingFunction:r}){const o={transitionDuration:`${n}ms`,transitionTimingFunction:r};return typeof e=="string"?e in ap?$l($l($l({transitionProperty:ap[e].transitionProperty},o),ap[e].common),ap[e][ck[t]]):null:$l($l($l({transitionProperty:e.transitionProperty},o),e.common),e[ck[t]])}function MQ({duration:e,exitDuration:t,timingFunction:n,mounted:r,onEnter:o,onExit:s,onEntered:i,onExited:l}){const u=xa(),p=FP(),m=u.respectReducedMotion?p:!1,[h,g]=d.useState(m?0:e),[x,y]=d.useState(r?"entered":"exited"),b=d.useRef(-1),w=S=>{const j=S?o:s,_=S?i:l;y(S?"pre-entering":"pre-exiting"),window.clearTimeout(b.current);const E=m?0:S?e:t;if(g(E),E===0)typeof j=="function"&&j(),typeof _=="function"&&_(),y(S?"entered":"exited");else{const I=window.setTimeout(()=>{typeof j=="function"&&j(),y(S?"entering":"exiting")},10);b.current=window.setTimeout(()=>{window.clearTimeout(I),typeof _=="function"&&_(),y(S?"entered":"exited")},E)}};return Uo(()=>{w(r)},[r]),d.useEffect(()=>()=>window.clearTimeout(b.current),[]),{transitionDuration:h,transitionStatus:x,transitionTimingFunction:n||u.transitionTimingFunction}}function oE({keepMounted:e,transition:t,duration:n=250,exitDuration:r=n,mounted:o,children:s,timingFunction:i,onExit:l,onEntered:u,onEnter:p,onExited:m}){const{transitionDuration:h,transitionStatus:g,transitionTimingFunction:x}=MQ({mounted:o,exitDuration:r,duration:n,timingFunction:i,onExit:l,onEntered:u,onEnter:p,onExited:m});return h===0?o?H.createElement(H.Fragment,null,s({})):e?s({display:"none"}):null:g==="exited"?e?s({display:"none"}):null:H.createElement(H.Fragment,null,s(EQ({transition:t,duration:h,state:g,timingFunction:x})))}oE.displayName="@mantine/core/Transition";function sE({children:e,active:t=!0,refProp:n="ref"}){const r=LG(t),o=Bd(r,e==null?void 0:e.ref);return OP(e)?d.cloneElement(e,{[n]:o}):e}sE.displayName="@mantine/core/FocusTrap";var OQ=Object.defineProperty,RQ=Object.defineProperties,DQ=Object.getOwnPropertyDescriptors,uk=Object.getOwnPropertySymbols,AQ=Object.prototype.hasOwnProperty,TQ=Object.prototype.propertyIsEnumerable,dk=(e,t,n)=>t in e?OQ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Na=(e,t)=>{for(var n in t||(t={}))AQ.call(t,n)&&dk(e,n,t[n]);if(uk)for(var n of uk(t))TQ.call(t,n)&&dk(e,n,t[n]);return e},hp=(e,t)=>RQ(e,DQ(t));function fk(e,t,n,r){return e==="center"||r==="center"?{top:t}:e==="end"?{bottom:n}:e==="start"?{top:n}:{}}function pk(e,t,n,r,o){return e==="center"||r==="center"?{left:t}:e==="end"?{[o==="ltr"?"right":"left"]:n}:e==="start"?{[o==="ltr"?"left":"right"]:n}:{}}const NQ={bottom:"borderTopLeftRadius",left:"borderTopRightRadius",right:"borderBottomLeftRadius",top:"borderBottomRightRadius"};function $Q({position:e,arrowSize:t,arrowOffset:n,arrowRadius:r,arrowPosition:o,arrowX:s,arrowY:i,dir:l}){const[u,p="center"]=e.split("-"),m={width:Re(t),height:Re(t),transform:"rotate(45deg)",position:"absolute",[NQ[u]]:Re(r)},h=Re(-t/2);return u==="left"?hp(Na(Na({},m),fk(p,i,n,o)),{right:h,borderLeftColor:"transparent",borderBottomColor:"transparent"}):u==="right"?hp(Na(Na({},m),fk(p,i,n,o)),{left:h,borderRightColor:"transparent",borderTopColor:"transparent"}):u==="top"?hp(Na(Na({},m),pk(p,s,n,o,l)),{bottom:h,borderTopColor:"transparent",borderLeftColor:"transparent"}):u==="bottom"?hp(Na(Na({},m),pk(p,s,n,o,l)),{top:h,borderBottomColor:"transparent",borderRightColor:"transparent"}):{}}var LQ=Object.defineProperty,zQ=Object.defineProperties,FQ=Object.getOwnPropertyDescriptors,Tm=Object.getOwnPropertySymbols,aE=Object.prototype.hasOwnProperty,iE=Object.prototype.propertyIsEnumerable,mk=(e,t,n)=>t in e?LQ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,BQ=(e,t)=>{for(var n in t||(t={}))aE.call(t,n)&&mk(e,n,t[n]);if(Tm)for(var n of Tm(t))iE.call(t,n)&&mk(e,n,t[n]);return e},HQ=(e,t)=>zQ(e,FQ(t)),VQ=(e,t)=>{var n={};for(var r in e)aE.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Tm)for(var r of Tm(e))t.indexOf(r)<0&&iE.call(e,r)&&(n[r]=e[r]);return n};const lE=d.forwardRef((e,t)=>{var n=e,{position:r,arrowSize:o,arrowOffset:s,arrowRadius:i,arrowPosition:l,visible:u,arrowX:p,arrowY:m}=n,h=VQ(n,["position","arrowSize","arrowOffset","arrowRadius","arrowPosition","visible","arrowX","arrowY"]);const g=xa();return u?H.createElement("div",HQ(BQ({},h),{ref:t,style:$Q({position:r,arrowSize:o,arrowOffset:s,arrowRadius:i,arrowPosition:l,dir:g.dir,arrowX:p,arrowY:m})})):null});lE.displayName="@mantine/core/FloatingArrow";var WQ=Object.defineProperty,UQ=Object.defineProperties,GQ=Object.getOwnPropertyDescriptors,Nm=Object.getOwnPropertySymbols,cE=Object.prototype.hasOwnProperty,uE=Object.prototype.propertyIsEnumerable,hk=(e,t,n)=>t in e?WQ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ll=(e,t)=>{for(var n in t||(t={}))cE.call(t,n)&&hk(e,n,t[n]);if(Nm)for(var n of Nm(t))uE.call(t,n)&&hk(e,n,t[n]);return e},gp=(e,t)=>UQ(e,GQ(t)),KQ=(e,t)=>{var n={};for(var r in e)cE.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Nm)for(var r of Nm(e))t.indexOf(r)<0&&uE.call(e,r)&&(n[r]=e[r]);return n};const qQ={};function dE(e){var t;const n=Rn("PopoverDropdown",qQ,e),{style:r,className:o,children:s,onKeyDownCapture:i}=n,l=KQ(n,["style","className","children","onKeyDownCapture"]),u=eE(),{classes:p,cx:m}=jQ({radius:u.radius,shadow:u.shadow},{name:u.__staticSelector,classNames:u.classNames,styles:u.styles,unstyled:u.unstyled,variant:u.variant}),h=OG({opened:u.opened,shouldReturnFocus:u.returnFocus}),g=u.withRoles?{"aria-labelledby":u.getTargetId(),id:u.getDropdownId(),role:"dialog"}:{};return u.disabled?null:H.createElement(d6,gp(Ll({},u.portalProps),{withinPortal:u.withinPortal}),H.createElement(oE,gp(Ll({mounted:u.opened},u.transitionProps),{transition:u.transitionProps.transition||"fade",duration:(t=u.transitionProps.duration)!=null?t:150,keepMounted:u.keepMounted,exitDuration:typeof u.transitionProps.exitDuration=="number"?u.transitionProps.exitDuration:u.transitionProps.duration}),x=>{var y,b;return H.createElement(sE,{active:u.trapFocus},H.createElement(zr,Ll(gp(Ll({},g),{tabIndex:-1,ref:u.floating,style:gp(Ll(Ll({},r),x),{zIndex:u.zIndex,top:(y=u.y)!=null?y:0,left:(b=u.x)!=null?b:0,width:u.width==="target"?void 0:Re(u.width)}),className:m(p.dropdown,o),onKeyDownCapture:aG(u.onClose,{active:u.closeOnEscape,onTrigger:h,onKeyDown:i}),"data-position":u.placement}),l),s,H.createElement(lE,{ref:u.arrowRef,arrowX:u.arrowX,arrowY:u.arrowY,visible:u.withArrow,position:u.placement,arrowSize:u.arrowSize,arrowRadius:u.arrowRadius,arrowOffset:u.arrowOffset,arrowPosition:u.arrowPosition,className:p.arrow})))}))}dE.displayName="@mantine/core/PopoverDropdown";function XQ(e,t){if(e==="rtl"&&(t.includes("right")||t.includes("left"))){const[n,r]=t.split("-"),o=n==="right"?"left":"right";return r===void 0?o:`${o}-${r}`}return t}var gk=Object.getOwnPropertySymbols,QQ=Object.prototype.hasOwnProperty,YQ=Object.prototype.propertyIsEnumerable,ZQ=(e,t)=>{var n={};for(var r in e)QQ.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&gk)for(var r of gk(e))t.indexOf(r)<0&&YQ.call(e,r)&&(n[r]=e[r]);return n};const JQ={position:"bottom",offset:8,positionDependencies:[],transitionProps:{transition:"fade",duration:150},middlewares:{flip:!0,shift:!0,inline:!1},arrowSize:7,arrowOffset:5,arrowRadius:0,arrowPosition:"side",closeOnClickOutside:!0,withinPortal:!1,closeOnEscape:!0,trapFocus:!1,withRoles:!0,returnFocus:!1,clickOutsideEvents:["mousedown","touchstart"],zIndex:Zb("popover"),__staticSelector:"Popover",width:"max-content"};function Bc(e){var t,n,r,o,s,i;const l=d.useRef(null),u=Rn("Popover",JQ,e),{children:p,position:m,offset:h,onPositionChange:g,positionDependencies:x,opened:y,transitionProps:b,width:w,middlewares:S,withArrow:j,arrowSize:_,arrowOffset:E,arrowRadius:I,arrowPosition:M,unstyled:R,classNames:D,styles:A,closeOnClickOutside:O,withinPortal:T,portalProps:X,closeOnEscape:B,clickOutsideEvents:V,trapFocus:U,onClose:N,onOpen:$,onChange:q,zIndex:F,radius:Q,shadow:Y,id:se,defaultOpened:ae,__staticSelector:re,withRoles:G,disabled:K,returnFocus:ee,variant:le,keepMounted:J}=u,ie=ZQ(u,["children","position","offset","onPositionChange","positionDependencies","opened","transitionProps","width","middlewares","withArrow","arrowSize","arrowOffset","arrowRadius","arrowPosition","unstyled","classNames","styles","closeOnClickOutside","withinPortal","portalProps","closeOnEscape","clickOutsideEvents","trapFocus","onClose","onOpen","onChange","zIndex","radius","shadow","id","defaultOpened","__staticSelector","withRoles","disabled","returnFocus","variant","keepMounted"]),[de,ge]=d.useState(null),[Ce,he]=d.useState(null),fe=ey(se),Oe=xa(),_e=gQ({middlewares:S,width:w,position:XQ(Oe.dir,m),offset:typeof h=="number"?h+(j?_/2:0):h,arrowRef:l,arrowOffset:E,onPositionChange:g,positionDependencies:x,opened:y,defaultOpened:ae,onChange:q,onOpen:$,onClose:N});IG(()=>_e.opened&&O&&_e.onClose(),V,[de,Ce]);const Ne=d.useCallback($e=>{ge($e),_e.floating.reference($e)},[_e.floating.reference]),nt=d.useCallback($e=>{he($e),_e.floating.floating($e)},[_e.floating.floating]);return H.createElement(vQ,{value:{returnFocus:ee,disabled:K,controlled:_e.controlled,reference:Ne,floating:nt,x:_e.floating.x,y:_e.floating.y,arrowX:(r=(n=(t=_e.floating)==null?void 0:t.middlewareData)==null?void 0:n.arrow)==null?void 0:r.x,arrowY:(i=(s=(o=_e.floating)==null?void 0:o.middlewareData)==null?void 0:s.arrow)==null?void 0:i.y,opened:_e.opened,arrowRef:l,transitionProps:b,width:w,withArrow:j,arrowSize:_,arrowOffset:E,arrowRadius:I,arrowPosition:M,placement:_e.floating.placement,trapFocus:U,withinPortal:T,portalProps:X,zIndex:F,radius:Q,shadow:Y,closeOnEscape:B,onClose:_e.onClose,onToggle:_e.onToggle,getTargetId:()=>`${fe}-target`,getDropdownId:()=>`${fe}-dropdown`,withRoles:G,targetProps:ie,__staticSelector:re,classNames:D,styles:A,unstyled:R,variant:le,keepMounted:J}},p)}Bc.Target=rE;Bc.Dropdown=dE;Bc.displayName="@mantine/core/Popover";var eY=Object.defineProperty,$m=Object.getOwnPropertySymbols,fE=Object.prototype.hasOwnProperty,pE=Object.prototype.propertyIsEnumerable,vk=(e,t,n)=>t in e?eY(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,tY=(e,t)=>{for(var n in t||(t={}))fE.call(t,n)&&vk(e,n,t[n]);if($m)for(var n of $m(t))pE.call(t,n)&&vk(e,n,t[n]);return e},nY=(e,t)=>{var n={};for(var r in e)fE.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&$m)for(var r of $m(e))t.indexOf(r)<0&&pE.call(e,r)&&(n[r]=e[r]);return n};function rY(e){var t=e,{children:n,component:r="div",maxHeight:o=220,direction:s="column",id:i,innerRef:l,__staticSelector:u,styles:p,classNames:m,unstyled:h}=t,g=nY(t,["children","component","maxHeight","direction","id","innerRef","__staticSelector","styles","classNames","unstyled"]);const{classes:x}=LX(null,{name:u,styles:p,classNames:m,unstyled:h});return H.createElement(Bc.Dropdown,tY({p:0,onMouseDown:y=>y.preventDefault()},g),H.createElement("div",{style:{maxHeight:Re(o),display:"flex"}},H.createElement(zr,{component:r||"div",id:`${i}-items`,"aria-labelledby":`${i}-label`,role:"listbox",onMouseDown:y=>y.preventDefault(),style:{flex:1,overflowY:r!==og?"auto":void 0},"data-combobox-popover":!0,tabIndex:-1,ref:l},H.createElement("div",{className:x.itemsWrapper,style:{flexDirection:s}},n))))}function Ka({opened:e,transitionProps:t={transition:"fade",duration:0},shadow:n,withinPortal:r,portalProps:o,children:s,__staticSelector:i,onDirectionChange:l,switchDirectionOnFlip:u,zIndex:p,dropdownPosition:m,positionDependencies:h=[],classNames:g,styles:x,unstyled:y,readOnly:b,variant:w}){return H.createElement(Bc,{unstyled:y,classNames:g,styles:x,width:"target",withRoles:!1,opened:e,middlewares:{flip:m==="flip",shift:!1},position:m==="flip"?"bottom":m,positionDependencies:h,zIndex:p,__staticSelector:i,withinPortal:r,portalProps:o,transitionProps:t,shadow:n,disabled:b,onPositionChange:S=>u&&(l==null?void 0:l(S==="top"?"column-reverse":"column")),variant:w},s)}Ka.Target=Bc.Target;Ka.Dropdown=rY;var oY=Object.defineProperty,sY=Object.defineProperties,aY=Object.getOwnPropertyDescriptors,Lm=Object.getOwnPropertySymbols,mE=Object.prototype.hasOwnProperty,hE=Object.prototype.propertyIsEnumerable,xk=(e,t,n)=>t in e?oY(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,vp=(e,t)=>{for(var n in t||(t={}))mE.call(t,n)&&xk(e,n,t[n]);if(Lm)for(var n of Lm(t))hE.call(t,n)&&xk(e,n,t[n]);return e},iY=(e,t)=>sY(e,aY(t)),lY=(e,t)=>{var n={};for(var r in e)mE.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Lm)for(var r of Lm(e))t.indexOf(r)<0&&hE.call(e,r)&&(n[r]=e[r]);return n};function gE(e,t,n){const r=Rn(e,t,n),{label:o,description:s,error:i,required:l,classNames:u,styles:p,className:m,unstyled:h,__staticSelector:g,sx:x,errorProps:y,labelProps:b,descriptionProps:w,wrapperProps:S,id:j,size:_,style:E,inputContainer:I,inputWrapperOrder:M,withAsterisk:R,variant:D}=r,A=lY(r,["label","description","error","required","classNames","styles","className","unstyled","__staticSelector","sx","errorProps","labelProps","descriptionProps","wrapperProps","id","size","style","inputContainer","inputWrapperOrder","withAsterisk","variant"]),O=ey(j),{systemStyles:T,rest:X}=eg(A),B=vp({label:o,description:s,error:i,required:l,classNames:u,className:m,__staticSelector:g,sx:x,errorProps:y,labelProps:b,descriptionProps:w,unstyled:h,styles:p,id:O,size:_,style:E,inputContainer:I,inputWrapperOrder:M,withAsterisk:R,variant:D},S);return iY(vp({},X),{classNames:u,styles:p,unstyled:h,wrapperProps:vp(vp({},B),T),inputProps:{required:l,classNames:u,styles:p,unstyled:h,id:O,size:_,__staticSelector:g,error:i,variant:D}})}var cY=fr((e,t,{size:n})=>({label:{display:"inline-block",fontSize:mt({size:n,sizes:e.fontSizes}),fontWeight:500,color:e.colorScheme==="dark"?e.colors.dark[0]:e.colors.gray[9],wordBreak:"break-word",cursor:"default",WebkitTapHighlightColor:"transparent"},required:{color:e.fn.variant({variant:"filled",color:"red"}).background}}));const uY=cY;var dY=Object.defineProperty,zm=Object.getOwnPropertySymbols,vE=Object.prototype.hasOwnProperty,xE=Object.prototype.propertyIsEnumerable,bk=(e,t,n)=>t in e?dY(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,fY=(e,t)=>{for(var n in t||(t={}))vE.call(t,n)&&bk(e,n,t[n]);if(zm)for(var n of zm(t))xE.call(t,n)&&bk(e,n,t[n]);return e},pY=(e,t)=>{var n={};for(var r in e)vE.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&zm)for(var r of zm(e))t.indexOf(r)<0&&xE.call(e,r)&&(n[r]=e[r]);return n};const mY={labelElement:"label",size:"sm"},cy=d.forwardRef((e,t)=>{const n=Rn("InputLabel",mY,e),{labelElement:r,children:o,required:s,size:i,classNames:l,styles:u,unstyled:p,className:m,htmlFor:h,__staticSelector:g,variant:x,onMouseDown:y}=n,b=pY(n,["labelElement","children","required","size","classNames","styles","unstyled","className","htmlFor","__staticSelector","variant","onMouseDown"]),{classes:w,cx:S}=uY(null,{name:["InputWrapper",g],classNames:l,styles:u,unstyled:p,variant:x,size:i});return H.createElement(zr,fY({component:r,ref:t,className:S(w.label,m),htmlFor:r==="label"?h:void 0,onMouseDown:j=>{y==null||y(j),!j.defaultPrevented&&j.detail>1&&j.preventDefault()}},b),o,s&&H.createElement("span",{className:w.required,"aria-hidden":!0}," *"))});cy.displayName="@mantine/core/InputLabel";var hY=fr((e,t,{size:n})=>({error:{wordBreak:"break-word",color:e.fn.variant({variant:"filled",color:"red"}).background,fontSize:`calc(${mt({size:n,sizes:e.fontSizes})} - ${Re(2)})`,lineHeight:1.2,display:"block"}}));const gY=hY;var vY=Object.defineProperty,Fm=Object.getOwnPropertySymbols,bE=Object.prototype.hasOwnProperty,yE=Object.prototype.propertyIsEnumerable,yk=(e,t,n)=>t in e?vY(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,xY=(e,t)=>{for(var n in t||(t={}))bE.call(t,n)&&yk(e,n,t[n]);if(Fm)for(var n of Fm(t))yE.call(t,n)&&yk(e,n,t[n]);return e},bY=(e,t)=>{var n={};for(var r in e)bE.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Fm)for(var r of Fm(e))t.indexOf(r)<0&&yE.call(e,r)&&(n[r]=e[r]);return n};const yY={size:"sm"},uy=d.forwardRef((e,t)=>{const n=Rn("InputError",yY,e),{children:r,className:o,classNames:s,styles:i,unstyled:l,size:u,__staticSelector:p,variant:m}=n,h=bY(n,["children","className","classNames","styles","unstyled","size","__staticSelector","variant"]),{classes:g,cx:x}=gY(null,{name:["InputWrapper",p],classNames:s,styles:i,unstyled:l,variant:m,size:u});return H.createElement(wc,xY({className:x(g.error,o),ref:t},h),r)});uy.displayName="@mantine/core/InputError";var CY=fr((e,t,{size:n})=>({description:{wordBreak:"break-word",color:e.colorScheme==="dark"?e.colors.dark[2]:e.colors.gray[6],fontSize:`calc(${mt({size:n,sizes:e.fontSizes})} - ${Re(2)})`,lineHeight:1.2,display:"block"}}));const wY=CY;var SY=Object.defineProperty,Bm=Object.getOwnPropertySymbols,CE=Object.prototype.hasOwnProperty,wE=Object.prototype.propertyIsEnumerable,Ck=(e,t,n)=>t in e?SY(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,kY=(e,t)=>{for(var n in t||(t={}))CE.call(t,n)&&Ck(e,n,t[n]);if(Bm)for(var n of Bm(t))wE.call(t,n)&&Ck(e,n,t[n]);return e},jY=(e,t)=>{var n={};for(var r in e)CE.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Bm)for(var r of Bm(e))t.indexOf(r)<0&&wE.call(e,r)&&(n[r]=e[r]);return n};const _Y={size:"sm"},dy=d.forwardRef((e,t)=>{const n=Rn("InputDescription",_Y,e),{children:r,className:o,classNames:s,styles:i,unstyled:l,size:u,__staticSelector:p,variant:m}=n,h=jY(n,["children","className","classNames","styles","unstyled","size","__staticSelector","variant"]),{classes:g,cx:x}=wY(null,{name:["InputWrapper",p],classNames:s,styles:i,unstyled:l,variant:m,size:u});return H.createElement(wc,kY({color:"dimmed",className:x(g.description,o),ref:t,unstyled:l},h),r)});dy.displayName="@mantine/core/InputDescription";const SE=d.createContext({offsetBottom:!1,offsetTop:!1,describedBy:void 0}),IY=SE.Provider,PY=()=>d.useContext(SE);function EY(e,{hasDescription:t,hasError:n}){const r=e.findIndex(u=>u==="input"),o=e[r-1],s=e[r+1];return{offsetBottom:t&&s==="description"||n&&s==="error",offsetTop:t&&o==="description"||n&&o==="error"}}var MY=Object.defineProperty,OY=Object.defineProperties,RY=Object.getOwnPropertyDescriptors,wk=Object.getOwnPropertySymbols,DY=Object.prototype.hasOwnProperty,AY=Object.prototype.propertyIsEnumerable,Sk=(e,t,n)=>t in e?MY(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,TY=(e,t)=>{for(var n in t||(t={}))DY.call(t,n)&&Sk(e,n,t[n]);if(wk)for(var n of wk(t))AY.call(t,n)&&Sk(e,n,t[n]);return e},NY=(e,t)=>OY(e,RY(t)),$Y=fr(e=>({root:NY(TY({},e.fn.fontStyles()),{lineHeight:e.lineHeight})}));const LY=$Y;var zY=Object.defineProperty,FY=Object.defineProperties,BY=Object.getOwnPropertyDescriptors,Hm=Object.getOwnPropertySymbols,kE=Object.prototype.hasOwnProperty,jE=Object.prototype.propertyIsEnumerable,kk=(e,t,n)=>t in e?zY(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,$a=(e,t)=>{for(var n in t||(t={}))kE.call(t,n)&&kk(e,n,t[n]);if(Hm)for(var n of Hm(t))jE.call(t,n)&&kk(e,n,t[n]);return e},jk=(e,t)=>FY(e,BY(t)),HY=(e,t)=>{var n={};for(var r in e)kE.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Hm)for(var r of Hm(e))t.indexOf(r)<0&&jE.call(e,r)&&(n[r]=e[r]);return n};const VY={labelElement:"label",size:"sm",inputContainer:e=>e,inputWrapperOrder:["label","description","input","error"]},_E=d.forwardRef((e,t)=>{const n=Rn("InputWrapper",VY,e),{className:r,label:o,children:s,required:i,id:l,error:u,description:p,labelElement:m,labelProps:h,descriptionProps:g,errorProps:x,classNames:y,styles:b,size:w,inputContainer:S,__staticSelector:j,unstyled:_,inputWrapperOrder:E,withAsterisk:I,variant:M}=n,R=HY(n,["className","label","children","required","id","error","description","labelElement","labelProps","descriptionProps","errorProps","classNames","styles","size","inputContainer","__staticSelector","unstyled","inputWrapperOrder","withAsterisk","variant"]),{classes:D,cx:A}=LY(null,{classNames:y,styles:b,name:["InputWrapper",j],unstyled:_,variant:M,size:w}),O={classNames:y,styles:b,unstyled:_,size:w,variant:M,__staticSelector:j},T=typeof I=="boolean"?I:i,X=l?`${l}-error`:x==null?void 0:x.id,B=l?`${l}-description`:g==null?void 0:g.id,U=`${!!u&&typeof u!="boolean"?X:""} ${p?B:""}`,N=U.trim().length>0?U.trim():void 0,$=o&&H.createElement(cy,$a($a({key:"label",labelElement:m,id:l?`${l}-label`:void 0,htmlFor:l,required:T},O),h),o),q=p&&H.createElement(dy,jk($a($a({key:"description"},g),O),{size:(g==null?void 0:g.size)||O.size,id:(g==null?void 0:g.id)||B}),p),F=H.createElement(d.Fragment,{key:"input"},S(s)),Q=typeof u!="boolean"&&u&&H.createElement(uy,jk($a($a({},x),O),{size:(x==null?void 0:x.size)||O.size,key:"error",id:(x==null?void 0:x.id)||X}),u),Y=E.map(se=>{switch(se){case"label":return $;case"input":return F;case"description":return q;case"error":return Q;default:return null}});return H.createElement(IY,{value:$a({describedBy:N},EY(E,{hasDescription:!!q,hasError:!!Q}))},H.createElement(zr,$a({className:A(D.root,r),ref:t},R),Y))});_E.displayName="@mantine/core/InputWrapper";var WY=Object.defineProperty,Vm=Object.getOwnPropertySymbols,IE=Object.prototype.hasOwnProperty,PE=Object.prototype.propertyIsEnumerable,_k=(e,t,n)=>t in e?WY(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,UY=(e,t)=>{for(var n in t||(t={}))IE.call(t,n)&&_k(e,n,t[n]);if(Vm)for(var n of Vm(t))PE.call(t,n)&&_k(e,n,t[n]);return e},GY=(e,t)=>{var n={};for(var r in e)IE.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Vm)for(var r of Vm(e))t.indexOf(r)<0&&PE.call(e,r)&&(n[r]=e[r]);return n};const KY={},EE=d.forwardRef((e,t)=>{const n=Rn("InputPlaceholder",KY,e),{sx:r}=n,o=GY(n,["sx"]);return H.createElement(zr,UY({component:"span",sx:[s=>s.fn.placeholderStyles(),...EP(r)],ref:t},o))});EE.displayName="@mantine/core/InputPlaceholder";var qY=Object.defineProperty,XY=Object.defineProperties,QY=Object.getOwnPropertyDescriptors,Ik=Object.getOwnPropertySymbols,YY=Object.prototype.hasOwnProperty,ZY=Object.prototype.propertyIsEnumerable,Pk=(e,t,n)=>t in e?qY(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,xp=(e,t)=>{for(var n in t||(t={}))YY.call(t,n)&&Pk(e,n,t[n]);if(Ik)for(var n of Ik(t))ZY.call(t,n)&&Pk(e,n,t[n]);return e},Pv=(e,t)=>XY(e,QY(t));const mo={xs:Re(30),sm:Re(36),md:Re(42),lg:Re(50),xl:Re(60)},JY=["default","filled","unstyled"];function eZ({theme:e,variant:t}){return JY.includes(t)?t==="default"?{border:`${Re(1)} solid ${e.colorScheme==="dark"?e.colors.dark[4]:e.colors.gray[4]}`,backgroundColor:e.colorScheme==="dark"?e.colors.dark[6]:e.white,transition:"border-color 100ms ease","&:focus, &:focus-within":e.focusRingStyles.inputStyles(e)}:t==="filled"?{border:`${Re(1)} solid transparent`,backgroundColor:e.colorScheme==="dark"?e.colors.dark[5]:e.colors.gray[1],"&:focus, &:focus-within":e.focusRingStyles.inputStyles(e)}:{borderWidth:0,color:e.colorScheme==="dark"?e.colors.dark[0]:e.black,backgroundColor:"transparent",minHeight:Re(28),outline:0,"&:focus, &:focus-within":{outline:"none",borderColor:"transparent"},"&:disabled":{backgroundColor:"transparent","&:focus, &:focus-within":{outline:"none",borderColor:"transparent"}}}:null}var tZ=fr((e,{multiline:t,radius:n,invalid:r,rightSectionWidth:o,withRightSection:s,iconWidth:i,offsetBottom:l,offsetTop:u,pointer:p},{variant:m,size:h})=>{const g=e.fn.variant({variant:"filled",color:"red"}).background,x=m==="default"||m==="filled"?{minHeight:mt({size:h,sizes:mo}),paddingLeft:`calc(${mt({size:h,sizes:mo})} / 3)`,paddingRight:s?o||mt({size:h,sizes:mo}):`calc(${mt({size:h,sizes:mo})} / 3)`,borderRadius:e.fn.radius(n)}:m==="unstyled"&&s?{paddingRight:o||mt({size:h,sizes:mo})}:null;return{wrapper:{position:"relative",marginTop:u?`calc(${e.spacing.xs} / 2)`:void 0,marginBottom:l?`calc(${e.spacing.xs} / 2)`:void 0,"&:has(input:disabled)":{"& .mantine-Input-rightSection":{display:"none"}}},input:Pv(xp(xp(Pv(xp({},e.fn.fontStyles()),{height:t?m==="unstyled"?void 0:"auto":mt({size:h,sizes:mo}),WebkitTapHighlightColor:"transparent",lineHeight:t?e.lineHeight:`calc(${mt({size:h,sizes:mo})} - ${Re(2)})`,appearance:"none",resize:"none",boxSizing:"border-box",fontSize:mt({size:h,sizes:e.fontSizes}),width:"100%",color:e.colorScheme==="dark"?e.colors.dark[0]:e.black,display:"block",textAlign:"left",cursor:p?"pointer":void 0}),eZ({theme:e,variant:m})),x),{"&:disabled, &[data-disabled]":{backgroundColor:e.colorScheme==="dark"?e.colors.dark[6]:e.colors.gray[1],color:e.colors.dark[2],opacity:.6,cursor:"not-allowed",pointerEvents:"none","&::placeholder":{color:e.colors.dark[2]}},"&[data-invalid]":{color:g,borderColor:g,"&::placeholder":{opacity:1,color:g}},"&[data-with-icon]":{paddingLeft:typeof i=="number"?Re(i):mt({size:h,sizes:mo})},"&::placeholder":Pv(xp({},e.fn.placeholderStyles()),{opacity:1}),"&::-webkit-inner-spin-button, &::-webkit-outer-spin-button, &::-webkit-search-decoration, &::-webkit-search-cancel-button, &::-webkit-search-results-button, &::-webkit-search-results-decoration":{appearance:"none"},"&[type=number]":{MozAppearance:"textfield"}}),icon:{pointerEvents:"none",position:"absolute",zIndex:1,left:0,top:0,bottom:0,display:"flex",alignItems:"center",justifyContent:"center",width:i?Re(i):mt({size:h,sizes:mo}),color:r?e.colors.red[e.colorScheme==="dark"?6:7]:e.colorScheme==="dark"?e.colors.dark[2]:e.colors.gray[5]},rightSection:{position:"absolute",top:0,bottom:0,right:0,display:"flex",alignItems:"center",justifyContent:"center",width:o||mt({size:h,sizes:mo})}}});const nZ=tZ;var rZ=Object.defineProperty,oZ=Object.defineProperties,sZ=Object.getOwnPropertyDescriptors,Wm=Object.getOwnPropertySymbols,ME=Object.prototype.hasOwnProperty,OE=Object.prototype.propertyIsEnumerable,Ek=(e,t,n)=>t in e?rZ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,bp=(e,t)=>{for(var n in t||(t={}))ME.call(t,n)&&Ek(e,n,t[n]);if(Wm)for(var n of Wm(t))OE.call(t,n)&&Ek(e,n,t[n]);return e},Mk=(e,t)=>oZ(e,sZ(t)),aZ=(e,t)=>{var n={};for(var r in e)ME.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Wm)for(var r of Wm(e))t.indexOf(r)<0&&OE.call(e,r)&&(n[r]=e[r]);return n};const iZ={size:"sm",variant:"default"},il=d.forwardRef((e,t)=>{const n=Rn("Input",iZ,e),{className:r,error:o,required:s,disabled:i,variant:l,icon:u,style:p,rightSectionWidth:m,iconWidth:h,rightSection:g,rightSectionProps:x,radius:y,size:b,wrapperProps:w,classNames:S,styles:j,__staticSelector:_,multiline:E,sx:I,unstyled:M,pointer:R}=n,D=aZ(n,["className","error","required","disabled","variant","icon","style","rightSectionWidth","iconWidth","rightSection","rightSectionProps","radius","size","wrapperProps","classNames","styles","__staticSelector","multiline","sx","unstyled","pointer"]),{offsetBottom:A,offsetTop:O,describedBy:T}=PY(),{classes:X,cx:B}=nZ({radius:y,multiline:E,invalid:!!o,rightSectionWidth:m?Re(m):void 0,iconWidth:h,withRightSection:!!g,offsetBottom:A,offsetTop:O,pointer:R},{classNames:S,styles:j,name:["Input",_],unstyled:M,variant:l,size:b}),{systemStyles:V,rest:U}=eg(D);return H.createElement(zr,bp(bp({className:B(X.wrapper,r),sx:I,style:p},V),w),u&&H.createElement("div",{className:X.icon},u),H.createElement(zr,Mk(bp({component:"input"},U),{ref:t,required:s,"aria-invalid":!!o,"aria-describedby":T,disabled:i,"data-disabled":i||void 0,"data-with-icon":!!u||void 0,"data-invalid":!!o||void 0,className:X.input})),g&&H.createElement("div",Mk(bp({},x),{className:X.rightSection}),g))});il.displayName="@mantine/core/Input";il.Wrapper=_E;il.Label=cy;il.Description=dy;il.Error=uy;il.Placeholder=EE;const _c=il;var lZ=Object.defineProperty,Um=Object.getOwnPropertySymbols,RE=Object.prototype.hasOwnProperty,DE=Object.prototype.propertyIsEnumerable,Ok=(e,t,n)=>t in e?lZ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Rk=(e,t)=>{for(var n in t||(t={}))RE.call(t,n)&&Ok(e,n,t[n]);if(Um)for(var n of Um(t))DE.call(t,n)&&Ok(e,n,t[n]);return e},cZ=(e,t)=>{var n={};for(var r in e)RE.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Um)for(var r of Um(e))t.indexOf(r)<0&&DE.call(e,r)&&(n[r]=e[r]);return n};const uZ={multiple:!1},AE=d.forwardRef((e,t)=>{const n=Rn("FileButton",uZ,e),{onChange:r,children:o,multiple:s,accept:i,name:l,form:u,resetRef:p,disabled:m,capture:h,inputProps:g}=n,x=cZ(n,["onChange","children","multiple","accept","name","form","resetRef","disabled","capture","inputProps"]),y=d.useRef(),b=()=>{!m&&y.current.click()},w=j=>{r(s?Array.from(j.currentTarget.files):j.currentTarget.files[0]||null)};return zP(p,()=>{y.current.value=""}),H.createElement(H.Fragment,null,o(Rk({onClick:b},x)),H.createElement("input",Rk({style:{display:"none"},type:"file",accept:i,multiple:s,onChange:w,ref:Bd(t,y),name:l,form:u,capture:h},g)))});AE.displayName="@mantine/core/FileButton";const TE={xs:Re(16),sm:Re(22),md:Re(26),lg:Re(30),xl:Re(36)},dZ={xs:Re(10),sm:Re(12),md:Re(14),lg:Re(16),xl:Re(18)};var fZ=fr((e,{disabled:t,radius:n,readOnly:r},{size:o,variant:s})=>({defaultValue:{display:"flex",alignItems:"center",backgroundColor:t?e.colorScheme==="dark"?e.colors.dark[5]:e.colors.gray[3]:e.colorScheme==="dark"?e.colors.dark[7]:s==="filled"?e.white:e.colors.gray[1],color:t?e.colorScheme==="dark"?e.colors.dark[1]:e.colors.gray[7]:e.colorScheme==="dark"?e.colors.dark[0]:e.colors.gray[7],height:mt({size:o,sizes:TE}),paddingLeft:`calc(${mt({size:o,sizes:e.spacing})} / 1.5)`,paddingRight:t||r?mt({size:o,sizes:e.spacing}):0,fontWeight:500,fontSize:mt({size:o,sizes:dZ}),borderRadius:mt({size:n,sizes:e.radius}),cursor:t?"not-allowed":"default",userSelect:"none",maxWidth:`calc(100% - ${Re(10)})`},defaultValueRemove:{color:e.colorScheme==="dark"?e.colors.dark[0]:e.colors.gray[7],marginLeft:`calc(${mt({size:o,sizes:e.spacing})} / 6)`},defaultValueLabel:{display:"block",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}}));const pZ=fZ;var mZ=Object.defineProperty,Gm=Object.getOwnPropertySymbols,NE=Object.prototype.hasOwnProperty,$E=Object.prototype.propertyIsEnumerable,Dk=(e,t,n)=>t in e?mZ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,hZ=(e,t)=>{for(var n in t||(t={}))NE.call(t,n)&&Dk(e,n,t[n]);if(Gm)for(var n of Gm(t))$E.call(t,n)&&Dk(e,n,t[n]);return e},gZ=(e,t)=>{var n={};for(var r in e)NE.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Gm)for(var r of Gm(e))t.indexOf(r)<0&&$E.call(e,r)&&(n[r]=e[r]);return n};const vZ={xs:16,sm:22,md:24,lg:26,xl:30};function LE(e){var t=e,{label:n,classNames:r,styles:o,className:s,onRemove:i,disabled:l,readOnly:u,size:p,radius:m="sm",variant:h,unstyled:g}=t,x=gZ(t,["label","classNames","styles","className","onRemove","disabled","readOnly","size","radius","variant","unstyled"]);const{classes:y,cx:b}=pZ({disabled:l,readOnly:u,radius:m},{name:"MultiSelect",classNames:r,styles:o,unstyled:g,size:p,variant:h});return H.createElement("div",hZ({className:b(y.defaultValue,s)},x),H.createElement("span",{className:y.defaultValueLabel},n),!l&&!u&&H.createElement(x6,{"aria-hidden":!0,onMouseDown:i,size:vZ[p],radius:2,color:"blue",variant:"transparent",iconSize:"70%",className:y.defaultValueRemove,tabIndex:-1,unstyled:g}))}LE.displayName="@mantine/core/MultiSelect/DefaultValue";function xZ({data:e,searchable:t,limit:n,searchValue:r,filter:o,value:s,disableSelectedItemFiltering:i}){if(!t&&s.length===0)return e;if(!t){const u=[];for(let p=0;pm===e[p].value&&!e[p].disabled))&&u.push(e[p]);return u}const l=[];for(let u=0;up===e[u].value&&!e[u].disabled),e[u])&&l.push(e[u]),!(l.length>=n));u+=1);return l}var bZ=Object.defineProperty,Km=Object.getOwnPropertySymbols,zE=Object.prototype.hasOwnProperty,FE=Object.prototype.propertyIsEnumerable,Ak=(e,t,n)=>t in e?bZ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Tk=(e,t)=>{for(var n in t||(t={}))zE.call(t,n)&&Ak(e,n,t[n]);if(Km)for(var n of Km(t))FE.call(t,n)&&Ak(e,n,t[n]);return e},yZ=(e,t)=>{var n={};for(var r in e)zE.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Km)for(var r of Km(e))t.indexOf(r)<0&&FE.call(e,r)&&(n[r]=e[r]);return n};const CZ={xs:Re(14),sm:Re(18),md:Re(20),lg:Re(24),xl:Re(28)};function wZ(e){var t=e,{size:n,error:r,style:o}=t,s=yZ(t,["size","error","style"]);const i=xa(),l=mt({size:n,sizes:CZ});return H.createElement("svg",Tk({viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:Tk({color:r?i.colors.red[6]:i.colors.gray[6],width:l,height:l},o),"data-chevron":!0},s),H.createElement("path",{d:"M4.93179 5.43179C4.75605 5.60753 4.75605 5.89245 4.93179 6.06819C5.10753 6.24392 5.39245 6.24392 5.56819 6.06819L7.49999 4.13638L9.43179 6.06819C9.60753 6.24392 9.89245 6.24392 10.0682 6.06819C10.2439 5.89245 10.2439 5.60753 10.0682 5.43179L7.81819 3.18179C7.73379 3.0974 7.61933 3.04999 7.49999 3.04999C7.38064 3.04999 7.26618 3.0974 7.18179 3.18179L4.93179 5.43179ZM10.0682 9.56819C10.2439 9.39245 10.2439 9.10753 10.0682 8.93179C9.89245 8.75606 9.60753 8.75606 9.43179 8.93179L7.49999 10.8636L5.56819 8.93179C5.39245 8.75606 5.10753 8.75606 4.93179 8.93179C4.75605 9.10753 4.75605 9.39245 4.93179 9.56819L7.18179 11.8182C7.35753 11.9939 7.64245 11.9939 7.81819 11.8182L10.0682 9.56819Z",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd"}))}var SZ=Object.defineProperty,kZ=Object.defineProperties,jZ=Object.getOwnPropertyDescriptors,Nk=Object.getOwnPropertySymbols,_Z=Object.prototype.hasOwnProperty,IZ=Object.prototype.propertyIsEnumerable,$k=(e,t,n)=>t in e?SZ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,PZ=(e,t)=>{for(var n in t||(t={}))_Z.call(t,n)&&$k(e,n,t[n]);if(Nk)for(var n of Nk(t))IZ.call(t,n)&&$k(e,n,t[n]);return e},EZ=(e,t)=>kZ(e,jZ(t));function BE({shouldClear:e,clearButtonProps:t,onClear:n,size:r,error:o}){return e?H.createElement(x6,EZ(PZ({},t),{variant:"transparent",onClick:n,size:r,onMouseDown:s=>s.preventDefault()})):H.createElement(wZ,{error:o,size:r})}BE.displayName="@mantine/core/SelectRightSection";var MZ=Object.defineProperty,OZ=Object.defineProperties,RZ=Object.getOwnPropertyDescriptors,qm=Object.getOwnPropertySymbols,HE=Object.prototype.hasOwnProperty,VE=Object.prototype.propertyIsEnumerable,Lk=(e,t,n)=>t in e?MZ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ev=(e,t)=>{for(var n in t||(t={}))HE.call(t,n)&&Lk(e,n,t[n]);if(qm)for(var n of qm(t))VE.call(t,n)&&Lk(e,n,t[n]);return e},zk=(e,t)=>OZ(e,RZ(t)),DZ=(e,t)=>{var n={};for(var r in e)HE.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&qm)for(var r of qm(e))t.indexOf(r)<0&&VE.call(e,r)&&(n[r]=e[r]);return n};function WE(e){var t=e,{styles:n,rightSection:r,rightSectionWidth:o,theme:s}=t,i=DZ(t,["styles","rightSection","rightSectionWidth","theme"]);if(r)return{rightSection:r,rightSectionWidth:o,styles:n};const l=typeof n=="function"?n(s):n;return{rightSection:!i.readOnly&&!(i.disabled&&i.shouldClear)&&H.createElement(BE,Ev({},i)),styles:zk(Ev({},l),{rightSection:zk(Ev({},l==null?void 0:l.rightSection),{pointerEvents:i.shouldClear?void 0:"none"})})}}var AZ=Object.defineProperty,TZ=Object.defineProperties,NZ=Object.getOwnPropertyDescriptors,Fk=Object.getOwnPropertySymbols,$Z=Object.prototype.hasOwnProperty,LZ=Object.prototype.propertyIsEnumerable,Bk=(e,t,n)=>t in e?AZ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,zZ=(e,t)=>{for(var n in t||(t={}))$Z.call(t,n)&&Bk(e,n,t[n]);if(Fk)for(var n of Fk(t))LZ.call(t,n)&&Bk(e,n,t[n]);return e},FZ=(e,t)=>TZ(e,NZ(t)),BZ=fr((e,{invalid:t},{size:n})=>({wrapper:{position:"relative","&:has(input:disabled)":{cursor:"not-allowed",pointerEvents:"none","& .mantine-MultiSelect-input":{backgroundColor:e.colorScheme==="dark"?e.colors.dark[6]:e.colors.gray[1],color:e.colors.dark[2],opacity:.6,"&::placeholder":{color:e.colors.dark[2]}},"& .mantine-MultiSelect-defaultValue":{backgroundColor:e.colorScheme==="dark"?e.colors.dark[5]:e.colors.gray[3],color:e.colorScheme==="dark"?e.colors.dark[1]:e.colors.gray[7]}}},values:{minHeight:`calc(${mt({size:n,sizes:mo})} - ${Re(2)})`,display:"flex",alignItems:"center",flexWrap:"wrap",marginLeft:`calc(-${e.spacing.xs} / 2)`,boxSizing:"border-box","&[data-clearable]":{marginRight:mt({size:n,sizes:mo})}},value:{margin:`calc(${e.spacing.xs} / 2 - ${Re(2)}) calc(${e.spacing.xs} / 2)`},searchInput:FZ(zZ({},e.fn.fontStyles()),{flex:1,minWidth:Re(60),backgroundColor:"transparent",border:0,outline:0,fontSize:mt({size:n,sizes:e.fontSizes}),padding:0,marginLeft:`calc(${e.spacing.xs} / 2)`,appearance:"none",color:"inherit",maxHeight:mt({size:n,sizes:TE}),"&::placeholder":{opacity:1,color:t?e.colors.red[e.fn.primaryShade()]:e.colorScheme==="dark"?e.colors.dark[3]:e.colors.gray[5]},"&:disabled":{cursor:"not-allowed",pointerEvents:"none"}}),searchInputEmpty:{width:"100%"},searchInputInputHidden:{flex:0,width:0,minWidth:0,margin:0,overflow:"hidden"},searchInputPointer:{cursor:"pointer","&:disabled":{cursor:"not-allowed",pointerEvents:"none"}},input:{cursor:"pointer","&:disabled":{cursor:"not-allowed",pointerEvents:"none"}}}));const HZ=BZ;var VZ=Object.defineProperty,WZ=Object.defineProperties,UZ=Object.getOwnPropertyDescriptors,Xm=Object.getOwnPropertySymbols,UE=Object.prototype.hasOwnProperty,GE=Object.prototype.propertyIsEnumerable,Hk=(e,t,n)=>t in e?VZ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,zl=(e,t)=>{for(var n in t||(t={}))UE.call(t,n)&&Hk(e,n,t[n]);if(Xm)for(var n of Xm(t))GE.call(t,n)&&Hk(e,n,t[n]);return e},Vk=(e,t)=>WZ(e,UZ(t)),GZ=(e,t)=>{var n={};for(var r in e)UE.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Xm)for(var r of Xm(e))t.indexOf(r)<0&&GE.call(e,r)&&(n[r]=e[r]);return n};function KZ(e,t,n){return t?!1:n.label.toLowerCase().trim().includes(e.toLowerCase().trim())}function qZ(e,t){return!!e&&!t.some(n=>n.value.toLowerCase()===e.toLowerCase())}function Wk(e,t){if(!Array.isArray(e))return;if(t.length===0)return[];const n=t.map(r=>typeof r=="object"?r.value:r);return e.filter(r=>n.includes(r))}const XZ={size:"sm",valueComponent:LE,itemComponent:ny,transitionProps:{transition:"fade",duration:0},maxDropdownHeight:220,shadow:"sm",searchable:!1,filter:KZ,limit:1/0,clearSearchOnChange:!0,clearable:!1,clearSearchOnBlur:!1,disabled:!1,initiallyOpened:!1,creatable:!1,shouldCreate:qZ,switchDirectionOnFlip:!1,zIndex:Zb("popover"),selectOnBlur:!1,positionDependencies:[],dropdownPosition:"flip"},KE=d.forwardRef((e,t)=>{const n=Rn("MultiSelect",XZ,e),{className:r,style:o,required:s,label:i,description:l,size:u,error:p,classNames:m,styles:h,wrapperProps:g,value:x,defaultValue:y,data:b,onChange:w,valueComponent:S,itemComponent:j,id:_,transitionProps:E,maxDropdownHeight:I,shadow:M,nothingFound:R,onFocus:D,onBlur:A,searchable:O,placeholder:T,filter:X,limit:B,clearSearchOnChange:V,clearable:U,clearSearchOnBlur:N,variant:$,onSearchChange:q,searchValue:F,disabled:Q,initiallyOpened:Y,radius:se,icon:ae,rightSection:re,rightSectionWidth:G,creatable:K,getCreateLabel:ee,shouldCreate:le,onCreate:J,sx:ie,dropdownComponent:de,onDropdownClose:ge,onDropdownOpen:Ce,maxSelectedValues:he,withinPortal:fe,portalProps:Oe,switchDirectionOnFlip:_e,zIndex:Ne,selectOnBlur:nt,name:$e,dropdownPosition:Pt,errorProps:Ze,labelProps:ot,descriptionProps:ye,form:De,positionDependencies:ut,onKeyDown:bt,unstyled:be,inputContainer:Je,inputWrapperOrder:lt,readOnly:ft,withAsterisk:Me,clearButtonProps:Le,hoverOnSearchChange:Ut,disableSelectedItemFiltering:Se}=n,Be=GZ(n,["className","style","required","label","description","size","error","classNames","styles","wrapperProps","value","defaultValue","data","onChange","valueComponent","itemComponent","id","transitionProps","maxDropdownHeight","shadow","nothingFound","onFocus","onBlur","searchable","placeholder","filter","limit","clearSearchOnChange","clearable","clearSearchOnBlur","variant","onSearchChange","searchValue","disabled","initiallyOpened","radius","icon","rightSection","rightSectionWidth","creatable","getCreateLabel","shouldCreate","onCreate","sx","dropdownComponent","onDropdownClose","onDropdownOpen","maxSelectedValues","withinPortal","portalProps","switchDirectionOnFlip","zIndex","selectOnBlur","name","dropdownPosition","errorProps","labelProps","descriptionProps","form","positionDependencies","onKeyDown","unstyled","inputContainer","inputWrapperOrder","readOnly","withAsterisk","clearButtonProps","hoverOnSearchChange","disableSelectedItemFiltering"]),{classes:ze,cx:Ge,theme:pt}=HZ({invalid:!!p},{name:"MultiSelect",classNames:m,styles:h,unstyled:be,size:u,variant:$}),{systemStyles:Pn,rest:Dt}=eg(Be),At=d.useRef(),pr=d.useRef({}),Ln=ey(_),[kn,gn]=d.useState(Y),[an,kr]=d.useState(-1),[Mo,mr]=d.useState("column"),[hr,Ns]=od({value:F,defaultValue:"",finalValue:void 0,onChange:q}),[$s,wa]=d.useState(!1),{scrollIntoView:Sa,targetRef:ml,scrollableRef:ka}=BP({duration:0,offset:5,cancelable:!1,isList:!0}),hl=K&&typeof ee=="function";let Qe=null;const Gt=b.map(rt=>typeof rt=="string"?{label:rt,value:rt}:rt),zn=MP({data:Gt}),[St,ja]=od({value:Wk(x,b),defaultValue:Wk(y,b),finalValue:[],onChange:w}),Wr=d.useRef(!!he&&he{if(!ft){const Mt=St.filter(kt=>kt!==rt);ja(Mt),he&&Mt.length{Ns(rt.currentTarget.value),!Q&&!Wr.current&&O&&gn(!0)},Fg=rt=>{typeof D=="function"&&D(rt),!Q&&!Wr.current&&O&&gn(!0)},Fn=xZ({data:zn,searchable:O,searchValue:hr,limit:B,filter:X,value:St,disableSelectedItemFiltering:Se});hl&&le(hr,zn)&&(Qe=ee(hr),Fn.push({label:hr,value:hr,creatable:!0}));const Ls=Math.min(an,Fn.length-1),tf=(rt,Mt,kt)=>{let Ot=rt;for(;kt(Ot);)if(Ot=Mt(Ot),!Fn[Ot].disabled)return Ot;return rt};Uo(()=>{kr(Ut&&hr?0:-1)},[hr,Ut]),Uo(()=>{!Q&&St.length>b.length&&gn(!1),he&&St.length=he&&(Wr.current=!0,gn(!1))},[St]);const gl=rt=>{if(!ft)if(V&&Ns(""),St.includes(rt.value))ef(rt.value);else{if(rt.creatable&&typeof J=="function"){const Mt=J(rt.value);typeof Mt<"u"&&Mt!==null&&ja(typeof Mt=="string"?[...St,Mt]:[...St,Mt.value])}else ja([...St,rt.value]);St.length===he-1&&(Wr.current=!0,gn(!1)),Fn.length===1&&gn(!1)}},Zc=rt=>{typeof A=="function"&&A(rt),nt&&Fn[Ls]&&kn&&gl(Fn[Ls]),N&&Ns(""),gn(!1)},mi=rt=>{if($s||(bt==null||bt(rt),ft)||rt.key!=="Backspace"&&he&&Wr.current)return;const Mt=Mo==="column",kt=()=>{kr(rr=>{var rn;const Dn=tf(rr,gr=>gr+1,gr=>gr{kr(rr=>{var rn;const Dn=tf(rr,gr=>gr-1,gr=>gr>0);return kn&&(ml.current=pr.current[(rn=Fn[Dn])==null?void 0:rn.value],Sa({alignment:Mt?"start":"end"})),Dn})};switch(rt.key){case"ArrowUp":{rt.preventDefault(),gn(!0),Mt?Ot():kt();break}case"ArrowDown":{rt.preventDefault(),gn(!0),Mt?kt():Ot();break}case"Enter":{rt.preventDefault(),Fn[Ls]&&kn?gl(Fn[Ls]):gn(!0);break}case" ":{O||(rt.preventDefault(),Fn[Ls]&&kn?gl(Fn[Ls]):gn(!0));break}case"Backspace":{St.length>0&&hr.length===0&&(ja(St.slice(0,-1)),gn(!0),he&&(Wr.current=!1));break}case"Home":{if(!O){rt.preventDefault(),kn||gn(!0);const rr=Fn.findIndex(rn=>!rn.disabled);kr(rr),Sa({alignment:Mt?"end":"start"})}break}case"End":{if(!O){rt.preventDefault(),kn||gn(!0);const rr=Fn.map(rn=>!!rn.disabled).lastIndexOf(!1);kr(rr),Sa({alignment:Mt?"end":"start"})}break}case"Escape":gn(!1)}},Jc=St.map(rt=>{let Mt=zn.find(kt=>kt.value===rt&&!kt.disabled);return!Mt&&hl&&(Mt={value:rt,label:rt}),Mt}).filter(rt=>!!rt).map((rt,Mt)=>H.createElement(S,Vk(zl({},rt),{variant:$,disabled:Q,className:ze.value,readOnly:ft,onRemove:kt=>{kt.preventDefault(),kt.stopPropagation(),ef(rt.value)},key:rt.value,size:u,styles:h,classNames:m,radius:se,index:Mt}))),eu=rt=>St.includes(rt),Bg=()=>{var rt;Ns(""),ja([]),(rt=At.current)==null||rt.focus(),he&&(Wr.current=!1)},_a=!ft&&(Fn.length>0?kn:kn&&!!R);return Uo(()=>{const rt=_a?Ce:ge;typeof rt=="function"&&rt()},[_a]),H.createElement(_c.Wrapper,zl(zl({required:s,id:Ln,label:i,error:p,description:l,size:u,className:r,style:o,classNames:m,styles:h,__staticSelector:"MultiSelect",sx:ie,errorProps:Ze,descriptionProps:ye,labelProps:ot,inputContainer:Je,inputWrapperOrder:lt,unstyled:be,withAsterisk:Me,variant:$},Pn),g),H.createElement(Ka,{opened:_a,transitionProps:E,shadow:"sm",withinPortal:fe,portalProps:Oe,__staticSelector:"MultiSelect",onDirectionChange:mr,switchDirectionOnFlip:_e,zIndex:Ne,dropdownPosition:Pt,positionDependencies:[...ut,hr],classNames:m,styles:h,unstyled:be,variant:$},H.createElement(Ka.Target,null,H.createElement("div",{className:ze.wrapper,role:"combobox","aria-haspopup":"listbox","aria-owns":kn&&_a?`${Ln}-items`:null,"aria-controls":Ln,"aria-expanded":kn,onMouseLeave:()=>kr(-1),tabIndex:-1},H.createElement("input",{type:"hidden",name:$e,value:St.join(","),form:De,disabled:Q}),H.createElement(_c,zl({__staticSelector:"MultiSelect",style:{overflow:"hidden"},component:"div",multiline:!0,size:u,variant:$,disabled:Q,error:p,required:s,radius:se,icon:ae,unstyled:be,onMouseDown:rt=>{var Mt;rt.preventDefault(),!Q&&!Wr.current&&gn(!kn),(Mt=At.current)==null||Mt.focus()},classNames:Vk(zl({},m),{input:Ge({[ze.input]:!O},m==null?void 0:m.input)})},WE({theme:pt,rightSection:re,rightSectionWidth:G,styles:h,size:u,shouldClear:U&&St.length>0,onClear:Bg,error:p,disabled:Q,clearButtonProps:Le,readOnly:ft})),H.createElement("div",{className:ze.values,"data-clearable":U||void 0},Jc,H.createElement("input",zl({ref:Bd(t,At),type:"search",id:Ln,className:Ge(ze.searchInput,{[ze.searchInputPointer]:!O,[ze.searchInputInputHidden]:!kn&&St.length>0||!O&&St.length>0,[ze.searchInputEmpty]:St.length===0}),onKeyDown:mi,value:hr,onChange:zg,onFocus:Fg,onBlur:Zc,readOnly:!O||Wr.current||ft,placeholder:St.length===0?T:void 0,disabled:Q,"data-mantine-stop-propagation":kn,autoComplete:"off",onCompositionStart:()=>wa(!0),onCompositionEnd:()=>wa(!1)},Dt)))))),H.createElement(Ka.Dropdown,{component:de||og,maxHeight:I,direction:Mo,id:Ln,innerRef:ka,__staticSelector:"MultiSelect",classNames:m,styles:h},H.createElement(ty,{data:Fn,hovered:Ls,classNames:m,styles:h,uuid:Ln,__staticSelector:"MultiSelect",onItemHover:kr,onItemSelect:gl,itemsRefs:pr,itemComponent:j,size:u,nothingFound:R,isItemSelected:eu,creatable:K&&!!Qe,createLabel:Qe,unstyled:be,variant:$}))))});KE.displayName="@mantine/core/MultiSelect";var QZ=Object.defineProperty,YZ=Object.defineProperties,ZZ=Object.getOwnPropertyDescriptors,Qm=Object.getOwnPropertySymbols,qE=Object.prototype.hasOwnProperty,XE=Object.prototype.propertyIsEnumerable,Uk=(e,t,n)=>t in e?QZ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Mv=(e,t)=>{for(var n in t||(t={}))qE.call(t,n)&&Uk(e,n,t[n]);if(Qm)for(var n of Qm(t))XE.call(t,n)&&Uk(e,n,t[n]);return e},JZ=(e,t)=>YZ(e,ZZ(t)),eJ=(e,t)=>{var n={};for(var r in e)qE.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Qm)for(var r of Qm(e))t.indexOf(r)<0&&XE.call(e,r)&&(n[r]=e[r]);return n};const tJ={type:"text",size:"sm",__staticSelector:"TextInput"},QE=d.forwardRef((e,t)=>{const n=gE("TextInput",tJ,e),{inputProps:r,wrapperProps:o}=n,s=eJ(n,["inputProps","wrapperProps"]);return H.createElement(_c.Wrapper,Mv({},o),H.createElement(_c,JZ(Mv(Mv({},r),s),{ref:t})))});QE.displayName="@mantine/core/TextInput";function nJ({data:e,searchable:t,limit:n,searchValue:r,filter:o,value:s,filterDataOnExactSearchMatch:i}){if(!t)return e;const l=s!=null&&e.find(p=>p.value===s)||null;if(l&&!i&&(l==null?void 0:l.label)===r){if(n){if(n>=e.length)return e;const p=e.indexOf(l),m=p+n,h=m-e.length;return h>0?e.slice(p-h):e.slice(p,m)}return e}const u=[];for(let p=0;p=n));p+=1);return u}var rJ=fr(()=>({input:{"&:not(:disabled)":{cursor:"pointer","&::selection":{backgroundColor:"transparent"}}}}));const oJ=rJ;var sJ=Object.defineProperty,aJ=Object.defineProperties,iJ=Object.getOwnPropertyDescriptors,Ym=Object.getOwnPropertySymbols,YE=Object.prototype.hasOwnProperty,ZE=Object.prototype.propertyIsEnumerable,Gk=(e,t,n)=>t in e?sJ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ju=(e,t)=>{for(var n in t||(t={}))YE.call(t,n)&&Gk(e,n,t[n]);if(Ym)for(var n of Ym(t))ZE.call(t,n)&&Gk(e,n,t[n]);return e},Ov=(e,t)=>aJ(e,iJ(t)),lJ=(e,t)=>{var n={};for(var r in e)YE.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Ym)for(var r of Ym(e))t.indexOf(r)<0&&ZE.call(e,r)&&(n[r]=e[r]);return n};function cJ(e,t){return t.label.toLowerCase().trim().includes(e.toLowerCase().trim())}function uJ(e,t){return!!e&&!t.some(n=>n.label.toLowerCase()===e.toLowerCase())}const dJ={required:!1,size:"sm",shadow:"sm",itemComponent:ny,transitionProps:{transition:"fade",duration:0},initiallyOpened:!1,filter:cJ,maxDropdownHeight:220,searchable:!1,clearable:!1,limit:1/0,disabled:!1,creatable:!1,shouldCreate:uJ,selectOnBlur:!1,switchDirectionOnFlip:!1,filterDataOnExactSearchMatch:!1,zIndex:Zb("popover"),positionDependencies:[],dropdownPosition:"flip"},fy=d.forwardRef((e,t)=>{const n=gE("Select",dJ,e),{inputProps:r,wrapperProps:o,shadow:s,data:i,value:l,defaultValue:u,onChange:p,itemComponent:m,onKeyDown:h,onBlur:g,onFocus:x,transitionProps:y,initiallyOpened:b,unstyled:w,classNames:S,styles:j,filter:_,maxDropdownHeight:E,searchable:I,clearable:M,nothingFound:R,limit:D,disabled:A,onSearchChange:O,searchValue:T,rightSection:X,rightSectionWidth:B,creatable:V,getCreateLabel:U,shouldCreate:N,selectOnBlur:$,onCreate:q,dropdownComponent:F,onDropdownClose:Q,onDropdownOpen:Y,withinPortal:se,portalProps:ae,switchDirectionOnFlip:re,zIndex:G,name:K,dropdownPosition:ee,allowDeselect:le,placeholder:J,filterDataOnExactSearchMatch:ie,form:de,positionDependencies:ge,readOnly:Ce,clearButtonProps:he,hoverOnSearchChange:fe}=n,Oe=lJ(n,["inputProps","wrapperProps","shadow","data","value","defaultValue","onChange","itemComponent","onKeyDown","onBlur","onFocus","transitionProps","initiallyOpened","unstyled","classNames","styles","filter","maxDropdownHeight","searchable","clearable","nothingFound","limit","disabled","onSearchChange","searchValue","rightSection","rightSectionWidth","creatable","getCreateLabel","shouldCreate","selectOnBlur","onCreate","dropdownComponent","onDropdownClose","onDropdownOpen","withinPortal","portalProps","switchDirectionOnFlip","zIndex","name","dropdownPosition","allowDeselect","placeholder","filterDataOnExactSearchMatch","form","positionDependencies","readOnly","clearButtonProps","hoverOnSearchChange"]),{classes:_e,cx:Ne,theme:nt}=oJ(),[$e,Pt]=d.useState(b),[Ze,ot]=d.useState(-1),ye=d.useRef(),De=d.useRef({}),[ut,bt]=d.useState("column"),be=ut==="column",{scrollIntoView:Je,targetRef:lt,scrollableRef:ft}=BP({duration:0,offset:5,cancelable:!1,isList:!0}),Me=le===void 0?M:le,Le=Qe=>{if($e!==Qe){Pt(Qe);const Gt=Qe?Y:Q;typeof Gt=="function"&&Gt()}},Ut=V&&typeof U=="function";let Se=null;const Be=i.map(Qe=>typeof Qe=="string"?{label:Qe,value:Qe}:Qe),ze=MP({data:Be}),[Ge,pt,Pn]=od({value:l,defaultValue:u,finalValue:null,onChange:p}),Dt=ze.find(Qe=>Qe.value===Ge),[At,pr]=od({value:T,defaultValue:(Dt==null?void 0:Dt.label)||"",finalValue:void 0,onChange:O}),Ln=Qe=>{pr(Qe),I&&typeof O=="function"&&O(Qe)},kn=()=>{var Qe;Ce||(pt(null),Pn||Ln(""),(Qe=ye.current)==null||Qe.focus())};d.useEffect(()=>{const Qe=ze.find(Gt=>Gt.value===Ge);Qe?Ln(Qe.label):(!Ut||!Ge)&&Ln("")},[Ge]),d.useEffect(()=>{Dt&&(!I||!$e)&&Ln(Dt.label)},[Dt==null?void 0:Dt.label]);const gn=Qe=>{if(!Ce)if(Me&&(Dt==null?void 0:Dt.value)===Qe.value)pt(null),Le(!1);else{if(Qe.creatable&&typeof q=="function"){const Gt=q(Qe.value);typeof Gt<"u"&&Gt!==null&&pt(typeof Gt=="string"?Gt:Gt.value)}else pt(Qe.value);Pn||Ln(Qe.label),ot(-1),Le(!1),ye.current.focus()}},an=nJ({data:ze,searchable:I,limit:D,searchValue:At,filter:_,filterDataOnExactSearchMatch:ie,value:Ge});Ut&&N(At,an)&&(Se=U(At),an.push({label:At,value:At,creatable:!0}));const kr=(Qe,Gt,zn)=>{let St=Qe;for(;zn(St);)if(St=Gt(St),!an[St].disabled)return St;return Qe};Uo(()=>{ot(fe&&At?0:-1)},[At,fe]);const Mo=Ge?an.findIndex(Qe=>Qe.value===Ge):0,mr=!Ce&&(an.length>0?$e:$e&&!!R),hr=()=>{ot(Qe=>{var Gt;const zn=kr(Qe,St=>St-1,St=>St>0);return lt.current=De.current[(Gt=an[zn])==null?void 0:Gt.value],mr&&Je({alignment:be?"start":"end"}),zn})},Ns=()=>{ot(Qe=>{var Gt;const zn=kr(Qe,St=>St+1,St=>Stwindow.setTimeout(()=>{var Qe;lt.current=De.current[(Qe=an[Mo])==null?void 0:Qe.value],Je({alignment:be?"end":"start"})},50);Uo(()=>{mr&&$s()},[mr]);const wa=Qe=>{switch(typeof h=="function"&&h(Qe),Qe.key){case"ArrowUp":{Qe.preventDefault(),$e?be?hr():Ns():(ot(Mo),Le(!0),$s());break}case"ArrowDown":{Qe.preventDefault(),$e?be?Ns():hr():(ot(Mo),Le(!0),$s());break}case"Home":{if(!I){Qe.preventDefault(),$e||Le(!0);const Gt=an.findIndex(zn=>!zn.disabled);ot(Gt),mr&&Je({alignment:be?"end":"start"})}break}case"End":{if(!I){Qe.preventDefault(),$e||Le(!0);const Gt=an.map(zn=>!!zn.disabled).lastIndexOf(!1);ot(Gt),mr&&Je({alignment:be?"end":"start"})}break}case"Escape":{Qe.preventDefault(),Le(!1),ot(-1);break}case" ":{I||(Qe.preventDefault(),an[Ze]&&$e?gn(an[Ze]):(Le(!0),ot(Mo),$s()));break}case"Enter":I||Qe.preventDefault(),an[Ze]&&$e&&(Qe.preventDefault(),gn(an[Ze]))}},Sa=Qe=>{typeof g=="function"&&g(Qe);const Gt=ze.find(zn=>zn.value===Ge);$&&an[Ze]&&$e&&gn(an[Ze]),Ln((Gt==null?void 0:Gt.label)||""),Le(!1)},ml=Qe=>{typeof x=="function"&&x(Qe),I&&Le(!0)},ka=Qe=>{Ce||(Ln(Qe.currentTarget.value),M&&Qe.currentTarget.value===""&&pt(null),ot(-1),Le(!0))},hl=()=>{Ce||(Le(!$e),Ge&&!$e&&ot(Mo))};return H.createElement(_c.Wrapper,Ov(ju({},o),{__staticSelector:"Select"}),H.createElement(Ka,{opened:mr,transitionProps:y,shadow:s,withinPortal:se,portalProps:ae,__staticSelector:"Select",onDirectionChange:bt,switchDirectionOnFlip:re,zIndex:G,dropdownPosition:ee,positionDependencies:[...ge,At],classNames:S,styles:j,unstyled:w,variant:r.variant},H.createElement(Ka.Target,null,H.createElement("div",{role:"combobox","aria-haspopup":"listbox","aria-owns":mr?`${r.id}-items`:null,"aria-controls":r.id,"aria-expanded":mr,onMouseLeave:()=>ot(-1),tabIndex:-1},H.createElement("input",{type:"hidden",name:K,value:Ge||"",form:de,disabled:A}),H.createElement(_c,ju(Ov(ju(ju({autoComplete:"off",type:"search"},r),Oe),{ref:Bd(t,ye),onKeyDown:wa,__staticSelector:"Select",value:At,placeholder:J,onChange:ka,"aria-autocomplete":"list","aria-controls":mr?`${r.id}-items`:null,"aria-activedescendant":Ze>=0?`${r.id}-${Ze}`:null,onMouseDown:hl,onBlur:Sa,onFocus:ml,readOnly:!I||Ce,disabled:A,"data-mantine-stop-propagation":mr,name:null,classNames:Ov(ju({},S),{input:Ne({[_e.input]:!I},S==null?void 0:S.input)})}),WE({theme:nt,rightSection:X,rightSectionWidth:B,styles:j,size:r.size,shouldClear:M&&!!Dt,onClear:kn,error:o.error,clearButtonProps:he,disabled:A,readOnly:Ce}))))),H.createElement(Ka.Dropdown,{component:F||og,maxHeight:E,direction:ut,id:r.id,innerRef:ft,__staticSelector:"Select",classNames:S,styles:j},H.createElement(ty,{data:an,hovered:Ze,classNames:S,styles:j,isItemSelected:Qe=>Qe===Ge,uuid:r.id,__staticSelector:"Select",onItemHover:ot,onItemSelect:gn,itemsRefs:De,itemComponent:m,size:r.size,nothingFound:R,creatable:Ut&&!!Se,createLabel:Se,"aria-label":o.label,unstyled:w,variant:r.variant}))))});fy.displayName="@mantine/core/Select";const Wd=()=>{const[e,t,n,r,o,s,i,l,u,p,m,h,g,x,y,b,w,S,j,_,E,I,M,R,D,A,O,T,X,B,V,U,N,$,q,F,Q,Y,se,ae,re,G,K,ee,le,J,ie,de,ge,Ce,he,fe,Oe,_e,Ne,nt,$e,Pt,Ze,ot,ye,De,ut,bt,be,Je,lt,ft,Me,Le,Ut,Se,Be,ze,Ge,pt]=Ho("colors",["base.50","base.100","base.150","base.200","base.250","base.300","base.350","base.400","base.450","base.500","base.550","base.600","base.650","base.700","base.750","base.800","base.850","base.900","base.950","accent.50","accent.100","accent.150","accent.200","accent.250","accent.300","accent.350","accent.400","accent.450","accent.500","accent.550","accent.600","accent.650","accent.700","accent.750","accent.800","accent.850","accent.900","accent.950","baseAlpha.50","baseAlpha.100","baseAlpha.150","baseAlpha.200","baseAlpha.250","baseAlpha.300","baseAlpha.350","baseAlpha.400","baseAlpha.450","baseAlpha.500","baseAlpha.550","baseAlpha.600","baseAlpha.650","baseAlpha.700","baseAlpha.750","baseAlpha.800","baseAlpha.850","baseAlpha.900","baseAlpha.950","accentAlpha.50","accentAlpha.100","accentAlpha.150","accentAlpha.200","accentAlpha.250","accentAlpha.300","accentAlpha.350","accentAlpha.400","accentAlpha.450","accentAlpha.500","accentAlpha.550","accentAlpha.600","accentAlpha.650","accentAlpha.700","accentAlpha.750","accentAlpha.800","accentAlpha.850","accentAlpha.900","accentAlpha.950"]);return{base50:e,base100:t,base150:n,base200:r,base250:o,base300:s,base350:i,base400:l,base450:u,base500:p,base550:m,base600:h,base650:g,base700:x,base750:y,base800:b,base850:w,base900:S,base950:j,accent50:_,accent100:E,accent150:I,accent200:M,accent250:R,accent300:D,accent350:A,accent400:O,accent450:T,accent500:X,accent550:B,accent600:V,accent650:U,accent700:N,accent750:$,accent800:q,accent850:F,accent900:Q,accent950:Y,baseAlpha50:se,baseAlpha100:ae,baseAlpha150:re,baseAlpha200:G,baseAlpha250:K,baseAlpha300:ee,baseAlpha350:le,baseAlpha400:J,baseAlpha450:ie,baseAlpha500:de,baseAlpha550:ge,baseAlpha600:Ce,baseAlpha650:he,baseAlpha700:fe,baseAlpha750:Oe,baseAlpha800:_e,baseAlpha850:Ne,baseAlpha900:nt,baseAlpha950:$e,accentAlpha50:Pt,accentAlpha100:Ze,accentAlpha150:ot,accentAlpha200:ye,accentAlpha250:De,accentAlpha300:ut,accentAlpha350:bt,accentAlpha400:be,accentAlpha450:Je,accentAlpha500:lt,accentAlpha550:ft,accentAlpha600:Me,accentAlpha650:Le,accentAlpha700:Ut,accentAlpha750:Se,accentAlpha800:Be,accentAlpha850:ze,accentAlpha900:Ge,accentAlpha950:pt}},Ae=(e,t)=>n=>n==="light"?e:t,JE=()=>{const{base50:e,base100:t,base200:n,base300:r,base400:o,base500:s,base600:i,base700:l,base800:u,base900:p,accent200:m,accent300:h,accent400:g,accent500:x,accent600:y}=Wd(),{colorMode:b}=ha(),[w]=Ho("shadows",["dark-lg"]),[S,j,_]=Ho("space",[1,2,6]),[E]=Ho("radii",["base"]),[I]=Ho("lineHeights",["base"]);return d.useCallback(()=>({label:{color:Ae(l,r)(b)},separatorLabel:{color:Ae(s,s)(b),"::after":{borderTopColor:Ae(r,l)(b)}},input:{border:"unset",backgroundColor:Ae(e,p)(b),borderRadius:E,borderStyle:"solid",borderWidth:"2px",borderColor:Ae(n,u)(b),color:Ae(p,t)(b),minHeight:"unset",lineHeight:I,height:"auto",paddingRight:0,paddingLeft:0,paddingInlineStart:j,paddingInlineEnd:_,paddingTop:S,paddingBottom:S,fontWeight:600,"&:hover":{borderColor:Ae(r,i)(b)},"&:focus":{borderColor:Ae(h,y)(b)},"&:is(:focus, :hover)":{borderColor:Ae(o,s)(b)},"&:focus-within":{borderColor:Ae(m,y)(b)},"&[data-disabled]":{backgroundColor:Ae(r,l)(b),color:Ae(i,o)(b),cursor:"not-allowed"}},value:{backgroundColor:Ae(t,p)(b),color:Ae(p,t)(b),button:{color:Ae(p,t)(b)},"&:hover":{backgroundColor:Ae(r,l)(b),cursor:"pointer"}},dropdown:{backgroundColor:Ae(n,u)(b),borderColor:Ae(n,u)(b),boxShadow:w},item:{backgroundColor:Ae(n,u)(b),color:Ae(u,n)(b),padding:6,"&[data-hovered]":{color:Ae(p,t)(b),backgroundColor:Ae(r,l)(b)},"&[data-active]":{backgroundColor:Ae(r,l)(b),"&:hover":{color:Ae(p,t)(b),backgroundColor:Ae(r,l)(b)}},"&[data-selected]":{backgroundColor:Ae(g,y)(b),color:Ae(e,t)(b),fontWeight:600,"&:hover":{backgroundColor:Ae(x,x)(b),color:Ae("white",e)(b)}},"&[data-disabled]":{color:Ae(s,i)(b),cursor:"not-allowed"}},rightSection:{width:32,button:{color:Ae(p,t)(b)}}}),[m,h,g,x,y,t,n,r,o,e,s,i,l,u,p,w,b,I,E,S,j,_])},eM=ke((e,t)=>{const{searchable:n=!0,tooltip:r,inputRef:o,onChange:s,label:i,disabled:l,...u}=e,p=te(),[m,h]=d.useState(""),g=d.useCallback(w=>{w.shiftKey&&p(Nr(!0))},[p]),x=d.useCallback(w=>{w.shiftKey||p(Nr(!1))},[p]),y=d.useCallback(w=>{s&&s(w)},[s]),b=JE();return a.jsx(Ht,{label:r,placement:"top",hasArrow:!0,children:a.jsxs(Kt,{ref:t,isDisabled:l,position:"static","data-testid":`select-${i||e.placeholder}`,children:[i&&a.jsx(wn,{children:i}),a.jsx(fy,{ref:o,disabled:l,searchValue:m,onSearchChange:h,onChange:y,onKeyDown:g,onKeyUp:x,searchable:n,maxDropdownHeight:300,styles:b,...u})]})})});eM.displayName="IAIMantineSearchableSelect";const nn=d.memo(eM),fJ=ce([xe],({changeBoardModal:e})=>{const{isModalOpen:t,imagesToChange:n}=e;return{isModalOpen:t,imagesToChange:n}},je),pJ=()=>{const e=te(),[t,n]=d.useState(),{data:r,isFetching:o}=yd(),{imagesToChange:s,isModalOpen:i}=W(fJ),[l]=JR(),[u]=eD(),{t:p}=Z(),m=d.useMemo(()=>{const y=[{label:p("boards.uncategorized"),value:"none"}];return(r??[]).forEach(b=>y.push({label:b.board_name,value:b.board_id})),y},[r,p]),h=d.useCallback(()=>{e(ew()),e(Bx(!1))},[e]),g=d.useCallback(()=>{!s.length||!t||(t==="none"?u({imageDTOs:s}):l({imageDTOs:s,board_id:t}),n(null),e(ew()))},[l,e,s,u,t]),x=d.useRef(null);return a.jsx(Td,{isOpen:i,onClose:h,leastDestructiveRef:x,isCentered:!0,children:a.jsx(Yo,{children:a.jsxs(Nd,{children:[a.jsx(Qo,{fontSize:"lg",fontWeight:"bold",children:p("boards.changeBoard")}),a.jsx(Zo,{children:a.jsxs(L,{sx:{flexDir:"column",gap:4},children:[a.jsxs(ve,{children:["Moving ",`${s.length}`," image",`${s.length>1?"s":""}`," to board:"]}),a.jsx(nn,{placeholder:p(o?"boards.loading":"boards.selectBoard"),disabled:o,onChange:y=>n(y),value:t,data:m})]})}),a.jsxs(Ss,{children:[a.jsx(at,{ref:x,onClick:h,children:p("boards.cancel")}),a.jsx(at,{colorScheme:"accent",onClick:g,ml:3,children:p("boards.move")})]})]})})})},mJ=d.memo(pJ),tM=e=>{const{label:t,isDisabled:n=!1,width:r="auto",formControlProps:o,formLabelProps:s,tooltip:i,helperText:l,...u}=e;return a.jsx(Ht,{label:i,hasArrow:!0,placement:"top",isDisabled:!i,children:a.jsx(Kt,{isDisabled:n,width:r,alignItems:"center",...o,children:a.jsxs(L,{sx:{flexDir:"column",w:"full"},children:[a.jsxs(L,{sx:{alignItems:"center",w:"full"},children:[t&&a.jsx(wn,{my:1,flexGrow:1,sx:{cursor:n?"not-allowed":"pointer",...s==null?void 0:s.sx,pe:4},...s,children:t}),a.jsx(qb,{...u})]}),l&&a.jsx(u5,{children:a.jsx(ve,{variant:"subtext",children:l})})]})})})};tM.displayName="IAISwitch";const dn=d.memo(tM),hJ=e=>{const{t}=Z(),{imageUsage:n,topMessage:r=t("gallery.currentlyInUse"),bottomMessage:o=t("gallery.featuresWillReset")}=e;return!n||!Xr(n)?null:a.jsxs(a.Fragment,{children:[a.jsx(ve,{children:r}),a.jsxs(Od,{sx:{paddingInlineStart:6},children:[n.isInitialImage&&a.jsx(Qr,{children:t("common.img2img")}),n.isCanvasImage&&a.jsx(Qr,{children:t("common.unifiedCanvas")}),n.isControlNetImage&&a.jsx(Qr,{children:t("common.controlNet")}),n.isIPAdapterImage&&a.jsx(Qr,{children:t("common.ipAdapter")}),n.isNodesImage&&a.jsx(Qr,{children:t("common.nodeEditor")})]}),a.jsx(ve,{children:o})]})},nM=d.memo(hJ),gJ=ce([xe,tD],(e,t)=>{const{system:n,config:r,deleteImageModal:o}=e,{shouldConfirmOnDelete:s}=n,{canRestoreDeletedImagesFromBin:i}=r,{imagesToDelete:l,isModalOpen:u}=o,p=(l??[]).map(({image_name:h})=>rI(e,h)),m={isInitialImage:Xr(p,h=>h.isInitialImage),isCanvasImage:Xr(p,h=>h.isCanvasImage),isNodesImage:Xr(p,h=>h.isNodesImage),isControlNetImage:Xr(p,h=>h.isControlNetImage),isIPAdapterImage:Xr(p,h=>h.isIPAdapterImage)};return{shouldConfirmOnDelete:s,canRestoreDeletedImagesFromBin:i,imagesToDelete:l,imagesUsage:t,isModalOpen:u,imageUsageSummary:m}},je),vJ=()=>{const e=te(),{t}=Z(),{shouldConfirmOnDelete:n,canRestoreDeletedImagesFromBin:r,imagesToDelete:o,imagesUsage:s,isModalOpen:i,imageUsageSummary:l}=W(gJ),u=d.useCallback(g=>e(oI(!g.target.checked)),[e]),p=d.useCallback(()=>{e(tw()),e(nD(!1))},[e]),m=d.useCallback(()=>{!o.length||!s.length||(e(tw()),e(rD({imageDTOs:o,imagesUsage:s})))},[e,o,s]),h=d.useRef(null);return a.jsx(Td,{isOpen:i,onClose:p,leastDestructiveRef:h,isCentered:!0,children:a.jsx(Yo,{children:a.jsxs(Nd,{children:[a.jsx(Qo,{fontSize:"lg",fontWeight:"bold",children:t("gallery.deleteImage")}),a.jsx(Zo,{children:a.jsxs(L,{direction:"column",gap:3,children:[a.jsx(nM,{imageUsage:l}),a.jsx(Yn,{}),a.jsx(ve,{children:t(r?"gallery.deleteImageBin":"gallery.deleteImagePermanent")}),a.jsx(ve,{children:t("common.areYouSure")}),a.jsx(dn,{label:t("common.dontAskMeAgain"),isChecked:!n,onChange:u})]})}),a.jsxs(Ss,{children:[a.jsx(at,{ref:h,onClick:p,children:"Cancel"}),a.jsx(at,{colorScheme:"error",onClick:m,ml:3,children:"Delete"})]})]})})})},xJ=d.memo(vJ),rM=ke((e,t)=>{const{role:n,tooltip:r="",tooltipProps:o,isChecked:s,...i}=e;return a.jsx(Ht,{label:r,hasArrow:!0,...o,...o!=null&&o.placement?{placement:o.placement}:{placement:"top"},children:a.jsx(ys,{ref:t,role:n,colorScheme:s?"accent":"base","data-testid":r,...i})})});rM.displayName="IAIIconButton";const Fe=d.memo(rM);var oM={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},Kk=H.createContext&&H.createContext(oM),qa=globalThis&&globalThis.__assign||function(){return qa=Object.assign||function(e){for(var t,n=1,r=arguments.length;n{const t=W(i=>i.config.disabledTabs),n=W(i=>i.config.disabledFeatures),r=W(i=>i.config.disabledSDFeatures),o=d.useMemo(()=>n.includes(e)||r.includes(e)||t.includes(e),[n,r,t,e]),s=d.useMemo(()=>!(n.includes(e)||r.includes(e)||t.includes(e)),[n,r,t,e]);return{isFeatureDisabled:o,isFeatureEnabled:s}};function aee(e){const{title:t,hotkey:n,description:r}=e;return a.jsxs(Ja,{sx:{gridTemplateColumns:"auto max-content",justifyContent:"space-between",alignItems:"center"},children:[a.jsxs(Ja,{children:[a.jsx(ve,{fontWeight:600,children:t}),r&&a.jsx(ve,{sx:{fontSize:"sm"},variant:"subtext",children:r})]}),a.jsx(Ie,{sx:{fontSize:"sm",fontWeight:600,px:2,py:1},children:n})]})}function iee({children:e}){const{isOpen:t,onOpen:n,onClose:r}=Lr(),{t:o}=Z(),s=[{title:o("hotkeys.invoke.title"),desc:o("hotkeys.invoke.desc"),hotkey:"Ctrl+Enter"},{title:o("hotkeys.cancel.title"),desc:o("hotkeys.cancel.desc"),hotkey:"Shift+X"},{title:o("hotkeys.focusPrompt.title"),desc:o("hotkeys.focusPrompt.desc"),hotkey:"Alt+A"},{title:o("hotkeys.toggleOptions.title"),desc:o("hotkeys.toggleOptions.desc"),hotkey:"O"},{title:o("hotkeys.toggleGallery.title"),desc:o("hotkeys.toggleGallery.desc"),hotkey:"G"},{title:o("hotkeys.maximizeWorkSpace.title"),desc:o("hotkeys.maximizeWorkSpace.desc"),hotkey:"F"},{title:o("hotkeys.changeTabs.title"),desc:o("hotkeys.changeTabs.desc"),hotkey:"1-5"}],i=[{title:o("hotkeys.setPrompt.title"),desc:o("hotkeys.setPrompt.desc"),hotkey:"P"},{title:o("hotkeys.setSeed.title"),desc:o("hotkeys.setSeed.desc"),hotkey:"S"},{title:o("hotkeys.setParameters.title"),desc:o("hotkeys.setParameters.desc"),hotkey:"A"},{title:o("hotkeys.upscale.title"),desc:o("hotkeys.upscale.desc"),hotkey:"Shift+U"},{title:o("hotkeys.showInfo.title"),desc:o("hotkeys.showInfo.desc"),hotkey:"I"},{title:o("hotkeys.sendToImageToImage.title"),desc:o("hotkeys.sendToImageToImage.desc"),hotkey:"Shift+I"},{title:o("hotkeys.deleteImage.title"),desc:o("hotkeys.deleteImage.desc"),hotkey:"Del"},{title:o("hotkeys.closePanels.title"),desc:o("hotkeys.closePanels.desc"),hotkey:"Esc"}],l=[{title:o("hotkeys.previousImage.title"),desc:o("hotkeys.previousImage.desc"),hotkey:"Arrow Left"},{title:o("hotkeys.nextImage.title"),desc:o("hotkeys.nextImage.desc"),hotkey:"Arrow Right"},{title:o("hotkeys.increaseGalleryThumbSize.title"),desc:o("hotkeys.increaseGalleryThumbSize.desc"),hotkey:"Shift+Up"},{title:o("hotkeys.decreaseGalleryThumbSize.title"),desc:o("hotkeys.decreaseGalleryThumbSize.desc"),hotkey:"Shift+Down"}],u=[{title:o("hotkeys.selectBrush.title"),desc:o("hotkeys.selectBrush.desc"),hotkey:"B"},{title:o("hotkeys.selectEraser.title"),desc:o("hotkeys.selectEraser.desc"),hotkey:"E"},{title:o("hotkeys.decreaseBrushSize.title"),desc:o("hotkeys.decreaseBrushSize.desc"),hotkey:"["},{title:o("hotkeys.increaseBrushSize.title"),desc:o("hotkeys.increaseBrushSize.desc"),hotkey:"]"},{title:o("hotkeys.decreaseBrushOpacity.title"),desc:o("hotkeys.decreaseBrushOpacity.desc"),hotkey:"Shift + ["},{title:o("hotkeys.increaseBrushOpacity.title"),desc:o("hotkeys.increaseBrushOpacity.desc"),hotkey:"Shift + ]"},{title:o("hotkeys.moveTool.title"),desc:o("hotkeys.moveTool.desc"),hotkey:"V"},{title:o("hotkeys.fillBoundingBox.title"),desc:o("hotkeys.fillBoundingBox.desc"),hotkey:"Shift + F"},{title:o("hotkeys.eraseBoundingBox.title"),desc:o("hotkeys.eraseBoundingBox.desc"),hotkey:"Delete / Backspace"},{title:o("hotkeys.colorPicker.title"),desc:o("hotkeys.colorPicker.desc"),hotkey:"C"},{title:o("hotkeys.toggleSnap.title"),desc:o("hotkeys.toggleSnap.desc"),hotkey:"N"},{title:o("hotkeys.quickToggleMove.title"),desc:o("hotkeys.quickToggleMove.desc"),hotkey:"Hold Space"},{title:o("hotkeys.toggleLayer.title"),desc:o("hotkeys.toggleLayer.desc"),hotkey:"Q"},{title:o("hotkeys.clearMask.title"),desc:o("hotkeys.clearMask.desc"),hotkey:"Shift+C"},{title:o("hotkeys.hideMask.title"),desc:o("hotkeys.hideMask.desc"),hotkey:"H"},{title:o("hotkeys.showHideBoundingBox.title"),desc:o("hotkeys.showHideBoundingBox.desc"),hotkey:"Shift+H"},{title:o("hotkeys.mergeVisible.title"),desc:o("hotkeys.mergeVisible.desc"),hotkey:"Shift+M"},{title:o("hotkeys.saveToGallery.title"),desc:o("hotkeys.saveToGallery.desc"),hotkey:"Shift+S"},{title:o("hotkeys.copyToClipboard.title"),desc:o("hotkeys.copyToClipboard.desc"),hotkey:"Ctrl+C"},{title:o("hotkeys.downloadImage.title"),desc:o("hotkeys.downloadImage.desc"),hotkey:"Shift+D"},{title:o("hotkeys.undoStroke.title"),desc:o("hotkeys.undoStroke.desc"),hotkey:"Ctrl+Z"},{title:o("hotkeys.redoStroke.title"),desc:o("hotkeys.redoStroke.desc"),hotkey:"Ctrl+Shift+Z, Ctrl+Y"},{title:o("hotkeys.resetView.title"),desc:o("hotkeys.resetView.desc"),hotkey:"R"},{title:o("hotkeys.previousStagingImage.title"),desc:o("hotkeys.previousStagingImage.desc"),hotkey:"Arrow Left"},{title:o("hotkeys.nextStagingImage.title"),desc:o("hotkeys.nextStagingImage.desc"),hotkey:"Arrow Right"},{title:o("hotkeys.acceptStagingImage.title"),desc:o("hotkeys.acceptStagingImage.desc"),hotkey:"Enter"}],p=[{title:o("hotkeys.addNodes.title"),desc:o("hotkeys.addNodes.desc"),hotkey:"Shift + A / Space"}],m=h=>a.jsx(L,{flexDir:"column",gap:4,children:h.map((g,x)=>a.jsxs(L,{flexDir:"column",px:2,gap:4,children:[a.jsx(aee,{title:g.title,description:g.desc,hotkey:g.hotkey}),x{const{data:t}=oD(),n=d.useRef(null),r=CM(n);return a.jsxs(L,{alignItems:"center",gap:5,ps:1,ref:n,children:[a.jsx(ga,{src:Hx,alt:"invoke-ai-logo",sx:{w:"32px",h:"32px",minW:"32px",minH:"32px",userSelect:"none"}}),a.jsxs(L,{sx:{gap:3,alignItems:"center"},children:[a.jsxs(ve,{sx:{fontSize:"xl",userSelect:"none"},children:["invoke ",a.jsx("strong",{children:"ai"})]}),a.jsx(dr,{children:e&&r&&t&&a.jsx(In.div,{initial:{opacity:0},animate:{opacity:1,transition:{duration:.15}},exit:{opacity:0,transition:{delay:.8}},children:a.jsx(ve,{sx:{fontWeight:600,marginTop:1,color:"base.300",fontSize:14},variant:"subtext",children:t.version})},"statusText")})]})]})},hee=d.memo(mee),wM=ke((e,t)=>{const{tooltip:n,inputRef:r,label:o,disabled:s,required:i,...l}=e,u=JE();return a.jsx(Ht,{label:n,placement:"top",hasArrow:!0,children:a.jsxs(Kt,{ref:t,isRequired:i,isDisabled:s,position:"static","data-testid":`select-${o||e.placeholder}`,children:[a.jsx(wn,{children:o}),a.jsx(fy,{disabled:s,ref:r,styles:u,...l})]})})});wM.displayName="IAIMantineSelect";const On=d.memo(wM),gee={ar:yt.t("common.langArabic",{lng:"ar"}),nl:yt.t("common.langDutch",{lng:"nl"}),en:yt.t("common.langEnglish",{lng:"en"}),fr:yt.t("common.langFrench",{lng:"fr"}),de:yt.t("common.langGerman",{lng:"de"}),he:yt.t("common.langHebrew",{lng:"he"}),it:yt.t("common.langItalian",{lng:"it"}),ja:yt.t("common.langJapanese",{lng:"ja"}),ko:yt.t("common.langKorean",{lng:"ko"}),pl:yt.t("common.langPolish",{lng:"pl"}),pt_BR:yt.t("common.langBrPortuguese",{lng:"pt_BR"}),pt:yt.t("common.langPortuguese",{lng:"pt"}),ru:yt.t("common.langRussian",{lng:"ru"}),zh_CN:yt.t("common.langSimplifiedChinese",{lng:"zh_CN"}),es:yt.t("common.langSpanish",{lng:"es"}),uk:yt.t("common.langUkranian",{lng:"ua"})},vee={CONNECTED:"common.statusConnected",DISCONNECTED:"common.statusDisconnected",PROCESSING:"common.statusProcessing",ERROR:"common.statusError",LOADING_MODEL:"common.statusLoadingModel"},SM=ce(xe,({system:e})=>e.language,je);function Lo(e){const{t}=Z(),{label:n,textProps:r,useBadge:o=!1,badgeLabel:s=t("settings.experimental"),badgeProps:i,...l}=e;return a.jsxs(L,{justifyContent:"space-between",py:1,children:[a.jsxs(L,{gap:2,alignItems:"center",children:[a.jsx(ve,{sx:{fontSize:14,_dark:{color:"base.300"}},...r,children:n}),o&&a.jsx(Ds,{size:"xs",sx:{px:2,color:"base.700",bg:"accent.200",_dark:{bg:"accent.500",color:"base.200"}},...i,children:s})]}),a.jsx(dn,{...l})]})}const xee=e=>a.jsx(L,{sx:{flexDirection:"column",gap:2,p:4,borderRadius:"base",bg:"base.100",_dark:{bg:"base.900"}},children:e.children}),Gl=d.memo(xee);function bee(){const e=te(),{data:t,refetch:n}=sD(),[r,{isLoading:o}]=aD(),s=d.useCallback(()=>{r().unwrap().then(l=>{e(sI()),e(aI()),e(ct({title:`Cleared ${l} intermediates`,status:"info"}))})},[r,e]);d.useEffect(()=>{n()},[n]);const i=t?`Clear ${t} Intermediate${t>1?"s":""}`:"No Intermediates to Clear";return a.jsxs(Gl,{children:[a.jsx(cr,{size:"sm",children:"Clear Intermediates"}),a.jsx(at,{colorScheme:"warning",onClick:s,isLoading:o,isDisabled:!t,children:i}),a.jsx(ve,{fontWeight:"bold",children:"Clearing intermediates will reset your Canvas and ControlNet state."}),a.jsx(ve,{variant:"subtext",children:"Intermediate images are byproducts of generation, different from the result images in the gallery. Clearing intermediates will free disk space."}),a.jsx(ve,{variant:"subtext",children:"Your gallery images will not be deleted."})]})}const yee=()=>{const{base50:e,base100:t,base200:n,base300:r,base400:o,base500:s,base600:i,base700:l,base800:u,base900:p,accent200:m,accent300:h,accent400:g,accent500:x,accent600:y}=Wd(),{colorMode:b}=ha(),[w]=Ho("shadows",["dark-lg"]);return d.useCallback(()=>({label:{color:Ae(l,r)(b)},separatorLabel:{color:Ae(s,s)(b),"::after":{borderTopColor:Ae(r,l)(b)}},searchInput:{":placeholder":{color:Ae(r,l)(b)}},input:{backgroundColor:Ae(e,p)(b),borderWidth:"2px",borderColor:Ae(n,u)(b),color:Ae(p,t)(b),paddingRight:24,fontWeight:600,"&:hover":{borderColor:Ae(r,i)(b)},"&:focus":{borderColor:Ae(h,y)(b)},"&:is(:focus, :hover)":{borderColor:Ae(o,s)(b)},"&:focus-within":{borderColor:Ae(m,y)(b)},"&[data-disabled]":{backgroundColor:Ae(r,l)(b),color:Ae(i,o)(b),cursor:"not-allowed"}},value:{backgroundColor:Ae(n,u)(b),color:Ae(p,t)(b),button:{color:Ae(p,t)(b)},"&:hover":{backgroundColor:Ae(r,l)(b),cursor:"pointer"}},dropdown:{backgroundColor:Ae(n,u)(b),borderColor:Ae(n,u)(b),boxShadow:w},item:{backgroundColor:Ae(n,u)(b),color:Ae(u,n)(b),padding:6,"&[data-hovered]":{color:Ae(p,t)(b),backgroundColor:Ae(r,l)(b)},"&[data-active]":{backgroundColor:Ae(r,l)(b),"&:hover":{color:Ae(p,t)(b),backgroundColor:Ae(r,l)(b)}},"&[data-selected]":{backgroundColor:Ae(g,y)(b),color:Ae(e,t)(b),fontWeight:600,"&:hover":{backgroundColor:Ae(x,x)(b),color:Ae("white",e)(b)}},"&[data-disabled]":{color:Ae(s,i)(b),cursor:"not-allowed"}},rightSection:{width:24,padding:20,button:{color:Ae(p,t)(b)}}}),[m,h,g,x,y,t,n,r,o,e,s,i,l,u,p,w,b])},kM=ke((e,t)=>{const{searchable:n=!0,tooltip:r,inputRef:o,label:s,disabled:i,...l}=e,u=te(),p=d.useCallback(g=>{g.shiftKey&&u(Nr(!0))},[u]),m=d.useCallback(g=>{g.shiftKey||u(Nr(!1))},[u]),h=yee();return a.jsx(Ht,{label:r,placement:"top",hasArrow:!0,isOpen:!0,children:a.jsxs(Kt,{ref:t,isDisabled:i,position:"static",children:[s&&a.jsx(wn,{children:s}),a.jsx(KE,{ref:o,disabled:i,onKeyDown:p,onKeyUp:m,searchable:n,maxDropdownHeight:300,styles:h,...l})]})})});kM.displayName="IAIMantineMultiSelect";const Cee=d.memo(kM),wee=nr(mh,(e,t)=>({value:t,label:e})).sort((e,t)=>e.label.localeCompare(t.label));function See(){const e=te(),{t}=Z(),n=W(o=>o.ui.favoriteSchedulers),r=d.useCallback(o=>{e(iD(o))},[e]);return a.jsx(Cee,{label:t("settings.favoriteSchedulers"),value:n,data:wee,onChange:r,clearable:!0,searchable:!0,maxSelectedValues:99,placeholder:t("settings.favoriteSchedulersPlaceholder")})}const kee=ce([xe],({system:e,ui:t})=>{const{shouldConfirmOnDelete:n,enableImageDebugging:r,consoleLogLevel:o,shouldLogToConsole:s,shouldAntialiasProgressImage:i,shouldUseNSFWChecker:l,shouldUseWatermarker:u,shouldEnableInformationalPopovers:p}=e,{shouldUseSliders:m,shouldShowProgressInViewer:h,shouldAutoChangeDimensions:g}=t;return{shouldConfirmOnDelete:n,enableImageDebugging:r,shouldUseSliders:m,shouldShowProgressInViewer:h,consoleLogLevel:o,shouldLogToConsole:s,shouldAntialiasProgressImage:i,shouldUseNSFWChecker:l,shouldUseWatermarker:u,shouldAutoChangeDimensions:g,shouldEnableInformationalPopovers:p}},{memoizeOptions:{resultEqualityCheck:Ft}}),jee=({children:e,config:t})=>{const n=te(),{t:r}=Z(),[o,s]=d.useState(3),i=(t==null?void 0:t.shouldShowDeveloperSettings)??!0,l=(t==null?void 0:t.shouldShowResetWebUiText)??!0,u=(t==null?void 0:t.shouldShowClearIntermediates)??!0,p=(t==null?void 0:t.shouldShowLocalizationToggle)??!0;d.useEffect(()=>{i||n(nw(!1))},[i,n]);const{isNSFWCheckerAvailable:m,isWatermarkerAvailable:h}=iI(void 0,{selectFromResult:({data:Y})=>({isNSFWCheckerAvailable:(Y==null?void 0:Y.nsfw_methods.includes("nsfw_checker"))??!1,isWatermarkerAvailable:(Y==null?void 0:Y.watermarking_methods.includes("invisible_watermark"))??!1})}),{isOpen:g,onOpen:x,onClose:y}=Lr(),{isOpen:b,onOpen:w,onClose:S}=Lr(),{shouldConfirmOnDelete:j,enableImageDebugging:_,shouldUseSliders:E,shouldShowProgressInViewer:I,consoleLogLevel:M,shouldLogToConsole:R,shouldAntialiasProgressImage:D,shouldUseNSFWChecker:A,shouldUseWatermarker:O,shouldAutoChangeDimensions:T,shouldEnableInformationalPopovers:X}=W(kee),B=d.useCallback(()=>{Object.keys(window.localStorage).forEach(Y=>{(lD.includes(Y)||Y.startsWith(cD))&&localStorage.removeItem(Y)}),y(),w(),setInterval(()=>s(Y=>Y-1),1e3)},[y,w]);d.useEffect(()=>{o<=0&&window.location.reload()},[o]);const V=d.useCallback(Y=>{n(uD(Y))},[n]),U=d.useCallback(Y=>{n(dD(Y))},[n]),N=d.useCallback(Y=>{n(nw(Y.target.checked))},[n]),{colorMode:$,toggleColorMode:q}=ha(),F=Bt("localization").isFeatureEnabled,Q=W(SM);return a.jsxs(a.Fragment,{children:[d.cloneElement(e,{onClick:x}),a.jsxs(Ki,{isOpen:g,onClose:y,size:"2xl",isCentered:!0,children:[a.jsx(Yo,{}),a.jsxs(qi,{children:[a.jsx(Qo,{bg:"none",children:r("common.settingsLabel")}),a.jsx($d,{}),a.jsx(Zo,{children:a.jsxs(L,{sx:{gap:4,flexDirection:"column"},children:[a.jsxs(Gl,{children:[a.jsx(cr,{size:"sm",children:r("settings.general")}),a.jsx(Lo,{label:r("settings.confirmOnDelete"),isChecked:j,onChange:Y=>n(oI(Y.target.checked))})]}),a.jsxs(Gl,{children:[a.jsx(cr,{size:"sm",children:r("settings.generation")}),a.jsx(See,{}),a.jsx(Lo,{label:"Enable NSFW Checker",isDisabled:!m,isChecked:A,onChange:Y=>n(fD(Y.target.checked))}),a.jsx(Lo,{label:"Enable Invisible Watermark",isDisabled:!h,isChecked:O,onChange:Y=>n(pD(Y.target.checked))})]}),a.jsxs(Gl,{children:[a.jsx(cr,{size:"sm",children:r("settings.ui")}),a.jsx(Lo,{label:r("common.darkMode"),isChecked:$==="dark",onChange:q}),a.jsx(Lo,{label:r("settings.useSlidersForAll"),isChecked:E,onChange:Y=>n(mD(Y.target.checked))}),a.jsx(Lo,{label:r("settings.showProgressInViewer"),isChecked:I,onChange:Y=>n(lI(Y.target.checked))}),a.jsx(Lo,{label:r("settings.antialiasProgressImages"),isChecked:D,onChange:Y=>n(hD(Y.target.checked))}),a.jsx(Lo,{label:r("settings.autoChangeDimensions"),isChecked:T,onChange:Y=>n(gD(Y.target.checked))}),p&&a.jsx(On,{disabled:!F,label:r("common.languagePickerLabel"),value:Q,data:Object.entries(gee).map(([Y,se])=>({value:Y,label:se})),onChange:U}),a.jsx(Lo,{label:"Enable informational popovers",isChecked:X,onChange:Y=>n(vD(Y.target.checked))})]}),i&&a.jsxs(Gl,{children:[a.jsx(cr,{size:"sm",children:r("settings.developer")}),a.jsx(Lo,{label:r("settings.shouldLogToConsole"),isChecked:R,onChange:N}),a.jsx(On,{disabled:!R,label:r("settings.consoleLogLevel"),onChange:V,value:M,data:xD.concat()}),a.jsx(Lo,{label:r("settings.enableImageDebugging"),isChecked:_,onChange:Y=>n(bD(Y.target.checked))})]}),u&&a.jsx(bee,{}),a.jsxs(Gl,{children:[a.jsx(cr,{size:"sm",children:r("settings.resetWebUI")}),a.jsx(at,{colorScheme:"error",onClick:B,children:r("settings.resetWebUI")}),l&&a.jsxs(a.Fragment,{children:[a.jsx(ve,{variant:"subtext",children:r("settings.resetWebUIDesc1")}),a.jsx(ve,{variant:"subtext",children:r("settings.resetWebUIDesc2")})]})]})]})}),a.jsx(Ss,{children:a.jsx(at,{onClick:y,children:r("common.close")})})]})]}),a.jsxs(Ki,{closeOnOverlayClick:!1,isOpen:b,onClose:S,isCentered:!0,closeOnEsc:!1,children:[a.jsx(Yo,{backdropFilter:"blur(40px)"}),a.jsxs(qi,{children:[a.jsx(Qo,{}),a.jsx(Zo,{children:a.jsx(L,{justifyContent:"center",children:a.jsx(ve,{fontSize:"lg",children:a.jsxs(ve,{children:[r("settings.resetComplete")," Reloading in ",o,"..."]})})})}),a.jsx(Ss,{})]})]})]})},_ee=d.memo(jee),Iee=ce(xe,({system:e})=>{const{isConnected:t,status:n}=e;return{isConnected:t,statusTranslationKey:vee[n]}},je),Yk={ok:"green.400",working:"yellow.400",error:"red.400"},Zk={ok:"green.600",working:"yellow.500",error:"red.500"},Pee=()=>{const{isConnected:e,statusTranslationKey:t}=W(Iee),{t:n}=Z(),r=d.useRef(null),{data:o}=va(),s=d.useMemo(()=>e?o!=null&&o.queue.in_progress?"working":"ok":"error",[o==null?void 0:o.queue.in_progress,e]),i=CM(r);return a.jsxs(L,{ref:r,h:"full",px:2,alignItems:"center",gap:5,children:[a.jsx(dr,{children:i&&a.jsx(In.div,{initial:{opacity:0},animate:{opacity:1,transition:{duration:.15}},exit:{opacity:0,transition:{delay:.8}},children:a.jsx(ve,{sx:{fontSize:"sm",fontWeight:"600",pb:"1px",userSelect:"none",color:Zk[s],_dark:{color:Yk[s]}},children:n(t)})},"statusText")}),a.jsx(Tn,{as:OJ,sx:{boxSize:"0.5rem",color:Zk[s],_dark:{color:Yk[s]}}})]})},Eee=d.memo(Pee),Mee=()=>{const{t:e}=Z(),t=Bt("bugLink").isFeatureEnabled,n=Bt("discordLink").isFeatureEnabled,r=Bt("githubLink").isFeatureEnabled,o="http://github.com/invoke-ai/InvokeAI",s="https://discord.gg/ZmtBAhwWhy";return a.jsxs(L,{sx:{gap:2,alignItems:"center"},children:[a.jsx(hee,{}),a.jsx(ba,{}),a.jsx(Eee,{}),a.jsxs(Ah,{children:[a.jsx(Th,{as:Fe,variant:"link","aria-label":e("accessibility.menu"),icon:a.jsx(EJ,{}),sx:{boxSize:8}}),a.jsxs(Ui,{motionProps:vc,children:[a.jsxs(td,{title:e("common.communityLabel"),children:[r&&a.jsx(en,{as:"a",href:o,target:"_blank",icon:a.jsx(wJ,{}),children:e("common.githubLabel")}),t&&a.jsx(en,{as:"a",href:`${o}/issues`,target:"_blank",icon:a.jsx(MJ,{}),children:e("common.reportBugLabel")}),n&&a.jsx(en,{as:"a",href:s,target:"_blank",icon:a.jsx(CJ,{}),children:e("common.discordLabel")})]}),a.jsxs(td,{title:e("common.settingsLabel"),children:[a.jsx(iee,{children:a.jsx(en,{as:"button",icon:a.jsx(UJ,{}),children:e("common.hotkeysLabel")})}),a.jsx(_ee,{children:a.jsx(en,{as:"button",icon:a.jsx(cM,{}),children:e("common.settingsLabel")})})]})]})]})]})},Oee=d.memo(Mee);/*! +`)},nV=0,Tl=[];function rV(e){var t=d.useRef([]),n=d.useRef([0,0]),r=d.useRef(),o=d.useState(nV++)[0],s=d.useState(T3)[0],i=d.useRef(e);d.useEffect(function(){i.current=e},[e]),d.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(o));var b=M1([e.lockRef.current],(e.shards||[]).map(OS),!0).filter(Boolean);return b.forEach(function(w){return w.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),b.forEach(function(w){return w.classList.remove("allow-interactivity-".concat(o))})}}},[e.inert,e.lockRef.current,e.shards]);var l=d.useCallback(function(b,w){if("touches"in b&&b.touches.length===2)return!i.current.allowPinchZoom;var S=rp(b),j=n.current,_="deltaX"in b?b.deltaX:j[0]-S[0],E="deltaY"in b?b.deltaY:j[1]-S[1],I,M=b.target,R=Math.abs(_)>Math.abs(E)?"h":"v";if("touches"in b&&R==="h"&&M.type==="range")return!1;var D=ES(R,M);if(!D)return!0;if(D?I=R:(I=R==="v"?"h":"v",D=ES(R,M)),!D)return!1;if(!r.current&&"changedTouches"in b&&(_||E)&&(r.current=I),!I)return!0;var A=r.current||I;return JH(A,w,b,A==="h"?_:E,!0)},[]),u=d.useCallback(function(b){var w=b;if(!(!Tl.length||Tl[Tl.length-1]!==s)){var S="deltaY"in w?MS(w):rp(w),j=t.current.filter(function(I){return I.name===w.type&&I.target===w.target&&eV(I.delta,S)})[0];if(j&&j.should){w.cancelable&&w.preventDefault();return}if(!j){var _=(i.current.shards||[]).map(OS).filter(Boolean).filter(function(I){return I.contains(w.target)}),E=_.length>0?l(w,_[0]):!i.current.noIsolation;E&&w.cancelable&&w.preventDefault()}}},[]),p=d.useCallback(function(b,w,S,j){var _={name:b,delta:w,target:S,should:j};t.current.push(_),setTimeout(function(){t.current=t.current.filter(function(E){return E!==_})},1)},[]),m=d.useCallback(function(b){n.current=rp(b),r.current=void 0},[]),h=d.useCallback(function(b){p(b.type,MS(b),b.target,l(b,e.lockRef.current))},[]),g=d.useCallback(function(b){p(b.type,rp(b),b.target,l(b,e.lockRef.current))},[]);d.useEffect(function(){return Tl.push(s),e.setCallbacks({onScrollCapture:h,onWheelCapture:h,onTouchMoveCapture:g}),document.addEventListener("wheel",u,Al),document.addEventListener("touchmove",u,Al),document.addEventListener("touchstart",m,Al),function(){Tl=Tl.filter(function(b){return b!==s}),document.removeEventListener("wheel",u,Al),document.removeEventListener("touchmove",u,Al),document.removeEventListener("touchstart",m,Al)}},[]);var x=e.removeScrollBar,y=e.inert;return d.createElement(d.Fragment,null,y?d.createElement(s,{styles:tV(o)}):null,x?d.createElement(GH,{gapMode:e.gapMode}):null)}const oV=oz(A3,rV);var z3=d.forwardRef(function(e,t){return d.createElement(Nh,gs({},e,{ref:t,sideCar:oV}))});z3.classNames=Nh.classNames;const sV=z3;function aV(e){const{autoFocus:t,trapFocus:n,dialogRef:r,initialFocusRef:o,blockScrollOnMount:s,allowPinchZoom:i,finalFocusRef:l,returnFocusOnClose:u,preserveScrollBarGap:p,lockFocusAcrossFrames:m,isOpen:h}=Ki(),[g,x]=HR();d.useEffect(()=>{!g&&x&&setTimeout(x)},[g,x]);const y=R3(r,h);return a.jsx(i3,{autoFocus:t,isDisabled:!n,initialFocusRef:o,finalFocusRef:l,restoreFocus:u,contentRef:r,lockFocusAcrossFrames:m,children:a.jsx(sV,{removeScrollBar:!p,allowPinchZoom:i,enabled:y===1&&s,forwardProps:!0,children:e.children})})}var Xi=je((e,t)=>{const{className:n,children:r,containerProps:o,motionProps:s,...i}=e,{getDialogProps:l,getDialogContainerProps:u}=Ki(),p=l(i,t),m=u(o),h=Ye("chakra-modal__content",n),g=Lc(),x={display:"flex",flexDirection:"column",position:"relative",width:"100%",outline:0,...g.dialog},y={display:"flex",width:"100vw",height:"$100vh",position:"fixed",left:0,top:0,...g.dialogContainer},{motionPreset:b}=Ki();return a.jsx(aV,{children:a.jsx(we.div,{...m,className:"chakra-modal__content-container",tabIndex:-1,__css:y,children:a.jsx(O3,{preset:b,motionProps:s,className:h,...p,__css:x,children:r})})})});Xi.displayName="ModalContent";function Td(e){const{leastDestructiveRef:t,...n}=e;return a.jsx(qi,{...n,initialFocusRef:t})}var Nd=je((e,t)=>a.jsx(Xi,{ref:t,role:"alertdialog",...e})),Ss=je((e,t)=>{const{className:n,...r}=e,o=Ye("chakra-modal__footer",n),i={display:"flex",alignItems:"center",justifyContent:"flex-end",...Lc().footer};return a.jsx(we.footer,{ref:t,...r,__css:i,className:o})});Ss.displayName="ModalFooter";var Qo=je((e,t)=>{const{className:n,...r}=e,{headerId:o,setHeaderMounted:s}=Ki();d.useEffect(()=>(s(!0),()=>s(!1)),[s]);const i=Ye("chakra-modal__header",n),u={flex:0,...Lc().header};return a.jsx(we.header,{ref:t,className:i,id:o,...r,__css:u})});Qo.displayName="ModalHeader";var iV=we(In.div),Yo=je((e,t)=>{const{className:n,transition:r,motionProps:o,...s}=e,i=Ye("chakra-modal__overlay",n),u={pos:"fixed",left:"0",top:"0",w:"100vw",h:"100vh",...Lc().overlay},{motionPreset:p}=Ki(),h=o||(p==="none"?{}:a5);return a.jsx(iV,{...h,__css:u,ref:t,className:i,...s})});Yo.displayName="ModalOverlay";var Zo=je((e,t)=>{const{className:n,...r}=e,{bodyId:o,setBodyMounted:s}=Ki();d.useEffect(()=>(s(!0),()=>s(!1)),[s]);const i=Ye("chakra-modal__body",n),l=Lc();return a.jsx(we.div,{ref:t,className:i,id:o,...r,__css:l.body})});Zo.displayName="ModalBody";var $d=je((e,t)=>{const{onClick:n,className:r,...o}=e,{onClose:s}=Ki(),i=Ye("chakra-modal__close-btn",r),l=Lc();return a.jsx(J_,{ref:t,__css:l.closeButton,className:i,onClick:He(n,u=>{u.stopPropagation(),s()}),...o})});$d.displayName="ModalCloseButton";var lV=e=>a.jsx(Nn,{viewBox:"0 0 24 24",...e,children:a.jsx("path",{fill:"currentColor",d:"M21,5H3C2.621,5,2.275,5.214,2.105,5.553C1.937,5.892,1.973,6.297,2.2,6.6l9,12 c0.188,0.252,0.485,0.4,0.8,0.4s0.611-0.148,0.8-0.4l9-12c0.228-0.303,0.264-0.708,0.095-1.047C21.725,5.214,21.379,5,21,5z"})}),cV=e=>a.jsx(Nn,{viewBox:"0 0 24 24",...e,children:a.jsx("path",{fill:"currentColor",d:"M12.8,5.4c-0.377-0.504-1.223-0.504-1.6,0l-9,12c-0.228,0.303-0.264,0.708-0.095,1.047 C2.275,18.786,2.621,19,3,19h18c0.379,0,0.725-0.214,0.895-0.553c0.169-0.339,0.133-0.744-0.095-1.047L12.8,5.4z"})});function RS(e,t,n,r){d.useEffect(()=>{var o;if(!e.current||!r)return;const s=(o=e.current.ownerDocument.defaultView)!=null?o:window,i=Array.isArray(t)?t:[t],l=new s.MutationObserver(u=>{for(const p of u)p.type==="attributes"&&p.attributeName&&i.includes(p.attributeName)&&n(p)});return l.observe(e.current,{attributes:!0,attributeFilter:i}),()=>l.disconnect()})}function uV(e,t){const n=dn(e);d.useEffect(()=>{let r=null;const o=()=>n();return t!==null&&(r=window.setInterval(o,t)),()=>{r&&window.clearInterval(r)}},[t,n])}var dV=50,DS=300;function fV(e,t){const[n,r]=d.useState(!1),[o,s]=d.useState(null),[i,l]=d.useState(!0),u=d.useRef(null),p=()=>clearTimeout(u.current);uV(()=>{o==="increment"&&e(),o==="decrement"&&t()},n?dV:null);const m=d.useCallback(()=>{i&&e(),u.current=setTimeout(()=>{l(!1),r(!0),s("increment")},DS)},[e,i]),h=d.useCallback(()=>{i&&t(),u.current=setTimeout(()=>{l(!1),r(!0),s("decrement")},DS)},[t,i]),g=d.useCallback(()=>{l(!0),r(!1),p()},[]);return d.useEffect(()=>()=>p(),[]),{up:m,down:h,stop:g,isSpinning:n}}var pV=/^[Ee0-9+\-.]$/;function mV(e){return pV.test(e)}function hV(e,t){if(e.key==null)return!0;const n=e.ctrlKey||e.altKey||e.metaKey;return!(e.key.length===1)||n?!0:t(e.key)}function gV(e={}){const{focusInputOnChange:t=!0,clampValueOnBlur:n=!0,keepWithinRange:r=!0,min:o=Number.MIN_SAFE_INTEGER,max:s=Number.MAX_SAFE_INTEGER,step:i=1,isReadOnly:l,isDisabled:u,isRequired:p,isInvalid:m,pattern:h="[0-9]*(.[0-9]+)?",inputMode:g="decimal",allowMouseWheel:x,id:y,onChange:b,precision:w,name:S,"aria-describedby":j,"aria-label":_,"aria-labelledby":E,onFocus:I,onBlur:M,onInvalid:R,getAriaValueText:D,isValidCharacter:A,format:O,parse:T,...X}=e,B=dn(I),V=dn(M),U=dn(R),N=dn(A??mV),$=dn(D),q=LL(e),{update:F,increment:Q,decrement:Y}=q,[se,ae]=d.useState(!1),re=!(l||u),G=d.useRef(null),K=d.useRef(null),ee=d.useRef(null),ce=d.useRef(null),J=d.useCallback(be=>be.split("").filter(N).join(""),[N]),ie=d.useCallback(be=>{var Je;return(Je=T==null?void 0:T(be))!=null?Je:be},[T]),de=d.useCallback(be=>{var Je;return((Je=O==null?void 0:O(be))!=null?Je:be).toString()},[O]);pa(()=>{(q.valueAsNumber>s||q.valueAsNumber{if(!G.current)return;if(G.current.value!=q.value){const Je=ie(G.current.value);q.setValue(J(Je))}},[ie,J]);const ge=d.useCallback((be=i)=>{re&&Q(be)},[Q,re,i]),Ce=d.useCallback((be=i)=>{re&&Y(be)},[Y,re,i]),he=fV(ge,Ce);RS(ee,"disabled",he.stop,he.isSpinning),RS(ce,"disabled",he.stop,he.isSpinning);const fe=d.useCallback(be=>{if(be.nativeEvent.isComposing)return;const lt=ie(be.currentTarget.value);F(J(lt)),K.current={start:be.currentTarget.selectionStart,end:be.currentTarget.selectionEnd}},[F,J,ie]),Oe=d.useCallback(be=>{var Je,lt,ft;B==null||B(be),K.current&&(be.target.selectionStart=(lt=K.current.start)!=null?lt:(Je=be.currentTarget.value)==null?void 0:Je.length,be.currentTarget.selectionEnd=(ft=K.current.end)!=null?ft:be.currentTarget.selectionStart)},[B]),_e=d.useCallback(be=>{if(be.nativeEvent.isComposing)return;hV(be,N)||be.preventDefault();const Je=Ne(be)*i,lt=be.key,Me={ArrowUp:()=>ge(Je),ArrowDown:()=>Ce(Je),Home:()=>F(o),End:()=>F(s)}[lt];Me&&(be.preventDefault(),Me(be))},[N,i,ge,Ce,F,o,s]),Ne=be=>{let Je=1;return(be.metaKey||be.ctrlKey)&&(Je=.1),be.shiftKey&&(Je=10),Je},nt=d.useMemo(()=>{const be=$==null?void 0:$(q.value);if(be!=null)return be;const Je=q.value.toString();return Je||void 0},[q.value,$]),$e=d.useCallback(()=>{let be=q.value;if(q.value==="")return;/^[eE]/.test(q.value.toString())?q.setValue(""):(q.valueAsNumbers&&(be=s),q.cast(be))},[q,s,o]),Pt=d.useCallback(()=>{ae(!1),n&&$e()},[n,ae,$e]),Ze=d.useCallback(()=>{t&&requestAnimationFrame(()=>{var be;(be=G.current)==null||be.focus()})},[t]),ot=d.useCallback(be=>{be.preventDefault(),he.up(),Ze()},[Ze,he]),ye=d.useCallback(be=>{be.preventDefault(),he.down(),Ze()},[Ze,he]);Di(()=>G.current,"wheel",be=>{var Je,lt;const Me=((lt=(Je=G.current)==null?void 0:Je.ownerDocument)!=null?lt:document).activeElement===G.current;if(!x||!Me)return;be.preventDefault();const Le=Ne(be)*i,Ut=Math.sign(be.deltaY);Ut===-1?ge(Le):Ut===1&&Ce(Le)},{passive:!1});const De=d.useCallback((be={},Je=null)=>{const lt=u||r&&q.isAtMax;return{...be,ref:It(Je,ee),role:"button",tabIndex:-1,onPointerDown:He(be.onPointerDown,ft=>{ft.button!==0||lt||ot(ft)}),onPointerLeave:He(be.onPointerLeave,he.stop),onPointerUp:He(be.onPointerUp,he.stop),disabled:lt,"aria-disabled":Co(lt)}},[q.isAtMax,r,ot,he.stop,u]),ut=d.useCallback((be={},Je=null)=>{const lt=u||r&&q.isAtMin;return{...be,ref:It(Je,ce),role:"button",tabIndex:-1,onPointerDown:He(be.onPointerDown,ft=>{ft.button!==0||lt||ye(ft)}),onPointerLeave:He(be.onPointerLeave,he.stop),onPointerUp:He(be.onPointerUp,he.stop),disabled:lt,"aria-disabled":Co(lt)}},[q.isAtMin,r,ye,he.stop,u]),bt=d.useCallback((be={},Je=null)=>{var lt,ft,Me,Le;return{name:S,inputMode:g,type:"text",pattern:h,"aria-labelledby":E,"aria-label":_,"aria-describedby":j,id:y,disabled:u,...be,readOnly:(lt=be.readOnly)!=null?lt:l,"aria-readonly":(ft=be.readOnly)!=null?ft:l,"aria-required":(Me=be.required)!=null?Me:p,required:(Le=be.required)!=null?Le:p,ref:It(G,Je),value:de(q.value),role:"spinbutton","aria-valuemin":o,"aria-valuemax":s,"aria-valuenow":Number.isNaN(q.valueAsNumber)?void 0:q.valueAsNumber,"aria-invalid":Co(m??q.isOutOfRange),"aria-valuetext":nt,autoComplete:"off",autoCorrect:"off",onChange:He(be.onChange,fe),onKeyDown:He(be.onKeyDown,_e),onFocus:He(be.onFocus,Oe,()=>ae(!0)),onBlur:He(be.onBlur,V,Pt)}},[S,g,h,E,_,de,j,y,u,p,l,m,q.value,q.valueAsNumber,q.isOutOfRange,o,s,nt,fe,_e,Oe,V,Pt]);return{value:de(q.value),valueAsNumber:q.valueAsNumber,isFocused:se,isDisabled:u,isReadOnly:l,getIncrementButtonProps:De,getDecrementButtonProps:ut,getInputProps:bt,htmlProps:X}}var[vV,$h]=Wt({name:"NumberInputStylesContext",errorMessage:`useNumberInputStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),[xV,Fb]=Wt({name:"NumberInputContext",errorMessage:"useNumberInputContext: `context` is undefined. Seems you forgot to wrap number-input's components within "}),Lh=je(function(t,n){const r=Un("NumberInput",t),o=on(t),s=fb(o),{htmlProps:i,...l}=gV(s),u=d.useMemo(()=>l,[l]);return a.jsx(xV,{value:u,children:a.jsx(vV,{value:r,children:a.jsx(we.div,{...i,ref:n,className:Ye("chakra-numberinput",t.className),__css:{position:"relative",zIndex:0,...r.root}})})})});Lh.displayName="NumberInput";var zh=je(function(t,n){const r=$h();return a.jsx(we.div,{"aria-hidden":!0,ref:n,...t,__css:{display:"flex",flexDirection:"column",position:"absolute",top:"0",insetEnd:"0px",margin:"1px",height:"calc(100% - 2px)",zIndex:1,...r.stepperGroup}})});zh.displayName="NumberInputStepper";var Fh=je(function(t,n){const{getInputProps:r}=Fb(),o=r(t,n),s=$h();return a.jsx(we.input,{...o,className:Ye("chakra-numberinput__field",t.className),__css:{width:"100%",...s.field}})});Fh.displayName="NumberInputField";var F3=we("div",{baseStyle:{display:"flex",justifyContent:"center",alignItems:"center",flex:1,transitionProperty:"common",transitionDuration:"normal",userSelect:"none",cursor:"pointer",lineHeight:"normal"}}),Bh=je(function(t,n){var r;const o=$h(),{getDecrementButtonProps:s}=Fb(),i=s(t,n);return a.jsx(F3,{...i,__css:o.stepper,children:(r=t.children)!=null?r:a.jsx(lV,{})})});Bh.displayName="NumberDecrementStepper";var Hh=je(function(t,n){var r;const{getIncrementButtonProps:o}=Fb(),s=o(t,n),i=$h();return a.jsx(F3,{...s,__css:i.stepper,children:(r=t.children)!=null?r:a.jsx(cV,{})})});Hh.displayName="NumberIncrementStepper";var[bV,nl]=Wt({name:"PopoverContext",errorMessage:"usePopoverContext: `context` is undefined. Seems you forgot to wrap all popover components within ``"}),[yV,Vh]=Wt({name:"PopoverStylesContext",errorMessage:`usePopoverStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `});function Wh(e){const t=d.Children.only(e.children),{getTriggerProps:n}=nl();return d.cloneElement(t,n(t.props,t.ref))}Wh.displayName="PopoverTrigger";var Nl={click:"click",hover:"hover"};function CV(e={}){const{closeOnBlur:t=!0,closeOnEsc:n=!0,initialFocusRef:r,id:o,returnFocusOnClose:s=!0,autoFocus:i=!0,arrowSize:l,arrowShadowColor:u,trigger:p=Nl.click,openDelay:m=200,closeDelay:h=200,isLazy:g,lazyBehavior:x="unmount",computePositionOnMount:y,...b}=e,{isOpen:w,onClose:S,onOpen:j,onToggle:_}=Lb(e),E=d.useRef(null),I=d.useRef(null),M=d.useRef(null),R=d.useRef(!1),D=d.useRef(!1);w&&(D.current=!0);const[A,O]=d.useState(!1),[T,X]=d.useState(!1),B=d.useId(),V=o??B,[U,N,$,q]=["popover-trigger","popover-content","popover-header","popover-body"].map(fe=>`${fe}-${V}`),{referenceRef:F,getArrowProps:Q,getPopperProps:Y,getArrowInnerProps:se,forceUpdate:ae}=$b({...b,enabled:w||!!y}),re=I3({isOpen:w,ref:M});y5({enabled:w,ref:I}),g3(M,{focusRef:I,visible:w,shouldFocus:s&&p===Nl.click}),EF(M,{focusRef:r,visible:w,shouldFocus:i&&p===Nl.click});const G=zb({wasSelected:D.current,enabled:g,mode:x,isSelected:re.present}),K=d.useCallback((fe={},Oe=null)=>{const _e={...fe,style:{...fe.style,transformOrigin:$n.transformOrigin.varRef,[$n.arrowSize.var]:l?`${l}px`:void 0,[$n.arrowShadowColor.var]:u},ref:It(M,Oe),children:G?fe.children:null,id:N,tabIndex:-1,role:"dialog",onKeyDown:He(fe.onKeyDown,Ne=>{n&&Ne.key==="Escape"&&S()}),onBlur:He(fe.onBlur,Ne=>{const nt=AS(Ne),$e=gv(M.current,nt),Pt=gv(I.current,nt);w&&t&&(!$e&&!Pt)&&S()}),"aria-labelledby":A?$:void 0,"aria-describedby":T?q:void 0};return p===Nl.hover&&(_e.role="tooltip",_e.onMouseEnter=He(fe.onMouseEnter,()=>{R.current=!0}),_e.onMouseLeave=He(fe.onMouseLeave,Ne=>{Ne.nativeEvent.relatedTarget!==null&&(R.current=!1,setTimeout(()=>S(),h))})),_e},[G,N,A,$,T,q,p,n,S,w,t,h,u,l]),ee=d.useCallback((fe={},Oe=null)=>Y({...fe,style:{visibility:w?"visible":"hidden",...fe.style}},Oe),[w,Y]),ce=d.useCallback((fe,Oe=null)=>({...fe,ref:It(Oe,E,F)}),[E,F]),J=d.useRef(),ie=d.useRef(),de=d.useCallback(fe=>{E.current==null&&F(fe)},[F]),ge=d.useCallback((fe={},Oe=null)=>{const _e={...fe,ref:It(I,Oe,de),id:U,"aria-haspopup":"dialog","aria-expanded":w,"aria-controls":N};return p===Nl.click&&(_e.onClick=He(fe.onClick,_)),p===Nl.hover&&(_e.onFocus=He(fe.onFocus,()=>{J.current===void 0&&j()}),_e.onBlur=He(fe.onBlur,Ne=>{const nt=AS(Ne),$e=!gv(M.current,nt);w&&t&&$e&&S()}),_e.onKeyDown=He(fe.onKeyDown,Ne=>{Ne.key==="Escape"&&S()}),_e.onMouseEnter=He(fe.onMouseEnter,()=>{R.current=!0,J.current=window.setTimeout(()=>j(),m)}),_e.onMouseLeave=He(fe.onMouseLeave,()=>{R.current=!1,J.current&&(clearTimeout(J.current),J.current=void 0),ie.current=window.setTimeout(()=>{R.current===!1&&S()},h)})),_e},[U,w,N,p,de,_,j,t,S,m,h]);d.useEffect(()=>()=>{J.current&&clearTimeout(J.current),ie.current&&clearTimeout(ie.current)},[]);const Ce=d.useCallback((fe={},Oe=null)=>({...fe,id:$,ref:It(Oe,_e=>{O(!!_e)})}),[$]),he=d.useCallback((fe={},Oe=null)=>({...fe,id:q,ref:It(Oe,_e=>{X(!!_e)})}),[q]);return{forceUpdate:ae,isOpen:w,onAnimationComplete:re.onComplete,onClose:S,getAnchorProps:ce,getArrowProps:Q,getArrowInnerProps:se,getPopoverPositionerProps:ee,getPopoverProps:K,getTriggerProps:ge,getHeaderProps:Ce,getBodyProps:he}}function gv(e,t){return e===t||(e==null?void 0:e.contains(t))}function AS(e){var t;const n=e.currentTarget.ownerDocument.activeElement;return(t=e.relatedTarget)!=null?t:n}function Ld(e){const t=Un("Popover",e),{children:n,...r}=on(e),o=bd(),s=CV({...r,direction:o.direction});return a.jsx(bV,{value:s,children:a.jsx(yV,{value:t,children:zx(n,{isOpen:s.isOpen,onClose:s.onClose,forceUpdate:s.forceUpdate})})})}Ld.displayName="Popover";function B3(e){const t=d.Children.only(e.children),{getAnchorProps:n}=nl();return d.cloneElement(t,n(t.props,t.ref))}B3.displayName="PopoverAnchor";var vv=(e,t)=>t?`${e}.${t}, ${t}`:void 0;function H3(e){var t;const{bg:n,bgColor:r,backgroundColor:o,shadow:s,boxShadow:i,shadowColor:l}=e,{getArrowProps:u,getArrowInnerProps:p}=nl(),m=Vh(),h=(t=n??r)!=null?t:o,g=s??i;return a.jsx(we.div,{...u(),className:"chakra-popover__arrow-positioner",children:a.jsx(we.div,{className:Ye("chakra-popover__arrow",e.className),...p(e),__css:{"--popper-arrow-shadow-color":vv("colors",l),"--popper-arrow-bg":vv("colors",h),"--popper-arrow-shadow":vv("shadows",g),...m.arrow}})})}H3.displayName="PopoverArrow";var Uh=je(function(t,n){const{getBodyProps:r}=nl(),o=Vh();return a.jsx(we.div,{...r(t,n),className:Ye("chakra-popover__body",t.className),__css:o.body})});Uh.displayName="PopoverBody";var V3=je(function(t,n){const{onClose:r}=nl(),o=Vh();return a.jsx(J_,{size:"sm",onClick:r,className:Ye("chakra-popover__close-btn",t.className),__css:o.closeButton,ref:n,...t})});V3.displayName="PopoverCloseButton";function wV(e){if(e)return{enter:{...e.enter,visibility:"visible"},exit:{...e.exit,transitionEnd:{visibility:"hidden"}}}}var SV={exit:{opacity:0,scale:.95,transition:{duration:.1,ease:[.4,0,1,1]}},enter:{scale:1,opacity:1,transition:{duration:.15,ease:[0,0,.2,1]}}},kV=we(In.section),W3=je(function(t,n){const{variants:r=SV,...o}=t,{isOpen:s}=nl();return a.jsx(kV,{ref:n,variants:wV(r),initial:!1,animate:s?"enter":"exit",...o})});W3.displayName="PopoverTransition";var zd=je(function(t,n){const{rootProps:r,motionProps:o,...s}=t,{getPopoverProps:i,getPopoverPositionerProps:l,onAnimationComplete:u}=nl(),p=Vh(),m={position:"relative",display:"flex",flexDirection:"column",...p.content};return a.jsx(we.div,{...l(r),__css:p.popper,className:"chakra-popover__popper",children:a.jsx(W3,{...o,...i(s,n),onAnimationComplete:ph(u,s.onAnimationComplete),className:Ye("chakra-popover__content",t.className),__css:m})})});zd.displayName="PopoverContent";var F1=e=>a.jsx(we.circle,{cx:50,cy:50,r:42,fill:"transparent",...e});F1.displayName="Circle";function jV(e,t,n){return(e-t)*100/(n-t)}var _V=ma({"0%":{strokeDasharray:"1, 400",strokeDashoffset:"0"},"50%":{strokeDasharray:"400, 400",strokeDashoffset:"-100"},"100%":{strokeDasharray:"400, 400",strokeDashoffset:"-260"}}),IV=ma({"0%":{transform:"rotate(0deg)"},"100%":{transform:"rotate(360deg)"}}),PV=ma({"0%":{left:"-40%"},"100%":{left:"100%"}}),EV=ma({from:{backgroundPosition:"1rem 0"},to:{backgroundPosition:"0 0"}});function U3(e){const{value:t=0,min:n,max:r,valueText:o,getValueText:s,isIndeterminate:i,role:l="progressbar"}=e,u=jV(t,n,r);return{bind:{"data-indeterminate":i?"":void 0,"aria-valuemax":r,"aria-valuemin":n,"aria-valuenow":i?void 0:t,"aria-valuetext":(()=>{if(t!=null)return typeof s=="function"?s(t,u):o})(),role:l},percent:u,value:t}}var G3=e=>{const{size:t,isIndeterminate:n,...r}=e;return a.jsx(we.svg,{viewBox:"0 0 100 100",__css:{width:t,height:t,animation:n?`${IV} 2s linear infinite`:void 0},...r})};G3.displayName="Shape";var B1=je((e,t)=>{var n;const{size:r="48px",max:o=100,min:s=0,valueText:i,getValueText:l,value:u,capIsRound:p,children:m,thickness:h="10px",color:g="#0078d4",trackColor:x="#edebe9",isIndeterminate:y,...b}=e,w=U3({min:s,max:o,value:u,valueText:i,getValueText:l,isIndeterminate:y}),S=y?void 0:((n=w.percent)!=null?n:0)*2.64,j=S==null?void 0:`${S} ${264-S}`,_=y?{css:{animation:`${_V} 1.5s linear infinite`}}:{strokeDashoffset:66,strokeDasharray:j,transitionProperty:"stroke-dasharray, stroke",transitionDuration:"0.6s",transitionTimingFunction:"ease"},E={display:"inline-block",position:"relative",verticalAlign:"middle",fontSize:r};return a.jsxs(we.div,{ref:t,className:"chakra-progress",...w.bind,...b,__css:E,children:[a.jsxs(G3,{size:r,isIndeterminate:y,children:[a.jsx(F1,{stroke:x,strokeWidth:h,className:"chakra-progress__track"}),a.jsx(F1,{stroke:g,strokeWidth:h,className:"chakra-progress__indicator",strokeLinecap:p?"round":void 0,opacity:w.value===0&&!y?0:void 0,..._})]}),m]})});B1.displayName="CircularProgress";var[MV,OV]=Wt({name:"ProgressStylesContext",errorMessage:`useProgressStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),RV=je((e,t)=>{const{min:n,max:r,value:o,isIndeterminate:s,role:i,...l}=e,u=U3({value:o,min:n,max:r,isIndeterminate:s,role:i}),m={height:"100%",...OV().filledTrack};return a.jsx(we.div,{ref:t,style:{width:`${u.percent}%`,...l.style},...u.bind,...l,__css:m})}),K3=je((e,t)=>{var n;const{value:r,min:o=0,max:s=100,hasStripe:i,isAnimated:l,children:u,borderRadius:p,isIndeterminate:m,"aria-label":h,"aria-labelledby":g,"aria-valuetext":x,title:y,role:b,...w}=on(e),S=Un("Progress",e),j=p??((n=S.track)==null?void 0:n.borderRadius),_={animation:`${EV} 1s linear infinite`},M={...!m&&i&&l&&_,...m&&{position:"absolute",willChange:"left",minWidth:"50%",animation:`${PV} 1s ease infinite normal none running`}},R={overflow:"hidden",position:"relative",...S.track};return a.jsx(we.div,{ref:t,borderRadius:j,__css:R,...w,children:a.jsxs(MV,{value:S,children:[a.jsx(RV,{"aria-label":h,"aria-labelledby":g,"aria-valuetext":x,min:o,max:s,value:r,isIndeterminate:m,css:M,borderRadius:j,title:y,role:b}),u]})})});K3.displayName="Progress";function DV(e){return e&&a1(e)&&a1(e.target)}function AV(e={}){const{onChange:t,value:n,defaultValue:r,name:o,isDisabled:s,isFocusable:i,isNative:l,...u}=e,[p,m]=d.useState(r||""),h=typeof n<"u",g=h?n:p,x=d.useRef(null),y=d.useCallback(()=>{const I=x.current;if(!I)return;let M="input:not(:disabled):checked";const R=I.querySelector(M);if(R){R.focus();return}M="input:not(:disabled)";const D=I.querySelector(M);D==null||D.focus()},[]),w=`radio-${d.useId()}`,S=o||w,j=d.useCallback(I=>{const M=DV(I)?I.target.value:I;h||m(M),t==null||t(String(M))},[t,h]),_=d.useCallback((I={},M=null)=>({...I,ref:It(M,x),role:"radiogroup"}),[]),E=d.useCallback((I={},M=null)=>({...I,ref:M,name:S,[l?"checked":"isChecked"]:g!=null?I.value===g:void 0,onChange(D){j(D)},"data-radiogroup":!0}),[l,S,j,g]);return{getRootProps:_,getRadioProps:E,name:S,ref:x,focus:y,setValue:m,value:g,onChange:j,isDisabled:s,isFocusable:i,htmlProps:u}}var[TV,q3]=Wt({name:"RadioGroupContext",strict:!1}),cm=je((e,t)=>{const{colorScheme:n,size:r,variant:o,children:s,className:i,isDisabled:l,isFocusable:u,...p}=e,{value:m,onChange:h,getRootProps:g,name:x,htmlProps:y}=AV(p),b=d.useMemo(()=>({name:x,size:r,onChange:h,colorScheme:n,value:m,variant:o,isDisabled:l,isFocusable:u}),[x,r,h,n,m,o,l,u]);return a.jsx(TV,{value:b,children:a.jsx(we.div,{...g(y,t),className:Ye("chakra-radio-group",i),children:s})})});cm.displayName="RadioGroup";var NV={border:"0",clip:"rect(0, 0, 0, 0)",height:"1px",width:"1px",margin:"-1px",padding:"0",overflow:"hidden",whiteSpace:"nowrap",position:"absolute"};function $V(e={}){const{defaultChecked:t,isChecked:n,isFocusable:r,isDisabled:o,isReadOnly:s,isRequired:i,onChange:l,isInvalid:u,name:p,value:m,id:h,"data-radiogroup":g,"aria-describedby":x,...y}=e,b=`radio-${d.useId()}`,w=Pd(),j=!!q3()||!!g;let E=!!w&&!j?w.id:b;E=h??E;const I=o??(w==null?void 0:w.isDisabled),M=s??(w==null?void 0:w.isReadOnly),R=i??(w==null?void 0:w.isRequired),D=u??(w==null?void 0:w.isInvalid),[A,O]=d.useState(!1),[T,X]=d.useState(!1),[B,V]=d.useState(!1),[U,N]=d.useState(!1),[$,q]=d.useState(!!t),F=typeof n<"u",Q=F?n:$;d.useEffect(()=>p5(O),[]);const Y=d.useCallback(de=>{if(M||I){de.preventDefault();return}F||q(de.target.checked),l==null||l(de)},[F,I,M,l]),se=d.useCallback(de=>{de.key===" "&&N(!0)},[N]),ae=d.useCallback(de=>{de.key===" "&&N(!1)},[N]),re=d.useCallback((de={},ge=null)=>({...de,ref:ge,"data-active":dt(U),"data-hover":dt(B),"data-disabled":dt(I),"data-invalid":dt(D),"data-checked":dt(Q),"data-focus":dt(T),"data-focus-visible":dt(T&&A),"data-readonly":dt(M),"aria-hidden":!0,onMouseDown:He(de.onMouseDown,()=>N(!0)),onMouseUp:He(de.onMouseUp,()=>N(!1)),onMouseEnter:He(de.onMouseEnter,()=>V(!0)),onMouseLeave:He(de.onMouseLeave,()=>V(!1))}),[U,B,I,D,Q,T,M,A]),{onFocus:G,onBlur:K}=w??{},ee=d.useCallback((de={},ge=null)=>{const Ce=I&&!r;return{...de,id:E,ref:ge,type:"radio",name:p,value:m,onChange:He(de.onChange,Y),onBlur:He(K,de.onBlur,()=>X(!1)),onFocus:He(G,de.onFocus,()=>X(!0)),onKeyDown:He(de.onKeyDown,se),onKeyUp:He(de.onKeyUp,ae),checked:Q,disabled:Ce,readOnly:M,required:R,"aria-invalid":Co(D),"aria-disabled":Co(Ce),"aria-required":Co(R),"data-readonly":dt(M),"aria-describedby":x,style:NV}},[I,r,E,p,m,Y,K,G,se,ae,Q,M,R,D,x]);return{state:{isInvalid:D,isFocused:T,isChecked:Q,isActive:U,isHovered:B,isDisabled:I,isReadOnly:M,isRequired:R},getCheckboxProps:re,getRadioProps:re,getInputProps:ee,getLabelProps:(de={},ge=null)=>({...de,ref:ge,onMouseDown:He(de.onMouseDown,LV),"data-disabled":dt(I),"data-checked":dt(Q),"data-invalid":dt(D)}),getRootProps:(de,ge=null)=>({...de,ref:ge,"data-disabled":dt(I),"data-checked":dt(Q),"data-invalid":dt(D)}),htmlProps:y}}function LV(e){e.preventDefault(),e.stopPropagation()}function zV(e,t){const n={},r={};for(const[o,s]of Object.entries(e))t.includes(o)?n[o]=s:r[o]=s;return[n,r]}var Ks=je((e,t)=>{var n;const r=q3(),{onChange:o,value:s}=e,i=Un("Radio",{...r,...e}),l=on(e),{spacing:u="0.5rem",children:p,isDisabled:m=r==null?void 0:r.isDisabled,isFocusable:h=r==null?void 0:r.isFocusable,inputProps:g,...x}=l;let y=e.isChecked;(r==null?void 0:r.value)!=null&&s!=null&&(y=r.value===s);let b=o;r!=null&&r.onChange&&s!=null&&(b=ph(r.onChange,o));const w=(n=e==null?void 0:e.name)!=null?n:r==null?void 0:r.name,{getInputProps:S,getCheckboxProps:j,getLabelProps:_,getRootProps:E,htmlProps:I}=$V({...x,isChecked:y,isFocusable:h,isDisabled:m,onChange:b,name:w}),[M,R]=zV(I,eI),D=j(R),A=S(g,t),O=_(),T=Object.assign({},M,E()),X={display:"inline-flex",alignItems:"center",verticalAlign:"top",cursor:"pointer",position:"relative",...i.container},B={display:"inline-flex",alignItems:"center",justifyContent:"center",flexShrink:0,...i.control},V={userSelect:"none",marginStart:u,...i.label};return a.jsxs(we.label,{className:"chakra-radio",...T,__css:X,children:[a.jsx("input",{className:"chakra-radio__input",...A}),a.jsx(we.span,{className:"chakra-radio__control",...D,__css:B}),p&&a.jsx(we.span,{className:"chakra-radio__label",...O,__css:V,children:p})]})});Ks.displayName="Radio";var X3=je(function(t,n){const{children:r,placeholder:o,className:s,...i}=t;return a.jsxs(we.select,{...i,ref:n,className:Ye("chakra-select",s),children:[o&&a.jsx("option",{value:"",children:o}),r]})});X3.displayName="SelectField";function FV(e,t){const n={},r={};for(const[o,s]of Object.entries(e))t.includes(o)?n[o]=s:r[o]=s;return[n,r]}var Q3=je((e,t)=>{var n;const r=Un("Select",e),{rootProps:o,placeholder:s,icon:i,color:l,height:u,h:p,minH:m,minHeight:h,iconColor:g,iconSize:x,...y}=on(e),[b,w]=FV(y,eI),S=db(w),j={width:"100%",height:"fit-content",position:"relative",color:l},_={paddingEnd:"2rem",...r.field,_focus:{zIndex:"unset",...(n=r.field)==null?void 0:n._focus}};return a.jsxs(we.div,{className:"chakra-select__wrapper",__css:j,...b,...o,children:[a.jsx(X3,{ref:t,height:p??u,minH:m??h,placeholder:s,...S,__css:_,children:e.children}),a.jsx(Y3,{"data-disabled":dt(S.disabled),...(g||l)&&{color:g||l},__css:r.icon,...x&&{fontSize:x},children:i})]})});Q3.displayName="Select";var BV=e=>a.jsx("svg",{viewBox:"0 0 24 24",...e,children:a.jsx("path",{fill:"currentColor",d:"M16.59 8.59L12 13.17 7.41 8.59 6 10l6 6 6-6z"})}),HV=we("div",{baseStyle:{position:"absolute",display:"inline-flex",alignItems:"center",justifyContent:"center",pointerEvents:"none",top:"50%",transform:"translateY(-50%)"}}),Y3=e=>{const{children:t=a.jsx(BV,{}),...n}=e,r=d.cloneElement(t,{role:"presentation",className:"chakra-select__icon",focusable:!1,"aria-hidden":!0,style:{width:"1em",height:"1em",color:"currentColor"}});return a.jsx(HV,{...n,className:"chakra-select__icon-wrapper",children:d.isValidElement(t)?r:null})};Y3.displayName="SelectIcon";function VV(){const e=d.useRef(!0);return d.useEffect(()=>{e.current=!1},[]),e.current}function WV(e){const t=d.useRef();return d.useEffect(()=>{t.current=e},[e]),t.current}var UV=we("div",{baseStyle:{boxShadow:"none",backgroundClip:"padding-box",cursor:"default",color:"transparent",pointerEvents:"none",userSelect:"none","&::before, &::after, *":{visibility:"hidden"}}}),H1=tI("skeleton-start-color"),V1=tI("skeleton-end-color"),GV=ma({from:{opacity:0},to:{opacity:1}}),KV=ma({from:{borderColor:H1.reference,background:H1.reference},to:{borderColor:V1.reference,background:V1.reference}}),Gh=je((e,t)=>{const n={...e,fadeDuration:typeof e.fadeDuration=="number"?e.fadeDuration:.4,speed:typeof e.speed=="number"?e.speed:.8},r=oi("Skeleton",n),o=VV(),{startColor:s="",endColor:i="",isLoaded:l,fadeDuration:u,speed:p,className:m,fitContent:h,...g}=on(n),[x,y]=Ho("colors",[s,i]),b=WV(l),w=Ye("chakra-skeleton",m),S={...x&&{[H1.variable]:x},...y&&{[V1.variable]:y}};if(l){const j=o||b?"none":`${GV} ${u}s`;return a.jsx(we.div,{ref:t,className:w,__css:{animation:j},...g})}return a.jsx(UV,{ref:t,className:w,...g,__css:{width:h?"fit-content":void 0,...r,...S,_dark:{...r._dark,...S},animation:`${p}s linear infinite alternate ${KV}`}})});Gh.displayName="Skeleton";var ho=e=>e?"":void 0,uc=e=>e?!0:void 0,ii=(...e)=>e.filter(Boolean).join(" ");function dc(...e){return function(n){e.some(r=>(r==null||r(n),n==null?void 0:n.defaultPrevented))}}function qV(e){return{root:`slider-root-${e}`,getThumb:t=>`slider-thumb-${e}-${t}`,getInput:t=>`slider-input-${e}-${t}`,track:`slider-track-${e}`,innerTrack:`slider-filled-track-${e}`,getMarker:t=>`slider-marker-${e}-${t}`,output:`slider-output-${e}`}}function Ru(e){const{orientation:t,vertical:n,horizontal:r}=e;return t==="vertical"?n:r}var zp={width:0,height:0},op=e=>e||zp;function Z3(e){const{orientation:t,thumbPercents:n,thumbRects:r,isReversed:o}=e,s=b=>{var w;const S=(w=r[b])!=null?w:zp;return{position:"absolute",userSelect:"none",WebkitUserSelect:"none",MozUserSelect:"none",msUserSelect:"none",touchAction:"none",...Ru({orientation:t,vertical:{bottom:`calc(${n[b]}% - ${S.height/2}px)`},horizontal:{left:`calc(${n[b]}% - ${S.width/2}px)`}})}},i=t==="vertical"?r.reduce((b,w)=>op(b).height>op(w).height?b:w,zp):r.reduce((b,w)=>op(b).width>op(w).width?b:w,zp),l={position:"relative",touchAction:"none",WebkitTapHighlightColor:"rgba(0,0,0,0)",userSelect:"none",outline:0,...Ru({orientation:t,vertical:i?{paddingLeft:i.width/2,paddingRight:i.width/2}:{},horizontal:i?{paddingTop:i.height/2,paddingBottom:i.height/2}:{}})},u={position:"absolute",...Ru({orientation:t,vertical:{left:"50%",transform:"translateX(-50%)",height:"100%"},horizontal:{top:"50%",transform:"translateY(-50%)",width:"100%"}})},p=n.length===1,m=[0,o?100-n[0]:n[0]],h=p?m:n;let g=h[0];!p&&o&&(g=100-g);const x=Math.abs(h[h.length-1]-h[0]),y={...u,...Ru({orientation:t,vertical:o?{height:`${x}%`,top:`${g}%`}:{height:`${x}%`,bottom:`${g}%`},horizontal:o?{width:`${x}%`,right:`${g}%`}:{width:`${x}%`,left:`${g}%`}})};return{trackStyle:u,innerTrackStyle:y,rootStyle:l,getThumbStyle:s}}function J3(e){const{isReversed:t,direction:n,orientation:r}=e;return n==="ltr"||r==="vertical"?t:!t}function XV(e,t,n,r){return e.addEventListener(t,n,r),()=>{e.removeEventListener(t,n,r)}}function QV(e){const t=ZV(e);return typeof t.PointerEvent<"u"&&e instanceof t.PointerEvent?e.pointerType==="mouse":e instanceof t.MouseEvent}function eP(e){return!!e.touches}function YV(e){return eP(e)&&e.touches.length>1}function ZV(e){var t;return(t=e.view)!=null?t:window}function JV(e,t="page"){const n=e.touches[0]||e.changedTouches[0];return{x:n[`${t}X`],y:n[`${t}Y`]}}function eW(e,t="page"){return{x:e[`${t}X`],y:e[`${t}Y`]}}function tP(e,t="page"){return eP(e)?JV(e,t):eW(e,t)}function tW(e){return t=>{const n=QV(t);(!n||n&&t.button===0)&&e(t)}}function nW(e,t=!1){function n(o){e(o,{point:tP(o)})}return t?tW(n):n}function Fp(e,t,n,r){return XV(e,t,nW(n,t==="pointerdown"),r)}var rW=Object.defineProperty,oW=(e,t,n)=>t in e?rW(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,$o=(e,t,n)=>(oW(e,typeof t!="symbol"?t+"":t,n),n),sW=class{constructor(e,t,n){$o(this,"history",[]),$o(this,"startEvent",null),$o(this,"lastEvent",null),$o(this,"lastEventInfo",null),$o(this,"handlers",{}),$o(this,"removeListeners",()=>{}),$o(this,"threshold",3),$o(this,"win"),$o(this,"updatePoint",()=>{if(!(this.lastEvent&&this.lastEventInfo))return;const l=xv(this.lastEventInfo,this.history),u=this.startEvent!==null,p=cW(l.offset,{x:0,y:0})>=this.threshold;if(!u&&!p)return;const{timestamp:m}=Qw();this.history.push({...l.point,timestamp:m});const{onStart:h,onMove:g}=this.handlers;u||(h==null||h(this.lastEvent,l),this.startEvent=this.lastEvent),g==null||g(this.lastEvent,l)}),$o(this,"onPointerMove",(l,u)=>{this.lastEvent=l,this.lastEventInfo=u,E$.update(this.updatePoint,!0)}),$o(this,"onPointerUp",(l,u)=>{const p=xv(u,this.history),{onEnd:m,onSessionEnd:h}=this.handlers;h==null||h(l,p),this.end(),!(!m||!this.startEvent)&&(m==null||m(l,p))});var r;if(this.win=(r=e.view)!=null?r:window,YV(e))return;this.handlers=t,n&&(this.threshold=n),e.stopPropagation(),e.preventDefault();const o={point:tP(e)},{timestamp:s}=Qw();this.history=[{...o.point,timestamp:s}];const{onSessionStart:i}=t;i==null||i(e,xv(o,this.history)),this.removeListeners=lW(Fp(this.win,"pointermove",this.onPointerMove),Fp(this.win,"pointerup",this.onPointerUp),Fp(this.win,"pointercancel",this.onPointerUp))}updateHandlers(e){this.handlers=e}end(){var e;(e=this.removeListeners)==null||e.call(this),M$.update(this.updatePoint)}};function TS(e,t){return{x:e.x-t.x,y:e.y-t.y}}function xv(e,t){return{point:e.point,delta:TS(e.point,t[t.length-1]),offset:TS(e.point,t[0]),velocity:iW(t,.1)}}var aW=e=>e*1e3;function iW(e,t){if(e.length<2)return{x:0,y:0};let n=e.length-1,r=null;const o=e[e.length-1];for(;n>=0&&(r=e[n],!(o.timestamp-r.timestamp>aW(t)));)n--;if(!r)return{x:0,y:0};const s=(o.timestamp-r.timestamp)/1e3;if(s===0)return{x:0,y:0};const i={x:(o.x-r.x)/s,y:(o.y-r.y)/s};return i.x===1/0&&(i.x=0),i.y===1/0&&(i.y=0),i}function lW(...e){return t=>e.reduce((n,r)=>r(n),t)}function bv(e,t){return Math.abs(e-t)}function NS(e){return"x"in e&&"y"in e}function cW(e,t){if(typeof e=="number"&&typeof t=="number")return bv(e,t);if(NS(e)&&NS(t)){const n=bv(e.x,t.x),r=bv(e.y,t.y);return Math.sqrt(n**2+r**2)}return 0}function nP(e){const t=d.useRef(null);return t.current=e,t}function rP(e,t){const{onPan:n,onPanStart:r,onPanEnd:o,onPanSessionStart:s,onPanSessionEnd:i,threshold:l}=t,u=!!(n||r||o||s||i),p=d.useRef(null),m=nP({onSessionStart:s,onSessionEnd:i,onStart:r,onMove:n,onEnd(h,g){p.current=null,o==null||o(h,g)}});d.useEffect(()=>{var h;(h=p.current)==null||h.updateHandlers(m.current)}),d.useEffect(()=>{const h=e.current;if(!h||!u)return;function g(x){p.current=new sW(x,m.current,l)}return Fp(h,"pointerdown",g)},[e,u,m,l]),d.useEffect(()=>()=>{var h;(h=p.current)==null||h.end(),p.current=null},[])}function uW(e,t){if(!e){t(void 0);return}t({width:e.offsetWidth,height:e.offsetHeight});const n=e.ownerDocument.defaultView??window,r=new n.ResizeObserver(o=>{if(!Array.isArray(o)||!o.length)return;const[s]=o;let i,l;if("borderBoxSize"in s){const u=s.borderBoxSize,p=Array.isArray(u)?u[0]:u;i=p.inlineSize,l=p.blockSize}else i=e.offsetWidth,l=e.offsetHeight;t({width:i,height:l})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}var dW=globalThis!=null&&globalThis.document?d.useLayoutEffect:d.useEffect;function fW(e,t){var n,r;if(!e||!e.parentElement)return;const o=(r=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?r:window,s=new o.MutationObserver(()=>{t()});return s.observe(e.parentElement,{childList:!0}),()=>{s.disconnect()}}function oP({getNodes:e,observeMutation:t=!0}){const[n,r]=d.useState([]),[o,s]=d.useState(0);return dW(()=>{const i=e(),l=i.map((u,p)=>uW(u,m=>{r(h=>[...h.slice(0,p),m,...h.slice(p+1)])}));if(t){const u=i[0];l.push(fW(u,()=>{s(p=>p+1)}))}return()=>{l.forEach(u=>{u==null||u()})}},[o]),n}function pW(e){return typeof e=="object"&&e!==null&&"current"in e}function mW(e){const[t]=oP({observeMutation:!1,getNodes(){return[pW(e)?e.current:e]}});return t}function hW(e){const{min:t=0,max:n=100,onChange:r,value:o,defaultValue:s,isReversed:i,direction:l="ltr",orientation:u="horizontal",id:p,isDisabled:m,isReadOnly:h,onChangeStart:g,onChangeEnd:x,step:y=1,getAriaValueText:b,"aria-valuetext":w,"aria-label":S,"aria-labelledby":j,name:_,focusThumbOnChange:E=!0,minStepsBetweenThumbs:I=0,...M}=e,R=dn(g),D=dn(x),A=dn(b),O=J3({isReversed:i,direction:l,orientation:u}),[T,X]=_d({value:o,defaultValue:s??[25,75],onChange:r});if(!Array.isArray(T))throw new TypeError(`[range-slider] You passed an invalid value for \`value\` or \`defaultValue\`, expected \`Array\` but got \`${typeof T}\``);const[B,V]=d.useState(!1),[U,N]=d.useState(!1),[$,q]=d.useState(-1),F=!(m||h),Q=d.useRef(T),Y=T.map(ke=>ac(ke,t,n)),se=I*y,ae=gW(Y,t,n,se),re=d.useRef({eventSource:null,value:[],valueBounds:[]});re.current.value=Y,re.current.valueBounds=ae;const G=Y.map(ke=>n-ke+t),ee=(O?G:Y).map(ke=>om(ke,t,n)),ce=u==="vertical",J=d.useRef(null),ie=d.useRef(null),de=oP({getNodes(){const ke=ie.current,Be=ke==null?void 0:ke.querySelectorAll("[role=slider]");return Be?Array.from(Be):[]}}),ge=d.useId(),he=qV(p??ge),fe=d.useCallback(ke=>{var Be,ze;if(!J.current)return;re.current.eventSource="pointer";const Ge=J.current.getBoundingClientRect(),{clientX:pt,clientY:En}=(ze=(Be=ke.touches)==null?void 0:Be[0])!=null?ze:ke,Dt=ce?Ge.bottom-En:pt-Ge.left,At=ce?Ge.height:Ge.width;let pr=Dt/At;return O&&(pr=1-pr),h5(pr,t,n)},[ce,O,n,t]),Oe=(n-t)/10,_e=y||(n-t)/100,Ne=d.useMemo(()=>({setValueAtIndex(ke,Be){if(!F)return;const ze=re.current.valueBounds[ke];Be=parseFloat(P1(Be,ze.min,_e)),Be=ac(Be,ze.min,ze.max);const Ge=[...re.current.value];Ge[ke]=Be,X(Ge)},setActiveIndex:q,stepUp(ke,Be=_e){const ze=re.current.value[ke],Ge=O?ze-Be:ze+Be;Ne.setValueAtIndex(ke,Ge)},stepDown(ke,Be=_e){const ze=re.current.value[ke],Ge=O?ze+Be:ze-Be;Ne.setValueAtIndex(ke,Ge)},reset(){X(Q.current)}}),[_e,O,X,F]),nt=d.useCallback(ke=>{const Be=ke.key,Ge={ArrowRight:()=>Ne.stepUp($),ArrowUp:()=>Ne.stepUp($),ArrowLeft:()=>Ne.stepDown($),ArrowDown:()=>Ne.stepDown($),PageUp:()=>Ne.stepUp($,Oe),PageDown:()=>Ne.stepDown($,Oe),Home:()=>{const{min:pt}=ae[$];Ne.setValueAtIndex($,pt)},End:()=>{const{max:pt}=ae[$];Ne.setValueAtIndex($,pt)}}[Be];Ge&&(ke.preventDefault(),ke.stopPropagation(),Ge(ke),re.current.eventSource="keyboard")},[Ne,$,Oe,ae]),{getThumbStyle:$e,rootStyle:Pt,trackStyle:Ze,innerTrackStyle:ot}=d.useMemo(()=>Z3({isReversed:O,orientation:u,thumbRects:de,thumbPercents:ee}),[O,u,ee,de]),ye=d.useCallback(ke=>{var Be;const ze=ke??$;if(ze!==-1&&E){const Ge=he.getThumb(ze),pt=(Be=ie.current)==null?void 0:Be.ownerDocument.getElementById(Ge);pt&&setTimeout(()=>pt.focus())}},[E,$,he]);pa(()=>{re.current.eventSource==="keyboard"&&(D==null||D(re.current.value))},[Y,D]);const De=ke=>{const Be=fe(ke)||0,ze=re.current.value.map(At=>Math.abs(At-Be)),Ge=Math.min(...ze);let pt=ze.indexOf(Ge);const En=ze.filter(At=>At===Ge);En.length>1&&Be>re.current.value[pt]&&(pt=pt+En.length-1),q(pt),Ne.setValueAtIndex(pt,Be),ye(pt)},ut=ke=>{if($==-1)return;const Be=fe(ke)||0;q($),Ne.setValueAtIndex($,Be),ye($)};rP(ie,{onPanSessionStart(ke){F&&(V(!0),De(ke),R==null||R(re.current.value))},onPanSessionEnd(){F&&(V(!1),D==null||D(re.current.value))},onPan(ke){F&&ut(ke)}});const bt=d.useCallback((ke={},Be=null)=>({...ke,...M,id:he.root,ref:It(Be,ie),tabIndex:-1,"aria-disabled":uc(m),"data-focused":ho(U),style:{...ke.style,...Pt}}),[M,m,U,Pt,he]),be=d.useCallback((ke={},Be=null)=>({...ke,ref:It(Be,J),id:he.track,"data-disabled":ho(m),style:{...ke.style,...Ze}}),[m,Ze,he]),Je=d.useCallback((ke={},Be=null)=>({...ke,ref:Be,id:he.innerTrack,style:{...ke.style,...ot}}),[ot,he]),lt=d.useCallback((ke,Be=null)=>{var ze;const{index:Ge,...pt}=ke,En=Y[Ge];if(En==null)throw new TypeError(`[range-slider > thumb] Cannot find value at index \`${Ge}\`. The \`value\` or \`defaultValue\` length is : ${Y.length}`);const Dt=ae[Ge];return{...pt,ref:Be,role:"slider",tabIndex:F?0:void 0,id:he.getThumb(Ge),"data-active":ho(B&&$===Ge),"aria-valuetext":(ze=A==null?void 0:A(En))!=null?ze:w==null?void 0:w[Ge],"aria-valuemin":Dt.min,"aria-valuemax":Dt.max,"aria-valuenow":En,"aria-orientation":u,"aria-disabled":uc(m),"aria-readonly":uc(h),"aria-label":S==null?void 0:S[Ge],"aria-labelledby":S!=null&&S[Ge]||j==null?void 0:j[Ge],style:{...ke.style,...$e(Ge)},onKeyDown:dc(ke.onKeyDown,nt),onFocus:dc(ke.onFocus,()=>{N(!0),q(Ge)}),onBlur:dc(ke.onBlur,()=>{N(!1),q(-1)})}},[he,Y,ae,F,B,$,A,w,u,m,h,S,j,$e,nt,N]),ft=d.useCallback((ke={},Be=null)=>({...ke,ref:Be,id:he.output,htmlFor:Y.map((ze,Ge)=>he.getThumb(Ge)).join(" "),"aria-live":"off"}),[he,Y]),Me=d.useCallback((ke,Be=null)=>{const{value:ze,...Ge}=ke,pt=!(zen),En=ze>=Y[0]&&ze<=Y[Y.length-1];let Dt=om(ze,t,n);Dt=O?100-Dt:Dt;const At={position:"absolute",pointerEvents:"none",...Ru({orientation:u,vertical:{bottom:`${Dt}%`},horizontal:{left:`${Dt}%`}})};return{...Ge,ref:Be,id:he.getMarker(ke.value),role:"presentation","aria-hidden":!0,"data-disabled":ho(m),"data-invalid":ho(!pt),"data-highlighted":ho(En),style:{...ke.style,...At}}},[m,O,n,t,u,Y,he]),Le=d.useCallback((ke,Be=null)=>{const{index:ze,...Ge}=ke;return{...Ge,ref:Be,id:he.getInput(ze),type:"hidden",value:Y[ze],name:Array.isArray(_)?_[ze]:`${_}-${ze}`}},[_,Y,he]);return{state:{value:Y,isFocused:U,isDragging:B,getThumbPercent:ke=>ee[ke],getThumbMinValue:ke=>ae[ke].min,getThumbMaxValue:ke=>ae[ke].max},actions:Ne,getRootProps:bt,getTrackProps:be,getInnerTrackProps:Je,getThumbProps:lt,getMarkerProps:Me,getInputProps:Le,getOutputProps:ft}}function gW(e,t,n,r){return e.map((o,s)=>{const i=s===0?t:e[s-1]+r,l=s===e.length-1?n:e[s+1]-r;return{min:i,max:l}})}var[vW,Kh]=Wt({name:"SliderContext",errorMessage:"useSliderContext: `context` is undefined. Seems you forgot to wrap all slider components within "}),[xW,qh]=Wt({name:"RangeSliderStylesContext",errorMessage:`useRangeSliderStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),Bb=je(function(t,n){const r={orientation:"horizontal",...t},o=Un("Slider",r),s=on(r),{direction:i}=bd();s.direction=i;const{getRootProps:l,...u}=hW(s),p=d.useMemo(()=>({...u,name:r.name}),[u,r.name]);return a.jsx(vW,{value:p,children:a.jsx(xW,{value:o,children:a.jsx(we.div,{...l({},n),className:"chakra-slider",__css:o.container,children:r.children})})})});Bb.displayName="RangeSlider";var nd=je(function(t,n){const{getThumbProps:r,getInputProps:o,name:s}=Kh(),i=qh(),l=r(t,n);return a.jsxs(we.div,{...l,className:ii("chakra-slider__thumb",t.className),__css:i.thumb,children:[l.children,s&&a.jsx("input",{...o({index:t.index})})]})});nd.displayName="RangeSliderThumb";var Hb=je(function(t,n){const{getTrackProps:r}=Kh(),o=qh(),s=r(t,n);return a.jsx(we.div,{...s,className:ii("chakra-slider__track",t.className),__css:o.track,"data-testid":"chakra-range-slider-track"})});Hb.displayName="RangeSliderTrack";var Vb=je(function(t,n){const{getInnerTrackProps:r}=Kh(),o=qh(),s=r(t,n);return a.jsx(we.div,{...s,className:"chakra-slider__filled-track",__css:o.filledTrack})});Vb.displayName="RangeSliderFilledTrack";var Ti=je(function(t,n){const{getMarkerProps:r}=Kh(),o=qh(),s=r(t,n);return a.jsx(we.div,{...s,className:ii("chakra-slider__marker",t.className),__css:o.mark})});Ti.displayName="RangeSliderMark";function bW(e){var t;const{min:n=0,max:r=100,onChange:o,value:s,defaultValue:i,isReversed:l,direction:u="ltr",orientation:p="horizontal",id:m,isDisabled:h,isReadOnly:g,onChangeStart:x,onChangeEnd:y,step:b=1,getAriaValueText:w,"aria-valuetext":S,"aria-label":j,"aria-labelledby":_,name:E,focusThumbOnChange:I=!0,...M}=e,R=dn(x),D=dn(y),A=dn(w),O=J3({isReversed:l,direction:u,orientation:p}),[T,X]=_d({value:s,defaultValue:i??CW(n,r),onChange:o}),[B,V]=d.useState(!1),[U,N]=d.useState(!1),$=!(h||g),q=(r-n)/10,F=b||(r-n)/100,Q=ac(T,n,r),Y=r-Q+n,ae=om(O?Y:Q,n,r),re=p==="vertical",G=nP({min:n,max:r,step:b,isDisabled:h,value:Q,isInteractive:$,isReversed:O,isVertical:re,eventSource:null,focusThumbOnChange:I,orientation:p}),K=d.useRef(null),ee=d.useRef(null),ce=d.useRef(null),J=d.useId(),ie=m??J,[de,ge]=[`slider-thumb-${ie}`,`slider-track-${ie}`],Ce=d.useCallback(Me=>{var Le,Ut;if(!K.current)return;const ke=G.current;ke.eventSource="pointer";const Be=K.current.getBoundingClientRect(),{clientX:ze,clientY:Ge}=(Ut=(Le=Me.touches)==null?void 0:Le[0])!=null?Ut:Me,pt=re?Be.bottom-Ge:ze-Be.left,En=re?Be.height:Be.width;let Dt=pt/En;O&&(Dt=1-Dt);let At=h5(Dt,ke.min,ke.max);return ke.step&&(At=parseFloat(P1(At,ke.min,ke.step))),At=ac(At,ke.min,ke.max),At},[re,O,G]),he=d.useCallback(Me=>{const Le=G.current;Le.isInteractive&&(Me=parseFloat(P1(Me,Le.min,F)),Me=ac(Me,Le.min,Le.max),X(Me))},[F,X,G]),fe=d.useMemo(()=>({stepUp(Me=F){const Le=O?Q-Me:Q+Me;he(Le)},stepDown(Me=F){const Le=O?Q+Me:Q-Me;he(Le)},reset(){he(i||0)},stepTo(Me){he(Me)}}),[he,O,Q,F,i]),Oe=d.useCallback(Me=>{const Le=G.current,ke={ArrowRight:()=>fe.stepUp(),ArrowUp:()=>fe.stepUp(),ArrowLeft:()=>fe.stepDown(),ArrowDown:()=>fe.stepDown(),PageUp:()=>fe.stepUp(q),PageDown:()=>fe.stepDown(q),Home:()=>he(Le.min),End:()=>he(Le.max)}[Me.key];ke&&(Me.preventDefault(),Me.stopPropagation(),ke(Me),Le.eventSource="keyboard")},[fe,he,q,G]),_e=(t=A==null?void 0:A(Q))!=null?t:S,Ne=mW(ee),{getThumbStyle:nt,rootStyle:$e,trackStyle:Pt,innerTrackStyle:Ze}=d.useMemo(()=>{const Me=G.current,Le=Ne??{width:0,height:0};return Z3({isReversed:O,orientation:Me.orientation,thumbRects:[Le],thumbPercents:[ae]})},[O,Ne,ae,G]),ot=d.useCallback(()=>{G.current.focusThumbOnChange&&setTimeout(()=>{var Le;return(Le=ee.current)==null?void 0:Le.focus()})},[G]);pa(()=>{const Me=G.current;ot(),Me.eventSource==="keyboard"&&(D==null||D(Me.value))},[Q,D]);function ye(Me){const Le=Ce(Me);Le!=null&&Le!==G.current.value&&X(Le)}rP(ce,{onPanSessionStart(Me){const Le=G.current;Le.isInteractive&&(V(!0),ot(),ye(Me),R==null||R(Le.value))},onPanSessionEnd(){const Me=G.current;Me.isInteractive&&(V(!1),D==null||D(Me.value))},onPan(Me){G.current.isInteractive&&ye(Me)}});const De=d.useCallback((Me={},Le=null)=>({...Me,...M,ref:It(Le,ce),tabIndex:-1,"aria-disabled":uc(h),"data-focused":ho(U),style:{...Me.style,...$e}}),[M,h,U,$e]),ut=d.useCallback((Me={},Le=null)=>({...Me,ref:It(Le,K),id:ge,"data-disabled":ho(h),style:{...Me.style,...Pt}}),[h,ge,Pt]),bt=d.useCallback((Me={},Le=null)=>({...Me,ref:Le,style:{...Me.style,...Ze}}),[Ze]),be=d.useCallback((Me={},Le=null)=>({...Me,ref:It(Le,ee),role:"slider",tabIndex:$?0:void 0,id:de,"data-active":ho(B),"aria-valuetext":_e,"aria-valuemin":n,"aria-valuemax":r,"aria-valuenow":Q,"aria-orientation":p,"aria-disabled":uc(h),"aria-readonly":uc(g),"aria-label":j,"aria-labelledby":j?void 0:_,style:{...Me.style,...nt(0)},onKeyDown:dc(Me.onKeyDown,Oe),onFocus:dc(Me.onFocus,()=>N(!0)),onBlur:dc(Me.onBlur,()=>N(!1))}),[$,de,B,_e,n,r,Q,p,h,g,j,_,nt,Oe]),Je=d.useCallback((Me,Le=null)=>{const Ut=!(Me.valuer),ke=Q>=Me.value,Be=om(Me.value,n,r),ze={position:"absolute",pointerEvents:"none",...yW({orientation:p,vertical:{bottom:O?`${100-Be}%`:`${Be}%`},horizontal:{left:O?`${100-Be}%`:`${Be}%`}})};return{...Me,ref:Le,role:"presentation","aria-hidden":!0,"data-disabled":ho(h),"data-invalid":ho(!Ut),"data-highlighted":ho(ke),style:{...Me.style,...ze}}},[h,O,r,n,p,Q]),lt=d.useCallback((Me={},Le=null)=>({...Me,ref:Le,type:"hidden",value:Q,name:E}),[E,Q]);return{state:{value:Q,isFocused:U,isDragging:B},actions:fe,getRootProps:De,getTrackProps:ut,getInnerTrackProps:bt,getThumbProps:be,getMarkerProps:Je,getInputProps:lt}}function yW(e){const{orientation:t,vertical:n,horizontal:r}=e;return t==="vertical"?n:r}function CW(e,t){return t"}),[SW,Qh]=Wt({name:"SliderStylesContext",hookName:"useSliderStyles",providerName:""}),Wb=je((e,t)=>{var n;const r={...e,orientation:(n=e==null?void 0:e.orientation)!=null?n:"horizontal"},o=Un("Slider",r),s=on(r),{direction:i}=bd();s.direction=i;const{getInputProps:l,getRootProps:u,...p}=bW(s),m=u(),h=l({},t);return a.jsx(wW,{value:p,children:a.jsx(SW,{value:o,children:a.jsxs(we.div,{...m,className:ii("chakra-slider",r.className),__css:o.container,children:[r.children,a.jsx("input",{...h})]})})})});Wb.displayName="Slider";var Ub=je((e,t)=>{const{getThumbProps:n}=Xh(),r=Qh(),o=n(e,t);return a.jsx(we.div,{...o,className:ii("chakra-slider__thumb",e.className),__css:r.thumb})});Ub.displayName="SliderThumb";var Gb=je((e,t)=>{const{getTrackProps:n}=Xh(),r=Qh(),o=n(e,t);return a.jsx(we.div,{...o,className:ii("chakra-slider__track",e.className),__css:r.track})});Gb.displayName="SliderTrack";var Kb=je((e,t)=>{const{getInnerTrackProps:n}=Xh(),r=Qh(),o=n(e,t);return a.jsx(we.div,{...o,className:ii("chakra-slider__filled-track",e.className),__css:r.filledTrack})});Kb.displayName="SliderFilledTrack";var Ul=je((e,t)=>{const{getMarkerProps:n}=Xh(),r=Qh(),o=n(e,t);return a.jsx(we.div,{...o,className:ii("chakra-slider__marker",e.className),__css:r.mark})});Ul.displayName="SliderMark";var[kW,sP]=Wt({name:"StatStylesContext",errorMessage:`useStatStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),aP=je(function(t,n){const r=Un("Stat",t),o={position:"relative",flex:"1 1 0%",...r.container},{className:s,children:i,...l}=on(t);return a.jsx(kW,{value:r,children:a.jsx(we.div,{ref:n,...l,className:Ye("chakra-stat",s),__css:o,children:a.jsx("dl",{children:i})})})});aP.displayName="Stat";var iP=je(function(t,n){return a.jsx(we.div,{...t,ref:n,role:"group",className:Ye("chakra-stat__group",t.className),__css:{display:"flex",flexWrap:"wrap",justifyContent:"space-around",alignItems:"flex-start"}})});iP.displayName="StatGroup";var lP=je(function(t,n){const r=sP();return a.jsx(we.dt,{ref:n,...t,className:Ye("chakra-stat__label",t.className),__css:r.label})});lP.displayName="StatLabel";var cP=je(function(t,n){const r=sP();return a.jsx(we.dd,{ref:n,...t,className:Ye("chakra-stat__number",t.className),__css:{...r.number,fontFeatureSettings:"pnum",fontVariantNumeric:"proportional-nums"}})});cP.displayName="StatNumber";var qb=je(function(t,n){const r=Un("Switch",t),{spacing:o="0.5rem",children:s,...i}=on(t),{getIndicatorProps:l,getInputProps:u,getCheckboxProps:p,getRootProps:m,getLabelProps:h}=m5(i),g=d.useMemo(()=>({display:"inline-block",position:"relative",verticalAlign:"middle",lineHeight:0,...r.container}),[r.container]),x=d.useMemo(()=>({display:"inline-flex",flexShrink:0,justifyContent:"flex-start",boxSizing:"content-box",cursor:"pointer",...r.track}),[r.track]),y=d.useMemo(()=>({userSelect:"none",marginStart:o,...r.label}),[o,r.label]);return a.jsxs(we.label,{...m(),className:Ye("chakra-switch",t.className),__css:g,children:[a.jsx("input",{className:"chakra-switch__input",...u({},n)}),a.jsx(we.span,{...p(),className:"chakra-switch__track",__css:x,children:a.jsx(we.span,{__css:r.thumb,className:"chakra-switch__thumb",...l()})}),s&&a.jsx(we.span,{className:"chakra-switch__label",...h(),__css:y,children:s})]})});qb.displayName="Switch";var[jW,_W,IW,PW]=lb();function EW(e){var t;const{defaultIndex:n,onChange:r,index:o,isManual:s,isLazy:i,lazyBehavior:l="unmount",orientation:u="horizontal",direction:p="ltr",...m}=e,[h,g]=d.useState(n??0),[x,y]=_d({defaultValue:n??0,value:o,onChange:r});d.useEffect(()=>{o!=null&&g(o)},[o]);const b=IW(),w=d.useId();return{id:`tabs-${(t=e.id)!=null?t:w}`,selectedIndex:x,focusedIndex:h,setSelectedIndex:y,setFocusedIndex:g,isManual:s,isLazy:i,lazyBehavior:l,orientation:u,descendants:b,direction:p,htmlProps:m}}var[MW,Yh]=Wt({name:"TabsContext",errorMessage:"useTabsContext: `context` is undefined. Seems you forgot to wrap all tabs components within "});function OW(e){const{focusedIndex:t,orientation:n,direction:r}=Yh(),o=_W(),s=d.useCallback(i=>{const l=()=>{var j;const _=o.nextEnabled(t);_&&((j=_.node)==null||j.focus())},u=()=>{var j;const _=o.prevEnabled(t);_&&((j=_.node)==null||j.focus())},p=()=>{var j;const _=o.firstEnabled();_&&((j=_.node)==null||j.focus())},m=()=>{var j;const _=o.lastEnabled();_&&((j=_.node)==null||j.focus())},h=n==="horizontal",g=n==="vertical",x=i.key,y=r==="ltr"?"ArrowLeft":"ArrowRight",b=r==="ltr"?"ArrowRight":"ArrowLeft",S={[y]:()=>h&&u(),[b]:()=>h&&l(),ArrowDown:()=>g&&l(),ArrowUp:()=>g&&u(),Home:p,End:m}[x];S&&(i.preventDefault(),S(i))},[o,t,n,r]);return{...e,role:"tablist","aria-orientation":n,onKeyDown:He(e.onKeyDown,s)}}function RW(e){const{isDisabled:t=!1,isFocusable:n=!1,...r}=e,{setSelectedIndex:o,isManual:s,id:i,setFocusedIndex:l,selectedIndex:u}=Yh(),{index:p,register:m}=PW({disabled:t&&!n}),h=p===u,g=()=>{o(p)},x=()=>{l(p),!s&&!(t&&n)&&o(p)},y=h3({...r,ref:It(m,e.ref),isDisabled:t,isFocusable:n,onClick:He(e.onClick,g)}),b="button";return{...y,id:uP(i,p),role:"tab",tabIndex:h?0:-1,type:b,"aria-selected":h,"aria-controls":dP(i,p),onFocus:t?void 0:He(e.onFocus,x)}}var[DW,AW]=Wt({});function TW(e){const t=Yh(),{id:n,selectedIndex:r}=t,s=kh(e.children).map((i,l)=>d.createElement(DW,{key:l,value:{isSelected:l===r,id:dP(n,l),tabId:uP(n,l),selectedIndex:r}},i));return{...e,children:s}}function NW(e){const{children:t,...n}=e,{isLazy:r,lazyBehavior:o}=Yh(),{isSelected:s,id:i,tabId:l}=AW(),u=d.useRef(!1);s&&(u.current=!0);const p=zb({wasSelected:u.current,isSelected:s,enabled:r,mode:o});return{tabIndex:0,...n,children:p?t:null,role:"tabpanel","aria-labelledby":l,hidden:!s,id:i}}function uP(e,t){return`${e}--tab-${t}`}function dP(e,t){return`${e}--tabpanel-${t}`}var[$W,Zh]=Wt({name:"TabsStylesContext",errorMessage:`useTabsStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),rl=je(function(t,n){const r=Un("Tabs",t),{children:o,className:s,...i}=on(t),{htmlProps:l,descendants:u,...p}=EW(i),m=d.useMemo(()=>p,[p]),{isFitted:h,...g}=l;return a.jsx(jW,{value:u,children:a.jsx(MW,{value:m,children:a.jsx($W,{value:r,children:a.jsx(we.div,{className:Ye("chakra-tabs",s),ref:n,...g,__css:r.root,children:o})})})})});rl.displayName="Tabs";var ol=je(function(t,n){const r=OW({...t,ref:n}),s={display:"flex",...Zh().tablist};return a.jsx(we.div,{...r,className:Ye("chakra-tabs__tablist",t.className),__css:s})});ol.displayName="TabList";var So=je(function(t,n){const r=NW({...t,ref:n}),o=Zh();return a.jsx(we.div,{outline:"0",...r,className:Ye("chakra-tabs__tab-panel",t.className),__css:o.tabpanel})});So.displayName="TabPanel";var zc=je(function(t,n){const r=TW(t),o=Zh();return a.jsx(we.div,{...r,width:"100%",ref:n,className:Ye("chakra-tabs__tab-panels",t.className),__css:o.tabpanels})});zc.displayName="TabPanels";var Tr=je(function(t,n){const r=Zh(),o=RW({...t,ref:n}),s={outline:"0",display:"flex",alignItems:"center",justifyContent:"center",...r.tab};return a.jsx(we.button,{...o,className:Ye("chakra-tabs__tab",t.className),__css:s})});Tr.displayName="Tab";function LW(e,t=[]){const n=Object.assign({},e);for(const r of t)r in n&&delete n[r];return n}var zW=["h","minH","height","minHeight"],fP=je((e,t)=>{const n=oi("Textarea",e),{className:r,rows:o,...s}=on(e),i=db(s),l=o?LW(n,zW):n;return a.jsx(we.textarea,{ref:t,rows:o,...i,className:Ye("chakra-textarea",r),__css:l})});fP.displayName="Textarea";var FW={exit:{scale:.85,opacity:0,transition:{opacity:{duration:.15,easings:"easeInOut"},scale:{duration:.2,easings:"easeInOut"}}},enter:{scale:1,opacity:1,transition:{opacity:{easings:"easeOut",duration:.2},scale:{duration:.2,ease:[.175,.885,.4,1.1]}}}},W1=e=>{var t;return((t=e.current)==null?void 0:t.ownerDocument)||document},Bp=e=>{var t,n;return((n=(t=e.current)==null?void 0:t.ownerDocument)==null?void 0:n.defaultView)||window};function BW(e={}){const{openDelay:t=0,closeDelay:n=0,closeOnClick:r=!0,closeOnMouseDown:o,closeOnScroll:s,closeOnPointerDown:i=o,closeOnEsc:l=!0,onOpen:u,onClose:p,placement:m,id:h,isOpen:g,defaultIsOpen:x,arrowSize:y=10,arrowShadowColor:b,arrowPadding:w,modifiers:S,isDisabled:j,gutter:_,offset:E,direction:I,...M}=e,{isOpen:R,onOpen:D,onClose:A}=Lb({isOpen:g,defaultIsOpen:x,onOpen:u,onClose:p}),{referenceRef:O,getPopperProps:T,getArrowInnerProps:X,getArrowProps:B}=$b({enabled:R,placement:m,arrowPadding:w,modifiers:S,gutter:_,offset:E,direction:I}),V=d.useId(),N=`tooltip-${h??V}`,$=d.useRef(null),q=d.useRef(),F=d.useCallback(()=>{q.current&&(clearTimeout(q.current),q.current=void 0)},[]),Q=d.useRef(),Y=d.useCallback(()=>{Q.current&&(clearTimeout(Q.current),Q.current=void 0)},[]),se=d.useCallback(()=>{Y(),A()},[A,Y]),ae=HW($,se),re=d.useCallback(()=>{if(!j&&!q.current){R&&ae();const ge=Bp($);q.current=ge.setTimeout(D,t)}},[ae,j,R,D,t]),G=d.useCallback(()=>{F();const ge=Bp($);Q.current=ge.setTimeout(se,n)},[n,se,F]),K=d.useCallback(()=>{R&&r&&G()},[r,G,R]),ee=d.useCallback(()=>{R&&i&&G()},[i,G,R]),ce=d.useCallback(ge=>{R&&ge.key==="Escape"&&G()},[R,G]);Di(()=>W1($),"keydown",l?ce:void 0),Di(()=>{const ge=$.current;if(!ge)return null;const Ce=n3(ge);return Ce.localName==="body"?Bp($):Ce},"scroll",()=>{R&&s&&se()},{passive:!0,capture:!0}),d.useEffect(()=>{j&&(F(),R&&A())},[j,R,A,F]),d.useEffect(()=>()=>{F(),Y()},[F,Y]),Di(()=>$.current,"pointerleave",G);const J=d.useCallback((ge={},Ce=null)=>({...ge,ref:It($,Ce,O),onPointerEnter:He(ge.onPointerEnter,fe=>{fe.pointerType!=="touch"&&re()}),onClick:He(ge.onClick,K),onPointerDown:He(ge.onPointerDown,ee),onFocus:He(ge.onFocus,re),onBlur:He(ge.onBlur,G),"aria-describedby":R?N:void 0}),[re,G,ee,R,N,K,O]),ie=d.useCallback((ge={},Ce=null)=>T({...ge,style:{...ge.style,[$n.arrowSize.var]:y?`${y}px`:void 0,[$n.arrowShadowColor.var]:b}},Ce),[T,y,b]),de=d.useCallback((ge={},Ce=null)=>{const he={...ge.style,position:"relative",transformOrigin:$n.transformOrigin.varRef};return{ref:Ce,...M,...ge,id:N,role:"tooltip",style:he}},[M,N]);return{isOpen:R,show:re,hide:G,getTriggerProps:J,getTooltipProps:de,getTooltipPositionerProps:ie,getArrowProps:B,getArrowInnerProps:X}}var yv="chakra-ui:close-tooltip";function HW(e,t){return d.useEffect(()=>{const n=W1(e);return n.addEventListener(yv,t),()=>n.removeEventListener(yv,t)},[t,e]),()=>{const n=W1(e),r=Bp(e);n.dispatchEvent(new r.CustomEvent(yv))}}function VW(e,t=[]){const n=Object.assign({},e);for(const r of t)r in n&&delete n[r];return n}function WW(e,t){const n={};for(const r of t)r in e&&(n[r]=e[r]);return n}var UW=we(In.div),Ht=je((e,t)=>{var n,r;const o=oi("Tooltip",e),s=on(e),i=bd(),{children:l,label:u,shouldWrapChildren:p,"aria-label":m,hasArrow:h,bg:g,portalProps:x,background:y,backgroundColor:b,bgColor:w,motionProps:S,...j}=s,_=(r=(n=y??b)!=null?n:g)!=null?r:w;if(_){o.bg=_;const T=VR(i,"colors",_);o[$n.arrowBg.var]=T}const E=BW({...j,direction:i.direction}),I=typeof l=="string"||p;let M;if(I)M=a.jsx(we.span,{display:"inline-block",tabIndex:0,...E.getTriggerProps(),children:l});else{const T=d.Children.only(l);M=d.cloneElement(T,E.getTriggerProps(T.props,T.ref))}const R=!!m,D=E.getTooltipProps({},t),A=R?VW(D,["role","id"]):D,O=WW(D,["role","id"]);return u?a.jsxs(a.Fragment,{children:[M,a.jsx(dr,{children:E.isOpen&&a.jsx(Ac,{...x,children:a.jsx(we.div,{...E.getTooltipPositionerProps(),__css:{zIndex:o.zIndex,pointerEvents:"none"},children:a.jsxs(UW,{variants:FW,initial:"exit",animate:"enter",exit:"exit",...S,...A,__css:o,children:[u,R&&a.jsx(we.span,{srOnly:!0,...O,children:m}),h&&a.jsx(we.div,{"data-popper-arrow":!0,className:"chakra-tooltip__arrow-wrapper",children:a.jsx(we.div,{"data-popper-arrow-inner":!0,className:"chakra-tooltip__arrow",__css:{bg:o.bg}})})]})})})})]}):a.jsx(a.Fragment,{children:l})});Ht.displayName="Tooltip";function Jh(e,t={}){let n=d.useCallback(o=>t.keys?s$(e,t.keys,o):e.listen(o),[t.keys,e]),r=e.get.bind(e);return d.useSyncExternalStore(n,r,r)}const GW=le(xe,({system:e})=>{const{consoleLogLevel:t,shouldLogToConsole:n}=e;return{consoleLogLevel:t,shouldLogToConsole:n}},{memoizeOptions:{resultEqualityCheck:Ft}}),pP=e=>{const{consoleLogLevel:t,shouldLogToConsole:n}=W(GW);return d.useEffect(()=>{n?(localStorage.setItem("ROARR_LOG","true"),localStorage.setItem("ROARR_FILTER",`context.logLevel:>=${WR[t]}`)):localStorage.setItem("ROARR_LOG","false"),JC.ROARR.write=UR.createLogWriter()},[t,n]),d.useEffect(()=>{const o={...GR};KR.set(JC.Roarr.child(o))},[]),d.useMemo(()=>si(e),[e])},KW=()=>{const e=te(),t=W(r=>r.system.toastQueue),n=o5();return d.useEffect(()=>{t.forEach(r=>{n(r)}),t.length>0&&e(qR())},[e,n,t]),null},sl=()=>{const e=te();return d.useCallback(n=>e(ct(Qt(n))),[e])},qW=d.memo(KW);var XW=new Map([["aac","audio/aac"],["abw","application/x-abiword"],["arc","application/x-freearc"],["avif","image/avif"],["avi","video/x-msvideo"],["azw","application/vnd.amazon.ebook"],["bin","application/octet-stream"],["bmp","image/bmp"],["bz","application/x-bzip"],["bz2","application/x-bzip2"],["cda","application/x-cdf"],["csh","application/x-csh"],["css","text/css"],["csv","text/csv"],["doc","application/msword"],["docx","application/vnd.openxmlformats-officedocument.wordprocessingml.document"],["eot","application/vnd.ms-fontobject"],["epub","application/epub+zip"],["gz","application/gzip"],["gif","image/gif"],["heic","image/heic"],["heif","image/heif"],["htm","text/html"],["html","text/html"],["ico","image/vnd.microsoft.icon"],["ics","text/calendar"],["jar","application/java-archive"],["jpeg","image/jpeg"],["jpg","image/jpeg"],["js","text/javascript"],["json","application/json"],["jsonld","application/ld+json"],["mid","audio/midi"],["midi","audio/midi"],["mjs","text/javascript"],["mp3","audio/mpeg"],["mp4","video/mp4"],["mpeg","video/mpeg"],["mpkg","application/vnd.apple.installer+xml"],["odp","application/vnd.oasis.opendocument.presentation"],["ods","application/vnd.oasis.opendocument.spreadsheet"],["odt","application/vnd.oasis.opendocument.text"],["oga","audio/ogg"],["ogv","video/ogg"],["ogx","application/ogg"],["opus","audio/opus"],["otf","font/otf"],["png","image/png"],["pdf","application/pdf"],["php","application/x-httpd-php"],["ppt","application/vnd.ms-powerpoint"],["pptx","application/vnd.openxmlformats-officedocument.presentationml.presentation"],["rar","application/vnd.rar"],["rtf","application/rtf"],["sh","application/x-sh"],["svg","image/svg+xml"],["swf","application/x-shockwave-flash"],["tar","application/x-tar"],["tif","image/tiff"],["tiff","image/tiff"],["ts","video/mp2t"],["ttf","font/ttf"],["txt","text/plain"],["vsd","application/vnd.visio"],["wav","audio/wav"],["weba","audio/webm"],["webm","video/webm"],["webp","image/webp"],["woff","font/woff"],["woff2","font/woff2"],["xhtml","application/xhtml+xml"],["xls","application/vnd.ms-excel"],["xlsx","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"],["xml","application/xml"],["xul","application/vnd.mozilla.xul+xml"],["zip","application/zip"],["7z","application/x-7z-compressed"],["mkv","video/x-matroska"],["mov","video/quicktime"],["msg","application/vnd.ms-outlook"]]);function Fd(e,t){var n=QW(e);if(typeof n.path!="string"){var r=e.webkitRelativePath;Object.defineProperty(n,"path",{value:typeof t=="string"?t:typeof r=="string"&&r.length>0?r:e.name,writable:!1,configurable:!1,enumerable:!0})}return n}function QW(e){var t=e.name,n=t&&t.lastIndexOf(".")!==-1;if(n&&!e.type){var r=t.split(".").pop().toLowerCase(),o=XW.get(r);o&&Object.defineProperty(e,"type",{value:o,writable:!1,configurable:!1,enumerable:!0})}return e}var YW=[".DS_Store","Thumbs.db"];function ZW(e){return Tc(this,void 0,void 0,function(){return Nc(this,function(t){return um(e)&&JW(e.dataTransfer)?[2,rU(e.dataTransfer,e.type)]:eU(e)?[2,tU(e)]:Array.isArray(e)&&e.every(function(n){return"getFile"in n&&typeof n.getFile=="function"})?[2,nU(e)]:[2,[]]})})}function JW(e){return um(e)}function eU(e){return um(e)&&um(e.target)}function um(e){return typeof e=="object"&&e!==null}function tU(e){return U1(e.target.files).map(function(t){return Fd(t)})}function nU(e){return Tc(this,void 0,void 0,function(){var t;return Nc(this,function(n){switch(n.label){case 0:return[4,Promise.all(e.map(function(r){return r.getFile()}))];case 1:return t=n.sent(),[2,t.map(function(r){return Fd(r)})]}})})}function rU(e,t){return Tc(this,void 0,void 0,function(){var n,r;return Nc(this,function(o){switch(o.label){case 0:return e.items?(n=U1(e.items).filter(function(s){return s.kind==="file"}),t!=="drop"?[2,n]:[4,Promise.all(n.map(oU))]):[3,2];case 1:return r=o.sent(),[2,$S(mP(r))];case 2:return[2,$S(U1(e.files).map(function(s){return Fd(s)}))]}})})}function $S(e){return e.filter(function(t){return YW.indexOf(t.name)===-1})}function U1(e){if(e===null)return[];for(var t=[],n=0;ne.length)&&(t=e.length);for(var n=0,r=new Array(t);nn)return[!1,HS(n)];if(e.sizen)return[!1,HS(n)]}return[!0,null]}function Ii(e){return e!=null}function yU(e){var t=e.files,n=e.accept,r=e.minSize,o=e.maxSize,s=e.multiple,i=e.maxFiles,l=e.validator;return!s&&t.length>1||s&&i>=1&&t.length>i?!1:t.every(function(u){var p=xP(u,n),m=rd(p,1),h=m[0],g=bP(u,r,o),x=rd(g,1),y=x[0],b=l?l(u):null;return h&&y&&!b})}function dm(e){return typeof e.isPropagationStopped=="function"?e.isPropagationStopped():typeof e.cancelBubble<"u"?e.cancelBubble:!1}function sp(e){return e.dataTransfer?Array.prototype.some.call(e.dataTransfer.types,function(t){return t==="Files"||t==="application/x-moz-file"}):!!e.target&&!!e.target.files}function WS(e){e.preventDefault()}function CU(e){return e.indexOf("MSIE")!==-1||e.indexOf("Trident/")!==-1}function wU(e){return e.indexOf("Edge/")!==-1}function SU(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:window.navigator.userAgent;return CU(e)||wU(e)}function ps(){for(var e=arguments.length,t=new Array(e),n=0;n1?o-1:0),i=1;ie.length)&&(t=e.length);for(var n=0,r=new Array(t);n=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function FU(e,t){if(e==null)return{};var n={},r=Object.keys(e),o,s;for(s=0;s=0)&&(n[o]=e[o]);return n}var Xb=d.forwardRef(function(e,t){var n=e.children,r=fm(e,EU),o=Qb(r),s=o.open,i=fm(o,MU);return d.useImperativeHandle(t,function(){return{open:s}},[s]),H.createElement(d.Fragment,null,n(bn(bn({},i),{},{open:s})))});Xb.displayName="Dropzone";var SP={disabled:!1,getFilesFromEvent:ZW,maxSize:1/0,minSize:0,multiple:!0,maxFiles:0,preventDropOnDocument:!0,noClick:!1,noKeyboard:!1,noDrag:!1,noDragEventsBubbling:!1,validator:null,useFsAccessApi:!0,autoFocus:!1};Xb.defaultProps=SP;Xb.propTypes={children:Jt.func,accept:Jt.objectOf(Jt.arrayOf(Jt.string)),multiple:Jt.bool,preventDropOnDocument:Jt.bool,noClick:Jt.bool,noKeyboard:Jt.bool,noDrag:Jt.bool,noDragEventsBubbling:Jt.bool,minSize:Jt.number,maxSize:Jt.number,maxFiles:Jt.number,disabled:Jt.bool,getFilesFromEvent:Jt.func,onFileDialogCancel:Jt.func,onFileDialogOpen:Jt.func,useFsAccessApi:Jt.bool,autoFocus:Jt.bool,onDragEnter:Jt.func,onDragLeave:Jt.func,onDragOver:Jt.func,onDrop:Jt.func,onDropAccepted:Jt.func,onDropRejected:Jt.func,onError:Jt.func,validator:Jt.func};var X1={isFocused:!1,isFileDialogActive:!1,isDragActive:!1,isDragAccept:!1,isDragReject:!1,acceptedFiles:[],fileRejections:[]};function Qb(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=bn(bn({},SP),e),n=t.accept,r=t.disabled,o=t.getFilesFromEvent,s=t.maxSize,i=t.minSize,l=t.multiple,u=t.maxFiles,p=t.onDragEnter,m=t.onDragLeave,h=t.onDragOver,g=t.onDrop,x=t.onDropAccepted,y=t.onDropRejected,b=t.onFileDialogCancel,w=t.onFileDialogOpen,S=t.useFsAccessApi,j=t.autoFocus,_=t.preventDropOnDocument,E=t.noClick,I=t.noKeyboard,M=t.noDrag,R=t.noDragEventsBubbling,D=t.onError,A=t.validator,O=d.useMemo(function(){return _U(n)},[n]),T=d.useMemo(function(){return jU(n)},[n]),X=d.useMemo(function(){return typeof w=="function"?w:GS},[w]),B=d.useMemo(function(){return typeof b=="function"?b:GS},[b]),V=d.useRef(null),U=d.useRef(null),N=d.useReducer(BU,X1),$=Cv(N,2),q=$[0],F=$[1],Q=q.isFocused,Y=q.isFileDialogActive,se=d.useRef(typeof window<"u"&&window.isSecureContext&&S&&kU()),ae=function(){!se.current&&Y&&setTimeout(function(){if(U.current){var De=U.current.files;De.length||(F({type:"closeDialog"}),B())}},300)};d.useEffect(function(){return window.addEventListener("focus",ae,!1),function(){window.removeEventListener("focus",ae,!1)}},[U,Y,B,se]);var re=d.useRef([]),G=function(De){V.current&&V.current.contains(De.target)||(De.preventDefault(),re.current=[])};d.useEffect(function(){return _&&(document.addEventListener("dragover",WS,!1),document.addEventListener("drop",G,!1)),function(){_&&(document.removeEventListener("dragover",WS),document.removeEventListener("drop",G))}},[V,_]),d.useEffect(function(){return!r&&j&&V.current&&V.current.focus(),function(){}},[V,j,r]);var K=d.useCallback(function(ye){D?D(ye):console.error(ye)},[D]),ee=d.useCallback(function(ye){ye.preventDefault(),ye.persist(),$e(ye),re.current=[].concat(DU(re.current),[ye.target]),sp(ye)&&Promise.resolve(o(ye)).then(function(De){if(!(dm(ye)&&!R)){var ut=De.length,bt=ut>0&&yU({files:De,accept:O,minSize:i,maxSize:s,multiple:l,maxFiles:u,validator:A}),be=ut>0&&!bt;F({isDragAccept:bt,isDragReject:be,isDragActive:!0,type:"setDraggedFiles"}),p&&p(ye)}}).catch(function(De){return K(De)})},[o,p,K,R,O,i,s,l,u,A]),ce=d.useCallback(function(ye){ye.preventDefault(),ye.persist(),$e(ye);var De=sp(ye);if(De&&ye.dataTransfer)try{ye.dataTransfer.dropEffect="copy"}catch{}return De&&h&&h(ye),!1},[h,R]),J=d.useCallback(function(ye){ye.preventDefault(),ye.persist(),$e(ye);var De=re.current.filter(function(bt){return V.current&&V.current.contains(bt)}),ut=De.indexOf(ye.target);ut!==-1&&De.splice(ut,1),re.current=De,!(De.length>0)&&(F({type:"setDraggedFiles",isDragActive:!1,isDragAccept:!1,isDragReject:!1}),sp(ye)&&m&&m(ye))},[V,m,R]),ie=d.useCallback(function(ye,De){var ut=[],bt=[];ye.forEach(function(be){var Je=xP(be,O),lt=Cv(Je,2),ft=lt[0],Me=lt[1],Le=bP(be,i,s),Ut=Cv(Le,2),ke=Ut[0],Be=Ut[1],ze=A?A(be):null;if(ft&&ke&&!ze)ut.push(be);else{var Ge=[Me,Be];ze&&(Ge=Ge.concat(ze)),bt.push({file:be,errors:Ge.filter(function(pt){return pt})})}}),(!l&&ut.length>1||l&&u>=1&&ut.length>u)&&(ut.forEach(function(be){bt.push({file:be,errors:[bU]})}),ut.splice(0)),F({acceptedFiles:ut,fileRejections:bt,type:"setFiles"}),g&&g(ut,bt,De),bt.length>0&&y&&y(bt,De),ut.length>0&&x&&x(ut,De)},[F,l,O,i,s,u,g,x,y,A]),de=d.useCallback(function(ye){ye.preventDefault(),ye.persist(),$e(ye),re.current=[],sp(ye)&&Promise.resolve(o(ye)).then(function(De){dm(ye)&&!R||ie(De,ye)}).catch(function(De){return K(De)}),F({type:"reset"})},[o,ie,K,R]),ge=d.useCallback(function(){if(se.current){F({type:"openDialog"}),X();var ye={multiple:l,types:T};window.showOpenFilePicker(ye).then(function(De){return o(De)}).then(function(De){ie(De,null),F({type:"closeDialog"})}).catch(function(De){IU(De)?(B(De),F({type:"closeDialog"})):PU(De)?(se.current=!1,U.current?(U.current.value=null,U.current.click()):K(new Error("Cannot open the file picker because the https://developer.mozilla.org/en-US/docs/Web/API/File_System_Access_API is not supported and no was provided."))):K(De)});return}U.current&&(F({type:"openDialog"}),X(),U.current.value=null,U.current.click())},[F,X,B,S,ie,K,T,l]),Ce=d.useCallback(function(ye){!V.current||!V.current.isEqualNode(ye.target)||(ye.key===" "||ye.key==="Enter"||ye.keyCode===32||ye.keyCode===13)&&(ye.preventDefault(),ge())},[V,ge]),he=d.useCallback(function(){F({type:"focus"})},[]),fe=d.useCallback(function(){F({type:"blur"})},[]),Oe=d.useCallback(function(){E||(SU()?setTimeout(ge,0):ge())},[E,ge]),_e=function(De){return r?null:De},Ne=function(De){return I?null:_e(De)},nt=function(De){return M?null:_e(De)},$e=function(De){R&&De.stopPropagation()},Pt=d.useMemo(function(){return function(){var ye=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},De=ye.refKey,ut=De===void 0?"ref":De,bt=ye.role,be=ye.onKeyDown,Je=ye.onFocus,lt=ye.onBlur,ft=ye.onClick,Me=ye.onDragEnter,Le=ye.onDragOver,Ut=ye.onDragLeave,ke=ye.onDrop,Be=fm(ye,OU);return bn(bn(q1({onKeyDown:Ne(ps(be,Ce)),onFocus:Ne(ps(Je,he)),onBlur:Ne(ps(lt,fe)),onClick:_e(ps(ft,Oe)),onDragEnter:nt(ps(Me,ee)),onDragOver:nt(ps(Le,ce)),onDragLeave:nt(ps(Ut,J)),onDrop:nt(ps(ke,de)),role:typeof bt=="string"&&bt!==""?bt:"presentation"},ut,V),!r&&!I?{tabIndex:0}:{}),Be)}},[V,Ce,he,fe,Oe,ee,ce,J,de,I,M,r]),Ze=d.useCallback(function(ye){ye.stopPropagation()},[]),ot=d.useMemo(function(){return function(){var ye=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},De=ye.refKey,ut=De===void 0?"ref":De,bt=ye.onChange,be=ye.onClick,Je=fm(ye,RU),lt=q1({accept:O,multiple:l,type:"file",style:{display:"none"},onChange:_e(ps(bt,de)),onClick:_e(ps(be,Ze)),tabIndex:-1},ut,U);return bn(bn({},lt),Je)}},[U,n,l,de,r]);return bn(bn({},q),{},{isFocused:Q&&!r,getRootProps:Pt,getInputProps:ot,rootRef:V,inputRef:U,open:_e(ge)})}function BU(e,t){switch(t.type){case"focus":return bn(bn({},e),{},{isFocused:!0});case"blur":return bn(bn({},e),{},{isFocused:!1});case"openDialog":return bn(bn({},X1),{},{isFileDialogActive:!0});case"closeDialog":return bn(bn({},e),{},{isFileDialogActive:!1});case"setDraggedFiles":return bn(bn({},e),{},{isDragActive:t.isDragActive,isDragAccept:t.isDragAccept,isDragReject:t.isDragReject});case"setFiles":return bn(bn({},e),{},{acceptedFiles:t.acceptedFiles,fileRejections:t.fileRejections});case"reset":return bn({},X1);default:return e}}function GS(){}function Q1(){return Q1=Object.assign?Object.assign.bind():function(e){for(var t=1;t'),!0):t?e.some(function(n){return t.includes(n)})||e.includes("*"):!0}var qU=function(t,n,r){r===void 0&&(r=!1);var o=n.alt,s=n.meta,i=n.mod,l=n.shift,u=n.ctrl,p=n.keys,m=t.key,h=t.code,g=t.ctrlKey,x=t.metaKey,y=t.shiftKey,b=t.altKey,w=Va(h),S=m.toLowerCase();if(!r){if(o===!b&&S!=="alt"||l===!y&&S!=="shift")return!1;if(i){if(!x&&!g)return!1}else if(s===!x&&S!=="meta"&&S!=="os"||u===!g&&S!=="ctrl"&&S!=="control")return!1}return p&&p.length===1&&(p.includes(S)||p.includes(w))?!0:p?Hp(p):!p},XU=d.createContext(void 0),QU=function(){return d.useContext(XU)};function PP(e,t){return e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(e).length===Object.keys(t).length&&Object.keys(e).reduce(function(n,r){return n&&PP(e[r],t[r])},!0):e===t}var YU=d.createContext({hotkeys:[],enabledScopes:[],toggleScope:function(){},enableScope:function(){},disableScope:function(){}}),ZU=function(){return d.useContext(YU)};function JU(e){var t=d.useRef(void 0);return PP(t.current,e)||(t.current=e),t.current}var KS=function(t){t.stopPropagation(),t.preventDefault(),t.stopImmediatePropagation()},eG=typeof window<"u"?d.useLayoutEffect:d.useEffect;function et(e,t,n,r){var o=d.useRef(null),s=d.useRef(!1),i=n instanceof Array?r instanceof Array?void 0:r:n,l=Yb(e)?e.join(i==null?void 0:i.splitKey):e,u=n instanceof Array?n:r instanceof Array?r:void 0,p=d.useCallback(t,u??[]),m=d.useRef(p);u?m.current=p:m.current=t;var h=JU(i),g=ZU(),x=g.enabledScopes,y=QU();return eG(function(){if(!((h==null?void 0:h.enabled)===!1||!KU(x,h==null?void 0:h.scopes))){var b=function(E,I){var M;if(I===void 0&&(I=!1),!(GU(E)&&!IP(E,h==null?void 0:h.enableOnFormTags))&&!(h!=null&&h.ignoreEventWhen!=null&&h.ignoreEventWhen(E))){if(o.current!==null&&document.activeElement!==o.current&&!o.current.contains(document.activeElement)){KS(E);return}(M=E.target)!=null&&M.isContentEditable&&!(h!=null&&h.enableOnContentEditable)||wv(l,h==null?void 0:h.splitKey).forEach(function(R){var D,A=Sv(R,h==null?void 0:h.combinationKey);if(qU(E,A,h==null?void 0:h.ignoreModifiers)||(D=A.keys)!=null&&D.includes("*")){if(I&&s.current)return;if(WU(E,A,h==null?void 0:h.preventDefault),!UU(E,A,h==null?void 0:h.enabled)){KS(E);return}m.current(E,A),I||(s.current=!0)}})}},w=function(E){E.key!==void 0&&(jP(Va(E.code)),((h==null?void 0:h.keydown)===void 0&&(h==null?void 0:h.keyup)!==!0||h!=null&&h.keydown)&&b(E))},S=function(E){E.key!==void 0&&(_P(Va(E.code)),s.current=!1,h!=null&&h.keyup&&b(E,!0))},j=o.current||(i==null?void 0:i.document)||document;return j.addEventListener("keyup",S),j.addEventListener("keydown",w),y&&wv(l,h==null?void 0:h.splitKey).forEach(function(_){return y.addHotkey(Sv(_,h==null?void 0:h.combinationKey,h==null?void 0:h.description))}),function(){j.removeEventListener("keyup",S),j.removeEventListener("keydown",w),y&&wv(l,h==null?void 0:h.splitKey).forEach(function(_){return y.removeHotkey(Sv(_,h==null?void 0:h.combinationKey,h==null?void 0:h.description))})}}},[l,h,x]),o}const tG=e=>{const{isDragAccept:t,isDragReject:n,setIsHandlingUpload:r}=e;return et("esc",()=>{r(!1)}),a.jsxs(Ie,{sx:{position:"absolute",top:0,insetInlineStart:0,width:"100vw",height:"100vh",zIndex:999,backdropFilter:"blur(20px)"},children:[a.jsx(L,{sx:{position:"absolute",top:0,insetInlineStart:0,w:"full",h:"full",bg:"base.700",_dark:{bg:"base.900"},opacity:.7,alignItems:"center",justifyContent:"center",transitionProperty:"common",transitionDuration:"0.1s"}}),a.jsx(L,{sx:{position:"absolute",top:0,insetInlineStart:0,width:"full",height:"full",alignItems:"center",justifyContent:"center",p:4},children:a.jsx(L,{sx:{width:"full",height:"full",alignItems:"center",justifyContent:"center",flexDir:"column",gap:4,borderWidth:3,borderRadius:"xl",borderStyle:"dashed",color:"base.100",borderColor:"base.100",_dark:{borderColor:"base.200"}},children:t?a.jsx(cr,{size:"lg",children:"Drop to Upload"}):a.jsxs(a.Fragment,{children:[a.jsx(cr,{size:"lg",children:"Invalid Upload"}),a.jsx(cr,{size:"md",children:"Must be single JPEG or PNG image"})]})})})]})},nG=d.memo(tG),rG=le([xe,Jn],({gallery:e},t)=>{let n={type:"TOAST"};t==="unifiedCanvas"&&(n={type:"SET_CANVAS_INITIAL_IMAGE"}),t==="img2img"&&(n={type:"SET_INITIAL_IMAGE"});const{autoAddBoardId:r}=e;return{autoAddBoardId:r,postUploadAction:n}},Se),oG=e=>{const{children:t}=e,{autoAddBoardId:n,postUploadAction:r}=W(rG),o=sl(),{t:s}=Z(),[i,l]=d.useState(!1),[u]=nI(),p=d.useCallback(_=>{l(!0),o({title:s("toast.uploadFailed"),description:_.errors.map(E=>E.message).join(` +`),status:"error"})},[s,o]),m=d.useCallback(async _=>{u({file:_,image_category:"user",is_intermediate:!1,postUploadAction:r,board_id:n==="none"?void 0:n})},[n,r,u]),h=d.useCallback((_,E)=>{if(E.length>1){o({title:s("toast.uploadFailed"),description:s("toast.uploadFailedInvalidUploadDesc"),status:"error"});return}E.forEach(I=>{p(I)}),_.forEach(I=>{m(I)})},[s,o,m,p]),g=d.useCallback(()=>{l(!0)},[]),{getRootProps:x,getInputProps:y,isDragAccept:b,isDragReject:w,isDragActive:S,inputRef:j}=Qb({accept:{"image/png":[".png"],"image/jpeg":[".jpg",".jpeg",".png"]},noClick:!0,onDrop:h,onDragOver:g,multiple:!1});return d.useEffect(()=>{const _=async E=>{var I,M;j.current&&(I=E.clipboardData)!=null&&I.files&&(j.current.files=E.clipboardData.files,(M=j.current)==null||M.dispatchEvent(new Event("change",{bubbles:!0})))};return document.addEventListener("paste",_),()=>{document.removeEventListener("paste",_)}},[j]),a.jsxs(Ie,{...x({style:{}}),onKeyDown:_=>{_.key},children:[a.jsx("input",{...y()}),t,a.jsx(dr,{children:S&&i&&a.jsx(In.div,{initial:{opacity:0},animate:{opacity:1,transition:{duration:.1}},exit:{opacity:0,transition:{duration:.1}},children:a.jsx(nG,{isDragAccept:b,isDragReject:w,setIsHandlingUpload:l})},"image-upload-overlay")})]})},sG=d.memo(oG),aG=je((e,t)=>{const{children:n,tooltip:r="",tooltipProps:{placement:o="top",hasArrow:s=!0,...i}={},isChecked:l,...u}=e;return a.jsx(Ht,{label:r,placement:o,hasArrow:s,...i,children:a.jsx(Za,{ref:t,colorScheme:l?"accent":"base",...u,children:n})})}),at=d.memo(aG);function iG(e){const t=d.createContext(null);return[({children:o,value:s})=>H.createElement(t.Provider,{value:s},o),()=>{const o=d.useContext(t);if(o===null)throw new Error(e);return o}]}function EP(e){return Array.isArray(e)?e:[e]}const lG=()=>{};function cG(e,t={active:!0}){return typeof e!="function"||!t.active?t.onKeyDown||lG:n=>{var r;n.key==="Escape"&&(e(n),(r=t.onTrigger)==null||r.call(t))}}function MP({data:e}){const t=[],n=[],r=e.reduce((o,s,i)=>(s.group?o[s.group]?o[s.group].push(i):o[s.group]=[i]:n.push(i),o),{});return Object.keys(r).forEach(o=>{t.push(...r[o].map(s=>e[s]))}),t.push(...n.map(o=>e[o])),t}function OP(e){return Array.isArray(e)||e===null?!1:typeof e=="object"?e.type!==H.Fragment:!1}function RP(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e))for(t=0;tr===t[o]).indexOf(!1)>=0)&&(n.current={v:e(),prevDeps:[...t]}),n.current.v}const fG=XR({key:"mantine",prepend:!0});function pG(){return QI()||fG}var mG=Object.defineProperty,qS=Object.getOwnPropertySymbols,hG=Object.prototype.hasOwnProperty,gG=Object.prototype.propertyIsEnumerable,XS=(e,t,n)=>t in e?mG(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,vG=(e,t)=>{for(var n in t||(t={}))hG.call(t,n)&&XS(e,n,t[n]);if(qS)for(var n of qS(t))gG.call(t,n)&&XS(e,n,t[n]);return e};const kv="ref";function xG(e){let t;if(e.length!==1)return{args:e,ref:t};const[n]=e;if(!(n instanceof Object))return{args:e,ref:t};if(!(kv in n))return{args:e,ref:t};t=n[kv];const r=vG({},n);return delete r[kv],{args:[r],ref:t}}const{cssFactory:bG}=(()=>{function e(n,r,o){const s=[],i=ZR(n,s,o);return s.length<2?o:i+r(s)}function t(n){const{cache:r}=n,o=(...i)=>{const{ref:l,args:u}=xG(i),p=QR(u,r.registered);return YR(r,p,!1),`${r.key}-${p.name}${l===void 0?"":` ${l}`}`};return{css:o,cx:(...i)=>e(r.registered,o,DP(i))}}return{cssFactory:t}})();function AP(){const e=pG();return dG(()=>bG({cache:e}),[e])}function yG({cx:e,classes:t,context:n,classNames:r,name:o,cache:s}){const i=n.reduce((l,u)=>(Object.keys(u.classNames).forEach(p=>{typeof l[p]!="string"?l[p]=`${u.classNames[p]}`:l[p]=`${l[p]} ${u.classNames[p]}`}),l),{});return Object.keys(t).reduce((l,u)=>(l[u]=e(t[u],i[u],r!=null&&r[u],Array.isArray(o)?o.filter(Boolean).map(p=>`${(s==null?void 0:s.key)||"mantine"}-${p}-${u}`).join(" "):o?`${(s==null?void 0:s.key)||"mantine"}-${o}-${u}`:null),l),{})}var CG=Object.defineProperty,QS=Object.getOwnPropertySymbols,wG=Object.prototype.hasOwnProperty,SG=Object.prototype.propertyIsEnumerable,YS=(e,t,n)=>t in e?CG(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,jv=(e,t)=>{for(var n in t||(t={}))wG.call(t,n)&&YS(e,n,t[n]);if(QS)for(var n of QS(t))SG.call(t,n)&&YS(e,n,t[n]);return e};function Y1(e,t){return t&&Object.keys(t).forEach(n=>{e[n]?e[n]=jv(jv({},e[n]),t[n]):e[n]=jv({},t[n])}),e}function ZS(e,t,n,r){const o=s=>typeof s=="function"?s(t,n||{},r):s||{};return Array.isArray(e)?e.map(s=>o(s.styles)).reduce((s,i)=>Y1(s,i),{}):o(e)}function kG({ctx:e,theme:t,params:n,variant:r,size:o}){return e.reduce((s,i)=>(i.variants&&r in i.variants&&Y1(s,i.variants[r](t,n,{variant:r,size:o})),i.sizes&&o in i.sizes&&Y1(s,i.sizes[o](t,n,{variant:r,size:o})),s),{})}function fr(e){const t=typeof e=="function"?e:()=>e;function n(r,o){const s=xa(),i=H9(o==null?void 0:o.name),l=QI(),u={variant:o==null?void 0:o.variant,size:o==null?void 0:o.size},{css:p,cx:m}=AP(),h=t(s,r,u),g=ZS(o==null?void 0:o.styles,s,r,u),x=ZS(i,s,r,u),y=kG({ctx:i,theme:s,params:r,variant:o==null?void 0:o.variant,size:o==null?void 0:o.size}),b=Object.fromEntries(Object.keys(h).map(w=>{const S=m({[p(h[w])]:!(o!=null&&o.unstyled)},p(y[w]),p(x[w]),p(g[w]));return[w,S]}));return{classes:yG({cx:m,classes:b,context:i,classNames:o==null?void 0:o.classNames,name:o==null?void 0:o.name,cache:l}),cx:m,theme:s}}return n}function JS(e){return`___ref-${e||""}`}var jG=Object.defineProperty,_G=Object.defineProperties,IG=Object.getOwnPropertyDescriptors,e4=Object.getOwnPropertySymbols,PG=Object.prototype.hasOwnProperty,EG=Object.prototype.propertyIsEnumerable,t4=(e,t,n)=>t in e?jG(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,wu=(e,t)=>{for(var n in t||(t={}))PG.call(t,n)&&t4(e,n,t[n]);if(e4)for(var n of e4(t))EG.call(t,n)&&t4(e,n,t[n]);return e},Su=(e,t)=>_G(e,IG(t));const ku={in:{opacity:1,transform:"scale(1)"},out:{opacity:0,transform:`scale(.9) translateY(${Re(10)})`},transitionProperty:"transform, opacity"},ap={fade:{in:{opacity:1},out:{opacity:0},transitionProperty:"opacity"},scale:{in:{opacity:1,transform:"scale(1)"},out:{opacity:0,transform:"scale(0)"},common:{transformOrigin:"top"},transitionProperty:"transform, opacity"},"scale-y":{in:{opacity:1,transform:"scaleY(1)"},out:{opacity:0,transform:"scaleY(0)"},common:{transformOrigin:"top"},transitionProperty:"transform, opacity"},"scale-x":{in:{opacity:1,transform:"scaleX(1)"},out:{opacity:0,transform:"scaleX(0)"},common:{transformOrigin:"left"},transitionProperty:"transform, opacity"},"skew-up":{in:{opacity:1,transform:"translateY(0) skew(0deg, 0deg)"},out:{opacity:0,transform:`translateY(-${Re(20)}) skew(-10deg, -5deg)`},common:{transformOrigin:"top"},transitionProperty:"transform, opacity"},"skew-down":{in:{opacity:1,transform:"translateY(0) skew(0deg, 0deg)"},out:{opacity:0,transform:`translateY(${Re(20)}) skew(-10deg, -5deg)`},common:{transformOrigin:"bottom"},transitionProperty:"transform, opacity"},"rotate-left":{in:{opacity:1,transform:"translateY(0) rotate(0deg)"},out:{opacity:0,transform:`translateY(${Re(20)}) rotate(-5deg)`},common:{transformOrigin:"bottom"},transitionProperty:"transform, opacity"},"rotate-right":{in:{opacity:1,transform:"translateY(0) rotate(0deg)"},out:{opacity:0,transform:`translateY(${Re(20)}) rotate(5deg)`},common:{transformOrigin:"top"},transitionProperty:"transform, opacity"},"slide-down":{in:{opacity:1,transform:"translateY(0)"},out:{opacity:0,transform:"translateY(-100%)"},common:{transformOrigin:"top"},transitionProperty:"transform, opacity"},"slide-up":{in:{opacity:1,transform:"translateY(0)"},out:{opacity:0,transform:"translateY(100%)"},common:{transformOrigin:"bottom"},transitionProperty:"transform, opacity"},"slide-left":{in:{opacity:1,transform:"translateX(0)"},out:{opacity:0,transform:"translateX(100%)"},common:{transformOrigin:"left"},transitionProperty:"transform, opacity"},"slide-right":{in:{opacity:1,transform:"translateX(0)"},out:{opacity:0,transform:"translateX(-100%)"},common:{transformOrigin:"right"},transitionProperty:"transform, opacity"},pop:Su(wu({},ku),{common:{transformOrigin:"center center"}}),"pop-bottom-left":Su(wu({},ku),{common:{transformOrigin:"bottom left"}}),"pop-bottom-right":Su(wu({},ku),{common:{transformOrigin:"bottom right"}}),"pop-top-left":Su(wu({},ku),{common:{transformOrigin:"top left"}}),"pop-top-right":Su(wu({},ku),{common:{transformOrigin:"top right"}})},n4=["mousedown","touchstart"];function MG(e,t,n){const r=d.useRef();return d.useEffect(()=>{const o=s=>{const{target:i}=s??{};if(Array.isArray(n)){const l=(i==null?void 0:i.hasAttribute("data-ignore-outside-clicks"))||!document.body.contains(i)&&i.tagName!=="HTML";n.every(p=>!!p&&!s.composedPath().includes(p))&&!l&&e()}else r.current&&!r.current.contains(i)&&e()};return(t||n4).forEach(s=>document.addEventListener(s,o)),()=>{(t||n4).forEach(s=>document.removeEventListener(s,o))}},[r,e,n]),r}function OG(e,t){try{return e.addEventListener("change",t),()=>e.removeEventListener("change",t)}catch{return e.addListener(t),()=>e.removeListener(t)}}function RG(e,t){return typeof t=="boolean"?t:typeof window<"u"&&"matchMedia"in window?window.matchMedia(e).matches:!1}function DG(e,t,{getInitialValueInEffect:n}={getInitialValueInEffect:!0}){const[r,o]=d.useState(n?t:RG(e,t)),s=d.useRef();return d.useEffect(()=>{if("matchMedia"in window)return s.current=window.matchMedia(e),o(s.current.matches),OG(s.current,i=>o(i.matches))},[e]),r}const TP=typeof document<"u"?d.useLayoutEffect:d.useEffect;function Uo(e,t){const n=d.useRef(!1);d.useEffect(()=>()=>{n.current=!1},[]),d.useEffect(()=>{if(n.current)return e();n.current=!0},t)}function AG({opened:e,shouldReturnFocus:t=!0}){const n=d.useRef(),r=()=>{var o;n.current&&"focus"in n.current&&typeof n.current.focus=="function"&&((o=n.current)==null||o.focus({preventScroll:!0}))};return Uo(()=>{let o=-1;const s=i=>{i.key==="Tab"&&window.clearTimeout(o)};return document.addEventListener("keydown",s),e?n.current=document.activeElement:t&&(o=window.setTimeout(r,10)),()=>{window.clearTimeout(o),document.removeEventListener("keydown",s)}},[e,t]),r}const TG=/input|select|textarea|button|object/,NP="a, input, select, textarea, button, object, [tabindex]";function NG(e){return e.style.display==="none"}function $G(e){if(e.getAttribute("aria-hidden")||e.getAttribute("hidden")||e.getAttribute("type")==="hidden")return!1;let n=e;for(;n&&!(n===document.body||n.nodeType===11);){if(NG(n))return!1;n=n.parentNode}return!0}function $P(e){let t=e.getAttribute("tabindex");return t===null&&(t=void 0),parseInt(t,10)}function Z1(e){const t=e.nodeName.toLowerCase(),n=!Number.isNaN($P(e));return(TG.test(t)&&!e.disabled||e instanceof HTMLAnchorElement&&e.href||n)&&$G(e)}function LP(e){const t=$P(e);return(Number.isNaN(t)||t>=0)&&Z1(e)}function LG(e){return Array.from(e.querySelectorAll(NP)).filter(LP)}function zG(e,t){const n=LG(e);if(!n.length){t.preventDefault();return}const r=n[t.shiftKey?0:n.length-1],o=e.getRootNode();if(!(r===o.activeElement||e===o.activeElement))return;t.preventDefault();const i=n[t.shiftKey?n.length-1:0];i&&i.focus()}function Jb(){return`mantine-${Math.random().toString(36).slice(2,11)}`}function FG(e,t="body > :not(script)"){const n=Jb(),r=Array.from(document.querySelectorAll(t)).map(o=>{var s;if((s=o==null?void 0:o.shadowRoot)!=null&&s.contains(e)||o.contains(e))return;const i=o.getAttribute("aria-hidden"),l=o.getAttribute("data-hidden"),u=o.getAttribute("data-focus-id");return o.setAttribute("data-focus-id",n),i===null||i==="false"?o.setAttribute("aria-hidden","true"):!l&&!u&&o.setAttribute("data-hidden",i),{node:o,ariaHidden:l||null}});return()=>{r.forEach(o=>{!o||n!==o.node.getAttribute("data-focus-id")||(o.ariaHidden===null?o.node.removeAttribute("aria-hidden"):o.node.setAttribute("aria-hidden",o.ariaHidden),o.node.removeAttribute("data-focus-id"),o.node.removeAttribute("data-hidden"))})}}function BG(e=!0){const t=d.useRef(),n=d.useRef(null),r=s=>{let i=s.querySelector("[data-autofocus]");if(!i){const l=Array.from(s.querySelectorAll(NP));i=l.find(LP)||l.find(Z1)||null,!i&&Z1(s)&&(i=s)}i&&i.focus({preventScroll:!0})},o=d.useCallback(s=>{if(e){if(s===null){n.current&&(n.current(),n.current=null);return}n.current=FG(s),t.current!==s&&(s?(setTimeout(()=>{s.getRootNode()&&r(s)}),t.current=s):t.current=null)}},[e]);return d.useEffect(()=>{if(!e)return;t.current&&setTimeout(()=>r(t.current));const s=i=>{i.key==="Tab"&&t.current&&zG(t.current,i)};return document.addEventListener("keydown",s),()=>{document.removeEventListener("keydown",s),n.current&&n.current()}},[e]),o}const HG=H["useId".toString()]||(()=>{});function VG(){const e=HG();return e?`mantine-${e.replace(/:/g,"")}`:""}function ey(e){const t=VG(),[n,r]=d.useState(t);return TP(()=>{r(Jb())},[]),typeof e=="string"?e:typeof window>"u"?t:n}function r4(e,t,n){d.useEffect(()=>(window.addEventListener(e,t,n),()=>window.removeEventListener(e,t,n)),[e,t])}function zP(e,t){typeof e=="function"?e(t):typeof e=="object"&&e!==null&&"current"in e&&(e.current=t)}function WG(...e){return t=>{e.forEach(n=>zP(n,t))}}function Bd(...e){return d.useCallback(WG(...e),e)}function od({value:e,defaultValue:t,finalValue:n,onChange:r=()=>{}}){const[o,s]=d.useState(t!==void 0?t:n),i=l=>{s(l),r==null||r(l)};return e!==void 0?[e,r,!0]:[o,i,!1]}function FP(e,t){return DG("(prefers-reduced-motion: reduce)",e,t)}const UG=e=>e<.5?2*e*e:-1+(4-2*e)*e,GG=({axis:e,target:t,parent:n,alignment:r,offset:o,isList:s})=>{if(!t||!n&&typeof document>"u")return 0;const i=!!n,u=(n||document.body).getBoundingClientRect(),p=t.getBoundingClientRect(),m=h=>p[h]-u[h];if(e==="y"){const h=m("top");if(h===0)return 0;if(r==="start"){const x=h-o;return x<=p.height*(s?0:1)||!s?x:0}const g=i?u.height:window.innerHeight;if(r==="end"){const x=h+o-g+p.height;return x>=-p.height*(s?0:1)||!s?x:0}return r==="center"?h-g/2+p.height/2:0}if(e==="x"){const h=m("left");if(h===0)return 0;if(r==="start"){const x=h-o;return x<=p.width||!s?x:0}const g=i?u.width:window.innerWidth;if(r==="end"){const x=h+o-g+p.width;return x>=-p.width||!s?x:0}return r==="center"?h-g/2+p.width/2:0}return 0},KG=({axis:e,parent:t})=>{if(!t&&typeof document>"u")return 0;const n=e==="y"?"scrollTop":"scrollLeft";if(t)return t[n];const{body:r,documentElement:o}=document;return r[n]+o[n]},qG=({axis:e,parent:t,distance:n})=>{if(!t&&typeof document>"u")return;const r=e==="y"?"scrollTop":"scrollLeft";if(t)t[r]=n;else{const{body:o,documentElement:s}=document;o[r]=n,s[r]=n}};function BP({duration:e=1250,axis:t="y",onScrollFinish:n,easing:r=UG,offset:o=0,cancelable:s=!0,isList:i=!1}={}){const l=d.useRef(0),u=d.useRef(0),p=d.useRef(!1),m=d.useRef(null),h=d.useRef(null),g=FP(),x=()=>{l.current&&cancelAnimationFrame(l.current)},y=d.useCallback(({alignment:w="start"}={})=>{var S;p.current=!1,l.current&&x();const j=(S=KG({parent:m.current,axis:t}))!=null?S:0,_=GG({parent:m.current,target:h.current,axis:t,alignment:w,offset:o,isList:i})-(m.current?0:j);function E(){u.current===0&&(u.current=performance.now());const M=performance.now()-u.current,R=g||e===0?1:M/e,D=j+_*r(R);qG({parent:m.current,axis:t,distance:D}),!p.current&&R<1?l.current=requestAnimationFrame(E):(typeof n=="function"&&n(),u.current=0,l.current=0,x())}E()},[t,e,r,i,o,n,g]),b=()=>{s&&(p.current=!0)};return r4("wheel",b,{passive:!0}),r4("touchmove",b,{passive:!0}),d.useEffect(()=>x,[]),{scrollableRef:m,targetRef:h,scrollIntoView:y,cancel:x}}var o4=Object.getOwnPropertySymbols,XG=Object.prototype.hasOwnProperty,QG=Object.prototype.propertyIsEnumerable,YG=(e,t)=>{var n={};for(var r in e)XG.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&o4)for(var r of o4(e))t.indexOf(r)<0&&QG.call(e,r)&&(n[r]=e[r]);return n};function eg(e){const t=e,{m:n,mx:r,my:o,mt:s,mb:i,ml:l,mr:u,p,px:m,py:h,pt:g,pb:x,pl:y,pr:b,bg:w,c:S,opacity:j,ff:_,fz:E,fw:I,lts:M,ta:R,lh:D,fs:A,tt:O,td:T,w:X,miw:B,maw:V,h:U,mih:N,mah:$,bgsz:q,bgp:F,bgr:Q,bga:Y,pos:se,top:ae,left:re,bottom:G,right:K,inset:ee,display:ce}=t,J=YG(t,["m","mx","my","mt","mb","ml","mr","p","px","py","pt","pb","pl","pr","bg","c","opacity","ff","fz","fw","lts","ta","lh","fs","tt","td","w","miw","maw","h","mih","mah","bgsz","bgp","bgr","bga","pos","top","left","bottom","right","inset","display"]);return{systemStyles:V9({m:n,mx:r,my:o,mt:s,mb:i,ml:l,mr:u,p,px:m,py:h,pt:g,pb:x,pl:y,pr:b,bg:w,c:S,opacity:j,ff:_,fz:E,fw:I,lts:M,ta:R,lh:D,fs:A,tt:O,td:T,w:X,miw:B,maw:V,h:U,mih:N,mah:$,bgsz:q,bgp:F,bgr:Q,bga:Y,pos:se,top:ae,left:re,bottom:G,right:K,inset:ee,display:ce}),rest:J}}function ZG(e,t){const n=Object.keys(e).filter(r=>r!=="base").sort((r,o)=>Uw(mt({size:r,sizes:t.breakpoints}))-Uw(mt({size:o,sizes:t.breakpoints})));return"base"in e?["base",...n]:n}function JG({value:e,theme:t,getValue:n,property:r}){if(e==null)return;if(typeof e=="object")return ZG(e,t).reduce((i,l)=>{if(l==="base"&&e.base!==void 0){const p=n(e.base,t);return Array.isArray(r)?(r.forEach(m=>{i[m]=p}),i):(i[r]=p,i)}const u=n(e[l],t);return Array.isArray(r)?(i[t.fn.largerThan(l)]={},r.forEach(p=>{i[t.fn.largerThan(l)][p]=u}),i):(i[t.fn.largerThan(l)]={[r]:u},i)},{});const o=n(e,t);return Array.isArray(r)?r.reduce((s,i)=>(s[i]=o,s),{}):{[r]:o}}function eK(e,t){return e==="dimmed"?t.colorScheme==="dark"?t.colors.dark[2]:t.colors.gray[6]:t.fn.variant({variant:"filled",color:e,primaryFallback:!1}).background}function tK(e){return Re(e)}function nK(e){return e}function rK(e,t){return mt({size:e,sizes:t.fontSizes})}const oK=["-xs","-sm","-md","-lg","-xl"];function sK(e,t){return oK.includes(e)?`calc(${mt({size:e.replace("-",""),sizes:t.spacing})} * -1)`:mt({size:e,sizes:t.spacing})}const aK={identity:nK,color:eK,size:tK,fontSize:rK,spacing:sK},iK={m:{type:"spacing",property:"margin"},mt:{type:"spacing",property:"marginTop"},mb:{type:"spacing",property:"marginBottom"},ml:{type:"spacing",property:"marginLeft"},mr:{type:"spacing",property:"marginRight"},mx:{type:"spacing",property:["marginRight","marginLeft"]},my:{type:"spacing",property:["marginTop","marginBottom"]},p:{type:"spacing",property:"padding"},pt:{type:"spacing",property:"paddingTop"},pb:{type:"spacing",property:"paddingBottom"},pl:{type:"spacing",property:"paddingLeft"},pr:{type:"spacing",property:"paddingRight"},px:{type:"spacing",property:["paddingRight","paddingLeft"]},py:{type:"spacing",property:["paddingTop","paddingBottom"]},bg:{type:"color",property:"background"},c:{type:"color",property:"color"},opacity:{type:"identity",property:"opacity"},ff:{type:"identity",property:"fontFamily"},fz:{type:"fontSize",property:"fontSize"},fw:{type:"identity",property:"fontWeight"},lts:{type:"size",property:"letterSpacing"},ta:{type:"identity",property:"textAlign"},lh:{type:"identity",property:"lineHeight"},fs:{type:"identity",property:"fontStyle"},tt:{type:"identity",property:"textTransform"},td:{type:"identity",property:"textDecoration"},w:{type:"spacing",property:"width"},miw:{type:"spacing",property:"minWidth"},maw:{type:"spacing",property:"maxWidth"},h:{type:"spacing",property:"height"},mih:{type:"spacing",property:"minHeight"},mah:{type:"spacing",property:"maxHeight"},bgsz:{type:"size",property:"backgroundSize"},bgp:{type:"identity",property:"backgroundPosition"},bgr:{type:"identity",property:"backgroundRepeat"},bga:{type:"identity",property:"backgroundAttachment"},pos:{type:"identity",property:"position"},top:{type:"identity",property:"top"},left:{type:"size",property:"left"},bottom:{type:"size",property:"bottom"},right:{type:"size",property:"right"},inset:{type:"size",property:"inset"},display:{type:"identity",property:"display"}};var lK=Object.defineProperty,s4=Object.getOwnPropertySymbols,cK=Object.prototype.hasOwnProperty,uK=Object.prototype.propertyIsEnumerable,a4=(e,t,n)=>t in e?lK(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,i4=(e,t)=>{for(var n in t||(t={}))cK.call(t,n)&&a4(e,n,t[n]);if(s4)for(var n of s4(t))uK.call(t,n)&&a4(e,n,t[n]);return e};function l4(e,t,n=iK){return Object.keys(n).reduce((o,s)=>(s in e&&e[s]!==void 0&&o.push(JG({value:e[s],getValue:aK[n[s].type],property:n[s].property,theme:t})),o),[]).reduce((o,s)=>(Object.keys(s).forEach(i=>{typeof s[i]=="object"&&s[i]!==null&&i in o?o[i]=i4(i4({},o[i]),s[i]):o[i]=s[i]}),o),{})}function c4(e,t){return typeof e=="function"?e(t):e}function dK(e,t,n){const r=xa(),{css:o,cx:s}=AP();return Array.isArray(e)?s(n,o(l4(t,r)),e.map(i=>o(c4(i,r)))):s(n,o(c4(e,r)),o(l4(t,r)))}var fK=Object.defineProperty,pm=Object.getOwnPropertySymbols,HP=Object.prototype.hasOwnProperty,VP=Object.prototype.propertyIsEnumerable,u4=(e,t,n)=>t in e?fK(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,pK=(e,t)=>{for(var n in t||(t={}))HP.call(t,n)&&u4(e,n,t[n]);if(pm)for(var n of pm(t))VP.call(t,n)&&u4(e,n,t[n]);return e},mK=(e,t)=>{var n={};for(var r in e)HP.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&pm)for(var r of pm(e))t.indexOf(r)<0&&VP.call(e,r)&&(n[r]=e[r]);return n};const WP=d.forwardRef((e,t)=>{var n=e,{className:r,component:o,style:s,sx:i}=n,l=mK(n,["className","component","style","sx"]);const{systemStyles:u,rest:p}=eg(l),m=o||"div";return H.createElement(m,pK({ref:t,className:dK(i,u,r),style:s},p))});WP.displayName="@mantine/core/Box";const zr=WP;var hK=Object.defineProperty,gK=Object.defineProperties,vK=Object.getOwnPropertyDescriptors,d4=Object.getOwnPropertySymbols,xK=Object.prototype.hasOwnProperty,bK=Object.prototype.propertyIsEnumerable,f4=(e,t,n)=>t in e?hK(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,p4=(e,t)=>{for(var n in t||(t={}))xK.call(t,n)&&f4(e,n,t[n]);if(d4)for(var n of d4(t))bK.call(t,n)&&f4(e,n,t[n]);return e},yK=(e,t)=>gK(e,vK(t)),CK=fr(e=>({root:yK(p4(p4({},e.fn.focusStyles()),e.fn.fontStyles()),{cursor:"pointer",border:0,padding:0,appearance:"none",fontSize:e.fontSizes.md,backgroundColor:"transparent",textAlign:"left",color:e.colorScheme==="dark"?e.colors.dark[0]:e.black,textDecoration:"none",boxSizing:"border-box"})}));const wK=CK;var SK=Object.defineProperty,mm=Object.getOwnPropertySymbols,UP=Object.prototype.hasOwnProperty,GP=Object.prototype.propertyIsEnumerable,m4=(e,t,n)=>t in e?SK(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,kK=(e,t)=>{for(var n in t||(t={}))UP.call(t,n)&&m4(e,n,t[n]);if(mm)for(var n of mm(t))GP.call(t,n)&&m4(e,n,t[n]);return e},jK=(e,t)=>{var n={};for(var r in e)UP.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&mm)for(var r of mm(e))t.indexOf(r)<0&&GP.call(e,r)&&(n[r]=e[r]);return n};const KP=d.forwardRef((e,t)=>{const n=Dn("UnstyledButton",{},e),{className:r,component:o="button",unstyled:s,variant:i}=n,l=jK(n,["className","component","unstyled","variant"]),{classes:u,cx:p}=wK(null,{name:"UnstyledButton",unstyled:s,variant:i});return H.createElement(zr,kK({component:o,ref:t,className:p(u.root,r),type:o==="button"?"button":void 0},l))});KP.displayName="@mantine/core/UnstyledButton";const _K=KP;var IK=Object.defineProperty,PK=Object.defineProperties,EK=Object.getOwnPropertyDescriptors,h4=Object.getOwnPropertySymbols,MK=Object.prototype.hasOwnProperty,OK=Object.prototype.propertyIsEnumerable,g4=(e,t,n)=>t in e?IK(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,J1=(e,t)=>{for(var n in t||(t={}))MK.call(t,n)&&g4(e,n,t[n]);if(h4)for(var n of h4(t))OK.call(t,n)&&g4(e,n,t[n]);return e},v4=(e,t)=>PK(e,EK(t));const RK=["subtle","filled","outline","light","default","transparent","gradient"],ip={xs:Re(18),sm:Re(22),md:Re(28),lg:Re(34),xl:Re(44)};function DK({variant:e,theme:t,color:n,gradient:r}){const o=t.fn.variant({color:n,variant:e,gradient:r});return e==="gradient"?{border:0,backgroundImage:o.background,color:o.color,"&:hover":t.fn.hover({backgroundSize:"200%"})}:RK.includes(e)?J1({border:`${Re(1)} solid ${o.border}`,backgroundColor:o.background,color:o.color},t.fn.hover({backgroundColor:o.hover})):null}var AK=fr((e,{radius:t,color:n,gradient:r},{variant:o,size:s})=>({root:v4(J1({position:"relative",borderRadius:e.fn.radius(t),padding:0,lineHeight:1,display:"flex",alignItems:"center",justifyContent:"center",height:mt({size:s,sizes:ip}),minHeight:mt({size:s,sizes:ip}),width:mt({size:s,sizes:ip}),minWidth:mt({size:s,sizes:ip})},DK({variant:o,theme:e,color:n,gradient:r})),{"&:active":e.activeStyles,"& [data-action-icon-loader]":{maxWidth:"70%"},"&:disabled, &[data-disabled]":{color:e.colors.gray[e.colorScheme==="dark"?6:4],cursor:"not-allowed",backgroundColor:o==="transparent"?void 0:e.fn.themeColor("gray",e.colorScheme==="dark"?8:1),borderColor:o==="transparent"?void 0:e.fn.themeColor("gray",e.colorScheme==="dark"?8:1),backgroundImage:"none",pointerEvents:"none","&:active":{transform:"none"}},"&[data-loading]":{pointerEvents:"none","&::before":v4(J1({content:'""'},e.fn.cover(Re(-1))),{backgroundColor:e.colorScheme==="dark"?e.fn.rgba(e.colors.dark[7],.5):"rgba(255, 255, 255, .5)",borderRadius:e.fn.radius(t),cursor:"not-allowed"})}})}));const TK=AK;var NK=Object.defineProperty,hm=Object.getOwnPropertySymbols,qP=Object.prototype.hasOwnProperty,XP=Object.prototype.propertyIsEnumerable,x4=(e,t,n)=>t in e?NK(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,b4=(e,t)=>{for(var n in t||(t={}))qP.call(t,n)&&x4(e,n,t[n]);if(hm)for(var n of hm(t))XP.call(t,n)&&x4(e,n,t[n]);return e},y4=(e,t)=>{var n={};for(var r in e)qP.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&hm)for(var r of hm(e))t.indexOf(r)<0&&XP.call(e,r)&&(n[r]=e[r]);return n};function $K(e){var t=e,{size:n,color:r}=t,o=y4(t,["size","color"]);const s=o,{style:i}=s,l=y4(s,["style"]);return H.createElement("svg",b4({viewBox:"0 0 135 140",xmlns:"http://www.w3.org/2000/svg",fill:r,style:b4({width:n},i)},l),H.createElement("rect",{y:"10",width:"15",height:"120",rx:"6"},H.createElement("animate",{attributeName:"height",begin:"0.5s",dur:"1s",values:"120;110;100;90;80;70;60;50;40;140;120",calcMode:"linear",repeatCount:"indefinite"}),H.createElement("animate",{attributeName:"y",begin:"0.5s",dur:"1s",values:"10;15;20;25;30;35;40;45;50;0;10",calcMode:"linear",repeatCount:"indefinite"})),H.createElement("rect",{x:"30",y:"10",width:"15",height:"120",rx:"6"},H.createElement("animate",{attributeName:"height",begin:"0.25s",dur:"1s",values:"120;110;100;90;80;70;60;50;40;140;120",calcMode:"linear",repeatCount:"indefinite"}),H.createElement("animate",{attributeName:"y",begin:"0.25s",dur:"1s",values:"10;15;20;25;30;35;40;45;50;0;10",calcMode:"linear",repeatCount:"indefinite"})),H.createElement("rect",{x:"60",width:"15",height:"140",rx:"6"},H.createElement("animate",{attributeName:"height",begin:"0s",dur:"1s",values:"120;110;100;90;80;70;60;50;40;140;120",calcMode:"linear",repeatCount:"indefinite"}),H.createElement("animate",{attributeName:"y",begin:"0s",dur:"1s",values:"10;15;20;25;30;35;40;45;50;0;10",calcMode:"linear",repeatCount:"indefinite"})),H.createElement("rect",{x:"90",y:"10",width:"15",height:"120",rx:"6"},H.createElement("animate",{attributeName:"height",begin:"0.25s",dur:"1s",values:"120;110;100;90;80;70;60;50;40;140;120",calcMode:"linear",repeatCount:"indefinite"}),H.createElement("animate",{attributeName:"y",begin:"0.25s",dur:"1s",values:"10;15;20;25;30;35;40;45;50;0;10",calcMode:"linear",repeatCount:"indefinite"})),H.createElement("rect",{x:"120",y:"10",width:"15",height:"120",rx:"6"},H.createElement("animate",{attributeName:"height",begin:"0.5s",dur:"1s",values:"120;110;100;90;80;70;60;50;40;140;120",calcMode:"linear",repeatCount:"indefinite"}),H.createElement("animate",{attributeName:"y",begin:"0.5s",dur:"1s",values:"10;15;20;25;30;35;40;45;50;0;10",calcMode:"linear",repeatCount:"indefinite"})))}var LK=Object.defineProperty,gm=Object.getOwnPropertySymbols,QP=Object.prototype.hasOwnProperty,YP=Object.prototype.propertyIsEnumerable,C4=(e,t,n)=>t in e?LK(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,w4=(e,t)=>{for(var n in t||(t={}))QP.call(t,n)&&C4(e,n,t[n]);if(gm)for(var n of gm(t))YP.call(t,n)&&C4(e,n,t[n]);return e},S4=(e,t)=>{var n={};for(var r in e)QP.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&gm)for(var r of gm(e))t.indexOf(r)<0&&YP.call(e,r)&&(n[r]=e[r]);return n};function zK(e){var t=e,{size:n,color:r}=t,o=S4(t,["size","color"]);const s=o,{style:i}=s,l=S4(s,["style"]);return H.createElement("svg",w4({viewBox:"0 0 38 38",xmlns:"http://www.w3.org/2000/svg",stroke:r,style:w4({width:n,height:n},i)},l),H.createElement("g",{fill:"none",fillRule:"evenodd"},H.createElement("g",{transform:"translate(2.5 2.5)",strokeWidth:"5"},H.createElement("circle",{strokeOpacity:".5",cx:"16",cy:"16",r:"16"}),H.createElement("path",{d:"M32 16c0-9.94-8.06-16-16-16"},H.createElement("animateTransform",{attributeName:"transform",type:"rotate",from:"0 16 16",to:"360 16 16",dur:"1s",repeatCount:"indefinite"})))))}var FK=Object.defineProperty,vm=Object.getOwnPropertySymbols,ZP=Object.prototype.hasOwnProperty,JP=Object.prototype.propertyIsEnumerable,k4=(e,t,n)=>t in e?FK(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,j4=(e,t)=>{for(var n in t||(t={}))ZP.call(t,n)&&k4(e,n,t[n]);if(vm)for(var n of vm(t))JP.call(t,n)&&k4(e,n,t[n]);return e},_4=(e,t)=>{var n={};for(var r in e)ZP.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&vm)for(var r of vm(e))t.indexOf(r)<0&&JP.call(e,r)&&(n[r]=e[r]);return n};function BK(e){var t=e,{size:n,color:r}=t,o=_4(t,["size","color"]);const s=o,{style:i}=s,l=_4(s,["style"]);return H.createElement("svg",j4({viewBox:"0 0 120 30",xmlns:"http://www.w3.org/2000/svg",fill:r,style:j4({width:n},i)},l),H.createElement("circle",{cx:"15",cy:"15",r:"15"},H.createElement("animate",{attributeName:"r",from:"15",to:"15",begin:"0s",dur:"0.8s",values:"15;9;15",calcMode:"linear",repeatCount:"indefinite"}),H.createElement("animate",{attributeName:"fill-opacity",from:"1",to:"1",begin:"0s",dur:"0.8s",values:"1;.5;1",calcMode:"linear",repeatCount:"indefinite"})),H.createElement("circle",{cx:"60",cy:"15",r:"9",fillOpacity:"0.3"},H.createElement("animate",{attributeName:"r",from:"9",to:"9",begin:"0s",dur:"0.8s",values:"9;15;9",calcMode:"linear",repeatCount:"indefinite"}),H.createElement("animate",{attributeName:"fill-opacity",from:"0.5",to:"0.5",begin:"0s",dur:"0.8s",values:".5;1;.5",calcMode:"linear",repeatCount:"indefinite"})),H.createElement("circle",{cx:"105",cy:"15",r:"15"},H.createElement("animate",{attributeName:"r",from:"15",to:"15",begin:"0s",dur:"0.8s",values:"15;9;15",calcMode:"linear",repeatCount:"indefinite"}),H.createElement("animate",{attributeName:"fill-opacity",from:"1",to:"1",begin:"0s",dur:"0.8s",values:"1;.5;1",calcMode:"linear",repeatCount:"indefinite"})))}var HK=Object.defineProperty,xm=Object.getOwnPropertySymbols,e6=Object.prototype.hasOwnProperty,t6=Object.prototype.propertyIsEnumerable,I4=(e,t,n)=>t in e?HK(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,VK=(e,t)=>{for(var n in t||(t={}))e6.call(t,n)&&I4(e,n,t[n]);if(xm)for(var n of xm(t))t6.call(t,n)&&I4(e,n,t[n]);return e},WK=(e,t)=>{var n={};for(var r in e)e6.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&xm)for(var r of xm(e))t.indexOf(r)<0&&t6.call(e,r)&&(n[r]=e[r]);return n};const _v={bars:$K,oval:zK,dots:BK},UK={xs:Re(18),sm:Re(22),md:Re(36),lg:Re(44),xl:Re(58)},GK={size:"md"};function n6(e){const t=Dn("Loader",GK,e),{size:n,color:r,variant:o}=t,s=WK(t,["size","color","variant"]),i=xa(),l=o in _v?o:i.loader;return H.createElement(zr,VK({role:"presentation",component:_v[l]||_v.bars,size:mt({size:n,sizes:UK}),color:i.fn.variant({variant:"filled",primaryFallback:!1,color:r||i.primaryColor}).background},s))}n6.displayName="@mantine/core/Loader";var KK=Object.defineProperty,bm=Object.getOwnPropertySymbols,r6=Object.prototype.hasOwnProperty,o6=Object.prototype.propertyIsEnumerable,P4=(e,t,n)=>t in e?KK(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,E4=(e,t)=>{for(var n in t||(t={}))r6.call(t,n)&&P4(e,n,t[n]);if(bm)for(var n of bm(t))o6.call(t,n)&&P4(e,n,t[n]);return e},qK=(e,t)=>{var n={};for(var r in e)r6.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&bm)for(var r of bm(e))t.indexOf(r)<0&&o6.call(e,r)&&(n[r]=e[r]);return n};const XK={color:"gray",size:"md",variant:"subtle"},s6=d.forwardRef((e,t)=>{const n=Dn("ActionIcon",XK,e),{className:r,color:o,children:s,radius:i,size:l,variant:u,gradient:p,disabled:m,loaderProps:h,loading:g,unstyled:x,__staticSelector:y}=n,b=qK(n,["className","color","children","radius","size","variant","gradient","disabled","loaderProps","loading","unstyled","__staticSelector"]),{classes:w,cx:S,theme:j}=TK({radius:i,color:o,gradient:p},{name:["ActionIcon",y],unstyled:x,size:l,variant:u}),_=H.createElement(n6,E4({color:j.fn.variant({color:o,variant:u}).color,size:"100%","data-action-icon-loader":!0},h));return H.createElement(_K,E4({className:S(w.root,r),ref:t,disabled:m,"data-disabled":m||void 0,"data-loading":g||void 0,unstyled:x},b),g?_:s)});s6.displayName="@mantine/core/ActionIcon";const QK=s6;var YK=Object.defineProperty,ZK=Object.defineProperties,JK=Object.getOwnPropertyDescriptors,ym=Object.getOwnPropertySymbols,a6=Object.prototype.hasOwnProperty,i6=Object.prototype.propertyIsEnumerable,M4=(e,t,n)=>t in e?YK(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,eq=(e,t)=>{for(var n in t||(t={}))a6.call(t,n)&&M4(e,n,t[n]);if(ym)for(var n of ym(t))i6.call(t,n)&&M4(e,n,t[n]);return e},tq=(e,t)=>ZK(e,JK(t)),nq=(e,t)=>{var n={};for(var r in e)a6.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&ym)for(var r of ym(e))t.indexOf(r)<0&&i6.call(e,r)&&(n[r]=e[r]);return n};function l6(e){const t=Dn("Portal",{},e),{children:n,target:r,className:o,innerRef:s}=t,i=nq(t,["children","target","className","innerRef"]),l=xa(),[u,p]=d.useState(!1),m=d.useRef();return TP(()=>(p(!0),m.current=r?typeof r=="string"?document.querySelector(r):r:document.createElement("div"),r||document.body.appendChild(m.current),()=>{!r&&document.body.removeChild(m.current)}),[r]),u?qr.createPortal(H.createElement("div",tq(eq({className:o,dir:l.dir},i),{ref:s}),n),m.current):null}l6.displayName="@mantine/core/Portal";var rq=Object.defineProperty,Cm=Object.getOwnPropertySymbols,c6=Object.prototype.hasOwnProperty,u6=Object.prototype.propertyIsEnumerable,O4=(e,t,n)=>t in e?rq(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,oq=(e,t)=>{for(var n in t||(t={}))c6.call(t,n)&&O4(e,n,t[n]);if(Cm)for(var n of Cm(t))u6.call(t,n)&&O4(e,n,t[n]);return e},sq=(e,t)=>{var n={};for(var r in e)c6.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Cm)for(var r of Cm(e))t.indexOf(r)<0&&u6.call(e,r)&&(n[r]=e[r]);return n};function d6(e){var t=e,{withinPortal:n=!0,children:r}=t,o=sq(t,["withinPortal","children"]);return n?H.createElement(l6,oq({},o),r):H.createElement(H.Fragment,null,r)}d6.displayName="@mantine/core/OptionalPortal";var aq=Object.defineProperty,wm=Object.getOwnPropertySymbols,f6=Object.prototype.hasOwnProperty,p6=Object.prototype.propertyIsEnumerable,R4=(e,t,n)=>t in e?aq(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,D4=(e,t)=>{for(var n in t||(t={}))f6.call(t,n)&&R4(e,n,t[n]);if(wm)for(var n of wm(t))p6.call(t,n)&&R4(e,n,t[n]);return e},iq=(e,t)=>{var n={};for(var r in e)f6.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&wm)for(var r of wm(e))t.indexOf(r)<0&&p6.call(e,r)&&(n[r]=e[r]);return n};function m6(e){const t=e,{width:n,height:r,style:o}=t,s=iq(t,["width","height","style"]);return H.createElement("svg",D4({viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:D4({width:n,height:r},o)},s),H.createElement("path",{d:"M11.7816 4.03157C12.0062 3.80702 12.0062 3.44295 11.7816 3.2184C11.5571 2.99385 11.193 2.99385 10.9685 3.2184L7.50005 6.68682L4.03164 3.2184C3.80708 2.99385 3.44301 2.99385 3.21846 3.2184C2.99391 3.44295 2.99391 3.80702 3.21846 4.03157L6.68688 7.49999L3.21846 10.9684C2.99391 11.193 2.99391 11.557 3.21846 11.7816C3.44301 12.0061 3.80708 12.0061 4.03164 11.7816L7.50005 8.31316L10.9685 11.7816C11.193 12.0061 11.5571 12.0061 11.7816 11.7816C12.0062 11.557 12.0062 11.193 11.7816 10.9684L8.31322 7.49999L11.7816 4.03157Z",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd"}))}m6.displayName="@mantine/core/CloseIcon";var lq=Object.defineProperty,Sm=Object.getOwnPropertySymbols,h6=Object.prototype.hasOwnProperty,g6=Object.prototype.propertyIsEnumerable,A4=(e,t,n)=>t in e?lq(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,cq=(e,t)=>{for(var n in t||(t={}))h6.call(t,n)&&A4(e,n,t[n]);if(Sm)for(var n of Sm(t))g6.call(t,n)&&A4(e,n,t[n]);return e},uq=(e,t)=>{var n={};for(var r in e)h6.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Sm)for(var r of Sm(e))t.indexOf(r)<0&&g6.call(e,r)&&(n[r]=e[r]);return n};const dq={xs:Re(12),sm:Re(16),md:Re(20),lg:Re(28),xl:Re(34)},fq={size:"sm"},v6=d.forwardRef((e,t)=>{const n=Dn("CloseButton",fq,e),{iconSize:r,size:o,children:s}=n,i=uq(n,["iconSize","size","children"]),l=Re(r||dq[o]);return H.createElement(QK,cq({ref:t,__staticSelector:"CloseButton",size:o},i),s||H.createElement(m6,{width:l,height:l}))});v6.displayName="@mantine/core/CloseButton";const x6=v6;var pq=Object.defineProperty,mq=Object.defineProperties,hq=Object.getOwnPropertyDescriptors,T4=Object.getOwnPropertySymbols,gq=Object.prototype.hasOwnProperty,vq=Object.prototype.propertyIsEnumerable,N4=(e,t,n)=>t in e?pq(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,lp=(e,t)=>{for(var n in t||(t={}))gq.call(t,n)&&N4(e,n,t[n]);if(T4)for(var n of T4(t))vq.call(t,n)&&N4(e,n,t[n]);return e},xq=(e,t)=>mq(e,hq(t));function bq({underline:e,strikethrough:t}){const n=[];return e&&n.push("underline"),t&&n.push("line-through"),n.length>0?n.join(" "):"none"}function yq({theme:e,color:t}){return t==="dimmed"?e.fn.dimmed():typeof t=="string"&&(t in e.colors||t.split(".")[0]in e.colors)?e.fn.variant({variant:"filled",color:t}).background:t||"inherit"}function Cq(e){return typeof e=="number"?{overflow:"hidden",textOverflow:"ellipsis",display:"-webkit-box",WebkitLineClamp:e,WebkitBoxOrient:"vertical"}:null}function wq({theme:e,truncate:t}){return t==="start"?{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",direction:e.dir==="ltr"?"rtl":"ltr",textAlign:e.dir==="ltr"?"right":"left"}:t?{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}:null}var Sq=fr((e,{color:t,lineClamp:n,truncate:r,inline:o,inherit:s,underline:i,gradient:l,weight:u,transform:p,align:m,strikethrough:h,italic:g},{size:x})=>{const y=e.fn.variant({variant:"gradient",gradient:l});return{root:xq(lp(lp(lp(lp({},e.fn.fontStyles()),e.fn.focusStyles()),Cq(n)),wq({theme:e,truncate:r})),{color:yq({color:t,theme:e}),fontFamily:s?"inherit":e.fontFamily,fontSize:s||x===void 0?"inherit":mt({size:x,sizes:e.fontSizes}),lineHeight:s?"inherit":o?1:e.lineHeight,textDecoration:bq({underline:i,strikethrough:h}),WebkitTapHighlightColor:"transparent",fontWeight:s?"inherit":u,textTransform:p,textAlign:m,fontStyle:g?"italic":void 0}),gradient:{backgroundImage:y.background,WebkitBackgroundClip:"text",WebkitTextFillColor:"transparent"}}});const kq=Sq;var jq=Object.defineProperty,km=Object.getOwnPropertySymbols,b6=Object.prototype.hasOwnProperty,y6=Object.prototype.propertyIsEnumerable,$4=(e,t,n)=>t in e?jq(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,_q=(e,t)=>{for(var n in t||(t={}))b6.call(t,n)&&$4(e,n,t[n]);if(km)for(var n of km(t))y6.call(t,n)&&$4(e,n,t[n]);return e},Iq=(e,t)=>{var n={};for(var r in e)b6.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&km)for(var r of km(e))t.indexOf(r)<0&&y6.call(e,r)&&(n[r]=e[r]);return n};const Pq={variant:"text"},C6=d.forwardRef((e,t)=>{const n=Dn("Text",Pq,e),{className:r,size:o,weight:s,transform:i,color:l,align:u,variant:p,lineClamp:m,truncate:h,gradient:g,inline:x,inherit:y,underline:b,strikethrough:w,italic:S,classNames:j,styles:_,unstyled:E,span:I,__staticSelector:M}=n,R=Iq(n,["className","size","weight","transform","color","align","variant","lineClamp","truncate","gradient","inline","inherit","underline","strikethrough","italic","classNames","styles","unstyled","span","__staticSelector"]),{classes:D,cx:A}=kq({color:l,lineClamp:m,truncate:h,inline:x,inherit:y,underline:b,strikethrough:w,italic:S,weight:s,transform:i,align:u,gradient:g},{unstyled:E,name:M||"Text",variant:p,size:o});return H.createElement(zr,_q({ref:t,className:A(D.root,{[D.gradient]:p==="gradient"},r),component:I?"span":"div"},R))});C6.displayName="@mantine/core/Text";const wc=C6,cp={xs:Re(1),sm:Re(2),md:Re(3),lg:Re(4),xl:Re(5)};function up(e,t){const n=e.fn.variant({variant:"outline",color:t}).border;return typeof t=="string"&&(t in e.colors||t.split(".")[0]in e.colors)?n:t===void 0?e.colorScheme==="dark"?e.colors.dark[4]:e.colors.gray[4]:t}var Eq=fr((e,{color:t},{size:n,variant:r})=>({root:{},withLabel:{borderTop:"0 !important"},left:{"&::before":{display:"none"}},right:{"&::after":{display:"none"}},label:{display:"flex",alignItems:"center","&::before":{content:'""',flex:1,height:Re(1),borderTop:`${mt({size:n,sizes:cp})} ${r} ${up(e,t)}`,marginRight:e.spacing.xs},"&::after":{content:'""',flex:1,borderTop:`${mt({size:n,sizes:cp})} ${r} ${up(e,t)}`,marginLeft:e.spacing.xs}},labelDefaultStyles:{color:t==="dark"?e.colors.dark[1]:e.fn.themeColor(t,e.colorScheme==="dark"?5:e.fn.primaryShade(),!1)},horizontal:{border:0,borderTopWidth:Re(mt({size:n,sizes:cp})),borderTopColor:up(e,t),borderTopStyle:r,margin:0},vertical:{border:0,alignSelf:"stretch",height:"auto",borderLeftWidth:Re(mt({size:n,sizes:cp})),borderLeftColor:up(e,t),borderLeftStyle:r}}));const Mq=Eq;var Oq=Object.defineProperty,Rq=Object.defineProperties,Dq=Object.getOwnPropertyDescriptors,jm=Object.getOwnPropertySymbols,w6=Object.prototype.hasOwnProperty,S6=Object.prototype.propertyIsEnumerable,L4=(e,t,n)=>t in e?Oq(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,z4=(e,t)=>{for(var n in t||(t={}))w6.call(t,n)&&L4(e,n,t[n]);if(jm)for(var n of jm(t))S6.call(t,n)&&L4(e,n,t[n]);return e},Aq=(e,t)=>Rq(e,Dq(t)),Tq=(e,t)=>{var n={};for(var r in e)w6.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&jm)for(var r of jm(e))t.indexOf(r)<0&&S6.call(e,r)&&(n[r]=e[r]);return n};const Nq={orientation:"horizontal",size:"xs",labelPosition:"left",variant:"solid"},ex=d.forwardRef((e,t)=>{const n=Dn("Divider",Nq,e),{className:r,color:o,orientation:s,size:i,label:l,labelPosition:u,labelProps:p,variant:m,styles:h,classNames:g,unstyled:x}=n,y=Tq(n,["className","color","orientation","size","label","labelPosition","labelProps","variant","styles","classNames","unstyled"]),{classes:b,cx:w}=Mq({color:o},{classNames:g,styles:h,unstyled:x,name:"Divider",variant:m,size:i}),S=s==="vertical",j=s==="horizontal",_=!!l&&j,E=!(p!=null&&p.color);return H.createElement(zr,z4({ref:t,className:w(b.root,{[b.vertical]:S,[b.horizontal]:j,[b.withLabel]:_},r),role:"separator"},y),_&&H.createElement(wc,Aq(z4({},p),{size:(p==null?void 0:p.size)||"xs",mt:Re(2),className:w(b.label,b[u],{[b.labelDefaultStyles]:E})}),l))});ex.displayName="@mantine/core/Divider";var $q=Object.defineProperty,Lq=Object.defineProperties,zq=Object.getOwnPropertyDescriptors,F4=Object.getOwnPropertySymbols,Fq=Object.prototype.hasOwnProperty,Bq=Object.prototype.propertyIsEnumerable,B4=(e,t,n)=>t in e?$q(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,H4=(e,t)=>{for(var n in t||(t={}))Fq.call(t,n)&&B4(e,n,t[n]);if(F4)for(var n of F4(t))Bq.call(t,n)&&B4(e,n,t[n]);return e},Hq=(e,t)=>Lq(e,zq(t)),Vq=fr((e,t,{size:n})=>({item:Hq(H4({},e.fn.fontStyles()),{boxSizing:"border-box",wordBreak:"break-all",textAlign:"left",width:"100%",padding:`calc(${mt({size:n,sizes:e.spacing})} / 1.5) ${mt({size:n,sizes:e.spacing})}`,cursor:"pointer",fontSize:mt({size:n,sizes:e.fontSizes}),color:e.colorScheme==="dark"?e.colors.dark[0]:e.black,borderRadius:e.fn.radius(),"&[data-hovered]":{backgroundColor:e.colorScheme==="dark"?e.colors.dark[4]:e.colors.gray[1]},"&[data-selected]":H4({backgroundColor:e.fn.variant({variant:"filled"}).background,color:e.fn.variant({variant:"filled"}).color},e.fn.hover({backgroundColor:e.fn.variant({variant:"filled"}).hover})),"&[data-disabled]":{cursor:"default",color:e.colors.dark[2]}}),nothingFound:{boxSizing:"border-box",color:e.colors.gray[6],paddingTop:`calc(${mt({size:n,sizes:e.spacing})} / 2)`,paddingBottom:`calc(${mt({size:n,sizes:e.spacing})} / 2)`,textAlign:"center"},separator:{boxSizing:"border-box",textAlign:"left",width:"100%",padding:`calc(${mt({size:n,sizes:e.spacing})} / 1.5) ${mt({size:n,sizes:e.spacing})}`},separatorLabel:{color:e.colorScheme==="dark"?e.colors.dark[3]:e.colors.gray[5]}}));const Wq=Vq;var Uq=Object.defineProperty,V4=Object.getOwnPropertySymbols,Gq=Object.prototype.hasOwnProperty,Kq=Object.prototype.propertyIsEnumerable,W4=(e,t,n)=>t in e?Uq(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,qq=(e,t)=>{for(var n in t||(t={}))Gq.call(t,n)&&W4(e,n,t[n]);if(V4)for(var n of V4(t))Kq.call(t,n)&&W4(e,n,t[n]);return e};function ty({data:e,hovered:t,classNames:n,styles:r,isItemSelected:o,uuid:s,__staticSelector:i,onItemHover:l,onItemSelect:u,itemsRefs:p,itemComponent:m,size:h,nothingFound:g,creatable:x,createLabel:y,unstyled:b,variant:w}){const{classes:S}=Wq(null,{classNames:n,styles:r,unstyled:b,name:i,variant:w,size:h}),j=[],_=[];let E=null;const I=(R,D)=>{const A=typeof o=="function"?o(R.value):!1;return H.createElement(m,qq({key:R.value,className:S.item,"data-disabled":R.disabled||void 0,"data-hovered":!R.disabled&&t===D||void 0,"data-selected":!R.disabled&&A||void 0,selected:A,onMouseEnter:()=>l(D),id:`${s}-${D}`,role:"option",tabIndex:-1,"aria-selected":t===D,ref:O=>{p&&p.current&&(p.current[R.value]=O)},onMouseDown:R.disabled?null:O=>{O.preventDefault(),u(R)},disabled:R.disabled,variant:w},R))};let M=null;if(e.forEach((R,D)=>{R.creatable?E=D:R.group?(M!==R.group&&(M=R.group,_.push(H.createElement("div",{className:S.separator,key:`__mantine-divider-${D}`},H.createElement(ex,{classNames:{label:S.separatorLabel},label:R.group})))),_.push(I(R,D))):j.push(I(R,D))}),x){const R=e[E];j.push(H.createElement("div",{key:Jb(),className:S.item,"data-hovered":t===E||void 0,onMouseEnter:()=>l(E),onMouseDown:D=>{D.preventDefault(),u(R)},tabIndex:-1,ref:D=>{p&&p.current&&(p.current[R.value]=D)}},y))}return _.length>0&&j.length>0&&j.unshift(H.createElement("div",{className:S.separator,key:"empty-group-separator"},H.createElement(ex,null))),_.length>0||j.length>0?H.createElement(H.Fragment,null,_,j):H.createElement(wc,{size:h,unstyled:b,className:S.nothingFound},g)}ty.displayName="@mantine/core/SelectItems";var Xq=Object.defineProperty,_m=Object.getOwnPropertySymbols,k6=Object.prototype.hasOwnProperty,j6=Object.prototype.propertyIsEnumerable,U4=(e,t,n)=>t in e?Xq(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Qq=(e,t)=>{for(var n in t||(t={}))k6.call(t,n)&&U4(e,n,t[n]);if(_m)for(var n of _m(t))j6.call(t,n)&&U4(e,n,t[n]);return e},Yq=(e,t)=>{var n={};for(var r in e)k6.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&_m)for(var r of _m(e))t.indexOf(r)<0&&j6.call(e,r)&&(n[r]=e[r]);return n};const ny=d.forwardRef((e,t)=>{var n=e,{label:r,value:o}=n,s=Yq(n,["label","value"]);return H.createElement("div",Qq({ref:t},s),r||o)});ny.displayName="@mantine/core/DefaultItem";function Zq(e,t){typeof e=="function"?e(t):e!=null&&(e.current=t)}function _6(...e){return t=>e.forEach(n=>Zq(n,t))}function al(...e){return d.useCallback(_6(...e),e)}const I6=d.forwardRef((e,t)=>{const{children:n,...r}=e,o=d.Children.toArray(n),s=o.find(eX);if(s){const i=s.props.children,l=o.map(u=>u===s?d.Children.count(i)>1?d.Children.only(null):d.isValidElement(i)?i.props.children:null:u);return d.createElement(tx,mn({},r,{ref:t}),d.isValidElement(i)?d.cloneElement(i,void 0,l):null)}return d.createElement(tx,mn({},r,{ref:t}),n)});I6.displayName="Slot";const tx=d.forwardRef((e,t)=>{const{children:n,...r}=e;return d.isValidElement(n)?d.cloneElement(n,{...tX(r,n.props),ref:_6(t,n.ref)}):d.Children.count(n)>1?d.Children.only(null):null});tx.displayName="SlotClone";const Jq=({children:e})=>d.createElement(d.Fragment,null,e);function eX(e){return d.isValidElement(e)&&e.type===Jq}function tX(e,t){const n={...t};for(const r in t){const o=e[r],s=t[r];/^on[A-Z]/.test(r)?o&&s?n[r]=(...l)=>{s(...l),o(...l)}:o&&(n[r]=o):r==="style"?n[r]={...o,...s}:r==="className"&&(n[r]=[o,s].filter(Boolean).join(" "))}return{...e,...n}}const nX=["a","button","div","h2","h3","img","label","li","nav","ol","p","span","svg","ul"],Hd=nX.reduce((e,t)=>{const n=d.forwardRef((r,o)=>{const{asChild:s,...i}=r,l=s?I6:t;return d.useEffect(()=>{window[Symbol.for("radix-ui")]=!0},[]),d.createElement(l,mn({},i,{ref:o}))});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{}),nx=globalThis!=null&&globalThis.document?d.useLayoutEffect:()=>{};function rX(e,t){return d.useReducer((n,r)=>{const o=t[n][r];return o??n},e)}const Vd=e=>{const{present:t,children:n}=e,r=oX(t),o=typeof n=="function"?n({present:r.isPresent}):d.Children.only(n),s=al(r.ref,o.ref);return typeof n=="function"||r.isPresent?d.cloneElement(o,{ref:s}):null};Vd.displayName="Presence";function oX(e){const[t,n]=d.useState(),r=d.useRef({}),o=d.useRef(e),s=d.useRef("none"),i=e?"mounted":"unmounted",[l,u]=rX(i,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return d.useEffect(()=>{const p=dp(r.current);s.current=l==="mounted"?p:"none"},[l]),nx(()=>{const p=r.current,m=o.current;if(m!==e){const g=s.current,x=dp(p);e?u("MOUNT"):x==="none"||(p==null?void 0:p.display)==="none"?u("UNMOUNT"):u(m&&g!==x?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,u]),nx(()=>{if(t){const p=h=>{const x=dp(r.current).includes(h.animationName);h.target===t&&x&&qr.flushSync(()=>u("ANIMATION_END"))},m=h=>{h.target===t&&(s.current=dp(r.current))};return t.addEventListener("animationstart",m),t.addEventListener("animationcancel",p),t.addEventListener("animationend",p),()=>{t.removeEventListener("animationstart",m),t.removeEventListener("animationcancel",p),t.removeEventListener("animationend",p)}}else u("ANIMATION_END")},[t,u]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:d.useCallback(p=>{p&&(r.current=getComputedStyle(p)),n(p)},[])}}function dp(e){return(e==null?void 0:e.animationName)||"none"}function sX(e,t=[]){let n=[];function r(s,i){const l=d.createContext(i),u=n.length;n=[...n,i];function p(h){const{scope:g,children:x,...y}=h,b=(g==null?void 0:g[e][u])||l,w=d.useMemo(()=>y,Object.values(y));return d.createElement(b.Provider,{value:w},x)}function m(h,g){const x=(g==null?void 0:g[e][u])||l,y=d.useContext(x);if(y)return y;if(i!==void 0)return i;throw new Error(`\`${h}\` must be used within \`${s}\``)}return p.displayName=s+"Provider",[p,m]}const o=()=>{const s=n.map(i=>d.createContext(i));return function(l){const u=(l==null?void 0:l[e])||s;return d.useMemo(()=>({[`__scope${e}`]:{...l,[e]:u}}),[l,u])}};return o.scopeName=e,[r,aX(o,...t)]}function aX(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(s){const i=r.reduce((l,{useScope:u,scopeName:p})=>{const h=u(s)[`__scope${p}`];return{...l,...h}},{});return d.useMemo(()=>({[`__scope${t.scopeName}`]:i}),[i])}};return n.scopeName=t.scopeName,n}function Pi(e){const t=d.useRef(e);return d.useEffect(()=>{t.current=e}),d.useMemo(()=>(...n)=>{var r;return(r=t.current)===null||r===void 0?void 0:r.call(t,...n)},[])}const iX=d.createContext(void 0);function lX(e){const t=d.useContext(iX);return e||t||"ltr"}function cX(e,[t,n]){return Math.min(n,Math.max(t,e))}function Ni(e,t,{checkForDefaultPrevented:n=!0}={}){return function(o){if(e==null||e(o),n===!1||!o.defaultPrevented)return t==null?void 0:t(o)}}function uX(e,t){return d.useReducer((n,r)=>{const o=t[n][r];return o??n},e)}const P6="ScrollArea",[E6,N1e]=sX(P6),[dX,_o]=E6(P6),fX=d.forwardRef((e,t)=>{const{__scopeScrollArea:n,type:r="hover",dir:o,scrollHideDelay:s=600,...i}=e,[l,u]=d.useState(null),[p,m]=d.useState(null),[h,g]=d.useState(null),[x,y]=d.useState(null),[b,w]=d.useState(null),[S,j]=d.useState(0),[_,E]=d.useState(0),[I,M]=d.useState(!1),[R,D]=d.useState(!1),A=al(t,T=>u(T)),O=lX(o);return d.createElement(dX,{scope:n,type:r,dir:O,scrollHideDelay:s,scrollArea:l,viewport:p,onViewportChange:m,content:h,onContentChange:g,scrollbarX:x,onScrollbarXChange:y,scrollbarXEnabled:I,onScrollbarXEnabledChange:M,scrollbarY:b,onScrollbarYChange:w,scrollbarYEnabled:R,onScrollbarYEnabledChange:D,onCornerWidthChange:j,onCornerHeightChange:E},d.createElement(Hd.div,mn({dir:O},i,{ref:A,style:{position:"relative","--radix-scroll-area-corner-width":S+"px","--radix-scroll-area-corner-height":_+"px",...e.style}})))}),pX="ScrollAreaViewport",mX=d.forwardRef((e,t)=>{const{__scopeScrollArea:n,children:r,...o}=e,s=_o(pX,n),i=d.useRef(null),l=al(t,i,s.onViewportChange);return d.createElement(d.Fragment,null,d.createElement("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}"}}),d.createElement(Hd.div,mn({"data-radix-scroll-area-viewport":""},o,{ref:l,style:{overflowX:s.scrollbarXEnabled?"scroll":"hidden",overflowY:s.scrollbarYEnabled?"scroll":"hidden",...e.style}}),d.createElement("div",{ref:s.onContentChange,style:{minWidth:"100%",display:"table"}},r)))}),ya="ScrollAreaScrollbar",hX=d.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=_o(ya,e.__scopeScrollArea),{onScrollbarXEnabledChange:s,onScrollbarYEnabledChange:i}=o,l=e.orientation==="horizontal";return d.useEffect(()=>(l?s(!0):i(!0),()=>{l?s(!1):i(!1)}),[l,s,i]),o.type==="hover"?d.createElement(gX,mn({},r,{ref:t,forceMount:n})):o.type==="scroll"?d.createElement(vX,mn({},r,{ref:t,forceMount:n})):o.type==="auto"?d.createElement(M6,mn({},r,{ref:t,forceMount:n})):o.type==="always"?d.createElement(ry,mn({},r,{ref:t})):null}),gX=d.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=_o(ya,e.__scopeScrollArea),[s,i]=d.useState(!1);return d.useEffect(()=>{const l=o.scrollArea;let u=0;if(l){const p=()=>{window.clearTimeout(u),i(!0)},m=()=>{u=window.setTimeout(()=>i(!1),o.scrollHideDelay)};return l.addEventListener("pointerenter",p),l.addEventListener("pointerleave",m),()=>{window.clearTimeout(u),l.removeEventListener("pointerenter",p),l.removeEventListener("pointerleave",m)}}},[o.scrollArea,o.scrollHideDelay]),d.createElement(Vd,{present:n||s},d.createElement(M6,mn({"data-state":s?"visible":"hidden"},r,{ref:t})))}),vX=d.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=_o(ya,e.__scopeScrollArea),s=e.orientation==="horizontal",i=ng(()=>u("SCROLL_END"),100),[l,u]=uX("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 d.useEffect(()=>{if(l==="idle"){const p=window.setTimeout(()=>u("HIDE"),o.scrollHideDelay);return()=>window.clearTimeout(p)}},[l,o.scrollHideDelay,u]),d.useEffect(()=>{const p=o.viewport,m=s?"scrollLeft":"scrollTop";if(p){let h=p[m];const g=()=>{const x=p[m];h!==x&&(u("SCROLL"),i()),h=x};return p.addEventListener("scroll",g),()=>p.removeEventListener("scroll",g)}},[o.viewport,s,u,i]),d.createElement(Vd,{present:n||l!=="hidden"},d.createElement(ry,mn({"data-state":l==="hidden"?"hidden":"visible"},r,{ref:t,onPointerEnter:Ni(e.onPointerEnter,()=>u("POINTER_ENTER")),onPointerLeave:Ni(e.onPointerLeave,()=>u("POINTER_LEAVE"))})))}),M6=d.forwardRef((e,t)=>{const n=_o(ya,e.__scopeScrollArea),{forceMount:r,...o}=e,[s,i]=d.useState(!1),l=e.orientation==="horizontal",u=ng(()=>{if(n.viewport){const p=n.viewport.offsetWidth{const{orientation:n="vertical",...r}=e,o=_o(ya,e.__scopeScrollArea),s=d.useRef(null),i=d.useRef(0),[l,u]=d.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),p=A6(l.viewport,l.content),m={...r,sizes:l,onSizesChange:u,hasThumb:p>0&&p<1,onThumbChange:g=>s.current=g,onThumbPointerUp:()=>i.current=0,onThumbPointerDown:g=>i.current=g};function h(g,x){return jX(g,i.current,l,x)}return n==="horizontal"?d.createElement(xX,mn({},m,{ref:t,onThumbPositionChange:()=>{if(o.viewport&&s.current){const g=o.viewport.scrollLeft,x=G4(g,l,o.dir);s.current.style.transform=`translate3d(${x}px, 0, 0)`}},onWheelScroll:g=>{o.viewport&&(o.viewport.scrollLeft=g)},onDragScroll:g=>{o.viewport&&(o.viewport.scrollLeft=h(g,o.dir))}})):n==="vertical"?d.createElement(bX,mn({},m,{ref:t,onThumbPositionChange:()=>{if(o.viewport&&s.current){const g=o.viewport.scrollTop,x=G4(g,l);s.current.style.transform=`translate3d(0, ${x}px, 0)`}},onWheelScroll:g=>{o.viewport&&(o.viewport.scrollTop=g)},onDragScroll:g=>{o.viewport&&(o.viewport.scrollTop=h(g))}})):null}),xX=d.forwardRef((e,t)=>{const{sizes:n,onSizesChange:r,...o}=e,s=_o(ya,e.__scopeScrollArea),[i,l]=d.useState(),u=d.useRef(null),p=al(t,u,s.onScrollbarXChange);return d.useEffect(()=>{u.current&&l(getComputedStyle(u.current))},[u]),d.createElement(R6,mn({"data-orientation":"horizontal"},o,{ref:p,sizes:n,style:{bottom:0,left:s.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:s.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":tg(n)+"px",...e.style},onThumbPointerDown:m=>e.onThumbPointerDown(m.x),onDragScroll:m=>e.onDragScroll(m.x),onWheelScroll:(m,h)=>{if(s.viewport){const g=s.viewport.scrollLeft+m.deltaX;e.onWheelScroll(g),N6(g,h)&&m.preventDefault()}},onResize:()=>{u.current&&s.viewport&&i&&r({content:s.viewport.scrollWidth,viewport:s.viewport.offsetWidth,scrollbar:{size:u.current.clientWidth,paddingStart:Im(i.paddingLeft),paddingEnd:Im(i.paddingRight)}})}}))}),bX=d.forwardRef((e,t)=>{const{sizes:n,onSizesChange:r,...o}=e,s=_o(ya,e.__scopeScrollArea),[i,l]=d.useState(),u=d.useRef(null),p=al(t,u,s.onScrollbarYChange);return d.useEffect(()=>{u.current&&l(getComputedStyle(u.current))},[u]),d.createElement(R6,mn({"data-orientation":"vertical"},o,{ref:p,sizes:n,style:{top:0,right:s.dir==="ltr"?0:void 0,left:s.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":tg(n)+"px",...e.style},onThumbPointerDown:m=>e.onThumbPointerDown(m.y),onDragScroll:m=>e.onDragScroll(m.y),onWheelScroll:(m,h)=>{if(s.viewport){const g=s.viewport.scrollTop+m.deltaY;e.onWheelScroll(g),N6(g,h)&&m.preventDefault()}},onResize:()=>{u.current&&s.viewport&&i&&r({content:s.viewport.scrollHeight,viewport:s.viewport.offsetHeight,scrollbar:{size:u.current.clientHeight,paddingStart:Im(i.paddingTop),paddingEnd:Im(i.paddingBottom)}})}}))}),[yX,O6]=E6(ya),R6=d.forwardRef((e,t)=>{const{__scopeScrollArea:n,sizes:r,hasThumb:o,onThumbChange:s,onThumbPointerUp:i,onThumbPointerDown:l,onThumbPositionChange:u,onDragScroll:p,onWheelScroll:m,onResize:h,...g}=e,x=_o(ya,n),[y,b]=d.useState(null),w=al(t,A=>b(A)),S=d.useRef(null),j=d.useRef(""),_=x.viewport,E=r.content-r.viewport,I=Pi(m),M=Pi(u),R=ng(h,10);function D(A){if(S.current){const O=A.clientX-S.current.left,T=A.clientY-S.current.top;p({x:O,y:T})}}return d.useEffect(()=>{const A=O=>{const T=O.target;(y==null?void 0:y.contains(T))&&I(O,E)};return document.addEventListener("wheel",A,{passive:!1}),()=>document.removeEventListener("wheel",A,{passive:!1})},[_,y,E,I]),d.useEffect(M,[r,M]),Sc(y,R),Sc(x.content,R),d.createElement(yX,{scope:n,scrollbar:y,hasThumb:o,onThumbChange:Pi(s),onThumbPointerUp:Pi(i),onThumbPositionChange:M,onThumbPointerDown:Pi(l)},d.createElement(Hd.div,mn({},g,{ref:w,style:{position:"absolute",...g.style},onPointerDown:Ni(e.onPointerDown,A=>{A.button===0&&(A.target.setPointerCapture(A.pointerId),S.current=y.getBoundingClientRect(),j.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",D(A))}),onPointerMove:Ni(e.onPointerMove,D),onPointerUp:Ni(e.onPointerUp,A=>{const O=A.target;O.hasPointerCapture(A.pointerId)&&O.releasePointerCapture(A.pointerId),document.body.style.webkitUserSelect=j.current,S.current=null})})))}),rx="ScrollAreaThumb",CX=d.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=O6(rx,e.__scopeScrollArea);return d.createElement(Vd,{present:n||o.hasThumb},d.createElement(wX,mn({ref:t},r)))}),wX=d.forwardRef((e,t)=>{const{__scopeScrollArea:n,style:r,...o}=e,s=_o(rx,n),i=O6(rx,n),{onThumbPositionChange:l}=i,u=al(t,h=>i.onThumbChange(h)),p=d.useRef(),m=ng(()=>{p.current&&(p.current(),p.current=void 0)},100);return d.useEffect(()=>{const h=s.viewport;if(h){const g=()=>{if(m(),!p.current){const x=_X(h,l);p.current=x,l()}};return l(),h.addEventListener("scroll",g),()=>h.removeEventListener("scroll",g)}},[s.viewport,m,l]),d.createElement(Hd.div,mn({"data-state":i.hasThumb?"visible":"hidden"},o,{ref:u,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...r},onPointerDownCapture:Ni(e.onPointerDownCapture,h=>{const x=h.target.getBoundingClientRect(),y=h.clientX-x.left,b=h.clientY-x.top;i.onThumbPointerDown({x:y,y:b})}),onPointerUp:Ni(e.onPointerUp,i.onThumbPointerUp)}))}),D6="ScrollAreaCorner",SX=d.forwardRef((e,t)=>{const n=_o(D6,e.__scopeScrollArea),r=!!(n.scrollbarX&&n.scrollbarY);return n.type!=="scroll"&&r?d.createElement(kX,mn({},e,{ref:t})):null}),kX=d.forwardRef((e,t)=>{const{__scopeScrollArea:n,...r}=e,o=_o(D6,n),[s,i]=d.useState(0),[l,u]=d.useState(0),p=!!(s&&l);return Sc(o.scrollbarX,()=>{var m;const h=((m=o.scrollbarX)===null||m===void 0?void 0:m.offsetHeight)||0;o.onCornerHeightChange(h),u(h)}),Sc(o.scrollbarY,()=>{var m;const h=((m=o.scrollbarY)===null||m===void 0?void 0:m.offsetWidth)||0;o.onCornerWidthChange(h),i(h)}),p?d.createElement(Hd.div,mn({},r,{ref:t,style:{width:s,height:l,position:"absolute",right:o.dir==="ltr"?0:void 0,left:o.dir==="rtl"?0:void 0,bottom:0,...e.style}})):null});function Im(e){return e?parseInt(e,10):0}function A6(e,t){const n=e/t;return isNaN(n)?0:n}function tg(e){const t=A6(e.viewport,e.content),n=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,r=(e.scrollbar.size-n)*t;return Math.max(r,18)}function jX(e,t,n,r="ltr"){const o=tg(n),s=o/2,i=t||s,l=o-i,u=n.scrollbar.paddingStart+i,p=n.scrollbar.size-n.scrollbar.paddingEnd-l,m=n.content-n.viewport,h=r==="ltr"?[0,m]:[m*-1,0];return T6([u,p],h)(e)}function G4(e,t,n="ltr"){const r=tg(t),o=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,s=t.scrollbar.size-o,i=t.content-t.viewport,l=s-r,u=n==="ltr"?[0,i]:[i*-1,0],p=cX(e,u);return T6([0,i],[0,l])(p)}function T6(e,t){return n=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const r=(t[1]-t[0])/(e[1]-e[0]);return t[0]+r*(n-e[0])}}function N6(e,t){return e>0&&e{})=>{let n={left:e.scrollLeft,top:e.scrollTop},r=0;return function o(){const s={left:e.scrollLeft,top:e.scrollTop},i=n.left!==s.left,l=n.top!==s.top;(i||l)&&t(),n=s,r=window.requestAnimationFrame(o)}(),()=>window.cancelAnimationFrame(r)};function ng(e,t){const n=Pi(e),r=d.useRef(0);return d.useEffect(()=>()=>window.clearTimeout(r.current),[]),d.useCallback(()=>{window.clearTimeout(r.current),r.current=window.setTimeout(n,t)},[n,t])}function Sc(e,t){const n=Pi(t);nx(()=>{let r=0;if(e){const o=new ResizeObserver(()=>{cancelAnimationFrame(r),r=window.requestAnimationFrame(n)});return o.observe(e),()=>{window.cancelAnimationFrame(r),o.unobserve(e)}}},[e,n])}const IX=fX,PX=mX,K4=hX,q4=CX,EX=SX;var MX=fr((e,{scrollbarSize:t,offsetScrollbars:n,scrollbarHovered:r,hidden:o})=>({root:{overflow:"hidden"},viewport:{width:"100%",height:"100%",paddingRight:n?Re(t):void 0,paddingBottom:n?Re(t):void 0},scrollbar:{display:o?"none":"flex",userSelect:"none",touchAction:"none",boxSizing:"border-box",padding:`calc(${Re(t)} / 5)`,transition:"background-color 150ms ease, opacity 150ms ease","&:hover":{backgroundColor:e.colorScheme==="dark"?e.colors.dark[8]:e.colors.gray[0],[`& .${JS("thumb")}`]:{backgroundColor:e.colorScheme==="dark"?e.fn.rgba(e.white,.5):e.fn.rgba(e.black,.5)}},'&[data-orientation="vertical"]':{width:Re(t)},'&[data-orientation="horizontal"]':{flexDirection:"column",height:Re(t)},'&[data-state="hidden"]':{display:"none",opacity:0}},thumb:{ref:JS("thumb"),flex:1,backgroundColor:e.colorScheme==="dark"?e.fn.rgba(e.white,.4):e.fn.rgba(e.black,.4),borderRadius:Re(t),position:"relative",transition:"background-color 150ms ease",display:o?"none":void 0,overflow:"hidden","&::before":{content:'""',position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",width:"100%",height:"100%",minWidth:Re(44),minHeight:Re(44)}},corner:{backgroundColor:e.colorScheme==="dark"?e.colors.dark[6]:e.colors.gray[0],transition:"opacity 150ms ease",opacity:r?1:0,display:o?"none":void 0}}));const OX=MX;var RX=Object.defineProperty,DX=Object.defineProperties,AX=Object.getOwnPropertyDescriptors,Pm=Object.getOwnPropertySymbols,$6=Object.prototype.hasOwnProperty,L6=Object.prototype.propertyIsEnumerable,X4=(e,t,n)=>t in e?RX(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ox=(e,t)=>{for(var n in t||(t={}))$6.call(t,n)&&X4(e,n,t[n]);if(Pm)for(var n of Pm(t))L6.call(t,n)&&X4(e,n,t[n]);return e},z6=(e,t)=>DX(e,AX(t)),F6=(e,t)=>{var n={};for(var r in e)$6.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Pm)for(var r of Pm(e))t.indexOf(r)<0&&L6.call(e,r)&&(n[r]=e[r]);return n};const B6={scrollbarSize:12,scrollHideDelay:1e3,type:"hover",offsetScrollbars:!1},rg=d.forwardRef((e,t)=>{const n=Dn("ScrollArea",B6,e),{children:r,className:o,classNames:s,styles:i,scrollbarSize:l,scrollHideDelay:u,type:p,dir:m,offsetScrollbars:h,viewportRef:g,onScrollPositionChange:x,unstyled:y,variant:b,viewportProps:w}=n,S=F6(n,["children","className","classNames","styles","scrollbarSize","scrollHideDelay","type","dir","offsetScrollbars","viewportRef","onScrollPositionChange","unstyled","variant","viewportProps"]),[j,_]=d.useState(!1),E=xa(),{classes:I,cx:M}=OX({scrollbarSize:l,offsetScrollbars:h,scrollbarHovered:j,hidden:p==="never"},{name:"ScrollArea",classNames:s,styles:i,unstyled:y,variant:b});return H.createElement(IX,{type:p==="never"?"always":p,scrollHideDelay:u,dir:m||E.dir,ref:t,asChild:!0},H.createElement(zr,ox({className:M(I.root,o)},S),H.createElement(PX,z6(ox({},w),{className:I.viewport,ref:g,onScroll:typeof x=="function"?({currentTarget:R})=>x({x:R.scrollLeft,y:R.scrollTop}):void 0}),r),H.createElement(K4,{orientation:"horizontal",className:I.scrollbar,forceMount:!0,onMouseEnter:()=>_(!0),onMouseLeave:()=>_(!1)},H.createElement(q4,{className:I.thumb})),H.createElement(K4,{orientation:"vertical",className:I.scrollbar,forceMount:!0,onMouseEnter:()=>_(!0),onMouseLeave:()=>_(!1)},H.createElement(q4,{className:I.thumb})),H.createElement(EX,{className:I.corner})))}),H6=d.forwardRef((e,t)=>{const n=Dn("ScrollAreaAutosize",B6,e),{children:r,classNames:o,styles:s,scrollbarSize:i,scrollHideDelay:l,type:u,dir:p,offsetScrollbars:m,viewportRef:h,onScrollPositionChange:g,unstyled:x,sx:y,variant:b,viewportProps:w}=n,S=F6(n,["children","classNames","styles","scrollbarSize","scrollHideDelay","type","dir","offsetScrollbars","viewportRef","onScrollPositionChange","unstyled","sx","variant","viewportProps"]);return H.createElement(zr,z6(ox({},S),{ref:t,sx:[{display:"flex"},...EP(y)]}),H.createElement(zr,{sx:{display:"flex",flexDirection:"column",flex:1}},H.createElement(rg,{classNames:o,styles:s,scrollHideDelay:l,scrollbarSize:i,type:u,dir:p,offsetScrollbars:m,viewportRef:h,onScrollPositionChange:g,unstyled:x,variant:b,viewportProps:w},r)))});H6.displayName="@mantine/core/ScrollAreaAutosize";rg.displayName="@mantine/core/ScrollArea";rg.Autosize=H6;const V6=rg;var TX=Object.defineProperty,NX=Object.defineProperties,$X=Object.getOwnPropertyDescriptors,Em=Object.getOwnPropertySymbols,W6=Object.prototype.hasOwnProperty,U6=Object.prototype.propertyIsEnumerable,Q4=(e,t,n)=>t in e?TX(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Y4=(e,t)=>{for(var n in t||(t={}))W6.call(t,n)&&Q4(e,n,t[n]);if(Em)for(var n of Em(t))U6.call(t,n)&&Q4(e,n,t[n]);return e},LX=(e,t)=>NX(e,$X(t)),zX=(e,t)=>{var n={};for(var r in e)W6.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Em)for(var r of Em(e))t.indexOf(r)<0&&U6.call(e,r)&&(n[r]=e[r]);return n};const og=d.forwardRef((e,t)=>{var n=e,{style:r}=n,o=zX(n,["style"]);return H.createElement(V6,LX(Y4({},o),{style:Y4({width:"100%"},r),viewportProps:{tabIndex:-1},viewportRef:t}),o.children)});og.displayName="@mantine/core/SelectScrollArea";var FX=fr(()=>({dropdown:{},itemsWrapper:{padding:Re(4),display:"flex",width:"100%",boxSizing:"border-box"}}));const BX=FX;function Fc(e){return e.split("-")[1]}function oy(e){return e==="y"?"height":"width"}function Go(e){return e.split("-")[0]}function li(e){return["top","bottom"].includes(Go(e))?"x":"y"}function Z4(e,t,n){let{reference:r,floating:o}=e;const s=r.x+r.width/2-o.width/2,i=r.y+r.height/2-o.height/2,l=li(t),u=oy(l),p=r[u]/2-o[u]/2,m=l==="x";let h;switch(Go(t)){case"top":h={x:s,y:r.y-o.height};break;case"bottom":h={x:s,y:r.y+r.height};break;case"right":h={x:r.x+r.width,y:i};break;case"left":h={x:r.x-o.width,y:i};break;default:h={x:r.x,y:r.y}}switch(Fc(t)){case"start":h[l]-=p*(n&&m?-1:1);break;case"end":h[l]+=p*(n&&m?-1:1)}return h}const HX=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:s=[],platform:i}=n,l=s.filter(Boolean),u=await(i.isRTL==null?void 0:i.isRTL(t));let p=await i.getElementRects({reference:e,floating:t,strategy:o}),{x:m,y:h}=Z4(p,r,u),g=r,x={},y=0;for(let b=0;b({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:s,platform:i,elements:l}=t,{element:u,padding:p=0}=ia(e,t)||{};if(u==null)return{};const m=sy(p),h={x:n,y:r},g=li(o),x=oy(g),y=await i.getDimensions(u),b=g==="y",w=b?"top":"left",S=b?"bottom":"right",j=b?"clientHeight":"clientWidth",_=s.reference[x]+s.reference[g]-h[g]-s.floating[x],E=h[g]-s.reference[g],I=await(i.getOffsetParent==null?void 0:i.getOffsetParent(u));let M=I?I[j]:0;M&&await(i.isElement==null?void 0:i.isElement(I))||(M=l.floating[j]||s.floating[x]);const R=_/2-E/2,D=M/2-y[x]/2-1,A=ei(m[w],D),O=ei(m[S],D),T=A,X=M-y[x]-O,B=M/2-y[x]/2+R,V=sx(T,B,X),U=Fc(o)!=null&&B!=V&&s.reference[x]/2-(Be.concat(t,t+"-start",t+"-end"),[]);const WX={left:"right",right:"left",bottom:"top",top:"bottom"};function Mm(e){return e.replace(/left|right|bottom|top/g,t=>WX[t])}function UX(e,t,n){n===void 0&&(n=!1);const r=Fc(e),o=li(e),s=oy(o);let i=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(i=Mm(i)),{main:i,cross:Mm(i)}}const GX={start:"end",end:"start"};function Iv(e){return e.replace(/start|end/g,t=>GX[t])}const KX=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n;const{placement:r,middlewareData:o,rects:s,initialPlacement:i,platform:l,elements:u}=t,{mainAxis:p=!0,crossAxis:m=!0,fallbackPlacements:h,fallbackStrategy:g="bestFit",fallbackAxisSideDirection:x="none",flipAlignment:y=!0,...b}=ia(e,t),w=Go(r),S=Go(i)===i,j=await(l.isRTL==null?void 0:l.isRTL(u.floating)),_=h||(S||!y?[Mm(i)]:function(T){const X=Mm(T);return[Iv(T),X,Iv(X)]}(i));h||x==="none"||_.push(...function(T,X,B,V){const U=Fc(T);let N=function($,q,F){const Q=["left","right"],Y=["right","left"],se=["top","bottom"],ae=["bottom","top"];switch($){case"top":case"bottom":return F?q?Y:Q:q?Q:Y;case"left":case"right":return q?se:ae;default:return[]}}(Go(T),B==="start",V);return U&&(N=N.map($=>$+"-"+U),X&&(N=N.concat(N.map(Iv)))),N}(i,y,x,j));const E=[i,..._],I=await ay(t,b),M=[];let R=((n=o.flip)==null?void 0:n.overflows)||[];if(p&&M.push(I[w]),m){const{main:T,cross:X}=UX(r,s,j);M.push(I[T],I[X])}if(R=[...R,{placement:r,overflows:M}],!M.every(T=>T<=0)){var D,A;const T=(((D=o.flip)==null?void 0:D.index)||0)+1,X=E[T];if(X)return{data:{index:T,overflows:R},reset:{placement:X}};let B=(A=R.filter(V=>V.overflows[0]<=0).sort((V,U)=>V.overflows[1]-U.overflows[1])[0])==null?void 0:A.placement;if(!B)switch(g){case"bestFit":{var O;const V=(O=R.map(U=>[U.placement,U.overflows.filter(N=>N>0).reduce((N,$)=>N+$,0)]).sort((U,N)=>U[1]-N[1])[0])==null?void 0:O[0];V&&(B=V);break}case"initialPlacement":B=i}if(r!==B)return{reset:{placement:B}}}return{}}}};function ek(e){const t=ei(...e.map(r=>r.left)),n=ei(...e.map(r=>r.top));return{x:t,y:n,width:ms(...e.map(r=>r.right))-t,height:ms(...e.map(r=>r.bottom))-n}}const qX=function(e){return e===void 0&&(e={}),{name:"inline",options:e,async fn(t){const{placement:n,elements:r,rects:o,platform:s,strategy:i}=t,{padding:l=2,x:u,y:p}=ia(e,t),m=Array.from(await(s.getClientRects==null?void 0:s.getClientRects(r.reference))||[]),h=function(b){const w=b.slice().sort((_,E)=>_.y-E.y),S=[];let j=null;for(let _=0;_j.height/2?S.push([E]):S[S.length-1].push(E),j=E}return S.map(_=>kc(ek(_)))}(m),g=kc(ek(m)),x=sy(l),y=await s.getElementRects({reference:{getBoundingClientRect:function(){if(h.length===2&&h[0].left>h[1].right&&u!=null&&p!=null)return h.find(b=>u>b.left-x.left&&ub.top-x.top&&p=2){if(li(n)==="x"){const I=h[0],M=h[h.length-1],R=Go(n)==="top",D=I.top,A=M.bottom,O=R?I.left:M.left,T=R?I.right:M.right;return{top:D,bottom:A,left:O,right:T,width:T-O,height:A-D,x:O,y:D}}const b=Go(n)==="left",w=ms(...h.map(I=>I.right)),S=ei(...h.map(I=>I.left)),j=h.filter(I=>b?I.left===S:I.right===w),_=j[0].top,E=j[j.length-1].bottom;return{top:_,bottom:E,left:S,right:w,width:w-S,height:E-_,x:S,y:_}}return g}},floating:r.floating,strategy:i});return o.reference.x!==y.reference.x||o.reference.y!==y.reference.y||o.reference.width!==y.reference.width||o.reference.height!==y.reference.height?{reset:{rects:y}}:{}}}},XX=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){const{x:n,y:r}=t,o=await async function(s,i){const{placement:l,platform:u,elements:p}=s,m=await(u.isRTL==null?void 0:u.isRTL(p.floating)),h=Go(l),g=Fc(l),x=li(l)==="x",y=["left","top"].includes(h)?-1:1,b=m&&x?-1:1,w=ia(i,s);let{mainAxis:S,crossAxis:j,alignmentAxis:_}=typeof w=="number"?{mainAxis:w,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...w};return g&&typeof _=="number"&&(j=g==="end"?-1*_:_),x?{x:j*b,y:S*y}:{x:S*y,y:j*b}}(t,e);return{x:n+o.x,y:r+o.y,data:o}}}};function G6(e){return e==="x"?"y":"x"}const QX=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o}=t,{mainAxis:s=!0,crossAxis:i=!1,limiter:l={fn:w=>{let{x:S,y:j}=w;return{x:S,y:j}}},...u}=ia(e,t),p={x:n,y:r},m=await ay(t,u),h=li(Go(o)),g=G6(h);let x=p[h],y=p[g];if(s){const w=h==="y"?"bottom":"right";x=sx(x+m[h==="y"?"top":"left"],x,x-m[w])}if(i){const w=g==="y"?"bottom":"right";y=sx(y+m[g==="y"?"top":"left"],y,y-m[w])}const b=l.fn({...t,[h]:x,[g]:y});return{...b,data:{x:b.x-n,y:b.y-r}}}}},YX=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:o,rects:s,middlewareData:i}=t,{offset:l=0,mainAxis:u=!0,crossAxis:p=!0}=ia(e,t),m={x:n,y:r},h=li(o),g=G6(h);let x=m[h],y=m[g];const b=ia(l,t),w=typeof b=="number"?{mainAxis:b,crossAxis:0}:{mainAxis:0,crossAxis:0,...b};if(u){const _=h==="y"?"height":"width",E=s.reference[h]-s.floating[_]+w.mainAxis,I=s.reference[h]+s.reference[_]-w.mainAxis;xI&&(x=I)}if(p){var S,j;const _=h==="y"?"width":"height",E=["top","left"].includes(Go(o)),I=s.reference[g]-s.floating[_]+(E&&((S=i.offset)==null?void 0:S[g])||0)+(E?0:w.crossAxis),M=s.reference[g]+s.reference[_]+(E?0:((j=i.offset)==null?void 0:j[g])||0)-(E?w.crossAxis:0);yM&&(y=M)}return{[h]:x,[g]:y}}}},ZX=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){const{placement:n,rects:r,platform:o,elements:s}=t,{apply:i=()=>{},...l}=ia(e,t),u=await ay(t,l),p=Go(n),m=Fc(n),h=li(n)==="x",{width:g,height:x}=r.floating;let y,b;p==="top"||p==="bottom"?(y=p,b=m===(await(o.isRTL==null?void 0:o.isRTL(s.floating))?"start":"end")?"left":"right"):(b=p,y=m==="end"?"top":"bottom");const w=x-u[y],S=g-u[b],j=!t.middlewareData.shift;let _=w,E=S;if(h){const M=g-u.left-u.right;E=m||j?ei(S,M):M}else{const M=x-u.top-u.bottom;_=m||j?ei(w,M):M}if(j&&!m){const M=ms(u.left,0),R=ms(u.right,0),D=ms(u.top,0),A=ms(u.bottom,0);h?E=g-2*(M!==0||R!==0?M+R:ms(u.left,u.right)):_=x-2*(D!==0||A!==0?D+A:ms(u.top,u.bottom))}await i({...t,availableWidth:E,availableHeight:_});const I=await o.getDimensions(s.floating);return g!==I.width||x!==I.height?{reset:{rects:!0}}:{}}}};function Zr(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function ks(e){return Zr(e).getComputedStyle(e)}function K6(e){return e instanceof Zr(e).Node}function ti(e){return K6(e)?(e.nodeName||"").toLowerCase():"#document"}function Jo(e){return e instanceof HTMLElement||e instanceof Zr(e).HTMLElement}function tk(e){return typeof ShadowRoot<"u"&&(e instanceof Zr(e).ShadowRoot||e instanceof ShadowRoot)}function sd(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=ks(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!["inline","contents"].includes(o)}function JX(e){return["table","td","th"].includes(ti(e))}function ax(e){const t=iy(),n=ks(e);return n.transform!=="none"||n.perspective!=="none"||!!n.containerType&&n.containerType!=="normal"||!t&&!!n.backdropFilter&&n.backdropFilter!=="none"||!t&&!!n.filter&&n.filter!=="none"||["transform","perspective","filter"].some(r=>(n.willChange||"").includes(r))||["paint","layout","strict","content"].some(r=>(n.contain||"").includes(r))}function iy(){return!(typeof CSS>"u"||!CSS.supports)&&CSS.supports("-webkit-backdrop-filter","none")}function sg(e){return["html","body","#document"].includes(ti(e))}const ix=Math.min,fc=Math.max,Om=Math.round,fp=Math.floor,ni=e=>({x:e,y:e});function q6(e){const t=ks(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=Jo(e),s=o?e.offsetWidth:n,i=o?e.offsetHeight:r,l=Om(n)!==s||Om(r)!==i;return l&&(n=s,r=i),{width:n,height:r,$:l}}function ea(e){return e instanceof Element||e instanceof Zr(e).Element}function ly(e){return ea(e)?e:e.contextElement}function pc(e){const t=ly(e);if(!Jo(t))return ni(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:s}=q6(t);let i=(s?Om(n.width):n.width)/r,l=(s?Om(n.height):n.height)/o;return i&&Number.isFinite(i)||(i=1),l&&Number.isFinite(l)||(l=1),{x:i,y:l}}const eQ=ni(0);function X6(e){const t=Zr(e);return iy()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:eQ}function Qi(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),s=ly(e);let i=ni(1);t&&(r?ea(r)&&(i=pc(r)):i=pc(e));const l=function(g,x,y){return x===void 0&&(x=!1),!(!y||x&&y!==Zr(g))&&x}(s,n,r)?X6(s):ni(0);let u=(o.left+l.x)/i.x,p=(o.top+l.y)/i.y,m=o.width/i.x,h=o.height/i.y;if(s){const g=Zr(s),x=r&&ea(r)?Zr(r):r;let y=g.frameElement;for(;y&&r&&x!==g;){const b=pc(y),w=y.getBoundingClientRect(),S=getComputedStyle(y),j=w.left+(y.clientLeft+parseFloat(S.paddingLeft))*b.x,_=w.top+(y.clientTop+parseFloat(S.paddingTop))*b.y;u*=b.x,p*=b.y,m*=b.x,h*=b.y,u+=j,p+=_,y=Zr(y).frameElement}}return kc({width:m,height:h,x:u,y:p})}function ag(e){return ea(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.pageXOffset,scrollTop:e.pageYOffset}}function ta(e){var t;return(t=(K6(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Q6(e){return Qi(ta(e)).left+ag(e).scrollLeft}function jc(e){if(ti(e)==="html")return e;const t=e.assignedSlot||e.parentNode||tk(e)&&e.host||ta(e);return tk(t)?t.host:t}function Y6(e){const t=jc(e);return sg(t)?e.ownerDocument?e.ownerDocument.body:e.body:Jo(t)&&sd(t)?t:Y6(t)}function Rm(e,t){var n;t===void 0&&(t=[]);const r=Y6(e),o=r===((n=e.ownerDocument)==null?void 0:n.body),s=Zr(r);return o?t.concat(s,s.visualViewport||[],sd(r)?r:[]):t.concat(r,Rm(r))}function nk(e,t,n){let r;if(t==="viewport")r=function(o,s){const i=Zr(o),l=ta(o),u=i.visualViewport;let p=l.clientWidth,m=l.clientHeight,h=0,g=0;if(u){p=u.width,m=u.height;const x=iy();(!x||x&&s==="fixed")&&(h=u.offsetLeft,g=u.offsetTop)}return{width:p,height:m,x:h,y:g}}(e,n);else if(t==="document")r=function(o){const s=ta(o),i=ag(o),l=o.ownerDocument.body,u=fc(s.scrollWidth,s.clientWidth,l.scrollWidth,l.clientWidth),p=fc(s.scrollHeight,s.clientHeight,l.scrollHeight,l.clientHeight);let m=-i.scrollLeft+Q6(o);const h=-i.scrollTop;return ks(l).direction==="rtl"&&(m+=fc(s.clientWidth,l.clientWidth)-u),{width:u,height:p,x:m,y:h}}(ta(e));else if(ea(t))r=function(o,s){const i=Qi(o,!0,s==="fixed"),l=i.top+o.clientTop,u=i.left+o.clientLeft,p=Jo(o)?pc(o):ni(1);return{width:o.clientWidth*p.x,height:o.clientHeight*p.y,x:u*p.x,y:l*p.y}}(t,n);else{const o=X6(e);r={...t,x:t.x-o.x,y:t.y-o.y}}return kc(r)}function Z6(e,t){const n=jc(e);return!(n===t||!ea(n)||sg(n))&&(ks(n).position==="fixed"||Z6(n,t))}function tQ(e,t,n){const r=Jo(t),o=ta(t),s=n==="fixed",i=Qi(e,!0,s,t);let l={scrollLeft:0,scrollTop:0};const u=ni(0);if(r||!r&&!s)if((ti(t)!=="body"||sd(o))&&(l=ag(t)),Jo(t)){const p=Qi(t,!0,s,t);u.x=p.x+t.clientLeft,u.y=p.y+t.clientTop}else o&&(u.x=Q6(o));return{x:i.left+l.scrollLeft-u.x,y:i.top+l.scrollTop-u.y,width:i.width,height:i.height}}function rk(e,t){return Jo(e)&&ks(e).position!=="fixed"?t?t(e):e.offsetParent:null}function ok(e,t){const n=Zr(e);if(!Jo(e))return n;let r=rk(e,t);for(;r&&JX(r)&&ks(r).position==="static";)r=rk(r,t);return r&&(ti(r)==="html"||ti(r)==="body"&&ks(r).position==="static"&&!ax(r))?n:r||function(o){let s=jc(o);for(;Jo(s)&&!sg(s);){if(ax(s))return s;s=jc(s)}return null}(e)||n}const nQ={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{rect:t,offsetParent:n,strategy:r}=e;const o=Jo(n),s=ta(n);if(n===s)return t;let i={scrollLeft:0,scrollTop:0},l=ni(1);const u=ni(0);if((o||!o&&r!=="fixed")&&((ti(n)!=="body"||sd(s))&&(i=ag(n)),Jo(n))){const p=Qi(n);l=pc(n),u.x=p.x+n.clientLeft,u.y=p.y+n.clientTop}return{width:t.width*l.x,height:t.height*l.y,x:t.x*l.x-i.scrollLeft*l.x+u.x,y:t.y*l.y-i.scrollTop*l.y+u.y}},getDocumentElement:ta,getClippingRect:function(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const s=[...n==="clippingAncestors"?function(u,p){const m=p.get(u);if(m)return m;let h=Rm(u).filter(b=>ea(b)&&ti(b)!=="body"),g=null;const x=ks(u).position==="fixed";let y=x?jc(u):u;for(;ea(y)&&!sg(y);){const b=ks(y),w=ax(y);w||b.position!=="fixed"||(g=null),(x?!w&&!g:!w&&b.position==="static"&&g&&["absolute","fixed"].includes(g.position)||sd(y)&&!w&&Z6(u,y))?h=h.filter(S=>S!==y):g=b,y=jc(y)}return p.set(u,h),h}(t,this._c):[].concat(n),r],i=s[0],l=s.reduce((u,p)=>{const m=nk(t,p,o);return u.top=fc(m.top,u.top),u.right=ix(m.right,u.right),u.bottom=ix(m.bottom,u.bottom),u.left=fc(m.left,u.left),u},nk(t,i,o));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}},getOffsetParent:ok,getElementRects:async function(e){let{reference:t,floating:n,strategy:r}=e;const o=this.getOffsetParent||ok,s=this.getDimensions;return{reference:tQ(t,await o(n),r),floating:{x:0,y:0,...await s(n)}}},getClientRects:function(e){return Array.from(e.getClientRects())},getDimensions:function(e){return q6(e)},getScale:pc,isElement:ea,isRTL:function(e){return getComputedStyle(e).direction==="rtl"}};function rQ(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:s=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:u=!1}=r,p=ly(e),m=o||s?[...p?Rm(p):[],...Rm(t)]:[];m.forEach(w=>{o&&w.addEventListener("scroll",n,{passive:!0}),s&&w.addEventListener("resize",n)});const h=p&&l?function(w,S){let j,_=null;const E=ta(w);function I(){clearTimeout(j),_&&_.disconnect(),_=null}return function M(R,D){R===void 0&&(R=!1),D===void 0&&(D=1),I();const{left:A,top:O,width:T,height:X}=w.getBoundingClientRect();if(R||S(),!T||!X)return;const B={rootMargin:-fp(O)+"px "+-fp(E.clientWidth-(A+T))+"px "+-fp(E.clientHeight-(O+X))+"px "+-fp(A)+"px",threshold:fc(0,ix(1,D))||1};let V=!0;function U(N){const $=N[0].intersectionRatio;if($!==D){if(!V)return M();$?M(!1,$):j=setTimeout(()=>{M(!1,1e-7)},100)}V=!1}try{_=new IntersectionObserver(U,{...B,root:E.ownerDocument})}catch{_=new IntersectionObserver(U,B)}_.observe(w)}(!0),I}(p,n):null;let g,x=-1,y=null;i&&(y=new ResizeObserver(w=>{let[S]=w;S&&S.target===p&&y&&(y.unobserve(t),cancelAnimationFrame(x),x=requestAnimationFrame(()=>{y&&y.observe(t)})),n()}),p&&!u&&y.observe(p),y.observe(t));let b=u?Qi(e):null;return u&&function w(){const S=Qi(e);!b||S.x===b.x&&S.y===b.y&&S.width===b.width&&S.height===b.height||n(),b=S,g=requestAnimationFrame(w)}(),n(),()=>{m.forEach(w=>{o&&w.removeEventListener("scroll",n),s&&w.removeEventListener("resize",n)}),h&&h(),y&&y.disconnect(),y=null,u&&cancelAnimationFrame(g)}}const oQ=(e,t,n)=>{const r=new Map,o={platform:nQ,...n},s={...o.platform,_c:r};return HX(e,t,{...o,platform:s})},sQ=e=>{const{element:t,padding:n}=e;function r(o){return Object.prototype.hasOwnProperty.call(o,"current")}return{name:"arrow",options:e,fn(o){return r(t)?t.current!=null?J4({element:t.current,padding:n}).fn(o):{}:t?J4({element:t,padding:n}).fn(o):{}}}};var Vp=typeof document<"u"?d.useLayoutEffect:d.useEffect;function Dm(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 n,r,o;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!=t.length)return!1;for(r=n;r--!==0;)if(!Dm(e[r],t[r]))return!1;return!0}if(o=Object.keys(e),n=o.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!Object.prototype.hasOwnProperty.call(t,o[r]))return!1;for(r=n;r--!==0;){const s=o[r];if(!(s==="_owner"&&e.$$typeof)&&!Dm(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function sk(e){const t=d.useRef(e);return Vp(()=>{t.current=e}),t}function aQ(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:o,whileElementsMounted:s,open:i}=e,[l,u]=d.useState({x:null,y:null,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[p,m]=d.useState(r);Dm(p,r)||m(r);const h=d.useRef(null),g=d.useRef(null),x=d.useRef(l),y=sk(s),b=sk(o),[w,S]=d.useState(null),[j,_]=d.useState(null),E=d.useCallback(O=>{h.current!==O&&(h.current=O,S(O))},[]),I=d.useCallback(O=>{g.current!==O&&(g.current=O,_(O))},[]),M=d.useCallback(()=>{if(!h.current||!g.current)return;const O={placement:t,strategy:n,middleware:p};b.current&&(O.platform=b.current),oQ(h.current,g.current,O).then(T=>{const X={...T,isPositioned:!0};R.current&&!Dm(x.current,X)&&(x.current=X,qr.flushSync(()=>{u(X)}))})},[p,t,n,b]);Vp(()=>{i===!1&&x.current.isPositioned&&(x.current.isPositioned=!1,u(O=>({...O,isPositioned:!1})))},[i]);const R=d.useRef(!1);Vp(()=>(R.current=!0,()=>{R.current=!1}),[]),Vp(()=>{if(w&&j){if(y.current)return y.current(w,j,M);M()}},[w,j,M,y]);const D=d.useMemo(()=>({reference:h,floating:g,setReference:E,setFloating:I}),[E,I]),A=d.useMemo(()=>({reference:w,floating:j}),[w,j]);return d.useMemo(()=>({...l,update:M,refs:D,elements:A,reference:E,floating:I}),[l,M,D,A,E,I])}var iQ=typeof document<"u"?d.useLayoutEffect:d.useEffect;function lQ(){const e=new Map;return{emit(t,n){var r;(r=e.get(t))==null||r.forEach(o=>o(n))},on(t,n){e.set(t,[...e.get(t)||[],n])},off(t,n){e.set(t,(e.get(t)||[]).filter(r=>r!==n))}}}const cQ=d.createContext(null),uQ=()=>d.useContext(cQ);function dQ(e){return(e==null?void 0:e.ownerDocument)||document}function fQ(e){return dQ(e).defaultView||window}function pp(e){return e?e instanceof fQ(e).Element:!1}const pQ=Fx["useInsertionEffect".toString()],mQ=pQ||(e=>e());function hQ(e){const t=d.useRef(()=>{});return mQ(()=>{t.current=e}),d.useCallback(function(){for(var n=arguments.length,r=new Array(n),o=0;olQ())[0],[p,m]=d.useState(null),h=d.useCallback(S=>{const j=pp(S)?{getBoundingClientRect:()=>S.getBoundingClientRect(),contextElement:S}:S;o.refs.setReference(j)},[o.refs]),g=d.useCallback(S=>{(pp(S)||S===null)&&(i.current=S,m(S)),(pp(o.refs.reference.current)||o.refs.reference.current===null||S!==null&&!pp(S))&&o.refs.setReference(S)},[o.refs]),x=d.useMemo(()=>({...o.refs,setReference:g,setPositionReference:h,domReference:i}),[o.refs,g,h]),y=d.useMemo(()=>({...o.elements,domReference:p}),[o.elements,p]),b=hQ(n),w=d.useMemo(()=>({...o,refs:x,elements:y,dataRef:l,nodeId:r,events:u,open:t,onOpenChange:b}),[o,r,u,t,b,x,y]);return iQ(()=>{const S=s==null?void 0:s.nodesRef.current.find(j=>j.id===r);S&&(S.context=w)}),d.useMemo(()=>({...o,context:w,refs:x,reference:g,positionReference:h}),[o,x,w,g,h])}function vQ({opened:e,floating:t,position:n,positionDependencies:r}){const[o,s]=d.useState(0);d.useEffect(()=>{if(t.refs.reference.current&&t.refs.floating.current)return rQ(t.refs.reference.current,t.refs.floating.current,t.update)},[t.refs.reference.current,t.refs.floating.current,e,o,n]),Uo(()=>{t.update()},r),Uo(()=>{s(i=>i+1)},[e])}function xQ(e){const t=[XX(e.offset)];return e.middlewares.shift&&t.push(QX({limiter:YX()})),e.middlewares.flip&&t.push(KX()),e.middlewares.inline&&t.push(qX()),t.push(sQ({element:e.arrowRef,padding:e.arrowOffset})),t}function bQ(e){const[t,n]=od({value:e.opened,defaultValue:e.defaultOpened,finalValue:!1,onChange:e.onChange}),r=()=>{var i;(i=e.onClose)==null||i.call(e),n(!1)},o=()=>{var i,l;t?((i=e.onClose)==null||i.call(e),n(!1)):((l=e.onOpen)==null||l.call(e),n(!0))},s=gQ({placement:e.position,middleware:[...xQ(e),...e.width==="target"?[ZX({apply({rects:i}){var l,u;Object.assign((u=(l=s.refs.floating.current)==null?void 0:l.style)!=null?u:{},{width:`${i.reference.width}px`})}})]:[]]});return vQ({opened:e.opened,position:e.position,positionDependencies:e.positionDependencies,floating:s}),Uo(()=>{var i;(i=e.onPositionChange)==null||i.call(e,s.placement)},[s.placement]),Uo(()=>{var i,l;e.opened?(l=e.onOpen)==null||l.call(e):(i=e.onClose)==null||i.call(e)},[e.opened]),{floating:s,controlled:typeof e.opened=="boolean",opened:t,onClose:r,onToggle:o}}const J6={context:"Popover component was not found in the tree",children:"Popover.Target component children should be an element or a component that accepts ref. Fragments, strings, numbers and other primitive values are not supported"},[yQ,eE]=iG(J6.context);var CQ=Object.defineProperty,wQ=Object.defineProperties,SQ=Object.getOwnPropertyDescriptors,Am=Object.getOwnPropertySymbols,tE=Object.prototype.hasOwnProperty,nE=Object.prototype.propertyIsEnumerable,ak=(e,t,n)=>t in e?CQ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,mp=(e,t)=>{for(var n in t||(t={}))tE.call(t,n)&&ak(e,n,t[n]);if(Am)for(var n of Am(t))nE.call(t,n)&&ak(e,n,t[n]);return e},kQ=(e,t)=>wQ(e,SQ(t)),jQ=(e,t)=>{var n={};for(var r in e)tE.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Am)for(var r of Am(e))t.indexOf(r)<0&&nE.call(e,r)&&(n[r]=e[r]);return n};const _Q={refProp:"ref",popupType:"dialog"},rE=d.forwardRef((e,t)=>{const n=Dn("PopoverTarget",_Q,e),{children:r,refProp:o,popupType:s}=n,i=jQ(n,["children","refProp","popupType"]);if(!OP(r))throw new Error(J6.children);const l=i,u=eE(),p=Bd(u.reference,r.ref,t),m=u.withRoles?{"aria-haspopup":s,"aria-expanded":u.opened,"aria-controls":u.getDropdownId(),id:u.getTargetId()}:{};return d.cloneElement(r,mp(kQ(mp(mp(mp({},l),m),u.targetProps),{className:DP(u.targetProps.className,l.className,r.props.className),[o]:p}),u.controlled?null:{onClick:u.onToggle}))});rE.displayName="@mantine/core/PopoverTarget";var IQ=fr((e,{radius:t,shadow:n})=>({dropdown:{position:"absolute",backgroundColor:e.white,background:e.colorScheme==="dark"?e.colors.dark[6]:e.white,border:`${Re(1)} solid ${e.colorScheme==="dark"?e.colors.dark[4]:e.colors.gray[2]}`,padding:`${e.spacing.sm} ${e.spacing.md}`,boxShadow:e.shadows[n]||n||"none",borderRadius:e.fn.radius(t),"&:focus":{outline:0}},arrow:{backgroundColor:"inherit",border:`${Re(1)} solid ${e.colorScheme==="dark"?e.colors.dark[4]:e.colors.gray[2]}`,zIndex:1}}));const PQ=IQ;var EQ=Object.defineProperty,ik=Object.getOwnPropertySymbols,MQ=Object.prototype.hasOwnProperty,OQ=Object.prototype.propertyIsEnumerable,lk=(e,t,n)=>t in e?EQ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,$l=(e,t)=>{for(var n in t||(t={}))MQ.call(t,n)&&lk(e,n,t[n]);if(ik)for(var n of ik(t))OQ.call(t,n)&&lk(e,n,t[n]);return e};const ck={entering:"in",entered:"in",exiting:"out",exited:"out","pre-exiting":"out","pre-entering":"out"};function RQ({transition:e,state:t,duration:n,timingFunction:r}){const o={transitionDuration:`${n}ms`,transitionTimingFunction:r};return typeof e=="string"?e in ap?$l($l($l({transitionProperty:ap[e].transitionProperty},o),ap[e].common),ap[e][ck[t]]):null:$l($l($l({transitionProperty:e.transitionProperty},o),e.common),e[ck[t]])}function DQ({duration:e,exitDuration:t,timingFunction:n,mounted:r,onEnter:o,onExit:s,onEntered:i,onExited:l}){const u=xa(),p=FP(),m=u.respectReducedMotion?p:!1,[h,g]=d.useState(m?0:e),[x,y]=d.useState(r?"entered":"exited"),b=d.useRef(-1),w=S=>{const j=S?o:s,_=S?i:l;y(S?"pre-entering":"pre-exiting"),window.clearTimeout(b.current);const E=m?0:S?e:t;if(g(E),E===0)typeof j=="function"&&j(),typeof _=="function"&&_(),y(S?"entered":"exited");else{const I=window.setTimeout(()=>{typeof j=="function"&&j(),y(S?"entering":"exiting")},10);b.current=window.setTimeout(()=>{window.clearTimeout(I),typeof _=="function"&&_(),y(S?"entered":"exited")},E)}};return Uo(()=>{w(r)},[r]),d.useEffect(()=>()=>window.clearTimeout(b.current),[]),{transitionDuration:h,transitionStatus:x,transitionTimingFunction:n||u.transitionTimingFunction}}function oE({keepMounted:e,transition:t,duration:n=250,exitDuration:r=n,mounted:o,children:s,timingFunction:i,onExit:l,onEntered:u,onEnter:p,onExited:m}){const{transitionDuration:h,transitionStatus:g,transitionTimingFunction:x}=DQ({mounted:o,exitDuration:r,duration:n,timingFunction:i,onExit:l,onEntered:u,onEnter:p,onExited:m});return h===0?o?H.createElement(H.Fragment,null,s({})):e?s({display:"none"}):null:g==="exited"?e?s({display:"none"}):null:H.createElement(H.Fragment,null,s(RQ({transition:t,duration:h,state:g,timingFunction:x})))}oE.displayName="@mantine/core/Transition";function sE({children:e,active:t=!0,refProp:n="ref"}){const r=BG(t),o=Bd(r,e==null?void 0:e.ref);return OP(e)?d.cloneElement(e,{[n]:o}):e}sE.displayName="@mantine/core/FocusTrap";var AQ=Object.defineProperty,TQ=Object.defineProperties,NQ=Object.getOwnPropertyDescriptors,uk=Object.getOwnPropertySymbols,$Q=Object.prototype.hasOwnProperty,LQ=Object.prototype.propertyIsEnumerable,dk=(e,t,n)=>t in e?AQ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Na=(e,t)=>{for(var n in t||(t={}))$Q.call(t,n)&&dk(e,n,t[n]);if(uk)for(var n of uk(t))LQ.call(t,n)&&dk(e,n,t[n]);return e},hp=(e,t)=>TQ(e,NQ(t));function fk(e,t,n,r){return e==="center"||r==="center"?{top:t}:e==="end"?{bottom:n}:e==="start"?{top:n}:{}}function pk(e,t,n,r,o){return e==="center"||r==="center"?{left:t}:e==="end"?{[o==="ltr"?"right":"left"]:n}:e==="start"?{[o==="ltr"?"left":"right"]:n}:{}}const zQ={bottom:"borderTopLeftRadius",left:"borderTopRightRadius",right:"borderBottomLeftRadius",top:"borderBottomRightRadius"};function FQ({position:e,arrowSize:t,arrowOffset:n,arrowRadius:r,arrowPosition:o,arrowX:s,arrowY:i,dir:l}){const[u,p="center"]=e.split("-"),m={width:Re(t),height:Re(t),transform:"rotate(45deg)",position:"absolute",[zQ[u]]:Re(r)},h=Re(-t/2);return u==="left"?hp(Na(Na({},m),fk(p,i,n,o)),{right:h,borderLeftColor:"transparent",borderBottomColor:"transparent"}):u==="right"?hp(Na(Na({},m),fk(p,i,n,o)),{left:h,borderRightColor:"transparent",borderTopColor:"transparent"}):u==="top"?hp(Na(Na({},m),pk(p,s,n,o,l)),{bottom:h,borderTopColor:"transparent",borderLeftColor:"transparent"}):u==="bottom"?hp(Na(Na({},m),pk(p,s,n,o,l)),{top:h,borderBottomColor:"transparent",borderRightColor:"transparent"}):{}}var BQ=Object.defineProperty,HQ=Object.defineProperties,VQ=Object.getOwnPropertyDescriptors,Tm=Object.getOwnPropertySymbols,aE=Object.prototype.hasOwnProperty,iE=Object.prototype.propertyIsEnumerable,mk=(e,t,n)=>t in e?BQ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,WQ=(e,t)=>{for(var n in t||(t={}))aE.call(t,n)&&mk(e,n,t[n]);if(Tm)for(var n of Tm(t))iE.call(t,n)&&mk(e,n,t[n]);return e},UQ=(e,t)=>HQ(e,VQ(t)),GQ=(e,t)=>{var n={};for(var r in e)aE.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Tm)for(var r of Tm(e))t.indexOf(r)<0&&iE.call(e,r)&&(n[r]=e[r]);return n};const lE=d.forwardRef((e,t)=>{var n=e,{position:r,arrowSize:o,arrowOffset:s,arrowRadius:i,arrowPosition:l,visible:u,arrowX:p,arrowY:m}=n,h=GQ(n,["position","arrowSize","arrowOffset","arrowRadius","arrowPosition","visible","arrowX","arrowY"]);const g=xa();return u?H.createElement("div",UQ(WQ({},h),{ref:t,style:FQ({position:r,arrowSize:o,arrowOffset:s,arrowRadius:i,arrowPosition:l,dir:g.dir,arrowX:p,arrowY:m})})):null});lE.displayName="@mantine/core/FloatingArrow";var KQ=Object.defineProperty,qQ=Object.defineProperties,XQ=Object.getOwnPropertyDescriptors,Nm=Object.getOwnPropertySymbols,cE=Object.prototype.hasOwnProperty,uE=Object.prototype.propertyIsEnumerable,hk=(e,t,n)=>t in e?KQ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ll=(e,t)=>{for(var n in t||(t={}))cE.call(t,n)&&hk(e,n,t[n]);if(Nm)for(var n of Nm(t))uE.call(t,n)&&hk(e,n,t[n]);return e},gp=(e,t)=>qQ(e,XQ(t)),QQ=(e,t)=>{var n={};for(var r in e)cE.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Nm)for(var r of Nm(e))t.indexOf(r)<0&&uE.call(e,r)&&(n[r]=e[r]);return n};const YQ={};function dE(e){var t;const n=Dn("PopoverDropdown",YQ,e),{style:r,className:o,children:s,onKeyDownCapture:i}=n,l=QQ(n,["style","className","children","onKeyDownCapture"]),u=eE(),{classes:p,cx:m}=PQ({radius:u.radius,shadow:u.shadow},{name:u.__staticSelector,classNames:u.classNames,styles:u.styles,unstyled:u.unstyled,variant:u.variant}),h=AG({opened:u.opened,shouldReturnFocus:u.returnFocus}),g=u.withRoles?{"aria-labelledby":u.getTargetId(),id:u.getDropdownId(),role:"dialog"}:{};return u.disabled?null:H.createElement(d6,gp(Ll({},u.portalProps),{withinPortal:u.withinPortal}),H.createElement(oE,gp(Ll({mounted:u.opened},u.transitionProps),{transition:u.transitionProps.transition||"fade",duration:(t=u.transitionProps.duration)!=null?t:150,keepMounted:u.keepMounted,exitDuration:typeof u.transitionProps.exitDuration=="number"?u.transitionProps.exitDuration:u.transitionProps.duration}),x=>{var y,b;return H.createElement(sE,{active:u.trapFocus},H.createElement(zr,Ll(gp(Ll({},g),{tabIndex:-1,ref:u.floating,style:gp(Ll(Ll({},r),x),{zIndex:u.zIndex,top:(y=u.y)!=null?y:0,left:(b=u.x)!=null?b:0,width:u.width==="target"?void 0:Re(u.width)}),className:m(p.dropdown,o),onKeyDownCapture:cG(u.onClose,{active:u.closeOnEscape,onTrigger:h,onKeyDown:i}),"data-position":u.placement}),l),s,H.createElement(lE,{ref:u.arrowRef,arrowX:u.arrowX,arrowY:u.arrowY,visible:u.withArrow,position:u.placement,arrowSize:u.arrowSize,arrowRadius:u.arrowRadius,arrowOffset:u.arrowOffset,arrowPosition:u.arrowPosition,className:p.arrow})))}))}dE.displayName="@mantine/core/PopoverDropdown";function ZQ(e,t){if(e==="rtl"&&(t.includes("right")||t.includes("left"))){const[n,r]=t.split("-"),o=n==="right"?"left":"right";return r===void 0?o:`${o}-${r}`}return t}var gk=Object.getOwnPropertySymbols,JQ=Object.prototype.hasOwnProperty,eY=Object.prototype.propertyIsEnumerable,tY=(e,t)=>{var n={};for(var r in e)JQ.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&gk)for(var r of gk(e))t.indexOf(r)<0&&eY.call(e,r)&&(n[r]=e[r]);return n};const nY={position:"bottom",offset:8,positionDependencies:[],transitionProps:{transition:"fade",duration:150},middlewares:{flip:!0,shift:!0,inline:!1},arrowSize:7,arrowOffset:5,arrowRadius:0,arrowPosition:"side",closeOnClickOutside:!0,withinPortal:!1,closeOnEscape:!0,trapFocus:!1,withRoles:!0,returnFocus:!1,clickOutsideEvents:["mousedown","touchstart"],zIndex:Zb("popover"),__staticSelector:"Popover",width:"max-content"};function Bc(e){var t,n,r,o,s,i;const l=d.useRef(null),u=Dn("Popover",nY,e),{children:p,position:m,offset:h,onPositionChange:g,positionDependencies:x,opened:y,transitionProps:b,width:w,middlewares:S,withArrow:j,arrowSize:_,arrowOffset:E,arrowRadius:I,arrowPosition:M,unstyled:R,classNames:D,styles:A,closeOnClickOutside:O,withinPortal:T,portalProps:X,closeOnEscape:B,clickOutsideEvents:V,trapFocus:U,onClose:N,onOpen:$,onChange:q,zIndex:F,radius:Q,shadow:Y,id:se,defaultOpened:ae,__staticSelector:re,withRoles:G,disabled:K,returnFocus:ee,variant:ce,keepMounted:J}=u,ie=tY(u,["children","position","offset","onPositionChange","positionDependencies","opened","transitionProps","width","middlewares","withArrow","arrowSize","arrowOffset","arrowRadius","arrowPosition","unstyled","classNames","styles","closeOnClickOutside","withinPortal","portalProps","closeOnEscape","clickOutsideEvents","trapFocus","onClose","onOpen","onChange","zIndex","radius","shadow","id","defaultOpened","__staticSelector","withRoles","disabled","returnFocus","variant","keepMounted"]),[de,ge]=d.useState(null),[Ce,he]=d.useState(null),fe=ey(se),Oe=xa(),_e=bQ({middlewares:S,width:w,position:ZQ(Oe.dir,m),offset:typeof h=="number"?h+(j?_/2:0):h,arrowRef:l,arrowOffset:E,onPositionChange:g,positionDependencies:x,opened:y,defaultOpened:ae,onChange:q,onOpen:$,onClose:N});MG(()=>_e.opened&&O&&_e.onClose(),V,[de,Ce]);const Ne=d.useCallback($e=>{ge($e),_e.floating.reference($e)},[_e.floating.reference]),nt=d.useCallback($e=>{he($e),_e.floating.floating($e)},[_e.floating.floating]);return H.createElement(yQ,{value:{returnFocus:ee,disabled:K,controlled:_e.controlled,reference:Ne,floating:nt,x:_e.floating.x,y:_e.floating.y,arrowX:(r=(n=(t=_e.floating)==null?void 0:t.middlewareData)==null?void 0:n.arrow)==null?void 0:r.x,arrowY:(i=(s=(o=_e.floating)==null?void 0:o.middlewareData)==null?void 0:s.arrow)==null?void 0:i.y,opened:_e.opened,arrowRef:l,transitionProps:b,width:w,withArrow:j,arrowSize:_,arrowOffset:E,arrowRadius:I,arrowPosition:M,placement:_e.floating.placement,trapFocus:U,withinPortal:T,portalProps:X,zIndex:F,radius:Q,shadow:Y,closeOnEscape:B,onClose:_e.onClose,onToggle:_e.onToggle,getTargetId:()=>`${fe}-target`,getDropdownId:()=>`${fe}-dropdown`,withRoles:G,targetProps:ie,__staticSelector:re,classNames:D,styles:A,unstyled:R,variant:ce,keepMounted:J}},p)}Bc.Target=rE;Bc.Dropdown=dE;Bc.displayName="@mantine/core/Popover";var rY=Object.defineProperty,$m=Object.getOwnPropertySymbols,fE=Object.prototype.hasOwnProperty,pE=Object.prototype.propertyIsEnumerable,vk=(e,t,n)=>t in e?rY(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,oY=(e,t)=>{for(var n in t||(t={}))fE.call(t,n)&&vk(e,n,t[n]);if($m)for(var n of $m(t))pE.call(t,n)&&vk(e,n,t[n]);return e},sY=(e,t)=>{var n={};for(var r in e)fE.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&$m)for(var r of $m(e))t.indexOf(r)<0&&pE.call(e,r)&&(n[r]=e[r]);return n};function aY(e){var t=e,{children:n,component:r="div",maxHeight:o=220,direction:s="column",id:i,innerRef:l,__staticSelector:u,styles:p,classNames:m,unstyled:h}=t,g=sY(t,["children","component","maxHeight","direction","id","innerRef","__staticSelector","styles","classNames","unstyled"]);const{classes:x}=BX(null,{name:u,styles:p,classNames:m,unstyled:h});return H.createElement(Bc.Dropdown,oY({p:0,onMouseDown:y=>y.preventDefault()},g),H.createElement("div",{style:{maxHeight:Re(o),display:"flex"}},H.createElement(zr,{component:r||"div",id:`${i}-items`,"aria-labelledby":`${i}-label`,role:"listbox",onMouseDown:y=>y.preventDefault(),style:{flex:1,overflowY:r!==og?"auto":void 0},"data-combobox-popover":!0,tabIndex:-1,ref:l},H.createElement("div",{className:x.itemsWrapper,style:{flexDirection:s}},n))))}function Ka({opened:e,transitionProps:t={transition:"fade",duration:0},shadow:n,withinPortal:r,portalProps:o,children:s,__staticSelector:i,onDirectionChange:l,switchDirectionOnFlip:u,zIndex:p,dropdownPosition:m,positionDependencies:h=[],classNames:g,styles:x,unstyled:y,readOnly:b,variant:w}){return H.createElement(Bc,{unstyled:y,classNames:g,styles:x,width:"target",withRoles:!1,opened:e,middlewares:{flip:m==="flip",shift:!1},position:m==="flip"?"bottom":m,positionDependencies:h,zIndex:p,__staticSelector:i,withinPortal:r,portalProps:o,transitionProps:t,shadow:n,disabled:b,onPositionChange:S=>u&&(l==null?void 0:l(S==="top"?"column-reverse":"column")),variant:w},s)}Ka.Target=Bc.Target;Ka.Dropdown=aY;var iY=Object.defineProperty,lY=Object.defineProperties,cY=Object.getOwnPropertyDescriptors,Lm=Object.getOwnPropertySymbols,mE=Object.prototype.hasOwnProperty,hE=Object.prototype.propertyIsEnumerable,xk=(e,t,n)=>t in e?iY(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,vp=(e,t)=>{for(var n in t||(t={}))mE.call(t,n)&&xk(e,n,t[n]);if(Lm)for(var n of Lm(t))hE.call(t,n)&&xk(e,n,t[n]);return e},uY=(e,t)=>lY(e,cY(t)),dY=(e,t)=>{var n={};for(var r in e)mE.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Lm)for(var r of Lm(e))t.indexOf(r)<0&&hE.call(e,r)&&(n[r]=e[r]);return n};function gE(e,t,n){const r=Dn(e,t,n),{label:o,description:s,error:i,required:l,classNames:u,styles:p,className:m,unstyled:h,__staticSelector:g,sx:x,errorProps:y,labelProps:b,descriptionProps:w,wrapperProps:S,id:j,size:_,style:E,inputContainer:I,inputWrapperOrder:M,withAsterisk:R,variant:D}=r,A=dY(r,["label","description","error","required","classNames","styles","className","unstyled","__staticSelector","sx","errorProps","labelProps","descriptionProps","wrapperProps","id","size","style","inputContainer","inputWrapperOrder","withAsterisk","variant"]),O=ey(j),{systemStyles:T,rest:X}=eg(A),B=vp({label:o,description:s,error:i,required:l,classNames:u,className:m,__staticSelector:g,sx:x,errorProps:y,labelProps:b,descriptionProps:w,unstyled:h,styles:p,id:O,size:_,style:E,inputContainer:I,inputWrapperOrder:M,withAsterisk:R,variant:D},S);return uY(vp({},X),{classNames:u,styles:p,unstyled:h,wrapperProps:vp(vp({},B),T),inputProps:{required:l,classNames:u,styles:p,unstyled:h,id:O,size:_,__staticSelector:g,error:i,variant:D}})}var fY=fr((e,t,{size:n})=>({label:{display:"inline-block",fontSize:mt({size:n,sizes:e.fontSizes}),fontWeight:500,color:e.colorScheme==="dark"?e.colors.dark[0]:e.colors.gray[9],wordBreak:"break-word",cursor:"default",WebkitTapHighlightColor:"transparent"},required:{color:e.fn.variant({variant:"filled",color:"red"}).background}}));const pY=fY;var mY=Object.defineProperty,zm=Object.getOwnPropertySymbols,vE=Object.prototype.hasOwnProperty,xE=Object.prototype.propertyIsEnumerable,bk=(e,t,n)=>t in e?mY(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,hY=(e,t)=>{for(var n in t||(t={}))vE.call(t,n)&&bk(e,n,t[n]);if(zm)for(var n of zm(t))xE.call(t,n)&&bk(e,n,t[n]);return e},gY=(e,t)=>{var n={};for(var r in e)vE.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&zm)for(var r of zm(e))t.indexOf(r)<0&&xE.call(e,r)&&(n[r]=e[r]);return n};const vY={labelElement:"label",size:"sm"},cy=d.forwardRef((e,t)=>{const n=Dn("InputLabel",vY,e),{labelElement:r,children:o,required:s,size:i,classNames:l,styles:u,unstyled:p,className:m,htmlFor:h,__staticSelector:g,variant:x,onMouseDown:y}=n,b=gY(n,["labelElement","children","required","size","classNames","styles","unstyled","className","htmlFor","__staticSelector","variant","onMouseDown"]),{classes:w,cx:S}=pY(null,{name:["InputWrapper",g],classNames:l,styles:u,unstyled:p,variant:x,size:i});return H.createElement(zr,hY({component:r,ref:t,className:S(w.label,m),htmlFor:r==="label"?h:void 0,onMouseDown:j=>{y==null||y(j),!j.defaultPrevented&&j.detail>1&&j.preventDefault()}},b),o,s&&H.createElement("span",{className:w.required,"aria-hidden":!0}," *"))});cy.displayName="@mantine/core/InputLabel";var xY=fr((e,t,{size:n})=>({error:{wordBreak:"break-word",color:e.fn.variant({variant:"filled",color:"red"}).background,fontSize:`calc(${mt({size:n,sizes:e.fontSizes})} - ${Re(2)})`,lineHeight:1.2,display:"block"}}));const bY=xY;var yY=Object.defineProperty,Fm=Object.getOwnPropertySymbols,bE=Object.prototype.hasOwnProperty,yE=Object.prototype.propertyIsEnumerable,yk=(e,t,n)=>t in e?yY(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,CY=(e,t)=>{for(var n in t||(t={}))bE.call(t,n)&&yk(e,n,t[n]);if(Fm)for(var n of Fm(t))yE.call(t,n)&&yk(e,n,t[n]);return e},wY=(e,t)=>{var n={};for(var r in e)bE.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Fm)for(var r of Fm(e))t.indexOf(r)<0&&yE.call(e,r)&&(n[r]=e[r]);return n};const SY={size:"sm"},uy=d.forwardRef((e,t)=>{const n=Dn("InputError",SY,e),{children:r,className:o,classNames:s,styles:i,unstyled:l,size:u,__staticSelector:p,variant:m}=n,h=wY(n,["children","className","classNames","styles","unstyled","size","__staticSelector","variant"]),{classes:g,cx:x}=bY(null,{name:["InputWrapper",p],classNames:s,styles:i,unstyled:l,variant:m,size:u});return H.createElement(wc,CY({className:x(g.error,o),ref:t},h),r)});uy.displayName="@mantine/core/InputError";var kY=fr((e,t,{size:n})=>({description:{wordBreak:"break-word",color:e.colorScheme==="dark"?e.colors.dark[2]:e.colors.gray[6],fontSize:`calc(${mt({size:n,sizes:e.fontSizes})} - ${Re(2)})`,lineHeight:1.2,display:"block"}}));const jY=kY;var _Y=Object.defineProperty,Bm=Object.getOwnPropertySymbols,CE=Object.prototype.hasOwnProperty,wE=Object.prototype.propertyIsEnumerable,Ck=(e,t,n)=>t in e?_Y(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,IY=(e,t)=>{for(var n in t||(t={}))CE.call(t,n)&&Ck(e,n,t[n]);if(Bm)for(var n of Bm(t))wE.call(t,n)&&Ck(e,n,t[n]);return e},PY=(e,t)=>{var n={};for(var r in e)CE.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Bm)for(var r of Bm(e))t.indexOf(r)<0&&wE.call(e,r)&&(n[r]=e[r]);return n};const EY={size:"sm"},dy=d.forwardRef((e,t)=>{const n=Dn("InputDescription",EY,e),{children:r,className:o,classNames:s,styles:i,unstyled:l,size:u,__staticSelector:p,variant:m}=n,h=PY(n,["children","className","classNames","styles","unstyled","size","__staticSelector","variant"]),{classes:g,cx:x}=jY(null,{name:["InputWrapper",p],classNames:s,styles:i,unstyled:l,variant:m,size:u});return H.createElement(wc,IY({color:"dimmed",className:x(g.description,o),ref:t,unstyled:l},h),r)});dy.displayName="@mantine/core/InputDescription";const SE=d.createContext({offsetBottom:!1,offsetTop:!1,describedBy:void 0}),MY=SE.Provider,OY=()=>d.useContext(SE);function RY(e,{hasDescription:t,hasError:n}){const r=e.findIndex(u=>u==="input"),o=e[r-1],s=e[r+1];return{offsetBottom:t&&s==="description"||n&&s==="error",offsetTop:t&&o==="description"||n&&o==="error"}}var DY=Object.defineProperty,AY=Object.defineProperties,TY=Object.getOwnPropertyDescriptors,wk=Object.getOwnPropertySymbols,NY=Object.prototype.hasOwnProperty,$Y=Object.prototype.propertyIsEnumerable,Sk=(e,t,n)=>t in e?DY(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,LY=(e,t)=>{for(var n in t||(t={}))NY.call(t,n)&&Sk(e,n,t[n]);if(wk)for(var n of wk(t))$Y.call(t,n)&&Sk(e,n,t[n]);return e},zY=(e,t)=>AY(e,TY(t)),FY=fr(e=>({root:zY(LY({},e.fn.fontStyles()),{lineHeight:e.lineHeight})}));const BY=FY;var HY=Object.defineProperty,VY=Object.defineProperties,WY=Object.getOwnPropertyDescriptors,Hm=Object.getOwnPropertySymbols,kE=Object.prototype.hasOwnProperty,jE=Object.prototype.propertyIsEnumerable,kk=(e,t,n)=>t in e?HY(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,$a=(e,t)=>{for(var n in t||(t={}))kE.call(t,n)&&kk(e,n,t[n]);if(Hm)for(var n of Hm(t))jE.call(t,n)&&kk(e,n,t[n]);return e},jk=(e,t)=>VY(e,WY(t)),UY=(e,t)=>{var n={};for(var r in e)kE.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Hm)for(var r of Hm(e))t.indexOf(r)<0&&jE.call(e,r)&&(n[r]=e[r]);return n};const GY={labelElement:"label",size:"sm",inputContainer:e=>e,inputWrapperOrder:["label","description","input","error"]},_E=d.forwardRef((e,t)=>{const n=Dn("InputWrapper",GY,e),{className:r,label:o,children:s,required:i,id:l,error:u,description:p,labelElement:m,labelProps:h,descriptionProps:g,errorProps:x,classNames:y,styles:b,size:w,inputContainer:S,__staticSelector:j,unstyled:_,inputWrapperOrder:E,withAsterisk:I,variant:M}=n,R=UY(n,["className","label","children","required","id","error","description","labelElement","labelProps","descriptionProps","errorProps","classNames","styles","size","inputContainer","__staticSelector","unstyled","inputWrapperOrder","withAsterisk","variant"]),{classes:D,cx:A}=BY(null,{classNames:y,styles:b,name:["InputWrapper",j],unstyled:_,variant:M,size:w}),O={classNames:y,styles:b,unstyled:_,size:w,variant:M,__staticSelector:j},T=typeof I=="boolean"?I:i,X=l?`${l}-error`:x==null?void 0:x.id,B=l?`${l}-description`:g==null?void 0:g.id,U=`${!!u&&typeof u!="boolean"?X:""} ${p?B:""}`,N=U.trim().length>0?U.trim():void 0,$=o&&H.createElement(cy,$a($a({key:"label",labelElement:m,id:l?`${l}-label`:void 0,htmlFor:l,required:T},O),h),o),q=p&&H.createElement(dy,jk($a($a({key:"description"},g),O),{size:(g==null?void 0:g.size)||O.size,id:(g==null?void 0:g.id)||B}),p),F=H.createElement(d.Fragment,{key:"input"},S(s)),Q=typeof u!="boolean"&&u&&H.createElement(uy,jk($a($a({},x),O),{size:(x==null?void 0:x.size)||O.size,key:"error",id:(x==null?void 0:x.id)||X}),u),Y=E.map(se=>{switch(se){case"label":return $;case"input":return F;case"description":return q;case"error":return Q;default:return null}});return H.createElement(MY,{value:$a({describedBy:N},RY(E,{hasDescription:!!q,hasError:!!Q}))},H.createElement(zr,$a({className:A(D.root,r),ref:t},R),Y))});_E.displayName="@mantine/core/InputWrapper";var KY=Object.defineProperty,Vm=Object.getOwnPropertySymbols,IE=Object.prototype.hasOwnProperty,PE=Object.prototype.propertyIsEnumerable,_k=(e,t,n)=>t in e?KY(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,qY=(e,t)=>{for(var n in t||(t={}))IE.call(t,n)&&_k(e,n,t[n]);if(Vm)for(var n of Vm(t))PE.call(t,n)&&_k(e,n,t[n]);return e},XY=(e,t)=>{var n={};for(var r in e)IE.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Vm)for(var r of Vm(e))t.indexOf(r)<0&&PE.call(e,r)&&(n[r]=e[r]);return n};const QY={},EE=d.forwardRef((e,t)=>{const n=Dn("InputPlaceholder",QY,e),{sx:r}=n,o=XY(n,["sx"]);return H.createElement(zr,qY({component:"span",sx:[s=>s.fn.placeholderStyles(),...EP(r)],ref:t},o))});EE.displayName="@mantine/core/InputPlaceholder";var YY=Object.defineProperty,ZY=Object.defineProperties,JY=Object.getOwnPropertyDescriptors,Ik=Object.getOwnPropertySymbols,eZ=Object.prototype.hasOwnProperty,tZ=Object.prototype.propertyIsEnumerable,Pk=(e,t,n)=>t in e?YY(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,xp=(e,t)=>{for(var n in t||(t={}))eZ.call(t,n)&&Pk(e,n,t[n]);if(Ik)for(var n of Ik(t))tZ.call(t,n)&&Pk(e,n,t[n]);return e},Pv=(e,t)=>ZY(e,JY(t));const mo={xs:Re(30),sm:Re(36),md:Re(42),lg:Re(50),xl:Re(60)},nZ=["default","filled","unstyled"];function rZ({theme:e,variant:t}){return nZ.includes(t)?t==="default"?{border:`${Re(1)} solid ${e.colorScheme==="dark"?e.colors.dark[4]:e.colors.gray[4]}`,backgroundColor:e.colorScheme==="dark"?e.colors.dark[6]:e.white,transition:"border-color 100ms ease","&:focus, &:focus-within":e.focusRingStyles.inputStyles(e)}:t==="filled"?{border:`${Re(1)} solid transparent`,backgroundColor:e.colorScheme==="dark"?e.colors.dark[5]:e.colors.gray[1],"&:focus, &:focus-within":e.focusRingStyles.inputStyles(e)}:{borderWidth:0,color:e.colorScheme==="dark"?e.colors.dark[0]:e.black,backgroundColor:"transparent",minHeight:Re(28),outline:0,"&:focus, &:focus-within":{outline:"none",borderColor:"transparent"},"&:disabled":{backgroundColor:"transparent","&:focus, &:focus-within":{outline:"none",borderColor:"transparent"}}}:null}var oZ=fr((e,{multiline:t,radius:n,invalid:r,rightSectionWidth:o,withRightSection:s,iconWidth:i,offsetBottom:l,offsetTop:u,pointer:p},{variant:m,size:h})=>{const g=e.fn.variant({variant:"filled",color:"red"}).background,x=m==="default"||m==="filled"?{minHeight:mt({size:h,sizes:mo}),paddingLeft:`calc(${mt({size:h,sizes:mo})} / 3)`,paddingRight:s?o||mt({size:h,sizes:mo}):`calc(${mt({size:h,sizes:mo})} / 3)`,borderRadius:e.fn.radius(n)}:m==="unstyled"&&s?{paddingRight:o||mt({size:h,sizes:mo})}:null;return{wrapper:{position:"relative",marginTop:u?`calc(${e.spacing.xs} / 2)`:void 0,marginBottom:l?`calc(${e.spacing.xs} / 2)`:void 0,"&:has(input:disabled)":{"& .mantine-Input-rightSection":{display:"none"}}},input:Pv(xp(xp(Pv(xp({},e.fn.fontStyles()),{height:t?m==="unstyled"?void 0:"auto":mt({size:h,sizes:mo}),WebkitTapHighlightColor:"transparent",lineHeight:t?e.lineHeight:`calc(${mt({size:h,sizes:mo})} - ${Re(2)})`,appearance:"none",resize:"none",boxSizing:"border-box",fontSize:mt({size:h,sizes:e.fontSizes}),width:"100%",color:e.colorScheme==="dark"?e.colors.dark[0]:e.black,display:"block",textAlign:"left",cursor:p?"pointer":void 0}),rZ({theme:e,variant:m})),x),{"&:disabled, &[data-disabled]":{backgroundColor:e.colorScheme==="dark"?e.colors.dark[6]:e.colors.gray[1],color:e.colors.dark[2],opacity:.6,cursor:"not-allowed",pointerEvents:"none","&::placeholder":{color:e.colors.dark[2]}},"&[data-invalid]":{color:g,borderColor:g,"&::placeholder":{opacity:1,color:g}},"&[data-with-icon]":{paddingLeft:typeof i=="number"?Re(i):mt({size:h,sizes:mo})},"&::placeholder":Pv(xp({},e.fn.placeholderStyles()),{opacity:1}),"&::-webkit-inner-spin-button, &::-webkit-outer-spin-button, &::-webkit-search-decoration, &::-webkit-search-cancel-button, &::-webkit-search-results-button, &::-webkit-search-results-decoration":{appearance:"none"},"&[type=number]":{MozAppearance:"textfield"}}),icon:{pointerEvents:"none",position:"absolute",zIndex:1,left:0,top:0,bottom:0,display:"flex",alignItems:"center",justifyContent:"center",width:i?Re(i):mt({size:h,sizes:mo}),color:r?e.colors.red[e.colorScheme==="dark"?6:7]:e.colorScheme==="dark"?e.colors.dark[2]:e.colors.gray[5]},rightSection:{position:"absolute",top:0,bottom:0,right:0,display:"flex",alignItems:"center",justifyContent:"center",width:o||mt({size:h,sizes:mo})}}});const sZ=oZ;var aZ=Object.defineProperty,iZ=Object.defineProperties,lZ=Object.getOwnPropertyDescriptors,Wm=Object.getOwnPropertySymbols,ME=Object.prototype.hasOwnProperty,OE=Object.prototype.propertyIsEnumerable,Ek=(e,t,n)=>t in e?aZ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,bp=(e,t)=>{for(var n in t||(t={}))ME.call(t,n)&&Ek(e,n,t[n]);if(Wm)for(var n of Wm(t))OE.call(t,n)&&Ek(e,n,t[n]);return e},Mk=(e,t)=>iZ(e,lZ(t)),cZ=(e,t)=>{var n={};for(var r in e)ME.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Wm)for(var r of Wm(e))t.indexOf(r)<0&&OE.call(e,r)&&(n[r]=e[r]);return n};const uZ={size:"sm",variant:"default"},il=d.forwardRef((e,t)=>{const n=Dn("Input",uZ,e),{className:r,error:o,required:s,disabled:i,variant:l,icon:u,style:p,rightSectionWidth:m,iconWidth:h,rightSection:g,rightSectionProps:x,radius:y,size:b,wrapperProps:w,classNames:S,styles:j,__staticSelector:_,multiline:E,sx:I,unstyled:M,pointer:R}=n,D=cZ(n,["className","error","required","disabled","variant","icon","style","rightSectionWidth","iconWidth","rightSection","rightSectionProps","radius","size","wrapperProps","classNames","styles","__staticSelector","multiline","sx","unstyled","pointer"]),{offsetBottom:A,offsetTop:O,describedBy:T}=OY(),{classes:X,cx:B}=sZ({radius:y,multiline:E,invalid:!!o,rightSectionWidth:m?Re(m):void 0,iconWidth:h,withRightSection:!!g,offsetBottom:A,offsetTop:O,pointer:R},{classNames:S,styles:j,name:["Input",_],unstyled:M,variant:l,size:b}),{systemStyles:V,rest:U}=eg(D);return H.createElement(zr,bp(bp({className:B(X.wrapper,r),sx:I,style:p},V),w),u&&H.createElement("div",{className:X.icon},u),H.createElement(zr,Mk(bp({component:"input"},U),{ref:t,required:s,"aria-invalid":!!o,"aria-describedby":T,disabled:i,"data-disabled":i||void 0,"data-with-icon":!!u||void 0,"data-invalid":!!o||void 0,className:X.input})),g&&H.createElement("div",Mk(bp({},x),{className:X.rightSection}),g))});il.displayName="@mantine/core/Input";il.Wrapper=_E;il.Label=cy;il.Description=dy;il.Error=uy;il.Placeholder=EE;const _c=il;var dZ=Object.defineProperty,Um=Object.getOwnPropertySymbols,RE=Object.prototype.hasOwnProperty,DE=Object.prototype.propertyIsEnumerable,Ok=(e,t,n)=>t in e?dZ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Rk=(e,t)=>{for(var n in t||(t={}))RE.call(t,n)&&Ok(e,n,t[n]);if(Um)for(var n of Um(t))DE.call(t,n)&&Ok(e,n,t[n]);return e},fZ=(e,t)=>{var n={};for(var r in e)RE.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Um)for(var r of Um(e))t.indexOf(r)<0&&DE.call(e,r)&&(n[r]=e[r]);return n};const pZ={multiple:!1},AE=d.forwardRef((e,t)=>{const n=Dn("FileButton",pZ,e),{onChange:r,children:o,multiple:s,accept:i,name:l,form:u,resetRef:p,disabled:m,capture:h,inputProps:g}=n,x=fZ(n,["onChange","children","multiple","accept","name","form","resetRef","disabled","capture","inputProps"]),y=d.useRef(),b=()=>{!m&&y.current.click()},w=j=>{r(s?Array.from(j.currentTarget.files):j.currentTarget.files[0]||null)};return zP(p,()=>{y.current.value=""}),H.createElement(H.Fragment,null,o(Rk({onClick:b},x)),H.createElement("input",Rk({style:{display:"none"},type:"file",accept:i,multiple:s,onChange:w,ref:Bd(t,y),name:l,form:u,capture:h},g)))});AE.displayName="@mantine/core/FileButton";const TE={xs:Re(16),sm:Re(22),md:Re(26),lg:Re(30),xl:Re(36)},mZ={xs:Re(10),sm:Re(12),md:Re(14),lg:Re(16),xl:Re(18)};var hZ=fr((e,{disabled:t,radius:n,readOnly:r},{size:o,variant:s})=>({defaultValue:{display:"flex",alignItems:"center",backgroundColor:t?e.colorScheme==="dark"?e.colors.dark[5]:e.colors.gray[3]:e.colorScheme==="dark"?e.colors.dark[7]:s==="filled"?e.white:e.colors.gray[1],color:t?e.colorScheme==="dark"?e.colors.dark[1]:e.colors.gray[7]:e.colorScheme==="dark"?e.colors.dark[0]:e.colors.gray[7],height:mt({size:o,sizes:TE}),paddingLeft:`calc(${mt({size:o,sizes:e.spacing})} / 1.5)`,paddingRight:t||r?mt({size:o,sizes:e.spacing}):0,fontWeight:500,fontSize:mt({size:o,sizes:mZ}),borderRadius:mt({size:n,sizes:e.radius}),cursor:t?"not-allowed":"default",userSelect:"none",maxWidth:`calc(100% - ${Re(10)})`},defaultValueRemove:{color:e.colorScheme==="dark"?e.colors.dark[0]:e.colors.gray[7],marginLeft:`calc(${mt({size:o,sizes:e.spacing})} / 6)`},defaultValueLabel:{display:"block",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}}));const gZ=hZ;var vZ=Object.defineProperty,Gm=Object.getOwnPropertySymbols,NE=Object.prototype.hasOwnProperty,$E=Object.prototype.propertyIsEnumerable,Dk=(e,t,n)=>t in e?vZ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,xZ=(e,t)=>{for(var n in t||(t={}))NE.call(t,n)&&Dk(e,n,t[n]);if(Gm)for(var n of Gm(t))$E.call(t,n)&&Dk(e,n,t[n]);return e},bZ=(e,t)=>{var n={};for(var r in e)NE.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Gm)for(var r of Gm(e))t.indexOf(r)<0&&$E.call(e,r)&&(n[r]=e[r]);return n};const yZ={xs:16,sm:22,md:24,lg:26,xl:30};function LE(e){var t=e,{label:n,classNames:r,styles:o,className:s,onRemove:i,disabled:l,readOnly:u,size:p,radius:m="sm",variant:h,unstyled:g}=t,x=bZ(t,["label","classNames","styles","className","onRemove","disabled","readOnly","size","radius","variant","unstyled"]);const{classes:y,cx:b}=gZ({disabled:l,readOnly:u,radius:m},{name:"MultiSelect",classNames:r,styles:o,unstyled:g,size:p,variant:h});return H.createElement("div",xZ({className:b(y.defaultValue,s)},x),H.createElement("span",{className:y.defaultValueLabel},n),!l&&!u&&H.createElement(x6,{"aria-hidden":!0,onMouseDown:i,size:yZ[p],radius:2,color:"blue",variant:"transparent",iconSize:"70%",className:y.defaultValueRemove,tabIndex:-1,unstyled:g}))}LE.displayName="@mantine/core/MultiSelect/DefaultValue";function CZ({data:e,searchable:t,limit:n,searchValue:r,filter:o,value:s,disableSelectedItemFiltering:i}){if(!t&&s.length===0)return e;if(!t){const u=[];for(let p=0;pm===e[p].value&&!e[p].disabled))&&u.push(e[p]);return u}const l=[];for(let u=0;up===e[u].value&&!e[u].disabled),e[u])&&l.push(e[u]),!(l.length>=n));u+=1);return l}var wZ=Object.defineProperty,Km=Object.getOwnPropertySymbols,zE=Object.prototype.hasOwnProperty,FE=Object.prototype.propertyIsEnumerable,Ak=(e,t,n)=>t in e?wZ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Tk=(e,t)=>{for(var n in t||(t={}))zE.call(t,n)&&Ak(e,n,t[n]);if(Km)for(var n of Km(t))FE.call(t,n)&&Ak(e,n,t[n]);return e},SZ=(e,t)=>{var n={};for(var r in e)zE.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Km)for(var r of Km(e))t.indexOf(r)<0&&FE.call(e,r)&&(n[r]=e[r]);return n};const kZ={xs:Re(14),sm:Re(18),md:Re(20),lg:Re(24),xl:Re(28)};function jZ(e){var t=e,{size:n,error:r,style:o}=t,s=SZ(t,["size","error","style"]);const i=xa(),l=mt({size:n,sizes:kZ});return H.createElement("svg",Tk({viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:Tk({color:r?i.colors.red[6]:i.colors.gray[6],width:l,height:l},o),"data-chevron":!0},s),H.createElement("path",{d:"M4.93179 5.43179C4.75605 5.60753 4.75605 5.89245 4.93179 6.06819C5.10753 6.24392 5.39245 6.24392 5.56819 6.06819L7.49999 4.13638L9.43179 6.06819C9.60753 6.24392 9.89245 6.24392 10.0682 6.06819C10.2439 5.89245 10.2439 5.60753 10.0682 5.43179L7.81819 3.18179C7.73379 3.0974 7.61933 3.04999 7.49999 3.04999C7.38064 3.04999 7.26618 3.0974 7.18179 3.18179L4.93179 5.43179ZM10.0682 9.56819C10.2439 9.39245 10.2439 9.10753 10.0682 8.93179C9.89245 8.75606 9.60753 8.75606 9.43179 8.93179L7.49999 10.8636L5.56819 8.93179C5.39245 8.75606 5.10753 8.75606 4.93179 8.93179C4.75605 9.10753 4.75605 9.39245 4.93179 9.56819L7.18179 11.8182C7.35753 11.9939 7.64245 11.9939 7.81819 11.8182L10.0682 9.56819Z",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd"}))}var _Z=Object.defineProperty,IZ=Object.defineProperties,PZ=Object.getOwnPropertyDescriptors,Nk=Object.getOwnPropertySymbols,EZ=Object.prototype.hasOwnProperty,MZ=Object.prototype.propertyIsEnumerable,$k=(e,t,n)=>t in e?_Z(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,OZ=(e,t)=>{for(var n in t||(t={}))EZ.call(t,n)&&$k(e,n,t[n]);if(Nk)for(var n of Nk(t))MZ.call(t,n)&&$k(e,n,t[n]);return e},RZ=(e,t)=>IZ(e,PZ(t));function BE({shouldClear:e,clearButtonProps:t,onClear:n,size:r,error:o}){return e?H.createElement(x6,RZ(OZ({},t),{variant:"transparent",onClick:n,size:r,onMouseDown:s=>s.preventDefault()})):H.createElement(jZ,{error:o,size:r})}BE.displayName="@mantine/core/SelectRightSection";var DZ=Object.defineProperty,AZ=Object.defineProperties,TZ=Object.getOwnPropertyDescriptors,qm=Object.getOwnPropertySymbols,HE=Object.prototype.hasOwnProperty,VE=Object.prototype.propertyIsEnumerable,Lk=(e,t,n)=>t in e?DZ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ev=(e,t)=>{for(var n in t||(t={}))HE.call(t,n)&&Lk(e,n,t[n]);if(qm)for(var n of qm(t))VE.call(t,n)&&Lk(e,n,t[n]);return e},zk=(e,t)=>AZ(e,TZ(t)),NZ=(e,t)=>{var n={};for(var r in e)HE.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&qm)for(var r of qm(e))t.indexOf(r)<0&&VE.call(e,r)&&(n[r]=e[r]);return n};function WE(e){var t=e,{styles:n,rightSection:r,rightSectionWidth:o,theme:s}=t,i=NZ(t,["styles","rightSection","rightSectionWidth","theme"]);if(r)return{rightSection:r,rightSectionWidth:o,styles:n};const l=typeof n=="function"?n(s):n;return{rightSection:!i.readOnly&&!(i.disabled&&i.shouldClear)&&H.createElement(BE,Ev({},i)),styles:zk(Ev({},l),{rightSection:zk(Ev({},l==null?void 0:l.rightSection),{pointerEvents:i.shouldClear?void 0:"none"})})}}var $Z=Object.defineProperty,LZ=Object.defineProperties,zZ=Object.getOwnPropertyDescriptors,Fk=Object.getOwnPropertySymbols,FZ=Object.prototype.hasOwnProperty,BZ=Object.prototype.propertyIsEnumerable,Bk=(e,t,n)=>t in e?$Z(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,HZ=(e,t)=>{for(var n in t||(t={}))FZ.call(t,n)&&Bk(e,n,t[n]);if(Fk)for(var n of Fk(t))BZ.call(t,n)&&Bk(e,n,t[n]);return e},VZ=(e,t)=>LZ(e,zZ(t)),WZ=fr((e,{invalid:t},{size:n})=>({wrapper:{position:"relative","&:has(input:disabled)":{cursor:"not-allowed",pointerEvents:"none","& .mantine-MultiSelect-input":{backgroundColor:e.colorScheme==="dark"?e.colors.dark[6]:e.colors.gray[1],color:e.colors.dark[2],opacity:.6,"&::placeholder":{color:e.colors.dark[2]}},"& .mantine-MultiSelect-defaultValue":{backgroundColor:e.colorScheme==="dark"?e.colors.dark[5]:e.colors.gray[3],color:e.colorScheme==="dark"?e.colors.dark[1]:e.colors.gray[7]}}},values:{minHeight:`calc(${mt({size:n,sizes:mo})} - ${Re(2)})`,display:"flex",alignItems:"center",flexWrap:"wrap",marginLeft:`calc(-${e.spacing.xs} / 2)`,boxSizing:"border-box","&[data-clearable]":{marginRight:mt({size:n,sizes:mo})}},value:{margin:`calc(${e.spacing.xs} / 2 - ${Re(2)}) calc(${e.spacing.xs} / 2)`},searchInput:VZ(HZ({},e.fn.fontStyles()),{flex:1,minWidth:Re(60),backgroundColor:"transparent",border:0,outline:0,fontSize:mt({size:n,sizes:e.fontSizes}),padding:0,marginLeft:`calc(${e.spacing.xs} / 2)`,appearance:"none",color:"inherit",maxHeight:mt({size:n,sizes:TE}),"&::placeholder":{opacity:1,color:t?e.colors.red[e.fn.primaryShade()]:e.colorScheme==="dark"?e.colors.dark[3]:e.colors.gray[5]},"&:disabled":{cursor:"not-allowed",pointerEvents:"none"}}),searchInputEmpty:{width:"100%"},searchInputInputHidden:{flex:0,width:0,minWidth:0,margin:0,overflow:"hidden"},searchInputPointer:{cursor:"pointer","&:disabled":{cursor:"not-allowed",pointerEvents:"none"}},input:{cursor:"pointer","&:disabled":{cursor:"not-allowed",pointerEvents:"none"}}}));const UZ=WZ;var GZ=Object.defineProperty,KZ=Object.defineProperties,qZ=Object.getOwnPropertyDescriptors,Xm=Object.getOwnPropertySymbols,UE=Object.prototype.hasOwnProperty,GE=Object.prototype.propertyIsEnumerable,Hk=(e,t,n)=>t in e?GZ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,zl=(e,t)=>{for(var n in t||(t={}))UE.call(t,n)&&Hk(e,n,t[n]);if(Xm)for(var n of Xm(t))GE.call(t,n)&&Hk(e,n,t[n]);return e},Vk=(e,t)=>KZ(e,qZ(t)),XZ=(e,t)=>{var n={};for(var r in e)UE.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Xm)for(var r of Xm(e))t.indexOf(r)<0&&GE.call(e,r)&&(n[r]=e[r]);return n};function QZ(e,t,n){return t?!1:n.label.toLowerCase().trim().includes(e.toLowerCase().trim())}function YZ(e,t){return!!e&&!t.some(n=>n.value.toLowerCase()===e.toLowerCase())}function Wk(e,t){if(!Array.isArray(e))return;if(t.length===0)return[];const n=t.map(r=>typeof r=="object"?r.value:r);return e.filter(r=>n.includes(r))}const ZZ={size:"sm",valueComponent:LE,itemComponent:ny,transitionProps:{transition:"fade",duration:0},maxDropdownHeight:220,shadow:"sm",searchable:!1,filter:QZ,limit:1/0,clearSearchOnChange:!0,clearable:!1,clearSearchOnBlur:!1,disabled:!1,initiallyOpened:!1,creatable:!1,shouldCreate:YZ,switchDirectionOnFlip:!1,zIndex:Zb("popover"),selectOnBlur:!1,positionDependencies:[],dropdownPosition:"flip"},KE=d.forwardRef((e,t)=>{const n=Dn("MultiSelect",ZZ,e),{className:r,style:o,required:s,label:i,description:l,size:u,error:p,classNames:m,styles:h,wrapperProps:g,value:x,defaultValue:y,data:b,onChange:w,valueComponent:S,itemComponent:j,id:_,transitionProps:E,maxDropdownHeight:I,shadow:M,nothingFound:R,onFocus:D,onBlur:A,searchable:O,placeholder:T,filter:X,limit:B,clearSearchOnChange:V,clearable:U,clearSearchOnBlur:N,variant:$,onSearchChange:q,searchValue:F,disabled:Q,initiallyOpened:Y,radius:se,icon:ae,rightSection:re,rightSectionWidth:G,creatable:K,getCreateLabel:ee,shouldCreate:ce,onCreate:J,sx:ie,dropdownComponent:de,onDropdownClose:ge,onDropdownOpen:Ce,maxSelectedValues:he,withinPortal:fe,portalProps:Oe,switchDirectionOnFlip:_e,zIndex:Ne,selectOnBlur:nt,name:$e,dropdownPosition:Pt,errorProps:Ze,labelProps:ot,descriptionProps:ye,form:De,positionDependencies:ut,onKeyDown:bt,unstyled:be,inputContainer:Je,inputWrapperOrder:lt,readOnly:ft,withAsterisk:Me,clearButtonProps:Le,hoverOnSearchChange:Ut,disableSelectedItemFiltering:ke}=n,Be=XZ(n,["className","style","required","label","description","size","error","classNames","styles","wrapperProps","value","defaultValue","data","onChange","valueComponent","itemComponent","id","transitionProps","maxDropdownHeight","shadow","nothingFound","onFocus","onBlur","searchable","placeholder","filter","limit","clearSearchOnChange","clearable","clearSearchOnBlur","variant","onSearchChange","searchValue","disabled","initiallyOpened","radius","icon","rightSection","rightSectionWidth","creatable","getCreateLabel","shouldCreate","onCreate","sx","dropdownComponent","onDropdownClose","onDropdownOpen","maxSelectedValues","withinPortal","portalProps","switchDirectionOnFlip","zIndex","selectOnBlur","name","dropdownPosition","errorProps","labelProps","descriptionProps","form","positionDependencies","onKeyDown","unstyled","inputContainer","inputWrapperOrder","readOnly","withAsterisk","clearButtonProps","hoverOnSearchChange","disableSelectedItemFiltering"]),{classes:ze,cx:Ge,theme:pt}=UZ({invalid:!!p},{name:"MultiSelect",classNames:m,styles:h,unstyled:be,size:u,variant:$}),{systemStyles:En,rest:Dt}=eg(Be),At=d.useRef(),pr=d.useRef({}),Ln=ey(_),[kn,gn]=d.useState(Y),[ln,kr]=d.useState(-1),[Mo,mr]=d.useState("column"),[hr,Ns]=od({value:F,defaultValue:"",finalValue:void 0,onChange:q}),[$s,wa]=d.useState(!1),{scrollIntoView:Sa,targetRef:ml,scrollableRef:ka}=BP({duration:0,offset:5,cancelable:!1,isList:!0}),hl=K&&typeof ee=="function";let Qe=null;const Gt=b.map(rt=>typeof rt=="string"?{label:rt,value:rt}:rt),zn=MP({data:Gt}),[St,ja]=od({value:Wk(x,b),defaultValue:Wk(y,b),finalValue:[],onChange:w}),Wr=d.useRef(!!he&&he{if(!ft){const Mt=St.filter(kt=>kt!==rt);ja(Mt),he&&Mt.length{Ns(rt.currentTarget.value),!Q&&!Wr.current&&O&&gn(!0)},Fg=rt=>{typeof D=="function"&&D(rt),!Q&&!Wr.current&&O&&gn(!0)},Fn=CZ({data:zn,searchable:O,searchValue:hr,limit:B,filter:X,value:St,disableSelectedItemFiltering:ke});hl&&ce(hr,zn)&&(Qe=ee(hr),Fn.push({label:hr,value:hr,creatable:!0}));const Ls=Math.min(ln,Fn.length-1),tf=(rt,Mt,kt)=>{let Ot=rt;for(;kt(Ot);)if(Ot=Mt(Ot),!Fn[Ot].disabled)return Ot;return rt};Uo(()=>{kr(Ut&&hr?0:-1)},[hr,Ut]),Uo(()=>{!Q&&St.length>b.length&&gn(!1),he&&St.length=he&&(Wr.current=!0,gn(!1))},[St]);const gl=rt=>{if(!ft)if(V&&Ns(""),St.includes(rt.value))ef(rt.value);else{if(rt.creatable&&typeof J=="function"){const Mt=J(rt.value);typeof Mt<"u"&&Mt!==null&&ja(typeof Mt=="string"?[...St,Mt]:[...St,Mt.value])}else ja([...St,rt.value]);St.length===he-1&&(Wr.current=!0,gn(!1)),Fn.length===1&&gn(!1)}},Zc=rt=>{typeof A=="function"&&A(rt),nt&&Fn[Ls]&&kn&&gl(Fn[Ls]),N&&Ns(""),gn(!1)},hi=rt=>{if($s||(bt==null||bt(rt),ft)||rt.key!=="Backspace"&&he&&Wr.current)return;const Mt=Mo==="column",kt=()=>{kr(rr=>{var rn;const An=tf(rr,gr=>gr+1,gr=>gr{kr(rr=>{var rn;const An=tf(rr,gr=>gr-1,gr=>gr>0);return kn&&(ml.current=pr.current[(rn=Fn[An])==null?void 0:rn.value],Sa({alignment:Mt?"start":"end"})),An})};switch(rt.key){case"ArrowUp":{rt.preventDefault(),gn(!0),Mt?Ot():kt();break}case"ArrowDown":{rt.preventDefault(),gn(!0),Mt?kt():Ot();break}case"Enter":{rt.preventDefault(),Fn[Ls]&&kn?gl(Fn[Ls]):gn(!0);break}case" ":{O||(rt.preventDefault(),Fn[Ls]&&kn?gl(Fn[Ls]):gn(!0));break}case"Backspace":{St.length>0&&hr.length===0&&(ja(St.slice(0,-1)),gn(!0),he&&(Wr.current=!1));break}case"Home":{if(!O){rt.preventDefault(),kn||gn(!0);const rr=Fn.findIndex(rn=>!rn.disabled);kr(rr),Sa({alignment:Mt?"end":"start"})}break}case"End":{if(!O){rt.preventDefault(),kn||gn(!0);const rr=Fn.map(rn=>!!rn.disabled).lastIndexOf(!1);kr(rr),Sa({alignment:Mt?"end":"start"})}break}case"Escape":gn(!1)}},Jc=St.map(rt=>{let Mt=zn.find(kt=>kt.value===rt&&!kt.disabled);return!Mt&&hl&&(Mt={value:rt,label:rt}),Mt}).filter(rt=>!!rt).map((rt,Mt)=>H.createElement(S,Vk(zl({},rt),{variant:$,disabled:Q,className:ze.value,readOnly:ft,onRemove:kt=>{kt.preventDefault(),kt.stopPropagation(),ef(rt.value)},key:rt.value,size:u,styles:h,classNames:m,radius:se,index:Mt}))),eu=rt=>St.includes(rt),Bg=()=>{var rt;Ns(""),ja([]),(rt=At.current)==null||rt.focus(),he&&(Wr.current=!1)},_a=!ft&&(Fn.length>0?kn:kn&&!!R);return Uo(()=>{const rt=_a?Ce:ge;typeof rt=="function"&&rt()},[_a]),H.createElement(_c.Wrapper,zl(zl({required:s,id:Ln,label:i,error:p,description:l,size:u,className:r,style:o,classNames:m,styles:h,__staticSelector:"MultiSelect",sx:ie,errorProps:Ze,descriptionProps:ye,labelProps:ot,inputContainer:Je,inputWrapperOrder:lt,unstyled:be,withAsterisk:Me,variant:$},En),g),H.createElement(Ka,{opened:_a,transitionProps:E,shadow:"sm",withinPortal:fe,portalProps:Oe,__staticSelector:"MultiSelect",onDirectionChange:mr,switchDirectionOnFlip:_e,zIndex:Ne,dropdownPosition:Pt,positionDependencies:[...ut,hr],classNames:m,styles:h,unstyled:be,variant:$},H.createElement(Ka.Target,null,H.createElement("div",{className:ze.wrapper,role:"combobox","aria-haspopup":"listbox","aria-owns":kn&&_a?`${Ln}-items`:null,"aria-controls":Ln,"aria-expanded":kn,onMouseLeave:()=>kr(-1),tabIndex:-1},H.createElement("input",{type:"hidden",name:$e,value:St.join(","),form:De,disabled:Q}),H.createElement(_c,zl({__staticSelector:"MultiSelect",style:{overflow:"hidden"},component:"div",multiline:!0,size:u,variant:$,disabled:Q,error:p,required:s,radius:se,icon:ae,unstyled:be,onMouseDown:rt=>{var Mt;rt.preventDefault(),!Q&&!Wr.current&&gn(!kn),(Mt=At.current)==null||Mt.focus()},classNames:Vk(zl({},m),{input:Ge({[ze.input]:!O},m==null?void 0:m.input)})},WE({theme:pt,rightSection:re,rightSectionWidth:G,styles:h,size:u,shouldClear:U&&St.length>0,onClear:Bg,error:p,disabled:Q,clearButtonProps:Le,readOnly:ft})),H.createElement("div",{className:ze.values,"data-clearable":U||void 0},Jc,H.createElement("input",zl({ref:Bd(t,At),type:"search",id:Ln,className:Ge(ze.searchInput,{[ze.searchInputPointer]:!O,[ze.searchInputInputHidden]:!kn&&St.length>0||!O&&St.length>0,[ze.searchInputEmpty]:St.length===0}),onKeyDown:hi,value:hr,onChange:zg,onFocus:Fg,onBlur:Zc,readOnly:!O||Wr.current||ft,placeholder:St.length===0?T:void 0,disabled:Q,"data-mantine-stop-propagation":kn,autoComplete:"off",onCompositionStart:()=>wa(!0),onCompositionEnd:()=>wa(!1)},Dt)))))),H.createElement(Ka.Dropdown,{component:de||og,maxHeight:I,direction:Mo,id:Ln,innerRef:ka,__staticSelector:"MultiSelect",classNames:m,styles:h},H.createElement(ty,{data:Fn,hovered:Ls,classNames:m,styles:h,uuid:Ln,__staticSelector:"MultiSelect",onItemHover:kr,onItemSelect:gl,itemsRefs:pr,itemComponent:j,size:u,nothingFound:R,isItemSelected:eu,creatable:K&&!!Qe,createLabel:Qe,unstyled:be,variant:$}))))});KE.displayName="@mantine/core/MultiSelect";var JZ=Object.defineProperty,eJ=Object.defineProperties,tJ=Object.getOwnPropertyDescriptors,Qm=Object.getOwnPropertySymbols,qE=Object.prototype.hasOwnProperty,XE=Object.prototype.propertyIsEnumerable,Uk=(e,t,n)=>t in e?JZ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Mv=(e,t)=>{for(var n in t||(t={}))qE.call(t,n)&&Uk(e,n,t[n]);if(Qm)for(var n of Qm(t))XE.call(t,n)&&Uk(e,n,t[n]);return e},nJ=(e,t)=>eJ(e,tJ(t)),rJ=(e,t)=>{var n={};for(var r in e)qE.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Qm)for(var r of Qm(e))t.indexOf(r)<0&&XE.call(e,r)&&(n[r]=e[r]);return n};const oJ={type:"text",size:"sm",__staticSelector:"TextInput"},QE=d.forwardRef((e,t)=>{const n=gE("TextInput",oJ,e),{inputProps:r,wrapperProps:o}=n,s=rJ(n,["inputProps","wrapperProps"]);return H.createElement(_c.Wrapper,Mv({},o),H.createElement(_c,nJ(Mv(Mv({},r),s),{ref:t})))});QE.displayName="@mantine/core/TextInput";function sJ({data:e,searchable:t,limit:n,searchValue:r,filter:o,value:s,filterDataOnExactSearchMatch:i}){if(!t)return e;const l=s!=null&&e.find(p=>p.value===s)||null;if(l&&!i&&(l==null?void 0:l.label)===r){if(n){if(n>=e.length)return e;const p=e.indexOf(l),m=p+n,h=m-e.length;return h>0?e.slice(p-h):e.slice(p,m)}return e}const u=[];for(let p=0;p=n));p+=1);return u}var aJ=fr(()=>({input:{"&:not(:disabled)":{cursor:"pointer","&::selection":{backgroundColor:"transparent"}}}}));const iJ=aJ;var lJ=Object.defineProperty,cJ=Object.defineProperties,uJ=Object.getOwnPropertyDescriptors,Ym=Object.getOwnPropertySymbols,YE=Object.prototype.hasOwnProperty,ZE=Object.prototype.propertyIsEnumerable,Gk=(e,t,n)=>t in e?lJ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ju=(e,t)=>{for(var n in t||(t={}))YE.call(t,n)&&Gk(e,n,t[n]);if(Ym)for(var n of Ym(t))ZE.call(t,n)&&Gk(e,n,t[n]);return e},Ov=(e,t)=>cJ(e,uJ(t)),dJ=(e,t)=>{var n={};for(var r in e)YE.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Ym)for(var r of Ym(e))t.indexOf(r)<0&&ZE.call(e,r)&&(n[r]=e[r]);return n};function fJ(e,t){return t.label.toLowerCase().trim().includes(e.toLowerCase().trim())}function pJ(e,t){return!!e&&!t.some(n=>n.label.toLowerCase()===e.toLowerCase())}const mJ={required:!1,size:"sm",shadow:"sm",itemComponent:ny,transitionProps:{transition:"fade",duration:0},initiallyOpened:!1,filter:fJ,maxDropdownHeight:220,searchable:!1,clearable:!1,limit:1/0,disabled:!1,creatable:!1,shouldCreate:pJ,selectOnBlur:!1,switchDirectionOnFlip:!1,filterDataOnExactSearchMatch:!1,zIndex:Zb("popover"),positionDependencies:[],dropdownPosition:"flip"},fy=d.forwardRef((e,t)=>{const n=gE("Select",mJ,e),{inputProps:r,wrapperProps:o,shadow:s,data:i,value:l,defaultValue:u,onChange:p,itemComponent:m,onKeyDown:h,onBlur:g,onFocus:x,transitionProps:y,initiallyOpened:b,unstyled:w,classNames:S,styles:j,filter:_,maxDropdownHeight:E,searchable:I,clearable:M,nothingFound:R,limit:D,disabled:A,onSearchChange:O,searchValue:T,rightSection:X,rightSectionWidth:B,creatable:V,getCreateLabel:U,shouldCreate:N,selectOnBlur:$,onCreate:q,dropdownComponent:F,onDropdownClose:Q,onDropdownOpen:Y,withinPortal:se,portalProps:ae,switchDirectionOnFlip:re,zIndex:G,name:K,dropdownPosition:ee,allowDeselect:ce,placeholder:J,filterDataOnExactSearchMatch:ie,form:de,positionDependencies:ge,readOnly:Ce,clearButtonProps:he,hoverOnSearchChange:fe}=n,Oe=dJ(n,["inputProps","wrapperProps","shadow","data","value","defaultValue","onChange","itemComponent","onKeyDown","onBlur","onFocus","transitionProps","initiallyOpened","unstyled","classNames","styles","filter","maxDropdownHeight","searchable","clearable","nothingFound","limit","disabled","onSearchChange","searchValue","rightSection","rightSectionWidth","creatable","getCreateLabel","shouldCreate","selectOnBlur","onCreate","dropdownComponent","onDropdownClose","onDropdownOpen","withinPortal","portalProps","switchDirectionOnFlip","zIndex","name","dropdownPosition","allowDeselect","placeholder","filterDataOnExactSearchMatch","form","positionDependencies","readOnly","clearButtonProps","hoverOnSearchChange"]),{classes:_e,cx:Ne,theme:nt}=iJ(),[$e,Pt]=d.useState(b),[Ze,ot]=d.useState(-1),ye=d.useRef(),De=d.useRef({}),[ut,bt]=d.useState("column"),be=ut==="column",{scrollIntoView:Je,targetRef:lt,scrollableRef:ft}=BP({duration:0,offset:5,cancelable:!1,isList:!0}),Me=ce===void 0?M:ce,Le=Qe=>{if($e!==Qe){Pt(Qe);const Gt=Qe?Y:Q;typeof Gt=="function"&&Gt()}},Ut=V&&typeof U=="function";let ke=null;const Be=i.map(Qe=>typeof Qe=="string"?{label:Qe,value:Qe}:Qe),ze=MP({data:Be}),[Ge,pt,En]=od({value:l,defaultValue:u,finalValue:null,onChange:p}),Dt=ze.find(Qe=>Qe.value===Ge),[At,pr]=od({value:T,defaultValue:(Dt==null?void 0:Dt.label)||"",finalValue:void 0,onChange:O}),Ln=Qe=>{pr(Qe),I&&typeof O=="function"&&O(Qe)},kn=()=>{var Qe;Ce||(pt(null),En||Ln(""),(Qe=ye.current)==null||Qe.focus())};d.useEffect(()=>{const Qe=ze.find(Gt=>Gt.value===Ge);Qe?Ln(Qe.label):(!Ut||!Ge)&&Ln("")},[Ge]),d.useEffect(()=>{Dt&&(!I||!$e)&&Ln(Dt.label)},[Dt==null?void 0:Dt.label]);const gn=Qe=>{if(!Ce)if(Me&&(Dt==null?void 0:Dt.value)===Qe.value)pt(null),Le(!1);else{if(Qe.creatable&&typeof q=="function"){const Gt=q(Qe.value);typeof Gt<"u"&&Gt!==null&&pt(typeof Gt=="string"?Gt:Gt.value)}else pt(Qe.value);En||Ln(Qe.label),ot(-1),Le(!1),ye.current.focus()}},ln=sJ({data:ze,searchable:I,limit:D,searchValue:At,filter:_,filterDataOnExactSearchMatch:ie,value:Ge});Ut&&N(At,ln)&&(ke=U(At),ln.push({label:At,value:At,creatable:!0}));const kr=(Qe,Gt,zn)=>{let St=Qe;for(;zn(St);)if(St=Gt(St),!ln[St].disabled)return St;return Qe};Uo(()=>{ot(fe&&At?0:-1)},[At,fe]);const Mo=Ge?ln.findIndex(Qe=>Qe.value===Ge):0,mr=!Ce&&(ln.length>0?$e:$e&&!!R),hr=()=>{ot(Qe=>{var Gt;const zn=kr(Qe,St=>St-1,St=>St>0);return lt.current=De.current[(Gt=ln[zn])==null?void 0:Gt.value],mr&&Je({alignment:be?"start":"end"}),zn})},Ns=()=>{ot(Qe=>{var Gt;const zn=kr(Qe,St=>St+1,St=>Stwindow.setTimeout(()=>{var Qe;lt.current=De.current[(Qe=ln[Mo])==null?void 0:Qe.value],Je({alignment:be?"end":"start"})},50);Uo(()=>{mr&&$s()},[mr]);const wa=Qe=>{switch(typeof h=="function"&&h(Qe),Qe.key){case"ArrowUp":{Qe.preventDefault(),$e?be?hr():Ns():(ot(Mo),Le(!0),$s());break}case"ArrowDown":{Qe.preventDefault(),$e?be?Ns():hr():(ot(Mo),Le(!0),$s());break}case"Home":{if(!I){Qe.preventDefault(),$e||Le(!0);const Gt=ln.findIndex(zn=>!zn.disabled);ot(Gt),mr&&Je({alignment:be?"end":"start"})}break}case"End":{if(!I){Qe.preventDefault(),$e||Le(!0);const Gt=ln.map(zn=>!!zn.disabled).lastIndexOf(!1);ot(Gt),mr&&Je({alignment:be?"end":"start"})}break}case"Escape":{Qe.preventDefault(),Le(!1),ot(-1);break}case" ":{I||(Qe.preventDefault(),ln[Ze]&&$e?gn(ln[Ze]):(Le(!0),ot(Mo),$s()));break}case"Enter":I||Qe.preventDefault(),ln[Ze]&&$e&&(Qe.preventDefault(),gn(ln[Ze]))}},Sa=Qe=>{typeof g=="function"&&g(Qe);const Gt=ze.find(zn=>zn.value===Ge);$&&ln[Ze]&&$e&&gn(ln[Ze]),Ln((Gt==null?void 0:Gt.label)||""),Le(!1)},ml=Qe=>{typeof x=="function"&&x(Qe),I&&Le(!0)},ka=Qe=>{Ce||(Ln(Qe.currentTarget.value),M&&Qe.currentTarget.value===""&&pt(null),ot(-1),Le(!0))},hl=()=>{Ce||(Le(!$e),Ge&&!$e&&ot(Mo))};return H.createElement(_c.Wrapper,Ov(ju({},o),{__staticSelector:"Select"}),H.createElement(Ka,{opened:mr,transitionProps:y,shadow:s,withinPortal:se,portalProps:ae,__staticSelector:"Select",onDirectionChange:bt,switchDirectionOnFlip:re,zIndex:G,dropdownPosition:ee,positionDependencies:[...ge,At],classNames:S,styles:j,unstyled:w,variant:r.variant},H.createElement(Ka.Target,null,H.createElement("div",{role:"combobox","aria-haspopup":"listbox","aria-owns":mr?`${r.id}-items`:null,"aria-controls":r.id,"aria-expanded":mr,onMouseLeave:()=>ot(-1),tabIndex:-1},H.createElement("input",{type:"hidden",name:K,value:Ge||"",form:de,disabled:A}),H.createElement(_c,ju(Ov(ju(ju({autoComplete:"off",type:"search"},r),Oe),{ref:Bd(t,ye),onKeyDown:wa,__staticSelector:"Select",value:At,placeholder:J,onChange:ka,"aria-autocomplete":"list","aria-controls":mr?`${r.id}-items`:null,"aria-activedescendant":Ze>=0?`${r.id}-${Ze}`:null,onMouseDown:hl,onBlur:Sa,onFocus:ml,readOnly:!I||Ce,disabled:A,"data-mantine-stop-propagation":mr,name:null,classNames:Ov(ju({},S),{input:Ne({[_e.input]:!I},S==null?void 0:S.input)})}),WE({theme:nt,rightSection:X,rightSectionWidth:B,styles:j,size:r.size,shouldClear:M&&!!Dt,onClear:kn,error:o.error,clearButtonProps:he,disabled:A,readOnly:Ce}))))),H.createElement(Ka.Dropdown,{component:F||og,maxHeight:E,direction:ut,id:r.id,innerRef:ft,__staticSelector:"Select",classNames:S,styles:j},H.createElement(ty,{data:ln,hovered:Ze,classNames:S,styles:j,isItemSelected:Qe=>Qe===Ge,uuid:r.id,__staticSelector:"Select",onItemHover:ot,onItemSelect:gn,itemsRefs:De,itemComponent:m,size:r.size,nothingFound:R,creatable:Ut&&!!ke,createLabel:ke,"aria-label":o.label,unstyled:w,variant:r.variant}))))});fy.displayName="@mantine/core/Select";const Wd=()=>{const[e,t,n,r,o,s,i,l,u,p,m,h,g,x,y,b,w,S,j,_,E,I,M,R,D,A,O,T,X,B,V,U,N,$,q,F,Q,Y,se,ae,re,G,K,ee,ce,J,ie,de,ge,Ce,he,fe,Oe,_e,Ne,nt,$e,Pt,Ze,ot,ye,De,ut,bt,be,Je,lt,ft,Me,Le,Ut,ke,Be,ze,Ge,pt]=Ho("colors",["base.50","base.100","base.150","base.200","base.250","base.300","base.350","base.400","base.450","base.500","base.550","base.600","base.650","base.700","base.750","base.800","base.850","base.900","base.950","accent.50","accent.100","accent.150","accent.200","accent.250","accent.300","accent.350","accent.400","accent.450","accent.500","accent.550","accent.600","accent.650","accent.700","accent.750","accent.800","accent.850","accent.900","accent.950","baseAlpha.50","baseAlpha.100","baseAlpha.150","baseAlpha.200","baseAlpha.250","baseAlpha.300","baseAlpha.350","baseAlpha.400","baseAlpha.450","baseAlpha.500","baseAlpha.550","baseAlpha.600","baseAlpha.650","baseAlpha.700","baseAlpha.750","baseAlpha.800","baseAlpha.850","baseAlpha.900","baseAlpha.950","accentAlpha.50","accentAlpha.100","accentAlpha.150","accentAlpha.200","accentAlpha.250","accentAlpha.300","accentAlpha.350","accentAlpha.400","accentAlpha.450","accentAlpha.500","accentAlpha.550","accentAlpha.600","accentAlpha.650","accentAlpha.700","accentAlpha.750","accentAlpha.800","accentAlpha.850","accentAlpha.900","accentAlpha.950"]);return{base50:e,base100:t,base150:n,base200:r,base250:o,base300:s,base350:i,base400:l,base450:u,base500:p,base550:m,base600:h,base650:g,base700:x,base750:y,base800:b,base850:w,base900:S,base950:j,accent50:_,accent100:E,accent150:I,accent200:M,accent250:R,accent300:D,accent350:A,accent400:O,accent450:T,accent500:X,accent550:B,accent600:V,accent650:U,accent700:N,accent750:$,accent800:q,accent850:F,accent900:Q,accent950:Y,baseAlpha50:se,baseAlpha100:ae,baseAlpha150:re,baseAlpha200:G,baseAlpha250:K,baseAlpha300:ee,baseAlpha350:ce,baseAlpha400:J,baseAlpha450:ie,baseAlpha500:de,baseAlpha550:ge,baseAlpha600:Ce,baseAlpha650:he,baseAlpha700:fe,baseAlpha750:Oe,baseAlpha800:_e,baseAlpha850:Ne,baseAlpha900:nt,baseAlpha950:$e,accentAlpha50:Pt,accentAlpha100:Ze,accentAlpha150:ot,accentAlpha200:ye,accentAlpha250:De,accentAlpha300:ut,accentAlpha350:bt,accentAlpha400:be,accentAlpha450:Je,accentAlpha500:lt,accentAlpha550:ft,accentAlpha600:Me,accentAlpha650:Le,accentAlpha700:Ut,accentAlpha750:ke,accentAlpha800:Be,accentAlpha850:ze,accentAlpha900:Ge,accentAlpha950:pt}},Ae=(e,t)=>n=>n==="light"?e:t,JE=()=>{const{base50:e,base100:t,base200:n,base300:r,base400:o,base500:s,base600:i,base700:l,base800:u,base900:p,accent200:m,accent300:h,accent400:g,accent500:x,accent600:y}=Wd(),{colorMode:b}=ha(),[w]=Ho("shadows",["dark-lg"]),[S,j,_]=Ho("space",[1,2,6]),[E]=Ho("radii",["base"]),[I]=Ho("lineHeights",["base"]);return d.useCallback(()=>({label:{color:Ae(l,r)(b)},separatorLabel:{color:Ae(s,s)(b),"::after":{borderTopColor:Ae(r,l)(b)}},input:{border:"unset",backgroundColor:Ae(e,p)(b),borderRadius:E,borderStyle:"solid",borderWidth:"2px",borderColor:Ae(n,u)(b),color:Ae(p,t)(b),minHeight:"unset",lineHeight:I,height:"auto",paddingRight:0,paddingLeft:0,paddingInlineStart:j,paddingInlineEnd:_,paddingTop:S,paddingBottom:S,fontWeight:600,"&:hover":{borderColor:Ae(r,i)(b)},"&:focus":{borderColor:Ae(h,y)(b)},"&:is(:focus, :hover)":{borderColor:Ae(o,s)(b)},"&:focus-within":{borderColor:Ae(m,y)(b)},"&[data-disabled]":{backgroundColor:Ae(r,l)(b),color:Ae(i,o)(b),cursor:"not-allowed"}},value:{backgroundColor:Ae(t,p)(b),color:Ae(p,t)(b),button:{color:Ae(p,t)(b)},"&:hover":{backgroundColor:Ae(r,l)(b),cursor:"pointer"}},dropdown:{backgroundColor:Ae(n,u)(b),borderColor:Ae(n,u)(b),boxShadow:w},item:{backgroundColor:Ae(n,u)(b),color:Ae(u,n)(b),padding:6,"&[data-hovered]":{color:Ae(p,t)(b),backgroundColor:Ae(r,l)(b)},"&[data-active]":{backgroundColor:Ae(r,l)(b),"&:hover":{color:Ae(p,t)(b),backgroundColor:Ae(r,l)(b)}},"&[data-selected]":{backgroundColor:Ae(g,y)(b),color:Ae(e,t)(b),fontWeight:600,"&:hover":{backgroundColor:Ae(x,x)(b),color:Ae("white",e)(b)}},"&[data-disabled]":{color:Ae(s,i)(b),cursor:"not-allowed"}},rightSection:{width:32,button:{color:Ae(p,t)(b)}}}),[m,h,g,x,y,t,n,r,o,e,s,i,l,u,p,w,b,I,E,S,j,_])},eM=je((e,t)=>{const{searchable:n=!0,tooltip:r,inputRef:o,onChange:s,label:i,disabled:l,...u}=e,p=te(),[m,h]=d.useState(""),g=d.useCallback(w=>{w.shiftKey&&p(Nr(!0))},[p]),x=d.useCallback(w=>{w.shiftKey||p(Nr(!1))},[p]),y=d.useCallback(w=>{s&&s(w)},[s]),b=JE();return a.jsx(Ht,{label:r,placement:"top",hasArrow:!0,children:a.jsxs(Kt,{ref:t,isDisabled:l,position:"static","data-testid":`select-${i||e.placeholder}`,children:[i&&a.jsx(wn,{children:i}),a.jsx(fy,{ref:o,disabled:l,searchValue:m,onSearchChange:h,onChange:y,onKeyDown:g,onKeyUp:x,searchable:n,maxDropdownHeight:300,styles:b,...u})]})})});eM.displayName="IAIMantineSearchableSelect";const nn=d.memo(eM),hJ=le([xe],({changeBoardModal:e})=>{const{isModalOpen:t,imagesToChange:n}=e;return{isModalOpen:t,imagesToChange:n}},Se),gJ=()=>{const e=te(),[t,n]=d.useState(),{data:r,isFetching:o}=yd(),{imagesToChange:s,isModalOpen:i}=W(hJ),[l]=JR(),[u]=eD(),{t:p}=Z(),m=d.useMemo(()=>{const y=[{label:p("boards.uncategorized"),value:"none"}];return(r??[]).forEach(b=>y.push({label:b.board_name,value:b.board_id})),y},[r,p]),h=d.useCallback(()=>{e(ew()),e(Bx(!1))},[e]),g=d.useCallback(()=>{!s.length||!t||(t==="none"?u({imageDTOs:s}):l({imageDTOs:s,board_id:t}),n(null),e(ew()))},[l,e,s,u,t]),x=d.useRef(null);return a.jsx(Td,{isOpen:i,onClose:h,leastDestructiveRef:x,isCentered:!0,children:a.jsx(Yo,{children:a.jsxs(Nd,{children:[a.jsx(Qo,{fontSize:"lg",fontWeight:"bold",children:p("boards.changeBoard")}),a.jsx(Zo,{children:a.jsxs(L,{sx:{flexDir:"column",gap:4},children:[a.jsxs(ve,{children:["Moving ",`${s.length}`," image",`${s.length>1?"s":""}`," to board:"]}),a.jsx(nn,{placeholder:p(o?"boards.loading":"boards.selectBoard"),disabled:o,onChange:y=>n(y),value:t,data:m})]})}),a.jsxs(Ss,{children:[a.jsx(at,{ref:x,onClick:h,children:p("boards.cancel")}),a.jsx(at,{colorScheme:"accent",onClick:g,ml:3,children:p("boards.move")})]})]})})})},vJ=d.memo(gJ),tM=e=>{const{label:t,isDisabled:n=!1,width:r="auto",formControlProps:o,formLabelProps:s,tooltip:i,helperText:l,...u}=e;return a.jsx(Ht,{label:i,hasArrow:!0,placement:"top",isDisabled:!i,children:a.jsx(Kt,{isDisabled:n,width:r,alignItems:"center",...o,children:a.jsxs(L,{sx:{flexDir:"column",w:"full"},children:[a.jsxs(L,{sx:{alignItems:"center",w:"full"},children:[t&&a.jsx(wn,{my:1,flexGrow:1,sx:{cursor:n?"not-allowed":"pointer",...s==null?void 0:s.sx,pe:4},...s,children:t}),a.jsx(qb,{...u})]}),l&&a.jsx(u5,{children:a.jsx(ve,{variant:"subtext",children:l})})]})})})};tM.displayName="IAISwitch";const fn=d.memo(tM),xJ=e=>{const{t}=Z(),{imageUsage:n,topMessage:r=t("gallery.currentlyInUse"),bottomMessage:o=t("gallery.featuresWillReset")}=e;return!n||!Xr(n)?null:a.jsxs(a.Fragment,{children:[a.jsx(ve,{children:r}),a.jsxs(Od,{sx:{paddingInlineStart:6},children:[n.isInitialImage&&a.jsx(Qr,{children:t("common.img2img")}),n.isCanvasImage&&a.jsx(Qr,{children:t("common.unifiedCanvas")}),n.isControlNetImage&&a.jsx(Qr,{children:t("common.controlNet")}),n.isIPAdapterImage&&a.jsx(Qr,{children:t("common.ipAdapter")}),n.isNodesImage&&a.jsx(Qr,{children:t("common.nodeEditor")})]}),a.jsx(ve,{children:o})]})},nM=d.memo(xJ),bJ=le([xe,tD],(e,t)=>{const{system:n,config:r,deleteImageModal:o}=e,{shouldConfirmOnDelete:s}=n,{canRestoreDeletedImagesFromBin:i}=r,{imagesToDelete:l,isModalOpen:u}=o,p=(l??[]).map(({image_name:h})=>rI(e,h)),m={isInitialImage:Xr(p,h=>h.isInitialImage),isCanvasImage:Xr(p,h=>h.isCanvasImage),isNodesImage:Xr(p,h=>h.isNodesImage),isControlNetImage:Xr(p,h=>h.isControlNetImage),isIPAdapterImage:Xr(p,h=>h.isIPAdapterImage)};return{shouldConfirmOnDelete:s,canRestoreDeletedImagesFromBin:i,imagesToDelete:l,imagesUsage:t,isModalOpen:u,imageUsageSummary:m}},Se),yJ=()=>{const e=te(),{t}=Z(),{shouldConfirmOnDelete:n,canRestoreDeletedImagesFromBin:r,imagesToDelete:o,imagesUsage:s,isModalOpen:i,imageUsageSummary:l}=W(bJ),u=d.useCallback(g=>e(oI(!g.target.checked)),[e]),p=d.useCallback(()=>{e(tw()),e(nD(!1))},[e]),m=d.useCallback(()=>{!o.length||!s.length||(e(tw()),e(rD({imageDTOs:o,imagesUsage:s})))},[e,o,s]),h=d.useRef(null);return a.jsx(Td,{isOpen:i,onClose:p,leastDestructiveRef:h,isCentered:!0,children:a.jsx(Yo,{children:a.jsxs(Nd,{children:[a.jsx(Qo,{fontSize:"lg",fontWeight:"bold",children:t("gallery.deleteImage")}),a.jsx(Zo,{children:a.jsxs(L,{direction:"column",gap:3,children:[a.jsx(nM,{imageUsage:l}),a.jsx(Yn,{}),a.jsx(ve,{children:t(r?"gallery.deleteImageBin":"gallery.deleteImagePermanent")}),a.jsx(ve,{children:t("common.areYouSure")}),a.jsx(fn,{label:t("common.dontAskMeAgain"),isChecked:!n,onChange:u})]})}),a.jsxs(Ss,{children:[a.jsx(at,{ref:h,onClick:p,children:"Cancel"}),a.jsx(at,{colorScheme:"error",onClick:m,ml:3,children:"Delete"})]})]})})})},CJ=d.memo(yJ),rM=je((e,t)=>{const{role:n,tooltip:r="",tooltipProps:o,isChecked:s,...i}=e;return a.jsx(Ht,{label:r,hasArrow:!0,...o,...o!=null&&o.placement?{placement:o.placement}:{placement:"top"},children:a.jsx(ys,{ref:t,role:n,colorScheme:s?"accent":"base","data-testid":r,...i})})});rM.displayName="IAIIconButton";const Fe=d.memo(rM);var oM={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},Kk=H.createContext&&H.createContext(oM),qa=globalThis&&globalThis.__assign||function(){return qa=Object.assign||function(e){for(var t,n=1,r=arguments.length;n{const t=W(i=>i.config.disabledTabs),n=W(i=>i.config.disabledFeatures),r=W(i=>i.config.disabledSDFeatures),o=d.useMemo(()=>n.includes(e)||r.includes(e)||t.includes(e),[n,r,t,e]),s=d.useMemo(()=>!(n.includes(e)||r.includes(e)||t.includes(e)),[n,r,t,e]);return{isFeatureDisabled:o,isFeatureEnabled:s}};function cee(e){const{title:t,hotkey:n,description:r}=e;return a.jsxs(Ja,{sx:{gridTemplateColumns:"auto max-content",justifyContent:"space-between",alignItems:"center"},children:[a.jsxs(Ja,{children:[a.jsx(ve,{fontWeight:600,children:t}),r&&a.jsx(ve,{sx:{fontSize:"sm"},variant:"subtext",children:r})]}),a.jsx(Ie,{sx:{fontSize:"sm",fontWeight:600,px:2,py:1},children:n})]})}function uee({children:e}){const{isOpen:t,onOpen:n,onClose:r}=Lr(),{t:o}=Z(),s=[{title:o("hotkeys.invoke.title"),desc:o("hotkeys.invoke.desc"),hotkey:"Ctrl+Enter"},{title:o("hotkeys.cancel.title"),desc:o("hotkeys.cancel.desc"),hotkey:"Shift+X"},{title:o("hotkeys.focusPrompt.title"),desc:o("hotkeys.focusPrompt.desc"),hotkey:"Alt+A"},{title:o("hotkeys.toggleOptions.title"),desc:o("hotkeys.toggleOptions.desc"),hotkey:"O"},{title:o("hotkeys.toggleGallery.title"),desc:o("hotkeys.toggleGallery.desc"),hotkey:"G"},{title:o("hotkeys.maximizeWorkSpace.title"),desc:o("hotkeys.maximizeWorkSpace.desc"),hotkey:"F"},{title:o("hotkeys.changeTabs.title"),desc:o("hotkeys.changeTabs.desc"),hotkey:"1-5"}],i=[{title:o("hotkeys.setPrompt.title"),desc:o("hotkeys.setPrompt.desc"),hotkey:"P"},{title:o("hotkeys.setSeed.title"),desc:o("hotkeys.setSeed.desc"),hotkey:"S"},{title:o("hotkeys.setParameters.title"),desc:o("hotkeys.setParameters.desc"),hotkey:"A"},{title:o("hotkeys.upscale.title"),desc:o("hotkeys.upscale.desc"),hotkey:"Shift+U"},{title:o("hotkeys.showInfo.title"),desc:o("hotkeys.showInfo.desc"),hotkey:"I"},{title:o("hotkeys.sendToImageToImage.title"),desc:o("hotkeys.sendToImageToImage.desc"),hotkey:"Shift+I"},{title:o("hotkeys.deleteImage.title"),desc:o("hotkeys.deleteImage.desc"),hotkey:"Del"},{title:o("hotkeys.closePanels.title"),desc:o("hotkeys.closePanels.desc"),hotkey:"Esc"}],l=[{title:o("hotkeys.previousImage.title"),desc:o("hotkeys.previousImage.desc"),hotkey:"Arrow Left"},{title:o("hotkeys.nextImage.title"),desc:o("hotkeys.nextImage.desc"),hotkey:"Arrow Right"},{title:o("hotkeys.increaseGalleryThumbSize.title"),desc:o("hotkeys.increaseGalleryThumbSize.desc"),hotkey:"Shift+Up"},{title:o("hotkeys.decreaseGalleryThumbSize.title"),desc:o("hotkeys.decreaseGalleryThumbSize.desc"),hotkey:"Shift+Down"}],u=[{title:o("hotkeys.selectBrush.title"),desc:o("hotkeys.selectBrush.desc"),hotkey:"B"},{title:o("hotkeys.selectEraser.title"),desc:o("hotkeys.selectEraser.desc"),hotkey:"E"},{title:o("hotkeys.decreaseBrushSize.title"),desc:o("hotkeys.decreaseBrushSize.desc"),hotkey:"["},{title:o("hotkeys.increaseBrushSize.title"),desc:o("hotkeys.increaseBrushSize.desc"),hotkey:"]"},{title:o("hotkeys.decreaseBrushOpacity.title"),desc:o("hotkeys.decreaseBrushOpacity.desc"),hotkey:"Shift + ["},{title:o("hotkeys.increaseBrushOpacity.title"),desc:o("hotkeys.increaseBrushOpacity.desc"),hotkey:"Shift + ]"},{title:o("hotkeys.moveTool.title"),desc:o("hotkeys.moveTool.desc"),hotkey:"V"},{title:o("hotkeys.fillBoundingBox.title"),desc:o("hotkeys.fillBoundingBox.desc"),hotkey:"Shift + F"},{title:o("hotkeys.eraseBoundingBox.title"),desc:o("hotkeys.eraseBoundingBox.desc"),hotkey:"Delete / Backspace"},{title:o("hotkeys.colorPicker.title"),desc:o("hotkeys.colorPicker.desc"),hotkey:"C"},{title:o("hotkeys.toggleSnap.title"),desc:o("hotkeys.toggleSnap.desc"),hotkey:"N"},{title:o("hotkeys.quickToggleMove.title"),desc:o("hotkeys.quickToggleMove.desc"),hotkey:"Hold Space"},{title:o("hotkeys.toggleLayer.title"),desc:o("hotkeys.toggleLayer.desc"),hotkey:"Q"},{title:o("hotkeys.clearMask.title"),desc:o("hotkeys.clearMask.desc"),hotkey:"Shift+C"},{title:o("hotkeys.hideMask.title"),desc:o("hotkeys.hideMask.desc"),hotkey:"H"},{title:o("hotkeys.showHideBoundingBox.title"),desc:o("hotkeys.showHideBoundingBox.desc"),hotkey:"Shift+H"},{title:o("hotkeys.mergeVisible.title"),desc:o("hotkeys.mergeVisible.desc"),hotkey:"Shift+M"},{title:o("hotkeys.saveToGallery.title"),desc:o("hotkeys.saveToGallery.desc"),hotkey:"Shift+S"},{title:o("hotkeys.copyToClipboard.title"),desc:o("hotkeys.copyToClipboard.desc"),hotkey:"Ctrl+C"},{title:o("hotkeys.downloadImage.title"),desc:o("hotkeys.downloadImage.desc"),hotkey:"Shift+D"},{title:o("hotkeys.undoStroke.title"),desc:o("hotkeys.undoStroke.desc"),hotkey:"Ctrl+Z"},{title:o("hotkeys.redoStroke.title"),desc:o("hotkeys.redoStroke.desc"),hotkey:"Ctrl+Shift+Z, Ctrl+Y"},{title:o("hotkeys.resetView.title"),desc:o("hotkeys.resetView.desc"),hotkey:"R"},{title:o("hotkeys.previousStagingImage.title"),desc:o("hotkeys.previousStagingImage.desc"),hotkey:"Arrow Left"},{title:o("hotkeys.nextStagingImage.title"),desc:o("hotkeys.nextStagingImage.desc"),hotkey:"Arrow Right"},{title:o("hotkeys.acceptStagingImage.title"),desc:o("hotkeys.acceptStagingImage.desc"),hotkey:"Enter"}],p=[{title:o("hotkeys.addNodes.title"),desc:o("hotkeys.addNodes.desc"),hotkey:"Shift + A / Space"}],m=h=>a.jsx(L,{flexDir:"column",gap:4,children:h.map((g,x)=>a.jsxs(L,{flexDir:"column",px:2,gap:4,children:[a.jsx(cee,{title:g.title,description:g.desc,hotkey:g.hotkey}),x{const{data:t}=oD(),n=d.useRef(null),r=CM(n);return a.jsxs(L,{alignItems:"center",gap:5,ps:1,ref:n,children:[a.jsx(ga,{src:Hx,alt:"invoke-ai-logo",sx:{w:"32px",h:"32px",minW:"32px",minH:"32px",userSelect:"none"}}),a.jsxs(L,{sx:{gap:3,alignItems:"center"},children:[a.jsxs(ve,{sx:{fontSize:"xl",userSelect:"none"},children:["invoke ",a.jsx("strong",{children:"ai"})]}),a.jsx(dr,{children:e&&r&&t&&a.jsx(In.div,{initial:{opacity:0},animate:{opacity:1,transition:{duration:.15}},exit:{opacity:0,transition:{delay:.8}},children:a.jsx(ve,{sx:{fontWeight:600,marginTop:1,color:"base.300",fontSize:14},variant:"subtext",children:t.version})},"statusText")})]})]})},xee=d.memo(vee),wM=je((e,t)=>{const{tooltip:n,inputRef:r,label:o,disabled:s,required:i,...l}=e,u=JE();return a.jsx(Ht,{label:n,placement:"top",hasArrow:!0,children:a.jsxs(Kt,{ref:t,isRequired:i,isDisabled:s,position:"static","data-testid":`select-${o||e.placeholder}`,children:[a.jsx(wn,{children:o}),a.jsx(fy,{disabled:s,ref:r,styles:u,...l})]})})});wM.displayName="IAIMantineSelect";const Pn=d.memo(wM),bee={ar:yt.t("common.langArabic",{lng:"ar"}),nl:yt.t("common.langDutch",{lng:"nl"}),en:yt.t("common.langEnglish",{lng:"en"}),fr:yt.t("common.langFrench",{lng:"fr"}),de:yt.t("common.langGerman",{lng:"de"}),he:yt.t("common.langHebrew",{lng:"he"}),it:yt.t("common.langItalian",{lng:"it"}),ja:yt.t("common.langJapanese",{lng:"ja"}),ko:yt.t("common.langKorean",{lng:"ko"}),pl:yt.t("common.langPolish",{lng:"pl"}),pt_BR:yt.t("common.langBrPortuguese",{lng:"pt_BR"}),pt:yt.t("common.langPortuguese",{lng:"pt"}),ru:yt.t("common.langRussian",{lng:"ru"}),zh_CN:yt.t("common.langSimplifiedChinese",{lng:"zh_CN"}),es:yt.t("common.langSpanish",{lng:"es"}),uk:yt.t("common.langUkranian",{lng:"ua"})},yee={CONNECTED:"common.statusConnected",DISCONNECTED:"common.statusDisconnected",PROCESSING:"common.statusProcessing",ERROR:"common.statusError",LOADING_MODEL:"common.statusLoadingModel"},SM=le(xe,({system:e})=>e.language,Se);function Lo(e){const{t}=Z(),{label:n,textProps:r,useBadge:o=!1,badgeLabel:s=t("settings.experimental"),badgeProps:i,...l}=e;return a.jsxs(L,{justifyContent:"space-between",py:1,children:[a.jsxs(L,{gap:2,alignItems:"center",children:[a.jsx(ve,{sx:{fontSize:14,_dark:{color:"base.300"}},...r,children:n}),o&&a.jsx(Ds,{size:"xs",sx:{px:2,color:"base.700",bg:"accent.200",_dark:{bg:"accent.500",color:"base.200"}},...i,children:s})]}),a.jsx(fn,{...l})]})}const Cee=e=>a.jsx(L,{sx:{flexDirection:"column",gap:2,p:4,borderRadius:"base",bg:"base.100",_dark:{bg:"base.900"}},children:e.children}),Gl=d.memo(Cee);function wee(){const e=te(),{data:t,refetch:n}=sD(),[r,{isLoading:o}]=aD(),s=d.useCallback(()=>{r().unwrap().then(l=>{e(sI()),e(aI()),e(ct({title:`Cleared ${l} intermediates`,status:"info"}))})},[r,e]);d.useEffect(()=>{n()},[n]);const i=t?`Clear ${t} Intermediate${t>1?"s":""}`:"No Intermediates to Clear";return a.jsxs(Gl,{children:[a.jsx(cr,{size:"sm",children:"Clear Intermediates"}),a.jsx(at,{colorScheme:"warning",onClick:s,isLoading:o,isDisabled:!t,children:i}),a.jsx(ve,{fontWeight:"bold",children:"Clearing intermediates will reset your Canvas and ControlNet state."}),a.jsx(ve,{variant:"subtext",children:"Intermediate images are byproducts of generation, different from the result images in the gallery. Clearing intermediates will free disk space."}),a.jsx(ve,{variant:"subtext",children:"Your gallery images will not be deleted."})]})}const See=()=>{const{base50:e,base100:t,base200:n,base300:r,base400:o,base500:s,base600:i,base700:l,base800:u,base900:p,accent200:m,accent300:h,accent400:g,accent500:x,accent600:y}=Wd(),{colorMode:b}=ha(),[w]=Ho("shadows",["dark-lg"]);return d.useCallback(()=>({label:{color:Ae(l,r)(b)},separatorLabel:{color:Ae(s,s)(b),"::after":{borderTopColor:Ae(r,l)(b)}},searchInput:{":placeholder":{color:Ae(r,l)(b)}},input:{backgroundColor:Ae(e,p)(b),borderWidth:"2px",borderColor:Ae(n,u)(b),color:Ae(p,t)(b),paddingRight:24,fontWeight:600,"&:hover":{borderColor:Ae(r,i)(b)},"&:focus":{borderColor:Ae(h,y)(b)},"&:is(:focus, :hover)":{borderColor:Ae(o,s)(b)},"&:focus-within":{borderColor:Ae(m,y)(b)},"&[data-disabled]":{backgroundColor:Ae(r,l)(b),color:Ae(i,o)(b),cursor:"not-allowed"}},value:{backgroundColor:Ae(n,u)(b),color:Ae(p,t)(b),button:{color:Ae(p,t)(b)},"&:hover":{backgroundColor:Ae(r,l)(b),cursor:"pointer"}},dropdown:{backgroundColor:Ae(n,u)(b),borderColor:Ae(n,u)(b),boxShadow:w},item:{backgroundColor:Ae(n,u)(b),color:Ae(u,n)(b),padding:6,"&[data-hovered]":{color:Ae(p,t)(b),backgroundColor:Ae(r,l)(b)},"&[data-active]":{backgroundColor:Ae(r,l)(b),"&:hover":{color:Ae(p,t)(b),backgroundColor:Ae(r,l)(b)}},"&[data-selected]":{backgroundColor:Ae(g,y)(b),color:Ae(e,t)(b),fontWeight:600,"&:hover":{backgroundColor:Ae(x,x)(b),color:Ae("white",e)(b)}},"&[data-disabled]":{color:Ae(s,i)(b),cursor:"not-allowed"}},rightSection:{width:24,padding:20,button:{color:Ae(p,t)(b)}}}),[m,h,g,x,y,t,n,r,o,e,s,i,l,u,p,w,b])},kM=je((e,t)=>{const{searchable:n=!0,tooltip:r,inputRef:o,label:s,disabled:i,...l}=e,u=te(),p=d.useCallback(g=>{g.shiftKey&&u(Nr(!0))},[u]),m=d.useCallback(g=>{g.shiftKey||u(Nr(!1))},[u]),h=See();return a.jsx(Ht,{label:r,placement:"top",hasArrow:!0,isOpen:!0,children:a.jsxs(Kt,{ref:t,isDisabled:i,position:"static",children:[s&&a.jsx(wn,{children:s}),a.jsx(KE,{ref:o,disabled:i,onKeyDown:p,onKeyUp:m,searchable:n,maxDropdownHeight:300,styles:h,...l})]})})});kM.displayName="IAIMantineMultiSelect";const kee=d.memo(kM),jee=nr(mh,(e,t)=>({value:t,label:e})).sort((e,t)=>e.label.localeCompare(t.label));function _ee(){const e=te(),{t}=Z(),n=W(o=>o.ui.favoriteSchedulers),r=d.useCallback(o=>{e(iD(o))},[e]);return a.jsx(kee,{label:t("settings.favoriteSchedulers"),value:n,data:jee,onChange:r,clearable:!0,searchable:!0,maxSelectedValues:99,placeholder:t("settings.favoriteSchedulersPlaceholder")})}const Iee=le([xe],({system:e,ui:t})=>{const{shouldConfirmOnDelete:n,enableImageDebugging:r,consoleLogLevel:o,shouldLogToConsole:s,shouldAntialiasProgressImage:i,shouldUseNSFWChecker:l,shouldUseWatermarker:u,shouldEnableInformationalPopovers:p}=e,{shouldUseSliders:m,shouldShowProgressInViewer:h,shouldAutoChangeDimensions:g}=t;return{shouldConfirmOnDelete:n,enableImageDebugging:r,shouldUseSliders:m,shouldShowProgressInViewer:h,consoleLogLevel:o,shouldLogToConsole:s,shouldAntialiasProgressImage:i,shouldUseNSFWChecker:l,shouldUseWatermarker:u,shouldAutoChangeDimensions:g,shouldEnableInformationalPopovers:p}},{memoizeOptions:{resultEqualityCheck:Ft}}),Pee=({children:e,config:t})=>{const n=te(),{t:r}=Z(),[o,s]=d.useState(3),i=(t==null?void 0:t.shouldShowDeveloperSettings)??!0,l=(t==null?void 0:t.shouldShowResetWebUiText)??!0,u=(t==null?void 0:t.shouldShowClearIntermediates)??!0,p=(t==null?void 0:t.shouldShowLocalizationToggle)??!0;d.useEffect(()=>{i||n(nw(!1))},[i,n]);const{isNSFWCheckerAvailable:m,isWatermarkerAvailable:h}=iI(void 0,{selectFromResult:({data:Y})=>({isNSFWCheckerAvailable:(Y==null?void 0:Y.nsfw_methods.includes("nsfw_checker"))??!1,isWatermarkerAvailable:(Y==null?void 0:Y.watermarking_methods.includes("invisible_watermark"))??!1})}),{isOpen:g,onOpen:x,onClose:y}=Lr(),{isOpen:b,onOpen:w,onClose:S}=Lr(),{shouldConfirmOnDelete:j,enableImageDebugging:_,shouldUseSliders:E,shouldShowProgressInViewer:I,consoleLogLevel:M,shouldLogToConsole:R,shouldAntialiasProgressImage:D,shouldUseNSFWChecker:A,shouldUseWatermarker:O,shouldAutoChangeDimensions:T,shouldEnableInformationalPopovers:X}=W(Iee),B=d.useCallback(()=>{Object.keys(window.localStorage).forEach(Y=>{(lD.includes(Y)||Y.startsWith(cD))&&localStorage.removeItem(Y)}),y(),w(),setInterval(()=>s(Y=>Y-1),1e3)},[y,w]);d.useEffect(()=>{o<=0&&window.location.reload()},[o]);const V=d.useCallback(Y=>{n(uD(Y))},[n]),U=d.useCallback(Y=>{n(dD(Y))},[n]),N=d.useCallback(Y=>{n(nw(Y.target.checked))},[n]),{colorMode:$,toggleColorMode:q}=ha(),F=Bt("localization").isFeatureEnabled,Q=W(SM);return a.jsxs(a.Fragment,{children:[d.cloneElement(e,{onClick:x}),a.jsxs(qi,{isOpen:g,onClose:y,size:"2xl",isCentered:!0,children:[a.jsx(Yo,{}),a.jsxs(Xi,{children:[a.jsx(Qo,{bg:"none",children:r("common.settingsLabel")}),a.jsx($d,{}),a.jsx(Zo,{children:a.jsxs(L,{sx:{gap:4,flexDirection:"column"},children:[a.jsxs(Gl,{children:[a.jsx(cr,{size:"sm",children:r("settings.general")}),a.jsx(Lo,{label:r("settings.confirmOnDelete"),isChecked:j,onChange:Y=>n(oI(Y.target.checked))})]}),a.jsxs(Gl,{children:[a.jsx(cr,{size:"sm",children:r("settings.generation")}),a.jsx(_ee,{}),a.jsx(Lo,{label:"Enable NSFW Checker",isDisabled:!m,isChecked:A,onChange:Y=>n(fD(Y.target.checked))}),a.jsx(Lo,{label:"Enable Invisible Watermark",isDisabled:!h,isChecked:O,onChange:Y=>n(pD(Y.target.checked))})]}),a.jsxs(Gl,{children:[a.jsx(cr,{size:"sm",children:r("settings.ui")}),a.jsx(Lo,{label:r("common.darkMode"),isChecked:$==="dark",onChange:q}),a.jsx(Lo,{label:r("settings.useSlidersForAll"),isChecked:E,onChange:Y=>n(mD(Y.target.checked))}),a.jsx(Lo,{label:r("settings.showProgressInViewer"),isChecked:I,onChange:Y=>n(lI(Y.target.checked))}),a.jsx(Lo,{label:r("settings.antialiasProgressImages"),isChecked:D,onChange:Y=>n(hD(Y.target.checked))}),a.jsx(Lo,{label:r("settings.autoChangeDimensions"),isChecked:T,onChange:Y=>n(gD(Y.target.checked))}),p&&a.jsx(Pn,{disabled:!F,label:r("common.languagePickerLabel"),value:Q,data:Object.entries(bee).map(([Y,se])=>({value:Y,label:se})),onChange:U}),a.jsx(Lo,{label:"Enable informational popovers",isChecked:X,onChange:Y=>n(vD(Y.target.checked))})]}),i&&a.jsxs(Gl,{children:[a.jsx(cr,{size:"sm",children:r("settings.developer")}),a.jsx(Lo,{label:r("settings.shouldLogToConsole"),isChecked:R,onChange:N}),a.jsx(Pn,{disabled:!R,label:r("settings.consoleLogLevel"),onChange:V,value:M,data:xD.concat()}),a.jsx(Lo,{label:r("settings.enableImageDebugging"),isChecked:_,onChange:Y=>n(bD(Y.target.checked))})]}),u&&a.jsx(wee,{}),a.jsxs(Gl,{children:[a.jsx(cr,{size:"sm",children:r("settings.resetWebUI")}),a.jsx(at,{colorScheme:"error",onClick:B,children:r("settings.resetWebUI")}),l&&a.jsxs(a.Fragment,{children:[a.jsx(ve,{variant:"subtext",children:r("settings.resetWebUIDesc1")}),a.jsx(ve,{variant:"subtext",children:r("settings.resetWebUIDesc2")})]})]})]})}),a.jsx(Ss,{children:a.jsx(at,{onClick:y,children:r("common.close")})})]})]}),a.jsxs(qi,{closeOnOverlayClick:!1,isOpen:b,onClose:S,isCentered:!0,closeOnEsc:!1,children:[a.jsx(Yo,{backdropFilter:"blur(40px)"}),a.jsxs(Xi,{children:[a.jsx(Qo,{}),a.jsx(Zo,{children:a.jsx(L,{justifyContent:"center",children:a.jsx(ve,{fontSize:"lg",children:a.jsxs(ve,{children:[r("settings.resetComplete")," Reloading in ",o,"..."]})})})}),a.jsx(Ss,{})]})]})]})},Eee=d.memo(Pee),Mee=le(xe,({system:e})=>{const{isConnected:t,status:n}=e;return{isConnected:t,statusTranslationKey:yee[n]}},Se),Yk={ok:"green.400",working:"yellow.400",error:"red.400"},Zk={ok:"green.600",working:"yellow.500",error:"red.500"},Oee=()=>{const{isConnected:e,statusTranslationKey:t}=W(Mee),{t:n}=Z(),r=d.useRef(null),{data:o}=va(),s=d.useMemo(()=>e?o!=null&&o.queue.in_progress?"working":"ok":"error",[o==null?void 0:o.queue.in_progress,e]),i=CM(r);return a.jsxs(L,{ref:r,h:"full",px:2,alignItems:"center",gap:5,children:[a.jsx(dr,{children:i&&a.jsx(In.div,{initial:{opacity:0},animate:{opacity:1,transition:{duration:.15}},exit:{opacity:0,transition:{delay:.8}},children:a.jsx(ve,{sx:{fontSize:"sm",fontWeight:"600",pb:"1px",userSelect:"none",color:Zk[s],_dark:{color:Yk[s]}},children:n(t)})},"statusText")}),a.jsx(Nn,{as:AJ,sx:{boxSize:"0.5rem",color:Zk[s],_dark:{color:Yk[s]}}})]})},Ree=d.memo(Oee),Dee=()=>{const{t:e}=Z(),t=Bt("bugLink").isFeatureEnabled,n=Bt("discordLink").isFeatureEnabled,r=Bt("githubLink").isFeatureEnabled,o="http://github.com/invoke-ai/InvokeAI",s="https://discord.gg/ZmtBAhwWhy";return a.jsxs(L,{sx:{gap:2,alignItems:"center"},children:[a.jsx(xee,{}),a.jsx(ba,{}),a.jsx(Ree,{}),a.jsxs(Ah,{children:[a.jsx(Th,{as:Fe,variant:"link","aria-label":e("accessibility.menu"),icon:a.jsx(RJ,{}),sx:{boxSize:8}}),a.jsxs(Gi,{motionProps:vc,children:[a.jsxs(td,{title:e("common.communityLabel"),children:[r&&a.jsx(en,{as:"a",href:o,target:"_blank",icon:a.jsx(jJ,{}),children:e("common.githubLabel")}),t&&a.jsx(en,{as:"a",href:`${o}/issues`,target:"_blank",icon:a.jsx(DJ,{}),children:e("common.reportBugLabel")}),n&&a.jsx(en,{as:"a",href:s,target:"_blank",icon:a.jsx(kJ,{}),children:e("common.discordLabel")})]}),a.jsxs(td,{title:e("common.settingsLabel"),children:[a.jsx(uee,{children:a.jsx(en,{as:"button",icon:a.jsx(qJ,{}),children:e("common.hotkeysLabel")})}),a.jsx(Eee,{children:a.jsx(en,{as:"button",icon:a.jsx(cM,{}),children:e("common.settingsLabel")})})]})]})]})]})},Aee=d.memo(Dee);/*! * OverlayScrollbars * Version: 2.2.1 * @@ -53,7 +53,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho * https://github.com/KingSora * * Released under the MIT license. - */function zt(e,t){if(dg(e))for(let n=0;nt(e[n],n,e));return e}function ur(e,t){const n=li(t);if(ts(t)||n){let o=n?"":{};if(e){const s=window.getComputedStyle(e,null);o=n?nj(e,s,t):t.reduce((i,l)=>(i[l]=nj(e,s,l),i),o)}return o}e&&zt(ro(t),o=>Kee(e,o,t[o]))}const Fo=(e,t)=>{const{o:n,u:r,_:o}=e;let s=n,i;const l=(m,h)=>{const g=s,x=m,y=h||(r?!r(g,x):g!==x);return(y||o)&&(s=x,i=g),[s,y,i]};return[t?m=>l(t(s,i),m):l,m=>[s,!!m,i]]},Gd=()=>typeof window<"u",jM=Gd()&&Node.ELEMENT_NODE,{toString:Ree,hasOwnProperty:Rv}=Object.prototype,Ca=e=>e===void 0,ug=e=>e===null,Dee=e=>Ca(e)||ug(e)?`${e}`:Ree.call(e).replace(/^\[object (.+)\]$/,"$1").toLowerCase(),Xa=e=>typeof e=="number",li=e=>typeof e=="string",my=e=>typeof e=="boolean",es=e=>typeof e=="function",ts=e=>Array.isArray(e),ad=e=>typeof e=="object"&&!ts(e)&&!ug(e),dg=e=>{const t=!!e&&e.length,n=Xa(t)&&t>-1&&t%1==0;return ts(e)||!es(e)&&n?t>0&&ad(e)?t-1 in e:!0:!1},lx=e=>{if(!e||!ad(e)||Dee(e)!=="object")return!1;let t;const n="constructor",r=e[n],o=r&&r.prototype,s=Rv.call(e,n),i=o&&Rv.call(o,"isPrototypeOf");if(r&&!s&&!i)return!1;for(t in e);return Ca(t)||Rv.call(e,t)},Zm=e=>{const t=HTMLElement;return e?t?e instanceof t:e.nodeType===jM:!1},fg=e=>{const t=Element;return e?t?e instanceof t:e.nodeType===jM:!1},hy=(e,t,n)=>e.indexOf(t,n),Xt=(e,t,n)=>(!n&&!li(t)&&dg(t)?Array.prototype.push.apply(e,t):e.push(t),e),Yi=e=>{const t=Array.from,n=[];return t&&e?t(e):(e instanceof Set?e.forEach(r=>{Xt(n,r)}):zt(e,r=>{Xt(n,r)}),n)},gy=e=>!!e&&e.length===0,As=(e,t,n)=>{zt(e,o=>o&&o.apply(void 0,t||[])),!n&&(e.length=0)},pg=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),ro=e=>e?Object.keys(e):[],Cn=(e,t,n,r,o,s,i)=>{const l=[t,n,r,o,s,i];return(typeof e!="object"||ug(e))&&!es(e)&&(e={}),zt(l,u=>{zt(ro(u),p=>{const m=u[p];if(e===m)return!0;const h=ts(m);if(m&&(lx(m)||h)){const g=e[p];let x=g;h&&!ts(g)?x=[]:!h&&!lx(g)&&(x={}),e[p]=Cn(x,m)}else e[p]=m})}),e},vy=e=>{for(const t in e)return!1;return!0},_M=(e,t,n,r)=>{if(Ca(r))return n?n[e]:t;n&&(li(r)||Xa(r))&&(n[e]=r)},lr=(e,t,n)=>{if(Ca(n))return e?e.getAttribute(t):null;e&&e.setAttribute(t,n)},Mr=(e,t)=>{e&&e.removeAttribute(t)},Ni=(e,t,n,r)=>{if(n){const o=lr(e,t)||"",s=new Set(o.split(" "));s[r?"add":"delete"](n);const i=Yi(s).join(" ").trim();lr(e,t,i)}},Aee=(e,t,n)=>{const r=lr(e,t)||"";return new Set(r.split(" ")).has(n)},Ko=(e,t)=>_M("scrollLeft",0,e,t),na=(e,t)=>_M("scrollTop",0,e,t),cx=Gd()&&Element.prototype,IM=(e,t)=>{const n=[],r=t?fg(t)?t:null:document;return r?Xt(n,r.querySelectorAll(e)):n},Tee=(e,t)=>{const n=t?fg(t)?t:null:document;return n?n.querySelector(e):null},Jm=(e,t)=>fg(e)?(cx.matches||cx.msMatchesSelector).call(e,t):!1,xy=e=>e?Yi(e.childNodes):[],la=e=>e?e.parentElement:null,Jl=(e,t)=>{if(fg(e)){const n=cx.closest;if(n)return n.call(e,t);do{if(Jm(e,t))return e;e=la(e)}while(e)}return null},Nee=(e,t,n)=>{const r=e&&Jl(e,t),o=e&&Tee(n,r),s=Jl(o,t)===r;return r&&o?r===e||o===e||s&&Jl(Jl(e,n),t)!==r:!1},by=(e,t,n)=>{if(n&&e){let r=t,o;dg(n)?(o=document.createDocumentFragment(),zt(n,s=>{s===r&&(r=s.previousSibling),o.appendChild(s)})):o=n,t&&(r?r!==t&&(r=r.nextSibling):r=e.firstChild),e.insertBefore(o,r||null)}},xo=(e,t)=>{by(e,null,t)},$ee=(e,t)=>{by(la(e),e,t)},Jk=(e,t)=>{by(la(e),e&&e.nextSibling,t)},js=e=>{if(dg(e))zt(Yi(e),t=>js(t));else if(e){const t=la(e);t&&t.removeChild(e)}},$i=e=>{const t=document.createElement("div");return e&&lr(t,"class",e),t},PM=e=>{const t=$i();return t.innerHTML=e.trim(),zt(xy(t),n=>js(n))},ux=e=>e.charAt(0).toUpperCase()+e.slice(1),Lee=()=>$i().style,zee=["-webkit-","-moz-","-o-","-ms-"],Fee=["WebKit","Moz","O","MS","webkit","moz","o","ms"],Dv={},Av={},Bee=e=>{let t=Av[e];if(pg(Av,e))return t;const n=ux(e),r=Lee();return zt(zee,o=>{const s=o.replace(/-/g,"");return!(t=[e,o+e,s+n,ux(s)+n].find(l=>r[l]!==void 0))}),Av[e]=t||""},Kd=e=>{if(Gd()){let t=Dv[e]||window[e];return pg(Dv,e)||(zt(Fee,n=>(t=t||window[n+ux(e)],!t)),Dv[e]=t),t}},Hee=Kd("MutationObserver"),ej=Kd("IntersectionObserver"),ec=Kd("ResizeObserver"),EM=Kd("cancelAnimationFrame"),MM=Kd("requestAnimationFrame"),eh=Gd()&&window.setTimeout,dx=Gd()&&window.clearTimeout,Vee=/[^\x20\t\r\n\f]+/g,OM=(e,t,n)=>{const r=e&&e.classList;let o,s=0,i=!1;if(r&&t&&li(t)){const l=t.match(Vee)||[];for(i=l.length>0;o=l[s++];)i=!!n(r,o)&&i}return i},yy=(e,t)=>{OM(e,t,(n,r)=>n.remove(r))},ra=(e,t)=>(OM(e,t,(n,r)=>n.add(r)),yy.bind(0,e,t)),mg=(e,t,n,r)=>{if(e&&t){let o=!0;return zt(n,s=>{const i=r?r(e[s]):e[s],l=r?r(t[s]):t[s];i!==l&&(o=!1)}),o}return!1},RM=(e,t)=>mg(e,t,["w","h"]),DM=(e,t)=>mg(e,t,["x","y"]),Wee=(e,t)=>mg(e,t,["t","r","b","l"]),tj=(e,t,n)=>mg(e,t,["width","height"],n&&(r=>Math.round(r))),go=()=>{},Kl=e=>{let t;const n=e?eh:MM,r=e?dx:EM;return[o=>{r(t),t=n(o,es(e)?e():e)},()=>r(t)]},Cy=(e,t)=>{let n,r,o,s=go;const{v:i,g:l,p:u}=t||{},p=function(y){s(),dx(n),n=r=void 0,s=go,e.apply(this,y)},m=x=>u&&r?u(r,x):x,h=()=>{s!==go&&p(m(o)||o)},g=function(){const y=Yi(arguments),b=es(i)?i():i;if(Xa(b)&&b>=0){const S=es(l)?l():l,j=Xa(S)&&S>=0,_=b>0?eh:MM,E=b>0?dx:EM,M=m(y)||y,R=p.bind(0,M);s();const D=_(R,b);s=()=>E(D),j&&!n&&(n=eh(h,S)),r=o=M}else p(y)};return g.m=h,g},Uee={opacity:1,zindex:1},yp=(e,t)=>{const n=t?parseFloat(e):parseInt(e,10);return n===n?n:0},Gee=(e,t)=>!Uee[e.toLowerCase()]&&Xa(t)?`${t}px`:t,nj=(e,t,n)=>t!=null?t[n]||t.getPropertyValue(n):e.style[n],Kee=(e,t,n)=>{try{const{style:r}=e;Ca(r[t])?r.setProperty(t,n):r[t]=Gee(t,n)}catch{}},id=e=>ur(e,"direction")==="rtl",rj=(e,t,n)=>{const r=t?`${t}-`:"",o=n?`-${n}`:"",s=`${r}top${o}`,i=`${r}right${o}`,l=`${r}bottom${o}`,u=`${r}left${o}`,p=ur(e,[s,i,l,u]);return{t:yp(p[s],!0),r:yp(p[i],!0),b:yp(p[l],!0),l:yp(p[u],!0)}},{round:oj}=Math,wy={w:0,h:0},ld=e=>e?{w:e.offsetWidth,h:e.offsetHeight}:wy,Wp=e=>e?{w:e.clientWidth,h:e.clientHeight}:wy,th=e=>e?{w:e.scrollWidth,h:e.scrollHeight}:wy,nh=e=>{const t=parseFloat(ur(e,"height"))||0,n=parseFloat(ur(e,"width"))||0;return{w:n-oj(n),h:t-oj(t)}},xs=e=>e.getBoundingClientRect();let Cp;const qee=()=>{if(Ca(Cp)){Cp=!1;try{window.addEventListener("test",null,Object.defineProperty({},"passive",{get(){Cp=!0}}))}catch{}}return Cp},AM=e=>e.split(" "),Xee=(e,t,n,r)=>{zt(AM(t),o=>{e.removeEventListener(o,n,r)})},Wn=(e,t,n,r)=>{var o;const s=qee(),i=(o=s&&r&&r.S)!=null?o:s,l=r&&r.$||!1,u=r&&r.C||!1,p=[],m=s?{passive:i,capture:l}:l;return zt(AM(t),h=>{const g=u?x=>{e.removeEventListener(h,g,l),n&&n(x)}:n;Xt(p,Xee.bind(null,e,h,g,l)),e.addEventListener(h,g,m)}),As.bind(0,p)},TM=e=>e.stopPropagation(),NM=e=>e.preventDefault(),Qee={x:0,y:0},Tv=e=>{const t=e?xs(e):0;return t?{x:t.left+window.pageYOffset,y:t.top+window.pageXOffset}:Qee},sj=(e,t)=>{zt(ts(t)?t:[t],e)},Sy=e=>{const t=new Map,n=(s,i)=>{if(s){const l=t.get(s);sj(u=>{l&&l[u?"delete":"clear"](u)},i)}else t.forEach(l=>{l.clear()}),t.clear()},r=(s,i)=>{if(li(s)){const p=t.get(s)||new Set;return t.set(s,p),sj(m=>{es(m)&&p.add(m)},i),n.bind(0,s,i)}my(i)&&i&&n();const l=ro(s),u=[];return zt(l,p=>{const m=s[p];m&&Xt(u,r(p,m))}),As.bind(0,u)},o=(s,i)=>{const l=t.get(s);zt(Yi(l),u=>{i&&!gy(i)?u.apply(0,i):u()})};return r(e||{}),[r,n,o]},aj=e=>JSON.stringify(e,(t,n)=>{if(es(n))throw new Error;return n}),Yee={paddingAbsolute:!1,showNativeOverlaidScrollbars:!1,update:{elementEvents:[["img","load"]],debounce:[0,33],attributes:null,ignoreMutation:null},overflow:{x:"scroll",y:"scroll"},scrollbars:{theme:"os-theme-dark",visibility:"auto",autoHide:"never",autoHideDelay:1300,dragScroll:!0,clickScroll:!1,pointers:["mouse","touch","pen"]}},$M=(e,t)=>{const n={},r=ro(t).concat(ro(e));return zt(r,o=>{const s=e[o],i=t[o];if(ad(s)&&ad(i))Cn(n[o]={},$M(s,i)),vy(n[o])&&delete n[o];else if(pg(t,o)&&i!==s){let l=!0;if(ts(s)||ts(i))try{aj(s)===aj(i)&&(l=!1)}catch{}l&&(n[o]=i)}}),n},LM="os-environment",zM=`${LM}-flexbox-glue`,Zee=`${zM}-max`,FM="os-scrollbar-hidden",Nv="data-overlayscrollbars-initialize",Bo="data-overlayscrollbars",BM=`${Bo}-overflow-x`,HM=`${Bo}-overflow-y`,mc="overflowVisible",Jee="scrollbarHidden",ij="scrollbarPressed",rh="updating",Fa="data-overlayscrollbars-viewport",$v="arrange",VM="scrollbarHidden",hc=mc,fx="data-overlayscrollbars-padding",ete=hc,lj="data-overlayscrollbars-content",ky="os-size-observer",tte=`${ky}-appear`,nte=`${ky}-listener`,rte="os-trinsic-observer",ote="os-no-css-vars",ste="os-theme-none",Hr="os-scrollbar",ate=`${Hr}-rtl`,ite=`${Hr}-horizontal`,lte=`${Hr}-vertical`,WM=`${Hr}-track`,jy=`${Hr}-handle`,cte=`${Hr}-visible`,ute=`${Hr}-cornerless`,cj=`${Hr}-transitionless`,uj=`${Hr}-interaction`,dj=`${Hr}-unusable`,fj=`${Hr}-auto-hidden`,pj=`${Hr}-wheel`,dte=`${WM}-interactive`,fte=`${jy}-interactive`,UM={},Zi=()=>UM,pte=e=>{const t=[];return zt(ts(e)?e:[e],n=>{const r=ro(n);zt(r,o=>{Xt(t,UM[o]=n[o])})}),t},mte="__osOptionsValidationPlugin",hte="__osSizeObserverPlugin",_y="__osScrollbarsHidingPlugin",gte="__osClickScrollPlugin";let Lv;const mj=(e,t,n,r)=>{xo(e,t);const o=Wp(t),s=ld(t),i=nh(n);return r&&js(t),{x:s.h-o.h+i.h,y:s.w-o.w+i.w}},vte=e=>{let t=!1;const n=ra(e,FM);try{t=ur(e,Bee("scrollbar-width"))==="none"||window.getComputedStyle(e,"::-webkit-scrollbar").getPropertyValue("display")==="none"}catch{}return n(),t},xte=(e,t)=>{const n="hidden";ur(e,{overflowX:n,overflowY:n,direction:"rtl"}),Ko(e,0);const r=Tv(e),o=Tv(t);Ko(e,-999);const s=Tv(t);return{i:r.x===o.x,n:o.x!==s.x}},bte=(e,t)=>{const n=ra(e,zM),r=xs(e),o=xs(t),s=tj(o,r,!0),i=ra(e,Zee),l=xs(e),u=xs(t),p=tj(u,l,!0);return n(),i(),s&&p},yte=()=>{const{body:e}=document,n=PM(`
`)[0],r=n.firstChild,[o,,s]=Sy(),[i,l]=Fo({o:mj(e,n,r),u:DM},mj.bind(0,e,n,r,!0)),[u]=l(),p=vte(n),m={x:u.x===0,y:u.y===0},h={elements:{host:null,padding:!p,viewport:j=>p&&j===j.ownerDocument.body&&j,content:!1},scrollbars:{slot:!0},cancel:{nativeScrollbarsOverlaid:!1,body:null}},g=Cn({},Yee),x=Cn.bind(0,{},g),y=Cn.bind(0,{},h),b={k:u,A:m,I:p,L:ur(n,"zIndex")==="-1",B:xte(n,r),V:bte(n,r),Y:o.bind(0,"z"),j:o.bind(0,"r"),N:y,q:j=>Cn(h,j)&&y(),F:x,G:j=>Cn(g,j)&&x(),X:Cn({},h),U:Cn({},g)},w=window.addEventListener,S=Cy(j=>s(j?"z":"r"),{v:33,g:99});if(Mr(n,"style"),js(n),w("resize",S.bind(0,!1)),!p&&(!m.x||!m.y)){let j;w("resize",()=>{const _=Zi()[_y];j=j||_&&_.R(),j&&j(b,i,S.bind(0,!0))})}return b},Vr=()=>(Lv||(Lv=yte()),Lv),Iy=(e,t)=>es(t)?t.apply(0,e):t,Cte=(e,t,n,r)=>{const o=Ca(r)?n:r;return Iy(e,o)||t.apply(0,e)},GM=(e,t,n,r)=>{const o=Ca(r)?n:r,s=Iy(e,o);return!!s&&(Zm(s)?s:t.apply(0,e))},wte=(e,t,n)=>{const{nativeScrollbarsOverlaid:r,body:o}=n||{},{A:s,I:i}=Vr(),{nativeScrollbarsOverlaid:l,body:u}=t,p=r??l,m=Ca(o)?u:o,h=(s.x||s.y)&&p,g=e&&(ug(m)?!i:m);return!!h||!!g},Py=new WeakMap,Ste=(e,t)=>{Py.set(e,t)},kte=e=>{Py.delete(e)},KM=e=>Py.get(e),hj=(e,t)=>e?t.split(".").reduce((n,r)=>n&&pg(n,r)?n[r]:void 0,e):void 0,px=(e,t,n)=>r=>[hj(e,r),n||hj(t,r)!==void 0],qM=e=>{let t=e;return[()=>t,n=>{t=Cn({},t,n)}]},wp="tabindex",Sp=$i.bind(0,""),zv=e=>{xo(la(e),xy(e)),js(e)},jte=e=>{const t=Vr(),{N:n,I:r}=t,o=Zi()[_y],s=o&&o.T,{elements:i}=n(),{host:l,padding:u,viewport:p,content:m}=i,h=Zm(e),g=h?{}:e,{elements:x}=g,{host:y,padding:b,viewport:w,content:S}=x||{},j=h?e:g.target,_=Jm(j,"textarea"),E=j.ownerDocument,I=E.documentElement,M=j===E.body,R=E.defaultView,D=Cte.bind(0,[j]),A=GM.bind(0,[j]),O=Iy.bind(0,[j]),T=D.bind(0,Sp,p),X=A.bind(0,Sp,m),B=T(w),V=B===j,U=V&&M,N=!V&&X(S),$=!V&&Zm(B)&&B===N,q=$&&!!O(m),F=q?T():B,Q=q?N:X(),se=U?I:$?F:B,ae=_?D(Sp,l,y):j,re=U?se:ae,G=$?Q:N,K=E.activeElement,ee=!V&&R.top===R&&K===j,le={W:j,Z:re,J:se,K:!V&&A(Sp,u,b),tt:G,nt:!V&&!r&&s&&s(t),ot:U?I:se,st:U?E:se,et:R,ct:E,rt:_,it:M,lt:h,ut:V,dt:$,ft:(Ze,ot)=>Aee(se,V?Bo:Fa,V?ot:Ze),_t:(Ze,ot,ye)=>Ni(se,V?Bo:Fa,V?ot:Ze,ye)},J=ro(le).reduce((Ze,ot)=>{const ye=le[ot];return Xt(Ze,ye&&!la(ye)?ye:!1)},[]),ie=Ze=>Ze?hy(J,Ze)>-1:null,{W:de,Z:ge,K:Ce,J:he,tt:fe,nt:Oe}=le,_e=[()=>{Mr(ge,Bo),Mr(ge,Nv),Mr(de,Nv),M&&(Mr(I,Bo),Mr(I,Nv))}],Ne=_&&ie(ge);let nt=_?de:xy([fe,he,Ce,ge,de].find(Ze=>ie(Ze)===!1));const $e=U?de:fe||he;return[le,()=>{lr(ge,Bo,V?"viewport":"host"),lr(Ce,fx,""),lr(fe,lj,""),V||lr(he,Fa,"");const Ze=M&&!V?ra(la(j),FM):go;if(Ne&&(Jk(de,ge),Xt(_e,()=>{Jk(ge,de),js(ge)})),xo($e,nt),xo(ge,Ce),xo(Ce||ge,!V&&he),xo(he,fe),Xt(_e,()=>{Ze(),Mr(Ce,fx),Mr(fe,lj),Mr(he,BM),Mr(he,HM),Mr(he,Fa),ie(fe)&&zv(fe),ie(he)&&zv(he),ie(Ce)&&zv(Ce)}),r&&!V&&(Ni(he,Fa,VM,!0),Xt(_e,Mr.bind(0,he,Fa))),Oe&&($ee(he,Oe),Xt(_e,js.bind(0,Oe))),ee){const ot=lr(he,wp);lr(he,wp,"-1"),he.focus();const ye=()=>ot?lr(he,wp,ot):Mr(he,wp),De=Wn(E,"pointerdown keydown",()=>{ye(),De()});Xt(_e,[ye,De])}else K&&K.focus&&K.focus();nt=0},As.bind(0,_e)]},_te=(e,t)=>{const{tt:n}=e,[r]=t;return o=>{const{V:s}=Vr(),{ht:i}=r(),{vt:l}=o,u=(n||!s)&&l;return u&&ur(n,{height:i?"":"100%"}),{gt:u,wt:u}}},Ite=(e,t)=>{const[n,r]=t,{Z:o,K:s,J:i,ut:l}=e,[u,p]=Fo({u:Wee,o:rj()},rj.bind(0,o,"padding",""));return(m,h,g)=>{let[x,y]=p(g);const{I:b,V:w}=Vr(),{bt:S}=n(),{gt:j,wt:_,yt:E}=m,[I,M]=h("paddingAbsolute");(j||y||!w&&_)&&([x,y]=u(g));const D=!l&&(M||E||y);if(D){const A=!I||!s&&!b,O=x.r+x.l,T=x.t+x.b,X={marginRight:A&&!S?-O:0,marginBottom:A?-T:0,marginLeft:A&&S?-O:0,top:A?-x.t:0,right:A?S?-x.r:"auto":0,left:A?S?"auto":-x.l:0,width:A?`calc(100% + ${O}px)`:""},B={paddingTop:A?x.t:0,paddingRight:A?x.r:0,paddingBottom:A?x.b:0,paddingLeft:A?x.l:0};ur(s||i,X),ur(i,B),r({K:x,St:!A,P:s?B:Cn({},X,B)})}return{xt:D}}},{max:mx}=Math,Ba=mx.bind(0,0),XM="visible",gj="hidden",Pte=42,kp={u:RM,o:{w:0,h:0}},Ete={u:DM,o:{x:gj,y:gj}},Mte=(e,t)=>{const n=window.devicePixelRatio%1!==0?1:0,r={w:Ba(e.w-t.w),h:Ba(e.h-t.h)};return{w:r.w>n?r.w:0,h:r.h>n?r.h:0}},jp=e=>e.indexOf(XM)===0,Ote=(e,t)=>{const[n,r]=t,{Z:o,K:s,J:i,nt:l,ut:u,_t:p,it:m,et:h}=e,{k:g,V:x,I:y,A:b}=Vr(),w=Zi()[_y],S=!u&&!y&&(b.x||b.y),j=m&&u,[_,E]=Fo(kp,nh.bind(0,i)),[I,M]=Fo(kp,th.bind(0,i)),[R,D]=Fo(kp),[A,O]=Fo(kp),[T]=Fo(Ete),X=(q,F)=>{if(ur(i,{height:""}),F){const{St:Q,K:Y}=n(),{$t:se,D:ae}=q,re=nh(o),G=Wp(o),K=ur(i,"boxSizing")==="content-box",ee=Q||K?Y.b+Y.t:0,le=!(b.x&&K);ur(i,{height:G.h+re.h+(se.x&&le?ae.x:0)-ee})}},B=(q,F)=>{const Q=!y&&!q?Pte:0,Y=(ie,de,ge)=>{const Ce=ur(i,ie),fe=(F?F[ie]:Ce)==="scroll";return[Ce,fe,fe&&!y?de?Q:ge:0,de&&!!Q]},[se,ae,re,G]=Y("overflowX",b.x,g.x),[K,ee,le,J]=Y("overflowY",b.y,g.y);return{Ct:{x:se,y:K},$t:{x:ae,y:ee},D:{x:re,y:le},M:{x:G,y:J}}},V=(q,F,Q,Y)=>{const se=(ee,le)=>{const J=jp(ee),ie=le&&J&&ee.replace(`${XM}-`,"")||"";return[le&&!J?ee:"",jp(ie)?"hidden":ie]},[ae,re]=se(Q.x,F.x),[G,K]=se(Q.y,F.y);return Y.overflowX=re&&G?re:ae,Y.overflowY=K&&ae?K:G,B(q,Y)},U=(q,F,Q,Y)=>{const{D:se,M:ae}=q,{x:re,y:G}=ae,{x:K,y:ee}=se,{P:le}=n(),J=F?"marginLeft":"marginRight",ie=F?"paddingLeft":"paddingRight",de=le[J],ge=le.marginBottom,Ce=le[ie],he=le.paddingBottom;Y.width=`calc(100% + ${ee+-1*de}px)`,Y[J]=-ee+de,Y.marginBottom=-K+ge,Q&&(Y[ie]=Ce+(G?ee:0),Y.paddingBottom=he+(re?K:0))},[N,$]=w?w.H(S,x,i,l,n,B,U):[()=>S,()=>[go]];return(q,F,Q)=>{const{gt:Y,Ot:se,wt:ae,xt:re,vt:G,yt:K}=q,{ht:ee,bt:le}=n(),[J,ie]=F("showNativeOverlaidScrollbars"),[de,ge]=F("overflow"),Ce=J&&b.x&&b.y,he=!u&&!x&&(Y||ae||se||ie||G),fe=jp(de.x),Oe=jp(de.y),_e=fe||Oe;let Ne=E(Q),nt=M(Q),$e=D(Q),Pt=O(Q),Ze;if(ie&&y&&p(VM,Jee,!Ce),he&&(Ze=B(Ce),X(Ze,ee)),Y||re||ae||K||ie){_e&&p(hc,mc,!1);const[Se,Be]=$(Ce,le,Ze),[ze,Ge]=Ne=_(Q),[pt,Pn]=nt=I(Q),Dt=Wp(i);let At=pt,pr=Dt;Se(),(Pn||Ge||ie)&&Be&&!Ce&&N(Be,pt,ze,le)&&(pr=Wp(i),At=th(i));const Ln={w:Ba(mx(pt.w,At.w)+ze.w),h:Ba(mx(pt.h,At.h)+ze.h)},kn={w:Ba((j?h.innerWidth:pr.w+Ba(Dt.w-pt.w))+ze.w),h:Ba((j?h.innerHeight+ze.h:pr.h+Ba(Dt.h-pt.h))+ze.h)};Pt=A(kn),$e=R(Mte(Ln,kn),Q)}const[ot,ye]=Pt,[De,ut]=$e,[bt,be]=nt,[Je,lt]=Ne,ft={x:De.w>0,y:De.h>0},Me=fe&&Oe&&(ft.x||ft.y)||fe&&ft.x&&!ft.y||Oe&&ft.y&&!ft.x;if(re||K||lt||be||ye||ut||ge||ie||he){const Se={marginRight:0,marginBottom:0,marginLeft:0,width:"",overflowY:"",overflowX:""},Be=V(Ce,ft,de,Se),ze=N(Be,bt,Je,le);u||U(Be,le,ze,Se),he&&X(Be,ee),u?(lr(o,BM,Se.overflowX),lr(o,HM,Se.overflowY)):ur(i,Se)}Ni(o,Bo,mc,Me),Ni(s,fx,ete,Me),u||Ni(i,Fa,hc,_e);const[Le,Ut]=T(B(Ce).Ct);return r({Ct:Le,zt:{x:ot.w,y:ot.h},Tt:{x:De.w,y:De.h},Et:ft}),{It:Ut,At:ye,Lt:ut}}},vj=(e,t,n)=>{const r={},o=t||{},s=ro(e).concat(ro(o));return zt(s,i=>{const l=e[i],u=o[i];r[i]=!!(n||l||u)}),r},Rte=(e,t)=>{const{W:n,J:r,_t:o,ut:s}=e,{I:i,A:l,V:u}=Vr(),p=!i&&(l.x||l.y),m=[_te(e,t),Ite(e,t),Ote(e,t)];return(h,g,x)=>{const y=vj(Cn({gt:!1,xt:!1,yt:!1,vt:!1,At:!1,Lt:!1,It:!1,Ot:!1,wt:!1},g),{},x),b=p||!u,w=b&&Ko(r),S=b&&na(r);o("",rh,!0);let j=y;return zt(m,_=>{j=vj(j,_(j,h,!!x)||{},x)}),Ko(r,w),na(r,S),o("",rh),s||(Ko(n,0),na(n,0)),j}},Dte=(e,t,n)=>{let r,o=!1;const s=()=>{o=!0},i=l=>{if(n){const u=n.reduce((p,m)=>{if(m){const[h,g]=m,x=g&&h&&(l?l(h):IM(h,e));x&&x.length&&g&&li(g)&&Xt(p,[x,g.trim()],!0)}return p},[]);zt(u,p=>zt(p[0],m=>{const h=p[1],g=r.get(m)||[];if(e.contains(m)){const y=Wn(m,h,b=>{o?(y(),r.delete(m)):t(b)});r.set(m,Xt(g,y))}else As(g),r.delete(m)}))}};return n&&(r=new WeakMap,i()),[s,i]},xj=(e,t,n,r)=>{let o=!1;const{Ht:s,Pt:i,Dt:l,Mt:u,Rt:p,kt:m}=r||{},h=Cy(()=>{o&&n(!0)},{v:33,g:99}),[g,x]=Dte(e,h,l),y=s||[],b=i||[],w=y.concat(b),S=(_,E)=>{const I=p||go,M=m||go,R=new Set,D=new Set;let A=!1,O=!1;if(zt(_,T=>{const{attributeName:X,target:B,type:V,oldValue:U,addedNodes:N,removedNodes:$}=T,q=V==="attributes",F=V==="childList",Q=e===B,Y=q&&li(X)?lr(B,X):0,se=Y!==0&&U!==Y,ae=hy(b,X)>-1&&se;if(t&&(F||!Q)){const re=!q,G=q&&se,K=G&&u&&Jm(B,u),le=(K?!I(B,X,U,Y):re||G)&&!M(T,!!K,e,r);zt(N,J=>R.add(J)),zt($,J=>R.add(J)),O=O||le}!t&&Q&&se&&!I(B,X,U,Y)&&(D.add(X),A=A||ae)}),R.size>0&&x(T=>Yi(R).reduce((X,B)=>(Xt(X,IM(T,B)),Jm(B,T)?Xt(X,B):X),[])),t)return!E&&O&&n(!1),[!1];if(D.size>0||A){const T=[Yi(D),A];return!E&&n.apply(0,T),T}},j=new Hee(_=>S(_));return j.observe(e,{attributes:!0,attributeOldValue:!0,attributeFilter:w,subtree:t,childList:t,characterData:t}),o=!0,[()=>{o&&(g(),j.disconnect(),o=!1)},()=>{if(o){h.m();const _=j.takeRecords();return!gy(_)&&S(_,!0)}}]},_p=3333333,Ip=e=>e&&(e.height||e.width),QM=(e,t,n)=>{const{Bt:r=!1,Vt:o=!1}=n||{},s=Zi()[hte],{B:i}=Vr(),u=PM(`
`)[0],p=u.firstChild,m=id.bind(0,e),[h]=Fo({o:void 0,_:!0,u:(b,w)=>!(!b||!Ip(b)&&Ip(w))}),g=b=>{const w=ts(b)&&b.length>0&&ad(b[0]),S=!w&&my(b[0]);let j=!1,_=!1,E=!0;if(w){const[I,,M]=h(b.pop().contentRect),R=Ip(I),D=Ip(M);j=!M||!R,_=!D&&R,E=!j}else S?[,E]=b:_=b===!0;if(r&&E){const I=S?b[0]:id(u);Ko(u,I?i.n?-_p:i.i?0:_p:_p),na(u,_p)}j||t({gt:!S,Yt:S?b:void 0,Vt:!!_})},x=[];let y=o?g:!1;return[()=>{As(x),js(u)},()=>{if(ec){const b=new ec(g);b.observe(p),Xt(x,()=>{b.disconnect()})}else if(s){const[b,w]=s.O(p,g,o);y=b,Xt(x,w)}if(r){const[b]=Fo({o:void 0},m);Xt(x,Wn(u,"scroll",w=>{const S=b(),[j,_,E]=S;_&&(yy(p,"ltr rtl"),j?ra(p,"rtl"):ra(p,"ltr"),g([!!j,_,E])),TM(w)}))}y&&(ra(u,tte),Xt(x,Wn(u,"animationstart",y,{C:!!ec}))),(ec||s)&&xo(e,u)}]},Ate=e=>e.h===0||e.isIntersecting||e.intersectionRatio>0,Tte=(e,t)=>{let n;const r=$i(rte),o=[],[s]=Fo({o:!1}),i=(u,p)=>{if(u){const m=s(Ate(u)),[,h]=m;if(h)return!p&&t(m),[m]}},l=(u,p)=>{if(u&&u.length>0)return i(u.pop(),p)};return[()=>{As(o),js(r)},()=>{if(ej)n=new ej(u=>l(u),{root:e}),n.observe(r),Xt(o,()=>{n.disconnect()});else{const u=()=>{const h=ld(r);i(h)},[p,m]=QM(r,u);Xt(o,p),m(),u()}xo(e,r)},()=>{if(n)return l(n.takeRecords(),!0)}]},bj=`[${Bo}]`,Nte=`[${Fa}]`,Fv=["tabindex"],yj=["wrap","cols","rows"],Bv=["id","class","style","open"],$te=(e,t,n)=>{let r,o,s;const{Z:i,J:l,tt:u,rt:p,ut:m,ft:h,_t:g}=e,{V:x}=Vr(),[y]=Fo({u:RM,o:{w:0,h:0}},()=>{const V=h(hc,mc),U=h($v,""),N=U&&Ko(l),$=U&&na(l);g(hc,mc),g($v,""),g("",rh,!0);const q=th(u),F=th(l),Q=nh(l);return g(hc,mc,V),g($v,"",U),g("",rh),Ko(l,N),na(l,$),{w:F.w+q.w+Q.w,h:F.h+q.h+Q.h}}),b=p?yj:Bv.concat(yj),w=Cy(n,{v:()=>r,g:()=>o,p(V,U){const[N]=V,[$]=U;return[ro(N).concat(ro($)).reduce((q,F)=>(q[F]=N[F]||$[F],q),{})]}}),S=V=>{zt(V||Fv,U=>{if(hy(Fv,U)>-1){const N=lr(i,U);li(N)?lr(l,U,N):Mr(l,U)}})},j=(V,U)=>{const[N,$]=V,q={vt:$};return t({ht:N}),!U&&n(q),q},_=({gt:V,Yt:U,Vt:N})=>{const $=!V||N?n:w;let q=!1;if(U){const[F,Q]=U;q=Q,t({bt:F})}$({gt:V,yt:q})},E=(V,U)=>{const[,N]=y(),$={wt:N};return N&&!U&&(V?n:w)($),$},I=(V,U,N)=>{const $={Ot:U};return U?!N&&w($):m||S(V),$},[M,R,D]=u||!x?Tte(i,j):[go,go,go],[A,O]=m?[go,go]:QM(i,_,{Vt:!0,Bt:!0}),[T,X]=xj(i,!1,I,{Pt:Bv,Ht:Bv.concat(Fv)}),B=m&&ec&&new ec(_.bind(0,{gt:!0}));return B&&B.observe(i),S(),[()=>{M(),A(),s&&s[0](),B&&B.disconnect(),T()},()=>{O(),R()},()=>{const V={},U=X(),N=D(),$=s&&s[1]();return U&&Cn(V,I.apply(0,Xt(U,!0))),N&&Cn(V,j.apply(0,Xt(N,!0))),$&&Cn(V,E.apply(0,Xt($,!0))),V},V=>{const[U]=V("update.ignoreMutation"),[N,$]=V("update.attributes"),[q,F]=V("update.elementEvents"),[Q,Y]=V("update.debounce"),se=F||$,ae=re=>es(U)&&U(re);if(se&&(s&&(s[1](),s[0]()),s=xj(u||l,!0,E,{Ht:b.concat(N||[]),Dt:q,Mt:bj,kt:(re,G)=>{const{target:K,attributeName:ee}=re;return(!G&&ee&&!m?Nee(K,bj,Nte):!1)||!!Jl(K,`.${Hr}`)||!!ae(re)}})),Y)if(w.m(),ts(Q)){const re=Q[0],G=Q[1];r=Xa(re)&&re,o=Xa(G)&&G}else Xa(Q)?(r=Q,o=!1):(r=!1,o=!1)}]},Cj={x:0,y:0},Lte=e=>({K:{t:0,r:0,b:0,l:0},St:!1,P:{marginRight:0,marginBottom:0,marginLeft:0,paddingTop:0,paddingRight:0,paddingBottom:0,paddingLeft:0},zt:Cj,Tt:Cj,Ct:{x:"hidden",y:"hidden"},Et:{x:!1,y:!1},ht:!1,bt:id(e.Z)}),zte=(e,t)=>{const n=px(t,{}),[r,o,s]=Sy(),[i,l,u]=jte(e),p=qM(Lte(i)),[m,h]=p,g=Rte(i,p),x=(_,E,I)=>{const R=ro(_).some(D=>_[D])||!vy(E)||I;return R&&s("u",[_,E,I]),R},[y,b,w,S]=$te(i,h,_=>x(g(n,_),{},!1)),j=m.bind(0);return j.jt=_=>r("u",_),j.Nt=()=>{const{W:_,J:E}=i,I=Ko(_),M=na(_);b(),l(),Ko(E,I),na(E,M)},j.qt=i,[(_,E)=>{const I=px(t,_,E);return S(I),x(g(I,w(),E),_,!!E)},j,()=>{o(),y(),u()}]},{round:wj}=Math,Fte=e=>{const{width:t,height:n}=xs(e),{w:r,h:o}=ld(e);return{x:wj(t)/r||1,y:wj(n)/o||1}},Bte=(e,t,n)=>{const r=t.scrollbars,{button:o,isPrimary:s,pointerType:i}=e,{pointers:l}=r;return o===0&&s&&r[n?"dragScroll":"clickScroll"]&&(l||[]).includes(i)},Hte=(e,t)=>Wn(e,"mousedown",Wn.bind(0,t,"click",TM,{C:!0,$:!0}),{$:!0}),Sj="pointerup pointerleave pointercancel lostpointercapture",Vte=(e,t,n,r,o,s,i)=>{const{B:l}=Vr(),{Ft:u,Gt:p,Xt:m}=r,h=`scroll${i?"Left":"Top"}`,g=`client${i?"X":"Y"}`,x=i?"width":"height",y=i?"left":"top",b=i?"w":"h",w=i?"x":"y",S=(j,_)=>E=>{const{Tt:I}=s(),M=ld(p)[b]-ld(u)[b],D=_*E/M*I[w],O=id(m)&&i?l.n||l.i?1:-1:1;o[h]=j+D*O};return Wn(p,"pointerdown",j=>{const _=Jl(j.target,`.${jy}`)===u,E=_?u:p;if(Ni(t,Bo,ij,!0),Bte(j,e,_)){const I=!_&&j.shiftKey,M=()=>xs(u),R=()=>xs(p),D=(F,Q)=>(F||M())[y]-(Q||R())[y],A=S(o[h]||0,1/Fte(o)[w]),O=j[g],T=M(),X=R(),B=T[x],V=D(T,X)+B/2,U=O-X[y],N=_?0:U-V,$=F=>{As(q),E.releasePointerCapture(F.pointerId)},q=[Ni.bind(0,t,Bo,ij),Wn(n,Sj,$),Wn(n,"selectstart",F=>NM(F),{S:!1}),Wn(p,Sj,$),Wn(p,"pointermove",F=>{const Q=F[g]-O;(_||I)&&A(N+Q)})];if(I)A(N);else if(!_){const F=Zi()[gte];F&&Xt(q,F.O(A,D,N,B,U))}E.setPointerCapture(j.pointerId)}})},Wte=(e,t)=>(n,r,o,s,i,l)=>{const{Xt:u}=n,[p,m]=Kl(333),h=!!i.scrollBy;let g=!0;return As.bind(0,[Wn(u,"pointerenter",()=>{r(uj,!0)}),Wn(u,"pointerleave pointercancel",()=>{r(uj)}),Wn(u,"wheel",x=>{const{deltaX:y,deltaY:b,deltaMode:w}=x;h&&g&&w===0&&la(u)===s&&i.scrollBy({left:y,top:b,behavior:"smooth"}),g=!1,r(pj,!0),p(()=>{g=!0,r(pj)}),NM(x)},{S:!1,$:!0}),Hte(u,o),Vte(e,s,o,n,i,t,l),m])},{min:hx,max:kj,abs:Ute,round:Gte}=Math,YM=(e,t,n,r)=>{if(r){const l=n?"x":"y",{Tt:u,zt:p}=r,m=p[l],h=u[l];return kj(0,hx(1,m/(m+h)))}const o=n?"width":"height",s=xs(e)[o],i=xs(t)[o];return kj(0,hx(1,s/i))},Kte=(e,t,n,r,o,s)=>{const{B:i}=Vr(),l=s?"x":"y",u=s?"Left":"Top",{Tt:p}=r,m=Gte(p[l]),h=Ute(n[`scroll${u}`]),g=s&&o,x=i.i?h:m-h,b=hx(1,(g?x:h)/m),w=YM(e,t,s);return 1/w*(1-w)*b},qte=(e,t,n)=>{const{N:r,L:o}=Vr(),{scrollbars:s}=r(),{slot:i}=s,{ct:l,W:u,Z:p,J:m,lt:h,ot:g,it:x,ut:y}=t,{scrollbars:b}=h?{}:e,{slot:w}=b||{},S=GM([u,p,m],()=>y&&x?u:p,i,w),j=(N,$,q)=>{const F=q?ra:yy;zt(N,Q=>{F(Q.Xt,$)})},_=(N,$)=>{zt(N,q=>{const[F,Q]=$(q);ur(F,Q)})},E=(N,$,q)=>{_(N,F=>{const{Ft:Q,Gt:Y}=F;return[Q,{[q?"width":"height"]:`${(100*YM(Q,Y,q,$)).toFixed(3)}%`}]})},I=(N,$,q)=>{const F=q?"X":"Y";_(N,Q=>{const{Ft:Y,Gt:se,Xt:ae}=Q,re=Kte(Y,se,g,$,id(ae),q);return[Y,{transform:re===re?`translate${F}(${(100*re).toFixed(3)}%)`:""}]})},M=[],R=[],D=[],A=(N,$,q)=>{const F=my(q),Q=F?q:!0,Y=F?!q:!0;Q&&j(R,N,$),Y&&j(D,N,$)},O=N=>{E(R,N,!0),E(D,N)},T=N=>{I(R,N,!0),I(D,N)},X=N=>{const $=N?ite:lte,q=N?R:D,F=gy(q)?cj:"",Q=$i(`${Hr} ${$} ${F}`),Y=$i(WM),se=$i(jy),ae={Xt:Q,Gt:Y,Ft:se};return o||ra(Q,ote),xo(Q,Y),xo(Y,se),Xt(q,ae),Xt(M,[js.bind(0,Q),n(ae,A,l,p,g,N)]),ae},B=X.bind(0,!0),V=X.bind(0,!1),U=()=>{xo(S,R[0].Xt),xo(S,D[0].Xt),eh(()=>{A(cj)},300)};return B(),V(),[{Ut:O,Wt:T,Zt:A,Jt:{Kt:R,Qt:B,tn:_.bind(0,R)},nn:{Kt:D,Qt:V,tn:_.bind(0,D)}},U,As.bind(0,M)]},Xte=(e,t,n,r)=>{let o,s,i,l,u,p=0;const m=qM({}),[h]=m,[g,x]=Kl(),[y,b]=Kl(),[w,S]=Kl(100),[j,_]=Kl(100),[E,I]=Kl(()=>p),[M,R,D]=qte(e,n.qt,Wte(t,n)),{Z:A,J:O,ot:T,st:X,ut:B,it:V}=n.qt,{Jt:U,nn:N,Zt:$,Ut:q,Wt:F}=M,{tn:Q}=U,{tn:Y}=N,se=ee=>{const{Xt:le}=ee,J=B&&!V&&la(le)===O&≤return[J,{transform:J?`translate(${Ko(T)}px, ${na(T)}px)`:""}]},ae=(ee,le)=>{if(I(),ee)$(fj);else{const J=()=>$(fj,!0);p>0&&!le?E(J):J()}},re=()=>{l=s,l&&ae(!0)},G=[S,I,_,b,x,D,Wn(A,"pointerover",re,{C:!0}),Wn(A,"pointerenter",re),Wn(A,"pointerleave",()=>{l=!1,s&&ae(!1)}),Wn(A,"pointermove",()=>{o&&g(()=>{S(),ae(!0),j(()=>{o&&ae(!1)})})}),Wn(X,"scroll",ee=>{y(()=>{F(n()),i&&ae(!0),w(()=>{i&&!l&&ae(!1)})}),r(ee),B&&Q(se),B&&Y(se)})],K=h.bind(0);return K.qt=M,K.Nt=R,[(ee,le,J)=>{const{At:ie,Lt:de,It:ge,yt:Ce}=J,{A:he}=Vr(),fe=px(t,ee,le),Oe=n(),{Tt:_e,Ct:Ne,bt:nt}=Oe,[$e,Pt]=fe("showNativeOverlaidScrollbars"),[Ze,ot]=fe("scrollbars.theme"),[ye,De]=fe("scrollbars.visibility"),[ut,bt]=fe("scrollbars.autoHide"),[be]=fe("scrollbars.autoHideDelay"),[Je,lt]=fe("scrollbars.dragScroll"),[ft,Me]=fe("scrollbars.clickScroll"),Le=ie||de||Ce,Ut=ge||De,Se=$e&&he.x&&he.y,Be=(ze,Ge)=>{const pt=ye==="visible"||ye==="auto"&&ze==="scroll";return $(cte,pt,Ge),pt};if(p=be,Pt&&$(ste,Se),ot&&($(u),$(Ze,!0),u=Ze),bt&&(o=ut==="move",s=ut==="leave",i=ut!=="never",ae(!i,!0)),lt&&$(fte,Je),Me&&$(dte,ft),Ut){const ze=Be(Ne.x,!0),Ge=Be(Ne.y,!1);$(ute,!(ze&&Ge))}Le&&(q(Oe),F(Oe),$(dj,!_e.x,!0),$(dj,!_e.y,!1),$(ate,nt&&!V))},K,As.bind(0,G)]},ZM=(e,t,n)=>{es(e)&&e(t||void 0,n||void 0)},Ua=(e,t,n)=>{const{F:r,N:o,Y:s,j:i}=Vr(),l=Zi(),u=Zm(e),p=u?e:e.target,m=KM(p);if(t&&!m){let h=!1;const g=B=>{const V=Zi()[mte],U=V&&V.O;return U?U(B,!0):B},x=Cn({},r(),g(t)),[y,b,w]=Sy(n),[S,j,_]=zte(e,x),[E,I,M]=Xte(e,x,j,B=>w("scroll",[X,B])),R=(B,V)=>S(B,!!V),D=R.bind(0,{},!0),A=s(D),O=i(D),T=B=>{kte(p),A(),O(),M(),_(),h=!0,w("destroyed",[X,!!B]),b()},X={options(B,V){if(B){const U=V?r():{},N=$M(x,Cn(U,g(B)));vy(N)||(Cn(x,N),R(N))}return Cn({},x)},on:y,off:(B,V)=>{B&&V&&b(B,V)},state(){const{zt:B,Tt:V,Ct:U,Et:N,K:$,St:q,bt:F}=j();return Cn({},{overflowEdge:B,overflowAmount:V,overflowStyle:U,hasOverflow:N,padding:$,paddingAbsolute:q,directionRTL:F,destroyed:h})},elements(){const{W:B,Z:V,K:U,J:N,tt:$,ot:q,st:F}=j.qt,{Jt:Q,nn:Y}=I.qt,se=re=>{const{Ft:G,Gt:K,Xt:ee}=re;return{scrollbar:ee,track:K,handle:G}},ae=re=>{const{Kt:G,Qt:K}=re,ee=se(G[0]);return Cn({},ee,{clone:()=>{const le=se(K());return E({},!0,{}),le}})};return Cn({},{target:B,host:V,padding:U||N,viewport:N,content:$||N,scrollOffsetElement:q,scrollEventElement:F,scrollbarHorizontal:ae(Q),scrollbarVertical:ae(Y)})},update:B=>R({},B),destroy:T.bind(0)};return j.jt((B,V,U)=>{E(V,U,B)}),Ste(p,X),zt(ro(l),B=>ZM(l[B],0,X)),wte(j.qt.it,o().cancel,!u&&e.cancel)?(T(!0),X):(j.Nt(),I.Nt(),w("initialized",[X]),j.jt((B,V,U)=>{const{gt:N,yt:$,vt:q,At:F,Lt:Q,It:Y,wt:se,Ot:ae}=B;w("updated",[X,{updateHints:{sizeChanged:N,directionChanged:$,heightIntrinsicChanged:q,overflowEdgeChanged:F,overflowAmountChanged:Q,overflowStyleChanged:Y,contentMutation:se,hostMutation:ae},changedOptions:V,force:U}])}),X.update(!0),X)}return m};Ua.plugin=e=>{zt(pte(e),t=>ZM(t,Ua))};Ua.valid=e=>{const t=e&&e.elements,n=es(t)&&t();return lx(n)&&!!KM(n.target)};Ua.env=()=>{const{k:e,A:t,I:n,B:r,V:o,L:s,X:i,U:l,N:u,q:p,F:m,G:h}=Vr();return Cn({},{scrollbarsSize:e,scrollbarsOverlaid:t,scrollbarsHiding:n,rtlScrollBehavior:r,flexboxGlue:o,cssCustomProperties:s,staticDefaultInitialization:i,staticDefaultOptions:l,getDefaultInitialization:u,setDefaultInitialization:p,getDefaultOptions:m,setDefaultOptions:h})};const Qte=()=>{if(typeof window>"u"){const p=()=>{};return[p,p]}let e,t;const n=window,r=typeof n.requestIdleCallback=="function",o=n.requestAnimationFrame,s=n.cancelAnimationFrame,i=r?n.requestIdleCallback:o,l=r?n.cancelIdleCallback:s,u=()=>{l(e),s(t)};return[(p,m)=>{u(),e=i(r?()=>{u(),t=o(p)}:p,typeof m=="object"?m:{timeout:2233})},u]},Ey=e=>{const{options:t,events:n,defer:r}=e||{},[o,s]=d.useMemo(Qte,[]),i=d.useRef(null),l=d.useRef(r),u=d.useRef(t),p=d.useRef(n);return d.useEffect(()=>{l.current=r},[r]),d.useEffect(()=>{const{current:m}=i;u.current=t,Ua.valid(m)&&m.options(t||{},!0)},[t]),d.useEffect(()=>{const{current:m}=i;p.current=n,Ua.valid(m)&&m.on(n||{},!0)},[n]),d.useEffect(()=>()=>{var m;s(),(m=i.current)==null||m.destroy()},[]),d.useMemo(()=>[m=>{const h=i.current;if(Ua.valid(h))return;const g=l.current,x=u.current||{},y=p.current||{},b=()=>i.current=Ua(m,x,y);g?o(b,g):b()},()=>i.current],[])},Yte=(e,t)=>{const{element:n="div",options:r,events:o,defer:s,children:i,...l}=e,u=n,p=d.useRef(null),m=d.useRef(null),[h,g]=Ey({options:r,events:o,defer:s});return d.useEffect(()=>{const{current:x}=p,{current:y}=m;return x&&y&&h({target:x,elements:{viewport:y,content:y}}),()=>{var b;return(b=g())==null?void 0:b.destroy()}},[h,n]),d.useImperativeHandle(t,()=>({osInstance:g,getElement:()=>p.current}),[]),H.createElement(u,{"data-overlayscrollbars-initialize":"",ref:p,...l},H.createElement("div",{ref:m},i))},hg=d.forwardRef(Yte),Zte=e=>{const{boardToDelete:t,setBoardToDelete:n}=e,{t:r}=Z(),o=W(j=>j.config.canRestoreDeletedImagesFromBin),{currentData:s,isFetching:i}=yD((t==null?void 0:t.board_id)??$r.skipToken),l=d.useMemo(()=>ce([xe],j=>{const _=(s??[]).map(I=>rI(j,I));return{imageUsageSummary:{isInitialImage:Xr(_,I=>I.isInitialImage),isCanvasImage:Xr(_,I=>I.isCanvasImage),isNodesImage:Xr(_,I=>I.isNodesImage),isControlNetImage:Xr(_,I=>I.isControlNetImage),isIPAdapterImage:Xr(_,I=>I.isIPAdapterImage)}}}),[s]),[u,{isLoading:p}]=CD(),[m,{isLoading:h}]=wD(),{imageUsageSummary:g}=W(l),x=d.useCallback(()=>{t&&(u(t.board_id),n(void 0))},[t,u,n]),y=d.useCallback(()=>{t&&(m(t.board_id),n(void 0))},[t,m,n]),b=d.useCallback(()=>{n(void 0)},[n]),w=d.useRef(null),S=d.useMemo(()=>h||p||i,[h,p,i]);return t?a.jsx(Td,{isOpen:!!t,onClose:b,leastDestructiveRef:w,isCentered:!0,children:a.jsx(Yo,{children:a.jsxs(Nd,{children:[a.jsxs(Qo,{fontSize:"lg",fontWeight:"bold",children:["Delete ",t.board_name]}),a.jsx(Zo,{children:a.jsxs(L,{direction:"column",gap:3,children:[i?a.jsx(Gh,{children:a.jsx(L,{sx:{w:"full",h:32}})}):a.jsx(nM,{imageUsage:g,topMessage:r("boards.topMessage"),bottomMessage:r("boards.bottomMessage")}),a.jsx(ve,{children:"Deleted boards cannot be restored."}),a.jsx(ve,{children:r(o?"gallery.deleteImageBin":"gallery.deleteImagePermanent")})]})}),a.jsx(Ss,{children:a.jsxs(L,{sx:{justifyContent:"space-between",width:"full",gap:2},children:[a.jsx(at,{ref:w,onClick:b,children:"Cancel"}),a.jsx(at,{colorScheme:"warning",isLoading:S,onClick:x,children:"Delete Board Only"}),a.jsx(at,{colorScheme:"error",isLoading:S,onClick:y,children:"Delete Board and Images"})]})})]})})}):null},Jte=d.memo(Zte),ene=()=>{const{t:e}=Z(),[t,{isLoading:n}]=SD(),r=e("boards.myBoard"),o=d.useCallback(()=>{t(r)},[t,r]);return a.jsx(Fe,{icon:a.jsx(Vc,{}),isLoading:n,tooltip:e("boards.addBoard"),"aria-label":e("boards.addBoard"),onClick:o,size:"sm","data-testid":"add-board-button"})},tne=d.memo(ene);var JM=wh({displayName:"ExternalLinkIcon",path:a.jsxs("g",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeWidth:"2",children:[a.jsx("path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"}),a.jsx("path",{d:"M15 3h6v6"}),a.jsx("path",{d:"M10 14L21 3"})]})}),gg=wh({d:"M12 8l-6 6 1.41 1.41L12 10.83l4.59 4.58L18 14z",displayName:"ChevronUpIcon"}),nne=wh({displayName:"CloseIcon",d:"M.439,21.44a1.5,1.5,0,0,0,2.122,2.121L11.823,14.3a.25.25,0,0,1,.354,0l9.262,9.263a1.5,1.5,0,1,0,2.122-2.121L14.3,12.177a.25.25,0,0,1,0-.354l9.263-9.262A1.5,1.5,0,0,0,21.439.44L12.177,9.7a.25.25,0,0,1-.354,0L2.561.44A1.5,1.5,0,0,0,.439,2.561L9.7,11.823a.25.25,0,0,1,0,.354Z"}),rne=wh({displayName:"DeleteIcon",path:a.jsx("g",{fill:"currentColor",children:a.jsx("path",{d:"M19.452 7.5H4.547a.5.5 0 00-.5.545l1.287 14.136A2 2 0 007.326 24h9.347a2 2 0 001.992-1.819L19.95 8.045a.5.5 0 00-.129-.382.5.5 0 00-.369-.163zm-9.2 13a.75.75 0 01-1.5 0v-9a.75.75 0 011.5 0zm5 0a.75.75 0 01-1.5 0v-9a.75.75 0 011.5 0zM22 4h-4.75a.25.25 0 01-.25-.25V2.5A2.5 2.5 0 0014.5 0h-5A2.5 2.5 0 007 2.5v1.25a.25.25 0 01-.25.25H2a1 1 0 000 2h20a1 1 0 000-2zM9 3.75V2.5a.5.5 0 01.5-.5h5a.5.5 0 01.5.5v1.25a.25.25 0 01-.25.25h-5.5A.25.25 0 019 3.75z"})})});const one=ce([xe],({gallery:e})=>{const{boardSearchText:t}=e;return{boardSearchText:t}},je),sne=()=>{const e=te(),{boardSearchText:t}=W(one),n=d.useRef(null),{t:r}=Z(),o=d.useCallback(u=>{e(rw(u))},[e]),s=d.useCallback(()=>{e(rw(""))},[e]),i=d.useCallback(u=>{u.key==="Escape"&&s()},[s]),l=d.useCallback(u=>{o(u.target.value)},[o]);return d.useEffect(()=>{n.current&&n.current.focus()},[]),a.jsxs(l3,{children:[a.jsx(Mh,{ref:n,placeholder:r("boards.searchBoard"),value:t,onKeyDown:i,onChange:l,"data-testid":"board-search-input"}),t&&t.length&&a.jsx(Ib,{children:a.jsx(ys,{onClick:s,size:"xs",variant:"ghost","aria-label":r("boards.clearSearch"),opacity:.5,icon:a.jsx(nne,{boxSize:2})})})]})},ane=d.memo(sne);function e8(e){return kD(e)}function ine(e){return jD(e)}const t8=(e,t)=>{if(!e||!(t!=null&&t.data.current))return!1;const{actionType:n}=e,{payloadType:r}=t.data.current;if(e.id===t.data.current.id)return!1;switch(n){case"ADD_FIELD_TO_LINEAR":return r==="NODE_FIELD";case"SET_CURRENT_IMAGE":return r==="IMAGE_DTO";case"SET_INITIAL_IMAGE":return r==="IMAGE_DTO";case"SET_CONTROLNET_IMAGE":return r==="IMAGE_DTO";case"SET_IP_ADAPTER_IMAGE":return r==="IMAGE_DTO";case"SET_CANVAS_INITIAL_IMAGE":return r==="IMAGE_DTO";case"SET_NODES_IMAGE":return r==="IMAGE_DTO";case"SET_MULTI_NODES_IMAGE":return r==="IMAGE_DTO"||"IMAGE_DTOS";case"ADD_TO_BATCH":return r==="IMAGE_DTO"||"IMAGE_DTOS";case"ADD_TO_BOARD":{if(!(r==="IMAGE_DTO"||"IMAGE_DTOS"))return!1;if(r==="IMAGE_DTO"){const{imageDTO:s}=t.data.current.payload,i=s.board_id??"none",l=e.context.boardId;return i!==l}return r==="IMAGE_DTOS"}case"REMOVE_FROM_BOARD":{if(!(r==="IMAGE_DTO"||"IMAGE_DTOS"))return!1;if(r==="IMAGE_DTO"){const{imageDTO:s}=t.data.current.payload;return s.board_id!=="none"}return r==="IMAGE_DTOS"}default:return!1}},lne=e=>{const{isOver:t,label:n="Drop"}=e,r=d.useRef(Zs()),{colorMode:o}=ha();return a.jsx(In.div,{initial:{opacity:0},animate:{opacity:1,transition:{duration:.1}},exit:{opacity:0,transition:{duration:.1}},children:a.jsxs(L,{sx:{position:"absolute",top:0,insetInlineStart:0,w:"full",h:"full"},children:[a.jsx(L,{sx:{position:"absolute",top:0,insetInlineStart:0,w:"full",h:"full",bg:Ae("base.700","base.900")(o),opacity:.7,borderRadius:"base",alignItems:"center",justifyContent:"center",transitionProperty:"common",transitionDuration:"0.1s"}}),a.jsx(L,{sx:{position:"absolute",top:.5,insetInlineStart:.5,insetInlineEnd:.5,bottom:.5,opacity:1,borderWidth:2,borderColor:t?Ae("base.50","base.50")(o):Ae("base.200","base.300")(o),borderRadius:"lg",borderStyle:"dashed",transitionProperty:"common",transitionDuration:"0.1s",alignItems:"center",justifyContent:"center"},children:a.jsx(Ie,{sx:{fontSize:"2xl",fontWeight:600,transform:t?"scale(1.1)":"scale(1)",color:t?Ae("base.50","base.50")(o):Ae("base.200","base.300")(o),transitionProperty:"common",transitionDuration:"0.1s"},children:n})})]})},r.current)},n8=d.memo(lne),cne=e=>{const{dropLabel:t,data:n,disabled:r}=e,o=d.useRef(Zs()),{isOver:s,setNodeRef:i,active:l}=e8({id:o.current,disabled:r,data:n});return a.jsx(Ie,{ref:i,position:"absolute",top:0,insetInlineStart:0,w:"full",h:"full",pointerEvents:l?"auto":"none",children:a.jsx(dr,{children:t8(n,l)&&a.jsx(n8,{isOver:s,label:t})})})},My=d.memo(cne),une=({isSelected:e,isHovered:t})=>a.jsx(Ie,{className:"selection-box",sx:{position:"absolute",top:0,insetInlineEnd:0,bottom:0,insetInlineStart:0,borderRadius:"base",opacity:e?1:.7,transitionProperty:"common",transitionDuration:"0.1s",pointerEvents:"none",shadow:e?t?"hoverSelected.light":"selected.light":t?"hoverUnselected.light":void 0,_dark:{shadow:e?t?"hoverSelected.dark":"selected.dark":t?"hoverUnselected.dark":void 0}}}),Oy=d.memo(une),dne=()=>a.jsx(L,{sx:{position:"absolute",insetInlineEnd:0,top:0,p:1},children:a.jsx(Ds,{variant:"solid",sx:{bg:"accent.400",_dark:{bg:"accent.500"}},children:"auto"})}),r8=d.memo(dne);function Ry(e){const[t,n]=d.useState(!1),[r,o]=d.useState(!1),[s,i]=d.useState(!1),[l,u]=d.useState([0,0]),p=d.useRef(null),m=W(g=>g.ui.globalContextMenuCloseTrigger);d.useEffect(()=>{if(t)setTimeout(()=>{o(!0),setTimeout(()=>{i(!0)})});else{i(!1);const g=setTimeout(()=>{o(t)},1e3);return()=>clearTimeout(g)}},[t]),d.useEffect(()=>{n(!1),i(!1),o(!1)},[m]),dF("contextmenu",g=>{var x;(x=p.current)!=null&&x.contains(g.target)||g.target===p.current?(g.preventDefault(),n(!0),u([g.pageX,g.pageY])):n(!1)});const h=d.useCallback(()=>{var g,x;(x=(g=e.menuProps)==null?void 0:g.onClose)==null||x.call(g),n(!1)},[e.menuProps]);return a.jsxs(a.Fragment,{children:[e.children(p),r&&a.jsx(Ac,{...e.portalProps,children:a.jsxs(Ah,{isOpen:s,gutter:0,...e.menuProps,onClose:h,children:[a.jsx(Th,{"aria-hidden":!0,w:1,h:1,style:{position:"absolute",left:l[0],top:l[1],cursor:"default"},...e.menuButtonProps}),e.renderMenu()]})})]})}const vg=e=>{const{boardName:t}=yd(void 0,{selectFromResult:({data:n})=>{const r=n==null?void 0:n.find(s=>s.board_id===e);return{boardName:(r==null?void 0:r.board_name)||"Uncategorized"}}});return t},fne=({board:e,setBoardToDelete:t})=>{const n=d.useCallback(()=>{t&&t(e)},[e,t]);return a.jsxs(a.Fragment,{children:[e.image_count>0&&a.jsx(a.Fragment,{}),a.jsx(en,{sx:{color:"error.600",_dark:{color:"error.300"}},icon:a.jsx(Br,{}),onClick:n,children:"Delete Board"})]})},pne=d.memo(fne),mne=()=>a.jsx(a.Fragment,{}),hne=d.memo(mne),gne=({board:e,board_id:t,setBoardToDelete:n,children:r})=>{const o=te(),s=d.useMemo(()=>ce(xe,({gallery:g})=>{const x=g.autoAddBoardId===t,y=g.autoAssignBoardOnClick;return{isAutoAdd:x,autoAssignBoardOnClick:y}},je),[t]),{isAutoAdd:i,autoAssignBoardOnClick:l}=W(s),u=vg(t),p=d.useCallback(()=>{o(hh(t))},[t,o]),m=d.useCallback(g=>{g.preventDefault()},[]),{t:h}=Z();return a.jsx(Ry,{menuProps:{size:"sm",isLazy:!0},menuButtonProps:{bg:"transparent",_hover:{bg:"transparent"}},renderMenu:()=>a.jsx(Ui,{sx:{visibility:"visible !important"},motionProps:vc,onContextMenu:m,children:a.jsxs(td,{title:u,children:[a.jsx(en,{icon:a.jsx(Vc,{}),isDisabled:i||l,onClick:p,children:h("boards.menuItemAutoAdd")}),!e&&a.jsx(hne,{}),e&&a.jsx(pne,{board:e,setBoardToDelete:n})]})}),children:r})},o8=d.memo(gne),vne=({board:e,isSelected:t,setBoardToDelete:n})=>{const r=te(),o=d.useMemo(()=>ce(xe,({gallery:A})=>{const O=e.board_id===A.autoAddBoardId,T=A.autoAssignBoardOnClick;return{isSelectedForAutoAdd:O,autoAssignBoardOnClick:T}},je),[e.board_id]),{isSelectedForAutoAdd:s,autoAssignBoardOnClick:i}=W(o),[l,u]=d.useState(!1),p=d.useCallback(()=>{u(!0)},[]),m=d.useCallback(()=>{u(!1)},[]),{data:h}=cI(e.board_id),{data:g}=uI(e.board_id),x=d.useMemo(()=>{if(!(!h||!g))return`${h} image${h>1?"s":""}, ${g} asset${g>1?"s":""}`},[g,h]),{currentData:y}=to(e.cover_image_name??$r.skipToken),{board_name:b,board_id:w}=e,[S,j]=d.useState(b),_=d.useCallback(()=>{r(dI({boardId:w})),i&&r(hh(w))},[w,i,r]),[E,{isLoading:I}]=_D(),M=d.useMemo(()=>({id:w,actionType:"ADD_TO_BOARD",context:{boardId:w}}),[w]),R=d.useCallback(async A=>{if(!A.trim()){j(b);return}if(A!==b)try{const{board_name:O}=await E({board_id:w,changes:{board_name:A}}).unwrap();j(O)}catch{j(b)}},[w,b,E]),D=d.useCallback(A=>{j(A)},[]);return a.jsx(Ie,{sx:{w:"full",h:"full",touchAction:"none",userSelect:"none"},children:a.jsx(L,{onMouseOver:p,onMouseOut:m,sx:{position:"relative",justifyContent:"center",alignItems:"center",aspectRatio:"1/1",w:"full",h:"full"},children:a.jsx(o8,{board:e,board_id:w,setBoardToDelete:n,children:A=>a.jsx(Ht,{label:x,openDelay:1e3,hasArrow:!0,children:a.jsxs(L,{ref:A,onClick:_,sx:{w:"full",h:"full",position:"relative",justifyContent:"center",alignItems:"center",borderRadius:"base",cursor:"pointer",bg:"base.200",_dark:{bg:"base.800"}},children:[y!=null&&y.thumbnail_url?a.jsx(ga,{src:y==null?void 0:y.thumbnail_url,draggable:!1,sx:{objectFit:"cover",w:"full",h:"full",maxH:"full",borderRadius:"base",borderBottomRadius:"lg"}}):a.jsx(L,{sx:{w:"full",h:"full",justifyContent:"center",alignItems:"center"},children:a.jsx(Tn,{boxSize:12,as:see,sx:{mt:-6,opacity:.7,color:"base.500",_dark:{color:"base.500"}}})}),s&&a.jsx(r8,{}),a.jsx(Oy,{isSelected:t,isHovered:l}),a.jsx(L,{sx:{position:"absolute",bottom:0,left:0,p:1,justifyContent:"center",alignItems:"center",w:"full",maxW:"full",borderBottomRadius:"base",bg:t?"accent.400":"base.500",color:t?"base.50":"base.100",_dark:{bg:t?"accent.500":"base.600",color:t?"base.50":"base.100"},lineHeight:"short",fontSize:"xs"},children:a.jsxs(Ih,{value:S,isDisabled:I,submitOnBlur:!0,onChange:D,onSubmit:R,sx:{w:"full"},children:[a.jsx(_h,{sx:{p:0,fontWeight:t?700:500,textAlign:"center",overflow:"hidden",textOverflow:"ellipsis"},noOfLines:1}),a.jsx(jh,{sx:{p:0,_focusVisible:{p:0,textAlign:"center",boxShadow:"none"}}})]})}),a.jsx(My,{data:M,dropLabel:a.jsx(ve,{fontSize:"md",children:"Move"})})]})})})})})},xne=d.memo(vne),bne=ce(xe,({gallery:e})=>{const{autoAddBoardId:t,autoAssignBoardOnClick:n}=e;return{autoAddBoardId:t,autoAssignBoardOnClick:n}},je),s8=d.memo(({isSelected:e})=>{const t=te(),{autoAddBoardId:n,autoAssignBoardOnClick:r}=W(bne),o=vg("none"),s=d.useCallback(()=>{t(dI({boardId:"none"})),r&&t(hh("none"))},[t,r]),[i,l]=d.useState(!1),u=d.useCallback(()=>{l(!0)},[]),p=d.useCallback(()=>{l(!1)},[]),m=d.useMemo(()=>({id:"no_board",actionType:"REMOVE_FROM_BOARD"}),[]);return a.jsx(Ie,{sx:{w:"full",h:"full",touchAction:"none",userSelect:"none"},children:a.jsx(L,{onMouseOver:u,onMouseOut:p,sx:{position:"relative",justifyContent:"center",alignItems:"center",aspectRatio:"1/1",borderRadius:"base",w:"full",h:"full"},children:a.jsx(o8,{board_id:"none",children:h=>a.jsxs(L,{ref:h,onClick:s,sx:{w:"full",h:"full",position:"relative",justifyContent:"center",alignItems:"center",borderRadius:"base",cursor:"pointer",bg:"base.200",_dark:{bg:"base.800"}},children:[a.jsx(L,{sx:{w:"full",h:"full",justifyContent:"center",alignItems:"center"},children:a.jsx(ga,{src:Hx,alt:"invoke-ai-logo",sx:{opacity:.4,filter:"grayscale(1)",mt:-6,w:16,h:16,minW:16,minH:16,userSelect:"none"}})}),n==="none"&&a.jsx(r8,{}),a.jsx(L,{sx:{position:"absolute",bottom:0,left:0,p:1,justifyContent:"center",alignItems:"center",w:"full",maxW:"full",borderBottomRadius:"base",bg:e?"accent.400":"base.500",color:e?"base.50":"base.100",_dark:{bg:e?"accent.500":"base.600",color:e?"base.50":"base.100"},lineHeight:"short",fontSize:"xs",fontWeight:e?700:500},children:o}),a.jsx(Oy,{isSelected:e,isHovered:i}),a.jsx(My,{data:m,dropLabel:a.jsx(ve,{fontSize:"md",children:"Move"})})]})})})})});s8.displayName="HoverableBoard";const yne=d.memo(s8),Cne=ce([xe],({gallery:e})=>{const{selectedBoardId:t,boardSearchText:n}=e;return{selectedBoardId:t,boardSearchText:n}},je),wne=e=>{const{isOpen:t}=e,{selectedBoardId:n,boardSearchText:r}=W(Cne),{data:o}=yd(),s=r?o==null?void 0:o.filter(u=>u.board_name.toLowerCase().includes(r.toLowerCase())):o,[i,l]=d.useState();return a.jsxs(a.Fragment,{children:[a.jsx(Id,{in:t,animateOpacity:!0,children:a.jsxs(L,{layerStyle:"first",sx:{flexDir:"column",gap:2,p:2,mt:2,borderRadius:"base"},children:[a.jsxs(L,{sx:{gap:2,alignItems:"center"},children:[a.jsx(ane,{}),a.jsx(tne,{})]}),a.jsx(hg,{defer:!0,style:{height:"100%",width:"100%"},options:{scrollbars:{visibility:"auto",autoHide:"move",autoHideDelay:1300,theme:"os-theme-dark"}},children:a.jsxs(Ja,{className:"list-container","data-testid":"boards-list",sx:{gridTemplateColumns:"repeat(auto-fill, minmax(108px, 1fr));",maxH:346},children:[a.jsx(Zu,{sx:{p:1.5},"data-testid":"no-board",children:a.jsx(yne,{isSelected:n==="none"})}),s&&s.map((u,p)=>a.jsx(Zu,{sx:{p:1.5},"data-testid":`board-${p}`,children:a.jsx(xne,{board:u,isSelected:n===u.board_id,setBoardToDelete:l})},u.board_id))]})})]})}),a.jsx(Jte,{boardToDelete:i,setBoardToDelete:l})]})},Sne=d.memo(wne),kne=ce([xe],e=>{const{selectedBoardId:t}=e.gallery;return{selectedBoardId:t}},je),jne=e=>{const{isOpen:t,onToggle:n}=e,{selectedBoardId:r}=W(kne),o=vg(r),s=d.useMemo(()=>o.length>20?`${o.substring(0,20)}...`:o,[o]);return a.jsxs(L,{as:Za,onClick:n,size:"sm",sx:{position:"relative",gap:2,w:"full",justifyContent:"space-between",alignItems:"center",px:2},children:[a.jsx(ve,{noOfLines:1,sx:{fontWeight:600,w:"100%",textAlign:"center",color:"base.800",_dark:{color:"base.200"}},children:s}),a.jsx(gg,{sx:{transform:t?"rotate(0deg)":"rotate(180deg)",transitionProperty:"common",transitionDuration:"normal"}})]})},_ne=d.memo(jne),Ine=e=>{const{triggerComponent:t,children:n,hasArrow:r=!0,isLazy:o=!0,...s}=e;return a.jsxs(Ld,{isLazy:o,...s,children:[a.jsx(Wh,{children:t}),a.jsxs(zd,{shadow:"dark-lg",children:[r&&a.jsx(H3,{}),n]})]})},qd=d.memo(Ine);function Pne(e){return Te({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{d:"M12 16c1.671 0 3-1.331 3-3s-1.329-3-3-3-3 1.331-3 3 1.329 3 3 3z"}},{tag:"path",attr:{d:"M20.817 11.186a8.94 8.94 0 0 0-1.355-3.219 9.053 9.053 0 0 0-2.43-2.43 8.95 8.95 0 0 0-3.219-1.355 9.028 9.028 0 0 0-1.838-.18V2L8 5l3.975 3V6.002c.484-.002.968.044 1.435.14a6.961 6.961 0 0 1 2.502 1.053 7.005 7.005 0 0 1 1.892 1.892A6.967 6.967 0 0 1 19 13a7.032 7.032 0 0 1-.55 2.725 7.11 7.11 0 0 1-.644 1.188 7.2 7.2 0 0 1-.858 1.039 7.028 7.028 0 0 1-3.536 1.907 7.13 7.13 0 0 1-2.822 0 6.961 6.961 0 0 1-2.503-1.054 7.002 7.002 0 0 1-1.89-1.89A6.996 6.996 0 0 1 5 13H3a9.02 9.02 0 0 0 1.539 5.034 9.096 9.096 0 0 0 2.428 2.428A8.95 8.95 0 0 0 12 22a9.09 9.09 0 0 0 1.814-.183 9.014 9.014 0 0 0 3.218-1.355 8.886 8.886 0 0 0 1.331-1.099 9.228 9.228 0 0 0 1.1-1.332A8.952 8.952 0 0 0 21 13a9.09 9.09 0 0 0-.183-1.814z"}}]})(e)}const a8=ke((e,t)=>{const[n,r]=d.useState(!1),{label:o,value:s,min:i=1,max:l=100,step:u=1,onChange:p,tooltipSuffix:m="",withSliderMarks:h=!1,withInput:g=!1,isInteger:x=!1,inputWidth:y=16,withReset:b=!1,hideTooltip:w=!1,isCompact:S=!1,isDisabled:j=!1,sliderMarks:_,handleReset:E,sliderFormControlProps:I,sliderFormLabelProps:M,sliderMarkProps:R,sliderTrackProps:D,sliderThumbProps:A,sliderNumberInputProps:O,sliderNumberInputFieldProps:T,sliderNumberInputStepperProps:X,sliderTooltipProps:B,sliderIAIIconButtonProps:V,...U}=e,N=te(),{t:$}=Z(),[q,F]=d.useState(String(s));d.useEffect(()=>{F(s)},[s]);const Q=d.useMemo(()=>O!=null&&O.min?O.min:i,[i,O==null?void 0:O.min]),Y=d.useMemo(()=>O!=null&&O.max?O.max:l,[l,O==null?void 0:O.max]),se=d.useCallback(J=>{p(J)},[p]),ae=d.useCallback(J=>{J.target.value===""&&(J.target.value=String(Q));const ie=Fi(x?Math.floor(Number(J.target.value)):Number(q),Q,Y),de=Mu(ie,u);p(de),F(de)},[x,q,Q,Y,p,u]),re=d.useCallback(J=>{F(J)},[]),G=d.useCallback(()=>{E&&E()},[E]),K=d.useCallback(J=>{J.target instanceof HTMLDivElement&&J.target.focus()},[]),ee=d.useCallback(J=>{J.shiftKey&&N(Nr(!0))},[N]),le=d.useCallback(J=>{J.shiftKey||N(Nr(!1))},[N]);return a.jsxs(Kt,{ref:t,onClick:K,sx:S?{display:"flex",flexDirection:"row",alignItems:"center",columnGap:4,margin:0,padding:0}:{},isDisabled:j,...I,children:[o&&a.jsx(wn,{sx:g?{mb:-1.5}:{},...M,children:o}),a.jsxs(Rh,{w:"100%",gap:2,alignItems:"center",children:[a.jsxs(Wb,{"aria-label":o,value:s,min:i,max:l,step:u,onChange:se,onMouseEnter:()=>r(!0),onMouseLeave:()=>r(!1),focusThumbOnChange:!1,isDisabled:j,...U,children:[h&&!_&&a.jsxs(a.Fragment,{children:[a.jsx(Ul,{value:i,sx:{insetInlineStart:"0 !important",insetInlineEnd:"unset !important"},...R,children:i}),a.jsx(Ul,{value:l,sx:{insetInlineStart:"unset !important",insetInlineEnd:"0 !important"},...R,children:l})]}),h&&_&&a.jsx(a.Fragment,{children:_.map((J,ie)=>ie===0?a.jsx(Ul,{value:J,sx:{insetInlineStart:"0 !important",insetInlineEnd:"unset !important"},...R,children:J},J):ie===_.length-1?a.jsx(Ul,{value:J,sx:{insetInlineStart:"unset !important",insetInlineEnd:"0 !important"},...R,children:J},J):a.jsx(Ul,{value:J,sx:{transform:"translateX(-50%)"},...R,children:J},J))}),a.jsx(Gb,{...D,children:a.jsx(Kb,{})}),a.jsx(Ht,{hasArrow:!0,placement:"top",isOpen:n,label:`${s}${m}`,hidden:w,...B,children:a.jsx(Ub,{...A,zIndex:0})})]}),g&&a.jsxs(Lh,{min:Q,max:Y,step:u,value:q,onChange:re,onBlur:ae,focusInputOnChange:!1,...O,children:[a.jsx(Fh,{onKeyDown:ee,onKeyUp:le,minWidth:y,...T}),a.jsxs(zh,{...X,children:[a.jsx(Hh,{onClick:()=>p(Number(q))}),a.jsx(Bh,{onClick:()=>p(Number(q))})]})]}),b&&a.jsx(Fe,{size:"sm","aria-label":$("accessibility.reset"),tooltip:$("accessibility.reset"),icon:a.jsx(Pne,{}),isDisabled:j,onClick:G,...V})]})]})});a8.displayName="IAISlider";const tt=d.memo(a8),i8=d.forwardRef(({label:e,tooltip:t,description:n,disabled:r,...o},s)=>a.jsx(Ht,{label:t,placement:"top",hasArrow:!0,openDelay:500,children:a.jsx(Ie,{ref:s,...o,children:a.jsxs(Ie,{children:[a.jsx(wc,{children:e}),n&&a.jsx(wc,{size:"xs",color:"base.600",children:n})]})})}));i8.displayName="IAIMantineSelectItemWithTooltip";const ci=d.memo(i8),Ene=ce([xe],({gallery:e})=>{const{autoAddBoardId:t,autoAssignBoardOnClick:n}=e;return{autoAddBoardId:t,autoAssignBoardOnClick:n}},je),Mne=()=>{const e=te(),{t}=Z(),{autoAddBoardId:n,autoAssignBoardOnClick:r}=W(Ene),o=d.useRef(null),{boards:s,hasBoards:i}=yd(void 0,{selectFromResult:({data:u})=>{const p=[{label:"None",value:"none"}];return u==null||u.forEach(({board_id:m,board_name:h})=>{p.push({label:h,value:m})}),{boards:p,hasBoards:p.length>1}}}),l=d.useCallback(u=>{u&&e(hh(u))},[e]);return a.jsx(nn,{label:t("boards.autoAddBoard"),inputRef:o,autoFocus:!0,placeholder:t("boards.selectBoard"),value:n,data:s,nothingFound:t("boards.noMatching"),itemComponent:ci,disabled:!i||r,filter:(u,p)=>{var m;return((m=p.label)==null?void 0:m.toLowerCase().includes(u.toLowerCase().trim()))||p.value.toLowerCase().includes(u.toLowerCase().trim())},onChange:l})},One=d.memo(Mne),Rne=e=>{const{label:t,...n}=e,{colorMode:r}=ha();return a.jsx(Md,{colorScheme:"accent",...n,children:a.jsx(ve,{sx:{fontSize:"sm",color:Ae("base.800","base.200")(r)},children:t})})},br=d.memo(Rne),Dne=ce([xe],e=>{const{galleryImageMinimumWidth:t,shouldAutoSwitch:n,autoAssignBoardOnClick:r}=e.gallery;return{galleryImageMinimumWidth:t,shouldAutoSwitch:n,autoAssignBoardOnClick:r}},je),Ane=()=>{const e=te(),{t}=Z(),{galleryImageMinimumWidth:n,shouldAutoSwitch:r,autoAssignBoardOnClick:o}=W(Dne),s=d.useCallback(u=>{e(ow(u))},[e]),i=d.useCallback(()=>{e(ow(64))},[e]),l=d.useCallback(u=>{e(ID(u.target.checked))},[e]);return a.jsx(qd,{triggerComponent:a.jsx(Fe,{tooltip:t("gallery.gallerySettings"),"aria-label":t("gallery.gallerySettings"),size:"sm",icon:a.jsx(yM,{})}),children:a.jsxs(L,{direction:"column",gap:2,children:[a.jsx(tt,{value:n,onChange:s,min:45,max:256,hideTooltip:!0,label:t("gallery.galleryImageSize"),withReset:!0,handleReset:i}),a.jsx(dn,{label:t("gallery.autoSwitchNewImages"),isChecked:r,onChange:l}),a.jsx(br,{label:t("gallery.autoAssignBoardOnClick"),isChecked:o,onChange:u=>e(PD(u.target.checked))}),a.jsx(One,{})]})})},Tne=d.memo(Ane),Nne=e=>e.image?a.jsx(Gh,{sx:{w:`${e.image.width}px`,h:"auto",objectFit:"contain",aspectRatio:`${e.image.width}/${e.image.height}`}}):a.jsx(L,{sx:{opacity:.7,w:"full",h:"full",alignItems:"center",justifyContent:"center",borderRadius:"base",bg:"base.200",_dark:{bg:"base.900"}},children:a.jsx(fa,{size:"xl"})}),Zn=e=>{const{icon:t=Qi,boxSize:n=16,sx:r,...o}=e;return a.jsxs(L,{sx:{w:"full",h:"full",alignItems:"center",justifyContent:"center",borderRadius:"base",flexDir:"column",gap:2,userSelect:"none",opacity:.7,color:"base.700",_dark:{color:"base.500"},...r},...o,children:[t&&a.jsx(Tn,{as:t,boxSize:n,opacity:.7}),e.label&&a.jsx(ve,{textAlign:"center",children:e.label})]})},$ne=e=>{const{sx:t,...n}=e;return a.jsxs(L,{sx:{w:"full",h:"full",alignItems:"center",justifyContent:"center",borderRadius:"base",flexDir:"column",gap:2,userSelect:"none",opacity:.7,color:"base.700",_dark:{color:"base.500"},...t},...n,children:[a.jsx(fa,{size:"xl"}),e.label&&a.jsx(ve,{textAlign:"center",children:e.label})]})},xg=0,ui=1,Wc=2,l8=4;function c8(e,t){return n=>e(t(n))}function Lne(e,t){return t(e)}function u8(e,t){return n=>e(t,n)}function jj(e,t){return()=>e(t)}function bg(e,t){return t(e),e}function hn(...e){return e}function zne(e){e()}function _j(e){return()=>e}function Fne(...e){return()=>{e.map(zne)}}function Dy(e){return e!==void 0}function Uc(){}function Yt(e,t){return e(ui,t)}function wt(e,t){e(xg,t)}function Ay(e){e(Wc)}function bo(e){return e(l8)}function st(e,t){return Yt(e,u8(t,xg))}function ca(e,t){const n=e(ui,r=>{n(),t(r)});return n}function Tt(){const e=[];return(t,n)=>{switch(t){case Wc:e.splice(0,e.length);return;case ui:return e.push(n),()=>{const r=e.indexOf(n);r>-1&&e.splice(r,1)};case xg:e.slice().forEach(r=>{r(n)});return;default:throw new Error(`unrecognized action ${t}`)}}}function Ve(e){let t=e;const n=Tt();return(r,o)=>{switch(r){case ui:o(t);break;case xg:t=o;break;case l8:return t}return n(r,o)}}function Bne(e){let t,n;const r=()=>t&&t();return function(o,s){switch(o){case ui:return s?n===s?void 0:(r(),n=s,t=Yt(e,s),t):(r(),Uc);case Wc:r(),n=null;return;default:throw new Error(`unrecognized action ${o}`)}}}function Jr(e){return bg(Tt(),t=>st(e,t))}function yr(e,t){return bg(Ve(t),n=>st(e,n))}function Hne(...e){return t=>e.reduceRight(Lne,t)}function Pe(e,...t){const n=Hne(...t);return(r,o)=>{switch(r){case ui:return Yt(e,n(o));case Wc:Ay(e);return}}}function d8(e,t){return e===t}function fn(e=d8){let t;return n=>r=>{e(t,r)||(t=r,n(r))}}function gt(e){return t=>n=>{e(n)&&t(n)}}function Xe(e){return t=>c8(t,e)}function qs(e){return t=>()=>t(e)}function bs(e,t){return n=>r=>n(t=e(t,r))}function Pc(e){return t=>n=>{e>0?e--:t(n)}}function Ga(e){let t=null,n;return r=>o=>{t=o,!n&&(n=setTimeout(()=>{n=void 0,r(t)},e))}}function Ij(e){let t,n;return r=>o=>{t=o,n&&clearTimeout(n),n=setTimeout(()=>{r(t)},e)}}function _t(...e){const t=new Array(e.length);let n=0,r=null;const o=Math.pow(2,e.length)-1;return e.forEach((s,i)=>{const l=Math.pow(2,i);Yt(s,u=>{const p=n;n=n|l,t[i]=u,p!==o&&n===o&&r&&(r(),r=null)})}),s=>i=>{const l=()=>s([i].concat(t));n===o?l():r=l}}function Pj(...e){return function(t,n){switch(t){case ui:return Fne(...e.map(r=>Yt(r,n)));case Wc:return;default:throw new Error(`unrecognized action ${t}`)}}}function ht(e,t=d8){return Pe(e,fn(t))}function Qn(...e){const t=Tt(),n=new Array(e.length);let r=0;const o=Math.pow(2,e.length)-1;return e.forEach((s,i)=>{const l=Math.pow(2,i);Yt(s,u=>{n[i]=u,r=r|l,r===o&&wt(t,n)})}),function(s,i){switch(s){case ui:return r===o&&i(n),Yt(t,i);case Wc:return Ay(t);default:throw new Error(`unrecognized action ${s}`)}}}function qt(e,t=[],{singleton:n}={singleton:!0}){return{id:Vne(),constructor:e,dependencies:t,singleton:n}}const Vne=()=>Symbol();function Wne(e){const t=new Map,n=({id:r,constructor:o,dependencies:s,singleton:i})=>{if(i&&t.has(r))return t.get(r);const l=o(s.map(u=>n(u)));return i&&t.set(r,l),l};return n(e)}function Une(e,t){const n={},r={};let o=0;const s=e.length;for(;o(w[S]=j=>{const _=b[t.methods[S]];wt(_,j)},w),{})}function m(b){return i.reduce((w,S)=>(w[S]=Bne(b[t.events[S]]),w),{})}return{Component:H.forwardRef((b,w)=>{const{children:S,...j}=b,[_]=H.useState(()=>bg(Wne(e),I=>u(I,j))),[E]=H.useState(jj(m,_));return Pp(()=>{for(const I of i)I in j&&Yt(E[I],j[I]);return()=>{Object.values(E).map(Ay)}},[j,E,_]),Pp(()=>{u(_,j)}),H.useImperativeHandle(w,_j(p(_))),H.createElement(l.Provider,{value:_},n?H.createElement(n,Une([...r,...o,...i],j),S):S)}),usePublisher:b=>H.useCallback(u8(wt,H.useContext(l)[b]),[b]),useEmitterValue:b=>{const S=H.useContext(l)[b],[j,_]=H.useState(jj(bo,S));return Pp(()=>Yt(S,E=>{E!==j&&_(_j(E))}),[S,j]),j},useEmitter:(b,w)=>{const j=H.useContext(l)[b];Pp(()=>Yt(j,w),[w,j])}}}const Gne=typeof document<"u"?H.useLayoutEffect:H.useEffect,Kne=Gne;var eo=(e=>(e[e.DEBUG=0]="DEBUG",e[e.INFO=1]="INFO",e[e.WARN=2]="WARN",e[e.ERROR=3]="ERROR",e))(eo||{});const qne={0:"debug",1:"log",2:"warn",3:"error"},Xne=()=>typeof globalThis>"u"?window:globalThis,di=qt(()=>{const e=Ve(3);return{log:Ve((n,r,o=1)=>{var s;const i=(s=Xne().VIRTUOSO_LOG_LEVEL)!=null?s:bo(e);o>=i&&console[qne[o]]("%creact-virtuoso: %c%s %o","color: #0253b3; font-weight: bold","color: initial",n,r)}),logLevel:e}},[],{singleton:!0});function Ty(e,t=!0){const n=H.useRef(null);let r=o=>{};if(typeof ResizeObserver<"u"){const o=H.useMemo(()=>new ResizeObserver(s=>{const i=s[0].target;i.offsetParent!==null&&e(i)}),[e]);r=s=>{s&&t?(o.observe(s),n.current=s):(n.current&&o.unobserve(n.current),n.current=null)}}return{ref:n,callbackRef:r}}function ll(e,t=!0){return Ty(e,t).callbackRef}function Qne(e,t,n,r,o,s,i){const l=H.useCallback(u=>{const p=Yne(u.children,t,"offsetHeight",o);let m=u.parentElement;for(;!m.dataset.virtuosoScroller;)m=m.parentElement;const h=m.lastElementChild.dataset.viewportType==="window",g=i?i.scrollTop:h?window.pageYOffset||document.documentElement.scrollTop:m.scrollTop,x=i?i.scrollHeight:h?document.documentElement.scrollHeight:m.scrollHeight,y=i?i.offsetHeight:h?window.innerHeight:m.offsetHeight;r({scrollTop:Math.max(g,0),scrollHeight:x,viewportHeight:y}),s==null||s(Zne("row-gap",getComputedStyle(u).rowGap,o)),p!==null&&e(p)},[e,t,o,s,i,r]);return Ty(l,n)}function Yne(e,t,n,r){const o=e.length;if(o===0)return null;const s=[];for(let i=0;i{const g=h.target,x=g===window||g===document,y=x?window.pageYOffset||document.documentElement.scrollTop:g.scrollTop,b=x?document.documentElement.scrollHeight:g.scrollHeight,w=x?window.innerHeight:g.offsetHeight,S=()=>{e({scrollTop:Math.max(y,0),scrollHeight:b,viewportHeight:w})};h.suppressFlushSync?S():ED.flushSync(S),i.current!==null&&(y===i.current||y<=0||y===b-w)&&(i.current=null,t(!0),l.current&&(clearTimeout(l.current),l.current=null))},[e,t]);H.useEffect(()=>{const h=o||s.current;return r(o||s.current),u({target:h,suppressFlushSync:!0}),h.addEventListener("scroll",u,{passive:!0}),()=>{r(null),h.removeEventListener("scroll",u)}},[s,u,n,r,o]);function p(h){const g=s.current;if(!g||"offsetHeight"in g&&g.offsetHeight===0)return;const x=h.behavior==="smooth";let y,b,w;g===window?(b=Math.max(ri(document.documentElement,"height"),document.documentElement.scrollHeight),y=window.innerHeight,w=document.documentElement.scrollTop):(b=g.scrollHeight,y=ri(g,"height"),w=g.scrollTop);const S=b-y;if(h.top=Math.ceil(Math.max(Math.min(S,h.top),0)),p8(y,b)||h.top===w){e({scrollTop:w,scrollHeight:b,viewportHeight:y}),x&&t(!0);return}x?(i.current=h.top,l.current&&clearTimeout(l.current),l.current=setTimeout(()=>{l.current=null,i.current=null,t(!0)},1e3)):i.current=null,g.scrollTo(h)}function m(h){s.current.scrollBy(h)}return{scrollerRef:s,scrollByCallback:m,scrollToCallback:p}}const Sr=qt(()=>{const e=Tt(),t=Tt(),n=Ve(0),r=Tt(),o=Ve(0),s=Tt(),i=Tt(),l=Ve(0),u=Ve(0),p=Ve(0),m=Ve(0),h=Tt(),g=Tt(),x=Ve(!1);return st(Pe(e,Xe(({scrollTop:y})=>y)),t),st(Pe(e,Xe(({scrollHeight:y})=>y)),i),st(t,o),{scrollContainerState:e,scrollTop:t,viewportHeight:s,headerHeight:l,fixedHeaderHeight:u,fixedFooterHeight:p,footerHeight:m,scrollHeight:i,smoothScrollTargetReached:r,scrollTo:h,scrollBy:g,statefulScrollTop:o,deviation:n,scrollingInProgress:x}},[],{singleton:!0}),cd={lvl:0};function h8(e,t,n,r=cd,o=cd){return{k:e,v:t,lvl:n,l:r,r:o}}function tn(e){return e===cd}function gc(){return cd}function gx(e,t){if(tn(e))return cd;const{k:n,l:r,r:o}=e;if(t===n){if(tn(r))return o;if(tn(o))return r;{const[s,i]=g8(r);return Up(Vn(e,{k:s,v:i,l:v8(r)}))}}else return tt&&(l=l.concat(vx(s,t,n))),r>=t&&r<=n&&l.push({k:r,v:o}),r<=n&&(l=l.concat(vx(i,t,n))),l}function Ei(e){return tn(e)?[]:[...Ei(e.l),{k:e.k,v:e.v},...Ei(e.r)]}function g8(e){return tn(e.r)?[e.k,e.v]:g8(e.r)}function v8(e){return tn(e.r)?e.l:Up(Vn(e,{r:v8(e.r)}))}function Vn(e,t){return h8(t.k!==void 0?t.k:e.k,t.v!==void 0?t.v:e.v,t.lvl!==void 0?t.lvl:e.lvl,t.l!==void 0?t.l:e.l,t.r!==void 0?t.r:e.r)}function Hv(e){return tn(e)||e.lvl>e.r.lvl}function Ej(e){return xx(b8(e))}function Up(e){const{l:t,r:n,lvl:r}=e;if(n.lvl>=r-1&&t.lvl>=r-1)return e;if(r>n.lvl+1){if(Hv(t))return b8(Vn(e,{lvl:r-1}));if(!tn(t)&&!tn(t.r))return Vn(t.r,{l:Vn(t,{r:t.r.l}),r:Vn(e,{l:t.r.r,lvl:r-1}),lvl:r});throw new Error("Unexpected empty nodes")}else{if(Hv(e))return xx(Vn(e,{lvl:r-1}));if(!tn(n)&&!tn(n.l)){const o=n.l,s=Hv(o)?n.lvl-1:n.lvl;return Vn(o,{l:Vn(e,{r:o.l,lvl:r-1}),r:xx(Vn(n,{l:o.r,lvl:s})),lvl:o.lvl+1})}else throw new Error("Unexpected empty nodes")}}function yg(e,t,n){if(tn(e))return[];const r=ns(e,t)[0];return Jne(vx(e,r,n))}function x8(e,t){const n=e.length;if(n===0)return[];let{index:r,value:o}=t(e[0]);const s=[];for(let i=1;i({index:t,value:n}))}function xx(e){const{r:t,lvl:n}=e;return!tn(t)&&!tn(t.r)&&t.lvl===n&&t.r.lvl===n?Vn(t,{l:Vn(e,{r:t.l}),lvl:n+1}):e}function b8(e){const{l:t}=e;return!tn(t)&&t.lvl===e.lvl?Vn(t,{r:Vn(e,{l:t.r})}):e}function oh(e,t,n,r=0){let o=e.length-1;for(;r<=o;){const s=Math.floor((r+o)/2),i=e[s],l=n(i,t);if(l===0)return s;if(l===-1){if(o-r<2)return s-1;o=s-1}else{if(o===r)return s;r=s+1}}throw new Error(`Failed binary finding record in array - ${e.join(",")}, searched for ${t}`)}function y8(e,t,n){return e[oh(e,t,n)]}function ere(e,t,n,r){const o=oh(e,t,r),s=oh(e,n,r,o);return e.slice(o,s+1)}const Ny=qt(()=>({recalcInProgress:Ve(!1)}),[],{singleton:!0});function tre(e){const{size:t,startIndex:n,endIndex:r}=e;return o=>o.start===n&&(o.end===r||o.end===1/0)&&o.value===t}function Mj(e,t){let n=0,r=0;for(;n=m||o===g)&&(e=gx(e,m)):(p=g!==o,u=!0),h>i&&i>=m&&g!==o&&(e=Yr(e,i+1,g));p&&(e=Yr(e,s,o))}return[e,n]}function rre(){return{offsetTree:[],sizeTree:gc(),groupOffsetTree:gc(),lastIndex:0,lastOffset:0,lastSize:0,groupIndices:[]}}function $y({index:e},t){return t===e?0:t0&&(t=Math.max(t,y8(e,r,$y).offset)),x8(ere(e,t,n,ore),sre)}function bx(e,t,n,r){let o=e,s=0,i=0,l=0,u=0;if(t!==0){u=oh(o,t-1,$y),l=o[u].offset;const m=ns(n,t-1);s=m[0],i=m[1],o.length&&o[u].size===ns(n,t)[1]&&(u-=1),o=o.slice(0,u+1)}else o=[];for(const{start:p,value:m}of yg(n,t,1/0)){const h=p-s,g=h*i+l+h*r;o.push({offset:g,size:m,index:p}),s=p,l=g,i=m}return{offsetTree:o,lastIndex:s,lastOffset:l,lastSize:i}}function ire(e,[t,n,r,o]){t.length>0&&r("received item sizes",t,eo.DEBUG);const s=e.sizeTree;let i=s,l=0;if(n.length>0&&tn(s)&&t.length===2){const g=t[0].size,x=t[1].size;i=n.reduce((y,b)=>Yr(Yr(y,b,g),b+1,x),i)}else[i,l]=nre(i,t);if(i===s)return e;const{offsetTree:u,lastIndex:p,lastSize:m,lastOffset:h}=bx(e.offsetTree,l,i,o);return{sizeTree:i,offsetTree:u,lastIndex:p,lastOffset:h,lastSize:m,groupOffsetTree:n.reduce((g,x)=>Yr(g,x,dd(x,u,o)),gc()),groupIndices:n}}function dd(e,t,n){if(t.length===0)return 0;const{offset:r,index:o,size:s}=y8(t,e,$y),i=e-o,l=s*i+(i-1)*n+r;return l>0?l+n:l}function lre(e){return typeof e.groupIndex<"u"}function C8(e,t,n){if(lre(e))return t.groupIndices[e.groupIndex]+1;{const r=e.index==="LAST"?n:e.index;let o=w8(r,t);return o=Math.max(0,o,Math.min(n,o)),o}}function w8(e,t){if(!Cg(t))return e;let n=0;for(;t.groupIndices[n]<=e+n;)n++;return e+n}function Cg(e){return!tn(e.groupOffsetTree)}function cre(e){return Ei(e).map(({k:t,v:n},r,o)=>{const s=o[r+1],i=s?s.k-1:1/0;return{startIndex:t,endIndex:i,size:n}})}const ure={offsetHeight:"height",offsetWidth:"width"},Ts=qt(([{log:e},{recalcInProgress:t}])=>{const n=Tt(),r=Tt(),o=yr(r,0),s=Tt(),i=Tt(),l=Ve(0),u=Ve([]),p=Ve(void 0),m=Ve(void 0),h=Ve((I,M)=>ri(I,ure[M])),g=Ve(void 0),x=Ve(0),y=rre(),b=yr(Pe(n,_t(u,e,x),bs(ire,y),fn()),y),w=yr(Pe(u,fn(),bs((I,M)=>({prev:I.current,current:M}),{prev:[],current:[]}),Xe(({prev:I})=>I)),[]);st(Pe(u,gt(I=>I.length>0),_t(b,x),Xe(([I,M,R])=>{const D=I.reduce((A,O,T)=>Yr(A,O,dd(O,M.offsetTree,R)||T),gc());return{...M,groupIndices:I,groupOffsetTree:D}})),b),st(Pe(r,_t(b),gt(([I,{lastIndex:M}])=>I[{startIndex:I,endIndex:M,size:R}])),n),st(p,m);const S=yr(Pe(p,Xe(I=>I===void 0)),!0);st(Pe(m,gt(I=>I!==void 0&&tn(bo(b).sizeTree)),Xe(I=>[{startIndex:0,endIndex:0,size:I}])),n);const j=Jr(Pe(n,_t(b),bs(({sizes:I},[M,R])=>({changed:R!==I,sizes:R}),{changed:!1,sizes:y}),Xe(I=>I.changed)));Yt(Pe(l,bs((I,M)=>({diff:I.prev-M,prev:M}),{diff:0,prev:0}),Xe(I=>I.diff)),I=>{const{groupIndices:M}=bo(b);if(I>0)wt(t,!0),wt(s,I+Mj(I,M));else if(I<0){const R=bo(w);R.length>0&&(I-=Mj(-I,R)),wt(i,I)}}),Yt(Pe(l,_t(e)),([I,M])=>{I<0&&M("`firstItemIndex` prop should not be set to less than zero. If you don't know the total count, just use a very high value",{firstItemIndex:l},eo.ERROR)});const _=Jr(s);st(Pe(s,_t(b),Xe(([I,M])=>{const R=M.groupIndices.length>0,D=[],A=M.lastSize;if(R){const O=ud(M.sizeTree,0);let T=0,X=0;for(;T{let q=U.ranges;return U.prevSize!==0&&(q=[...U.ranges,{startIndex:U.prevIndex,endIndex:N+I-1,size:U.prevSize}]),{ranges:q,prevIndex:N+I,prevSize:$}},{ranges:D,prevIndex:I,prevSize:0}).ranges}return Ei(M.sizeTree).reduce((O,{k:T,v:X})=>({ranges:[...O.ranges,{startIndex:O.prevIndex,endIndex:T+I-1,size:O.prevSize}],prevIndex:T+I,prevSize:X}),{ranges:[],prevIndex:0,prevSize:A}).ranges})),n);const E=Jr(Pe(i,_t(b,x),Xe(([I,{offsetTree:M},R])=>{const D=-I;return dd(D,M,R)})));return st(Pe(i,_t(b,x),Xe(([I,M,R])=>{if(M.groupIndices.length>0){if(tn(M.sizeTree))return M;let A=gc();const O=bo(w);let T=0,X=0,B=0;for(;T<-I;){B=O[X];const U=O[X+1]-B-1;X++,T+=U+1}if(A=Ei(M.sizeTree).reduce((U,{k:N,v:$})=>Yr(U,Math.max(0,N+I),$),A),T!==-I){const U=ud(M.sizeTree,B);A=Yr(A,0,U);const N=ns(M.sizeTree,-I+1)[1];A=Yr(A,1,N)}return{...M,sizeTree:A,...bx(M.offsetTree,0,A,R)}}else{const A=Ei(M.sizeTree).reduce((O,{k:T,v:X})=>Yr(O,Math.max(0,T+I),X),gc());return{...M,sizeTree:A,...bx(M.offsetTree,0,A,R)}}})),b),{data:g,totalCount:r,sizeRanges:n,groupIndices:u,defaultItemSize:m,fixedItemSize:p,unshiftWith:s,shiftWith:i,shiftWithOffset:E,beforeUnshiftWith:_,firstItemIndex:l,gap:x,sizes:b,listRefresh:j,statefulTotalCount:o,trackItemSizes:S,itemSize:h}},hn(di,Ny),{singleton:!0}),dre=typeof document<"u"&&"scrollBehavior"in document.documentElement.style;function S8(e){const t=typeof e=="number"?{index:e}:e;return t.align||(t.align="start"),(!t.behavior||!dre)&&(t.behavior="auto"),t.offset||(t.offset=0),t}const Xd=qt(([{sizes:e,totalCount:t,listRefresh:n,gap:r},{scrollingInProgress:o,viewportHeight:s,scrollTo:i,smoothScrollTargetReached:l,headerHeight:u,footerHeight:p,fixedHeaderHeight:m,fixedFooterHeight:h},{log:g}])=>{const x=Tt(),y=Ve(0);let b=null,w=null,S=null;function j(){b&&(b(),b=null),S&&(S(),S=null),w&&(clearTimeout(w),w=null),wt(o,!1)}return st(Pe(x,_t(e,s,t,y,u,p,g),_t(r,m,h),Xe(([[_,E,I,M,R,D,A,O],T,X,B])=>{const V=S8(_),{align:U,behavior:N,offset:$}=V,q=M-1,F=C8(V,E,q);let Q=dd(F,E.offsetTree,T)+D;U==="end"?(Q+=X+ns(E.sizeTree,F)[1]-I+B,F===q&&(Q+=A)):U==="center"?Q+=(X+ns(E.sizeTree,F)[1]-I+B)/2:Q-=R,$&&(Q+=$);const Y=se=>{j(),se?(O("retrying to scroll to",{location:_},eo.DEBUG),wt(x,_)):O("list did not change, scroll successful",{},eo.DEBUG)};if(j(),N==="smooth"){let se=!1;S=Yt(n,ae=>{se=se||ae}),b=ca(l,()=>{Y(se)})}else b=ca(Pe(n,fre(150)),Y);return w=setTimeout(()=>{j()},1200),wt(o,!0),O("scrolling from index to",{index:F,top:Q,behavior:N},eo.DEBUG),{top:Q,behavior:N}})),i),{scrollToIndex:x,topListHeight:y}},hn(Ts,Sr,di),{singleton:!0});function fre(e){return t=>{const n=setTimeout(()=>{t(!1)},e);return r=>{r&&(t(!0),clearTimeout(n))}}}const fd="up",Hu="down",pre="none",mre={atBottom:!1,notAtBottomBecause:"NOT_SHOWING_LAST_ITEM",state:{offsetBottom:0,scrollTop:0,viewportHeight:0,scrollHeight:0}},hre=0,Qd=qt(([{scrollContainerState:e,scrollTop:t,viewportHeight:n,headerHeight:r,footerHeight:o,scrollBy:s}])=>{const i=Ve(!1),l=Ve(!0),u=Tt(),p=Tt(),m=Ve(4),h=Ve(hre),g=yr(Pe(Pj(Pe(ht(t),Pc(1),qs(!0)),Pe(ht(t),Pc(1),qs(!1),Ij(100))),fn()),!1),x=yr(Pe(Pj(Pe(s,qs(!0)),Pe(s,qs(!1),Ij(200))),fn()),!1);st(Pe(Qn(ht(t),ht(h)),Xe(([j,_])=>j<=_),fn()),l),st(Pe(l,Ga(50)),p);const y=Jr(Pe(Qn(e,ht(n),ht(r),ht(o),ht(m)),bs((j,[{scrollTop:_,scrollHeight:E},I,M,R,D])=>{const A=_+I-E>-D,O={viewportHeight:I,scrollTop:_,scrollHeight:E};if(A){let X,B;return _>j.state.scrollTop?(X="SCROLLED_DOWN",B=j.state.scrollTop-_):(X="SIZE_DECREASED",B=j.state.scrollTop-_||j.scrollTopDelta),{atBottom:!0,state:O,atBottomBecause:X,scrollTopDelta:B}}let T;return O.scrollHeight>j.state.scrollHeight?T="SIZE_INCREASED":Ij&&j.atBottom===_.atBottom))),b=yr(Pe(e,bs((j,{scrollTop:_,scrollHeight:E,viewportHeight:I})=>{if(p8(j.scrollHeight,E))return{scrollTop:_,scrollHeight:E,jump:0,changed:!1};{const M=E-(_+I)<1;return j.scrollTop!==_&&M?{scrollHeight:E,scrollTop:_,jump:j.scrollTop-_,changed:!0}:{scrollHeight:E,scrollTop:_,jump:0,changed:!0}}},{scrollHeight:0,jump:0,scrollTop:0,changed:!1}),gt(j=>j.changed),Xe(j=>j.jump)),0);st(Pe(y,Xe(j=>j.atBottom)),i),st(Pe(i,Ga(50)),u);const w=Ve(Hu);st(Pe(e,Xe(({scrollTop:j})=>j),fn(),bs((j,_)=>bo(x)?{direction:j.direction,prevScrollTop:_}:{direction:_j.direction)),w),st(Pe(e,Ga(50),qs(pre)),w);const S=Ve(0);return st(Pe(g,gt(j=>!j),qs(0)),S),st(Pe(t,Ga(100),_t(g),gt(([j,_])=>!!_),bs(([j,_],[E])=>[_,E],[0,0]),Xe(([j,_])=>_-j)),S),{isScrolling:g,isAtTop:l,isAtBottom:i,atBottomState:y,atTopStateChange:p,atBottomStateChange:u,scrollDirection:w,atBottomThreshold:m,atTopThreshold:h,scrollVelocity:S,lastJumpDueToItemResize:b}},hn(Sr)),fi=qt(([{log:e}])=>{const t=Ve(!1),n=Jr(Pe(t,gt(r=>r),fn()));return Yt(t,r=>{r&&bo(e)("props updated",{},eo.DEBUG)}),{propsReady:t,didMount:n}},hn(di),{singleton:!0});function Ly(e,t){e==0?t():requestAnimationFrame(()=>Ly(e-1,t))}function zy(e,t){const n=t-1;return typeof e=="number"?e:e.index==="LAST"?n:e.index}const Yd=qt(([{sizes:e,listRefresh:t,defaultItemSize:n},{scrollTop:r},{scrollToIndex:o},{didMount:s}])=>{const i=Ve(!0),l=Ve(0),u=Ve(!1);return st(Pe(s,_t(l),gt(([p,m])=>!!m),qs(!1)),i),Yt(Pe(Qn(t,s),_t(i,e,n,u),gt(([[,p],m,{sizeTree:h},g,x])=>p&&(!tn(h)||Dy(g))&&!m&&!x),_t(l)),([,p])=>{wt(u,!0),Ly(3,()=>{ca(r,()=>wt(i,!0)),wt(o,p)})}),{scrolledToInitialItem:i,initialTopMostItemIndex:l}},hn(Ts,Sr,Xd,fi),{singleton:!0});function Oj(e){return e?e==="smooth"?"smooth":"auto":!1}const gre=(e,t)=>typeof e=="function"?Oj(e(t)):t&&Oj(e),vre=qt(([{totalCount:e,listRefresh:t},{isAtBottom:n,atBottomState:r},{scrollToIndex:o},{scrolledToInitialItem:s},{propsReady:i,didMount:l},{log:u},{scrollingInProgress:p}])=>{const m=Ve(!1),h=Tt();let g=null;function x(b){wt(o,{index:"LAST",align:"end",behavior:b})}Yt(Pe(Qn(Pe(ht(e),Pc(1)),l),_t(ht(m),n,s,p),Xe(([[b,w],S,j,_,E])=>{let I=w&&_,M="auto";return I&&(M=gre(S,j||E),I=I&&!!M),{totalCount:b,shouldFollow:I,followOutputBehavior:M}}),gt(({shouldFollow:b})=>b)),({totalCount:b,followOutputBehavior:w})=>{g&&(g(),g=null),g=ca(t,()=>{bo(u)("following output to ",{totalCount:b},eo.DEBUG),x(w),g=null})});function y(b){const w=ca(r,S=>{b&&!S.atBottom&&S.notAtBottomBecause==="SIZE_INCREASED"&&!g&&(bo(u)("scrolling to bottom due to increased size",{},eo.DEBUG),x("auto"))});setTimeout(w,100)}return Yt(Pe(Qn(ht(m),e,i),gt(([b,,w])=>b&&w),bs(({value:b},[,w])=>({refreshed:b===w,value:w}),{refreshed:!1,value:0}),gt(({refreshed:b})=>b),_t(m,e)),([,b])=>{y(b!==!1)}),Yt(h,()=>{y(bo(m)!==!1)}),Yt(Qn(ht(m),r),([b,w])=>{b&&!w.atBottom&&w.notAtBottomBecause==="VIEWPORT_HEIGHT_DECREASING"&&x("auto")}),{followOutput:m,autoscrollToBottom:h}},hn(Ts,Qd,Xd,Yd,fi,di,Sr));function xre(e){return e.reduce((t,n)=>(t.groupIndices.push(t.totalCount),t.totalCount+=n+1,t),{totalCount:0,groupIndices:[]})}const k8=qt(([{totalCount:e,groupIndices:t,sizes:n},{scrollTop:r,headerHeight:o}])=>{const s=Tt(),i=Tt(),l=Jr(Pe(s,Xe(xre)));return st(Pe(l,Xe(u=>u.totalCount)),e),st(Pe(l,Xe(u=>u.groupIndices)),t),st(Pe(Qn(r,n,o),gt(([u,p])=>Cg(p)),Xe(([u,p,m])=>ns(p.groupOffsetTree,Math.max(u-m,0),"v")[0]),fn(),Xe(u=>[u])),i),{groupCounts:s,topItemsIndexes:i}},hn(Ts,Sr));function pd(e,t){return!!(e&&e[0]===t[0]&&e[1]===t[1])}function j8(e,t){return!!(e&&e.startIndex===t.startIndex&&e.endIndex===t.endIndex)}const sh="top",ah="bottom",Rj="none";function Dj(e,t,n){return typeof e=="number"?n===fd&&t===sh||n===Hu&&t===ah?e:0:n===fd?t===sh?e.main:e.reverse:t===ah?e.main:e.reverse}function Aj(e,t){return typeof e=="number"?e:e[t]||0}const Fy=qt(([{scrollTop:e,viewportHeight:t,deviation:n,headerHeight:r,fixedHeaderHeight:o}])=>{const s=Tt(),i=Ve(0),l=Ve(0),u=Ve(0),p=yr(Pe(Qn(ht(e),ht(t),ht(r),ht(s,pd),ht(u),ht(i),ht(o),ht(n),ht(l)),Xe(([m,h,g,[x,y],b,w,S,j,_])=>{const E=m-j,I=w+S,M=Math.max(g-E,0);let R=Rj;const D=Aj(_,sh),A=Aj(_,ah);return x-=j,x+=g+S,y+=g+S,y-=j,x>m+I-D&&(R=fd),ym!=null),fn(pd)),[0,0]);return{listBoundary:s,overscan:u,topListHeight:i,increaseViewportBy:l,visibleRange:p}},hn(Sr),{singleton:!0});function bre(e,t,n){if(Cg(t)){const r=w8(e,t);return[{index:ns(t.groupOffsetTree,r)[0],size:0,offset:0},{index:r,size:0,offset:0,data:n&&n[0]}]}return[{index:e,size:0,offset:0,data:n&&n[0]}]}const Tj={items:[],topItems:[],offsetTop:0,offsetBottom:0,top:0,bottom:0,topListHeight:0,totalCount:0,firstItemIndex:0};function Nj(e,t,n){if(e.length===0)return[];if(!Cg(t))return e.map(p=>({...p,index:p.index+n,originalIndex:p.index}));const r=e[0].index,o=e[e.length-1].index,s=[],i=yg(t.groupOffsetTree,r,o);let l,u=0;for(const p of e){(!l||l.end0){p=e[0].offset;const b=e[e.length-1];m=b.offset+b.size}const h=n-u,g=l+h*i+(h-1)*r,x=p,y=g-m;return{items:Nj(e,o,s),topItems:Nj(t,o,s),topListHeight:t.reduce((b,w)=>w.size+b,0),offsetTop:p,offsetBottom:y,top:x,bottom:m,totalCount:n,firstItemIndex:s}}const cl=qt(([{sizes:e,totalCount:t,data:n,firstItemIndex:r,gap:o},s,{visibleRange:i,listBoundary:l,topListHeight:u},{scrolledToInitialItem:p,initialTopMostItemIndex:m},{topListHeight:h},g,{didMount:x},{recalcInProgress:y}])=>{const b=Ve([]),w=Tt();st(s.topItemsIndexes,b);const S=yr(Pe(Qn(x,y,ht(i,pd),ht(t),ht(e),ht(m),p,ht(b),ht(r),ht(o),n),gt(([I,M,,R,,,,,,,D])=>{const A=D&&D.length!==R;return I&&!M&&!A}),Xe(([,,[I,M],R,D,A,O,T,X,B,V])=>{const U=D,{sizeTree:N,offsetTree:$}=U;if(R===0||I===0&&M===0)return{...Tj,totalCount:R};if(tn(N))return Gp(bre(zy(A,R),U,V),[],R,B,U,X);const q=[];if(T.length>0){const ae=T[0],re=T[T.length-1];let G=0;for(const K of yg(N,ae,re)){const ee=K.value,le=Math.max(K.start,ae),J=Math.min(K.end,re);for(let ie=le;ie<=J;ie++)q.push({index:ie,size:ee,offset:G,data:V&&V[ie]}),G+=ee}}if(!O)return Gp([],q,R,B,U,X);const F=T.length>0?T[T.length-1]+1:0,Q=are($,I,M,F);if(Q.length===0)return null;const Y=R-1,se=bg([],ae=>{for(const re of Q){const G=re.value;let K=G.offset,ee=re.start;const le=G.size;if(G.offset=M);ie++)ae.push({index:ie,size:le,offset:K,data:V&&V[ie]}),K+=le+B}});return Gp(se,q,R,B,U,X)}),gt(I=>I!==null),fn()),Tj);st(Pe(n,gt(Dy),Xe(I=>I==null?void 0:I.length)),t),st(Pe(S,Xe(I=>I.topListHeight)),h),st(h,u),st(Pe(S,Xe(I=>[I.top,I.bottom])),l),st(Pe(S,Xe(I=>I.items)),w);const j=Jr(Pe(S,gt(({items:I})=>I.length>0),_t(t,n),gt(([{items:I},M])=>I[I.length-1].originalIndex===M-1),Xe(([,I,M])=>[I-1,M]),fn(pd),Xe(([I])=>I))),_=Jr(Pe(S,Ga(200),gt(({items:I,topItems:M})=>I.length>0&&I[0].originalIndex===M.length),Xe(({items:I})=>I[0].index),fn())),E=Jr(Pe(S,gt(({items:I})=>I.length>0),Xe(({items:I})=>{let M=0,R=I.length-1;for(;I[M].type==="group"&&MM;)R--;return{startIndex:I[M].index,endIndex:I[R].index}}),fn(j8)));return{listState:S,topItemsIndexes:b,endReached:j,startReached:_,rangeChanged:E,itemsRendered:w,...g}},hn(Ts,k8,Fy,Yd,Xd,Qd,fi,Ny),{singleton:!0}),yre=qt(([{sizes:e,firstItemIndex:t,data:n,gap:r},{initialTopMostItemIndex:o},{listState:s},{didMount:i}])=>{const l=Ve(0);return st(Pe(i,_t(l),gt(([,u])=>u!==0),_t(o,e,t,r,n),Xe(([[,u],p,m,h,g,x=[]])=>{let y=0;if(m.groupIndices.length>0)for(const j of m.groupIndices){if(j-y>=u)break;y++}const b=u+y,w=zy(p,b),S=Array.from({length:b}).map((j,_)=>({index:_+w,size:0,offset:0,data:x[_+w]}));return Gp(S,[],b,g,m,h)})),s),{initialItemCount:l}},hn(Ts,Yd,cl,fi),{singleton:!0}),_8=qt(([{scrollVelocity:e}])=>{const t=Ve(!1),n=Tt(),r=Ve(!1);return st(Pe(e,_t(r,t,n),gt(([o,s])=>!!s),Xe(([o,s,i,l])=>{const{exit:u,enter:p}=s;if(i){if(u(o,l))return!1}else if(p(o,l))return!0;return i}),fn()),t),Yt(Pe(Qn(t,e,n),_t(r)),([[o,s,i],l])=>o&&l&&l.change&&l.change(s,i)),{isSeeking:t,scrollSeekConfiguration:r,scrollVelocity:e,scrollSeekRangeChanged:n}},hn(Qd),{singleton:!0}),Cre=qt(([{topItemsIndexes:e}])=>{const t=Ve(0);return st(Pe(t,gt(n=>n>0),Xe(n=>Array.from({length:n}).map((r,o)=>o))),e),{topItemCount:t}},hn(cl)),I8=qt(([{footerHeight:e,headerHeight:t,fixedHeaderHeight:n,fixedFooterHeight:r},{listState:o}])=>{const s=Tt(),i=yr(Pe(Qn(e,r,t,n,o),Xe(([l,u,p,m,h])=>l+u+p+m+h.offsetBottom+h.bottom)),0);return st(ht(i),s),{totalListHeight:i,totalListHeightChanged:s}},hn(Sr,cl),{singleton:!0});function P8(e){let t=!1,n;return()=>(t||(t=!0,n=e()),n)}const wre=P8(()=>/iP(ad|od|hone)/i.test(navigator.userAgent)&&/WebKit/i.test(navigator.userAgent)),Sre=qt(([{scrollBy:e,scrollTop:t,deviation:n,scrollingInProgress:r},{isScrolling:o,isAtBottom:s,scrollDirection:i,lastJumpDueToItemResize:l},{listState:u},{beforeUnshiftWith:p,shiftWithOffset:m,sizes:h,gap:g},{log:x},{recalcInProgress:y}])=>{const b=Jr(Pe(u,_t(l),bs(([,S,j,_],[{items:E,totalCount:I,bottom:M,offsetBottom:R},D])=>{const A=M+R;let O=0;return j===I&&S.length>0&&E.length>0&&(E[0].originalIndex===0&&S[0].originalIndex===0||(O=A-_,O!==0&&(O+=D))),[O,E,I,A]},[0,[],0,0]),gt(([S])=>S!==0),_t(t,i,r,s,x,y),gt(([,S,j,_,,,E])=>!E&&!_&&S!==0&&j===fd),Xe(([[S],,,,,j])=>(j("Upward scrolling compensation",{amount:S},eo.DEBUG),S))));function w(S){S>0?(wt(e,{top:-S,behavior:"auto"}),wt(n,0)):(wt(n,0),wt(e,{top:-S,behavior:"auto"}))}return Yt(Pe(b,_t(n,o)),([S,j,_])=>{_&&wre()?wt(n,j-S):w(-S)}),Yt(Pe(Qn(yr(o,!1),n,y),gt(([S,j,_])=>!S&&!_&&j!==0),Xe(([S,j])=>j),Ga(1)),w),st(Pe(m,Xe(S=>({top:-S}))),e),Yt(Pe(p,_t(h,g),Xe(([S,{lastSize:j,groupIndices:_,sizeTree:E},I])=>{function M(R){return R*(j+I)}if(_.length===0)return M(S);{let R=0;const D=ud(E,0);let A=0,O=0;for(;AS&&(R-=D,T=S-A+1),A+=T,R+=M(T),O++}return R}})),S=>{wt(n,S),requestAnimationFrame(()=>{wt(e,{top:S}),requestAnimationFrame(()=>{wt(n,0),wt(y,!1)})})}),{deviation:n}},hn(Sr,Qd,cl,Ts,di,Ny)),kre=qt(([{didMount:e},{scrollTo:t},{listState:n}])=>{const r=Ve(0);return Yt(Pe(e,_t(r),gt(([,o])=>o!==0),Xe(([,o])=>({top:o}))),o=>{ca(Pe(n,Pc(1),gt(s=>s.items.length>1)),()=>{requestAnimationFrame(()=>{wt(t,o)})})}),{initialScrollTop:r}},hn(fi,Sr,cl),{singleton:!0}),jre=qt(([{viewportHeight:e},{totalListHeight:t}])=>{const n=Ve(!1),r=yr(Pe(Qn(n,e,t),gt(([o])=>o),Xe(([,o,s])=>Math.max(0,o-s)),Ga(0),fn()),0);return{alignToBottom:n,paddingTopAddition:r}},hn(Sr,I8),{singleton:!0}),By=qt(([{scrollTo:e,scrollContainerState:t}])=>{const n=Tt(),r=Tt(),o=Tt(),s=Ve(!1),i=Ve(void 0);return st(Pe(Qn(n,r),Xe(([{viewportHeight:l,scrollTop:u,scrollHeight:p},{offsetTop:m}])=>({scrollTop:Math.max(0,u-m),scrollHeight:p,viewportHeight:l}))),t),st(Pe(e,_t(r),Xe(([l,{offsetTop:u}])=>({...l,top:l.top+u}))),o),{useWindowScroll:s,customScrollParent:i,windowScrollContainerState:n,windowViewportRect:r,windowScrollTo:o}},hn(Sr)),_re=({itemTop:e,itemBottom:t,viewportTop:n,viewportBottom:r,locationParams:{behavior:o,align:s,...i}})=>er?{...i,behavior:o,align:s??"end"}:null,Ire=qt(([{sizes:e,totalCount:t,gap:n},{scrollTop:r,viewportHeight:o,headerHeight:s,fixedHeaderHeight:i,fixedFooterHeight:l,scrollingInProgress:u},{scrollToIndex:p}])=>{const m=Tt();return st(Pe(m,_t(e,o,t,s,i,l,r),_t(n),Xe(([[h,g,x,y,b,w,S,j],_])=>{const{done:E,behavior:I,align:M,calculateViewLocation:R=_re,...D}=h,A=C8(h,g,y-1),O=dd(A,g.offsetTree,_)+b+w,T=O+ns(g.sizeTree,A)[1],X=j+w,B=j+x-S,V=R({itemTop:O,itemBottom:T,viewportTop:X,viewportBottom:B,locationParams:{behavior:I,align:M,...D}});return V?E&&ca(Pe(u,gt(U=>U===!1),Pc(bo(u)?1:2)),E):E&&E(),V}),gt(h=>h!==null)),p),{scrollIntoView:m}},hn(Ts,Sr,Xd,cl,di),{singleton:!0}),Pre=qt(([{sizes:e,sizeRanges:t},{scrollTop:n},{initialTopMostItemIndex:r},{didMount:o},{useWindowScroll:s,windowScrollContainerState:i,windowViewportRect:l}])=>{const u=Tt(),p=Ve(void 0),m=Ve(null),h=Ve(null);return st(i,m),st(l,h),Yt(Pe(u,_t(e,n,s,m,h)),([g,x,y,b,w,S])=>{const j=cre(x.sizeTree);b&&w!==null&&S!==null&&(y=w.scrollTop-S.offsetTop),g({ranges:j,scrollTop:y})}),st(Pe(p,gt(Dy),Xe(Ere)),r),st(Pe(o,_t(p),gt(([,g])=>g!==void 0),fn(),Xe(([,g])=>g.ranges)),t),{getState:u,restoreStateFrom:p}},hn(Ts,Sr,Yd,fi,By));function Ere(e){return{offset:e.scrollTop,index:0,align:"start"}}const Mre=qt(([e,t,n,r,o,s,i,l,u,p])=>({...e,...t,...n,...r,...o,...s,...i,...l,...u,...p}),hn(Fy,yre,fi,_8,I8,kre,jre,By,Ire,di)),Ore=qt(([{totalCount:e,sizeRanges:t,fixedItemSize:n,defaultItemSize:r,trackItemSizes:o,itemSize:s,data:i,firstItemIndex:l,groupIndices:u,statefulTotalCount:p,gap:m,sizes:h},{initialTopMostItemIndex:g,scrolledToInitialItem:x},y,b,w,{listState:S,topItemsIndexes:j,..._},{scrollToIndex:E},I,{topItemCount:M},{groupCounts:R},D])=>(st(_.rangeChanged,D.scrollSeekRangeChanged),st(Pe(D.windowViewportRect,Xe(A=>A.visibleHeight)),y.viewportHeight),{totalCount:e,data:i,firstItemIndex:l,sizeRanges:t,initialTopMostItemIndex:g,scrolledToInitialItem:x,topItemsIndexes:j,topItemCount:M,groupCounts:R,fixedItemHeight:n,defaultItemHeight:r,gap:m,...w,statefulTotalCount:p,listState:S,scrollToIndex:E,trackItemSizes:o,itemSize:s,groupIndices:u,..._,...D,...y,sizes:h,...b}),hn(Ts,Yd,Sr,Pre,vre,cl,Xd,Sre,Cre,k8,Mre)),Vv="-webkit-sticky",$j="sticky",E8=P8(()=>{if(typeof document>"u")return $j;const e=document.createElement("div");return e.style.position=Vv,e.style.position===Vv?Vv:$j});function M8(e,t){const n=H.useRef(null),r=H.useCallback(l=>{if(l===null||!l.offsetParent)return;const u=l.getBoundingClientRect(),p=u.width;let m,h;if(t){const g=t.getBoundingClientRect(),x=u.top-g.top;m=g.height-Math.max(0,x),h=x+t.scrollTop}else m=window.innerHeight-Math.max(0,u.top),h=u.top+window.pageYOffset;n.current={offsetTop:h,visibleHeight:m,visibleWidth:p},e(n.current)},[e,t]),{callbackRef:o,ref:s}=Ty(r),i=H.useCallback(()=>{r(s.current)},[r,s]);return H.useEffect(()=>{if(t){t.addEventListener("scroll",i);const l=new ResizeObserver(i);return l.observe(t),()=>{t.removeEventListener("scroll",i),l.unobserve(t)}}else return window.addEventListener("scroll",i),window.addEventListener("resize",i),()=>{window.removeEventListener("scroll",i),window.removeEventListener("resize",i)}},[i,t]),o}const O8=H.createContext(void 0),R8=H.createContext(void 0);function D8(e){return e}const Rre=qt(()=>{const e=Ve(u=>`Item ${u}`),t=Ve(null),n=Ve(u=>`Group ${u}`),r=Ve({}),o=Ve(D8),s=Ve("div"),i=Ve(Uc),l=(u,p=null)=>yr(Pe(r,Xe(m=>m[u]),fn()),p);return{context:t,itemContent:e,groupContent:n,components:r,computeItemKey:o,headerFooterTag:s,scrollerRef:i,FooterComponent:l("Footer"),HeaderComponent:l("Header"),TopItemListComponent:l("TopItemList"),ListComponent:l("List","div"),ItemComponent:l("Item","div"),GroupComponent:l("Group","div"),ScrollerComponent:l("Scroller","div"),EmptyPlaceholder:l("EmptyPlaceholder"),ScrollSeekPlaceholder:l("ScrollSeekPlaceholder")}}),Dre=qt(([e,t])=>({...e,...t}),hn(Ore,Rre)),Are=({height:e})=>H.createElement("div",{style:{height:e}}),Tre={position:E8(),zIndex:1,overflowAnchor:"none"},Nre={overflowAnchor:"none"},Lj=H.memo(function({showTopList:t=!1}){const n=Rt("listState"),r=yo("sizeRanges"),o=Rt("useWindowScroll"),s=Rt("customScrollParent"),i=yo("windowScrollContainerState"),l=yo("scrollContainerState"),u=s||o?i:l,p=Rt("itemContent"),m=Rt("context"),h=Rt("groupContent"),g=Rt("trackItemSizes"),x=Rt("itemSize"),y=Rt("log"),b=yo("gap"),{callbackRef:w}=Qne(r,x,g,t?Uc:u,y,b,s),[S,j]=H.useState(0);Hy("deviation",V=>{S!==V&&j(V)});const _=Rt("EmptyPlaceholder"),E=Rt("ScrollSeekPlaceholder")||Are,I=Rt("ListComponent"),M=Rt("ItemComponent"),R=Rt("GroupComponent"),D=Rt("computeItemKey"),A=Rt("isSeeking"),O=Rt("groupIndices").length>0,T=Rt("paddingTopAddition"),X=Rt("scrolledToInitialItem"),B=t?{}:{boxSizing:"border-box",paddingTop:n.offsetTop+T,paddingBottom:n.offsetBottom,marginTop:S,...X?{}:{visibility:"hidden"}};return!t&&n.totalCount===0&&_?H.createElement(_,Rr(_,m)):H.createElement(I,{...Rr(I,m),ref:w,style:B,"data-test-id":t?"virtuoso-top-item-list":"virtuoso-item-list"},(t?n.topItems:n.items).map(V=>{const U=V.originalIndex,N=D(U+n.firstItemIndex,V.data,m);return A?H.createElement(E,{...Rr(E,m),key:N,index:V.index,height:V.size,type:V.type||"item",...V.type==="group"?{}:{groupIndex:V.groupIndex}}):V.type==="group"?H.createElement(R,{...Rr(R,m),key:N,"data-index":U,"data-known-size":V.size,"data-item-index":V.index,style:Tre},h(V.index,m)):H.createElement(M,{...Rr(M,m),key:N,"data-index":U,"data-known-size":V.size,"data-item-index":V.index,"data-item-group-index":V.groupIndex,item:V.data,style:Nre},O?p(V.index,V.groupIndex,V.data,m):p(V.index,V.data,m))}))}),$re={height:"100%",outline:"none",overflowY:"auto",position:"relative",WebkitOverflowScrolling:"touch"},wg={width:"100%",height:"100%",position:"absolute",top:0},Lre={width:"100%",position:E8(),top:0,zIndex:1};function Rr(e,t){if(typeof e!="string")return{context:t}}const zre=H.memo(function(){const t=Rt("HeaderComponent"),n=yo("headerHeight"),r=Rt("headerFooterTag"),o=ll(i=>n(ri(i,"height"))),s=Rt("context");return t?H.createElement(r,{ref:o},H.createElement(t,Rr(t,s))):null}),Fre=H.memo(function(){const t=Rt("FooterComponent"),n=yo("footerHeight"),r=Rt("headerFooterTag"),o=ll(i=>n(ri(i,"height"))),s=Rt("context");return t?H.createElement(r,{ref:o},H.createElement(t,Rr(t,s))):null});function A8({usePublisher:e,useEmitter:t,useEmitterValue:n}){return H.memo(function({style:s,children:i,...l}){const u=e("scrollContainerState"),p=n("ScrollerComponent"),m=e("smoothScrollTargetReached"),h=n("scrollerRef"),g=n("context"),{scrollerRef:x,scrollByCallback:y,scrollToCallback:b}=m8(u,m,p,h);return t("scrollTo",b),t("scrollBy",y),H.createElement(p,{ref:x,style:{...$re,...s},"data-test-id":"virtuoso-scroller","data-virtuoso-scroller":!0,tabIndex:0,...l,...Rr(p,g)},i)})}function T8({usePublisher:e,useEmitter:t,useEmitterValue:n}){return H.memo(function({style:s,children:i,...l}){const u=e("windowScrollContainerState"),p=n("ScrollerComponent"),m=e("smoothScrollTargetReached"),h=n("totalListHeight"),g=n("deviation"),x=n("customScrollParent"),y=n("context"),{scrollerRef:b,scrollByCallback:w,scrollToCallback:S}=m8(u,m,p,Uc,x);return Kne(()=>(b.current=x||window,()=>{b.current=null}),[b,x]),t("windowScrollTo",S),t("scrollBy",w),H.createElement(p,{style:{position:"relative",...s,...h!==0?{height:h+g}:{}},"data-virtuoso-scroller":!0,...l,...Rr(p,y)},i)})}const Bre=({children:e})=>{const t=H.useContext(O8),n=yo("viewportHeight"),r=yo("fixedItemHeight"),o=ll(c8(n,s=>ri(s,"height")));return H.useEffect(()=>{t&&(n(t.viewportHeight),r(t.itemHeight))},[t,n,r]),H.createElement("div",{style:wg,ref:o,"data-viewport-type":"element"},e)},Hre=({children:e})=>{const t=H.useContext(O8),n=yo("windowViewportRect"),r=yo("fixedItemHeight"),o=Rt("customScrollParent"),s=M8(n,o);return H.useEffect(()=>{t&&(r(t.itemHeight),n({offsetTop:0,visibleHeight:t.viewportHeight,visibleWidth:100}))},[t,n,r]),H.createElement("div",{ref:s,style:wg,"data-viewport-type":"window"},e)},Vre=({children:e})=>{const t=Rt("TopItemListComponent"),n=Rt("headerHeight"),r={...Lre,marginTop:`${n}px`},o=Rt("context");return H.createElement(t||"div",{style:r,context:o},e)},Wre=H.memo(function(t){const n=Rt("useWindowScroll"),r=Rt("topItemsIndexes").length>0,o=Rt("customScrollParent"),s=o||n?Kre:Gre,i=o||n?Hre:Bre;return H.createElement(s,{...t},r&&H.createElement(Vre,null,H.createElement(Lj,{showTopList:!0})),H.createElement(i,null,H.createElement(zre,null),H.createElement(Lj,null),H.createElement(Fre,null)))}),{Component:Ure,usePublisher:yo,useEmitterValue:Rt,useEmitter:Hy}=f8(Dre,{required:{},optional:{restoreStateFrom:"restoreStateFrom",context:"context",followOutput:"followOutput",itemContent:"itemContent",groupContent:"groupContent",overscan:"overscan",increaseViewportBy:"increaseViewportBy",totalCount:"totalCount",groupCounts:"groupCounts",topItemCount:"topItemCount",firstItemIndex:"firstItemIndex",initialTopMostItemIndex:"initialTopMostItemIndex",components:"components",atBottomThreshold:"atBottomThreshold",atTopThreshold:"atTopThreshold",computeItemKey:"computeItemKey",defaultItemHeight:"defaultItemHeight",fixedItemHeight:"fixedItemHeight",itemSize:"itemSize",scrollSeekConfiguration:"scrollSeekConfiguration",headerFooterTag:"headerFooterTag",data:"data",initialItemCount:"initialItemCount",initialScrollTop:"initialScrollTop",alignToBottom:"alignToBottom",useWindowScroll:"useWindowScroll",customScrollParent:"customScrollParent",scrollerRef:"scrollerRef",logLevel:"logLevel"},methods:{scrollToIndex:"scrollToIndex",scrollIntoView:"scrollIntoView",scrollTo:"scrollTo",scrollBy:"scrollBy",autoscrollToBottom:"autoscrollToBottom",getState:"getState"},events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange",totalListHeightChanged:"totalListHeightChanged",itemsRendered:"itemsRendered",groupIndices:"groupIndices"}},Wre),Gre=A8({usePublisher:yo,useEmitterValue:Rt,useEmitter:Hy}),Kre=T8({usePublisher:yo,useEmitterValue:Rt,useEmitter:Hy}),qre=Ure,zj={items:[],offsetBottom:0,offsetTop:0,top:0,bottom:0,itemHeight:0,itemWidth:0},Xre={items:[{index:0}],offsetBottom:0,offsetTop:0,top:0,bottom:0,itemHeight:0,itemWidth:0},{round:Fj,ceil:Bj,floor:ih,min:Wv,max:Vu}=Math;function Qre(e){return{...Xre,items:e}}function Hj(e,t,n){return Array.from({length:t-e+1}).map((r,o)=>{const s=n===null?null:n[o+e];return{index:o+e,data:s}})}function Yre(e,t){return e&&e.column===t.column&&e.row===t.row}function Ep(e,t){return e&&e.width===t.width&&e.height===t.height}const Zre=qt(([{overscan:e,visibleRange:t,listBoundary:n},{scrollTop:r,viewportHeight:o,scrollBy:s,scrollTo:i,smoothScrollTargetReached:l,scrollContainerState:u,footerHeight:p,headerHeight:m},h,g,{propsReady:x,didMount:y},{windowViewportRect:b,useWindowScroll:w,customScrollParent:S,windowScrollContainerState:j,windowScrollTo:_},E])=>{const I=Ve(0),M=Ve(0),R=Ve(zj),D=Ve({height:0,width:0}),A=Ve({height:0,width:0}),O=Tt(),T=Tt(),X=Ve(0),B=Ve(null),V=Ve({row:0,column:0}),U=Tt(),N=Tt(),$=Ve(!1),q=Ve(0),F=Ve(!0),Q=Ve(!1);Yt(Pe(y,_t(q),gt(([K,ee])=>!!ee)),()=>{wt(F,!1),wt(M,0)}),Yt(Pe(Qn(y,F,A,D,q,Q),gt(([K,ee,le,J,,ie])=>K&&!ee&&le.height!==0&&J.height!==0&&!ie)),([,,,,K])=>{wt(Q,!0),Ly(1,()=>{wt(O,K)}),ca(Pe(r),()=>{wt(n,[0,0]),wt(F,!0)})}),st(Pe(N,gt(K=>K!=null&&K.scrollTop>0),qs(0)),M),Yt(Pe(y,_t(N),gt(([,K])=>K!=null)),([,K])=>{K&&(wt(D,K.viewport),wt(A,K==null?void 0:K.item),wt(V,K.gap),K.scrollTop>0&&(wt($,!0),ca(Pe(r,Pc(1)),ee=>{wt($,!1)}),wt(i,{top:K.scrollTop})))}),st(Pe(D,Xe(({height:K})=>K)),o),st(Pe(Qn(ht(D,Ep),ht(A,Ep),ht(V,(K,ee)=>K&&K.column===ee.column&&K.row===ee.row),ht(r)),Xe(([K,ee,le,J])=>({viewport:K,item:ee,gap:le,scrollTop:J}))),U),st(Pe(Qn(ht(I),t,ht(V,Yre),ht(A,Ep),ht(D,Ep),ht(B),ht(M),ht($),ht(F),ht(q)),gt(([,,,,,,,K])=>!K),Xe(([K,[ee,le],J,ie,de,ge,Ce,,he,fe])=>{const{row:Oe,column:_e}=J,{height:Ne,width:nt}=ie,{width:$e}=de;if(Ce===0&&(K===0||$e===0))return zj;if(nt===0){const lt=zy(fe,K),ft=lt===0?Math.max(Ce-1,0):lt;return Qre(Hj(lt,ft,ge))}const Pt=N8($e,nt,_e);let Ze,ot;he?ee===0&&le===0&&Ce>0?(Ze=0,ot=Ce-1):(Ze=Pt*ih((ee+Oe)/(Ne+Oe)),ot=Pt*Bj((le+Oe)/(Ne+Oe))-1,ot=Wv(K-1,Vu(ot,Pt-1)),Ze=Wv(ot,Vu(0,Ze))):(Ze=0,ot=-1);const ye=Hj(Ze,ot,ge),{top:De,bottom:ut}=Vj(de,J,ie,ye),bt=Bj(K/Pt),Je=bt*Ne+(bt-1)*Oe-ut;return{items:ye,offsetTop:De,offsetBottom:Je,top:De,bottom:ut,itemHeight:Ne,itemWidth:nt}})),R),st(Pe(B,gt(K=>K!==null),Xe(K=>K.length)),I),st(Pe(Qn(D,A,R,V),gt(([K,ee,{items:le}])=>le.length>0&&ee.height!==0&&K.height!==0),Xe(([K,ee,{items:le},J])=>{const{top:ie,bottom:de}=Vj(K,J,ee,le);return[ie,de]}),fn(pd)),n);const Y=Ve(!1);st(Pe(r,_t(Y),Xe(([K,ee])=>ee||K!==0)),Y);const se=Jr(Pe(ht(R),gt(({items:K})=>K.length>0),_t(I,Y),gt(([{items:K},ee,le])=>le&&K[K.length-1].index===ee-1),Xe(([,K])=>K-1),fn())),ae=Jr(Pe(ht(R),gt(({items:K})=>K.length>0&&K[0].index===0),qs(0),fn())),re=Jr(Pe(ht(R),_t($),gt(([{items:K},ee])=>K.length>0&&!ee),Xe(([{items:K}])=>({startIndex:K[0].index,endIndex:K[K.length-1].index})),fn(j8),Ga(0)));st(re,g.scrollSeekRangeChanged),st(Pe(O,_t(D,A,I,V),Xe(([K,ee,le,J,ie])=>{const de=S8(K),{align:ge,behavior:Ce,offset:he}=de;let fe=de.index;fe==="LAST"&&(fe=J-1),fe=Vu(0,fe,Wv(J-1,fe));let Oe=yx(ee,ie,le,fe);return ge==="end"?Oe=Fj(Oe-ee.height+le.height):ge==="center"&&(Oe=Fj(Oe-ee.height/2+le.height/2)),he&&(Oe+=he),{top:Oe,behavior:Ce}})),i);const G=yr(Pe(R,Xe(K=>K.offsetBottom+K.bottom)),0);return st(Pe(b,Xe(K=>({width:K.visibleWidth,height:K.visibleHeight}))),D),{data:B,totalCount:I,viewportDimensions:D,itemDimensions:A,scrollTop:r,scrollHeight:T,overscan:e,scrollBy:s,scrollTo:i,scrollToIndex:O,smoothScrollTargetReached:l,windowViewportRect:b,windowScrollTo:_,useWindowScroll:w,customScrollParent:S,windowScrollContainerState:j,deviation:X,scrollContainerState:u,footerHeight:p,headerHeight:m,initialItemCount:M,gap:V,restoreStateFrom:N,...g,initialTopMostItemIndex:q,gridState:R,totalListHeight:G,...h,startReached:ae,endReached:se,rangeChanged:re,stateChanged:U,propsReady:x,stateRestoreInProgress:$,...E}},hn(Fy,Sr,Qd,_8,fi,By,di));function Vj(e,t,n,r){const{height:o}=n;if(o===void 0||r.length===0)return{top:0,bottom:0};const s=yx(e,t,n,r[0].index),i=yx(e,t,n,r[r.length-1].index)+o;return{top:s,bottom:i}}function yx(e,t,n,r){const o=N8(e.width,n.width,t.column),s=ih(r/o),i=s*n.height+Vu(0,s-1)*t.row;return i>0?i+t.row:i}function N8(e,t,n){return Vu(1,ih((e+n)/(ih(t)+n)))}const Jre=qt(()=>{const e=Ve(p=>`Item ${p}`),t=Ve({}),n=Ve(null),r=Ve("virtuoso-grid-item"),o=Ve("virtuoso-grid-list"),s=Ve(D8),i=Ve("div"),l=Ve(Uc),u=(p,m=null)=>yr(Pe(t,Xe(h=>h[p]),fn()),m);return{context:n,itemContent:e,components:t,computeItemKey:s,itemClassName:r,listClassName:o,headerFooterTag:i,scrollerRef:l,FooterComponent:u("Footer"),HeaderComponent:u("Header"),ListComponent:u("List","div"),ItemComponent:u("Item","div"),ScrollerComponent:u("Scroller","div"),ScrollSeekPlaceholder:u("ScrollSeekPlaceholder","div")}}),eoe=qt(([e,t])=>({...e,...t}),hn(Zre,Jre)),toe=H.memo(function(){const t=yn("gridState"),n=yn("listClassName"),r=yn("itemClassName"),o=yn("itemContent"),s=yn("computeItemKey"),i=yn("isSeeking"),l=qo("scrollHeight"),u=yn("ItemComponent"),p=yn("ListComponent"),m=yn("ScrollSeekPlaceholder"),h=yn("context"),g=qo("itemDimensions"),x=qo("gap"),y=yn("log"),b=yn("stateRestoreInProgress"),w=ll(S=>{const j=S.parentElement.parentElement.scrollHeight;l(j);const _=S.firstChild;if(_){const{width:E,height:I}=_.getBoundingClientRect();g({width:E,height:I})}x({row:Wj("row-gap",getComputedStyle(S).rowGap,y),column:Wj("column-gap",getComputedStyle(S).columnGap,y)})});return b?null:H.createElement(p,{ref:w,className:n,...Rr(p,h),style:{paddingTop:t.offsetTop,paddingBottom:t.offsetBottom},"data-test-id":"virtuoso-item-list"},t.items.map(S=>{const j=s(S.index,S.data,h);return i?H.createElement(m,{key:j,...Rr(m,h),index:S.index,height:t.itemHeight,width:t.itemWidth}):H.createElement(u,{...Rr(u,h),className:r,"data-index":S.index,key:j},o(S.index,S.data,h))}))}),noe=H.memo(function(){const t=yn("HeaderComponent"),n=qo("headerHeight"),r=yn("headerFooterTag"),o=ll(i=>n(ri(i,"height"))),s=yn("context");return t?H.createElement(r,{ref:o},H.createElement(t,Rr(t,s))):null}),roe=H.memo(function(){const t=yn("FooterComponent"),n=qo("footerHeight"),r=yn("headerFooterTag"),o=ll(i=>n(ri(i,"height"))),s=yn("context");return t?H.createElement(r,{ref:o},H.createElement(t,Rr(t,s))):null}),ooe=({children:e})=>{const t=H.useContext(R8),n=qo("itemDimensions"),r=qo("viewportDimensions"),o=ll(s=>{r(s.getBoundingClientRect())});return H.useEffect(()=>{t&&(r({height:t.viewportHeight,width:t.viewportWidth}),n({height:t.itemHeight,width:t.itemWidth}))},[t,r,n]),H.createElement("div",{style:wg,ref:o},e)},soe=({children:e})=>{const t=H.useContext(R8),n=qo("windowViewportRect"),r=qo("itemDimensions"),o=yn("customScrollParent"),s=M8(n,o);return H.useEffect(()=>{t&&(r({height:t.itemHeight,width:t.itemWidth}),n({offsetTop:0,visibleHeight:t.viewportHeight,visibleWidth:t.viewportWidth}))},[t,n,r]),H.createElement("div",{ref:s,style:wg},e)},aoe=H.memo(function({...t}){const n=yn("useWindowScroll"),r=yn("customScrollParent"),o=r||n?coe:loe,s=r||n?soe:ooe;return H.createElement(o,{...t},H.createElement(s,null,H.createElement(noe,null),H.createElement(toe,null),H.createElement(roe,null)))}),{Component:ioe,usePublisher:qo,useEmitterValue:yn,useEmitter:$8}=f8(eoe,{optional:{context:"context",totalCount:"totalCount",overscan:"overscan",itemContent:"itemContent",components:"components",computeItemKey:"computeItemKey",data:"data",initialItemCount:"initialItemCount",scrollSeekConfiguration:"scrollSeekConfiguration",headerFooterTag:"headerFooterTag",listClassName:"listClassName",itemClassName:"itemClassName",useWindowScroll:"useWindowScroll",customScrollParent:"customScrollParent",scrollerRef:"scrollerRef",logLevel:"logLevel",restoreStateFrom:"restoreStateFrom",initialTopMostItemIndex:"initialTopMostItemIndex"},methods:{scrollTo:"scrollTo",scrollBy:"scrollBy",scrollToIndex:"scrollToIndex"},events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange",stateChanged:"stateChanged"}},aoe),loe=A8({usePublisher:qo,useEmitterValue:yn,useEmitter:$8}),coe=T8({usePublisher:qo,useEmitterValue:yn,useEmitter:$8});function Wj(e,t,n){return t!=="normal"&&!(t!=null&&t.endsWith("px"))&&n(`${e} was not resolved to pixel value correctly`,t,eo.WARN),t==="normal"?0:parseInt(t??"0",10)}const uoe=ioe,doe=e=>{const t=W(s=>s.gallery.galleryView),{data:n}=cI(e),{data:r}=uI(e),o=d.useMemo(()=>t==="images"?n:r,[t,r,n]);return{totalImages:n,totalAssets:r,currentViewTotal:o}},foe=({imageDTO:e})=>a.jsx(L,{sx:{pointerEvents:"none",flexDirection:"column",position:"absolute",top:0,insetInlineStart:0,p:2,alignItems:"flex-start",gap:2},children:a.jsxs(Ds,{variant:"solid",colorScheme:"base",children:[e.width," × ",e.height]})}),poe=d.memo(foe),Vy=({postUploadAction:e,isDisabled:t})=>{const n=W(u=>u.gallery.autoAddBoardId),[r]=nI(),o=d.useCallback(u=>{const p=u[0];p&&r({file:p,image_category:"user",is_intermediate:!1,postUploadAction:e??{type:"TOAST"},board_id:n==="none"?void 0:n})},[n,e,r]),{getRootProps:s,getInputProps:i,open:l}=Qb({accept:{"image/png":[".png"],"image/jpeg":[".jpg",".jpeg",".png"]},onDropAccepted:o,disabled:t,noDrag:!0,multiple:!1});return{getUploadButtonProps:s,getUploadInputProps:i,openUploader:l}},moe=ce(xe,({generation:e})=>{const{model:t}=e;return{model:t}}),Sg=()=>{const e=te(),t=sl(),{t:n}=Z(),{model:r}=W(moe),o=d.useCallback(()=>{t({title:n("toast.parameterSet"),status:"info",duration:2500,isClosable:!0})},[n,t]),s=d.useCallback(N=>{t({title:n("toast.parameterNotSet"),description:N,status:"warning",duration:2500,isClosable:!0})},[n,t]),i=d.useCallback(()=>{t({title:n("toast.parametersSet"),status:"info",duration:2500,isClosable:!0})},[n,t]),l=d.useCallback(N=>{t({title:n("toast.parametersNotSet"),status:"warning",description:N,duration:2500,isClosable:!0})},[n,t]),u=d.useCallback((N,$,q,F)=>{if(qf(N)||Xf($)||bu(q)||Q0(F)){qf(N)&&e(Nu(N)),Xf($)&&e($u($)),bu(q)&&e(Lu(q)),bu(F)&&e(zu(F)),o();return}s()},[e,o,s]),p=d.useCallback(N=>{if(!qf(N)){s();return}e(Nu(N)),o()},[e,o,s]),m=d.useCallback(N=>{if(!Xf(N)){s();return}e($u(N)),o()},[e,o,s]),h=d.useCallback(N=>{if(!bu(N)){s();return}e(Lu(N)),o()},[e,o,s]),g=d.useCallback(N=>{if(!Q0(N)){s();return}e(zu(N)),o()},[e,o,s]),x=d.useCallback(N=>{if(!sw(N)){s();return}e(Xp(N)),o()},[e,o,s]),y=d.useCallback(N=>{if(!Y0(N)){s();return}e(Qp(N)),o()},[e,o,s]),b=d.useCallback(N=>{if(!aw(N)){s();return}e(i1(N)),o()},[e,o,s]),w=d.useCallback(N=>{if(!Z0(N)){s();return}e(l1(N)),o()},[e,o,s]),S=d.useCallback(N=>{if(!J0(N)){s();return}e(Yp(N)),o()},[e,o,s]),j=d.useCallback(N=>{if(!iw(N)){s();return}e(Bi(N)),o()},[e,o,s]),_=d.useCallback(N=>{if(!lw(N)){s();return}e(Hi(N)),o()},[e,o,s]),E=d.useCallback(N=>{if(!cw(N)){s();return}e(Zp(N)),o()},[e,o,s]),{loras:I}=Cd(void 0,{selectFromResult:N=>({loras:N.data?MD.getSelectors().selectAll(N.data):[]})}),M=d.useCallback(N=>{if(!fI(N.lora))return{lora:null,error:"Invalid LoRA model"};const{base_model:$,model_name:q}=N.lora,F=I.find(Y=>Y.base_model===$&&Y.model_name===q);return F?(F==null?void 0:F.base_model)===(r==null?void 0:r.base_model)?{lora:F,error:null}:{lora:null,error:"LoRA incompatible with currently-selected model"}:{lora:null,error:"LoRA model is not installed"}},[I,r==null?void 0:r.base_model]),R=d.useCallback(N=>{const $=M(N);if(!$.lora){s($.error);return}e(uw({...$.lora,weight:N.weight})),o()},[M,e,o,s]),{controlnets:D}=gh(void 0,{selectFromResult:N=>({controlnets:N.data?OD.getSelectors().selectAll(N.data):[]})}),A=d.useCallback(N=>{if(!c1(N.control_model))return{controlnet:null,error:"Invalid ControlNet model"};const{image:$,control_model:q,control_weight:F,begin_step_percent:Q,end_step_percent:Y,control_mode:se,resize_mode:ae}=N,re=D.find(ie=>ie.base_model===q.base_model&&ie.model_name===q.model_name);if(!re)return{controlnet:null,error:"ControlNet model is not installed"};if(!((re==null?void 0:re.base_model)===(r==null?void 0:r.base_model)))return{controlnet:null,error:"ControlNet incompatible with currently-selected model"};const K=Zs();let ee=Ta.processorType;for(const ie in dw)if(re.model_name.includes(ie)){ee=dw[ie]||Ta.processorType;break}const le=Fr[ee].default;return{controlnet:{isEnabled:!0,model:re,weight:typeof F=="number"?F:Ta.weight,beginStepPct:Q||Ta.beginStepPct,endStepPct:Y||Ta.endStepPct,controlMode:se||Ta.controlMode,resizeMode:ae||Ta.resizeMode,controlImage:($==null?void 0:$.image_name)||null,processedControlImage:($==null?void 0:$.image_name)||null,processorType:ee,processorNode:le.type!=="none"?le:Ta.processorNode,shouldAutoConfig:!0,controlNetId:K},error:null}},[D,r==null?void 0:r.base_model]),O=d.useCallback(N=>{const $=A(N);if(!$.controlnet){s($.error);return}e(fw({...$.controlnet})),o()},[A,e,o,s]),{ipAdapters:T}=Vx(void 0,{selectFromResult:N=>({ipAdapters:N.data?RD.getSelectors().selectAll(N.data):[]})}),X=d.useCallback(N=>{if(!DD(N==null?void 0:N.ip_adapter_model))return{ipAdapter:null,error:"Invalid IP Adapter model"};const{image:$,ip_adapter_model:q,weight:F,begin_step_percent:Q,end_step_percent:Y}=N,se=T.find(G=>G.base_model===(q==null?void 0:q.base_model)&&G.model_name===(q==null?void 0:q.model_name));return se?(se==null?void 0:se.base_model)===(r==null?void 0:r.base_model)?{ipAdapter:{adapterImage:($==null?void 0:$.image_name)??null,model:se,weight:F??ev.weight,beginStepPct:Q??ev.beginStepPct,endStepPct:Y??ev.endStepPct},error:null}:{ipAdapter:null,error:"IP Adapter incompatible with currently-selected model"}:{ipAdapter:null,error:"IP Adapter model is not installed"}},[T,r==null?void 0:r.base_model]),B=d.useCallback(N=>{const $=X(N);if(!$.ipAdapter){s($.error);return}e(pw({...$.ipAdapter})),e(u1(!0)),o()},[X,e,o,s]),V=d.useCallback(N=>{e(vh(N))},[e]),U=d.useCallback(N=>{if(!N){l();return}const{cfg_scale:$,height:q,model:F,positive_prompt:Q,negative_prompt:Y,scheduler:se,seed:ae,steps:re,width:G,strength:K,positive_style_prompt:ee,negative_style_prompt:le,refiner_model:J,refiner_cfg_scale:ie,refiner_steps:de,refiner_scheduler:ge,refiner_positive_aesthetic_score:Ce,refiner_negative_aesthetic_score:he,refiner_start:fe,loras:Oe,controlnets:_e,ipAdapters:Ne}=N;Y0($)&&e(Qp($)),aw(F)&&e(i1(F)),qf(Q)&&e(Nu(Q)),Xf(Y)&&e($u(Y)),Z0(se)&&e(l1(se)),sw(ae)&&e(Xp(ae)),J0(re)&&e(Yp(re)),iw(G)&&e(Bi(G)),lw(q)&&e(Hi(q)),cw(K)&&e(Zp(K)),bu(ee)&&e(Lu(ee)),Q0(le)&&e(zu(le)),AD(J)&&e(pI(J)),J0(de)&&e(d1(de)),Y0(ie)&&e(f1(ie)),Z0(ge)&&e(mI(ge)),TD(Ce)&&e(p1(Ce)),ND(he)&&e(m1(he)),$D(fe)&&e(h1(fe)),e(LD()),Oe==null||Oe.forEach(nt=>{const $e=M(nt);$e.lora&&e(uw({...$e.lora,weight:nt.weight}))}),e(sI()),_e!=null&&_e.length&&e(zD()),_e==null||_e.forEach(nt=>{const $e=A(nt);$e.controlnet&&e(fw($e.controlnet))}),Ne!=null&&Ne.length&&e(u1(!0)),Ne==null||Ne.forEach(nt=>{const $e=X(nt);$e.ipAdapter&&e(pw($e.ipAdapter))}),i()},[l,i,e,M,A,X]);return{recallBothPrompts:u,recallPositivePrompt:p,recallNegativePrompt:m,recallSDXLPositiveStylePrompt:h,recallSDXLNegativeStylePrompt:g,recallSeed:x,recallCfgScale:y,recallModel:b,recallScheduler:w,recallSteps:S,recallWidth:j,recallHeight:_,recallStrength:E,recallLoRA:R,recallControlNet:O,recallIPAdapter:B,recallAllParameters:U,sendToImageToImage:V}},L8=()=>{const e=sl(),{t}=Z(),n=d.useMemo(()=>!!navigator.clipboard&&!!window.ClipboardItem,[]),r=d.useCallback(async o=>{n||e({title:t("toast.problemCopyingImage"),description:"Your browser doesn't support the Clipboard API.",status:"error",duration:2500,isClosable:!0});try{FD((async()=>await(await fetch(o)).blob())()),e({title:t("toast.imageCopied"),status:"success",duration:2500,isClosable:!0})}catch(s){e({title:t("toast.problemCopyingImage"),description:String(s),status:"error",duration:2500,isClosable:!0})}},[n,t,e]);return{isClipboardAPIAvailable:n,copyImageToClipboard:r}};function hoe(e){return Te({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M125.7 160H176c17.7 0 32 14.3 32 32s-14.3 32-32 32H48c-17.7 0-32-14.3-32-32V64c0-17.7 14.3-32 32-32s32 14.3 32 32v51.2L97.6 97.6c87.5-87.5 229.3-87.5 316.8 0s87.5 229.3 0 316.8s-229.3 87.5-316.8 0c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0c62.5 62.5 163.8 62.5 226.3 0s62.5-163.8 0-226.3s-163.8-62.5-226.3 0L125.7 160z"}}]})(e)}function goe(e){return Te({tag:"svg",attr:{viewBox:"0 0 384 512"},child:[{tag:"path",attr:{d:"M0 256L28.5 28c2-16 15.6-28 31.8-28H228.9c15 0 27.1 12.1 27.1 27.1c0 3.2-.6 6.5-1.7 9.5L208 160H347.3c20.2 0 36.7 16.4 36.7 36.7c0 7.4-2.2 14.6-6.4 20.7l-192.2 281c-5.9 8.6-15.6 13.7-25.9 13.7h-2.9c-15.7 0-28.5-12.8-28.5-28.5c0-2.3 .3-4.6 .9-6.9L176 288H32c-17.7 0-32-14.3-32-32z"}}]})(e)}function voe(e){return Te({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M256 512A256 256 0 1 0 256 0a256 256 0 1 0 0 512zm0-384c13.3 0 24 10.7 24 24V264c0 13.3-10.7 24-24 24s-24-10.7-24-24V152c0-13.3 10.7-24 24-24zM224 352a32 32 0 1 1 64 0 32 32 0 1 1 -64 0z"}}]})(e)}function Wy(e){return Te({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M418.4 157.9c35.3-8.3 61.6-40 61.6-77.9c0-44.2-35.8-80-80-80c-43.4 0-78.7 34.5-80 77.5L136.2 151.1C121.7 136.8 101.9 128 80 128c-44.2 0-80 35.8-80 80s35.8 80 80 80c12.2 0 23.8-2.7 34.1-7.6L259.7 407.8c-2.4 7.6-3.7 15.8-3.7 24.2c0 44.2 35.8 80 80 80s80-35.8 80-80c0-27.7-14-52.1-35.4-66.4l37.8-207.7zM156.3 232.2c2.2-6.9 3.5-14.2 3.7-21.7l183.8-73.5c3.6 3.5 7.4 6.7 11.6 9.5L317.6 354.1c-5.5 1.3-10.8 3.1-15.8 5.5L156.3 232.2z"}}]})(e)}function xoe(e){return Te({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M8 256a56 56 0 1 1 112 0A56 56 0 1 1 8 256zm160 0a56 56 0 1 1 112 0 56 56 0 1 1 -112 0zm216-56a56 56 0 1 1 0 112 56 56 0 1 1 0-112z"}}]})(e)}function boe(e){return Te({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M416 208c0 45.9-14.9 88.3-40 122.7L502.6 457.4c12.5 12.5 12.5 32.8 0 45.3s-32.8 12.5-45.3 0L330.7 376c-34.4 25.2-76.8 40-122.7 40C93.1 416 0 322.9 0 208S93.1 0 208 0S416 93.1 416 208zM136 184c-13.3 0-24 10.7-24 24s10.7 24 24 24H280c13.3 0 24-10.7 24-24s-10.7-24-24-24H136z"}}]})(e)}function yoe(e){return Te({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M416 208c0 45.9-14.9 88.3-40 122.7L502.6 457.4c12.5 12.5 12.5 32.8 0 45.3s-32.8 12.5-45.3 0L330.7 376c-34.4 25.2-76.8 40-122.7 40C93.1 416 0 322.9 0 208S93.1 0 208 0S416 93.1 416 208zM184 296c0 13.3 10.7 24 24 24s24-10.7 24-24V232h64c13.3 0 24-10.7 24-24s-10.7-24-24-24H232V120c0-13.3-10.7-24-24-24s-24 10.7-24 24v64H120c-13.3 0-24 10.7-24 24s10.7 24 24 24h64v64z"}}]})(e)}function Coe(e){return Te({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0V0z"}},{tag:"path",attr:{d:"M17 16l-4-4V8.82C14.16 8.4 15 7.3 15 6c0-1.66-1.34-3-3-3S9 4.34 9 6c0 1.3.84 2.4 2 2.82V12l-4 4H3v5h5v-3.05l4-4.2 4 4.2V21h5v-5h-4z"}}]})(e)}function woe(e){return Te({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M20 2H4c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zM8 20H4v-4h4v4zm0-6H4v-4h4v4zm0-6H4V4h4v4zm6 12h-4v-4h4v4zm0-6h-4v-4h4v4zm0-6h-4V4h4v4zm6 12h-4v-4h4v4zm0-6h-4v-4h4v4zm0-6h-4V4h4v4z"}}]})(e)}function Soe(e){return Te({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M22 16V4c0-1.1-.9-2-2-2H8c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2zm-11-4l2.03 2.71L16 11l4 5H8l3-4zM2 6v14c0 1.1.9 2 2 2h14v-2H4V6H2z"}}]})(e)}function Uy(e){return Te({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M22 9.24l-7.19-.62L12 2 9.19 8.63 2 9.24l5.46 4.73L5.82 21 12 17.27 18.18 21l-1.63-7.03L22 9.24zM12 15.4l-3.76 2.27 1-4.28-3.32-2.88 4.38-.38L12 6.1l1.71 4.04 4.38.38-3.32 2.88 1 4.28L12 15.4z"}}]})(e)}function Gy(e){return Te({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M12 17.27L18.18 21l-1.64-7.03L22 9.24l-7.19-.61L12 2 9.19 8.63 2 9.24l5.46 4.73L5.82 21z"}}]})(e)}function z8(e){return Te({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0V0z"}},{tag:"path",attr:{d:"M16 17.01V10h-2v7.01h-3L15 21l4-3.99h-3zM9 3L5 6.99h3V14h2V6.99h3L9 3zm7 14.01V10h-2v7.01h-3L15 21l4-3.99h-3zM9 3L5 6.99h3V14h2V6.99h3L9 3z"}}]})(e)}const Ky=e=>e.config;Wx("gallery/requestedBoardImagesDeletion");const koe=Wx("gallery/sentImageToCanvas"),F8=Wx("gallery/sentImageToImg2Img"),joe=e=>{const{imageDTO:t}=e,n=te(),{t:r}=Z(),o=sl(),s=Bt("unifiedCanvas").isFeatureEnabled,{shouldFetchMetadataFromApi:i}=W(Ky),l=Jh(Ux),{metadata:u,workflow:p,isLoading:m}=Gx({image:t,shouldFetchMetadataFromApi:i},{selectFromResult:B=>{var V,U;return{isLoading:B.isFetching,metadata:(V=B==null?void 0:B.currentData)==null?void 0:V.metadata,workflow:(U=B==null?void 0:B.currentData)==null?void 0:U.workflow}}}),[h]=Kx(),[g]=qx(),{isClipboardAPIAvailable:x,copyImageToClipboard:y}=L8(),b=d.useCallback(()=>{t&&n(xh([t]))},[n,t]),{recallBothPrompts:w,recallSeed:S,recallAllParameters:j}=Sg(),_=d.useCallback(()=>{w(u==null?void 0:u.positive_prompt,u==null?void 0:u.negative_prompt,u==null?void 0:u.positive_style_prompt,u==null?void 0:u.negative_style_prompt)},[u==null?void 0:u.negative_prompt,u==null?void 0:u.positive_prompt,u==null?void 0:u.positive_style_prompt,u==null?void 0:u.negative_style_prompt,w]),E=d.useCallback(()=>{S(u==null?void 0:u.seed)},[u==null?void 0:u.seed,S]),I=d.useCallback(()=>{p&&n(Xx(p))},[n,p]),M=d.useCallback(()=>{n(F8()),n(vh(t))},[n,t]),R=d.useCallback(()=>{n(koe()),qr.flushSync(()=>{n(Xs("unifiedCanvas"))}),n(hI(t)),o({title:r("toast.sentToUnifiedCanvas"),status:"success",duration:2500,isClosable:!0})},[n,t,r,o]),D=d.useCallback(()=>{j(u)},[u,j]),A=d.useCallback(()=>{n(gI([t])),n(Bx(!0))},[n,t]),O=d.useCallback(()=>{y(t.image_url)},[y,t.image_url]),T=d.useCallback(()=>{t&&h({imageDTOs:[t]})},[h,t]),X=d.useCallback(()=>{t&&g({imageDTOs:[t]})},[g,t]);return a.jsxs(a.Fragment,{children:[a.jsx(en,{as:"a",href:t.image_url,target:"_blank",icon:a.jsx(py,{}),children:r("common.openInNewTab")}),x&&a.jsx(en,{icon:a.jsx(Hc,{}),onClickCapture:O,children:r("parameters.copyImage")}),a.jsx(en,{as:"a",download:!0,href:t.image_url,target:"_blank",icon:a.jsx(ig,{}),w:"100%",children:r("parameters.downloadImage")}),a.jsx(en,{icon:m?a.jsx(Mp,{}):a.jsx(Wy,{}),onClickCapture:I,isDisabled:m||!p,children:r("nodes.loadWorkflow")}),a.jsx(en,{icon:m?a.jsx(Mp,{}):a.jsx(gM,{}),onClickCapture:_,isDisabled:m||(u==null?void 0:u.positive_prompt)===void 0&&(u==null?void 0:u.negative_prompt)===void 0,children:r("parameters.usePrompt")}),a.jsx(en,{icon:m?a.jsx(Mp,{}):a.jsx(vM,{}),onClickCapture:E,isDisabled:m||(u==null?void 0:u.seed)===void 0,children:r("parameters.useSeed")}),a.jsx(en,{icon:m?a.jsx(Mp,{}):a.jsx(aM,{}),onClickCapture:D,isDisabled:m||!u,children:r("parameters.useAll")}),a.jsx(en,{icon:a.jsx(qk,{}),onClickCapture:M,id:"send-to-img2img",children:r("parameters.sendToImg2Img")}),s&&a.jsx(en,{icon:a.jsx(qk,{}),onClickCapture:R,id:"send-to-canvas",children:r("parameters.sendToUnifiedCanvas")}),a.jsx(en,{icon:a.jsx(dM,{}),onClickCapture:A,children:"Change Board"}),t.starred?a.jsx(en,{icon:l?l.off.icon:a.jsx(Gy,{}),onClickCapture:X,children:l?l.off.text:"Unstar Image"}):a.jsx(en,{icon:l?l.on.icon:a.jsx(Uy,{}),onClickCapture:T,children:l?l.on.text:"Star Image"}),a.jsx(en,{sx:{color:"error.600",_dark:{color:"error.300"}},icon:a.jsx(Br,{}),onClickCapture:b,children:r("gallery.deleteImage")})]})},B8=d.memo(joe),Mp=()=>a.jsx(L,{w:"14px",alignItems:"center",justifyContent:"center",children:a.jsx(fa,{size:"xs"})}),_oe=()=>{const e=te(),t=W(h=>h.gallery.selection),n=Jh(Ux),[r]=Kx(),[o]=qx(),s=d.useCallback(()=>{e(gI(t)),e(Bx(!0))},[e,t]),i=d.useCallback(()=>{e(xh(t))},[e,t]),l=d.useCallback(()=>{r({imageDTOs:t})},[r,t]),u=d.useCallback(()=>{o({imageDTOs:t})},[o,t]),p=d.useMemo(()=>t.every(h=>h.starred),[t]),m=d.useMemo(()=>t.every(h=>!h.starred),[t]);return a.jsxs(a.Fragment,{children:[p&&a.jsx(en,{icon:n?n.on.icon:a.jsx(Uy,{}),onClickCapture:u,children:n?n.off.text:"Unstar All"}),(m||!p&&!m)&&a.jsx(en,{icon:n?n.on.icon:a.jsx(Gy,{}),onClickCapture:l,children:n?n.on.text:"Star All"}),a.jsx(en,{icon:a.jsx(dM,{}),onClickCapture:s,children:"Change Board"}),a.jsx(en,{sx:{color:"error.600",_dark:{color:"error.300"}},icon:a.jsx(Br,{}),onClickCapture:i,children:"Delete Selection"})]})},Ioe=d.memo(_oe),Poe=ce([xe],({gallery:e})=>({selectionCount:e.selection.length}),je),Eoe=({imageDTO:e,children:t})=>{const{selectionCount:n}=W(Poe),r=d.useCallback(o=>{o.preventDefault()},[]);return a.jsx(Ry,{menuProps:{size:"sm",isLazy:!0},menuButtonProps:{bg:"transparent",_hover:{bg:"transparent"}},renderMenu:()=>e?n>1?a.jsx(Ui,{sx:{visibility:"visible !important"},motionProps:vc,onContextMenu:r,children:a.jsx(Ioe,{})}):a.jsx(Ui,{sx:{visibility:"visible !important"},motionProps:vc,onContextMenu:r,children:a.jsx(B8,{imageDTO:e})}):null,children:t})},Moe=d.memo(Eoe),Ooe=e=>{const{data:t,disabled:n,...r}=e,o=d.useRef(Zs()),{attributes:s,listeners:i,setNodeRef:l}=ine({id:o.current,disabled:n,data:t});return a.jsx(Ie,{ref:l,position:"absolute",w:"full",h:"full",top:0,insetInlineStart:0,...s,...i,...r})},Roe=d.memo(Ooe),Doe=a.jsx(Tn,{as:cg,sx:{boxSize:16}}),Aoe=a.jsx(Zn,{icon:Qi}),Toe=e=>{const{imageDTO:t,onError:n,onClick:r,withMetadataOverlay:o=!1,isDropDisabled:s=!1,isDragDisabled:i=!1,isUploadDisabled:l=!1,minSize:u=24,postUploadAction:p,imageSx:m,fitContainer:h=!1,droppableData:g,draggableData:x,dropLabel:y,isSelected:b=!1,thumbnail:w=!1,noContentFallback:S=Aoe,uploadElement:j=Doe,useThumbailFallback:_,withHoverOverlay:E=!1,children:I,onMouseOver:M,onMouseOut:R,dataTestId:D}=e,{colorMode:A}=ha(),[O,T]=d.useState(!1),X=d.useCallback($=>{M&&M($),T(!0)},[M]),B=d.useCallback($=>{R&&R($),T(!1)},[R]),{getUploadButtonProps:V,getUploadInputProps:U}=Vy({postUploadAction:p,isDisabled:l}),N=l?{}:{cursor:"pointer",bg:Ae("base.200","base.700")(A),_hover:{bg:Ae("base.300","base.650")(A),color:Ae("base.500","base.300")(A)}};return a.jsx(Moe,{imageDTO:t,children:$=>a.jsxs(L,{ref:$,onMouseOver:X,onMouseOut:B,sx:{width:"full",height:"full",alignItems:"center",justifyContent:"center",position:"relative",minW:u||void 0,minH:u||void 0,userSelect:"none",cursor:i||!t?"default":"pointer"},children:[t&&a.jsxs(L,{sx:{w:"full",h:"full",position:h?"absolute":"relative",alignItems:"center",justifyContent:"center"},children:[a.jsx(ga,{src:w?t.thumbnail_url:t.image_url,fallbackStrategy:"beforeLoadOrError",fallbackSrc:_?t.thumbnail_url:void 0,fallback:_?void 0:a.jsx(Nne,{image:t}),onError:n,draggable:!1,sx:{w:t.width,objectFit:"contain",maxW:"full",maxH:"full",borderRadius:"base",...m},"data-testid":D}),o&&a.jsx(poe,{imageDTO:t}),a.jsx(Oy,{isSelected:b,isHovered:E?O:!1})]}),!t&&!l&&a.jsx(a.Fragment,{children:a.jsxs(L,{sx:{minH:u,w:"full",h:"full",alignItems:"center",justifyContent:"center",borderRadius:"base",transitionProperty:"common",transitionDuration:"0.1s",color:Ae("base.500","base.500")(A),...N},...V(),children:[a.jsx("input",{...U()}),j]})}),!t&&l&&S,t&&!i&&a.jsx(Roe,{data:x,disabled:i||!t,onClick:r}),I,!s&&a.jsx(My,{data:g,disabled:s,dropLabel:y})]})})},ua=d.memo(Toe),Noe=()=>a.jsx(Gh,{sx:{position:"relative",height:"full",width:"full","::before":{content:"''",display:"block",pt:"100%"}},children:a.jsx(Ie,{sx:{position:"absolute",top:0,insetInlineStart:0,height:"full",width:"full"}})}),$oe=d.memo(Noe),Loe=ce([xe,Qx],({gallery:e},t)=>{const n=e.selection;return{queryArgs:t,selection:n}},je),zoe=e=>{const t=te(),{queryArgs:n,selection:r}=W(Loe),{imageDTOs:o}=vI(n,{selectFromResult:p=>({imageDTOs:p.data?BD.selectAll(p.data):[]})}),s=Bt("multiselect").isFeatureEnabled,i=d.useCallback(p=>{var m;if(e){if(!s){t(yu([e]));return}if(p.shiftKey){const h=e.image_name,g=(m=r[r.length-1])==null?void 0:m.image_name,x=o.findIndex(b=>b.image_name===g),y=o.findIndex(b=>b.image_name===h);if(x>-1&&y>-1){const b=Math.min(x,y),w=Math.max(x,y),S=o.slice(b,w+1);t(yu(Kw(r.concat(S))))}}else p.ctrlKey||p.metaKey?r.some(h=>h.image_name===e.image_name)&&r.length>1?t(yu(r.filter(h=>h.image_name!==e.image_name))):t(yu(Kw(r.concat(e)))):t(yu([e]))}},[t,e,o,r,s]),l=d.useMemo(()=>e?r.some(p=>p.image_name===e.image_name):!1,[e,r]),u=d.useMemo(()=>r.length,[r.length]);return{selection:r,selectionCount:u,isSelected:l,handleClick:i}},Foe=e=>{const{onClick:t,tooltip:n,icon:r,styleOverrides:o}=e,s=sa("drop-shadow(0px 0px 0.1rem var(--invokeai-colors-base-600))","drop-shadow(0px 0px 0.1rem var(--invokeai-colors-base-800))");return a.jsx(Fe,{onClick:t,"aria-label":n,tooltip:n,icon:r,size:"sm",variant:"link",sx:{position:"absolute",top:1,insetInlineEnd:1,p:0,minW:0,svg:{transitionProperty:"common",transitionDuration:"normal",fill:"base.100",_hover:{fill:"base.50"},filter:s},...o},"data-testid":n})},Li=d.memo(Foe),Boe=e=>{const t=te(),{imageName:n}=e,{currentData:r}=to(n),o=W(M=>M.hotkeys.shift),{t:s}=Z(),{handleClick:i,isSelected:l,selection:u,selectionCount:p}=zoe(r),m=Jh(Ux),h=d.useCallback(M=>{M.stopPropagation(),r&&t(xh([r]))},[t,r]),g=d.useMemo(()=>{if(p>1)return{id:"gallery-image",payloadType:"IMAGE_DTOS",payload:{imageDTOs:u}};if(r)return{id:"gallery-image",payloadType:"IMAGE_DTO",payload:{imageDTO:r}}},[r,u,p]),[x]=Kx(),[y]=qx(),b=d.useCallback(()=>{r&&(r.starred&&y({imageDTOs:[r]}),r.starred||x({imageDTOs:[r]}))},[x,y,r]),[w,S]=d.useState(!1),j=d.useCallback(()=>{S(!0)},[]),_=d.useCallback(()=>{S(!1)},[]),E=d.useMemo(()=>{if(r!=null&&r.starred)return m?m.on.icon:a.jsx(Gy,{size:"20"});if(!(r!=null&&r.starred)&&w)return m?m.off.icon:a.jsx(Uy,{size:"20"})},[r==null?void 0:r.starred,w,m]),I=d.useMemo(()=>r!=null&&r.starred?m?m.off.text:"Unstar":r!=null&&r.starred?"":m?m.on.text:"Star",[r==null?void 0:r.starred,m]);return r?a.jsx(Ie,{sx:{w:"full",h:"full",touchAction:"none"},"data-testid":`image-${r.image_name}`,children:a.jsx(L,{userSelect:"none",sx:{position:"relative",justifyContent:"center",alignItems:"center",aspectRatio:"1/1"},children:a.jsx(ua,{onClick:i,imageDTO:r,draggableData:g,isSelected:l,minSize:0,imageSx:{w:"full",h:"full"},isDropDisabled:!0,isUploadDisabled:!0,thumbnail:!0,withHoverOverlay:!0,onMouseOver:j,onMouseOut:_,children:a.jsxs(a.Fragment,{children:[a.jsx(Li,{onClick:b,icon:E,tooltip:I}),w&&o&&a.jsx(Li,{onClick:h,icon:a.jsx(Br,{}),tooltip:s("gallery.deleteImage"),styleOverrides:{bottom:2,top:"auto"}})]})})})}):a.jsx($oe,{})},Hoe=d.memo(Boe),Voe=ke((e,t)=>a.jsx(Ie,{className:"item-container",ref:t,p:1.5,"data-testid":"image-item-container",children:e.children})),Woe=d.memo(Voe),Uoe=ke((e,t)=>{const n=W(r=>r.gallery.galleryImageMinimumWidth);return a.jsx(Ja,{...e,className:"list-container",ref:t,sx:{gridTemplateColumns:`repeat(auto-fill, minmax(${n}px, 1fr));`},"data-testid":"image-list-container",children:e.children})}),Goe=d.memo(Uoe),Koe={defer:!0,options:{scrollbars:{visibility:"auto",autoHide:"scroll",autoHideDelay:1300,theme:"os-theme-dark"},overflow:{x:"hidden"}}},qoe=()=>{const{t:e}=Z(),t=d.useRef(null),[n,r]=d.useState(null),[o,s]=Ey(Koe),i=W(w=>w.gallery.selectedBoardId),{currentViewTotal:l}=doe(i),u=W(Qx),{currentData:p,isFetching:m,isSuccess:h,isError:g}=vI(u),[x]=xI(),y=d.useMemo(()=>!p||!l?!1:p.ids.length{y&&x({...u,offset:(p==null?void 0:p.ids.length)??0,limit:bI})},[y,x,u,p==null?void 0:p.ids.length]);return d.useEffect(()=>{const{current:w}=t;return n&&w&&o({target:w,elements:{viewport:n}}),()=>{var S;return(S=s())==null?void 0:S.destroy()}},[n,o,s]),p?h&&(p==null?void 0:p.ids.length)===0?a.jsx(L,{sx:{w:"full",h:"full",alignItems:"center",justifyContent:"center"},children:a.jsx(Zn,{label:e("gallery.noImagesInGallery"),icon:Qi})}):h&&p?a.jsxs(a.Fragment,{children:[a.jsx(Ie,{ref:t,"data-overlayscrollbars":"",h:"100%",children:a.jsx(uoe,{style:{height:"100%"},data:p.ids,endReached:b,components:{Item:Woe,List:Goe},scrollerRef:r,itemContent:(w,S)=>a.jsx(Hoe,{imageName:S},S)})}),a.jsx(at,{onClick:b,isDisabled:!y,isLoading:m,loadingText:e("gallery.loading"),flexShrink:0,children:`Load More (${p.ids.length} of ${l})`})]}):g?a.jsx(Ie,{sx:{w:"full",h:"full"},children:a.jsx(Zn,{label:e("gallery.unableToLoad"),icon:NJ})}):null:a.jsx(L,{sx:{w:"full",h:"full",alignItems:"center",justifyContent:"center"},children:a.jsx(Zn,{label:e("gallery.loading"),icon:Qi})})},Xoe=d.memo(qoe),Qoe=ce([xe],e=>{const{galleryView:t}=e.gallery;return{galleryView:t}},je),Yoe=()=>{const e=d.useRef(null),t=d.useRef(null),{galleryView:n}=W(Qoe),r=te(),{isOpen:o,onToggle:s}=Lr({defaultIsOpen:!0}),i=d.useCallback(()=>{r(mw("images"))},[r]),l=d.useCallback(()=>{r(mw("assets"))},[r]);return a.jsxs(m3,{layerStyle:"first",sx:{flexDirection:"column",h:"full",w:"full",borderRadius:"base",p:2},children:[a.jsxs(Ie,{sx:{w:"full"},children:[a.jsxs(L,{ref:e,sx:{alignItems:"center",justifyContent:"space-between",gap:2},children:[a.jsx(_ne,{isOpen:o,onToggle:s}),a.jsx(Tne,{})]}),a.jsx(Ie,{children:a.jsx(Sne,{isOpen:o})})]}),a.jsxs(L,{ref:t,direction:"column",gap:2,h:"full",w:"full",children:[a.jsx(L,{sx:{alignItems:"center",justifyContent:"space-between",gap:2},children:a.jsx(rl,{index:n==="images"?0:1,variant:"unstyled",size:"sm",sx:{w:"full"},children:a.jsx(ol,{children:a.jsxs(Vt,{isAttached:!0,sx:{w:"full"},children:[a.jsx(Tr,{as:at,size:"sm",isChecked:n==="images",onClick:i,sx:{w:"full"},leftIcon:a.jsx(WJ,{}),"data-testid":"images-tab",children:"Images"}),a.jsx(Tr,{as:at,size:"sm",isChecked:n==="assets",onClick:l,sx:{w:"full"},leftIcon:a.jsx(nee,{}),"data-testid":"assets-tab",children:"Assets"})]})})})}),a.jsx(Xoe,{})]})]})},Zoe=d.memo(Yoe),Joe=()=>{const e=W(p=>p.system.isConnected),{data:t}=va(),[n,{isLoading:r}]=Yx(),o=te(),{t:s}=Z(),i=d.useMemo(()=>t==null?void 0:t.queue.item_id,[t==null?void 0:t.queue.item_id]),l=d.useCallback(async()=>{if(i)try{await n(i).unwrap(),o(ct({title:s("queue.cancelSucceeded"),status:"success"}))}catch{o(ct({title:s("queue.cancelFailed"),status:"error"}))}},[i,o,s,n]),u=d.useMemo(()=>!e||J9(i),[e,i]);return{cancelQueueItem:l,isLoading:r,currentQueueItemId:i,isDisabled:u}},ese=({label:e,tooltip:t,icon:n,onClick:r,isDisabled:o,colorScheme:s,asIconButton:i,isLoading:l,loadingText:u,sx:p})=>i?a.jsx(Fe,{"aria-label":e,tooltip:t,icon:n,onClick:r,isDisabled:o,colorScheme:s,isLoading:l,sx:p,"data-testid":e}):a.jsx(at,{"aria-label":e,tooltip:t,leftIcon:n,onClick:r,isDisabled:o,colorScheme:s,isLoading:l,loadingText:u??e,flexGrow:1,sx:p,"data-testid":e,children:e}),ul=d.memo(ese),tse=({asIconButton:e,sx:t})=>{const{t:n}=Z(),{cancelQueueItem:r,isLoading:o,isDisabled:s}=Joe();return a.jsx(ul,{isDisabled:s,isLoading:o,asIconButton:e,label:n("queue.cancel"),tooltip:n("queue.cancelTooltip"),icon:a.jsx(Ic,{}),onClick:r,colorScheme:"error",sx:t})},H8=d.memo(tse),nse=()=>{const{t:e}=Z(),t=te(),{data:n}=va(),r=W(u=>u.system.isConnected),[o,{isLoading:s}]=yI({fixedCacheKey:"clearQueue"}),i=d.useCallback(async()=>{if(n!=null&&n.queue.total)try{await o().unwrap(),t(ct({title:e("queue.clearSucceeded"),status:"success"})),t(Zx(void 0)),t(Jx(void 0))}catch{t(ct({title:e("queue.clearFailed"),status:"error"}))}},[n==null?void 0:n.queue.total,o,t,e]),l=d.useMemo(()=>!r||!(n!=null&&n.queue.total),[r,n==null?void 0:n.queue.total]);return{clearQueue:i,isLoading:s,queueStatus:n,isDisabled:l}},rse=ke((e,t)=>{const{t:n}=Z(),{acceptButtonText:r=n("common.accept"),acceptCallback:o,cancelButtonText:s=n("common.cancel"),cancelCallback:i,children:l,title:u,triggerComponent:p}=e,{isOpen:m,onOpen:h,onClose:g}=Lr(),x=d.useRef(null),y=()=>{o(),g()},b=()=>{i&&i(),g()};return a.jsxs(a.Fragment,{children:[d.cloneElement(p,{onClick:h,ref:t}),a.jsx(Td,{isOpen:m,leastDestructiveRef:x,onClose:g,isCentered:!0,children:a.jsx(Yo,{children:a.jsxs(Nd,{children:[a.jsx(Qo,{fontSize:"lg",fontWeight:"bold",children:u}),a.jsx(Zo,{children:l}),a.jsxs(Ss,{children:[a.jsx(at,{ref:x,onClick:b,children:s}),a.jsx(at,{colorScheme:"error",onClick:y,ml:3,children:r})]})]})})})]})}),kg=d.memo(rse),ose=({asIconButton:e,sx:t})=>{const{t:n}=Z(),{clearQueue:r,isLoading:o,isDisabled:s}=nse();return a.jsxs(kg,{title:n("queue.clearTooltip"),acceptCallback:r,acceptButtonText:n("queue.clear"),triggerComponent:a.jsx(ul,{isDisabled:s,isLoading:o,asIconButton:e,label:n("queue.clear"),tooltip:n("queue.clearTooltip"),icon:a.jsx(Br,{}),colorScheme:"error",sx:t}),children:[a.jsx(ve,{children:n("queue.clearQueueAlertDialog")}),a.jsx("br",{}),a.jsx(ve,{children:n("queue.clearQueueAlertDialog2")})]})},qy=d.memo(ose),sse=()=>{const e=te(),{t}=Z(),n=W(p=>p.system.isConnected),{data:r}=va(),[o,{isLoading:s}]=CI({fixedCacheKey:"pauseProcessor"}),i=d.useMemo(()=>!!(r!=null&&r.processor.is_started),[r==null?void 0:r.processor.is_started]),l=d.useCallback(async()=>{if(i)try{await o().unwrap(),e(ct({title:t("queue.pauseSucceeded"),status:"success"}))}catch{e(ct({title:t("queue.pauseFailed"),status:"error"}))}},[i,o,e,t]),u=d.useMemo(()=>!n||!i,[n,i]);return{pauseProcessor:l,isLoading:s,isStarted:i,isDisabled:u}},ase=({asIconButton:e})=>{const{t}=Z(),{pauseProcessor:n,isLoading:r,isDisabled:o}=sse();return a.jsx(ul,{asIconButton:e,label:t("queue.pause"),tooltip:t("queue.pauseTooltip"),isDisabled:o,isLoading:r,icon:a.jsx(QJ,{}),onClick:n,colorScheme:"gold"})},V8=d.memo(ase),ise=ce([xe,Jn],({controlNet:e,generation:t,system:n,nodes:r,dynamicPrompts:o},s)=>{const{initialImage:i,model:l}=t,{isConnected:u}=n,p=[];return u||p.push(yt.t("parameters.invoke.systemDisconnected")),s==="img2img"&&!i&&p.push(yt.t("parameters.invoke.noInitialImageSelected")),s==="nodes"?r.shouldValidateGraph&&(r.nodes.length||p.push(yt.t("parameters.invoke.noNodesInGraph")),r.nodes.forEach(m=>{if(!Mn(m))return;const h=r.nodeTemplates[m.data.type];if(!h){p.push(yt.t("parameters.invoke.missingNodeTemplate"));return}const g=HD([m],r.edges);$n(m.data.inputs,x=>{const y=h.inputs[x.name],b=g.some(w=>w.target===m.id&&w.targetHandle===x.name);if(!y){p.push(yt.t("parameters.invoke.missingFieldTemplate"));return}if(y.required&&x.value===void 0&&!b){p.push(yt.t("parameters.invoke.missingInputForField",{nodeLabel:m.data.label||h.title,fieldLabel:x.label||y.title}));return}})})):(o.prompts.length===0&&p.push(yt.t("parameters.invoke.noPrompts")),l||p.push(yt.t("parameters.invoke.noModelSelected")),e.isEnabled&&nr(e.controlNets).forEach((m,h)=>{m.isEnabled&&(m.model||p.push(yt.t("parameters.invoke.noModelForControlNet",{index:h+1})),(!m.controlImage||!m.processedControlImage&&m.processorType!=="none")&&p.push(yt.t("parameters.invoke.noControlImageForControlNet",{index:h+1})))})),{isReady:!p.length,reasons:p}},je),Xy=()=>{const{isReady:e,reasons:t}=W(ise);return{isReady:e,reasons:t}},W8=()=>{const e=te(),t=W(Jn),{isReady:n}=Xy(),[r,{isLoading:o}]=bh({fixedCacheKey:"enqueueBatch"}),s=d.useMemo(()=>!n,[n]);return{queueBack:d.useCallback(()=>{s||(e(eb()),e(wI({tabName:t,prepend:!1})))},[e,s,t]),isLoading:o,isDisabled:s}},lse=ce([xe],({gallery:e})=>{const{autoAddBoardId:t}=e;return{autoAddBoardId:t}},je),cse=({prepend:e=!1})=>{const{t}=Z(),{isReady:n,reasons:r}=Xy(),{autoAddBoardId:o}=W(lse),s=vg(o),[i,{isLoading:l}]=bh({fixedCacheKey:"enqueueBatch"}),u=d.useMemo(()=>t(l?"queue.enqueueing":n?e?"queue.queueFront":"queue.queueBack":"queue.notReady"),[l,n,e,t]);return a.jsxs(L,{flexDir:"column",gap:1,children:[a.jsx(ve,{fontWeight:600,children:u}),r.length>0&&a.jsx(Od,{children:r.map((p,m)=>a.jsx(Qr,{children:a.jsx(ve,{fontWeight:400,children:p})},`${p}.${m}`))}),a.jsx(G8,{}),a.jsxs(ve,{fontWeight:400,fontStyle:"oblique 10deg",children:["Adding images to"," ",a.jsx(ve,{as:"span",fontWeight:600,children:s||"Uncategorized"})]})]})},U8=d.memo(cse),G8=d.memo(()=>a.jsx(Yn,{opacity:.2,borderColor:"base.50",_dark:{borderColor:"base.900"}}));G8.displayName="StyledDivider";const use=()=>a.jsx(Ie,{pos:"relative",w:4,h:4,children:a.jsx(ga,{src:Hx,alt:"invoke-ai-logo",pos:"absolute",top:-.5,insetInlineStart:-.5,w:5,h:5,minW:5,minH:5,filter:"saturate(0)"})}),dse=d.memo(use),fse=({asIconButton:e,sx:t})=>{const{t:n}=Z(),{queueBack:r,isLoading:o,isDisabled:s}=W8();return a.jsx(ul,{asIconButton:e,colorScheme:"accent",label:n("parameters.invoke.invoke"),isDisabled:s,isLoading:o,onClick:r,tooltip:a.jsx(U8,{}),sx:t,icon:e?a.jsx(dse,{}):void 0})},K8=d.memo(fse),q8=()=>{const e=te(),t=W(Jn),{isReady:n}=Xy(),[r,{isLoading:o}]=bh({fixedCacheKey:"enqueueBatch"}),s=Bt("prependQueue").isFeatureEnabled,i=d.useMemo(()=>!n||!s,[n,s]);return{queueFront:d.useCallback(()=>{i||(e(eb()),e(wI({tabName:t,prepend:!0})))},[e,i,t]),isLoading:o,isDisabled:i}},pse=({asIconButton:e,sx:t})=>{const{t:n}=Z(),{queueFront:r,isLoading:o,isDisabled:s}=q8();return a.jsx(ul,{asIconButton:e,colorScheme:"base",label:n("queue.queueFront"),isDisabled:s,isLoading:o,onClick:r,tooltip:a.jsx(U8,{prepend:!0}),icon:a.jsx(goe,{}),sx:t})},mse=d.memo(pse),hse=()=>{const e=te(),t=W(p=>p.system.isConnected),{data:n}=va(),{t:r}=Z(),[o,{isLoading:s}]=SI({fixedCacheKey:"resumeProcessor"}),i=d.useMemo(()=>!!(n!=null&&n.processor.is_started),[n==null?void 0:n.processor.is_started]),l=d.useCallback(async()=>{if(!i)try{await o().unwrap(),e(ct({title:r("queue.resumeSucceeded"),status:"success"}))}catch{e(ct({title:r("queue.resumeFailed"),status:"error"}))}},[i,o,e,r]),u=d.useMemo(()=>!t||i,[t,i]);return{resumeProcessor:l,isLoading:s,isStarted:i,isDisabled:u}},gse=({asIconButton:e})=>{const{t}=Z(),{resumeProcessor:n,isLoading:r,isDisabled:o}=hse();return a.jsx(ul,{asIconButton:e,label:t("queue.resume"),tooltip:t("queue.resumeTooltip"),isDisabled:o,isLoading:r,icon:a.jsx(YJ,{}),onClick:n,colorScheme:"green"})},X8=d.memo(gse),vse=ce(xe,({system:e})=>{var t;return{isConnected:e.isConnected,hasSteps:!!e.denoiseProgress,value:(((t=e.denoiseProgress)==null?void 0:t.percentage)??0)*100}},je),xse=()=>{const{t:e}=Z(),{data:t}=va(),{hasSteps:n,value:r,isConnected:o}=W(vse);return a.jsx(K3,{value:r,"aria-label":e("accessibility.invokeProgressBar"),isIndeterminate:o&&!!(t!=null&&t.queue.in_progress)&&!n,h:"full",w:"full",borderRadius:2,colorScheme:"accent"})},bse=d.memo(xse),yse=()=>{const e=Bt("pauseQueue").isFeatureEnabled,t=Bt("resumeQueue").isFeatureEnabled,n=Bt("prependQueue").isFeatureEnabled;return a.jsxs(L,{layerStyle:"first",sx:{w:"full",position:"relative",borderRadius:"base",p:2,gap:2,flexDir:"column"},children:[a.jsxs(L,{gap:2,w:"full",children:[a.jsxs(Vt,{isAttached:!0,flexGrow:2,children:[a.jsx(K8,{}),n?a.jsx(mse,{asIconButton:!0}):a.jsx(a.Fragment,{}),a.jsx(H8,{asIconButton:!0})]}),a.jsxs(Vt,{isAttached:!0,children:[t?a.jsx(X8,{asIconButton:!0}):a.jsx(a.Fragment,{}),e?a.jsx(V8,{asIconButton:!0}):a.jsx(a.Fragment,{})]}),a.jsx(qy,{asIconButton:!0})]}),a.jsx(L,{h:3,w:"full",children:a.jsx(bse,{})}),a.jsx(Y8,{})]})},Q8=d.memo(yse),Y8=d.memo(()=>{const{t:e}=Z(),t=te(),{hasItems:n,pending:r}=va(void 0,{selectFromResult:({data:s})=>{if(!s)return{hasItems:!1,pending:0};const{pending:i,in_progress:l}=s.queue;return{hasItems:i+l>0,pending:i}}}),o=d.useCallback(()=>{t(Xs("queue"))},[t]);return a.jsxs(L,{justifyContent:"space-between",alignItems:"center",pe:1,"data-testid":"queue-count",children:[a.jsx(ba,{}),a.jsx(Za,{onClick:o,size:"sm",variant:"link",fontWeight:400,opacity:.7,fontStyle:"oblique 10deg",children:n?e("queue.queuedCount",{pending:r}):e("queue.queueEmpty")})]})});Y8.displayName="QueueCounts";const{createElement:Ec,createContext:Cse,forwardRef:Z8,useCallback:Gs,useContext:J8,useEffect:oa,useImperativeHandle:eO,useLayoutEffect:wse,useMemo:Sse,useRef:Kr,useState:Wu}=Fx,Uj=Fx["useId".toString()],Uu=wse,kse=typeof Uj=="function"?Uj:()=>null;let jse=0;function Qy(e=null){const t=kse(),n=Kr(e||t||null);return n.current===null&&(n.current=""+jse++),n.current}const jg=Cse(null);jg.displayName="PanelGroupContext";function tO({children:e=null,className:t="",collapsedSize:n=0,collapsible:r=!1,defaultSize:o=null,forwardedRef:s,id:i=null,maxSize:l=null,minSize:u,onCollapse:p=null,onResize:m=null,order:h=null,style:g={},tagName:x="div"}){const y=J8(jg);if(y===null)throw Error("Panel components must be rendered within a PanelGroup container");const b=Qy(i),{collapsePanel:w,expandPanel:S,getPanelSize:j,getPanelStyle:_,registerPanel:E,resizePanel:I,units:M,unregisterPanel:R}=y;u==null&&(M==="percentages"?u=10:u=0);const D=Kr({onCollapse:p,onResize:m});oa(()=>{D.current.onCollapse=p,D.current.onResize=m});const A=_(b,o),O=Kr({size:Gj(A)}),T=Kr({callbacksRef:D,collapsedSize:n,collapsible:r,defaultSize:o,id:b,idWasAutoGenerated:i==null,maxSize:l,minSize:u,order:h});return Uu(()=>{O.current.size=Gj(A),T.current.callbacksRef=D,T.current.collapsedSize=n,T.current.collapsible=r,T.current.defaultSize=o,T.current.id=b,T.current.idWasAutoGenerated=i==null,T.current.maxSize=l,T.current.minSize=u,T.current.order=h}),Uu(()=>(E(b,T),()=>{R(b)}),[h,b,E,R]),eO(s,()=>({collapse:()=>w(b),expand:()=>S(b),getCollapsed(){return O.current.size===0},getId(){return b},getSize(X){return j(b,X)},resize:(X,B)=>I(b,X,B)}),[w,S,j,b,I]),Ec(x,{children:e,className:t,"data-panel":"","data-panel-collapsible":r||void 0,"data-panel-id":b,"data-panel-size":parseFloat(""+A.flexGrow).toFixed(1),id:`data-panel-id-${b}`,style:{...A,...g}})}const Qa=Z8((e,t)=>Ec(tO,{...e,forwardedRef:t}));tO.displayName="Panel";Qa.displayName="forwardRef(Panel)";function Gj(e){const{flexGrow:t}=e;return typeof t=="string"?parseFloat(t):t}const Ji=10;function Du(e,t,n,r,o,s,i,l){const{id:u,panels:p,units:m}=t,h=m==="pixels"?Ha(u):NaN,{sizes:g}=l||{},x=g||s,y=Or(p),b=x.concat();let w=0;{const _=o<0?r:n,E=y.findIndex(D=>D.current.id===_),I=y[E],M=x[E],R=Cx(m,h,I,M,M+Math.abs(o),e);if(M===R)return x;R===0&&M>0&&i.set(_,M),o=o<0?M-R:R-M}let S=o<0?n:r,j=y.findIndex(_=>_.current.id===S);for(;;){const _=y[j],E=x[j],I=Math.abs(o)-Math.abs(w),M=Cx(m,h,_,E,E-I,e);if(E!==M&&(M===0&&E>0&&i.set(_.current.id,E),w+=E-M,b[j]=M,w.toPrecision(Ji).localeCompare(Math.abs(o).toPrecision(Ji),void 0,{numeric:!0})>=0))break;if(o<0){if(--j<0)break}else if(++j>=y.length)break}return w===0?x:(S=o<0?r:n,j=y.findIndex(_=>_.current.id===S),b[j]=x[j]+w,b)}function Fl(e,t,n){t.forEach((r,o)=>{const s=e[o];if(!s)return;const{callbacksRef:i,collapsedSize:l,collapsible:u,id:p}=s.current,m=n[p];if(m!==r){n[p]=r;const{onCollapse:h,onResize:g}=i.current;g&&g(r,m),u&&h&&((m==null||m===l)&&r!==l?h(!1):m!==l&&r===l&&h(!0))}})}function _se({groupId:e,panels:t,units:n}){const r=n==="pixels"?Ha(e):NaN,o=Or(t),s=Array(o.length);let i=0,l=100;for(let u=0;ui.current.id===e);if(n<0)return[null,null];const r=n===t.length-1,o=r?t[n-1].current.id:e,s=r?e:t[n+1].current.id;return[o,s]}function Ha(e){const t=md(e);if(t==null)return NaN;const n=t.getAttribute("data-panel-group-direction"),r=Yy(e);return n==="horizontal"?t.offsetWidth-r.reduce((o,s)=>o+s.offsetWidth,0):t.offsetHeight-r.reduce((o,s)=>o+s.offsetHeight,0)}function nO(e,t,n){if(e.size===1)return"100";const o=Or(e).findIndex(i=>i.current.id===t),s=n[o];return s==null?"0":s.toPrecision(Ji)}function Ise(e){const t=document.querySelector(`[data-panel-id="${e}"]`);return t||null}function md(e){const t=document.querySelector(`[data-panel-group-id="${e}"]`);return t||null}function _g(e){const t=document.querySelector(`[data-panel-resize-handle-id="${e}"]`);return t||null}function Pse(e){return rO().findIndex(r=>r.getAttribute("data-panel-resize-handle-id")===e)??null}function rO(){return Array.from(document.querySelectorAll("[data-panel-resize-handle-id]"))}function Yy(e){return Array.from(document.querySelectorAll(`[data-panel-resize-handle-id][data-panel-group-id="${e}"]`))}function Zy(e,t,n){var u,p,m,h;const r=_g(t),o=Yy(e),s=r?o.indexOf(r):-1,i=((p=(u=n[s])==null?void 0:u.current)==null?void 0:p.id)??null,l=((h=(m=n[s+1])==null?void 0:m.current)==null?void 0:h.id)??null;return[i,l]}function Or(e){return Array.from(e.values()).sort((t,n)=>{const r=t.current.order,o=n.current.order;return r==null&&o==null?0:r==null?-1:o==null?1:r-o})}function Cx(e,t,n,r,o,s=null){var m;let{collapsedSize:i,collapsible:l,maxSize:u,minSize:p}=n.current;if(e==="pixels"&&(i=i/t*100,u!=null&&(u=u/t*100),p=p/t*100),l){if(r>i){if(o<=p/2+i)return i}else if(!((m=s==null?void 0:s.type)==null?void 0:m.startsWith("key"))&&o100)&&(t.current.minSize=0),o!=null&&(o<0||e==="percentages"&&o>100)&&(t.current.maxSize=null),r!==null&&(r<0||e==="percentages"&&r>100?t.current.defaultSize=null:ro&&(t.current.defaultSize=o))}function Gv({groupId:e,panels:t,nextSizes:n,prevSizes:r,units:o}){n=[...n];const s=Or(t),i=o==="pixels"?Ha(e):NaN;let l=0;for(let u=0;u{const{direction:i,panels:l}=e.current,u=md(t);oO(u!=null,`No group found for id "${t}"`);const{height:p,width:m}=u.getBoundingClientRect(),g=Yy(t).map(x=>{const y=x.getAttribute("data-panel-resize-handle-id"),b=Or(l),[w,S]=Zy(t,y,b);if(w==null||S==null)return()=>{};let j=0,_=100,E=0,I=0;b.forEach(T=>{const{id:X,maxSize:B,minSize:V}=T.current;X===w?(j=V,_=B??100):(E+=V,I+=B??100)});const M=Math.min(_,100-E),R=Math.max(j,(b.length-1)*100-I),D=nO(l,w,o);x.setAttribute("aria-valuemax",""+Math.round(M)),x.setAttribute("aria-valuemin",""+Math.round(R)),x.setAttribute("aria-valuenow",""+Math.round(parseInt(D)));const A=T=>{if(!T.defaultPrevented)switch(T.key){case"Enter":{T.preventDefault();const X=b.findIndex(B=>B.current.id===w);if(X>=0){const B=b[X],V=o[X];if(V!=null){let U=0;V.toPrecision(Ji)<=B.current.minSize.toPrecision(Ji)?U=i==="horizontal"?m:p:U=-(i==="horizontal"?m:p);const N=Du(T,e.current,w,S,U,o,s.current,null);o!==N&&r(N)}}break}}};x.addEventListener("keydown",A);const O=Ise(w);return O!=null&&x.setAttribute("aria-controls",O.id),()=>{x.removeAttribute("aria-valuemax"),x.removeAttribute("aria-valuemin"),x.removeAttribute("aria-valuenow"),x.removeEventListener("keydown",A),O!=null&&x.removeAttribute("aria-controls")}});return()=>{g.forEach(x=>x())}},[e,t,n,s,r,o])}function Ose({disabled:e,handleId:t,resizeHandler:n}){oa(()=>{if(e||n==null)return;const r=_g(t);if(r==null)return;const o=s=>{if(!s.defaultPrevented)switch(s.key){case"ArrowDown":case"ArrowLeft":case"ArrowRight":case"ArrowUp":case"End":case"Home":{s.preventDefault(),n(s);break}case"F6":{s.preventDefault();const i=rO(),l=Pse(t);oO(l!==null);const u=s.shiftKey?l>0?l-1:i.length-1:l+1{r.removeEventListener("keydown",o)}},[e,t,n])}function Kv(e,t){if(e.length!==t.length)return!1;for(let n=0;nR.current.id===E),M=r[I];if(M.current.collapsible){const R=m[I];(R===0||R.toPrecision(Ji)===M.current.minSize.toPrecision(Ji))&&(S=S<0?-M.current.minSize*y:M.current.minSize*y)}return S}else return sO(e,n,o,l,u)}function Dse(e){return e.type==="keydown"}function wx(e){return e.type.startsWith("mouse")}function Sx(e){return e.type.startsWith("touch")}let kx=null,Mi=null;function aO(e){switch(e){case"horizontal":return"ew-resize";case"horizontal-max":return"w-resize";case"horizontal-min":return"e-resize";case"vertical":return"ns-resize";case"vertical-max":return"n-resize";case"vertical-min":return"s-resize"}}function Ase(){Mi!==null&&(document.head.removeChild(Mi),kx=null,Mi=null)}function qv(e){if(kx===e)return;kx=e;const t=aO(e);Mi===null&&(Mi=document.createElement("style"),document.head.appendChild(Mi)),Mi.innerHTML=`*{cursor: ${t}!important;}`}function Tse(e,t=10){let n=null;return(...o)=>{n!==null&&clearTimeout(n),n=setTimeout(()=>{e(...o)},t)}}function iO(e){return e.map(t=>{const{minSize:n,order:r}=t.current;return r?`${r}:${n}`:`${n}`}).sort((t,n)=>t.localeCompare(n)).join(",")}function lO(e,t){try{const n=t.getItem(`PanelGroup:sizes:${e}`);if(n){const r=JSON.parse(n);if(typeof r=="object"&&r!=null)return r}}catch{}return null}function Nse(e,t,n){const r=lO(e,n);if(r){const o=iO(t);return r[o]??null}return null}function $se(e,t,n,r){const o=iO(t),s=lO(e,r)||{};s[o]=n;try{r.setItem(`PanelGroup:sizes:${e}`,JSON.stringify(s))}catch(i){console.error(i)}}const Xv={};function Kj(e){try{if(typeof localStorage<"u")e.getItem=t=>localStorage.getItem(t),e.setItem=(t,n)=>{localStorage.setItem(t,n)};else throw new Error("localStorage not supported in this environment")}catch(t){console.error(t),e.getItem=()=>null,e.setItem=()=>{}}}const Au={getItem:e=>(Kj(Au),Au.getItem(e)),setItem:(e,t)=>{Kj(Au),Au.setItem(e,t)}};function cO({autoSaveId:e,children:t=null,className:n="",direction:r,disablePointerEventsDuringResize:o=!1,forwardedRef:s,id:i=null,onLayout:l,storage:u=Au,style:p={},tagName:m="div",units:h="percentages"}){const g=Qy(i),[x,y]=Wu(null),[b,w]=Wu(new Map),S=Kr(null);Kr({didLogDefaultSizeWarning:!1,didLogIdAndOrderWarning:!1,didLogInvalidLayoutWarning:!1,prevPanelIds:[]});const j=Kr({onLayout:l});oa(()=>{j.current.onLayout=l});const _=Kr({}),[E,I]=Wu([]),M=Kr(new Map),R=Kr(0),D=Kr({direction:r,id:g,panels:b,sizes:E,units:h});eO(s,()=>({getId:()=>g,getLayout:F=>{const{sizes:Q,units:Y}=D.current;if((F??Y)==="pixels"){const ae=Ha(g);return Q.map(re=>re/100*ae)}else return Q},setLayout:(F,Q)=>{const{id:Y,panels:se,sizes:ae,units:re}=D.current;if((Q||re)==="pixels"){const le=Ha(Y);F=F.map(J=>J/le*100)}const G=_.current,K=Or(se),ee=Gv({groupId:Y,panels:se,nextSizes:F,prevSizes:ae,units:re});Kv(ae,ee)||(I(ee),Fl(K,ee,G))}}),[g]),Uu(()=>{D.current.direction=r,D.current.id=g,D.current.panels=b,D.current.sizes=E,D.current.units=h}),Mse({committedValuesRef:D,groupId:g,panels:b,setSizes:I,sizes:E,panelSizeBeforeCollapse:M}),oa(()=>{const{onLayout:F}=j.current,{panels:Q,sizes:Y}=D.current;if(Y.length>0){F&&F(Y);const se=_.current,ae=Or(Q);Fl(ae,Y,se)}},[E]),Uu(()=>{const{id:F,sizes:Q,units:Y}=D.current;if(Q.length===b.size)return;let se=null;if(e){const ae=Or(b);se=Nse(e,ae,u)}if(se!=null){const ae=Gv({groupId:F,panels:b,nextSizes:se,prevSizes:se,units:Y});I(ae)}else{const ae=_se({groupId:F,panels:b,units:Y});I(ae)}},[e,b,u]),oa(()=>{if(e){if(E.length===0||E.length!==b.size)return;const F=Or(b);Xv[e]||(Xv[e]=Tse($se,100)),Xv[e](e,F,E,u)}},[e,b,E,u]),Uu(()=>{if(h==="pixels"){const F=new ResizeObserver(()=>{const{panels:Q,sizes:Y}=D.current,se=Gv({groupId:g,panels:Q,nextSizes:Y,prevSizes:Y,units:h});Kv(Y,se)||I(se)});return F.observe(md(g)),()=>{F.disconnect()}}},[g,h]);const A=Gs((F,Q)=>{const{panels:Y,units:se}=D.current,re=Or(Y).findIndex(ee=>ee.current.id===F),G=E[re];if((Q??se)==="pixels"){const ee=Ha(g);return G/100*ee}else return G},[g,E]),O=Gs((F,Q)=>{const{panels:Y}=D.current;return Y.size===0?{flexBasis:0,flexGrow:Q??void 0,flexShrink:1,overflow:"hidden"}:{flexBasis:0,flexGrow:nO(Y,F,E),flexShrink:1,overflow:"hidden",pointerEvents:o&&x!==null?"none":void 0}},[x,o,E]),T=Gs((F,Q)=>{const{units:Y}=D.current;Ese(Y,Q),w(se=>{if(se.has(F))return se;const ae=new Map(se);return ae.set(F,Q),ae})},[]),X=Gs(F=>Y=>{Y.preventDefault();const{direction:se,panels:ae,sizes:re}=D.current,G=Or(ae),[K,ee]=Zy(g,F,G);if(K==null||ee==null)return;let le=Rse(Y,g,F,G,se,re,S.current);if(le===0)return;const ie=md(g).getBoundingClientRect(),de=se==="horizontal";document.dir==="rtl"&&de&&(le=-le);const ge=de?ie.width:ie.height,Ce=le/ge*100,he=Du(Y,D.current,K,ee,Ce,re,M.current,S.current),fe=!Kv(re,he);if((wx(Y)||Sx(Y))&&R.current!=Ce&&qv(fe?de?"horizontal":"vertical":de?le<0?"horizontal-min":"horizontal-max":le<0?"vertical-min":"vertical-max"),fe){const Oe=_.current;I(he),Fl(G,he,Oe)}R.current=Ce},[g]),B=Gs(F=>{w(Q=>{if(!Q.has(F))return Q;const Y=new Map(Q);return Y.delete(F),Y})},[]),V=Gs(F=>{const{panels:Q,sizes:Y}=D.current,se=Q.get(F);if(se==null)return;const{collapsedSize:ae,collapsible:re}=se.current;if(!re)return;const G=Or(Q),K=G.indexOf(se);if(K<0)return;const ee=Y[K];if(ee===ae)return;M.current.set(F,ee);const[le,J]=Uv(F,G);if(le==null||J==null)return;const de=K===G.length-1?ee:ae-ee,ge=Du(null,D.current,le,J,de,Y,M.current,null);if(Y!==ge){const Ce=_.current;I(ge),Fl(G,ge,Ce)}},[]),U=Gs(F=>{const{panels:Q,sizes:Y}=D.current,se=Q.get(F);if(se==null)return;const{collapsedSize:ae,minSize:re}=se.current,G=M.current.get(F)||re;if(!G)return;const K=Or(Q),ee=K.indexOf(se);if(ee<0||Y[ee]!==ae)return;const[J,ie]=Uv(F,K);if(J==null||ie==null)return;const ge=ee===K.length-1?ae-G:G,Ce=Du(null,D.current,J,ie,ge,Y,M.current,null);if(Y!==Ce){const he=_.current;I(Ce),Fl(K,Ce,he)}},[]),N=Gs((F,Q,Y)=>{const{id:se,panels:ae,sizes:re,units:G}=D.current;if((Y||G)==="pixels"){const nt=Ha(se);Q=Q/nt*100}const K=ae.get(F);if(K==null)return;let{collapsedSize:ee,collapsible:le,maxSize:J,minSize:ie}=K.current;if(G==="pixels"){const nt=Ha(se);ie=ie/nt*100,J!=null&&(J=J/nt*100)}const de=Or(ae),ge=de.indexOf(K);if(ge<0)return;const Ce=re[ge];if(Ce===Q)return;le&&Q===ee||(Q=Math.min(J??100,Math.max(ie,Q)));const[he,fe]=Uv(F,de);if(he==null||fe==null)return;const _e=ge===de.length-1?Ce-Q:Q-Ce,Ne=Du(null,D.current,he,fe,_e,re,M.current,null);if(re!==Ne){const nt=_.current;I(Ne),Fl(de,Ne,nt)}},[]),$=Sse(()=>({activeHandleId:x,collapsePanel:V,direction:r,expandPanel:U,getPanelSize:A,getPanelStyle:O,groupId:g,registerPanel:T,registerResizeHandle:X,resizePanel:N,startDragging:(F,Q)=>{if(y(F),wx(Q)||Sx(Q)){const Y=_g(F);S.current={dragHandleRect:Y.getBoundingClientRect(),dragOffset:sO(Q,F,r),sizes:D.current.sizes}}},stopDragging:()=>{Ase(),y(null),S.current=null},units:h,unregisterPanel:B}),[x,V,r,U,A,O,g,T,X,N,h,B]),q={display:"flex",flexDirection:r==="horizontal"?"row":"column",height:"100%",overflow:"hidden",width:"100%"};return Ec(jg.Provider,{children:Ec(m,{children:t,className:n,"data-panel-group":"","data-panel-group-direction":r,"data-panel-group-id":g,"data-panel-group-units":h,style:{...q,...p}}),value:$})}const Ig=Z8((e,t)=>Ec(cO,{...e,forwardedRef:t}));cO.displayName="PanelGroup";Ig.displayName="forwardRef(PanelGroup)";function jx({children:e=null,className:t="",disabled:n=!1,id:r=null,onDragging:o,style:s={},tagName:i="div"}){const l=Kr(null),u=Kr({onDragging:o});oa(()=>{u.current.onDragging=o});const p=J8(jg);if(p===null)throw Error("PanelResizeHandle components must be rendered within a PanelGroup container");const{activeHandleId:m,direction:h,groupId:g,registerResizeHandle:x,startDragging:y,stopDragging:b}=p,w=Qy(r),S=m===w,[j,_]=Wu(!1),[E,I]=Wu(null),M=Gs(()=>{l.current.blur(),b();const{onDragging:A}=u.current;A&&A(!1)},[b]);oa(()=>{if(n)I(null);else{const D=x(w);I(()=>D)}},[n,w,x]),oa(()=>{if(n||E==null||!S)return;const D=X=>{E(X)},A=X=>{E(X)},T=l.current.ownerDocument;return T.body.addEventListener("contextmenu",M),T.body.addEventListener("mousemove",D),T.body.addEventListener("touchmove",D),T.body.addEventListener("mouseleave",A),window.addEventListener("mouseup",M),window.addEventListener("touchend",M),()=>{T.body.removeEventListener("contextmenu",M),T.body.removeEventListener("mousemove",D),T.body.removeEventListener("touchmove",D),T.body.removeEventListener("mouseleave",A),window.removeEventListener("mouseup",M),window.removeEventListener("touchend",M)}},[h,n,S,E,M]),Ose({disabled:n,handleId:w,resizeHandler:E});const R={cursor:aO(h),touchAction:"none",userSelect:"none"};return Ec(i,{children:e,className:t,"data-resize-handle-active":S?"pointer":j?"keyboard":void 0,"data-panel-group-direction":h,"data-panel-group-id":g,"data-panel-resize-handle-enabled":!n,"data-panel-resize-handle-id":w,onBlur:()=>_(!1),onFocus:()=>_(!0),onMouseDown:D=>{y(w,D.nativeEvent);const{onDragging:A}=u.current;A&&A(!0)},onMouseUp:M,onTouchCancel:M,onTouchEnd:M,onTouchStart:D=>{y(w,D.nativeEvent);const{onDragging:A}=u.current;A&&A(!0)},ref:l,role:"separator",style:{...R,...s},tabIndex:0})}jx.displayName="PanelResizeHandle";const Lse=e=>{const{direction:t="horizontal",collapsedDirection:n,isCollapsed:r=!1,...o}=e,s=sa("base.100","base.850"),i=sa("base.300","base.700");return t==="horizontal"?a.jsx(jx,{style:{visibility:r?"hidden":"visible",width:r?0:"auto"},children:a.jsx(L,{className:"resize-handle-horizontal",sx:{w:n?2.5:4,h:"full",justifyContent:n?n==="left"?"flex-start":"flex-end":"center",alignItems:"center",div:{bg:s},_hover:{div:{bg:i}}},...o,children:a.jsx(Ie,{sx:{w:1,h:"calc(100% - 1rem)",borderRadius:"base",transitionProperty:"common",transitionDuration:"normal"}})})}):a.jsx(jx,{style:{visibility:r?"hidden":"visible",width:r?0:"auto"},children:a.jsx(L,{className:"resize-handle-vertical",sx:{w:"full",h:n?2.5:4,alignItems:n?n==="top"?"flex-start":"flex-end":"center",justifyContent:"center",div:{bg:s},_hover:{div:{bg:i}}},...o,children:a.jsx(Ie,{sx:{h:1,w:"calc(100% - 1rem)",borderRadius:"base",transitionProperty:"common",transitionDuration:"normal"}})})})},lh=d.memo(Lse),Jy=()=>{const e=te(),t=W(o=>o.ui.panels),n=d.useCallback(o=>t[o]??"",[t]),r=d.useCallback((o,s)=>{e(VD({name:o,value:s}))},[e]);return{getItem:n,setItem:r}};const zse=e=>{const{label:t,data:n,fileName:r,withDownload:o=!0,withCopy:s=!0}=e,i=d.useMemo(()=>WD(n)?n:JSON.stringify(n,null,2),[n]),l=d.useCallback(()=>{navigator.clipboard.writeText(i)},[i]),u=d.useCallback(()=>{const m=new Blob([i]),h=document.createElement("a");h.href=URL.createObjectURL(m),h.download=`${r||t}.json`,document.body.appendChild(h),h.click(),h.remove()},[i,t,r]),{t:p}=Z();return a.jsxs(L,{layerStyle:"second",sx:{borderRadius:"base",flexGrow:1,w:"full",h:"full",position:"relative"},children:[a.jsx(Ie,{sx:{position:"absolute",top:0,left:0,right:0,bottom:0,overflow:"auto",p:4,fontSize:"sm"},children:a.jsx(hg,{defer:!0,style:{height:"100%",width:"100%"},options:{scrollbars:{visibility:"auto",autoHide:"scroll",autoHideDelay:1300,theme:"os-theme-dark"}},children:a.jsx("pre",{children:i})})}),a.jsxs(L,{sx:{position:"absolute",top:0,insetInlineEnd:0,p:2},children:[o&&a.jsx(Ht,{label:`${p("gallery.download")} ${t} JSON`,children:a.jsx(ys,{"aria-label":`${p("gallery.download")} ${t} JSON`,icon:a.jsx(ig,{}),variant:"ghost",opacity:.7,onClick:u})}),s&&a.jsx(Ht,{label:`${p("gallery.copy")} ${t} JSON`,children:a.jsx(ys,{"aria-label":`${p("gallery.copy")} ${t} JSON`,icon:a.jsx(Hc,{}),variant:"ghost",opacity:.7,onClick:l})})]})]})},Ya=d.memo(zse),Fse=ce(xe,({nodes:e})=>{const t=e.selectedNodes[e.selectedNodes.length-1],n=e.nodes.find(r=>r.id===t);return{data:n==null?void 0:n.data}},je),Bse=()=>{const{data:e}=W(Fse);return e?a.jsx(Ya,{data:e,label:"Node Data"}):a.jsx(Zn,{label:"No node selected",icon:null})},Hse=d.memo(Bse),Vse=({children:e,maxHeight:t})=>a.jsx(L,{sx:{w:"full",h:"full",maxHeight:t,position:"relative"},children:a.jsx(Ie,{sx:{position:"absolute",top:0,left:0,right:0,bottom:0},children:a.jsx(hg,{defer:!0,style:{height:"100%",width:"100%"},options:{scrollbars:{visibility:"auto",autoHide:"scroll",autoHideDelay:1300,theme:"os-theme-dark"},overflow:{x:"hidden"}},children:e})})}),Zd=d.memo(Vse),Wse=({output:e})=>{const{image:t}=e,{data:n}=to(t.image_name);return a.jsx(ua,{imageDTO:n})},Use=d.memo(Wse),Gse=ce(xe,({nodes:e})=>{const t=e.selectedNodes[e.selectedNodes.length-1],n=e.nodes.find(s=>s.id===t),r=n?e.nodeTemplates[n.data.type]:void 0,o=e.nodeExecutionStates[t??"__UNKNOWN_NODE__"];return{node:n,template:r,nes:o}},je),Kse=()=>{const{node:e,template:t,nes:n}=W(Gse),{t:r}=Z();return!e||!n||!Mn(e)?a.jsx(Zn,{label:r("nodes.noNodeSelected"),icon:null}):n.outputs.length===0?a.jsx(Zn,{label:r("nodes.noOutputRecorded"),icon:null}):a.jsx(Ie,{sx:{position:"relative",w:"full",h:"full"},children:a.jsx(Zd,{children:a.jsx(L,{sx:{position:"relative",flexDir:"column",alignItems:"flex-start",p:1,gap:2,h:"full",w:"full"},children:(t==null?void 0:t.outputType)==="image_output"?n.outputs.map((o,s)=>a.jsx(Use,{output:o},Xse(o,s))):a.jsx(Ya,{data:n.outputs,label:r("nodes.nodeOutputs")})})})})},qse=d.memo(Kse),Xse=(e,t)=>`${e.type}-${t}`,Qse=ce(xe,({nodes:e})=>{const t=e.selectedNodes[e.selectedNodes.length-1],n=e.nodes.find(o=>o.id===t);return{template:n?e.nodeTemplates[n.data.type]:void 0}},je),Yse=()=>{const{template:e}=W(Qse),{t}=Z();return e?a.jsx(Ya,{data:e,label:t("nodes.nodeTemplate")}):a.jsx(Zn,{label:t("nodes.noNodeSelected"),icon:null})},Zse=d.memo(Yse),Jse=()=>a.jsx(L,{layerStyle:"first",sx:{flexDir:"column",w:"full",h:"full",borderRadius:"base",p:2,gap:2},children:a.jsxs(rl,{variant:"line",sx:{display:"flex",flexDir:"column",w:"full",h:"full"},children:[a.jsxs(ol,{children:[a.jsx(Tr,{children:"Outputs"}),a.jsx(Tr,{children:"Data"}),a.jsx(Tr,{children:"Template"})]}),a.jsxs(zc,{children:[a.jsx(So,{children:a.jsx(qse,{})}),a.jsx(So,{children:a.jsx(Hse,{})}),a.jsx(So,{children:a.jsx(Zse,{})})]})]})}),eae=d.memo(Jse),e2=e=>{e.stopPropagation()},tae={display:"flex",flexDirection:"row",alignItems:"center",gap:10},nae=e=>{const{label:t="",labelPos:n="top",isDisabled:r=!1,isInvalid:o,formControlProps:s,...i}=e,l=te(),u=d.useCallback(m=>{m.shiftKey&&l(Nr(!0))},[l]),p=d.useCallback(m=>{m.shiftKey||l(Nr(!1))},[l]);return a.jsxs(Kt,{isInvalid:o,isDisabled:r,...s,style:n==="side"?tae:void 0,children:[t!==""&&a.jsx(wn,{children:t}),a.jsx(Mh,{...i,onPaste:e2,onKeyDown:u,onKeyUp:p})]})},vo=d.memo(nae),rae=ke((e,t)=>{const n=te(),r=d.useCallback(s=>{s.shiftKey&&n(Nr(!0))},[n]),o=d.useCallback(s=>{s.shiftKey||n(Nr(!1))},[n]);return a.jsx(fP,{ref:t,onPaste:e2,onKeyDown:r,onKeyUp:o,...e})}),da=d.memo(rae),oae=ce(xe,({nodes:e})=>{const{author:t,name:n,description:r,tags:o,version:s,contact:i,notes:l}=e.workflow;return{name:n,author:t,description:r,tags:o,version:s,contact:i,notes:l}},je),sae=()=>{const{author:e,name:t,description:n,tags:r,version:o,contact:s,notes:i}=W(oae),l=te(),u=d.useCallback(w=>{l(UD(w.target.value))},[l]),p=d.useCallback(w=>{l(GD(w.target.value))},[l]),m=d.useCallback(w=>{l(KD(w.target.value))},[l]),h=d.useCallback(w=>{l(qD(w.target.value))},[l]),g=d.useCallback(w=>{l(XD(w.target.value))},[l]),x=d.useCallback(w=>{l(QD(w.target.value))},[l]),y=d.useCallback(w=>{l(YD(w.target.value))},[l]),{t:b}=Z();return a.jsx(Zd,{children:a.jsxs(L,{sx:{flexDir:"column",alignItems:"flex-start",gap:2,h:"full"},children:[a.jsxs(L,{sx:{gap:2,w:"full"},children:[a.jsx(vo,{label:b("nodes.workflowName"),value:t,onChange:u}),a.jsx(vo,{label:b("nodes.workflowVersion"),value:o,onChange:h})]}),a.jsxs(L,{sx:{gap:2,w:"full"},children:[a.jsx(vo,{label:b("nodes.workflowAuthor"),value:e,onChange:p}),a.jsx(vo,{label:b("nodes.workflowContact"),value:s,onChange:m})]}),a.jsx(vo,{label:b("nodes.workflowTags"),value:r,onChange:x}),a.jsxs(Kt,{as:L,sx:{flexDir:"column"},children:[a.jsx(wn,{children:b("nodes.workflowDescription")}),a.jsx(da,{onChange:g,value:n,fontSize:"sm",sx:{resize:"none"}})]}),a.jsxs(Kt,{as:L,sx:{flexDir:"column",h:"full"},children:[a.jsx(wn,{children:b("nodes.workflowNotes")}),a.jsx(da,{onChange:y,value:i,fontSize:"sm",sx:{h:"full",resize:"none"}})]})]})})},aae=d.memo(sae);function iae(e,t,n){var r=this,o=d.useRef(null),s=d.useRef(0),i=d.useRef(null),l=d.useRef([]),u=d.useRef(),p=d.useRef(),m=d.useRef(e),h=d.useRef(!0);d.useEffect(function(){m.current=e},[e]);var g=!t&&t!==0&&typeof window<"u";if(typeof e!="function")throw new TypeError("Expected a function");t=+t||0;var x=!!(n=n||{}).leading,y=!("trailing"in n)||!!n.trailing,b="maxWait"in n,w=b?Math.max(+n.maxWait||0,t):null;d.useEffect(function(){return h.current=!0,function(){h.current=!1}},[]);var S=d.useMemo(function(){var j=function(D){var A=l.current,O=u.current;return l.current=u.current=null,s.current=D,p.current=m.current.apply(O,A)},_=function(D,A){g&&cancelAnimationFrame(i.current),i.current=g?requestAnimationFrame(D):setTimeout(D,A)},E=function(D){if(!h.current)return!1;var A=D-o.current;return!o.current||A>=t||A<0||b&&D-s.current>=w},I=function(D){return i.current=null,y&&l.current?j(D):(l.current=u.current=null,p.current)},M=function D(){var A=Date.now();if(E(A))return I(A);if(h.current){var O=t-(A-o.current),T=b?Math.min(O,w-(A-s.current)):O;_(D,T)}},R=function(){var D=Date.now(),A=E(D);if(l.current=[].slice.call(arguments),u.current=r,o.current=D,A){if(!i.current&&h.current)return s.current=o.current,_(M,t),x?j(o.current):p.current;if(b)return _(M,t),j(o.current)}return i.current||_(M,t),p.current};return R.cancel=function(){i.current&&(g?cancelAnimationFrame(i.current):clearTimeout(i.current)),s.current=0,l.current=o.current=u.current=i.current=null},R.isPending=function(){return!!i.current},R.flush=function(){return i.current?I(Date.now()):p.current},R},[x,b,t,w,y,g]);return S}function lae(e,t){return e===t}function qj(e){return typeof e=="function"?function(){return e}:e}function cae(e,t,n){var r,o,s=n&&n.equalityFn||lae,i=(r=d.useState(qj(e)),o=r[1],[r[0],d.useCallback(function(h){return o(qj(h))},[])]),l=i[0],u=i[1],p=iae(d.useCallback(function(h){return u(h)},[u]),t,n),m=d.useRef(e);return s(m.current,e)||(p(e),m.current=e),[l,p]}const uO=()=>{const e=W(r=>r.nodes),[t]=cae(e,300);return d.useMemo(()=>ZD(t),[t])},uae=()=>{const e=uO(),{t}=Z();return a.jsx(L,{sx:{flexDir:"column",alignItems:"flex-start",gap:2,h:"full"},children:a.jsx(Ya,{data:e,label:t("nodes.workflow")})})},dae=d.memo(uae),fae=({isSelected:e,isHovered:t})=>{const n=d.useMemo(()=>{if(e&&t)return"nodeHoveredSelected.light";if(e)return"nodeSelected.light";if(t)return"nodeHovered.light"},[t,e]),r=d.useMemo(()=>{if(e&&t)return"nodeHoveredSelected.dark";if(e)return"nodeSelected.dark";if(t)return"nodeHovered.dark"},[t,e]);return a.jsx(Ie,{className:"selection-box",sx:{position:"absolute",top:0,insetInlineEnd:0,bottom:0,insetInlineStart:0,borderRadius:"base",opacity:e||t?1:.5,transitionProperty:"common",transitionDuration:"0.1s",pointerEvents:"none",shadow:n,_dark:{shadow:r}}})},dO=d.memo(fae),fO=e=>{const t=te(),n=d.useMemo(()=>ce(xe,({nodes:i})=>i.mouseOverNode===e,je),[e]),r=W(n),o=d.useCallback(()=>{!r&&t(hw(e))},[t,e,r]),s=d.useCallback(()=>{r&&t(hw(null))},[t,r]);return{isMouseOverNode:r,handleMouseOver:o,handleMouseOut:s}},pO=(e,t)=>{const n=d.useMemo(()=>ce(xe,({nodes:o})=>{var i;const s=o.nodes.find(l=>l.id===e);if(Mn(s))return(i=s==null?void 0:s.data.inputs[t])==null?void 0:i.label},je),[t,e]);return W(n)},mO=(e,t,n)=>{const r=d.useMemo(()=>ce(xe,({nodes:s})=>{var u;const i=s.nodes.find(p=>p.id===e);if(!Mn(i))return;const l=s.nodeTemplates[(i==null?void 0:i.data.type)??""];return(u=l==null?void 0:l[tb[n]][t])==null?void 0:u.title},je),[t,n,e]);return W(r)},hO=(e,t)=>{const n=d.useMemo(()=>ce(xe,({nodes:o})=>{const s=o.nodes.find(i=>i.id===e);if(Mn(s))return s==null?void 0:s.data.inputs[t]},je),[t,e]);return W(n)},Pg=(e,t,n)=>{const r=d.useMemo(()=>ce(xe,({nodes:s})=>{const i=s.nodes.find(u=>u.id===e);if(!Mn(i))return;const l=s.nodeTemplates[(i==null?void 0:i.data.type)??""];return l==null?void 0:l[tb[n]][t]},je),[t,n,e]);return W(r)},pae=({nodeId:e,fieldName:t,kind:n})=>{const r=hO(e,t),o=Pg(e,t,n),s=JD(o),{t:i}=Z(),l=d.useMemo(()=>eA(r)?r.label&&(o!=null&&o.title)?`${r.label} (${o.title})`:r.label&&!o?r.label:!r.label&&o?o.title:i("nodes.unknownField"):(o==null?void 0:o.title)||i("nodes.unknownField"),[r,o,i]);return a.jsxs(L,{sx:{flexDir:"column"},children:[a.jsx(ve,{sx:{fontWeight:600},children:l}),o&&a.jsx(ve,{sx:{opacity:.7,fontStyle:"oblique 5deg"},children:o.description}),o&&a.jsxs(ve,{children:["Type: ",wd[o.type].title]}),s&&a.jsxs(ve,{children:["Input: ",tA(o.input)]})]})},t2=d.memo(pae),mae=ke((e,t)=>{const{nodeId:n,fieldName:r,kind:o,isMissingInput:s=!1,withTooltip:i=!1}=e,l=pO(n,r),u=mO(n,r,o),{t:p}=Z(),m=te(),[h,g]=d.useState(l||u||p("nodes.unknownField")),x=d.useCallback(async b=>{b&&(b===l||b===u)||(g(b||u||p("nodes.unknownField")),m(nA({nodeId:n,fieldName:r,label:b})))},[l,u,m,n,r,p]),y=d.useCallback(b=>{g(b)},[]);return d.useEffect(()=>{g(l||u||p("nodes.unknownField"))},[l,u,p]),a.jsx(Ht,{label:i?a.jsx(t2,{nodeId:n,fieldName:r,kind:"input"}):void 0,openDelay:yh,placement:"top",hasArrow:!0,children:a.jsx(L,{ref:t,sx:{position:"relative",overflow:"hidden",alignItems:"center",justifyContent:"flex-start",gap:1,h:"full"},children:a.jsxs(Ih,{value:h,onChange:y,onSubmit:x,as:L,sx:{position:"relative",alignItems:"center",h:"full"},children:[a.jsx(_h,{sx:{p:0,fontWeight:s?600:400,textAlign:"left",_hover:{fontWeight:"600 !important"}},noOfLines:1}),a.jsx(jh,{className:"nodrag",sx:{p:0,w:"full",fontWeight:600,color:"base.900",_dark:{color:"base.100"},_focusVisible:{p:0,textAlign:"left",boxShadow:"none"}}}),a.jsx(vO,{})]})})})}),gO=d.memo(mae),vO=d.memo(()=>{const{isEditing:e,getEditButtonProps:t}=C5(),n=d.useCallback(r=>{const{onClick:o}=t();o&&(o(r),r.preventDefault())},[t]);return e?null:a.jsx(L,{onClick:n,position:"absolute",w:"full",h:"full",top:0,insetInlineStart:0,cursor:"text"})});vO.displayName="EditableControls";const hae=e=>{const{nodeId:t,field:n}=e,r=te(),o=d.useCallback(s=>{r(rA({nodeId:t,fieldName:n.name,value:s.target.checked}))},[r,n.name,t]);return a.jsx(qb,{className:"nodrag",onChange:o,isChecked:n.value})},gae=d.memo(hae);function Eg(){return(Eg=Object.assign||function(e){for(var t=1;t=0||(o[n]=e[n]);return o}function _x(e){var t=d.useRef(e),n=d.useRef(function(r){t.current&&t.current(r)});return t.current=e,n.current}var Mc=function(e,t,n){return t===void 0&&(t=0),n===void 0&&(n=1),e>n?n:e0:w.buttons>0)&&o.current?s(Xj(o.current,w,l.current)):b(!1)},y=function(){return b(!1)};function b(w){var S=u.current,j=Ix(o.current),_=w?j.addEventListener:j.removeEventListener;_(S?"touchmove":"mousemove",x),_(S?"touchend":"mouseup",y)}return[function(w){var S=w.nativeEvent,j=o.current;if(j&&(Qj(S),!function(E,I){return I&&!Gu(E)}(S,u.current)&&j)){if(Gu(S)){u.current=!0;var _=S.changedTouches||[];_.length&&(l.current=_[0].identifier)}j.focus(),s(Xj(j,S,l.current)),b(!0)}},function(w){var S=w.which||w.keyCode;S<37||S>40||(w.preventDefault(),i({left:S===39?.05:S===37?-.05:0,top:S===40?.05:S===38?-.05:0}))},b]},[i,s]),m=p[0],h=p[1],g=p[2];return d.useEffect(function(){return g},[g]),H.createElement("div",Eg({},r,{onTouchStart:m,onMouseDown:m,className:"react-colorful__interactive",ref:o,onKeyDown:h,tabIndex:0,role:"slider"}))}),Mg=function(e){return e.filter(Boolean).join(" ")},r2=function(e){var t=e.color,n=e.left,r=e.top,o=r===void 0?.5:r,s=Mg(["react-colorful__pointer",e.className]);return H.createElement("div",{className:s,style:{top:100*o+"%",left:100*n+"%"}},H.createElement("div",{className:"react-colorful__pointer-fill",style:{backgroundColor:t}}))},Cr=function(e,t,n){return t===void 0&&(t=0),n===void 0&&(n=Math.pow(10,t)),Math.round(n*e)/n},bO=function(e){var t=e.s,n=e.v,r=e.a,o=(200-t)*n/100;return{h:Cr(e.h),s:Cr(o>0&&o<200?t*n/100/(o<=100?o:200-o)*100:0),l:Cr(o/2),a:Cr(r,2)}},Px=function(e){var t=bO(e);return"hsl("+t.h+", "+t.s+"%, "+t.l+"%)"},Qv=function(e){var t=bO(e);return"hsla("+t.h+", "+t.s+"%, "+t.l+"%, "+t.a+")"},vae=function(e){var t=e.h,n=e.s,r=e.v,o=e.a;t=t/360*6,n/=100,r/=100;var s=Math.floor(t),i=r*(1-n),l=r*(1-(t-s)*n),u=r*(1-(1-t+s)*n),p=s%6;return{r:Cr(255*[r,l,i,i,u,r][p]),g:Cr(255*[u,r,r,l,i,i][p]),b:Cr(255*[i,i,u,r,r,l][p]),a:Cr(o,2)}},xae=function(e){var t=e.r,n=e.g,r=e.b,o=e.a,s=Math.max(t,n,r),i=s-Math.min(t,n,r),l=i?s===t?(n-r)/i:s===n?2+(r-t)/i:4+(t-n)/i:0;return{h:Cr(60*(l<0?l+6:l)),s:Cr(s?i/s*100:0),v:Cr(s/255*100),a:o}},bae=H.memo(function(e){var t=e.hue,n=e.onChange,r=Mg(["react-colorful__hue",e.className]);return H.createElement("div",{className:r},H.createElement(n2,{onMove:function(o){n({h:360*o.left})},onKey:function(o){n({h:Mc(t+360*o.left,0,360)})},"aria-label":"Hue","aria-valuenow":Cr(t),"aria-valuemax":"360","aria-valuemin":"0"},H.createElement(r2,{className:"react-colorful__hue-pointer",left:t/360,color:Px({h:t,s:100,v:100,a:1})})))}),yae=H.memo(function(e){var t=e.hsva,n=e.onChange,r={backgroundColor:Px({h:t.h,s:100,v:100,a:1})};return H.createElement("div",{className:"react-colorful__saturation",style:r},H.createElement(n2,{onMove:function(o){n({s:100*o.left,v:100-100*o.top})},onKey:function(o){n({s:Mc(t.s+100*o.left,0,100),v:Mc(t.v-100*o.top,0,100)})},"aria-label":"Color","aria-valuetext":"Saturation "+Cr(t.s)+"%, Brightness "+Cr(t.v)+"%"},H.createElement(r2,{className:"react-colorful__saturation-pointer",top:1-t.v/100,left:t.s/100,color:Px(t)})))}),yO=function(e,t){if(e===t)return!0;for(var n in e)if(e[n]!==t[n])return!1;return!0};function Cae(e,t,n){var r=_x(n),o=d.useState(function(){return e.toHsva(t)}),s=o[0],i=o[1],l=d.useRef({color:t,hsva:s});d.useEffect(function(){if(!e.equal(t,l.current.color)){var p=e.toHsva(t);l.current={hsva:p,color:t},i(p)}},[t,e]),d.useEffect(function(){var p;yO(s,l.current.hsva)||e.equal(p=e.fromHsva(s),l.current.color)||(l.current={hsva:s,color:p},r(p))},[s,e,r]);var u=d.useCallback(function(p){i(function(m){return Object.assign({},m,p)})},[]);return[s,u]}var wae=typeof window<"u"?d.useLayoutEffect:d.useEffect,Sae=function(){return typeof __webpack_nonce__<"u"?__webpack_nonce__:void 0},Yj=new Map,kae=function(e){wae(function(){var t=e.current?e.current.ownerDocument:document;if(t!==void 0&&!Yj.has(t)){var n=t.createElement("style");n.innerHTML=`.react-colorful{position:relative;display:flex;flex-direction:column;width:200px;height:200px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;cursor:default}.react-colorful__saturation{position:relative;flex-grow:1;border-color:transparent;border-bottom:12px solid #000;border-radius:8px 8px 0 0;background-image:linear-gradient(0deg,#000,transparent),linear-gradient(90deg,#fff,hsla(0,0%,100%,0))}.react-colorful__alpha-gradient,.react-colorful__pointer-fill{content:"";position:absolute;left:0;top:0;right:0;bottom:0;pointer-events:none;border-radius:inherit}.react-colorful__alpha-gradient,.react-colorful__saturation{box-shadow:inset 0 0 0 1px rgba(0,0,0,.05)}.react-colorful__alpha,.react-colorful__hue{position:relative;height:24px}.react-colorful__hue{background:linear-gradient(90deg,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red)}.react-colorful__last-control{border-radius:0 0 8px 8px}.react-colorful__interactive{position:absolute;left:0;top:0;right:0;bottom:0;border-radius:inherit;outline:none;touch-action:none}.react-colorful__pointer{position:absolute;z-index:1;box-sizing:border-box;width:28px;height:28px;transform:translate(-50%,-50%);background-color:#fff;border:2px solid #fff;border-radius:50%;box-shadow:0 2px 4px rgba(0,0,0,.2)}.react-colorful__interactive:focus .react-colorful__pointer{transform:translate(-50%,-50%) scale(1.1)}.react-colorful__alpha,.react-colorful__alpha-pointer{background-color:#fff;background-image:url('data:image/svg+xml;charset=utf-8,')}.react-colorful__saturation-pointer{z-index:3}.react-colorful__hue-pointer{z-index:2}`,Yj.set(t,n);var r=Sae();r&&n.setAttribute("nonce",r),t.head.appendChild(n)}},[])},jae=function(e){var t=e.className,n=e.hsva,r=e.onChange,o={backgroundImage:"linear-gradient(90deg, "+Qv(Object.assign({},n,{a:0}))+", "+Qv(Object.assign({},n,{a:1}))+")"},s=Mg(["react-colorful__alpha",t]),i=Cr(100*n.a);return H.createElement("div",{className:s},H.createElement("div",{className:"react-colorful__alpha-gradient",style:o}),H.createElement(n2,{onMove:function(l){r({a:l.left})},onKey:function(l){r({a:Mc(n.a+l.left)})},"aria-label":"Alpha","aria-valuetext":i+"%","aria-valuenow":i,"aria-valuemin":"0","aria-valuemax":"100"},H.createElement(r2,{className:"react-colorful__alpha-pointer",left:n.a,color:Qv(n)})))},_ae=function(e){var t=e.className,n=e.colorModel,r=e.color,o=r===void 0?n.defaultColor:r,s=e.onChange,i=xO(e,["className","colorModel","color","onChange"]),l=d.useRef(null);kae(l);var u=Cae(n,o,s),p=u[0],m=u[1],h=Mg(["react-colorful",t]);return H.createElement("div",Eg({},i,{ref:l,className:h}),H.createElement(yae,{hsva:p,onChange:m}),H.createElement(bae,{hue:p.h,onChange:m}),H.createElement(jae,{hsva:p,onChange:m,className:"react-colorful__last-control"}))},Iae={defaultColor:{r:0,g:0,b:0,a:1},toHsva:xae,fromHsva:vae,equal:yO},CO=function(e){return H.createElement(_ae,Eg({},e,{colorModel:Iae}))};const Pae=e=>{const{nodeId:t,field:n}=e,r=te(),o=d.useCallback(s=>{r(oA({nodeId:t,fieldName:n.name,value:s}))},[r,n.name,t]);return a.jsx(CO,{className:"nodrag",color:n.value,onChange:o})},Eae=d.memo(Pae),wO=e=>{const t=el("models"),[n,r,o]=e.split("/"),s=sA.safeParse({base_model:n,model_name:o});if(!s.success){t.error({controlNetModelId:e,errors:s.error.format()},"Failed to parse ControlNet model id");return}return s.data},Mae=e=>{const{nodeId:t,field:n}=e,r=n.value,o=te(),{data:s}=gh(),i=d.useMemo(()=>(s==null?void 0:s.entities[`${r==null?void 0:r.base_model}/controlnet/${r==null?void 0:r.model_name}`])??null,[r==null?void 0:r.base_model,r==null?void 0:r.model_name,s==null?void 0:s.entities]),l=d.useMemo(()=>{if(!s)return[];const p=[];return $n(s.entities,(m,h)=>{m&&p.push({value:h,label:m.model_name,group:mn[m.base_model]})}),p},[s]),u=d.useCallback(p=>{if(!p)return;const m=wO(p);m&&o(aA({nodeId:t,fieldName:n.name,value:m}))},[o,n.name,t]);return a.jsx(On,{className:"nowheel nodrag",tooltip:i==null?void 0:i.description,value:(i==null?void 0:i.id)??null,placeholder:"Pick one",error:!i,data:l,onChange:u,sx:{width:"100%"}})},Oae=d.memo(Mae),Rae=e=>{const{nodeId:t,field:n,fieldTemplate:r}=e,o=te(),s=d.useCallback(i=>{o(iA({nodeId:t,fieldName:n.name,value:i.target.value}))},[o,n.name,t]);return a.jsx(Q3,{className:"nowheel nodrag",onChange:s,value:n.value,children:r.options.map(i=>a.jsx("option",{value:i,children:r.ui_choice_labels?r.ui_choice_labels[i]:i},i))})},Dae=d.memo(Rae),Aae=e=>{var p;const{nodeId:t,field:n}=e,r=te(),{currentData:o}=to(((p=n.value)==null?void 0:p.image_name)??$r.skipToken),s=d.useCallback(()=>{r(lA({nodeId:t,fieldName:n.name,value:void 0}))},[r,n.name,t]),i=d.useMemo(()=>{if(o)return{id:`node-${t}-${n.name}`,payloadType:"IMAGE_DTO",payload:{imageDTO:o}}},[n.name,o,t]),l=d.useMemo(()=>({id:`node-${t}-${n.name}`,actionType:"SET_NODES_IMAGE",context:{nodeId:t,fieldName:n.name}}),[n.name,t]),u=d.useMemo(()=>({type:"SET_NODES_IMAGE",nodeId:t,fieldName:n.name}),[t,n.name]);return a.jsx(L,{className:"nodrag",sx:{w:"full",h:"full",alignItems:"center",justifyContent:"center"},children:a.jsx(ua,{imageDTO:o,droppableData:l,draggableData:i,postUploadAction:u,useThumbailFallback:!0,uploadElement:a.jsx(SO,{}),dropLabel:a.jsx(kO,{}),minSize:8,children:a.jsx(Li,{onClick:s,icon:o?a.jsx(Ud,{}):void 0,tooltip:"Reset Image"})})})},Tae=d.memo(Aae),SO=d.memo(()=>a.jsx(ve,{fontSize:16,fontWeight:600,children:"Drop or Upload"}));SO.displayName="UploadElement";const kO=d.memo(()=>a.jsx(ve,{fontSize:16,fontWeight:600,children:"Drop"}));kO.displayName="DropLabel";const Nae=e=>{const t=el("models"),[n,r,o]=e.split("/"),s=cA.safeParse({base_model:n,model_name:o});if(!s.success){t.error({loraModelId:e,errors:s.error.format()},"Failed to parse LoRA model id");return}return s.data},$ae=e=>{const{nodeId:t,field:n}=e,r=n.value,o=te(),{data:s}=Cd(),{t:i}=Z(),l=d.useMemo(()=>{if(!s)return[];const m=[];return $n(s.entities,(h,g)=>{h&&m.push({value:g,label:h.model_name,group:mn[h.base_model]})}),m.sort((h,g)=>h.disabled&&!g.disabled?1:-1)},[s]),u=d.useMemo(()=>(s==null?void 0:s.entities[`${r==null?void 0:r.base_model}/lora/${r==null?void 0:r.model_name}`])??null,[s==null?void 0:s.entities,r==null?void 0:r.base_model,r==null?void 0:r.model_name]),p=d.useCallback(m=>{if(!m)return;const h=Nae(m);h&&o(uA({nodeId:t,fieldName:n.name,value:h}))},[o,n.name,t]);return(s==null?void 0:s.ids.length)===0?a.jsx(L,{sx:{justifyContent:"center",p:2},children:a.jsx(ve,{sx:{fontSize:"sm",color:"base.500",_dark:"base.700"},children:"No LoRAs Loaded"})}):a.jsx(nn,{className:"nowheel nodrag",value:(u==null?void 0:u.id)??null,placeholder:l.length>0?i("models.selectLoRA"):i("models.noLoRAsAvailable"),data:l,nothingFound:i("models.noMatchingLoRAs"),itemComponent:ci,disabled:l.length===0,filter:(m,h)=>{var g;return((g=h.label)==null?void 0:g.toLowerCase().includes(m.toLowerCase().trim()))||h.value.toLowerCase().includes(m.toLowerCase().trim())},error:!u,onChange:p,sx:{width:"100%",".mantine-Select-dropdown":{width:"16rem !important"}}})},Lae=d.memo($ae),Og=e=>{const t=el("models"),[n,r,o]=e.split("/"),s=dA.safeParse({base_model:n,model_name:o,model_type:r});if(!s.success){t.error({mainModelId:e,errors:s.error.format()},"Failed to parse main model id");return}return s.data};function Gc(e){const{iconMode:t=!1,...n}=e,r=te(),{t:o}=Z(),[s,{isLoading:i}]=fA(),l=()=>{s().unwrap().then(u=>{r(ct(Qt({title:`${o("modelManager.modelsSynced")}`,status:"success"})))}).catch(u=>{u&&r(ct(Qt({title:`${o("modelManager.modelSyncFailed")}`,status:"error"})))})};return t?a.jsx(Fe,{icon:a.jsx(bM,{}),tooltip:o("modelManager.syncModels"),"aria-label":o("modelManager.syncModels"),isLoading:i,onClick:l,size:"sm",...n}):a.jsx(at,{isLoading:i,onClick:l,minW:"max-content",...n,children:"Sync Models"})}const zae=e=>{var y,b;const{nodeId:t,field:n}=e,r=te(),o=Bt("syncModels").isFeatureEnabled,{t:s}=Z(),{data:i,isLoading:l}=Ku(gw),{data:u,isLoading:p}=Xo(gw),m=d.useMemo(()=>l||p,[l,p]),h=d.useMemo(()=>{if(!u)return[];const w=[];return $n(u.entities,(S,j)=>{S&&w.push({value:j,label:S.model_name,group:mn[S.base_model]})}),i&&$n(i.entities,(S,j)=>{S&&w.push({value:j,label:S.model_name,group:mn[S.base_model]})}),w},[u,i]),g=d.useMemo(()=>{var w,S,j,_;return((u==null?void 0:u.entities[`${(w=n.value)==null?void 0:w.base_model}/main/${(S=n.value)==null?void 0:S.model_name}`])||(i==null?void 0:i.entities[`${(j=n.value)==null?void 0:j.base_model}/onnx/${(_=n.value)==null?void 0:_.model_name}`]))??null},[(y=n.value)==null?void 0:y.base_model,(b=n.value)==null?void 0:b.model_name,u==null?void 0:u.entities,i==null?void 0:i.entities]),x=d.useCallback(w=>{if(!w)return;const S=Og(w);S&&r(kI({nodeId:t,fieldName:n.name,value:S}))},[r,n.name,t]);return a.jsxs(L,{sx:{w:"full",alignItems:"center",gap:2},children:[m?a.jsx(ve,{variant:"subtext",children:"Loading..."}):a.jsx(nn,{className:"nowheel nodrag",tooltip:g==null?void 0:g.description,value:g==null?void 0:g.id,placeholder:h.length>0?s("models.selectModel"):s("models.noModelsAvailable"),data:h,error:!g,disabled:h.length===0,onChange:x,sx:{width:"100%",".mantine-Select-dropdown":{width:"16rem !important"}}}),o&&a.jsx(Gc,{className:"nodrag",iconMode:!0})]})},Fae=d.memo(zae),ch=/^-?(0\.)?\.?$/,jO=ke((e,t)=>{const{label:n,isDisabled:r=!1,showStepper:o=!0,isInvalid:s,value:i,onChange:l,min:u,max:p,isInteger:m=!0,formControlProps:h,formLabelProps:g,numberInputFieldProps:x,numberInputStepperProps:y,tooltipProps:b,...w}=e,S=te(),[j,_]=d.useState(String(i));d.useEffect(()=>{!j.match(ch)&&i!==Number(j)&&_(String(i))},[i,j]);const E=D=>{_(D),D.match(ch)||l(m?Math.floor(Number(D)):Number(D))},I=D=>{const A=Fi(m?Math.floor(Number(D.target.value)):Number(D.target.value),u,p);_(String(A)),l(A)},M=d.useCallback(D=>{D.shiftKey&&S(Nr(!0))},[S]),R=d.useCallback(D=>{D.shiftKey||S(Nr(!1))},[S]);return a.jsx(Ht,{...b,children:a.jsxs(Kt,{ref:t,isDisabled:r,isInvalid:s,...h,children:[n&&a.jsx(wn,{...g,children:n}),a.jsxs(Lh,{value:j,min:u,max:p,keepWithinRange:!0,clampValueOnBlur:!1,onChange:E,onBlur:I,...w,onPaste:e2,children:[a.jsx(Fh,{...x,onKeyDown:M,onKeyUp:R}),o&&a.jsxs(zh,{children:[a.jsx(Hh,{...y}),a.jsx(Bh,{...y})]})]})]})})});jO.displayName="IAINumberInput";const Kc=d.memo(jO),Bae=e=>{const{nodeId:t,field:n,fieldTemplate:r}=e,o=te(),[s,i]=d.useState(String(n.value)),l=d.useMemo(()=>r.type==="integer",[r.type]),u=p=>{i(p),p.match(ch)||o(pA({nodeId:t,fieldName:n.name,value:l?Math.floor(Number(p)):Number(p)}))};return d.useEffect(()=>{!s.match(ch)&&n.value!==Number(s)&&i(String(n.value))},[n.value,s]),a.jsxs(Lh,{onChange:u,value:s,step:l?1:.1,precision:l?0:3,children:[a.jsx(Fh,{className:"nodrag"}),a.jsxs(zh,{children:[a.jsx(Hh,{}),a.jsx(Bh,{})]})]})},Hae=d.memo(Bae),Vae=e=>{var h,g;const{nodeId:t,field:n}=e,r=te(),{t:o}=Z(),s=Bt("syncModels").isFeatureEnabled,{data:i,isLoading:l}=Xo(nb),u=d.useMemo(()=>{if(!i)return[];const x=[];return $n(i.entities,(y,b)=>{y&&x.push({value:b,label:y.model_name,group:mn[y.base_model]})}),x},[i]),p=d.useMemo(()=>{var x,y;return(i==null?void 0:i.entities[`${(x=n.value)==null?void 0:x.base_model}/main/${(y=n.value)==null?void 0:y.model_name}`])??null},[(h=n.value)==null?void 0:h.base_model,(g=n.value)==null?void 0:g.model_name,i==null?void 0:i.entities]),m=d.useCallback(x=>{if(!x)return;const y=Og(x);y&&r(mA({nodeId:t,fieldName:n.name,value:y}))},[r,n.name,t]);return l?a.jsx(nn,{label:o("modelManager.model"),placeholder:o("models.loading"),disabled:!0,data:[]}):a.jsxs(L,{w:"100%",alignItems:"center",gap:2,children:[a.jsx(nn,{className:"nowheel nodrag",tooltip:p==null?void 0:p.description,value:p==null?void 0:p.id,placeholder:u.length>0?o("models.selectModel"):o("models.noModelsAvailable"),data:u,error:!p,disabled:u.length===0,onChange:m,sx:{width:"100%",".mantine-Select-dropdown":{width:"16rem !important"}}}),s&&a.jsx(Gc,{className:"nodrag",iconMode:!0})]})},Wae=d.memo(Vae),Uae=e=>{var g,x;const{nodeId:t,field:n}=e,r=te(),{t:o}=Z(),s=Bt("syncModels").isFeatureEnabled,{data:i}=Ku(vw),{data:l,isLoading:u}=Xo(vw),p=d.useMemo(()=>{if(!l)return[];const y=[];return $n(l.entities,(b,w)=>{!b||b.base_model!=="sdxl"||y.push({value:w,label:b.model_name,group:mn[b.base_model]})}),i&&$n(i.entities,(b,w)=>{!b||b.base_model!=="sdxl"||y.push({value:w,label:b.model_name,group:mn[b.base_model]})}),y},[l,i]),m=d.useMemo(()=>{var y,b,w,S;return((l==null?void 0:l.entities[`${(y=n.value)==null?void 0:y.base_model}/main/${(b=n.value)==null?void 0:b.model_name}`])||(i==null?void 0:i.entities[`${(w=n.value)==null?void 0:w.base_model}/onnx/${(S=n.value)==null?void 0:S.model_name}`]))??null},[(g=n.value)==null?void 0:g.base_model,(x=n.value)==null?void 0:x.model_name,l==null?void 0:l.entities,i==null?void 0:i.entities]),h=d.useCallback(y=>{if(!y)return;const b=Og(y);b&&r(kI({nodeId:t,fieldName:n.name,value:b}))},[r,n.name,t]);return u?a.jsx(nn,{label:o("modelManager.model"),placeholder:o("models.loading"),disabled:!0,data:[]}):a.jsxs(L,{w:"100%",alignItems:"center",gap:2,children:[a.jsx(nn,{className:"nowheel nodrag",tooltip:m==null?void 0:m.description,value:m==null?void 0:m.id,placeholder:p.length>0?o("models.selectModel"):o("models.noModelsAvailable"),data:p,error:!m,disabled:p.length===0,onChange:h,sx:{width:"100%",".mantine-Select-dropdown":{width:"16rem !important"}}}),s&&a.jsx(Gc,{className:"nodrag",iconMode:!0})]})},Gae=d.memo(Uae),Kae=ce([xe],({ui:e})=>{const{favoriteSchedulers:t}=e;return{data:nr(mh,(r,o)=>({value:o,label:r,group:t.includes(o)?"Favorites":void 0})).sort((r,o)=>r.label.localeCompare(o.label))}},je),qae=e=>{const{nodeId:t,field:n}=e,r=te(),{data:o}=W(Kae),s=d.useCallback(i=>{i&&r(hA({nodeId:t,fieldName:n.name,value:i}))},[r,n.name,t]);return a.jsx(nn,{className:"nowheel nodrag",value:n.value,data:o,onChange:s})},Xae=d.memo(qae),Qae=e=>{const{nodeId:t,field:n,fieldTemplate:r}=e,o=te(),s=d.useCallback(i=>{o(gA({nodeId:t,fieldName:n.name,value:i.target.value}))},[o,n.name,t]);return r.ui_component==="textarea"?a.jsx(da,{className:"nodrag",onChange:s,value:n.value,rows:5,resize:"none"}):a.jsx(vo,{onChange:s,value:n.value})},Yae=d.memo(Qae),_O=e=>{const t=el("models"),[n,r,o]=e.split("/"),s=vA.safeParse({base_model:n,model_name:o});if(!s.success){t.error({vaeModelId:e,errors:s.error.format()},"Failed to parse VAE model id");return}return s.data},Zae=e=>{const{nodeId:t,field:n}=e,r=n.value,o=te(),{data:s}=jI(),i=d.useMemo(()=>{if(!s)return[];const p=[{value:"default",label:"Default",group:"Default"}];return $n(s.entities,(m,h)=>{m&&p.push({value:h,label:m.model_name,group:mn[m.base_model]})}),p.sort((m,h)=>m.disabled&&!h.disabled?1:-1)},[s]),l=d.useMemo(()=>(s==null?void 0:s.entities[`${r==null?void 0:r.base_model}/vae/${r==null?void 0:r.model_name}`])??null,[s==null?void 0:s.entities,r]),u=d.useCallback(p=>{if(!p)return;const m=_O(p);m&&o(xA({nodeId:t,fieldName:n.name,value:m}))},[o,n.name,t]);return a.jsx(nn,{className:"nowheel nodrag",itemComponent:ci,tooltip:l==null?void 0:l.description,value:(l==null?void 0:l.id)??"default",placeholder:"Default",data:i,onChange:u,disabled:i.length===0,error:!l,clearable:!0,sx:{width:"100%",".mantine-Select-dropdown":{width:"16rem !important"}}})},Jae=d.memo(Zae),IO=e=>{const t=el("models"),[n,r,o]=e.split("/"),s=bA.safeParse({base_model:n,model_name:o});if(!s.success){t.error({ipAdapterModelId:e,errors:s.error.format()},"Failed to parse IP-Adapter model id");return}return s.data},eie=e=>{const{nodeId:t,field:n}=e,r=n.value,o=te(),{data:s}=Vx(),i=d.useMemo(()=>(s==null?void 0:s.entities[`${r==null?void 0:r.base_model}/ip_adapter/${r==null?void 0:r.model_name}`])??null,[r==null?void 0:r.base_model,r==null?void 0:r.model_name,s==null?void 0:s.entities]),l=d.useMemo(()=>{if(!s)return[];const p=[];return $n(s.entities,(m,h)=>{m&&p.push({value:h,label:m.model_name,group:mn[m.base_model]})}),p},[s]),u=d.useCallback(p=>{if(!p)return;const m=IO(p);m&&o(yA({nodeId:t,fieldName:n.name,value:m}))},[o,n.name,t]);return a.jsx(On,{className:"nowheel nodrag",tooltip:i==null?void 0:i.description,value:(i==null?void 0:i.id)??null,placeholder:"Pick one",error:!i,data:l,onChange:u,sx:{width:"100%"}})},tie=d.memo(eie),nie=e=>{var l;const{nodeId:t,field:n}=e,r=te(),{data:o,hasBoards:s}=yd(void 0,{selectFromResult:({data:u})=>{const p=[{label:"None",value:"none"}];return u==null||u.forEach(({board_id:m,board_name:h})=>{p.push({label:h,value:m})}),{data:p,hasBoards:p.length>1}}}),i=d.useCallback(u=>{r(CA({nodeId:t,fieldName:n.name,value:u&&u!=="none"?{board_id:u}:void 0}))},[r,n.name,t]);return a.jsx(nn,{className:"nowheel nodrag",value:((l=n.value)==null?void 0:l.board_id)??"none",data:o,onChange:i,disabled:!s})},rie=d.memo(nie),oie=({nodeId:e,fieldName:t})=>{const n=hO(e,t),r=Pg(e,t,"input");return(r==null?void 0:r.fieldKind)==="output"?a.jsxs(Ie,{p:2,children:["Output field in input: ",n==null?void 0:n.type]}):(n==null?void 0:n.type)==="string"&&(r==null?void 0:r.type)==="string"||(n==null?void 0:n.type)==="StringPolymorphic"&&(r==null?void 0:r.type)==="StringPolymorphic"?a.jsx(Yae,{nodeId:e,field:n,fieldTemplate:r}):(n==null?void 0:n.type)==="boolean"&&(r==null?void 0:r.type)==="boolean"||(n==null?void 0:n.type)==="BooleanPolymorphic"&&(r==null?void 0:r.type)==="BooleanPolymorphic"?a.jsx(gae,{nodeId:e,field:n,fieldTemplate:r}):(n==null?void 0:n.type)==="integer"&&(r==null?void 0:r.type)==="integer"||(n==null?void 0:n.type)==="float"&&(r==null?void 0:r.type)==="float"||(n==null?void 0:n.type)==="FloatPolymorphic"&&(r==null?void 0:r.type)==="FloatPolymorphic"||(n==null?void 0:n.type)==="IntegerPolymorphic"&&(r==null?void 0:r.type)==="IntegerPolymorphic"?a.jsx(Hae,{nodeId:e,field:n,fieldTemplate:r}):(n==null?void 0:n.type)==="enum"&&(r==null?void 0:r.type)==="enum"?a.jsx(Dae,{nodeId:e,field:n,fieldTemplate:r}):(n==null?void 0:n.type)==="ImageField"&&(r==null?void 0:r.type)==="ImageField"||(n==null?void 0:n.type)==="ImagePolymorphic"&&(r==null?void 0:r.type)==="ImagePolymorphic"?a.jsx(Tae,{nodeId:e,field:n,fieldTemplate:r}):(n==null?void 0:n.type)==="BoardField"&&(r==null?void 0:r.type)==="BoardField"?a.jsx(rie,{nodeId:e,field:n,fieldTemplate:r}):(n==null?void 0:n.type)==="MainModelField"&&(r==null?void 0:r.type)==="MainModelField"?a.jsx(Fae,{nodeId:e,field:n,fieldTemplate:r}):(n==null?void 0:n.type)==="SDXLRefinerModelField"&&(r==null?void 0:r.type)==="SDXLRefinerModelField"?a.jsx(Wae,{nodeId:e,field:n,fieldTemplate:r}):(n==null?void 0:n.type)==="VaeModelField"&&(r==null?void 0:r.type)==="VaeModelField"?a.jsx(Jae,{nodeId:e,field:n,fieldTemplate:r}):(n==null?void 0:n.type)==="LoRAModelField"&&(r==null?void 0:r.type)==="LoRAModelField"?a.jsx(Lae,{nodeId:e,field:n,fieldTemplate:r}):(n==null?void 0:n.type)==="ControlNetModelField"&&(r==null?void 0:r.type)==="ControlNetModelField"?a.jsx(Oae,{nodeId:e,field:n,fieldTemplate:r}):(n==null?void 0:n.type)==="IPAdapterModelField"&&(r==null?void 0:r.type)==="IPAdapterModelField"?a.jsx(tie,{nodeId:e,field:n,fieldTemplate:r}):(n==null?void 0:n.type)==="ColorField"&&(r==null?void 0:r.type)==="ColorField"?a.jsx(Eae,{nodeId:e,field:n,fieldTemplate:r}):(n==null?void 0:n.type)==="SDXLMainModelField"&&(r==null?void 0:r.type)==="SDXLMainModelField"?a.jsx(Gae,{nodeId:e,field:n,fieldTemplate:r}):(n==null?void 0:n.type)==="Scheduler"&&(r==null?void 0:r.type)==="Scheduler"?a.jsx(Xae,{nodeId:e,field:n,fieldTemplate:r}):n&&r?null:a.jsx(Ie,{p:1,children:a.jsxs(ve,{sx:{fontSize:"sm",fontWeight:600,color:"error.400",_dark:{color:"error.300"}},children:["Unknown field type: ",n==null?void 0:n.type]})})},PO=d.memo(oie),sie=({nodeId:e,fieldName:t})=>{const n=te(),{isMouseOverNode:r,handleMouseOut:o,handleMouseOver:s}=fO(e),{t:i}=Z(),l=d.useCallback(()=>{n(_I({nodeId:e,fieldName:t}))},[n,t,e]);return a.jsxs(L,{onMouseEnter:s,onMouseLeave:o,layerStyle:"second",sx:{position:"relative",borderRadius:"base",w:"full",p:2},children:[a.jsxs(Kt,{as:L,sx:{flexDir:"column",gap:1,flexShrink:1},children:[a.jsxs(wn,{sx:{display:"flex",alignItems:"center",mb:0},children:[a.jsx(gO,{nodeId:e,fieldName:t,kind:"input"}),a.jsx(ba,{}),a.jsx(Ht,{label:a.jsx(t2,{nodeId:e,fieldName:t,kind:"input"}),openDelay:yh,placement:"top",hasArrow:!0,children:a.jsx(L,{h:"full",alignItems:"center",children:a.jsx(Tn,{as:fM})})}),a.jsx(Fe,{"aria-label":i("nodes.removeLinearView"),tooltip:i("nodes.removeLinearView"),variant:"ghost",size:"sm",onClick:l,icon:a.jsx(Br,{})})]}),a.jsx(PO,{nodeId:e,fieldName:t})]}),a.jsx(dO,{isSelected:!1,isHovered:r})]})},aie=d.memo(sie),iie=ce(xe,({nodes:e})=>({fields:e.workflow.exposedFields}),je),lie=()=>{const{fields:e}=W(iie),{t}=Z();return a.jsx(Ie,{sx:{position:"relative",w:"full",h:"full"},children:a.jsx(Zd,{children:a.jsx(L,{sx:{position:"relative",flexDir:"column",alignItems:"flex-start",p:1,gap:2,h:"full",w:"full"},children:e.length?e.map(({nodeId:n,fieldName:r})=>a.jsx(aie,{nodeId:n,fieldName:r},`${n}.${r}`)):a.jsx(Zn,{label:t("nodes.noFieldsLinearview"),icon:null})})})})},cie=d.memo(lie),uie=()=>a.jsx(L,{layerStyle:"first",sx:{flexDir:"column",w:"full",h:"full",borderRadius:"base",p:2,gap:2},children:a.jsxs(rl,{variant:"line",sx:{display:"flex",flexDir:"column",w:"full",h:"full"},children:[a.jsxs(ol,{children:[a.jsx(Tr,{children:"Linear"}),a.jsx(Tr,{children:"Details"}),a.jsx(Tr,{children:"JSON"})]}),a.jsxs(zc,{children:[a.jsx(So,{children:a.jsx(cie,{})}),a.jsx(So,{children:a.jsx(aae,{})}),a.jsx(So,{children:a.jsx(dae,{})})]})]})}),die=d.memo(uie),fie={paramNegativeConditioning:{placement:"right"},controlNet:{href:"https://support.invoke.ai/support/solutions/articles/151000105880"},lora:{href:"https://support.invoke.ai/support/solutions/articles/151000159072"},compositingCoherenceMode:{href:"https://support.invoke.ai/support/solutions/articles/151000158838"},infillMethod:{href:"https://support.invoke.ai/support/solutions/articles/151000158841"},scaleBeforeProcessing:{href:"https://support.invoke.ai/support/solutions/articles/151000158841"},paramIterations:{href:"https://support.invoke.ai/support/solutions/articles/151000159073"},paramPositiveConditioning:{href:"https://support.invoke.ai/support/solutions/articles/151000096606-tips-on-crafting-prompts",placement:"right"},paramScheduler:{placement:"right",href:"https://support.invoke.ai/support/solutions/articles/151000159073"},paramModel:{placement:"right",href:"https://support.invoke.ai/support/solutions/articles/151000096601-what-is-a-model-which-should-i-use-"},paramRatio:{gutter:16},controlNetControlMode:{placement:"right"},controlNetResizeMode:{placement:"right"},paramVAE:{placement:"right"},paramVAEPrecision:{placement:"right"}},pie=1e3,mie=[{name:"preventOverflow",options:{padding:10}}],EO=ke(({feature:e,children:t,wrapperProps:n,...r},o)=>{const{t:s}=Z(),i=W(g=>g.system.shouldEnableInformationalPopovers),l=d.useMemo(()=>fie[e],[e]),u=d.useMemo(()=>wA(SA(l,["image","href","buttonLabel"]),r),[l,r]),p=d.useMemo(()=>s(`popovers.${e}.heading`),[e,s]),m=d.useMemo(()=>s(`popovers.${e}.paragraphs`,{returnObjects:!0})??[],[e,s]),h=d.useCallback(()=>{l!=null&&l.href&&window.open(l.href)},[l==null?void 0:l.href]);return i?a.jsxs(Ld,{isLazy:!0,closeOnBlur:!1,trigger:"hover",variant:"informational",openDelay:pie,modifiers:mie,placement:"top",...u,children:[a.jsx(Wh,{children:a.jsx(Ie,{ref:o,w:"full",...n,children:t})}),a.jsx(Ac,{children:a.jsxs(zd,{w:96,children:[a.jsx(V3,{}),a.jsx(Uh,{children:a.jsxs(L,{sx:{gap:2,flexDirection:"column",alignItems:"flex-start"},children:[p&&a.jsxs(a.Fragment,{children:[a.jsx(cr,{size:"sm",children:p}),a.jsx(Yn,{})]}),(l==null?void 0:l.image)&&a.jsxs(a.Fragment,{children:[a.jsx(ga,{sx:{objectFit:"contain",maxW:"60%",maxH:"60%",backgroundColor:"white"},src:l.image,alt:"Optional Image"}),a.jsx(Yn,{})]}),m.map(g=>a.jsx(ve,{children:g},g)),(l==null?void 0:l.href)&&a.jsxs(a.Fragment,{children:[a.jsx(Yn,{}),a.jsx(Za,{pt:1,onClick:h,leftIcon:a.jsx(py,{}),alignSelf:"flex-end",variant:"link",children:s("common.learnMore")??p})]})]})})]})})]}):a.jsx(Ie,{ref:o,w:"full",...n,children:t})});EO.displayName="IAIInformationalPopover";const Et=d.memo(EO),hie=ce([xe],e=>{const{initial:t,min:n,sliderMax:r,inputMax:o,fineStep:s,coarseStep:i}=e.config.sd.iterations,{iterations:l}=e.generation,{shouldUseSliders:u}=e.ui,p=e.hotkeys.shift?s:i;return{iterations:l,initial:t,min:n,sliderMax:r,inputMax:o,step:p,shouldUseSliders:u}},je),gie=({asSlider:e})=>{const{iterations:t,initial:n,min:r,sliderMax:o,inputMax:s,step:i,shouldUseSliders:l}=W(hie),u=te(),{t:p}=Z(),m=d.useCallback(g=>{u(xw(g))},[u]),h=d.useCallback(()=>{u(xw(n))},[u,n]);return e||l?a.jsx(Et,{feature:"paramIterations",children:a.jsx(tt,{label:p("parameters.iterations"),step:i,min:r,max:o,onChange:m,handleReset:h,value:t,withInput:!0,withReset:!0,withSliderMarks:!0,sliderNumberInputProps:{max:s}})}):a.jsx(Et,{feature:"paramIterations",children:a.jsx(Kc,{label:p("parameters.iterations"),step:i,min:r,max:s,onChange:m,value:t,numberInputFieldProps:{textAlign:"center"}})})},rs=d.memo(gie),vie=()=>{const[e,t]=d.useState(!1),[n,r]=d.useState(!1),o=d.useRef(null),s=Jy(),i=d.useCallback(()=>{o.current&&o.current.setLayout([50,50])},[]);return a.jsxs(L,{sx:{flexDir:"column",gap:2,height:"100%",width:"100%"},children:[a.jsx(Q8,{}),a.jsx(L,{layerStyle:"first",sx:{w:"full",position:"relative",borderRadius:"base",p:2,pb:3,gap:2,flexDir:"column"},children:a.jsx(rs,{asSlider:!0})}),a.jsxs(Ig,{ref:o,id:"workflow-panel-group",autoSaveId:"workflow-panel-group",direction:"vertical",style:{height:"100%",width:"100%"},storage:s,children:[a.jsx(Qa,{id:"workflow",collapsible:!0,onCollapse:t,minSize:25,children:a.jsx(die,{})}),a.jsx(lh,{direction:"vertical",onDoubleClick:i,collapsedDirection:e?"top":n?"bottom":void 0}),a.jsx(Qa,{id:"inspector",collapsible:!0,onCollapse:r,minSize:25,children:a.jsx(eae,{})})]})]})},xie=d.memo(vie),Zj=(e,t)=>{const n=d.useRef(null),[r,o]=d.useState(()=>{var p;return!!((p=n.current)!=null&&p.getCollapsed())}),s=d.useCallback(()=>{var p;(p=n.current)!=null&&p.getCollapsed()?qr.flushSync(()=>{var m;(m=n.current)==null||m.expand()}):qr.flushSync(()=>{var m;(m=n.current)==null||m.collapse()})},[]),i=d.useCallback(()=>{qr.flushSync(()=>{var p;(p=n.current)==null||p.expand()})},[]),l=d.useCallback(()=>{qr.flushSync(()=>{var p;(p=n.current)==null||p.collapse()})},[]),u=d.useCallback(()=>{qr.flushSync(()=>{var p;(p=n.current)==null||p.resize(e,t)})},[e,t]);return{ref:n,minSize:e,isCollapsed:r,setIsCollapsed:o,reset:u,toggle:s,expand:i,collapse:l}},bie=({isGalleryCollapsed:e,galleryPanelRef:t})=>{const{t:n}=Z(),r=()=>{var o;(o=t.current)==null||o.expand()};return e?a.jsx(Ac,{children:a.jsx(L,{pos:"absolute",transform:"translate(0, -50%)",minW:8,top:"50%",insetInlineEnd:"1.63rem",children:a.jsx(Fe,{tooltip:"Show Gallery (G)",tooltipProps:{placement:"top"},"aria-label":n("accessibility.showGalleryPanel"),onClick:r,icon:a.jsx(Soe,{}),sx:{p:0,px:3,h:48,borderEndRadius:0}})})}):null},yie=d.memo(bie),Op={borderStartRadius:0,flexGrow:1},Cie=({isSidePanelCollapsed:e,sidePanelRef:t})=>{const{t:n}=Z(),r=()=>{var o;(o=t.current)==null||o.expand()};return e?a.jsx(Ac,{children:a.jsxs(L,{pos:"absolute",transform:"translate(0, -50%)",minW:8,top:"50%",insetInlineStart:"5.13rem",direction:"column",gap:2,h:48,children:[a.jsxs(Vt,{isAttached:!0,orientation:"vertical",flexGrow:3,children:[a.jsx(Fe,{tooltip:n("parameters.showOptionsPanel"),"aria-label":n("parameters.showOptionsPanel"),onClick:r,sx:Op,icon:a.jsx(xM,{})}),a.jsx(K8,{asIconButton:!0,sx:Op}),a.jsx(H8,{asIconButton:!0,sx:Op})]}),a.jsx(qy,{asIconButton:!0,sx:Op})]})}):null},wie=d.memo(Cie),Sie=e=>{const{label:t,activeLabel:n,children:r,defaultIsOpen:o=!1}=e,{isOpen:s,onToggle:i}=Lr({defaultIsOpen:o}),{colorMode:l}=ha();return a.jsxs(Ie,{children:[a.jsxs(L,{onClick:i,sx:{alignItems:"center",p:2,px:4,gap:2,borderTopRadius:"base",borderBottomRadius:s?0:"base",bg:Ae("base.250","base.750")(l),color:Ae("base.900","base.100")(l),_hover:{bg:Ae("base.300","base.700")(l)},fontSize:"sm",fontWeight:600,cursor:"pointer",transitionProperty:"common",transitionDuration:"normal",userSelect:"none"},"data-testid":`${t} collapsible`,children:[t,a.jsx(dr,{children:n&&a.jsx(In.div,{initial:{opacity:0},animate:{opacity:1,transition:{duration:.1}},exit:{opacity:0,transition:{duration:.1}},children:a.jsx(ve,{sx:{color:"accent.500",_dark:{color:"accent.300"}},children:n})},"statusText")}),a.jsx(ba,{}),a.jsx(gg,{sx:{w:"1rem",h:"1rem",transform:s?"rotate(0deg)":"rotate(180deg)",transitionProperty:"common",transitionDuration:"normal"}})]}),a.jsx(Id,{in:s,animateOpacity:!0,style:{overflow:"unset"},children:a.jsx(Ie,{sx:{p:4,pb:4,borderBottomRadius:"base",bg:"base.150",_dark:{bg:"base.800"}},children:r})})]})},oo=d.memo(Sie),kie=ce(xe,e=>{const{maxPrompts:t,combinatorial:n}=e.dynamicPrompts,{min:r,sliderMax:o,inputMax:s}=e.config.sd.dynamicPrompts.maxPrompts;return{maxPrompts:t,min:r,sliderMax:o,inputMax:s,isDisabled:!n}},je),jie=()=>{const{maxPrompts:e,min:t,sliderMax:n,inputMax:r,isDisabled:o}=W(kie),s=te(),{t:i}=Z(),l=d.useCallback(p=>{s(kA(p))},[s]),u=d.useCallback(()=>{s(jA())},[s]);return a.jsx(Et,{feature:"dynamicPromptsMaxPrompts",children:a.jsx(tt,{label:i("dynamicPrompts.maxPrompts"),isDisabled:o,min:t,max:n,value:e,onChange:l,sliderNumberInputProps:{max:r},withSliderMarks:!0,withInput:!0,withReset:!0,handleReset:u})})},_ie=d.memo(jie),Iie=ce(xe,e=>{const{isLoading:t,isError:n,prompts:r,parsingError:o}=e.dynamicPrompts;return{prompts:r,parsingError:o,isError:n,isLoading:t}},je),Pie={"&::marker":{color:"base.500",_dark:{color:"base.500"}}},Eie=()=>{const{prompts:e,parsingError:t,isLoading:n,isError:r}=W(Iie);return r?a.jsx(Et,{feature:"dynamicPrompts",children:a.jsx(L,{w:"full",h:"full",layerStyle:"second",alignItems:"center",justifyContent:"center",p:8,children:a.jsx(Zn,{icon:voe,label:"Problem generating prompts"})})}):a.jsx(Et,{feature:"dynamicPrompts",children:a.jsxs(Kt,{isInvalid:!!t,children:[a.jsxs(wn,{whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",children:["Prompts Preview (",e.length,")",t&&` - ${t}`]}),a.jsxs(L,{h:64,pos:"relative",layerStyle:"third",borderRadius:"base",p:2,children:[a.jsx(Zd,{children:a.jsx(d3,{stylePosition:"inside",ms:0,children:e.map((o,s)=>a.jsx(Qr,{fontSize:"sm",sx:Pie,children:a.jsx(ve,{as:"span",children:o})},`${o}.${s}`))})}),n&&a.jsx(L,{pos:"absolute",w:"full",h:"full",top:0,insetInlineStart:0,layerStyle:"second",opacity:.7,alignItems:"center",justifyContent:"center",children:a.jsx(fa,{})})]})]})})},Mie=d.memo(Eie),MO=d.forwardRef(({label:e,description:t,...n},r)=>a.jsx(Ie,{ref:r,...n,children:a.jsxs(Ie,{children:[a.jsx(ve,{fontWeight:600,children:e}),t&&a.jsx(ve,{size:"xs",variant:"subtext",children:t})]})}));MO.displayName="IAIMantineSelectItemWithDescription";const Oie=d.memo(MO),Rie=()=>{const e=te(),{t}=Z(),n=W(s=>s.dynamicPrompts.seedBehaviour),r=d.useMemo(()=>[{value:"PER_ITERATION",label:t("dynamicPrompts.seedBehaviour.perIterationLabel"),description:t("dynamicPrompts.seedBehaviour.perIterationDesc")},{value:"PER_PROMPT",label:t("dynamicPrompts.seedBehaviour.perPromptLabel"),description:t("dynamicPrompts.seedBehaviour.perPromptDesc")}],[t]),o=d.useCallback(s=>{s&&e(_A(s))},[e]);return a.jsx(Et,{feature:"dynamicPromptsSeedBehaviour",children:a.jsx(On,{label:t("dynamicPrompts.seedBehaviour.label"),value:n,data:r,itemComponent:Oie,onChange:o})})},Die=d.memo(Rie),Aie=()=>{const{t:e}=Z(),t=d.useMemo(()=>ce(xe,({dynamicPrompts:o})=>{const s=o.prompts.length;return s===1?e("dynamicPrompts.promptsWithCount_one",{count:s}):e("dynamicPrompts.promptsWithCount_other",{count:s})}),[e]),n=W(t);return Bt("dynamicPrompting").isFeatureEnabled?a.jsx(oo,{label:e("dynamicPrompts.dynamicPrompts"),activeLabel:n,children:a.jsxs(L,{sx:{gap:2,flexDir:"column"},children:[a.jsx(Mie,{}),a.jsx(Die,{}),a.jsx(_ie,{})]})}):null},qc=d.memo(Aie),Tie=e=>{const t=te(),{lora:n}=e,r=d.useCallback(i=>{t(IA({id:n.id,weight:i}))},[t,n.id]),o=d.useCallback(()=>{t(PA(n.id))},[t,n.id]),s=d.useCallback(()=>{t(EA(n.id))},[t,n.id]);return a.jsx(Et,{feature:"lora",children:a.jsxs(L,{sx:{gap:2.5,alignItems:"flex-end"},children:[a.jsx(tt,{label:n.model_name,value:n.weight,onChange:r,min:-1,max:2,step:.01,withInput:!0,withReset:!0,handleReset:o,withSliderMarks:!0,sliderMarks:[-1,0,1,2],sliderNumberInputProps:{min:-50,max:50}}),a.jsx(Fe,{size:"sm",onClick:s,tooltip:"Remove LoRA","aria-label":"Remove LoRA",icon:a.jsx(Br,{}),colorScheme:"error"})]})})},Nie=d.memo(Tie),$ie=ce(xe,({lora:e})=>({lorasArray:nr(e.loras)}),je),Lie=()=>{const{lorasArray:e}=W($ie);return a.jsx(a.Fragment,{children:e.map((t,n)=>a.jsxs(L,{sx:{flexDirection:"column",gap:2},children:[n>0&&a.jsx(Yn,{pt:1}),a.jsx(Nie,{lora:t})]},t.model_name))})},zie=d.memo(Lie),Fie=ce(xe,({lora:e})=>({loras:e.loras}),je),Bie=()=>{const e=te(),{loras:t}=W(Fie),{data:n}=Cd(),r=W(i=>i.generation.model),o=d.useMemo(()=>{if(!n)return[];const i=[];return $n(n.entities,(l,u)=>{if(!l||u in t)return;const p=(r==null?void 0:r.base_model)!==l.base_model;i.push({value:u,label:l.model_name,disabled:p,group:mn[l.base_model],tooltip:p?`Incompatible base model: ${l.base_model}`:void 0})}),i.sort((l,u)=>l.label&&!u.label?1:-1),i.sort((l,u)=>l.disabled&&!u.disabled?1:-1)},[t,n,r==null?void 0:r.base_model]),s=d.useCallback(i=>{if(!i)return;const l=n==null?void 0:n.entities[i];l&&e(MA(l))},[e,n==null?void 0:n.entities]);return(n==null?void 0:n.ids.length)===0?a.jsx(L,{sx:{justifyContent:"center",p:2},children:a.jsx(ve,{sx:{fontSize:"sm",color:"base.500",_dark:"base.700"},children:"No LoRAs Loaded"})}):a.jsx(nn,{placeholder:o.length===0?"All LoRAs added":"Add LoRA",value:null,data:o,nothingFound:"No matching LoRAs",itemComponent:ci,disabled:o.length===0,filter:(i,l)=>{var u;return((u=l.label)==null?void 0:u.toLowerCase().includes(i.toLowerCase().trim()))||l.value.toLowerCase().includes(i.toLowerCase().trim())},onChange:s,"data-testid":"add-lora"})},Hie=d.memo(Bie),Vie=ce(xe,e=>{const t=II(e.lora.loras);return{activeLabel:t>0?`${t} Active`:void 0}},je),Wie=()=>{const{activeLabel:e}=W(Vie);return Bt("lora").isFeatureEnabled?a.jsx(oo,{label:"LoRA",activeLabel:e,children:a.jsxs(L,{sx:{flexDir:"column",gap:2},children:[a.jsx(Hie,{}),a.jsx(zie,{})]})}):null},Xc=d.memo(Wie),Uie=()=>{const e=te(),t=W(o=>o.generation.shouldUseCpuNoise),{t:n}=Z(),r=d.useCallback(o=>{e(OA(o.target.checked))},[e]);return a.jsx(Et,{feature:"noiseUseCPU",children:a.jsx(dn,{label:n("parameters.useCpuNoise"),isChecked:t,onChange:r})})},os=e=>e.generation,Gie=ce(os,e=>{const{seamlessXAxis:t}=e;return{seamlessXAxis:t}},je),Kie=()=>{const{t:e}=Z(),{seamlessXAxis:t}=W(Gie),n=te(),r=d.useCallback(o=>{n(RA(o.target.checked))},[n]);return a.jsx(dn,{label:e("parameters.seamlessXAxis"),"aria-label":e("parameters.seamlessXAxis"),isChecked:t,onChange:r})},qie=d.memo(Kie),Xie=ce(os,e=>{const{seamlessYAxis:t}=e;return{seamlessYAxis:t}},je),Qie=()=>{const{t:e}=Z(),{seamlessYAxis:t}=W(Xie),n=te(),r=d.useCallback(o=>{n(DA(o.target.checked))},[n]);return a.jsx(dn,{label:e("parameters.seamlessYAxis"),"aria-label":e("parameters.seamlessYAxis"),isChecked:t,onChange:r})},Yie=d.memo(Qie),Zie=()=>{const{t:e}=Z();return Bt("seamless").isFeatureEnabled?a.jsxs(Kt,{children:[a.jsx(wn,{children:e("parameters.seamlessTiling")})," ",a.jsxs(L,{sx:{gap:5},children:[a.jsx(Ie,{flexGrow:1,children:a.jsx(qie,{})}),a.jsx(Ie,{flexGrow:1,children:a.jsx(Yie,{})})]})]}):null},Jie=d.memo(Zie);function ele(){const e=W(u=>u.generation.clipSkip),{model:t}=W(u=>u.generation),n=te(),{t:r}=Z(),o=d.useCallback(u=>{n(bw(u))},[n]),s=d.useCallback(()=>{n(bw(0))},[n]),i=d.useMemo(()=>t?Qf[t.base_model].maxClip:Qf["sd-1"].maxClip,[t]),l=d.useMemo(()=>t?Qf[t.base_model].markers:Qf["sd-1"].markers,[t]);return(t==null?void 0:t.base_model)==="sdxl"?null:a.jsx(Et,{feature:"clipSkip",placement:"top",children:a.jsx(tt,{label:r("parameters.clipSkip"),"aria-label":r("parameters.clipSkip"),min:0,max:i,step:1,value:e,onChange:o,withSliderMarks:!0,sliderMarks:l,withInput:!0,withReset:!0,handleReset:s})})}const tle=ce(xe,e=>{const{clipSkip:t,model:n,seamlessXAxis:r,seamlessYAxis:o,shouldUseCpuNoise:s}=e.generation;return{clipSkip:t,model:n,seamlessXAxis:r,seamlessYAxis:o,shouldUseCpuNoise:s}},je);function Qc(){const{clipSkip:e,model:t,seamlessXAxis:n,seamlessYAxis:r,shouldUseCpuNoise:o}=W(tle),{t:s}=Z(),i=d.useMemo(()=>{const l=[];return o?l.push(s("parameters.cpuNoise")):l.push(s("parameters.gpuNoise")),e>0&&t&&t.base_model!=="sdxl"&&l.push(s("parameters.clipSkipWithLayerCount",{layerCount:e})),n&&r?l.push(s("parameters.seamlessX&Y")):n?l.push(s("parameters.seamlessX")):r&&l.push(s("parameters.seamlessY")),l.join(", ")},[e,t,n,r,o,s]);return a.jsx(oo,{label:s("common.advanced"),activeLabel:i,children:a.jsxs(L,{sx:{flexDir:"column",gap:2},children:[a.jsx(Jie,{}),a.jsx(Yn,{}),t&&(t==null?void 0:t.base_model)!=="sdxl"&&a.jsxs(a.Fragment,{children:[a.jsx(ele,{}),a.jsx(Yn,{pt:2})]}),a.jsx(Uie,{})]})})}const nle=ce(xe,({generation:e})=>{const{model:t}=e;return{mainModel:t}},je),rle=e=>{const{controlNetId:t,model:n,isEnabled:r}=e.controlNet,o=te(),{mainModel:s}=W(nle),{t:i}=Z(),{data:l}=gh(),u=d.useMemo(()=>{if(!l)return[];const h=[];return $n(l.entities,(g,x)=>{if(!g)return;const y=(g==null?void 0:g.base_model)!==(s==null?void 0:s.base_model);h.push({value:x,label:g.model_name,group:mn[g.base_model],disabled:y,tooltip:y?`${i("controlnet.incompatibleBaseModel")} ${g.base_model}`:void 0})}),h},[l,s==null?void 0:s.base_model,i]),p=d.useMemo(()=>(l==null?void 0:l.entities[`${n==null?void 0:n.base_model}/controlnet/${n==null?void 0:n.model_name}`])??null,[n==null?void 0:n.base_model,n==null?void 0:n.model_name,l==null?void 0:l.entities]),m=d.useCallback(h=>{if(!h)return;const g=wO(h);g&&o(PI({controlNetId:t,model:g}))},[t,o]);return a.jsx(nn,{itemComponent:ci,data:u,error:!p||(s==null?void 0:s.base_model)!==p.base_model,placeholder:i("controlnet.selectModel"),value:(p==null?void 0:p.id)??null,onChange:m,disabled:!r,tooltip:p==null?void 0:p.description})},ole=d.memo(rle),sle=e=>{const{weight:t,isEnabled:n,controlNetId:r}=e.controlNet,o=te(),{t:s}=Z(),i=d.useCallback(l=>{o(AA({controlNetId:r,weight:l}))},[r,o]);return a.jsx(Et,{feature:"controlNetWeight",children:a.jsx(tt,{isDisabled:!n,label:s("controlnet.weight"),value:t,onChange:i,min:0,max:2,step:.01,withSliderMarks:!0,sliderMarks:[0,1,2]})})},ale=d.memo(sle),ile=ce(xe,({controlNet:e,gallery:t})=>{const{pendingControlImages:n}=e,{autoAddBoardId:r}=t;return{pendingControlImages:n,autoAddBoardId:r}},je),lle=({isSmall:e,controlNet:t})=>{const{controlImage:n,processedControlImage:r,processorType:o,controlNetId:s}=t,i=te(),{t:l}=Z(),{pendingControlImages:u,autoAddBoardId:p}=W(ile),m=W(Jn),[h,g]=d.useState(!1),{currentData:x}=to(n??$r.skipToken),{currentData:y}=to(r??$r.skipToken),[b]=TA(),[w]=NA(),[S]=$A(),j=d.useCallback(()=>{i(LA({controlNetId:s,controlImage:null}))},[s,i]),_=d.useCallback(async()=>{y&&(await b({imageDTO:y,is_intermediate:!1}).unwrap(),p!=="none"?w({imageDTO:y,board_id:p}):S({imageDTO:y}))},[y,b,p,w,S]),E=d.useCallback(()=>{x&&(m==="unifiedCanvas"?i(Vo({width:x.width,height:x.height})):(i(Bi(x.width)),i(Hi(x.height))))},[x,m,i]),I=d.useCallback(()=>{g(!0)},[]),M=d.useCallback(()=>{g(!1)},[]),R=d.useMemo(()=>{if(x)return{id:s,payloadType:"IMAGE_DTO",payload:{imageDTO:x}}},[x,s]),D=d.useMemo(()=>({id:s,actionType:"SET_CONTROLNET_IMAGE",context:{controlNetId:s}}),[s]),A=d.useMemo(()=>({type:"SET_CONTROLNET_IMAGE",controlNetId:s}),[s]),O=x&&y&&!h&&!u.includes(s)&&o!=="none";return a.jsxs(L,{onMouseEnter:I,onMouseLeave:M,sx:{position:"relative",w:"full",h:e?28:366,alignItems:"center",justifyContent:"center"},children:[a.jsx(ua,{draggableData:R,droppableData:D,imageDTO:x,isDropDisabled:O,postUploadAction:A}),a.jsx(Ie,{sx:{position:"absolute",top:0,insetInlineStart:0,w:"full",h:"full",opacity:O?1:0,transitionProperty:"common",transitionDuration:"normal",pointerEvents:"none"},children:a.jsx(ua,{draggableData:R,droppableData:D,imageDTO:y,isUploadDisabled:!0})}),a.jsxs(a.Fragment,{children:[a.jsx(Li,{onClick:j,icon:x?a.jsx(Ud,{}):void 0,tooltip:l("controlnet.resetControlImage")}),a.jsx(Li,{onClick:_,icon:x?a.jsx(lg,{size:16}):void 0,tooltip:l("controlnet.saveControlImage"),styleOverrides:{marginTop:6}}),a.jsx(Li,{onClick:E,icon:x?a.jsx(eee,{size:16}):void 0,tooltip:l("controlnet.setControlImageDimensions"),styleOverrides:{marginTop:12}})]}),u.includes(s)&&a.jsx(L,{sx:{position:"absolute",top:0,insetInlineStart:0,w:"full",h:"full",alignItems:"center",justifyContent:"center",opacity:.8,borderRadius:"base",bg:"base.400",_dark:{bg:"base.900"}},children:a.jsx(fa,{size:"xl",sx:{color:"base.100",_dark:{color:"base.400"}}})})]})},Jj=d.memo(lle),Io=()=>{const e=te();return d.useCallback((n,r)=>{e(zA({controlNetId:n,changes:r}))},[e])};function Po(e){return a.jsx(L,{sx:{flexDirection:"column",gap:2,pb:2},children:e.children})}const e_=Fr.canny_image_processor.default,cle=e=>{const{controlNetId:t,processorNode:n,isEnabled:r}=e,{low_threshold:o,high_threshold:s}=n,i=Io(),{t:l}=Z(),u=d.useCallback(g=>{i(t,{low_threshold:g})},[t,i]),p=d.useCallback(()=>{i(t,{low_threshold:e_.low_threshold})},[t,i]),m=d.useCallback(g=>{i(t,{high_threshold:g})},[t,i]),h=d.useCallback(()=>{i(t,{high_threshold:e_.high_threshold})},[t,i]);return a.jsxs(Po,{children:[a.jsx(tt,{isDisabled:!r,label:l("controlnet.lowThreshold"),value:o,onChange:u,handleReset:p,withReset:!0,min:0,max:255,withInput:!0,withSliderMarks:!0}),a.jsx(tt,{isDisabled:!r,label:l("controlnet.highThreshold"),value:s,onChange:m,handleReset:h,withReset:!0,min:0,max:255,withInput:!0,withSliderMarks:!0})]})},ule=d.memo(cle),dle=Fr.color_map_image_processor.default,fle=e=>{const{controlNetId:t,processorNode:n,isEnabled:r}=e,{color_map_tile_size:o}=n,s=Io(),{t:i}=Z(),l=d.useCallback(p=>{s(t,{color_map_tile_size:p})},[t,s]),u=d.useCallback(()=>{s(t,{color_map_tile_size:dle.color_map_tile_size})},[t,s]);return a.jsx(Po,{children:a.jsx(tt,{isDisabled:!r,label:i("controlnet.colorMapTileSize"),value:o,onChange:l,handleReset:u,withReset:!0,min:1,max:256,step:1,withInput:!0,withSliderMarks:!0,sliderNumberInputProps:{max:4096}})})},ple=d.memo(fle),_u=Fr.content_shuffle_image_processor.default,mle=e=>{const{controlNetId:t,processorNode:n,isEnabled:r}=e,{image_resolution:o,detect_resolution:s,w:i,h:l,f:u}=n,p=Io(),{t:m}=Z(),h=d.useCallback(I=>{p(t,{detect_resolution:I})},[t,p]),g=d.useCallback(()=>{p(t,{detect_resolution:_u.detect_resolution})},[t,p]),x=d.useCallback(I=>{p(t,{image_resolution:I})},[t,p]),y=d.useCallback(()=>{p(t,{image_resolution:_u.image_resolution})},[t,p]),b=d.useCallback(I=>{p(t,{w:I})},[t,p]),w=d.useCallback(()=>{p(t,{w:_u.w})},[t,p]),S=d.useCallback(I=>{p(t,{h:I})},[t,p]),j=d.useCallback(()=>{p(t,{h:_u.h})},[t,p]),_=d.useCallback(I=>{p(t,{f:I})},[t,p]),E=d.useCallback(()=>{p(t,{f:_u.f})},[t,p]);return a.jsxs(Po,{children:[a.jsx(tt,{label:m("controlnet.detectResolution"),value:s,onChange:h,handleReset:g,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(tt,{label:m("controlnet.imageResolution"),value:o,onChange:x,handleReset:y,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(tt,{label:m("controlnet.w"),value:i,onChange:b,handleReset:w,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(tt,{label:m("controlnet.h"),value:l,onChange:S,handleReset:j,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(tt,{label:m("controlnet.f"),value:u,onChange:_,handleReset:E,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r})]})},hle=d.memo(mle),t_=Fr.hed_image_processor.default,gle=e=>{const{controlNetId:t,processorNode:{detect_resolution:n,image_resolution:r,scribble:o},isEnabled:s}=e,i=Io(),{t:l}=Z(),u=d.useCallback(x=>{i(t,{detect_resolution:x})},[t,i]),p=d.useCallback(x=>{i(t,{image_resolution:x})},[t,i]),m=d.useCallback(x=>{i(t,{scribble:x.target.checked})},[t,i]),h=d.useCallback(()=>{i(t,{detect_resolution:t_.detect_resolution})},[t,i]),g=d.useCallback(()=>{i(t,{image_resolution:t_.image_resolution})},[t,i]);return a.jsxs(Po,{children:[a.jsx(tt,{label:l("controlnet.detectResolution"),value:n,onChange:u,handleReset:h,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!s}),a.jsx(tt,{label:l("controlnet.imageResolution"),value:r,onChange:p,handleReset:g,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!s}),a.jsx(dn,{label:l("controlnet.scribble"),isChecked:o,onChange:m,isDisabled:!s})]})},vle=d.memo(gle),n_=Fr.lineart_anime_image_processor.default,xle=e=>{const{controlNetId:t,processorNode:n,isEnabled:r}=e,{image_resolution:o,detect_resolution:s}=n,i=Io(),{t:l}=Z(),u=d.useCallback(g=>{i(t,{detect_resolution:g})},[t,i]),p=d.useCallback(g=>{i(t,{image_resolution:g})},[t,i]),m=d.useCallback(()=>{i(t,{detect_resolution:n_.detect_resolution})},[t,i]),h=d.useCallback(()=>{i(t,{image_resolution:n_.image_resolution})},[t,i]);return a.jsxs(Po,{children:[a.jsx(tt,{label:l("controlnet.detectResolution"),value:s,onChange:u,handleReset:m,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(tt,{label:l("controlnet.imageResolution"),value:o,onChange:p,handleReset:h,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r})]})},ble=d.memo(xle),r_=Fr.lineart_image_processor.default,yle=e=>{const{controlNetId:t,processorNode:n,isEnabled:r}=e,{image_resolution:o,detect_resolution:s,coarse:i}=n,l=Io(),{t:u}=Z(),p=d.useCallback(y=>{l(t,{detect_resolution:y})},[t,l]),m=d.useCallback(y=>{l(t,{image_resolution:y})},[t,l]),h=d.useCallback(()=>{l(t,{detect_resolution:r_.detect_resolution})},[t,l]),g=d.useCallback(()=>{l(t,{image_resolution:r_.image_resolution})},[t,l]),x=d.useCallback(y=>{l(t,{coarse:y.target.checked})},[t,l]);return a.jsxs(Po,{children:[a.jsx(tt,{label:u("controlnet.detectResolution"),value:s,onChange:p,handleReset:h,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(tt,{label:u("controlnet.imageResolution"),value:o,onChange:m,handleReset:g,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(dn,{label:u("controlnet.coarse"),isChecked:i,onChange:x,isDisabled:!r})]})},Cle=d.memo(yle),o_=Fr.mediapipe_face_processor.default,wle=e=>{const{controlNetId:t,processorNode:n,isEnabled:r}=e,{max_faces:o,min_confidence:s}=n,i=Io(),{t:l}=Z(),u=d.useCallback(g=>{i(t,{max_faces:g})},[t,i]),p=d.useCallback(g=>{i(t,{min_confidence:g})},[t,i]),m=d.useCallback(()=>{i(t,{max_faces:o_.max_faces})},[t,i]),h=d.useCallback(()=>{i(t,{min_confidence:o_.min_confidence})},[t,i]);return a.jsxs(Po,{children:[a.jsx(tt,{label:l("controlnet.maxFaces"),value:o,onChange:u,handleReset:m,withReset:!0,min:1,max:20,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(tt,{label:l("controlnet.minConfidence"),value:s,onChange:p,handleReset:h,withReset:!0,min:0,max:1,step:.01,withInput:!0,withSliderMarks:!0,isDisabled:!r})]})},Sle=d.memo(wle),s_=Fr.midas_depth_image_processor.default,kle=e=>{const{controlNetId:t,processorNode:n,isEnabled:r}=e,{a_mult:o,bg_th:s}=n,i=Io(),{t:l}=Z(),u=d.useCallback(g=>{i(t,{a_mult:g})},[t,i]),p=d.useCallback(g=>{i(t,{bg_th:g})},[t,i]),m=d.useCallback(()=>{i(t,{a_mult:s_.a_mult})},[t,i]),h=d.useCallback(()=>{i(t,{bg_th:s_.bg_th})},[t,i]);return a.jsxs(Po,{children:[a.jsx(tt,{label:l("controlnet.amult"),value:o,onChange:u,handleReset:m,withReset:!0,min:0,max:20,step:.01,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(tt,{label:l("controlnet.bgth"),value:s,onChange:p,handleReset:h,withReset:!0,min:0,max:20,step:.01,withInput:!0,withSliderMarks:!0,isDisabled:!r})]})},jle=d.memo(kle),Rp=Fr.mlsd_image_processor.default,_le=e=>{const{controlNetId:t,processorNode:n,isEnabled:r}=e,{image_resolution:o,detect_resolution:s,thr_d:i,thr_v:l}=n,u=Io(),{t:p}=Z(),m=d.useCallback(j=>{u(t,{detect_resolution:j})},[t,u]),h=d.useCallback(j=>{u(t,{image_resolution:j})},[t,u]),g=d.useCallback(j=>{u(t,{thr_d:j})},[t,u]),x=d.useCallback(j=>{u(t,{thr_v:j})},[t,u]),y=d.useCallback(()=>{u(t,{detect_resolution:Rp.detect_resolution})},[t,u]),b=d.useCallback(()=>{u(t,{image_resolution:Rp.image_resolution})},[t,u]),w=d.useCallback(()=>{u(t,{thr_d:Rp.thr_d})},[t,u]),S=d.useCallback(()=>{u(t,{thr_v:Rp.thr_v})},[t,u]);return a.jsxs(Po,{children:[a.jsx(tt,{label:p("controlnet.detectResolution"),value:s,onChange:m,handleReset:y,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(tt,{label:p("controlnet.imageResolution"),value:o,onChange:h,handleReset:b,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(tt,{label:p("controlnet.w"),value:i,onChange:g,handleReset:w,withReset:!0,min:0,max:1,step:.01,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(tt,{label:p("controlnet.h"),value:l,onChange:x,handleReset:S,withReset:!0,min:0,max:1,step:.01,withInput:!0,withSliderMarks:!0,isDisabled:!r})]})},Ile=d.memo(_le),a_=Fr.normalbae_image_processor.default,Ple=e=>{const{controlNetId:t,processorNode:n,isEnabled:r}=e,{image_resolution:o,detect_resolution:s}=n,i=Io(),{t:l}=Z(),u=d.useCallback(g=>{i(t,{detect_resolution:g})},[t,i]),p=d.useCallback(g=>{i(t,{image_resolution:g})},[t,i]),m=d.useCallback(()=>{i(t,{detect_resolution:a_.detect_resolution})},[t,i]),h=d.useCallback(()=>{i(t,{image_resolution:a_.image_resolution})},[t,i]);return a.jsxs(Po,{children:[a.jsx(tt,{label:l("controlnet.detectResolution"),value:s,onChange:u,handleReset:m,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(tt,{label:l("controlnet.imageResolution"),value:o,onChange:p,handleReset:h,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r})]})},Ele=d.memo(Ple),i_=Fr.openpose_image_processor.default,Mle=e=>{const{controlNetId:t,processorNode:n,isEnabled:r}=e,{image_resolution:o,detect_resolution:s,hand_and_face:i}=n,l=Io(),{t:u}=Z(),p=d.useCallback(y=>{l(t,{detect_resolution:y})},[t,l]),m=d.useCallback(y=>{l(t,{image_resolution:y})},[t,l]),h=d.useCallback(()=>{l(t,{detect_resolution:i_.detect_resolution})},[t,l]),g=d.useCallback(()=>{l(t,{image_resolution:i_.image_resolution})},[t,l]),x=d.useCallback(y=>{l(t,{hand_and_face:y.target.checked})},[t,l]);return a.jsxs(Po,{children:[a.jsx(tt,{label:u("controlnet.detectResolution"),value:s,onChange:p,handleReset:h,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(tt,{label:u("controlnet.imageResolution"),value:o,onChange:m,handleReset:g,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(dn,{label:u("controlnet.handAndFace"),isChecked:i,onChange:x,isDisabled:!r})]})},Ole=d.memo(Mle),l_=Fr.pidi_image_processor.default,Rle=e=>{const{controlNetId:t,processorNode:n,isEnabled:r}=e,{image_resolution:o,detect_resolution:s,scribble:i,safe:l}=n,u=Io(),{t:p}=Z(),m=d.useCallback(w=>{u(t,{detect_resolution:w})},[t,u]),h=d.useCallback(w=>{u(t,{image_resolution:w})},[t,u]),g=d.useCallback(()=>{u(t,{detect_resolution:l_.detect_resolution})},[t,u]),x=d.useCallback(()=>{u(t,{image_resolution:l_.image_resolution})},[t,u]),y=d.useCallback(w=>{u(t,{scribble:w.target.checked})},[t,u]),b=d.useCallback(w=>{u(t,{safe:w.target.checked})},[t,u]);return a.jsxs(Po,{children:[a.jsx(tt,{label:p("controlnet.detectResolution"),value:s,onChange:m,handleReset:g,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(tt,{label:p("controlnet.imageResolution"),value:o,onChange:h,handleReset:x,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(dn,{label:p("controlnet.scribble"),isChecked:i,onChange:y}),a.jsx(dn,{label:p("controlnet.safe"),isChecked:l,onChange:b,isDisabled:!r})]})},Dle=d.memo(Rle),Ale=e=>null,Tle=d.memo(Ale),Nle=e=>{const{controlNetId:t,isEnabled:n,processorNode:r}=e.controlNet;return r.type==="canny_image_processor"?a.jsx(ule,{controlNetId:t,processorNode:r,isEnabled:n}):r.type==="color_map_image_processor"?a.jsx(ple,{controlNetId:t,processorNode:r,isEnabled:n}):r.type==="hed_image_processor"?a.jsx(vle,{controlNetId:t,processorNode:r,isEnabled:n}):r.type==="lineart_image_processor"?a.jsx(Cle,{controlNetId:t,processorNode:r,isEnabled:n}):r.type==="content_shuffle_image_processor"?a.jsx(hle,{controlNetId:t,processorNode:r,isEnabled:n}):r.type==="lineart_anime_image_processor"?a.jsx(ble,{controlNetId:t,processorNode:r,isEnabled:n}):r.type==="mediapipe_face_processor"?a.jsx(Sle,{controlNetId:t,processorNode:r,isEnabled:n}):r.type==="midas_depth_image_processor"?a.jsx(jle,{controlNetId:t,processorNode:r,isEnabled:n}):r.type==="mlsd_image_processor"?a.jsx(Ile,{controlNetId:t,processorNode:r,isEnabled:n}):r.type==="normalbae_image_processor"?a.jsx(Ele,{controlNetId:t,processorNode:r,isEnabled:n}):r.type==="openpose_image_processor"?a.jsx(Ole,{controlNetId:t,processorNode:r,isEnabled:n}):r.type==="pidi_image_processor"?a.jsx(Dle,{controlNetId:t,processorNode:r,isEnabled:n}):r.type==="zoe_depth_image_processor"?a.jsx(Tle,{controlNetId:t,processorNode:r,isEnabled:n}):null},$le=d.memo(Nle),Lle=e=>{const{controlNetId:t,isEnabled:n,shouldAutoConfig:r}=e.controlNet,o=te(),{t:s}=Z(),i=d.useCallback(()=>{o(FA({controlNetId:t}))},[t,o]);return a.jsx(dn,{label:s("controlnet.autoConfigure"),"aria-label":s("controlnet.autoConfigure"),isChecked:r,onChange:i,isDisabled:!n})},zle=d.memo(Lle),Fle=e=>{const{controlNet:t}=e,n=te(),{t:r}=Z(),o=d.useCallback(()=>{n(BA({controlNet:t}))},[t,n]),s=d.useCallback(()=>{n(HA({controlNet:t}))},[t,n]);return a.jsxs(L,{sx:{gap:2},children:[a.jsx(Fe,{size:"sm",icon:a.jsx(Qi,{}),tooltip:r("controlnet.importImageFromCanvas"),"aria-label":r("controlnet.importImageFromCanvas"),onClick:o}),a.jsx(Fe,{size:"sm",icon:a.jsx(hM,{}),tooltip:r("controlnet.importMaskFromCanvas"),"aria-label":r("controlnet.importMaskFromCanvas"),onClick:s})]})},Ble=d.memo(Fle),c_=e=>`${Math.round(e*100)}%`,Hle=e=>{const{beginStepPct:t,endStepPct:n,isEnabled:r,controlNetId:o}=e.controlNet,s=te(),{t:i}=Z(),l=d.useCallback(u=>{s(VA({controlNetId:o,beginStepPct:u[0]})),s(WA({controlNetId:o,endStepPct:u[1]}))},[o,s]);return a.jsx(Et,{feature:"controlNetBeginEnd",children:a.jsxs(Kt,{isDisabled:!r,children:[a.jsx(wn,{children:i("controlnet.beginEndStepPercent")}),a.jsx(Rh,{w:"100%",gap:2,alignItems:"center",children:a.jsxs(Bb,{"aria-label":["Begin Step %","End Step %!"],value:[t,n],onChange:l,min:0,max:1,step:.01,minStepsBetweenThumbs:5,isDisabled:!r,children:[a.jsx(Hb,{children:a.jsx(Vb,{})}),a.jsx(Ht,{label:c_(t),placement:"top",hasArrow:!0,children:a.jsx(nd,{index:0})}),a.jsx(Ht,{label:c_(n),placement:"top",hasArrow:!0,children:a.jsx(nd,{index:1})}),a.jsx(Ai,{value:0,sx:{insetInlineStart:"0 !important",insetInlineEnd:"unset !important"},children:"0%"}),a.jsx(Ai,{value:.5,sx:{insetInlineStart:"50% !important",transform:"translateX(-50%)"},children:"50%"}),a.jsx(Ai,{value:1,sx:{insetInlineStart:"unset !important",insetInlineEnd:"0 !important"},children:"100%"})]})})]})})},Vle=d.memo(Hle);function Wle(e){const{controlMode:t,isEnabled:n,controlNetId:r}=e.controlNet,o=te(),{t:s}=Z(),i=[{label:s("controlnet.balanced"),value:"balanced"},{label:s("controlnet.prompt"),value:"more_prompt"},{label:s("controlnet.control"),value:"more_control"},{label:s("controlnet.megaControl"),value:"unbalanced"}],l=d.useCallback(u=>{o(UA({controlNetId:r,controlMode:u}))},[r,o]);return a.jsx(Et,{feature:"controlNetControlMode",children:a.jsx(On,{disabled:!n,label:s("controlnet.controlMode"),data:i,value:String(t),onChange:l})})}const Ule=ce(Ky,e=>nr(Fr,n=>({value:n.type,label:n.label})).sort((n,r)=>n.value==="none"?-1:r.value==="none"?1:n.label.localeCompare(r.label)).filter(n=>!e.sd.disabledControlNetProcessors.includes(n.value)),je),Gle=e=>{const t=te(),{controlNetId:n,isEnabled:r,processorNode:o}=e.controlNet,s=W(Ule),{t:i}=Z(),l=d.useCallback(u=>{t(GA({controlNetId:n,processorType:u}))},[n,t]);return a.jsx(nn,{label:i("controlnet.processor"),value:o.type??"canny_image_processor",data:s,onChange:l,disabled:!r})},Kle=d.memo(Gle);function qle(e){const{resizeMode:t,isEnabled:n,controlNetId:r}=e.controlNet,o=te(),{t:s}=Z(),i=[{label:s("controlnet.resize"),value:"just_resize"},{label:s("controlnet.crop"),value:"crop_resize"},{label:s("controlnet.fill"),value:"fill_resize"}],l=d.useCallback(u=>{o(KA({controlNetId:r,resizeMode:u}))},[r,o]);return a.jsx(Et,{feature:"controlNetResizeMode",children:a.jsx(On,{disabled:!n,label:s("controlnet.resizeMode"),data:i,value:String(t),onChange:l})})}const Xle=e=>{const{controlNet:t}=e,{controlNetId:n}=t,r=te(),{t:o}=Z(),s=W(Jn),i=ce(xe,({controlNet:y})=>{const b=y.controlNets[n];if(!b)return{isEnabled:!1,shouldAutoConfig:!1};const{isEnabled:w,shouldAutoConfig:S}=b;return{isEnabled:w,shouldAutoConfig:S}},je),{isEnabled:l,shouldAutoConfig:u}=W(i),[p,m]=uee(!1),h=d.useCallback(()=>{r(qA({controlNetId:n}))},[n,r]),g=d.useCallback(()=>{r(XA({sourceControlNetId:n,newControlNetId:Zs()}))},[n,r]),x=d.useCallback(y=>{r(QA({controlNetId:n,isEnabled:y.target.checked}))},[n,r]);return a.jsxs(L,{sx:{flexDir:"column",gap:3,p:2,borderRadius:"base",position:"relative",bg:"base.250",_dark:{bg:"base.750"}},children:[a.jsxs(L,{sx:{gap:2,alignItems:"center"},children:[a.jsx(dn,{tooltip:o("controlnet.toggleControlNet"),"aria-label":o("controlnet.toggleControlNet"),isChecked:l,onChange:x}),a.jsx(Ie,{sx:{w:"full",minW:0,transitionProperty:"common",transitionDuration:"0.1s"},children:a.jsx(ole,{controlNet:t})}),s==="unifiedCanvas"&&a.jsx(Ble,{controlNet:t}),a.jsx(Fe,{size:"sm",tooltip:o("controlnet.duplicate"),"aria-label":o("controlnet.duplicate"),onClick:g,icon:a.jsx(Hc,{})}),a.jsx(Fe,{size:"sm",tooltip:o("controlnet.delete"),"aria-label":o("controlnet.delete"),colorScheme:"error",onClick:h,icon:a.jsx(Br,{})}),a.jsx(Fe,{size:"sm",tooltip:o(p?"controlnet.hideAdvanced":"controlnet.showAdvanced"),"aria-label":o(p?"controlnet.hideAdvanced":"controlnet.showAdvanced"),onClick:m,variant:"ghost",sx:{_hover:{bg:"none"}},icon:a.jsx(gg,{sx:{boxSize:4,color:"base.700",transform:p?"rotate(0deg)":"rotate(180deg)",transitionProperty:"common",transitionDuration:"normal",_dark:{color:"base.300"}}})}),!u&&a.jsx(Ie,{sx:{position:"absolute",w:1.5,h:1.5,borderRadius:"full",top:4,insetInlineEnd:4,bg:"accent.700",_dark:{bg:"accent.400"}}})]}),a.jsxs(L,{sx:{w:"full",flexDirection:"column",gap:3},children:[a.jsxs(L,{sx:{gap:4,w:"full",alignItems:"center"},children:[a.jsxs(L,{sx:{flexDir:"column",gap:3,h:28,w:"full",paddingInlineStart:1,paddingInlineEnd:p?1:0,pb:2,justifyContent:"space-between"},children:[a.jsx(ale,{controlNet:t}),a.jsx(Vle,{controlNet:t})]}),!p&&a.jsx(L,{sx:{alignItems:"center",justifyContent:"center",h:28,w:28,aspectRatio:"1/1"},children:a.jsx(Jj,{controlNet:t,isSmall:!0})})]}),a.jsxs(L,{sx:{gap:2},children:[a.jsx(Wle,{controlNet:t}),a.jsx(qle,{controlNet:t})]}),a.jsx(Kle,{controlNet:t})]}),p&&a.jsxs(a.Fragment,{children:[a.jsx(Jj,{controlNet:t}),a.jsx(zle,{controlNet:t}),a.jsx($le,{controlNet:t})]})]})},Qle=d.memo(Xle),u_=e=>`${Math.round(e*100)}%`,Yle=()=>{const e=W(i=>i.controlNet.isIPAdapterEnabled),t=W(i=>i.controlNet.ipAdapterInfo.beginStepPct),n=W(i=>i.controlNet.ipAdapterInfo.endStepPct),r=te(),{t:o}=Z(),s=d.useCallback(i=>{r(YA(i[0])),r(ZA(i[1]))},[r]);return a.jsxs(Kt,{isDisabled:!e,children:[a.jsx(wn,{children:o("controlnet.beginEndStepPercent")}),a.jsx(Rh,{w:"100%",gap:2,alignItems:"center",children:a.jsxs(Bb,{"aria-label":["Begin Step %","End Step %!"],value:[t,n],onChange:s,min:0,max:1,step:.01,minStepsBetweenThumbs:5,isDisabled:!e,children:[a.jsx(Hb,{children:a.jsx(Vb,{})}),a.jsx(Ht,{label:u_(t),placement:"top",hasArrow:!0,children:a.jsx(nd,{index:0})}),a.jsx(Ht,{label:u_(n),placement:"top",hasArrow:!0,children:a.jsx(nd,{index:1})}),a.jsx(Ai,{value:0,sx:{insetInlineStart:"0 !important",insetInlineEnd:"unset !important"},children:"0%"}),a.jsx(Ai,{value:.5,sx:{insetInlineStart:"50% !important",transform:"translateX(-50%)"},children:"50%"}),a.jsx(Ai,{value:1,sx:{insetInlineStart:"unset !important",insetInlineEnd:"0 !important"},children:"100%"})]})})]})},Zle=d.memo(Yle),Jle=ce(xe,e=>{const{isIPAdapterEnabled:t}=e.controlNet;return{isIPAdapterEnabled:t}},je),ece=()=>{const{isIPAdapterEnabled:e}=W(Jle),t=te(),{t:n}=Z(),r=d.useCallback(o=>{t(u1(o.target.checked))},[t]);return a.jsx(dn,{label:n("controlnet.enableIPAdapter"),isChecked:e,onChange:r,formControlProps:{width:"100%"}})},tce=d.memo(ece),nce=ce(xe,({controlNet:e})=>{const{ipAdapterInfo:t}=e;return{ipAdapterInfo:t}},je),rce=()=>{const{ipAdapterInfo:e}=W(nce),t=te(),{t:n}=Z(),{currentData:r}=to(e.adapterImage??$r.skipToken),o=d.useMemo(()=>{if(r)return{id:"ip-adapter-image",payloadType:"IMAGE_DTO",payload:{imageDTO:r}}},[r]),s=d.useMemo(()=>({id:"ip-adapter-image",actionType:"SET_IP_ADAPTER_IMAGE"}),[]),i=d.useMemo(()=>({type:"SET_IP_ADAPTER_IMAGE"}),[]);return a.jsxs(L,{layerStyle:"second",sx:{position:"relative",w:"full",alignItems:"center",justifyContent:"center",aspectRatio:"1/1",borderRadius:"base"},children:[a.jsx(ua,{imageDTO:r,droppableData:s,draggableData:o,postUploadAction:i,dropLabel:n("toast.setIPAdapterImage"),noContentFallback:a.jsx(Zn,{label:n("controlnet.ipAdapterImageFallback")})}),a.jsx(Li,{onClick:()=>t(JA(null)),icon:e.adapterImage?a.jsx(Ud,{}):void 0,tooltip:n("controlnet.resetIPAdapterImage")})]})},oce=d.memo(rce),sce=()=>{const e=W(p=>p.controlNet.isIPAdapterEnabled),t=W(p=>p.controlNet.ipAdapterInfo.model),n=W(p=>p.generation.model),r=te(),{t:o}=Z(),{data:s}=Vx(),i=d.useMemo(()=>(s==null?void 0:s.entities[`${t==null?void 0:t.base_model}/ip_adapter/${t==null?void 0:t.model_name}`])??null,[t==null?void 0:t.base_model,t==null?void 0:t.model_name,s==null?void 0:s.entities]),l=d.useMemo(()=>{if(!s)return[];const p=[];return $n(s.entities,(m,h)=>{if(!m)return;const g=(n==null?void 0:n.base_model)!==m.base_model;p.push({value:h,label:m.model_name,group:mn[m.base_model],disabled:g,tooltip:g?`Incompatible base model: ${m.base_model}`:void 0})}),p.sort((m,h)=>m.disabled&&!h.disabled?1:-1)},[s,n==null?void 0:n.base_model]),u=d.useCallback(p=>{if(!p)return;const m=IO(p);m&&r(eT(m))},[r]);return a.jsx(On,{label:o("controlnet.ipAdapterModel"),className:"nowheel nodrag",tooltip:i==null?void 0:i.description,value:(i==null?void 0:i.id)??null,placeholder:"Pick one",error:!i,data:l,onChange:u,sx:{width:"100%"},disabled:!e})},ace=d.memo(sce),ice=()=>{const e=W(i=>i.controlNet.isIPAdapterEnabled),t=W(i=>i.controlNet.ipAdapterInfo.weight),n=te(),{t:r}=Z(),o=d.useCallback(i=>{n(yw(i))},[n]),s=d.useCallback(()=>{n(yw(1))},[n]);return a.jsx(tt,{isDisabled:!e,label:r("controlnet.weight"),value:t,onChange:o,min:0,max:2,step:.01,withSliderMarks:!0,sliderMarks:[0,1,2],withReset:!0,handleReset:s})},lce=d.memo(ice),cce=()=>a.jsxs(L,{sx:{flexDir:"column",gap:3,paddingInline:3,paddingBlock:2,paddingBottom:5,borderRadius:"base",position:"relative",bg:"base.250",_dark:{bg:"base.750"}},children:[a.jsx(tce,{}),a.jsx(oce,{}),a.jsx(ace,{}),a.jsx(lce,{}),a.jsx(Zle,{})]}),uce=d.memo(cce),dce=ce(xe,e=>{const{isEnabled:t}=e.controlNet;return{isEnabled:t}},je),fce=()=>{const{isEnabled:e}=W(dce),t=te(),n=d.useCallback(()=>{t(tT())},[t]);return a.jsx(Ie,{width:"100%",children:a.jsx(Et,{feature:"controlNet",children:a.jsx(dn,{label:"Enable ControlNet",isChecked:e,onChange:n})})})},pce=d.memo(fce),mce=ce([xe],({controlNet:e})=>{const{controlNets:t,isEnabled:n,isIPAdapterEnabled:r,ipAdapterInfo:o}=e,s=nT(t),i=o.model&&o.adapterImage;let l;return n&&s.length>0&&(l=`${s.length} ControlNet`),r&&i&&(l?l=`${l}, IP Adapter`:l="IP Adapter"),{controlNetsArray:nr(t),activeLabel:l}},je),hce=()=>{const{controlNetsArray:e,activeLabel:t}=W(mce),n=Bt("controlNet").isFeatureDisabled,r=te(),{data:o}=gh(),s=d.useMemo(()=>{if(!o||!Object.keys(o.entities).length)return;const l=Object.keys(o.entities)[0];if(!l)return;const u=o.entities[l];return u||void 0},[o]),i=d.useCallback(()=>{if(!s)return;const l=Zs();r(rT({controlNetId:l})),r(PI({controlNetId:l,model:s}))},[r,s]);return n?null:a.jsx(oo,{label:"Control Adapters",activeLabel:t,children:a.jsxs(L,{sx:{flexDir:"column",gap:2},children:[a.jsxs(L,{sx:{w:"100%",gap:2,p:2,ps:3,borderRadius:"base",alignItems:"center",bg:"base.250",_dark:{bg:"base.750"}},children:[a.jsx(pce,{}),a.jsx(Fe,{tooltip:"Add ControlNet","aria-label":"Add ControlNet",icon:a.jsx(Vc,{}),isDisabled:!s,flexGrow:1,size:"sm",onClick:i,"data-testid":"add controlnet"})]}),e.map((l,u)=>a.jsxs(d.Fragment,{children:[u>0&&a.jsx(Yn,{}),a.jsx(Qle,{controlNet:l})]},l.controlNetId)),a.jsx(uce,{})]})})},Yc=d.memo(hce),gce=e=>{const{onClick:t}=e,{t:n}=Z();return a.jsx(Fe,{size:"sm","aria-label":n("embedding.addEmbedding"),tooltip:n("embedding.addEmbedding"),icon:a.jsx(lM,{}),sx:{p:2,color:"base.500",_hover:{color:"base.600"},_active:{color:"base.700"},_dark:{color:"base.500",_hover:{color:"base.400"},_active:{color:"base.300"}}},variant:"link",onClick:t})},Rg=d.memo(gce),vce="28rem",xce=e=>{const{onSelect:t,isOpen:n,onClose:r,children:o}=e,{data:s}=oT(),i=d.useRef(null),{t:l}=Z(),u=W(h=>h.generation.model),p=d.useMemo(()=>{if(!s)return[];const h=[];return $n(s.entities,(g,x)=>{if(!g)return;const y=(u==null?void 0:u.base_model)!==g.base_model;h.push({value:g.model_name,label:g.model_name,group:mn[g.base_model],disabled:y,tooltip:y?`${l("embedding.incompatibleModel")} ${g.base_model}`:void 0})}),h.sort((g,x)=>{var y;return g.label&&x.label?(y=g.label)!=null&&y.localeCompare(x.label)?-1:1:-1}),h.sort((g,x)=>g.disabled&&!x.disabled?1:-1)},[s,u==null?void 0:u.base_model,l]),m=d.useCallback(h=>{h&&t(h)},[t]);return a.jsxs(Ld,{initialFocusRef:i,isOpen:n,onClose:r,placement:"bottom",openDelay:0,closeDelay:0,closeOnBlur:!0,returnFocusOnClose:!0,children:[a.jsx(Wh,{children:o}),a.jsx(zd,{sx:{p:0,top:-1,shadow:"dark-lg",borderColor:"accent.300",borderWidth:"2px",borderStyle:"solid",_dark:{borderColor:"accent.400"}},children:a.jsx(Uh,{sx:{p:0,w:`calc(${vce} - 2rem )`},children:p.length===0?a.jsx(L,{sx:{justifyContent:"center",p:2,fontSize:"sm",color:"base.500",_dark:{color:"base.700"}},children:a.jsx(ve,{children:"No Embeddings Loaded"})}):a.jsx(nn,{inputRef:i,autoFocus:!0,placeholder:l("embedding.addEmbedding"),value:null,data:p,nothingFound:l("embedding.noMatchingEmbedding"),itemComponent:ci,disabled:p.length===0,onDropdownClose:r,filter:(h,g)=>{var x;return((x=g.label)==null?void 0:x.toLowerCase().includes(h.toLowerCase().trim()))||g.value.toLowerCase().includes(h.toLowerCase().trim())},onChange:m})})})]})},Dg=d.memo(xce),bce=()=>{const e=W(h=>h.generation.negativePrompt),t=d.useRef(null),{isOpen:n,onClose:r,onOpen:o}=Lr(),s=te(),{t:i}=Z(),l=d.useCallback(h=>{s($u(h.target.value))},[s]),u=d.useCallback(h=>{h.key==="<"&&o()},[o]),p=d.useCallback(h=>{if(!t.current)return;const g=t.current.selectionStart;if(g===void 0)return;let x=e.slice(0,g);x[x.length-1]!=="<"&&(x+="<"),x+=`${h}>`;const y=x.length;x+=e.slice(g),qr.flushSync(()=>{s($u(x))}),t.current.selectionEnd=y,r()},[s,r,e]),m=Bt("embedding").isFeatureEnabled;return a.jsxs(Kt,{children:[a.jsx(Dg,{isOpen:n,onClose:r,onSelect:p,children:a.jsx(Et,{feature:"paramNegativeConditioning",placement:"right",children:a.jsx(da,{id:"negativePrompt",name:"negativePrompt",ref:t,value:e,placeholder:i("parameters.negativePromptPlaceholder"),onChange:l,resize:"vertical",fontSize:"sm",minH:16,...m&&{onKeyDown:u}})})}),!n&&m&&a.jsx(Ie,{sx:{position:"absolute",top:0,insetInlineEnd:0},children:a.jsx(Rg,{onClick:o})})]})},OO=d.memo(bce),yce=ce([xe],({generation:e})=>({prompt:e.positivePrompt}),{memoizeOptions:{resultEqualityCheck:Ft}}),Cce=()=>{const e=te(),{prompt:t}=W(yce),n=d.useRef(null),{isOpen:r,onClose:o,onOpen:s}=Lr(),{t:i}=Z(),l=d.useCallback(h=>{e(Nu(h.target.value))},[e]);et("alt+a",()=>{var h;(h=n.current)==null||h.focus()},[]);const u=d.useCallback(h=>{if(!n.current)return;const g=n.current.selectionStart;if(g===void 0)return;let x=t.slice(0,g);x[x.length-1]!=="<"&&(x+="<"),x+=`${h}>`;const y=x.length;x+=t.slice(g),qr.flushSync(()=>{e(Nu(x))}),n.current.selectionStart=y,n.current.selectionEnd=y,o()},[e,o,t]),p=Bt("embedding").isFeatureEnabled,m=d.useCallback(h=>{p&&h.key==="<"&&s()},[s,p]);return a.jsxs(Ie,{position:"relative",children:[a.jsx(Kt,{children:a.jsx(Dg,{isOpen:r,onClose:o,onSelect:u,children:a.jsx(Et,{feature:"paramPositiveConditioning",placement:"right",children:a.jsx(da,{id:"prompt",name:"prompt",ref:n,value:t,placeholder:i("parameters.positivePromptPlaceholder"),onChange:l,onKeyDown:m,resize:"vertical",minH:32})})})}),!r&&p&&a.jsx(Ie,{sx:{position:"absolute",top:0,insetInlineEnd:0},children:a.jsx(Rg,{onClick:s})})]})},RO=d.memo(Cce);function wce(){const e=W(o=>o.sdxl.shouldConcatSDXLStylePrompt),t=te(),{t:n}=Z(),r=()=>{t(sT(!e))};return a.jsx(Fe,{"aria-label":n("sdxl.concatPromptStyle"),tooltip:n("sdxl.concatPromptStyle"),variant:"outline",isChecked:e,onClick:r,icon:a.jsx(pM,{}),size:"xs",sx:{position:"absolute",insetInlineEnd:1,top:6,border:"none",color:e?"accent.500":"base.500",_hover:{bg:"none"}}})}const d_={position:"absolute",bg:"none",w:"full",minH:2,borderRadius:0,borderLeft:"none",borderRight:"none",zIndex:2,maskImage:"radial-gradient(circle at center, black, black 65%, black 30%, black 15%, transparent)"};function DO(){return a.jsxs(L,{children:[a.jsx(Ie,{as:In.div,initial:{scaleX:0,borderWidth:0,display:"none"},animate:{display:["block","block","block","none"],scaleX:[0,.25,.5,1],borderWidth:[0,3,3,0],transition:{duration:.37,times:[0,.25,.5,1]}},sx:{top:"1px",borderTop:"none",borderColor:"base.400",...d_,_dark:{borderColor:"accent.500"}}}),a.jsx(Ie,{as:In.div,initial:{opacity:0,scale:0},animate:{opacity:[0,1,1,1],scale:[0,.75,1.5,1],transition:{duration:.42,times:[0,.25,.5,1]}},exit:{opacity:0,scale:0},sx:{zIndex:3,position:"absolute",left:"48%",top:"3px",p:1,borderRadius:4,bg:"accent.400",color:"base.50",_dark:{bg:"accent.500"}},children:a.jsx(pM,{size:12})}),a.jsx(Ie,{as:In.div,initial:{scaleX:0,borderWidth:0,display:"none"},animate:{display:["block","block","block","none"],scaleX:[0,.25,.5,1],borderWidth:[0,3,3,0],transition:{duration:.37,times:[0,.25,.5,1]}},sx:{top:"17px",borderBottom:"none",borderColor:"base.400",...d_,_dark:{borderColor:"accent.500"}}})]})}const Sce=ce([xe],({sdxl:e})=>{const{negativeStylePrompt:t,shouldConcatSDXLStylePrompt:n}=e;return{prompt:t,shouldConcatSDXLStylePrompt:n}},{memoizeOptions:{resultEqualityCheck:Ft}}),kce=()=>{const e=te(),t=d.useRef(null),{isOpen:n,onClose:r,onOpen:o}=Lr(),{t:s}=Z(),{prompt:i,shouldConcatSDXLStylePrompt:l}=W(Sce),u=d.useCallback(g=>{e(zu(g.target.value))},[e]),p=d.useCallback(g=>{if(!t.current)return;const x=t.current.selectionStart;if(x===void 0)return;let y=i.slice(0,x);y[y.length-1]!=="<"&&(y+="<"),y+=`${g}>`;const b=y.length;y+=i.slice(x),qr.flushSync(()=>{e(zu(y))}),t.current.selectionStart=b,t.current.selectionEnd=b,r()},[e,r,i]),m=Bt("embedding").isFeatureEnabled,h=d.useCallback(g=>{m&&g.key==="<"&&o()},[o,m]);return a.jsxs(Ie,{position:"relative",children:[a.jsx(dr,{children:l&&a.jsx(Ie,{sx:{position:"absolute",left:"3",w:"94%",top:"-17px"},children:a.jsx(DO,{})})}),a.jsx(Kt,{children:a.jsx(Dg,{isOpen:n,onClose:r,onSelect:p,children:a.jsx(da,{id:"prompt",name:"prompt",ref:t,value:i,placeholder:s("sdxl.negStylePrompt"),onChange:u,onKeyDown:h,resize:"vertical",fontSize:"sm",minH:16})})}),!n&&m&&a.jsx(Ie,{sx:{position:"absolute",top:0,insetInlineEnd:0},children:a.jsx(Rg,{onClick:o})})]})},jce=d.memo(kce),_ce=ce([xe],({sdxl:e})=>{const{positiveStylePrompt:t,shouldConcatSDXLStylePrompt:n}=e;return{prompt:t,shouldConcatSDXLStylePrompt:n}},{memoizeOptions:{resultEqualityCheck:Ft}}),Ice=()=>{const e=te(),t=d.useRef(null),{isOpen:n,onClose:r,onOpen:o}=Lr(),{t:s}=Z(),{prompt:i,shouldConcatSDXLStylePrompt:l}=W(_ce),u=d.useCallback(g=>{e(Lu(g.target.value))},[e]),p=d.useCallback(g=>{if(!t.current)return;const x=t.current.selectionStart;if(x===void 0)return;let y=i.slice(0,x);y[y.length-1]!=="<"&&(y+="<"),y+=`${g}>`;const b=y.length;y+=i.slice(x),qr.flushSync(()=>{e(Lu(y))}),t.current.selectionStart=b,t.current.selectionEnd=b,r()},[e,r,i]),m=Bt("embedding").isFeatureEnabled,h=d.useCallback(g=>{m&&g.key==="<"&&o()},[o,m]);return a.jsxs(Ie,{position:"relative",children:[a.jsx(dr,{children:l&&a.jsx(Ie,{sx:{position:"absolute",left:"3",w:"94%",top:"-17px"},children:a.jsx(DO,{})})}),a.jsx(Kt,{children:a.jsx(Dg,{isOpen:n,onClose:r,onSelect:p,children:a.jsx(da,{id:"prompt",name:"prompt",ref:t,value:i,placeholder:s("sdxl.posStylePrompt"),onChange:u,onKeyDown:h,resize:"vertical",minH:16})})}),!n&&m&&a.jsx(Ie,{sx:{position:"absolute",top:0,insetInlineEnd:0},children:a.jsx(Rg,{onClick:o})})]})},Pce=d.memo(Ice);function o2(){return a.jsxs(L,{sx:{flexDirection:"column",gap:2},children:[a.jsx(RO,{}),a.jsx(wce,{}),a.jsx(Pce,{}),a.jsx(OO,{}),a.jsx(jce,{})]})}const dl=()=>{const{isRefinerAvailable:e}=Xo(nb,{selectFromResult:({data:t})=>({isRefinerAvailable:t?t.ids.length>0:!1})});return e},Ece=ce([xe],({sdxl:e,ui:t,hotkeys:n})=>{const{refinerCFGScale:r}=e,{shouldUseSliders:o}=t,{shift:s}=n;return{refinerCFGScale:r,shouldUseSliders:o,shift:s}},je),Mce=()=>{const{refinerCFGScale:e,shouldUseSliders:t,shift:n}=W(Ece),r=dl(),o=te(),{t:s}=Z(),i=d.useCallback(u=>o(f1(u)),[o]),l=d.useCallback(()=>o(f1(7)),[o]);return t?a.jsx(tt,{label:s("sdxl.cfgScale"),step:n?.1:.5,min:1,max:20,onChange:i,handleReset:l,value:e,sliderNumberInputProps:{max:200},withInput:!0,withReset:!0,withSliderMarks:!0,isInteger:!1,isDisabled:!r}):a.jsx(Kc,{label:s("sdxl.cfgScale"),step:.5,min:1,max:200,onChange:i,value:e,isInteger:!1,numberInputFieldProps:{textAlign:"center"},isDisabled:!r})},Oce=d.memo(Mce),Rce=e=>{const t=el("models"),[n,r,o]=e.split("/"),s=aT.safeParse({base_model:n,model_name:o,model_type:r});if(!s.success){t.error({mainModelId:e,errors:s.error.format()},"Failed to parse main model id");return}return s.data},Dce=ce(xe,e=>({model:e.sdxl.refinerModel}),je),Ace=()=>{const e=te(),t=Bt("syncModels").isFeatureEnabled,{model:n}=W(Dce),{t:r}=Z(),{data:o,isLoading:s}=Xo(nb),i=d.useMemo(()=>{if(!o)return[];const p=[];return $n(o.entities,(m,h)=>{m&&p.push({value:h,label:m.model_name,group:mn[m.base_model]})}),p},[o]),l=d.useMemo(()=>(o==null?void 0:o.entities[`${n==null?void 0:n.base_model}/main/${n==null?void 0:n.model_name}`])??null,[o==null?void 0:o.entities,n]),u=d.useCallback(p=>{if(!p)return;const m=Rce(p);m&&e(pI(m))},[e]);return s?a.jsx(nn,{label:r("sdxl.refinermodel"),placeholder:r("sdxl.loading"),disabled:!0,data:[]}):a.jsxs(L,{w:"100%",alignItems:"center",gap:2,children:[a.jsx(nn,{tooltip:l==null?void 0:l.description,label:r("sdxl.refinermodel"),value:l==null?void 0:l.id,placeholder:i.length>0?r("sdxl.selectAModel"):r("sdxl.noModelsAvailable"),data:i,error:i.length===0,disabled:i.length===0,onChange:u,w:"100%"}),t&&a.jsx(Ie,{mt:7,children:a.jsx(Gc,{iconMode:!0})})]})},Tce=d.memo(Ace),Nce=ce([xe],({sdxl:e,hotkeys:t})=>{const{refinerNegativeAestheticScore:n}=e,{shift:r}=t;return{refinerNegativeAestheticScore:n,shift:r}},je),$ce=()=>{const{refinerNegativeAestheticScore:e,shift:t}=W(Nce),n=dl(),r=te(),{t:o}=Z(),s=d.useCallback(l=>r(m1(l)),[r]),i=d.useCallback(()=>r(m1(2.5)),[r]);return a.jsx(tt,{label:o("sdxl.negAestheticScore"),step:t?.1:.5,min:1,max:10,onChange:s,handleReset:i,value:e,sliderNumberInputProps:{max:10},withInput:!0,withReset:!0,withSliderMarks:!0,isInteger:!1,isDisabled:!n})},Lce=d.memo($ce),zce=ce([xe],({sdxl:e,hotkeys:t})=>{const{refinerPositiveAestheticScore:n}=e,{shift:r}=t;return{refinerPositiveAestheticScore:n,shift:r}},je),Fce=()=>{const{refinerPositiveAestheticScore:e,shift:t}=W(zce),n=dl(),r=te(),{t:o}=Z(),s=d.useCallback(l=>r(p1(l)),[r]),i=d.useCallback(()=>r(p1(6)),[r]);return a.jsx(tt,{label:o("sdxl.posAestheticScore"),step:t?.1:.5,min:1,max:10,onChange:s,handleReset:i,value:e,sliderNumberInputProps:{max:10},withInput:!0,withReset:!0,withSliderMarks:!0,isInteger:!1,isDisabled:!n})},Bce=d.memo(Fce),Hce=ce(xe,({ui:e,sdxl:t})=>{const{refinerScheduler:n}=t,{favoriteSchedulers:r}=e,o=nr(mh,(s,i)=>({value:i,label:s,group:r.includes(i)?"Favorites":void 0})).sort((s,i)=>s.label.localeCompare(i.label));return{refinerScheduler:n,data:o}},je),Vce=()=>{const e=te(),{t}=Z(),{refinerScheduler:n,data:r}=W(Hce),o=dl(),s=d.useCallback(i=>{i&&e(mI(i))},[e]);return a.jsx(nn,{w:"100%",label:t("sdxl.scheduler"),value:n,data:r,onChange:s,disabled:!o})},Wce=d.memo(Vce),Uce=ce([xe],({sdxl:e})=>{const{refinerStart:t}=e;return{refinerStart:t}},je),Gce=()=>{const{refinerStart:e}=W(Uce),t=te(),n=dl(),r=d.useCallback(i=>t(h1(i)),[t]),{t:o}=Z(),s=d.useCallback(()=>t(h1(.8)),[t]);return a.jsx(tt,{label:o("sdxl.refinerStart"),step:.01,min:0,max:1,onChange:r,handleReset:s,value:e,withInput:!0,withReset:!0,withSliderMarks:!0,isInteger:!1,isDisabled:!n})},Kce=d.memo(Gce),qce=ce([xe],({sdxl:e,ui:t})=>{const{refinerSteps:n}=e,{shouldUseSliders:r}=t;return{refinerSteps:n,shouldUseSliders:r}},je),Xce=()=>{const{refinerSteps:e,shouldUseSliders:t}=W(qce),n=dl(),r=te(),{t:o}=Z(),s=d.useCallback(l=>{r(d1(l))},[r]),i=d.useCallback(()=>{r(d1(20))},[r]);return t?a.jsx(tt,{label:o("sdxl.steps"),min:1,max:100,step:1,onChange:s,handleReset:i,value:e,withInput:!0,withReset:!0,withSliderMarks:!0,sliderNumberInputProps:{max:500},isDisabled:!n}):a.jsx(Kc,{label:o("sdxl.steps"),min:1,max:500,step:1,onChange:s,value:e,numberInputFieldProps:{textAlign:"center"},isDisabled:!n})},Qce=d.memo(Xce);function Yce(){const e=W(s=>s.sdxl.shouldUseSDXLRefiner),t=dl(),n=te(),{t:r}=Z(),o=s=>{n(iT(s.target.checked))};return a.jsx(dn,{label:r("sdxl.useRefiner"),isChecked:e,onChange:o,isDisabled:!t})}const Zce=ce(xe,e=>{const{shouldUseSDXLRefiner:t}=e.sdxl,{shouldUseSliders:n}=e.ui;return{activeLabel:t?"Enabled":void 0,shouldUseSliders:n}},je),Jce=()=>{const{activeLabel:e,shouldUseSliders:t}=W(Zce),{t:n}=Z();return a.jsx(oo,{label:n("sdxl.refiner"),activeLabel:e,children:a.jsxs(L,{sx:{gap:2,flexDir:"column"},children:[a.jsx(Yce,{}),a.jsx(Tce,{}),a.jsxs(L,{gap:2,flexDirection:t?"column":"row",children:[a.jsx(Qce,{}),a.jsx(Oce,{})]}),a.jsx(Wce,{}),a.jsx(Bce,{}),a.jsx(Lce,{}),a.jsx(Kce,{})]})})},s2=d.memo(Jce),eue=ce([xe],({generation:e,config:t,ui:n,hotkeys:r})=>{const{initial:o,min:s,sliderMax:i,inputMax:l}=t.sd.guidance,{cfgScale:u}=e,{shouldUseSliders:p}=n,{shift:m}=r;return{cfgScale:u,initial:o,min:s,sliderMax:i,inputMax:l,shouldUseSliders:p,shift:m}},je),tue=()=>{const{cfgScale:e,initial:t,min:n,sliderMax:r,inputMax:o,shouldUseSliders:s,shift:i}=W(eue),l=te(),{t:u}=Z(),p=d.useCallback(h=>l(Qp(h)),[l]),m=d.useCallback(()=>l(Qp(t)),[l,t]);return s?a.jsx(Et,{feature:"paramCFGScale",children:a.jsx(tt,{label:u("parameters.cfgScale"),step:i?.1:.5,min:n,max:r,onChange:p,handleReset:m,value:e,sliderNumberInputProps:{max:o},withInput:!0,withReset:!0,withSliderMarks:!0,isInteger:!1})}):a.jsx(Et,{feature:"paramCFGScale",children:a.jsx(Kc,{label:u("parameters.cfgScale"),step:.5,min:n,max:o,onChange:p,value:e,isInteger:!1,numberInputFieldProps:{textAlign:"center"}})})},_s=d.memo(tue),nue=ce(xe,e=>({model:e.generation.model}),je),rue=()=>{const e=te(),{t}=Z(),{model:n}=W(nue),r=Bt("syncModels").isFeatureEnabled,{data:o,isLoading:s}=Xo(Cw),{data:i,isLoading:l}=Ku(Cw),u=W(Jn),p=d.useMemo(()=>{if(!o)return[];const g=[];return $n(o.entities,(x,y)=>{x&&g.push({value:y,label:x.model_name,group:mn[x.base_model]})}),$n(i==null?void 0:i.entities,(x,y)=>{!x||u==="unifiedCanvas"||u==="img2img"||g.push({value:y,label:x.model_name,group:mn[x.base_model]})}),g},[o,i,u]),m=d.useMemo(()=>((o==null?void 0:o.entities[`${n==null?void 0:n.base_model}/main/${n==null?void 0:n.model_name}`])||(i==null?void 0:i.entities[`${n==null?void 0:n.base_model}/onnx/${n==null?void 0:n.model_name}`]))??null,[o==null?void 0:o.entities,n,i==null?void 0:i.entities]),h=d.useCallback(g=>{if(!g)return;const x=Og(g);x&&e(i1(x))},[e]);return s||l?a.jsx(nn,{label:t("modelManager.model"),placeholder:"Loading...",disabled:!0,data:[]}):a.jsxs(L,{w:"100%",alignItems:"center",gap:3,children:[a.jsx(Et,{feature:"paramModel",children:a.jsx(nn,{tooltip:m==null?void 0:m.description,label:t("modelManager.model"),value:m==null?void 0:m.id,placeholder:p.length>0?"Select a model":"No models available",data:p,error:p.length===0,disabled:p.length===0,onChange:h,w:"100%"})}),r&&a.jsx(Ie,{mt:6,children:a.jsx(Gc,{iconMode:!0})})]})},oue=d.memo(rue),sue=ce(xe,({generation:e})=>{const{model:t,vae:n}=e;return{model:t,vae:n}},je),aue=()=>{const e=te(),{t}=Z(),{model:n,vae:r}=W(sue),{data:o}=jI(),s=d.useMemo(()=>{if(!o)return[];const u=[{value:"default",label:"Default",group:"Default"}];return $n(o.entities,(p,m)=>{if(!p)return;const h=(n==null?void 0:n.base_model)!==p.base_model;u.push({value:m,label:p.model_name,group:mn[p.base_model],disabled:h,tooltip:h?`Incompatible base model: ${p.base_model}`:void 0})}),u.sort((p,m)=>p.disabled&&!m.disabled?1:-1)},[o,n==null?void 0:n.base_model]),i=d.useMemo(()=>(o==null?void 0:o.entities[`${r==null?void 0:r.base_model}/vae/${r==null?void 0:r.model_name}`])??null,[o==null?void 0:o.entities,r]),l=d.useCallback(u=>{if(!u||u==="default"){e(ww(null));return}const p=_O(u);p&&e(ww(p))},[e]);return a.jsx(Et,{feature:"paramVAE",children:a.jsx(nn,{itemComponent:ci,tooltip:i==null?void 0:i.description,label:t("modelManager.vae"),value:(i==null?void 0:i.id)??"default",placeholder:"Default",data:s,onChange:l,disabled:s.length===0,clearable:!0})})},iue=d.memo(aue),lue=ce([EI,os],(e,t)=>{const{scheduler:n}=t,{favoriteSchedulers:r}=e,o=nr(mh,(s,i)=>({value:i,label:s,group:r.includes(i)?"Favorites":void 0})).sort((s,i)=>s.label.localeCompare(i.label));return{scheduler:n,data:o}},je),cue=()=>{const e=te(),{t}=Z(),{scheduler:n,data:r}=W(lue),o=d.useCallback(s=>{s&&e(l1(s))},[e]);return a.jsx(Et,{feature:"paramScheduler",children:a.jsx(nn,{label:t("parameters.scheduler"),value:n,data:r,onChange:o})})},uue=d.memo(cue),due=ce(xe,({generation:e})=>{const{vaePrecision:t}=e;return{vaePrecision:t}},je),fue=["fp16","fp32"],pue=()=>{const e=te(),{vaePrecision:t}=W(due),n=d.useCallback(r=>{r&&e(lT(r))},[e]);return a.jsx(Et,{feature:"paramVAEPrecision",children:a.jsx(On,{label:"VAE Precision",value:t,data:fue,onChange:n})})},mue=d.memo(pue),hue=()=>{const e=Bt("vae").isFeatureEnabled;return a.jsxs(L,{gap:3,w:"full",flexWrap:e?"wrap":"nowrap",children:[a.jsx(Ie,{w:"full",children:a.jsx(oue,{})}),a.jsx(Ie,{w:"full",children:a.jsx(uue,{})}),e&&a.jsxs(L,{w:"full",gap:3,children:[a.jsx(iue,{}),a.jsx(mue,{})]})]})},Is=d.memo(hue),AO=[{name:"Free",value:null},{name:"2:3",value:2/3},{name:"16:9",value:16/9},{name:"1:1",value:1/1}],TO=AO.map(e=>e.value);function NO(){const e=W(o=>o.generation.aspectRatio),t=te(),n=W(o=>o.generation.shouldFitToWidthHeight),r=W(Jn);return a.jsx(Vt,{isAttached:!0,children:AO.map(o=>a.jsx(at,{size:"sm",isChecked:e===o.value,isDisabled:r==="img2img"?!n:!1,onClick:()=>{t(zo(o.value)),t(qu(!1))},children:o.name},o.name))})}const gue=ce([xe],({generation:e,hotkeys:t,config:n})=>{const{min:r,sliderMax:o,inputMax:s,fineStep:i,coarseStep:l}=n.sd.height,{model:u,height:p}=e,{aspectRatio:m}=e,h=t.shift?i:l;return{model:u,height:p,min:r,sliderMax:o,inputMax:s,step:h,aspectRatio:m}},je),vue=e=>{const{model:t,height:n,min:r,sliderMax:o,inputMax:s,step:i,aspectRatio:l}=W(gue),u=te(),{t:p}=Z(),m=["sdxl","sdxl-refiner"].includes(t==null?void 0:t.base_model)?1024:512,h=d.useCallback(x=>{if(u(Hi(x)),l){const y=wr(x*l,8);u(Bi(y))}},[u,l]),g=d.useCallback(()=>{if(u(Hi(m)),l){const x=wr(m*l,8);u(Bi(x))}},[u,m,l]);return a.jsx(tt,{label:p("parameters.height"),value:n,min:r,step:i,max:o,onChange:h,handleReset:g,withInput:!0,withReset:!0,withSliderMarks:!0,sliderNumberInputProps:{max:s},...e})},xue=d.memo(vue),bue=ce([xe],({generation:e,hotkeys:t,config:n})=>{const{min:r,sliderMax:o,inputMax:s,fineStep:i,coarseStep:l}=n.sd.width,{model:u,width:p,aspectRatio:m}=e,h=t.shift?i:l;return{model:u,width:p,min:r,sliderMax:o,inputMax:s,step:h,aspectRatio:m}},je),yue=e=>{const{model:t,width:n,min:r,sliderMax:o,inputMax:s,step:i,aspectRatio:l}=W(bue),u=te(),{t:p}=Z(),m=["sdxl","sdxl-refiner"].includes(t==null?void 0:t.base_model)?1024:512,h=d.useCallback(x=>{if(u(Bi(x)),l){const y=wr(x/l,8);u(Hi(y))}},[u,l]),g=d.useCallback(()=>{if(u(Bi(m)),l){const x=wr(m/l,8);u(Hi(x))}},[u,m,l]);return a.jsx(tt,{label:p("parameters.width"),value:n,min:r,step:i,max:o,onChange:h,handleReset:g,withInput:!0,withReset:!0,withSliderMarks:!0,sliderNumberInputProps:{max:s},...e})},Cue=d.memo(yue),wue=ce([os,Jn],(e,t)=>{const{shouldFitToWidthHeight:n,shouldLockAspectRatio:r,width:o,height:s}=e;return{activeTabName:t,shouldFitToWidthHeight:n,shouldLockAspectRatio:r,width:o,height:s}},je);function Oc(){const{t:e}=Z(),t=te(),{activeTabName:n,shouldFitToWidthHeight:r,shouldLockAspectRatio:o,width:s,height:i}=W(wue),l=d.useCallback(()=>{o?(t(qu(!1)),TO.includes(s/i)?t(zo(s/i)):t(zo(null))):(t(qu(!0)),t(zo(s/i)))},[o,s,i,t]),u=d.useCallback(()=>{t(cT()),t(zo(null)),o&&t(zo(i/s))},[t,o,s,i]);return a.jsxs(L,{sx:{gap:2,p:4,borderRadius:4,flexDirection:"column",w:"full",bg:"base.150",_dark:{bg:"base.750"}},children:[a.jsx(Et,{feature:"paramRatio",children:a.jsxs(Kt,{as:L,flexDir:"row",alignItems:"center",gap:2,children:[a.jsx(wn,{children:e("parameters.aspectRatio")}),a.jsx(ba,{}),a.jsx(NO,{}),a.jsx(Fe,{tooltip:e("ui.swapSizes"),"aria-label":e("ui.swapSizes"),size:"sm",icon:a.jsx(z8,{}),fontSize:20,isDisabled:n==="img2img"?!r:!1,onClick:u}),a.jsx(Fe,{tooltip:e("ui.lockRatio"),"aria-label":e("ui.lockRatio"),size:"sm",icon:a.jsx(mM,{}),isChecked:o,isDisabled:n==="img2img"?!r:!1,onClick:l})]})}),a.jsx(L,{gap:2,alignItems:"center",children:a.jsxs(L,{gap:2,flexDirection:"column",width:"full",children:[a.jsx(Cue,{isDisabled:n==="img2img"?!r:!1}),a.jsx(xue,{isDisabled:n==="img2img"?!r:!1})]})})]})}const Sue=ce([xe],({generation:e,config:t,ui:n,hotkeys:r})=>{const{initial:o,min:s,sliderMax:i,inputMax:l,fineStep:u,coarseStep:p}=t.sd.steps,{steps:m}=e,{shouldUseSliders:h}=n,g=r.shift?u:p;return{steps:m,initial:o,min:s,sliderMax:i,inputMax:l,step:g,shouldUseSliders:h}},je),kue=()=>{const{steps:e,initial:t,min:n,sliderMax:r,inputMax:o,step:s,shouldUseSliders:i}=W(Sue),l=te(),{t:u}=Z(),p=d.useCallback(g=>{l(Yp(g))},[l]),m=d.useCallback(()=>{l(Yp(t))},[l,t]),h=d.useCallback(()=>{l(eb())},[l]);return i?a.jsx(Et,{feature:"paramSteps",children:a.jsx(tt,{label:u("parameters.steps"),min:n,max:r,step:s,onChange:p,handleReset:m,value:e,withInput:!0,withReset:!0,withSliderMarks:!0,sliderNumberInputProps:{max:o}})}):a.jsx(Et,{feature:"paramSteps",children:a.jsx(Kc,{label:u("parameters.steps"),min:n,max:o,step:s,onChange:p,value:e,numberInputFieldProps:{textAlign:"center"},onBlur:h})})},Ps=d.memo(kue);function $O(){const e=te(),t=W(o=>o.generation.shouldFitToWidthHeight),n=o=>e(uT(o.target.checked)),{t:r}=Z();return a.jsx(dn,{label:r("parameters.imageFit"),isChecked:t,onChange:n})}function jue(){const e=W(i=>i.generation.seed),t=W(i=>i.generation.shouldRandomizeSeed),n=W(i=>i.generation.shouldGenerateVariations),{t:r}=Z(),o=te(),s=i=>o(Xp(i));return a.jsx(Kc,{label:r("parameters.seed"),step:1,precision:0,flexGrow:1,min:MI,max:OI,isDisabled:t,isInvalid:e<0&&n,onChange:s,value:e})}const _ue=(e,t)=>Math.floor(Math.random()*(t-e+1)+e);function Iue(){const e=te(),t=W(o=>o.generation.shouldRandomizeSeed),{t:n}=Z(),r=()=>e(Xp(_ue(MI,OI)));return a.jsx(Fe,{size:"sm",isDisabled:t,"aria-label":n("parameters.shuffle"),tooltip:n("parameters.shuffle"),onClick:r,icon:a.jsx(ZJ,{})})}const Pue=()=>{const e=te(),{t}=Z(),n=W(o=>o.generation.shouldRandomizeSeed),r=o=>e(dT(o.target.checked));return a.jsx(dn,{label:t("common.random"),isChecked:n,onChange:r})},Eue=d.memo(Pue),Mue=()=>a.jsx(Et,{feature:"paramSeed",children:a.jsxs(L,{sx:{gap:3,alignItems:"flex-end"},children:[a.jsx(jue,{}),a.jsx(Iue,{}),a.jsx(Eue,{})]})}),Es=d.memo(Mue),LO=ke((e,t)=>a.jsxs(L,{ref:t,sx:{flexDir:"column",gap:2,bg:"base.100",px:4,pt:2,pb:4,borderRadius:"base",_dark:{bg:"base.750"}},children:[a.jsx(ve,{fontSize:"sm",fontWeight:"bold",sx:{color:"base.600",_dark:{color:"base.300"}},children:e.label}),e.children]}));LO.displayName="SubSettingsWrapper";const Rc=d.memo(LO),Oue=ce([xe],({sdxl:e})=>{const{sdxlImg2ImgDenoisingStrength:t}=e;return{sdxlImg2ImgDenoisingStrength:t}},je),Rue=()=>{const{sdxlImg2ImgDenoisingStrength:e}=W(Oue),t=te(),{t:n}=Z(),r=d.useCallback(s=>t(Sw(s)),[t]),o=d.useCallback(()=>{t(Sw(.7))},[t]);return a.jsx(Et,{feature:"paramDenoisingStrength",children:a.jsx(Rc,{children:a.jsx(tt,{label:n("sdxl.denoisingStrength"),step:.01,min:0,max:1,onChange:r,handleReset:o,value:e,isInteger:!1,withInput:!0,withSliderMarks:!0,withReset:!0})})})},zO=d.memo(Rue),Due=ce([EI,os],(e,t)=>{const{shouldUseSliders:n}=e,{shouldRandomizeSeed:r}=t;return{shouldUseSliders:n,activeLabel:r?void 0:"Manual Seed"}},je),Aue=()=>{const{shouldUseSliders:e,activeLabel:t}=W(Due);return a.jsx(oo,{label:"General",activeLabel:t,defaultIsOpen:!0,children:a.jsxs(L,{sx:{flexDirection:"column",gap:3},children:[e?a.jsxs(a.Fragment,{children:[a.jsx(rs,{}),a.jsx(Ps,{}),a.jsx(_s,{}),a.jsx(Is,{}),a.jsx(Ie,{pt:2,children:a.jsx(Es,{})}),a.jsx(Oc,{})]}):a.jsxs(a.Fragment,{children:[a.jsxs(L,{gap:3,children:[a.jsx(rs,{}),a.jsx(Ps,{}),a.jsx(_s,{})]}),a.jsx(Is,{}),a.jsx(Ie,{pt:2,children:a.jsx(Es,{})}),a.jsx(Oc,{})]}),a.jsx(zO,{}),a.jsx($O,{})]})})},Tue=d.memo(Aue),Nue=()=>a.jsxs(a.Fragment,{children:[a.jsx(o2,{}),a.jsx(Tue,{}),a.jsx(s2,{}),a.jsx(Yc,{}),a.jsx(Xc,{}),a.jsx(qc,{}),a.jsx(Qc,{})]}),$ue=d.memo(Nue),a2=()=>{const{t:e}=Z(),t=W(i=>i.generation.shouldRandomizeSeed),n=W(i=>i.generation.iterations),r=d.useMemo(()=>n===1?e("parameters.iterationsWithCount_one",{count:1}):e("parameters.iterationsWithCount_other",{count:n}),[n,e]),o=d.useMemo(()=>e(t?"parameters.randomSeed":"parameters.manualSeed"),[t,e]);return{iterationsAndSeedLabel:d.useMemo(()=>[r,o].join(", "),[r,o]),iterationsLabel:r,seedLabel:o}},Lue=()=>{const e=W(n=>n.ui.shouldUseSliders),{iterationsAndSeedLabel:t}=a2();return a.jsx(oo,{label:"General",activeLabel:t,defaultIsOpen:!0,children:a.jsx(L,{sx:{flexDirection:"column",gap:3},children:e?a.jsxs(a.Fragment,{children:[a.jsx(rs,{}),a.jsx(Ps,{}),a.jsx(_s,{}),a.jsx(Is,{}),a.jsx(Ie,{pt:2,children:a.jsx(Es,{})}),a.jsx(Oc,{})]}):a.jsxs(a.Fragment,{children:[a.jsxs(L,{gap:3,children:[a.jsx(rs,{}),a.jsx(Ps,{}),a.jsx(_s,{})]}),a.jsx(Is,{}),a.jsx(Ie,{pt:2,children:a.jsx(Es,{})}),a.jsx(Oc,{})]})})})},FO=d.memo(Lue),zue=()=>a.jsxs(a.Fragment,{children:[a.jsx(o2,{}),a.jsx(FO,{}),a.jsx(s2,{}),a.jsx(Yc,{}),a.jsx(Xc,{}),a.jsx(qc,{}),a.jsx(Qc,{})]}),Fue=d.memo(zue),Bue=[{label:"Unmasked",value:"unmasked"},{label:"Mask",value:"mask"},{label:"Mask Edge",value:"edge"}],Hue=()=>{const e=te(),t=W(o=>o.generation.canvasCoherenceMode),{t:n}=Z(),r=o=>{o&&e(fT(o))};return a.jsx(Et,{feature:"compositingCoherenceMode",children:a.jsx(On,{label:n("parameters.coherenceMode"),data:Bue,value:t,onChange:r})})},Vue=d.memo(Hue),Wue=()=>{const e=te(),t=W(r=>r.generation.canvasCoherenceSteps),{t:n}=Z();return a.jsx(Et,{feature:"compositingCoherenceSteps",children:a.jsx(tt,{label:n("parameters.coherenceSteps"),min:1,max:100,step:1,sliderNumberInputProps:{max:999},value:t,onChange:r=>{e(kw(r))},withInput:!0,withSliderMarks:!0,withReset:!0,handleReset:()=>{e(kw(20))}})})},Uue=d.memo(Wue),Gue=()=>{const e=te(),t=W(r=>r.generation.canvasCoherenceStrength),{t:n}=Z();return a.jsx(Et,{feature:"compositingStrength",children:a.jsx(tt,{label:n("parameters.coherenceStrength"),min:0,max:1,step:.01,sliderNumberInputProps:{max:999},value:t,onChange:r=>{e(jw(r))},withInput:!0,withSliderMarks:!0,withReset:!0,handleReset:()=>{e(jw(.3))}})})},Kue=d.memo(Gue);function que(){const e=te(),t=W(r=>r.generation.maskBlur),{t:n}=Z();return a.jsx(Et,{feature:"compositingBlur",children:a.jsx(tt,{label:n("parameters.maskBlur"),min:0,max:64,sliderNumberInputProps:{max:512},value:t,onChange:r=>{e(_w(r))},withInput:!0,withSliderMarks:!0,withReset:!0,handleReset:()=>{e(_w(16))}})})}const Xue=[{label:"Box Blur",value:"box"},{label:"Gaussian Blur",value:"gaussian"}];function Que(){const e=W(o=>o.generation.maskBlurMethod),t=te(),{t:n}=Z(),r=o=>{o&&t(pT(o))};return a.jsx(Et,{feature:"compositingBlurMethod",children:a.jsx(On,{value:e,onChange:r,label:n("parameters.maskBlurMethod"),data:Xue})})}const Yue=()=>{const{t:e}=Z();return a.jsx(oo,{label:e("parameters.compositingSettingsHeader"),children:a.jsxs(L,{sx:{flexDirection:"column",gap:2},children:[a.jsxs(Rc,{label:e("parameters.coherencePassHeader"),children:[a.jsx(Vue,{}),a.jsx(Uue,{}),a.jsx(Kue,{})]}),a.jsx(Yn,{}),a.jsxs(Rc,{label:e("parameters.maskAdjustmentsHeader"),children:[a.jsx(que,{}),a.jsx(Que,{})]})]})})},BO=d.memo(Yue),Zue=ce([xe],({generation:e})=>{const{infillMethod:t}=e;return{infillMethod:t}},je),Jue=()=>{const e=te(),{infillMethod:t}=W(Zue),{data:n,isLoading:r}=iI(),o=n==null?void 0:n.infill_methods,{t:s}=Z(),i=d.useCallback(l=>{e(mT(l))},[e]);return a.jsx(Et,{feature:"infillMethod",children:a.jsx(On,{disabled:(o==null?void 0:o.length)===0,placeholder:r?"Loading...":void 0,label:s("parameters.infillMethod"),value:t,data:o??[],onChange:i})})},ede=d.memo(Jue),tde=ce([os],e=>{const{infillPatchmatchDownscaleSize:t,infillMethod:n}=e;return{infillPatchmatchDownscaleSize:t,infillMethod:n}},je),nde=()=>{const e=te(),{infillPatchmatchDownscaleSize:t,infillMethod:n}=W(tde),{t:r}=Z(),o=d.useCallback(i=>{e(Iw(i))},[e]),s=d.useCallback(()=>{e(Iw(2))},[e]);return a.jsx(tt,{isDisabled:n!=="patchmatch",label:r("parameters.patchmatchDownScaleSize"),min:1,max:10,value:t,onChange:o,withInput:!0,withSliderMarks:!0,withReset:!0,handleReset:s})},rde=d.memo(nde),ode=ce([os],e=>{const{infillTileSize:t,infillMethod:n}=e;return{infillTileSize:t,infillMethod:n}},je),sde=()=>{const e=te(),{infillTileSize:t,infillMethod:n}=W(ode),{t:r}=Z(),o=d.useCallback(i=>{e(Pw(i))},[e]),s=d.useCallback(()=>{e(Pw(32))},[e]);return a.jsx(tt,{isDisabled:n!=="tile",label:r("parameters.tileSize"),min:16,max:64,sliderNumberInputProps:{max:256},value:t,onChange:o,withInput:!0,withSliderMarks:!0,withReset:!0,handleReset:s})},ade=d.memo(sde),ide=ce([os],e=>{const{infillMethod:t}=e;return{infillMethod:t}},je);function lde(){const{infillMethod:e}=W(ide);return a.jsxs(L,{children:[e==="tile"&&a.jsx(ade,{}),e==="patchmatch"&&a.jsx(rde,{})]})}const Sn=e=>e.canvas,Eo=ce([xe],({canvas:e})=>e.batchIds.length>0),cde=ce([Sn],e=>{const{boundingBoxScaleMethod:t}=e;return{boundingBoxScale:t}},je),ude=()=>{const e=te(),{boundingBoxScale:t}=W(cde),{t:n}=Z(),r=o=>{e(gT(o))};return a.jsx(Et,{feature:"scaleBeforeProcessing",children:a.jsx(nn,{label:n("parameters.scaleBeforeProcessing"),data:hT,value:t,onChange:r})})},dde=d.memo(ude),fde=ce([os,Sn],(e,t)=>{const{scaledBoundingBoxDimensions:n,boundingBoxScaleMethod:r}=t,{model:o,aspectRatio:s}=e;return{model:o,scaledBoundingBoxDimensions:n,isManual:r==="manual",aspectRatio:s}},je),pde=()=>{const e=te(),{model:t,isManual:n,scaledBoundingBoxDimensions:r,aspectRatio:o}=W(fde),s=["sdxl","sdxl-refiner"].includes(t==null?void 0:t.base_model)?1024:512,{t:i}=Z(),l=p=>{let m=r.width;const h=Math.floor(p);o&&(m=wr(h*o,64)),e(Jp({width:m,height:h}))},u=()=>{let p=r.width;const m=Math.floor(s);o&&(p=wr(m*o,64)),e(Jp({width:p,height:m}))};return a.jsx(tt,{isDisabled:!n,label:i("parameters.scaledHeight"),min:64,max:1536,step:64,value:r.height,onChange:l,sliderNumberInputProps:{max:4096},withSliderMarks:!0,withInput:!0,withReset:!0,handleReset:u})},mde=d.memo(pde),hde=ce([Sn,os],(e,t)=>{const{boundingBoxScaleMethod:n,scaledBoundingBoxDimensions:r}=e,{model:o,aspectRatio:s}=t;return{model:o,scaledBoundingBoxDimensions:r,aspectRatio:s,isManual:n==="manual"}},je),gde=()=>{const e=te(),{model:t,isManual:n,scaledBoundingBoxDimensions:r,aspectRatio:o}=W(hde),s=["sdxl","sdxl-refiner"].includes(t==null?void 0:t.base_model)?1024:512,{t:i}=Z(),l=p=>{const m=Math.floor(p);let h=r.height;o&&(h=wr(m/o,64)),e(Jp({width:m,height:h}))},u=()=>{const p=Math.floor(s);let m=r.height;o&&(m=wr(p/o,64)),e(Jp({width:p,height:m}))};return a.jsx(tt,{isDisabled:!n,label:i("parameters.scaledWidth"),min:64,max:1536,step:64,value:r.width,onChange:l,sliderNumberInputProps:{max:4096},withSliderMarks:!0,withInput:!0,withReset:!0,handleReset:u})},vde=d.memo(gde),xde=()=>{const{t:e}=Z();return a.jsx(oo,{label:e("parameters.infillScalingHeader"),children:a.jsxs(L,{sx:{gap:2,flexDirection:"column"},children:[a.jsxs(Rc,{children:[a.jsx(ede,{}),a.jsx(lde,{})]}),a.jsx(Yn,{}),a.jsxs(Rc,{children:[a.jsx(dde,{}),a.jsx(vde,{}),a.jsx(mde,{})]})]})})},HO=d.memo(xde),bde=ce([xe,Eo],({canvas:e,generation:t},n)=>{const{boundingBoxDimensions:r}=e,{model:o,aspectRatio:s}=t;return{model:o,boundingBoxDimensions:r,isStaging:n,aspectRatio:s}},je),yde=()=>{const e=te(),{model:t,boundingBoxDimensions:n,isStaging:r,aspectRatio:o}=W(bde),{t:s}=Z(),i=["sdxl","sdxl-refiner"].includes(t==null?void 0:t.base_model)?1024:512,l=p=>{if(e(Vo({...n,height:Math.floor(p)})),o){const m=wr(p*o,64);e(Vo({width:m,height:Math.floor(p)}))}},u=()=>{if(e(Vo({...n,height:Math.floor(i)})),o){const p=wr(i*o,64);e(Vo({width:p,height:Math.floor(i)}))}};return a.jsx(tt,{label:s("parameters.boundingBoxHeight"),min:64,max:1536,step:64,value:n.height,onChange:l,isDisabled:r,sliderNumberInputProps:{max:4096},withSliderMarks:!0,withInput:!0,withReset:!0,handleReset:u})},Cde=d.memo(yde),wde=ce([xe,Eo],({canvas:e,generation:t},n)=>{const{boundingBoxDimensions:r}=e,{model:o,aspectRatio:s}=t;return{model:o,boundingBoxDimensions:r,isStaging:n,aspectRatio:s}},je),Sde=()=>{const e=te(),{model:t,boundingBoxDimensions:n,isStaging:r,aspectRatio:o}=W(wde),s=["sdxl","sdxl-refiner"].includes(t==null?void 0:t.base_model)?1024:512,{t:i}=Z(),l=p=>{if(e(Vo({...n,width:Math.floor(p)})),o){const m=wr(p/o,64);e(Vo({width:Math.floor(p),height:m}))}},u=()=>{if(e(Vo({...n,width:Math.floor(s)})),o){const p=wr(s/o,64);e(Vo({width:Math.floor(s),height:p}))}};return a.jsx(tt,{label:i("parameters.boundingBoxWidth"),min:64,max:1536,step:64,value:n.width,onChange:l,isDisabled:r,sliderNumberInputProps:{max:4096},withSliderMarks:!0,withInput:!0,withReset:!0,handleReset:u})},kde=d.memo(Sde),jde=ce([os,Sn],(e,t)=>{const{shouldFitToWidthHeight:n,shouldLockAspectRatio:r}=e,{boundingBoxDimensions:o}=t;return{shouldFitToWidthHeight:n,shouldLockAspectRatio:r,boundingBoxDimensions:o}});function uh(){const e=te(),{t}=Z(),{shouldLockAspectRatio:n,boundingBoxDimensions:r}=W(jde),o=d.useCallback(()=>{n?(e(qu(!1)),TO.includes(r.width/r.height)?e(zo(r.width/r.height)):e(zo(null))):(e(qu(!0)),e(zo(r.width/r.height)))},[n,r,e]),s=d.useCallback(()=>{e(vT()),e(zo(null)),n&&e(zo(r.height/r.width))},[e,n,r]);return a.jsxs(L,{sx:{gap:2,p:4,borderRadius:4,flexDirection:"column",w:"full",bg:"base.100",_dark:{bg:"base.750"}},children:[a.jsx(Et,{feature:"paramRatio",children:a.jsxs(Kt,{as:L,flexDir:"row",alignItems:"center",gap:2,children:[a.jsx(wn,{children:t("parameters.aspectRatio")}),a.jsx(ba,{}),a.jsx(NO,{}),a.jsx(Fe,{tooltip:t("ui.swapSizes"),"aria-label":t("ui.swapSizes"),size:"sm",icon:a.jsx(z8,{}),fontSize:20,onClick:s}),a.jsx(Fe,{tooltip:t("ui.lockRatio"),"aria-label":t("ui.lockRatio"),size:"sm",icon:a.jsx(mM,{}),isChecked:n,onClick:o})]})}),a.jsx(kde,{}),a.jsx(Cde,{})]})}const _de=ce(xe,({ui:e,generation:t})=>{const{shouldUseSliders:n}=e,{shouldRandomizeSeed:r}=t;return{shouldUseSliders:n,activeLabel:r?void 0:"Manual Seed"}},je),Ide=()=>{const{shouldUseSliders:e,activeLabel:t}=W(_de);return a.jsx(oo,{label:"General",activeLabel:t,defaultIsOpen:!0,children:a.jsxs(L,{sx:{flexDirection:"column",gap:3},children:[e?a.jsxs(a.Fragment,{children:[a.jsx(rs,{}),a.jsx(Ps,{}),a.jsx(_s,{}),a.jsx(Is,{}),a.jsx(Ie,{pt:2,children:a.jsx(Es,{})}),a.jsx(uh,{})]}):a.jsxs(a.Fragment,{children:[a.jsxs(L,{gap:3,children:[a.jsx(rs,{}),a.jsx(Ps,{}),a.jsx(_s,{})]}),a.jsx(Is,{}),a.jsx(Ie,{pt:2,children:a.jsx(Es,{})}),a.jsx(uh,{})]}),a.jsx(zO,{})]})})},Pde=d.memo(Ide);function Ede(){return a.jsxs(a.Fragment,{children:[a.jsx(o2,{}),a.jsx(Pde,{}),a.jsx(s2,{}),a.jsx(Yc,{}),a.jsx(Xc,{}),a.jsx(qc,{}),a.jsx(HO,{}),a.jsx(BO,{}),a.jsx(Qc,{})]})}function i2(){return a.jsxs(L,{sx:{flexDirection:"column",gap:2},children:[a.jsx(RO,{}),a.jsx(OO,{})]})}function Mde(){const e=W(o=>o.generation.horizontalSymmetrySteps),t=W(o=>o.generation.steps),n=te(),{t:r}=Z();return a.jsx(tt,{label:r("parameters.hSymmetryStep"),value:e,onChange:o=>n(Ew(o)),min:0,max:t,step:1,withInput:!0,withSliderMarks:!0,withReset:!0,handleReset:()=>n(Ew(0))})}function Ode(){const e=W(o=>o.generation.verticalSymmetrySteps),t=W(o=>o.generation.steps),n=te(),{t:r}=Z();return a.jsx(tt,{label:r("parameters.vSymmetryStep"),value:e,onChange:o=>n(Mw(o)),min:0,max:t,step:1,withInput:!0,withSliderMarks:!0,withReset:!0,handleReset:()=>n(Mw(0))})}function Rde(){const e=W(n=>n.generation.shouldUseSymmetry),t=te();return a.jsx(dn,{label:"Enable Symmetry",isChecked:e,onChange:n=>t(xT(n.target.checked))})}const Dde=ce(xe,e=>({activeLabel:e.generation.shouldUseSymmetry?"Enabled":void 0}),je),Ade=()=>{const{t:e}=Z(),{activeLabel:t}=W(Dde);return Bt("symmetry").isFeatureEnabled?a.jsx(oo,{label:e("parameters.symmetry"),activeLabel:t,children:a.jsxs(L,{sx:{gap:2,flexDirection:"column"},children:[a.jsx(Rde,{}),a.jsx(Mde,{}),a.jsx(Ode,{})]})}):null},l2=d.memo(Ade),Tde=ce([xe],({generation:e,hotkeys:t,config:n})=>{const{initial:r,min:o,sliderMax:s,inputMax:i,fineStep:l,coarseStep:u}=n.sd.img2imgStrength,{img2imgStrength:p}=e,m=t.shift?l:u;return{img2imgStrength:p,initial:r,min:o,sliderMax:s,inputMax:i,step:m}},je),Nde=()=>{const{img2imgStrength:e,initial:t,min:n,sliderMax:r,inputMax:o,step:s}=W(Tde),i=te(),{t:l}=Z(),u=d.useCallback(m=>i(Zp(m)),[i]),p=d.useCallback(()=>{i(Zp(t))},[i,t]);return a.jsx(Et,{feature:"paramDenoisingStrength",children:a.jsx(Rc,{children:a.jsx(tt,{label:`${l("parameters.denoisingStrength")}`,step:s,min:n,max:r,onChange:u,handleReset:p,value:e,isInteger:!1,withInput:!0,withSliderMarks:!0,withReset:!0,sliderNumberInputProps:{max:o}})})})},VO=d.memo(Nde),$de=()=>{const e=W(n=>n.ui.shouldUseSliders),{iterationsAndSeedLabel:t}=a2();return a.jsx(oo,{label:"General",activeLabel:t,defaultIsOpen:!0,children:a.jsxs(L,{sx:{flexDirection:"column",gap:3},children:[e?a.jsxs(a.Fragment,{children:[a.jsx(rs,{}),a.jsx(Ps,{}),a.jsx(_s,{}),a.jsx(Is,{}),a.jsx(Ie,{pt:2,children:a.jsx(Es,{})}),a.jsx(Oc,{})]}):a.jsxs(a.Fragment,{children:[a.jsxs(L,{gap:3,children:[a.jsx(rs,{}),a.jsx(Ps,{}),a.jsx(_s,{})]}),a.jsx(Is,{}),a.jsx(Ie,{pt:2,children:a.jsx(Es,{})}),a.jsx(Oc,{})]}),a.jsx(VO,{}),a.jsx($O,{})]})})},Lde=d.memo($de),zde=()=>a.jsxs(a.Fragment,{children:[a.jsx(i2,{}),a.jsx(Lde,{}),a.jsx(Yc,{}),a.jsx(Xc,{}),a.jsx(qc,{}),a.jsx(l2,{}),a.jsx(Qc,{})]}),Fde=d.memo(zde),Bde=()=>a.jsxs(a.Fragment,{children:[a.jsx(i2,{}),a.jsx(FO,{}),a.jsx(Yc,{}),a.jsx(Xc,{}),a.jsx(qc,{}),a.jsx(l2,{}),a.jsx(Qc,{})]}),Hde=d.memo(Bde),Vde=()=>{const e=W(n=>n.ui.shouldUseSliders),{iterationsAndSeedLabel:t}=a2();return a.jsx(oo,{label:"General",activeLabel:t,defaultIsOpen:!0,children:a.jsxs(L,{sx:{flexDirection:"column",gap:3},children:[e?a.jsxs(a.Fragment,{children:[a.jsx(rs,{}),a.jsx(Ps,{}),a.jsx(_s,{}),a.jsx(Is,{}),a.jsx(Ie,{pt:2,children:a.jsx(Es,{})}),a.jsx(uh,{})]}):a.jsxs(a.Fragment,{children:[a.jsxs(L,{gap:3,children:[a.jsx(rs,{}),a.jsx(Ps,{}),a.jsx(_s,{})]}),a.jsx(Is,{}),a.jsx(Ie,{pt:2,children:a.jsx(Es,{})}),a.jsx(uh,{})]}),a.jsx(VO,{})]})})},Wde=d.memo(Vde),Ude=()=>a.jsxs(a.Fragment,{children:[a.jsx(i2,{}),a.jsx(Wde,{}),a.jsx(Yc,{}),a.jsx(Xc,{}),a.jsx(qc,{}),a.jsx(l2,{}),a.jsx(HO,{}),a.jsx(BO,{}),a.jsx(Qc,{})]}),Gde=d.memo(Ude),Kde=()=>{const e=W(Jn),t=W(n=>n.generation.model);return e==="txt2img"?a.jsx(Kp,{children:t&&t.base_model==="sdxl"?a.jsx(Fue,{}):a.jsx(Hde,{})}):e==="img2img"?a.jsx(Kp,{children:t&&t.base_model==="sdxl"?a.jsx($ue,{}):a.jsx(Fde,{})}):e==="unifiedCanvas"?a.jsx(Kp,{children:t&&t.base_model==="sdxl"?a.jsx(Ede,{}):a.jsx(Gde,{})}):null},qde=d.memo(Kde),Kp=d.memo(e=>a.jsxs(L,{sx:{w:"full",h:"full",flexDir:"column",gap:2},children:[a.jsx(Q8,{}),a.jsx(L,{layerStyle:"first",sx:{w:"full",h:"full",position:"relative",borderRadius:"base",p:2},children:a.jsx(L,{sx:{w:"full",h:"full",position:"relative"},children:a.jsx(Ie,{sx:{position:"absolute",top:0,left:0,right:0,bottom:0},children:a.jsx(hg,{defer:!0,style:{height:"100%",width:"100%"},options:{scrollbars:{visibility:"auto",autoHide:"scroll",autoHideDelay:800,theme:"os-theme-dark"},overflow:{x:"hidden"}},children:a.jsx(L,{sx:{gap:2,flexDirection:"column",h:"full",w:"full"},children:e.children})})})})})]}));Kp.displayName="ParametersPanelWrapper";const Xde=ce([xe],e=>{const{initialImage:t}=e.generation;return{initialImage:t,isResetButtonDisabled:!t}},je),Qde=()=>{const{initialImage:e}=W(Xde),{currentData:t}=to((e==null?void 0:e.imageName)??$r.skipToken),n=d.useMemo(()=>{if(t)return{id:"initial-image",payloadType:"IMAGE_DTO",payload:{imageDTO:t}}},[t]),r=d.useMemo(()=>({id:"initial-image",actionType:"SET_INITIAL_IMAGE"}),[]);return a.jsx(ua,{imageDTO:t,droppableData:r,draggableData:n,isUploadDisabled:!0,fitContainer:!0,dropLabel:"Set as Initial Image",noContentFallback:a.jsx(Zn,{label:"No initial image selected"}),dataTestId:"initial-image"})},Yde=d.memo(Qde),Zde=ce([xe],e=>{const{initialImage:t}=e.generation;return{isResetButtonDisabled:!t}},je),Jde={type:"SET_INITIAL_IMAGE"},efe=()=>{const{isResetButtonDisabled:e}=W(Zde),t=te(),{getUploadButtonProps:n,getUploadInputProps:r}=Vy({postUploadAction:Jde}),o=d.useCallback(()=>{t(bT())},[t]);return a.jsxs(L,{layerStyle:"first",sx:{position:"relative",flexDirection:"column",height:"full",width:"full",alignItems:"center",justifyContent:"center",borderRadius:"base",p:2,gap:4},children:[a.jsxs(L,{sx:{w:"full",flexWrap:"wrap",justifyContent:"center",alignItems:"center",gap:2},children:[a.jsx(ve,{sx:{ps:2,fontWeight:600,userSelect:"none",color:"base.700",_dark:{color:"base.200"}},children:"Initial Image"}),a.jsx(ba,{}),a.jsx(Fe,{tooltip:"Upload Initial Image","aria-label":"Upload Initial Image",icon:a.jsx(cg,{}),...n()}),a.jsx(Fe,{tooltip:"Reset Initial Image","aria-label":"Reset Initial Image",icon:a.jsx(Ud,{}),onClick:o,isDisabled:e})]}),a.jsx(Yde,{}),a.jsx("input",{...r()})]})},tfe=d.memo(efe),nfe=e=>{const{onClick:t,isDisabled:n}=e,{t:r}=Z(),o=W(s=>s.system.isConnected);return a.jsx(Fe,{onClick:t,icon:a.jsx(Br,{}),tooltip:`${r("gallery.deleteImage")} (Del)`,"aria-label":`${r("gallery.deleteImage")} (Del)`,isDisabled:n||!o,colorScheme:"error"})},WO=()=>{const[e,{isLoading:t}]=bh({fixedCacheKey:"enqueueBatch"}),[n,{isLoading:r}]=yT({fixedCacheKey:"enqueueGraph"}),[o,{isLoading:s}]=SI({fixedCacheKey:"resumeProcessor"}),[i,{isLoading:l}]=CI({fixedCacheKey:"pauseProcessor"}),[u,{isLoading:p}]=Yx({fixedCacheKey:"cancelQueueItem"}),[m,{isLoading:h}]=yI({fixedCacheKey:"clearQueue"}),[g,{isLoading:x}]=RI({fixedCacheKey:"pruneQueue"});return t||r||s||l||p||h||x},rfe=[{label:"RealESRGAN x2 Plus",value:"RealESRGAN_x2plus.pth",tooltip:"Attempts to retain sharpness, low smoothing",group:"x2 Upscalers"},{label:"RealESRGAN x4 Plus",value:"RealESRGAN_x4plus.pth",tooltip:"Best for photos and highly detailed images, medium smoothing",group:"x4 Upscalers"},{label:"RealESRGAN x4 Plus (anime 6B)",value:"RealESRGAN_x4plus_anime_6B.pth",tooltip:"Best for anime/manga, high smoothing",group:"x4 Upscalers"},{label:"ESRGAN SRx4",value:"ESRGAN_SRx4_DF2KOST_official-ff704c30.pth",tooltip:"Retains sharpness, low smoothing",group:"x4 Upscalers"}];function ofe(){const e=W(r=>r.postprocessing.esrganModelName),t=te(),n=r=>t(CT(r));return a.jsx(On,{label:"ESRGAN Model",value:e,itemComponent:ci,onChange:n,data:rfe})}const sfe=e=>{const{imageDTO:t}=e,n=te(),r=WO(),{t:o}=Z(),{isOpen:s,onOpen:i,onClose:l}=Lr(),{isAllowedToUpscale:u,detail:p}=wT(t),m=d.useCallback(()=>{l(),!(!t||!u)&&n(DI({imageDTO:t}))},[n,t,u,l]);return a.jsx(qd,{isOpen:s,onClose:l,triggerComponent:a.jsx(Fe,{tooltip:o("parameters.upscale"),onClick:i,icon:a.jsx(uM,{}),"aria-label":o("parameters.upscale")}),children:a.jsxs(L,{sx:{flexDirection:"column",gap:4},children:[a.jsx(ofe,{}),a.jsx(at,{tooltip:p,size:"sm",isDisabled:!t||r||!u,onClick:m,children:o("parameters.upscaleImage")})]})})},afe=d.memo(sfe),ife=ce([xe,Jn],({gallery:e,system:t,ui:n,config:r},o)=>{const{isConnected:s,shouldConfirmOnDelete:i,denoiseProgress:l}=t,{shouldShowImageDetails:u,shouldHidePreview:p,shouldShowProgressInViewer:m}=n,{shouldFetchMetadataFromApi:h}=r,g=e.selection[e.selection.length-1];return{shouldConfirmOnDelete:i,isConnected:s,shouldDisableToolbarButtons:!!(l!=null&&l.progress_image)||!g,shouldShowImageDetails:u,activeTabName:o,shouldHidePreview:p,shouldShowProgressInViewer:m,lastSelectedImage:g,shouldFetchMetadataFromApi:h}},{memoizeOptions:{resultEqualityCheck:Ft}}),lfe=e=>{const t=te(),{isConnected:n,shouldDisableToolbarButtons:r,shouldShowImageDetails:o,lastSelectedImage:s,shouldShowProgressInViewer:i,shouldFetchMetadataFromApi:l}=W(ife),u=Bt("upscaling").isFeatureEnabled,p=WO(),m=sl(),{t:h}=Z(),{recallBothPrompts:g,recallSeed:x,recallAllParameters:y}=Sg(),{currentData:b}=to((s==null?void 0:s.image_name)??$r.skipToken),w=d.useMemo(()=>s?{image:s,shouldFetchMetadataFromApi:l}:$r.skipToken,[s,l]),{metadata:S,workflow:j,isLoading:_}=Gx(w,{selectFromResult:B=>{var V,U;return{isLoading:B.isFetching,metadata:(V=B==null?void 0:B.currentData)==null?void 0:V.metadata,workflow:(U=B==null?void 0:B.currentData)==null?void 0:U.workflow}}}),E=d.useCallback(()=>{j&&t(Xx(j))},[t,j]),I=d.useCallback(()=>{y(S)},[S,y]);et("a",()=>{},[S,y]);const M=d.useCallback(()=>{x(S==null?void 0:S.seed)},[S==null?void 0:S.seed,x]);et("s",M,[b]);const R=d.useCallback(()=>{g(S==null?void 0:S.positive_prompt,S==null?void 0:S.negative_prompt,S==null?void 0:S.positive_style_prompt,S==null?void 0:S.negative_style_prompt)},[S==null?void 0:S.negative_prompt,S==null?void 0:S.positive_prompt,S==null?void 0:S.positive_style_prompt,S==null?void 0:S.negative_style_prompt,g]);et("p",R,[b]),et("w",E,[j]);const D=d.useCallback(()=>{t(F8()),t(vh(b))},[t,b]);et("shift+i",D,[b]);const A=d.useCallback(()=>{b&&t(DI({imageDTO:b}))},[t,b]),O=d.useCallback(()=>{b&&t(xh([b]))},[t,b]);et("Shift+U",()=>{A()},{enabled:()=>!!(u&&!r&&n)},[u,b,r,n]);const T=d.useCallback(()=>t(ST(!o)),[t,o]);et("i",()=>{b?T():m({title:h("toast.metadataLoadFailed"),status:"error",duration:2500,isClosable:!0})},[b,o,m]),et("delete",()=>{O()},[t,b]);const X=d.useCallback(()=>{t(lI(!i))},[t,i]);return a.jsx(a.Fragment,{children:a.jsxs(L,{sx:{flexWrap:"wrap",justifyContent:"center",alignItems:"center",gap:2},...e,children:[a.jsx(Vt,{isAttached:!0,isDisabled:r,children:a.jsxs(Ah,{children:[a.jsx(Th,{as:Fe,"aria-label":h("parameters.imageActions"),tooltip:h("parameters.imageActions"),isDisabled:!b,icon:a.jsx(xoe,{})}),a.jsx(Ui,{motionProps:vc,children:b&&a.jsx(B8,{imageDTO:b})})]})}),a.jsxs(Vt,{isAttached:!0,isDisabled:r,children:[a.jsx(Fe,{isLoading:_,icon:a.jsx(Wy,{}),tooltip:`${h("nodes.loadWorkflow")} (W)`,"aria-label":`${h("nodes.loadWorkflow")} (W)`,isDisabled:!j,onClick:E}),a.jsx(Fe,{isLoading:_,icon:a.jsx(gM,{}),tooltip:`${h("parameters.usePrompt")} (P)`,"aria-label":`${h("parameters.usePrompt")} (P)`,isDisabled:!(S!=null&&S.positive_prompt),onClick:R}),a.jsx(Fe,{isLoading:_,icon:a.jsx(vM,{}),tooltip:`${h("parameters.useSeed")} (S)`,"aria-label":`${h("parameters.useSeed")} (S)`,isDisabled:(S==null?void 0:S.seed)===null||(S==null?void 0:S.seed)===void 0,onClick:M}),a.jsx(Fe,{isLoading:_,icon:a.jsx(aM,{}),tooltip:`${h("parameters.useAll")} (A)`,"aria-label":`${h("parameters.useAll")} (A)`,isDisabled:!S,onClick:I})]}),u&&a.jsx(Vt,{isAttached:!0,isDisabled:p,children:u&&a.jsx(afe,{imageDTO:b})}),a.jsx(Vt,{isAttached:!0,children:a.jsx(Fe,{icon:a.jsx(lM,{}),tooltip:`${h("parameters.info")} (I)`,"aria-label":`${h("parameters.info")} (I)`,isChecked:o,onClick:T})}),a.jsx(Vt,{isAttached:!0,children:a.jsx(Fe,{"aria-label":h("settings.displayInProgress"),tooltip:h("settings.displayInProgress"),icon:a.jsx(VJ,{}),isChecked:i,onClick:X})}),a.jsx(Vt,{isAttached:!0,children:a.jsx(nfe,{onClick:O})})]})})},cfe=d.memo(lfe),ufe=ce([xe,Qx],(e,t)=>{var j,_;const{data:n,status:r}=kT.endpoints.listImages.select(t)(e),{data:o}=e.gallery.galleryView==="images"?Ow.endpoints.getBoardImagesTotal.select(t.board_id??"none")(e):Ow.endpoints.getBoardAssetsTotal.select(t.board_id??"none")(e),s=e.gallery.selection[e.gallery.selection.length-1],i=r==="pending";if(!n||!s||o===0)return{isFetching:i,queryArgs:t,isOnFirstImage:!0,isOnLastImage:!0};const l={...t,offset:n.ids.length,limit:bI},u=jT.getSelectors(),p=u.selectAll(n),m=p.findIndex(E=>E.image_name===s.image_name),h=Fi(m+1,0,p.length-1),g=Fi(m-1,0,p.length-1),x=(j=p[h])==null?void 0:j.image_name,y=(_=p[g])==null?void 0:_.image_name,b=x?u.selectById(n,x):void 0,w=y?u.selectById(n,y):void 0,S=p.length;return{loadedImagesCount:p.length,currentImageIndex:m,areMoreImagesAvailable:(o??0)>S,isFetching:r==="pending",nextImage:b,prevImage:w,queryArgs:l}},{memoizeOptions:{resultEqualityCheck:Ft}}),UO=()=>{const e=te(),{nextImage:t,prevImage:n,areMoreImagesAvailable:r,isFetching:o,queryArgs:s,loadedImagesCount:i,currentImageIndex:l}=W(ufe),u=d.useCallback(()=>{n&&e(Rw(n))},[e,n]),p=d.useCallback(()=>{t&&e(Rw(t))},[e,t]),[m]=xI(),h=d.useCallback(()=>{m(s)},[m,s]);return{handlePrevImage:u,handleNextImage:p,isOnFirstImage:l===0,isOnLastImage:l!==void 0&&l===i-1,nextImage:t,prevImage:n,areMoreImagesAvailable:r,handleLoadMoreImages:h,isFetching:o}};function dfe(e){return Te({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M245.09 327.74v-37.32c57.07 0 84.51 13.47 108.58 38.68 5.4 5.65 15 1.32 14.29-6.43-5.45-61.45-34.14-117.09-122.87-117.09v-37.32a8.32 8.32 0 00-14.05-6L146.58 242a8.2 8.2 0 000 11.94L231 333.71a8.32 8.32 0 0014.09-5.97z"}},{tag:"path",attr:{fill:"none",strokeMiterlimit:"10",strokeWidth:"32",d:"M256 64C150 64 64 150 64 256s86 192 192 192 192-86 192-192S362 64 256 64z"}}]})(e)}const ffe=({label:e,value:t,onClick:n,isLink:r,labelPosition:o,withCopy:s=!1})=>{const{t:i}=Z();return t?a.jsxs(L,{gap:2,children:[n&&a.jsx(Ht,{label:`Recall ${e}`,children:a.jsx(ys,{"aria-label":i("accessibility.useThisParameter"),icon:a.jsx(dfe,{}),size:"xs",variant:"ghost",fontSize:20,onClick:n})}),s&&a.jsx(Ht,{label:`Copy ${e}`,children:a.jsx(ys,{"aria-label":`Copy ${e}`,icon:a.jsx(Hc,{}),size:"xs",variant:"ghost",fontSize:14,onClick:()=>navigator.clipboard.writeText(t.toString())})}),a.jsxs(L,{direction:o?"column":"row",children:[a.jsxs(ve,{fontWeight:"semibold",whiteSpace:"pre-wrap",pr:2,children:[e,":"]}),r?a.jsxs(Oh,{href:t.toString(),isExternal:!0,wordBreak:"break-all",children:[t.toString()," ",a.jsx(JM,{mx:"2px"})]}):a.jsx(ve,{overflowY:"scroll",wordBreak:"break-all",children:t.toString()})]})]}):null},xr=d.memo(ffe),pfe=e=>{const{metadata:t}=e,{t:n}=Z(),{recallPositivePrompt:r,recallNegativePrompt:o,recallSeed:s,recallCfgScale:i,recallModel:l,recallScheduler:u,recallSteps:p,recallWidth:m,recallHeight:h,recallStrength:g,recallLoRA:x,recallControlNet:y,recallIPAdapter:b}=Sg(),w=d.useCallback(()=>{r(t==null?void 0:t.positive_prompt)},[t==null?void 0:t.positive_prompt,r]),S=d.useCallback(()=>{o(t==null?void 0:t.negative_prompt)},[t==null?void 0:t.negative_prompt,o]),j=d.useCallback(()=>{s(t==null?void 0:t.seed)},[t==null?void 0:t.seed,s]),_=d.useCallback(()=>{l(t==null?void 0:t.model)},[t==null?void 0:t.model,l]),E=d.useCallback(()=>{m(t==null?void 0:t.width)},[t==null?void 0:t.width,m]),I=d.useCallback(()=>{h(t==null?void 0:t.height)},[t==null?void 0:t.height,h]),M=d.useCallback(()=>{u(t==null?void 0:t.scheduler)},[t==null?void 0:t.scheduler,u]),R=d.useCallback(()=>{p(t==null?void 0:t.steps)},[t==null?void 0:t.steps,p]),D=d.useCallback(()=>{i(t==null?void 0:t.cfg_scale)},[t==null?void 0:t.cfg_scale,i]),A=d.useCallback(()=>{g(t==null?void 0:t.strength)},[t==null?void 0:t.strength,g]),O=d.useCallback(U=>{x(U)},[x]),T=d.useCallback(U=>{y(U)},[y]),X=d.useCallback(U=>{b(U)},[b]),B=d.useMemo(()=>t!=null&&t.controlnets?t.controlnets.filter(U=>c1(U.control_model)):[],[t==null?void 0:t.controlnets]),V=d.useMemo(()=>t!=null&&t.ipAdapters?t.ipAdapters.filter(U=>c1(U.ip_adapter_model)):[],[t==null?void 0:t.ipAdapters]);return!t||Object.keys(t).length===0?null:a.jsxs(a.Fragment,{children:[t.created_by&&a.jsx(xr,{label:n("metadata.createdBy"),value:t.created_by}),t.generation_mode&&a.jsx(xr,{label:n("metadata.generationMode"),value:t.generation_mode}),t.positive_prompt&&a.jsx(xr,{label:n("metadata.positivePrompt"),labelPosition:"top",value:t.positive_prompt,onClick:w}),t.negative_prompt&&a.jsx(xr,{label:n("metadata.negativePrompt"),labelPosition:"top",value:t.negative_prompt,onClick:S}),t.seed!==void 0&&t.seed!==null&&a.jsx(xr,{label:n("metadata.seed"),value:t.seed,onClick:j}),t.model!==void 0&&t.model!==null&&t.model.model_name&&a.jsx(xr,{label:n("metadata.model"),value:t.model.model_name,onClick:_}),t.width&&a.jsx(xr,{label:n("metadata.width"),value:t.width,onClick:E}),t.height&&a.jsx(xr,{label:n("metadata.height"),value:t.height,onClick:I}),t.scheduler&&a.jsx(xr,{label:n("metadata.scheduler"),value:t.scheduler,onClick:M}),t.steps&&a.jsx(xr,{label:n("metadata.steps"),value:t.steps,onClick:R}),t.cfg_scale!==void 0&&t.cfg_scale!==null&&a.jsx(xr,{label:n("metadata.cfgScale"),value:t.cfg_scale,onClick:D}),t.strength&&a.jsx(xr,{label:n("metadata.strength"),value:t.strength,onClick:A}),t.loras&&t.loras.map((U,N)=>{if(fI(U.lora))return a.jsx(xr,{label:"LoRA",value:`${U.lora.model_name} - ${U.weight}`,onClick:()=>O(U)},N)}),B.map((U,N)=>{var $;return a.jsx(xr,{label:"ControlNet",value:`${($=U.control_model)==null?void 0:$.model_name} - ${U.control_weight}`,onClick:()=>T(U)},N)}),V.map((U,N)=>{var $;return a.jsx(xr,{label:"IP Adapter",value:`${($=U.ip_adapter_model)==null?void 0:$.model_name} - ${U.weight}`,onClick:()=>X(U)},N)})]})},mfe=d.memo(pfe),hfe=({image:e})=>{const{t}=Z(),{shouldFetchMetadataFromApi:n}=W(Ky),{metadata:r,workflow:o}=Gx({image:e,shouldFetchMetadataFromApi:n},{selectFromResult:s=>{var i,l;return{metadata:(i=s==null?void 0:s.currentData)==null?void 0:i.metadata,workflow:(l=s==null?void 0:s.currentData)==null?void 0:l.workflow}}});return a.jsxs(L,{layerStyle:"first",sx:{padding:4,gap:1,flexDirection:"column",width:"full",height:"full",borderRadius:"base",position:"absolute",overflow:"hidden"},children:[a.jsxs(L,{gap:2,children:[a.jsx(ve,{fontWeight:"semibold",children:"File:"}),a.jsxs(Oh,{href:e.image_url,isExternal:!0,maxW:"calc(100% - 3rem)",children:[e.image_name,a.jsx(JM,{mx:"2px"})]})]}),a.jsx(mfe,{metadata:r}),a.jsxs(rl,{variant:"line",sx:{display:"flex",flexDir:"column",w:"full",h:"full"},children:[a.jsxs(ol,{children:[a.jsx(Tr,{children:t("metadata.metadata")}),a.jsx(Tr,{children:t("metadata.imageDetails")}),a.jsx(Tr,{children:t("metadata.workflow")})]}),a.jsxs(zc,{children:[a.jsx(So,{children:r?a.jsx(Ya,{data:r,label:t("metadata.metadata")}):a.jsx(Zn,{label:t("metadata.noMetaData")})}),a.jsx(So,{children:e?a.jsx(Ya,{data:e,label:t("metadata.imageDetails")}):a.jsx(Zn,{label:t("metadata.noImageDetails")})}),a.jsx(So,{children:o?a.jsx(Ya,{data:o,label:t("metadata.workflow")}):a.jsx(Zn,{label:t("nodes.noWorkflow")})})]})]})]})},gfe=d.memo(hfe),Yv={color:"base.100",pointerEvents:"auto"},vfe=()=>{const{t:e}=Z(),{handlePrevImage:t,handleNextImage:n,isOnFirstImage:r,isOnLastImage:o,handleLoadMoreImages:s,areMoreImagesAvailable:i,isFetching:l}=UO();return a.jsxs(Ie,{sx:{position:"relative",height:"100%",width:"100%"},children:[a.jsx(Ie,{sx:{pos:"absolute",top:"50%",transform:"translate(0, -50%)",insetInlineStart:0},children:!r&&a.jsx(ys,{"aria-label":e("accessibility.previousImage"),icon:a.jsx(kJ,{size:64}),variant:"unstyled",onClick:t,boxSize:16,sx:Yv})}),a.jsxs(Ie,{sx:{pos:"absolute",top:"50%",transform:"translate(0, -50%)",insetInlineEnd:0},children:[!o&&a.jsx(ys,{"aria-label":e("accessibility.nextImage"),icon:a.jsx(jJ,{size:64}),variant:"unstyled",onClick:n,boxSize:16,sx:Yv}),o&&i&&!l&&a.jsx(ys,{"aria-label":e("accessibility.loadMore"),icon:a.jsx(SJ,{size:64}),variant:"unstyled",onClick:s,boxSize:16,sx:Yv}),o&&i&&l&&a.jsx(L,{sx:{w:16,h:16,alignItems:"center",justifyContent:"center"},children:a.jsx(fa,{opacity:.5,size:"xl"})})]})]})},GO=d.memo(vfe),xfe=ce([xe,_T],({ui:e,system:t},n)=>{const{shouldShowImageDetails:r,shouldHidePreview:o,shouldShowProgressInViewer:s}=e,{denoiseProgress:i,shouldAntialiasProgressImage:l}=t;return{shouldShowImageDetails:r,shouldHidePreview:o,imageName:n==null?void 0:n.image_name,denoiseProgress:i,shouldShowProgressInViewer:s,shouldAntialiasProgressImage:l}},{memoizeOptions:{resultEqualityCheck:Ft}}),bfe=()=>{const{shouldShowImageDetails:e,imageName:t,denoiseProgress:n,shouldShowProgressInViewer:r,shouldAntialiasProgressImage:o}=W(xfe),{handlePrevImage:s,handleNextImage:i,isOnLastImage:l,handleLoadMoreImages:u,areMoreImagesAvailable:p,isFetching:m}=UO();et("left",()=>{s()},[s]),et("right",()=>{if(l&&p&&!m){u();return}l||i()},[l,p,u,m,i]);const{currentData:h}=to(t??$r.skipToken),g=d.useMemo(()=>{if(h)return{id:"current-image",payloadType:"IMAGE_DTO",payload:{imageDTO:h}}},[h]),x=d.useMemo(()=>({id:"current-image",actionType:"SET_CURRENT_IMAGE"}),[]),[y,b]=d.useState(!1),w=d.useRef(0),{t:S}=Z(),j=d.useCallback(()=>{b(!0),window.clearTimeout(w.current)},[]),_=d.useCallback(()=>{w.current=window.setTimeout(()=>{b(!1)},500)},[]);return a.jsxs(L,{onMouseOver:j,onMouseOut:_,sx:{width:"full",height:"full",alignItems:"center",justifyContent:"center",position:"relative"},children:[n!=null&&n.progress_image&&r?a.jsx(ga,{src:n.progress_image.dataURL,width:n.progress_image.width,height:n.progress_image.height,draggable:!1,"data-testid":"progress-image",sx:{objectFit:"contain",maxWidth:"full",maxHeight:"full",height:"auto",position:"absolute",borderRadius:"base",imageRendering:o?"auto":"pixelated"}}):a.jsx(ua,{imageDTO:h,droppableData:x,draggableData:g,isUploadDisabled:!0,fitContainer:!0,useThumbailFallback:!0,dropLabel:S("gallery.setCurrentImage"),noContentFallback:a.jsx(Zn,{icon:Qi,label:"No image selected"}),dataTestId:"image-preview"}),e&&h&&a.jsx(Ie,{sx:{position:"absolute",top:"0",width:"full",height:"full",borderRadius:"base"},children:a.jsx(gfe,{image:h})}),a.jsx(dr,{children:!e&&h&&y&&a.jsx(In.div,{initial:{opacity:0},animate:{opacity:1,transition:{duration:.1}},exit:{opacity:0,transition:{duration:.1}},style:{position:"absolute",top:"0",width:"100%",height:"100%",pointerEvents:"none"},children:a.jsx(GO,{})},"nextPrevButtons")})]})},yfe=d.memo(bfe),Cfe=()=>a.jsxs(L,{sx:{position:"relative",flexDirection:"column",height:"100%",width:"100%",rowGap:4,alignItems:"center",justifyContent:"center"},children:[a.jsx(cfe,{}),a.jsx(yfe,{})]}),wfe=d.memo(Cfe),Sfe=()=>a.jsx(Ie,{layerStyle:"first",sx:{position:"relative",width:"100%",height:"100%",p:2,borderRadius:"base"},children:a.jsx(L,{sx:{width:"100%",height:"100%"},children:a.jsx(wfe,{})})}),KO=d.memo(Sfe),kfe=()=>{const e=d.useRef(null),t=d.useCallback(()=>{e.current&&e.current.setLayout([50,50])},[]),n=Jy();return a.jsx(Ie,{sx:{w:"full",h:"full"},children:a.jsxs(Ig,{ref:e,autoSaveId:"imageTab.content",direction:"horizontal",style:{height:"100%",width:"100%"},storage:n,units:"percentages",children:[a.jsx(Qa,{id:"imageTab.content.initImage",order:0,defaultSize:50,minSize:25,style:{position:"relative"},children:a.jsx(tfe,{})}),a.jsx(lh,{onDoubleClick:t}),a.jsx(Qa,{id:"imageTab.content.selectedImage",order:1,defaultSize:50,minSize:25,children:a.jsx(KO,{})})]})})},jfe=d.memo(kfe);var _fe=function e(t,n){if(t===n)return!0;if(t&&n&&typeof t=="object"&&typeof n=="object"){if(t.constructor!==n.constructor)return!1;var r,o,s;if(Array.isArray(t)){if(r=t.length,r!=n.length)return!1;for(o=r;o--!==0;)if(!e(t[o],n[o]))return!1;return!0}if(t.constructor===RegExp)return t.source===n.source&&t.flags===n.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===n.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===n.toString();if(s=Object.keys(t),r=s.length,r!==Object.keys(n).length)return!1;for(o=r;o--!==0;)if(!Object.prototype.hasOwnProperty.call(n,s[o]))return!1;for(o=r;o--!==0;){var i=s[o];if(!e(t[i],n[i]))return!1}return!0}return t!==t&&n!==n};const f_=xd(_fe);function Ex(e){return e===null||typeof e!="object"?{}:Object.keys(e).reduce((t,n)=>{const r=e[n];return r!=null&&r!==!1&&(t[n]=r),t},{})}var Ife=Object.defineProperty,p_=Object.getOwnPropertySymbols,Pfe=Object.prototype.hasOwnProperty,Efe=Object.prototype.propertyIsEnumerable,m_=(e,t,n)=>t in e?Ife(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Mfe=(e,t)=>{for(var n in t||(t={}))Pfe.call(t,n)&&m_(e,n,t[n]);if(p_)for(var n of p_(t))Efe.call(t,n)&&m_(e,n,t[n]);return e};function qO(e,t){if(t===null||typeof t!="object")return{};const n=Mfe({},t);return Object.keys(t).forEach(r=>{r.includes(`${String(e)}.`)&&delete n[r]}),n}const Ofe="__MANTINE_FORM_INDEX__";function h_(e,t){return t?typeof t=="boolean"?t:Array.isArray(t)?t.includes(e.replace(/[.][0-9]/g,`.${Ofe}`)):!1:!1}function g_(e,t,n){typeof n.value=="object"&&(n.value=tc(n.value)),!n.enumerable||n.get||n.set||!n.configurable||!n.writable||t==="__proto__"?Object.defineProperty(e,t,n):e[t]=n.value}function tc(e){if(typeof e!="object")return e;var t=0,n,r,o,s=Object.prototype.toString.call(e);if(s==="[object Object]"?o=Object.create(e.__proto__||null):s==="[object Array]"?o=Array(e.length):s==="[object Set]"?(o=new Set,e.forEach(function(i){o.add(tc(i))})):s==="[object Map]"?(o=new Map,e.forEach(function(i,l){o.set(tc(l),tc(i))})):s==="[object Date]"?o=new Date(+e):s==="[object RegExp]"?o=new RegExp(e.source,e.flags):s==="[object DataView]"?o=new e.constructor(tc(e.buffer)):s==="[object ArrayBuffer]"?o=e.slice(0):s.slice(-6)==="Array]"&&(o=new e.constructor(e)),o){for(r=Object.getOwnPropertySymbols(e);t0,errors:t}}function Mx(e,t,n="",r={}){return typeof e!="object"||e===null?r:Object.keys(e).reduce((o,s)=>{const i=e[s],l=`${n===""?"":`${n}.`}${s}`,u=Qs(l,t);let p=!1;return typeof i=="function"&&(o[l]=i(u,t,l)),typeof i=="object"&&Array.isArray(u)&&(p=!0,u.forEach((m,h)=>Mx(i,t,`${l}.${h}`,o))),typeof i=="object"&&typeof u=="object"&&u!==null&&(p||Mx(i,t,l,o)),o},r)}function Ox(e,t){return v_(typeof e=="function"?e(t):Mx(e,t))}function Dp(e,t,n){if(typeof e!="string")return{hasError:!1,error:null};const r=Ox(t,n),o=Object.keys(r.errors).find(s=>e.split(".").every((i,l)=>i===s.split(".")[l]));return{hasError:!!o,error:o?r.errors[o]:null}}function Rfe(e,{from:t,to:n},r){const o=Qs(e,r);if(!Array.isArray(o))return r;const s=[...o],i=o[t];return s.splice(t,1),s.splice(n,0,i),Ag(e,s,r)}var Dfe=Object.defineProperty,x_=Object.getOwnPropertySymbols,Afe=Object.prototype.hasOwnProperty,Tfe=Object.prototype.propertyIsEnumerable,b_=(e,t,n)=>t in e?Dfe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Nfe=(e,t)=>{for(var n in t||(t={}))Afe.call(t,n)&&b_(e,n,t[n]);if(x_)for(var n of x_(t))Tfe.call(t,n)&&b_(e,n,t[n]);return e};function $fe(e,{from:t,to:n},r){const o=`${e}.${t}`,s=`${e}.${n}`,i=Nfe({},r);return Object.keys(r).every(l=>{let u,p;if(l.startsWith(o)&&(u=l,p=l.replace(o,s)),l.startsWith(s)&&(u=l.replace(s,o),p=l),u&&p){const m=i[u],h=i[p];return h===void 0?delete i[u]:i[u]=h,m===void 0?delete i[p]:i[p]=m,!1}return!0}),i}function Lfe(e,t,n){const r=Qs(e,n);return Array.isArray(r)?Ag(e,r.filter((o,s)=>s!==t),n):n}var zfe=Object.defineProperty,y_=Object.getOwnPropertySymbols,Ffe=Object.prototype.hasOwnProperty,Bfe=Object.prototype.propertyIsEnumerable,C_=(e,t,n)=>t in e?zfe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Hfe=(e,t)=>{for(var n in t||(t={}))Ffe.call(t,n)&&C_(e,n,t[n]);if(y_)for(var n of y_(t))Bfe.call(t,n)&&C_(e,n,t[n]);return e};function w_(e,t){const n=e.substring(t.length+1).split(".")[0];return parseInt(n,10)}function S_(e,t,n,r){if(t===void 0)return n;const o=`${String(e)}`;let s=n;r===-1&&(s=qO(`${o}.${t}`,s));const i=Hfe({},s),l=new Set;return Object.entries(s).filter(([u])=>{if(!u.startsWith(`${o}.`))return!1;const p=w_(u,o);return Number.isNaN(p)?!1:p>=t}).forEach(([u,p])=>{const m=w_(u,o),h=u.replace(`${o}.${m}`,`${o}.${m+r}`);i[h]=p,l.add(h),l.has(u)||delete i[u]}),i}function Vfe(e,t,n,r){const o=Qs(e,r);if(!Array.isArray(o))return r;const s=[...o];return s.splice(typeof n=="number"?n:s.length,0,t),Ag(e,s,r)}function k_(e,t){const n=Object.keys(e);if(typeof t=="string"){const r=n.filter(o=>o.startsWith(`${t}.`));return e[t]||r.some(o=>e[o])||!1}return n.some(r=>e[r])}function Wfe(e){return t=>{if(!t)e(t);else if(typeof t=="function")e(t);else if(typeof t=="object"&&"nativeEvent"in t){const{currentTarget:n}=t;n instanceof HTMLInputElement?n.type==="checkbox"?e(n.checked):e(n.value):(n instanceof HTMLTextAreaElement||n instanceof HTMLSelectElement)&&e(n.value)}else e(t)}}var Ufe=Object.defineProperty,Gfe=Object.defineProperties,Kfe=Object.getOwnPropertyDescriptors,j_=Object.getOwnPropertySymbols,qfe=Object.prototype.hasOwnProperty,Xfe=Object.prototype.propertyIsEnumerable,__=(e,t,n)=>t in e?Ufe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,La=(e,t)=>{for(var n in t||(t={}))qfe.call(t,n)&&__(e,n,t[n]);if(j_)for(var n of j_(t))Xfe.call(t,n)&&__(e,n,t[n]);return e},Zv=(e,t)=>Gfe(e,Kfe(t));function fl({initialValues:e={},initialErrors:t={},initialDirty:n={},initialTouched:r={},clearInputErrorOnChange:o=!0,validateInputOnChange:s=!1,validateInputOnBlur:i=!1,transformValues:l=p=>p,validate:u}={}){const[p,m]=d.useState(r),[h,g]=d.useState(n),[x,y]=d.useState(e),[b,w]=d.useState(Ex(t)),S=d.useRef(e),j=G=>{S.current=G},_=d.useCallback(()=>m({}),[]),E=G=>{const K=G?La(La({},x),G):x;j(K),g({})},I=d.useCallback(G=>w(K=>Ex(typeof G=="function"?G(K):G)),[]),M=d.useCallback(()=>w({}),[]),R=d.useCallback(()=>{y(e),M(),j(e),g({}),_()},[]),D=d.useCallback((G,K)=>I(ee=>Zv(La({},ee),{[G]:K})),[]),A=d.useCallback(G=>I(K=>{if(typeof G!="string")return K;const ee=La({},K);return delete ee[G],ee}),[]),O=d.useCallback(G=>g(K=>{if(typeof G!="string")return K;const ee=qO(G,K);return delete ee[G],ee}),[]),T=d.useCallback((G,K)=>{const ee=h_(G,s);O(G),m(le=>Zv(La({},le),{[G]:!0})),y(le=>{const J=Ag(G,K,le);if(ee){const ie=Dp(G,u,J);ie.hasError?D(G,ie.error):A(G)}return J}),!ee&&o&&D(G,null)},[]),X=d.useCallback(G=>{y(K=>{const ee=typeof G=="function"?G(K):G;return La(La({},K),ee)}),o&&M()},[]),B=d.useCallback((G,K)=>{O(G),y(ee=>Rfe(G,K,ee)),w(ee=>$fe(G,K,ee))},[]),V=d.useCallback((G,K)=>{O(G),y(ee=>Lfe(G,K,ee)),w(ee=>S_(G,K,ee,-1))},[]),U=d.useCallback((G,K,ee)=>{O(G),y(le=>Vfe(G,K,ee,le)),w(le=>S_(G,ee,le,1))},[]),N=d.useCallback(()=>{const G=Ox(u,x);return w(G.errors),G},[x,u]),$=d.useCallback(G=>{const K=Dp(G,u,x);return K.hasError?D(G,K.error):A(G),K},[x,u]),q=(G,{type:K="input",withError:ee=!0,withFocus:le=!0}={})=>{const ie={onChange:Wfe(de=>T(G,de))};return ee&&(ie.error=b[G]),K==="checkbox"?ie.checked=Qs(G,x):ie.value=Qs(G,x),le&&(ie.onFocus=()=>m(de=>Zv(La({},de),{[G]:!0})),ie.onBlur=()=>{if(h_(G,i)){const de=Dp(G,u,x);de.hasError?D(G,de.error):A(G)}}),ie},F=(G,K)=>ee=>{ee==null||ee.preventDefault();const le=N();le.hasErrors?K==null||K(le.errors,x,ee):G==null||G(l(x),ee)},Q=G=>l(G||x),Y=d.useCallback(G=>{G.preventDefault(),R()},[]),se=G=>{if(G){const ee=Qs(G,h);if(typeof ee=="boolean")return ee;const le=Qs(G,x),J=Qs(G,S.current);return!f_(le,J)}return Object.keys(h).length>0?k_(h):!f_(x,S.current)},ae=d.useCallback(G=>k_(p,G),[p]),re=d.useCallback(G=>G?!Dp(G,u,x).hasError:!Ox(u,x).hasErrors,[x,u]);return{values:x,errors:b,setValues:X,setErrors:I,setFieldValue:T,setFieldError:D,clearFieldError:A,clearErrors:M,reset:R,validate:N,validateField:$,reorderListItem:B,removeListItem:V,insertListItem:U,getInputProps:q,onSubmit:F,onReset:Y,isDirty:se,isTouched:ae,setTouched:m,setDirty:g,resetTouched:_,resetDirty:E,isValid:re,getTransformedValues:Q}}function _n(e){const{...t}=e,{base50:n,base100:r,base200:o,base300:s,base800:i,base700:l,base900:u,accent500:p,accent300:m}=Wd(),{colorMode:h}=ha();return a.jsx(QE,{styles:()=>({input:{color:Ae(u,r)(h),backgroundColor:Ae(n,u)(h),borderColor:Ae(o,i)(h),borderWidth:2,outline:"none",":focus":{borderColor:Ae(m,p)(h)}},label:{color:Ae(l,s)(h),fontWeight:"normal",marginBottom:4}}),...t})}const Qfe=[{value:"sd-1",label:mn["sd-1"]},{value:"sd-2",label:mn["sd-2"]},{value:"sdxl",label:mn.sdxl},{value:"sdxl-refiner",label:mn["sdxl-refiner"]}];function Jd(e){const{...t}=e,{t:n}=Z();return a.jsx(On,{label:n("modelManager.baseModel"),data:Qfe,...t})}function QO(e){const{data:t}=AI(),{...n}=e;return a.jsx(On,{label:"Config File",placeholder:"Select A Config File",data:t||[],...n})}const Yfe=[{value:"normal",label:"Normal"},{value:"inpaint",label:"Inpaint"},{value:"depth",label:"Depth"}];function Tg(e){const{...t}=e,{t:n}=Z();return a.jsx(On,{label:n("modelManager.variant"),data:Yfe,...t})}function dh(e,t=!0){let n;t?n=new RegExp("[^\\\\/]+(?=\\.)"):n=new RegExp("[^\\\\/]+(?=[\\\\/]?$)");const r=e.match(n);return r?r[0]:""}function YO(e){const{t}=Z(),n=te(),{model_path:r}=e,o=fl({initialValues:{model_name:r?dh(r):"",base_model:"sd-1",model_type:"main",path:r||"",description:"",model_format:"checkpoint",error:void 0,vae:"",variant:"normal",config:"configs\\stable-diffusion\\v1-inference.yaml"}}),[s]=TI(),[i,l]=d.useState(!1),u=p=>{s({body:p}).unwrap().then(m=>{n(ct(Qt({title:t("modelManager.modelAdded",{modelName:p.model_name}),status:"success"}))),o.reset(),r&&n(Sd(null))}).catch(m=>{m&&n(ct(Qt({title:t("toast.modelAddFailed"),status:"error"})))})};return a.jsx("form",{onSubmit:o.onSubmit(p=>u(p)),style:{width:"100%"},children:a.jsxs(L,{flexDirection:"column",gap:2,children:[a.jsx(_n,{label:t("modelManager.model"),required:!0,...o.getInputProps("model_name")}),a.jsx(Jd,{label:t("modelManager.baseModel"),...o.getInputProps("base_model")}),a.jsx(_n,{label:t("modelManager.modelLocation"),required:!0,...o.getInputProps("path"),onBlur:p=>{if(o.values.model_name===""){const m=dh(p.currentTarget.value);m&&o.setFieldValue("model_name",m)}}}),a.jsx(_n,{label:t("modelManager.description"),...o.getInputProps("description")}),a.jsx(_n,{label:t("modelManager.vaeLocation"),...o.getInputProps("vae")}),a.jsx(Tg,{label:t("modelManager.variant"),...o.getInputProps("variant")}),a.jsxs(L,{flexDirection:"column",width:"100%",gap:2,children:[i?a.jsx(_n,{required:!0,label:t("modelManager.customConfigFileLocation"),...o.getInputProps("config")}):a.jsx(QO,{required:!0,width:"100%",...o.getInputProps("config")}),a.jsx(br,{isChecked:i,onChange:()=>l(!i),label:t("modelManager.useCustomConfig")}),a.jsx(at,{mt:2,type:"submit",children:t("modelManager.addModel")})]})]})})}function ZO(e){const{t}=Z(),n=te(),{model_path:r}=e,[o]=TI(),s=fl({initialValues:{model_name:r?dh(r,!1):"",base_model:"sd-1",model_type:"main",path:r||"",description:"",model_format:"diffusers",error:void 0,vae:"",variant:"normal"}}),i=l=>{o({body:l}).unwrap().then(u=>{n(ct(Qt({title:t("modelManager.modelAdded",{modelName:l.model_name}),status:"success"}))),s.reset(),r&&n(Sd(null))}).catch(u=>{u&&n(ct(Qt({title:t("toast.modelAddFailed"),status:"error"})))})};return a.jsx("form",{onSubmit:s.onSubmit(l=>i(l)),style:{width:"100%"},children:a.jsxs(L,{flexDirection:"column",gap:2,children:[a.jsx(_n,{required:!0,label:t("modelManager.model"),...s.getInputProps("model_name")}),a.jsx(Jd,{label:t("modelManager.baseModel"),...s.getInputProps("base_model")}),a.jsx(_n,{required:!0,label:t("modelManager.modelLocation"),placeholder:t("modelManager.modelLocationValidationMsg"),...s.getInputProps("path"),onBlur:l=>{if(s.values.model_name===""){const u=dh(l.currentTarget.value,!1);u&&s.setFieldValue("model_name",u)}}}),a.jsx(_n,{label:t("modelManager.description"),...s.getInputProps("description")}),a.jsx(_n,{label:t("modelManager.vaeLocation"),...s.getInputProps("vae")}),a.jsx(Tg,{label:t("modelManager.variant"),...s.getInputProps("variant")}),a.jsx(at,{mt:2,type:"submit",children:t("modelManager.addModel")})]})})}const JO=[{label:"Diffusers",value:"diffusers"},{label:"Checkpoint / Safetensors",value:"checkpoint"}];function Zfe(){const[e,t]=d.useState("diffusers"),{t:n}=Z();return a.jsxs(L,{flexDirection:"column",gap:4,width:"100%",children:[a.jsx(On,{label:n("modelManager.modelType"),value:e,data:JO,onChange:r=>{r&&t(r)}}),a.jsxs(L,{sx:{p:4,borderRadius:4,bg:"base.300",_dark:{bg:"base.850"}},children:[e==="diffusers"&&a.jsx(ZO,{}),e==="checkpoint"&&a.jsx(YO,{})]})]})}const Jfe=[{label:"None",value:"none"},{label:"v_prediction",value:"v_prediction"},{label:"epsilon",value:"epsilon"},{label:"sample",value:"sample"}];function epe(){const e=te(),{t}=Z(),[n,{isLoading:r}]=NI(),o=fl({initialValues:{location:"",prediction_type:void 0}}),s=i=>{const l={location:i.location,prediction_type:i.prediction_type==="none"?void 0:i.prediction_type};n({body:l}).unwrap().then(u=>{e(ct(Qt({title:t("toast.modelAddedSimple"),status:"success"}))),o.reset()}).catch(u=>{u&&e(ct(Qt({title:`${u.data.detail} `,status:"error"})))})};return a.jsx("form",{onSubmit:o.onSubmit(i=>s(i)),style:{width:"100%"},children:a.jsxs(L,{flexDirection:"column",width:"100%",gap:4,children:[a.jsx(_n,{label:t("modelManager.modelLocation"),placeholder:t("modelManager.simpleModelDesc"),w:"100%",...o.getInputProps("location")}),a.jsx(On,{label:t("modelManager.predictionType"),data:Jfe,defaultValue:"none",...o.getInputProps("prediction_type")}),a.jsx(at,{type:"submit",isLoading:r,children:t("modelManager.addModel")})]})})}function tpe(){const[e,t]=d.useState("simple");return a.jsxs(L,{flexDirection:"column",width:"100%",overflow:"scroll",maxHeight:window.innerHeight-250,gap:4,children:[a.jsxs(Vt,{isAttached:!0,children:[a.jsx(at,{size:"sm",isChecked:e=="simple",onClick:()=>t("simple"),children:"Simple"}),a.jsx(at,{size:"sm",isChecked:e=="advanced",onClick:()=>t("advanced"),children:"Advanced"})]}),a.jsxs(L,{sx:{p:4,borderRadius:4,background:"base.200",_dark:{background:"base.800"}},children:[e==="simple"&&a.jsx(epe,{}),e==="advanced"&&a.jsx(Zfe,{})]})]})}function npe(e){const{...t}=e;return a.jsx(V6,{w:"100%",...t,children:e.children})}function rpe(){const e=W(b=>b.modelmanager.searchFolder),[t,n]=d.useState(""),{data:r}=Xo(Pi),{foundModels:o,alreadyInstalled:s,filteredModels:i}=$I({search_path:e||""},{selectFromResult:({data:b})=>{const w=K9(r==null?void 0:r.entities),S=nr(w,"path"),j=W9(b,S),_=Z9(b,S);return{foundModels:b,alreadyInstalled:I_(_,t),filteredModels:I_(j,t)}}}),[l,{isLoading:u}]=NI(),p=te(),{t:m}=Z(),h=d.useCallback(b=>{const w=b.currentTarget.id.split("\\").splice(-1)[0];l({body:{location:b.currentTarget.id}}).unwrap().then(S=>{p(ct(Qt({title:`Added Model: ${w}`,status:"success"})))}).catch(S=>{S&&p(ct(Qt({title:m("toast.modelAddFailed"),status:"error"})))})},[p,l,m]),g=d.useCallback(b=>{n(b.target.value)},[]),x=({models:b,showActions:w=!0})=>b.map(S=>a.jsxs(L,{sx:{p:4,gap:4,alignItems:"center",borderRadius:4,bg:"base.200",_dark:{bg:"base.800"}},children:[a.jsxs(L,{w:"100%",sx:{flexDirection:"column",minW:"25%"},children:[a.jsx(ve,{sx:{fontWeight:600},children:S.split("\\").slice(-1)[0]}),a.jsx(ve,{sx:{fontSize:"sm",color:"base.600",_dark:{color:"base.400"}},children:S})]}),w?a.jsxs(L,{gap:2,children:[a.jsx(at,{id:S,onClick:h,isLoading:u,children:m("modelManager.quickAdd")}),a.jsx(at,{onClick:()=>p(Sd(S)),isLoading:u,children:m("modelManager.advanced")})]}):a.jsx(ve,{sx:{fontWeight:600,p:2,borderRadius:4,color:"accent.50",bg:"accent.400",_dark:{color:"accent.100",bg:"accent.600"}},children:"Installed"})]},S));return(()=>e?!o||o.length===0?a.jsx(L,{sx:{w:"full",h:"full",justifyContent:"center",alignItems:"center",height:96,userSelect:"none",bg:"base.200",_dark:{bg:"base.900"}},children:a.jsx(ve,{variant:"subtext",children:m("modelManager.noModels")})}):a.jsxs(L,{sx:{flexDirection:"column",gap:2,w:"100%",minW:"50%"},children:[a.jsx(vo,{onChange:g,label:m("modelManager.search"),labelPos:"side"}),a.jsxs(L,{p:2,gap:2,children:[a.jsxs(ve,{sx:{fontWeight:600},children:["Models Found: ",o.length]}),a.jsxs(ve,{sx:{fontWeight:600,color:"accent.500",_dark:{color:"accent.200"}},children:["Not Installed: ",i.length]})]}),a.jsx(npe,{offsetScrollbars:!0,children:a.jsxs(L,{gap:2,flexDirection:"column",children:[x({models:i}),x({models:s,showActions:!1})]})})]}):null)()}const I_=(e,t)=>{const n=[];return $n(e,r=>{if(!r)return null;r.includes(t)&&n.push(r)}),n};function ope(){const e=W(l=>l.modelmanager.advancedAddScanModel),{t}=Z(),[n,r]=d.useState("diffusers"),[o,s]=d.useState(!0);d.useEffect(()=>{e&&[".ckpt",".safetensors",".pth",".pt"].some(l=>e.endsWith(l))?r("checkpoint"):r("diffusers")},[e,r,o]);const i=te();return e?a.jsxs(Ie,{as:In.div,initial:{x:-100,opacity:0},animate:{x:0,opacity:1,transition:{duration:.2}},sx:{display:"flex",flexDirection:"column",minWidth:"40%",maxHeight:window.innerHeight-300,overflow:"scroll",p:4,gap:4,borderRadius:4,bg:"base.200",_dark:{bg:"base.800"}},children:[a.jsxs(L,{justifyContent:"space-between",alignItems:"center",children:[a.jsx(ve,{size:"xl",fontWeight:600,children:o||n==="checkpoint"?"Add Checkpoint Model":"Add Diffusers Model"}),a.jsx(Fe,{icon:a.jsx(Ic,{}),"aria-label":t("modelManager.closeAdvanced"),onClick:()=>i(Sd(null)),size:"sm"})]}),a.jsx(On,{label:t("modelManager.modelType"),value:n,data:JO,onChange:l=>{l&&(r(l),s(l==="checkpoint"))}}),o?a.jsx(YO,{model_path:e},e):a.jsx(ZO,{model_path:e},e)]}):null}function spe(){const e=te(),{t}=Z(),n=W(l=>l.modelmanager.searchFolder),{refetch:r}=$I({search_path:n||""}),o=fl({initialValues:{folder:""}}),s=d.useCallback(l=>{e(Dw(l.folder))},[e]),i=()=>{r()};return a.jsx("form",{onSubmit:o.onSubmit(l=>s(l)),style:{width:"100%"},children:a.jsxs(L,{sx:{w:"100%",gap:2,borderRadius:4,alignItems:"center"},children:[a.jsxs(L,{w:"100%",alignItems:"center",gap:4,minH:12,children:[a.jsx(ve,{sx:{fontSize:"sm",fontWeight:600,color:"base.700",minW:"max-content",_dark:{color:"base.300"}},children:"Folder"}),n?a.jsx(L,{sx:{w:"100%",p:2,px:4,bg:"base.300",borderRadius:4,fontSize:"sm",fontWeight:"bold",_dark:{bg:"base.700"}},children:n}):a.jsx(vo,{w:"100%",size:"md",...o.getInputProps("folder")})]}),a.jsxs(L,{gap:2,children:[n?a.jsx(Fe,{"aria-label":t("modelManager.scanAgain"),tooltip:t("modelManager.scanAgain"),icon:a.jsx(bM,{}),onClick:i,fontSize:18,size:"sm"}):a.jsx(Fe,{"aria-label":t("modelManager.findModels"),tooltip:t("modelManager.findModels"),icon:a.jsx(tee,{}),fontSize:18,size:"sm",type:"submit"}),a.jsx(Fe,{"aria-label":t("modelManager.clearCheckpointFolder"),tooltip:t("modelManager.clearCheckpointFolder"),icon:a.jsx(Br,{}),size:"sm",onClick:()=>{e(Dw(null)),e(Sd(null))},isDisabled:!n,colorScheme:"red"})]})]})})}const ape=d.memo(spe);function ipe(){return a.jsxs(L,{flexDirection:"column",w:"100%",gap:4,children:[a.jsx(ape,{}),a.jsxs(L,{gap:4,children:[a.jsx(L,{sx:{maxHeight:window.innerHeight-300,overflow:"scroll",gap:4,w:"100%"},children:a.jsx(rpe,{})}),a.jsx(ope,{})]})]})}function lpe(){const[e,t]=d.useState("add"),{t:n}=Z();return a.jsxs(L,{flexDirection:"column",gap:4,children:[a.jsxs(Vt,{isAttached:!0,children:[a.jsx(at,{onClick:()=>t("add"),isChecked:e=="add",size:"sm",width:"100%",children:n("modelManager.addModel")}),a.jsx(at,{onClick:()=>t("scan"),isChecked:e=="scan",size:"sm",width:"100%",children:n("modelManager.scanForModels")})]}),e=="add"&&a.jsx(tpe,{}),e=="scan"&&a.jsx(ipe,{})]})}const cpe=[{label:"Stable Diffusion 1",value:"sd-1"},{label:"Stable Diffusion 2",value:"sd-2"}];function upe(){var $,q;const{t:e}=Z(),t=te(),{data:n}=Xo(Pi),[r,{isLoading:o}]=IT(),[s,i]=d.useState("sd-1"),l=Gw(n==null?void 0:n.entities,(F,Q)=>(F==null?void 0:F.model_format)==="diffusers"&&(F==null?void 0:F.base_model)==="sd-1"),u=Gw(n==null?void 0:n.entities,(F,Q)=>(F==null?void 0:F.model_format)==="diffusers"&&(F==null?void 0:F.base_model)==="sd-2"),p=d.useMemo(()=>({"sd-1":l,"sd-2":u}),[l,u]),[m,h]=d.useState((($=Object.keys(p[s]))==null?void 0:$[0])??null),[g,x]=d.useState(((q=Object.keys(p[s]))==null?void 0:q[1])??null),[y,b]=d.useState(null),[w,S]=d.useState(""),[j,_]=d.useState(.5),[E,I]=d.useState("weighted_sum"),[M,R]=d.useState("root"),[D,A]=d.useState(""),[O,T]=d.useState(!1),X=Object.keys(p[s]).filter(F=>F!==g&&F!==y),B=Object.keys(p[s]).filter(F=>F!==m&&F!==y),V=Object.keys(p[s]).filter(F=>F!==m&&F!==g),U=F=>{i(F),h(null),x(null)},N=()=>{const F=[];let Q=[m,g,y];Q=Q.filter(se=>se!==null),Q.forEach(se=>{var re;const ae=(re=se==null?void 0:se.split("/"))==null?void 0:re[2];ae&&F.push(ae)});const Y={model_names:F,merged_model_name:w!==""?w:F.join("-"),alpha:j,interp:E,force:O,merge_dest_directory:M==="root"?void 0:D};r({base_model:s,body:Y}).unwrap().then(se=>{t(ct(Qt({title:e("modelManager.modelsMerged"),status:"success"})))}).catch(se=>{se&&t(ct(Qt({title:e("modelManager.modelsMergeFailed"),status:"error"})))})};return a.jsxs(L,{flexDirection:"column",rowGap:4,children:[a.jsxs(L,{sx:{flexDirection:"column",rowGap:1},children:[a.jsx(ve,{children:e("modelManager.modelMergeHeaderHelp1")}),a.jsx(ve,{fontSize:"sm",variant:"subtext",children:e("modelManager.modelMergeHeaderHelp2")})]}),a.jsxs(L,{columnGap:4,children:[a.jsx(On,{label:"Model Type",w:"100%",data:cpe,value:s,onChange:U}),a.jsx(nn,{label:e("modelManager.modelOne"),w:"100%",value:m,placeholder:e("modelManager.selectModel"),data:X,onChange:F=>h(F)}),a.jsx(nn,{label:e("modelManager.modelTwo"),w:"100%",placeholder:e("modelManager.selectModel"),value:g,data:B,onChange:F=>x(F)}),a.jsx(nn,{label:e("modelManager.modelThree"),data:V,w:"100%",placeholder:e("modelManager.selectModel"),clearable:!0,onChange:F=>{F?(b(F),I("weighted_sum")):(b(null),I("add_difference"))}})]}),a.jsx(vo,{label:e("modelManager.mergedModelName"),value:w,onChange:F=>S(F.target.value)}),a.jsxs(L,{sx:{flexDirection:"column",padding:4,borderRadius:"base",gap:4,bg:"base.200",_dark:{bg:"base.800"}},children:[a.jsx(tt,{label:e("modelManager.alpha"),min:.01,max:.99,step:.01,value:j,onChange:F=>_(F),withInput:!0,withReset:!0,handleReset:()=>_(.5),withSliderMarks:!0}),a.jsx(ve,{variant:"subtext",fontSize:"sm",children:e("modelManager.modelMergeAlphaHelp")})]}),a.jsxs(L,{sx:{padding:4,borderRadius:"base",gap:4,bg:"base.200",_dark:{bg:"base.800"}},children:[a.jsx(ve,{fontWeight:500,fontSize:"sm",variant:"subtext",children:e("modelManager.interpolationType")}),a.jsx(cm,{value:E,onChange:F=>I(F),children:a.jsx(L,{columnGap:4,children:y===null?a.jsxs(a.Fragment,{children:[a.jsx(Ks,{value:"weighted_sum",children:a.jsx(ve,{fontSize:"sm",children:e("modelManager.weightedSum")})}),a.jsx(Ks,{value:"sigmoid",children:a.jsx(ve,{fontSize:"sm",children:e("modelManager.sigmoid")})}),a.jsx(Ks,{value:"inv_sigmoid",children:a.jsx(ve,{fontSize:"sm",children:e("modelManager.inverseSigmoid")})})]}):a.jsx(Ks,{value:"add_difference",children:a.jsx(Ht,{label:e("modelManager.modelMergeInterpAddDifferenceHelp"),children:a.jsx(ve,{fontSize:"sm",children:e("modelManager.addDifference")})})})})})]}),a.jsxs(L,{sx:{flexDirection:"column",padding:4,borderRadius:"base",gap:4,bg:"base.200",_dark:{bg:"base.900"}},children:[a.jsxs(L,{columnGap:4,children:[a.jsx(ve,{fontWeight:"500",fontSize:"sm",variant:"subtext",children:e("modelManager.mergedModelSaveLocation")}),a.jsx(cm,{value:M,onChange:F=>R(F),children:a.jsxs(L,{columnGap:4,children:[a.jsx(Ks,{value:"root",children:a.jsx(ve,{fontSize:"sm",children:e("modelManager.invokeAIFolder")})}),a.jsx(Ks,{value:"custom",children:a.jsx(ve,{fontSize:"sm",children:e("modelManager.custom")})})]})})]}),M==="custom"&&a.jsx(vo,{label:e("modelManager.mergedModelCustomSaveLocation"),value:D,onChange:F=>A(F.target.value)})]}),a.jsx(br,{label:e("modelManager.ignoreMismatch"),isChecked:O,onChange:F=>T(F.target.checked),fontWeight:"500"}),a.jsx(at,{onClick:N,isLoading:o,isDisabled:m===null||g===null,children:e("modelManager.merge")})]})}function dpe(e){const{model:t}=e,n=te(),{t:r}=Z(),[o,{isLoading:s}]=PT(),[i,l]=d.useState("InvokeAIRoot"),[u,p]=d.useState("");d.useEffect(()=>{l("InvokeAIRoot")},[t]);const m=()=>{l("InvokeAIRoot")},h=()=>{const g={base_model:t.base_model,model_name:t.model_name,convert_dest_directory:i==="Custom"?u:void 0};if(i==="Custom"&&u===""){n(ct(Qt({title:r("modelManager.noCustomLocationProvided"),status:"error"})));return}n(ct(Qt({title:`${r("modelManager.convertingModelBegin")}: ${t.model_name}`,status:"info"}))),o(g).unwrap().then(()=>{n(ct(Qt({title:`${r("modelManager.modelConverted")}: ${t.model_name}`,status:"success"})))}).catch(()=>{n(ct(Qt({title:`${r("modelManager.modelConversionFailed")}: ${t.model_name}`,status:"error"})))})};return a.jsxs(kg,{title:`${r("modelManager.convert")} ${t.model_name}`,acceptCallback:h,cancelCallback:m,acceptButtonText:`${r("modelManager.convert")}`,triggerComponent:a.jsxs(at,{size:"sm","aria-label":r("modelManager.convertToDiffusers"),className:" modal-close-btn",isLoading:s,children:["🧨 ",r("modelManager.convertToDiffusers")]}),motionPreset:"slideInBottom",children:[a.jsxs(L,{flexDirection:"column",rowGap:4,children:[a.jsx(ve,{children:r("modelManager.convertToDiffusersHelpText1")}),a.jsxs(Od,{children:[a.jsx(Qr,{children:r("modelManager.convertToDiffusersHelpText2")}),a.jsx(Qr,{children:r("modelManager.convertToDiffusersHelpText3")}),a.jsx(Qr,{children:r("modelManager.convertToDiffusersHelpText4")}),a.jsx(Qr,{children:r("modelManager.convertToDiffusersHelpText5")})]}),a.jsx(ve,{children:r("modelManager.convertToDiffusersHelpText6")})]}),a.jsxs(L,{flexDir:"column",gap:2,children:[a.jsxs(L,{marginTop:4,flexDir:"column",gap:2,children:[a.jsx(ve,{fontWeight:"600",children:r("modelManager.convertToDiffusersSaveLocation")}),a.jsx(cm,{value:i,onChange:g=>l(g),children:a.jsxs(L,{gap:4,children:[a.jsx(Ks,{value:"InvokeAIRoot",children:a.jsx(Ht,{label:"Save converted model in the InvokeAI root folder",children:r("modelManager.invokeRoot")})}),a.jsx(Ks,{value:"Custom",children:a.jsx(Ht,{label:"Save converted model in a custom folder",children:r("modelManager.custom")})})]})})]}),i==="Custom"&&a.jsxs(L,{flexDirection:"column",rowGap:2,children:[a.jsx(ve,{fontWeight:"500",fontSize:"sm",variant:"subtext",children:r("modelManager.customSaveLocation")}),a.jsx(vo,{value:u,onChange:g=>{p(g.target.value)},width:"full"})]})]})]})}function fpe(e){const{model:t}=e,[n,{isLoading:r}]=LI(),{data:o}=AI(),[s,i]=d.useState(!1);d.useEffect(()=>{o!=null&&o.includes(t.config)||i(!0)},[o,t.config]);const l=te(),{t:u}=Z(),p=fl({initialValues:{model_name:t.model_name?t.model_name:"",base_model:t.base_model,model_type:"main",path:t.path?t.path:"",description:t.description?t.description:"",model_format:"checkpoint",vae:t.vae?t.vae:"",config:t.config?t.config:"",variant:t.variant},validate:{path:h=>h.trim().length===0?"Must provide a path":null}}),m=d.useCallback(h=>{const g={base_model:t.base_model,model_name:t.model_name,body:h};n(g).unwrap().then(x=>{p.setValues(x),l(ct(Qt({title:u("modelManager.modelUpdated"),status:"success"})))}).catch(x=>{p.reset(),l(ct(Qt({title:u("modelManager.modelUpdateFailed"),status:"error"})))})},[p,l,t.base_model,t.model_name,u,n]);return a.jsxs(L,{flexDirection:"column",rowGap:4,width:"100%",children:[a.jsxs(L,{justifyContent:"space-between",alignItems:"center",children:[a.jsxs(L,{flexDirection:"column",children:[a.jsx(ve,{fontSize:"lg",fontWeight:"bold",children:t.model_name}),a.jsxs(ve,{fontSize:"sm",color:"base.400",children:[mn[t.base_model]," Model"]})]}),[""].includes(t.base_model)?a.jsx(Ds,{sx:{p:2,borderRadius:4,bg:"error.200",_dark:{bg:"error.400"}},children:"Conversion Not Supported"}):a.jsx(dpe,{model:t})]}),a.jsx(Yn,{}),a.jsx(L,{flexDirection:"column",maxHeight:window.innerHeight-270,overflowY:"scroll",children:a.jsx("form",{onSubmit:p.onSubmit(h=>m(h)),children:a.jsxs(L,{flexDirection:"column",overflowY:"scroll",gap:4,children:[a.jsx(_n,{label:u("modelManager.name"),...p.getInputProps("model_name")}),a.jsx(_n,{label:u("modelManager.description"),...p.getInputProps("description")}),a.jsx(Jd,{required:!0,...p.getInputProps("base_model")}),a.jsx(Tg,{required:!0,...p.getInputProps("variant")}),a.jsx(_n,{required:!0,label:u("modelManager.modelLocation"),...p.getInputProps("path")}),a.jsx(_n,{label:u("modelManager.vaeLocation"),...p.getInputProps("vae")}),a.jsxs(L,{flexDirection:"column",gap:2,children:[s?a.jsx(_n,{required:!0,label:u("modelManager.config"),...p.getInputProps("config")}):a.jsx(QO,{required:!0,...p.getInputProps("config")}),a.jsx(br,{isChecked:s,onChange:()=>i(!s),label:"Use Custom Config"})]}),a.jsx(at,{type:"submit",isLoading:r,children:u("modelManager.updateModel")})]})})})]})}function ppe(e){const{model:t}=e,[n,{isLoading:r}]=LI(),o=te(),{t:s}=Z(),i=fl({initialValues:{model_name:t.model_name?t.model_name:"",base_model:t.base_model,model_type:"main",path:t.path?t.path:"",description:t.description?t.description:"",model_format:"diffusers",vae:t.vae?t.vae:"",variant:t.variant},validate:{path:u=>u.trim().length===0?"Must provide a path":null}}),l=d.useCallback(u=>{const p={base_model:t.base_model,model_name:t.model_name,body:u};n(p).unwrap().then(m=>{i.setValues(m),o(ct(Qt({title:s("modelManager.modelUpdated"),status:"success"})))}).catch(m=>{i.reset(),o(ct(Qt({title:s("modelManager.modelUpdateFailed"),status:"error"})))})},[i,o,t.base_model,t.model_name,s,n]);return a.jsxs(L,{flexDirection:"column",rowGap:4,width:"100%",children:[a.jsxs(L,{flexDirection:"column",children:[a.jsx(ve,{fontSize:"lg",fontWeight:"bold",children:t.model_name}),a.jsxs(ve,{fontSize:"sm",color:"base.400",children:[mn[t.base_model]," Model"]})]}),a.jsx(Yn,{}),a.jsx("form",{onSubmit:i.onSubmit(u=>l(u)),children:a.jsxs(L,{flexDirection:"column",overflowY:"scroll",gap:4,children:[a.jsx(_n,{label:s("modelManager.name"),...i.getInputProps("model_name")}),a.jsx(_n,{label:s("modelManager.description"),...i.getInputProps("description")}),a.jsx(Jd,{required:!0,...i.getInputProps("base_model")}),a.jsx(Tg,{required:!0,...i.getInputProps("variant")}),a.jsx(_n,{required:!0,label:s("modelManager.modelLocation"),...i.getInputProps("path")}),a.jsx(_n,{label:s("modelManager.vaeLocation"),...i.getInputProps("vae")}),a.jsx(at,{type:"submit",isLoading:r,children:s("modelManager.updateModel")})]})})]})}function mpe(e){const{model:t}=e,[n,{isLoading:r}]=ET(),o=te(),{t:s}=Z(),i=fl({initialValues:{model_name:t.model_name?t.model_name:"",base_model:t.base_model,model_type:"lora",path:t.path?t.path:"",description:t.description?t.description:"",model_format:t.model_format},validate:{path:u=>u.trim().length===0?"Must provide a path":null}}),l=d.useCallback(u=>{const p={base_model:t.base_model,model_name:t.model_name,body:u};n(p).unwrap().then(m=>{i.setValues(m),o(ct(Qt({title:s("modelManager.modelUpdated"),status:"success"})))}).catch(m=>{i.reset(),o(ct(Qt({title:s("modelManager.modelUpdateFailed"),status:"error"})))})},[o,i,t.base_model,t.model_name,s,n]);return a.jsxs(L,{flexDirection:"column",rowGap:4,width:"100%",children:[a.jsxs(L,{flexDirection:"column",children:[a.jsx(ve,{fontSize:"lg",fontWeight:"bold",children:t.model_name}),a.jsxs(ve,{fontSize:"sm",color:"base.400",children:[mn[t.base_model]," Model ⋅"," ",MT[t.model_format]," format"]})]}),a.jsx(Yn,{}),a.jsx("form",{onSubmit:i.onSubmit(u=>l(u)),children:a.jsxs(L,{flexDirection:"column",overflowY:"scroll",gap:4,children:[a.jsx(_n,{label:s("modelManager.name"),...i.getInputProps("model_name")}),a.jsx(_n,{label:s("modelManager.description"),...i.getInputProps("description")}),a.jsx(Jd,{...i.getInputProps("base_model")}),a.jsx(_n,{label:s("modelManager.modelLocation"),...i.getInputProps("path")}),a.jsx(at,{type:"submit",isLoading:r,children:s("modelManager.updateModel")})]})})]})}function hpe(e){const{t}=Z(),n=te(),[r]=OT(),[o]=RT(),{model:s,isSelected:i,setSelectedModelId:l}=e,u=d.useCallback(()=>{l(s.id)},[s.id,l]),p=d.useCallback(()=>{const m={main:r,lora:o,onnx:r}[s.model_type];m(s).unwrap().then(h=>{n(ct(Qt({title:`${t("modelManager.modelDeleted")}: ${s.model_name}`,status:"success"})))}).catch(h=>{h&&n(ct(Qt({title:`${t("modelManager.modelDeleteFailed")}: ${s.model_name}`,status:"error"})))}),l(void 0)},[r,o,s,l,n,t]);return a.jsxs(L,{sx:{gap:2,alignItems:"center",w:"full"},children:[a.jsx(L,{as:at,isChecked:i,sx:{justifyContent:"start",p:2,borderRadius:"base",w:"full",alignItems:"center",bg:i?"accent.400":"base.100",color:i?"base.50":"base.800",_hover:{bg:i?"accent.500":"base.300",color:i?"base.50":"base.800"},_dark:{color:i?"base.50":"base.100",bg:i?"accent.600":"base.850",_hover:{color:i?"base.50":"base.100",bg:i?"accent.550":"base.700"}}},onClick:u,children:a.jsxs(L,{gap:4,alignItems:"center",children:[a.jsx(Ds,{minWidth:14,p:.5,fontSize:"sm",variant:"solid",children:DT[s.base_model]}),a.jsx(Ht,{label:s.description,hasArrow:!0,placement:"bottom",children:a.jsx(ve,{sx:{fontWeight:500},children:s.model_name})})]})}),a.jsx(kg,{title:t("modelManager.deleteModel"),acceptCallback:p,acceptButtonText:t("modelManager.delete"),triggerComponent:a.jsx(Fe,{icon:a.jsx(rne,{}),"aria-label":t("modelManager.deleteConfig"),colorScheme:"error"}),children:a.jsxs(L,{rowGap:4,flexDirection:"column",children:[a.jsx("p",{style:{fontWeight:"bold"},children:t("modelManager.deleteMsg1")}),a.jsx("p",{children:t("modelManager.deleteMsg2")})]})})]})}const gpe=e=>{const{selectedModelId:t,setSelectedModelId:n}=e,{t:r}=Z(),[o,s]=d.useState(""),[i,l]=d.useState("all"),{filteredDiffusersModels:u,isLoadingDiffusersModels:p}=Xo(Pi,{selectFromResult:({data:_,isLoading:E})=>({filteredDiffusersModels:Iu(_,"main","diffusers",o),isLoadingDiffusersModels:E})}),{filteredCheckpointModels:m,isLoadingCheckpointModels:h}=Xo(Pi,{selectFromResult:({data:_,isLoading:E})=>({filteredCheckpointModels:Iu(_,"main","checkpoint",o),isLoadingCheckpointModels:E})}),{filteredLoraModels:g,isLoadingLoraModels:x}=Cd(void 0,{selectFromResult:({data:_,isLoading:E})=>({filteredLoraModels:Iu(_,"lora",void 0,o),isLoadingLoraModels:E})}),{filteredOnnxModels:y,isLoadingOnnxModels:b}=Ku(Pi,{selectFromResult:({data:_,isLoading:E})=>({filteredOnnxModels:Iu(_,"onnx","onnx",o),isLoadingOnnxModels:E})}),{filteredOliveModels:w,isLoadingOliveModels:S}=Ku(Pi,{selectFromResult:({data:_,isLoading:E})=>({filteredOliveModels:Iu(_,"onnx","olive",o),isLoadingOliveModels:E})}),j=d.useCallback(_=>{s(_.target.value)},[]);return a.jsx(L,{flexDirection:"column",rowGap:4,width:"50%",minWidth:"50%",children:a.jsxs(L,{flexDirection:"column",gap:4,paddingInlineEnd:4,children:[a.jsxs(Vt,{isAttached:!0,children:[a.jsx(at,{onClick:()=>l("all"),isChecked:i==="all",size:"sm",children:r("modelManager.allModels")}),a.jsx(at,{size:"sm",onClick:()=>l("diffusers"),isChecked:i==="diffusers",children:r("modelManager.diffusersModels")}),a.jsx(at,{size:"sm",onClick:()=>l("checkpoint"),isChecked:i==="checkpoint",children:r("modelManager.checkpointModels")}),a.jsx(at,{size:"sm",onClick:()=>l("onnx"),isChecked:i==="onnx",children:r("modelManager.onnxModels")}),a.jsx(at,{size:"sm",onClick:()=>l("olive"),isChecked:i==="olive",children:r("modelManager.oliveModels")}),a.jsx(at,{size:"sm",onClick:()=>l("lora"),isChecked:i==="lora",children:r("modelManager.loraModels")})]}),a.jsx(vo,{onChange:j,label:r("modelManager.search"),labelPos:"side"}),a.jsxs(L,{flexDirection:"column",gap:4,maxHeight:window.innerHeight-280,overflow:"scroll",children:[p&&a.jsx(Xl,{loadingMessage:"Loading Diffusers..."}),["all","diffusers"].includes(i)&&!p&&u.length>0&&a.jsx(ql,{title:"Diffusers",modelList:u,selected:{selectedModelId:t,setSelectedModelId:n}},"diffusers"),h&&a.jsx(Xl,{loadingMessage:"Loading Checkpoints..."}),["all","checkpoint"].includes(i)&&!h&&m.length>0&&a.jsx(ql,{title:"Checkpoints",modelList:m,selected:{selectedModelId:t,setSelectedModelId:n}},"checkpoints"),x&&a.jsx(Xl,{loadingMessage:"Loading LoRAs..."}),["all","lora"].includes(i)&&!x&&g.length>0&&a.jsx(ql,{title:"LoRAs",modelList:g,selected:{selectedModelId:t,setSelectedModelId:n}},"loras"),S&&a.jsx(Xl,{loadingMessage:"Loading Olives..."}),["all","olive"].includes(i)&&!S&&w.length>0&&a.jsx(ql,{title:"Olives",modelList:w,selected:{selectedModelId:t,setSelectedModelId:n}},"olive"),b&&a.jsx(Xl,{loadingMessage:"Loading ONNX..."}),["all","onnx"].includes(i)&&!b&&y.length>0&&a.jsx(ql,{title:"ONNX",modelList:y,selected:{selectedModelId:t,setSelectedModelId:n}},"onnx")]})]})})},vpe=d.memo(gpe),Iu=(e,t,n,r)=>{const o=[];return $n(e==null?void 0:e.entities,s=>{if(!s)return;const i=s.model_name.toLowerCase().includes(r.toLowerCase()),l=n===void 0||s.model_format===n,u=s.model_type===t;i&&l&&u&&o.push(s)}),o},c2=d.memo(e=>a.jsx(L,{flexDirection:"column",gap:4,borderRadius:4,p:4,sx:{bg:"base.200",_dark:{bg:"base.800"}},children:e.children}));c2.displayName="StyledModelContainer";const ql=d.memo(e=>{const{title:t,modelList:n,selected:r}=e;return a.jsx(c2,{children:a.jsxs(L,{sx:{gap:2,flexDir:"column"},children:[a.jsx(ve,{variant:"subtext",fontSize:"sm",children:t}),n.map(o=>a.jsx(hpe,{model:o,isSelected:r.selectedModelId===o.id,setSelectedModelId:r.setSelectedModelId},o.id))]})})});ql.displayName="ModelListWrapper";const Xl=d.memo(({loadingMessage:e})=>a.jsx(c2,{children:a.jsxs(L,{justifyContent:"center",alignItems:"center",flexDirection:"column",p:4,gap:8,children:[a.jsx(fa,{}),a.jsx(ve,{variant:"subtext",children:e||"Fetching..."})]})}));Xl.displayName="FetchingModelsLoader";function xpe(){const[e,t]=d.useState(),{mainModel:n}=Xo(Pi,{selectFromResult:({data:s})=>({mainModel:e?s==null?void 0:s.entities[e]:void 0})}),{loraModel:r}=Cd(void 0,{selectFromResult:({data:s})=>({loraModel:e?s==null?void 0:s.entities[e]:void 0})}),o=n||r;return a.jsxs(L,{sx:{gap:8,w:"full",h:"full"},children:[a.jsx(vpe,{selectedModelId:e,setSelectedModelId:t}),a.jsx(bpe,{model:o})]})}const bpe=e=>{const{model:t}=e;return(t==null?void 0:t.model_format)==="checkpoint"?a.jsx(fpe,{model:t},t.id):(t==null?void 0:t.model_format)==="diffusers"?a.jsx(ppe,{model:t},t.id):(t==null?void 0:t.model_type)==="lora"?a.jsx(mpe,{model:t},t.id):a.jsx(L,{sx:{w:"full",h:"full",justifyContent:"center",alignItems:"center",maxH:96,userSelect:"none"},children:a.jsx(ve,{variant:"subtext",children:"No Model Selected"})})};function ype(){const{t:e}=Z();return a.jsxs(L,{sx:{w:"full",p:4,borderRadius:4,gap:4,justifyContent:"space-between",alignItems:"center",bg:"base.200",_dark:{bg:"base.800"}},children:[a.jsxs(L,{sx:{flexDirection:"column",gap:2},children:[a.jsx(ve,{sx:{fontWeight:600},children:e("modelManager.syncModels")}),a.jsx(ve,{fontSize:"sm",sx:{_dark:{color:"base.400"}},children:e("modelManager.syncModelsDesc")})]}),a.jsx(Gc,{})]})}function Cpe(){return a.jsx(L,{children:a.jsx(ype,{})})}const P_=[{id:"modelManager",label:yt.t("modelManager.modelManager"),content:a.jsx(xpe,{})},{id:"importModels",label:yt.t("modelManager.importModels"),content:a.jsx(lpe,{})},{id:"mergeModels",label:yt.t("modelManager.mergeModels"),content:a.jsx(upe,{})},{id:"settings",label:yt.t("modelManager.settings"),content:a.jsx(Cpe,{})}],wpe=()=>a.jsxs(rl,{isLazy:!0,variant:"line",layerStyle:"first",sx:{w:"full",h:"full",p:4,gap:4,borderRadius:"base"},children:[a.jsx(ol,{children:P_.map(e=>a.jsx(Tr,{sx:{borderTopRadius:"base"},children:e.label},e.id))}),a.jsx(zc,{sx:{w:"full",h:"full"},children:P_.map(e=>a.jsx(So,{sx:{w:"full",h:"full"},children:e.content},e.id))})]}),Spe=d.memo(wpe),kpe={enum:"",BoardField:void 0,boolean:!1,BooleanCollection:[],BooleanPolymorphic:!1,ClipField:void 0,Collection:[],CollectionItem:void 0,ColorCollection:[],ColorField:void 0,ColorPolymorphic:void 0,ConditioningCollection:[],ConditioningField:void 0,ConditioningPolymorphic:void 0,ControlCollection:[],ControlField:void 0,ControlNetModelField:void 0,ControlPolymorphic:void 0,DenoiseMaskField:void 0,float:0,FloatCollection:[],FloatPolymorphic:0,ImageCollection:[],ImageField:void 0,ImagePolymorphic:void 0,integer:0,IntegerCollection:[],IntegerPolymorphic:0,IPAdapterField:void 0,IPAdapterModelField:void 0,LatentsCollection:[],LatentsField:void 0,LatentsPolymorphic:void 0,LoRAModelField:void 0,MainModelField:void 0,ONNXModelField:void 0,Scheduler:"euler",SDXLMainModelField:void 0,SDXLRefinerModelField:void 0,string:"",StringCollection:[],StringPolymorphic:"",UNetField:void 0,VaeField:void 0,VaeModelField:void 0},jpe=(e,t)=>{const n={id:e,name:t.name,type:t.type,label:"",fieldKind:"input"};return n.value=t.default??kpe[t.type],n},_pe=ce([e=>e.nodes],e=>e.nodeTemplates),Jv={dragHandle:`.${tl}`},Ipe=()=>{const e=W(_pe),t=rb();return d.useCallback(n=>{var x;const r=Zs();let o=window.innerWidth/2,s=window.innerHeight/2;const i=(x=document.querySelector("#workflow-editor"))==null?void 0:x.getBoundingClientRect();i&&(o=i.width/2-g1/2,s=i.height/2-g1/2);const{x:l,y:u}=t.project({x:o,y:s});if(n==="current_image")return{...Jv,id:r,type:"current_image",position:{x:l,y:u},data:{id:r,type:"current_image",isOpen:!0,label:"Current Image"}};if(n==="notes")return{...Jv,id:r,type:"notes",position:{x:l,y:u},data:{id:r,isOpen:!0,label:"Notes",notes:"",type:"notes"}};const p=e[n];if(p===void 0){console.error(`Unable to find template ${n}.`);return}const m=Aw(p.inputs,(y,b,w)=>{const S=Zs(),j=jpe(S,b);return y[w]=j,y},{}),h=Aw(p.outputs,(y,b,w)=>{const j={id:Zs(),name:w,type:b.type,fieldKind:"output"};return y[w]=j,y},{});return{...Jv,id:r,type:"invocation",position:{x:l,y:u},data:{id:r,type:n,version:p.version,label:"",notes:"",isOpen:!0,embedWorkflow:!1,isIntermediate:n!=="save_image",inputs:m,outputs:h,useCache:p.useCache}}},[e,t])},e7=d.forwardRef(({label:e,description:t,...n},r)=>a.jsx("div",{ref:r,...n,children:a.jsxs("div",{children:[a.jsx(ve,{fontWeight:600,children:e}),a.jsx(ve,{size:"xs",sx:{color:"base.600",_dark:{color:"base.500"}},children:t})]})}));e7.displayName="AddNodePopoverSelectItem";const Ppe=(e,t)=>{const n=new RegExp(e.trim().replace(/[-[\]{}()*+!<=:?./\\^$|#,]/g,"").split(" ").join(".*"),"gi");return n.test(t.label)||n.test(t.description)||t.tags.some(r=>n.test(r))},Epe=()=>{const e=te(),t=Ipe(),n=sl(),{t:r}=Z(),o=W(w=>w.nodes.currentConnectionFieldType),s=W(w=>{var S;return(S=w.nodes.connectionStartParams)==null?void 0:S.handleType}),i=ce([xe],({nodes:w})=>{const S=o?AT(w.nodeTemplates,_=>{const E=s=="source"?_.inputs:_.outputs;return Xr(E,I=>{const M=s=="source"?o:I.type,R=s=="target"?o:I.type;return ob(M,R)})}):nr(w.nodeTemplates),j=nr(S,_=>({label:_.title,value:_.type,description:_.description,tags:_.tags}));return o===null&&(j.push({label:r("nodes.currentImage"),value:"current_image",description:r("nodes.currentImageDescription"),tags:["progress"]}),j.push({label:r("nodes.notes"),value:"notes",description:r("nodes.notesDescription"),tags:["notes"]})),j.sort((_,E)=>_.label.localeCompare(E.label)),{data:j,t:r}},je),{data:l}=W(i),u=W(w=>w.nodes.isAddNodePopoverOpen),p=d.useRef(null),m=d.useCallback(w=>{const S=t(w);if(!S){const j=r("nodes.unknownNode",{nodeType:w});n({status:"error",title:j});return}e(TT(S))},[e,t,n,r]),h=d.useCallback(w=>{w&&m(w)},[m]),g=d.useCallback(()=>{e(NT())},[e]),x=d.useCallback(()=>{e(zI())},[e]),y=d.useCallback(w=>{w.preventDefault(),x(),setTimeout(()=>{var S;(S=p.current)==null||S.focus()},0)},[x]),b=d.useCallback(()=>{g()},[g]);return et(["shift+a","space"],y),et(["escape"],b),a.jsxs(Ld,{initialFocusRef:p,isOpen:u,onClose:g,placement:"bottom",openDelay:0,closeDelay:0,closeOnBlur:!0,returnFocusOnClose:!0,children:[a.jsx(B3,{children:a.jsx(L,{sx:{position:"absolute",top:"15%",insetInlineStart:"50%",pointerEvents:"none"}})}),a.jsx(zd,{sx:{p:0,top:-1,shadow:"dark-lg",borderColor:"accent.300",borderWidth:"2px",borderStyle:"solid",_dark:{borderColor:"accent.400"}},children:a.jsx(Uh,{sx:{p:0},children:a.jsx(nn,{inputRef:p,selectOnBlur:!1,placeholder:r("nodes.nodeSearch"),value:null,data:l,maxDropdownHeight:400,nothingFound:r("nodes.noMatchingNodes"),itemComponent:e7,filter:Ppe,onChange:h,hoverOnSearchChange:!0,onDropdownClose:g,sx:{width:"32rem",input:{padding:"0.5rem"}}})})})]})},Mpe=d.memo(Epe),Ope=()=>{const e=rb(),t=W(r=>r.nodes.shouldValidateGraph);return d.useCallback(({source:r,sourceHandle:o,target:s,targetHandle:i})=>{var x,y;const l=e.getEdges(),u=e.getNodes();if(!(r&&o&&s&&i))return!1;const p=e.getNode(r),m=e.getNode(s);if(!(p&&m&&p.data&&m.data))return!1;const h=(x=p.data.outputs[o])==null?void 0:x.type,g=(y=m.data.inputs[i])==null?void 0:y.type;return!h||!g||r===s?!1:t?l.find(b=>{b.target===s&&b.targetHandle===i&&b.source===r&&b.sourceHandle})||l.find(b=>b.target===s&&b.targetHandle===i)&&g!=="CollectionItem"||!ob(h,g)?!1:FI(r,s,u,l):!0},[e,t])},hd=e=>`var(--invokeai-colors-${e.split(".").join("-")})`,Rpe=ce(xe,({nodes:e})=>{const{shouldAnimateEdges:t,currentConnectionFieldType:n,shouldColorEdges:r}=e,o=hd(n&&r?wd[n].color:"base.500");let s="react-flow__custom_connection-path";return t&&(s=s.concat(" animated")),{stroke:o,className:s}}),Dpe=({fromX:e,fromY:t,fromPosition:n,toX:r,toY:o,toPosition:s})=>{const{stroke:i,className:l}=W(Rpe),u={sourceX:e,sourceY:t,sourcePosition:n,targetX:r,targetY:o,targetPosition:s},[p]=sb(u);return a.jsx("g",{children:a.jsx("path",{fill:"none",stroke:i,strokeWidth:2,className:l,d:p,style:{opacity:.8}})})},Ape=d.memo(Dpe),t7=(e,t,n,r,o)=>ce(xe,({nodes:s})=>{var g,x;const i=s.nodes.find(y=>y.id===e),l=s.nodes.find(y=>y.id===n),u=Mn(i)&&Mn(l),p=(i==null?void 0:i.selected)||(l==null?void 0:l.selected)||o,m=u?(x=(g=i==null?void 0:i.data)==null?void 0:g.outputs[t||""])==null?void 0:x.type:void 0,h=m&&s.shouldColorEdges?hd(wd[m].color):hd("base.500");return{isSelected:p,shouldAnimate:s.shouldAnimateEdges&&p,stroke:h}},je),Tpe=({sourceX:e,sourceY:t,targetX:n,targetY:r,sourcePosition:o,targetPosition:s,markerEnd:i,data:l,selected:u,source:p,target:m,sourceHandleId:h,targetHandleId:g})=>{const x=d.useMemo(()=>t7(p,h,m,g,u),[u,p,h,m,g]),{isSelected:y,shouldAnimate:b}=W(x),[w,S,j]=sb({sourceX:e,sourceY:t,sourcePosition:o,targetX:n,targetY:r,targetPosition:s}),{base500:_}=Wd();return a.jsxs(a.Fragment,{children:[a.jsx(BI,{path:w,markerEnd:i,style:{strokeWidth:y?3:2,stroke:_,opacity:y?.8:.5,animation:b?"dashdraw 0.5s linear infinite":void 0,strokeDasharray:b?5:"none"}}),(l==null?void 0:l.count)&&l.count>1&&a.jsx($T,{children:a.jsx(L,{sx:{position:"absolute",transform:`translate(-50%, -50%) translate(${S}px,${j}px)`},className:"nodrag nopan",children:a.jsx(Ds,{variant:"solid",sx:{bg:"base.500",opacity:y?.8:.5,boxShadow:"base"},children:l.count})})})]})},Npe=d.memo(Tpe),$pe=({sourceX:e,sourceY:t,targetX:n,targetY:r,sourcePosition:o,targetPosition:s,markerEnd:i,selected:l,source:u,target:p,sourceHandleId:m,targetHandleId:h})=>{const g=d.useMemo(()=>t7(u,m,p,h,l),[u,m,p,h,l]),{isSelected:x,shouldAnimate:y,stroke:b}=W(g),[w]=sb({sourceX:e,sourceY:t,sourcePosition:o,targetX:n,targetY:r,targetPosition:s});return a.jsx(BI,{path:w,markerEnd:i,style:{strokeWidth:x?3:2,stroke:b,opacity:x?.8:.5,animation:y?"dashdraw 0.5s linear infinite":void 0,strokeDasharray:y?5:"none"}})},Lpe=d.memo($pe),zpe=e=>{const{nodeId:t,width:n,children:r,selected:o}=e,{isMouseOverNode:s,handleMouseOut:i,handleMouseOver:l}=fO(t),u=d.useMemo(()=>ce(xe,({nodes:j})=>{var _;return((_=j.nodeExecutionStates[t])==null?void 0:_.status)===Ys.IN_PROGRESS}),[t]),p=W(u),[m,h,g,x]=Ho("shadows",["nodeInProgress.light","nodeInProgress.dark","shadows.xl","shadows.base"]),y=te(),b=sa(m,h),w=W(j=>j.nodes.nodeOpacity),S=d.useCallback(j=>{!j.ctrlKey&&!j.altKey&&!j.metaKey&&!j.shiftKey&&y(LT(t)),y(HI())},[y,t]);return a.jsxs(Ie,{onClick:S,onMouseEnter:l,onMouseLeave:i,className:tl,sx:{h:"full",position:"relative",borderRadius:"base",w:n??g1,transitionProperty:"common",transitionDuration:"0.1s",cursor:"grab",opacity:w},children:[a.jsx(Ie,{sx:{position:"absolute",top:0,insetInlineEnd:0,bottom:0,insetInlineStart:0,borderRadius:"base",pointerEvents:"none",shadow:`${g}, ${x}, ${x}`,zIndex:-1}}),a.jsx(Ie,{sx:{position:"absolute",top:0,insetInlineEnd:0,bottom:0,insetInlineStart:0,borderRadius:"md",pointerEvents:"none",transitionProperty:"common",transitionDuration:"0.1s",opacity:.7,shadow:p?b:void 0,zIndex:-1}}),r,a.jsx(dO,{isSelected:o,isHovered:s})]})},Ng=d.memo(zpe),Fpe=ce(xe,({system:e,gallery:t})=>{var r;return{imageDTO:t.selection[t.selection.length-1],progressImage:(r=e.denoiseProgress)==null?void 0:r.progress_image}}),Bpe=e=>{const{progressImage:t,imageDTO:n}=zT(Fpe);return t?a.jsx(e1,{nodeProps:e,children:a.jsx(ga,{src:t.dataURL,sx:{w:"full",h:"full",objectFit:"contain",borderRadius:"base"}})}):n?a.jsx(e1,{nodeProps:e,children:a.jsx(ua,{imageDTO:n,isDragDisabled:!0,useThumbailFallback:!0})}):a.jsx(e1,{nodeProps:e,children:a.jsx(Zn,{})})},Hpe=d.memo(Bpe),e1=e=>{const[t,n]=d.useState(!1),r=()=>{n(!0)},o=()=>{n(!1)};return a.jsx(Ng,{nodeId:e.nodeProps.id,selected:e.nodeProps.selected,width:384,children:a.jsxs(L,{onMouseEnter:r,onMouseLeave:o,className:tl,sx:{position:"relative",flexDirection:"column"},children:[a.jsx(L,{layerStyle:"nodeHeader",sx:{borderTopRadius:"base",alignItems:"center",justifyContent:"center",h:8},children:a.jsx(ve,{sx:{fontSize:"sm",fontWeight:600,color:"base.700",_dark:{color:"base.200"}},children:"Current Image"})}),a.jsxs(L,{layerStyle:"nodeBody",sx:{w:"full",h:"full",borderBottomRadius:"base",p:2},children:[e.children,t&&a.jsx(In.div,{initial:{opacity:0},animate:{opacity:1,transition:{duration:.1}},exit:{opacity:0,transition:{duration:.1}},style:{position:"absolute",top:40,left:-2,right:-2,bottom:0,pointerEvents:"none"},children:a.jsx(GO,{})},"nextPrevButtons")]})]})})},Vpe=e=>{const t=d.useMemo(()=>ce(xe,({nodes:r})=>{const o=r.nodes.find(i=>i.id===e);if(!Mn(o))return[];const s=r.nodeTemplates[o.data.type];return s?nr(s.inputs).filter(i=>(["any","direct"].includes(i.input)||ab.includes(i.type))&&VI.includes(i.type)).filter(i=>!i.ui_hidden).sort((i,l)=>(i.ui_order??0)-(l.ui_order??0)).map(i=>i.name).filter(i=>i!=="is_intermediate"):[]},je),[e]);return W(t)},Wpe=e=>{const t=d.useMemo(()=>ce(xe,({nodes:r})=>{const o=r.nodes.find(i=>i.id===e);if(!Mn(o))return[];const s=r.nodeTemplates[o.data.type];return s?nr(s.inputs).filter(i=>i.input==="connection"&&!ab.includes(i.type)||!VI.includes(i.type)).filter(i=>!i.ui_hidden).sort((i,l)=>(i.ui_order??0)-(l.ui_order??0)).map(i=>i.name).filter(i=>i!=="is_intermediate"):[]},je),[e]);return W(t)},Upe=e=>{const t=d.useMemo(()=>ce(xe,({nodes:r})=>{const o=r.nodes.find(i=>i.id===e);if(!Mn(o))return[];const s=r.nodeTemplates[o.data.type];return s?nr(s.outputs).filter(i=>!i.ui_hidden).sort((i,l)=>(i.ui_order??0)-(l.ui_order??0)).map(i=>i.name).filter(i=>i!=="is_intermediate"):[]},je),[e]);return W(t)},Gpe=e=>{const t=d.useMemo(()=>ce(xe,({nodes:r})=>{const o=r.nodes.find(s=>s.id===e);return Mn(o)?o.data.embedWorkflow:!1},je),[e]);return W(t)},$g=e=>{const t=d.useMemo(()=>ce(xe,({nodes:r})=>{const o=r.nodes.find(s=>s.id===e);return Mn(o)?Xr(o.data.outputs,s=>FT.includes(s.type)&&o.data.type!=="image"):!1},je),[e]);return W(t)},Kpe=({nodeId:e})=>{const t=te(),n=$g(e),r=Gpe(e),o=d.useCallback(s=>{t(BT({nodeId:e,embedWorkflow:s.target.checked}))},[t,e]);return n?a.jsxs(Kt,{as:L,sx:{alignItems:"center",gap:2,w:"auto"},children:[a.jsx(wn,{sx:{fontSize:"xs",mb:"1px"},children:"Workflow"}),a.jsx(Md,{className:"nopan",size:"sm",onChange:o,isChecked:r})]}):null},qpe=d.memo(Kpe),Xpe=e=>{const t=d.useMemo(()=>ce(xe,({nodes:r})=>{const o=r.nodes.find(s=>s.id===e);return Mn(o)?o.data.isIntermediate:!1},je),[e]);return W(t)},Qpe=({nodeId:e})=>{const t=te(),n=$g(e),r=Xpe(e),o=d.useCallback(s=>{t(HT({nodeId:e,isIntermediate:!s.target.checked}))},[t,e]);return n?a.jsxs(Kt,{as:L,sx:{alignItems:"center",gap:2,w:"auto"},children:[a.jsx(wn,{sx:{fontSize:"xs",mb:"1px"},children:"Save to Gallery"}),a.jsx(Md,{className:"nopan",size:"sm",onChange:o,isChecked:!r})]}):null},Ype=d.memo(Qpe),Zpe=e=>{const t=d.useMemo(()=>ce(xe,({nodes:r})=>{const o=r.nodes.find(s=>s.id===e);return Mn(o)?o.data.useCache:!1},je),[e]);return W(t)},Jpe=({nodeId:e})=>{const t=te(),n=Zpe(e),r=d.useCallback(o=>{t(VT({nodeId:e,useCache:o.target.checked}))},[t,e]);return a.jsxs(Kt,{as:L,sx:{alignItems:"center",gap:2,w:"auto"},children:[a.jsx(wn,{sx:{fontSize:"xs",mb:"1px"},children:"Use Cache"}),a.jsx(Md,{className:"nopan",size:"sm",onChange:r,isChecked:n})]})},eme=d.memo(Jpe),tme=({nodeId:e})=>{const t=$g(e),n=Bt("invocationCache").isFeatureEnabled;return a.jsxs(L,{className:tl,layerStyle:"nodeFooter",sx:{w:"full",borderBottomRadius:"base",px:2,py:0,h:6,justifyContent:"space-between"},children:[n&&a.jsx(eme,{nodeId:e}),t&&a.jsx(qpe,{nodeId:e}),t&&a.jsx(Ype,{nodeId:e})]})},nme=d.memo(tme),rme=({nodeId:e,isOpen:t})=>{const n=te(),r=WT(),o=d.useCallback(()=>{n(UT({nodeId:e,isOpen:!t})),r(e)},[n,t,e,r]);return a.jsx(Fe,{className:"nodrag",onClick:o,"aria-label":"Minimize",sx:{minW:8,w:8,h:8,color:"base.500",_dark:{color:"base.500"},_hover:{color:"base.700",_dark:{color:"base.300"}}},variant:"link",icon:a.jsx(gg,{sx:{transform:t?"rotate(0deg)":"rotate(180deg)",transitionProperty:"common",transitionDuration:"normal"}})})},u2=d.memo(rme),n7=e=>{const t=d.useMemo(()=>ce(xe,({nodes:r})=>{const o=r.nodes.find(s=>s.id===e);return Mn(o)?o.data.label:!1},je),[e]);return W(t)},r7=e=>{const t=d.useMemo(()=>ce(xe,({nodes:r})=>{const o=r.nodes.find(i=>i.id===e);if(!Mn(o))return!1;const s=o?r.nodeTemplates[o.data.type]:void 0;return s==null?void 0:s.title},je),[e]);return W(t)},ome=({nodeId:e,title:t})=>{const n=te(),r=n7(e),o=r7(e),{t:s}=Z(),[i,l]=d.useState(""),u=d.useCallback(async m=>{n(GT({nodeId:e,label:m})),l(r||t||o||s("nodes.problemSettingTitle"))},[n,e,t,o,r,s]),p=d.useCallback(m=>{l(m)},[]);return d.useEffect(()=>{l(r||t||o||s("nodes.problemSettingTitle"))},[r,o,t,s]),a.jsx(L,{sx:{overflow:"hidden",w:"full",h:"full",alignItems:"center",justifyContent:"center",cursor:"text"},children:a.jsxs(Ih,{as:L,value:i,onChange:p,onSubmit:u,sx:{alignItems:"center",position:"relative",w:"full",h:"full"},children:[a.jsx(_h,{fontSize:"sm",sx:{p:0,w:"full"},noOfLines:1}),a.jsx(jh,{className:"nodrag",fontSize:"sm",sx:{p:0,fontWeight:700,_focusVisible:{p:0,boxShadow:"none"}}}),a.jsx(sme,{})]})})},o7=d.memo(ome);function sme(){const{isEditing:e,getEditButtonProps:t}=C5(),n=d.useCallback(r=>{const{onClick:o}=t();o&&o(r)},[t]);return e?null:a.jsx(Ie,{className:tl,onDoubleClick:n,sx:{position:"absolute",w:"full",h:"full",top:0,cursor:"grab"}})}const d2=e=>{const t=d.useMemo(()=>ce(xe,({nodes:r})=>{const o=r.nodes.find(s=>s.id===e);return o==null?void 0:o.data},je),[e]);return W(t)},ame=({nodeId:e})=>{const t=d2(e),{base400:n,base600:r}=Wd(),o=sa(n,r),s=d.useMemo(()=>({borderWidth:0,borderRadius:"3px",width:"1rem",height:"1rem",backgroundColor:o,zIndex:-1}),[o]);return em(t)?a.jsxs(a.Fragment,{children:[a.jsx(Ou,{type:"target",id:`${t.id}-collapsed-target`,isConnectable:!1,position:Ql.Left,style:{...s,left:"-0.5rem"}}),nr(t.inputs,i=>a.jsx(Ou,{type:"target",id:i.name,isConnectable:!1,position:Ql.Left,style:{visibility:"hidden"}},`${t.id}-${i.name}-collapsed-input-handle`)),a.jsx(Ou,{type:"source",id:`${t.id}-collapsed-source`,isConnectable:!1,position:Ql.Right,style:{...s,right:"-0.5rem"}}),nr(t.outputs,i=>a.jsx(Ou,{type:"source",id:i.name,isConnectable:!1,position:Ql.Right,style:{visibility:"hidden"}},`${t.id}-${i.name}-collapsed-output-handle`))]}):null},ime=d.memo(ame),lme=e=>{const t=d.useMemo(()=>ce(xe,({nodes:r})=>{const o=r.nodes.find(i=>i.id===e);return r.nodeTemplates[(o==null?void 0:o.data.type)??""]},je),[e]);return W(t)},cme=({nodeId:e})=>{const t=te(),n=d2(e),{t:r}=Z(),o=d.useCallback(s=>{t(KT({nodeId:e,notes:s.target.value}))},[t,e]);return em(n)?a.jsxs(Kt,{children:[a.jsx(wn,{children:r("nodes.notes")}),a.jsx(da,{value:n==null?void 0:n.notes,onChange:o,rows:10})]}):null},ume=d.memo(cme),dme=e=>{const t=d.useMemo(()=>ce(xe,({nodes:r})=>{var i;const o=r.nodes.find(l=>l.id===e);if(!Mn(o))return!1;const s=r.nodeTemplates[(o==null?void 0:o.data.type)??""];return!(s!=null&&s.version)||!((i=o.data)!=null&&i.version)?!1:Y_(s.version,o.data.version)===0},je),[e]);return W(t)},fme=({nodeId:e})=>{const{isOpen:t,onOpen:n,onClose:r}=Lr(),o=n7(e),s=r7(e),i=dme(e),{t:l}=Z();return a.jsxs(a.Fragment,{children:[a.jsx(Ht,{label:a.jsx(s7,{nodeId:e}),placement:"top",shouldWrapChildren:!0,children:a.jsx(L,{className:"nodrag",onClick:n,sx:{alignItems:"center",justifyContent:"center",w:8,h:8,cursor:"pointer"},children:a.jsx(Tn,{as:fM,sx:{boxSize:4,w:8,color:i?"base.400":"error.400"}})})}),a.jsxs(Ki,{isOpen:t,onClose:r,isCentered:!0,children:[a.jsx(Yo,{}),a.jsxs(qi,{children:[a.jsx(Qo,{children:o||s||l("nodes.unknownNode")}),a.jsx($d,{}),a.jsx(Zo,{children:a.jsx(ume,{nodeId:e})}),a.jsx(Ss,{})]})]})]})},pme=d.memo(fme),s7=d.memo(({nodeId:e})=>{const t=d2(e),n=lme(e),{t:r}=Z(),o=d.useMemo(()=>t!=null&&t.label&&(n!=null&&n.title)?`${t.label} (${n.title})`:t!=null&&t.label&&!n?t.label:!(t!=null&&t.label)&&n?n.title:r("nodes.unknownNode"),[t,n,r]),s=d.useMemo(()=>!em(t)||!n?null:t.version?n.version?qw(t.version,n.version,"<")?a.jsxs(ve,{as:"span",sx:{color:"error.500"},children:[r("nodes.version")," ",t.version," (",r("nodes.updateNode"),")"]}):qw(t.version,n.version,">")?a.jsxs(ve,{as:"span",sx:{color:"error.500"},children:[r("nodes.version")," ",t.version," (",r("nodes.updateApp"),")"]}):a.jsxs(ve,{as:"span",children:[r("nodes.version")," ",t.version]}):a.jsxs(ve,{as:"span",sx:{color:"error.500"},children:[r("nodes.version")," ",t.version," (",r("nodes.unknownTemplate"),")"]}):a.jsx(ve,{as:"span",sx:{color:"error.500"},children:r("nodes.versionUnknown")}),[t,n,r]);return em(t)?a.jsxs(L,{sx:{flexDir:"column"},children:[a.jsx(ve,{as:"span",sx:{fontWeight:600},children:o}),a.jsx(ve,{sx:{opacity:.7,fontStyle:"oblique 5deg"},children:n==null?void 0:n.description}),s,(t==null?void 0:t.notes)&&a.jsx(ve,{children:t.notes})]}):a.jsx(ve,{sx:{fontWeight:600},children:r("nodes.unknownNode")})});s7.displayName="TooltipContent";const t1=3,E_={circle:{transitionProperty:"none",transitionDuration:"0s"},".chakra-progress__track":{stroke:"transparent"}},mme=({nodeId:e})=>{const t=d.useMemo(()=>ce(xe,({nodes:r})=>r.nodeExecutionStates[e]),[e]),n=W(t);return n?a.jsx(Ht,{label:a.jsx(a7,{nodeExecutionState:n}),placement:"top",children:a.jsx(L,{className:tl,sx:{w:5,h:"full",alignItems:"center",justifyContent:"flex-end"},children:a.jsx(i7,{nodeExecutionState:n})})}):null},hme=d.memo(mme),a7=d.memo(({nodeExecutionState:e})=>{const{status:t,progress:n,progressImage:r}=e,{t:o}=Z();return t===Ys.PENDING?a.jsx(ve,{children:"Pending"}):t===Ys.IN_PROGRESS?r?a.jsxs(L,{sx:{pos:"relative",pt:1.5,pb:.5},children:[a.jsx(ga,{src:r.dataURL,sx:{w:32,h:32,borderRadius:"base",objectFit:"contain"}}),n!==null&&a.jsxs(Ds,{variant:"solid",sx:{pos:"absolute",top:2.5,insetInlineEnd:1},children:[Math.round(n*100),"%"]})]}):n!==null?a.jsxs(ve,{children:[o("nodes.executionStateInProgress")," (",Math.round(n*100),"%)"]}):a.jsx(ve,{children:o("nodes.executionStateInProgress")}):t===Ys.COMPLETED?a.jsx(ve,{children:o("nodes.executionStateCompleted")}):t===Ys.FAILED?a.jsx(ve,{children:o("nodes.executionStateError")}):null});a7.displayName="TooltipLabel";const i7=d.memo(e=>{const{progress:t,status:n}=e.nodeExecutionState;return n===Ys.PENDING?a.jsx(Tn,{as:AJ,sx:{boxSize:t1,color:"base.600",_dark:{color:"base.300"}}}):n===Ys.IN_PROGRESS?t===null?a.jsx(B1,{isIndeterminate:!0,size:"14px",color:"base.500",thickness:14,sx:E_}):a.jsx(B1,{value:Math.round(t*100),size:"14px",color:"base.500",thickness:14,sx:E_}):n===Ys.COMPLETED?a.jsx(Tn,{as:iM,sx:{boxSize:t1,color:"ok.600",_dark:{color:"ok.300"}}}):n===Ys.FAILED?a.jsx(Tn,{as:$J,sx:{boxSize:t1,color:"error.600",_dark:{color:"error.300"}}}):null});i7.displayName="StatusIcon";const gme=({nodeId:e,isOpen:t})=>a.jsxs(L,{layerStyle:"nodeHeader",sx:{borderTopRadius:"base",borderBottomRadius:t?0:"base",alignItems:"center",justifyContent:"space-between",h:8,textAlign:"center",fontWeight:500,color:"base.700",_dark:{color:"base.200"}},children:[a.jsx(u2,{nodeId:e,isOpen:t}),a.jsx(o7,{nodeId:e}),a.jsxs(L,{alignItems:"center",children:[a.jsx(hme,{nodeId:e}),a.jsx(pme,{nodeId:e})]}),!t&&a.jsx(ime,{nodeId:e})]}),vme=d.memo(gme),xme=(e,t,n,r)=>ce(xe,o=>{if(!r)return yt.t("nodes.noFieldType");const{currentConnectionFieldType:s,connectionStartParams:i,nodes:l,edges:u}=o.nodes;if(!i||!s)return yt.t("nodes.noConnectionInProgress");const{handleType:p,nodeId:m,handleId:h}=i;if(!p||!m||!h)return yt.t("nodes.noConnectionData");const g=n==="target"?r:s,x=n==="source"?r:s;if(e===m)return yt.t("nodes.cannotConnectToSelf");if(n===p)return n==="source"?yt.t("nodes.cannotConnectOutputToOutput"):yt.t("nodes.cannotConnectInputToInput");const y=n==="target"?e:m,b=n==="target"?t:h,w=n==="source"?e:m,S=n==="source"?t:h;return u.find(_=>{_.target===y&&_.targetHandle===b&&_.source===w&&_.sourceHandle})?yt.t("nodes.cannotDuplicateConnection"):u.find(_=>_.target===y&&_.targetHandle===b)&&g!=="CollectionItem"?yt.t("nodes.inputMayOnlyHaveOneConnection"):ob(x,g)?FI(p==="source"?m:e,p==="source"?e:m,l,u)?null:yt.t("nodes.connectionWouldCreateCycle"):yt.t("nodes.fieldTypesMustMatch")}),bme=(e,t,n)=>{const r=d.useMemo(()=>ce(xe,({nodes:s})=>{var l;const i=s.nodes.find(u=>u.id===e);if(Mn(i))return(l=i==null?void 0:i.data[tb[n]][t])==null?void 0:l.type},je),[t,n,e]);return W(r)},yme=ce(xe,({nodes:e})=>e.currentConnectionFieldType!==null&&e.connectionStartParams!==null),l7=({nodeId:e,fieldName:t,kind:n})=>{const r=bme(e,t,n),o=d.useMemo(()=>ce(xe,({nodes:g})=>!!g.edges.filter(x=>(n==="input"?x.target:x.source)===e&&(n==="input"?x.targetHandle:x.sourceHandle)===t).length),[t,n,e]),s=d.useMemo(()=>xme(e,t,n==="input"?"target":"source",r),[e,t,n,r]),i=d.useMemo(()=>ce(xe,({nodes:g})=>{var x,y,b;return((x=g.connectionStartParams)==null?void 0:x.nodeId)===e&&((y=g.connectionStartParams)==null?void 0:y.handleId)===t&&((b=g.connectionStartParams)==null?void 0:b.handleType)==={input:"target",output:"source"}[n]}),[t,n,e]),l=W(o),u=W(yme),p=W(i),m=W(s),h=d.useMemo(()=>!!(u&&m&&!p),[m,u,p]);return{isConnected:l,isConnectionInProgress:u,isConnectionStartField:p,connectionError:m,shouldDim:h}},Cme=(e,t)=>{const n=d.useMemo(()=>ce(xe,({nodes:o})=>{var i;const s=o.nodes.find(l=>l.id===e);if(Mn(s))return((i=s==null?void 0:s.data.inputs[t])==null?void 0:i.value)!==void 0},je),[t,e]);return W(n)},wme=(e,t)=>{const n=d.useMemo(()=>ce(xe,({nodes:o})=>{const s=o.nodes.find(u=>u.id===e);if(!Mn(s))return;const i=o.nodeTemplates[(s==null?void 0:s.data.type)??""],l=i==null?void 0:i.inputs[t];return l==null?void 0:l.input},je),[t,e]);return W(n)},Sme=({nodeId:e,fieldName:t,kind:n,children:r})=>{const o=te(),s=pO(e,t),i=mO(e,t,n),l=wme(e,t),{t:u}=Z(),p=d.useCallback(w=>{w.preventDefault()},[]),m=d.useMemo(()=>ce(xe,({nodes:w})=>({isExposed:!!w.workflow.exposedFields.find(j=>j.nodeId===e&&j.fieldName===t)}),je),[t,e]),h=d.useMemo(()=>["any","direct"].includes(l??"__UNKNOWN_INPUT__"),[l]),{isExposed:g}=W(m),x=d.useCallback(()=>{o(qT({nodeId:e,fieldName:t}))},[o,t,e]),y=d.useCallback(()=>{o(_I({nodeId:e,fieldName:t}))},[o,t,e]),b=d.useMemo(()=>{const w=[];return h&&!g&&w.push(a.jsx(en,{icon:a.jsx(Vc,{}),onClick:x,children:"Add to Linear View"},`${e}.${t}.expose-field`)),h&&g&&w.push(a.jsx(en,{icon:a.jsx(qJ,{}),onClick:y,children:"Remove from Linear View"},`${e}.${t}.unexpose-field`)),w},[t,x,y,g,h,e]);return a.jsx(Ry,{menuProps:{size:"sm",isLazy:!0},menuButtonProps:{bg:"transparent",_hover:{bg:"transparent"}},renderMenu:()=>b.length?a.jsx(Ui,{sx:{visibility:"visible !important"},motionProps:vc,onContextMenu:p,children:a.jsx(td,{title:s||i||u("nodes.unknownField"),children:b})}):null,children:r})},kme=d.memo(Sme),jme=e=>{const{fieldTemplate:t,handleType:n,isConnectionInProgress:r,isConnectionStartField:o,connectionError:s}=e,{name:i,type:l}=t,{color:u,title:p}=wd[l],m=d.useMemo(()=>{const g=XT.includes(l),x=ab.includes(l),y=QT.includes(l),b=hd(u),w={backgroundColor:g||x?"var(--invokeai-colors-base-900)":b,position:"absolute",width:"1rem",height:"1rem",borderWidth:g||x?4:0,borderStyle:"solid",borderColor:b,borderRadius:y?4:"100%",zIndex:1};return n==="target"?w.insetInlineStart="-1rem":w.insetInlineEnd="-1rem",r&&!o&&s&&(w.filter="opacity(0.4) grayscale(0.7)"),r&&s?o?w.cursor="grab":w.cursor="not-allowed":w.cursor="crosshair",w},[s,n,r,o,l,u]),h=d.useMemo(()=>r&&o?p:r&&s?s??p:p,[s,r,o,p]);return a.jsx(Ht,{label:h,placement:n==="target"?"start":"end",hasArrow:!0,openDelay:yh,children:a.jsx(Ou,{type:n,id:i,position:n==="target"?Ql.Left:Ql.Right,style:m})})},c7=d.memo(jme),_me=({nodeId:e,fieldName:t})=>{const n=Pg(e,t,"input"),r=Cme(e,t),{isConnected:o,isConnectionInProgress:s,isConnectionStartField:i,connectionError:l,shouldDim:u}=l7({nodeId:e,fieldName:t,kind:"input"}),p=d.useMemo(()=>{if((n==null?void 0:n.fieldKind)!=="input"||!n.required)return!1;if(!o&&n.input==="connection"||!r&&!o&&n.input==="any")return!0},[n,o,r]);return(n==null?void 0:n.fieldKind)!=="input"?a.jsx(Rx,{shouldDim:u,children:a.jsxs(Kt,{sx:{color:"error.400",textAlign:"left",fontSize:"sm"},children:["Unknown input: ",t]})}):a.jsxs(Rx,{shouldDim:u,children:[a.jsxs(Kt,{isInvalid:p,isDisabled:o,sx:{alignItems:"stretch",justifyContent:"space-between",ps:n.input==="direct"?0:2,gap:2,h:"full",w:"full"},children:[a.jsx(kme,{nodeId:e,fieldName:t,kind:"input",children:m=>a.jsx(wn,{sx:{display:"flex",alignItems:"center",h:"full",mb:0,px:1,gap:2},children:a.jsx(gO,{ref:m,nodeId:e,fieldName:t,kind:"input",isMissingInput:p,withTooltip:!0})})}),a.jsx(Ie,{children:a.jsx(PO,{nodeId:e,fieldName:t})})]}),n.input!=="direct"&&a.jsx(c7,{fieldTemplate:n,handleType:"target",isConnectionInProgress:s,isConnectionStartField:i,connectionError:l})]})},M_=d.memo(_me),Rx=d.memo(({shouldDim:e,children:t})=>a.jsx(L,{sx:{position:"relative",minH:8,py:.5,alignItems:"center",opacity:e?.5:1,transitionProperty:"opacity",transitionDuration:"0.1s",w:"full",h:"full"},children:t}));Rx.displayName="InputFieldWrapper";const Ime=({nodeId:e,fieldName:t})=>{const n=Pg(e,t,"output"),{isConnected:r,isConnectionInProgress:o,isConnectionStartField:s,connectionError:i,shouldDim:l}=l7({nodeId:e,fieldName:t,kind:"output"});return(n==null?void 0:n.fieldKind)!=="output"?a.jsx(Dx,{shouldDim:l,children:a.jsxs(Kt,{sx:{color:"error.400",textAlign:"right",fontSize:"sm"},children:["Unknown output: ",t]})}):a.jsxs(Dx,{shouldDim:l,children:[a.jsx(Ht,{label:a.jsx(t2,{nodeId:e,fieldName:t,kind:"output"}),openDelay:yh,placement:"top",shouldWrapChildren:!0,hasArrow:!0,children:a.jsx(Kt,{isDisabled:r,pe:2,children:a.jsx(wn,{sx:{mb:0,fontWeight:500},children:n==null?void 0:n.title})})}),a.jsx(c7,{fieldTemplate:n,handleType:"source",isConnectionInProgress:o,isConnectionStartField:s,connectionError:i})]})},Pme=d.memo(Ime),Dx=d.memo(({shouldDim:e,children:t})=>a.jsx(L,{sx:{position:"relative",minH:8,py:.5,alignItems:"center",opacity:e?.5:1,transitionProperty:"opacity",transitionDuration:"0.1s",justifyContent:"flex-end"},children:t}));Dx.displayName="OutputFieldWrapper";const Eme=e=>{const t=$g(e),n=Bt("invocationCache").isFeatureEnabled;return d.useMemo(()=>t||n,[t,n])},Mme=({nodeId:e,isOpen:t,label:n,type:r,selected:o})=>{const s=Wpe(e),i=Vpe(e),l=Eme(e),u=Upe(e);return a.jsxs(Ng,{nodeId:e,selected:o,children:[a.jsx(vme,{nodeId:e,isOpen:t,label:n,selected:o,type:r}),t&&a.jsxs(a.Fragment,{children:[a.jsx(L,{layerStyle:"nodeBody",sx:{flexDirection:"column",w:"full",h:"full",py:2,gap:1,borderBottomRadius:l?0:"base"},children:a.jsxs(L,{sx:{flexDir:"column",px:2,w:"full",h:"full"},children:[a.jsxs(Ja,{gridTemplateColumns:"1fr auto",gridAutoRows:"1fr",children:[s.map((p,m)=>a.jsx(Zu,{gridColumnStart:1,gridRowStart:m+1,children:a.jsx(M_,{nodeId:e,fieldName:p})},`${e}.${p}.input-field`)),u.map((p,m)=>a.jsx(Zu,{gridColumnStart:2,gridRowStart:m+1,children:a.jsx(Pme,{nodeId:e,fieldName:p})},`${e}.${p}.output-field`))]}),i.map(p=>a.jsx(M_,{nodeId:e,fieldName:p},`${e}.${p}.input-field`))]})}),l&&a.jsx(nme,{nodeId:e})]})]})},Ome=d.memo(Mme),Rme=({nodeId:e,isOpen:t,label:n,type:r,selected:o})=>a.jsxs(Ng,{nodeId:e,selected:o,children:[a.jsxs(L,{className:tl,layerStyle:"nodeHeader",sx:{borderTopRadius:"base",borderBottomRadius:t?0:"base",alignItems:"center",h:8,fontWeight:600,fontSize:"sm"},children:[a.jsx(u2,{nodeId:e,isOpen:t}),a.jsx(ve,{sx:{w:"full",textAlign:"center",pe:8,color:"error.500",_dark:{color:"error.300"}},children:n?`${n} (${r})`:r})]}),t&&a.jsx(L,{layerStyle:"nodeBody",sx:{userSelect:"auto",flexDirection:"column",w:"full",h:"full",p:4,gap:1,borderBottomRadius:"base",fontSize:"sm"},children:a.jsxs(Ie,{children:[a.jsx(ve,{as:"span",children:"Unknown node type: "}),a.jsx(ve,{as:"span",fontWeight:600,children:r})]})})]}),Dme=d.memo(Rme),Ame=e=>{const{data:t,selected:n}=e,{id:r,type:o,isOpen:s,label:i}=t,l=d.useMemo(()=>ce(xe,({nodes:p})=>!!p.nodeTemplates[o]),[o]);return W(l)?a.jsx(Ome,{nodeId:r,isOpen:s,label:i,type:o,selected:n}):a.jsx(Dme,{nodeId:r,isOpen:s,label:i,type:o,selected:n})},Tme=d.memo(Ame),Nme=e=>{const{id:t,data:n,selected:r}=e,{notes:o,isOpen:s}=n,i=te(),l=d.useCallback(u=>{i(YT({nodeId:t,value:u.target.value}))},[i,t]);return a.jsxs(Ng,{nodeId:t,selected:r,children:[a.jsxs(L,{layerStyle:"nodeHeader",sx:{borderTopRadius:"base",borderBottomRadius:s?0:"base",alignItems:"center",justifyContent:"space-between",h:8},children:[a.jsx(u2,{nodeId:t,isOpen:s}),a.jsx(o7,{nodeId:t,title:"Notes"}),a.jsx(Ie,{minW:8})]}),s&&a.jsx(a.Fragment,{children:a.jsx(L,{layerStyle:"nodeBody",className:"nopan",sx:{cursor:"auto",flexDirection:"column",borderBottomRadius:"base",w:"full",h:"full",p:2,gap:1},children:a.jsx(L,{className:"nopan",sx:{flexDir:"column",w:"full",h:"full"},children:a.jsx(da,{value:o,onChange:l,rows:8,resize:"none",sx:{fontSize:"xs"}})})})})]})},$me=d.memo(Nme),Lme=["Delete","Backspace"],zme={collapsed:Npe,default:Lpe},Fme={invocation:Tme,current_image:Hpe,notes:$me},Bme={hideAttribution:!0},Hme=ce(xe,({nodes:e})=>{const{shouldSnapToGrid:t,selectionMode:n}=e;return{shouldSnapToGrid:t,selectionMode:n}},je),Vme=()=>{const e=te(),t=W(O=>O.nodes.nodes),n=W(O=>O.nodes.edges),r=W(O=>O.nodes.viewport),{shouldSnapToGrid:o,selectionMode:s}=W(Hme),i=d.useRef(null),l=d.useRef(),u=Ope(),[p]=Ho("radii",["base"]),m=d.useCallback(O=>{e(ZT(O))},[e]),h=d.useCallback(O=>{e(JT(O))},[e]),g=d.useCallback((O,T)=>{e(eN(T))},[e]),x=d.useCallback(O=>{e(Tw(O))},[e]),y=d.useCallback(()=>{e(tN({cursorPosition:l.current}))},[e]),b=d.useCallback(O=>{e(nN(O))},[e]),w=d.useCallback(O=>{e(rN(O))},[e]),S=d.useCallback(({nodes:O,edges:T})=>{e(oN(O?O.map(X=>X.id):[])),e(sN(T?T.map(X=>X.id):[]))},[e]),j=d.useCallback((O,T)=>{e(aN(T))},[e]),_=d.useCallback(()=>{e(HI())},[e]),E=d.useCallback(O=>{Nw.set(O),O.fitView()},[]),I=d.useCallback(O=>{var X,B;const T=(X=i.current)==null?void 0:X.getBoundingClientRect();if(T){const V=(B=Nw.get())==null?void 0:B.project({x:O.clientX-T.left,y:O.clientY-T.top});l.current=V}},[]),M=d.useRef(),R=d.useCallback((O,T,X)=>{M.current=O,e(iN(T.id)),e(lN())},[e]),D=d.useCallback((O,T)=>{e(Tw(T))},[e]),A=d.useCallback((O,T,X)=>{var B,V;!("touches"in O)&&((B=M.current)==null?void 0:B.clientX)===O.clientX&&((V=M.current)==null?void 0:V.clientY)===O.clientY&&e(cN(T)),M.current=void 0},[e]);return et(["Ctrl+c","Meta+c"],O=>{O.preventDefault(),e(uN())}),et(["Ctrl+a","Meta+a"],O=>{O.preventDefault(),e(dN())}),et(["Ctrl+v","Meta+v"],O=>{O.preventDefault(),e(fN({cursorPosition:l.current}))}),a.jsx(pN,{id:"workflow-editor",ref:i,defaultViewport:r,nodeTypes:Fme,edgeTypes:zme,nodes:t,edges:n,onInit:E,onMouseMove:I,onNodesChange:m,onEdgesChange:h,onEdgesDelete:b,onEdgeUpdate:D,onEdgeUpdateStart:R,onEdgeUpdateEnd:A,onNodesDelete:w,onConnectStart:g,onConnect:x,onConnectEnd:y,onMoveEnd:j,connectionLineComponent:Ape,onSelectionChange:S,isValidConnection:u,minZoom:.1,snapToGrid:o,snapGrid:[25,25],connectionRadius:30,proOptions:Bme,style:{borderRadius:p},onPaneClick:_,deleteKeyCode:Lme,selectionMode:s,children:a.jsx(b$,{})})},Wme=()=>{const e=te(),{t}=Z(),n=d.useCallback(()=>{e(zI())},[e]);return a.jsx(L,{sx:{gap:2,position:"absolute",top:2,insetInlineStart:2},children:a.jsx(Fe,{tooltip:t("nodes.addNodeToolTip"),"aria-label":t("nodes.addNode"),icon:a.jsx(Vc,{}),onClick:n})})},Ume=d.memo(Wme),Gme=()=>{const e=te(),t=pP("nodes"),{t:n}=Z();return d.useCallback(o=>{if(!o)return;const s=new FileReader;s.onload=async()=>{const i=s.result;try{const l=JSON.parse(String(i)),u=mN.safeParse(l);if(!u.success){const{message:p}=hN(u.error,{prefix:n("nodes.workflowValidation")});t.error({error:gN(u.error)},p),e(ct(Qt({title:n("nodes.unableToValidateWorkflow"),status:"error",duration:5e3}))),s.abort();return}e(Xx(u.data)),s.abort()}catch{e(ct(Qt({title:n("nodes.unableToLoadWorkflow"),status:"error"})))}},s.readAsText(o)},[e,t,n])},Kme=d.memo(e=>e.error.issues[0]?a.jsx(ve,{children:$w(e.error.issues[0],{prefix:null}).toString()}):a.jsx(Od,{children:e.error.issues.map((t,n)=>a.jsx(Qr,{children:a.jsx(ve,{children:$w(t,{prefix:null}).toString()})},n))}));Kme.displayName="WorkflowValidationErrorContent";const qme=()=>{const{t:e}=Z(),t=d.useRef(null),n=Gme();return a.jsx(AE,{resetRef:t,accept:"application/json",onChange:n,children:r=>a.jsx(Fe,{icon:a.jsx(cg,{}),tooltip:e("nodes.loadWorkflow"),"aria-label":e("nodes.loadWorkflow"),...r})})},Xme=d.memo(qme),Qme=()=>{const{t:e}=Z(),t=te(),{isOpen:n,onOpen:r,onClose:o}=Lr(),s=d.useRef(null),i=W(u=>u.nodes.nodes.length),l=d.useCallback(()=>{t(vN()),t(ct(Qt({title:e("toast.nodesCleared"),status:"success"}))),o()},[t,e,o]);return a.jsxs(a.Fragment,{children:[a.jsx(Fe,{icon:a.jsx(Br,{}),tooltip:e("nodes.resetWorkflow"),"aria-label":e("nodes.resetWorkflow"),onClick:r,isDisabled:!i,colorScheme:"error"}),a.jsxs(Td,{isOpen:n,onClose:o,leastDestructiveRef:s,isCentered:!0,children:[a.jsx(Yo,{}),a.jsxs(Nd,{children:[a.jsx(Qo,{fontSize:"lg",fontWeight:"bold",children:e("nodes.resetWorkflow")}),a.jsx(Zo,{py:4,children:a.jsxs(L,{flexDir:"column",gap:2,children:[a.jsx(ve,{children:e("nodes.resetWorkflowDesc")}),a.jsx(ve,{variant:"subtext",children:e("nodes.resetWorkflowDesc2")})]})}),a.jsxs(Ss,{children:[a.jsx(Za,{ref:s,onClick:o,children:e("common.cancel")}),a.jsx(Za,{colorScheme:"error",ml:3,onClick:l,children:e("common.accept")})]})]})]})]})},Yme=d.memo(Qme),Zme=()=>{const{t:e}=Z(),t=uO(),n=d.useCallback(()=>{const r=new Blob([JSON.stringify(t,null,2)]),o=document.createElement("a");o.href=URL.createObjectURL(r),o.download=`${t.name||"My Workflow"}.json`,document.body.appendChild(o),o.click(),o.remove()},[t]);return a.jsx(Fe,{icon:a.jsx(ig,{}),tooltip:e("nodes.downloadWorkflow"),"aria-label":e("nodes.downloadWorkflow"),onClick:n})},Jme=d.memo(Zme),ehe=()=>a.jsxs(L,{sx:{gap:2,position:"absolute",top:2,insetInlineStart:"50%",transform:"translate(-50%)"},children:[a.jsx(Jme,{}),a.jsx(Xme,{}),a.jsx(Yme,{})]}),the=d.memo(ehe),nhe=()=>a.jsx(L,{sx:{gap:2,flexDir:"column"},children:nr(wd,({title:e,description:t,color:n},r)=>a.jsx(Ht,{label:t,children:a.jsx(Ds,{sx:{userSelect:"none",color:parseInt(n.split(".")[1]??"0",10)<500?"base.800":"base.50",bg:n},textAlign:"center",children:e})},r))}),rhe=d.memo(nhe),ohe=()=>{const{t:e}=Z(),t=te(),n=d.useCallback(()=>{t(xN())},[t]);return a.jsx(at,{leftIcon:a.jsx(oee,{}),tooltip:e("nodes.reloadNodeTemplates"),"aria-label":e("nodes.reloadNodeTemplates"),onClick:n,children:e("nodes.reloadNodeTemplates")})},she=d.memo(ohe),Pu={fontWeight:600},ahe=ce(xe,({nodes:e})=>{const{shouldAnimateEdges:t,shouldValidateGraph:n,shouldSnapToGrid:r,shouldColorEdges:o,selectionMode:s}=e;return{shouldAnimateEdges:t,shouldValidateGraph:n,shouldSnapToGrid:r,shouldColorEdges:o,selectionModeIsChecked:s===bN.Full}},je),ihe=ke((e,t)=>{const{isOpen:n,onOpen:r,onClose:o}=Lr(),s=te(),{shouldAnimateEdges:i,shouldValidateGraph:l,shouldSnapToGrid:u,shouldColorEdges:p,selectionModeIsChecked:m}=W(ahe),h=d.useCallback(S=>{s(yN(S.target.checked))},[s]),g=d.useCallback(S=>{s(CN(S.target.checked))},[s]),x=d.useCallback(S=>{s(wN(S.target.checked))},[s]),y=d.useCallback(S=>{s(SN(S.target.checked))},[s]),b=d.useCallback(S=>{s(kN(S.target.checked))},[s]),{t:w}=Z();return a.jsxs(a.Fragment,{children:[a.jsx(Fe,{ref:t,"aria-label":w("nodes.workflowSettings"),tooltip:w("nodes.workflowSettings"),icon:a.jsx(cM,{}),onClick:r}),a.jsxs(Ki,{isOpen:n,onClose:o,size:"2xl",isCentered:!0,children:[a.jsx(Yo,{}),a.jsxs(qi,{children:[a.jsx(Qo,{children:w("nodes.workflowSettings")}),a.jsx($d,{}),a.jsx(Zo,{children:a.jsxs(L,{sx:{flexDirection:"column",gap:4,py:4},children:[a.jsx(cr,{size:"sm",children:"General"}),a.jsx(dn,{formLabelProps:Pu,onChange:g,isChecked:i,label:w("nodes.animatedEdges"),helperText:w("nodes.animatedEdgesHelp")}),a.jsx(Yn,{}),a.jsx(dn,{formLabelProps:Pu,isChecked:u,onChange:x,label:w("nodes.snapToGrid"),helperText:w("nodes.snapToGridHelp")}),a.jsx(Yn,{}),a.jsx(dn,{formLabelProps:Pu,isChecked:p,onChange:y,label:w("nodes.colorCodeEdges"),helperText:w("nodes.colorCodeEdgesHelp")}),a.jsx(dn,{formLabelProps:Pu,isChecked:m,onChange:b,label:w("nodes.fullyContainNodes"),helperText:w("nodes.fullyContainNodesHelp")}),a.jsx(cr,{size:"sm",pt:4,children:"Advanced"}),a.jsx(dn,{formLabelProps:Pu,isChecked:l,onChange:h,label:w("nodes.validateConnections"),helperText:w("nodes.validateConnectionsHelp")}),a.jsx(she,{})]})})]})]})]})}),lhe=d.memo(ihe),che=()=>{const e=W(t=>t.nodes.shouldShowFieldTypeLegend);return a.jsxs(L,{sx:{gap:2,position:"absolute",top:2,insetInlineEnd:2},children:[a.jsx(lhe,{}),e&&a.jsx(rhe,{})]})},uhe=d.memo(che);function dhe(){const e=te(),t=W(o=>o.nodes.nodeOpacity),{t:n}=Z(),r=d.useCallback(o=>{e(jN(o))},[e]);return a.jsx(L,{alignItems:"center",children:a.jsxs(Wb,{"aria-label":n("nodes.nodeOpacity"),value:t,min:.5,max:1,step:.01,onChange:r,orientation:"vertical",defaultValue:30,h:"calc(100% - 0.5rem)",children:[a.jsx(Gb,{children:a.jsx(Kb,{})}),a.jsx(Ub,{})]})})}const fhe=()=>{const{t:e}=Z(),{zoomIn:t,zoomOut:n,fitView:r}=rb(),o=te(),s=W(m=>m.nodes.shouldShowMinimapPanel),i=d.useCallback(()=>{t()},[t]),l=d.useCallback(()=>{n()},[n]),u=d.useCallback(()=>{r()},[r]),p=d.useCallback(()=>{o(_N(!s))},[s,o]);return a.jsxs(Vt,{isAttached:!0,orientation:"vertical",children:[a.jsx(Fe,{tooltip:e("nodes.zoomInNodes"),"aria-label":e("nodes.zoomInNodes"),onClick:i,icon:a.jsx(yoe,{})}),a.jsx(Fe,{tooltip:e("nodes.zoomOutNodes"),"aria-label":e("nodes.zoomOutNodes"),onClick:l,icon:a.jsx(boe,{})}),a.jsx(Fe,{tooltip:e("nodes.fitViewportNodes"),"aria-label":e("nodes.fitViewportNodes"),onClick:u,icon:a.jsx(uM,{})}),a.jsx(Fe,{tooltip:e(s?"nodes.hideMinimapnodes":"nodes.showMinimapnodes"),"aria-label":e(s?"nodes.hideMinimapnodes":"nodes.showMinimapnodes"),isChecked:s,onClick:p,icon:a.jsx(KJ,{})})]})},phe=d.memo(fhe),mhe=()=>a.jsxs(L,{sx:{gap:2,position:"absolute",bottom:2,insetInlineStart:2},children:[a.jsx(phe,{}),a.jsx(dhe,{})]}),hhe=d.memo(mhe),ghe=we(p$),vhe=()=>{const e=W(r=>r.nodes.shouldShowMinimapPanel),t=sa("var(--invokeai-colors-accent-300)","var(--invokeai-colors-accent-600)"),n=sa("var(--invokeai-colors-blackAlpha-300)","var(--invokeai-colors-blackAlpha-600)");return a.jsx(L,{sx:{gap:2,position:"absolute",bottom:2,insetInlineEnd:2},children:e&&a.jsx(ghe,{pannable:!0,zoomable:!0,nodeBorderRadius:15,sx:{m:"0 !important",backgroundColor:"base.200 !important",borderRadius:"base",_dark:{backgroundColor:"base.500 !important"},svg:{borderRadius:"inherit"}},nodeColor:t,maskColor:n})})},xhe=d.memo(vhe),bhe=()=>{const e=W(n=>n.nodes.isReady),{t}=Z();return a.jsxs(L,{layerStyle:"first",sx:{position:"relative",width:"full",height:"full",borderRadius:"base",alignItems:"center",justifyContent:"center"},children:[a.jsx(dr,{children:e&&a.jsxs(In.div,{initial:{opacity:0},animate:{opacity:1,transition:{duration:.2}},exit:{opacity:0,transition:{duration:.2}},style:{position:"relative",width:"100%",height:"100%"},children:[a.jsx(Vme,{}),a.jsx(Mpe,{}),a.jsx(Ume,{}),a.jsx(the,{}),a.jsx(uhe,{}),a.jsx(hhe,{}),a.jsx(xhe,{})]})}),a.jsx(dr,{children:!e&&a.jsx(In.div,{initial:{opacity:0},animate:{opacity:1,transition:{duration:.2}},exit:{opacity:0,transition:{duration:.2}},style:{position:"absolute",width:"100%",height:"100%"},children:a.jsx(L,{layerStyle:"first",sx:{position:"relative",width:"full",height:"full",borderRadius:"base",alignItems:"center",justifyContent:"center",pointerEvents:"none"},children:a.jsx(Zn,{label:t("nodes.loadingNodes"),icon:Coe})})})})]})},yhe=d.memo(bhe),Che=()=>a.jsx(IN,{children:a.jsx(yhe,{})}),whe=d.memo(Che),She=()=>{const{t:e}=Z(),t=te(),{data:n}=kd(),r=W(u=>u.system.isConnected),[o,{isLoading:s}]=PN({fixedCacheKey:"clearInvocationCache"}),i=d.useMemo(()=>!(n!=null&&n.size)||!r,[n==null?void 0:n.size,r]);return{clearInvocationCache:d.useCallback(async()=>{if(!i)try{await o().unwrap(),t(ct({title:e("invocationCache.clearSucceeded"),status:"success"}))}catch{t(ct({title:e("invocationCache.clearFailed"),status:"error"}))}},[i,o,t,e]),isLoading:s,cacheStatus:n,isDisabled:i}},khe=()=>{const{t:e}=Z(),{clearInvocationCache:t,isDisabled:n,isLoading:r}=She();return a.jsx(at,{isDisabled:n,isLoading:r,onClick:t,children:e("invocationCache.clear")})},jhe=d.memo(khe),_he=()=>{const{t:e}=Z(),t=te(),{data:n}=kd(),r=W(u=>u.system.isConnected),[o,{isLoading:s}]=EN({fixedCacheKey:"disableInvocationCache"}),i=d.useMemo(()=>!(n!=null&&n.enabled)||!r||(n==null?void 0:n.max_size)===0,[n==null?void 0:n.enabled,n==null?void 0:n.max_size,r]);return{disableInvocationCache:d.useCallback(async()=>{if(!i)try{await o().unwrap(),t(ct({title:e("invocationCache.disableSucceeded"),status:"success"}))}catch{t(ct({title:e("invocationCache.disableFailed"),status:"error"}))}},[i,o,t,e]),isLoading:s,cacheStatus:n,isDisabled:i}},Ihe=()=>{const{t:e}=Z(),t=te(),{data:n}=kd(),r=W(u=>u.system.isConnected),[o,{isLoading:s}]=MN({fixedCacheKey:"enableInvocationCache"}),i=d.useMemo(()=>(n==null?void 0:n.enabled)||!r||(n==null?void 0:n.max_size)===0,[n==null?void 0:n.enabled,n==null?void 0:n.max_size,r]);return{enableInvocationCache:d.useCallback(async()=>{if(!i)try{await o().unwrap(),t(ct({title:e("invocationCache.enableSucceeded"),status:"success"}))}catch{t(ct({title:e("invocationCache.enableFailed"),status:"error"}))}},[i,o,t,e]),isLoading:s,cacheStatus:n,isDisabled:i}},Phe=()=>{const{t:e}=Z(),{data:t}=kd(),{enableInvocationCache:n,isDisabled:r,isLoading:o}=Ihe(),{disableInvocationCache:s,isDisabled:i,isLoading:l}=_he();return t!=null&&t.enabled?a.jsx(at,{isDisabled:i,isLoading:l,onClick:s,children:e("invocationCache.disable")}):a.jsx(at,{isDisabled:r,isLoading:o,onClick:n,children:e("invocationCache.enable")})},Ehe=d.memo(Phe),Mhe=({children:e,...t})=>a.jsx(iP,{alignItems:"center",justifyContent:"center",w:"full",h:"full",layerStyle:"second",borderRadius:"base",py:2,px:3,gap:6,flexWrap:"nowrap",...t,children:e}),u7=d.memo(Mhe),Ohe={'&[aria-disabled="true"]':{color:"base.400",_dark:{color:"base.500"}}},Rhe=({label:e,value:t,isDisabled:n=!1,...r})=>a.jsxs(aP,{flexGrow:1,textOverflow:"ellipsis",overflow:"hidden",whiteSpace:"nowrap","aria-disabled":n,sx:Ohe,...r,children:[a.jsx(lP,{textOverflow:"ellipsis",overflow:"hidden",whiteSpace:"nowrap",children:e}),a.jsx(cP,{children:t})]}),hs=d.memo(Rhe),Dhe=()=>{const{t:e}=Z(),{data:t}=kd(void 0);return a.jsxs(u7,{children:[a.jsx(hs,{isDisabled:!(t!=null&&t.enabled),label:e("invocationCache.cacheSize"),value:(t==null?void 0:t.size)??0}),a.jsx(hs,{isDisabled:!(t!=null&&t.enabled),label:e("invocationCache.hits"),value:(t==null?void 0:t.hits)??0}),a.jsx(hs,{isDisabled:!(t!=null&&t.enabled),label:e("invocationCache.misses"),value:(t==null?void 0:t.misses)??0}),a.jsx(hs,{isDisabled:!(t!=null&&t.enabled),label:e("invocationCache.maxCacheSize"),value:(t==null?void 0:t.max_size)??0}),a.jsxs(Vt,{w:24,orientation:"vertical",size:"xs",children:[a.jsx(jhe,{}),a.jsx(Ehe,{})]})]})},Ahe=d.memo(Dhe),d7=e=>{const t=W(l=>l.system.isConnected),[n,{isLoading:r}]=Yx(),o=te(),{t:s}=Z();return{cancelQueueItem:d.useCallback(async()=>{try{await n(e).unwrap(),o(ct({title:s("queue.cancelSucceeded"),status:"success"}))}catch{o(ct({title:s("queue.cancelFailed"),status:"error"}))}},[o,e,s,n]),isLoading:r,isDisabled:!t}},f7=(e,t)=>Number(((Date.parse(t)-Date.parse(e))/1e3).toFixed(2)),O_={pending:{colorScheme:"cyan",translationKey:"queue.pending"},in_progress:{colorScheme:"yellow",translationKey:"queue.in_progress"},completed:{colorScheme:"green",translationKey:"queue.completed"},failed:{colorScheme:"red",translationKey:"queue.failed"},canceled:{colorScheme:"orange",translationKey:"queue.canceled"}},The=({status:e})=>{const{t}=Z();return a.jsx(Ds,{colorScheme:O_[e].colorScheme,children:t(O_[e].translationKey)})},Nhe=d.memo(The),$he=e=>{const t=W(u=>u.system.isConnected),{isCanceled:n}=ON({batch_id:e},{selectFromResult:({data:u})=>u?{isCanceled:(u==null?void 0:u.in_progress)===0&&(u==null?void 0:u.pending)===0}:{isCanceled:!0}}),[r,{isLoading:o}]=RN({fixedCacheKey:"cancelByBatchIds"}),s=te(),{t:i}=Z();return{cancelBatch:d.useCallback(async()=>{if(!n)try{await r({batch_ids:[e]}).unwrap(),s(ct({title:i("queue.cancelBatchSucceeded"),status:"success"}))}catch{s(ct({title:i("queue.cancelBatchFailed"),status:"error"}))}},[e,s,n,i,r]),isLoading:o,isCanceled:n,isDisabled:!t}},Lhe=({queueItemDTO:e})=>{const{session_id:t,batch_id:n,item_id:r}=e,{t:o}=Z(),{cancelBatch:s,isLoading:i,isCanceled:l}=$he(n),{cancelQueueItem:u,isLoading:p}=d7(r),{data:m}=DN(r),h=d.useMemo(()=>{if(!m)return o("common.loading");if(!m.completed_at||!m.started_at)return o(`queue.${m.status}`);const g=f7(m.started_at,m.completed_at);return m.status==="completed"?`${o("queue.completedIn")} ${g}${g===1?"":"s"}`:`${g}s`},[m,o]);return a.jsxs(L,{layerStyle:"third",flexDir:"column",p:2,pt:0,borderRadius:"base",gap:2,children:[a.jsxs(L,{layerStyle:"second",p:2,gap:2,justifyContent:"space-between",alignItems:"center",borderRadius:"base",h:20,children:[a.jsx(Ap,{label:o("queue.status"),data:h}),a.jsx(Ap,{label:o("queue.item"),data:r}),a.jsx(Ap,{label:o("queue.batch"),data:n}),a.jsx(Ap,{label:o("queue.session"),data:t}),a.jsxs(Vt,{size:"xs",orientation:"vertical",children:[a.jsx(at,{onClick:u,isLoading:p,isDisabled:m?["canceled","completed","failed"].includes(m.status):!0,"aria-label":o("queue.cancelItem"),icon:a.jsx(Ic,{}),colorScheme:"error",children:o("queue.cancelItem")}),a.jsx(at,{onClick:s,isLoading:i,isDisabled:l,"aria-label":o("queue.cancelBatch"),icon:a.jsx(Ic,{}),colorScheme:"error",children:o("queue.cancelBatch")})]})]}),(m==null?void 0:m.error)&&a.jsxs(L,{layerStyle:"second",p:3,gap:1,justifyContent:"space-between",alignItems:"flex-start",borderRadius:"base",flexDir:"column",children:[a.jsx(cr,{size:"sm",color:"error.500",_dark:{color:"error.400"},children:"Error"}),a.jsx("pre",{children:m.error})]}),a.jsx(L,{layerStyle:"second",h:512,w:"full",borderRadius:"base",alignItems:"center",justifyContent:"center",children:m?a.jsx(Zd,{children:a.jsx(Ya,{label:"Queue Item",data:m})}):a.jsx(fa,{opacity:.5})})]})},zhe=d.memo(Lhe),Ap=({label:e,data:t})=>a.jsxs(L,{flexDir:"column",justifyContent:"flex-start",p:1,gap:1,overflow:"hidden",h:"full",w:"full",children:[a.jsx(cr,{size:"md",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",children:e}),a.jsx(ve,{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",children:t})]}),vs={number:"3rem",statusBadge:"5.7rem",statusDot:2,time:"4rem",batchId:"5rem",fieldValues:"auto",actions:"auto"},R_={bg:"base.300",_dark:{bg:"base.750"}},Fhe={_hover:R_,"&[aria-selected='true']":R_},Bhe=({index:e,item:t,context:n})=>{const{t:r}=Z(),o=d.useCallback(()=>{n.toggleQueueItem(t.item_id)},[n,t.item_id]),{cancelQueueItem:s,isLoading:i}=d7(t.item_id),l=d.useCallback(h=>{h.stopPropagation(),s()},[s]),u=d.useMemo(()=>n.openQueueItems.includes(t.item_id),[n.openQueueItems,t.item_id]),p=d.useMemo(()=>!t.completed_at||!t.started_at?void 0:`${f7(t.started_at,t.completed_at)}s`,[t]),m=d.useMemo(()=>["canceled","completed","failed"].includes(t.status),[t.status]);return a.jsxs(L,{flexDir:"column","aria-selected":u,fontSize:"sm",borderRadius:"base",justifyContent:"center",sx:Fhe,"data-testid":"queue-item",children:[a.jsxs(L,{minH:9,alignItems:"center",gap:4,p:1.5,cursor:"pointer",onClick:o,children:[a.jsx(L,{w:vs.number,justifyContent:"flex-end",alignItems:"center",flexShrink:0,children:a.jsx(ve,{variant:"subtext",children:e+1})}),a.jsx(L,{w:vs.statusBadge,alignItems:"center",flexShrink:0,children:a.jsx(Nhe,{status:t.status})}),a.jsx(L,{w:vs.time,alignItems:"center",flexShrink:0,children:p||"-"}),a.jsx(L,{w:vs.batchId,flexShrink:0,children:a.jsx(ve,{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",alignItems:"center",children:t.batch_id})}),a.jsx(L,{alignItems:"center",overflow:"hidden",flexGrow:1,children:t.field_values&&a.jsx(L,{gap:2,w:"full",whiteSpace:"nowrap",textOverflow:"ellipsis",overflow:"hidden",children:t.field_values.filter(h=>h.node_path!=="metadata_accumulator").map(({node_path:h,field_name:g,value:x})=>a.jsxs(ve,{as:"span",children:[a.jsxs(ve,{as:"span",fontWeight:600,children:[h,".",g]}),": ",x]},`${t.item_id}.${h}.${g}.${x}`))})}),a.jsx(L,{alignItems:"center",w:vs.actions,pe:3,children:a.jsx(Vt,{size:"xs",variant:"ghost",children:a.jsx(Fe,{onClick:l,isDisabled:m,isLoading:i,"aria-label":r("queue.cancelItem"),icon:a.jsx(Ic,{})})})})]}),a.jsx(Id,{in:u,transition:{enter:{duration:.1},exit:{duration:.1}},unmountOnExit:!0,children:a.jsx(zhe,{queueItemDTO:t})})]})},Hhe=d.memo(Bhe),Vhe=d.memo(ke((e,t)=>a.jsx(L,{...e,ref:t,flexDirection:"column",gap:.5,children:e.children}))),Whe=d.memo(Vhe),Uhe=()=>a.jsxs(L,{alignItems:"center",gap:4,p:1,pb:2,textTransform:"uppercase",fontWeight:700,fontSize:"xs",letterSpacing:1,children:[a.jsx(L,{w:vs.number,justifyContent:"flex-end",alignItems:"center",children:a.jsx(ve,{variant:"subtext",children:"#"})}),a.jsx(L,{ps:.5,w:vs.statusBadge,alignItems:"center",children:a.jsx(ve,{variant:"subtext",children:"status"})}),a.jsx(L,{ps:.5,w:vs.time,alignItems:"center",children:a.jsx(ve,{variant:"subtext",children:"time"})}),a.jsx(L,{ps:.5,w:vs.batchId,alignItems:"center",children:a.jsx(ve,{variant:"subtext",children:"batch"})}),a.jsx(L,{ps:.5,w:vs.fieldValues,alignItems:"center",children:a.jsx(ve,{variant:"subtext",children:"batch field values"})})]}),Ghe=d.memo(Uhe),Khe={defer:!0,options:{scrollbars:{visibility:"auto",autoHide:"scroll",autoHideDelay:1300,theme:"os-theme-dark"},overflow:{x:"hidden"}}},qhe=ce(xe,({queue:e})=>{const{listCursor:t,listPriority:n}=e;return{listCursor:t,listPriority:n}},je),Xhe=(e,t)=>t.item_id,Qhe={List:Whe},Yhe=(e,t,n)=>a.jsx(Hhe,{index:e,item:t,context:n}),Zhe=()=>{const{listCursor:e,listPriority:t}=W(qhe),n=te(),r=d.useRef(null),[o,s]=d.useState(null),[i,l]=Ey(Khe),{t:u}=Z();d.useEffect(()=>{const{current:S}=r;return o&&S&&i({target:S,elements:{viewport:o}}),()=>{var j;return(j=l())==null?void 0:j.destroy()}},[o,i,l]);const{data:p,isLoading:m}=AN({cursor:e,priority:t}),h=d.useMemo(()=>p?TN.getSelectors().selectAll(p):[],[p]),g=d.useCallback(()=>{if(!(p!=null&&p.has_more))return;const S=h[h.length-1];S&&(n(Zx(S.item_id)),n(Jx(S.priority)))},[n,p==null?void 0:p.has_more,h]),[x,y]=d.useState([]),b=d.useCallback(S=>{y(j=>j.includes(S)?j.filter(_=>_!==S):[...j,S])},[]),w=d.useMemo(()=>({openQueueItems:x,toggleQueueItem:b}),[x,b]);return m?a.jsx($ne,{}):h.length?a.jsxs(L,{w:"full",h:"full",flexDir:"column",children:[a.jsx(Ghe,{}),a.jsx(L,{ref:r,w:"full",h:"full",alignItems:"center",justifyContent:"center",children:a.jsx(qre,{data:h,endReached:g,scrollerRef:s,itemContent:Yhe,computeItemKey:Xhe,components:Qhe,context:w})})]}):a.jsx(L,{w:"full",h:"full",alignItems:"center",justifyContent:"center",children:a.jsx(cr,{color:"base.400",_dark:{color:"base.500"},children:u("queue.queueEmpty")})})},Jhe=d.memo(Zhe),ege=()=>{const{data:e}=va(),{t}=Z();return a.jsxs(u7,{"data-testid":"queue-status",children:[a.jsx(hs,{label:t("queue.in_progress"),value:(e==null?void 0:e.queue.in_progress)??0}),a.jsx(hs,{label:t("queue.pending"),value:(e==null?void 0:e.queue.pending)??0}),a.jsx(hs,{label:t("queue.completed"),value:(e==null?void 0:e.queue.completed)??0}),a.jsx(hs,{label:t("queue.failed"),value:(e==null?void 0:e.queue.failed)??0}),a.jsx(hs,{label:t("queue.canceled"),value:(e==null?void 0:e.queue.canceled)??0}),a.jsx(hs,{label:t("queue.total"),value:(e==null?void 0:e.queue.total)??0})]})},tge=d.memo(ege);function nge(e){return Te({tag:"svg",attr:{fill:"currentColor",viewBox:"0 0 16 16"},child:[{tag:"path",attr:{d:"M7.657 6.247c.11-.33.576-.33.686 0l.645 1.937a2.89 2.89 0 0 0 1.829 1.828l1.936.645c.33.11.33.576 0 .686l-1.937.645a2.89 2.89 0 0 0-1.828 1.829l-.645 1.936a.361.361 0 0 1-.686 0l-.645-1.937a2.89 2.89 0 0 0-1.828-1.828l-1.937-.645a.361.361 0 0 1 0-.686l1.937-.645a2.89 2.89 0 0 0 1.828-1.828l.645-1.937zM3.794 1.148a.217.217 0 0 1 .412 0l.387 1.162c.173.518.579.924 1.097 1.097l1.162.387a.217.217 0 0 1 0 .412l-1.162.387A1.734 1.734 0 0 0 4.593 5.69l-.387 1.162a.217.217 0 0 1-.412 0L3.407 5.69A1.734 1.734 0 0 0 2.31 4.593l-1.162-.387a.217.217 0 0 1 0-.412l1.162-.387A1.734 1.734 0 0 0 3.407 2.31l.387-1.162zM10.863.099a.145.145 0 0 1 .274 0l.258.774c.115.346.386.617.732.732l.774.258a.145.145 0 0 1 0 .274l-.774.258a1.156 1.156 0 0 0-.732.732l-.258.774a.145.145 0 0 1-.274 0l-.258-.774a1.156 1.156 0 0 0-.732-.732L9.1 2.137a.145.145 0 0 1 0-.274l.774-.258c.346-.115.617-.386.732-.732L10.863.1z"}}]})(e)}const rge=()=>{const e=te(),{t}=Z(),n=W(u=>u.system.isConnected),[r,{isLoading:o}]=RI({fixedCacheKey:"pruneQueue"}),{finishedCount:s}=va(void 0,{selectFromResult:({data:u})=>u?{finishedCount:u.queue.completed+u.queue.canceled+u.queue.failed}:{finishedCount:0}}),i=d.useCallback(async()=>{if(s)try{const u=await r().unwrap();e(ct({title:t("queue.pruneSucceeded",{item_count:u.deleted}),status:"success"})),e(Zx(void 0)),e(Jx(void 0))}catch{e(ct({title:t("queue.pruneFailed"),status:"error"}))}},[s,r,e,t]),l=d.useMemo(()=>!n||!s,[s,n]);return{pruneQueue:i,isLoading:o,finishedCount:s,isDisabled:l}},oge=({asIconButton:e})=>{const{t}=Z(),{pruneQueue:n,isLoading:r,finishedCount:o,isDisabled:s}=rge();return a.jsx(ul,{isDisabled:s,isLoading:r,asIconButton:e,label:t("queue.prune"),tooltip:t("queue.pruneTooltip",{item_count:o}),icon:a.jsx(nge,{}),onClick:n,colorScheme:"blue"})},sge=d.memo(oge),age=()=>{const e=Bt("pauseQueue").isFeatureEnabled,t=Bt("resumeQueue").isFeatureEnabled;return a.jsxs(L,{layerStyle:"second",borderRadius:"base",p:2,gap:2,children:[e||t?a.jsxs(Vt,{w:28,orientation:"vertical",isAttached:!0,size:"sm",children:[t?a.jsx(X8,{}):a.jsx(a.Fragment,{}),e?a.jsx(V8,{}):a.jsx(a.Fragment,{})]}):a.jsx(a.Fragment,{}),a.jsxs(Vt,{w:28,orientation:"vertical",isAttached:!0,size:"sm",children:[a.jsx(sge,{}),a.jsx(qy,{})]})]})},ige=d.memo(age),lge=()=>{const e=Bt("invocationCache").isFeatureEnabled;return a.jsxs(L,{layerStyle:"first",borderRadius:"base",w:"full",h:"full",p:2,flexDir:"column",gap:2,children:[a.jsxs(L,{gap:2,w:"full",children:[a.jsx(ige,{}),a.jsx(tge,{}),e&&a.jsx(Ahe,{})]}),a.jsx(Ie,{layerStyle:"second",p:2,borderRadius:"base",w:"full",h:"full",children:a.jsx(Jhe,{})})]})},cge=d.memo(lge),uge=()=>a.jsx(cge,{}),dge=d.memo(uge),fge=()=>a.jsx(KO,{}),pge=d.memo(fge);var Ax={exports:{}};(function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.Konva=void 0;var n=Lw;Object.defineProperty(t,"Konva",{enumerable:!0,get:function(){return n.Konva}});const r=Lw;e.exports=r.Konva})(Ax,Ax.exports);var mge=Ax.exports;const gd=xd(mge);var p7={exports:{}};/** + */function zt(e,t){if(dg(e))for(let n=0;nt(e[n],n,e));return e}function ur(e,t){const n=ci(t);if(ts(t)||n){let o=n?"":{};if(e){const s=window.getComputedStyle(e,null);o=n?nj(e,s,t):t.reduce((i,l)=>(i[l]=nj(e,s,l),i),o)}return o}e&&zt(ro(t),o=>Qee(e,o,t[o]))}const Fo=(e,t)=>{const{o:n,u:r,_:o}=e;let s=n,i;const l=(m,h)=>{const g=s,x=m,y=h||(r?!r(g,x):g!==x);return(y||o)&&(s=x,i=g),[s,y,i]};return[t?m=>l(t(s,i),m):l,m=>[s,!!m,i]]},Gd=()=>typeof window<"u",jM=Gd()&&Node.ELEMENT_NODE,{toString:Tee,hasOwnProperty:Rv}=Object.prototype,Ca=e=>e===void 0,ug=e=>e===null,Nee=e=>Ca(e)||ug(e)?`${e}`:Tee.call(e).replace(/^\[object (.+)\]$/,"$1").toLowerCase(),Xa=e=>typeof e=="number",ci=e=>typeof e=="string",my=e=>typeof e=="boolean",es=e=>typeof e=="function",ts=e=>Array.isArray(e),ad=e=>typeof e=="object"&&!ts(e)&&!ug(e),dg=e=>{const t=!!e&&e.length,n=Xa(t)&&t>-1&&t%1==0;return ts(e)||!es(e)&&n?t>0&&ad(e)?t-1 in e:!0:!1},lx=e=>{if(!e||!ad(e)||Nee(e)!=="object")return!1;let t;const n="constructor",r=e[n],o=r&&r.prototype,s=Rv.call(e,n),i=o&&Rv.call(o,"isPrototypeOf");if(r&&!s&&!i)return!1;for(t in e);return Ca(t)||Rv.call(e,t)},Zm=e=>{const t=HTMLElement;return e?t?e instanceof t:e.nodeType===jM:!1},fg=e=>{const t=Element;return e?t?e instanceof t:e.nodeType===jM:!1},hy=(e,t,n)=>e.indexOf(t,n),Xt=(e,t,n)=>(!n&&!ci(t)&&dg(t)?Array.prototype.push.apply(e,t):e.push(t),e),Zi=e=>{const t=Array.from,n=[];return t&&e?t(e):(e instanceof Set?e.forEach(r=>{Xt(n,r)}):zt(e,r=>{Xt(n,r)}),n)},gy=e=>!!e&&e.length===0,As=(e,t,n)=>{zt(e,o=>o&&o.apply(void 0,t||[])),!n&&(e.length=0)},pg=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),ro=e=>e?Object.keys(e):[],Cn=(e,t,n,r,o,s,i)=>{const l=[t,n,r,o,s,i];return(typeof e!="object"||ug(e))&&!es(e)&&(e={}),zt(l,u=>{zt(ro(u),p=>{const m=u[p];if(e===m)return!0;const h=ts(m);if(m&&(lx(m)||h)){const g=e[p];let x=g;h&&!ts(g)?x=[]:!h&&!lx(g)&&(x={}),e[p]=Cn(x,m)}else e[p]=m})}),e},vy=e=>{for(const t in e)return!1;return!0},_M=(e,t,n,r)=>{if(Ca(r))return n?n[e]:t;n&&(ci(r)||Xa(r))&&(n[e]=r)},lr=(e,t,n)=>{if(Ca(n))return e?e.getAttribute(t):null;e&&e.setAttribute(t,n)},Mr=(e,t)=>{e&&e.removeAttribute(t)},$i=(e,t,n,r)=>{if(n){const o=lr(e,t)||"",s=new Set(o.split(" "));s[r?"add":"delete"](n);const i=Zi(s).join(" ").trim();lr(e,t,i)}},$ee=(e,t,n)=>{const r=lr(e,t)||"";return new Set(r.split(" ")).has(n)},Ko=(e,t)=>_M("scrollLeft",0,e,t),na=(e,t)=>_M("scrollTop",0,e,t),cx=Gd()&&Element.prototype,IM=(e,t)=>{const n=[],r=t?fg(t)?t:null:document;return r?Xt(n,r.querySelectorAll(e)):n},Lee=(e,t)=>{const n=t?fg(t)?t:null:document;return n?n.querySelector(e):null},Jm=(e,t)=>fg(e)?(cx.matches||cx.msMatchesSelector).call(e,t):!1,xy=e=>e?Zi(e.childNodes):[],la=e=>e?e.parentElement:null,Jl=(e,t)=>{if(fg(e)){const n=cx.closest;if(n)return n.call(e,t);do{if(Jm(e,t))return e;e=la(e)}while(e)}return null},zee=(e,t,n)=>{const r=e&&Jl(e,t),o=e&&Lee(n,r),s=Jl(o,t)===r;return r&&o?r===e||o===e||s&&Jl(Jl(e,n),t)!==r:!1},by=(e,t,n)=>{if(n&&e){let r=t,o;dg(n)?(o=document.createDocumentFragment(),zt(n,s=>{s===r&&(r=s.previousSibling),o.appendChild(s)})):o=n,t&&(r?r!==t&&(r=r.nextSibling):r=e.firstChild),e.insertBefore(o,r||null)}},xo=(e,t)=>{by(e,null,t)},Fee=(e,t)=>{by(la(e),e,t)},Jk=(e,t)=>{by(la(e),e&&e.nextSibling,t)},js=e=>{if(dg(e))zt(Zi(e),t=>js(t));else if(e){const t=la(e);t&&t.removeChild(e)}},Li=e=>{const t=document.createElement("div");return e&&lr(t,"class",e),t},PM=e=>{const t=Li();return t.innerHTML=e.trim(),zt(xy(t),n=>js(n))},ux=e=>e.charAt(0).toUpperCase()+e.slice(1),Bee=()=>Li().style,Hee=["-webkit-","-moz-","-o-","-ms-"],Vee=["WebKit","Moz","O","MS","webkit","moz","o","ms"],Dv={},Av={},Wee=e=>{let t=Av[e];if(pg(Av,e))return t;const n=ux(e),r=Bee();return zt(Hee,o=>{const s=o.replace(/-/g,"");return!(t=[e,o+e,s+n,ux(s)+n].find(l=>r[l]!==void 0))}),Av[e]=t||""},Kd=e=>{if(Gd()){let t=Dv[e]||window[e];return pg(Dv,e)||(zt(Vee,n=>(t=t||window[n+ux(e)],!t)),Dv[e]=t),t}},Uee=Kd("MutationObserver"),ej=Kd("IntersectionObserver"),ec=Kd("ResizeObserver"),EM=Kd("cancelAnimationFrame"),MM=Kd("requestAnimationFrame"),eh=Gd()&&window.setTimeout,dx=Gd()&&window.clearTimeout,Gee=/[^\x20\t\r\n\f]+/g,OM=(e,t,n)=>{const r=e&&e.classList;let o,s=0,i=!1;if(r&&t&&ci(t)){const l=t.match(Gee)||[];for(i=l.length>0;o=l[s++];)i=!!n(r,o)&&i}return i},yy=(e,t)=>{OM(e,t,(n,r)=>n.remove(r))},ra=(e,t)=>(OM(e,t,(n,r)=>n.add(r)),yy.bind(0,e,t)),mg=(e,t,n,r)=>{if(e&&t){let o=!0;return zt(n,s=>{const i=r?r(e[s]):e[s],l=r?r(t[s]):t[s];i!==l&&(o=!1)}),o}return!1},RM=(e,t)=>mg(e,t,["w","h"]),DM=(e,t)=>mg(e,t,["x","y"]),Kee=(e,t)=>mg(e,t,["t","r","b","l"]),tj=(e,t,n)=>mg(e,t,["width","height"],n&&(r=>Math.round(r))),go=()=>{},Kl=e=>{let t;const n=e?eh:MM,r=e?dx:EM;return[o=>{r(t),t=n(o,es(e)?e():e)},()=>r(t)]},Cy=(e,t)=>{let n,r,o,s=go;const{v:i,g:l,p:u}=t||{},p=function(y){s(),dx(n),n=r=void 0,s=go,e.apply(this,y)},m=x=>u&&r?u(r,x):x,h=()=>{s!==go&&p(m(o)||o)},g=function(){const y=Zi(arguments),b=es(i)?i():i;if(Xa(b)&&b>=0){const S=es(l)?l():l,j=Xa(S)&&S>=0,_=b>0?eh:MM,E=b>0?dx:EM,M=m(y)||y,R=p.bind(0,M);s();const D=_(R,b);s=()=>E(D),j&&!n&&(n=eh(h,S)),r=o=M}else p(y)};return g.m=h,g},qee={opacity:1,zindex:1},yp=(e,t)=>{const n=t?parseFloat(e):parseInt(e,10);return n===n?n:0},Xee=(e,t)=>!qee[e.toLowerCase()]&&Xa(t)?`${t}px`:t,nj=(e,t,n)=>t!=null?t[n]||t.getPropertyValue(n):e.style[n],Qee=(e,t,n)=>{try{const{style:r}=e;Ca(r[t])?r.setProperty(t,n):r[t]=Xee(t,n)}catch{}},id=e=>ur(e,"direction")==="rtl",rj=(e,t,n)=>{const r=t?`${t}-`:"",o=n?`-${n}`:"",s=`${r}top${o}`,i=`${r}right${o}`,l=`${r}bottom${o}`,u=`${r}left${o}`,p=ur(e,[s,i,l,u]);return{t:yp(p[s],!0),r:yp(p[i],!0),b:yp(p[l],!0),l:yp(p[u],!0)}},{round:oj}=Math,wy={w:0,h:0},ld=e=>e?{w:e.offsetWidth,h:e.offsetHeight}:wy,Wp=e=>e?{w:e.clientWidth,h:e.clientHeight}:wy,th=e=>e?{w:e.scrollWidth,h:e.scrollHeight}:wy,nh=e=>{const t=parseFloat(ur(e,"height"))||0,n=parseFloat(ur(e,"width"))||0;return{w:n-oj(n),h:t-oj(t)}},xs=e=>e.getBoundingClientRect();let Cp;const Yee=()=>{if(Ca(Cp)){Cp=!1;try{window.addEventListener("test",null,Object.defineProperty({},"passive",{get(){Cp=!0}}))}catch{}}return Cp},AM=e=>e.split(" "),Zee=(e,t,n,r)=>{zt(AM(t),o=>{e.removeEventListener(o,n,r)})},Wn=(e,t,n,r)=>{var o;const s=Yee(),i=(o=s&&r&&r.S)!=null?o:s,l=r&&r.$||!1,u=r&&r.C||!1,p=[],m=s?{passive:i,capture:l}:l;return zt(AM(t),h=>{const g=u?x=>{e.removeEventListener(h,g,l),n&&n(x)}:n;Xt(p,Zee.bind(null,e,h,g,l)),e.addEventListener(h,g,m)}),As.bind(0,p)},TM=e=>e.stopPropagation(),NM=e=>e.preventDefault(),Jee={x:0,y:0},Tv=e=>{const t=e?xs(e):0;return t?{x:t.left+window.pageYOffset,y:t.top+window.pageXOffset}:Jee},sj=(e,t)=>{zt(ts(t)?t:[t],e)},Sy=e=>{const t=new Map,n=(s,i)=>{if(s){const l=t.get(s);sj(u=>{l&&l[u?"delete":"clear"](u)},i)}else t.forEach(l=>{l.clear()}),t.clear()},r=(s,i)=>{if(ci(s)){const p=t.get(s)||new Set;return t.set(s,p),sj(m=>{es(m)&&p.add(m)},i),n.bind(0,s,i)}my(i)&&i&&n();const l=ro(s),u=[];return zt(l,p=>{const m=s[p];m&&Xt(u,r(p,m))}),As.bind(0,u)},o=(s,i)=>{const l=t.get(s);zt(Zi(l),u=>{i&&!gy(i)?u.apply(0,i):u()})};return r(e||{}),[r,n,o]},aj=e=>JSON.stringify(e,(t,n)=>{if(es(n))throw new Error;return n}),ete={paddingAbsolute:!1,showNativeOverlaidScrollbars:!1,update:{elementEvents:[["img","load"]],debounce:[0,33],attributes:null,ignoreMutation:null},overflow:{x:"scroll",y:"scroll"},scrollbars:{theme:"os-theme-dark",visibility:"auto",autoHide:"never",autoHideDelay:1300,dragScroll:!0,clickScroll:!1,pointers:["mouse","touch","pen"]}},$M=(e,t)=>{const n={},r=ro(t).concat(ro(e));return zt(r,o=>{const s=e[o],i=t[o];if(ad(s)&&ad(i))Cn(n[o]={},$M(s,i)),vy(n[o])&&delete n[o];else if(pg(t,o)&&i!==s){let l=!0;if(ts(s)||ts(i))try{aj(s)===aj(i)&&(l=!1)}catch{}l&&(n[o]=i)}}),n},LM="os-environment",zM=`${LM}-flexbox-glue`,tte=`${zM}-max`,FM="os-scrollbar-hidden",Nv="data-overlayscrollbars-initialize",Bo="data-overlayscrollbars",BM=`${Bo}-overflow-x`,HM=`${Bo}-overflow-y`,mc="overflowVisible",nte="scrollbarHidden",ij="scrollbarPressed",rh="updating",Fa="data-overlayscrollbars-viewport",$v="arrange",VM="scrollbarHidden",hc=mc,fx="data-overlayscrollbars-padding",rte=hc,lj="data-overlayscrollbars-content",ky="os-size-observer",ote=`${ky}-appear`,ste=`${ky}-listener`,ate="os-trinsic-observer",ite="os-no-css-vars",lte="os-theme-none",Hr="os-scrollbar",cte=`${Hr}-rtl`,ute=`${Hr}-horizontal`,dte=`${Hr}-vertical`,WM=`${Hr}-track`,jy=`${Hr}-handle`,fte=`${Hr}-visible`,pte=`${Hr}-cornerless`,cj=`${Hr}-transitionless`,uj=`${Hr}-interaction`,dj=`${Hr}-unusable`,fj=`${Hr}-auto-hidden`,pj=`${Hr}-wheel`,mte=`${WM}-interactive`,hte=`${jy}-interactive`,UM={},Ji=()=>UM,gte=e=>{const t=[];return zt(ts(e)?e:[e],n=>{const r=ro(n);zt(r,o=>{Xt(t,UM[o]=n[o])})}),t},vte="__osOptionsValidationPlugin",xte="__osSizeObserverPlugin",_y="__osScrollbarsHidingPlugin",bte="__osClickScrollPlugin";let Lv;const mj=(e,t,n,r)=>{xo(e,t);const o=Wp(t),s=ld(t),i=nh(n);return r&&js(t),{x:s.h-o.h+i.h,y:s.w-o.w+i.w}},yte=e=>{let t=!1;const n=ra(e,FM);try{t=ur(e,Wee("scrollbar-width"))==="none"||window.getComputedStyle(e,"::-webkit-scrollbar").getPropertyValue("display")==="none"}catch{}return n(),t},Cte=(e,t)=>{const n="hidden";ur(e,{overflowX:n,overflowY:n,direction:"rtl"}),Ko(e,0);const r=Tv(e),o=Tv(t);Ko(e,-999);const s=Tv(t);return{i:r.x===o.x,n:o.x!==s.x}},wte=(e,t)=>{const n=ra(e,zM),r=xs(e),o=xs(t),s=tj(o,r,!0),i=ra(e,tte),l=xs(e),u=xs(t),p=tj(u,l,!0);return n(),i(),s&&p},Ste=()=>{const{body:e}=document,n=PM(`
`)[0],r=n.firstChild,[o,,s]=Sy(),[i,l]=Fo({o:mj(e,n,r),u:DM},mj.bind(0,e,n,r,!0)),[u]=l(),p=yte(n),m={x:u.x===0,y:u.y===0},h={elements:{host:null,padding:!p,viewport:j=>p&&j===j.ownerDocument.body&&j,content:!1},scrollbars:{slot:!0},cancel:{nativeScrollbarsOverlaid:!1,body:null}},g=Cn({},ete),x=Cn.bind(0,{},g),y=Cn.bind(0,{},h),b={k:u,A:m,I:p,L:ur(n,"zIndex")==="-1",B:Cte(n,r),V:wte(n,r),Y:o.bind(0,"z"),j:o.bind(0,"r"),N:y,q:j=>Cn(h,j)&&y(),F:x,G:j=>Cn(g,j)&&x(),X:Cn({},h),U:Cn({},g)},w=window.addEventListener,S=Cy(j=>s(j?"z":"r"),{v:33,g:99});if(Mr(n,"style"),js(n),w("resize",S.bind(0,!1)),!p&&(!m.x||!m.y)){let j;w("resize",()=>{const _=Ji()[_y];j=j||_&&_.R(),j&&j(b,i,S.bind(0,!0))})}return b},Vr=()=>(Lv||(Lv=Ste()),Lv),Iy=(e,t)=>es(t)?t.apply(0,e):t,kte=(e,t,n,r)=>{const o=Ca(r)?n:r;return Iy(e,o)||t.apply(0,e)},GM=(e,t,n,r)=>{const o=Ca(r)?n:r,s=Iy(e,o);return!!s&&(Zm(s)?s:t.apply(0,e))},jte=(e,t,n)=>{const{nativeScrollbarsOverlaid:r,body:o}=n||{},{A:s,I:i}=Vr(),{nativeScrollbarsOverlaid:l,body:u}=t,p=r??l,m=Ca(o)?u:o,h=(s.x||s.y)&&p,g=e&&(ug(m)?!i:m);return!!h||!!g},Py=new WeakMap,_te=(e,t)=>{Py.set(e,t)},Ite=e=>{Py.delete(e)},KM=e=>Py.get(e),hj=(e,t)=>e?t.split(".").reduce((n,r)=>n&&pg(n,r)?n[r]:void 0,e):void 0,px=(e,t,n)=>r=>[hj(e,r),n||hj(t,r)!==void 0],qM=e=>{let t=e;return[()=>t,n=>{t=Cn({},t,n)}]},wp="tabindex",Sp=Li.bind(0,""),zv=e=>{xo(la(e),xy(e)),js(e)},Pte=e=>{const t=Vr(),{N:n,I:r}=t,o=Ji()[_y],s=o&&o.T,{elements:i}=n(),{host:l,padding:u,viewport:p,content:m}=i,h=Zm(e),g=h?{}:e,{elements:x}=g,{host:y,padding:b,viewport:w,content:S}=x||{},j=h?e:g.target,_=Jm(j,"textarea"),E=j.ownerDocument,I=E.documentElement,M=j===E.body,R=E.defaultView,D=kte.bind(0,[j]),A=GM.bind(0,[j]),O=Iy.bind(0,[j]),T=D.bind(0,Sp,p),X=A.bind(0,Sp,m),B=T(w),V=B===j,U=V&&M,N=!V&&X(S),$=!V&&Zm(B)&&B===N,q=$&&!!O(m),F=q?T():B,Q=q?N:X(),se=U?I:$?F:B,ae=_?D(Sp,l,y):j,re=U?se:ae,G=$?Q:N,K=E.activeElement,ee=!V&&R.top===R&&K===j,ce={W:j,Z:re,J:se,K:!V&&A(Sp,u,b),tt:G,nt:!V&&!r&&s&&s(t),ot:U?I:se,st:U?E:se,et:R,ct:E,rt:_,it:M,lt:h,ut:V,dt:$,ft:(Ze,ot)=>$ee(se,V?Bo:Fa,V?ot:Ze),_t:(Ze,ot,ye)=>$i(se,V?Bo:Fa,V?ot:Ze,ye)},J=ro(ce).reduce((Ze,ot)=>{const ye=ce[ot];return Xt(Ze,ye&&!la(ye)?ye:!1)},[]),ie=Ze=>Ze?hy(J,Ze)>-1:null,{W:de,Z:ge,K:Ce,J:he,tt:fe,nt:Oe}=ce,_e=[()=>{Mr(ge,Bo),Mr(ge,Nv),Mr(de,Nv),M&&(Mr(I,Bo),Mr(I,Nv))}],Ne=_&&ie(ge);let nt=_?de:xy([fe,he,Ce,ge,de].find(Ze=>ie(Ze)===!1));const $e=U?de:fe||he;return[ce,()=>{lr(ge,Bo,V?"viewport":"host"),lr(Ce,fx,""),lr(fe,lj,""),V||lr(he,Fa,"");const Ze=M&&!V?ra(la(j),FM):go;if(Ne&&(Jk(de,ge),Xt(_e,()=>{Jk(ge,de),js(ge)})),xo($e,nt),xo(ge,Ce),xo(Ce||ge,!V&&he),xo(he,fe),Xt(_e,()=>{Ze(),Mr(Ce,fx),Mr(fe,lj),Mr(he,BM),Mr(he,HM),Mr(he,Fa),ie(fe)&&zv(fe),ie(he)&&zv(he),ie(Ce)&&zv(Ce)}),r&&!V&&($i(he,Fa,VM,!0),Xt(_e,Mr.bind(0,he,Fa))),Oe&&(Fee(he,Oe),Xt(_e,js.bind(0,Oe))),ee){const ot=lr(he,wp);lr(he,wp,"-1"),he.focus();const ye=()=>ot?lr(he,wp,ot):Mr(he,wp),De=Wn(E,"pointerdown keydown",()=>{ye(),De()});Xt(_e,[ye,De])}else K&&K.focus&&K.focus();nt=0},As.bind(0,_e)]},Ete=(e,t)=>{const{tt:n}=e,[r]=t;return o=>{const{V:s}=Vr(),{ht:i}=r(),{vt:l}=o,u=(n||!s)&&l;return u&&ur(n,{height:i?"":"100%"}),{gt:u,wt:u}}},Mte=(e,t)=>{const[n,r]=t,{Z:o,K:s,J:i,ut:l}=e,[u,p]=Fo({u:Kee,o:rj()},rj.bind(0,o,"padding",""));return(m,h,g)=>{let[x,y]=p(g);const{I:b,V:w}=Vr(),{bt:S}=n(),{gt:j,wt:_,yt:E}=m,[I,M]=h("paddingAbsolute");(j||y||!w&&_)&&([x,y]=u(g));const D=!l&&(M||E||y);if(D){const A=!I||!s&&!b,O=x.r+x.l,T=x.t+x.b,X={marginRight:A&&!S?-O:0,marginBottom:A?-T:0,marginLeft:A&&S?-O:0,top:A?-x.t:0,right:A?S?-x.r:"auto":0,left:A?S?"auto":-x.l:0,width:A?`calc(100% + ${O}px)`:""},B={paddingTop:A?x.t:0,paddingRight:A?x.r:0,paddingBottom:A?x.b:0,paddingLeft:A?x.l:0};ur(s||i,X),ur(i,B),r({K:x,St:!A,P:s?B:Cn({},X,B)})}return{xt:D}}},{max:mx}=Math,Ba=mx.bind(0,0),XM="visible",gj="hidden",Ote=42,kp={u:RM,o:{w:0,h:0}},Rte={u:DM,o:{x:gj,y:gj}},Dte=(e,t)=>{const n=window.devicePixelRatio%1!==0?1:0,r={w:Ba(e.w-t.w),h:Ba(e.h-t.h)};return{w:r.w>n?r.w:0,h:r.h>n?r.h:0}},jp=e=>e.indexOf(XM)===0,Ate=(e,t)=>{const[n,r]=t,{Z:o,K:s,J:i,nt:l,ut:u,_t:p,it:m,et:h}=e,{k:g,V:x,I:y,A:b}=Vr(),w=Ji()[_y],S=!u&&!y&&(b.x||b.y),j=m&&u,[_,E]=Fo(kp,nh.bind(0,i)),[I,M]=Fo(kp,th.bind(0,i)),[R,D]=Fo(kp),[A,O]=Fo(kp),[T]=Fo(Rte),X=(q,F)=>{if(ur(i,{height:""}),F){const{St:Q,K:Y}=n(),{$t:se,D:ae}=q,re=nh(o),G=Wp(o),K=ur(i,"boxSizing")==="content-box",ee=Q||K?Y.b+Y.t:0,ce=!(b.x&&K);ur(i,{height:G.h+re.h+(se.x&&ce?ae.x:0)-ee})}},B=(q,F)=>{const Q=!y&&!q?Ote:0,Y=(ie,de,ge)=>{const Ce=ur(i,ie),fe=(F?F[ie]:Ce)==="scroll";return[Ce,fe,fe&&!y?de?Q:ge:0,de&&!!Q]},[se,ae,re,G]=Y("overflowX",b.x,g.x),[K,ee,ce,J]=Y("overflowY",b.y,g.y);return{Ct:{x:se,y:K},$t:{x:ae,y:ee},D:{x:re,y:ce},M:{x:G,y:J}}},V=(q,F,Q,Y)=>{const se=(ee,ce)=>{const J=jp(ee),ie=ce&&J&&ee.replace(`${XM}-`,"")||"";return[ce&&!J?ee:"",jp(ie)?"hidden":ie]},[ae,re]=se(Q.x,F.x),[G,K]=se(Q.y,F.y);return Y.overflowX=re&&G?re:ae,Y.overflowY=K&&ae?K:G,B(q,Y)},U=(q,F,Q,Y)=>{const{D:se,M:ae}=q,{x:re,y:G}=ae,{x:K,y:ee}=se,{P:ce}=n(),J=F?"marginLeft":"marginRight",ie=F?"paddingLeft":"paddingRight",de=ce[J],ge=ce.marginBottom,Ce=ce[ie],he=ce.paddingBottom;Y.width=`calc(100% + ${ee+-1*de}px)`,Y[J]=-ee+de,Y.marginBottom=-K+ge,Q&&(Y[ie]=Ce+(G?ee:0),Y.paddingBottom=he+(re?K:0))},[N,$]=w?w.H(S,x,i,l,n,B,U):[()=>S,()=>[go]];return(q,F,Q)=>{const{gt:Y,Ot:se,wt:ae,xt:re,vt:G,yt:K}=q,{ht:ee,bt:ce}=n(),[J,ie]=F("showNativeOverlaidScrollbars"),[de,ge]=F("overflow"),Ce=J&&b.x&&b.y,he=!u&&!x&&(Y||ae||se||ie||G),fe=jp(de.x),Oe=jp(de.y),_e=fe||Oe;let Ne=E(Q),nt=M(Q),$e=D(Q),Pt=O(Q),Ze;if(ie&&y&&p(VM,nte,!Ce),he&&(Ze=B(Ce),X(Ze,ee)),Y||re||ae||K||ie){_e&&p(hc,mc,!1);const[ke,Be]=$(Ce,ce,Ze),[ze,Ge]=Ne=_(Q),[pt,En]=nt=I(Q),Dt=Wp(i);let At=pt,pr=Dt;ke(),(En||Ge||ie)&&Be&&!Ce&&N(Be,pt,ze,ce)&&(pr=Wp(i),At=th(i));const Ln={w:Ba(mx(pt.w,At.w)+ze.w),h:Ba(mx(pt.h,At.h)+ze.h)},kn={w:Ba((j?h.innerWidth:pr.w+Ba(Dt.w-pt.w))+ze.w),h:Ba((j?h.innerHeight+ze.h:pr.h+Ba(Dt.h-pt.h))+ze.h)};Pt=A(kn),$e=R(Dte(Ln,kn),Q)}const[ot,ye]=Pt,[De,ut]=$e,[bt,be]=nt,[Je,lt]=Ne,ft={x:De.w>0,y:De.h>0},Me=fe&&Oe&&(ft.x||ft.y)||fe&&ft.x&&!ft.y||Oe&&ft.y&&!ft.x;if(re||K||lt||be||ye||ut||ge||ie||he){const ke={marginRight:0,marginBottom:0,marginLeft:0,width:"",overflowY:"",overflowX:""},Be=V(Ce,ft,de,ke),ze=N(Be,bt,Je,ce);u||U(Be,ce,ze,ke),he&&X(Be,ee),u?(lr(o,BM,ke.overflowX),lr(o,HM,ke.overflowY)):ur(i,ke)}$i(o,Bo,mc,Me),$i(s,fx,rte,Me),u||$i(i,Fa,hc,_e);const[Le,Ut]=T(B(Ce).Ct);return r({Ct:Le,zt:{x:ot.w,y:ot.h},Tt:{x:De.w,y:De.h},Et:ft}),{It:Ut,At:ye,Lt:ut}}},vj=(e,t,n)=>{const r={},o=t||{},s=ro(e).concat(ro(o));return zt(s,i=>{const l=e[i],u=o[i];r[i]=!!(n||l||u)}),r},Tte=(e,t)=>{const{W:n,J:r,_t:o,ut:s}=e,{I:i,A:l,V:u}=Vr(),p=!i&&(l.x||l.y),m=[Ete(e,t),Mte(e,t),Ate(e,t)];return(h,g,x)=>{const y=vj(Cn({gt:!1,xt:!1,yt:!1,vt:!1,At:!1,Lt:!1,It:!1,Ot:!1,wt:!1},g),{},x),b=p||!u,w=b&&Ko(r),S=b&&na(r);o("",rh,!0);let j=y;return zt(m,_=>{j=vj(j,_(j,h,!!x)||{},x)}),Ko(r,w),na(r,S),o("",rh),s||(Ko(n,0),na(n,0)),j}},Nte=(e,t,n)=>{let r,o=!1;const s=()=>{o=!0},i=l=>{if(n){const u=n.reduce((p,m)=>{if(m){const[h,g]=m,x=g&&h&&(l?l(h):IM(h,e));x&&x.length&&g&&ci(g)&&Xt(p,[x,g.trim()],!0)}return p},[]);zt(u,p=>zt(p[0],m=>{const h=p[1],g=r.get(m)||[];if(e.contains(m)){const y=Wn(m,h,b=>{o?(y(),r.delete(m)):t(b)});r.set(m,Xt(g,y))}else As(g),r.delete(m)}))}};return n&&(r=new WeakMap,i()),[s,i]},xj=(e,t,n,r)=>{let o=!1;const{Ht:s,Pt:i,Dt:l,Mt:u,Rt:p,kt:m}=r||{},h=Cy(()=>{o&&n(!0)},{v:33,g:99}),[g,x]=Nte(e,h,l),y=s||[],b=i||[],w=y.concat(b),S=(_,E)=>{const I=p||go,M=m||go,R=new Set,D=new Set;let A=!1,O=!1;if(zt(_,T=>{const{attributeName:X,target:B,type:V,oldValue:U,addedNodes:N,removedNodes:$}=T,q=V==="attributes",F=V==="childList",Q=e===B,Y=q&&ci(X)?lr(B,X):0,se=Y!==0&&U!==Y,ae=hy(b,X)>-1&&se;if(t&&(F||!Q)){const re=!q,G=q&&se,K=G&&u&&Jm(B,u),ce=(K?!I(B,X,U,Y):re||G)&&!M(T,!!K,e,r);zt(N,J=>R.add(J)),zt($,J=>R.add(J)),O=O||ce}!t&&Q&&se&&!I(B,X,U,Y)&&(D.add(X),A=A||ae)}),R.size>0&&x(T=>Zi(R).reduce((X,B)=>(Xt(X,IM(T,B)),Jm(B,T)?Xt(X,B):X),[])),t)return!E&&O&&n(!1),[!1];if(D.size>0||A){const T=[Zi(D),A];return!E&&n.apply(0,T),T}},j=new Uee(_=>S(_));return j.observe(e,{attributes:!0,attributeOldValue:!0,attributeFilter:w,subtree:t,childList:t,characterData:t}),o=!0,[()=>{o&&(g(),j.disconnect(),o=!1)},()=>{if(o){h.m();const _=j.takeRecords();return!gy(_)&&S(_,!0)}}]},_p=3333333,Ip=e=>e&&(e.height||e.width),QM=(e,t,n)=>{const{Bt:r=!1,Vt:o=!1}=n||{},s=Ji()[xte],{B:i}=Vr(),u=PM(`
`)[0],p=u.firstChild,m=id.bind(0,e),[h]=Fo({o:void 0,_:!0,u:(b,w)=>!(!b||!Ip(b)&&Ip(w))}),g=b=>{const w=ts(b)&&b.length>0&&ad(b[0]),S=!w&&my(b[0]);let j=!1,_=!1,E=!0;if(w){const[I,,M]=h(b.pop().contentRect),R=Ip(I),D=Ip(M);j=!M||!R,_=!D&&R,E=!j}else S?[,E]=b:_=b===!0;if(r&&E){const I=S?b[0]:id(u);Ko(u,I?i.n?-_p:i.i?0:_p:_p),na(u,_p)}j||t({gt:!S,Yt:S?b:void 0,Vt:!!_})},x=[];let y=o?g:!1;return[()=>{As(x),js(u)},()=>{if(ec){const b=new ec(g);b.observe(p),Xt(x,()=>{b.disconnect()})}else if(s){const[b,w]=s.O(p,g,o);y=b,Xt(x,w)}if(r){const[b]=Fo({o:void 0},m);Xt(x,Wn(u,"scroll",w=>{const S=b(),[j,_,E]=S;_&&(yy(p,"ltr rtl"),j?ra(p,"rtl"):ra(p,"ltr"),g([!!j,_,E])),TM(w)}))}y&&(ra(u,ote),Xt(x,Wn(u,"animationstart",y,{C:!!ec}))),(ec||s)&&xo(e,u)}]},$te=e=>e.h===0||e.isIntersecting||e.intersectionRatio>0,Lte=(e,t)=>{let n;const r=Li(ate),o=[],[s]=Fo({o:!1}),i=(u,p)=>{if(u){const m=s($te(u)),[,h]=m;if(h)return!p&&t(m),[m]}},l=(u,p)=>{if(u&&u.length>0)return i(u.pop(),p)};return[()=>{As(o),js(r)},()=>{if(ej)n=new ej(u=>l(u),{root:e}),n.observe(r),Xt(o,()=>{n.disconnect()});else{const u=()=>{const h=ld(r);i(h)},[p,m]=QM(r,u);Xt(o,p),m(),u()}xo(e,r)},()=>{if(n)return l(n.takeRecords(),!0)}]},bj=`[${Bo}]`,zte=`[${Fa}]`,Fv=["tabindex"],yj=["wrap","cols","rows"],Bv=["id","class","style","open"],Fte=(e,t,n)=>{let r,o,s;const{Z:i,J:l,tt:u,rt:p,ut:m,ft:h,_t:g}=e,{V:x}=Vr(),[y]=Fo({u:RM,o:{w:0,h:0}},()=>{const V=h(hc,mc),U=h($v,""),N=U&&Ko(l),$=U&&na(l);g(hc,mc),g($v,""),g("",rh,!0);const q=th(u),F=th(l),Q=nh(l);return g(hc,mc,V),g($v,"",U),g("",rh),Ko(l,N),na(l,$),{w:F.w+q.w+Q.w,h:F.h+q.h+Q.h}}),b=p?yj:Bv.concat(yj),w=Cy(n,{v:()=>r,g:()=>o,p(V,U){const[N]=V,[$]=U;return[ro(N).concat(ro($)).reduce((q,F)=>(q[F]=N[F]||$[F],q),{})]}}),S=V=>{zt(V||Fv,U=>{if(hy(Fv,U)>-1){const N=lr(i,U);ci(N)?lr(l,U,N):Mr(l,U)}})},j=(V,U)=>{const[N,$]=V,q={vt:$};return t({ht:N}),!U&&n(q),q},_=({gt:V,Yt:U,Vt:N})=>{const $=!V||N?n:w;let q=!1;if(U){const[F,Q]=U;q=Q,t({bt:F})}$({gt:V,yt:q})},E=(V,U)=>{const[,N]=y(),$={wt:N};return N&&!U&&(V?n:w)($),$},I=(V,U,N)=>{const $={Ot:U};return U?!N&&w($):m||S(V),$},[M,R,D]=u||!x?Lte(i,j):[go,go,go],[A,O]=m?[go,go]:QM(i,_,{Vt:!0,Bt:!0}),[T,X]=xj(i,!1,I,{Pt:Bv,Ht:Bv.concat(Fv)}),B=m&&ec&&new ec(_.bind(0,{gt:!0}));return B&&B.observe(i),S(),[()=>{M(),A(),s&&s[0](),B&&B.disconnect(),T()},()=>{O(),R()},()=>{const V={},U=X(),N=D(),$=s&&s[1]();return U&&Cn(V,I.apply(0,Xt(U,!0))),N&&Cn(V,j.apply(0,Xt(N,!0))),$&&Cn(V,E.apply(0,Xt($,!0))),V},V=>{const[U]=V("update.ignoreMutation"),[N,$]=V("update.attributes"),[q,F]=V("update.elementEvents"),[Q,Y]=V("update.debounce"),se=F||$,ae=re=>es(U)&&U(re);if(se&&(s&&(s[1](),s[0]()),s=xj(u||l,!0,E,{Ht:b.concat(N||[]),Dt:q,Mt:bj,kt:(re,G)=>{const{target:K,attributeName:ee}=re;return(!G&&ee&&!m?zee(K,bj,zte):!1)||!!Jl(K,`.${Hr}`)||!!ae(re)}})),Y)if(w.m(),ts(Q)){const re=Q[0],G=Q[1];r=Xa(re)&&re,o=Xa(G)&&G}else Xa(Q)?(r=Q,o=!1):(r=!1,o=!1)}]},Cj={x:0,y:0},Bte=e=>({K:{t:0,r:0,b:0,l:0},St:!1,P:{marginRight:0,marginBottom:0,marginLeft:0,paddingTop:0,paddingRight:0,paddingBottom:0,paddingLeft:0},zt:Cj,Tt:Cj,Ct:{x:"hidden",y:"hidden"},Et:{x:!1,y:!1},ht:!1,bt:id(e.Z)}),Hte=(e,t)=>{const n=px(t,{}),[r,o,s]=Sy(),[i,l,u]=Pte(e),p=qM(Bte(i)),[m,h]=p,g=Tte(i,p),x=(_,E,I)=>{const R=ro(_).some(D=>_[D])||!vy(E)||I;return R&&s("u",[_,E,I]),R},[y,b,w,S]=Fte(i,h,_=>x(g(n,_),{},!1)),j=m.bind(0);return j.jt=_=>r("u",_),j.Nt=()=>{const{W:_,J:E}=i,I=Ko(_),M=na(_);b(),l(),Ko(E,I),na(E,M)},j.qt=i,[(_,E)=>{const I=px(t,_,E);return S(I),x(g(I,w(),E),_,!!E)},j,()=>{o(),y(),u()}]},{round:wj}=Math,Vte=e=>{const{width:t,height:n}=xs(e),{w:r,h:o}=ld(e);return{x:wj(t)/r||1,y:wj(n)/o||1}},Wte=(e,t,n)=>{const r=t.scrollbars,{button:o,isPrimary:s,pointerType:i}=e,{pointers:l}=r;return o===0&&s&&r[n?"dragScroll":"clickScroll"]&&(l||[]).includes(i)},Ute=(e,t)=>Wn(e,"mousedown",Wn.bind(0,t,"click",TM,{C:!0,$:!0}),{$:!0}),Sj="pointerup pointerleave pointercancel lostpointercapture",Gte=(e,t,n,r,o,s,i)=>{const{B:l}=Vr(),{Ft:u,Gt:p,Xt:m}=r,h=`scroll${i?"Left":"Top"}`,g=`client${i?"X":"Y"}`,x=i?"width":"height",y=i?"left":"top",b=i?"w":"h",w=i?"x":"y",S=(j,_)=>E=>{const{Tt:I}=s(),M=ld(p)[b]-ld(u)[b],D=_*E/M*I[w],O=id(m)&&i?l.n||l.i?1:-1:1;o[h]=j+D*O};return Wn(p,"pointerdown",j=>{const _=Jl(j.target,`.${jy}`)===u,E=_?u:p;if($i(t,Bo,ij,!0),Wte(j,e,_)){const I=!_&&j.shiftKey,M=()=>xs(u),R=()=>xs(p),D=(F,Q)=>(F||M())[y]-(Q||R())[y],A=S(o[h]||0,1/Vte(o)[w]),O=j[g],T=M(),X=R(),B=T[x],V=D(T,X)+B/2,U=O-X[y],N=_?0:U-V,$=F=>{As(q),E.releasePointerCapture(F.pointerId)},q=[$i.bind(0,t,Bo,ij),Wn(n,Sj,$),Wn(n,"selectstart",F=>NM(F),{S:!1}),Wn(p,Sj,$),Wn(p,"pointermove",F=>{const Q=F[g]-O;(_||I)&&A(N+Q)})];if(I)A(N);else if(!_){const F=Ji()[bte];F&&Xt(q,F.O(A,D,N,B,U))}E.setPointerCapture(j.pointerId)}})},Kte=(e,t)=>(n,r,o,s,i,l)=>{const{Xt:u}=n,[p,m]=Kl(333),h=!!i.scrollBy;let g=!0;return As.bind(0,[Wn(u,"pointerenter",()=>{r(uj,!0)}),Wn(u,"pointerleave pointercancel",()=>{r(uj)}),Wn(u,"wheel",x=>{const{deltaX:y,deltaY:b,deltaMode:w}=x;h&&g&&w===0&&la(u)===s&&i.scrollBy({left:y,top:b,behavior:"smooth"}),g=!1,r(pj,!0),p(()=>{g=!0,r(pj)}),NM(x)},{S:!1,$:!0}),Ute(u,o),Gte(e,s,o,n,i,t,l),m])},{min:hx,max:kj,abs:qte,round:Xte}=Math,YM=(e,t,n,r)=>{if(r){const l=n?"x":"y",{Tt:u,zt:p}=r,m=p[l],h=u[l];return kj(0,hx(1,m/(m+h)))}const o=n?"width":"height",s=xs(e)[o],i=xs(t)[o];return kj(0,hx(1,s/i))},Qte=(e,t,n,r,o,s)=>{const{B:i}=Vr(),l=s?"x":"y",u=s?"Left":"Top",{Tt:p}=r,m=Xte(p[l]),h=qte(n[`scroll${u}`]),g=s&&o,x=i.i?h:m-h,b=hx(1,(g?x:h)/m),w=YM(e,t,s);return 1/w*(1-w)*b},Yte=(e,t,n)=>{const{N:r,L:o}=Vr(),{scrollbars:s}=r(),{slot:i}=s,{ct:l,W:u,Z:p,J:m,lt:h,ot:g,it:x,ut:y}=t,{scrollbars:b}=h?{}:e,{slot:w}=b||{},S=GM([u,p,m],()=>y&&x?u:p,i,w),j=(N,$,q)=>{const F=q?ra:yy;zt(N,Q=>{F(Q.Xt,$)})},_=(N,$)=>{zt(N,q=>{const[F,Q]=$(q);ur(F,Q)})},E=(N,$,q)=>{_(N,F=>{const{Ft:Q,Gt:Y}=F;return[Q,{[q?"width":"height"]:`${(100*YM(Q,Y,q,$)).toFixed(3)}%`}]})},I=(N,$,q)=>{const F=q?"X":"Y";_(N,Q=>{const{Ft:Y,Gt:se,Xt:ae}=Q,re=Qte(Y,se,g,$,id(ae),q);return[Y,{transform:re===re?`translate${F}(${(100*re).toFixed(3)}%)`:""}]})},M=[],R=[],D=[],A=(N,$,q)=>{const F=my(q),Q=F?q:!0,Y=F?!q:!0;Q&&j(R,N,$),Y&&j(D,N,$)},O=N=>{E(R,N,!0),E(D,N)},T=N=>{I(R,N,!0),I(D,N)},X=N=>{const $=N?ute:dte,q=N?R:D,F=gy(q)?cj:"",Q=Li(`${Hr} ${$} ${F}`),Y=Li(WM),se=Li(jy),ae={Xt:Q,Gt:Y,Ft:se};return o||ra(Q,ite),xo(Q,Y),xo(Y,se),Xt(q,ae),Xt(M,[js.bind(0,Q),n(ae,A,l,p,g,N)]),ae},B=X.bind(0,!0),V=X.bind(0,!1),U=()=>{xo(S,R[0].Xt),xo(S,D[0].Xt),eh(()=>{A(cj)},300)};return B(),V(),[{Ut:O,Wt:T,Zt:A,Jt:{Kt:R,Qt:B,tn:_.bind(0,R)},nn:{Kt:D,Qt:V,tn:_.bind(0,D)}},U,As.bind(0,M)]},Zte=(e,t,n,r)=>{let o,s,i,l,u,p=0;const m=qM({}),[h]=m,[g,x]=Kl(),[y,b]=Kl(),[w,S]=Kl(100),[j,_]=Kl(100),[E,I]=Kl(()=>p),[M,R,D]=Yte(e,n.qt,Kte(t,n)),{Z:A,J:O,ot:T,st:X,ut:B,it:V}=n.qt,{Jt:U,nn:N,Zt:$,Ut:q,Wt:F}=M,{tn:Q}=U,{tn:Y}=N,se=ee=>{const{Xt:ce}=ee,J=B&&!V&&la(ce)===O&&ce;return[J,{transform:J?`translate(${Ko(T)}px, ${na(T)}px)`:""}]},ae=(ee,ce)=>{if(I(),ee)$(fj);else{const J=()=>$(fj,!0);p>0&&!ce?E(J):J()}},re=()=>{l=s,l&&ae(!0)},G=[S,I,_,b,x,D,Wn(A,"pointerover",re,{C:!0}),Wn(A,"pointerenter",re),Wn(A,"pointerleave",()=>{l=!1,s&&ae(!1)}),Wn(A,"pointermove",()=>{o&&g(()=>{S(),ae(!0),j(()=>{o&&ae(!1)})})}),Wn(X,"scroll",ee=>{y(()=>{F(n()),i&&ae(!0),w(()=>{i&&!l&&ae(!1)})}),r(ee),B&&Q(se),B&&Y(se)})],K=h.bind(0);return K.qt=M,K.Nt=R,[(ee,ce,J)=>{const{At:ie,Lt:de,It:ge,yt:Ce}=J,{A:he}=Vr(),fe=px(t,ee,ce),Oe=n(),{Tt:_e,Ct:Ne,bt:nt}=Oe,[$e,Pt]=fe("showNativeOverlaidScrollbars"),[Ze,ot]=fe("scrollbars.theme"),[ye,De]=fe("scrollbars.visibility"),[ut,bt]=fe("scrollbars.autoHide"),[be]=fe("scrollbars.autoHideDelay"),[Je,lt]=fe("scrollbars.dragScroll"),[ft,Me]=fe("scrollbars.clickScroll"),Le=ie||de||Ce,Ut=ge||De,ke=$e&&he.x&&he.y,Be=(ze,Ge)=>{const pt=ye==="visible"||ye==="auto"&&ze==="scroll";return $(fte,pt,Ge),pt};if(p=be,Pt&&$(lte,ke),ot&&($(u),$(Ze,!0),u=Ze),bt&&(o=ut==="move",s=ut==="leave",i=ut!=="never",ae(!i,!0)),lt&&$(hte,Je),Me&&$(mte,ft),Ut){const ze=Be(Ne.x,!0),Ge=Be(Ne.y,!1);$(pte,!(ze&&Ge))}Le&&(q(Oe),F(Oe),$(dj,!_e.x,!0),$(dj,!_e.y,!1),$(cte,nt&&!V))},K,As.bind(0,G)]},ZM=(e,t,n)=>{es(e)&&e(t||void 0,n||void 0)},Ua=(e,t,n)=>{const{F:r,N:o,Y:s,j:i}=Vr(),l=Ji(),u=Zm(e),p=u?e:e.target,m=KM(p);if(t&&!m){let h=!1;const g=B=>{const V=Ji()[vte],U=V&&V.O;return U?U(B,!0):B},x=Cn({},r(),g(t)),[y,b,w]=Sy(n),[S,j,_]=Hte(e,x),[E,I,M]=Zte(e,x,j,B=>w("scroll",[X,B])),R=(B,V)=>S(B,!!V),D=R.bind(0,{},!0),A=s(D),O=i(D),T=B=>{Ite(p),A(),O(),M(),_(),h=!0,w("destroyed",[X,!!B]),b()},X={options(B,V){if(B){const U=V?r():{},N=$M(x,Cn(U,g(B)));vy(N)||(Cn(x,N),R(N))}return Cn({},x)},on:y,off:(B,V)=>{B&&V&&b(B,V)},state(){const{zt:B,Tt:V,Ct:U,Et:N,K:$,St:q,bt:F}=j();return Cn({},{overflowEdge:B,overflowAmount:V,overflowStyle:U,hasOverflow:N,padding:$,paddingAbsolute:q,directionRTL:F,destroyed:h})},elements(){const{W:B,Z:V,K:U,J:N,tt:$,ot:q,st:F}=j.qt,{Jt:Q,nn:Y}=I.qt,se=re=>{const{Ft:G,Gt:K,Xt:ee}=re;return{scrollbar:ee,track:K,handle:G}},ae=re=>{const{Kt:G,Qt:K}=re,ee=se(G[0]);return Cn({},ee,{clone:()=>{const ce=se(K());return E({},!0,{}),ce}})};return Cn({},{target:B,host:V,padding:U||N,viewport:N,content:$||N,scrollOffsetElement:q,scrollEventElement:F,scrollbarHorizontal:ae(Q),scrollbarVertical:ae(Y)})},update:B=>R({},B),destroy:T.bind(0)};return j.jt((B,V,U)=>{E(V,U,B)}),_te(p,X),zt(ro(l),B=>ZM(l[B],0,X)),jte(j.qt.it,o().cancel,!u&&e.cancel)?(T(!0),X):(j.Nt(),I.Nt(),w("initialized",[X]),j.jt((B,V,U)=>{const{gt:N,yt:$,vt:q,At:F,Lt:Q,It:Y,wt:se,Ot:ae}=B;w("updated",[X,{updateHints:{sizeChanged:N,directionChanged:$,heightIntrinsicChanged:q,overflowEdgeChanged:F,overflowAmountChanged:Q,overflowStyleChanged:Y,contentMutation:se,hostMutation:ae},changedOptions:V,force:U}])}),X.update(!0),X)}return m};Ua.plugin=e=>{zt(gte(e),t=>ZM(t,Ua))};Ua.valid=e=>{const t=e&&e.elements,n=es(t)&&t();return lx(n)&&!!KM(n.target)};Ua.env=()=>{const{k:e,A:t,I:n,B:r,V:o,L:s,X:i,U:l,N:u,q:p,F:m,G:h}=Vr();return Cn({},{scrollbarsSize:e,scrollbarsOverlaid:t,scrollbarsHiding:n,rtlScrollBehavior:r,flexboxGlue:o,cssCustomProperties:s,staticDefaultInitialization:i,staticDefaultOptions:l,getDefaultInitialization:u,setDefaultInitialization:p,getDefaultOptions:m,setDefaultOptions:h})};const Jte=()=>{if(typeof window>"u"){const p=()=>{};return[p,p]}let e,t;const n=window,r=typeof n.requestIdleCallback=="function",o=n.requestAnimationFrame,s=n.cancelAnimationFrame,i=r?n.requestIdleCallback:o,l=r?n.cancelIdleCallback:s,u=()=>{l(e),s(t)};return[(p,m)=>{u(),e=i(r?()=>{u(),t=o(p)}:p,typeof m=="object"?m:{timeout:2233})},u]},Ey=e=>{const{options:t,events:n,defer:r}=e||{},[o,s]=d.useMemo(Jte,[]),i=d.useRef(null),l=d.useRef(r),u=d.useRef(t),p=d.useRef(n);return d.useEffect(()=>{l.current=r},[r]),d.useEffect(()=>{const{current:m}=i;u.current=t,Ua.valid(m)&&m.options(t||{},!0)},[t]),d.useEffect(()=>{const{current:m}=i;p.current=n,Ua.valid(m)&&m.on(n||{},!0)},[n]),d.useEffect(()=>()=>{var m;s(),(m=i.current)==null||m.destroy()},[]),d.useMemo(()=>[m=>{const h=i.current;if(Ua.valid(h))return;const g=l.current,x=u.current||{},y=p.current||{},b=()=>i.current=Ua(m,x,y);g?o(b,g):b()},()=>i.current],[])},ene=(e,t)=>{const{element:n="div",options:r,events:o,defer:s,children:i,...l}=e,u=n,p=d.useRef(null),m=d.useRef(null),[h,g]=Ey({options:r,events:o,defer:s});return d.useEffect(()=>{const{current:x}=p,{current:y}=m;return x&&y&&h({target:x,elements:{viewport:y,content:y}}),()=>{var b;return(b=g())==null?void 0:b.destroy()}},[h,n]),d.useImperativeHandle(t,()=>({osInstance:g,getElement:()=>p.current}),[]),H.createElement(u,{"data-overlayscrollbars-initialize":"",ref:p,...l},H.createElement("div",{ref:m},i))},hg=d.forwardRef(ene),tne=e=>{const{boardToDelete:t,setBoardToDelete:n}=e,{t:r}=Z(),o=W(j=>j.config.canRestoreDeletedImagesFromBin),{currentData:s,isFetching:i}=yD((t==null?void 0:t.board_id)??$r.skipToken),l=d.useMemo(()=>le([xe],j=>{const _=(s??[]).map(I=>rI(j,I));return{imageUsageSummary:{isInitialImage:Xr(_,I=>I.isInitialImage),isCanvasImage:Xr(_,I=>I.isCanvasImage),isNodesImage:Xr(_,I=>I.isNodesImage),isControlNetImage:Xr(_,I=>I.isControlNetImage),isIPAdapterImage:Xr(_,I=>I.isIPAdapterImage)}}}),[s]),[u,{isLoading:p}]=CD(),[m,{isLoading:h}]=wD(),{imageUsageSummary:g}=W(l),x=d.useCallback(()=>{t&&(u(t.board_id),n(void 0))},[t,u,n]),y=d.useCallback(()=>{t&&(m(t.board_id),n(void 0))},[t,m,n]),b=d.useCallback(()=>{n(void 0)},[n]),w=d.useRef(null),S=d.useMemo(()=>h||p||i,[h,p,i]);return t?a.jsx(Td,{isOpen:!!t,onClose:b,leastDestructiveRef:w,isCentered:!0,children:a.jsx(Yo,{children:a.jsxs(Nd,{children:[a.jsxs(Qo,{fontSize:"lg",fontWeight:"bold",children:["Delete ",t.board_name]}),a.jsx(Zo,{children:a.jsxs(L,{direction:"column",gap:3,children:[i?a.jsx(Gh,{children:a.jsx(L,{sx:{w:"full",h:32}})}):a.jsx(nM,{imageUsage:g,topMessage:r("boards.topMessage"),bottomMessage:r("boards.bottomMessage")}),a.jsx(ve,{children:"Deleted boards cannot be restored."}),a.jsx(ve,{children:r(o?"gallery.deleteImageBin":"gallery.deleteImagePermanent")})]})}),a.jsx(Ss,{children:a.jsxs(L,{sx:{justifyContent:"space-between",width:"full",gap:2},children:[a.jsx(at,{ref:w,onClick:b,children:"Cancel"}),a.jsx(at,{colorScheme:"warning",isLoading:S,onClick:x,children:"Delete Board Only"}),a.jsx(at,{colorScheme:"error",isLoading:S,onClick:y,children:"Delete Board and Images"})]})})]})})}):null},nne=d.memo(tne),rne=()=>{const{t:e}=Z(),[t,{isLoading:n}]=SD(),r=e("boards.myBoard"),o=d.useCallback(()=>{t(r)},[t,r]);return a.jsx(Fe,{icon:a.jsx(Vc,{}),isLoading:n,tooltip:e("boards.addBoard"),"aria-label":e("boards.addBoard"),onClick:o,size:"sm","data-testid":"add-board-button"})},one=d.memo(rne);var JM=wh({displayName:"ExternalLinkIcon",path:a.jsxs("g",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeWidth:"2",children:[a.jsx("path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"}),a.jsx("path",{d:"M15 3h6v6"}),a.jsx("path",{d:"M10 14L21 3"})]})}),gg=wh({d:"M12 8l-6 6 1.41 1.41L12 10.83l4.59 4.58L18 14z",displayName:"ChevronUpIcon"}),sne=wh({displayName:"CloseIcon",d:"M.439,21.44a1.5,1.5,0,0,0,2.122,2.121L11.823,14.3a.25.25,0,0,1,.354,0l9.262,9.263a1.5,1.5,0,1,0,2.122-2.121L14.3,12.177a.25.25,0,0,1,0-.354l9.263-9.262A1.5,1.5,0,0,0,21.439.44L12.177,9.7a.25.25,0,0,1-.354,0L2.561.44A1.5,1.5,0,0,0,.439,2.561L9.7,11.823a.25.25,0,0,1,0,.354Z"}),ane=wh({displayName:"DeleteIcon",path:a.jsx("g",{fill:"currentColor",children:a.jsx("path",{d:"M19.452 7.5H4.547a.5.5 0 00-.5.545l1.287 14.136A2 2 0 007.326 24h9.347a2 2 0 001.992-1.819L19.95 8.045a.5.5 0 00-.129-.382.5.5 0 00-.369-.163zm-9.2 13a.75.75 0 01-1.5 0v-9a.75.75 0 011.5 0zm5 0a.75.75 0 01-1.5 0v-9a.75.75 0 011.5 0zM22 4h-4.75a.25.25 0 01-.25-.25V2.5A2.5 2.5 0 0014.5 0h-5A2.5 2.5 0 007 2.5v1.25a.25.25 0 01-.25.25H2a1 1 0 000 2h20a1 1 0 000-2zM9 3.75V2.5a.5.5 0 01.5-.5h5a.5.5 0 01.5.5v1.25a.25.25 0 01-.25.25h-5.5A.25.25 0 019 3.75z"})})});const ine=le([xe],({gallery:e})=>{const{boardSearchText:t}=e;return{boardSearchText:t}},Se),lne=()=>{const e=te(),{boardSearchText:t}=W(ine),n=d.useRef(null),{t:r}=Z(),o=d.useCallback(u=>{e(rw(u))},[e]),s=d.useCallback(()=>{e(rw(""))},[e]),i=d.useCallback(u=>{u.key==="Escape"&&s()},[s]),l=d.useCallback(u=>{o(u.target.value)},[o]);return d.useEffect(()=>{n.current&&n.current.focus()},[]),a.jsxs(l3,{children:[a.jsx(Mh,{ref:n,placeholder:r("boards.searchBoard"),value:t,onKeyDown:i,onChange:l,"data-testid":"board-search-input"}),t&&t.length&&a.jsx(Ib,{children:a.jsx(ys,{onClick:s,size:"xs",variant:"ghost","aria-label":r("boards.clearSearch"),opacity:.5,icon:a.jsx(sne,{boxSize:2})})})]})},cne=d.memo(lne);function e8(e){return kD(e)}function une(e){return jD(e)}const t8=(e,t)=>{if(!e||!(t!=null&&t.data.current))return!1;const{actionType:n}=e,{payloadType:r}=t.data.current;if(e.id===t.data.current.id)return!1;switch(n){case"ADD_FIELD_TO_LINEAR":return r==="NODE_FIELD";case"SET_CURRENT_IMAGE":return r==="IMAGE_DTO";case"SET_INITIAL_IMAGE":return r==="IMAGE_DTO";case"SET_CONTROLNET_IMAGE":return r==="IMAGE_DTO";case"SET_IP_ADAPTER_IMAGE":return r==="IMAGE_DTO";case"SET_CANVAS_INITIAL_IMAGE":return r==="IMAGE_DTO";case"SET_NODES_IMAGE":return r==="IMAGE_DTO";case"SET_MULTI_NODES_IMAGE":return r==="IMAGE_DTO"||"IMAGE_DTOS";case"ADD_TO_BATCH":return r==="IMAGE_DTO"||"IMAGE_DTOS";case"ADD_TO_BOARD":{if(!(r==="IMAGE_DTO"||"IMAGE_DTOS"))return!1;if(r==="IMAGE_DTO"){const{imageDTO:s}=t.data.current.payload,i=s.board_id??"none",l=e.context.boardId;return i!==l}return r==="IMAGE_DTOS"}case"REMOVE_FROM_BOARD":{if(!(r==="IMAGE_DTO"||"IMAGE_DTOS"))return!1;if(r==="IMAGE_DTO"){const{imageDTO:s}=t.data.current.payload;return s.board_id!=="none"}return r==="IMAGE_DTOS"}default:return!1}},dne=e=>{const{isOver:t,label:n="Drop"}=e,r=d.useRef(Zs()),{colorMode:o}=ha();return a.jsx(In.div,{initial:{opacity:0},animate:{opacity:1,transition:{duration:.1}},exit:{opacity:0,transition:{duration:.1}},children:a.jsxs(L,{sx:{position:"absolute",top:0,insetInlineStart:0,w:"full",h:"full"},children:[a.jsx(L,{sx:{position:"absolute",top:0,insetInlineStart:0,w:"full",h:"full",bg:Ae("base.700","base.900")(o),opacity:.7,borderRadius:"base",alignItems:"center",justifyContent:"center",transitionProperty:"common",transitionDuration:"0.1s"}}),a.jsx(L,{sx:{position:"absolute",top:.5,insetInlineStart:.5,insetInlineEnd:.5,bottom:.5,opacity:1,borderWidth:2,borderColor:t?Ae("base.50","base.50")(o):Ae("base.200","base.300")(o),borderRadius:"lg",borderStyle:"dashed",transitionProperty:"common",transitionDuration:"0.1s",alignItems:"center",justifyContent:"center"},children:a.jsx(Ie,{sx:{fontSize:"2xl",fontWeight:600,transform:t?"scale(1.1)":"scale(1)",color:t?Ae("base.50","base.50")(o):Ae("base.200","base.300")(o),transitionProperty:"common",transitionDuration:"0.1s"},children:n})})]})},r.current)},n8=d.memo(dne),fne=e=>{const{dropLabel:t,data:n,disabled:r}=e,o=d.useRef(Zs()),{isOver:s,setNodeRef:i,active:l}=e8({id:o.current,disabled:r,data:n});return a.jsx(Ie,{ref:i,position:"absolute",top:0,insetInlineStart:0,w:"full",h:"full",pointerEvents:l?"auto":"none",children:a.jsx(dr,{children:t8(n,l)&&a.jsx(n8,{isOver:s,label:t})})})},My=d.memo(fne),pne=({isSelected:e,isHovered:t})=>a.jsx(Ie,{className:"selection-box",sx:{position:"absolute",top:0,insetInlineEnd:0,bottom:0,insetInlineStart:0,borderRadius:"base",opacity:e?1:.7,transitionProperty:"common",transitionDuration:"0.1s",pointerEvents:"none",shadow:e?t?"hoverSelected.light":"selected.light":t?"hoverUnselected.light":void 0,_dark:{shadow:e?t?"hoverSelected.dark":"selected.dark":t?"hoverUnselected.dark":void 0}}}),Oy=d.memo(pne),mne=()=>a.jsx(L,{sx:{position:"absolute",insetInlineEnd:0,top:0,p:1},children:a.jsx(Ds,{variant:"solid",sx:{bg:"accent.400",_dark:{bg:"accent.500"}},children:"auto"})}),r8=d.memo(mne);function Ry(e){const[t,n]=d.useState(!1),[r,o]=d.useState(!1),[s,i]=d.useState(!1),[l,u]=d.useState([0,0]),p=d.useRef(null),m=W(g=>g.ui.globalContextMenuCloseTrigger);d.useEffect(()=>{if(t)setTimeout(()=>{o(!0),setTimeout(()=>{i(!0)})});else{i(!1);const g=setTimeout(()=>{o(t)},1e3);return()=>clearTimeout(g)}},[t]),d.useEffect(()=>{n(!1),i(!1),o(!1)},[m]),mF("contextmenu",g=>{var x;(x=p.current)!=null&&x.contains(g.target)||g.target===p.current?(g.preventDefault(),n(!0),u([g.pageX,g.pageY])):n(!1)});const h=d.useCallback(()=>{var g,x;(x=(g=e.menuProps)==null?void 0:g.onClose)==null||x.call(g),n(!1)},[e.menuProps]);return a.jsxs(a.Fragment,{children:[e.children(p),r&&a.jsx(Ac,{...e.portalProps,children:a.jsxs(Ah,{isOpen:s,gutter:0,...e.menuProps,onClose:h,children:[a.jsx(Th,{"aria-hidden":!0,w:1,h:1,style:{position:"absolute",left:l[0],top:l[1],cursor:"default"},...e.menuButtonProps}),e.renderMenu()]})})]})}const vg=e=>{const{boardName:t}=yd(void 0,{selectFromResult:({data:n})=>{const r=n==null?void 0:n.find(s=>s.board_id===e);return{boardName:(r==null?void 0:r.board_name)||"Uncategorized"}}});return t},hne=({board:e,setBoardToDelete:t})=>{const n=d.useCallback(()=>{t&&t(e)},[e,t]);return a.jsxs(a.Fragment,{children:[e.image_count>0&&a.jsx(a.Fragment,{}),a.jsx(en,{sx:{color:"error.600",_dark:{color:"error.300"}},icon:a.jsx(Br,{}),onClick:n,children:"Delete Board"})]})},gne=d.memo(hne),vne=()=>a.jsx(a.Fragment,{}),xne=d.memo(vne),bne=({board:e,board_id:t,setBoardToDelete:n,children:r})=>{const o=te(),s=d.useMemo(()=>le(xe,({gallery:g})=>{const x=g.autoAddBoardId===t,y=g.autoAssignBoardOnClick;return{isAutoAdd:x,autoAssignBoardOnClick:y}},Se),[t]),{isAutoAdd:i,autoAssignBoardOnClick:l}=W(s),u=vg(t),p=d.useCallback(()=>{o(hh(t))},[t,o]),m=d.useCallback(g=>{g.preventDefault()},[]),{t:h}=Z();return a.jsx(Ry,{menuProps:{size:"sm",isLazy:!0},menuButtonProps:{bg:"transparent",_hover:{bg:"transparent"}},renderMenu:()=>a.jsx(Gi,{sx:{visibility:"visible !important"},motionProps:vc,onContextMenu:m,children:a.jsxs(td,{title:u,children:[a.jsx(en,{icon:a.jsx(Vc,{}),isDisabled:i||l,onClick:p,children:h("boards.menuItemAutoAdd")}),!e&&a.jsx(xne,{}),e&&a.jsx(gne,{board:e,setBoardToDelete:n})]})}),children:r})},o8=d.memo(bne),yne=({board:e,isSelected:t,setBoardToDelete:n})=>{const r=te(),o=d.useMemo(()=>le(xe,({gallery:A})=>{const O=e.board_id===A.autoAddBoardId,T=A.autoAssignBoardOnClick;return{isSelectedForAutoAdd:O,autoAssignBoardOnClick:T}},Se),[e.board_id]),{isSelectedForAutoAdd:s,autoAssignBoardOnClick:i}=W(o),[l,u]=d.useState(!1),p=d.useCallback(()=>{u(!0)},[]),m=d.useCallback(()=>{u(!1)},[]),{data:h}=cI(e.board_id),{data:g}=uI(e.board_id),x=d.useMemo(()=>{if(!(!h||!g))return`${h} image${h>1?"s":""}, ${g} asset${g>1?"s":""}`},[g,h]),{currentData:y}=to(e.cover_image_name??$r.skipToken),{board_name:b,board_id:w}=e,[S,j]=d.useState(b),_=d.useCallback(()=>{r(dI({boardId:w})),i&&r(hh(w))},[w,i,r]),[E,{isLoading:I}]=_D(),M=d.useMemo(()=>({id:w,actionType:"ADD_TO_BOARD",context:{boardId:w}}),[w]),R=d.useCallback(async A=>{if(!A.trim()){j(b);return}if(A!==b)try{const{board_name:O}=await E({board_id:w,changes:{board_name:A}}).unwrap();j(O)}catch{j(b)}},[w,b,E]),D=d.useCallback(A=>{j(A)},[]);return a.jsx(Ie,{sx:{w:"full",h:"full",touchAction:"none",userSelect:"none"},children:a.jsx(L,{onMouseOver:p,onMouseOut:m,sx:{position:"relative",justifyContent:"center",alignItems:"center",aspectRatio:"1/1",w:"full",h:"full"},children:a.jsx(o8,{board:e,board_id:w,setBoardToDelete:n,children:A=>a.jsx(Ht,{label:x,openDelay:1e3,hasArrow:!0,children:a.jsxs(L,{ref:A,onClick:_,sx:{w:"full",h:"full",position:"relative",justifyContent:"center",alignItems:"center",borderRadius:"base",cursor:"pointer",bg:"base.200",_dark:{bg:"base.800"}},children:[y!=null&&y.thumbnail_url?a.jsx(ga,{src:y==null?void 0:y.thumbnail_url,draggable:!1,sx:{objectFit:"cover",w:"full",h:"full",maxH:"full",borderRadius:"base",borderBottomRadius:"lg"}}):a.jsx(L,{sx:{w:"full",h:"full",justifyContent:"center",alignItems:"center"},children:a.jsx(Nn,{boxSize:12,as:lee,sx:{mt:-6,opacity:.7,color:"base.500",_dark:{color:"base.500"}}})}),s&&a.jsx(r8,{}),a.jsx(Oy,{isSelected:t,isHovered:l}),a.jsx(L,{sx:{position:"absolute",bottom:0,left:0,p:1,justifyContent:"center",alignItems:"center",w:"full",maxW:"full",borderBottomRadius:"base",bg:t?"accent.400":"base.500",color:t?"base.50":"base.100",_dark:{bg:t?"accent.500":"base.600",color:t?"base.50":"base.100"},lineHeight:"short",fontSize:"xs"},children:a.jsxs(Ih,{value:S,isDisabled:I,submitOnBlur:!0,onChange:D,onSubmit:R,sx:{w:"full"},children:[a.jsx(_h,{sx:{p:0,fontWeight:t?700:500,textAlign:"center",overflow:"hidden",textOverflow:"ellipsis"},noOfLines:1}),a.jsx(jh,{sx:{p:0,_focusVisible:{p:0,textAlign:"center",boxShadow:"none"}}})]})}),a.jsx(My,{data:M,dropLabel:a.jsx(ve,{fontSize:"md",children:"Move"})})]})})})})})},Cne=d.memo(yne),wne=le(xe,({gallery:e})=>{const{autoAddBoardId:t,autoAssignBoardOnClick:n}=e;return{autoAddBoardId:t,autoAssignBoardOnClick:n}},Se),s8=d.memo(({isSelected:e})=>{const t=te(),{autoAddBoardId:n,autoAssignBoardOnClick:r}=W(wne),o=vg("none"),s=d.useCallback(()=>{t(dI({boardId:"none"})),r&&t(hh("none"))},[t,r]),[i,l]=d.useState(!1),u=d.useCallback(()=>{l(!0)},[]),p=d.useCallback(()=>{l(!1)},[]),m=d.useMemo(()=>({id:"no_board",actionType:"REMOVE_FROM_BOARD"}),[]);return a.jsx(Ie,{sx:{w:"full",h:"full",touchAction:"none",userSelect:"none"},children:a.jsx(L,{onMouseOver:u,onMouseOut:p,sx:{position:"relative",justifyContent:"center",alignItems:"center",aspectRatio:"1/1",borderRadius:"base",w:"full",h:"full"},children:a.jsx(o8,{board_id:"none",children:h=>a.jsxs(L,{ref:h,onClick:s,sx:{w:"full",h:"full",position:"relative",justifyContent:"center",alignItems:"center",borderRadius:"base",cursor:"pointer",bg:"base.200",_dark:{bg:"base.800"}},children:[a.jsx(L,{sx:{w:"full",h:"full",justifyContent:"center",alignItems:"center"},children:a.jsx(ga,{src:Hx,alt:"invoke-ai-logo",sx:{opacity:.4,filter:"grayscale(1)",mt:-6,w:16,h:16,minW:16,minH:16,userSelect:"none"}})}),n==="none"&&a.jsx(r8,{}),a.jsx(L,{sx:{position:"absolute",bottom:0,left:0,p:1,justifyContent:"center",alignItems:"center",w:"full",maxW:"full",borderBottomRadius:"base",bg:e?"accent.400":"base.500",color:e?"base.50":"base.100",_dark:{bg:e?"accent.500":"base.600",color:e?"base.50":"base.100"},lineHeight:"short",fontSize:"xs",fontWeight:e?700:500},children:o}),a.jsx(Oy,{isSelected:e,isHovered:i}),a.jsx(My,{data:m,dropLabel:a.jsx(ve,{fontSize:"md",children:"Move"})})]})})})})});s8.displayName="HoverableBoard";const Sne=d.memo(s8),kne=le([xe],({gallery:e})=>{const{selectedBoardId:t,boardSearchText:n}=e;return{selectedBoardId:t,boardSearchText:n}},Se),jne=e=>{const{isOpen:t}=e,{selectedBoardId:n,boardSearchText:r}=W(kne),{data:o}=yd(),s=r?o==null?void 0:o.filter(u=>u.board_name.toLowerCase().includes(r.toLowerCase())):o,[i,l]=d.useState();return a.jsxs(a.Fragment,{children:[a.jsx(Id,{in:t,animateOpacity:!0,children:a.jsxs(L,{layerStyle:"first",sx:{flexDir:"column",gap:2,p:2,mt:2,borderRadius:"base"},children:[a.jsxs(L,{sx:{gap:2,alignItems:"center"},children:[a.jsx(cne,{}),a.jsx(one,{})]}),a.jsx(hg,{defer:!0,style:{height:"100%",width:"100%"},options:{scrollbars:{visibility:"auto",autoHide:"move",autoHideDelay:1300,theme:"os-theme-dark"}},children:a.jsxs(Ja,{className:"list-container","data-testid":"boards-list",sx:{gridTemplateColumns:"repeat(auto-fill, minmax(108px, 1fr));",maxH:346},children:[a.jsx(Zu,{sx:{p:1.5},"data-testid":"no-board",children:a.jsx(Sne,{isSelected:n==="none"})}),s&&s.map((u,p)=>a.jsx(Zu,{sx:{p:1.5},"data-testid":`board-${p}`,children:a.jsx(Cne,{board:u,isSelected:n===u.board_id,setBoardToDelete:l})},u.board_id))]})})]})}),a.jsx(nne,{boardToDelete:i,setBoardToDelete:l})]})},_ne=d.memo(jne),Ine=le([xe],e=>{const{selectedBoardId:t}=e.gallery;return{selectedBoardId:t}},Se),Pne=e=>{const{isOpen:t,onToggle:n}=e,{selectedBoardId:r}=W(Ine),o=vg(r),s=d.useMemo(()=>o.length>20?`${o.substring(0,20)}...`:o,[o]);return a.jsxs(L,{as:Za,onClick:n,size:"sm",sx:{position:"relative",gap:2,w:"full",justifyContent:"space-between",alignItems:"center",px:2},children:[a.jsx(ve,{noOfLines:1,sx:{fontWeight:600,w:"100%",textAlign:"center",color:"base.800",_dark:{color:"base.200"}},children:s}),a.jsx(gg,{sx:{transform:t?"rotate(0deg)":"rotate(180deg)",transitionProperty:"common",transitionDuration:"normal"}})]})},Ene=d.memo(Pne),Mne=e=>{const{triggerComponent:t,children:n,hasArrow:r=!0,isLazy:o=!0,...s}=e;return a.jsxs(Ld,{isLazy:o,...s,children:[a.jsx(Wh,{children:t}),a.jsxs(zd,{shadow:"dark-lg",children:[r&&a.jsx(H3,{}),n]})]})},qd=d.memo(Mne);function One(e){return Te({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{d:"M12 16c1.671 0 3-1.331 3-3s-1.329-3-3-3-3 1.331-3 3 1.329 3 3 3z"}},{tag:"path",attr:{d:"M20.817 11.186a8.94 8.94 0 0 0-1.355-3.219 9.053 9.053 0 0 0-2.43-2.43 8.95 8.95 0 0 0-3.219-1.355 9.028 9.028 0 0 0-1.838-.18V2L8 5l3.975 3V6.002c.484-.002.968.044 1.435.14a6.961 6.961 0 0 1 2.502 1.053 7.005 7.005 0 0 1 1.892 1.892A6.967 6.967 0 0 1 19 13a7.032 7.032 0 0 1-.55 2.725 7.11 7.11 0 0 1-.644 1.188 7.2 7.2 0 0 1-.858 1.039 7.028 7.028 0 0 1-3.536 1.907 7.13 7.13 0 0 1-2.822 0 6.961 6.961 0 0 1-2.503-1.054 7.002 7.002 0 0 1-1.89-1.89A6.996 6.996 0 0 1 5 13H3a9.02 9.02 0 0 0 1.539 5.034 9.096 9.096 0 0 0 2.428 2.428A8.95 8.95 0 0 0 12 22a9.09 9.09 0 0 0 1.814-.183 9.014 9.014 0 0 0 3.218-1.355 8.886 8.886 0 0 0 1.331-1.099 9.228 9.228 0 0 0 1.1-1.332A8.952 8.952 0 0 0 21 13a9.09 9.09 0 0 0-.183-1.814z"}}]})(e)}const a8=je((e,t)=>{const[n,r]=d.useState(!1),{label:o,value:s,min:i=1,max:l=100,step:u=1,onChange:p,tooltipSuffix:m="",withSliderMarks:h=!1,withInput:g=!1,isInteger:x=!1,inputWidth:y=16,withReset:b=!1,hideTooltip:w=!1,isCompact:S=!1,isDisabled:j=!1,sliderMarks:_,handleReset:E,sliderFormControlProps:I,sliderFormLabelProps:M,sliderMarkProps:R,sliderTrackProps:D,sliderThumbProps:A,sliderNumberInputProps:O,sliderNumberInputFieldProps:T,sliderNumberInputStepperProps:X,sliderTooltipProps:B,sliderIAIIconButtonProps:V,...U}=e,N=te(),{t:$}=Z(),[q,F]=d.useState(String(s));d.useEffect(()=>{F(s)},[s]);const Q=d.useMemo(()=>O!=null&&O.min?O.min:i,[i,O==null?void 0:O.min]),Y=d.useMemo(()=>O!=null&&O.max?O.max:l,[l,O==null?void 0:O.max]),se=d.useCallback(J=>{p(J)},[p]),ae=d.useCallback(J=>{J.target.value===""&&(J.target.value=String(Q));const ie=Bi(x?Math.floor(Number(J.target.value)):Number(q),Q,Y),de=Mu(ie,u);p(de),F(de)},[x,q,Q,Y,p,u]),re=d.useCallback(J=>{F(J)},[]),G=d.useCallback(()=>{E&&E()},[E]),K=d.useCallback(J=>{J.target instanceof HTMLDivElement&&J.target.focus()},[]),ee=d.useCallback(J=>{J.shiftKey&&N(Nr(!0))},[N]),ce=d.useCallback(J=>{J.shiftKey||N(Nr(!1))},[N]);return a.jsxs(Kt,{ref:t,onClick:K,sx:S?{display:"flex",flexDirection:"row",alignItems:"center",columnGap:4,margin:0,padding:0}:{},isDisabled:j,...I,children:[o&&a.jsx(wn,{sx:g?{mb:-1.5}:{},...M,children:o}),a.jsxs(Rh,{w:"100%",gap:2,alignItems:"center",children:[a.jsxs(Wb,{"aria-label":o,value:s,min:i,max:l,step:u,onChange:se,onMouseEnter:()=>r(!0),onMouseLeave:()=>r(!1),focusThumbOnChange:!1,isDisabled:j,...U,children:[h&&!_&&a.jsxs(a.Fragment,{children:[a.jsx(Ul,{value:i,sx:{insetInlineStart:"0 !important",insetInlineEnd:"unset !important"},...R,children:i}),a.jsx(Ul,{value:l,sx:{insetInlineStart:"unset !important",insetInlineEnd:"0 !important"},...R,children:l})]}),h&&_&&a.jsx(a.Fragment,{children:_.map((J,ie)=>ie===0?a.jsx(Ul,{value:J,sx:{insetInlineStart:"0 !important",insetInlineEnd:"unset !important"},...R,children:J},J):ie===_.length-1?a.jsx(Ul,{value:J,sx:{insetInlineStart:"unset !important",insetInlineEnd:"0 !important"},...R,children:J},J):a.jsx(Ul,{value:J,sx:{transform:"translateX(-50%)"},...R,children:J},J))}),a.jsx(Gb,{...D,children:a.jsx(Kb,{})}),a.jsx(Ht,{hasArrow:!0,placement:"top",isOpen:n,label:`${s}${m}`,hidden:w,...B,children:a.jsx(Ub,{...A,zIndex:0})})]}),g&&a.jsxs(Lh,{min:Q,max:Y,step:u,value:q,onChange:re,onBlur:ae,focusInputOnChange:!1,...O,children:[a.jsx(Fh,{onKeyDown:ee,onKeyUp:ce,minWidth:y,...T}),a.jsxs(zh,{...X,children:[a.jsx(Hh,{onClick:()=>p(Number(q))}),a.jsx(Bh,{onClick:()=>p(Number(q))})]})]}),b&&a.jsx(Fe,{size:"sm","aria-label":$("accessibility.reset"),tooltip:$("accessibility.reset"),icon:a.jsx(One,{}),isDisabled:j,onClick:G,...V})]})]})});a8.displayName="IAISlider";const tt=d.memo(a8),i8=d.forwardRef(({label:e,tooltip:t,description:n,disabled:r,...o},s)=>a.jsx(Ht,{label:t,placement:"top",hasArrow:!0,openDelay:500,children:a.jsx(Ie,{ref:s,...o,children:a.jsxs(Ie,{children:[a.jsx(wc,{children:e}),n&&a.jsx(wc,{size:"xs",color:"base.600",children:n})]})})}));i8.displayName="IAIMantineSelectItemWithTooltip";const ui=d.memo(i8),Rne=le([xe],({gallery:e})=>{const{autoAddBoardId:t,autoAssignBoardOnClick:n}=e;return{autoAddBoardId:t,autoAssignBoardOnClick:n}},Se),Dne=()=>{const e=te(),{t}=Z(),{autoAddBoardId:n,autoAssignBoardOnClick:r}=W(Rne),o=d.useRef(null),{boards:s,hasBoards:i}=yd(void 0,{selectFromResult:({data:u})=>{const p=[{label:"None",value:"none"}];return u==null||u.forEach(({board_id:m,board_name:h})=>{p.push({label:h,value:m})}),{boards:p,hasBoards:p.length>1}}}),l=d.useCallback(u=>{u&&e(hh(u))},[e]);return a.jsx(nn,{label:t("boards.autoAddBoard"),inputRef:o,autoFocus:!0,placeholder:t("boards.selectBoard"),value:n,data:s,nothingFound:t("boards.noMatching"),itemComponent:ui,disabled:!i||r,filter:(u,p)=>{var m;return((m=p.label)==null?void 0:m.toLowerCase().includes(u.toLowerCase().trim()))||p.value.toLowerCase().includes(u.toLowerCase().trim())},onChange:l})},Ane=d.memo(Dne),Tne=e=>{const{label:t,...n}=e,{colorMode:r}=ha();return a.jsx(Md,{colorScheme:"accent",...n,children:a.jsx(ve,{sx:{fontSize:"sm",color:Ae("base.800","base.200")(r)},children:t})})},br=d.memo(Tne),Nne=le([xe],e=>{const{galleryImageMinimumWidth:t,shouldAutoSwitch:n,autoAssignBoardOnClick:r}=e.gallery;return{galleryImageMinimumWidth:t,shouldAutoSwitch:n,autoAssignBoardOnClick:r}},Se),$ne=()=>{const e=te(),{t}=Z(),{galleryImageMinimumWidth:n,shouldAutoSwitch:r,autoAssignBoardOnClick:o}=W(Nne),s=d.useCallback(u=>{e(ow(u))},[e]),i=d.useCallback(()=>{e(ow(64))},[e]),l=d.useCallback(u=>{e(ID(u.target.checked))},[e]);return a.jsx(qd,{triggerComponent:a.jsx(Fe,{tooltip:t("gallery.gallerySettings"),"aria-label":t("gallery.gallerySettings"),size:"sm",icon:a.jsx(yM,{})}),children:a.jsxs(L,{direction:"column",gap:2,children:[a.jsx(tt,{value:n,onChange:s,min:45,max:256,hideTooltip:!0,label:t("gallery.galleryImageSize"),withReset:!0,handleReset:i}),a.jsx(fn,{label:t("gallery.autoSwitchNewImages"),isChecked:r,onChange:l}),a.jsx(br,{label:t("gallery.autoAssignBoardOnClick"),isChecked:o,onChange:u=>e(PD(u.target.checked))}),a.jsx(Ane,{})]})})},Lne=d.memo($ne),zne=e=>e.image?a.jsx(Gh,{sx:{w:`${e.image.width}px`,h:"auto",objectFit:"contain",aspectRatio:`${e.image.width}/${e.image.height}`}}):a.jsx(L,{sx:{opacity:.7,w:"full",h:"full",alignItems:"center",justifyContent:"center",borderRadius:"base",bg:"base.200",_dark:{bg:"base.900"}},children:a.jsx(fa,{size:"xl"})}),Zn=e=>{const{icon:t=Yi,boxSize:n=16,sx:r,...o}=e;return a.jsxs(L,{sx:{w:"full",h:"full",alignItems:"center",justifyContent:"center",borderRadius:"base",flexDir:"column",gap:2,userSelect:"none",opacity:.7,color:"base.700",_dark:{color:"base.500"},...r},...o,children:[t&&a.jsx(Nn,{as:t,boxSize:n,opacity:.7}),e.label&&a.jsx(ve,{textAlign:"center",children:e.label})]})},Fne=e=>{const{sx:t,...n}=e;return a.jsxs(L,{sx:{w:"full",h:"full",alignItems:"center",justifyContent:"center",borderRadius:"base",flexDir:"column",gap:2,userSelect:"none",opacity:.7,color:"base.700",_dark:{color:"base.500"},...t},...n,children:[a.jsx(fa,{size:"xl"}),e.label&&a.jsx(ve,{textAlign:"center",children:e.label})]})},xg=0,di=1,Wc=2,l8=4;function c8(e,t){return n=>e(t(n))}function Bne(e,t){return t(e)}function u8(e,t){return n=>e(t,n)}function jj(e,t){return()=>e(t)}function bg(e,t){return t(e),e}function hn(...e){return e}function Hne(e){e()}function _j(e){return()=>e}function Vne(...e){return()=>{e.map(Hne)}}function Dy(e){return e!==void 0}function Uc(){}function Yt(e,t){return e(di,t)}function wt(e,t){e(xg,t)}function Ay(e){e(Wc)}function bo(e){return e(l8)}function st(e,t){return Yt(e,u8(t,xg))}function ca(e,t){const n=e(di,r=>{n(),t(r)});return n}function Tt(){const e=[];return(t,n)=>{switch(t){case Wc:e.splice(0,e.length);return;case di:return e.push(n),()=>{const r=e.indexOf(n);r>-1&&e.splice(r,1)};case xg:e.slice().forEach(r=>{r(n)});return;default:throw new Error(`unrecognized action ${t}`)}}}function Ve(e){let t=e;const n=Tt();return(r,o)=>{switch(r){case di:o(t);break;case xg:t=o;break;case l8:return t}return n(r,o)}}function Wne(e){let t,n;const r=()=>t&&t();return function(o,s){switch(o){case di:return s?n===s?void 0:(r(),n=s,t=Yt(e,s),t):(r(),Uc);case Wc:r(),n=null;return;default:throw new Error(`unrecognized action ${o}`)}}}function Jr(e){return bg(Tt(),t=>st(e,t))}function yr(e,t){return bg(Ve(t),n=>st(e,n))}function Une(...e){return t=>e.reduceRight(Bne,t)}function Pe(e,...t){const n=Une(...t);return(r,o)=>{switch(r){case di:return Yt(e,n(o));case Wc:Ay(e);return}}}function d8(e,t){return e===t}function pn(e=d8){let t;return n=>r=>{e(t,r)||(t=r,n(r))}}function gt(e){return t=>n=>{e(n)&&t(n)}}function Xe(e){return t=>c8(t,e)}function qs(e){return t=>()=>t(e)}function bs(e,t){return n=>r=>n(t=e(t,r))}function Pc(e){return t=>n=>{e>0?e--:t(n)}}function Ga(e){let t=null,n;return r=>o=>{t=o,!n&&(n=setTimeout(()=>{n=void 0,r(t)},e))}}function Ij(e){let t,n;return r=>o=>{t=o,n&&clearTimeout(n),n=setTimeout(()=>{r(t)},e)}}function _t(...e){const t=new Array(e.length);let n=0,r=null;const o=Math.pow(2,e.length)-1;return e.forEach((s,i)=>{const l=Math.pow(2,i);Yt(s,u=>{const p=n;n=n|l,t[i]=u,p!==o&&n===o&&r&&(r(),r=null)})}),s=>i=>{const l=()=>s([i].concat(t));n===o?l():r=l}}function Pj(...e){return function(t,n){switch(t){case di:return Vne(...e.map(r=>Yt(r,n)));case Wc:return;default:throw new Error(`unrecognized action ${t}`)}}}function ht(e,t=d8){return Pe(e,pn(t))}function Qn(...e){const t=Tt(),n=new Array(e.length);let r=0;const o=Math.pow(2,e.length)-1;return e.forEach((s,i)=>{const l=Math.pow(2,i);Yt(s,u=>{n[i]=u,r=r|l,r===o&&wt(t,n)})}),function(s,i){switch(s){case di:return r===o&&i(n),Yt(t,i);case Wc:return Ay(t);default:throw new Error(`unrecognized action ${s}`)}}}function qt(e,t=[],{singleton:n}={singleton:!0}){return{id:Gne(),constructor:e,dependencies:t,singleton:n}}const Gne=()=>Symbol();function Kne(e){const t=new Map,n=({id:r,constructor:o,dependencies:s,singleton:i})=>{if(i&&t.has(r))return t.get(r);const l=o(s.map(u=>n(u)));return i&&t.set(r,l),l};return n(e)}function qne(e,t){const n={},r={};let o=0;const s=e.length;for(;o(w[S]=j=>{const _=b[t.methods[S]];wt(_,j)},w),{})}function m(b){return i.reduce((w,S)=>(w[S]=Wne(b[t.events[S]]),w),{})}return{Component:H.forwardRef((b,w)=>{const{children:S,...j}=b,[_]=H.useState(()=>bg(Kne(e),I=>u(I,j))),[E]=H.useState(jj(m,_));return Pp(()=>{for(const I of i)I in j&&Yt(E[I],j[I]);return()=>{Object.values(E).map(Ay)}},[j,E,_]),Pp(()=>{u(_,j)}),H.useImperativeHandle(w,_j(p(_))),H.createElement(l.Provider,{value:_},n?H.createElement(n,qne([...r,...o,...i],j),S):S)}),usePublisher:b=>H.useCallback(u8(wt,H.useContext(l)[b]),[b]),useEmitterValue:b=>{const S=H.useContext(l)[b],[j,_]=H.useState(jj(bo,S));return Pp(()=>Yt(S,E=>{E!==j&&_(_j(E))}),[S,j]),j},useEmitter:(b,w)=>{const j=H.useContext(l)[b];Pp(()=>Yt(j,w),[w,j])}}}const Xne=typeof document<"u"?H.useLayoutEffect:H.useEffect,Qne=Xne;var eo=(e=>(e[e.DEBUG=0]="DEBUG",e[e.INFO=1]="INFO",e[e.WARN=2]="WARN",e[e.ERROR=3]="ERROR",e))(eo||{});const Yne={0:"debug",1:"log",2:"warn",3:"error"},Zne=()=>typeof globalThis>"u"?window:globalThis,fi=qt(()=>{const e=Ve(3);return{log:Ve((n,r,o=1)=>{var s;const i=(s=Zne().VIRTUOSO_LOG_LEVEL)!=null?s:bo(e);o>=i&&console[Yne[o]]("%creact-virtuoso: %c%s %o","color: #0253b3; font-weight: bold","color: initial",n,r)}),logLevel:e}},[],{singleton:!0});function Ty(e,t=!0){const n=H.useRef(null);let r=o=>{};if(typeof ResizeObserver<"u"){const o=H.useMemo(()=>new ResizeObserver(s=>{const i=s[0].target;i.offsetParent!==null&&e(i)}),[e]);r=s=>{s&&t?(o.observe(s),n.current=s):(n.current&&o.unobserve(n.current),n.current=null)}}return{ref:n,callbackRef:r}}function ll(e,t=!0){return Ty(e,t).callbackRef}function Jne(e,t,n,r,o,s,i){const l=H.useCallback(u=>{const p=ere(u.children,t,"offsetHeight",o);let m=u.parentElement;for(;!m.dataset.virtuosoScroller;)m=m.parentElement;const h=m.lastElementChild.dataset.viewportType==="window",g=i?i.scrollTop:h?window.pageYOffset||document.documentElement.scrollTop:m.scrollTop,x=i?i.scrollHeight:h?document.documentElement.scrollHeight:m.scrollHeight,y=i?i.offsetHeight:h?window.innerHeight:m.offsetHeight;r({scrollTop:Math.max(g,0),scrollHeight:x,viewportHeight:y}),s==null||s(tre("row-gap",getComputedStyle(u).rowGap,o)),p!==null&&e(p)},[e,t,o,s,i,r]);return Ty(l,n)}function ere(e,t,n,r){const o=e.length;if(o===0)return null;const s=[];for(let i=0;i{const g=h.target,x=g===window||g===document,y=x?window.pageYOffset||document.documentElement.scrollTop:g.scrollTop,b=x?document.documentElement.scrollHeight:g.scrollHeight,w=x?window.innerHeight:g.offsetHeight,S=()=>{e({scrollTop:Math.max(y,0),scrollHeight:b,viewportHeight:w})};h.suppressFlushSync?S():ED.flushSync(S),i.current!==null&&(y===i.current||y<=0||y===b-w)&&(i.current=null,t(!0),l.current&&(clearTimeout(l.current),l.current=null))},[e,t]);H.useEffect(()=>{const h=o||s.current;return r(o||s.current),u({target:h,suppressFlushSync:!0}),h.addEventListener("scroll",u,{passive:!0}),()=>{r(null),h.removeEventListener("scroll",u)}},[s,u,n,r,o]);function p(h){const g=s.current;if(!g||"offsetHeight"in g&&g.offsetHeight===0)return;const x=h.behavior==="smooth";let y,b,w;g===window?(b=Math.max(ri(document.documentElement,"height"),document.documentElement.scrollHeight),y=window.innerHeight,w=document.documentElement.scrollTop):(b=g.scrollHeight,y=ri(g,"height"),w=g.scrollTop);const S=b-y;if(h.top=Math.ceil(Math.max(Math.min(S,h.top),0)),p8(y,b)||h.top===w){e({scrollTop:w,scrollHeight:b,viewportHeight:y}),x&&t(!0);return}x?(i.current=h.top,l.current&&clearTimeout(l.current),l.current=setTimeout(()=>{l.current=null,i.current=null,t(!0)},1e3)):i.current=null,g.scrollTo(h)}function m(h){s.current.scrollBy(h)}return{scrollerRef:s,scrollByCallback:m,scrollToCallback:p}}const Sr=qt(()=>{const e=Tt(),t=Tt(),n=Ve(0),r=Tt(),o=Ve(0),s=Tt(),i=Tt(),l=Ve(0),u=Ve(0),p=Ve(0),m=Ve(0),h=Tt(),g=Tt(),x=Ve(!1);return st(Pe(e,Xe(({scrollTop:y})=>y)),t),st(Pe(e,Xe(({scrollHeight:y})=>y)),i),st(t,o),{scrollContainerState:e,scrollTop:t,viewportHeight:s,headerHeight:l,fixedHeaderHeight:u,fixedFooterHeight:p,footerHeight:m,scrollHeight:i,smoothScrollTargetReached:r,scrollTo:h,scrollBy:g,statefulScrollTop:o,deviation:n,scrollingInProgress:x}},[],{singleton:!0}),cd={lvl:0};function h8(e,t,n,r=cd,o=cd){return{k:e,v:t,lvl:n,l:r,r:o}}function tn(e){return e===cd}function gc(){return cd}function gx(e,t){if(tn(e))return cd;const{k:n,l:r,r:o}=e;if(t===n){if(tn(r))return o;if(tn(o))return r;{const[s,i]=g8(r);return Up(Vn(e,{k:s,v:i,l:v8(r)}))}}else return tt&&(l=l.concat(vx(s,t,n))),r>=t&&r<=n&&l.push({k:r,v:o}),r<=n&&(l=l.concat(vx(i,t,n))),l}function Mi(e){return tn(e)?[]:[...Mi(e.l),{k:e.k,v:e.v},...Mi(e.r)]}function g8(e){return tn(e.r)?[e.k,e.v]:g8(e.r)}function v8(e){return tn(e.r)?e.l:Up(Vn(e,{r:v8(e.r)}))}function Vn(e,t){return h8(t.k!==void 0?t.k:e.k,t.v!==void 0?t.v:e.v,t.lvl!==void 0?t.lvl:e.lvl,t.l!==void 0?t.l:e.l,t.r!==void 0?t.r:e.r)}function Hv(e){return tn(e)||e.lvl>e.r.lvl}function Ej(e){return xx(b8(e))}function Up(e){const{l:t,r:n,lvl:r}=e;if(n.lvl>=r-1&&t.lvl>=r-1)return e;if(r>n.lvl+1){if(Hv(t))return b8(Vn(e,{lvl:r-1}));if(!tn(t)&&!tn(t.r))return Vn(t.r,{l:Vn(t,{r:t.r.l}),r:Vn(e,{l:t.r.r,lvl:r-1}),lvl:r});throw new Error("Unexpected empty nodes")}else{if(Hv(e))return xx(Vn(e,{lvl:r-1}));if(!tn(n)&&!tn(n.l)){const o=n.l,s=Hv(o)?n.lvl-1:n.lvl;return Vn(o,{l:Vn(e,{r:o.l,lvl:r-1}),r:xx(Vn(n,{l:o.r,lvl:s})),lvl:o.lvl+1})}else throw new Error("Unexpected empty nodes")}}function yg(e,t,n){if(tn(e))return[];const r=ns(e,t)[0];return nre(vx(e,r,n))}function x8(e,t){const n=e.length;if(n===0)return[];let{index:r,value:o}=t(e[0]);const s=[];for(let i=1;i({index:t,value:n}))}function xx(e){const{r:t,lvl:n}=e;return!tn(t)&&!tn(t.r)&&t.lvl===n&&t.r.lvl===n?Vn(t,{l:Vn(e,{r:t.l}),lvl:n+1}):e}function b8(e){const{l:t}=e;return!tn(t)&&t.lvl===e.lvl?Vn(t,{r:Vn(e,{l:t.r})}):e}function oh(e,t,n,r=0){let o=e.length-1;for(;r<=o;){const s=Math.floor((r+o)/2),i=e[s],l=n(i,t);if(l===0)return s;if(l===-1){if(o-r<2)return s-1;o=s-1}else{if(o===r)return s;r=s+1}}throw new Error(`Failed binary finding record in array - ${e.join(",")}, searched for ${t}`)}function y8(e,t,n){return e[oh(e,t,n)]}function rre(e,t,n,r){const o=oh(e,t,r),s=oh(e,n,r,o);return e.slice(o,s+1)}const Ny=qt(()=>({recalcInProgress:Ve(!1)}),[],{singleton:!0});function ore(e){const{size:t,startIndex:n,endIndex:r}=e;return o=>o.start===n&&(o.end===r||o.end===1/0)&&o.value===t}function Mj(e,t){let n=0,r=0;for(;n=m||o===g)&&(e=gx(e,m)):(p=g!==o,u=!0),h>i&&i>=m&&g!==o&&(e=Yr(e,i+1,g));p&&(e=Yr(e,s,o))}return[e,n]}function are(){return{offsetTree:[],sizeTree:gc(),groupOffsetTree:gc(),lastIndex:0,lastOffset:0,lastSize:0,groupIndices:[]}}function $y({index:e},t){return t===e?0:t0&&(t=Math.max(t,y8(e,r,$y).offset)),x8(rre(e,t,n,ire),lre)}function bx(e,t,n,r){let o=e,s=0,i=0,l=0,u=0;if(t!==0){u=oh(o,t-1,$y),l=o[u].offset;const m=ns(n,t-1);s=m[0],i=m[1],o.length&&o[u].size===ns(n,t)[1]&&(u-=1),o=o.slice(0,u+1)}else o=[];for(const{start:p,value:m}of yg(n,t,1/0)){const h=p-s,g=h*i+l+h*r;o.push({offset:g,size:m,index:p}),s=p,l=g,i=m}return{offsetTree:o,lastIndex:s,lastOffset:l,lastSize:i}}function ure(e,[t,n,r,o]){t.length>0&&r("received item sizes",t,eo.DEBUG);const s=e.sizeTree;let i=s,l=0;if(n.length>0&&tn(s)&&t.length===2){const g=t[0].size,x=t[1].size;i=n.reduce((y,b)=>Yr(Yr(y,b,g),b+1,x),i)}else[i,l]=sre(i,t);if(i===s)return e;const{offsetTree:u,lastIndex:p,lastSize:m,lastOffset:h}=bx(e.offsetTree,l,i,o);return{sizeTree:i,offsetTree:u,lastIndex:p,lastOffset:h,lastSize:m,groupOffsetTree:n.reduce((g,x)=>Yr(g,x,dd(x,u,o)),gc()),groupIndices:n}}function dd(e,t,n){if(t.length===0)return 0;const{offset:r,index:o,size:s}=y8(t,e,$y),i=e-o,l=s*i+(i-1)*n+r;return l>0?l+n:l}function dre(e){return typeof e.groupIndex<"u"}function C8(e,t,n){if(dre(e))return t.groupIndices[e.groupIndex]+1;{const r=e.index==="LAST"?n:e.index;let o=w8(r,t);return o=Math.max(0,o,Math.min(n,o)),o}}function w8(e,t){if(!Cg(t))return e;let n=0;for(;t.groupIndices[n]<=e+n;)n++;return e+n}function Cg(e){return!tn(e.groupOffsetTree)}function fre(e){return Mi(e).map(({k:t,v:n},r,o)=>{const s=o[r+1],i=s?s.k-1:1/0;return{startIndex:t,endIndex:i,size:n}})}const pre={offsetHeight:"height",offsetWidth:"width"},Ts=qt(([{log:e},{recalcInProgress:t}])=>{const n=Tt(),r=Tt(),o=yr(r,0),s=Tt(),i=Tt(),l=Ve(0),u=Ve([]),p=Ve(void 0),m=Ve(void 0),h=Ve((I,M)=>ri(I,pre[M])),g=Ve(void 0),x=Ve(0),y=are(),b=yr(Pe(n,_t(u,e,x),bs(ure,y),pn()),y),w=yr(Pe(u,pn(),bs((I,M)=>({prev:I.current,current:M}),{prev:[],current:[]}),Xe(({prev:I})=>I)),[]);st(Pe(u,gt(I=>I.length>0),_t(b,x),Xe(([I,M,R])=>{const D=I.reduce((A,O,T)=>Yr(A,O,dd(O,M.offsetTree,R)||T),gc());return{...M,groupIndices:I,groupOffsetTree:D}})),b),st(Pe(r,_t(b),gt(([I,{lastIndex:M}])=>I[{startIndex:I,endIndex:M,size:R}])),n),st(p,m);const S=yr(Pe(p,Xe(I=>I===void 0)),!0);st(Pe(m,gt(I=>I!==void 0&&tn(bo(b).sizeTree)),Xe(I=>[{startIndex:0,endIndex:0,size:I}])),n);const j=Jr(Pe(n,_t(b),bs(({sizes:I},[M,R])=>({changed:R!==I,sizes:R}),{changed:!1,sizes:y}),Xe(I=>I.changed)));Yt(Pe(l,bs((I,M)=>({diff:I.prev-M,prev:M}),{diff:0,prev:0}),Xe(I=>I.diff)),I=>{const{groupIndices:M}=bo(b);if(I>0)wt(t,!0),wt(s,I+Mj(I,M));else if(I<0){const R=bo(w);R.length>0&&(I-=Mj(-I,R)),wt(i,I)}}),Yt(Pe(l,_t(e)),([I,M])=>{I<0&&M("`firstItemIndex` prop should not be set to less than zero. If you don't know the total count, just use a very high value",{firstItemIndex:l},eo.ERROR)});const _=Jr(s);st(Pe(s,_t(b),Xe(([I,M])=>{const R=M.groupIndices.length>0,D=[],A=M.lastSize;if(R){const O=ud(M.sizeTree,0);let T=0,X=0;for(;T{let q=U.ranges;return U.prevSize!==0&&(q=[...U.ranges,{startIndex:U.prevIndex,endIndex:N+I-1,size:U.prevSize}]),{ranges:q,prevIndex:N+I,prevSize:$}},{ranges:D,prevIndex:I,prevSize:0}).ranges}return Mi(M.sizeTree).reduce((O,{k:T,v:X})=>({ranges:[...O.ranges,{startIndex:O.prevIndex,endIndex:T+I-1,size:O.prevSize}],prevIndex:T+I,prevSize:X}),{ranges:[],prevIndex:0,prevSize:A}).ranges})),n);const E=Jr(Pe(i,_t(b,x),Xe(([I,{offsetTree:M},R])=>{const D=-I;return dd(D,M,R)})));return st(Pe(i,_t(b,x),Xe(([I,M,R])=>{if(M.groupIndices.length>0){if(tn(M.sizeTree))return M;let A=gc();const O=bo(w);let T=0,X=0,B=0;for(;T<-I;){B=O[X];const U=O[X+1]-B-1;X++,T+=U+1}if(A=Mi(M.sizeTree).reduce((U,{k:N,v:$})=>Yr(U,Math.max(0,N+I),$),A),T!==-I){const U=ud(M.sizeTree,B);A=Yr(A,0,U);const N=ns(M.sizeTree,-I+1)[1];A=Yr(A,1,N)}return{...M,sizeTree:A,...bx(M.offsetTree,0,A,R)}}else{const A=Mi(M.sizeTree).reduce((O,{k:T,v:X})=>Yr(O,Math.max(0,T+I),X),gc());return{...M,sizeTree:A,...bx(M.offsetTree,0,A,R)}}})),b),{data:g,totalCount:r,sizeRanges:n,groupIndices:u,defaultItemSize:m,fixedItemSize:p,unshiftWith:s,shiftWith:i,shiftWithOffset:E,beforeUnshiftWith:_,firstItemIndex:l,gap:x,sizes:b,listRefresh:j,statefulTotalCount:o,trackItemSizes:S,itemSize:h}},hn(fi,Ny),{singleton:!0}),mre=typeof document<"u"&&"scrollBehavior"in document.documentElement.style;function S8(e){const t=typeof e=="number"?{index:e}:e;return t.align||(t.align="start"),(!t.behavior||!mre)&&(t.behavior="auto"),t.offset||(t.offset=0),t}const Xd=qt(([{sizes:e,totalCount:t,listRefresh:n,gap:r},{scrollingInProgress:o,viewportHeight:s,scrollTo:i,smoothScrollTargetReached:l,headerHeight:u,footerHeight:p,fixedHeaderHeight:m,fixedFooterHeight:h},{log:g}])=>{const x=Tt(),y=Ve(0);let b=null,w=null,S=null;function j(){b&&(b(),b=null),S&&(S(),S=null),w&&(clearTimeout(w),w=null),wt(o,!1)}return st(Pe(x,_t(e,s,t,y,u,p,g),_t(r,m,h),Xe(([[_,E,I,M,R,D,A,O],T,X,B])=>{const V=S8(_),{align:U,behavior:N,offset:$}=V,q=M-1,F=C8(V,E,q);let Q=dd(F,E.offsetTree,T)+D;U==="end"?(Q+=X+ns(E.sizeTree,F)[1]-I+B,F===q&&(Q+=A)):U==="center"?Q+=(X+ns(E.sizeTree,F)[1]-I+B)/2:Q-=R,$&&(Q+=$);const Y=se=>{j(),se?(O("retrying to scroll to",{location:_},eo.DEBUG),wt(x,_)):O("list did not change, scroll successful",{},eo.DEBUG)};if(j(),N==="smooth"){let se=!1;S=Yt(n,ae=>{se=se||ae}),b=ca(l,()=>{Y(se)})}else b=ca(Pe(n,hre(150)),Y);return w=setTimeout(()=>{j()},1200),wt(o,!0),O("scrolling from index to",{index:F,top:Q,behavior:N},eo.DEBUG),{top:Q,behavior:N}})),i),{scrollToIndex:x,topListHeight:y}},hn(Ts,Sr,fi),{singleton:!0});function hre(e){return t=>{const n=setTimeout(()=>{t(!1)},e);return r=>{r&&(t(!0),clearTimeout(n))}}}const fd="up",Hu="down",gre="none",vre={atBottom:!1,notAtBottomBecause:"NOT_SHOWING_LAST_ITEM",state:{offsetBottom:0,scrollTop:0,viewportHeight:0,scrollHeight:0}},xre=0,Qd=qt(([{scrollContainerState:e,scrollTop:t,viewportHeight:n,headerHeight:r,footerHeight:o,scrollBy:s}])=>{const i=Ve(!1),l=Ve(!0),u=Tt(),p=Tt(),m=Ve(4),h=Ve(xre),g=yr(Pe(Pj(Pe(ht(t),Pc(1),qs(!0)),Pe(ht(t),Pc(1),qs(!1),Ij(100))),pn()),!1),x=yr(Pe(Pj(Pe(s,qs(!0)),Pe(s,qs(!1),Ij(200))),pn()),!1);st(Pe(Qn(ht(t),ht(h)),Xe(([j,_])=>j<=_),pn()),l),st(Pe(l,Ga(50)),p);const y=Jr(Pe(Qn(e,ht(n),ht(r),ht(o),ht(m)),bs((j,[{scrollTop:_,scrollHeight:E},I,M,R,D])=>{const A=_+I-E>-D,O={viewportHeight:I,scrollTop:_,scrollHeight:E};if(A){let X,B;return _>j.state.scrollTop?(X="SCROLLED_DOWN",B=j.state.scrollTop-_):(X="SIZE_DECREASED",B=j.state.scrollTop-_||j.scrollTopDelta),{atBottom:!0,state:O,atBottomBecause:X,scrollTopDelta:B}}let T;return O.scrollHeight>j.state.scrollHeight?T="SIZE_INCREASED":Ij&&j.atBottom===_.atBottom))),b=yr(Pe(e,bs((j,{scrollTop:_,scrollHeight:E,viewportHeight:I})=>{if(p8(j.scrollHeight,E))return{scrollTop:_,scrollHeight:E,jump:0,changed:!1};{const M=E-(_+I)<1;return j.scrollTop!==_&&M?{scrollHeight:E,scrollTop:_,jump:j.scrollTop-_,changed:!0}:{scrollHeight:E,scrollTop:_,jump:0,changed:!0}}},{scrollHeight:0,jump:0,scrollTop:0,changed:!1}),gt(j=>j.changed),Xe(j=>j.jump)),0);st(Pe(y,Xe(j=>j.atBottom)),i),st(Pe(i,Ga(50)),u);const w=Ve(Hu);st(Pe(e,Xe(({scrollTop:j})=>j),pn(),bs((j,_)=>bo(x)?{direction:j.direction,prevScrollTop:_}:{direction:_j.direction)),w),st(Pe(e,Ga(50),qs(gre)),w);const S=Ve(0);return st(Pe(g,gt(j=>!j),qs(0)),S),st(Pe(t,Ga(100),_t(g),gt(([j,_])=>!!_),bs(([j,_],[E])=>[_,E],[0,0]),Xe(([j,_])=>_-j)),S),{isScrolling:g,isAtTop:l,isAtBottom:i,atBottomState:y,atTopStateChange:p,atBottomStateChange:u,scrollDirection:w,atBottomThreshold:m,atTopThreshold:h,scrollVelocity:S,lastJumpDueToItemResize:b}},hn(Sr)),pi=qt(([{log:e}])=>{const t=Ve(!1),n=Jr(Pe(t,gt(r=>r),pn()));return Yt(t,r=>{r&&bo(e)("props updated",{},eo.DEBUG)}),{propsReady:t,didMount:n}},hn(fi),{singleton:!0});function Ly(e,t){e==0?t():requestAnimationFrame(()=>Ly(e-1,t))}function zy(e,t){const n=t-1;return typeof e=="number"?e:e.index==="LAST"?n:e.index}const Yd=qt(([{sizes:e,listRefresh:t,defaultItemSize:n},{scrollTop:r},{scrollToIndex:o},{didMount:s}])=>{const i=Ve(!0),l=Ve(0),u=Ve(!1);return st(Pe(s,_t(l),gt(([p,m])=>!!m),qs(!1)),i),Yt(Pe(Qn(t,s),_t(i,e,n,u),gt(([[,p],m,{sizeTree:h},g,x])=>p&&(!tn(h)||Dy(g))&&!m&&!x),_t(l)),([,p])=>{wt(u,!0),Ly(3,()=>{ca(r,()=>wt(i,!0)),wt(o,p)})}),{scrolledToInitialItem:i,initialTopMostItemIndex:l}},hn(Ts,Sr,Xd,pi),{singleton:!0});function Oj(e){return e?e==="smooth"?"smooth":"auto":!1}const bre=(e,t)=>typeof e=="function"?Oj(e(t)):t&&Oj(e),yre=qt(([{totalCount:e,listRefresh:t},{isAtBottom:n,atBottomState:r},{scrollToIndex:o},{scrolledToInitialItem:s},{propsReady:i,didMount:l},{log:u},{scrollingInProgress:p}])=>{const m=Ve(!1),h=Tt();let g=null;function x(b){wt(o,{index:"LAST",align:"end",behavior:b})}Yt(Pe(Qn(Pe(ht(e),Pc(1)),l),_t(ht(m),n,s,p),Xe(([[b,w],S,j,_,E])=>{let I=w&&_,M="auto";return I&&(M=bre(S,j||E),I=I&&!!M),{totalCount:b,shouldFollow:I,followOutputBehavior:M}}),gt(({shouldFollow:b})=>b)),({totalCount:b,followOutputBehavior:w})=>{g&&(g(),g=null),g=ca(t,()=>{bo(u)("following output to ",{totalCount:b},eo.DEBUG),x(w),g=null})});function y(b){const w=ca(r,S=>{b&&!S.atBottom&&S.notAtBottomBecause==="SIZE_INCREASED"&&!g&&(bo(u)("scrolling to bottom due to increased size",{},eo.DEBUG),x("auto"))});setTimeout(w,100)}return Yt(Pe(Qn(ht(m),e,i),gt(([b,,w])=>b&&w),bs(({value:b},[,w])=>({refreshed:b===w,value:w}),{refreshed:!1,value:0}),gt(({refreshed:b})=>b),_t(m,e)),([,b])=>{y(b!==!1)}),Yt(h,()=>{y(bo(m)!==!1)}),Yt(Qn(ht(m),r),([b,w])=>{b&&!w.atBottom&&w.notAtBottomBecause==="VIEWPORT_HEIGHT_DECREASING"&&x("auto")}),{followOutput:m,autoscrollToBottom:h}},hn(Ts,Qd,Xd,Yd,pi,fi,Sr));function Cre(e){return e.reduce((t,n)=>(t.groupIndices.push(t.totalCount),t.totalCount+=n+1,t),{totalCount:0,groupIndices:[]})}const k8=qt(([{totalCount:e,groupIndices:t,sizes:n},{scrollTop:r,headerHeight:o}])=>{const s=Tt(),i=Tt(),l=Jr(Pe(s,Xe(Cre)));return st(Pe(l,Xe(u=>u.totalCount)),e),st(Pe(l,Xe(u=>u.groupIndices)),t),st(Pe(Qn(r,n,o),gt(([u,p])=>Cg(p)),Xe(([u,p,m])=>ns(p.groupOffsetTree,Math.max(u-m,0),"v")[0]),pn(),Xe(u=>[u])),i),{groupCounts:s,topItemsIndexes:i}},hn(Ts,Sr));function pd(e,t){return!!(e&&e[0]===t[0]&&e[1]===t[1])}function j8(e,t){return!!(e&&e.startIndex===t.startIndex&&e.endIndex===t.endIndex)}const sh="top",ah="bottom",Rj="none";function Dj(e,t,n){return typeof e=="number"?n===fd&&t===sh||n===Hu&&t===ah?e:0:n===fd?t===sh?e.main:e.reverse:t===ah?e.main:e.reverse}function Aj(e,t){return typeof e=="number"?e:e[t]||0}const Fy=qt(([{scrollTop:e,viewportHeight:t,deviation:n,headerHeight:r,fixedHeaderHeight:o}])=>{const s=Tt(),i=Ve(0),l=Ve(0),u=Ve(0),p=yr(Pe(Qn(ht(e),ht(t),ht(r),ht(s,pd),ht(u),ht(i),ht(o),ht(n),ht(l)),Xe(([m,h,g,[x,y],b,w,S,j,_])=>{const E=m-j,I=w+S,M=Math.max(g-E,0);let R=Rj;const D=Aj(_,sh),A=Aj(_,ah);return x-=j,x+=g+S,y+=g+S,y-=j,x>m+I-D&&(R=fd),ym!=null),pn(pd)),[0,0]);return{listBoundary:s,overscan:u,topListHeight:i,increaseViewportBy:l,visibleRange:p}},hn(Sr),{singleton:!0});function wre(e,t,n){if(Cg(t)){const r=w8(e,t);return[{index:ns(t.groupOffsetTree,r)[0],size:0,offset:0},{index:r,size:0,offset:0,data:n&&n[0]}]}return[{index:e,size:0,offset:0,data:n&&n[0]}]}const Tj={items:[],topItems:[],offsetTop:0,offsetBottom:0,top:0,bottom:0,topListHeight:0,totalCount:0,firstItemIndex:0};function Nj(e,t,n){if(e.length===0)return[];if(!Cg(t))return e.map(p=>({...p,index:p.index+n,originalIndex:p.index}));const r=e[0].index,o=e[e.length-1].index,s=[],i=yg(t.groupOffsetTree,r,o);let l,u=0;for(const p of e){(!l||l.end0){p=e[0].offset;const b=e[e.length-1];m=b.offset+b.size}const h=n-u,g=l+h*i+(h-1)*r,x=p,y=g-m;return{items:Nj(e,o,s),topItems:Nj(t,o,s),topListHeight:t.reduce((b,w)=>w.size+b,0),offsetTop:p,offsetBottom:y,top:x,bottom:m,totalCount:n,firstItemIndex:s}}const cl=qt(([{sizes:e,totalCount:t,data:n,firstItemIndex:r,gap:o},s,{visibleRange:i,listBoundary:l,topListHeight:u},{scrolledToInitialItem:p,initialTopMostItemIndex:m},{topListHeight:h},g,{didMount:x},{recalcInProgress:y}])=>{const b=Ve([]),w=Tt();st(s.topItemsIndexes,b);const S=yr(Pe(Qn(x,y,ht(i,pd),ht(t),ht(e),ht(m),p,ht(b),ht(r),ht(o),n),gt(([I,M,,R,,,,,,,D])=>{const A=D&&D.length!==R;return I&&!M&&!A}),Xe(([,,[I,M],R,D,A,O,T,X,B,V])=>{const U=D,{sizeTree:N,offsetTree:$}=U;if(R===0||I===0&&M===0)return{...Tj,totalCount:R};if(tn(N))return Gp(wre(zy(A,R),U,V),[],R,B,U,X);const q=[];if(T.length>0){const ae=T[0],re=T[T.length-1];let G=0;for(const K of yg(N,ae,re)){const ee=K.value,ce=Math.max(K.start,ae),J=Math.min(K.end,re);for(let ie=ce;ie<=J;ie++)q.push({index:ie,size:ee,offset:G,data:V&&V[ie]}),G+=ee}}if(!O)return Gp([],q,R,B,U,X);const F=T.length>0?T[T.length-1]+1:0,Q=cre($,I,M,F);if(Q.length===0)return null;const Y=R-1,se=bg([],ae=>{for(const re of Q){const G=re.value;let K=G.offset,ee=re.start;const ce=G.size;if(G.offset=M);ie++)ae.push({index:ie,size:ce,offset:K,data:V&&V[ie]}),K+=ce+B}});return Gp(se,q,R,B,U,X)}),gt(I=>I!==null),pn()),Tj);st(Pe(n,gt(Dy),Xe(I=>I==null?void 0:I.length)),t),st(Pe(S,Xe(I=>I.topListHeight)),h),st(h,u),st(Pe(S,Xe(I=>[I.top,I.bottom])),l),st(Pe(S,Xe(I=>I.items)),w);const j=Jr(Pe(S,gt(({items:I})=>I.length>0),_t(t,n),gt(([{items:I},M])=>I[I.length-1].originalIndex===M-1),Xe(([,I,M])=>[I-1,M]),pn(pd),Xe(([I])=>I))),_=Jr(Pe(S,Ga(200),gt(({items:I,topItems:M})=>I.length>0&&I[0].originalIndex===M.length),Xe(({items:I})=>I[0].index),pn())),E=Jr(Pe(S,gt(({items:I})=>I.length>0),Xe(({items:I})=>{let M=0,R=I.length-1;for(;I[M].type==="group"&&MM;)R--;return{startIndex:I[M].index,endIndex:I[R].index}}),pn(j8)));return{listState:S,topItemsIndexes:b,endReached:j,startReached:_,rangeChanged:E,itemsRendered:w,...g}},hn(Ts,k8,Fy,Yd,Xd,Qd,pi,Ny),{singleton:!0}),Sre=qt(([{sizes:e,firstItemIndex:t,data:n,gap:r},{initialTopMostItemIndex:o},{listState:s},{didMount:i}])=>{const l=Ve(0);return st(Pe(i,_t(l),gt(([,u])=>u!==0),_t(o,e,t,r,n),Xe(([[,u],p,m,h,g,x=[]])=>{let y=0;if(m.groupIndices.length>0)for(const j of m.groupIndices){if(j-y>=u)break;y++}const b=u+y,w=zy(p,b),S=Array.from({length:b}).map((j,_)=>({index:_+w,size:0,offset:0,data:x[_+w]}));return Gp(S,[],b,g,m,h)})),s),{initialItemCount:l}},hn(Ts,Yd,cl,pi),{singleton:!0}),_8=qt(([{scrollVelocity:e}])=>{const t=Ve(!1),n=Tt(),r=Ve(!1);return st(Pe(e,_t(r,t,n),gt(([o,s])=>!!s),Xe(([o,s,i,l])=>{const{exit:u,enter:p}=s;if(i){if(u(o,l))return!1}else if(p(o,l))return!0;return i}),pn()),t),Yt(Pe(Qn(t,e,n),_t(r)),([[o,s,i],l])=>o&&l&&l.change&&l.change(s,i)),{isSeeking:t,scrollSeekConfiguration:r,scrollVelocity:e,scrollSeekRangeChanged:n}},hn(Qd),{singleton:!0}),kre=qt(([{topItemsIndexes:e}])=>{const t=Ve(0);return st(Pe(t,gt(n=>n>0),Xe(n=>Array.from({length:n}).map((r,o)=>o))),e),{topItemCount:t}},hn(cl)),I8=qt(([{footerHeight:e,headerHeight:t,fixedHeaderHeight:n,fixedFooterHeight:r},{listState:o}])=>{const s=Tt(),i=yr(Pe(Qn(e,r,t,n,o),Xe(([l,u,p,m,h])=>l+u+p+m+h.offsetBottom+h.bottom)),0);return st(ht(i),s),{totalListHeight:i,totalListHeightChanged:s}},hn(Sr,cl),{singleton:!0});function P8(e){let t=!1,n;return()=>(t||(t=!0,n=e()),n)}const jre=P8(()=>/iP(ad|od|hone)/i.test(navigator.userAgent)&&/WebKit/i.test(navigator.userAgent)),_re=qt(([{scrollBy:e,scrollTop:t,deviation:n,scrollingInProgress:r},{isScrolling:o,isAtBottom:s,scrollDirection:i,lastJumpDueToItemResize:l},{listState:u},{beforeUnshiftWith:p,shiftWithOffset:m,sizes:h,gap:g},{log:x},{recalcInProgress:y}])=>{const b=Jr(Pe(u,_t(l),bs(([,S,j,_],[{items:E,totalCount:I,bottom:M,offsetBottom:R},D])=>{const A=M+R;let O=0;return j===I&&S.length>0&&E.length>0&&(E[0].originalIndex===0&&S[0].originalIndex===0||(O=A-_,O!==0&&(O+=D))),[O,E,I,A]},[0,[],0,0]),gt(([S])=>S!==0),_t(t,i,r,s,x,y),gt(([,S,j,_,,,E])=>!E&&!_&&S!==0&&j===fd),Xe(([[S],,,,,j])=>(j("Upward scrolling compensation",{amount:S},eo.DEBUG),S))));function w(S){S>0?(wt(e,{top:-S,behavior:"auto"}),wt(n,0)):(wt(n,0),wt(e,{top:-S,behavior:"auto"}))}return Yt(Pe(b,_t(n,o)),([S,j,_])=>{_&&jre()?wt(n,j-S):w(-S)}),Yt(Pe(Qn(yr(o,!1),n,y),gt(([S,j,_])=>!S&&!_&&j!==0),Xe(([S,j])=>j),Ga(1)),w),st(Pe(m,Xe(S=>({top:-S}))),e),Yt(Pe(p,_t(h,g),Xe(([S,{lastSize:j,groupIndices:_,sizeTree:E},I])=>{function M(R){return R*(j+I)}if(_.length===0)return M(S);{let R=0;const D=ud(E,0);let A=0,O=0;for(;AS&&(R-=D,T=S-A+1),A+=T,R+=M(T),O++}return R}})),S=>{wt(n,S),requestAnimationFrame(()=>{wt(e,{top:S}),requestAnimationFrame(()=>{wt(n,0),wt(y,!1)})})}),{deviation:n}},hn(Sr,Qd,cl,Ts,fi,Ny)),Ire=qt(([{didMount:e},{scrollTo:t},{listState:n}])=>{const r=Ve(0);return Yt(Pe(e,_t(r),gt(([,o])=>o!==0),Xe(([,o])=>({top:o}))),o=>{ca(Pe(n,Pc(1),gt(s=>s.items.length>1)),()=>{requestAnimationFrame(()=>{wt(t,o)})})}),{initialScrollTop:r}},hn(pi,Sr,cl),{singleton:!0}),Pre=qt(([{viewportHeight:e},{totalListHeight:t}])=>{const n=Ve(!1),r=yr(Pe(Qn(n,e,t),gt(([o])=>o),Xe(([,o,s])=>Math.max(0,o-s)),Ga(0),pn()),0);return{alignToBottom:n,paddingTopAddition:r}},hn(Sr,I8),{singleton:!0}),By=qt(([{scrollTo:e,scrollContainerState:t}])=>{const n=Tt(),r=Tt(),o=Tt(),s=Ve(!1),i=Ve(void 0);return st(Pe(Qn(n,r),Xe(([{viewportHeight:l,scrollTop:u,scrollHeight:p},{offsetTop:m}])=>({scrollTop:Math.max(0,u-m),scrollHeight:p,viewportHeight:l}))),t),st(Pe(e,_t(r),Xe(([l,{offsetTop:u}])=>({...l,top:l.top+u}))),o),{useWindowScroll:s,customScrollParent:i,windowScrollContainerState:n,windowViewportRect:r,windowScrollTo:o}},hn(Sr)),Ere=({itemTop:e,itemBottom:t,viewportTop:n,viewportBottom:r,locationParams:{behavior:o,align:s,...i}})=>er?{...i,behavior:o,align:s??"end"}:null,Mre=qt(([{sizes:e,totalCount:t,gap:n},{scrollTop:r,viewportHeight:o,headerHeight:s,fixedHeaderHeight:i,fixedFooterHeight:l,scrollingInProgress:u},{scrollToIndex:p}])=>{const m=Tt();return st(Pe(m,_t(e,o,t,s,i,l,r),_t(n),Xe(([[h,g,x,y,b,w,S,j],_])=>{const{done:E,behavior:I,align:M,calculateViewLocation:R=Ere,...D}=h,A=C8(h,g,y-1),O=dd(A,g.offsetTree,_)+b+w,T=O+ns(g.sizeTree,A)[1],X=j+w,B=j+x-S,V=R({itemTop:O,itemBottom:T,viewportTop:X,viewportBottom:B,locationParams:{behavior:I,align:M,...D}});return V?E&&ca(Pe(u,gt(U=>U===!1),Pc(bo(u)?1:2)),E):E&&E(),V}),gt(h=>h!==null)),p),{scrollIntoView:m}},hn(Ts,Sr,Xd,cl,fi),{singleton:!0}),Ore=qt(([{sizes:e,sizeRanges:t},{scrollTop:n},{initialTopMostItemIndex:r},{didMount:o},{useWindowScroll:s,windowScrollContainerState:i,windowViewportRect:l}])=>{const u=Tt(),p=Ve(void 0),m=Ve(null),h=Ve(null);return st(i,m),st(l,h),Yt(Pe(u,_t(e,n,s,m,h)),([g,x,y,b,w,S])=>{const j=fre(x.sizeTree);b&&w!==null&&S!==null&&(y=w.scrollTop-S.offsetTop),g({ranges:j,scrollTop:y})}),st(Pe(p,gt(Dy),Xe(Rre)),r),st(Pe(o,_t(p),gt(([,g])=>g!==void 0),pn(),Xe(([,g])=>g.ranges)),t),{getState:u,restoreStateFrom:p}},hn(Ts,Sr,Yd,pi,By));function Rre(e){return{offset:e.scrollTop,index:0,align:"start"}}const Dre=qt(([e,t,n,r,o,s,i,l,u,p])=>({...e,...t,...n,...r,...o,...s,...i,...l,...u,...p}),hn(Fy,Sre,pi,_8,I8,Ire,Pre,By,Mre,fi)),Are=qt(([{totalCount:e,sizeRanges:t,fixedItemSize:n,defaultItemSize:r,trackItemSizes:o,itemSize:s,data:i,firstItemIndex:l,groupIndices:u,statefulTotalCount:p,gap:m,sizes:h},{initialTopMostItemIndex:g,scrolledToInitialItem:x},y,b,w,{listState:S,topItemsIndexes:j,..._},{scrollToIndex:E},I,{topItemCount:M},{groupCounts:R},D])=>(st(_.rangeChanged,D.scrollSeekRangeChanged),st(Pe(D.windowViewportRect,Xe(A=>A.visibleHeight)),y.viewportHeight),{totalCount:e,data:i,firstItemIndex:l,sizeRanges:t,initialTopMostItemIndex:g,scrolledToInitialItem:x,topItemsIndexes:j,topItemCount:M,groupCounts:R,fixedItemHeight:n,defaultItemHeight:r,gap:m,...w,statefulTotalCount:p,listState:S,scrollToIndex:E,trackItemSizes:o,itemSize:s,groupIndices:u,..._,...D,...y,sizes:h,...b}),hn(Ts,Yd,Sr,Ore,yre,cl,Xd,_re,kre,k8,Dre)),Vv="-webkit-sticky",$j="sticky",E8=P8(()=>{if(typeof document>"u")return $j;const e=document.createElement("div");return e.style.position=Vv,e.style.position===Vv?Vv:$j});function M8(e,t){const n=H.useRef(null),r=H.useCallback(l=>{if(l===null||!l.offsetParent)return;const u=l.getBoundingClientRect(),p=u.width;let m,h;if(t){const g=t.getBoundingClientRect(),x=u.top-g.top;m=g.height-Math.max(0,x),h=x+t.scrollTop}else m=window.innerHeight-Math.max(0,u.top),h=u.top+window.pageYOffset;n.current={offsetTop:h,visibleHeight:m,visibleWidth:p},e(n.current)},[e,t]),{callbackRef:o,ref:s}=Ty(r),i=H.useCallback(()=>{r(s.current)},[r,s]);return H.useEffect(()=>{if(t){t.addEventListener("scroll",i);const l=new ResizeObserver(i);return l.observe(t),()=>{t.removeEventListener("scroll",i),l.unobserve(t)}}else return window.addEventListener("scroll",i),window.addEventListener("resize",i),()=>{window.removeEventListener("scroll",i),window.removeEventListener("resize",i)}},[i,t]),o}const O8=H.createContext(void 0),R8=H.createContext(void 0);function D8(e){return e}const Tre=qt(()=>{const e=Ve(u=>`Item ${u}`),t=Ve(null),n=Ve(u=>`Group ${u}`),r=Ve({}),o=Ve(D8),s=Ve("div"),i=Ve(Uc),l=(u,p=null)=>yr(Pe(r,Xe(m=>m[u]),pn()),p);return{context:t,itemContent:e,groupContent:n,components:r,computeItemKey:o,headerFooterTag:s,scrollerRef:i,FooterComponent:l("Footer"),HeaderComponent:l("Header"),TopItemListComponent:l("TopItemList"),ListComponent:l("List","div"),ItemComponent:l("Item","div"),GroupComponent:l("Group","div"),ScrollerComponent:l("Scroller","div"),EmptyPlaceholder:l("EmptyPlaceholder"),ScrollSeekPlaceholder:l("ScrollSeekPlaceholder")}}),Nre=qt(([e,t])=>({...e,...t}),hn(Are,Tre)),$re=({height:e})=>H.createElement("div",{style:{height:e}}),Lre={position:E8(),zIndex:1,overflowAnchor:"none"},zre={overflowAnchor:"none"},Lj=H.memo(function({showTopList:t=!1}){const n=Rt("listState"),r=yo("sizeRanges"),o=Rt("useWindowScroll"),s=Rt("customScrollParent"),i=yo("windowScrollContainerState"),l=yo("scrollContainerState"),u=s||o?i:l,p=Rt("itemContent"),m=Rt("context"),h=Rt("groupContent"),g=Rt("trackItemSizes"),x=Rt("itemSize"),y=Rt("log"),b=yo("gap"),{callbackRef:w}=Jne(r,x,g,t?Uc:u,y,b,s),[S,j]=H.useState(0);Hy("deviation",V=>{S!==V&&j(V)});const _=Rt("EmptyPlaceholder"),E=Rt("ScrollSeekPlaceholder")||$re,I=Rt("ListComponent"),M=Rt("ItemComponent"),R=Rt("GroupComponent"),D=Rt("computeItemKey"),A=Rt("isSeeking"),O=Rt("groupIndices").length>0,T=Rt("paddingTopAddition"),X=Rt("scrolledToInitialItem"),B=t?{}:{boxSizing:"border-box",paddingTop:n.offsetTop+T,paddingBottom:n.offsetBottom,marginTop:S,...X?{}:{visibility:"hidden"}};return!t&&n.totalCount===0&&_?H.createElement(_,Rr(_,m)):H.createElement(I,{...Rr(I,m),ref:w,style:B,"data-test-id":t?"virtuoso-top-item-list":"virtuoso-item-list"},(t?n.topItems:n.items).map(V=>{const U=V.originalIndex,N=D(U+n.firstItemIndex,V.data,m);return A?H.createElement(E,{...Rr(E,m),key:N,index:V.index,height:V.size,type:V.type||"item",...V.type==="group"?{}:{groupIndex:V.groupIndex}}):V.type==="group"?H.createElement(R,{...Rr(R,m),key:N,"data-index":U,"data-known-size":V.size,"data-item-index":V.index,style:Lre},h(V.index,m)):H.createElement(M,{...Rr(M,m),key:N,"data-index":U,"data-known-size":V.size,"data-item-index":V.index,"data-item-group-index":V.groupIndex,item:V.data,style:zre},O?p(V.index,V.groupIndex,V.data,m):p(V.index,V.data,m))}))}),Fre={height:"100%",outline:"none",overflowY:"auto",position:"relative",WebkitOverflowScrolling:"touch"},wg={width:"100%",height:"100%",position:"absolute",top:0},Bre={width:"100%",position:E8(),top:0,zIndex:1};function Rr(e,t){if(typeof e!="string")return{context:t}}const Hre=H.memo(function(){const t=Rt("HeaderComponent"),n=yo("headerHeight"),r=Rt("headerFooterTag"),o=ll(i=>n(ri(i,"height"))),s=Rt("context");return t?H.createElement(r,{ref:o},H.createElement(t,Rr(t,s))):null}),Vre=H.memo(function(){const t=Rt("FooterComponent"),n=yo("footerHeight"),r=Rt("headerFooterTag"),o=ll(i=>n(ri(i,"height"))),s=Rt("context");return t?H.createElement(r,{ref:o},H.createElement(t,Rr(t,s))):null});function A8({usePublisher:e,useEmitter:t,useEmitterValue:n}){return H.memo(function({style:s,children:i,...l}){const u=e("scrollContainerState"),p=n("ScrollerComponent"),m=e("smoothScrollTargetReached"),h=n("scrollerRef"),g=n("context"),{scrollerRef:x,scrollByCallback:y,scrollToCallback:b}=m8(u,m,p,h);return t("scrollTo",b),t("scrollBy",y),H.createElement(p,{ref:x,style:{...Fre,...s},"data-test-id":"virtuoso-scroller","data-virtuoso-scroller":!0,tabIndex:0,...l,...Rr(p,g)},i)})}function T8({usePublisher:e,useEmitter:t,useEmitterValue:n}){return H.memo(function({style:s,children:i,...l}){const u=e("windowScrollContainerState"),p=n("ScrollerComponent"),m=e("smoothScrollTargetReached"),h=n("totalListHeight"),g=n("deviation"),x=n("customScrollParent"),y=n("context"),{scrollerRef:b,scrollByCallback:w,scrollToCallback:S}=m8(u,m,p,Uc,x);return Qne(()=>(b.current=x||window,()=>{b.current=null}),[b,x]),t("windowScrollTo",S),t("scrollBy",w),H.createElement(p,{style:{position:"relative",...s,...h!==0?{height:h+g}:{}},"data-virtuoso-scroller":!0,...l,...Rr(p,y)},i)})}const Wre=({children:e})=>{const t=H.useContext(O8),n=yo("viewportHeight"),r=yo("fixedItemHeight"),o=ll(c8(n,s=>ri(s,"height")));return H.useEffect(()=>{t&&(n(t.viewportHeight),r(t.itemHeight))},[t,n,r]),H.createElement("div",{style:wg,ref:o,"data-viewport-type":"element"},e)},Ure=({children:e})=>{const t=H.useContext(O8),n=yo("windowViewportRect"),r=yo("fixedItemHeight"),o=Rt("customScrollParent"),s=M8(n,o);return H.useEffect(()=>{t&&(r(t.itemHeight),n({offsetTop:0,visibleHeight:t.viewportHeight,visibleWidth:100}))},[t,n,r]),H.createElement("div",{ref:s,style:wg,"data-viewport-type":"window"},e)},Gre=({children:e})=>{const t=Rt("TopItemListComponent"),n=Rt("headerHeight"),r={...Bre,marginTop:`${n}px`},o=Rt("context");return H.createElement(t||"div",{style:r,context:o},e)},Kre=H.memo(function(t){const n=Rt("useWindowScroll"),r=Rt("topItemsIndexes").length>0,o=Rt("customScrollParent"),s=o||n?Qre:Xre,i=o||n?Ure:Wre;return H.createElement(s,{...t},r&&H.createElement(Gre,null,H.createElement(Lj,{showTopList:!0})),H.createElement(i,null,H.createElement(Hre,null),H.createElement(Lj,null),H.createElement(Vre,null)))}),{Component:qre,usePublisher:yo,useEmitterValue:Rt,useEmitter:Hy}=f8(Nre,{required:{},optional:{restoreStateFrom:"restoreStateFrom",context:"context",followOutput:"followOutput",itemContent:"itemContent",groupContent:"groupContent",overscan:"overscan",increaseViewportBy:"increaseViewportBy",totalCount:"totalCount",groupCounts:"groupCounts",topItemCount:"topItemCount",firstItemIndex:"firstItemIndex",initialTopMostItemIndex:"initialTopMostItemIndex",components:"components",atBottomThreshold:"atBottomThreshold",atTopThreshold:"atTopThreshold",computeItemKey:"computeItemKey",defaultItemHeight:"defaultItemHeight",fixedItemHeight:"fixedItemHeight",itemSize:"itemSize",scrollSeekConfiguration:"scrollSeekConfiguration",headerFooterTag:"headerFooterTag",data:"data",initialItemCount:"initialItemCount",initialScrollTop:"initialScrollTop",alignToBottom:"alignToBottom",useWindowScroll:"useWindowScroll",customScrollParent:"customScrollParent",scrollerRef:"scrollerRef",logLevel:"logLevel"},methods:{scrollToIndex:"scrollToIndex",scrollIntoView:"scrollIntoView",scrollTo:"scrollTo",scrollBy:"scrollBy",autoscrollToBottom:"autoscrollToBottom",getState:"getState"},events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange",totalListHeightChanged:"totalListHeightChanged",itemsRendered:"itemsRendered",groupIndices:"groupIndices"}},Kre),Xre=A8({usePublisher:yo,useEmitterValue:Rt,useEmitter:Hy}),Qre=T8({usePublisher:yo,useEmitterValue:Rt,useEmitter:Hy}),Yre=qre,zj={items:[],offsetBottom:0,offsetTop:0,top:0,bottom:0,itemHeight:0,itemWidth:0},Zre={items:[{index:0}],offsetBottom:0,offsetTop:0,top:0,bottom:0,itemHeight:0,itemWidth:0},{round:Fj,ceil:Bj,floor:ih,min:Wv,max:Vu}=Math;function Jre(e){return{...Zre,items:e}}function Hj(e,t,n){return Array.from({length:t-e+1}).map((r,o)=>{const s=n===null?null:n[o+e];return{index:o+e,data:s}})}function eoe(e,t){return e&&e.column===t.column&&e.row===t.row}function Ep(e,t){return e&&e.width===t.width&&e.height===t.height}const toe=qt(([{overscan:e,visibleRange:t,listBoundary:n},{scrollTop:r,viewportHeight:o,scrollBy:s,scrollTo:i,smoothScrollTargetReached:l,scrollContainerState:u,footerHeight:p,headerHeight:m},h,g,{propsReady:x,didMount:y},{windowViewportRect:b,useWindowScroll:w,customScrollParent:S,windowScrollContainerState:j,windowScrollTo:_},E])=>{const I=Ve(0),M=Ve(0),R=Ve(zj),D=Ve({height:0,width:0}),A=Ve({height:0,width:0}),O=Tt(),T=Tt(),X=Ve(0),B=Ve(null),V=Ve({row:0,column:0}),U=Tt(),N=Tt(),$=Ve(!1),q=Ve(0),F=Ve(!0),Q=Ve(!1);Yt(Pe(y,_t(q),gt(([K,ee])=>!!ee)),()=>{wt(F,!1),wt(M,0)}),Yt(Pe(Qn(y,F,A,D,q,Q),gt(([K,ee,ce,J,,ie])=>K&&!ee&&ce.height!==0&&J.height!==0&&!ie)),([,,,,K])=>{wt(Q,!0),Ly(1,()=>{wt(O,K)}),ca(Pe(r),()=>{wt(n,[0,0]),wt(F,!0)})}),st(Pe(N,gt(K=>K!=null&&K.scrollTop>0),qs(0)),M),Yt(Pe(y,_t(N),gt(([,K])=>K!=null)),([,K])=>{K&&(wt(D,K.viewport),wt(A,K==null?void 0:K.item),wt(V,K.gap),K.scrollTop>0&&(wt($,!0),ca(Pe(r,Pc(1)),ee=>{wt($,!1)}),wt(i,{top:K.scrollTop})))}),st(Pe(D,Xe(({height:K})=>K)),o),st(Pe(Qn(ht(D,Ep),ht(A,Ep),ht(V,(K,ee)=>K&&K.column===ee.column&&K.row===ee.row),ht(r)),Xe(([K,ee,ce,J])=>({viewport:K,item:ee,gap:ce,scrollTop:J}))),U),st(Pe(Qn(ht(I),t,ht(V,eoe),ht(A,Ep),ht(D,Ep),ht(B),ht(M),ht($),ht(F),ht(q)),gt(([,,,,,,,K])=>!K),Xe(([K,[ee,ce],J,ie,de,ge,Ce,,he,fe])=>{const{row:Oe,column:_e}=J,{height:Ne,width:nt}=ie,{width:$e}=de;if(Ce===0&&(K===0||$e===0))return zj;if(nt===0){const lt=zy(fe,K),ft=lt===0?Math.max(Ce-1,0):lt;return Jre(Hj(lt,ft,ge))}const Pt=N8($e,nt,_e);let Ze,ot;he?ee===0&&ce===0&&Ce>0?(Ze=0,ot=Ce-1):(Ze=Pt*ih((ee+Oe)/(Ne+Oe)),ot=Pt*Bj((ce+Oe)/(Ne+Oe))-1,ot=Wv(K-1,Vu(ot,Pt-1)),Ze=Wv(ot,Vu(0,Ze))):(Ze=0,ot=-1);const ye=Hj(Ze,ot,ge),{top:De,bottom:ut}=Vj(de,J,ie,ye),bt=Bj(K/Pt),Je=bt*Ne+(bt-1)*Oe-ut;return{items:ye,offsetTop:De,offsetBottom:Je,top:De,bottom:ut,itemHeight:Ne,itemWidth:nt}})),R),st(Pe(B,gt(K=>K!==null),Xe(K=>K.length)),I),st(Pe(Qn(D,A,R,V),gt(([K,ee,{items:ce}])=>ce.length>0&&ee.height!==0&&K.height!==0),Xe(([K,ee,{items:ce},J])=>{const{top:ie,bottom:de}=Vj(K,J,ee,ce);return[ie,de]}),pn(pd)),n);const Y=Ve(!1);st(Pe(r,_t(Y),Xe(([K,ee])=>ee||K!==0)),Y);const se=Jr(Pe(ht(R),gt(({items:K})=>K.length>0),_t(I,Y),gt(([{items:K},ee,ce])=>ce&&K[K.length-1].index===ee-1),Xe(([,K])=>K-1),pn())),ae=Jr(Pe(ht(R),gt(({items:K})=>K.length>0&&K[0].index===0),qs(0),pn())),re=Jr(Pe(ht(R),_t($),gt(([{items:K},ee])=>K.length>0&&!ee),Xe(([{items:K}])=>({startIndex:K[0].index,endIndex:K[K.length-1].index})),pn(j8),Ga(0)));st(re,g.scrollSeekRangeChanged),st(Pe(O,_t(D,A,I,V),Xe(([K,ee,ce,J,ie])=>{const de=S8(K),{align:ge,behavior:Ce,offset:he}=de;let fe=de.index;fe==="LAST"&&(fe=J-1),fe=Vu(0,fe,Wv(J-1,fe));let Oe=yx(ee,ie,ce,fe);return ge==="end"?Oe=Fj(Oe-ee.height+ce.height):ge==="center"&&(Oe=Fj(Oe-ee.height/2+ce.height/2)),he&&(Oe+=he),{top:Oe,behavior:Ce}})),i);const G=yr(Pe(R,Xe(K=>K.offsetBottom+K.bottom)),0);return st(Pe(b,Xe(K=>({width:K.visibleWidth,height:K.visibleHeight}))),D),{data:B,totalCount:I,viewportDimensions:D,itemDimensions:A,scrollTop:r,scrollHeight:T,overscan:e,scrollBy:s,scrollTo:i,scrollToIndex:O,smoothScrollTargetReached:l,windowViewportRect:b,windowScrollTo:_,useWindowScroll:w,customScrollParent:S,windowScrollContainerState:j,deviation:X,scrollContainerState:u,footerHeight:p,headerHeight:m,initialItemCount:M,gap:V,restoreStateFrom:N,...g,initialTopMostItemIndex:q,gridState:R,totalListHeight:G,...h,startReached:ae,endReached:se,rangeChanged:re,stateChanged:U,propsReady:x,stateRestoreInProgress:$,...E}},hn(Fy,Sr,Qd,_8,pi,By,fi));function Vj(e,t,n,r){const{height:o}=n;if(o===void 0||r.length===0)return{top:0,bottom:0};const s=yx(e,t,n,r[0].index),i=yx(e,t,n,r[r.length-1].index)+o;return{top:s,bottom:i}}function yx(e,t,n,r){const o=N8(e.width,n.width,t.column),s=ih(r/o),i=s*n.height+Vu(0,s-1)*t.row;return i>0?i+t.row:i}function N8(e,t,n){return Vu(1,ih((e+n)/(ih(t)+n)))}const noe=qt(()=>{const e=Ve(p=>`Item ${p}`),t=Ve({}),n=Ve(null),r=Ve("virtuoso-grid-item"),o=Ve("virtuoso-grid-list"),s=Ve(D8),i=Ve("div"),l=Ve(Uc),u=(p,m=null)=>yr(Pe(t,Xe(h=>h[p]),pn()),m);return{context:n,itemContent:e,components:t,computeItemKey:s,itemClassName:r,listClassName:o,headerFooterTag:i,scrollerRef:l,FooterComponent:u("Footer"),HeaderComponent:u("Header"),ListComponent:u("List","div"),ItemComponent:u("Item","div"),ScrollerComponent:u("Scroller","div"),ScrollSeekPlaceholder:u("ScrollSeekPlaceholder","div")}}),roe=qt(([e,t])=>({...e,...t}),hn(toe,noe)),ooe=H.memo(function(){const t=yn("gridState"),n=yn("listClassName"),r=yn("itemClassName"),o=yn("itemContent"),s=yn("computeItemKey"),i=yn("isSeeking"),l=qo("scrollHeight"),u=yn("ItemComponent"),p=yn("ListComponent"),m=yn("ScrollSeekPlaceholder"),h=yn("context"),g=qo("itemDimensions"),x=qo("gap"),y=yn("log"),b=yn("stateRestoreInProgress"),w=ll(S=>{const j=S.parentElement.parentElement.scrollHeight;l(j);const _=S.firstChild;if(_){const{width:E,height:I}=_.getBoundingClientRect();g({width:E,height:I})}x({row:Wj("row-gap",getComputedStyle(S).rowGap,y),column:Wj("column-gap",getComputedStyle(S).columnGap,y)})});return b?null:H.createElement(p,{ref:w,className:n,...Rr(p,h),style:{paddingTop:t.offsetTop,paddingBottom:t.offsetBottom},"data-test-id":"virtuoso-item-list"},t.items.map(S=>{const j=s(S.index,S.data,h);return i?H.createElement(m,{key:j,...Rr(m,h),index:S.index,height:t.itemHeight,width:t.itemWidth}):H.createElement(u,{...Rr(u,h),className:r,"data-index":S.index,key:j},o(S.index,S.data,h))}))}),soe=H.memo(function(){const t=yn("HeaderComponent"),n=qo("headerHeight"),r=yn("headerFooterTag"),o=ll(i=>n(ri(i,"height"))),s=yn("context");return t?H.createElement(r,{ref:o},H.createElement(t,Rr(t,s))):null}),aoe=H.memo(function(){const t=yn("FooterComponent"),n=qo("footerHeight"),r=yn("headerFooterTag"),o=ll(i=>n(ri(i,"height"))),s=yn("context");return t?H.createElement(r,{ref:o},H.createElement(t,Rr(t,s))):null}),ioe=({children:e})=>{const t=H.useContext(R8),n=qo("itemDimensions"),r=qo("viewportDimensions"),o=ll(s=>{r(s.getBoundingClientRect())});return H.useEffect(()=>{t&&(r({height:t.viewportHeight,width:t.viewportWidth}),n({height:t.itemHeight,width:t.itemWidth}))},[t,r,n]),H.createElement("div",{style:wg,ref:o},e)},loe=({children:e})=>{const t=H.useContext(R8),n=qo("windowViewportRect"),r=qo("itemDimensions"),o=yn("customScrollParent"),s=M8(n,o);return H.useEffect(()=>{t&&(r({height:t.itemHeight,width:t.itemWidth}),n({offsetTop:0,visibleHeight:t.viewportHeight,visibleWidth:t.viewportWidth}))},[t,n,r]),H.createElement("div",{ref:s,style:wg},e)},coe=H.memo(function({...t}){const n=yn("useWindowScroll"),r=yn("customScrollParent"),o=r||n?foe:doe,s=r||n?loe:ioe;return H.createElement(o,{...t},H.createElement(s,null,H.createElement(soe,null),H.createElement(ooe,null),H.createElement(aoe,null)))}),{Component:uoe,usePublisher:qo,useEmitterValue:yn,useEmitter:$8}=f8(roe,{optional:{context:"context",totalCount:"totalCount",overscan:"overscan",itemContent:"itemContent",components:"components",computeItemKey:"computeItemKey",data:"data",initialItemCount:"initialItemCount",scrollSeekConfiguration:"scrollSeekConfiguration",headerFooterTag:"headerFooterTag",listClassName:"listClassName",itemClassName:"itemClassName",useWindowScroll:"useWindowScroll",customScrollParent:"customScrollParent",scrollerRef:"scrollerRef",logLevel:"logLevel",restoreStateFrom:"restoreStateFrom",initialTopMostItemIndex:"initialTopMostItemIndex"},methods:{scrollTo:"scrollTo",scrollBy:"scrollBy",scrollToIndex:"scrollToIndex"},events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange",stateChanged:"stateChanged"}},coe),doe=A8({usePublisher:qo,useEmitterValue:yn,useEmitter:$8}),foe=T8({usePublisher:qo,useEmitterValue:yn,useEmitter:$8});function Wj(e,t,n){return t!=="normal"&&!(t!=null&&t.endsWith("px"))&&n(`${e} was not resolved to pixel value correctly`,t,eo.WARN),t==="normal"?0:parseInt(t??"0",10)}const poe=uoe,moe=e=>{const t=W(s=>s.gallery.galleryView),{data:n}=cI(e),{data:r}=uI(e),o=d.useMemo(()=>t==="images"?n:r,[t,r,n]);return{totalImages:n,totalAssets:r,currentViewTotal:o}},hoe=({imageDTO:e})=>a.jsx(L,{sx:{pointerEvents:"none",flexDirection:"column",position:"absolute",top:0,insetInlineStart:0,p:2,alignItems:"flex-start",gap:2},children:a.jsxs(Ds,{variant:"solid",colorScheme:"base",children:[e.width," × ",e.height]})}),goe=d.memo(hoe),Vy=({postUploadAction:e,isDisabled:t})=>{const n=W(u=>u.gallery.autoAddBoardId),[r]=nI(),o=d.useCallback(u=>{const p=u[0];p&&r({file:p,image_category:"user",is_intermediate:!1,postUploadAction:e??{type:"TOAST"},board_id:n==="none"?void 0:n})},[n,e,r]),{getRootProps:s,getInputProps:i,open:l}=Qb({accept:{"image/png":[".png"],"image/jpeg":[".jpg",".jpeg",".png"]},onDropAccepted:o,disabled:t,noDrag:!0,multiple:!1});return{getUploadButtonProps:s,getUploadInputProps:i,openUploader:l}},voe=le(xe,({generation:e})=>{const{model:t}=e;return{model:t}}),Sg=()=>{const e=te(),t=sl(),{t:n}=Z(),{model:r}=W(voe),o=d.useCallback(()=>{t({title:n("toast.parameterSet"),status:"info",duration:2500,isClosable:!0})},[n,t]),s=d.useCallback(N=>{t({title:n("toast.parameterNotSet"),description:N,status:"warning",duration:2500,isClosable:!0})},[n,t]),i=d.useCallback(()=>{t({title:n("toast.parametersSet"),status:"info",duration:2500,isClosable:!0})},[n,t]),l=d.useCallback(N=>{t({title:n("toast.parametersNotSet"),status:"warning",description:N,duration:2500,isClosable:!0})},[n,t]),u=d.useCallback((N,$,q,F)=>{if(qf(N)||Xf($)||bu(q)||Q0(F)){qf(N)&&e(Nu(N)),Xf($)&&e($u($)),bu(q)&&e(Lu(q)),bu(F)&&e(zu(F)),o();return}s()},[e,o,s]),p=d.useCallback(N=>{if(!qf(N)){s();return}e(Nu(N)),o()},[e,o,s]),m=d.useCallback(N=>{if(!Xf(N)){s();return}e($u(N)),o()},[e,o,s]),h=d.useCallback(N=>{if(!bu(N)){s();return}e(Lu(N)),o()},[e,o,s]),g=d.useCallback(N=>{if(!Q0(N)){s();return}e(zu(N)),o()},[e,o,s]),x=d.useCallback(N=>{if(!sw(N)){s();return}e(Xp(N)),o()},[e,o,s]),y=d.useCallback(N=>{if(!Y0(N)){s();return}e(Qp(N)),o()},[e,o,s]),b=d.useCallback(N=>{if(!aw(N)){s();return}e(i1(N)),o()},[e,o,s]),w=d.useCallback(N=>{if(!Z0(N)){s();return}e(l1(N)),o()},[e,o,s]),S=d.useCallback(N=>{if(!J0(N)){s();return}e(Yp(N)),o()},[e,o,s]),j=d.useCallback(N=>{if(!iw(N)){s();return}e(Hi(N)),o()},[e,o,s]),_=d.useCallback(N=>{if(!lw(N)){s();return}e(Vi(N)),o()},[e,o,s]),E=d.useCallback(N=>{if(!cw(N)){s();return}e(Zp(N)),o()},[e,o,s]),{loras:I}=Cd(void 0,{selectFromResult:N=>({loras:N.data?MD.getSelectors().selectAll(N.data):[]})}),M=d.useCallback(N=>{if(!fI(N.lora))return{lora:null,error:"Invalid LoRA model"};const{base_model:$,model_name:q}=N.lora,F=I.find(Y=>Y.base_model===$&&Y.model_name===q);return F?(F==null?void 0:F.base_model)===(r==null?void 0:r.base_model)?{lora:F,error:null}:{lora:null,error:"LoRA incompatible with currently-selected model"}:{lora:null,error:"LoRA model is not installed"}},[I,r==null?void 0:r.base_model]),R=d.useCallback(N=>{const $=M(N);if(!$.lora){s($.error);return}e(uw({...$.lora,weight:N.weight})),o()},[M,e,o,s]),{controlnets:D}=gh(void 0,{selectFromResult:N=>({controlnets:N.data?OD.getSelectors().selectAll(N.data):[]})}),A=d.useCallback(N=>{if(!c1(N.control_model))return{controlnet:null,error:"Invalid ControlNet model"};const{image:$,control_model:q,control_weight:F,begin_step_percent:Q,end_step_percent:Y,control_mode:se,resize_mode:ae}=N,re=D.find(ie=>ie.base_model===q.base_model&&ie.model_name===q.model_name);if(!re)return{controlnet:null,error:"ControlNet model is not installed"};if(!((re==null?void 0:re.base_model)===(r==null?void 0:r.base_model)))return{controlnet:null,error:"ControlNet incompatible with currently-selected model"};const K=Zs();let ee=Ta.processorType;for(const ie in dw)if(re.model_name.includes(ie)){ee=dw[ie]||Ta.processorType;break}const ce=Fr[ee].default;return{controlnet:{isEnabled:!0,model:re,weight:typeof F=="number"?F:Ta.weight,beginStepPct:Q||Ta.beginStepPct,endStepPct:Y||Ta.endStepPct,controlMode:se||Ta.controlMode,resizeMode:ae||Ta.resizeMode,controlImage:($==null?void 0:$.image_name)||null,processedControlImage:($==null?void 0:$.image_name)||null,processorType:ee,processorNode:ce.type!=="none"?ce:Ta.processorNode,shouldAutoConfig:!0,controlNetId:K},error:null}},[D,r==null?void 0:r.base_model]),O=d.useCallback(N=>{const $=A(N);if(!$.controlnet){s($.error);return}e(fw({...$.controlnet})),o()},[A,e,o,s]),{ipAdapters:T}=Vx(void 0,{selectFromResult:N=>({ipAdapters:N.data?RD.getSelectors().selectAll(N.data):[]})}),X=d.useCallback(N=>{if(!DD(N==null?void 0:N.ip_adapter_model))return{ipAdapter:null,error:"Invalid IP Adapter model"};const{image:$,ip_adapter_model:q,weight:F,begin_step_percent:Q,end_step_percent:Y}=N,se=T.find(G=>G.base_model===(q==null?void 0:q.base_model)&&G.model_name===(q==null?void 0:q.model_name));return se?(se==null?void 0:se.base_model)===(r==null?void 0:r.base_model)?{ipAdapter:{adapterImage:($==null?void 0:$.image_name)??null,model:se,weight:F??ev.weight,beginStepPct:Q??ev.beginStepPct,endStepPct:Y??ev.endStepPct},error:null}:{ipAdapter:null,error:"IP Adapter incompatible with currently-selected model"}:{ipAdapter:null,error:"IP Adapter model is not installed"}},[T,r==null?void 0:r.base_model]),B=d.useCallback(N=>{const $=X(N);if(!$.ipAdapter){s($.error);return}e(pw({...$.ipAdapter})),e(u1(!0)),o()},[X,e,o,s]),V=d.useCallback(N=>{e(vh(N))},[e]),U=d.useCallback(N=>{if(!N){l();return}const{cfg_scale:$,height:q,model:F,positive_prompt:Q,negative_prompt:Y,scheduler:se,seed:ae,steps:re,width:G,strength:K,positive_style_prompt:ee,negative_style_prompt:ce,refiner_model:J,refiner_cfg_scale:ie,refiner_steps:de,refiner_scheduler:ge,refiner_positive_aesthetic_score:Ce,refiner_negative_aesthetic_score:he,refiner_start:fe,loras:Oe,controlnets:_e,ipAdapters:Ne}=N;Y0($)&&e(Qp($)),aw(F)&&e(i1(F)),qf(Q)&&e(Nu(Q)),Xf(Y)&&e($u(Y)),Z0(se)&&e(l1(se)),sw(ae)&&e(Xp(ae)),J0(re)&&e(Yp(re)),iw(G)&&e(Hi(G)),lw(q)&&e(Vi(q)),cw(K)&&e(Zp(K)),bu(ee)&&e(Lu(ee)),Q0(ce)&&e(zu(ce)),AD(J)&&e(pI(J)),J0(de)&&e(d1(de)),Y0(ie)&&e(f1(ie)),Z0(ge)&&e(mI(ge)),TD(Ce)&&e(p1(Ce)),ND(he)&&e(m1(he)),$D(fe)&&e(h1(fe)),e(LD()),Oe==null||Oe.forEach(nt=>{const $e=M(nt);$e.lora&&e(uw({...$e.lora,weight:nt.weight}))}),e(sI()),_e!=null&&_e.length&&e(zD()),_e==null||_e.forEach(nt=>{const $e=A(nt);$e.controlnet&&e(fw($e.controlnet))}),Ne!=null&&Ne.length&&e(u1(!0)),Ne==null||Ne.forEach(nt=>{const $e=X(nt);$e.ipAdapter&&e(pw($e.ipAdapter))}),i()},[l,i,e,M,A,X]);return{recallBothPrompts:u,recallPositivePrompt:p,recallNegativePrompt:m,recallSDXLPositiveStylePrompt:h,recallSDXLNegativeStylePrompt:g,recallSeed:x,recallCfgScale:y,recallModel:b,recallScheduler:w,recallSteps:S,recallWidth:j,recallHeight:_,recallStrength:E,recallLoRA:R,recallControlNet:O,recallIPAdapter:B,recallAllParameters:U,sendToImageToImage:V}},L8=()=>{const e=sl(),{t}=Z(),n=d.useMemo(()=>!!navigator.clipboard&&!!window.ClipboardItem,[]),r=d.useCallback(async o=>{n||e({title:t("toast.problemCopyingImage"),description:"Your browser doesn't support the Clipboard API.",status:"error",duration:2500,isClosable:!0});try{FD((async()=>await(await fetch(o)).blob())()),e({title:t("toast.imageCopied"),status:"success",duration:2500,isClosable:!0})}catch(s){e({title:t("toast.problemCopyingImage"),description:String(s),status:"error",duration:2500,isClosable:!0})}},[n,t,e]);return{isClipboardAPIAvailable:n,copyImageToClipboard:r}};function xoe(e){return Te({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M125.7 160H176c17.7 0 32 14.3 32 32s-14.3 32-32 32H48c-17.7 0-32-14.3-32-32V64c0-17.7 14.3-32 32-32s32 14.3 32 32v51.2L97.6 97.6c87.5-87.5 229.3-87.5 316.8 0s87.5 229.3 0 316.8s-229.3 87.5-316.8 0c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0c62.5 62.5 163.8 62.5 226.3 0s62.5-163.8 0-226.3s-163.8-62.5-226.3 0L125.7 160z"}}]})(e)}function boe(e){return Te({tag:"svg",attr:{viewBox:"0 0 384 512"},child:[{tag:"path",attr:{d:"M0 256L28.5 28c2-16 15.6-28 31.8-28H228.9c15 0 27.1 12.1 27.1 27.1c0 3.2-.6 6.5-1.7 9.5L208 160H347.3c20.2 0 36.7 16.4 36.7 36.7c0 7.4-2.2 14.6-6.4 20.7l-192.2 281c-5.9 8.6-15.6 13.7-25.9 13.7h-2.9c-15.7 0-28.5-12.8-28.5-28.5c0-2.3 .3-4.6 .9-6.9L176 288H32c-17.7 0-32-14.3-32-32z"}}]})(e)}function yoe(e){return Te({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M256 512A256 256 0 1 0 256 0a256 256 0 1 0 0 512zm0-384c13.3 0 24 10.7 24 24V264c0 13.3-10.7 24-24 24s-24-10.7-24-24V152c0-13.3 10.7-24 24-24zM224 352a32 32 0 1 1 64 0 32 32 0 1 1 -64 0z"}}]})(e)}function Wy(e){return Te({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M418.4 157.9c35.3-8.3 61.6-40 61.6-77.9c0-44.2-35.8-80-80-80c-43.4 0-78.7 34.5-80 77.5L136.2 151.1C121.7 136.8 101.9 128 80 128c-44.2 0-80 35.8-80 80s35.8 80 80 80c12.2 0 23.8-2.7 34.1-7.6L259.7 407.8c-2.4 7.6-3.7 15.8-3.7 24.2c0 44.2 35.8 80 80 80s80-35.8 80-80c0-27.7-14-52.1-35.4-66.4l37.8-207.7zM156.3 232.2c2.2-6.9 3.5-14.2 3.7-21.7l183.8-73.5c3.6 3.5 7.4 6.7 11.6 9.5L317.6 354.1c-5.5 1.3-10.8 3.1-15.8 5.5L156.3 232.2z"}}]})(e)}function Coe(e){return Te({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M8 256a56 56 0 1 1 112 0A56 56 0 1 1 8 256zm160 0a56 56 0 1 1 112 0 56 56 0 1 1 -112 0zm216-56a56 56 0 1 1 0 112 56 56 0 1 1 0-112z"}}]})(e)}function woe(e){return Te({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M416 208c0 45.9-14.9 88.3-40 122.7L502.6 457.4c12.5 12.5 12.5 32.8 0 45.3s-32.8 12.5-45.3 0L330.7 376c-34.4 25.2-76.8 40-122.7 40C93.1 416 0 322.9 0 208S93.1 0 208 0S416 93.1 416 208zM136 184c-13.3 0-24 10.7-24 24s10.7 24 24 24H280c13.3 0 24-10.7 24-24s-10.7-24-24-24H136z"}}]})(e)}function Soe(e){return Te({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M416 208c0 45.9-14.9 88.3-40 122.7L502.6 457.4c12.5 12.5 12.5 32.8 0 45.3s-32.8 12.5-45.3 0L330.7 376c-34.4 25.2-76.8 40-122.7 40C93.1 416 0 322.9 0 208S93.1 0 208 0S416 93.1 416 208zM184 296c0 13.3 10.7 24 24 24s24-10.7 24-24V232h64c13.3 0 24-10.7 24-24s-10.7-24-24-24H232V120c0-13.3-10.7-24-24-24s-24 10.7-24 24v64H120c-13.3 0-24 10.7-24 24s10.7 24 24 24h64v64z"}}]})(e)}function koe(e){return Te({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0V0z"}},{tag:"path",attr:{d:"M17 16l-4-4V8.82C14.16 8.4 15 7.3 15 6c0-1.66-1.34-3-3-3S9 4.34 9 6c0 1.3.84 2.4 2 2.82V12l-4 4H3v5h5v-3.05l4-4.2 4 4.2V21h5v-5h-4z"}}]})(e)}function joe(e){return Te({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M20 2H4c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zM8 20H4v-4h4v4zm0-6H4v-4h4v4zm0-6H4V4h4v4zm6 12h-4v-4h4v4zm0-6h-4v-4h4v4zm0-6h-4V4h4v4zm6 12h-4v-4h4v4zm0-6h-4v-4h4v4zm0-6h-4V4h4v4z"}}]})(e)}function _oe(e){return Te({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M22 16V4c0-1.1-.9-2-2-2H8c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2zm-11-4l2.03 2.71L16 11l4 5H8l3-4zM2 6v14c0 1.1.9 2 2 2h14v-2H4V6H2z"}}]})(e)}function Uy(e){return Te({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M22 9.24l-7.19-.62L12 2 9.19 8.63 2 9.24l5.46 4.73L5.82 21 12 17.27 18.18 21l-1.63-7.03L22 9.24zM12 15.4l-3.76 2.27 1-4.28-3.32-2.88 4.38-.38L12 6.1l1.71 4.04 4.38.38-3.32 2.88 1 4.28L12 15.4z"}}]})(e)}function Gy(e){return Te({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M12 17.27L18.18 21l-1.64-7.03L22 9.24l-7.19-.61L12 2 9.19 8.63 2 9.24l5.46 4.73L5.82 21z"}}]})(e)}function z8(e){return Te({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0V0z"}},{tag:"path",attr:{d:"M16 17.01V10h-2v7.01h-3L15 21l4-3.99h-3zM9 3L5 6.99h3V14h2V6.99h3L9 3zm7 14.01V10h-2v7.01h-3L15 21l4-3.99h-3zM9 3L5 6.99h3V14h2V6.99h3L9 3z"}}]})(e)}const Ky=e=>e.config;Wx("gallery/requestedBoardImagesDeletion");const Ioe=Wx("gallery/sentImageToCanvas"),F8=Wx("gallery/sentImageToImg2Img"),Poe=e=>{const{imageDTO:t}=e,n=te(),{t:r}=Z(),o=sl(),s=Bt("unifiedCanvas").isFeatureEnabled,{shouldFetchMetadataFromApi:i}=W(Ky),l=Jh(Ux),{metadata:u,workflow:p,isLoading:m}=Gx({image:t,shouldFetchMetadataFromApi:i},{selectFromResult:B=>{var V,U;return{isLoading:B.isFetching,metadata:(V=B==null?void 0:B.currentData)==null?void 0:V.metadata,workflow:(U=B==null?void 0:B.currentData)==null?void 0:U.workflow}}}),[h]=Kx(),[g]=qx(),{isClipboardAPIAvailable:x,copyImageToClipboard:y}=L8(),b=d.useCallback(()=>{t&&n(xh([t]))},[n,t]),{recallBothPrompts:w,recallSeed:S,recallAllParameters:j}=Sg(),_=d.useCallback(()=>{w(u==null?void 0:u.positive_prompt,u==null?void 0:u.negative_prompt,u==null?void 0:u.positive_style_prompt,u==null?void 0:u.negative_style_prompt)},[u==null?void 0:u.negative_prompt,u==null?void 0:u.positive_prompt,u==null?void 0:u.positive_style_prompt,u==null?void 0:u.negative_style_prompt,w]),E=d.useCallback(()=>{S(u==null?void 0:u.seed)},[u==null?void 0:u.seed,S]),I=d.useCallback(()=>{p&&n(Xx(p))},[n,p]),M=d.useCallback(()=>{n(F8()),n(vh(t))},[n,t]),R=d.useCallback(()=>{n(Ioe()),qr.flushSync(()=>{n(Xs("unifiedCanvas"))}),n(hI(t)),o({title:r("toast.sentToUnifiedCanvas"),status:"success",duration:2500,isClosable:!0})},[n,t,r,o]),D=d.useCallback(()=>{j(u)},[u,j]),A=d.useCallback(()=>{n(gI([t])),n(Bx(!0))},[n,t]),O=d.useCallback(()=>{y(t.image_url)},[y,t.image_url]),T=d.useCallback(()=>{t&&h({imageDTOs:[t]})},[h,t]),X=d.useCallback(()=>{t&&g({imageDTOs:[t]})},[g,t]);return a.jsxs(a.Fragment,{children:[a.jsx(en,{as:"a",href:t.image_url,target:"_blank",icon:a.jsx(py,{}),children:r("common.openInNewTab")}),x&&a.jsx(en,{icon:a.jsx(Hc,{}),onClickCapture:O,children:r("parameters.copyImage")}),a.jsx(en,{as:"a",download:!0,href:t.image_url,target:"_blank",icon:a.jsx(ig,{}),w:"100%",children:r("parameters.downloadImage")}),a.jsx(en,{icon:m?a.jsx(Mp,{}):a.jsx(Wy,{}),onClickCapture:I,isDisabled:m||!p,children:r("nodes.loadWorkflow")}),a.jsx(en,{icon:m?a.jsx(Mp,{}):a.jsx(gM,{}),onClickCapture:_,isDisabled:m||(u==null?void 0:u.positive_prompt)===void 0&&(u==null?void 0:u.negative_prompt)===void 0,children:r("parameters.usePrompt")}),a.jsx(en,{icon:m?a.jsx(Mp,{}):a.jsx(vM,{}),onClickCapture:E,isDisabled:m||(u==null?void 0:u.seed)===void 0,children:r("parameters.useSeed")}),a.jsx(en,{icon:m?a.jsx(Mp,{}):a.jsx(aM,{}),onClickCapture:D,isDisabled:m||!u,children:r("parameters.useAll")}),a.jsx(en,{icon:a.jsx(qk,{}),onClickCapture:M,id:"send-to-img2img",children:r("parameters.sendToImg2Img")}),s&&a.jsx(en,{icon:a.jsx(qk,{}),onClickCapture:R,id:"send-to-canvas",children:r("parameters.sendToUnifiedCanvas")}),a.jsx(en,{icon:a.jsx(dM,{}),onClickCapture:A,children:"Change Board"}),t.starred?a.jsx(en,{icon:l?l.off.icon:a.jsx(Gy,{}),onClickCapture:X,children:l?l.off.text:"Unstar Image"}):a.jsx(en,{icon:l?l.on.icon:a.jsx(Uy,{}),onClickCapture:T,children:l?l.on.text:"Star Image"}),a.jsx(en,{sx:{color:"error.600",_dark:{color:"error.300"}},icon:a.jsx(Br,{}),onClickCapture:b,children:r("gallery.deleteImage")})]})},B8=d.memo(Poe),Mp=()=>a.jsx(L,{w:"14px",alignItems:"center",justifyContent:"center",children:a.jsx(fa,{size:"xs"})}),Eoe=()=>{const e=te(),t=W(h=>h.gallery.selection),n=Jh(Ux),[r]=Kx(),[o]=qx(),s=d.useCallback(()=>{e(gI(t)),e(Bx(!0))},[e,t]),i=d.useCallback(()=>{e(xh(t))},[e,t]),l=d.useCallback(()=>{r({imageDTOs:t})},[r,t]),u=d.useCallback(()=>{o({imageDTOs:t})},[o,t]),p=d.useMemo(()=>t.every(h=>h.starred),[t]),m=d.useMemo(()=>t.every(h=>!h.starred),[t]);return a.jsxs(a.Fragment,{children:[p&&a.jsx(en,{icon:n?n.on.icon:a.jsx(Uy,{}),onClickCapture:u,children:n?n.off.text:"Unstar All"}),(m||!p&&!m)&&a.jsx(en,{icon:n?n.on.icon:a.jsx(Gy,{}),onClickCapture:l,children:n?n.on.text:"Star All"}),a.jsx(en,{icon:a.jsx(dM,{}),onClickCapture:s,children:"Change Board"}),a.jsx(en,{sx:{color:"error.600",_dark:{color:"error.300"}},icon:a.jsx(Br,{}),onClickCapture:i,children:"Delete Selection"})]})},Moe=d.memo(Eoe),Ooe=le([xe],({gallery:e})=>({selectionCount:e.selection.length}),Se),Roe=({imageDTO:e,children:t})=>{const{selectionCount:n}=W(Ooe),r=d.useCallback(o=>{o.preventDefault()},[]);return a.jsx(Ry,{menuProps:{size:"sm",isLazy:!0},menuButtonProps:{bg:"transparent",_hover:{bg:"transparent"}},renderMenu:()=>e?n>1?a.jsx(Gi,{sx:{visibility:"visible !important"},motionProps:vc,onContextMenu:r,children:a.jsx(Moe,{})}):a.jsx(Gi,{sx:{visibility:"visible !important"},motionProps:vc,onContextMenu:r,children:a.jsx(B8,{imageDTO:e})}):null,children:t})},Doe=d.memo(Roe),Aoe=e=>{const{data:t,disabled:n,...r}=e,o=d.useRef(Zs()),{attributes:s,listeners:i,setNodeRef:l}=une({id:o.current,disabled:n,data:t});return a.jsx(Ie,{ref:l,position:"absolute",w:"full",h:"full",top:0,insetInlineStart:0,...s,...i,...r})},Toe=d.memo(Aoe),Noe=a.jsx(Nn,{as:cg,sx:{boxSize:16}}),$oe=a.jsx(Zn,{icon:Yi}),Loe=e=>{const{imageDTO:t,onError:n,onClick:r,withMetadataOverlay:o=!1,isDropDisabled:s=!1,isDragDisabled:i=!1,isUploadDisabled:l=!1,minSize:u=24,postUploadAction:p,imageSx:m,fitContainer:h=!1,droppableData:g,draggableData:x,dropLabel:y,isSelected:b=!1,thumbnail:w=!1,noContentFallback:S=$oe,uploadElement:j=Noe,useThumbailFallback:_,withHoverOverlay:E=!1,children:I,onMouseOver:M,onMouseOut:R,dataTestId:D}=e,{colorMode:A}=ha(),[O,T]=d.useState(!1),X=d.useCallback($=>{M&&M($),T(!0)},[M]),B=d.useCallback($=>{R&&R($),T(!1)},[R]),{getUploadButtonProps:V,getUploadInputProps:U}=Vy({postUploadAction:p,isDisabled:l}),N=l?{}:{cursor:"pointer",bg:Ae("base.200","base.700")(A),_hover:{bg:Ae("base.300","base.650")(A),color:Ae("base.500","base.300")(A)}};return a.jsx(Doe,{imageDTO:t,children:$=>a.jsxs(L,{ref:$,onMouseOver:X,onMouseOut:B,sx:{width:"full",height:"full",alignItems:"center",justifyContent:"center",position:"relative",minW:u||void 0,minH:u||void 0,userSelect:"none",cursor:i||!t?"default":"pointer"},children:[t&&a.jsxs(L,{sx:{w:"full",h:"full",position:h?"absolute":"relative",alignItems:"center",justifyContent:"center"},children:[a.jsx(ga,{src:w?t.thumbnail_url:t.image_url,fallbackStrategy:"beforeLoadOrError",fallbackSrc:_?t.thumbnail_url:void 0,fallback:_?void 0:a.jsx(zne,{image:t}),onError:n,draggable:!1,sx:{w:t.width,objectFit:"contain",maxW:"full",maxH:"full",borderRadius:"base",...m},"data-testid":D}),o&&a.jsx(goe,{imageDTO:t}),a.jsx(Oy,{isSelected:b,isHovered:E?O:!1})]}),!t&&!l&&a.jsx(a.Fragment,{children:a.jsxs(L,{sx:{minH:u,w:"full",h:"full",alignItems:"center",justifyContent:"center",borderRadius:"base",transitionProperty:"common",transitionDuration:"0.1s",color:Ae("base.500","base.500")(A),...N},...V(),children:[a.jsx("input",{...U()}),j]})}),!t&&l&&S,t&&!i&&a.jsx(Toe,{data:x,disabled:i||!t,onClick:r}),I,!s&&a.jsx(My,{data:g,disabled:s,dropLabel:y})]})})},ua=d.memo(Loe),zoe=()=>a.jsx(Gh,{sx:{position:"relative",height:"full",width:"full","::before":{content:"''",display:"block",pt:"100%"}},children:a.jsx(Ie,{sx:{position:"absolute",top:0,insetInlineStart:0,height:"full",width:"full"}})}),Foe=d.memo(zoe),Boe=le([xe,Qx],({gallery:e},t)=>{const n=e.selection;return{queryArgs:t,selection:n}},Se),Hoe=e=>{const t=te(),{queryArgs:n,selection:r}=W(Boe),{imageDTOs:o}=vI(n,{selectFromResult:p=>({imageDTOs:p.data?BD.selectAll(p.data):[]})}),s=Bt("multiselect").isFeatureEnabled,i=d.useCallback(p=>{var m;if(e){if(!s){t(yu([e]));return}if(p.shiftKey){const h=e.image_name,g=(m=r[r.length-1])==null?void 0:m.image_name,x=o.findIndex(b=>b.image_name===g),y=o.findIndex(b=>b.image_name===h);if(x>-1&&y>-1){const b=Math.min(x,y),w=Math.max(x,y),S=o.slice(b,w+1);t(yu(Kw(r.concat(S))))}}else p.ctrlKey||p.metaKey?r.some(h=>h.image_name===e.image_name)&&r.length>1?t(yu(r.filter(h=>h.image_name!==e.image_name))):t(yu(Kw(r.concat(e)))):t(yu([e]))}},[t,e,o,r,s]),l=d.useMemo(()=>e?r.some(p=>p.image_name===e.image_name):!1,[e,r]),u=d.useMemo(()=>r.length,[r.length]);return{selection:r,selectionCount:u,isSelected:l,handleClick:i}},Voe=e=>{const{onClick:t,tooltip:n,icon:r,styleOverrides:o}=e,s=sa("drop-shadow(0px 0px 0.1rem var(--invokeai-colors-base-600))","drop-shadow(0px 0px 0.1rem var(--invokeai-colors-base-800))");return a.jsx(Fe,{onClick:t,"aria-label":n,tooltip:n,icon:r,size:"sm",variant:"link",sx:{position:"absolute",top:1,insetInlineEnd:1,p:0,minW:0,svg:{transitionProperty:"common",transitionDuration:"normal",fill:"base.100",_hover:{fill:"base.50"},filter:s},...o},"data-testid":n})},zi=d.memo(Voe),Woe=e=>{const t=te(),{imageName:n}=e,{currentData:r}=to(n),o=W(M=>M.hotkeys.shift),{t:s}=Z(),{handleClick:i,isSelected:l,selection:u,selectionCount:p}=Hoe(r),m=Jh(Ux),h=d.useCallback(M=>{M.stopPropagation(),r&&t(xh([r]))},[t,r]),g=d.useMemo(()=>{if(p>1)return{id:"gallery-image",payloadType:"IMAGE_DTOS",payload:{imageDTOs:u}};if(r)return{id:"gallery-image",payloadType:"IMAGE_DTO",payload:{imageDTO:r}}},[r,u,p]),[x]=Kx(),[y]=qx(),b=d.useCallback(()=>{r&&(r.starred&&y({imageDTOs:[r]}),r.starred||x({imageDTOs:[r]}))},[x,y,r]),[w,S]=d.useState(!1),j=d.useCallback(()=>{S(!0)},[]),_=d.useCallback(()=>{S(!1)},[]),E=d.useMemo(()=>{if(r!=null&&r.starred)return m?m.on.icon:a.jsx(Gy,{size:"20"});if(!(r!=null&&r.starred)&&w)return m?m.off.icon:a.jsx(Uy,{size:"20"})},[r==null?void 0:r.starred,w,m]),I=d.useMemo(()=>r!=null&&r.starred?m?m.off.text:"Unstar":r!=null&&r.starred?"":m?m.on.text:"Star",[r==null?void 0:r.starred,m]);return r?a.jsx(Ie,{sx:{w:"full",h:"full",touchAction:"none"},"data-testid":`image-${r.image_name}`,children:a.jsx(L,{userSelect:"none",sx:{position:"relative",justifyContent:"center",alignItems:"center",aspectRatio:"1/1"},children:a.jsx(ua,{onClick:i,imageDTO:r,draggableData:g,isSelected:l,minSize:0,imageSx:{w:"full",h:"full"},isDropDisabled:!0,isUploadDisabled:!0,thumbnail:!0,withHoverOverlay:!0,onMouseOver:j,onMouseOut:_,children:a.jsxs(a.Fragment,{children:[a.jsx(zi,{onClick:b,icon:E,tooltip:I}),w&&o&&a.jsx(zi,{onClick:h,icon:a.jsx(Br,{}),tooltip:s("gallery.deleteImage"),styleOverrides:{bottom:2,top:"auto"}})]})})})}):a.jsx(Foe,{})},Uoe=d.memo(Woe),Goe=je((e,t)=>a.jsx(Ie,{className:"item-container",ref:t,p:1.5,"data-testid":"image-item-container",children:e.children})),Koe=d.memo(Goe),qoe=je((e,t)=>{const n=W(r=>r.gallery.galleryImageMinimumWidth);return a.jsx(Ja,{...e,className:"list-container",ref:t,sx:{gridTemplateColumns:`repeat(auto-fill, minmax(${n}px, 1fr));`},"data-testid":"image-list-container",children:e.children})}),Xoe=d.memo(qoe),Qoe={defer:!0,options:{scrollbars:{visibility:"auto",autoHide:"scroll",autoHideDelay:1300,theme:"os-theme-dark"},overflow:{x:"hidden"}}},Yoe=()=>{const{t:e}=Z(),t=d.useRef(null),[n,r]=d.useState(null),[o,s]=Ey(Qoe),i=W(w=>w.gallery.selectedBoardId),{currentViewTotal:l}=moe(i),u=W(Qx),{currentData:p,isFetching:m,isSuccess:h,isError:g}=vI(u),[x]=xI(),y=d.useMemo(()=>!p||!l?!1:p.ids.length{y&&x({...u,offset:(p==null?void 0:p.ids.length)??0,limit:bI})},[y,x,u,p==null?void 0:p.ids.length]);return d.useEffect(()=>{const{current:w}=t;return n&&w&&o({target:w,elements:{viewport:n}}),()=>{var S;return(S=s())==null?void 0:S.destroy()}},[n,o,s]),p?h&&(p==null?void 0:p.ids.length)===0?a.jsx(L,{sx:{w:"full",h:"full",alignItems:"center",justifyContent:"center"},children:a.jsx(Zn,{label:e("gallery.noImagesInGallery"),icon:Yi})}):h&&p?a.jsxs(a.Fragment,{children:[a.jsx(Ie,{ref:t,"data-overlayscrollbars":"",h:"100%",children:a.jsx(poe,{style:{height:"100%"},data:p.ids,endReached:b,components:{Item:Koe,List:Xoe},scrollerRef:r,itemContent:(w,S)=>a.jsx(Uoe,{imageName:S},S)})}),a.jsx(at,{onClick:b,isDisabled:!y,isLoading:m,loadingText:e("gallery.loading"),flexShrink:0,children:`Load More (${p.ids.length} of ${l})`})]}):g?a.jsx(Ie,{sx:{w:"full",h:"full"},children:a.jsx(Zn,{label:e("gallery.unableToLoad"),icon:zJ})}):null:a.jsx(L,{sx:{w:"full",h:"full",alignItems:"center",justifyContent:"center"},children:a.jsx(Zn,{label:e("gallery.loading"),icon:Yi})})},Zoe=d.memo(Yoe),Joe=le([xe],e=>{const{galleryView:t}=e.gallery;return{galleryView:t}},Se),ese=()=>{const e=d.useRef(null),t=d.useRef(null),{galleryView:n}=W(Joe),r=te(),{isOpen:o,onToggle:s}=Lr({defaultIsOpen:!0}),i=d.useCallback(()=>{r(mw("images"))},[r]),l=d.useCallback(()=>{r(mw("assets"))},[r]);return a.jsxs(m3,{layerStyle:"first",sx:{flexDirection:"column",h:"full",w:"full",borderRadius:"base",p:2},children:[a.jsxs(Ie,{sx:{w:"full"},children:[a.jsxs(L,{ref:e,sx:{alignItems:"center",justifyContent:"space-between",gap:2},children:[a.jsx(Ene,{isOpen:o,onToggle:s}),a.jsx(Lne,{})]}),a.jsx(Ie,{children:a.jsx(_ne,{isOpen:o})})]}),a.jsxs(L,{ref:t,direction:"column",gap:2,h:"full",w:"full",children:[a.jsx(L,{sx:{alignItems:"center",justifyContent:"space-between",gap:2},children:a.jsx(rl,{index:n==="images"?0:1,variant:"unstyled",size:"sm",sx:{w:"full"},children:a.jsx(ol,{children:a.jsxs(Vt,{isAttached:!0,sx:{w:"full"},children:[a.jsx(Tr,{as:at,size:"sm",isChecked:n==="images",onClick:i,sx:{w:"full"},leftIcon:a.jsx(KJ,{}),"data-testid":"images-tab",children:"Images"}),a.jsx(Tr,{as:at,size:"sm",isChecked:n==="assets",onClick:l,sx:{w:"full"},leftIcon:a.jsx(see,{}),"data-testid":"assets-tab",children:"Assets"})]})})})}),a.jsx(Zoe,{})]})]})},tse=d.memo(ese),nse=()=>{const e=W(p=>p.system.isConnected),{data:t}=va(),[n,{isLoading:r}]=Yx(),o=te(),{t:s}=Z(),i=d.useMemo(()=>t==null?void 0:t.queue.item_id,[t==null?void 0:t.queue.item_id]),l=d.useCallback(async()=>{if(i)try{await n(i).unwrap(),o(ct({title:s("queue.cancelSucceeded"),status:"success"}))}catch{o(ct({title:s("queue.cancelFailed"),status:"error"}))}},[i,o,s,n]),u=d.useMemo(()=>!e||n$(i),[e,i]);return{cancelQueueItem:l,isLoading:r,currentQueueItemId:i,isDisabled:u}},rse=({label:e,tooltip:t,icon:n,onClick:r,isDisabled:o,colorScheme:s,asIconButton:i,isLoading:l,loadingText:u,sx:p})=>i?a.jsx(Fe,{"aria-label":e,tooltip:t,icon:n,onClick:r,isDisabled:o,colorScheme:s,isLoading:l,sx:p,"data-testid":e}):a.jsx(at,{"aria-label":e,tooltip:t,leftIcon:n,onClick:r,isDisabled:o,colorScheme:s,isLoading:l,loadingText:u??e,flexGrow:1,sx:p,"data-testid":e,children:e}),ul=d.memo(rse),ose=({asIconButton:e,sx:t})=>{const{t:n}=Z(),{cancelQueueItem:r,isLoading:o,isDisabled:s}=nse();return a.jsx(ul,{isDisabled:s,isLoading:o,asIconButton:e,label:n("queue.cancel"),tooltip:n("queue.cancelTooltip"),icon:a.jsx(Ic,{}),onClick:r,colorScheme:"error",sx:t})},H8=d.memo(ose),sse=()=>{const{t:e}=Z(),t=te(),{data:n}=va(),r=W(u=>u.system.isConnected),[o,{isLoading:s}]=yI({fixedCacheKey:"clearQueue"}),i=d.useCallback(async()=>{if(n!=null&&n.queue.total)try{await o().unwrap(),t(ct({title:e("queue.clearSucceeded"),status:"success"})),t(Zx(void 0)),t(Jx(void 0))}catch{t(ct({title:e("queue.clearFailed"),status:"error"}))}},[n==null?void 0:n.queue.total,o,t,e]),l=d.useMemo(()=>!r||!(n!=null&&n.queue.total),[r,n==null?void 0:n.queue.total]);return{clearQueue:i,isLoading:s,queueStatus:n,isDisabled:l}},ase=je((e,t)=>{const{t:n}=Z(),{acceptButtonText:r=n("common.accept"),acceptCallback:o,cancelButtonText:s=n("common.cancel"),cancelCallback:i,children:l,title:u,triggerComponent:p}=e,{isOpen:m,onOpen:h,onClose:g}=Lr(),x=d.useRef(null),y=()=>{o(),g()},b=()=>{i&&i(),g()};return a.jsxs(a.Fragment,{children:[d.cloneElement(p,{onClick:h,ref:t}),a.jsx(Td,{isOpen:m,leastDestructiveRef:x,onClose:g,isCentered:!0,children:a.jsx(Yo,{children:a.jsxs(Nd,{children:[a.jsx(Qo,{fontSize:"lg",fontWeight:"bold",children:u}),a.jsx(Zo,{children:l}),a.jsxs(Ss,{children:[a.jsx(at,{ref:x,onClick:b,children:s}),a.jsx(at,{colorScheme:"error",onClick:y,ml:3,children:r})]})]})})})]})}),kg=d.memo(ase),ise=({asIconButton:e,sx:t})=>{const{t:n}=Z(),{clearQueue:r,isLoading:o,isDisabled:s}=sse();return a.jsxs(kg,{title:n("queue.clearTooltip"),acceptCallback:r,acceptButtonText:n("queue.clear"),triggerComponent:a.jsx(ul,{isDisabled:s,isLoading:o,asIconButton:e,label:n("queue.clear"),tooltip:n("queue.clearTooltip"),icon:a.jsx(Br,{}),colorScheme:"error",sx:t}),children:[a.jsx(ve,{children:n("queue.clearQueueAlertDialog")}),a.jsx("br",{}),a.jsx(ve,{children:n("queue.clearQueueAlertDialog2")})]})},qy=d.memo(ise),lse=()=>{const e=te(),{t}=Z(),n=W(p=>p.system.isConnected),{data:r}=va(),[o,{isLoading:s}]=CI({fixedCacheKey:"pauseProcessor"}),i=d.useMemo(()=>!!(r!=null&&r.processor.is_started),[r==null?void 0:r.processor.is_started]),l=d.useCallback(async()=>{if(i)try{await o().unwrap(),e(ct({title:t("queue.pauseSucceeded"),status:"success"}))}catch{e(ct({title:t("queue.pauseFailed"),status:"error"}))}},[i,o,e,t]),u=d.useMemo(()=>!n||!i,[n,i]);return{pauseProcessor:l,isLoading:s,isStarted:i,isDisabled:u}},cse=({asIconButton:e})=>{const{t}=Z(),{pauseProcessor:n,isLoading:r,isDisabled:o}=lse();return a.jsx(ul,{asIconButton:e,label:t("queue.pause"),tooltip:t("queue.pauseTooltip"),isDisabled:o,isLoading:r,icon:a.jsx(JJ,{}),onClick:n,colorScheme:"gold"})},V8=d.memo(cse),use=le([xe,Jn],({controlNet:e,generation:t,system:n,nodes:r,dynamicPrompts:o},s)=>{const{initialImage:i,model:l}=t,{isConnected:u}=n,p=[];return u||p.push(yt.t("parameters.invoke.systemDisconnected")),s==="img2img"&&!i&&p.push(yt.t("parameters.invoke.noInitialImageSelected")),s==="nodes"?r.shouldValidateGraph&&(r.nodes.length||p.push(yt.t("parameters.invoke.noNodesInGraph")),r.nodes.forEach(m=>{if(!On(m))return;const h=r.nodeTemplates[m.data.type];if(!h){p.push(yt.t("parameters.invoke.missingNodeTemplate"));return}const g=HD([m],r.edges);Rn(m.data.inputs,x=>{const y=h.inputs[x.name],b=g.some(w=>w.target===m.id&&w.targetHandle===x.name);if(!y){p.push(yt.t("parameters.invoke.missingFieldTemplate"));return}if(y.required&&x.value===void 0&&!b){p.push(yt.t("parameters.invoke.missingInputForField",{nodeLabel:m.data.label||h.title,fieldLabel:x.label||y.title}));return}})})):(o.prompts.length===0&&p.push(yt.t("parameters.invoke.noPrompts")),l||p.push(yt.t("parameters.invoke.noModelSelected")),e.isEnabled&&nr(e.controlNets).forEach((m,h)=>{m.isEnabled&&(m.model||p.push(yt.t("parameters.invoke.noModelForControlNet",{index:h+1})),(!m.controlImage||!m.processedControlImage&&m.processorType!=="none")&&p.push(yt.t("parameters.invoke.noControlImageForControlNet",{index:h+1})))})),{isReady:!p.length,reasons:p}},Se),Xy=()=>{const{isReady:e,reasons:t}=W(use);return{isReady:e,reasons:t}},W8=()=>{const e=te(),t=W(Jn),{isReady:n}=Xy(),[r,{isLoading:o}]=bh({fixedCacheKey:"enqueueBatch"}),s=d.useMemo(()=>!n,[n]);return{queueBack:d.useCallback(()=>{s||(e(eb()),e(wI({tabName:t,prepend:!1})))},[e,s,t]),isLoading:o,isDisabled:s}},dse=le([xe],({gallery:e})=>{const{autoAddBoardId:t}=e;return{autoAddBoardId:t}},Se),fse=({prepend:e=!1})=>{const{t}=Z(),{isReady:n,reasons:r}=Xy(),{autoAddBoardId:o}=W(dse),s=vg(o),[i,{isLoading:l}]=bh({fixedCacheKey:"enqueueBatch"}),u=d.useMemo(()=>t(l?"queue.enqueueing":n?e?"queue.queueFront":"queue.queueBack":"queue.notReady"),[l,n,e,t]);return a.jsxs(L,{flexDir:"column",gap:1,children:[a.jsx(ve,{fontWeight:600,children:u}),r.length>0&&a.jsx(Od,{children:r.map((p,m)=>a.jsx(Qr,{children:a.jsx(ve,{fontWeight:400,children:p})},`${p}.${m}`))}),a.jsx(G8,{}),a.jsxs(ve,{fontWeight:400,fontStyle:"oblique 10deg",children:["Adding images to"," ",a.jsx(ve,{as:"span",fontWeight:600,children:s||"Uncategorized"})]})]})},U8=d.memo(fse),G8=d.memo(()=>a.jsx(Yn,{opacity:.2,borderColor:"base.50",_dark:{borderColor:"base.900"}}));G8.displayName="StyledDivider";const pse=()=>a.jsx(Ie,{pos:"relative",w:4,h:4,children:a.jsx(ga,{src:Hx,alt:"invoke-ai-logo",pos:"absolute",top:-.5,insetInlineStart:-.5,w:5,h:5,minW:5,minH:5,filter:"saturate(0)"})}),mse=d.memo(pse),hse=({asIconButton:e,sx:t})=>{const{t:n}=Z(),{queueBack:r,isLoading:o,isDisabled:s}=W8();return a.jsx(ul,{asIconButton:e,colorScheme:"accent",label:n("parameters.invoke.invoke"),isDisabled:s,isLoading:o,onClick:r,tooltip:a.jsx(U8,{}),sx:t,icon:e?a.jsx(mse,{}):void 0})},K8=d.memo(hse),q8=()=>{const e=te(),t=W(Jn),{isReady:n}=Xy(),[r,{isLoading:o}]=bh({fixedCacheKey:"enqueueBatch"}),s=Bt("prependQueue").isFeatureEnabled,i=d.useMemo(()=>!n||!s,[n,s]);return{queueFront:d.useCallback(()=>{i||(e(eb()),e(wI({tabName:t,prepend:!0})))},[e,i,t]),isLoading:o,isDisabled:i}},gse=({asIconButton:e,sx:t})=>{const{t:n}=Z(),{queueFront:r,isLoading:o,isDisabled:s}=q8();return a.jsx(ul,{asIconButton:e,colorScheme:"base",label:n("queue.queueFront"),isDisabled:s,isLoading:o,onClick:r,tooltip:a.jsx(U8,{prepend:!0}),icon:a.jsx(boe,{}),sx:t})},vse=d.memo(gse),xse=()=>{const e=te(),t=W(p=>p.system.isConnected),{data:n}=va(),{t:r}=Z(),[o,{isLoading:s}]=SI({fixedCacheKey:"resumeProcessor"}),i=d.useMemo(()=>!!(n!=null&&n.processor.is_started),[n==null?void 0:n.processor.is_started]),l=d.useCallback(async()=>{if(!i)try{await o().unwrap(),e(ct({title:r("queue.resumeSucceeded"),status:"success"}))}catch{e(ct({title:r("queue.resumeFailed"),status:"error"}))}},[i,o,e,r]),u=d.useMemo(()=>!t||i,[t,i]);return{resumeProcessor:l,isLoading:s,isStarted:i,isDisabled:u}},bse=({asIconButton:e})=>{const{t}=Z(),{resumeProcessor:n,isLoading:r,isDisabled:o}=xse();return a.jsx(ul,{asIconButton:e,label:t("queue.resume"),tooltip:t("queue.resumeTooltip"),isDisabled:o,isLoading:r,icon:a.jsx(eee,{}),onClick:n,colorScheme:"green"})},X8=d.memo(bse),yse=le(xe,({system:e})=>{var t;return{isConnected:e.isConnected,hasSteps:!!e.denoiseProgress,value:(((t=e.denoiseProgress)==null?void 0:t.percentage)??0)*100}},Se),Cse=()=>{const{t:e}=Z(),{data:t}=va(),{hasSteps:n,value:r,isConnected:o}=W(yse);return a.jsx(K3,{value:r,"aria-label":e("accessibility.invokeProgressBar"),isIndeterminate:o&&!!(t!=null&&t.queue.in_progress)&&!n,h:"full",w:"full",borderRadius:2,colorScheme:"accent"})},wse=d.memo(Cse),Sse=()=>{const e=Bt("pauseQueue").isFeatureEnabled,t=Bt("resumeQueue").isFeatureEnabled,n=Bt("prependQueue").isFeatureEnabled;return a.jsxs(L,{layerStyle:"first",sx:{w:"full",position:"relative",borderRadius:"base",p:2,gap:2,flexDir:"column"},children:[a.jsxs(L,{gap:2,w:"full",children:[a.jsxs(Vt,{isAttached:!0,flexGrow:2,children:[a.jsx(K8,{}),n?a.jsx(vse,{asIconButton:!0}):a.jsx(a.Fragment,{}),a.jsx(H8,{asIconButton:!0})]}),a.jsxs(Vt,{isAttached:!0,children:[t?a.jsx(X8,{asIconButton:!0}):a.jsx(a.Fragment,{}),e?a.jsx(V8,{asIconButton:!0}):a.jsx(a.Fragment,{})]}),a.jsx(qy,{asIconButton:!0})]}),a.jsx(L,{h:3,w:"full",children:a.jsx(wse,{})}),a.jsx(Y8,{})]})},Q8=d.memo(Sse),Y8=d.memo(()=>{const{t:e}=Z(),t=te(),{hasItems:n,pending:r}=va(void 0,{selectFromResult:({data:s})=>{if(!s)return{hasItems:!1,pending:0};const{pending:i,in_progress:l}=s.queue;return{hasItems:i+l>0,pending:i}}}),o=d.useCallback(()=>{t(Xs("queue"))},[t]);return a.jsxs(L,{justifyContent:"space-between",alignItems:"center",pe:1,"data-testid":"queue-count",children:[a.jsx(ba,{}),a.jsx(Za,{onClick:o,size:"sm",variant:"link",fontWeight:400,opacity:.7,fontStyle:"oblique 10deg",children:n?e("queue.queuedCount",{pending:r}):e("queue.queueEmpty")})]})});Y8.displayName="QueueCounts";const{createElement:Ec,createContext:kse,forwardRef:Z8,useCallback:Gs,useContext:J8,useEffect:oa,useImperativeHandle:eO,useLayoutEffect:jse,useMemo:_se,useRef:Kr,useState:Wu}=Fx,Uj=Fx["useId".toString()],Uu=jse,Ise=typeof Uj=="function"?Uj:()=>null;let Pse=0;function Qy(e=null){const t=Ise(),n=Kr(e||t||null);return n.current===null&&(n.current=""+Pse++),n.current}const jg=kse(null);jg.displayName="PanelGroupContext";function tO({children:e=null,className:t="",collapsedSize:n=0,collapsible:r=!1,defaultSize:o=null,forwardedRef:s,id:i=null,maxSize:l=null,minSize:u,onCollapse:p=null,onResize:m=null,order:h=null,style:g={},tagName:x="div"}){const y=J8(jg);if(y===null)throw Error("Panel components must be rendered within a PanelGroup container");const b=Qy(i),{collapsePanel:w,expandPanel:S,getPanelSize:j,getPanelStyle:_,registerPanel:E,resizePanel:I,units:M,unregisterPanel:R}=y;u==null&&(M==="percentages"?u=10:u=0);const D=Kr({onCollapse:p,onResize:m});oa(()=>{D.current.onCollapse=p,D.current.onResize=m});const A=_(b,o),O=Kr({size:Gj(A)}),T=Kr({callbacksRef:D,collapsedSize:n,collapsible:r,defaultSize:o,id:b,idWasAutoGenerated:i==null,maxSize:l,minSize:u,order:h});return Uu(()=>{O.current.size=Gj(A),T.current.callbacksRef=D,T.current.collapsedSize=n,T.current.collapsible=r,T.current.defaultSize=o,T.current.id=b,T.current.idWasAutoGenerated=i==null,T.current.maxSize=l,T.current.minSize=u,T.current.order=h}),Uu(()=>(E(b,T),()=>{R(b)}),[h,b,E,R]),eO(s,()=>({collapse:()=>w(b),expand:()=>S(b),getCollapsed(){return O.current.size===0},getId(){return b},getSize(X){return j(b,X)},resize:(X,B)=>I(b,X,B)}),[w,S,j,b,I]),Ec(x,{children:e,className:t,"data-panel":"","data-panel-collapsible":r||void 0,"data-panel-id":b,"data-panel-size":parseFloat(""+A.flexGrow).toFixed(1),id:`data-panel-id-${b}`,style:{...A,...g}})}const Qa=Z8((e,t)=>Ec(tO,{...e,forwardedRef:t}));tO.displayName="Panel";Qa.displayName="forwardRef(Panel)";function Gj(e){const{flexGrow:t}=e;return typeof t=="string"?parseFloat(t):t}const el=10;function Du(e,t,n,r,o,s,i,l){const{id:u,panels:p,units:m}=t,h=m==="pixels"?Ha(u):NaN,{sizes:g}=l||{},x=g||s,y=Or(p),b=x.concat();let w=0;{const _=o<0?r:n,E=y.findIndex(D=>D.current.id===_),I=y[E],M=x[E],R=Cx(m,h,I,M,M+Math.abs(o),e);if(M===R)return x;R===0&&M>0&&i.set(_,M),o=o<0?M-R:R-M}let S=o<0?n:r,j=y.findIndex(_=>_.current.id===S);for(;;){const _=y[j],E=x[j],I=Math.abs(o)-Math.abs(w),M=Cx(m,h,_,E,E-I,e);if(E!==M&&(M===0&&E>0&&i.set(_.current.id,E),w+=E-M,b[j]=M,w.toPrecision(el).localeCompare(Math.abs(o).toPrecision(el),void 0,{numeric:!0})>=0))break;if(o<0){if(--j<0)break}else if(++j>=y.length)break}return w===0?x:(S=o<0?r:n,j=y.findIndex(_=>_.current.id===S),b[j]=x[j]+w,b)}function Fl(e,t,n){t.forEach((r,o)=>{const s=e[o];if(!s)return;const{callbacksRef:i,collapsedSize:l,collapsible:u,id:p}=s.current,m=n[p];if(m!==r){n[p]=r;const{onCollapse:h,onResize:g}=i.current;g&&g(r,m),u&&h&&((m==null||m===l)&&r!==l?h(!1):m!==l&&r===l&&h(!0))}})}function Ese({groupId:e,panels:t,units:n}){const r=n==="pixels"?Ha(e):NaN,o=Or(t),s=Array(o.length);let i=0,l=100;for(let u=0;ui.current.id===e);if(n<0)return[null,null];const r=n===t.length-1,o=r?t[n-1].current.id:e,s=r?e:t[n+1].current.id;return[o,s]}function Ha(e){const t=md(e);if(t==null)return NaN;const n=t.getAttribute("data-panel-group-direction"),r=Yy(e);return n==="horizontal"?t.offsetWidth-r.reduce((o,s)=>o+s.offsetWidth,0):t.offsetHeight-r.reduce((o,s)=>o+s.offsetHeight,0)}function nO(e,t,n){if(e.size===1)return"100";const o=Or(e).findIndex(i=>i.current.id===t),s=n[o];return s==null?"0":s.toPrecision(el)}function Mse(e){const t=document.querySelector(`[data-panel-id="${e}"]`);return t||null}function md(e){const t=document.querySelector(`[data-panel-group-id="${e}"]`);return t||null}function _g(e){const t=document.querySelector(`[data-panel-resize-handle-id="${e}"]`);return t||null}function Ose(e){return rO().findIndex(r=>r.getAttribute("data-panel-resize-handle-id")===e)??null}function rO(){return Array.from(document.querySelectorAll("[data-panel-resize-handle-id]"))}function Yy(e){return Array.from(document.querySelectorAll(`[data-panel-resize-handle-id][data-panel-group-id="${e}"]`))}function Zy(e,t,n){var u,p,m,h;const r=_g(t),o=Yy(e),s=r?o.indexOf(r):-1,i=((p=(u=n[s])==null?void 0:u.current)==null?void 0:p.id)??null,l=((h=(m=n[s+1])==null?void 0:m.current)==null?void 0:h.id)??null;return[i,l]}function Or(e){return Array.from(e.values()).sort((t,n)=>{const r=t.current.order,o=n.current.order;return r==null&&o==null?0:r==null?-1:o==null?1:r-o})}function Cx(e,t,n,r,o,s=null){var m;let{collapsedSize:i,collapsible:l,maxSize:u,minSize:p}=n.current;if(e==="pixels"&&(i=i/t*100,u!=null&&(u=u/t*100),p=p/t*100),l){if(r>i){if(o<=p/2+i)return i}else if(!((m=s==null?void 0:s.type)==null?void 0:m.startsWith("key"))&&o100)&&(t.current.minSize=0),o!=null&&(o<0||e==="percentages"&&o>100)&&(t.current.maxSize=null),r!==null&&(r<0||e==="percentages"&&r>100?t.current.defaultSize=null:ro&&(t.current.defaultSize=o))}function Gv({groupId:e,panels:t,nextSizes:n,prevSizes:r,units:o}){n=[...n];const s=Or(t),i=o==="pixels"?Ha(e):NaN;let l=0;for(let u=0;u{const{direction:i,panels:l}=e.current,u=md(t);oO(u!=null,`No group found for id "${t}"`);const{height:p,width:m}=u.getBoundingClientRect(),g=Yy(t).map(x=>{const y=x.getAttribute("data-panel-resize-handle-id"),b=Or(l),[w,S]=Zy(t,y,b);if(w==null||S==null)return()=>{};let j=0,_=100,E=0,I=0;b.forEach(T=>{const{id:X,maxSize:B,minSize:V}=T.current;X===w?(j=V,_=B??100):(E+=V,I+=B??100)});const M=Math.min(_,100-E),R=Math.max(j,(b.length-1)*100-I),D=nO(l,w,o);x.setAttribute("aria-valuemax",""+Math.round(M)),x.setAttribute("aria-valuemin",""+Math.round(R)),x.setAttribute("aria-valuenow",""+Math.round(parseInt(D)));const A=T=>{if(!T.defaultPrevented)switch(T.key){case"Enter":{T.preventDefault();const X=b.findIndex(B=>B.current.id===w);if(X>=0){const B=b[X],V=o[X];if(V!=null){let U=0;V.toPrecision(el)<=B.current.minSize.toPrecision(el)?U=i==="horizontal"?m:p:U=-(i==="horizontal"?m:p);const N=Du(T,e.current,w,S,U,o,s.current,null);o!==N&&r(N)}}break}}};x.addEventListener("keydown",A);const O=Mse(w);return O!=null&&x.setAttribute("aria-controls",O.id),()=>{x.removeAttribute("aria-valuemax"),x.removeAttribute("aria-valuemin"),x.removeAttribute("aria-valuenow"),x.removeEventListener("keydown",A),O!=null&&x.removeAttribute("aria-controls")}});return()=>{g.forEach(x=>x())}},[e,t,n,s,r,o])}function Ase({disabled:e,handleId:t,resizeHandler:n}){oa(()=>{if(e||n==null)return;const r=_g(t);if(r==null)return;const o=s=>{if(!s.defaultPrevented)switch(s.key){case"ArrowDown":case"ArrowLeft":case"ArrowRight":case"ArrowUp":case"End":case"Home":{s.preventDefault(),n(s);break}case"F6":{s.preventDefault();const i=rO(),l=Ose(t);oO(l!==null);const u=s.shiftKey?l>0?l-1:i.length-1:l+1{r.removeEventListener("keydown",o)}},[e,t,n])}function Kv(e,t){if(e.length!==t.length)return!1;for(let n=0;nR.current.id===E),M=r[I];if(M.current.collapsible){const R=m[I];(R===0||R.toPrecision(el)===M.current.minSize.toPrecision(el))&&(S=S<0?-M.current.minSize*y:M.current.minSize*y)}return S}else return sO(e,n,o,l,u)}function Nse(e){return e.type==="keydown"}function wx(e){return e.type.startsWith("mouse")}function Sx(e){return e.type.startsWith("touch")}let kx=null,Oi=null;function aO(e){switch(e){case"horizontal":return"ew-resize";case"horizontal-max":return"w-resize";case"horizontal-min":return"e-resize";case"vertical":return"ns-resize";case"vertical-max":return"n-resize";case"vertical-min":return"s-resize"}}function $se(){Oi!==null&&(document.head.removeChild(Oi),kx=null,Oi=null)}function qv(e){if(kx===e)return;kx=e;const t=aO(e);Oi===null&&(Oi=document.createElement("style"),document.head.appendChild(Oi)),Oi.innerHTML=`*{cursor: ${t}!important;}`}function Lse(e,t=10){let n=null;return(...o)=>{n!==null&&clearTimeout(n),n=setTimeout(()=>{e(...o)},t)}}function iO(e){return e.map(t=>{const{minSize:n,order:r}=t.current;return r?`${r}:${n}`:`${n}`}).sort((t,n)=>t.localeCompare(n)).join(",")}function lO(e,t){try{const n=t.getItem(`PanelGroup:sizes:${e}`);if(n){const r=JSON.parse(n);if(typeof r=="object"&&r!=null)return r}}catch{}return null}function zse(e,t,n){const r=lO(e,n);if(r){const o=iO(t);return r[o]??null}return null}function Fse(e,t,n,r){const o=iO(t),s=lO(e,r)||{};s[o]=n;try{r.setItem(`PanelGroup:sizes:${e}`,JSON.stringify(s))}catch(i){console.error(i)}}const Xv={};function Kj(e){try{if(typeof localStorage<"u")e.getItem=t=>localStorage.getItem(t),e.setItem=(t,n)=>{localStorage.setItem(t,n)};else throw new Error("localStorage not supported in this environment")}catch(t){console.error(t),e.getItem=()=>null,e.setItem=()=>{}}}const Au={getItem:e=>(Kj(Au),Au.getItem(e)),setItem:(e,t)=>{Kj(Au),Au.setItem(e,t)}};function cO({autoSaveId:e,children:t=null,className:n="",direction:r,disablePointerEventsDuringResize:o=!1,forwardedRef:s,id:i=null,onLayout:l,storage:u=Au,style:p={},tagName:m="div",units:h="percentages"}){const g=Qy(i),[x,y]=Wu(null),[b,w]=Wu(new Map),S=Kr(null);Kr({didLogDefaultSizeWarning:!1,didLogIdAndOrderWarning:!1,didLogInvalidLayoutWarning:!1,prevPanelIds:[]});const j=Kr({onLayout:l});oa(()=>{j.current.onLayout=l});const _=Kr({}),[E,I]=Wu([]),M=Kr(new Map),R=Kr(0),D=Kr({direction:r,id:g,panels:b,sizes:E,units:h});eO(s,()=>({getId:()=>g,getLayout:F=>{const{sizes:Q,units:Y}=D.current;if((F??Y)==="pixels"){const ae=Ha(g);return Q.map(re=>re/100*ae)}else return Q},setLayout:(F,Q)=>{const{id:Y,panels:se,sizes:ae,units:re}=D.current;if((Q||re)==="pixels"){const ce=Ha(Y);F=F.map(J=>J/ce*100)}const G=_.current,K=Or(se),ee=Gv({groupId:Y,panels:se,nextSizes:F,prevSizes:ae,units:re});Kv(ae,ee)||(I(ee),Fl(K,ee,G))}}),[g]),Uu(()=>{D.current.direction=r,D.current.id=g,D.current.panels=b,D.current.sizes=E,D.current.units=h}),Dse({committedValuesRef:D,groupId:g,panels:b,setSizes:I,sizes:E,panelSizeBeforeCollapse:M}),oa(()=>{const{onLayout:F}=j.current,{panels:Q,sizes:Y}=D.current;if(Y.length>0){F&&F(Y);const se=_.current,ae=Or(Q);Fl(ae,Y,se)}},[E]),Uu(()=>{const{id:F,sizes:Q,units:Y}=D.current;if(Q.length===b.size)return;let se=null;if(e){const ae=Or(b);se=zse(e,ae,u)}if(se!=null){const ae=Gv({groupId:F,panels:b,nextSizes:se,prevSizes:se,units:Y});I(ae)}else{const ae=Ese({groupId:F,panels:b,units:Y});I(ae)}},[e,b,u]),oa(()=>{if(e){if(E.length===0||E.length!==b.size)return;const F=Or(b);Xv[e]||(Xv[e]=Lse(Fse,100)),Xv[e](e,F,E,u)}},[e,b,E,u]),Uu(()=>{if(h==="pixels"){const F=new ResizeObserver(()=>{const{panels:Q,sizes:Y}=D.current,se=Gv({groupId:g,panels:Q,nextSizes:Y,prevSizes:Y,units:h});Kv(Y,se)||I(se)});return F.observe(md(g)),()=>{F.disconnect()}}},[g,h]);const A=Gs((F,Q)=>{const{panels:Y,units:se}=D.current,re=Or(Y).findIndex(ee=>ee.current.id===F),G=E[re];if((Q??se)==="pixels"){const ee=Ha(g);return G/100*ee}else return G},[g,E]),O=Gs((F,Q)=>{const{panels:Y}=D.current;return Y.size===0?{flexBasis:0,flexGrow:Q??void 0,flexShrink:1,overflow:"hidden"}:{flexBasis:0,flexGrow:nO(Y,F,E),flexShrink:1,overflow:"hidden",pointerEvents:o&&x!==null?"none":void 0}},[x,o,E]),T=Gs((F,Q)=>{const{units:Y}=D.current;Rse(Y,Q),w(se=>{if(se.has(F))return se;const ae=new Map(se);return ae.set(F,Q),ae})},[]),X=Gs(F=>Y=>{Y.preventDefault();const{direction:se,panels:ae,sizes:re}=D.current,G=Or(ae),[K,ee]=Zy(g,F,G);if(K==null||ee==null)return;let ce=Tse(Y,g,F,G,se,re,S.current);if(ce===0)return;const ie=md(g).getBoundingClientRect(),de=se==="horizontal";document.dir==="rtl"&&de&&(ce=-ce);const ge=de?ie.width:ie.height,Ce=ce/ge*100,he=Du(Y,D.current,K,ee,Ce,re,M.current,S.current),fe=!Kv(re,he);if((wx(Y)||Sx(Y))&&R.current!=Ce&&qv(fe?de?"horizontal":"vertical":de?ce<0?"horizontal-min":"horizontal-max":ce<0?"vertical-min":"vertical-max"),fe){const Oe=_.current;I(he),Fl(G,he,Oe)}R.current=Ce},[g]),B=Gs(F=>{w(Q=>{if(!Q.has(F))return Q;const Y=new Map(Q);return Y.delete(F),Y})},[]),V=Gs(F=>{const{panels:Q,sizes:Y}=D.current,se=Q.get(F);if(se==null)return;const{collapsedSize:ae,collapsible:re}=se.current;if(!re)return;const G=Or(Q),K=G.indexOf(se);if(K<0)return;const ee=Y[K];if(ee===ae)return;M.current.set(F,ee);const[ce,J]=Uv(F,G);if(ce==null||J==null)return;const de=K===G.length-1?ee:ae-ee,ge=Du(null,D.current,ce,J,de,Y,M.current,null);if(Y!==ge){const Ce=_.current;I(ge),Fl(G,ge,Ce)}},[]),U=Gs(F=>{const{panels:Q,sizes:Y}=D.current,se=Q.get(F);if(se==null)return;const{collapsedSize:ae,minSize:re}=se.current,G=M.current.get(F)||re;if(!G)return;const K=Or(Q),ee=K.indexOf(se);if(ee<0||Y[ee]!==ae)return;const[J,ie]=Uv(F,K);if(J==null||ie==null)return;const ge=ee===K.length-1?ae-G:G,Ce=Du(null,D.current,J,ie,ge,Y,M.current,null);if(Y!==Ce){const he=_.current;I(Ce),Fl(K,Ce,he)}},[]),N=Gs((F,Q,Y)=>{const{id:se,panels:ae,sizes:re,units:G}=D.current;if((Y||G)==="pixels"){const nt=Ha(se);Q=Q/nt*100}const K=ae.get(F);if(K==null)return;let{collapsedSize:ee,collapsible:ce,maxSize:J,minSize:ie}=K.current;if(G==="pixels"){const nt=Ha(se);ie=ie/nt*100,J!=null&&(J=J/nt*100)}const de=Or(ae),ge=de.indexOf(K);if(ge<0)return;const Ce=re[ge];if(Ce===Q)return;ce&&Q===ee||(Q=Math.min(J??100,Math.max(ie,Q)));const[he,fe]=Uv(F,de);if(he==null||fe==null)return;const _e=ge===de.length-1?Ce-Q:Q-Ce,Ne=Du(null,D.current,he,fe,_e,re,M.current,null);if(re!==Ne){const nt=_.current;I(Ne),Fl(de,Ne,nt)}},[]),$=_se(()=>({activeHandleId:x,collapsePanel:V,direction:r,expandPanel:U,getPanelSize:A,getPanelStyle:O,groupId:g,registerPanel:T,registerResizeHandle:X,resizePanel:N,startDragging:(F,Q)=>{if(y(F),wx(Q)||Sx(Q)){const Y=_g(F);S.current={dragHandleRect:Y.getBoundingClientRect(),dragOffset:sO(Q,F,r),sizes:D.current.sizes}}},stopDragging:()=>{$se(),y(null),S.current=null},units:h,unregisterPanel:B}),[x,V,r,U,A,O,g,T,X,N,h,B]),q={display:"flex",flexDirection:r==="horizontal"?"row":"column",height:"100%",overflow:"hidden",width:"100%"};return Ec(jg.Provider,{children:Ec(m,{children:t,className:n,"data-panel-group":"","data-panel-group-direction":r,"data-panel-group-id":g,"data-panel-group-units":h,style:{...q,...p}}),value:$})}const Ig=Z8((e,t)=>Ec(cO,{...e,forwardedRef:t}));cO.displayName="PanelGroup";Ig.displayName="forwardRef(PanelGroup)";function jx({children:e=null,className:t="",disabled:n=!1,id:r=null,onDragging:o,style:s={},tagName:i="div"}){const l=Kr(null),u=Kr({onDragging:o});oa(()=>{u.current.onDragging=o});const p=J8(jg);if(p===null)throw Error("PanelResizeHandle components must be rendered within a PanelGroup container");const{activeHandleId:m,direction:h,groupId:g,registerResizeHandle:x,startDragging:y,stopDragging:b}=p,w=Qy(r),S=m===w,[j,_]=Wu(!1),[E,I]=Wu(null),M=Gs(()=>{l.current.blur(),b();const{onDragging:A}=u.current;A&&A(!1)},[b]);oa(()=>{if(n)I(null);else{const D=x(w);I(()=>D)}},[n,w,x]),oa(()=>{if(n||E==null||!S)return;const D=X=>{E(X)},A=X=>{E(X)},T=l.current.ownerDocument;return T.body.addEventListener("contextmenu",M),T.body.addEventListener("mousemove",D),T.body.addEventListener("touchmove",D),T.body.addEventListener("mouseleave",A),window.addEventListener("mouseup",M),window.addEventListener("touchend",M),()=>{T.body.removeEventListener("contextmenu",M),T.body.removeEventListener("mousemove",D),T.body.removeEventListener("touchmove",D),T.body.removeEventListener("mouseleave",A),window.removeEventListener("mouseup",M),window.removeEventListener("touchend",M)}},[h,n,S,E,M]),Ase({disabled:n,handleId:w,resizeHandler:E});const R={cursor:aO(h),touchAction:"none",userSelect:"none"};return Ec(i,{children:e,className:t,"data-resize-handle-active":S?"pointer":j?"keyboard":void 0,"data-panel-group-direction":h,"data-panel-group-id":g,"data-panel-resize-handle-enabled":!n,"data-panel-resize-handle-id":w,onBlur:()=>_(!1),onFocus:()=>_(!0),onMouseDown:D=>{y(w,D.nativeEvent);const{onDragging:A}=u.current;A&&A(!0)},onMouseUp:M,onTouchCancel:M,onTouchEnd:M,onTouchStart:D=>{y(w,D.nativeEvent);const{onDragging:A}=u.current;A&&A(!0)},ref:l,role:"separator",style:{...R,...s},tabIndex:0})}jx.displayName="PanelResizeHandle";const Bse=e=>{const{direction:t="horizontal",collapsedDirection:n,isCollapsed:r=!1,...o}=e,s=sa("base.100","base.850"),i=sa("base.300","base.700");return t==="horizontal"?a.jsx(jx,{style:{visibility:r?"hidden":"visible",width:r?0:"auto"},children:a.jsx(L,{className:"resize-handle-horizontal",sx:{w:n?2.5:4,h:"full",justifyContent:n?n==="left"?"flex-start":"flex-end":"center",alignItems:"center",div:{bg:s},_hover:{div:{bg:i}}},...o,children:a.jsx(Ie,{sx:{w:1,h:"calc(100% - 1rem)",borderRadius:"base",transitionProperty:"common",transitionDuration:"normal"}})})}):a.jsx(jx,{style:{visibility:r?"hidden":"visible",width:r?0:"auto"},children:a.jsx(L,{className:"resize-handle-vertical",sx:{w:"full",h:n?2.5:4,alignItems:n?n==="top"?"flex-start":"flex-end":"center",justifyContent:"center",div:{bg:s},_hover:{div:{bg:i}}},...o,children:a.jsx(Ie,{sx:{h:1,w:"calc(100% - 1rem)",borderRadius:"base",transitionProperty:"common",transitionDuration:"normal"}})})})},lh=d.memo(Bse),Jy=()=>{const e=te(),t=W(o=>o.ui.panels),n=d.useCallback(o=>t[o]??"",[t]),r=d.useCallback((o,s)=>{e(VD({name:o,value:s}))},[e]);return{getItem:n,setItem:r}};const Hse=e=>{const{label:t,data:n,fileName:r,withDownload:o=!0,withCopy:s=!0}=e,i=d.useMemo(()=>WD(n)?n:JSON.stringify(n,null,2),[n]),l=d.useCallback(()=>{navigator.clipboard.writeText(i)},[i]),u=d.useCallback(()=>{const m=new Blob([i]),h=document.createElement("a");h.href=URL.createObjectURL(m),h.download=`${r||t}.json`,document.body.appendChild(h),h.click(),h.remove()},[i,t,r]),{t:p}=Z();return a.jsxs(L,{layerStyle:"second",sx:{borderRadius:"base",flexGrow:1,w:"full",h:"full",position:"relative"},children:[a.jsx(Ie,{sx:{position:"absolute",top:0,left:0,right:0,bottom:0,overflow:"auto",p:4,fontSize:"sm"},children:a.jsx(hg,{defer:!0,style:{height:"100%",width:"100%"},options:{scrollbars:{visibility:"auto",autoHide:"scroll",autoHideDelay:1300,theme:"os-theme-dark"}},children:a.jsx("pre",{children:i})})}),a.jsxs(L,{sx:{position:"absolute",top:0,insetInlineEnd:0,p:2},children:[o&&a.jsx(Ht,{label:`${p("gallery.download")} ${t} JSON`,children:a.jsx(ys,{"aria-label":`${p("gallery.download")} ${t} JSON`,icon:a.jsx(ig,{}),variant:"ghost",opacity:.7,onClick:u})}),s&&a.jsx(Ht,{label:`${p("gallery.copy")} ${t} JSON`,children:a.jsx(ys,{"aria-label":`${p("gallery.copy")} ${t} JSON`,icon:a.jsx(Hc,{}),variant:"ghost",opacity:.7,onClick:l})})]})]})},Ya=d.memo(Hse),Vse=le(xe,({nodes:e})=>{const t=e.selectedNodes[e.selectedNodes.length-1],n=e.nodes.find(r=>r.id===t);return{data:n==null?void 0:n.data}},Se),Wse=()=>{const{data:e}=W(Vse);return e?a.jsx(Ya,{data:e,label:"Node Data"}):a.jsx(Zn,{label:"No node selected",icon:null})},Use=d.memo(Wse),Gse=({children:e,maxHeight:t})=>a.jsx(L,{sx:{w:"full",h:"full",maxHeight:t,position:"relative"},children:a.jsx(Ie,{sx:{position:"absolute",top:0,left:0,right:0,bottom:0},children:a.jsx(hg,{defer:!0,style:{height:"100%",width:"100%"},options:{scrollbars:{visibility:"auto",autoHide:"scroll",autoHideDelay:1300,theme:"os-theme-dark"},overflow:{x:"hidden"}},children:e})})}),Zd=d.memo(Gse),Kse=({output:e})=>{const{image:t}=e,{data:n}=to(t.image_name);return a.jsx(ua,{imageDTO:n})},qse=d.memo(Kse),Xse=le(xe,({nodes:e})=>{const t=e.selectedNodes[e.selectedNodes.length-1],n=e.nodes.find(s=>s.id===t),r=n?e.nodeTemplates[n.data.type]:void 0,o=e.nodeExecutionStates[t??"__UNKNOWN_NODE__"];return{node:n,template:r,nes:o}},Se),Qse=()=>{const{node:e,template:t,nes:n}=W(Xse),{t:r}=Z();return!e||!n||!On(e)?a.jsx(Zn,{label:r("nodes.noNodeSelected"),icon:null}):n.outputs.length===0?a.jsx(Zn,{label:r("nodes.noOutputRecorded"),icon:null}):a.jsx(Ie,{sx:{position:"relative",w:"full",h:"full"},children:a.jsx(Zd,{children:a.jsx(L,{sx:{position:"relative",flexDir:"column",alignItems:"flex-start",p:1,gap:2,h:"full",w:"full"},children:(t==null?void 0:t.outputType)==="image_output"?n.outputs.map((o,s)=>a.jsx(qse,{output:o},Zse(o,s))):a.jsx(Ya,{data:n.outputs,label:r("nodes.nodeOutputs")})})})})},Yse=d.memo(Qse),Zse=(e,t)=>`${e.type}-${t}`,Jse=le(xe,({nodes:e})=>{const t=e.selectedNodes[e.selectedNodes.length-1],n=e.nodes.find(o=>o.id===t);return{template:n?e.nodeTemplates[n.data.type]:void 0}},Se),eae=()=>{const{template:e}=W(Jse),{t}=Z();return e?a.jsx(Ya,{data:e,label:t("nodes.nodeTemplate")}):a.jsx(Zn,{label:t("nodes.noNodeSelected"),icon:null})},tae=d.memo(eae),nae=()=>a.jsx(L,{layerStyle:"first",sx:{flexDir:"column",w:"full",h:"full",borderRadius:"base",p:2,gap:2},children:a.jsxs(rl,{variant:"line",sx:{display:"flex",flexDir:"column",w:"full",h:"full"},children:[a.jsxs(ol,{children:[a.jsx(Tr,{children:"Outputs"}),a.jsx(Tr,{children:"Data"}),a.jsx(Tr,{children:"Template"})]}),a.jsxs(zc,{children:[a.jsx(So,{children:a.jsx(Yse,{})}),a.jsx(So,{children:a.jsx(Use,{})}),a.jsx(So,{children:a.jsx(tae,{})})]})]})}),rae=d.memo(nae),e2=e=>{e.stopPropagation()},oae={display:"flex",flexDirection:"row",alignItems:"center",gap:10},sae=e=>{const{label:t="",labelPos:n="top",isDisabled:r=!1,isInvalid:o,formControlProps:s,...i}=e,l=te(),u=d.useCallback(m=>{m.shiftKey&&l(Nr(!0))},[l]),p=d.useCallback(m=>{m.shiftKey||l(Nr(!1))},[l]);return a.jsxs(Kt,{isInvalid:o,isDisabled:r,...s,style:n==="side"?oae:void 0,children:[t!==""&&a.jsx(wn,{children:t}),a.jsx(Mh,{...i,onPaste:e2,onKeyDown:u,onKeyUp:p})]})},vo=d.memo(sae),aae=je((e,t)=>{const n=te(),r=d.useCallback(s=>{s.shiftKey&&n(Nr(!0))},[n]),o=d.useCallback(s=>{s.shiftKey||n(Nr(!1))},[n]);return a.jsx(fP,{ref:t,onPaste:e2,onKeyDown:r,onKeyUp:o,...e})}),da=d.memo(aae),iae=le(xe,({nodes:e})=>{const{author:t,name:n,description:r,tags:o,version:s,contact:i,notes:l}=e.workflow;return{name:n,author:t,description:r,tags:o,version:s,contact:i,notes:l}},Se),lae=()=>{const{author:e,name:t,description:n,tags:r,version:o,contact:s,notes:i}=W(iae),l=te(),u=d.useCallback(w=>{l(UD(w.target.value))},[l]),p=d.useCallback(w=>{l(GD(w.target.value))},[l]),m=d.useCallback(w=>{l(KD(w.target.value))},[l]),h=d.useCallback(w=>{l(qD(w.target.value))},[l]),g=d.useCallback(w=>{l(XD(w.target.value))},[l]),x=d.useCallback(w=>{l(QD(w.target.value))},[l]),y=d.useCallback(w=>{l(YD(w.target.value))},[l]),{t:b}=Z();return a.jsx(Zd,{children:a.jsxs(L,{sx:{flexDir:"column",alignItems:"flex-start",gap:2,h:"full"},children:[a.jsxs(L,{sx:{gap:2,w:"full"},children:[a.jsx(vo,{label:b("nodes.workflowName"),value:t,onChange:u}),a.jsx(vo,{label:b("nodes.workflowVersion"),value:o,onChange:h})]}),a.jsxs(L,{sx:{gap:2,w:"full"},children:[a.jsx(vo,{label:b("nodes.workflowAuthor"),value:e,onChange:p}),a.jsx(vo,{label:b("nodes.workflowContact"),value:s,onChange:m})]}),a.jsx(vo,{label:b("nodes.workflowTags"),value:r,onChange:x}),a.jsxs(Kt,{as:L,sx:{flexDir:"column"},children:[a.jsx(wn,{children:b("nodes.workflowDescription")}),a.jsx(da,{onChange:g,value:n,fontSize:"sm",sx:{resize:"none"}})]}),a.jsxs(Kt,{as:L,sx:{flexDir:"column",h:"full"},children:[a.jsx(wn,{children:b("nodes.workflowNotes")}),a.jsx(da,{onChange:y,value:i,fontSize:"sm",sx:{h:"full",resize:"none"}})]})]})})},cae=d.memo(lae);function uae(e,t,n){var r=this,o=d.useRef(null),s=d.useRef(0),i=d.useRef(null),l=d.useRef([]),u=d.useRef(),p=d.useRef(),m=d.useRef(e),h=d.useRef(!0);d.useEffect(function(){m.current=e},[e]);var g=!t&&t!==0&&typeof window<"u";if(typeof e!="function")throw new TypeError("Expected a function");t=+t||0;var x=!!(n=n||{}).leading,y=!("trailing"in n)||!!n.trailing,b="maxWait"in n,w=b?Math.max(+n.maxWait||0,t):null;d.useEffect(function(){return h.current=!0,function(){h.current=!1}},[]);var S=d.useMemo(function(){var j=function(D){var A=l.current,O=u.current;return l.current=u.current=null,s.current=D,p.current=m.current.apply(O,A)},_=function(D,A){g&&cancelAnimationFrame(i.current),i.current=g?requestAnimationFrame(D):setTimeout(D,A)},E=function(D){if(!h.current)return!1;var A=D-o.current;return!o.current||A>=t||A<0||b&&D-s.current>=w},I=function(D){return i.current=null,y&&l.current?j(D):(l.current=u.current=null,p.current)},M=function D(){var A=Date.now();if(E(A))return I(A);if(h.current){var O=t-(A-o.current),T=b?Math.min(O,w-(A-s.current)):O;_(D,T)}},R=function(){var D=Date.now(),A=E(D);if(l.current=[].slice.call(arguments),u.current=r,o.current=D,A){if(!i.current&&h.current)return s.current=o.current,_(M,t),x?j(o.current):p.current;if(b)return _(M,t),j(o.current)}return i.current||_(M,t),p.current};return R.cancel=function(){i.current&&(g?cancelAnimationFrame(i.current):clearTimeout(i.current)),s.current=0,l.current=o.current=u.current=i.current=null},R.isPending=function(){return!!i.current},R.flush=function(){return i.current?I(Date.now()):p.current},R},[x,b,t,w,y,g]);return S}function dae(e,t){return e===t}function qj(e){return typeof e=="function"?function(){return e}:e}function fae(e,t,n){var r,o,s=n&&n.equalityFn||dae,i=(r=d.useState(qj(e)),o=r[1],[r[0],d.useCallback(function(h){return o(qj(h))},[])]),l=i[0],u=i[1],p=uae(d.useCallback(function(h){return u(h)},[u]),t,n),m=d.useRef(e);return s(m.current,e)||(p(e),m.current=e),[l,p]}const uO=()=>{const e=W(r=>r.nodes),[t]=fae(e,300);return d.useMemo(()=>ZD(t),[t])},pae=()=>{const e=uO(),{t}=Z();return a.jsx(L,{sx:{flexDir:"column",alignItems:"flex-start",gap:2,h:"full"},children:a.jsx(Ya,{data:e,label:t("nodes.workflow")})})},mae=d.memo(pae),hae=({isSelected:e,isHovered:t})=>{const n=d.useMemo(()=>{if(e&&t)return"nodeHoveredSelected.light";if(e)return"nodeSelected.light";if(t)return"nodeHovered.light"},[t,e]),r=d.useMemo(()=>{if(e&&t)return"nodeHoveredSelected.dark";if(e)return"nodeSelected.dark";if(t)return"nodeHovered.dark"},[t,e]);return a.jsx(Ie,{className:"selection-box",sx:{position:"absolute",top:0,insetInlineEnd:0,bottom:0,insetInlineStart:0,borderRadius:"base",opacity:e||t?1:.5,transitionProperty:"common",transitionDuration:"0.1s",pointerEvents:"none",shadow:n,_dark:{shadow:r}}})},dO=d.memo(hae),fO=e=>{const t=te(),n=d.useMemo(()=>le(xe,({nodes:i})=>i.mouseOverNode===e,Se),[e]),r=W(n),o=d.useCallback(()=>{!r&&t(hw(e))},[t,e,r]),s=d.useCallback(()=>{r&&t(hw(null))},[t,r]);return{isMouseOverNode:r,handleMouseOver:o,handleMouseOut:s}},pO=(e,t)=>{const n=d.useMemo(()=>le(xe,({nodes:o})=>{var i;const s=o.nodes.find(l=>l.id===e);if(On(s))return(i=s==null?void 0:s.data.inputs[t])==null?void 0:i.label},Se),[t,e]);return W(n)},mO=(e,t,n)=>{const r=d.useMemo(()=>le(xe,({nodes:s})=>{var u;const i=s.nodes.find(p=>p.id===e);if(!On(i))return;const l=s.nodeTemplates[(i==null?void 0:i.data.type)??""];return(u=l==null?void 0:l[tb[n]][t])==null?void 0:u.title},Se),[t,n,e]);return W(r)},hO=(e,t)=>{const n=d.useMemo(()=>le(xe,({nodes:o})=>{const s=o.nodes.find(i=>i.id===e);if(On(s))return s==null?void 0:s.data.inputs[t]},Se),[t,e]);return W(n)},Pg=(e,t,n)=>{const r=d.useMemo(()=>le(xe,({nodes:s})=>{const i=s.nodes.find(u=>u.id===e);if(!On(i))return;const l=s.nodeTemplates[(i==null?void 0:i.data.type)??""];return l==null?void 0:l[tb[n]][t]},Se),[t,n,e]);return W(r)},gae=({nodeId:e,fieldName:t,kind:n})=>{const r=hO(e,t),o=Pg(e,t,n),s=JD(o),{t:i}=Z(),l=d.useMemo(()=>eA(r)?r.label&&(o!=null&&o.title)?`${r.label} (${o.title})`:r.label&&!o?r.label:!r.label&&o?o.title:i("nodes.unknownField"):(o==null?void 0:o.title)||i("nodes.unknownField"),[r,o,i]);return a.jsxs(L,{sx:{flexDir:"column"},children:[a.jsx(ve,{sx:{fontWeight:600},children:l}),o&&a.jsx(ve,{sx:{opacity:.7,fontStyle:"oblique 5deg"},children:o.description}),o&&a.jsxs(ve,{children:["Type: ",wd[o.type].title]}),s&&a.jsxs(ve,{children:["Input: ",tA(o.input)]})]})},t2=d.memo(gae),vae=je((e,t)=>{const{nodeId:n,fieldName:r,kind:o,isMissingInput:s=!1,withTooltip:i=!1}=e,l=pO(n,r),u=mO(n,r,o),{t:p}=Z(),m=te(),[h,g]=d.useState(l||u||p("nodes.unknownField")),x=d.useCallback(async b=>{b&&(b===l||b===u)||(g(b||u||p("nodes.unknownField")),m(nA({nodeId:n,fieldName:r,label:b})))},[l,u,m,n,r,p]),y=d.useCallback(b=>{g(b)},[]);return d.useEffect(()=>{g(l||u||p("nodes.unknownField"))},[l,u,p]),a.jsx(Ht,{label:i?a.jsx(t2,{nodeId:n,fieldName:r,kind:"input"}):void 0,openDelay:yh,placement:"top",hasArrow:!0,children:a.jsx(L,{ref:t,sx:{position:"relative",overflow:"hidden",alignItems:"center",justifyContent:"flex-start",gap:1,h:"full"},children:a.jsxs(Ih,{value:h,onChange:y,onSubmit:x,as:L,sx:{position:"relative",alignItems:"center",h:"full"},children:[a.jsx(_h,{sx:{p:0,fontWeight:s?600:400,textAlign:"left",_hover:{fontWeight:"600 !important"}},noOfLines:1}),a.jsx(jh,{className:"nodrag",sx:{p:0,w:"full",fontWeight:600,color:"base.900",_dark:{color:"base.100"},_focusVisible:{p:0,textAlign:"left",boxShadow:"none"}}}),a.jsx(vO,{})]})})})}),gO=d.memo(vae),vO=d.memo(()=>{const{isEditing:e,getEditButtonProps:t}=C5(),n=d.useCallback(r=>{const{onClick:o}=t();o&&(o(r),r.preventDefault())},[t]);return e?null:a.jsx(L,{onClick:n,position:"absolute",w:"full",h:"full",top:0,insetInlineStart:0,cursor:"text"})});vO.displayName="EditableControls";const xae=e=>{const{nodeId:t,field:n}=e,r=te(),o=d.useCallback(s=>{r(rA({nodeId:t,fieldName:n.name,value:s.target.checked}))},[r,n.name,t]);return a.jsx(qb,{className:"nodrag",onChange:o,isChecked:n.value})},bae=d.memo(xae);function Eg(){return(Eg=Object.assign||function(e){for(var t=1;t=0||(o[n]=e[n]);return o}function _x(e){var t=d.useRef(e),n=d.useRef(function(r){t.current&&t.current(r)});return t.current=e,n.current}var Mc=function(e,t,n){return t===void 0&&(t=0),n===void 0&&(n=1),e>n?n:e0:w.buttons>0)&&o.current?s(Xj(o.current,w,l.current)):b(!1)},y=function(){return b(!1)};function b(w){var S=u.current,j=Ix(o.current),_=w?j.addEventListener:j.removeEventListener;_(S?"touchmove":"mousemove",x),_(S?"touchend":"mouseup",y)}return[function(w){var S=w.nativeEvent,j=o.current;if(j&&(Qj(S),!function(E,I){return I&&!Gu(E)}(S,u.current)&&j)){if(Gu(S)){u.current=!0;var _=S.changedTouches||[];_.length&&(l.current=_[0].identifier)}j.focus(),s(Xj(j,S,l.current)),b(!0)}},function(w){var S=w.which||w.keyCode;S<37||S>40||(w.preventDefault(),i({left:S===39?.05:S===37?-.05:0,top:S===40?.05:S===38?-.05:0}))},b]},[i,s]),m=p[0],h=p[1],g=p[2];return d.useEffect(function(){return g},[g]),H.createElement("div",Eg({},r,{onTouchStart:m,onMouseDown:m,className:"react-colorful__interactive",ref:o,onKeyDown:h,tabIndex:0,role:"slider"}))}),Mg=function(e){return e.filter(Boolean).join(" ")},r2=function(e){var t=e.color,n=e.left,r=e.top,o=r===void 0?.5:r,s=Mg(["react-colorful__pointer",e.className]);return H.createElement("div",{className:s,style:{top:100*o+"%",left:100*n+"%"}},H.createElement("div",{className:"react-colorful__pointer-fill",style:{backgroundColor:t}}))},Cr=function(e,t,n){return t===void 0&&(t=0),n===void 0&&(n=Math.pow(10,t)),Math.round(n*e)/n},bO=function(e){var t=e.s,n=e.v,r=e.a,o=(200-t)*n/100;return{h:Cr(e.h),s:Cr(o>0&&o<200?t*n/100/(o<=100?o:200-o)*100:0),l:Cr(o/2),a:Cr(r,2)}},Px=function(e){var t=bO(e);return"hsl("+t.h+", "+t.s+"%, "+t.l+"%)"},Qv=function(e){var t=bO(e);return"hsla("+t.h+", "+t.s+"%, "+t.l+"%, "+t.a+")"},yae=function(e){var t=e.h,n=e.s,r=e.v,o=e.a;t=t/360*6,n/=100,r/=100;var s=Math.floor(t),i=r*(1-n),l=r*(1-(t-s)*n),u=r*(1-(1-t+s)*n),p=s%6;return{r:Cr(255*[r,l,i,i,u,r][p]),g:Cr(255*[u,r,r,l,i,i][p]),b:Cr(255*[i,i,u,r,r,l][p]),a:Cr(o,2)}},Cae=function(e){var t=e.r,n=e.g,r=e.b,o=e.a,s=Math.max(t,n,r),i=s-Math.min(t,n,r),l=i?s===t?(n-r)/i:s===n?2+(r-t)/i:4+(t-n)/i:0;return{h:Cr(60*(l<0?l+6:l)),s:Cr(s?i/s*100:0),v:Cr(s/255*100),a:o}},wae=H.memo(function(e){var t=e.hue,n=e.onChange,r=Mg(["react-colorful__hue",e.className]);return H.createElement("div",{className:r},H.createElement(n2,{onMove:function(o){n({h:360*o.left})},onKey:function(o){n({h:Mc(t+360*o.left,0,360)})},"aria-label":"Hue","aria-valuenow":Cr(t),"aria-valuemax":"360","aria-valuemin":"0"},H.createElement(r2,{className:"react-colorful__hue-pointer",left:t/360,color:Px({h:t,s:100,v:100,a:1})})))}),Sae=H.memo(function(e){var t=e.hsva,n=e.onChange,r={backgroundColor:Px({h:t.h,s:100,v:100,a:1})};return H.createElement("div",{className:"react-colorful__saturation",style:r},H.createElement(n2,{onMove:function(o){n({s:100*o.left,v:100-100*o.top})},onKey:function(o){n({s:Mc(t.s+100*o.left,0,100),v:Mc(t.v-100*o.top,0,100)})},"aria-label":"Color","aria-valuetext":"Saturation "+Cr(t.s)+"%, Brightness "+Cr(t.v)+"%"},H.createElement(r2,{className:"react-colorful__saturation-pointer",top:1-t.v/100,left:t.s/100,color:Px(t)})))}),yO=function(e,t){if(e===t)return!0;for(var n in e)if(e[n]!==t[n])return!1;return!0};function kae(e,t,n){var r=_x(n),o=d.useState(function(){return e.toHsva(t)}),s=o[0],i=o[1],l=d.useRef({color:t,hsva:s});d.useEffect(function(){if(!e.equal(t,l.current.color)){var p=e.toHsva(t);l.current={hsva:p,color:t},i(p)}},[t,e]),d.useEffect(function(){var p;yO(s,l.current.hsva)||e.equal(p=e.fromHsva(s),l.current.color)||(l.current={hsva:s,color:p},r(p))},[s,e,r]);var u=d.useCallback(function(p){i(function(m){return Object.assign({},m,p)})},[]);return[s,u]}var jae=typeof window<"u"?d.useLayoutEffect:d.useEffect,_ae=function(){return typeof __webpack_nonce__<"u"?__webpack_nonce__:void 0},Yj=new Map,Iae=function(e){jae(function(){var t=e.current?e.current.ownerDocument:document;if(t!==void 0&&!Yj.has(t)){var n=t.createElement("style");n.innerHTML=`.react-colorful{position:relative;display:flex;flex-direction:column;width:200px;height:200px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;cursor:default}.react-colorful__saturation{position:relative;flex-grow:1;border-color:transparent;border-bottom:12px solid #000;border-radius:8px 8px 0 0;background-image:linear-gradient(0deg,#000,transparent),linear-gradient(90deg,#fff,hsla(0,0%,100%,0))}.react-colorful__alpha-gradient,.react-colorful__pointer-fill{content:"";position:absolute;left:0;top:0;right:0;bottom:0;pointer-events:none;border-radius:inherit}.react-colorful__alpha-gradient,.react-colorful__saturation{box-shadow:inset 0 0 0 1px rgba(0,0,0,.05)}.react-colorful__alpha,.react-colorful__hue{position:relative;height:24px}.react-colorful__hue{background:linear-gradient(90deg,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red)}.react-colorful__last-control{border-radius:0 0 8px 8px}.react-colorful__interactive{position:absolute;left:0;top:0;right:0;bottom:0;border-radius:inherit;outline:none;touch-action:none}.react-colorful__pointer{position:absolute;z-index:1;box-sizing:border-box;width:28px;height:28px;transform:translate(-50%,-50%);background-color:#fff;border:2px solid #fff;border-radius:50%;box-shadow:0 2px 4px rgba(0,0,0,.2)}.react-colorful__interactive:focus .react-colorful__pointer{transform:translate(-50%,-50%) scale(1.1)}.react-colorful__alpha,.react-colorful__alpha-pointer{background-color:#fff;background-image:url('data:image/svg+xml;charset=utf-8,')}.react-colorful__saturation-pointer{z-index:3}.react-colorful__hue-pointer{z-index:2}`,Yj.set(t,n);var r=_ae();r&&n.setAttribute("nonce",r),t.head.appendChild(n)}},[])},Pae=function(e){var t=e.className,n=e.hsva,r=e.onChange,o={backgroundImage:"linear-gradient(90deg, "+Qv(Object.assign({},n,{a:0}))+", "+Qv(Object.assign({},n,{a:1}))+")"},s=Mg(["react-colorful__alpha",t]),i=Cr(100*n.a);return H.createElement("div",{className:s},H.createElement("div",{className:"react-colorful__alpha-gradient",style:o}),H.createElement(n2,{onMove:function(l){r({a:l.left})},onKey:function(l){r({a:Mc(n.a+l.left)})},"aria-label":"Alpha","aria-valuetext":i+"%","aria-valuenow":i,"aria-valuemin":"0","aria-valuemax":"100"},H.createElement(r2,{className:"react-colorful__alpha-pointer",left:n.a,color:Qv(n)})))},Eae=function(e){var t=e.className,n=e.colorModel,r=e.color,o=r===void 0?n.defaultColor:r,s=e.onChange,i=xO(e,["className","colorModel","color","onChange"]),l=d.useRef(null);Iae(l);var u=kae(n,o,s),p=u[0],m=u[1],h=Mg(["react-colorful",t]);return H.createElement("div",Eg({},i,{ref:l,className:h}),H.createElement(Sae,{hsva:p,onChange:m}),H.createElement(wae,{hue:p.h,onChange:m}),H.createElement(Pae,{hsva:p,onChange:m,className:"react-colorful__last-control"}))},Mae={defaultColor:{r:0,g:0,b:0,a:1},toHsva:Cae,fromHsva:yae,equal:yO},CO=function(e){return H.createElement(Eae,Eg({},e,{colorModel:Mae}))};const Oae=e=>{const{nodeId:t,field:n}=e,r=te(),o=d.useCallback(s=>{r(oA({nodeId:t,fieldName:n.name,value:s}))},[r,n.name,t]);return a.jsx(CO,{className:"nodrag",color:n.value,onChange:o})},Rae=d.memo(Oae),wO=e=>{const t=si("models"),[n,r,o]=e.split("/"),s=sA.safeParse({base_model:n,model_name:o});if(!s.success){t.error({controlNetModelId:e,errors:s.error.format()},"Failed to parse ControlNet model id");return}return s.data},Dae=e=>{const{nodeId:t,field:n}=e,r=n.value,o=te(),{data:s}=gh(),i=d.useMemo(()=>(s==null?void 0:s.entities[`${r==null?void 0:r.base_model}/controlnet/${r==null?void 0:r.model_name}`])??null,[r==null?void 0:r.base_model,r==null?void 0:r.model_name,s==null?void 0:s.entities]),l=d.useMemo(()=>{if(!s)return[];const p=[];return Rn(s.entities,(m,h)=>{m&&p.push({value:h,label:m.model_name,group:an[m.base_model]})}),p},[s]),u=d.useCallback(p=>{if(!p)return;const m=wO(p);m&&o(aA({nodeId:t,fieldName:n.name,value:m}))},[o,n.name,t]);return a.jsx(Pn,{className:"nowheel nodrag",tooltip:i==null?void 0:i.description,value:(i==null?void 0:i.id)??null,placeholder:"Pick one",error:!i,data:l,onChange:u,sx:{width:"100%"}})},Aae=d.memo(Dae),Tae=e=>{const{nodeId:t,field:n,fieldTemplate:r}=e,o=te(),s=d.useCallback(i=>{o(iA({nodeId:t,fieldName:n.name,value:i.target.value}))},[o,n.name,t]);return a.jsx(Q3,{className:"nowheel nodrag",onChange:s,value:n.value,children:r.options.map(i=>a.jsx("option",{value:i,children:r.ui_choice_labels?r.ui_choice_labels[i]:i},i))})},Nae=d.memo(Tae),$ae=e=>{var p;const{nodeId:t,field:n}=e,r=te(),{currentData:o}=to(((p=n.value)==null?void 0:p.image_name)??$r.skipToken),s=d.useCallback(()=>{r(lA({nodeId:t,fieldName:n.name,value:void 0}))},[r,n.name,t]),i=d.useMemo(()=>{if(o)return{id:`node-${t}-${n.name}`,payloadType:"IMAGE_DTO",payload:{imageDTO:o}}},[n.name,o,t]),l=d.useMemo(()=>({id:`node-${t}-${n.name}`,actionType:"SET_NODES_IMAGE",context:{nodeId:t,fieldName:n.name}}),[n.name,t]),u=d.useMemo(()=>({type:"SET_NODES_IMAGE",nodeId:t,fieldName:n.name}),[t,n.name]);return a.jsx(L,{className:"nodrag",sx:{w:"full",h:"full",alignItems:"center",justifyContent:"center"},children:a.jsx(ua,{imageDTO:o,droppableData:l,draggableData:i,postUploadAction:u,useThumbailFallback:!0,uploadElement:a.jsx(SO,{}),dropLabel:a.jsx(kO,{}),minSize:8,children:a.jsx(zi,{onClick:s,icon:o?a.jsx(Ud,{}):void 0,tooltip:"Reset Image"})})})},Lae=d.memo($ae),SO=d.memo(()=>a.jsx(ve,{fontSize:16,fontWeight:600,children:"Drop or Upload"}));SO.displayName="UploadElement";const kO=d.memo(()=>a.jsx(ve,{fontSize:16,fontWeight:600,children:"Drop"}));kO.displayName="DropLabel";const zae=e=>{const t=si("models"),[n,r,o]=e.split("/"),s=cA.safeParse({base_model:n,model_name:o});if(!s.success){t.error({loraModelId:e,errors:s.error.format()},"Failed to parse LoRA model id");return}return s.data},Fae=e=>{const{nodeId:t,field:n}=e,r=n.value,o=te(),{data:s}=Cd(),{t:i}=Z(),l=d.useMemo(()=>{if(!s)return[];const m=[];return Rn(s.entities,(h,g)=>{h&&m.push({value:g,label:h.model_name,group:an[h.base_model]})}),m.sort((h,g)=>h.disabled&&!g.disabled?1:-1)},[s]),u=d.useMemo(()=>(s==null?void 0:s.entities[`${r==null?void 0:r.base_model}/lora/${r==null?void 0:r.model_name}`])??null,[s==null?void 0:s.entities,r==null?void 0:r.base_model,r==null?void 0:r.model_name]),p=d.useCallback(m=>{if(!m)return;const h=zae(m);h&&o(uA({nodeId:t,fieldName:n.name,value:h}))},[o,n.name,t]);return(s==null?void 0:s.ids.length)===0?a.jsx(L,{sx:{justifyContent:"center",p:2},children:a.jsx(ve,{sx:{fontSize:"sm",color:"base.500",_dark:"base.700"},children:"No LoRAs Loaded"})}):a.jsx(nn,{className:"nowheel nodrag",value:(u==null?void 0:u.id)??null,placeholder:l.length>0?i("models.selectLoRA"):i("models.noLoRAsAvailable"),data:l,nothingFound:i("models.noMatchingLoRAs"),itemComponent:ui,disabled:l.length===0,filter:(m,h)=>{var g;return((g=h.label)==null?void 0:g.toLowerCase().includes(m.toLowerCase().trim()))||h.value.toLowerCase().includes(m.toLowerCase().trim())},error:!u,onChange:p,sx:{width:"100%",".mantine-Select-dropdown":{width:"16rem !important"}}})},Bae=d.memo(Fae),Og=e=>{const t=si("models"),[n,r,o]=e.split("/"),s=dA.safeParse({base_model:n,model_name:o,model_type:r});if(!s.success){t.error({mainModelId:e,errors:s.error.format()},"Failed to parse main model id");return}return s.data};function Gc(e){const{iconMode:t=!1,...n}=e,r=te(),{t:o}=Z(),[s,{isLoading:i}]=fA(),l=()=>{s().unwrap().then(u=>{r(ct(Qt({title:`${o("modelManager.modelsSynced")}`,status:"success"})))}).catch(u=>{u&&r(ct(Qt({title:`${o("modelManager.modelSyncFailed")}`,status:"error"})))})};return t?a.jsx(Fe,{icon:a.jsx(bM,{}),tooltip:o("modelManager.syncModels"),"aria-label":o("modelManager.syncModels"),isLoading:i,onClick:l,size:"sm",...n}):a.jsx(at,{isLoading:i,onClick:l,minW:"max-content",...n,children:"Sync Models"})}const Hae=e=>{var y,b;const{nodeId:t,field:n}=e,r=te(),o=Bt("syncModels").isFeatureEnabled,{t:s}=Z(),{data:i,isLoading:l}=Ku(gw),{data:u,isLoading:p}=Xo(gw),m=d.useMemo(()=>l||p,[l,p]),h=d.useMemo(()=>{if(!u)return[];const w=[];return Rn(u.entities,(S,j)=>{S&&w.push({value:j,label:S.model_name,group:an[S.base_model]})}),i&&Rn(i.entities,(S,j)=>{S&&w.push({value:j,label:S.model_name,group:an[S.base_model]})}),w},[u,i]),g=d.useMemo(()=>{var w,S,j,_;return((u==null?void 0:u.entities[`${(w=n.value)==null?void 0:w.base_model}/main/${(S=n.value)==null?void 0:S.model_name}`])||(i==null?void 0:i.entities[`${(j=n.value)==null?void 0:j.base_model}/onnx/${(_=n.value)==null?void 0:_.model_name}`]))??null},[(y=n.value)==null?void 0:y.base_model,(b=n.value)==null?void 0:b.model_name,u==null?void 0:u.entities,i==null?void 0:i.entities]),x=d.useCallback(w=>{if(!w)return;const S=Og(w);S&&r(kI({nodeId:t,fieldName:n.name,value:S}))},[r,n.name,t]);return a.jsxs(L,{sx:{w:"full",alignItems:"center",gap:2},children:[m?a.jsx(ve,{variant:"subtext",children:"Loading..."}):a.jsx(nn,{className:"nowheel nodrag",tooltip:g==null?void 0:g.description,value:g==null?void 0:g.id,placeholder:h.length>0?s("models.selectModel"):s("models.noModelsAvailable"),data:h,error:!g,disabled:h.length===0,onChange:x,sx:{width:"100%",".mantine-Select-dropdown":{width:"16rem !important"}}}),o&&a.jsx(Gc,{className:"nodrag",iconMode:!0})]})},Vae=d.memo(Hae),ch=/^-?(0\.)?\.?$/,jO=je((e,t)=>{const{label:n,isDisabled:r=!1,showStepper:o=!0,isInvalid:s,value:i,onChange:l,min:u,max:p,isInteger:m=!0,formControlProps:h,formLabelProps:g,numberInputFieldProps:x,numberInputStepperProps:y,tooltipProps:b,...w}=e,S=te(),[j,_]=d.useState(String(i));d.useEffect(()=>{!j.match(ch)&&i!==Number(j)&&_(String(i))},[i,j]);const E=D=>{_(D),D.match(ch)||l(m?Math.floor(Number(D)):Number(D))},I=D=>{const A=Bi(m?Math.floor(Number(D.target.value)):Number(D.target.value),u,p);_(String(A)),l(A)},M=d.useCallback(D=>{D.shiftKey&&S(Nr(!0))},[S]),R=d.useCallback(D=>{D.shiftKey||S(Nr(!1))},[S]);return a.jsx(Ht,{...b,children:a.jsxs(Kt,{ref:t,isDisabled:r,isInvalid:s,...h,children:[n&&a.jsx(wn,{...g,children:n}),a.jsxs(Lh,{value:j,min:u,max:p,keepWithinRange:!0,clampValueOnBlur:!1,onChange:E,onBlur:I,...w,onPaste:e2,children:[a.jsx(Fh,{...x,onKeyDown:M,onKeyUp:R}),o&&a.jsxs(zh,{children:[a.jsx(Hh,{...y}),a.jsx(Bh,{...y})]})]})]})})});jO.displayName="IAINumberInput";const Kc=d.memo(jO),Wae=e=>{const{nodeId:t,field:n,fieldTemplate:r}=e,o=te(),[s,i]=d.useState(String(n.value)),l=d.useMemo(()=>r.type==="integer",[r.type]),u=p=>{i(p),p.match(ch)||o(pA({nodeId:t,fieldName:n.name,value:l?Math.floor(Number(p)):Number(p)}))};return d.useEffect(()=>{!s.match(ch)&&n.value!==Number(s)&&i(String(n.value))},[n.value,s]),a.jsxs(Lh,{onChange:u,value:s,step:l?1:.1,precision:l?0:3,children:[a.jsx(Fh,{className:"nodrag"}),a.jsxs(zh,{children:[a.jsx(Hh,{}),a.jsx(Bh,{})]})]})},Uae=d.memo(Wae),Gae=e=>{var h,g;const{nodeId:t,field:n}=e,r=te(),{t:o}=Z(),s=Bt("syncModels").isFeatureEnabled,{data:i,isLoading:l}=Xo(nb),u=d.useMemo(()=>{if(!i)return[];const x=[];return Rn(i.entities,(y,b)=>{y&&x.push({value:b,label:y.model_name,group:an[y.base_model]})}),x},[i]),p=d.useMemo(()=>{var x,y;return(i==null?void 0:i.entities[`${(x=n.value)==null?void 0:x.base_model}/main/${(y=n.value)==null?void 0:y.model_name}`])??null},[(h=n.value)==null?void 0:h.base_model,(g=n.value)==null?void 0:g.model_name,i==null?void 0:i.entities]),m=d.useCallback(x=>{if(!x)return;const y=Og(x);y&&r(mA({nodeId:t,fieldName:n.name,value:y}))},[r,n.name,t]);return l?a.jsx(nn,{label:o("modelManager.model"),placeholder:o("models.loading"),disabled:!0,data:[]}):a.jsxs(L,{w:"100%",alignItems:"center",gap:2,children:[a.jsx(nn,{className:"nowheel nodrag",tooltip:p==null?void 0:p.description,value:p==null?void 0:p.id,placeholder:u.length>0?o("models.selectModel"):o("models.noModelsAvailable"),data:u,error:!p,disabled:u.length===0,onChange:m,sx:{width:"100%",".mantine-Select-dropdown":{width:"16rem !important"}}}),s&&a.jsx(Gc,{className:"nodrag",iconMode:!0})]})},Kae=d.memo(Gae),qae=e=>{var g,x;const{nodeId:t,field:n}=e,r=te(),{t:o}=Z(),s=Bt("syncModels").isFeatureEnabled,{data:i}=Ku(vw),{data:l,isLoading:u}=Xo(vw),p=d.useMemo(()=>{if(!l)return[];const y=[];return Rn(l.entities,(b,w)=>{!b||b.base_model!=="sdxl"||y.push({value:w,label:b.model_name,group:an[b.base_model]})}),i&&Rn(i.entities,(b,w)=>{!b||b.base_model!=="sdxl"||y.push({value:w,label:b.model_name,group:an[b.base_model]})}),y},[l,i]),m=d.useMemo(()=>{var y,b,w,S;return((l==null?void 0:l.entities[`${(y=n.value)==null?void 0:y.base_model}/main/${(b=n.value)==null?void 0:b.model_name}`])||(i==null?void 0:i.entities[`${(w=n.value)==null?void 0:w.base_model}/onnx/${(S=n.value)==null?void 0:S.model_name}`]))??null},[(g=n.value)==null?void 0:g.base_model,(x=n.value)==null?void 0:x.model_name,l==null?void 0:l.entities,i==null?void 0:i.entities]),h=d.useCallback(y=>{if(!y)return;const b=Og(y);b&&r(kI({nodeId:t,fieldName:n.name,value:b}))},[r,n.name,t]);return u?a.jsx(nn,{label:o("modelManager.model"),placeholder:o("models.loading"),disabled:!0,data:[]}):a.jsxs(L,{w:"100%",alignItems:"center",gap:2,children:[a.jsx(nn,{className:"nowheel nodrag",tooltip:m==null?void 0:m.description,value:m==null?void 0:m.id,placeholder:p.length>0?o("models.selectModel"):o("models.noModelsAvailable"),data:p,error:!m,disabled:p.length===0,onChange:h,sx:{width:"100%",".mantine-Select-dropdown":{width:"16rem !important"}}}),s&&a.jsx(Gc,{className:"nodrag",iconMode:!0})]})},Xae=d.memo(qae),Qae=le([xe],({ui:e})=>{const{favoriteSchedulers:t}=e;return{data:nr(mh,(r,o)=>({value:o,label:r,group:t.includes(o)?"Favorites":void 0})).sort((r,o)=>r.label.localeCompare(o.label))}},Se),Yae=e=>{const{nodeId:t,field:n}=e,r=te(),{data:o}=W(Qae),s=d.useCallback(i=>{i&&r(hA({nodeId:t,fieldName:n.name,value:i}))},[r,n.name,t]);return a.jsx(nn,{className:"nowheel nodrag",value:n.value,data:o,onChange:s})},Zae=d.memo(Yae),Jae=e=>{const{nodeId:t,field:n,fieldTemplate:r}=e,o=te(),s=d.useCallback(i=>{o(gA({nodeId:t,fieldName:n.name,value:i.target.value}))},[o,n.name,t]);return r.ui_component==="textarea"?a.jsx(da,{className:"nodrag",onChange:s,value:n.value,rows:5,resize:"none"}):a.jsx(vo,{onChange:s,value:n.value})},eie=d.memo(Jae),_O=e=>{const t=si("models"),[n,r,o]=e.split("/"),s=vA.safeParse({base_model:n,model_name:o});if(!s.success){t.error({vaeModelId:e,errors:s.error.format()},"Failed to parse VAE model id");return}return s.data},tie=e=>{const{nodeId:t,field:n}=e,r=n.value,o=te(),{data:s}=jI(),i=d.useMemo(()=>{if(!s)return[];const p=[{value:"default",label:"Default",group:"Default"}];return Rn(s.entities,(m,h)=>{m&&p.push({value:h,label:m.model_name,group:an[m.base_model]})}),p.sort((m,h)=>m.disabled&&!h.disabled?1:-1)},[s]),l=d.useMemo(()=>(s==null?void 0:s.entities[`${r==null?void 0:r.base_model}/vae/${r==null?void 0:r.model_name}`])??null,[s==null?void 0:s.entities,r]),u=d.useCallback(p=>{if(!p)return;const m=_O(p);m&&o(xA({nodeId:t,fieldName:n.name,value:m}))},[o,n.name,t]);return a.jsx(nn,{className:"nowheel nodrag",itemComponent:ui,tooltip:l==null?void 0:l.description,value:(l==null?void 0:l.id)??"default",placeholder:"Default",data:i,onChange:u,disabled:i.length===0,error:!l,clearable:!0,sx:{width:"100%",".mantine-Select-dropdown":{width:"16rem !important"}}})},nie=d.memo(tie),IO=e=>{const t=si("models"),[n,r,o]=e.split("/"),s=bA.safeParse({base_model:n,model_name:o});if(!s.success){t.error({ipAdapterModelId:e,errors:s.error.format()},"Failed to parse IP-Adapter model id");return}return s.data},rie=e=>{const{nodeId:t,field:n}=e,r=n.value,o=te(),{data:s}=Vx(),i=d.useMemo(()=>(s==null?void 0:s.entities[`${r==null?void 0:r.base_model}/ip_adapter/${r==null?void 0:r.model_name}`])??null,[r==null?void 0:r.base_model,r==null?void 0:r.model_name,s==null?void 0:s.entities]),l=d.useMemo(()=>{if(!s)return[];const p=[];return Rn(s.entities,(m,h)=>{m&&p.push({value:h,label:m.model_name,group:an[m.base_model]})}),p},[s]),u=d.useCallback(p=>{if(!p)return;const m=IO(p);m&&o(yA({nodeId:t,fieldName:n.name,value:m}))},[o,n.name,t]);return a.jsx(Pn,{className:"nowheel nodrag",tooltip:i==null?void 0:i.description,value:(i==null?void 0:i.id)??null,placeholder:"Pick one",error:!i,data:l,onChange:u,sx:{width:"100%"}})},oie=d.memo(rie),sie=e=>{const t=si("models"),[n,r,o]=e.split("/"),s=CA.safeParse({base_model:n,model_name:o});if(!s.success){t.error({t2iAdapterModelId:e,errors:s.error.format()},"Failed to parse T2I-Adapter model id");return}return s.data},aie=e=>{const{nodeId:t,field:n}=e,r=n.value,o=te(),{data:s}=wA(),i=d.useMemo(()=>(s==null?void 0:s.entities[`${r==null?void 0:r.base_model}/t2i_adapter/${r==null?void 0:r.model_name}`])??null,[r==null?void 0:r.base_model,r==null?void 0:r.model_name,s==null?void 0:s.entities]),l=d.useMemo(()=>{if(!s)return[];const p=[];return Rn(s.entities,(m,h)=>{m&&p.push({value:h,label:m.model_name,group:an[m.base_model]})}),p},[s]),u=d.useCallback(p=>{if(!p)return;const m=sie(p);m&&o(SA({nodeId:t,fieldName:n.name,value:m}))},[o,n.name,t]);return a.jsx(Pn,{className:"nowheel nodrag",tooltip:i==null?void 0:i.description,value:(i==null?void 0:i.id)??null,placeholder:"Pick one",error:!i,data:l,onChange:u,sx:{width:"100%"}})},iie=d.memo(aie),lie=e=>{var l;const{nodeId:t,field:n}=e,r=te(),{data:o,hasBoards:s}=yd(void 0,{selectFromResult:({data:u})=>{const p=[{label:"None",value:"none"}];return u==null||u.forEach(({board_id:m,board_name:h})=>{p.push({label:h,value:m})}),{data:p,hasBoards:p.length>1}}}),i=d.useCallback(u=>{r(kA({nodeId:t,fieldName:n.name,value:u&&u!=="none"?{board_id:u}:void 0}))},[r,n.name,t]);return a.jsx(nn,{className:"nowheel nodrag",value:((l=n.value)==null?void 0:l.board_id)??"none",data:o,onChange:i,disabled:!s})},cie=d.memo(lie),uie=({nodeId:e,fieldName:t})=>{const n=hO(e,t),r=Pg(e,t,"input");return(r==null?void 0:r.fieldKind)==="output"?a.jsxs(Ie,{p:2,children:["Output field in input: ",n==null?void 0:n.type]}):(n==null?void 0:n.type)==="string"&&(r==null?void 0:r.type)==="string"||(n==null?void 0:n.type)==="StringPolymorphic"&&(r==null?void 0:r.type)==="StringPolymorphic"?a.jsx(eie,{nodeId:e,field:n,fieldTemplate:r}):(n==null?void 0:n.type)==="boolean"&&(r==null?void 0:r.type)==="boolean"||(n==null?void 0:n.type)==="BooleanPolymorphic"&&(r==null?void 0:r.type)==="BooleanPolymorphic"?a.jsx(bae,{nodeId:e,field:n,fieldTemplate:r}):(n==null?void 0:n.type)==="integer"&&(r==null?void 0:r.type)==="integer"||(n==null?void 0:n.type)==="float"&&(r==null?void 0:r.type)==="float"||(n==null?void 0:n.type)==="FloatPolymorphic"&&(r==null?void 0:r.type)==="FloatPolymorphic"||(n==null?void 0:n.type)==="IntegerPolymorphic"&&(r==null?void 0:r.type)==="IntegerPolymorphic"?a.jsx(Uae,{nodeId:e,field:n,fieldTemplate:r}):(n==null?void 0:n.type)==="enum"&&(r==null?void 0:r.type)==="enum"?a.jsx(Nae,{nodeId:e,field:n,fieldTemplate:r}):(n==null?void 0:n.type)==="ImageField"&&(r==null?void 0:r.type)==="ImageField"||(n==null?void 0:n.type)==="ImagePolymorphic"&&(r==null?void 0:r.type)==="ImagePolymorphic"?a.jsx(Lae,{nodeId:e,field:n,fieldTemplate:r}):(n==null?void 0:n.type)==="BoardField"&&(r==null?void 0:r.type)==="BoardField"?a.jsx(cie,{nodeId:e,field:n,fieldTemplate:r}):(n==null?void 0:n.type)==="MainModelField"&&(r==null?void 0:r.type)==="MainModelField"?a.jsx(Vae,{nodeId:e,field:n,fieldTemplate:r}):(n==null?void 0:n.type)==="SDXLRefinerModelField"&&(r==null?void 0:r.type)==="SDXLRefinerModelField"?a.jsx(Kae,{nodeId:e,field:n,fieldTemplate:r}):(n==null?void 0:n.type)==="VaeModelField"&&(r==null?void 0:r.type)==="VaeModelField"?a.jsx(nie,{nodeId:e,field:n,fieldTemplate:r}):(n==null?void 0:n.type)==="LoRAModelField"&&(r==null?void 0:r.type)==="LoRAModelField"?a.jsx(Bae,{nodeId:e,field:n,fieldTemplate:r}):(n==null?void 0:n.type)==="ControlNetModelField"&&(r==null?void 0:r.type)==="ControlNetModelField"?a.jsx(Aae,{nodeId:e,field:n,fieldTemplate:r}):(n==null?void 0:n.type)==="IPAdapterModelField"&&(r==null?void 0:r.type)==="IPAdapterModelField"?a.jsx(oie,{nodeId:e,field:n,fieldTemplate:r}):(n==null?void 0:n.type)==="T2IAdapterModelField"&&(r==null?void 0:r.type)==="T2IAdapterModelField"?a.jsx(iie,{nodeId:e,field:n,fieldTemplate:r}):(n==null?void 0:n.type)==="ColorField"&&(r==null?void 0:r.type)==="ColorField"?a.jsx(Rae,{nodeId:e,field:n,fieldTemplate:r}):(n==null?void 0:n.type)==="SDXLMainModelField"&&(r==null?void 0:r.type)==="SDXLMainModelField"?a.jsx(Xae,{nodeId:e,field:n,fieldTemplate:r}):(n==null?void 0:n.type)==="Scheduler"&&(r==null?void 0:r.type)==="Scheduler"?a.jsx(Zae,{nodeId:e,field:n,fieldTemplate:r}):n&&r?null:a.jsx(Ie,{p:1,children:a.jsxs(ve,{sx:{fontSize:"sm",fontWeight:600,color:"error.400",_dark:{color:"error.300"}},children:["Unknown field type: ",n==null?void 0:n.type]})})},PO=d.memo(uie),die=({nodeId:e,fieldName:t})=>{const n=te(),{isMouseOverNode:r,handleMouseOut:o,handleMouseOver:s}=fO(e),{t:i}=Z(),l=d.useCallback(()=>{n(_I({nodeId:e,fieldName:t}))},[n,t,e]);return a.jsxs(L,{onMouseEnter:s,onMouseLeave:o,layerStyle:"second",sx:{position:"relative",borderRadius:"base",w:"full",p:2},children:[a.jsxs(Kt,{as:L,sx:{flexDir:"column",gap:1,flexShrink:1},children:[a.jsxs(wn,{sx:{display:"flex",alignItems:"center",mb:0},children:[a.jsx(gO,{nodeId:e,fieldName:t,kind:"input"}),a.jsx(ba,{}),a.jsx(Ht,{label:a.jsx(t2,{nodeId:e,fieldName:t,kind:"input"}),openDelay:yh,placement:"top",hasArrow:!0,children:a.jsx(L,{h:"full",alignItems:"center",children:a.jsx(Nn,{as:fM})})}),a.jsx(Fe,{"aria-label":i("nodes.removeLinearView"),tooltip:i("nodes.removeLinearView"),variant:"ghost",size:"sm",onClick:l,icon:a.jsx(Br,{})})]}),a.jsx(PO,{nodeId:e,fieldName:t})]}),a.jsx(dO,{isSelected:!1,isHovered:r})]})},fie=d.memo(die),pie=le(xe,({nodes:e})=>({fields:e.workflow.exposedFields}),Se),mie=()=>{const{fields:e}=W(pie),{t}=Z();return a.jsx(Ie,{sx:{position:"relative",w:"full",h:"full"},children:a.jsx(Zd,{children:a.jsx(L,{sx:{position:"relative",flexDir:"column",alignItems:"flex-start",p:1,gap:2,h:"full",w:"full"},children:e.length?e.map(({nodeId:n,fieldName:r})=>a.jsx(fie,{nodeId:n,fieldName:r},`${n}.${r}`)):a.jsx(Zn,{label:t("nodes.noFieldsLinearview"),icon:null})})})})},hie=d.memo(mie),gie=()=>a.jsx(L,{layerStyle:"first",sx:{flexDir:"column",w:"full",h:"full",borderRadius:"base",p:2,gap:2},children:a.jsxs(rl,{variant:"line",sx:{display:"flex",flexDir:"column",w:"full",h:"full"},children:[a.jsxs(ol,{children:[a.jsx(Tr,{children:"Linear"}),a.jsx(Tr,{children:"Details"}),a.jsx(Tr,{children:"JSON"})]}),a.jsxs(zc,{children:[a.jsx(So,{children:a.jsx(hie,{})}),a.jsx(So,{children:a.jsx(cae,{})}),a.jsx(So,{children:a.jsx(mae,{})})]})]})}),vie=d.memo(gie),xie={paramNegativeConditioning:{placement:"right"},controlNet:{href:"https://support.invoke.ai/support/solutions/articles/151000105880"},lora:{href:"https://support.invoke.ai/support/solutions/articles/151000159072"},compositingCoherenceMode:{href:"https://support.invoke.ai/support/solutions/articles/151000158838"},infillMethod:{href:"https://support.invoke.ai/support/solutions/articles/151000158841"},scaleBeforeProcessing:{href:"https://support.invoke.ai/support/solutions/articles/151000158841"},paramIterations:{href:"https://support.invoke.ai/support/solutions/articles/151000159073"},paramPositiveConditioning:{href:"https://support.invoke.ai/support/solutions/articles/151000096606-tips-on-crafting-prompts",placement:"right"},paramScheduler:{placement:"right",href:"https://support.invoke.ai/support/solutions/articles/151000159073"},paramModel:{placement:"right",href:"https://support.invoke.ai/support/solutions/articles/151000096601-what-is-a-model-which-should-i-use-"},paramRatio:{gutter:16},controlNetControlMode:{placement:"right"},controlNetResizeMode:{placement:"right"},paramVAE:{placement:"right"},paramVAEPrecision:{placement:"right"}},bie=1e3,yie=[{name:"preventOverflow",options:{padding:10}}],EO=je(({feature:e,children:t,wrapperProps:n,...r},o)=>{const{t:s}=Z(),i=W(g=>g.system.shouldEnableInformationalPopovers),l=d.useMemo(()=>xie[e],[e]),u=d.useMemo(()=>jA(_A(l,["image","href","buttonLabel"]),r),[l,r]),p=d.useMemo(()=>s(`popovers.${e}.heading`),[e,s]),m=d.useMemo(()=>s(`popovers.${e}.paragraphs`,{returnObjects:!0})??[],[e,s]),h=d.useCallback(()=>{l!=null&&l.href&&window.open(l.href)},[l==null?void 0:l.href]);return i?a.jsxs(Ld,{isLazy:!0,closeOnBlur:!1,trigger:"hover",variant:"informational",openDelay:bie,modifiers:yie,placement:"top",...u,children:[a.jsx(Wh,{children:a.jsx(Ie,{ref:o,w:"full",...n,children:t})}),a.jsx(Ac,{children:a.jsxs(zd,{w:96,children:[a.jsx(V3,{}),a.jsx(Uh,{children:a.jsxs(L,{sx:{gap:2,flexDirection:"column",alignItems:"flex-start"},children:[p&&a.jsxs(a.Fragment,{children:[a.jsx(cr,{size:"sm",children:p}),a.jsx(Yn,{})]}),(l==null?void 0:l.image)&&a.jsxs(a.Fragment,{children:[a.jsx(ga,{sx:{objectFit:"contain",maxW:"60%",maxH:"60%",backgroundColor:"white"},src:l.image,alt:"Optional Image"}),a.jsx(Yn,{})]}),m.map(g=>a.jsx(ve,{children:g},g)),(l==null?void 0:l.href)&&a.jsxs(a.Fragment,{children:[a.jsx(Yn,{}),a.jsx(Za,{pt:1,onClick:h,leftIcon:a.jsx(py,{}),alignSelf:"flex-end",variant:"link",children:s("common.learnMore")??p})]})]})})]})})]}):a.jsx(Ie,{ref:o,w:"full",...n,children:t})});EO.displayName="IAIInformationalPopover";const Et=d.memo(EO),Cie=le([xe],e=>{const{initial:t,min:n,sliderMax:r,inputMax:o,fineStep:s,coarseStep:i}=e.config.sd.iterations,{iterations:l}=e.generation,{shouldUseSliders:u}=e.ui,p=e.hotkeys.shift?s:i;return{iterations:l,initial:t,min:n,sliderMax:r,inputMax:o,step:p,shouldUseSliders:u}},Se),wie=({asSlider:e})=>{const{iterations:t,initial:n,min:r,sliderMax:o,inputMax:s,step:i,shouldUseSliders:l}=W(Cie),u=te(),{t:p}=Z(),m=d.useCallback(g=>{u(xw(g))},[u]),h=d.useCallback(()=>{u(xw(n))},[u,n]);return e||l?a.jsx(Et,{feature:"paramIterations",children:a.jsx(tt,{label:p("parameters.iterations"),step:i,min:r,max:o,onChange:m,handleReset:h,value:t,withInput:!0,withReset:!0,withSliderMarks:!0,sliderNumberInputProps:{max:s}})}):a.jsx(Et,{feature:"paramIterations",children:a.jsx(Kc,{label:p("parameters.iterations"),step:i,min:r,max:s,onChange:m,value:t,numberInputFieldProps:{textAlign:"center"}})})},rs=d.memo(wie),Sie=()=>{const[e,t]=d.useState(!1),[n,r]=d.useState(!1),o=d.useRef(null),s=Jy(),i=d.useCallback(()=>{o.current&&o.current.setLayout([50,50])},[]);return a.jsxs(L,{sx:{flexDir:"column",gap:2,height:"100%",width:"100%"},children:[a.jsx(Q8,{}),a.jsx(L,{layerStyle:"first",sx:{w:"full",position:"relative",borderRadius:"base",p:2,pb:3,gap:2,flexDir:"column"},children:a.jsx(rs,{asSlider:!0})}),a.jsxs(Ig,{ref:o,id:"workflow-panel-group",autoSaveId:"workflow-panel-group",direction:"vertical",style:{height:"100%",width:"100%"},storage:s,children:[a.jsx(Qa,{id:"workflow",collapsible:!0,onCollapse:t,minSize:25,children:a.jsx(vie,{})}),a.jsx(lh,{direction:"vertical",onDoubleClick:i,collapsedDirection:e?"top":n?"bottom":void 0}),a.jsx(Qa,{id:"inspector",collapsible:!0,onCollapse:r,minSize:25,children:a.jsx(rae,{})})]})]})},kie=d.memo(Sie),Zj=(e,t)=>{const n=d.useRef(null),[r,o]=d.useState(()=>{var p;return!!((p=n.current)!=null&&p.getCollapsed())}),s=d.useCallback(()=>{var p;(p=n.current)!=null&&p.getCollapsed()?qr.flushSync(()=>{var m;(m=n.current)==null||m.expand()}):qr.flushSync(()=>{var m;(m=n.current)==null||m.collapse()})},[]),i=d.useCallback(()=>{qr.flushSync(()=>{var p;(p=n.current)==null||p.expand()})},[]),l=d.useCallback(()=>{qr.flushSync(()=>{var p;(p=n.current)==null||p.collapse()})},[]),u=d.useCallback(()=>{qr.flushSync(()=>{var p;(p=n.current)==null||p.resize(e,t)})},[e,t]);return{ref:n,minSize:e,isCollapsed:r,setIsCollapsed:o,reset:u,toggle:s,expand:i,collapse:l}},jie=({isGalleryCollapsed:e,galleryPanelRef:t})=>{const{t:n}=Z(),r=()=>{var o;(o=t.current)==null||o.expand()};return e?a.jsx(Ac,{children:a.jsx(L,{pos:"absolute",transform:"translate(0, -50%)",minW:8,top:"50%",insetInlineEnd:"1.63rem",children:a.jsx(Fe,{tooltip:"Show Gallery (G)",tooltipProps:{placement:"top"},"aria-label":n("accessibility.showGalleryPanel"),onClick:r,icon:a.jsx(_oe,{}),sx:{p:0,px:3,h:48,borderEndRadius:0}})})}):null},_ie=d.memo(jie),Op={borderStartRadius:0,flexGrow:1},Iie=({isSidePanelCollapsed:e,sidePanelRef:t})=>{const{t:n}=Z(),r=()=>{var o;(o=t.current)==null||o.expand()};return e?a.jsx(Ac,{children:a.jsxs(L,{pos:"absolute",transform:"translate(0, -50%)",minW:8,top:"50%",insetInlineStart:"5.13rem",direction:"column",gap:2,h:48,children:[a.jsxs(Vt,{isAttached:!0,orientation:"vertical",flexGrow:3,children:[a.jsx(Fe,{tooltip:n("parameters.showOptionsPanel"),"aria-label":n("parameters.showOptionsPanel"),onClick:r,sx:Op,icon:a.jsx(xM,{})}),a.jsx(K8,{asIconButton:!0,sx:Op}),a.jsx(H8,{asIconButton:!0,sx:Op})]}),a.jsx(qy,{asIconButton:!0,sx:Op})]})}):null},Pie=d.memo(Iie),Eie=e=>{const{label:t,activeLabel:n,children:r,defaultIsOpen:o=!1}=e,{isOpen:s,onToggle:i}=Lr({defaultIsOpen:o}),{colorMode:l}=ha();return a.jsxs(Ie,{children:[a.jsxs(L,{onClick:i,sx:{alignItems:"center",p:2,px:4,gap:2,borderTopRadius:"base",borderBottomRadius:s?0:"base",bg:Ae("base.250","base.750")(l),color:Ae("base.900","base.100")(l),_hover:{bg:Ae("base.300","base.700")(l)},fontSize:"sm",fontWeight:600,cursor:"pointer",transitionProperty:"common",transitionDuration:"normal",userSelect:"none"},"data-testid":`${t} collapsible`,children:[t,a.jsx(dr,{children:n&&a.jsx(In.div,{initial:{opacity:0},animate:{opacity:1,transition:{duration:.1}},exit:{opacity:0,transition:{duration:.1}},children:a.jsx(ve,{sx:{color:"accent.500",_dark:{color:"accent.300"}},children:n})},"statusText")}),a.jsx(ba,{}),a.jsx(gg,{sx:{w:"1rem",h:"1rem",transform:s?"rotate(0deg)":"rotate(180deg)",transitionProperty:"common",transitionDuration:"normal"}})]}),a.jsx(Id,{in:s,animateOpacity:!0,style:{overflow:"unset"},children:a.jsx(Ie,{sx:{p:4,pb:4,borderBottomRadius:"base",bg:"base.150",_dark:{bg:"base.800"}},children:r})})]})},oo=d.memo(Eie),Mie=le(xe,e=>{const{maxPrompts:t,combinatorial:n}=e.dynamicPrompts,{min:r,sliderMax:o,inputMax:s}=e.config.sd.dynamicPrompts.maxPrompts;return{maxPrompts:t,min:r,sliderMax:o,inputMax:s,isDisabled:!n}},Se),Oie=()=>{const{maxPrompts:e,min:t,sliderMax:n,inputMax:r,isDisabled:o}=W(Mie),s=te(),{t:i}=Z(),l=d.useCallback(p=>{s(IA(p))},[s]),u=d.useCallback(()=>{s(PA())},[s]);return a.jsx(Et,{feature:"dynamicPromptsMaxPrompts",children:a.jsx(tt,{label:i("dynamicPrompts.maxPrompts"),isDisabled:o,min:t,max:n,value:e,onChange:l,sliderNumberInputProps:{max:r},withSliderMarks:!0,withInput:!0,withReset:!0,handleReset:u})})},Rie=d.memo(Oie),Die=le(xe,e=>{const{isLoading:t,isError:n,prompts:r,parsingError:o}=e.dynamicPrompts;return{prompts:r,parsingError:o,isError:n,isLoading:t}},Se),Aie={"&::marker":{color:"base.500",_dark:{color:"base.500"}}},Tie=()=>{const{prompts:e,parsingError:t,isLoading:n,isError:r}=W(Die);return r?a.jsx(Et,{feature:"dynamicPrompts",children:a.jsx(L,{w:"full",h:"full",layerStyle:"second",alignItems:"center",justifyContent:"center",p:8,children:a.jsx(Zn,{icon:yoe,label:"Problem generating prompts"})})}):a.jsx(Et,{feature:"dynamicPrompts",children:a.jsxs(Kt,{isInvalid:!!t,children:[a.jsxs(wn,{whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",children:["Prompts Preview (",e.length,")",t&&` - ${t}`]}),a.jsxs(L,{h:64,pos:"relative",layerStyle:"third",borderRadius:"base",p:2,children:[a.jsx(Zd,{children:a.jsx(d3,{stylePosition:"inside",ms:0,children:e.map((o,s)=>a.jsx(Qr,{fontSize:"sm",sx:Aie,children:a.jsx(ve,{as:"span",children:o})},`${o}.${s}`))})}),n&&a.jsx(L,{pos:"absolute",w:"full",h:"full",top:0,insetInlineStart:0,layerStyle:"second",opacity:.7,alignItems:"center",justifyContent:"center",children:a.jsx(fa,{})})]})]})})},Nie=d.memo(Tie),MO=d.forwardRef(({label:e,description:t,...n},r)=>a.jsx(Ie,{ref:r,...n,children:a.jsxs(Ie,{children:[a.jsx(ve,{fontWeight:600,children:e}),t&&a.jsx(ve,{size:"xs",variant:"subtext",children:t})]})}));MO.displayName="IAIMantineSelectItemWithDescription";const $ie=d.memo(MO),Lie=()=>{const e=te(),{t}=Z(),n=W(s=>s.dynamicPrompts.seedBehaviour),r=d.useMemo(()=>[{value:"PER_ITERATION",label:t("dynamicPrompts.seedBehaviour.perIterationLabel"),description:t("dynamicPrompts.seedBehaviour.perIterationDesc")},{value:"PER_PROMPT",label:t("dynamicPrompts.seedBehaviour.perPromptLabel"),description:t("dynamicPrompts.seedBehaviour.perPromptDesc")}],[t]),o=d.useCallback(s=>{s&&e(EA(s))},[e]);return a.jsx(Et,{feature:"dynamicPromptsSeedBehaviour",children:a.jsx(Pn,{label:t("dynamicPrompts.seedBehaviour.label"),value:n,data:r,itemComponent:$ie,onChange:o})})},zie=d.memo(Lie),Fie=()=>{const{t:e}=Z(),t=d.useMemo(()=>le(xe,({dynamicPrompts:o})=>{const s=o.prompts.length;return s===1?e("dynamicPrompts.promptsWithCount_one",{count:s}):e("dynamicPrompts.promptsWithCount_other",{count:s})}),[e]),n=W(t);return Bt("dynamicPrompting").isFeatureEnabled?a.jsx(oo,{label:e("dynamicPrompts.dynamicPrompts"),activeLabel:n,children:a.jsxs(L,{sx:{gap:2,flexDir:"column"},children:[a.jsx(Nie,{}),a.jsx(zie,{}),a.jsx(Rie,{})]})}):null},qc=d.memo(Fie),Bie=e=>{const t=te(),{lora:n}=e,r=d.useCallback(i=>{t(MA({id:n.id,weight:i}))},[t,n.id]),o=d.useCallback(()=>{t(OA(n.id))},[t,n.id]),s=d.useCallback(()=>{t(RA(n.id))},[t,n.id]);return a.jsx(Et,{feature:"lora",children:a.jsxs(L,{sx:{gap:2.5,alignItems:"flex-end"},children:[a.jsx(tt,{label:n.model_name,value:n.weight,onChange:r,min:-1,max:2,step:.01,withInput:!0,withReset:!0,handleReset:o,withSliderMarks:!0,sliderMarks:[-1,0,1,2],sliderNumberInputProps:{min:-50,max:50}}),a.jsx(Fe,{size:"sm",onClick:s,tooltip:"Remove LoRA","aria-label":"Remove LoRA",icon:a.jsx(Br,{}),colorScheme:"error"})]})})},Hie=d.memo(Bie),Vie=le(xe,({lora:e})=>({lorasArray:nr(e.loras)}),Se),Wie=()=>{const{lorasArray:e}=W(Vie);return a.jsx(a.Fragment,{children:e.map((t,n)=>a.jsxs(L,{sx:{flexDirection:"column",gap:2},children:[n>0&&a.jsx(Yn,{pt:1}),a.jsx(Hie,{lora:t})]},t.model_name))})},Uie=d.memo(Wie),Gie=le(xe,({lora:e})=>({loras:e.loras}),Se),Kie=()=>{const e=te(),{loras:t}=W(Gie),{data:n}=Cd(),r=W(i=>i.generation.model),o=d.useMemo(()=>{if(!n)return[];const i=[];return Rn(n.entities,(l,u)=>{if(!l||u in t)return;const p=(r==null?void 0:r.base_model)!==l.base_model;i.push({value:u,label:l.model_name,disabled:p,group:an[l.base_model],tooltip:p?`Incompatible base model: ${l.base_model}`:void 0})}),i.sort((l,u)=>l.label&&!u.label?1:-1),i.sort((l,u)=>l.disabled&&!u.disabled?1:-1)},[t,n,r==null?void 0:r.base_model]),s=d.useCallback(i=>{if(!i)return;const l=n==null?void 0:n.entities[i];l&&e(DA(l))},[e,n==null?void 0:n.entities]);return(n==null?void 0:n.ids.length)===0?a.jsx(L,{sx:{justifyContent:"center",p:2},children:a.jsx(ve,{sx:{fontSize:"sm",color:"base.500",_dark:"base.700"},children:"No LoRAs Loaded"})}):a.jsx(nn,{placeholder:o.length===0?"All LoRAs added":"Add LoRA",value:null,data:o,nothingFound:"No matching LoRAs",itemComponent:ui,disabled:o.length===0,filter:(i,l)=>{var u;return((u=l.label)==null?void 0:u.toLowerCase().includes(i.toLowerCase().trim()))||l.value.toLowerCase().includes(i.toLowerCase().trim())},onChange:s,"data-testid":"add-lora"})},qie=d.memo(Kie),Xie=le(xe,e=>{const t=II(e.lora.loras);return{activeLabel:t>0?`${t} Active`:void 0}},Se),Qie=()=>{const{activeLabel:e}=W(Xie);return Bt("lora").isFeatureEnabled?a.jsx(oo,{label:"LoRA",activeLabel:e,children:a.jsxs(L,{sx:{flexDir:"column",gap:2},children:[a.jsx(qie,{}),a.jsx(Uie,{})]})}):null},Xc=d.memo(Qie),Yie=()=>{const e=te(),t=W(o=>o.generation.shouldUseCpuNoise),{t:n}=Z(),r=d.useCallback(o=>{e(AA(o.target.checked))},[e]);return a.jsx(Et,{feature:"noiseUseCPU",children:a.jsx(fn,{label:n("parameters.useCpuNoise"),isChecked:t,onChange:r})})},os=e=>e.generation,Zie=le(os,e=>{const{seamlessXAxis:t}=e;return{seamlessXAxis:t}},Se),Jie=()=>{const{t:e}=Z(),{seamlessXAxis:t}=W(Zie),n=te(),r=d.useCallback(o=>{n(TA(o.target.checked))},[n]);return a.jsx(fn,{label:e("parameters.seamlessXAxis"),"aria-label":e("parameters.seamlessXAxis"),isChecked:t,onChange:r})},ele=d.memo(Jie),tle=le(os,e=>{const{seamlessYAxis:t}=e;return{seamlessYAxis:t}},Se),nle=()=>{const{t:e}=Z(),{seamlessYAxis:t}=W(tle),n=te(),r=d.useCallback(o=>{n(NA(o.target.checked))},[n]);return a.jsx(fn,{label:e("parameters.seamlessYAxis"),"aria-label":e("parameters.seamlessYAxis"),isChecked:t,onChange:r})},rle=d.memo(nle),ole=()=>{const{t:e}=Z();return Bt("seamless").isFeatureEnabled?a.jsxs(Kt,{children:[a.jsx(wn,{children:e("parameters.seamlessTiling")})," ",a.jsxs(L,{sx:{gap:5},children:[a.jsx(Ie,{flexGrow:1,children:a.jsx(ele,{})}),a.jsx(Ie,{flexGrow:1,children:a.jsx(rle,{})})]})]}):null},sle=d.memo(ole);function ale(){const e=W(u=>u.generation.clipSkip),{model:t}=W(u=>u.generation),n=te(),{t:r}=Z(),o=d.useCallback(u=>{n(bw(u))},[n]),s=d.useCallback(()=>{n(bw(0))},[n]),i=d.useMemo(()=>t?Qf[t.base_model].maxClip:Qf["sd-1"].maxClip,[t]),l=d.useMemo(()=>t?Qf[t.base_model].markers:Qf["sd-1"].markers,[t]);return(t==null?void 0:t.base_model)==="sdxl"?null:a.jsx(Et,{feature:"clipSkip",placement:"top",children:a.jsx(tt,{label:r("parameters.clipSkip"),"aria-label":r("parameters.clipSkip"),min:0,max:i,step:1,value:e,onChange:o,withSliderMarks:!0,sliderMarks:l,withInput:!0,withReset:!0,handleReset:s})})}const ile=le(xe,e=>{const{clipSkip:t,model:n,seamlessXAxis:r,seamlessYAxis:o,shouldUseCpuNoise:s}=e.generation;return{clipSkip:t,model:n,seamlessXAxis:r,seamlessYAxis:o,shouldUseCpuNoise:s}},Se);function Qc(){const{clipSkip:e,model:t,seamlessXAxis:n,seamlessYAxis:r,shouldUseCpuNoise:o}=W(ile),{t:s}=Z(),i=d.useMemo(()=>{const l=[];return o?l.push(s("parameters.cpuNoise")):l.push(s("parameters.gpuNoise")),e>0&&t&&t.base_model!=="sdxl"&&l.push(s("parameters.clipSkipWithLayerCount",{layerCount:e})),n&&r?l.push(s("parameters.seamlessX&Y")):n?l.push(s("parameters.seamlessX")):r&&l.push(s("parameters.seamlessY")),l.join(", ")},[e,t,n,r,o,s]);return a.jsx(oo,{label:s("common.advanced"),activeLabel:i,children:a.jsxs(L,{sx:{flexDir:"column",gap:2},children:[a.jsx(sle,{}),a.jsx(Yn,{}),t&&(t==null?void 0:t.base_model)!=="sdxl"&&a.jsxs(a.Fragment,{children:[a.jsx(ale,{}),a.jsx(Yn,{pt:2})]}),a.jsx(Yie,{})]})})}const lle=le(xe,({generation:e})=>{const{model:t}=e;return{mainModel:t}},Se),cle=e=>{const{controlNetId:t,model:n,isEnabled:r}=e.controlNet,o=te(),{mainModel:s}=W(lle),{t:i}=Z(),{data:l}=gh(),u=d.useMemo(()=>{if(!l)return[];const h=[];return Rn(l.entities,(g,x)=>{if(!g)return;const y=(g==null?void 0:g.base_model)!==(s==null?void 0:s.base_model);h.push({value:x,label:g.model_name,group:an[g.base_model],disabled:y,tooltip:y?`${i("controlnet.incompatibleBaseModel")} ${g.base_model}`:void 0})}),h},[l,s==null?void 0:s.base_model,i]),p=d.useMemo(()=>(l==null?void 0:l.entities[`${n==null?void 0:n.base_model}/controlnet/${n==null?void 0:n.model_name}`])??null,[n==null?void 0:n.base_model,n==null?void 0:n.model_name,l==null?void 0:l.entities]),m=d.useCallback(h=>{if(!h)return;const g=wO(h);g&&o(PI({controlNetId:t,model:g}))},[t,o]);return a.jsx(nn,{itemComponent:ui,data:u,error:!p||(s==null?void 0:s.base_model)!==p.base_model,placeholder:i("controlnet.selectModel"),value:(p==null?void 0:p.id)??null,onChange:m,disabled:!r,tooltip:p==null?void 0:p.description})},ule=d.memo(cle),dle=e=>{const{weight:t,isEnabled:n,controlNetId:r}=e.controlNet,o=te(),{t:s}=Z(),i=d.useCallback(l=>{o($A({controlNetId:r,weight:l}))},[r,o]);return a.jsx(Et,{feature:"controlNetWeight",children:a.jsx(tt,{isDisabled:!n,label:s("controlnet.weight"),value:t,onChange:i,min:0,max:2,step:.01,withSliderMarks:!0,sliderMarks:[0,1,2]})})},fle=d.memo(dle),ple=le(xe,({controlNet:e,gallery:t})=>{const{pendingControlImages:n}=e,{autoAddBoardId:r}=t;return{pendingControlImages:n,autoAddBoardId:r}},Se),mle=({isSmall:e,controlNet:t})=>{const{controlImage:n,processedControlImage:r,processorType:o,controlNetId:s}=t,i=te(),{t:l}=Z(),{pendingControlImages:u,autoAddBoardId:p}=W(ple),m=W(Jn),[h,g]=d.useState(!1),{currentData:x}=to(n??$r.skipToken),{currentData:y}=to(r??$r.skipToken),[b]=LA(),[w]=zA(),[S]=FA(),j=d.useCallback(()=>{i(BA({controlNetId:s,controlImage:null}))},[s,i]),_=d.useCallback(async()=>{y&&(await b({imageDTO:y,is_intermediate:!1}).unwrap(),p!=="none"?w({imageDTO:y,board_id:p}):S({imageDTO:y}))},[y,b,p,w,S]),E=d.useCallback(()=>{x&&(m==="unifiedCanvas"?i(Vo({width:x.width,height:x.height})):(i(Hi(x.width)),i(Vi(x.height))))},[x,m,i]),I=d.useCallback(()=>{g(!0)},[]),M=d.useCallback(()=>{g(!1)},[]),R=d.useMemo(()=>{if(x)return{id:s,payloadType:"IMAGE_DTO",payload:{imageDTO:x}}},[x,s]),D=d.useMemo(()=>({id:s,actionType:"SET_CONTROLNET_IMAGE",context:{controlNetId:s}}),[s]),A=d.useMemo(()=>({type:"SET_CONTROLNET_IMAGE",controlNetId:s}),[s]),O=x&&y&&!h&&!u.includes(s)&&o!=="none";return a.jsxs(L,{onMouseEnter:I,onMouseLeave:M,sx:{position:"relative",w:"full",h:e?28:366,alignItems:"center",justifyContent:"center"},children:[a.jsx(ua,{draggableData:R,droppableData:D,imageDTO:x,isDropDisabled:O,postUploadAction:A}),a.jsx(Ie,{sx:{position:"absolute",top:0,insetInlineStart:0,w:"full",h:"full",opacity:O?1:0,transitionProperty:"common",transitionDuration:"normal",pointerEvents:"none"},children:a.jsx(ua,{draggableData:R,droppableData:D,imageDTO:y,isUploadDisabled:!0})}),a.jsxs(a.Fragment,{children:[a.jsx(zi,{onClick:j,icon:x?a.jsx(Ud,{}):void 0,tooltip:l("controlnet.resetControlImage")}),a.jsx(zi,{onClick:_,icon:x?a.jsx(lg,{size:16}):void 0,tooltip:l("controlnet.saveControlImage"),styleOverrides:{marginTop:6}}),a.jsx(zi,{onClick:E,icon:x?a.jsx(ree,{size:16}):void 0,tooltip:l("controlnet.setControlImageDimensions"),styleOverrides:{marginTop:12}})]}),u.includes(s)&&a.jsx(L,{sx:{position:"absolute",top:0,insetInlineStart:0,w:"full",h:"full",alignItems:"center",justifyContent:"center",opacity:.8,borderRadius:"base",bg:"base.400",_dark:{bg:"base.900"}},children:a.jsx(fa,{size:"xl",sx:{color:"base.100",_dark:{color:"base.400"}}})})]})},Jj=d.memo(mle),Io=()=>{const e=te();return d.useCallback((n,r)=>{e(HA({controlNetId:n,changes:r}))},[e])};function Po(e){return a.jsx(L,{sx:{flexDirection:"column",gap:2,pb:2},children:e.children})}const e_=Fr.canny_image_processor.default,hle=e=>{const{controlNetId:t,processorNode:n,isEnabled:r}=e,{low_threshold:o,high_threshold:s}=n,i=Io(),{t:l}=Z(),u=d.useCallback(g=>{i(t,{low_threshold:g})},[t,i]),p=d.useCallback(()=>{i(t,{low_threshold:e_.low_threshold})},[t,i]),m=d.useCallback(g=>{i(t,{high_threshold:g})},[t,i]),h=d.useCallback(()=>{i(t,{high_threshold:e_.high_threshold})},[t,i]);return a.jsxs(Po,{children:[a.jsx(tt,{isDisabled:!r,label:l("controlnet.lowThreshold"),value:o,onChange:u,handleReset:p,withReset:!0,min:0,max:255,withInput:!0,withSliderMarks:!0}),a.jsx(tt,{isDisabled:!r,label:l("controlnet.highThreshold"),value:s,onChange:m,handleReset:h,withReset:!0,min:0,max:255,withInput:!0,withSliderMarks:!0})]})},gle=d.memo(hle),vle=Fr.color_map_image_processor.default,xle=e=>{const{controlNetId:t,processorNode:n,isEnabled:r}=e,{color_map_tile_size:o}=n,s=Io(),{t:i}=Z(),l=d.useCallback(p=>{s(t,{color_map_tile_size:p})},[t,s]),u=d.useCallback(()=>{s(t,{color_map_tile_size:vle.color_map_tile_size})},[t,s]);return a.jsx(Po,{children:a.jsx(tt,{isDisabled:!r,label:i("controlnet.colorMapTileSize"),value:o,onChange:l,handleReset:u,withReset:!0,min:1,max:256,step:1,withInput:!0,withSliderMarks:!0,sliderNumberInputProps:{max:4096}})})},ble=d.memo(xle),_u=Fr.content_shuffle_image_processor.default,yle=e=>{const{controlNetId:t,processorNode:n,isEnabled:r}=e,{image_resolution:o,detect_resolution:s,w:i,h:l,f:u}=n,p=Io(),{t:m}=Z(),h=d.useCallback(I=>{p(t,{detect_resolution:I})},[t,p]),g=d.useCallback(()=>{p(t,{detect_resolution:_u.detect_resolution})},[t,p]),x=d.useCallback(I=>{p(t,{image_resolution:I})},[t,p]),y=d.useCallback(()=>{p(t,{image_resolution:_u.image_resolution})},[t,p]),b=d.useCallback(I=>{p(t,{w:I})},[t,p]),w=d.useCallback(()=>{p(t,{w:_u.w})},[t,p]),S=d.useCallback(I=>{p(t,{h:I})},[t,p]),j=d.useCallback(()=>{p(t,{h:_u.h})},[t,p]),_=d.useCallback(I=>{p(t,{f:I})},[t,p]),E=d.useCallback(()=>{p(t,{f:_u.f})},[t,p]);return a.jsxs(Po,{children:[a.jsx(tt,{label:m("controlnet.detectResolution"),value:s,onChange:h,handleReset:g,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(tt,{label:m("controlnet.imageResolution"),value:o,onChange:x,handleReset:y,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(tt,{label:m("controlnet.w"),value:i,onChange:b,handleReset:w,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(tt,{label:m("controlnet.h"),value:l,onChange:S,handleReset:j,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(tt,{label:m("controlnet.f"),value:u,onChange:_,handleReset:E,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r})]})},Cle=d.memo(yle),t_=Fr.hed_image_processor.default,wle=e=>{const{controlNetId:t,processorNode:{detect_resolution:n,image_resolution:r,scribble:o},isEnabled:s}=e,i=Io(),{t:l}=Z(),u=d.useCallback(x=>{i(t,{detect_resolution:x})},[t,i]),p=d.useCallback(x=>{i(t,{image_resolution:x})},[t,i]),m=d.useCallback(x=>{i(t,{scribble:x.target.checked})},[t,i]),h=d.useCallback(()=>{i(t,{detect_resolution:t_.detect_resolution})},[t,i]),g=d.useCallback(()=>{i(t,{image_resolution:t_.image_resolution})},[t,i]);return a.jsxs(Po,{children:[a.jsx(tt,{label:l("controlnet.detectResolution"),value:n,onChange:u,handleReset:h,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!s}),a.jsx(tt,{label:l("controlnet.imageResolution"),value:r,onChange:p,handleReset:g,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!s}),a.jsx(fn,{label:l("controlnet.scribble"),isChecked:o,onChange:m,isDisabled:!s})]})},Sle=d.memo(wle),n_=Fr.lineart_anime_image_processor.default,kle=e=>{const{controlNetId:t,processorNode:n,isEnabled:r}=e,{image_resolution:o,detect_resolution:s}=n,i=Io(),{t:l}=Z(),u=d.useCallback(g=>{i(t,{detect_resolution:g})},[t,i]),p=d.useCallback(g=>{i(t,{image_resolution:g})},[t,i]),m=d.useCallback(()=>{i(t,{detect_resolution:n_.detect_resolution})},[t,i]),h=d.useCallback(()=>{i(t,{image_resolution:n_.image_resolution})},[t,i]);return a.jsxs(Po,{children:[a.jsx(tt,{label:l("controlnet.detectResolution"),value:s,onChange:u,handleReset:m,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(tt,{label:l("controlnet.imageResolution"),value:o,onChange:p,handleReset:h,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r})]})},jle=d.memo(kle),r_=Fr.lineart_image_processor.default,_le=e=>{const{controlNetId:t,processorNode:n,isEnabled:r}=e,{image_resolution:o,detect_resolution:s,coarse:i}=n,l=Io(),{t:u}=Z(),p=d.useCallback(y=>{l(t,{detect_resolution:y})},[t,l]),m=d.useCallback(y=>{l(t,{image_resolution:y})},[t,l]),h=d.useCallback(()=>{l(t,{detect_resolution:r_.detect_resolution})},[t,l]),g=d.useCallback(()=>{l(t,{image_resolution:r_.image_resolution})},[t,l]),x=d.useCallback(y=>{l(t,{coarse:y.target.checked})},[t,l]);return a.jsxs(Po,{children:[a.jsx(tt,{label:u("controlnet.detectResolution"),value:s,onChange:p,handleReset:h,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(tt,{label:u("controlnet.imageResolution"),value:o,onChange:m,handleReset:g,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(fn,{label:u("controlnet.coarse"),isChecked:i,onChange:x,isDisabled:!r})]})},Ile=d.memo(_le),o_=Fr.mediapipe_face_processor.default,Ple=e=>{const{controlNetId:t,processorNode:n,isEnabled:r}=e,{max_faces:o,min_confidence:s}=n,i=Io(),{t:l}=Z(),u=d.useCallback(g=>{i(t,{max_faces:g})},[t,i]),p=d.useCallback(g=>{i(t,{min_confidence:g})},[t,i]),m=d.useCallback(()=>{i(t,{max_faces:o_.max_faces})},[t,i]),h=d.useCallback(()=>{i(t,{min_confidence:o_.min_confidence})},[t,i]);return a.jsxs(Po,{children:[a.jsx(tt,{label:l("controlnet.maxFaces"),value:o,onChange:u,handleReset:m,withReset:!0,min:1,max:20,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(tt,{label:l("controlnet.minConfidence"),value:s,onChange:p,handleReset:h,withReset:!0,min:0,max:1,step:.01,withInput:!0,withSliderMarks:!0,isDisabled:!r})]})},Ele=d.memo(Ple),s_=Fr.midas_depth_image_processor.default,Mle=e=>{const{controlNetId:t,processorNode:n,isEnabled:r}=e,{a_mult:o,bg_th:s}=n,i=Io(),{t:l}=Z(),u=d.useCallback(g=>{i(t,{a_mult:g})},[t,i]),p=d.useCallback(g=>{i(t,{bg_th:g})},[t,i]),m=d.useCallback(()=>{i(t,{a_mult:s_.a_mult})},[t,i]),h=d.useCallback(()=>{i(t,{bg_th:s_.bg_th})},[t,i]);return a.jsxs(Po,{children:[a.jsx(tt,{label:l("controlnet.amult"),value:o,onChange:u,handleReset:m,withReset:!0,min:0,max:20,step:.01,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(tt,{label:l("controlnet.bgth"),value:s,onChange:p,handleReset:h,withReset:!0,min:0,max:20,step:.01,withInput:!0,withSliderMarks:!0,isDisabled:!r})]})},Ole=d.memo(Mle),Rp=Fr.mlsd_image_processor.default,Rle=e=>{const{controlNetId:t,processorNode:n,isEnabled:r}=e,{image_resolution:o,detect_resolution:s,thr_d:i,thr_v:l}=n,u=Io(),{t:p}=Z(),m=d.useCallback(j=>{u(t,{detect_resolution:j})},[t,u]),h=d.useCallback(j=>{u(t,{image_resolution:j})},[t,u]),g=d.useCallback(j=>{u(t,{thr_d:j})},[t,u]),x=d.useCallback(j=>{u(t,{thr_v:j})},[t,u]),y=d.useCallback(()=>{u(t,{detect_resolution:Rp.detect_resolution})},[t,u]),b=d.useCallback(()=>{u(t,{image_resolution:Rp.image_resolution})},[t,u]),w=d.useCallback(()=>{u(t,{thr_d:Rp.thr_d})},[t,u]),S=d.useCallback(()=>{u(t,{thr_v:Rp.thr_v})},[t,u]);return a.jsxs(Po,{children:[a.jsx(tt,{label:p("controlnet.detectResolution"),value:s,onChange:m,handleReset:y,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(tt,{label:p("controlnet.imageResolution"),value:o,onChange:h,handleReset:b,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(tt,{label:p("controlnet.w"),value:i,onChange:g,handleReset:w,withReset:!0,min:0,max:1,step:.01,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(tt,{label:p("controlnet.h"),value:l,onChange:x,handleReset:S,withReset:!0,min:0,max:1,step:.01,withInput:!0,withSliderMarks:!0,isDisabled:!r})]})},Dle=d.memo(Rle),a_=Fr.normalbae_image_processor.default,Ale=e=>{const{controlNetId:t,processorNode:n,isEnabled:r}=e,{image_resolution:o,detect_resolution:s}=n,i=Io(),{t:l}=Z(),u=d.useCallback(g=>{i(t,{detect_resolution:g})},[t,i]),p=d.useCallback(g=>{i(t,{image_resolution:g})},[t,i]),m=d.useCallback(()=>{i(t,{detect_resolution:a_.detect_resolution})},[t,i]),h=d.useCallback(()=>{i(t,{image_resolution:a_.image_resolution})},[t,i]);return a.jsxs(Po,{children:[a.jsx(tt,{label:l("controlnet.detectResolution"),value:s,onChange:u,handleReset:m,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(tt,{label:l("controlnet.imageResolution"),value:o,onChange:p,handleReset:h,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r})]})},Tle=d.memo(Ale),i_=Fr.openpose_image_processor.default,Nle=e=>{const{controlNetId:t,processorNode:n,isEnabled:r}=e,{image_resolution:o,detect_resolution:s,hand_and_face:i}=n,l=Io(),{t:u}=Z(),p=d.useCallback(y=>{l(t,{detect_resolution:y})},[t,l]),m=d.useCallback(y=>{l(t,{image_resolution:y})},[t,l]),h=d.useCallback(()=>{l(t,{detect_resolution:i_.detect_resolution})},[t,l]),g=d.useCallback(()=>{l(t,{image_resolution:i_.image_resolution})},[t,l]),x=d.useCallback(y=>{l(t,{hand_and_face:y.target.checked})},[t,l]);return a.jsxs(Po,{children:[a.jsx(tt,{label:u("controlnet.detectResolution"),value:s,onChange:p,handleReset:h,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(tt,{label:u("controlnet.imageResolution"),value:o,onChange:m,handleReset:g,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(fn,{label:u("controlnet.handAndFace"),isChecked:i,onChange:x,isDisabled:!r})]})},$le=d.memo(Nle),l_=Fr.pidi_image_processor.default,Lle=e=>{const{controlNetId:t,processorNode:n,isEnabled:r}=e,{image_resolution:o,detect_resolution:s,scribble:i,safe:l}=n,u=Io(),{t:p}=Z(),m=d.useCallback(w=>{u(t,{detect_resolution:w})},[t,u]),h=d.useCallback(w=>{u(t,{image_resolution:w})},[t,u]),g=d.useCallback(()=>{u(t,{detect_resolution:l_.detect_resolution})},[t,u]),x=d.useCallback(()=>{u(t,{image_resolution:l_.image_resolution})},[t,u]),y=d.useCallback(w=>{u(t,{scribble:w.target.checked})},[t,u]),b=d.useCallback(w=>{u(t,{safe:w.target.checked})},[t,u]);return a.jsxs(Po,{children:[a.jsx(tt,{label:p("controlnet.detectResolution"),value:s,onChange:m,handleReset:g,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(tt,{label:p("controlnet.imageResolution"),value:o,onChange:h,handleReset:x,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(fn,{label:p("controlnet.scribble"),isChecked:i,onChange:y}),a.jsx(fn,{label:p("controlnet.safe"),isChecked:l,onChange:b,isDisabled:!r})]})},zle=d.memo(Lle),Fle=e=>null,Ble=d.memo(Fle),Hle=e=>{const{controlNetId:t,isEnabled:n,processorNode:r}=e.controlNet;return r.type==="canny_image_processor"?a.jsx(gle,{controlNetId:t,processorNode:r,isEnabled:n}):r.type==="color_map_image_processor"?a.jsx(ble,{controlNetId:t,processorNode:r,isEnabled:n}):r.type==="hed_image_processor"?a.jsx(Sle,{controlNetId:t,processorNode:r,isEnabled:n}):r.type==="lineart_image_processor"?a.jsx(Ile,{controlNetId:t,processorNode:r,isEnabled:n}):r.type==="content_shuffle_image_processor"?a.jsx(Cle,{controlNetId:t,processorNode:r,isEnabled:n}):r.type==="lineart_anime_image_processor"?a.jsx(jle,{controlNetId:t,processorNode:r,isEnabled:n}):r.type==="mediapipe_face_processor"?a.jsx(Ele,{controlNetId:t,processorNode:r,isEnabled:n}):r.type==="midas_depth_image_processor"?a.jsx(Ole,{controlNetId:t,processorNode:r,isEnabled:n}):r.type==="mlsd_image_processor"?a.jsx(Dle,{controlNetId:t,processorNode:r,isEnabled:n}):r.type==="normalbae_image_processor"?a.jsx(Tle,{controlNetId:t,processorNode:r,isEnabled:n}):r.type==="openpose_image_processor"?a.jsx($le,{controlNetId:t,processorNode:r,isEnabled:n}):r.type==="pidi_image_processor"?a.jsx(zle,{controlNetId:t,processorNode:r,isEnabled:n}):r.type==="zoe_depth_image_processor"?a.jsx(Ble,{controlNetId:t,processorNode:r,isEnabled:n}):null},Vle=d.memo(Hle),Wle=e=>{const{controlNetId:t,isEnabled:n,shouldAutoConfig:r}=e.controlNet,o=te(),{t:s}=Z(),i=d.useCallback(()=>{o(VA({controlNetId:t}))},[t,o]);return a.jsx(fn,{label:s("controlnet.autoConfigure"),"aria-label":s("controlnet.autoConfigure"),isChecked:r,onChange:i,isDisabled:!n})},Ule=d.memo(Wle),Gle=e=>{const{controlNet:t}=e,n=te(),{t:r}=Z(),o=d.useCallback(()=>{n(WA({controlNet:t}))},[t,n]),s=d.useCallback(()=>{n(UA({controlNet:t}))},[t,n]);return a.jsxs(L,{sx:{gap:2},children:[a.jsx(Fe,{size:"sm",icon:a.jsx(Yi,{}),tooltip:r("controlnet.importImageFromCanvas"),"aria-label":r("controlnet.importImageFromCanvas"),onClick:o}),a.jsx(Fe,{size:"sm",icon:a.jsx(hM,{}),tooltip:r("controlnet.importMaskFromCanvas"),"aria-label":r("controlnet.importMaskFromCanvas"),onClick:s})]})},Kle=d.memo(Gle),c_=e=>`${Math.round(e*100)}%`,qle=e=>{const{beginStepPct:t,endStepPct:n,isEnabled:r,controlNetId:o}=e.controlNet,s=te(),{t:i}=Z(),l=d.useCallback(u=>{s(GA({controlNetId:o,beginStepPct:u[0]})),s(KA({controlNetId:o,endStepPct:u[1]}))},[o,s]);return a.jsx(Et,{feature:"controlNetBeginEnd",children:a.jsxs(Kt,{isDisabled:!r,children:[a.jsx(wn,{children:i("controlnet.beginEndStepPercent")}),a.jsx(Rh,{w:"100%",gap:2,alignItems:"center",children:a.jsxs(Bb,{"aria-label":["Begin Step %","End Step %!"],value:[t,n],onChange:l,min:0,max:1,step:.01,minStepsBetweenThumbs:5,isDisabled:!r,children:[a.jsx(Hb,{children:a.jsx(Vb,{})}),a.jsx(Ht,{label:c_(t),placement:"top",hasArrow:!0,children:a.jsx(nd,{index:0})}),a.jsx(Ht,{label:c_(n),placement:"top",hasArrow:!0,children:a.jsx(nd,{index:1})}),a.jsx(Ti,{value:0,sx:{insetInlineStart:"0 !important",insetInlineEnd:"unset !important"},children:"0%"}),a.jsx(Ti,{value:.5,sx:{insetInlineStart:"50% !important",transform:"translateX(-50%)"},children:"50%"}),a.jsx(Ti,{value:1,sx:{insetInlineStart:"unset !important",insetInlineEnd:"0 !important"},children:"100%"})]})})]})})},Xle=d.memo(qle);function Qle(e){const{controlMode:t,isEnabled:n,controlNetId:r}=e.controlNet,o=te(),{t:s}=Z(),i=[{label:s("controlnet.balanced"),value:"balanced"},{label:s("controlnet.prompt"),value:"more_prompt"},{label:s("controlnet.control"),value:"more_control"},{label:s("controlnet.megaControl"),value:"unbalanced"}],l=d.useCallback(u=>{o(qA({controlNetId:r,controlMode:u}))},[r,o]);return a.jsx(Et,{feature:"controlNetControlMode",children:a.jsx(Pn,{disabled:!n,label:s("controlnet.controlMode"),data:i,value:String(t),onChange:l})})}const Yle=le(Ky,e=>nr(Fr,n=>({value:n.type,label:n.label})).sort((n,r)=>n.value==="none"?-1:r.value==="none"?1:n.label.localeCompare(r.label)).filter(n=>!e.sd.disabledControlNetProcessors.includes(n.value)),Se),Zle=e=>{const t=te(),{controlNetId:n,isEnabled:r,processorNode:o}=e.controlNet,s=W(Yle),{t:i}=Z(),l=d.useCallback(u=>{t(XA({controlNetId:n,processorType:u}))},[n,t]);return a.jsx(nn,{label:i("controlnet.processor"),value:o.type??"canny_image_processor",data:s,onChange:l,disabled:!r})},Jle=d.memo(Zle);function ece(e){const{resizeMode:t,isEnabled:n,controlNetId:r}=e.controlNet,o=te(),{t:s}=Z(),i=[{label:s("controlnet.resize"),value:"just_resize"},{label:s("controlnet.crop"),value:"crop_resize"},{label:s("controlnet.fill"),value:"fill_resize"}],l=d.useCallback(u=>{o(QA({controlNetId:r,resizeMode:u}))},[r,o]);return a.jsx(Et,{feature:"controlNetResizeMode",children:a.jsx(Pn,{disabled:!n,label:s("controlnet.resizeMode"),data:i,value:String(t),onChange:l})})}const tce=e=>{const{controlNet:t}=e,{controlNetId:n}=t,r=te(),{t:o}=Z(),s=W(Jn),i=le(xe,({controlNet:y})=>{const b=y.controlNets[n];if(!b)return{isEnabled:!1,shouldAutoConfig:!1};const{isEnabled:w,shouldAutoConfig:S}=b;return{isEnabled:w,shouldAutoConfig:S}},Se),{isEnabled:l,shouldAutoConfig:u}=W(i),[p,m]=pee(!1),h=d.useCallback(()=>{r(YA({controlNetId:n}))},[n,r]),g=d.useCallback(()=>{r(ZA({sourceControlNetId:n,newControlNetId:Zs()}))},[n,r]),x=d.useCallback(y=>{r(JA({controlNetId:n,isEnabled:y.target.checked}))},[n,r]);return a.jsxs(L,{sx:{flexDir:"column",gap:3,p:2,borderRadius:"base",position:"relative",bg:"base.250",_dark:{bg:"base.750"}},children:[a.jsxs(L,{sx:{gap:2,alignItems:"center"},children:[a.jsx(fn,{tooltip:o("controlnet.toggleControlNet"),"aria-label":o("controlnet.toggleControlNet"),isChecked:l,onChange:x}),a.jsx(Ie,{sx:{w:"full",minW:0,transitionProperty:"common",transitionDuration:"0.1s"},children:a.jsx(ule,{controlNet:t})}),s==="unifiedCanvas"&&a.jsx(Kle,{controlNet:t}),a.jsx(Fe,{size:"sm",tooltip:o("controlnet.duplicate"),"aria-label":o("controlnet.duplicate"),onClick:g,icon:a.jsx(Hc,{})}),a.jsx(Fe,{size:"sm",tooltip:o("controlnet.delete"),"aria-label":o("controlnet.delete"),colorScheme:"error",onClick:h,icon:a.jsx(Br,{})}),a.jsx(Fe,{size:"sm",tooltip:o(p?"controlnet.hideAdvanced":"controlnet.showAdvanced"),"aria-label":o(p?"controlnet.hideAdvanced":"controlnet.showAdvanced"),onClick:m,variant:"ghost",sx:{_hover:{bg:"none"}},icon:a.jsx(gg,{sx:{boxSize:4,color:"base.700",transform:p?"rotate(0deg)":"rotate(180deg)",transitionProperty:"common",transitionDuration:"normal",_dark:{color:"base.300"}}})}),!u&&a.jsx(Ie,{sx:{position:"absolute",w:1.5,h:1.5,borderRadius:"full",top:4,insetInlineEnd:4,bg:"accent.700",_dark:{bg:"accent.400"}}})]}),a.jsxs(L,{sx:{w:"full",flexDirection:"column",gap:3},children:[a.jsxs(L,{sx:{gap:4,w:"full",alignItems:"center"},children:[a.jsxs(L,{sx:{flexDir:"column",gap:3,h:28,w:"full",paddingInlineStart:1,paddingInlineEnd:p?1:0,pb:2,justifyContent:"space-between"},children:[a.jsx(fle,{controlNet:t}),a.jsx(Xle,{controlNet:t})]}),!p&&a.jsx(L,{sx:{alignItems:"center",justifyContent:"center",h:28,w:28,aspectRatio:"1/1"},children:a.jsx(Jj,{controlNet:t,isSmall:!0})})]}),a.jsxs(L,{sx:{gap:2},children:[a.jsx(Qle,{controlNet:t}),a.jsx(ece,{controlNet:t})]}),a.jsx(Jle,{controlNet:t})]}),p&&a.jsxs(a.Fragment,{children:[a.jsx(Jj,{controlNet:t}),a.jsx(Ule,{controlNet:t}),a.jsx(Vle,{controlNet:t})]})]})},nce=d.memo(tce),u_=e=>`${Math.round(e*100)}%`,rce=()=>{const e=W(i=>i.controlNet.isIPAdapterEnabled),t=W(i=>i.controlNet.ipAdapterInfo.beginStepPct),n=W(i=>i.controlNet.ipAdapterInfo.endStepPct),r=te(),{t:o}=Z(),s=d.useCallback(i=>{r(eT(i[0])),r(tT(i[1]))},[r]);return a.jsxs(Kt,{isDisabled:!e,children:[a.jsx(wn,{children:o("controlnet.beginEndStepPercent")}),a.jsx(Rh,{w:"100%",gap:2,alignItems:"center",children:a.jsxs(Bb,{"aria-label":["Begin Step %","End Step %!"],value:[t,n],onChange:s,min:0,max:1,step:.01,minStepsBetweenThumbs:5,isDisabled:!e,children:[a.jsx(Hb,{children:a.jsx(Vb,{})}),a.jsx(Ht,{label:u_(t),placement:"top",hasArrow:!0,children:a.jsx(nd,{index:0})}),a.jsx(Ht,{label:u_(n),placement:"top",hasArrow:!0,children:a.jsx(nd,{index:1})}),a.jsx(Ti,{value:0,sx:{insetInlineStart:"0 !important",insetInlineEnd:"unset !important"},children:"0%"}),a.jsx(Ti,{value:.5,sx:{insetInlineStart:"50% !important",transform:"translateX(-50%)"},children:"50%"}),a.jsx(Ti,{value:1,sx:{insetInlineStart:"unset !important",insetInlineEnd:"0 !important"},children:"100%"})]})})]})},oce=d.memo(rce),sce=le(xe,e=>{const{isIPAdapterEnabled:t}=e.controlNet;return{isIPAdapterEnabled:t}},Se),ace=()=>{const{isIPAdapterEnabled:e}=W(sce),t=te(),{t:n}=Z(),r=d.useCallback(o=>{t(u1(o.target.checked))},[t]);return a.jsx(fn,{label:n("controlnet.enableIPAdapter"),isChecked:e,onChange:r,formControlProps:{width:"100%"}})},ice=d.memo(ace),lce=le(xe,({controlNet:e})=>{const{ipAdapterInfo:t}=e;return{ipAdapterInfo:t}},Se),cce=()=>{const{ipAdapterInfo:e}=W(lce),t=te(),{t:n}=Z(),{currentData:r}=to(e.adapterImage??$r.skipToken),o=d.useMemo(()=>{if(r)return{id:"ip-adapter-image",payloadType:"IMAGE_DTO",payload:{imageDTO:r}}},[r]),s=d.useMemo(()=>({id:"ip-adapter-image",actionType:"SET_IP_ADAPTER_IMAGE"}),[]),i=d.useMemo(()=>({type:"SET_IP_ADAPTER_IMAGE"}),[]);return a.jsxs(L,{layerStyle:"second",sx:{position:"relative",h:28,w:28,alignItems:"center",justifyContent:"center",aspectRatio:"1/1",borderRadius:"base"},children:[a.jsx(ua,{imageDTO:r,droppableData:s,draggableData:o,postUploadAction:i,dropLabel:n("toast.setIPAdapterImage"),noContentFallback:a.jsx(Zn,{label:n("controlnet.ipAdapterImageFallback")})}),a.jsx(zi,{onClick:()=>t(nT(null)),icon:e.adapterImage?a.jsx(Ud,{}):void 0,tooltip:n("controlnet.resetIPAdapterImage")})]})},uce=d.memo(cce),dce=()=>{const e=W(p=>p.controlNet.isIPAdapterEnabled),t=W(p=>p.controlNet.ipAdapterInfo.model),n=W(p=>p.generation.model),r=te(),{t:o}=Z(),{data:s}=Vx(),i=d.useMemo(()=>(s==null?void 0:s.entities[`${t==null?void 0:t.base_model}/ip_adapter/${t==null?void 0:t.model_name}`])??null,[t==null?void 0:t.base_model,t==null?void 0:t.model_name,s==null?void 0:s.entities]),l=d.useMemo(()=>{if(!s)return[];const p=[];return Rn(s.entities,(m,h)=>{if(!m)return;const g=(n==null?void 0:n.base_model)!==m.base_model;p.push({value:h,label:m.model_name,group:an[m.base_model],disabled:g,tooltip:g?`Incompatible base model: ${m.base_model}`:void 0})}),p.sort((m,h)=>m.disabled&&!h.disabled?1:-1)},[s,n==null?void 0:n.base_model]),u=d.useCallback(p=>{if(!p)return;const m=IO(p);m&&r(rT(m))},[r]);return a.jsx(Pn,{label:o("controlnet.ipAdapterModel"),className:"nowheel nodrag",tooltip:i==null?void 0:i.description,value:(i==null?void 0:i.id)??null,placeholder:l.length>0?o("models.selectModel"):o("models.noModelsAvailable"),error:!i&&l.length>0,data:l,onChange:u,sx:{width:"100%"},disabled:!e||l.length===0})},fce=d.memo(dce),pce=()=>{const e=W(i=>i.controlNet.isIPAdapterEnabled),t=W(i=>i.controlNet.ipAdapterInfo.weight),n=te(),{t:r}=Z(),o=d.useCallback(i=>{n(yw(i))},[n]),s=d.useCallback(()=>{n(yw(1))},[n]);return a.jsx(tt,{isDisabled:!e,label:r("controlnet.weight"),value:t,onChange:o,min:0,max:2,step:.01,withSliderMarks:!0,sliderMarks:[0,1,2],withReset:!0,handleReset:s})},mce=d.memo(pce),hce=le(xe,e=>{const{isIPAdapterEnabled:t}=e.controlNet;return{isIPAdapterEnabled:t}},Se),gce=()=>{const{isIPAdapterEnabled:e}=W(hce);return a.jsxs(L,{sx:{flexDir:"column",gap:3,paddingInline:3,paddingBlock:2,borderRadius:"base",position:"relative",bg:"base.250",_dark:{bg:"base.750"}},children:[a.jsx(ice,{}),e&&a.jsxs(a.Fragment,{children:[a.jsx(fce,{}),a.jsxs(L,{gap:"3",children:[a.jsxs(L,{flexDirection:"column",sx:{h:28,w:"full",gap:4,mb:4},children:[a.jsx(mce,{}),a.jsx(oce,{})]}),a.jsx(uce,{})]})]})]})},vce=d.memo(gce),xce=le(xe,e=>{const{isEnabled:t}=e.controlNet;return{isEnabled:t}},Se),bce=()=>{const{isEnabled:e}=W(xce),t=te(),n=d.useCallback(()=>{t(oT())},[t]);return a.jsx(Ie,{width:"100%",children:a.jsx(Et,{feature:"controlNet",children:a.jsx(fn,{label:"Enable ControlNet",isChecked:e,onChange:n})})})},yce=d.memo(bce),Cce=le([xe],({controlNet:e})=>{const{controlNets:t,isEnabled:n,isIPAdapterEnabled:r,ipAdapterInfo:o}=e,s=sT(t),i=o.model&&o.adapterImage;let l;return n&&s.length>0&&(l=`${s.length} ControlNet`),r&&i&&(l?l=`${l}, IP Adapter`:l="IP Adapter"),{controlNetsArray:nr(t),activeLabel:l}},Se),wce=()=>{const{controlNetsArray:e,activeLabel:t}=W(Cce),n=Bt("controlNet").isFeatureDisabled,r=te(),{data:o}=gh(),s=d.useMemo(()=>{if(!o||!Object.keys(o.entities).length)return;const l=Object.keys(o.entities)[0];if(!l)return;const u=o.entities[l];return u||void 0},[o]),i=d.useCallback(()=>{if(!s)return;const l=Zs();r(aT({controlNetId:l})),r(PI({controlNetId:l,model:s}))},[r,s]);return n?null:a.jsx(oo,{label:"Control Adapters",activeLabel:t,children:a.jsxs(L,{sx:{flexDir:"column",gap:2},children:[a.jsxs(L,{sx:{w:"100%",gap:2,p:2,ps:3,borderRadius:"base",alignItems:"center",bg:"base.250",_dark:{bg:"base.750"}},children:[a.jsx(yce,{}),a.jsx(Fe,{tooltip:"Add ControlNet","aria-label":"Add ControlNet",icon:a.jsx(Vc,{}),isDisabled:!s,flexGrow:1,size:"sm",onClick:i,"data-testid":"add controlnet"})]}),e.map((l,u)=>a.jsxs(d.Fragment,{children:[u>0&&a.jsx(Yn,{}),a.jsx(nce,{controlNet:l})]},l.controlNetId)),a.jsx(vce,{})]})})},Yc=d.memo(wce),Sce=e=>{const{onClick:t}=e,{t:n}=Z();return a.jsx(Fe,{size:"sm","aria-label":n("embedding.addEmbedding"),tooltip:n("embedding.addEmbedding"),icon:a.jsx(lM,{}),sx:{p:2,color:"base.500",_hover:{color:"base.600"},_active:{color:"base.700"},_dark:{color:"base.500",_hover:{color:"base.400"},_active:{color:"base.300"}}},variant:"link",onClick:t})},Rg=d.memo(Sce),kce="28rem",jce=e=>{const{onSelect:t,isOpen:n,onClose:r,children:o}=e,{data:s}=iT(),i=d.useRef(null),{t:l}=Z(),u=W(h=>h.generation.model),p=d.useMemo(()=>{if(!s)return[];const h=[];return Rn(s.entities,(g,x)=>{if(!g)return;const y=(u==null?void 0:u.base_model)!==g.base_model;h.push({value:g.model_name,label:g.model_name,group:an[g.base_model],disabled:y,tooltip:y?`${l("embedding.incompatibleModel")} ${g.base_model}`:void 0})}),h.sort((g,x)=>{var y;return g.label&&x.label?(y=g.label)!=null&&y.localeCompare(x.label)?-1:1:-1}),h.sort((g,x)=>g.disabled&&!x.disabled?1:-1)},[s,u==null?void 0:u.base_model,l]),m=d.useCallback(h=>{h&&t(h)},[t]);return a.jsxs(Ld,{initialFocusRef:i,isOpen:n,onClose:r,placement:"bottom",openDelay:0,closeDelay:0,closeOnBlur:!0,returnFocusOnClose:!0,children:[a.jsx(Wh,{children:o}),a.jsx(zd,{sx:{p:0,top:-1,shadow:"dark-lg",borderColor:"accent.300",borderWidth:"2px",borderStyle:"solid",_dark:{borderColor:"accent.400"}},children:a.jsx(Uh,{sx:{p:0,w:`calc(${kce} - 2rem )`},children:p.length===0?a.jsx(L,{sx:{justifyContent:"center",p:2,fontSize:"sm",color:"base.500",_dark:{color:"base.700"}},children:a.jsx(ve,{children:"No Embeddings Loaded"})}):a.jsx(nn,{inputRef:i,autoFocus:!0,placeholder:l("embedding.addEmbedding"),value:null,data:p,nothingFound:l("embedding.noMatchingEmbedding"),itemComponent:ui,disabled:p.length===0,onDropdownClose:r,filter:(h,g)=>{var x;return((x=g.label)==null?void 0:x.toLowerCase().includes(h.toLowerCase().trim()))||g.value.toLowerCase().includes(h.toLowerCase().trim())},onChange:m})})})]})},Dg=d.memo(jce),_ce=()=>{const e=W(h=>h.generation.negativePrompt),t=d.useRef(null),{isOpen:n,onClose:r,onOpen:o}=Lr(),s=te(),{t:i}=Z(),l=d.useCallback(h=>{s($u(h.target.value))},[s]),u=d.useCallback(h=>{h.key==="<"&&o()},[o]),p=d.useCallback(h=>{if(!t.current)return;const g=t.current.selectionStart;if(g===void 0)return;let x=e.slice(0,g);x[x.length-1]!=="<"&&(x+="<"),x+=`${h}>`;const y=x.length;x+=e.slice(g),qr.flushSync(()=>{s($u(x))}),t.current.selectionEnd=y,r()},[s,r,e]),m=Bt("embedding").isFeatureEnabled;return a.jsxs(Kt,{children:[a.jsx(Dg,{isOpen:n,onClose:r,onSelect:p,children:a.jsx(Et,{feature:"paramNegativeConditioning",placement:"right",children:a.jsx(da,{id:"negativePrompt",name:"negativePrompt",ref:t,value:e,placeholder:i("parameters.negativePromptPlaceholder"),onChange:l,resize:"vertical",fontSize:"sm",minH:16,...m&&{onKeyDown:u}})})}),!n&&m&&a.jsx(Ie,{sx:{position:"absolute",top:0,insetInlineEnd:0},children:a.jsx(Rg,{onClick:o})})]})},OO=d.memo(_ce),Ice=le([xe],({generation:e})=>({prompt:e.positivePrompt}),{memoizeOptions:{resultEqualityCheck:Ft}}),Pce=()=>{const e=te(),{prompt:t}=W(Ice),n=d.useRef(null),{isOpen:r,onClose:o,onOpen:s}=Lr(),{t:i}=Z(),l=d.useCallback(h=>{e(Nu(h.target.value))},[e]);et("alt+a",()=>{var h;(h=n.current)==null||h.focus()},[]);const u=d.useCallback(h=>{if(!n.current)return;const g=n.current.selectionStart;if(g===void 0)return;let x=t.slice(0,g);x[x.length-1]!=="<"&&(x+="<"),x+=`${h}>`;const y=x.length;x+=t.slice(g),qr.flushSync(()=>{e(Nu(x))}),n.current.selectionStart=y,n.current.selectionEnd=y,o()},[e,o,t]),p=Bt("embedding").isFeatureEnabled,m=d.useCallback(h=>{p&&h.key==="<"&&s()},[s,p]);return a.jsxs(Ie,{position:"relative",children:[a.jsx(Kt,{children:a.jsx(Dg,{isOpen:r,onClose:o,onSelect:u,children:a.jsx(Et,{feature:"paramPositiveConditioning",placement:"right",children:a.jsx(da,{id:"prompt",name:"prompt",ref:n,value:t,placeholder:i("parameters.positivePromptPlaceholder"),onChange:l,onKeyDown:m,resize:"vertical",minH:32})})})}),!r&&p&&a.jsx(Ie,{sx:{position:"absolute",top:0,insetInlineEnd:0},children:a.jsx(Rg,{onClick:s})})]})},RO=d.memo(Pce);function Ece(){const e=W(o=>o.sdxl.shouldConcatSDXLStylePrompt),t=te(),{t:n}=Z(),r=()=>{t(lT(!e))};return a.jsx(Fe,{"aria-label":n("sdxl.concatPromptStyle"),tooltip:n("sdxl.concatPromptStyle"),variant:"outline",isChecked:e,onClick:r,icon:a.jsx(pM,{}),size:"xs",sx:{position:"absolute",insetInlineEnd:1,top:6,border:"none",color:e?"accent.500":"base.500",_hover:{bg:"none"}}})}const d_={position:"absolute",bg:"none",w:"full",minH:2,borderRadius:0,borderLeft:"none",borderRight:"none",zIndex:2,maskImage:"radial-gradient(circle at center, black, black 65%, black 30%, black 15%, transparent)"};function DO(){return a.jsxs(L,{children:[a.jsx(Ie,{as:In.div,initial:{scaleX:0,borderWidth:0,display:"none"},animate:{display:["block","block","block","none"],scaleX:[0,.25,.5,1],borderWidth:[0,3,3,0],transition:{duration:.37,times:[0,.25,.5,1]}},sx:{top:"1px",borderTop:"none",borderColor:"base.400",...d_,_dark:{borderColor:"accent.500"}}}),a.jsx(Ie,{as:In.div,initial:{opacity:0,scale:0},animate:{opacity:[0,1,1,1],scale:[0,.75,1.5,1],transition:{duration:.42,times:[0,.25,.5,1]}},exit:{opacity:0,scale:0},sx:{zIndex:3,position:"absolute",left:"48%",top:"3px",p:1,borderRadius:4,bg:"accent.400",color:"base.50",_dark:{bg:"accent.500"}},children:a.jsx(pM,{size:12})}),a.jsx(Ie,{as:In.div,initial:{scaleX:0,borderWidth:0,display:"none"},animate:{display:["block","block","block","none"],scaleX:[0,.25,.5,1],borderWidth:[0,3,3,0],transition:{duration:.37,times:[0,.25,.5,1]}},sx:{top:"17px",borderBottom:"none",borderColor:"base.400",...d_,_dark:{borderColor:"accent.500"}}})]})}const Mce=le([xe],({sdxl:e})=>{const{negativeStylePrompt:t,shouldConcatSDXLStylePrompt:n}=e;return{prompt:t,shouldConcatSDXLStylePrompt:n}},{memoizeOptions:{resultEqualityCheck:Ft}}),Oce=()=>{const e=te(),t=d.useRef(null),{isOpen:n,onClose:r,onOpen:o}=Lr(),{t:s}=Z(),{prompt:i,shouldConcatSDXLStylePrompt:l}=W(Mce),u=d.useCallback(g=>{e(zu(g.target.value))},[e]),p=d.useCallback(g=>{if(!t.current)return;const x=t.current.selectionStart;if(x===void 0)return;let y=i.slice(0,x);y[y.length-1]!=="<"&&(y+="<"),y+=`${g}>`;const b=y.length;y+=i.slice(x),qr.flushSync(()=>{e(zu(y))}),t.current.selectionStart=b,t.current.selectionEnd=b,r()},[e,r,i]),m=Bt("embedding").isFeatureEnabled,h=d.useCallback(g=>{m&&g.key==="<"&&o()},[o,m]);return a.jsxs(Ie,{position:"relative",children:[a.jsx(dr,{children:l&&a.jsx(Ie,{sx:{position:"absolute",left:"3",w:"94%",top:"-17px"},children:a.jsx(DO,{})})}),a.jsx(Kt,{children:a.jsx(Dg,{isOpen:n,onClose:r,onSelect:p,children:a.jsx(da,{id:"prompt",name:"prompt",ref:t,value:i,placeholder:s("sdxl.negStylePrompt"),onChange:u,onKeyDown:h,resize:"vertical",fontSize:"sm",minH:16})})}),!n&&m&&a.jsx(Ie,{sx:{position:"absolute",top:0,insetInlineEnd:0},children:a.jsx(Rg,{onClick:o})})]})},Rce=d.memo(Oce),Dce=le([xe],({sdxl:e})=>{const{positiveStylePrompt:t,shouldConcatSDXLStylePrompt:n}=e;return{prompt:t,shouldConcatSDXLStylePrompt:n}},{memoizeOptions:{resultEqualityCheck:Ft}}),Ace=()=>{const e=te(),t=d.useRef(null),{isOpen:n,onClose:r,onOpen:o}=Lr(),{t:s}=Z(),{prompt:i,shouldConcatSDXLStylePrompt:l}=W(Dce),u=d.useCallback(g=>{e(Lu(g.target.value))},[e]),p=d.useCallback(g=>{if(!t.current)return;const x=t.current.selectionStart;if(x===void 0)return;let y=i.slice(0,x);y[y.length-1]!=="<"&&(y+="<"),y+=`${g}>`;const b=y.length;y+=i.slice(x),qr.flushSync(()=>{e(Lu(y))}),t.current.selectionStart=b,t.current.selectionEnd=b,r()},[e,r,i]),m=Bt("embedding").isFeatureEnabled,h=d.useCallback(g=>{m&&g.key==="<"&&o()},[o,m]);return a.jsxs(Ie,{position:"relative",children:[a.jsx(dr,{children:l&&a.jsx(Ie,{sx:{position:"absolute",left:"3",w:"94%",top:"-17px"},children:a.jsx(DO,{})})}),a.jsx(Kt,{children:a.jsx(Dg,{isOpen:n,onClose:r,onSelect:p,children:a.jsx(da,{id:"prompt",name:"prompt",ref:t,value:i,placeholder:s("sdxl.posStylePrompt"),onChange:u,onKeyDown:h,resize:"vertical",minH:16})})}),!n&&m&&a.jsx(Ie,{sx:{position:"absolute",top:0,insetInlineEnd:0},children:a.jsx(Rg,{onClick:o})})]})},Tce=d.memo(Ace);function o2(){return a.jsxs(L,{sx:{flexDirection:"column",gap:2},children:[a.jsx(RO,{}),a.jsx(Ece,{}),a.jsx(Tce,{}),a.jsx(OO,{}),a.jsx(Rce,{})]})}const dl=()=>{const{isRefinerAvailable:e}=Xo(nb,{selectFromResult:({data:t})=>({isRefinerAvailable:t?t.ids.length>0:!1})});return e},Nce=le([xe],({sdxl:e,ui:t,hotkeys:n})=>{const{refinerCFGScale:r}=e,{shouldUseSliders:o}=t,{shift:s}=n;return{refinerCFGScale:r,shouldUseSliders:o,shift:s}},Se),$ce=()=>{const{refinerCFGScale:e,shouldUseSliders:t,shift:n}=W(Nce),r=dl(),o=te(),{t:s}=Z(),i=d.useCallback(u=>o(f1(u)),[o]),l=d.useCallback(()=>o(f1(7)),[o]);return t?a.jsx(tt,{label:s("sdxl.cfgScale"),step:n?.1:.5,min:1,max:20,onChange:i,handleReset:l,value:e,sliderNumberInputProps:{max:200},withInput:!0,withReset:!0,withSliderMarks:!0,isInteger:!1,isDisabled:!r}):a.jsx(Kc,{label:s("sdxl.cfgScale"),step:.5,min:1,max:200,onChange:i,value:e,isInteger:!1,numberInputFieldProps:{textAlign:"center"},isDisabled:!r})},Lce=d.memo($ce),zce=e=>{const t=si("models"),[n,r,o]=e.split("/"),s=cT.safeParse({base_model:n,model_name:o,model_type:r});if(!s.success){t.error({mainModelId:e,errors:s.error.format()},"Failed to parse main model id");return}return s.data},Fce=le(xe,e=>({model:e.sdxl.refinerModel}),Se),Bce=()=>{const e=te(),t=Bt("syncModels").isFeatureEnabled,{model:n}=W(Fce),{t:r}=Z(),{data:o,isLoading:s}=Xo(nb),i=d.useMemo(()=>{if(!o)return[];const p=[];return Rn(o.entities,(m,h)=>{m&&p.push({value:h,label:m.model_name,group:an[m.base_model]})}),p},[o]),l=d.useMemo(()=>(o==null?void 0:o.entities[`${n==null?void 0:n.base_model}/main/${n==null?void 0:n.model_name}`])??null,[o==null?void 0:o.entities,n]),u=d.useCallback(p=>{if(!p)return;const m=zce(p);m&&e(pI(m))},[e]);return s?a.jsx(nn,{label:r("sdxl.refinermodel"),placeholder:r("sdxl.loading"),disabled:!0,data:[]}):a.jsxs(L,{w:"100%",alignItems:"center",gap:2,children:[a.jsx(nn,{tooltip:l==null?void 0:l.description,label:r("sdxl.refinermodel"),value:l==null?void 0:l.id,placeholder:i.length>0?r("sdxl.selectAModel"):r("sdxl.noModelsAvailable"),data:i,error:i.length===0,disabled:i.length===0,onChange:u,w:"100%"}),t&&a.jsx(Ie,{mt:7,children:a.jsx(Gc,{iconMode:!0})})]})},Hce=d.memo(Bce),Vce=le([xe],({sdxl:e,hotkeys:t})=>{const{refinerNegativeAestheticScore:n}=e,{shift:r}=t;return{refinerNegativeAestheticScore:n,shift:r}},Se),Wce=()=>{const{refinerNegativeAestheticScore:e,shift:t}=W(Vce),n=dl(),r=te(),{t:o}=Z(),s=d.useCallback(l=>r(m1(l)),[r]),i=d.useCallback(()=>r(m1(2.5)),[r]);return a.jsx(tt,{label:o("sdxl.negAestheticScore"),step:t?.1:.5,min:1,max:10,onChange:s,handleReset:i,value:e,sliderNumberInputProps:{max:10},withInput:!0,withReset:!0,withSliderMarks:!0,isInteger:!1,isDisabled:!n})},Uce=d.memo(Wce),Gce=le([xe],({sdxl:e,hotkeys:t})=>{const{refinerPositiveAestheticScore:n}=e,{shift:r}=t;return{refinerPositiveAestheticScore:n,shift:r}},Se),Kce=()=>{const{refinerPositiveAestheticScore:e,shift:t}=W(Gce),n=dl(),r=te(),{t:o}=Z(),s=d.useCallback(l=>r(p1(l)),[r]),i=d.useCallback(()=>r(p1(6)),[r]);return a.jsx(tt,{label:o("sdxl.posAestheticScore"),step:t?.1:.5,min:1,max:10,onChange:s,handleReset:i,value:e,sliderNumberInputProps:{max:10},withInput:!0,withReset:!0,withSliderMarks:!0,isInteger:!1,isDisabled:!n})},qce=d.memo(Kce),Xce=le(xe,({ui:e,sdxl:t})=>{const{refinerScheduler:n}=t,{favoriteSchedulers:r}=e,o=nr(mh,(s,i)=>({value:i,label:s,group:r.includes(i)?"Favorites":void 0})).sort((s,i)=>s.label.localeCompare(i.label));return{refinerScheduler:n,data:o}},Se),Qce=()=>{const e=te(),{t}=Z(),{refinerScheduler:n,data:r}=W(Xce),o=dl(),s=d.useCallback(i=>{i&&e(mI(i))},[e]);return a.jsx(nn,{w:"100%",label:t("sdxl.scheduler"),value:n,data:r,onChange:s,disabled:!o})},Yce=d.memo(Qce),Zce=le([xe],({sdxl:e})=>{const{refinerStart:t}=e;return{refinerStart:t}},Se),Jce=()=>{const{refinerStart:e}=W(Zce),t=te(),n=dl(),r=d.useCallback(i=>t(h1(i)),[t]),{t:o}=Z(),s=d.useCallback(()=>t(h1(.8)),[t]);return a.jsx(tt,{label:o("sdxl.refinerStart"),step:.01,min:0,max:1,onChange:r,handleReset:s,value:e,withInput:!0,withReset:!0,withSliderMarks:!0,isInteger:!1,isDisabled:!n})},eue=d.memo(Jce),tue=le([xe],({sdxl:e,ui:t})=>{const{refinerSteps:n}=e,{shouldUseSliders:r}=t;return{refinerSteps:n,shouldUseSliders:r}},Se),nue=()=>{const{refinerSteps:e,shouldUseSliders:t}=W(tue),n=dl(),r=te(),{t:o}=Z(),s=d.useCallback(l=>{r(d1(l))},[r]),i=d.useCallback(()=>{r(d1(20))},[r]);return t?a.jsx(tt,{label:o("sdxl.steps"),min:1,max:100,step:1,onChange:s,handleReset:i,value:e,withInput:!0,withReset:!0,withSliderMarks:!0,sliderNumberInputProps:{max:500},isDisabled:!n}):a.jsx(Kc,{label:o("sdxl.steps"),min:1,max:500,step:1,onChange:s,value:e,numberInputFieldProps:{textAlign:"center"},isDisabled:!n})},rue=d.memo(nue);function oue(){const e=W(s=>s.sdxl.shouldUseSDXLRefiner),t=dl(),n=te(),{t:r}=Z(),o=s=>{n(uT(s.target.checked))};return a.jsx(fn,{label:r("sdxl.useRefiner"),isChecked:e,onChange:o,isDisabled:!t})}const sue=le(xe,e=>{const{shouldUseSDXLRefiner:t}=e.sdxl,{shouldUseSliders:n}=e.ui;return{activeLabel:t?"Enabled":void 0,shouldUseSliders:n}},Se),aue=()=>{const{activeLabel:e,shouldUseSliders:t}=W(sue),{t:n}=Z();return a.jsx(oo,{label:n("sdxl.refiner"),activeLabel:e,children:a.jsxs(L,{sx:{gap:2,flexDir:"column"},children:[a.jsx(oue,{}),a.jsx(Hce,{}),a.jsxs(L,{gap:2,flexDirection:t?"column":"row",children:[a.jsx(rue,{}),a.jsx(Lce,{})]}),a.jsx(Yce,{}),a.jsx(qce,{}),a.jsx(Uce,{}),a.jsx(eue,{})]})})},s2=d.memo(aue),iue=le([xe],({generation:e,config:t,ui:n,hotkeys:r})=>{const{initial:o,min:s,sliderMax:i,inputMax:l}=t.sd.guidance,{cfgScale:u}=e,{shouldUseSliders:p}=n,{shift:m}=r;return{cfgScale:u,initial:o,min:s,sliderMax:i,inputMax:l,shouldUseSliders:p,shift:m}},Se),lue=()=>{const{cfgScale:e,initial:t,min:n,sliderMax:r,inputMax:o,shouldUseSliders:s,shift:i}=W(iue),l=te(),{t:u}=Z(),p=d.useCallback(h=>l(Qp(h)),[l]),m=d.useCallback(()=>l(Qp(t)),[l,t]);return s?a.jsx(Et,{feature:"paramCFGScale",children:a.jsx(tt,{label:u("parameters.cfgScale"),step:i?.1:.5,min:n,max:r,onChange:p,handleReset:m,value:e,sliderNumberInputProps:{max:o},withInput:!0,withReset:!0,withSliderMarks:!0,isInteger:!1})}):a.jsx(Et,{feature:"paramCFGScale",children:a.jsx(Kc,{label:u("parameters.cfgScale"),step:.5,min:n,max:o,onChange:p,value:e,isInteger:!1,numberInputFieldProps:{textAlign:"center"}})})},_s=d.memo(lue),cue=le(xe,e=>({model:e.generation.model}),Se),uue=()=>{const e=te(),{t}=Z(),{model:n}=W(cue),r=Bt("syncModels").isFeatureEnabled,{data:o,isLoading:s}=Xo(Cw),{data:i,isLoading:l}=Ku(Cw),u=W(Jn),p=d.useMemo(()=>{if(!o)return[];const g=[];return Rn(o.entities,(x,y)=>{x&&g.push({value:y,label:x.model_name,group:an[x.base_model]})}),Rn(i==null?void 0:i.entities,(x,y)=>{!x||u==="unifiedCanvas"||u==="img2img"||g.push({value:y,label:x.model_name,group:an[x.base_model]})}),g},[o,i,u]),m=d.useMemo(()=>((o==null?void 0:o.entities[`${n==null?void 0:n.base_model}/main/${n==null?void 0:n.model_name}`])||(i==null?void 0:i.entities[`${n==null?void 0:n.base_model}/onnx/${n==null?void 0:n.model_name}`]))??null,[o==null?void 0:o.entities,n,i==null?void 0:i.entities]),h=d.useCallback(g=>{if(!g)return;const x=Og(g);x&&e(i1(x))},[e]);return s||l?a.jsx(nn,{label:t("modelManager.model"),placeholder:"Loading...",disabled:!0,data:[]}):a.jsxs(L,{w:"100%",alignItems:"center",gap:3,children:[a.jsx(Et,{feature:"paramModel",children:a.jsx(nn,{tooltip:m==null?void 0:m.description,label:t("modelManager.model"),value:m==null?void 0:m.id,placeholder:p.length>0?"Select a model":"No models available",data:p,error:p.length===0,disabled:p.length===0,onChange:h,w:"100%"})}),r&&a.jsx(Ie,{mt:6,children:a.jsx(Gc,{iconMode:!0})})]})},due=d.memo(uue),fue=le(xe,({generation:e})=>{const{model:t,vae:n}=e;return{model:t,vae:n}},Se),pue=()=>{const e=te(),{t}=Z(),{model:n,vae:r}=W(fue),{data:o}=jI(),s=d.useMemo(()=>{if(!o)return[];const u=[{value:"default",label:"Default",group:"Default"}];return Rn(o.entities,(p,m)=>{if(!p)return;const h=(n==null?void 0:n.base_model)!==p.base_model;u.push({value:m,label:p.model_name,group:an[p.base_model],disabled:h,tooltip:h?`Incompatible base model: ${p.base_model}`:void 0})}),u.sort((p,m)=>p.disabled&&!m.disabled?1:-1)},[o,n==null?void 0:n.base_model]),i=d.useMemo(()=>(o==null?void 0:o.entities[`${r==null?void 0:r.base_model}/vae/${r==null?void 0:r.model_name}`])??null,[o==null?void 0:o.entities,r]),l=d.useCallback(u=>{if(!u||u==="default"){e(ww(null));return}const p=_O(u);p&&e(ww(p))},[e]);return a.jsx(Et,{feature:"paramVAE",children:a.jsx(nn,{itemComponent:ui,tooltip:i==null?void 0:i.description,label:t("modelManager.vae"),value:(i==null?void 0:i.id)??"default",placeholder:"Default",data:s,onChange:l,disabled:s.length===0,clearable:!0})})},mue=d.memo(pue),hue=le([EI,os],(e,t)=>{const{scheduler:n}=t,{favoriteSchedulers:r}=e,o=nr(mh,(s,i)=>({value:i,label:s,group:r.includes(i)?"Favorites":void 0})).sort((s,i)=>s.label.localeCompare(i.label));return{scheduler:n,data:o}},Se),gue=()=>{const e=te(),{t}=Z(),{scheduler:n,data:r}=W(hue),o=d.useCallback(s=>{s&&e(l1(s))},[e]);return a.jsx(Et,{feature:"paramScheduler",children:a.jsx(nn,{label:t("parameters.scheduler"),value:n,data:r,onChange:o})})},vue=d.memo(gue),xue=le(xe,({generation:e})=>{const{vaePrecision:t}=e;return{vaePrecision:t}},Se),bue=["fp16","fp32"],yue=()=>{const e=te(),{vaePrecision:t}=W(xue),n=d.useCallback(r=>{r&&e(dT(r))},[e]);return a.jsx(Et,{feature:"paramVAEPrecision",children:a.jsx(Pn,{label:"VAE Precision",value:t,data:bue,onChange:n})})},Cue=d.memo(yue),wue=()=>{const e=Bt("vae").isFeatureEnabled;return a.jsxs(L,{gap:3,w:"full",flexWrap:e?"wrap":"nowrap",children:[a.jsx(Ie,{w:"full",children:a.jsx(due,{})}),a.jsx(Ie,{w:"full",children:a.jsx(vue,{})}),e&&a.jsxs(L,{w:"full",gap:3,children:[a.jsx(mue,{}),a.jsx(Cue,{})]})]})},Is=d.memo(wue),AO=[{name:"Free",value:null},{name:"2:3",value:2/3},{name:"16:9",value:16/9},{name:"1:1",value:1/1}],TO=AO.map(e=>e.value);function NO(){const e=W(o=>o.generation.aspectRatio),t=te(),n=W(o=>o.generation.shouldFitToWidthHeight),r=W(Jn);return a.jsx(Vt,{isAttached:!0,children:AO.map(o=>a.jsx(at,{size:"sm",isChecked:e===o.value,isDisabled:r==="img2img"?!n:!1,onClick:()=>{t(zo(o.value)),t(qu(!1))},children:o.name},o.name))})}const Sue=le([xe],({generation:e,hotkeys:t,config:n})=>{const{min:r,sliderMax:o,inputMax:s,fineStep:i,coarseStep:l}=n.sd.height,{model:u,height:p}=e,{aspectRatio:m}=e,h=t.shift?i:l;return{model:u,height:p,min:r,sliderMax:o,inputMax:s,step:h,aspectRatio:m}},Se),kue=e=>{const{model:t,height:n,min:r,sliderMax:o,inputMax:s,step:i,aspectRatio:l}=W(Sue),u=te(),{t:p}=Z(),m=["sdxl","sdxl-refiner"].includes(t==null?void 0:t.base_model)?1024:512,h=d.useCallback(x=>{if(u(Vi(x)),l){const y=wr(x*l,8);u(Hi(y))}},[u,l]),g=d.useCallback(()=>{if(u(Vi(m)),l){const x=wr(m*l,8);u(Hi(x))}},[u,m,l]);return a.jsx(tt,{label:p("parameters.height"),value:n,min:r,step:i,max:o,onChange:h,handleReset:g,withInput:!0,withReset:!0,withSliderMarks:!0,sliderNumberInputProps:{max:s},...e})},jue=d.memo(kue),_ue=le([xe],({generation:e,hotkeys:t,config:n})=>{const{min:r,sliderMax:o,inputMax:s,fineStep:i,coarseStep:l}=n.sd.width,{model:u,width:p,aspectRatio:m}=e,h=t.shift?i:l;return{model:u,width:p,min:r,sliderMax:o,inputMax:s,step:h,aspectRatio:m}},Se),Iue=e=>{const{model:t,width:n,min:r,sliderMax:o,inputMax:s,step:i,aspectRatio:l}=W(_ue),u=te(),{t:p}=Z(),m=["sdxl","sdxl-refiner"].includes(t==null?void 0:t.base_model)?1024:512,h=d.useCallback(x=>{if(u(Hi(x)),l){const y=wr(x/l,8);u(Vi(y))}},[u,l]),g=d.useCallback(()=>{if(u(Hi(m)),l){const x=wr(m/l,8);u(Vi(x))}},[u,m,l]);return a.jsx(tt,{label:p("parameters.width"),value:n,min:r,step:i,max:o,onChange:h,handleReset:g,withInput:!0,withReset:!0,withSliderMarks:!0,sliderNumberInputProps:{max:s},...e})},Pue=d.memo(Iue),Eue=le([os,Jn],(e,t)=>{const{shouldFitToWidthHeight:n,shouldLockAspectRatio:r,width:o,height:s}=e;return{activeTabName:t,shouldFitToWidthHeight:n,shouldLockAspectRatio:r,width:o,height:s}},Se);function Oc(){const{t:e}=Z(),t=te(),{activeTabName:n,shouldFitToWidthHeight:r,shouldLockAspectRatio:o,width:s,height:i}=W(Eue),l=d.useCallback(()=>{o?(t(qu(!1)),TO.includes(s/i)?t(zo(s/i)):t(zo(null))):(t(qu(!0)),t(zo(s/i)))},[o,s,i,t]),u=d.useCallback(()=>{t(fT()),t(zo(null)),o&&t(zo(i/s))},[t,o,s,i]);return a.jsxs(L,{sx:{gap:2,p:4,borderRadius:4,flexDirection:"column",w:"full",bg:"base.150",_dark:{bg:"base.750"}},children:[a.jsx(Et,{feature:"paramRatio",children:a.jsxs(Kt,{as:L,flexDir:"row",alignItems:"center",gap:2,children:[a.jsx(wn,{children:e("parameters.aspectRatio")}),a.jsx(ba,{}),a.jsx(NO,{}),a.jsx(Fe,{tooltip:e("ui.swapSizes"),"aria-label":e("ui.swapSizes"),size:"sm",icon:a.jsx(z8,{}),fontSize:20,isDisabled:n==="img2img"?!r:!1,onClick:u}),a.jsx(Fe,{tooltip:e("ui.lockRatio"),"aria-label":e("ui.lockRatio"),size:"sm",icon:a.jsx(mM,{}),isChecked:o,isDisabled:n==="img2img"?!r:!1,onClick:l})]})}),a.jsx(L,{gap:2,alignItems:"center",children:a.jsxs(L,{gap:2,flexDirection:"column",width:"full",children:[a.jsx(Pue,{isDisabled:n==="img2img"?!r:!1}),a.jsx(jue,{isDisabled:n==="img2img"?!r:!1})]})})]})}const Mue=le([xe],({generation:e,config:t,ui:n,hotkeys:r})=>{const{initial:o,min:s,sliderMax:i,inputMax:l,fineStep:u,coarseStep:p}=t.sd.steps,{steps:m}=e,{shouldUseSliders:h}=n,g=r.shift?u:p;return{steps:m,initial:o,min:s,sliderMax:i,inputMax:l,step:g,shouldUseSliders:h}},Se),Oue=()=>{const{steps:e,initial:t,min:n,sliderMax:r,inputMax:o,step:s,shouldUseSliders:i}=W(Mue),l=te(),{t:u}=Z(),p=d.useCallback(g=>{l(Yp(g))},[l]),m=d.useCallback(()=>{l(Yp(t))},[l,t]),h=d.useCallback(()=>{l(eb())},[l]);return i?a.jsx(Et,{feature:"paramSteps",children:a.jsx(tt,{label:u("parameters.steps"),min:n,max:r,step:s,onChange:p,handleReset:m,value:e,withInput:!0,withReset:!0,withSliderMarks:!0,sliderNumberInputProps:{max:o}})}):a.jsx(Et,{feature:"paramSteps",children:a.jsx(Kc,{label:u("parameters.steps"),min:n,max:o,step:s,onChange:p,value:e,numberInputFieldProps:{textAlign:"center"},onBlur:h})})},Ps=d.memo(Oue);function $O(){const e=te(),t=W(o=>o.generation.shouldFitToWidthHeight),n=o=>e(pT(o.target.checked)),{t:r}=Z();return a.jsx(fn,{label:r("parameters.imageFit"),isChecked:t,onChange:n})}function Rue(){const e=W(i=>i.generation.seed),t=W(i=>i.generation.shouldRandomizeSeed),n=W(i=>i.generation.shouldGenerateVariations),{t:r}=Z(),o=te(),s=i=>o(Xp(i));return a.jsx(Kc,{label:r("parameters.seed"),step:1,precision:0,flexGrow:1,min:MI,max:OI,isDisabled:t,isInvalid:e<0&&n,onChange:s,value:e})}const Due=(e,t)=>Math.floor(Math.random()*(t-e+1)+e);function Aue(){const e=te(),t=W(o=>o.generation.shouldRandomizeSeed),{t:n}=Z(),r=()=>e(Xp(Due(MI,OI)));return a.jsx(Fe,{size:"sm",isDisabled:t,"aria-label":n("parameters.shuffle"),tooltip:n("parameters.shuffle"),onClick:r,icon:a.jsx(tee,{})})}const Tue=()=>{const e=te(),{t}=Z(),n=W(o=>o.generation.shouldRandomizeSeed),r=o=>e(mT(o.target.checked));return a.jsx(fn,{label:t("common.random"),isChecked:n,onChange:r})},Nue=d.memo(Tue),$ue=()=>a.jsx(Et,{feature:"paramSeed",children:a.jsxs(L,{sx:{gap:3,alignItems:"flex-end"},children:[a.jsx(Rue,{}),a.jsx(Aue,{}),a.jsx(Nue,{})]})}),Es=d.memo($ue),LO=je((e,t)=>a.jsxs(L,{ref:t,sx:{flexDir:"column",gap:2,bg:"base.100",px:4,pt:2,pb:4,borderRadius:"base",_dark:{bg:"base.750"}},children:[a.jsx(ve,{fontSize:"sm",fontWeight:"bold",sx:{color:"base.600",_dark:{color:"base.300"}},children:e.label}),e.children]}));LO.displayName="SubSettingsWrapper";const Rc=d.memo(LO),Lue=le([xe],({sdxl:e})=>{const{sdxlImg2ImgDenoisingStrength:t}=e;return{sdxlImg2ImgDenoisingStrength:t}},Se),zue=()=>{const{sdxlImg2ImgDenoisingStrength:e}=W(Lue),t=te(),{t:n}=Z(),r=d.useCallback(s=>t(Sw(s)),[t]),o=d.useCallback(()=>{t(Sw(.7))},[t]);return a.jsx(Et,{feature:"paramDenoisingStrength",children:a.jsx(Rc,{children:a.jsx(tt,{label:n("sdxl.denoisingStrength"),step:.01,min:0,max:1,onChange:r,handleReset:o,value:e,isInteger:!1,withInput:!0,withSliderMarks:!0,withReset:!0})})})},zO=d.memo(zue),Fue=le([EI,os],(e,t)=>{const{shouldUseSliders:n}=e,{shouldRandomizeSeed:r}=t;return{shouldUseSliders:n,activeLabel:r?void 0:"Manual Seed"}},Se),Bue=()=>{const{shouldUseSliders:e,activeLabel:t}=W(Fue);return a.jsx(oo,{label:"General",activeLabel:t,defaultIsOpen:!0,children:a.jsxs(L,{sx:{flexDirection:"column",gap:3},children:[e?a.jsxs(a.Fragment,{children:[a.jsx(rs,{}),a.jsx(Ps,{}),a.jsx(_s,{}),a.jsx(Is,{}),a.jsx(Ie,{pt:2,children:a.jsx(Es,{})}),a.jsx(Oc,{})]}):a.jsxs(a.Fragment,{children:[a.jsxs(L,{gap:3,children:[a.jsx(rs,{}),a.jsx(Ps,{}),a.jsx(_s,{})]}),a.jsx(Is,{}),a.jsx(Ie,{pt:2,children:a.jsx(Es,{})}),a.jsx(Oc,{})]}),a.jsx(zO,{}),a.jsx($O,{})]})})},Hue=d.memo(Bue),Vue=()=>a.jsxs(a.Fragment,{children:[a.jsx(o2,{}),a.jsx(Hue,{}),a.jsx(s2,{}),a.jsx(Yc,{}),a.jsx(Xc,{}),a.jsx(qc,{}),a.jsx(Qc,{})]}),Wue=d.memo(Vue),a2=()=>{const{t:e}=Z(),t=W(i=>i.generation.shouldRandomizeSeed),n=W(i=>i.generation.iterations),r=d.useMemo(()=>n===1?e("parameters.iterationsWithCount_one",{count:1}):e("parameters.iterationsWithCount_other",{count:n}),[n,e]),o=d.useMemo(()=>e(t?"parameters.randomSeed":"parameters.manualSeed"),[t,e]);return{iterationsAndSeedLabel:d.useMemo(()=>[r,o].join(", "),[r,o]),iterationsLabel:r,seedLabel:o}},Uue=()=>{const e=W(n=>n.ui.shouldUseSliders),{iterationsAndSeedLabel:t}=a2();return a.jsx(oo,{label:"General",activeLabel:t,defaultIsOpen:!0,children:a.jsx(L,{sx:{flexDirection:"column",gap:3},children:e?a.jsxs(a.Fragment,{children:[a.jsx(rs,{}),a.jsx(Ps,{}),a.jsx(_s,{}),a.jsx(Is,{}),a.jsx(Ie,{pt:2,children:a.jsx(Es,{})}),a.jsx(Oc,{})]}):a.jsxs(a.Fragment,{children:[a.jsxs(L,{gap:3,children:[a.jsx(rs,{}),a.jsx(Ps,{}),a.jsx(_s,{})]}),a.jsx(Is,{}),a.jsx(Ie,{pt:2,children:a.jsx(Es,{})}),a.jsx(Oc,{})]})})})},FO=d.memo(Uue),Gue=()=>a.jsxs(a.Fragment,{children:[a.jsx(o2,{}),a.jsx(FO,{}),a.jsx(s2,{}),a.jsx(Yc,{}),a.jsx(Xc,{}),a.jsx(qc,{}),a.jsx(Qc,{})]}),Kue=d.memo(Gue),que=[{label:"Unmasked",value:"unmasked"},{label:"Mask",value:"mask"},{label:"Mask Edge",value:"edge"}],Xue=()=>{const e=te(),t=W(o=>o.generation.canvasCoherenceMode),{t:n}=Z(),r=o=>{o&&e(hT(o))};return a.jsx(Et,{feature:"compositingCoherenceMode",children:a.jsx(Pn,{label:n("parameters.coherenceMode"),data:que,value:t,onChange:r})})},Que=d.memo(Xue),Yue=()=>{const e=te(),t=W(r=>r.generation.canvasCoherenceSteps),{t:n}=Z();return a.jsx(Et,{feature:"compositingCoherenceSteps",children:a.jsx(tt,{label:n("parameters.coherenceSteps"),min:1,max:100,step:1,sliderNumberInputProps:{max:999},value:t,onChange:r=>{e(kw(r))},withInput:!0,withSliderMarks:!0,withReset:!0,handleReset:()=>{e(kw(20))}})})},Zue=d.memo(Yue),Jue=()=>{const e=te(),t=W(r=>r.generation.canvasCoherenceStrength),{t:n}=Z();return a.jsx(Et,{feature:"compositingStrength",children:a.jsx(tt,{label:n("parameters.coherenceStrength"),min:0,max:1,step:.01,sliderNumberInputProps:{max:999},value:t,onChange:r=>{e(jw(r))},withInput:!0,withSliderMarks:!0,withReset:!0,handleReset:()=>{e(jw(.3))}})})},ede=d.memo(Jue);function tde(){const e=te(),t=W(r=>r.generation.maskBlur),{t:n}=Z();return a.jsx(Et,{feature:"compositingBlur",children:a.jsx(tt,{label:n("parameters.maskBlur"),min:0,max:64,sliderNumberInputProps:{max:512},value:t,onChange:r=>{e(_w(r))},withInput:!0,withSliderMarks:!0,withReset:!0,handleReset:()=>{e(_w(16))}})})}const nde=[{label:"Box Blur",value:"box"},{label:"Gaussian Blur",value:"gaussian"}];function rde(){const e=W(o=>o.generation.maskBlurMethod),t=te(),{t:n}=Z(),r=o=>{o&&t(gT(o))};return a.jsx(Et,{feature:"compositingBlurMethod",children:a.jsx(Pn,{value:e,onChange:r,label:n("parameters.maskBlurMethod"),data:nde})})}const ode=()=>{const{t:e}=Z();return a.jsx(oo,{label:e("parameters.compositingSettingsHeader"),children:a.jsxs(L,{sx:{flexDirection:"column",gap:2},children:[a.jsxs(Rc,{label:e("parameters.coherencePassHeader"),children:[a.jsx(Que,{}),a.jsx(Zue,{}),a.jsx(ede,{})]}),a.jsx(Yn,{}),a.jsxs(Rc,{label:e("parameters.maskAdjustmentsHeader"),children:[a.jsx(tde,{}),a.jsx(rde,{})]})]})})},BO=d.memo(ode),sde=le([xe],({generation:e})=>{const{infillMethod:t}=e;return{infillMethod:t}},Se),ade=()=>{const e=te(),{infillMethod:t}=W(sde),{data:n,isLoading:r}=iI(),o=n==null?void 0:n.infill_methods,{t:s}=Z(),i=d.useCallback(l=>{e(vT(l))},[e]);return a.jsx(Et,{feature:"infillMethod",children:a.jsx(Pn,{disabled:(o==null?void 0:o.length)===0,placeholder:r?"Loading...":void 0,label:s("parameters.infillMethod"),value:t,data:o??[],onChange:i})})},ide=d.memo(ade),lde=le([os],e=>{const{infillPatchmatchDownscaleSize:t,infillMethod:n}=e;return{infillPatchmatchDownscaleSize:t,infillMethod:n}},Se),cde=()=>{const e=te(),{infillPatchmatchDownscaleSize:t,infillMethod:n}=W(lde),{t:r}=Z(),o=d.useCallback(i=>{e(Iw(i))},[e]),s=d.useCallback(()=>{e(Iw(2))},[e]);return a.jsx(tt,{isDisabled:n!=="patchmatch",label:r("parameters.patchmatchDownScaleSize"),min:1,max:10,value:t,onChange:o,withInput:!0,withSliderMarks:!0,withReset:!0,handleReset:s})},ude=d.memo(cde),dde=le([os],e=>{const{infillTileSize:t,infillMethod:n}=e;return{infillTileSize:t,infillMethod:n}},Se),fde=()=>{const e=te(),{infillTileSize:t,infillMethod:n}=W(dde),{t:r}=Z(),o=d.useCallback(i=>{e(Pw(i))},[e]),s=d.useCallback(()=>{e(Pw(32))},[e]);return a.jsx(tt,{isDisabled:n!=="tile",label:r("parameters.tileSize"),min:16,max:64,sliderNumberInputProps:{max:256},value:t,onChange:o,withInput:!0,withSliderMarks:!0,withReset:!0,handleReset:s})},pde=d.memo(fde),mde=le([os],e=>{const{infillMethod:t}=e;return{infillMethod:t}},Se);function hde(){const{infillMethod:e}=W(mde);return a.jsxs(L,{children:[e==="tile"&&a.jsx(pde,{}),e==="patchmatch"&&a.jsx(ude,{})]})}const Sn=e=>e.canvas,Eo=le([xe],({canvas:e})=>e.batchIds.length>0||e.layerState.stagingArea.images.length>0),gde=le([Sn],e=>{const{boundingBoxScaleMethod:t}=e;return{boundingBoxScale:t}},Se),vde=()=>{const e=te(),{boundingBoxScale:t}=W(gde),{t:n}=Z(),r=o=>{e(bT(o))};return a.jsx(Et,{feature:"scaleBeforeProcessing",children:a.jsx(nn,{label:n("parameters.scaleBeforeProcessing"),data:xT,value:t,onChange:r})})},xde=d.memo(vde),bde=le([os,Sn],(e,t)=>{const{scaledBoundingBoxDimensions:n,boundingBoxScaleMethod:r}=t,{model:o,aspectRatio:s}=e;return{model:o,scaledBoundingBoxDimensions:n,isManual:r==="manual",aspectRatio:s}},Se),yde=()=>{const e=te(),{model:t,isManual:n,scaledBoundingBoxDimensions:r,aspectRatio:o}=W(bde),s=["sdxl","sdxl-refiner"].includes(t==null?void 0:t.base_model)?1024:512,{t:i}=Z(),l=p=>{let m=r.width;const h=Math.floor(p);o&&(m=wr(h*o,64)),e(Jp({width:m,height:h}))},u=()=>{let p=r.width;const m=Math.floor(s);o&&(p=wr(m*o,64)),e(Jp({width:p,height:m}))};return a.jsx(tt,{isDisabled:!n,label:i("parameters.scaledHeight"),min:64,max:1536,step:64,value:r.height,onChange:l,sliderNumberInputProps:{max:4096},withSliderMarks:!0,withInput:!0,withReset:!0,handleReset:u})},Cde=d.memo(yde),wde=le([Sn,os],(e,t)=>{const{boundingBoxScaleMethod:n,scaledBoundingBoxDimensions:r}=e,{model:o,aspectRatio:s}=t;return{model:o,scaledBoundingBoxDimensions:r,aspectRatio:s,isManual:n==="manual"}},Se),Sde=()=>{const e=te(),{model:t,isManual:n,scaledBoundingBoxDimensions:r,aspectRatio:o}=W(wde),s=["sdxl","sdxl-refiner"].includes(t==null?void 0:t.base_model)?1024:512,{t:i}=Z(),l=p=>{const m=Math.floor(p);let h=r.height;o&&(h=wr(m/o,64)),e(Jp({width:m,height:h}))},u=()=>{const p=Math.floor(s);let m=r.height;o&&(m=wr(p/o,64)),e(Jp({width:p,height:m}))};return a.jsx(tt,{isDisabled:!n,label:i("parameters.scaledWidth"),min:64,max:1536,step:64,value:r.width,onChange:l,sliderNumberInputProps:{max:4096},withSliderMarks:!0,withInput:!0,withReset:!0,handleReset:u})},kde=d.memo(Sde),jde=()=>{const{t:e}=Z();return a.jsx(oo,{label:e("parameters.infillScalingHeader"),children:a.jsxs(L,{sx:{gap:2,flexDirection:"column"},children:[a.jsxs(Rc,{children:[a.jsx(ide,{}),a.jsx(hde,{})]}),a.jsx(Yn,{}),a.jsxs(Rc,{children:[a.jsx(xde,{}),a.jsx(kde,{}),a.jsx(Cde,{})]})]})})},HO=d.memo(jde),_de=le([xe,Eo],({canvas:e,generation:t},n)=>{const{boundingBoxDimensions:r}=e,{model:o,aspectRatio:s}=t;return{model:o,boundingBoxDimensions:r,isStaging:n,aspectRatio:s}},Se),Ide=()=>{const e=te(),{model:t,boundingBoxDimensions:n,isStaging:r,aspectRatio:o}=W(_de),{t:s}=Z(),i=["sdxl","sdxl-refiner"].includes(t==null?void 0:t.base_model)?1024:512,l=p=>{if(e(Vo({...n,height:Math.floor(p)})),o){const m=wr(p*o,64);e(Vo({width:m,height:Math.floor(p)}))}},u=()=>{if(e(Vo({...n,height:Math.floor(i)})),o){const p=wr(i*o,64);e(Vo({width:p,height:Math.floor(i)}))}};return a.jsx(tt,{label:s("parameters.boundingBoxHeight"),min:64,max:1536,step:64,value:n.height,onChange:l,isDisabled:r,sliderNumberInputProps:{max:4096},withSliderMarks:!0,withInput:!0,withReset:!0,handleReset:u})},Pde=d.memo(Ide),Ede=le([xe,Eo],({canvas:e,generation:t},n)=>{const{boundingBoxDimensions:r}=e,{model:o,aspectRatio:s}=t;return{model:o,boundingBoxDimensions:r,isStaging:n,aspectRatio:s}},Se),Mde=()=>{const e=te(),{model:t,boundingBoxDimensions:n,isStaging:r,aspectRatio:o}=W(Ede),s=["sdxl","sdxl-refiner"].includes(t==null?void 0:t.base_model)?1024:512,{t:i}=Z(),l=p=>{if(e(Vo({...n,width:Math.floor(p)})),o){const m=wr(p/o,64);e(Vo({width:Math.floor(p),height:m}))}},u=()=>{if(e(Vo({...n,width:Math.floor(s)})),o){const p=wr(s/o,64);e(Vo({width:Math.floor(s),height:p}))}};return a.jsx(tt,{label:i("parameters.boundingBoxWidth"),min:64,max:1536,step:64,value:n.width,onChange:l,isDisabled:r,sliderNumberInputProps:{max:4096},withSliderMarks:!0,withInput:!0,withReset:!0,handleReset:u})},Ode=d.memo(Mde),Rde=le([os,Sn],(e,t)=>{const{shouldFitToWidthHeight:n,shouldLockAspectRatio:r}=e,{boundingBoxDimensions:o}=t;return{shouldFitToWidthHeight:n,shouldLockAspectRatio:r,boundingBoxDimensions:o}});function uh(){const e=te(),{t}=Z(),{shouldLockAspectRatio:n,boundingBoxDimensions:r}=W(Rde),o=d.useCallback(()=>{n?(e(qu(!1)),TO.includes(r.width/r.height)?e(zo(r.width/r.height)):e(zo(null))):(e(qu(!0)),e(zo(r.width/r.height)))},[n,r,e]),s=d.useCallback(()=>{e(yT()),e(zo(null)),n&&e(zo(r.height/r.width))},[e,n,r]);return a.jsxs(L,{sx:{gap:2,p:4,borderRadius:4,flexDirection:"column",w:"full",bg:"base.100",_dark:{bg:"base.750"}},children:[a.jsx(Et,{feature:"paramRatio",children:a.jsxs(Kt,{as:L,flexDir:"row",alignItems:"center",gap:2,children:[a.jsx(wn,{children:t("parameters.aspectRatio")}),a.jsx(ba,{}),a.jsx(NO,{}),a.jsx(Fe,{tooltip:t("ui.swapSizes"),"aria-label":t("ui.swapSizes"),size:"sm",icon:a.jsx(z8,{}),fontSize:20,onClick:s}),a.jsx(Fe,{tooltip:t("ui.lockRatio"),"aria-label":t("ui.lockRatio"),size:"sm",icon:a.jsx(mM,{}),isChecked:n,onClick:o})]})}),a.jsx(Ode,{}),a.jsx(Pde,{})]})}const Dde=le(xe,({ui:e,generation:t})=>{const{shouldUseSliders:n}=e,{shouldRandomizeSeed:r}=t;return{shouldUseSliders:n,activeLabel:r?void 0:"Manual Seed"}},Se),Ade=()=>{const{shouldUseSliders:e,activeLabel:t}=W(Dde);return a.jsx(oo,{label:"General",activeLabel:t,defaultIsOpen:!0,children:a.jsxs(L,{sx:{flexDirection:"column",gap:3},children:[e?a.jsxs(a.Fragment,{children:[a.jsx(rs,{}),a.jsx(Ps,{}),a.jsx(_s,{}),a.jsx(Is,{}),a.jsx(Ie,{pt:2,children:a.jsx(Es,{})}),a.jsx(uh,{})]}):a.jsxs(a.Fragment,{children:[a.jsxs(L,{gap:3,children:[a.jsx(rs,{}),a.jsx(Ps,{}),a.jsx(_s,{})]}),a.jsx(Is,{}),a.jsx(Ie,{pt:2,children:a.jsx(Es,{})}),a.jsx(uh,{})]}),a.jsx(zO,{})]})})},Tde=d.memo(Ade);function Nde(){return a.jsxs(a.Fragment,{children:[a.jsx(o2,{}),a.jsx(Tde,{}),a.jsx(s2,{}),a.jsx(Yc,{}),a.jsx(Xc,{}),a.jsx(qc,{}),a.jsx(HO,{}),a.jsx(BO,{}),a.jsx(Qc,{})]})}function i2(){return a.jsxs(L,{sx:{flexDirection:"column",gap:2},children:[a.jsx(RO,{}),a.jsx(OO,{})]})}function $de(){const e=W(o=>o.generation.horizontalSymmetrySteps),t=W(o=>o.generation.steps),n=te(),{t:r}=Z();return a.jsx(tt,{label:r("parameters.hSymmetryStep"),value:e,onChange:o=>n(Ew(o)),min:0,max:t,step:1,withInput:!0,withSliderMarks:!0,withReset:!0,handleReset:()=>n(Ew(0))})}function Lde(){const e=W(o=>o.generation.verticalSymmetrySteps),t=W(o=>o.generation.steps),n=te(),{t:r}=Z();return a.jsx(tt,{label:r("parameters.vSymmetryStep"),value:e,onChange:o=>n(Mw(o)),min:0,max:t,step:1,withInput:!0,withSliderMarks:!0,withReset:!0,handleReset:()=>n(Mw(0))})}function zde(){const e=W(n=>n.generation.shouldUseSymmetry),t=te();return a.jsx(fn,{label:"Enable Symmetry",isChecked:e,onChange:n=>t(CT(n.target.checked))})}const Fde=le(xe,e=>({activeLabel:e.generation.shouldUseSymmetry?"Enabled":void 0}),Se),Bde=()=>{const{t:e}=Z(),{activeLabel:t}=W(Fde);return Bt("symmetry").isFeatureEnabled?a.jsx(oo,{label:e("parameters.symmetry"),activeLabel:t,children:a.jsxs(L,{sx:{gap:2,flexDirection:"column"},children:[a.jsx(zde,{}),a.jsx($de,{}),a.jsx(Lde,{})]})}):null},l2=d.memo(Bde),Hde=le([xe],({generation:e,hotkeys:t,config:n})=>{const{initial:r,min:o,sliderMax:s,inputMax:i,fineStep:l,coarseStep:u}=n.sd.img2imgStrength,{img2imgStrength:p}=e,m=t.shift?l:u;return{img2imgStrength:p,initial:r,min:o,sliderMax:s,inputMax:i,step:m}},Se),Vde=()=>{const{img2imgStrength:e,initial:t,min:n,sliderMax:r,inputMax:o,step:s}=W(Hde),i=te(),{t:l}=Z(),u=d.useCallback(m=>i(Zp(m)),[i]),p=d.useCallback(()=>{i(Zp(t))},[i,t]);return a.jsx(Et,{feature:"paramDenoisingStrength",children:a.jsx(Rc,{children:a.jsx(tt,{label:`${l("parameters.denoisingStrength")}`,step:s,min:n,max:r,onChange:u,handleReset:p,value:e,isInteger:!1,withInput:!0,withSliderMarks:!0,withReset:!0,sliderNumberInputProps:{max:o}})})})},VO=d.memo(Vde),Wde=()=>{const e=W(n=>n.ui.shouldUseSliders),{iterationsAndSeedLabel:t}=a2();return a.jsx(oo,{label:"General",activeLabel:t,defaultIsOpen:!0,children:a.jsxs(L,{sx:{flexDirection:"column",gap:3},children:[e?a.jsxs(a.Fragment,{children:[a.jsx(rs,{}),a.jsx(Ps,{}),a.jsx(_s,{}),a.jsx(Is,{}),a.jsx(Ie,{pt:2,children:a.jsx(Es,{})}),a.jsx(Oc,{})]}):a.jsxs(a.Fragment,{children:[a.jsxs(L,{gap:3,children:[a.jsx(rs,{}),a.jsx(Ps,{}),a.jsx(_s,{})]}),a.jsx(Is,{}),a.jsx(Ie,{pt:2,children:a.jsx(Es,{})}),a.jsx(Oc,{})]}),a.jsx(VO,{}),a.jsx($O,{})]})})},Ude=d.memo(Wde),Gde=()=>a.jsxs(a.Fragment,{children:[a.jsx(i2,{}),a.jsx(Ude,{}),a.jsx(Yc,{}),a.jsx(Xc,{}),a.jsx(qc,{}),a.jsx(l2,{}),a.jsx(Qc,{})]}),Kde=d.memo(Gde),qde=()=>a.jsxs(a.Fragment,{children:[a.jsx(i2,{}),a.jsx(FO,{}),a.jsx(Yc,{}),a.jsx(Xc,{}),a.jsx(qc,{}),a.jsx(l2,{}),a.jsx(Qc,{})]}),Xde=d.memo(qde),Qde=()=>{const e=W(n=>n.ui.shouldUseSliders),{iterationsAndSeedLabel:t}=a2();return a.jsx(oo,{label:"General",activeLabel:t,defaultIsOpen:!0,children:a.jsxs(L,{sx:{flexDirection:"column",gap:3},children:[e?a.jsxs(a.Fragment,{children:[a.jsx(rs,{}),a.jsx(Ps,{}),a.jsx(_s,{}),a.jsx(Is,{}),a.jsx(Ie,{pt:2,children:a.jsx(Es,{})}),a.jsx(uh,{})]}):a.jsxs(a.Fragment,{children:[a.jsxs(L,{gap:3,children:[a.jsx(rs,{}),a.jsx(Ps,{}),a.jsx(_s,{})]}),a.jsx(Is,{}),a.jsx(Ie,{pt:2,children:a.jsx(Es,{})}),a.jsx(uh,{})]}),a.jsx(VO,{})]})})},Yde=d.memo(Qde),Zde=()=>a.jsxs(a.Fragment,{children:[a.jsx(i2,{}),a.jsx(Yde,{}),a.jsx(Yc,{}),a.jsx(Xc,{}),a.jsx(qc,{}),a.jsx(l2,{}),a.jsx(HO,{}),a.jsx(BO,{}),a.jsx(Qc,{})]}),Jde=d.memo(Zde),efe=()=>{const e=W(Jn),t=W(n=>n.generation.model);return e==="txt2img"?a.jsx(Kp,{children:t&&t.base_model==="sdxl"?a.jsx(Kue,{}):a.jsx(Xde,{})}):e==="img2img"?a.jsx(Kp,{children:t&&t.base_model==="sdxl"?a.jsx(Wue,{}):a.jsx(Kde,{})}):e==="unifiedCanvas"?a.jsx(Kp,{children:t&&t.base_model==="sdxl"?a.jsx(Nde,{}):a.jsx(Jde,{})}):null},tfe=d.memo(efe),Kp=d.memo(e=>a.jsxs(L,{sx:{w:"full",h:"full",flexDir:"column",gap:2},children:[a.jsx(Q8,{}),a.jsx(L,{layerStyle:"first",sx:{w:"full",h:"full",position:"relative",borderRadius:"base",p:2},children:a.jsx(L,{sx:{w:"full",h:"full",position:"relative"},children:a.jsx(Ie,{sx:{position:"absolute",top:0,left:0,right:0,bottom:0},children:a.jsx(hg,{defer:!0,style:{height:"100%",width:"100%"},options:{scrollbars:{visibility:"auto",autoHide:"scroll",autoHideDelay:800,theme:"os-theme-dark"},overflow:{x:"hidden"}},children:a.jsx(L,{sx:{gap:2,flexDirection:"column",h:"full",w:"full"},children:e.children})})})})})]}));Kp.displayName="ParametersPanelWrapper";const nfe=le([xe],e=>{const{initialImage:t}=e.generation;return{initialImage:t,isResetButtonDisabled:!t}},Se),rfe=()=>{const{initialImage:e}=W(nfe),{currentData:t}=to((e==null?void 0:e.imageName)??$r.skipToken),n=d.useMemo(()=>{if(t)return{id:"initial-image",payloadType:"IMAGE_DTO",payload:{imageDTO:t}}},[t]),r=d.useMemo(()=>({id:"initial-image",actionType:"SET_INITIAL_IMAGE"}),[]);return a.jsx(ua,{imageDTO:t,droppableData:r,draggableData:n,isUploadDisabled:!0,fitContainer:!0,dropLabel:"Set as Initial Image",noContentFallback:a.jsx(Zn,{label:"No initial image selected"}),dataTestId:"initial-image"})},ofe=d.memo(rfe),sfe=le([xe],e=>{const{initialImage:t}=e.generation;return{isResetButtonDisabled:!t}},Se),afe={type:"SET_INITIAL_IMAGE"},ife=()=>{const{isResetButtonDisabled:e}=W(sfe),t=te(),{getUploadButtonProps:n,getUploadInputProps:r}=Vy({postUploadAction:afe}),o=d.useCallback(()=>{t(wT())},[t]);return a.jsxs(L,{layerStyle:"first",sx:{position:"relative",flexDirection:"column",height:"full",width:"full",alignItems:"center",justifyContent:"center",borderRadius:"base",p:2,gap:4},children:[a.jsxs(L,{sx:{w:"full",flexWrap:"wrap",justifyContent:"center",alignItems:"center",gap:2},children:[a.jsx(ve,{sx:{ps:2,fontWeight:600,userSelect:"none",color:"base.700",_dark:{color:"base.200"}},children:"Initial Image"}),a.jsx(ba,{}),a.jsx(Fe,{tooltip:"Upload Initial Image","aria-label":"Upload Initial Image",icon:a.jsx(cg,{}),...n()}),a.jsx(Fe,{tooltip:"Reset Initial Image","aria-label":"Reset Initial Image",icon:a.jsx(Ud,{}),onClick:o,isDisabled:e})]}),a.jsx(ofe,{}),a.jsx("input",{...r()})]})},lfe=d.memo(ife),cfe=e=>{const{onClick:t,isDisabled:n}=e,{t:r}=Z(),o=W(s=>s.system.isConnected);return a.jsx(Fe,{onClick:t,icon:a.jsx(Br,{}),tooltip:`${r("gallery.deleteImage")} (Del)`,"aria-label":`${r("gallery.deleteImage")} (Del)`,isDisabled:n||!o,colorScheme:"error"})},WO=()=>{const[e,{isLoading:t}]=bh({fixedCacheKey:"enqueueBatch"}),[n,{isLoading:r}]=ST({fixedCacheKey:"enqueueGraph"}),[o,{isLoading:s}]=SI({fixedCacheKey:"resumeProcessor"}),[i,{isLoading:l}]=CI({fixedCacheKey:"pauseProcessor"}),[u,{isLoading:p}]=Yx({fixedCacheKey:"cancelQueueItem"}),[m,{isLoading:h}]=yI({fixedCacheKey:"clearQueue"}),[g,{isLoading:x}]=RI({fixedCacheKey:"pruneQueue"});return t||r||s||l||p||h||x},ufe=[{label:"RealESRGAN x2 Plus",value:"RealESRGAN_x2plus.pth",tooltip:"Attempts to retain sharpness, low smoothing",group:"x2 Upscalers"},{label:"RealESRGAN x4 Plus",value:"RealESRGAN_x4plus.pth",tooltip:"Best for photos and highly detailed images, medium smoothing",group:"x4 Upscalers"},{label:"RealESRGAN x4 Plus (anime 6B)",value:"RealESRGAN_x4plus_anime_6B.pth",tooltip:"Best for anime/manga, high smoothing",group:"x4 Upscalers"},{label:"ESRGAN SRx4",value:"ESRGAN_SRx4_DF2KOST_official-ff704c30.pth",tooltip:"Retains sharpness, low smoothing",group:"x4 Upscalers"}];function dfe(){const e=W(r=>r.postprocessing.esrganModelName),t=te(),n=r=>t(kT(r));return a.jsx(Pn,{label:"ESRGAN Model",value:e,itemComponent:ui,onChange:n,data:ufe})}const ffe=e=>{const{imageDTO:t}=e,n=te(),r=WO(),{t:o}=Z(),{isOpen:s,onOpen:i,onClose:l}=Lr(),{isAllowedToUpscale:u,detail:p}=jT(t),m=d.useCallback(()=>{l(),!(!t||!u)&&n(DI({imageDTO:t}))},[n,t,u,l]);return a.jsx(qd,{isOpen:s,onClose:l,triggerComponent:a.jsx(Fe,{tooltip:o("parameters.upscale"),onClick:i,icon:a.jsx(uM,{}),"aria-label":o("parameters.upscale")}),children:a.jsxs(L,{sx:{flexDirection:"column",gap:4},children:[a.jsx(dfe,{}),a.jsx(at,{tooltip:p,size:"sm",isDisabled:!t||r||!u,onClick:m,children:o("parameters.upscaleImage")})]})})},pfe=d.memo(ffe),mfe=le([xe,Jn],({gallery:e,system:t,ui:n,config:r},o)=>{const{isConnected:s,shouldConfirmOnDelete:i,denoiseProgress:l}=t,{shouldShowImageDetails:u,shouldHidePreview:p,shouldShowProgressInViewer:m}=n,{shouldFetchMetadataFromApi:h}=r,g=e.selection[e.selection.length-1];return{shouldConfirmOnDelete:i,isConnected:s,shouldDisableToolbarButtons:!!(l!=null&&l.progress_image)||!g,shouldShowImageDetails:u,activeTabName:o,shouldHidePreview:p,shouldShowProgressInViewer:m,lastSelectedImage:g,shouldFetchMetadataFromApi:h}},{memoizeOptions:{resultEqualityCheck:Ft}}),hfe=e=>{const t=te(),{isConnected:n,shouldDisableToolbarButtons:r,shouldShowImageDetails:o,lastSelectedImage:s,shouldShowProgressInViewer:i,shouldFetchMetadataFromApi:l}=W(mfe),u=Bt("upscaling").isFeatureEnabled,p=WO(),m=sl(),{t:h}=Z(),{recallBothPrompts:g,recallSeed:x,recallAllParameters:y}=Sg(),{currentData:b}=to((s==null?void 0:s.image_name)??$r.skipToken),w=d.useMemo(()=>s?{image:s,shouldFetchMetadataFromApi:l}:$r.skipToken,[s,l]),{metadata:S,workflow:j,isLoading:_}=Gx(w,{selectFromResult:B=>{var V,U;return{isLoading:B.isFetching,metadata:(V=B==null?void 0:B.currentData)==null?void 0:V.metadata,workflow:(U=B==null?void 0:B.currentData)==null?void 0:U.workflow}}}),E=d.useCallback(()=>{j&&t(Xx(j))},[t,j]),I=d.useCallback(()=>{y(S)},[S,y]);et("a",()=>{},[S,y]);const M=d.useCallback(()=>{x(S==null?void 0:S.seed)},[S==null?void 0:S.seed,x]);et("s",M,[b]);const R=d.useCallback(()=>{g(S==null?void 0:S.positive_prompt,S==null?void 0:S.negative_prompt,S==null?void 0:S.positive_style_prompt,S==null?void 0:S.negative_style_prompt)},[S==null?void 0:S.negative_prompt,S==null?void 0:S.positive_prompt,S==null?void 0:S.positive_style_prompt,S==null?void 0:S.negative_style_prompt,g]);et("p",R,[b]),et("w",E,[j]);const D=d.useCallback(()=>{t(F8()),t(vh(b))},[t,b]);et("shift+i",D,[b]);const A=d.useCallback(()=>{b&&t(DI({imageDTO:b}))},[t,b]),O=d.useCallback(()=>{b&&t(xh([b]))},[t,b]);et("Shift+U",()=>{A()},{enabled:()=>!!(u&&!r&&n)},[u,b,r,n]);const T=d.useCallback(()=>t(_T(!o)),[t,o]);et("i",()=>{b?T():m({title:h("toast.metadataLoadFailed"),status:"error",duration:2500,isClosable:!0})},[b,o,m]),et("delete",()=>{O()},[t,b]);const X=d.useCallback(()=>{t(lI(!i))},[t,i]);return a.jsx(a.Fragment,{children:a.jsxs(L,{sx:{flexWrap:"wrap",justifyContent:"center",alignItems:"center",gap:2},...e,children:[a.jsx(Vt,{isAttached:!0,isDisabled:r,children:a.jsxs(Ah,{children:[a.jsx(Th,{as:Fe,"aria-label":h("parameters.imageActions"),tooltip:h("parameters.imageActions"),isDisabled:!b,icon:a.jsx(Coe,{})}),a.jsx(Gi,{motionProps:vc,children:b&&a.jsx(B8,{imageDTO:b})})]})}),a.jsxs(Vt,{isAttached:!0,isDisabled:r,children:[a.jsx(Fe,{isLoading:_,icon:a.jsx(Wy,{}),tooltip:`${h("nodes.loadWorkflow")} (W)`,"aria-label":`${h("nodes.loadWorkflow")} (W)`,isDisabled:!j,onClick:E}),a.jsx(Fe,{isLoading:_,icon:a.jsx(gM,{}),tooltip:`${h("parameters.usePrompt")} (P)`,"aria-label":`${h("parameters.usePrompt")} (P)`,isDisabled:!(S!=null&&S.positive_prompt),onClick:R}),a.jsx(Fe,{isLoading:_,icon:a.jsx(vM,{}),tooltip:`${h("parameters.useSeed")} (S)`,"aria-label":`${h("parameters.useSeed")} (S)`,isDisabled:(S==null?void 0:S.seed)===null||(S==null?void 0:S.seed)===void 0,onClick:M}),a.jsx(Fe,{isLoading:_,icon:a.jsx(aM,{}),tooltip:`${h("parameters.useAll")} (A)`,"aria-label":`${h("parameters.useAll")} (A)`,isDisabled:!S,onClick:I})]}),u&&a.jsx(Vt,{isAttached:!0,isDisabled:p,children:u&&a.jsx(pfe,{imageDTO:b})}),a.jsx(Vt,{isAttached:!0,children:a.jsx(Fe,{icon:a.jsx(lM,{}),tooltip:`${h("parameters.info")} (I)`,"aria-label":`${h("parameters.info")} (I)`,isChecked:o,onClick:T})}),a.jsx(Vt,{isAttached:!0,children:a.jsx(Fe,{"aria-label":h("settings.displayInProgress"),tooltip:h("settings.displayInProgress"),icon:a.jsx(GJ,{}),isChecked:i,onClick:X})}),a.jsx(Vt,{isAttached:!0,children:a.jsx(cfe,{onClick:O})})]})})},gfe=d.memo(hfe),vfe=le([xe,Qx],(e,t)=>{var j,_;const{data:n,status:r}=IT.endpoints.listImages.select(t)(e),{data:o}=e.gallery.galleryView==="images"?Ow.endpoints.getBoardImagesTotal.select(t.board_id??"none")(e):Ow.endpoints.getBoardAssetsTotal.select(t.board_id??"none")(e),s=e.gallery.selection[e.gallery.selection.length-1],i=r==="pending";if(!n||!s||o===0)return{isFetching:i,queryArgs:t,isOnFirstImage:!0,isOnLastImage:!0};const l={...t,offset:n.ids.length,limit:bI},u=PT.getSelectors(),p=u.selectAll(n),m=p.findIndex(E=>E.image_name===s.image_name),h=Bi(m+1,0,p.length-1),g=Bi(m-1,0,p.length-1),x=(j=p[h])==null?void 0:j.image_name,y=(_=p[g])==null?void 0:_.image_name,b=x?u.selectById(n,x):void 0,w=y?u.selectById(n,y):void 0,S=p.length;return{loadedImagesCount:p.length,currentImageIndex:m,areMoreImagesAvailable:(o??0)>S,isFetching:r==="pending",nextImage:b,prevImage:w,queryArgs:l}},{memoizeOptions:{resultEqualityCheck:Ft}}),UO=()=>{const e=te(),{nextImage:t,prevImage:n,areMoreImagesAvailable:r,isFetching:o,queryArgs:s,loadedImagesCount:i,currentImageIndex:l}=W(vfe),u=d.useCallback(()=>{n&&e(Rw(n))},[e,n]),p=d.useCallback(()=>{t&&e(Rw(t))},[e,t]),[m]=xI(),h=d.useCallback(()=>{m(s)},[m,s]);return{handlePrevImage:u,handleNextImage:p,isOnFirstImage:l===0,isOnLastImage:l!==void 0&&l===i-1,nextImage:t,prevImage:n,areMoreImagesAvailable:r,handleLoadMoreImages:h,isFetching:o}};function xfe(e){return Te({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M245.09 327.74v-37.32c57.07 0 84.51 13.47 108.58 38.68 5.4 5.65 15 1.32 14.29-6.43-5.45-61.45-34.14-117.09-122.87-117.09v-37.32a8.32 8.32 0 00-14.05-6L146.58 242a8.2 8.2 0 000 11.94L231 333.71a8.32 8.32 0 0014.09-5.97z"}},{tag:"path",attr:{fill:"none",strokeMiterlimit:"10",strokeWidth:"32",d:"M256 64C150 64 64 150 64 256s86 192 192 192 192-86 192-192S362 64 256 64z"}}]})(e)}const bfe=({label:e,value:t,onClick:n,isLink:r,labelPosition:o,withCopy:s=!1})=>{const{t:i}=Z();return t?a.jsxs(L,{gap:2,children:[n&&a.jsx(Ht,{label:`Recall ${e}`,children:a.jsx(ys,{"aria-label":i("accessibility.useThisParameter"),icon:a.jsx(xfe,{}),size:"xs",variant:"ghost",fontSize:20,onClick:n})}),s&&a.jsx(Ht,{label:`Copy ${e}`,children:a.jsx(ys,{"aria-label":`Copy ${e}`,icon:a.jsx(Hc,{}),size:"xs",variant:"ghost",fontSize:14,onClick:()=>navigator.clipboard.writeText(t.toString())})}),a.jsxs(L,{direction:o?"column":"row",children:[a.jsxs(ve,{fontWeight:"semibold",whiteSpace:"pre-wrap",pr:2,children:[e,":"]}),r?a.jsxs(Oh,{href:t.toString(),isExternal:!0,wordBreak:"break-all",children:[t.toString()," ",a.jsx(JM,{mx:"2px"})]}):a.jsx(ve,{overflowY:"scroll",wordBreak:"break-all",children:t.toString()})]})]}):null},xr=d.memo(bfe),yfe=e=>{const{metadata:t}=e,{t:n}=Z(),{recallPositivePrompt:r,recallNegativePrompt:o,recallSeed:s,recallCfgScale:i,recallModel:l,recallScheduler:u,recallSteps:p,recallWidth:m,recallHeight:h,recallStrength:g,recallLoRA:x,recallControlNet:y,recallIPAdapter:b}=Sg(),w=d.useCallback(()=>{r(t==null?void 0:t.positive_prompt)},[t==null?void 0:t.positive_prompt,r]),S=d.useCallback(()=>{o(t==null?void 0:t.negative_prompt)},[t==null?void 0:t.negative_prompt,o]),j=d.useCallback(()=>{s(t==null?void 0:t.seed)},[t==null?void 0:t.seed,s]),_=d.useCallback(()=>{l(t==null?void 0:t.model)},[t==null?void 0:t.model,l]),E=d.useCallback(()=>{m(t==null?void 0:t.width)},[t==null?void 0:t.width,m]),I=d.useCallback(()=>{h(t==null?void 0:t.height)},[t==null?void 0:t.height,h]),M=d.useCallback(()=>{u(t==null?void 0:t.scheduler)},[t==null?void 0:t.scheduler,u]),R=d.useCallback(()=>{p(t==null?void 0:t.steps)},[t==null?void 0:t.steps,p]),D=d.useCallback(()=>{i(t==null?void 0:t.cfg_scale)},[t==null?void 0:t.cfg_scale,i]),A=d.useCallback(()=>{g(t==null?void 0:t.strength)},[t==null?void 0:t.strength,g]),O=d.useCallback(U=>{x(U)},[x]),T=d.useCallback(U=>{y(U)},[y]),X=d.useCallback(U=>{b(U)},[b]),B=d.useMemo(()=>t!=null&&t.controlnets?t.controlnets.filter(U=>c1(U.control_model)):[],[t==null?void 0:t.controlnets]),V=d.useMemo(()=>t!=null&&t.ipAdapters?t.ipAdapters.filter(U=>c1(U.ip_adapter_model)):[],[t==null?void 0:t.ipAdapters]);return!t||Object.keys(t).length===0?null:a.jsxs(a.Fragment,{children:[t.created_by&&a.jsx(xr,{label:n("metadata.createdBy"),value:t.created_by}),t.generation_mode&&a.jsx(xr,{label:n("metadata.generationMode"),value:t.generation_mode}),t.positive_prompt&&a.jsx(xr,{label:n("metadata.positivePrompt"),labelPosition:"top",value:t.positive_prompt,onClick:w}),t.negative_prompt&&a.jsx(xr,{label:n("metadata.negativePrompt"),labelPosition:"top",value:t.negative_prompt,onClick:S}),t.seed!==void 0&&t.seed!==null&&a.jsx(xr,{label:n("metadata.seed"),value:t.seed,onClick:j}),t.model!==void 0&&t.model!==null&&t.model.model_name&&a.jsx(xr,{label:n("metadata.model"),value:t.model.model_name,onClick:_}),t.width&&a.jsx(xr,{label:n("metadata.width"),value:t.width,onClick:E}),t.height&&a.jsx(xr,{label:n("metadata.height"),value:t.height,onClick:I}),t.scheduler&&a.jsx(xr,{label:n("metadata.scheduler"),value:t.scheduler,onClick:M}),t.steps&&a.jsx(xr,{label:n("metadata.steps"),value:t.steps,onClick:R}),t.cfg_scale!==void 0&&t.cfg_scale!==null&&a.jsx(xr,{label:n("metadata.cfgScale"),value:t.cfg_scale,onClick:D}),t.strength&&a.jsx(xr,{label:n("metadata.strength"),value:t.strength,onClick:A}),t.loras&&t.loras.map((U,N)=>{if(fI(U.lora))return a.jsx(xr,{label:"LoRA",value:`${U.lora.model_name} - ${U.weight}`,onClick:()=>O(U)},N)}),B.map((U,N)=>{var $;return a.jsx(xr,{label:"ControlNet",value:`${($=U.control_model)==null?void 0:$.model_name} - ${U.control_weight}`,onClick:()=>T(U)},N)}),V.map((U,N)=>{var $;return a.jsx(xr,{label:"IP Adapter",value:`${($=U.ip_adapter_model)==null?void 0:$.model_name} - ${U.weight}`,onClick:()=>X(U)},N)})]})},Cfe=d.memo(yfe),wfe=({image:e})=>{const{t}=Z(),{shouldFetchMetadataFromApi:n}=W(Ky),{metadata:r,workflow:o}=Gx({image:e,shouldFetchMetadataFromApi:n},{selectFromResult:s=>{var i,l;return{metadata:(i=s==null?void 0:s.currentData)==null?void 0:i.metadata,workflow:(l=s==null?void 0:s.currentData)==null?void 0:l.workflow}}});return a.jsxs(L,{layerStyle:"first",sx:{padding:4,gap:1,flexDirection:"column",width:"full",height:"full",borderRadius:"base",position:"absolute",overflow:"hidden"},children:[a.jsxs(L,{gap:2,children:[a.jsx(ve,{fontWeight:"semibold",children:"File:"}),a.jsxs(Oh,{href:e.image_url,isExternal:!0,maxW:"calc(100% - 3rem)",children:[e.image_name,a.jsx(JM,{mx:"2px"})]})]}),a.jsx(Cfe,{metadata:r}),a.jsxs(rl,{variant:"line",sx:{display:"flex",flexDir:"column",w:"full",h:"full"},children:[a.jsxs(ol,{children:[a.jsx(Tr,{children:t("metadata.metadata")}),a.jsx(Tr,{children:t("metadata.imageDetails")}),a.jsx(Tr,{children:t("metadata.workflow")})]}),a.jsxs(zc,{children:[a.jsx(So,{children:r?a.jsx(Ya,{data:r,label:t("metadata.metadata")}):a.jsx(Zn,{label:t("metadata.noMetaData")})}),a.jsx(So,{children:e?a.jsx(Ya,{data:e,label:t("metadata.imageDetails")}):a.jsx(Zn,{label:t("metadata.noImageDetails")})}),a.jsx(So,{children:o?a.jsx(Ya,{data:o,label:t("metadata.workflow")}):a.jsx(Zn,{label:t("nodes.noWorkflow")})})]})]})]})},Sfe=d.memo(wfe),Yv={color:"base.100",pointerEvents:"auto"},kfe=()=>{const{t:e}=Z(),{handlePrevImage:t,handleNextImage:n,isOnFirstImage:r,isOnLastImage:o,handleLoadMoreImages:s,areMoreImagesAvailable:i,isFetching:l}=UO();return a.jsxs(Ie,{sx:{position:"relative",height:"100%",width:"100%"},children:[a.jsx(Ie,{sx:{pos:"absolute",top:"50%",transform:"translate(0, -50%)",insetInlineStart:0},children:!r&&a.jsx(ys,{"aria-label":e("accessibility.previousImage"),icon:a.jsx(IJ,{size:64}),variant:"unstyled",onClick:t,boxSize:16,sx:Yv})}),a.jsxs(Ie,{sx:{pos:"absolute",top:"50%",transform:"translate(0, -50%)",insetInlineEnd:0},children:[!o&&a.jsx(ys,{"aria-label":e("accessibility.nextImage"),icon:a.jsx(PJ,{size:64}),variant:"unstyled",onClick:n,boxSize:16,sx:Yv}),o&&i&&!l&&a.jsx(ys,{"aria-label":e("accessibility.loadMore"),icon:a.jsx(_J,{size:64}),variant:"unstyled",onClick:s,boxSize:16,sx:Yv}),o&&i&&l&&a.jsx(L,{sx:{w:16,h:16,alignItems:"center",justifyContent:"center"},children:a.jsx(fa,{opacity:.5,size:"xl"})})]})]})},GO=d.memo(kfe),jfe=le([xe,ET],({ui:e,system:t},n)=>{const{shouldShowImageDetails:r,shouldHidePreview:o,shouldShowProgressInViewer:s}=e,{denoiseProgress:i,shouldAntialiasProgressImage:l}=t;return{shouldShowImageDetails:r,shouldHidePreview:o,imageName:n==null?void 0:n.image_name,denoiseProgress:i,shouldShowProgressInViewer:s,shouldAntialiasProgressImage:l}},{memoizeOptions:{resultEqualityCheck:Ft}}),_fe=()=>{const{shouldShowImageDetails:e,imageName:t,denoiseProgress:n,shouldShowProgressInViewer:r,shouldAntialiasProgressImage:o}=W(jfe),{handlePrevImage:s,handleNextImage:i,isOnLastImage:l,handleLoadMoreImages:u,areMoreImagesAvailable:p,isFetching:m}=UO();et("left",()=>{s()},[s]),et("right",()=>{if(l&&p&&!m){u();return}l||i()},[l,p,u,m,i]);const{currentData:h}=to(t??$r.skipToken),g=d.useMemo(()=>{if(h)return{id:"current-image",payloadType:"IMAGE_DTO",payload:{imageDTO:h}}},[h]),x=d.useMemo(()=>({id:"current-image",actionType:"SET_CURRENT_IMAGE"}),[]),[y,b]=d.useState(!1),w=d.useRef(0),{t:S}=Z(),j=d.useCallback(()=>{b(!0),window.clearTimeout(w.current)},[]),_=d.useCallback(()=>{w.current=window.setTimeout(()=>{b(!1)},500)},[]);return a.jsxs(L,{onMouseOver:j,onMouseOut:_,sx:{width:"full",height:"full",alignItems:"center",justifyContent:"center",position:"relative"},children:[n!=null&&n.progress_image&&r?a.jsx(ga,{src:n.progress_image.dataURL,width:n.progress_image.width,height:n.progress_image.height,draggable:!1,"data-testid":"progress-image",sx:{objectFit:"contain",maxWidth:"full",maxHeight:"full",height:"auto",position:"absolute",borderRadius:"base",imageRendering:o?"auto":"pixelated"}}):a.jsx(ua,{imageDTO:h,droppableData:x,draggableData:g,isUploadDisabled:!0,fitContainer:!0,useThumbailFallback:!0,dropLabel:S("gallery.setCurrentImage"),noContentFallback:a.jsx(Zn,{icon:Yi,label:"No image selected"}),dataTestId:"image-preview"}),e&&h&&a.jsx(Ie,{sx:{position:"absolute",top:"0",width:"full",height:"full",borderRadius:"base"},children:a.jsx(Sfe,{image:h})}),a.jsx(dr,{children:!e&&h&&y&&a.jsx(In.div,{initial:{opacity:0},animate:{opacity:1,transition:{duration:.1}},exit:{opacity:0,transition:{duration:.1}},style:{position:"absolute",top:"0",width:"100%",height:"100%",pointerEvents:"none"},children:a.jsx(GO,{})},"nextPrevButtons")})]})},Ife=d.memo(_fe),Pfe=()=>a.jsxs(L,{sx:{position:"relative",flexDirection:"column",height:"100%",width:"100%",rowGap:4,alignItems:"center",justifyContent:"center"},children:[a.jsx(gfe,{}),a.jsx(Ife,{})]}),Efe=d.memo(Pfe),Mfe=()=>a.jsx(Ie,{layerStyle:"first",sx:{position:"relative",width:"100%",height:"100%",p:2,borderRadius:"base"},children:a.jsx(L,{sx:{width:"100%",height:"100%"},children:a.jsx(Efe,{})})}),KO=d.memo(Mfe),Ofe=()=>{const e=d.useRef(null),t=d.useCallback(()=>{e.current&&e.current.setLayout([50,50])},[]),n=Jy();return a.jsx(Ie,{sx:{w:"full",h:"full"},children:a.jsxs(Ig,{ref:e,autoSaveId:"imageTab.content",direction:"horizontal",style:{height:"100%",width:"100%"},storage:n,units:"percentages",children:[a.jsx(Qa,{id:"imageTab.content.initImage",order:0,defaultSize:50,minSize:25,style:{position:"relative"},children:a.jsx(lfe,{})}),a.jsx(lh,{onDoubleClick:t}),a.jsx(Qa,{id:"imageTab.content.selectedImage",order:1,defaultSize:50,minSize:25,children:a.jsx(KO,{})})]})})},Rfe=d.memo(Ofe);var Dfe=function e(t,n){if(t===n)return!0;if(t&&n&&typeof t=="object"&&typeof n=="object"){if(t.constructor!==n.constructor)return!1;var r,o,s;if(Array.isArray(t)){if(r=t.length,r!=n.length)return!1;for(o=r;o--!==0;)if(!e(t[o],n[o]))return!1;return!0}if(t.constructor===RegExp)return t.source===n.source&&t.flags===n.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===n.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===n.toString();if(s=Object.keys(t),r=s.length,r!==Object.keys(n).length)return!1;for(o=r;o--!==0;)if(!Object.prototype.hasOwnProperty.call(n,s[o]))return!1;for(o=r;o--!==0;){var i=s[o];if(!e(t[i],n[i]))return!1}return!0}return t!==t&&n!==n};const f_=xd(Dfe);function Ex(e){return e===null||typeof e!="object"?{}:Object.keys(e).reduce((t,n)=>{const r=e[n];return r!=null&&r!==!1&&(t[n]=r),t},{})}var Afe=Object.defineProperty,p_=Object.getOwnPropertySymbols,Tfe=Object.prototype.hasOwnProperty,Nfe=Object.prototype.propertyIsEnumerable,m_=(e,t,n)=>t in e?Afe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,$fe=(e,t)=>{for(var n in t||(t={}))Tfe.call(t,n)&&m_(e,n,t[n]);if(p_)for(var n of p_(t))Nfe.call(t,n)&&m_(e,n,t[n]);return e};function qO(e,t){if(t===null||typeof t!="object")return{};const n=$fe({},t);return Object.keys(t).forEach(r=>{r.includes(`${String(e)}.`)&&delete n[r]}),n}const Lfe="__MANTINE_FORM_INDEX__";function h_(e,t){return t?typeof t=="boolean"?t:Array.isArray(t)?t.includes(e.replace(/[.][0-9]/g,`.${Lfe}`)):!1:!1}function g_(e,t,n){typeof n.value=="object"&&(n.value=tc(n.value)),!n.enumerable||n.get||n.set||!n.configurable||!n.writable||t==="__proto__"?Object.defineProperty(e,t,n):e[t]=n.value}function tc(e){if(typeof e!="object")return e;var t=0,n,r,o,s=Object.prototype.toString.call(e);if(s==="[object Object]"?o=Object.create(e.__proto__||null):s==="[object Array]"?o=Array(e.length):s==="[object Set]"?(o=new Set,e.forEach(function(i){o.add(tc(i))})):s==="[object Map]"?(o=new Map,e.forEach(function(i,l){o.set(tc(l),tc(i))})):s==="[object Date]"?o=new Date(+e):s==="[object RegExp]"?o=new RegExp(e.source,e.flags):s==="[object DataView]"?o=new e.constructor(tc(e.buffer)):s==="[object ArrayBuffer]"?o=e.slice(0):s.slice(-6)==="Array]"&&(o=new e.constructor(e)),o){for(r=Object.getOwnPropertySymbols(e);t0,errors:t}}function Mx(e,t,n="",r={}){return typeof e!="object"||e===null?r:Object.keys(e).reduce((o,s)=>{const i=e[s],l=`${n===""?"":`${n}.`}${s}`,u=Qs(l,t);let p=!1;return typeof i=="function"&&(o[l]=i(u,t,l)),typeof i=="object"&&Array.isArray(u)&&(p=!0,u.forEach((m,h)=>Mx(i,t,`${l}.${h}`,o))),typeof i=="object"&&typeof u=="object"&&u!==null&&(p||Mx(i,t,l,o)),o},r)}function Ox(e,t){return v_(typeof e=="function"?e(t):Mx(e,t))}function Dp(e,t,n){if(typeof e!="string")return{hasError:!1,error:null};const r=Ox(t,n),o=Object.keys(r.errors).find(s=>e.split(".").every((i,l)=>i===s.split(".")[l]));return{hasError:!!o,error:o?r.errors[o]:null}}function zfe(e,{from:t,to:n},r){const o=Qs(e,r);if(!Array.isArray(o))return r;const s=[...o],i=o[t];return s.splice(t,1),s.splice(n,0,i),Ag(e,s,r)}var Ffe=Object.defineProperty,x_=Object.getOwnPropertySymbols,Bfe=Object.prototype.hasOwnProperty,Hfe=Object.prototype.propertyIsEnumerable,b_=(e,t,n)=>t in e?Ffe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Vfe=(e,t)=>{for(var n in t||(t={}))Bfe.call(t,n)&&b_(e,n,t[n]);if(x_)for(var n of x_(t))Hfe.call(t,n)&&b_(e,n,t[n]);return e};function Wfe(e,{from:t,to:n},r){const o=`${e}.${t}`,s=`${e}.${n}`,i=Vfe({},r);return Object.keys(r).every(l=>{let u,p;if(l.startsWith(o)&&(u=l,p=l.replace(o,s)),l.startsWith(s)&&(u=l.replace(s,o),p=l),u&&p){const m=i[u],h=i[p];return h===void 0?delete i[u]:i[u]=h,m===void 0?delete i[p]:i[p]=m,!1}return!0}),i}function Ufe(e,t,n){const r=Qs(e,n);return Array.isArray(r)?Ag(e,r.filter((o,s)=>s!==t),n):n}var Gfe=Object.defineProperty,y_=Object.getOwnPropertySymbols,Kfe=Object.prototype.hasOwnProperty,qfe=Object.prototype.propertyIsEnumerable,C_=(e,t,n)=>t in e?Gfe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Xfe=(e,t)=>{for(var n in t||(t={}))Kfe.call(t,n)&&C_(e,n,t[n]);if(y_)for(var n of y_(t))qfe.call(t,n)&&C_(e,n,t[n]);return e};function w_(e,t){const n=e.substring(t.length+1).split(".")[0];return parseInt(n,10)}function S_(e,t,n,r){if(t===void 0)return n;const o=`${String(e)}`;let s=n;r===-1&&(s=qO(`${o}.${t}`,s));const i=Xfe({},s),l=new Set;return Object.entries(s).filter(([u])=>{if(!u.startsWith(`${o}.`))return!1;const p=w_(u,o);return Number.isNaN(p)?!1:p>=t}).forEach(([u,p])=>{const m=w_(u,o),h=u.replace(`${o}.${m}`,`${o}.${m+r}`);i[h]=p,l.add(h),l.has(u)||delete i[u]}),i}function Qfe(e,t,n,r){const o=Qs(e,r);if(!Array.isArray(o))return r;const s=[...o];return s.splice(typeof n=="number"?n:s.length,0,t),Ag(e,s,r)}function k_(e,t){const n=Object.keys(e);if(typeof t=="string"){const r=n.filter(o=>o.startsWith(`${t}.`));return e[t]||r.some(o=>e[o])||!1}return n.some(r=>e[r])}function Yfe(e){return t=>{if(!t)e(t);else if(typeof t=="function")e(t);else if(typeof t=="object"&&"nativeEvent"in t){const{currentTarget:n}=t;n instanceof HTMLInputElement?n.type==="checkbox"?e(n.checked):e(n.value):(n instanceof HTMLTextAreaElement||n instanceof HTMLSelectElement)&&e(n.value)}else e(t)}}var Zfe=Object.defineProperty,Jfe=Object.defineProperties,epe=Object.getOwnPropertyDescriptors,j_=Object.getOwnPropertySymbols,tpe=Object.prototype.hasOwnProperty,npe=Object.prototype.propertyIsEnumerable,__=(e,t,n)=>t in e?Zfe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,La=(e,t)=>{for(var n in t||(t={}))tpe.call(t,n)&&__(e,n,t[n]);if(j_)for(var n of j_(t))npe.call(t,n)&&__(e,n,t[n]);return e},Zv=(e,t)=>Jfe(e,epe(t));function fl({initialValues:e={},initialErrors:t={},initialDirty:n={},initialTouched:r={},clearInputErrorOnChange:o=!0,validateInputOnChange:s=!1,validateInputOnBlur:i=!1,transformValues:l=p=>p,validate:u}={}){const[p,m]=d.useState(r),[h,g]=d.useState(n),[x,y]=d.useState(e),[b,w]=d.useState(Ex(t)),S=d.useRef(e),j=G=>{S.current=G},_=d.useCallback(()=>m({}),[]),E=G=>{const K=G?La(La({},x),G):x;j(K),g({})},I=d.useCallback(G=>w(K=>Ex(typeof G=="function"?G(K):G)),[]),M=d.useCallback(()=>w({}),[]),R=d.useCallback(()=>{y(e),M(),j(e),g({}),_()},[]),D=d.useCallback((G,K)=>I(ee=>Zv(La({},ee),{[G]:K})),[]),A=d.useCallback(G=>I(K=>{if(typeof G!="string")return K;const ee=La({},K);return delete ee[G],ee}),[]),O=d.useCallback(G=>g(K=>{if(typeof G!="string")return K;const ee=qO(G,K);return delete ee[G],ee}),[]),T=d.useCallback((G,K)=>{const ee=h_(G,s);O(G),m(ce=>Zv(La({},ce),{[G]:!0})),y(ce=>{const J=Ag(G,K,ce);if(ee){const ie=Dp(G,u,J);ie.hasError?D(G,ie.error):A(G)}return J}),!ee&&o&&D(G,null)},[]),X=d.useCallback(G=>{y(K=>{const ee=typeof G=="function"?G(K):G;return La(La({},K),ee)}),o&&M()},[]),B=d.useCallback((G,K)=>{O(G),y(ee=>zfe(G,K,ee)),w(ee=>Wfe(G,K,ee))},[]),V=d.useCallback((G,K)=>{O(G),y(ee=>Ufe(G,K,ee)),w(ee=>S_(G,K,ee,-1))},[]),U=d.useCallback((G,K,ee)=>{O(G),y(ce=>Qfe(G,K,ee,ce)),w(ce=>S_(G,ee,ce,1))},[]),N=d.useCallback(()=>{const G=Ox(u,x);return w(G.errors),G},[x,u]),$=d.useCallback(G=>{const K=Dp(G,u,x);return K.hasError?D(G,K.error):A(G),K},[x,u]),q=(G,{type:K="input",withError:ee=!0,withFocus:ce=!0}={})=>{const ie={onChange:Yfe(de=>T(G,de))};return ee&&(ie.error=b[G]),K==="checkbox"?ie.checked=Qs(G,x):ie.value=Qs(G,x),ce&&(ie.onFocus=()=>m(de=>Zv(La({},de),{[G]:!0})),ie.onBlur=()=>{if(h_(G,i)){const de=Dp(G,u,x);de.hasError?D(G,de.error):A(G)}}),ie},F=(G,K)=>ee=>{ee==null||ee.preventDefault();const ce=N();ce.hasErrors?K==null||K(ce.errors,x,ee):G==null||G(l(x),ee)},Q=G=>l(G||x),Y=d.useCallback(G=>{G.preventDefault(),R()},[]),se=G=>{if(G){const ee=Qs(G,h);if(typeof ee=="boolean")return ee;const ce=Qs(G,x),J=Qs(G,S.current);return!f_(ce,J)}return Object.keys(h).length>0?k_(h):!f_(x,S.current)},ae=d.useCallback(G=>k_(p,G),[p]),re=d.useCallback(G=>G?!Dp(G,u,x).hasError:!Ox(u,x).hasErrors,[x,u]);return{values:x,errors:b,setValues:X,setErrors:I,setFieldValue:T,setFieldError:D,clearFieldError:A,clearErrors:M,reset:R,validate:N,validateField:$,reorderListItem:B,removeListItem:V,insertListItem:U,getInputProps:q,onSubmit:F,onReset:Y,isDirty:se,isTouched:ae,setTouched:m,setDirty:g,resetTouched:_,resetDirty:E,isValid:re,getTransformedValues:Q}}function _n(e){const{...t}=e,{base50:n,base100:r,base200:o,base300:s,base800:i,base700:l,base900:u,accent500:p,accent300:m}=Wd(),{colorMode:h}=ha();return a.jsx(QE,{styles:()=>({input:{color:Ae(u,r)(h),backgroundColor:Ae(n,u)(h),borderColor:Ae(o,i)(h),borderWidth:2,outline:"none",":focus":{borderColor:Ae(m,p)(h)}},label:{color:Ae(l,s)(h),fontWeight:"normal",marginBottom:4}}),...t})}const rpe=[{value:"sd-1",label:an["sd-1"]},{value:"sd-2",label:an["sd-2"]},{value:"sdxl",label:an.sdxl},{value:"sdxl-refiner",label:an["sdxl-refiner"]}];function Jd(e){const{...t}=e,{t:n}=Z();return a.jsx(Pn,{label:n("modelManager.baseModel"),data:rpe,...t})}function QO(e){const{data:t}=AI(),{...n}=e;return a.jsx(Pn,{label:"Config File",placeholder:"Select A Config File",data:t||[],...n})}const ope=[{value:"normal",label:"Normal"},{value:"inpaint",label:"Inpaint"},{value:"depth",label:"Depth"}];function Tg(e){const{...t}=e,{t:n}=Z();return a.jsx(Pn,{label:n("modelManager.variant"),data:ope,...t})}function dh(e,t=!0){let n;t?n=new RegExp("[^\\\\/]+(?=\\.)"):n=new RegExp("[^\\\\/]+(?=[\\\\/]?$)");const r=e.match(n);return r?r[0]:""}function YO(e){const{t}=Z(),n=te(),{model_path:r}=e,o=fl({initialValues:{model_name:r?dh(r):"",base_model:"sd-1",model_type:"main",path:r||"",description:"",model_format:"checkpoint",error:void 0,vae:"",variant:"normal",config:"configs\\stable-diffusion\\v1-inference.yaml"}}),[s]=TI(),[i,l]=d.useState(!1),u=p=>{s({body:p}).unwrap().then(m=>{n(ct(Qt({title:t("modelManager.modelAdded",{modelName:p.model_name}),status:"success"}))),o.reset(),r&&n(Sd(null))}).catch(m=>{m&&n(ct(Qt({title:t("toast.modelAddFailed"),status:"error"})))})};return a.jsx("form",{onSubmit:o.onSubmit(p=>u(p)),style:{width:"100%"},children:a.jsxs(L,{flexDirection:"column",gap:2,children:[a.jsx(_n,{label:t("modelManager.model"),required:!0,...o.getInputProps("model_name")}),a.jsx(Jd,{label:t("modelManager.baseModel"),...o.getInputProps("base_model")}),a.jsx(_n,{label:t("modelManager.modelLocation"),required:!0,...o.getInputProps("path"),onBlur:p=>{if(o.values.model_name===""){const m=dh(p.currentTarget.value);m&&o.setFieldValue("model_name",m)}}}),a.jsx(_n,{label:t("modelManager.description"),...o.getInputProps("description")}),a.jsx(_n,{label:t("modelManager.vaeLocation"),...o.getInputProps("vae")}),a.jsx(Tg,{label:t("modelManager.variant"),...o.getInputProps("variant")}),a.jsxs(L,{flexDirection:"column",width:"100%",gap:2,children:[i?a.jsx(_n,{required:!0,label:t("modelManager.customConfigFileLocation"),...o.getInputProps("config")}):a.jsx(QO,{required:!0,width:"100%",...o.getInputProps("config")}),a.jsx(br,{isChecked:i,onChange:()=>l(!i),label:t("modelManager.useCustomConfig")}),a.jsx(at,{mt:2,type:"submit",children:t("modelManager.addModel")})]})]})})}function ZO(e){const{t}=Z(),n=te(),{model_path:r}=e,[o]=TI(),s=fl({initialValues:{model_name:r?dh(r,!1):"",base_model:"sd-1",model_type:"main",path:r||"",description:"",model_format:"diffusers",error:void 0,vae:"",variant:"normal"}}),i=l=>{o({body:l}).unwrap().then(u=>{n(ct(Qt({title:t("modelManager.modelAdded",{modelName:l.model_name}),status:"success"}))),s.reset(),r&&n(Sd(null))}).catch(u=>{u&&n(ct(Qt({title:t("toast.modelAddFailed"),status:"error"})))})};return a.jsx("form",{onSubmit:s.onSubmit(l=>i(l)),style:{width:"100%"},children:a.jsxs(L,{flexDirection:"column",gap:2,children:[a.jsx(_n,{required:!0,label:t("modelManager.model"),...s.getInputProps("model_name")}),a.jsx(Jd,{label:t("modelManager.baseModel"),...s.getInputProps("base_model")}),a.jsx(_n,{required:!0,label:t("modelManager.modelLocation"),placeholder:t("modelManager.modelLocationValidationMsg"),...s.getInputProps("path"),onBlur:l=>{if(s.values.model_name===""){const u=dh(l.currentTarget.value,!1);u&&s.setFieldValue("model_name",u)}}}),a.jsx(_n,{label:t("modelManager.description"),...s.getInputProps("description")}),a.jsx(_n,{label:t("modelManager.vaeLocation"),...s.getInputProps("vae")}),a.jsx(Tg,{label:t("modelManager.variant"),...s.getInputProps("variant")}),a.jsx(at,{mt:2,type:"submit",children:t("modelManager.addModel")})]})})}const JO=[{label:"Diffusers",value:"diffusers"},{label:"Checkpoint / Safetensors",value:"checkpoint"}];function spe(){const[e,t]=d.useState("diffusers"),{t:n}=Z();return a.jsxs(L,{flexDirection:"column",gap:4,width:"100%",children:[a.jsx(Pn,{label:n("modelManager.modelType"),value:e,data:JO,onChange:r=>{r&&t(r)}}),a.jsxs(L,{sx:{p:4,borderRadius:4,bg:"base.300",_dark:{bg:"base.850"}},children:[e==="diffusers"&&a.jsx(ZO,{}),e==="checkpoint"&&a.jsx(YO,{})]})]})}const ape=[{label:"None",value:"none"},{label:"v_prediction",value:"v_prediction"},{label:"epsilon",value:"epsilon"},{label:"sample",value:"sample"}];function ipe(){const e=te(),{t}=Z(),[n,{isLoading:r}]=NI(),o=fl({initialValues:{location:"",prediction_type:void 0}}),s=i=>{const l={location:i.location,prediction_type:i.prediction_type==="none"?void 0:i.prediction_type};n({body:l}).unwrap().then(u=>{e(ct(Qt({title:t("toast.modelAddedSimple"),status:"success"}))),o.reset()}).catch(u=>{u&&e(ct(Qt({title:`${u.data.detail} `,status:"error"})))})};return a.jsx("form",{onSubmit:o.onSubmit(i=>s(i)),style:{width:"100%"},children:a.jsxs(L,{flexDirection:"column",width:"100%",gap:4,children:[a.jsx(_n,{label:t("modelManager.modelLocation"),placeholder:t("modelManager.simpleModelDesc"),w:"100%",...o.getInputProps("location")}),a.jsx(Pn,{label:t("modelManager.predictionType"),data:ape,defaultValue:"none",...o.getInputProps("prediction_type")}),a.jsx(at,{type:"submit",isLoading:r,children:t("modelManager.addModel")})]})})}function lpe(){const[e,t]=d.useState("simple");return a.jsxs(L,{flexDirection:"column",width:"100%",overflow:"scroll",maxHeight:window.innerHeight-250,gap:4,children:[a.jsxs(Vt,{isAttached:!0,children:[a.jsx(at,{size:"sm",isChecked:e=="simple",onClick:()=>t("simple"),children:"Simple"}),a.jsx(at,{size:"sm",isChecked:e=="advanced",onClick:()=>t("advanced"),children:"Advanced"})]}),a.jsxs(L,{sx:{p:4,borderRadius:4,background:"base.200",_dark:{background:"base.800"}},children:[e==="simple"&&a.jsx(ipe,{}),e==="advanced"&&a.jsx(spe,{})]})]})}function cpe(e){const{...t}=e;return a.jsx(V6,{w:"100%",...t,children:e.children})}function upe(){const e=W(b=>b.modelmanager.searchFolder),[t,n]=d.useState(""),{data:r}=Xo(Ei),{foundModels:o,alreadyInstalled:s,filteredModels:i}=$I({search_path:e||""},{selectFromResult:({data:b})=>{const w=Q9(r==null?void 0:r.entities),S=nr(w,"path"),j=K9(b,S),_=t$(b,S);return{foundModels:b,alreadyInstalled:I_(_,t),filteredModels:I_(j,t)}}}),[l,{isLoading:u}]=NI(),p=te(),{t:m}=Z(),h=d.useCallback(b=>{const w=b.currentTarget.id.split("\\").splice(-1)[0];l({body:{location:b.currentTarget.id}}).unwrap().then(S=>{p(ct(Qt({title:`Added Model: ${w}`,status:"success"})))}).catch(S=>{S&&p(ct(Qt({title:m("toast.modelAddFailed"),status:"error"})))})},[p,l,m]),g=d.useCallback(b=>{n(b.target.value)},[]),x=({models:b,showActions:w=!0})=>b.map(S=>a.jsxs(L,{sx:{p:4,gap:4,alignItems:"center",borderRadius:4,bg:"base.200",_dark:{bg:"base.800"}},children:[a.jsxs(L,{w:"100%",sx:{flexDirection:"column",minW:"25%"},children:[a.jsx(ve,{sx:{fontWeight:600},children:S.split("\\").slice(-1)[0]}),a.jsx(ve,{sx:{fontSize:"sm",color:"base.600",_dark:{color:"base.400"}},children:S})]}),w?a.jsxs(L,{gap:2,children:[a.jsx(at,{id:S,onClick:h,isLoading:u,children:m("modelManager.quickAdd")}),a.jsx(at,{onClick:()=>p(Sd(S)),isLoading:u,children:m("modelManager.advanced")})]}):a.jsx(ve,{sx:{fontWeight:600,p:2,borderRadius:4,color:"accent.50",bg:"accent.400",_dark:{color:"accent.100",bg:"accent.600"}},children:"Installed"})]},S));return(()=>e?!o||o.length===0?a.jsx(L,{sx:{w:"full",h:"full",justifyContent:"center",alignItems:"center",height:96,userSelect:"none",bg:"base.200",_dark:{bg:"base.900"}},children:a.jsx(ve,{variant:"subtext",children:m("modelManager.noModels")})}):a.jsxs(L,{sx:{flexDirection:"column",gap:2,w:"100%",minW:"50%"},children:[a.jsx(vo,{onChange:g,label:m("modelManager.search"),labelPos:"side"}),a.jsxs(L,{p:2,gap:2,children:[a.jsxs(ve,{sx:{fontWeight:600},children:["Models Found: ",o.length]}),a.jsxs(ve,{sx:{fontWeight:600,color:"accent.500",_dark:{color:"accent.200"}},children:["Not Installed: ",i.length]})]}),a.jsx(cpe,{offsetScrollbars:!0,children:a.jsxs(L,{gap:2,flexDirection:"column",children:[x({models:i}),x({models:s,showActions:!1})]})})]}):null)()}const I_=(e,t)=>{const n=[];return Rn(e,r=>{if(!r)return null;r.includes(t)&&n.push(r)}),n};function dpe(){const e=W(l=>l.modelmanager.advancedAddScanModel),{t}=Z(),[n,r]=d.useState("diffusers"),[o,s]=d.useState(!0);d.useEffect(()=>{e&&[".ckpt",".safetensors",".pth",".pt"].some(l=>e.endsWith(l))?r("checkpoint"):r("diffusers")},[e,r,o]);const i=te();return e?a.jsxs(Ie,{as:In.div,initial:{x:-100,opacity:0},animate:{x:0,opacity:1,transition:{duration:.2}},sx:{display:"flex",flexDirection:"column",minWidth:"40%",maxHeight:window.innerHeight-300,overflow:"scroll",p:4,gap:4,borderRadius:4,bg:"base.200",_dark:{bg:"base.800"}},children:[a.jsxs(L,{justifyContent:"space-between",alignItems:"center",children:[a.jsx(ve,{size:"xl",fontWeight:600,children:o||n==="checkpoint"?"Add Checkpoint Model":"Add Diffusers Model"}),a.jsx(Fe,{icon:a.jsx(Ic,{}),"aria-label":t("modelManager.closeAdvanced"),onClick:()=>i(Sd(null)),size:"sm"})]}),a.jsx(Pn,{label:t("modelManager.modelType"),value:n,data:JO,onChange:l=>{l&&(r(l),s(l==="checkpoint"))}}),o?a.jsx(YO,{model_path:e},e):a.jsx(ZO,{model_path:e},e)]}):null}function fpe(){const e=te(),{t}=Z(),n=W(l=>l.modelmanager.searchFolder),{refetch:r}=$I({search_path:n||""}),o=fl({initialValues:{folder:""}}),s=d.useCallback(l=>{e(Dw(l.folder))},[e]),i=()=>{r()};return a.jsx("form",{onSubmit:o.onSubmit(l=>s(l)),style:{width:"100%"},children:a.jsxs(L,{sx:{w:"100%",gap:2,borderRadius:4,alignItems:"center"},children:[a.jsxs(L,{w:"100%",alignItems:"center",gap:4,minH:12,children:[a.jsx(ve,{sx:{fontSize:"sm",fontWeight:600,color:"base.700",minW:"max-content",_dark:{color:"base.300"}},children:"Folder"}),n?a.jsx(L,{sx:{w:"100%",p:2,px:4,bg:"base.300",borderRadius:4,fontSize:"sm",fontWeight:"bold",_dark:{bg:"base.700"}},children:n}):a.jsx(vo,{w:"100%",size:"md",...o.getInputProps("folder")})]}),a.jsxs(L,{gap:2,children:[n?a.jsx(Fe,{"aria-label":t("modelManager.scanAgain"),tooltip:t("modelManager.scanAgain"),icon:a.jsx(bM,{}),onClick:i,fontSize:18,size:"sm"}):a.jsx(Fe,{"aria-label":t("modelManager.findModels"),tooltip:t("modelManager.findModels"),icon:a.jsx(oee,{}),fontSize:18,size:"sm",type:"submit"}),a.jsx(Fe,{"aria-label":t("modelManager.clearCheckpointFolder"),tooltip:t("modelManager.clearCheckpointFolder"),icon:a.jsx(Br,{}),size:"sm",onClick:()=>{e(Dw(null)),e(Sd(null))},isDisabled:!n,colorScheme:"red"})]})]})})}const ppe=d.memo(fpe);function mpe(){return a.jsxs(L,{flexDirection:"column",w:"100%",gap:4,children:[a.jsx(ppe,{}),a.jsxs(L,{gap:4,children:[a.jsx(L,{sx:{maxHeight:window.innerHeight-300,overflow:"scroll",gap:4,w:"100%"},children:a.jsx(upe,{})}),a.jsx(dpe,{})]})]})}function hpe(){const[e,t]=d.useState("add"),{t:n}=Z();return a.jsxs(L,{flexDirection:"column",gap:4,children:[a.jsxs(Vt,{isAttached:!0,children:[a.jsx(at,{onClick:()=>t("add"),isChecked:e=="add",size:"sm",width:"100%",children:n("modelManager.addModel")}),a.jsx(at,{onClick:()=>t("scan"),isChecked:e=="scan",size:"sm",width:"100%",children:n("modelManager.scanForModels")})]}),e=="add"&&a.jsx(lpe,{}),e=="scan"&&a.jsx(mpe,{})]})}const gpe=[{label:"Stable Diffusion 1",value:"sd-1"},{label:"Stable Diffusion 2",value:"sd-2"}];function vpe(){var $,q;const{t:e}=Z(),t=te(),{data:n}=Xo(Ei),[r,{isLoading:o}]=MT(),[s,i]=d.useState("sd-1"),l=Gw(n==null?void 0:n.entities,(F,Q)=>(F==null?void 0:F.model_format)==="diffusers"&&(F==null?void 0:F.base_model)==="sd-1"),u=Gw(n==null?void 0:n.entities,(F,Q)=>(F==null?void 0:F.model_format)==="diffusers"&&(F==null?void 0:F.base_model)==="sd-2"),p=d.useMemo(()=>({"sd-1":l,"sd-2":u}),[l,u]),[m,h]=d.useState((($=Object.keys(p[s]))==null?void 0:$[0])??null),[g,x]=d.useState(((q=Object.keys(p[s]))==null?void 0:q[1])??null),[y,b]=d.useState(null),[w,S]=d.useState(""),[j,_]=d.useState(.5),[E,I]=d.useState("weighted_sum"),[M,R]=d.useState("root"),[D,A]=d.useState(""),[O,T]=d.useState(!1),X=Object.keys(p[s]).filter(F=>F!==g&&F!==y),B=Object.keys(p[s]).filter(F=>F!==m&&F!==y),V=Object.keys(p[s]).filter(F=>F!==m&&F!==g),U=F=>{i(F),h(null),x(null)},N=()=>{const F=[];let Q=[m,g,y];Q=Q.filter(se=>se!==null),Q.forEach(se=>{var re;const ae=(re=se==null?void 0:se.split("/"))==null?void 0:re[2];ae&&F.push(ae)});const Y={model_names:F,merged_model_name:w!==""?w:F.join("-"),alpha:j,interp:E,force:O,merge_dest_directory:M==="root"?void 0:D};r({base_model:s,body:Y}).unwrap().then(se=>{t(ct(Qt({title:e("modelManager.modelsMerged"),status:"success"})))}).catch(se=>{se&&t(ct(Qt({title:e("modelManager.modelsMergeFailed"),status:"error"})))})};return a.jsxs(L,{flexDirection:"column",rowGap:4,children:[a.jsxs(L,{sx:{flexDirection:"column",rowGap:1},children:[a.jsx(ve,{children:e("modelManager.modelMergeHeaderHelp1")}),a.jsx(ve,{fontSize:"sm",variant:"subtext",children:e("modelManager.modelMergeHeaderHelp2")})]}),a.jsxs(L,{columnGap:4,children:[a.jsx(Pn,{label:"Model Type",w:"100%",data:gpe,value:s,onChange:U}),a.jsx(nn,{label:e("modelManager.modelOne"),w:"100%",value:m,placeholder:e("modelManager.selectModel"),data:X,onChange:F=>h(F)}),a.jsx(nn,{label:e("modelManager.modelTwo"),w:"100%",placeholder:e("modelManager.selectModel"),value:g,data:B,onChange:F=>x(F)}),a.jsx(nn,{label:e("modelManager.modelThree"),data:V,w:"100%",placeholder:e("modelManager.selectModel"),clearable:!0,onChange:F=>{F?(b(F),I("weighted_sum")):(b(null),I("add_difference"))}})]}),a.jsx(vo,{label:e("modelManager.mergedModelName"),value:w,onChange:F=>S(F.target.value)}),a.jsxs(L,{sx:{flexDirection:"column",padding:4,borderRadius:"base",gap:4,bg:"base.200",_dark:{bg:"base.800"}},children:[a.jsx(tt,{label:e("modelManager.alpha"),min:.01,max:.99,step:.01,value:j,onChange:F=>_(F),withInput:!0,withReset:!0,handleReset:()=>_(.5),withSliderMarks:!0}),a.jsx(ve,{variant:"subtext",fontSize:"sm",children:e("modelManager.modelMergeAlphaHelp")})]}),a.jsxs(L,{sx:{padding:4,borderRadius:"base",gap:4,bg:"base.200",_dark:{bg:"base.800"}},children:[a.jsx(ve,{fontWeight:500,fontSize:"sm",variant:"subtext",children:e("modelManager.interpolationType")}),a.jsx(cm,{value:E,onChange:F=>I(F),children:a.jsx(L,{columnGap:4,children:y===null?a.jsxs(a.Fragment,{children:[a.jsx(Ks,{value:"weighted_sum",children:a.jsx(ve,{fontSize:"sm",children:e("modelManager.weightedSum")})}),a.jsx(Ks,{value:"sigmoid",children:a.jsx(ve,{fontSize:"sm",children:e("modelManager.sigmoid")})}),a.jsx(Ks,{value:"inv_sigmoid",children:a.jsx(ve,{fontSize:"sm",children:e("modelManager.inverseSigmoid")})})]}):a.jsx(Ks,{value:"add_difference",children:a.jsx(Ht,{label:e("modelManager.modelMergeInterpAddDifferenceHelp"),children:a.jsx(ve,{fontSize:"sm",children:e("modelManager.addDifference")})})})})})]}),a.jsxs(L,{sx:{flexDirection:"column",padding:4,borderRadius:"base",gap:4,bg:"base.200",_dark:{bg:"base.900"}},children:[a.jsxs(L,{columnGap:4,children:[a.jsx(ve,{fontWeight:"500",fontSize:"sm",variant:"subtext",children:e("modelManager.mergedModelSaveLocation")}),a.jsx(cm,{value:M,onChange:F=>R(F),children:a.jsxs(L,{columnGap:4,children:[a.jsx(Ks,{value:"root",children:a.jsx(ve,{fontSize:"sm",children:e("modelManager.invokeAIFolder")})}),a.jsx(Ks,{value:"custom",children:a.jsx(ve,{fontSize:"sm",children:e("modelManager.custom")})})]})})]}),M==="custom"&&a.jsx(vo,{label:e("modelManager.mergedModelCustomSaveLocation"),value:D,onChange:F=>A(F.target.value)})]}),a.jsx(br,{label:e("modelManager.ignoreMismatch"),isChecked:O,onChange:F=>T(F.target.checked),fontWeight:"500"}),a.jsx(at,{onClick:N,isLoading:o,isDisabled:m===null||g===null,children:e("modelManager.merge")})]})}function xpe(e){const{model:t}=e,n=te(),{t:r}=Z(),[o,{isLoading:s}]=OT(),[i,l]=d.useState("InvokeAIRoot"),[u,p]=d.useState("");d.useEffect(()=>{l("InvokeAIRoot")},[t]);const m=()=>{l("InvokeAIRoot")},h=()=>{const g={base_model:t.base_model,model_name:t.model_name,convert_dest_directory:i==="Custom"?u:void 0};if(i==="Custom"&&u===""){n(ct(Qt({title:r("modelManager.noCustomLocationProvided"),status:"error"})));return}n(ct(Qt({title:`${r("modelManager.convertingModelBegin")}: ${t.model_name}`,status:"info"}))),o(g).unwrap().then(()=>{n(ct(Qt({title:`${r("modelManager.modelConverted")}: ${t.model_name}`,status:"success"})))}).catch(()=>{n(ct(Qt({title:`${r("modelManager.modelConversionFailed")}: ${t.model_name}`,status:"error"})))})};return a.jsxs(kg,{title:`${r("modelManager.convert")} ${t.model_name}`,acceptCallback:h,cancelCallback:m,acceptButtonText:`${r("modelManager.convert")}`,triggerComponent:a.jsxs(at,{size:"sm","aria-label":r("modelManager.convertToDiffusers"),className:" modal-close-btn",isLoading:s,children:["🧨 ",r("modelManager.convertToDiffusers")]}),motionPreset:"slideInBottom",children:[a.jsxs(L,{flexDirection:"column",rowGap:4,children:[a.jsx(ve,{children:r("modelManager.convertToDiffusersHelpText1")}),a.jsxs(Od,{children:[a.jsx(Qr,{children:r("modelManager.convertToDiffusersHelpText2")}),a.jsx(Qr,{children:r("modelManager.convertToDiffusersHelpText3")}),a.jsx(Qr,{children:r("modelManager.convertToDiffusersHelpText4")}),a.jsx(Qr,{children:r("modelManager.convertToDiffusersHelpText5")})]}),a.jsx(ve,{children:r("modelManager.convertToDiffusersHelpText6")})]}),a.jsxs(L,{flexDir:"column",gap:2,children:[a.jsxs(L,{marginTop:4,flexDir:"column",gap:2,children:[a.jsx(ve,{fontWeight:"600",children:r("modelManager.convertToDiffusersSaveLocation")}),a.jsx(cm,{value:i,onChange:g=>l(g),children:a.jsxs(L,{gap:4,children:[a.jsx(Ks,{value:"InvokeAIRoot",children:a.jsx(Ht,{label:"Save converted model in the InvokeAI root folder",children:r("modelManager.invokeRoot")})}),a.jsx(Ks,{value:"Custom",children:a.jsx(Ht,{label:"Save converted model in a custom folder",children:r("modelManager.custom")})})]})})]}),i==="Custom"&&a.jsxs(L,{flexDirection:"column",rowGap:2,children:[a.jsx(ve,{fontWeight:"500",fontSize:"sm",variant:"subtext",children:r("modelManager.customSaveLocation")}),a.jsx(vo,{value:u,onChange:g=>{p(g.target.value)},width:"full"})]})]})]})}function bpe(e){const{model:t}=e,[n,{isLoading:r}]=LI(),{data:o}=AI(),[s,i]=d.useState(!1);d.useEffect(()=>{o!=null&&o.includes(t.config)||i(!0)},[o,t.config]);const l=te(),{t:u}=Z(),p=fl({initialValues:{model_name:t.model_name?t.model_name:"",base_model:t.base_model,model_type:"main",path:t.path?t.path:"",description:t.description?t.description:"",model_format:"checkpoint",vae:t.vae?t.vae:"",config:t.config?t.config:"",variant:t.variant},validate:{path:h=>h.trim().length===0?"Must provide a path":null}}),m=d.useCallback(h=>{const g={base_model:t.base_model,model_name:t.model_name,body:h};n(g).unwrap().then(x=>{p.setValues(x),l(ct(Qt({title:u("modelManager.modelUpdated"),status:"success"})))}).catch(x=>{p.reset(),l(ct(Qt({title:u("modelManager.modelUpdateFailed"),status:"error"})))})},[p,l,t.base_model,t.model_name,u,n]);return a.jsxs(L,{flexDirection:"column",rowGap:4,width:"100%",children:[a.jsxs(L,{justifyContent:"space-between",alignItems:"center",children:[a.jsxs(L,{flexDirection:"column",children:[a.jsx(ve,{fontSize:"lg",fontWeight:"bold",children:t.model_name}),a.jsxs(ve,{fontSize:"sm",color:"base.400",children:[an[t.base_model]," Model"]})]}),[""].includes(t.base_model)?a.jsx(Ds,{sx:{p:2,borderRadius:4,bg:"error.200",_dark:{bg:"error.400"}},children:"Conversion Not Supported"}):a.jsx(xpe,{model:t})]}),a.jsx(Yn,{}),a.jsx(L,{flexDirection:"column",maxHeight:window.innerHeight-270,overflowY:"scroll",children:a.jsx("form",{onSubmit:p.onSubmit(h=>m(h)),children:a.jsxs(L,{flexDirection:"column",overflowY:"scroll",gap:4,children:[a.jsx(_n,{label:u("modelManager.name"),...p.getInputProps("model_name")}),a.jsx(_n,{label:u("modelManager.description"),...p.getInputProps("description")}),a.jsx(Jd,{required:!0,...p.getInputProps("base_model")}),a.jsx(Tg,{required:!0,...p.getInputProps("variant")}),a.jsx(_n,{required:!0,label:u("modelManager.modelLocation"),...p.getInputProps("path")}),a.jsx(_n,{label:u("modelManager.vaeLocation"),...p.getInputProps("vae")}),a.jsxs(L,{flexDirection:"column",gap:2,children:[s?a.jsx(_n,{required:!0,label:u("modelManager.config"),...p.getInputProps("config")}):a.jsx(QO,{required:!0,...p.getInputProps("config")}),a.jsx(br,{isChecked:s,onChange:()=>i(!s),label:"Use Custom Config"})]}),a.jsx(at,{type:"submit",isLoading:r,children:u("modelManager.updateModel")})]})})})]})}function ype(e){const{model:t}=e,[n,{isLoading:r}]=LI(),o=te(),{t:s}=Z(),i=fl({initialValues:{model_name:t.model_name?t.model_name:"",base_model:t.base_model,model_type:"main",path:t.path?t.path:"",description:t.description?t.description:"",model_format:"diffusers",vae:t.vae?t.vae:"",variant:t.variant},validate:{path:u=>u.trim().length===0?"Must provide a path":null}}),l=d.useCallback(u=>{const p={base_model:t.base_model,model_name:t.model_name,body:u};n(p).unwrap().then(m=>{i.setValues(m),o(ct(Qt({title:s("modelManager.modelUpdated"),status:"success"})))}).catch(m=>{i.reset(),o(ct(Qt({title:s("modelManager.modelUpdateFailed"),status:"error"})))})},[i,o,t.base_model,t.model_name,s,n]);return a.jsxs(L,{flexDirection:"column",rowGap:4,width:"100%",children:[a.jsxs(L,{flexDirection:"column",children:[a.jsx(ve,{fontSize:"lg",fontWeight:"bold",children:t.model_name}),a.jsxs(ve,{fontSize:"sm",color:"base.400",children:[an[t.base_model]," Model"]})]}),a.jsx(Yn,{}),a.jsx("form",{onSubmit:i.onSubmit(u=>l(u)),children:a.jsxs(L,{flexDirection:"column",overflowY:"scroll",gap:4,children:[a.jsx(_n,{label:s("modelManager.name"),...i.getInputProps("model_name")}),a.jsx(_n,{label:s("modelManager.description"),...i.getInputProps("description")}),a.jsx(Jd,{required:!0,...i.getInputProps("base_model")}),a.jsx(Tg,{required:!0,...i.getInputProps("variant")}),a.jsx(_n,{required:!0,label:s("modelManager.modelLocation"),...i.getInputProps("path")}),a.jsx(_n,{label:s("modelManager.vaeLocation"),...i.getInputProps("vae")}),a.jsx(at,{type:"submit",isLoading:r,children:s("modelManager.updateModel")})]})})]})}function Cpe(e){const{model:t}=e,[n,{isLoading:r}]=RT(),o=te(),{t:s}=Z(),i=fl({initialValues:{model_name:t.model_name?t.model_name:"",base_model:t.base_model,model_type:"lora",path:t.path?t.path:"",description:t.description?t.description:"",model_format:t.model_format},validate:{path:u=>u.trim().length===0?"Must provide a path":null}}),l=d.useCallback(u=>{const p={base_model:t.base_model,model_name:t.model_name,body:u};n(p).unwrap().then(m=>{i.setValues(m),o(ct(Qt({title:s("modelManager.modelUpdated"),status:"success"})))}).catch(m=>{i.reset(),o(ct(Qt({title:s("modelManager.modelUpdateFailed"),status:"error"})))})},[o,i,t.base_model,t.model_name,s,n]);return a.jsxs(L,{flexDirection:"column",rowGap:4,width:"100%",children:[a.jsxs(L,{flexDirection:"column",children:[a.jsx(ve,{fontSize:"lg",fontWeight:"bold",children:t.model_name}),a.jsxs(ve,{fontSize:"sm",color:"base.400",children:[an[t.base_model]," Model ⋅"," ",DT[t.model_format]," format"]})]}),a.jsx(Yn,{}),a.jsx("form",{onSubmit:i.onSubmit(u=>l(u)),children:a.jsxs(L,{flexDirection:"column",overflowY:"scroll",gap:4,children:[a.jsx(_n,{label:s("modelManager.name"),...i.getInputProps("model_name")}),a.jsx(_n,{label:s("modelManager.description"),...i.getInputProps("description")}),a.jsx(Jd,{...i.getInputProps("base_model")}),a.jsx(_n,{label:s("modelManager.modelLocation"),...i.getInputProps("path")}),a.jsx(at,{type:"submit",isLoading:r,children:s("modelManager.updateModel")})]})})]})}function wpe(e){const{t}=Z(),n=te(),[r]=AT(),[o]=TT(),{model:s,isSelected:i,setSelectedModelId:l}=e,u=d.useCallback(()=>{l(s.id)},[s.id,l]),p=d.useCallback(()=>{const m={main:r,lora:o,onnx:r}[s.model_type];m(s).unwrap().then(h=>{n(ct(Qt({title:`${t("modelManager.modelDeleted")}: ${s.model_name}`,status:"success"})))}).catch(h=>{h&&n(ct(Qt({title:`${t("modelManager.modelDeleteFailed")}: ${s.model_name}`,status:"error"})))}),l(void 0)},[r,o,s,l,n,t]);return a.jsxs(L,{sx:{gap:2,alignItems:"center",w:"full"},children:[a.jsx(L,{as:at,isChecked:i,sx:{justifyContent:"start",p:2,borderRadius:"base",w:"full",alignItems:"center",bg:i?"accent.400":"base.100",color:i?"base.50":"base.800",_hover:{bg:i?"accent.500":"base.300",color:i?"base.50":"base.800"},_dark:{color:i?"base.50":"base.100",bg:i?"accent.600":"base.850",_hover:{color:i?"base.50":"base.100",bg:i?"accent.550":"base.700"}}},onClick:u,children:a.jsxs(L,{gap:4,alignItems:"center",children:[a.jsx(Ds,{minWidth:14,p:.5,fontSize:"sm",variant:"solid",children:NT[s.base_model]}),a.jsx(Ht,{label:s.description,hasArrow:!0,placement:"bottom",children:a.jsx(ve,{sx:{fontWeight:500},children:s.model_name})})]})}),a.jsx(kg,{title:t("modelManager.deleteModel"),acceptCallback:p,acceptButtonText:t("modelManager.delete"),triggerComponent:a.jsx(Fe,{icon:a.jsx(ane,{}),"aria-label":t("modelManager.deleteConfig"),colorScheme:"error"}),children:a.jsxs(L,{rowGap:4,flexDirection:"column",children:[a.jsx("p",{style:{fontWeight:"bold"},children:t("modelManager.deleteMsg1")}),a.jsx("p",{children:t("modelManager.deleteMsg2")})]})})]})}const Spe=e=>{const{selectedModelId:t,setSelectedModelId:n}=e,{t:r}=Z(),[o,s]=d.useState(""),[i,l]=d.useState("all"),{filteredDiffusersModels:u,isLoadingDiffusersModels:p}=Xo(Ei,{selectFromResult:({data:_,isLoading:E})=>({filteredDiffusersModels:Iu(_,"main","diffusers",o),isLoadingDiffusersModels:E})}),{filteredCheckpointModels:m,isLoadingCheckpointModels:h}=Xo(Ei,{selectFromResult:({data:_,isLoading:E})=>({filteredCheckpointModels:Iu(_,"main","checkpoint",o),isLoadingCheckpointModels:E})}),{filteredLoraModels:g,isLoadingLoraModels:x}=Cd(void 0,{selectFromResult:({data:_,isLoading:E})=>({filteredLoraModels:Iu(_,"lora",void 0,o),isLoadingLoraModels:E})}),{filteredOnnxModels:y,isLoadingOnnxModels:b}=Ku(Ei,{selectFromResult:({data:_,isLoading:E})=>({filteredOnnxModels:Iu(_,"onnx","onnx",o),isLoadingOnnxModels:E})}),{filteredOliveModels:w,isLoadingOliveModels:S}=Ku(Ei,{selectFromResult:({data:_,isLoading:E})=>({filteredOliveModels:Iu(_,"onnx","olive",o),isLoadingOliveModels:E})}),j=d.useCallback(_=>{s(_.target.value)},[]);return a.jsx(L,{flexDirection:"column",rowGap:4,width:"50%",minWidth:"50%",children:a.jsxs(L,{flexDirection:"column",gap:4,paddingInlineEnd:4,children:[a.jsxs(Vt,{isAttached:!0,children:[a.jsx(at,{onClick:()=>l("all"),isChecked:i==="all",size:"sm",children:r("modelManager.allModels")}),a.jsx(at,{size:"sm",onClick:()=>l("diffusers"),isChecked:i==="diffusers",children:r("modelManager.diffusersModels")}),a.jsx(at,{size:"sm",onClick:()=>l("checkpoint"),isChecked:i==="checkpoint",children:r("modelManager.checkpointModels")}),a.jsx(at,{size:"sm",onClick:()=>l("onnx"),isChecked:i==="onnx",children:r("modelManager.onnxModels")}),a.jsx(at,{size:"sm",onClick:()=>l("olive"),isChecked:i==="olive",children:r("modelManager.oliveModels")}),a.jsx(at,{size:"sm",onClick:()=>l("lora"),isChecked:i==="lora",children:r("modelManager.loraModels")})]}),a.jsx(vo,{onChange:j,label:r("modelManager.search"),labelPos:"side"}),a.jsxs(L,{flexDirection:"column",gap:4,maxHeight:window.innerHeight-280,overflow:"scroll",children:[p&&a.jsx(Xl,{loadingMessage:"Loading Diffusers..."}),["all","diffusers"].includes(i)&&!p&&u.length>0&&a.jsx(ql,{title:"Diffusers",modelList:u,selected:{selectedModelId:t,setSelectedModelId:n}},"diffusers"),h&&a.jsx(Xl,{loadingMessage:"Loading Checkpoints..."}),["all","checkpoint"].includes(i)&&!h&&m.length>0&&a.jsx(ql,{title:"Checkpoints",modelList:m,selected:{selectedModelId:t,setSelectedModelId:n}},"checkpoints"),x&&a.jsx(Xl,{loadingMessage:"Loading LoRAs..."}),["all","lora"].includes(i)&&!x&&g.length>0&&a.jsx(ql,{title:"LoRAs",modelList:g,selected:{selectedModelId:t,setSelectedModelId:n}},"loras"),S&&a.jsx(Xl,{loadingMessage:"Loading Olives..."}),["all","olive"].includes(i)&&!S&&w.length>0&&a.jsx(ql,{title:"Olives",modelList:w,selected:{selectedModelId:t,setSelectedModelId:n}},"olive"),b&&a.jsx(Xl,{loadingMessage:"Loading ONNX..."}),["all","onnx"].includes(i)&&!b&&y.length>0&&a.jsx(ql,{title:"ONNX",modelList:y,selected:{selectedModelId:t,setSelectedModelId:n}},"onnx")]})]})})},kpe=d.memo(Spe),Iu=(e,t,n,r)=>{const o=[];return Rn(e==null?void 0:e.entities,s=>{if(!s)return;const i=s.model_name.toLowerCase().includes(r.toLowerCase()),l=n===void 0||s.model_format===n,u=s.model_type===t;i&&l&&u&&o.push(s)}),o},c2=d.memo(e=>a.jsx(L,{flexDirection:"column",gap:4,borderRadius:4,p:4,sx:{bg:"base.200",_dark:{bg:"base.800"}},children:e.children}));c2.displayName="StyledModelContainer";const ql=d.memo(e=>{const{title:t,modelList:n,selected:r}=e;return a.jsx(c2,{children:a.jsxs(L,{sx:{gap:2,flexDir:"column"},children:[a.jsx(ve,{variant:"subtext",fontSize:"sm",children:t}),n.map(o=>a.jsx(wpe,{model:o,isSelected:r.selectedModelId===o.id,setSelectedModelId:r.setSelectedModelId},o.id))]})})});ql.displayName="ModelListWrapper";const Xl=d.memo(({loadingMessage:e})=>a.jsx(c2,{children:a.jsxs(L,{justifyContent:"center",alignItems:"center",flexDirection:"column",p:4,gap:8,children:[a.jsx(fa,{}),a.jsx(ve,{variant:"subtext",children:e||"Fetching..."})]})}));Xl.displayName="FetchingModelsLoader";function jpe(){const[e,t]=d.useState(),{mainModel:n}=Xo(Ei,{selectFromResult:({data:s})=>({mainModel:e?s==null?void 0:s.entities[e]:void 0})}),{loraModel:r}=Cd(void 0,{selectFromResult:({data:s})=>({loraModel:e?s==null?void 0:s.entities[e]:void 0})}),o=n||r;return a.jsxs(L,{sx:{gap:8,w:"full",h:"full"},children:[a.jsx(kpe,{selectedModelId:e,setSelectedModelId:t}),a.jsx(_pe,{model:o})]})}const _pe=e=>{const{model:t}=e;return(t==null?void 0:t.model_format)==="checkpoint"?a.jsx(bpe,{model:t},t.id):(t==null?void 0:t.model_format)==="diffusers"?a.jsx(ype,{model:t},t.id):(t==null?void 0:t.model_type)==="lora"?a.jsx(Cpe,{model:t},t.id):a.jsx(L,{sx:{w:"full",h:"full",justifyContent:"center",alignItems:"center",maxH:96,userSelect:"none"},children:a.jsx(ve,{variant:"subtext",children:"No Model Selected"})})};function Ipe(){const{t:e}=Z();return a.jsxs(L,{sx:{w:"full",p:4,borderRadius:4,gap:4,justifyContent:"space-between",alignItems:"center",bg:"base.200",_dark:{bg:"base.800"}},children:[a.jsxs(L,{sx:{flexDirection:"column",gap:2},children:[a.jsx(ve,{sx:{fontWeight:600},children:e("modelManager.syncModels")}),a.jsx(ve,{fontSize:"sm",sx:{_dark:{color:"base.400"}},children:e("modelManager.syncModelsDesc")})]}),a.jsx(Gc,{})]})}function Ppe(){return a.jsx(L,{children:a.jsx(Ipe,{})})}const P_=[{id:"modelManager",label:yt.t("modelManager.modelManager"),content:a.jsx(jpe,{})},{id:"importModels",label:yt.t("modelManager.importModels"),content:a.jsx(hpe,{})},{id:"mergeModels",label:yt.t("modelManager.mergeModels"),content:a.jsx(vpe,{})},{id:"settings",label:yt.t("modelManager.settings"),content:a.jsx(Ppe,{})}],Epe=()=>a.jsxs(rl,{isLazy:!0,variant:"line",layerStyle:"first",sx:{w:"full",h:"full",p:4,gap:4,borderRadius:"base"},children:[a.jsx(ol,{children:P_.map(e=>a.jsx(Tr,{sx:{borderTopRadius:"base"},children:e.label},e.id))}),a.jsx(zc,{sx:{w:"full",h:"full"},children:P_.map(e=>a.jsx(So,{sx:{w:"full",h:"full"},children:e.content},e.id))})]}),Mpe=d.memo(Epe),Ope={enum:"",BoardField:void 0,boolean:!1,BooleanCollection:[],BooleanPolymorphic:!1,ClipField:void 0,Collection:[],CollectionItem:void 0,ColorCollection:[],ColorField:void 0,ColorPolymorphic:void 0,ConditioningCollection:[],ConditioningField:void 0,ConditioningPolymorphic:void 0,ControlCollection:[],ControlField:void 0,ControlNetModelField:void 0,ControlPolymorphic:void 0,DenoiseMaskField:void 0,float:0,FloatCollection:[],FloatPolymorphic:0,ImageCollection:[],ImageField:void 0,ImagePolymorphic:void 0,integer:0,IntegerCollection:[],IntegerPolymorphic:0,IPAdapterField:void 0,IPAdapterModelField:void 0,LatentsCollection:[],LatentsField:void 0,LatentsPolymorphic:void 0,LoRAModelField:void 0,MainModelField:void 0,ONNXModelField:void 0,Scheduler:"euler",SDXLMainModelField:void 0,SDXLRefinerModelField:void 0,string:"",StringCollection:[],StringPolymorphic:"",T2IAdapterCollection:[],T2IAdapterField:void 0,T2IAdapterModelField:void 0,T2IAdapterPolymorphic:void 0,UNetField:void 0,VaeField:void 0,VaeModelField:void 0},Rpe=(e,t)=>{const n={id:e,name:t.name,type:t.type,label:"",fieldKind:"input"};return n.value=t.default??Ope[t.type],n},Dpe=le([e=>e.nodes],e=>e.nodeTemplates),Jv={dragHandle:`.${tl}`},Ape=()=>{const e=W(Dpe),t=rb();return d.useCallback(n=>{var x;const r=Zs();let o=window.innerWidth/2,s=window.innerHeight/2;const i=(x=document.querySelector("#workflow-editor"))==null?void 0:x.getBoundingClientRect();i&&(o=i.width/2-g1/2,s=i.height/2-g1/2);const{x:l,y:u}=t.project({x:o,y:s});if(n==="current_image")return{...Jv,id:r,type:"current_image",position:{x:l,y:u},data:{id:r,type:"current_image",isOpen:!0,label:"Current Image"}};if(n==="notes")return{...Jv,id:r,type:"notes",position:{x:l,y:u},data:{id:r,isOpen:!0,label:"Notes",notes:"",type:"notes"}};const p=e[n];if(p===void 0){console.error(`Unable to find template ${n}.`);return}const m=Aw(p.inputs,(y,b,w)=>{const S=Zs(),j=Rpe(S,b);return y[w]=j,y},{}),h=Aw(p.outputs,(y,b,w)=>{const j={id:Zs(),name:w,type:b.type,fieldKind:"output"};return y[w]=j,y},{});return{...Jv,id:r,type:"invocation",position:{x:l,y:u},data:{id:r,type:n,version:p.version,label:"",notes:"",isOpen:!0,embedWorkflow:!1,isIntermediate:n!=="save_image",inputs:m,outputs:h,useCache:p.useCache}}},[e,t])},e7=d.forwardRef(({label:e,description:t,...n},r)=>a.jsx("div",{ref:r,...n,children:a.jsxs("div",{children:[a.jsx(ve,{fontWeight:600,children:e}),a.jsx(ve,{size:"xs",sx:{color:"base.600",_dark:{color:"base.500"}},children:t})]})}));e7.displayName="AddNodePopoverSelectItem";const Tpe=(e,t)=>{const n=new RegExp(e.trim().replace(/[-[\]{}()*+!<=:?./\\^$|#,]/g,"").split(" ").join(".*"),"gi");return n.test(t.label)||n.test(t.description)||t.tags.some(r=>n.test(r))},Npe=()=>{const e=te(),t=Ape(),n=sl(),{t:r}=Z(),o=W(w=>w.nodes.currentConnectionFieldType),s=W(w=>{var S;return(S=w.nodes.connectionStartParams)==null?void 0:S.handleType}),i=le([xe],({nodes:w})=>{const S=o?$T(w.nodeTemplates,_=>{const E=s=="source"?_.inputs:_.outputs;return Xr(E,I=>{const M=s=="source"?o:I.type,R=s=="target"?o:I.type;return ob(M,R)})}):nr(w.nodeTemplates),j=nr(S,_=>({label:_.title,value:_.type,description:_.description,tags:_.tags}));return o===null&&(j.push({label:r("nodes.currentImage"),value:"current_image",description:r("nodes.currentImageDescription"),tags:["progress"]}),j.push({label:r("nodes.notes"),value:"notes",description:r("nodes.notesDescription"),tags:["notes"]})),j.sort((_,E)=>_.label.localeCompare(E.label)),{data:j,t:r}},Se),{data:l}=W(i),u=W(w=>w.nodes.isAddNodePopoverOpen),p=d.useRef(null),m=d.useCallback(w=>{const S=t(w);if(!S){const j=r("nodes.unknownNode",{nodeType:w});n({status:"error",title:j});return}e(LT(S))},[e,t,n,r]),h=d.useCallback(w=>{w&&m(w)},[m]),g=d.useCallback(()=>{e(zT())},[e]),x=d.useCallback(()=>{e(zI())},[e]),y=d.useCallback(w=>{w.preventDefault(),x(),setTimeout(()=>{var S;(S=p.current)==null||S.focus()},0)},[x]),b=d.useCallback(()=>{g()},[g]);return et(["shift+a","space"],y),et(["escape"],b),a.jsxs(Ld,{initialFocusRef:p,isOpen:u,onClose:g,placement:"bottom",openDelay:0,closeDelay:0,closeOnBlur:!0,returnFocusOnClose:!0,children:[a.jsx(B3,{children:a.jsx(L,{sx:{position:"absolute",top:"15%",insetInlineStart:"50%",pointerEvents:"none"}})}),a.jsx(zd,{sx:{p:0,top:-1,shadow:"dark-lg",borderColor:"accent.300",borderWidth:"2px",borderStyle:"solid",_dark:{borderColor:"accent.400"}},children:a.jsx(Uh,{sx:{p:0},children:a.jsx(nn,{inputRef:p,selectOnBlur:!1,placeholder:r("nodes.nodeSearch"),value:null,data:l,maxDropdownHeight:400,nothingFound:r("nodes.noMatchingNodes"),itemComponent:e7,filter:Tpe,onChange:h,hoverOnSearchChange:!0,onDropdownClose:g,sx:{width:"32rem",input:{padding:"0.5rem"}}})})})]})},$pe=d.memo(Npe),Lpe=()=>{const e=rb(),t=W(r=>r.nodes.shouldValidateGraph);return d.useCallback(({source:r,sourceHandle:o,target:s,targetHandle:i})=>{var x,y;const l=e.getEdges(),u=e.getNodes();if(!(r&&o&&s&&i))return!1;const p=e.getNode(r),m=e.getNode(s);if(!(p&&m&&p.data&&m.data))return!1;const h=(x=p.data.outputs[o])==null?void 0:x.type,g=(y=m.data.inputs[i])==null?void 0:y.type;return!h||!g||r===s?!1:t?l.find(b=>{b.target===s&&b.targetHandle===i&&b.source===r&&b.sourceHandle})||l.find(b=>b.target===s&&b.targetHandle===i)&&g!=="CollectionItem"||!ob(h,g)?!1:FI(r,s,u,l):!0},[e,t])},hd=e=>`var(--invokeai-colors-${e.split(".").join("-")})`,zpe=le(xe,({nodes:e})=>{const{shouldAnimateEdges:t,currentConnectionFieldType:n,shouldColorEdges:r}=e,o=hd(n&&r?wd[n].color:"base.500");let s="react-flow__custom_connection-path";return t&&(s=s.concat(" animated")),{stroke:o,className:s}}),Fpe=({fromX:e,fromY:t,fromPosition:n,toX:r,toY:o,toPosition:s})=>{const{stroke:i,className:l}=W(zpe),u={sourceX:e,sourceY:t,sourcePosition:n,targetX:r,targetY:o,targetPosition:s},[p]=sb(u);return a.jsx("g",{children:a.jsx("path",{fill:"none",stroke:i,strokeWidth:2,className:l,d:p,style:{opacity:.8}})})},Bpe=d.memo(Fpe),t7=(e,t,n,r,o)=>le(xe,({nodes:s})=>{var g,x;const i=s.nodes.find(y=>y.id===e),l=s.nodes.find(y=>y.id===n),u=On(i)&&On(l),p=(i==null?void 0:i.selected)||(l==null?void 0:l.selected)||o,m=u?(x=(g=i==null?void 0:i.data)==null?void 0:g.outputs[t||""])==null?void 0:x.type:void 0,h=m&&s.shouldColorEdges?hd(wd[m].color):hd("base.500");return{isSelected:p,shouldAnimate:s.shouldAnimateEdges&&p,stroke:h}},Se),Hpe=({sourceX:e,sourceY:t,targetX:n,targetY:r,sourcePosition:o,targetPosition:s,markerEnd:i,data:l,selected:u,source:p,target:m,sourceHandleId:h,targetHandleId:g})=>{const x=d.useMemo(()=>t7(p,h,m,g,u),[u,p,h,m,g]),{isSelected:y,shouldAnimate:b}=W(x),[w,S,j]=sb({sourceX:e,sourceY:t,sourcePosition:o,targetX:n,targetY:r,targetPosition:s}),{base500:_}=Wd();return a.jsxs(a.Fragment,{children:[a.jsx(BI,{path:w,markerEnd:i,style:{strokeWidth:y?3:2,stroke:_,opacity:y?.8:.5,animation:b?"dashdraw 0.5s linear infinite":void 0,strokeDasharray:b?5:"none"}}),(l==null?void 0:l.count)&&l.count>1&&a.jsx(FT,{children:a.jsx(L,{sx:{position:"absolute",transform:`translate(-50%, -50%) translate(${S}px,${j}px)`},className:"nodrag nopan",children:a.jsx(Ds,{variant:"solid",sx:{bg:"base.500",opacity:y?.8:.5,boxShadow:"base"},children:l.count})})})]})},Vpe=d.memo(Hpe),Wpe=({sourceX:e,sourceY:t,targetX:n,targetY:r,sourcePosition:o,targetPosition:s,markerEnd:i,selected:l,source:u,target:p,sourceHandleId:m,targetHandleId:h})=>{const g=d.useMemo(()=>t7(u,m,p,h,l),[u,m,p,h,l]),{isSelected:x,shouldAnimate:y,stroke:b}=W(g),[w]=sb({sourceX:e,sourceY:t,sourcePosition:o,targetX:n,targetY:r,targetPosition:s});return a.jsx(BI,{path:w,markerEnd:i,style:{strokeWidth:x?3:2,stroke:b,opacity:x?.8:.5,animation:y?"dashdraw 0.5s linear infinite":void 0,strokeDasharray:y?5:"none"}})},Upe=d.memo(Wpe),Gpe=e=>{const{nodeId:t,width:n,children:r,selected:o}=e,{isMouseOverNode:s,handleMouseOut:i,handleMouseOver:l}=fO(t),u=d.useMemo(()=>le(xe,({nodes:j})=>{var _;return((_=j.nodeExecutionStates[t])==null?void 0:_.status)===Ys.IN_PROGRESS}),[t]),p=W(u),[m,h,g,x]=Ho("shadows",["nodeInProgress.light","nodeInProgress.dark","shadows.xl","shadows.base"]),y=te(),b=sa(m,h),w=W(j=>j.nodes.nodeOpacity),S=d.useCallback(j=>{!j.ctrlKey&&!j.altKey&&!j.metaKey&&!j.shiftKey&&y(BT(t)),y(HI())},[y,t]);return a.jsxs(Ie,{onClick:S,onMouseEnter:l,onMouseLeave:i,className:tl,sx:{h:"full",position:"relative",borderRadius:"base",w:n??g1,transitionProperty:"common",transitionDuration:"0.1s",cursor:"grab",opacity:w},children:[a.jsx(Ie,{sx:{position:"absolute",top:0,insetInlineEnd:0,bottom:0,insetInlineStart:0,borderRadius:"base",pointerEvents:"none",shadow:`${g}, ${x}, ${x}`,zIndex:-1}}),a.jsx(Ie,{sx:{position:"absolute",top:0,insetInlineEnd:0,bottom:0,insetInlineStart:0,borderRadius:"md",pointerEvents:"none",transitionProperty:"common",transitionDuration:"0.1s",opacity:.7,shadow:p?b:void 0,zIndex:-1}}),r,a.jsx(dO,{isSelected:o,isHovered:s})]})},Ng=d.memo(Gpe),Kpe=le(xe,({system:e,gallery:t})=>{var r;return{imageDTO:t.selection[t.selection.length-1],progressImage:(r=e.denoiseProgress)==null?void 0:r.progress_image}}),qpe=e=>{const{progressImage:t,imageDTO:n}=HT(Kpe);return t?a.jsx(e1,{nodeProps:e,children:a.jsx(ga,{src:t.dataURL,sx:{w:"full",h:"full",objectFit:"contain",borderRadius:"base"}})}):n?a.jsx(e1,{nodeProps:e,children:a.jsx(ua,{imageDTO:n,isDragDisabled:!0,useThumbailFallback:!0})}):a.jsx(e1,{nodeProps:e,children:a.jsx(Zn,{})})},Xpe=d.memo(qpe),e1=e=>{const[t,n]=d.useState(!1),r=()=>{n(!0)},o=()=>{n(!1)};return a.jsx(Ng,{nodeId:e.nodeProps.id,selected:e.nodeProps.selected,width:384,children:a.jsxs(L,{onMouseEnter:r,onMouseLeave:o,className:tl,sx:{position:"relative",flexDirection:"column"},children:[a.jsx(L,{layerStyle:"nodeHeader",sx:{borderTopRadius:"base",alignItems:"center",justifyContent:"center",h:8},children:a.jsx(ve,{sx:{fontSize:"sm",fontWeight:600,color:"base.700",_dark:{color:"base.200"}},children:"Current Image"})}),a.jsxs(L,{layerStyle:"nodeBody",sx:{w:"full",h:"full",borderBottomRadius:"base",p:2},children:[e.children,t&&a.jsx(In.div,{initial:{opacity:0},animate:{opacity:1,transition:{duration:.1}},exit:{opacity:0,transition:{duration:.1}},style:{position:"absolute",top:40,left:-2,right:-2,bottom:0,pointerEvents:"none"},children:a.jsx(GO,{})},"nextPrevButtons")]})]})})},Qpe=e=>{const t=d.useMemo(()=>le(xe,({nodes:r})=>{const o=r.nodes.find(i=>i.id===e);if(!On(o))return[];const s=r.nodeTemplates[o.data.type];return s?nr(s.inputs).filter(i=>(["any","direct"].includes(i.input)||ab.includes(i.type))&&VI.includes(i.type)).filter(i=>!i.ui_hidden).sort((i,l)=>(i.ui_order??0)-(l.ui_order??0)).map(i=>i.name).filter(i=>i!=="is_intermediate"):[]},Se),[e]);return W(t)},Ype=e=>{const t=d.useMemo(()=>le(xe,({nodes:r})=>{const o=r.nodes.find(i=>i.id===e);if(!On(o))return[];const s=r.nodeTemplates[o.data.type];return s?nr(s.inputs).filter(i=>i.input==="connection"&&!ab.includes(i.type)||!VI.includes(i.type)).filter(i=>!i.ui_hidden).sort((i,l)=>(i.ui_order??0)-(l.ui_order??0)).map(i=>i.name).filter(i=>i!=="is_intermediate"):[]},Se),[e]);return W(t)},Zpe=e=>{const t=d.useMemo(()=>le(xe,({nodes:r})=>{const o=r.nodes.find(i=>i.id===e);if(!On(o))return[];const s=r.nodeTemplates[o.data.type];return s?nr(s.outputs).filter(i=>!i.ui_hidden).sort((i,l)=>(i.ui_order??0)-(l.ui_order??0)).map(i=>i.name).filter(i=>i!=="is_intermediate"):[]},Se),[e]);return W(t)},Jpe=e=>{const t=d.useMemo(()=>le(xe,({nodes:r})=>{const o=r.nodes.find(s=>s.id===e);return On(o)?o.data.embedWorkflow:!1},Se),[e]);return W(t)},$g=e=>{const t=d.useMemo(()=>le(xe,({nodes:r})=>{const o=r.nodes.find(s=>s.id===e);return On(o)?Xr(o.data.outputs,s=>VT.includes(s.type)&&o.data.type!=="image"):!1},Se),[e]);return W(t)},eme=({nodeId:e})=>{const t=te(),n=$g(e),r=Jpe(e),o=d.useCallback(s=>{t(WT({nodeId:e,embedWorkflow:s.target.checked}))},[t,e]);return n?a.jsxs(Kt,{as:L,sx:{alignItems:"center",gap:2,w:"auto"},children:[a.jsx(wn,{sx:{fontSize:"xs",mb:"1px"},children:"Workflow"}),a.jsx(Md,{className:"nopan",size:"sm",onChange:o,isChecked:r})]}):null},tme=d.memo(eme),nme=e=>{const t=d.useMemo(()=>le(xe,({nodes:r})=>{const o=r.nodes.find(s=>s.id===e);return On(o)?o.data.isIntermediate:!1},Se),[e]);return W(t)},rme=({nodeId:e})=>{const t=te(),n=$g(e),r=nme(e),o=d.useCallback(s=>{t(UT({nodeId:e,isIntermediate:!s.target.checked}))},[t,e]);return n?a.jsxs(Kt,{as:L,sx:{alignItems:"center",gap:2,w:"auto"},children:[a.jsx(wn,{sx:{fontSize:"xs",mb:"1px"},children:"Save to Gallery"}),a.jsx(Md,{className:"nopan",size:"sm",onChange:o,isChecked:!r})]}):null},ome=d.memo(rme),sme=e=>{const t=d.useMemo(()=>le(xe,({nodes:r})=>{const o=r.nodes.find(s=>s.id===e);return On(o)?o.data.useCache:!1},Se),[e]);return W(t)},ame=({nodeId:e})=>{const t=te(),n=sme(e),r=d.useCallback(o=>{t(GT({nodeId:e,useCache:o.target.checked}))},[t,e]);return a.jsxs(Kt,{as:L,sx:{alignItems:"center",gap:2,w:"auto"},children:[a.jsx(wn,{sx:{fontSize:"xs",mb:"1px"},children:"Use Cache"}),a.jsx(Md,{className:"nopan",size:"sm",onChange:r,isChecked:n})]})},ime=d.memo(ame),lme=({nodeId:e})=>{const t=$g(e),n=Bt("invocationCache").isFeatureEnabled;return a.jsxs(L,{className:tl,layerStyle:"nodeFooter",sx:{w:"full",borderBottomRadius:"base",px:2,py:0,h:6,justifyContent:"space-between"},children:[n&&a.jsx(ime,{nodeId:e}),t&&a.jsx(tme,{nodeId:e}),t&&a.jsx(ome,{nodeId:e})]})},cme=d.memo(lme),ume=({nodeId:e,isOpen:t})=>{const n=te(),r=KT(),o=d.useCallback(()=>{n(qT({nodeId:e,isOpen:!t})),r(e)},[n,t,e,r]);return a.jsx(Fe,{className:"nodrag",onClick:o,"aria-label":"Minimize",sx:{minW:8,w:8,h:8,color:"base.500",_dark:{color:"base.500"},_hover:{color:"base.700",_dark:{color:"base.300"}}},variant:"link",icon:a.jsx(gg,{sx:{transform:t?"rotate(0deg)":"rotate(180deg)",transitionProperty:"common",transitionDuration:"normal"}})})},u2=d.memo(ume),n7=e=>{const t=d.useMemo(()=>le(xe,({nodes:r})=>{const o=r.nodes.find(s=>s.id===e);return On(o)?o.data.label:!1},Se),[e]);return W(t)},r7=e=>{const t=d.useMemo(()=>le(xe,({nodes:r})=>{const o=r.nodes.find(i=>i.id===e);if(!On(o))return!1;const s=o?r.nodeTemplates[o.data.type]:void 0;return s==null?void 0:s.title},Se),[e]);return W(t)},dme=({nodeId:e,title:t})=>{const n=te(),r=n7(e),o=r7(e),{t:s}=Z(),[i,l]=d.useState(""),u=d.useCallback(async m=>{n(XT({nodeId:e,label:m})),l(r||t||o||s("nodes.problemSettingTitle"))},[n,e,t,o,r,s]),p=d.useCallback(m=>{l(m)},[]);return d.useEffect(()=>{l(r||t||o||s("nodes.problemSettingTitle"))},[r,o,t,s]),a.jsx(L,{sx:{overflow:"hidden",w:"full",h:"full",alignItems:"center",justifyContent:"center",cursor:"text"},children:a.jsxs(Ih,{as:L,value:i,onChange:p,onSubmit:u,sx:{alignItems:"center",position:"relative",w:"full",h:"full"},children:[a.jsx(_h,{fontSize:"sm",sx:{p:0,w:"full"},noOfLines:1}),a.jsx(jh,{className:"nodrag",fontSize:"sm",sx:{p:0,fontWeight:700,_focusVisible:{p:0,boxShadow:"none"}}}),a.jsx(fme,{})]})})},o7=d.memo(dme);function fme(){const{isEditing:e,getEditButtonProps:t}=C5(),n=d.useCallback(r=>{const{onClick:o}=t();o&&o(r)},[t]);return e?null:a.jsx(Ie,{className:tl,onDoubleClick:n,sx:{position:"absolute",w:"full",h:"full",top:0,cursor:"grab"}})}const d2=e=>{const t=d.useMemo(()=>le(xe,({nodes:r})=>{const o=r.nodes.find(s=>s.id===e);return o==null?void 0:o.data},Se),[e]);return W(t)},pme=({nodeId:e})=>{const t=d2(e),{base400:n,base600:r}=Wd(),o=sa(n,r),s=d.useMemo(()=>({borderWidth:0,borderRadius:"3px",width:"1rem",height:"1rem",backgroundColor:o,zIndex:-1}),[o]);return em(t)?a.jsxs(a.Fragment,{children:[a.jsx(Ou,{type:"target",id:`${t.id}-collapsed-target`,isConnectable:!1,position:Ql.Left,style:{...s,left:"-0.5rem"}}),nr(t.inputs,i=>a.jsx(Ou,{type:"target",id:i.name,isConnectable:!1,position:Ql.Left,style:{visibility:"hidden"}},`${t.id}-${i.name}-collapsed-input-handle`)),a.jsx(Ou,{type:"source",id:`${t.id}-collapsed-source`,isConnectable:!1,position:Ql.Right,style:{...s,right:"-0.5rem"}}),nr(t.outputs,i=>a.jsx(Ou,{type:"source",id:i.name,isConnectable:!1,position:Ql.Right,style:{visibility:"hidden"}},`${t.id}-${i.name}-collapsed-output-handle`))]}):null},mme=d.memo(pme),hme=e=>{const t=d.useMemo(()=>le(xe,({nodes:r})=>{const o=r.nodes.find(i=>i.id===e);return r.nodeTemplates[(o==null?void 0:o.data.type)??""]},Se),[e]);return W(t)},gme=({nodeId:e})=>{const t=te(),n=d2(e),{t:r}=Z(),o=d.useCallback(s=>{t(QT({nodeId:e,notes:s.target.value}))},[t,e]);return em(n)?a.jsxs(Kt,{children:[a.jsx(wn,{children:r("nodes.notes")}),a.jsx(da,{value:n==null?void 0:n.notes,onChange:o,rows:10})]}):null},vme=d.memo(gme),xme=e=>{const t=d.useMemo(()=>le(xe,({nodes:r})=>{var i;const o=r.nodes.find(l=>l.id===e);if(!On(o))return!1;const s=r.nodeTemplates[(o==null?void 0:o.data.type)??""];return!(s!=null&&s.version)||!((i=o.data)!=null&&i.version)?!1:Y_(s.version,o.data.version)===0},Se),[e]);return W(t)},bme=({nodeId:e})=>{const{isOpen:t,onOpen:n,onClose:r}=Lr(),o=n7(e),s=r7(e),i=xme(e),{t:l}=Z();return a.jsxs(a.Fragment,{children:[a.jsx(Ht,{label:a.jsx(s7,{nodeId:e}),placement:"top",shouldWrapChildren:!0,children:a.jsx(L,{className:"nodrag",onClick:n,sx:{alignItems:"center",justifyContent:"center",w:8,h:8,cursor:"pointer"},children:a.jsx(Nn,{as:fM,sx:{boxSize:4,w:8,color:i?"base.400":"error.400"}})})}),a.jsxs(qi,{isOpen:t,onClose:r,isCentered:!0,children:[a.jsx(Yo,{}),a.jsxs(Xi,{children:[a.jsx(Qo,{children:o||s||l("nodes.unknownNode")}),a.jsx($d,{}),a.jsx(Zo,{children:a.jsx(vme,{nodeId:e})}),a.jsx(Ss,{})]})]})]})},yme=d.memo(bme),s7=d.memo(({nodeId:e})=>{const t=d2(e),n=hme(e),{t:r}=Z(),o=d.useMemo(()=>t!=null&&t.label&&(n!=null&&n.title)?`${t.label} (${n.title})`:t!=null&&t.label&&!n?t.label:!(t!=null&&t.label)&&n?n.title:r("nodes.unknownNode"),[t,n,r]),s=d.useMemo(()=>!em(t)||!n?null:t.version?n.version?qw(t.version,n.version,"<")?a.jsxs(ve,{as:"span",sx:{color:"error.500"},children:[r("nodes.version")," ",t.version," (",r("nodes.updateNode"),")"]}):qw(t.version,n.version,">")?a.jsxs(ve,{as:"span",sx:{color:"error.500"},children:[r("nodes.version")," ",t.version," (",r("nodes.updateApp"),")"]}):a.jsxs(ve,{as:"span",children:[r("nodes.version")," ",t.version]}):a.jsxs(ve,{as:"span",sx:{color:"error.500"},children:[r("nodes.version")," ",t.version," (",r("nodes.unknownTemplate"),")"]}):a.jsx(ve,{as:"span",sx:{color:"error.500"},children:r("nodes.versionUnknown")}),[t,n,r]);return em(t)?a.jsxs(L,{sx:{flexDir:"column"},children:[a.jsx(ve,{as:"span",sx:{fontWeight:600},children:o}),a.jsx(ve,{sx:{opacity:.7,fontStyle:"oblique 5deg"},children:n==null?void 0:n.description}),s,(t==null?void 0:t.notes)&&a.jsx(ve,{children:t.notes})]}):a.jsx(ve,{sx:{fontWeight:600},children:r("nodes.unknownNode")})});s7.displayName="TooltipContent";const t1=3,E_={circle:{transitionProperty:"none",transitionDuration:"0s"},".chakra-progress__track":{stroke:"transparent"}},Cme=({nodeId:e})=>{const t=d.useMemo(()=>le(xe,({nodes:r})=>r.nodeExecutionStates[e]),[e]),n=W(t);return n?a.jsx(Ht,{label:a.jsx(a7,{nodeExecutionState:n}),placement:"top",children:a.jsx(L,{className:tl,sx:{w:5,h:"full",alignItems:"center",justifyContent:"flex-end"},children:a.jsx(i7,{nodeExecutionState:n})})}):null},wme=d.memo(Cme),a7=d.memo(({nodeExecutionState:e})=>{const{status:t,progress:n,progressImage:r}=e,{t:o}=Z();return t===Ys.PENDING?a.jsx(ve,{children:"Pending"}):t===Ys.IN_PROGRESS?r?a.jsxs(L,{sx:{pos:"relative",pt:1.5,pb:.5},children:[a.jsx(ga,{src:r.dataURL,sx:{w:32,h:32,borderRadius:"base",objectFit:"contain"}}),n!==null&&a.jsxs(Ds,{variant:"solid",sx:{pos:"absolute",top:2.5,insetInlineEnd:1},children:[Math.round(n*100),"%"]})]}):n!==null?a.jsxs(ve,{children:[o("nodes.executionStateInProgress")," (",Math.round(n*100),"%)"]}):a.jsx(ve,{children:o("nodes.executionStateInProgress")}):t===Ys.COMPLETED?a.jsx(ve,{children:o("nodes.executionStateCompleted")}):t===Ys.FAILED?a.jsx(ve,{children:o("nodes.executionStateError")}):null});a7.displayName="TooltipLabel";const i7=d.memo(e=>{const{progress:t,status:n}=e.nodeExecutionState;return n===Ys.PENDING?a.jsx(Nn,{as:$J,sx:{boxSize:t1,color:"base.600",_dark:{color:"base.300"}}}):n===Ys.IN_PROGRESS?t===null?a.jsx(B1,{isIndeterminate:!0,size:"14px",color:"base.500",thickness:14,sx:E_}):a.jsx(B1,{value:Math.round(t*100),size:"14px",color:"base.500",thickness:14,sx:E_}):n===Ys.COMPLETED?a.jsx(Nn,{as:iM,sx:{boxSize:t1,color:"ok.600",_dark:{color:"ok.300"}}}):n===Ys.FAILED?a.jsx(Nn,{as:FJ,sx:{boxSize:t1,color:"error.600",_dark:{color:"error.300"}}}):null});i7.displayName="StatusIcon";const Sme=({nodeId:e,isOpen:t})=>a.jsxs(L,{layerStyle:"nodeHeader",sx:{borderTopRadius:"base",borderBottomRadius:t?0:"base",alignItems:"center",justifyContent:"space-between",h:8,textAlign:"center",fontWeight:500,color:"base.700",_dark:{color:"base.200"}},children:[a.jsx(u2,{nodeId:e,isOpen:t}),a.jsx(o7,{nodeId:e}),a.jsxs(L,{alignItems:"center",children:[a.jsx(wme,{nodeId:e}),a.jsx(yme,{nodeId:e})]}),!t&&a.jsx(mme,{nodeId:e})]}),kme=d.memo(Sme),jme=(e,t,n,r)=>le(xe,o=>{if(!r)return yt.t("nodes.noFieldType");const{currentConnectionFieldType:s,connectionStartParams:i,nodes:l,edges:u}=o.nodes;if(!i||!s)return yt.t("nodes.noConnectionInProgress");const{handleType:p,nodeId:m,handleId:h}=i;if(!p||!m||!h)return yt.t("nodes.noConnectionData");const g=n==="target"?r:s,x=n==="source"?r:s;if(e===m)return yt.t("nodes.cannotConnectToSelf");if(n===p)return n==="source"?yt.t("nodes.cannotConnectOutputToOutput"):yt.t("nodes.cannotConnectInputToInput");const y=n==="target"?e:m,b=n==="target"?t:h,w=n==="source"?e:m,S=n==="source"?t:h;return u.find(_=>{_.target===y&&_.targetHandle===b&&_.source===w&&_.sourceHandle})?yt.t("nodes.cannotDuplicateConnection"):u.find(_=>_.target===y&&_.targetHandle===b)&&g!=="CollectionItem"?yt.t("nodes.inputMayOnlyHaveOneConnection"):ob(x,g)?FI(p==="source"?m:e,p==="source"?e:m,l,u)?null:yt.t("nodes.connectionWouldCreateCycle"):yt.t("nodes.fieldTypesMustMatch")}),_me=(e,t,n)=>{const r=d.useMemo(()=>le(xe,({nodes:s})=>{var l;const i=s.nodes.find(u=>u.id===e);if(On(i))return(l=i==null?void 0:i.data[tb[n]][t])==null?void 0:l.type},Se),[t,n,e]);return W(r)},Ime=le(xe,({nodes:e})=>e.currentConnectionFieldType!==null&&e.connectionStartParams!==null),l7=({nodeId:e,fieldName:t,kind:n})=>{const r=_me(e,t,n),o=d.useMemo(()=>le(xe,({nodes:g})=>!!g.edges.filter(x=>(n==="input"?x.target:x.source)===e&&(n==="input"?x.targetHandle:x.sourceHandle)===t).length),[t,n,e]),s=d.useMemo(()=>jme(e,t,n==="input"?"target":"source",r),[e,t,n,r]),i=d.useMemo(()=>le(xe,({nodes:g})=>{var x,y,b;return((x=g.connectionStartParams)==null?void 0:x.nodeId)===e&&((y=g.connectionStartParams)==null?void 0:y.handleId)===t&&((b=g.connectionStartParams)==null?void 0:b.handleType)==={input:"target",output:"source"}[n]}),[t,n,e]),l=W(o),u=W(Ime),p=W(i),m=W(s),h=d.useMemo(()=>!!(u&&m&&!p),[m,u,p]);return{isConnected:l,isConnectionInProgress:u,isConnectionStartField:p,connectionError:m,shouldDim:h}},Pme=(e,t)=>{const n=d.useMemo(()=>le(xe,({nodes:o})=>{var i;const s=o.nodes.find(l=>l.id===e);if(On(s))return((i=s==null?void 0:s.data.inputs[t])==null?void 0:i.value)!==void 0},Se),[t,e]);return W(n)},Eme=(e,t)=>{const n=d.useMemo(()=>le(xe,({nodes:o})=>{const s=o.nodes.find(u=>u.id===e);if(!On(s))return;const i=o.nodeTemplates[(s==null?void 0:s.data.type)??""],l=i==null?void 0:i.inputs[t];return l==null?void 0:l.input},Se),[t,e]);return W(n)},Mme=({nodeId:e,fieldName:t,kind:n,children:r})=>{const o=te(),s=pO(e,t),i=mO(e,t,n),l=Eme(e,t),{t:u}=Z(),p=d.useCallback(w=>{w.preventDefault()},[]),m=d.useMemo(()=>le(xe,({nodes:w})=>({isExposed:!!w.workflow.exposedFields.find(j=>j.nodeId===e&&j.fieldName===t)}),Se),[t,e]),h=d.useMemo(()=>["any","direct"].includes(l??"__UNKNOWN_INPUT__"),[l]),{isExposed:g}=W(m),x=d.useCallback(()=>{o(YT({nodeId:e,fieldName:t}))},[o,t,e]),y=d.useCallback(()=>{o(_I({nodeId:e,fieldName:t}))},[o,t,e]),b=d.useMemo(()=>{const w=[];return h&&!g&&w.push(a.jsx(en,{icon:a.jsx(Vc,{}),onClick:x,children:"Add to Linear View"},`${e}.${t}.expose-field`)),h&&g&&w.push(a.jsx(en,{icon:a.jsx(YJ,{}),onClick:y,children:"Remove from Linear View"},`${e}.${t}.unexpose-field`)),w},[t,x,y,g,h,e]);return a.jsx(Ry,{menuProps:{size:"sm",isLazy:!0},menuButtonProps:{bg:"transparent",_hover:{bg:"transparent"}},renderMenu:()=>b.length?a.jsx(Gi,{sx:{visibility:"visible !important"},motionProps:vc,onContextMenu:p,children:a.jsx(td,{title:s||i||u("nodes.unknownField"),children:b})}):null,children:r})},Ome=d.memo(Mme),Rme=e=>{const{fieldTemplate:t,handleType:n,isConnectionInProgress:r,isConnectionStartField:o,connectionError:s}=e,{name:i,type:l}=t,{color:u,title:p}=wd[l],m=d.useMemo(()=>{const g=ZT.includes(l),x=ab.includes(l),y=JT.includes(l),b=hd(u),w={backgroundColor:g||x?"var(--invokeai-colors-base-900)":b,position:"absolute",width:"1rem",height:"1rem",borderWidth:g||x?4:0,borderStyle:"solid",borderColor:b,borderRadius:y?4:"100%",zIndex:1};return n==="target"?w.insetInlineStart="-1rem":w.insetInlineEnd="-1rem",r&&!o&&s&&(w.filter="opacity(0.4) grayscale(0.7)"),r&&s?o?w.cursor="grab":w.cursor="not-allowed":w.cursor="crosshair",w},[s,n,r,o,l,u]),h=d.useMemo(()=>r&&o?p:r&&s?s??p:p,[s,r,o,p]);return a.jsx(Ht,{label:h,placement:n==="target"?"start":"end",hasArrow:!0,openDelay:yh,children:a.jsx(Ou,{type:n,id:i,position:n==="target"?Ql.Left:Ql.Right,style:m})})},c7=d.memo(Rme),Dme=({nodeId:e,fieldName:t})=>{const n=Pg(e,t,"input"),r=Pme(e,t),{isConnected:o,isConnectionInProgress:s,isConnectionStartField:i,connectionError:l,shouldDim:u}=l7({nodeId:e,fieldName:t,kind:"input"}),p=d.useMemo(()=>{if((n==null?void 0:n.fieldKind)!=="input"||!n.required)return!1;if(!o&&n.input==="connection"||!r&&!o&&n.input==="any")return!0},[n,o,r]);return(n==null?void 0:n.fieldKind)!=="input"?a.jsx(Rx,{shouldDim:u,children:a.jsxs(Kt,{sx:{color:"error.400",textAlign:"left",fontSize:"sm"},children:["Unknown input: ",t]})}):a.jsxs(Rx,{shouldDim:u,children:[a.jsxs(Kt,{isInvalid:p,isDisabled:o,sx:{alignItems:"stretch",justifyContent:"space-between",ps:n.input==="direct"?0:2,gap:2,h:"full",w:"full"},children:[a.jsx(Ome,{nodeId:e,fieldName:t,kind:"input",children:m=>a.jsx(wn,{sx:{display:"flex",alignItems:"center",h:"full",mb:0,px:1,gap:2},children:a.jsx(gO,{ref:m,nodeId:e,fieldName:t,kind:"input",isMissingInput:p,withTooltip:!0})})}),a.jsx(Ie,{children:a.jsx(PO,{nodeId:e,fieldName:t})})]}),n.input!=="direct"&&a.jsx(c7,{fieldTemplate:n,handleType:"target",isConnectionInProgress:s,isConnectionStartField:i,connectionError:l})]})},M_=d.memo(Dme),Rx=d.memo(({shouldDim:e,children:t})=>a.jsx(L,{sx:{position:"relative",minH:8,py:.5,alignItems:"center",opacity:e?.5:1,transitionProperty:"opacity",transitionDuration:"0.1s",w:"full",h:"full"},children:t}));Rx.displayName="InputFieldWrapper";const Ame=({nodeId:e,fieldName:t})=>{const n=Pg(e,t,"output"),{isConnected:r,isConnectionInProgress:o,isConnectionStartField:s,connectionError:i,shouldDim:l}=l7({nodeId:e,fieldName:t,kind:"output"});return(n==null?void 0:n.fieldKind)!=="output"?a.jsx(Dx,{shouldDim:l,children:a.jsxs(Kt,{sx:{color:"error.400",textAlign:"right",fontSize:"sm"},children:["Unknown output: ",t]})}):a.jsxs(Dx,{shouldDim:l,children:[a.jsx(Ht,{label:a.jsx(t2,{nodeId:e,fieldName:t,kind:"output"}),openDelay:yh,placement:"top",shouldWrapChildren:!0,hasArrow:!0,children:a.jsx(Kt,{isDisabled:r,pe:2,children:a.jsx(wn,{sx:{mb:0,fontWeight:500},children:n==null?void 0:n.title})})}),a.jsx(c7,{fieldTemplate:n,handleType:"source",isConnectionInProgress:o,isConnectionStartField:s,connectionError:i})]})},Tme=d.memo(Ame),Dx=d.memo(({shouldDim:e,children:t})=>a.jsx(L,{sx:{position:"relative",minH:8,py:.5,alignItems:"center",opacity:e?.5:1,transitionProperty:"opacity",transitionDuration:"0.1s",justifyContent:"flex-end"},children:t}));Dx.displayName="OutputFieldWrapper";const Nme=e=>{const t=$g(e),n=Bt("invocationCache").isFeatureEnabled;return d.useMemo(()=>t||n,[t,n])},$me=({nodeId:e,isOpen:t,label:n,type:r,selected:o})=>{const s=Ype(e),i=Qpe(e),l=Nme(e),u=Zpe(e);return a.jsxs(Ng,{nodeId:e,selected:o,children:[a.jsx(kme,{nodeId:e,isOpen:t,label:n,selected:o,type:r}),t&&a.jsxs(a.Fragment,{children:[a.jsx(L,{layerStyle:"nodeBody",sx:{flexDirection:"column",w:"full",h:"full",py:2,gap:1,borderBottomRadius:l?0:"base"},children:a.jsxs(L,{sx:{flexDir:"column",px:2,w:"full",h:"full"},children:[a.jsxs(Ja,{gridTemplateColumns:"1fr auto",gridAutoRows:"1fr",children:[s.map((p,m)=>a.jsx(Zu,{gridColumnStart:1,gridRowStart:m+1,children:a.jsx(M_,{nodeId:e,fieldName:p})},`${e}.${p}.input-field`)),u.map((p,m)=>a.jsx(Zu,{gridColumnStart:2,gridRowStart:m+1,children:a.jsx(Tme,{nodeId:e,fieldName:p})},`${e}.${p}.output-field`))]}),i.map(p=>a.jsx(M_,{nodeId:e,fieldName:p},`${e}.${p}.input-field`))]})}),l&&a.jsx(cme,{nodeId:e})]})]})},Lme=d.memo($me),zme=({nodeId:e,isOpen:t,label:n,type:r,selected:o})=>a.jsxs(Ng,{nodeId:e,selected:o,children:[a.jsxs(L,{className:tl,layerStyle:"nodeHeader",sx:{borderTopRadius:"base",borderBottomRadius:t?0:"base",alignItems:"center",h:8,fontWeight:600,fontSize:"sm"},children:[a.jsx(u2,{nodeId:e,isOpen:t}),a.jsx(ve,{sx:{w:"full",textAlign:"center",pe:8,color:"error.500",_dark:{color:"error.300"}},children:n?`${n} (${r})`:r})]}),t&&a.jsx(L,{layerStyle:"nodeBody",sx:{userSelect:"auto",flexDirection:"column",w:"full",h:"full",p:4,gap:1,borderBottomRadius:"base",fontSize:"sm"},children:a.jsxs(Ie,{children:[a.jsx(ve,{as:"span",children:"Unknown node type: "}),a.jsx(ve,{as:"span",fontWeight:600,children:r})]})})]}),Fme=d.memo(zme),Bme=e=>{const{data:t,selected:n}=e,{id:r,type:o,isOpen:s,label:i}=t,l=d.useMemo(()=>le(xe,({nodes:p})=>!!p.nodeTemplates[o]),[o]);return W(l)?a.jsx(Lme,{nodeId:r,isOpen:s,label:i,type:o,selected:n}):a.jsx(Fme,{nodeId:r,isOpen:s,label:i,type:o,selected:n})},Hme=d.memo(Bme),Vme=e=>{const{id:t,data:n,selected:r}=e,{notes:o,isOpen:s}=n,i=te(),l=d.useCallback(u=>{i(eN({nodeId:t,value:u.target.value}))},[i,t]);return a.jsxs(Ng,{nodeId:t,selected:r,children:[a.jsxs(L,{layerStyle:"nodeHeader",sx:{borderTopRadius:"base",borderBottomRadius:s?0:"base",alignItems:"center",justifyContent:"space-between",h:8},children:[a.jsx(u2,{nodeId:t,isOpen:s}),a.jsx(o7,{nodeId:t,title:"Notes"}),a.jsx(Ie,{minW:8})]}),s&&a.jsx(a.Fragment,{children:a.jsx(L,{layerStyle:"nodeBody",className:"nopan",sx:{cursor:"auto",flexDirection:"column",borderBottomRadius:"base",w:"full",h:"full",p:2,gap:1},children:a.jsx(L,{className:"nopan",sx:{flexDir:"column",w:"full",h:"full"},children:a.jsx(da,{value:o,onChange:l,rows:8,resize:"none",sx:{fontSize:"xs"}})})})})]})},Wme=d.memo(Vme),Ume=["Delete","Backspace"],Gme={collapsed:Vpe,default:Upe},Kme={invocation:Hme,current_image:Xpe,notes:Wme},qme={hideAttribution:!0},Xme=le(xe,({nodes:e})=>{const{shouldSnapToGrid:t,selectionMode:n}=e;return{shouldSnapToGrid:t,selectionMode:n}},Se),Qme=()=>{const e=te(),t=W(O=>O.nodes.nodes),n=W(O=>O.nodes.edges),r=W(O=>O.nodes.viewport),{shouldSnapToGrid:o,selectionMode:s}=W(Xme),i=d.useRef(null),l=d.useRef(),u=Lpe(),[p]=Ho("radii",["base"]),m=d.useCallback(O=>{e(tN(O))},[e]),h=d.useCallback(O=>{e(nN(O))},[e]),g=d.useCallback((O,T)=>{e(rN(T))},[e]),x=d.useCallback(O=>{e(Tw(O))},[e]),y=d.useCallback(()=>{e(oN({cursorPosition:l.current}))},[e]),b=d.useCallback(O=>{e(sN(O))},[e]),w=d.useCallback(O=>{e(aN(O))},[e]),S=d.useCallback(({nodes:O,edges:T})=>{e(iN(O?O.map(X=>X.id):[])),e(lN(T?T.map(X=>X.id):[]))},[e]),j=d.useCallback((O,T)=>{e(cN(T))},[e]),_=d.useCallback(()=>{e(HI())},[e]),E=d.useCallback(O=>{Nw.set(O),O.fitView()},[]),I=d.useCallback(O=>{var X,B;const T=(X=i.current)==null?void 0:X.getBoundingClientRect();if(T){const V=(B=Nw.get())==null?void 0:B.project({x:O.clientX-T.left,y:O.clientY-T.top});l.current=V}},[]),M=d.useRef(),R=d.useCallback((O,T,X)=>{M.current=O,e(uN(T.id)),e(dN())},[e]),D=d.useCallback((O,T)=>{e(Tw(T))},[e]),A=d.useCallback((O,T,X)=>{var B,V;!("touches"in O)&&((B=M.current)==null?void 0:B.clientX)===O.clientX&&((V=M.current)==null?void 0:V.clientY)===O.clientY&&e(fN(T)),M.current=void 0},[e]);return et(["Ctrl+c","Meta+c"],O=>{O.preventDefault(),e(pN())}),et(["Ctrl+a","Meta+a"],O=>{O.preventDefault(),e(mN())}),et(["Ctrl+v","Meta+v"],O=>{O.preventDefault(),e(hN({cursorPosition:l.current}))}),a.jsx(gN,{id:"workflow-editor",ref:i,defaultViewport:r,nodeTypes:Kme,edgeTypes:Gme,nodes:t,edges:n,onInit:E,onMouseMove:I,onNodesChange:m,onEdgesChange:h,onEdgesDelete:b,onEdgeUpdate:D,onEdgeUpdateStart:R,onEdgeUpdateEnd:A,onNodesDelete:w,onConnectStart:g,onConnect:x,onConnectEnd:y,onMoveEnd:j,connectionLineComponent:Bpe,onSelectionChange:S,isValidConnection:u,minZoom:.1,snapToGrid:o,snapGrid:[25,25],connectionRadius:30,proOptions:qme,style:{borderRadius:p},onPaneClick:_,deleteKeyCode:Ume,selectionMode:s,children:a.jsx(w$,{})})},Yme=()=>{const e=te(),{t}=Z(),n=d.useCallback(()=>{e(zI())},[e]);return a.jsx(L,{sx:{gap:2,position:"absolute",top:2,insetInlineStart:2},children:a.jsx(Fe,{tooltip:t("nodes.addNodeToolTip"),"aria-label":t("nodes.addNode"),icon:a.jsx(Vc,{}),onClick:n})})},Zme=d.memo(Yme),Jme=()=>{const e=te(),t=pP("nodes"),{t:n}=Z();return d.useCallback(o=>{if(!o)return;const s=new FileReader;s.onload=async()=>{const i=s.result;try{const l=JSON.parse(String(i)),u=vN.safeParse(l);if(!u.success){const{message:p}=xN(u.error,{prefix:n("nodes.workflowValidation")});t.error({error:bN(u.error)},p),e(ct(Qt({title:n("nodes.unableToValidateWorkflow"),status:"error",duration:5e3}))),s.abort();return}e(Xx(u.data)),s.abort()}catch{e(ct(Qt({title:n("nodes.unableToLoadWorkflow"),status:"error"})))}},s.readAsText(o)},[e,t,n])},ehe=d.memo(e=>e.error.issues[0]?a.jsx(ve,{children:$w(e.error.issues[0],{prefix:null}).toString()}):a.jsx(Od,{children:e.error.issues.map((t,n)=>a.jsx(Qr,{children:a.jsx(ve,{children:$w(t,{prefix:null}).toString()})},n))}));ehe.displayName="WorkflowValidationErrorContent";const the=()=>{const{t:e}=Z(),t=d.useRef(null),n=Jme();return a.jsx(AE,{resetRef:t,accept:"application/json",onChange:n,children:r=>a.jsx(Fe,{icon:a.jsx(cg,{}),tooltip:e("nodes.loadWorkflow"),"aria-label":e("nodes.loadWorkflow"),...r})})},nhe=d.memo(the),rhe=()=>{const{t:e}=Z(),t=te(),{isOpen:n,onOpen:r,onClose:o}=Lr(),s=d.useRef(null),i=W(u=>u.nodes.nodes.length),l=d.useCallback(()=>{t(yN()),t(ct(Qt({title:e("toast.nodesCleared"),status:"success"}))),o()},[t,e,o]);return a.jsxs(a.Fragment,{children:[a.jsx(Fe,{icon:a.jsx(Br,{}),tooltip:e("nodes.resetWorkflow"),"aria-label":e("nodes.resetWorkflow"),onClick:r,isDisabled:!i,colorScheme:"error"}),a.jsxs(Td,{isOpen:n,onClose:o,leastDestructiveRef:s,isCentered:!0,children:[a.jsx(Yo,{}),a.jsxs(Nd,{children:[a.jsx(Qo,{fontSize:"lg",fontWeight:"bold",children:e("nodes.resetWorkflow")}),a.jsx(Zo,{py:4,children:a.jsxs(L,{flexDir:"column",gap:2,children:[a.jsx(ve,{children:e("nodes.resetWorkflowDesc")}),a.jsx(ve,{variant:"subtext",children:e("nodes.resetWorkflowDesc2")})]})}),a.jsxs(Ss,{children:[a.jsx(Za,{ref:s,onClick:o,children:e("common.cancel")}),a.jsx(Za,{colorScheme:"error",ml:3,onClick:l,children:e("common.accept")})]})]})]})]})},ohe=d.memo(rhe),she=()=>{const{t:e}=Z(),t=uO(),n=d.useCallback(()=>{const r=new Blob([JSON.stringify(t,null,2)]),o=document.createElement("a");o.href=URL.createObjectURL(r),o.download=`${t.name||"My Workflow"}.json`,document.body.appendChild(o),o.click(),o.remove()},[t]);return a.jsx(Fe,{icon:a.jsx(ig,{}),tooltip:e("nodes.downloadWorkflow"),"aria-label":e("nodes.downloadWorkflow"),onClick:n})},ahe=d.memo(she),ihe=()=>a.jsxs(L,{sx:{gap:2,position:"absolute",top:2,insetInlineStart:"50%",transform:"translate(-50%)"},children:[a.jsx(ahe,{}),a.jsx(nhe,{}),a.jsx(ohe,{})]}),lhe=d.memo(ihe),che=()=>a.jsx(L,{sx:{gap:2,flexDir:"column"},children:nr(wd,({title:e,description:t,color:n},r)=>a.jsx(Ht,{label:t,children:a.jsx(Ds,{sx:{userSelect:"none",color:parseInt(n.split(".")[1]??"0",10)<500?"base.800":"base.50",bg:n},textAlign:"center",children:e})},r))}),uhe=d.memo(che),dhe=()=>{const{t:e}=Z(),t=te(),n=d.useCallback(()=>{t(CN())},[t]);return a.jsx(at,{leftIcon:a.jsx(iee,{}),tooltip:e("nodes.reloadNodeTemplates"),"aria-label":e("nodes.reloadNodeTemplates"),onClick:n,children:e("nodes.reloadNodeTemplates")})},fhe=d.memo(dhe),Pu={fontWeight:600},phe=le(xe,({nodes:e})=>{const{shouldAnimateEdges:t,shouldValidateGraph:n,shouldSnapToGrid:r,shouldColorEdges:o,selectionMode:s}=e;return{shouldAnimateEdges:t,shouldValidateGraph:n,shouldSnapToGrid:r,shouldColorEdges:o,selectionModeIsChecked:s===wN.Full}},Se),mhe=je((e,t)=>{const{isOpen:n,onOpen:r,onClose:o}=Lr(),s=te(),{shouldAnimateEdges:i,shouldValidateGraph:l,shouldSnapToGrid:u,shouldColorEdges:p,selectionModeIsChecked:m}=W(phe),h=d.useCallback(S=>{s(SN(S.target.checked))},[s]),g=d.useCallback(S=>{s(kN(S.target.checked))},[s]),x=d.useCallback(S=>{s(jN(S.target.checked))},[s]),y=d.useCallback(S=>{s(_N(S.target.checked))},[s]),b=d.useCallback(S=>{s(IN(S.target.checked))},[s]),{t:w}=Z();return a.jsxs(a.Fragment,{children:[a.jsx(Fe,{ref:t,"aria-label":w("nodes.workflowSettings"),tooltip:w("nodes.workflowSettings"),icon:a.jsx(cM,{}),onClick:r}),a.jsxs(qi,{isOpen:n,onClose:o,size:"2xl",isCentered:!0,children:[a.jsx(Yo,{}),a.jsxs(Xi,{children:[a.jsx(Qo,{children:w("nodes.workflowSettings")}),a.jsx($d,{}),a.jsx(Zo,{children:a.jsxs(L,{sx:{flexDirection:"column",gap:4,py:4},children:[a.jsx(cr,{size:"sm",children:"General"}),a.jsx(fn,{formLabelProps:Pu,onChange:g,isChecked:i,label:w("nodes.animatedEdges"),helperText:w("nodes.animatedEdgesHelp")}),a.jsx(Yn,{}),a.jsx(fn,{formLabelProps:Pu,isChecked:u,onChange:x,label:w("nodes.snapToGrid"),helperText:w("nodes.snapToGridHelp")}),a.jsx(Yn,{}),a.jsx(fn,{formLabelProps:Pu,isChecked:p,onChange:y,label:w("nodes.colorCodeEdges"),helperText:w("nodes.colorCodeEdgesHelp")}),a.jsx(fn,{formLabelProps:Pu,isChecked:m,onChange:b,label:w("nodes.fullyContainNodes"),helperText:w("nodes.fullyContainNodesHelp")}),a.jsx(cr,{size:"sm",pt:4,children:"Advanced"}),a.jsx(fn,{formLabelProps:Pu,isChecked:l,onChange:h,label:w("nodes.validateConnections"),helperText:w("nodes.validateConnectionsHelp")}),a.jsx(fhe,{})]})})]})]})]})}),hhe=d.memo(mhe),ghe=()=>{const e=W(t=>t.nodes.shouldShowFieldTypeLegend);return a.jsxs(L,{sx:{gap:2,position:"absolute",top:2,insetInlineEnd:2},children:[a.jsx(hhe,{}),e&&a.jsx(uhe,{})]})},vhe=d.memo(ghe);function xhe(){const e=te(),t=W(o=>o.nodes.nodeOpacity),{t:n}=Z(),r=d.useCallback(o=>{e(PN(o))},[e]);return a.jsx(L,{alignItems:"center",children:a.jsxs(Wb,{"aria-label":n("nodes.nodeOpacity"),value:t,min:.5,max:1,step:.01,onChange:r,orientation:"vertical",defaultValue:30,h:"calc(100% - 0.5rem)",children:[a.jsx(Gb,{children:a.jsx(Kb,{})}),a.jsx(Ub,{})]})})}const bhe=()=>{const{t:e}=Z(),{zoomIn:t,zoomOut:n,fitView:r}=rb(),o=te(),s=W(m=>m.nodes.shouldShowMinimapPanel),i=d.useCallback(()=>{t()},[t]),l=d.useCallback(()=>{n()},[n]),u=d.useCallback(()=>{r()},[r]),p=d.useCallback(()=>{o(EN(!s))},[s,o]);return a.jsxs(Vt,{isAttached:!0,orientation:"vertical",children:[a.jsx(Fe,{tooltip:e("nodes.zoomInNodes"),"aria-label":e("nodes.zoomInNodes"),onClick:i,icon:a.jsx(Soe,{})}),a.jsx(Fe,{tooltip:e("nodes.zoomOutNodes"),"aria-label":e("nodes.zoomOutNodes"),onClick:l,icon:a.jsx(woe,{})}),a.jsx(Fe,{tooltip:e("nodes.fitViewportNodes"),"aria-label":e("nodes.fitViewportNodes"),onClick:u,icon:a.jsx(uM,{})}),a.jsx(Fe,{tooltip:e(s?"nodes.hideMinimapnodes":"nodes.showMinimapnodes"),"aria-label":e(s?"nodes.hideMinimapnodes":"nodes.showMinimapnodes"),isChecked:s,onClick:p,icon:a.jsx(QJ,{})})]})},yhe=d.memo(bhe),Che=()=>a.jsxs(L,{sx:{gap:2,position:"absolute",bottom:2,insetInlineStart:2},children:[a.jsx(yhe,{}),a.jsx(xhe,{})]}),whe=d.memo(Che),She=we(g$),khe=()=>{const e=W(r=>r.nodes.shouldShowMinimapPanel),t=sa("var(--invokeai-colors-accent-300)","var(--invokeai-colors-accent-600)"),n=sa("var(--invokeai-colors-blackAlpha-300)","var(--invokeai-colors-blackAlpha-600)");return a.jsx(L,{sx:{gap:2,position:"absolute",bottom:2,insetInlineEnd:2},children:e&&a.jsx(She,{pannable:!0,zoomable:!0,nodeBorderRadius:15,sx:{m:"0 !important",backgroundColor:"base.200 !important",borderRadius:"base",_dark:{backgroundColor:"base.500 !important"},svg:{borderRadius:"inherit"}},nodeColor:t,maskColor:n})})},jhe=d.memo(khe),_he=()=>{const e=W(n=>n.nodes.isReady),{t}=Z();return a.jsxs(L,{layerStyle:"first",sx:{position:"relative",width:"full",height:"full",borderRadius:"base",alignItems:"center",justifyContent:"center"},children:[a.jsx(dr,{children:e&&a.jsxs(In.div,{initial:{opacity:0},animate:{opacity:1,transition:{duration:.2}},exit:{opacity:0,transition:{duration:.2}},style:{position:"relative",width:"100%",height:"100%"},children:[a.jsx(Qme,{}),a.jsx($pe,{}),a.jsx(Zme,{}),a.jsx(lhe,{}),a.jsx(vhe,{}),a.jsx(whe,{}),a.jsx(jhe,{})]})}),a.jsx(dr,{children:!e&&a.jsx(In.div,{initial:{opacity:0},animate:{opacity:1,transition:{duration:.2}},exit:{opacity:0,transition:{duration:.2}},style:{position:"absolute",width:"100%",height:"100%"},children:a.jsx(L,{layerStyle:"first",sx:{position:"relative",width:"full",height:"full",borderRadius:"base",alignItems:"center",justifyContent:"center",pointerEvents:"none"},children:a.jsx(Zn,{label:t("nodes.loadingNodes"),icon:koe})})})})]})},Ihe=d.memo(_he),Phe=()=>a.jsx(MN,{children:a.jsx(Ihe,{})}),Ehe=d.memo(Phe),Mhe=()=>{const{t:e}=Z(),t=te(),{data:n}=kd(),r=W(u=>u.system.isConnected),[o,{isLoading:s}]=ON({fixedCacheKey:"clearInvocationCache"}),i=d.useMemo(()=>!(n!=null&&n.size)||!r,[n==null?void 0:n.size,r]);return{clearInvocationCache:d.useCallback(async()=>{if(!i)try{await o().unwrap(),t(ct({title:e("invocationCache.clearSucceeded"),status:"success"}))}catch{t(ct({title:e("invocationCache.clearFailed"),status:"error"}))}},[i,o,t,e]),isLoading:s,cacheStatus:n,isDisabled:i}},Ohe=()=>{const{t:e}=Z(),{clearInvocationCache:t,isDisabled:n,isLoading:r}=Mhe();return a.jsx(at,{isDisabled:n,isLoading:r,onClick:t,children:e("invocationCache.clear")})},Rhe=d.memo(Ohe),Dhe=()=>{const{t:e}=Z(),t=te(),{data:n}=kd(),r=W(u=>u.system.isConnected),[o,{isLoading:s}]=RN({fixedCacheKey:"disableInvocationCache"}),i=d.useMemo(()=>!(n!=null&&n.enabled)||!r||(n==null?void 0:n.max_size)===0,[n==null?void 0:n.enabled,n==null?void 0:n.max_size,r]);return{disableInvocationCache:d.useCallback(async()=>{if(!i)try{await o().unwrap(),t(ct({title:e("invocationCache.disableSucceeded"),status:"success"}))}catch{t(ct({title:e("invocationCache.disableFailed"),status:"error"}))}},[i,o,t,e]),isLoading:s,cacheStatus:n,isDisabled:i}},Ahe=()=>{const{t:e}=Z(),t=te(),{data:n}=kd(),r=W(u=>u.system.isConnected),[o,{isLoading:s}]=DN({fixedCacheKey:"enableInvocationCache"}),i=d.useMemo(()=>(n==null?void 0:n.enabled)||!r||(n==null?void 0:n.max_size)===0,[n==null?void 0:n.enabled,n==null?void 0:n.max_size,r]);return{enableInvocationCache:d.useCallback(async()=>{if(!i)try{await o().unwrap(),t(ct({title:e("invocationCache.enableSucceeded"),status:"success"}))}catch{t(ct({title:e("invocationCache.enableFailed"),status:"error"}))}},[i,o,t,e]),isLoading:s,cacheStatus:n,isDisabled:i}},The=()=>{const{t:e}=Z(),{data:t}=kd(),{enableInvocationCache:n,isDisabled:r,isLoading:o}=Ahe(),{disableInvocationCache:s,isDisabled:i,isLoading:l}=Dhe();return t!=null&&t.enabled?a.jsx(at,{isDisabled:i,isLoading:l,onClick:s,children:e("invocationCache.disable")}):a.jsx(at,{isDisabled:r,isLoading:o,onClick:n,children:e("invocationCache.enable")})},Nhe=d.memo(The),$he=({children:e,...t})=>a.jsx(iP,{alignItems:"center",justifyContent:"center",w:"full",h:"full",layerStyle:"second",borderRadius:"base",py:2,px:3,gap:6,flexWrap:"nowrap",...t,children:e}),u7=d.memo($he),Lhe={'&[aria-disabled="true"]':{color:"base.400",_dark:{color:"base.500"}}},zhe=({label:e,value:t,isDisabled:n=!1,...r})=>a.jsxs(aP,{flexGrow:1,textOverflow:"ellipsis",overflow:"hidden",whiteSpace:"nowrap","aria-disabled":n,sx:Lhe,...r,children:[a.jsx(lP,{textOverflow:"ellipsis",overflow:"hidden",whiteSpace:"nowrap",children:e}),a.jsx(cP,{children:t})]}),hs=d.memo(zhe),Fhe=()=>{const{t:e}=Z(),{data:t}=kd(void 0);return a.jsxs(u7,{children:[a.jsx(hs,{isDisabled:!(t!=null&&t.enabled),label:e("invocationCache.cacheSize"),value:(t==null?void 0:t.size)??0}),a.jsx(hs,{isDisabled:!(t!=null&&t.enabled),label:e("invocationCache.hits"),value:(t==null?void 0:t.hits)??0}),a.jsx(hs,{isDisabled:!(t!=null&&t.enabled),label:e("invocationCache.misses"),value:(t==null?void 0:t.misses)??0}),a.jsx(hs,{isDisabled:!(t!=null&&t.enabled),label:e("invocationCache.maxCacheSize"),value:(t==null?void 0:t.max_size)??0}),a.jsxs(Vt,{w:24,orientation:"vertical",size:"xs",children:[a.jsx(Rhe,{}),a.jsx(Nhe,{})]})]})},Bhe=d.memo(Fhe),d7=e=>{const t=W(l=>l.system.isConnected),[n,{isLoading:r}]=Yx(),o=te(),{t:s}=Z();return{cancelQueueItem:d.useCallback(async()=>{try{await n(e).unwrap(),o(ct({title:s("queue.cancelSucceeded"),status:"success"}))}catch{o(ct({title:s("queue.cancelFailed"),status:"error"}))}},[o,e,s,n]),isLoading:r,isDisabled:!t}},f7=(e,t)=>Number(((Date.parse(t)-Date.parse(e))/1e3).toFixed(2)),O_={pending:{colorScheme:"cyan",translationKey:"queue.pending"},in_progress:{colorScheme:"yellow",translationKey:"queue.in_progress"},completed:{colorScheme:"green",translationKey:"queue.completed"},failed:{colorScheme:"red",translationKey:"queue.failed"},canceled:{colorScheme:"orange",translationKey:"queue.canceled"}},Hhe=({status:e})=>{const{t}=Z();return a.jsx(Ds,{colorScheme:O_[e].colorScheme,children:t(O_[e].translationKey)})},Vhe=d.memo(Hhe),Whe=e=>{const t=W(u=>u.system.isConnected),{isCanceled:n}=AN({batch_id:e},{selectFromResult:({data:u})=>u?{isCanceled:(u==null?void 0:u.in_progress)===0&&(u==null?void 0:u.pending)===0}:{isCanceled:!0}}),[r,{isLoading:o}]=TN({fixedCacheKey:"cancelByBatchIds"}),s=te(),{t:i}=Z();return{cancelBatch:d.useCallback(async()=>{if(!n)try{await r({batch_ids:[e]}).unwrap(),s(ct({title:i("queue.cancelBatchSucceeded"),status:"success"}))}catch{s(ct({title:i("queue.cancelBatchFailed"),status:"error"}))}},[e,s,n,i,r]),isLoading:o,isCanceled:n,isDisabled:!t}},Uhe=({queueItemDTO:e})=>{const{session_id:t,batch_id:n,item_id:r}=e,{t:o}=Z(),{cancelBatch:s,isLoading:i,isCanceled:l}=Whe(n),{cancelQueueItem:u,isLoading:p}=d7(r),{data:m}=NN(r),h=d.useMemo(()=>{if(!m)return o("common.loading");if(!m.completed_at||!m.started_at)return o(`queue.${m.status}`);const g=f7(m.started_at,m.completed_at);return m.status==="completed"?`${o("queue.completedIn")} ${g}${g===1?"":"s"}`:`${g}s`},[m,o]);return a.jsxs(L,{layerStyle:"third",flexDir:"column",p:2,pt:0,borderRadius:"base",gap:2,children:[a.jsxs(L,{layerStyle:"second",p:2,gap:2,justifyContent:"space-between",alignItems:"center",borderRadius:"base",h:20,children:[a.jsx(Ap,{label:o("queue.status"),data:h}),a.jsx(Ap,{label:o("queue.item"),data:r}),a.jsx(Ap,{label:o("queue.batch"),data:n}),a.jsx(Ap,{label:o("queue.session"),data:t}),a.jsxs(Vt,{size:"xs",orientation:"vertical",children:[a.jsx(at,{onClick:u,isLoading:p,isDisabled:m?["canceled","completed","failed"].includes(m.status):!0,"aria-label":o("queue.cancelItem"),icon:a.jsx(Ic,{}),colorScheme:"error",children:o("queue.cancelItem")}),a.jsx(at,{onClick:s,isLoading:i,isDisabled:l,"aria-label":o("queue.cancelBatch"),icon:a.jsx(Ic,{}),colorScheme:"error",children:o("queue.cancelBatch")})]})]}),(m==null?void 0:m.error)&&a.jsxs(L,{layerStyle:"second",p:3,gap:1,justifyContent:"space-between",alignItems:"flex-start",borderRadius:"base",flexDir:"column",children:[a.jsx(cr,{size:"sm",color:"error.500",_dark:{color:"error.400"},children:"Error"}),a.jsx("pre",{children:m.error})]}),a.jsx(L,{layerStyle:"second",h:512,w:"full",borderRadius:"base",alignItems:"center",justifyContent:"center",children:m?a.jsx(Zd,{children:a.jsx(Ya,{label:"Queue Item",data:m})}):a.jsx(fa,{opacity:.5})})]})},Ghe=d.memo(Uhe),Ap=({label:e,data:t})=>a.jsxs(L,{flexDir:"column",justifyContent:"flex-start",p:1,gap:1,overflow:"hidden",h:"full",w:"full",children:[a.jsx(cr,{size:"md",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",children:e}),a.jsx(ve,{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",children:t})]}),vs={number:"3rem",statusBadge:"5.7rem",statusDot:2,time:"4rem",batchId:"5rem",fieldValues:"auto",actions:"auto"},R_={bg:"base.300",_dark:{bg:"base.750"}},Khe={_hover:R_,"&[aria-selected='true']":R_},qhe=({index:e,item:t,context:n})=>{const{t:r}=Z(),o=d.useCallback(()=>{n.toggleQueueItem(t.item_id)},[n,t.item_id]),{cancelQueueItem:s,isLoading:i}=d7(t.item_id),l=d.useCallback(h=>{h.stopPropagation(),s()},[s]),u=d.useMemo(()=>n.openQueueItems.includes(t.item_id),[n.openQueueItems,t.item_id]),p=d.useMemo(()=>!t.completed_at||!t.started_at?void 0:`${f7(t.started_at,t.completed_at)}s`,[t]),m=d.useMemo(()=>["canceled","completed","failed"].includes(t.status),[t.status]);return a.jsxs(L,{flexDir:"column","aria-selected":u,fontSize:"sm",borderRadius:"base",justifyContent:"center",sx:Khe,"data-testid":"queue-item",children:[a.jsxs(L,{minH:9,alignItems:"center",gap:4,p:1.5,cursor:"pointer",onClick:o,children:[a.jsx(L,{w:vs.number,justifyContent:"flex-end",alignItems:"center",flexShrink:0,children:a.jsx(ve,{variant:"subtext",children:e+1})}),a.jsx(L,{w:vs.statusBadge,alignItems:"center",flexShrink:0,children:a.jsx(Vhe,{status:t.status})}),a.jsx(L,{w:vs.time,alignItems:"center",flexShrink:0,children:p||"-"}),a.jsx(L,{w:vs.batchId,flexShrink:0,children:a.jsx(ve,{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",alignItems:"center",children:t.batch_id})}),a.jsx(L,{alignItems:"center",overflow:"hidden",flexGrow:1,children:t.field_values&&a.jsx(L,{gap:2,w:"full",whiteSpace:"nowrap",textOverflow:"ellipsis",overflow:"hidden",children:t.field_values.filter(h=>h.node_path!=="metadata_accumulator").map(({node_path:h,field_name:g,value:x})=>a.jsxs(ve,{as:"span",children:[a.jsxs(ve,{as:"span",fontWeight:600,children:[h,".",g]}),": ",x]},`${t.item_id}.${h}.${g}.${x}`))})}),a.jsx(L,{alignItems:"center",w:vs.actions,pe:3,children:a.jsx(Vt,{size:"xs",variant:"ghost",children:a.jsx(Fe,{onClick:l,isDisabled:m,isLoading:i,"aria-label":r("queue.cancelItem"),icon:a.jsx(Ic,{})})})})]}),a.jsx(Id,{in:u,transition:{enter:{duration:.1},exit:{duration:.1}},unmountOnExit:!0,children:a.jsx(Ghe,{queueItemDTO:t})})]})},Xhe=d.memo(qhe),Qhe=d.memo(je((e,t)=>a.jsx(L,{...e,ref:t,flexDirection:"column",gap:.5,children:e.children}))),Yhe=d.memo(Qhe),Zhe=()=>a.jsxs(L,{alignItems:"center",gap:4,p:1,pb:2,textTransform:"uppercase",fontWeight:700,fontSize:"xs",letterSpacing:1,children:[a.jsx(L,{w:vs.number,justifyContent:"flex-end",alignItems:"center",children:a.jsx(ve,{variant:"subtext",children:"#"})}),a.jsx(L,{ps:.5,w:vs.statusBadge,alignItems:"center",children:a.jsx(ve,{variant:"subtext",children:"status"})}),a.jsx(L,{ps:.5,w:vs.time,alignItems:"center",children:a.jsx(ve,{variant:"subtext",children:"time"})}),a.jsx(L,{ps:.5,w:vs.batchId,alignItems:"center",children:a.jsx(ve,{variant:"subtext",children:"batch"})}),a.jsx(L,{ps:.5,w:vs.fieldValues,alignItems:"center",children:a.jsx(ve,{variant:"subtext",children:"batch field values"})})]}),Jhe=d.memo(Zhe),ege={defer:!0,options:{scrollbars:{visibility:"auto",autoHide:"scroll",autoHideDelay:1300,theme:"os-theme-dark"},overflow:{x:"hidden"}}},tge=le(xe,({queue:e})=>{const{listCursor:t,listPriority:n}=e;return{listCursor:t,listPriority:n}},Se),nge=(e,t)=>t.item_id,rge={List:Yhe},oge=(e,t,n)=>a.jsx(Xhe,{index:e,item:t,context:n}),sge=()=>{const{listCursor:e,listPriority:t}=W(tge),n=te(),r=d.useRef(null),[o,s]=d.useState(null),[i,l]=Ey(ege),{t:u}=Z();d.useEffect(()=>{const{current:S}=r;return o&&S&&i({target:S,elements:{viewport:o}}),()=>{var j;return(j=l())==null?void 0:j.destroy()}},[o,i,l]);const{data:p,isLoading:m}=$N({cursor:e,priority:t}),h=d.useMemo(()=>p?LN.getSelectors().selectAll(p):[],[p]),g=d.useCallback(()=>{if(!(p!=null&&p.has_more))return;const S=h[h.length-1];S&&(n(Zx(S.item_id)),n(Jx(S.priority)))},[n,p==null?void 0:p.has_more,h]),[x,y]=d.useState([]),b=d.useCallback(S=>{y(j=>j.includes(S)?j.filter(_=>_!==S):[...j,S])},[]),w=d.useMemo(()=>({openQueueItems:x,toggleQueueItem:b}),[x,b]);return m?a.jsx(Fne,{}):h.length?a.jsxs(L,{w:"full",h:"full",flexDir:"column",children:[a.jsx(Jhe,{}),a.jsx(L,{ref:r,w:"full",h:"full",alignItems:"center",justifyContent:"center",children:a.jsx(Yre,{data:h,endReached:g,scrollerRef:s,itemContent:oge,computeItemKey:nge,components:rge,context:w})})]}):a.jsx(L,{w:"full",h:"full",alignItems:"center",justifyContent:"center",children:a.jsx(cr,{color:"base.400",_dark:{color:"base.500"},children:u("queue.queueEmpty")})})},age=d.memo(sge),ige=()=>{const{data:e}=va(),{t}=Z();return a.jsxs(u7,{"data-testid":"queue-status",children:[a.jsx(hs,{label:t("queue.in_progress"),value:(e==null?void 0:e.queue.in_progress)??0}),a.jsx(hs,{label:t("queue.pending"),value:(e==null?void 0:e.queue.pending)??0}),a.jsx(hs,{label:t("queue.completed"),value:(e==null?void 0:e.queue.completed)??0}),a.jsx(hs,{label:t("queue.failed"),value:(e==null?void 0:e.queue.failed)??0}),a.jsx(hs,{label:t("queue.canceled"),value:(e==null?void 0:e.queue.canceled)??0}),a.jsx(hs,{label:t("queue.total"),value:(e==null?void 0:e.queue.total)??0})]})},lge=d.memo(ige);function cge(e){return Te({tag:"svg",attr:{fill:"currentColor",viewBox:"0 0 16 16"},child:[{tag:"path",attr:{d:"M7.657 6.247c.11-.33.576-.33.686 0l.645 1.937a2.89 2.89 0 0 0 1.829 1.828l1.936.645c.33.11.33.576 0 .686l-1.937.645a2.89 2.89 0 0 0-1.828 1.829l-.645 1.936a.361.361 0 0 1-.686 0l-.645-1.937a2.89 2.89 0 0 0-1.828-1.828l-1.937-.645a.361.361 0 0 1 0-.686l1.937-.645a2.89 2.89 0 0 0 1.828-1.828l.645-1.937zM3.794 1.148a.217.217 0 0 1 .412 0l.387 1.162c.173.518.579.924 1.097 1.097l1.162.387a.217.217 0 0 1 0 .412l-1.162.387A1.734 1.734 0 0 0 4.593 5.69l-.387 1.162a.217.217 0 0 1-.412 0L3.407 5.69A1.734 1.734 0 0 0 2.31 4.593l-1.162-.387a.217.217 0 0 1 0-.412l1.162-.387A1.734 1.734 0 0 0 3.407 2.31l.387-1.162zM10.863.099a.145.145 0 0 1 .274 0l.258.774c.115.346.386.617.732.732l.774.258a.145.145 0 0 1 0 .274l-.774.258a1.156 1.156 0 0 0-.732.732l-.258.774a.145.145 0 0 1-.274 0l-.258-.774a1.156 1.156 0 0 0-.732-.732L9.1 2.137a.145.145 0 0 1 0-.274l.774-.258c.346-.115.617-.386.732-.732L10.863.1z"}}]})(e)}const uge=()=>{const e=te(),{t}=Z(),n=W(u=>u.system.isConnected),[r,{isLoading:o}]=RI({fixedCacheKey:"pruneQueue"}),{finishedCount:s}=va(void 0,{selectFromResult:({data:u})=>u?{finishedCount:u.queue.completed+u.queue.canceled+u.queue.failed}:{finishedCount:0}}),i=d.useCallback(async()=>{if(s)try{const u=await r().unwrap();e(ct({title:t("queue.pruneSucceeded",{item_count:u.deleted}),status:"success"})),e(Zx(void 0)),e(Jx(void 0))}catch{e(ct({title:t("queue.pruneFailed"),status:"error"}))}},[s,r,e,t]),l=d.useMemo(()=>!n||!s,[s,n]);return{pruneQueue:i,isLoading:o,finishedCount:s,isDisabled:l}},dge=({asIconButton:e})=>{const{t}=Z(),{pruneQueue:n,isLoading:r,finishedCount:o,isDisabled:s}=uge();return a.jsx(ul,{isDisabled:s,isLoading:r,asIconButton:e,label:t("queue.prune"),tooltip:t("queue.pruneTooltip",{item_count:o}),icon:a.jsx(cge,{}),onClick:n,colorScheme:"blue"})},fge=d.memo(dge),pge=()=>{const e=Bt("pauseQueue").isFeatureEnabled,t=Bt("resumeQueue").isFeatureEnabled;return a.jsxs(L,{layerStyle:"second",borderRadius:"base",p:2,gap:2,children:[e||t?a.jsxs(Vt,{w:28,orientation:"vertical",isAttached:!0,size:"sm",children:[t?a.jsx(X8,{}):a.jsx(a.Fragment,{}),e?a.jsx(V8,{}):a.jsx(a.Fragment,{})]}):a.jsx(a.Fragment,{}),a.jsxs(Vt,{w:28,orientation:"vertical",isAttached:!0,size:"sm",children:[a.jsx(fge,{}),a.jsx(qy,{})]})]})},mge=d.memo(pge),hge=()=>{const e=Bt("invocationCache").isFeatureEnabled;return a.jsxs(L,{layerStyle:"first",borderRadius:"base",w:"full",h:"full",p:2,flexDir:"column",gap:2,children:[a.jsxs(L,{gap:2,w:"full",children:[a.jsx(mge,{}),a.jsx(lge,{}),e&&a.jsx(Bhe,{})]}),a.jsx(Ie,{layerStyle:"second",p:2,borderRadius:"base",w:"full",h:"full",children:a.jsx(age,{})})]})},gge=d.memo(hge),vge=()=>a.jsx(gge,{}),xge=d.memo(vge),bge=()=>a.jsx(KO,{}),yge=d.memo(bge);var Ax={exports:{}};(function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.Konva=void 0;var n=Lw;Object.defineProperty(t,"Konva",{enumerable:!0,get:function(){return n.Konva}});const r=Lw;e.exports=r.Konva})(Ax,Ax.exports);var Cge=Ax.exports;const gd=xd(Cge);var p7={exports:{}};/** * @license React * react-reconciler.production.min.js * @@ -61,17 +61,17 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var hge=function(t){var n={},r=d,o=Tp,s=Object.assign;function i(c){for(var f="https://reactjs.org/docs/error-decoder.html?invariant="+c,v=1;vne||k[z]!==P[ne]){var pe=` -`+k[z].replace(" at new "," at ");return c.displayName&&pe.includes("")&&(pe=pe.replace("",c.displayName)),pe}while(1<=z&&0<=ne);break}}}finally{Jc=!1,Error.prepareStackTrace=v}return(c=c?c.displayName||c.name:"")?mi(c):""}var Bg=Object.prototype.hasOwnProperty,_a=[],rt=-1;function Mt(c){return{current:c}}function kt(c){0>rt||(c.current=_a[rt],_a[rt]=null,rt--)}function Ot(c,f){rt++,_a[rt]=c.current,c.current=f}var rr={},rn=Mt(rr),Dn=Mt(!1),gr=rr;function vl(c,f){var v=c.type.contextTypes;if(!v)return rr;var C=c.stateNode;if(C&&C.__reactInternalMemoizedUnmaskedChildContext===f)return C.__reactInternalMemoizedMaskedChildContext;var k={},P;for(P in v)k[P]=f[P];return C&&(c=c.stateNode,c.__reactInternalMemoizedUnmaskedChildContext=f,c.__reactInternalMemoizedMaskedChildContext=k),k}function jr(c){return c=c.childContextTypes,c!=null}function nf(){kt(Dn),kt(rn)}function h2(c,f,v){if(rn.current!==rr)throw Error(i(168));Ot(rn,f),Ot(Dn,v)}function g2(c,f,v){var C=c.stateNode;if(f=f.childContextTypes,typeof C.getChildContext!="function")return v;C=C.getChildContext();for(var k in C)if(!(k in f))throw Error(i(108,D(c)||"Unknown",k));return s({},v,C)}function rf(c){return c=(c=c.stateNode)&&c.__reactInternalMemoizedMergedChildContext||rr,gr=rn.current,Ot(rn,c),Ot(Dn,Dn.current),!0}function v2(c,f,v){var C=c.stateNode;if(!C)throw Error(i(169));v?(c=g2(c,f,gr),C.__reactInternalMemoizedMergedChildContext=c,kt(Dn),kt(rn),Ot(rn,c)):kt(Dn),Ot(Dn,v)}var Oo=Math.clz32?Math.clz32:P7,_7=Math.log,I7=Math.LN2;function P7(c){return c>>>=0,c===0?32:31-(_7(c)/I7|0)|0}var of=64,sf=4194304;function tu(c){switch(c&-c){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 c&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return c&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return c}}function af(c,f){var v=c.pendingLanes;if(v===0)return 0;var C=0,k=c.suspendedLanes,P=c.pingedLanes,z=v&268435455;if(z!==0){var ne=z&~k;ne!==0?C=tu(ne):(P&=z,P!==0&&(C=tu(P)))}else z=v&~k,z!==0?C=tu(z):P!==0&&(C=tu(P));if(C===0)return 0;if(f!==0&&f!==C&&!(f&k)&&(k=C&-C,P=f&-f,k>=P||k===16&&(P&4194240)!==0))return f;if(C&4&&(C|=v&16),f=c.entangledLanes,f!==0)for(c=c.entanglements,f&=C;0v;v++)f.push(c);return f}function nu(c,f,v){c.pendingLanes|=f,f!==536870912&&(c.suspendedLanes=0,c.pingedLanes=0),c=c.eventTimes,f=31-Oo(f),c[f]=v}function O7(c,f){var v=c.pendingLanes&~f;c.pendingLanes=f,c.suspendedLanes=0,c.pingedLanes=0,c.expiredLanes&=f,c.mutableReadLanes&=f,c.entangledLanes&=f,f=c.entanglements;var C=c.eventTimes;for(c=c.expirationTimes;0>=z,k-=z,Fs=1<<32-Oo(f)+k|v<$t?(Xn=xt,xt=null):Xn=xt.sibling;var Lt=We(ue,xt,me[$t],Ue);if(Lt===null){xt===null&&(xt=Xn);break}c&&xt&&Lt.alternate===null&&f(ue,xt),oe=P(Lt,oe,$t),Ct===null?it=Lt:Ct.sibling=Lt,Ct=Lt,xt=Xn}if($t===me.length)return v(ue,xt),ln&&gi(ue,$t),it;if(xt===null){for(;$t$t?(Xn=xt,xt=null):Xn=xt.sibling;var Aa=We(ue,xt,Lt.value,Ue);if(Aa===null){xt===null&&(xt=Xn);break}c&&xt&&Aa.alternate===null&&f(ue,xt),oe=P(Aa,oe,$t),Ct===null?it=Aa:Ct.sibling=Aa,Ct=Aa,xt=Xn}if(Lt.done)return v(ue,xt),ln&&gi(ue,$t),it;if(xt===null){for(;!Lt.done;$t++,Lt=me.next())Lt=vt(ue,Lt.value,Ue),Lt!==null&&(oe=P(Lt,oe,$t),Ct===null?it=Lt:Ct.sibling=Lt,Ct=Lt);return ln&&gi(ue,$t),it}for(xt=C(ue,xt);!Lt.done;$t++,Lt=me.next())Lt=sn(xt,ue,$t,Lt.value,Ue),Lt!==null&&(c&&Lt.alternate!==null&&xt.delete(Lt.key===null?$t:Lt.key),oe=P(Lt,oe,$t),Ct===null?it=Lt:Ct.sibling=Lt,Ct=Lt);return c&&xt.forEach(function(gR){return f(ue,gR)}),ln&&gi(ue,$t),it}function Us(ue,oe,me,Ue){if(typeof me=="object"&&me!==null&&me.type===m&&me.key===null&&(me=me.props.children),typeof me=="object"&&me!==null){switch(me.$$typeof){case u:e:{for(var it=me.key,Ct=oe;Ct!==null;){if(Ct.key===it){if(it=me.type,it===m){if(Ct.tag===7){v(ue,Ct.sibling),oe=k(Ct,me.props.children),oe.return=ue,ue=oe;break e}}else if(Ct.elementType===it||typeof it=="object"&&it!==null&&it.$$typeof===_&&N2(it)===Ct.type){v(ue,Ct.sibling),oe=k(Ct,me.props),oe.ref=ou(ue,Ct,me),oe.return=ue,ue=oe;break e}v(ue,Ct);break}else f(ue,Ct);Ct=Ct.sibling}me.type===m?(oe=Si(me.props.children,ue.mode,Ue,me.key),oe.return=ue,ue=oe):(Ue=Uf(me.type,me.key,me.props,null,ue.mode,Ue),Ue.ref=ou(ue,oe,me),Ue.return=ue,ue=Ue)}return z(ue);case p:e:{for(Ct=me.key;oe!==null;){if(oe.key===Ct)if(oe.tag===4&&oe.stateNode.containerInfo===me.containerInfo&&oe.stateNode.implementation===me.implementation){v(ue,oe.sibling),oe=k(oe,me.children||[]),oe.return=ue,ue=oe;break e}else{v(ue,oe);break}else f(ue,oe);oe=oe.sibling}oe=X0(me,ue.mode,Ue),oe.return=ue,ue=oe}return z(ue);case _:return Ct=me._init,Us(ue,oe,Ct(me._payload),Ue)}if(U(me))return Zt(ue,oe,me,Ue);if(M(me))return Er(ue,oe,me,Ue);bf(ue,me)}return typeof me=="string"&&me!==""||typeof me=="number"?(me=""+me,oe!==null&&oe.tag===6?(v(ue,oe.sibling),oe=k(oe,me),oe.return=ue,ue=oe):(v(ue,oe),oe=q0(me,ue.mode,Ue),oe.return=ue,ue=oe),z(ue)):v(ue,oe)}return Us}var Sl=$2(!0),L2=$2(!1),su={},co=Mt(su),au=Mt(su),kl=Mt(su);function ls(c){if(c===su)throw Error(i(174));return c}function l0(c,f){Ot(kl,f),Ot(au,c),Ot(co,su),c=$(f),kt(co),Ot(co,c)}function jl(){kt(co),kt(au),kt(kl)}function z2(c){var f=ls(kl.current),v=ls(co.current);f=q(v,c.type,f),v!==f&&(Ot(au,c),Ot(co,f))}function c0(c){au.current===c&&(kt(co),kt(au))}var vn=Mt(0);function yf(c){for(var f=c;f!==null;){if(f.tag===13){var v=f.memoizedState;if(v!==null&&(v=v.dehydrated,v===null||$s(v)||wa(v)))return f}else if(f.tag===19&&f.memoizedProps.revealOrder!==void 0){if(f.flags&128)return f}else if(f.child!==null){f.child.return=f,f=f.child;continue}if(f===c)break;for(;f.sibling===null;){if(f.return===null||f.return===c)return null;f=f.return}f.sibling.return=f.return,f=f.sibling}return null}var u0=[];function d0(){for(var c=0;cv?v:4,c(!0);var C=f0.transition;f0.transition={};try{c(!1),f()}finally{Nt=v,f0.transition=C}}function rC(){return uo().memoizedState}function V7(c,f,v){var C=Oa(c);if(v={lane:C,action:v,hasEagerState:!1,eagerState:null,next:null},oC(c))sC(f,v);else if(v=P2(c,f,v,C),v!==null){var k=ir();fo(v,c,C,k),aC(v,f,C)}}function W7(c,f,v){var C=Oa(c),k={lane:C,action:v,hasEagerState:!1,eagerState:null,next:null};if(oC(c))sC(f,k);else{var P=c.alternate;if(c.lanes===0&&(P===null||P.lanes===0)&&(P=f.lastRenderedReducer,P!==null))try{var z=f.lastRenderedState,ne=P(z,v);if(k.hasEagerState=!0,k.eagerState=ne,Ro(ne,z)){var pe=f.interleaved;pe===null?(k.next=k,o0(f)):(k.next=pe.next,pe.next=k),f.interleaved=k;return}}catch{}finally{}v=P2(c,f,k,C),v!==null&&(k=ir(),fo(v,c,C,k),aC(v,f,C))}}function oC(c){var f=c.alternate;return c===xn||f!==null&&f===xn}function sC(c,f){iu=wf=!0;var v=c.pending;v===null?f.next=f:(f.next=v.next,v.next=f),c.pending=f}function aC(c,f,v){if(v&4194240){var C=f.lanes;C&=c.pendingLanes,v|=C,f.lanes=v,Wg(c,v)}}var jf={readContext:lo,useCallback:or,useContext:or,useEffect:or,useImperativeHandle:or,useInsertionEffect:or,useLayoutEffect:or,useMemo:or,useReducer:or,useRef:or,useState:or,useDebugValue:or,useDeferredValue:or,useTransition:or,useMutableSource:or,useSyncExternalStore:or,useId:or,unstable_isNewReconciler:!1},U7={readContext:lo,useCallback:function(c,f){return cs().memoizedState=[c,f===void 0?null:f],c},useContext:lo,useEffect:X2,useImperativeHandle:function(c,f,v){return v=v!=null?v.concat([c]):null,Sf(4194308,4,Z2.bind(null,f,c),v)},useLayoutEffect:function(c,f){return Sf(4194308,4,c,f)},useInsertionEffect:function(c,f){return Sf(4,2,c,f)},useMemo:function(c,f){var v=cs();return f=f===void 0?null:f,c=c(),v.memoizedState=[c,f],c},useReducer:function(c,f,v){var C=cs();return f=v!==void 0?v(f):f,C.memoizedState=C.baseState=f,c={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:c,lastRenderedState:f},C.queue=c,c=c.dispatch=V7.bind(null,xn,c),[C.memoizedState,c]},useRef:function(c){var f=cs();return c={current:c},f.memoizedState=c},useState:K2,useDebugValue:b0,useDeferredValue:function(c){return cs().memoizedState=c},useTransition:function(){var c=K2(!1),f=c[0];return c=H7.bind(null,c[1]),cs().memoizedState=c,[f,c]},useMutableSource:function(){},useSyncExternalStore:function(c,f,v){var C=xn,k=cs();if(ln){if(v===void 0)throw Error(i(407));v=v()}else{if(v=f(),qn===null)throw Error(i(349));xi&30||H2(C,f,v)}k.memoizedState=v;var P={value:v,getSnapshot:f};return k.queue=P,X2(W2.bind(null,C,P,c),[c]),C.flags|=2048,uu(9,V2.bind(null,C,P,v,f),void 0,null),v},useId:function(){var c=cs(),f=qn.identifierPrefix;if(ln){var v=Bs,C=Fs;v=(C&~(1<<32-Oo(C)-1)).toString(32)+v,f=":"+f+"R"+v,v=lu++,0")&&(pe=pe.replace("",c.displayName)),pe}while(1<=z&&0<=ne);break}}}finally{Jc=!1,Error.prepareStackTrace=v}return(c=c?c.displayName||c.name:"")?hi(c):""}var Bg=Object.prototype.hasOwnProperty,_a=[],rt=-1;function Mt(c){return{current:c}}function kt(c){0>rt||(c.current=_a[rt],_a[rt]=null,rt--)}function Ot(c,f){rt++,_a[rt]=c.current,c.current=f}var rr={},rn=Mt(rr),An=Mt(!1),gr=rr;function vl(c,f){var v=c.type.contextTypes;if(!v)return rr;var C=c.stateNode;if(C&&C.__reactInternalMemoizedUnmaskedChildContext===f)return C.__reactInternalMemoizedMaskedChildContext;var k={},P;for(P in v)k[P]=f[P];return C&&(c=c.stateNode,c.__reactInternalMemoizedUnmaskedChildContext=f,c.__reactInternalMemoizedMaskedChildContext=k),k}function jr(c){return c=c.childContextTypes,c!=null}function nf(){kt(An),kt(rn)}function h2(c,f,v){if(rn.current!==rr)throw Error(i(168));Ot(rn,f),Ot(An,v)}function g2(c,f,v){var C=c.stateNode;if(f=f.childContextTypes,typeof C.getChildContext!="function")return v;C=C.getChildContext();for(var k in C)if(!(k in f))throw Error(i(108,D(c)||"Unknown",k));return s({},v,C)}function rf(c){return c=(c=c.stateNode)&&c.__reactInternalMemoizedMergedChildContext||rr,gr=rn.current,Ot(rn,c),Ot(An,An.current),!0}function v2(c,f,v){var C=c.stateNode;if(!C)throw Error(i(169));v?(c=g2(c,f,gr),C.__reactInternalMemoizedMergedChildContext=c,kt(An),kt(rn),Ot(rn,c)):kt(An),Ot(An,v)}var Oo=Math.clz32?Math.clz32:P7,_7=Math.log,I7=Math.LN2;function P7(c){return c>>>=0,c===0?32:31-(_7(c)/I7|0)|0}var of=64,sf=4194304;function tu(c){switch(c&-c){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 c&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return c&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return c}}function af(c,f){var v=c.pendingLanes;if(v===0)return 0;var C=0,k=c.suspendedLanes,P=c.pingedLanes,z=v&268435455;if(z!==0){var ne=z&~k;ne!==0?C=tu(ne):(P&=z,P!==0&&(C=tu(P)))}else z=v&~k,z!==0?C=tu(z):P!==0&&(C=tu(P));if(C===0)return 0;if(f!==0&&f!==C&&!(f&k)&&(k=C&-C,P=f&-f,k>=P||k===16&&(P&4194240)!==0))return f;if(C&4&&(C|=v&16),f=c.entangledLanes,f!==0)for(c=c.entanglements,f&=C;0v;v++)f.push(c);return f}function nu(c,f,v){c.pendingLanes|=f,f!==536870912&&(c.suspendedLanes=0,c.pingedLanes=0),c=c.eventTimes,f=31-Oo(f),c[f]=v}function O7(c,f){var v=c.pendingLanes&~f;c.pendingLanes=f,c.suspendedLanes=0,c.pingedLanes=0,c.expiredLanes&=f,c.mutableReadLanes&=f,c.entangledLanes&=f,f=c.entanglements;var C=c.eventTimes;for(c=c.expirationTimes;0>=z,k-=z,Fs=1<<32-Oo(f)+k|v<$t?(Xn=xt,xt=null):Xn=xt.sibling;var Lt=We(ue,xt,me[$t],Ue);if(Lt===null){xt===null&&(xt=Xn);break}c&&xt&&Lt.alternate===null&&f(ue,xt),oe=P(Lt,oe,$t),Ct===null?it=Lt:Ct.sibling=Lt,Ct=Lt,xt=Xn}if($t===me.length)return v(ue,xt),cn&&vi(ue,$t),it;if(xt===null){for(;$t$t?(Xn=xt,xt=null):Xn=xt.sibling;var Aa=We(ue,xt,Lt.value,Ue);if(Aa===null){xt===null&&(xt=Xn);break}c&&xt&&Aa.alternate===null&&f(ue,xt),oe=P(Aa,oe,$t),Ct===null?it=Aa:Ct.sibling=Aa,Ct=Aa,xt=Xn}if(Lt.done)return v(ue,xt),cn&&vi(ue,$t),it;if(xt===null){for(;!Lt.done;$t++,Lt=me.next())Lt=vt(ue,Lt.value,Ue),Lt!==null&&(oe=P(Lt,oe,$t),Ct===null?it=Lt:Ct.sibling=Lt,Ct=Lt);return cn&&vi(ue,$t),it}for(xt=C(ue,xt);!Lt.done;$t++,Lt=me.next())Lt=sn(xt,ue,$t,Lt.value,Ue),Lt!==null&&(c&&Lt.alternate!==null&&xt.delete(Lt.key===null?$t:Lt.key),oe=P(Lt,oe,$t),Ct===null?it=Lt:Ct.sibling=Lt,Ct=Lt);return c&&xt.forEach(function(gR){return f(ue,gR)}),cn&&vi(ue,$t),it}function Us(ue,oe,me,Ue){if(typeof me=="object"&&me!==null&&me.type===m&&me.key===null&&(me=me.props.children),typeof me=="object"&&me!==null){switch(me.$$typeof){case u:e:{for(var it=me.key,Ct=oe;Ct!==null;){if(Ct.key===it){if(it=me.type,it===m){if(Ct.tag===7){v(ue,Ct.sibling),oe=k(Ct,me.props.children),oe.return=ue,ue=oe;break e}}else if(Ct.elementType===it||typeof it=="object"&&it!==null&&it.$$typeof===_&&N2(it)===Ct.type){v(ue,Ct.sibling),oe=k(Ct,me.props),oe.ref=ou(ue,Ct,me),oe.return=ue,ue=oe;break e}v(ue,Ct);break}else f(ue,Ct);Ct=Ct.sibling}me.type===m?(oe=ki(me.props.children,ue.mode,Ue,me.key),oe.return=ue,ue=oe):(Ue=Uf(me.type,me.key,me.props,null,ue.mode,Ue),Ue.ref=ou(ue,oe,me),Ue.return=ue,ue=Ue)}return z(ue);case p:e:{for(Ct=me.key;oe!==null;){if(oe.key===Ct)if(oe.tag===4&&oe.stateNode.containerInfo===me.containerInfo&&oe.stateNode.implementation===me.implementation){v(ue,oe.sibling),oe=k(oe,me.children||[]),oe.return=ue,ue=oe;break e}else{v(ue,oe);break}else f(ue,oe);oe=oe.sibling}oe=X0(me,ue.mode,Ue),oe.return=ue,ue=oe}return z(ue);case _:return Ct=me._init,Us(ue,oe,Ct(me._payload),Ue)}if(U(me))return Zt(ue,oe,me,Ue);if(M(me))return Er(ue,oe,me,Ue);bf(ue,me)}return typeof me=="string"&&me!==""||typeof me=="number"?(me=""+me,oe!==null&&oe.tag===6?(v(ue,oe.sibling),oe=k(oe,me),oe.return=ue,ue=oe):(v(ue,oe),oe=q0(me,ue.mode,Ue),oe.return=ue,ue=oe),z(ue)):v(ue,oe)}return Us}var Sl=$2(!0),L2=$2(!1),su={},co=Mt(su),au=Mt(su),kl=Mt(su);function ls(c){if(c===su)throw Error(i(174));return c}function l0(c,f){Ot(kl,f),Ot(au,c),Ot(co,su),c=$(f),kt(co),Ot(co,c)}function jl(){kt(co),kt(au),kt(kl)}function z2(c){var f=ls(kl.current),v=ls(co.current);f=q(v,c.type,f),v!==f&&(Ot(au,c),Ot(co,f))}function c0(c){au.current===c&&(kt(co),kt(au))}var vn=Mt(0);function yf(c){for(var f=c;f!==null;){if(f.tag===13){var v=f.memoizedState;if(v!==null&&(v=v.dehydrated,v===null||$s(v)||wa(v)))return f}else if(f.tag===19&&f.memoizedProps.revealOrder!==void 0){if(f.flags&128)return f}else if(f.child!==null){f.child.return=f,f=f.child;continue}if(f===c)break;for(;f.sibling===null;){if(f.return===null||f.return===c)return null;f=f.return}f.sibling.return=f.return,f=f.sibling}return null}var u0=[];function d0(){for(var c=0;cv?v:4,c(!0);var C=f0.transition;f0.transition={};try{c(!1),f()}finally{Nt=v,f0.transition=C}}function rC(){return uo().memoizedState}function V7(c,f,v){var C=Oa(c);if(v={lane:C,action:v,hasEagerState:!1,eagerState:null,next:null},oC(c))sC(f,v);else if(v=P2(c,f,v,C),v!==null){var k=ir();fo(v,c,C,k),aC(v,f,C)}}function W7(c,f,v){var C=Oa(c),k={lane:C,action:v,hasEagerState:!1,eagerState:null,next:null};if(oC(c))sC(f,k);else{var P=c.alternate;if(c.lanes===0&&(P===null||P.lanes===0)&&(P=f.lastRenderedReducer,P!==null))try{var z=f.lastRenderedState,ne=P(z,v);if(k.hasEagerState=!0,k.eagerState=ne,Ro(ne,z)){var pe=f.interleaved;pe===null?(k.next=k,o0(f)):(k.next=pe.next,pe.next=k),f.interleaved=k;return}}catch{}finally{}v=P2(c,f,k,C),v!==null&&(k=ir(),fo(v,c,C,k),aC(v,f,C))}}function oC(c){var f=c.alternate;return c===xn||f!==null&&f===xn}function sC(c,f){iu=wf=!0;var v=c.pending;v===null?f.next=f:(f.next=v.next,v.next=f),c.pending=f}function aC(c,f,v){if(v&4194240){var C=f.lanes;C&=c.pendingLanes,v|=C,f.lanes=v,Wg(c,v)}}var jf={readContext:lo,useCallback:or,useContext:or,useEffect:or,useImperativeHandle:or,useInsertionEffect:or,useLayoutEffect:or,useMemo:or,useReducer:or,useRef:or,useState:or,useDebugValue:or,useDeferredValue:or,useTransition:or,useMutableSource:or,useSyncExternalStore:or,useId:or,unstable_isNewReconciler:!1},U7={readContext:lo,useCallback:function(c,f){return cs().memoizedState=[c,f===void 0?null:f],c},useContext:lo,useEffect:X2,useImperativeHandle:function(c,f,v){return v=v!=null?v.concat([c]):null,Sf(4194308,4,Z2.bind(null,f,c),v)},useLayoutEffect:function(c,f){return Sf(4194308,4,c,f)},useInsertionEffect:function(c,f){return Sf(4,2,c,f)},useMemo:function(c,f){var v=cs();return f=f===void 0?null:f,c=c(),v.memoizedState=[c,f],c},useReducer:function(c,f,v){var C=cs();return f=v!==void 0?v(f):f,C.memoizedState=C.baseState=f,c={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:c,lastRenderedState:f},C.queue=c,c=c.dispatch=V7.bind(null,xn,c),[C.memoizedState,c]},useRef:function(c){var f=cs();return c={current:c},f.memoizedState=c},useState:K2,useDebugValue:b0,useDeferredValue:function(c){return cs().memoizedState=c},useTransition:function(){var c=K2(!1),f=c[0];return c=H7.bind(null,c[1]),cs().memoizedState=c,[f,c]},useMutableSource:function(){},useSyncExternalStore:function(c,f,v){var C=xn,k=cs();if(cn){if(v===void 0)throw Error(i(407));v=v()}else{if(v=f(),qn===null)throw Error(i(349));bi&30||H2(C,f,v)}k.memoizedState=v;var P={value:v,getSnapshot:f};return k.queue=P,X2(W2.bind(null,C,P,c),[c]),C.flags|=2048,uu(9,V2.bind(null,C,P,v,f),void 0,null),v},useId:function(){var c=cs(),f=qn.identifierPrefix;if(cn){var v=Bs,C=Fs;v=(C&~(1<<32-Oo(C)-1)).toString(32)+v,f=":"+f+"R"+v,v=lu++,0F0&&(f.flags|=128,C=!0,pu(k,!1),f.lanes=4194304)}else{if(!C)if(c=yf(P),c!==null){if(f.flags|=128,C=!0,c=c.updateQueue,c!==null&&(f.updateQueue=c,f.flags|=4),pu(k,!0),k.tail===null&&k.tailMode==="hidden"&&!P.alternate&&!ln)return sr(f),null}else 2*Gn()-k.renderingStartTime>F0&&v!==1073741824&&(f.flags|=128,C=!0,pu(k,!1),f.lanes=4194304);k.isBackwards?(P.sibling=f.child,f.child=P):(c=k.last,c!==null?c.sibling=P:f.child=P,k.last=P)}return k.tail!==null?(f=k.tail,k.rendering=f,k.tail=f.sibling,k.renderingStartTime=Gn(),f.sibling=null,c=vn.current,Ot(vn,C?c&1|2:c&1),f):(sr(f),null);case 22:case 23:return U0(),v=f.memoizedState!==null,c!==null&&c.memoizedState!==null!==v&&(f.flags|=8192),v&&f.mode&1?Gr&1073741824&&(sr(f),de&&f.subtreeFlags&6&&(f.flags|=8192)):sr(f),null;case 24:return null;case 25:return null}throw Error(i(156,f.tag))}function J7(c,f){switch(Qg(f),f.tag){case 1:return jr(f.type)&&nf(),c=f.flags,c&65536?(f.flags=c&-65537|128,f):null;case 3:return jl(),kt(Dn),kt(rn),d0(),c=f.flags,c&65536&&!(c&128)?(f.flags=c&-65537|128,f):null;case 5:return c0(f),null;case 13:if(kt(vn),c=f.memoizedState,c!==null&&c.dehydrated!==null){if(f.alternate===null)throw Error(i(340));yl()}return c=f.flags,c&65536?(f.flags=c&-65537|128,f):null;case 19:return kt(vn),null;case 4:return jl(),null;case 10:return n0(f.type._context),null;case 22:case 23:return U0(),null;case 24:return null;default:return null}}var Mf=!1,ar=!1,eR=typeof WeakSet=="function"?WeakSet:Set,Ke=null;function Il(c,f){var v=c.ref;if(v!==null)if(typeof v=="function")try{v(null)}catch(C){cn(c,f,C)}else v.current=null}function P0(c,f,v){try{v()}catch(C){cn(c,f,C)}}var jC=!1;function tR(c,f){for(F(c.containerInfo),Ke=f;Ke!==null;)if(c=Ke,f=c.child,(c.subtreeFlags&1028)!==0&&f!==null)f.return=c,Ke=f;else for(;Ke!==null;){c=Ke;try{var v=c.alternate;if(c.flags&1024)switch(c.tag){case 0:case 11:case 15:break;case 1:if(v!==null){var C=v.memoizedProps,k=v.memoizedState,P=c.stateNode,z=P.getSnapshotBeforeUpdate(c.elementType===c.type?C:Ao(c.type,C),k);P.__reactInternalSnapshotBeforeUpdate=z}break;case 3:de&&At(c.stateNode.containerInfo);break;case 5:case 6:case 4:case 17:break;default:throw Error(i(163))}}catch(ne){cn(c,c.return,ne)}if(f=c.sibling,f!==null){f.return=c.return,Ke=f;break}Ke=c.return}return v=jC,jC=!1,v}function mu(c,f,v){var C=f.updateQueue;if(C=C!==null?C.lastEffect:null,C!==null){var k=C=C.next;do{if((k.tag&c)===c){var P=k.destroy;k.destroy=void 0,P!==void 0&&P0(f,v,P)}k=k.next}while(k!==C)}}function Of(c,f){if(f=f.updateQueue,f=f!==null?f.lastEffect:null,f!==null){var v=f=f.next;do{if((v.tag&c)===c){var C=v.create;v.destroy=C()}v=v.next}while(v!==f)}}function E0(c){var f=c.ref;if(f!==null){var v=c.stateNode;switch(c.tag){case 5:c=N(v);break;default:c=v}typeof f=="function"?f(c):f.current=c}}function _C(c){var f=c.alternate;f!==null&&(c.alternate=null,_C(f)),c.child=null,c.deletions=null,c.sibling=null,c.tag===5&&(f=c.stateNode,f!==null&&_e(f)),c.stateNode=null,c.return=null,c.dependencies=null,c.memoizedProps=null,c.memoizedState=null,c.pendingProps=null,c.stateNode=null,c.updateQueue=null}function IC(c){return c.tag===5||c.tag===3||c.tag===4}function PC(c){e:for(;;){for(;c.sibling===null;){if(c.return===null||IC(c.return))return null;c=c.return}for(c.sibling.return=c.return,c=c.sibling;c.tag!==5&&c.tag!==6&&c.tag!==18;){if(c.flags&2||c.child===null||c.tag===4)continue e;c.child.return=c,c=c.child}if(!(c.flags&2))return c.stateNode}}function M0(c,f,v){var C=c.tag;if(C===5||C===6)c=c.stateNode,f?Ut(v,c,f):Je(v,c);else if(C!==4&&(c=c.child,c!==null))for(M0(c,f,v),c=c.sibling;c!==null;)M0(c,f,v),c=c.sibling}function O0(c,f,v){var C=c.tag;if(C===5||C===6)c=c.stateNode,f?Le(v,c,f):be(v,c);else if(C!==4&&(c=c.child,c!==null))for(O0(c,f,v),c=c.sibling;c!==null;)O0(c,f,v),c=c.sibling}var er=null,To=!1;function ds(c,f,v){for(v=v.child;v!==null;)R0(c,f,v),v=v.sibling}function R0(c,f,v){if(ss&&typeof ss.onCommitFiberUnmount=="function")try{ss.onCommitFiberUnmount(lf,v)}catch{}switch(v.tag){case 5:ar||Il(v,f);case 6:if(de){var C=er,k=To;er=null,ds(c,f,v),er=C,To=k,er!==null&&(To?Be(er,v.stateNode):Se(er,v.stateNode))}else ds(c,f,v);break;case 18:de&&er!==null&&(To?Fn(er,v.stateNode):Fg(er,v.stateNode));break;case 4:de?(C=er,k=To,er=v.stateNode.containerInfo,To=!0,ds(c,f,v),er=C,To=k):(ge&&(C=v.stateNode.containerInfo,k=Ln(C),an(C,k)),ds(c,f,v));break;case 0:case 11:case 14:case 15:if(!ar&&(C=v.updateQueue,C!==null&&(C=C.lastEffect,C!==null))){k=C=C.next;do{var P=k,z=P.destroy;P=P.tag,z!==void 0&&(P&2||P&4)&&P0(v,f,z),k=k.next}while(k!==C)}ds(c,f,v);break;case 1:if(!ar&&(Il(v,f),C=v.stateNode,typeof C.componentWillUnmount=="function"))try{C.props=v.memoizedProps,C.state=v.memoizedState,C.componentWillUnmount()}catch(ne){cn(v,f,ne)}ds(c,f,v);break;case 21:ds(c,f,v);break;case 22:v.mode&1?(ar=(C=ar)||v.memoizedState!==null,ds(c,f,v),ar=C):ds(c,f,v);break;default:ds(c,f,v)}}function EC(c){var f=c.updateQueue;if(f!==null){c.updateQueue=null;var v=c.stateNode;v===null&&(v=c.stateNode=new eR),f.forEach(function(C){var k=uR.bind(null,c,C);v.has(C)||(v.add(C),C.then(k,k))})}}function No(c,f){var v=f.deletions;if(v!==null)for(var C=0;C";case Df:return":has("+(T0(c)||"")+")";case Af:return'[role="'+c.value+'"]';case Nf:return'"'+c.value+'"';case Tf:return'[data-testname="'+c.value+'"]';default:throw Error(i(365))}}function TC(c,f){var v=[];c=[c,0];for(var C=0;Ck&&(k=z),C&=~P}if(C=k,C=Gn()-C,C=(120>C?120:480>C?480:1080>C?1080:1920>C?1920:3e3>C?3e3:4320>C?4320:1960*rR(C/1960))-C,10c?16:c,Ma===null)var C=!1;else{if(c=Ma,Ma=null,Bf=0,jt&6)throw Error(i(331));var k=jt;for(jt|=4,Ke=c.current;Ke!==null;){var P=Ke,z=P.child;if(Ke.flags&16){var ne=P.deletions;if(ne!==null){for(var pe=0;peGn()-z0?yi(c,0):L0|=v),Pr(c,f)}function WC(c,f){f===0&&(c.mode&1?(f=sf,sf<<=1,!(sf&130023424)&&(sf=4194304)):f=1);var v=ir();c=is(c,f),c!==null&&(nu(c,f,v),Pr(c,v))}function cR(c){var f=c.memoizedState,v=0;f!==null&&(v=f.retryLane),WC(c,v)}function uR(c,f){var v=0;switch(c.tag){case 13:var C=c.stateNode,k=c.memoizedState;k!==null&&(v=k.retryLane);break;case 19:C=c.stateNode;break;default:throw Error(i(314))}C!==null&&C.delete(f),WC(c,v)}var UC;UC=function(c,f,v){if(c!==null)if(c.memoizedProps!==f.pendingProps||Dn.current)_r=!0;else{if(!(c.lanes&v)&&!(f.flags&128))return _r=!1,Y7(c,f,v);_r=!!(c.flags&131072)}else _r=!1,ln&&f.flags&1048576&&w2(f,df,f.index);switch(f.lanes=0,f.tag){case 2:var C=f.type;If(c,f),c=f.pendingProps;var k=vl(f,rn.current);wl(f,v),k=m0(null,f,C,c,k,v);var P=h0();return f.flags|=1,typeof k=="object"&&k!==null&&typeof k.render=="function"&&k.$$typeof===void 0?(f.tag=1,f.memoizedState=null,f.updateQueue=null,jr(C)?(P=!0,rf(f)):P=!1,f.memoizedState=k.state!==null&&k.state!==void 0?k.state:null,s0(f),k.updater=xf,f.stateNode=k,k._reactInternals=f,i0(f,C,c,v),f=S0(null,f,C,!0,P,v)):(f.tag=0,ln&&P&&Xg(f),vr(null,f,k,v),f=f.child),f;case 16:C=f.elementType;e:{switch(If(c,f),c=f.pendingProps,k=C._init,C=k(C._payload),f.type=C,k=f.tag=fR(C),c=Ao(C,c),k){case 0:f=w0(null,f,C,c,v);break e;case 1:f=vC(null,f,C,c,v);break e;case 11:f=fC(null,f,C,c,v);break e;case 14:f=pC(null,f,C,Ao(C.type,c),v);break e}throw Error(i(306,C,""))}return f;case 0:return C=f.type,k=f.pendingProps,k=f.elementType===C?k:Ao(C,k),w0(c,f,C,k,v);case 1:return C=f.type,k=f.pendingProps,k=f.elementType===C?k:Ao(C,k),vC(c,f,C,k,v);case 3:e:{if(xC(f),c===null)throw Error(i(387));C=f.pendingProps,P=f.memoizedState,k=P.element,E2(c,f),vf(f,C,null,v);var z=f.memoizedState;if(C=z.element,Ce&&P.isDehydrated)if(P={element:C,isDehydrated:!1,cache:z.cache,pendingSuspenseBoundaries:z.pendingSuspenseBoundaries,transitions:z.transitions},f.updateQueue.baseState=P,f.memoizedState=P,f.flags&256){k=_l(Error(i(423)),f),f=bC(c,f,C,v,k);break e}else if(C!==k){k=_l(Error(i(424)),f),f=bC(c,f,C,v,k);break e}else for(Ce&&(io=Qe(f.stateNode.containerInfo),Ur=f,ln=!0,Do=null,ru=!1),v=L2(f,null,C,v),f.child=v;v;)v.flags=v.flags&-3|4096,v=v.sibling;else{if(yl(),C===k){f=Vs(c,f,v);break e}vr(c,f,C,v)}f=f.child}return f;case 5:return z2(f),c===null&&Zg(f),C=f.type,k=f.pendingProps,P=c!==null?c.memoizedProps:null,z=k.children,G(C,k)?z=null:P!==null&&G(C,P)&&(f.flags|=32),gC(c,f),vr(c,f,z,v),f.child;case 6:return c===null&&Zg(f),null;case 13:return yC(c,f,v);case 4:return l0(f,f.stateNode.containerInfo),C=f.pendingProps,c===null?f.child=Sl(f,null,C,v):vr(c,f,C,v),f.child;case 11:return C=f.type,k=f.pendingProps,k=f.elementType===C?k:Ao(C,k),fC(c,f,C,k,v);case 7:return vr(c,f,f.pendingProps,v),f.child;case 8:return vr(c,f,f.pendingProps.children,v),f.child;case 12:return vr(c,f,f.pendingProps.children,v),f.child;case 10:e:{if(C=f.type._context,k=f.pendingProps,P=f.memoizedProps,z=k.value,I2(f,C,z),P!==null)if(Ro(P.value,z)){if(P.children===k.children&&!Dn.current){f=Vs(c,f,v);break e}}else for(P=f.child,P!==null&&(P.return=f);P!==null;){var ne=P.dependencies;if(ne!==null){z=P.child;for(var pe=ne.firstContext;pe!==null;){if(pe.context===C){if(P.tag===1){pe=Hs(-1,v&-v),pe.tag=2;var Ee=P.updateQueue;if(Ee!==null){Ee=Ee.shared;var qe=Ee.pending;qe===null?pe.next=pe:(pe.next=qe.next,qe.next=pe),Ee.pending=pe}}P.lanes|=v,pe=P.alternate,pe!==null&&(pe.lanes|=v),r0(P.return,v,f),ne.lanes|=v;break}pe=pe.next}}else if(P.tag===10)z=P.type===f.type?null:P.child;else if(P.tag===18){if(z=P.return,z===null)throw Error(i(341));z.lanes|=v,ne=z.alternate,ne!==null&&(ne.lanes|=v),r0(z,v,f),z=P.sibling}else z=P.child;if(z!==null)z.return=P;else for(z=P;z!==null;){if(z===f){z=null;break}if(P=z.sibling,P!==null){P.return=z.return,z=P;break}z=z.return}P=z}vr(c,f,k.children,v),f=f.child}return f;case 9:return k=f.type,C=f.pendingProps.children,wl(f,v),k=lo(k),C=C(k),f.flags|=1,vr(c,f,C,v),f.child;case 14:return C=f.type,k=Ao(C,f.pendingProps),k=Ao(C.type,k),pC(c,f,C,k,v);case 15:return mC(c,f,f.type,f.pendingProps,v);case 17:return C=f.type,k=f.pendingProps,k=f.elementType===C?k:Ao(C,k),If(c,f),f.tag=1,jr(C)?(c=!0,rf(f)):c=!1,wl(f,v),A2(f,C,k),i0(f,C,k,v),S0(null,f,C,!0,c,v);case 19:return wC(c,f,v);case 22:return hC(c,f,v)}throw Error(i(156,f.tag))};function GC(c,f){return Ug(c,f)}function dR(c,f,v,C){this.tag=c,this.key=v,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=C,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function po(c,f,v,C){return new dR(c,f,v,C)}function K0(c){return c=c.prototype,!(!c||!c.isReactComponent)}function fR(c){if(typeof c=="function")return K0(c)?1:0;if(c!=null){if(c=c.$$typeof,c===b)return 11;if(c===j)return 14}return 2}function Da(c,f){var v=c.alternate;return v===null?(v=po(c.tag,f,c.key,c.mode),v.elementType=c.elementType,v.type=c.type,v.stateNode=c.stateNode,v.alternate=c,c.alternate=v):(v.pendingProps=f,v.type=c.type,v.flags=0,v.subtreeFlags=0,v.deletions=null),v.flags=c.flags&14680064,v.childLanes=c.childLanes,v.lanes=c.lanes,v.child=c.child,v.memoizedProps=c.memoizedProps,v.memoizedState=c.memoizedState,v.updateQueue=c.updateQueue,f=c.dependencies,v.dependencies=f===null?null:{lanes:f.lanes,firstContext:f.firstContext},v.sibling=c.sibling,v.index=c.index,v.ref=c.ref,v}function Uf(c,f,v,C,k,P){var z=2;if(C=c,typeof c=="function")K0(c)&&(z=1);else if(typeof c=="string")z=5;else e:switch(c){case m:return Si(v.children,k,P,f);case h:z=8,k|=8;break;case g:return c=po(12,v,f,k|2),c.elementType=g,c.lanes=P,c;case w:return c=po(13,v,f,k),c.elementType=w,c.lanes=P,c;case S:return c=po(19,v,f,k),c.elementType=S,c.lanes=P,c;case E:return Gf(v,k,P,f);default:if(typeof c=="object"&&c!==null)switch(c.$$typeof){case x:z=10;break e;case y:z=9;break e;case b:z=11;break e;case j:z=14;break e;case _:z=16,C=null;break e}throw Error(i(130,c==null?c:typeof c,""))}return f=po(z,v,f,k),f.elementType=c,f.type=C,f.lanes=P,f}function Si(c,f,v,C){return c=po(7,c,C,f),c.lanes=v,c}function Gf(c,f,v,C){return c=po(22,c,C,f),c.elementType=E,c.lanes=v,c.stateNode={isHidden:!1},c}function q0(c,f,v){return c=po(6,c,null,f),c.lanes=v,c}function X0(c,f,v){return f=po(4,c.children!==null?c.children:[],c.key,f),f.lanes=v,f.stateNode={containerInfo:c.containerInfo,pendingChildren:null,implementation:c.implementation},f}function pR(c,f,v,C,k){this.tag=f,this.containerInfo=c,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=J,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Vg(0),this.expirationTimes=Vg(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Vg(0),this.identifierPrefix=C,this.onRecoverableError=k,Ce&&(this.mutableSourceEagerHydrationData=null)}function KC(c,f,v,C,k,P,z,ne,pe){return c=new pR(c,f,v,ne,pe),f===1?(f=1,P===!0&&(f|=8)):f=0,P=po(3,null,null,f),c.current=P,P.stateNode=c,P.memoizedState={element:C,isDehydrated:v,cache:null,transitions:null,pendingSuspenseBoundaries:null},s0(P),c}function qC(c){if(!c)return rr;c=c._reactInternals;e:{if(A(c)!==c||c.tag!==1)throw Error(i(170));var f=c;do{switch(f.tag){case 3:f=f.stateNode.context;break e;case 1:if(jr(f.type)){f=f.stateNode.__reactInternalMemoizedMergedChildContext;break e}}f=f.return}while(f!==null);throw Error(i(171))}if(c.tag===1){var v=c.type;if(jr(v))return g2(c,v,f)}return f}function XC(c){var f=c._reactInternals;if(f===void 0)throw typeof c.render=="function"?Error(i(188)):(c=Object.keys(c).join(","),Error(i(268,c)));return c=X(f),c===null?null:c.stateNode}function QC(c,f){if(c=c.memoizedState,c!==null&&c.dehydrated!==null){var v=c.retryLane;c.retryLane=v!==0&&v=Ee&&P>=vt&&k<=qe&&z<=We){c.splice(f,1);break}else if(C!==Ee||v.width!==pe.width||Wez){if(!(P!==vt||v.height!==pe.height||qek)){Ee>C&&(pe.width+=Ee-C,pe.x=C),qeP&&(pe.height+=vt-P,pe.y=P),Wev&&(v=z)),zF0&&(f.flags|=128,C=!0,pu(k,!1),f.lanes=4194304)}else{if(!C)if(c=yf(P),c!==null){if(f.flags|=128,C=!0,c=c.updateQueue,c!==null&&(f.updateQueue=c,f.flags|=4),pu(k,!0),k.tail===null&&k.tailMode==="hidden"&&!P.alternate&&!cn)return sr(f),null}else 2*Gn()-k.renderingStartTime>F0&&v!==1073741824&&(f.flags|=128,C=!0,pu(k,!1),f.lanes=4194304);k.isBackwards?(P.sibling=f.child,f.child=P):(c=k.last,c!==null?c.sibling=P:f.child=P,k.last=P)}return k.tail!==null?(f=k.tail,k.rendering=f,k.tail=f.sibling,k.renderingStartTime=Gn(),f.sibling=null,c=vn.current,Ot(vn,C?c&1|2:c&1),f):(sr(f),null);case 22:case 23:return U0(),v=f.memoizedState!==null,c!==null&&c.memoizedState!==null!==v&&(f.flags|=8192),v&&f.mode&1?Gr&1073741824&&(sr(f),de&&f.subtreeFlags&6&&(f.flags|=8192)):sr(f),null;case 24:return null;case 25:return null}throw Error(i(156,f.tag))}function J7(c,f){switch(Qg(f),f.tag){case 1:return jr(f.type)&&nf(),c=f.flags,c&65536?(f.flags=c&-65537|128,f):null;case 3:return jl(),kt(An),kt(rn),d0(),c=f.flags,c&65536&&!(c&128)?(f.flags=c&-65537|128,f):null;case 5:return c0(f),null;case 13:if(kt(vn),c=f.memoizedState,c!==null&&c.dehydrated!==null){if(f.alternate===null)throw Error(i(340));yl()}return c=f.flags,c&65536?(f.flags=c&-65537|128,f):null;case 19:return kt(vn),null;case 4:return jl(),null;case 10:return n0(f.type._context),null;case 22:case 23:return U0(),null;case 24:return null;default:return null}}var Mf=!1,ar=!1,eR=typeof WeakSet=="function"?WeakSet:Set,Ke=null;function Il(c,f){var v=c.ref;if(v!==null)if(typeof v=="function")try{v(null)}catch(C){un(c,f,C)}else v.current=null}function P0(c,f,v){try{v()}catch(C){un(c,f,C)}}var jC=!1;function tR(c,f){for(F(c.containerInfo),Ke=f;Ke!==null;)if(c=Ke,f=c.child,(c.subtreeFlags&1028)!==0&&f!==null)f.return=c,Ke=f;else for(;Ke!==null;){c=Ke;try{var v=c.alternate;if(c.flags&1024)switch(c.tag){case 0:case 11:case 15:break;case 1:if(v!==null){var C=v.memoizedProps,k=v.memoizedState,P=c.stateNode,z=P.getSnapshotBeforeUpdate(c.elementType===c.type?C:Ao(c.type,C),k);P.__reactInternalSnapshotBeforeUpdate=z}break;case 3:de&&At(c.stateNode.containerInfo);break;case 5:case 6:case 4:case 17:break;default:throw Error(i(163))}}catch(ne){un(c,c.return,ne)}if(f=c.sibling,f!==null){f.return=c.return,Ke=f;break}Ke=c.return}return v=jC,jC=!1,v}function mu(c,f,v){var C=f.updateQueue;if(C=C!==null?C.lastEffect:null,C!==null){var k=C=C.next;do{if((k.tag&c)===c){var P=k.destroy;k.destroy=void 0,P!==void 0&&P0(f,v,P)}k=k.next}while(k!==C)}}function Of(c,f){if(f=f.updateQueue,f=f!==null?f.lastEffect:null,f!==null){var v=f=f.next;do{if((v.tag&c)===c){var C=v.create;v.destroy=C()}v=v.next}while(v!==f)}}function E0(c){var f=c.ref;if(f!==null){var v=c.stateNode;switch(c.tag){case 5:c=N(v);break;default:c=v}typeof f=="function"?f(c):f.current=c}}function _C(c){var f=c.alternate;f!==null&&(c.alternate=null,_C(f)),c.child=null,c.deletions=null,c.sibling=null,c.tag===5&&(f=c.stateNode,f!==null&&_e(f)),c.stateNode=null,c.return=null,c.dependencies=null,c.memoizedProps=null,c.memoizedState=null,c.pendingProps=null,c.stateNode=null,c.updateQueue=null}function IC(c){return c.tag===5||c.tag===3||c.tag===4}function PC(c){e:for(;;){for(;c.sibling===null;){if(c.return===null||IC(c.return))return null;c=c.return}for(c.sibling.return=c.return,c=c.sibling;c.tag!==5&&c.tag!==6&&c.tag!==18;){if(c.flags&2||c.child===null||c.tag===4)continue e;c.child.return=c,c=c.child}if(!(c.flags&2))return c.stateNode}}function M0(c,f,v){var C=c.tag;if(C===5||C===6)c=c.stateNode,f?Ut(v,c,f):Je(v,c);else if(C!==4&&(c=c.child,c!==null))for(M0(c,f,v),c=c.sibling;c!==null;)M0(c,f,v),c=c.sibling}function O0(c,f,v){var C=c.tag;if(C===5||C===6)c=c.stateNode,f?Le(v,c,f):be(v,c);else if(C!==4&&(c=c.child,c!==null))for(O0(c,f,v),c=c.sibling;c!==null;)O0(c,f,v),c=c.sibling}var er=null,To=!1;function ds(c,f,v){for(v=v.child;v!==null;)R0(c,f,v),v=v.sibling}function R0(c,f,v){if(ss&&typeof ss.onCommitFiberUnmount=="function")try{ss.onCommitFiberUnmount(lf,v)}catch{}switch(v.tag){case 5:ar||Il(v,f);case 6:if(de){var C=er,k=To;er=null,ds(c,f,v),er=C,To=k,er!==null&&(To?Be(er,v.stateNode):ke(er,v.stateNode))}else ds(c,f,v);break;case 18:de&&er!==null&&(To?Fn(er,v.stateNode):Fg(er,v.stateNode));break;case 4:de?(C=er,k=To,er=v.stateNode.containerInfo,To=!0,ds(c,f,v),er=C,To=k):(ge&&(C=v.stateNode.containerInfo,k=Ln(C),ln(C,k)),ds(c,f,v));break;case 0:case 11:case 14:case 15:if(!ar&&(C=v.updateQueue,C!==null&&(C=C.lastEffect,C!==null))){k=C=C.next;do{var P=k,z=P.destroy;P=P.tag,z!==void 0&&(P&2||P&4)&&P0(v,f,z),k=k.next}while(k!==C)}ds(c,f,v);break;case 1:if(!ar&&(Il(v,f),C=v.stateNode,typeof C.componentWillUnmount=="function"))try{C.props=v.memoizedProps,C.state=v.memoizedState,C.componentWillUnmount()}catch(ne){un(v,f,ne)}ds(c,f,v);break;case 21:ds(c,f,v);break;case 22:v.mode&1?(ar=(C=ar)||v.memoizedState!==null,ds(c,f,v),ar=C):ds(c,f,v);break;default:ds(c,f,v)}}function EC(c){var f=c.updateQueue;if(f!==null){c.updateQueue=null;var v=c.stateNode;v===null&&(v=c.stateNode=new eR),f.forEach(function(C){var k=uR.bind(null,c,C);v.has(C)||(v.add(C),C.then(k,k))})}}function No(c,f){var v=f.deletions;if(v!==null)for(var C=0;C";case Df:return":has("+(T0(c)||"")+")";case Af:return'[role="'+c.value+'"]';case Nf:return'"'+c.value+'"';case Tf:return'[data-testname="'+c.value+'"]';default:throw Error(i(365))}}function TC(c,f){var v=[];c=[c,0];for(var C=0;Ck&&(k=z),C&=~P}if(C=k,C=Gn()-C,C=(120>C?120:480>C?480:1080>C?1080:1920>C?1920:3e3>C?3e3:4320>C?4320:1960*rR(C/1960))-C,10c?16:c,Ma===null)var C=!1;else{if(c=Ma,Ma=null,Bf=0,jt&6)throw Error(i(331));var k=jt;for(jt|=4,Ke=c.current;Ke!==null;){var P=Ke,z=P.child;if(Ke.flags&16){var ne=P.deletions;if(ne!==null){for(var pe=0;peGn()-z0?Ci(c,0):L0|=v),Pr(c,f)}function WC(c,f){f===0&&(c.mode&1?(f=sf,sf<<=1,!(sf&130023424)&&(sf=4194304)):f=1);var v=ir();c=is(c,f),c!==null&&(nu(c,f,v),Pr(c,v))}function cR(c){var f=c.memoizedState,v=0;f!==null&&(v=f.retryLane),WC(c,v)}function uR(c,f){var v=0;switch(c.tag){case 13:var C=c.stateNode,k=c.memoizedState;k!==null&&(v=k.retryLane);break;case 19:C=c.stateNode;break;default:throw Error(i(314))}C!==null&&C.delete(f),WC(c,v)}var UC;UC=function(c,f,v){if(c!==null)if(c.memoizedProps!==f.pendingProps||An.current)_r=!0;else{if(!(c.lanes&v)&&!(f.flags&128))return _r=!1,Y7(c,f,v);_r=!!(c.flags&131072)}else _r=!1,cn&&f.flags&1048576&&w2(f,df,f.index);switch(f.lanes=0,f.tag){case 2:var C=f.type;If(c,f),c=f.pendingProps;var k=vl(f,rn.current);wl(f,v),k=m0(null,f,C,c,k,v);var P=h0();return f.flags|=1,typeof k=="object"&&k!==null&&typeof k.render=="function"&&k.$$typeof===void 0?(f.tag=1,f.memoizedState=null,f.updateQueue=null,jr(C)?(P=!0,rf(f)):P=!1,f.memoizedState=k.state!==null&&k.state!==void 0?k.state:null,s0(f),k.updater=xf,f.stateNode=k,k._reactInternals=f,i0(f,C,c,v),f=S0(null,f,C,!0,P,v)):(f.tag=0,cn&&P&&Xg(f),vr(null,f,k,v),f=f.child),f;case 16:C=f.elementType;e:{switch(If(c,f),c=f.pendingProps,k=C._init,C=k(C._payload),f.type=C,k=f.tag=fR(C),c=Ao(C,c),k){case 0:f=w0(null,f,C,c,v);break e;case 1:f=vC(null,f,C,c,v);break e;case 11:f=fC(null,f,C,c,v);break e;case 14:f=pC(null,f,C,Ao(C.type,c),v);break e}throw Error(i(306,C,""))}return f;case 0:return C=f.type,k=f.pendingProps,k=f.elementType===C?k:Ao(C,k),w0(c,f,C,k,v);case 1:return C=f.type,k=f.pendingProps,k=f.elementType===C?k:Ao(C,k),vC(c,f,C,k,v);case 3:e:{if(xC(f),c===null)throw Error(i(387));C=f.pendingProps,P=f.memoizedState,k=P.element,E2(c,f),vf(f,C,null,v);var z=f.memoizedState;if(C=z.element,Ce&&P.isDehydrated)if(P={element:C,isDehydrated:!1,cache:z.cache,pendingSuspenseBoundaries:z.pendingSuspenseBoundaries,transitions:z.transitions},f.updateQueue.baseState=P,f.memoizedState=P,f.flags&256){k=_l(Error(i(423)),f),f=bC(c,f,C,v,k);break e}else if(C!==k){k=_l(Error(i(424)),f),f=bC(c,f,C,v,k);break e}else for(Ce&&(io=Qe(f.stateNode.containerInfo),Ur=f,cn=!0,Do=null,ru=!1),v=L2(f,null,C,v),f.child=v;v;)v.flags=v.flags&-3|4096,v=v.sibling;else{if(yl(),C===k){f=Vs(c,f,v);break e}vr(c,f,C,v)}f=f.child}return f;case 5:return z2(f),c===null&&Zg(f),C=f.type,k=f.pendingProps,P=c!==null?c.memoizedProps:null,z=k.children,G(C,k)?z=null:P!==null&&G(C,P)&&(f.flags|=32),gC(c,f),vr(c,f,z,v),f.child;case 6:return c===null&&Zg(f),null;case 13:return yC(c,f,v);case 4:return l0(f,f.stateNode.containerInfo),C=f.pendingProps,c===null?f.child=Sl(f,null,C,v):vr(c,f,C,v),f.child;case 11:return C=f.type,k=f.pendingProps,k=f.elementType===C?k:Ao(C,k),fC(c,f,C,k,v);case 7:return vr(c,f,f.pendingProps,v),f.child;case 8:return vr(c,f,f.pendingProps.children,v),f.child;case 12:return vr(c,f,f.pendingProps.children,v),f.child;case 10:e:{if(C=f.type._context,k=f.pendingProps,P=f.memoizedProps,z=k.value,I2(f,C,z),P!==null)if(Ro(P.value,z)){if(P.children===k.children&&!An.current){f=Vs(c,f,v);break e}}else for(P=f.child,P!==null&&(P.return=f);P!==null;){var ne=P.dependencies;if(ne!==null){z=P.child;for(var pe=ne.firstContext;pe!==null;){if(pe.context===C){if(P.tag===1){pe=Hs(-1,v&-v),pe.tag=2;var Ee=P.updateQueue;if(Ee!==null){Ee=Ee.shared;var qe=Ee.pending;qe===null?pe.next=pe:(pe.next=qe.next,qe.next=pe),Ee.pending=pe}}P.lanes|=v,pe=P.alternate,pe!==null&&(pe.lanes|=v),r0(P.return,v,f),ne.lanes|=v;break}pe=pe.next}}else if(P.tag===10)z=P.type===f.type?null:P.child;else if(P.tag===18){if(z=P.return,z===null)throw Error(i(341));z.lanes|=v,ne=z.alternate,ne!==null&&(ne.lanes|=v),r0(z,v,f),z=P.sibling}else z=P.child;if(z!==null)z.return=P;else for(z=P;z!==null;){if(z===f){z=null;break}if(P=z.sibling,P!==null){P.return=z.return,z=P;break}z=z.return}P=z}vr(c,f,k.children,v),f=f.child}return f;case 9:return k=f.type,C=f.pendingProps.children,wl(f,v),k=lo(k),C=C(k),f.flags|=1,vr(c,f,C,v),f.child;case 14:return C=f.type,k=Ao(C,f.pendingProps),k=Ao(C.type,k),pC(c,f,C,k,v);case 15:return mC(c,f,f.type,f.pendingProps,v);case 17:return C=f.type,k=f.pendingProps,k=f.elementType===C?k:Ao(C,k),If(c,f),f.tag=1,jr(C)?(c=!0,rf(f)):c=!1,wl(f,v),A2(f,C,k),i0(f,C,k,v),S0(null,f,C,!0,c,v);case 19:return wC(c,f,v);case 22:return hC(c,f,v)}throw Error(i(156,f.tag))};function GC(c,f){return Ug(c,f)}function dR(c,f,v,C){this.tag=c,this.key=v,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=C,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function po(c,f,v,C){return new dR(c,f,v,C)}function K0(c){return c=c.prototype,!(!c||!c.isReactComponent)}function fR(c){if(typeof c=="function")return K0(c)?1:0;if(c!=null){if(c=c.$$typeof,c===b)return 11;if(c===j)return 14}return 2}function Da(c,f){var v=c.alternate;return v===null?(v=po(c.tag,f,c.key,c.mode),v.elementType=c.elementType,v.type=c.type,v.stateNode=c.stateNode,v.alternate=c,c.alternate=v):(v.pendingProps=f,v.type=c.type,v.flags=0,v.subtreeFlags=0,v.deletions=null),v.flags=c.flags&14680064,v.childLanes=c.childLanes,v.lanes=c.lanes,v.child=c.child,v.memoizedProps=c.memoizedProps,v.memoizedState=c.memoizedState,v.updateQueue=c.updateQueue,f=c.dependencies,v.dependencies=f===null?null:{lanes:f.lanes,firstContext:f.firstContext},v.sibling=c.sibling,v.index=c.index,v.ref=c.ref,v}function Uf(c,f,v,C,k,P){var z=2;if(C=c,typeof c=="function")K0(c)&&(z=1);else if(typeof c=="string")z=5;else e:switch(c){case m:return ki(v.children,k,P,f);case h:z=8,k|=8;break;case g:return c=po(12,v,f,k|2),c.elementType=g,c.lanes=P,c;case w:return c=po(13,v,f,k),c.elementType=w,c.lanes=P,c;case S:return c=po(19,v,f,k),c.elementType=S,c.lanes=P,c;case E:return Gf(v,k,P,f);default:if(typeof c=="object"&&c!==null)switch(c.$$typeof){case x:z=10;break e;case y:z=9;break e;case b:z=11;break e;case j:z=14;break e;case _:z=16,C=null;break e}throw Error(i(130,c==null?c:typeof c,""))}return f=po(z,v,f,k),f.elementType=c,f.type=C,f.lanes=P,f}function ki(c,f,v,C){return c=po(7,c,C,f),c.lanes=v,c}function Gf(c,f,v,C){return c=po(22,c,C,f),c.elementType=E,c.lanes=v,c.stateNode={isHidden:!1},c}function q0(c,f,v){return c=po(6,c,null,f),c.lanes=v,c}function X0(c,f,v){return f=po(4,c.children!==null?c.children:[],c.key,f),f.lanes=v,f.stateNode={containerInfo:c.containerInfo,pendingChildren:null,implementation:c.implementation},f}function pR(c,f,v,C,k){this.tag=f,this.containerInfo=c,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=J,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Vg(0),this.expirationTimes=Vg(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Vg(0),this.identifierPrefix=C,this.onRecoverableError=k,Ce&&(this.mutableSourceEagerHydrationData=null)}function KC(c,f,v,C,k,P,z,ne,pe){return c=new pR(c,f,v,ne,pe),f===1?(f=1,P===!0&&(f|=8)):f=0,P=po(3,null,null,f),c.current=P,P.stateNode=c,P.memoizedState={element:C,isDehydrated:v,cache:null,transitions:null,pendingSuspenseBoundaries:null},s0(P),c}function qC(c){if(!c)return rr;c=c._reactInternals;e:{if(A(c)!==c||c.tag!==1)throw Error(i(170));var f=c;do{switch(f.tag){case 3:f=f.stateNode.context;break e;case 1:if(jr(f.type)){f=f.stateNode.__reactInternalMemoizedMergedChildContext;break e}}f=f.return}while(f!==null);throw Error(i(171))}if(c.tag===1){var v=c.type;if(jr(v))return g2(c,v,f)}return f}function XC(c){var f=c._reactInternals;if(f===void 0)throw typeof c.render=="function"?Error(i(188)):(c=Object.keys(c).join(","),Error(i(268,c)));return c=X(f),c===null?null:c.stateNode}function QC(c,f){if(c=c.memoizedState,c!==null&&c.dehydrated!==null){var v=c.retryLane;c.retryLane=v!==0&&v=Ee&&P>=vt&&k<=qe&&z<=We){c.splice(f,1);break}else if(C!==Ee||v.width!==pe.width||Wez){if(!(P!==vt||v.height!==pe.height||qek)){Ee>C&&(pe.width+=Ee-C,pe.x=C),qeP&&(pe.height+=vt-P,pe.y=P),Wev&&(v=z)),z ")+` No matching component was found for: - `)+c.join(" > ")}return null},n.getPublicRootInstance=function(c){if(c=c.current,!c.child)return null;switch(c.child.tag){case 5:return N(c.child.stateNode);default:return c.child.stateNode}},n.injectIntoDevTools=function(c){if(c={bundleType:c.bundleType,version:c.version,rendererPackageName:c.rendererPackageName,rendererConfig:c.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:l.ReactCurrentDispatcher,findHostInstanceByFiber:mR,findFiberByHostInstance:c.findFiberByHostInstance||hR,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.2.0"},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u")c=!1;else{var f=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(f.isDisabled||!f.supportsFiber)c=!0;else{try{lf=f.inject(c),ss=f}catch{}c=!!f.checkDCE}}return c},n.isAlreadyRendering=function(){return!1},n.observeVisibleRects=function(c,f,v,C){if(!$e)throw Error(i(363));c=N0(c,f);var k=bt(c,v,C).disconnect;return{disconnect:function(){k()}}},n.registerMutableSourceForHydration=function(c,f){var v=f._getVersion;v=v(f._source),c.mutableSourceEagerHydrationData==null?c.mutableSourceEagerHydrationData=[f,v]:c.mutableSourceEagerHydrationData.push(f,v)},n.runWithPriority=function(c,f){var v=Nt;try{return Nt=c,f()}finally{Nt=v}},n.shouldError=function(){return null},n.shouldSuspend=function(){return!1},n.updateContainer=function(c,f,v,C){var k=f.current,P=ir(),z=Oa(k);return v=qC(v),f.context===null?f.context=v:f.pendingContext=v,f=Hs(P,z),f.payload={element:c},C=C===void 0?null:C,C!==null&&(f.callback=C),c=Pa(k,f,z),c!==null&&(fo(c,k,z,P),gf(c,k,z)),z},n};p7.exports=hge;var gge=p7.exports;const vge=xd(gge);var m7={exports:{}},pl={};/** + `)+c.join(" > ")}return null},n.getPublicRootInstance=function(c){if(c=c.current,!c.child)return null;switch(c.child.tag){case 5:return N(c.child.stateNode);default:return c.child.stateNode}},n.injectIntoDevTools=function(c){if(c={bundleType:c.bundleType,version:c.version,rendererPackageName:c.rendererPackageName,rendererConfig:c.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:l.ReactCurrentDispatcher,findHostInstanceByFiber:mR,findFiberByHostInstance:c.findFiberByHostInstance||hR,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.2.0"},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u")c=!1;else{var f=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(f.isDisabled||!f.supportsFiber)c=!0;else{try{lf=f.inject(c),ss=f}catch{}c=!!f.checkDCE}}return c},n.isAlreadyRendering=function(){return!1},n.observeVisibleRects=function(c,f,v,C){if(!$e)throw Error(i(363));c=N0(c,f);var k=bt(c,v,C).disconnect;return{disconnect:function(){k()}}},n.registerMutableSourceForHydration=function(c,f){var v=f._getVersion;v=v(f._source),c.mutableSourceEagerHydrationData==null?c.mutableSourceEagerHydrationData=[f,v]:c.mutableSourceEagerHydrationData.push(f,v)},n.runWithPriority=function(c,f){var v=Nt;try{return Nt=c,f()}finally{Nt=v}},n.shouldError=function(){return null},n.shouldSuspend=function(){return!1},n.updateContainer=function(c,f,v,C){var k=f.current,P=ir(),z=Oa(k);return v=qC(v),f.context===null?f.context=v:f.pendingContext=v,f=Hs(P,z),f.payload={element:c},C=C===void 0?null:C,C!==null&&(f.callback=C),c=Pa(k,f,z),c!==null&&(fo(c,k,z,P),gf(c,k,z)),z},n};p7.exports=wge;var Sge=p7.exports;const kge=xd(Sge);var m7={exports:{}},pl={};/** * @license React * react-reconciler-constants.production.min.js * @@ -79,14 +79,14 @@ No matching component was found for: * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */pl.ConcurrentRoot=1;pl.ContinuousEventPriority=4;pl.DefaultEventPriority=16;pl.DiscreteEventPriority=1;pl.IdleEventPriority=536870912;pl.LegacyRoot=0;m7.exports=pl;var h7=m7.exports;const D_={children:!0,ref:!0,key:!0,style:!0,forwardedRef:!0,unstable_applyCache:!0,unstable_applyDrawHitFromCache:!0};let A_=!1,T_=!1;const f2=".react-konva-event",xge=`ReactKonva: You have a Konva node with draggable = true and position defined but no onDragMove or onDragEnd events are handled. + */pl.ConcurrentRoot=1;pl.ContinuousEventPriority=4;pl.DefaultEventPriority=16;pl.DiscreteEventPriority=1;pl.IdleEventPriority=536870912;pl.LegacyRoot=0;m7.exports=pl;var h7=m7.exports;const D_={children:!0,ref:!0,key:!0,style:!0,forwardedRef:!0,unstable_applyCache:!0,unstable_applyDrawHitFromCache:!0};let A_=!1,T_=!1;const f2=".react-konva-event",jge=`ReactKonva: You have a Konva node with draggable = true and position defined but no onDragMove or onDragEnd events are handled. Position of a node will be changed during drag&drop, so you should update state of the react app as well. Consider to add onDragMove or onDragEnd events. For more info see: https://github.com/konvajs/react-konva/issues/256 -`,bge=`ReactKonva: You are using "zIndex" attribute for a Konva node. +`,_ge=`ReactKonva: You are using "zIndex" attribute for a Konva node. react-konva may get confused with ordering. Just define correct order of elements in your render function of a component. For more info see: https://github.com/konvajs/react-konva/issues/194 -`,yge={};function Lg(e,t,n=yge){if(!A_&&"zIndex"in t&&(console.warn(bge),A_=!0),!T_&&t.draggable){var r=t.x!==void 0||t.y!==void 0,o=t.onDragEnd||t.onDragMove;r&&!o&&(console.warn(xge),T_=!0)}for(var s in n)if(!D_[s]){var i=s.slice(0,2)==="on",l=n[s]!==t[s];if(i&&l){var u=s.substr(2).toLowerCase();u.substr(0,7)==="content"&&(u="content"+u.substr(7,1).toUpperCase()+u.substr(8)),e.off(u,n[s])}var p=!t.hasOwnProperty(s);p&&e.setAttr(s,void 0)}var m=t._useStrictMode,h={},g=!1;const x={};for(var s in t)if(!D_[s]){var i=s.slice(0,2)==="on",y=n[s]!==t[s];if(i&&y){var u=s.substr(2).toLowerCase();u.substr(0,7)==="content"&&(u="content"+u.substr(7,1).toUpperCase()+u.substr(8)),t[s]&&(x[u]=t[s])}!i&&(t[s]!==n[s]||m&&t[s]!==e.getAttr(s))&&(g=!0,h[s]=t[s])}g&&(e.setAttrs(h),pi(e));for(var u in x)e.on(u+f2,x[u])}function pi(e){if(!NN.Konva.autoDrawEnabled){var t=e.getLayer()||e.getStage();t&&t.batchDraw()}}const g7={},Cge={};gd.Node.prototype._applyProps=Lg;function wge(e,t){if(typeof t=="string"){console.error(`Do not use plain text as child of Konva.Node. You are using text: ${t}`);return}e.add(t),pi(e)}function Sge(e,t,n){let r=gd[e];r||(console.error(`Konva has no node with the type ${e}. Group will be used instead. If you use minimal version of react-konva, just import required nodes into Konva: "import "konva/lib/shapes/${e}" If you want to render DOM elements as part of canvas tree take a look into this demo: https://konvajs.github.io/docs/react/DOM_Portal.html`),r=gd.Group);const o={},s={};for(var i in t){var l=i.slice(0,2)==="on";l?s[i]=t[i]:o[i]=t[i]}const u=new r(o);return Lg(u,s),u}function kge(e,t,n){console.error(`Text components are not supported for now in ReactKonva. Your text is: "${e}"`)}function jge(e,t,n){return!1}function _ge(e){return e}function Ige(){return null}function Pge(){return null}function Ege(e,t,n,r){return Cge}function Mge(){}function Oge(e){}function Rge(e,t){return!1}function Dge(){return g7}function Age(){return g7}const Tge=setTimeout,Nge=clearTimeout,$ge=-1;function Lge(e,t){return!1}const zge=!1,Fge=!0,Bge=!0;function Hge(e,t){t.parent===e?t.moveToTop():e.add(t),pi(e)}function Vge(e,t){t.parent===e?t.moveToTop():e.add(t),pi(e)}function v7(e,t,n){t._remove(),e.add(t),t.setZIndex(n.getZIndex()),pi(e)}function Wge(e,t,n){v7(e,t,n)}function Uge(e,t){t.destroy(),t.off(f2),pi(e)}function Gge(e,t){t.destroy(),t.off(f2),pi(e)}function Kge(e,t,n){console.error(`Text components are not yet supported in ReactKonva. You text is: "${n}"`)}function qge(e,t,n){}function Xge(e,t,n,r,o){Lg(e,o,r)}function Qge(e){e.hide(),pi(e)}function Yge(e){}function Zge(e,t){(t.visible==null||t.visible)&&e.show()}function Jge(e,t){}function e0e(e){}function t0e(){}const n0e=()=>h7.DefaultEventPriority,r0e=Object.freeze(Object.defineProperty({__proto__:null,appendChild:Hge,appendChildToContainer:Vge,appendInitialChild:wge,cancelTimeout:Nge,clearContainer:e0e,commitMount:qge,commitTextUpdate:Kge,commitUpdate:Xge,createInstance:Sge,createTextInstance:kge,detachDeletedInstance:t0e,finalizeInitialChildren:jge,getChildHostContext:Age,getCurrentEventPriority:n0e,getPublicInstance:_ge,getRootHostContext:Dge,hideInstance:Qge,hideTextInstance:Yge,idlePriority:Tp.unstable_IdlePriority,insertBefore:v7,insertInContainerBefore:Wge,isPrimaryRenderer:zge,noTimeout:$ge,now:Tp.unstable_now,prepareForCommit:Ige,preparePortalMount:Pge,prepareUpdate:Ege,removeChild:Uge,removeChildFromContainer:Gge,resetAfterCommit:Mge,resetTextContent:Oge,run:Tp.unstable_runWithPriority,scheduleTimeout:Tge,shouldDeprioritizeSubtree:Rge,shouldSetTextContent:Lge,supportsMutation:Bge,unhideInstance:Zge,unhideTextInstance:Jge,warnsIfNotActing:Fge},Symbol.toStringTag,{value:"Module"}));var o0e=Object.defineProperty,s0e=Object.defineProperties,a0e=Object.getOwnPropertyDescriptors,N_=Object.getOwnPropertySymbols,i0e=Object.prototype.hasOwnProperty,l0e=Object.prototype.propertyIsEnumerable,$_=(e,t,n)=>t in e?o0e(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,L_=(e,t)=>{for(var n in t||(t={}))i0e.call(t,n)&&$_(e,n,t[n]);if(N_)for(var n of N_(t))l0e.call(t,n)&&$_(e,n,t[n]);return e},c0e=(e,t)=>s0e(e,a0e(t));function x7(e,t,n){if(!e)return;if(n(e)===!0)return e;let r=t?e.return:e.child;for(;r;){const o=x7(r,t,n);if(o)return o;r=t?null:r.sibling}}function b7(e){try{return Object.defineProperties(e,{_currentRenderer:{get(){return null},set(){}},_currentRenderer2:{get(){return null},set(){}}})}catch{return e}}const p2=b7(d.createContext(null));class y7 extends d.Component{render(){return d.createElement(p2.Provider,{value:this._reactInternals},this.props.children)}}const{ReactCurrentOwner:z_,ReactCurrentDispatcher:F_}=d.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function u0e(){const e=d.useContext(p2);if(e===null)throw new Error("its-fine: useFiber must be called within a !");const t=d.useId();return d.useMemo(()=>{for(const r of[z_==null?void 0:z_.current,e,e==null?void 0:e.alternate]){if(!r)continue;const o=x7(r,!1,s=>{let i=s.memoizedState;for(;i;){if(i.memoizedState===t)return!0;i=i.next}});if(o)return o}},[e,t])}function d0e(){var e,t;const n=u0e(),[r]=d.useState(()=>new Map);r.clear();let o=n;for(;o;){const s=(e=o.type)==null?void 0:e._context;s&&s!==p2&&!r.has(s)&&r.set(s,(t=F_==null?void 0:F_.current)==null?void 0:t.readContext(b7(s))),o=o.return}return r}function f0e(){const e=d0e();return d.useMemo(()=>Array.from(e.keys()).reduce((t,n)=>r=>d.createElement(t,null,d.createElement(n.Provider,c0e(L_({},r),{value:e.get(n)}))),t=>d.createElement(y7,L_({},t))),[e])}function p0e(e){const t=H.useRef({});return H.useLayoutEffect(()=>{t.current=e}),H.useLayoutEffect(()=>()=>{t.current={}},[]),t.current}const m0e=e=>{const t=H.useRef(),n=H.useRef(),r=H.useRef(),o=p0e(e),s=f0e(),i=l=>{const{forwardedRef:u}=e;u&&(typeof u=="function"?u(l):u.current=l)};return H.useLayoutEffect(()=>(n.current=new gd.Stage({width:e.width,height:e.height,container:t.current}),i(n.current),r.current=Tu.createContainer(n.current,h7.LegacyRoot,!1,null),Tu.updateContainer(H.createElement(s,{},e.children),r.current),()=>{gd.isBrowser&&(i(null),Tu.updateContainer(null,r.current,null),n.current.destroy())}),[]),H.useLayoutEffect(()=>{i(n.current),Lg(n.current,e,o),Tu.updateContainer(H.createElement(s,{},e.children),r.current,null)}),H.createElement("div",{ref:t,id:e.id,accessKey:e.accessKey,className:e.className,role:e.role,style:e.style,tabIndex:e.tabIndex,title:e.title})},Eu="Layer",Ms="Group",Os="Rect",ki="Circle",fh="Line",C7="Image",h0e="Text",g0e="Transformer",Tu=vge(r0e);Tu.injectIntoDevTools({findHostInstanceByFiber:()=>null,bundleType:0,version:H.version,rendererPackageName:"react-konva"});const v0e=H.forwardRef((e,t)=>H.createElement(y7,{},H.createElement(m0e,{...e,forwardedRef:t}))),x0e=ce([Sn,Eo],(e,t)=>{const{tool:n,isMovingBoundingBox:r}=e;return{tool:n,isStaging:t,isMovingBoundingBox:r}},{memoizeOptions:{resultEqualityCheck:Ft}}),b0e=()=>{const e=te(),{tool:t,isStaging:n,isMovingBoundingBox:r}=W(x0e);return{handleDragStart:d.useCallback(()=>{(t==="move"||n)&&!r&&e(tm(!0))},[e,r,n,t]),handleDragMove:d.useCallback(o=>{if(!((t==="move"||n)&&!r))return;const s={x:o.target.x(),y:o.target.y()};e(WI(s))},[e,r,n,t]),handleDragEnd:d.useCallback(()=>{(t==="move"||n)&&!r&&e(tm(!1))},[e,r,n,t])}},y0e=ce([Sn,Jn,Eo],(e,t,n)=>{const{cursorPosition:r,shouldLockBoundingBox:o,shouldShowBoundingBox:s,tool:i,isMaskEnabled:l,shouldSnapToGrid:u}=e;return{activeTabName:t,isCursorOnCanvas:!!r,shouldLockBoundingBox:o,shouldShowBoundingBox:s,tool:i,isStaging:n,isMaskEnabled:l,shouldSnapToGrid:u}},{memoizeOptions:{resultEqualityCheck:Ft}}),C0e=()=>{const e=te(),{activeTabName:t,shouldShowBoundingBox:n,tool:r,isStaging:o,isMaskEnabled:s,shouldSnapToGrid:i}=W(y0e),l=d.useRef(null),u=UI(),p=()=>e(GI());et(["shift+c"],()=>{p()},{enabled:()=>!o,preventDefault:!0},[]);const m=()=>e(ib(!s));et(["h"],()=>{m()},{enabled:()=>!o,preventDefault:!0},[s]),et(["n"],()=>{e(nm(!i))},{enabled:!0,preventDefault:!0},[i]),et("esc",()=>{e($N())},{enabled:()=>!0,preventDefault:!0}),et("shift+h",()=>{e(LN(!n))},{enabled:()=>!o,preventDefault:!0},[t,n]),et(["space"],h=>{h.repeat||(u==null||u.container().focus(),r!=="move"&&(l.current=r,e(oc("move"))),r==="move"&&l.current&&l.current!=="move"&&(e(oc(l.current)),l.current="move"))},{keyup:!0,keydown:!0,preventDefault:!0},[r,l])},m2=e=>{const t=e.getPointerPosition(),n=e.getAbsoluteTransform().copy();if(!t||!n)return;const r=n.invert().point(t);return{x:r.x,y:r.y}},w7=()=>{const e=te(),t=v1(),n=UI();return{updateColorUnderCursor:()=>{if(!n||!t)return;const r=n.getPointerPosition();if(!r)return;const o=zN.pixelRatio,[s,i,l,u]=t.getContext().getImageData(r.x*o,r.y*o,1,1).data;u&&s&&i&&l&&e(FN({r:s,g:i,b:l,a:u}))},commitColorUnderCursor:()=>{e(BN())}}},w0e=ce([Jn,Sn,Eo],(e,t,n)=>{const{tool:r}=t;return{tool:r,activeTabName:e,isStaging:n}},{memoizeOptions:{resultEqualityCheck:Ft}}),S0e=e=>{const t=te(),{tool:n,isStaging:r}=W(w0e),{commitColorUnderCursor:o}=w7();return d.useCallback(s=>{if(!e.current)return;if(e.current.container().focus(),n==="move"||r){t(tm(!0));return}if(n==="colorPicker"){o();return}const i=m2(e.current);i&&(s.evt.preventDefault(),t(KI(!0)),t(HN([i.x,i.y])))},[e,n,r,t,o])},k0e=ce([Jn,Sn,Eo],(e,t,n)=>{const{tool:r,isDrawing:o}=t;return{tool:r,isDrawing:o,activeTabName:e,isStaging:n}},{memoizeOptions:{resultEqualityCheck:Ft}}),j0e=(e,t,n)=>{const r=te(),{isDrawing:o,tool:s,isStaging:i}=W(k0e),{updateColorUnderCursor:l}=w7();return d.useCallback(()=>{if(!e.current)return;const u=m2(e.current);if(u){if(r(VN(u)),n.current=u,s==="colorPicker"){l();return}!o||s==="move"||i||(t.current=!0,r(qI([u.x,u.y])))}},[t,r,o,i,n,e,s,l])},_0e=()=>{const e=te();return d.useCallback(()=>{e(WN())},[e])},I0e=ce([Jn,Sn,Eo],(e,t,n)=>{const{tool:r,isDrawing:o}=t;return{tool:r,isDrawing:o,activeTabName:e,isStaging:n}},{memoizeOptions:{resultEqualityCheck:Ft}}),P0e=(e,t)=>{const n=te(),{tool:r,isDrawing:o,isStaging:s}=W(I0e);return d.useCallback(()=>{if(r==="move"||s){n(tm(!1));return}if(!t.current&&o&&e.current){const i=m2(e.current);if(!i)return;n(qI([i.x,i.y]))}else t.current=!1;n(KI(!1))},[t,n,o,s,e,r])},E0e=ce([Sn],e=>{const{isMoveStageKeyHeld:t,stageScale:n}=e;return{isMoveStageKeyHeld:t,stageScale:n}},{memoizeOptions:{resultEqualityCheck:Ft}}),M0e=e=>{const t=te(),{isMoveStageKeyHeld:n,stageScale:r}=W(E0e);return d.useCallback(o=>{if(!e.current||n)return;o.evt.preventDefault();const s=e.current.getPointerPosition();if(!s)return;const i={x:(s.x-e.current.x())/r,y:(s.y-e.current.y())/r};let l=o.evt.deltaY;o.evt.ctrlKey&&(l=-l);const u=Fi(r*KN**l,GN,UN),p={x:s.x-i.x*u,y:s.y-i.y*u};t(qN(u)),t(WI(p))},[e,n,r,t])},O0e=ce(Sn,e=>{const{boundingBoxCoordinates:t,boundingBoxDimensions:n,stageDimensions:r,stageScale:o,shouldDarkenOutsideBoundingBox:s,stageCoordinates:i}=e;return{boundingBoxCoordinates:t,boundingBoxDimensions:n,shouldDarkenOutsideBoundingBox:s,stageCoordinates:i,stageDimensions:r,stageScale:o}},{memoizeOptions:{resultEqualityCheck:Ft}}),R0e=()=>{const{boundingBoxCoordinates:e,boundingBoxDimensions:t,shouldDarkenOutsideBoundingBox:n,stageCoordinates:r,stageDimensions:o,stageScale:s}=W(O0e);return a.jsxs(Ms,{children:[a.jsx(Os,{offsetX:r.x/s,offsetY:r.y/s,height:o.height/s,width:o.width/s,fill:"rgba(0,0,0,0.4)",listening:!1,visible:n}),a.jsx(Os,{x:e.x,y:e.y,width:t.width,height:t.height,fill:"rgb(255,255,255)",listening:!1,visible:n,globalCompositeOperation:"destination-out"})]})},D0e=d.memo(R0e),A0e=ce([Sn],e=>{const{stageScale:t,stageCoordinates:n,stageDimensions:r}=e;return{stageScale:t,stageCoordinates:n,stageDimensions:r}},{memoizeOptions:{resultEqualityCheck:Ft}}),T0e=()=>{const{stageScale:e,stageCoordinates:t,stageDimensions:n}=W(A0e),{colorMode:r}=ha(),[o,s]=d.useState([]),[i,l]=Ho("colors",["base.800","base.200"]),u=d.useCallback(p=>p/e,[e]);return d.useLayoutEffect(()=>{const{width:p,height:m}=n,{x:h,y:g}=t,x={x1:0,y1:0,x2:p,y2:m,offset:{x:u(h),y:u(g)}},y={x:Math.ceil(u(h)/64)*64,y:Math.ceil(u(g)/64)*64},b={x1:-y.x,y1:-y.y,x2:u(p)-y.x+64,y2:u(m)-y.y+64},S={x1:Math.min(x.x1,b.x1),y1:Math.min(x.y1,b.y1),x2:Math.max(x.x2,b.x2),y2:Math.max(x.y2,b.y2)},j=S.x2-S.x1,_=S.y2-S.y1,E=Math.round(j/64)+1,I=Math.round(_/64)+1,M=zw(0,E).map(D=>a.jsx(fh,{x:S.x1+D*64,y:S.y1,points:[0,0,0,_],stroke:r==="dark"?i:l,strokeWidth:1},`x_${D}`)),R=zw(0,I).map(D=>a.jsx(fh,{x:S.x1,y:S.y1+D*64,points:[0,0,j,0],stroke:r==="dark"?i:l,strokeWidth:1},`y_${D}`));s(M.concat(R))},[e,t,n,u,r,i,l]),a.jsx(Ms,{children:o})},N0e=d.memo(T0e),$0e=ce([xe],({system:e,canvas:t})=>{const{denoiseProgress:n}=e,{boundingBox:r}=t.layerState.stagingArea,{batchIds:o}=t;return{boundingBox:r,progressImage:n&&o.includes(n.batch_id)?n.progress_image:void 0}},{memoizeOptions:{resultEqualityCheck:Ft}}),L0e=e=>{const{...t}=e,{progressImage:n,boundingBox:r}=W($0e),[o,s]=d.useState(null);return d.useEffect(()=>{if(!n)return;const i=new Image;i.onload=()=>{s(i)},i.src=n.dataURL},[n]),n&&r&&o?a.jsx(C7,{x:r.x,y:r.y,width:r.width,height:r.height,image:o,listening:!1,...t}):null},z0e=d.memo(L0e),zi=e=>{const{r:t,g:n,b:r,a:o}=e;return`rgba(${t}, ${n}, ${r}, ${o})`},F0e=ce(Sn,e=>{const{maskColor:t,stageCoordinates:n,stageDimensions:r,stageScale:o}=e;return{stageCoordinates:n,stageDimensions:r,stageScale:o,maskColorString:zi(t)}}),B_=e=>`data:image/svg+xml;utf8, +`,Ige={};function Lg(e,t,n=Ige){if(!A_&&"zIndex"in t&&(console.warn(_ge),A_=!0),!T_&&t.draggable){var r=t.x!==void 0||t.y!==void 0,o=t.onDragEnd||t.onDragMove;r&&!o&&(console.warn(jge),T_=!0)}for(var s in n)if(!D_[s]){var i=s.slice(0,2)==="on",l=n[s]!==t[s];if(i&&l){var u=s.substr(2).toLowerCase();u.substr(0,7)==="content"&&(u="content"+u.substr(7,1).toUpperCase()+u.substr(8)),e.off(u,n[s])}var p=!t.hasOwnProperty(s);p&&e.setAttr(s,void 0)}var m=t._useStrictMode,h={},g=!1;const x={};for(var s in t)if(!D_[s]){var i=s.slice(0,2)==="on",y=n[s]!==t[s];if(i&&y){var u=s.substr(2).toLowerCase();u.substr(0,7)==="content"&&(u="content"+u.substr(7,1).toUpperCase()+u.substr(8)),t[s]&&(x[u]=t[s])}!i&&(t[s]!==n[s]||m&&t[s]!==e.getAttr(s))&&(g=!0,h[s]=t[s])}g&&(e.setAttrs(h),mi(e));for(var u in x)e.on(u+f2,x[u])}function mi(e){if(!zN.Konva.autoDrawEnabled){var t=e.getLayer()||e.getStage();t&&t.batchDraw()}}const g7={},Pge={};gd.Node.prototype._applyProps=Lg;function Ege(e,t){if(typeof t=="string"){console.error(`Do not use plain text as child of Konva.Node. You are using text: ${t}`);return}e.add(t),mi(e)}function Mge(e,t,n){let r=gd[e];r||(console.error(`Konva has no node with the type ${e}. Group will be used instead. If you use minimal version of react-konva, just import required nodes into Konva: "import "konva/lib/shapes/${e}" If you want to render DOM elements as part of canvas tree take a look into this demo: https://konvajs.github.io/docs/react/DOM_Portal.html`),r=gd.Group);const o={},s={};for(var i in t){var l=i.slice(0,2)==="on";l?s[i]=t[i]:o[i]=t[i]}const u=new r(o);return Lg(u,s),u}function Oge(e,t,n){console.error(`Text components are not supported for now in ReactKonva. Your text is: "${e}"`)}function Rge(e,t,n){return!1}function Dge(e){return e}function Age(){return null}function Tge(){return null}function Nge(e,t,n,r){return Pge}function $ge(){}function Lge(e){}function zge(e,t){return!1}function Fge(){return g7}function Bge(){return g7}const Hge=setTimeout,Vge=clearTimeout,Wge=-1;function Uge(e,t){return!1}const Gge=!1,Kge=!0,qge=!0;function Xge(e,t){t.parent===e?t.moveToTop():e.add(t),mi(e)}function Qge(e,t){t.parent===e?t.moveToTop():e.add(t),mi(e)}function v7(e,t,n){t._remove(),e.add(t),t.setZIndex(n.getZIndex()),mi(e)}function Yge(e,t,n){v7(e,t,n)}function Zge(e,t){t.destroy(),t.off(f2),mi(e)}function Jge(e,t){t.destroy(),t.off(f2),mi(e)}function e0e(e,t,n){console.error(`Text components are not yet supported in ReactKonva. You text is: "${n}"`)}function t0e(e,t,n){}function n0e(e,t,n,r,o){Lg(e,o,r)}function r0e(e){e.hide(),mi(e)}function o0e(e){}function s0e(e,t){(t.visible==null||t.visible)&&e.show()}function a0e(e,t){}function i0e(e){}function l0e(){}const c0e=()=>h7.DefaultEventPriority,u0e=Object.freeze(Object.defineProperty({__proto__:null,appendChild:Xge,appendChildToContainer:Qge,appendInitialChild:Ege,cancelTimeout:Vge,clearContainer:i0e,commitMount:t0e,commitTextUpdate:e0e,commitUpdate:n0e,createInstance:Mge,createTextInstance:Oge,detachDeletedInstance:l0e,finalizeInitialChildren:Rge,getChildHostContext:Bge,getCurrentEventPriority:c0e,getPublicInstance:Dge,getRootHostContext:Fge,hideInstance:r0e,hideTextInstance:o0e,idlePriority:Tp.unstable_IdlePriority,insertBefore:v7,insertInContainerBefore:Yge,isPrimaryRenderer:Gge,noTimeout:Wge,now:Tp.unstable_now,prepareForCommit:Age,preparePortalMount:Tge,prepareUpdate:Nge,removeChild:Zge,removeChildFromContainer:Jge,resetAfterCommit:$ge,resetTextContent:Lge,run:Tp.unstable_runWithPriority,scheduleTimeout:Hge,shouldDeprioritizeSubtree:zge,shouldSetTextContent:Uge,supportsMutation:qge,unhideInstance:s0e,unhideTextInstance:a0e,warnsIfNotActing:Kge},Symbol.toStringTag,{value:"Module"}));var d0e=Object.defineProperty,f0e=Object.defineProperties,p0e=Object.getOwnPropertyDescriptors,N_=Object.getOwnPropertySymbols,m0e=Object.prototype.hasOwnProperty,h0e=Object.prototype.propertyIsEnumerable,$_=(e,t,n)=>t in e?d0e(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,L_=(e,t)=>{for(var n in t||(t={}))m0e.call(t,n)&&$_(e,n,t[n]);if(N_)for(var n of N_(t))h0e.call(t,n)&&$_(e,n,t[n]);return e},g0e=(e,t)=>f0e(e,p0e(t));function x7(e,t,n){if(!e)return;if(n(e)===!0)return e;let r=t?e.return:e.child;for(;r;){const o=x7(r,t,n);if(o)return o;r=t?null:r.sibling}}function b7(e){try{return Object.defineProperties(e,{_currentRenderer:{get(){return null},set(){}},_currentRenderer2:{get(){return null},set(){}}})}catch{return e}}const p2=b7(d.createContext(null));class y7 extends d.Component{render(){return d.createElement(p2.Provider,{value:this._reactInternals},this.props.children)}}const{ReactCurrentOwner:z_,ReactCurrentDispatcher:F_}=d.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function v0e(){const e=d.useContext(p2);if(e===null)throw new Error("its-fine: useFiber must be called within a !");const t=d.useId();return d.useMemo(()=>{for(const r of[z_==null?void 0:z_.current,e,e==null?void 0:e.alternate]){if(!r)continue;const o=x7(r,!1,s=>{let i=s.memoizedState;for(;i;){if(i.memoizedState===t)return!0;i=i.next}});if(o)return o}},[e,t])}function x0e(){var e,t;const n=v0e(),[r]=d.useState(()=>new Map);r.clear();let o=n;for(;o;){const s=(e=o.type)==null?void 0:e._context;s&&s!==p2&&!r.has(s)&&r.set(s,(t=F_==null?void 0:F_.current)==null?void 0:t.readContext(b7(s))),o=o.return}return r}function b0e(){const e=x0e();return d.useMemo(()=>Array.from(e.keys()).reduce((t,n)=>r=>d.createElement(t,null,d.createElement(n.Provider,g0e(L_({},r),{value:e.get(n)}))),t=>d.createElement(y7,L_({},t))),[e])}function y0e(e){const t=H.useRef({});return H.useLayoutEffect(()=>{t.current=e}),H.useLayoutEffect(()=>()=>{t.current={}},[]),t.current}const C0e=e=>{const t=H.useRef(),n=H.useRef(),r=H.useRef(),o=y0e(e),s=b0e(),i=l=>{const{forwardedRef:u}=e;u&&(typeof u=="function"?u(l):u.current=l)};return H.useLayoutEffect(()=>(n.current=new gd.Stage({width:e.width,height:e.height,container:t.current}),i(n.current),r.current=Tu.createContainer(n.current,h7.LegacyRoot,!1,null),Tu.updateContainer(H.createElement(s,{},e.children),r.current),()=>{gd.isBrowser&&(i(null),Tu.updateContainer(null,r.current,null),n.current.destroy())}),[]),H.useLayoutEffect(()=>{i(n.current),Lg(n.current,e,o),Tu.updateContainer(H.createElement(s,{},e.children),r.current,null)}),H.createElement("div",{ref:t,id:e.id,accessKey:e.accessKey,className:e.className,role:e.role,style:e.style,tabIndex:e.tabIndex,title:e.title})},Eu="Layer",Ms="Group",Os="Rect",ji="Circle",fh="Line",C7="Image",w0e="Text",S0e="Transformer",Tu=kge(u0e);Tu.injectIntoDevTools({findHostInstanceByFiber:()=>null,bundleType:0,version:H.version,rendererPackageName:"react-konva"});const k0e=H.forwardRef((e,t)=>H.createElement(y7,{},H.createElement(C0e,{...e,forwardedRef:t}))),j0e=le([Sn,Eo],(e,t)=>{const{tool:n,isMovingBoundingBox:r}=e;return{tool:n,isStaging:t,isMovingBoundingBox:r}},{memoizeOptions:{resultEqualityCheck:Ft}}),_0e=()=>{const e=te(),{tool:t,isStaging:n,isMovingBoundingBox:r}=W(j0e);return{handleDragStart:d.useCallback(()=>{(t==="move"||n)&&!r&&e(tm(!0))},[e,r,n,t]),handleDragMove:d.useCallback(o=>{if(!((t==="move"||n)&&!r))return;const s={x:o.target.x(),y:o.target.y()};e(WI(s))},[e,r,n,t]),handleDragEnd:d.useCallback(()=>{(t==="move"||n)&&!r&&e(tm(!1))},[e,r,n,t])}},I0e=le([Sn,Jn,Eo],(e,t,n)=>{const{cursorPosition:r,shouldLockBoundingBox:o,shouldShowBoundingBox:s,tool:i,isMaskEnabled:l,shouldSnapToGrid:u}=e;return{activeTabName:t,isCursorOnCanvas:!!r,shouldLockBoundingBox:o,shouldShowBoundingBox:s,tool:i,isStaging:n,isMaskEnabled:l,shouldSnapToGrid:u}},{memoizeOptions:{resultEqualityCheck:Ft}}),P0e=()=>{const e=te(),{activeTabName:t,shouldShowBoundingBox:n,tool:r,isStaging:o,isMaskEnabled:s,shouldSnapToGrid:i}=W(I0e),l=d.useRef(null),u=UI(),p=()=>e(GI());et(["shift+c"],()=>{p()},{enabled:()=>!o,preventDefault:!0},[]);const m=()=>e(ib(!s));et(["h"],()=>{m()},{enabled:()=>!o,preventDefault:!0},[s]),et(["n"],()=>{e(nm(!i))},{enabled:!0,preventDefault:!0},[i]),et("esc",()=>{e(FN())},{enabled:()=>!0,preventDefault:!0}),et("shift+h",()=>{e(BN(!n))},{enabled:()=>!o,preventDefault:!0},[t,n]),et(["space"],h=>{h.repeat||(u==null||u.container().focus(),r!=="move"&&(l.current=r,e(oc("move"))),r==="move"&&l.current&&l.current!=="move"&&(e(oc(l.current)),l.current="move"))},{keyup:!0,keydown:!0,preventDefault:!0},[r,l])},m2=e=>{const t=e.getPointerPosition(),n=e.getAbsoluteTransform().copy();if(!t||!n)return;const r=n.invert().point(t);return{x:r.x,y:r.y}},w7=()=>{const e=te(),t=v1(),n=UI();return{updateColorUnderCursor:()=>{if(!n||!t)return;const r=n.getPointerPosition();if(!r)return;const o=HN.pixelRatio,[s,i,l,u]=t.getContext().getImageData(r.x*o,r.y*o,1,1).data;u&&s&&i&&l&&e(VN({r:s,g:i,b:l,a:u}))},commitColorUnderCursor:()=>{e(WN())}}},E0e=le([Jn,Sn,Eo],(e,t,n)=>{const{tool:r}=t;return{tool:r,activeTabName:e,isStaging:n}},{memoizeOptions:{resultEqualityCheck:Ft}}),M0e=e=>{const t=te(),{tool:n,isStaging:r}=W(E0e),{commitColorUnderCursor:o}=w7();return d.useCallback(s=>{if(!e.current)return;if(e.current.container().focus(),n==="move"||r){t(tm(!0));return}if(n==="colorPicker"){o();return}const i=m2(e.current);i&&(s.evt.preventDefault(),t(KI(!0)),t(UN([i.x,i.y])))},[e,n,r,t,o])},O0e=le([Jn,Sn,Eo],(e,t,n)=>{const{tool:r,isDrawing:o}=t;return{tool:r,isDrawing:o,activeTabName:e,isStaging:n}},{memoizeOptions:{resultEqualityCheck:Ft}}),R0e=(e,t,n)=>{const r=te(),{isDrawing:o,tool:s,isStaging:i}=W(O0e),{updateColorUnderCursor:l}=w7();return d.useCallback(()=>{if(!e.current)return;const u=m2(e.current);if(u){if(r(GN(u)),n.current=u,s==="colorPicker"){l();return}!o||s==="move"||i||(t.current=!0,r(qI([u.x,u.y])))}},[t,r,o,i,n,e,s,l])},D0e=()=>{const e=te();return d.useCallback(()=>{e(KN())},[e])},A0e=le([Jn,Sn,Eo],(e,t,n)=>{const{tool:r,isDrawing:o}=t;return{tool:r,isDrawing:o,activeTabName:e,isStaging:n}},{memoizeOptions:{resultEqualityCheck:Ft}}),T0e=(e,t)=>{const n=te(),{tool:r,isDrawing:o,isStaging:s}=W(A0e);return d.useCallback(()=>{if(r==="move"||s){n(tm(!1));return}if(!t.current&&o&&e.current){const i=m2(e.current);if(!i)return;n(qI([i.x,i.y]))}else t.current=!1;n(KI(!1))},[t,n,o,s,e,r])},N0e=le([Sn],e=>{const{isMoveStageKeyHeld:t,stageScale:n}=e;return{isMoveStageKeyHeld:t,stageScale:n}},{memoizeOptions:{resultEqualityCheck:Ft}}),$0e=e=>{const t=te(),{isMoveStageKeyHeld:n,stageScale:r}=W(N0e);return d.useCallback(o=>{if(!e.current||n)return;o.evt.preventDefault();const s=e.current.getPointerPosition();if(!s)return;const i={x:(s.x-e.current.x())/r,y:(s.y-e.current.y())/r};let l=o.evt.deltaY;o.evt.ctrlKey&&(l=-l);const u=Bi(r*QN**l,XN,qN),p={x:s.x-i.x*u,y:s.y-i.y*u};t(YN(u)),t(WI(p))},[e,n,r,t])},L0e=le(Sn,e=>{const{boundingBoxCoordinates:t,boundingBoxDimensions:n,stageDimensions:r,stageScale:o,shouldDarkenOutsideBoundingBox:s,stageCoordinates:i}=e;return{boundingBoxCoordinates:t,boundingBoxDimensions:n,shouldDarkenOutsideBoundingBox:s,stageCoordinates:i,stageDimensions:r,stageScale:o}},{memoizeOptions:{resultEqualityCheck:Ft}}),z0e=()=>{const{boundingBoxCoordinates:e,boundingBoxDimensions:t,shouldDarkenOutsideBoundingBox:n,stageCoordinates:r,stageDimensions:o,stageScale:s}=W(L0e);return a.jsxs(Ms,{children:[a.jsx(Os,{offsetX:r.x/s,offsetY:r.y/s,height:o.height/s,width:o.width/s,fill:"rgba(0,0,0,0.4)",listening:!1,visible:n}),a.jsx(Os,{x:e.x,y:e.y,width:t.width,height:t.height,fill:"rgb(255,255,255)",listening:!1,visible:n,globalCompositeOperation:"destination-out"})]})},F0e=d.memo(z0e),B0e=le([Sn],e=>{const{stageScale:t,stageCoordinates:n,stageDimensions:r}=e;return{stageScale:t,stageCoordinates:n,stageDimensions:r}},{memoizeOptions:{resultEqualityCheck:Ft}}),H0e=()=>{const{stageScale:e,stageCoordinates:t,stageDimensions:n}=W(B0e),{colorMode:r}=ha(),[o,s]=d.useState([]),[i,l]=Ho("colors",["base.800","base.200"]),u=d.useCallback(p=>p/e,[e]);return d.useLayoutEffect(()=>{const{width:p,height:m}=n,{x:h,y:g}=t,x={x1:0,y1:0,x2:p,y2:m,offset:{x:u(h),y:u(g)}},y={x:Math.ceil(u(h)/64)*64,y:Math.ceil(u(g)/64)*64},b={x1:-y.x,y1:-y.y,x2:u(p)-y.x+64,y2:u(m)-y.y+64},S={x1:Math.min(x.x1,b.x1),y1:Math.min(x.y1,b.y1),x2:Math.max(x.x2,b.x2),y2:Math.max(x.y2,b.y2)},j=S.x2-S.x1,_=S.y2-S.y1,E=Math.round(j/64)+1,I=Math.round(_/64)+1,M=zw(0,E).map(D=>a.jsx(fh,{x:S.x1+D*64,y:S.y1,points:[0,0,0,_],stroke:r==="dark"?i:l,strokeWidth:1},`x_${D}`)),R=zw(0,I).map(D=>a.jsx(fh,{x:S.x1,y:S.y1+D*64,points:[0,0,j,0],stroke:r==="dark"?i:l,strokeWidth:1},`y_${D}`));s(M.concat(R))},[e,t,n,u,r,i,l]),a.jsx(Ms,{children:o})},V0e=d.memo(H0e),W0e=le([xe],({system:e,canvas:t})=>{const{denoiseProgress:n}=e,{boundingBox:r}=t.layerState.stagingArea,{batchIds:o}=t;return{boundingBox:r,progressImage:n&&o.includes(n.batch_id)?n.progress_image:void 0}},{memoizeOptions:{resultEqualityCheck:Ft}}),U0e=e=>{const{...t}=e,{progressImage:n,boundingBox:r}=W(W0e),[o,s]=d.useState(null);return d.useEffect(()=>{if(!n)return;const i=new Image;i.onload=()=>{s(i)},i.src=n.dataURL},[n]),n&&r&&o?a.jsx(C7,{x:r.x,y:r.y,width:r.width,height:r.height,image:o,listening:!1,...t}):null},G0e=d.memo(U0e),Fi=e=>{const{r:t,g:n,b:r,a:o}=e;return`rgba(${t}, ${n}, ${r}, ${o})`},K0e=le(Sn,e=>{const{maskColor:t,stageCoordinates:n,stageDimensions:r,stageScale:o}=e;return{stageCoordinates:n,stageDimensions:r,stageScale:o,maskColorString:Fi(t)}}),B_=e=>`data:image/svg+xml;utf8, @@ -164,6 +164,6 @@ For more info see: https://github.com/konvajs/react-konva/issues/194 -`.replaceAll("black",e),B0e=e=>{const{...t}=e,{maskColorString:n,stageCoordinates:r,stageDimensions:o,stageScale:s}=W(F0e),[i,l]=d.useState(null),[u,p]=d.useState(0),m=d.useRef(null),h=d.useCallback(()=>{p(u+1),setTimeout(h,500)},[u]);return d.useEffect(()=>{if(i)return;const g=new Image;g.onload=()=>{l(g)},g.src=B_(n)},[i,n]),d.useEffect(()=>{i&&(i.src=B_(n))},[i,n]),d.useEffect(()=>{const g=setInterval(()=>p(x=>(x+1)%5),50);return()=>clearInterval(g)},[]),!i||!Ml(r.x)||!Ml(r.y)||!Ml(s)||!Ml(o.width)||!Ml(o.height)?null:a.jsx(Os,{ref:m,offsetX:r.x/s,offsetY:r.y/s,height:o.height/s,width:o.width/s,fillPatternImage:i,fillPatternOffsetY:Ml(u)?u:0,fillPatternRepeat:"repeat",fillPatternScale:{x:1/s,y:1/s},listening:!0,globalCompositeOperation:"source-in",...t})},H0e=d.memo(B0e),V0e=ce([Sn],e=>({objects:e.layerState.objects}),{memoizeOptions:{resultEqualityCheck:Ft}}),W0e=e=>{const{...t}=e,{objects:n}=W(V0e);return a.jsx(Ms,{listening:!1,...t,children:n.filter(XN).map((r,o)=>a.jsx(fh,{points:r.points,stroke:"rgb(0,0,0)",strokeWidth:r.strokeWidth*2,tension:0,lineCap:"round",lineJoin:"round",shadowForStrokeEnabled:!1,listening:!1,globalCompositeOperation:r.tool==="brush"?"source-over":"destination-out"},o))})},U0e=d.memo(W0e);var ji=d,G0e=function(t,n,r){const o=ji.useRef("loading"),s=ji.useRef(),[i,l]=ji.useState(0),u=ji.useRef(),p=ji.useRef(),m=ji.useRef();return(u.current!==t||p.current!==n||m.current!==r)&&(o.current="loading",s.current=void 0,u.current=t,p.current=n,m.current=r),ji.useLayoutEffect(function(){if(!t)return;var h=document.createElement("img");function g(){o.current="loaded",s.current=h,l(Math.random())}function x(){o.current="failed",s.current=void 0,l(Math.random())}return h.addEventListener("load",g),h.addEventListener("error",x),n&&(h.crossOrigin=n),r&&(h.referrerPolicy=r),h.src=t,function(){h.removeEventListener("load",g),h.removeEventListener("error",x)}},[t,n,r]),[s.current,o.current]};const K0e=xd(G0e),q0e=({canvasImage:e})=>{const[t,n,r,o]=Ho("colors",["base.400","base.500","base.700","base.900"]),s=sa(t,n),i=sa(r,o),{t:l}=Z();return a.jsxs(Ms,{children:[a.jsx(Os,{x:e.x,y:e.y,width:e.width,height:e.height,fill:s}),a.jsx(h0e,{x:e.x,y:e.y,width:e.width,height:e.height,align:"center",verticalAlign:"middle",fontFamily:'"Inter Variable", sans-serif',fontSize:e.width/16,fontStyle:"600",text:l("common.imageFailedToLoad"),fill:i})]})},X0e=d.memo(q0e),Q0e=e=>{const{x:t,y:n,imageName:r}=e.canvasImage,{currentData:o,isError:s}=to(r??$r.skipToken),[i,l]=K0e((o==null?void 0:o.image_url)??"",QN.get()?"use-credentials":"anonymous");return s||l==="failed"?a.jsx(X0e,{canvasImage:e.canvasImage}):a.jsx(C7,{x:t,y:n,image:i,listening:!1})},S7=d.memo(Q0e),Y0e=ce([Sn],e=>{const{layerState:{objects:t}}=e;return{objects:t}},{memoizeOptions:{resultEqualityCheck:Ft}}),Z0e=()=>{const{objects:e}=W(Y0e);return e?a.jsx(Ms,{name:"outpainting-objects",listening:!1,children:e.map((t,n)=>{if(YN(t))return a.jsx(S7,{canvasImage:t},n);if(ZN(t)){const r=a.jsx(fh,{points:t.points,stroke:t.color?zi(t.color):"rgb(0,0,0)",strokeWidth:t.strokeWidth*2,tension:0,lineCap:"round",lineJoin:"round",shadowForStrokeEnabled:!1,listening:!1,globalCompositeOperation:t.tool==="brush"?"source-over":"destination-out"},n);return t.clip?a.jsx(Ms,{clipX:t.clip.x,clipY:t.clip.y,clipWidth:t.clip.width,clipHeight:t.clip.height,children:r},n):r}else{if(JN(t))return a.jsx(Os,{x:t.x,y:t.y,width:t.width,height:t.height,fill:zi(t.color)},n);if(e9(t))return a.jsx(Os,{x:t.x,y:t.y,width:t.width,height:t.height,fill:"rgb(255, 255, 255)",globalCompositeOperation:"destination-out"},n)}})}):null},J0e=d.memo(Z0e),eve=ce([Sn],e=>{const{layerState:t,shouldShowStagingImage:n,shouldShowStagingOutline:r,boundingBoxCoordinates:o,boundingBoxDimensions:s}=e,{selectedImageIndex:i,images:l,boundingBox:u}=t.stagingArea;return{currentStagingAreaImage:l.length>0&&i!==void 0?l[i]:void 0,isOnFirstImage:i===0,isOnLastImage:i===l.length-1,shouldShowStagingImage:n,shouldShowStagingOutline:r,x:(u==null?void 0:u.x)??o.x,y:(u==null?void 0:u.y)??o.y,width:(u==null?void 0:u.width)??s.width,height:(u==null?void 0:u.height)??s.height}},{memoizeOptions:{resultEqualityCheck:Ft}}),tve=e=>{const{...t}=e,{currentStagingAreaImage:n,shouldShowStagingImage:r,shouldShowStagingOutline:o,x:s,y:i,width:l,height:u}=W(eve);return a.jsxs(Ms,{...t,children:[r&&n&&a.jsx(S7,{canvasImage:n}),o&&a.jsxs(Ms,{children:[a.jsx(Os,{x:s,y:i,width:l,height:u,strokeWidth:1,stroke:"white",strokeScaleEnabled:!1}),a.jsx(Os,{x:s,y:i,width:l,height:u,dash:[4,4],strokeWidth:1,stroke:"black",strokeScaleEnabled:!1})]})]})},nve=d.memo(tve),rve=ce([Sn],e=>{const{layerState:{stagingArea:{images:t,selectedImageIndex:n}},shouldShowStagingOutline:r,shouldShowStagingImage:o}=e;return{currentIndex:n,total:t.length,currentStagingAreaImage:t.length>0?t[n]:void 0,shouldShowStagingImage:o,shouldShowStagingOutline:r}},je),ove=()=>{const e=te(),{currentStagingAreaImage:t,shouldShowStagingImage:n,currentIndex:r,total:o}=W(rve),{t:s}=Z(),i=d.useCallback(()=>{e(Fw(!0))},[e]),l=d.useCallback(()=>{e(Fw(!1))},[e]),u=d.useCallback(()=>e(t9()),[e]),p=d.useCallback(()=>e(n9()),[e]),m=d.useCallback(()=>e(r9()),[e]);et(["left"],u,{enabled:()=>!0,preventDefault:!0}),et(["right"],p,{enabled:()=>!0,preventDefault:!0}),et(["enter"],()=>m,{enabled:()=>!0,preventDefault:!0});const{data:h}=to((t==null?void 0:t.imageName)??$r.skipToken),g=d.useCallback(()=>{e(o9(!n))},[e,n]),x=d.useCallback(()=>{h&&e(s9({imageDTO:h}))},[e,h]),y=d.useCallback(()=>{e(a9())},[e]);return t?a.jsxs(L,{pos:"absolute",bottom:4,gap:2,w:"100%",align:"center",justify:"center",onMouseEnter:i,onMouseLeave:l,children:[a.jsxs(Vt,{isAttached:!0,borderRadius:"base",shadow:"dark-lg",children:[a.jsx(Fe,{tooltip:`${s("unifiedCanvas.previous")} (Left)`,"aria-label":`${s("unifiedCanvas.previous")} (Left)`,icon:a.jsx(_J,{}),onClick:u,colorScheme:"accent",isDisabled:!n}),a.jsx(at,{colorScheme:"accent",pointerEvents:"none",isDisabled:!n,sx:{background:"base.600",_dark:{background:"base.800"}},children:`${r+1}/${o}`}),a.jsx(Fe,{tooltip:`${s("unifiedCanvas.next")} (Right)`,"aria-label":`${s("unifiedCanvas.next")} (Right)`,icon:a.jsx(IJ,{}),onClick:p,colorScheme:"accent",isDisabled:!n})]}),a.jsxs(Vt,{isAttached:!0,borderRadius:"base",shadow:"dark-lg",children:[a.jsx(Fe,{tooltip:`${s("unifiedCanvas.accept")} (Enter)`,"aria-label":`${s("unifiedCanvas.accept")} (Enter)`,icon:a.jsx(iM,{}),onClick:m,colorScheme:"accent"}),a.jsx(Fe,{tooltip:s(n?"unifiedCanvas.showResultsOn":"unifiedCanvas.showResultsOff"),"aria-label":s(n?"unifiedCanvas.showResultsOn":"unifiedCanvas.showResultsOff"),"data-alert":!n,icon:n?a.jsx(FJ,{}):a.jsx(zJ,{}),onClick:g,colorScheme:"accent"}),a.jsx(Fe,{tooltip:s("unifiedCanvas.saveToGallery"),"aria-label":s("unifiedCanvas.saveToGallery"),isDisabled:!h||!h.is_intermediate,icon:a.jsx(lg,{}),onClick:x,colorScheme:"accent"}),a.jsx(Fe,{tooltip:s("unifiedCanvas.discardAll"),"aria-label":s("unifiedCanvas.discardAll"),icon:a.jsx(Ic,{}),onClick:y,colorScheme:"error",fontSize:20})]})]}):null},sve=d.memo(ove),ave=()=>{const e=W(l=>l.canvas.layerState),t=W(l=>l.canvas.boundingBoxCoordinates),n=W(l=>l.canvas.boundingBoxDimensions),r=W(l=>l.canvas.isMaskEnabled),o=W(l=>l.canvas.shouldPreserveMaskedArea),[s,i]=d.useState();return d.useEffect(()=>{i(void 0)},[e,t,n,r,o]),fee(async()=>{const l=await i9(e,t,n,r,o);if(!l)return;const{baseImageData:u,maskImageData:p}=l,m=l9(u,p);i(m)},1e3,[e,t,n,r,o]),s},ive={txt2img:"Text to Image",img2img:"Image to Image",inpaint:"Inpaint",outpaint:"Inpaint"},lve=()=>{const e=ave();return a.jsxs(Ie,{children:["Mode: ",e?ive[e]:"..."]})},cve=d.memo(lve),nc=e=>Math.round(e*100)/100,uve=ce([Sn],e=>{const{cursorPosition:t}=e,{cursorX:n,cursorY:r}=t?{cursorX:t.x,cursorY:t.y}:{cursorX:-1,cursorY:-1};return{cursorCoordinatesString:`(${nc(n)}, ${nc(r)})`}},{memoizeOptions:{resultEqualityCheck:Ft}});function dve(){const{cursorCoordinatesString:e}=W(uve),{t}=Z();return a.jsx(Ie,{children:`${t("unifiedCanvas.cursorPosition")}: ${e}`})}const Tx="var(--invokeai-colors-warning-500)",fve=ce([Sn],e=>{const{stageDimensions:{width:t,height:n},stageCoordinates:{x:r,y:o},boundingBoxDimensions:{width:s,height:i},scaledBoundingBoxDimensions:{width:l,height:u},boundingBoxCoordinates:{x:p,y:m},stageScale:h,shouldShowCanvasDebugInfo:g,layer:x,boundingBoxScaleMethod:y,shouldPreserveMaskedArea:b}=e;let w="inherit";return(y==="none"&&(s<512||i<512)||y==="manual"&&l*u<512*512)&&(w=Tx),{activeLayerColor:x==="mask"?Tx:"inherit",activeLayerString:x.charAt(0).toUpperCase()+x.slice(1),boundingBoxColor:w,boundingBoxCoordinatesString:`(${nc(p)}, ${nc(m)})`,boundingBoxDimensionsString:`${s}×${i}`,scaledBoundingBoxDimensionsString:`${l}×${u}`,canvasCoordinatesString:`${nc(r)}×${nc(o)}`,canvasDimensionsString:`${t}×${n}`,canvasScaleString:Math.round(h*100),shouldShowCanvasDebugInfo:g,shouldShowBoundingBox:y!=="auto",shouldShowScaledBoundingBox:y!=="none",shouldPreserveMaskedArea:b}},{memoizeOptions:{resultEqualityCheck:Ft}}),pve=()=>{const{activeLayerColor:e,activeLayerString:t,boundingBoxColor:n,boundingBoxCoordinatesString:r,boundingBoxDimensionsString:o,scaledBoundingBoxDimensionsString:s,shouldShowScaledBoundingBox:i,canvasCoordinatesString:l,canvasDimensionsString:u,canvasScaleString:p,shouldShowCanvasDebugInfo:m,shouldShowBoundingBox:h,shouldPreserveMaskedArea:g}=W(fve),{t:x}=Z();return a.jsxs(L,{sx:{flexDirection:"column",position:"absolute",top:0,insetInlineStart:0,opacity:.65,display:"flex",fontSize:"sm",padding:1,px:2,minWidth:48,margin:1,borderRadius:"base",pointerEvents:"none",bg:"base.200",_dark:{bg:"base.800"}},children:[a.jsx(cve,{}),a.jsx(Ie,{style:{color:e},children:`${x("unifiedCanvas.activeLayer")}: ${t}`}),a.jsx(Ie,{children:`${x("unifiedCanvas.canvasScale")}: ${p}%`}),g&&a.jsx(Ie,{style:{color:Tx},children:"Preserve Masked Area: On"}),h&&a.jsx(Ie,{style:{color:n},children:`${x("unifiedCanvas.boundingBox")}: ${o}`}),i&&a.jsx(Ie,{style:{color:n},children:`${x("unifiedCanvas.scaledBoundingBox")}: ${s}`}),m&&a.jsxs(a.Fragment,{children:[a.jsx(Ie,{children:`${x("unifiedCanvas.boundingBoxPosition")}: ${r}`}),a.jsx(Ie,{children:`${x("unifiedCanvas.canvasDimensions")}: ${u}`}),a.jsx(Ie,{children:`${x("unifiedCanvas.canvasPosition")}: ${l}`}),a.jsx(dve,{})]})]})},mve=d.memo(pve),hve=ce([xe],({canvas:e,generation:t})=>{const{boundingBoxCoordinates:n,boundingBoxDimensions:r,stageScale:o,isDrawing:s,isTransformingBoundingBox:i,isMovingBoundingBox:l,tool:u,shouldSnapToGrid:p}=e,{aspectRatio:m}=t;return{boundingBoxCoordinates:n,boundingBoxDimensions:r,isDrawing:s,isMovingBoundingBox:l,isTransformingBoundingBox:i,stageScale:o,shouldSnapToGrid:p,tool:u,hitStrokeWidth:20/o,aspectRatio:m}},{memoizeOptions:{resultEqualityCheck:Ft}}),gve=e=>{const{...t}=e,n=te(),{boundingBoxCoordinates:r,boundingBoxDimensions:o,isDrawing:s,isMovingBoundingBox:i,isTransformingBoundingBox:l,stageScale:u,shouldSnapToGrid:p,tool:m,hitStrokeWidth:h,aspectRatio:g}=W(hve),x=d.useRef(null),y=d.useRef(null),[b,w]=d.useState(!1);d.useEffect(()=>{var B;!x.current||!y.current||(x.current.nodes([y.current]),(B=x.current.getLayer())==null||B.batchDraw())},[]);const S=64*u;et("N",()=>{n(nm(!p))});const j=d.useCallback(B=>{if(!p){n(tv({x:Math.floor(B.target.x()),y:Math.floor(B.target.y())}));return}const V=B.target.x(),U=B.target.y(),N=wr(V,64),$=wr(U,64);B.target.x(N),B.target.y($),n(tv({x:N,y:$}))},[n,p]),_=d.useCallback(()=>{if(!y.current)return;const B=y.current,V=B.scaleX(),U=B.scaleY(),N=Math.round(B.width()*V),$=Math.round(B.height()*U),q=Math.round(B.x()),F=Math.round(B.y());if(g){const Q=wr(N/g,64);n(Vo({width:N,height:Q}))}else n(Vo({width:N,height:$}));n(tv({x:p?Mu(q,64):q,y:p?Mu(F,64):F})),B.scaleX(1),B.scaleY(1)},[n,p,g]),E=d.useCallback((B,V,U)=>{const N=B.x%S,$=B.y%S;return{x:Mu(V.x,S)+N,y:Mu(V.y,S)+$}},[S]),I=d.useCallback(()=>{n(nv(!0))},[n]),M=d.useCallback(()=>{n(nv(!1)),n(rv(!1)),n(Yf(!1)),w(!1)},[n]),R=d.useCallback(()=>{n(rv(!0))},[n]),D=d.useCallback(()=>{n(nv(!1)),n(rv(!1)),n(Yf(!1)),w(!1)},[n]),A=d.useCallback(()=>{w(!0)},[]),O=d.useCallback(()=>{!l&&!i&&w(!1)},[i,l]),T=d.useCallback(()=>{n(Yf(!0))},[n]),X=d.useCallback(()=>{n(Yf(!1))},[n]);return a.jsxs(Ms,{...t,children:[a.jsx(Os,{height:o.height,width:o.width,x:r.x,y:r.y,onMouseEnter:T,onMouseOver:T,onMouseLeave:X,onMouseOut:X}),a.jsx(Os,{draggable:!0,fillEnabled:!1,height:o.height,hitStrokeWidth:h,listening:!s&&m==="move",onDragStart:R,onDragEnd:D,onDragMove:j,onMouseDown:R,onMouseOut:O,onMouseOver:A,onMouseEnter:A,onMouseUp:D,onTransform:_,onTransformEnd:M,ref:y,stroke:b?"rgba(255,255,255,0.7)":"white",strokeWidth:(b?8:1)/u,width:o.width,x:r.x,y:r.y}),a.jsx(g0e,{anchorCornerRadius:3,anchorDragBoundFunc:E,anchorFill:"rgba(212,216,234,1)",anchorSize:15,anchorStroke:"rgb(42,42,42)",borderDash:[4,4],borderEnabled:!0,borderStroke:"black",draggable:!1,enabledAnchors:m==="move"?void 0:[],flipEnabled:!1,ignoreStroke:!0,keepRatio:!1,listening:!s&&m==="move",onDragStart:R,onDragEnd:D,onMouseDown:I,onMouseUp:M,onTransformEnd:M,ref:x,rotateEnabled:!1})]})},vve=d.memo(gve),xve=ce(Sn,e=>{const{cursorPosition:t,brushSize:n,colorPickerColor:r,maskColor:o,brushColor:s,tool:i,layer:l,shouldShowBrush:u,isMovingBoundingBox:p,isTransformingBoundingBox:m,stageScale:h,stageDimensions:g,boundingBoxCoordinates:x,boundingBoxDimensions:y,shouldRestrictStrokesToBox:b}=e,w=b?{clipX:x.x,clipY:x.y,clipWidth:y.width,clipHeight:y.height}:{};return{cursorPosition:t,brushX:t?t.x:g.width/2,brushY:t?t.y:g.height/2,radius:n/2,colorPickerOuterRadius:Bw/h,colorPickerInnerRadius:(Bw-x1+1)/h,maskColorString:zi({...o,a:.5}),brushColorString:zi(s),colorPickerColorString:zi(r),tool:i,layer:l,shouldShowBrush:u,shouldDrawBrushPreview:!(p||m||!t)&&u,strokeWidth:1.5/h,dotRadius:1.5/h,clip:w}},{memoizeOptions:{resultEqualityCheck:Ft}}),bve=e=>{const{...t}=e,{brushX:n,brushY:r,radius:o,maskColorString:s,tool:i,layer:l,shouldDrawBrushPreview:u,dotRadius:p,strokeWidth:m,brushColorString:h,colorPickerColorString:g,colorPickerInnerRadius:x,colorPickerOuterRadius:y,clip:b}=W(xve);return u?a.jsxs(Ms,{listening:!1,...b,...t,children:[i==="colorPicker"?a.jsxs(a.Fragment,{children:[a.jsx(ki,{x:n,y:r,radius:y,stroke:h,strokeWidth:x1,strokeScaleEnabled:!1}),a.jsx(ki,{x:n,y:r,radius:x,stroke:g,strokeWidth:x1,strokeScaleEnabled:!1})]}):a.jsxs(a.Fragment,{children:[a.jsx(ki,{x:n,y:r,radius:o,fill:l==="mask"?s:h,globalCompositeOperation:i==="eraser"?"destination-out":"source-out"}),a.jsx(ki,{x:n,y:r,radius:o,stroke:"rgba(255,255,255,0.4)",strokeWidth:m*2,strokeEnabled:!0,listening:!1}),a.jsx(ki,{x:n,y:r,radius:o,stroke:"rgba(0,0,0,1)",strokeWidth:m,strokeEnabled:!0,listening:!1})]}),a.jsx(ki,{x:n,y:r,radius:p*2,fill:"rgba(255,255,255,0.4)",listening:!1}),a.jsx(ki,{x:n,y:r,radius:p,fill:"rgba(0,0,0,1)",listening:!1})]}):null},yve=d.memo(bve),Cve=ce([Sn,Eo],(e,t)=>{const{isMaskEnabled:n,stageScale:r,shouldShowBoundingBox:o,isTransformingBoundingBox:s,isMouseOverBoundingBox:i,isMovingBoundingBox:l,stageDimensions:u,stageCoordinates:p,tool:m,isMovingStage:h,shouldShowIntermediates:g,shouldShowGrid:x,shouldRestrictStrokesToBox:y,shouldAntialias:b}=e;let w="none";return m==="move"||t?h?w="grabbing":w="grab":s?w=void 0:y&&!i&&(w="default"),{isMaskEnabled:n,isModifyingBoundingBox:s||l,shouldShowBoundingBox:o,shouldShowGrid:x,stageCoordinates:p,stageCursor:w,stageDimensions:u,stageScale:r,tool:m,isStaging:t,shouldShowIntermediates:g,shouldAntialias:b}},je),wve=we(v0e,{shouldForwardProp:e=>!["sx"].includes(e)}),Sve=()=>{const{isMaskEnabled:e,isModifyingBoundingBox:t,shouldShowBoundingBox:n,shouldShowGrid:r,stageCoordinates:o,stageCursor:s,stageDimensions:i,stageScale:l,tool:u,isStaging:p,shouldShowIntermediates:m,shouldAntialias:h}=W(Cve);C0e();const g=te(),x=d.useRef(null),y=d.useRef(null),b=d.useRef(null),w=d.useCallback(B=>{c9(B),y.current=B},[]),S=d.useCallback(B=>{u9(B),b.current=B},[]),j=d.useRef({x:0,y:0}),_=d.useRef(!1),E=M0e(y),I=S0e(y),M=P0e(y,_),R=j0e(y,_,j),D=_0e(),{handleDragStart:A,handleDragMove:O,handleDragEnd:T}=b0e(),X=d.useCallback(B=>B.evt.preventDefault(),[]);return d.useEffect(()=>{if(!x.current)return;const B=new ResizeObserver(N=>{for(const $ of N)if($.contentBoxSize){const{width:q,height:F}=$.contentRect;g(Hw({width:q,height:F}))}});B.observe(x.current);const{width:V,height:U}=x.current.getBoundingClientRect();return g(Hw({width:V,height:U})),()=>{B.disconnect()}},[g]),a.jsxs(L,{id:"canvas-container",ref:x,sx:{position:"relative",height:"100%",width:"100%",borderRadius:"base"},children:[a.jsx(Ie,{sx:{position:"absolute"},children:a.jsxs(wve,{tabIndex:-1,ref:w,sx:{outline:"none",overflow:"hidden",cursor:s||void 0,canvas:{outline:"none"}},x:o.x,y:o.y,width:i.width,height:i.height,scale:{x:l,y:l},onTouchStart:I,onTouchMove:R,onTouchEnd:M,onMouseDown:I,onMouseLeave:D,onMouseMove:R,onMouseUp:M,onDragStart:A,onDragMove:O,onDragEnd:T,onContextMenu:X,onWheel:E,draggable:(u==="move"||p)&&!t,children:[a.jsx(Eu,{id:"grid",visible:r,children:a.jsx(N0e,{})}),a.jsx(Eu,{id:"base",ref:S,listening:!1,imageSmoothingEnabled:h,children:a.jsx(J0e,{})}),a.jsxs(Eu,{id:"mask",visible:e&&!p,listening:!1,children:[a.jsx(U0e,{visible:!0,listening:!1}),a.jsx(H0e,{listening:!1})]}),a.jsx(Eu,{children:a.jsx(D0e,{})}),a.jsxs(Eu,{id:"preview",imageSmoothingEnabled:h,children:[!p&&a.jsx(yve,{visible:u!=="move",listening:!1}),a.jsx(nve,{visible:p}),m&&a.jsx(z0e,{}),a.jsx(vve,{visible:n&&!p})]})]})}),a.jsx(mve,{}),a.jsx(sve,{})]})},kve=d.memo(Sve);function jve(e,t,n=250){const[r,o]=d.useState(0);return d.useEffect(()=>{const s=setTimeout(()=>{r===1&&e(),o(0)},n);return r===2&&t(),()=>clearTimeout(s)},[r,e,t,n]),()=>o(s=>s+1)}const n1={width:6,height:6,borderColor:"base.100"},_ve={".react-colorful__hue-pointer":n1,".react-colorful__saturation-pointer":n1,".react-colorful__alpha-pointer":n1},Ive=e=>a.jsx(Ie,{sx:_ve,children:a.jsx(CO,{...e})}),k7=d.memo(Ive),Pve=ce([Sn,Eo],(e,t)=>{const{maskColor:n,layer:r,isMaskEnabled:o,shouldPreserveMaskedArea:s}=e;return{layer:r,maskColor:n,maskColorString:zi(n),isMaskEnabled:o,shouldPreserveMaskedArea:s,isStaging:t}},{memoizeOptions:{resultEqualityCheck:Ft}}),Eve=()=>{const e=te(),{t}=Z(),{layer:n,maskColor:r,isMaskEnabled:o,shouldPreserveMaskedArea:s,isStaging:i}=W(Pve);et(["q"],()=>{l()},{enabled:()=>!i,preventDefault:!0},[n]),et(["shift+c"],()=>{u()},{enabled:()=>!i,preventDefault:!0},[]),et(["h"],()=>{p()},{enabled:()=>!i,preventDefault:!0},[o]);const l=()=>{e(XI(n==="mask"?"base":"mask"))},u=()=>e(GI()),p=()=>e(ib(!o)),m=async()=>{e(p9())};return a.jsx(qd,{triggerComponent:a.jsx(Vt,{children:a.jsx(Fe,{"aria-label":t("unifiedCanvas.maskingOptions"),tooltip:t("unifiedCanvas.maskingOptions"),icon:a.jsx(hM,{}),isChecked:n==="mask",isDisabled:i})}),children:a.jsxs(L,{direction:"column",gap:2,children:[a.jsx(br,{label:`${t("unifiedCanvas.enableMask")} (H)`,isChecked:o,onChange:p}),a.jsx(br,{label:t("unifiedCanvas.preserveMaskedArea"),isChecked:s,onChange:h=>e(d9(h.target.checked))}),a.jsx(Ie,{sx:{paddingTop:2,paddingBottom:2},children:a.jsx(k7,{color:r,onChange:h=>e(f9(h))})}),a.jsx(at,{size:"sm",leftIcon:a.jsx(lg,{}),onClick:m,children:"Save Mask"}),a.jsxs(at,{size:"sm",leftIcon:a.jsx(Br,{}),onClick:u,children:[t("unifiedCanvas.clearMask")," (Shift+C)"]})]})})},Mve=d.memo(Eve),Ove=ce([xe,Jn],({canvas:e},t)=>{const{futureLayerStates:n}=e;return{canRedo:n.length>0,activeTabName:t}},{memoizeOptions:{resultEqualityCheck:Ft}});function Rve(){const e=te(),{canRedo:t,activeTabName:n}=W(Ove),{t:r}=Z(),o=()=>{e(m9())};return et(["meta+shift+z","ctrl+shift+z","control+y","meta+y"],()=>{o()},{enabled:()=>t,preventDefault:!0},[n,t]),a.jsx(Fe,{"aria-label":`${r("unifiedCanvas.redo")} (Ctrl+Shift+Z)`,tooltip:`${r("unifiedCanvas.redo")} (Ctrl+Shift+Z)`,icon:a.jsx(JJ,{}),onClick:o,isDisabled:!t})}const Dve=()=>{const e=W(Eo),t=te(),{t:n}=Z();return a.jsxs(kg,{title:n("unifiedCanvas.clearCanvasHistory"),acceptCallback:()=>t(h9()),acceptButtonText:n("unifiedCanvas.clearHistory"),triggerComponent:a.jsx(at,{size:"sm",leftIcon:a.jsx(Br,{}),isDisabled:e,children:n("unifiedCanvas.clearCanvasHistory")}),children:[a.jsx("p",{children:n("unifiedCanvas.clearCanvasHistoryMessage")}),a.jsx("br",{}),a.jsx("p",{children:n("unifiedCanvas.clearCanvasHistoryConfirm")})]})},Ave=d.memo(Dve),Tve=ce([Sn],e=>{const{shouldAutoSave:t,shouldCropToBoundingBoxOnSave:n,shouldDarkenOutsideBoundingBox:r,shouldShowCanvasDebugInfo:o,shouldShowGrid:s,shouldShowIntermediates:i,shouldSnapToGrid:l,shouldRestrictStrokesToBox:u,shouldAntialias:p}=e;return{shouldAutoSave:t,shouldCropToBoundingBoxOnSave:n,shouldDarkenOutsideBoundingBox:r,shouldShowCanvasDebugInfo:o,shouldShowGrid:s,shouldShowIntermediates:i,shouldSnapToGrid:l,shouldRestrictStrokesToBox:u,shouldAntialias:p}},{memoizeOptions:{resultEqualityCheck:Ft}}),Nve=()=>{const e=te(),{t}=Z(),{shouldAutoSave:n,shouldCropToBoundingBoxOnSave:r,shouldDarkenOutsideBoundingBox:o,shouldShowCanvasDebugInfo:s,shouldShowGrid:i,shouldShowIntermediates:l,shouldSnapToGrid:u,shouldRestrictStrokesToBox:p,shouldAntialias:m}=W(Tve);et(["n"],()=>{e(nm(!u))},{enabled:!0,preventDefault:!0},[u]);const h=g=>e(nm(g.target.checked));return a.jsx(qd,{isLazy:!1,triggerComponent:a.jsx(Fe,{tooltip:t("unifiedCanvas.canvasSettings"),"aria-label":t("unifiedCanvas.canvasSettings"),icon:a.jsx(yM,{})}),children:a.jsxs(L,{direction:"column",gap:2,children:[a.jsx(br,{label:t("unifiedCanvas.showIntermediates"),isChecked:l,onChange:g=>e(g9(g.target.checked))}),a.jsx(br,{label:t("unifiedCanvas.showGrid"),isChecked:i,onChange:g=>e(v9(g.target.checked))}),a.jsx(br,{label:t("unifiedCanvas.snapToGrid"),isChecked:u,onChange:h}),a.jsx(br,{label:t("unifiedCanvas.darkenOutsideSelection"),isChecked:o,onChange:g=>e(x9(g.target.checked))}),a.jsx(br,{label:t("unifiedCanvas.autoSaveToGallery"),isChecked:n,onChange:g=>e(b9(g.target.checked))}),a.jsx(br,{label:t("unifiedCanvas.saveBoxRegionOnly"),isChecked:r,onChange:g=>e(y9(g.target.checked))}),a.jsx(br,{label:t("unifiedCanvas.limitStrokesToBox"),isChecked:p,onChange:g=>e(C9(g.target.checked))}),a.jsx(br,{label:t("unifiedCanvas.showCanvasDebugInfo"),isChecked:s,onChange:g=>e(w9(g.target.checked))}),a.jsx(br,{label:t("unifiedCanvas.antialiasing"),isChecked:m,onChange:g=>e(S9(g.target.checked))}),a.jsx(Ave,{})]})})},$ve=d.memo(Nve),Lve=ce([xe,Eo],({canvas:e},t)=>{const{tool:n,brushColor:r,brushSize:o}=e;return{tool:n,isStaging:t,brushColor:r,brushSize:o}},{memoizeOptions:{resultEqualityCheck:Ft}}),zve=()=>{const e=te(),{tool:t,brushColor:n,brushSize:r,isStaging:o}=W(Lve),{t:s}=Z();et(["b"],()=>{i()},{enabled:()=>!o,preventDefault:!0},[]),et(["e"],()=>{l()},{enabled:()=>!o,preventDefault:!0},[t]),et(["c"],()=>{u()},{enabled:()=>!o,preventDefault:!0},[t]),et(["shift+f"],()=>{p()},{enabled:()=>!o,preventDefault:!0}),et(["delete","backspace"],()=>{m()},{enabled:()=>!o,preventDefault:!0}),et(["BracketLeft"],()=>{r-5<=5?e(Zf(Math.max(r-1,1))):e(Zf(Math.max(r-5,1)))},{enabled:()=>!o,preventDefault:!0},[r]),et(["BracketRight"],()=>{e(Zf(Math.min(r+5,500)))},{enabled:()=>!o,preventDefault:!0},[r]),et(["Shift+BracketLeft"],()=>{e(ov({...n,a:Fi(n.a-.05,.05,1)}))},{enabled:()=>!o,preventDefault:!0},[n]),et(["Shift+BracketRight"],()=>{e(ov({...n,a:Fi(n.a+.05,.05,1)}))},{enabled:()=>!o,preventDefault:!0},[n]);const i=()=>e(oc("brush")),l=()=>e(oc("eraser")),u=()=>e(oc("colorPicker")),p=()=>e(k9()),m=()=>e(j9());return a.jsxs(Vt,{isAttached:!0,children:[a.jsx(Fe,{"aria-label":`${s("unifiedCanvas.brush")} (B)`,tooltip:`${s("unifiedCanvas.brush")} (B)`,icon:a.jsx(XJ,{}),isChecked:t==="brush"&&!o,onClick:i,isDisabled:o}),a.jsx(Fe,{"aria-label":`${s("unifiedCanvas.eraser")} (E)`,tooltip:`${s("unifiedCanvas.eraser")} (E)`,icon:a.jsx(TJ,{}),isChecked:t==="eraser"&&!o,isDisabled:o,onClick:l}),a.jsx(Fe,{"aria-label":`${s("unifiedCanvas.fillBoundingBox")} (Shift+F)`,tooltip:`${s("unifiedCanvas.fillBoundingBox")} (Shift+F)`,icon:a.jsx(BJ,{}),isDisabled:o,onClick:p}),a.jsx(Fe,{"aria-label":`${s("unifiedCanvas.eraseBoundingBox")} (Del/Backspace)`,tooltip:`${s("unifiedCanvas.eraseBoundingBox")} (Del/Backspace)`,icon:a.jsx(Vc,{style:{transform:"rotate(45deg)"}}),isDisabled:o,onClick:m}),a.jsx(Fe,{"aria-label":`${s("unifiedCanvas.colorPicker")} (C)`,tooltip:`${s("unifiedCanvas.colorPicker")} (C)`,icon:a.jsx(LJ,{}),isChecked:t==="colorPicker"&&!o,isDisabled:o,onClick:u}),a.jsx(qd,{triggerComponent:a.jsx(Fe,{"aria-label":s("unifiedCanvas.brushOptions"),tooltip:s("unifiedCanvas.brushOptions"),icon:a.jsx(xM,{})}),children:a.jsxs(L,{minWidth:60,direction:"column",gap:4,width:"100%",children:[a.jsx(L,{gap:4,justifyContent:"space-between",children:a.jsx(tt,{label:s("unifiedCanvas.brushSize"),value:r,withInput:!0,onChange:h=>e(Zf(h)),sliderNumberInputProps:{max:500}})}),a.jsx(Ie,{sx:{width:"100%",paddingTop:2,paddingBottom:2},children:a.jsx(k7,{color:n,onChange:h=>e(ov(h))})})]})})]})},Fve=d.memo(zve),Bve=ce([xe,Jn],({canvas:e},t)=>{const{pastLayerStates:n}=e;return{canUndo:n.length>0,activeTabName:t}},{memoizeOptions:{resultEqualityCheck:Ft}});function Hve(){const e=te(),{t}=Z(),{canUndo:n,activeTabName:r}=W(Bve),o=()=>{e(_9())};return et(["meta+z","ctrl+z"],()=>{o()},{enabled:()=>n,preventDefault:!0},[r,n]),a.jsx(Fe,{"aria-label":`${t("unifiedCanvas.undo")} (Ctrl+Z)`,tooltip:`${t("unifiedCanvas.undo")} (Ctrl+Z)`,icon:a.jsx(Ud,{}),onClick:o,isDisabled:!n})}const Vve=ce([xe,Eo],({canvas:e},t)=>{const{tool:n,shouldCropToBoundingBoxOnSave:r,layer:o,isMaskEnabled:s}=e;return{isStaging:t,isMaskEnabled:s,tool:n,layer:o,shouldCropToBoundingBoxOnSave:r}},{memoizeOptions:{resultEqualityCheck:Ft}}),Wve=()=>{const e=te(),{isStaging:t,isMaskEnabled:n,layer:r,tool:o}=W(Vve),s=v1(),{t:i}=Z(),{isClipboardAPIAvailable:l}=L8(),{getUploadButtonProps:u,getUploadInputProps:p}=Vy({postUploadAction:{type:"SET_CANVAS_INITIAL_IMAGE"}});et(["v"],()=>{m()},{enabled:()=>!t,preventDefault:!0},[]),et(["r"],()=>{g()},{enabled:()=>!0,preventDefault:!0},[s]),et(["shift+m"],()=>{y()},{enabled:()=>!t,preventDefault:!0},[s]),et(["shift+s"],()=>{b()},{enabled:()=>!t,preventDefault:!0},[s]),et(["meta+c","ctrl+c"],()=>{w()},{enabled:()=>!t&&l,preventDefault:!0},[s,l]),et(["shift+d"],()=>{S()},{enabled:()=>!t,preventDefault:!0},[s]);const m=()=>e(oc("move")),h=jve(()=>g(!1),()=>g(!0)),g=(_=!1)=>{const E=v1();if(!E)return;const I=E.getClientRect({skipTransform:!0});e(P9({contentRect:I,shouldScaleTo1:_}))},x=()=>{e(aI())},y=()=>{e(E9())},b=()=>{e(M9())},w=()=>{l&&e(O9())},S=()=>{e(R9())},j=_=>{const E=_;e(XI(E)),E==="mask"&&!n&&e(ib(!0))};return a.jsxs(L,{sx:{alignItems:"center",gap:2,flexWrap:"wrap"},children:[a.jsx(Ie,{w:24,children:a.jsx(On,{tooltip:`${i("unifiedCanvas.layer")} (Q)`,value:r,data:I9,onChange:j,disabled:t})}),a.jsx(Mve,{}),a.jsx(Fve,{}),a.jsxs(Vt,{isAttached:!0,children:[a.jsx(Fe,{"aria-label":`${i("unifiedCanvas.move")} (V)`,tooltip:`${i("unifiedCanvas.move")} (V)`,icon:a.jsx(PJ,{}),isChecked:o==="move"||t,onClick:m}),a.jsx(Fe,{"aria-label":`${i("unifiedCanvas.resetView")} (R)`,tooltip:`${i("unifiedCanvas.resetView")} (R)`,icon:a.jsx(RJ,{}),onClick:h})]}),a.jsxs(Vt,{isAttached:!0,children:[a.jsx(Fe,{"aria-label":`${i("unifiedCanvas.mergeVisible")} (Shift+M)`,tooltip:`${i("unifiedCanvas.mergeVisible")} (Shift+M)`,icon:a.jsx(GJ,{}),onClick:y,isDisabled:t}),a.jsx(Fe,{"aria-label":`${i("unifiedCanvas.saveToGallery")} (Shift+S)`,tooltip:`${i("unifiedCanvas.saveToGallery")} (Shift+S)`,icon:a.jsx(lg,{}),onClick:b,isDisabled:t}),l&&a.jsx(Fe,{"aria-label":`${i("unifiedCanvas.copyToClipboard")} (Cmd/Ctrl+C)`,tooltip:`${i("unifiedCanvas.copyToClipboard")} (Cmd/Ctrl+C)`,icon:a.jsx(Hc,{}),onClick:w,isDisabled:t}),a.jsx(Fe,{"aria-label":`${i("unifiedCanvas.downloadAsImage")} (Shift+D)`,tooltip:`${i("unifiedCanvas.downloadAsImage")} (Shift+D)`,icon:a.jsx(ig,{}),onClick:S,isDisabled:t})]}),a.jsxs(Vt,{isAttached:!0,children:[a.jsx(Hve,{}),a.jsx(Rve,{})]}),a.jsxs(Vt,{isAttached:!0,children:[a.jsx(Fe,{"aria-label":`${i("common.upload")}`,tooltip:`${i("common.upload")}`,icon:a.jsx(cg,{}),isDisabled:t,...u()}),a.jsx("input",{...p()}),a.jsx(Fe,{"aria-label":`${i("unifiedCanvas.clearCanvas")}`,tooltip:`${i("unifiedCanvas.clearCanvas")}`,icon:a.jsx(Br,{}),onClick:x,colorScheme:"error",isDisabled:t})]}),a.jsx(Vt,{isAttached:!0,children:a.jsx($ve,{})})]})},Uve=d.memo(Wve),H_={id:"canvas-intial-image",actionType:"SET_CANVAS_INITIAL_IMAGE"},Gve=()=>{const{isOver:e,setNodeRef:t,active:n}=e8({id:"unifiedCanvas",data:H_});return a.jsxs(L,{layerStyle:"first",ref:t,tabIndex:-1,sx:{flexDirection:"column",alignItems:"center",gap:4,p:2,borderRadius:"base",w:"full",h:"full"},children:[a.jsx(Uve,{}),a.jsx(kve,{}),t8(H_,n)&&a.jsx(n8,{isOver:e,label:"Set Canvas Initial Image"})]})},Kve=d.memo(Gve),qve=()=>a.jsx(Kve,{}),Xve=d.memo(qve),Qve=[{id:"txt2img",translationKey:"common.txt2img",icon:a.jsx(Tn,{as:HJ,sx:{boxSize:6,pointerEvents:"none"}}),content:a.jsx(pge,{})},{id:"img2img",translationKey:"common.img2img",icon:a.jsx(Tn,{as:Qi,sx:{boxSize:6,pointerEvents:"none"}}),content:a.jsx(jfe,{})},{id:"unifiedCanvas",translationKey:"common.unifiedCanvas",icon:a.jsx(Tn,{as:woe,sx:{boxSize:6,pointerEvents:"none"}}),content:a.jsx(Xve,{})},{id:"nodes",translationKey:"common.nodes",icon:a.jsx(Tn,{as:Wy,sx:{boxSize:6,pointerEvents:"none"}}),content:a.jsx(whe,{})},{id:"modelManager",translationKey:"modelManager.modelManager",icon:a.jsx(Tn,{as:DJ,sx:{boxSize:6,pointerEvents:"none"}}),content:a.jsx(Spe,{})},{id:"queue",translationKey:"queue.queue",icon:a.jsx(Tn,{as:ree,sx:{boxSize:6,pointerEvents:"none"}}),content:a.jsx(dge,{})}],Yve=ce([xe],({config:e})=>{const{disabledTabs:t}=e;return Qve.filter(r=>!t.includes(r.id))},{memoizeOptions:{resultEqualityCheck:Ft}}),Zve=448,Jve=448,e1e=360,t1e=["modelManager","queue"],n1e=["modelManager","queue"],r1e=()=>{const e=W(D9),t=W(Jn),n=W(Yve),{t:r}=Z(),o=te(),s=d.useCallback(O=>{O.target instanceof HTMLElement&&O.target.blur()},[]),i=d.useMemo(()=>n.map(O=>a.jsx(Ht,{hasArrow:!0,label:String(r(O.translationKey)),placement:"end",children:a.jsxs(Tr,{onClick:s,children:[a.jsx(f5,{children:String(r(O.translationKey))}),O.icon]})},O.id)),[n,r,s]),l=d.useMemo(()=>n.map(O=>a.jsx(So,{children:O.content},O.id)),[n]),u=d.useCallback(O=>{const T=n[O];T&&o(Xs(T.id))},[o,n]),{minSize:p,isCollapsed:m,setIsCollapsed:h,ref:g,reset:x,expand:y,collapse:b,toggle:w}=Zj(Zve,"pixels"),{ref:S,minSize:j,isCollapsed:_,setIsCollapsed:E,reset:I,expand:M,collapse:R,toggle:D}=Zj(e1e,"pixels");et("f",()=>{_||m?(M(),y()):(b(),R())},[o,_,m]),et(["t","o"],()=>{w()},[o]),et("g",()=>{D()},[o]);const A=Jy();return a.jsxs(rl,{variant:"appTabs",defaultIndex:e,index:e,onChange:u,sx:{flexGrow:1,gap:4},isLazy:!0,children:[a.jsxs(ol,{sx:{pt:2,gap:4,flexDir:"column"},children:[i,a.jsx(ba,{})]}),a.jsxs(Ig,{id:"app",autoSaveId:"app",direction:"horizontal",style:{height:"100%",width:"100%"},storage:A,units:"pixels",children:[!n1e.includes(t)&&a.jsxs(a.Fragment,{children:[a.jsx(Qa,{order:0,id:"side",ref:g,defaultSize:p,minSize:p,onCollapse:h,collapsible:!0,children:t==="nodes"?a.jsx(xie,{}):a.jsx(qde,{})}),a.jsx(lh,{onDoubleClick:x,collapsedDirection:m?"left":void 0}),a.jsx(wie,{isSidePanelCollapsed:m,sidePanelRef:g})]}),a.jsx(Qa,{id:"main",order:1,minSize:Jve,children:a.jsx(zc,{style:{height:"100%",width:"100%"},children:l})}),!t1e.includes(t)&&a.jsxs(a.Fragment,{children:[a.jsx(lh,{onDoubleClick:I,collapsedDirection:_?"right":void 0}),a.jsx(Qa,{id:"gallery",ref:S,order:2,defaultSize:j,minSize:j,onCollapse:E,collapsible:!0,children:a.jsx(Zoe,{})}),a.jsx(yie,{isGalleryCollapsed:_,galleryPanelRef:S})]})]})]})},o1e=d.memo(r1e),s1e=d.createContext(null),r1={didCatch:!1,error:null};class a1e extends d.Component{constructor(t){super(t),this.resetErrorBoundary=this.resetErrorBoundary.bind(this),this.state=r1}static getDerivedStateFromError(t){return{didCatch:!0,error:t}}resetErrorBoundary(){const{error:t}=this.state;if(t!==null){for(var n,r,o=arguments.length,s=new Array(o),i=0;i0&&arguments[0]!==void 0?arguments[0]:[],t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];return e.length!==t.length||e.some((n,r)=>!Object.is(n,t[r]))}function l1e(e={}){let t;if(e.repoUrl)t=e.repoUrl;else if(e.user&&e.repo)t=`https://github.com/${e.user}/${e.repo}`;else throw new Error("You need to specify either the `repoUrl` option or both the `user` and `repo` options");const n=new URL(`${t}/issues/new`),r=["body","title","labels","template","milestone","assignee","projects"];for(const o of r){let s=e[o];if(s!==void 0){if(o==="labels"||o==="projects"){if(!Array.isArray(s))throw new TypeError(`The \`${o}\` option should be an array`);s=s.join(",")}n.searchParams.set(o,s)}}return n.toString()}const c1e=[EvalError,RangeError,ReferenceError,SyntaxError,TypeError,URIError,globalThis.DOMException,globalThis.AssertionError,globalThis.SystemError].filter(Boolean).map(e=>[e.name,e]),u1e=new Map(c1e),d1e=[{property:"name",enumerable:!1},{property:"message",enumerable:!1},{property:"stack",enumerable:!1},{property:"code",enumerable:!0},{property:"cause",enumerable:!1}],Nx=new WeakSet,f1e=e=>{Nx.add(e);const t=e.toJSON();return Nx.delete(e),t},p1e=e=>u1e.get(e)??Error,j7=({from:e,seen:t,to:n,forceEnumerable:r,maxDepth:o,depth:s,useToJSON:i,serialize:l})=>{if(!n)if(Array.isArray(e))n=[];else if(!l&&V_(e)){const p=p1e(e.name);n=new p}else n={};if(t.push(e),s>=o)return n;if(i&&typeof e.toJSON=="function"&&!Nx.has(e))return f1e(e);const u=p=>j7({from:p,seen:[...t],forceEnumerable:r,maxDepth:o,depth:s,useToJSON:i,serialize:l});for(const[p,m]of Object.entries(e)){if(typeof Buffer=="function"&&Buffer.isBuffer(m)){n[p]="[object Buffer]";continue}if(m!==null&&typeof m=="object"&&typeof m.pipe=="function"){n[p]="[object Stream]";continue}if(typeof m!="function"){if(!m||typeof m!="object"){n[p]=m;continue}if(!t.includes(e[p])){s++,n[p]=u(e[p]);continue}n[p]="[Circular]"}}for(const{property:p,enumerable:m}of d1e)typeof e[p]<"u"&&e[p]!==null&&Object.defineProperty(n,p,{value:V_(e[p])?u(e[p]):e[p],enumerable:r?!0:m,configurable:!0,writable:!0});return n};function m1e(e,t={}){const{maxDepth:n=Number.POSITIVE_INFINITY,useToJSON:r=!0}=t;return typeof e=="object"&&e!==null?j7({from:e,seen:[],forceEnumerable:!0,maxDepth:n,depth:0,useToJSON:r,serialize:!0}):typeof e=="function"?`[Function: ${e.name??"anonymous"}]`:e}function V_(e){return!!e&&typeof e=="object"&&"name"in e&&"message"in e&&"stack"in e}const h1e=({error:e,resetErrorBoundary:t})=>{const n=o5(),r=d.useCallback(()=>{const s=JSON.stringify(m1e(e),null,2);navigator.clipboard.writeText(`\`\`\` +`.replaceAll("black",e),q0e=e=>{const{...t}=e,{maskColorString:n,stageCoordinates:r,stageDimensions:o,stageScale:s}=W(K0e),[i,l]=d.useState(null),[u,p]=d.useState(0),m=d.useRef(null),h=d.useCallback(()=>{p(u+1),setTimeout(h,500)},[u]);return d.useEffect(()=>{if(i)return;const g=new Image;g.onload=()=>{l(g)},g.src=B_(n)},[i,n]),d.useEffect(()=>{i&&(i.src=B_(n))},[i,n]),d.useEffect(()=>{const g=setInterval(()=>p(x=>(x+1)%5),50);return()=>clearInterval(g)},[]),!i||!Ml(r.x)||!Ml(r.y)||!Ml(s)||!Ml(o.width)||!Ml(o.height)?null:a.jsx(Os,{ref:m,offsetX:r.x/s,offsetY:r.y/s,height:o.height/s,width:o.width/s,fillPatternImage:i,fillPatternOffsetY:Ml(u)?u:0,fillPatternRepeat:"repeat",fillPatternScale:{x:1/s,y:1/s},listening:!0,globalCompositeOperation:"source-in",...t})},X0e=d.memo(q0e),Q0e=le([Sn],e=>({objects:e.layerState.objects}),{memoizeOptions:{resultEqualityCheck:Ft}}),Y0e=e=>{const{...t}=e,{objects:n}=W(Q0e);return a.jsx(Ms,{listening:!1,...t,children:n.filter(ZN).map((r,o)=>a.jsx(fh,{points:r.points,stroke:"rgb(0,0,0)",strokeWidth:r.strokeWidth*2,tension:0,lineCap:"round",lineJoin:"round",shadowForStrokeEnabled:!1,listening:!1,globalCompositeOperation:r.tool==="brush"?"source-over":"destination-out"},o))})},Z0e=d.memo(Y0e);var _i=d,J0e=function(t,n,r){const o=_i.useRef("loading"),s=_i.useRef(),[i,l]=_i.useState(0),u=_i.useRef(),p=_i.useRef(),m=_i.useRef();return(u.current!==t||p.current!==n||m.current!==r)&&(o.current="loading",s.current=void 0,u.current=t,p.current=n,m.current=r),_i.useLayoutEffect(function(){if(!t)return;var h=document.createElement("img");function g(){o.current="loaded",s.current=h,l(Math.random())}function x(){o.current="failed",s.current=void 0,l(Math.random())}return h.addEventListener("load",g),h.addEventListener("error",x),n&&(h.crossOrigin=n),r&&(h.referrerPolicy=r),h.src=t,function(){h.removeEventListener("load",g),h.removeEventListener("error",x)}},[t,n,r]),[s.current,o.current]};const eve=xd(J0e),tve=({canvasImage:e})=>{const[t,n,r,o]=Ho("colors",["base.400","base.500","base.700","base.900"]),s=sa(t,n),i=sa(r,o),{t:l}=Z();return a.jsxs(Ms,{children:[a.jsx(Os,{x:e.x,y:e.y,width:e.width,height:e.height,fill:s}),a.jsx(w0e,{x:e.x,y:e.y,width:e.width,height:e.height,align:"center",verticalAlign:"middle",fontFamily:'"Inter Variable", sans-serif',fontSize:e.width/16,fontStyle:"600",text:l("common.imageFailedToLoad"),fill:i})]})},nve=d.memo(tve),rve=e=>{const{x:t,y:n,imageName:r}=e.canvasImage,{currentData:o,isError:s}=to(r??$r.skipToken),[i,l]=eve((o==null?void 0:o.image_url)??"",JN.get()?"use-credentials":"anonymous");return s||l==="failed"?a.jsx(nve,{canvasImage:e.canvasImage}):a.jsx(C7,{x:t,y:n,image:i,listening:!1})},S7=d.memo(rve),ove=le([Sn],e=>{const{layerState:{objects:t}}=e;return{objects:t}},{memoizeOptions:{resultEqualityCheck:Ft}}),sve=()=>{const{objects:e}=W(ove);return e?a.jsx(Ms,{name:"outpainting-objects",listening:!1,children:e.map((t,n)=>{if(e9(t))return a.jsx(S7,{canvasImage:t},n);if(t9(t)){const r=a.jsx(fh,{points:t.points,stroke:t.color?Fi(t.color):"rgb(0,0,0)",strokeWidth:t.strokeWidth*2,tension:0,lineCap:"round",lineJoin:"round",shadowForStrokeEnabled:!1,listening:!1,globalCompositeOperation:t.tool==="brush"?"source-over":"destination-out"},n);return t.clip?a.jsx(Ms,{clipX:t.clip.x,clipY:t.clip.y,clipWidth:t.clip.width,clipHeight:t.clip.height,children:r},n):r}else{if(n9(t))return a.jsx(Os,{x:t.x,y:t.y,width:t.width,height:t.height,fill:Fi(t.color)},n);if(r9(t))return a.jsx(Os,{x:t.x,y:t.y,width:t.width,height:t.height,fill:"rgb(255, 255, 255)",globalCompositeOperation:"destination-out"},n)}})}):null},ave=d.memo(sve),ive=le([Sn],e=>{const{layerState:t,shouldShowStagingImage:n,shouldShowStagingOutline:r,boundingBoxCoordinates:o,boundingBoxDimensions:s}=e,{selectedImageIndex:i,images:l,boundingBox:u}=t.stagingArea;return{currentStagingAreaImage:l.length>0&&i!==void 0?l[i]:void 0,isOnFirstImage:i===0,isOnLastImage:i===l.length-1,shouldShowStagingImage:n,shouldShowStagingOutline:r,x:(u==null?void 0:u.x)??o.x,y:(u==null?void 0:u.y)??o.y,width:(u==null?void 0:u.width)??s.width,height:(u==null?void 0:u.height)??s.height}},{memoizeOptions:{resultEqualityCheck:Ft}}),lve=e=>{const{...t}=e,{currentStagingAreaImage:n,shouldShowStagingImage:r,shouldShowStagingOutline:o,x:s,y:i,width:l,height:u}=W(ive);return a.jsxs(Ms,{...t,children:[r&&n&&a.jsx(S7,{canvasImage:n}),o&&a.jsxs(Ms,{children:[a.jsx(Os,{x:s,y:i,width:l,height:u,strokeWidth:1,stroke:"white",strokeScaleEnabled:!1}),a.jsx(Os,{x:s,y:i,width:l,height:u,dash:[4,4],strokeWidth:1,stroke:"black",strokeScaleEnabled:!1})]})]})},cve=d.memo(lve),uve=le([Sn],e=>{const{layerState:{stagingArea:{images:t,selectedImageIndex:n}},shouldShowStagingOutline:r,shouldShowStagingImage:o}=e;return{currentIndex:n,total:t.length,currentStagingAreaImage:t.length>0?t[n]:void 0,shouldShowStagingImage:o,shouldShowStagingOutline:r}},Se),dve=()=>{const e=te(),{currentStagingAreaImage:t,shouldShowStagingImage:n,currentIndex:r,total:o}=W(uve),{t:s}=Z(),i=d.useCallback(()=>{e(Fw(!0))},[e]),l=d.useCallback(()=>{e(Fw(!1))},[e]),u=d.useCallback(()=>e(o9()),[e]),p=d.useCallback(()=>e(s9()),[e]),m=d.useCallback(()=>e(a9()),[e]);et(["left"],u,{enabled:()=>!0,preventDefault:!0}),et(["right"],p,{enabled:()=>!0,preventDefault:!0}),et(["enter"],()=>m,{enabled:()=>!0,preventDefault:!0});const{data:h}=to((t==null?void 0:t.imageName)??$r.skipToken),g=d.useCallback(()=>{e(i9(!n))},[e,n]),x=d.useCallback(()=>{h&&e(l9({imageDTO:h}))},[e,h]),y=d.useCallback(()=>{e(c9())},[e]);return t?a.jsxs(L,{pos:"absolute",bottom:4,gap:2,w:"100%",align:"center",justify:"center",onMouseEnter:i,onMouseLeave:l,children:[a.jsxs(Vt,{isAttached:!0,borderRadius:"base",shadow:"dark-lg",children:[a.jsx(Fe,{tooltip:`${s("unifiedCanvas.previous")} (Left)`,"aria-label":`${s("unifiedCanvas.previous")} (Left)`,icon:a.jsx(EJ,{}),onClick:u,colorScheme:"accent",isDisabled:!n}),a.jsx(at,{colorScheme:"base",pointerEvents:"none",isDisabled:!n,minW:20,children:`${r+1}/${o}`}),a.jsx(Fe,{tooltip:`${s("unifiedCanvas.next")} (Right)`,"aria-label":`${s("unifiedCanvas.next")} (Right)`,icon:a.jsx(MJ,{}),onClick:p,colorScheme:"accent",isDisabled:!n})]}),a.jsxs(Vt,{isAttached:!0,borderRadius:"base",shadow:"dark-lg",children:[a.jsx(Fe,{tooltip:`${s("unifiedCanvas.accept")} (Enter)`,"aria-label":`${s("unifiedCanvas.accept")} (Enter)`,icon:a.jsx(iM,{}),onClick:m,colorScheme:"accent"}),a.jsx(Fe,{tooltip:s(n?"unifiedCanvas.showResultsOn":"unifiedCanvas.showResultsOff"),"aria-label":s(n?"unifiedCanvas.showResultsOn":"unifiedCanvas.showResultsOff"),"data-alert":!n,icon:n?a.jsx(VJ,{}):a.jsx(HJ,{}),onClick:g,colorScheme:"accent"}),a.jsx(Fe,{tooltip:s("unifiedCanvas.saveToGallery"),"aria-label":s("unifiedCanvas.saveToGallery"),isDisabled:!h||!h.is_intermediate,icon:a.jsx(lg,{}),onClick:x,colorScheme:"accent"}),a.jsx(Fe,{tooltip:s("unifiedCanvas.discardAll"),"aria-label":s("unifiedCanvas.discardAll"),icon:a.jsx(Ic,{}),onClick:y,colorScheme:"error",fontSize:20})]})]}):null},fve=d.memo(dve),pve=()=>{const e=W(l=>l.canvas.layerState),t=W(l=>l.canvas.boundingBoxCoordinates),n=W(l=>l.canvas.boundingBoxDimensions),r=W(l=>l.canvas.isMaskEnabled),o=W(l=>l.canvas.shouldPreserveMaskedArea),[s,i]=d.useState();return d.useEffect(()=>{i(void 0)},[e,t,n,r,o]),hee(async()=>{const l=await u9(e,t,n,r,o);if(!l)return;const{baseImageData:u,maskImageData:p}=l,m=d9(u,p);i(m)},1e3,[e,t,n,r,o]),s},mve={txt2img:"Text to Image",img2img:"Image to Image",inpaint:"Inpaint",outpaint:"Inpaint"},hve=()=>{const e=pve();return a.jsxs(Ie,{children:["Mode: ",e?mve[e]:"..."]})},gve=d.memo(hve),nc=e=>Math.round(e*100)/100,vve=le([Sn],e=>{const{cursorPosition:t}=e,{cursorX:n,cursorY:r}=t?{cursorX:t.x,cursorY:t.y}:{cursorX:-1,cursorY:-1};return{cursorCoordinatesString:`(${nc(n)}, ${nc(r)})`}},{memoizeOptions:{resultEqualityCheck:Ft}});function xve(){const{cursorCoordinatesString:e}=W(vve),{t}=Z();return a.jsx(Ie,{children:`${t("unifiedCanvas.cursorPosition")}: ${e}`})}const Tx="var(--invokeai-colors-warning-500)",bve=le([Sn],e=>{const{stageDimensions:{width:t,height:n},stageCoordinates:{x:r,y:o},boundingBoxDimensions:{width:s,height:i},scaledBoundingBoxDimensions:{width:l,height:u},boundingBoxCoordinates:{x:p,y:m},stageScale:h,shouldShowCanvasDebugInfo:g,layer:x,boundingBoxScaleMethod:y,shouldPreserveMaskedArea:b}=e;let w="inherit";return(y==="none"&&(s<512||i<512)||y==="manual"&&l*u<512*512)&&(w=Tx),{activeLayerColor:x==="mask"?Tx:"inherit",activeLayerString:x.charAt(0).toUpperCase()+x.slice(1),boundingBoxColor:w,boundingBoxCoordinatesString:`(${nc(p)}, ${nc(m)})`,boundingBoxDimensionsString:`${s}×${i}`,scaledBoundingBoxDimensionsString:`${l}×${u}`,canvasCoordinatesString:`${nc(r)}×${nc(o)}`,canvasDimensionsString:`${t}×${n}`,canvasScaleString:Math.round(h*100),shouldShowCanvasDebugInfo:g,shouldShowBoundingBox:y!=="auto",shouldShowScaledBoundingBox:y!=="none",shouldPreserveMaskedArea:b}},{memoizeOptions:{resultEqualityCheck:Ft}}),yve=()=>{const{activeLayerColor:e,activeLayerString:t,boundingBoxColor:n,boundingBoxCoordinatesString:r,boundingBoxDimensionsString:o,scaledBoundingBoxDimensionsString:s,shouldShowScaledBoundingBox:i,canvasCoordinatesString:l,canvasDimensionsString:u,canvasScaleString:p,shouldShowCanvasDebugInfo:m,shouldShowBoundingBox:h,shouldPreserveMaskedArea:g}=W(bve),{t:x}=Z();return a.jsxs(L,{sx:{flexDirection:"column",position:"absolute",top:0,insetInlineStart:0,opacity:.65,display:"flex",fontSize:"sm",padding:1,px:2,minWidth:48,margin:1,borderRadius:"base",pointerEvents:"none",bg:"base.200",_dark:{bg:"base.800"}},children:[a.jsx(gve,{}),a.jsx(Ie,{style:{color:e},children:`${x("unifiedCanvas.activeLayer")}: ${t}`}),a.jsx(Ie,{children:`${x("unifiedCanvas.canvasScale")}: ${p}%`}),g&&a.jsx(Ie,{style:{color:Tx},children:"Preserve Masked Area: On"}),h&&a.jsx(Ie,{style:{color:n},children:`${x("unifiedCanvas.boundingBox")}: ${o}`}),i&&a.jsx(Ie,{style:{color:n},children:`${x("unifiedCanvas.scaledBoundingBox")}: ${s}`}),m&&a.jsxs(a.Fragment,{children:[a.jsx(Ie,{children:`${x("unifiedCanvas.boundingBoxPosition")}: ${r}`}),a.jsx(Ie,{children:`${x("unifiedCanvas.canvasDimensions")}: ${u}`}),a.jsx(Ie,{children:`${x("unifiedCanvas.canvasPosition")}: ${l}`}),a.jsx(xve,{})]})]})},Cve=d.memo(yve),wve=le([xe],({canvas:e,generation:t})=>{const{boundingBoxCoordinates:n,boundingBoxDimensions:r,stageScale:o,isDrawing:s,isTransformingBoundingBox:i,isMovingBoundingBox:l,tool:u,shouldSnapToGrid:p}=e,{aspectRatio:m}=t;return{boundingBoxCoordinates:n,boundingBoxDimensions:r,isDrawing:s,isMovingBoundingBox:l,isTransformingBoundingBox:i,stageScale:o,shouldSnapToGrid:p,tool:u,hitStrokeWidth:20/o,aspectRatio:m}},{memoizeOptions:{resultEqualityCheck:Ft}}),Sve=e=>{const{...t}=e,n=te(),{boundingBoxCoordinates:r,boundingBoxDimensions:o,isDrawing:s,isMovingBoundingBox:i,isTransformingBoundingBox:l,stageScale:u,shouldSnapToGrid:p,tool:m,hitStrokeWidth:h,aspectRatio:g}=W(wve),x=d.useRef(null),y=d.useRef(null),[b,w]=d.useState(!1);d.useEffect(()=>{var B;!x.current||!y.current||(x.current.nodes([y.current]),(B=x.current.getLayer())==null||B.batchDraw())},[]);const S=64*u;et("N",()=>{n(nm(!p))});const j=d.useCallback(B=>{if(!p){n(tv({x:Math.floor(B.target.x()),y:Math.floor(B.target.y())}));return}const V=B.target.x(),U=B.target.y(),N=wr(V,64),$=wr(U,64);B.target.x(N),B.target.y($),n(tv({x:N,y:$}))},[n,p]),_=d.useCallback(()=>{if(!y.current)return;const B=y.current,V=B.scaleX(),U=B.scaleY(),N=Math.round(B.width()*V),$=Math.round(B.height()*U),q=Math.round(B.x()),F=Math.round(B.y());if(g){const Q=wr(N/g,64);n(Vo({width:N,height:Q}))}else n(Vo({width:N,height:$}));n(tv({x:p?Mu(q,64):q,y:p?Mu(F,64):F})),B.scaleX(1),B.scaleY(1)},[n,p,g]),E=d.useCallback((B,V,U)=>{const N=B.x%S,$=B.y%S;return{x:Mu(V.x,S)+N,y:Mu(V.y,S)+$}},[S]),I=d.useCallback(()=>{n(nv(!0))},[n]),M=d.useCallback(()=>{n(nv(!1)),n(rv(!1)),n(Yf(!1)),w(!1)},[n]),R=d.useCallback(()=>{n(rv(!0))},[n]),D=d.useCallback(()=>{n(nv(!1)),n(rv(!1)),n(Yf(!1)),w(!1)},[n]),A=d.useCallback(()=>{w(!0)},[]),O=d.useCallback(()=>{!l&&!i&&w(!1)},[i,l]),T=d.useCallback(()=>{n(Yf(!0))},[n]),X=d.useCallback(()=>{n(Yf(!1))},[n]);return a.jsxs(Ms,{...t,children:[a.jsx(Os,{height:o.height,width:o.width,x:r.x,y:r.y,onMouseEnter:T,onMouseOver:T,onMouseLeave:X,onMouseOut:X}),a.jsx(Os,{draggable:!0,fillEnabled:!1,height:o.height,hitStrokeWidth:h,listening:!s&&m==="move",onDragStart:R,onDragEnd:D,onDragMove:j,onMouseDown:R,onMouseOut:O,onMouseOver:A,onMouseEnter:A,onMouseUp:D,onTransform:_,onTransformEnd:M,ref:y,stroke:b?"rgba(255,255,255,0.7)":"white",strokeWidth:(b?8:1)/u,width:o.width,x:r.x,y:r.y}),a.jsx(S0e,{anchorCornerRadius:3,anchorDragBoundFunc:E,anchorFill:"rgba(212,216,234,1)",anchorSize:15,anchorStroke:"rgb(42,42,42)",borderDash:[4,4],borderEnabled:!0,borderStroke:"black",draggable:!1,enabledAnchors:m==="move"?void 0:[],flipEnabled:!1,ignoreStroke:!0,keepRatio:!1,listening:!s&&m==="move",onDragStart:R,onDragEnd:D,onMouseDown:I,onMouseUp:M,onTransformEnd:M,ref:x,rotateEnabled:!1})]})},kve=d.memo(Sve),jve=le(Sn,e=>{const{cursorPosition:t,brushSize:n,colorPickerColor:r,maskColor:o,brushColor:s,tool:i,layer:l,shouldShowBrush:u,isMovingBoundingBox:p,isTransformingBoundingBox:m,stageScale:h,stageDimensions:g,boundingBoxCoordinates:x,boundingBoxDimensions:y,shouldRestrictStrokesToBox:b}=e,w=b?{clipX:x.x,clipY:x.y,clipWidth:y.width,clipHeight:y.height}:{};return{cursorPosition:t,brushX:t?t.x:g.width/2,brushY:t?t.y:g.height/2,radius:n/2,colorPickerOuterRadius:Bw/h,colorPickerInnerRadius:(Bw-x1+1)/h,maskColorString:Fi({...o,a:.5}),brushColorString:Fi(s),colorPickerColorString:Fi(r),tool:i,layer:l,shouldShowBrush:u,shouldDrawBrushPreview:!(p||m||!t)&&u,strokeWidth:1.5/h,dotRadius:1.5/h,clip:w}},{memoizeOptions:{resultEqualityCheck:Ft}}),_ve=e=>{const{...t}=e,{brushX:n,brushY:r,radius:o,maskColorString:s,tool:i,layer:l,shouldDrawBrushPreview:u,dotRadius:p,strokeWidth:m,brushColorString:h,colorPickerColorString:g,colorPickerInnerRadius:x,colorPickerOuterRadius:y,clip:b}=W(jve);return u?a.jsxs(Ms,{listening:!1,...b,...t,children:[i==="colorPicker"?a.jsxs(a.Fragment,{children:[a.jsx(ji,{x:n,y:r,radius:y,stroke:h,strokeWidth:x1,strokeScaleEnabled:!1}),a.jsx(ji,{x:n,y:r,radius:x,stroke:g,strokeWidth:x1,strokeScaleEnabled:!1})]}):a.jsxs(a.Fragment,{children:[a.jsx(ji,{x:n,y:r,radius:o,fill:l==="mask"?s:h,globalCompositeOperation:i==="eraser"?"destination-out":"source-out"}),a.jsx(ji,{x:n,y:r,radius:o,stroke:"rgba(255,255,255,0.4)",strokeWidth:m*2,strokeEnabled:!0,listening:!1}),a.jsx(ji,{x:n,y:r,radius:o,stroke:"rgba(0,0,0,1)",strokeWidth:m,strokeEnabled:!0,listening:!1})]}),a.jsx(ji,{x:n,y:r,radius:p*2,fill:"rgba(255,255,255,0.4)",listening:!1}),a.jsx(ji,{x:n,y:r,radius:p,fill:"rgba(0,0,0,1)",listening:!1})]}):null},Ive=d.memo(_ve),Pve=le([Sn,Eo],(e,t)=>{const{isMaskEnabled:n,stageScale:r,shouldShowBoundingBox:o,isTransformingBoundingBox:s,isMouseOverBoundingBox:i,isMovingBoundingBox:l,stageDimensions:u,stageCoordinates:p,tool:m,isMovingStage:h,shouldShowIntermediates:g,shouldShowGrid:x,shouldRestrictStrokesToBox:y,shouldAntialias:b}=e;let w="none";return m==="move"||t?h?w="grabbing":w="grab":s?w=void 0:y&&!i&&(w="default"),{isMaskEnabled:n,isModifyingBoundingBox:s||l,shouldShowBoundingBox:o,shouldShowGrid:x,stageCoordinates:p,stageCursor:w,stageDimensions:u,stageScale:r,tool:m,isStaging:t,shouldShowIntermediates:g,shouldAntialias:b}},Se),Eve=we(k0e,{shouldForwardProp:e=>!["sx"].includes(e)}),Mve=()=>{const{isMaskEnabled:e,isModifyingBoundingBox:t,shouldShowBoundingBox:n,shouldShowGrid:r,stageCoordinates:o,stageCursor:s,stageDimensions:i,stageScale:l,tool:u,isStaging:p,shouldShowIntermediates:m,shouldAntialias:h}=W(Pve);P0e();const g=te(),x=d.useRef(null),y=d.useRef(null),b=d.useRef(null),w=d.useCallback(B=>{f9(B),y.current=B},[]),S=d.useCallback(B=>{p9(B),b.current=B},[]),j=d.useRef({x:0,y:0}),_=d.useRef(!1),E=$0e(y),I=M0e(y),M=T0e(y,_),R=R0e(y,_,j),D=D0e(),{handleDragStart:A,handleDragMove:O,handleDragEnd:T}=_0e(),X=d.useCallback(B=>B.evt.preventDefault(),[]);return d.useEffect(()=>{if(!x.current)return;const B=new ResizeObserver(N=>{for(const $ of N)if($.contentBoxSize){const{width:q,height:F}=$.contentRect;g(Hw({width:q,height:F}))}});B.observe(x.current);const{width:V,height:U}=x.current.getBoundingClientRect();return g(Hw({width:V,height:U})),()=>{B.disconnect()}},[g]),a.jsxs(L,{id:"canvas-container",ref:x,sx:{position:"relative",height:"100%",width:"100%",borderRadius:"base"},children:[a.jsx(Ie,{sx:{position:"absolute"},children:a.jsxs(Eve,{tabIndex:-1,ref:w,sx:{outline:"none",overflow:"hidden",cursor:s||void 0,canvas:{outline:"none"}},x:o.x,y:o.y,width:i.width,height:i.height,scale:{x:l,y:l},onTouchStart:I,onTouchMove:R,onTouchEnd:M,onMouseDown:I,onMouseLeave:D,onMouseMove:R,onMouseUp:M,onDragStart:A,onDragMove:O,onDragEnd:T,onContextMenu:X,onWheel:E,draggable:(u==="move"||p)&&!t,children:[a.jsx(Eu,{id:"grid",visible:r,children:a.jsx(V0e,{})}),a.jsx(Eu,{id:"base",ref:S,listening:!1,imageSmoothingEnabled:h,children:a.jsx(ave,{})}),a.jsxs(Eu,{id:"mask",visible:e&&!p,listening:!1,children:[a.jsx(Z0e,{visible:!0,listening:!1}),a.jsx(X0e,{listening:!1})]}),a.jsx(Eu,{children:a.jsx(F0e,{})}),a.jsxs(Eu,{id:"preview",imageSmoothingEnabled:h,children:[!p&&a.jsx(Ive,{visible:u!=="move",listening:!1}),a.jsx(cve,{visible:p}),m&&a.jsx(G0e,{}),a.jsx(kve,{visible:n&&!p})]})]})}),a.jsx(Cve,{}),a.jsx(fve,{})]})},Ove=d.memo(Mve);function Rve(e,t,n=250){const[r,o]=d.useState(0);return d.useEffect(()=>{const s=setTimeout(()=>{r===1&&e(),o(0)},n);return r===2&&t(),()=>clearTimeout(s)},[r,e,t,n]),()=>o(s=>s+1)}const n1={width:6,height:6,borderColor:"base.100"},Dve={".react-colorful__hue-pointer":n1,".react-colorful__saturation-pointer":n1,".react-colorful__alpha-pointer":n1},Ave=e=>a.jsx(Ie,{sx:Dve,children:a.jsx(CO,{...e})}),k7=d.memo(Ave),Tve=le([Sn,Eo],(e,t)=>{const{maskColor:n,layer:r,isMaskEnabled:o,shouldPreserveMaskedArea:s}=e;return{layer:r,maskColor:n,maskColorString:Fi(n),isMaskEnabled:o,shouldPreserveMaskedArea:s,isStaging:t}},{memoizeOptions:{resultEqualityCheck:Ft}}),Nve=()=>{const e=te(),{t}=Z(),{layer:n,maskColor:r,isMaskEnabled:o,shouldPreserveMaskedArea:s,isStaging:i}=W(Tve);et(["q"],()=>{l()},{enabled:()=>!i,preventDefault:!0},[n]),et(["shift+c"],()=>{u()},{enabled:()=>!i,preventDefault:!0},[]),et(["h"],()=>{p()},{enabled:()=>!i,preventDefault:!0},[o]);const l=()=>{e(XI(n==="mask"?"base":"mask"))},u=()=>e(GI()),p=()=>e(ib(!o)),m=async()=>{e(g9())};return a.jsx(qd,{triggerComponent:a.jsx(Vt,{children:a.jsx(Fe,{"aria-label":t("unifiedCanvas.maskingOptions"),tooltip:t("unifiedCanvas.maskingOptions"),icon:a.jsx(hM,{}),isChecked:n==="mask",isDisabled:i})}),children:a.jsxs(L,{direction:"column",gap:2,children:[a.jsx(br,{label:`${t("unifiedCanvas.enableMask")} (H)`,isChecked:o,onChange:p}),a.jsx(br,{label:t("unifiedCanvas.preserveMaskedArea"),isChecked:s,onChange:h=>e(m9(h.target.checked))}),a.jsx(Ie,{sx:{paddingTop:2,paddingBottom:2},children:a.jsx(k7,{color:r,onChange:h=>e(h9(h))})}),a.jsx(at,{size:"sm",leftIcon:a.jsx(lg,{}),onClick:m,children:"Save Mask"}),a.jsxs(at,{size:"sm",leftIcon:a.jsx(Br,{}),onClick:u,children:[t("unifiedCanvas.clearMask")," (Shift+C)"]})]})})},$ve=d.memo(Nve),Lve=le([xe,Jn],({canvas:e},t)=>{const{futureLayerStates:n}=e;return{canRedo:n.length>0,activeTabName:t}},{memoizeOptions:{resultEqualityCheck:Ft}});function zve(){const e=te(),{canRedo:t,activeTabName:n}=W(Lve),{t:r}=Z(),o=()=>{e(v9())};return et(["meta+shift+z","ctrl+shift+z","control+y","meta+y"],()=>{o()},{enabled:()=>t,preventDefault:!0},[n,t]),a.jsx(Fe,{"aria-label":`${r("unifiedCanvas.redo")} (Ctrl+Shift+Z)`,tooltip:`${r("unifiedCanvas.redo")} (Ctrl+Shift+Z)`,icon:a.jsx(nee,{}),onClick:o,isDisabled:!t})}const Fve=()=>{const e=W(Eo),t=te(),{t:n}=Z();return a.jsxs(kg,{title:n("unifiedCanvas.clearCanvasHistory"),acceptCallback:()=>t(x9()),acceptButtonText:n("unifiedCanvas.clearHistory"),triggerComponent:a.jsx(at,{size:"sm",leftIcon:a.jsx(Br,{}),isDisabled:e,children:n("unifiedCanvas.clearCanvasHistory")}),children:[a.jsx("p",{children:n("unifiedCanvas.clearCanvasHistoryMessage")}),a.jsx("br",{}),a.jsx("p",{children:n("unifiedCanvas.clearCanvasHistoryConfirm")})]})},Bve=d.memo(Fve),Hve=le([Sn],e=>{const{shouldAutoSave:t,shouldCropToBoundingBoxOnSave:n,shouldDarkenOutsideBoundingBox:r,shouldShowCanvasDebugInfo:o,shouldShowGrid:s,shouldShowIntermediates:i,shouldSnapToGrid:l,shouldRestrictStrokesToBox:u,shouldAntialias:p}=e;return{shouldAutoSave:t,shouldCropToBoundingBoxOnSave:n,shouldDarkenOutsideBoundingBox:r,shouldShowCanvasDebugInfo:o,shouldShowGrid:s,shouldShowIntermediates:i,shouldSnapToGrid:l,shouldRestrictStrokesToBox:u,shouldAntialias:p}},{memoizeOptions:{resultEqualityCheck:Ft}}),Vve=()=>{const e=te(),{t}=Z(),{shouldAutoSave:n,shouldCropToBoundingBoxOnSave:r,shouldDarkenOutsideBoundingBox:o,shouldShowCanvasDebugInfo:s,shouldShowGrid:i,shouldShowIntermediates:l,shouldSnapToGrid:u,shouldRestrictStrokesToBox:p,shouldAntialias:m}=W(Hve);et(["n"],()=>{e(nm(!u))},{enabled:!0,preventDefault:!0},[u]);const h=g=>e(nm(g.target.checked));return a.jsx(qd,{isLazy:!1,triggerComponent:a.jsx(Fe,{tooltip:t("unifiedCanvas.canvasSettings"),"aria-label":t("unifiedCanvas.canvasSettings"),icon:a.jsx(yM,{})}),children:a.jsxs(L,{direction:"column",gap:2,children:[a.jsx(br,{label:t("unifiedCanvas.showIntermediates"),isChecked:l,onChange:g=>e(b9(g.target.checked))}),a.jsx(br,{label:t("unifiedCanvas.showGrid"),isChecked:i,onChange:g=>e(y9(g.target.checked))}),a.jsx(br,{label:t("unifiedCanvas.snapToGrid"),isChecked:u,onChange:h}),a.jsx(br,{label:t("unifiedCanvas.darkenOutsideSelection"),isChecked:o,onChange:g=>e(C9(g.target.checked))}),a.jsx(br,{label:t("unifiedCanvas.autoSaveToGallery"),isChecked:n,onChange:g=>e(w9(g.target.checked))}),a.jsx(br,{label:t("unifiedCanvas.saveBoxRegionOnly"),isChecked:r,onChange:g=>e(S9(g.target.checked))}),a.jsx(br,{label:t("unifiedCanvas.limitStrokesToBox"),isChecked:p,onChange:g=>e(k9(g.target.checked))}),a.jsx(br,{label:t("unifiedCanvas.showCanvasDebugInfo"),isChecked:s,onChange:g=>e(j9(g.target.checked))}),a.jsx(br,{label:t("unifiedCanvas.antialiasing"),isChecked:m,onChange:g=>e(_9(g.target.checked))}),a.jsx(Bve,{})]})})},Wve=d.memo(Vve),Uve=le([xe,Eo],({canvas:e},t)=>{const{tool:n,brushColor:r,brushSize:o}=e;return{tool:n,isStaging:t,brushColor:r,brushSize:o}},{memoizeOptions:{resultEqualityCheck:Ft}}),Gve=()=>{const e=te(),{tool:t,brushColor:n,brushSize:r,isStaging:o}=W(Uve),{t:s}=Z();et(["b"],()=>{i()},{enabled:()=>!o,preventDefault:!0},[]),et(["e"],()=>{l()},{enabled:()=>!o,preventDefault:!0},[t]),et(["c"],()=>{u()},{enabled:()=>!o,preventDefault:!0},[t]),et(["shift+f"],()=>{p()},{enabled:()=>!o,preventDefault:!0}),et(["delete","backspace"],()=>{m()},{enabled:()=>!o,preventDefault:!0}),et(["BracketLeft"],()=>{r-5<=5?e(Zf(Math.max(r-1,1))):e(Zf(Math.max(r-5,1)))},{enabled:()=>!o,preventDefault:!0},[r]),et(["BracketRight"],()=>{e(Zf(Math.min(r+5,500)))},{enabled:()=>!o,preventDefault:!0},[r]),et(["Shift+BracketLeft"],()=>{e(ov({...n,a:Bi(n.a-.05,.05,1)}))},{enabled:()=>!o,preventDefault:!0},[n]),et(["Shift+BracketRight"],()=>{e(ov({...n,a:Bi(n.a+.05,.05,1)}))},{enabled:()=>!o,preventDefault:!0},[n]);const i=()=>e(oc("brush")),l=()=>e(oc("eraser")),u=()=>e(oc("colorPicker")),p=()=>e(I9()),m=()=>e(P9());return a.jsxs(Vt,{isAttached:!0,children:[a.jsx(Fe,{"aria-label":`${s("unifiedCanvas.brush")} (B)`,tooltip:`${s("unifiedCanvas.brush")} (B)`,icon:a.jsx(ZJ,{}),isChecked:t==="brush"&&!o,onClick:i,isDisabled:o}),a.jsx(Fe,{"aria-label":`${s("unifiedCanvas.eraser")} (E)`,tooltip:`${s("unifiedCanvas.eraser")} (E)`,icon:a.jsx(LJ,{}),isChecked:t==="eraser"&&!o,isDisabled:o,onClick:l}),a.jsx(Fe,{"aria-label":`${s("unifiedCanvas.fillBoundingBox")} (Shift+F)`,tooltip:`${s("unifiedCanvas.fillBoundingBox")} (Shift+F)`,icon:a.jsx(WJ,{}),isDisabled:o,onClick:p}),a.jsx(Fe,{"aria-label":`${s("unifiedCanvas.eraseBoundingBox")} (Del/Backspace)`,tooltip:`${s("unifiedCanvas.eraseBoundingBox")} (Del/Backspace)`,icon:a.jsx(Vc,{style:{transform:"rotate(45deg)"}}),isDisabled:o,onClick:m}),a.jsx(Fe,{"aria-label":`${s("unifiedCanvas.colorPicker")} (C)`,tooltip:`${s("unifiedCanvas.colorPicker")} (C)`,icon:a.jsx(BJ,{}),isChecked:t==="colorPicker"&&!o,isDisabled:o,onClick:u}),a.jsx(qd,{triggerComponent:a.jsx(Fe,{"aria-label":s("unifiedCanvas.brushOptions"),tooltip:s("unifiedCanvas.brushOptions"),icon:a.jsx(xM,{})}),children:a.jsxs(L,{minWidth:60,direction:"column",gap:4,width:"100%",children:[a.jsx(L,{gap:4,justifyContent:"space-between",children:a.jsx(tt,{label:s("unifiedCanvas.brushSize"),value:r,withInput:!0,onChange:h=>e(Zf(h)),sliderNumberInputProps:{max:500}})}),a.jsx(Ie,{sx:{width:"100%",paddingTop:2,paddingBottom:2},children:a.jsx(k7,{color:n,onChange:h=>e(ov(h))})})]})})]})},Kve=d.memo(Gve),qve=le([xe,Jn],({canvas:e},t)=>{const{pastLayerStates:n}=e;return{canUndo:n.length>0,activeTabName:t}},{memoizeOptions:{resultEqualityCheck:Ft}});function Xve(){const e=te(),{t}=Z(),{canUndo:n,activeTabName:r}=W(qve),o=()=>{e(E9())};return et(["meta+z","ctrl+z"],()=>{o()},{enabled:()=>n,preventDefault:!0},[r,n]),a.jsx(Fe,{"aria-label":`${t("unifiedCanvas.undo")} (Ctrl+Z)`,tooltip:`${t("unifiedCanvas.undo")} (Ctrl+Z)`,icon:a.jsx(Ud,{}),onClick:o,isDisabled:!n})}const Qve=le([xe,Eo],({canvas:e},t)=>{const{tool:n,shouldCropToBoundingBoxOnSave:r,layer:o,isMaskEnabled:s}=e;return{isStaging:t,isMaskEnabled:s,tool:n,layer:o,shouldCropToBoundingBoxOnSave:r}},{memoizeOptions:{resultEqualityCheck:Ft}}),Yve=()=>{const e=te(),{isStaging:t,isMaskEnabled:n,layer:r,tool:o}=W(Qve),s=v1(),{t:i}=Z(),{isClipboardAPIAvailable:l}=L8(),{getUploadButtonProps:u,getUploadInputProps:p}=Vy({postUploadAction:{type:"SET_CANVAS_INITIAL_IMAGE"}});et(["v"],()=>{m()},{enabled:()=>!t,preventDefault:!0},[]),et(["r"],()=>{g()},{enabled:()=>!0,preventDefault:!0},[s]),et(["shift+m"],()=>{y()},{enabled:()=>!t,preventDefault:!0},[s]),et(["shift+s"],()=>{b()},{enabled:()=>!t,preventDefault:!0},[s]),et(["meta+c","ctrl+c"],()=>{w()},{enabled:()=>!t&&l,preventDefault:!0},[s,l]),et(["shift+d"],()=>{S()},{enabled:()=>!t,preventDefault:!0},[s]);const m=()=>e(oc("move")),h=Rve(()=>g(!1),()=>g(!0)),g=(_=!1)=>{const E=v1();if(!E)return;const I=E.getClientRect({skipTransform:!0});e(O9({contentRect:I,shouldScaleTo1:_}))},x=()=>{e(aI())},y=()=>{e(R9())},b=()=>{e(D9())},w=()=>{l&&e(A9())},S=()=>{e(T9())},j=_=>{const E=_;e(XI(E)),E==="mask"&&!n&&e(ib(!0))};return a.jsxs(L,{sx:{alignItems:"center",gap:2,flexWrap:"wrap"},children:[a.jsx(Ie,{w:24,children:a.jsx(Pn,{tooltip:`${i("unifiedCanvas.layer")} (Q)`,value:r,data:M9,onChange:j,disabled:t})}),a.jsx($ve,{}),a.jsx(Kve,{}),a.jsxs(Vt,{isAttached:!0,children:[a.jsx(Fe,{"aria-label":`${i("unifiedCanvas.move")} (V)`,tooltip:`${i("unifiedCanvas.move")} (V)`,icon:a.jsx(OJ,{}),isChecked:o==="move"||t,onClick:m}),a.jsx(Fe,{"aria-label":`${i("unifiedCanvas.resetView")} (R)`,tooltip:`${i("unifiedCanvas.resetView")} (R)`,icon:a.jsx(TJ,{}),onClick:h})]}),a.jsxs(Vt,{isAttached:!0,children:[a.jsx(Fe,{"aria-label":`${i("unifiedCanvas.mergeVisible")} (Shift+M)`,tooltip:`${i("unifiedCanvas.mergeVisible")} (Shift+M)`,icon:a.jsx(XJ,{}),onClick:y,isDisabled:t}),a.jsx(Fe,{"aria-label":`${i("unifiedCanvas.saveToGallery")} (Shift+S)`,tooltip:`${i("unifiedCanvas.saveToGallery")} (Shift+S)`,icon:a.jsx(lg,{}),onClick:b,isDisabled:t}),l&&a.jsx(Fe,{"aria-label":`${i("unifiedCanvas.copyToClipboard")} (Cmd/Ctrl+C)`,tooltip:`${i("unifiedCanvas.copyToClipboard")} (Cmd/Ctrl+C)`,icon:a.jsx(Hc,{}),onClick:w,isDisabled:t}),a.jsx(Fe,{"aria-label":`${i("unifiedCanvas.downloadAsImage")} (Shift+D)`,tooltip:`${i("unifiedCanvas.downloadAsImage")} (Shift+D)`,icon:a.jsx(ig,{}),onClick:S,isDisabled:t})]}),a.jsxs(Vt,{isAttached:!0,children:[a.jsx(Xve,{}),a.jsx(zve,{})]}),a.jsxs(Vt,{isAttached:!0,children:[a.jsx(Fe,{"aria-label":`${i("common.upload")}`,tooltip:`${i("common.upload")}`,icon:a.jsx(cg,{}),isDisabled:t,...u()}),a.jsx("input",{...p()}),a.jsx(Fe,{"aria-label":`${i("unifiedCanvas.clearCanvas")}`,tooltip:`${i("unifiedCanvas.clearCanvas")}`,icon:a.jsx(Br,{}),onClick:x,colorScheme:"error",isDisabled:t})]}),a.jsx(Vt,{isAttached:!0,children:a.jsx(Wve,{})})]})},Zve=d.memo(Yve),H_={id:"canvas-intial-image",actionType:"SET_CANVAS_INITIAL_IMAGE"},Jve=()=>{const{isOver:e,setNodeRef:t,active:n}=e8({id:"unifiedCanvas",data:H_});return a.jsxs(L,{layerStyle:"first",ref:t,tabIndex:-1,sx:{flexDirection:"column",alignItems:"center",gap:4,p:2,borderRadius:"base",w:"full",h:"full"},children:[a.jsx(Zve,{}),a.jsx(Ove,{}),t8(H_,n)&&a.jsx(n8,{isOver:e,label:"Set Canvas Initial Image"})]})},e1e=d.memo(Jve),t1e=()=>a.jsx(e1e,{}),n1e=d.memo(t1e),r1e=[{id:"txt2img",translationKey:"common.txt2img",icon:a.jsx(Nn,{as:UJ,sx:{boxSize:6,pointerEvents:"none"}}),content:a.jsx(yge,{})},{id:"img2img",translationKey:"common.img2img",icon:a.jsx(Nn,{as:Yi,sx:{boxSize:6,pointerEvents:"none"}}),content:a.jsx(Rfe,{})},{id:"unifiedCanvas",translationKey:"common.unifiedCanvas",icon:a.jsx(Nn,{as:joe,sx:{boxSize:6,pointerEvents:"none"}}),content:a.jsx(n1e,{})},{id:"nodes",translationKey:"common.nodes",icon:a.jsx(Nn,{as:Wy,sx:{boxSize:6,pointerEvents:"none"}}),content:a.jsx(Ehe,{})},{id:"modelManager",translationKey:"modelManager.modelManager",icon:a.jsx(Nn,{as:NJ,sx:{boxSize:6,pointerEvents:"none"}}),content:a.jsx(Mpe,{})},{id:"queue",translationKey:"queue.queue",icon:a.jsx(Nn,{as:aee,sx:{boxSize:6,pointerEvents:"none"}}),content:a.jsx(xge,{})}],o1e=le([xe],({config:e})=>{const{disabledTabs:t}=e;return r1e.filter(r=>!t.includes(r.id))},{memoizeOptions:{resultEqualityCheck:Ft}}),s1e=448,a1e=448,i1e=360,l1e=["modelManager","queue"],c1e=["modelManager","queue"],u1e=()=>{const e=W(N9),t=W(Jn),n=W(o1e),{t:r}=Z(),o=te(),s=d.useCallback(O=>{O.target instanceof HTMLElement&&O.target.blur()},[]),i=d.useMemo(()=>n.map(O=>a.jsx(Ht,{hasArrow:!0,label:String(r(O.translationKey)),placement:"end",children:a.jsxs(Tr,{onClick:s,children:[a.jsx(f5,{children:String(r(O.translationKey))}),O.icon]})},O.id)),[n,r,s]),l=d.useMemo(()=>n.map(O=>a.jsx(So,{children:O.content},O.id)),[n]),u=d.useCallback(O=>{const T=n[O];T&&o(Xs(T.id))},[o,n]),{minSize:p,isCollapsed:m,setIsCollapsed:h,ref:g,reset:x,expand:y,collapse:b,toggle:w}=Zj(s1e,"pixels"),{ref:S,minSize:j,isCollapsed:_,setIsCollapsed:E,reset:I,expand:M,collapse:R,toggle:D}=Zj(i1e,"pixels");et("f",()=>{_||m?(M(),y()):(b(),R())},[o,_,m]),et(["t","o"],()=>{w()},[o]),et("g",()=>{D()},[o]);const A=Jy();return a.jsxs(rl,{variant:"appTabs",defaultIndex:e,index:e,onChange:u,sx:{flexGrow:1,gap:4},isLazy:!0,children:[a.jsxs(ol,{sx:{pt:2,gap:4,flexDir:"column"},children:[i,a.jsx(ba,{})]}),a.jsxs(Ig,{id:"app",autoSaveId:"app",direction:"horizontal",style:{height:"100%",width:"100%"},storage:A,units:"pixels",children:[!c1e.includes(t)&&a.jsxs(a.Fragment,{children:[a.jsx(Qa,{order:0,id:"side",ref:g,defaultSize:p,minSize:p,onCollapse:h,collapsible:!0,children:t==="nodes"?a.jsx(kie,{}):a.jsx(tfe,{})}),a.jsx(lh,{onDoubleClick:x,collapsedDirection:m?"left":void 0}),a.jsx(Pie,{isSidePanelCollapsed:m,sidePanelRef:g})]}),a.jsx(Qa,{id:"main",order:1,minSize:a1e,children:a.jsx(zc,{style:{height:"100%",width:"100%"},children:l})}),!l1e.includes(t)&&a.jsxs(a.Fragment,{children:[a.jsx(lh,{onDoubleClick:I,collapsedDirection:_?"right":void 0}),a.jsx(Qa,{id:"gallery",ref:S,order:2,defaultSize:j,minSize:j,onCollapse:E,collapsible:!0,children:a.jsx(tse,{})}),a.jsx(_ie,{isGalleryCollapsed:_,galleryPanelRef:S})]})]})]})},d1e=d.memo(u1e),f1e=d.createContext(null),r1={didCatch:!1,error:null};class p1e extends d.Component{constructor(t){super(t),this.resetErrorBoundary=this.resetErrorBoundary.bind(this),this.state=r1}static getDerivedStateFromError(t){return{didCatch:!0,error:t}}resetErrorBoundary(){const{error:t}=this.state;if(t!==null){for(var n,r,o=arguments.length,s=new Array(o),i=0;i0&&arguments[0]!==void 0?arguments[0]:[],t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];return e.length!==t.length||e.some((n,r)=>!Object.is(n,t[r]))}function h1e(e={}){let t;if(e.repoUrl)t=e.repoUrl;else if(e.user&&e.repo)t=`https://github.com/${e.user}/${e.repo}`;else throw new Error("You need to specify either the `repoUrl` option or both the `user` and `repo` options");const n=new URL(`${t}/issues/new`),r=["body","title","labels","template","milestone","assignee","projects"];for(const o of r){let s=e[o];if(s!==void 0){if(o==="labels"||o==="projects"){if(!Array.isArray(s))throw new TypeError(`The \`${o}\` option should be an array`);s=s.join(",")}n.searchParams.set(o,s)}}return n.toString()}const g1e=[EvalError,RangeError,ReferenceError,SyntaxError,TypeError,URIError,globalThis.DOMException,globalThis.AssertionError,globalThis.SystemError].filter(Boolean).map(e=>[e.name,e]),v1e=new Map(g1e),x1e=[{property:"name",enumerable:!1},{property:"message",enumerable:!1},{property:"stack",enumerable:!1},{property:"code",enumerable:!0},{property:"cause",enumerable:!1}],Nx=new WeakSet,b1e=e=>{Nx.add(e);const t=e.toJSON();return Nx.delete(e),t},y1e=e=>v1e.get(e)??Error,j7=({from:e,seen:t,to:n,forceEnumerable:r,maxDepth:o,depth:s,useToJSON:i,serialize:l})=>{if(!n)if(Array.isArray(e))n=[];else if(!l&&V_(e)){const p=y1e(e.name);n=new p}else n={};if(t.push(e),s>=o)return n;if(i&&typeof e.toJSON=="function"&&!Nx.has(e))return b1e(e);const u=p=>j7({from:p,seen:[...t],forceEnumerable:r,maxDepth:o,depth:s,useToJSON:i,serialize:l});for(const[p,m]of Object.entries(e)){if(typeof Buffer=="function"&&Buffer.isBuffer(m)){n[p]="[object Buffer]";continue}if(m!==null&&typeof m=="object"&&typeof m.pipe=="function"){n[p]="[object Stream]";continue}if(typeof m!="function"){if(!m||typeof m!="object"){n[p]=m;continue}if(!t.includes(e[p])){s++,n[p]=u(e[p]);continue}n[p]="[Circular]"}}for(const{property:p,enumerable:m}of x1e)typeof e[p]<"u"&&e[p]!==null&&Object.defineProperty(n,p,{value:V_(e[p])?u(e[p]):e[p],enumerable:r?!0:m,configurable:!0,writable:!0});return n};function C1e(e,t={}){const{maxDepth:n=Number.POSITIVE_INFINITY,useToJSON:r=!0}=t;return typeof e=="object"&&e!==null?j7({from:e,seen:[],forceEnumerable:!0,maxDepth:n,depth:0,useToJSON:r,serialize:!0}):typeof e=="function"?`[Function: ${e.name??"anonymous"}]`:e}function V_(e){return!!e&&typeof e=="object"&&"name"in e&&"message"in e&&"stack"in e}const w1e=({error:e,resetErrorBoundary:t})=>{const n=o5(),r=d.useCallback(()=>{const s=JSON.stringify(C1e(e),null,2);navigator.clipboard.writeText(`\`\`\` ${s} -\`\`\``),n({title:"Error Copied"})},[e,n]),o=d.useMemo(()=>l1e({user:"invoke-ai",repo:"InvokeAI",template:"BUG_REPORT.yml",title:`[bug]: ${e.name}: ${e.message}`}),[e.message,e.name]);return a.jsx(L,{layerStyle:"body",sx:{w:"100vw",h:"100vh",alignItems:"center",justifyContent:"center",p:4},children:a.jsxs(L,{layerStyle:"first",sx:{flexDir:"column",borderRadius:"base",justifyContent:"center",gap:8,p:16},children:[a.jsx(cr,{children:"Something went wrong"}),a.jsx(L,{layerStyle:"second",sx:{px:8,py:4,borderRadius:"base",gap:4,justifyContent:"space-between",alignItems:"center"},children:a.jsxs(ve,{sx:{fontWeight:600,color:"error.500",_dark:{color:"error.400"}},children:[e.name,": ",e.message]})}),a.jsxs(L,{sx:{gap:4},children:[a.jsx(at,{leftIcon:a.jsx(hoe,{}),onClick:t,children:"Reset UI"}),a.jsx(at,{leftIcon:a.jsx(Hc,{}),onClick:r,children:"Copy Error"}),a.jsx(Oh,{href:o,isExternal:!0,children:a.jsx(at,{leftIcon:a.jsx(py,{}),children:"Create Issue"})})]})]})})},g1e=d.memo(h1e),v1e=ce([xe],({hotkeys:e})=>{const{shift:t,ctrl:n,meta:r}=e;return{shift:t,ctrl:n,meta:r}},{memoizeOptions:{resultEqualityCheck:Ft}}),x1e=()=>{const e=te(),{shift:t,ctrl:n,meta:r}=W(v1e),{queueBack:o,isDisabled:s,isLoading:i}=W8();et(["ctrl+enter","meta+enter"],o,{enabled:()=>!s&&!i,preventDefault:!0,enableOnFormTags:["input","textarea","select"]},[o,s,i]);const{queueFront:l,isDisabled:u,isLoading:p}=q8();return et(["ctrl+shift+enter","meta+shift+enter"],l,{enabled:()=>!u&&!p,preventDefault:!0,enableOnFormTags:["input","textarea","select"]},[l,u,p]),et("*",()=>{Hp("shift")?!t&&e(Nr(!0)):t&&e(Nr(!1)),Hp("ctrl")?!n&&e(Vw(!0)):n&&e(Vw(!1)),Hp("meta")?!r&&e(Ww(!0)):r&&e(Ww(!1))},{keyup:!0,keydown:!0},[t,n,r]),et("1",()=>{e(Xs("txt2img"))}),et("2",()=>{e(Xs("img2img"))}),et("3",()=>{e(Xs("unifiedCanvas"))}),et("4",()=>{e(Xs("nodes"))}),et("5",()=>{e(Xs("modelManager"))}),null},b1e=d.memo(x1e),y1e=e=>{const t=te(),{recallAllParameters:n}=Sg(),r=sl(),{currentData:o}=to((e==null?void 0:e.imageName)??$r.skipToken),{currentData:s}=A9((e==null?void 0:e.imageName)??$r.skipToken),i=d.useCallback(()=>{o&&(t(hI(o)),t(Xs("unifiedCanvas")),r({title:T9("toast.sentToUnifiedCanvas"),status:"info",duration:2500,isClosable:!0}))},[t,r,o]),l=d.useCallback(()=>{o&&t(vh(o))},[t,o]),u=d.useCallback(()=>{s&&n(s.metadata)},[s]);return d.useEffect(()=>{e&&e.action==="sendToCanvas"&&i()},[e,i]),d.useEffect(()=>{e&&e.action==="sendToImg2Img"&&l()},[e,l]),d.useEffect(()=>{e&&e.action==="useAllParameters"&&u()},[e,u]),{handleSendToCanvas:i,handleSendToImg2Img:l,handleUseAllMetadata:u}},C1e=e=>(y1e(e.selectedImage),null),w1e=d.memo(C1e),S1e={},k1e=({config:e=S1e,selectedImage:t})=>{const n=W(SM),r=pP("system"),o=te(),s=d.useCallback(()=>(localStorage.clear(),location.reload(),!1),[]);d.useEffect(()=>{yt.changeLanguage(n)},[n]),d.useEffect(()=>{II(e)&&(r.info({config:e},"Received config"),o(N9(e)))},[o,e,r]),d.useEffect(()=>{o($9())},[o]);const i=Jh(L9);return a.jsxs(a1e,{onReset:s,FallbackComponent:g1e,children:[a.jsx(Ja,{w:"100vw",h:"100vh",position:"relative",overflow:"hidden",children:a.jsx(nG,{children:a.jsxs(Ja,{sx:{gap:4,p:4,gridAutoRows:"min-content auto",w:"full",h:"full"},children:[i||a.jsx(Oee,{}),a.jsx(L,{sx:{gap:4,w:"full",h:"full"},children:a.jsx(o1e,{})})]})})}),a.jsx(xJ,{}),a.jsx(mJ,{}),a.jsx(UW,{}),a.jsx(b1e,{}),a.jsx(w1e,{selectedImage:t})]})},M1e=d.memo(k1e);export{M1e as default}; +\`\`\``),n({title:"Error Copied"})},[e,n]),o=d.useMemo(()=>h1e({user:"invoke-ai",repo:"InvokeAI",template:"BUG_REPORT.yml",title:`[bug]: ${e.name}: ${e.message}`}),[e.message,e.name]);return a.jsx(L,{layerStyle:"body",sx:{w:"100vw",h:"100vh",alignItems:"center",justifyContent:"center",p:4},children:a.jsxs(L,{layerStyle:"first",sx:{flexDir:"column",borderRadius:"base",justifyContent:"center",gap:8,p:16},children:[a.jsx(cr,{children:"Something went wrong"}),a.jsx(L,{layerStyle:"second",sx:{px:8,py:4,borderRadius:"base",gap:4,justifyContent:"space-between",alignItems:"center"},children:a.jsxs(ve,{sx:{fontWeight:600,color:"error.500",_dark:{color:"error.400"}},children:[e.name,": ",e.message]})}),a.jsxs(L,{sx:{gap:4},children:[a.jsx(at,{leftIcon:a.jsx(xoe,{}),onClick:t,children:"Reset UI"}),a.jsx(at,{leftIcon:a.jsx(Hc,{}),onClick:r,children:"Copy Error"}),a.jsx(Oh,{href:o,isExternal:!0,children:a.jsx(at,{leftIcon:a.jsx(py,{}),children:"Create Issue"})})]})]})})},S1e=d.memo(w1e),k1e=le([xe],({hotkeys:e})=>{const{shift:t,ctrl:n,meta:r}=e;return{shift:t,ctrl:n,meta:r}},{memoizeOptions:{resultEqualityCheck:Ft}}),j1e=()=>{const e=te(),{shift:t,ctrl:n,meta:r}=W(k1e),{queueBack:o,isDisabled:s,isLoading:i}=W8();et(["ctrl+enter","meta+enter"],o,{enabled:()=>!s&&!i,preventDefault:!0,enableOnFormTags:["input","textarea","select"]},[o,s,i]);const{queueFront:l,isDisabled:u,isLoading:p}=q8();return et(["ctrl+shift+enter","meta+shift+enter"],l,{enabled:()=>!u&&!p,preventDefault:!0,enableOnFormTags:["input","textarea","select"]},[l,u,p]),et("*",()=>{Hp("shift")?!t&&e(Nr(!0)):t&&e(Nr(!1)),Hp("ctrl")?!n&&e(Vw(!0)):n&&e(Vw(!1)),Hp("meta")?!r&&e(Ww(!0)):r&&e(Ww(!1))},{keyup:!0,keydown:!0},[t,n,r]),et("1",()=>{e(Xs("txt2img"))}),et("2",()=>{e(Xs("img2img"))}),et("3",()=>{e(Xs("unifiedCanvas"))}),et("4",()=>{e(Xs("nodes"))}),et("5",()=>{e(Xs("modelManager"))}),null},_1e=d.memo(j1e),I1e=e=>{const t=te(),{recallAllParameters:n}=Sg(),r=sl(),{currentData:o}=to((e==null?void 0:e.imageName)??$r.skipToken),{currentData:s}=$9((e==null?void 0:e.imageName)??$r.skipToken),i=d.useCallback(()=>{o&&(t(hI(o)),t(Xs("unifiedCanvas")),r({title:L9("toast.sentToUnifiedCanvas"),status:"info",duration:2500,isClosable:!0}))},[t,r,o]),l=d.useCallback(()=>{o&&t(vh(o))},[t,o]),u=d.useCallback(()=>{s&&n(s.metadata)},[s]);return d.useEffect(()=>{e&&e.action==="sendToCanvas"&&i()},[e,i]),d.useEffect(()=>{e&&e.action==="sendToImg2Img"&&l()},[e,l]),d.useEffect(()=>{e&&e.action==="useAllParameters"&&u()},[e,u]),{handleSendToCanvas:i,handleSendToImg2Img:l,handleUseAllMetadata:u}},P1e=e=>(I1e(e.selectedImage),null),E1e=d.memo(P1e),M1e={},O1e=({config:e=M1e,selectedImage:t})=>{const n=W(SM),r=pP("system"),o=te(),s=d.useCallback(()=>(localStorage.clear(),location.reload(),!1),[]);d.useEffect(()=>{yt.changeLanguage(n)},[n]),d.useEffect(()=>{II(e)&&(r.info({config:e},"Received config"),o(z9(e)))},[o,e,r]),d.useEffect(()=>{o(F9())},[o]);const i=Jh(B9);return a.jsxs(p1e,{onReset:s,FallbackComponent:S1e,children:[a.jsx(Ja,{w:"100vw",h:"100vh",position:"relative",overflow:"hidden",children:a.jsx(sG,{children:a.jsxs(Ja,{sx:{gap:4,p:4,gridAutoRows:"min-content auto",w:"full",h:"full"},children:[i||a.jsx(Aee,{}),a.jsx(L,{sx:{gap:4,w:"full",h:"full"},children:a.jsx(d1e,{})})]})})}),a.jsx(CJ,{}),a.jsx(vJ,{}),a.jsx(qW,{}),a.jsx(_1e,{}),a.jsx(E1e,{selectedImage:t})]})},$1e=d.memo(O1e);export{$1e as default}; diff --git a/invokeai/frontend/web/dist/assets/MantineProvider-a057bfc9.js b/invokeai/frontend/web/dist/assets/MantineProvider-2072a471.js similarity index 99% rename from invokeai/frontend/web/dist/assets/MantineProvider-a057bfc9.js rename to invokeai/frontend/web/dist/assets/MantineProvider-2072a471.js index c92a7c218a..25a4aca86f 100644 --- a/invokeai/frontend/web/dist/assets/MantineProvider-a057bfc9.js +++ b/invokeai/frontend/web/dist/assets/MantineProvider-2072a471.js @@ -1 +1 @@ -import{aa as d,hY as _,v as h,i7 as X}from"./index-94062f76.js";const Y={dark:["#C1C2C5","#A6A7AB","#909296","#5c5f66","#373A40","#2C2E33","#25262b","#1A1B1E","#141517","#101113"],gray:["#f8f9fa","#f1f3f5","#e9ecef","#dee2e6","#ced4da","#adb5bd","#868e96","#495057","#343a40","#212529"],red:["#fff5f5","#ffe3e3","#ffc9c9","#ffa8a8","#ff8787","#ff6b6b","#fa5252","#f03e3e","#e03131","#c92a2a"],pink:["#fff0f6","#ffdeeb","#fcc2d7","#faa2c1","#f783ac","#f06595","#e64980","#d6336c","#c2255c","#a61e4d"],grape:["#f8f0fc","#f3d9fa","#eebefa","#e599f7","#da77f2","#cc5de8","#be4bdb","#ae3ec9","#9c36b5","#862e9c"],violet:["#f3f0ff","#e5dbff","#d0bfff","#b197fc","#9775fa","#845ef7","#7950f2","#7048e8","#6741d9","#5f3dc4"],indigo:["#edf2ff","#dbe4ff","#bac8ff","#91a7ff","#748ffc","#5c7cfa","#4c6ef5","#4263eb","#3b5bdb","#364fc7"],blue:["#e7f5ff","#d0ebff","#a5d8ff","#74c0fc","#4dabf7","#339af0","#228be6","#1c7ed6","#1971c2","#1864ab"],cyan:["#e3fafc","#c5f6fa","#99e9f2","#66d9e8","#3bc9db","#22b8cf","#15aabf","#1098ad","#0c8599","#0b7285"],teal:["#e6fcf5","#c3fae8","#96f2d7","#63e6be","#38d9a9","#20c997","#12b886","#0ca678","#099268","#087f5b"],green:["#ebfbee","#d3f9d8","#b2f2bb","#8ce99a","#69db7c","#51cf66","#40c057","#37b24d","#2f9e44","#2b8a3e"],lime:["#f4fce3","#e9fac8","#d8f5a2","#c0eb75","#a9e34b","#94d82d","#82c91e","#74b816","#66a80f","#5c940d"],yellow:["#fff9db","#fff3bf","#ffec99","#ffe066","#ffd43b","#fcc419","#fab005","#f59f00","#f08c00","#e67700"],orange:["#fff4e6","#ffe8cc","#ffd8a8","#ffc078","#ffa94d","#ff922b","#fd7e14","#f76707","#e8590c","#d9480f"]};function q(r){return()=>({fontFamily:r.fontFamily||"sans-serif"})}var J=Object.defineProperty,x=Object.getOwnPropertySymbols,K=Object.prototype.hasOwnProperty,Q=Object.prototype.propertyIsEnumerable,z=(r,e,o)=>e in r?J(r,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):r[e]=o,j=(r,e)=>{for(var o in e||(e={}))K.call(e,o)&&z(r,o,e[o]);if(x)for(var o of x(e))Q.call(e,o)&&z(r,o,e[o]);return r};function Z(r){return e=>({WebkitTapHighlightColor:"transparent",[e||"&:focus"]:j({},r.focusRing==="always"||r.focusRing==="auto"?r.focusRingStyles.styles(r):r.focusRingStyles.resetStyles(r)),[e?e.replace(":focus",":focus:not(:focus-visible)"):"&:focus:not(:focus-visible)"]:j({},r.focusRing==="auto"||r.focusRing==="never"?r.focusRingStyles.resetStyles(r):null)})}function y(r){return e=>typeof r.primaryShade=="number"?r.primaryShade:r.primaryShade[e||r.colorScheme]}function w(r){const e=y(r);return(o,n,a=!0,t=!0)=>{if(typeof o=="string"&&o.includes(".")){const[s,l]=o.split("."),g=parseInt(l,10);if(s in r.colors&&g>=0&&g<10)return r.colors[s][typeof n=="number"&&!t?n:g]}const i=typeof n=="number"?n:e();return o in r.colors?r.colors[o][i]:a?r.colors[r.primaryColor][i]:o}}function T(r){let e="";for(let o=1;o{const a={from:(n==null?void 0:n.from)||r.defaultGradient.from,to:(n==null?void 0:n.to)||r.defaultGradient.to,deg:(n==null?void 0:n.deg)||r.defaultGradient.deg};return`linear-gradient(${a.deg}deg, ${e(a.from,o(),!1)} 0%, ${e(a.to,o(),!1)} 100%)`}}function D(r){return e=>{if(typeof e=="number")return`${e/16}${r}`;if(typeof e=="string"){const o=e.replace("px","");if(!Number.isNaN(Number(o)))return`${Number(o)/16}${r}`}return e}}const u=D("rem"),k=D("em");function V({size:r,sizes:e,units:o}){return r in e?e[r]:typeof r=="number"?o==="em"?k(r):u(r):r||e.md}function S(r){return typeof r=="number"?r:typeof r=="string"&&r.includes("rem")?Number(r.replace("rem",""))*16:typeof r=="string"&&r.includes("em")?Number(r.replace("em",""))*16:Number(r)}function er(r){return e=>`@media (min-width: ${k(S(V({size:e,sizes:r.breakpoints})))})`}function or(r){return e=>`@media (max-width: ${k(S(V({size:e,sizes:r.breakpoints}))-1)})`}function nr(r){return/^#?([0-9A-F]{3}){1,2}$/i.test(r)}function tr(r){let e=r.replace("#","");if(e.length===3){const i=e.split("");e=[i[0],i[0],i[1],i[1],i[2],i[2]].join("")}const o=parseInt(e,16),n=o>>16&255,a=o>>8&255,t=o&255;return{r:n,g:a,b:t,a:1}}function ar(r){const[e,o,n,a]=r.replace(/[^0-9,.]/g,"").split(",").map(Number);return{r:e,g:o,b:n,a:a||1}}function C(r){return nr(r)?tr(r):r.startsWith("rgb")?ar(r):{r:0,g:0,b:0,a:1}}function p(r,e){if(typeof r!="string"||e>1||e<0)return"rgba(0, 0, 0, 1)";if(r.startsWith("var(--"))return r;const{r:o,g:n,b:a}=C(r);return`rgba(${o}, ${n}, ${a}, ${e})`}function ir(r=0){return{position:"absolute",top:u(r),right:u(r),left:u(r),bottom:u(r)}}function sr(r,e){if(typeof r=="string"&&r.startsWith("var(--"))return r;const{r:o,g:n,b:a,a:t}=C(r),i=1-e,s=l=>Math.round(l*i);return`rgba(${s(o)}, ${s(n)}, ${s(a)}, ${t})`}function lr(r,e){if(typeof r=="string"&&r.startsWith("var(--"))return r;const{r:o,g:n,b:a,a:t}=C(r),i=s=>Math.round(s+(255-s)*e);return`rgba(${i(o)}, ${i(n)}, ${i(a)}, ${t})`}function fr(r){return e=>{if(typeof e=="number")return u(e);const o=typeof r.defaultRadius=="number"?r.defaultRadius:r.radius[r.defaultRadius]||r.defaultRadius;return r.radius[e]||e||o}}function cr(r,e){if(typeof r=="string"&&r.includes(".")){const[o,n]=r.split("."),a=parseInt(n,10);if(o in e.colors&&a>=0&&a<10)return{isSplittedColor:!0,key:o,shade:a}}return{isSplittedColor:!1}}function dr(r){const e=w(r),o=y(r),n=G(r);return({variant:a,color:t,gradient:i,primaryFallback:s})=>{const l=cr(t,r);switch(a){case"light":return{border:"transparent",background:p(e(t,r.colorScheme==="dark"?8:0,s,!1),r.colorScheme==="dark"?.2:1),color:t==="dark"?r.colorScheme==="dark"?r.colors.dark[0]:r.colors.dark[9]:e(t,r.colorScheme==="dark"?2:o("light")),hover:p(e(t,r.colorScheme==="dark"?7:1,s,!1),r.colorScheme==="dark"?.25:.65)};case"subtle":return{border:"transparent",background:"transparent",color:t==="dark"?r.colorScheme==="dark"?r.colors.dark[0]:r.colors.dark[9]:e(t,r.colorScheme==="dark"?2:o("light")),hover:p(e(t,r.colorScheme==="dark"?8:0,s,!1),r.colorScheme==="dark"?.2:1)};case"outline":return{border:e(t,r.colorScheme==="dark"?5:o("light")),background:"transparent",color:e(t,r.colorScheme==="dark"?5:o("light")),hover:r.colorScheme==="dark"?p(e(t,5,s,!1),.05):p(e(t,0,s,!1),.35)};case"default":return{border:r.colorScheme==="dark"?r.colors.dark[4]:r.colors.gray[4],background:r.colorScheme==="dark"?r.colors.dark[6]:r.white,color:r.colorScheme==="dark"?r.white:r.black,hover:r.colorScheme==="dark"?r.colors.dark[5]:r.colors.gray[0]};case"white":return{border:"transparent",background:r.white,color:e(t,o()),hover:null};case"transparent":return{border:"transparent",color:t==="dark"?r.colorScheme==="dark"?r.colors.dark[0]:r.colors.dark[9]:e(t,r.colorScheme==="dark"?2:o("light")),background:"transparent",hover:null};case"gradient":return{background:n(i),color:r.white,border:"transparent",hover:null};default:{const g=o(),$=l.isSplittedColor?l.shade:g,O=l.isSplittedColor?l.key:t;return{border:"transparent",background:e(O,$,s),color:r.white,hover:e(O,$===9?8:$+1)}}}}}function ur(r){return e=>{const o=y(r)(e);return r.colors[r.primaryColor][o]}}function pr(r){return{"@media (hover: hover)":{"&:hover":r},"@media (hover: none)":{"&:active":r}}}function gr(r){return()=>({userSelect:"none",color:r.colorScheme==="dark"?r.colors.dark[3]:r.colors.gray[5]})}function br(r){return()=>r.colorScheme==="dark"?r.colors.dark[2]:r.colors.gray[6]}const f={fontStyles:q,themeColor:w,focusStyles:Z,linearGradient:B,radialGradient:rr,smallerThan:or,largerThan:er,rgba:p,cover:ir,darken:sr,lighten:lr,radius:fr,variant:dr,primaryShade:y,hover:pr,gradient:G,primaryColor:ur,placeholderStyles:gr,dimmed:br};var mr=Object.defineProperty,yr=Object.defineProperties,Sr=Object.getOwnPropertyDescriptors,R=Object.getOwnPropertySymbols,vr=Object.prototype.hasOwnProperty,_r=Object.prototype.propertyIsEnumerable,F=(r,e,o)=>e in r?mr(r,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):r[e]=o,hr=(r,e)=>{for(var o in e||(e={}))vr.call(e,o)&&F(r,o,e[o]);if(R)for(var o of R(e))_r.call(e,o)&&F(r,o,e[o]);return r},kr=(r,e)=>yr(r,Sr(e));function U(r){return kr(hr({},r),{fn:{fontStyles:f.fontStyles(r),themeColor:f.themeColor(r),focusStyles:f.focusStyles(r),largerThan:f.largerThan(r),smallerThan:f.smallerThan(r),radialGradient:f.radialGradient,linearGradient:f.linearGradient,gradient:f.gradient(r),rgba:f.rgba,cover:f.cover,lighten:f.lighten,darken:f.darken,primaryShade:f.primaryShade(r),radius:f.radius(r),variant:f.variant(r),hover:f.hover,primaryColor:f.primaryColor(r),placeholderStyles:f.placeholderStyles(r),dimmed:f.dimmed(r)}})}const $r={dir:"ltr",primaryShade:{light:6,dark:8},focusRing:"auto",loader:"oval",colorScheme:"light",white:"#fff",black:"#000",defaultRadius:"sm",transitionTimingFunction:"ease",colors:Y,lineHeight:1.55,fontFamily:"-apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica, Arial, sans-serif, Apple Color Emoji, Segoe UI Emoji",fontFamilyMonospace:"ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, Liberation Mono, Courier New, monospace",primaryColor:"blue",respectReducedMotion:!0,cursorType:"default",defaultGradient:{from:"indigo",to:"cyan",deg:45},shadows:{xs:"0 0.0625rem 0.1875rem rgba(0, 0, 0, 0.05), 0 0.0625rem 0.125rem rgba(0, 0, 0, 0.1)",sm:"0 0.0625rem 0.1875rem rgba(0, 0, 0, 0.05), rgba(0, 0, 0, 0.05) 0 0.625rem 0.9375rem -0.3125rem, rgba(0, 0, 0, 0.04) 0 0.4375rem 0.4375rem -0.3125rem",md:"0 0.0625rem 0.1875rem rgba(0, 0, 0, 0.05), rgba(0, 0, 0, 0.05) 0 1.25rem 1.5625rem -0.3125rem, rgba(0, 0, 0, 0.04) 0 0.625rem 0.625rem -0.3125rem",lg:"0 0.0625rem 0.1875rem rgba(0, 0, 0, 0.05), rgba(0, 0, 0, 0.05) 0 1.75rem 1.4375rem -0.4375rem, rgba(0, 0, 0, 0.04) 0 0.75rem 0.75rem -0.4375rem",xl:"0 0.0625rem 0.1875rem rgba(0, 0, 0, 0.05), rgba(0, 0, 0, 0.05) 0 2.25rem 1.75rem -0.4375rem, rgba(0, 0, 0, 0.04) 0 1.0625rem 1.0625rem -0.4375rem"},fontSizes:{xs:"0.75rem",sm:"0.875rem",md:"1rem",lg:"1.125rem",xl:"1.25rem"},radius:{xs:"0.125rem",sm:"0.25rem",md:"0.5rem",lg:"1rem",xl:"2rem"},spacing:{xs:"0.625rem",sm:"0.75rem",md:"1rem",lg:"1.25rem",xl:"1.5rem"},breakpoints:{xs:"36em",sm:"48em",md:"62em",lg:"75em",xl:"88em"},headings:{fontFamily:"-apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica, Arial, sans-serif, Apple Color Emoji, Segoe UI Emoji",fontWeight:700,sizes:{h1:{fontSize:"2.125rem",lineHeight:1.3,fontWeight:void 0},h2:{fontSize:"1.625rem",lineHeight:1.35,fontWeight:void 0},h3:{fontSize:"1.375rem",lineHeight:1.4,fontWeight:void 0},h4:{fontSize:"1.125rem",lineHeight:1.45,fontWeight:void 0},h5:{fontSize:"1rem",lineHeight:1.5,fontWeight:void 0},h6:{fontSize:"0.875rem",lineHeight:1.5,fontWeight:void 0}}},other:{},components:{},activeStyles:{transform:"translateY(0.0625rem)"},datesLocale:"en",globalStyles:void 0,focusRingStyles:{styles:r=>({outlineOffset:"0.125rem",outline:`0.125rem solid ${r.colors[r.primaryColor][r.colorScheme==="dark"?7:5]}`}),resetStyles:()=>({outline:"none"}),inputStyles:r=>({outline:"none",borderColor:r.colors[r.primaryColor][typeof r.primaryShade=="object"?r.primaryShade[r.colorScheme]:r.primaryShade]})}},E=U($r);var Pr=Object.defineProperty,wr=Object.defineProperties,Cr=Object.getOwnPropertyDescriptors,H=Object.getOwnPropertySymbols,Er=Object.prototype.hasOwnProperty,Or=Object.prototype.propertyIsEnumerable,M=(r,e,o)=>e in r?Pr(r,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):r[e]=o,xr=(r,e)=>{for(var o in e||(e={}))Er.call(e,o)&&M(r,o,e[o]);if(H)for(var o of H(e))Or.call(e,o)&&M(r,o,e[o]);return r},zr=(r,e)=>wr(r,Cr(e));function jr({theme:r}){return d.createElement(_,{styles:{"*, *::before, *::after":{boxSizing:"border-box"},html:{colorScheme:r.colorScheme==="dark"?"dark":"light"},body:zr(xr({},r.fn.fontStyles()),{backgroundColor:r.colorScheme==="dark"?r.colors.dark[7]:r.white,color:r.colorScheme==="dark"?r.colors.dark[0]:r.black,lineHeight:r.lineHeight,fontSize:r.fontSizes.md,WebkitFontSmoothing:"antialiased",MozOsxFontSmoothing:"grayscale"})}})}function b(r,e,o,n=u){Object.keys(e).forEach(a=>{r[`--mantine-${o}-${a}`]=n(e[a])})}function Rr({theme:r}){const e={"--mantine-color-white":r.white,"--mantine-color-black":r.black,"--mantine-transition-timing-function":r.transitionTimingFunction,"--mantine-line-height":`${r.lineHeight}`,"--mantine-font-family":r.fontFamily,"--mantine-font-family-monospace":r.fontFamilyMonospace,"--mantine-font-family-headings":r.headings.fontFamily,"--mantine-heading-font-weight":`${r.headings.fontWeight}`};b(e,r.shadows,"shadow"),b(e,r.fontSizes,"font-size"),b(e,r.radius,"radius"),b(e,r.spacing,"spacing"),b(e,r.breakpoints,"breakpoints",k),Object.keys(r.colors).forEach(n=>{r.colors[n].forEach((a,t)=>{e[`--mantine-color-${n}-${t}`]=a})});const o=r.headings.sizes;return Object.keys(o).forEach(n=>{e[`--mantine-${n}-font-size`]=o[n].fontSize,e[`--mantine-${n}-line-height`]=`${o[n].lineHeight}`}),d.createElement(_,{styles:{":root":e}})}var Fr=Object.defineProperty,Hr=Object.defineProperties,Mr=Object.getOwnPropertyDescriptors,I=Object.getOwnPropertySymbols,Ir=Object.prototype.hasOwnProperty,Ar=Object.prototype.propertyIsEnumerable,A=(r,e,o)=>e in r?Fr(r,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):r[e]=o,c=(r,e)=>{for(var o in e||(e={}))Ir.call(e,o)&&A(r,o,e[o]);if(I)for(var o of I(e))Ar.call(e,o)&&A(r,o,e[o]);return r},P=(r,e)=>Hr(r,Mr(e));function Nr(r,e){var o;if(!e)return r;const n=Object.keys(r).reduce((a,t)=>{if(t==="headings"&&e.headings){const i=e.headings.sizes?Object.keys(r.headings.sizes).reduce((s,l)=>(s[l]=c(c({},r.headings.sizes[l]),e.headings.sizes[l]),s),{}):r.headings.sizes;return P(c({},a),{headings:P(c(c({},r.headings),e.headings),{sizes:i})})}if(t==="breakpoints"&&e.breakpoints){const i=c(c({},r.breakpoints),e.breakpoints);return P(c({},a),{breakpoints:Object.fromEntries(Object.entries(i).sort((s,l)=>S(s[1])-S(l[1])))})}return a[t]=typeof e[t]=="object"?c(c({},r[t]),e[t]):typeof e[t]=="number"||typeof e[t]=="boolean"||typeof e[t]=="function"?e[t]:e[t]||r[t],a},{});if(e!=null&&e.fontFamily&&!((o=e==null?void 0:e.headings)!=null&&o.fontFamily)&&(n.headings.fontFamily=e.fontFamily),!(n.primaryColor in n.colors))throw new Error("MantineProvider: Invalid theme.primaryColor, it accepts only key of theme.colors, learn more – https://mantine.dev/theming/colors/#primary-color");return n}function Wr(r,e){return U(Nr(r,e))}function Tr(r){return Object.keys(r).reduce((e,o)=>(r[o]!==void 0&&(e[o]=r[o]),e),{})}const Gr={html:{fontFamily:"sans-serif",lineHeight:"1.15",textSizeAdjust:"100%"},body:{margin:0},"article, aside, footer, header, nav, section, figcaption, figure, main":{display:"block"},h1:{fontSize:"2em"},hr:{boxSizing:"content-box",height:0,overflow:"visible"},pre:{fontFamily:"monospace, monospace",fontSize:"1em"},a:{background:"transparent",textDecorationSkip:"objects"},"a:active, a:hover":{outlineWidth:0},"abbr[title]":{borderBottom:"none",textDecoration:"underline"},"b, strong":{fontWeight:"bolder"},"code, kbp, samp":{fontFamily:"monospace, monospace",fontSize:"1em"},dfn:{fontStyle:"italic"},mark:{backgroundColor:"#ff0",color:"#000"},small:{fontSize:"80%"},"sub, sup":{fontSize:"75%",lineHeight:0,position:"relative",verticalAlign:"baseline"},sup:{top:"-0.5em"},sub:{bottom:"-0.25em"},"audio, video":{display:"inline-block"},"audio:not([controls])":{display:"none",height:0},img:{borderStyle:"none",verticalAlign:"middle"},"svg:not(:root)":{overflow:"hidden"},"button, input, optgroup, select, textarea":{fontFamily:"sans-serif",fontSize:"100%",lineHeight:"1.15",margin:0},"button, input":{overflow:"visible"},"button, select":{textTransform:"none"},"button, [type=reset], [type=submit]":{WebkitAppearance:"button"},"button::-moz-focus-inner, [type=button]::-moz-focus-inner, [type=reset]::-moz-focus-inner, [type=submit]::-moz-focus-inner":{borderStyle:"none",padding:0},"button:-moz-focusring, [type=button]:-moz-focusring, [type=reset]:-moz-focusring, [type=submit]:-moz-focusring":{outline:`${u(1)} dotted ButtonText`},legend:{boxSizing:"border-box",color:"inherit",display:"table",maxWidth:"100%",padding:0,whiteSpace:"normal"},progress:{display:"inline-block",verticalAlign:"baseline"},textarea:{overflow:"auto"},"[type=checkbox], [type=radio]":{boxSizing:"border-box",padding:0},"[type=number]::-webkit-inner-spin-button, [type=number]::-webkit-outer-spin-button":{height:"auto"},"[type=search]":{appearance:"none"},"[type=search]::-webkit-search-cancel-button, [type=search]::-webkit-search-decoration":{appearance:"none"},"::-webkit-file-upload-button":{appearance:"button",font:"inherit"},"details, menu":{display:"block"},summary:{display:"list-item"},canvas:{display:"inline-block"},template:{display:"none"}};function Dr(){return d.createElement(_,{styles:Gr})}var Vr=Object.defineProperty,N=Object.getOwnPropertySymbols,Ur=Object.prototype.hasOwnProperty,Lr=Object.prototype.propertyIsEnumerable,W=(r,e,o)=>e in r?Vr(r,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):r[e]=o,m=(r,e)=>{for(var o in e||(e={}))Ur.call(e,o)&&W(r,o,e[o]);if(N)for(var o of N(e))Lr.call(e,o)&&W(r,o,e[o]);return r};const v=h.createContext({theme:E});function L(){var r;return((r=h.useContext(v))==null?void 0:r.theme)||E}function qr(r){const e=L(),o=n=>{var a,t,i,s;return{styles:((a=e.components[n])==null?void 0:a.styles)||{},classNames:((t=e.components[n])==null?void 0:t.classNames)||{},variants:(i=e.components[n])==null?void 0:i.variants,sizes:(s=e.components[n])==null?void 0:s.sizes}};return Array.isArray(r)?r.map(o):[o(r)]}function Jr(){var r;return(r=h.useContext(v))==null?void 0:r.emotionCache}function Kr(r,e,o){var n;const a=L(),t=(n=a.components[r])==null?void 0:n.defaultProps,i=typeof t=="function"?t(a):t;return m(m(m({},e),i),Tr(o))}function Xr({theme:r,emotionCache:e,withNormalizeCSS:o=!1,withGlobalStyles:n=!1,withCSSVariables:a=!1,inherit:t=!1,children:i}){const s=h.useContext(v),l=Wr(E,t?m(m({},s.theme),r):r);return d.createElement(X,{theme:l},d.createElement(v.Provider,{value:{theme:l,emotionCache:e}},o&&d.createElement(Dr,null),n&&d.createElement(jr,{theme:l}),a&&d.createElement(Rr,{theme:l}),typeof l.globalStyles=="function"&&d.createElement(_,{styles:l.globalStyles(l)}),i))}Xr.displayName="@mantine/core/MantineProvider";export{Xr as M,L as a,qr as b,V as c,Kr as d,Tr as f,S as g,u as r,Jr as u}; +import{aa as d,h$ as _,v as h,ia as X}from"./index-6f7e7659.js";const Y={dark:["#C1C2C5","#A6A7AB","#909296","#5c5f66","#373A40","#2C2E33","#25262b","#1A1B1E","#141517","#101113"],gray:["#f8f9fa","#f1f3f5","#e9ecef","#dee2e6","#ced4da","#adb5bd","#868e96","#495057","#343a40","#212529"],red:["#fff5f5","#ffe3e3","#ffc9c9","#ffa8a8","#ff8787","#ff6b6b","#fa5252","#f03e3e","#e03131","#c92a2a"],pink:["#fff0f6","#ffdeeb","#fcc2d7","#faa2c1","#f783ac","#f06595","#e64980","#d6336c","#c2255c","#a61e4d"],grape:["#f8f0fc","#f3d9fa","#eebefa","#e599f7","#da77f2","#cc5de8","#be4bdb","#ae3ec9","#9c36b5","#862e9c"],violet:["#f3f0ff","#e5dbff","#d0bfff","#b197fc","#9775fa","#845ef7","#7950f2","#7048e8","#6741d9","#5f3dc4"],indigo:["#edf2ff","#dbe4ff","#bac8ff","#91a7ff","#748ffc","#5c7cfa","#4c6ef5","#4263eb","#3b5bdb","#364fc7"],blue:["#e7f5ff","#d0ebff","#a5d8ff","#74c0fc","#4dabf7","#339af0","#228be6","#1c7ed6","#1971c2","#1864ab"],cyan:["#e3fafc","#c5f6fa","#99e9f2","#66d9e8","#3bc9db","#22b8cf","#15aabf","#1098ad","#0c8599","#0b7285"],teal:["#e6fcf5","#c3fae8","#96f2d7","#63e6be","#38d9a9","#20c997","#12b886","#0ca678","#099268","#087f5b"],green:["#ebfbee","#d3f9d8","#b2f2bb","#8ce99a","#69db7c","#51cf66","#40c057","#37b24d","#2f9e44","#2b8a3e"],lime:["#f4fce3","#e9fac8","#d8f5a2","#c0eb75","#a9e34b","#94d82d","#82c91e","#74b816","#66a80f","#5c940d"],yellow:["#fff9db","#fff3bf","#ffec99","#ffe066","#ffd43b","#fcc419","#fab005","#f59f00","#f08c00","#e67700"],orange:["#fff4e6","#ffe8cc","#ffd8a8","#ffc078","#ffa94d","#ff922b","#fd7e14","#f76707","#e8590c","#d9480f"]};function q(r){return()=>({fontFamily:r.fontFamily||"sans-serif"})}var J=Object.defineProperty,x=Object.getOwnPropertySymbols,K=Object.prototype.hasOwnProperty,Q=Object.prototype.propertyIsEnumerable,z=(r,e,o)=>e in r?J(r,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):r[e]=o,j=(r,e)=>{for(var o in e||(e={}))K.call(e,o)&&z(r,o,e[o]);if(x)for(var o of x(e))Q.call(e,o)&&z(r,o,e[o]);return r};function Z(r){return e=>({WebkitTapHighlightColor:"transparent",[e||"&:focus"]:j({},r.focusRing==="always"||r.focusRing==="auto"?r.focusRingStyles.styles(r):r.focusRingStyles.resetStyles(r)),[e?e.replace(":focus",":focus:not(:focus-visible)"):"&:focus:not(:focus-visible)"]:j({},r.focusRing==="auto"||r.focusRing==="never"?r.focusRingStyles.resetStyles(r):null)})}function y(r){return e=>typeof r.primaryShade=="number"?r.primaryShade:r.primaryShade[e||r.colorScheme]}function w(r){const e=y(r);return(o,n,a=!0,t=!0)=>{if(typeof o=="string"&&o.includes(".")){const[s,l]=o.split("."),g=parseInt(l,10);if(s in r.colors&&g>=0&&g<10)return r.colors[s][typeof n=="number"&&!t?n:g]}const i=typeof n=="number"?n:e();return o in r.colors?r.colors[o][i]:a?r.colors[r.primaryColor][i]:o}}function T(r){let e="";for(let o=1;o{const a={from:(n==null?void 0:n.from)||r.defaultGradient.from,to:(n==null?void 0:n.to)||r.defaultGradient.to,deg:(n==null?void 0:n.deg)||r.defaultGradient.deg};return`linear-gradient(${a.deg}deg, ${e(a.from,o(),!1)} 0%, ${e(a.to,o(),!1)} 100%)`}}function D(r){return e=>{if(typeof e=="number")return`${e/16}${r}`;if(typeof e=="string"){const o=e.replace("px","");if(!Number.isNaN(Number(o)))return`${Number(o)/16}${r}`}return e}}const u=D("rem"),k=D("em");function V({size:r,sizes:e,units:o}){return r in e?e[r]:typeof r=="number"?o==="em"?k(r):u(r):r||e.md}function S(r){return typeof r=="number"?r:typeof r=="string"&&r.includes("rem")?Number(r.replace("rem",""))*16:typeof r=="string"&&r.includes("em")?Number(r.replace("em",""))*16:Number(r)}function er(r){return e=>`@media (min-width: ${k(S(V({size:e,sizes:r.breakpoints})))})`}function or(r){return e=>`@media (max-width: ${k(S(V({size:e,sizes:r.breakpoints}))-1)})`}function nr(r){return/^#?([0-9A-F]{3}){1,2}$/i.test(r)}function tr(r){let e=r.replace("#","");if(e.length===3){const i=e.split("");e=[i[0],i[0],i[1],i[1],i[2],i[2]].join("")}const o=parseInt(e,16),n=o>>16&255,a=o>>8&255,t=o&255;return{r:n,g:a,b:t,a:1}}function ar(r){const[e,o,n,a]=r.replace(/[^0-9,.]/g,"").split(",").map(Number);return{r:e,g:o,b:n,a:a||1}}function C(r){return nr(r)?tr(r):r.startsWith("rgb")?ar(r):{r:0,g:0,b:0,a:1}}function p(r,e){if(typeof r!="string"||e>1||e<0)return"rgba(0, 0, 0, 1)";if(r.startsWith("var(--"))return r;const{r:o,g:n,b:a}=C(r);return`rgba(${o}, ${n}, ${a}, ${e})`}function ir(r=0){return{position:"absolute",top:u(r),right:u(r),left:u(r),bottom:u(r)}}function sr(r,e){if(typeof r=="string"&&r.startsWith("var(--"))return r;const{r:o,g:n,b:a,a:t}=C(r),i=1-e,s=l=>Math.round(l*i);return`rgba(${s(o)}, ${s(n)}, ${s(a)}, ${t})`}function lr(r,e){if(typeof r=="string"&&r.startsWith("var(--"))return r;const{r:o,g:n,b:a,a:t}=C(r),i=s=>Math.round(s+(255-s)*e);return`rgba(${i(o)}, ${i(n)}, ${i(a)}, ${t})`}function fr(r){return e=>{if(typeof e=="number")return u(e);const o=typeof r.defaultRadius=="number"?r.defaultRadius:r.radius[r.defaultRadius]||r.defaultRadius;return r.radius[e]||e||o}}function cr(r,e){if(typeof r=="string"&&r.includes(".")){const[o,n]=r.split("."),a=parseInt(n,10);if(o in e.colors&&a>=0&&a<10)return{isSplittedColor:!0,key:o,shade:a}}return{isSplittedColor:!1}}function dr(r){const e=w(r),o=y(r),n=G(r);return({variant:a,color:t,gradient:i,primaryFallback:s})=>{const l=cr(t,r);switch(a){case"light":return{border:"transparent",background:p(e(t,r.colorScheme==="dark"?8:0,s,!1),r.colorScheme==="dark"?.2:1),color:t==="dark"?r.colorScheme==="dark"?r.colors.dark[0]:r.colors.dark[9]:e(t,r.colorScheme==="dark"?2:o("light")),hover:p(e(t,r.colorScheme==="dark"?7:1,s,!1),r.colorScheme==="dark"?.25:.65)};case"subtle":return{border:"transparent",background:"transparent",color:t==="dark"?r.colorScheme==="dark"?r.colors.dark[0]:r.colors.dark[9]:e(t,r.colorScheme==="dark"?2:o("light")),hover:p(e(t,r.colorScheme==="dark"?8:0,s,!1),r.colorScheme==="dark"?.2:1)};case"outline":return{border:e(t,r.colorScheme==="dark"?5:o("light")),background:"transparent",color:e(t,r.colorScheme==="dark"?5:o("light")),hover:r.colorScheme==="dark"?p(e(t,5,s,!1),.05):p(e(t,0,s,!1),.35)};case"default":return{border:r.colorScheme==="dark"?r.colors.dark[4]:r.colors.gray[4],background:r.colorScheme==="dark"?r.colors.dark[6]:r.white,color:r.colorScheme==="dark"?r.white:r.black,hover:r.colorScheme==="dark"?r.colors.dark[5]:r.colors.gray[0]};case"white":return{border:"transparent",background:r.white,color:e(t,o()),hover:null};case"transparent":return{border:"transparent",color:t==="dark"?r.colorScheme==="dark"?r.colors.dark[0]:r.colors.dark[9]:e(t,r.colorScheme==="dark"?2:o("light")),background:"transparent",hover:null};case"gradient":return{background:n(i),color:r.white,border:"transparent",hover:null};default:{const g=o(),$=l.isSplittedColor?l.shade:g,O=l.isSplittedColor?l.key:t;return{border:"transparent",background:e(O,$,s),color:r.white,hover:e(O,$===9?8:$+1)}}}}}function ur(r){return e=>{const o=y(r)(e);return r.colors[r.primaryColor][o]}}function pr(r){return{"@media (hover: hover)":{"&:hover":r},"@media (hover: none)":{"&:active":r}}}function gr(r){return()=>({userSelect:"none",color:r.colorScheme==="dark"?r.colors.dark[3]:r.colors.gray[5]})}function br(r){return()=>r.colorScheme==="dark"?r.colors.dark[2]:r.colors.gray[6]}const f={fontStyles:q,themeColor:w,focusStyles:Z,linearGradient:B,radialGradient:rr,smallerThan:or,largerThan:er,rgba:p,cover:ir,darken:sr,lighten:lr,radius:fr,variant:dr,primaryShade:y,hover:pr,gradient:G,primaryColor:ur,placeholderStyles:gr,dimmed:br};var mr=Object.defineProperty,yr=Object.defineProperties,Sr=Object.getOwnPropertyDescriptors,R=Object.getOwnPropertySymbols,vr=Object.prototype.hasOwnProperty,_r=Object.prototype.propertyIsEnumerable,F=(r,e,o)=>e in r?mr(r,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):r[e]=o,hr=(r,e)=>{for(var o in e||(e={}))vr.call(e,o)&&F(r,o,e[o]);if(R)for(var o of R(e))_r.call(e,o)&&F(r,o,e[o]);return r},kr=(r,e)=>yr(r,Sr(e));function U(r){return kr(hr({},r),{fn:{fontStyles:f.fontStyles(r),themeColor:f.themeColor(r),focusStyles:f.focusStyles(r),largerThan:f.largerThan(r),smallerThan:f.smallerThan(r),radialGradient:f.radialGradient,linearGradient:f.linearGradient,gradient:f.gradient(r),rgba:f.rgba,cover:f.cover,lighten:f.lighten,darken:f.darken,primaryShade:f.primaryShade(r),radius:f.radius(r),variant:f.variant(r),hover:f.hover,primaryColor:f.primaryColor(r),placeholderStyles:f.placeholderStyles(r),dimmed:f.dimmed(r)}})}const $r={dir:"ltr",primaryShade:{light:6,dark:8},focusRing:"auto",loader:"oval",colorScheme:"light",white:"#fff",black:"#000",defaultRadius:"sm",transitionTimingFunction:"ease",colors:Y,lineHeight:1.55,fontFamily:"-apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica, Arial, sans-serif, Apple Color Emoji, Segoe UI Emoji",fontFamilyMonospace:"ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, Liberation Mono, Courier New, monospace",primaryColor:"blue",respectReducedMotion:!0,cursorType:"default",defaultGradient:{from:"indigo",to:"cyan",deg:45},shadows:{xs:"0 0.0625rem 0.1875rem rgba(0, 0, 0, 0.05), 0 0.0625rem 0.125rem rgba(0, 0, 0, 0.1)",sm:"0 0.0625rem 0.1875rem rgba(0, 0, 0, 0.05), rgba(0, 0, 0, 0.05) 0 0.625rem 0.9375rem -0.3125rem, rgba(0, 0, 0, 0.04) 0 0.4375rem 0.4375rem -0.3125rem",md:"0 0.0625rem 0.1875rem rgba(0, 0, 0, 0.05), rgba(0, 0, 0, 0.05) 0 1.25rem 1.5625rem -0.3125rem, rgba(0, 0, 0, 0.04) 0 0.625rem 0.625rem -0.3125rem",lg:"0 0.0625rem 0.1875rem rgba(0, 0, 0, 0.05), rgba(0, 0, 0, 0.05) 0 1.75rem 1.4375rem -0.4375rem, rgba(0, 0, 0, 0.04) 0 0.75rem 0.75rem -0.4375rem",xl:"0 0.0625rem 0.1875rem rgba(0, 0, 0, 0.05), rgba(0, 0, 0, 0.05) 0 2.25rem 1.75rem -0.4375rem, rgba(0, 0, 0, 0.04) 0 1.0625rem 1.0625rem -0.4375rem"},fontSizes:{xs:"0.75rem",sm:"0.875rem",md:"1rem",lg:"1.125rem",xl:"1.25rem"},radius:{xs:"0.125rem",sm:"0.25rem",md:"0.5rem",lg:"1rem",xl:"2rem"},spacing:{xs:"0.625rem",sm:"0.75rem",md:"1rem",lg:"1.25rem",xl:"1.5rem"},breakpoints:{xs:"36em",sm:"48em",md:"62em",lg:"75em",xl:"88em"},headings:{fontFamily:"-apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica, Arial, sans-serif, Apple Color Emoji, Segoe UI Emoji",fontWeight:700,sizes:{h1:{fontSize:"2.125rem",lineHeight:1.3,fontWeight:void 0},h2:{fontSize:"1.625rem",lineHeight:1.35,fontWeight:void 0},h3:{fontSize:"1.375rem",lineHeight:1.4,fontWeight:void 0},h4:{fontSize:"1.125rem",lineHeight:1.45,fontWeight:void 0},h5:{fontSize:"1rem",lineHeight:1.5,fontWeight:void 0},h6:{fontSize:"0.875rem",lineHeight:1.5,fontWeight:void 0}}},other:{},components:{},activeStyles:{transform:"translateY(0.0625rem)"},datesLocale:"en",globalStyles:void 0,focusRingStyles:{styles:r=>({outlineOffset:"0.125rem",outline:`0.125rem solid ${r.colors[r.primaryColor][r.colorScheme==="dark"?7:5]}`}),resetStyles:()=>({outline:"none"}),inputStyles:r=>({outline:"none",borderColor:r.colors[r.primaryColor][typeof r.primaryShade=="object"?r.primaryShade[r.colorScheme]:r.primaryShade]})}},E=U($r);var Pr=Object.defineProperty,wr=Object.defineProperties,Cr=Object.getOwnPropertyDescriptors,H=Object.getOwnPropertySymbols,Er=Object.prototype.hasOwnProperty,Or=Object.prototype.propertyIsEnumerable,M=(r,e,o)=>e in r?Pr(r,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):r[e]=o,xr=(r,e)=>{for(var o in e||(e={}))Er.call(e,o)&&M(r,o,e[o]);if(H)for(var o of H(e))Or.call(e,o)&&M(r,o,e[o]);return r},zr=(r,e)=>wr(r,Cr(e));function jr({theme:r}){return d.createElement(_,{styles:{"*, *::before, *::after":{boxSizing:"border-box"},html:{colorScheme:r.colorScheme==="dark"?"dark":"light"},body:zr(xr({},r.fn.fontStyles()),{backgroundColor:r.colorScheme==="dark"?r.colors.dark[7]:r.white,color:r.colorScheme==="dark"?r.colors.dark[0]:r.black,lineHeight:r.lineHeight,fontSize:r.fontSizes.md,WebkitFontSmoothing:"antialiased",MozOsxFontSmoothing:"grayscale"})}})}function b(r,e,o,n=u){Object.keys(e).forEach(a=>{r[`--mantine-${o}-${a}`]=n(e[a])})}function Rr({theme:r}){const e={"--mantine-color-white":r.white,"--mantine-color-black":r.black,"--mantine-transition-timing-function":r.transitionTimingFunction,"--mantine-line-height":`${r.lineHeight}`,"--mantine-font-family":r.fontFamily,"--mantine-font-family-monospace":r.fontFamilyMonospace,"--mantine-font-family-headings":r.headings.fontFamily,"--mantine-heading-font-weight":`${r.headings.fontWeight}`};b(e,r.shadows,"shadow"),b(e,r.fontSizes,"font-size"),b(e,r.radius,"radius"),b(e,r.spacing,"spacing"),b(e,r.breakpoints,"breakpoints",k),Object.keys(r.colors).forEach(n=>{r.colors[n].forEach((a,t)=>{e[`--mantine-color-${n}-${t}`]=a})});const o=r.headings.sizes;return Object.keys(o).forEach(n=>{e[`--mantine-${n}-font-size`]=o[n].fontSize,e[`--mantine-${n}-line-height`]=`${o[n].lineHeight}`}),d.createElement(_,{styles:{":root":e}})}var Fr=Object.defineProperty,Hr=Object.defineProperties,Mr=Object.getOwnPropertyDescriptors,I=Object.getOwnPropertySymbols,Ir=Object.prototype.hasOwnProperty,Ar=Object.prototype.propertyIsEnumerable,A=(r,e,o)=>e in r?Fr(r,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):r[e]=o,c=(r,e)=>{for(var o in e||(e={}))Ir.call(e,o)&&A(r,o,e[o]);if(I)for(var o of I(e))Ar.call(e,o)&&A(r,o,e[o]);return r},P=(r,e)=>Hr(r,Mr(e));function Nr(r,e){var o;if(!e)return r;const n=Object.keys(r).reduce((a,t)=>{if(t==="headings"&&e.headings){const i=e.headings.sizes?Object.keys(r.headings.sizes).reduce((s,l)=>(s[l]=c(c({},r.headings.sizes[l]),e.headings.sizes[l]),s),{}):r.headings.sizes;return P(c({},a),{headings:P(c(c({},r.headings),e.headings),{sizes:i})})}if(t==="breakpoints"&&e.breakpoints){const i=c(c({},r.breakpoints),e.breakpoints);return P(c({},a),{breakpoints:Object.fromEntries(Object.entries(i).sort((s,l)=>S(s[1])-S(l[1])))})}return a[t]=typeof e[t]=="object"?c(c({},r[t]),e[t]):typeof e[t]=="number"||typeof e[t]=="boolean"||typeof e[t]=="function"?e[t]:e[t]||r[t],a},{});if(e!=null&&e.fontFamily&&!((o=e==null?void 0:e.headings)!=null&&o.fontFamily)&&(n.headings.fontFamily=e.fontFamily),!(n.primaryColor in n.colors))throw new Error("MantineProvider: Invalid theme.primaryColor, it accepts only key of theme.colors, learn more – https://mantine.dev/theming/colors/#primary-color");return n}function Wr(r,e){return U(Nr(r,e))}function Tr(r){return Object.keys(r).reduce((e,o)=>(r[o]!==void 0&&(e[o]=r[o]),e),{})}const Gr={html:{fontFamily:"sans-serif",lineHeight:"1.15",textSizeAdjust:"100%"},body:{margin:0},"article, aside, footer, header, nav, section, figcaption, figure, main":{display:"block"},h1:{fontSize:"2em"},hr:{boxSizing:"content-box",height:0,overflow:"visible"},pre:{fontFamily:"monospace, monospace",fontSize:"1em"},a:{background:"transparent",textDecorationSkip:"objects"},"a:active, a:hover":{outlineWidth:0},"abbr[title]":{borderBottom:"none",textDecoration:"underline"},"b, strong":{fontWeight:"bolder"},"code, kbp, samp":{fontFamily:"monospace, monospace",fontSize:"1em"},dfn:{fontStyle:"italic"},mark:{backgroundColor:"#ff0",color:"#000"},small:{fontSize:"80%"},"sub, sup":{fontSize:"75%",lineHeight:0,position:"relative",verticalAlign:"baseline"},sup:{top:"-0.5em"},sub:{bottom:"-0.25em"},"audio, video":{display:"inline-block"},"audio:not([controls])":{display:"none",height:0},img:{borderStyle:"none",verticalAlign:"middle"},"svg:not(:root)":{overflow:"hidden"},"button, input, optgroup, select, textarea":{fontFamily:"sans-serif",fontSize:"100%",lineHeight:"1.15",margin:0},"button, input":{overflow:"visible"},"button, select":{textTransform:"none"},"button, [type=reset], [type=submit]":{WebkitAppearance:"button"},"button::-moz-focus-inner, [type=button]::-moz-focus-inner, [type=reset]::-moz-focus-inner, [type=submit]::-moz-focus-inner":{borderStyle:"none",padding:0},"button:-moz-focusring, [type=button]:-moz-focusring, [type=reset]:-moz-focusring, [type=submit]:-moz-focusring":{outline:`${u(1)} dotted ButtonText`},legend:{boxSizing:"border-box",color:"inherit",display:"table",maxWidth:"100%",padding:0,whiteSpace:"normal"},progress:{display:"inline-block",verticalAlign:"baseline"},textarea:{overflow:"auto"},"[type=checkbox], [type=radio]":{boxSizing:"border-box",padding:0},"[type=number]::-webkit-inner-spin-button, [type=number]::-webkit-outer-spin-button":{height:"auto"},"[type=search]":{appearance:"none"},"[type=search]::-webkit-search-cancel-button, [type=search]::-webkit-search-decoration":{appearance:"none"},"::-webkit-file-upload-button":{appearance:"button",font:"inherit"},"details, menu":{display:"block"},summary:{display:"list-item"},canvas:{display:"inline-block"},template:{display:"none"}};function Dr(){return d.createElement(_,{styles:Gr})}var Vr=Object.defineProperty,N=Object.getOwnPropertySymbols,Ur=Object.prototype.hasOwnProperty,Lr=Object.prototype.propertyIsEnumerable,W=(r,e,o)=>e in r?Vr(r,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):r[e]=o,m=(r,e)=>{for(var o in e||(e={}))Ur.call(e,o)&&W(r,o,e[o]);if(N)for(var o of N(e))Lr.call(e,o)&&W(r,o,e[o]);return r};const v=h.createContext({theme:E});function L(){var r;return((r=h.useContext(v))==null?void 0:r.theme)||E}function qr(r){const e=L(),o=n=>{var a,t,i,s;return{styles:((a=e.components[n])==null?void 0:a.styles)||{},classNames:((t=e.components[n])==null?void 0:t.classNames)||{},variants:(i=e.components[n])==null?void 0:i.variants,sizes:(s=e.components[n])==null?void 0:s.sizes}};return Array.isArray(r)?r.map(o):[o(r)]}function Jr(){var r;return(r=h.useContext(v))==null?void 0:r.emotionCache}function Kr(r,e,o){var n;const a=L(),t=(n=a.components[r])==null?void 0:n.defaultProps,i=typeof t=="function"?t(a):t;return m(m(m({},e),i),Tr(o))}function Xr({theme:r,emotionCache:e,withNormalizeCSS:o=!1,withGlobalStyles:n=!1,withCSSVariables:a=!1,inherit:t=!1,children:i}){const s=h.useContext(v),l=Wr(E,t?m(m({},s.theme),r):r);return d.createElement(X,{theme:l},d.createElement(v.Provider,{value:{theme:l,emotionCache:e}},o&&d.createElement(Dr,null),n&&d.createElement(jr,{theme:l}),a&&d.createElement(Rr,{theme:l}),typeof l.globalStyles=="function"&&d.createElement(_,{styles:l.globalStyles(l)}),i))}Xr.displayName="@mantine/core/MantineProvider";export{Xr as M,L as a,qr as b,V as c,Kr as d,Tr as f,S as g,u as r,Jr as u}; diff --git a/invokeai/frontend/web/dist/assets/ThemeLocaleProvider-632b3401.js b/invokeai/frontend/web/dist/assets/ThemeLocaleProvider-bbfac5eb.js similarity index 95% rename from invokeai/frontend/web/dist/assets/ThemeLocaleProvider-632b3401.js rename to invokeai/frontend/web/dist/assets/ThemeLocaleProvider-bbfac5eb.js index e03863ddf1..dd8589b6d1 100644 --- a/invokeai/frontend/web/dist/assets/ThemeLocaleProvider-632b3401.js +++ b/invokeai/frontend/web/dist/assets/ThemeLocaleProvider-bbfac5eb.js @@ -1,4 +1,4 @@ -import{w as s,hY as T,v as l,a2 as I,hZ as R,ae as V,h_ as z,h$ as j,i0 as D,i1 as F,i2 as G,i3 as W,i4 as K,aG as Y,i5 as Z,i6 as H}from"./index-94062f76.js";import{M as U}from"./MantineProvider-a057bfc9.js";var P=String.raw,E=P` +import{w as s,h$ as T,v as l,a2 as I,i0 as R,ae as V,i1 as z,i2 as j,i3 as D,i4 as F,i5 as G,i6 as W,i7 as K,aG as H,i8 as U,i9 as Y}from"./index-6f7e7659.js";import{M as Z}from"./MantineProvider-2072a471.js";var P=String.raw,E=P` :root, :host { --chakra-vh: 100vh; @@ -277,4 +277,4 @@ import{w as s,hY as T,v as l,a2 as I,hZ as R,ae as V,h_ as z,h$ as j,i0 as D,i1 } ${E} - `}),g={light:"chakra-ui-light",dark:"chakra-ui-dark"};function Q(e={}){const{preventTransition:o=!0}=e,n={setDataset:r=>{const t=o?n.preventTransition():void 0;document.documentElement.dataset.theme=r,document.documentElement.style.colorScheme=r,t==null||t()},setClassName(r){document.body.classList.add(r?g.dark:g.light),document.body.classList.remove(r?g.light:g.dark)},query(){return window.matchMedia("(prefers-color-scheme: dark)")},getSystemTheme(r){var t;return((t=n.query().matches)!=null?t:r==="dark")?"dark":"light"},addListener(r){const t=n.query(),i=a=>{r(a.matches?"dark":"light")};return typeof t.addListener=="function"?t.addListener(i):t.addEventListener("change",i),()=>{typeof t.removeListener=="function"?t.removeListener(i):t.removeEventListener("change",i)}},preventTransition(){const r=document.createElement("style");return r.appendChild(document.createTextNode("*{-webkit-transition:none!important;-moz-transition:none!important;-o-transition:none!important;-ms-transition:none!important;transition:none!important}")),document.head.appendChild(r),()=>{window.getComputedStyle(document.body),requestAnimationFrame(()=>{requestAnimationFrame(()=>{document.head.removeChild(r)})})}}};return n}var X="chakra-ui-color-mode";function L(e){return{ssr:!1,type:"localStorage",get(o){if(!(globalThis!=null&&globalThis.document))return o;let n;try{n=localStorage.getItem(e)||o}catch{}return n||o},set(o){try{localStorage.setItem(e,o)}catch{}}}}var ee=L(X),M=()=>{};function S(e,o){return e.type==="cookie"&&e.ssr?e.get(o):o}function O(e){const{value:o,children:n,options:{useSystemColorMode:r,initialColorMode:t,disableTransitionOnChange:i}={},colorModeManager:a=ee}=e,d=t==="dark"?"dark":"light",[u,p]=l.useState(()=>S(a,d)),[y,b]=l.useState(()=>S(a)),{getSystemTheme:w,setClassName:k,setDataset:x,addListener:$}=l.useMemo(()=>Q({preventTransition:i}),[i]),v=t==="system"&&!u?y:u,c=l.useCallback(h=>{const f=h==="system"?w():h;p(f),k(f==="dark"),x(f),a.set(f)},[a,w,k,x]);I(()=>{t==="system"&&b(w())},[]),l.useEffect(()=>{const h=a.get();if(h){c(h);return}if(t==="system"){c("system");return}c(d)},[a,d,t,c]);const C=l.useCallback(()=>{c(v==="dark"?"light":"dark")},[v,c]);l.useEffect(()=>{if(r)return $(c)},[r,$,c]);const A=l.useMemo(()=>({colorMode:o??v,toggleColorMode:o?M:C,setColorMode:o?M:c,forced:o!==void 0}),[v,C,c,o]);return s.jsx(R.Provider,{value:A,children:n})}O.displayName="ColorModeProvider";var te=["borders","breakpoints","colors","components","config","direction","fonts","fontSizes","fontWeights","letterSpacings","lineHeights","radii","shadows","sizes","space","styles","transition","zIndices"];function re(e){return V(e)?te.every(o=>Object.prototype.hasOwnProperty.call(e,o)):!1}function m(e){return typeof e=="function"}function oe(...e){return o=>e.reduce((n,r)=>r(n),o)}var ne=e=>function(...n){let r=[...n],t=n[n.length-1];return re(t)&&r.length>1?r=r.slice(0,r.length-1):t=e,oe(...r.map(i=>a=>m(i)?i(a):ae(a,i)))(t)},ie=ne(j);function ae(...e){return z({},...e,_)}function _(e,o,n,r){if((m(e)||m(o))&&Object.prototype.hasOwnProperty.call(r,n))return(...t)=>{const i=m(e)?e(...t):e,a=m(o)?o(...t):o;return z({},i,a,_)}}var q=l.createContext({getDocument(){return document},getWindow(){return window}});q.displayName="EnvironmentContext";function N(e){const{children:o,environment:n,disabled:r}=e,t=l.useRef(null),i=l.useMemo(()=>n||{getDocument:()=>{var d,u;return(u=(d=t.current)==null?void 0:d.ownerDocument)!=null?u:document},getWindow:()=>{var d,u;return(u=(d=t.current)==null?void 0:d.ownerDocument.defaultView)!=null?u:window}},[n]),a=!r||!n;return s.jsxs(q.Provider,{value:i,children:[o,a&&s.jsx("span",{id:"__chakra_env",hidden:!0,ref:t})]})}N.displayName="EnvironmentProvider";var se=e=>{const{children:o,colorModeManager:n,portalZIndex:r,resetScope:t,resetCSS:i=!0,theme:a={},environment:d,cssVarsRoot:u,disableEnvironment:p,disableGlobalStyle:y}=e,b=s.jsx(N,{environment:d,disabled:p,children:o});return s.jsx(D,{theme:a,cssVarsRoot:u,children:s.jsxs(O,{colorModeManager:n,options:a.config,children:[i?s.jsx(J,{scope:t}):s.jsx(B,{}),!y&&s.jsx(F,{}),r?s.jsx(G,{zIndex:r,children:b}):b]})})},le=e=>function({children:n,theme:r=e,toastOptions:t,...i}){return s.jsxs(se,{theme:r,...i,children:[s.jsx(W,{value:t==null?void 0:t.defaultOptions,children:n}),s.jsx(K,{...t})]})},de=le(j);const ue=()=>l.useMemo(()=>({colorScheme:"dark",fontFamily:"'Inter Variable', sans-serif",components:{ScrollArea:{defaultProps:{scrollbarSize:10},styles:{scrollbar:{"&:hover":{backgroundColor:"var(--invokeai-colors-baseAlpha-300)"}},thumb:{backgroundColor:"var(--invokeai-colors-baseAlpha-300)"}}}}}),[]),ce=L("@@invokeai-color-mode");function he({children:e}){const{i18n:o}=Y(),n=o.dir(),r=l.useMemo(()=>ie({...Z,direction:n}),[n]);l.useEffect(()=>{document.body.dir=n},[n]);const t=ue();return s.jsx(U,{theme:t,children:s.jsx(de,{theme:r,colorModeManager:ce,toastOptions:H,children:e})})}const ve=l.memo(he);export{ve as default}; + `}),g={light:"chakra-ui-light",dark:"chakra-ui-dark"};function Q(e={}){const{preventTransition:o=!0}=e,n={setDataset:r=>{const t=o?n.preventTransition():void 0;document.documentElement.dataset.theme=r,document.documentElement.style.colorScheme=r,t==null||t()},setClassName(r){document.body.classList.add(r?g.dark:g.light),document.body.classList.remove(r?g.light:g.dark)},query(){return window.matchMedia("(prefers-color-scheme: dark)")},getSystemTheme(r){var t;return((t=n.query().matches)!=null?t:r==="dark")?"dark":"light"},addListener(r){const t=n.query(),i=a=>{r(a.matches?"dark":"light")};return typeof t.addListener=="function"?t.addListener(i):t.addEventListener("change",i),()=>{typeof t.removeListener=="function"?t.removeListener(i):t.removeEventListener("change",i)}},preventTransition(){const r=document.createElement("style");return r.appendChild(document.createTextNode("*{-webkit-transition:none!important;-moz-transition:none!important;-o-transition:none!important;-ms-transition:none!important;transition:none!important}")),document.head.appendChild(r),()=>{window.getComputedStyle(document.body),requestAnimationFrame(()=>{requestAnimationFrame(()=>{document.head.removeChild(r)})})}}};return n}var X="chakra-ui-color-mode";function L(e){return{ssr:!1,type:"localStorage",get(o){if(!(globalThis!=null&&globalThis.document))return o;let n;try{n=localStorage.getItem(e)||o}catch{}return n||o},set(o){try{localStorage.setItem(e,o)}catch{}}}}var ee=L(X),M=()=>{};function S(e,o){return e.type==="cookie"&&e.ssr?e.get(o):o}function O(e){const{value:o,children:n,options:{useSystemColorMode:r,initialColorMode:t,disableTransitionOnChange:i}={},colorModeManager:a=ee}=e,d=t==="dark"?"dark":"light",[u,p]=l.useState(()=>S(a,d)),[y,b]=l.useState(()=>S(a)),{getSystemTheme:w,setClassName:k,setDataset:x,addListener:$}=l.useMemo(()=>Q({preventTransition:i}),[i]),v=t==="system"&&!u?y:u,c=l.useCallback(h=>{const f=h==="system"?w():h;p(f),k(f==="dark"),x(f),a.set(f)},[a,w,k,x]);I(()=>{t==="system"&&b(w())},[]),l.useEffect(()=>{const h=a.get();if(h){c(h);return}if(t==="system"){c("system");return}c(d)},[a,d,t,c]);const C=l.useCallback(()=>{c(v==="dark"?"light":"dark")},[v,c]);l.useEffect(()=>{if(r)return $(c)},[r,$,c]);const A=l.useMemo(()=>({colorMode:o??v,toggleColorMode:o?M:C,setColorMode:o?M:c,forced:o!==void 0}),[v,C,c,o]);return s.jsx(R.Provider,{value:A,children:n})}O.displayName="ColorModeProvider";var te=["borders","breakpoints","colors","components","config","direction","fonts","fontSizes","fontWeights","letterSpacings","lineHeights","radii","shadows","sizes","space","styles","transition","zIndices"];function re(e){return V(e)?te.every(o=>Object.prototype.hasOwnProperty.call(e,o)):!1}function m(e){return typeof e=="function"}function oe(...e){return o=>e.reduce((n,r)=>r(n),o)}var ne=e=>function(...n){let r=[...n],t=n[n.length-1];return re(t)&&r.length>1?r=r.slice(0,r.length-1):t=e,oe(...r.map(i=>a=>m(i)?i(a):ae(a,i)))(t)},ie=ne(j);function ae(...e){return z({},...e,_)}function _(e,o,n,r){if((m(e)||m(o))&&Object.prototype.hasOwnProperty.call(r,n))return(...t)=>{const i=m(e)?e(...t):e,a=m(o)?o(...t):o;return z({},i,a,_)}}var q=l.createContext({getDocument(){return document},getWindow(){return window}});q.displayName="EnvironmentContext";function N(e){const{children:o,environment:n,disabled:r}=e,t=l.useRef(null),i=l.useMemo(()=>n||{getDocument:()=>{var d,u;return(u=(d=t.current)==null?void 0:d.ownerDocument)!=null?u:document},getWindow:()=>{var d,u;return(u=(d=t.current)==null?void 0:d.ownerDocument.defaultView)!=null?u:window}},[n]),a=!r||!n;return s.jsxs(q.Provider,{value:i,children:[o,a&&s.jsx("span",{id:"__chakra_env",hidden:!0,ref:t})]})}N.displayName="EnvironmentProvider";var se=e=>{const{children:o,colorModeManager:n,portalZIndex:r,resetScope:t,resetCSS:i=!0,theme:a={},environment:d,cssVarsRoot:u,disableEnvironment:p,disableGlobalStyle:y}=e,b=s.jsx(N,{environment:d,disabled:p,children:o});return s.jsx(D,{theme:a,cssVarsRoot:u,children:s.jsxs(O,{colorModeManager:n,options:a.config,children:[i?s.jsx(J,{scope:t}):s.jsx(B,{}),!y&&s.jsx(F,{}),r?s.jsx(G,{zIndex:r,children:b}):b]})})},le=e=>function({children:n,theme:r=e,toastOptions:t,...i}){return s.jsxs(se,{theme:r,...i,children:[s.jsx(W,{value:t==null?void 0:t.defaultOptions,children:n}),s.jsx(K,{...t})]})},de=le(j);const ue=()=>l.useMemo(()=>({colorScheme:"dark",fontFamily:"'Inter Variable', sans-serif",components:{ScrollArea:{defaultProps:{scrollbarSize:10},styles:{scrollbar:{"&:hover":{backgroundColor:"var(--invokeai-colors-baseAlpha-300)"}},thumb:{backgroundColor:"var(--invokeai-colors-baseAlpha-300)"}}}}}),[]),ce=L("@@invokeai-color-mode");function he({children:e}){const{i18n:o}=H(),n=o.dir(),r=l.useMemo(()=>ie({...U,direction:n}),[n]);l.useEffect(()=>{document.body.dir=n},[n]);const t=ue();return s.jsx(Z,{theme:t,children:s.jsx(de,{theme:r,colorModeManager:ce,toastOptions:Y,children:e})})}const ve=l.memo(he);export{ve as default}; diff --git a/invokeai/frontend/web/dist/assets/index-6f7e7659.js b/invokeai/frontend/web/dist/assets/index-6f7e7659.js new file mode 100644 index 0000000000..365d228b11 --- /dev/null +++ b/invokeai/frontend/web/dist/assets/index-6f7e7659.js @@ -0,0 +1,158 @@ +var HK=Object.defineProperty;var WK=(e,t,n)=>t in e?HK(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Sw=(e,t,n)=>(WK(e,typeof t!="symbol"?t+"":t,n),n),xw=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)};var ae=(e,t,n)=>(xw(e,t,"read from private field"),n?n.call(e):t.get(e)),Yn=(e,t,n)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,n)},oa=(e,t,n,r)=>(xw(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n);var Np=(e,t,n,r)=>({set _(i){oa(e,t,i,n)},get _(){return ae(e,t,r)}}),gs=(e,t,n)=>(xw(e,t,"access private method"),n);function jN(e,t){for(var n=0;nr[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"]'))r(i);new MutationObserver(i=>{for(const o of i)if(o.type==="childList")for(const a of o.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&r(a)}).observe(document,{childList:!0,subtree:!0});function n(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 r(i){if(i.ep)return;i.ep=!0;const o=n(i);fetch(i.href,o)}})();var yt=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function mc(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function fS(e){if(e.__esModule)return e;var t=e.default;if(typeof t=="function"){var n=function r(){return this instanceof r?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(r){var i=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(n,r,i.get?i:{enumerable:!0,get:function(){return e[r]}})}),n}var UN={exports:{}},hS={},VN={exports:{}},Lt={};/** + * @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 V0=Symbol.for("react.element"),KK=Symbol.for("react.portal"),QK=Symbol.for("react.fragment"),XK=Symbol.for("react.strict_mode"),YK=Symbol.for("react.profiler"),ZK=Symbol.for("react.provider"),JK=Symbol.for("react.context"),eQ=Symbol.for("react.forward_ref"),tQ=Symbol.for("react.suspense"),nQ=Symbol.for("react.memo"),rQ=Symbol.for("react.lazy"),BP=Symbol.iterator;function iQ(e){return e===null||typeof e!="object"?null:(e=BP&&e[BP]||e["@@iterator"],typeof e=="function"?e:null)}var GN={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},qN=Object.assign,HN={};function dp(e,t,n){this.props=e,this.context=t,this.refs=HN,this.updater=n||GN}dp.prototype.isReactComponent={};dp.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=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,e,t,"setState")};dp.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function WN(){}WN.prototype=dp.prototype;function HT(e,t,n){this.props=e,this.context=t,this.refs=HN,this.updater=n||GN}var WT=HT.prototype=new WN;WT.constructor=HT;qN(WT,dp.prototype);WT.isPureReactComponent=!0;var zP=Array.isArray,KN=Object.prototype.hasOwnProperty,KT={current:null},QN={key:!0,ref:!0,__self:!0,__source:!0};function XN(e,t,n){var r,i={},o=null,a=null;if(t!=null)for(r in t.ref!==void 0&&(a=t.ref),t.key!==void 0&&(o=""+t.key),t)KN.call(t,r)&&!QN.hasOwnProperty(r)&&(i[r]=t[r]);var s=arguments.length-2;if(s===1)i.children=n;else if(1>>1,U=M[B];if(0>>1;Bi(ee,N))Ji(j,ee)?(M[B]=j,M[J]=N,B=J):(M[B]=ee,M[Y]=N,B=Y);else if(Ji(j,N))M[B]=j,M[J]=N,B=J;else break e}}return R}function i(M,R){var N=M.sortIndex-R.sortIndex;return N!==0?N:M.id-R.id}if(typeof performance=="object"&&typeof performance.now=="function"){var o=performance;e.unstable_now=function(){return o.now()}}else{var a=Date,s=a.now();e.unstable_now=function(){return a.now()-s}}var l=[],u=[],c=1,d=null,f=3,h=!1,p=!1,m=!1,_=typeof setTimeout=="function"?setTimeout:null,b=typeof clearTimeout=="function"?clearTimeout:null,v=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function g(M){for(var R=n(u);R!==null;){if(R.callback===null)r(u);else if(R.startTime<=M)r(u),R.sortIndex=R.expirationTime,t(l,R);else break;R=n(u)}}function y(M){if(m=!1,g(M),!p)if(n(l)!==null)p=!0,D(S);else{var R=n(u);R!==null&&L(y,R.startTime-M)}}function S(M,R){p=!1,m&&(m=!1,b(C),C=-1),h=!0;var N=f;try{for(g(R),d=n(l);d!==null&&(!(d.expirationTime>R)||M&&!P());){var B=d.callback;if(typeof B=="function"){d.callback=null,f=d.priorityLevel;var U=B(d.expirationTime<=R);R=e.unstable_now(),typeof U=="function"?d.callback=U:d===n(l)&&r(l),g(R)}else r(l);d=n(l)}if(d!==null)var G=!0;else{var Y=n(u);Y!==null&&L(y,Y.startTime-R),G=!1}return G}finally{d=null,f=N,h=!1}}var w=!1,x=null,C=-1,k=5,T=-1;function P(){return!(e.unstable_now()-TM||125B?(M.sortIndex=N,t(u,M),n(l)===null&&M===n(u)&&(m?(b(C),C=-1):m=!0,L(y,N-B))):(M.sortIndex=U,t(l,M),p||h||(p=!0,D(S))),M},e.unstable_shouldYield=P,e.unstable_wrapCallback=function(M){var R=f;return function(){var N=f;f=R;try{return M.apply(this,arguments)}finally{f=N}}}})(e$);JN.exports=e$;var gQ=JN.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 t$=I,Xo=gQ;function le(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),q5=Object.prototype.hasOwnProperty,mQ=/^[: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]*$/,VP={},GP={};function yQ(e){return q5.call(GP,e)?!0:q5.call(VP,e)?!1:mQ.test(e)?GP[e]=!0:(VP[e]=!0,!1)}function vQ(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function bQ(e,t,n,r){if(t===null||typeof t>"u"||vQ(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function lo(e,t,n,r,i,o,a){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=i,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=o,this.removeEmptyString=a}var Ri={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){Ri[e]=new lo(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];Ri[t]=new lo(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){Ri[e]=new lo(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){Ri[e]=new lo(e,2,!1,e,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(e){Ri[e]=new lo(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){Ri[e]=new lo(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){Ri[e]=new lo(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){Ri[e]=new lo(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){Ri[e]=new lo(e,5,!1,e.toLowerCase(),null,!1,!1)});var XT=/[\-:]([a-z])/g;function YT(e){return e[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(e){var t=e.replace(XT,YT);Ri[t]=new lo(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(XT,YT);Ri[t]=new lo(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(XT,YT);Ri[t]=new lo(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){Ri[e]=new lo(e,1,!1,e.toLowerCase(),null,!1,!1)});Ri.xlinkHref=new lo("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){Ri[e]=new lo(e,1,!1,e.toLowerCase(),null,!0,!0)});function ZT(e,t,n,r){var i=Ri.hasOwnProperty(t)?Ri[t]:null;(i!==null?i.type!==0:r||!(2s||i[a]!==o[s]){var l=` +`+i[a].replace(" at new "," at ");return e.displayName&&l.includes("")&&(l=l.replace("",e.displayName)),l}while(1<=a&&0<=s);break}}}finally{Ew=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?hg(e):""}function _Q(e){switch(e.tag){case 5:return hg(e.type);case 16:return hg("Lazy");case 13:return hg("Suspense");case 19:return hg("SuspenseList");case 0:case 2:case 15:return e=Tw(e.type,!1),e;case 11:return e=Tw(e.type.render,!1),e;case 1:return e=Tw(e.type,!0),e;default:return""}}function Q5(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case Pf:return"Fragment";case Af:return"Portal";case H5:return"Profiler";case JT:return"StrictMode";case W5:return"Suspense";case K5:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case i$:return(e.displayName||"Context")+".Consumer";case r$:return(e._context.displayName||"Context")+".Provider";case e4:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case t4:return t=e.displayName||null,t!==null?t:Q5(e.type)||"Memo";case yu:t=e._payload,e=e._init;try{return Q5(e(t))}catch{}}return null}function SQ(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return Q5(t);case 8:return t===JT?"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 t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function ec(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function a$(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function xQ(e){var t=a$(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var i=n.get,o=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(a){r=""+a,o.call(this,a)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(a){r=""+a},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function qy(e){e._valueTracker||(e._valueTracker=xQ(e))}function s$(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=a$(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function db(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function X5(e,t){var n=t.checked;return cr({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function HP(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=ec(t.value!=null?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function l$(e,t){t=t.checked,t!=null&&ZT(e,"checked",t,!1)}function Y5(e,t){l$(e,t);var n=ec(t.value),r=t.type;if(n!=null)r==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?Z5(e,t.type,n):t.hasOwnProperty("defaultValue")&&Z5(e,t.type,ec(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function WP(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!(r!=="submit"&&r!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function Z5(e,t,n){(t!=="number"||db(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var pg=Array.isArray;function Zf(e,t,n,r){if(e=e.options,t){t={};for(var i=0;i"+t.valueOf().toString()+"",t=Hy.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function cm(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Mg={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},wQ=["Webkit","ms","Moz","O"];Object.keys(Mg).forEach(function(e){wQ.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Mg[t]=Mg[e]})});function f$(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||Mg.hasOwnProperty(e)&&Mg[e]?(""+t).trim():t+"px"}function h$(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,i=f$(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,i):e[n]=i}}var CQ=cr({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 t3(e,t){if(t){if(CQ[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(le(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(le(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(le(61))}if(t.style!=null&&typeof t.style!="object")throw Error(le(62))}}function n3(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){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 r3=null;function n4(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var i3=null,Jf=null,eh=null;function XP(e){if(e=H0(e)){if(typeof i3!="function")throw Error(le(280));var t=e.stateNode;t&&(t=vS(t),i3(e.stateNode,e.type,t))}}function p$(e){Jf?eh?eh.push(e):eh=[e]:Jf=e}function g$(){if(Jf){var e=Jf,t=eh;if(eh=Jf=null,XP(e),t)for(e=0;e>>=0,e===0?32:31-($Q(e)/DQ|0)|0}var Wy=64,Ky=4194304;function gg(e){switch(e&-e){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 e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function gb(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,i=e.suspendedLanes,o=e.pingedLanes,a=n&268435455;if(a!==0){var s=a&~i;s!==0?r=gg(s):(o&=a,o!==0&&(r=gg(o)))}else a=n&~i,a!==0?r=gg(a):o!==0&&(r=gg(o));if(r===0)return 0;if(t!==0&&t!==r&&!(t&i)&&(i=r&-r,o=t&-t,i>=o||i===16&&(o&4194240)!==0))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0n;n++)t.push(e);return t}function G0(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Ja(t),e[t]=n}function zQ(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0=$g),o6=String.fromCharCode(32),a6=!1;function $$(e,t){switch(e){case"keyup":return pX.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function D$(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var If=!1;function mX(e,t){switch(e){case"compositionend":return D$(t);case"keypress":return t.which!==32?null:(a6=!0,o6);case"textInput":return e=t.data,e===o6&&a6?null:e;default:return null}}function yX(e,t){if(If)return e==="compositionend"||!c4&&$$(e,t)?(e=M$(),S1=s4=Ru=null,If=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=c6(n)}}function z$(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?z$(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function j$(){for(var e=window,t=db();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=db(e.document)}return t}function d4(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function TX(e){var t=j$(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&z$(n.ownerDocument.documentElement,n)){if(r!==null&&d4(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var i=n.textContent.length,o=Math.min(r.start,i);r=r.end===void 0?o:Math.min(r.end,i),!e.extend&&o>r&&(i=r,r=o,o=i),i=d6(n,o);var a=d6(n,r);i&&a&&(e.rangeCount!==1||e.anchorNode!==i.node||e.anchorOffset!==i.offset||e.focusNode!==a.node||e.focusOffset!==a.offset)&&(t=t.createRange(),t.setStart(i.node,i.offset),e.removeAllRanges(),o>r?(e.addRange(t),e.extend(a.node,a.offset)):(t.setEnd(a.node,a.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n=document.documentMode,Rf=null,c3=null,Lg=null,d3=!1;function f6(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;d3||Rf==null||Rf!==db(r)||(r=Rf,"selectionStart"in r&&d4(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Lg&&mm(Lg,r)||(Lg=r,r=vb(c3,"onSelect"),0Nf||(e.current=y3[Nf],y3[Nf]=null,Nf--)}function Nn(e,t){Nf++,y3[Nf]=e.current,e.current=t}var tc={},Wi=vc(tc),Eo=vc(!1),xd=tc;function Nh(e,t){var n=e.type.contextTypes;if(!n)return tc;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var i={},o;for(o in n)i[o]=t[o];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=i),i}function To(e){return e=e.childContextTypes,e!=null}function _b(){Kn(Eo),Kn(Wi)}function b6(e,t,n){if(Wi.current!==tc)throw Error(le(168));Nn(Wi,t),Nn(Eo,n)}function X$(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var i in r)if(!(i in t))throw Error(le(108,SQ(e)||"Unknown",i));return cr({},n,r)}function Sb(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||tc,xd=Wi.current,Nn(Wi,e),Nn(Eo,Eo.current),!0}function _6(e,t,n){var r=e.stateNode;if(!r)throw Error(le(169));n?(e=X$(e,t,xd),r.__reactInternalMemoizedMergedChildContext=e,Kn(Eo),Kn(Wi),Nn(Wi,e)):Kn(Eo),Nn(Eo,n)}var vl=null,bS=!1,zw=!1;function Y$(e){vl===null?vl=[e]:vl.push(e)}function FX(e){bS=!0,Y$(e)}function bc(){if(!zw&&vl!==null){zw=!0;var e=0,t=mn;try{var n=vl;for(mn=1;e>=a,i-=a,Al=1<<32-Ja(t)+i|n<C?(k=x,x=null):k=x.sibling;var T=f(b,x,g[C],y);if(T===null){x===null&&(x=k);break}e&&x&&T.alternate===null&&t(b,x),v=o(T,v,C),w===null?S=T:w.sibling=T,w=T,x=k}if(C===g.length)return n(b,x),tr&&zc(b,C),S;if(x===null){for(;CC?(k=x,x=null):k=x.sibling;var P=f(b,x,T.value,y);if(P===null){x===null&&(x=k);break}e&&x&&P.alternate===null&&t(b,x),v=o(P,v,C),w===null?S=P:w.sibling=P,w=P,x=k}if(T.done)return n(b,x),tr&&zc(b,C),S;if(x===null){for(;!T.done;C++,T=g.next())T=d(b,T.value,y),T!==null&&(v=o(T,v,C),w===null?S=T:w.sibling=T,w=T);return tr&&zc(b,C),S}for(x=r(b,x);!T.done;C++,T=g.next())T=h(x,b,C,T.value,y),T!==null&&(e&&T.alternate!==null&&x.delete(T.key===null?C:T.key),v=o(T,v,C),w===null?S=T:w.sibling=T,w=T);return e&&x.forEach(function($){return t(b,$)}),tr&&zc(b,C),S}function _(b,v,g,y){if(typeof g=="object"&&g!==null&&g.type===Pf&&g.key===null&&(g=g.props.children),typeof g=="object"&&g!==null){switch(g.$$typeof){case Gy:e:{for(var S=g.key,w=v;w!==null;){if(w.key===S){if(S=g.type,S===Pf){if(w.tag===7){n(b,w.sibling),v=i(w,g.props.children),v.return=b,b=v;break e}}else if(w.elementType===S||typeof S=="object"&&S!==null&&S.$$typeof===yu&&k6(S)===w.type){n(b,w.sibling),v=i(w,g.props),v.ref=zp(b,w,g),v.return=b,b=v;break e}n(b,w);break}else t(b,w);w=w.sibling}g.type===Pf?(v=fd(g.props.children,b.mode,y,g.key),v.return=b,b=v):(y=P1(g.type,g.key,g.props,null,b.mode,y),y.ref=zp(b,v,g),y.return=b,b=y)}return a(b);case Af:e:{for(w=g.key;v!==null;){if(v.key===w)if(v.tag===4&&v.stateNode.containerInfo===g.containerInfo&&v.stateNode.implementation===g.implementation){n(b,v.sibling),v=i(v,g.children||[]),v.return=b,b=v;break e}else{n(b,v);break}else t(b,v);v=v.sibling}v=Kw(g,b.mode,y),v.return=b,b=v}return a(b);case yu:return w=g._init,_(b,v,w(g._payload),y)}if(pg(g))return p(b,v,g,y);if($p(g))return m(b,v,g,y);tv(b,g)}return typeof g=="string"&&g!==""||typeof g=="number"?(g=""+g,v!==null&&v.tag===6?(n(b,v.sibling),v=i(v,g),v.return=b,b=v):(n(b,v),v=Ww(g,b.mode,y),v.return=b,b=v),a(b)):n(b,v)}return _}var Dh=oD(!0),aD=oD(!1),W0={},Bs=vc(W0),_m=vc(W0),Sm=vc(W0);function ed(e){if(e===W0)throw Error(le(174));return e}function _4(e,t){switch(Nn(Sm,t),Nn(_m,e),Nn(Bs,W0),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:e3(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=e3(t,e)}Kn(Bs),Nn(Bs,t)}function Lh(){Kn(Bs),Kn(_m),Kn(Sm)}function sD(e){ed(Sm.current);var t=ed(Bs.current),n=e3(t,e.type);t!==n&&(Nn(_m,e),Nn(Bs,n))}function S4(e){_m.current===e&&(Kn(Bs),Kn(_m))}var sr=vc(0);function kb(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||n.data==="$?"||n.data==="$!"))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==void 0){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var jw=[];function x4(){for(var e=0;en?n:4,e(!0);var r=Uw.transition;Uw.transition={};try{e(!1),t()}finally{mn=n,Uw.transition=r}}function wD(){return xa().memoizedState}function UX(e,t,n){var r=Gu(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},CD(e))ED(t,n);else if(n=tD(e,t,n,r),n!==null){var i=ro();es(n,e,r,i),TD(n,t,r)}}function VX(e,t,n){var r=Gu(e),i={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(CD(e))ED(t,i);else{var o=e.alternate;if(e.lanes===0&&(o===null||o.lanes===0)&&(o=t.lastRenderedReducer,o!==null))try{var a=t.lastRenderedState,s=o(a,n);if(i.hasEagerState=!0,i.eagerState=s,os(s,a)){var l=t.interleaved;l===null?(i.next=i,v4(t)):(i.next=l.next,l.next=i),t.interleaved=i;return}}catch{}finally{}n=tD(e,t,i,r),n!==null&&(i=ro(),es(n,e,r,i),TD(n,t,r))}}function CD(e){var t=e.alternate;return e===ur||t!==null&&t===ur}function ED(e,t){Fg=Ab=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function TD(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,i4(e,n)}}var Pb={readContext:Sa,useCallback:Li,useContext:Li,useEffect:Li,useImperativeHandle:Li,useInsertionEffect:Li,useLayoutEffect:Li,useMemo:Li,useReducer:Li,useRef:Li,useState:Li,useDebugValue:Li,useDeferredValue:Li,useTransition:Li,useMutableSource:Li,useSyncExternalStore:Li,useId:Li,unstable_isNewReconciler:!1},GX={readContext:Sa,useCallback:function(e,t){return Ss().memoizedState=[e,t===void 0?null:t],e},useContext:Sa,useEffect:P6,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,E1(4194308,4,vD.bind(null,t,e),n)},useLayoutEffect:function(e,t){return E1(4194308,4,e,t)},useInsertionEffect:function(e,t){return E1(4,2,e,t)},useMemo:function(e,t){var n=Ss();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=Ss();return t=n!==void 0?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=UX.bind(null,ur,e),[r.memoizedState,e]},useRef:function(e){var t=Ss();return e={current:e},t.memoizedState=e},useState:A6,useDebugValue:k4,useDeferredValue:function(e){return Ss().memoizedState=e},useTransition:function(){var e=A6(!1),t=e[0];return e=jX.bind(null,e[1]),Ss().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=ur,i=Ss();if(tr){if(n===void 0)throw Error(le(407));n=n()}else{if(n=t(),di===null)throw Error(le(349));Cd&30||cD(r,t,n)}i.memoizedState=n;var o={value:n,getSnapshot:t};return i.queue=o,P6(fD.bind(null,r,o,e),[e]),r.flags|=2048,Cm(9,dD.bind(null,r,o,n,t),void 0,null),n},useId:function(){var e=Ss(),t=di.identifierPrefix;if(tr){var n=Pl,r=Al;n=(r&~(1<<32-Ja(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=xm++,0<\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=a.createElement(n,{is:r.is}):(e=a.createElement(n),n==="select"&&(a=e,r.multiple?a.multiple=!0:r.size&&(a.size=r.size))):e=a.createElementNS(e,n),e[Ps]=t,e[bm]=r,$D(e,t,!1,!1),t.stateNode=e;e:{switch(a=n3(n,r),n){case"dialog":jn("cancel",e),jn("close",e),i=r;break;case"iframe":case"object":case"embed":jn("load",e),i=r;break;case"video":case"audio":for(i=0;iBh&&(t.flags|=128,r=!0,jp(o,!1),t.lanes=4194304)}else{if(!r)if(e=kb(a),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),jp(o,!0),o.tail===null&&o.tailMode==="hidden"&&!a.alternate&&!tr)return Fi(t),null}else 2*Cr()-o.renderingStartTime>Bh&&n!==1073741824&&(t.flags|=128,r=!0,jp(o,!1),t.lanes=4194304);o.isBackwards?(a.sibling=t.child,t.child=a):(n=o.last,n!==null?n.sibling=a:t.child=a,o.last=a)}return o.tail!==null?(t=o.tail,o.rendering=t,o.tail=t.sibling,o.renderingStartTime=Cr(),t.sibling=null,n=sr.current,Nn(sr,r?n&1|2:n&1),t):(Fi(t),null);case 22:case 23:return M4(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?jo&1073741824&&(Fi(t),t.subtreeFlags&6&&(t.flags|=8192)):Fi(t),null;case 24:return null;case 25:return null}throw Error(le(156,t.tag))}function ZX(e,t){switch(h4(t),t.tag){case 1:return To(t.type)&&_b(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Lh(),Kn(Eo),Kn(Wi),x4(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return S4(t),null;case 13:if(Kn(sr),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(le(340));$h()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Kn(sr),null;case 4:return Lh(),null;case 10:return y4(t.type._context),null;case 22:case 23:return M4(),null;case 24:return null;default:return null}}var rv=!1,Gi=!1,JX=typeof WeakSet=="function"?WeakSet:Set,De=null;function Ff(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){gr(e,t,r)}else n.current=null}function P3(e,t,n){try{n()}catch(r){gr(e,t,r)}}var F6=!1;function eY(e,t){if(f3=mb,e=j$(),d4(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var i=r.anchorOffset,o=r.focusNode;r=r.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break e}var a=0,s=-1,l=-1,u=0,c=0,d=e,f=null;t:for(;;){for(var h;d!==n||i!==0&&d.nodeType!==3||(s=a+i),d!==o||r!==0&&d.nodeType!==3||(l=a+r),d.nodeType===3&&(a+=d.nodeValue.length),(h=d.firstChild)!==null;)f=d,d=h;for(;;){if(d===e)break t;if(f===n&&++u===i&&(s=a),f===o&&++c===r&&(l=a),(h=d.nextSibling)!==null)break;d=f,f=d.parentNode}d=h}n=s===-1||l===-1?null:{start:s,end:l}}else n=null}n=n||{start:0,end:0}}else n=null;for(h3={focusedElem:e,selectionRange:n},mb=!1,De=t;De!==null;)if(t=De,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,De=e;else for(;De!==null;){t=De;try{var p=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(p!==null){var m=p.memoizedProps,_=p.memoizedState,b=t.stateNode,v=b.getSnapshotBeforeUpdate(t.elementType===t.type?m:ja(t.type,m),_);b.__reactInternalSnapshotBeforeUpdate=v}break;case 3:var g=t.stateNode.containerInfo;g.nodeType===1?g.textContent="":g.nodeType===9&&g.documentElement&&g.removeChild(g.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(le(163))}}catch(y){gr(t,t.return,y)}if(e=t.sibling,e!==null){e.return=t.return,De=e;break}De=t.return}return p=F6,F6=!1,p}function Bg(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var i=r=r.next;do{if((i.tag&e)===e){var o=i.destroy;i.destroy=void 0,o!==void 0&&P3(t,n,o)}i=i.next}while(i!==r)}}function xS(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function I3(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function FD(e){var t=e.alternate;t!==null&&(e.alternate=null,FD(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Ps],delete t[bm],delete t[m3],delete t[DX],delete t[LX])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function BD(e){return e.tag===5||e.tag===3||e.tag===4}function B6(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||BD(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function R3(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=bb));else if(r!==4&&(e=e.child,e!==null))for(R3(e,t,n),e=e.sibling;e!==null;)R3(e,t,n),e=e.sibling}function O3(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(O3(e,t,n),e=e.sibling;e!==null;)O3(e,t,n),e=e.sibling}var wi=null,Va=!1;function su(e,t,n){for(n=n.child;n!==null;)zD(e,t,n),n=n.sibling}function zD(e,t,n){if(Fs&&typeof Fs.onCommitFiberUnmount=="function")try{Fs.onCommitFiberUnmount(pS,n)}catch{}switch(n.tag){case 5:Gi||Ff(n,t);case 6:var r=wi,i=Va;wi=null,su(e,t,n),wi=r,Va=i,wi!==null&&(Va?(e=wi,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):wi.removeChild(n.stateNode));break;case 18:wi!==null&&(Va?(e=wi,n=n.stateNode,e.nodeType===8?Bw(e.parentNode,n):e.nodeType===1&&Bw(e,n),pm(e)):Bw(wi,n.stateNode));break;case 4:r=wi,i=Va,wi=n.stateNode.containerInfo,Va=!0,su(e,t,n),wi=r,Va=i;break;case 0:case 11:case 14:case 15:if(!Gi&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){i=r=r.next;do{var o=i,a=o.destroy;o=o.tag,a!==void 0&&(o&2||o&4)&&P3(n,t,a),i=i.next}while(i!==r)}su(e,t,n);break;case 1:if(!Gi&&(Ff(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(s){gr(n,t,s)}su(e,t,n);break;case 21:su(e,t,n);break;case 22:n.mode&1?(Gi=(r=Gi)||n.memoizedState!==null,su(e,t,n),Gi=r):su(e,t,n);break;default:su(e,t,n)}}function z6(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new JX),t.forEach(function(r){var i=uY.bind(null,e,r);n.has(r)||(n.add(r),r.then(i,i))})}}function Fa(e,t){var n=t.deletions;if(n!==null)for(var r=0;ri&&(i=a),r&=~o}if(r=i,r=Cr()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*nY(r/1960))-r,10e?16:e,Ou===null)var r=!1;else{if(e=Ou,Ou=null,Ob=0,qt&6)throw Error(le(331));var i=qt;for(qt|=4,De=e.current;De!==null;){var o=De,a=o.child;if(De.flags&16){var s=o.deletions;if(s!==null){for(var l=0;lCr()-R4?dd(e,0):I4|=n),ko(e,t)}function KD(e,t){t===0&&(e.mode&1?(t=Ky,Ky<<=1,!(Ky&130023424)&&(Ky=4194304)):t=1);var n=ro();e=Ul(e,t),e!==null&&(G0(e,t,n),ko(e,n))}function lY(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),KD(e,n)}function uY(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,i=e.memoizedState;i!==null&&(n=i.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(le(314))}r!==null&&r.delete(t),KD(e,n)}var QD;QD=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||Eo.current)So=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return So=!1,XX(e,t,n);So=!!(e.flags&131072)}else So=!1,tr&&t.flags&1048576&&Z$(t,wb,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;T1(e,t),e=t.pendingProps;var i=Nh(t,Wi.current);nh(t,n),i=C4(null,t,r,e,i,n);var o=E4();return t.flags|=1,typeof i=="object"&&i!==null&&typeof i.render=="function"&&i.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,To(r)?(o=!0,Sb(t)):o=!1,t.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,b4(t),i.updater=_S,t.stateNode=i,i._reactInternals=t,x3(t,r,e,n),t=E3(null,t,r,!0,o,n)):(t.tag=0,tr&&o&&f4(t),eo(null,t,i,n),t=t.child),t;case 16:r=t.elementType;e:{switch(T1(e,t),e=t.pendingProps,i=r._init,r=i(r._payload),t.type=r,i=t.tag=dY(r),e=ja(r,e),i){case 0:t=C3(null,t,r,e,n);break e;case 1:t=$6(null,t,r,e,n);break e;case 11:t=M6(null,t,r,e,n);break e;case 14:t=N6(null,t,r,ja(r.type,e),n);break e}throw Error(le(306,r,""))}return t;case 0:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:ja(r,i),C3(e,t,r,i,n);case 1:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:ja(r,i),$6(e,t,r,i,n);case 3:e:{if(OD(t),e===null)throw Error(le(387));r=t.pendingProps,o=t.memoizedState,i=o.element,nD(e,t),Tb(t,r,null,n);var a=t.memoizedState;if(r=a.element,o.isDehydrated)if(o={element:r,isDehydrated:!1,cache:a.cache,pendingSuspenseBoundaries:a.pendingSuspenseBoundaries,transitions:a.transitions},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){i=Fh(Error(le(423)),t),t=D6(e,t,r,n,i);break e}else if(r!==i){i=Fh(Error(le(424)),t),t=D6(e,t,r,n,i);break e}else for(qo=ju(t.stateNode.containerInfo.firstChild),Wo=t,tr=!0,qa=null,n=aD(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if($h(),r===i){t=Vl(e,t,n);break e}eo(e,t,r,n)}t=t.child}return t;case 5:return sD(t),e===null&&b3(t),r=t.type,i=t.pendingProps,o=e!==null?e.memoizedProps:null,a=i.children,p3(r,i)?a=null:o!==null&&p3(r,o)&&(t.flags|=32),RD(e,t),eo(e,t,a,n),t.child;case 6:return e===null&&b3(t),null;case 13:return MD(e,t,n);case 4:return _4(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Dh(t,null,r,n):eo(e,t,r,n),t.child;case 11:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:ja(r,i),M6(e,t,r,i,n);case 7:return eo(e,t,t.pendingProps,n),t.child;case 8:return eo(e,t,t.pendingProps.children,n),t.child;case 12:return eo(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,i=t.pendingProps,o=t.memoizedProps,a=i.value,Nn(Cb,r._currentValue),r._currentValue=a,o!==null)if(os(o.value,a)){if(o.children===i.children&&!Eo.current){t=Vl(e,t,n);break e}}else for(o=t.child,o!==null&&(o.return=t);o!==null;){var s=o.dependencies;if(s!==null){a=o.child;for(var l=s.firstContext;l!==null;){if(l.context===r){if(o.tag===1){l=Ml(-1,n&-n),l.tag=2;var u=o.updateQueue;if(u!==null){u=u.shared;var c=u.pending;c===null?l.next=l:(l.next=c.next,c.next=l),u.pending=l}}o.lanes|=n,l=o.alternate,l!==null&&(l.lanes|=n),_3(o.return,n,t),s.lanes|=n;break}l=l.next}}else if(o.tag===10)a=o.type===t.type?null:o.child;else if(o.tag===18){if(a=o.return,a===null)throw Error(le(341));a.lanes|=n,s=a.alternate,s!==null&&(s.lanes|=n),_3(a,n,t),a=o.sibling}else a=o.child;if(a!==null)a.return=o;else for(a=o;a!==null;){if(a===t){a=null;break}if(o=a.sibling,o!==null){o.return=a.return,a=o;break}a=a.return}o=a}eo(e,t,i.children,n),t=t.child}return t;case 9:return i=t.type,r=t.pendingProps.children,nh(t,n),i=Sa(i),r=r(i),t.flags|=1,eo(e,t,r,n),t.child;case 14:return r=t.type,i=ja(r,t.pendingProps),i=ja(r.type,i),N6(e,t,r,i,n);case 15:return PD(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:ja(r,i),T1(e,t),t.tag=1,To(r)?(e=!0,Sb(t)):e=!1,nh(t,n),iD(t,r,i),x3(t,r,i,n),E3(null,t,r,!0,e,n);case 19:return ND(e,t,n);case 22:return ID(e,t,n)}throw Error(le(156,t.tag))};function XD(e,t){return x$(e,t)}function cY(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function va(e,t,n,r){return new cY(e,t,n,r)}function $4(e){return e=e.prototype,!(!e||!e.isReactComponent)}function dY(e){if(typeof e=="function")return $4(e)?1:0;if(e!=null){if(e=e.$$typeof,e===e4)return 11;if(e===t4)return 14}return 2}function qu(e,t){var n=e.alternate;return n===null?(n=va(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function P1(e,t,n,r,i,o){var a=2;if(r=e,typeof e=="function")$4(e)&&(a=1);else if(typeof e=="string")a=5;else e:switch(e){case Pf:return fd(n.children,i,o,t);case JT:a=8,i|=8;break;case H5:return e=va(12,n,t,i|2),e.elementType=H5,e.lanes=o,e;case W5:return e=va(13,n,t,i),e.elementType=W5,e.lanes=o,e;case K5:return e=va(19,n,t,i),e.elementType=K5,e.lanes=o,e;case o$:return CS(n,i,o,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case r$:a=10;break e;case i$:a=9;break e;case e4:a=11;break e;case t4:a=14;break e;case yu:a=16,r=null;break e}throw Error(le(130,e==null?e:typeof e,""))}return t=va(a,n,t,i),t.elementType=e,t.type=r,t.lanes=o,t}function fd(e,t,n,r){return e=va(7,e,r,t),e.lanes=n,e}function CS(e,t,n,r){return e=va(22,e,r,t),e.elementType=o$,e.lanes=n,e.stateNode={isHidden:!1},e}function Ww(e,t,n){return e=va(6,e,null,t),e.lanes=n,e}function Kw(e,t,n){return t=va(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function fY(e,t,n,r,i){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Aw(0),this.expirationTimes=Aw(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Aw(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function D4(e,t,n,r,i,o,a,s,l){return e=new fY(e,t,n,s,l),t===1?(t=1,o===!0&&(t|=8)):t=0,o=va(3,null,null,t),e.current=o,o.stateNode=e,o.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},b4(o),e}function hY(e,t,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(eL)}catch(e){console.error(e)}}eL(),ZN.exports=ea;var Uo=ZN.exports;const eUe=mc(Uo);var K6=Uo;G5.createRoot=K6.createRoot,G5.hydrateRoot=K6.hydrateRoot;const vY="modulepreload",bY=function(e,t){return new URL(e,t).href},Q6={},tL=function(t,n,r){if(!n||n.length===0)return t();const i=document.getElementsByTagName("link");return Promise.all(n.map(o=>{if(o=bY(o,r),o in Q6)return;Q6[o]=!0;const a=o.endsWith(".css"),s=a?'[rel="stylesheet"]':"";if(!!r)for(let c=i.length-1;c>=0;c--){const d=i[c];if(d.href===o&&(!a||d.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${o}"]${s}`))return;const u=document.createElement("link");if(u.rel=a?"stylesheet":vY,a||(u.as="script",u.crossOrigin=""),u.href=o,document.head.appendChild(u),a)return new Promise((c,d)=>{u.addEventListener("load",c),u.addEventListener("error",()=>d(new Error(`Unable to preload CSS for ${o}`)))})})).then(()=>t()).catch(o=>{const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=o,window.dispatchEvent(a),!a.defaultPrevented)throw o})};function ci(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r3?t.i-4:t.i:Array.isArray(e)?1:PS(e)?2:IS(e)?3:0}function Hu(e,t){return nc(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function I1(e,t){return nc(e)===2?e.get(t):e[t]}function nL(e,t,n){var r=nc(e);r===2?e.set(t,n):r===3?e.add(n):e[t]=n}function rL(e,t){return e===t?e!==0||1/e==1/t:e!=e&&t!=t}function PS(e){return EY&&e instanceof Map}function IS(e){return TY&&e instanceof Set}function ri(e){return e.o||e.t}function j4(e){if(Array.isArray(e))return Array.prototype.slice.call(e);var t=oL(e);delete t[St];for(var n=oh(t),r=0;r1&&(e.set=e.add=e.clear=e.delete=_Y),Object.freeze(e),t&&Gl(e,function(n,r){return K0(r,!0)},!0)),e}function _Y(){ci(2)}function U4(e){return e==null||typeof e!="object"||Object.isFrozen(e)}function zs(e){var t=F3[e];return t||ci(18,e),t}function V4(e,t){F3[e]||(F3[e]=t)}function Tm(){return Am}function Qw(e,t){t&&(zs("Patches"),e.u=[],e.s=[],e.v=t)}function $b(e){L3(e),e.p.forEach(SY),e.p=null}function L3(e){e===Am&&(Am=e.l)}function X6(e){return Am={p:[],l:Am,h:e,m:!0,_:0}}function SY(e){var t=e[St];t.i===0||t.i===1?t.j():t.g=!0}function Xw(e,t){t._=t.p.length;var n=t.p[0],r=e!==void 0&&e!==n;return t.h.O||zs("ES5").S(t,e,r),r?(n[St].P&&($b(t),ci(4)),Ao(e)&&(e=Db(t,e),t.l||Lb(t,e)),t.u&&zs("Patches").M(n[St].t,e,t.u,t.s)):e=Db(t,n,[]),$b(t),t.u&&t.v(t.u,t.s),e!==OS?e:void 0}function Db(e,t,n){if(U4(t))return t;var r=t[St];if(!r)return Gl(t,function(s,l){return Y6(e,r,t,s,l,n)},!0),t;if(r.A!==e)return t;if(!r.P)return Lb(e,r.t,!0),r.t;if(!r.I){r.I=!0,r.A._--;var i=r.i===4||r.i===5?r.o=j4(r.k):r.o,o=i,a=!1;r.i===3&&(o=new Set(i),i.clear(),a=!0),Gl(o,function(s,l){return Y6(e,r,i,s,l,n,a)}),Lb(e,i,!1),n&&e.u&&zs("Patches").N(r,n,e.u,e.s)}return r.o}function Y6(e,t,n,r,i,o,a){if(oo(i)){var s=Db(e,i,o&&t&&t.i!==3&&!Hu(t.R,r)?o.concat(r):void 0);if(nL(n,r,s),!oo(s))return;e.m=!1}else a&&n.add(i);if(Ao(i)&&!U4(i)){if(!e.h.D&&e._<1)return;Db(e,i),t&&t.A.l||Lb(e,i)}}function Lb(e,t,n){n===void 0&&(n=!1),!e.l&&e.h.D&&e.m&&K0(t,n)}function Yw(e,t){var n=e[St];return(n?ri(n):e)[t]}function Z6(e,t){if(t in e)for(var n=Object.getPrototypeOf(e);n;){var r=Object.getOwnPropertyDescriptor(n,t);if(r)return r;n=Object.getPrototypeOf(n)}}function bo(e){e.P||(e.P=!0,e.l&&bo(e.l))}function Zw(e){e.o||(e.o=j4(e.t))}function km(e,t,n){var r=PS(t)?zs("MapSet").F(t,n):IS(t)?zs("MapSet").T(t,n):e.O?function(i,o){var a=Array.isArray(i),s={i:a?1:0,A:o?o.A:Tm(),P:!1,I:!1,R:{},l:o,t:i,k:null,o:null,j:null,C:!1},l=s,u=Pm;a&&(l=[s],u=yg);var c=Proxy.revocable(l,u),d=c.revoke,f=c.proxy;return s.k=f,s.j=d,f}(t,n):zs("ES5").J(t,n);return(n?n.A:Tm()).p.push(r),r}function RS(e){return oo(e)||ci(22,e),function t(n){if(!Ao(n))return n;var r,i=n[St],o=nc(n);if(i){if(!i.P&&(i.i<4||!zs("ES5").K(i)))return i.t;i.I=!0,r=J6(n,o),i.I=!1}else r=J6(n,o);return Gl(r,function(a,s){i&&I1(i.t,a)===s||nL(r,a,t(s))}),o===3?new Set(r):r}(e)}function J6(e,t){switch(t){case 2:return new Map(e);case 3:return Array.from(e)}return j4(e)}function G4(){function e(o,a){var s=i[o];return s?s.enumerable=a:i[o]=s={configurable:!0,enumerable:a,get:function(){var l=this[St];return Pm.get(l,o)},set:function(l){var u=this[St];Pm.set(u,o,l)}},s}function t(o){for(var a=o.length-1;a>=0;a--){var s=o[a][St];if(!s.P)switch(s.i){case 5:r(s)&&bo(s);break;case 4:n(s)&&bo(s)}}}function n(o){for(var a=o.t,s=o.k,l=oh(s),u=l.length-1;u>=0;u--){var c=l[u];if(c!==St){var d=a[c];if(d===void 0&&!Hu(a,c))return!0;var f=s[c],h=f&&f[St];if(h?h.t!==d:!rL(f,d))return!0}}var p=!!a[St];return l.length!==oh(a).length+(p?0:1)}function r(o){var a=o.k;if(a.length!==o.t.length)return!0;var s=Object.getOwnPropertyDescriptor(a,a.length-1);if(s&&!s.get)return!0;for(var l=0;l1?b-1:0),g=1;g1?c-1:0),f=1;f=0;i--){var o=r[i];if(o.path.length===0&&o.op==="replace"){n=o.value;break}}i>-1&&(r=r.slice(i+1));var a=zs("Patches").$;return oo(n)?a(n,r):this.produce(n,function(s){return a(s,r)})},e}(),Yo=new aL,sL=Yo.produce,W4=Yo.produceWithPatches.bind(Yo),AY=Yo.setAutoFreeze.bind(Yo),PY=Yo.setUseProxies.bind(Yo),B3=Yo.applyPatches.bind(Yo),IY=Yo.createDraft.bind(Yo),RY=Yo.finishDraft.bind(Yo);const _c=sL,OY=Object.freeze(Object.defineProperty({__proto__:null,Immer:aL,applyPatches:B3,castDraft:wY,castImmutable:CY,createDraft:IY,current:RS,default:_c,enableAllPlugins:xY,enableES5:G4,enableMapSet:iL,enablePatches:q4,finishDraft:RY,freeze:K0,immerable:ih,isDraft:oo,isDraftable:Ao,nothing:OS,original:z4,produce:sL,produceWithPatches:W4,setAutoFreeze:AY,setUseProxies:PY},Symbol.toStringTag,{value:"Module"}));function Im(e){"@babel/helpers - typeof";return Im=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},Im(e)}function MY(e,t){if(Im(e)!=="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(Im(r)!=="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function NY(e){var t=MY(e,"string");return Im(t)==="symbol"?t:String(t)}function $Y(e,t,n){return t=NY(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function n8(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function r8(e){for(var t=1;t"u"&&(n=t,t=void 0),typeof n<"u"){if(typeof n!="function")throw new Error(Ci(1));return n(Q0)(e,t)}if(typeof e!="function")throw new Error(Ci(2));var i=e,o=t,a=[],s=a,l=!1;function u(){s===a&&(s=a.slice())}function c(){if(l)throw new Error(Ci(3));return o}function d(m){if(typeof m!="function")throw new Error(Ci(4));if(l)throw new Error(Ci(5));var _=!0;return u(),s.push(m),function(){if(_){if(l)throw new Error(Ci(6));_=!1,u();var v=s.indexOf(m);s.splice(v,1),a=null}}}function f(m){if(!DY(m))throw new Error(Ci(7));if(typeof m.type>"u")throw new Error(Ci(8));if(l)throw new Error(Ci(9));try{l=!0,o=i(o,m)}finally{l=!1}for(var _=a=s,b=0;b<_.length;b++){var v=_[b];v()}return m}function h(m){if(typeof m!="function")throw new Error(Ci(10));i=m,f({type:zh.REPLACE})}function p(){var m,_=d;return m={subscribe:function(v){if(typeof v!="object"||v===null)throw new Error(Ci(11));function g(){v.next&&v.next(c())}g();var y=_(g);return{unsubscribe:y}}},m[i8]=function(){return this},m}return f({type:zh.INIT}),r={dispatch:f,subscribe:d,getState:c,replaceReducer:h},r[i8]=p,r}var lL=Q0;function LY(e){Object.keys(e).forEach(function(t){var n=e[t],r=n(void 0,{type:zh.INIT});if(typeof r>"u")throw new Error(Ci(12));if(typeof n(void 0,{type:zh.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(Ci(13))})}function pp(e){for(var t=Object.keys(e),n={},r=0;r"u")throw u&&u.type,new Error(Ci(14));d[h]=_,c=c||_!==m}return c=c||o.length!==Object.keys(l).length,c?d:l}}function o8(e,t){return function(){return t(e.apply(this,arguments))}}function uL(e,t){if(typeof e=="function")return o8(e,t);if(typeof e!="object"||e===null)throw new Error(Ci(16));var n={};for(var r in e){var i=e[r];typeof i=="function"&&(n[r]=o8(i,t))}return n}function jh(){for(var e=arguments.length,t=new Array(e),n=0;n-1){var u=n[l];return l>0&&(n.splice(l,1),n.unshift(u)),u.value}return Fb}function i(s,l){r(s)===Fb&&(n.unshift({key:s,value:l}),n.length>e&&n.pop())}function o(){return n}function a(){n=[]}return{get:r,put:i,getEntries:o,clear:a}}var cL=function(t,n){return t===n};function jY(e){return function(n,r){if(n===null||r===null||n.length!==r.length)return!1;for(var i=n.length,o=0;o1?t-1:0),r=1;r0&&o[o.length-1])&&(u[0]===6||u[0]===2)){n=0;continue}if(u[0]===3&&(!o||u[1]>o[0]&&u[1]",value:e};if(typeof e!="object"||e===null||o!=null&&o.has(e))return!1;for(var s=r!=null?r(e):Object.entries(e),l=i.length>0,u=function(_,b){var v=t?t+"."+_:_;if(l){var g=i.some(function(y){return y instanceof RegExp?y.test(v):v===y});if(g)return"continue"}if(!n(b))return{value:{keyPath:v,value:b}};if(typeof b=="object"&&(a=vL(b,v,n,r,i,o),a))return{value:a}},c=0,d=s;c-1}function iZ(e){return""+e}function wL(e){var t={},n=[],r,i={addCase:function(o,a){var s=typeof o=="string"?o:o.type;if(s in t)throw new Error("addCase cannot be called with two reducers for the same action type");return t[s]=a,i},addMatcher:function(o,a){return n.push({matcher:o,reducer:a}),i},addDefaultCase:function(o){return r=o,i}};return e(i),[t,n,r]}function oZ(e){return typeof e=="function"}function CL(e,t,n,r){n===void 0&&(n=[]);var i=typeof t=="function"?wL(t):[t,n,r],o=i[0],a=i[1],s=i[2],l;if(oZ(e))l=function(){return z3(e())};else{var u=z3(e);l=function(){return u}}function c(d,f){d===void 0&&(d=l());var h=rc([o[f.type]],a.filter(function(p){var m=p.matcher;return m(f)}).map(function(p){var m=p.reducer;return m}));return h.filter(function(p){return!!p}).length===0&&(h=[s]),h.reduce(function(p,m){if(m)if(oo(p)){var _=p,b=m(_,f);return b===void 0?p:b}else{if(Ao(p))return _c(p,function(v){return m(v,f)});var b=m(p,f);if(b===void 0){if(p===null)return p;throw Error("A case reducer on a non-draftable value must not return undefined")}return b}return p},d)}return c.getInitialState=l,c}function aZ(e,t){return e+"/"+t}function nr(e){var t=e.name;if(!t)throw new Error("`name` is a required option for createSlice");typeof process<"u";var n=typeof e.initialState=="function"?e.initialState:z3(e.initialState),r=e.reducers||{},i=Object.keys(r),o={},a={},s={};i.forEach(function(c){var d=r[c],f=aZ(t,c),h,p;"reducer"in d?(h=d.reducer,p=d.prepare):h=d,o[c]=h,a[f]=h,s[c]=p?Ne(f,p):Ne(f)});function l(){var c=typeof e.extraReducers=="function"?wL(e.extraReducers):[e.extraReducers],d=c[0],f=d===void 0?{}:d,h=c[1],p=h===void 0?[]:h,m=c[2],_=m===void 0?void 0:m,b=xo(xo({},f),a);return CL(n,function(v){for(var g in b)v.addCase(g,b[g]);for(var y=0,S=p;y0;if(v){var g=p.filter(function(y){return u(_,y,m)}).length>0;g&&(m.ids=Object.keys(m.entities))}}function f(p,m){return h([p],m)}function h(p,m){var _=EL(p,e,m),b=_[0],v=_[1];d(v,m),n(b,m)}return{removeAll:cZ(l),addOne:xr(t),addMany:xr(n),setOne:xr(r),setMany:xr(i),setAll:xr(o),updateOne:xr(c),updateMany:xr(d),upsertOne:xr(f),upsertMany:xr(h),removeOne:xr(a),removeMany:xr(s)}}function dZ(e,t){var n=TL(e),r=n.removeOne,i=n.removeMany,o=n.removeAll;function a(v,g){return s([v],g)}function s(v,g){v=hd(v);var y=v.filter(function(S){return!(Ug(S,e)in g.entities)});y.length!==0&&_(y,g)}function l(v,g){return u([v],g)}function u(v,g){v=hd(v),v.length!==0&&_(v,g)}function c(v,g){v=hd(v),g.entities={},g.ids=[],s(v,g)}function d(v,g){return f([v],g)}function f(v,g){for(var y=!1,S=0,w=v;S-1;return n&&r}function Z0(e){return typeof e[0]=="function"&&"pending"in e[0]&&"fulfilled"in e[0]&&"rejected"in e[0]}function $S(){for(var e=[],t=0;t0)for(var g=h.getState(),y=Array.from(n.values()),S=0,w=y;SMath.floor(e/t)*t,Ha=(e,t)=>Math.round(e/t)*t;var IZ=typeof global=="object"&&global&&global.Object===Object&&global;const GL=IZ;var RZ=typeof self=="object"&&self&&self.Object===Object&&self,OZ=GL||RZ||Function("return this")();const el=OZ;var MZ=el.Symbol;const wa=MZ;var qL=Object.prototype,NZ=qL.hasOwnProperty,$Z=qL.toString,Vp=wa?wa.toStringTag:void 0;function DZ(e){var t=NZ.call(e,Vp),n=e[Vp];try{e[Vp]=void 0;var r=!0}catch{}var i=$Z.call(e);return r&&(t?e[Vp]=n:delete e[Vp]),i}var LZ=Object.prototype,FZ=LZ.toString;function BZ(e){return FZ.call(e)}var zZ="[object Null]",jZ="[object Undefined]",h8=wa?wa.toStringTag:void 0;function ds(e){return e==null?e===void 0?jZ:zZ:h8&&h8 in Object(e)?DZ(e):BZ(e)}function Po(e){return e!=null&&typeof e=="object"}var UZ="[object Symbol]";function DS(e){return typeof e=="symbol"||Po(e)&&ds(e)==UZ}function HL(e,t){for(var n=-1,r=e==null?0:e.length,i=Array(r);++n0){if(++t>=SJ)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}function EJ(e){return function(){return e}}var TJ=function(){try{var e=Ud(Object,"defineProperty");return e({},"",{}),e}catch{}}();const Gb=TJ;var kJ=Gb?function(e,t){return Gb(e,"toString",{configurable:!0,enumerable:!1,value:EJ(t),writable:!0})}:LS;const AJ=kJ;var PJ=CJ(AJ);const XL=PJ;function YL(e,t){for(var n=-1,r=e==null?0:e.length;++n-1}var $J=9007199254740991,DJ=/^(?:0|[1-9]\d*)$/;function J4(e,t){var n=typeof e;return t=t??$J,!!t&&(n=="number"||n!="symbol"&&DJ.test(e))&&e>-1&&e%1==0&&e-1&&e%1==0&&e<=BJ}function mp(e){return e!=null&&ek(e.length)&&!Z4(e)}function BS(e,t,n){if(!Io(n))return!1;var r=typeof t;return(r=="number"?mp(n)&&J4(t,n.length):r=="string"&&t in n)?ny(n[t],e):!1}function tF(e){return eF(function(t,n){var r=-1,i=n.length,o=i>1?n[i-1]:void 0,a=i>2?n[2]:void 0;for(o=e.length>3&&typeof o=="function"?(i--,o):void 0,a&&BS(n[0],n[1],a)&&(o=i<3?void 0:o,i=1),t=Object(t);++r-1}function ete(e,t){var n=this.__data__,r=jS(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this}function Yl(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t0&&n(s)?t>1?lF(s,t-1,n,r,i):ak(i,s):r||(i[i.length]=s)}return i}function yte(e){var t=e==null?0:e.length;return t?lF(e,1):[]}function vte(e){return XL(JL(e,void 0,yte),e+"")}var bte=aF(Object.getPrototypeOf,Object);const sk=bte;var _te="[object Object]",Ste=Function.prototype,xte=Object.prototype,uF=Ste.toString,wte=xte.hasOwnProperty,Cte=uF.call(Object);function cF(e){if(!Po(e)||ds(e)!=_te)return!1;var t=sk(e);if(t===null)return!0;var n=wte.call(t,"constructor")&&t.constructor;return typeof n=="function"&&n instanceof n&&uF.call(n)==Cte}function dF(e,t,n){var r=-1,i=e.length;t<0&&(t=-t>i?0:i+t),n=n>i?i:n,n<0&&(n+=i),i=t>n?0:n-t>>>0,t>>>=0;for(var o=Array(i);++r=r?e:dF(e,t,n)}var Ete="\\ud800-\\udfff",Tte="\\u0300-\\u036f",kte="\\ufe20-\\ufe2f",Ate="\\u20d0-\\u20ff",Pte=Tte+kte+Ate,Ite="\\ufe0e\\ufe0f",Rte="\\u200d",Ote=RegExp("["+Rte+Ete+Pte+Ite+"]");function GS(e){return Ote.test(e)}function Mte(e){return e.split("")}var hF="\\ud800-\\udfff",Nte="\\u0300-\\u036f",$te="\\ufe20-\\ufe2f",Dte="\\u20d0-\\u20ff",Lte=Nte+$te+Dte,Fte="\\ufe0e\\ufe0f",Bte="["+hF+"]",G3="["+Lte+"]",q3="\\ud83c[\\udffb-\\udfff]",zte="(?:"+G3+"|"+q3+")",pF="[^"+hF+"]",gF="(?:\\ud83c[\\udde6-\\uddff]){2}",mF="[\\ud800-\\udbff][\\udc00-\\udfff]",jte="\\u200d",yF=zte+"?",vF="["+Fte+"]?",Ute="(?:"+jte+"(?:"+[pF,gF,mF].join("|")+")"+vF+yF+")*",Vte=vF+yF+Ute,Gte="(?:"+[pF+G3+"?",G3,gF,mF,Bte].join("|")+")",qte=RegExp(q3+"(?="+q3+")|"+Gte+Vte,"g");function Hte(e){return e.match(qte)||[]}function bF(e){return GS(e)?Hte(e):Mte(e)}function Wte(e){return function(t){t=Vh(t);var n=GS(t)?bF(t):void 0,r=n?n[0]:t.charAt(0),i=n?fF(n,1).join(""):t.slice(1);return r[e]()+i}}var Kte=Wte("toUpperCase");const _F=Kte;function SF(e,t,n,r){var i=-1,o=e==null?0:e.length;for(r&&o&&(n=e[++i]);++i=t?e:t)),e}function Mu(e,t,n){return n===void 0&&(n=t,t=void 0),n!==void 0&&(n=O1(n),n=n===n?n:0),t!==void 0&&(t=O1(t),t=t===t?t:0),Fne(O1(e),t,n)}function Bne(){this.__data__=new Yl,this.size=0}function zne(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}function jne(e){return this.__data__.get(e)}function Une(e){return this.__data__.has(e)}var Vne=200;function Gne(e,t){var n=this.__data__;if(n instanceof Yl){var r=n.__data__;if(!Nm||r.lengths))return!1;var u=o.get(e),c=o.get(t);if(u&&c)return u==t&&c==e;var d=-1,f=!0,h=n&Cie?new $m:void 0;for(o.set(e,t),o.set(t,e);++d1),o}),gp(e,jF(e),n),r&&(n=Gg(n,Voe|Goe|qoe,Uoe));for(var i=t.length;i--;)rB(n,t[i]);return n});const WS=Hoe;var Woe=JF("length");const Koe=Woe;var iB="\\ud800-\\udfff",Qoe="\\u0300-\\u036f",Xoe="\\ufe20-\\ufe2f",Yoe="\\u20d0-\\u20ff",Zoe=Qoe+Xoe+Yoe,Joe="\\ufe0e\\ufe0f",eae="["+iB+"]",Y3="["+Zoe+"]",Z3="\\ud83c[\\udffb-\\udfff]",tae="(?:"+Y3+"|"+Z3+")",oB="[^"+iB+"]",aB="(?:\\ud83c[\\udde6-\\uddff]){2}",sB="[\\ud800-\\udbff][\\udc00-\\udfff]",nae="\\u200d",lB=tae+"?",uB="["+Joe+"]?",rae="(?:"+nae+"(?:"+[oB,aB,sB].join("|")+")"+uB+lB+")*",iae=uB+lB+rae,oae="(?:"+[oB+Y3+"?",Y3,aB,sB,eae].join("|")+")",K8=RegExp(Z3+"(?="+Z3+")|"+oae+iae,"g");function aae(e){for(var t=K8.lastIndex=0;K8.test(e);)++t;return t}function cB(e){return GS(e)?aae(e):Koe(e)}var sae=Math.floor,lae=Math.random;function uae(e,t){return e+sae(lae()*(t-e+1))}var cae=parseFloat,dae=Math.min,fae=Math.random;function hae(e,t,n){if(n&&typeof n!="boolean"&&BS(e,t,n)&&(t=n=void 0),n===void 0&&(typeof t=="boolean"?(n=t,t=void 0):typeof e=="boolean"&&(n=e,e=void 0)),e===void 0&&t===void 0?(e=0,t=1):(e=uh(e),t===void 0?(t=e,e=0):t=uh(t)),e>t){var r=e;e=t,t=r}if(n||e%1||t%1){var i=fae();return dae(e+i*(t-e+cae("1e-"+((i+"").length-1))),t)}return uae(e,t)}var pae=Math.ceil,gae=Math.max;function mae(e,t,n,r){for(var i=-1,o=gae(pae((t-e)/(n||1)),0),a=Array(o);o--;)a[r?o:++i]=e,e+=n;return a}function yae(e){return function(t,n,r){return r&&typeof r!="number"&&BS(t,n,r)&&(n=r=void 0),t=uh(t),n===void 0?(n=t,t=0):n=uh(n),r=r===void 0?t=o)return e;var s=n-cB(r);if(s<1)return r;var l=a?fF(a,0,s).join(""):e.slice(0,s);if(i===void 0)return l+r;if(a&&(s+=l.length-s),Foe(i)){if(e.slice(s).search(i)){var u,c=l;for(i.global||(i=RegExp(i.source,Vh(Aae.exec(i))+"g")),i.lastIndex=0;u=i.exec(c);)var d=u.index;l=l.slice(0,d===void 0?s:d)}}else if(e.indexOf(Vb(i),s)!=s){var f=l.lastIndexOf(i);f>-1&&(l=l.slice(0,f))}return l+r}var Pae=1/0,Iae=dh&&1/ck(new dh([,-0]))[1]==Pae?function(e){return new dh(e)}:_J;const Rae=Iae;var Oae=200;function Mae(e,t,n){var r=-1,i=NJ,o=e.length,a=!0,s=[],l=s;if(n)a=!1,i=_oe;else if(o>=Oae){var u=t?null:Rae(e);if(u)return ck(u);a=!1,i=KF,l=new $m}else l=t?[]:s;e:for(;++r{joe(e,t.payload)}}}),{configChanged:Nae}=fB.actions,$ae=fB.reducer,tUe={any:"Any","sd-1":"Stable Diffusion 1.x","sd-2":"Stable Diffusion 2.x",sdxl:"Stable Diffusion XL","sdxl-refiner":"Stable Diffusion XL Refiner"},nUe={any:"Any","sd-1":"SD1","sd-2":"SD2",sdxl:"SDXL","sdxl-refiner":"SDXLR"},Dae={any:{maxClip:0,markers:[]},"sd-1":{maxClip:12,markers:[0,1,2,3,4,8,12]},"sd-2":{maxClip:24,markers:[0,1,2,3,5,10,15,20,24]},sdxl:{maxClip:24,markers:[0,1,2,3,5,10,15,20,24]},"sdxl-refiner":{maxClip:24,markers:[0,1,2,3,5,10,15,20,24]}},rUe={lycoris:"LyCORIS",diffusers:"Diffusers"},Lae=0,qg=4294967295;var Xt;(function(e){e.assertEqual=i=>i;function t(i){}e.assertIs=t;function n(i){throw new Error}e.assertNever=n,e.arrayToEnum=i=>{const o={};for(const a of i)o[a]=a;return o},e.getValidEnumValues=i=>{const o=e.objectKeys(i).filter(s=>typeof i[i[s]]!="number"),a={};for(const s of o)a[s]=i[s];return e.objectValues(a)},e.objectValues=i=>e.objectKeys(i).map(function(o){return i[o]}),e.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{const o=[];for(const a in i)Object.prototype.hasOwnProperty.call(i,a)&&o.push(a);return o},e.find=(i,o)=>{for(const a of i)if(o(a))return a},e.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&isFinite(i)&&Math.floor(i)===i;function r(i,o=" | "){return i.map(a=>typeof a=="string"?`'${a}'`:a).join(o)}e.joinValues=r,e.jsonStringifyReplacer=(i,o)=>typeof o=="bigint"?o.toString():o})(Xt||(Xt={}));var eE;(function(e){e.mergeShapes=(t,n)=>({...t,...n})})(eE||(eE={}));const Re=Xt.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Eu=e=>{switch(typeof e){case"undefined":return Re.undefined;case"string":return Re.string;case"number":return isNaN(e)?Re.nan:Re.number;case"boolean":return Re.boolean;case"function":return Re.function;case"bigint":return Re.bigint;case"symbol":return Re.symbol;case"object":return Array.isArray(e)?Re.array:e===null?Re.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?Re.promise:typeof Map<"u"&&e instanceof Map?Re.map:typeof Set<"u"&&e instanceof Set?Re.set:typeof Date<"u"&&e instanceof Date?Re.date:Re.object;default:return Re.unknown}},he=Xt.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),Fae=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:");class ns extends Error{constructor(t){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};const n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=t}get errors(){return this.issues}format(t){const n=t||function(o){return o.message},r={_errors:[]},i=o=>{for(const a of o.issues)if(a.code==="invalid_union")a.unionErrors.map(i);else if(a.code==="invalid_return_type")i(a.returnTypeError);else if(a.code==="invalid_arguments")i(a.argumentsError);else if(a.path.length===0)r._errors.push(n(a));else{let s=r,l=0;for(;ln.message){const n={},r=[];for(const i of this.issues)i.path.length>0?(n[i.path[0]]=n[i.path[0]]||[],n[i.path[0]].push(t(i))):r.push(t(i));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}}ns.create=e=>new ns(e);const Dm=(e,t)=>{let n;switch(e.code){case he.invalid_type:e.received===Re.undefined?n="Required":n=`Expected ${e.expected}, received ${e.received}`;break;case he.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,Xt.jsonStringifyReplacer)}`;break;case he.unrecognized_keys:n=`Unrecognized key(s) in object: ${Xt.joinValues(e.keys,", ")}`;break;case he.invalid_union:n="Invalid input";break;case he.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${Xt.joinValues(e.options)}`;break;case he.invalid_enum_value:n=`Invalid enum value. Expected ${Xt.joinValues(e.options)}, received '${e.received}'`;break;case he.invalid_arguments:n="Invalid function arguments";break;case he.invalid_return_type:n="Invalid function return type";break;case he.invalid_date:n="Invalid date";break;case he.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:Xt.assertNever(e.validation):e.validation!=="regex"?n=`Invalid ${e.validation}`:n="Invalid";break;case he.too_small:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:n="Invalid input";break;case he.too_big:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?n=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:n="Invalid input";break;case he.custom:n="Invalid input";break;case he.invalid_intersection_types:n="Intersection results could not be merged";break;case he.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case he.not_finite:n="Number must be finite";break;default:n=t.defaultError,Xt.assertNever(e)}return{message:n}};let hB=Dm;function Bae(e){hB=e}function Hb(){return hB}const Wb=e=>{const{data:t,path:n,errorMaps:r,issueData:i}=e,o=[...n,...i.path||[]],a={...i,path:o};let s="";const l=r.filter(u=>!!u).slice().reverse();for(const u of l)s=u(a,{data:t,defaultError:s}).message;return{...i,path:o,message:i.message||s}},zae=[];function Me(e,t){const n=Wb({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,Hb(),Dm].filter(r=>!!r)});e.common.issues.push(n)}class Ki{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,n){const r=[];for(const i of n){if(i.status==="aborted")return vt;i.status==="dirty"&&t.dirty(),r.push(i.value)}return{status:t.value,value:r}}static async mergeObjectAsync(t,n){const r=[];for(const i of n)r.push({key:await i.key,value:await i.value});return Ki.mergeObjectSync(t,r)}static mergeObjectSync(t,n){const r={};for(const i of n){const{key:o,value:a}=i;if(o.status==="aborted"||a.status==="aborted")return vt;o.status==="dirty"&&t.dirty(),a.status==="dirty"&&t.dirty(),o.value!=="__proto__"&&(typeof a.value<"u"||i.alwaysSet)&&(r[o.value]=a.value)}return{status:t.value,value:r}}}const vt=Object.freeze({status:"aborted"}),pB=e=>({status:"dirty",value:e}),ao=e=>({status:"valid",value:e}),tE=e=>e.status==="aborted",nE=e=>e.status==="dirty",Lm=e=>e.status==="valid",Kb=e=>typeof Promise<"u"&&e instanceof Promise;var rt;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t==null?void 0:t.message})(rt||(rt={}));class Qs{constructor(t,n,r,i){this._cachedPath=[],this.parent=t,this.data=n,this._path=r,this._key=i}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const Z8=(e,t)=>{if(Lm(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const n=new ns(e.common.issues);return this._error=n,this._error}}};function xt(e){if(!e)return{};const{errorMap:t,invalid_type_error:n,required_error:r,description:i}=e;if(t&&(n||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:i}:{errorMap:(a,s)=>a.code!=="invalid_type"?{message:s.defaultError}:typeof s.data>"u"?{message:r??s.defaultError}:{message:n??s.defaultError},description:i}}class Et{constructor(t){this.spa=this.safeParseAsync,this._def=t,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(t){return Eu(t.data)}_getOrReturnCtx(t,n){return n||{common:t.parent.common,data:t.data,parsedType:Eu(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new Ki,ctx:{common:t.parent.common,data:t.data,parsedType:Eu(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){const n=this._parse(t);if(Kb(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(t){const n=this._parse(t);return Promise.resolve(n)}parse(t,n){const r=this.safeParse(t,n);if(r.success)return r.data;throw r.error}safeParse(t,n){var r;const i={common:{issues:[],async:(r=n==null?void 0:n.async)!==null&&r!==void 0?r:!1,contextualErrorMap:n==null?void 0:n.errorMap},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Eu(t)},o=this._parseSync({data:t,path:i.path,parent:i});return Z8(i,o)}async parseAsync(t,n){const r=await this.safeParseAsync(t,n);if(r.success)return r.data;throw r.error}async safeParseAsync(t,n){const r={common:{issues:[],contextualErrorMap:n==null?void 0:n.errorMap,async:!0},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Eu(t)},i=this._parse({data:t,path:r.path,parent:r}),o=await(Kb(i)?i:Promise.resolve(i));return Z8(r,o)}refine(t,n){const r=i=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(i):n;return this._refinement((i,o)=>{const a=t(i),s=()=>o.addIssue({code:he.custom,...r(i)});return typeof Promise<"u"&&a instanceof Promise?a.then(l=>l?!0:(s(),!1)):a?!0:(s(),!1)})}refinement(t,n){return this._refinement((r,i)=>t(r)?!0:(i.addIssue(typeof n=="function"?n(r,i):n),!1))}_refinement(t){return new ss({schema:this,typeName:st.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}optional(){return Nl.create(this,this._def)}nullable(){return Id.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return rs.create(this,this._def)}promise(){return Hh.create(this,this._def)}or(t){return jm.create([this,t],this._def)}and(t){return Um.create(this,t,this._def)}transform(t){return new ss({...xt(this._def),schema:this,typeName:st.ZodEffects,effect:{type:"transform",transform:t}})}default(t){const n=typeof t=="function"?t:()=>t;return new Wm({...xt(this._def),innerType:this,defaultValue:n,typeName:st.ZodDefault})}brand(){return new mB({typeName:st.ZodBranded,type:this,...xt(this._def)})}catch(t){const n=typeof t=="function"?t:()=>t;return new Zb({...xt(this._def),innerType:this,catchValue:n,typeName:st.ZodCatch})}describe(t){const n=this.constructor;return new n({...this._def,description:t})}pipe(t){return ly.create(this,t)}readonly(){return e_.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const jae=/^c[^\s-]{8,}$/i,Uae=/^[a-z][a-z0-9]*$/,Vae=/[0-9A-HJKMNP-TV-Z]{26}/,Gae=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,qae=/^([A-Z0-9_+-]+\.?)*[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Hae=/^(\p{Extended_Pictographic}|\p{Emoji_Component})+$/u,Wae=/^(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))$/,Kae=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,Qae=e=>e.precision?e.offset?new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${e.precision}}(([+-]\\d{2}(:?\\d{2})?)|Z)$`):new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${e.precision}}Z$`):e.precision===0?e.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(([+-]\\d{2}(:?\\d{2})?)|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$"):e.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}(:?\\d{2})?)|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$");function Xae(e,t){return!!((t==="v4"||!t)&&Wae.test(e)||(t==="v6"||!t)&&Kae.test(e))}class Ya extends Et{constructor(){super(...arguments),this._regex=(t,n,r)=>this.refinement(i=>t.test(i),{validation:n,code:he.invalid_string,...rt.errToObj(r)}),this.nonempty=t=>this.min(1,rt.errToObj(t)),this.trim=()=>new Ya({...this._def,checks:[...this._def.checks,{kind:"trim"}]}),this.toLowerCase=()=>new Ya({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]}),this.toUpperCase=()=>new Ya({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==Re.string){const o=this._getOrReturnCtx(t);return Me(o,{code:he.invalid_type,expected:Re.string,received:o.parsedType}),vt}const r=new Ki;let i;for(const o of this._def.checks)if(o.kind==="min")t.data.lengtho.value&&(i=this._getOrReturnCtx(t,i),Me(i,{code:he.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),r.dirty());else if(o.kind==="length"){const a=t.data.length>o.value,s=t.data.length"u"?null:t==null?void 0:t.precision,offset:(n=t==null?void 0:t.offset)!==null&&n!==void 0?n:!1,...rt.errToObj(t==null?void 0:t.message)})}regex(t,n){return this._addCheck({kind:"regex",regex:t,...rt.errToObj(n)})}includes(t,n){return this._addCheck({kind:"includes",value:t,position:n==null?void 0:n.position,...rt.errToObj(n==null?void 0:n.message)})}startsWith(t,n){return this._addCheck({kind:"startsWith",value:t,...rt.errToObj(n)})}endsWith(t,n){return this._addCheck({kind:"endsWith",value:t,...rt.errToObj(n)})}min(t,n){return this._addCheck({kind:"min",value:t,...rt.errToObj(n)})}max(t,n){return this._addCheck({kind:"max",value:t,...rt.errToObj(n)})}length(t,n){return this._addCheck({kind:"length",value:t,...rt.errToObj(n)})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get minLength(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxLength(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value{var t;return new Ya({checks:[],typeName:st.ZodString,coerce:(t=e==null?void 0:e.coerce)!==null&&t!==void 0?t:!1,...xt(e)})};function Yae(e,t){const n=(e.toString().split(".")[1]||"").length,r=(t.toString().split(".")[1]||"").length,i=n>r?n:r,o=parseInt(e.toFixed(i).replace(".","")),a=parseInt(t.toFixed(i).replace(".",""));return o%a/Math.pow(10,i)}class oc extends Et{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==Re.number){const o=this._getOrReturnCtx(t);return Me(o,{code:he.invalid_type,expected:Re.number,received:o.parsedType}),vt}let r;const i=new Ki;for(const o of this._def.checks)o.kind==="int"?Xt.isInteger(t.data)||(r=this._getOrReturnCtx(t,r),Me(r,{code:he.invalid_type,expected:"integer",received:"float",message:o.message}),i.dirty()):o.kind==="min"?(o.inclusive?t.datao.value:t.data>=o.value)&&(r=this._getOrReturnCtx(t,r),Me(r,{code:he.too_big,maximum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),i.dirty()):o.kind==="multipleOf"?Yae(t.data,o.value)!==0&&(r=this._getOrReturnCtx(t,r),Me(r,{code:he.not_multiple_of,multipleOf:o.value,message:o.message}),i.dirty()):o.kind==="finite"?Number.isFinite(t.data)||(r=this._getOrReturnCtx(t,r),Me(r,{code:he.not_finite,message:o.message}),i.dirty()):Xt.assertNever(o);return{status:i.value,value:t.data}}gte(t,n){return this.setLimit("min",t,!0,rt.toString(n))}gt(t,n){return this.setLimit("min",t,!1,rt.toString(n))}lte(t,n){return this.setLimit("max",t,!0,rt.toString(n))}lt(t,n){return this.setLimit("max",t,!1,rt.toString(n))}setLimit(t,n,r,i){return new oc({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:rt.toString(i)}]})}_addCheck(t){return new oc({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:rt.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:rt.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:rt.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:rt.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:rt.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:rt.toString(n)})}finite(t){return this._addCheck({kind:"finite",message:rt.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:rt.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:rt.toString(t)})}get minValue(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.valuet.kind==="int"||t.kind==="multipleOf"&&Xt.isInteger(t.value))}get isFinite(){let t=null,n=null;for(const r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(n===null||r.value>n)&&(n=r.value):r.kind==="max"&&(t===null||r.valuenew oc({checks:[],typeName:st.ZodNumber,coerce:(e==null?void 0:e.coerce)||!1,...xt(e)});class ac extends Et{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce&&(t.data=BigInt(t.data)),this._getType(t)!==Re.bigint){const o=this._getOrReturnCtx(t);return Me(o,{code:he.invalid_type,expected:Re.bigint,received:o.parsedType}),vt}let r;const i=new Ki;for(const o of this._def.checks)o.kind==="min"?(o.inclusive?t.datao.value:t.data>=o.value)&&(r=this._getOrReturnCtx(t,r),Me(r,{code:he.too_big,type:"bigint",maximum:o.value,inclusive:o.inclusive,message:o.message}),i.dirty()):o.kind==="multipleOf"?t.data%o.value!==BigInt(0)&&(r=this._getOrReturnCtx(t,r),Me(r,{code:he.not_multiple_of,multipleOf:o.value,message:o.message}),i.dirty()):Xt.assertNever(o);return{status:i.value,value:t.data}}gte(t,n){return this.setLimit("min",t,!0,rt.toString(n))}gt(t,n){return this.setLimit("min",t,!1,rt.toString(n))}lte(t,n){return this.setLimit("max",t,!0,rt.toString(n))}lt(t,n){return this.setLimit("max",t,!1,rt.toString(n))}setLimit(t,n,r,i){return new ac({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:rt.toString(i)}]})}_addCheck(t){return new ac({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:rt.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:rt.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:rt.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:rt.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:rt.toString(n)})}get minValue(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value{var t;return new ac({checks:[],typeName:st.ZodBigInt,coerce:(t=e==null?void 0:e.coerce)!==null&&t!==void 0?t:!1,...xt(e)})};class Fm extends Et{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==Re.boolean){const r=this._getOrReturnCtx(t);return Me(r,{code:he.invalid_type,expected:Re.boolean,received:r.parsedType}),vt}return ao(t.data)}}Fm.create=e=>new Fm({typeName:st.ZodBoolean,coerce:(e==null?void 0:e.coerce)||!1,...xt(e)});class Ad extends Et{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==Re.date){const o=this._getOrReturnCtx(t);return Me(o,{code:he.invalid_type,expected:Re.date,received:o.parsedType}),vt}if(isNaN(t.data.getTime())){const o=this._getOrReturnCtx(t);return Me(o,{code:he.invalid_date}),vt}const r=new Ki;let i;for(const o of this._def.checks)o.kind==="min"?t.data.getTime()o.value&&(i=this._getOrReturnCtx(t,i),Me(i,{code:he.too_big,message:o.message,inclusive:!0,exact:!1,maximum:o.value,type:"date"}),r.dirty()):Xt.assertNever(o);return{status:r.value,value:new Date(t.data.getTime())}}_addCheck(t){return new Ad({...this._def,checks:[...this._def.checks,t]})}min(t,n){return this._addCheck({kind:"min",value:t.getTime(),message:rt.toString(n)})}max(t,n){return this._addCheck({kind:"max",value:t.getTime(),message:rt.toString(n)})}get minDate(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.valuenew Ad({checks:[],coerce:(e==null?void 0:e.coerce)||!1,typeName:st.ZodDate,...xt(e)});class Qb extends Et{_parse(t){if(this._getType(t)!==Re.symbol){const r=this._getOrReturnCtx(t);return Me(r,{code:he.invalid_type,expected:Re.symbol,received:r.parsedType}),vt}return ao(t.data)}}Qb.create=e=>new Qb({typeName:st.ZodSymbol,...xt(e)});class Bm extends Et{_parse(t){if(this._getType(t)!==Re.undefined){const r=this._getOrReturnCtx(t);return Me(r,{code:he.invalid_type,expected:Re.undefined,received:r.parsedType}),vt}return ao(t.data)}}Bm.create=e=>new Bm({typeName:st.ZodUndefined,...xt(e)});class zm extends Et{_parse(t){if(this._getType(t)!==Re.null){const r=this._getOrReturnCtx(t);return Me(r,{code:he.invalid_type,expected:Re.null,received:r.parsedType}),vt}return ao(t.data)}}zm.create=e=>new zm({typeName:st.ZodNull,...xt(e)});class qh extends Et{constructor(){super(...arguments),this._any=!0}_parse(t){return ao(t.data)}}qh.create=e=>new qh({typeName:st.ZodAny,...xt(e)});class pd extends Et{constructor(){super(...arguments),this._unknown=!0}_parse(t){return ao(t.data)}}pd.create=e=>new pd({typeName:st.ZodUnknown,...xt(e)});class ql extends Et{_parse(t){const n=this._getOrReturnCtx(t);return Me(n,{code:he.invalid_type,expected:Re.never,received:n.parsedType}),vt}}ql.create=e=>new ql({typeName:st.ZodNever,...xt(e)});class Xb extends Et{_parse(t){if(this._getType(t)!==Re.undefined){const r=this._getOrReturnCtx(t);return Me(r,{code:he.invalid_type,expected:Re.void,received:r.parsedType}),vt}return ao(t.data)}}Xb.create=e=>new Xb({typeName:st.ZodVoid,...xt(e)});class rs extends Et{_parse(t){const{ctx:n,status:r}=this._processInputParams(t),i=this._def;if(n.parsedType!==Re.array)return Me(n,{code:he.invalid_type,expected:Re.array,received:n.parsedType}),vt;if(i.exactLength!==null){const a=n.data.length>i.exactLength.value,s=n.data.lengthi.maxLength.value&&(Me(n,{code:he.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((a,s)=>i.type._parseAsync(new Qs(n,a,n.path,s)))).then(a=>Ki.mergeArray(r,a));const o=[...n.data].map((a,s)=>i.type._parseSync(new Qs(n,a,n.path,s)));return Ki.mergeArray(r,o)}get element(){return this._def.type}min(t,n){return new rs({...this._def,minLength:{value:t,message:rt.toString(n)}})}max(t,n){return new rs({...this._def,maxLength:{value:t,message:rt.toString(n)}})}length(t,n){return new rs({...this._def,exactLength:{value:t,message:rt.toString(n)}})}nonempty(t){return this.min(1,t)}}rs.create=(e,t)=>new rs({type:e,minLength:null,maxLength:null,exactLength:null,typeName:st.ZodArray,...xt(t)});function wf(e){if(e instanceof ar){const t={};for(const n in e.shape){const r=e.shape[n];t[n]=Nl.create(wf(r))}return new ar({...e._def,shape:()=>t})}else return e instanceof rs?new rs({...e._def,type:wf(e.element)}):e instanceof Nl?Nl.create(wf(e.unwrap())):e instanceof Id?Id.create(wf(e.unwrap())):e instanceof Xs?Xs.create(e.items.map(t=>wf(t))):e}class ar extends Et{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const t=this._def.shape(),n=Xt.objectKeys(t);return this._cached={shape:t,keys:n}}_parse(t){if(this._getType(t)!==Re.object){const u=this._getOrReturnCtx(t);return Me(u,{code:he.invalid_type,expected:Re.object,received:u.parsedType}),vt}const{status:r,ctx:i}=this._processInputParams(t),{shape:o,keys:a}=this._getCached(),s=[];if(!(this._def.catchall instanceof ql&&this._def.unknownKeys==="strip"))for(const u in i.data)a.includes(u)||s.push(u);const l=[];for(const u of a){const c=o[u],d=i.data[u];l.push({key:{status:"valid",value:u},value:c._parse(new Qs(i,d,i.path,u)),alwaysSet:u in i.data})}if(this._def.catchall instanceof ql){const u=this._def.unknownKeys;if(u==="passthrough")for(const c of s)l.push({key:{status:"valid",value:c},value:{status:"valid",value:i.data[c]}});else if(u==="strict")s.length>0&&(Me(i,{code:he.unrecognized_keys,keys:s}),r.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const u=this._def.catchall;for(const c of s){const d=i.data[c];l.push({key:{status:"valid",value:c},value:u._parse(new Qs(i,d,i.path,c)),alwaysSet:c in i.data})}}return i.common.async?Promise.resolve().then(async()=>{const u=[];for(const c of l){const d=await c.key;u.push({key:d,value:await c.value,alwaysSet:c.alwaysSet})}return u}).then(u=>Ki.mergeObjectSync(r,u)):Ki.mergeObjectSync(r,l)}get shape(){return this._def.shape()}strict(t){return rt.errToObj,new ar({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(n,r)=>{var i,o,a,s;const l=(a=(o=(i=this._def).errorMap)===null||o===void 0?void 0:o.call(i,n,r).message)!==null&&a!==void 0?a:r.defaultError;return n.code==="unrecognized_keys"?{message:(s=rt.errToObj(t).message)!==null&&s!==void 0?s:l}:{message:l}}}:{}})}strip(){return new ar({...this._def,unknownKeys:"strip"})}passthrough(){return new ar({...this._def,unknownKeys:"passthrough"})}extend(t){return new ar({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new ar({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:st.ZodObject})}setKey(t,n){return this.augment({[t]:n})}catchall(t){return new ar({...this._def,catchall:t})}pick(t){const n={};return Xt.objectKeys(t).forEach(r=>{t[r]&&this.shape[r]&&(n[r]=this.shape[r])}),new ar({...this._def,shape:()=>n})}omit(t){const n={};return Xt.objectKeys(this.shape).forEach(r=>{t[r]||(n[r]=this.shape[r])}),new ar({...this._def,shape:()=>n})}deepPartial(){return wf(this)}partial(t){const n={};return Xt.objectKeys(this.shape).forEach(r=>{const i=this.shape[r];t&&!t[r]?n[r]=i:n[r]=i.optional()}),new ar({...this._def,shape:()=>n})}required(t){const n={};return Xt.objectKeys(this.shape).forEach(r=>{if(t&&!t[r])n[r]=this.shape[r];else{let o=this.shape[r];for(;o instanceof Nl;)o=o._def.innerType;n[r]=o}}),new ar({...this._def,shape:()=>n})}keyof(){return gB(Xt.objectKeys(this.shape))}}ar.create=(e,t)=>new ar({shape:()=>e,unknownKeys:"strip",catchall:ql.create(),typeName:st.ZodObject,...xt(t)});ar.strictCreate=(e,t)=>new ar({shape:()=>e,unknownKeys:"strict",catchall:ql.create(),typeName:st.ZodObject,...xt(t)});ar.lazycreate=(e,t)=>new ar({shape:e,unknownKeys:"strip",catchall:ql.create(),typeName:st.ZodObject,...xt(t)});class jm extends Et{_parse(t){const{ctx:n}=this._processInputParams(t),r=this._def.options;function i(o){for(const s of o)if(s.result.status==="valid")return s.result;for(const s of o)if(s.result.status==="dirty")return n.common.issues.push(...s.ctx.common.issues),s.result;const a=o.map(s=>new ns(s.ctx.common.issues));return Me(n,{code:he.invalid_union,unionErrors:a}),vt}if(n.common.async)return Promise.all(r.map(async o=>{const a={...n,common:{...n.common,issues:[]},parent:null};return{result:await o._parseAsync({data:n.data,path:n.path,parent:a}),ctx:a}})).then(i);{let o;const a=[];for(const l of r){const u={...n,common:{...n.common,issues:[]},parent:null},c=l._parseSync({data:n.data,path:n.path,parent:u});if(c.status==="valid")return c;c.status==="dirty"&&!o&&(o={result:c,ctx:u}),u.common.issues.length&&a.push(u.common.issues)}if(o)return n.common.issues.push(...o.ctx.common.issues),o.result;const s=a.map(l=>new ns(l));return Me(n,{code:he.invalid_union,unionErrors:s}),vt}}get options(){return this._def.options}}jm.create=(e,t)=>new jm({options:e,typeName:st.ZodUnion,...xt(t)});const M1=e=>e instanceof Gm?M1(e.schema):e instanceof ss?M1(e.innerType()):e instanceof qm?[e.value]:e instanceof sc?e.options:e instanceof Hm?Object.keys(e.enum):e instanceof Wm?M1(e._def.innerType):e instanceof Bm?[void 0]:e instanceof zm?[null]:null;class QS extends Et{_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==Re.object)return Me(n,{code:he.invalid_type,expected:Re.object,received:n.parsedType}),vt;const r=this.discriminator,i=n.data[r],o=this.optionsMap.get(i);return o?n.common.async?o._parseAsync({data:n.data,path:n.path,parent:n}):o._parseSync({data:n.data,path:n.path,parent:n}):(Me(n,{code:he.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),vt)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,n,r){const i=new Map;for(const o of n){const a=M1(o.shape[t]);if(!a)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(const s of a){if(i.has(s))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(s)}`);i.set(s,o)}}return new QS({typeName:st.ZodDiscriminatedUnion,discriminator:t,options:n,optionsMap:i,...xt(r)})}}function rE(e,t){const n=Eu(e),r=Eu(t);if(e===t)return{valid:!0,data:e};if(n===Re.object&&r===Re.object){const i=Xt.objectKeys(t),o=Xt.objectKeys(e).filter(s=>i.indexOf(s)!==-1),a={...e,...t};for(const s of o){const l=rE(e[s],t[s]);if(!l.valid)return{valid:!1};a[s]=l.data}return{valid:!0,data:a}}else if(n===Re.array&&r===Re.array){if(e.length!==t.length)return{valid:!1};const i=[];for(let o=0;o{if(tE(o)||tE(a))return vt;const s=rE(o.value,a.value);return s.valid?((nE(o)||nE(a))&&n.dirty(),{status:n.value,value:s.data}):(Me(r,{code:he.invalid_intersection_types}),vt)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([o,a])=>i(o,a)):i(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}Um.create=(e,t,n)=>new Um({left:e,right:t,typeName:st.ZodIntersection,...xt(n)});class Xs extends Et{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==Re.array)return Me(r,{code:he.invalid_type,expected:Re.array,received:r.parsedType}),vt;if(r.data.lengththis._def.items.length&&(Me(r,{code:he.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());const o=[...r.data].map((a,s)=>{const l=this._def.items[s]||this._def.rest;return l?l._parse(new Qs(r,a,r.path,s)):null}).filter(a=>!!a);return r.common.async?Promise.all(o).then(a=>Ki.mergeArray(n,a)):Ki.mergeArray(n,o)}get items(){return this._def.items}rest(t){return new Xs({...this._def,rest:t})}}Xs.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Xs({items:e,typeName:st.ZodTuple,rest:null,...xt(t)})};class Vm extends Et{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==Re.object)return Me(r,{code:he.invalid_type,expected:Re.object,received:r.parsedType}),vt;const i=[],o=this._def.keyType,a=this._def.valueType;for(const s in r.data)i.push({key:o._parse(new Qs(r,s,r.path,s)),value:a._parse(new Qs(r,r.data[s],r.path,s))});return r.common.async?Ki.mergeObjectAsync(n,i):Ki.mergeObjectSync(n,i)}get element(){return this._def.valueType}static create(t,n,r){return n instanceof Et?new Vm({keyType:t,valueType:n,typeName:st.ZodRecord,...xt(r)}):new Vm({keyType:Ya.create(),valueType:t,typeName:st.ZodRecord,...xt(n)})}}class Yb extends Et{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==Re.map)return Me(r,{code:he.invalid_type,expected:Re.map,received:r.parsedType}),vt;const i=this._def.keyType,o=this._def.valueType,a=[...r.data.entries()].map(([s,l],u)=>({key:i._parse(new Qs(r,s,r.path,[u,"key"])),value:o._parse(new Qs(r,l,r.path,[u,"value"]))}));if(r.common.async){const s=new Map;return Promise.resolve().then(async()=>{for(const l of a){const u=await l.key,c=await l.value;if(u.status==="aborted"||c.status==="aborted")return vt;(u.status==="dirty"||c.status==="dirty")&&n.dirty(),s.set(u.value,c.value)}return{status:n.value,value:s}})}else{const s=new Map;for(const l of a){const u=l.key,c=l.value;if(u.status==="aborted"||c.status==="aborted")return vt;(u.status==="dirty"||c.status==="dirty")&&n.dirty(),s.set(u.value,c.value)}return{status:n.value,value:s}}}}Yb.create=(e,t,n)=>new Yb({valueType:t,keyType:e,typeName:st.ZodMap,...xt(n)});class Pd extends Et{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==Re.set)return Me(r,{code:he.invalid_type,expected:Re.set,received:r.parsedType}),vt;const i=this._def;i.minSize!==null&&r.data.sizei.maxSize.value&&(Me(r,{code:he.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),n.dirty());const o=this._def.valueType;function a(l){const u=new Set;for(const c of l){if(c.status==="aborted")return vt;c.status==="dirty"&&n.dirty(),u.add(c.value)}return{status:n.value,value:u}}const s=[...r.data.values()].map((l,u)=>o._parse(new Qs(r,l,r.path,u)));return r.common.async?Promise.all(s).then(l=>a(l)):a(s)}min(t,n){return new Pd({...this._def,minSize:{value:t,message:rt.toString(n)}})}max(t,n){return new Pd({...this._def,maxSize:{value:t,message:rt.toString(n)}})}size(t,n){return this.min(t,n).max(t,n)}nonempty(t){return this.min(1,t)}}Pd.create=(e,t)=>new Pd({valueType:e,minSize:null,maxSize:null,typeName:st.ZodSet,...xt(t)});class fh extends Et{constructor(){super(...arguments),this.validate=this.implement}_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==Re.function)return Me(n,{code:he.invalid_type,expected:Re.function,received:n.parsedType}),vt;function r(s,l){return Wb({data:s,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,Hb(),Dm].filter(u=>!!u),issueData:{code:he.invalid_arguments,argumentsError:l}})}function i(s,l){return Wb({data:s,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,Hb(),Dm].filter(u=>!!u),issueData:{code:he.invalid_return_type,returnTypeError:l}})}const o={errorMap:n.common.contextualErrorMap},a=n.data;if(this._def.returns instanceof Hh){const s=this;return ao(async function(...l){const u=new ns([]),c=await s._def.args.parseAsync(l,o).catch(h=>{throw u.addIssue(r(l,h)),u}),d=await Reflect.apply(a,this,c);return await s._def.returns._def.type.parseAsync(d,o).catch(h=>{throw u.addIssue(i(d,h)),u})})}else{const s=this;return ao(function(...l){const u=s._def.args.safeParse(l,o);if(!u.success)throw new ns([r(l,u.error)]);const c=Reflect.apply(a,this,u.data),d=s._def.returns.safeParse(c,o);if(!d.success)throw new ns([i(c,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new fh({...this._def,args:Xs.create(t).rest(pd.create())})}returns(t){return new fh({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,n,r){return new fh({args:t||Xs.create([]).rest(pd.create()),returns:n||pd.create(),typeName:st.ZodFunction,...xt(r)})}}class Gm extends Et{get schema(){return this._def.getter()}_parse(t){const{ctx:n}=this._processInputParams(t);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}}Gm.create=(e,t)=>new Gm({getter:e,typeName:st.ZodLazy,...xt(t)});class qm extends Et{_parse(t){if(t.data!==this._def.value){const n=this._getOrReturnCtx(t);return Me(n,{received:n.data,code:he.invalid_literal,expected:this._def.value}),vt}return{status:"valid",value:t.data}}get value(){return this._def.value}}qm.create=(e,t)=>new qm({value:e,typeName:st.ZodLiteral,...xt(t)});function gB(e,t){return new sc({values:e,typeName:st.ZodEnum,...xt(t)})}class sc extends Et{_parse(t){if(typeof t.data!="string"){const n=this._getOrReturnCtx(t),r=this._def.values;return Me(n,{expected:Xt.joinValues(r),received:n.parsedType,code:he.invalid_type}),vt}if(this._def.values.indexOf(t.data)===-1){const n=this._getOrReturnCtx(t),r=this._def.values;return Me(n,{received:n.data,code:he.invalid_enum_value,options:r}),vt}return ao(t.data)}get options(){return this._def.values}get enum(){const t={};for(const n of this._def.values)t[n]=n;return t}get Values(){const t={};for(const n of this._def.values)t[n]=n;return t}get Enum(){const t={};for(const n of this._def.values)t[n]=n;return t}extract(t){return sc.create(t)}exclude(t){return sc.create(this.options.filter(n=>!t.includes(n)))}}sc.create=gB;class Hm extends Et{_parse(t){const n=Xt.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(t);if(r.parsedType!==Re.string&&r.parsedType!==Re.number){const i=Xt.objectValues(n);return Me(r,{expected:Xt.joinValues(i),received:r.parsedType,code:he.invalid_type}),vt}if(n.indexOf(t.data)===-1){const i=Xt.objectValues(n);return Me(r,{received:r.data,code:he.invalid_enum_value,options:i}),vt}return ao(t.data)}get enum(){return this._def.values}}Hm.create=(e,t)=>new Hm({values:e,typeName:st.ZodNativeEnum,...xt(t)});class Hh extends Et{unwrap(){return this._def.type}_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==Re.promise&&n.common.async===!1)return Me(n,{code:he.invalid_type,expected:Re.promise,received:n.parsedType}),vt;const r=n.parsedType===Re.promise?n.data:Promise.resolve(n.data);return ao(r.then(i=>this._def.type.parseAsync(i,{path:n.path,errorMap:n.common.contextualErrorMap})))}}Hh.create=(e,t)=>new Hh({type:e,typeName:st.ZodPromise,...xt(t)});class ss extends Et{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===st.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){const{status:n,ctx:r}=this._processInputParams(t),i=this._def.effect||null,o={addIssue:a=>{Me(r,a),a.fatal?n.abort():n.dirty()},get path(){return r.path}};if(o.addIssue=o.addIssue.bind(o),i.type==="preprocess"){const a=i.transform(r.data,o);return r.common.issues.length?{status:"dirty",value:r.data}:r.common.async?Promise.resolve(a).then(s=>this._def.schema._parseAsync({data:s,path:r.path,parent:r})):this._def.schema._parseSync({data:a,path:r.path,parent:r})}if(i.type==="refinement"){const a=s=>{const l=i.refinement(s,o);if(r.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return s};if(r.common.async===!1){const s=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?vt:(s.status==="dirty"&&n.dirty(),a(s.value),{status:n.value,value:s.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(s=>s.status==="aborted"?vt:(s.status==="dirty"&&n.dirty(),a(s.value).then(()=>({status:n.value,value:s.value}))))}if(i.type==="transform")if(r.common.async===!1){const a=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!Lm(a))return a;const s=i.transform(a.value,o);if(s instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:s}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(a=>Lm(a)?Promise.resolve(i.transform(a.value,o)).then(s=>({status:n.value,value:s})):a);Xt.assertNever(i)}}ss.create=(e,t,n)=>new ss({schema:e,typeName:st.ZodEffects,effect:t,...xt(n)});ss.createWithPreprocess=(e,t,n)=>new ss({schema:t,effect:{type:"preprocess",transform:e},typeName:st.ZodEffects,...xt(n)});class Nl extends Et{_parse(t){return this._getType(t)===Re.undefined?ao(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}Nl.create=(e,t)=>new Nl({innerType:e,typeName:st.ZodOptional,...xt(t)});class Id extends Et{_parse(t){return this._getType(t)===Re.null?ao(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}Id.create=(e,t)=>new Id({innerType:e,typeName:st.ZodNullable,...xt(t)});class Wm extends Et{_parse(t){const{ctx:n}=this._processInputParams(t);let r=n.data;return n.parsedType===Re.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}}Wm.create=(e,t)=>new Wm({innerType:e,typeName:st.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...xt(t)});class Zb extends Et{_parse(t){const{ctx:n}=this._processInputParams(t),r={...n,common:{...n.common,issues:[]}},i=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return Kb(i)?i.then(o=>({status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new ns(r.common.issues)},input:r.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new ns(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}Zb.create=(e,t)=>new Zb({innerType:e,typeName:st.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...xt(t)});class Jb extends Et{_parse(t){if(this._getType(t)!==Re.nan){const r=this._getOrReturnCtx(t);return Me(r,{code:he.invalid_type,expected:Re.nan,received:r.parsedType}),vt}return{status:"valid",value:t.data}}}Jb.create=e=>new Jb({typeName:st.ZodNaN,...xt(e)});const Zae=Symbol("zod_brand");class mB extends Et{_parse(t){const{ctx:n}=this._processInputParams(t),r=n.data;return this._def.type._parse({data:r,path:n.path,parent:n})}unwrap(){return this._def.type}}class ly extends Et{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.common.async)return(async()=>{const o=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return o.status==="aborted"?vt:o.status==="dirty"?(n.dirty(),pB(o.value)):this._def.out._parseAsync({data:o.value,path:r.path,parent:r})})();{const i=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return i.status==="aborted"?vt:i.status==="dirty"?(n.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:r.path,parent:r})}}static create(t,n){return new ly({in:t,out:n,typeName:st.ZodPipeline})}}class e_ extends Et{_parse(t){const n=this._def.innerType._parse(t);return Lm(n)&&(n.value=Object.freeze(n.value)),n}}e_.create=(e,t)=>new e_({innerType:e,typeName:st.ZodReadonly,...xt(t)});const yB=(e,t={},n)=>e?qh.create().superRefine((r,i)=>{var o,a;if(!e(r)){const s=typeof t=="function"?t(r):typeof t=="string"?{message:t}:t,l=(a=(o=s.fatal)!==null&&o!==void 0?o:n)!==null&&a!==void 0?a:!0,u=typeof s=="string"?{message:s}:s;i.addIssue({code:"custom",...u,fatal:l})}}):qh.create(),Jae={object:ar.lazycreate};var st;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(st||(st={}));const ese=(e,t={message:`Input not instance of ${e.name}`})=>yB(n=>n instanceof e,t),vB=Ya.create,bB=oc.create,tse=Jb.create,nse=ac.create,_B=Fm.create,rse=Ad.create,ise=Qb.create,ose=Bm.create,ase=zm.create,sse=qh.create,lse=pd.create,use=ql.create,cse=Xb.create,dse=rs.create,fse=ar.create,hse=ar.strictCreate,pse=jm.create,gse=QS.create,mse=Um.create,yse=Xs.create,vse=Vm.create,bse=Yb.create,_se=Pd.create,Sse=fh.create,xse=Gm.create,wse=qm.create,Cse=sc.create,Ese=Hm.create,Tse=Hh.create,J8=ss.create,kse=Nl.create,Ase=Id.create,Pse=ss.createWithPreprocess,Ise=ly.create,Rse=()=>vB().optional(),Ose=()=>bB().optional(),Mse=()=>_B().optional(),Nse={string:e=>Ya.create({...e,coerce:!0}),number:e=>oc.create({...e,coerce:!0}),boolean:e=>Fm.create({...e,coerce:!0}),bigint:e=>ac.create({...e,coerce:!0}),date:e=>Ad.create({...e,coerce:!0})},$se=vt;var z=Object.freeze({__proto__:null,defaultErrorMap:Dm,setErrorMap:Bae,getErrorMap:Hb,makeIssue:Wb,EMPTY_PATH:zae,addIssueToContext:Me,ParseStatus:Ki,INVALID:vt,DIRTY:pB,OK:ao,isAborted:tE,isDirty:nE,isValid:Lm,isAsync:Kb,get util(){return Xt},get objectUtil(){return eE},ZodParsedType:Re,getParsedType:Eu,ZodType:Et,ZodString:Ya,ZodNumber:oc,ZodBigInt:ac,ZodBoolean:Fm,ZodDate:Ad,ZodSymbol:Qb,ZodUndefined:Bm,ZodNull:zm,ZodAny:qh,ZodUnknown:pd,ZodNever:ql,ZodVoid:Xb,ZodArray:rs,ZodObject:ar,ZodUnion:jm,ZodDiscriminatedUnion:QS,ZodIntersection:Um,ZodTuple:Xs,ZodRecord:Vm,ZodMap:Yb,ZodSet:Pd,ZodFunction:fh,ZodLazy:Gm,ZodLiteral:qm,ZodEnum:sc,ZodNativeEnum:Hm,ZodPromise:Hh,ZodEffects:ss,ZodTransformer:ss,ZodOptional:Nl,ZodNullable:Id,ZodDefault:Wm,ZodCatch:Zb,ZodNaN:Jb,BRAND:Zae,ZodBranded:mB,ZodPipeline:ly,ZodReadonly:e_,custom:yB,Schema:Et,ZodSchema:Et,late:Jae,get ZodFirstPartyTypeKind(){return st},coerce:Nse,any:sse,array:dse,bigint:nse,boolean:_B,date:rse,discriminatedUnion:gse,effect:J8,enum:Cse,function:Sse,instanceof:ese,intersection:mse,lazy:xse,literal:wse,map:bse,nan:tse,nativeEnum:Ese,never:use,null:ase,nullable:Ase,number:bB,object:fse,oboolean:Mse,onumber:Ose,optional:kse,ostring:Rse,pipeline:Ise,preprocess:Pse,promise:Tse,record:vse,set:_se,strictObject:hse,string:vB,symbol:ise,transformer:J8,tuple:yse,undefined:ose,union:pse,unknown:lse,void:cse,NEVER:$se,ZodIssueCode:he,quotelessJson:Fae,ZodError:ns});const Dse=z.string(),iUe=e=>Dse.safeParse(e).success,Lse=z.string(),oUe=e=>Lse.safeParse(e).success,Fse=z.string(),aUe=e=>Fse.safeParse(e).success,Bse=z.string(),sUe=e=>Bse.safeParse(e).success,zse=z.number().int().min(1),lUe=e=>zse.safeParse(e).success,jse=z.number().min(1),uUe=e=>jse.safeParse(e).success,SB=z.enum(["euler","deis","ddim","ddpm","dpmpp_2s","dpmpp_2m","dpmpp_2m_sde","dpmpp_sde","heun","kdpm_2","lms","pndm","unipc","euler_k","dpmpp_2s_k","dpmpp_2m_k","dpmpp_2m_sde_k","dpmpp_sde_k","heun_k","lms_k","euler_a","kdpm_2_a"]),cUe=e=>SB.safeParse(e).success,dUe={euler:"Euler",deis:"DEIS",ddim:"DDIM",ddpm:"DDPM",dpmpp_sde:"DPM++ SDE",dpmpp_2s:"DPM++ 2S",dpmpp_2m:"DPM++ 2M",dpmpp_2m_sde:"DPM++ 2M SDE",heun:"Heun",kdpm_2:"KDPM 2",lms:"LMS",pndm:"PNDM",unipc:"UniPC",euler_k:"Euler Karras",dpmpp_sde_k:"DPM++ SDE Karras",dpmpp_2s_k:"DPM++ 2S Karras",dpmpp_2m_k:"DPM++ 2M Karras",dpmpp_2m_sde_k:"DPM++ 2M SDE Karras",heun_k:"Heun Karras",lms_k:"LMS Karras",euler_a:"Euler Ancestral",kdpm_2_a:"KDPM 2 Ancestral"},Use=z.number().int().min(0).max(qg),fUe=e=>Use.safeParse(e).success,Vse=z.number().multipleOf(8).min(64),hUe=e=>Vse.safeParse(e).success,Gse=z.number().multipleOf(8).min(64),pUe=e=>Gse.safeParse(e).success,xc=z.enum(["any","sd-1","sd-2","sdxl","sdxl-refiner"]),XS=z.object({model_name:z.string().min(1),base_model:xc,model_type:z.literal("main")}),gUe=e=>XS.safeParse(e).success,pk=z.object({model_name:z.string().min(1),base_model:z.literal("sdxl-refiner"),model_type:z.literal("main")}),mUe=e=>pk.safeParse(e).success,xB=z.object({model_name:z.string().min(1),base_model:xc,model_type:z.literal("onnx")}),uy=z.union([XS,xB]),qse=z.object({model_name:z.string().min(1),base_model:xc}),Hse=z.object({model_name:z.string().min(1),base_model:xc}),yUe=e=>Hse.safeParse(e).success,Wse=z.object({model_name:z.string().min(1),base_model:xc}),vUe=e=>Wse.safeParse(e).success,Kse=z.object({model_name:z.string().min(1),base_model:xc}),bUe=z.object({model_name:z.string().min(1),base_model:xc}),_Ue=e=>Kse.safeParse(e).success,Qse=z.number().min(0).max(1),SUe=e=>Qse.safeParse(e).success;z.enum(["fp16","fp32"]);const Xse=z.number().min(1).max(10),xUe=e=>Xse.safeParse(e).success,Yse=z.number().min(1).max(10),wUe=e=>Yse.safeParse(e).success,Zse=z.number().min(0).max(1),CUe=e=>Zse.safeParse(e).success;z.enum(["box","gaussian"]);z.enum(["unmasked","mask","edge"]);const gk={cfgScale:7.5,height:512,img2imgStrength:.75,infillMethod:"patchmatch",iterations:1,perlin:0,positivePrompt:"",negativePrompt:"",scheduler:"euler",maskBlur:16,maskBlurMethod:"box",canvasCoherenceMode:"unmasked",canvasCoherenceSteps:20,canvasCoherenceStrength:.3,seed:0,seedWeights:"",shouldFitToWidthHeight:!0,shouldGenerateVariations:!1,shouldRandomizeSeed:!0,steps:50,threshold:0,infillTileSize:32,infillPatchmatchDownscaleSize:1,variationAmount:.1,width:512,shouldUseSymmetry:!1,horizontalSymmetrySteps:0,verticalSymmetrySteps:0,model:null,vae:null,vaePrecision:"fp32",seamlessXAxis:!1,seamlessYAxis:!1,clipSkip:0,shouldUseCpuNoise:!0,shouldShowAdvancedOptions:!1,aspectRatio:null,shouldLockAspectRatio:!1},Jse=gk,wB=nr({name:"generation",initialState:Jse,reducers:{setPositivePrompt:(e,t)=>{e.positivePrompt=t.payload},setNegativePrompt:(e,t)=>{e.negativePrompt=t.payload},setIterations:(e,t)=>{e.iterations=t.payload},setSteps:(e,t)=>{e.steps=t.payload},clampSymmetrySteps:e=>{e.horizontalSymmetrySteps=Mu(e.horizontalSymmetrySteps,0,e.steps),e.verticalSymmetrySteps=Mu(e.verticalSymmetrySteps,0,e.steps)},setCfgScale:(e,t)=>{e.cfgScale=t.payload},setThreshold:(e,t)=>{e.threshold=t.payload},setPerlin:(e,t)=>{e.perlin=t.payload},setHeight:(e,t)=>{e.height=t.payload},setWidth:(e,t)=>{e.width=t.payload},toggleSize:e=>{const[t,n]=[e.width,e.height];e.width=n,e.height=t},setScheduler:(e,t)=>{e.scheduler=t.payload},setSeed:(e,t)=>{e.seed=t.payload,e.shouldRandomizeSeed=!1},setImg2imgStrength:(e,t)=>{e.img2imgStrength=t.payload},setSeamlessXAxis:(e,t)=>{e.seamlessXAxis=t.payload},setSeamlessYAxis:(e,t)=>{e.seamlessYAxis=t.payload},setShouldFitToWidthHeight:(e,t)=>{e.shouldFitToWidthHeight=t.payload},resetSeed:e=>{e.seed=-1},setShouldGenerateVariations:(e,t)=>{e.shouldGenerateVariations=t.payload},setVariationAmount:(e,t)=>{e.variationAmount=t.payload},setSeedWeights:(e,t)=>{e.seedWeights=t.payload,e.shouldGenerateVariations=!0,e.variationAmount=0},resetParametersState:e=>({...e,...gk}),setShouldRandomizeSeed:(e,t)=>{e.shouldRandomizeSeed=t.payload},clearInitialImage:e=>{e.initialImage=void 0},setMaskBlur:(e,t)=>{e.maskBlur=t.payload},setMaskBlurMethod:(e,t)=>{e.maskBlurMethod=t.payload},setCanvasCoherenceMode:(e,t)=>{e.canvasCoherenceMode=t.payload},setCanvasCoherenceSteps:(e,t)=>{e.canvasCoherenceSteps=t.payload},setCanvasCoherenceStrength:(e,t)=>{e.canvasCoherenceStrength=t.payload},setInfillMethod:(e,t)=>{e.infillMethod=t.payload},setInfillTileSize:(e,t)=>{e.infillTileSize=t.payload},setInfillPatchmatchDownscaleSize:(e,t)=>{e.infillPatchmatchDownscaleSize=t.payload},setShouldUseSymmetry:(e,t)=>{e.shouldUseSymmetry=t.payload},setHorizontalSymmetrySteps:(e,t)=>{e.horizontalSymmetrySteps=t.payload},setVerticalSymmetrySteps:(e,t)=>{e.verticalSymmetrySteps=t.payload},initialImageChanged:(e,t)=>{const{image_name:n,width:r,height:i}=t.payload;e.initialImage={imageName:n,width:r,height:i}},modelChanged:(e,t)=>{if(e.model=t.payload,e.model===null)return;const{maxClip:n}=Dae[e.model.base_model];e.clipSkip=Mu(e.clipSkip,0,n)},vaeSelected:(e,t)=>{e.vae=t.payload},vaePrecisionChanged:(e,t)=>{e.vaePrecision=t.payload},setClipSkip:(e,t)=>{e.clipSkip=t.payload},shouldUseCpuNoiseChanged:(e,t)=>{e.shouldUseCpuNoise=t.payload},setAspectRatio:(e,t)=>{const n=t.payload;e.aspectRatio=n,n&&(e.height=Ha(e.width/n,8))},setShouldLockAspectRatio:(e,t)=>{e.shouldLockAspectRatio=t.payload}},extraReducers:e=>{e.addCase(Nae,(t,n)=>{var i;const r=(i=n.payload.sd)==null?void 0:i.defaultModel;if(r&&!t.model){const[o,a,s]=r.split("/"),l=XS.safeParse({model_name:s,base_model:o,model_type:a});l.success&&(t.model=l.data)}})}}),{clampSymmetrySteps:EUe,clearInitialImage:mk,resetParametersState:TUe,resetSeed:kUe,setCfgScale:AUe,setWidth:eI,setHeight:tI,toggleSize:PUe,setImg2imgStrength:IUe,setInfillMethod:ele,setIterations:RUe,setPerlin:OUe,setPositivePrompt:tle,setNegativePrompt:MUe,setScheduler:NUe,setMaskBlur:$Ue,setMaskBlurMethod:DUe,setCanvasCoherenceMode:LUe,setCanvasCoherenceSteps:FUe,setCanvasCoherenceStrength:BUe,setSeed:zUe,setSeedWeights:jUe,setShouldFitToWidthHeight:UUe,setShouldGenerateVariations:VUe,setShouldRandomizeSeed:GUe,setSteps:qUe,setThreshold:HUe,setInfillTileSize:WUe,setInfillPatchmatchDownscaleSize:KUe,setVariationAmount:QUe,setShouldUseSymmetry:XUe,setHorizontalSymmetrySteps:YUe,setVerticalSymmetrySteps:ZUe,initialImageChanged:YS,modelChanged:Nu,vaeSelected:CB,setSeamlessXAxis:JUe,setSeamlessYAxis:eVe,setClipSkip:tVe,shouldUseCpuNoiseChanged:nVe,setAspectRatio:nle,setShouldLockAspectRatio:rVe,vaePrecisionChanged:iVe}=wB.actions,rle=wB.reducer,uv=(e,t,n,r,i,o,a)=>{const s=Math.floor(e/2-(n+i/2)*a),l=Math.floor(t/2-(r+o/2)*a);return{x:s,y:l}},cv=(e,t,n,r,i=.95)=>{const o=e*i/n,a=t*i/r,s=Math.min(1,Math.min(o,a));return s||1},oVe=.999,aVe=.1,sVe=20,dv=.95,lVe=30,uVe=10,ile=e=>({x:Math.floor(e.x),y:Math.floor(e.y)}),af=e=>{const{width:t,height:n}=e,r={width:t,height:n},i=512*512,o=t/n;let a=t*n,s=448;for(;a1?(r.width=s,r.height=Ha(s/o,64)):o<1&&(r.height=s,r.width=Ha(s*o,64)),a=r.width*r.height;return r},ole=e=>({width:Ha(e.width,64),height:Ha(e.height,64)}),cVe=[{label:"Base",value:"base"},{label:"Mask",value:"mask"}],dVe=[{label:"None",value:"none"},{label:"Auto",value:"auto"},{label:"Manual",value:"manual"}],EB=e=>e.kind==="line"&&e.layer==="mask",fVe=e=>e.kind==="line"&&e.layer==="base",ale=e=>e.kind==="image"&&e.layer==="base",hVe=e=>e.kind==="fillRect"&&e.layer==="base",pVe=e=>e.kind==="eraseRect"&&e.layer==="base",sle=e=>e.kind==="line",vg={objects:[],stagingArea:{images:[],selectedImageIndex:-1}},TB={boundingBoxCoordinates:{x:0,y:0},boundingBoxDimensions:{width:512,height:512},boundingBoxPreviewFill:{r:0,g:0,b:0,a:.5},boundingBoxScaleMethod:"none",brushColor:{r:90,g:90,b:255,a:1},brushSize:50,colorPickerColor:{r:90,g:90,b:255,a:1},cursorPosition:null,futureLayerStates:[],isDrawing:!1,isMaskEnabled:!0,isMouseOverBoundingBox:!1,isMoveBoundingBoxKeyHeld:!1,isMoveStageKeyHeld:!1,isMovingBoundingBox:!1,isMovingStage:!1,isTransformingBoundingBox:!1,layer:"base",layerState:vg,maskColor:{r:255,g:90,b:90,a:1},maxHistory:128,minimumStageScale:1,pastLayerStates:[],scaledBoundingBoxDimensions:{width:512,height:512},shouldAntialias:!0,shouldAutoSave:!1,shouldCropToBoundingBoxOnSave:!1,shouldDarkenOutsideBoundingBox:!1,shouldLockBoundingBox:!1,shouldPreserveMaskedArea:!1,shouldRestrictStrokesToBox:!0,shouldShowBoundingBox:!0,shouldShowBrush:!0,shouldShowBrushPreview:!1,shouldShowCanvasDebugInfo:!1,shouldShowCheckboardTransparency:!1,shouldShowGrid:!0,shouldShowIntermediates:!0,shouldShowStagingImage:!0,shouldShowStagingOutline:!0,shouldSnapToGrid:!0,stageCoordinates:{x:0,y:0},stageDimensions:{width:0,height:0},stageScale:1,tool:"brush",batchIds:[]},kB=nr({name:"canvas",initialState:TB,reducers:{setTool:(e,t)=>{const n=t.payload;e.tool=t.payload,n!=="move"&&(e.isTransformingBoundingBox=!1,e.isMouseOverBoundingBox=!1,e.isMovingBoundingBox=!1,e.isMovingStage=!1)},setLayer:(e,t)=>{e.layer=t.payload},toggleTool:e=>{const t=e.tool;t!=="move"&&(e.tool=t==="brush"?"eraser":"brush")},setMaskColor:(e,t)=>{e.maskColor=t.payload},setBrushColor:(e,t)=>{e.brushColor=t.payload},setBrushSize:(e,t)=>{e.brushSize=t.payload},clearMask:e=>{e.pastLayerStates.push(wn(e.layerState)),e.layerState.objects=e.layerState.objects.filter(t=>!EB(t)),e.futureLayerStates=[],e.shouldPreserveMaskedArea=!1},toggleShouldInvertMask:e=>{e.shouldPreserveMaskedArea=!e.shouldPreserveMaskedArea},toggleShouldShowMask:e=>{e.isMaskEnabled=!e.isMaskEnabled},setShouldPreserveMaskedArea:(e,t)=>{e.shouldPreserveMaskedArea=t.payload},setIsMaskEnabled:(e,t)=>{e.isMaskEnabled=t.payload,e.layer=t.payload?"mask":"base"},setShouldShowCheckboardTransparency:(e,t)=>{e.shouldShowCheckboardTransparency=t.payload},setShouldShowBrushPreview:(e,t)=>{e.shouldShowBrushPreview=t.payload},setShouldShowBrush:(e,t)=>{e.shouldShowBrush=t.payload},setCursorPosition:(e,t)=>{e.cursorPosition=t.payload},setInitialCanvasImage:(e,t)=>{const n=t.payload,{width:r,height:i}=n,{stageDimensions:o}=e,a={width:sv(Mu(r,64,512),64),height:sv(Mu(i,64,512),64)},s={x:Ha(r/2-a.width/2,64),y:Ha(i/2-a.height/2,64)};if(e.boundingBoxScaleMethod==="auto"){const c=af(a);e.scaledBoundingBoxDimensions=c}e.boundingBoxDimensions=a,e.boundingBoxCoordinates=s,e.pastLayerStates.push(wn(e.layerState)),e.layerState={...wn(vg),objects:[{kind:"image",layer:"base",x:0,y:0,width:r,height:i,imageName:n.image_name}]},e.futureLayerStates=[],e.batchIds=[];const l=cv(o.width,o.height,r,i,dv),u=uv(o.width,o.height,0,0,r,i,l);e.stageScale=l,e.stageCoordinates=u},setBoundingBoxDimensions:(e,t)=>{const n=ole(t.payload);if(e.boundingBoxDimensions=n,e.boundingBoxScaleMethod==="auto"){const r=af(n);e.scaledBoundingBoxDimensions=r}},flipBoundingBoxAxes:e=>{const[t,n]=[e.boundingBoxDimensions.width,e.boundingBoxDimensions.height],[r,i]=[e.scaledBoundingBoxDimensions.width,e.scaledBoundingBoxDimensions.height];e.boundingBoxDimensions={width:n,height:t},e.scaledBoundingBoxDimensions={width:i,height:r}},setBoundingBoxCoordinates:(e,t)=>{e.boundingBoxCoordinates=ile(t.payload)},setStageCoordinates:(e,t)=>{e.stageCoordinates=t.payload},setBoundingBoxPreviewFill:(e,t)=>{e.boundingBoxPreviewFill=t.payload},setStageScale:(e,t)=>{e.stageScale=t.payload},setShouldDarkenOutsideBoundingBox:(e,t)=>{e.shouldDarkenOutsideBoundingBox=t.payload},setIsDrawing:(e,t)=>{e.isDrawing=t.payload},clearCanvasHistory:e=>{e.pastLayerStates=[],e.futureLayerStates=[]},setShouldLockBoundingBox:(e,t)=>{e.shouldLockBoundingBox=t.payload},toggleShouldLockBoundingBox:e=>{e.shouldLockBoundingBox=!e.shouldLockBoundingBox},setShouldShowBoundingBox:(e,t)=>{e.shouldShowBoundingBox=t.payload},setIsTransformingBoundingBox:(e,t)=>{e.isTransformingBoundingBox=t.payload},setIsMovingBoundingBox:(e,t)=>{e.isMovingBoundingBox=t.payload},setIsMouseOverBoundingBox:(e,t)=>{e.isMouseOverBoundingBox=t.payload},setIsMoveBoundingBoxKeyHeld:(e,t)=>{e.isMoveBoundingBoxKeyHeld=t.payload},setIsMoveStageKeyHeld:(e,t)=>{e.isMoveStageKeyHeld=t.payload},canvasBatchIdAdded:(e,t)=>{e.batchIds.push(t.payload)},canvasBatchIdsReset:e=>{e.batchIds=[]},stagingAreaInitialized:(e,t)=>{const{boundingBox:n}=t.payload;e.layerState.stagingArea={boundingBox:n,images:[],selectedImageIndex:-1}},addImageToStagingArea:(e,t)=>{const n=t.payload;!n||!e.layerState.stagingArea.boundingBox||(e.pastLayerStates.push(wn(e.layerState)),e.pastLayerStates.length>e.maxHistory&&e.pastLayerStates.shift(),e.layerState.stagingArea.images.push({kind:"image",layer:"base",...e.layerState.stagingArea.boundingBox,imageName:n.image_name}),e.layerState.stagingArea.selectedImageIndex=e.layerState.stagingArea.images.length-1,e.futureLayerStates=[])},discardStagedImages:e=>{e.pastLayerStates.push(wn(e.layerState)),e.pastLayerStates.length>e.maxHistory&&e.pastLayerStates.shift(),e.layerState.stagingArea=wn(wn(vg)).stagingArea,e.futureLayerStates=[],e.shouldShowStagingOutline=!0,e.shouldShowStagingImage=!0,e.batchIds=[]},addFillRect:e=>{const{boundingBoxCoordinates:t,boundingBoxDimensions:n,brushColor:r}=e;e.pastLayerStates.push(wn(e.layerState)),e.pastLayerStates.length>e.maxHistory&&e.pastLayerStates.shift(),e.layerState.objects.push({kind:"fillRect",layer:"base",...t,...n,color:r}),e.futureLayerStates=[]},addEraseRect:e=>{const{boundingBoxCoordinates:t,boundingBoxDimensions:n}=e;e.pastLayerStates.push(wn(e.layerState)),e.pastLayerStates.length>e.maxHistory&&e.pastLayerStates.shift(),e.layerState.objects.push({kind:"eraseRect",layer:"base",...t,...n}),e.futureLayerStates=[]},addLine:(e,t)=>{const{tool:n,layer:r,brushColor:i,brushSize:o,shouldRestrictStrokesToBox:a}=e;if(n==="move"||n==="colorPicker")return;const s=o/2,l=r==="base"&&n==="brush"?{color:i}:{};e.pastLayerStates.push(wn(e.layerState)),e.pastLayerStates.length>e.maxHistory&&e.pastLayerStates.shift();const u={kind:"line",layer:r,tool:n,strokeWidth:s,points:t.payload,...l};a&&(u.clip={...e.boundingBoxCoordinates,...e.boundingBoxDimensions}),e.layerState.objects.push(u),e.futureLayerStates=[]},addPointToCurrentLine:(e,t)=>{const n=e.layerState.objects.findLast(sle);n&&n.points.push(...t.payload)},undo:e=>{const t=e.pastLayerStates.pop();t&&(e.futureLayerStates.unshift(wn(e.layerState)),e.futureLayerStates.length>e.maxHistory&&e.futureLayerStates.pop(),e.layerState=t)},redo:e=>{const t=e.futureLayerStates.shift();t&&(e.pastLayerStates.push(wn(e.layerState)),e.pastLayerStates.length>e.maxHistory&&e.pastLayerStates.shift(),e.layerState=t)},setShouldShowGrid:(e,t)=>{e.shouldShowGrid=t.payload},setIsMovingStage:(e,t)=>{e.isMovingStage=t.payload},setShouldSnapToGrid:(e,t)=>{e.shouldSnapToGrid=t.payload},setShouldAutoSave:(e,t)=>{e.shouldAutoSave=t.payload},setShouldShowIntermediates:(e,t)=>{e.shouldShowIntermediates=t.payload},resetCanvas:e=>{e.pastLayerStates.push(wn(e.layerState)),e.layerState=wn(vg),e.futureLayerStates=[],e.batchIds=[]},canvasResized:(e,t)=>{const{width:n,height:r}=t.payload,i={width:Math.floor(n),height:Math.floor(r)};if(e.stageDimensions=i,!e.layerState.objects.find(ale)){const o=cv(i.width,i.height,512,512,dv),a=uv(i.width,i.height,0,0,512,512,o),s={width:512,height:512};if(e.stageScale=o,e.stageCoordinates=a,e.boundingBoxCoordinates={x:0,y:0},e.boundingBoxDimensions=s,e.boundingBoxScaleMethod==="auto"){const l=af(s);e.scaledBoundingBoxDimensions=l}}},resetCanvasView:(e,t)=>{const{contentRect:n,shouldScaleTo1:r}=t.payload,{stageDimensions:{width:i,height:o}}=e,{x:a,y:s,width:l,height:u}=n;if(l!==0&&u!==0){const c=r?1:cv(i,o,l,u,dv),d=uv(i,o,a,s,l,u,c);e.stageScale=c,e.stageCoordinates=d}else{const c=cv(i,o,512,512,dv),d=uv(i,o,0,0,512,512,c),f={width:512,height:512};if(e.stageScale=c,e.stageCoordinates=d,e.boundingBoxCoordinates={x:0,y:0},e.boundingBoxDimensions=f,e.boundingBoxScaleMethod==="auto"){const h=af(f);e.scaledBoundingBoxDimensions=h}}},nextStagingAreaImage:e=>{if(!e.layerState.stagingArea.images.length)return;const t=e.layerState.stagingArea.selectedImageIndex+1,n=e.layerState.stagingArea.images.length-1;e.layerState.stagingArea.selectedImageIndex=t>n?0:t},prevStagingAreaImage:e=>{if(!e.layerState.stagingArea.images.length)return;const t=e.layerState.stagingArea.selectedImageIndex-1,n=e.layerState.stagingArea.images.length-1;e.layerState.stagingArea.selectedImageIndex=t<0?n:t},commitStagingAreaImage:e=>{if(!e.layerState.stagingArea.images.length)return;const{images:t,selectedImageIndex:n}=e.layerState.stagingArea;e.pastLayerStates.push(wn(e.layerState)),e.pastLayerStates.length>e.maxHistory&&e.pastLayerStates.shift();const r=t[n];r&&e.layerState.objects.push({...r}),e.layerState.stagingArea=wn(vg).stagingArea,e.futureLayerStates=[],e.shouldShowStagingOutline=!0,e.shouldShowStagingImage=!0,e.batchIds=[]},fitBoundingBoxToStage:e=>{const{boundingBoxDimensions:t,boundingBoxCoordinates:n,stageDimensions:r,stageScale:i}=e,o=r.width/i,a=r.height/i;if(n.x<0||n.x+t.width>o||n.y<0||n.y+t.height>a){const s={width:sv(Mu(o,64,512),64),height:sv(Mu(a,64,512),64)},l={x:Ha(o/2-s.width/2,64),y:Ha(a/2-s.height/2,64)};if(e.boundingBoxDimensions=s,e.boundingBoxCoordinates=l,e.boundingBoxScaleMethod==="auto"){const u=af(s);e.scaledBoundingBoxDimensions=u}}},setBoundingBoxScaleMethod:(e,t)=>{if(e.boundingBoxScaleMethod=t.payload,t.payload==="auto"){const n=af(e.boundingBoxDimensions);e.scaledBoundingBoxDimensions=n}},setScaledBoundingBoxDimensions:(e,t)=>{e.scaledBoundingBoxDimensions=t.payload},setShouldShowStagingImage:(e,t)=>{e.shouldShowStagingImage=t.payload},setShouldShowStagingOutline:(e,t)=>{e.shouldShowStagingOutline=t.payload},setShouldShowCanvasDebugInfo:(e,t)=>{e.shouldShowCanvasDebugInfo=t.payload},setShouldRestrictStrokesToBox:(e,t)=>{e.shouldRestrictStrokesToBox=t.payload},setShouldAntialias:(e,t)=>{e.shouldAntialias=t.payload},setShouldCropToBoundingBoxOnSave:(e,t)=>{e.shouldCropToBoundingBoxOnSave=t.payload},setColorPickerColor:(e,t)=>{e.colorPickerColor=t.payload},commitColorPickerColor:e=>{e.brushColor={...e.colorPickerColor,a:e.brushColor.a},e.tool="brush"},setMergedCanvas:(e,t)=>{e.pastLayerStates.push(wn(e.layerState)),e.futureLayerStates=[],e.layerState.objects=[t.payload]},resetCanvasInteractionState:e=>{e.cursorPosition=null,e.isDrawing=!1,e.isMouseOverBoundingBox=!1,e.isMoveBoundingBoxKeyHeld=!1,e.isMoveStageKeyHeld=!1,e.isMovingBoundingBox=!1,e.isMovingStage=!1,e.isTransformingBoundingBox=!1},mouseLeftCanvas:e=>{e.cursorPosition=null,e.isDrawing=!1,e.isMouseOverBoundingBox=!1,e.isMovingBoundingBox=!1,e.isTransformingBoundingBox=!1}},extraReducers:e=>{e.addCase(nle,(t,n)=>{const r=n.payload;r&&(t.boundingBoxDimensions.height=Ha(t.boundingBoxDimensions.width/r,64),t.scaledBoundingBoxDimensions.height=Ha(t.scaledBoundingBoxDimensions.width/r,64))})}}),{addEraseRect:gVe,addFillRect:mVe,addImageToStagingArea:lle,addLine:yVe,addPointToCurrentLine:vVe,clearCanvasHistory:bVe,clearMask:_Ve,commitColorPickerColor:SVe,commitStagingAreaImage:ule,discardStagedImages:cle,fitBoundingBoxToStage:xVe,mouseLeftCanvas:wVe,nextStagingAreaImage:CVe,prevStagingAreaImage:EVe,redo:TVe,resetCanvas:yk,resetCanvasInteractionState:kVe,resetCanvasView:AVe,setBoundingBoxCoordinates:PVe,setBoundingBoxDimensions:nI,setBoundingBoxPreviewFill:IVe,setBoundingBoxScaleMethod:RVe,flipBoundingBoxAxes:OVe,setBrushColor:MVe,setBrushSize:NVe,setColorPickerColor:$Ve,setCursorPosition:DVe,setInitialCanvasImage:AB,setIsDrawing:LVe,setIsMaskEnabled:FVe,setIsMouseOverBoundingBox:BVe,setIsMoveBoundingBoxKeyHeld:zVe,setIsMoveStageKeyHeld:jVe,setIsMovingBoundingBox:UVe,setIsMovingStage:VVe,setIsTransformingBoundingBox:GVe,setLayer:qVe,setMaskColor:HVe,setMergedCanvas:dle,setShouldAutoSave:WVe,setShouldCropToBoundingBoxOnSave:KVe,setShouldDarkenOutsideBoundingBox:QVe,setShouldLockBoundingBox:XVe,setShouldPreserveMaskedArea:YVe,setShouldShowBoundingBox:ZVe,setShouldShowBrush:JVe,setShouldShowBrushPreview:eGe,setShouldShowCanvasDebugInfo:tGe,setShouldShowCheckboardTransparency:nGe,setShouldShowGrid:rGe,setShouldShowIntermediates:iGe,setShouldShowStagingImage:oGe,setShouldShowStagingOutline:aGe,setShouldSnapToGrid:sGe,setStageCoordinates:lGe,setStageScale:uGe,setTool:cGe,toggleShouldLockBoundingBox:dGe,toggleTool:fGe,undo:hGe,setScaledBoundingBoxDimensions:pGe,setShouldRestrictStrokesToBox:gGe,stagingAreaInitialized:fle,setShouldAntialias:mGe,canvasResized:yGe,canvasBatchIdAdded:hle,canvasBatchIdsReset:ple}=kB.actions,gle=kB.reducer,mle={isModalOpen:!1,imagesToChange:[]},PB=nr({name:"changeBoardModal",initialState:mle,reducers:{isModalOpenChanged:(e,t)=>{e.isModalOpen=t.payload},imagesToChangeSelected:(e,t)=>{e.imagesToChange=t.payload},changeBoardReset:e=>{e.imagesToChange=[],e.isModalOpen=!1}}}),{isModalOpenChanged:vGe,imagesToChangeSelected:bGe,changeBoardReset:_Ge}=PB.actions,yle=PB.reducer;var IB={exports:{}},RB={};const Lo=fS(PZ),Gp=fS(OY),vle=fS(GY);(function(e){var t,n,r=yt&&yt.__generator||function(H,te){var re,de,oe,je,Ge={label:0,sent:function(){if(1&oe[0])throw oe[1];return oe[1]},trys:[],ops:[]};return je={next:ut(0),throw:ut(1),return:ut(2)},typeof Symbol=="function"&&(je[Symbol.iterator]=function(){return this}),je;function ut($e){return function(qe){return function(Ie){if(re)throw new TypeError("Generator is already executing.");for(;Ge;)try{if(re=1,de&&(oe=2&Ie[0]?de.return:Ie[0]?de.throw||((oe=de.return)&&oe.call(de),0):de.next)&&!(oe=oe.call(de,Ie[1])).done)return oe;switch(de=0,oe&&(Ie=[2&Ie[0],oe.value]),Ie[0]){case 0:case 1:oe=Ie;break;case 4:return Ge.label++,{value:Ie[1],done:!1};case 5:Ge.label++,de=Ie[1],Ie=[0];continue;case 7:Ie=Ge.ops.pop(),Ge.trys.pop();continue;default:if(!((oe=(oe=Ge.trys).length>0&&oe[oe.length-1])||Ie[0]!==6&&Ie[0]!==2)){Ge=0;continue}if(Ie[0]===3&&(!oe||Ie[1]>oe[0]&&Ie[1]=200&&H.status<=299},$=function(H){return/ion\/(vnd\.api\+)?json/.test(H.get("content-type")||"")};function O(H){if(!(0,k.isPlainObject)(H))return H;for(var te=_({},H),re=0,de=Object.entries(te);re"u"&&Ge===T&&console.warn("Warning: `fetch` is not available. Please supply a custom `fetchFn` property to use `fetchBaseQuery` on SSR environments."),function(wt,Tt){return S(te,null,function(){var cn,dn,$i,Do,Di,_r,yi,Qn,go,La,it,fn,nn,ir,Sr,vi,_n,Nt,Ht,Sn,rn,gn,xe,Je,Ue,ke,He,ft,Ve,we,ue,Ee,fe,ge,Ce,et;return r(this,function(Qe){switch(Qe.label){case 0:return cn=Tt.signal,dn=Tt.getState,$i=Tt.extra,Do=Tt.endpoint,Di=Tt.forced,_r=Tt.type,go=(Qn=typeof wt=="string"?{url:wt}:wt).url,it=(La=Qn.headers)===void 0?new Headers(dt.headers):La,nn=(fn=Qn.params)===void 0?void 0:fn,Sr=(ir=Qn.responseHandler)===void 0?Ze??"json":ir,_n=(vi=Qn.validateStatus)===void 0?ct??P:vi,Ht=(Nt=Qn.timeout)===void 0?Ye:Nt,Sn=g(Qn,["url","headers","params","responseHandler","validateStatus","timeout"]),rn=_(b(_({},dt),{signal:cn}),Sn),it=new Headers(O(it)),gn=rn,[4,oe(it,{getState:dn,extra:$i,endpoint:Do,forced:Di,type:_r})];case 1:gn.headers=Qe.sent()||it,xe=function(Ae){return typeof Ae=="object"&&((0,k.isPlainObject)(Ae)||Array.isArray(Ae)||typeof Ae.toJSON=="function")},!rn.headers.has("content-type")&&xe(rn.body)&&rn.headers.set("content-type",ie),xe(rn.body)&&qe(rn.headers)&&(rn.body=JSON.stringify(rn.body,Se)),nn&&(Je=~go.indexOf("?")?"&":"?",Ue=ut?ut(nn):new URLSearchParams(O(nn)),go+=Je+Ue),go=function(Ae,kt){if(!Ae)return kt;if(!kt)return Ae;if(function(Vt){return new RegExp("(^|:)//").test(Vt)}(kt))return kt;var jt=Ae.endsWith("/")||!kt.startsWith("?")?"/":"";return Ae=function(Vt){return Vt.replace(/\/$/,"")}(Ae),""+Ae+jt+function(Vt){return Vt.replace(/^\//,"")}(kt)}(re,go),ke=new Request(go,rn),He=ke.clone(),yi={request:He},Ve=!1,we=Ht&&setTimeout(function(){Ve=!0,Tt.abort()},Ht),Qe.label=2;case 2:return Qe.trys.push([2,4,5,6]),[4,Ge(ke)];case 3:return ft=Qe.sent(),[3,6];case 4:return ue=Qe.sent(),[2,{error:{status:Ve?"TIMEOUT_ERROR":"FETCH_ERROR",error:String(ue)},meta:yi}];case 5:return we&&clearTimeout(we),[7];case 6:Ee=ft.clone(),yi.response=Ee,ge="",Qe.label=7;case 7:return Qe.trys.push([7,9,,10]),[4,Promise.all([_t(ft,Sr).then(function(Ae){return fe=Ae},function(Ae){return Ce=Ae}),Ee.text().then(function(Ae){return ge=Ae},function(){})])];case 8:if(Qe.sent(),Ce)throw Ce;return[3,10];case 9:return et=Qe.sent(),[2,{error:{status:"PARSING_ERROR",originalStatus:ft.status,data:ge,error:String(et)},meta:yi}];case 10:return[2,_n(ft,fe)?{data:fe,meta:yi}:{error:{status:ft.status,data:fe},meta:yi}]}})})};function _t(wt,Tt){return S(this,null,function(){var cn;return r(this,function(dn){switch(dn.label){case 0:return typeof Tt=="function"?[2,Tt(wt)]:(Tt==="content-type"&&(Tt=qe(wt.headers)?"json":"text"),Tt!=="json"?[3,2]:[4,wt.text()]);case 1:return[2,(cn=dn.sent()).length?JSON.parse(cn):null];case 2:return[2,wt.text()]}})})}}var A=function(H,te){te===void 0&&(te=void 0),this.value=H,this.meta=te};function D(H,te){return H===void 0&&(H=0),te===void 0&&(te=5),S(this,null,function(){var re,de;return r(this,function(oe){switch(oe.label){case 0:return re=Math.min(H,te),de=~~((Math.random()+.4)*(300<=Ee)}var Sn=(0,Jt.createAsyncThunk)(nn+"/executeQuery",Nt,{getPendingMeta:function(){var xe;return(xe={startedTimeStamp:Date.now()})[Jt.SHOULD_AUTOBATCH]=!0,xe},condition:function(xe,Je){var Ue,ke,He,ft=(0,Je.getState)(),Ve=(ke=(Ue=ft[nn])==null?void 0:Ue.queries)==null?void 0:ke[xe.queryCacheKey],we=Ve==null?void 0:Ve.fulfilledTimeStamp,ue=xe.originalArgs,Ee=Ve==null?void 0:Ve.originalArgs,fe=Sr[xe.endpointName];return!(!ze(xe)&&((Ve==null?void 0:Ve.status)==="pending"||!Ht(xe,ft)&&(!ne(fe)||!((He=fe==null?void 0:fe.forceRefetch)!=null&&He.call(fe,{currentArg:ue,previousArg:Ee,endpointState:Ve,state:ft})))&&we))},dispatchConditionRejection:!0}),rn=(0,Jt.createAsyncThunk)(nn+"/executeMutation",Nt,{getPendingMeta:function(){var xe;return(xe={startedTimeStamp:Date.now()})[Jt.SHOULD_AUTOBATCH]=!0,xe}});function gn(xe){return function(Je){var Ue,ke;return((ke=(Ue=Je==null?void 0:Je.meta)==null?void 0:Ue.arg)==null?void 0:ke.endpointName)===xe}}return{queryThunk:Sn,mutationThunk:rn,prefetch:function(xe,Je,Ue){return function(ke,He){var ft=function(fe){return"force"in fe}(Ue)&&Ue.force,Ve=function(fe){return"ifOlderThan"in fe}(Ue)&&Ue.ifOlderThan,we=function(fe){return fe===void 0&&(fe=!0),_n.endpoints[xe].initiate(Je,{forceRefetch:fe})},ue=_n.endpoints[xe].select(Je)(He());if(ft)ke(we());else if(Ve){var Ee=ue==null?void 0:ue.fulfilledTimeStamp;if(!Ee)return void ke(we());(Number(new Date)-Number(new Date(Ee)))/1e3>=Ve&&ke(we())}else ke(we(!1))}},updateQueryData:function(xe,Je,Ue){return function(ke,He){var ft,Ve,we=_n.endpoints[xe].select(Je)(He()),ue={patches:[],inversePatches:[],undo:function(){return ke(_n.util.patchQueryData(xe,Je,ue.inversePatches))}};if(we.status===t.uninitialized)return ue;if("data"in we)if((0,Pe.isDraftable)(we.data)){var Ee=(0,Pe.produceWithPatches)(we.data,Ue),fe=Ee[2];(ft=ue.patches).push.apply(ft,Ee[1]),(Ve=ue.inversePatches).push.apply(Ve,fe)}else{var ge=Ue(we.data);ue.patches.push({op:"replace",path:[],value:ge}),ue.inversePatches.push({op:"replace",path:[],value:we.data})}return ke(_n.util.patchQueryData(xe,Je,ue.patches)),ue}},upsertQueryData:function(xe,Je,Ue){return function(ke){var He;return ke(_n.endpoints[xe].initiate(Je,((He={subscribe:!1,forceRefetch:!0})[ot]=function(){return{data:Ue}},He)))}},patchQueryData:function(xe,Je,Ue){return function(ke){ke(_n.internalActions.queryResultPatched({queryCacheKey:vi({queryArgs:Je,endpointDefinition:Sr[xe],endpointName:xe}),patches:Ue}))}},buildMatchThunkActions:function(xe,Je){return{matchPending:(0,mt.isAllOf)((0,mt.isPending)(xe),gn(Je)),matchFulfilled:(0,mt.isAllOf)((0,mt.isFulfilled)(xe),gn(Je)),matchRejected:(0,mt.isAllOf)((0,mt.isRejected)(xe),gn(Je))}}}}({baseQuery:de,reducerPath:oe,context:re,api:H,serializeQueryArgs:je}),Se=ie.queryThunk,Ye=ie.mutationThunk,Ze=ie.patchQueryData,ct=ie.updateQueryData,dt=ie.upsertQueryData,_t=ie.prefetch,wt=ie.buildMatchThunkActions,Tt=function(it){var fn=it.reducerPath,nn=it.queryThunk,ir=it.mutationThunk,Sr=it.context,vi=Sr.endpointDefinitions,_n=Sr.apiUid,Nt=Sr.extractRehydrationInfo,Ht=Sr.hasRehydrationInfo,Sn=it.assertTagType,rn=it.config,gn=(0,ce.createAction)(fn+"/resetApiState"),xe=(0,ce.createSlice)({name:fn+"/queries",initialState:Jr,reducers:{removeQueryResult:{reducer:function(we,ue){delete we[ue.payload.queryCacheKey]},prepare:(0,ce.prepareAutoBatched)()},queryResultPatched:function(we,ue){var Ee=ue.payload,fe=Ee.patches;Ln(we,Ee.queryCacheKey,function(ge){ge.data=(0,en.applyPatches)(ge.data,fe.concat())})}},extraReducers:function(we){we.addCase(nn.pending,function(ue,Ee){var fe,ge=Ee.meta,Ce=Ee.meta.arg,et=ze(Ce);(Ce.subscribe||et)&&(ue[fe=Ce.queryCacheKey]!=null||(ue[fe]={status:t.uninitialized,endpointName:Ce.endpointName})),Ln(ue,Ce.queryCacheKey,function(Qe){Qe.status=t.pending,Qe.requestId=et&&Qe.requestId?Qe.requestId:ge.requestId,Ce.originalArgs!==void 0&&(Qe.originalArgs=Ce.originalArgs),Qe.startedTimeStamp=ge.startedTimeStamp})}).addCase(nn.fulfilled,function(ue,Ee){var fe=Ee.meta,ge=Ee.payload;Ln(ue,fe.arg.queryCacheKey,function(Ce){var et;if(Ce.requestId===fe.requestId||ze(fe.arg)){var Qe=vi[fe.arg.endpointName].merge;if(Ce.status=t.fulfilled,Qe)if(Ce.data!==void 0){var Ae=fe.fulfilledTimeStamp,kt=fe.arg,jt=fe.baseQueryMeta,Vt=fe.requestId,or=(0,ce.createNextState)(Ce.data,function(pr){return Qe(pr,ge,{arg:kt.originalArgs,baseQueryMeta:jt,fulfilledTimeStamp:Ae,requestId:Vt})});Ce.data=or}else Ce.data=ge;else Ce.data=(et=vi[fe.arg.endpointName].structuralSharing)==null||et?C((0,kn.isDraft)(Ce.data)?(0,en.original)(Ce.data):Ce.data,ge):ge;delete Ce.error,Ce.fulfilledTimeStamp=fe.fulfilledTimeStamp}})}).addCase(nn.rejected,function(ue,Ee){var fe=Ee.meta,ge=fe.condition,Ce=fe.requestId,et=Ee.error,Qe=Ee.payload;Ln(ue,fe.arg.queryCacheKey,function(Ae){if(!ge){if(Ae.requestId!==Ce)return;Ae.status=t.rejected,Ae.error=Qe??et}})}).addMatcher(Ht,function(ue,Ee){for(var fe=Nt(Ee).queries,ge=0,Ce=Object.entries(fe);ge"u"||navigator.onLine===void 0||navigator.onLine,focused:typeof document>"u"||document.visibilityState!=="hidden",middlewareRegistered:!1},rn),reducers:{middlewareRegistered:function(we,ue){we.middlewareRegistered=we.middlewareRegistered!=="conflict"&&_n===ue.payload||"conflict"}},extraReducers:function(we){we.addCase(U,function(ue){ue.online=!0}).addCase(G,function(ue){ue.online=!1}).addCase(N,function(ue){ue.focused=!0}).addCase(B,function(ue){ue.focused=!1}).addMatcher(Ht,function(ue){return _({},ue)})}}),Ve=(0,ce.combineReducers)({queries:xe.reducer,mutations:Je.reducer,provided:Ue.reducer,subscriptions:He.reducer,config:ft.reducer});return{reducer:function(we,ue){return Ve(gn.match(ue)?void 0:we,ue)},actions:b(_(_(_(_(_({},ft.actions),xe.actions),ke.actions),He.actions),Je.actions),{unsubscribeMutationResult:Je.actions.removeMutationResult,resetApiState:gn})}}({context:re,queryThunk:Se,mutationThunk:Ye,reducerPath:oe,assertTagType:Ie,config:{refetchOnFocus:$e,refetchOnReconnect:qe,refetchOnMountOrArgChange:ut,keepUnusedDataFor:Ge,reducerPath:oe}}),cn=Tt.reducer,dn=Tt.actions;mi(H.util,{patchQueryData:Ze,updateQueryData:ct,upsertQueryData:dt,prefetch:_t,resetApiState:dn.resetApiState}),mi(H.internalActions,dn);var $i=function(it){var fn=it.reducerPath,nn=it.queryThunk,ir=it.api,Sr=it.context,vi=Sr.apiUid,_n={invalidateTags:(0,al.createAction)(fn+"/invalidateTags")},Nt=[zr,Bn,Br,Rr,Ni,gi];return{middleware:function(Sn){var rn=!1,gn=b(_({},it),{internalState:{currentSubscriptions:{}},refetchQuery:Ht}),xe=Nt.map(function(ke){return ke(gn)}),Je=function(ke){var He=ke.api,ft=ke.queryThunk,Ve=ke.internalState,we=He.reducerPath+"/subscriptions",ue=null,Ee=!1,fe=He.internalActions,ge=fe.updateSubscriptionOptions,Ce=fe.unsubscribeQueryResult;return function(et,Qe){var Ae,kt;if(ue||(ue=JSON.parse(JSON.stringify(Ve.currentSubscriptions))),He.util.resetApiState.match(et))return ue=Ve.currentSubscriptions={},[!0,!1];if(He.internalActions.internal_probeSubscription.match(et)){var jt=et.payload;return[!1,!!((Ae=Ve.currentSubscriptions[jt.queryCacheKey])!=null&&Ae[jt.requestId])]}var Vt=function(zn,An){var Xi,F,V,X,pe,Ct,hn,Pn,It;if(ge.match(An)){var xn=An.payload,bi=xn.queryCacheKey,Xn=xn.requestId;return(Xi=zn==null?void 0:zn[bi])!=null&&Xi[Xn]&&(zn[bi][Xn]=xn.options),!0}if(Ce.match(An)){var ou=An.payload;return Xn=ou.requestId,zn[bi=ou.queryCacheKey]&&delete zn[bi][Xn],!0}if(He.internalActions.removeQueryResult.match(An))return delete zn[An.payload.queryCacheKey],!0;if(ft.pending.match(An)){var tf=An.meta;if(Xn=tf.requestId,(rf=tf.arg).subscribe)return(au=(V=zn[F=rf.queryCacheKey])!=null?V:zn[F]={})[Xn]=(pe=(X=rf.subscriptionOptions)!=null?X:au[Xn])!=null?pe:{},!0}if(ft.rejected.match(An)){var au,nf=An.meta,rf=nf.arg;if(Xn=nf.requestId,nf.condition&&rf.subscribe)return(au=(hn=zn[Ct=rf.queryCacheKey])!=null?hn:zn[Ct]={})[Xn]=(It=(Pn=rf.subscriptionOptions)!=null?Pn:au[Xn])!=null?It:{},!0}return!1}(Ve.currentSubscriptions,et);if(Vt){Ee||(ps(function(){var zn=JSON.parse(JSON.stringify(Ve.currentSubscriptions)),An=(0,Da.produceWithPatches)(ue,function(){return zn});Qe.next(He.internalActions.subscriptionsUpdated(An[1])),ue=zn,Ee=!1}),Ee=!0);var or=!!((kt=et.type)!=null&&kt.startsWith(we)),pr=ft.rejected.match(et)&&et.meta.condition&&!!et.meta.arg.subscribe;return[!or&&!pr,!1]}return[!0,!1]}}(gn),Ue=function(ke){var He=ke.reducerPath,ft=ke.context,Ve=ke.refetchQuery,we=ke.internalState,ue=ke.api.internalActions.removeQueryResult;function Ee(fe,ge){var Ce=fe.getState()[He],et=Ce.queries,Qe=we.currentSubscriptions;ft.batch(function(){for(var Ae=0,kt=Object.keys(Qe);Ae{let n=[],r={get(){return r.lc||r.listen(()=>{})(),r.value},l:t||0,lc:0,listen(i,o){return r.lc=n.push(i,o||r.l)/2,()=>{let a=n.indexOf(i);~a&&(n.splice(a,2),r.lc--,r.lc||r.off())}},notify(i){let o=!Yi.length;for(let a=0;a(e.events=e.events||{},e.events[n+pv]||(e.events[n+pv]=r(i=>{e.events[n].reduceRight((o,a)=>(a(o),o),{shared:{},...i})})),e.events[n]=e.events[n]||[],e.events[n].push(t),()=>{let i=e.events[n],o=i.indexOf(t);i.splice(o,1),i.length||(delete e.events[n],e.events[n+pv](),delete e.events[n+pv])}),wle=1e3,Cle=(e,t)=>xle(e,r=>{let i=t(r);i&&e.events[hv].push(i)},Sle,r=>{let i=e.listen;e.listen=(...a)=>(!e.lc&&!e.active&&(e.active=!0,r()),i(...a));let o=e.off;return e.events[hv]=[],e.off=()=>{o(),setTimeout(()=>{if(e.active&&!e.lc){e.active=!1;for(let a of e.events[hv])a();e.events[hv]=[]}},wle)},()=>{e.listen=i,e.off=o}}),Ele=(e,t)=>{Array.isArray(e)||(e=[e]);let n,r=()=>{let o=e.map(a=>a.get());(n===void 0||o.some((a,s)=>a!==n[s]))&&(n=o,i.set(t(...o)))},i=tl(void 0,Math.max(...e.map(o=>o.l))+1);return Cle(i,()=>{let o=e.map(a=>a.listen(r,i.l));return r(),()=>{for(let a of o)a()}}),i};const OB=tl(),Tle={type:"logger",log(e){this.output("log",e)},warn(e){this.output("warn",e)},error(e){this.output("error",e)},output(e,t){console&&console[e]&&console[e].apply(console,t)}};class t_{constructor(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.init(t,n)}init(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.prefix=n.prefix||"i18next:",this.logger=t||Tle,this.options=n,this.debug=n.debug}log(){for(var t=arguments.length,n=new Array(t),r=0;r{this.observers[r]=this.observers[r]||[],this.observers[r].push(n)}),this}off(t,n){if(this.observers[t]){if(!n){delete this.observers[t];return}this.observers[t]=this.observers[t].filter(r=>r!==n)}}emit(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i{a(...r)}),this.observers["*"]&&[].concat(this.observers["*"]).forEach(a=>{a.apply(a,[t,...r])})}}function qp(){let e,t;const n=new Promise((r,i)=>{e=r,t=i});return n.resolve=e,n.reject=t,n}function rI(e){return e==null?"":""+e}function kle(e,t,n){e.forEach(r=>{t[r]&&(n[r]=t[r])})}function vk(e,t,n){function r(a){return a&&a.indexOf("###")>-1?a.replace(/###/g,"."):a}function i(){return!e||typeof e=="string"}const o=typeof t!="string"?[].concat(t):t.split(".");for(;o.length>1;){if(i())return{};const a=r(o.shift());!e[a]&&n&&(e[a]=new n),Object.prototype.hasOwnProperty.call(e,a)?e=e[a]:e={}}return i()?{}:{obj:e,k:r(o.shift())}}function iI(e,t,n){const{obj:r,k:i}=vk(e,t,Object);r[i]=n}function Ale(e,t,n,r){const{obj:i,k:o}=vk(e,t,Object);i[o]=i[o]||[],r&&(i[o]=i[o].concat(n)),r||i[o].push(n)}function n_(e,t){const{obj:n,k:r}=vk(e,t);if(n)return n[r]}function Ple(e,t,n){const r=n_(e,n);return r!==void 0?r:n_(t,n)}function MB(e,t,n){for(const r in t)r!=="__proto__"&&r!=="constructor"&&(r in e?typeof e[r]=="string"||e[r]instanceof String||typeof t[r]=="string"||t[r]instanceof String?n&&(e[r]=t[r]):MB(e[r],t[r],n):e[r]=t[r]);return e}function sf(e){return e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}var Ile={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};function Rle(e){return typeof e=="string"?e.replace(/[&<>"'\/]/g,t=>Ile[t]):e}const Ole=[" ",",","?","!",";"];function Mle(e,t,n){t=t||"",n=n||"";const r=Ole.filter(a=>t.indexOf(a)<0&&n.indexOf(a)<0);if(r.length===0)return!0;const i=new RegExp(`(${r.map(a=>a==="?"?"\\?":a).join("|")})`);let o=!i.test(e);if(!o){const a=e.indexOf(n);a>0&&!i.test(e.substring(0,a))&&(o=!0)}return o}function r_(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:".";if(!e)return;if(e[t])return e[t];const r=t.split(n);let i=e;for(let o=0;oo+a;)a++,s=r.slice(o,o+a).join(n),l=i[s];if(l===void 0)return;if(l===null)return null;if(t.endsWith(s)){if(typeof l=="string")return l;if(s&&typeof l[s]=="string")return l[s]}const u=r.slice(o+a).join(n);return u?r_(l,u,n):void 0}i=i[r[o]]}return i}function i_(e){return e&&e.indexOf("_")>0?e.replace("_","-"):e}class oI extends ZS{constructor(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{ns:["translation"],defaultNS:"translation"};super(),this.data=t||{},this.options=n,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.options.ignoreJSONStructure===void 0&&(this.options.ignoreJSONStructure=!0)}addNamespaces(t){this.options.ns.indexOf(t)<0&&this.options.ns.push(t)}removeNamespaces(t){const n=this.options.ns.indexOf(t);n>-1&&this.options.ns.splice(n,1)}getResource(t,n,r){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};const o=i.keySeparator!==void 0?i.keySeparator:this.options.keySeparator,a=i.ignoreJSONStructure!==void 0?i.ignoreJSONStructure:this.options.ignoreJSONStructure;let s=[t,n];r&&typeof r!="string"&&(s=s.concat(r)),r&&typeof r=="string"&&(s=s.concat(o?r.split(o):r)),t.indexOf(".")>-1&&(s=t.split("."));const l=n_(this.data,s);return l||!a||typeof r!="string"?l:r_(this.data&&this.data[t]&&this.data[t][n],r,o)}addResource(t,n,r,i){let o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{silent:!1};const a=o.keySeparator!==void 0?o.keySeparator:this.options.keySeparator;let s=[t,n];r&&(s=s.concat(a?r.split(a):r)),t.indexOf(".")>-1&&(s=t.split("."),i=n,n=s[1]),this.addNamespaces(n),iI(this.data,s,i),o.silent||this.emit("added",t,n,r,i)}addResources(t,n,r){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{silent:!1};for(const o in r)(typeof r[o]=="string"||Object.prototype.toString.apply(r[o])==="[object Array]")&&this.addResource(t,n,o,r[o],{silent:!0});i.silent||this.emit("added",t,n,r)}addResourceBundle(t,n,r,i,o){let a=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{silent:!1},s=[t,n];t.indexOf(".")>-1&&(s=t.split("."),i=r,r=n,n=s[1]),this.addNamespaces(n);let l=n_(this.data,s)||{};i?MB(l,r,o):l={...l,...r},iI(this.data,s,l),a.silent||this.emit("added",t,n,r)}removeResourceBundle(t,n){this.hasResourceBundle(t,n)&&delete this.data[t][n],this.removeNamespaces(n),this.emit("removed",t,n)}hasResourceBundle(t,n){return this.getResource(t,n)!==void 0}getResourceBundle(t,n){return n||(n=this.options.defaultNS),this.options.compatibilityAPI==="v1"?{...this.getResource(t,n)}:this.getResource(t,n)}getDataByLanguage(t){return this.data[t]}hasLanguageSomeTranslations(t){const n=this.getDataByLanguage(t);return!!(n&&Object.keys(n)||[]).find(i=>n[i]&&Object.keys(n[i]).length>0)}toJSON(){return this.data}}var NB={processors:{},addPostProcessor(e){this.processors[e.name]=e},handle(e,t,n,r,i){return e.forEach(o=>{this.processors[o]&&(t=this.processors[o].process(t,n,r,i))}),t}};const aI={};class o_ extends ZS{constructor(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(),kle(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],t,this),this.options=n,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=Ns.create("translator")}changeLanguage(t){t&&(this.language=t)}exists(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}};if(t==null)return!1;const r=this.resolve(t,n);return r&&r.res!==void 0}extractFromKey(t,n){let r=n.nsSeparator!==void 0?n.nsSeparator:this.options.nsSeparator;r===void 0&&(r=":");const i=n.keySeparator!==void 0?n.keySeparator:this.options.keySeparator;let o=n.ns||this.options.defaultNS||[];const a=r&&t.indexOf(r)>-1,s=!this.options.userDefinedKeySeparator&&!n.keySeparator&&!this.options.userDefinedNsSeparator&&!n.nsSeparator&&!Mle(t,r,i);if(a&&!s){const l=t.match(this.interpolator.nestingRegexp);if(l&&l.length>0)return{key:t,namespaces:o};const u=t.split(r);(r!==i||r===i&&this.options.ns.indexOf(u[0])>-1)&&(o=u.shift()),t=u.join(i)}return typeof o=="string"&&(o=[o]),{key:t,namespaces:o}}translate(t,n,r){if(typeof n!="object"&&this.options.overloadTranslationOptionHandler&&(n=this.options.overloadTranslationOptionHandler(arguments)),typeof n=="object"&&(n={...n}),n||(n={}),t==null)return"";Array.isArray(t)||(t=[String(t)]);const i=n.returnDetails!==void 0?n.returnDetails:this.options.returnDetails,o=n.keySeparator!==void 0?n.keySeparator:this.options.keySeparator,{key:a,namespaces:s}=this.extractFromKey(t[t.length-1],n),l=s[s.length-1],u=n.lng||this.language,c=n.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(u&&u.toLowerCase()==="cimode"){if(c){const y=n.nsSeparator||this.options.nsSeparator;return i?{res:`${l}${y}${a}`,usedKey:a,exactUsedKey:a,usedLng:u,usedNS:l}:`${l}${y}${a}`}return i?{res:a,usedKey:a,exactUsedKey:a,usedLng:u,usedNS:l}:a}const d=this.resolve(t,n);let f=d&&d.res;const h=d&&d.usedKey||a,p=d&&d.exactUsedKey||a,m=Object.prototype.toString.apply(f),_=["[object Number]","[object Function]","[object RegExp]"],b=n.joinArrays!==void 0?n.joinArrays:this.options.joinArrays,v=!this.i18nFormat||this.i18nFormat.handleAsObject;if(v&&f&&(typeof f!="string"&&typeof f!="boolean"&&typeof f!="number")&&_.indexOf(m)<0&&!(typeof b=="string"&&m==="[object Array]")){if(!n.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const y=this.options.returnedObjectHandler?this.options.returnedObjectHandler(h,f,{...n,ns:s}):`key '${a} (${this.language})' returned an object instead of string.`;return i?(d.res=y,d):y}if(o){const y=m==="[object Array]",S=y?[]:{},w=y?p:h;for(const x in f)if(Object.prototype.hasOwnProperty.call(f,x)){const C=`${w}${o}${x}`;S[x]=this.translate(C,{...n,joinArrays:!1,ns:s}),S[x]===C&&(S[x]=f[x])}f=S}}else if(v&&typeof b=="string"&&m==="[object Array]")f=f.join(b),f&&(f=this.extendTranslation(f,t,n,r));else{let y=!1,S=!1;const w=n.count!==void 0&&typeof n.count!="string",x=o_.hasDefaultValue(n),C=w?this.pluralResolver.getSuffix(u,n.count,n):"",k=n.ordinal&&w?this.pluralResolver.getSuffix(u,n.count,{ordinal:!1}):"",T=n[`defaultValue${C}`]||n[`defaultValue${k}`]||n.defaultValue;!this.isValidLookup(f)&&x&&(y=!0,f=T),this.isValidLookup(f)||(S=!0,f=a);const $=(n.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&S?void 0:f,O=x&&T!==f&&this.options.updateMissing;if(S||y||O){if(this.logger.log(O?"updateKey":"missingKey",u,l,a,O?T:f),o){const L=this.resolve(a,{...n,keySeparator:!1});L&&L.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}let E=[];const A=this.languageUtils.getFallbackCodes(this.options.fallbackLng,n.lng||this.language);if(this.options.saveMissingTo==="fallback"&&A&&A[0])for(let L=0;L{const N=x&&R!==f?R:$;this.options.missingKeyHandler?this.options.missingKeyHandler(L,l,M,N,O,n):this.backendConnector&&this.backendConnector.saveMissing&&this.backendConnector.saveMissing(L,l,M,N,O,n),this.emit("missingKey",L,l,M,f)};this.options.saveMissing&&(this.options.saveMissingPlurals&&w?E.forEach(L=>{this.pluralResolver.getSuffixes(L,n).forEach(M=>{D([L],a+M,n[`defaultValue${M}`]||T)})}):D(E,a,T))}f=this.extendTranslation(f,t,n,d,r),S&&f===a&&this.options.appendNamespaceToMissingKey&&(f=`${l}:${a}`),(S||y)&&this.options.parseMissingKeyHandler&&(this.options.compatibilityAPI!=="v1"?f=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${l}:${a}`:a,y?f:void 0):f=this.options.parseMissingKeyHandler(f))}return i?(d.res=f,d):f}extendTranslation(t,n,r,i,o){var a=this;if(this.i18nFormat&&this.i18nFormat.parse)t=this.i18nFormat.parse(t,{...this.options.interpolation.defaultVariables,...r},i.usedLng,i.usedNS,i.usedKey,{resolved:i});else if(!r.skipInterpolation){r.interpolation&&this.interpolator.init({...r,interpolation:{...this.options.interpolation,...r.interpolation}});const u=typeof t=="string"&&(r&&r.interpolation&&r.interpolation.skipOnVariables!==void 0?r.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let c;if(u){const f=t.match(this.interpolator.nestingRegexp);c=f&&f.length}let d=r.replace&&typeof r.replace!="string"?r.replace:r;if(this.options.interpolation.defaultVariables&&(d={...this.options.interpolation.defaultVariables,...d}),t=this.interpolator.interpolate(t,d,r.lng||this.language,r),u){const f=t.match(this.interpolator.nestingRegexp),h=f&&f.length;c1&&arguments[1]!==void 0?arguments[1]:{},r,i,o,a,s;return typeof t=="string"&&(t=[t]),t.forEach(l=>{if(this.isValidLookup(r))return;const u=this.extractFromKey(l,n),c=u.key;i=c;let d=u.namespaces;this.options.fallbackNS&&(d=d.concat(this.options.fallbackNS));const f=n.count!==void 0&&typeof n.count!="string",h=f&&!n.ordinal&&n.count===0&&this.pluralResolver.shouldUseIntlApi(),p=n.context!==void 0&&(typeof n.context=="string"||typeof n.context=="number")&&n.context!=="",m=n.lngs?n.lngs:this.languageUtils.toResolveHierarchy(n.lng||this.language,n.fallbackLng);d.forEach(_=>{this.isValidLookup(r)||(s=_,!aI[`${m[0]}-${_}`]&&this.utils&&this.utils.hasLoadedNamespace&&!this.utils.hasLoadedNamespace(s)&&(aI[`${m[0]}-${_}`]=!0,this.logger.warn(`key "${i}" for languages "${m.join(", ")}" won't get resolved as namespace "${s}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),m.forEach(b=>{if(this.isValidLookup(r))return;a=b;const v=[c];if(this.i18nFormat&&this.i18nFormat.addLookupKeys)this.i18nFormat.addLookupKeys(v,c,b,_,n);else{let y;f&&(y=this.pluralResolver.getSuffix(b,n.count,n));const S=`${this.options.pluralSeparator}zero`,w=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(f&&(v.push(c+y),n.ordinal&&y.indexOf(w)===0&&v.push(c+y.replace(w,this.options.pluralSeparator)),h&&v.push(c+S)),p){const x=`${c}${this.options.contextSeparator}${n.context}`;v.push(x),f&&(v.push(x+y),n.ordinal&&y.indexOf(w)===0&&v.push(x+y.replace(w,this.options.pluralSeparator)),h&&v.push(x+S))}}let g;for(;g=v.pop();)this.isValidLookup(r)||(o=g,r=this.getResource(b,_,g,n))}))})}),{res:r,usedKey:i,exactUsedKey:o,usedLng:a,usedNS:s}}isValidLookup(t){return t!==void 0&&!(!this.options.returnNull&&t===null)&&!(!this.options.returnEmptyString&&t==="")}getResource(t,n,r){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};return this.i18nFormat&&this.i18nFormat.getResource?this.i18nFormat.getResource(t,n,r,i):this.resourceStore.getResource(t,n,r,i)}static hasDefaultValue(t){const n="defaultValue";for(const r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&n===r.substring(0,n.length)&&t[r]!==void 0)return!0;return!1}}function oC(e){return e.charAt(0).toUpperCase()+e.slice(1)}class sI{constructor(t){this.options=t,this.supportedLngs=this.options.supportedLngs||!1,this.logger=Ns.create("languageUtils")}getScriptPartFromCode(t){if(t=i_(t),!t||t.indexOf("-")<0)return null;const n=t.split("-");return n.length===2||(n.pop(),n[n.length-1].toLowerCase()==="x")?null:this.formatLanguageCode(n.join("-"))}getLanguagePartFromCode(t){if(t=i_(t),!t||t.indexOf("-")<0)return t;const n=t.split("-");return this.formatLanguageCode(n[0])}formatLanguageCode(t){if(typeof t=="string"&&t.indexOf("-")>-1){const n=["hans","hant","latn","cyrl","cans","mong","arab"];let r=t.split("-");return this.options.lowerCaseLng?r=r.map(i=>i.toLowerCase()):r.length===2?(r[0]=r[0].toLowerCase(),r[1]=r[1].toUpperCase(),n.indexOf(r[1].toLowerCase())>-1&&(r[1]=oC(r[1].toLowerCase()))):r.length===3&&(r[0]=r[0].toLowerCase(),r[1].length===2&&(r[1]=r[1].toUpperCase()),r[0]!=="sgn"&&r[2].length===2&&(r[2]=r[2].toUpperCase()),n.indexOf(r[1].toLowerCase())>-1&&(r[1]=oC(r[1].toLowerCase())),n.indexOf(r[2].toLowerCase())>-1&&(r[2]=oC(r[2].toLowerCase()))),r.join("-")}return this.options.cleanCode||this.options.lowerCaseLng?t.toLowerCase():t}isSupportedCode(t){return(this.options.load==="languageOnly"||this.options.nonExplicitSupportedLngs)&&(t=this.getLanguagePartFromCode(t)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(t)>-1}getBestMatchFromCodes(t){if(!t)return null;let n;return t.forEach(r=>{if(n)return;const i=this.formatLanguageCode(r);(!this.options.supportedLngs||this.isSupportedCode(i))&&(n=i)}),!n&&this.options.supportedLngs&&t.forEach(r=>{if(n)return;const i=this.getLanguagePartFromCode(r);if(this.isSupportedCode(i))return n=i;n=this.options.supportedLngs.find(o=>{if(o===i)return o;if(!(o.indexOf("-")<0&&i.indexOf("-")<0)&&o.indexOf(i)===0)return o})}),n||(n=this.getFallbackCodes(this.options.fallbackLng)[0]),n}getFallbackCodes(t,n){if(!t)return[];if(typeof t=="function"&&(t=t(n)),typeof t=="string"&&(t=[t]),Object.prototype.toString.apply(t)==="[object Array]")return t;if(!n)return t.default||[];let r=t[n];return r||(r=t[this.getScriptPartFromCode(n)]),r||(r=t[this.formatLanguageCode(n)]),r||(r=t[this.getLanguagePartFromCode(n)]),r||(r=t.default),r||[]}toResolveHierarchy(t,n){const r=this.getFallbackCodes(n||this.options.fallbackLng||[],t),i=[],o=a=>{a&&(this.isSupportedCode(a)?i.push(a):this.logger.warn(`rejecting language code not found in supportedLngs: ${a}`))};return typeof t=="string"&&(t.indexOf("-")>-1||t.indexOf("_")>-1)?(this.options.load!=="languageOnly"&&o(this.formatLanguageCode(t)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&o(this.getScriptPartFromCode(t)),this.options.load!=="currentOnly"&&o(this.getLanguagePartFromCode(t))):typeof t=="string"&&o(this.formatLanguageCode(t)),r.forEach(a=>{i.indexOf(a)<0&&o(this.formatLanguageCode(a))}),i}}let Nle=[{lngs:["ach","ak","am","arn","br","fil","gun","ln","mfe","mg","mi","oc","pt","pt-BR","tg","tl","ti","tr","uz","wa"],nr:[1,2],fc:1},{lngs:["af","an","ast","az","bg","bn","ca","da","de","dev","el","en","eo","es","et","eu","fi","fo","fur","fy","gl","gu","ha","hi","hu","hy","ia","it","kk","kn","ku","lb","mai","ml","mn","mr","nah","nap","nb","ne","nl","nn","no","nso","pa","pap","pms","ps","pt-PT","rm","sco","se","si","so","son","sq","sv","sw","ta","te","tk","ur","yo"],nr:[1,2],fc:2},{lngs:["ay","bo","cgg","fa","ht","id","ja","jbo","ka","km","ko","ky","lo","ms","sah","su","th","tt","ug","vi","wo","zh"],nr:[1],fc:3},{lngs:["be","bs","cnr","dz","hr","ru","sr","uk"],nr:[1,2,5],fc:4},{lngs:["ar"],nr:[0,1,2,3,11,100],fc:5},{lngs:["cs","sk"],nr:[1,2,5],fc:6},{lngs:["csb","pl"],nr:[1,2,5],fc:7},{lngs:["cy"],nr:[1,2,3,8],fc:8},{lngs:["fr"],nr:[1,2],fc:9},{lngs:["ga"],nr:[1,2,3,7,11],fc:10},{lngs:["gd"],nr:[1,2,3,20],fc:11},{lngs:["is"],nr:[1,2],fc:12},{lngs:["jv"],nr:[0,1],fc:13},{lngs:["kw"],nr:[1,2,3,4],fc:14},{lngs:["lt"],nr:[1,2,10],fc:15},{lngs:["lv"],nr:[1,2,0],fc:16},{lngs:["mk"],nr:[1,2],fc:17},{lngs:["mnk"],nr:[0,1,2],fc:18},{lngs:["mt"],nr:[1,2,11,20],fc:19},{lngs:["or"],nr:[2,1],fc:2},{lngs:["ro"],nr:[1,2,20],fc:20},{lngs:["sl"],nr:[5,1,2,3],fc:21},{lngs:["he","iw"],nr:[1,2,20,21],fc:22}],$le={1:function(e){return+(e>1)},2:function(e){return+(e!=1)},3:function(e){return 0},4:function(e){return e%10==1&&e%100!=11?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2},5:function(e){return e==0?0:e==1?1:e==2?2:e%100>=3&&e%100<=10?3:e%100>=11?4:5},6:function(e){return e==1?0:e>=2&&e<=4?1:2},7:function(e){return e==1?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2},8:function(e){return e==1?0:e==2?1:e!=8&&e!=11?2:3},9:function(e){return+(e>=2)},10:function(e){return e==1?0:e==2?1:e<7?2:e<11?3:4},11:function(e){return e==1||e==11?0:e==2||e==12?1:e>2&&e<20?2:3},12:function(e){return+(e%10!=1||e%100==11)},13:function(e){return+(e!==0)},14:function(e){return e==1?0:e==2?1:e==3?2:3},15:function(e){return e%10==1&&e%100!=11?0:e%10>=2&&(e%100<10||e%100>=20)?1:2},16:function(e){return e%10==1&&e%100!=11?0:e!==0?1:2},17:function(e){return e==1||e%10==1&&e%100!=11?0:1},18:function(e){return e==0?0:e==1?1:2},19:function(e){return e==1?0:e==0||e%100>1&&e%100<11?1:e%100>10&&e%100<20?2:3},20:function(e){return e==1?0:e==0||e%100>0&&e%100<20?1:2},21:function(e){return e%100==1?1:e%100==2?2:e%100==3||e%100==4?3:0},22:function(e){return e==1?0:e==2?1:(e<0||e>10)&&e%10==0?2:3}};const Dle=["v1","v2","v3"],Lle=["v4"],lI={zero:0,one:1,two:2,few:3,many:4,other:5};function Fle(){const e={};return Nle.forEach(t=>{t.lngs.forEach(n=>{e[n]={numbers:t.nr,plurals:$le[t.fc]}})}),e}class Ble{constructor(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.languageUtils=t,this.options=n,this.logger=Ns.create("pluralResolver"),(!this.options.compatibilityJSON||Lle.includes(this.options.compatibilityJSON))&&(typeof Intl>"u"||!Intl.PluralRules)&&(this.options.compatibilityJSON="v3",this.logger.error("Your environment seems not to be Intl API compatible, use an Intl.PluralRules polyfill. Will fallback to the compatibilityJSON v3 format handling.")),this.rules=Fle()}addRule(t,n){this.rules[t]=n}getRule(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(this.shouldUseIntlApi())try{return new Intl.PluralRules(i_(t),{type:n.ordinal?"ordinal":"cardinal"})}catch{return}return this.rules[t]||this.rules[this.languageUtils.getLanguagePartFromCode(t)]}needsPlural(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const r=this.getRule(t,n);return this.shouldUseIntlApi()?r&&r.resolvedOptions().pluralCategories.length>1:r&&r.numbers.length>1}getPluralFormsOfKey(t,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return this.getSuffixes(t,r).map(i=>`${n}${i}`)}getSuffixes(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const r=this.getRule(t,n);return r?this.shouldUseIntlApi()?r.resolvedOptions().pluralCategories.sort((i,o)=>lI[i]-lI[o]).map(i=>`${this.options.prepend}${n.ordinal?`ordinal${this.options.prepend}`:""}${i}`):r.numbers.map(i=>this.getSuffix(t,i,n)):[]}getSuffix(t,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const i=this.getRule(t,r);return i?this.shouldUseIntlApi()?`${this.options.prepend}${r.ordinal?`ordinal${this.options.prepend}`:""}${i.select(n)}`:this.getSuffixRetroCompatible(i,n):(this.logger.warn(`no plural rule found for: ${t}`),"")}getSuffixRetroCompatible(t,n){const r=t.noAbs?t.plurals(n):t.plurals(Math.abs(n));let i=t.numbers[r];this.options.simplifyPluralSuffix&&t.numbers.length===2&&t.numbers[0]===1&&(i===2?i="plural":i===1&&(i=""));const o=()=>this.options.prepend&&i.toString()?this.options.prepend+i.toString():i.toString();return this.options.compatibilityJSON==="v1"?i===1?"":typeof i=="number"?`_plural_${i.toString()}`:o():this.options.compatibilityJSON==="v2"||this.options.simplifyPluralSuffix&&t.numbers.length===2&&t.numbers[0]===1?o():this.options.prepend&&r.toString()?this.options.prepend+r.toString():r.toString()}shouldUseIntlApi(){return!Dle.includes(this.options.compatibilityJSON)}}function uI(e,t,n){let r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:".",i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,o=Ple(e,t,n);return!o&&i&&typeof n=="string"&&(o=r_(e,n,r),o===void 0&&(o=r_(t,n,r))),o}class zle{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=Ns.create("interpolator"),this.options=t,this.format=t.interpolation&&t.interpolation.format||(n=>n),this.init(t)}init(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};t.interpolation||(t.interpolation={escapeValue:!0});const n=t.interpolation;this.escape=n.escape!==void 0?n.escape:Rle,this.escapeValue=n.escapeValue!==void 0?n.escapeValue:!0,this.useRawValueToEscape=n.useRawValueToEscape!==void 0?n.useRawValueToEscape:!1,this.prefix=n.prefix?sf(n.prefix):n.prefixEscaped||"{{",this.suffix=n.suffix?sf(n.suffix):n.suffixEscaped||"}}",this.formatSeparator=n.formatSeparator?n.formatSeparator:n.formatSeparator||",",this.unescapePrefix=n.unescapeSuffix?"":n.unescapePrefix||"-",this.unescapeSuffix=this.unescapePrefix?"":n.unescapeSuffix||"",this.nestingPrefix=n.nestingPrefix?sf(n.nestingPrefix):n.nestingPrefixEscaped||sf("$t("),this.nestingSuffix=n.nestingSuffix?sf(n.nestingSuffix):n.nestingSuffixEscaped||sf(")"),this.nestingOptionsSeparator=n.nestingOptionsSeparator?n.nestingOptionsSeparator:n.nestingOptionsSeparator||",",this.maxReplaces=n.maxReplaces?n.maxReplaces:1e3,this.alwaysFormat=n.alwaysFormat!==void 0?n.alwaysFormat:!1,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){const t=`${this.prefix}(.+?)${this.suffix}`;this.regexp=new RegExp(t,"g");const n=`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`;this.regexpUnescape=new RegExp(n,"g");const r=`${this.nestingPrefix}(.+?)${this.nestingSuffix}`;this.nestingRegexp=new RegExp(r,"g")}interpolate(t,n,r,i){let o,a,s;const l=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{};function u(p){return p.replace(/\$/g,"$$$$")}const c=p=>{if(p.indexOf(this.formatSeparator)<0){const v=uI(n,l,p,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(v,void 0,r,{...i,...n,interpolationkey:p}):v}const m=p.split(this.formatSeparator),_=m.shift().trim(),b=m.join(this.formatSeparator).trim();return this.format(uI(n,l,_,this.options.keySeparator,this.options.ignoreJSONStructure),b,r,{...i,...n,interpolationkey:_})};this.resetRegExp();const d=i&&i.missingInterpolationHandler||this.options.missingInterpolationHandler,f=i&&i.interpolation&&i.interpolation.skipOnVariables!==void 0?i.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:p=>u(p)},{regex:this.regexp,safeValue:p=>this.escapeValue?u(this.escape(p)):u(p)}].forEach(p=>{for(s=0;o=p.regex.exec(t);){const m=o[1].trim();if(a=c(m),a===void 0)if(typeof d=="function"){const b=d(t,o,i);a=typeof b=="string"?b:""}else if(i&&Object.prototype.hasOwnProperty.call(i,m))a="";else if(f){a=o[0];continue}else this.logger.warn(`missed to pass in variable ${m} for interpolating ${t}`),a="";else typeof a!="string"&&!this.useRawValueToEscape&&(a=rI(a));const _=p.safeValue(a);if(t=t.replace(o[0],_),f?(p.regex.lastIndex+=a.length,p.regex.lastIndex-=o[0].length):p.regex.lastIndex=0,s++,s>=this.maxReplaces)break}}),t}nest(t,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},i,o,a;function s(l,u){const c=this.nestingOptionsSeparator;if(l.indexOf(c)<0)return l;const d=l.split(new RegExp(`${c}[ ]*{`));let f=`{${d[1]}`;l=d[0],f=this.interpolate(f,a);const h=f.match(/'/g),p=f.match(/"/g);(h&&h.length%2===0&&!p||p.length%2!==0)&&(f=f.replace(/'/g,'"'));try{a=JSON.parse(f),u&&(a={...u,...a})}catch(m){return this.logger.warn(`failed parsing options string in nesting for key ${l}`,m),`${l}${c}${f}`}return delete a.defaultValue,l}for(;i=this.nestingRegexp.exec(t);){let l=[];a={...r},a=a.replace&&typeof a.replace!="string"?a.replace:a,a.applyPostProcessor=!1,delete a.defaultValue;let u=!1;if(i[0].indexOf(this.formatSeparator)!==-1&&!/{.*}/.test(i[1])){const c=i[1].split(this.formatSeparator).map(d=>d.trim());i[1]=c.shift(),l=c,u=!0}if(o=n(s.call(this,i[1].trim(),a),a),o&&i[0]===t&&typeof o!="string")return o;typeof o!="string"&&(o=rI(o)),o||(this.logger.warn(`missed to resolve ${i[1]} for nesting ${t}`),o=""),u&&(o=l.reduce((c,d)=>this.format(c,d,r.lng,{...r,interpolationkey:i[1].trim()}),o.trim())),t=t.replace(i[0],o),this.regexp.lastIndex=0}return t}}function jle(e){let t=e.toLowerCase().trim();const n={};if(e.indexOf("(")>-1){const r=e.split("(");t=r[0].toLowerCase().trim();const i=r[1].substring(0,r[1].length-1);t==="currency"&&i.indexOf(":")<0?n.currency||(n.currency=i.trim()):t==="relativetime"&&i.indexOf(":")<0?n.range||(n.range=i.trim()):i.split(";").forEach(a=>{if(!a)return;const[s,...l]=a.split(":"),u=l.join(":").trim().replace(/^'+|'+$/g,"");n[s.trim()]||(n[s.trim()]=u),u==="false"&&(n[s.trim()]=!1),u==="true"&&(n[s.trim()]=!0),isNaN(u)||(n[s.trim()]=parseInt(u,10))})}return{formatName:t,formatOptions:n}}function lf(e){const t={};return function(r,i,o){const a=i+JSON.stringify(o);let s=t[a];return s||(s=e(i_(i),o),t[a]=s),s(r)}}class Ule{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=Ns.create("formatter"),this.options=t,this.formats={number:lf((n,r)=>{const i=new Intl.NumberFormat(n,{...r});return o=>i.format(o)}),currency:lf((n,r)=>{const i=new Intl.NumberFormat(n,{...r,style:"currency"});return o=>i.format(o)}),datetime:lf((n,r)=>{const i=new Intl.DateTimeFormat(n,{...r});return o=>i.format(o)}),relativetime:lf((n,r)=>{const i=new Intl.RelativeTimeFormat(n,{...r});return o=>i.format(o,r.range||"day")}),list:lf((n,r)=>{const i=new Intl.ListFormat(n,{...r});return o=>i.format(o)})},this.init(t)}init(t){const r=(arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}}).interpolation;this.formatSeparator=r.formatSeparator?r.formatSeparator:r.formatSeparator||","}add(t,n){this.formats[t.toLowerCase().trim()]=n}addCached(t,n){this.formats[t.toLowerCase().trim()]=lf(n)}format(t,n,r){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};return n.split(this.formatSeparator).reduce((s,l)=>{const{formatName:u,formatOptions:c}=jle(l);if(this.formats[u]){let d=s;try{const f=i&&i.formatParams&&i.formatParams[i.interpolationkey]||{},h=f.locale||f.lng||i.locale||i.lng||r;d=this.formats[u](s,h,{...c,...i,...f})}catch(f){this.logger.warn(f)}return d}else this.logger.warn(`there was no format function for ${u}`);return s},t)}}function Vle(e,t){e.pending[t]!==void 0&&(delete e.pending[t],e.pendingCount--)}class Gle extends ZS{constructor(t,n,r){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};super(),this.backend=t,this.store=n,this.services=r,this.languageUtils=r.languageUtils,this.options=i,this.logger=Ns.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=i.maxParallelReads||10,this.readingCalls=0,this.maxRetries=i.maxRetries>=0?i.maxRetries:5,this.retryTimeout=i.retryTimeout>=1?i.retryTimeout:350,this.state={},this.queue=[],this.backend&&this.backend.init&&this.backend.init(r,i.backend,i)}queueLoad(t,n,r,i){const o={},a={},s={},l={};return t.forEach(u=>{let c=!0;n.forEach(d=>{const f=`${u}|${d}`;!r.reload&&this.store.hasResourceBundle(u,d)?this.state[f]=2:this.state[f]<0||(this.state[f]===1?a[f]===void 0&&(a[f]=!0):(this.state[f]=1,c=!1,a[f]===void 0&&(a[f]=!0),o[f]===void 0&&(o[f]=!0),l[d]===void 0&&(l[d]=!0)))}),c||(s[u]=!0)}),(Object.keys(o).length||Object.keys(a).length)&&this.queue.push({pending:a,pendingCount:Object.keys(a).length,loaded:{},errors:[],callback:i}),{toLoad:Object.keys(o),pending:Object.keys(a),toLoadLanguages:Object.keys(s),toLoadNamespaces:Object.keys(l)}}loaded(t,n,r){const i=t.split("|"),o=i[0],a=i[1];n&&this.emit("failedLoading",o,a,n),r&&this.store.addResourceBundle(o,a,r),this.state[t]=n?-1:2;const s={};this.queue.forEach(l=>{Ale(l.loaded,[o],a),Vle(l,t),n&&l.errors.push(n),l.pendingCount===0&&!l.done&&(Object.keys(l.loaded).forEach(u=>{s[u]||(s[u]={});const c=l.loaded[u];c.length&&c.forEach(d=>{s[u][d]===void 0&&(s[u][d]=!0)})}),l.done=!0,l.errors.length?l.callback(l.errors):l.callback())}),this.emit("loaded",s),this.queue=this.queue.filter(l=>!l.done)}read(t,n,r){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:this.retryTimeout,a=arguments.length>5?arguments[5]:void 0;if(!t.length)return a(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:t,ns:n,fcName:r,tried:i,wait:o,callback:a});return}this.readingCalls++;const s=(u,c)=>{if(this.readingCalls--,this.waitingReads.length>0){const d=this.waitingReads.shift();this.read(d.lng,d.ns,d.fcName,d.tried,d.wait,d.callback)}if(u&&c&&i{this.read.call(this,t,n,r,i+1,o*2,a)},o);return}a(u,c)},l=this.backend[r].bind(this.backend);if(l.length===2){try{const u=l(t,n);u&&typeof u.then=="function"?u.then(c=>s(null,c)).catch(s):s(null,u)}catch(u){s(u)}return}return l(t,n,s)}prepareLoading(t,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},i=arguments.length>3?arguments[3]:void 0;if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),i&&i();typeof t=="string"&&(t=this.languageUtils.toResolveHierarchy(t)),typeof n=="string"&&(n=[n]);const o=this.queueLoad(t,n,r,i);if(!o.toLoad.length)return o.pending.length||i(),null;o.toLoad.forEach(a=>{this.loadOne(a)})}load(t,n,r){this.prepareLoading(t,n,{},r)}reload(t,n,r){this.prepareLoading(t,n,{reload:!0},r)}loadOne(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";const r=t.split("|"),i=r[0],o=r[1];this.read(i,o,"read",void 0,void 0,(a,s)=>{a&&this.logger.warn(`${n}loading namespace ${o} for language ${i} failed`,a),!a&&s&&this.logger.log(`${n}loaded namespace ${o} for language ${i}`,s),this.loaded(t,a,s)})}saveMissing(t,n,r,i,o){let a=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{},s=arguments.length>6&&arguments[6]!==void 0?arguments[6]:()=>{};if(this.services.utils&&this.services.utils.hasLoadedNamespace&&!this.services.utils.hasLoadedNamespace(n)){this.logger.warn(`did not save key "${r}" as the namespace "${n}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");return}if(!(r==null||r==="")){if(this.backend&&this.backend.create){const l={...a,isUpdate:o},u=this.backend.create.bind(this.backend);if(u.length<6)try{let c;u.length===5?c=u(t,n,r,i,l):c=u(t,n,r,i),c&&typeof c.then=="function"?c.then(d=>s(null,d)).catch(s):s(null,c)}catch(c){s(c)}else u(t,n,r,i,s,l)}!t||!t[0]||this.store.addResource(t[0],n,r,i)}}}function cI(){return{debug:!1,initImmediate:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!1,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:function(t){let n={};if(typeof t[1]=="object"&&(n=t[1]),typeof t[1]=="string"&&(n.defaultValue=t[1]),typeof t[2]=="string"&&(n.tDescription=t[2]),typeof t[2]=="object"||typeof t[3]=="object"){const r=t[3]||t[2];Object.keys(r).forEach(i=>{n[i]=r[i]})}return n},interpolation:{escapeValue:!0,format:(e,t,n,r)=>e,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0}}}function dI(e){return typeof e.ns=="string"&&(e.ns=[e.ns]),typeof e.fallbackLng=="string"&&(e.fallbackLng=[e.fallbackLng]),typeof e.fallbackNS=="string"&&(e.fallbackNS=[e.fallbackNS]),e.supportedLngs&&e.supportedLngs.indexOf("cimode")<0&&(e.supportedLngs=e.supportedLngs.concat(["cimode"])),e}function gv(){}function qle(e){Object.getOwnPropertyNames(Object.getPrototypeOf(e)).forEach(n=>{typeof e[n]=="function"&&(e[n]=e[n].bind(e))})}class Km extends ZS{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;if(super(),this.options=dI(t),this.services={},this.logger=Ns,this.modules={external:[]},qle(this),n&&!this.isInitialized&&!t.isClone){if(!this.options.initImmediate)return this.init(t,n),this;setTimeout(()=>{this.init(t,n)},0)}}init(){var t=this;let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0;typeof n=="function"&&(r=n,n={}),!n.defaultNS&&n.defaultNS!==!1&&n.ns&&(typeof n.ns=="string"?n.defaultNS=n.ns:n.ns.indexOf("translation")<0&&(n.defaultNS=n.ns[0]));const i=cI();this.options={...i,...this.options,...dI(n)},this.options.compatibilityAPI!=="v1"&&(this.options.interpolation={...i.interpolation,...this.options.interpolation}),n.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=n.keySeparator),n.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=n.nsSeparator);function o(c){return c?typeof c=="function"?new c:c:null}if(!this.options.isClone){this.modules.logger?Ns.init(o(this.modules.logger),this.options):Ns.init(null,this.options);let c;this.modules.formatter?c=this.modules.formatter:typeof Intl<"u"&&(c=Ule);const d=new sI(this.options);this.store=new oI(this.options.resources,this.options);const f=this.services;f.logger=Ns,f.resourceStore=this.store,f.languageUtils=d,f.pluralResolver=new Ble(d,{prepend:this.options.pluralSeparator,compatibilityJSON:this.options.compatibilityJSON,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),c&&(!this.options.interpolation.format||this.options.interpolation.format===i.interpolation.format)&&(f.formatter=o(c),f.formatter.init(f,this.options),this.options.interpolation.format=f.formatter.format.bind(f.formatter)),f.interpolator=new zle(this.options),f.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},f.backendConnector=new Gle(o(this.modules.backend),f.resourceStore,f,this.options),f.backendConnector.on("*",function(h){for(var p=arguments.length,m=new Array(p>1?p-1:0),_=1;_1?p-1:0),_=1;_{h.init&&h.init(this)})}if(this.format=this.options.interpolation.format,r||(r=gv),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const c=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);c.length>0&&c[0]!=="dev"&&(this.options.lng=c[0])}!this.services.languageDetector&&!this.options.lng&&this.logger.warn("init: no languageDetector is used and no lng is defined"),["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach(c=>{this[c]=function(){return t.store[c](...arguments)}}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(c=>{this[c]=function(){return t.store[c](...arguments),t}});const l=qp(),u=()=>{const c=(d,f)=>{this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn("init: i18next is already initialized. You should call init just once!"),this.isInitialized=!0,this.options.isClone||this.logger.log("initialized",this.options),this.emit("initialized",this.options),l.resolve(f),r(d,f)};if(this.languages&&this.options.compatibilityAPI!=="v1"&&!this.isInitialized)return c(null,this.t.bind(this));this.changeLanguage(this.options.lng,c)};return this.options.resources||!this.options.initImmediate?u():setTimeout(u,0),l}loadResources(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:gv;const i=typeof t=="string"?t:this.language;if(typeof t=="function"&&(r=t),!this.options.resources||this.options.partialBundledLanguages){if(i&&i.toLowerCase()==="cimode")return r();const o=[],a=s=>{if(!s)return;this.services.languageUtils.toResolveHierarchy(s).forEach(u=>{o.indexOf(u)<0&&o.push(u)})};i?a(i):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(l=>a(l)),this.options.preload&&this.options.preload.forEach(s=>a(s)),this.services.backendConnector.load(o,this.options.ns,s=>{!s&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),r(s)})}else r(null)}reloadResources(t,n,r){const i=qp();return t||(t=this.languages),n||(n=this.options.ns),r||(r=gv),this.services.backendConnector.reload(t,n,o=>{i.resolve(),r(o)}),i}use(t){if(!t)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!t.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return t.type==="backend"&&(this.modules.backend=t),(t.type==="logger"||t.log&&t.warn&&t.error)&&(this.modules.logger=t),t.type==="languageDetector"&&(this.modules.languageDetector=t),t.type==="i18nFormat"&&(this.modules.i18nFormat=t),t.type==="postProcessor"&&NB.addPostProcessor(t),t.type==="formatter"&&(this.modules.formatter=t),t.type==="3rdParty"&&this.modules.external.push(t),this}setResolvedLanguage(t){if(!(!t||!this.languages)&&!(["cimode","dev"].indexOf(t)>-1))for(let n=0;n-1)&&this.store.hasLanguageSomeTranslations(r)){this.resolvedLanguage=r;break}}}changeLanguage(t,n){var r=this;this.isLanguageChangingTo=t;const i=qp();this.emit("languageChanging",t);const o=l=>{this.language=l,this.languages=this.services.languageUtils.toResolveHierarchy(l),this.resolvedLanguage=void 0,this.setResolvedLanguage(l)},a=(l,u)=>{u?(o(u),this.translator.changeLanguage(u),this.isLanguageChangingTo=void 0,this.emit("languageChanged",u),this.logger.log("languageChanged",u)):this.isLanguageChangingTo=void 0,i.resolve(function(){return r.t(...arguments)}),n&&n(l,function(){return r.t(...arguments)})},s=l=>{!t&&!l&&this.services.languageDetector&&(l=[]);const u=typeof l=="string"?l:this.services.languageUtils.getBestMatchFromCodes(l);u&&(this.language||o(u),this.translator.language||this.translator.changeLanguage(u),this.services.languageDetector&&this.services.languageDetector.cacheUserLanguage&&this.services.languageDetector.cacheUserLanguage(u)),this.loadResources(u,c=>{a(c,u)})};return!t&&this.services.languageDetector&&!this.services.languageDetector.async?s(this.services.languageDetector.detect()):!t&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(s):this.services.languageDetector.detect(s):s(t),i}getFixedT(t,n,r){var i=this;const o=function(a,s){let l;if(typeof s!="object"){for(var u=arguments.length,c=new Array(u>2?u-2:0),d=2;d`${l.keyPrefix}${f}${p}`):h=l.keyPrefix?`${l.keyPrefix}${f}${a}`:a,i.t(h,l)};return typeof t=="string"?o.lng=t:o.lngs=t,o.ns=n,o.keyPrefix=r,o}t(){return this.translator&&this.translator.translate(...arguments)}exists(){return this.translator&&this.translator.exists(...arguments)}setDefaultNamespace(t){this.options.defaultNS=t}hasLoadedNamespace(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;const r=n.lng||this.resolvedLanguage||this.languages[0],i=this.options?this.options.fallbackLng:!1,o=this.languages[this.languages.length-1];if(r.toLowerCase()==="cimode")return!0;const a=(s,l)=>{const u=this.services.backendConnector.state[`${s}|${l}`];return u===-1||u===2};if(n.precheck){const s=n.precheck(this,a);if(s!==void 0)return s}return!!(this.hasResourceBundle(r,t)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||a(r,t)&&(!i||a(o,t)))}loadNamespaces(t,n){const r=qp();return this.options.ns?(typeof t=="string"&&(t=[t]),t.forEach(i=>{this.options.ns.indexOf(i)<0&&this.options.ns.push(i)}),this.loadResources(i=>{r.resolve(),n&&n(i)}),r):(n&&n(),Promise.resolve())}loadLanguages(t,n){const r=qp();typeof t=="string"&&(t=[t]);const i=this.options.preload||[],o=t.filter(a=>i.indexOf(a)<0);return o.length?(this.options.preload=i.concat(o),this.loadResources(a=>{r.resolve(),n&&n(a)}),r):(n&&n(),Promise.resolve())}dir(t){if(t||(t=this.resolvedLanguage||(this.languages&&this.languages.length>0?this.languages[0]:this.language)),!t)return"rtl";const n=["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"],r=this.services&&this.services.languageUtils||new sI(cI());return n.indexOf(r.getLanguagePartFromCode(t))>-1||t.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;return new Km(t,n)}cloneInstance(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:gv;const r=t.forkResourceStore;r&&delete t.forkResourceStore;const i={...this.options,...t,isClone:!0},o=new Km(i);return(t.debug!==void 0||t.prefix!==void 0)&&(o.logger=o.logger.clone(t)),["store","services","language"].forEach(s=>{o[s]=this[s]}),o.services={...this.services},o.services.utils={hasLoadedNamespace:o.hasLoadedNamespace.bind(o)},r&&(o.store=new oI(this.store.data,i),o.services.resourceStore=o.store),o.translator=new o_(o.services,i),o.translator.on("*",function(s){for(var l=arguments.length,u=new Array(l>1?l-1:0),c=1;c$B.safeParse(e).success||Hle.safeParse(e).success;z.enum(["connection","direct","any"]);const DB=z.object({id:z.string().trim().min(1),name:z.string().trim().min(1),type:$B}),Wle=DB.extend({fieldKind:z.literal("output")}),lt=DB.extend({fieldKind:z.literal("input"),label:z.string()}),Jl=z.object({model_name:z.string().trim().min(1),base_model:xc}),yp=z.object({image_name:z.string().trim().min(1)}),Kle=z.object({board_id:z.string().trim().min(1)}),a_=z.object({latents_name:z.string().trim().min(1),seed:z.number().int().optional()}),s_=z.object({conditioning_name:z.string().trim().min(1)}),Qle=z.object({mask_name:z.string().trim().min(1),masked_latents_name:z.string().trim().min(1).optional()}),Xle=lt.extend({type:z.literal("integer"),value:z.number().int().optional()}),Yle=lt.extend({type:z.literal("IntegerCollection"),value:z.array(z.number().int()).optional()}),Zle=lt.extend({type:z.literal("IntegerPolymorphic"),value:z.number().int().optional()}),Jle=lt.extend({type:z.literal("float"),value:z.number().optional()}),eue=lt.extend({type:z.literal("FloatCollection"),value:z.array(z.number()).optional()}),tue=lt.extend({type:z.literal("FloatPolymorphic"),value:z.number().optional()}),nue=lt.extend({type:z.literal("string"),value:z.string().optional()}),rue=lt.extend({type:z.literal("StringCollection"),value:z.array(z.string()).optional()}),iue=lt.extend({type:z.literal("StringPolymorphic"),value:z.string().optional()}),oue=lt.extend({type:z.literal("boolean"),value:z.boolean().optional()}),aue=lt.extend({type:z.literal("BooleanCollection"),value:z.array(z.boolean()).optional()}),sue=lt.extend({type:z.literal("BooleanPolymorphic"),value:z.boolean().optional()}),lue=lt.extend({type:z.literal("enum"),value:z.string().optional()}),uue=lt.extend({type:z.literal("LatentsField"),value:a_.optional()}),cue=lt.extend({type:z.literal("LatentsCollection"),value:z.array(a_).optional()}),due=lt.extend({type:z.literal("LatentsPolymorphic"),value:z.union([a_,z.array(a_)]).optional()}),fue=lt.extend({type:z.literal("DenoiseMaskField"),value:Qle.optional()}),hue=lt.extend({type:z.literal("ConditioningField"),value:s_.optional()}),pue=lt.extend({type:z.literal("ConditioningCollection"),value:z.array(s_).optional()}),gue=lt.extend({type:z.literal("ConditioningPolymorphic"),value:z.union([s_,z.array(s_)]).optional()}),mue=Jl,Qm=z.object({image:yp,control_model:mue,control_weight:z.union([z.number(),z.array(z.number())]).optional(),begin_step_percent:z.number().optional(),end_step_percent:z.number().optional(),control_mode:z.enum(["balanced","more_prompt","more_control","unbalanced"]).optional(),resize_mode:z.enum(["just_resize","crop_resize","fill_resize","just_resize_simple"]).optional()}),yue=lt.extend({type:z.literal("ControlField"),value:Qm.optional()}),vue=lt.extend({type:z.literal("ControlPolymorphic"),value:z.union([Qm,z.array(Qm)]).optional()}),bue=lt.extend({type:z.literal("ControlCollection"),value:z.array(Qm).optional()}),LB=Jl,FB=z.object({image:yp,ip_adapter_model:LB,weight:z.number(),begin_step_percent:z.number().optional(),end_step_percent:z.number().optional()}),_ue=lt.extend({type:z.literal("IPAdapterField"),value:FB.optional()}),Sue=Jl,l_=z.object({image:yp,t2i_adapter_model:Sue,weight:z.union([z.number(),z.array(z.number())]).optional(),begin_step_percent:z.number().optional(),end_step_percent:z.number().optional(),resize_mode:z.enum(["just_resize","crop_resize","fill_resize","just_resize_simple"]).optional()}),xue=lt.extend({type:z.literal("T2IAdapterField"),value:l_.optional()}),wue=lt.extend({type:z.literal("T2IAdapterPolymorphic"),value:z.union([l_,z.array(l_)]).optional()}),Cue=lt.extend({type:z.literal("T2IAdapterCollection"),value:z.array(l_).optional()}),Eue=z.enum(["onnx","main","vae","lora","controlnet","embedding"]),Tue=z.enum(["unet","text_encoder","text_encoder_2","tokenizer","tokenizer_2","vae","vae_decoder","vae_encoder","scheduler","safety_checker"]),Wh=Jl.extend({model_type:Eue,submodel:Tue.optional()}),BB=Wh.extend({weight:z.number().optional()}),kue=z.object({unet:Wh,scheduler:Wh,loras:z.array(BB)}),Aue=lt.extend({type:z.literal("UNetField"),value:kue.optional()}),Pue=z.object({tokenizer:Wh,text_encoder:Wh,skipped_layers:z.number(),loras:z.array(BB)}),Iue=lt.extend({type:z.literal("ClipField"),value:Pue.optional()}),Rue=z.object({vae:Wh}),Oue=lt.extend({type:z.literal("VaeField"),value:Rue.optional()}),Mue=lt.extend({type:z.literal("ImageField"),value:yp.optional()}),Nue=lt.extend({type:z.literal("BoardField"),value:Kle.optional()}),$ue=lt.extend({type:z.literal("ImagePolymorphic"),value:yp.optional()}),Due=lt.extend({type:z.literal("ImageCollection"),value:z.array(yp).optional()}),Lue=lt.extend({type:z.literal("MainModelField"),value:uy.optional()}),Fue=lt.extend({type:z.literal("SDXLMainModelField"),value:uy.optional()}),Bue=lt.extend({type:z.literal("SDXLRefinerModelField"),value:uy.optional()}),zB=Jl,zue=lt.extend({type:z.literal("VaeModelField"),value:zB.optional()}),jB=Jl,jue=lt.extend({type:z.literal("LoRAModelField"),value:jB.optional()}),Uue=Jl,Vue=lt.extend({type:z.literal("ControlNetModelField"),value:Uue.optional()}),Gue=Jl,que=lt.extend({type:z.literal("IPAdapterModelField"),value:Gue.optional()}),Hue=Jl,Wue=lt.extend({type:z.literal("T2IAdapterModelField"),value:Hue.optional()}),Kue=lt.extend({type:z.literal("Collection"),value:z.array(z.any()).optional()}),Que=lt.extend({type:z.literal("CollectionItem"),value:z.any().optional()}),u_=z.object({r:z.number().int().min(0).max(255),g:z.number().int().min(0).max(255),b:z.number().int().min(0).max(255),a:z.number().int().min(0).max(255)}),Xue=lt.extend({type:z.literal("ColorField"),value:u_.optional()}),Yue=lt.extend({type:z.literal("ColorCollection"),value:z.array(u_).optional()}),Zue=lt.extend({type:z.literal("ColorPolymorphic"),value:z.union([u_,z.array(u_)]).optional()}),Jue=lt.extend({type:z.literal("Scheduler"),value:SB.optional()}),ece=z.discriminatedUnion("type",[Nue,aue,oue,sue,Iue,Kue,Que,Xue,Yue,Zue,hue,pue,gue,yue,Vue,bue,vue,fue,lue,eue,Jle,tue,Due,$ue,Mue,Yle,Zle,Xle,_ue,que,uue,cue,due,jue,Lue,Jue,Fue,Bue,rue,iue,nue,xue,Wue,Cue,wue,Aue,Oue,zue]),SGe=e=>!!(e&&e.fieldKind==="input"),xGe=e=>!!(e&&e.fieldKind==="input"),tce=e=>!!(e&&!("$ref"in e)),hI=e=>!!(e&&!("$ref"in e)&&e.type==="array"),mv=e=>!!(e&&!("$ref"in e)&&e.type!=="array"),Hp=e=>!!(e&&"$ref"in e),nce=e=>"class"in e&&e.class==="invocation",rce=e=>"class"in e&&e.class==="output",pI=e=>!("$ref"in e),ice=z.object({lora:jB.deepPartial(),weight:z.number()}),oce=Qm.deepPartial(),ace=FB.deepPartial(),UB=z.object({app_version:z.string().nullish().catch(null),generation_mode:z.string().nullish().catch(null),created_by:z.string().nullish().catch(null),positive_prompt:z.string().nullish().catch(null),negative_prompt:z.string().nullish().catch(null),width:z.number().int().nullish().catch(null),height:z.number().int().nullish().catch(null),seed:z.number().int().nullish().catch(null),rand_device:z.string().nullish().catch(null),cfg_scale:z.number().nullish().catch(null),steps:z.number().int().nullish().catch(null),scheduler:z.string().nullish().catch(null),clip_skip:z.number().int().nullish().catch(null),model:z.union([XS.deepPartial(),xB.deepPartial()]).nullish().catch(null),controlnets:z.array(oce).nullish().catch(null),ipAdapters:z.array(ace).nullish().catch(null),loras:z.array(ice).nullish().catch(null),vae:zB.nullish().catch(null),strength:z.number().nullish().catch(null),init_image:z.string().nullish().catch(null),positive_style_prompt:z.string().nullish().catch(null),negative_style_prompt:z.string().nullish().catch(null),refiner_model:pk.deepPartial().nullish().catch(null),refiner_cfg_scale:z.number().nullish().catch(null),refiner_steps:z.number().int().nullish().catch(null),refiner_scheduler:z.string().nullish().catch(null),refiner_positive_aesthetic_score:z.number().nullish().catch(null),refiner_negative_aesthetic_score:z.number().nullish().catch(null),refiner_start:z.number().nullish().catch(null)}).passthrough(),bk=z.string().refine(e=>{const[t,n,r]=e.split(".");return t!==void 0&&Number.isInteger(Number(t))&&n!==void 0&&Number.isInteger(Number(n))&&r!==void 0&&Number.isInteger(Number(r))});bk.transform(e=>{const[t,n,r]=e.split(".");return{major:Number(t),minor:Number(n),patch:Number(r)}});const gI=z.object({id:z.string().trim().min(1),type:z.string().trim().min(1),inputs:z.record(ece),outputs:z.record(Wle),label:z.string(),isOpen:z.boolean(),notes:z.string(),embedWorkflow:z.boolean(),isIntermediate:z.boolean(),useCache:z.boolean().optional(),version:bk.optional()}),sce=z.preprocess(e=>{var t;try{const n=gI.parse(e);if(!Aoe(n,"useCache")){const r=(t=OB.get())==null?void 0:t.getState().nodes.nodeTemplates,i=r==null?void 0:r[n.type];let o=!0;i&&(o=i.useCache),Object.assign(n,{useCache:o})}return n}catch{return e}},gI.extend({useCache:z.boolean()})),lce=z.object({id:z.string().trim().min(1),type:z.literal("notes"),label:z.string(),isOpen:z.boolean(),notes:z.string()}),VB=z.object({x:z.number(),y:z.number()}).default({x:0,y:0}),c_=z.number().gt(0).nullish(),GB=z.object({id:z.string().trim().min(1),type:z.literal("invocation"),data:sce,width:c_,height:c_,position:VB}),iE=e=>GB.safeParse(e).success,uce=z.object({id:z.string().trim().min(1),type:z.literal("notes"),data:lce,width:c_,height:c_,position:VB}),qB=z.discriminatedUnion("type",[GB,uce]),cce=z.object({source:z.string().trim().min(1),sourceHandle:z.string().trim().min(1),target:z.string().trim().min(1),targetHandle:z.string().trim().min(1),id:z.string().trim().min(1),type:z.literal("default")}),dce=z.object({source:z.string().trim().min(1),target:z.string().trim().min(1),id:z.string().trim().min(1),type:z.literal("collapsed")}),HB=z.union([cce,dce]),fce=z.object({nodeId:z.string().trim().min(1),fieldName:z.string().trim().min(1)}),hce="1.0.0",WB=z.object({name:z.string().default(""),author:z.string().default(""),description:z.string().default(""),version:z.string().default(""),contact:z.string().default(""),tags:z.string().default(""),notes:z.string().default(""),nodes:z.array(qB).default([]),edges:z.array(HB).default([]),exposedFields:z.array(fce).default([]),meta:z.object({version:bk}).default({version:hce})});WB.transform(e=>{const{nodes:t,edges:n}=e,r=[],i=t.filter(iE),o=hk(i,"id");return n.forEach((a,s)=>{const l=o[a.source],u=o[a.target],c=[];if(l?a.type==="default"&&!(a.sourceHandle in l.data.outputs)&&c.push(`${be.t("nodes.outputField")}"${a.source}.${a.sourceHandle}" ${be.t("nodes.doesNotExist")}`):c.push(`${be.t("nodes.outputNode")} ${a.source} ${be.t("nodes.doesNotExist")}`),u?a.type==="default"&&!(a.targetHandle in u.data.inputs)&&c.push(`${be.t("nodes.inputField")} "${a.target}.${a.targetHandle}" ${be.t("nodes.doesNotExist")}`):c.push(`${be.t("nodes.inputNode")} ${a.target} ${be.t("nodes.doesNotExist")}`),c.length){delete n[s];const d=a.type==="default"?a.sourceHandle:a.source,f=a.type==="default"?a.targetHandle:a.target;r.push({message:`${be.t("nodes.edge")} "${d} -> ${f}" ${be.t("nodes.skipped")}`,issues:c,data:a})}}),{workflow:e,warnings:r}});const jr=e=>!!(e&&e.type==="invocation"),wGe=e=>!!(e&&!["notes","current_image"].includes(e.type)),mI=e=>!!(e&&e.type==="notes");var Wc=(e=>(e[e.PENDING=0]="PENDING",e[e.IN_PROGRESS=1]="IN_PROGRESS",e[e.COMPLETED=2]="COMPLETED",e[e.FAILED=3]="FAILED",e))(Wc||{});/*! pako 2.1.0 https://github.com/nodeca/pako @license (MIT AND Zlib) */const pce=4,yI=0,vI=1,gce=2;function vp(e){let t=e.length;for(;--t>=0;)e[t]=0}const mce=0,KB=1,yce=2,vce=3,bce=258,_k=29,cy=256,Xm=cy+1+_k,hh=30,Sk=19,QB=2*Xm+1,nd=15,aC=16,_ce=7,xk=256,XB=16,YB=17,ZB=18,oE=new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]),N1=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]),Sce=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),JB=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),xce=512,bl=new Array((Xm+2)*2);vp(bl);const Hg=new Array(hh*2);vp(Hg);const Ym=new Array(xce);vp(Ym);const Zm=new Array(bce-vce+1);vp(Zm);const wk=new Array(_k);vp(wk);const d_=new Array(hh);vp(d_);function sC(e,t,n,r,i){this.static_tree=e,this.extra_bits=t,this.extra_base=n,this.elems=r,this.max_length=i,this.has_stree=e&&e.length}let ez,tz,nz;function lC(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}const rz=e=>e<256?Ym[e]:Ym[256+(e>>>7)],Jm=(e,t)=>{e.pending_buf[e.pending++]=t&255,e.pending_buf[e.pending++]=t>>>8&255},wo=(e,t,n)=>{e.bi_valid>aC-n?(e.bi_buf|=t<>aC-e.bi_valid,e.bi_valid+=n-aC):(e.bi_buf|=t<{wo(e,n[t*2],n[t*2+1])},iz=(e,t)=>{let n=0;do n|=e&1,e>>>=1,n<<=1;while(--t>0);return n>>>1},wce=e=>{e.bi_valid===16?(Jm(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):e.bi_valid>=8&&(e.pending_buf[e.pending++]=e.bi_buf&255,e.bi_buf>>=8,e.bi_valid-=8)},Cce=(e,t)=>{const n=t.dyn_tree,r=t.max_code,i=t.stat_desc.static_tree,o=t.stat_desc.has_stree,a=t.stat_desc.extra_bits,s=t.stat_desc.extra_base,l=t.stat_desc.max_length;let u,c,d,f,h,p,m=0;for(f=0;f<=nd;f++)e.bl_count[f]=0;for(n[e.heap[e.heap_max]*2+1]=0,u=e.heap_max+1;ul&&(f=l,m++),n[c*2+1]=f,!(c>r)&&(e.bl_count[f]++,h=0,c>=s&&(h=a[c-s]),p=n[c*2],e.opt_len+=p*(f+h),o&&(e.static_len+=p*(i[c*2+1]+h)));if(m!==0){do{for(f=l-1;e.bl_count[f]===0;)f--;e.bl_count[f]--,e.bl_count[f+1]+=2,e.bl_count[l]--,m-=2}while(m>0);for(f=l;f!==0;f--)for(c=e.bl_count[f];c!==0;)d=e.heap[--u],!(d>r)&&(n[d*2+1]!==f&&(e.opt_len+=(f-n[d*2+1])*n[d*2],n[d*2+1]=f),c--)}},oz=(e,t,n)=>{const r=new Array(nd+1);let i=0,o,a;for(o=1;o<=nd;o++)i=i+n[o-1]<<1,r[o]=i;for(a=0;a<=t;a++){let s=e[a*2+1];s!==0&&(e[a*2]=iz(r[s]++,s))}},Ece=()=>{let e,t,n,r,i;const o=new Array(nd+1);for(n=0,r=0;r<_k-1;r++)for(wk[r]=n,e=0;e<1<>=7;r{let t;for(t=0;t{e.bi_valid>8?Jm(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0},bI=(e,t,n,r)=>{const i=t*2,o=n*2;return e[i]{const r=e.heap[n];let i=n<<1;for(;i<=e.heap_len&&(i{let r,i,o=0,a,s;if(e.sym_next!==0)do r=e.pending_buf[e.sym_buf+o++]&255,r+=(e.pending_buf[e.sym_buf+o++]&255)<<8,i=e.pending_buf[e.sym_buf+o++],r===0?Is(e,i,t):(a=Zm[i],Is(e,a+cy+1,t),s=oE[a],s!==0&&(i-=wk[a],wo(e,i,s)),r--,a=rz(r),Is(e,a,n),s=N1[a],s!==0&&(r-=d_[a],wo(e,r,s)));while(o{const n=t.dyn_tree,r=t.stat_desc.static_tree,i=t.stat_desc.has_stree,o=t.stat_desc.elems;let a,s,l=-1,u;for(e.heap_len=0,e.heap_max=QB,a=0;a>1;a>=1;a--)uC(e,n,a);u=o;do a=e.heap[1],e.heap[1]=e.heap[e.heap_len--],uC(e,n,1),s=e.heap[1],e.heap[--e.heap_max]=a,e.heap[--e.heap_max]=s,n[u*2]=n[a*2]+n[s*2],e.depth[u]=(e.depth[a]>=e.depth[s]?e.depth[a]:e.depth[s])+1,n[a*2+1]=n[s*2+1]=u,e.heap[1]=u++,uC(e,n,1);while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],Cce(e,t),oz(n,l,e.bl_count)},SI=(e,t,n)=>{let r,i=-1,o,a=t[0*2+1],s=0,l=7,u=4;for(a===0&&(l=138,u=3),t[(n+1)*2+1]=65535,r=0;r<=n;r++)o=a,a=t[(r+1)*2+1],!(++s{let r,i=-1,o,a=t[0*2+1],s=0,l=7,u=4;for(a===0&&(l=138,u=3),r=0;r<=n;r++)if(o=a,a=t[(r+1)*2+1],!(++s{let t;for(SI(e,e.dyn_ltree,e.l_desc.max_code),SI(e,e.dyn_dtree,e.d_desc.max_code),aE(e,e.bl_desc),t=Sk-1;t>=3&&e.bl_tree[JB[t]*2+1]===0;t--);return e.opt_len+=3*(t+1)+5+5+4,t},kce=(e,t,n,r)=>{let i;for(wo(e,t-257,5),wo(e,n-1,5),wo(e,r-4,4),i=0;i{let t=4093624447,n;for(n=0;n<=31;n++,t>>>=1)if(t&1&&e.dyn_ltree[n*2]!==0)return yI;if(e.dyn_ltree[9*2]!==0||e.dyn_ltree[10*2]!==0||e.dyn_ltree[13*2]!==0)return vI;for(n=32;n{wI||(Ece(),wI=!0),e.l_desc=new lC(e.dyn_ltree,ez),e.d_desc=new lC(e.dyn_dtree,tz),e.bl_desc=new lC(e.bl_tree,nz),e.bi_buf=0,e.bi_valid=0,az(e)},lz=(e,t,n,r)=>{wo(e,(mce<<1)+(r?1:0),3),sz(e),Jm(e,n),Jm(e,~n),n&&e.pending_buf.set(e.window.subarray(t,t+n),e.pending),e.pending+=n},Ice=e=>{wo(e,KB<<1,3),Is(e,xk,bl),wce(e)},Rce=(e,t,n,r)=>{let i,o,a=0;e.level>0?(e.strm.data_type===gce&&(e.strm.data_type=Ace(e)),aE(e,e.l_desc),aE(e,e.d_desc),a=Tce(e),i=e.opt_len+3+7>>>3,o=e.static_len+3+7>>>3,o<=i&&(i=o)):i=o=n+5,n+4<=i&&t!==-1?lz(e,t,n,r):e.strategy===pce||o===i?(wo(e,(KB<<1)+(r?1:0),3),_I(e,bl,Hg)):(wo(e,(yce<<1)+(r?1:0),3),kce(e,e.l_desc.max_code+1,e.d_desc.max_code+1,a+1),_I(e,e.dyn_ltree,e.dyn_dtree)),az(e),r&&sz(e)},Oce=(e,t,n)=>(e.pending_buf[e.sym_buf+e.sym_next++]=t,e.pending_buf[e.sym_buf+e.sym_next++]=t>>8,e.pending_buf[e.sym_buf+e.sym_next++]=n,t===0?e.dyn_ltree[n*2]++:(e.matches++,t--,e.dyn_ltree[(Zm[n]+cy+1)*2]++,e.dyn_dtree[rz(t)*2]++),e.sym_next===e.sym_end);var Mce=Pce,Nce=lz,$ce=Rce,Dce=Oce,Lce=Ice,Fce={_tr_init:Mce,_tr_stored_block:Nce,_tr_flush_block:$ce,_tr_tally:Dce,_tr_align:Lce};const Bce=(e,t,n,r)=>{let i=e&65535|0,o=e>>>16&65535|0,a=0;for(;n!==0;){a=n>2e3?2e3:n,n-=a;do i=i+t[r++]|0,o=o+i|0;while(--a);i%=65521,o%=65521}return i|o<<16|0};var e0=Bce;const zce=()=>{let e,t=[];for(var n=0;n<256;n++){e=n;for(var r=0;r<8;r++)e=e&1?3988292384^e>>>1:e>>>1;t[n]=e}return t},jce=new Uint32Array(zce()),Uce=(e,t,n,r)=>{const i=jce,o=r+n;e^=-1;for(let a=r;a>>8^i[(e^t[a])&255];return e^-1};var ai=Uce,Kh={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},dy={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8};const{_tr_init:Vce,_tr_stored_block:sE,_tr_flush_block:Gce,_tr_tally:Wu,_tr_align:qce}=Fce,{Z_NO_FLUSH:Ku,Z_PARTIAL_FLUSH:Hce,Z_FULL_FLUSH:Wce,Z_FINISH:ya,Z_BLOCK:CI,Z_OK:Ei,Z_STREAM_END:EI,Z_STREAM_ERROR:js,Z_DATA_ERROR:Kce,Z_BUF_ERROR:cC,Z_DEFAULT_COMPRESSION:Qce,Z_FILTERED:Xce,Z_HUFFMAN_ONLY:yv,Z_RLE:Yce,Z_FIXED:Zce,Z_DEFAULT_STRATEGY:Jce,Z_UNKNOWN:ede,Z_DEFLATED:JS}=dy,tde=9,nde=15,rde=8,ide=29,ode=256,lE=ode+1+ide,ade=30,sde=19,lde=2*lE+1,ude=15,Bt=3,Du=258,Us=Du+Bt+1,cde=32,Qh=42,Ck=57,uE=69,cE=73,dE=91,fE=103,rd=113,bg=666,to=1,bp=2,Rd=3,_p=4,dde=3,id=(e,t)=>(e.msg=Kh[t],t),TI=e=>e*2-(e>4?9:0),Tu=e=>{let t=e.length;for(;--t>=0;)e[t]=0},fde=e=>{let t,n,r,i=e.w_size;t=e.hash_size,r=t;do n=e.head[--r],e.head[r]=n>=i?n-i:0;while(--t);t=i,r=t;do n=e.prev[--r],e.prev[r]=n>=i?n-i:0;while(--t)};let hde=(e,t,n)=>(t<{const t=e.state;let n=t.pending;n>e.avail_out&&(n=e.avail_out),n!==0&&(e.output.set(t.pending_buf.subarray(t.pending_out,t.pending_out+n),e.next_out),e.next_out+=n,t.pending_out+=n,e.total_out+=n,e.avail_out-=n,t.pending-=n,t.pending===0&&(t.pending_out=0))},Ho=(e,t)=>{Gce(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,Fo(e.strm)},on=(e,t)=>{e.pending_buf[e.pending++]=t},Wp=(e,t)=>{e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=t&255},hE=(e,t,n,r)=>{let i=e.avail_in;return i>r&&(i=r),i===0?0:(e.avail_in-=i,t.set(e.input.subarray(e.next_in,e.next_in+i),n),e.state.wrap===1?e.adler=e0(e.adler,t,i,n):e.state.wrap===2&&(e.adler=ai(e.adler,t,i,n)),e.next_in+=i,e.total_in+=i,i)},uz=(e,t)=>{let n=e.max_chain_length,r=e.strstart,i,o,a=e.prev_length,s=e.nice_match;const l=e.strstart>e.w_size-Us?e.strstart-(e.w_size-Us):0,u=e.window,c=e.w_mask,d=e.prev,f=e.strstart+Du;let h=u[r+a-1],p=u[r+a];e.prev_length>=e.good_match&&(n>>=2),s>e.lookahead&&(s=e.lookahead);do if(i=t,!(u[i+a]!==p||u[i+a-1]!==h||u[i]!==u[r]||u[++i]!==u[r+1])){r+=2,i++;do;while(u[++r]===u[++i]&&u[++r]===u[++i]&&u[++r]===u[++i]&&u[++r]===u[++i]&&u[++r]===u[++i]&&u[++r]===u[++i]&&u[++r]===u[++i]&&u[++r]===u[++i]&&ra){if(e.match_start=t,a=o,o>=s)break;h=u[r+a-1],p=u[r+a]}}while((t=d[t&c])>l&&--n!==0);return a<=e.lookahead?a:e.lookahead},Xh=e=>{const t=e.w_size;let n,r,i;do{if(r=e.window_size-e.lookahead-e.strstart,e.strstart>=t+(t-Us)&&(e.window.set(e.window.subarray(t,t+t-r),0),e.match_start-=t,e.strstart-=t,e.block_start-=t,e.insert>e.strstart&&(e.insert=e.strstart),fde(e),r+=t),e.strm.avail_in===0)break;if(n=hE(e.strm,e.window,e.strstart+e.lookahead,r),e.lookahead+=n,e.lookahead+e.insert>=Bt)for(i=e.strstart-e.insert,e.ins_h=e.window[i],e.ins_h=Qu(e,e.ins_h,e.window[i+1]);e.insert&&(e.ins_h=Qu(e,e.ins_h,e.window[i+Bt-1]),e.prev[i&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=i,i++,e.insert--,!(e.lookahead+e.insert{let n=e.pending_buf_size-5>e.w_size?e.w_size:e.pending_buf_size-5,r,i,o,a=0,s=e.strm.avail_in;do{if(r=65535,o=e.bi_valid+42>>3,e.strm.avail_outi+e.strm.avail_in&&(r=i+e.strm.avail_in),r>o&&(r=o),r>8,e.pending_buf[e.pending-2]=~r,e.pending_buf[e.pending-1]=~r>>8,Fo(e.strm),i&&(i>r&&(i=r),e.strm.output.set(e.window.subarray(e.block_start,e.block_start+i),e.strm.next_out),e.strm.next_out+=i,e.strm.avail_out-=i,e.strm.total_out+=i,e.block_start+=i,r-=i),r&&(hE(e.strm,e.strm.output,e.strm.next_out,r),e.strm.next_out+=r,e.strm.avail_out-=r,e.strm.total_out+=r)}while(a===0);return s-=e.strm.avail_in,s&&(s>=e.w_size?(e.matches=2,e.window.set(e.strm.input.subarray(e.strm.next_in-e.w_size,e.strm.next_in),0),e.strstart=e.w_size,e.insert=e.strstart):(e.window_size-e.strstart<=s&&(e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,e.insert>e.strstart&&(e.insert=e.strstart)),e.window.set(e.strm.input.subarray(e.strm.next_in-s,e.strm.next_in),e.strstart),e.strstart+=s,e.insert+=s>e.w_size-e.insert?e.w_size-e.insert:s),e.block_start=e.strstart),e.high_watero&&e.block_start>=e.w_size&&(e.block_start-=e.w_size,e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,o+=e.w_size,e.insert>e.strstart&&(e.insert=e.strstart)),o>e.strm.avail_in&&(o=e.strm.avail_in),o&&(hE(e.strm,e.window,e.strstart,o),e.strstart+=o,e.insert+=o>e.w_size-e.insert?e.w_size-e.insert:o),e.high_water>3,o=e.pending_buf_size-o>65535?65535:e.pending_buf_size-o,n=o>e.w_size?e.w_size:o,i=e.strstart-e.block_start,(i>=n||(i||t===ya)&&t!==Ku&&e.strm.avail_in===0&&i<=o)&&(r=i>o?o:i,a=t===ya&&e.strm.avail_in===0&&r===i?1:0,sE(e,e.block_start,r,a),e.block_start+=r,Fo(e.strm)),a?Rd:to)},dC=(e,t)=>{let n,r;for(;;){if(e.lookahead=Bt&&(e.ins_h=Qu(e,e.ins_h,e.window[e.strstart+Bt-1]),n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),n!==0&&e.strstart-n<=e.w_size-Us&&(e.match_length=uz(e,n)),e.match_length>=Bt)if(r=Wu(e,e.strstart-e.match_start,e.match_length-Bt),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=Bt){e.match_length--;do e.strstart++,e.ins_h=Qu(e,e.ins_h,e.window[e.strstart+Bt-1]),n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart;while(--e.match_length!==0);e.strstart++}else e.strstart+=e.match_length,e.match_length=0,e.ins_h=e.window[e.strstart],e.ins_h=Qu(e,e.ins_h,e.window[e.strstart+1]);else r=Wu(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(r&&(Ho(e,!1),e.strm.avail_out===0))return to}return e.insert=e.strstart{let n,r,i;for(;;){if(e.lookahead=Bt&&(e.ins_h=Qu(e,e.ins_h,e.window[e.strstart+Bt-1]),n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),e.prev_length=e.match_length,e.prev_match=e.match_start,e.match_length=Bt-1,n!==0&&e.prev_length4096)&&(e.match_length=Bt-1)),e.prev_length>=Bt&&e.match_length<=e.prev_length){i=e.strstart+e.lookahead-Bt,r=Wu(e,e.strstart-1-e.prev_match,e.prev_length-Bt),e.lookahead-=e.prev_length-1,e.prev_length-=2;do++e.strstart<=i&&(e.ins_h=Qu(e,e.ins_h,e.window[e.strstart+Bt-1]),n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart);while(--e.prev_length!==0);if(e.match_available=0,e.match_length=Bt-1,e.strstart++,r&&(Ho(e,!1),e.strm.avail_out===0))return to}else if(e.match_available){if(r=Wu(e,0,e.window[e.strstart-1]),r&&Ho(e,!1),e.strstart++,e.lookahead--,e.strm.avail_out===0)return to}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&(r=Wu(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart{let n,r,i,o;const a=e.window;for(;;){if(e.lookahead<=Du){if(Xh(e),e.lookahead<=Du&&t===Ku)return to;if(e.lookahead===0)break}if(e.match_length=0,e.lookahead>=Bt&&e.strstart>0&&(i=e.strstart-1,r=a[i],r===a[++i]&&r===a[++i]&&r===a[++i])){o=e.strstart+Du;do;while(r===a[++i]&&r===a[++i]&&r===a[++i]&&r===a[++i]&&r===a[++i]&&r===a[++i]&&r===a[++i]&&r===a[++i]&&ie.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=Bt?(n=Wu(e,1,e.match_length-Bt),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(n=Wu(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),n&&(Ho(e,!1),e.strm.avail_out===0))return to}return e.insert=0,t===ya?(Ho(e,!0),e.strm.avail_out===0?Rd:_p):e.sym_next&&(Ho(e,!1),e.strm.avail_out===0)?to:bp},gde=(e,t)=>{let n;for(;;){if(e.lookahead===0&&(Xh(e),e.lookahead===0)){if(t===Ku)return to;break}if(e.match_length=0,n=Wu(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,n&&(Ho(e,!1),e.strm.avail_out===0))return to}return e.insert=0,t===ya?(Ho(e,!0),e.strm.avail_out===0?Rd:_p):e.sym_next&&(Ho(e,!1),e.strm.avail_out===0)?to:bp};function ys(e,t,n,r,i){this.good_length=e,this.max_lazy=t,this.nice_length=n,this.max_chain=r,this.func=i}const _g=[new ys(0,0,0,0,cz),new ys(4,4,8,4,dC),new ys(4,5,16,8,dC),new ys(4,6,32,32,dC),new ys(4,4,16,16,uf),new ys(8,16,32,32,uf),new ys(8,16,128,128,uf),new ys(8,32,128,256,uf),new ys(32,128,258,1024,uf),new ys(32,258,258,4096,uf)],mde=e=>{e.window_size=2*e.w_size,Tu(e.head),e.max_lazy_match=_g[e.level].max_lazy,e.good_match=_g[e.level].good_length,e.nice_match=_g[e.level].nice_length,e.max_chain_length=_g[e.level].max_chain,e.strstart=0,e.block_start=0,e.lookahead=0,e.insert=0,e.match_length=e.prev_length=Bt-1,e.match_available=0,e.ins_h=0};function yde(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=JS,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(lde*2),this.dyn_dtree=new Uint16Array((2*ade+1)*2),this.bl_tree=new Uint16Array((2*sde+1)*2),Tu(this.dyn_ltree),Tu(this.dyn_dtree),Tu(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(ude+1),this.heap=new Uint16Array(2*lE+1),Tu(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(2*lE+1),Tu(this.depth),this.sym_buf=0,this.lit_bufsize=0,this.sym_next=0,this.sym_end=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}const fy=e=>{if(!e)return 1;const t=e.state;return!t||t.strm!==e||t.status!==Qh&&t.status!==Ck&&t.status!==uE&&t.status!==cE&&t.status!==dE&&t.status!==fE&&t.status!==rd&&t.status!==bg?1:0},dz=e=>{if(fy(e))return id(e,js);e.total_in=e.total_out=0,e.data_type=ede;const t=e.state;return t.pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=t.wrap===2?Ck:t.wrap?Qh:rd,e.adler=t.wrap===2?0:1,t.last_flush=-2,Vce(t),Ei},fz=e=>{const t=dz(e);return t===Ei&&mde(e.state),t},vde=(e,t)=>fy(e)||e.state.wrap!==2?js:(e.state.gzhead=t,Ei),hz=(e,t,n,r,i,o)=>{if(!e)return js;let a=1;if(t===Qce&&(t=6),r<0?(a=0,r=-r):r>15&&(a=2,r-=16),i<1||i>tde||n!==JS||r<8||r>15||t<0||t>9||o<0||o>Zce||r===8&&a!==1)return id(e,js);r===8&&(r=9);const s=new yde;return e.state=s,s.strm=e,s.status=Qh,s.wrap=a,s.gzhead=null,s.w_bits=r,s.w_size=1<hz(e,t,JS,nde,rde,Jce),_de=(e,t)=>{if(fy(e)||t>CI||t<0)return e?id(e,js):js;const n=e.state;if(!e.output||e.avail_in!==0&&!e.input||n.status===bg&&t!==ya)return id(e,e.avail_out===0?cC:js);const r=n.last_flush;if(n.last_flush=t,n.pending!==0){if(Fo(e),e.avail_out===0)return n.last_flush=-1,Ei}else if(e.avail_in===0&&TI(t)<=TI(r)&&t!==ya)return id(e,cC);if(n.status===bg&&e.avail_in!==0)return id(e,cC);if(n.status===Qh&&n.wrap===0&&(n.status=rd),n.status===Qh){let i=JS+(n.w_bits-8<<4)<<8,o=-1;if(n.strategy>=yv||n.level<2?o=0:n.level<6?o=1:n.level===6?o=2:o=3,i|=o<<6,n.strstart!==0&&(i|=cde),i+=31-i%31,Wp(n,i),n.strstart!==0&&(Wp(n,e.adler>>>16),Wp(n,e.adler&65535)),e.adler=1,n.status=rd,Fo(e),n.pending!==0)return n.last_flush=-1,Ei}if(n.status===Ck){if(e.adler=0,on(n,31),on(n,139),on(n,8),n.gzhead)on(n,(n.gzhead.text?1:0)+(n.gzhead.hcrc?2:0)+(n.gzhead.extra?4:0)+(n.gzhead.name?8:0)+(n.gzhead.comment?16:0)),on(n,n.gzhead.time&255),on(n,n.gzhead.time>>8&255),on(n,n.gzhead.time>>16&255),on(n,n.gzhead.time>>24&255),on(n,n.level===9?2:n.strategy>=yv||n.level<2?4:0),on(n,n.gzhead.os&255),n.gzhead.extra&&n.gzhead.extra.length&&(on(n,n.gzhead.extra.length&255),on(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(e.adler=ai(e.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=uE;else if(on(n,0),on(n,0),on(n,0),on(n,0),on(n,0),on(n,n.level===9?2:n.strategy>=yv||n.level<2?4:0),on(n,dde),n.status=rd,Fo(e),n.pending!==0)return n.last_flush=-1,Ei}if(n.status===uE){if(n.gzhead.extra){let i=n.pending,o=(n.gzhead.extra.length&65535)-n.gzindex;for(;n.pending+o>n.pending_buf_size;){let s=n.pending_buf_size-n.pending;if(n.pending_buf.set(n.gzhead.extra.subarray(n.gzindex,n.gzindex+s),n.pending),n.pending=n.pending_buf_size,n.gzhead.hcrc&&n.pending>i&&(e.adler=ai(e.adler,n.pending_buf,n.pending-i,i)),n.gzindex+=s,Fo(e),n.pending!==0)return n.last_flush=-1,Ei;i=0,o-=s}let a=new Uint8Array(n.gzhead.extra);n.pending_buf.set(a.subarray(n.gzindex,n.gzindex+o),n.pending),n.pending+=o,n.gzhead.hcrc&&n.pending>i&&(e.adler=ai(e.adler,n.pending_buf,n.pending-i,i)),n.gzindex=0}n.status=cE}if(n.status===cE){if(n.gzhead.name){let i=n.pending,o;do{if(n.pending===n.pending_buf_size){if(n.gzhead.hcrc&&n.pending>i&&(e.adler=ai(e.adler,n.pending_buf,n.pending-i,i)),Fo(e),n.pending!==0)return n.last_flush=-1,Ei;i=0}n.gzindexi&&(e.adler=ai(e.adler,n.pending_buf,n.pending-i,i)),n.gzindex=0}n.status=dE}if(n.status===dE){if(n.gzhead.comment){let i=n.pending,o;do{if(n.pending===n.pending_buf_size){if(n.gzhead.hcrc&&n.pending>i&&(e.adler=ai(e.adler,n.pending_buf,n.pending-i,i)),Fo(e),n.pending!==0)return n.last_flush=-1,Ei;i=0}n.gzindexi&&(e.adler=ai(e.adler,n.pending_buf,n.pending-i,i))}n.status=fE}if(n.status===fE){if(n.gzhead.hcrc){if(n.pending+2>n.pending_buf_size&&(Fo(e),n.pending!==0))return n.last_flush=-1,Ei;on(n,e.adler&255),on(n,e.adler>>8&255),e.adler=0}if(n.status=rd,Fo(e),n.pending!==0)return n.last_flush=-1,Ei}if(e.avail_in!==0||n.lookahead!==0||t!==Ku&&n.status!==bg){let i=n.level===0?cz(n,t):n.strategy===yv?gde(n,t):n.strategy===Yce?pde(n,t):_g[n.level].func(n,t);if((i===Rd||i===_p)&&(n.status=bg),i===to||i===Rd)return e.avail_out===0&&(n.last_flush=-1),Ei;if(i===bp&&(t===Hce?qce(n):t!==CI&&(sE(n,0,0,!1),t===Wce&&(Tu(n.head),n.lookahead===0&&(n.strstart=0,n.block_start=0,n.insert=0))),Fo(e),e.avail_out===0))return n.last_flush=-1,Ei}return t!==ya?Ei:n.wrap<=0?EI:(n.wrap===2?(on(n,e.adler&255),on(n,e.adler>>8&255),on(n,e.adler>>16&255),on(n,e.adler>>24&255),on(n,e.total_in&255),on(n,e.total_in>>8&255),on(n,e.total_in>>16&255),on(n,e.total_in>>24&255)):(Wp(n,e.adler>>>16),Wp(n,e.adler&65535)),Fo(e),n.wrap>0&&(n.wrap=-n.wrap),n.pending!==0?Ei:EI)},Sde=e=>{if(fy(e))return js;const t=e.state.status;return e.state=null,t===rd?id(e,Kce):Ei},xde=(e,t)=>{let n=t.length;if(fy(e))return js;const r=e.state,i=r.wrap;if(i===2||i===1&&r.status!==Qh||r.lookahead)return js;if(i===1&&(e.adler=e0(e.adler,t,n,0)),r.wrap=0,n>=r.w_size){i===0&&(Tu(r.head),r.strstart=0,r.block_start=0,r.insert=0);let l=new Uint8Array(r.w_size);l.set(t.subarray(n-r.w_size,n),0),t=l,n=r.w_size}const o=e.avail_in,a=e.next_in,s=e.input;for(e.avail_in=n,e.next_in=0,e.input=t,Xh(r);r.lookahead>=Bt;){let l=r.strstart,u=r.lookahead-(Bt-1);do r.ins_h=Qu(r,r.ins_h,r.window[l+Bt-1]),r.prev[l&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=l,l++;while(--u);r.strstart=l,r.lookahead=Bt-1,Xh(r)}return r.strstart+=r.lookahead,r.block_start=r.strstart,r.insert=r.lookahead,r.lookahead=0,r.match_length=r.prev_length=Bt-1,r.match_available=0,e.next_in=a,e.input=s,e.avail_in=o,r.wrap=i,Ei};var wde=bde,Cde=hz,Ede=fz,Tde=dz,kde=vde,Ade=_de,Pde=Sde,Ide=xde,Rde="pako deflate (from Nodeca project)",Wg={deflateInit:wde,deflateInit2:Cde,deflateReset:Ede,deflateResetKeep:Tde,deflateSetHeader:kde,deflate:Ade,deflateEnd:Pde,deflateSetDictionary:Ide,deflateInfo:Rde};const Ode=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var Mde=function(e){const t=Array.prototype.slice.call(arguments,1);for(;t.length;){const n=t.shift();if(n){if(typeof n!="object")throw new TypeError(n+"must be non-object");for(const r in n)Ode(n,r)&&(e[r]=n[r])}}return e},Nde=e=>{let t=0;for(let r=0,i=e.length;r=252?6:e>=248?5:e>=240?4:e>=224?3:e>=192?2:1;t0[254]=t0[254]=1;var $de=e=>{if(typeof TextEncoder=="function"&&TextEncoder.prototype.encode)return new TextEncoder().encode(e);let t,n,r,i,o,a=e.length,s=0;for(i=0;i>>6,t[o++]=128|n&63):n<65536?(t[o++]=224|n>>>12,t[o++]=128|n>>>6&63,t[o++]=128|n&63):(t[o++]=240|n>>>18,t[o++]=128|n>>>12&63,t[o++]=128|n>>>6&63,t[o++]=128|n&63);return t};const Dde=(e,t)=>{if(t<65534&&e.subarray&&pz)return String.fromCharCode.apply(null,e.length===t?e:e.subarray(0,t));let n="";for(let r=0;r{const n=t||e.length;if(typeof TextDecoder=="function"&&TextDecoder.prototype.decode)return new TextDecoder().decode(e.subarray(0,t));let r,i;const o=new Array(n*2);for(i=0,r=0;r4){o[i++]=65533,r+=s-1;continue}for(a&=s===2?31:s===3?15:7;s>1&&r1){o[i++]=65533;continue}a<65536?o[i++]=a:(a-=65536,o[i++]=55296|a>>10&1023,o[i++]=56320|a&1023)}return Dde(o,i)},Fde=(e,t)=>{t=t||e.length,t>e.length&&(t=e.length);let n=t-1;for(;n>=0&&(e[n]&192)===128;)n--;return n<0||n===0?t:n+t0[e[n]]>t?n:t},n0={string2buf:$de,buf2string:Lde,utf8border:Fde};function Bde(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}var gz=Bde;const mz=Object.prototype.toString,{Z_NO_FLUSH:zde,Z_SYNC_FLUSH:jde,Z_FULL_FLUSH:Ude,Z_FINISH:Vde,Z_OK:f_,Z_STREAM_END:Gde,Z_DEFAULT_COMPRESSION:qde,Z_DEFAULT_STRATEGY:Hde,Z_DEFLATED:Wde}=dy;function Ek(e){this.options=e2.assign({level:qde,method:Wde,chunkSize:16384,windowBits:15,memLevel:8,strategy:Hde},e||{});let t=this.options;t.raw&&t.windowBits>0?t.windowBits=-t.windowBits:t.gzip&&t.windowBits>0&&t.windowBits<16&&(t.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new gz,this.strm.avail_out=0;let n=Wg.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(n!==f_)throw new Error(Kh[n]);if(t.header&&Wg.deflateSetHeader(this.strm,t.header),t.dictionary){let r;if(typeof t.dictionary=="string"?r=n0.string2buf(t.dictionary):mz.call(t.dictionary)==="[object ArrayBuffer]"?r=new Uint8Array(t.dictionary):r=t.dictionary,n=Wg.deflateSetDictionary(this.strm,r),n!==f_)throw new Error(Kh[n]);this._dict_set=!0}}Ek.prototype.push=function(e,t){const n=this.strm,r=this.options.chunkSize;let i,o;if(this.ended)return!1;for(t===~~t?o=t:o=t===!0?Vde:zde,typeof e=="string"?n.input=n0.string2buf(e):mz.call(e)==="[object ArrayBuffer]"?n.input=new Uint8Array(e):n.input=e,n.next_in=0,n.avail_in=n.input.length;;){if(n.avail_out===0&&(n.output=new Uint8Array(r),n.next_out=0,n.avail_out=r),(o===jde||o===Ude)&&n.avail_out<=6){this.onData(n.output.subarray(0,n.next_out)),n.avail_out=0;continue}if(i=Wg.deflate(n,o),i===Gde)return n.next_out>0&&this.onData(n.output.subarray(0,n.next_out)),i=Wg.deflateEnd(this.strm),this.onEnd(i),this.ended=!0,i===f_;if(n.avail_out===0){this.onData(n.output);continue}if(o>0&&n.next_out>0){this.onData(n.output.subarray(0,n.next_out)),n.avail_out=0;continue}if(n.avail_in===0)break}return!0};Ek.prototype.onData=function(e){this.chunks.push(e)};Ek.prototype.onEnd=function(e){e===f_&&(this.result=e2.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};const vv=16209,Kde=16191;var Qde=function(t,n){let r,i,o,a,s,l,u,c,d,f,h,p,m,_,b,v,g,y,S,w,x,C,k,T;const P=t.state;r=t.next_in,k=t.input,i=r+(t.avail_in-5),o=t.next_out,T=t.output,a=o-(n-t.avail_out),s=o+(t.avail_out-257),l=P.dmax,u=P.wsize,c=P.whave,d=P.wnext,f=P.window,h=P.hold,p=P.bits,m=P.lencode,_=P.distcode,b=(1<>>24,h>>>=y,p-=y,y=g>>>16&255,y===0)T[o++]=g&65535;else if(y&16){S=g&65535,y&=15,y&&(p>>=y,p-=y),p<15&&(h+=k[r++]<>>24,h>>>=y,p-=y,y=g>>>16&255,y&16){if(w=g&65535,y&=15,pl){t.msg="invalid distance too far back",P.mode=vv;break e}if(h>>>=y,p-=y,y=o-a,w>y){if(y=w-y,y>c&&P.sane){t.msg="invalid distance too far back",P.mode=vv;break e}if(x=0,C=f,d===0){if(x+=u-y,y2;)T[o++]=C[x++],T[o++]=C[x++],T[o++]=C[x++],S-=3;S&&(T[o++]=C[x++],S>1&&(T[o++]=C[x++]))}else{x=o-w;do T[o++]=T[x++],T[o++]=T[x++],T[o++]=T[x++],S-=3;while(S>2);S&&(T[o++]=T[x++],S>1&&(T[o++]=T[x++]))}}else if(y&64){t.msg="invalid distance code",P.mode=vv;break e}else{g=_[(g&65535)+(h&(1<>3,r-=S,p-=S<<3,h&=(1<{const l=s.bits;let u=0,c=0,d=0,f=0,h=0,p=0,m=0,_=0,b=0,v=0,g,y,S,w,x,C=null,k;const T=new Uint16Array(cf+1),P=new Uint16Array(cf+1);let $=null,O,E,A;for(u=0;u<=cf;u++)T[u]=0;for(c=0;c=1&&T[f]===0;f--);if(h>f&&(h=f),f===0)return i[o++]=1<<24|64<<16|0,i[o++]=1<<24|64<<16|0,s.bits=1,0;for(d=1;d0&&(e===PI||f!==1))return-1;for(P[1]=0,u=1;ukI||e===II&&b>AI)return 1;for(;;){O=u-m,a[c]+1=k?(E=$[a[c]-k],A=C[a[c]-k]):(E=32+64,A=0),g=1<>m)+y]=O<<24|E<<16|A|0;while(y!==0);for(g=1<>=1;if(g!==0?(v&=g-1,v+=g):v=0,c++,--T[u]===0){if(u===f)break;u=t[n+a[c]]}if(u>h&&(v&w)!==S){for(m===0&&(m=h),x+=d,p=u-m,_=1<kI||e===II&&b>AI)return 1;S=v&w,i[S]=h<<24|p<<16|x-o|0}}return v!==0&&(i[x+v]=u-m<<24|64<<16|0),s.bits=h,0};var Kg=efe;const tfe=0,yz=1,vz=2,{Z_FINISH:RI,Z_BLOCK:nfe,Z_TREES:bv,Z_OK:Od,Z_STREAM_END:rfe,Z_NEED_DICT:ife,Z_STREAM_ERROR:Ea,Z_DATA_ERROR:bz,Z_MEM_ERROR:_z,Z_BUF_ERROR:ofe,Z_DEFLATED:OI}=dy,t2=16180,MI=16181,NI=16182,$I=16183,DI=16184,LI=16185,FI=16186,BI=16187,zI=16188,jI=16189,h_=16190,ll=16191,hC=16192,UI=16193,pC=16194,VI=16195,GI=16196,qI=16197,HI=16198,_v=16199,Sv=16200,WI=16201,KI=16202,QI=16203,XI=16204,YI=16205,gC=16206,ZI=16207,JI=16208,Zn=16209,Sz=16210,xz=16211,afe=852,sfe=592,lfe=15,ufe=lfe,eR=e=>(e>>>24&255)+(e>>>8&65280)+((e&65280)<<8)+((e&255)<<24);function cfe(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}const Vd=e=>{if(!e)return 1;const t=e.state;return!t||t.strm!==e||t.modexz?1:0},wz=e=>{if(Vd(e))return Ea;const t=e.state;return e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=t.wrap&1),t.mode=t2,t.last=0,t.havedict=0,t.flags=-1,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new Int32Array(afe),t.distcode=t.distdyn=new Int32Array(sfe),t.sane=1,t.back=-1,Od},Cz=e=>{if(Vd(e))return Ea;const t=e.state;return t.wsize=0,t.whave=0,t.wnext=0,wz(e)},Ez=(e,t)=>{let n;if(Vd(e))return Ea;const r=e.state;return t<0?(n=0,t=-t):(n=(t>>4)+5,t<48&&(t&=15)),t&&(t<8||t>15)?Ea:(r.window!==null&&r.wbits!==t&&(r.window=null),r.wrap=n,r.wbits=t,Cz(e))},Tz=(e,t)=>{if(!e)return Ea;const n=new cfe;e.state=n,n.strm=e,n.window=null,n.mode=t2;const r=Ez(e,t);return r!==Od&&(e.state=null),r},dfe=e=>Tz(e,ufe);let tR=!0,mC,yC;const ffe=e=>{if(tR){mC=new Int32Array(512),yC=new Int32Array(32);let t=0;for(;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(Kg(yz,e.lens,0,288,mC,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;Kg(vz,e.lens,0,32,yC,0,e.work,{bits:5}),tR=!1}e.lencode=mC,e.lenbits=9,e.distcode=yC,e.distbits=5},kz=(e,t,n,r)=>{let i;const o=e.state;return o.window===null&&(o.wsize=1<=o.wsize?(o.window.set(t.subarray(n-o.wsize,n),0),o.wnext=0,o.whave=o.wsize):(i=o.wsize-o.wnext,i>r&&(i=r),o.window.set(t.subarray(n-r,n-r+i),o.wnext),r-=i,r?(o.window.set(t.subarray(n-r,n),0),o.wnext=r,o.whave=o.wsize):(o.wnext+=i,o.wnext===o.wsize&&(o.wnext=0),o.whave{let n,r,i,o,a,s,l,u,c,d,f,h,p,m,_=0,b,v,g,y,S,w,x,C;const k=new Uint8Array(4);let T,P;const $=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(Vd(e)||!e.output||!e.input&&e.avail_in!==0)return Ea;n=e.state,n.mode===ll&&(n.mode=hC),a=e.next_out,i=e.output,l=e.avail_out,o=e.next_in,r=e.input,s=e.avail_in,u=n.hold,c=n.bits,d=s,f=l,C=Od;e:for(;;)switch(n.mode){case t2:if(n.wrap===0){n.mode=hC;break}for(;c<16;){if(s===0)break e;s--,u+=r[o++]<>>8&255,n.check=ai(n.check,k,2,0),u=0,c=0,n.mode=MI;break}if(n.head&&(n.head.done=!1),!(n.wrap&1)||(((u&255)<<8)+(u>>8))%31){e.msg="incorrect header check",n.mode=Zn;break}if((u&15)!==OI){e.msg="unknown compression method",n.mode=Zn;break}if(u>>>=4,c-=4,x=(u&15)+8,n.wbits===0&&(n.wbits=x),x>15||x>n.wbits){e.msg="invalid window size",n.mode=Zn;break}n.dmax=1<>8&1),n.flags&512&&n.wrap&4&&(k[0]=u&255,k[1]=u>>>8&255,n.check=ai(n.check,k,2,0)),u=0,c=0,n.mode=NI;case NI:for(;c<32;){if(s===0)break e;s--,u+=r[o++]<>>8&255,k[2]=u>>>16&255,k[3]=u>>>24&255,n.check=ai(n.check,k,4,0)),u=0,c=0,n.mode=$I;case $I:for(;c<16;){if(s===0)break e;s--,u+=r[o++]<>8),n.flags&512&&n.wrap&4&&(k[0]=u&255,k[1]=u>>>8&255,n.check=ai(n.check,k,2,0)),u=0,c=0,n.mode=DI;case DI:if(n.flags&1024){for(;c<16;){if(s===0)break e;s--,u+=r[o++]<>>8&255,n.check=ai(n.check,k,2,0)),u=0,c=0}else n.head&&(n.head.extra=null);n.mode=LI;case LI:if(n.flags&1024&&(h=n.length,h>s&&(h=s),h&&(n.head&&(x=n.head.extra_len-n.length,n.head.extra||(n.head.extra=new Uint8Array(n.head.extra_len)),n.head.extra.set(r.subarray(o,o+h),x)),n.flags&512&&n.wrap&4&&(n.check=ai(n.check,r,h,o)),s-=h,o+=h,n.length-=h),n.length))break e;n.length=0,n.mode=FI;case FI:if(n.flags&2048){if(s===0)break e;h=0;do x=r[o+h++],n.head&&x&&n.length<65536&&(n.head.name+=String.fromCharCode(x));while(x&&h>9&1,n.head.done=!0),e.adler=n.check=0,n.mode=ll;break;case jI:for(;c<32;){if(s===0)break e;s--,u+=r[o++]<>>=c&7,c-=c&7,n.mode=gC;break}for(;c<3;){if(s===0)break e;s--,u+=r[o++]<>>=1,c-=1,u&3){case 0:n.mode=UI;break;case 1:if(ffe(n),n.mode=_v,t===bv){u>>>=2,c-=2;break e}break;case 2:n.mode=GI;break;case 3:e.msg="invalid block type",n.mode=Zn}u>>>=2,c-=2;break;case UI:for(u>>>=c&7,c-=c&7;c<32;){if(s===0)break e;s--,u+=r[o++]<>>16^65535)){e.msg="invalid stored block lengths",n.mode=Zn;break}if(n.length=u&65535,u=0,c=0,n.mode=pC,t===bv)break e;case pC:n.mode=VI;case VI:if(h=n.length,h){if(h>s&&(h=s),h>l&&(h=l),h===0)break e;i.set(r.subarray(o,o+h),a),s-=h,o+=h,l-=h,a+=h,n.length-=h;break}n.mode=ll;break;case GI:for(;c<14;){if(s===0)break e;s--,u+=r[o++]<>>=5,c-=5,n.ndist=(u&31)+1,u>>>=5,c-=5,n.ncode=(u&15)+4,u>>>=4,c-=4,n.nlen>286||n.ndist>30){e.msg="too many length or distance symbols",n.mode=Zn;break}n.have=0,n.mode=qI;case qI:for(;n.have>>=3,c-=3}for(;n.have<19;)n.lens[$[n.have++]]=0;if(n.lencode=n.lendyn,n.lenbits=7,T={bits:n.lenbits},C=Kg(tfe,n.lens,0,19,n.lencode,0,n.work,T),n.lenbits=T.bits,C){e.msg="invalid code lengths set",n.mode=Zn;break}n.have=0,n.mode=HI;case HI:for(;n.have>>24,v=_>>>16&255,g=_&65535,!(b<=c);){if(s===0)break e;s--,u+=r[o++]<>>=b,c-=b,n.lens[n.have++]=g;else{if(g===16){for(P=b+2;c>>=b,c-=b,n.have===0){e.msg="invalid bit length repeat",n.mode=Zn;break}x=n.lens[n.have-1],h=3+(u&3),u>>>=2,c-=2}else if(g===17){for(P=b+3;c>>=b,c-=b,x=0,h=3+(u&7),u>>>=3,c-=3}else{for(P=b+7;c>>=b,c-=b,x=0,h=11+(u&127),u>>>=7,c-=7}if(n.have+h>n.nlen+n.ndist){e.msg="invalid bit length repeat",n.mode=Zn;break}for(;h--;)n.lens[n.have++]=x}}if(n.mode===Zn)break;if(n.lens[256]===0){e.msg="invalid code -- missing end-of-block",n.mode=Zn;break}if(n.lenbits=9,T={bits:n.lenbits},C=Kg(yz,n.lens,0,n.nlen,n.lencode,0,n.work,T),n.lenbits=T.bits,C){e.msg="invalid literal/lengths set",n.mode=Zn;break}if(n.distbits=6,n.distcode=n.distdyn,T={bits:n.distbits},C=Kg(vz,n.lens,n.nlen,n.ndist,n.distcode,0,n.work,T),n.distbits=T.bits,C){e.msg="invalid distances set",n.mode=Zn;break}if(n.mode=_v,t===bv)break e;case _v:n.mode=Sv;case Sv:if(s>=6&&l>=258){e.next_out=a,e.avail_out=l,e.next_in=o,e.avail_in=s,n.hold=u,n.bits=c,Qde(e,f),a=e.next_out,i=e.output,l=e.avail_out,o=e.next_in,r=e.input,s=e.avail_in,u=n.hold,c=n.bits,n.mode===ll&&(n.back=-1);break}for(n.back=0;_=n.lencode[u&(1<>>24,v=_>>>16&255,g=_&65535,!(b<=c);){if(s===0)break e;s--,u+=r[o++]<>y)],b=_>>>24,v=_>>>16&255,g=_&65535,!(y+b<=c);){if(s===0)break e;s--,u+=r[o++]<>>=y,c-=y,n.back+=y}if(u>>>=b,c-=b,n.back+=b,n.length=g,v===0){n.mode=YI;break}if(v&32){n.back=-1,n.mode=ll;break}if(v&64){e.msg="invalid literal/length code",n.mode=Zn;break}n.extra=v&15,n.mode=WI;case WI:if(n.extra){for(P=n.extra;c>>=n.extra,c-=n.extra,n.back+=n.extra}n.was=n.length,n.mode=KI;case KI:for(;_=n.distcode[u&(1<>>24,v=_>>>16&255,g=_&65535,!(b<=c);){if(s===0)break e;s--,u+=r[o++]<>y)],b=_>>>24,v=_>>>16&255,g=_&65535,!(y+b<=c);){if(s===0)break e;s--,u+=r[o++]<>>=y,c-=y,n.back+=y}if(u>>>=b,c-=b,n.back+=b,v&64){e.msg="invalid distance code",n.mode=Zn;break}n.offset=g,n.extra=v&15,n.mode=QI;case QI:if(n.extra){for(P=n.extra;c>>=n.extra,c-=n.extra,n.back+=n.extra}if(n.offset>n.dmax){e.msg="invalid distance too far back",n.mode=Zn;break}n.mode=XI;case XI:if(l===0)break e;if(h=f-l,n.offset>h){if(h=n.offset-h,h>n.whave&&n.sane){e.msg="invalid distance too far back",n.mode=Zn;break}h>n.wnext?(h-=n.wnext,p=n.wsize-h):p=n.wnext-h,h>n.length&&(h=n.length),m=n.window}else m=i,p=a-n.offset,h=n.length;h>l&&(h=l),l-=h,n.length-=h;do i[a++]=m[p++];while(--h);n.length===0&&(n.mode=Sv);break;case YI:if(l===0)break e;i[a++]=n.length,l--,n.mode=Sv;break;case gC:if(n.wrap){for(;c<32;){if(s===0)break e;s--,u|=r[o++]<{if(Vd(e))return Ea;let t=e.state;return t.window&&(t.window=null),e.state=null,Od},gfe=(e,t)=>{if(Vd(e))return Ea;const n=e.state;return n.wrap&2?(n.head=t,t.done=!1,Od):Ea},mfe=(e,t)=>{const n=t.length;let r,i,o;return Vd(e)||(r=e.state,r.wrap!==0&&r.mode!==h_)?Ea:r.mode===h_&&(i=1,i=e0(i,t,n,0),i!==r.check)?bz:(o=kz(e,t,n,n),o?(r.mode=Sz,_z):(r.havedict=1,Od))};var yfe=Cz,vfe=Ez,bfe=wz,_fe=dfe,Sfe=Tz,xfe=hfe,wfe=pfe,Cfe=gfe,Efe=mfe,Tfe="pako inflate (from Nodeca project)",_l={inflateReset:yfe,inflateReset2:vfe,inflateResetKeep:bfe,inflateInit:_fe,inflateInit2:Sfe,inflate:xfe,inflateEnd:wfe,inflateGetHeader:Cfe,inflateSetDictionary:Efe,inflateInfo:Tfe};function kfe(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}var Afe=kfe;const Az=Object.prototype.toString,{Z_NO_FLUSH:Pfe,Z_FINISH:Ife,Z_OK:r0,Z_STREAM_END:vC,Z_NEED_DICT:bC,Z_STREAM_ERROR:Rfe,Z_DATA_ERROR:nR,Z_MEM_ERROR:Ofe}=dy;function hy(e){this.options=e2.assign({chunkSize:1024*64,windowBits:15,to:""},e||{});const t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,t.windowBits===0&&(t.windowBits=-15)),t.windowBits>=0&&t.windowBits<16&&!(e&&e.windowBits)&&(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&(t.windowBits&15||(t.windowBits|=15)),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new gz,this.strm.avail_out=0;let n=_l.inflateInit2(this.strm,t.windowBits);if(n!==r0)throw new Error(Kh[n]);if(this.header=new Afe,_l.inflateGetHeader(this.strm,this.header),t.dictionary&&(typeof t.dictionary=="string"?t.dictionary=n0.string2buf(t.dictionary):Az.call(t.dictionary)==="[object ArrayBuffer]"&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(n=_l.inflateSetDictionary(this.strm,t.dictionary),n!==r0)))throw new Error(Kh[n])}hy.prototype.push=function(e,t){const n=this.strm,r=this.options.chunkSize,i=this.options.dictionary;let o,a,s;if(this.ended)return!1;for(t===~~t?a=t:a=t===!0?Ife:Pfe,Az.call(e)==="[object ArrayBuffer]"?n.input=new Uint8Array(e):n.input=e,n.next_in=0,n.avail_in=n.input.length;;){for(n.avail_out===0&&(n.output=new Uint8Array(r),n.next_out=0,n.avail_out=r),o=_l.inflate(n,a),o===bC&&i&&(o=_l.inflateSetDictionary(n,i),o===r0?o=_l.inflate(n,a):o===nR&&(o=bC));n.avail_in>0&&o===vC&&n.state.wrap>0&&e[n.next_in]!==0;)_l.inflateReset(n),o=_l.inflate(n,a);switch(o){case Rfe:case nR:case bC:case Ofe:return this.onEnd(o),this.ended=!0,!1}if(s=n.avail_out,n.next_out&&(n.avail_out===0||o===vC))if(this.options.to==="string"){let l=n0.utf8border(n.output,n.next_out),u=n.next_out-l,c=n0.buf2string(n.output,l);n.next_out=u,n.avail_out=r-u,u&&n.output.set(n.output.subarray(l,l+u),0),this.onData(c)}else this.onData(n.output.length===n.next_out?n.output:n.output.subarray(0,n.next_out));if(!(o===r0&&s===0)){if(o===vC)return o=_l.inflateEnd(this.strm),this.onEnd(o),this.ended=!0,!0;if(n.avail_in===0)break}}return!0};hy.prototype.onData=function(e){this.chunks.push(e)};hy.prototype.onEnd=function(e){e===r0&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=e2.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};function Tk(e,t){const n=new hy(t);if(n.push(e),n.err)throw n.msg||Kh[n.err];return n.result}function Mfe(e,t){return t=t||{},t.raw=!0,Tk(e,t)}var Nfe=hy,$fe=Tk,Dfe=Mfe,Lfe=Tk,Ffe=dy,Bfe={Inflate:Nfe,inflate:$fe,inflateRaw:Dfe,ungzip:Lfe,constants:Ffe};const{Inflate:CGe,inflate:zfe,inflateRaw:EGe,ungzip:TGe}=Bfe;var Pz=zfe;const Iz=[];for(let e=0;e<256;e++){let t=e;for(let n=0;n<8;n++)t&1?t=3988292384^t>>>1:t=t>>>1;Iz[e]=t}function jfe(e){let t=-1;for(let n=0;n>>8;return t^-1}var Jn;(function(e){e[e.GRAYSCALE=0]="GRAYSCALE",e[e.TRUE_COLOR=2]="TRUE_COLOR",e[e.PALETTE=3]="PALETTE",e[e.GRAYSCALE_WITH_ALPHA=4]="GRAYSCALE_WITH_ALPHA",e[e.TRUE_COLOR_WITH_ALPHA=6]="TRUE_COLOR_WITH_ALPHA"})(Jn||(Jn={}));const Ufe={[Jn.GRAYSCALE]:1,[Jn.TRUE_COLOR]:3,[Jn.PALETTE]:1,[Jn.GRAYSCALE_WITH_ALPHA]:2,[Jn.TRUE_COLOR_WITH_ALPHA]:4},Vfe=1;var Vo;(function(e){e[e.NONE=0]="NONE",e[e.SUB=1]="SUB",e[e.UP=2]="UP",e[e.AVERAGE=3]="AVERAGE",e[e.PAETH=4]="PAETH"})(Vo||(Vo={}));const Gfe={[Vo.NONE](e){return e},[Vo.SUB](e,t){const n=new Uint8Array(e.length);for(let r=0;r>1;r[i]=e[i]+s}return r},[Vo.PAETH](e,t,n){const r=new Uint8Array(e.length);for(let i=0;i>7&1,i>>6&1,i>>5&1,i>>4&1,i>>3&1,i>>2&1,i>>1&1,i&1)}else if(t===2){const i=e[r++];n.push(i>>6&3,i>>4&3,i>>2&3,i&3)}else if(t===4){const i=e[r++];n.push(i>>4&15,i&15)}else if(t===8){const i=e[r++];n.push(i)}else if(t===16)n.push(e[r++]<<8|e[r++]);else throw new Error("Unsupported depth: "+t);return n}const Oz=[{x:[0],y:[0]},{x:[4],y:[0]},{x:[0,4],y:[4]},{x:[2,6],y:[0,4]},{x:[0,2,4,6],y:[2,6]},{x:[1,3,5,7],y:[0,2,4,6]},{x:[0,1,2,3,4,5,6,7],y:[1,3,5,7]}];function Hfe(e,t,n){if(!e)return[{passWidth:t,passHeight:n,passIndex:0}];const r=[];return Oz.forEach(function({x:i,y:o},a){const s=t%8,l=n%8,u=t-s>>3,c=n-l>>3;let d=u*i.length;for(let h=0;h>3||1;let p=0,m=new Uint8Array;for(let _=0;_>3)+Vfe,w=u[p];if(!(w in Vo))throw new Error("Unsupported filter type: "+w);const x=Gfe[w],C=x(u.slice(p+1,p+S),h,m);m=C;let k=0;const T=qfe(C,o);for(let $=0;$127)if(r>191&&r<224){if(t>=e.length)throw new Error("UTF-8 decode: incomplete 2-byte sequence");r=(r&31)<<6|e[t++]&63}else if(r>223&&r<240){if(t+1>=e.length)throw new Error("UTF-8 decode: incomplete 3-byte sequence");r=(r&15)<<12|(e[t++]&63)<<6|e[t++]&63}else if(r>239&&r<248){if(t+2>=e.length)throw new Error("UTF-8 decode: incomplete 4-byte sequence");r=(r&7)<<18|(e[t++]&63)<<12|(e[t++]&63)<<6|e[t++]&63}else throw new Error("UTF-8 decode: unknown multibyte start 0x"+r.toString(16)+" at index "+(t-1));if(r<=65535)n+=String.fromCharCode(r);else if(r<=1114111)r-=65536,n+=String.fromCharCode(r>>10|55296),n+=String.fromCharCode(r&1023|56320);else throw new Error("UTF-8 decode: code point 0x"+r.toString(16)+" exceeds UTF-16 reach")}return n}function Xfe(e,t){const n=new Uint8Array(e.length+t.length);return n.set(e),n.set(t,e.length),n}const lu=1e5;function Yfe(e){const t=new Uint8Array(e);let n=new Uint8Array;const r={width:0,height:0,depth:0,colorType:0,compression:0,interlace:0,filter:0,data:[]};let i=0;function o(){return t[i++]<<24|t[i++]<<16|t[i++]<<8|t[i++]}function a(){return t[i++]<<8|t[i++]}function s(){return t[i++]}function l(){const M=[];let R=0;for(;(R=t[i++])!==0;)M.push(R);return new Uint8Array(M)}function u(M){const R=i+M;let N="";for(;i=0&&rR.call(t.callee)==="[object Function]"),r},xC,iR;function the(){if(iR)return xC;iR=1;var e;if(!Object.keys){var t=Object.prototype.hasOwnProperty,n=Object.prototype.toString,r=Nz,i=Object.prototype.propertyIsEnumerable,o=!i.call({toString:null},"toString"),a=i.call(function(){},"prototype"),s=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],l=function(f){var h=f.constructor;return h&&h.prototype===f},u={$applicationCache:!0,$console:!0,$external:!0,$frame:!0,$frameElement:!0,$frames:!0,$innerHeight:!0,$innerWidth:!0,$onmozfullscreenchange:!0,$onmozfullscreenerror:!0,$outerHeight:!0,$outerWidth:!0,$pageXOffset:!0,$pageYOffset:!0,$parent:!0,$scrollLeft:!0,$scrollTop:!0,$scrollX:!0,$scrollY:!0,$self:!0,$webkitIndexedDB:!0,$webkitStorageInfo:!0,$window:!0},c=function(){if(typeof window>"u")return!1;for(var f in window)try{if(!u["$"+f]&&t.call(window,f)&&window[f]!==null&&typeof window[f]=="object")try{l(window[f])}catch{return!0}}catch{return!0}return!1}(),d=function(f){if(typeof window>"u"||!c)return l(f);try{return l(f)}catch{return!1}};e=function(h){var p=h!==null&&typeof h=="object",m=n.call(h)==="[object Function]",_=r(h),b=p&&n.call(h)==="[object String]",v=[];if(!p&&!m&&!_)throw new TypeError("Object.keys called on a non-object");var g=a&&m;if(b&&h.length>0&&!t.call(h,0))for(var y=0;y0)for(var S=0;S"u"||!oi?Dt:oi(Uint8Array),md={"%AggregateError%":typeof AggregateError>"u"?Dt:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?Dt:ArrayBuffer,"%ArrayIteratorPrototype%":df&&oi?oi([][Symbol.iterator]()):Dt,"%AsyncFromSyncIteratorPrototype%":Dt,"%AsyncFunction%":Cf,"%AsyncGenerator%":Cf,"%AsyncGeneratorFunction%":Cf,"%AsyncIteratorPrototype%":Cf,"%Atomics%":typeof Atomics>"u"?Dt:Atomics,"%BigInt%":typeof BigInt>"u"?Dt:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?Dt:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?Dt:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?Dt:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":typeof Float32Array>"u"?Dt:Float32Array,"%Float64Array%":typeof Float64Array>"u"?Dt:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?Dt:FinalizationRegistry,"%Function%":Dz,"%GeneratorFunction%":Cf,"%Int8Array%":typeof Int8Array>"u"?Dt:Int8Array,"%Int16Array%":typeof Int16Array>"u"?Dt:Int16Array,"%Int32Array%":typeof Int32Array>"u"?Dt:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":df&&oi?oi(oi([][Symbol.iterator]())):Dt,"%JSON%":typeof JSON=="object"?JSON:Dt,"%Map%":typeof Map>"u"?Dt:Map,"%MapIteratorPrototype%":typeof Map>"u"||!df||!oi?Dt:oi(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?Dt:Promise,"%Proxy%":typeof Proxy>"u"?Dt:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":typeof Reflect>"u"?Dt:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?Dt:Set,"%SetIteratorPrototype%":typeof Set>"u"||!df||!oi?Dt:oi(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?Dt:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":df&&oi?oi(""[Symbol.iterator]()):Dt,"%Symbol%":df?Symbol:Dt,"%SyntaxError%":Yh,"%ThrowTypeError%":yhe,"%TypedArray%":bhe,"%TypeError%":ph,"%Uint8Array%":typeof Uint8Array>"u"?Dt:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?Dt:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?Dt:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?Dt:Uint32Array,"%URIError%":URIError,"%WeakMap%":typeof WeakMap>"u"?Dt:WeakMap,"%WeakRef%":typeof WeakRef>"u"?Dt:WeakRef,"%WeakSet%":typeof WeakSet>"u"?Dt:WeakSet};if(oi)try{null.error}catch(e){var _he=oi(oi(e));md["%Error.prototype%"]=_he}var She=function e(t){var n;if(t==="%AsyncFunction%")n=CC("async function () {}");else if(t==="%GeneratorFunction%")n=CC("function* () {}");else if(t==="%AsyncGeneratorFunction%")n=CC("async function* () {}");else if(t==="%AsyncGenerator%"){var r=e("%AsyncGeneratorFunction%");r&&(n=r.prototype)}else if(t==="%AsyncIteratorPrototype%"){var i=e("%AsyncGenerator%");i&&oi&&(n=oi(i.prototype))}return md[t]=n,n},uR={"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},py=$z,p_=mhe,xhe=py.call(Function.call,Array.prototype.concat),whe=py.call(Function.apply,Array.prototype.splice),cR=py.call(Function.call,String.prototype.replace),g_=py.call(Function.call,String.prototype.slice),Che=py.call(Function.call,RegExp.prototype.exec),Ehe=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,The=/\\(\\)?/g,khe=function(t){var n=g_(t,0,1),r=g_(t,-1);if(n==="%"&&r!=="%")throw new Yh("invalid intrinsic syntax, expected closing `%`");if(r==="%"&&n!=="%")throw new Yh("invalid intrinsic syntax, expected opening `%`");var i=[];return cR(t,Ehe,function(o,a,s,l){i[i.length]=s?cR(l,The,"$1"):a||o}),i},Ahe=function(t,n){var r=t,i;if(p_(uR,r)&&(i=uR[r],r="%"+i[0]+"%"),p_(md,r)){var o=md[r];if(o===Cf&&(o=She(r)),typeof o>"u"&&!n)throw new ph("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:i,name:r,value:o}}throw new Yh("intrinsic "+t+" does not exist!")},Phe=function(t,n){if(typeof t!="string"||t.length===0)throw new ph("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof n!="boolean")throw new ph('"allowMissing" argument must be a boolean');if(Che(/^%?[^%]*%?$/,t)===null)throw new Yh("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var r=khe(t),i=r.length>0?r[0]:"",o=Ahe("%"+i+"%",n),a=o.name,s=o.value,l=!1,u=o.alias;u&&(i=u[0],whe(r,xhe([0,1],u)));for(var c=1,d=!0;c=r.length){var m=gd(s,f);d=!!m,d&&"get"in m&&!("originalValue"in m.get)?s=m.get:s=s[f]}else d=p_(s,f),s=s[f];d&&!l&&(md[a]=s)}}return s},Ihe=Phe,pE=Ihe("%Object.defineProperty%",!0),gE=function(){if(pE)try{return pE({},"a",{value:1}),!0}catch{return!1}return!1};gE.hasArrayLengthDefineBug=function(){if(!gE())return null;try{return pE([],"length",{value:1}).length!==1}catch{return!0}};var Rhe=gE,Ohe=ihe,Mhe=typeof Symbol=="function"&&typeof Symbol("foo")=="symbol",Nhe=Object.prototype.toString,$he=Array.prototype.concat,Lz=Object.defineProperty,Dhe=function(e){return typeof e=="function"&&Nhe.call(e)==="[object Function]"},Lhe=Rhe(),Fz=Lz&&Lhe,Fhe=function(e,t,n,r){if(t in e){if(r===!0){if(e[t]===n)return}else if(!Dhe(r)||!r())return}Fz?Lz(e,t,{configurable:!0,enumerable:!1,value:n,writable:!0}):e[t]=n},Bz=function(e,t){var n=arguments.length>2?arguments[2]:{},r=Ohe(t);Mhe&&(r=$he.call(r,Object.getOwnPropertySymbols(t)));for(var i=0;i":return t>e;case":<":return t=":return t>=e;case":<=":return t<=e;default:throw new Error("Unimplemented comparison operator: ".concat(n))}};u2.testComparisonRange=ope;var c2={};Object.defineProperty(c2,"__esModule",{value:!0});c2.testRange=void 0;var ape=function(e,t){return typeof e=="number"?!(et.max||e===t.max&&!t.maxInclusive):!1};c2.testRange=ape;(function(e){var t=yt&&yt.__assign||function(){return t=Object.assign||function(c){for(var d,f=1,h=arguments.length;f0?{path:l.path,query:new RegExp("("+l.keywords.map(function(u){return(0,upe.escapeRegexString)(u.trim())}).join("|")+")")}:{path:l.path}})};d2.highlight=dpe;var f2={},Hz={exports:{}};(function(e){(function(t,n){e.exports?e.exports=n():t.nearley=n()})(yt,function(){function t(u,c,d){return this.id=++t.highestId,this.name=u,this.symbols=c,this.postprocess=d,this}t.highestId=0,t.prototype.toString=function(u){var c=typeof u>"u"?this.symbols.map(l).join(" "):this.symbols.slice(0,u).map(l).join(" ")+" ● "+this.symbols.slice(u).map(l).join(" ");return this.name+" → "+c};function n(u,c,d,f){this.rule=u,this.dot=c,this.reference=d,this.data=[],this.wantedBy=f,this.isComplete=this.dot===u.symbols.length}n.prototype.toString=function(){return"{"+this.rule.toString(this.dot)+"}, from: "+(this.reference||0)},n.prototype.nextState=function(u){var c=new n(this.rule,this.dot+1,this.reference,this.wantedBy);return c.left=this,c.right=u,c.isComplete&&(c.data=c.build(),c.right=void 0),c},n.prototype.build=function(){var u=[],c=this;do u.push(c.right.data),c=c.left;while(c.left);return u.reverse(),u},n.prototype.finish=function(){this.rule.postprocess&&(this.data=this.rule.postprocess(this.data,this.reference,a.fail))};function r(u,c){this.grammar=u,this.index=c,this.states=[],this.wants={},this.scannable=[],this.completed={}}r.prototype.process=function(u){for(var c=this.states,d=this.wants,f=this.completed,h=0;h0&&c.push(" ^ "+f+" more lines identical to this"),f=0,c.push(" "+m)),d=m}},a.prototype.getSymbolDisplay=function(u){return s(u)},a.prototype.buildFirstStateStack=function(u,c){if(c.indexOf(u)!==-1)return null;if(u.wantedBy.length===0)return[u];var d=u.wantedBy[0],f=[u].concat(c),h=this.buildFirstStateStack(d,f);return h===null?null:[u].concat(h)},a.prototype.save=function(){var u=this.table[this.current];return u.lexerState=this.lexerState,u},a.prototype.restore=function(u){var c=u.index;this.current=c,this.table[c]=u,this.table.splice(c+1),this.lexerState=u.lexerState,this.results=this.finish()},a.prototype.rewind=function(u){if(!this.options.keepHistory)throw new Error("set option `keepHistory` to enable rewinding");this.restore(this.table[u])},a.prototype.finish=function(){var u=[],c=this.grammar.start,d=this.table[this.table.length-1];return d.states.forEach(function(f){f.rule.name===c&&f.dot===f.rule.symbols.length&&f.reference===0&&f.data!==a.fail&&u.push(f)}),u.map(function(f){return f.data})};function s(u){var c=typeof u;if(c==="string")return u;if(c==="object"){if(u.literal)return JSON.stringify(u.literal);if(u instanceof RegExp)return"character matching "+u;if(u.type)return u.type+" token";if(u.test)return"token matching "+String(u.test);throw new Error("Unknown symbol type: "+u)}}function l(u){var c=typeof u;if(c==="string")return u;if(c==="object"){if(u.literal)return JSON.stringify(u.literal);if(u instanceof RegExp)return u.toString();if(u.type)return"%"+u.type;if(u.test)return"<"+String(u.test)+">";throw new Error("Unknown symbol type: "+u)}}return{Parser:a,Grammar:i,Rule:t}})})(Hz);var fpe=Hz.exports,Md={},Wz={},wc={};wc.__esModule=void 0;wc.__esModule=!0;var hpe=typeof Object.setPrototypeOf=="function",ppe=typeof Object.getPrototypeOf=="function",gpe=typeof Object.defineProperty=="function",mpe=typeof Object.create=="function",ype=typeof Object.prototype.hasOwnProperty=="function",vpe=function(t,n){hpe?Object.setPrototypeOf(t,n):t.__proto__=n};wc.setPrototypeOf=vpe;var bpe=function(t){return ppe?Object.getPrototypeOf(t):t.__proto__||t.prototype};wc.getPrototypeOf=bpe;var dR=!1,_pe=function e(t,n,r){if(gpe&&!dR)try{Object.defineProperty(t,n,r)}catch{dR=!0,e(t,n,r)}else t[n]=r.value};wc.defineProperty=_pe;var Kz=function(t,n){return ype?t.hasOwnProperty(t,n):t[n]===void 0};wc.hasOwnProperty=Kz;var Spe=function(t,n){if(mpe)return Object.create(t,n);var r=function(){};r.prototype=t;var i=new r;if(typeof n>"u")return i;if(typeof n=="null")throw new Error("PropertyDescriptors must not be null.");if(typeof n=="object")for(var o in n)Kz(n,o)&&(i[o]=n[o].value);return i};wc.objectCreate=Spe;(function(e){e.__esModule=void 0,e.__esModule=!0;var t=wc,n=t.setPrototypeOf,r=t.getPrototypeOf,i=t.defineProperty,o=t.objectCreate,a=new Error().toString()==="[object Error]",s="";function l(u){var c=this.constructor,d=c.name||function(){var _=c.toString().match(/^function\s*([^\s(]+)/);return _===null?s||"Error":_[1]}(),f=d==="Error",h=f?s:d,p=Error.apply(this,arguments);if(n(p,r(this)),!(p instanceof c)||!(p instanceof l)){var p=this;Error.apply(this,arguments),i(p,"message",{configurable:!0,enumerable:!1,value:u,writable:!0})}if(i(p,"name",{configurable:!0,enumerable:!1,value:h,writable:!0}),Error.captureStackTrace&&Error.captureStackTrace(p,f?l:c),p.stack===void 0){var m=new Error(u);m.name=p.name,p.stack=m.stack}return a&&i(p,"toString",{configurable:!0,enumerable:!1,value:function(){return(this.name||"Error")+(typeof this.message>"u"?"":": "+this.message)},writable:!0}),p}s=l.name||"ExtendableError",l.prototype=o(Error.prototype,{constructor:{value:Error,enumerable:!1,writable:!0,configurable:!0}}),e.ExtendableError=l,e.default=e.ExtendableError})(Wz);var Qz=yt&&yt.__extends||function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(r[o]=i[o])},e(t,n)};return function(t,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}();Object.defineProperty(Md,"__esModule",{value:!0});Md.SyntaxError=Md.LiqeError=void 0;var xpe=Wz,Xz=function(e){Qz(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t}(xpe.ExtendableError);Md.LiqeError=Xz;var wpe=function(e){Qz(t,e);function t(n,r,i,o){var a=e.call(this,n)||this;return a.message=n,a.offset=r,a.line=i,a.column=o,a}return t}(Xz);Md.SyntaxError=wpe;var Ik={},m_=yt&&yt.__assign||function(){return m_=Object.assign||function(e){for(var t,n=1,r=arguments.length;n"}],postprocess:function(e){return e.join("")}},{name:"comparison_operator$subexpression$1",symbols:["comparison_operator$subexpression$1$string$2"]},{name:"comparison_operator$subexpression$1$string$3",symbols:[{literal:":"},{literal:"<"}],postprocess:function(e){return e.join("")}},{name:"comparison_operator$subexpression$1",symbols:["comparison_operator$subexpression$1$string$3"]},{name:"comparison_operator$subexpression$1$string$4",symbols:[{literal:":"},{literal:">"},{literal:"="}],postprocess:function(e){return e.join("")}},{name:"comparison_operator$subexpression$1",symbols:["comparison_operator$subexpression$1$string$4"]},{name:"comparison_operator$subexpression$1$string$5",symbols:[{literal:":"},{literal:"<"},{literal:"="}],postprocess:function(e){return e.join("")}},{name:"comparison_operator$subexpression$1",symbols:["comparison_operator$subexpression$1$string$5"]},{name:"comparison_operator",symbols:["comparison_operator$subexpression$1"],postprocess:function(e,t){return{location:{start:t,end:t+e[0][0].length},type:"ComparisonOperator",operator:e[0][0]}}},{name:"regex",symbols:["regex_body","regex_flags"],postprocess:function(e){return e.join("")}},{name:"regex_body$ebnf$1",symbols:[]},{name:"regex_body$ebnf$1",symbols:["regex_body$ebnf$1","regex_body_char"],postprocess:function(e){return e[0].concat([e[1]])}},{name:"regex_body",symbols:[{literal:"/"},"regex_body$ebnf$1",{literal:"/"}],postprocess:function(e){return"/"+e[1].join("")+"/"}},{name:"regex_body_char",symbols:[/[^\\]/],postprocess:ul},{name:"regex_body_char",symbols:[{literal:"\\"},/[^\\]/],postprocess:function(e){return"\\"+e[1]}},{name:"regex_flags",symbols:[]},{name:"regex_flags$ebnf$1",symbols:[/[gmiyusd]/]},{name:"regex_flags$ebnf$1",symbols:["regex_flags$ebnf$1",/[gmiyusd]/],postprocess:function(e){return e[0].concat([e[1]])}},{name:"regex_flags",symbols:["regex_flags$ebnf$1"],postprocess:function(e){return e[0].join("")}},{name:"unquoted_value$ebnf$1",symbols:[]},{name:"unquoted_value$ebnf$1",symbols:["unquoted_value$ebnf$1",/[a-zA-Z\.\-_*@#$]/],postprocess:function(e){return e[0].concat([e[1]])}},{name:"unquoted_value",symbols:[/[a-zA-Z_*@#$]/,"unquoted_value$ebnf$1"],postprocess:function(e){return e[0]+e[1].join("")}}],ParserStart:"main"};Ik.default=Cpe;var Yz={},h2={},yy={};Object.defineProperty(yy,"__esModule",{value:!0});yy.isSafePath=void 0;var Epe=/^(\.(?:[_a-zA-Z][a-zA-Z\d_]*|\0|[1-9]\d*))+$/u,Tpe=function(e){return Epe.test(e)};yy.isSafePath=Tpe;Object.defineProperty(h2,"__esModule",{value:!0});h2.createGetValueFunctionBody=void 0;var kpe=yy,Ape=function(e){if(!(0,kpe.isSafePath)(e))throw new Error("Unsafe path.");var t="return subject"+e;return t.replace(/(\.(\d+))/g,".[$2]").replace(/\./g,"?.")};h2.createGetValueFunctionBody=Ape;(function(e){var t=yt&&yt.__assign||function(){return t=Object.assign||function(o){for(var a,s=1,l=arguments.length;s\d+) col (?\d+)/,Npe=function(e){if(e.trim()==="")return{location:{end:0,start:0},type:"EmptyExpression"};var t=new Jz.default.Parser(Ope),n;try{n=t.feed(e).results}catch(o){if(typeof(o==null?void 0:o.message)=="string"&&typeof(o==null?void 0:o.offset)=="number"){var r=o.message.match(Mpe);throw r?new Ppe.SyntaxError("Syntax error at line ".concat(r.groups.line," column ").concat(r.groups.column),o.offset,Number(r.groups.line),Number(r.groups.column)):o}throw o}if(n.length===0)throw new Error("Found no parsings.");if(n.length>1)throw new Error("Ambiguous results.");var i=(0,Rpe.hydrateAst)(n[0]);return i};f2.parse=Npe;var p2={};Object.defineProperty(p2,"__esModule",{value:!0});p2.test=void 0;var $pe=gy,Dpe=function(e,t){return(0,$pe.filter)(e,[t]).length===1};p2.test=Dpe;var ej={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.serialize=void 0;var t=function(o,a){return a==="double"?'"'.concat(o,'"'):a==="single"?"'".concat(o,"'"):o},n=function(o){if(o.type==="LiteralExpression")return o.quoted&&typeof o.value=="string"?t(o.value,o.quotes):String(o.value);if(o.type==="RegexExpression")return String(o.value);if(o.type==="RangeExpression"){var a=o.range,s=a.min,l=a.max,u=a.minInclusive,c=a.maxInclusive;return"".concat(u?"[":"{").concat(s," TO ").concat(l).concat(c?"]":"}")}if(o.type==="EmptyExpression")return"";throw new Error("Unexpected AST type.")},r=function(o){if(o.type!=="Tag")throw new Error("Expected a tag expression.");var a=o.field,s=o.expression,l=o.operator;if(a.type==="ImplicitField")return n(s);var u=a.quoted?t(a.name,a.quotes):a.name,c=" ".repeat(s.location.start-l.location.end);return u+l.operator+c+n(s)},i=function(o){if(o.type==="ParenthesizedExpression"){if(!("location"in o.expression))throw new Error("Expected location in expression.");if(!o.location.end)throw new Error("Expected location end.");var a=" ".repeat(o.expression.location.start-(o.location.start+1)),s=" ".repeat(o.location.end-o.expression.location.end-1);return"(".concat(a).concat((0,e.serialize)(o.expression)).concat(s,")")}if(o.type==="Tag")return r(o);if(o.type==="LogicalExpression"){var l="";return o.operator.type==="BooleanOperator"?(l+=" ".repeat(o.operator.location.start-o.left.location.end),l+=o.operator.operator,l+=" ".repeat(o.right.location.start-o.operator.location.end)):l=" ".repeat(o.right.location.start-o.left.location.end),"".concat((0,e.serialize)(o.left)).concat(l).concat((0,e.serialize)(o.right))}if(o.type==="UnaryOperator")return(o.operator==="NOT"?"NOT ":o.operator)+(0,e.serialize)(o.operand);if(o.type==="EmptyExpression")return"";throw new Error("Unexpected AST type.")};e.serialize=i})(ej);var g2={};Object.defineProperty(g2,"__esModule",{value:!0});g2.isSafeUnquotedExpression=void 0;var Lpe=function(e){return/^[#$*@A-Z_a-z][#$*.@A-Z_a-z-]*$/.test(e)};g2.isSafeUnquotedExpression=Lpe;(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.isSafeUnquotedExpression=e.serialize=e.SyntaxError=e.LiqeError=e.test=e.parse=e.highlight=e.filter=void 0;var t=gy;Object.defineProperty(e,"filter",{enumerable:!0,get:function(){return t.filter}});var n=d2;Object.defineProperty(e,"highlight",{enumerable:!0,get:function(){return n.highlight}});var r=f2;Object.defineProperty(e,"parse",{enumerable:!0,get:function(){return r.parse}});var i=p2;Object.defineProperty(e,"test",{enumerable:!0,get:function(){return i.test}});var o=Md;Object.defineProperty(e,"LiqeError",{enumerable:!0,get:function(){return o.LiqeError}}),Object.defineProperty(e,"SyntaxError",{enumerable:!0,get:function(){return o.SyntaxError}});var a=ej;Object.defineProperty(e,"serialize",{enumerable:!0,get:function(){return a.serialize}});var s=g2;Object.defineProperty(e,"isSafeUnquotedExpression",{enumerable:!0,get:function(){return s.isSafeUnquotedExpression}})})(qz);var vy={},tj={},Nd={};Object.defineProperty(Nd,"__esModule",{value:!0});Nd.ROARR_LOG_FORMAT_VERSION=Nd.ROARR_VERSION=void 0;Nd.ROARR_VERSION="5.0.0";Nd.ROARR_LOG_FORMAT_VERSION="2.0.0";var by={};Object.defineProperty(by,"__esModule",{value:!0});by.logLevels=void 0;by.logLevels={debug:20,error:50,fatal:60,info:30,trace:10,warn:40};var nj={},m2={};Object.defineProperty(m2,"__esModule",{value:!0});m2.hasOwnProperty=void 0;const Fpe=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);m2.hasOwnProperty=Fpe;(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.hasOwnProperty=void 0;var t=m2;Object.defineProperty(e,"hasOwnProperty",{enumerable:!0,get:function(){return t.hasOwnProperty}})})(nj);var rj={},y2={},v2={};Object.defineProperty(v2,"__esModule",{value:!0});v2.tokenize=void 0;const Bpe=/(?:%(?([+0-]|-\+))?(?\d+)?(?\d+\$)?(?\.\d+)?(?[%BCESb-iosux]))|(\\%)/g,zpe=e=>{let t;const n=[];let r=0,i=0,o=null;for(;(t=Bpe.exec(e))!==null;){t.index>i&&(o={literal:e.slice(i,t.index),type:"literal"},n.push(o));const a=t[0];i=t.index+a.length,a==="\\%"||a==="%%"?o&&o.type==="literal"?o.literal+="%":(o={literal:"%",type:"literal"},n.push(o)):t.groups&&(o={conversion:t.groups.conversion,flag:t.groups.flag||null,placeholder:a,position:t.groups.position?Number.parseInt(t.groups.position,10)-1:r++,precision:t.groups.precision?Number.parseInt(t.groups.precision.slice(1),10):null,type:"placeholder",width:t.groups.width?Number.parseInt(t.groups.width,10):null},n.push(o))}return i<=e.length-1&&(o&&o.type==="literal"?o.literal+=e.slice(i):n.push({literal:e.slice(i),type:"literal"})),n};v2.tokenize=zpe;Object.defineProperty(y2,"__esModule",{value:!0});y2.createPrintf=void 0;const fR=kk,jpe=v2,Upe=(e,t)=>t.placeholder,Vpe=e=>{var t;const n=(o,a,s)=>s==="-"?o.padEnd(a," "):s==="-+"?((Number(o)>=0?"+":"")+o).padEnd(a," "):s==="+"?((Number(o)>=0?"+":"")+o).padStart(a," "):s==="0"?o.padStart(a,"0"):o.padStart(a," "),r=(t=e==null?void 0:e.formatUnboundExpression)!==null&&t!==void 0?t:Upe,i={};return(o,...a)=>{let s=i[o];s||(s=i[o]=jpe.tokenize(o));let l="";for(const u of s)if(u.type==="literal")l+=u.literal;else{let c=a[u.position];if(c===void 0)l+=r(o,u,a);else if(u.conversion==="b")l+=fR.boolean(c)?"true":"false";else if(u.conversion==="B")l+=fR.boolean(c)?"TRUE":"FALSE";else if(u.conversion==="c")l+=c;else if(u.conversion==="C")l+=String(c).toUpperCase();else if(u.conversion==="i"||u.conversion==="d")c=String(Math.trunc(c)),u.width!==null&&(c=n(c,u.width,u.flag)),l+=c;else if(u.conversion==="e")l+=Number(c).toExponential();else if(u.conversion==="E")l+=Number(c).toExponential().toUpperCase();else if(u.conversion==="f")u.precision!==null&&(c=Number(c).toFixed(u.precision)),u.width!==null&&(c=n(String(c),u.width,u.flag)),l+=c;else if(u.conversion==="o")l+=(Number.parseInt(String(c),10)>>>0).toString(8);else if(u.conversion==="s")u.width!==null&&(c=n(String(c),u.width,u.flag)),l+=c;else if(u.conversion==="S")u.width!==null&&(c=n(String(c),u.width,u.flag)),l+=String(c).toUpperCase();else if(u.conversion==="u")l+=Number.parseInt(String(c),10)>>>0;else if(u.conversion==="x")c=(Number.parseInt(String(c),10)>>>0).toString(16),u.width!==null&&(c=n(String(c),u.width,u.flag)),l+=c;else throw new Error("Unknown format specifier.")}return l}};y2.createPrintf=Vpe;(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.printf=e.createPrintf=void 0;const t=y2;Object.defineProperty(e,"createPrintf",{enumerable:!0,get:function(){return t.createPrintf}}),e.printf=t.createPrintf()})(rj);var mE={exports:{}};(function(e,t){const{hasOwnProperty:n}=Object.prototype,r=_();r.configure=_,r.stringify=r,r.default=r,t.stringify=r,t.configure=_,e.exports=r;const i=/[\u0000-\u001f\u0022\u005c\ud800-\udfff]|[\ud800-\udbff](?![\udc00-\udfff])|(?:[^\ud800-\udbff]|^)[\udc00-\udfff]/;function o(b){return b.length<5e3&&!i.test(b)?`"${b}"`:JSON.stringify(b)}function a(b){if(b.length>200)return b.sort();for(let v=1;vg;)b[y]=b[y-1],y--;b[y]=g}return b}const s=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(Object.getPrototypeOf(new Int8Array)),Symbol.toStringTag).get;function l(b){return s.call(b)!==void 0&&b.length!==0}function u(b,v,g){b.length= 1`)}return g===void 0?1/0:g}function h(b){return b===1?"1 item":`${b} items`}function p(b){const v=new Set;for(const g of b)(typeof g=="string"||typeof g=="number")&&v.add(String(g));return v}function m(b){if(n.call(b,"strict")){const v=b.strict;if(typeof v!="boolean")throw new TypeError('The "strict" argument must be of type boolean');if(v)return g=>{let y=`Object can not safely be stringified. Received type ${typeof g}`;throw typeof g!="function"&&(y+=` (${g.toString()})`),new Error(y)}}}function _(b){b={...b};const v=m(b);v&&(b.bigint===void 0&&(b.bigint=!1),"circularValue"in b||(b.circularValue=Error));const g=c(b),y=d(b,"bigint"),S=d(b,"deterministic"),w=f(b,"maximumDepth"),x=f(b,"maximumBreadth");function C(O,E,A,D,L,M){let R=E[O];switch(typeof R=="object"&&R!==null&&typeof R.toJSON=="function"&&(R=R.toJSON(O)),R=D.call(E,O,R),typeof R){case"string":return o(R);case"object":{if(R===null)return"null";if(A.indexOf(R)!==-1)return g;let N="",B=",";const U=M;if(Array.isArray(R)){if(R.length===0)return"[]";if(wx){const ve=R.length-x-1;N+=`${B}"... ${h(ve)} not stringified"`}return L!==""&&(N+=` +${U}`),A.pop(),`[${N}]`}let G=Object.keys(R);const Y=G.length;if(Y===0)return"{}";if(wx){const Q=Y-x;N+=`${J}"...":${ee}"${h(Q)} not stringified"`,J=B}return L!==""&&J.length>1&&(N=` +${M}${N} +${U}`),A.pop(),`{${N}}`}case"number":return isFinite(R)?String(R):v?v(R):"null";case"boolean":return R===!0?"true":"false";case"undefined":return;case"bigint":if(y)return String(R);default:return v?v(R):void 0}}function k(O,E,A,D,L,M){switch(typeof E=="object"&&E!==null&&typeof E.toJSON=="function"&&(E=E.toJSON(O)),typeof E){case"string":return o(E);case"object":{if(E===null)return"null";if(A.indexOf(E)!==-1)return g;const R=M;let N="",B=",";if(Array.isArray(E)){if(E.length===0)return"[]";if(wx){const j=E.length-x-1;N+=`${B}"... ${h(j)} not stringified"`}return L!==""&&(N+=` +${R}`),A.pop(),`[${N}]`}A.push(E);let U="";L!==""&&(M+=L,B=`, +${M}`,U=" ");let G="";for(const Y of D){const ee=k(Y,E[Y],A,D,L,M);ee!==void 0&&(N+=`${G}${o(Y)}:${U}${ee}`,G=B)}return L!==""&&G.length>1&&(N=` +${M}${N} +${R}`),A.pop(),`{${N}}`}case"number":return isFinite(E)?String(E):v?v(E):"null";case"boolean":return E===!0?"true":"false";case"undefined":return;case"bigint":if(y)return String(E);default:return v?v(E):void 0}}function T(O,E,A,D,L){switch(typeof E){case"string":return o(E);case"object":{if(E===null)return"null";if(typeof E.toJSON=="function"){if(E=E.toJSON(O),typeof E!="object")return T(O,E,A,D,L);if(E===null)return"null"}if(A.indexOf(E)!==-1)return g;const M=L;if(Array.isArray(E)){if(E.length===0)return"[]";if(wx){const se=E.length-x-1;ee+=`${J}"... ${h(se)} not stringified"`}return ee+=` +${M}`,A.pop(),`[${ee}]`}let R=Object.keys(E);const N=R.length;if(N===0)return"{}";if(wx){const ee=N-x;U+=`${G}"...": "${h(ee)} not stringified"`,G=B}return G!==""&&(U=` +${L}${U} +${M}`),A.pop(),`{${U}}`}case"number":return isFinite(E)?String(E):v?v(E):"null";case"boolean":return E===!0?"true":"false";case"undefined":return;case"bigint":if(y)return String(E);default:return v?v(E):void 0}}function P(O,E,A){switch(typeof E){case"string":return o(E);case"object":{if(E===null)return"null";if(typeof E.toJSON=="function"){if(E=E.toJSON(O),typeof E!="object")return P(O,E,A);if(E===null)return"null"}if(A.indexOf(E)!==-1)return g;let D="";if(Array.isArray(E)){if(E.length===0)return"[]";if(wx){const Y=E.length-x-1;D+=`,"... ${h(Y)} not stringified"`}return A.pop(),`[${D}]`}let L=Object.keys(E);const M=L.length;if(M===0)return"{}";if(wx){const B=M-x;D+=`${R}"...":"${h(B)} not stringified"`}return A.pop(),`{${D}}`}case"number":return isFinite(E)?String(E):v?v(E):"null";case"boolean":return E===!0?"true":"false";case"undefined":return;case"bigint":if(y)return String(E);default:return v?v(E):void 0}}function $(O,E,A){if(arguments.length>1){let D="";if(typeof A=="number"?D=" ".repeat(Math.min(A,10)):typeof A=="string"&&(D=A.slice(0,10)),E!=null){if(typeof E=="function")return C("",{"":O},[],E,D,"");if(Array.isArray(E))return k("",O,[],p(E),D,"")}if(D.length!==0)return T("",O,[],D,"")}return P("",O,[])}return $}})(mE,mE.exports);var Gpe=mE.exports;(function(e){var t=yt&&yt.__importDefault||function(g){return g&&g.__esModule?g:{default:g}};Object.defineProperty(e,"__esModule",{value:!0}),e.createLogger=void 0;const n=Nd,r=by,i=nj,o=rj,a=t(Ak),s=t(Gpe);let l=!1;const u=(0,a.default)(),c=()=>u.ROARR,d=()=>({messageContext:{},transforms:[]}),f=()=>{const g=c().asyncLocalStorage;if(!g)throw new Error("AsyncLocalContext is unavailable.");const y=g.getStore();return y||d()},h=()=>!!c().asyncLocalStorage,p=()=>{if(h()){const g=f();return(0,i.hasOwnProperty)(g,"sequenceRoot")&&(0,i.hasOwnProperty)(g,"sequence")&&typeof g.sequence=="number"?String(g.sequenceRoot)+"."+String(g.sequence++):String(c().sequence++)}return String(c().sequence++)},m=(g,y)=>(S,w,x,C,k,T,P,$,O,E)=>{g.child({logLevel:y})(S,w,x,C,k,T,P,$,O,E)},_=1e3,b=(g,y)=>(S,w,x,C,k,T,P,$,O,E)=>{const A=(0,s.default)({a:S,b:w,c:x,d:C,e:k,f:T,g:P,h:$,i:O,j:E,logLevel:y});if(!A)throw new Error("Expected key to be a string");const D=c().onceLog;D.has(A)||(D.add(A),D.size>_&&D.clear(),g.child({logLevel:y})(S,w,x,C,k,T,P,$,O,E))},v=(g,y={},S=[])=>{const w=(x,C,k,T,P,$,O,E,A,D)=>{const L=Date.now(),M=p();let R;h()?R=f():R=d();let N,B;if(typeof x=="string"?N={...R.messageContext,...y}:N={...R.messageContext,...y,...x},typeof x=="string"&&C===void 0)B=x;else if(typeof x=="string"){if(!x.includes("%"))throw new Error("When a string parameter is followed by other arguments, then it is assumed that you are attempting to format a message using printf syntax. You either forgot to add printf bindings or if you meant to add context to the log message, pass them in an object as the first parameter.");B=(0,o.printf)(x,C,k,T,P,$,O,E,A,D)}else{let G=C;if(typeof C!="string")if(C===void 0)G="";else throw new TypeError("Message must be a string. Received "+typeof C+".");B=(0,o.printf)(G,k,T,P,$,O,E,A,D)}let U={context:N,message:B,sequence:M,time:L,version:n.ROARR_LOG_FORMAT_VERSION};for(const G of[...R.transforms,...S])if(U=G(U),typeof U!="object"||U===null)throw new Error("Message transform function must return a message object.");g(U)};return w.child=x=>{let C;return h()?C=f():C=d(),typeof x=="function"?(0,e.createLogger)(g,{...C.messageContext,...y,...x},[x,...S]):(0,e.createLogger)(g,{...C.messageContext,...y,...x},S)},w.getContext=()=>{let x;return h()?x=f():x=d(),{...x.messageContext,...y}},w.adopt=async(x,C)=>{if(!h())return l===!1&&(l=!0,g({context:{logLevel:r.logLevels.warn,package:"roarr"},message:"async_hooks are unavailable; Roarr.adopt will not function as expected",sequence:p(),time:Date.now(),version:n.ROARR_LOG_FORMAT_VERSION})),x();const k=f();let T;(0,i.hasOwnProperty)(k,"sequenceRoot")&&(0,i.hasOwnProperty)(k,"sequence")&&typeof k.sequence=="number"?T=k.sequenceRoot+"."+String(k.sequence++):T=String(c().sequence++);let P={...k.messageContext};const $=[...k.transforms];typeof C=="function"?$.push(C):P={...P,...C};const O=c().asyncLocalStorage;if(!O)throw new Error("Async local context unavailable.");return O.run({messageContext:P,sequence:0,sequenceRoot:T,transforms:$},()=>x())},w.debug=m(w,r.logLevels.debug),w.debugOnce=b(w,r.logLevels.debug),w.error=m(w,r.logLevels.error),w.errorOnce=b(w,r.logLevels.error),w.fatal=m(w,r.logLevels.fatal),w.fatalOnce=b(w,r.logLevels.fatal),w.info=m(w,r.logLevels.info),w.infoOnce=b(w,r.logLevels.info),w.trace=m(w,r.logLevels.trace),w.traceOnce=b(w,r.logLevels.trace),w.warn=m(w,r.logLevels.warn),w.warnOnce=b(w,r.logLevels.warn),w};e.createLogger=v})(tj);var b2={},qpe=function(t,n){for(var r=t.split("."),i=n.split("."),o=0;o<3;o++){var a=Number(r[o]),s=Number(i[o]);if(a>s)return 1;if(s>a)return-1;if(!isNaN(a)&&isNaN(s))return 1;if(isNaN(a)&&!isNaN(s))return-1}return 0},Hpe=yt&&yt.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(b2,"__esModule",{value:!0});b2.createRoarrInitialGlobalStateBrowser=void 0;const hR=Nd,pR=Hpe(qpe),Wpe=e=>{const t=(e.versions||[]).concat();return t.length>1&&t.sort(pR.default),t.includes(hR.ROARR_VERSION)||t.push(hR.ROARR_VERSION),t.sort(pR.default),{sequence:0,...e,versions:t}};b2.createRoarrInitialGlobalStateBrowser=Wpe;var _2={};Object.defineProperty(_2,"__esModule",{value:!0});_2.getLogLevelName=void 0;const Kpe=e=>e<=10?"trace":e<=20?"debug":e<=30?"info":e<=40?"warn":e<=50?"error":"fatal";_2.getLogLevelName=Kpe;(function(e){var t=yt&&yt.__importDefault||function(d){return d&&d.__esModule?d:{default:d}};Object.defineProperty(e,"__esModule",{value:!0}),e.getLogLevelName=e.logLevels=e.Roarr=e.ROARR=void 0;const n=tj,r=b2,o=(0,t(Ak).default)(),a=(0,r.createRoarrInitialGlobalStateBrowser)(o.ROARR||{});e.ROARR=a,o.ROARR=a;const s=d=>JSON.stringify(d),l=(0,n.createLogger)(d=>{var f;a.write&&a.write(((f=a.serializeMessage)!==null&&f!==void 0?f:s)(d))});e.Roarr=l;var u=by;Object.defineProperty(e,"logLevels",{enumerable:!0,get:function(){return u.logLevels}});var c=_2;Object.defineProperty(e,"getLogLevelName",{enumerable:!0,get:function(){return c.getLogLevelName}})})(vy);var Qpe=yt&&yt.__rest||function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(e);i0?h("%c ".concat(f," %c").concat(c?" [".concat(String(c),"]:"):"","%c ").concat(s.message," %O"),m,_,b,d):h("%c ".concat(f," %c").concat(c?" [".concat(String(c),"]:"):"","%c ").concat(s.message),m,_,b)}}};n2.createLogWriter=ige;(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.createLogWriter=void 0;var t=n2;Object.defineProperty(e,"createLogWriter",{enumerable:!0,get:function(){return t.createLogWriter}})})(Mz);vy.ROARR.write=Mz.createLogWriter();const oj={};vy.Roarr.child(oj);const S2=tl(vy.Roarr.child(oj)),_e=e=>S2.get().child({namespace:e}),kGe=["trace","debug","info","warn","error","fatal"],AGe={trace:10,debug:20,info:30,warn:40,error:50,fatal:60},Qt=e=>{try{return JSON.parse(JSON.stringify(e))}catch{return"Error parsing object"}},oge=async e=>{const t={},n=await e.arrayBuffer(),r=Yfe(n).text,i=ch(r,"invokeai_metadata");if(i){const a=UB.safeParse(JSON.parse(i));a.success?t.metadata=a.data:_e("system").error({error:Qt(a.error)},"Problem reading metadata from image")}const o=ch(r,"invokeai_workflow");if(o){const a=WB.safeParse(JSON.parse(o));a.success?t.workflow=a.data:_e("system").error({error:Qt(a.error)},"Problem reading workflow from image")}return t};var y_=globalThis&&globalThis.__generator||function(e,t){var n={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},r,i,o,a;return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function s(u){return function(c){return l([u,c])}}function l(u){if(r)throw new TypeError("Generator is already executing.");for(;n;)try{if(r=1,i&&(o=u[0]&2?i.return:u[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,u[1])).done)return o;switch(i=0,o&&(u=[u[0]&2,o.value]),u[0]){case 0:case 1:o=u;break;case 4:return n.label++,{value:u[1],done:!1};case 5:n.label++,i=u[1],u=[0];continue;case 7:u=n.ops.pop(),n.trys.pop();continue;default:if(o=n.trys,!(o=o.length>0&&o[o.length-1])&&(u[0]===6||u[0]===2)){n=0;continue}if(u[0]===3&&(!o||u[1]>o[0]&&u[1]"u"||navigator.onLine===void 0?!0:navigator.onLine}function gge(){return typeof document>"u"?!0:document.visibilityState!=="hidden"}var bR=as;function lj(e,t){if(e===t||!(bR(e)&&bR(t)||Array.isArray(e)&&Array.isArray(t)))return t;for(var n=Object.keys(t),r=Object.keys(e),i=n.length===r.length,o=Array.isArray(t)?[]:{},a=0,s=n;a=200&&e.status<=299},yge=function(e){return/ion\/(vnd\.api\+)?json/.test(e.get("content-type")||"")};function SR(e){if(!as(e))return e;for(var t=wr({},e),n=0,r=Object.entries(t);n"u"&&s===_R&&console.warn("Warning: `fetch` is not available. Please supply a custom `fetchFn` property to use `fetchBaseQuery` on SSR environments."),function(g,y){return __(t,null,function(){var S,w,x,C,k,T,P,$,O,E,A,D,L,M,R,N,B,U,G,Y,ee,J,j,Q,ne,se,ve,ce,bt,ot,ze,mt,Pe,Jt,Ar,Dn;return y_(this,function(kn){switch(kn.label){case 0:return S=y.signal,w=y.getState,x=y.extra,C=y.endpoint,k=y.forced,T=y.type,$=typeof g=="string"?{url:g}:g,O=$.url,E=$.headers,A=E===void 0?new Headers(b.headers):E,D=$.params,L=D===void 0?void 0:D,M=$.responseHandler,R=M===void 0?m??"json":M,N=$.validateStatus,B=N===void 0?_??mge:N,U=$.timeout,G=U===void 0?p:U,Y=yR($,["url","headers","params","responseHandler","validateStatus","timeout"]),ee=wr($s(wr({},b),{signal:S}),Y),A=new Headers(SR(A)),J=ee,[4,o(A,{getState:w,extra:x,endpoint:C,forced:k,type:T})];case 1:J.headers=kn.sent()||A,j=function(en){return typeof en=="object"&&(as(en)||Array.isArray(en)||typeof en.toJSON=="function")},!ee.headers.has("content-type")&&j(ee.body)&&ee.headers.set("content-type",f),j(ee.body)&&c(ee.headers)&&(ee.body=JSON.stringify(ee.body,h)),L&&(Q=~O.indexOf("?")?"&":"?",ne=l?l(L):new URLSearchParams(SR(L)),O+=Q+ne),O=hge(r,O),se=new Request(O,ee),ve=se.clone(),P={request:ve},bt=!1,ot=G&&setTimeout(function(){bt=!0,y.abort()},G),kn.label=2;case 2:return kn.trys.push([2,4,5,6]),[4,s(se)];case 3:return ce=kn.sent(),[3,6];case 4:return ze=kn.sent(),[2,{error:{status:bt?"TIMEOUT_ERROR":"FETCH_ERROR",error:String(ze)},meta:P}];case 5:return ot&&clearTimeout(ot),[7];case 6:mt=ce.clone(),P.response=mt,Jt="",kn.label=7;case 7:return kn.trys.push([7,9,,10]),[4,Promise.all([v(ce,R).then(function(en){return Pe=en},function(en){return Ar=en}),mt.text().then(function(en){return Jt=en},function(){})])];case 8:if(kn.sent(),Ar)throw Ar;return[3,10];case 9:return Dn=kn.sent(),[2,{error:{status:"PARSING_ERROR",originalStatus:ce.status,data:Jt,error:String(Dn)},meta:P}];case 10:return[2,B(ce,Pe)?{data:Pe,meta:P}:{error:{status:ce.status,data:Pe},meta:P}]}})})};function v(g,y){return __(this,null,function(){var S;return y_(this,function(w){switch(w.label){case 0:return typeof y=="function"?[2,y(g)]:(y==="content-type"&&(y=c(g.headers)?"json":"text"),y!=="json"?[3,2]:[4,g.text()]);case 1:return S=w.sent(),[2,S.length?JSON.parse(S):null];case 2:return[2,g.text()]}})})}}var xR=function(){function e(t,n){n===void 0&&(n=void 0),this.value=t,this.meta=n}return e}(),Rk=Ne("__rtkq/focused"),uj=Ne("__rtkq/unfocused"),Ok=Ne("__rtkq/online"),cj=Ne("__rtkq/offline"),Ys;(function(e){e.query="query",e.mutation="mutation"})(Ys||(Ys={}));function dj(e){return e.type===Ys.query}function bge(e){return e.type===Ys.mutation}function fj(e,t,n,r,i,o){return _ge(e)?e(t,n,r,i).map(yE).map(o):Array.isArray(e)?e.map(yE).map(o):[]}function _ge(e){return typeof e=="function"}function yE(e){return typeof e=="string"?{type:e}:e}function kC(e){return e!=null}var i0=Symbol("forceQueryFn"),vE=function(e){return typeof e[i0]=="function"};function Sge(e){var t=e.serializeQueryArgs,n=e.queryThunk,r=e.mutationThunk,i=e.api,o=e.context,a=new Map,s=new Map,l=i.internalActions,u=l.unsubscribeQueryResult,c=l.removeMutationResult,d=l.updateSubscriptionOptions;return{buildInitiateQuery:v,buildInitiateMutation:g,getRunningQueryThunk:p,getRunningMutationThunk:m,getRunningQueriesThunk:_,getRunningMutationsThunk:b,getRunningOperationPromises:h,removalWarning:f};function f(){throw new Error(`This method had to be removed due to a conceptual bug in RTK. + Please see https://github.com/reduxjs/redux-toolkit/pull/2481 for details. + See https://redux-toolkit.js.org/rtk-query/usage/server-side-rendering for new guidance on SSR.`)}function h(){typeof process<"u";var y=function(S){return Array.from(S.values()).flatMap(function(w){return w?Object.values(w):[]})};return v_(v_([],y(a)),y(s)).filter(kC)}function p(y,S){return function(w){var x,C=o.endpointDefinitions[y],k=t({queryArgs:S,endpointDefinition:C,endpointName:y});return(x=a.get(w))==null?void 0:x[k]}}function m(y,S){return function(w){var x;return(x=s.get(w))==null?void 0:x[S]}}function _(){return function(y){return Object.values(a.get(y)||{}).filter(kC)}}function b(){return function(y){return Object.values(s.get(y)||{}).filter(kC)}}function v(y,S){var w=function(x,C){var k=C===void 0?{}:C,T=k.subscribe,P=T===void 0?!0:T,$=k.forceRefetch,O=k.subscriptionOptions,E=i0,A=k[E];return function(D,L){var M,R,N=t({queryArgs:x,endpointDefinition:S,endpointName:y}),B=n((M={type:"query",subscribe:P,forceRefetch:$,subscriptionOptions:O,endpointName:y,originalArgs:x,queryCacheKey:N},M[i0]=A,M)),U=i.endpoints[y].select(x),G=D(B),Y=U(L()),ee=G.requestId,J=G.abort,j=Y.requestId!==ee,Q=(R=a.get(D))==null?void 0:R[N],ne=function(){return U(L())},se=Object.assign(A?G.then(ne):j&&!Q?Promise.resolve(Y):Promise.all([Q,G]).then(ne),{arg:x,requestId:ee,subscriptionOptions:O,queryCacheKey:N,abort:J,unwrap:function(){return __(this,null,function(){var ce;return y_(this,function(bt){switch(bt.label){case 0:return[4,se];case 1:if(ce=bt.sent(),ce.isError)throw ce.error;return[2,ce.data]}})})},refetch:function(){return D(w(x,{subscribe:!1,forceRefetch:!0}))},unsubscribe:function(){P&&D(u({queryCacheKey:N,requestId:ee}))},updateSubscriptionOptions:function(ce){se.subscriptionOptions=ce,D(d({endpointName:y,requestId:ee,queryCacheKey:N,options:ce}))}});if(!Q&&!j&&!A){var ve=a.get(D)||{};ve[N]=se,a.set(D,ve),se.then(function(){delete ve[N],Object.keys(ve).length||a.delete(D)})}return se}};return w}function g(y){return function(S,w){var x=w===void 0?{}:w,C=x.track,k=C===void 0?!0:C,T=x.fixedCacheKey;return function(P,$){var O=r({type:"mutation",endpointName:y,originalArgs:S,track:k,fixedCacheKey:T}),E=P(O),A=E.requestId,D=E.abort,L=E.unwrap,M=E.unwrap().then(function(U){return{data:U}}).catch(function(U){return{error:U}}),R=function(){P(c({requestId:A,fixedCacheKey:T}))},N=Object.assign(M,{arg:E.arg,requestId:A,abort:D,unwrap:L,unsubscribe:R,reset:R}),B=s.get(P)||{};return s.set(P,B),B[A]=N,N.then(function(){delete B[A],Object.keys(B).length||s.delete(P)}),T&&(B[T]=N,N.then(function(){B[T]===N&&(delete B[T],Object.keys(B).length||s.delete(P))})),N}}}}function wR(e){return e}function xge(e){var t=this,n=e.reducerPath,r=e.baseQuery,i=e.context.endpointDefinitions,o=e.serializeQueryArgs,a=e.api,s=function(g,y,S){return function(w){var x=i[g];w(a.internalActions.queryResultPatched({queryCacheKey:o({queryArgs:y,endpointDefinition:x,endpointName:g}),patches:S}))}},l=function(g,y,S){return function(w,x){var C,k,T=a.endpoints[g].select(y)(x()),P={patches:[],inversePatches:[],undo:function(){return w(a.util.patchQueryData(g,y,P.inversePatches))}};if(T.status===er.uninitialized)return P;if("data"in T)if(Ao(T.data)){var $=W4(T.data,S),O=$[1],E=$[2];(C=P.patches).push.apply(C,O),(k=P.inversePatches).push.apply(k,E)}else{var A=S(T.data);P.patches.push({op:"replace",path:[],value:A}),P.inversePatches.push({op:"replace",path:[],value:T.data})}return w(a.util.patchQueryData(g,y,P.patches)),P}},u=function(g,y,S){return function(w){var x;return w(a.endpoints[g].initiate(y,(x={subscribe:!1,forceRefetch:!0},x[i0]=function(){return{data:S}},x)))}},c=function(g,y){return __(t,[g,y],function(S,w){var x,C,k,T,P,$,O,E,A,D,L,M,R,N,B,U,G,Y,ee=w.signal,J=w.abort,j=w.rejectWithValue,Q=w.fulfillWithValue,ne=w.dispatch,se=w.getState,ve=w.extra;return y_(this,function(ce){switch(ce.label){case 0:x=i[S.endpointName],ce.label=1;case 1:return ce.trys.push([1,8,,13]),C=wR,k=void 0,T={signal:ee,abort:J,dispatch:ne,getState:se,extra:ve,endpoint:S.endpointName,type:S.type,forced:S.type==="query"?d(S,se()):void 0},P=S.type==="query"?S[i0]:void 0,P?(k=P(),[3,6]):[3,2];case 2:return x.query?[4,r(x.query(S.originalArgs),T,x.extraOptions)]:[3,4];case 3:return k=ce.sent(),x.transformResponse&&(C=x.transformResponse),[3,6];case 4:return[4,x.queryFn(S.originalArgs,T,x.extraOptions,function(bt){return r(bt,T,x.extraOptions)})];case 5:k=ce.sent(),ce.label=6;case 6:if(typeof process<"u",k.error)throw new xR(k.error,k.meta);return L=Q,[4,C(k.data,k.meta,S.originalArgs)];case 7:return[2,L.apply(void 0,[ce.sent(),(G={fulfilledTimeStamp:Date.now(),baseQueryMeta:k.meta},G[td]=!0,G)])];case 8:if(M=ce.sent(),R=M,!(R instanceof xR))return[3,12];N=wR,x.query&&x.transformErrorResponse&&(N=x.transformErrorResponse),ce.label=9;case 9:return ce.trys.push([9,11,,12]),B=j,[4,N(R.value,R.meta,S.originalArgs)];case 10:return[2,B.apply(void 0,[ce.sent(),(Y={baseQueryMeta:R.meta},Y[td]=!0,Y)])];case 11:return U=ce.sent(),R=U,[3,12];case 12:throw typeof process<"u",console.error(R),R;case 13:return[2]}})})};function d(g,y){var S,w,x,C,k=(w=(S=y[n])==null?void 0:S.queries)==null?void 0:w[g.queryCacheKey],T=(x=y[n])==null?void 0:x.config.refetchOnMountOrArgChange,P=k==null?void 0:k.fulfilledTimeStamp,$=(C=g.forceRefetch)!=null?C:g.subscribe&&T;return $?$===!0||(Number(new Date)-Number(P))/1e3>=$:!1}var f=zb(n+"/executeQuery",c,{getPendingMeta:function(){var g;return g={startedTimeStamp:Date.now()},g[td]=!0,g},condition:function(g,y){var S=y.getState,w,x,C,k=S(),T=(x=(w=k[n])==null?void 0:w.queries)==null?void 0:x[g.queryCacheKey],P=T==null?void 0:T.fulfilledTimeStamp,$=g.originalArgs,O=T==null?void 0:T.originalArgs,E=i[g.endpointName];return vE(g)?!0:(T==null?void 0:T.status)==="pending"?!1:d(g,k)||dj(E)&&((C=E==null?void 0:E.forceRefetch)!=null&&C.call(E,{currentArg:$,previousArg:O,endpointState:T,state:k}))?!0:!P},dispatchConditionRejection:!0}),h=zb(n+"/executeMutation",c,{getPendingMeta:function(){var g;return g={startedTimeStamp:Date.now()},g[td]=!0,g}}),p=function(g){return"force"in g},m=function(g){return"ifOlderThan"in g},_=function(g,y,S){return function(w,x){var C=p(S)&&S.force,k=m(S)&&S.ifOlderThan,T=function(E){return E===void 0&&(E=!0),a.endpoints[g].initiate(y,{forceRefetch:E})},P=a.endpoints[g].select(y)(x());if(C)w(T());else if(k){var $=P==null?void 0:P.fulfilledTimeStamp;if(!$){w(T());return}var O=(Number(new Date)-Number(new Date($)))/1e3>=k;O&&w(T())}else w(T(!1))}};function b(g){return function(y){var S,w;return((w=(S=y==null?void 0:y.meta)==null?void 0:S.arg)==null?void 0:w.endpointName)===g}}function v(g,y){return{matchPending:ah($S(g),b(y)),matchFulfilled:ah(Sc(g),b(y)),matchRejected:ah(Uh(g),b(y))}}return{queryThunk:f,mutationThunk:h,prefetch:_,updateQueryData:l,upsertQueryData:u,patchQueryData:s,buildMatchThunkActions:v}}function hj(e,t,n,r){return fj(n[e.meta.arg.endpointName][t],Sc(e)?e.payload:void 0,J0(e)?e.payload:void 0,e.meta.arg.originalArgs,"baseQueryMeta"in e.meta?e.meta.baseQueryMeta:void 0,r)}function xv(e,t,n){var r=e[t];r&&n(r)}function o0(e){var t;return(t="arg"in e?e.arg.fixedCacheKey:e.fixedCacheKey)!=null?t:e.requestId}function CR(e,t,n){var r=e[o0(t)];r&&n(r)}var Kp={};function wge(e){var t=e.reducerPath,n=e.queryThunk,r=e.mutationThunk,i=e.context,o=i.endpointDefinitions,a=i.apiUid,s=i.extractRehydrationInfo,l=i.hasRehydrationInfo,u=e.assertTagType,c=e.config,d=Ne(t+"/resetApiState"),f=nr({name:t+"/queries",initialState:Kp,reducers:{removeQueryResult:{reducer:function(S,w){var x=w.payload.queryCacheKey;delete S[x]},prepare:R1()},queryResultPatched:function(S,w){var x=w.payload,C=x.queryCacheKey,k=x.patches;xv(S,C,function(T){T.data=B3(T.data,k.concat())})}},extraReducers:function(S){S.addCase(n.pending,function(w,x){var C=x.meta,k=x.meta.arg,T,P,$=vE(k);(k.subscribe||$)&&((P=w[T=k.queryCacheKey])!=null||(w[T]={status:er.uninitialized,endpointName:k.endpointName})),xv(w,k.queryCacheKey,function(O){O.status=er.pending,O.requestId=$&&O.requestId?O.requestId:C.requestId,k.originalArgs!==void 0&&(O.originalArgs=k.originalArgs),O.startedTimeStamp=C.startedTimeStamp})}).addCase(n.fulfilled,function(w,x){var C=x.meta,k=x.payload;xv(w,C.arg.queryCacheKey,function(T){var P;if(!(T.requestId!==C.requestId&&!vE(C.arg))){var $=o[C.arg.endpointName].merge;if(T.status=er.fulfilled,$)if(T.data!==void 0){var O=C.fulfilledTimeStamp,E=C.arg,A=C.baseQueryMeta,D=C.requestId,L=_c(T.data,function(M){return $(M,k,{arg:E.originalArgs,baseQueryMeta:A,fulfilledTimeStamp:O,requestId:D})});T.data=L}else T.data=k;else T.data=(P=o[C.arg.endpointName].structuralSharing)==null||P?lj(oo(T.data)?z4(T.data):T.data,k):k;delete T.error,T.fulfilledTimeStamp=C.fulfilledTimeStamp}})}).addCase(n.rejected,function(w,x){var C=x.meta,k=C.condition,T=C.arg,P=C.requestId,$=x.error,O=x.payload;xv(w,T.queryCacheKey,function(E){if(!k){if(E.requestId!==P)return;E.status=er.rejected,E.error=O??$}})}).addMatcher(l,function(w,x){for(var C=s(x).queries,k=0,T=Object.entries(C);k"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?Hge:qge;mj.useSyncExternalStore=Zh.useSyncExternalStore!==void 0?Zh.useSyncExternalStore:Wge;gj.exports=mj;var Kge=gj.exports,yj={exports:{}},vj={};/** + * @license React + * use-sync-external-store-shim/with-selector.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 x2=I,Qge=Kge;function Xge(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Yge=typeof Object.is=="function"?Object.is:Xge,Zge=Qge.useSyncExternalStore,Jge=x2.useRef,eme=x2.useEffect,tme=x2.useMemo,nme=x2.useDebugValue;vj.useSyncExternalStoreWithSelector=function(e,t,n,r,i){var o=Jge(null);if(o.current===null){var a={hasValue:!1,value:null};o.current=a}else a=o.current;o=tme(function(){function l(h){if(!u){if(u=!0,c=h,h=r(h),i!==void 0&&a.hasValue){var p=a.value;if(i(p,h))return d=p}return d=h}if(p=d,Yge(c,h))return p;var m=r(h);return i!==void 0&&i(p,m)?p:(c=h,d=m)}var u=!1,c,d,f=n===void 0?null:n;return[function(){return l(t())},f===null?void 0:function(){return l(f())}]},[t,n,r,i]);var s=Zge(e,o[0],o[1]);return eme(function(){a.hasValue=!0,a.value=s},[s]),nme(s),s};yj.exports=vj;var bj=yj.exports;const rme=mc(bj);function ime(e){e()}let _j=ime;const ome=e=>_j=e,ame=()=>_j,RR=Symbol.for("react-redux-context"),OR=typeof globalThis<"u"?globalThis:{};function sme(){var e;if(!I.createContext)return{};const t=(e=OR[RR])!=null?e:OR[RR]=new Map;let n=t.get(I.createContext);return n||(n=I.createContext(null),t.set(I.createContext,n)),n}const lc=sme();function Mk(e=lc){return function(){return I.useContext(e)}}const Sj=Mk(),lme=()=>{throw new Error("uSES not initialized!")};let xj=lme;const ume=e=>{xj=e},cme=(e,t)=>e===t;function dme(e=lc){const t=e===lc?Sj:Mk(e);return function(r,i={}){const{equalityFn:o=cme,stabilityCheck:a=void 0,noopCheck:s=void 0}=typeof i=="function"?{equalityFn:i}:i,{store:l,subscription:u,getServerState:c,stabilityCheck:d,noopCheck:f}=t();I.useRef(!0);const h=I.useCallback({[r.name](m){return r(m)}}[r.name],[r,d,a]),p=xj(u.addNestedSub,l.getState,c||l.getState,h,o);return I.useDebugValue(p),p}}const wj=dme();function S_(){return S_=Object.assign?Object.assign.bind():function(e){for(var t=1;t{let r=t;for(;r;)r.callback(),r=r.next})},get(){let r=[],i=t;for(;i;)r.push(i),i=i.next;return r},subscribe(r){let i=!0,o=n={callback:r,next:null,prev:n};return o.prev?o.prev.next=o:t=o,function(){!i||t===null||(i=!1,o.next?o.next.prev=o.prev:n=o.prev,o.prev?o.prev.next=o.next:t=o.next)}}}}const MR={notify(){},get:()=>[]};function wme(e,t){let n,r=MR;function i(d){return l(),r.subscribe(d)}function o(){r.notify()}function a(){c.onStateChange&&c.onStateChange()}function s(){return!!n}function l(){n||(n=t?t.addNestedSub(a):e.subscribe(a),r=xme())}function u(){n&&(n(),n=void 0,r.clear(),r=MR)}const c={addNestedSub:i,notifyNestedSubs:o,handleChangeWrapper:a,isSubscribed:s,trySubscribe:l,tryUnsubscribe:u,getListeners:()=>r};return c}const Cme=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",Eme=Cme?I.useLayoutEffect:I.useEffect;function NR(e,t){return e===t?e!==0||t!==0||1/e===1/t:e!==e&&t!==t}function x_(e,t){if(NR(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let i=0;i{const u=wme(e);return{store:e,subscription:u,getServerState:r?()=>r:void 0,stabilityCheck:i,noopCheck:o}},[e,r,i,o]),s=I.useMemo(()=>e.getState(),[e]);Eme(()=>{const{subscription:u}=a;return u.onStateChange=u.notifyNestedSubs,u.trySubscribe(),s!==e.getState()&&u.notifyNestedSubs(),()=>{u.tryUnsubscribe(),u.onStateChange=void 0}},[a,s]);const l=t||lc;return I.createElement(l.Provider,{value:a},n)}function Pj(e=lc){const t=e===lc?Sj:Mk(e);return function(){const{store:r}=t();return r}}const Ij=Pj();function kme(e=lc){const t=e===lc?Ij:Pj(e);return function(){return t().dispatch}}const Rj=kme();ume(bj.useSyncExternalStoreWithSelector);ome(Uo.unstable_batchedUpdates);var Ame=globalThis&&globalThis.__spreadArray||function(e,t){for(var n=0,r=t.length,i=e.length;nHme({headers:{...e?{Authorization:`Bearer ${e}`}:{},...n?{"project-id":n}:{}},baseUrl:`${t??""}`}));const Yme=["Board","BoardImagesTotal","BoardAssetsTotal","Image","ImageNameList","ImageList","ImageMetadata","ImageMetadataFromFile","Model","SessionQueueItem","SessionQueueItemDTO","SessionQueueItemDTOList","SessionQueueStatus","SessionProcessorStatus","BatchStatus","InvocationCacheStatus"],Mt="LIST",Zme=async(e,t,n)=>{const r=a0.get(),i=Jh.get(),o=s0.get();return vge({baseUrl:`${r??""}/api/v1`,prepareHeaders:s=>(i&&s.set("Authorization",`Bearer ${i}`),o&&s.set("project-id",o),s)})(e,t,n)},ls=Vme({baseQuery:Zme,reducerPath:"api",tagTypes:Yme,endpoints:()=>({})}),Jme=(e,t)=>{const n=new Date(e),r=new Date(t);return n>r?1:ne==null,o0e=e=>encodeURIComponent(e).replace(/[!'()*]/g,t=>`%${t.charCodeAt(0).toString(16).toUpperCase()}`),_E=Symbol("encodeFragmentIdentifier");function a0e(e){switch(e.arrayFormat){case"index":return t=>(n,r)=>{const i=n.length;return r===void 0||e.skipNull&&r===null||e.skipEmptyString&&r===""?n:r===null?[...n,[Mr(t,e),"[",i,"]"].join("")]:[...n,[Mr(t,e),"[",Mr(i,e),"]=",Mr(r,e)].join("")]};case"bracket":return t=>(n,r)=>r===void 0||e.skipNull&&r===null||e.skipEmptyString&&r===""?n:r===null?[...n,[Mr(t,e),"[]"].join("")]:[...n,[Mr(t,e),"[]=",Mr(r,e)].join("")];case"colon-list-separator":return t=>(n,r)=>r===void 0||e.skipNull&&r===null||e.skipEmptyString&&r===""?n:r===null?[...n,[Mr(t,e),":list="].join("")]:[...n,[Mr(t,e),":list=",Mr(r,e)].join("")];case"comma":case"separator":case"bracket-separator":{const t=e.arrayFormat==="bracket-separator"?"[]=":"=";return n=>(r,i)=>i===void 0||e.skipNull&&i===null||e.skipEmptyString&&i===""?r:(i=i===null?"":i,r.length===0?[[Mr(n,e),t,Mr(i,e)].join("")]:[[r,Mr(i,e)].join(e.arrayFormatSeparator)])}default:return t=>(n,r)=>r===void 0||e.skipNull&&r===null||e.skipEmptyString&&r===""?n:r===null?[...n,Mr(t,e)]:[...n,[Mr(t,e),"=",Mr(r,e)].join("")]}}function s0e(e){let t;switch(e.arrayFormat){case"index":return(n,r,i)=>{if(t=/\[(\d*)]$/.exec(n),n=n.replace(/\[\d*]$/,""),!t){i[n]=r;return}i[n]===void 0&&(i[n]={}),i[n][t[1]]=r};case"bracket":return(n,r,i)=>{if(t=/(\[])$/.exec(n),n=n.replace(/\[]$/,""),!t){i[n]=r;return}if(i[n]===void 0){i[n]=[r];return}i[n]=[...i[n],r]};case"colon-list-separator":return(n,r,i)=>{if(t=/(:list)$/.exec(n),n=n.replace(/:list$/,""),!t){i[n]=r;return}if(i[n]===void 0){i[n]=[r];return}i[n]=[...i[n],r]};case"comma":case"separator":return(n,r,i)=>{const o=typeof r=="string"&&r.includes(e.arrayFormatSeparator),a=typeof r=="string"&&!o&&Sl(r,e).includes(e.arrayFormatSeparator);r=a?Sl(r,e):r;const s=o||a?r.split(e.arrayFormatSeparator).map(l=>Sl(l,e)):r===null?r:Sl(r,e);i[n]=s};case"bracket-separator":return(n,r,i)=>{const o=/(\[])$/.test(n);if(n=n.replace(/\[]$/,""),!o){i[n]=r&&Sl(r,e);return}const a=r===null?[]:r.split(e.arrayFormatSeparator).map(s=>Sl(s,e));if(i[n]===void 0){i[n]=a;return}i[n]=[...i[n],...a]};default:return(n,r,i)=>{if(i[n]===void 0){i[n]=r;return}i[n]=[...[i[n]].flat(),r]}}}function Nj(e){if(typeof e!="string"||e.length!==1)throw new TypeError("arrayFormatSeparator must be single character string")}function Mr(e,t){return t.encode?t.strict?o0e(e):encodeURIComponent(e):e}function Sl(e,t){return t.decode?n0e(e):e}function $j(e){return Array.isArray(e)?e.sort():typeof e=="object"?$j(Object.keys(e)).sort((t,n)=>Number(t)-Number(n)).map(t=>e[t]):e}function Dj(e){const t=e.indexOf("#");return t!==-1&&(e=e.slice(0,t)),e}function l0e(e){let t="";const n=e.indexOf("#");return n!==-1&&(t=e.slice(n)),t}function zR(e,t){return t.parseNumbers&&!Number.isNaN(Number(e))&&typeof e=="string"&&e.trim()!==""?e=Number(e):t.parseBooleans&&e!==null&&(e.toLowerCase()==="true"||e.toLowerCase()==="false")&&(e=e.toLowerCase()==="true"),e}function Bk(e){e=Dj(e);const t=e.indexOf("?");return t===-1?"":e.slice(t+1)}function zk(e,t){t={decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1,...t},Nj(t.arrayFormatSeparator);const n=s0e(t),r=Object.create(null);if(typeof e!="string"||(e=e.trim().replace(/^[?#&]/,""),!e))return r;for(const i of e.split("&")){if(i==="")continue;const o=t.decode?i.replace(/\+/g," "):i;let[a,s]=Mj(o,"=");a===void 0&&(a=o),s=s===void 0?null:["comma","separator","bracket-separator"].includes(t.arrayFormat)?s:Sl(s,t),n(Sl(a,t),s,r)}for(const[i,o]of Object.entries(r))if(typeof o=="object"&&o!==null)for(const[a,s]of Object.entries(o))o[a]=zR(s,t);else r[i]=zR(o,t);return t.sort===!1?r:(t.sort===!0?Object.keys(r).sort():Object.keys(r).sort(t.sort)).reduce((i,o)=>{const a=r[o];return a&&typeof a=="object"&&!Array.isArray(a)?i[o]=$j(a):i[o]=a,i},Object.create(null))}function Lj(e,t){if(!e)return"";t={encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:",",...t},Nj(t.arrayFormatSeparator);const n=a=>t.skipNull&&i0e(e[a])||t.skipEmptyString&&e[a]==="",r=a0e(t),i={};for(const[a,s]of Object.entries(e))n(a)||(i[a]=s);const o=Object.keys(i);return t.sort!==!1&&o.sort(t.sort),o.map(a=>{const s=e[a];return s===void 0?"":s===null?Mr(a,t):Array.isArray(s)?s.length===0&&t.arrayFormat==="bracket-separator"?Mr(a,t)+"[]":s.reduce(r(a),[]).join("&"):Mr(a,t)+"="+Mr(s,t)}).filter(a=>a.length>0).join("&")}function Fj(e,t){var i;t={decode:!0,...t};let[n,r]=Mj(e,"#");return n===void 0&&(n=e),{url:((i=n==null?void 0:n.split("?"))==null?void 0:i[0])??"",query:zk(Bk(e),t),...t&&t.parseFragmentIdentifier&&r?{fragmentIdentifier:Sl(r,t)}:{}}}function Bj(e,t){t={encode:!0,strict:!0,[_E]:!0,...t};const n=Dj(e.url).split("?")[0]||"",r=Bk(e.url),i={...zk(r,{sort:!1}),...e.query};let o=Lj(i,t);o&&(o=`?${o}`);let a=l0e(e.url);if(e.fragmentIdentifier){const s=new URL(n);s.hash=e.fragmentIdentifier,a=t[_E]?s.hash:`#${e.fragmentIdentifier}`}return`${n}${o}${a}`}function zj(e,t,n){n={parseFragmentIdentifier:!0,[_E]:!1,...n};const{url:r,query:i,fragmentIdentifier:o}=Fj(e,n);return Bj({url:r,query:r0e(i,t),fragmentIdentifier:o},n)}function u0e(e,t,n){const r=Array.isArray(t)?i=>!t.includes(i):(i,o)=>!t(i,o);return zj(e,r,n)}const Qg=Object.freeze(Object.defineProperty({__proto__:null,exclude:u0e,extract:Bk,parse:zk,parseUrl:Fj,pick:zj,stringify:Lj,stringifyUrl:Bj},Symbol.toStringTag,{value:"Module"})),Mc=(e,t)=>{if(!e)return!1;const n=l0.selectAll(e);if(n.length<=1)return!0;const r=[],i=[];for(let o=0;o=s}else{const o=i[i.length-1];if(!o)return!1;const a=new Date(t.created_at),s=new Date(o.created_at);return a>=s}},aa=e=>ii.includes(e.image_category)?ii:$u,Vn=cs({selectId:e=>e.image_name,sortComparer:(e,t)=>e.starred&&!t.starred?-1:!e.starred&&t.starred?1:Jme(t.created_at,e.created_at)}),l0=Vn.getSelectors(),Bo=e=>`images/?${Qg.stringify(e,{arrayFormat:"none"})}`,xi=ls.injectEndpoints({endpoints:e=>({listBoards:e.query({query:t=>({url:"boards/",params:t}),providesTags:t=>{const n=[{type:"Board",id:Mt}];return t&&n.push(...t.items.map(({board_id:r})=>({type:"Board",id:r}))),n}}),listAllBoards:e.query({query:()=>({url:"boards/",params:{all:!0}}),providesTags:t=>{const n=[{type:"Board",id:Mt}];return t&&n.push(...t.map(({board_id:r})=>({type:"Board",id:r}))),n}}),listAllImageNamesForBoard:e.query({query:t=>({url:`boards/${t}/image_names`}),providesTags:(t,n,r)=>[{type:"ImageNameList",id:r}],keepUnusedDataFor:0}),getBoardImagesTotal:e.query({query:t=>({url:Bo({board_id:t??"none",categories:ii,is_intermediate:!1,limit:0,offset:0}),method:"GET"}),providesTags:(t,n,r)=>[{type:"BoardImagesTotal",id:r??"none"}],transformResponse:t=>t.total}),getBoardAssetsTotal:e.query({query:t=>({url:Bo({board_id:t??"none",categories:$u,is_intermediate:!1,limit:0,offset:0}),method:"GET"}),providesTags:(t,n,r)=>[{type:"BoardAssetsTotal",id:r??"none"}],transformResponse:t=>t.total}),createBoard:e.mutation({query:t=>({url:"boards/",method:"POST",params:{board_name:t}}),invalidatesTags:[{type:"Board",id:Mt}]}),updateBoard:e.mutation({query:({board_id:t,changes:n})=>({url:`boards/${t}`,method:"PATCH",body:n}),invalidatesTags:(t,n,r)=>[{type:"Board",id:r.board_id}]})})}),{useListBoardsQuery:PGe,useListAllBoardsQuery:IGe,useGetBoardImagesTotalQuery:RGe,useGetBoardAssetsTotalQuery:OGe,useCreateBoardMutation:MGe,useUpdateBoardMutation:NGe,useListAllImageNamesForBoardQuery:$Ge}=xi,me=ls.injectEndpoints({endpoints:e=>({listImages:e.query({query:t=>({url:Bo(t),method:"GET"}),providesTags:(t,n,{board_id:r,categories:i})=>[{type:"ImageList",id:Bo({board_id:r,categories:i})}],serializeQueryArgs:({queryArgs:t})=>{const{board_id:n,categories:r}=t;return Bo({board_id:n,categories:r})},transformResponse(t){const{items:n}=t;return Vn.addMany(Vn.getInitialState(),n)},merge:(t,n)=>{Vn.addMany(t,l0.selectAll(n))},forceRefetch({currentArg:t,previousArg:n}){return(t==null?void 0:t.offset)!==(n==null?void 0:n.offset)},async onQueryStarted(t,{dispatch:n,queryFulfilled:r}){try{const{data:i}=await r;l0.selectAll(i).forEach(o=>{n(me.util.upsertQueryData("getImageDTO",o.image_name,o))})}catch{}},keepUnusedDataFor:86400}),getIntermediatesCount:e.query({query:()=>({url:Bo({is_intermediate:!0})}),providesTags:["IntermediatesCount"],transformResponse:t=>t.total}),getImageDTO:e.query({query:t=>({url:`images/i/${t}`}),providesTags:(t,n,r)=>[{type:"Image",id:r}],keepUnusedDataFor:86400}),getImageMetadata:e.query({query:t=>({url:`images/i/${t}/metadata`}),providesTags:(t,n,r)=>[{type:"ImageMetadata",id:r}],keepUnusedDataFor:86400}),getImageMetadataFromFile:e.query({queryFn:async(t,n,r,i)=>{var o;if(t.shouldFetchMetadataFromApi){let a;const s=await i(`images/i/${t.image.image_name}/metadata`);if(s.data){const l=UB.safeParse((o=s.data)==null?void 0:o.metadata);l.success&&(a=l.data)}return{data:{metadata:a}}}else{const a=Jh.get(),s=s0.get(),u=await ble.fetchBaseQuery({baseUrl:"",prepareHeaders:d=>(a&&d.set("Authorization",`Bearer ${a}`),s&&d.set("project-id",s),d),responseHandler:async d=>await d.blob()})(t.image.image_url,n,r);return{data:await oge(u.data)}}},providesTags:(t,n,{image:r})=>[{type:"ImageMetadataFromFile",id:r.image_name}],keepUnusedDataFor:86400}),clearIntermediates:e.mutation({query:()=>({url:"images/clear-intermediates",method:"POST"}),invalidatesTags:["IntermediatesCount"]}),deleteImage:e.mutation({query:({image_name:t})=>({url:`images/i/${t}`,method:"DELETE"}),invalidatesTags:(t,n,{board_id:r})=>[{type:"BoardImagesTotal",id:r??"none"},{type:"BoardAssetsTotal",id:r??"none"}],async onQueryStarted(t,{dispatch:n,queryFulfilled:r}){const{image_name:i,board_id:o}=t,a={board_id:o??"none",categories:aa(t)},s=n(me.util.updateQueryData("listImages",a,l=>{Vn.removeOne(l,i)}));try{await r}catch{s.undo()}}}),deleteImages:e.mutation({query:({imageDTOs:t})=>({url:"images/delete",method:"POST",body:{image_names:t.map(r=>r.image_name)}}),invalidatesTags:(t,n,{imageDTOs:r})=>{var o;const i=(o=r[0])==null?void 0:o.board_id;return[{type:"BoardImagesTotal",id:i??"none"},{type:"BoardAssetsTotal",id:i??"none"}]},async onQueryStarted({imageDTOs:t},{dispatch:n,queryFulfilled:r}){try{const{data:i}=await r,o=hk(t,"image_name");i.deleted_images.forEach(a=>{const s=o[a];if(s){const l={board_id:s.board_id??"none",categories:aa(s)};n(me.util.updateQueryData("listImages",l,u=>{Vn.removeOne(u,a)}))}})}catch{}}}),changeImageIsIntermediate:e.mutation({query:({imageDTO:t,is_intermediate:n})=>({url:`images/i/${t.image_name}`,method:"PATCH",body:{is_intermediate:n}}),invalidatesTags:(t,n,{imageDTO:r})=>[{type:"BoardImagesTotal",id:r.board_id??"none"},{type:"BoardAssetsTotal",id:r.board_id??"none"}],async onQueryStarted({imageDTO:t,is_intermediate:n},{dispatch:r,queryFulfilled:i,getState:o}){const a=[];a.push(r(me.util.updateQueryData("getImageDTO",t.image_name,l=>{Object.assign(l,{is_intermediate:n})})));const s=aa(t);if(n)a.push(r(me.util.updateQueryData("listImages",{board_id:t.board_id??"none",categories:s},l=>{Vn.removeOne(l,t.image_name)})));else{const l={board_id:t.board_id??"none",categories:s},u=me.endpoints.listImages.select(l)(o()),{data:c}=ii.includes(t.image_category)?xi.endpoints.getBoardImagesTotal.select(t.board_id??"none")(o()):xi.endpoints.getBoardAssetsTotal.select(t.board_id??"none")(o()),d=u.data&&u.data.ids.length>=(c??0),f=Mc(u.data,t);(d||f)&&a.push(r(me.util.updateQueryData("listImages",l,h=>{Vn.upsertOne(h,t)})))}try{await i}catch{a.forEach(l=>l.undo())}}}),changeImageSessionId:e.mutation({query:({imageDTO:t,session_id:n})=>({url:`images/i/${t.image_name}`,method:"PATCH",body:{session_id:n}}),invalidatesTags:(t,n,{imageDTO:r})=>[{type:"BoardImagesTotal",id:r.board_id??"none"},{type:"BoardAssetsTotal",id:r.board_id??"none"}],async onQueryStarted({imageDTO:t,session_id:n},{dispatch:r,queryFulfilled:i}){const o=[];o.push(r(me.util.updateQueryData("getImageDTO",t.image_name,a=>{Object.assign(a,{session_id:n})})));try{await i}catch{o.forEach(a=>a.undo())}}}),starImages:e.mutation({query:({imageDTOs:t})=>({url:"images/star",method:"POST",body:{image_names:t.map(n=>n.image_name)}}),invalidatesTags:(t,n,{imageDTOs:r})=>{if(r[0]){const i=aa(r[0]),o=r[0].board_id;return[{type:"ImageList",id:Bo({board_id:o,categories:i})},{type:"Board",id:o}]}return[]},async onQueryStarted({imageDTOs:t},{dispatch:n,queryFulfilled:r,getState:i}){try{const{data:o}=await r,a=t.filter(u=>o.updated_image_names.includes(u.image_name));if(!a[0])return;const s=aa(a[0]),l=a[0].board_id;a.forEach(u=>{const{image_name:c}=u;n(me.util.updateQueryData("getImageDTO",c,_=>{_.starred=!0}));const d={board_id:l??"none",categories:s},f=me.endpoints.listImages.select(d)(i()),{data:h}=ii.includes(u.image_category)?xi.endpoints.getBoardImagesTotal.select(l??"none")(i()):xi.endpoints.getBoardAssetsTotal.select(l??"none")(i()),p=f.data&&f.data.ids.length>=(h??0),m=(h||0)>=fv?Mc(f.data,u):!0;(p||m)&&n(me.util.updateQueryData("listImages",d,_=>{Vn.upsertOne(_,{...u,starred:!0})}))})}catch{}}}),unstarImages:e.mutation({query:({imageDTOs:t})=>({url:"images/unstar",method:"POST",body:{image_names:t.map(n=>n.image_name)}}),invalidatesTags:(t,n,{imageDTOs:r})=>{if(r[0]){const i=aa(r[0]),o=r[0].board_id;return[{type:"ImageList",id:Bo({board_id:o,categories:i})},{type:"Board",id:o}]}return[]},async onQueryStarted({imageDTOs:t},{dispatch:n,queryFulfilled:r,getState:i}){try{const{data:o}=await r,a=t.filter(u=>o.updated_image_names.includes(u.image_name));if(!a[0])return;const s=aa(a[0]),l=a[0].board_id;a.forEach(u=>{const{image_name:c}=u;n(me.util.updateQueryData("getImageDTO",c,_=>{_.starred=!1}));const d={board_id:l??"none",categories:s},f=me.endpoints.listImages.select(d)(i()),{data:h}=ii.includes(u.image_category)?xi.endpoints.getBoardImagesTotal.select(l??"none")(i()):xi.endpoints.getBoardAssetsTotal.select(l??"none")(i()),p=f.data&&f.data.ids.length>=(h??0),m=(h||0)>=fv?Mc(f.data,u):!0;(p||m)&&n(me.util.updateQueryData("listImages",d,_=>{Vn.upsertOne(_,{...u,starred:!1})}))})}catch{}}}),uploadImage:e.mutation({query:({file:t,image_category:n,is_intermediate:r,session_id:i,board_id:o,crop_visible:a})=>{const s=new FormData;return s.append("file",t),{url:"images/upload",method:"POST",body:s,params:{image_category:n,is_intermediate:r,session_id:i,board_id:o==="none"?void 0:o,crop_visible:a}}},async onQueryStarted(t,{dispatch:n,queryFulfilled:r}){try{const{data:i}=await r;if(i.is_intermediate)return;n(me.util.upsertQueryData("getImageDTO",i.image_name,i));const o=aa(i);n(me.util.updateQueryData("listImages",{board_id:i.board_id??"none",categories:o},a=>{Vn.addOne(a,i)})),n(me.util.invalidateTags([{type:"BoardImagesTotal",id:i.board_id??"none"},{type:"BoardAssetsTotal",id:i.board_id??"none"}]))}catch{}}}),deleteBoard:e.mutation({query:t=>({url:`boards/${t}`,method:"DELETE"}),invalidatesTags:()=>[{type:"Board",id:Mt},{type:"ImageList",id:Bo({board_id:"none",categories:ii})},{type:"ImageList",id:Bo({board_id:"none",categories:$u})},{type:"BoardImagesTotal",id:"none"},{type:"BoardAssetsTotal",id:"none"}],async onQueryStarted(t,{dispatch:n,queryFulfilled:r}){try{const{data:i}=await r,{deleted_board_images:o}=i;o.forEach(l=>{n(me.util.updateQueryData("getImageDTO",l,u=>{u.board_id=void 0}))});const a=[{categories:ii},{categories:$u}],s=o.map(l=>({id:l,changes:{board_id:void 0}}));a.forEach(l=>{n(me.util.updateQueryData("listImages",l,u=>{Vn.updateMany(u,s)}))})}catch{}}}),deleteBoardAndImages:e.mutation({query:t=>({url:`boards/${t}`,method:"DELETE",params:{include_images:!0}}),invalidatesTags:()=>[{type:"Board",id:Mt},{type:"ImageList",id:Bo({board_id:"none",categories:ii})},{type:"ImageList",id:Bo({board_id:"none",categories:$u})},{type:"BoardImagesTotal",id:"none"},{type:"BoardAssetsTotal",id:"none"}],async onQueryStarted(t,{dispatch:n,queryFulfilled:r}){try{const{data:i}=await r,{deleted_images:o}=i;[{categories:ii},{categories:$u}].forEach(s=>{n(me.util.updateQueryData("listImages",s,l=>{Vn.removeMany(l,o)}))})}catch{}}}),addImageToBoard:e.mutation({query:({board_id:t,imageDTO:n})=>{const{image_name:r}=n;return{url:"board_images/",method:"POST",body:{board_id:t,image_name:r}}},invalidatesTags:(t,n,{board_id:r,imageDTO:i})=>[{type:"Board",id:r},{type:"BoardImagesTotal",id:r},{type:"BoardAssetsTotal",id:r},{type:"BoardImagesTotal",id:i.board_id??"none"},{type:"BoardAssetsTotal",id:i.board_id??"none"}],async onQueryStarted({board_id:t,imageDTO:n},{dispatch:r,queryFulfilled:i,getState:o}){const a=[],s=aa(n);if(a.push(r(me.util.updateQueryData("getImageDTO",n.image_name,l=>{l.board_id=t}))),!n.is_intermediate){a.push(r(me.util.updateQueryData("listImages",{board_id:n.board_id??"none",categories:s},h=>{Vn.removeOne(h,n.image_name)})));const l={board_id:t??"none",categories:s},u=me.endpoints.listImages.select(l)(o()),{data:c}=ii.includes(n.image_category)?xi.endpoints.getBoardImagesTotal.select(n.board_id??"none")(o()):xi.endpoints.getBoardAssetsTotal.select(n.board_id??"none")(o()),d=u.data&&u.data.ids.length>=(c??0),f=Mc(u.data,n);(d||f)&&a.push(r(me.util.updateQueryData("listImages",l,h=>{Vn.addOne(h,n)})))}try{await i}catch{a.forEach(l=>l.undo())}}}),removeImageFromBoard:e.mutation({query:({imageDTO:t})=>{const{image_name:n}=t;return{url:"board_images/",method:"DELETE",body:{image_name:n}}},invalidatesTags:(t,n,{imageDTO:r})=>{const{board_id:i}=r;return[{type:"Board",id:i??"none"},{type:"BoardImagesTotal",id:i??"none"},{type:"BoardAssetsTotal",id:i??"none"},{type:"BoardImagesTotal",id:"none"},{type:"BoardAssetsTotal",id:"none"}]},async onQueryStarted({imageDTO:t},{dispatch:n,queryFulfilled:r,getState:i}){const o=aa(t),a=[];a.push(n(me.util.updateQueryData("getImageDTO",t.image_name,f=>{f.board_id=void 0}))),a.push(n(me.util.updateQueryData("listImages",{board_id:t.board_id??"none",categories:o},f=>{Vn.removeOne(f,t.image_name)})));const s={board_id:"none",categories:o},l=me.endpoints.listImages.select(s)(i()),{data:u}=ii.includes(t.image_category)?xi.endpoints.getBoardImagesTotal.select(t.board_id??"none")(i()):xi.endpoints.getBoardAssetsTotal.select(t.board_id??"none")(i()),c=l.data&&l.data.ids.length>=(u??0),d=Mc(l.data,t);(c||d)&&a.push(n(me.util.updateQueryData("listImages",s,f=>{Vn.upsertOne(f,t)})));try{await r}catch{a.forEach(f=>f.undo())}}}),addImagesToBoard:e.mutation({query:({board_id:t,imageDTOs:n})=>({url:"board_images/batch",method:"POST",body:{image_names:n.map(r=>r.image_name),board_id:t}}),invalidatesTags:(t,n,{imageDTOs:r,board_id:i})=>{var a;const o=(a=r[0])==null?void 0:a.board_id;return[{type:"Board",id:i??"none"},{type:"BoardImagesTotal",id:i??"none"},{type:"BoardAssetsTotal",id:i??"none"},{type:"BoardImagesTotal",id:o??"none"},{type:"BoardAssetsTotal",id:o??"none"},{type:"BoardImagesTotal",id:"none"},{type:"BoardAssetsTotal",id:"none"}]},async onQueryStarted({board_id:t,imageDTOs:n},{dispatch:r,queryFulfilled:i,getState:o}){try{const{data:a}=await i,{added_image_names:s}=a;s.forEach(l=>{r(me.util.updateQueryData("getImageDTO",l,b=>{b.board_id=t}));const u=n.find(b=>b.image_name===l);if(!u)return;const c=aa(u),d=u.board_id;r(me.util.updateQueryData("listImages",{board_id:d??"none",categories:c},b=>{Vn.removeOne(b,u.image_name)}));const f={board_id:t,categories:c},h=me.endpoints.listImages.select(f)(o()),{data:p}=ii.includes(u.image_category)?xi.endpoints.getBoardImagesTotal.select(t??"none")(o()):xi.endpoints.getBoardAssetsTotal.select(t??"none")(o()),m=h.data&&h.data.ids.length>=(p??0),_=(p||0)>=fv?Mc(h.data,u):!0;(m||_)&&r(me.util.updateQueryData("listImages",f,b=>{Vn.upsertOne(b,{...u,board_id:t})}))})}catch{}}}),removeImagesFromBoard:e.mutation({query:({imageDTOs:t})=>({url:"board_images/batch/delete",method:"POST",body:{image_names:t.map(n=>n.image_name)}}),invalidatesTags:(t,n,{imageDTOs:r})=>{const i=[],o=[{type:"BoardImagesTotal",id:"none"},{type:"BoardAssetsTotal",id:"none"}];return t==null||t.removed_image_names.forEach(a=>{var l;const s=(l=r.find(u=>u.image_name===a))==null?void 0:l.board_id;!s||i.includes(s)||(o.push({type:"Board",id:s}),o.push({type:"BoardImagesTotal",id:s}),o.push({type:"BoardAssetsTotal",id:s}))}),o},async onQueryStarted({imageDTOs:t},{dispatch:n,queryFulfilled:r,getState:i}){try{const{data:o}=await r,{removed_image_names:a}=o;a.forEach(s=>{n(me.util.updateQueryData("getImageDTO",s,m=>{m.board_id=void 0}));const l=t.find(m=>m.image_name===s);if(!l)return;const u=aa(l);n(me.util.updateQueryData("listImages",{board_id:l.board_id??"none",categories:u},m=>{Vn.removeOne(m,l.image_name)}));const c={board_id:"none",categories:u},d=me.endpoints.listImages.select(c)(i()),{data:f}=ii.includes(l.image_category)?xi.endpoints.getBoardImagesTotal.select(l.board_id??"none")(i()):xi.endpoints.getBoardAssetsTotal.select(l.board_id??"none")(i()),h=d.data&&d.data.ids.length>=(f??0),p=(f||0)>=fv?Mc(d.data,l):!0;(h||p)&&n(me.util.updateQueryData("listImages",c,m=>{Vn.upsertOne(m,{...l,board_id:"none"})}))})}catch{}}})})}),{useGetIntermediatesCountQuery:DGe,useListImagesQuery:LGe,useLazyListImagesQuery:FGe,useGetImageDTOQuery:BGe,useGetImageMetadataQuery:zGe,useDeleteImageMutation:jGe,useDeleteImagesMutation:UGe,useUploadImageMutation:VGe,useClearIntermediatesMutation:GGe,useAddImagesToBoardMutation:qGe,useRemoveImagesFromBoardMutation:HGe,useAddImageToBoardMutation:WGe,useRemoveImageFromBoardMutation:KGe,useChangeImageIsIntermediateMutation:QGe,useChangeImageSessionIdMutation:XGe,useDeleteBoardAndImagesMutation:YGe,useDeleteBoardMutation:ZGe,useStarImagesMutation:JGe,useUnstarImagesMutation:eqe,useGetImageMetadataFromFileQuery:tqe}=me,jj=Ne("socket/socketConnected"),jk=Ne("socket/appSocketConnected"),Uj=Ne("socket/socketDisconnected"),Vj=Ne("socket/appSocketDisconnected"),c0e=Ne("socket/socketSubscribedSession"),d0e=Ne("socket/appSocketSubscribedSession"),f0e=Ne("socket/socketUnsubscribedSession"),h0e=Ne("socket/appSocketUnsubscribedSession"),Gj=Ne("socket/socketInvocationStarted"),Uk=Ne("socket/appSocketInvocationStarted"),Vk=Ne("socket/socketInvocationComplete"),Gk=Ne("socket/appSocketInvocationComplete"),qj=Ne("socket/socketInvocationError"),V2=Ne("socket/appSocketInvocationError"),Hj=Ne("socket/socketGraphExecutionStateComplete"),Wj=Ne("socket/appSocketGraphExecutionStateComplete"),Kj=Ne("socket/socketGeneratorProgress"),qk=Ne("socket/appSocketGeneratorProgress"),Qj=Ne("socket/socketModelLoadStarted"),Xj=Ne("socket/appSocketModelLoadStarted"),Yj=Ne("socket/socketModelLoadCompleted"),Zj=Ne("socket/appSocketModelLoadCompleted"),Jj=Ne("socket/socketSessionRetrievalError"),eU=Ne("socket/appSocketSessionRetrievalError"),tU=Ne("socket/socketInvocationRetrievalError"),nU=Ne("socket/appSocketInvocationRetrievalError"),rU=Ne("socket/socketQueueItemStatusChanged"),Hk=Ne("socket/appSocketQueueItemStatusChanged"),Wk=Ne("controlNet/imageProcessed"),Ef={none:{type:"none",get label(){return be.t("controlnet.none")},get description(){return be.t("controlnet.noneDescription")},default:{type:"none"}},canny_image_processor:{type:"canny_image_processor",get label(){return be.t("controlnet.canny")},get description(){return be.t("controlnet.cannyDescription")},default:{id:"canny_image_processor",type:"canny_image_processor",low_threshold:100,high_threshold:200}},color_map_image_processor:{type:"color_map_image_processor",get label(){return be.t("controlnet.colorMap")},get description(){return be.t("controlnet.colorMapDescription")},default:{id:"color_map_image_processor",type:"color_map_image_processor",color_map_tile_size:64}},content_shuffle_image_processor:{type:"content_shuffle_image_processor",get label(){return be.t("controlnet.contentShuffle")},get description(){return be.t("controlnet.contentShuffleDescription")},default:{id:"content_shuffle_image_processor",type:"content_shuffle_image_processor",detect_resolution:512,image_resolution:512,h:512,w:512,f:256}},hed_image_processor:{type:"hed_image_processor",get label(){return be.t("controlnet.hed")},get description(){return be.t("controlnet.hedDescription")},default:{id:"hed_image_processor",type:"hed_image_processor",detect_resolution:512,image_resolution:512,scribble:!1}},lineart_anime_image_processor:{type:"lineart_anime_image_processor",get label(){return be.t("controlnet.lineartAnime")},get description(){return be.t("controlnet.lineartAnimeDescription")},default:{id:"lineart_anime_image_processor",type:"lineart_anime_image_processor",detect_resolution:512,image_resolution:512}},lineart_image_processor:{type:"lineart_image_processor",get label(){return be.t("controlnet.lineart")},get description(){return be.t("controlnet.lineartDescription")},default:{id:"lineart_image_processor",type:"lineart_image_processor",detect_resolution:512,image_resolution:512,coarse:!1}},mediapipe_face_processor:{type:"mediapipe_face_processor",get label(){return be.t("controlnet.mediapipeFace")},get description(){return be.t("controlnet.mediapipeFaceDescription")},default:{id:"mediapipe_face_processor",type:"mediapipe_face_processor",max_faces:1,min_confidence:.5}},midas_depth_image_processor:{type:"midas_depth_image_processor",get label(){return be.t("controlnet.depthMidas")},get description(){return be.t("controlnet.depthMidasDescription")},default:{id:"midas_depth_image_processor",type:"midas_depth_image_processor",a_mult:2,bg_th:.1}},mlsd_image_processor:{type:"mlsd_image_processor",get label(){return be.t("controlnet.mlsd")},get description(){return be.t("controlnet.mlsdDescription")},default:{id:"mlsd_image_processor",type:"mlsd_image_processor",detect_resolution:512,image_resolution:512,thr_d:.1,thr_v:.1}},normalbae_image_processor:{type:"normalbae_image_processor",get label(){return be.t("controlnet.normalBae")},get description(){return be.t("controlnet.normalBaeDescription")},default:{id:"normalbae_image_processor",type:"normalbae_image_processor",detect_resolution:512,image_resolution:512}},openpose_image_processor:{type:"openpose_image_processor",get label(){return be.t("controlnet.openPose")},get description(){return be.t("controlnet.openPoseDescription")},default:{id:"openpose_image_processor",type:"openpose_image_processor",detect_resolution:512,image_resolution:512,hand_and_face:!1}},pidi_image_processor:{type:"pidi_image_processor",get label(){return be.t("controlnet.pidi")},get description(){return be.t("controlnet.pidiDescription")},default:{id:"pidi_image_processor",type:"pidi_image_processor",detect_resolution:512,image_resolution:512,scribble:!1,safe:!1}},zoe_depth_image_processor:{type:"zoe_depth_image_processor",get label(){return be.t("controlnet.depthZoe")},get description(){return be.t("controlnet.depthZoeDescription")},default:{id:"zoe_depth_image_processor",type:"zoe_depth_image_processor"}}},Tv={canny:"canny_image_processor",mlsd:"mlsd_image_processor",depth:"midas_depth_image_processor",bae:"normalbae_image_processor",lineart:"lineart_image_processor",lineart_anime:"lineart_anime_image_processor",softedge:"hed_image_processor",shuffle:"content_shuffle_image_processor",openpose:"openpose_image_processor",mediapipe:"mediapipe_face_processor",pidi:"pidi_image_processor",zoe:"zoe_depth_image_processor",color:"color_map_image_processor"},jR={isEnabled:!0,model:null,weight:1,beginStepPct:0,endStepPct:1,controlMode:"balanced",resizeMode:"just_resize",controlImage:null,processedControlImage:null,processorType:"canny_image_processor",processorNode:Ef.canny_image_processor.default,shouldAutoConfig:!0},iU={adapterImage:null,model:null,weight:1,beginStepPct:0,endStepPct:1},SE={controlNets:{},isEnabled:!1,pendingControlImages:[],isIPAdapterEnabled:!1,ipAdapterInfo:{...iU}},oU=nr({name:"controlNet",initialState:SE,reducers:{isControlNetEnabledToggled:e=>{e.isEnabled=!e.isEnabled},controlNetEnabled:e=>{e.isEnabled=!0},controlNetAdded:(e,t)=>{const{controlNetId:n,controlNet:r}=t.payload;e.controlNets[n]={...r??jR,controlNetId:n}},controlNetRecalled:(e,t)=>{const n=t.payload;e.controlNets[n.controlNetId]={...n}},controlNetDuplicated:(e,t)=>{const{sourceControlNetId:n,newControlNetId:r}=t.payload,i=e.controlNets[n];if(!i)return;const o=wn(i);o.controlNetId=r,e.controlNets[r]=o},controlNetAddedFromImage:(e,t)=>{const{controlNetId:n,controlImage:r}=t.payload;e.controlNets[n]={...jR,controlNetId:n,controlImage:r}},controlNetRemoved:(e,t)=>{const{controlNetId:n}=t.payload;delete e.controlNets[n]},controlNetIsEnabledChanged:(e,t)=>{const{controlNetId:n,isEnabled:r}=t.payload,i=e.controlNets[n];i&&(i.isEnabled=r)},controlNetImageChanged:(e,t)=>{const{controlNetId:n,controlImage:r}=t.payload,i=e.controlNets[n];i&&(i.controlImage=r,i.processedControlImage=null,r!==null&&i.processorType!=="none"&&e.pendingControlImages.push(n))},controlNetProcessedImageChanged:(e,t)=>{const{controlNetId:n,processedControlImage:r}=t.payload,i=e.controlNets[n];i&&(i.processedControlImage=r,e.pendingControlImages=e.pendingControlImages.filter(o=>o!==n))},controlNetModelChanged:(e,t)=>{const{controlNetId:n,model:r}=t.payload,i=e.controlNets[n];if(i&&(i.model=r,i.processedControlImage=null,i.shouldAutoConfig)){let o;for(const a in Tv)if(r.model_name.includes(a)){o=Tv[a];break}o?(i.processorType=o,i.processorNode=Ef[o].default):(i.processorType="none",i.processorNode=Ef.none.default)}},controlNetWeightChanged:(e,t)=>{const{controlNetId:n,weight:r}=t.payload,i=e.controlNets[n];i&&(i.weight=r)},controlNetBeginStepPctChanged:(e,t)=>{const{controlNetId:n,beginStepPct:r}=t.payload,i=e.controlNets[n];i&&(i.beginStepPct=r)},controlNetEndStepPctChanged:(e,t)=>{const{controlNetId:n,endStepPct:r}=t.payload,i=e.controlNets[n];i&&(i.endStepPct=r)},controlNetControlModeChanged:(e,t)=>{const{controlNetId:n,controlMode:r}=t.payload,i=e.controlNets[n];i&&(i.controlMode=r)},controlNetResizeModeChanged:(e,t)=>{const{controlNetId:n,resizeMode:r}=t.payload,i=e.controlNets[n];i&&(i.resizeMode=r)},controlNetProcessorParamsChanged:(e,t)=>{const{controlNetId:n,changes:r}=t.payload,i=e.controlNets[n];if(!i)return;const o=i.processorNode;i.processorNode={...o,...r},i.shouldAutoConfig=!1},controlNetProcessorTypeChanged:(e,t)=>{const{controlNetId:n,processorType:r}=t.payload,i=e.controlNets[n];i&&(i.processedControlImage=null,i.processorType=r,i.processorNode=Ef[r].default,i.shouldAutoConfig=!1)},controlNetAutoConfigToggled:(e,t)=>{var o;const{controlNetId:n}=t.payload,r=e.controlNets[n];if(!r)return;const i=!r.shouldAutoConfig;if(i){let a;for(const s in Tv)if((o=r.model)!=null&&o.model_name.includes(s)){a=Tv[s];break}a?(r.processorType=a,r.processorNode=Ef[a].default):(r.processorType="none",r.processorNode=Ef.none.default)}r.shouldAutoConfig=i},controlNetReset:()=>({...SE}),isIPAdapterEnabledChanged:(e,t)=>{e.isIPAdapterEnabled=t.payload},ipAdapterRecalled:(e,t)=>{e.ipAdapterInfo=t.payload},ipAdapterImageChanged:(e,t)=>{e.ipAdapterInfo.adapterImage=t.payload},ipAdapterWeightChanged:(e,t)=>{e.ipAdapterInfo.weight=t.payload},ipAdapterModelChanged:(e,t)=>{e.ipAdapterInfo.model=t.payload},ipAdapterBeginStepPctChanged:(e,t)=>{e.ipAdapterInfo.beginStepPct=t.payload},ipAdapterEndStepPctChanged:(e,t)=>{e.ipAdapterInfo.endStepPct=t.payload},ipAdapterStateReset:e=>{e.isIPAdapterEnabled=!1,e.ipAdapterInfo={...iU}},clearPendingControlImages:e=>{e.pendingControlImages=[]}},extraReducers:e=>{e.addCase(Wk,(t,n)=>{const r=t.controlNets[n.payload.controlNetId];r&&r.controlImage!==null&&t.pendingControlImages.push(n.payload.controlNetId)}),e.addCase(V2,t=>{t.pendingControlImages=[]}),e.addMatcher(me.endpoints.deleteImage.matchFulfilled,(t,n)=>{const{image_name:r}=n.meta.arg.originalArgs;Ca(t.controlNets,i=>{i.controlImage===r&&(i.controlImage=null,i.processedControlImage=null),i.processedControlImage===r&&(i.processedControlImage=null)})})}}),{isControlNetEnabledToggled:nqe,controlNetEnabled:rqe,controlNetAdded:iqe,controlNetRecalled:oqe,controlNetDuplicated:aqe,controlNetAddedFromImage:sqe,controlNetRemoved:aU,controlNetImageChanged:Cc,controlNetProcessedImageChanged:Kk,controlNetIsEnabledChanged:sU,controlNetModelChanged:UR,controlNetWeightChanged:lqe,controlNetBeginStepPctChanged:uqe,controlNetEndStepPctChanged:cqe,controlNetControlModeChanged:dqe,controlNetResizeModeChanged:fqe,controlNetProcessorParamsChanged:p0e,controlNetProcessorTypeChanged:g0e,controlNetReset:m0e,controlNetAutoConfigToggled:VR,isIPAdapterEnabledChanged:lU,ipAdapterRecalled:hqe,ipAdapterImageChanged:G2,ipAdapterWeightChanged:pqe,ipAdapterModelChanged:GR,ipAdapterBeginStepPctChanged:gqe,ipAdapterEndStepPctChanged:mqe,ipAdapterStateReset:uU,clearPendingControlImages:y0e}=oU.actions,v0e=oU.reducer,b0e={imagesToDelete:[],isModalOpen:!1},cU=nr({name:"deleteImageModal",initialState:b0e,reducers:{isModalOpenChanged:(e,t)=>{e.isModalOpen=t.payload},imagesToDeleteSelected:(e,t)=>{e.imagesToDelete=t.payload},imageDeletionCanceled:e=>{e.imagesToDelete=[],e.isModalOpen=!1}}}),{isModalOpenChanged:Qk,imagesToDeleteSelected:_0e,imageDeletionCanceled:yqe}=cU.actions,S0e=cU.reducer,Xk={maxPrompts:100,combinatorial:!0,prompts:[],parsingError:void 0,isError:!1,isLoading:!1,seedBehaviour:"PER_ITERATION"},x0e=Xk,dU=nr({name:"dynamicPrompts",initialState:x0e,reducers:{maxPromptsChanged:(e,t)=>{e.maxPrompts=t.payload},maxPromptsReset:e=>{e.maxPrompts=Xk.maxPrompts},combinatorialToggled:e=>{e.combinatorial=!e.combinatorial},promptsChanged:(e,t)=>{e.prompts=t.payload},parsingErrorChanged:(e,t)=>{e.parsingError=t.payload},isErrorChanged:(e,t)=>{e.isError=t.payload},isLoadingChanged:(e,t)=>{e.isLoading=t.payload},seedBehaviourChanged:(e,t)=>{e.seedBehaviour=t.payload}}}),{maxPromptsChanged:w0e,maxPromptsReset:C0e,combinatorialToggled:E0e,promptsChanged:T0e,parsingErrorChanged:k0e,isErrorChanged:qR,isLoadingChanged:OC,seedBehaviourChanged:vqe}=dU.actions,A0e=dU.reducer,fU={selection:[],shouldAutoSwitch:!0,autoAssignBoardOnClick:!0,autoAddBoardId:"none",galleryImageMinimumWidth:96,selectedBoardId:"none",galleryView:"images",boardSearchText:""},hU=nr({name:"gallery",initialState:fU,reducers:{imageSelected:(e,t)=>{e.selection=t.payload?[t.payload]:[]},selectionChanged:(e,t)=>{e.selection=t.payload},shouldAutoSwitchChanged:(e,t)=>{e.shouldAutoSwitch=t.payload},setGalleryImageMinimumWidth:(e,t)=>{e.galleryImageMinimumWidth=t.payload},autoAssignBoardOnClickChanged:(e,t)=>{e.autoAssignBoardOnClick=t.payload},boardIdSelected:(e,t)=>{e.selectedBoardId=t.payload.boardId,e.galleryView="images"},autoAddBoardIdChanged:(e,t)=>{if(!t.payload){e.autoAddBoardId="none";return}e.autoAddBoardId=t.payload},galleryViewChanged:(e,t)=>{e.galleryView=t.payload},boardSearchTextChanged:(e,t)=>{e.boardSearchText=t.payload}},extraReducers:e=>{e.addMatcher(I0e,(t,n)=>{const r=n.meta.arg.originalArgs;r===t.selectedBoardId&&(t.selectedBoardId="none",t.galleryView="images"),r===t.autoAddBoardId&&(t.autoAddBoardId="none")}),e.addMatcher(xi.endpoints.listAllBoards.matchFulfilled,(t,n)=>{const r=n.payload;t.autoAddBoardId&&(r.map(i=>i.board_id).includes(t.autoAddBoardId)||(t.autoAddBoardId="none"))})}}),{imageSelected:Vs,shouldAutoSwitchChanged:bqe,autoAssignBoardOnClickChanged:_qe,setGalleryImageMinimumWidth:Sqe,boardIdSelected:C_,autoAddBoardIdChanged:xqe,galleryViewChanged:xE,selectionChanged:pU,boardSearchTextChanged:wqe}=hU.actions,P0e=hU.reducer,I0e=No(me.endpoints.deleteBoard.matchFulfilled,me.endpoints.deleteBoardAndImages.matchFulfilled),HR={weight:.75},R0e={loras:{}},gU=nr({name:"lora",initialState:R0e,reducers:{loraAdded:(e,t)=>{const{model_name:n,id:r,base_model:i}=t.payload;e.loras[r]={id:r,model_name:n,base_model:i,...HR}},loraRecalled:(e,t)=>{const{model_name:n,id:r,base_model:i,weight:o}=t.payload;e.loras[r]={id:r,model_name:n,base_model:i,weight:o}},loraRemoved:(e,t)=>{const n=t.payload;delete e.loras[n]},lorasCleared:e=>{e.loras={}},loraWeightChanged:(e,t)=>{const{id:n,weight:r}=t.payload,i=e.loras[n];i&&(i.weight=r)},loraWeightReset:(e,t)=>{const n=t.payload,r=e.loras[n];r&&(r.weight=HR.weight)}}}),{loraAdded:Cqe,loraRemoved:mU,loraWeightChanged:Eqe,loraWeightReset:Tqe,lorasCleared:kqe,loraRecalled:Aqe}=gU.actions,O0e=gU.reducer;function ka(e){if(typeof e=="string"||typeof e=="number")return""+e;let t="";if(Array.isArray(e))for(let n=0,r;n{let t;const n=new Set,r=(l,u)=>{const c=typeof l=="function"?l(t):l;if(!Object.is(c,t)){const d=t;t=u??typeof c!="object"?c:Object.assign({},t,c),n.forEach(f=>f(t,d))}},i=()=>t,s={setState:r,getState:i,subscribe:l=>(n.add(l),()=>n.delete(l)),destroy:()=>{n.clear()}};return t=e(r,i,s),s},M0e=e=>e?WR(e):WR,{useSyncExternalStoreWithSelector:N0e}=rme;function yU(e,t=e.getState,n){const r=N0e(e.subscribe,e.getState,e.getServerState||e.getState,t,n);return I.useDebugValue(r),r}const KR=(e,t)=>{const n=M0e(e),r=(i,o=t)=>yU(n,i,o);return Object.assign(r,n),r},$0e=(e,t)=>e?KR(e,t):KR;function Ro(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[r,i]of e)if(!Object.is(i,t.get(r)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const r of e)if(!t.has(r))return!1;return!0}const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(let r=0;r{}};function q2(){for(var e=0,t=arguments.length,n={},r;e=0&&(r=n.slice(i+1),n=n.slice(0,i)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:r}})}F1.prototype=q2.prototype={constructor:F1,on:function(e,t){var n=this._,r=L0e(e+"",n),i,o=-1,a=r.length;if(arguments.length<2){for(;++o0)for(var n=new Array(i),r=0,i,o;r=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),XR.hasOwnProperty(t)?{space:XR[t],local:e}:e}function B0e(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===wE&&t.documentElement.namespaceURI===wE?t.createElement(e):t.createElementNS(n,e)}}function z0e(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function vU(e){var t=H2(e);return(t.local?z0e:B0e)(t)}function j0e(){}function Yk(e){return e==null?j0e:function(){return this.querySelector(e)}}function U0e(e){typeof e!="function"&&(e=Yk(e));for(var t=this._groups,n=t.length,r=new Array(n),i=0;i=g&&(g=v+1);!(S=_[g])&&++g=0;)(a=r[i])&&(o&&a.compareDocumentPosition(o)^4&&o.parentNode.insertBefore(a,o),o=a);return this}function hye(e){e||(e=pye);function t(d,f){return d&&f?e(d.__data__,f.__data__):!d-!f}for(var n=this._groups,r=n.length,i=new Array(r),o=0;ot?1:e>=t?0:NaN}function gye(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function mye(){return Array.from(this)}function yye(){for(var e=this._groups,t=0,n=e.length;t1?this.each((t==null?Aye:typeof t=="function"?Iye:Pye)(e,t,n??"")):ep(this.node(),e)}function ep(e,t){return e.style.getPropertyValue(t)||wU(e).getComputedStyle(e,null).getPropertyValue(t)}function Oye(e){return function(){delete this[e]}}function Mye(e,t){return function(){this[e]=t}}function Nye(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function $ye(e,t){return arguments.length>1?this.each((t==null?Oye:typeof t=="function"?Nye:Mye)(e,t)):this.node()[e]}function CU(e){return e.trim().split(/^|\s+/)}function Zk(e){return e.classList||new EU(e)}function EU(e){this._node=e,this._names=CU(e.getAttribute("class")||"")}EU.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function TU(e,t){for(var n=Zk(e),r=-1,i=t.length;++r=0&&(n=t.slice(r+1),t=t.slice(0,r)),{type:t,name:n}})}function uve(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,i=t.length,o;n()=>e;function CE(e,{sourceEvent:t,subject:n,target:r,identifier:i,active:o,x:a,y:s,dx:l,dy:u,dispatch:c}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:i,enumerable:!0,configurable:!0},active:{value:o,enumerable:!0,configurable:!0},x:{value:a,enumerable:!0,configurable:!0},y:{value:s,enumerable:!0,configurable:!0},dx:{value:l,enumerable:!0,configurable:!0},dy:{value:u,enumerable:!0,configurable:!0},_:{value:c}})}CE.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function bve(e){return!e.ctrlKey&&!e.button}function _ve(){return this.parentNode}function Sve(e,t){return t??{x:e.x,y:e.y}}function xve(){return navigator.maxTouchPoints||"ontouchstart"in this}function wve(){var e=bve,t=_ve,n=Sve,r=xve,i={},o=q2("start","drag","end"),a=0,s,l,u,c,d=0;function f(y){y.on("mousedown.drag",h).filter(r).on("touchstart.drag",_).on("touchmove.drag",b,vve).on("touchend.drag touchcancel.drag",v).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function h(y,S){if(!(c||!e.call(this,y,S))){var w=g(this,t.call(this,y,S),y,S,"mouse");w&&(Wa(y.view).on("mousemove.drag",p,u0).on("mouseup.drag",m,u0),IU(y.view),MC(y),u=!1,s=y.clientX,l=y.clientY,w("start",y))}}function p(y){if(gh(y),!u){var S=y.clientX-s,w=y.clientY-l;u=S*S+w*w>d}i.mouse("drag",y)}function m(y){Wa(y.view).on("mousemove.drag mouseup.drag",null),RU(y.view,u),gh(y),i.mouse("end",y)}function _(y,S){if(e.call(this,y,S)){var w=y.changedTouches,x=t.call(this,y,S),C=w.length,k,T;for(k=0;k>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?Av(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?Av(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=Eve.exec(e))?new Co(t[1],t[2],t[3],1):(t=Tve.exec(e))?new Co(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=kve.exec(e))?Av(t[1],t[2],t[3],t[4]):(t=Ave.exec(e))?Av(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=Pve.exec(e))?r9(t[1],t[2]/100,t[3]/100,1):(t=Ive.exec(e))?r9(t[1],t[2]/100,t[3]/100,t[4]):YR.hasOwnProperty(e)?e9(YR[e]):e==="transparent"?new Co(NaN,NaN,NaN,0):null}function e9(e){return new Co(e>>16&255,e>>8&255,e&255,1)}function Av(e,t,n,r){return r<=0&&(e=t=n=NaN),new Co(e,t,n,r)}function Mve(e){return e instanceof Sy||(e=f0(e)),e?(e=e.rgb(),new Co(e.r,e.g,e.b,e.opacity)):new Co}function EE(e,t,n,r){return arguments.length===1?Mve(e):new Co(e,t,n,r??1)}function Co(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}Jk(Co,EE,OU(Sy,{brighter(e){return e=e==null?T_:Math.pow(T_,e),new Co(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?c0:Math.pow(c0,e),new Co(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Co(yd(this.r),yd(this.g),yd(this.b),k_(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:t9,formatHex:t9,formatHex8:Nve,formatRgb:n9,toString:n9}));function t9(){return`#${ad(this.r)}${ad(this.g)}${ad(this.b)}`}function Nve(){return`#${ad(this.r)}${ad(this.g)}${ad(this.b)}${ad((isNaN(this.opacity)?1:this.opacity)*255)}`}function n9(){const e=k_(this.opacity);return`${e===1?"rgb(":"rgba("}${yd(this.r)}, ${yd(this.g)}, ${yd(this.b)}${e===1?")":`, ${e})`}`}function k_(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function yd(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function ad(e){return e=yd(e),(e<16?"0":"")+e.toString(16)}function r9(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new Ka(e,t,n,r)}function MU(e){if(e instanceof Ka)return new Ka(e.h,e.s,e.l,e.opacity);if(e instanceof Sy||(e=f0(e)),!e)return new Ka;if(e instanceof Ka)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,i=Math.min(t,n,r),o=Math.max(t,n,r),a=NaN,s=o-i,l=(o+i)/2;return s?(t===o?a=(n-r)/s+(n0&&l<1?0:a,new Ka(a,s,l,e.opacity)}function $ve(e,t,n,r){return arguments.length===1?MU(e):new Ka(e,t,n,r??1)}function Ka(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}Jk(Ka,$ve,OU(Sy,{brighter(e){return e=e==null?T_:Math.pow(T_,e),new Ka(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?c0:Math.pow(c0,e),new Ka(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,n=this.l,r=n+(n<.5?n:1-n)*t,i=2*n-r;return new Co(NC(e>=240?e-240:e+120,i,r),NC(e,i,r),NC(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new Ka(i9(this.h),Pv(this.s),Pv(this.l),k_(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=k_(this.opacity);return`${e===1?"hsl(":"hsla("}${i9(this.h)}, ${Pv(this.s)*100}%, ${Pv(this.l)*100}%${e===1?")":`, ${e})`}`}}));function i9(e){return e=(e||0)%360,e<0?e+360:e}function Pv(e){return Math.max(0,Math.min(1,e||0))}function NC(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}const NU=e=>()=>e;function Dve(e,t){return function(n){return e+n*t}}function Lve(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(r){return Math.pow(e+r*t,n)}}function Fve(e){return(e=+e)==1?$U:function(t,n){return n-t?Lve(t,n,e):NU(isNaN(t)?n:t)}}function $U(e,t){var n=t-e;return n?Dve(e,n):NU(isNaN(e)?t:e)}const o9=function e(t){var n=Fve(t);function r(i,o){var a=n((i=EE(i)).r,(o=EE(o)).r),s=n(i.g,o.g),l=n(i.b,o.b),u=$U(i.opacity,o.opacity);return function(c){return i.r=a(c),i.g=s(c),i.b=l(c),i.opacity=u(c),i+""}}return r.gamma=e,r}(1);function bu(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}var TE=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,$C=new RegExp(TE.source,"g");function Bve(e){return function(){return e}}function zve(e){return function(t){return e(t)+""}}function jve(e,t){var n=TE.lastIndex=$C.lastIndex=0,r,i,o,a=-1,s=[],l=[];for(e=e+"",t=t+"";(r=TE.exec(e))&&(i=$C.exec(t));)(o=i.index)>n&&(o=t.slice(n,o),s[a]?s[a]+=o:s[++a]=o),(r=r[0])===(i=i[0])?s[a]?s[a]+=i:s[++a]=i:(s[++a]=null,l.push({i:a,x:bu(r,i)})),n=$C.lastIndex;return n180?c+=360:c-u>180&&(u+=360),f.push({i:d.push(i(d)+"rotate(",null,r)-2,x:bu(u,c)})):c&&d.push(i(d)+"rotate("+c+r)}function s(u,c,d,f){u!==c?f.push({i:d.push(i(d)+"skewX(",null,r)-2,x:bu(u,c)}):c&&d.push(i(d)+"skewX("+c+r)}function l(u,c,d,f,h,p){if(u!==d||c!==f){var m=h.push(i(h)+"scale(",null,",",null,")");p.push({i:m-4,x:bu(u,d)},{i:m-2,x:bu(c,f)})}else(d!==1||f!==1)&&h.push(i(h)+"scale("+d+","+f+")")}return function(u,c){var d=[],f=[];return u=e(u),c=e(c),o(u.translateX,u.translateY,c.translateX,c.translateY,d,f),a(u.rotate,c.rotate,d,f),s(u.skewX,c.skewX,d,f),l(u.scaleX,u.scaleY,c.scaleX,c.scaleY,d,f),u=c=null,function(h){for(var p=-1,m=f.length,_;++p=0&&e._call.call(void 0,t),e=e._next;--tp}function l9(){$d=(P_=h0.now())+W2,tp=Sg=0;try{Yve()}finally{tp=0,Jve(),$d=0}}function Zve(){var e=h0.now(),t=e-P_;t>FU&&(W2-=t,P_=e)}function Jve(){for(var e,t=A_,n,r=1/0;t;)t._call?(r>t._time&&(r=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:A_=n);xg=e,AE(r)}function AE(e){if(!tp){Sg&&(Sg=clearTimeout(Sg));var t=e-$d;t>24?(e<1/0&&(Sg=setTimeout(l9,e-h0.now()-W2)),Qp&&(Qp=clearInterval(Qp))):(Qp||(P_=h0.now(),Qp=setInterval(Zve,FU)),tp=1,BU(l9))}}function u9(e,t,n){var r=new I_;return t=t==null?0:+t,r.restart(i=>{r.stop(),e(i+t)},t,n),r}var e1e=q2("start","end","cancel","interrupt"),t1e=[],jU=0,c9=1,PE=2,B1=3,d9=4,IE=5,z1=6;function K2(e,t,n,r,i,o){var a=e.__transition;if(!a)e.__transition={};else if(n in a)return;n1e(e,n,{name:t,index:r,group:i,on:e1e,tween:t1e,time:o.time,delay:o.delay,duration:o.duration,ease:o.ease,timer:null,state:jU})}function tA(e,t){var n=fs(e,t);if(n.state>jU)throw new Error("too late; already scheduled");return n}function nl(e,t){var n=fs(e,t);if(n.state>B1)throw new Error("too late; already running");return n}function fs(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function n1e(e,t,n){var r=e.__transition,i;r[t]=n,n.timer=zU(o,0,n.time);function o(u){n.state=c9,n.timer.restart(a,n.delay,n.time),n.delay<=u&&a(u-n.delay)}function a(u){var c,d,f,h;if(n.state!==c9)return l();for(c in r)if(h=r[c],h.name===n.name){if(h.state===B1)return u9(a);h.state===d9?(h.state=z1,h.timer.stop(),h.on.call("interrupt",e,e.__data__,h.index,h.group),delete r[c]):+cPE&&r.state=0&&(t=t.slice(0,n)),!t||t==="start"})}function O1e(e,t,n){var r,i,o=R1e(t)?tA:nl;return function(){var a=o(this,e),s=a.on;s!==r&&(i=(r=s).copy()).on(t,n),a.on=i}}function M1e(e,t){var n=this._id;return arguments.length<2?fs(this.node(),n).on.on(e):this.each(O1e(n,e,t))}function N1e(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function $1e(){return this.on("end.remove",N1e(this._id))}function D1e(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Yk(e));for(var r=this._groups,i=r.length,o=new Array(i),a=0;a()=>e;function sbe(e,{sourceEvent:t,target:n,transform:r,dispatch:i}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:i}})}function Il(e,t,n){this.k=e,this.x=t,this.y=n}Il.prototype={constructor:Il,scale:function(e){return e===1?this:new Il(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Il(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var Xu=new Il(1,0,0);Il.prototype;function DC(e){e.stopImmediatePropagation()}function Xp(e){e.preventDefault(),e.stopImmediatePropagation()}function lbe(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function ube(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function f9(){return this.__zoom||Xu}function cbe(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function dbe(){return navigator.maxTouchPoints||"ontouchstart"in this}function fbe(e,t,n){var r=e.invertX(t[0][0])-n[0][0],i=e.invertX(t[1][0])-n[1][0],o=e.invertY(t[0][1])-n[0][1],a=e.invertY(t[1][1])-n[1][1];return e.translate(i>r?(r+i)/2:Math.min(0,r)||Math.max(0,i),a>o?(o+a)/2:Math.min(0,o)||Math.max(0,a))}function hbe(){var e=lbe,t=ube,n=fbe,r=cbe,i=dbe,o=[0,1/0],a=[[-1/0,-1/0],[1/0,1/0]],s=250,l=Qve,u=q2("start","zoom","end"),c,d,f,h=500,p=150,m=0,_=10;function b(E){E.property("__zoom",f9).on("wheel.zoom",C,{passive:!1}).on("mousedown.zoom",k).on("dblclick.zoom",T).filter(i).on("touchstart.zoom",P).on("touchmove.zoom",$).on("touchend.zoom touchcancel.zoom",O).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}b.transform=function(E,A,D,L){var M=E.selection?E.selection():E;M.property("__zoom",f9),E!==M?S(E,A,D,L):M.interrupt().each(function(){w(this,arguments).event(L).start().zoom(null,typeof A=="function"?A.apply(this,arguments):A).end()})},b.scaleBy=function(E,A,D,L){b.scaleTo(E,function(){var M=this.__zoom.k,R=typeof A=="function"?A.apply(this,arguments):A;return M*R},D,L)},b.scaleTo=function(E,A,D,L){b.transform(E,function(){var M=t.apply(this,arguments),R=this.__zoom,N=D==null?y(M):typeof D=="function"?D.apply(this,arguments):D,B=R.invert(N),U=typeof A=="function"?A.apply(this,arguments):A;return n(g(v(R,U),N,B),M,a)},D,L)},b.translateBy=function(E,A,D,L){b.transform(E,function(){return n(this.__zoom.translate(typeof A=="function"?A.apply(this,arguments):A,typeof D=="function"?D.apply(this,arguments):D),t.apply(this,arguments),a)},null,L)},b.translateTo=function(E,A,D,L,M){b.transform(E,function(){var R=t.apply(this,arguments),N=this.__zoom,B=L==null?y(R):typeof L=="function"?L.apply(this,arguments):L;return n(Xu.translate(B[0],B[1]).scale(N.k).translate(typeof A=="function"?-A.apply(this,arguments):-A,typeof D=="function"?-D.apply(this,arguments):-D),R,a)},L,M)};function v(E,A){return A=Math.max(o[0],Math.min(o[1],A)),A===E.k?E:new Il(A,E.x,E.y)}function g(E,A,D){var L=A[0]-D[0]*E.k,M=A[1]-D[1]*E.k;return L===E.x&&M===E.y?E:new Il(E.k,L,M)}function y(E){return[(+E[0][0]+ +E[1][0])/2,(+E[0][1]+ +E[1][1])/2]}function S(E,A,D,L){E.on("start.zoom",function(){w(this,arguments).event(L).start()}).on("interrupt.zoom end.zoom",function(){w(this,arguments).event(L).end()}).tween("zoom",function(){var M=this,R=arguments,N=w(M,R).event(L),B=t.apply(M,R),U=D==null?y(B):typeof D=="function"?D.apply(M,R):D,G=Math.max(B[1][0]-B[0][0],B[1][1]-B[0][1]),Y=M.__zoom,ee=typeof A=="function"?A.apply(M,R):A,J=l(Y.invert(U).concat(G/Y.k),ee.invert(U).concat(G/ee.k));return function(j){if(j===1)j=ee;else{var Q=J(j),ne=G/Q[2];j=new Il(ne,U[0]-Q[0]*ne,U[1]-Q[1]*ne)}N.zoom(null,j)}})}function w(E,A,D){return!D&&E.__zooming||new x(E,A)}function x(E,A){this.that=E,this.args=A,this.active=0,this.sourceEvent=null,this.extent=t.apply(E,A),this.taps=0}x.prototype={event:function(E){return E&&(this.sourceEvent=E),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(E,A){return this.mouse&&E!=="mouse"&&(this.mouse[1]=A.invert(this.mouse[0])),this.touch0&&E!=="touch"&&(this.touch0[1]=A.invert(this.touch0[0])),this.touch1&&E!=="touch"&&(this.touch1[1]=A.invert(this.touch1[0])),this.that.__zoom=A,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(E){var A=Wa(this.that).datum();u.call(E,this.that,new sbe(E,{sourceEvent:this.sourceEvent,target:b,type:E,transform:this.that.__zoom,dispatch:u}),A)}};function C(E,...A){if(!e.apply(this,arguments))return;var D=w(this,A).event(E),L=this.__zoom,M=Math.max(o[0],Math.min(o[1],L.k*Math.pow(2,r.apply(this,arguments)))),R=ws(E);if(D.wheel)(D.mouse[0][0]!==R[0]||D.mouse[0][1]!==R[1])&&(D.mouse[1]=L.invert(D.mouse[0]=R)),clearTimeout(D.wheel);else{if(L.k===M)return;D.mouse=[R,L.invert(R)],j1(this),D.start()}Xp(E),D.wheel=setTimeout(N,p),D.zoom("mouse",n(g(v(L,M),D.mouse[0],D.mouse[1]),D.extent,a));function N(){D.wheel=null,D.end()}}function k(E,...A){if(f||!e.apply(this,arguments))return;var D=E.currentTarget,L=w(this,A,!0).event(E),M=Wa(E.view).on("mousemove.zoom",U,!0).on("mouseup.zoom",G,!0),R=ws(E,D),N=E.clientX,B=E.clientY;IU(E.view),DC(E),L.mouse=[R,this.__zoom.invert(R)],j1(this),L.start();function U(Y){if(Xp(Y),!L.moved){var ee=Y.clientX-N,J=Y.clientY-B;L.moved=ee*ee+J*J>m}L.event(Y).zoom("mouse",n(g(L.that.__zoom,L.mouse[0]=ws(Y,D),L.mouse[1]),L.extent,a))}function G(Y){M.on("mousemove.zoom mouseup.zoom",null),RU(Y.view,L.moved),Xp(Y),L.event(Y).end()}}function T(E,...A){if(e.apply(this,arguments)){var D=this.__zoom,L=ws(E.changedTouches?E.changedTouches[0]:E,this),M=D.invert(L),R=D.k*(E.shiftKey?.5:2),N=n(g(v(D,R),L,M),t.apply(this,A),a);Xp(E),s>0?Wa(this).transition().duration(s).call(S,N,L,E):Wa(this).call(b.transform,N,L,E)}}function P(E,...A){if(e.apply(this,arguments)){var D=E.touches,L=D.length,M=w(this,A,E.changedTouches.length===L).event(E),R,N,B,U;for(DC(E),N=0;N"[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.dev/error#001",error002:()=>"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.",error003:e=>`Node type "${e}" not found. Using fallback type "default".`,error004:()=>"The React Flow parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error007:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,t)=>`Couldn't create edge for ${e?"target":"source"} handle id: "${e?t.targetHandle:t.sourceHandle}", edge id: ${t.id}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:e=>`Edge type "${e}" not found. Using fallback type "default".`,error012:e=>`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`},qU=Wl.error001();function br(e,t){const n=I.useContext(Q2);if(n===null)throw new Error(qU);return yU(n,e,t)}const hi=()=>{const e=I.useContext(Q2);if(e===null)throw new Error(qU);return I.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe,destroy:e.destroy}),[e])},gbe=e=>e.userSelectionActive?"none":"all";function mbe({position:e,children:t,className:n,style:r,...i}){const o=br(gbe),a=`${e}`.split("-");return W.jsx("div",{className:ka(["react-flow__panel",n,...a]),style:{...r,pointerEvents:o},...i,children:t})}function ybe({proOptions:e,position:t="bottom-right"}){return e!=null&&e.hideAttribution?null:W.jsx(mbe,{position:t,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://pro.reactflow.dev",children:W.jsx("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const vbe=({x:e,y:t,label:n,labelStyle:r={},labelShowBg:i=!0,labelBgStyle:o={},labelBgPadding:a=[2,4],labelBgBorderRadius:s=2,children:l,className:u,...c})=>{const d=I.useRef(null),[f,h]=I.useState({x:0,y:0,width:0,height:0}),p=ka(["react-flow__edge-textwrapper",u]);return I.useEffect(()=>{if(d.current){const m=d.current.getBBox();h({x:m.x,y:m.y,width:m.width,height:m.height})}},[n]),typeof n>"u"||!n?null:W.jsxs("g",{transform:`translate(${e-f.width/2} ${t-f.height/2})`,className:p,visibility:f.width?"visible":"hidden",...c,children:[i&&W.jsx("rect",{width:f.width+2*a[0],x:-a[0],y:-a[1],height:f.height+2*a[1],className:"react-flow__edge-textbg",style:o,rx:s,ry:s}),W.jsx("text",{className:"react-flow__edge-text",y:f.height/2,dy:"0.3em",ref:d,style:r,children:n}),l]})};var bbe=I.memo(vbe);const rA=e=>({width:e.offsetWidth,height:e.offsetHeight}),np=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),iA=(e={x:0,y:0},t)=>({x:np(e.x,t[0][0],t[1][0]),y:np(e.y,t[0][1],t[1][1])}),h9=(e,t,n)=>en?-np(Math.abs(e-n),1,50)/50:0,HU=(e,t)=>{const n=h9(e.x,35,t.width-35)*20,r=h9(e.y,35,t.height-35)*20;return[n,r]},WU=e=>{var t;return((t=e.getRootNode)==null?void 0:t.call(e))||(window==null?void 0:window.document)},KU=(e,t)=>({x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x2,t.x2),y2:Math.max(e.y2,t.y2)}),p0=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),QU=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),p9=e=>({...e.positionAbsolute||{x:0,y:0},width:e.width||0,height:e.height||0}),Pqe=(e,t)=>QU(KU(p0(e),p0(t))),RE=(e,t)=>{const n=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),r=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(n*r)},_be=e=>ba(e.width)&&ba(e.height)&&ba(e.x)&&ba(e.y),ba=e=>!isNaN(e)&&isFinite(e),Kr=Symbol.for("internals"),XU=["Enter"," ","Escape"],Sbe=(e,t)=>{},xbe=e=>"nativeEvent"in e;function OE(e){var i,o;const t=xbe(e)?e.nativeEvent:e,n=((o=(i=t.composedPath)==null?void 0:i.call(t))==null?void 0:o[0])||e.target;return["INPUT","SELECT","TEXTAREA"].includes(n==null?void 0:n.nodeName)||(n==null?void 0:n.hasAttribute("contenteditable"))||!!(n!=null&&n.closest(".nokey"))}const YU=e=>"clientX"in e,Yu=(e,t)=>{var o,a;const n=YU(e),r=n?e.clientX:(o=e.touches)==null?void 0:o[0].clientX,i=n?e.clientY:(a=e.touches)==null?void 0:a[0].clientY;return{x:r-((t==null?void 0:t.left)??0),y:i-((t==null?void 0:t.top)??0)}},R_=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0},xy=({id:e,path:t,labelX:n,labelY:r,label:i,labelStyle:o,labelShowBg:a,labelBgStyle:s,labelBgPadding:l,labelBgBorderRadius:u,style:c,markerEnd:d,markerStart:f,interactionWidth:h=20})=>W.jsxs(W.Fragment,{children:[W.jsx("path",{id:e,style:c,d:t,fill:"none",className:"react-flow__edge-path",markerEnd:d,markerStart:f}),h&&W.jsx("path",{d:t,fill:"none",strokeOpacity:0,strokeWidth:h,className:"react-flow__edge-interaction"}),i&&ba(n)&&ba(r)?W.jsx(bbe,{x:n,y:r,label:i,labelStyle:o,labelShowBg:a,labelBgStyle:s,labelBgPadding:l,labelBgBorderRadius:u}):null]});xy.displayName="BaseEdge";function Yp(e,t,n){return n===void 0?n:r=>{const i=t().edges.find(o=>o.id===e);i&&n(r,{...i})}}function ZU({sourceX:e,sourceY:t,targetX:n,targetY:r}){const i=Math.abs(n-e)/2,o=n{const[_,b,v]=eV({sourceX:e,sourceY:t,sourcePosition:i,targetX:n,targetY:r,targetPosition:o});return W.jsx(xy,{path:_,labelX:b,labelY:v,label:a,labelStyle:s,labelShowBg:l,labelBgStyle:u,labelBgPadding:c,labelBgBorderRadius:d,style:f,markerEnd:h,markerStart:p,interactionWidth:m})});oA.displayName="SimpleBezierEdge";const m9={[tt.Left]:{x:-1,y:0},[tt.Right]:{x:1,y:0},[tt.Top]:{x:0,y:-1},[tt.Bottom]:{x:0,y:1}},wbe=({source:e,sourcePosition:t=tt.Bottom,target:n})=>t===tt.Left||t===tt.Right?e.xMath.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function Cbe({source:e,sourcePosition:t=tt.Bottom,target:n,targetPosition:r=tt.Top,center:i,offset:o}){const a=m9[t],s=m9[r],l={x:e.x+a.x*o,y:e.y+a.y*o},u={x:n.x+s.x*o,y:n.y+s.y*o},c=wbe({source:l,sourcePosition:t,target:u}),d=c.x!==0?"x":"y",f=c[d];let h=[],p,m;const _={x:0,y:0},b={x:0,y:0},[v,g,y,S]=ZU({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(a[d]*s[d]===-1){p=i.x||v,m=i.y||g;const x=[{x:p,y:l.y},{x:p,y:u.y}],C=[{x:l.x,y:m},{x:u.x,y:m}];a[d]===f?h=d==="x"?x:C:h=d==="x"?C:x}else{const x=[{x:l.x,y:u.y}],C=[{x:u.x,y:l.y}];if(d==="x"?h=a.x===f?C:x:h=a.y===f?x:C,t===r){const O=Math.abs(e[d]-n[d]);if(O<=o){const E=Math.min(o-1,o-O);a[d]===f?_[d]=(l[d]>e[d]?-1:1)*E:b[d]=(u[d]>n[d]?-1:1)*E}}if(t!==r){const O=d==="x"?"y":"x",E=a[d]===s[O],A=l[O]>u[O],D=l[O]=$?(p=(k.x+T.x)/2,m=h[0].y):(p=h[0].x,m=(k.y+T.y)/2)}return[[e,{x:l.x+_.x,y:l.y+_.y},...h,{x:u.x+b.x,y:u.y+b.y},n],p,m,y,S]}function Ebe(e,t,n,r){const i=Math.min(y9(e,t)/2,y9(t,n)/2,r),{x:o,y:a}=t;if(e.x===o&&o===n.x||e.y===a&&a===n.y)return`L${o} ${a}`;if(e.y===a){const u=e.x{let g="";return v>0&&v{const[b,v,g]=ME({sourceX:e,sourceY:t,sourcePosition:d,targetX:n,targetY:r,targetPosition:f,borderRadius:m==null?void 0:m.borderRadius,offset:m==null?void 0:m.offset});return W.jsx(xy,{path:b,labelX:v,labelY:g,label:i,labelStyle:o,labelShowBg:a,labelBgStyle:s,labelBgPadding:l,labelBgBorderRadius:u,style:c,markerEnd:h,markerStart:p,interactionWidth:_})});X2.displayName="SmoothStepEdge";const aA=I.memo(e=>{var t;return W.jsx(X2,{...e,pathOptions:I.useMemo(()=>{var n;return{borderRadius:0,offset:(n=e.pathOptions)==null?void 0:n.offset}},[(t=e.pathOptions)==null?void 0:t.offset])})});aA.displayName="StepEdge";function Tbe({sourceX:e,sourceY:t,targetX:n,targetY:r}){const[i,o,a,s]=ZU({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,i,o,a,s]}const sA=I.memo(({sourceX:e,sourceY:t,targetX:n,targetY:r,label:i,labelStyle:o,labelShowBg:a,labelBgStyle:s,labelBgPadding:l,labelBgBorderRadius:u,style:c,markerEnd:d,markerStart:f,interactionWidth:h})=>{const[p,m,_]=Tbe({sourceX:e,sourceY:t,targetX:n,targetY:r});return W.jsx(xy,{path:p,labelX:m,labelY:_,label:i,labelStyle:o,labelShowBg:a,labelBgStyle:s,labelBgPadding:l,labelBgBorderRadius:u,style:c,markerEnd:d,markerStart:f,interactionWidth:h})});sA.displayName="StraightEdge";function Ov(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function v9({pos:e,x1:t,y1:n,x2:r,y2:i,c:o}){switch(e){case tt.Left:return[t-Ov(t-r,o),n];case tt.Right:return[t+Ov(r-t,o),n];case tt.Top:return[t,n-Ov(n-i,o)];case tt.Bottom:return[t,n+Ov(i-n,o)]}}function tV({sourceX:e,sourceY:t,sourcePosition:n=tt.Bottom,targetX:r,targetY:i,targetPosition:o=tt.Top,curvature:a=.25}){const[s,l]=v9({pos:n,x1:e,y1:t,x2:r,y2:i,c:a}),[u,c]=v9({pos:o,x1:r,y1:i,x2:e,y2:t,c:a}),[d,f,h,p]=JU({sourceX:e,sourceY:t,targetX:r,targetY:i,sourceControlX:s,sourceControlY:l,targetControlX:u,targetControlY:c});return[`M${e},${t} C${s},${l} ${u},${c} ${r},${i}`,d,f,h,p]}const M_=I.memo(({sourceX:e,sourceY:t,targetX:n,targetY:r,sourcePosition:i=tt.Bottom,targetPosition:o=tt.Top,label:a,labelStyle:s,labelShowBg:l,labelBgStyle:u,labelBgPadding:c,labelBgBorderRadius:d,style:f,markerEnd:h,markerStart:p,pathOptions:m,interactionWidth:_})=>{const[b,v,g]=tV({sourceX:e,sourceY:t,sourcePosition:i,targetX:n,targetY:r,targetPosition:o,curvature:m==null?void 0:m.curvature});return W.jsx(xy,{path:b,labelX:v,labelY:g,label:a,labelStyle:s,labelShowBg:l,labelBgStyle:u,labelBgPadding:c,labelBgBorderRadius:d,style:f,markerEnd:h,markerStart:p,interactionWidth:_})});M_.displayName="BezierEdge";const lA=I.createContext(null),kbe=lA.Provider;lA.Consumer;const Abe=()=>I.useContext(lA),Pbe=e=>"id"in e&&"source"in e&&"target"in e,nV=e=>"id"in e&&!("source"in e)&&!("target"in e),Ibe=(e,t,n)=>{if(!nV(e))return[];const r=n.filter(i=>i.source===e.id).map(i=>i.target);return t.filter(i=>r.includes(i.id))},Rbe=(e,t,n)=>{if(!nV(e))return[];const r=n.filter(i=>i.target===e.id).map(i=>i.source);return t.filter(i=>r.includes(i.id))},rV=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`reactflow__edge-${e}${t||""}-${n}${r||""}`,NE=(e,t)=>typeof e>"u"?"":typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(r=>`${r}=${e[r]}`).join("&")}`,Obe=(e,t)=>t.some(n=>n.source===e.source&&n.target===e.target&&(n.sourceHandle===e.sourceHandle||!n.sourceHandle&&!e.sourceHandle)&&(n.targetHandle===e.targetHandle||!n.targetHandle&&!e.targetHandle)),wg=(e,t)=>{if(!e.source||!e.target)return t;let n;return Pbe(e)?n={...e}:n={...e,id:rV(e)},Obe(n,t)?t:t.concat(n)},Mbe=(e,t,n,r={shouldReplaceId:!0})=>{const{id:i,...o}=e;if(!t.source||!t.target||!n.find(l=>l.id===i))return n;const s={...o,id:r.shouldReplaceId?rV(t):i,source:t.source,target:t.target,sourceHandle:t.sourceHandle,targetHandle:t.targetHandle};return n.filter(l=>l.id!==i).concat(s)},iV=({x:e,y:t},[n,r,i],o,[a,s])=>{const l={x:(e-n)/i,y:(t-r)/i};return o?{x:a*Math.round(l.x/a),y:s*Math.round(l.y/s)}:l},Nbe=({x:e,y:t},[n,r,i])=>({x:e*i+n,y:t*i+r}),yh=(e,t=[0,0])=>{if(!e)return{x:0,y:0,positionAbsolute:{x:0,y:0}};const n=(e.width??0)*t[0],r=(e.height??0)*t[1],i={x:e.position.x-n,y:e.position.y-r};return{...i,positionAbsolute:e.positionAbsolute?{x:e.positionAbsolute.x-n,y:e.positionAbsolute.y-r}:i}},uA=(e,t=[0,0])=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const n=e.reduce((r,i)=>{const{x:o,y:a}=yh(i,t).positionAbsolute;return KU(r,p0({x:o,y:a,width:i.width||0,height:i.height||0}))},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return QU(n)},oV=(e,t,[n,r,i]=[0,0,1],o=!1,a=!1,s=[0,0])=>{const l={x:(t.x-n)/i,y:(t.y-r)/i,width:t.width/i,height:t.height/i},u=[];return e.forEach(c=>{const{width:d,height:f,selectable:h=!0,hidden:p=!1}=c;if(a&&!h||p)return!1;const{positionAbsolute:m}=yh(c,s),_={x:m.x,y:m.y,width:d||0,height:f||0},b=RE(l,_),v=typeof d>"u"||typeof f>"u"||d===null||f===null,g=o&&b>0,y=(d||0)*(f||0);(v||g||b>=y||c.dragging)&&u.push(c)}),u},cA=(e,t)=>{const n=e.map(r=>r.id);return t.filter(r=>n.includes(r.source)||n.includes(r.target))},aV=(e,t,n,r,i,o=.1)=>{const a=t/(e.width*(1+o)),s=n/(e.height*(1+o)),l=Math.min(a,s),u=np(l,r,i),c=e.x+e.width/2,d=e.y+e.height/2,f=t/2-c*u,h=n/2-d*u;return[f,h,u]},Vc=(e,t=0)=>e.transition().duration(t);function b9(e,t,n,r){return(t[n]||[]).reduce((i,o)=>{var a,s;return`${e.id}-${o.id}-${n}`!==r&&i.push({id:o.id||null,type:n,nodeId:e.id,x:(((a=e.positionAbsolute)==null?void 0:a.x)??0)+o.x+o.width/2,y:(((s=e.positionAbsolute)==null?void 0:s.y)??0)+o.y+o.height/2}),i},[])}function $be(e,t,n,r,i,o){const{x:a,y:s}=Yu(e),u=t.elementsFromPoint(a,s).find(p=>p.classList.contains("react-flow__handle"));if(u){const p=u.getAttribute("data-nodeid");if(p){const m=dA(void 0,u),_=u.getAttribute("data-handleid"),b=o({nodeId:p,id:_,type:m});if(b)return{handle:{id:_,type:m,nodeId:p,x:n.x,y:n.y},validHandleResult:b}}}let c=[],d=1/0;if(i.forEach(p=>{const m=Math.sqrt((p.x-n.x)**2+(p.y-n.y)**2);if(m<=r){const _=o(p);m<=d&&(mp.isValid),h=c.some(({handle:p})=>p.type==="target");return c.find(({handle:p,validHandleResult:m})=>h?p.type==="target":f?m.isValid:!0)||c[0]}const Dbe={source:null,target:null,sourceHandle:null,targetHandle:null},sV=()=>({handleDomNode:null,isValid:!1,connection:Dbe,endHandle:null});function lV(e,t,n,r,i,o,a){const s=i==="target",l=a.querySelector(`.react-flow__handle[data-id="${e==null?void 0:e.nodeId}-${e==null?void 0:e.id}-${e==null?void 0:e.type}"]`),u={...sV(),handleDomNode:l};if(l){const c=dA(void 0,l),d=l.getAttribute("data-nodeid"),f=l.getAttribute("data-handleid"),h=l.classList.contains("connectable"),p=l.classList.contains("connectableend"),m={source:s?d:n,sourceHandle:s?f:r,target:s?n:d,targetHandle:s?r:f};u.connection=m,h&&p&&(t===Dd.Strict?s&&c==="source"||!s&&c==="target":d!==n||f!==r)&&(u.endHandle={nodeId:d,handleId:f,type:c},u.isValid=o(m))}return u}function Lbe({nodes:e,nodeId:t,handleId:n,handleType:r}){return e.reduce((i,o)=>{if(o[Kr]){const{handleBounds:a}=o[Kr];let s=[],l=[];a&&(s=b9(o,a,"source",`${t}-${n}-${r}`),l=b9(o,a,"target",`${t}-${n}-${r}`)),i.push(...s,...l)}return i},[])}function dA(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function LC(e){e==null||e.classList.remove("valid","connecting","react-flow__handle-valid","react-flow__handle-connecting")}function Fbe(e,t){let n=null;return t?n="valid":e&&!t&&(n="invalid"),n}function uV({event:e,handleId:t,nodeId:n,onConnect:r,isTarget:i,getState:o,setState:a,isValidConnection:s,edgeUpdaterType:l,onEdgeUpdateEnd:u}){const c=WU(e.target),{connectionMode:d,domNode:f,autoPanOnConnect:h,connectionRadius:p,onConnectStart:m,panBy:_,getNodes:b,cancelConnection:v}=o();let g=0,y;const{x:S,y:w}=Yu(e),x=c==null?void 0:c.elementFromPoint(S,w),C=dA(l,x),k=f==null?void 0:f.getBoundingClientRect();if(!k||!C)return;let T,P=Yu(e,k),$=!1,O=null,E=!1,A=null;const D=Lbe({nodes:b(),nodeId:n,handleId:t,handleType:C}),L=()=>{if(!h)return;const[N,B]=HU(P,k);_({x:N,y:B}),g=requestAnimationFrame(L)};a({connectionPosition:P,connectionStatus:null,connectionNodeId:n,connectionHandleId:t,connectionHandleType:C,connectionStartHandle:{nodeId:n,handleId:t,type:C},connectionEndHandle:null}),m==null||m(e,{nodeId:n,handleId:t,handleType:C});function M(N){const{transform:B}=o();P=Yu(N,k);const{handle:U,validHandleResult:G}=$be(N,c,iV(P,B,!1,[1,1]),p,D,Y=>lV(Y,d,n,t,i?"target":"source",s,c));if(y=U,$||(L(),$=!0),A=G.handleDomNode,O=G.connection,E=G.isValid,a({connectionPosition:y&&E?Nbe({x:y.x,y:y.y},B):P,connectionStatus:Fbe(!!y,E),connectionEndHandle:G.endHandle}),!y&&!E&&!A)return LC(T);O.source!==O.target&&A&&(LC(T),T=A,A.classList.add("connecting","react-flow__handle-connecting"),A.classList.toggle("valid",E),A.classList.toggle("react-flow__handle-valid",E))}function R(N){var B,U;(y||A)&&O&&E&&(r==null||r(O)),(U=(B=o()).onConnectEnd)==null||U.call(B,N),l&&(u==null||u(N)),LC(T),v(),cancelAnimationFrame(g),$=!1,E=!1,O=null,A=null,c.removeEventListener("mousemove",M),c.removeEventListener("mouseup",R),c.removeEventListener("touchmove",M),c.removeEventListener("touchend",R)}c.addEventListener("mousemove",M),c.addEventListener("mouseup",R),c.addEventListener("touchmove",M),c.addEventListener("touchend",R)}const _9=()=>!0,Bbe=e=>({connectionStartHandle:e.connectionStartHandle,connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName}),zbe=(e,t,n)=>r=>{const{connectionStartHandle:i,connectionEndHandle:o,connectionClickStartHandle:a}=r;return{connecting:(i==null?void 0:i.nodeId)===e&&(i==null?void 0:i.handleId)===t&&(i==null?void 0:i.type)===n||(o==null?void 0:o.nodeId)===e&&(o==null?void 0:o.handleId)===t&&(o==null?void 0:o.type)===n,clickConnecting:(a==null?void 0:a.nodeId)===e&&(a==null?void 0:a.handleId)===t&&(a==null?void 0:a.type)===n}},cV=I.forwardRef(({type:e="source",position:t=tt.Top,isValidConnection:n,isConnectable:r=!0,isConnectableStart:i=!0,isConnectableEnd:o=!0,id:a,onConnect:s,children:l,className:u,onMouseDown:c,onTouchStart:d,...f},h)=>{var k,T;const p=a||null,m=e==="target",_=hi(),b=Abe(),{connectOnClick:v,noPanClassName:g}=br(Bbe,Ro),{connecting:y,clickConnecting:S}=br(zbe(b,p,e),Ro);b||(T=(k=_.getState()).onError)==null||T.call(k,"010",Wl.error010());const w=P=>{const{defaultEdgeOptions:$,onConnect:O,hasDefaultEdges:E}=_.getState(),A={...$,...P};if(E){const{edges:D,setEdges:L}=_.getState();L(wg(A,D))}O==null||O(A),s==null||s(A)},x=P=>{if(!b)return;const $=YU(P);i&&($&&P.button===0||!$)&&uV({event:P,handleId:p,nodeId:b,onConnect:w,isTarget:m,getState:_.getState,setState:_.setState,isValidConnection:n||_.getState().isValidConnection||_9}),$?c==null||c(P):d==null||d(P)},C=P=>{const{onClickConnectStart:$,onClickConnectEnd:O,connectionClickStartHandle:E,connectionMode:A,isValidConnection:D}=_.getState();if(!b||!E&&!i)return;if(!E){$==null||$(P,{nodeId:b,handleId:p,handleType:e}),_.setState({connectionClickStartHandle:{nodeId:b,type:e,handleId:p}});return}const L=WU(P.target),M=n||D||_9,{connection:R,isValid:N}=lV({nodeId:b,id:p,type:e},A,E.nodeId,E.handleId||null,E.type,M,L);N&&w(R),O==null||O(P),_.setState({connectionClickStartHandle:null})};return W.jsx("div",{"data-handleid":p,"data-nodeid":b,"data-handlepos":t,"data-id":`${b}-${p}-${e}`,className:ka(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",g,u,{source:!m,target:m,connectable:r,connectablestart:i,connectableend:o,connecting:S,connectionindicator:r&&(i&&!y||o&&y)}]),onMouseDown:x,onTouchStart:x,onClick:v?C:void 0,ref:h,...f,children:l})});cV.displayName="Handle";var N_=I.memo(cV);const dV=({data:e,isConnectable:t,targetPosition:n=tt.Top,sourcePosition:r=tt.Bottom})=>W.jsxs(W.Fragment,{children:[W.jsx(N_,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label,W.jsx(N_,{type:"source",position:r,isConnectable:t})]});dV.displayName="DefaultNode";var $E=I.memo(dV);const fV=({data:e,isConnectable:t,sourcePosition:n=tt.Bottom})=>W.jsxs(W.Fragment,{children:[e==null?void 0:e.label,W.jsx(N_,{type:"source",position:n,isConnectable:t})]});fV.displayName="InputNode";var hV=I.memo(fV);const pV=({data:e,isConnectable:t,targetPosition:n=tt.Top})=>W.jsxs(W.Fragment,{children:[W.jsx(N_,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label]});pV.displayName="OutputNode";var gV=I.memo(pV);const fA=()=>null;fA.displayName="GroupNode";const jbe=e=>({selectedNodes:e.getNodes().filter(t=>t.selected),selectedEdges:e.edges.filter(t=>t.selected)}),Mv=e=>e.id;function Ube(e,t){return Ro(e.selectedNodes.map(Mv),t.selectedNodes.map(Mv))&&Ro(e.selectedEdges.map(Mv),t.selectedEdges.map(Mv))}const mV=I.memo(({onSelectionChange:e})=>{const t=hi(),{selectedNodes:n,selectedEdges:r}=br(jbe,Ube);return I.useEffect(()=>{var o,a;const i={nodes:n,edges:r};e==null||e(i),(a=(o=t.getState()).onSelectionChange)==null||a.call(o,i)},[n,r,e]),null});mV.displayName="SelectionListener";const Vbe=e=>!!e.onSelectionChange;function Gbe({onSelectionChange:e}){const t=br(Vbe);return e||t?W.jsx(mV,{onSelectionChange:e}):null}const qbe=e=>({setNodes:e.setNodes,setEdges:e.setEdges,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset});function ff(e,t){I.useEffect(()=>{typeof e<"u"&&t(e)},[e])}function Ot(e,t,n){I.useEffect(()=>{typeof t<"u"&&n({[e]:t})},[t])}const Hbe=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:i,onConnectStart:o,onConnectEnd:a,onClickConnectStart:s,onClickConnectEnd:l,nodesDraggable:u,nodesConnectable:c,nodesFocusable:d,edgesFocusable:f,edgesUpdatable:h,elevateNodesOnSelect:p,minZoom:m,maxZoom:_,nodeExtent:b,onNodesChange:v,onEdgesChange:g,elementsSelectable:y,connectionMode:S,snapGrid:w,snapToGrid:x,translateExtent:C,connectOnClick:k,defaultEdgeOptions:T,fitView:P,fitViewOptions:$,onNodesDelete:O,onEdgesDelete:E,onNodeDrag:A,onNodeDragStart:D,onNodeDragStop:L,onSelectionDrag:M,onSelectionDragStart:R,onSelectionDragStop:N,noPanClassName:B,nodeOrigin:U,rfId:G,autoPanOnConnect:Y,autoPanOnNodeDrag:ee,onError:J,connectionRadius:j,isValidConnection:Q})=>{const{setNodes:ne,setEdges:se,setDefaultNodesAndEdges:ve,setMinZoom:ce,setMaxZoom:bt,setTranslateExtent:ot,setNodeExtent:ze,reset:mt}=br(qbe,Ro),Pe=hi();return I.useEffect(()=>{const Jt=r==null?void 0:r.map(Ar=>({...Ar,...T}));return ve(n,Jt),()=>{mt()}},[]),Ot("defaultEdgeOptions",T,Pe.setState),Ot("connectionMode",S,Pe.setState),Ot("onConnect",i,Pe.setState),Ot("onConnectStart",o,Pe.setState),Ot("onConnectEnd",a,Pe.setState),Ot("onClickConnectStart",s,Pe.setState),Ot("onClickConnectEnd",l,Pe.setState),Ot("nodesDraggable",u,Pe.setState),Ot("nodesConnectable",c,Pe.setState),Ot("nodesFocusable",d,Pe.setState),Ot("edgesFocusable",f,Pe.setState),Ot("edgesUpdatable",h,Pe.setState),Ot("elementsSelectable",y,Pe.setState),Ot("elevateNodesOnSelect",p,Pe.setState),Ot("snapToGrid",x,Pe.setState),Ot("snapGrid",w,Pe.setState),Ot("onNodesChange",v,Pe.setState),Ot("onEdgesChange",g,Pe.setState),Ot("connectOnClick",k,Pe.setState),Ot("fitViewOnInit",P,Pe.setState),Ot("fitViewOnInitOptions",$,Pe.setState),Ot("onNodesDelete",O,Pe.setState),Ot("onEdgesDelete",E,Pe.setState),Ot("onNodeDrag",A,Pe.setState),Ot("onNodeDragStart",D,Pe.setState),Ot("onNodeDragStop",L,Pe.setState),Ot("onSelectionDrag",M,Pe.setState),Ot("onSelectionDragStart",R,Pe.setState),Ot("onSelectionDragStop",N,Pe.setState),Ot("noPanClassName",B,Pe.setState),Ot("nodeOrigin",U,Pe.setState),Ot("rfId",G,Pe.setState),Ot("autoPanOnConnect",Y,Pe.setState),Ot("autoPanOnNodeDrag",ee,Pe.setState),Ot("onError",J,Pe.setState),Ot("connectionRadius",j,Pe.setState),Ot("isValidConnection",Q,Pe.setState),ff(e,ne),ff(t,se),ff(m,ce),ff(_,bt),ff(C,ot),ff(b,ze),null},S9={display:"none"},Wbe={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},yV="react-flow__node-desc",vV="react-flow__edge-desc",Kbe="react-flow__aria-live",Qbe=e=>e.ariaLiveMessage;function Xbe({rfId:e}){const t=br(Qbe);return W.jsx("div",{id:`${Kbe}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:Wbe,children:t})}function Ybe({rfId:e,disableKeyboardA11y:t}){return W.jsxs(W.Fragment,{children:[W.jsxs("div",{id:`${yV}-${e}`,style:S9,children:["Press enter or space to select a node.",!t&&"You can then use the arrow keys to move the node around."," Press delete to remove it and escape to cancel."," "]}),W.jsx("div",{id:`${vV}-${e}`,style:S9,children:"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel."}),!t&&W.jsx(Xbe,{rfId:e})]})}const Zbe=typeof document<"u"?document:null;var g0=(e=null,t={target:Zbe})=>{const[n,r]=I.useState(!1),i=I.useRef(!1),o=I.useRef(new Set([])),[a,s]=I.useMemo(()=>{if(e!==null){const u=(Array.isArray(e)?e:[e]).filter(d=>typeof d=="string").map(d=>d.split("+")),c=u.reduce((d,f)=>d.concat(...f),[]);return[u,c]}return[[],[]]},[e]);return I.useEffect(()=>{var l,u;if(e!==null){const c=h=>{if(i.current=h.ctrlKey||h.metaKey||h.shiftKey,!i.current&&OE(h))return!1;const p=w9(h.code,s);o.current.add(h[p]),x9(a,o.current,!1)&&(h.preventDefault(),r(!0))},d=h=>{if(!i.current&&OE(h))return!1;const p=w9(h.code,s);x9(a,o.current,!0)?(r(!1),o.current.clear()):o.current.delete(h[p]),h.key==="Meta"&&o.current.clear(),i.current=!1},f=()=>{o.current.clear(),r(!1)};return(l=t==null?void 0:t.target)==null||l.addEventListener("keydown",c),(u=t==null?void 0:t.target)==null||u.addEventListener("keyup",d),window.addEventListener("blur",f),()=>{var h,p;(h=t==null?void 0:t.target)==null||h.removeEventListener("keydown",c),(p=t==null?void 0:t.target)==null||p.removeEventListener("keyup",d),window.removeEventListener("blur",f)}}},[e,r]),n};function x9(e,t,n){return e.filter(r=>n||r.length===t.size).some(r=>r.every(i=>t.has(i)))}function w9(e,t){return t.includes(e)?"code":"key"}function bV(e,t,n,r){var a,s;if(!e.parentNode)return n;const i=t.get(e.parentNode),o=yh(i,r);return bV(i,t,{x:(n.x??0)+o.x,y:(n.y??0)+o.y,z:(((a=i[Kr])==null?void 0:a.z)??0)>(n.z??0)?((s=i[Kr])==null?void 0:s.z)??0:n.z??0},r)}function _V(e,t,n){e.forEach(r=>{var i;if(r.parentNode&&!e.has(r.parentNode))throw new Error(`Parent node ${r.parentNode} not found`);if(r.parentNode||n!=null&&n[r.id]){const{x:o,y:a,z:s}=bV(r,e,{...r.position,z:((i=r[Kr])==null?void 0:i.z)??0},t);r.positionAbsolute={x:o,y:a},r[Kr].z=s,n!=null&&n[r.id]&&(r[Kr].isParent=!0)}})}function FC(e,t,n,r){const i=new Map,o={},a=r?1e3:0;return e.forEach(s=>{var d;const l=(ba(s.zIndex)?s.zIndex:0)+(s.selected?a:0),u=t.get(s.id),c={width:u==null?void 0:u.width,height:u==null?void 0:u.height,...s,positionAbsolute:{x:s.position.x,y:s.position.y}};s.parentNode&&(c.parentNode=s.parentNode,o[s.parentNode]=!0),Object.defineProperty(c,Kr,{enumerable:!1,value:{handleBounds:(d=u==null?void 0:u[Kr])==null?void 0:d.handleBounds,z:l}}),i.set(s.id,c)}),_V(i,n,o),i}function SV(e,t={}){const{getNodes:n,width:r,height:i,minZoom:o,maxZoom:a,d3Zoom:s,d3Selection:l,fitViewOnInitDone:u,fitViewOnInit:c,nodeOrigin:d}=e(),f=t.initial&&!u&&c;if(s&&l&&(f||!t.initial)){const p=n().filter(_=>{var v;const b=t.includeHiddenNodes?_.width&&_.height:!_.hidden;return(v=t.nodes)!=null&&v.length?b&&t.nodes.some(g=>g.id===_.id):b}),m=p.every(_=>_.width&&_.height);if(p.length>0&&m){const _=uA(p,d),[b,v,g]=aV(_,r,i,t.minZoom??o,t.maxZoom??a,t.padding??.1),y=Xu.translate(b,v).scale(g);return typeof t.duration=="number"&&t.duration>0?s.transform(Vc(l,t.duration),y):s.transform(l,y),!0}}return!1}function Jbe(e,t){return e.forEach(n=>{const r=t.get(n.id);r&&t.set(r.id,{...r,[Kr]:r[Kr],selected:n.selected})}),new Map(t)}function e_e(e,t){return t.map(n=>{const r=e.find(i=>i.id===n.id);return r&&(n.selected=r.selected),n})}function Nv({changedNodes:e,changedEdges:t,get:n,set:r}){const{nodeInternals:i,edges:o,onNodesChange:a,onEdgesChange:s,hasDefaultNodes:l,hasDefaultEdges:u}=n();e!=null&&e.length&&(l&&r({nodeInternals:Jbe(e,i)}),a==null||a(e)),t!=null&&t.length&&(u&&r({edges:e_e(t,o)}),s==null||s(t))}const hf=()=>{},t_e={zoomIn:hf,zoomOut:hf,zoomTo:hf,getZoom:()=>1,setViewport:hf,getViewport:()=>({x:0,y:0,zoom:1}),fitView:()=>!1,setCenter:hf,fitBounds:hf,project:e=>e,viewportInitialized:!1},n_e=e=>({d3Zoom:e.d3Zoom,d3Selection:e.d3Selection}),r_e=()=>{const e=hi(),{d3Zoom:t,d3Selection:n}=br(n_e,Ro);return I.useMemo(()=>n&&t?{zoomIn:i=>t.scaleBy(Vc(n,i==null?void 0:i.duration),1.2),zoomOut:i=>t.scaleBy(Vc(n,i==null?void 0:i.duration),1/1.2),zoomTo:(i,o)=>t.scaleTo(Vc(n,o==null?void 0:o.duration),i),getZoom:()=>e.getState().transform[2],setViewport:(i,o)=>{const[a,s,l]=e.getState().transform,u=Xu.translate(i.x??a,i.y??s).scale(i.zoom??l);t.transform(Vc(n,o==null?void 0:o.duration),u)},getViewport:()=>{const[i,o,a]=e.getState().transform;return{x:i,y:o,zoom:a}},fitView:i=>SV(e.getState,i),setCenter:(i,o,a)=>{const{width:s,height:l,maxZoom:u}=e.getState(),c=typeof(a==null?void 0:a.zoom)<"u"?a.zoom:u,d=s/2-i*c,f=l/2-o*c,h=Xu.translate(d,f).scale(c);t.transform(Vc(n,a==null?void 0:a.duration),h)},fitBounds:(i,o)=>{const{width:a,height:s,minZoom:l,maxZoom:u}=e.getState(),[c,d,f]=aV(i,a,s,l,u,(o==null?void 0:o.padding)??.1),h=Xu.translate(c,d).scale(f);t.transform(Vc(n,o==null?void 0:o.duration),h)},project:i=>{const{transform:o,snapToGrid:a,snapGrid:s}=e.getState();return iV(i,o,a,s)},viewportInitialized:!0}:t_e,[t,n])};function xV(){const e=r_e(),t=hi(),n=I.useCallback(()=>t.getState().getNodes().map(m=>({...m})),[]),r=I.useCallback(m=>t.getState().nodeInternals.get(m),[]),i=I.useCallback(()=>{const{edges:m=[]}=t.getState();return m.map(_=>({..._}))},[]),o=I.useCallback(m=>{const{edges:_=[]}=t.getState();return _.find(b=>b.id===m)},[]),a=I.useCallback(m=>{const{getNodes:_,setNodes:b,hasDefaultNodes:v,onNodesChange:g}=t.getState(),y=_(),S=typeof m=="function"?m(y):m;if(v)b(S);else if(g){const w=S.length===0?y.map(x=>({type:"remove",id:x.id})):S.map(x=>({item:x,type:"reset"}));g(w)}},[]),s=I.useCallback(m=>{const{edges:_=[],setEdges:b,hasDefaultEdges:v,onEdgesChange:g}=t.getState(),y=typeof m=="function"?m(_):m;if(v)b(y);else if(g){const S=y.length===0?_.map(w=>({type:"remove",id:w.id})):y.map(w=>({item:w,type:"reset"}));g(S)}},[]),l=I.useCallback(m=>{const _=Array.isArray(m)?m:[m],{getNodes:b,setNodes:v,hasDefaultNodes:g,onNodesChange:y}=t.getState();if(g){const w=[...b(),..._];v(w)}else if(y){const S=_.map(w=>({item:w,type:"add"}));y(S)}},[]),u=I.useCallback(m=>{const _=Array.isArray(m)?m:[m],{edges:b=[],setEdges:v,hasDefaultEdges:g,onEdgesChange:y}=t.getState();if(g)v([...b,..._]);else if(y){const S=_.map(w=>({item:w,type:"add"}));y(S)}},[]),c=I.useCallback(()=>{const{getNodes:m,edges:_=[],transform:b}=t.getState(),[v,g,y]=b;return{nodes:m().map(S=>({...S})),edges:_.map(S=>({...S})),viewport:{x:v,y:g,zoom:y}}},[]),d=I.useCallback(({nodes:m,edges:_})=>{const{nodeInternals:b,getNodes:v,edges:g,hasDefaultNodes:y,hasDefaultEdges:S,onNodesDelete:w,onEdgesDelete:x,onNodesChange:C,onEdgesChange:k}=t.getState(),T=(m||[]).map(A=>A.id),P=(_||[]).map(A=>A.id),$=v().reduce((A,D)=>{const L=!T.includes(D.id)&&D.parentNode&&A.find(R=>R.id===D.parentNode);return(typeof D.deletable=="boolean"?D.deletable:!0)&&(T.includes(D.id)||L)&&A.push(D),A},[]),O=g.filter(A=>typeof A.deletable=="boolean"?A.deletable:!0),E=O.filter(A=>P.includes(A.id));if($||E){const A=cA($,O),D=[...E,...A],L=D.reduce((M,R)=>(M.includes(R.id)||M.push(R.id),M),[]);if((S||y)&&(S&&t.setState({edges:g.filter(M=>!L.includes(M.id))}),y&&($.forEach(M=>{b.delete(M.id)}),t.setState({nodeInternals:new Map(b)}))),L.length>0&&(x==null||x(D),k&&k(L.map(M=>({id:M,type:"remove"})))),$.length>0&&(w==null||w($),C)){const M=$.map(R=>({id:R.id,type:"remove"}));C(M)}}},[]),f=I.useCallback(m=>{const _=_be(m),b=_?null:t.getState().nodeInternals.get(m.id);return[_?m:p9(b),b,_]},[]),h=I.useCallback((m,_=!0,b)=>{const[v,g,y]=f(m);return v?(b||t.getState().getNodes()).filter(S=>{if(!y&&(S.id===g.id||!S.positionAbsolute))return!1;const w=p9(S),x=RE(w,v);return _&&x>0||x>=m.width*m.height}):[]},[]),p=I.useCallback((m,_,b=!0)=>{const[v]=f(m);if(!v)return!1;const g=RE(v,_);return b&&g>0||g>=m.width*m.height},[]);return I.useMemo(()=>({...e,getNodes:n,getNode:r,getEdges:i,getEdge:o,setNodes:a,setEdges:s,addNodes:l,addEdges:u,toObject:c,deleteElements:d,getIntersectingNodes:h,isNodeIntersecting:p}),[e,n,r,i,o,a,s,l,u,c,d,h,p])}var i_e=({deleteKeyCode:e,multiSelectionKeyCode:t})=>{const n=hi(),{deleteElements:r}=xV(),i=g0(e),o=g0(t);I.useEffect(()=>{if(i){const{edges:a,getNodes:s}=n.getState(),l=s().filter(c=>c.selected),u=a.filter(c=>c.selected);r({nodes:l,edges:u}),n.setState({nodesSelectionActive:!1})}},[i]),I.useEffect(()=>{n.setState({multiSelectionActive:o})},[o])};function o_e(e){const t=hi();I.useEffect(()=>{let n;const r=()=>{var o,a;if(!e.current)return;const i=rA(e.current);(i.height===0||i.width===0)&&((a=(o=t.getState()).onError)==null||a.call(o,"004",Wl.error004())),t.setState({width:i.width||500,height:i.height||500})};return r(),window.addEventListener("resize",r),e.current&&(n=new ResizeObserver(()=>r()),n.observe(e.current)),()=>{window.removeEventListener("resize",r),n&&e.current&&n.unobserve(e.current)}},[])}const hA={position:"absolute",width:"100%",height:"100%",top:0,left:0},a_e=(e,t)=>e.x!==t.x||e.y!==t.y||e.zoom!==t.k,$v=e=>({x:e.x,y:e.y,zoom:e.k}),pf=(e,t)=>e.target.closest(`.${t}`),C9=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),E9=e=>{const t=e.ctrlKey&&R_()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t},s_e=e=>({d3Zoom:e.d3Zoom,d3Selection:e.d3Selection,d3ZoomHandler:e.d3ZoomHandler,userSelectionActive:e.userSelectionActive}),l_e=({onMove:e,onMoveStart:t,onMoveEnd:n,onPaneContextMenu:r,zoomOnScroll:i=!0,zoomOnPinch:o=!0,panOnScroll:a=!1,panOnScrollSpeed:s=.5,panOnScrollMode:l=sd.Free,zoomOnDoubleClick:u=!0,elementsSelectable:c,panOnDrag:d=!0,defaultViewport:f,translateExtent:h,minZoom:p,maxZoom:m,zoomActivationKeyCode:_,preventScrolling:b=!0,children:v,noWheelClassName:g,noPanClassName:y})=>{const S=I.useRef(),w=hi(),x=I.useRef(!1),C=I.useRef(!1),k=I.useRef(null),T=I.useRef({x:0,y:0,zoom:0}),{d3Zoom:P,d3Selection:$,d3ZoomHandler:O,userSelectionActive:E}=br(s_e,Ro),A=g0(_),D=I.useRef(0),L=I.useRef(!1),M=I.useRef();return o_e(k),I.useEffect(()=>{if(k.current){const R=k.current.getBoundingClientRect(),N=hbe().scaleExtent([p,m]).translateExtent(h),B=Wa(k.current).call(N),U=Xu.translate(f.x,f.y).scale(np(f.zoom,p,m)),G=[[0,0],[R.width,R.height]],Y=N.constrain()(U,G,h);N.transform(B,Y),N.wheelDelta(E9),w.setState({d3Zoom:N,d3Selection:B,d3ZoomHandler:B.on("wheel.zoom"),transform:[Y.x,Y.y,Y.k],domNode:k.current.closest(".react-flow")})}},[]),I.useEffect(()=>{$&&P&&(a&&!A&&!E?$.on("wheel.zoom",R=>{if(pf(R,g))return!1;R.preventDefault(),R.stopImmediatePropagation();const N=$.property("__zoom").k||1,B=R_();if(R.ctrlKey&&o&&B){const ne=ws(R),se=E9(R),ve=N*Math.pow(2,se);P.scaleTo($,ve,ne,R);return}const U=R.deltaMode===1?20:1;let G=l===sd.Vertical?0:R.deltaX*U,Y=l===sd.Horizontal?0:R.deltaY*U;!B&&R.shiftKey&&l!==sd.Vertical&&(G=R.deltaY*U,Y=0),P.translateBy($,-(G/N)*s,-(Y/N)*s,{internal:!0});const ee=$v($.property("__zoom")),{onViewportChangeStart:J,onViewportChange:j,onViewportChangeEnd:Q}=w.getState();clearTimeout(M.current),L.current||(L.current=!0,t==null||t(R,ee),J==null||J(ee)),L.current&&(e==null||e(R,ee),j==null||j(ee),M.current=setTimeout(()=>{n==null||n(R,ee),Q==null||Q(ee),L.current=!1},150))},{passive:!1}):typeof O<"u"&&$.on("wheel.zoom",function(R,N){if(!b||pf(R,g))return null;R.preventDefault(),O.call(this,R,N)},{passive:!1}))},[E,a,l,$,P,O,A,o,b,g,t,e,n]),I.useEffect(()=>{P&&P.on("start",R=>{var U,G;if(!R.sourceEvent||R.sourceEvent.internal)return null;D.current=(U=R.sourceEvent)==null?void 0:U.button;const{onViewportChangeStart:N}=w.getState(),B=$v(R.transform);x.current=!0,T.current=B,((G=R.sourceEvent)==null?void 0:G.type)==="mousedown"&&w.setState({paneDragging:!0}),N==null||N(B),t==null||t(R.sourceEvent,B)})},[P,t]),I.useEffect(()=>{P&&(E&&!x.current?P.on("zoom",null):E||P.on("zoom",R=>{var B;const{onViewportChange:N}=w.getState();if(w.setState({transform:[R.transform.x,R.transform.y,R.transform.k]}),C.current=!!(r&&C9(d,D.current??0)),(e||N)&&!((B=R.sourceEvent)!=null&&B.internal)){const U=$v(R.transform);N==null||N(U),e==null||e(R.sourceEvent,U)}}))},[E,P,e,d,r]),I.useEffect(()=>{P&&P.on("end",R=>{if(!R.sourceEvent||R.sourceEvent.internal)return null;const{onViewportChangeEnd:N}=w.getState();if(x.current=!1,w.setState({paneDragging:!1}),r&&C9(d,D.current??0)&&!C.current&&r(R.sourceEvent),C.current=!1,(n||N)&&a_e(T.current,R.transform)){const B=$v(R.transform);T.current=B,clearTimeout(S.current),S.current=setTimeout(()=>{N==null||N(B),n==null||n(R.sourceEvent,B)},a?150:0)}})},[P,a,d,n,r]),I.useEffect(()=>{P&&P.filter(R=>{const N=A||i,B=o&&R.ctrlKey;if(R.button===1&&R.type==="mousedown"&&(pf(R,"react-flow__node")||pf(R,"react-flow__edge")))return!0;if(!d&&!N&&!a&&!u&&!o||E||!u&&R.type==="dblclick"||pf(R,g)&&R.type==="wheel"||pf(R,y)&&R.type!=="wheel"||!o&&R.ctrlKey&&R.type==="wheel"||!N&&!a&&!B&&R.type==="wheel"||!d&&(R.type==="mousedown"||R.type==="touchstart")||Array.isArray(d)&&!d.includes(R.button)&&(R.type==="mousedown"||R.type==="touchstart"))return!1;const U=Array.isArray(d)&&d.includes(R.button)||!R.button||R.button<=1;return(!R.ctrlKey||R.type==="wheel")&&U})},[E,P,i,o,a,u,d,c,A]),W.jsx("div",{className:"react-flow__renderer",ref:k,style:hA,children:v})},u_e=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function c_e(){const{userSelectionActive:e,userSelectionRect:t}=br(u_e,Ro);return e&&t?W.jsx("div",{className:"react-flow__selection react-flow__container",style:{width:t.width,height:t.height,transform:`translate(${t.x}px, ${t.y}px)`}}):null}function T9(e,t){const n=e.find(r=>r.id===t.parentNode);if(n){const r=t.position.x+t.width-n.width,i=t.position.y+t.height-n.height;if(r>0||i>0||t.position.x<0||t.position.y<0){if(n.style={...n.style},n.style.width=n.style.width??n.width,n.style.height=n.style.height??n.height,r>0&&(n.style.width+=r),i>0&&(n.style.height+=i),t.position.x<0){const o=Math.abs(t.position.x);n.position.x=n.position.x-o,n.style.width+=o,t.position.x=0}if(t.position.y<0){const o=Math.abs(t.position.y);n.position.y=n.position.y-o,n.style.height+=o,t.position.y=0}n.width=n.style.width,n.height=n.style.height}}}function wV(e,t){if(e.some(r=>r.type==="reset"))return e.filter(r=>r.type==="reset").map(r=>r.item);const n=e.filter(r=>r.type==="add").map(r=>r.item);return t.reduce((r,i)=>{const o=e.filter(s=>s.id===i.id);if(o.length===0)return r.push(i),r;const a={...i};for(const s of o)if(s)switch(s.type){case"select":{a.selected=s.selected;break}case"position":{typeof s.position<"u"&&(a.position=s.position),typeof s.positionAbsolute<"u"&&(a.positionAbsolute=s.positionAbsolute),typeof s.dragging<"u"&&(a.dragging=s.dragging),a.expandParent&&T9(r,a);break}case"dimensions":{typeof s.dimensions<"u"&&(a.width=s.dimensions.width,a.height=s.dimensions.height),typeof s.updateStyle<"u"&&(a.style={...a.style||{},...s.dimensions}),typeof s.resizing=="boolean"&&(a.resizing=s.resizing),a.expandParent&&T9(r,a);break}case"remove":return r}return r.push(a),r},n)}function Gc(e,t){return wV(e,t)}function Nc(e,t){return wV(e,t)}const _u=(e,t)=>({id:e,type:"select",selected:t});function jf(e,t){return e.reduce((n,r)=>{const i=t.includes(r.id);return!r.selected&&i?(r.selected=!0,n.push(_u(r.id,!0))):r.selected&&!i&&(r.selected=!1,n.push(_u(r.id,!1))),n},[])}const BC=(e,t)=>n=>{n.target===t.current&&(e==null||e(n))},d_e=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,dragging:e.paneDragging}),CV=I.memo(({isSelecting:e,selectionMode:t=uc.Full,panOnDrag:n,onSelectionStart:r,onSelectionEnd:i,onPaneClick:o,onPaneContextMenu:a,onPaneScroll:s,onPaneMouseEnter:l,onPaneMouseMove:u,onPaneMouseLeave:c,children:d})=>{const f=I.useRef(null),h=hi(),p=I.useRef(0),m=I.useRef(0),_=I.useRef(),{userSelectionActive:b,elementsSelectable:v,dragging:g}=br(d_e,Ro),y=()=>{h.setState({userSelectionActive:!1,userSelectionRect:null}),p.current=0,m.current=0},S=O=>{o==null||o(O),h.getState().resetSelectedElements(),h.setState({nodesSelectionActive:!1})},w=O=>{if(Array.isArray(n)&&(n!=null&&n.includes(2))){O.preventDefault();return}a==null||a(O)},x=s?O=>s(O):void 0,C=O=>{const{resetSelectedElements:E,domNode:A}=h.getState();if(_.current=A==null?void 0:A.getBoundingClientRect(),!v||!e||O.button!==0||O.target!==f.current||!_.current)return;const{x:D,y:L}=Yu(O,_.current);E(),h.setState({userSelectionRect:{width:0,height:0,startX:D,startY:L,x:D,y:L}}),r==null||r(O)},k=O=>{const{userSelectionRect:E,nodeInternals:A,edges:D,transform:L,onNodesChange:M,onEdgesChange:R,nodeOrigin:N,getNodes:B}=h.getState();if(!e||!_.current||!E)return;h.setState({userSelectionActive:!0,nodesSelectionActive:!1});const U=Yu(O,_.current),G=E.startX??0,Y=E.startY??0,ee={...E,x:U.xse.id),ne=j.map(se=>se.id);if(p.current!==ne.length){p.current=ne.length;const se=jf(J,ne);se.length&&(M==null||M(se))}if(m.current!==Q.length){m.current=Q.length;const se=jf(D,Q);se.length&&(R==null||R(se))}h.setState({userSelectionRect:ee})},T=O=>{if(O.button!==0)return;const{userSelectionRect:E}=h.getState();!b&&E&&O.target===f.current&&(S==null||S(O)),h.setState({nodesSelectionActive:p.current>0}),y(),i==null||i(O)},P=O=>{b&&(h.setState({nodesSelectionActive:p.current>0}),i==null||i(O)),y()},$=v&&(e||b);return W.jsxs("div",{className:ka(["react-flow__pane",{dragging:g,selection:e}]),onClick:$?void 0:BC(S,f),onContextMenu:BC(w,f),onWheel:BC(x,f),onMouseEnter:$?void 0:l,onMouseDown:$?C:void 0,onMouseMove:$?k:u,onMouseUp:$?T:void 0,onMouseLeave:$?P:c,ref:f,style:hA,children:[d,W.jsx(c_e,{})]})});CV.displayName="Pane";function EV(e,t){if(!e.parentNode)return!1;const n=t.get(e.parentNode);return n?n.selected?!0:EV(n,t):!1}function k9(e,t,n){let r=e;do{if(r!=null&&r.matches(t))return!0;if(r===n.current)return!1;r=r.parentElement}while(r);return!1}function f_e(e,t,n,r){return Array.from(e.values()).filter(i=>(i.selected||i.id===r)&&(!i.parentNode||!EV(i,e))&&(i.draggable||t&&typeof i.draggable>"u")).map(i=>{var o,a;return{id:i.id,position:i.position||{x:0,y:0},positionAbsolute:i.positionAbsolute||{x:0,y:0},distance:{x:n.x-(((o=i.positionAbsolute)==null?void 0:o.x)??0),y:n.y-(((a=i.positionAbsolute)==null?void 0:a.y)??0)},delta:{x:0,y:0},extent:i.extent,parentNode:i.parentNode,width:i.width,height:i.height}})}function h_e(e,t){return!t||t==="parent"?t:[t[0],[t[1][0]-(e.width||0),t[1][1]-(e.height||0)]]}function TV(e,t,n,r,i=[0,0],o){const a=h_e(e,e.extent||r);let s=a;if(e.extent==="parent")if(e.parentNode&&e.width&&e.height){const c=n.get(e.parentNode),{x:d,y:f}=yh(c,i).positionAbsolute;s=c&&ba(d)&&ba(f)&&ba(c.width)&&ba(c.height)?[[d+e.width*i[0],f+e.height*i[1]],[d+c.width-e.width+e.width*i[0],f+c.height-e.height+e.height*i[1]]]:s}else o==null||o("005",Wl.error005()),s=a;else if(e.extent&&e.parentNode){const c=n.get(e.parentNode),{x:d,y:f}=yh(c,i).positionAbsolute;s=[[e.extent[0][0]+d,e.extent[0][1]+f],[e.extent[1][0]+d,e.extent[1][1]+f]]}let l={x:0,y:0};if(e.parentNode){const c=n.get(e.parentNode);l=yh(c,i).positionAbsolute}const u=s&&s!=="parent"?iA(t,s):t;return{position:{x:u.x-l.x,y:u.y-l.y},positionAbsolute:u}}function zC({nodeId:e,dragItems:t,nodeInternals:n}){const r=t.map(i=>({...n.get(i.id),position:i.position,positionAbsolute:i.positionAbsolute}));return[e?r.find(i=>i.id===e):r[0],r]}const A9=(e,t,n,r)=>{const i=t.querySelectorAll(e);if(!i||!i.length)return null;const o=Array.from(i),a=t.getBoundingClientRect(),s={x:a.width*r[0],y:a.height*r[1]};return o.map(l=>{const u=l.getBoundingClientRect();return{id:l.getAttribute("data-handleid"),position:l.getAttribute("data-handlepos"),x:(u.left-a.left-s.x)/n,y:(u.top-a.top-s.y)/n,...rA(l)}})};function Zp(e,t,n){return n===void 0?n:r=>{const i=t().nodeInternals.get(e);i&&n(r,{...i})}}function DE({id:e,store:t,unselect:n=!1,nodeRef:r}){const{addSelectedNodes:i,unselectNodesAndEdges:o,multiSelectionActive:a,nodeInternals:s,onError:l}=t.getState(),u=s.get(e);if(!u){l==null||l("012",Wl.error012(e));return}t.setState({nodesSelectionActive:!1}),u.selected?(n||u.selected&&a)&&(o({nodes:[u]}),requestAnimationFrame(()=>{var c;return(c=r==null?void 0:r.current)==null?void 0:c.blur()})):i([e])}function p_e(){const e=hi();return I.useCallback(({sourceEvent:n})=>{const{transform:r,snapGrid:i,snapToGrid:o}=e.getState(),a=n.touches?n.touches[0].clientX:n.clientX,s=n.touches?n.touches[0].clientY:n.clientY,l={x:(a-r[0])/r[2],y:(s-r[1])/r[2]};return{xSnapped:o?i[0]*Math.round(l.x/i[0]):l.x,ySnapped:o?i[1]*Math.round(l.y/i[1]):l.y,...l}},[])}function jC(e){return(t,n,r)=>e==null?void 0:e(t,r)}function kV({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:r,nodeId:i,isSelectable:o,selectNodesOnDrag:a}){const s=hi(),[l,u]=I.useState(!1),c=I.useRef([]),d=I.useRef({x:null,y:null}),f=I.useRef(0),h=I.useRef(null),p=I.useRef({x:0,y:0}),m=I.useRef(null),_=I.useRef(!1),b=p_e();return I.useEffect(()=>{if(e!=null&&e.current){const v=Wa(e.current),g=({x:S,y:w})=>{const{nodeInternals:x,onNodeDrag:C,onSelectionDrag:k,updateNodePositions:T,nodeExtent:P,snapGrid:$,snapToGrid:O,nodeOrigin:E,onError:A}=s.getState();d.current={x:S,y:w};let D=!1,L={x:0,y:0,x2:0,y2:0};if(c.current.length>1&&P){const R=uA(c.current,E);L=p0(R)}if(c.current=c.current.map(R=>{const N={x:S-R.distance.x,y:w-R.distance.y};O&&(N.x=$[0]*Math.round(N.x/$[0]),N.y=$[1]*Math.round(N.y/$[1]));const B=[[P[0][0],P[0][1]],[P[1][0],P[1][1]]];c.current.length>1&&P&&!R.extent&&(B[0][0]=R.positionAbsolute.x-L.x+P[0][0],B[1][0]=R.positionAbsolute.x+(R.width??0)-L.x2+P[1][0],B[0][1]=R.positionAbsolute.y-L.y+P[0][1],B[1][1]=R.positionAbsolute.y+(R.height??0)-L.y2+P[1][1]);const U=TV(R,N,x,B,E,A);return D=D||R.position.x!==U.position.x||R.position.y!==U.position.y,R.position=U.position,R.positionAbsolute=U.positionAbsolute,R}),!D)return;T(c.current,!0,!0),u(!0);const M=i?C:jC(k);if(M&&m.current){const[R,N]=zC({nodeId:i,dragItems:c.current,nodeInternals:x});M(m.current,R,N)}},y=()=>{if(!h.current)return;const[S,w]=HU(p.current,h.current);if(S!==0||w!==0){const{transform:x,panBy:C}=s.getState();d.current.x=(d.current.x??0)-S/x[2],d.current.y=(d.current.y??0)-w/x[2],C({x:S,y:w})&&g(d.current)}f.current=requestAnimationFrame(y)};if(t)v.on(".drag",null);else{const S=wve().on("start",w=>{var D;const{nodeInternals:x,multiSelectionActive:C,domNode:k,nodesDraggable:T,unselectNodesAndEdges:P,onNodeDragStart:$,onSelectionDragStart:O}=s.getState(),E=i?$:jC(O);!a&&!C&&i&&((D=x.get(i))!=null&&D.selected||P()),i&&o&&a&&DE({id:i,store:s,nodeRef:e});const A=b(w);if(d.current=A,c.current=f_e(x,T,A,i),E&&c.current){const[L,M]=zC({nodeId:i,dragItems:c.current,nodeInternals:x});E(w.sourceEvent,L,M)}h.current=(k==null?void 0:k.getBoundingClientRect())||null,p.current=Yu(w.sourceEvent,h.current)}).on("drag",w=>{const x=b(w),{autoPanOnNodeDrag:C}=s.getState();!_.current&&C&&(_.current=!0,y()),(d.current.x!==x.xSnapped||d.current.y!==x.ySnapped)&&c.current&&(m.current=w.sourceEvent,p.current=Yu(w.sourceEvent,h.current),g(x))}).on("end",w=>{if(u(!1),_.current=!1,cancelAnimationFrame(f.current),c.current){const{updateNodePositions:x,nodeInternals:C,onNodeDragStop:k,onSelectionDragStop:T}=s.getState(),P=i?k:jC(T);if(x(c.current,!1,!1),P){const[$,O]=zC({nodeId:i,dragItems:c.current,nodeInternals:C});P(w.sourceEvent,$,O)}}}).filter(w=>{const x=w.target;return!w.button&&(!n||!k9(x,`.${n}`,e))&&(!r||k9(x,r,e))});return v.call(S),()=>{v.on(".drag",null)}}}},[e,t,n,r,o,s,i,a,b]),l}function AV(){const e=hi();return I.useCallback(n=>{const{nodeInternals:r,nodeExtent:i,updateNodePositions:o,getNodes:a,snapToGrid:s,snapGrid:l,onError:u,nodesDraggable:c}=e.getState(),d=a().filter(v=>v.selected&&(v.draggable||c&&typeof v.draggable>"u")),f=s?l[0]:5,h=s?l[1]:5,p=n.isShiftPressed?4:1,m=n.x*f*p,_=n.y*h*p,b=d.map(v=>{if(v.positionAbsolute){const g={x:v.positionAbsolute.x+m,y:v.positionAbsolute.y+_};s&&(g.x=l[0]*Math.round(g.x/l[0]),g.y=l[1]*Math.round(g.y/l[1]));const{positionAbsolute:y,position:S}=TV(v,g,r,i,void 0,u);v.position=S,v.positionAbsolute=y}return v});o(b,!0,!1)},[])}const vh={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};var Jp=e=>{const t=({id:n,type:r,data:i,xPos:o,yPos:a,xPosOrigin:s,yPosOrigin:l,selected:u,onClick:c,onMouseEnter:d,onMouseMove:f,onMouseLeave:h,onContextMenu:p,onDoubleClick:m,style:_,className:b,isDraggable:v,isSelectable:g,isConnectable:y,isFocusable:S,selectNodesOnDrag:w,sourcePosition:x,targetPosition:C,hidden:k,resizeObserver:T,dragHandle:P,zIndex:$,isParent:O,noDragClassName:E,noPanClassName:A,initialized:D,disableKeyboardA11y:L,ariaLabel:M,rfId:R})=>{const N=hi(),B=I.useRef(null),U=I.useRef(x),G=I.useRef(C),Y=I.useRef(r),ee=g||v||c||d||f||h,J=AV(),j=Zp(n,N.getState,d),Q=Zp(n,N.getState,f),ne=Zp(n,N.getState,h),se=Zp(n,N.getState,p),ve=Zp(n,N.getState,m),ce=ze=>{if(g&&(!w||!v)&&DE({id:n,store:N,nodeRef:B}),c){const mt=N.getState().nodeInternals.get(n);mt&&c(ze,{...mt})}},bt=ze=>{if(!OE(ze))if(XU.includes(ze.key)&&g){const mt=ze.key==="Escape";DE({id:n,store:N,unselect:mt,nodeRef:B})}else!L&&v&&u&&Object.prototype.hasOwnProperty.call(vh,ze.key)&&(N.setState({ariaLiveMessage:`Moved selected node ${ze.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~o}, y: ${~~a}`}),J({x:vh[ze.key].x,y:vh[ze.key].y,isShiftPressed:ze.shiftKey}))};I.useEffect(()=>{if(B.current&&!k){const ze=B.current;return T==null||T.observe(ze),()=>T==null?void 0:T.unobserve(ze)}},[k]),I.useEffect(()=>{const ze=Y.current!==r,mt=U.current!==x,Pe=G.current!==C;B.current&&(ze||mt||Pe)&&(ze&&(Y.current=r),mt&&(U.current=x),Pe&&(G.current=C),N.getState().updateNodeDimensions([{id:n,nodeElement:B.current,forceUpdate:!0}]))},[n,r,x,C]);const ot=kV({nodeRef:B,disabled:k||!v,noDragClassName:E,handleSelector:P,nodeId:n,isSelectable:g,selectNodesOnDrag:w});return k?null:W.jsx("div",{className:ka(["react-flow__node",`react-flow__node-${r}`,{[A]:v},b,{selected:u,selectable:g,parent:O,dragging:ot}]),ref:B,style:{zIndex:$,transform:`translate(${s}px,${l}px)`,pointerEvents:ee?"all":"none",visibility:D?"visible":"hidden",..._},"data-id":n,"data-testid":`rf__node-${n}`,onMouseEnter:j,onMouseMove:Q,onMouseLeave:ne,onContextMenu:se,onClick:ce,onDoubleClick:ve,onKeyDown:S?bt:void 0,tabIndex:S?0:void 0,role:S?"button":void 0,"aria-describedby":L?void 0:`${yV}-${R}`,"aria-label":M,children:W.jsx(kbe,{value:n,children:W.jsx(e,{id:n,data:i,type:r,xPos:o,yPos:a,selected:u,isConnectable:y,sourcePosition:x,targetPosition:C,dragging:ot,dragHandle:P,zIndex:$})})})};return t.displayName="NodeWrapper",I.memo(t)};const g_e=e=>{const t=e.getNodes().filter(n=>n.selected);return{...uA(t,e.nodeOrigin),transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`,userSelectionActive:e.userSelectionActive}};function m_e({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const r=hi(),{width:i,height:o,x:a,y:s,transformString:l,userSelectionActive:u}=br(g_e,Ro),c=AV(),d=I.useRef(null);if(I.useEffect(()=>{var p;n||(p=d.current)==null||p.focus({preventScroll:!0})},[n]),kV({nodeRef:d}),u||!i||!o)return null;const f=e?p=>{const m=r.getState().getNodes().filter(_=>_.selected);e(p,m)}:void 0,h=p=>{Object.prototype.hasOwnProperty.call(vh,p.key)&&c({x:vh[p.key].x,y:vh[p.key].y,isShiftPressed:p.shiftKey})};return W.jsx("div",{className:ka(["react-flow__nodesselection","react-flow__container",t]),style:{transform:l},children:W.jsx("div",{ref:d,className:"react-flow__nodesselection-rect",onContextMenu:f,tabIndex:n?void 0:-1,onKeyDown:n?void 0:h,style:{width:i,height:o,top:s,left:a}})})}var y_e=I.memo(m_e);const v_e=e=>e.nodesSelectionActive,PV=({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:i,onPaneContextMenu:o,onPaneScroll:a,deleteKeyCode:s,onMove:l,onMoveStart:u,onMoveEnd:c,selectionKeyCode:d,selectionOnDrag:f,selectionMode:h,onSelectionStart:p,onSelectionEnd:m,multiSelectionKeyCode:_,panActivationKeyCode:b,zoomActivationKeyCode:v,elementsSelectable:g,zoomOnScroll:y,zoomOnPinch:S,panOnScroll:w,panOnScrollSpeed:x,panOnScrollMode:C,zoomOnDoubleClick:k,panOnDrag:T,defaultViewport:P,translateExtent:$,minZoom:O,maxZoom:E,preventScrolling:A,onSelectionContextMenu:D,noWheelClassName:L,noPanClassName:M,disableKeyboardA11y:R})=>{const N=br(v_e),B=g0(d),G=g0(b)||T,Y=B||f&&G!==!0;return i_e({deleteKeyCode:s,multiSelectionKeyCode:_}),W.jsx(l_e,{onMove:l,onMoveStart:u,onMoveEnd:c,onPaneContextMenu:o,elementsSelectable:g,zoomOnScroll:y,zoomOnPinch:S,panOnScroll:w,panOnScrollSpeed:x,panOnScrollMode:C,zoomOnDoubleClick:k,panOnDrag:!B&&G,defaultViewport:P,translateExtent:$,minZoom:O,maxZoom:E,zoomActivationKeyCode:v,preventScrolling:A,noWheelClassName:L,noPanClassName:M,children:W.jsxs(CV,{onSelectionStart:p,onSelectionEnd:m,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:i,onPaneContextMenu:o,onPaneScroll:a,panOnDrag:G,isSelecting:!!Y,selectionMode:h,children:[e,N&&W.jsx(y_e,{onSelectionContextMenu:D,noPanClassName:M,disableKeyboardA11y:R})]})})};PV.displayName="FlowRenderer";var b_e=I.memo(PV);function __e(e){return br(I.useCallback(n=>e?oV(n.nodeInternals,{x:0,y:0,width:n.width,height:n.height},n.transform,!0):n.getNodes(),[e]))}function S_e(e){const t={input:Jp(e.input||hV),default:Jp(e.default||$E),output:Jp(e.output||gV),group:Jp(e.group||fA)},n={},r=Object.keys(e).filter(i=>!["input","default","output","group"].includes(i)).reduce((i,o)=>(i[o]=Jp(e[o]||$E),i),n);return{...t,...r}}const x_e=({x:e,y:t,width:n,height:r,origin:i})=>!n||!r?{x:e,y:t}:i[0]<0||i[1]<0||i[0]>1||i[1]>1?{x:e,y:t}:{x:e-n*i[0],y:t-r*i[1]},w_e=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,updateNodeDimensions:e.updateNodeDimensions,onError:e.onError}),IV=e=>{const{nodesDraggable:t,nodesConnectable:n,nodesFocusable:r,elementsSelectable:i,updateNodeDimensions:o,onError:a}=br(w_e,Ro),s=__e(e.onlyRenderVisibleElements),l=I.useRef(),u=I.useMemo(()=>{if(typeof ResizeObserver>"u")return null;const c=new ResizeObserver(d=>{const f=d.map(h=>({id:h.target.getAttribute("data-id"),nodeElement:h.target,forceUpdate:!0}));o(f)});return l.current=c,c},[]);return I.useEffect(()=>()=>{var c;(c=l==null?void 0:l.current)==null||c.disconnect()},[]),W.jsx("div",{className:"react-flow__nodes",style:hA,children:s.map(c=>{var S,w;let d=c.type||"default";e.nodeTypes[d]||(a==null||a("003",Wl.error003(d)),d="default");const f=e.nodeTypes[d]||e.nodeTypes.default,h=!!(c.draggable||t&&typeof c.draggable>"u"),p=!!(c.selectable||i&&typeof c.selectable>"u"),m=!!(c.connectable||n&&typeof c.connectable>"u"),_=!!(c.focusable||r&&typeof c.focusable>"u"),b=e.nodeExtent?iA(c.positionAbsolute,e.nodeExtent):c.positionAbsolute,v=(b==null?void 0:b.x)??0,g=(b==null?void 0:b.y)??0,y=x_e({x:v,y:g,width:c.width??0,height:c.height??0,origin:e.nodeOrigin});return W.jsx(f,{id:c.id,className:c.className,style:c.style,type:d,data:c.data,sourcePosition:c.sourcePosition||tt.Bottom,targetPosition:c.targetPosition||tt.Top,hidden:c.hidden,xPos:v,yPos:g,xPosOrigin:y.x,yPosOrigin:y.y,selectNodesOnDrag:e.selectNodesOnDrag,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,selected:!!c.selected,isDraggable:h,isSelectable:p,isConnectable:m,isFocusable:_,resizeObserver:u,dragHandle:c.dragHandle,zIndex:((S=c[Kr])==null?void 0:S.z)??0,isParent:!!((w=c[Kr])!=null&&w.isParent),noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,initialized:!!c.width&&!!c.height,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,ariaLabel:c.ariaLabel},c.id)})})};IV.displayName="NodeRenderer";var C_e=I.memo(IV);const E_e=(e,t,n)=>n===tt.Left?e-t:n===tt.Right?e+t:e,T_e=(e,t,n)=>n===tt.Top?e-t:n===tt.Bottom?e+t:e,P9="react-flow__edgeupdater",I9=({position:e,centerX:t,centerY:n,radius:r=10,onMouseDown:i,onMouseEnter:o,onMouseOut:a,type:s})=>W.jsx("circle",{onMouseDown:i,onMouseEnter:o,onMouseOut:a,className:ka([P9,`${P9}-${s}`]),cx:E_e(t,r,e),cy:T_e(n,r,e),r,stroke:"transparent",fill:"transparent"}),k_e=()=>!0;var gf=e=>{const t=({id:n,className:r,type:i,data:o,onClick:a,onEdgeDoubleClick:s,selected:l,animated:u,label:c,labelStyle:d,labelShowBg:f,labelBgStyle:h,labelBgPadding:p,labelBgBorderRadius:m,style:_,source:b,target:v,sourceX:g,sourceY:y,targetX:S,targetY:w,sourcePosition:x,targetPosition:C,elementsSelectable:k,hidden:T,sourceHandleId:P,targetHandleId:$,onContextMenu:O,onMouseEnter:E,onMouseMove:A,onMouseLeave:D,edgeUpdaterRadius:L,onEdgeUpdate:M,onEdgeUpdateStart:R,onEdgeUpdateEnd:N,markerEnd:B,markerStart:U,rfId:G,ariaLabel:Y,isFocusable:ee,isUpdatable:J,pathOptions:j,interactionWidth:Q})=>{const ne=I.useRef(null),[se,ve]=I.useState(!1),[ce,bt]=I.useState(!1),ot=hi(),ze=I.useMemo(()=>`url(#${NE(U,G)})`,[U,G]),mt=I.useMemo(()=>`url(#${NE(B,G)})`,[B,G]);if(T)return null;const Pe=Fn=>{const{edges:bn,addSelectedEdges:Mi}=ot.getState();if(k&&(ot.setState({nodesSelectionActive:!1}),Mi([n])),a){const pi=bn.find(Qi=>Qi.id===n);a(Fn,pi)}},Jt=Yp(n,ot.getState,s),Ar=Yp(n,ot.getState,O),Dn=Yp(n,ot.getState,E),kn=Yp(n,ot.getState,A),en=Yp(n,ot.getState,D),Ln=(Fn,bn)=>{if(Fn.button!==0)return;const{edges:Mi,isValidConnection:pi}=ot.getState(),Qi=bn?v:b,$a=(bn?$:P)||null,Ir=bn?"target":"source",ho=pi||k_e,ol=bn,$o=Mi.find(tn=>tn.id===n);bt(!0),R==null||R(Fn,$o,Ir);const al=tn=>{bt(!1),N==null||N(tn,$o,Ir)};uV({event:Fn,handleId:$a,nodeId:Qi,onConnect:tn=>M==null?void 0:M($o,tn),isTarget:ol,getState:ot.getState,setState:ot.setState,isValidConnection:ho,edgeUpdaterType:Ir,onEdgeUpdateEnd:al})},Pr=Fn=>Ln(Fn,!0),fo=Fn=>Ln(Fn,!1),Jr=()=>ve(!0),hr=()=>ve(!1),Fr=!k&&!a,ei=Fn=>{var bn;if(XU.includes(Fn.key)&&k){const{unselectNodesAndEdges:Mi,addSelectedEdges:pi,edges:Qi}=ot.getState();Fn.key==="Escape"?((bn=ne.current)==null||bn.blur(),Mi({edges:[Qi.find(Ir=>Ir.id===n)]})):pi([n])}};return W.jsxs("g",{className:ka(["react-flow__edge",`react-flow__edge-${i}`,r,{selected:l,animated:u,inactive:Fr,updating:se}]),onClick:Pe,onDoubleClick:Jt,onContextMenu:Ar,onMouseEnter:Dn,onMouseMove:kn,onMouseLeave:en,onKeyDown:ee?ei:void 0,tabIndex:ee?0:void 0,role:ee?"button":"img","data-testid":`rf__edge-${n}`,"aria-label":Y===null?void 0:Y||`Edge from ${b} to ${v}`,"aria-describedby":ee?`${vV}-${G}`:void 0,ref:ne,children:[!ce&&W.jsx(e,{id:n,source:b,target:v,selected:l,animated:u,label:c,labelStyle:d,labelShowBg:f,labelBgStyle:h,labelBgPadding:p,labelBgBorderRadius:m,data:o,style:_,sourceX:g,sourceY:y,targetX:S,targetY:w,sourcePosition:x,targetPosition:C,sourceHandleId:P,targetHandleId:$,markerStart:ze,markerEnd:mt,pathOptions:j,interactionWidth:Q}),J&&W.jsxs(W.Fragment,{children:[(J==="source"||J===!0)&&W.jsx(I9,{position:x,centerX:g,centerY:y,radius:L,onMouseDown:Pr,onMouseEnter:Jr,onMouseOut:hr,type:"source"}),(J==="target"||J===!0)&&W.jsx(I9,{position:C,centerX:S,centerY:w,radius:L,onMouseDown:fo,onMouseEnter:Jr,onMouseOut:hr,type:"target"})]})]})};return t.displayName="EdgeWrapper",I.memo(t)};function A_e(e){const t={default:gf(e.default||M_),straight:gf(e.bezier||sA),step:gf(e.step||aA),smoothstep:gf(e.step||X2),simplebezier:gf(e.simplebezier||oA)},n={},r=Object.keys(e).filter(i=>!["default","bezier"].includes(i)).reduce((i,o)=>(i[o]=gf(e[o]||M_),i),n);return{...t,...r}}function R9(e,t,n=null){const r=((n==null?void 0:n.x)||0)+t.x,i=((n==null?void 0:n.y)||0)+t.y,o=(n==null?void 0:n.width)||t.width,a=(n==null?void 0:n.height)||t.height;switch(e){case tt.Top:return{x:r+o/2,y:i};case tt.Right:return{x:r+o,y:i+a/2};case tt.Bottom:return{x:r+o/2,y:i+a};case tt.Left:return{x:r,y:i+a/2}}}function O9(e,t){return e?e.length===1||!t?e[0]:t&&e.find(n=>n.id===t)||null:null}const P_e=(e,t,n,r,i,o)=>{const a=R9(n,e,t),s=R9(o,r,i);return{sourceX:a.x,sourceY:a.y,targetX:s.x,targetY:s.y}};function I_e({sourcePos:e,targetPos:t,sourceWidth:n,sourceHeight:r,targetWidth:i,targetHeight:o,width:a,height:s,transform:l}){const u={x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x+n,t.x+i),y2:Math.max(e.y+r,t.y+o)};u.x===u.x2&&(u.x2+=1),u.y===u.y2&&(u.y2+=1);const c=p0({x:(0-l[0])/l[2],y:(0-l[1])/l[2],width:a/l[2],height:s/l[2]}),d=Math.max(0,Math.min(c.x2,u.x2)-Math.max(c.x,u.x)),f=Math.max(0,Math.min(c.y2,u.y2)-Math.max(c.y,u.y));return Math.ceil(d*f)>0}function M9(e){var r,i,o,a,s;const t=((r=e==null?void 0:e[Kr])==null?void 0:r.handleBounds)||null,n=t&&(e==null?void 0:e.width)&&(e==null?void 0:e.height)&&typeof((i=e==null?void 0:e.positionAbsolute)==null?void 0:i.x)<"u"&&typeof((o=e==null?void 0:e.positionAbsolute)==null?void 0:o.y)<"u";return[{x:((a=e==null?void 0:e.positionAbsolute)==null?void 0:a.x)||0,y:((s=e==null?void 0:e.positionAbsolute)==null?void 0:s.y)||0,width:(e==null?void 0:e.width)||0,height:(e==null?void 0:e.height)||0},t,!!n]}const R_e=[{level:0,isMaxLevel:!0,edges:[]}];function O_e(e,t,n=!1){let r=-1;const i=e.reduce((a,s)=>{var c,d;const l=ba(s.zIndex);let u=l?s.zIndex:0;if(n){const f=t.get(s.target),h=t.get(s.source),p=s.selected||(f==null?void 0:f.selected)||(h==null?void 0:h.selected),m=Math.max(((c=h==null?void 0:h[Kr])==null?void 0:c.z)||0,((d=f==null?void 0:f[Kr])==null?void 0:d.z)||0,1e3);u=(l?s.zIndex:0)+(p?m:0)}return a[u]?a[u].push(s):a[u]=[s],r=u>r?u:r,a},{}),o=Object.entries(i).map(([a,s])=>{const l=+a;return{edges:s,level:l,isMaxLevel:l===r}});return o.length===0?R_e:o}function M_e(e,t,n){const r=br(I.useCallback(i=>e?i.edges.filter(o=>{const a=t.get(o.source),s=t.get(o.target);return(a==null?void 0:a.width)&&(a==null?void 0:a.height)&&(s==null?void 0:s.width)&&(s==null?void 0:s.height)&&I_e({sourcePos:a.positionAbsolute||{x:0,y:0},targetPos:s.positionAbsolute||{x:0,y:0},sourceWidth:a.width,sourceHeight:a.height,targetWidth:s.width,targetHeight:s.height,width:i.width,height:i.height,transform:i.transform})}):i.edges,[e,t]));return O_e(r,t,n)}const N_e=({color:e="none",strokeWidth:t=1})=>W.jsx("polyline",{stroke:e,strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:t,fill:"none",points:"-5,-4 0,0 -5,4"}),$_e=({color:e="none",strokeWidth:t=1})=>W.jsx("polyline",{stroke:e,strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:t,fill:e,points:"-5,-4 0,0 -5,4 -5,-4"}),N9={[O_.Arrow]:N_e,[O_.ArrowClosed]:$_e};function D_e(e){const t=hi();return I.useMemo(()=>{var i,o;return Object.prototype.hasOwnProperty.call(N9,e)?N9[e]:((o=(i=t.getState()).onError)==null||o.call(i,"009",Wl.error009(e)),null)},[e])}const L_e=({id:e,type:t,color:n,width:r=12.5,height:i=12.5,markerUnits:o="strokeWidth",strokeWidth:a,orient:s="auto-start-reverse"})=>{const l=D_e(t);return l?W.jsx("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${r}`,markerHeight:`${i}`,viewBox:"-10 -10 20 20",markerUnits:o,orient:s,refX:"0",refY:"0",children:W.jsx(l,{color:n,strokeWidth:a})}):null},F_e=({defaultColor:e,rfId:t})=>n=>{const r=[];return n.edges.reduce((i,o)=>([o.markerStart,o.markerEnd].forEach(a=>{if(a&&typeof a=="object"){const s=NE(a,t);r.includes(s)||(i.push({id:s,color:a.color||e,...a}),r.push(s))}}),i),[]).sort((i,o)=>i.id.localeCompare(o.id))},RV=({defaultColor:e,rfId:t})=>{const n=br(I.useCallback(F_e({defaultColor:e,rfId:t}),[e,t]),(r,i)=>!(r.length!==i.length||r.some((o,a)=>o.id!==i[a].id)));return W.jsx("defs",{children:n.map(r=>W.jsx(L_e,{id:r.id,type:r.type,color:r.color,width:r.width,height:r.height,markerUnits:r.markerUnits,strokeWidth:r.strokeWidth,orient:r.orient},r.id))})};RV.displayName="MarkerDefinitions";var B_e=I.memo(RV);const z_e=e=>({nodesConnectable:e.nodesConnectable,edgesFocusable:e.edgesFocusable,edgesUpdatable:e.edgesUpdatable,elementsSelectable:e.elementsSelectable,width:e.width,height:e.height,connectionMode:e.connectionMode,nodeInternals:e.nodeInternals,onError:e.onError}),OV=({defaultMarkerColor:e,onlyRenderVisibleElements:t,elevateEdgesOnSelect:n,rfId:r,edgeTypes:i,noPanClassName:o,onEdgeUpdate:a,onEdgeContextMenu:s,onEdgeMouseEnter:l,onEdgeMouseMove:u,onEdgeMouseLeave:c,onEdgeClick:d,edgeUpdaterRadius:f,onEdgeDoubleClick:h,onEdgeUpdateStart:p,onEdgeUpdateEnd:m,children:_})=>{const{edgesFocusable:b,edgesUpdatable:v,elementsSelectable:g,width:y,height:S,connectionMode:w,nodeInternals:x,onError:C}=br(z_e,Ro),k=M_e(t,x,n);return y?W.jsxs(W.Fragment,{children:[k.map(({level:T,edges:P,isMaxLevel:$})=>W.jsxs("svg",{style:{zIndex:T},width:y,height:S,className:"react-flow__edges react-flow__container",children:[$&&W.jsx(B_e,{defaultColor:e,rfId:r}),W.jsx("g",{children:P.map(O=>{const[E,A,D]=M9(x.get(O.source)),[L,M,R]=M9(x.get(O.target));if(!D||!R)return null;let N=O.type||"default";i[N]||(C==null||C("011",Wl.error011(N)),N="default");const B=i[N]||i.default,U=w===Dd.Strict?M.target:(M.target??[]).concat(M.source??[]),G=O9(A.source,O.sourceHandle),Y=O9(U,O.targetHandle),ee=(G==null?void 0:G.position)||tt.Bottom,J=(Y==null?void 0:Y.position)||tt.Top,j=!!(O.focusable||b&&typeof O.focusable>"u"),Q=typeof a<"u"&&(O.updatable||v&&typeof O.updatable>"u");if(!G||!Y)return C==null||C("008",Wl.error008(G,O)),null;const{sourceX:ne,sourceY:se,targetX:ve,targetY:ce}=P_e(E,G,ee,L,Y,J);return W.jsx(B,{id:O.id,className:ka([O.className,o]),type:N,data:O.data,selected:!!O.selected,animated:!!O.animated,hidden:!!O.hidden,label:O.label,labelStyle:O.labelStyle,labelShowBg:O.labelShowBg,labelBgStyle:O.labelBgStyle,labelBgPadding:O.labelBgPadding,labelBgBorderRadius:O.labelBgBorderRadius,style:O.style,source:O.source,target:O.target,sourceHandleId:O.sourceHandle,targetHandleId:O.targetHandle,markerEnd:O.markerEnd,markerStart:O.markerStart,sourceX:ne,sourceY:se,targetX:ve,targetY:ce,sourcePosition:ee,targetPosition:J,elementsSelectable:g,onEdgeUpdate:a,onContextMenu:s,onMouseEnter:l,onMouseMove:u,onMouseLeave:c,onClick:d,edgeUpdaterRadius:f,onEdgeDoubleClick:h,onEdgeUpdateStart:p,onEdgeUpdateEnd:m,rfId:r,ariaLabel:O.ariaLabel,isFocusable:j,isUpdatable:Q,pathOptions:"pathOptions"in O?O.pathOptions:void 0,interactionWidth:O.interactionWidth},O.id)})})]},T)),_]}):null};OV.displayName="EdgeRenderer";var j_e=I.memo(OV);const U_e=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function V_e({children:e}){const t=br(U_e);return W.jsx("div",{className:"react-flow__viewport react-flow__container",style:{transform:t},children:e})}function G_e(e){const t=xV(),n=I.useRef(!1);I.useEffect(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}const q_e={[tt.Left]:tt.Right,[tt.Right]:tt.Left,[tt.Top]:tt.Bottom,[tt.Bottom]:tt.Top},MV=({nodeId:e,handleType:t,style:n,type:r=ku.Bezier,CustomComponent:i,connectionStatus:o})=>{var w,x,C;const{fromNode:a,handleId:s,toX:l,toY:u,connectionMode:c}=br(I.useCallback(k=>({fromNode:k.nodeInternals.get(e),handleId:k.connectionHandleId,toX:(k.connectionPosition.x-k.transform[0])/k.transform[2],toY:(k.connectionPosition.y-k.transform[1])/k.transform[2],connectionMode:k.connectionMode}),[e]),Ro),d=(w=a==null?void 0:a[Kr])==null?void 0:w.handleBounds;let f=d==null?void 0:d[t];if(c===Dd.Loose&&(f=f||(d==null?void 0:d[t==="source"?"target":"source"])),!a||!f)return null;const h=s?f.find(k=>k.id===s):f[0],p=h?h.x+h.width/2:(a.width??0)/2,m=h?h.y+h.height/2:a.height??0,_=(((x=a.positionAbsolute)==null?void 0:x.x)??0)+p,b=(((C=a.positionAbsolute)==null?void 0:C.y)??0)+m,v=h==null?void 0:h.position,g=v?q_e[v]:null;if(!v||!g)return null;if(i)return W.jsx(i,{connectionLineType:r,connectionLineStyle:n,fromNode:a,fromHandle:h,fromX:_,fromY:b,toX:l,toY:u,fromPosition:v,toPosition:g,connectionStatus:o});let y="";const S={sourceX:_,sourceY:b,sourcePosition:v,targetX:l,targetY:u,targetPosition:g};return r===ku.Bezier?[y]=tV(S):r===ku.Step?[y]=ME({...S,borderRadius:0}):r===ku.SmoothStep?[y]=ME(S):r===ku.SimpleBezier?[y]=eV(S):y=`M${_},${b} ${l},${u}`,W.jsx("path",{d:y,fill:"none",className:"react-flow__connection-path",style:n})};MV.displayName="ConnectionLine";const H_e=e=>({nodeId:e.connectionNodeId,handleType:e.connectionHandleType,nodesConnectable:e.nodesConnectable,connectionStatus:e.connectionStatus,width:e.width,height:e.height});function W_e({containerStyle:e,style:t,type:n,component:r}){const{nodeId:i,handleType:o,nodesConnectable:a,width:s,height:l,connectionStatus:u}=br(H_e,Ro);return!(i&&o&&s&&a)?null:W.jsx("svg",{style:e,width:s,height:l,className:"react-flow__edges react-flow__connectionline react-flow__container",children:W.jsx("g",{className:ka(["react-flow__connection",u]),children:W.jsx(MV,{nodeId:i,handleType:o,style:t,type:n,CustomComponent:r,connectionStatus:u})})})}function $9(e,t){return I.useRef(null),hi(),I.useMemo(()=>t(e),[e])}const NV=({nodeTypes:e,edgeTypes:t,onMove:n,onMoveStart:r,onMoveEnd:i,onInit:o,onNodeClick:a,onEdgeClick:s,onNodeDoubleClick:l,onEdgeDoubleClick:u,onNodeMouseEnter:c,onNodeMouseMove:d,onNodeMouseLeave:f,onNodeContextMenu:h,onSelectionContextMenu:p,onSelectionStart:m,onSelectionEnd:_,connectionLineType:b,connectionLineStyle:v,connectionLineComponent:g,connectionLineContainerStyle:y,selectionKeyCode:S,selectionOnDrag:w,selectionMode:x,multiSelectionKeyCode:C,panActivationKeyCode:k,zoomActivationKeyCode:T,deleteKeyCode:P,onlyRenderVisibleElements:$,elementsSelectable:O,selectNodesOnDrag:E,defaultViewport:A,translateExtent:D,minZoom:L,maxZoom:M,preventScrolling:R,defaultMarkerColor:N,zoomOnScroll:B,zoomOnPinch:U,panOnScroll:G,panOnScrollSpeed:Y,panOnScrollMode:ee,zoomOnDoubleClick:J,panOnDrag:j,onPaneClick:Q,onPaneMouseEnter:ne,onPaneMouseMove:se,onPaneMouseLeave:ve,onPaneScroll:ce,onPaneContextMenu:bt,onEdgeUpdate:ot,onEdgeContextMenu:ze,onEdgeMouseEnter:mt,onEdgeMouseMove:Pe,onEdgeMouseLeave:Jt,edgeUpdaterRadius:Ar,onEdgeUpdateStart:Dn,onEdgeUpdateEnd:kn,noDragClassName:en,noWheelClassName:Ln,noPanClassName:Pr,elevateEdgesOnSelect:fo,disableKeyboardA11y:Jr,nodeOrigin:hr,nodeExtent:Fr,rfId:ei})=>{const Fn=$9(e,S_e),bn=$9(t,A_e);return G_e(o),W.jsx(b_e,{onPaneClick:Q,onPaneMouseEnter:ne,onPaneMouseMove:se,onPaneMouseLeave:ve,onPaneContextMenu:bt,onPaneScroll:ce,deleteKeyCode:P,selectionKeyCode:S,selectionOnDrag:w,selectionMode:x,onSelectionStart:m,onSelectionEnd:_,multiSelectionKeyCode:C,panActivationKeyCode:k,zoomActivationKeyCode:T,elementsSelectable:O,onMove:n,onMoveStart:r,onMoveEnd:i,zoomOnScroll:B,zoomOnPinch:U,zoomOnDoubleClick:J,panOnScroll:G,panOnScrollSpeed:Y,panOnScrollMode:ee,panOnDrag:j,defaultViewport:A,translateExtent:D,minZoom:L,maxZoom:M,onSelectionContextMenu:p,preventScrolling:R,noDragClassName:en,noWheelClassName:Ln,noPanClassName:Pr,disableKeyboardA11y:Jr,children:W.jsxs(V_e,{children:[W.jsx(j_e,{edgeTypes:bn,onEdgeClick:s,onEdgeDoubleClick:u,onEdgeUpdate:ot,onlyRenderVisibleElements:$,onEdgeContextMenu:ze,onEdgeMouseEnter:mt,onEdgeMouseMove:Pe,onEdgeMouseLeave:Jt,onEdgeUpdateStart:Dn,onEdgeUpdateEnd:kn,edgeUpdaterRadius:Ar,defaultMarkerColor:N,noPanClassName:Pr,elevateEdgesOnSelect:!!fo,disableKeyboardA11y:Jr,rfId:ei,children:W.jsx(W_e,{style:v,type:b,component:g,containerStyle:y})}),W.jsx("div",{className:"react-flow__edgelabel-renderer"}),W.jsx(C_e,{nodeTypes:Fn,onNodeClick:a,onNodeDoubleClick:l,onNodeMouseEnter:c,onNodeMouseMove:d,onNodeMouseLeave:f,onNodeContextMenu:h,selectNodesOnDrag:E,onlyRenderVisibleElements:$,noPanClassName:Pr,noDragClassName:en,disableKeyboardA11y:Jr,nodeOrigin:hr,nodeExtent:Fr,rfId:ei})]})})};NV.displayName="GraphView";var K_e=I.memo(NV);const LE=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],cu={rfId:"1",width:0,height:0,transform:[0,0,1],nodeInternals:new Map,edges:[],onNodesChange:null,onEdgesChange:null,hasDefaultNodes:!1,hasDefaultEdges:!1,d3Zoom:null,d3Selection:null,d3ZoomHandler:void 0,minZoom:.5,maxZoom:2,translateExtent:LE,nodeExtent:LE,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionNodeId:null,connectionHandleId:null,connectionHandleType:"source",connectionPosition:{x:0,y:0},connectionStatus:null,connectionMode:Dd.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:[0,0],snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesUpdatable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,fitViewOnInit:!1,fitViewOnInitDone:!1,fitViewOnInitOptions:void 0,multiSelectionActive:!1,connectionStartHandle:null,connectionEndHandle:null,connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,connectionRadius:20,onError:Sbe,isValidConnection:void 0},Q_e=()=>$0e((e,t)=>({...cu,setNodes:n=>{const{nodeInternals:r,nodeOrigin:i,elevateNodesOnSelect:o}=t();e({nodeInternals:FC(n,r,i,o)})},getNodes:()=>Array.from(t().nodeInternals.values()),setEdges:n=>{const{defaultEdgeOptions:r={}}=t();e({edges:n.map(i=>({...r,...i}))})},setDefaultNodesAndEdges:(n,r)=>{const i=typeof n<"u",o=typeof r<"u",a=i?FC(n,new Map,t().nodeOrigin,t().elevateNodesOnSelect):new Map;e({nodeInternals:a,edges:o?r:[],hasDefaultNodes:i,hasDefaultEdges:o})},updateNodeDimensions:n=>{const{onNodesChange:r,nodeInternals:i,fitViewOnInit:o,fitViewOnInitDone:a,fitViewOnInitOptions:s,domNode:l,nodeOrigin:u}=t(),c=l==null?void 0:l.querySelector(".react-flow__viewport");if(!c)return;const d=window.getComputedStyle(c),{m22:f}=new window.DOMMatrixReadOnly(d.transform),h=n.reduce((m,_)=>{const b=i.get(_.id);if(b){const v=rA(_.nodeElement);!!(v.width&&v.height&&(b.width!==v.width||b.height!==v.height||_.forceUpdate))&&(i.set(b.id,{...b,[Kr]:{...b[Kr],handleBounds:{source:A9(".source",_.nodeElement,f,u),target:A9(".target",_.nodeElement,f,u)}},...v}),m.push({id:b.id,type:"dimensions",dimensions:v}))}return m},[]);_V(i,u);const p=a||o&&!a&&SV(t,{initial:!0,...s});e({nodeInternals:new Map(i),fitViewOnInitDone:p}),(h==null?void 0:h.length)>0&&(r==null||r(h))},updateNodePositions:(n,r=!0,i=!1)=>{const{triggerNodeChanges:o}=t(),a=n.map(s=>{const l={id:s.id,type:"position",dragging:i};return r&&(l.positionAbsolute=s.positionAbsolute,l.position=s.position),l});o(a)},triggerNodeChanges:n=>{const{onNodesChange:r,nodeInternals:i,hasDefaultNodes:o,nodeOrigin:a,getNodes:s,elevateNodesOnSelect:l}=t();if(n!=null&&n.length){if(o){const u=Gc(n,s()),c=FC(u,i,a,l);e({nodeInternals:c})}r==null||r(n)}},addSelectedNodes:n=>{const{multiSelectionActive:r,edges:i,getNodes:o}=t();let a,s=null;r?a=n.map(l=>_u(l,!0)):(a=jf(o(),n),s=jf(i,[])),Nv({changedNodes:a,changedEdges:s,get:t,set:e})},addSelectedEdges:n=>{const{multiSelectionActive:r,edges:i,getNodes:o}=t();let a,s=null;r?a=n.map(l=>_u(l,!0)):(a=jf(i,n),s=jf(o(),[])),Nv({changedNodes:s,changedEdges:a,get:t,set:e})},unselectNodesAndEdges:({nodes:n,edges:r}={})=>{const{edges:i,getNodes:o}=t(),a=n||o(),s=r||i,l=a.map(c=>(c.selected=!1,_u(c.id,!1))),u=s.map(c=>_u(c.id,!1));Nv({changedNodes:l,changedEdges:u,get:t,set:e})},setMinZoom:n=>{const{d3Zoom:r,maxZoom:i}=t();r==null||r.scaleExtent([n,i]),e({minZoom:n})},setMaxZoom:n=>{const{d3Zoom:r,minZoom:i}=t();r==null||r.scaleExtent([i,n]),e({maxZoom:n})},setTranslateExtent:n=>{var r;(r=t().d3Zoom)==null||r.translateExtent(n),e({translateExtent:n})},resetSelectedElements:()=>{const{edges:n,getNodes:r}=t(),o=r().filter(s=>s.selected).map(s=>_u(s.id,!1)),a=n.filter(s=>s.selected).map(s=>_u(s.id,!1));Nv({changedNodes:o,changedEdges:a,get:t,set:e})},setNodeExtent:n=>{const{nodeInternals:r}=t();r.forEach(i=>{i.positionAbsolute=iA(i.position,n)}),e({nodeExtent:n,nodeInternals:new Map(r)})},panBy:n=>{const{transform:r,width:i,height:o,d3Zoom:a,d3Selection:s,translateExtent:l}=t();if(!a||!s||!n.x&&!n.y)return!1;const u=Xu.translate(r[0]+n.x,r[1]+n.y).scale(r[2]),c=[[0,0],[i,o]],d=a==null?void 0:a.constrain()(u,c,l);return a.transform(s,d),r[0]!==d.x||r[1]!==d.y||r[2]!==d.k},cancelConnection:()=>e({connectionNodeId:cu.connectionNodeId,connectionHandleId:cu.connectionHandleId,connectionHandleType:cu.connectionHandleType,connectionStatus:cu.connectionStatus,connectionStartHandle:cu.connectionStartHandle,connectionEndHandle:cu.connectionEndHandle}),reset:()=>e({...cu})}),Object.is),$V=({children:e})=>{const t=I.useRef(null);return t.current||(t.current=Q_e()),W.jsx(pbe,{value:t.current,children:e})};$V.displayName="ReactFlowProvider";const DV=({children:e})=>I.useContext(Q2)?W.jsx(W.Fragment,{children:e}):W.jsx($V,{children:e});DV.displayName="ReactFlowWrapper";const X_e={input:hV,default:$E,output:gV,group:fA},Y_e={default:M_,straight:sA,step:aA,smoothstep:X2,simplebezier:oA},Z_e=[0,0],J_e=[15,15],eSe={x:0,y:0,zoom:1},tSe={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0},nSe=I.forwardRef(({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,className:i,nodeTypes:o=X_e,edgeTypes:a=Y_e,onNodeClick:s,onEdgeClick:l,onInit:u,onMove:c,onMoveStart:d,onMoveEnd:f,onConnect:h,onConnectStart:p,onConnectEnd:m,onClickConnectStart:_,onClickConnectEnd:b,onNodeMouseEnter:v,onNodeMouseMove:g,onNodeMouseLeave:y,onNodeContextMenu:S,onNodeDoubleClick:w,onNodeDragStart:x,onNodeDrag:C,onNodeDragStop:k,onNodesDelete:T,onEdgesDelete:P,onSelectionChange:$,onSelectionDragStart:O,onSelectionDrag:E,onSelectionDragStop:A,onSelectionContextMenu:D,onSelectionStart:L,onSelectionEnd:M,connectionMode:R=Dd.Strict,connectionLineType:N=ku.Bezier,connectionLineStyle:B,connectionLineComponent:U,connectionLineContainerStyle:G,deleteKeyCode:Y="Backspace",selectionKeyCode:ee="Shift",selectionOnDrag:J=!1,selectionMode:j=uc.Full,panActivationKeyCode:Q="Space",multiSelectionKeyCode:ne=R_()?"Meta":"Control",zoomActivationKeyCode:se=R_()?"Meta":"Control",snapToGrid:ve=!1,snapGrid:ce=J_e,onlyRenderVisibleElements:bt=!1,selectNodesOnDrag:ot=!0,nodesDraggable:ze,nodesConnectable:mt,nodesFocusable:Pe,nodeOrigin:Jt=Z_e,edgesFocusable:Ar,edgesUpdatable:Dn,elementsSelectable:kn,defaultViewport:en=eSe,minZoom:Ln=.5,maxZoom:Pr=2,translateExtent:fo=LE,preventScrolling:Jr=!0,nodeExtent:hr,defaultMarkerColor:Fr="#b1b1b7",zoomOnScroll:ei=!0,zoomOnPinch:Fn=!0,panOnScroll:bn=!1,panOnScrollSpeed:Mi=.5,panOnScrollMode:pi=sd.Free,zoomOnDoubleClick:Qi=!0,panOnDrag:$a=!0,onPaneClick:Ir,onPaneMouseEnter:ho,onPaneMouseMove:ol,onPaneMouseLeave:$o,onPaneScroll:al,onPaneContextMenu:Bn,children:tn,onEdgeUpdate:Br,onEdgeContextMenu:Rr,onEdgeDoubleClick:Or,onEdgeMouseEnter:ti,onEdgeMouseMove:Ni,onEdgeMouseLeave:po,onEdgeUpdateStart:gi,onEdgeUpdateEnd:zr,edgeUpdaterRadius:Da=10,onNodesChange:ps,onEdgesChange:mi,noDragClassName:iu="nodrag",noWheelClassName:ia="nowheel",noPanClassName:ni="nopan",fitView:sl=!1,fitViewOptions:H,connectOnClick:te=!0,attributionPosition:re,proOptions:de,defaultEdgeOptions:oe,elevateNodesOnSelect:je=!0,elevateEdgesOnSelect:Ge=!1,disableKeyboardA11y:ut=!1,autoPanOnConnect:$e=!0,autoPanOnNodeDrag:qe=!0,connectionRadius:Ie=20,isValidConnection:ie,onError:Se,style:Ye,id:Ze,...ct},dt)=>{const _t=Ze||"1";return W.jsx("div",{...ct,style:{...Ye,...tSe},ref:dt,className:ka(["react-flow",i]),"data-testid":"rf__wrapper",id:Ze,children:W.jsxs(DV,{children:[W.jsx(K_e,{onInit:u,onMove:c,onMoveStart:d,onMoveEnd:f,onNodeClick:s,onEdgeClick:l,onNodeMouseEnter:v,onNodeMouseMove:g,onNodeMouseLeave:y,onNodeContextMenu:S,onNodeDoubleClick:w,nodeTypes:o,edgeTypes:a,connectionLineType:N,connectionLineStyle:B,connectionLineComponent:U,connectionLineContainerStyle:G,selectionKeyCode:ee,selectionOnDrag:J,selectionMode:j,deleteKeyCode:Y,multiSelectionKeyCode:ne,panActivationKeyCode:Q,zoomActivationKeyCode:se,onlyRenderVisibleElements:bt,selectNodesOnDrag:ot,defaultViewport:en,translateExtent:fo,minZoom:Ln,maxZoom:Pr,preventScrolling:Jr,zoomOnScroll:ei,zoomOnPinch:Fn,zoomOnDoubleClick:Qi,panOnScroll:bn,panOnScrollSpeed:Mi,panOnScrollMode:pi,panOnDrag:$a,onPaneClick:Ir,onPaneMouseEnter:ho,onPaneMouseMove:ol,onPaneMouseLeave:$o,onPaneScroll:al,onPaneContextMenu:Bn,onSelectionContextMenu:D,onSelectionStart:L,onSelectionEnd:M,onEdgeUpdate:Br,onEdgeContextMenu:Rr,onEdgeDoubleClick:Or,onEdgeMouseEnter:ti,onEdgeMouseMove:Ni,onEdgeMouseLeave:po,onEdgeUpdateStart:gi,onEdgeUpdateEnd:zr,edgeUpdaterRadius:Da,defaultMarkerColor:Fr,noDragClassName:iu,noWheelClassName:ia,noPanClassName:ni,elevateEdgesOnSelect:Ge,rfId:_t,disableKeyboardA11y:ut,nodeOrigin:Jt,nodeExtent:hr}),W.jsx(Hbe,{nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:h,onConnectStart:p,onConnectEnd:m,onClickConnectStart:_,onClickConnectEnd:b,nodesDraggable:ze,nodesConnectable:mt,nodesFocusable:Pe,edgesFocusable:Ar,edgesUpdatable:Dn,elementsSelectable:kn,elevateNodesOnSelect:je,minZoom:Ln,maxZoom:Pr,nodeExtent:hr,onNodesChange:ps,onEdgesChange:mi,snapToGrid:ve,snapGrid:ce,connectionMode:R,translateExtent:fo,connectOnClick:te,defaultEdgeOptions:oe,fitView:sl,fitViewOptions:H,onNodesDelete:T,onEdgesDelete:P,onNodeDragStart:x,onNodeDrag:C,onNodeDragStop:k,onSelectionDrag:E,onSelectionDragStart:O,onSelectionDragStop:A,noPanClassName:ni,nodeOrigin:Jt,rfId:_t,autoPanOnConnect:$e,autoPanOnNodeDrag:qe,onError:Se,connectionRadius:Ie,isValidConnection:ie}),W.jsx(Gbe,{onSelectionChange:$}),tn,W.jsx(ybe,{proOptions:de,position:re}),W.jsx(Ybe,{rfId:_t,disableKeyboardA11y:ut})]})})});nSe.displayName="ReactFlow";const rSe=e=>{var t;return(t=e.domNode)==null?void 0:t.querySelector(".react-flow__edgelabel-renderer")};function Iqe({children:e}){const t=br(rSe);return t?Uo.createPortal(e,t):null}function Rqe(){const e=hi();return I.useCallback(t=>{const{domNode:n,updateNodeDimensions:r}=e.getState(),o=(Array.isArray(t)?t:[t]).reduce((a,s)=>{const l=n==null?void 0:n.querySelector(`.react-flow__node[data-id="${s}"]`);return l&&a.push({id:s,nodeElement:l,forceUpdate:!0}),a},[]);requestAnimationFrame(()=>r(o))},[])}function iSe(){const e=[];return function(t,n){if(typeof n!="object"||n===null)return n;for(;e.length>0&&e.at(-1)!==this;)e.pop();return e.includes(n)?"[Circular]":(e.push(n),n)}}const m0=zb("nodes/receivedOpenAPISchema",async(e,{rejectWithValue:t})=>{try{const n=[window.location.origin,"openapi.json"].join("/"),i=await(await fetch(n)).json();return JSON.parse(JSON.stringify(i,iSe()))}catch(n){return t({error:n})}});let Dv;const oSe=new Uint8Array(16);function aSe(){if(!Dv&&(Dv=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Dv))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Dv(oSe)}const Si=[];for(let e=0;e<256;++e)Si.push((e+256).toString(16).slice(1));function sSe(e,t=0){return(Si[e[t+0]]+Si[e[t+1]]+Si[e[t+2]]+Si[e[t+3]]+"-"+Si[e[t+4]]+Si[e[t+5]]+"-"+Si[e[t+6]]+Si[e[t+7]]+"-"+Si[e[t+8]]+Si[e[t+9]]+"-"+Si[e[t+10]]+Si[e[t+11]]+Si[e[t+12]]+Si[e[t+13]]+Si[e[t+14]]+Si[e[t+15]]).toLowerCase()}const lSe=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),D9={randomUUID:lSe};function LV(e,t,n){if(D9.randomUUID&&!t&&!e)return D9.randomUUID();e=e||{};const r=e.random||(e.rng||aSe)();if(r[6]=r[6]&15|64,r[8]=r[8]&63|128,t){n=n||0;for(let i=0;i<16;++i)t[n+i]=r[i];return t}return sSe(r)}const Oqe=500,Mqe=320,uSe="node-drag-handle",Nqe=["ImageField","ImageCollection"],$qe={input:"inputs",output:"outputs"},Lv=["Collection","IntegerCollection","BooleanCollection","FloatCollection","StringCollection","ImageCollection","LatentsCollection","ConditioningCollection","ControlCollection","ColorCollection","T2IAdapterCollection"],Cg=["IntegerPolymorphic","BooleanPolymorphic","FloatPolymorphic","StringPolymorphic","ImagePolymorphic","LatentsPolymorphic","ConditioningPolymorphic","ControlPolymorphic","ColorPolymorphic","T2IAdapterPolymorphic"],Dqe=["IPAdapterModelField","ControlNetModelField","LoRAModelField","MainModelField","ONNXModelField","SDXLMainModelField","SDXLRefinerModelField","VaeModelField","UNetField","VaeField","ClipField","T2IAdapterModelField"],pA={integer:"IntegerCollection",boolean:"BooleanCollection",number:"FloatCollection",float:"FloatCollection",string:"StringCollection",ImageField:"ImageCollection",LatentsField:"LatentsCollection",ConditioningField:"ConditioningCollection",ControlField:"ControlCollection",ColorField:"ColorCollection",T2IAdapterField:"T2IAdapterCollection"},cSe=e=>!!(e&&e in pA),FV={integer:"IntegerPolymorphic",boolean:"BooleanPolymorphic",number:"FloatPolymorphic",float:"FloatPolymorphic",string:"StringPolymorphic",ImageField:"ImagePolymorphic",LatentsField:"LatentsPolymorphic",ConditioningField:"ConditioningPolymorphic",ControlField:"ControlPolymorphic",ColorField:"ColorPolymorphic",T2IAdapterField:"T2IAdapterPolymorphic"},dSe={IntegerPolymorphic:"integer",BooleanPolymorphic:"boolean",FloatPolymorphic:"float",StringPolymorphic:"string",ImagePolymorphic:"ImageField",LatentsPolymorphic:"LatentsField",ConditioningPolymorphic:"ConditioningField",ControlPolymorphic:"ControlField",ColorPolymorphic:"ColorField",T2IAdapterPolymorphic:"T2IAdapterField"},Lqe=["string","StringPolymorphic","boolean","BooleanPolymorphic","integer","float","FloatPolymorphic","IntegerPolymorphic","enum","ImageField","ImagePolymorphic","MainModelField","SDXLRefinerModelField","VaeModelField","LoRAModelField","ControlNetModelField","ColorField","SDXLMainModelField","Scheduler","IPAdapterModelField","BoardField","T2IAdapterModelField"],fSe=e=>!!(e&&e in FV),Fqe={boolean:{color:"green.500",description:Z("nodes.booleanDescription"),title:Z("nodes.boolean")},BooleanCollection:{color:"green.500",description:Z("nodes.booleanCollectionDescription"),title:Z("nodes.booleanCollection")},BooleanPolymorphic:{color:"green.500",description:Z("nodes.booleanPolymorphicDescription"),title:Z("nodes.booleanPolymorphic")},ClipField:{color:"green.500",description:Z("nodes.clipFieldDescription"),title:Z("nodes.clipField")},Collection:{color:"base.500",description:Z("nodes.collectionDescription"),title:Z("nodes.collection")},CollectionItem:{color:"base.500",description:Z("nodes.collectionItemDescription"),title:Z("nodes.collectionItem")},ColorCollection:{color:"pink.300",description:Z("nodes.colorCollectionDescription"),title:Z("nodes.colorCollection")},ColorField:{color:"pink.300",description:Z("nodes.colorFieldDescription"),title:Z("nodes.colorField")},ColorPolymorphic:{color:"pink.300",description:Z("nodes.colorPolymorphicDescription"),title:Z("nodes.colorPolymorphic")},ConditioningCollection:{color:"cyan.500",description:Z("nodes.conditioningCollectionDescription"),title:Z("nodes.conditioningCollection")},ConditioningField:{color:"cyan.500",description:Z("nodes.conditioningFieldDescription"),title:Z("nodes.conditioningField")},ConditioningPolymorphic:{color:"cyan.500",description:Z("nodes.conditioningPolymorphicDescription"),title:Z("nodes.conditioningPolymorphic")},ControlCollection:{color:"teal.500",description:Z("nodes.controlCollectionDescription"),title:Z("nodes.controlCollection")},ControlField:{color:"teal.500",description:Z("nodes.controlFieldDescription"),title:Z("nodes.controlField")},ControlNetModelField:{color:"teal.500",description:"TODO",title:"ControlNet"},ControlPolymorphic:{color:"teal.500",description:"Control info passed between nodes.",title:"Control Polymorphic"},DenoiseMaskField:{color:"blue.300",description:Z("nodes.denoiseMaskFieldDescription"),title:Z("nodes.denoiseMaskField")},enum:{color:"blue.500",description:Z("nodes.enumDescription"),title:Z("nodes.enum")},float:{color:"orange.500",description:Z("nodes.floatDescription"),title:Z("nodes.float")},FloatCollection:{color:"orange.500",description:Z("nodes.floatCollectionDescription"),title:Z("nodes.floatCollection")},FloatPolymorphic:{color:"orange.500",description:Z("nodes.floatPolymorphicDescription"),title:Z("nodes.floatPolymorphic")},ImageCollection:{color:"purple.500",description:Z("nodes.imageCollectionDescription"),title:Z("nodes.imageCollection")},ImageField:{color:"purple.500",description:Z("nodes.imageFieldDescription"),title:Z("nodes.imageField")},BoardField:{color:"purple.500",description:Z("nodes.imageFieldDescription"),title:Z("nodes.imageField")},ImagePolymorphic:{color:"purple.500",description:Z("nodes.imagePolymorphicDescription"),title:Z("nodes.imagePolymorphic")},integer:{color:"red.500",description:Z("nodes.integerDescription"),title:Z("nodes.integer")},IntegerCollection:{color:"red.500",description:Z("nodes.integerCollectionDescription"),title:Z("nodes.integerCollection")},IntegerPolymorphic:{color:"red.500",description:Z("nodes.integerPolymorphicDescription"),title:Z("nodes.integerPolymorphic")},IPAdapterField:{color:"teal.500",description:"IP-Adapter info passed between nodes.",title:"IP-Adapter"},IPAdapterModelField:{color:"teal.500",description:"IP-Adapter model",title:"IP-Adapter Model"},LatentsCollection:{color:"pink.500",description:Z("nodes.latentsCollectionDescription"),title:Z("nodes.latentsCollection")},LatentsField:{color:"pink.500",description:Z("nodes.latentsFieldDescription"),title:Z("nodes.latentsField")},LatentsPolymorphic:{color:"pink.500",description:Z("nodes.latentsPolymorphicDescription"),title:Z("nodes.latentsPolymorphic")},LoRAModelField:{color:"teal.500",description:Z("nodes.loRAModelFieldDescription"),title:Z("nodes.loRAModelField")},MainModelField:{color:"teal.500",description:Z("nodes.mainModelFieldDescription"),title:Z("nodes.mainModelField")},ONNXModelField:{color:"teal.500",description:Z("nodes.oNNXModelFieldDescription"),title:Z("nodes.oNNXModelField")},Scheduler:{color:"base.500",description:Z("nodes.schedulerDescription"),title:Z("nodes.scheduler")},SDXLMainModelField:{color:"teal.500",description:Z("nodes.sDXLMainModelFieldDescription"),title:Z("nodes.sDXLMainModelField")},SDXLRefinerModelField:{color:"teal.500",description:Z("nodes.sDXLRefinerModelFieldDescription"),title:Z("nodes.sDXLRefinerModelField")},string:{color:"yellow.500",description:Z("nodes.stringDescription"),title:Z("nodes.string")},StringCollection:{color:"yellow.500",description:Z("nodes.stringCollectionDescription"),title:Z("nodes.stringCollection")},StringPolymorphic:{color:"yellow.500",description:Z("nodes.stringPolymorphicDescription"),title:Z("nodes.stringPolymorphic")},T2IAdapterCollection:{color:"teal.500",description:Z("nodes.t2iAdapterCollectionDescription"),title:Z("nodes.t2iAdapterCollection")},T2IAdapterField:{color:"teal.500",description:Z("nodes.t2iAdapterFieldDescription"),title:Z("nodes.t2iAdapterField")},T2IAdapterModelField:{color:"teal.500",description:"TODO",title:"T2I-Adapter"},T2IAdapterPolymorphic:{color:"teal.500",description:"T2I-Adapter info passed between nodes.",title:"T2I-Adapter Polymorphic"},UNetField:{color:"red.500",description:Z("nodes.uNetFieldDescription"),title:Z("nodes.uNetField")},VaeField:{color:"blue.500",description:Z("nodes.vaeFieldDescription"),title:Z("nodes.vaeField")},VaeModelField:{color:"teal.500",description:Z("nodes.vaeModelFieldDescription"),title:Z("nodes.vaeModelField")}},L9=(e,t,n)=>{let r=t,i=n;for(;e.find(o=>o.position.x===r&&o.position.y===i);)r=r+50,i=i+50;return{x:r,y:i}},hSe=(e,t)=>{if(e==="Collection"&&t==="Collection")return!1;if(e===t)return!0;const n=e==="CollectionItem"&&!Lv.includes(t),r=t==="CollectionItem"&&!Lv.includes(e)&&!Cg.includes(e),i=Cg.includes(t)&&(()=>{if(!Cg.includes(t))return!1;const u=dSe[t],c=pA[u];return e===u||e===c})(),o=e==="Collection"&&(Lv.includes(t)||Cg.includes(t)),a=t==="Collection"&&Lv.includes(e);return n||r||i||o||a||e==="integer"&&t==="float"||(e==="integer"||e==="float")&&t==="string"};var pSe="\0",$c="\0",F9="",yo,cd,zo,B0,Ah,Ph,fa,Es,Pu,Ts,Iu,xl,wl,Ih,Rh,Cl,Ua,z0,FE,BN;let gSe=(BN=class{constructor(t){Yn(this,z0);Yn(this,yo,!0);Yn(this,cd,!1);Yn(this,zo,!1);Yn(this,B0,void 0);Yn(this,Ah,()=>{});Yn(this,Ph,()=>{});Yn(this,fa,{});Yn(this,Es,{});Yn(this,Pu,{});Yn(this,Ts,{});Yn(this,Iu,{});Yn(this,xl,{});Yn(this,wl,{});Yn(this,Ih,0);Yn(this,Rh,0);Yn(this,Cl,void 0);Yn(this,Ua,void 0);t&&(oa(this,yo,t.hasOwnProperty("directed")?t.directed:!0),oa(this,cd,t.hasOwnProperty("multigraph")?t.multigraph:!1),oa(this,zo,t.hasOwnProperty("compound")?t.compound:!1)),ae(this,zo)&&(oa(this,Cl,{}),oa(this,Ua,{}),ae(this,Ua)[$c]={})}isDirected(){return ae(this,yo)}isMultigraph(){return ae(this,cd)}isCompound(){return ae(this,zo)}setGraph(t){return oa(this,B0,t),this}graph(){return ae(this,B0)}setDefaultNodeLabel(t){return oa(this,Ah,t),typeof t!="function"&&oa(this,Ah,()=>t),this}nodeCount(){return ae(this,Ih)}nodes(){return Object.keys(ae(this,fa))}sources(){var t=this;return this.nodes().filter(n=>Object.keys(ae(t,Es)[n]).length===0)}sinks(){var t=this;return this.nodes().filter(n=>Object.keys(ae(t,Ts)[n]).length===0)}setNodes(t,n){var r=arguments,i=this;return t.forEach(function(o){r.length>1?i.setNode(o,n):i.setNode(o)}),this}setNode(t,n){return ae(this,fa).hasOwnProperty(t)?(arguments.length>1&&(ae(this,fa)[t]=n),this):(ae(this,fa)[t]=arguments.length>1?n:ae(this,Ah).call(this,t),ae(this,zo)&&(ae(this,Cl)[t]=$c,ae(this,Ua)[t]={},ae(this,Ua)[$c][t]=!0),ae(this,Es)[t]={},ae(this,Pu)[t]={},ae(this,Ts)[t]={},ae(this,Iu)[t]={},++Np(this,Ih)._,this)}node(t){return ae(this,fa)[t]}hasNode(t){return ae(this,fa).hasOwnProperty(t)}removeNode(t){var n=this;if(ae(this,fa).hasOwnProperty(t)){var r=i=>n.removeEdge(ae(n,xl)[i]);delete ae(this,fa)[t],ae(this,zo)&&(gs(this,z0,FE).call(this,t),delete ae(this,Cl)[t],this.children(t).forEach(function(i){n.setParent(i)}),delete ae(this,Ua)[t]),Object.keys(ae(this,Es)[t]).forEach(r),delete ae(this,Es)[t],delete ae(this,Pu)[t],Object.keys(ae(this,Ts)[t]).forEach(r),delete ae(this,Ts)[t],delete ae(this,Iu)[t],--Np(this,Ih)._}return this}setParent(t,n){if(!ae(this,zo))throw new Error("Cannot set parent in a non-compound graph");if(n===void 0)n=$c;else{n+="";for(var r=n;r!==void 0;r=this.parent(r))if(r===t)throw new Error("Setting "+n+" as parent of "+t+" would create a cycle");this.setNode(n)}return this.setNode(t),gs(this,z0,FE).call(this,t),ae(this,Cl)[t]=n,ae(this,Ua)[n][t]=!0,this}parent(t){if(ae(this,zo)){var n=ae(this,Cl)[t];if(n!==$c)return n}}children(t=$c){if(ae(this,zo)){var n=ae(this,Ua)[t];if(n)return Object.keys(n)}else{if(t===$c)return this.nodes();if(this.hasNode(t))return[]}}predecessors(t){var n=ae(this,Pu)[t];if(n)return Object.keys(n)}successors(t){var n=ae(this,Iu)[t];if(n)return Object.keys(n)}neighbors(t){var n=this.predecessors(t);if(n){const i=new Set(n);for(var r of this.successors(t))i.add(r);return Array.from(i.values())}}isLeaf(t){var n;return this.isDirected()?n=this.successors(t):n=this.neighbors(t),n.length===0}filterNodes(t){var n=new this.constructor({directed:ae(this,yo),multigraph:ae(this,cd),compound:ae(this,zo)});n.setGraph(this.graph());var r=this;Object.entries(ae(this,fa)).forEach(function([a,s]){t(a)&&n.setNode(a,s)}),Object.values(ae(this,xl)).forEach(function(a){n.hasNode(a.v)&&n.hasNode(a.w)&&n.setEdge(a,r.edge(a))});var i={};function o(a){var s=r.parent(a);return s===void 0||n.hasNode(s)?(i[a]=s,s):s in i?i[s]:o(s)}return ae(this,zo)&&n.nodes().forEach(a=>n.setParent(a,o(a))),n}setDefaultEdgeLabel(t){return oa(this,Ph,t),typeof t!="function"&&oa(this,Ph,()=>t),this}edgeCount(){return ae(this,Rh)}edges(){return Object.values(ae(this,xl))}setPath(t,n){var r=this,i=arguments;return t.reduce(function(o,a){return i.length>1?r.setEdge(o,a,n):r.setEdge(o,a),a}),this}setEdge(){var t,n,r,i,o=!1,a=arguments[0];typeof a=="object"&&a!==null&&"v"in a?(t=a.v,n=a.w,r=a.name,arguments.length===2&&(i=arguments[1],o=!0)):(t=a,n=arguments[1],r=arguments[3],arguments.length>2&&(i=arguments[2],o=!0)),t=""+t,n=""+n,r!==void 0&&(r=""+r);var s=Eg(ae(this,yo),t,n,r);if(ae(this,wl).hasOwnProperty(s))return o&&(ae(this,wl)[s]=i),this;if(r!==void 0&&!ae(this,cd))throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(t),this.setNode(n),ae(this,wl)[s]=o?i:ae(this,Ph).call(this,t,n,r);var l=mSe(ae(this,yo),t,n,r);return t=l.v,n=l.w,Object.freeze(l),ae(this,xl)[s]=l,B9(ae(this,Pu)[n],t),B9(ae(this,Iu)[t],n),ae(this,Es)[n][s]=l,ae(this,Ts)[t][s]=l,Np(this,Rh)._++,this}edge(t,n,r){var i=arguments.length===1?UC(ae(this,yo),arguments[0]):Eg(ae(this,yo),t,n,r);return ae(this,wl)[i]}edgeAsObj(){const t=this.edge(...arguments);return typeof t!="object"?{label:t}:t}hasEdge(t,n,r){var i=arguments.length===1?UC(ae(this,yo),arguments[0]):Eg(ae(this,yo),t,n,r);return ae(this,wl).hasOwnProperty(i)}removeEdge(t,n,r){var i=arguments.length===1?UC(ae(this,yo),arguments[0]):Eg(ae(this,yo),t,n,r),o=ae(this,xl)[i];return o&&(t=o.v,n=o.w,delete ae(this,wl)[i],delete ae(this,xl)[i],z9(ae(this,Pu)[n],t),z9(ae(this,Iu)[t],n),delete ae(this,Es)[n][i],delete ae(this,Ts)[t][i],Np(this,Rh)._--),this}inEdges(t,n){var r=ae(this,Es)[t];if(r){var i=Object.values(r);return n?i.filter(o=>o.v===n):i}}outEdges(t,n){var r=ae(this,Ts)[t];if(r){var i=Object.values(r);return n?i.filter(o=>o.w===n):i}}nodeEdges(t,n){var r=this.inEdges(t,n);if(r)return r.concat(this.outEdges(t,n))}},yo=new WeakMap,cd=new WeakMap,zo=new WeakMap,B0=new WeakMap,Ah=new WeakMap,Ph=new WeakMap,fa=new WeakMap,Es=new WeakMap,Pu=new WeakMap,Ts=new WeakMap,Iu=new WeakMap,xl=new WeakMap,wl=new WeakMap,Ih=new WeakMap,Rh=new WeakMap,Cl=new WeakMap,Ua=new WeakMap,z0=new WeakSet,FE=function(t){delete ae(this,Ua)[ae(this,Cl)[t]][t]},BN);function B9(e,t){e[t]?e[t]++:e[t]=1}function z9(e,t){--e[t]||delete e[t]}function Eg(e,t,n,r){var i=""+t,o=""+n;if(!e&&i>o){var a=i;i=o,o=a}return i+F9+o+F9+(r===void 0?pSe:r)}function mSe(e,t,n,r){var i=""+t,o=""+n;if(!e&&i>o){var a=i;i=o,o=a}var s={v:i,w:o};return r&&(s.name=r),s}function UC(e,t){return Eg(e,t.v,t.w,t.name)}var gA=gSe,ySe="2.1.13",vSe={Graph:gA,version:ySe},bSe=gA,_Se={write:SSe,read:CSe};function SSe(e){var t={options:{directed:e.isDirected(),multigraph:e.isMultigraph(),compound:e.isCompound()},nodes:xSe(e),edges:wSe(e)};return e.graph()!==void 0&&(t.value=structuredClone(e.graph())),t}function xSe(e){return e.nodes().map(function(t){var n=e.node(t),r=e.parent(t),i={v:t};return n!==void 0&&(i.value=n),r!==void 0&&(i.parent=r),i})}function wSe(e){return e.edges().map(function(t){var n=e.edge(t),r={v:t.v,w:t.w};return t.name!==void 0&&(r.name=t.name),n!==void 0&&(r.value=n),r})}function CSe(e){var t=new bSe(e.options).setGraph(e.value);return e.nodes.forEach(function(n){t.setNode(n.v,n.value),n.parent&&t.setParent(n.v,n.parent)}),e.edges.forEach(function(n){t.setEdge({v:n.v,w:n.w,name:n.name},n.value)}),t}var ESe=TSe;function TSe(e){var t={},n=[],r;function i(o){t.hasOwnProperty(o)||(t[o]=!0,r.push(o),e.successors(o).forEach(i),e.predecessors(o).forEach(i))}return e.nodes().forEach(function(o){r=[],i(o),r.length&&n.push(r)}),n}var zi,El,j0,BE,U0,zE,Oh,U1,zN;let kSe=(zN=class{constructor(){Yn(this,j0);Yn(this,U0);Yn(this,Oh);Yn(this,zi,[]);Yn(this,El,{})}size(){return ae(this,zi).length}keys(){return ae(this,zi).map(function(t){return t.key})}has(t){return ae(this,El).hasOwnProperty(t)}priority(t){var n=ae(this,El)[t];if(n!==void 0)return ae(this,zi)[n].priority}min(){if(this.size()===0)throw new Error("Queue underflow");return ae(this,zi)[0].key}add(t,n){var r=ae(this,El);if(t=String(t),!r.hasOwnProperty(t)){var i=ae(this,zi),o=i.length;return r[t]=o,i.push({key:t,priority:n}),gs(this,U0,zE).call(this,o),!0}return!1}removeMin(){gs(this,Oh,U1).call(this,0,ae(this,zi).length-1);var t=ae(this,zi).pop();return delete ae(this,El)[t.key],gs(this,j0,BE).call(this,0),t.key}decrease(t,n){var r=ae(this,El)[t];if(n>ae(this,zi)[r].priority)throw new Error("New priority is greater than current priority. Key: "+t+" Old: "+ae(this,zi)[r].priority+" New: "+n);ae(this,zi)[r].priority=n,gs(this,U0,zE).call(this,r)}},zi=new WeakMap,El=new WeakMap,j0=new WeakSet,BE=function(t){var n=ae(this,zi),r=2*t,i=r+1,o=t;r>1,!(n[i].priority1;function ISe(e,t,n,r){return RSe(e,String(t),n||PSe,r||function(i){return e.outEdges(i)})}function RSe(e,t,n,r){var i={},o=new ASe,a,s,l=function(u){var c=u.v!==a?u.v:u.w,d=i[c],f=n(u),h=s.distance+f;if(f<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+u+" Weight: "+f);h0&&(a=o.removeMin(),s=i[a],s.distance!==Number.POSITIVE_INFINITY);)r(a).forEach(l);return i}var OSe=zV,MSe=NSe;function NSe(e,t,n){return e.nodes().reduce(function(r,i){return r[i]=OSe(e,i,t,n),r},{})}var jV=$Se;function $Se(e){var t=0,n=[],r={},i=[];function o(a){var s=r[a]={onStack:!0,lowlink:t,index:t++};if(n.push(a),e.successors(a).forEach(function(c){r.hasOwnProperty(c)?r[c].onStack&&(s.lowlink=Math.min(s.lowlink,r[c].index)):(o(c),s.lowlink=Math.min(s.lowlink,r[c].lowlink))}),s.lowlink===s.index){var l=[],u;do u=n.pop(),r[u].onStack=!1,l.push(u);while(a!==u);i.push(l)}}return e.nodes().forEach(function(a){r.hasOwnProperty(a)||o(a)}),i}var DSe=jV,LSe=FSe;function FSe(e){return DSe(e).filter(function(t){return t.length>1||t.length===1&&e.hasEdge(t[0],t[0])})}var BSe=jSe,zSe=()=>1;function jSe(e,t,n){return USe(e,t||zSe,n||function(r){return e.outEdges(r)})}function USe(e,t,n){var r={},i=e.nodes();return i.forEach(function(o){r[o]={},r[o][o]={distance:0},i.forEach(function(a){o!==a&&(r[o][a]={distance:Number.POSITIVE_INFINITY})}),n(o).forEach(function(a){var s=a.v===o?a.w:a.v,l=t(a);r[o][s]={distance:l,predecessor:o}})}),i.forEach(function(o){var a=r[o];i.forEach(function(s){var l=r[s];i.forEach(function(u){var c=l[o],d=a[u],f=l[u],h=c.distance+d.distance;he.successors(s):s=>e.neighbors(s),i=n==="post"?HSe:WSe,o=[],a={};return t.forEach(s=>{if(!e.hasNode(s))throw new Error("Graph does not have node: "+s);i(s,r,a,o)}),o}function HSe(e,t,n,r){for(var i=[[e,!1]];i.length>0;){var o=i.pop();o[1]?r.push(o[0]):n.hasOwnProperty(o[0])||(n[o[0]]=!0,i.push([o[0],!0]),qV(t(o[0]),a=>i.push([a,!1])))}}function WSe(e,t,n,r){for(var i=[e];i.length>0;){var o=i.pop();n.hasOwnProperty(o)||(n[o]=!0,r.push(o),qV(t(o),a=>i.push(a)))}}function qV(e,t){for(var n=e.length;n--;)t(e[n],n,e);return e}var KSe=GV,QSe=XSe;function XSe(e,t){return KSe(e,t,"post")}var YSe=GV,ZSe=JSe;function JSe(e,t){return YSe(e,t,"pre")}var e2e=gA,t2e=BV,n2e=r2e;function r2e(e,t){var n=new e2e,r={},i=new t2e,o;function a(l){var u=l.v===o?l.w:l.v,c=i.priority(u);if(c!==void 0){var d=t(l);d0;){if(o=i.removeMin(),r.hasOwnProperty(o))n.setEdge(o,r[o]);else{if(s)throw new Error("Input graph is not connected: "+e);s=!0}e.nodeEdges(o).forEach(a)}return n}var i2e={components:ESe,dijkstra:zV,dijkstraAll:MSe,findCycles:LSe,floydWarshall:BSe,isAcyclic:VSe,postorder:QSe,preorder:ZSe,prim:n2e,tarjan:jV,topsort:VV},U9=vSe,o2e={Graph:U9.Graph,json:_Se,alg:i2e,version:U9.version};const V9=mc(o2e),G9=(e,t,n,r)=>{const i=new V9.Graph;return n.forEach(o=>{i.setNode(o.id)}),r.forEach(o=>{i.setEdge(o.source,o.target)}),i.setEdge(e,t),V9.alg.isAcyclic(i)},q9=(e,t,n,r,i)=>{let o=!0;return t==="source"?e.find(a=>a.target===r.id&&a.targetHandle===i.name)&&(o=!1):e.find(a=>a.source===r.id&&a.sourceHandle===i.name)&&(o=!1),hSe(n,i.type)||(o=!1),o},H9=(e,t,n,r,i,o,a)=>{if(e.id===r)return null;const s=o=="source"?e.data.inputs:e.data.outputs;if(s[i]){const l=s[i],u=o=="source"?r:e.id,c=o=="source"?e.id:r,d=o=="source"?i:l.name,f=o=="source"?l.name:i,h=G9(u,c,t,n),p=q9(n,o,a,e,l);if(h&&p)return{source:u,sourceHandle:d,target:c,targetHandle:f}}for(const l in s){const u=s[l],c=o=="source"?r:e.id,d=o=="source"?e.id:r,f=o=="source"?i:u.name,h=o=="source"?u.name:i,p=G9(c,d,t,n),m=q9(n,o,a,e,u);if(p&&m)return{source:c,sourceHandle:f,target:d,targetHandle:h}}return null},a2e="1.0.0",VC={status:Wc.PENDING,error:null,progress:null,progressImage:null,outputs:[]},UE={meta:{version:a2e},name:"",author:"",description:"",notes:"",tags:"",contact:"",version:"",exposedFields:[]},HV={nodes:[],edges:[],nodeTemplates:{},isReady:!1,connectionStartParams:null,currentConnectionFieldType:null,connectionMade:!1,modifyingEdge:!1,addNewNodePosition:null,shouldShowFieldTypeLegend:!1,shouldShowMinimapPanel:!0,shouldValidateGraph:!0,shouldAnimateEdges:!0,shouldSnapToGrid:!1,shouldColorEdges:!0,isAddNodePopoverOpen:!1,nodeOpacity:1,selectedNodes:[],selectedEdges:[],workflow:UE,nodeExecutionStates:{},viewport:{x:0,y:0,zoom:1},mouseOverField:null,mouseOverNode:null,nodesToCopy:[],edgesToCopy:[],selectionMode:uc.Partial},Zi=(e,t)=>{var l,u;const{nodeId:n,fieldName:r,value:i}=t.payload,o=e.nodes.findIndex(c=>c.id===n),a=(l=e.nodes)==null?void 0:l[o];if(!jr(a))return;const s=(u=a.data)==null?void 0:u.inputs[r];s&&o>-1&&(s.value=i)},WV=nr({name:"nodes",initialState:HV,reducers:{nodesChanged:(e,t)=>{e.nodes=Gc(t.payload,e.nodes)},nodeAdded:(e,t)=>{var i,o;const n=t.payload,r=L9(e.nodes,((i=e.addNewNodePosition)==null?void 0:i.x)??n.position.x,((o=e.addNewNodePosition)==null?void 0:o.y)??n.position.y);if(n.position=r,n.selected=!0,e.nodes=Gc(e.nodes.map(a=>({id:a.id,type:"select",selected:!1})),e.nodes),e.edges=Nc(e.edges.map(a=>({id:a.id,type:"select",selected:!1})),e.edges),e.nodes.push(n),!!jr(n)){if(e.nodeExecutionStates[n.id]={nodeId:n.id,...VC},e.connectionStartParams){const{nodeId:a,handleId:s,handleType:l}=e.connectionStartParams;if(a&&s&&l&&e.currentConnectionFieldType){const u=H9(n,e.nodes,e.edges,a,s,l,e.currentConnectionFieldType);u&&(e.edges=wg({...u,type:"default"},e.edges))}}e.connectionStartParams=null,e.currentConnectionFieldType=null}},edgeChangeStarted:e=>{e.modifyingEdge=!0},edgesChanged:(e,t)=>{e.edges=Nc(t.payload,e.edges)},edgeAdded:(e,t)=>{e.edges=wg(t.payload,e.edges)},edgeUpdated:(e,t)=>{const{oldEdge:n,newConnection:r}=t.payload;e.edges=Mbe(n,r,e.edges)},connectionStarted:(e,t)=>{var l;e.connectionStartParams=t.payload,e.connectionMade=e.modifyingEdge;const{nodeId:n,handleId:r,handleType:i}=t.payload;if(!n||!r)return;const o=e.nodes.findIndex(u=>u.id===n),a=(l=e.nodes)==null?void 0:l[o];if(!jr(a))return;const s=i==="source"?a.data.outputs[r]:a.data.inputs[r];e.currentConnectionFieldType=(s==null?void 0:s.type)??null},connectionMade:(e,t)=>{e.currentConnectionFieldType&&(e.edges=wg({...t.payload,type:"default"},e.edges),e.connectionMade=!0)},connectionEnded:(e,t)=>{var n;if(e.connectionMade)e.connectionStartParams=null,e.currentConnectionFieldType=null;else if(e.mouseOverNode){const r=e.nodes.findIndex(o=>o.id===e.mouseOverNode),i=(n=e.nodes)==null?void 0:n[r];if(i&&e.connectionStartParams){const{nodeId:o,handleId:a,handleType:s}=e.connectionStartParams;if(o&&a&&s&&e.currentConnectionFieldType){const l=H9(i,e.nodes,e.edges,o,a,s,e.currentConnectionFieldType);l&&(e.edges=wg({...l,type:"default"},e.edges))}}e.connectionStartParams=null,e.currentConnectionFieldType=null}else e.addNewNodePosition=t.payload.cursorPosition,e.isAddNodePopoverOpen=!0;e.modifyingEdge=!1},workflowExposedFieldAdded:(e,t)=>{e.workflow.exposedFields=X8(e.workflow.exposedFields.concat(t.payload),n=>`${n.nodeId}-${n.fieldName}`)},workflowExposedFieldRemoved:(e,t)=>{e.workflow.exposedFields=e.workflow.exposedFields.filter(n=>!fk(n,t.payload))},fieldLabelChanged:(e,t)=>{const{nodeId:n,fieldName:r,label:i}=t.payload,o=e.nodes.find(s=>s.id===n);if(!jr(o))return;const a=o.data.inputs[r];a&&(a.label=i)},nodeEmbedWorkflowChanged:(e,t)=>{var a;const{nodeId:n,embedWorkflow:r}=t.payload,i=e.nodes.findIndex(s=>s.id===n),o=(a=e.nodes)==null?void 0:a[i];jr(o)&&(o.data.embedWorkflow=r)},nodeUseCacheChanged:(e,t)=>{var a;const{nodeId:n,useCache:r}=t.payload,i=e.nodes.findIndex(s=>s.id===n),o=(a=e.nodes)==null?void 0:a[i];jr(o)&&(o.data.useCache=r)},nodeIsIntermediateChanged:(e,t)=>{var a;const{nodeId:n,isIntermediate:r}=t.payload,i=e.nodes.findIndex(s=>s.id===n),o=(a=e.nodes)==null?void 0:a[i];jr(o)&&(o.data.isIntermediate=r)},nodeIsOpenChanged:(e,t)=>{var s;const{nodeId:n,isOpen:r}=t.payload,i=e.nodes.findIndex(l=>l.id===n),o=(s=e.nodes)==null?void 0:s[i];if(!jr(o)&&!mI(o)||(o.data.isOpen=r,!jr(o)))return;const a=cA([o],e.edges);if(r)a.forEach(l=>{delete l.hidden}),a.forEach(l=>{l.type==="collapsed"&&(e.edges=e.edges.filter(u=>u.id!==l.id))});else{const l=Rbe(o,e.nodes,e.edges).filter(d=>jr(d)&&d.data.isOpen===!1),u=Ibe(o,e.nodes,e.edges).filter(d=>jr(d)&&d.data.isOpen===!1),c=[];a.forEach(d=>{var f,h;if(d.target===n&&l.find(p=>p.id===d.source)){d.hidden=!0;const p=c.find(m=>m.source===d.source&&m.target===d.target);p?p.data={count:(((f=p.data)==null?void 0:f.count)??0)+1}:c.push({id:`${d.source}-${d.target}-collapsed`,source:d.source,target:d.target,type:"collapsed",data:{count:1},updatable:!1})}if(d.source===n&&u.find(p=>p.id===d.target)){const p=c.find(m=>m.source===d.source&&m.target===d.target);d.hidden=!0,p?p.data={count:(((h=p.data)==null?void 0:h.count)??0)+1}:c.push({id:`${d.source}-${d.target}-collapsed`,source:d.source,target:d.target,type:"collapsed",data:{count:1},updatable:!1})}}),c.length&&(e.edges=Nc(c.map(d=>({type:"add",item:d})),e.edges))}},edgeDeleted:(e,t)=>{e.edges=e.edges.filter(n=>n.id!==t.payload)},edgesDeleted:(e,t)=>{const r=t.payload.filter(i=>i.type==="collapsed");if(r.length){const i=[];r.forEach(o=>{e.edges.forEach(a=>{a.source===o.source&&a.target===o.target&&i.push({id:a.id,type:"remove"})})}),e.edges=Nc(i,e.edges)}},nodesDeleted:(e,t)=>{t.payload.forEach(n=>{e.workflow.exposedFields=e.workflow.exposedFields.filter(r=>r.nodeId!==n.id),jr(n)&&delete e.nodeExecutionStates[n.id]})},nodeLabelChanged:(e,t)=>{var a;const{nodeId:n,label:r}=t.payload,i=e.nodes.findIndex(s=>s.id===n),o=(a=e.nodes)==null?void 0:a[i];jr(o)&&(o.data.label=r)},nodeNotesChanged:(e,t)=>{var a;const{nodeId:n,notes:r}=t.payload,i=e.nodes.findIndex(s=>s.id===n),o=(a=e.nodes)==null?void 0:a[i];jr(o)&&(o.data.notes=r)},nodeExclusivelySelected:(e,t)=>{const n=t.payload;e.nodes=Gc(e.nodes.map(r=>({id:r.id,type:"select",selected:r.id===n})),e.nodes)},selectedNodesChanged:(e,t)=>{e.selectedNodes=t.payload},selectedEdgesChanged:(e,t)=>{e.selectedEdges=t.payload},fieldStringValueChanged:(e,t)=>{Zi(e,t)},fieldNumberValueChanged:(e,t)=>{Zi(e,t)},fieldBooleanValueChanged:(e,t)=>{Zi(e,t)},fieldBoardValueChanged:(e,t)=>{Zi(e,t)},fieldImageValueChanged:(e,t)=>{Zi(e,t)},fieldColorValueChanged:(e,t)=>{Zi(e,t)},fieldMainModelValueChanged:(e,t)=>{Zi(e,t)},fieldRefinerModelValueChanged:(e,t)=>{Zi(e,t)},fieldVaeModelValueChanged:(e,t)=>{Zi(e,t)},fieldLoRAModelValueChanged:(e,t)=>{Zi(e,t)},fieldControlNetModelValueChanged:(e,t)=>{Zi(e,t)},fieldIPAdapterModelValueChanged:(e,t)=>{Zi(e,t)},fieldT2IAdapterModelValueChanged:(e,t)=>{Zi(e,t)},fieldEnumModelValueChanged:(e,t)=>{Zi(e,t)},fieldSchedulerValueChanged:(e,t)=>{Zi(e,t)},imageCollectionFieldValueChanged:(e,t)=>{var u,c;const{nodeId:n,fieldName:r,value:i}=t.payload,o=e.nodes.findIndex(d=>d.id===n);if(o===-1)return;const a=(u=e.nodes)==null?void 0:u[o];if(!jr(a))return;const s=(c=a.data)==null?void 0:c.inputs[r];if(!s)return;const l=wn(s.value);if(!l){s.value=i;return}s.value=X8(l.concat(i),"image_name")},notesNodeValueChanged:(e,t)=>{var a;const{nodeId:n,value:r}=t.payload,i=e.nodes.findIndex(s=>s.id===n),o=(a=e.nodes)==null?void 0:a[i];mI(o)&&(o.data.notes=r)},shouldShowFieldTypeLegendChanged:(e,t)=>{e.shouldShowFieldTypeLegend=t.payload},shouldShowMinimapPanelChanged:(e,t)=>{e.shouldShowMinimapPanel=t.payload},nodeTemplatesBuilt:(e,t)=>{e.nodeTemplates=t.payload,e.isReady=!0},nodeEditorReset:e=>{e.nodes=[],e.edges=[],e.workflow=wn(UE)},shouldValidateGraphChanged:(e,t)=>{e.shouldValidateGraph=t.payload},shouldAnimateEdgesChanged:(e,t)=>{e.shouldAnimateEdges=t.payload},shouldSnapToGridChanged:(e,t)=>{e.shouldSnapToGrid=t.payload},shouldColorEdgesChanged:(e,t)=>{e.shouldColorEdges=t.payload},nodeOpacityChanged:(e,t)=>{e.nodeOpacity=t.payload},workflowNameChanged:(e,t)=>{e.workflow.name=t.payload},workflowDescriptionChanged:(e,t)=>{e.workflow.description=t.payload},workflowTagsChanged:(e,t)=>{e.workflow.tags=t.payload},workflowAuthorChanged:(e,t)=>{e.workflow.author=t.payload},workflowNotesChanged:(e,t)=>{e.workflow.notes=t.payload},workflowVersionChanged:(e,t)=>{e.workflow.version=t.payload},workflowContactChanged:(e,t)=>{e.workflow.contact=t.payload},workflowLoaded:(e,t)=>{const{nodes:n,edges:r,...i}=t.payload;e.workflow=i,e.nodes=Gc(n.map(o=>({item:{...o,dragHandle:`.${uSe}`},type:"add"})),[]),e.edges=Nc(r.map(o=>({item:o,type:"add"})),[]),e.nodeExecutionStates=n.reduce((o,a)=>(o[a.id]={nodeId:a.id,...VC},o),{})},workflowReset:e=>{e.workflow=wn(UE)},viewportChanged:(e,t)=>{e.viewport=t.payload},mouseOverFieldChanged:(e,t)=>{e.mouseOverField=t.payload},mouseOverNodeChanged:(e,t)=>{e.mouseOverNode=t.payload},selectedAll:e=>{e.nodes=Gc(e.nodes.map(t=>({id:t.id,type:"select",selected:!0})),e.nodes),e.edges=Nc(e.edges.map(t=>({id:t.id,type:"select",selected:!0})),e.edges)},selectionCopied:e=>{if(e.nodesToCopy=e.nodes.filter(t=>t.selected).map(wn),e.edgesToCopy=e.edges.filter(t=>t.selected).map(wn),e.nodesToCopy.length>0){const t={x:0,y:0};e.nodesToCopy.forEach(n=>{const r=.15*(n.width??0),i=.5*(n.height??0);t.x+=n.position.x+r,t.y+=n.position.y+i}),t.x/=e.nodesToCopy.length,t.y/=e.nodesToCopy.length,e.nodesToCopy.forEach(n=>{n.position.x-=t.x,n.position.y-=t.y})}},selectionPasted:(e,t)=>{const{cursorPosition:n}=t.payload,r=e.nodesToCopy.map(wn),i=r.map(c=>c.data.id),o=e.edgesToCopy.filter(c=>i.includes(c.source)&&i.includes(c.target)).map(wn);o.forEach(c=>c.selected=!0),r.forEach(c=>{const d=LV();o.forEach(h=>{h.source===c.data.id&&(h.source=d,h.id=h.id.replace(c.data.id,d)),h.target===c.data.id&&(h.target=d,h.id=h.id.replace(c.data.id,d))}),c.selected=!0,c.id=d,c.data.id=d;const f=L9(e.nodes,c.position.x+((n==null?void 0:n.x)??0),c.position.y+((n==null?void 0:n.y)??0));c.position=f});const a=r.map(c=>({item:c,type:"add"})),s=e.nodes.map(c=>({id:c.data.id,type:"select",selected:!1})),l=o.map(c=>({item:c,type:"add"})),u=e.edges.map(c=>({id:c.id,type:"select",selected:!1}));e.nodes=Gc(a.concat(s),e.nodes),e.edges=Nc(l.concat(u),e.edges),r.forEach(c=>{e.nodeExecutionStates[c.id]={nodeId:c.id,...VC}})},addNodePopoverOpened:e=>{e.addNewNodePosition=null,e.isAddNodePopoverOpen=!0},addNodePopoverClosed:e=>{e.isAddNodePopoverOpen=!1,e.connectionStartParams=null,e.currentConnectionFieldType=null},addNodePopoverToggled:e=>{e.isAddNodePopoverOpen=!e.isAddNodePopoverOpen},selectionModeChanged:(e,t)=>{e.selectionMode=t.payload?uc.Full:uc.Partial}},extraReducers:e=>{e.addCase(m0.pending,t=>{t.isReady=!1}),e.addCase(Uk,(t,n)=>{const{source_node_id:r}=n.payload.data,i=t.nodeExecutionStates[r];i&&(i.status=Wc.IN_PROGRESS)}),e.addCase(Gk,(t,n)=>{const{source_node_id:r,result:i}=n.payload.data,o=t.nodeExecutionStates[r];o&&(o.status=Wc.COMPLETED,o.progress!==null&&(o.progress=1),o.outputs.push(i))}),e.addCase(V2,(t,n)=>{const{source_node_id:r}=n.payload.data,i=t.nodeExecutionStates[r];i&&(i.status=Wc.FAILED,i.error=n.payload.data.error,i.progress=null,i.progressImage=null)}),e.addCase(qk,(t,n)=>{const{source_node_id:r,step:i,total_steps:o,progress_image:a}=n.payload.data,s=t.nodeExecutionStates[r];s&&(s.status=Wc.IN_PROGRESS,s.progress=(i+1)/o,s.progressImage=a??null)}),e.addCase(Hk,(t,n)=>{["in_progress"].includes(n.payload.data.status)&&Ca(t.nodeExecutionStates,r=>{r.status=Wc.PENDING,r.error=null,r.progress=null,r.progressImage=null,r.outputs=[]})})}}),{addNodePopoverClosed:jqe,addNodePopoverOpened:Uqe,addNodePopoverToggled:Vqe,connectionEnded:Gqe,connectionMade:qqe,connectionStarted:Hqe,edgeDeleted:Wqe,edgeChangeStarted:Kqe,edgesChanged:Qqe,edgesDeleted:Xqe,edgeUpdated:Yqe,fieldBoardValueChanged:Zqe,fieldBooleanValueChanged:Jqe,fieldColorValueChanged:eHe,fieldControlNetModelValueChanged:tHe,fieldEnumModelValueChanged:nHe,fieldImageValueChanged:Y2,fieldIPAdapterModelValueChanged:rHe,fieldT2IAdapterModelValueChanged:iHe,fieldLabelChanged:oHe,fieldLoRAModelValueChanged:aHe,fieldMainModelValueChanged:sHe,fieldNumberValueChanged:lHe,fieldRefinerModelValueChanged:uHe,fieldSchedulerValueChanged:cHe,fieldStringValueChanged:dHe,fieldVaeModelValueChanged:fHe,imageCollectionFieldValueChanged:hHe,mouseOverFieldChanged:pHe,mouseOverNodeChanged:gHe,nodeAdded:mHe,nodeEditorReset:s2e,nodeEmbedWorkflowChanged:yHe,nodeExclusivelySelected:vHe,nodeIsIntermediateChanged:bHe,nodeIsOpenChanged:_He,nodeLabelChanged:SHe,nodeNotesChanged:xHe,nodeOpacityChanged:wHe,nodesChanged:CHe,nodesDeleted:EHe,nodeTemplatesBuilt:KV,nodeUseCacheChanged:THe,notesNodeValueChanged:kHe,selectedAll:AHe,selectedEdgesChanged:PHe,selectedNodesChanged:IHe,selectionCopied:RHe,selectionModeChanged:OHe,selectionPasted:MHe,shouldAnimateEdgesChanged:NHe,shouldColorEdgesChanged:$He,shouldShowFieldTypeLegendChanged:DHe,shouldShowMinimapPanelChanged:LHe,shouldSnapToGridChanged:FHe,shouldValidateGraphChanged:BHe,viewportChanged:zHe,workflowAuthorChanged:jHe,workflowContactChanged:UHe,workflowDescriptionChanged:VHe,workflowExposedFieldAdded:l2e,workflowExposedFieldRemoved:GHe,workflowLoaded:u2e,workflowNameChanged:qHe,workflowNotesChanged:HHe,workflowTagsChanged:WHe,workflowVersionChanged:KHe,edgeAdded:QHe}=WV.actions,c2e=WV.reducer,QV={esrganModelName:"RealESRGAN_x4plus.pth"},XV=nr({name:"postprocessing",initialState:QV,reducers:{esrganModelNameChanged:(e,t)=>{e.esrganModelName=t.payload}}}),{esrganModelNameChanged:XHe}=XV.actions,d2e=XV.reducer,YV={positiveStylePrompt:"",negativeStylePrompt:"",shouldConcatSDXLStylePrompt:!0,shouldUseSDXLRefiner:!1,sdxlImg2ImgDenoisingStrength:.7,refinerModel:null,refinerSteps:20,refinerCFGScale:7.5,refinerScheduler:"euler",refinerPositiveAestheticScore:6,refinerNegativeAestheticScore:2.5,refinerStart:.8},ZV=nr({name:"sdxl",initialState:YV,reducers:{setPositiveStylePromptSDXL:(e,t)=>{e.positiveStylePrompt=t.payload},setNegativeStylePromptSDXL:(e,t)=>{e.negativeStylePrompt=t.payload},setShouldConcatSDXLStylePrompt:(e,t)=>{e.shouldConcatSDXLStylePrompt=t.payload},setShouldUseSDXLRefiner:(e,t)=>{e.shouldUseSDXLRefiner=t.payload},setSDXLImg2ImgDenoisingStrength:(e,t)=>{e.sdxlImg2ImgDenoisingStrength=t.payload},refinerModelChanged:(e,t)=>{e.refinerModel=t.payload},setRefinerSteps:(e,t)=>{e.refinerSteps=t.payload},setRefinerCFGScale:(e,t)=>{e.refinerCFGScale=t.payload},setRefinerScheduler:(e,t)=>{e.refinerScheduler=t.payload},setRefinerPositiveAestheticScore:(e,t)=>{e.refinerPositiveAestheticScore=t.payload},setRefinerNegativeAestheticScore:(e,t)=>{e.refinerNegativeAestheticScore=t.payload},setRefinerStart:(e,t)=>{e.refinerStart=t.payload}}}),{setPositiveStylePromptSDXL:YHe,setNegativeStylePromptSDXL:ZHe,setShouldConcatSDXLStylePrompt:JHe,setShouldUseSDXLRefiner:f2e,setSDXLImg2ImgDenoisingStrength:eWe,refinerModelChanged:W9,setRefinerSteps:tWe,setRefinerCFGScale:nWe,setRefinerScheduler:rWe,setRefinerPositiveAestheticScore:iWe,setRefinerNegativeAestheticScore:oWe,setRefinerStart:aWe}=ZV.actions,h2e=ZV.reducer,p2e=(e,t,n)=>t===0?0:n===2?Math.floor((e+1+1)/2)/Math.floor((t+1)/2):(e+1+1)/(t+1),Ld=e=>typeof e=="string"?{title:e,status:"info",isClosable:!0,duration:2500}:{status:"info",isClosable:!0,duration:2500,...e},JV={isInitialized:!1,isConnected:!1,shouldConfirmOnDelete:!0,enableImageDebugging:!1,toastQueue:[],denoiseProgress:null,shouldAntialiasProgressImage:!1,consoleLogLevel:"debug",shouldLogToConsole:!0,language:"en",shouldUseNSFWChecker:!1,shouldUseWatermarker:!1,shouldEnableInformationalPopovers:!1,status:"DISCONNECTED"},eG=nr({name:"system",initialState:JV,reducers:{setShouldConfirmOnDelete:(e,t)=>{e.shouldConfirmOnDelete=t.payload},setEnableImageDebugging:(e,t)=>{e.enableImageDebugging=t.payload},addToast:(e,t)=>{e.toastQueue.push(t.payload)},clearToastQueue:e=>{e.toastQueue=[]},consoleLogLevelChanged:(e,t)=>{e.consoleLogLevel=t.payload},shouldLogToConsoleChanged:(e,t)=>{e.shouldLogToConsole=t.payload},shouldAntialiasProgressImageChanged:(e,t)=>{e.shouldAntialiasProgressImage=t.payload},languageChanged:(e,t)=>{e.language=t.payload},shouldUseNSFWCheckerChanged(e,t){e.shouldUseNSFWChecker=t.payload},shouldUseWatermarkerChanged(e,t){e.shouldUseWatermarker=t.payload},setShouldEnableInformationalPopovers(e,t){e.shouldEnableInformationalPopovers=t.payload},isInitializedChanged(e,t){e.isInitialized=t.payload}},extraReducers(e){e.addCase(jk,t=>{t.isConnected=!0,t.denoiseProgress=null,t.status="CONNECTED"}),e.addCase(Vj,t=>{t.isConnected=!1,t.denoiseProgress=null,t.status="DISCONNECTED"}),e.addCase(Uk,t=>{t.denoiseProgress=null,t.status="PROCESSING"}),e.addCase(qk,(t,n)=>{const{step:r,total_steps:i,order:o,progress_image:a,graph_execution_state_id:s,queue_batch_id:l}=n.payload.data;t.denoiseProgress={step:r,total_steps:i,order:o,percentage:p2e(r,i,o),progress_image:a,session_id:s,batch_id:l},t.status="PROCESSING"}),e.addCase(Gk,t=>{t.denoiseProgress=null,t.status="CONNECTED"}),e.addCase(Wj,t=>{t.denoiseProgress=null,t.status="CONNECTED"}),e.addCase(Xj,t=>{t.status="LOADING_MODEL"}),e.addCase(Zj,t=>{t.status="CONNECTED"}),e.addCase(Hk,(t,n)=>{["completed","canceled","failed"].includes(n.payload.data.status)&&(t.status="CONNECTED",t.denoiseProgress=null)}),e.addMatcher(b2e,(t,n)=>{t.toastQueue.push(Ld({title:Z("toast.serverError"),status:"error",description:Eae(n.payload.data.error_type)}))})}}),{setShouldConfirmOnDelete:sWe,setEnableImageDebugging:lWe,addToast:Gt,clearToastQueue:uWe,consoleLogLevelChanged:cWe,shouldLogToConsoleChanged:dWe,shouldAntialiasProgressImageChanged:fWe,languageChanged:hWe,shouldUseNSFWCheckerChanged:g2e,shouldUseWatermarkerChanged:m2e,setShouldEnableInformationalPopovers:pWe,isInitializedChanged:y2e}=eG.actions,v2e=eG.reducer,b2e=No(V2,eU,nU),_2e={listCursor:void 0,listPriority:void 0,selectedQueueItem:void 0,resumeProcessorOnEnqueue:!0},S2e=_2e,tG=nr({name:"queue",initialState:S2e,reducers:{listCursorChanged:(e,t)=>{e.listCursor=t.payload},listPriorityChanged:(e,t)=>{e.listPriority=t.payload},listParamsReset:e=>{e.listCursor=void 0,e.listPriority=void 0},queueItemSelectionToggled:(e,t)=>{e.selectedQueueItem===t.payload?e.selectedQueueItem=void 0:e.selectedQueueItem=t.payload},resumeProcessorOnEnqueueChanged:(e,t)=>{e.resumeProcessorOnEnqueue=t.payload}}}),{listCursorChanged:gWe,listPriorityChanged:mWe,listParamsReset:x2e,queueItemSelectionToggled:yWe,resumeProcessorOnEnqueueChanged:vWe}=tG.actions,w2e=tG.reducer,C2e={searchFolder:null,advancedAddScanModel:null},nG=nr({name:"modelmanager",initialState:C2e,reducers:{setSearchFolder:(e,t)=>{e.searchFolder=t.payload},setAdvancedAddScanModel:(e,t)=>{e.advancedAddScanModel=t.payload}}}),{setSearchFolder:bWe,setAdvancedAddScanModel:_We}=nG.actions,E2e=nG.reducer,rG={shift:!1,ctrl:!1,meta:!1},iG=nr({name:"hotkeys",initialState:rG,reducers:{shiftKeyPressed:(e,t)=>{e.shift=t.payload},ctrlKeyPressed:(e,t)=>{e.ctrl=t.payload},metaKeyPressed:(e,t)=>{e.meta=t.payload}}}),{shiftKeyPressed:SWe,ctrlKeyPressed:xWe,metaKeyPressed:wWe}=iG.actions,T2e=iG.reducer,oG={activeTab:"txt2img",shouldShowImageDetails:!1,shouldUseCanvasBetaLayout:!1,shouldShowExistingModelsInSearch:!1,shouldUseSliders:!1,shouldHidePreview:!1,shouldShowProgressInViewer:!0,shouldShowEmbeddingPicker:!1,shouldAutoChangeDimensions:!1,favoriteSchedulers:[],globalContextMenuCloseTrigger:0,panels:{}},aG=nr({name:"ui",initialState:oG,reducers:{setActiveTab:(e,t)=>{e.activeTab=t.payload},setShouldShowImageDetails:(e,t)=>{e.shouldShowImageDetails=t.payload},setShouldUseCanvasBetaLayout:(e,t)=>{e.shouldUseCanvasBetaLayout=t.payload},setShouldHidePreview:(e,t)=>{e.shouldHidePreview=t.payload},setShouldShowExistingModelsInSearch:(e,t)=>{e.shouldShowExistingModelsInSearch=t.payload},setShouldUseSliders:(e,t)=>{e.shouldUseSliders=t.payload},setShouldShowProgressInViewer:(e,t)=>{e.shouldShowProgressInViewer=t.payload},favoriteSchedulersChanged:(e,t)=>{e.favoriteSchedulers=t.payload},toggleEmbeddingPicker:e=>{e.shouldShowEmbeddingPicker=!e.shouldShowEmbeddingPicker},setShouldAutoChangeDimensions:(e,t)=>{e.shouldAutoChangeDimensions=t.payload},contextMenusClosed:e=>{e.globalContextMenuCloseTrigger+=1},panelsChanged:(e,t)=>{e.panels[t.payload.name]=t.payload.value}},extraReducers(e){e.addCase(YS,t=>{t.activeTab="img2img"})}}),{setActiveTab:sG,setShouldShowImageDetails:CWe,setShouldUseCanvasBetaLayout:EWe,setShouldShowExistingModelsInSearch:TWe,setShouldUseSliders:kWe,setShouldHidePreview:AWe,setShouldShowProgressInViewer:PWe,favoriteSchedulersChanged:IWe,toggleEmbeddingPicker:RWe,setShouldAutoChangeDimensions:OWe,contextMenusClosed:MWe,panelsChanged:NWe}=aG.actions,k2e=aG.reducer,A2e=fS(FY);lG=VE=void 0;var P2e=A2e,I2e=function(){var t=[],n=[],r=void 0,i=function(u){return r=u,function(c){return function(d){return P2e.compose.apply(void 0,n)(c)(d)}}},o=function(){for(var u,c,d=arguments.length,f=Array(d),h=0;h=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(u){throw u},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var o=!0,a=!1,s;return{s:function(){n=n.call(e)},n:function(){var u=n.next();return o=u.done,u},e:function(u){a=!0,s=u},f:function(){try{!o&&n.return!=null&&n.return()}finally{if(a)throw s}}}}function cG(e,t){if(e){if(typeof e=="string")return Q9(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Q9(e,t)}}function Q9(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=arguments.length>2?arguments[2]:void 0,i=r.prefix,o=r.driver,a=r.persistWholeStore,s=r.serialize;try{var l=a?G2e:q2e;yield l(t,n,{prefix:i,driver:o,serialize:s})}catch(u){console.warn("redux-remember: persist error",u)}});return function(){return e.apply(this,arguments)}}();function J9(e,t,n,r,i,o,a){try{var s=e[o](a),l=s.value}catch(u){n(u);return}s.done?t(l):Promise.resolve(l).then(r,i)}function eO(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function a(l){J9(o,r,i,a,s,"next",l)}function s(l){J9(o,r,i,a,s,"throw",l)}a(void 0)})}}var W2e=function(){var e=eO(function*(t,n,r){var i=r.prefix,o=r.driver,a=r.serialize,s=r.unserialize,l=r.persistThrottle,u=r.persistDebounce,c=r.persistWholeStore;yield B2e(t,n,{prefix:i,driver:o,unserialize:s,persistWholeStore:c});var d={},f=function(){var h=eO(function*(){var p=uG(t.getState(),n);yield H2e(p,d,{prefix:i,driver:o,serialize:a,persistWholeStore:c}),yA(p,d)||t.dispatch({type:N2e,payload:p}),d=p});return function(){return h.apply(this,arguments)}}();u&&u>0?t.subscribe(D2e(f,u)):t.subscribe($2e(f,l))});return function(n,r,i){return e.apply(this,arguments)}}();const K2e=W2e;function y0(e){"@babel/helpers - typeof";return y0=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},y0(e)}function tO(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function HC(e){for(var t=1;t0&&arguments[0]!==void 0?arguments[0]:n.state,i=arguments.length>1?arguments[1]:void 0;i.type&&(i.type==="@@INIT"||i.type.startsWith("@@redux/INIT"))&&(n.state=HC({},r));var o=typeof t=="function"?t:pp(t);switch(i.type){case GE:{var a=HC(HC({},n.state),i.payload||{});return n.state=o(a,{type:GE,payload:a}),n.state}default:return o(r,i)}}},J2e=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},i=r.prefix,o=i===void 0?"@@remember-":i,a=r.serialize,s=a===void 0?function(_,b){return JSON.stringify(_)}:a,l=r.unserialize,u=l===void 0?function(_,b){return JSON.parse(_)}:l,c=r.persistThrottle,d=c===void 0?100:c,f=r.persistDebounce,h=r.persistWholeStore,p=h===void 0?!1:h;if(!t)throw Error("redux-remember error: driver required");if(!Array.isArray(n))throw Error("redux-remember error: rememberedKeys needs to be an array");var m=function(b){return function(v,g,y){var S=b(v,g,y);return K2e(S,n,{driver:t,prefix:o,serialize:s,unserialize:u,persistThrottle:d,persistDebounce:f,persistWholeStore:p}),S}};return m};const $We=["chakra-ui-color-mode","i18nextLng","ROARR_FILTER","ROARR_LOG"],exe="@@invokeai-",txe=["cursorPosition"],nxe=["pendingControlImages"],rxe=["prompts"],ixe=["selection","selectedBoardId","galleryView"],oxe=["nodeTemplates","connectionStartParams","currentConnectionFieldType","selectedNodes","selectedEdges","isReady","nodesToCopy","edgesToCopy","connectionMade","modifyingEdge","addNewNodePosition"],axe=[],sxe=[],lxe=["isInitialized","isConnected","denoiseProgress","status"],uxe=["shouldShowImageDetails","globalContextMenuCloseTrigger","panels"],cxe={canvas:txe,gallery:ixe,generation:axe,nodes:oxe,postprocessing:sxe,system:lxe,ui:uxe,controlNet:nxe,dynamicPrompts:rxe},dxe=(e,t)=>{const n=WS(e,cxe[t]??[]);return JSON.stringify(n)},fxe={canvas:TB,gallery:fU,generation:gk,nodes:HV,postprocessing:QV,system:JV,config:dB,ui:oG,hotkeys:rG,controlNet:SE,dynamicPrompts:Xk,sdxl:YV},hxe=(e,t)=>boe(JSON.parse(e),fxe[t]),pxe=Ne("nodes/textToImageGraphBuilt"),gxe=Ne("nodes/imageToImageGraphBuilt"),fG=Ne("nodes/canvasGraphBuilt"),mxe=Ne("nodes/nodesGraphBuilt"),yxe=No(pxe,gxe,fG,mxe),vxe=Ne("nodes/workflowLoadRequested"),bxe=e=>{if(yxe(e)&&e.payload.nodes){const t={};return{...e,payload:{...e.payload,nodes:t}}}return m0.fulfilled.match(e)?{...e,payload:""}:KV.match(e)?{...e,payload:""}:e},_xe=["canvas/setCursorPosition","canvas/setStageCoordinates","canvas/setStageScale","canvas/setIsDrawing","canvas/setBoundingBoxCoordinates","canvas/setBoundingBoxDimensions","canvas/setIsDrawing","canvas/addPointToCurrentLine","socket/socketGeneratorProgress","socket/appSocketGeneratorProgress","@@REMEMBER_PERSISTED"],Sxe=e=>e,hG="default",Ur=tl(hG),xxe=e=>{const t=e?Qg.stringify(e,{arrayFormat:"none"}):void 0;return t?`queue/${Ur.get()}/list?${t}`:`queue/${Ur.get()}/list`},Kc=cs({selectId:e=>e.item_id,sortComparer:(e,t)=>e.priority>t.priority?-1:e.priorityt.item_id?1:0}),Qr=ls.injectEndpoints({endpoints:e=>({enqueueBatch:e.mutation({query:t=>({url:`queue/${Ur.get()}/enqueue_batch`,body:t,method:"POST"}),invalidatesTags:["SessionQueueStatus","CurrentSessionQueueItem","NextSessionQueueItem"],onQueryStarted:async(t,n)=>{const{dispatch:r,queryFulfilled:i}=n;try{await i,eg(r)}catch{}}}),enqueueGraph:e.mutation({query:t=>({url:`queue/${Ur.get()}/enqueue_graph`,body:t,method:"POST"}),invalidatesTags:["SessionQueueStatus","CurrentSessionQueueItem","NextSessionQueueItem"],onQueryStarted:async(t,n)=>{const{dispatch:r,queryFulfilled:i}=n;try{await i,eg(r)}catch{}}}),resumeProcessor:e.mutation({query:()=>({url:`queue/${Ur.get()}/processor/resume`,method:"PUT"}),invalidatesTags:["CurrentSessionQueueItem","SessionQueueStatus"]}),pauseProcessor:e.mutation({query:()=>({url:`queue/${Ur.get()}/processor/pause`,method:"PUT"}),invalidatesTags:["CurrentSessionQueueItem","SessionQueueStatus"]}),pruneQueue:e.mutation({query:()=>({url:`queue/${Ur.get()}/prune`,method:"PUT"}),invalidatesTags:["SessionQueueStatus","BatchStatus","SessionQueueItem","SessionQueueItemDTO"],onQueryStarted:async(t,n)=>{const{dispatch:r,queryFulfilled:i}=n;try{await i,eg(r)}catch{}}}),clearQueue:e.mutation({query:()=>({url:`queue/${Ur.get()}/clear`,method:"PUT"}),invalidatesTags:["SessionQueueStatus","SessionProcessorStatus","BatchStatus","CurrentSessionQueueItem","NextSessionQueueItem","SessionQueueItem","SessionQueueItemDTO"],onQueryStarted:async(t,n)=>{const{dispatch:r,queryFulfilled:i}=n;try{await i,eg(r)}catch{}}}),getCurrentQueueItem:e.query({query:()=>({url:`queue/${Ur.get()}/current`,method:"GET"}),providesTags:t=>{const n=["CurrentSessionQueueItem"];return t&&n.push({type:"SessionQueueItem",id:t.item_id}),n}}),getNextQueueItem:e.query({query:()=>({url:`queue/${Ur.get()}/next`,method:"GET"}),providesTags:t=>{const n=["NextSessionQueueItem"];return t&&n.push({type:"SessionQueueItem",id:t.item_id}),n}}),getQueueStatus:e.query({query:()=>({url:`queue/${Ur.get()}/status`,method:"GET"}),providesTags:["SessionQueueStatus"]}),getBatchStatus:e.query({query:({batch_id:t})=>({url:`queue/${Ur.get()}/b/${t}/status`,method:"GET"}),providesTags:t=>t?[{type:"BatchStatus",id:t.batch_id}]:[]}),getQueueItem:e.query({query:t=>({url:`queue/${Ur.get()}/i/${t}`,method:"GET"}),providesTags:t=>t?[{type:"SessionQueueItem",id:t.item_id}]:[]}),cancelQueueItem:e.mutation({query:t=>({url:`queue/${Ur.get()}/i/${t}/cancel`,method:"PUT"}),onQueryStarted:async(t,{dispatch:n,queryFulfilled:r})=>{try{const{data:i}=await r;n(Qr.util.updateQueryData("listQueueItems",void 0,o=>{Kc.updateOne(o,{id:t,changes:{status:i.status}})}))}catch{}},invalidatesTags:t=>t?[{type:"SessionQueueItem",id:t.item_id},{type:"SessionQueueItemDTO",id:t.item_id},{type:"BatchStatus",id:t.batch_id}]:[]}),cancelByBatchIds:e.mutation({query:t=>({url:`queue/${Ur.get()}/cancel_by_batch_ids`,method:"PUT",body:t}),onQueryStarted:async(t,n)=>{const{dispatch:r,queryFulfilled:i}=n;try{await i,eg(r)}catch{}},invalidatesTags:["SessionQueueItem","SessionQueueItemDTO","BatchStatus"]}),listQueueItems:e.query({query:t=>({url:xxe(t),method:"GET"}),serializeQueryArgs:()=>`queue/${Ur.get()}/list`,transformResponse:t=>Kc.addMany(Kc.getInitialState({has_more:t.has_more}),t.items),merge:(t,n)=>{Kc.addMany(t,Kc.getSelectors().selectAll(n)),t.has_more=n.has_more},forceRefetch:({currentArg:t,previousArg:n})=>t!==n,keepUnusedDataFor:60*5})})}),{useCancelByBatchIdsMutation:DWe,useEnqueueGraphMutation:LWe,useEnqueueBatchMutation:FWe,usePauseProcessorMutation:BWe,useResumeProcessorMutation:zWe,useClearQueueMutation:jWe,usePruneQueueMutation:UWe,useGetCurrentQueueItemQuery:VWe,useGetQueueStatusQuery:GWe,useGetQueueItemQuery:qWe,useGetNextQueueItemQuery:HWe,useListQueueItemsQuery:WWe,useCancelQueueItemMutation:KWe,useGetBatchStatusQuery:QWe}=Qr,eg=e=>{e(Qr.util.updateQueryData("listQueueItems",void 0,t=>{Kc.removeAll(t),t.has_more=!1})),e(x2e()),e(Qr.endpoints.listQueueItems.initiate(void 0))},wxe=No(ule,cle),Cxe=()=>{Fe({matcher:wxe,effect:async(e,{dispatch:t,getState:n})=>{const r=_e("canvas"),i=n(),{batchIds:o}=i.canvas;try{const a=t(Qr.endpoints.cancelByBatchIds.initiate({batch_ids:o},{fixedCacheKey:"cancelByBatchIds"})),{canceled:s}=await a.unwrap();a.reset(),s>0&&(r.debug(`Canceled ${s} canvas batches`),t(Gt({title:Z("queue.cancelBatchSucceeded"),status:"success"}))),t(ple())}catch{r.error("Failed to cancel canvas batches"),t(Gt({title:Z("queue.cancelBatchFailed"),status:"error"}))}}})};Ne("app/appStarted");const Exe=()=>{Fe({matcher:me.endpoints.listImages.matchFulfilled,effect:async(e,{dispatch:t,unsubscribe:n,cancelActiveListeners:r})=>{if(e.meta.arg.queryCacheKey!==Bo({board_id:"none",categories:ii}))return;r(),n();const i=e.payload;if(i.ids.length>0){const o=Vn.getSelectors().selectAll(i)[0];t(Vs(o??null))}}})},Txe=No(Qr.endpoints.enqueueBatch.matchFulfilled,Qr.endpoints.enqueueGraph.matchFulfilled),kxe=()=>{Fe({matcher:Txe,effect:async(e,{dispatch:t,getState:n})=>{const{data:r}=Qr.endpoints.getQueueStatus.select()(n());!r||r.processor.is_started||t(Qr.endpoints.resumeProcessor.initiate(void 0,{fixedCacheKey:"resumeProcessor"}))}})},pG=ls.injectEndpoints({endpoints:e=>({getAppVersion:e.query({query:()=>({url:"app/version",method:"GET"}),providesTags:["AppVersion"],keepUnusedDataFor:864e5}),getAppConfig:e.query({query:()=>({url:"app/config",method:"GET"}),providesTags:["AppConfig"],keepUnusedDataFor:864e5}),getInvocationCacheStatus:e.query({query:()=>({url:"app/invocation_cache/status",method:"GET"}),providesTags:["InvocationCacheStatus"]}),clearInvocationCache:e.mutation({query:()=>({url:"app/invocation_cache",method:"DELETE"}),invalidatesTags:["InvocationCacheStatus"]}),enableInvocationCache:e.mutation({query:()=>({url:"app/invocation_cache/enable",method:"PUT"}),invalidatesTags:["InvocationCacheStatus"]}),disableInvocationCache:e.mutation({query:()=>({url:"app/invocation_cache/disable",method:"PUT"}),invalidatesTags:["InvocationCacheStatus"]})})}),{useGetAppVersionQuery:XWe,useGetAppConfigQuery:YWe,useClearInvocationCacheMutation:ZWe,useDisableInvocationCacheMutation:JWe,useEnableInvocationCacheMutation:eKe,useGetInvocationCacheStatusQuery:tKe}=pG,Axe=()=>{Fe({matcher:pG.endpoints.getAppConfig.matchFulfilled,effect:async(e,{getState:t,dispatch:n})=>{const{infill_methods:r=[],nsfw_methods:i=[],watermarking_methods:o=[]}=e.payload,a=t().generation.infillMethod;r.includes(a)||n(ele(r[0])),i.includes("nsfw_checker")||n(g2e(!1)),o.includes("invisible_watermark")||n(m2e(!1))}})},Pxe=Ne("app/appStarted"),Ixe=()=>{Fe({actionCreator:Pxe,effect:async(e,{unsubscribe:t,cancelActiveListeners:n})=>{n(),t()}})},J2={memoizeOptions:{resultEqualityCheck:fk}},gG=(e,t)=>{var f;const{generation:n,canvas:r,nodes:i,controlNet:o}=e,a=((f=n.initialImage)==null?void 0:f.imageName)===t,s=r.layerState.objects.some(h=>h.kind==="image"&&h.imageName===t),l=i.nodes.filter(jr).some(h=>zf(h.data.inputs,p=>{var m;return p.type==="ImageField"&&((m=p.value)==null?void 0:m.image_name)===t})),u=zf(o.controlNets,h=>h.controlImage===t||h.processedControlImage===t),c=o.ipAdapterInfo.adapterImage===t;return{isInitialImage:a,isCanvasImage:s,isNodesImage:l,isControlNetImage:u,isIPAdapterImage:c}},Rxe=Ii([e=>e],e=>{const{imagesToDelete:t}=e.deleteImageModal;return t.length?t.map(r=>gG(e,r.image_name)):[]},J2),Oxe=()=>{Fe({matcher:me.endpoints.deleteBoardAndImages.matchFulfilled,effect:async(e,{dispatch:t,getState:n})=>{const{deleted_images:r}=e.payload;let i=!1,o=!1,a=!1,s=!1,l=!1;const u=n();r.forEach(c=>{const d=gG(u,c);d.isInitialImage&&!i&&(t(mk()),i=!0),d.isCanvasImage&&!o&&(t(yk()),o=!0),d.isNodesImage&&!a&&(t(s2e()),a=!0),d.isControlNetImage&&!s&&(t(m0e()),s=!0),d.isIPAdapterImage&&!l&&(t(uU()),l=!0)})}})},Mxe=()=>{Fe({matcher:No(C_,xE),effect:async(e,{getState:t,dispatch:n,condition:r,cancelActiveListeners:i})=>{i();const o=t(),a=C_.match(e)?e.payload.boardId:o.gallery.selectedBoardId,l=(xE.match(e)?e.payload:o.gallery.galleryView)==="images"?ii:$u,u={board_id:a??"none",categories:l};if(await r(()=>me.endpoints.listImages.select(u)(t()).isSuccess,5e3)){const{data:d}=me.endpoints.listImages.select(u)(t());if(d){const f=l0.selectAll(d)[0],h=l0.selectById(d,e.payload.selectedImageName);n(Vs(h||f||null))}else n(Vs(null))}else n(Vs(null))}})},Nxe=Ne("canvas/canvasSavedToGallery"),$xe=Ne("canvas/canvasMaskSavedToGallery"),Dxe=Ne("canvas/canvasCopiedToClipboard"),Lxe=Ne("canvas/canvasDownloadedAsImage"),Fxe=Ne("canvas/canvasMerged"),Bxe=Ne("canvas/stagingAreaImageSaved"),zxe=Ne("canvas/canvasMaskToControlNet"),jxe=Ne("canvas/canvasImageToControlNet");let mG=null,yG=null;const nKe=e=>{mG=e},ex=()=>mG,rKe=e=>{yG=e},Uxe=()=>yG,Vxe=async e=>new Promise((t,n)=>{e.toBlob(r=>{if(r){t(r);return}n("Unable to create Blob")})}),D_=async(e,t)=>await Vxe(e.toCanvas(t)),tx=async(e,t=!1)=>{const n=ex();if(!n)throw new Error("Problem getting base layer blob");const{shouldCropToBoundingBoxOnSave:r,boundingBoxCoordinates:i,boundingBoxDimensions:o}=e.canvas,a=n.clone();a.scale({x:1,y:1});const s=a.getAbsolutePosition(),l=r||t?{x:i.x+s.x,y:i.y+s.y,width:o.width,height:o.height}:a.getClientRect();return D_(a,l)},Gxe=(e,t="image/png")=>{navigator.clipboard.write([new ClipboardItem({[t]:e})])},qxe=()=>{Fe({actionCreator:Dxe,effect:async(e,{dispatch:t,getState:n})=>{const r=S2.get().child({namespace:"canvasCopiedToClipboardListener"}),i=n();try{const o=tx(i);Gxe(o)}catch(o){r.error(String(o)),t(Gt({title:Z("toast.problemCopyingCanvas"),description:Z("toast.problemCopyingCanvasDesc"),status:"error"}));return}t(Gt({title:Z("toast.canvasCopiedClipboard"),status:"success"}))}})},Hxe=(e,t)=>{const n=URL.createObjectURL(e),r=document.createElement("a");r.href=n,r.download=t,document.body.appendChild(r),r.click(),document.body.removeChild(r),r.remove()},Wxe=()=>{Fe({actionCreator:Lxe,effect:async(e,{dispatch:t,getState:n})=>{const r=S2.get().child({namespace:"canvasSavedToGalleryListener"}),i=n();let o;try{o=await tx(i)}catch(a){r.error(String(a)),t(Gt({title:Z("toast.problemDownloadingCanvas"),description:Z("toast.problemDownloadingCanvasDesc"),status:"error"}));return}Hxe(o,"canvas.png"),t(Gt({title:Z("toast.canvasDownloaded"),status:"success"}))}})},Kxe=()=>{Fe({actionCreator:jxe,effect:async(e,{dispatch:t,getState:n})=>{const r=_e("canvas"),i=n();let o;try{o=await tx(i,!0)}catch(u){r.error(String(u)),t(Gt({title:Z("toast.problemSavingCanvas"),description:Z("toast.problemSavingCanvasDesc"),status:"error"}));return}const{autoAddBoardId:a}=i.gallery,s=await t(me.endpoints.uploadImage.initiate({file:new File([o],"savedCanvas.png",{type:"image/png"}),image_category:"control",is_intermediate:!1,board_id:a==="none"?void 0:a,crop_visible:!1,postUploadAction:{type:"TOAST",toastOptions:{title:Z("toast.canvasSentControlnetAssets")}}})).unwrap(),{image_name:l}=s;t(Cc({controlNetId:e.payload.controlNet.controlNetId,controlImage:l}))}})};var vA={exports:{}},nx={},vG={},Rt={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e._registerNode=e.Konva=e.glob=void 0;var t=Math.PI/180;function n(){return typeof window<"u"&&({}.toString.call(window)==="[object Window]"||{}.toString.call(window)==="[object global]")}e.glob=typeof yt<"u"?yt:typeof window<"u"?window:typeof WorkerGlobalScope<"u"?self:{},e.Konva={_global:e.glob,version:"9.2.0",isBrowser:n(),isUnminified:/param/.test((function(i){}).toString()),dblClickWindow:400,getAngle(i){return e.Konva.angleDeg?i*t:i},enableTrace:!1,pointerEventsEnabled:!0,autoDrawEnabled:!0,hitOnDragEnabled:!1,capturePointerEventsEnabled:!1,_mouseListenClick:!1,_touchListenClick:!1,_pointerListenClick:!1,_mouseInDblClickWindow:!1,_touchInDblClickWindow:!1,_pointerInDblClickWindow:!1,_mouseDblClickPointerId:null,_touchDblClickPointerId:null,_pointerDblClickPointerId:null,pixelRatio:typeof window<"u"&&window.devicePixelRatio||1,dragDistance:3,angleDeg:!0,showWarnings:!0,dragButtons:[0,1],isDragging(){return e.Konva.DD.isDragging},isDragReady(){return!!e.Konva.DD.node},releaseCanvasOnDestroy:!0,document:e.glob.document,_injectGlobal(i){e.glob.Konva=i}};const r=i=>{e.Konva[i.prototype.getClassName()]=i};e._registerNode=r,e.Konva._injectGlobal(e.Konva)})(Rt);var dr={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.Util=e.Transform=void 0;const t=Rt;class n{constructor(y=[1,0,0,1,0,0]){this.dirty=!1,this.m=y&&y.slice()||[1,0,0,1,0,0]}reset(){this.m[0]=1,this.m[1]=0,this.m[2]=0,this.m[3]=1,this.m[4]=0,this.m[5]=0}copy(){return new n(this.m)}copyInto(y){y.m[0]=this.m[0],y.m[1]=this.m[1],y.m[2]=this.m[2],y.m[3]=this.m[3],y.m[4]=this.m[4],y.m[5]=this.m[5]}point(y){var S=this.m;return{x:S[0]*y.x+S[2]*y.y+S[4],y:S[1]*y.x+S[3]*y.y+S[5]}}translate(y,S){return this.m[4]+=this.m[0]*y+this.m[2]*S,this.m[5]+=this.m[1]*y+this.m[3]*S,this}scale(y,S){return this.m[0]*=y,this.m[1]*=y,this.m[2]*=S,this.m[3]*=S,this}rotate(y){var S=Math.cos(y),w=Math.sin(y),x=this.m[0]*S+this.m[2]*w,C=this.m[1]*S+this.m[3]*w,k=this.m[0]*-w+this.m[2]*S,T=this.m[1]*-w+this.m[3]*S;return this.m[0]=x,this.m[1]=C,this.m[2]=k,this.m[3]=T,this}getTranslation(){return{x:this.m[4],y:this.m[5]}}skew(y,S){var w=this.m[0]+this.m[2]*S,x=this.m[1]+this.m[3]*S,C=this.m[2]+this.m[0]*y,k=this.m[3]+this.m[1]*y;return this.m[0]=w,this.m[1]=x,this.m[2]=C,this.m[3]=k,this}multiply(y){var S=this.m[0]*y.m[0]+this.m[2]*y.m[1],w=this.m[1]*y.m[0]+this.m[3]*y.m[1],x=this.m[0]*y.m[2]+this.m[2]*y.m[3],C=this.m[1]*y.m[2]+this.m[3]*y.m[3],k=this.m[0]*y.m[4]+this.m[2]*y.m[5]+this.m[4],T=this.m[1]*y.m[4]+this.m[3]*y.m[5]+this.m[5];return this.m[0]=S,this.m[1]=w,this.m[2]=x,this.m[3]=C,this.m[4]=k,this.m[5]=T,this}invert(){var y=1/(this.m[0]*this.m[3]-this.m[1]*this.m[2]),S=this.m[3]*y,w=-this.m[1]*y,x=-this.m[2]*y,C=this.m[0]*y,k=y*(this.m[2]*this.m[5]-this.m[3]*this.m[4]),T=y*(this.m[1]*this.m[4]-this.m[0]*this.m[5]);return this.m[0]=S,this.m[1]=w,this.m[2]=x,this.m[3]=C,this.m[4]=k,this.m[5]=T,this}getMatrix(){return this.m}decompose(){var y=this.m[0],S=this.m[1],w=this.m[2],x=this.m[3],C=this.m[4],k=this.m[5],T=y*x-S*w;let P={x:C,y:k,rotation:0,scaleX:0,scaleY:0,skewX:0,skewY:0};if(y!=0||S!=0){var $=Math.sqrt(y*y+S*S);P.rotation=S>0?Math.acos(y/$):-Math.acos(y/$),P.scaleX=$,P.scaleY=T/$,P.skewX=(y*w+S*x)/T,P.skewY=0}else if(w!=0||x!=0){var O=Math.sqrt(w*w+x*x);P.rotation=Math.PI/2-(x>0?Math.acos(-w/O):-Math.acos(w/O)),P.scaleX=T/O,P.scaleY=O,P.skewX=0,P.skewY=(y*w+S*x)/T}return P.rotation=e.Util._getRotation(P.rotation),P}}e.Transform=n;var r="[object Array]",i="[object Number]",o="[object String]",a="[object Boolean]",s=Math.PI/180,l=180/Math.PI,u="#",c="",d="0",f="Konva warning: ",h="Konva error: ",p="rgb(",m={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,132,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,255,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,203],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[119,128,144],slategrey:[119,128,144],snow:[255,255,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],transparent:[255,255,255,0],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,5]},_=/rgb\((\d{1,3}),(\d{1,3}),(\d{1,3})\)/,b=[];const v=typeof requestAnimationFrame<"u"&&requestAnimationFrame||function(g){setTimeout(g,60)};e.Util={_isElement(g){return!!(g&&g.nodeType==1)},_isFunction(g){return!!(g&&g.constructor&&g.call&&g.apply)},_isPlainObject(g){return!!g&&g.constructor===Object},_isArray(g){return Object.prototype.toString.call(g)===r},_isNumber(g){return Object.prototype.toString.call(g)===i&&!isNaN(g)&&isFinite(g)},_isString(g){return Object.prototype.toString.call(g)===o},_isBoolean(g){return Object.prototype.toString.call(g)===a},isObject(g){return g instanceof Object},isValidSelector(g){if(typeof g!="string")return!1;var y=g[0];return y==="#"||y==="."||y===y.toUpperCase()},_sign(g){return g===0||g>0?1:-1},requestAnimFrame(g){b.push(g),b.length===1&&v(function(){const y=b;b=[],y.forEach(function(S){S()})})},createCanvasElement(){var g=document.createElement("canvas");try{g.style=g.style||{}}catch{}return g},createImageElement(){return document.createElement("img")},_isInDocument(g){for(;g=g.parentNode;)if(g==document)return!0;return!1},_urlToImage(g,y){var S=e.Util.createImageElement();S.onload=function(){y(S)},S.src=g},_rgbToHex(g,y,S){return((1<<24)+(g<<16)+(y<<8)+S).toString(16).slice(1)},_hexToRgb(g){g=g.replace(u,c);var y=parseInt(g,16);return{r:y>>16&255,g:y>>8&255,b:y&255}},getRandomColor(){for(var g=(Math.random()*16777215<<0).toString(16);g.length<6;)g=d+g;return u+g},getRGB(g){var y;return g in m?(y=m[g],{r:y[0],g:y[1],b:y[2]}):g[0]===u?this._hexToRgb(g.substring(1)):g.substr(0,4)===p?(y=_.exec(g.replace(/ /g,"")),{r:parseInt(y[1],10),g:parseInt(y[2],10),b:parseInt(y[3],10)}):{r:0,g:0,b:0}},colorToRGBA(g){return g=g||"black",e.Util._namedColorToRBA(g)||e.Util._hex3ColorToRGBA(g)||e.Util._hex4ColorToRGBA(g)||e.Util._hex6ColorToRGBA(g)||e.Util._hex8ColorToRGBA(g)||e.Util._rgbColorToRGBA(g)||e.Util._rgbaColorToRGBA(g)||e.Util._hslColorToRGBA(g)},_namedColorToRBA(g){var y=m[g.toLowerCase()];return y?{r:y[0],g:y[1],b:y[2],a:1}:null},_rgbColorToRGBA(g){if(g.indexOf("rgb(")===0){g=g.match(/rgb\(([^)]+)\)/)[1];var y=g.split(/ *, */).map(Number);return{r:y[0],g:y[1],b:y[2],a:1}}},_rgbaColorToRGBA(g){if(g.indexOf("rgba(")===0){g=g.match(/rgba\(([^)]+)\)/)[1];var y=g.split(/ *, */).map((S,w)=>S.slice(-1)==="%"?w===3?parseInt(S)/100:parseInt(S)/100*255:Number(S));return{r:y[0],g:y[1],b:y[2],a:y[3]}}},_hex8ColorToRGBA(g){if(g[0]==="#"&&g.length===9)return{r:parseInt(g.slice(1,3),16),g:parseInt(g.slice(3,5),16),b:parseInt(g.slice(5,7),16),a:parseInt(g.slice(7,9),16)/255}},_hex6ColorToRGBA(g){if(g[0]==="#"&&g.length===7)return{r:parseInt(g.slice(1,3),16),g:parseInt(g.slice(3,5),16),b:parseInt(g.slice(5,7),16),a:1}},_hex4ColorToRGBA(g){if(g[0]==="#"&&g.length===5)return{r:parseInt(g[1]+g[1],16),g:parseInt(g[2]+g[2],16),b:parseInt(g[3]+g[3],16),a:parseInt(g[4]+g[4],16)/255}},_hex3ColorToRGBA(g){if(g[0]==="#"&&g.length===4)return{r:parseInt(g[1]+g[1],16),g:parseInt(g[2]+g[2],16),b:parseInt(g[3]+g[3],16),a:1}},_hslColorToRGBA(g){if(/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.test(g)){const[y,...S]=/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.exec(g),w=Number(S[0])/360,x=Number(S[1])/100,C=Number(S[2])/100;let k,T,P;if(x===0)return P=C*255,{r:Math.round(P),g:Math.round(P),b:Math.round(P),a:1};C<.5?k=C*(1+x):k=C+x-C*x;const $=2*C-k,O=[0,0,0];for(let E=0;E<3;E++)T=w+1/3*-(E-1),T<0&&T++,T>1&&T--,6*T<1?P=$+(k-$)*6*T:2*T<1?P=k:3*T<2?P=$+(k-$)*(2/3-T)*6:P=$,O[E]=P*255;return{r:Math.round(O[0]),g:Math.round(O[1]),b:Math.round(O[2]),a:1}}},haveIntersection(g,y){return!(y.x>g.x+g.width||y.x+y.widthg.y+g.height||y.y+y.height1?(k=S,T=w,P=(S-x)*(S-x)+(w-C)*(w-C)):(k=g+O*(S-g),T=y+O*(w-y),P=(k-x)*(k-x)+(T-C)*(T-C))}return[k,T,P]},_getProjectionToLine(g,y,S){var w=e.Util.cloneObject(g),x=Number.MAX_VALUE;return y.forEach(function(C,k){if(!(!S&&k===y.length-1)){var T=y[(k+1)%y.length],P=e.Util._getProjectionToSegment(C.x,C.y,T.x,T.y,g.x,g.y),$=P[0],O=P[1],E=P[2];Ey.length){var k=y;y=g,g=k}for(w=0;w{y.width=0,y.height=0})},drawRoundedRectPath(g,y,S,w){let x=0,C=0,k=0,T=0;typeof w=="number"?x=C=k=T=Math.min(w,y/2,S/2):(x=Math.min(w[0]||0,y/2,S/2),C=Math.min(w[1]||0,y/2,S/2),T=Math.min(w[2]||0,y/2,S/2),k=Math.min(w[3]||0,y/2,S/2)),g.moveTo(x,0),g.lineTo(y-C,0),g.arc(y-C,C,C,Math.PI*3/2,0,!1),g.lineTo(y,S-T),g.arc(y-T,S-T,T,0,Math.PI/2,!1),g.lineTo(k,S),g.arc(k,S-k,k,Math.PI/2,Math.PI,!1),g.lineTo(0,x),g.arc(x,x,x,Math.PI,Math.PI*3/2,!1)}}})(dr);var rr={},At={},Xe={};Object.defineProperty(Xe,"__esModule",{value:!0});Xe.getComponentValidator=Xe.getBooleanValidator=Xe.getNumberArrayValidator=Xe.getFunctionValidator=Xe.getStringOrGradientValidator=Xe.getStringValidator=Xe.getNumberOrAutoValidator=Xe.getNumberOrArrayOfNumbersValidator=Xe.getNumberValidator=Xe.alphaComponent=Xe.RGBComponent=void 0;const eu=Rt,vr=dr;function tu(e){return vr.Util._isString(e)?'"'+e+'"':Object.prototype.toString.call(e)==="[object Number]"||vr.Util._isBoolean(e)?e:Object.prototype.toString.call(e)}function Qxe(e){return e>255?255:e<0?0:Math.round(e)}Xe.RGBComponent=Qxe;function Xxe(e){return e>1?1:e<1e-4?1e-4:e}Xe.alphaComponent=Xxe;function Yxe(){if(eu.Konva.isUnminified)return function(e,t){return vr.Util._isNumber(e)||vr.Util.warn(tu(e)+' is a not valid value for "'+t+'" attribute. The value should be a number.'),e}}Xe.getNumberValidator=Yxe;function Zxe(e){if(eu.Konva.isUnminified)return function(t,n){let r=vr.Util._isNumber(t),i=vr.Util._isArray(t)&&t.length==e;return!r&&!i&&vr.Util.warn(tu(t)+' is a not valid value for "'+n+'" attribute. The value should be a number or Array('+e+")"),t}}Xe.getNumberOrArrayOfNumbersValidator=Zxe;function Jxe(){if(eu.Konva.isUnminified)return function(e,t){var n=vr.Util._isNumber(e),r=e==="auto";return n||r||vr.Util.warn(tu(e)+' is a not valid value for "'+t+'" attribute. The value should be a number or "auto".'),e}}Xe.getNumberOrAutoValidator=Jxe;function ewe(){if(eu.Konva.isUnminified)return function(e,t){return vr.Util._isString(e)||vr.Util.warn(tu(e)+' is a not valid value for "'+t+'" attribute. The value should be a string.'),e}}Xe.getStringValidator=ewe;function twe(){if(eu.Konva.isUnminified)return function(e,t){const n=vr.Util._isString(e),r=Object.prototype.toString.call(e)==="[object CanvasGradient]"||e&&e.addColorStop;return n||r||vr.Util.warn(tu(e)+' is a not valid value for "'+t+'" attribute. The value should be a string or a native gradient.'),e}}Xe.getStringOrGradientValidator=twe;function nwe(){if(eu.Konva.isUnminified)return function(e,t){return vr.Util._isFunction(e)||vr.Util.warn(tu(e)+' is a not valid value for "'+t+'" attribute. The value should be a function.'),e}}Xe.getFunctionValidator=nwe;function rwe(){if(eu.Konva.isUnminified)return function(e,t){const n=Int8Array?Object.getPrototypeOf(Int8Array):null;return n&&e instanceof n||(vr.Util._isArray(e)?e.forEach(function(r){vr.Util._isNumber(r)||vr.Util.warn('"'+t+'" attribute has non numeric element '+r+". Make sure that all elements are numbers.")}):vr.Util.warn(tu(e)+' is a not valid value for "'+t+'" attribute. The value should be a array of numbers.')),e}}Xe.getNumberArrayValidator=rwe;function iwe(){if(eu.Konva.isUnminified)return function(e,t){var n=e===!0||e===!1;return n||vr.Util.warn(tu(e)+' is a not valid value for "'+t+'" attribute. The value should be a boolean.'),e}}Xe.getBooleanValidator=iwe;function owe(e){if(eu.Konva.isUnminified)return function(t,n){return t==null||vr.Util.isObject(t)||vr.Util.warn(tu(t)+' is a not valid value for "'+n+'" attribute. The value should be an object with properties '+e),t}}Xe.getComponentValidator=owe;(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.Factory=void 0;const t=dr,n=Xe;var r="get",i="set";e.Factory={addGetterSetter(o,a,s,l,u){e.Factory.addGetter(o,a,s),e.Factory.addSetter(o,a,l,u),e.Factory.addOverloadedGetterSetter(o,a)},addGetter(o,a,s){var l=r+t.Util._capitalize(a);o.prototype[l]=o.prototype[l]||function(){var u=this.attrs[a];return u===void 0?s:u}},addSetter(o,a,s,l){var u=i+t.Util._capitalize(a);o.prototype[u]||e.Factory.overWriteSetter(o,a,s,l)},overWriteSetter(o,a,s,l){var u=i+t.Util._capitalize(a);o.prototype[u]=function(c){return s&&c!==void 0&&c!==null&&(c=s.call(this,c,a)),this._setAttr(a,c),l&&l.call(this),this}},addComponentsGetterSetter(o,a,s,l,u){var c=s.length,d=t.Util._capitalize,f=r+d(a),h=i+d(a),p,m;o.prototype[f]=function(){var b={};for(p=0;p{this._setAttr(a+d(y),void 0)}),this._fireChangeEvent(a,v,b),u&&u.call(this),this},e.Factory.addOverloadedGetterSetter(o,a)},addOverloadedGetterSetter(o,a){var s=t.Util._capitalize(a),l=i+s,u=r+s;o.prototype[a]=function(){return arguments.length?(this[l](arguments[0]),this):this[u]()}},addDeprecatedGetterSetter(o,a,s,l){t.Util.error("Adding deprecated "+a);var u=r+t.Util._capitalize(a),c=a+" property is deprecated and will be removed soon. Look at Konva change log for more information.";o.prototype[u]=function(){t.Util.error(c);var d=this.attrs[a];return d===void 0?s:d},e.Factory.addSetter(o,a,l,function(){t.Util.error(c)}),e.Factory.addOverloadedGetterSetter(o,a)},backCompat(o,a){t.Util.each(a,function(s,l){var u=o.prototype[l],c=r+t.Util._capitalize(s),d=i+t.Util._capitalize(s);function f(){u.apply(this,arguments),t.Util.error('"'+s+'" method is deprecated and will be removed soon. Use ""'+l+'" instead.')}o.prototype[s]=f,o.prototype[c]=f,o.prototype[d]=f})},afterSetFilter(){this._filterUpToDate=!1}}})(At);var is={},$l={};Object.defineProperty($l,"__esModule",{value:!0});$l.HitContext=$l.SceneContext=$l.Context=void 0;const bG=dr,awe=Rt;function swe(e){var t=[],n=e.length,r=bG.Util,i,o;for(i=0;itypeof c=="number"?Math.floor(c):c)),o+=lwe+u.join(nO)+uwe)):(o+=s.property,t||(o+=pwe+s.val)),o+=fwe;return o}clearTrace(){this.traceArr=[]}_trace(t){var n=this.traceArr,r;n.push(t),r=n.length,r>=mwe&&n.shift()}reset(){var t=this.getCanvas().getPixelRatio();this.setTransform(1*t,0,0,1*t,0,0)}getCanvas(){return this.canvas}clear(t){var n=this.getCanvas();t?this.clearRect(t.x||0,t.y||0,t.width||0,t.height||0):this.clearRect(0,0,n.getWidth()/n.pixelRatio,n.getHeight()/n.pixelRatio)}_applyLineCap(t){const n=t.attrs.lineCap;n&&this.setAttr("lineCap",n)}_applyOpacity(t){var n=t.getAbsoluteOpacity();n!==1&&this.setAttr("globalAlpha",n)}_applyLineJoin(t){const n=t.attrs.lineJoin;n&&this.setAttr("lineJoin",n)}setAttr(t,n){this._context[t]=n}arc(t,n,r,i,o,a){this._context.arc(t,n,r,i,o,a)}arcTo(t,n,r,i,o){this._context.arcTo(t,n,r,i,o)}beginPath(){this._context.beginPath()}bezierCurveTo(t,n,r,i,o,a){this._context.bezierCurveTo(t,n,r,i,o,a)}clearRect(t,n,r,i){this._context.clearRect(t,n,r,i)}clip(...t){this._context.clip.apply(this._context,t)}closePath(){this._context.closePath()}createImageData(t,n){var r=arguments;if(r.length===2)return this._context.createImageData(t,n);if(r.length===1)return this._context.createImageData(t)}createLinearGradient(t,n,r,i){return this._context.createLinearGradient(t,n,r,i)}createPattern(t,n){return this._context.createPattern(t,n)}createRadialGradient(t,n,r,i,o,a){return this._context.createRadialGradient(t,n,r,i,o,a)}drawImage(t,n,r,i,o,a,s,l,u){var c=arguments,d=this._context;c.length===3?d.drawImage(t,n,r):c.length===5?d.drawImage(t,n,r,i,o):c.length===9&&d.drawImage(t,n,r,i,o,a,s,l,u)}ellipse(t,n,r,i,o,a,s,l){this._context.ellipse(t,n,r,i,o,a,s,l)}isPointInPath(t,n,r,i){return r?this._context.isPointInPath(r,t,n,i):this._context.isPointInPath(t,n,i)}fill(...t){this._context.fill.apply(this._context,t)}fillRect(t,n,r,i){this._context.fillRect(t,n,r,i)}strokeRect(t,n,r,i){this._context.strokeRect(t,n,r,i)}fillText(t,n,r,i){i?this._context.fillText(t,n,r,i):this._context.fillText(t,n,r)}measureText(t){return this._context.measureText(t)}getImageData(t,n,r,i){return this._context.getImageData(t,n,r,i)}lineTo(t,n){this._context.lineTo(t,n)}moveTo(t,n){this._context.moveTo(t,n)}rect(t,n,r,i){this._context.rect(t,n,r,i)}putImageData(t,n,r){this._context.putImageData(t,n,r)}quadraticCurveTo(t,n,r,i){this._context.quadraticCurveTo(t,n,r,i)}restore(){this._context.restore()}rotate(t){this._context.rotate(t)}save(){this._context.save()}scale(t,n){this._context.scale(t,n)}setLineDash(t){this._context.setLineDash?this._context.setLineDash(t):"mozDash"in this._context?this._context.mozDash=t:"webkitLineDash"in this._context&&(this._context.webkitLineDash=t)}getLineDash(){return this._context.getLineDash()}setTransform(t,n,r,i,o,a){this._context.setTransform(t,n,r,i,o,a)}stroke(t){t?this._context.stroke(t):this._context.stroke()}strokeText(t,n,r,i){this._context.strokeText(t,n,r,i)}transform(t,n,r,i,o,a){this._context.transform(t,n,r,i,o,a)}translate(t,n){this._context.translate(t,n)}_enableTrace(){var t=this,n=rO.length,r=this.setAttr,i,o,a=function(s){var l=t[s],u;t[s]=function(){return o=swe(Array.prototype.slice.call(arguments,0)),u=l.apply(t,arguments),t._trace({method:s,args:o}),u}};for(i=0;i{i.dragStatus==="dragging"&&(r=!0)}),r},justDragged:!1,get node(){var r;return e.DD._dragElements.forEach(i=>{r=i.node}),r},_dragElements:new Map,_drag(r){const i=[];e.DD._dragElements.forEach((o,a)=>{const{node:s}=o,l=s.getStage();l.setPointersPositions(r),o.pointerId===void 0&&(o.pointerId=n.Util._getFirstPointerId(r));const u=l._changedPointerPositions.find(f=>f.id===o.pointerId);if(u){if(o.dragStatus!=="dragging"){var c=s.dragDistance(),d=Math.max(Math.abs(u.x-o.startPointerPos.x),Math.abs(u.y-o.startPointerPos.y));if(d{o.fire("dragmove",{type:"dragmove",target:o,evt:r},!0)})},_endDragBefore(r){const i=[];e.DD._dragElements.forEach(o=>{const{node:a}=o,s=a.getStage();if(r&&s.setPointersPositions(r),!s._changedPointerPositions.find(c=>c.id===o.pointerId))return;(o.dragStatus==="dragging"||o.dragStatus==="stopped")&&(e.DD.justDragged=!0,t.Konva._mouseListenClick=!1,t.Konva._touchListenClick=!1,t.Konva._pointerListenClick=!1,o.dragStatus="stopped");const u=o.node.getLayer()||o.node instanceof t.Konva.Stage&&o.node;u&&i.indexOf(u)===-1&&i.push(u)}),i.forEach(o=>{o.draw()})},_endDragAfter(r){e.DD._dragElements.forEach((i,o)=>{i.dragStatus==="stopped"&&i.node.fire("dragend",{type:"dragend",target:i.node,evt:r},!0),i.dragStatus!=="dragging"&&e.DD._dragElements.delete(o)})}},t.Konva.isBrowser&&(window.addEventListener("mouseup",e.DD._endDragBefore,!0),window.addEventListener("touchend",e.DD._endDragBefore,!0),window.addEventListener("mousemove",e.DD._drag),window.addEventListener("touchmove",e.DD._drag),window.addEventListener("mouseup",e.DD._endDragAfter,!1),window.addEventListener("touchend",e.DD._endDragAfter,!1))})(ox);Object.defineProperty(rr,"__esModule",{value:!0});rr.Node=void 0;const $t=dr,wy=At,Bv=is,Dc=Rt,sa=ox,Tr=Xe;var V1="absoluteOpacity",zv="allEventListeners",gl="absoluteTransform",iO="absoluteScale",Lc="canvas",Cwe="Change",Ewe="children",Twe="konva",HE="listening",oO="mouseenter",aO="mouseleave",sO="set",lO="Shape",G1=" ",uO="stage",gu="transform",kwe="Stage",WE="visible",Awe=["xChange.konva","yChange.konva","scaleXChange.konva","scaleYChange.konva","skewXChange.konva","skewYChange.konva","rotationChange.konva","offsetXChange.konva","offsetYChange.konva","transformsEnabledChange.konva"].join(G1);let Pwe=1;class ht{constructor(t){this._id=Pwe++,this.eventListeners={},this.attrs={},this.index=0,this._allEventListeners=null,this.parent=null,this._cache=new Map,this._attachedDepsListeners=new Map,this._lastPos=null,this._batchingTransformChange=!1,this._needClearTransformCache=!1,this._filterUpToDate=!1,this._isUnderCache=!1,this._dragEventId=null,this._shouldFireChangeEvents=!1,this.setAttrs(t),this._shouldFireChangeEvents=!0}hasChildren(){return!1}_clearCache(t){(t===gu||t===gl)&&this._cache.get(t)?this._cache.get(t).dirty=!0:t?this._cache.delete(t):this._cache.clear()}_getCache(t,n){var r=this._cache.get(t),i=t===gu||t===gl,o=r===void 0||i&&r.dirty===!0;return o&&(r=n.call(this),this._cache.set(t,r)),r}_calculate(t,n,r){if(!this._attachedDepsListeners.get(t)){const i=n.map(o=>o+"Change.konva").join(G1);this.on(i,()=>{this._clearCache(t)}),this._attachedDepsListeners.set(t,!0)}return this._getCache(t,r)}_getCanvasCache(){return this._cache.get(Lc)}_clearSelfAndDescendantCache(t){this._clearCache(t),t===gl&&this.fire("absoluteTransformChange")}clearCache(){if(this._cache.has(Lc)){const{scene:t,filter:n,hit:r}=this._cache.get(Lc);$t.Util.releaseCanvas(t,n,r),this._cache.delete(Lc)}return this._clearSelfAndDescendantCache(),this._requestDraw(),this}cache(t){var n=t||{},r={};(n.x===void 0||n.y===void 0||n.width===void 0||n.height===void 0)&&(r=this.getClientRect({skipTransform:!0,relativeTo:this.getParent()}));var i=Math.ceil(n.width||r.width),o=Math.ceil(n.height||r.height),a=n.pixelRatio,s=n.x===void 0?Math.floor(r.x):n.x,l=n.y===void 0?Math.floor(r.y):n.y,u=n.offset||0,c=n.drawBorder||!1,d=n.hitCanvasPixelRatio||1;if(!i||!o){$t.Util.error("Can not cache the node. Width or height of the node equals 0. Caching is skipped.");return}i+=u*2+1,o+=u*2+1,s-=u,l-=u;var f=new Bv.SceneCanvas({pixelRatio:a,width:i,height:o}),h=new Bv.SceneCanvas({pixelRatio:a,width:0,height:0,willReadFrequently:!0}),p=new Bv.HitCanvas({pixelRatio:d,width:i,height:o}),m=f.getContext(),_=p.getContext();return p.isCache=!0,f.isCache=!0,this._cache.delete(Lc),this._filterUpToDate=!1,n.imageSmoothingEnabled===!1&&(f.getContext()._context.imageSmoothingEnabled=!1,h.getContext()._context.imageSmoothingEnabled=!1),m.save(),_.save(),m.translate(-s,-l),_.translate(-s,-l),this._isUnderCache=!0,this._clearSelfAndDescendantCache(V1),this._clearSelfAndDescendantCache(iO),this.drawScene(f,this),this.drawHit(p,this),this._isUnderCache=!1,m.restore(),_.restore(),c&&(m.save(),m.beginPath(),m.rect(0,0,i,o),m.closePath(),m.setAttr("strokeStyle","red"),m.setAttr("lineWidth",5),m.stroke(),m.restore()),this._cache.set(Lc,{scene:f,filter:h,hit:p,x:s,y:l}),this._requestDraw(),this}isCached(){return this._cache.has(Lc)}getClientRect(t){throw new Error('abstract "getClientRect" method call')}_transformedRect(t,n){var r=[{x:t.x,y:t.y},{x:t.x+t.width,y:t.y},{x:t.x+t.width,y:t.y+t.height},{x:t.x,y:t.y+t.height}],i,o,a,s,l=this.getAbsoluteTransform(n);return r.forEach(function(u){var c=l.point(u);i===void 0&&(i=a=c.x,o=s=c.y),i=Math.min(i,c.x),o=Math.min(o,c.y),a=Math.max(a,c.x),s=Math.max(s,c.y)}),{x:i,y:o,width:a-i,height:s-o}}_drawCachedSceneCanvas(t){t.save(),t._applyOpacity(this),t._applyGlobalCompositeOperation(this);const n=this._getCanvasCache();t.translate(n.x,n.y);var r=this._getCachedSceneCanvas(),i=r.pixelRatio;t.drawImage(r._canvas,0,0,r.width/i,r.height/i),t.restore()}_drawCachedHitCanvas(t){var n=this._getCanvasCache(),r=n.hit;t.save(),t.translate(n.x,n.y),t.drawImage(r._canvas,0,0,r.width/r.pixelRatio,r.height/r.pixelRatio),t.restore()}_getCachedSceneCanvas(){var t=this.filters(),n=this._getCanvasCache(),r=n.scene,i=n.filter,o=i.getContext(),a,s,l,u;if(t){if(!this._filterUpToDate){var c=r.pixelRatio;i.setSize(r.width/r.pixelRatio,r.height/r.pixelRatio);try{for(a=t.length,o.clear(),o.drawImage(r._canvas,0,0,r.getWidth()/c,r.getHeight()/c),s=o.getImageData(0,0,i.getWidth(),i.getHeight()),l=0;l{var n,r;if(!t)return this;for(n in t)n!==Ewe&&(r=sO+$t.Util._capitalize(n),$t.Util._isFunction(this[r])?this[r](t[n]):this._setAttr(n,t[n]))}),this}isListening(){return this._getCache(HE,this._isListening)}_isListening(t){if(!this.listening())return!1;const r=this.getParent();return r&&r!==t&&this!==t?r._isListening(t):!0}isVisible(){return this._getCache(WE,this._isVisible)}_isVisible(t){if(!this.visible())return!1;const r=this.getParent();return r&&r!==t&&this!==t?r._isVisible(t):!0}shouldDrawHit(t,n=!1){if(t)return this._isVisible(t)&&this._isListening(t);var r=this.getLayer(),i=!1;sa.DD._dragElements.forEach(a=>{a.dragStatus==="dragging"&&(a.node.nodeType==="Stage"||a.node.getLayer()===r)&&(i=!0)});var o=!n&&!Dc.Konva.hitOnDragEnabled&&i;return this.isListening()&&this.isVisible()&&!o}show(){return this.visible(!0),this}hide(){return this.visible(!1),this}getZIndex(){return this.index||0}getAbsoluteZIndex(){var t=this.getDepth(),n=this,r=0,i,o,a,s;function l(u){for(i=[],o=u.length,a=0;a0&&i[0].getDepth()<=t&&l(i)}return n.nodeType!==kwe&&l(n.getStage().getChildren()),r}getDepth(){for(var t=0,n=this.parent;n;)t++,n=n.parent;return t}_batchTransformChanges(t){this._batchingTransformChange=!0,t(),this._batchingTransformChange=!1,this._needClearTransformCache&&(this._clearCache(gu),this._clearSelfAndDescendantCache(gl)),this._needClearTransformCache=!1}setPosition(t){return this._batchTransformChanges(()=>{this.x(t.x),this.y(t.y)}),this}getPosition(){return{x:this.x(),y:this.y()}}getRelativePointerPosition(){if(!this.getStage())return null;var t=this.getStage().getPointerPosition();if(!t)return null;var n=this.getAbsoluteTransform().copy();return n.invert(),n.point(t)}getAbsolutePosition(t){let n=!1,r=this.parent;for(;r;){if(r.isCached()){n=!0;break}r=r.parent}n&&!t&&(t=!0);var i=this.getAbsoluteTransform(t).getMatrix(),o=new $t.Transform,a=this.offset();return o.m=i.slice(),o.translate(a.x,a.y),o.getTranslation()}setAbsolutePosition(t){var n=this._clearTransform();this.attrs.x=n.x,this.attrs.y=n.y,delete n.x,delete n.y,this._clearCache(gu);var r=this._getAbsoluteTransform().copy();return r.invert(),r.translate(t.x,t.y),t={x:this.attrs.x+r.getTranslation().x,y:this.attrs.y+r.getTranslation().y},this._setTransform(n),this.setPosition({x:t.x,y:t.y}),this._clearCache(gu),this._clearSelfAndDescendantCache(gl),this}_setTransform(t){var n;for(n in t)this.attrs[n]=t[n]}_clearTransform(){var t={x:this.x(),y:this.y(),rotation:this.rotation(),scaleX:this.scaleX(),scaleY:this.scaleY(),offsetX:this.offsetX(),offsetY:this.offsetY(),skewX:this.skewX(),skewY:this.skewY()};return this.attrs.x=0,this.attrs.y=0,this.attrs.rotation=0,this.attrs.scaleX=1,this.attrs.scaleY=1,this.attrs.offsetX=0,this.attrs.offsetY=0,this.attrs.skewX=0,this.attrs.skewY=0,t}move(t){var n=t.x,r=t.y,i=this.x(),o=this.y();return n!==void 0&&(i+=n),r!==void 0&&(o+=r),this.setPosition({x:i,y:o}),this}_eachAncestorReverse(t,n){var r=[],i=this.getParent(),o,a;if(!(n&&n._id===this._id)){for(r.unshift(this);i&&(!n||i._id!==n._id);)r.unshift(i),i=i.parent;for(o=r.length,a=0;a0?(this.parent.children.splice(t,1),this.parent.children.splice(t-1,0,this),this.parent._setChildrenIndices(),!0):!1}moveToBottom(){if(!this.parent)return $t.Util.warn("Node has no parent. moveToBottom function is ignored."),!1;var t=this.index;return t>0?(this.parent.children.splice(t,1),this.parent.children.unshift(this),this.parent._setChildrenIndices(),!0):!1}setZIndex(t){if(!this.parent)return $t.Util.warn("Node has no parent. zIndex parameter is ignored."),this;(t<0||t>=this.parent.children.length)&&$t.Util.warn("Unexpected value "+t+" for zIndex property. zIndex is just index of a node in children of its parent. Expected value is from 0 to "+(this.parent.children.length-1)+".");var n=this.index;return this.parent.children.splice(n,1),this.parent.children.splice(t,0,this),this.parent._setChildrenIndices(),this}getAbsoluteOpacity(){return this._getCache(V1,this._getAbsoluteOpacity)}_getAbsoluteOpacity(){var t=this.opacity(),n=this.getParent();return n&&!n._isUnderCache&&(t*=n.getAbsoluteOpacity()),t}moveTo(t){return this.getParent()!==t&&(this._remove(),t.add(this)),this}toObject(){var t={},n=this.getAttrs(),r,i,o,a,s;t.attrs={};for(r in n)i=n[r],s=$t.Util.isObject(i)&&!$t.Util._isPlainObject(i)&&!$t.Util._isArray(i),!s&&(o=typeof this[r]=="function"&&this[r],delete n[r],a=o?o.call(this):null,n[r]=i,a!==i&&(t.attrs[r]=i));return t.className=this.getClassName(),$t.Util._prepareToStringify(t)}toJSON(){return JSON.stringify(this.toObject())}getParent(){return this.parent}findAncestors(t,n,r){var i=[];n&&this._isMatch(t)&&i.push(this);for(var o=this.parent;o;){if(o===r)return i;o._isMatch(t)&&i.push(o),o=o.parent}return i}isAncestorOf(t){return!1}findAncestor(t,n,r){return this.findAncestors(t,n,r)[0]}_isMatch(t){if(!t)return!1;if(typeof t=="function")return t(this);var n=t.replace(/ /g,"").split(","),r=n.length,i,o;for(i=0;i{try{const i=t==null?void 0:t.callback;i&&delete t.callback,$t.Util._urlToImage(this.toDataURL(t),function(o){n(o),i==null||i(o)})}catch(i){r(i)}})}toBlob(t){return new Promise((n,r)=>{try{const i=t==null?void 0:t.callback;i&&delete t.callback,this.toCanvas(t).toBlob(o=>{n(o),i==null||i(o)})}catch(i){r(i)}})}setSize(t){return this.width(t.width),this.height(t.height),this}getSize(){return{width:this.width(),height:this.height()}}getClassName(){return this.className||this.nodeType}getType(){return this.nodeType}getDragDistance(){return this.attrs.dragDistance!==void 0?this.attrs.dragDistance:this.parent?this.parent.getDragDistance():Dc.Konva.dragDistance}_off(t,n,r){var i=this.eventListeners[t],o,a,s;for(o=0;o=0;if(r&&!this.isDragging()){var i=!1;sa.DD._dragElements.forEach(o=>{this.isAncestorOf(o.node)&&(i=!0)}),i||this._createDragElement(t)}})}_dragChange(){if(this.attrs.draggable)this._listenDrag();else{this._dragCleanup();var t=this.getStage();if(!t)return;const n=sa.DD._dragElements.get(this._id),r=n&&n.dragStatus==="dragging",i=n&&n.dragStatus==="ready";r?this.stopDrag():i&&sa.DD._dragElements.delete(this._id)}}_dragCleanup(){this.off("mousedown.konva"),this.off("touchstart.konva")}isClientRectOnScreen(t={x:0,y:0}){const n=this.getStage();if(!n)return!1;const r={x:-t.x,y:-t.y,width:n.width()+2*t.x,height:n.height()+2*t.y};return $t.Util.haveIntersection(r,this.getClientRect())}static create(t,n){return $t.Util._isString(t)&&(t=JSON.parse(t)),this._createNode(t,n)}static _createNode(t,n){var r=ht.prototype.getClassName.call(t),i=t.children,o,a,s;n&&(t.attrs.container=n),Dc.Konva[r]||($t.Util.warn('Can not find a node with class name "'+r+'". Fallback to "Shape".'),r="Shape");const l=Dc.Konva[r];if(o=new l(t.attrs),i)for(a=i.length,s=0;s0}removeChildren(){return this.getChildren().forEach(t=>{t.parent=null,t.index=0,t.remove()}),this.children=[],this._requestDraw(),this}destroyChildren(){return this.getChildren().forEach(t=>{t.parent=null,t.index=0,t.destroy()}),this.children=[],this._requestDraw(),this}add(...t){if(t.length===0)return this;if(t.length>1){for(var n=0;n0?n[0]:void 0}_generalFind(t,n){var r=[];return this._descendants(i=>{const o=i._isMatch(t);return o&&r.push(i),!!(o&&n)}),r}_descendants(t){let n=!1;const r=this.getChildren();for(const i of r){if(n=t(i),n)return!0;if(i.hasChildren()&&(n=i._descendants(t),n))return!0}return!1}toObject(){var t=WC.Node.prototype.toObject.call(this);return t.children=[],this.getChildren().forEach(n=>{t.children.push(n.toObject())}),t}isAncestorOf(t){for(var n=t.getParent();n;){if(n._id===this._id)return!0;n=n.getParent()}return!1}clone(t){var n=WC.Node.prototype.clone.call(this,t);return this.getChildren().forEach(function(r){n.add(r.clone())}),n}getAllIntersections(t){var n=[];return this.find("Shape").forEach(function(r){r.isVisible()&&r.intersects(t)&&n.push(r)}),n}_clearSelfAndDescendantCache(t){var n;super._clearSelfAndDescendantCache(t),!this.isCached()&&((n=this.children)===null||n===void 0||n.forEach(function(r){r._clearSelfAndDescendantCache(t)}))}_setChildrenIndices(){var t;(t=this.children)===null||t===void 0||t.forEach(function(n,r){n.index=r}),this._requestDraw()}drawScene(t,n){var r=this.getLayer(),i=t||r&&r.getCanvas(),o=i&&i.getContext(),a=this._getCanvasCache(),s=a&&a.scene,l=i&&i.isCache;if(!this.isVisible()&&!l)return this;if(s){o.save();var u=this.getAbsoluteTransform(n).getMatrix();o.transform(u[0],u[1],u[2],u[3],u[4],u[5]),this._drawCachedSceneCanvas(o),o.restore()}else this._drawChildren("drawScene",i,n);return this}drawHit(t,n){if(!this.shouldDrawHit(n))return this;var r=this.getLayer(),i=t||r&&r.hitCanvas,o=i&&i.getContext(),a=this._getCanvasCache(),s=a&&a.hit;if(s){o.save();var l=this.getAbsoluteTransform(n).getMatrix();o.transform(l[0],l[1],l[2],l[3],l[4],l[5]),this._drawCachedHitCanvas(o),o.restore()}else this._drawChildren("drawHit",i,n);return this}_drawChildren(t,n,r){var i,o=n&&n.getContext(),a=this.clipWidth(),s=this.clipHeight(),l=this.clipFunc(),u=a&&s||l;const c=r===this;if(u){o.save();var d=this.getAbsoluteTransform(r),f=d.getMatrix();o.transform(f[0],f[1],f[2],f[3],f[4],f[5]),o.beginPath();let _;if(l)_=l.call(this,o,this);else{var h=this.clipX(),p=this.clipY();o.rect(h,p,a,s)}o.clip.apply(o,_),f=d.copy().invert().getMatrix(),o.transform(f[0],f[1],f[2],f[3],f[4],f[5])}var m=!c&&this.globalCompositeOperation()!=="source-over"&&t==="drawScene";m&&(o.save(),o._applyGlobalCompositeOperation(this)),(i=this.children)===null||i===void 0||i.forEach(function(_){_[t](n,r)}),m&&o.restore(),u&&o.restore()}getClientRect(t){var n;t=t||{};var r=t.skipTransform,i=t.relativeTo,o,a,s,l,u={x:1/0,y:1/0,width:0,height:0},c=this;(n=this.children)===null||n===void 0||n.forEach(function(m){if(m.visible()){var _=m.getClientRect({relativeTo:c,skipShadow:t.skipShadow,skipStroke:t.skipStroke});_.width===0&&_.height===0||(o===void 0?(o=_.x,a=_.y,s=_.x+_.width,l=_.y+_.height):(o=Math.min(o,_.x),a=Math.min(a,_.y),s=Math.max(s,_.x+_.width),l=Math.max(l,_.y+_.height)))}});for(var d=this.find("Shape"),f=!1,h=0;hJ.indexOf("pointer")>=0?"pointer":J.indexOf("touch")>=0?"touch":"mouse",U=J=>{const j=B(J);if(j==="pointer")return i.Konva.pointerEventsEnabled&&N.pointer;if(j==="touch")return N.touch;if(j==="mouse")return N.mouse};function G(J={}){return(J.clipFunc||J.clipWidth||J.clipHeight)&&t.Util.warn("Stage does not support clipping. Please use clip for Layers or Groups."),J}const Y="Pointer position is missing and not registered by the stage. Looks like it is outside of the stage container. You can set it manually from event: stage.setPointersPositions(event);";e.stages=[];class ee extends r.Container{constructor(j){super(G(j)),this._pointerPositions=[],this._changedPointerPositions=[],this._buildDOM(),this._bindContentEvents(),e.stages.push(this),this.on("widthChange.konva heightChange.konva",this._resizeDOM),this.on("visibleChange.konva",this._checkVisibility),this.on("clipWidthChange.konva clipHeightChange.konva clipFuncChange.konva",()=>{G(this.attrs)}),this._checkVisibility()}_validateAdd(j){const Q=j.getType()==="Layer",ne=j.getType()==="FastLayer";Q||ne||t.Util.throw("You may only add layers to the stage.")}_checkVisibility(){if(!this.content)return;const j=this.visible()?"":"none";this.content.style.display=j}setContainer(j){if(typeof j===c){if(j.charAt(0)==="."){var Q=j.slice(1);j=document.getElementsByClassName(Q)[0]}else{var ne;j.charAt(0)!=="#"?ne=j:ne=j.slice(1),j=document.getElementById(ne)}if(!j)throw"Can not find container in document with id "+ne}return this._setAttr("container",j),this.content&&(this.content.parentElement&&this.content.parentElement.removeChild(this.content),j.appendChild(this.content)),this}shouldDrawHit(){return!0}clear(){var j=this.children,Q=j.length,ne;for(ne=0;ne-1&&e.stages.splice(Q,1),t.Util.releaseCanvas(this.bufferCanvas._canvas,this.bufferHitCanvas._canvas),this}getPointerPosition(){const j=this._pointerPositions[0]||this._changedPointerPositions[0];return j?{x:j.x,y:j.y}:(t.Util.warn(Y),null)}_getPointerById(j){return this._pointerPositions.find(Q=>Q.id===j)}getPointersPositions(){return this._pointerPositions}getStage(){return this}getContent(){return this.content}_toKonvaCanvas(j){j=j||{},j.x=j.x||0,j.y=j.y||0,j.width=j.width||this.width(),j.height=j.height||this.height();var Q=new o.SceneCanvas({width:j.width,height:j.height,pixelRatio:j.pixelRatio||1}),ne=Q.getContext()._context,se=this.children;return(j.x||j.y)&&ne.translate(-1*j.x,-1*j.y),se.forEach(function(ve){if(ve.isVisible()){var ce=ve._toKonvaCanvas(j);ne.drawImage(ce._canvas,j.x,j.y,ce.getWidth()/ce.getPixelRatio(),ce.getHeight()/ce.getPixelRatio())}}),Q}getIntersection(j){if(!j)return null;var Q=this.children,ne=Q.length,se=ne-1,ve;for(ve=se;ve>=0;ve--){const ce=Q[ve].getIntersection(j);if(ce)return ce}return null}_resizeDOM(){var j=this.width(),Q=this.height();this.content&&(this.content.style.width=j+d,this.content.style.height=Q+d),this.bufferCanvas.setSize(j,Q),this.bufferHitCanvas.setSize(j,Q),this.children.forEach(ne=>{ne.setSize({width:j,height:Q}),ne.draw()})}add(j,...Q){if(arguments.length>1){for(var ne=0;neM&&t.Util.warn("The stage has "+se+" layers. Recommended maximum number of layers is 3-5. Adding more layers into the stage may drop the performance. Rethink your tree structure, you can use Konva.Group."),j.setSize({width:this.width(),height:this.height()}),j.draw(),i.Konva.isBrowser&&this.content.appendChild(j.canvas._canvas),this}getParent(){return null}getLayer(){return null}hasPointerCapture(j){return l.hasPointerCapture(j,this)}setPointerCapture(j){l.setPointerCapture(j,this)}releaseCapture(j){l.releaseCapture(j,this)}getLayers(){return this.children}_bindContentEvents(){i.Konva.isBrowser&&R.forEach(([j,Q])=>{this.content.addEventListener(j,ne=>{this[Q](ne)},{passive:!1})})}_pointerenter(j){this.setPointersPositions(j);const Q=U(j.type);this._fire(Q.pointerenter,{evt:j,target:this,currentTarget:this})}_pointerover(j){this.setPointersPositions(j);const Q=U(j.type);this._fire(Q.pointerover,{evt:j,target:this,currentTarget:this})}_getTargetShape(j){let Q=this[j+"targetShape"];return Q&&!Q.getStage()&&(Q=null),Q}_pointerleave(j){const Q=U(j.type),ne=B(j.type);if(Q){this.setPointersPositions(j);var se=this._getTargetShape(ne),ve=!a.DD.isDragging||i.Konva.hitOnDragEnabled;se&&ve?(se._fireAndBubble(Q.pointerout,{evt:j}),se._fireAndBubble(Q.pointerleave,{evt:j}),this._fire(Q.pointerleave,{evt:j,target:this,currentTarget:this}),this[ne+"targetShape"]=null):ve&&(this._fire(Q.pointerleave,{evt:j,target:this,currentTarget:this}),this._fire(Q.pointerout,{evt:j,target:this,currentTarget:this})),this.pointerPos=void 0,this._pointerPositions=[]}}_pointerdown(j){const Q=U(j.type),ne=B(j.type);if(Q){this.setPointersPositions(j);var se=!1;this._changedPointerPositions.forEach(ve=>{var ce=this.getIntersection(ve);if(a.DD.justDragged=!1,i.Konva["_"+ne+"ListenClick"]=!0,!(ce&&ce.isListening()))return;i.Konva.capturePointerEventsEnabled&&ce.setPointerCapture(ve.id),this[ne+"ClickStartShape"]=ce,ce._fireAndBubble(Q.pointerdown,{evt:j,pointerId:ve.id}),se=!0;const ot=j.type.indexOf("touch")>=0;ce.preventDefault()&&j.cancelable&&ot&&j.preventDefault()}),se||this._fire(Q.pointerdown,{evt:j,target:this,currentTarget:this,pointerId:this._pointerPositions[0].id})}}_pointermove(j){const Q=U(j.type),ne=B(j.type);if(!Q)return;a.DD.isDragging&&a.DD.node.preventDefault()&&j.cancelable&&j.preventDefault(),this.setPointersPositions(j);var se=!a.DD.isDragging||i.Konva.hitOnDragEnabled;if(!se)return;var ve={};let ce=!1;var bt=this._getTargetShape(ne);this._changedPointerPositions.forEach(ot=>{const ze=l.getCapturedShape(ot.id)||this.getIntersection(ot),mt=ot.id,Pe={evt:j,pointerId:mt};var Jt=bt!==ze;if(Jt&&bt&&(bt._fireAndBubble(Q.pointerout,Object.assign({},Pe),ze),bt._fireAndBubble(Q.pointerleave,Object.assign({},Pe),ze)),ze){if(ve[ze._id])return;ve[ze._id]=!0}ze&&ze.isListening()?(ce=!0,Jt&&(ze._fireAndBubble(Q.pointerover,Object.assign({},Pe),bt),ze._fireAndBubble(Q.pointerenter,Object.assign({},Pe),bt),this[ne+"targetShape"]=ze),ze._fireAndBubble(Q.pointermove,Object.assign({},Pe))):bt&&(this._fire(Q.pointerover,{evt:j,target:this,currentTarget:this,pointerId:mt}),this[ne+"targetShape"]=null)}),ce||this._fire(Q.pointermove,{evt:j,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id})}_pointerup(j){const Q=U(j.type),ne=B(j.type);if(!Q)return;this.setPointersPositions(j);const se=this[ne+"ClickStartShape"],ve=this[ne+"ClickEndShape"];var ce={};let bt=!1;this._changedPointerPositions.forEach(ot=>{const ze=l.getCapturedShape(ot.id)||this.getIntersection(ot);if(ze){if(ze.releaseCapture(ot.id),ce[ze._id])return;ce[ze._id]=!0}const mt=ot.id,Pe={evt:j,pointerId:mt};let Jt=!1;i.Konva["_"+ne+"InDblClickWindow"]?(Jt=!0,clearTimeout(this[ne+"DblTimeout"])):a.DD.justDragged||(i.Konva["_"+ne+"InDblClickWindow"]=!0,clearTimeout(this[ne+"DblTimeout"])),this[ne+"DblTimeout"]=setTimeout(function(){i.Konva["_"+ne+"InDblClickWindow"]=!1},i.Konva.dblClickWindow),ze&&ze.isListening()?(bt=!0,this[ne+"ClickEndShape"]=ze,ze._fireAndBubble(Q.pointerup,Object.assign({},Pe)),i.Konva["_"+ne+"ListenClick"]&&se&&se===ze&&(ze._fireAndBubble(Q.pointerclick,Object.assign({},Pe)),Jt&&ve&&ve===ze&&ze._fireAndBubble(Q.pointerdblclick,Object.assign({},Pe)))):(this[ne+"ClickEndShape"]=null,i.Konva["_"+ne+"ListenClick"]&&this._fire(Q.pointerclick,{evt:j,target:this,currentTarget:this,pointerId:mt}),Jt&&this._fire(Q.pointerdblclick,{evt:j,target:this,currentTarget:this,pointerId:mt}))}),bt||this._fire(Q.pointerup,{evt:j,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id}),i.Konva["_"+ne+"ListenClick"]=!1,j.cancelable&&ne!=="touch"&&j.preventDefault()}_contextmenu(j){this.setPointersPositions(j);var Q=this.getIntersection(this.getPointerPosition());Q&&Q.isListening()?Q._fireAndBubble($,{evt:j}):this._fire($,{evt:j,target:this,currentTarget:this})}_wheel(j){this.setPointersPositions(j);var Q=this.getIntersection(this.getPointerPosition());Q&&Q.isListening()?Q._fireAndBubble(L,{evt:j}):this._fire(L,{evt:j,target:this,currentTarget:this})}_pointercancel(j){this.setPointersPositions(j);const Q=l.getCapturedShape(j.pointerId)||this.getIntersection(this.getPointerPosition());Q&&Q._fireAndBubble(S,l.createEvent(j)),l.releaseCapture(j.pointerId)}_lostpointercapture(j){l.releaseCapture(j.pointerId)}setPointersPositions(j){var Q=this._getContentPosition(),ne=null,se=null;j=j||window.event,j.touches!==void 0?(this._pointerPositions=[],this._changedPointerPositions=[],Array.prototype.forEach.call(j.touches,ve=>{this._pointerPositions.push({id:ve.identifier,x:(ve.clientX-Q.left)/Q.scaleX,y:(ve.clientY-Q.top)/Q.scaleY})}),Array.prototype.forEach.call(j.changedTouches||j.touches,ve=>{this._changedPointerPositions.push({id:ve.identifier,x:(ve.clientX-Q.left)/Q.scaleX,y:(ve.clientY-Q.top)/Q.scaleY})})):(ne=(j.clientX-Q.left)/Q.scaleX,se=(j.clientY-Q.top)/Q.scaleY,this.pointerPos={x:ne,y:se},this._pointerPositions=[{x:ne,y:se,id:t.Util._getFirstPointerId(j)}],this._changedPointerPositions=[{x:ne,y:se,id:t.Util._getFirstPointerId(j)}])}_setPointerPosition(j){t.Util.warn('Method _setPointerPosition is deprecated. Use "stage.setPointersPositions(event)" instead.'),this.setPointersPositions(j)}_getContentPosition(){if(!this.content||!this.content.getBoundingClientRect)return{top:0,left:0,scaleX:1,scaleY:1};var j=this.content.getBoundingClientRect();return{top:j.top,left:j.left,scaleX:j.width/this.content.clientWidth||1,scaleY:j.height/this.content.clientHeight||1}}_buildDOM(){if(this.bufferCanvas=new o.SceneCanvas({width:this.width(),height:this.height()}),this.bufferHitCanvas=new o.HitCanvas({pixelRatio:1,width:this.width(),height:this.height()}),!!i.Konva.isBrowser){var j=this.container();if(!j)throw"Stage has no container. A container is required.";j.innerHTML="",this.content=document.createElement("div"),this.content.style.position="relative",this.content.style.userSelect="none",this.content.className="konvajs-content",this.content.setAttribute("role","presentation"),j.appendChild(this.content),this._resizeDOM()}}cache(){return t.Util.warn("Cache function is not allowed for stage. You may use cache only for layers, groups and shapes."),this}clearCache(){return this}batchDraw(){return this.getChildren().forEach(function(j){j.batchDraw()}),this}}e.Stage=ee,ee.prototype.nodeType=u,(0,s._registerNode)(ee),n.Factory.addGetterSetter(ee,"container")})(xG);var Cy={},Yr={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.Shape=e.shapes=void 0;const t=Rt,n=dr,r=At,i=rr,o=Xe,a=Rt,s=Go;var l="hasShadow",u="shadowRGBA",c="patternImage",d="linearGradient",f="radialGradient";let h;function p(){return h||(h=n.Util.createCanvasElement().getContext("2d"),h)}e.shapes={};function m(k){const T=this.attrs.fillRule;T?k.fill(T):k.fill()}function _(k){k.stroke()}function b(k){k.fill()}function v(k){k.stroke()}function g(){this._clearCache(l)}function y(){this._clearCache(u)}function S(){this._clearCache(c)}function w(){this._clearCache(d)}function x(){this._clearCache(f)}class C extends i.Node{constructor(T){super(T);let P;for(;P=n.Util.getRandomColor(),!(P&&!(P in e.shapes)););this.colorKey=P,e.shapes[P]=this}getContext(){return n.Util.warn("shape.getContext() method is deprecated. Please do not use it."),this.getLayer().getContext()}getCanvas(){return n.Util.warn("shape.getCanvas() method is deprecated. Please do not use it."),this.getLayer().getCanvas()}getSceneFunc(){return this.attrs.sceneFunc||this._sceneFunc}getHitFunc(){return this.attrs.hitFunc||this._hitFunc}hasShadow(){return this._getCache(l,this._hasShadow)}_hasShadow(){return this.shadowEnabled()&&this.shadowOpacity()!==0&&!!(this.shadowColor()||this.shadowBlur()||this.shadowOffsetX()||this.shadowOffsetY())}_getFillPattern(){return this._getCache(c,this.__getFillPattern)}__getFillPattern(){if(this.fillPatternImage()){var T=p();const P=T.createPattern(this.fillPatternImage(),this.fillPatternRepeat()||"repeat");if(P&&P.setTransform){const $=new n.Transform;$.translate(this.fillPatternX(),this.fillPatternY()),$.rotate(t.Konva.getAngle(this.fillPatternRotation())),$.scale(this.fillPatternScaleX(),this.fillPatternScaleY()),$.translate(-1*this.fillPatternOffsetX(),-1*this.fillPatternOffsetY());const O=$.getMatrix(),E=typeof DOMMatrix>"u"?{a:O[0],b:O[1],c:O[2],d:O[3],e:O[4],f:O[5]}:new DOMMatrix(O);P.setTransform(E)}return P}}_getLinearGradient(){return this._getCache(d,this.__getLinearGradient)}__getLinearGradient(){var T=this.fillLinearGradientColorStops();if(T){for(var P=p(),$=this.fillLinearGradientStartPoint(),O=this.fillLinearGradientEndPoint(),E=P.createLinearGradient($.x,$.y,O.x,O.y),A=0;Athis.fillEnabled()&&!!(this.fill()||this.fillPatternImage()||this.fillLinearGradientColorStops()||this.fillRadialGradientColorStops()))}hasStroke(){return this._calculate("hasStroke",["strokeEnabled","strokeWidth","stroke","strokeLinearGradientColorStops"],()=>this.strokeEnabled()&&this.strokeWidth()&&!!(this.stroke()||this.strokeLinearGradientColorStops()))}hasHitStroke(){const T=this.hitStrokeWidth();return T==="auto"?this.hasStroke():this.strokeEnabled()&&!!T}intersects(T){var P=this.getStage(),$=P.bufferHitCanvas,O;return $.getContext().clear(),this.drawHit($,null,!0),O=$.context.getImageData(Math.round(T.x),Math.round(T.y),1,1).data,O[3]>0}destroy(){return i.Node.prototype.destroy.call(this),delete e.shapes[this.colorKey],delete this.colorKey,this}_useBufferCanvas(T){var P;if(!this.getStage()||!((P=this.attrs.perfectDrawEnabled)!==null&&P!==void 0?P:!0))return!1;const O=T||this.hasFill(),E=this.hasStroke(),A=this.getAbsoluteOpacity()!==1;if(O&&E&&A)return!0;const D=this.hasShadow(),L=this.shadowForStrokeEnabled();return!!(O&&E&&D&&L)}setStrokeHitEnabled(T){n.Util.warn("strokeHitEnabled property is deprecated. Please use hitStrokeWidth instead."),T?this.hitStrokeWidth("auto"):this.hitStrokeWidth(0)}getStrokeHitEnabled(){return this.hitStrokeWidth()!==0}getSelfRect(){var T=this.size();return{x:this._centroid?-T.width/2:0,y:this._centroid?-T.height/2:0,width:T.width,height:T.height}}getClientRect(T={}){const P=T.skipTransform,$=T.relativeTo,O=this.getSelfRect(),A=!T.skipStroke&&this.hasStroke()&&this.strokeWidth()||0,D=O.width+A,L=O.height+A,M=!T.skipShadow&&this.hasShadow(),R=M?this.shadowOffsetX():0,N=M?this.shadowOffsetY():0,B=D+Math.abs(R),U=L+Math.abs(N),G=M&&this.shadowBlur()||0,Y=B+G*2,ee=U+G*2,J={width:Y,height:ee,x:-(A/2+G)+Math.min(R,0)+O.x,y:-(A/2+G)+Math.min(N,0)+O.y};return P?J:this._transformedRect(J,$)}drawScene(T,P){var $=this.getLayer(),O=T||$.getCanvas(),E=O.getContext(),A=this._getCanvasCache(),D=this.getSceneFunc(),L=this.hasShadow(),M,R,N,B=O.isCache,U=P===this;if(!this.isVisible()&&!U)return this;if(A){E.save();var G=this.getAbsoluteTransform(P).getMatrix();return E.transform(G[0],G[1],G[2],G[3],G[4],G[5]),this._drawCachedSceneCanvas(E),E.restore(),this}if(!D)return this;if(E.save(),this._useBufferCanvas()&&!B){M=this.getStage(),R=M.bufferCanvas,N=R.getContext(),N.clear(),N.save(),N._applyLineJoin(this);var Y=this.getAbsoluteTransform(P).getMatrix();N.transform(Y[0],Y[1],Y[2],Y[3],Y[4],Y[5]),D.call(this,N,this),N.restore();var ee=R.pixelRatio;L&&E._applyShadow(this),E._applyOpacity(this),E._applyGlobalCompositeOperation(this),E.drawImage(R._canvas,0,0,R.width/ee,R.height/ee)}else{if(E._applyLineJoin(this),!U){var Y=this.getAbsoluteTransform(P).getMatrix();E.transform(Y[0],Y[1],Y[2],Y[3],Y[4],Y[5]),E._applyOpacity(this),E._applyGlobalCompositeOperation(this)}L&&E._applyShadow(this),D.call(this,E,this)}return E.restore(),this}drawHit(T,P,$=!1){if(!this.shouldDrawHit(P,$))return this;var O=this.getLayer(),E=T||O.hitCanvas,A=E&&E.getContext(),D=this.hitFunc()||this.sceneFunc(),L=this._getCanvasCache(),M=L&&L.hit;if(this.colorKey||n.Util.warn("Looks like your canvas has a destroyed shape in it. Do not reuse shape after you destroyed it. If you want to reuse shape you should call remove() instead of destroy()"),M){A.save();var R=this.getAbsoluteTransform(P).getMatrix();return A.transform(R[0],R[1],R[2],R[3],R[4],R[5]),this._drawCachedHitCanvas(A),A.restore(),this}if(!D)return this;if(A.save(),A._applyLineJoin(this),!(this===P)){var B=this.getAbsoluteTransform(P).getMatrix();A.transform(B[0],B[1],B[2],B[3],B[4],B[5])}return D.call(this,A,this),A.restore(),this}drawHitFromCache(T=0){var P=this._getCanvasCache(),$=this._getCachedSceneCanvas(),O=P.hit,E=O.getContext(),A=O.getWidth(),D=O.getHeight(),L,M,R,N,B,U;E.clear(),E.drawImage($._canvas,0,0,A,D);try{for(L=E.getImageData(0,0,A,D),M=L.data,R=M.length,N=n.Util._hexToRgb(this.colorKey),B=0;BT?(M[B]=N.r,M[B+1]=N.g,M[B+2]=N.b,M[B+3]=255):M[B+3]=0;E.putImageData(L,0,0)}catch(G){n.Util.error("Unable to draw hit graph from cached scene canvas. "+G.message)}return this}hasPointerCapture(T){return s.hasPointerCapture(T,this)}setPointerCapture(T){s.setPointerCapture(T,this)}releaseCapture(T){s.releaseCapture(T,this)}}e.Shape=C,C.prototype._fillFunc=m,C.prototype._strokeFunc=_,C.prototype._fillFuncHit=b,C.prototype._strokeFuncHit=v,C.prototype._centroid=!1,C.prototype.nodeType="Shape",(0,a._registerNode)(C),C.prototype.eventListeners={},C.prototype.on.call(C.prototype,"shadowColorChange.konva shadowBlurChange.konva shadowOffsetChange.konva shadowOpacityChange.konva shadowEnabledChange.konva",g),C.prototype.on.call(C.prototype,"shadowColorChange.konva shadowOpacityChange.konva shadowEnabledChange.konva",y),C.prototype.on.call(C.prototype,"fillPriorityChange.konva fillPatternImageChange.konva fillPatternRepeatChange.konva fillPatternScaleXChange.konva fillPatternScaleYChange.konva fillPatternOffsetXChange.konva fillPatternOffsetYChange.konva fillPatternXChange.konva fillPatternYChange.konva fillPatternRotationChange.konva",S),C.prototype.on.call(C.prototype,"fillPriorityChange.konva fillLinearGradientColorStopsChange.konva fillLinearGradientStartPointXChange.konva fillLinearGradientStartPointYChange.konva fillLinearGradientEndPointXChange.konva fillLinearGradientEndPointYChange.konva",w),C.prototype.on.call(C.prototype,"fillPriorityChange.konva fillRadialGradientColorStopsChange.konva fillRadialGradientStartPointXChange.konva fillRadialGradientStartPointYChange.konva fillRadialGradientEndPointXChange.konva fillRadialGradientEndPointYChange.konva fillRadialGradientStartRadiusChange.konva fillRadialGradientEndRadiusChange.konva",x),r.Factory.addGetterSetter(C,"stroke",void 0,(0,o.getStringOrGradientValidator)()),r.Factory.addGetterSetter(C,"strokeWidth",2,(0,o.getNumberValidator)()),r.Factory.addGetterSetter(C,"fillAfterStrokeEnabled",!1),r.Factory.addGetterSetter(C,"hitStrokeWidth","auto",(0,o.getNumberOrAutoValidator)()),r.Factory.addGetterSetter(C,"strokeHitEnabled",!0,(0,o.getBooleanValidator)()),r.Factory.addGetterSetter(C,"perfectDrawEnabled",!0,(0,o.getBooleanValidator)()),r.Factory.addGetterSetter(C,"shadowForStrokeEnabled",!0,(0,o.getBooleanValidator)()),r.Factory.addGetterSetter(C,"lineJoin"),r.Factory.addGetterSetter(C,"lineCap"),r.Factory.addGetterSetter(C,"sceneFunc"),r.Factory.addGetterSetter(C,"hitFunc"),r.Factory.addGetterSetter(C,"dash"),r.Factory.addGetterSetter(C,"dashOffset",0,(0,o.getNumberValidator)()),r.Factory.addGetterSetter(C,"shadowColor",void 0,(0,o.getStringValidator)()),r.Factory.addGetterSetter(C,"shadowBlur",0,(0,o.getNumberValidator)()),r.Factory.addGetterSetter(C,"shadowOpacity",1,(0,o.getNumberValidator)()),r.Factory.addComponentsGetterSetter(C,"shadowOffset",["x","y"]),r.Factory.addGetterSetter(C,"shadowOffsetX",0,(0,o.getNumberValidator)()),r.Factory.addGetterSetter(C,"shadowOffsetY",0,(0,o.getNumberValidator)()),r.Factory.addGetterSetter(C,"fillPatternImage"),r.Factory.addGetterSetter(C,"fill",void 0,(0,o.getStringOrGradientValidator)()),r.Factory.addGetterSetter(C,"fillPatternX",0,(0,o.getNumberValidator)()),r.Factory.addGetterSetter(C,"fillPatternY",0,(0,o.getNumberValidator)()),r.Factory.addGetterSetter(C,"fillLinearGradientColorStops"),r.Factory.addGetterSetter(C,"strokeLinearGradientColorStops"),r.Factory.addGetterSetter(C,"fillRadialGradientStartRadius",0),r.Factory.addGetterSetter(C,"fillRadialGradientEndRadius",0),r.Factory.addGetterSetter(C,"fillRadialGradientColorStops"),r.Factory.addGetterSetter(C,"fillPatternRepeat","repeat"),r.Factory.addGetterSetter(C,"fillEnabled",!0),r.Factory.addGetterSetter(C,"strokeEnabled",!0),r.Factory.addGetterSetter(C,"shadowEnabled",!0),r.Factory.addGetterSetter(C,"dashEnabled",!0),r.Factory.addGetterSetter(C,"strokeScaleEnabled",!0),r.Factory.addGetterSetter(C,"fillPriority","color"),r.Factory.addComponentsGetterSetter(C,"fillPatternOffset",["x","y"]),r.Factory.addGetterSetter(C,"fillPatternOffsetX",0,(0,o.getNumberValidator)()),r.Factory.addGetterSetter(C,"fillPatternOffsetY",0,(0,o.getNumberValidator)()),r.Factory.addComponentsGetterSetter(C,"fillPatternScale",["x","y"]),r.Factory.addGetterSetter(C,"fillPatternScaleX",1,(0,o.getNumberValidator)()),r.Factory.addGetterSetter(C,"fillPatternScaleY",1,(0,o.getNumberValidator)()),r.Factory.addComponentsGetterSetter(C,"fillLinearGradientStartPoint",["x","y"]),r.Factory.addComponentsGetterSetter(C,"strokeLinearGradientStartPoint",["x","y"]),r.Factory.addGetterSetter(C,"fillLinearGradientStartPointX",0),r.Factory.addGetterSetter(C,"strokeLinearGradientStartPointX",0),r.Factory.addGetterSetter(C,"fillLinearGradientStartPointY",0),r.Factory.addGetterSetter(C,"strokeLinearGradientStartPointY",0),r.Factory.addComponentsGetterSetter(C,"fillLinearGradientEndPoint",["x","y"]),r.Factory.addComponentsGetterSetter(C,"strokeLinearGradientEndPoint",["x","y"]),r.Factory.addGetterSetter(C,"fillLinearGradientEndPointX",0),r.Factory.addGetterSetter(C,"strokeLinearGradientEndPointX",0),r.Factory.addGetterSetter(C,"fillLinearGradientEndPointY",0),r.Factory.addGetterSetter(C,"strokeLinearGradientEndPointY",0),r.Factory.addComponentsGetterSetter(C,"fillRadialGradientStartPoint",["x","y"]),r.Factory.addGetterSetter(C,"fillRadialGradientStartPointX",0),r.Factory.addGetterSetter(C,"fillRadialGradientStartPointY",0),r.Factory.addComponentsGetterSetter(C,"fillRadialGradientEndPoint",["x","y"]),r.Factory.addGetterSetter(C,"fillRadialGradientEndPointX",0),r.Factory.addGetterSetter(C,"fillRadialGradientEndPointY",0),r.Factory.addGetterSetter(C,"fillPatternRotation",0),r.Factory.addGetterSetter(C,"fillRule",void 0,(0,o.getStringValidator)()),r.Factory.backCompat(C,{dashArray:"dash",getDashArray:"getDash",setDashArray:"getDash",drawFunc:"sceneFunc",getDrawFunc:"getSceneFunc",setDrawFunc:"setSceneFunc",drawHitFunc:"hitFunc",getDrawHitFunc:"getHitFunc",setDrawHitFunc:"setHitFunc"})})(Yr);Object.defineProperty(Cy,"__esModule",{value:!0});Cy.Layer=void 0;const dl=dr,KC=Gd,mf=rr,_A=At,cO=is,Nwe=Xe,$we=Yr,Dwe=Rt;var Lwe="#",Fwe="beforeDraw",Bwe="draw",EG=[{x:0,y:0},{x:-1,y:-1},{x:1,y:-1},{x:1,y:1},{x:-1,y:1}],zwe=EG.length;class xp extends KC.Container{constructor(t){super(t),this.canvas=new cO.SceneCanvas,this.hitCanvas=new cO.HitCanvas({pixelRatio:1}),this._waitingForDraw=!1,this.on("visibleChange.konva",this._checkVisibility),this._checkVisibility(),this.on("imageSmoothingEnabledChange.konva",this._setSmoothEnabled),this._setSmoothEnabled()}createPNGStream(){return this.canvas._canvas.createPNGStream()}getCanvas(){return this.canvas}getNativeCanvasElement(){return this.canvas._canvas}getHitCanvas(){return this.hitCanvas}getContext(){return this.getCanvas().getContext()}clear(t){return this.getContext().clear(t),this.getHitCanvas().getContext().clear(t),this}setZIndex(t){super.setZIndex(t);var n=this.getStage();return n&&n.content&&(n.content.removeChild(this.getNativeCanvasElement()),t{this.draw(),this._waitingForDraw=!1})),this}getIntersection(t){if(!this.isListening()||!this.isVisible())return null;for(var n=1,r=!1;;){for(let i=0;i0)return{antialiased:!0};return{}}drawScene(t,n){var r=this.getLayer(),i=t||r&&r.getCanvas();return this._fire(Fwe,{node:this}),this.clearBeforeDraw()&&i.getContext().clear(),KC.Container.prototype.drawScene.call(this,i,n),this._fire(Bwe,{node:this}),this}drawHit(t,n){var r=this.getLayer(),i=t||r&&r.hitCanvas;return r&&r.clearBeforeDraw()&&r.getHitCanvas().getContext().clear(),KC.Container.prototype.drawHit.call(this,i,n),this}enableHitGraph(){return this.hitGraphEnabled(!0),this}disableHitGraph(){return this.hitGraphEnabled(!1),this}setHitGraphEnabled(t){dl.Util.warn("hitGraphEnabled method is deprecated. Please use layer.listening() instead."),this.listening(t)}getHitGraphEnabled(t){return dl.Util.warn("hitGraphEnabled method is deprecated. Please use layer.listening() instead."),this.listening()}toggleHitCanvas(){if(!(!this.parent||!this.parent.content)){var t=this.parent,n=!!this.hitCanvas._canvas.parentNode;n?t.content.removeChild(this.hitCanvas._canvas):t.content.appendChild(this.hitCanvas._canvas)}}destroy(){return dl.Util.releaseCanvas(this.getNativeCanvasElement(),this.getHitCanvas()._canvas),super.destroy()}}Cy.Layer=xp;xp.prototype.nodeType="Layer";(0,Dwe._registerNode)(xp);_A.Factory.addGetterSetter(xp,"imageSmoothingEnabled",!0);_A.Factory.addGetterSetter(xp,"clearBeforeDraw",!0);_A.Factory.addGetterSetter(xp,"hitGraphEnabled",!0,(0,Nwe.getBooleanValidator)());var sx={};Object.defineProperty(sx,"__esModule",{value:!0});sx.FastLayer=void 0;const jwe=dr,Uwe=Cy,Vwe=Rt;class SA extends Uwe.Layer{constructor(t){super(t),this.listening(!1),jwe.Util.warn('Konva.Fast layer is deprecated. Please use "new Konva.Layer({ listening: false })" instead.')}}sx.FastLayer=SA;SA.prototype.nodeType="FastLayer";(0,Vwe._registerNode)(SA);var wp={};Object.defineProperty(wp,"__esModule",{value:!0});wp.Group=void 0;const Gwe=dr,qwe=Gd,Hwe=Rt;class xA extends qwe.Container{_validateAdd(t){var n=t.getType();n!=="Group"&&n!=="Shape"&&Gwe.Util.throw("You may only add groups and shapes to groups.")}}wp.Group=xA;xA.prototype.nodeType="Group";(0,Hwe._registerNode)(xA);var Cp={};Object.defineProperty(Cp,"__esModule",{value:!0});Cp.Animation=void 0;const QC=Rt,dO=dr;var XC=function(){return QC.glob.performance&&QC.glob.performance.now?function(){return QC.glob.performance.now()}:function(){return new Date().getTime()}}();class Rs{constructor(t,n){this.id=Rs.animIdCounter++,this.frame={time:0,timeDiff:0,lastTime:XC(),frameRate:0},this.func=t,this.setLayers(n)}setLayers(t){var n=[];return t?t.length>0?n=t:n=[t]:n=[],this.layers=n,this}getLayers(){return this.layers}addLayer(t){var n=this.layers,r=n.length,i;for(i=0;ithis.duration?this.yoyo?(this._time=this.duration,this.reverse()):this.finish():p<0?this.yoyo?(this._time=0,this.play()):this.reset():(this._time=p,this.update())}getTime(){return this._time}setPosition(p){this.prevPos=this._pos,this.propFunc(p),this._pos=p}getPosition(p){return p===void 0&&(p=this._time),this.func(p,this.begin,this._change,this.duration)}play(){this.state=s,this._startTime=this.getTimer()-this._time,this.onEnterFrame(),this.fire("onPlay")}reverse(){this.state=l,this._time=this.duration-this._time,this._startTime=this.getTimer()-this._time,this.onEnterFrame(),this.fire("onReverse")}seek(p){this.pause(),this._time=p,this.update(),this.fire("onSeek")}reset(){this.pause(),this._time=0,this.update(),this.fire("onReset")}finish(){this.pause(),this._time=this.duration,this.update(),this.fire("onFinish")}update(){this.setPosition(this.getPosition(this._time)),this.fire("onUpdate")}onEnterFrame(){var p=this.getTimer()-this._startTime;this.state===s?this.setTime(p):this.state===l&&this.setTime(this.duration-p)}pause(){this.state=a,this.fire("onPause")}getTimer(){return new Date().getTime()}}class f{constructor(p){var m=this,_=p.node,b=_._id,v,g=p.easing||e.Easings.Linear,y=!!p.yoyo,S;typeof p.duration>"u"?v=.3:p.duration===0?v=.001:v=p.duration,this.node=_,this._id=u++;var w=_.getLayer()||(_ instanceof i.Konva.Stage?_.getLayers():null);w||t.Util.error("Tween constructor have `node` that is not in a layer. Please add node into layer first."),this.anim=new n.Animation(function(){m.tween.onEnterFrame()},w),this.tween=new d(S,function(x){m._tweenFunc(x)},g,0,1,v*1e3,y),this._addListeners(),f.attrs[b]||(f.attrs[b]={}),f.attrs[b][this._id]||(f.attrs[b][this._id]={}),f.tweens[b]||(f.tweens[b]={});for(S in p)o[S]===void 0&&this._addAttr(S,p[S]);this.reset(),this.onFinish=p.onFinish,this.onReset=p.onReset,this.onUpdate=p.onUpdate}_addAttr(p,m){var _=this.node,b=_._id,v,g,y,S,w,x,C,k;if(y=f.tweens[b][p],y&&delete f.attrs[b][y][p],v=_.getAttr(p),t.Util._isArray(m))if(g=[],w=Math.max(m.length,v.length),p==="points"&&m.length!==v.length&&(m.length>v.length?(C=v,v=t.Util._prepareArrayForTween(v,m,_.closed())):(x=m,m=t.Util._prepareArrayForTween(m,v,_.closed()))),p.indexOf("fill")===0)for(S=0;S{this.anim.start()},this.tween.onReverse=()=>{this.anim.start()},this.tween.onPause=()=>{this.anim.stop()},this.tween.onFinish=()=>{var p=this.node,m=f.attrs[p._id][this._id];m.points&&m.points.trueEnd&&p.setAttr("points",m.points.trueEnd),this.onFinish&&this.onFinish.call(this)},this.tween.onReset=()=>{var p=this.node,m=f.attrs[p._id][this._id];m.points&&m.points.trueStart&&p.points(m.points.trueStart),this.onReset&&this.onReset()},this.tween.onUpdate=()=>{this.onUpdate&&this.onUpdate.call(this)}}play(){return this.tween.play(),this}reverse(){return this.tween.reverse(),this}reset(){return this.tween.reset(),this}seek(p){return this.tween.seek(p*1e3),this}pause(){return this.tween.pause(),this}finish(){return this.tween.finish(),this}destroy(){var p=this.node._id,m=this._id,_=f.tweens[p],b;this.pause();for(b in _)delete f.tweens[p][b];delete f.attrs[p][m]}}e.Tween=f,f.attrs={},f.tweens={},r.Node.prototype.to=function(h){var p=h.onFinish;h.node=this,h.onFinish=function(){this.destroy(),p&&p()};var m=new f(h);m.play()},e.Easings={BackEaseIn(h,p,m,_){var b=1.70158;return m*(h/=_)*h*((b+1)*h-b)+p},BackEaseOut(h,p,m,_){var b=1.70158;return m*((h=h/_-1)*h*((b+1)*h+b)+1)+p},BackEaseInOut(h,p,m,_){var b=1.70158;return(h/=_/2)<1?m/2*(h*h*(((b*=1.525)+1)*h-b))+p:m/2*((h-=2)*h*(((b*=1.525)+1)*h+b)+2)+p},ElasticEaseIn(h,p,m,_,b,v){var g=0;return h===0?p:(h/=_)===1?p+m:(v||(v=_*.3),!b||b0?t:n),c=a*n,d=s*(s>0?t:n),f=l*(l>0?n:t);return{x:u,y:r?-1*f:d,width:c-u,height:f-d}}}lx.Arc=nu;nu.prototype._centroid=!0;nu.prototype.className="Arc";nu.prototype._attrsAffectingSize=["innerRadius","outerRadius"];(0,Kwe._registerNode)(nu);ux.Factory.addGetterSetter(nu,"innerRadius",0,(0,cx.getNumberValidator)());ux.Factory.addGetterSetter(nu,"outerRadius",0,(0,cx.getNumberValidator)());ux.Factory.addGetterSetter(nu,"angle",0,(0,cx.getNumberValidator)());ux.Factory.addGetterSetter(nu,"clockwise",!1,(0,cx.getBooleanValidator)());var dx={},Ey={};Object.defineProperty(Ey,"__esModule",{value:!0});Ey.Line=void 0;const fx=At,Qwe=Yr,kG=Xe,Xwe=Rt;function KE(e,t,n,r,i,o,a){var s=Math.sqrt(Math.pow(n-e,2)+Math.pow(r-t,2)),l=Math.sqrt(Math.pow(i-n,2)+Math.pow(o-r,2)),u=a*s/(s+l),c=a*l/(s+l),d=n-u*(i-e),f=r-u*(o-t),h=n+c*(i-e),p=r+c*(o-t);return[d,f,h,p]}function hO(e,t){var n=e.length,r=[],i,o;for(i=2;i4){for(s=this.getTensionPoints(),l=s.length,u=o?0:4,o||t.quadraticCurveTo(s[0],s[1],s[2],s[3]);u{let u,c,d;u=l/2,c=0;for(let h=0;h<20;h++)d=u*e.tValues[20][h]+u,c+=e.cValues[20][h]*r(a,s,d);return u*c};e.getCubicArcLength=t;const n=(a,s,l)=>{l===void 0&&(l=1);const u=a[0]-2*a[1]+a[2],c=s[0]-2*s[1]+s[2],d=2*a[1]-2*a[0],f=2*s[1]-2*s[0],h=4*(u*u+c*c),p=4*(u*d+c*f),m=d*d+f*f;if(h===0)return l*Math.sqrt(Math.pow(a[2]-a[0],2)+Math.pow(s[2]-s[0],2));const _=p/(2*h),b=m/h,v=l+_,g=b-_*_,y=v*v+g>0?Math.sqrt(v*v+g):0,S=_*_+g>0?Math.sqrt(_*_+g):0,w=_+Math.sqrt(_*_+g)!==0?g*Math.log(Math.abs((v+y)/(_+S))):0;return Math.sqrt(h)/2*(v*y-_*S+w)};e.getQuadraticArcLength=n;function r(a,s,l){const u=i(1,l,a),c=i(1,l,s),d=u*u+c*c;return Math.sqrt(d)}const i=(a,s,l)=>{const u=l.length-1;let c,d;if(u===0)return 0;if(a===0){d=0;for(let f=0;f<=u;f++)d+=e.binomialCoefficients[u][f]*Math.pow(1-s,u-f)*Math.pow(s,f)*l[f];return d}else{c=new Array(u);for(let f=0;f{let u=1,c=a/s,d=(a-l(c))/s,f=0;for(;u>.001;){const h=l(c+d),p=Math.abs(a-h)/s;if(p500)break}return c};e.t2length=o})(AG);Object.defineProperty(Ep,"__esModule",{value:!0});Ep.Path=void 0;const Ywe=At,Zwe=Yr,Jwe=Rt,yf=AG;class Vr extends Zwe.Shape{constructor(t){super(t),this.dataArray=[],this.pathLength=0,this._readDataAttribute(),this.on("dataChange.konva",function(){this._readDataAttribute()})}_readDataAttribute(){this.dataArray=Vr.parsePathData(this.data()),this.pathLength=Vr.getPathLength(this.dataArray)}_sceneFunc(t){var n=this.dataArray;t.beginPath();for(var r=!1,i=0;ic?u:c,_=u>c?1:u/c,b=u>c?c/u:1;t.translate(s,l),t.rotate(h),t.scale(_,b),t.arc(0,0,m,d,d+f,1-p),t.scale(1/_,1/b),t.rotate(-h),t.translate(-s,-l);break;case"z":r=!0,t.closePath();break}}!r&&!this.hasFill()?t.strokeShape(this):t.fillStrokeShape(this)}getSelfRect(){var t=[];this.dataArray.forEach(function(u){if(u.command==="A"){var c=u.points[4],d=u.points[5],f=u.points[4]+d,h=Math.PI/180;if(Math.abs(c-f)f;p-=h){const m=Vr.getPointOnEllipticalArc(u.points[0],u.points[1],u.points[2],u.points[3],p,0);t.push(m.x,m.y)}else for(let p=c+h;pn[i].pathLength;)t-=n[i].pathLength,++i;if(i===o)return r=n[i-1].points.slice(-2),{x:r[0],y:r[1]};if(t<.01)return r=n[i].points.slice(0,2),{x:r[0],y:r[1]};var a=n[i],s=a.points;switch(a.command){case"L":return Vr.getPointOnLine(t,a.start.x,a.start.y,s[0],s[1]);case"C":return Vr.getPointOnCubicBezier((0,yf.t2length)(t,Vr.getPathLength(n),m=>(0,yf.getCubicArcLength)([a.start.x,s[0],s[2],s[4]],[a.start.y,s[1],s[3],s[5]],m)),a.start.x,a.start.y,s[0],s[1],s[2],s[3],s[4],s[5]);case"Q":return Vr.getPointOnQuadraticBezier((0,yf.t2length)(t,Vr.getPathLength(n),m=>(0,yf.getQuadraticArcLength)([a.start.x,s[0],s[2]],[a.start.y,s[1],s[3]],m)),a.start.x,a.start.y,s[0],s[1],s[2],s[3]);case"A":var l=s[0],u=s[1],c=s[2],d=s[3],f=s[4],h=s[5],p=s[6];return f+=h*t/a.pathLength,Vr.getPointOnEllipticalArc(l,u,c,d,f,p)}return null}static getPointOnLine(t,n,r,i,o,a,s){a===void 0&&(a=n),s===void 0&&(s=r);var l=(o-r)/(i-n+1e-8),u=Math.sqrt(t*t/(1+l*l));i0&&!isNaN(p[0]);){var v=null,g=[],y=l,S=u,w,x,C,k,T,P,$,O,E,A;switch(h){case"l":l+=p.shift(),u+=p.shift(),v="L",g.push(l,u);break;case"L":l=p.shift(),u=p.shift(),g.push(l,u);break;case"m":var D=p.shift(),L=p.shift();if(l+=D,u+=L,v="M",a.length>2&&a[a.length-1].command==="z"){for(var M=a.length-2;M>=0;M--)if(a[M].command==="M"){l=a[M].points[0]+D,u=a[M].points[1]+L;break}}g.push(l,u),h="l";break;case"M":l=p.shift(),u=p.shift(),v="M",g.push(l,u),h="L";break;case"h":l+=p.shift(),v="L",g.push(l,u);break;case"H":l=p.shift(),v="L",g.push(l,u);break;case"v":u+=p.shift(),v="L",g.push(l,u);break;case"V":u=p.shift(),v="L",g.push(l,u);break;case"C":g.push(p.shift(),p.shift(),p.shift(),p.shift()),l=p.shift(),u=p.shift(),g.push(l,u);break;case"c":g.push(l+p.shift(),u+p.shift(),l+p.shift(),u+p.shift()),l+=p.shift(),u+=p.shift(),v="C",g.push(l,u);break;case"S":x=l,C=u,w=a[a.length-1],w.command==="C"&&(x=l+(l-w.points[2]),C=u+(u-w.points[3])),g.push(x,C,p.shift(),p.shift()),l=p.shift(),u=p.shift(),v="C",g.push(l,u);break;case"s":x=l,C=u,w=a[a.length-1],w.command==="C"&&(x=l+(l-w.points[2]),C=u+(u-w.points[3])),g.push(x,C,l+p.shift(),u+p.shift()),l+=p.shift(),u+=p.shift(),v="C",g.push(l,u);break;case"Q":g.push(p.shift(),p.shift()),l=p.shift(),u=p.shift(),g.push(l,u);break;case"q":g.push(l+p.shift(),u+p.shift()),l+=p.shift(),u+=p.shift(),v="Q",g.push(l,u);break;case"T":x=l,C=u,w=a[a.length-1],w.command==="Q"&&(x=l+(l-w.points[0]),C=u+(u-w.points[1])),l=p.shift(),u=p.shift(),v="Q",g.push(x,C,l,u);break;case"t":x=l,C=u,w=a[a.length-1],w.command==="Q"&&(x=l+(l-w.points[0]),C=u+(u-w.points[1])),l+=p.shift(),u+=p.shift(),v="Q",g.push(x,C,l,u);break;case"A":k=p.shift(),T=p.shift(),P=p.shift(),$=p.shift(),O=p.shift(),E=l,A=u,l=p.shift(),u=p.shift(),v="A",g=this.convertEndpointToCenterParameterization(E,A,l,u,$,O,k,T,P);break;case"a":k=p.shift(),T=p.shift(),P=p.shift(),$=p.shift(),O=p.shift(),E=l,A=u,l+=p.shift(),u+=p.shift(),v="A",g=this.convertEndpointToCenterParameterization(E,A,l,u,$,O,k,T,P);break}a.push({command:v||h,points:g,start:{x:y,y:S},pathLength:this.calcLength(y,S,v||h,g)})}(h==="z"||h==="Z")&&a.push({command:"z",points:[],start:void 0,pathLength:0})}return a}static calcLength(t,n,r,i){var o,a,s,l,u=Vr;switch(r){case"L":return u.getLineLength(t,n,i[0],i[1]);case"C":return(0,yf.getCubicArcLength)([t,i[0],i[2],i[4]],[n,i[1],i[3],i[5]],1);case"Q":return(0,yf.getQuadraticArcLength)([t,i[0],i[2]],[n,i[1],i[3]],1);case"A":o=0;var c=i[4],d=i[5],f=i[4]+d,h=Math.PI/180;if(Math.abs(c-f)f;l-=h)s=u.getPointOnEllipticalArc(i[0],i[1],i[2],i[3],l,0),o+=u.getLineLength(a.x,a.y,s.x,s.y),a=s;else for(l=c+h;l1&&(s*=Math.sqrt(h),l*=Math.sqrt(h));var p=Math.sqrt((s*s*(l*l)-s*s*(f*f)-l*l*(d*d))/(s*s*(f*f)+l*l*(d*d)));o===a&&(p*=-1),isNaN(p)&&(p=0);var m=p*s*f/l,_=p*-l*d/s,b=(t+r)/2+Math.cos(c)*m-Math.sin(c)*_,v=(n+i)/2+Math.sin(c)*m+Math.cos(c)*_,g=function(T){return Math.sqrt(T[0]*T[0]+T[1]*T[1])},y=function(T,P){return(T[0]*P[0]+T[1]*P[1])/(g(T)*g(P))},S=function(T,P){return(T[0]*P[1]=1&&(k=0),a===0&&k>0&&(k=k-2*Math.PI),a===1&&k<0&&(k=k+2*Math.PI),[b,v,s,l,w,k,c,a]}}Ep.Path=Vr;Vr.prototype.className="Path";Vr.prototype._attrsAffectingSize=["data"];(0,Jwe._registerNode)(Vr);Ywe.Factory.addGetterSetter(Vr,"data");Object.defineProperty(dx,"__esModule",{value:!0});dx.Arrow=void 0;const hx=At,eCe=Ey,PG=Xe,tCe=Rt,pO=Ep;class Hd extends eCe.Line{_sceneFunc(t){super._sceneFunc(t);var n=Math.PI*2,r=this.points(),i=r,o=this.tension()!==0&&r.length>4;o&&(i=this.getTensionPoints());var a=this.pointerLength(),s=r.length,l,u;if(o){const f=[i[i.length-4],i[i.length-3],i[i.length-2],i[i.length-1],r[s-2],r[s-1]],h=pO.Path.calcLength(i[i.length-4],i[i.length-3],"C",f),p=pO.Path.getPointOnQuadraticBezier(Math.min(1,1-a/h),f[0],f[1],f[2],f[3],f[4],f[5]);l=r[s-2]-p.x,u=r[s-1]-p.y}else l=r[s-2]-r[s-4],u=r[s-1]-r[s-3];var c=(Math.atan2(u,l)+n)%n,d=this.pointerWidth();this.pointerAtEnding()&&(t.save(),t.beginPath(),t.translate(r[s-2],r[s-1]),t.rotate(c),t.moveTo(0,0),t.lineTo(-a,d/2),t.lineTo(-a,-d/2),t.closePath(),t.restore(),this.__fillStroke(t)),this.pointerAtBeginning()&&(t.save(),t.beginPath(),t.translate(r[0],r[1]),o?(l=(i[0]+i[2])/2-r[0],u=(i[1]+i[3])/2-r[1]):(l=r[2]-r[0],u=r[3]-r[1]),t.rotate((Math.atan2(-u,-l)+n)%n),t.moveTo(0,0),t.lineTo(-a,d/2),t.lineTo(-a,-d/2),t.closePath(),t.restore(),this.__fillStroke(t))}__fillStroke(t){var n=this.dashEnabled();n&&(this.attrs.dashEnabled=!1,t.setLineDash([])),t.fillStrokeShape(this),n&&(this.attrs.dashEnabled=!0)}getSelfRect(){const t=super.getSelfRect(),n=this.pointerWidth()/2;return{x:t.x-n,y:t.y-n,width:t.width+n*2,height:t.height+n*2}}}dx.Arrow=Hd;Hd.prototype.className="Arrow";(0,tCe._registerNode)(Hd);hx.Factory.addGetterSetter(Hd,"pointerLength",10,(0,PG.getNumberValidator)());hx.Factory.addGetterSetter(Hd,"pointerWidth",10,(0,PG.getNumberValidator)());hx.Factory.addGetterSetter(Hd,"pointerAtBeginning",!1);hx.Factory.addGetterSetter(Hd,"pointerAtEnding",!0);var px={};Object.defineProperty(px,"__esModule",{value:!0});px.Circle=void 0;const nCe=At,rCe=Yr,iCe=Xe,oCe=Rt;let Tp=class extends rCe.Shape{_sceneFunc(t){t.beginPath(),t.arc(0,0,this.attrs.radius||0,0,Math.PI*2,!1),t.closePath(),t.fillStrokeShape(this)}getWidth(){return this.radius()*2}getHeight(){return this.radius()*2}setWidth(t){this.radius()!==t/2&&this.radius(t/2)}setHeight(t){this.radius()!==t/2&&this.radius(t/2)}};px.Circle=Tp;Tp.prototype._centroid=!0;Tp.prototype.className="Circle";Tp.prototype._attrsAffectingSize=["radius"];(0,oCe._registerNode)(Tp);nCe.Factory.addGetterSetter(Tp,"radius",0,(0,iCe.getNumberValidator)());var gx={};Object.defineProperty(gx,"__esModule",{value:!0});gx.Ellipse=void 0;const wA=At,aCe=Yr,IG=Xe,sCe=Rt;class Tc extends aCe.Shape{_sceneFunc(t){var n=this.radiusX(),r=this.radiusY();t.beginPath(),t.save(),n!==r&&t.scale(1,r/n),t.arc(0,0,n,0,Math.PI*2,!1),t.restore(),t.closePath(),t.fillStrokeShape(this)}getWidth(){return this.radiusX()*2}getHeight(){return this.radiusY()*2}setWidth(t){this.radiusX(t/2)}setHeight(t){this.radiusY(t/2)}}gx.Ellipse=Tc;Tc.prototype.className="Ellipse";Tc.prototype._centroid=!0;Tc.prototype._attrsAffectingSize=["radiusX","radiusY"];(0,sCe._registerNode)(Tc);wA.Factory.addComponentsGetterSetter(Tc,"radius",["x","y"]);wA.Factory.addGetterSetter(Tc,"radiusX",0,(0,IG.getNumberValidator)());wA.Factory.addGetterSetter(Tc,"radiusY",0,(0,IG.getNumberValidator)());var mx={};Object.defineProperty(mx,"__esModule",{value:!0});mx.Image=void 0;const YC=dr,Wd=At,lCe=Yr,uCe=Rt,Ty=Xe;let rl=class RG extends lCe.Shape{constructor(t){super(t),this.on("imageChange.konva",()=>{this._setImageLoad()}),this._setImageLoad()}_setImageLoad(){const t=this.image();t&&t.complete||t&&t.readyState===4||t&&t.addEventListener&&t.addEventListener("load",()=>{this._requestDraw()})}_useBufferCanvas(){return super._useBufferCanvas(!0)}_sceneFunc(t){const n=this.getWidth(),r=this.getHeight(),i=this.cornerRadius(),o=this.attrs.image;let a;if(o){const s=this.attrs.cropWidth,l=this.attrs.cropHeight;s&&l?a=[o,this.cropX(),this.cropY(),s,l,0,0,n,r]:a=[o,0,0,n,r]}(this.hasFill()||this.hasStroke()||i)&&(t.beginPath(),i?YC.Util.drawRoundedRectPath(t,n,r,i):t.rect(0,0,n,r),t.closePath(),t.fillStrokeShape(this)),o&&(i&&t.clip(),t.drawImage.apply(t,a))}_hitFunc(t){var n=this.width(),r=this.height(),i=this.cornerRadius();t.beginPath(),i?YC.Util.drawRoundedRectPath(t,n,r,i):t.rect(0,0,n,r),t.closePath(),t.fillStrokeShape(this)}getWidth(){var t,n;return(t=this.attrs.width)!==null&&t!==void 0?t:(n=this.image())===null||n===void 0?void 0:n.width}getHeight(){var t,n;return(t=this.attrs.height)!==null&&t!==void 0?t:(n=this.image())===null||n===void 0?void 0:n.height}static fromURL(t,n,r=null){var i=YC.Util.createImageElement();i.onload=function(){var o=new RG({image:i});n(o)},i.onerror=r,i.crossOrigin="Anonymous",i.src=t}};mx.Image=rl;rl.prototype.className="Image";(0,uCe._registerNode)(rl);Wd.Factory.addGetterSetter(rl,"cornerRadius",0,(0,Ty.getNumberOrArrayOfNumbersValidator)(4));Wd.Factory.addGetterSetter(rl,"image");Wd.Factory.addComponentsGetterSetter(rl,"crop",["x","y","width","height"]);Wd.Factory.addGetterSetter(rl,"cropX",0,(0,Ty.getNumberValidator)());Wd.Factory.addGetterSetter(rl,"cropY",0,(0,Ty.getNumberValidator)());Wd.Factory.addGetterSetter(rl,"cropWidth",0,(0,Ty.getNumberValidator)());Wd.Factory.addGetterSetter(rl,"cropHeight",0,(0,Ty.getNumberValidator)());var rp={};Object.defineProperty(rp,"__esModule",{value:!0});rp.Tag=rp.Label=void 0;const yx=At,cCe=Yr,dCe=wp,CA=Xe,OG=Rt;var MG=["fontFamily","fontSize","fontStyle","padding","lineHeight","text","width","height","pointerDirection","pointerWidth","pointerHeight"],fCe="Change.konva",hCe="none",QE="up",XE="right",YE="down",ZE="left",pCe=MG.length;class EA extends dCe.Group{constructor(t){super(t),this.on("add.konva",function(n){this._addListeners(n.child),this._sync()})}getText(){return this.find("Text")[0]}getTag(){return this.find("Tag")[0]}_addListeners(t){var n=this,r,i=function(){n._sync()};for(r=0;r{n=Math.min(n,a.x),r=Math.max(r,a.x),i=Math.min(i,a.y),o=Math.max(o,a.y)}),{x:n,y:i,width:r-n,height:o-i}}getWidth(){return this.radius()*2}getHeight(){return this.radius()*2}setWidth(t){this.radius(t/2)}setHeight(t){this.radius(t/2)}}bx.RegularPolygon=Qd;Qd.prototype.className="RegularPolygon";Qd.prototype._centroid=!0;Qd.prototype._attrsAffectingSize=["radius"];(0,SCe._registerNode)(Qd);NG.Factory.addGetterSetter(Qd,"radius",0,(0,$G.getNumberValidator)());NG.Factory.addGetterSetter(Qd,"sides",0,(0,$G.getNumberValidator)());var _x={};Object.defineProperty(_x,"__esModule",{value:!0});_x.Ring=void 0;const DG=At,xCe=Yr,LG=Xe,wCe=Rt;var gO=Math.PI*2;class Xd extends xCe.Shape{_sceneFunc(t){t.beginPath(),t.arc(0,0,this.innerRadius(),0,gO,!1),t.moveTo(this.outerRadius(),0),t.arc(0,0,this.outerRadius(),gO,0,!0),t.closePath(),t.fillStrokeShape(this)}getWidth(){return this.outerRadius()*2}getHeight(){return this.outerRadius()*2}setWidth(t){this.outerRadius(t/2)}setHeight(t){this.outerRadius(t/2)}}_x.Ring=Xd;Xd.prototype.className="Ring";Xd.prototype._centroid=!0;Xd.prototype._attrsAffectingSize=["innerRadius","outerRadius"];(0,wCe._registerNode)(Xd);DG.Factory.addGetterSetter(Xd,"innerRadius",0,(0,LG.getNumberValidator)());DG.Factory.addGetterSetter(Xd,"outerRadius",0,(0,LG.getNumberValidator)());var Sx={};Object.defineProperty(Sx,"__esModule",{value:!0});Sx.Sprite=void 0;const Yd=At,CCe=Yr,ECe=Cp,FG=Xe,TCe=Rt;class il extends CCe.Shape{constructor(t){super(t),this._updated=!0,this.anim=new ECe.Animation(()=>{var n=this._updated;return this._updated=!1,n}),this.on("animationChange.konva",function(){this.frameIndex(0)}),this.on("frameIndexChange.konva",function(){this._updated=!0}),this.on("frameRateChange.konva",function(){this.anim.isRunning()&&(clearInterval(this.interval),this._setInterval())})}_sceneFunc(t){var n=this.animation(),r=this.frameIndex(),i=r*4,o=this.animations()[n],a=this.frameOffsets(),s=o[i+0],l=o[i+1],u=o[i+2],c=o[i+3],d=this.image();if((this.hasFill()||this.hasStroke())&&(t.beginPath(),t.rect(0,0,u,c),t.closePath(),t.fillStrokeShape(this)),d)if(a){var f=a[n],h=r*2;t.drawImage(d,s,l,u,c,f[h+0],f[h+1],u,c)}else t.drawImage(d,s,l,u,c,0,0,u,c)}_hitFunc(t){var n=this.animation(),r=this.frameIndex(),i=r*4,o=this.animations()[n],a=this.frameOffsets(),s=o[i+2],l=o[i+3];if(t.beginPath(),a){var u=a[n],c=r*2;t.rect(u[c+0],u[c+1],s,l)}else t.rect(0,0,s,l);t.closePath(),t.fillShape(this)}_useBufferCanvas(){return super._useBufferCanvas(!0)}_setInterval(){var t=this;this.interval=setInterval(function(){t._updateIndex()},1e3/this.frameRate())}start(){if(!this.isRunning()){var t=this.getLayer();this.anim.setLayers(t),this._setInterval(),this.anim.start()}}stop(){this.anim.stop(),clearInterval(this.interval)}isRunning(){return this.anim.isRunning()}_updateIndex(){var t=this.frameIndex(),n=this.animation(),r=this.animations(),i=r[n],o=i.length/4;t{t=t.trim();const n=t.indexOf(" ")>=0,r=t.indexOf('"')>=0||t.indexOf("'")>=0;return n&&!r&&(t=`"${t}"`),t}).join(", ")}var Uv;function JC(){return Uv||(Uv=JE.Util.createCanvasElement().getContext(MCe),Uv)}function GCe(e){e.fillText(this._partialText,this._partialTextX,this._partialTextY)}function qCe(e){e.setAttr("miterLimit",2),e.strokeText(this._partialText,this._partialTextX,this._partialTextY)}function HCe(e){return e=e||{},!e.fillLinearGradientColorStops&&!e.fillRadialGradientColorStops&&!e.fillPatternImage&&(e.fill=e.fill||"black"),e}let kr=class extends PCe.Shape{constructor(t){super(HCe(t)),this._partialTextX=0,this._partialTextY=0;for(var n=0;n1&&(b+=a)}}}_hitFunc(t){var n=this.getWidth(),r=this.getHeight();t.beginPath(),t.rect(0,0,n,r),t.closePath(),t.fillStrokeShape(this)}setText(t){var n=JE.Util._isString(t)?t:t==null?"":t+"";return this._setAttr(NCe,n),this}getWidth(){var t=this.attrs.width===vf||this.attrs.width===void 0;return t?this.getTextWidth()+this.padding()*2:this.attrs.width}getHeight(){var t=this.attrs.height===vf||this.attrs.height===void 0;return t?this.fontSize()*this.textArr.length*this.lineHeight()+this.padding()*2:this.attrs.height}getTextWidth(){return this.textWidth}getTextHeight(){return JE.Util.warn("text.getTextHeight() method is deprecated. Use text.height() - for full height and text.fontSize() - for one line height."),this.textHeight}measureSize(t){var n=JC(),r=this.fontSize(),i;return n.save(),n.font=this._getContextFont(),i=n.measureText(t),n.restore(),{width:i.width,height:r}}_getContextFont(){return this.fontStyle()+jv+this.fontVariant()+jv+(this.fontSize()+FCe)+VCe(this.fontFamily())}_addTextLine(t){this.align()===tg&&(t=t.trim());var r=this._getTextWidth(t);return this.textArr.push({text:t,width:r,lastInParagraph:!1})}_getTextWidth(t){var n=this.letterSpacing(),r=t.length;return JC().measureText(t).width+(r?n*(r-1):0)}_setTextData(){var t=this.text().split(` +`),n=+this.fontSize(),r=0,i=this.lineHeight()*n,o=this.attrs.width,a=this.attrs.height,s=o!==vf&&o!==void 0,l=a!==vf&&a!==void 0,u=this.padding(),c=o-u*2,d=a-u*2,f=0,h=this.wrap(),p=h!==vO,m=h!==jCe&&p,_=this.ellipsis();this.textArr=[],JC().font=this._getContextFont();for(var b=_?this._getTextWidth(ZC):0,v=0,g=t.length;vc)for(;y.length>0;){for(var w=0,x=y.length,C="",k=0;w>>1,P=y.slice(0,T+1),$=this._getTextWidth(P)+b;$<=c?(w=T+1,C=P,k=$):x=T}if(C){if(m){var O,E=y[C.length],A=E===jv||E===mO;A&&k<=c?O=C.length:O=Math.max(C.lastIndexOf(jv),C.lastIndexOf(mO))+1,O>0&&(w=O,C=C.slice(0,w),k=this._getTextWidth(C))}C=C.trimRight(),this._addTextLine(C),r=Math.max(r,k),f+=i;var D=this._shouldHandleEllipsis(f);if(D){this._tryToAddEllipsisToLastLine();break}if(y=y.slice(w),y=y.trimLeft(),y.length>0&&(S=this._getTextWidth(y),S<=c)){this._addTextLine(y),f+=i,r=Math.max(r,S);break}}else break}else this._addTextLine(y),f+=i,r=Math.max(r,S),this._shouldHandleEllipsis(f)&&vd)break}this.textHeight=n,this.textWidth=r}_shouldHandleEllipsis(t){var n=+this.fontSize(),r=this.lineHeight()*n,i=this.attrs.height,o=i!==vf&&i!==void 0,a=this.padding(),s=i-a*2,l=this.wrap(),u=l!==vO;return!u||o&&t+r>s}_tryToAddEllipsisToLastLine(){var t=this.attrs.width,n=t!==vf&&t!==void 0,r=this.padding(),i=t-r*2,o=this.ellipsis(),a=this.textArr[this.textArr.length-1];if(!(!a||!o)){if(n){var s=this._getTextWidth(a.text+ZC)n?null:ng.Path.getPointAtLengthOfDataArray(t,this.dataArray)}_readDataAttribute(){this.dataArray=ng.Path.parsePathData(this.attrs.data),this.pathLength=this._getTextPathLength()}_sceneFunc(t){t.setAttr("font",this._getContextFont()),t.setAttr("textBaseline",this.textBaseline()),t.setAttr("textAlign","left"),t.save();var n=this.textDecoration(),r=this.fill(),i=this.fontSize(),o=this.glyphInfo;n==="underline"&&t.beginPath();for(var a=0;a=1){var r=n[0].p0;t.moveTo(r.x,r.y)}for(var i=0;ie+`.${WG}`).join(" "),SO="nodesRect",e5e=["widthChange","heightChange","scaleXChange","scaleYChange","skewXChange","skewYChange","rotationChange","offsetXChange","offsetYChange","transformsEnabledChange","strokeWidthChange"],t5e={"top-left":-45,"top-center":0,"top-right":45,"middle-right":-90,"middle-left":90,"bottom-left":-135,"bottom-center":180,"bottom-right":135};const n5e="ontouchstart"in za.Konva._global;function r5e(e,t){if(e==="rotater")return"crosshair";t+=Cn.Util.degToRad(t5e[e]||0);var n=(Cn.Util.radToDeg(t)%360+360)%360;return Cn.Util._inRange(n,315+22.5,360)||Cn.Util._inRange(n,0,22.5)?"ns-resize":Cn.Util._inRange(n,45-22.5,45+22.5)?"nesw-resize":Cn.Util._inRange(n,90-22.5,90+22.5)?"ew-resize":Cn.Util._inRange(n,135-22.5,135+22.5)?"nwse-resize":Cn.Util._inRange(n,180-22.5,180+22.5)?"ns-resize":Cn.Util._inRange(n,225-22.5,225+22.5)?"nesw-resize":Cn.Util._inRange(n,270-22.5,270+22.5)?"ew-resize":Cn.Util._inRange(n,315-22.5,315+22.5)?"nwse-resize":(Cn.Util.error("Transformer has unknown angle for cursor detection: "+n),"pointer")}var F_=["top-left","top-center","top-right","middle-right","middle-left","bottom-left","bottom-center","bottom-right"],xO=1e8;function i5e(e){return{x:e.x+e.width/2*Math.cos(e.rotation)+e.height/2*Math.sin(-e.rotation),y:e.y+e.height/2*Math.cos(e.rotation)+e.width/2*Math.sin(e.rotation)}}function KG(e,t,n){const r=n.x+(e.x-n.x)*Math.cos(t)-(e.y-n.y)*Math.sin(t),i=n.y+(e.x-n.x)*Math.sin(t)+(e.y-n.y)*Math.cos(t);return Object.assign(Object.assign({},e),{rotation:e.rotation+t,x:r,y:i})}function o5e(e,t){const n=i5e(e);return KG(e,t,n)}function a5e(e,t,n){let r=t;for(let i=0;ii.isAncestorOf(this)?(Cn.Util.error("Konva.Transformer cannot be an a child of the node you are trying to attach"),!1):!0);this._nodes=t=n,t.length===1&&this.useSingleNodeRotation()?this.rotation(t[0].getAbsoluteRotation()):this.rotation(0),this._nodes.forEach(i=>{const o=()=>{this.nodes().length===1&&this.useSingleNodeRotation()&&this.rotation(this.nodes()[0].getAbsoluteRotation()),this._resetTransformCache(),!this._transforming&&!this.isDragging()&&this.update()},a=i._attrsAffectingSize.map(s=>s+"Change."+this._getEventNamespace()).join(" ");i.on(a,o),i.on(e5e.map(s=>s+`.${this._getEventNamespace()}`).join(" "),o),i.on(`absoluteTransformChange.${this._getEventNamespace()}`,o),this._proxyDrag(i)}),this._resetTransformCache();var r=!!this.findOne(".top-left");return r&&this.update(),this}_proxyDrag(t){let n;t.on(`dragstart.${this._getEventNamespace()}`,r=>{n=t.getAbsolutePosition(),!this.isDragging()&&t!==this.findOne(".back")&&this.startDrag(r,!1)}),t.on(`dragmove.${this._getEventNamespace()}`,r=>{if(!n)return;const i=t.getAbsolutePosition(),o=i.x-n.x,a=i.y-n.y;this.nodes().forEach(s=>{if(s===t||s.isDragging())return;const l=s.getAbsolutePosition();s.setAbsolutePosition({x:l.x+o,y:l.y+a}),s.startDrag(r)}),n=null})}getNodes(){return this._nodes||[]}getActiveAnchor(){return this._movingAnchorName}detach(){this._nodes&&this._nodes.forEach(t=>{t.off("."+this._getEventNamespace())}),this._nodes=[],this._resetTransformCache()}_resetTransformCache(){this._clearCache(SO),this._clearCache("transform"),this._clearSelfAndDescendantCache("absoluteTransform")}_getNodeRect(){return this._getCache(SO,this.__getNodeRect)}__getNodeShape(t,n=this.rotation(),r){var i=t.getClientRect({skipTransform:!0,skipShadow:!0,skipStroke:this.ignoreStroke()}),o=t.getAbsoluteScale(r),a=t.getAbsolutePosition(r),s=i.x*o.x-t.offsetX()*o.x,l=i.y*o.y-t.offsetY()*o.y;const u=(za.Konva.getAngle(t.getAbsoluteRotation())+Math.PI*2)%(Math.PI*2),c={x:a.x+s*Math.cos(u)+l*Math.sin(-u),y:a.y+l*Math.cos(u)+s*Math.sin(u),width:i.width*o.x,height:i.height*o.y,rotation:u};return KG(c,-za.Konva.getAngle(n),{x:0,y:0})}__getNodeRect(){var t=this.getNode();if(!t)return{x:-xO,y:-xO,width:0,height:0,rotation:0};const n=[];this.nodes().map(u=>{const c=u.getClientRect({skipTransform:!0,skipShadow:!0,skipStroke:this.ignoreStroke()});var d=[{x:c.x,y:c.y},{x:c.x+c.width,y:c.y},{x:c.x+c.width,y:c.y+c.height},{x:c.x,y:c.y+c.height}],f=u.getAbsoluteTransform();d.forEach(function(h){var p=f.point(h);n.push(p)})});const r=new Cn.Transform;r.rotate(-za.Konva.getAngle(this.rotation()));var i,o,a,s;n.forEach(function(u){var c=r.point(u);i===void 0&&(i=a=c.x,o=s=c.y),i=Math.min(i,c.x),o=Math.min(o,c.y),a=Math.max(a,c.x),s=Math.max(s,c.y)}),r.invert();const l=r.point({x:i,y:o});return{x:l.x,y:l.y,width:a-i,height:s-o,rotation:za.Konva.getAngle(this.rotation())}}getX(){return this._getNodeRect().x}getY(){return this._getNodeRect().y}getWidth(){return this._getNodeRect().width}getHeight(){return this._getNodeRect().height}_createElements(){this._createBack(),F_.forEach((function(t){this._createAnchor(t)}).bind(this)),this._createAnchor("rotater")}_createAnchor(t){var n=new YCe.Rect({stroke:"rgb(0, 161, 255)",fill:"white",strokeWidth:1,name:t+" _anchor",dragDistance:0,draggable:!0,hitStrokeWidth:n5e?10:"auto"}),r=this;n.on("mousedown touchstart",function(i){r._handleMouseDown(i)}),n.on("dragstart",i=>{n.stopDrag(),i.cancelBubble=!0}),n.on("dragend",i=>{i.cancelBubble=!0}),n.on("mouseenter",()=>{var i=za.Konva.getAngle(this.rotation()),o=r5e(t,i);n.getStage().content&&(n.getStage().content.style.cursor=o),this._cursorChange=!0}),n.on("mouseout",()=>{n.getStage().content&&(n.getStage().content.style.cursor=""),this._cursorChange=!1}),this.add(n)}_createBack(){var t=new XCe.Shape({name:"back",width:0,height:0,draggable:!0,sceneFunc(n){var r=this.getParent(),i=r.padding();n.beginPath(),n.rect(-i,-i,this.width()+i*2,this.height()+i*2),n.moveTo(this.width()/2,-i),r.rotateEnabled()&&n.lineTo(this.width()/2,-r.rotateAnchorOffset()*Cn.Util._sign(this.height())-i),n.fillStrokeShape(this)},hitFunc:(n,r)=>{if(this.shouldOverdrawWholeArea()){var i=this.padding();n.beginPath(),n.rect(-i,-i,r.width()+i*2,r.height()+i*2),n.fillStrokeShape(r)}}});this.add(t),this._proxyDrag(t),t.on("dragstart",n=>{n.cancelBubble=!0}),t.on("dragmove",n=>{n.cancelBubble=!0}),t.on("dragend",n=>{n.cancelBubble=!0}),this.on("dragmove",n=>{this.update()})}_handleMouseDown(t){this._movingAnchorName=t.target.name().split(" ")[0];var n=this._getNodeRect(),r=n.width,i=n.height,o=Math.sqrt(Math.pow(r,2)+Math.pow(i,2));this.sin=Math.abs(i/o),this.cos=Math.abs(r/o),typeof window<"u"&&(window.addEventListener("mousemove",this._handleMouseMove),window.addEventListener("touchmove",this._handleMouseMove),window.addEventListener("mouseup",this._handleMouseUp,!0),window.addEventListener("touchend",this._handleMouseUp,!0)),this._transforming=!0;var a=t.target.getAbsolutePosition(),s=t.target.getStage().getPointerPosition();this._anchorDragOffset={x:s.x-a.x,y:s.y-a.y},this._fire("transformstart",{evt:t.evt,target:this.getNode()}),this._nodes.forEach(l=>{l._fire("transformstart",{evt:t.evt,target:l})})}_handleMouseMove(t){var n,r,i,o=this.findOne("."+this._movingAnchorName),a=o.getStage();a.setPointersPositions(t);const s=a.getPointerPosition();let l={x:s.x-this._anchorDragOffset.x,y:s.y-this._anchorDragOffset.y};const u=o.getAbsolutePosition();this.anchorDragBoundFunc()&&(l=this.anchorDragBoundFunc()(u,l,t)),o.setAbsolutePosition(l);const c=o.getAbsolutePosition();if(!(u.x===c.x&&u.y===c.y)){if(this._movingAnchorName==="rotater"){var d=this._getNodeRect();n=o.x()-d.width/2,r=-o.y()+d.height/2;let O=Math.atan2(-r,n)+Math.PI/2;d.height<0&&(O-=Math.PI);var f=za.Konva.getAngle(this.rotation());const E=f+O,A=za.Konva.getAngle(this.rotationSnapTolerance()),L=a5e(this.rotationSnaps(),E,A)-d.rotation,M=o5e(d,L);this._fitNodesInto(M,t);return}var h=this.shiftBehavior(),p;h==="inverted"?p=this.keepRatio()&&!t.shiftKey:h==="none"?p=this.keepRatio():p=this.keepRatio()||t.shiftKey;var g=this.centeredScaling()||t.altKey;if(this._movingAnchorName==="top-left"){if(p){var m=g?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".bottom-right").x(),y:this.findOne(".bottom-right").y()};i=Math.sqrt(Math.pow(m.x-o.x(),2)+Math.pow(m.y-o.y(),2));var _=this.findOne(".top-left").x()>m.x?-1:1,b=this.findOne(".top-left").y()>m.y?-1:1;n=i*this.cos*_,r=i*this.sin*b,this.findOne(".top-left").x(m.x-n),this.findOne(".top-left").y(m.y-r)}}else if(this._movingAnchorName==="top-center")this.findOne(".top-left").y(o.y());else if(this._movingAnchorName==="top-right"){if(p){var m=g?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".bottom-left").x(),y:this.findOne(".bottom-left").y()};i=Math.sqrt(Math.pow(o.x()-m.x,2)+Math.pow(m.y-o.y(),2));var _=this.findOne(".top-right").x()m.y?-1:1;n=i*this.cos*_,r=i*this.sin*b,this.findOne(".top-right").x(m.x+n),this.findOne(".top-right").y(m.y-r)}var v=o.position();this.findOne(".top-left").y(v.y),this.findOne(".bottom-right").x(v.x)}else if(this._movingAnchorName==="middle-left")this.findOne(".top-left").x(o.x());else if(this._movingAnchorName==="middle-right")this.findOne(".bottom-right").x(o.x());else if(this._movingAnchorName==="bottom-left"){if(p){var m=g?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".top-right").x(),y:this.findOne(".top-right").y()};i=Math.sqrt(Math.pow(m.x-o.x(),2)+Math.pow(o.y()-m.y,2));var _=m.x{r._fire("transformend",{evt:t,target:r})}),this._movingAnchorName=null}}_fitNodesInto(t,n){var r=this._getNodeRect();const i=1;if(Cn.Util._inRange(t.width,-this.padding()*2-i,i)){this.update();return}if(Cn.Util._inRange(t.height,-this.padding()*2-i,i)){this.update();return}const o=this.flipEnabled();var a=new Cn.Transform;if(a.rotate(za.Konva.getAngle(this.rotation())),this._movingAnchorName&&t.width<0&&this._movingAnchorName.indexOf("left")>=0){const d=a.point({x:-this.padding()*2,y:0});if(t.x+=d.x,t.y+=d.y,t.width+=this.padding()*2,this._movingAnchorName=this._movingAnchorName.replace("left","right"),this._anchorDragOffset.x-=d.x,this._anchorDragOffset.y-=d.y,!o){this.update();return}}else if(this._movingAnchorName&&t.width<0&&this._movingAnchorName.indexOf("right")>=0){const d=a.point({x:this.padding()*2,y:0});if(this._movingAnchorName=this._movingAnchorName.replace("right","left"),this._anchorDragOffset.x-=d.x,this._anchorDragOffset.y-=d.y,t.width+=this.padding()*2,!o){this.update();return}}if(this._movingAnchorName&&t.height<0&&this._movingAnchorName.indexOf("top")>=0){const d=a.point({x:0,y:-this.padding()*2});if(t.x+=d.x,t.y+=d.y,this._movingAnchorName=this._movingAnchorName.replace("top","bottom"),this._anchorDragOffset.x-=d.x,this._anchorDragOffset.y-=d.y,t.height+=this.padding()*2,!o){this.update();return}}else if(this._movingAnchorName&&t.height<0&&this._movingAnchorName.indexOf("bottom")>=0){const d=a.point({x:0,y:this.padding()*2});if(this._movingAnchorName=this._movingAnchorName.replace("bottom","top"),this._anchorDragOffset.x-=d.x,this._anchorDragOffset.y-=d.y,t.height+=this.padding()*2,!o){this.update();return}}if(this.boundBoxFunc()){const d=this.boundBoxFunc()(r,t);d?t=d:Cn.Util.warn("boundBoxFunc returned falsy. You should return new bound rect from it!")}const s=1e7,l=new Cn.Transform;l.translate(r.x,r.y),l.rotate(r.rotation),l.scale(r.width/s,r.height/s);const u=new Cn.Transform;u.translate(t.x,t.y),u.rotate(t.rotation),u.scale(t.width/s,t.height/s);const c=u.multiply(l.invert());this._nodes.forEach(d=>{var f;const h=d.getParent().getAbsoluteTransform(),p=d.getTransform().copy();p.translate(d.offsetX(),d.offsetY());const m=new Cn.Transform;m.multiply(h.copy().invert()).multiply(c).multiply(h).multiply(p);const _=m.decompose();d.setAttrs(_),this._fire("transform",{evt:n,target:d}),d._fire("transform",{evt:n,target:d}),(f=d.getLayer())===null||f===void 0||f.batchDraw()}),this.rotation(Cn.Util._getRotation(t.rotation)),this._resetTransformCache(),this.update(),this.getLayer().batchDraw()}forceUpdate(){this._resetTransformCache(),this.update()}_batchChangeChild(t,n){this.findOne(t).setAttrs(n)}update(){var t,n=this._getNodeRect();this.rotation(Cn.Util._getRotation(n.rotation));var r=n.width,i=n.height,o=this.enabledAnchors(),a=this.resizeEnabled(),s=this.padding(),l=this.anchorSize();const u=this.find("._anchor");u.forEach(d=>{d.setAttrs({width:l,height:l,offsetX:l/2,offsetY:l/2,stroke:this.anchorStroke(),strokeWidth:this.anchorStrokeWidth(),fill:this.anchorFill(),cornerRadius:this.anchorCornerRadius()})}),this._batchChangeChild(".top-left",{x:0,y:0,offsetX:l/2+s,offsetY:l/2+s,visible:a&&o.indexOf("top-left")>=0}),this._batchChangeChild(".top-center",{x:r/2,y:0,offsetY:l/2+s,visible:a&&o.indexOf("top-center")>=0}),this._batchChangeChild(".top-right",{x:r,y:0,offsetX:l/2-s,offsetY:l/2+s,visible:a&&o.indexOf("top-right")>=0}),this._batchChangeChild(".middle-left",{x:0,y:i/2,offsetX:l/2+s,visible:a&&o.indexOf("middle-left")>=0}),this._batchChangeChild(".middle-right",{x:r,y:i/2,offsetX:l/2-s,visible:a&&o.indexOf("middle-right")>=0}),this._batchChangeChild(".bottom-left",{x:0,y:i,offsetX:l/2+s,offsetY:l/2-s,visible:a&&o.indexOf("bottom-left")>=0}),this._batchChangeChild(".bottom-center",{x:r/2,y:i,offsetY:l/2-s,visible:a&&o.indexOf("bottom-center")>=0}),this._batchChangeChild(".bottom-right",{x:r,y:i,offsetX:l/2-s,offsetY:l/2-s,visible:a&&o.indexOf("bottom-right")>=0}),this._batchChangeChild(".rotater",{x:r/2,y:-this.rotateAnchorOffset()*Cn.Util._sign(i)-s,visible:this.rotateEnabled()}),this._batchChangeChild(".back",{width:r,height:i,visible:this.borderEnabled(),stroke:this.borderStroke(),strokeWidth:this.borderStrokeWidth(),dash:this.borderDash(),x:0,y:0});const c=this.anchorStyleFunc();c&&u.forEach(d=>{c(d)}),(t=this.getLayer())===null||t===void 0||t.batchDraw()}isTransforming(){return this._transforming}stopTransform(){if(this._transforming){this._removeEvents();var t=this.findOne("."+this._movingAnchorName);t&&t.stopDrag()}}destroy(){return this.getStage()&&this._cursorChange&&this.getStage().content&&(this.getStage().content.style.cursor=""),_O.Group.prototype.destroy.call(this),this.detach(),this._removeEvents(),this}toObject(){return bO.Node.prototype.toObject.call(this)}clone(t){var n=bO.Node.prototype.clone.call(this,t);return n}getClientRect(){return this.nodes().length>0?super.getClientRect():{x:0,y:0,width:0,height:0}}}Cx.Transformer=Zt;function s5e(e){return e instanceof Array||Cn.Util.warn("enabledAnchors value should be an array"),e instanceof Array&&e.forEach(function(t){F_.indexOf(t)===-1&&Cn.Util.warn("Unknown anchor name: "+t+". Available names are: "+F_.join(", "))}),e||[]}Zt.prototype.className="Transformer";(0,ZCe._registerNode)(Zt);vn.Factory.addGetterSetter(Zt,"enabledAnchors",F_,s5e);vn.Factory.addGetterSetter(Zt,"flipEnabled",!0,(0,Pc.getBooleanValidator)());vn.Factory.addGetterSetter(Zt,"resizeEnabled",!0);vn.Factory.addGetterSetter(Zt,"anchorSize",10,(0,Pc.getNumberValidator)());vn.Factory.addGetterSetter(Zt,"rotateEnabled",!0);vn.Factory.addGetterSetter(Zt,"rotationSnaps",[]);vn.Factory.addGetterSetter(Zt,"rotateAnchorOffset",50,(0,Pc.getNumberValidator)());vn.Factory.addGetterSetter(Zt,"rotationSnapTolerance",5,(0,Pc.getNumberValidator)());vn.Factory.addGetterSetter(Zt,"borderEnabled",!0);vn.Factory.addGetterSetter(Zt,"anchorStroke","rgb(0, 161, 255)");vn.Factory.addGetterSetter(Zt,"anchorStrokeWidth",1,(0,Pc.getNumberValidator)());vn.Factory.addGetterSetter(Zt,"anchorFill","white");vn.Factory.addGetterSetter(Zt,"anchorCornerRadius",0,(0,Pc.getNumberValidator)());vn.Factory.addGetterSetter(Zt,"borderStroke","rgb(0, 161, 255)");vn.Factory.addGetterSetter(Zt,"borderStrokeWidth",1,(0,Pc.getNumberValidator)());vn.Factory.addGetterSetter(Zt,"borderDash");vn.Factory.addGetterSetter(Zt,"keepRatio",!0);vn.Factory.addGetterSetter(Zt,"shiftBehavior","default");vn.Factory.addGetterSetter(Zt,"centeredScaling",!1);vn.Factory.addGetterSetter(Zt,"ignoreStroke",!1);vn.Factory.addGetterSetter(Zt,"padding",0,(0,Pc.getNumberValidator)());vn.Factory.addGetterSetter(Zt,"node");vn.Factory.addGetterSetter(Zt,"nodes");vn.Factory.addGetterSetter(Zt,"boundBoxFunc");vn.Factory.addGetterSetter(Zt,"anchorDragBoundFunc");vn.Factory.addGetterSetter(Zt,"anchorStyleFunc");vn.Factory.addGetterSetter(Zt,"shouldOverdrawWholeArea",!1);vn.Factory.addGetterSetter(Zt,"useSingleNodeRotation",!0);vn.Factory.backCompat(Zt,{lineEnabled:"borderEnabled",rotateHandlerOffset:"rotateAnchorOffset",enabledHandlers:"enabledAnchors"});var Ex={};Object.defineProperty(Ex,"__esModule",{value:!0});Ex.Wedge=void 0;const Tx=At,l5e=Yr,u5e=Rt,QG=Xe,c5e=Rt;class ru extends l5e.Shape{_sceneFunc(t){t.beginPath(),t.arc(0,0,this.radius(),0,u5e.Konva.getAngle(this.angle()),this.clockwise()),t.lineTo(0,0),t.closePath(),t.fillStrokeShape(this)}getWidth(){return this.radius()*2}getHeight(){return this.radius()*2}setWidth(t){this.radius(t/2)}setHeight(t){this.radius(t/2)}}Ex.Wedge=ru;ru.prototype.className="Wedge";ru.prototype._centroid=!0;ru.prototype._attrsAffectingSize=["radius"];(0,c5e._registerNode)(ru);Tx.Factory.addGetterSetter(ru,"radius",0,(0,QG.getNumberValidator)());Tx.Factory.addGetterSetter(ru,"angle",0,(0,QG.getNumberValidator)());Tx.Factory.addGetterSetter(ru,"clockwise",!1);Tx.Factory.backCompat(ru,{angleDeg:"angle",getAngleDeg:"getAngle",setAngleDeg:"setAngle"});var kx={};Object.defineProperty(kx,"__esModule",{value:!0});kx.Blur=void 0;const wO=At,d5e=rr,f5e=Xe;function CO(){this.r=0,this.g=0,this.b=0,this.a=0,this.next=null}var h5e=[512,512,456,512,328,456,335,512,405,328,271,456,388,335,292,512,454,405,364,328,298,271,496,456,420,388,360,335,312,292,273,512,482,454,428,405,383,364,345,328,312,298,284,271,259,496,475,456,437,420,404,388,374,360,347,335,323,312,302,292,282,273,265,512,497,482,468,454,441,428,417,405,394,383,373,364,354,345,337,328,320,312,305,298,291,284,278,271,265,259,507,496,485,475,465,456,446,437,428,420,412,404,396,388,381,374,367,360,354,347,341,335,329,323,318,312,307,302,297,292,287,282,278,273,269,265,261,512,505,497,489,482,475,468,461,454,447,441,435,428,422,417,411,405,399,394,389,383,378,373,368,364,359,354,350,345,341,337,332,328,324,320,316,312,309,305,301,298,294,291,287,284,281,278,274,271,268,265,262,259,257,507,501,496,491,485,480,475,470,465,460,456,451,446,442,437,433,428,424,420,416,412,408,404,400,396,392,388,385,381,377,374,370,367,363,360,357,354,350,347,344,341,338,335,332,329,326,323,320,318,315,312,310,307,304,302,299,297,294,292,289,287,285,282,280,278,275,273,271,269,267,265,263,261,259],p5e=[9,11,12,13,13,14,14,15,15,15,15,16,16,16,16,17,17,17,17,17,17,17,18,18,18,18,18,18,18,18,18,19,19,19,19,19,19,19,19,19,19,19,19,19,19,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24];function g5e(e,t){var n=e.data,r=e.width,i=e.height,o,a,s,l,u,c,d,f,h,p,m,_,b,v,g,y,S,w,x,C,k,T,P,$,O=t+t+1,E=r-1,A=i-1,D=t+1,L=D*(D+1)/2,M=new CO,R=null,N=M,B=null,U=null,G=h5e[t],Y=p5e[t];for(s=1;s>Y,P!==0?(P=255/P,n[c]=(f*G>>Y)*P,n[c+1]=(h*G>>Y)*P,n[c+2]=(p*G>>Y)*P):n[c]=n[c+1]=n[c+2]=0,f-=_,h-=b,p-=v,m-=g,_-=B.r,b-=B.g,v-=B.b,g-=B.a,l=d+((l=o+t+1)>Y,P>0?(P=255/P,n[l]=(f*G>>Y)*P,n[l+1]=(h*G>>Y)*P,n[l+2]=(p*G>>Y)*P):n[l]=n[l+1]=n[l+2]=0,f-=_,h-=b,p-=v,m-=g,_-=B.r,b-=B.g,v-=B.b,g-=B.a,l=o+((l=a+D)0&&g5e(t,n)};kx.Blur=m5e;wO.Factory.addGetterSetter(d5e.Node,"blurRadius",0,(0,f5e.getNumberValidator)(),wO.Factory.afterSetFilter);var Ax={};Object.defineProperty(Ax,"__esModule",{value:!0});Ax.Brighten=void 0;const EO=At,y5e=rr,v5e=Xe,b5e=function(e){var t=this.brightness()*255,n=e.data,r=n.length,i;for(i=0;i255?255:i,o=o<0?0:o>255?255:o,a=a<0?0:a>255?255:a,n[s]=i,n[s+1]=o,n[s+2]=a};Px.Contrast=x5e;TO.Factory.addGetterSetter(_5e.Node,"contrast",0,(0,S5e.getNumberValidator)(),TO.Factory.afterSetFilter);var Ix={};Object.defineProperty(Ix,"__esModule",{value:!0});Ix.Emboss=void 0;const cc=At,Rx=rr,w5e=dr,XG=Xe,C5e=function(e){var t=this.embossStrength()*10,n=this.embossWhiteLevel()*255,r=this.embossDirection(),i=this.embossBlend(),o=0,a=0,s=e.data,l=e.width,u=e.height,c=l*4,d=u;switch(r){case"top-left":o=-1,a=-1;break;case"top":o=-1,a=0;break;case"top-right":o=-1,a=1;break;case"right":o=0,a=1;break;case"bottom-right":o=1,a=1;break;case"bottom":o=1,a=0;break;case"bottom-left":o=1,a=-1;break;case"left":o=0,a=-1;break;default:w5e.Util.error("Unknown emboss direction: "+r)}do{var f=(d-1)*c,h=o;d+h<1&&(h=0),d+h>u&&(h=0);var p=(d-1+h)*l*4,m=l;do{var _=f+(m-1)*4,b=a;m+b<1&&(b=0),m+b>l&&(b=0);var v=p+(m-1+b)*4,g=s[_]-s[v],y=s[_+1]-s[v+1],S=s[_+2]-s[v+2],w=g,x=w>0?w:-w,C=y>0?y:-y,k=S>0?S:-S;if(C>x&&(w=y),k>x&&(w=S),w*=t,i){var T=s[_]+w,P=s[_+1]+w,$=s[_+2]+w;s[_]=T>255?255:T<0?0:T,s[_+1]=P>255?255:P<0?0:P,s[_+2]=$>255?255:$<0?0:$}else{var O=n-w;O<0?O=0:O>255&&(O=255),s[_]=s[_+1]=s[_+2]=O}}while(--m)}while(--d)};Ix.Emboss=C5e;cc.Factory.addGetterSetter(Rx.Node,"embossStrength",.5,(0,XG.getNumberValidator)(),cc.Factory.afterSetFilter);cc.Factory.addGetterSetter(Rx.Node,"embossWhiteLevel",.5,(0,XG.getNumberValidator)(),cc.Factory.afterSetFilter);cc.Factory.addGetterSetter(Rx.Node,"embossDirection","top-left",null,cc.Factory.afterSetFilter);cc.Factory.addGetterSetter(Rx.Node,"embossBlend",!1,null,cc.Factory.afterSetFilter);var Ox={};Object.defineProperty(Ox,"__esModule",{value:!0});Ox.Enhance=void 0;const kO=At,E5e=rr,T5e=Xe;function n5(e,t,n,r,i){var o=n-t,a=i-r,s;return o===0?r+a/2:a===0?r:(s=(e-t)/o,s=a*s+r,s)}const k5e=function(e){var t=e.data,n=t.length,r=t[0],i=r,o,a=t[1],s=a,l,u=t[2],c=u,d,f,h=this.enhance();if(h!==0){for(f=0;fi&&(i=o),l=t[f+1],ls&&(s=l),d=t[f+2],dc&&(c=d);i===r&&(i=255,r=0),s===a&&(s=255,a=0),c===u&&(c=255,u=0);var p,m,_,b,v,g,y,S,w;for(h>0?(m=i+h*(255-i),_=r-h*(r-0),v=s+h*(255-s),g=a-h*(a-0),S=c+h*(255-c),w=u-h*(u-0)):(p=(i+r)*.5,m=i+h*(i-p),_=r+h*(r-p),b=(s+a)*.5,v=s+h*(s-b),g=a+h*(a-b),y=(c+u)*.5,S=c+h*(c-y),w=u+h*(u-y)),f=0;fb?_:b;var v=a,g=o,y,S,w=360/g*Math.PI/180,x,C;for(S=0;Sg?v:g;var y=a,S=o,w,x,C=n.polarRotation||0,k,T;for(c=0;ct&&(y=g,S=0,w=-1),i=0;i=0&&h=0&&p=0&&h=0&&p=255*4?255:0}return a}function U5e(e,t,n){for(var r=[.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111],i=Math.round(Math.sqrt(r.length)),o=Math.floor(i/2),a=[],s=0;s=0&&h=0&&p=n))for(o=m;o<_;o+=1)o>=r||(a=(n*o+i)*4,s+=y[a+0],l+=y[a+1],u+=y[a+2],c+=y[a+3],g+=1);for(s=s/g,l=l/g,u=u/g,c=c/g,i=h;i=n))for(o=m;o<_;o+=1)o>=r||(a=(n*o+i)*4,y[a+0]=s,y[a+1]=l,y[a+2]=u,y[a+3]=c)}};zx.Pixelate=X5e;RO.Factory.addGetterSetter(K5e.Node,"pixelSize",8,(0,Q5e.getNumberValidator)(),RO.Factory.afterSetFilter);var jx={};Object.defineProperty(jx,"__esModule",{value:!0});jx.Posterize=void 0;const OO=At,Y5e=rr,Z5e=Xe,J5e=function(e){var t=Math.round(this.levels()*254)+1,n=e.data,r=n.length,i=255/t,o;for(o=0;o255?255:e<0?0:Math.round(e)});z_.Factory.addGetterSetter(OA.Node,"green",0,function(e){return this._filterUpToDate=!1,e>255?255:e<0?0:Math.round(e)});z_.Factory.addGetterSetter(OA.Node,"blue",0,e3e.RGBComponent,z_.Factory.afterSetFilter);var Vx={};Object.defineProperty(Vx,"__esModule",{value:!0});Vx.RGBA=void 0;const b0=At,Gx=rr,n3e=Xe,r3e=function(e){var t=e.data,n=t.length,r=this.red(),i=this.green(),o=this.blue(),a=this.alpha(),s,l;for(s=0;s255?255:e<0?0:Math.round(e)});b0.Factory.addGetterSetter(Gx.Node,"green",0,function(e){return this._filterUpToDate=!1,e>255?255:e<0?0:Math.round(e)});b0.Factory.addGetterSetter(Gx.Node,"blue",0,n3e.RGBComponent,b0.Factory.afterSetFilter);b0.Factory.addGetterSetter(Gx.Node,"alpha",1,function(e){return this._filterUpToDate=!1,e>1?1:e<0?0:e});var qx={};Object.defineProperty(qx,"__esModule",{value:!0});qx.Sepia=void 0;const i3e=function(e){var t=e.data,n=t.length,r,i,o,a;for(r=0;r127&&(u=255-u),c>127&&(c=255-c),d>127&&(d=255-d),t[l]=u,t[l+1]=c,t[l+2]=d}while(--s)}while(--o)};Hx.Solarize=o3e;var Wx={};Object.defineProperty(Wx,"__esModule",{value:!0});Wx.Threshold=void 0;const MO=At,a3e=rr,s3e=Xe,l3e=function(e){var t=this.threshold()*255,n=e.data,r=n.length,i;for(i=0;i{const{width:r,height:i}=t,o=document.createElement("div"),a=new ig.Stage({container:o,width:r,height:i}),s=new ig.Layer,l=new ig.Layer;return s.add(new ig.Rect({...t,fill:n?"black":"white"})),e.forEach(u=>l.add(new ig.Line({points:u.points,stroke:n?"white":"black",strokeWidth:u.strokeWidth*2,tension:0,lineCap:"round",lineJoin:"round",shadowForStrokeEnabled:!1,globalCompositeOperation:u.tool==="brush"?"source-over":"destination-out"}))),a.add(s),a.add(l),o.remove(),a},K3e=async(e,t,n)=>new Promise((r,i)=>{const o=document.createElement("canvas");o.width=t,o.height=n;const a=o.getContext("2d"),s=new Image;if(!a){o.remove(),i("Unable to get context");return}s.onload=function(){a.drawImage(s,0,0),o.remove(),r(a.getImageData(0,0,t,n))},s.src=e}),DO=async(e,t)=>{const n=e.toDataURL(t);return await K3e(n,t.width,t.height)},MA=async(e,t,n,r,i)=>{const o=_e("canvas"),a=ex(),s=Uxe();if(!a||!s){o.error("Unable to find canvas / stage");return}const l={...t,...n},u=a.clone();u.scale({x:1,y:1});const c=u.getAbsolutePosition(),d={x:l.x+c.x,y:l.y+c.y,width:l.width,height:l.height},f=await D_(u,d),h=await DO(u,d),p=await W3e(r?e.objects.filter(EB):[],l,i),m=await D_(p,l),_=await DO(p,l);return{baseBlob:f,baseImageData:h,maskBlob:m,maskImageData:_}},Q3e=()=>{Fe({actionCreator:$xe,effect:async(e,{dispatch:t,getState:n})=>{const r=_e("canvas"),i=n(),o=await MA(i.canvas.layerState,i.canvas.boundingBoxCoordinates,i.canvas.boundingBoxDimensions,i.canvas.isMaskEnabled,i.canvas.shouldPreserveMaskedArea);if(!o)return;const{maskBlob:a}=o;if(!a){r.error("Problem getting mask layer blob"),t(Gt({title:Z("toast.problemSavingMask"),description:Z("toast.problemSavingMaskDesc"),status:"error"}));return}const{autoAddBoardId:s}=i.gallery;t(me.endpoints.uploadImage.initiate({file:new File([a],"canvasMaskImage.png",{type:"image/png"}),image_category:"mask",is_intermediate:!1,board_id:s==="none"?void 0:s,crop_visible:!0,postUploadAction:{type:"TOAST",toastOptions:{title:Z("toast.maskSavedAssets")}}}))}})},X3e=()=>{Fe({actionCreator:zxe,effect:async(e,{dispatch:t,getState:n})=>{const r=_e("canvas"),i=n(),o=await MA(i.canvas.layerState,i.canvas.boundingBoxCoordinates,i.canvas.boundingBoxDimensions,i.canvas.isMaskEnabled,i.canvas.shouldPreserveMaskedArea);if(!o)return;const{maskBlob:a}=o;if(!a){r.error("Problem getting mask layer blob"),t(Gt({title:Z("toast.problemImportingMask"),description:Z("toast.problemImportingMaskDesc"),status:"error"}));return}const{autoAddBoardId:s}=i.gallery,l=await t(me.endpoints.uploadImage.initiate({file:new File([a],"canvasMaskImage.png",{type:"image/png"}),image_category:"mask",is_intermediate:!1,board_id:s==="none"?void 0:s,crop_visible:!1,postUploadAction:{type:"TOAST",toastOptions:{title:Z("toast.maskSentControlnetAssets")}}})).unwrap(),{image_name:u}=l;t(Cc({controlNetId:e.payload.controlNet.controlNetId,controlImage:u}))}})},Y3e=async()=>{const e=ex();if(!e)return;const t=e.clone();return t.scale({x:1,y:1}),D_(t,t.getClientRect())},Z3e=()=>{Fe({actionCreator:Fxe,effect:async(e,{dispatch:t})=>{const n=S2.get().child({namespace:"canvasCopiedToClipboardListener"}),r=await Y3e();if(!r){n.error("Problem getting base layer blob"),t(Gt({title:Z("toast.problemMergingCanvas"),description:Z("toast.problemMergingCanvasDesc"),status:"error"}));return}const i=ex();if(!i){n.error("Problem getting canvas base layer"),t(Gt({title:Z("toast.problemMergingCanvas"),description:Z("toast.problemMergingCanvasDesc"),status:"error"}));return}const o=i.getClientRect({relativeTo:i.getParent()}),a=await t(me.endpoints.uploadImage.initiate({file:new File([r],"mergedCanvas.png",{type:"image/png"}),image_category:"general",is_intermediate:!0,postUploadAction:{type:"TOAST",toastOptions:{title:Z("toast.canvasMerged")}}})).unwrap(),{image_name:s}=a;t(dle({kind:"image",layer:"base",imageName:s,...o}))}})},J3e=()=>{Fe({actionCreator:Nxe,effect:async(e,{dispatch:t,getState:n})=>{const r=_e("canvas"),i=n();let o;try{o=await tx(i)}catch(s){r.error(String(s)),t(Gt({title:Z("toast.problemSavingCanvas"),description:Z("toast.problemSavingCanvasDesc"),status:"error"}));return}const{autoAddBoardId:a}=i.gallery;t(me.endpoints.uploadImage.initiate({file:new File([o],"savedCanvas.png",{type:"image/png"}),image_category:"general",is_intermediate:!1,board_id:a==="none"?void 0:a,crop_visible:!0,postUploadAction:{type:"TOAST",toastOptions:{title:Z("toast.canvasSavedGallery")}}}))}})},eEe=(e,t,n)=>{var c;if(!(p0e.match(e)||UR.match(e)||Cc.match(e)||g0e.match(e)||VR.match(e))||VR.match(e)&&((c=n.controlNet.controlNets[e.payload.controlNetId])==null?void 0:c.shouldAutoConfig)===!0)return!1;const i=t.controlNet.controlNets[e.payload.controlNetId];if(!i)return!1;const{controlImage:o,processorType:a,shouldAutoConfig:s}=i;return UR.match(e)&&!s?!1:a!=="none"&&!!o},tEe=()=>{Fe({predicate:eEe,effect:async(e,{dispatch:t,cancelActiveListeners:n,delay:r})=>{const i=_e("session"),{controlNetId:o}=e.payload;n(),i.trace("ControlNet auto-process triggered"),await r(300),t(Wk({controlNetId:o}))}})},Be="positive_conditioning",We="negative_conditioning",Oe="denoise_latents",Ke="latents_to_image",Za="save_image",vd="nsfw_checker",Qc="invisible_watermark",Le="noise",Ic="main_model_loader",Kx="onnx_model_loader",vs="vae_loader",JG="lora_loader",Yt="clip_skip",qn="image_to_latents",Os="resize_image",bh="img2img_resize",ye="canvas_output",Wn="inpaint_image",Ai="inpaint_image_resize_up",qi="inpaint_image_resize_down",Wt="inpaint_infill",Lu="inpaint_infill_resize_down",Hn="inpaint_create_mask",gt="canvas_coherence_denoise_latents",Ut="canvas_coherence_noise",dc="canvas_coherence_noise_increment",mr="canvas_coherence_mask_edge",zt="canvas_coherence_inpaint_create_mask",_h="tomask",Ui="mask_blur",Ti="mask_combine",Mn="mask_resize_up",Hi="mask_resize_down",Gv="control_net_collect",nEe="ip_adapter",pt="metadata_accumulator",r5="esrgan",Vi="sdxl_model_loader",Te="sdxl_denoise_latents",Fc="sdxl_refiner_model_loader",qv="sdxl_refiner_positive_conditioning",Hv="sdxl_refiner_negative_conditioning",bs="sdxl_refiner_denoise_latents",ca="refiner_inpaint_create_mask",Hr="seamless",Qa="refiner_seamless",eq="text_to_image_graph",eT="image_to_image_graph",tq="canvas_text_to_image_graph",tT="canvas_image_to_image_graph",Qx="canvas_inpaint_graph",Xx="canvas_outpaint_graph",NA="sdxl_text_to_image_graph",j_="sxdl_image_to_image_graph",Yx="sdxl_canvas_text_to_image_graph",_0="sdxl_canvas_image_to_image_graph",fc="sdxl_canvas_inpaint_graph",hc="sdxl_canvas_outpaint_graph",nq=e=>(e==null?void 0:e.type)==="image_output",rEe=()=>{Fe({actionCreator:Wk,effect:async(e,{dispatch:t,getState:n,take:r})=>{var l;const i=_e("session"),{controlNetId:o}=e.payload,a=n().controlNet.controlNets[o];if(!(a!=null&&a.controlImage)){i.error("Unable to process ControlNet image");return}const s={nodes:{[a.processorNode.id]:{...a.processorNode,is_intermediate:!0,image:{image_name:a.controlImage}},[Za]:{id:Za,type:"save_image",is_intermediate:!0,use_cache:!1}},edges:[{source:{node_id:a.processorNode.id,field:"image"},destination:{node_id:Za,field:"image"}}]};try{const u=t(Qr.endpoints.enqueueGraph.initiate({graph:s,prepend:!0},{fixedCacheKey:"enqueueGraph"})),c=await u.unwrap();u.reset(),i.debug({enqueueResult:Qt(c)},Z("queue.graphQueued"));const[d]=await r(f=>Vk.match(f)&&f.payload.data.graph_execution_state_id===c.queue_item.session_id&&f.payload.data.source_node_id===Za);if(nq(d.payload.data.result)){const{image_name:f}=d.payload.data.result.image,[{payload:h}]=await r(m=>me.endpoints.getImageDTO.matchFulfilled(m)&&m.payload.image_name===f),p=h;i.debug({controlNetId:e.payload,processedControlImage:p},"ControlNet image processed"),t(Kk({controlNetId:o,processedControlImage:p.image_name}))}}catch(u){if(i.error({graph:Qt(s)},Z("queue.graphFailedToQueue")),u instanceof Object&&"data"in u&&"status"in u&&u.status===403){const c=((l=u.data)==null?void 0:l.detail)||"Unknown Error";t(Gt({title:Z("queue.graphFailedToQueue"),status:"error",description:c,duration:15e3})),t(y0e()),t(Cc({controlNetId:o,controlImage:null}));return}t(Gt({title:Z("queue.graphFailedToQueue"),status:"error"}))}}})},$A=Ne("app/enqueueRequested");Ne("app/batchEnqueued");const iEe=e=>{const t=window.open("");t&&e.forEach(n=>{const r=new Image;r.src=n.base64,t.document.write(n.caption),t.document.write("
"),t.document.write(r.outerHTML),t.document.write("

")})},LO=e=>new Promise((t,n)=>{const r=new FileReader;r.onload=i=>t(r.result),r.onerror=i=>n(r.error),r.onabort=i=>n(new Error("Read aborted")),r.readAsDataURL(e)}),oEe=e=>{let t=!0,n=!1;const r=e.length;let i=3;for(i;i{const t=e.length;let n=0;for(n;n{const{isPartiallyTransparent:n,isFullyTransparent:r}=oEe(e.data),i=aEe(t.data);return n?r?"txt2img":"outpaint":i?"inpaint":"img2img"},lEe=e=>Coe(e,n=>n.isEnabled&&(!!n.processedControlImage||n.processorType==="none"&&!!n.controlImage)),Aa=(e,t,n)=>{const{isEnabled:r,controlNets:i}=e.controlNet,o=lEe(i),a=t.nodes[pt];if(r&&o.length&&o.length){const s={id:Gv,type:"collect",is_intermediate:!0};t.nodes[Gv]=s,t.edges.push({source:{node_id:Gv,field:"collection"},destination:{node_id:n,field:"control"}}),o.forEach(l=>{const{controlNetId:u,controlImage:c,processedControlImage:d,beginStepPct:f,endStepPct:h,controlMode:p,resizeMode:m,model:_,processorType:b,weight:v}=l,g={id:`control_net_${u}`,type:"controlnet",is_intermediate:!0,begin_step_percent:f,end_step_percent:h,control_mode:p,resize_mode:m,control_model:_,control_weight:v};if(d&&b!=="none")g.image={image_name:d};else if(c)g.image={image_name:c};else return;if(t.nodes[g.id]=g,a!=null&&a.controlnets){const y=WS(g,["id","type"]);a.controlnets.push(y)}t.edges.push({source:{node_id:g.id,field:"control"},destination:{node_id:Gv,field:"item"}}),gt in t.nodes&&t.edges.push({source:{node_id:g.id,field:"control"},destination:{node_id:gt,field:"control"}})})}},Pa=(e,t,n)=>{var a,s,l,u;const{isIPAdapterEnabled:r,ipAdapterInfo:i}=e.controlNet,o=t.nodes[pt];if(r&&i.model){const c={id:nEe,type:"ip_adapter",is_intermediate:!0,weight:i.weight,ip_adapter_model:{base_model:(a=i.model)==null?void 0:a.base_model,model_name:(s=i.model)==null?void 0:s.model_name},begin_step_percent:i.beginStepPct,end_step_percent:i.endStepPct};if(i.adapterImage)c.image={image_name:i.adapterImage};else return;if(t.nodes[c.id]=c,o!=null&&o.ipAdapters){const d={image:{image_name:i.adapterImage},ip_adapter_model:{base_model:(l=i.model)==null?void 0:l.base_model,model_name:(u=i.model)==null?void 0:u.model_name},weight:i.weight,begin_step_percent:i.beginStepPct,end_step_percent:i.endStepPct};o.ipAdapters.push(d)}t.edges.push({source:{node_id:c.id,field:"ip_adapter"},destination:{node_id:n,field:"ip_adapter"}}),gt in t.nodes&&t.edges.push({source:{node_id:c.id,field:"ip_adapter"},destination:{node_id:gt,field:"ip_adapter"}})}},kp=(e,t,n,r=Ic)=>{const{loras:i}=e.lora,o=KS(i),a=t.nodes[pt];o>0&&(t.edges=t.edges.filter(u=>!(u.source.node_id===r&&["unet"].includes(u.source.field))),t.edges=t.edges.filter(u=>!(u.source.node_id===Yt&&["clip"].includes(u.source.field))));let s="",l=0;Ca(i,u=>{const{model_name:c,base_model:d,weight:f}=u,h=`${JG}_${c.replace(".","_")}`,p={type:"lora_loader",id:h,is_intermediate:!0,lora:{model_name:c,base_model:d},weight:f};a!=null&&a.loras&&a.loras.push({lora:{model_name:c,base_model:d},weight:f}),t.nodes[h]=p,l===0?(t.edges.push({source:{node_id:r,field:"unet"},destination:{node_id:h,field:"unet"}}),t.edges.push({source:{node_id:Yt,field:"clip"},destination:{node_id:h,field:"clip"}})):(t.edges.push({source:{node_id:s,field:"unet"},destination:{node_id:h,field:"unet"}}),t.edges.push({source:{node_id:s,field:"clip"},destination:{node_id:h,field:"clip"}})),l===o-1&&(t.edges.push({source:{node_id:h,field:"unet"},destination:{node_id:n,field:"unet"}}),t.id&&[Qx,Xx].includes(t.id)&&t.edges.push({source:{node_id:h,field:"unet"},destination:{node_id:gt,field:"unet"}}),t.edges.push({source:{node_id:h,field:"clip"},destination:{node_id:Be,field:"clip"}}),t.edges.push({source:{node_id:h,field:"clip"},destination:{node_id:We,field:"clip"}})),s=h,l+=1})},Ia=(e,t,n=Ke)=>{const r=t.nodes[n];if(!r)return;r.is_intermediate=!0,r.use_cache=!0;const i={id:vd,type:"img_nsfw",is_intermediate:!0};t.nodes[vd]=i,t.edges.push({source:{node_id:n,field:"image"},destination:{node_id:vd,field:"image"}})},uEe=["txt2img","img2img","unifiedCanvas","nodes","modelManager","queue"],DA=Ii(e=>e,({ui:e})=>dk(e.activeTab)?e.activeTab:"txt2img"),lKe=Ii(e=>e,({ui:e,config:t})=>{const r=uEe.filter(i=>!t.disabledTabs.includes(i)).indexOf(e.activeTab);return r===-1?0:r}),uKe=Ii(e=>e.ui,e=>e,{memoizeOptions:{equalityCheck:fk}}),Ra=(e,t)=>{const r=DA(e)==="unifiedCanvas"?!e.canvas.shouldAutoSave:!1,{autoAddBoardId:i}=e.gallery,o={id:Za,type:"save_image",is_intermediate:r,use_cache:!1,board:i==="none"?void 0:{board_id:i}};t.nodes[Za]=o,t.nodes[pt]&&t.edges.push({source:{node_id:pt,field:"metadata"},destination:{node_id:Za,field:"metadata"}});const s={node_id:Za,field:"image"};Qc in t.nodes?t.edges.push({source:{node_id:Qc,field:"image"},destination:s}):vd in t.nodes?t.edges.push({source:{node_id:vd,field:"image"},destination:s}):ye in t.nodes?t.edges.push({source:{node_id:ye,field:"image"},destination:s}):Ke in t.nodes&&t.edges.push({source:{node_id:Ke,field:"image"},destination:s})},Oa=(e,t,n)=>{const{seamlessXAxis:r,seamlessYAxis:i}=e.generation;t.nodes[Hr]={id:Hr,type:"seamless",seamless_x:r,seamless_y:i};let o=Oe;(t.id===NA||t.id===j_||t.id===Yx||t.id===_0||t.id===fc||t.id===hc)&&(o=Te),t.edges=t.edges.filter(a=>!(a.source.node_id===n&&["unet"].includes(a.source.field))&&!(a.source.node_id===n&&["vae"].includes(a.source.field))),t.edges.push({source:{node_id:n,field:"unet"},destination:{node_id:Hr,field:"unet"}},{source:{node_id:n,field:"vae"},destination:{node_id:Hr,field:"vae"}},{source:{node_id:Hr,field:"unet"},destination:{node_id:o,field:"unet"}}),(t.id==Qx||t.id===Xx||t.id===fc||t.id===hc)&&t.edges.push({source:{node_id:Hr,field:"unet"},destination:{node_id:gt,field:"unet"}})},Ma=(e,t,n=Ic)=>{const{vae:r,canvasCoherenceMode:i}=e.generation,{boundingBoxScaleMethod:o}=e.canvas,{shouldUseSDXLRefiner:a}=e.sdxl,s=["auto","manual"].includes(o),l=!r,u=t.nodes[pt];l||(t.nodes[vs]={type:"vae_loader",id:vs,is_intermediate:!0,vae_model:r});const c=n==Kx;(t.id===eq||t.id===eT||t.id===NA||t.id===j_)&&t.edges.push({source:{node_id:l?n:vs,field:l&&c?"vae_decoder":"vae"},destination:{node_id:Ke,field:"vae"}}),(t.id===tq||t.id===tT||t.id===Yx||t.id==_0)&&t.edges.push({source:{node_id:l?n:vs,field:l&&c?"vae_decoder":"vae"},destination:{node_id:s?Ke:ye,field:"vae"}}),(t.id===eT||t.id===j_||t.id===tT||t.id===_0)&&t.edges.push({source:{node_id:l?n:vs,field:l&&c?"vae_decoder":"vae"},destination:{node_id:qn,field:"vae"}}),(t.id===Qx||t.id===Xx||t.id===fc||t.id===hc)&&(t.edges.push({source:{node_id:l?n:vs,field:l&&c?"vae_decoder":"vae"},destination:{node_id:Wn,field:"vae"}},{source:{node_id:l?n:vs,field:l&&c?"vae_decoder":"vae"},destination:{node_id:Hn,field:"vae"}},{source:{node_id:l?n:vs,field:l&&c?"vae_decoder":"vae"},destination:{node_id:Ke,field:"vae"}}),i!=="unmasked"&&t.edges.push({source:{node_id:l?n:vs,field:l&&c?"vae_decoder":"vae"},destination:{node_id:zt,field:"vae"}})),a&&(t.id===fc||t.id===hc)&&t.edges.push({source:{node_id:l?n:vs,field:l&&c?"vae_decoder":"vae"},destination:{node_id:ca,field:"vae"}}),r&&u&&(u.vae=r)},Na=(e,t,n=Ke)=>{const i=DA(e)==="unifiedCanvas"?!e.canvas.shouldAutoSave:!1,o=t.nodes[n],a=t.nodes[vd],s=t.nodes[pt];if(!o)return;const l={id:Qc,type:"img_watermark",is_intermediate:i};t.nodes[Qc]=l,o.is_intermediate=!0,o.use_cache=!0,a?(a.is_intermediate=!0,t.edges.push({source:{node_id:vd,field:"image"},destination:{node_id:Qc,field:"image"}})):t.edges.push({source:{node_id:n,field:"image"},destination:{node_id:Qc,field:"image"}}),s&&t.edges.push({source:{node_id:pt,field:"metadata"},destination:{node_id:Qc,field:"metadata"}})},cEe=(e,t)=>{const n=_e("nodes"),{positivePrompt:r,negativePrompt:i,model:o,cfgScale:a,scheduler:s,seed:l,steps:u,img2imgStrength:c,vaePrecision:d,clipSkip:f,shouldUseCpuNoise:h,seamlessXAxis:p,seamlessYAxis:m}=e.generation,{width:_,height:b}=e.canvas.boundingBoxDimensions,{scaledBoundingBoxDimensions:v,boundingBoxScaleMethod:g}=e.canvas,y=d==="fp32",S=!0,w=["auto","manual"].includes(g);if(!o)throw n.error("No model found in state"),new Error("No model found in state");let x=Ic;const C=h,k={id:tT,nodes:{[x]:{type:"main_model_loader",id:x,is_intermediate:S,model:o},[Yt]:{type:"clip_skip",id:Yt,is_intermediate:S,skipped_layers:f},[Be]:{type:"compel",id:Be,is_intermediate:S,prompt:r},[We]:{type:"compel",id:We,is_intermediate:S,prompt:i},[Le]:{type:"noise",id:Le,is_intermediate:S,use_cpu:C,seed:l,width:w?v.width:_,height:w?v.height:b},[qn]:{type:"i2l",id:qn,is_intermediate:S},[Oe]:{type:"denoise_latents",id:Oe,is_intermediate:S,cfg_scale:a,scheduler:s,steps:u,denoising_start:1-c,denoising_end:1},[ye]:{type:"l2i",id:ye,is_intermediate:S}},edges:[{source:{node_id:x,field:"unet"},destination:{node_id:Oe,field:"unet"}},{source:{node_id:x,field:"clip"},destination:{node_id:Yt,field:"clip"}},{source:{node_id:Yt,field:"clip"},destination:{node_id:Be,field:"clip"}},{source:{node_id:Yt,field:"clip"},destination:{node_id:We,field:"clip"}},{source:{node_id:Be,field:"conditioning"},destination:{node_id:Oe,field:"positive_conditioning"}},{source:{node_id:We,field:"conditioning"},destination:{node_id:Oe,field:"negative_conditioning"}},{source:{node_id:Le,field:"noise"},destination:{node_id:Oe,field:"noise"}},{source:{node_id:qn,field:"latents"},destination:{node_id:Oe,field:"latents"}}]};return w?(k.nodes[bh]={id:bh,type:"img_resize",is_intermediate:S,image:t,width:v.width,height:v.height},k.nodes[Ke]={id:Ke,type:"l2i",is_intermediate:S,fp32:y},k.nodes[ye]={id:ye,type:"img_resize",is_intermediate:S,width:_,height:b},k.edges.push({source:{node_id:bh,field:"image"},destination:{node_id:qn,field:"image"}},{source:{node_id:Oe,field:"latents"},destination:{node_id:Ke,field:"latents"}},{source:{node_id:Ke,field:"image"},destination:{node_id:ye,field:"image"}})):(k.nodes[ye]={type:"l2i",id:ye,is_intermediate:S,fp32:y},k.nodes[qn].image=t,k.edges.push({source:{node_id:Oe,field:"latents"},destination:{node_id:ye,field:"latents"}})),k.nodes[pt]={id:pt,type:"metadata_accumulator",generation_mode:"img2img",cfg_scale:a,width:w?v.width:_,height:w?v.height:b,positive_prompt:r,negative_prompt:i,model:o,seed:l,steps:u,rand_device:C?"cpu":"cuda",scheduler:s,vae:void 0,controlnets:[],loras:[],ipAdapters:[],clip_skip:f,strength:c,init_image:t.image_name},(p||m)&&(Oa(e,k,x),x=Hr),kp(e,k,Oe),Ma(e,k,x),Aa(e,k,Oe),Pa(e,k,Oe),e.system.shouldUseNSFWChecker&&Ia(e,k,ye),e.system.shouldUseWatermarker&&Na(e,k,ye),Ra(e,k),k},dEe=(e,t,n)=>{const r=_e("nodes"),{positivePrompt:i,negativePrompt:o,model:a,cfgScale:s,scheduler:l,steps:u,img2imgStrength:c,seed:d,vaePrecision:f,shouldUseCpuNoise:h,maskBlur:p,maskBlurMethod:m,canvasCoherenceMode:_,canvasCoherenceSteps:b,canvasCoherenceStrength:v,clipSkip:g,seamlessXAxis:y,seamlessYAxis:S}=e.generation;if(!a)throw r.error("No Image found in state"),new Error("No Image found in state");const{width:w,height:x}=e.canvas.boundingBoxDimensions,{scaledBoundingBoxDimensions:C,boundingBoxScaleMethod:k}=e.canvas,T=!0,P=f==="fp32",$=["auto","manual"].includes(k);let O=Ic;const E=h,A={id:Qx,nodes:{[O]:{type:"main_model_loader",id:O,is_intermediate:T,model:a},[Yt]:{type:"clip_skip",id:Yt,is_intermediate:T,skipped_layers:g},[Be]:{type:"compel",id:Be,is_intermediate:T,prompt:i},[We]:{type:"compel",id:We,is_intermediate:T,prompt:o},[Ui]:{type:"img_blur",id:Ui,is_intermediate:T,radius:p,blur_type:m},[Wn]:{type:"i2l",id:Wn,is_intermediate:T,fp32:P},[Le]:{type:"noise",id:Le,use_cpu:E,seed:d,is_intermediate:T},[Hn]:{type:"create_denoise_mask",id:Hn,is_intermediate:T,fp32:P},[Oe]:{type:"denoise_latents",id:Oe,is_intermediate:T,steps:u,cfg_scale:s,scheduler:l,denoising_start:1-c,denoising_end:1},[Ut]:{type:"noise",id:Ut,use_cpu:E,seed:d+1,is_intermediate:T},[dc]:{type:"add",id:dc,b:1,is_intermediate:T},[gt]:{type:"denoise_latents",id:gt,is_intermediate:T,steps:b,cfg_scale:s,scheduler:l,denoising_start:1-v,denoising_end:1},[Ke]:{type:"l2i",id:Ke,is_intermediate:T,fp32:P},[ye]:{type:"color_correct",id:ye,is_intermediate:T,reference:t}},edges:[{source:{node_id:O,field:"unet"},destination:{node_id:Oe,field:"unet"}},{source:{node_id:O,field:"clip"},destination:{node_id:Yt,field:"clip"}},{source:{node_id:Yt,field:"clip"},destination:{node_id:Be,field:"clip"}},{source:{node_id:Yt,field:"clip"},destination:{node_id:We,field:"clip"}},{source:{node_id:Be,field:"conditioning"},destination:{node_id:Oe,field:"positive_conditioning"}},{source:{node_id:We,field:"conditioning"},destination:{node_id:Oe,field:"negative_conditioning"}},{source:{node_id:Le,field:"noise"},destination:{node_id:Oe,field:"noise"}},{source:{node_id:Wn,field:"latents"},destination:{node_id:Oe,field:"latents"}},{source:{node_id:Ui,field:"image"},destination:{node_id:Hn,field:"mask"}},{source:{node_id:Hn,field:"denoise_mask"},destination:{node_id:Oe,field:"denoise_mask"}},{source:{node_id:O,field:"unet"},destination:{node_id:gt,field:"unet"}},{source:{node_id:Be,field:"conditioning"},destination:{node_id:gt,field:"positive_conditioning"}},{source:{node_id:We,field:"conditioning"},destination:{node_id:gt,field:"negative_conditioning"}},{source:{node_id:Ut,field:"noise"},destination:{node_id:gt,field:"noise"}},{source:{node_id:Oe,field:"latents"},destination:{node_id:gt,field:"latents"}},{source:{node_id:gt,field:"latents"},destination:{node_id:Ke,field:"latents"}}]};if($){const D=C.width,L=C.height;A.nodes[Ai]={type:"img_resize",id:Ai,is_intermediate:T,width:D,height:L,image:t},A.nodes[Mn]={type:"img_resize",id:Mn,is_intermediate:T,width:D,height:L,image:n},A.nodes[qi]={type:"img_resize",id:qi,is_intermediate:T,width:w,height:x},A.nodes[Hi]={type:"img_resize",id:Hi,is_intermediate:T,width:w,height:x},A.nodes[Le].width=D,A.nodes[Le].height=L,A.nodes[Ut].width=D,A.nodes[Ut].height=L,A.edges.push({source:{node_id:Ai,field:"image"},destination:{node_id:Wn,field:"image"}},{source:{node_id:Mn,field:"image"},destination:{node_id:Ui,field:"image"}},{source:{node_id:Ai,field:"image"},destination:{node_id:Hn,field:"image"}},{source:{node_id:Ke,field:"image"},destination:{node_id:qi,field:"image"}},{source:{node_id:qi,field:"image"},destination:{node_id:ye,field:"image"}},{source:{node_id:Ui,field:"image"},destination:{node_id:Hi,field:"image"}},{source:{node_id:Hi,field:"image"},destination:{node_id:ye,field:"mask"}})}else A.nodes[Le].width=w,A.nodes[Le].height=x,A.nodes[Ut].width=w,A.nodes[Ut].height=x,A.nodes[Wn]={...A.nodes[Wn],image:t},A.nodes[Ui]={...A.nodes[Ui],image:n},A.nodes[Hn]={...A.nodes[Hn],image:t},A.edges.push({source:{node_id:Ke,field:"image"},destination:{node_id:ye,field:"image"}},{source:{node_id:Ui,field:"image"},destination:{node_id:ye,field:"mask"}});return _!=="unmasked"&&(A.nodes[zt]={type:"create_denoise_mask",id:zt,is_intermediate:T,fp32:P},$?A.edges.push({source:{node_id:Ai,field:"image"},destination:{node_id:zt,field:"image"}}):A.nodes[zt]={...A.nodes[zt],image:t},_==="mask"&&($?A.edges.push({source:{node_id:Mn,field:"image"},destination:{node_id:zt,field:"mask"}}):A.nodes[zt]={...A.nodes[zt],mask:n}),_==="edge"&&(A.nodes[mr]={type:"mask_edge",id:mr,is_intermediate:T,edge_blur:p,edge_size:p*2,low_threshold:100,high_threshold:200},$?A.edges.push({source:{node_id:Mn,field:"image"},destination:{node_id:mr,field:"image"}}):A.nodes[mr]={...A.nodes[mr],image:n},A.edges.push({source:{node_id:mr,field:"image"},destination:{node_id:zt,field:"mask"}})),A.edges.push({source:{node_id:zt,field:"denoise_mask"},destination:{node_id:gt,field:"denoise_mask"}})),(y||S)&&(Oa(e,A,O),O=Hr),Ma(e,A,O),kp(e,A,Oe,O),Aa(e,A,Oe),Pa(e,A,Oe),e.system.shouldUseNSFWChecker&&Ia(e,A,ye),e.system.shouldUseWatermarker&&Na(e,A,ye),Ra(e,A),A},fEe=(e,t,n)=>{const r=_e("nodes"),{positivePrompt:i,negativePrompt:o,model:a,cfgScale:s,scheduler:l,steps:u,img2imgStrength:c,seed:d,vaePrecision:f,shouldUseCpuNoise:h,maskBlur:p,canvasCoherenceMode:m,canvasCoherenceSteps:_,canvasCoherenceStrength:b,infillTileSize:v,infillPatchmatchDownscaleSize:g,infillMethod:y,clipSkip:S,seamlessXAxis:w,seamlessYAxis:x}=e.generation;if(!a)throw r.error("No model found in state"),new Error("No model found in state");const{width:C,height:k}=e.canvas.boundingBoxDimensions,{scaledBoundingBoxDimensions:T,boundingBoxScaleMethod:P}=e.canvas,$=f==="fp32",O=!0,E=["auto","manual"].includes(P);let A=Ic;const D=h,L={id:Xx,nodes:{[A]:{type:"main_model_loader",id:A,is_intermediate:O,model:a},[Yt]:{type:"clip_skip",id:Yt,is_intermediate:O,skipped_layers:S},[Be]:{type:"compel",id:Be,is_intermediate:O,prompt:i},[We]:{type:"compel",id:We,is_intermediate:O,prompt:o},[_h]:{type:"tomask",id:_h,is_intermediate:O,image:t},[Ti]:{type:"mask_combine",id:Ti,is_intermediate:O,mask2:n},[Wn]:{type:"i2l",id:Wn,is_intermediate:O,fp32:$},[Le]:{type:"noise",id:Le,use_cpu:D,seed:d,is_intermediate:O},[Hn]:{type:"create_denoise_mask",id:Hn,is_intermediate:O,fp32:$},[Oe]:{type:"denoise_latents",id:Oe,is_intermediate:O,steps:u,cfg_scale:s,scheduler:l,denoising_start:1-c,denoising_end:1},[Ut]:{type:"noise",id:Ut,use_cpu:D,seed:d+1,is_intermediate:O},[dc]:{type:"add",id:dc,b:1,is_intermediate:O},[gt]:{type:"denoise_latents",id:gt,is_intermediate:O,steps:_,cfg_scale:s,scheduler:l,denoising_start:1-b,denoising_end:1},[Ke]:{type:"l2i",id:Ke,is_intermediate:O,fp32:$},[ye]:{type:"color_correct",id:ye,is_intermediate:O}},edges:[{source:{node_id:A,field:"unet"},destination:{node_id:Oe,field:"unet"}},{source:{node_id:A,field:"clip"},destination:{node_id:Yt,field:"clip"}},{source:{node_id:Yt,field:"clip"},destination:{node_id:Be,field:"clip"}},{source:{node_id:Yt,field:"clip"},destination:{node_id:We,field:"clip"}},{source:{node_id:Wt,field:"image"},destination:{node_id:Wn,field:"image"}},{source:{node_id:_h,field:"image"},destination:{node_id:Ti,field:"mask1"}},{source:{node_id:Be,field:"conditioning"},destination:{node_id:Oe,field:"positive_conditioning"}},{source:{node_id:We,field:"conditioning"},destination:{node_id:Oe,field:"negative_conditioning"}},{source:{node_id:Le,field:"noise"},destination:{node_id:Oe,field:"noise"}},{source:{node_id:Wn,field:"latents"},destination:{node_id:Oe,field:"latents"}},{source:{node_id:E?Mn:Ti,field:"image"},destination:{node_id:Hn,field:"mask"}},{source:{node_id:Hn,field:"denoise_mask"},destination:{node_id:Oe,field:"denoise_mask"}},{source:{node_id:A,field:"unet"},destination:{node_id:gt,field:"unet"}},{source:{node_id:Be,field:"conditioning"},destination:{node_id:gt,field:"positive_conditioning"}},{source:{node_id:We,field:"conditioning"},destination:{node_id:gt,field:"negative_conditioning"}},{source:{node_id:Ut,field:"noise"},destination:{node_id:gt,field:"noise"}},{source:{node_id:Oe,field:"latents"},destination:{node_id:gt,field:"latents"}},{source:{node_id:Wt,field:"image"},destination:{node_id:Hn,field:"image"}},{source:{node_id:gt,field:"latents"},destination:{node_id:Ke,field:"latents"}}]};if(y==="patchmatch"&&(L.nodes[Wt]={type:"infill_patchmatch",id:Wt,is_intermediate:O,downscale:g}),y==="lama"&&(L.nodes[Wt]={type:"infill_lama",id:Wt,is_intermediate:O}),y==="cv2"&&(L.nodes[Wt]={type:"infill_cv2",id:Wt,is_intermediate:O}),y==="tile"&&(L.nodes[Wt]={type:"infill_tile",id:Wt,is_intermediate:O,tile_size:v}),E){const M=T.width,R=T.height;L.nodes[Ai]={type:"img_resize",id:Ai,is_intermediate:O,width:M,height:R,image:t},L.nodes[Mn]={type:"img_resize",id:Mn,is_intermediate:O,width:M,height:R},L.nodes[qi]={type:"img_resize",id:qi,is_intermediate:O,width:C,height:k},L.nodes[Lu]={type:"img_resize",id:Lu,is_intermediate:O,width:C,height:k},L.nodes[Hi]={type:"img_resize",id:Hi,is_intermediate:O,width:C,height:k},L.nodes[Le].width=M,L.nodes[Le].height=R,L.nodes[Ut].width=M,L.nodes[Ut].height=R,L.edges.push({source:{node_id:Ai,field:"image"},destination:{node_id:Wt,field:"image"}},{source:{node_id:Ti,field:"image"},destination:{node_id:Mn,field:"image"}},{source:{node_id:Ke,field:"image"},destination:{node_id:qi,field:"image"}},{source:{node_id:Mn,field:"image"},destination:{node_id:Hi,field:"image"}},{source:{node_id:Wt,field:"image"},destination:{node_id:Lu,field:"image"}},{source:{node_id:Lu,field:"image"},destination:{node_id:ye,field:"reference"}},{source:{node_id:qi,field:"image"},destination:{node_id:ye,field:"image"}},{source:{node_id:Hi,field:"image"},destination:{node_id:ye,field:"mask"}})}else L.nodes[Wt]={...L.nodes[Wt],image:t},L.nodes[Le].width=C,L.nodes[Le].height=k,L.nodes[Ut].width=C,L.nodes[Ut].height=k,L.nodes[Wn]={...L.nodes[Wn],image:t},L.edges.push({source:{node_id:Wt,field:"image"},destination:{node_id:ye,field:"reference"}},{source:{node_id:Ke,field:"image"},destination:{node_id:ye,field:"image"}},{source:{node_id:Ti,field:"image"},destination:{node_id:ye,field:"mask"}});return m!=="unmasked"&&(L.nodes[zt]={type:"create_denoise_mask",id:zt,is_intermediate:O,fp32:$},L.edges.push({source:{node_id:Wt,field:"image"},destination:{node_id:zt,field:"image"}}),m==="mask"&&(E?L.edges.push({source:{node_id:Mn,field:"image"},destination:{node_id:zt,field:"mask"}}):L.edges.push({source:{node_id:Ti,field:"image"},destination:{node_id:zt,field:"mask"}})),m==="edge"&&(L.nodes[mr]={type:"mask_edge",id:mr,is_intermediate:O,edge_blur:p,edge_size:p*2,low_threshold:100,high_threshold:200},E?L.edges.push({source:{node_id:Mn,field:"image"},destination:{node_id:mr,field:"image"}}):L.edges.push({source:{node_id:Ti,field:"image"},destination:{node_id:mr,field:"image"}}),L.edges.push({source:{node_id:mr,field:"image"},destination:{node_id:zt,field:"mask"}})),L.edges.push({source:{node_id:zt,field:"denoise_mask"},destination:{node_id:gt,field:"denoise_mask"}})),(w||x)&&(Oa(e,L,A),A=Hr),Ma(e,L,A),kp(e,L,Oe,A),Aa(e,L,Oe),Pa(e,L,Oe),e.system.shouldUseNSFWChecker&&Ia(e,L,ye),e.system.shouldUseWatermarker&&Na(e,L,ye),Ra(e,L),L},Ap=(e,t,n,r=Vi)=>{const{loras:i}=e.lora,o=KS(i),a=t.nodes[pt],s=r;let l=r;[Hr,ca].includes(r)&&(l=Vi),o>0&&(t.edges=t.edges.filter(d=>!(d.source.node_id===s&&["unet"].includes(d.source.field))&&!(d.source.node_id===l&&["clip"].includes(d.source.field))&&!(d.source.node_id===l&&["clip2"].includes(d.source.field))));let u="",c=0;Ca(i,d=>{const{model_name:f,base_model:h,weight:p}=d,m=`${JG}_${f.replace(".","_")}`,_={type:"sdxl_lora_loader",id:m,is_intermediate:!0,lora:{model_name:f,base_model:h},weight:p};a&&(a.loras||(a.loras=[]),a.loras.push({lora:{model_name:f,base_model:h},weight:p})),t.nodes[m]=_,c===0?(t.edges.push({source:{node_id:s,field:"unet"},destination:{node_id:m,field:"unet"}}),t.edges.push({source:{node_id:l,field:"clip"},destination:{node_id:m,field:"clip"}}),t.edges.push({source:{node_id:l,field:"clip2"},destination:{node_id:m,field:"clip2"}})):(t.edges.push({source:{node_id:u,field:"unet"},destination:{node_id:m,field:"unet"}}),t.edges.push({source:{node_id:u,field:"clip"},destination:{node_id:m,field:"clip"}}),t.edges.push({source:{node_id:u,field:"clip2"},destination:{node_id:m,field:"clip2"}})),c===o-1&&(t.edges.push({source:{node_id:m,field:"unet"},destination:{node_id:n,field:"unet"}}),t.id&&[fc,hc].includes(t.id)&&t.edges.push({source:{node_id:m,field:"unet"},destination:{node_id:gt,field:"unet"}}),t.edges.push({source:{node_id:m,field:"clip"},destination:{node_id:Be,field:"clip"}}),t.edges.push({source:{node_id:m,field:"clip"},destination:{node_id:We,field:"clip"}}),t.edges.push({source:{node_id:m,field:"clip2"},destination:{node_id:Be,field:"clip2"}}),t.edges.push({source:{node_id:m,field:"clip2"},destination:{node_id:We,field:"clip2"}})),u=m,c+=1})},Zd=(e,t)=>{const{positivePrompt:n,negativePrompt:r}=e.generation,{positiveStylePrompt:i,negativeStylePrompt:o,shouldConcatSDXLStylePrompt:a}=e.sdxl,s=a||t?[n,i].join(" "):i,l=a||t?[r,o].join(" "):o;return{joinedPositiveStylePrompt:s,joinedNegativeStylePrompt:l}},Pp=(e,t,n,r,i,o)=>{const{refinerModel:a,refinerPositiveAestheticScore:s,refinerNegativeAestheticScore:l,refinerSteps:u,refinerScheduler:c,refinerCFGScale:d,refinerStart:f}=e.sdxl,{seamlessXAxis:h,seamlessYAxis:p,vaePrecision:m}=e.generation,{boundingBoxScaleMethod:_}=e.canvas,b=m==="fp32",v=["auto","manual"].includes(_);if(!a)return;const g=t.nodes[pt];g&&(g.refiner_model=a,g.refiner_positive_aesthetic_score=s,g.refiner_negative_aesthetic_score=l,g.refiner_cfg_scale=d,g.refiner_scheduler=c,g.refiner_start=f,g.refiner_steps=u);const y=r||Vi,{joinedPositiveStylePrompt:S,joinedNegativeStylePrompt:w}=Zd(e,!0);t.edges=t.edges.filter(x=>!(x.source.node_id===n&&["latents"].includes(x.source.field))),t.edges=t.edges.filter(x=>!(x.source.node_id===y&&["vae"].includes(x.source.field))),t.nodes[Fc]={type:"sdxl_refiner_model_loader",id:Fc,model:a},t.nodes[qv]={type:"sdxl_refiner_compel_prompt",id:qv,style:S,aesthetic_score:s},t.nodes[Hv]={type:"sdxl_refiner_compel_prompt",id:Hv,style:w,aesthetic_score:l},t.nodes[bs]={type:"denoise_latents",id:bs,cfg_scale:d,steps:u,scheduler:c,denoising_start:f,denoising_end:1},h||p?(t.nodes[Qa]={id:Qa,type:"seamless",seamless_x:h,seamless_y:p},t.edges.push({source:{node_id:Fc,field:"unet"},destination:{node_id:Qa,field:"unet"}},{source:{node_id:Fc,field:"vae"},destination:{node_id:Qa,field:"vae"}},{source:{node_id:Qa,field:"unet"},destination:{node_id:bs,field:"unet"}})):t.edges.push({source:{node_id:Fc,field:"unet"},destination:{node_id:bs,field:"unet"}}),t.edges.push({source:{node_id:Fc,field:"clip2"},destination:{node_id:qv,field:"clip2"}},{source:{node_id:Fc,field:"clip2"},destination:{node_id:Hv,field:"clip2"}},{source:{node_id:qv,field:"conditioning"},destination:{node_id:bs,field:"positive_conditioning"}},{source:{node_id:Hv,field:"conditioning"},destination:{node_id:bs,field:"negative_conditioning"}},{source:{node_id:n,field:"latents"},destination:{node_id:bs,field:"latents"}}),(t.id===fc||t.id===hc)&&(t.nodes[ca]={type:"create_denoise_mask",id:ca,is_intermediate:!0,fp32:b},v?t.edges.push({source:{node_id:Ai,field:"image"},destination:{node_id:ca,field:"image"}}):t.nodes[ca]={...t.nodes[ca],image:i},t.id===fc&&(v?t.edges.push({source:{node_id:Mn,field:"image"},destination:{node_id:ca,field:"mask"}}):t.nodes[ca]={...t.nodes[ca],mask:o}),t.id===hc&&t.edges.push({source:{node_id:v?Mn:Ti,field:"image"},destination:{node_id:ca,field:"mask"}}),t.edges.push({source:{node_id:ca,field:"denoise_mask"},destination:{node_id:bs,field:"denoise_mask"}})),t.id===Yx||t.id===_0?t.edges.push({source:{node_id:bs,field:"latents"},destination:{node_id:v?Ke:ye,field:"latents"}}):t.edges.push({source:{node_id:bs,field:"latents"},destination:{node_id:Ke,field:"latents"}})},hEe=(e,t)=>{const n=_e("nodes"),{positivePrompt:r,negativePrompt:i,model:o,cfgScale:a,scheduler:s,seed:l,steps:u,vaePrecision:c,shouldUseCpuNoise:d,seamlessXAxis:f,seamlessYAxis:h}=e.generation,{shouldUseSDXLRefiner:p,refinerStart:m,sdxlImg2ImgDenoisingStrength:_}=e.sdxl,{width:b,height:v}=e.canvas.boundingBoxDimensions,{scaledBoundingBoxDimensions:g,boundingBoxScaleMethod:y}=e.canvas,S=c==="fp32",w=!0,x=["auto","manual"].includes(y);if(!o)throw n.error("No model found in state"),new Error("No model found in state");let C=Vi;const k=d,{joinedPositiveStylePrompt:T,joinedNegativeStylePrompt:P}=Zd(e),$={id:_0,nodes:{[C]:{type:"sdxl_model_loader",id:C,model:o},[Be]:{type:"sdxl_compel_prompt",id:Be,prompt:r,style:T},[We]:{type:"sdxl_compel_prompt",id:We,prompt:i,style:P},[Le]:{type:"noise",id:Le,is_intermediate:w,use_cpu:k,seed:l,width:x?g.width:b,height:x?g.height:v},[qn]:{type:"i2l",id:qn,is_intermediate:w,fp32:S},[Te]:{type:"denoise_latents",id:Te,is_intermediate:w,cfg_scale:a,scheduler:s,steps:u,denoising_start:p?Math.min(m,1-_):1-_,denoising_end:p?m:1}},edges:[{source:{node_id:C,field:"unet"},destination:{node_id:Te,field:"unet"}},{source:{node_id:C,field:"clip"},destination:{node_id:Be,field:"clip"}},{source:{node_id:C,field:"clip2"},destination:{node_id:Be,field:"clip2"}},{source:{node_id:C,field:"clip"},destination:{node_id:We,field:"clip"}},{source:{node_id:C,field:"clip2"},destination:{node_id:We,field:"clip2"}},{source:{node_id:Be,field:"conditioning"},destination:{node_id:Te,field:"positive_conditioning"}},{source:{node_id:We,field:"conditioning"},destination:{node_id:Te,field:"negative_conditioning"}},{source:{node_id:Le,field:"noise"},destination:{node_id:Te,field:"noise"}},{source:{node_id:qn,field:"latents"},destination:{node_id:Te,field:"latents"}}]};return x?($.nodes[bh]={id:bh,type:"img_resize",is_intermediate:w,image:t,width:g.width,height:g.height},$.nodes[Ke]={id:Ke,type:"l2i",is_intermediate:w,fp32:S},$.nodes[ye]={id:ye,type:"img_resize",is_intermediate:w,width:b,height:v},$.edges.push({source:{node_id:bh,field:"image"},destination:{node_id:qn,field:"image"}},{source:{node_id:Te,field:"latents"},destination:{node_id:Ke,field:"latents"}},{source:{node_id:Ke,field:"image"},destination:{node_id:ye,field:"image"}})):($.nodes[ye]={type:"l2i",id:ye,is_intermediate:w,fp32:S},$.nodes[qn].image=t,$.edges.push({source:{node_id:Te,field:"latents"},destination:{node_id:ye,field:"latents"}})),$.nodes[pt]={id:pt,type:"metadata_accumulator",generation_mode:"img2img",cfg_scale:a,width:x?g.width:b,height:x?g.height:v,positive_prompt:r,negative_prompt:i,model:o,seed:l,steps:u,rand_device:k?"cpu":"cuda",scheduler:s,vae:void 0,controlnets:[],loras:[],ipAdapters:[],strength:_,init_image:t.image_name},$.edges.push({source:{node_id:pt,field:"metadata"},destination:{node_id:ye,field:"metadata"}}),(f||h)&&(Oa(e,$,C),C=Hr),p&&(Pp(e,$,Te,C),(f||h)&&(C=Qa)),Ma(e,$,C),Ap(e,$,Te,C),Aa(e,$,Te),Pa(e,$,Te),e.system.shouldUseNSFWChecker&&Ia(e,$,ye),e.system.shouldUseWatermarker&&Na(e,$,ye),Ra(e,$),$},pEe=(e,t,n)=>{const r=_e("nodes"),{positivePrompt:i,negativePrompt:o,model:a,cfgScale:s,scheduler:l,steps:u,seed:c,vaePrecision:d,shouldUseCpuNoise:f,maskBlur:h,maskBlurMethod:p,canvasCoherenceMode:m,canvasCoherenceSteps:_,canvasCoherenceStrength:b,seamlessXAxis:v,seamlessYAxis:g}=e.generation,{sdxlImg2ImgDenoisingStrength:y,shouldUseSDXLRefiner:S,refinerStart:w}=e.sdxl;if(!a)throw r.error("No model found in state"),new Error("No model found in state");const{width:x,height:C}=e.canvas.boundingBoxDimensions,{scaledBoundingBoxDimensions:k,boundingBoxScaleMethod:T}=e.canvas,P=d==="fp32",$=!0,O=["auto","manual"].includes(T);let E=Vi;const A=f,{joinedPositiveStylePrompt:D,joinedNegativeStylePrompt:L}=Zd(e),M={id:fc,nodes:{[E]:{type:"sdxl_model_loader",id:E,model:a},[Be]:{type:"sdxl_compel_prompt",id:Be,prompt:i,style:D},[We]:{type:"sdxl_compel_prompt",id:We,prompt:o,style:L},[Ui]:{type:"img_blur",id:Ui,is_intermediate:$,radius:h,blur_type:p},[Wn]:{type:"i2l",id:Wn,is_intermediate:$,fp32:P},[Le]:{type:"noise",id:Le,use_cpu:A,seed:c,is_intermediate:$},[Hn]:{type:"create_denoise_mask",id:Hn,is_intermediate:$,fp32:P},[Te]:{type:"denoise_latents",id:Te,is_intermediate:$,steps:u,cfg_scale:s,scheduler:l,denoising_start:S?Math.min(w,1-y):1-y,denoising_end:S?w:1},[Ut]:{type:"noise",id:Ut,use_cpu:A,seed:c+1,is_intermediate:$},[dc]:{type:"add",id:dc,b:1,is_intermediate:$},[gt]:{type:"denoise_latents",id:gt,is_intermediate:$,steps:_,cfg_scale:s,scheduler:l,denoising_start:1-b,denoising_end:1},[Ke]:{type:"l2i",id:Ke,is_intermediate:$,fp32:P},[ye]:{type:"color_correct",id:ye,is_intermediate:$,reference:t}},edges:[{source:{node_id:E,field:"unet"},destination:{node_id:Te,field:"unet"}},{source:{node_id:E,field:"clip"},destination:{node_id:Be,field:"clip"}},{source:{node_id:E,field:"clip2"},destination:{node_id:Be,field:"clip2"}},{source:{node_id:E,field:"clip"},destination:{node_id:We,field:"clip"}},{source:{node_id:E,field:"clip2"},destination:{node_id:We,field:"clip2"}},{source:{node_id:Be,field:"conditioning"},destination:{node_id:Te,field:"positive_conditioning"}},{source:{node_id:We,field:"conditioning"},destination:{node_id:Te,field:"negative_conditioning"}},{source:{node_id:Le,field:"noise"},destination:{node_id:Te,field:"noise"}},{source:{node_id:Wn,field:"latents"},destination:{node_id:Te,field:"latents"}},{source:{node_id:Ui,field:"image"},destination:{node_id:Hn,field:"mask"}},{source:{node_id:Hn,field:"denoise_mask"},destination:{node_id:Te,field:"denoise_mask"}},{source:{node_id:E,field:"unet"},destination:{node_id:gt,field:"unet"}},{source:{node_id:Be,field:"conditioning"},destination:{node_id:gt,field:"positive_conditioning"}},{source:{node_id:We,field:"conditioning"},destination:{node_id:gt,field:"negative_conditioning"}},{source:{node_id:Ut,field:"noise"},destination:{node_id:gt,field:"noise"}},{source:{node_id:Te,field:"latents"},destination:{node_id:gt,field:"latents"}},{source:{node_id:gt,field:"latents"},destination:{node_id:Ke,field:"latents"}}]};if(O){const R=k.width,N=k.height;M.nodes[Ai]={type:"img_resize",id:Ai,is_intermediate:$,width:R,height:N,image:t},M.nodes[Mn]={type:"img_resize",id:Mn,is_intermediate:$,width:R,height:N,image:n},M.nodes[qi]={type:"img_resize",id:qi,is_intermediate:$,width:x,height:C},M.nodes[Hi]={type:"img_resize",id:Hi,is_intermediate:$,width:x,height:C},M.nodes[Le].width=R,M.nodes[Le].height=N,M.nodes[Ut].width=R,M.nodes[Ut].height=N,M.edges.push({source:{node_id:Ai,field:"image"},destination:{node_id:Wn,field:"image"}},{source:{node_id:Mn,field:"image"},destination:{node_id:Ui,field:"image"}},{source:{node_id:Ai,field:"image"},destination:{node_id:Hn,field:"image"}},{source:{node_id:Ke,field:"image"},destination:{node_id:qi,field:"image"}},{source:{node_id:qi,field:"image"},destination:{node_id:ye,field:"image"}},{source:{node_id:Ui,field:"image"},destination:{node_id:Hi,field:"image"}},{source:{node_id:Hi,field:"image"},destination:{node_id:ye,field:"mask"}})}else M.nodes[Le].width=x,M.nodes[Le].height=C,M.nodes[Ut].width=x,M.nodes[Ut].height=C,M.nodes[Wn]={...M.nodes[Wn],image:t},M.nodes[Ui]={...M.nodes[Ui],image:n},M.nodes[Hn]={...M.nodes[Hn],image:t},M.edges.push({source:{node_id:Ke,field:"image"},destination:{node_id:ye,field:"image"}},{source:{node_id:Ui,field:"image"},destination:{node_id:ye,field:"mask"}});return m!=="unmasked"&&(M.nodes[zt]={type:"create_denoise_mask",id:zt,is_intermediate:$,fp32:P},O?M.edges.push({source:{node_id:Ai,field:"image"},destination:{node_id:zt,field:"image"}}):M.nodes[zt]={...M.nodes[zt],image:t},m==="mask"&&(O?M.edges.push({source:{node_id:Mn,field:"image"},destination:{node_id:zt,field:"mask"}}):M.nodes[zt]={...M.nodes[zt],mask:n}),m==="edge"&&(M.nodes[mr]={type:"mask_edge",id:mr,is_intermediate:$,edge_blur:h,edge_size:h*2,low_threshold:100,high_threshold:200},O?M.edges.push({source:{node_id:Mn,field:"image"},destination:{node_id:mr,field:"image"}}):M.nodes[mr]={...M.nodes[mr],image:n},M.edges.push({source:{node_id:mr,field:"image"},destination:{node_id:zt,field:"mask"}})),M.edges.push({source:{node_id:zt,field:"denoise_mask"},destination:{node_id:gt,field:"denoise_mask"}})),(v||g)&&(Oa(e,M,E),E=Hr),S&&(Pp(e,M,gt,E,t,n),(v||g)&&(E=Qa)),Ma(e,M,E),Ap(e,M,Te,E),Aa(e,M,Te),Pa(e,M,Te),e.system.shouldUseNSFWChecker&&Ia(e,M,ye),e.system.shouldUseWatermarker&&Na(e,M,ye),Ra(e,M),M},gEe=(e,t,n)=>{const r=_e("nodes"),{positivePrompt:i,negativePrompt:o,model:a,cfgScale:s,scheduler:l,steps:u,seed:c,vaePrecision:d,shouldUseCpuNoise:f,maskBlur:h,canvasCoherenceMode:p,canvasCoherenceSteps:m,canvasCoherenceStrength:_,infillTileSize:b,infillPatchmatchDownscaleSize:v,infillMethod:g,seamlessXAxis:y,seamlessYAxis:S}=e.generation,{sdxlImg2ImgDenoisingStrength:w,shouldUseSDXLRefiner:x,refinerStart:C}=e.sdxl;if(!a)throw r.error("No model found in state"),new Error("No model found in state");const{width:k,height:T}=e.canvas.boundingBoxDimensions,{scaledBoundingBoxDimensions:P,boundingBoxScaleMethod:$}=e.canvas,O=d==="fp32",E=!0,A=["auto","manual"].includes($);let D=Vi;const L=f,{joinedPositiveStylePrompt:M,joinedNegativeStylePrompt:R}=Zd(e),N={id:hc,nodes:{[Vi]:{type:"sdxl_model_loader",id:Vi,model:a},[Be]:{type:"sdxl_compel_prompt",id:Be,prompt:i,style:M},[We]:{type:"sdxl_compel_prompt",id:We,prompt:o,style:R},[_h]:{type:"tomask",id:_h,is_intermediate:E,image:t},[Ti]:{type:"mask_combine",id:Ti,is_intermediate:E,mask2:n},[Wn]:{type:"i2l",id:Wn,is_intermediate:E,fp32:O},[Le]:{type:"noise",id:Le,use_cpu:L,seed:c,is_intermediate:E},[Hn]:{type:"create_denoise_mask",id:Hn,is_intermediate:E,fp32:O},[Te]:{type:"denoise_latents",id:Te,is_intermediate:E,steps:u,cfg_scale:s,scheduler:l,denoising_start:x?Math.min(C,1-w):1-w,denoising_end:x?C:1},[Ut]:{type:"noise",id:Ut,use_cpu:L,seed:c+1,is_intermediate:E},[dc]:{type:"add",id:dc,b:1,is_intermediate:E},[gt]:{type:"denoise_latents",id:gt,is_intermediate:E,steps:m,cfg_scale:s,scheduler:l,denoising_start:1-_,denoising_end:1},[Ke]:{type:"l2i",id:Ke,is_intermediate:E,fp32:O},[ye]:{type:"color_correct",id:ye,is_intermediate:E}},edges:[{source:{node_id:Vi,field:"unet"},destination:{node_id:Te,field:"unet"}},{source:{node_id:Vi,field:"clip"},destination:{node_id:Be,field:"clip"}},{source:{node_id:Vi,field:"clip2"},destination:{node_id:Be,field:"clip2"}},{source:{node_id:Vi,field:"clip"},destination:{node_id:We,field:"clip"}},{source:{node_id:Vi,field:"clip2"},destination:{node_id:We,field:"clip2"}},{source:{node_id:Wt,field:"image"},destination:{node_id:Wn,field:"image"}},{source:{node_id:_h,field:"image"},destination:{node_id:Ti,field:"mask1"}},{source:{node_id:Be,field:"conditioning"},destination:{node_id:Te,field:"positive_conditioning"}},{source:{node_id:We,field:"conditioning"},destination:{node_id:Te,field:"negative_conditioning"}},{source:{node_id:Le,field:"noise"},destination:{node_id:Te,field:"noise"}},{source:{node_id:Wn,field:"latents"},destination:{node_id:Te,field:"latents"}},{source:{node_id:A?Mn:Ti,field:"image"},destination:{node_id:Hn,field:"mask"}},{source:{node_id:Hn,field:"denoise_mask"},destination:{node_id:Te,field:"denoise_mask"}},{source:{node_id:D,field:"unet"},destination:{node_id:gt,field:"unet"}},{source:{node_id:Be,field:"conditioning"},destination:{node_id:gt,field:"positive_conditioning"}},{source:{node_id:We,field:"conditioning"},destination:{node_id:gt,field:"negative_conditioning"}},{source:{node_id:Ut,field:"noise"},destination:{node_id:gt,field:"noise"}},{source:{node_id:Te,field:"latents"},destination:{node_id:gt,field:"latents"}},{source:{node_id:Wt,field:"image"},destination:{node_id:Hn,field:"image"}},{source:{node_id:gt,field:"latents"},destination:{node_id:Ke,field:"latents"}}]};if(g==="patchmatch"&&(N.nodes[Wt]={type:"infill_patchmatch",id:Wt,is_intermediate:E,downscale:v}),g==="lama"&&(N.nodes[Wt]={type:"infill_lama",id:Wt,is_intermediate:E}),g==="cv2"&&(N.nodes[Wt]={type:"infill_cv2",id:Wt,is_intermediate:E}),g==="tile"&&(N.nodes[Wt]={type:"infill_tile",id:Wt,is_intermediate:E,tile_size:b}),A){const B=P.width,U=P.height;N.nodes[Ai]={type:"img_resize",id:Ai,is_intermediate:E,width:B,height:U,image:t},N.nodes[Mn]={type:"img_resize",id:Mn,is_intermediate:E,width:B,height:U},N.nodes[qi]={type:"img_resize",id:qi,is_intermediate:E,width:k,height:T},N.nodes[Lu]={type:"img_resize",id:Lu,is_intermediate:E,width:k,height:T},N.nodes[Hi]={type:"img_resize",id:Hi,is_intermediate:E,width:k,height:T},N.nodes[Le].width=B,N.nodes[Le].height=U,N.nodes[Ut].width=B,N.nodes[Ut].height=U,N.edges.push({source:{node_id:Ai,field:"image"},destination:{node_id:Wt,field:"image"}},{source:{node_id:Ti,field:"image"},destination:{node_id:Mn,field:"image"}},{source:{node_id:Ke,field:"image"},destination:{node_id:qi,field:"image"}},{source:{node_id:Mn,field:"image"},destination:{node_id:Hi,field:"image"}},{source:{node_id:Wt,field:"image"},destination:{node_id:Lu,field:"image"}},{source:{node_id:Lu,field:"image"},destination:{node_id:ye,field:"reference"}},{source:{node_id:qi,field:"image"},destination:{node_id:ye,field:"image"}},{source:{node_id:Hi,field:"image"},destination:{node_id:ye,field:"mask"}})}else N.nodes[Wt]={...N.nodes[Wt],image:t},N.nodes[Le].width=k,N.nodes[Le].height=T,N.nodes[Ut].width=k,N.nodes[Ut].height=T,N.nodes[Wn]={...N.nodes[Wn],image:t},N.edges.push({source:{node_id:Wt,field:"image"},destination:{node_id:ye,field:"reference"}},{source:{node_id:Ke,field:"image"},destination:{node_id:ye,field:"image"}},{source:{node_id:Ti,field:"image"},destination:{node_id:ye,field:"mask"}});return p!=="unmasked"&&(N.nodes[zt]={type:"create_denoise_mask",id:zt,is_intermediate:E,fp32:O},N.edges.push({source:{node_id:Wt,field:"image"},destination:{node_id:zt,field:"image"}}),p==="mask"&&(A?N.edges.push({source:{node_id:Mn,field:"image"},destination:{node_id:zt,field:"mask"}}):N.edges.push({source:{node_id:Ti,field:"image"},destination:{node_id:zt,field:"mask"}})),p==="edge"&&(N.nodes[mr]={type:"mask_edge",id:mr,is_intermediate:E,edge_blur:h,edge_size:h*2,low_threshold:100,high_threshold:200},A?N.edges.push({source:{node_id:Mn,field:"image"},destination:{node_id:mr,field:"image"}}):N.edges.push({source:{node_id:Ti,field:"image"},destination:{node_id:mr,field:"image"}}),N.edges.push({source:{node_id:mr,field:"image"},destination:{node_id:zt,field:"mask"}})),N.edges.push({source:{node_id:zt,field:"denoise_mask"},destination:{node_id:gt,field:"denoise_mask"}})),(y||S)&&(Oa(e,N,D),D=Hr),x&&(Pp(e,N,gt,D,t),(y||S)&&(D=Qa)),Ma(e,N,D),Ap(e,N,Te,D),Aa(e,N,Te),Pa(e,N,Te),e.system.shouldUseNSFWChecker&&Ia(e,N,ye),e.system.shouldUseWatermarker&&Na(e,N,ye),Ra(e,N),N},mEe=e=>{const t=_e("nodes"),{positivePrompt:n,negativePrompt:r,model:i,cfgScale:o,scheduler:a,seed:s,steps:l,vaePrecision:u,shouldUseCpuNoise:c,seamlessXAxis:d,seamlessYAxis:f}=e.generation,{width:h,height:p}=e.canvas.boundingBoxDimensions,{scaledBoundingBoxDimensions:m,boundingBoxScaleMethod:_}=e.canvas,b=u==="fp32",v=!0,g=["auto","manual"].includes(_),{shouldUseSDXLRefiner:y,refinerStart:S}=e.sdxl;if(!i)throw t.error("No model found in state"),new Error("No model found in state");const w=c,x=i.model_type==="onnx";let C=x?Kx:Vi;const k=x?"onnx_model_loader":"sdxl_model_loader",T=x?{type:"t2l_onnx",id:Te,is_intermediate:v,cfg_scale:o,scheduler:a,steps:l}:{type:"denoise_latents",id:Te,is_intermediate:v,cfg_scale:o,scheduler:a,steps:l,denoising_start:0,denoising_end:y?S:1},{joinedPositiveStylePrompt:P,joinedNegativeStylePrompt:$}=Zd(e),O={id:Yx,nodes:{[C]:{type:k,id:C,is_intermediate:v,model:i},[Be]:{type:x?"prompt_onnx":"sdxl_compel_prompt",id:Be,is_intermediate:v,prompt:n,style:P},[We]:{type:x?"prompt_onnx":"sdxl_compel_prompt",id:We,is_intermediate:v,prompt:r,style:$},[Le]:{type:"noise",id:Le,is_intermediate:v,seed:s,width:g?m.width:h,height:g?m.height:p,use_cpu:w},[T.id]:T},edges:[{source:{node_id:C,field:"unet"},destination:{node_id:Te,field:"unet"}},{source:{node_id:C,field:"clip"},destination:{node_id:Be,field:"clip"}},{source:{node_id:C,field:"clip2"},destination:{node_id:Be,field:"clip2"}},{source:{node_id:C,field:"clip"},destination:{node_id:We,field:"clip"}},{source:{node_id:C,field:"clip2"},destination:{node_id:We,field:"clip2"}},{source:{node_id:Be,field:"conditioning"},destination:{node_id:Te,field:"positive_conditioning"}},{source:{node_id:We,field:"conditioning"},destination:{node_id:Te,field:"negative_conditioning"}},{source:{node_id:Le,field:"noise"},destination:{node_id:Te,field:"noise"}}]};return g?(O.nodes[Ke]={id:Ke,type:x?"l2i_onnx":"l2i",is_intermediate:v,fp32:b},O.nodes[ye]={id:ye,type:"img_resize",is_intermediate:v,width:h,height:p},O.edges.push({source:{node_id:Te,field:"latents"},destination:{node_id:Ke,field:"latents"}},{source:{node_id:Ke,field:"image"},destination:{node_id:ye,field:"image"}})):(O.nodes[ye]={type:x?"l2i_onnx":"l2i",id:ye,is_intermediate:v,fp32:b},O.edges.push({source:{node_id:Te,field:"latents"},destination:{node_id:ye,field:"latents"}})),O.nodes[pt]={id:pt,type:"metadata_accumulator",generation_mode:"txt2img",cfg_scale:o,width:g?m.width:h,height:g?m.height:p,positive_prompt:n,negative_prompt:r,model:i,seed:s,steps:l,rand_device:w?"cpu":"cuda",scheduler:a,vae:void 0,controlnets:[],loras:[],ipAdapters:[]},O.edges.push({source:{node_id:pt,field:"metadata"},destination:{node_id:ye,field:"metadata"}}),(d||f)&&(Oa(e,O,C),C=Hr),y&&(Pp(e,O,Te,C),(d||f)&&(C=Qa)),Ap(e,O,Te,C),Ma(e,O,C),Aa(e,O,Te),Pa(e,O,Te),e.system.shouldUseNSFWChecker&&Ia(e,O,ye),e.system.shouldUseWatermarker&&Na(e,O,ye),Ra(e,O),O},yEe=e=>{const t=_e("nodes"),{positivePrompt:n,negativePrompt:r,model:i,cfgScale:o,scheduler:a,seed:s,steps:l,vaePrecision:u,clipSkip:c,shouldUseCpuNoise:d,seamlessXAxis:f,seamlessYAxis:h}=e.generation,{width:p,height:m}=e.canvas.boundingBoxDimensions,{scaledBoundingBoxDimensions:_,boundingBoxScaleMethod:b}=e.canvas,v=u==="fp32",g=!0,y=["auto","manual"].includes(b);if(!i)throw t.error("No model found in state"),new Error("No model found in state");const S=d,w=i.model_type==="onnx";let x=w?Kx:Ic;const C=w?"onnx_model_loader":"main_model_loader",k=w?{type:"t2l_onnx",id:Oe,is_intermediate:g,cfg_scale:o,scheduler:a,steps:l}:{type:"denoise_latents",id:Oe,is_intermediate:g,cfg_scale:o,scheduler:a,steps:l,denoising_start:0,denoising_end:1},T={id:tq,nodes:{[x]:{type:C,id:x,is_intermediate:g,model:i},[Yt]:{type:"clip_skip",id:Yt,is_intermediate:g,skipped_layers:c},[Be]:{type:w?"prompt_onnx":"compel",id:Be,is_intermediate:g,prompt:n},[We]:{type:w?"prompt_onnx":"compel",id:We,is_intermediate:g,prompt:r},[Le]:{type:"noise",id:Le,is_intermediate:g,seed:s,width:y?_.width:p,height:y?_.height:m,use_cpu:S},[k.id]:k},edges:[{source:{node_id:x,field:"unet"},destination:{node_id:Oe,field:"unet"}},{source:{node_id:x,field:"clip"},destination:{node_id:Yt,field:"clip"}},{source:{node_id:Yt,field:"clip"},destination:{node_id:Be,field:"clip"}},{source:{node_id:Yt,field:"clip"},destination:{node_id:We,field:"clip"}},{source:{node_id:Be,field:"conditioning"},destination:{node_id:Oe,field:"positive_conditioning"}},{source:{node_id:We,field:"conditioning"},destination:{node_id:Oe,field:"negative_conditioning"}},{source:{node_id:Le,field:"noise"},destination:{node_id:Oe,field:"noise"}}]};return y?(T.nodes[Ke]={id:Ke,type:w?"l2i_onnx":"l2i",is_intermediate:g,fp32:v},T.nodes[ye]={id:ye,type:"img_resize",is_intermediate:g,width:p,height:m},T.edges.push({source:{node_id:Oe,field:"latents"},destination:{node_id:Ke,field:"latents"}},{source:{node_id:Ke,field:"image"},destination:{node_id:ye,field:"image"}})):(T.nodes[ye]={type:w?"l2i_onnx":"l2i",id:ye,is_intermediate:g,fp32:v},T.edges.push({source:{node_id:Oe,field:"latents"},destination:{node_id:ye,field:"latents"}})),T.nodes[pt]={id:pt,type:"metadata_accumulator",generation_mode:"txt2img",cfg_scale:o,width:y?_.width:p,height:y?_.height:m,positive_prompt:n,negative_prompt:r,model:i,seed:s,steps:l,rand_device:S?"cpu":"cuda",scheduler:a,vae:void 0,controlnets:[],loras:[],ipAdapters:[],clip_skip:c},T.edges.push({source:{node_id:pt,field:"metadata"},destination:{node_id:ye,field:"metadata"}}),(f||h)&&(Oa(e,T,x),x=Hr),Ma(e,T,x),kp(e,T,Oe,x),Aa(e,T,Oe),Pa(e,T,Oe),e.system.shouldUseNSFWChecker&&Ia(e,T,ye),e.system.shouldUseWatermarker&&Na(e,T,ye),Ra(e,T),T},vEe=(e,t,n,r)=>{let i;if(t==="txt2img")e.generation.model&&e.generation.model.base_model==="sdxl"?i=mEe(e):i=yEe(e);else if(t==="img2img"){if(!n)throw new Error("Missing canvas init image");e.generation.model&&e.generation.model.base_model==="sdxl"?i=hEe(e,n):i=cEe(e,n)}else if(t==="inpaint"){if(!n||!r)throw new Error("Missing canvas init and mask images");e.generation.model&&e.generation.model.base_model==="sdxl"?i=pEe(e,n,r):i=dEe(e,n,r)}else{if(!n)throw new Error("Missing canvas init image");e.generation.model&&e.generation.model.base_model==="sdxl"?i=gEe(e,n,r):i=fEe(e,n,r)}return i},i5=({count:e,start:t,min:n=Lae,max:r=qg})=>{const i=t??hae(n,r),o=[];for(let a=i;a{const{iterations:r,model:i,shouldRandomizeSeed:o,seed:a}=e.generation,{shouldConcatSDXLStylePrompt:s,positiveStylePrompt:l}=e.sdxl,{prompts:u,seedBehaviour:c}=e.dynamicPrompts,d=[];if(u.length===1){Y8(t.nodes[pt],"seed");const h=i5({count:r,start:o?void 0:a}),p=[];t.nodes[Le]&&p.push({node_path:Le,field_name:"seed",items:h}),t.nodes[pt]&&p.push({node_path:pt,field_name:"seed",items:h}),t.nodes[Ut]&&p.push({node_path:Ut,field_name:"seed",items:h.map(m=>(m+1)%qg)}),d.push(p)}else{const h=[],p=[];if(c==="PER_PROMPT"){const _=i5({count:u.length*r,start:o?void 0:a});t.nodes[Le]&&h.push({node_path:Le,field_name:"seed",items:_}),t.nodes[pt]&&h.push({node_path:pt,field_name:"seed",items:_}),t.nodes[Ut]&&h.push({node_path:Ut,field_name:"seed",items:_.map(b=>(b+1)%qg)})}else{const _=i5({count:r,start:o?void 0:a});t.nodes[Le]&&p.push({node_path:Le,field_name:"seed",items:_}),t.nodes[pt]&&p.push({node_path:pt,field_name:"seed",items:_}),t.nodes[Ut]&&p.push({node_path:Ut,field_name:"seed",items:_.map(b=>(b+1)%qg)}),d.push(p)}const m=c==="PER_PROMPT"?bae(r).flatMap(()=>u):u;if(t.nodes[Be]&&h.push({node_path:Be,field_name:"prompt",items:m}),t.nodes[pt]&&h.push({node_path:pt,field_name:"positive_prompt",items:m}),s&&(i==null?void 0:i.base_model)==="sdxl"){Y8(t.nodes[pt],"positive_style_prompt");const _=m.map(b=>[b,l].join(" "));t.nodes[Be]&&h.push({node_path:Be,field_name:"style",items:_}),t.nodes[pt]&&h.push({node_path:pt,field_name:"positive_style_prompt",items:_})}d.push(h)}return{prepend:n,batch:{graph:t,runs:1,data:d}}},bEe=()=>{Fe({predicate:e=>$A.match(e)&&e.payload.tabName==="unifiedCanvas",effect:async(e,{getState:t,dispatch:n})=>{const r=_e("queue"),{prepend:i}=e.payload,o=t(),{layerState:a,boundingBoxCoordinates:s,boundingBoxDimensions:l,isMaskEnabled:u,shouldPreserveMaskedArea:c}=o.canvas,d=await MA(a,s,l,u,c);if(!d){r.error("Unable to create canvas data");return}const{baseBlob:f,baseImageData:h,maskBlob:p,maskImageData:m}=d,_=sEe(h,m);if(o.system.enableImageDebugging){const S=await LO(f),w=await LO(p);iEe([{base64:w,caption:"mask b64"},{base64:S,caption:"image b64"}])}r.debug(`Generation mode: ${_}`);let b,v;["img2img","inpaint","outpaint"].includes(_)&&(b=await n(me.endpoints.uploadImage.initiate({file:new File([f],"canvasInitImage.png",{type:"image/png"}),image_category:"general",is_intermediate:!0})).unwrap()),["inpaint","outpaint"].includes(_)&&(v=await n(me.endpoints.uploadImage.initiate({file:new File([p],"canvasMaskImage.png",{type:"image/png"}),image_category:"mask",is_intermediate:!0})).unwrap());const g=vEe(o,_,b,v);r.debug({graph:Qt(g)},"Canvas graph built"),n(fG(g));const y=rq(o,g,i);try{const S=n(Qr.endpoints.enqueueBatch.initiate(y,{fixedCacheKey:"enqueueBatch"})),w=await S.unwrap();S.reset();const x=w.batch.batch_id;o.canvas.layerState.stagingArea.boundingBox||n(fle({boundingBox:{...o.canvas.boundingBoxCoordinates,...o.canvas.boundingBoxDimensions}})),n(hle(x))}catch{}}})},_Ee=e=>{const t=_e("nodes"),{positivePrompt:n,negativePrompt:r,model:i,cfgScale:o,scheduler:a,seed:s,steps:l,initialImage:u,img2imgStrength:c,shouldFitToWidthHeight:d,width:f,height:h,clipSkip:p,shouldUseCpuNoise:m,vaePrecision:_,seamlessXAxis:b,seamlessYAxis:v}=e.generation;if(!u)throw t.error("No initial image found in state"),new Error("No initial image found in state");if(!i)throw t.error("No model found in state"),new Error("No model found in state");const g=_==="fp32",y=!0;let S=Ic;const w=m,x={id:eT,nodes:{[S]:{type:"main_model_loader",id:S,model:i,is_intermediate:y},[Yt]:{type:"clip_skip",id:Yt,skipped_layers:p,is_intermediate:y},[Be]:{type:"compel",id:Be,prompt:n,is_intermediate:y},[We]:{type:"compel",id:We,prompt:r,is_intermediate:y},[Le]:{type:"noise",id:Le,use_cpu:w,seed:s,is_intermediate:y},[Ke]:{type:"l2i",id:Ke,fp32:g,is_intermediate:y},[Oe]:{type:"denoise_latents",id:Oe,cfg_scale:o,scheduler:a,steps:l,denoising_start:1-c,denoising_end:1,is_intermediate:y},[qn]:{type:"i2l",id:qn,fp32:g,is_intermediate:y}},edges:[{source:{node_id:S,field:"unet"},destination:{node_id:Oe,field:"unet"}},{source:{node_id:S,field:"clip"},destination:{node_id:Yt,field:"clip"}},{source:{node_id:Yt,field:"clip"},destination:{node_id:Be,field:"clip"}},{source:{node_id:Yt,field:"clip"},destination:{node_id:We,field:"clip"}},{source:{node_id:Be,field:"conditioning"},destination:{node_id:Oe,field:"positive_conditioning"}},{source:{node_id:We,field:"conditioning"},destination:{node_id:Oe,field:"negative_conditioning"}},{source:{node_id:Le,field:"noise"},destination:{node_id:Oe,field:"noise"}},{source:{node_id:qn,field:"latents"},destination:{node_id:Oe,field:"latents"}},{source:{node_id:Oe,field:"latents"},destination:{node_id:Ke,field:"latents"}}]};if(d&&(u.width!==f||u.height!==h)){const C={id:Os,type:"img_resize",image:{image_name:u.imageName},is_intermediate:!0,width:f,height:h};x.nodes[Os]=C,x.edges.push({source:{node_id:Os,field:"image"},destination:{node_id:qn,field:"image"}}),x.edges.push({source:{node_id:Os,field:"width"},destination:{node_id:Le,field:"width"}}),x.edges.push({source:{node_id:Os,field:"height"},destination:{node_id:Le,field:"height"}})}else x.nodes[qn].image={image_name:u.imageName},x.edges.push({source:{node_id:qn,field:"width"},destination:{node_id:Le,field:"width"}}),x.edges.push({source:{node_id:qn,field:"height"},destination:{node_id:Le,field:"height"}});return x.nodes[pt]={id:pt,type:"metadata_accumulator",generation_mode:"img2img",cfg_scale:o,height:h,width:f,positive_prompt:n,negative_prompt:r,model:i,seed:s,steps:l,rand_device:w?"cpu":"cuda",scheduler:a,vae:void 0,controlnets:[],loras:[],ipAdapters:[],clip_skip:p,strength:c,init_image:u.imageName},x.edges.push({source:{node_id:pt,field:"metadata"},destination:{node_id:Ke,field:"metadata"}}),(b||v)&&(Oa(e,x,S),S=Hr),Ma(e,x,S),kp(e,x,Oe,S),Aa(e,x,Oe),Pa(e,x,Oe),e.system.shouldUseNSFWChecker&&Ia(e,x),e.system.shouldUseWatermarker&&Na(e,x),Ra(e,x),x},SEe=e=>{const t=_e("nodes"),{positivePrompt:n,negativePrompt:r,model:i,cfgScale:o,scheduler:a,seed:s,steps:l,initialImage:u,shouldFitToWidthHeight:c,width:d,height:f,shouldUseCpuNoise:h,vaePrecision:p,seamlessXAxis:m,seamlessYAxis:_}=e.generation,{positiveStylePrompt:b,negativeStylePrompt:v,shouldUseSDXLRefiner:g,refinerStart:y,sdxlImg2ImgDenoisingStrength:S}=e.sdxl;if(!u)throw t.error("No initial image found in state"),new Error("No initial image found in state");if(!i)throw t.error("No model found in state"),new Error("No model found in state");const w=p==="fp32",x=!0;let C=Vi;const k=h,{joinedPositiveStylePrompt:T,joinedNegativeStylePrompt:P}=Zd(e),$={id:j_,nodes:{[C]:{type:"sdxl_model_loader",id:C,model:i,is_intermediate:x},[Be]:{type:"sdxl_compel_prompt",id:Be,prompt:n,style:T,is_intermediate:x},[We]:{type:"sdxl_compel_prompt",id:We,prompt:r,style:P,is_intermediate:x},[Le]:{type:"noise",id:Le,use_cpu:k,seed:s,is_intermediate:x},[Ke]:{type:"l2i",id:Ke,fp32:w,is_intermediate:x},[Te]:{type:"denoise_latents",id:Te,cfg_scale:o,scheduler:a,steps:l,denoising_start:g?Math.min(y,1-S):1-S,denoising_end:g?y:1,is_intermediate:x},[qn]:{type:"i2l",id:qn,fp32:w,is_intermediate:x}},edges:[{source:{node_id:C,field:"unet"},destination:{node_id:Te,field:"unet"}},{source:{node_id:C,field:"clip"},destination:{node_id:Be,field:"clip"}},{source:{node_id:C,field:"clip2"},destination:{node_id:Be,field:"clip2"}},{source:{node_id:C,field:"clip"},destination:{node_id:We,field:"clip"}},{source:{node_id:C,field:"clip2"},destination:{node_id:We,field:"clip2"}},{source:{node_id:Be,field:"conditioning"},destination:{node_id:Te,field:"positive_conditioning"}},{source:{node_id:We,field:"conditioning"},destination:{node_id:Te,field:"negative_conditioning"}},{source:{node_id:Le,field:"noise"},destination:{node_id:Te,field:"noise"}},{source:{node_id:qn,field:"latents"},destination:{node_id:Te,field:"latents"}},{source:{node_id:Te,field:"latents"},destination:{node_id:Ke,field:"latents"}}]};if(c&&(u.width!==d||u.height!==f)){const O={id:Os,type:"img_resize",image:{image_name:u.imageName},is_intermediate:!0,width:d,height:f};$.nodes[Os]=O,$.edges.push({source:{node_id:Os,field:"image"},destination:{node_id:qn,field:"image"}}),$.edges.push({source:{node_id:Os,field:"width"},destination:{node_id:Le,field:"width"}}),$.edges.push({source:{node_id:Os,field:"height"},destination:{node_id:Le,field:"height"}})}else $.nodes[qn].image={image_name:u.imageName},$.edges.push({source:{node_id:qn,field:"width"},destination:{node_id:Le,field:"width"}}),$.edges.push({source:{node_id:qn,field:"height"},destination:{node_id:Le,field:"height"}});return $.nodes[pt]={id:pt,type:"metadata_accumulator",generation_mode:"sdxl_img2img",cfg_scale:o,height:f,width:d,positive_prompt:n,negative_prompt:r,model:i,seed:s,steps:l,rand_device:k?"cpu":"cuda",scheduler:a,vae:void 0,controlnets:[],loras:[],ipAdapters:[],strength:S,init_image:u.imageName,positive_style_prompt:b,negative_style_prompt:v},$.edges.push({source:{node_id:pt,field:"metadata"},destination:{node_id:Ke,field:"metadata"}}),(m||_)&&(Oa(e,$,C),C=Hr),g&&(Pp(e,$,Te),(m||_)&&(C=Qa)),Ma(e,$,C),Ap(e,$,Te,C),Aa(e,$,Te),Pa(e,$,Te),e.system.shouldUseNSFWChecker&&Ia(e,$),e.system.shouldUseWatermarker&&Na(e,$),Ra(e,$),$},xEe=e=>{const t=_e("nodes"),{positivePrompt:n,negativePrompt:r,model:i,cfgScale:o,scheduler:a,seed:s,steps:l,width:u,height:c,shouldUseCpuNoise:d,vaePrecision:f,seamlessXAxis:h,seamlessYAxis:p}=e.generation,{positiveStylePrompt:m,negativeStylePrompt:_,shouldUseSDXLRefiner:b,refinerStart:v}=e.sdxl,g=d;if(!i)throw t.error("No model found in state"),new Error("No model found in state");const y=f==="fp32",S=!0,{joinedPositiveStylePrompt:w,joinedNegativeStylePrompt:x}=Zd(e);let C=Vi;const k={id:NA,nodes:{[C]:{type:"sdxl_model_loader",id:C,model:i,is_intermediate:S},[Be]:{type:"sdxl_compel_prompt",id:Be,prompt:n,style:w,is_intermediate:S},[We]:{type:"sdxl_compel_prompt",id:We,prompt:r,style:x,is_intermediate:S},[Le]:{type:"noise",id:Le,seed:s,width:u,height:c,use_cpu:g,is_intermediate:S},[Te]:{type:"denoise_latents",id:Te,cfg_scale:o,scheduler:a,steps:l,denoising_start:0,denoising_end:b?v:1,is_intermediate:S},[Ke]:{type:"l2i",id:Ke,fp32:y,is_intermediate:S}},edges:[{source:{node_id:C,field:"unet"},destination:{node_id:Te,field:"unet"}},{source:{node_id:C,field:"clip"},destination:{node_id:Be,field:"clip"}},{source:{node_id:C,field:"clip2"},destination:{node_id:Be,field:"clip2"}},{source:{node_id:C,field:"clip"},destination:{node_id:We,field:"clip"}},{source:{node_id:C,field:"clip2"},destination:{node_id:We,field:"clip2"}},{source:{node_id:Be,field:"conditioning"},destination:{node_id:Te,field:"positive_conditioning"}},{source:{node_id:We,field:"conditioning"},destination:{node_id:Te,field:"negative_conditioning"}},{source:{node_id:Le,field:"noise"},destination:{node_id:Te,field:"noise"}},{source:{node_id:Te,field:"latents"},destination:{node_id:Ke,field:"latents"}}]};return k.nodes[pt]={id:pt,type:"metadata_accumulator",generation_mode:"sdxl_txt2img",cfg_scale:o,height:c,width:u,positive_prompt:n,negative_prompt:r,model:i,seed:s,steps:l,rand_device:g?"cpu":"cuda",scheduler:a,vae:void 0,controlnets:[],loras:[],ipAdapters:[],positive_style_prompt:m,negative_style_prompt:_},k.edges.push({source:{node_id:pt,field:"metadata"},destination:{node_id:Ke,field:"metadata"}}),(h||p)&&(Oa(e,k,C),C=Hr),b&&(Pp(e,k,Te),(h||p)&&(C=Qa)),Ma(e,k,C),Ap(e,k,Te,C),Aa(e,k,Te),Pa(e,k,Te),e.system.shouldUseNSFWChecker&&Ia(e,k),e.system.shouldUseWatermarker&&Na(e,k),Ra(e,k),k},wEe=e=>{const t=_e("nodes"),{positivePrompt:n,negativePrompt:r,model:i,cfgScale:o,scheduler:a,steps:s,width:l,height:u,clipSkip:c,shouldUseCpuNoise:d,vaePrecision:f,seamlessXAxis:h,seamlessYAxis:p,seed:m}=e.generation,_=d;if(!i)throw t.error("No model found in state"),new Error("No model found in state");const b=f==="fp32",v=!0,g=i.model_type==="onnx";let y=g?Kx:Ic;const S=g?"onnx_model_loader":"main_model_loader",w=g?{type:"t2l_onnx",id:Oe,is_intermediate:v,cfg_scale:o,scheduler:a,steps:s}:{type:"denoise_latents",id:Oe,is_intermediate:v,cfg_scale:o,scheduler:a,steps:s,denoising_start:0,denoising_end:1},x={id:eq,nodes:{[y]:{type:S,id:y,is_intermediate:v,model:i},[Yt]:{type:"clip_skip",id:Yt,skipped_layers:c,is_intermediate:v},[Be]:{type:g?"prompt_onnx":"compel",id:Be,prompt:n,is_intermediate:v},[We]:{type:g?"prompt_onnx":"compel",id:We,prompt:r,is_intermediate:v},[Le]:{type:"noise",id:Le,seed:m,width:l,height:u,use_cpu:_,is_intermediate:v},[w.id]:w,[Ke]:{type:g?"l2i_onnx":"l2i",id:Ke,fp32:b,is_intermediate:v}},edges:[{source:{node_id:y,field:"unet"},destination:{node_id:Oe,field:"unet"}},{source:{node_id:y,field:"clip"},destination:{node_id:Yt,field:"clip"}},{source:{node_id:Yt,field:"clip"},destination:{node_id:Be,field:"clip"}},{source:{node_id:Yt,field:"clip"},destination:{node_id:We,field:"clip"}},{source:{node_id:Be,field:"conditioning"},destination:{node_id:Oe,field:"positive_conditioning"}},{source:{node_id:We,field:"conditioning"},destination:{node_id:Oe,field:"negative_conditioning"}},{source:{node_id:Le,field:"noise"},destination:{node_id:Oe,field:"noise"}},{source:{node_id:Oe,field:"latents"},destination:{node_id:Ke,field:"latents"}}]};return x.nodes[pt]={id:pt,type:"metadata_accumulator",generation_mode:"txt2img",cfg_scale:o,height:u,width:l,positive_prompt:n,negative_prompt:r,model:i,seed:m,steps:s,rand_device:_?"cpu":"cuda",scheduler:a,vae:void 0,controlnets:[],loras:[],ipAdapters:[],clip_skip:c},x.edges.push({source:{node_id:pt,field:"metadata"},destination:{node_id:Ke,field:"metadata"}}),(h||p)&&(Oa(e,x,y),y=Hr),Ma(e,x,y),kp(e,x,Oe,y),Aa(e,x,Oe),Pa(e,x,Oe),e.system.shouldUseNSFWChecker&&Ia(e,x),e.system.shouldUseWatermarker&&Na(e,x),Ra(e,x),x},CEe=()=>{Fe({predicate:e=>$A.match(e)&&(e.payload.tabName==="txt2img"||e.payload.tabName==="img2img"),effect:async(e,{getState:t,dispatch:n})=>{const r=t(),i=r.generation.model,{prepend:o}=e.payload;let a;i&&i.base_model==="sdxl"?e.payload.tabName==="txt2img"?a=xEe(r):a=SEe(r):e.payload.tabName==="txt2img"?a=wEe(r):a=_Ee(r);const s=rq(r,a,o);n(Qr.endpoints.enqueueBatch.initiate(s,{fixedCacheKey:"enqueueBatch"})).reset()}})},EEe=/[$_\p{ID_Start}][$\u200c\u200d\p{ID_Continue}]*/u;function TEe(e){return e.length===1?e[0].toString():e.reduce((t,n)=>{if(typeof n=="number")return t+"["+n.toString()+"]";if(n.includes('"'))return t+'["'+kEe(n)+'"]';if(!EEe.test(n))return t+'["'+n+'"]';const r=t.length===0?"":".";return t+r+n},"")}function kEe(e){return e.replace(/"/g,'\\"')}function AEe(e){return e.length!==0}const PEe=99,iq="; ",oq=", or ",LA="Validation error",aq=": ";class sq extends Error{constructor(n,r=[]){super(n);Sw(this,"details");Sw(this,"name");this.details=r,this.name="ZodValidationError"}toString(){return this.message}}function FA(e,t,n){if(e.code==="invalid_union")return e.unionErrors.reduce((r,i)=>{const o=i.issues.map(a=>FA(a,t,n)).join(t);return r.includes(o)||r.push(o),r},[]).join(n);if(AEe(e.path)){if(e.path.length===1){const r=e.path[0];if(typeof r=="number")return`${e.message} at index ${r}`}return`${e.message} at "${TEe(e.path)}"`}return e.message}function lq(e,t,n){return t!==null?e.length>0?[t,e].join(n):t:e.length>0?e:LA}function cKe(e,t={}){const{issueSeparator:n=iq,unionSeparator:r=oq,prefixSeparator:i=aq,prefix:o=LA}=t,a=FA(e,n,r),s=lq(a,o,i);return new sq(s,[e])}function FO(e,t={}){const{maxIssuesInMessage:n=PEe,issueSeparator:r=iq,unionSeparator:i=oq,prefixSeparator:o=aq,prefix:a=LA}=t,s=e.errors.slice(0,n).map(u=>FA(u,r,i)).join(r),l=lq(s,a,o);return new sq(l,e.errors)}const IEe=e=>{const{workflow:t,nodes:n,edges:r}=e,i={...t,nodes:[],edges:[]};return n.filter(o=>["invocation","notes"].includes(o.type??"__UNKNOWN_NODE_TYPE__")).forEach(o=>{const a=qB.safeParse(o);if(!a.success){const{message:s}=FO(a.error,{prefix:be.t("nodes.unableToParseNode")});_e("nodes").warn({node:Qt(o)},s);return}i.nodes.push(a.data)}),r.forEach(o=>{const a=HB.safeParse(o);if(!a.success){const{message:s}=FO(a.error,{prefix:be.t("nodes.unableToParseEdge")});_e("nodes").warn({edge:Qt(o)},s);return}i.edges.push(a.data)}),i},REe=e=>{if(e.type==="ColorField"&&e.value){const t=wn(e.value),{r:n,g:r,b:i,a:o}=e.value,a=Math.max(0,Math.min(o*255,255));return Object.assign(t,{r:n,g:r,b:i,a}),t}return e.value},OEe=e=>{const{nodes:t,edges:n}=e,r=t.filter(jr),i=JSON.stringify(IEe(e)),o=r.reduce((u,c)=>{const{id:d,data:f}=c,{type:h,inputs:p,isIntermediate:m,embedWorkflow:_}=f,b=J3(p,(g,y,S)=>{const w=REe(y);return g[S]=w,g},{});b.use_cache=c.data.useCache;const v={type:h,id:d,...b,is_intermediate:m};return _&&Object.assign(v,{workflow:i}),Object.assign(u,{[d]:v}),u},{}),s=n.filter(u=>u.type!=="collapsed").reduce((u,c)=>{const{source:d,target:f,sourceHandle:h,targetHandle:p}=c;return u.push({source:{node_id:d,field:h},destination:{node_id:f,field:p}}),u},[]);return s.forEach(u=>{const c=o[u.destination.node_id],d=u.destination.field;o[u.destination.node_id]=WS(c,d)}),{id:LV(),nodes:o,edges:s}},MEe=()=>{Fe({predicate:e=>$A.match(e)&&e.payload.tabName==="nodes",effect:async(e,{getState:t,dispatch:n})=>{const r=t(),o={batch:{graph:OEe(r.nodes),runs:r.generation.iterations},prepend:e.payload.prepend};n(Qr.endpoints.enqueueBatch.initiate(o,{fixedCacheKey:"enqueueBatch"})).reset()}})},NEe=()=>{Fe({matcher:me.endpoints.addImageToBoard.matchFulfilled,effect:e=>{const t=_e("images"),{board_id:n,imageDTO:r}=e.meta.arg.originalArgs;t.debug({board_id:n,imageDTO:r},"Image added to board")}})},$Ee=()=>{Fe({matcher:me.endpoints.addImageToBoard.matchRejected,effect:e=>{const t=_e("images"),{board_id:n,imageDTO:r}=e.meta.arg.originalArgs;t.debug({board_id:n,imageDTO:r},"Problem adding image to board")}})},BA=Ne("deleteImageModal/imageDeletionConfirmed"),dKe=Ii(e=>e,e=>e.gallery.selection[e.gallery.selection.length-1],J2),uq=Ii([e=>e],e=>{const{selectedBoardId:t,galleryView:n}=e.gallery;return{board_id:t,categories:n==="images"?ii:$u,offset:0,limit:_le,is_intermediate:!1}},J2),DEe=()=>{Fe({actionCreator:BA,effect:async(e,{dispatch:t,getState:n,condition:r})=>{var f;const{imageDTOs:i,imagesUsage:o}=e.payload;if(i.length!==1||o.length!==1)return;const a=i[0],s=o[0];if(!a||!s)return;t(Qk(!1));const l=n(),u=(f=l.gallery.selection[l.gallery.selection.length-1])==null?void 0:f.image_name;if(a&&(a==null?void 0:a.image_name)===u){const{image_name:h}=a,p=uq(l),{data:m}=me.endpoints.listImages.select(p)(l),_=m?Vn.getSelectors().selectAll(m):[],b=_.findIndex(S=>S.image_name===h),v=_.filter(S=>S.image_name!==h),g=Mu(b,0,v.length-1),y=v[g];t(Vs(y||null))}s.isCanvasImage&&t(yk()),i.forEach(h=>{var p;((p=n().generation.initialImage)==null?void 0:p.imageName)===h.image_name&&t(mk()),Ca(n().controlNet.controlNets,m=>{(m.controlImage===h.image_name||m.processedControlImage===h.image_name)&&(t(Cc({controlNetId:m.controlNetId,controlImage:null})),t(Kk({controlNetId:m.controlNetId,processedControlImage:null})))}),n().controlNet.ipAdapterInfo.adapterImage===h.image_name&&t(G2(null)),n().nodes.nodes.forEach(m=>{jr(m)&&Ca(m.data.inputs,_=>{var b;_.type==="ImageField"&&((b=_.value)==null?void 0:b.image_name)===h.image_name&&t(Y2({nodeId:m.data.id,fieldName:_.name,value:void 0}))})})});const{requestId:c}=t(me.endpoints.deleteImage.initiate(a));await r(h=>me.endpoints.deleteImage.matchFulfilled(h)&&h.meta.requestId===c,3e4)&&t(ls.util.invalidateTags([{type:"Board",id:a.board_id}]))}})},LEe=()=>{Fe({actionCreator:BA,effect:async(e,{dispatch:t,getState:n})=>{const{imageDTOs:r,imagesUsage:i}=e.payload;if(!(r.length<=1||i.length<=1))try{await t(me.endpoints.deleteImages.initiate({imageDTOs:r})).unwrap();const o=n(),a=uq(o),{data:s}=me.endpoints.listImages.select(a)(o),l=s?Vn.getSelectors().selectAll(s)[0]:void 0;t(Vs(l||null)),t(Qk(!1)),i.some(u=>u.isCanvasImage)&&t(yk()),r.forEach(u=>{var c;((c=n().generation.initialImage)==null?void 0:c.imageName)===u.image_name&&t(mk()),Ca(n().controlNet.controlNets,d=>{(d.controlImage===u.image_name||d.processedControlImage===u.image_name)&&(t(Cc({controlNetId:d.controlNetId,controlImage:null})),t(Kk({controlNetId:d.controlNetId,processedControlImage:null})))}),n().controlNet.ipAdapterInfo.adapterImage===u.image_name&&t(G2(null)),n().nodes.nodes.forEach(d=>{jr(d)&&Ca(d.data.inputs,f=>{var h;f.type==="ImageField"&&((h=f.value)==null?void 0:h.image_name)===u.image_name&&t(Y2({nodeId:d.data.id,fieldName:f.name,value:void 0}))})})})}catch{}}})},FEe=()=>{Fe({matcher:me.endpoints.deleteImage.matchPending,effect:()=>{}})},BEe=()=>{Fe({matcher:me.endpoints.deleteImage.matchFulfilled,effect:e=>{_e("images").debug({imageDTO:e.meta.arg.originalArgs},"Image deleted")}})},zEe=()=>{Fe({matcher:me.endpoints.deleteImage.matchRejected,effect:e=>{_e("images").debug({imageDTO:e.meta.arg.originalArgs},"Unable to delete image")}})},cq=Ne("dnd/dndDropped"),jEe=()=>{Fe({actionCreator:cq,effect:async(e,{dispatch:t})=>{const n=_e("dnd"),{activeData:r,overData:i}=e.payload;if(r.payloadType==="IMAGE_DTO"?n.debug({activeData:r,overData:i},"Image dropped"):r.payloadType==="IMAGE_DTOS"?n.debug({activeData:r,overData:i},`Images (${r.payload.imageDTOs.length}) dropped`):r.payloadType==="NODE_FIELD"?n.debug({activeData:Qt(r),overData:Qt(i)},"Node field dropped"):n.debug({activeData:r,overData:i},"Unknown payload dropped"),i.actionType==="ADD_FIELD_TO_LINEAR"&&r.payloadType==="NODE_FIELD"){const{nodeId:o,field:a}=r.payload;t(l2e({nodeId:o,fieldName:a.name}))}if(i.actionType==="SET_CURRENT_IMAGE"&&r.payloadType==="IMAGE_DTO"&&r.payload.imageDTO){t(Vs(r.payload.imageDTO));return}if(i.actionType==="SET_INITIAL_IMAGE"&&r.payloadType==="IMAGE_DTO"&&r.payload.imageDTO){t(YS(r.payload.imageDTO));return}if(i.actionType==="SET_CONTROLNET_IMAGE"&&r.payloadType==="IMAGE_DTO"&&r.payload.imageDTO){const{controlNetId:o}=i.context;t(Cc({controlImage:r.payload.imageDTO.image_name,controlNetId:o})),t(sU({controlNetId:o,isEnabled:!0}));return}if(i.actionType==="SET_IP_ADAPTER_IMAGE"&&r.payloadType==="IMAGE_DTO"&&r.payload.imageDTO){t(G2(r.payload.imageDTO.image_name)),t(lU(!0));return}if(i.actionType==="SET_CANVAS_INITIAL_IMAGE"&&r.payloadType==="IMAGE_DTO"&&r.payload.imageDTO){t(AB(r.payload.imageDTO));return}if(i.actionType==="SET_NODES_IMAGE"&&r.payloadType==="IMAGE_DTO"&&r.payload.imageDTO){const{fieldName:o,nodeId:a}=i.context;t(Y2({nodeId:a,fieldName:o,value:r.payload.imageDTO}));return}if(i.actionType==="ADD_TO_BOARD"&&r.payloadType==="IMAGE_DTO"&&r.payload.imageDTO){const{imageDTO:o}=r.payload,{boardId:a}=i.context;t(me.endpoints.addImageToBoard.initiate({imageDTO:o,board_id:a}));return}if(i.actionType==="REMOVE_FROM_BOARD"&&r.payloadType==="IMAGE_DTO"&&r.payload.imageDTO){const{imageDTO:o}=r.payload;t(me.endpoints.removeImageFromBoard.initiate({imageDTO:o}));return}if(i.actionType==="ADD_TO_BOARD"&&r.payloadType==="IMAGE_DTOS"&&r.payload.imageDTOs){const{imageDTOs:o}=r.payload,{boardId:a}=i.context;t(me.endpoints.addImagesToBoard.initiate({imageDTOs:o,board_id:a}));return}if(i.actionType==="REMOVE_FROM_BOARD"&&r.payloadType==="IMAGE_DTOS"&&r.payload.imageDTOs){const{imageDTOs:o}=r.payload;t(me.endpoints.removeImagesFromBoard.initiate({imageDTOs:o}));return}}})},UEe=()=>{Fe({matcher:me.endpoints.removeImageFromBoard.matchFulfilled,effect:e=>{const t=_e("images"),n=e.meta.arg.originalArgs;t.debug({imageDTO:n},"Image removed from board")}})},VEe=()=>{Fe({matcher:me.endpoints.removeImageFromBoard.matchRejected,effect:e=>{const t=_e("images"),n=e.meta.arg.originalArgs;t.debug({imageDTO:n},"Problem removing image from board")}})},GEe=()=>{Fe({actionCreator:_0e,effect:async(e,{dispatch:t,getState:n})=>{const r=e.payload,i=n(),{shouldConfirmOnDelete:o}=i.system,a=Rxe(n()),s=a.some(l=>l.isCanvasImage)||a.some(l=>l.isInitialImage)||a.some(l=>l.isControlNetImage)||a.some(l=>l.isIPAdapterImage)||a.some(l=>l.isNodesImage);if(o||s){t(Qk(!0));return}t(BA({imageDTOs:r,imagesUsage:a}))}})},qEe=()=>{Fe({matcher:me.endpoints.uploadImage.matchFulfilled,effect:(e,{dispatch:t,getState:n})=>{const r=_e("images"),i=e.payload,o=n(),{autoAddBoardId:a}=o.gallery;r.debug({imageDTO:i},"Image uploaded");const{postUploadAction:s}=e.meta.arg.originalArgs;if(e.payload.is_intermediate&&!s)return;const l={title:Z("toast.imageUploaded"),status:"success"};if((s==null?void 0:s.type)==="TOAST"){const{toastOptions:u}=s;if(!a||a==="none")t(Gt({...l,...u}));else{t(me.endpoints.addImageToBoard.initiate({board_id:a,imageDTO:i}));const{data:c}=xi.endpoints.listAllBoards.select()(o),d=c==null?void 0:c.find(h=>h.board_id===a),f=d?`${Z("toast.addedToBoard")} ${d.board_name}`:`${Z("toast.addedToBoard")} ${a}`;t(Gt({...l,description:f}))}return}if((s==null?void 0:s.type)==="SET_CANVAS_INITIAL_IMAGE"){t(AB(i)),t(Gt({...l,description:Z("toast.setCanvasInitialImage")}));return}if((s==null?void 0:s.type)==="SET_CONTROLNET_IMAGE"){const{controlNetId:u}=s;t(sU({controlNetId:u,isEnabled:!0})),t(Cc({controlNetId:u,controlImage:i.image_name})),t(Gt({...l,description:Z("toast.setControlImage")}));return}if((s==null?void 0:s.type)==="SET_IP_ADAPTER_IMAGE"){t(G2(i.image_name)),t(lU(!0)),t(Gt({...l,description:Z("toast.setIPAdapterImage")}));return}if((s==null?void 0:s.type)==="SET_INITIAL_IMAGE"){t(YS(i)),t(Gt({...l,description:Z("toast.setInitialImage")}));return}if((s==null?void 0:s.type)==="SET_NODES_IMAGE"){const{nodeId:u,fieldName:c}=s;t(Y2({nodeId:u,fieldName:c,value:i})),t(Gt({...l,description:`${Z("toast.setNodeField")} ${c}`}));return}}})},HEe=()=>{Fe({matcher:me.endpoints.uploadImage.matchRejected,effect:(e,{dispatch:t})=>{const n=_e("images"),r={arg:{...WS(e.meta.arg.originalArgs,["file","postUploadAction"]),file:""}};n.error({...r},"Image upload failed"),t(Gt({title:Z("toast.imageUploadFailed"),description:e.error.message,status:"error"}))}})},WEe=()=>{Fe({matcher:me.endpoints.starImages.matchFulfilled,effect:async(e,{dispatch:t,getState:n})=>{const{updated_image_names:r}=e.payload,i=n(),{selection:o}=i.gallery,a=[];o.forEach(s=>{r.includes(s.image_name)?a.push({...s,starred:!0}):a.push(s)}),t(pU(a))}})},KEe=()=>{Fe({matcher:me.endpoints.unstarImages.matchFulfilled,effect:async(e,{dispatch:t,getState:n})=>{const{updated_image_names:r}=e.payload,i=n(),{selection:o}=i.gallery,a=[];o.forEach(s=>{r.includes(s.image_name)?a.push({...s,starred:!1}):a.push(s)}),t(pU(a))}})},QEe=Ne("generation/initialImageSelected"),XEe=Ne("generation/modelSelected"),YEe=()=>{Fe({actionCreator:QEe,effect:(e,{dispatch:t})=>{if(!e.payload){t(Gt(Ld({title:Z("toast.imageNotLoadedDesc"),status:"error"})));return}t(YS(e.payload)),t(Gt(Ld(Z("toast.sentToImageToImage"))))}})},ZEe=()=>{Fe({actionCreator:XEe,effect:(e,{getState:t,dispatch:n})=>{var l,u;const r=_e("models"),i=t(),o=uy.safeParse(e.payload);if(!o.success){r.error({error:o.error.format()},"Failed to parse main model");return}const a=o.data,{base_model:s}=a;if(((l=i.generation.model)==null?void 0:l.base_model)!==s){let c=0;Ca(i.lora.loras,(p,m)=>{p.base_model!==s&&(n(mU(m)),c+=1)});const{vae:d}=i.generation;d&&d.base_model!==s&&(n(CB(null)),c+=1);const{controlNets:f}=i.controlNet;Ca(f,(p,m)=>{var _;((_=p.model)==null?void 0:_.base_model)!==s&&(n(aU({controlNetId:m})),c+=1)});const{ipAdapterInfo:h}=i.controlNet;h.model&&h.model.base_model!==s&&(n(uU()),c+=1),c>0&&n(Gt(Ld({title:`${Z("toast.baseModelChangedCleared")} ${c} ${Z("toast.incompatibleSubmodel")}${c===1?"":"s"}`,status:"warning"})))}((u=i.generation.model)==null?void 0:u.base_model)!==a.base_model&&i.ui.shouldAutoChangeDimensions&&(["sdxl","sdxl-refiner"].includes(a.base_model)?(n(eI(1024)),n(tI(1024)),n(nI({width:1024,height:1024}))):(n(eI(512)),n(tI(512)),n(nI({width:512,height:512})))),n(Nu(a))}})},S0=cs({sortComparer:(e,t)=>e.model_name.localeCompare(t.model_name)}),BO=cs({sortComparer:(e,t)=>e.model_name.localeCompare(t.model_name)}),zO=cs({sortComparer:(e,t)=>e.model_name.localeCompare(t.model_name)}),jO=cs({sortComparer:(e,t)=>e.model_name.localeCompare(t.model_name)}),nT=cs({sortComparer:(e,t)=>e.model_name.localeCompare(t.model_name)}),UO=cs({sortComparer:(e,t)=>e.model_name.localeCompare(t.model_name)}),VO=cs({sortComparer:(e,t)=>e.model_name.localeCompare(t.model_name)}),rT=cs({sortComparer:(e,t)=>e.model_name.localeCompare(t.model_name)}),JEe=({base_model:e,model_type:t,model_name:n})=>`${e}/${t}/${n}`,du=e=>{const t=[];return e.forEach(n=>{const r={...wn(n),id:JEe(n)};t.push(r)}),t},yl=ls.injectEndpoints({endpoints:e=>({getOnnxModels:e.query({query:t=>{const n={model_type:"onnx",base_models:t};return`models/?${Qg.stringify(n,{arrayFormat:"none"})}`},providesTags:t=>{const n=[{type:"OnnxModel",id:Mt}];return t&&n.push(...t.ids.map(r=>({type:"OnnxModel",id:r}))),n},transformResponse:t=>{const n=du(t.models);return BO.setAll(BO.getInitialState(),n)}}),getMainModels:e.query({query:t=>{const n={model_type:"main",base_models:t};return`models/?${Qg.stringify(n,{arrayFormat:"none"})}`},providesTags:t=>{const n=[{type:"MainModel",id:Mt}];return t&&n.push(...t.ids.map(r=>({type:"MainModel",id:r}))),n},transformResponse:t=>{const n=du(t.models);return S0.setAll(S0.getInitialState(),n)}}),updateMainModels:e.mutation({query:({base_model:t,model_name:n,body:r})=>({url:`models/${t}/main/${n}`,method:"PATCH",body:r}),invalidatesTags:[{type:"MainModel",id:Mt},{type:"SDXLRefinerModel",id:Mt},{type:"OnnxModel",id:Mt}]}),importMainModels:e.mutation({query:({body:t})=>({url:"models/import",method:"POST",body:t}),invalidatesTags:[{type:"MainModel",id:Mt},{type:"SDXLRefinerModel",id:Mt},{type:"OnnxModel",id:Mt}]}),addMainModels:e.mutation({query:({body:t})=>({url:"models/add",method:"POST",body:t}),invalidatesTags:[{type:"MainModel",id:Mt},{type:"SDXLRefinerModel",id:Mt},{type:"OnnxModel",id:Mt}]}),deleteMainModels:e.mutation({query:({base_model:t,model_name:n,model_type:r})=>({url:`models/${t}/${r}/${n}`,method:"DELETE"}),invalidatesTags:[{type:"MainModel",id:Mt},{type:"SDXLRefinerModel",id:Mt},{type:"OnnxModel",id:Mt}]}),convertMainModels:e.mutation({query:({base_model:t,model_name:n,convert_dest_directory:r})=>({url:`models/convert/${t}/main/${n}`,method:"PUT",params:{convert_dest_directory:r}}),invalidatesTags:[{type:"MainModel",id:Mt},{type:"SDXLRefinerModel",id:Mt},{type:"OnnxModel",id:Mt}]}),mergeMainModels:e.mutation({query:({base_model:t,body:n})=>({url:`models/merge/${t}`,method:"PUT",body:n}),invalidatesTags:[{type:"MainModel",id:Mt},{type:"SDXLRefinerModel",id:Mt},{type:"OnnxModel",id:Mt}]}),syncModels:e.mutation({query:()=>({url:"models/sync",method:"POST"}),invalidatesTags:[{type:"MainModel",id:Mt},{type:"SDXLRefinerModel",id:Mt},{type:"OnnxModel",id:Mt}]}),getLoRAModels:e.query({query:()=>({url:"models/",params:{model_type:"lora"}}),providesTags:t=>{const n=[{type:"LoRAModel",id:Mt}];return t&&n.push(...t.ids.map(r=>({type:"LoRAModel",id:r}))),n},transformResponse:t=>{const n=du(t.models);return zO.setAll(zO.getInitialState(),n)}}),updateLoRAModels:e.mutation({query:({base_model:t,model_name:n,body:r})=>({url:`models/${t}/lora/${n}`,method:"PATCH",body:r}),invalidatesTags:[{type:"LoRAModel",id:Mt}]}),deleteLoRAModels:e.mutation({query:({base_model:t,model_name:n})=>({url:`models/${t}/lora/${n}`,method:"DELETE"}),invalidatesTags:[{type:"LoRAModel",id:Mt}]}),getControlNetModels:e.query({query:()=>({url:"models/",params:{model_type:"controlnet"}}),providesTags:t=>{const n=[{type:"ControlNetModel",id:Mt}];return t&&n.push(...t.ids.map(r=>({type:"ControlNetModel",id:r}))),n},transformResponse:t=>{const n=du(t.models);return jO.setAll(jO.getInitialState(),n)}}),getIPAdapterModels:e.query({query:()=>({url:"models/",params:{model_type:"ip_adapter"}}),providesTags:t=>{const n=[{type:"IPAdapterModel",id:Mt}];return t&&n.push(...t.ids.map(r=>({type:"IPAdapterModel",id:r}))),n},transformResponse:t=>{const n=du(t.models);return nT.setAll(nT.getInitialState(),n)}}),getT2IAdapterModels:e.query({query:()=>({url:"models/",params:{model_type:"t2i_adapter"}}),providesTags:t=>{const n=[{type:"T2IAdapterModel",id:Mt}];return t&&n.push(...t.ids.map(r=>({type:"T2IAdapterModel",id:r}))),n},transformResponse:t=>{const n=du(t.models);return UO.setAll(UO.getInitialState(),n)}}),getVaeModels:e.query({query:()=>({url:"models/",params:{model_type:"vae"}}),providesTags:t=>{const n=[{type:"VaeModel",id:Mt}];return t&&n.push(...t.ids.map(r=>({type:"VaeModel",id:r}))),n},transformResponse:t=>{const n=du(t.models);return rT.setAll(rT.getInitialState(),n)}}),getTextualInversionModels:e.query({query:()=>({url:"models/",params:{model_type:"embedding"}}),providesTags:t=>{const n=[{type:"TextualInversionModel",id:Mt}];return t&&n.push(...t.ids.map(r=>({type:"TextualInversionModel",id:r}))),n},transformResponse:t=>{const n=du(t.models);return VO.setAll(VO.getInitialState(),n)}}),getModelsInFolder:e.query({query:t=>({url:`/models/search?${Qg.stringify(t,{})}`}),providesTags:t=>{const n=[{type:"ScannedModels",id:Mt}];return t&&n.push(...t.map(r=>({type:"ScannedModels",id:r}))),n}}),getCheckpointConfigs:e.query({query:()=>({url:"/models/ckpt_confs"})})})}),{useGetMainModelsQuery:fKe,useGetOnnxModelsQuery:hKe,useGetControlNetModelsQuery:pKe,useGetIPAdapterModelsQuery:gKe,useGetT2IAdapterModelsQuery:mKe,useGetLoRAModelsQuery:yKe,useGetTextualInversionModelsQuery:vKe,useGetVaeModelsQuery:bKe,useUpdateMainModelsMutation:_Ke,useDeleteMainModelsMutation:SKe,useImportMainModelsMutation:xKe,useAddMainModelsMutation:wKe,useConvertMainModelsMutation:CKe,useMergeMainModelsMutation:EKe,useDeleteLoRAModelsMutation:TKe,useUpdateLoRAModelsMutation:kKe,useSyncModelsMutation:AKe,useGetModelsInFolderQuery:PKe,useGetCheckpointConfigsQuery:IKe}=yl,eTe=()=>{Fe({predicate:e=>yl.endpoints.getMainModels.matchFulfilled(e)&&!e.meta.arg.originalArgs.includes("sdxl-refiner"),effect:async(e,{getState:t,dispatch:n})=>{const r=_e("models");r.info({models:e.payload.entities},`Main models loaded (${e.payload.ids.length})`);const i=t().generation.model,o=S0.getSelectors().selectAll(e.payload);if(o.length===0){n(Nu(null));return}if(i?o.some(l=>l.model_name===i.model_name&&l.base_model===i.base_model&&l.model_type===i.model_type):!1)return;const s=uy.safeParse(o[0]);if(!s.success){r.error({error:s.error.format()},"Failed to parse main model");return}n(Nu(s.data))}}),Fe({predicate:e=>yl.endpoints.getMainModels.matchFulfilled(e)&&e.meta.arg.originalArgs.includes("sdxl-refiner"),effect:async(e,{getState:t,dispatch:n})=>{const r=_e("models");r.info({models:e.payload.entities},`SDXL Refiner models loaded (${e.payload.ids.length})`);const i=t().sdxl.refinerModel,o=S0.getSelectors().selectAll(e.payload);if(o.length===0){n(W9(null)),n(f2e(!1));return}if(i?o.some(l=>l.model_name===i.model_name&&l.base_model===i.base_model&&l.model_type===i.model_type):!1)return;const s=pk.safeParse(o[0]);if(!s.success){r.error({error:s.error.format()},"Failed to parse SDXL Refiner Model");return}n(W9(s.data))}}),Fe({matcher:yl.endpoints.getVaeModels.matchFulfilled,effect:async(e,{getState:t,dispatch:n})=>{const r=_e("models");r.info({models:e.payload.entities},`VAEs loaded (${e.payload.ids.length})`);const i=t().generation.vae;if(i===null||zf(e.payload.entities,l=>(l==null?void 0:l.model_name)===(i==null?void 0:i.model_name)&&(l==null?void 0:l.base_model)===(i==null?void 0:i.base_model)))return;const a=rT.getSelectors().selectAll(e.payload)[0];if(!a){n(Nu(null));return}const s=qse.safeParse(a);if(!s.success){r.error({error:s.error.format()},"Failed to parse VAE model");return}n(CB(s.data))}}),Fe({matcher:yl.endpoints.getLoRAModels.matchFulfilled,effect:async(e,{getState:t,dispatch:n})=>{_e("models").info({models:e.payload.entities},`LoRAs loaded (${e.payload.ids.length})`);const i=t().lora.loras;Ca(i,(o,a)=>{zf(e.payload.entities,l=>(l==null?void 0:l.model_name)===(o==null?void 0:o.model_name)&&(l==null?void 0:l.base_model)===(o==null?void 0:o.base_model))||n(mU(a))})}}),Fe({matcher:yl.endpoints.getControlNetModels.matchFulfilled,effect:async(e,{getState:t,dispatch:n})=>{_e("models").info({models:e.payload.entities},`ControlNet models loaded (${e.payload.ids.length})`);const i=t().controlNet.controlNets;Ca(i,(o,a)=>{zf(e.payload.entities,l=>{var u,c;return(l==null?void 0:l.model_name)===((u=o==null?void 0:o.model)==null?void 0:u.model_name)&&(l==null?void 0:l.base_model)===((c=o==null?void 0:o.model)==null?void 0:c.base_model)})||n(aU({controlNetId:a}))})}}),Fe({matcher:yl.endpoints.getIPAdapterModels.matchFulfilled,effect:async(e,{getState:t,dispatch:n})=>{const r=_e("models");r.info({models:e.payload.entities},`IP Adapter models loaded (${e.payload.ids.length})`);const{model:i}=t().controlNet.ipAdapterInfo;if(zf(e.payload.entities,l=>(l==null?void 0:l.model_name)===(i==null?void 0:i.model_name)&&(l==null?void 0:l.base_model)===(i==null?void 0:i.base_model)))return;const a=nT.getSelectors().selectAll(e.payload)[0];a||n(GR(null));const s=LB.safeParse(a);if(!s.success){r.error({error:s.error.format()},"Failed to parse IP Adapter model");return}n(GR(s.data))}}),Fe({matcher:yl.endpoints.getTextualInversionModels.matchFulfilled,effect:async e=>{_e("models").info({models:e.payload.entities},`Embeddings loaded (${e.payload.ids.length})`)}})},tTe=ls.injectEndpoints({endpoints:e=>({dynamicPrompts:e.query({query:t=>({url:"utilities/dynamicprompts",body:t,method:"POST"}),keepUnusedDataFor:86400})})}),nTe=No(tle,E0e,w0e,C0e,jk),rTe=()=>{Fe({matcher:nTe,effect:async(e,{dispatch:t,getState:n,cancelActiveListeners:r,delay:i})=>{r(),await i(1e3);const o=n();if(o.config.disabledFeatures.includes("dynamicPrompting"))return;const{positivePrompt:a}=o.generation,{maxPrompts:s}=o.dynamicPrompts;t(OC(!0));try{const l=t(tTe.endpoints.dynamicPrompts.initiate({prompt:a,max_prompts:s})),u=await l.unwrap();l.unsubscribe(),t(T0e(u.prompts)),t(k0e(u.error)),t(qR(!1)),t(OC(!1))}catch{t(qR(!0)),t(OC(!1))}}})},bf=e=>e.$ref.split("/").slice(-1)[0],iTe=({schemaObject:e,baseField:t})=>{const n={...t,type:"integer",default:e.default??0};return e.multipleOf!==void 0&&(n.multipleOf=e.multipleOf),e.maximum!==void 0&&(n.maximum=e.maximum),e.exclusiveMaximum!==void 0&&(n.exclusiveMaximum=e.exclusiveMaximum),e.minimum!==void 0&&(n.minimum=e.minimum),e.exclusiveMinimum!==void 0&&(n.exclusiveMinimum=e.exclusiveMinimum),n},oTe=({schemaObject:e,baseField:t})=>{const n={...t,type:"IntegerPolymorphic",default:e.default??0};return e.multipleOf!==void 0&&(n.multipleOf=e.multipleOf),e.maximum!==void 0&&(n.maximum=e.maximum),e.exclusiveMaximum!==void 0&&(n.exclusiveMaximum=e.exclusiveMaximum),e.minimum!==void 0&&(n.minimum=e.minimum),e.exclusiveMinimum!==void 0&&(n.exclusiveMinimum=e.exclusiveMinimum),n},aTe=({schemaObject:e,baseField:t})=>{const n=nB(e.item_default)&&Moe(e.item_default)?e.item_default:0;return{...t,type:"IntegerCollection",default:e.default??[],item_default:n}},sTe=({schemaObject:e,baseField:t})=>{const n={...t,type:"float",default:e.default??0};return e.multipleOf!==void 0&&(n.multipleOf=e.multipleOf),e.maximum!==void 0&&(n.maximum=e.maximum),e.exclusiveMaximum!==void 0&&(n.exclusiveMaximum=e.exclusiveMaximum),e.minimum!==void 0&&(n.minimum=e.minimum),e.exclusiveMinimum!==void 0&&(n.exclusiveMinimum=e.exclusiveMinimum),n},lTe=({schemaObject:e,baseField:t})=>{const n={...t,type:"FloatPolymorphic",default:e.default??0};return e.multipleOf!==void 0&&(n.multipleOf=e.multipleOf),e.maximum!==void 0&&(n.maximum=e.maximum),e.exclusiveMaximum!==void 0&&(n.exclusiveMaximum=e.exclusiveMaximum),e.minimum!==void 0&&(n.minimum=e.minimum),e.exclusiveMinimum!==void 0&&(n.exclusiveMinimum=e.exclusiveMinimum),n},uTe=({schemaObject:e,baseField:t})=>{const n=nB(e.item_default)?e.item_default:0;return{...t,type:"FloatCollection",default:e.default??[],item_default:n}},cTe=({schemaObject:e,baseField:t})=>{const n={...t,type:"string",default:e.default??""};return e.minLength!==void 0&&(n.minLength=e.minLength),e.maxLength!==void 0&&(n.maxLength=e.maxLength),e.pattern!==void 0&&(n.pattern=e.pattern),n},dTe=({schemaObject:e,baseField:t})=>{const n={...t,type:"StringPolymorphic",default:e.default??""};return e.minLength!==void 0&&(n.minLength=e.minLength),e.maxLength!==void 0&&(n.maxLength=e.maxLength),e.pattern!==void 0&&(n.pattern=e.pattern),n},fTe=({schemaObject:e,baseField:t})=>{const n=dk(e.item_default)?e.item_default:"";return{...t,type:"StringCollection",default:e.default??[],item_default:n}},hTe=({schemaObject:e,baseField:t})=>({...t,type:"boolean",default:e.default??!1}),pTe=({schemaObject:e,baseField:t})=>({...t,type:"BooleanPolymorphic",default:e.default??!1}),gTe=({schemaObject:e,baseField:t})=>{const n=e.item_default&&Ooe(e.item_default)?e.item_default:!1;return{...t,type:"BooleanCollection",default:e.default??[],item_default:n}},mTe=({schemaObject:e,baseField:t})=>({...t,type:"MainModelField",default:e.default??void 0}),yTe=({schemaObject:e,baseField:t})=>({...t,type:"SDXLMainModelField",default:e.default??void 0}),vTe=({schemaObject:e,baseField:t})=>({...t,type:"SDXLRefinerModelField",default:e.default??void 0}),bTe=({schemaObject:e,baseField:t})=>({...t,type:"VaeModelField",default:e.default??void 0}),_Te=({schemaObject:e,baseField:t})=>({...t,type:"LoRAModelField",default:e.default??void 0}),STe=({schemaObject:e,baseField:t})=>({...t,type:"ControlNetModelField",default:e.default??void 0}),xTe=({schemaObject:e,baseField:t})=>({...t,type:"IPAdapterModelField",default:e.default??void 0}),wTe=({schemaObject:e,baseField:t})=>({...t,type:"T2IAdapterModelField",default:e.default??void 0}),CTe=({schemaObject:e,baseField:t})=>({...t,type:"BoardField",default:e.default??void 0}),ETe=({schemaObject:e,baseField:t})=>({...t,type:"ImageField",default:e.default??void 0}),TTe=({schemaObject:e,baseField:t})=>({...t,type:"ImagePolymorphic",default:e.default??void 0}),kTe=({schemaObject:e,baseField:t})=>({...t,type:"ImageCollection",default:e.default??[],item_default:e.item_default??void 0}),ATe=({schemaObject:e,baseField:t})=>({...t,type:"DenoiseMaskField",default:e.default??void 0}),PTe=({schemaObject:e,baseField:t})=>({...t,type:"LatentsField",default:e.default??void 0}),ITe=({schemaObject:e,baseField:t})=>({...t,type:"LatentsPolymorphic",default:e.default??void 0}),RTe=({schemaObject:e,baseField:t})=>({...t,type:"LatentsCollection",default:e.default??[],item_default:e.item_default??void 0}),OTe=({schemaObject:e,baseField:t})=>({...t,type:"ConditioningField",default:e.default??void 0}),MTe=({schemaObject:e,baseField:t})=>({...t,type:"ConditioningPolymorphic",default:e.default??void 0}),NTe=({schemaObject:e,baseField:t})=>({...t,type:"ConditioningCollection",default:e.default??[],item_default:e.item_default??void 0}),$Te=({schemaObject:e,baseField:t})=>({...t,type:"UNetField",default:e.default??void 0}),DTe=({schemaObject:e,baseField:t})=>({...t,type:"ClipField",default:e.default??void 0}),LTe=({schemaObject:e,baseField:t})=>({...t,type:"VaeField",default:e.default??void 0}),FTe=({schemaObject:e,baseField:t})=>({...t,type:"ControlField",default:e.default??void 0}),BTe=({schemaObject:e,baseField:t})=>({...t,type:"ControlPolymorphic",default:e.default??void 0}),zTe=({schemaObject:e,baseField:t})=>({...t,type:"ControlCollection",default:e.default??[],item_default:e.item_default??void 0}),jTe=({schemaObject:e,baseField:t})=>({...t,type:"IPAdapterField",default:e.default??void 0}),UTe=({schemaObject:e,baseField:t})=>({...t,type:"T2IAdapterField",default:e.default??void 0}),VTe=({schemaObject:e,baseField:t})=>({...t,type:"T2IAdapterPolymorphic",default:e.default??void 0}),GTe=({schemaObject:e,baseField:t})=>({...t,type:"T2IAdapterCollection",default:e.default??[],item_default:e.item_default??void 0}),qTe=({schemaObject:e,baseField:t})=>{const n=e.enum??[];return{...t,type:"enum",options:n,ui_choice_labels:e.ui_choice_labels,default:e.default??n[0]}},HTe=({baseField:e})=>({...e,type:"Collection",default:[]}),WTe=({baseField:e})=>({...e,type:"CollectionItem",default:void 0}),KTe=({schemaObject:e,baseField:t})=>({...t,type:"ColorField",default:e.default??{r:127,g:127,b:127,a:255}}),QTe=({schemaObject:e,baseField:t})=>({...t,type:"ColorPolymorphic",default:e.default??{r:127,g:127,b:127,a:255}}),XTe=({schemaObject:e,baseField:t})=>({...t,type:"ColorCollection",default:e.default??[]}),YTe=({schemaObject:e,baseField:t})=>({...t,type:"Scheduler",default:e.default??"euler"}),GO=e=>{if(e!=null&&e.ui_type)return e.ui_type;if(e.type){if(e.enum)return"enum";if(e.type){if(e.type==="number")return"float";if(e.type==="array"){const t=tce(e.items)?e.items.type:bf(e.items);return cSe(t)?pA[t]:void 0}else return e.type}}else if(e.allOf){const t=e.allOf;if(t&&t[0]&&Hp(t[0]))return bf(t[0])}else if(e.anyOf){const t=e.anyOf;let n,r;if(hI(t[0])){const i=t[0].items,o=t[1];Hp(i)&&Hp(o)?(n=bf(i),r=bf(o)):mv(i)&&mv(o)&&(n=i.type,r=o.type)}else if(hI(t[1])){const i=t[0],o=t[1].items;Hp(i)&&Hp(o)?(n=bf(i),r=bf(o)):mv(i)&&mv(o)&&(n=i.type,r=o.type)}if(n===r&&fSe(n))return FV[n]}},dq={BoardField:CTe,boolean:hTe,BooleanCollection:gTe,BooleanPolymorphic:pTe,ClipField:DTe,Collection:HTe,CollectionItem:WTe,ColorCollection:XTe,ColorField:KTe,ColorPolymorphic:QTe,ConditioningCollection:NTe,ConditioningField:OTe,ConditioningPolymorphic:MTe,ControlCollection:zTe,ControlField:FTe,ControlNetModelField:STe,ControlPolymorphic:BTe,DenoiseMaskField:ATe,enum:qTe,float:sTe,FloatCollection:uTe,FloatPolymorphic:lTe,ImageCollection:kTe,ImageField:ETe,ImagePolymorphic:TTe,integer:iTe,IntegerCollection:aTe,IntegerPolymorphic:oTe,IPAdapterField:jTe,IPAdapterModelField:xTe,LatentsCollection:RTe,LatentsField:PTe,LatentsPolymorphic:ITe,LoRAModelField:_Te,MainModelField:mTe,Scheduler:YTe,SDXLMainModelField:yTe,SDXLRefinerModelField:vTe,string:cTe,StringCollection:fTe,StringPolymorphic:dTe,T2IAdapterCollection:GTe,T2IAdapterField:UTe,T2IAdapterModelField:wTe,T2IAdapterPolymorphic:VTe,UNetField:$Te,VaeField:LTe,VaeModelField:bTe},ZTe=e=>!!(e&&e in dq),JTe=(e,t,n,r)=>{var f;const{input:i,ui_hidden:o,ui_component:a,ui_type:s,ui_order:l}=t,u={input:Cg.includes(r)?"connection":i,ui_hidden:o,ui_component:a,ui_type:s,required:((f=e.required)==null?void 0:f.includes(n))??!1,ui_order:l},c={name:n,title:t.title??"",description:t.description??"",fieldKind:"input",...u};if(!ZTe(r))return;const d=dq[r];if(d)return d({schemaObject:t,baseField:c})},e4e=["id","type","metadata","use_cache"],t4e=["type"],n4e=["WorkflowField","MetadataField","IsIntermediate"],r4e=["graph","metadata_accumulator"],i4e=(e,t)=>!!(e4e.includes(t)||e==="collect"&&t==="collection"||e==="iterate"&&t==="index"),o4e=e=>!!n4e.includes(e),a4e=(e,t)=>!t4e.includes(t),s4e=e=>!r4e.includes(e.properties.type.default),l4e=(e,t=void 0,n=void 0)=>{var o;return Object.values(((o=e.components)==null?void 0:o.schemas)??{}).filter(nce).filter(s4e).filter(a=>t?t.includes(a.properties.type.default):!0).filter(a=>n?!n.includes(a.properties.type.default):!0).reduce((a,s)=>{var y,S;const l=s.properties.type.default,u=s.title.replace("Invocation",""),c=s.tags??[],d=s.description??"",f=s.version,h=J3(s.properties,(w,x,C)=>{if(i4e(l,C))return _e("nodes").trace({node:l,fieldName:C,field:Qt(x)},"Skipped reserved input field"),w;if(!pI(x))return _e("nodes").warn({node:l,propertyName:C,property:Qt(x)},"Unhandled input property"),w;const k=GO(x);if(!fI(k))return _e("nodes").warn({node:l,fieldName:C,fieldType:k,field:Qt(x)},"Skipping unknown input field type"),w;if(o4e(k))return _e("nodes").trace({node:l,fieldName:C,fieldType:k,field:Qt(x)},"Skipping reserved field type"),w;const T=JTe(s,x,C,k);return T?(w[C]=T,w):(_e("nodes").debug({node:l,fieldName:C,fieldType:k,field:Qt(x)},"Skipping input field with no template"),w)},{}),p=s.output.$ref.split("/").pop();if(!p)return _e("nodes").warn({outputRefObject:Qt(s.output)},"No output schema name found in ref object"),a;const m=(S=(y=e.components)==null?void 0:y.schemas)==null?void 0:S[p];if(!m)return _e("nodes").warn({outputSchemaName:p},"Output schema not found"),a;if(!rce(m))return _e("nodes").error({outputSchema:Qt(m)},"Invalid output schema"),a;const _=m.properties.type.default,b=J3(m.properties,(w,x,C)=>{if(!a4e(l,C))return _e("nodes").trace({type:l,propertyName:C,property:Qt(x)},"Skipped reserved output field"),w;if(!pI(x))return _e("nodes").warn({type:l,propertyName:C,property:Qt(x)},"Unhandled output property"),w;const k=GO(x);return fI(k)?(w[C]={fieldKind:"output",name:C,title:x.title??"",description:x.description??"",type:k,ui_hidden:x.ui_hidden??!1,ui_type:x.ui_type,ui_order:x.ui_order},w):(_e("nodes").warn({fieldName:C,fieldType:k,field:Qt(x)},"Skipping unknown output field type"),w)},{}),v=s.properties.use_cache.default,g={title:u,type:l,version:f,tags:c,description:d,outputType:_,inputs:h,outputs:b,useCache:v};return Object.assign(a,{[l]:g}),a},{})},u4e=()=>{Fe({actionCreator:m0.fulfilled,effect:(e,{dispatch:t,getState:n})=>{const r=_e("system"),i=e.payload;r.debug({schemaJSON:i},"Received OpenAPI schema");const{nodesAllowlist:o,nodesDenylist:a}=n().config,s=l4e(i,o,a);r.debug({nodeTemplates:Qt(s)},`Built ${KS(s)} node templates`),t(KV(s))}}),Fe({actionCreator:m0.rejected,effect:e=>{_e("system").error({error:Qt(e.error)},"Problem retrieving OpenAPI Schema")}})},c4e=()=>{Fe({actionCreator:jj,effect:(e,{dispatch:t,getState:n})=>{_e("socketio").debug("Connected");const{nodes:i,config:o,system:a}=n(),{disabledTabs:s}=o;!KS(i.nodeTemplates)&&!s.includes("nodes")&&t(m0()),a.isInitialized?t(ls.util.resetApiState()):t(y2e(!0)),t(jk(e.payload))}})},d4e=()=>{Fe({actionCreator:Uj,effect:(e,{dispatch:t})=>{_e("socketio").debug("Disconnected"),t(Vj(e.payload))}})},f4e=()=>{Fe({actionCreator:Kj,effect:(e,{dispatch:t})=>{_e("socketio").trace(e.payload,"Generator progress"),t(qk(e.payload))}})},h4e=()=>{Fe({actionCreator:Hj,effect:(e,{dispatch:t})=>{_e("socketio").debug(e.payload,"Session complete"),t(Wj(e.payload))}})},p4e=["load_image","image"],g4e=()=>{Fe({actionCreator:Vk,effect:async(e,{dispatch:t,getState:n})=>{const r=_e("socketio"),{data:i}=e.payload;r.debug({data:Qt(i)},`Invocation complete (${e.payload.data.node.type})`);const{result:o,node:a,queue_batch_id:s}=i;if(nq(o)&&!p4e.includes(a.type)){const{image_name:l}=o.image,{canvas:u,gallery:c}=n(),d=await t(me.endpoints.getImageDTO.initiate(l)).unwrap();if(u.batchIds.includes(s)&&[ye].includes(i.source_node_id)&&t(lle(d)),!d.is_intermediate){t(me.util.updateQueryData("listImages",{board_id:d.board_id??"none",categories:ii},h=>{Vn.addOne(h,d)})),t(me.util.invalidateTags([{type:"BoardImagesTotal",id:d.board_id},{type:"BoardAssetsTotal",id:d.board_id},{type:"Board",id:d.board_id}]));const{shouldAutoSwitch:f}=c;f&&(c.galleryView!=="images"&&t(xE("images")),d.board_id&&d.board_id!==c.selectedBoardId&&t(C_({boardId:d.board_id,selectedImageName:d.image_name})),!d.board_id&&c.selectedBoardId!=="none"&&t(C_({boardId:"none",selectedImageName:d.image_name})),t(Vs(d)))}}t(Gk(e.payload))}})},m4e=()=>{Fe({actionCreator:qj,effect:(e,{dispatch:t})=>{_e("socketio").error(e.payload,`Invocation error (${e.payload.data.node.type})`),t(V2(e.payload))}})},y4e=()=>{Fe({actionCreator:tU,effect:(e,{dispatch:t})=>{_e("socketio").error(e.payload,`Invocation retrieval error (${e.payload.data.graph_execution_state_id})`),t(nU(e.payload))}})},v4e=()=>{Fe({actionCreator:Gj,effect:(e,{dispatch:t})=>{_e("socketio").debug(e.payload,`Invocation started (${e.payload.data.node.type})`),t(Uk(e.payload))}})},b4e=()=>{Fe({actionCreator:Qj,effect:(e,{dispatch:t})=>{const n=_e("socketio"),{base_model:r,model_name:i,model_type:o,submodel:a}=e.payload.data;let s=`Model load started: ${r}/${o}/${i}`;a&&(s=s.concat(`/${a}`)),n.debug(e.payload,s),t(Xj(e.payload))}}),Fe({actionCreator:Yj,effect:(e,{dispatch:t})=>{const n=_e("socketio"),{base_model:r,model_name:i,model_type:o,submodel:a}=e.payload.data;let s=`Model load complete: ${r}/${o}/${i}`;a&&(s=s.concat(`/${a}`)),n.debug(e.payload,s),t(Zj(e.payload))}})},_4e=()=>{Fe({actionCreator:rU,effect:async(e,{dispatch:t})=>{const n=_e("socketio"),{queue_item_id:r,queue_batch_id:i,status:o}=e.payload.data;n.debug(e.payload,`Queue item ${r} status updated: ${o}`),t(Hk(e.payload)),t(Qr.util.updateQueryData("listQueueItems",void 0,s=>{Kc.updateOne(s,{id:r,changes:e.payload.data})})),t(Qr.util.invalidateTags(["CurrentSessionQueueItem","NextSessionQueueItem","InvocationCacheStatus",{type:"SessionQueueItem",id:r},{type:"SessionQueueItemDTO",id:r},{type:"BatchStatus",id:i}]));const a=t(Qr.endpoints.getQueueStatus.initiate(void 0,{forceRefetch:!0}));await a.unwrap(),a.unsubscribe()}})},S4e=()=>{Fe({actionCreator:Jj,effect:(e,{dispatch:t})=>{_e("socketio").error(e.payload,`Session retrieval error (${e.payload.data.graph_execution_state_id})`),t(eU(e.payload))}})},x4e=()=>{Fe({actionCreator:c0e,effect:(e,{dispatch:t})=>{_e("socketio").debug(e.payload,"Subscribed"),t(d0e(e.payload))}})},w4e=()=>{Fe({actionCreator:f0e,effect:(e,{dispatch:t})=>{_e("socketio").debug(e.payload,"Unsubscribed"),t(h0e(e.payload))}})},C4e=()=>{Fe({actionCreator:Bxe,effect:async(e,{dispatch:t,getState:n})=>{const{imageDTO:r}=e.payload;try{const i=await t(me.endpoints.changeImageIsIntermediate.initiate({imageDTO:r,is_intermediate:!1})).unwrap(),{autoAddBoardId:o}=n().gallery;o&&o!=="none"&&await t(me.endpoints.addImageToBoard.initiate({imageDTO:i,board_id:o})),t(Gt({title:Z("toast.imageSaved"),status:"success"}))}catch(i){t(Gt({title:Z("toast.imageSavingFailed"),description:i==null?void 0:i.message,status:"error"}))}}})},RKe=["sd-1","sd-2","sdxl","sdxl-refiner"],E4e=["sd-1","sd-2","sdxl"],OKe=["sdxl"],MKe=["sd-1","sd-2"],NKe=["sdxl-refiner"],T4e=()=>{Fe({actionCreator:sG,effect:async(e,{getState:t,dispatch:n})=>{var i;if(e.payload==="unifiedCanvas"){const o=(i=t().generation.model)==null?void 0:i.base_model;if(o&&["sd-1","sd-2","sdxl"].includes(o))return;try{const a=n(yl.endpoints.getMainModels.initiate(E4e)),s=await a.unwrap();if(a.unsubscribe(),!s.ids.length){n(Nu(null));return}const u=S0.getSelectors().selectAll(s).filter(h=>["sd-1","sd-2","sxdl"].includes(h.base_model))[0];if(!u){n(Nu(null));return}const{base_model:c,model_name:d,model_type:f}=u;n(Nu({base_model:c,model_name:d,model_type:f}))}catch{n(Nu(null))}}}})},k4e=({image_name:e,esrganModelName:t,autoAddBoardId:n})=>{const r={id:r5,type:"esrgan",image:{image_name:e},model_name:t,is_intermediate:!0},i={id:Za,type:"save_image",use_cache:!1,is_intermediate:!1,board:n==="none"?void 0:{board_id:n}};return{id:"adhoc-esrgan-graph",nodes:{[r5]:r,[Za]:i},edges:[{source:{node_id:r5,field:"image"},destination:{node_id:Za,field:"image"}}]}},A4e=()=>Rj(),fq=wj;function P4e(){if(console&&console.warn){for(var e=arguments.length,t=new Array(e),n=0;n()=>{if(e.isInitialized)t();else{const n=()=>{setTimeout(()=>{e.off("initialized",n)},0),t()};e.on("initialized",n)}};function HO(e,t,n){e.loadNamespaces(t,hq(e,n))}function WO(e,t,n,r){typeof n=="string"&&(n=[n]),n.forEach(i=>{e.options.ns.indexOf(i)<0&&e.options.ns.push(i)}),e.loadLanguages(t,hq(e,r))}function I4e(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const r=t.languages[0],i=t.options?t.options.fallbackLng:!1,o=t.languages[t.languages.length-1];if(r.toLowerCase()==="cimode")return!0;const a=(s,l)=>{const u=t.services.backendConnector.state[`${s}|${l}`];return u===-1||u===2};return n.bindI18n&&n.bindI18n.indexOf("languageChanging")>-1&&t.services.backendConnector.backend&&t.isLanguageChangingTo&&!a(t.isLanguageChangingTo,e)?!1:!!(t.hasResourceBundle(r,e)||!t.services.backendConnector.backend||t.options.resources&&!t.options.partialBundledLanguages||a(r,e)&&(!i||a(o,e)))}function R4e(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return!t.languages||!t.languages.length?(iT("i18n.languages were undefined or empty",t.languages),!0):t.options.ignoreJSONStructure!==void 0?t.hasLoadedNamespace(e,{lng:n.lng,precheck:(i,o)=>{if(n.bindI18n&&n.bindI18n.indexOf("languageChanging")>-1&&i.services.backendConnector.backend&&i.isLanguageChangingTo&&!o(i.isLanguageChangingTo,e))return!1}}):I4e(e,t,n)}const O4e=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,M4e={"&":"&","&":"&","<":"<","<":"<",">":">",">":">","'":"'","'":"'",""":'"',""":'"'," ":" "," ":" ","©":"©","©":"©","®":"®","®":"®","…":"…","…":"…","/":"/","/":"/"},N4e=e=>M4e[e],$4e=e=>e.replace(O4e,N4e);let oT={bindI18n:"languageChanged",bindI18nStore:"",transEmptyNodeValue:"",transSupportBasicHtmlNodes:!0,transWrapTextNodes:"",transKeepBasicHtmlNodesFor:["br","strong","i","p"],useSuspense:!0,unescape:$4e};function D4e(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};oT={...oT,...e}}function L4e(){return oT}let pq;function F4e(e){pq=e}function B4e(){return pq}const z4e={type:"3rdParty",init(e){D4e(e.options.react),F4e(e)}},j4e=I.createContext();class U4e{constructor(){this.usedNamespaces={}}addUsedNamespaces(t){t.forEach(n=>{this.usedNamespaces[n]||(this.usedNamespaces[n]=!0)})}getUsedNamespaces(){return Object.keys(this.usedNamespaces)}}const V4e=(e,t)=>{const n=I.useRef();return I.useEffect(()=>{n.current=t?n.current:e},[e,t]),n.current};function G4e(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const{i18n:n}=t,{i18n:r,defaultNS:i}=I.useContext(j4e)||{},o=n||r||B4e();if(o&&!o.reportNamespaces&&(o.reportNamespaces=new U4e),!o){iT("You will need to pass in an i18next instance by using initReactI18next");const g=(S,w)=>typeof w=="string"?w:w&&typeof w=="object"&&typeof w.defaultValue=="string"?w.defaultValue:Array.isArray(S)?S[S.length-1]:S,y=[g,{},!1];return y.t=g,y.i18n={},y.ready=!1,y}o.options.react&&o.options.react.wait!==void 0&&iT("It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");const a={...L4e(),...o.options.react,...t},{useSuspense:s,keyPrefix:l}=a;let u=e||i||o.options&&o.options.defaultNS;u=typeof u=="string"?[u]:u||["translation"],o.reportNamespaces.addUsedNamespaces&&o.reportNamespaces.addUsedNamespaces(u);const c=(o.isInitialized||o.initializedStoreOnce)&&u.every(g=>R4e(g,o,a));function d(){return o.getFixedT(t.lng||null,a.nsMode==="fallback"?u:u[0],l)}const[f,h]=I.useState(d);let p=u.join();t.lng&&(p=`${t.lng}${p}`);const m=V4e(p),_=I.useRef(!0);I.useEffect(()=>{const{bindI18n:g,bindI18nStore:y}=a;_.current=!0,!c&&!s&&(t.lng?WO(o,t.lng,u,()=>{_.current&&h(d)}):HO(o,u,()=>{_.current&&h(d)})),c&&m&&m!==p&&_.current&&h(d);function S(){_.current&&h(d)}return g&&o&&o.on(g,S),y&&o&&o.store.on(y,S),()=>{_.current=!1,g&&o&&g.split(" ").forEach(w=>o.off(w,S)),y&&o&&y.split(" ").forEach(w=>o.store.off(w,S))}},[o,p]);const b=I.useRef(!0);I.useEffect(()=>{_.current&&!b.current&&h(d),b.current=!1},[o,l]);const v=[f,o,c];if(v.t=f,v.i18n=o,v.ready=c,c||!c&&!s)return v;throw new Promise(g=>{t.lng?WO(o,t.lng,u,()=>g()):HO(o,u,()=>g())})}const q4e=(e,t)=>{if(!e||!t)return;const{width:n,height:r}=e,i=r*4*n*4,o=r*2*n*2;return{x4:i,x2:o}},H4e=(e,t)=>{if(!e||!t)return{x4:!0,x2:!0};const n={x4:!1,x2:!1};return e.x4<=t&&(n.x4=!0),e.x2<=t&&(n.x2=!0),n},W4e=(e,t)=>{if(!(!e||!t)&&!(e.x4&&e.x2)){if(!e.x2&&!e.x4)return"parameters.isAllowedToUpscale.tooLarge";if(!e.x4&&e.x2&&t===4)return"parameters.isAllowedToUpscale.useX2Model"}},gq=e=>Ii(iK,({postprocessing:t,config:n})=>{const{esrganModelName:r}=t,{maxUpscalePixels:i}=n,o=q4e(e,i),a=H4e(o,i),s=r.includes("x2")?2:4,l=W4e(a,s);return{isAllowedToUpscale:s===2?a.x2:a.x4,detailTKey:l}},J2),$Ke=e=>{const{t}=G4e(),n=I.useMemo(()=>gq(e),[e]),{isAllowedToUpscale:r,detailTKey:i}=fq(n);return{isAllowedToUpscale:r,detail:i?t(i):void 0}},K4e=Ne("upscale/upscaleRequested"),Q4e=()=>{Fe({actionCreator:K4e,effect:async(e,{dispatch:t,getState:n})=>{var f;const r=_e("session"),{imageDTO:i}=e.payload,{image_name:o}=i,a=n(),{isAllowedToUpscale:s,detailTKey:l}=gq(i)(a);if(!s){r.error({imageDTO:i},Z(l??"parameters.isAllowedToUpscale.tooLarge")),t(Gt({title:Z(l??"parameters.isAllowedToUpscale.tooLarge"),status:"error"}));return}const{esrganModelName:u}=a.postprocessing,{autoAddBoardId:c}=a.gallery,d=k4e({image_name:o,esrganModelName:u,autoAddBoardId:c});try{const h=t(Qr.endpoints.enqueueGraph.initiate({graph:d,prepend:!0},{fixedCacheKey:"enqueueGraph"})),p=await h.unwrap();h.reset(),r.debug({enqueueResult:Qt(p)},Z("queue.graphQueued"))}catch(h){if(r.error({graph:Qt(d)},Z("queue.graphFailedToQueue")),h instanceof Object&&"data"in h&&"status"in h&&h.status===403){const p=((f=h.data)==null?void 0:f.detail)||"Unknown Error";t(Gt({title:Z("queue.graphFailedToQueue"),status:"error",description:p,duration:15e3}));return}t(Gt({title:Z("queue.graphFailedToQueue"),status:"error"}))}}})},X4e=tl(null),Y4e=/^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z\-]+(?:\.[\da-z\-]+)*))?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?)?)?$/i,KO=e=>{if(typeof e!="string")throw new TypeError("Invalid argument expected string");const t=e.match(Y4e);if(!t)throw new Error(`Invalid argument not valid semver ('${e}' received)`);return t.shift(),t},QO=e=>e==="*"||e==="x"||e==="X",XO=e=>{const t=parseInt(e,10);return isNaN(t)?e:t},Z4e=(e,t)=>typeof e!=typeof t?[String(e),String(t)]:[e,t],J4e=(e,t)=>{if(QO(e)||QO(t))return 0;const[n,r]=Z4e(XO(e),XO(t));return n>r?1:n{for(let n=0;n{const n=KO(e),r=KO(t),i=n.pop(),o=r.pop(),a=YO(n,r);return a!==0?a:i&&o?YO(i.split("."),o.split(".")):i||o?i?-1:1:0},tke=(e,t)=>{const n=wn(e),{nodes:r,edges:i}=n,o=[],a=r.filter(iE),s=hk(a,"id");return r.forEach(l=>{if(!iE(l))return;const u=t[l.data.type];if(!u){o.push({message:`${be.t("nodes.node")} "${l.data.type}" ${be.t("nodes.skipped")}`,issues:[`${be.t("nodes.nodeType")}"${l.data.type}" ${be.t("nodes.doesNotExist")}`],data:l});return}if(u.version&&l.data.version&&eke(u.version,l.data.version)!==0){o.push({message:`${be.t("nodes.node")} "${l.data.type}" ${be.t("nodes.mismatchedVersion")}`,issues:[`${be.t("nodes.node")} "${l.data.type}" v${l.data.version} ${be.t("nodes.maybeIncompatible")} v${u.version}`],data:{node:l,nodeTemplate:Qt(u)}});return}}),i.forEach((l,u)=>{const c=s[l.source],d=s[l.target],f=[];if(c?l.type==="default"&&!(l.sourceHandle in c.data.outputs)&&f.push(`${be.t("nodes.outputNode")} "${l.source}.${l.sourceHandle}" ${be.t("nodes.doesNotExist")}`):f.push(`${be.t("nodes.outputNode")} ${l.source} ${be.t("nodes.doesNotExist")}`),d?l.type==="default"&&!(l.targetHandle in d.data.inputs)&&f.push(`${be.t("nodes.inputField")} "${l.target}.${l.targetHandle}" ${be.t("nodes.doesNotExist")}`):f.push(`${be.t("nodes.inputNode")} ${l.target} ${be.t("nodes.doesNotExist")}`),t[(c==null?void 0:c.data.type)??"__UNKNOWN_NODE_TYPE__"]||f.push(`${be.t("nodes.sourceNode")} "${l.source}" ${be.t("nodes.missingTemplate")} "${c==null?void 0:c.data.type}"`),t[(d==null?void 0:d.data.type)??"__UNKNOWN_NODE_TYPE__"]||f.push(`${be.t("nodes.sourceNode")}"${l.target}" ${be.t("nodes.missingTemplate")} "${d==null?void 0:d.data.type}"`),f.length){delete i[u];const h=l.type==="default"?l.sourceHandle:l.source,p=l.type==="default"?l.targetHandle:l.target;o.push({message:`Edge "${h} -> ${p}" skipped`,issues:f,data:l})}}),{workflow:n,errors:o}},nke=()=>{Fe({actionCreator:vxe,effect:(e,{dispatch:t,getState:n})=>{const r=_e("nodes"),i=e.payload,o=n().nodes.nodeTemplates,{workflow:a,errors:s}=tke(i,o);t(u2e(a)),s.length?(t(Gt(Ld({title:Z("toast.loadedWithWarnings"),status:"warning"}))),s.forEach(({message:l,...u})=>{r.warn(u,l)})):t(Gt(Ld({title:Z("toast.workflowLoaded"),status:"success"}))),t(sG("nodes")),requestAnimationFrame(()=>{var l;(l=X4e.get())==null||l.fitView()})}})};function rke(e){if(e.sheet)return e.sheet;for(var t=0;t0?ki(Ip,--Oo):0,ap--,$r===10&&(ap=1,Jx--),$r}function Ko(){return $r=Oo2||w0($r)>3?"":" "}function mke(e,t){for(;--t&&Ko()&&!($r<48||$r>102||$r>57&&$r<65||$r>70&&$r<97););return Ay(e,q1()+(t<6&&qs()==32&&Ko()==32))}function sT(e){for(;Ko();)switch($r){case e:return Oo;case 34:case 39:e!==34&&e!==39&&sT($r);break;case 40:e===41&&sT(e);break;case 92:Ko();break}return Oo}function yke(e,t){for(;Ko()&&e+$r!==47+10;)if(e+$r===42+42&&qs()===47)break;return"/*"+Ay(t,Oo-1)+"*"+Zx(e===47?e:Ko())}function vke(e){for(;!w0(qs());)Ko();return Ay(e,Oo)}function bke(e){return Sq(W1("",null,null,null,[""],e=_q(e),0,[0],e))}function W1(e,t,n,r,i,o,a,s,l){for(var u=0,c=0,d=a,f=0,h=0,p=0,m=1,_=1,b=1,v=0,g="",y=i,S=o,w=r,x=g;_;)switch(p=v,v=Ko()){case 40:if(p!=108&&ki(x,d-1)==58){aT(x+=ln(H1(v),"&","&\f"),"&\f")!=-1&&(b=-1);break}case 34:case 39:case 91:x+=H1(v);break;case 9:case 10:case 13:case 32:x+=gke(p);break;case 92:x+=mke(q1()-1,7);continue;case 47:switch(qs()){case 42:case 47:Wv(_ke(yke(Ko(),q1()),t,n),l);break;default:x+="/"}break;case 123*m:s[u++]=ks(x)*b;case 125*m:case 59:case 0:switch(v){case 0:case 125:_=0;case 59+c:b==-1&&(x=ln(x,/\f/g,"")),h>0&&ks(x)-d&&Wv(h>32?JO(x+";",r,n,d-1):JO(ln(x," ","")+";",r,n,d-2),l);break;case 59:x+=";";default:if(Wv(w=ZO(x,t,n,u,c,i,s,g,y=[],S=[],d),o),v===123)if(c===0)W1(x,t,w,w,y,o,d,s,S);else switch(f===99&&ki(x,3)===110?100:f){case 100:case 108:case 109:case 115:W1(e,w,w,r&&Wv(ZO(e,w,w,0,0,i,s,g,i,y=[],d),S),i,S,d,s,r?y:S);break;default:W1(x,w,w,w,[""],S,0,s,S)}}u=c=h=0,m=b=1,g=x="",d=a;break;case 58:d=1+ks(x),h=p;default:if(m<1){if(v==123)--m;else if(v==125&&m++==0&&pke()==125)continue}switch(x+=Zx(v),v*m){case 38:b=c>0?1:(x+="\f",-1);break;case 44:s[u++]=(ks(x)-1)*b,b=1;break;case 64:qs()===45&&(x+=H1(Ko())),f=qs(),c=d=ks(g=x+=vke(q1())),v++;break;case 45:p===45&&ks(x)==2&&(m=0)}}return o}function ZO(e,t,n,r,i,o,a,s,l,u,c){for(var d=i-1,f=i===0?o:[""],h=UA(f),p=0,m=0,_=0;p0?f[b]+" "+v:ln(v,/&\f/g,f[b])))&&(l[_++]=g);return ew(e,t,n,i===0?zA:s,l,u,c)}function _ke(e,t,n){return ew(e,t,n,mq,Zx(hke()),x0(e,2,-2),0)}function JO(e,t,n,r){return ew(e,t,n,jA,x0(e,0,r),x0(e,r+1,-1),r)}function Sh(e,t){for(var n="",r=UA(e),i=0;i6)switch(ki(e,t+1)){case 109:if(ki(e,t+4)!==45)break;case 102:return ln(e,/(.+:)(.+)-([^]+)/,"$1"+sn+"$2-$3$1"+U_+(ki(e,t+3)==108?"$3":"$2-$3"))+e;case 115:return~aT(e,"stretch")?wq(ln(e,"stretch","fill-available"),t)+e:e}break;case 4949:if(ki(e,t+1)!==115)break;case 6444:switch(ki(e,ks(e)-3-(~aT(e,"!important")&&10))){case 107:return ln(e,":",":"+sn)+e;case 101:return ln(e,/(.+:)([^;!]+)(;|!.+)?/,"$1"+sn+(ki(e,14)===45?"inline-":"")+"box$3$1"+sn+"$2$3$1"+Bi+"$2box$3")+e}break;case 5936:switch(ki(e,t+11)){case 114:return sn+e+Bi+ln(e,/[svh]\w+-[tblr]{2}/,"tb")+e;case 108:return sn+e+Bi+ln(e,/[svh]\w+-[tblr]{2}/,"tb-rl")+e;case 45:return sn+e+Bi+ln(e,/[svh]\w+-[tblr]{2}/,"lr")+e}return sn+e+Bi+e+e}return e}var Pke=function(t,n,r,i){if(t.length>-1&&!t.return)switch(t.type){case jA:t.return=wq(t.value,t.length);break;case yq:return Sh([og(t,{value:ln(t.value,"@","@"+sn)})],i);case zA:if(t.length)return fke(t.props,function(o){switch(dke(o,/(::plac\w+|:read-\w+)/)){case":read-only":case":read-write":return Sh([og(t,{props:[ln(o,/:(read-\w+)/,":"+U_+"$1")]})],i);case"::placeholder":return Sh([og(t,{props:[ln(o,/:(plac\w+)/,":"+sn+"input-$1")]}),og(t,{props:[ln(o,/:(plac\w+)/,":"+U_+"$1")]}),og(t,{props:[ln(o,/:(plac\w+)/,Bi+"input-$1")]})],i)}return""})}},Ike=[Pke],Rke=function(t){var n=t.key;if(n==="css"){var r=document.querySelectorAll("style[data-emotion]:not([data-s])");Array.prototype.forEach.call(r,function(m){var _=m.getAttribute("data-emotion");_.indexOf(" ")!==-1&&(document.head.appendChild(m),m.setAttribute("data-s",""))})}var i=t.stylisPlugins||Ike,o={},a,s=[];a=t.container||document.head,Array.prototype.forEach.call(document.querySelectorAll('style[data-emotion^="'+n+' "]'),function(m){for(var _=m.getAttribute("data-emotion").split(" "),b=1;b<_.length;b++)o[_[b]]=!0;s.push(m)});var l,u=[kke,Ake];{var c,d=[Ske,wke(function(m){c.insert(m)})],f=xke(u.concat(i,d)),h=function(_){return Sh(bke(_),f)};l=function(_,b,v,g){c=v,h(_?_+"{"+b.styles+"}":b.styles),g&&(p.inserted[b.name]=!0)}}var p={key:n,sheet:new oke({key:n,container:a,nonce:t.nonce,speedy:t.speedy,prepend:t.prepend,insertionPoint:t.insertionPoint}),nonce:t.nonce,inserted:o,registered:{},insert:l};return p.sheet.hydrate(s),p},Oke=!0;function Mke(e,t,n){var r="";return n.split(" ").forEach(function(i){e[i]!==void 0?t.push(e[i]+";"):r+=i+" "}),r}var Cq=function(t,n,r){var i=t.key+"-"+n.name;(r===!1||Oke===!1)&&t.registered[i]===void 0&&(t.registered[i]=n.styles)},Eq=function(t,n,r){Cq(t,n,r);var i=t.key+"-"+n.name;if(t.inserted[n.name]===void 0){var o=n;do t.insert(n===o?"."+i:"",o,t.sheet,!0),o=o.next;while(o!==void 0)}};function Nke(e){for(var t=0,n,r=0,i=e.length;i>=4;++r,i-=4)n=e.charCodeAt(r)&255|(e.charCodeAt(++r)&255)<<8|(e.charCodeAt(++r)&255)<<16|(e.charCodeAt(++r)&255)<<24,n=(n&65535)*1540483477+((n>>>16)*59797<<16),n^=n>>>24,t=(n&65535)*1540483477+((n>>>16)*59797<<16)^(t&65535)*1540483477+((t>>>16)*59797<<16);switch(i){case 3:t^=(e.charCodeAt(r+2)&255)<<16;case 2:t^=(e.charCodeAt(r+1)&255)<<8;case 1:t^=e.charCodeAt(r)&255,t=(t&65535)*1540483477+((t>>>16)*59797<<16)}return t^=t>>>13,t=(t&65535)*1540483477+((t>>>16)*59797<<16),((t^t>>>15)>>>0).toString(36)}var $ke={animationIterationCount:1,aspectRatio:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,msGridRow:1,msGridRowSpan:1,msGridColumn:1,msGridColumnSpan:1,fontWeight:1,lineHeight:1,opacity:1,order:1,orphans:1,tabSize:1,widows:1,zIndex:1,zoom:1,WebkitLineClamp:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1},Dke=/[A-Z]|^ms/g,Lke=/_EMO_([^_]+?)_([^]*?)_EMO_/g,Tq=function(t){return t.charCodeAt(1)===45},nM=function(t){return t!=null&&typeof t!="boolean"},o5=xq(function(e){return Tq(e)?e:e.replace(Dke,"-$&").toLowerCase()}),rM=function(t,n){switch(t){case"animation":case"animationName":if(typeof n=="string")return n.replace(Lke,function(r,i,o){return As={name:i,styles:o,next:As},i})}return $ke[t]!==1&&!Tq(t)&&typeof n=="number"&&n!==0?n+"px":n};function C0(e,t,n){if(n==null)return"";if(n.__emotion_styles!==void 0)return n;switch(typeof n){case"boolean":return"";case"object":{if(n.anim===1)return As={name:n.name,styles:n.styles,next:As},n.name;if(n.styles!==void 0){var r=n.next;if(r!==void 0)for(;r!==void 0;)As={name:r.name,styles:r.styles,next:As},r=r.next;var i=n.styles+";";return i}return Fke(e,t,n)}case"function":{if(e!==void 0){var o=As,a=n(e);return As=o,C0(e,t,a)}break}}if(t==null)return n;var s=t[n];return s!==void 0?s:n}function Fke(e,t,n){var r="";if(Array.isArray(n))for(var i=0;iW.jsx("div",{className:"chakra-portal-zIndex",style:{position:"absolute",zIndex:e.zIndex,top:0,left:0,right:0},children:e.children}),Jke=e=>{const{appendToParentPortal:t,children:n}=e,[r,i]=I.useState(null),o=I.useRef(null),[,a]=I.useState({});I.useEffect(()=>a({}),[]);const s=Xke(),l=Kke();V_(()=>{if(!r)return;const c=r.ownerDocument,d=t?s??c.body:c.body;if(!d)return;o.current=c.createElement("div"),o.current.className=GA,d.appendChild(o.current),a({});const f=o.current;return()=>{d.contains(f)&&d.removeChild(f)}},[r]);const u=l!=null&&l.zIndex?W.jsx(Zke,{zIndex:l==null?void 0:l.zIndex,children:n}):n;return o.current?Uo.createPortal(W.jsx(Rq,{value:o.current,children:u}),o.current):W.jsx("span",{ref:c=>{c&&i(c)}})},eAe=e=>{const{children:t,containerRef:n,appendToParentPortal:r}=e,i=n.current,o=i??(typeof window<"u"?document.body:void 0),a=I.useMemo(()=>{const l=i==null?void 0:i.ownerDocument.createElement("div");return l&&(l.className=GA),l},[i]),[,s]=I.useState({});return V_(()=>s({}),[]),V_(()=>{if(!(!a||!o))return o.appendChild(a),()=>{o.removeChild(a)}},[a,o]),o&&a?Uo.createPortal(W.jsx(Rq,{value:r?a:null,children:t}),a):null};function tw(e){const t={appendToParentPortal:!0,...e},{containerRef:n,...r}=t;return n?W.jsx(eAe,{containerRef:n,...r}):W.jsx(Jke,{...r})}tw.className=GA;tw.selector=Yke;tw.displayName="Portal";function Oq(){const e=I.useContext(E0);if(!e)throw Error("useTheme: `theme` is undefined. Seems you forgot to wrap your app in `` or ``");return e}var qA=I.createContext({});qA.displayName="ColorModeContext";function nw(){const e=I.useContext(qA);if(e===void 0)throw new Error("useColorMode must be used within a ColorModeProvider");return e}function DKe(e,t){const{colorMode:n}=nw();return n==="dark"?t:e}function tAe(){const e=nw(),t=Oq();return{...e,theme:t}}function nAe(e,t,n){var r,i;if(t==null)return t;const o=a=>{var s,l;return(l=(s=e.__breakpoints)==null?void 0:s.asArray)==null?void 0:l[a]};return(i=(r=o(t))!=null?r:o(n))!=null?i:n}function rAe(e,t,n){var r,i;if(t==null)return t;const o=a=>{var s,l;return(l=(s=e.__cssMap)==null?void 0:s[a])==null?void 0:l.value};return(i=(r=o(t))!=null?r:o(n))!=null?i:n}function LKe(e,t,n){const r=Oq();return iAe(e,t,n)(r)}function iAe(e,t,n){const r=Array.isArray(t)?t:[t],i=Array.isArray(n)?n:[n];return o=>{const a=i.filter(Boolean),s=r.map((l,u)=>{var c,d;if(e==="breakpoints")return nAe(o,l,(c=a[u])!=null?c:l);const f=`${e}.${l}`;return rAe(o,f,(d=a[u])!=null?d:l)});return Array.isArray(t)?s:s[0]}}var Rc=(...e)=>e.filter(Boolean).join(" ");function oAe(){return!1}function Hs(e){const t=typeof e;return e!=null&&(t==="object"||t==="function")&&!Array.isArray(e)}var FKe=e=>{const{condition:t,message:n}=e;t&&oAe()&&console.warn(n)};function Ds(e,...t){return aAe(e)?e(...t):e}var aAe=e=>typeof e=="function",BKe=e=>e?"":void 0,zKe=e=>e?!0:void 0;function jKe(...e){return function(n){e.some(r=>(r==null||r(n),n==null?void 0:n.defaultPrevented))}}function UKe(...e){return function(n){e.forEach(r=>{r==null||r(n)})}}var G_={exports:{}};G_.exports;(function(e,t){var n=200,r="__lodash_hash_undefined__",i=800,o=16,a=9007199254740991,s="[object Arguments]",l="[object Array]",u="[object AsyncFunction]",c="[object Boolean]",d="[object Date]",f="[object Error]",h="[object Function]",p="[object GeneratorFunction]",m="[object Map]",_="[object Number]",b="[object Null]",v="[object Object]",g="[object Proxy]",y="[object RegExp]",S="[object Set]",w="[object String]",x="[object Undefined]",C="[object WeakMap]",k="[object ArrayBuffer]",T="[object DataView]",P="[object Float32Array]",$="[object Float64Array]",O="[object Int8Array]",E="[object Int16Array]",A="[object Int32Array]",D="[object Uint8Array]",L="[object Uint8ClampedArray]",M="[object Uint16Array]",R="[object Uint32Array]",N=/[\\^$.*+?()[\]{}|]/g,B=/^\[object .+?Constructor\]$/,U=/^(?:0|[1-9]\d*)$/,G={};G[P]=G[$]=G[O]=G[E]=G[A]=G[D]=G[L]=G[M]=G[R]=!0,G[s]=G[l]=G[k]=G[c]=G[T]=G[d]=G[f]=G[h]=G[m]=G[_]=G[v]=G[y]=G[S]=G[w]=G[C]=!1;var Y=typeof yt=="object"&&yt&&yt.Object===Object&&yt,ee=typeof self=="object"&&self&&self.Object===Object&&self,J=Y||ee||Function("return this")(),j=t&&!t.nodeType&&t,Q=j&&!0&&e&&!e.nodeType&&e,ne=Q&&Q.exports===j,se=ne&&Y.process,ve=function(){try{var F=Q&&Q.require&&Q.require("util").types;return F||se&&se.binding&&se.binding("util")}catch{}}(),ce=ve&&ve.isTypedArray;function bt(F,V,X){switch(X.length){case 0:return F.call(V);case 1:return F.call(V,X[0]);case 2:return F.call(V,X[0],X[1]);case 3:return F.call(V,X[0],X[1],X[2])}return F.apply(V,X)}function ot(F,V){for(var X=-1,pe=Array(F);++X-1}function ia(F,V){var X=this.__data__,pe=Ye(X,F);return pe<0?(++this.size,X.push([F,V])):X[pe][1]=V,this}zr.prototype.clear=Da,zr.prototype.delete=ps,zr.prototype.get=mi,zr.prototype.has=iu,zr.prototype.set=ia;function ni(F){var V=-1,X=F==null?0:F.length;for(this.clear();++V1?X[Ct-1]:void 0,Pn=Ct>2?X[2]:void 0;for(hn=F.length>3&&typeof hn=="function"?(Ct--,hn):void 0,Pn&&Nt(X[0],X[1],Pn)&&(hn=Ct<3?void 0:hn,Ct=1),V=Object(V);++pe-1&&F%1==0&&F0){if(++V>=i)return arguments[0]}else V=0;return F.apply(void 0,arguments)}}function ft(F){if(F!=null){try{return en.call(F)}catch{}try{return F+""}catch{}}return""}function Ve(F,V){return F===V||F!==F&&V!==V}var we=_t(function(){return arguments}())?_t:function(F){return Ae(F)&&Ln.call(F,"callee")&&!Qi.call(F,"callee")},ue=Array.isArray;function Ee(F){return F!=null&&et(F.length)&&!Ce(F)}function fe(F){return Ae(F)&&Ee(F)}var ge=ol||Xi;function Ce(F){if(!Qe(F))return!1;var V=dt(F);return V==h||V==p||V==u||V==g}function et(F){return typeof F=="number"&&F>-1&&F%1==0&&F<=a}function Qe(F){var V=typeof F;return F!=null&&(V=="object"||V=="function")}function Ae(F){return F!=null&&typeof F=="object"}function kt(F){if(!Ae(F)||dt(F)!=v)return!1;var V=Mi(F);if(V===null)return!0;var X=Ln.call(V,"constructor")&&V.constructor;return typeof X=="function"&&X instanceof X&&en.call(X)==Jr}var jt=ce?ze(ce):Tt;function Vt(F){return La(F,or(F))}function or(F){return Ee(F)?Ie(F,!0):cn(F)}var pr=it(function(F,V,X,pe){dn(F,V,X,pe)});function zn(F){return function(){return F}}function An(F){return F}function Xi(){return!1}e.exports=pr})(G_,G_.exports);var sAe=G_.exports;const Ls=mc(sAe);var lAe=e=>/!(important)?$/.test(e),aM=e=>typeof e=="string"?e.replace(/!(important)?$/,"").trim():e,uAe=(e,t)=>n=>{const r=String(t),i=lAe(r),o=aM(r),a=e?`${e}.${o}`:o;let s=Hs(n.__cssMap)&&a in n.__cssMap?n.__cssMap[a].varRef:t;return s=aM(s),i?`${s} !important`:s};function HA(e){const{scale:t,transform:n,compose:r}=e;return(o,a)=>{var s;const l=uAe(t,o)(a);let u=(s=n==null?void 0:n(l,a))!=null?s:l;return r&&(u=r(u,a)),u}}var Kv=(...e)=>t=>e.reduce((n,r)=>r(n),t);function la(e,t){return n=>{const r={property:n,scale:e};return r.transform=HA({scale:e,transform:t}),r}}var cAe=({rtl:e,ltr:t})=>n=>n.direction==="rtl"?e:t;function dAe(e){const{property:t,scale:n,transform:r}=e;return{scale:n,property:cAe(t),transform:n?HA({scale:n,compose:r}):r}}var Mq=["rotate(var(--chakra-rotate, 0))","scaleX(var(--chakra-scale-x, 1))","scaleY(var(--chakra-scale-y, 1))","skewX(var(--chakra-skew-x, 0))","skewY(var(--chakra-skew-y, 0))"];function fAe(){return["translateX(var(--chakra-translate-x, 0))","translateY(var(--chakra-translate-y, 0))",...Mq].join(" ")}function hAe(){return["translate3d(var(--chakra-translate-x, 0), var(--chakra-translate-y, 0), 0)",...Mq].join(" ")}var pAe={"--chakra-blur":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-brightness":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-contrast":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-grayscale":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-hue-rotate":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-invert":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-saturate":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-sepia":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-drop-shadow":"var(--chakra-empty,/*!*/ /*!*/)",filter:["var(--chakra-blur)","var(--chakra-brightness)","var(--chakra-contrast)","var(--chakra-grayscale)","var(--chakra-hue-rotate)","var(--chakra-invert)","var(--chakra-saturate)","var(--chakra-sepia)","var(--chakra-drop-shadow)"].join(" ")},gAe={backdropFilter:["var(--chakra-backdrop-blur)","var(--chakra-backdrop-brightness)","var(--chakra-backdrop-contrast)","var(--chakra-backdrop-grayscale)","var(--chakra-backdrop-hue-rotate)","var(--chakra-backdrop-invert)","var(--chakra-backdrop-opacity)","var(--chakra-backdrop-saturate)","var(--chakra-backdrop-sepia)"].join(" "),"--chakra-backdrop-blur":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-backdrop-brightness":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-backdrop-contrast":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-backdrop-grayscale":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-backdrop-hue-rotate":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-backdrop-invert":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-backdrop-opacity":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-backdrop-saturate":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-backdrop-sepia":"var(--chakra-empty,/*!*/ /*!*/)"};function mAe(e){return{"--chakra-ring-offset-shadow":"var(--chakra-ring-inset) 0 0 0 var(--chakra-ring-offset-width) var(--chakra-ring-offset-color)","--chakra-ring-shadow":"var(--chakra-ring-inset) 0 0 0 calc(var(--chakra-ring-width) + var(--chakra-ring-offset-width)) var(--chakra-ring-color)","--chakra-ring-width":e,boxShadow:["var(--chakra-ring-offset-shadow)","var(--chakra-ring-shadow)","var(--chakra-shadow, 0 0 #0000)"].join(", ")}}var yAe={"row-reverse":{space:"--chakra-space-x-reverse",divide:"--chakra-divide-x-reverse"},"column-reverse":{space:"--chakra-space-y-reverse",divide:"--chakra-divide-y-reverse"}},lT={"to-t":"to top","to-tr":"to top right","to-r":"to right","to-br":"to bottom right","to-b":"to bottom","to-bl":"to bottom left","to-l":"to left","to-tl":"to top left"},vAe=new Set(Object.values(lT)),uT=new Set(["none","-moz-initial","inherit","initial","revert","unset"]),bAe=e=>e.trim();function _Ae(e,t){if(e==null||uT.has(e))return e;if(!(cT(e)||uT.has(e)))return`url('${e}')`;const i=/(^[a-z-A-Z]+)\((.*)\)/g.exec(e),o=i==null?void 0:i[1],a=i==null?void 0:i[2];if(!o||!a)return e;const s=o.includes("-gradient")?o:`${o}-gradient`,[l,...u]=a.split(",").map(bAe).filter(Boolean);if((u==null?void 0:u.length)===0)return e;const c=l in lT?lT[l]:l;u.unshift(c);const d=u.map(f=>{if(vAe.has(f))return f;const h=f.indexOf(" "),[p,m]=h!==-1?[f.substr(0,h),f.substr(h+1)]:[f],_=cT(m)?m:m&&m.split(" "),b=`colors.${p}`,v=b in t.__cssMap?t.__cssMap[b].varRef:p;return _?[v,...Array.isArray(_)?_:[_]].join(" "):v});return`${s}(${d.join(", ")})`}var cT=e=>typeof e=="string"&&e.includes("(")&&e.includes(")"),SAe=(e,t)=>_Ae(e,t??{});function xAe(e){return/^var\(--.+\)$/.test(e)}var wAe=e=>{const t=parseFloat(e.toString()),n=e.toString().replace(String(t),"");return{unitless:!n,value:t,unit:n}},_s=e=>t=>`${e}(${t})`,Kt={filter(e){return e!=="auto"?e:pAe},backdropFilter(e){return e!=="auto"?e:gAe},ring(e){return mAe(Kt.px(e))},bgClip(e){return e==="text"?{color:"transparent",backgroundClip:"text"}:{backgroundClip:e}},transform(e){return e==="auto"?fAe():e==="auto-gpu"?hAe():e},vh(e){return e==="$100vh"?"var(--chakra-vh)":e},px(e){if(e==null)return e;const{unitless:t}=wAe(e);return t||typeof e=="number"?`${e}px`:e},fraction(e){return typeof e!="number"||e>1?e:`${e*100}%`},float(e,t){const n={left:"right",right:"left"};return t.direction==="rtl"?n[e]:e},degree(e){if(xAe(e)||e==null)return e;const t=typeof e=="string"&&!e.endsWith("deg");return typeof e=="number"||t?`${e}deg`:e},gradient:SAe,blur:_s("blur"),opacity:_s("opacity"),brightness:_s("brightness"),contrast:_s("contrast"),dropShadow:_s("drop-shadow"),grayscale:_s("grayscale"),hueRotate:_s("hue-rotate"),invert:_s("invert"),saturate:_s("saturate"),sepia:_s("sepia"),bgImage(e){return e==null||cT(e)||uT.has(e)?e:`url(${e})`},outline(e){const t=String(e)==="0"||String(e)==="none";return e!==null&&t?{outline:"2px solid transparent",outlineOffset:"2px"}:{outline:e}},flexDirection(e){var t;const{space:n,divide:r}=(t=yAe[e])!=null?t:{},i={flexDirection:e};return n&&(i[n]=1),r&&(i[r]=1),i}},q={borderWidths:la("borderWidths"),borderStyles:la("borderStyles"),colors:la("colors"),borders:la("borders"),gradients:la("gradients",Kt.gradient),radii:la("radii",Kt.px),space:la("space",Kv(Kt.vh,Kt.px)),spaceT:la("space",Kv(Kt.vh,Kt.px)),degreeT(e){return{property:e,transform:Kt.degree}},prop(e,t,n){return{property:e,scale:t,...t&&{transform:HA({scale:t,transform:n})}}},propT(e,t){return{property:e,transform:t}},sizes:la("sizes",Kv(Kt.vh,Kt.px)),sizesT:la("sizes",Kv(Kt.vh,Kt.fraction)),shadows:la("shadows"),logical:dAe,blur:la("blur",Kt.blur)},K1={background:q.colors("background"),backgroundColor:q.colors("backgroundColor"),backgroundImage:q.gradients("backgroundImage"),backgroundSize:!0,backgroundPosition:!0,backgroundRepeat:!0,backgroundAttachment:!0,backgroundClip:{transform:Kt.bgClip},bgSize:q.prop("backgroundSize"),bgPosition:q.prop("backgroundPosition"),bg:q.colors("background"),bgColor:q.colors("backgroundColor"),bgPos:q.prop("backgroundPosition"),bgRepeat:q.prop("backgroundRepeat"),bgAttachment:q.prop("backgroundAttachment"),bgGradient:q.gradients("backgroundImage"),bgClip:{transform:Kt.bgClip}};Object.assign(K1,{bgImage:K1.backgroundImage,bgImg:K1.backgroundImage});var an={border:q.borders("border"),borderWidth:q.borderWidths("borderWidth"),borderStyle:q.borderStyles("borderStyle"),borderColor:q.colors("borderColor"),borderRadius:q.radii("borderRadius"),borderTop:q.borders("borderTop"),borderBlockStart:q.borders("borderBlockStart"),borderTopLeftRadius:q.radii("borderTopLeftRadius"),borderStartStartRadius:q.logical({scale:"radii",property:{ltr:"borderTopLeftRadius",rtl:"borderTopRightRadius"}}),borderEndStartRadius:q.logical({scale:"radii",property:{ltr:"borderBottomLeftRadius",rtl:"borderBottomRightRadius"}}),borderTopRightRadius:q.radii("borderTopRightRadius"),borderStartEndRadius:q.logical({scale:"radii",property:{ltr:"borderTopRightRadius",rtl:"borderTopLeftRadius"}}),borderEndEndRadius:q.logical({scale:"radii",property:{ltr:"borderBottomRightRadius",rtl:"borderBottomLeftRadius"}}),borderRight:q.borders("borderRight"),borderInlineEnd:q.borders("borderInlineEnd"),borderBottom:q.borders("borderBottom"),borderBlockEnd:q.borders("borderBlockEnd"),borderBottomLeftRadius:q.radii("borderBottomLeftRadius"),borderBottomRightRadius:q.radii("borderBottomRightRadius"),borderLeft:q.borders("borderLeft"),borderInlineStart:{property:"borderInlineStart",scale:"borders"},borderInlineStartRadius:q.logical({scale:"radii",property:{ltr:["borderTopLeftRadius","borderBottomLeftRadius"],rtl:["borderTopRightRadius","borderBottomRightRadius"]}}),borderInlineEndRadius:q.logical({scale:"radii",property:{ltr:["borderTopRightRadius","borderBottomRightRadius"],rtl:["borderTopLeftRadius","borderBottomLeftRadius"]}}),borderX:q.borders(["borderLeft","borderRight"]),borderInline:q.borders("borderInline"),borderY:q.borders(["borderTop","borderBottom"]),borderBlock:q.borders("borderBlock"),borderTopWidth:q.borderWidths("borderTopWidth"),borderBlockStartWidth:q.borderWidths("borderBlockStartWidth"),borderTopColor:q.colors("borderTopColor"),borderBlockStartColor:q.colors("borderBlockStartColor"),borderTopStyle:q.borderStyles("borderTopStyle"),borderBlockStartStyle:q.borderStyles("borderBlockStartStyle"),borderBottomWidth:q.borderWidths("borderBottomWidth"),borderBlockEndWidth:q.borderWidths("borderBlockEndWidth"),borderBottomColor:q.colors("borderBottomColor"),borderBlockEndColor:q.colors("borderBlockEndColor"),borderBottomStyle:q.borderStyles("borderBottomStyle"),borderBlockEndStyle:q.borderStyles("borderBlockEndStyle"),borderLeftWidth:q.borderWidths("borderLeftWidth"),borderInlineStartWidth:q.borderWidths("borderInlineStartWidth"),borderLeftColor:q.colors("borderLeftColor"),borderInlineStartColor:q.colors("borderInlineStartColor"),borderLeftStyle:q.borderStyles("borderLeftStyle"),borderInlineStartStyle:q.borderStyles("borderInlineStartStyle"),borderRightWidth:q.borderWidths("borderRightWidth"),borderInlineEndWidth:q.borderWidths("borderInlineEndWidth"),borderRightColor:q.colors("borderRightColor"),borderInlineEndColor:q.colors("borderInlineEndColor"),borderRightStyle:q.borderStyles("borderRightStyle"),borderInlineEndStyle:q.borderStyles("borderInlineEndStyle"),borderTopRadius:q.radii(["borderTopLeftRadius","borderTopRightRadius"]),borderBottomRadius:q.radii(["borderBottomLeftRadius","borderBottomRightRadius"]),borderLeftRadius:q.radii(["borderTopLeftRadius","borderBottomLeftRadius"]),borderRightRadius:q.radii(["borderTopRightRadius","borderBottomRightRadius"])};Object.assign(an,{rounded:an.borderRadius,roundedTop:an.borderTopRadius,roundedTopLeft:an.borderTopLeftRadius,roundedTopRight:an.borderTopRightRadius,roundedTopStart:an.borderStartStartRadius,roundedTopEnd:an.borderStartEndRadius,roundedBottom:an.borderBottomRadius,roundedBottomLeft:an.borderBottomLeftRadius,roundedBottomRight:an.borderBottomRightRadius,roundedBottomStart:an.borderEndStartRadius,roundedBottomEnd:an.borderEndEndRadius,roundedLeft:an.borderLeftRadius,roundedRight:an.borderRightRadius,roundedStart:an.borderInlineStartRadius,roundedEnd:an.borderInlineEndRadius,borderStart:an.borderInlineStart,borderEnd:an.borderInlineEnd,borderTopStartRadius:an.borderStartStartRadius,borderTopEndRadius:an.borderStartEndRadius,borderBottomStartRadius:an.borderEndStartRadius,borderBottomEndRadius:an.borderEndEndRadius,borderStartRadius:an.borderInlineStartRadius,borderEndRadius:an.borderInlineEndRadius,borderStartWidth:an.borderInlineStartWidth,borderEndWidth:an.borderInlineEndWidth,borderStartColor:an.borderInlineStartColor,borderEndColor:an.borderInlineEndColor,borderStartStyle:an.borderInlineStartStyle,borderEndStyle:an.borderInlineEndStyle});var CAe={color:q.colors("color"),textColor:q.colors("color"),fill:q.colors("fill"),stroke:q.colors("stroke")},dT={boxShadow:q.shadows("boxShadow"),mixBlendMode:!0,blendMode:q.prop("mixBlendMode"),backgroundBlendMode:!0,bgBlendMode:q.prop("backgroundBlendMode"),opacity:!0};Object.assign(dT,{shadow:dT.boxShadow});var EAe={filter:{transform:Kt.filter},blur:q.blur("--chakra-blur"),brightness:q.propT("--chakra-brightness",Kt.brightness),contrast:q.propT("--chakra-contrast",Kt.contrast),hueRotate:q.degreeT("--chakra-hue-rotate"),invert:q.propT("--chakra-invert",Kt.invert),saturate:q.propT("--chakra-saturate",Kt.saturate),dropShadow:q.propT("--chakra-drop-shadow",Kt.dropShadow),backdropFilter:{transform:Kt.backdropFilter},backdropBlur:q.blur("--chakra-backdrop-blur"),backdropBrightness:q.propT("--chakra-backdrop-brightness",Kt.brightness),backdropContrast:q.propT("--chakra-backdrop-contrast",Kt.contrast),backdropHueRotate:q.degreeT("--chakra-backdrop-hue-rotate"),backdropInvert:q.propT("--chakra-backdrop-invert",Kt.invert),backdropSaturate:q.propT("--chakra-backdrop-saturate",Kt.saturate)},q_={alignItems:!0,alignContent:!0,justifyItems:!0,justifyContent:!0,flexWrap:!0,flexDirection:{transform:Kt.flexDirection},flex:!0,flexFlow:!0,flexGrow:!0,flexShrink:!0,flexBasis:q.sizes("flexBasis"),justifySelf:!0,alignSelf:!0,order:!0,placeItems:!0,placeContent:!0,placeSelf:!0,gap:q.space("gap"),rowGap:q.space("rowGap"),columnGap:q.space("columnGap")};Object.assign(q_,{flexDir:q_.flexDirection});var Nq={gridGap:q.space("gridGap"),gridColumnGap:q.space("gridColumnGap"),gridRowGap:q.space("gridRowGap"),gridColumn:!0,gridRow:!0,gridAutoFlow:!0,gridAutoColumns:!0,gridColumnStart:!0,gridColumnEnd:!0,gridRowStart:!0,gridRowEnd:!0,gridAutoRows:!0,gridTemplate:!0,gridTemplateColumns:!0,gridTemplateRows:!0,gridTemplateAreas:!0,gridArea:!0},TAe={appearance:!0,cursor:!0,resize:!0,userSelect:!0,pointerEvents:!0,outline:{transform:Kt.outline},outlineOffset:!0,outlineColor:q.colors("outlineColor")},da={width:q.sizesT("width"),inlineSize:q.sizesT("inlineSize"),height:q.sizes("height"),blockSize:q.sizes("blockSize"),boxSize:q.sizes(["width","height"]),minWidth:q.sizes("minWidth"),minInlineSize:q.sizes("minInlineSize"),minHeight:q.sizes("minHeight"),minBlockSize:q.sizes("minBlockSize"),maxWidth:q.sizes("maxWidth"),maxInlineSize:q.sizes("maxInlineSize"),maxHeight:q.sizes("maxHeight"),maxBlockSize:q.sizes("maxBlockSize"),overflow:!0,overflowX:!0,overflowY:!0,overscrollBehavior:!0,overscrollBehaviorX:!0,overscrollBehaviorY:!0,display:!0,aspectRatio:!0,hideFrom:{scale:"breakpoints",transform:(e,t)=>{var n,r,i;return{[`@media screen and (min-width: ${(i=(r=(n=t.__breakpoints)==null?void 0:n.get(e))==null?void 0:r.minW)!=null?i:e})`]:{display:"none"}}}},hideBelow:{scale:"breakpoints",transform:(e,t)=>{var n,r,i;return{[`@media screen and (max-width: ${(i=(r=(n=t.__breakpoints)==null?void 0:n.get(e))==null?void 0:r._minW)!=null?i:e})`]:{display:"none"}}}},verticalAlign:!0,boxSizing:!0,boxDecorationBreak:!0,float:q.propT("float",Kt.float),objectFit:!0,objectPosition:!0,visibility:!0,isolation:!0};Object.assign(da,{w:da.width,h:da.height,minW:da.minWidth,maxW:da.maxWidth,minH:da.minHeight,maxH:da.maxHeight,overscroll:da.overscrollBehavior,overscrollX:da.overscrollBehaviorX,overscrollY:da.overscrollBehaviorY});var kAe={listStyleType:!0,listStylePosition:!0,listStylePos:q.prop("listStylePosition"),listStyleImage:!0,listStyleImg:q.prop("listStyleImage")};function AAe(e,t,n,r){const i=typeof t=="string"?t.split("."):[t];for(r=0;r{const t=new WeakMap;return(r,i,o,a)=>{if(typeof r>"u")return e(r,i,o);t.has(r)||t.set(r,new Map);const s=t.get(r);if(s.has(i))return s.get(i);const l=e(r,i,o,a);return s.set(i,l),l}},IAe=PAe(AAe),RAe={border:"0px",clip:"rect(0, 0, 0, 0)",width:"1px",height:"1px",margin:"-1px",padding:"0px",overflow:"hidden",whiteSpace:"nowrap",position:"absolute"},OAe={position:"static",width:"auto",height:"auto",clip:"auto",padding:"0",margin:"0",overflow:"visible",whiteSpace:"normal"},a5=(e,t,n)=>{const r={},i=IAe(e,t,{});for(const o in i)o in n&&n[o]!=null||(r[o]=i[o]);return r},MAe={srOnly:{transform(e){return e===!0?RAe:e==="focusable"?OAe:{}}},layerStyle:{processResult:!0,transform:(e,t,n)=>a5(t,`layerStyles.${e}`,n)},textStyle:{processResult:!0,transform:(e,t,n)=>a5(t,`textStyles.${e}`,n)},apply:{processResult:!0,transform:(e,t,n)=>a5(t,e,n)}},Xg={position:!0,pos:q.prop("position"),zIndex:q.prop("zIndex","zIndices"),inset:q.spaceT("inset"),insetX:q.spaceT(["left","right"]),insetInline:q.spaceT("insetInline"),insetY:q.spaceT(["top","bottom"]),insetBlock:q.spaceT("insetBlock"),top:q.spaceT("top"),insetBlockStart:q.spaceT("insetBlockStart"),bottom:q.spaceT("bottom"),insetBlockEnd:q.spaceT("insetBlockEnd"),left:q.spaceT("left"),insetInlineStart:q.logical({scale:"space",property:{ltr:"left",rtl:"right"}}),right:q.spaceT("right"),insetInlineEnd:q.logical({scale:"space",property:{ltr:"right",rtl:"left"}})};Object.assign(Xg,{insetStart:Xg.insetInlineStart,insetEnd:Xg.insetInlineEnd});var NAe={ring:{transform:Kt.ring},ringColor:q.colors("--chakra-ring-color"),ringOffset:q.prop("--chakra-ring-offset-width"),ringOffsetColor:q.colors("--chakra-ring-offset-color"),ringInset:q.prop("--chakra-ring-inset")},Un={margin:q.spaceT("margin"),marginTop:q.spaceT("marginTop"),marginBlockStart:q.spaceT("marginBlockStart"),marginRight:q.spaceT("marginRight"),marginInlineEnd:q.spaceT("marginInlineEnd"),marginBottom:q.spaceT("marginBottom"),marginBlockEnd:q.spaceT("marginBlockEnd"),marginLeft:q.spaceT("marginLeft"),marginInlineStart:q.spaceT("marginInlineStart"),marginX:q.spaceT(["marginInlineStart","marginInlineEnd"]),marginInline:q.spaceT("marginInline"),marginY:q.spaceT(["marginTop","marginBottom"]),marginBlock:q.spaceT("marginBlock"),padding:q.space("padding"),paddingTop:q.space("paddingTop"),paddingBlockStart:q.space("paddingBlockStart"),paddingRight:q.space("paddingRight"),paddingBottom:q.space("paddingBottom"),paddingBlockEnd:q.space("paddingBlockEnd"),paddingLeft:q.space("paddingLeft"),paddingInlineStart:q.space("paddingInlineStart"),paddingInlineEnd:q.space("paddingInlineEnd"),paddingX:q.space(["paddingInlineStart","paddingInlineEnd"]),paddingInline:q.space("paddingInline"),paddingY:q.space(["paddingTop","paddingBottom"]),paddingBlock:q.space("paddingBlock")};Object.assign(Un,{m:Un.margin,mt:Un.marginTop,mr:Un.marginRight,me:Un.marginInlineEnd,marginEnd:Un.marginInlineEnd,mb:Un.marginBottom,ml:Un.marginLeft,ms:Un.marginInlineStart,marginStart:Un.marginInlineStart,mx:Un.marginX,my:Un.marginY,p:Un.padding,pt:Un.paddingTop,py:Un.paddingY,px:Un.paddingX,pb:Un.paddingBottom,pl:Un.paddingLeft,ps:Un.paddingInlineStart,paddingStart:Un.paddingInlineStart,pr:Un.paddingRight,pe:Un.paddingInlineEnd,paddingEnd:Un.paddingInlineEnd});var $Ae={textDecorationColor:q.colors("textDecorationColor"),textDecoration:!0,textDecor:{property:"textDecoration"},textDecorationLine:!0,textDecorationStyle:!0,textDecorationThickness:!0,textUnderlineOffset:!0,textShadow:q.shadows("textShadow")},DAe={clipPath:!0,transform:q.propT("transform",Kt.transform),transformOrigin:!0,translateX:q.spaceT("--chakra-translate-x"),translateY:q.spaceT("--chakra-translate-y"),skewX:q.degreeT("--chakra-skew-x"),skewY:q.degreeT("--chakra-skew-y"),scaleX:q.prop("--chakra-scale-x"),scaleY:q.prop("--chakra-scale-y"),scale:q.prop(["--chakra-scale-x","--chakra-scale-y"]),rotate:q.degreeT("--chakra-rotate")},LAe={transition:!0,transitionDelay:!0,animation:!0,willChange:!0,transitionDuration:q.prop("transitionDuration","transition.duration"),transitionProperty:q.prop("transitionProperty","transition.property"),transitionTimingFunction:q.prop("transitionTimingFunction","transition.easing")},FAe={fontFamily:q.prop("fontFamily","fonts"),fontSize:q.prop("fontSize","fontSizes",Kt.px),fontWeight:q.prop("fontWeight","fontWeights"),lineHeight:q.prop("lineHeight","lineHeights"),letterSpacing:q.prop("letterSpacing","letterSpacings"),textAlign:!0,fontStyle:!0,textIndent:!0,wordBreak:!0,overflowWrap:!0,textOverflow:!0,textTransform:!0,whiteSpace:!0,isTruncated:{transform(e){if(e===!0)return{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}}},noOfLines:{static:{overflow:"hidden",textOverflow:"ellipsis",display:"-webkit-box",WebkitBoxOrient:"vertical",WebkitLineClamp:"var(--chakra-line-clamp)"},property:"--chakra-line-clamp"}},BAe={scrollBehavior:!0,scrollSnapAlign:!0,scrollSnapStop:!0,scrollSnapType:!0,scrollMargin:q.spaceT("scrollMargin"),scrollMarginTop:q.spaceT("scrollMarginTop"),scrollMarginBottom:q.spaceT("scrollMarginBottom"),scrollMarginLeft:q.spaceT("scrollMarginLeft"),scrollMarginRight:q.spaceT("scrollMarginRight"),scrollMarginX:q.spaceT(["scrollMarginLeft","scrollMarginRight"]),scrollMarginY:q.spaceT(["scrollMarginTop","scrollMarginBottom"]),scrollPadding:q.spaceT("scrollPadding"),scrollPaddingTop:q.spaceT("scrollPaddingTop"),scrollPaddingBottom:q.spaceT("scrollPaddingBottom"),scrollPaddingLeft:q.spaceT("scrollPaddingLeft"),scrollPaddingRight:q.spaceT("scrollPaddingRight"),scrollPaddingX:q.spaceT(["scrollPaddingLeft","scrollPaddingRight"]),scrollPaddingY:q.spaceT(["scrollPaddingTop","scrollPaddingBottom"])};function $q(e){return Hs(e)&&e.reference?e.reference:String(e)}var rw=(e,...t)=>t.map($q).join(` ${e} `).replace(/calc/g,""),sM=(...e)=>`calc(${rw("+",...e)})`,lM=(...e)=>`calc(${rw("-",...e)})`,fT=(...e)=>`calc(${rw("*",...e)})`,uM=(...e)=>`calc(${rw("/",...e)})`,cM=e=>{const t=$q(e);return t!=null&&!Number.isNaN(parseFloat(t))?String(t).startsWith("-")?String(t).slice(1):`-${t}`:fT(t,-1)},Xc=Object.assign(e=>({add:(...t)=>Xc(sM(e,...t)),subtract:(...t)=>Xc(lM(e,...t)),multiply:(...t)=>Xc(fT(e,...t)),divide:(...t)=>Xc(uM(e,...t)),negate:()=>Xc(cM(e)),toString:()=>e.toString()}),{add:sM,subtract:lM,multiply:fT,divide:uM,negate:cM});function zAe(e,t="-"){return e.replace(/\s+/g,t)}function jAe(e){const t=zAe(e.toString());return VAe(UAe(t))}function UAe(e){return e.includes("\\.")?e:!Number.isInteger(parseFloat(e.toString()))?e.replace(".","\\."):e}function VAe(e){return e.replace(/[!-,/:-@[-^`{-~]/g,"\\$&")}function GAe(e,t=""){return[t,e].filter(Boolean).join("-")}function qAe(e,t){return`var(${e}${t?`, ${t}`:""})`}function HAe(e,t=""){return jAe(`--${GAe(e,t)}`)}function nt(e,t,n){const r=HAe(e,n);return{variable:r,reference:qAe(r,t)}}function WAe(e,t){const n={};for(const r of t){if(Array.isArray(r)){const[i,o]=r;n[i]=nt(`${e}-${i}`,o);continue}n[r]=nt(`${e}-${r}`)}return n}function KAe(e){const t=e==null?0:e.length;return t?e[t-1]:void 0}function QAe(e){const t=parseFloat(e.toString()),n=e.toString().replace(String(t),"");return{unitless:!n,value:t,unit:n}}function hT(e){if(e==null)return e;const{unitless:t}=QAe(e);return t||typeof e=="number"?`${e}px`:e}var Dq=(e,t)=>parseInt(e[1],10)>parseInt(t[1],10)?1:-1,WA=e=>Object.fromEntries(Object.entries(e).sort(Dq));function dM(e){const t=WA(e);return Object.assign(Object.values(t),t)}function XAe(e){const t=Object.keys(WA(e));return new Set(t)}function fM(e){var t;if(!e)return e;e=(t=hT(e))!=null?t:e;const n=-.02;return typeof e=="number"?`${e+n}`:e.replace(/(\d+\.?\d*)/u,r=>`${parseFloat(r)+n}`)}function Tg(e,t){const n=["@media screen"];return e&&n.push("and",`(min-width: ${hT(e)})`),t&&n.push("and",`(max-width: ${hT(t)})`),n.join(" ")}function YAe(e){var t;if(!e)return null;e.base=(t=e.base)!=null?t:"0px";const n=dM(e),r=Object.entries(e).sort(Dq).map(([a,s],l,u)=>{var c;let[,d]=(c=u[l+1])!=null?c:[];return d=parseFloat(d)>0?fM(d):void 0,{_minW:fM(s),breakpoint:a,minW:s,maxW:d,maxWQuery:Tg(null,d),minWQuery:Tg(s),minMaxQuery:Tg(s,d)}}),i=XAe(e),o=Array.from(i.values());return{keys:i,normalized:n,isResponsive(a){const s=Object.keys(a);return s.length>0&&s.every(l=>i.has(l))},asObject:WA(e),asArray:dM(e),details:r,get(a){return r.find(s=>s.breakpoint===a)},media:[null,...n.map(a=>Tg(a)).slice(1)],toArrayValue(a){if(!Hs(a))throw new Error("toArrayValue: value must be an object");const s=o.map(l=>{var u;return(u=a[l])!=null?u:null});for(;KAe(s)===null;)s.pop();return s},toObjectValue(a){if(!Array.isArray(a))throw new Error("toObjectValue: value must be an array");return a.reduce((s,l,u)=>{const c=o[u];return c!=null&&l!=null&&(s[c]=l),s},{})}}}var _i={hover:(e,t)=>`${e}:hover ${t}, ${e}[data-hover] ${t}`,focus:(e,t)=>`${e}:focus ${t}, ${e}[data-focus] ${t}`,focusVisible:(e,t)=>`${e}:focus-visible ${t}`,focusWithin:(e,t)=>`${e}:focus-within ${t}`,active:(e,t)=>`${e}:active ${t}, ${e}[data-active] ${t}`,disabled:(e,t)=>`${e}:disabled ${t}, ${e}[data-disabled] ${t}`,invalid:(e,t)=>`${e}:invalid ${t}, ${e}[data-invalid] ${t}`,checked:(e,t)=>`${e}:checked ${t}, ${e}[data-checked] ${t}`,indeterminate:(e,t)=>`${e}:indeterminate ${t}, ${e}[aria-checked=mixed] ${t}, ${e}[data-indeterminate] ${t}`,readOnly:(e,t)=>`${e}:read-only ${t}, ${e}[readonly] ${t}, ${e}[data-read-only] ${t}`,expanded:(e,t)=>`${e}:read-only ${t}, ${e}[aria-expanded=true] ${t}, ${e}[data-expanded] ${t}`,placeholderShown:(e,t)=>`${e}:placeholder-shown ${t}`},fu=e=>Lq(t=>e(t,"&"),"[role=group]","[data-group]",".group"),fl=e=>Lq(t=>e(t,"~ &"),"[data-peer]",".peer"),Lq=(e,...t)=>t.map(e).join(", "),iw={_hover:"&:hover, &[data-hover]",_active:"&:active, &[data-active]",_focus:"&:focus, &[data-focus]",_highlighted:"&[data-highlighted]",_focusWithin:"&:focus-within",_focusVisible:"&:focus-visible, &[data-focus-visible]",_disabled:"&:disabled, &[disabled], &[aria-disabled=true], &[data-disabled]",_readOnly:"&[aria-readonly=true], &[readonly], &[data-readonly]",_before:"&::before",_after:"&::after",_empty:"&:empty",_expanded:"&[aria-expanded=true], &[data-expanded]",_checked:"&[aria-checked=true], &[data-checked]",_grabbed:"&[aria-grabbed=true], &[data-grabbed]",_pressed:"&[aria-pressed=true], &[data-pressed]",_invalid:"&[aria-invalid=true], &[data-invalid]",_valid:"&[data-valid], &[data-state=valid]",_loading:"&[data-loading], &[aria-busy=true]",_selected:"&[aria-selected=true], &[data-selected]",_hidden:"&[hidden], &[data-hidden]",_autofill:"&:-webkit-autofill",_even:"&:nth-of-type(even)",_odd:"&:nth-of-type(odd)",_first:"&:first-of-type",_firstLetter:"&::first-letter",_last:"&:last-of-type",_notFirst:"&:not(:first-of-type)",_notLast:"&:not(:last-of-type)",_visited:"&:visited",_activeLink:"&[aria-current=page]",_activeStep:"&[aria-current=step]",_indeterminate:"&:indeterminate, &[aria-checked=mixed], &[data-indeterminate]",_groupHover:fu(_i.hover),_peerHover:fl(_i.hover),_groupFocus:fu(_i.focus),_peerFocus:fl(_i.focus),_groupFocusVisible:fu(_i.focusVisible),_peerFocusVisible:fl(_i.focusVisible),_groupActive:fu(_i.active),_peerActive:fl(_i.active),_groupDisabled:fu(_i.disabled),_peerDisabled:fl(_i.disabled),_groupInvalid:fu(_i.invalid),_peerInvalid:fl(_i.invalid),_groupChecked:fu(_i.checked),_peerChecked:fl(_i.checked),_groupFocusWithin:fu(_i.focusWithin),_peerFocusWithin:fl(_i.focusWithin),_peerPlaceholderShown:fl(_i.placeholderShown),_placeholder:"&::placeholder",_placeholderShown:"&:placeholder-shown",_fullScreen:"&:fullscreen",_selection:"&::selection",_rtl:"[dir=rtl] &, &[dir=rtl]",_ltr:"[dir=ltr] &, &[dir=ltr]",_mediaDark:"@media (prefers-color-scheme: dark)",_mediaReduceMotion:"@media (prefers-reduced-motion: reduce)",_dark:".chakra-ui-dark &:not([data-theme]),[data-theme=dark] &:not([data-theme]),&[data-theme=dark]",_light:".chakra-ui-light &:not([data-theme]),[data-theme=light] &:not([data-theme]),&[data-theme=light]",_horizontal:"&[data-orientation=horizontal]",_vertical:"&[data-orientation=vertical]"},Fq=Object.keys(iw);function hM(e,t){return nt(String(e).replace(/\./g,"-"),void 0,t)}function ZAe(e,t){let n={};const r={};for(const[i,o]of Object.entries(e)){const{isSemantic:a,value:s}=o,{variable:l,reference:u}=hM(i,t==null?void 0:t.cssVarPrefix);if(!a){if(i.startsWith("space")){const f=i.split("."),[h,...p]=f,m=`${h}.-${p.join(".")}`,_=Xc.negate(s),b=Xc.negate(u);r[m]={value:_,var:l,varRef:b}}n[l]=s,r[i]={value:s,var:l,varRef:u};continue}const c=f=>{const p=[String(i).split(".")[0],f].join(".");if(!e[p])return f;const{reference:_}=hM(p,t==null?void 0:t.cssVarPrefix);return _},d=Hs(s)?s:{default:s};n=Ls(n,Object.entries(d).reduce((f,[h,p])=>{var m,_;if(!p)return f;const b=c(`${p}`);if(h==="default")return f[l]=b,f;const v=(_=(m=iw)==null?void 0:m[h])!=null?_:h;return f[v]={[l]:b},f},{})),r[i]={value:u,var:l,varRef:u}}return{cssVars:n,cssMap:r}}function JAe(e,t=[]){const n=Object.assign({},e);for(const r of t)r in n&&delete n[r];return n}function ePe(e,t){const n={};for(const r of t)r in e&&(n[r]=e[r]);return n}function tPe(e){return typeof e=="object"&&e!=null&&!Array.isArray(e)}function pM(e,t,n={}){const{stop:r,getKey:i}=n;function o(a,s=[]){var l;if(tPe(a)||Array.isArray(a)){const u={};for(const[c,d]of Object.entries(a)){const f=(l=i==null?void 0:i(c))!=null?l:c,h=[...s,f];if(r!=null&&r(a,h))return t(a,s);u[f]=o(d,h)}return u}return t(a,s)}return o(e)}var nPe=["colors","borders","borderWidths","borderStyles","fonts","fontSizes","fontWeights","gradients","letterSpacings","lineHeights","radii","space","shadows","sizes","zIndices","transition","blur","breakpoints"];function rPe(e){return ePe(e,nPe)}function iPe(e){return e.semanticTokens}function oPe(e){const{__cssMap:t,__cssVars:n,__breakpoints:r,...i}=e;return i}var aPe=e=>Fq.includes(e)||e==="default";function sPe({tokens:e,semanticTokens:t}){const n={};return pM(e,(r,i)=>{r!=null&&(n[i.join(".")]={isSemantic:!1,value:r})}),pM(t,(r,i)=>{r!=null&&(n[i.join(".")]={isSemantic:!0,value:r})},{stop:r=>Object.keys(r).every(aPe)}),n}function lPe(e){var t;const n=oPe(e),r=rPe(n),i=iPe(n),o=sPe({tokens:r,semanticTokens:i}),a=(t=n.config)==null?void 0:t.cssVarPrefix,{cssMap:s,cssVars:l}=ZAe(o,{cssVarPrefix:a});return Object.assign(n,{__cssVars:{...{"--chakra-ring-inset":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-ring-offset-width":"0px","--chakra-ring-offset-color":"#fff","--chakra-ring-color":"rgba(66, 153, 225, 0.6)","--chakra-ring-offset-shadow":"0 0 #0000","--chakra-ring-shadow":"0 0 #0000","--chakra-space-x-reverse":"0","--chakra-space-y-reverse":"0"},...l},__cssMap:s,__breakpoints:YAe(n.breakpoints)}),n}var KA=Ls({},K1,an,CAe,q_,da,EAe,NAe,TAe,Nq,MAe,Xg,dT,Un,BAe,FAe,$Ae,DAe,kAe,LAe),uPe=Object.assign({},Un,da,q_,Nq,Xg),VKe=Object.keys(uPe),cPe=[...Object.keys(KA),...Fq],dPe={...KA,...iw},fPe=e=>e in dPe,hPe=e=>t=>{if(!t.__breakpoints)return e;const{isResponsive:n,toArrayValue:r,media:i}=t.__breakpoints,o={};for(const a in e){let s=Ds(e[a],t);if(s==null)continue;if(s=Hs(s)&&n(s)?r(s):s,!Array.isArray(s)){o[a]=s;continue}const l=s.slice(0,i.length).length;for(let u=0;ue.startsWith("--")&&typeof t=="string"&&!gPe(t),yPe=(e,t)=>{var n,r;if(t==null)return t;const i=l=>{var u,c;return(c=(u=e.__cssMap)==null?void 0:u[l])==null?void 0:c.varRef},o=l=>{var u;return(u=i(l))!=null?u:l},[a,s]=pPe(t);return t=(r=(n=i(a))!=null?n:o(s))!=null?r:o(t),t};function vPe(e){const{configs:t={},pseudos:n={},theme:r}=e,i=(o,a=!1)=>{var s,l,u;const c=Ds(o,r),d=hPe(c)(r);let f={};for(let h in d){const p=d[h];let m=Ds(p,r);h in n&&(h=n[h]),mPe(h,m)&&(m=yPe(r,m));let _=t[h];if(_===!0&&(_={property:h}),Hs(m)){f[h]=(s=f[h])!=null?s:{},f[h]=Ls({},f[h],i(m,!0));continue}let b=(u=(l=_==null?void 0:_.transform)==null?void 0:l.call(_,m,r,c))!=null?u:m;b=_!=null&&_.processResult?i(b,!0):b;const v=Ds(_==null?void 0:_.property,r);if(!a&&(_!=null&&_.static)){const g=Ds(_.static,r);f=Ls({},f,g)}if(v&&Array.isArray(v)){for(const g of v)f[g]=b;continue}if(v){v==="&"&&Hs(b)?f=Ls({},f,b):f[v]=b;continue}if(Hs(b)){f=Ls({},f,b);continue}f[h]=b}return f};return i}var Bq=e=>t=>vPe({theme:t,pseudos:iw,configs:KA})(e);function Pt(e){return{definePartsStyle(t){return t},defineMultiStyleConfig(t){return{parts:e,...t}}}}function bPe(e,t){if(Array.isArray(e))return e;if(Hs(e))return t(e);if(e!=null)return[e]}function _Pe(e,t){for(let n=t+1;n{Ls(u,{[g]:f?v[g]:{[b]:v[g]}})});continue}if(!h){f?Ls(u,v):u[b]=v;continue}u[b]=v}}return u}}function xPe(e){return t=>{var n;const{variant:r,size:i,theme:o}=t,a=SPe(o);return Ls({},Ds((n=e.baseStyle)!=null?n:{},t),a(e,"sizes",i,t),a(e,"variants",r,t))}}function GKe(e,t,n){var r,i,o;return(o=(i=(r=e.__cssMap)==null?void 0:r[`${t}.${n}`])==null?void 0:i.varRef)!=null?o:n}function Iy(e){return JAe(e,["styleConfig","size","variant","colorScheme"])}var wPe={common:"background-color, border-color, color, fill, stroke, opacity, box-shadow, transform",colors:"background-color, border-color, color, fill, stroke",dimensions:"width, height",position:"left, right, top, bottom",background:"background-color, background-image, background-position"},CPe={"ease-in":"cubic-bezier(0.4, 0, 1, 1)","ease-out":"cubic-bezier(0, 0, 0.2, 1)","ease-in-out":"cubic-bezier(0.4, 0, 0.2, 1)"},EPe={"ultra-fast":"50ms",faster:"100ms",fast:"150ms",normal:"200ms",slow:"300ms",slower:"400ms","ultra-slow":"500ms"},TPe={property:wPe,easing:CPe,duration:EPe},kPe=TPe,APe={hide:-1,auto:"auto",base:0,docked:10,dropdown:1e3,sticky:1100,banner:1200,overlay:1300,modal:1400,popover:1500,skipLink:1600,toast:1700,tooltip:1800},PPe=APe,IPe={none:0,"1px":"1px solid","2px":"2px solid","4px":"4px solid","8px":"8px solid"},RPe=IPe,OPe={base:"0em",sm:"30em",md:"48em",lg:"62em",xl:"80em","2xl":"96em"},MPe=OPe,NPe={transparent:"transparent",current:"currentColor",black:"#000000",white:"#FFFFFF",whiteAlpha:{50:"rgba(255, 255, 255, 0.04)",100:"rgba(255, 255, 255, 0.06)",200:"rgba(255, 255, 255, 0.08)",300:"rgba(255, 255, 255, 0.16)",400:"rgba(255, 255, 255, 0.24)",500:"rgba(255, 255, 255, 0.36)",600:"rgba(255, 255, 255, 0.48)",700:"rgba(255, 255, 255, 0.64)",800:"rgba(255, 255, 255, 0.80)",900:"rgba(255, 255, 255, 0.92)"},blackAlpha:{50:"rgba(0, 0, 0, 0.04)",100:"rgba(0, 0, 0, 0.06)",200:"rgba(0, 0, 0, 0.08)",300:"rgba(0, 0, 0, 0.16)",400:"rgba(0, 0, 0, 0.24)",500:"rgba(0, 0, 0, 0.36)",600:"rgba(0, 0, 0, 0.48)",700:"rgba(0, 0, 0, 0.64)",800:"rgba(0, 0, 0, 0.80)",900:"rgba(0, 0, 0, 0.92)"},gray:{50:"#F7FAFC",100:"#EDF2F7",200:"#E2E8F0",300:"#CBD5E0",400:"#A0AEC0",500:"#718096",600:"#4A5568",700:"#2D3748",800:"#1A202C",900:"#171923"},red:{50:"#FFF5F5",100:"#FED7D7",200:"#FEB2B2",300:"#FC8181",400:"#F56565",500:"#E53E3E",600:"#C53030",700:"#9B2C2C",800:"#822727",900:"#63171B"},orange:{50:"#FFFAF0",100:"#FEEBC8",200:"#FBD38D",300:"#F6AD55",400:"#ED8936",500:"#DD6B20",600:"#C05621",700:"#9C4221",800:"#7B341E",900:"#652B19"},yellow:{50:"#FFFFF0",100:"#FEFCBF",200:"#FAF089",300:"#F6E05E",400:"#ECC94B",500:"#D69E2E",600:"#B7791F",700:"#975A16",800:"#744210",900:"#5F370E"},green:{50:"#F0FFF4",100:"#C6F6D5",200:"#9AE6B4",300:"#68D391",400:"#48BB78",500:"#38A169",600:"#2F855A",700:"#276749",800:"#22543D",900:"#1C4532"},teal:{50:"#E6FFFA",100:"#B2F5EA",200:"#81E6D9",300:"#4FD1C5",400:"#38B2AC",500:"#319795",600:"#2C7A7B",700:"#285E61",800:"#234E52",900:"#1D4044"},blue:{50:"#ebf8ff",100:"#bee3f8",200:"#90cdf4",300:"#63b3ed",400:"#4299e1",500:"#3182ce",600:"#2b6cb0",700:"#2c5282",800:"#2a4365",900:"#1A365D"},cyan:{50:"#EDFDFD",100:"#C4F1F9",200:"#9DECF9",300:"#76E4F7",400:"#0BC5EA",500:"#00B5D8",600:"#00A3C4",700:"#0987A0",800:"#086F83",900:"#065666"},purple:{50:"#FAF5FF",100:"#E9D8FD",200:"#D6BCFA",300:"#B794F4",400:"#9F7AEA",500:"#805AD5",600:"#6B46C1",700:"#553C9A",800:"#44337A",900:"#322659"},pink:{50:"#FFF5F7",100:"#FED7E2",200:"#FBB6CE",300:"#F687B3",400:"#ED64A6",500:"#D53F8C",600:"#B83280",700:"#97266D",800:"#702459",900:"#521B41"},linkedin:{50:"#E8F4F9",100:"#CFEDFB",200:"#9BDAF3",300:"#68C7EC",400:"#34B3E4",500:"#00A0DC",600:"#008CC9",700:"#0077B5",800:"#005E93",900:"#004471"},facebook:{50:"#E8F4F9",100:"#D9DEE9",200:"#B7C2DA",300:"#6482C0",400:"#4267B2",500:"#385898",600:"#314E89",700:"#29487D",800:"#223B67",900:"#1E355B"},messenger:{50:"#D0E6FF",100:"#B9DAFF",200:"#A2CDFF",300:"#7AB8FF",400:"#2E90FF",500:"#0078FF",600:"#0063D1",700:"#0052AC",800:"#003C7E",900:"#002C5C"},whatsapp:{50:"#dffeec",100:"#b9f5d0",200:"#90edb3",300:"#65e495",400:"#3cdd78",500:"#22c35e",600:"#179848",700:"#0c6c33",800:"#01421c",900:"#001803"},twitter:{50:"#E5F4FD",100:"#C8E9FB",200:"#A8DCFA",300:"#83CDF7",400:"#57BBF5",500:"#1DA1F2",600:"#1A94DA",700:"#1681BF",800:"#136B9E",900:"#0D4D71"},telegram:{50:"#E3F2F9",100:"#C5E4F3",200:"#A2D4EC",300:"#7AC1E4",400:"#47A9DA",500:"#0088CC",600:"#007AB8",700:"#006BA1",800:"#005885",900:"#003F5E"}},$Pe=NPe,DPe={none:"0",sm:"0.125rem",base:"0.25rem",md:"0.375rem",lg:"0.5rem",xl:"0.75rem","2xl":"1rem","3xl":"1.5rem",full:"9999px"},LPe=DPe,FPe={xs:"0 0 0 1px rgba(0, 0, 0, 0.05)",sm:"0 1px 2px 0 rgba(0, 0, 0, 0.05)",base:"0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06)",md:"0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)",lg:"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)",xl:"0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04)","2xl":"0 25px 50px -12px rgba(0, 0, 0, 0.25)",outline:"0 0 0 3px rgba(66, 153, 225, 0.6)",inner:"inset 0 2px 4px 0 rgba(0,0,0,0.06)",none:"none","dark-lg":"rgba(0, 0, 0, 0.1) 0px 0px 0px 1px, rgba(0, 0, 0, 0.2) 0px 5px 10px, rgba(0, 0, 0, 0.4) 0px 15px 40px"},BPe=FPe,zPe={none:0,sm:"4px",base:"8px",md:"12px",lg:"16px",xl:"24px","2xl":"40px","3xl":"64px"},jPe=zPe,UPe={letterSpacings:{tighter:"-0.05em",tight:"-0.025em",normal:"0",wide:"0.025em",wider:"0.05em",widest:"0.1em"},lineHeights:{normal:"normal",none:1,shorter:1.25,short:1.375,base:1.5,tall:1.625,taller:"2",3:".75rem",4:"1rem",5:"1.25rem",6:"1.5rem",7:"1.75rem",8:"2rem",9:"2.25rem",10:"2.5rem"},fontWeights:{hairline:100,thin:200,light:300,normal:400,medium:500,semibold:600,bold:700,extrabold:800,black:900},fonts:{heading:'-apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"',body:'-apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"',mono:'SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace'},fontSizes:{"3xs":"0.45rem","2xs":"0.625rem",xs:"0.75rem",sm:"0.875rem",md:"1rem",lg:"1.125rem",xl:"1.25rem","2xl":"1.5rem","3xl":"1.875rem","4xl":"2.25rem","5xl":"3rem","6xl":"3.75rem","7xl":"4.5rem","8xl":"6rem","9xl":"8rem"}},zq=UPe,jq={px:"1px",.5:"0.125rem",1:"0.25rem",1.5:"0.375rem",2:"0.5rem",2.5:"0.625rem",3:"0.75rem",3.5:"0.875rem",4:"1rem",5:"1.25rem",6:"1.5rem",7:"1.75rem",8:"2rem",9:"2.25rem",10:"2.5rem",12:"3rem",14:"3.5rem",16:"4rem",20:"5rem",24:"6rem",28:"7rem",32:"8rem",36:"9rem",40:"10rem",44:"11rem",48:"12rem",52:"13rem",56:"14rem",60:"15rem",64:"16rem",72:"18rem",80:"20rem",96:"24rem"},VPe={max:"max-content",min:"min-content",full:"100%","3xs":"14rem","2xs":"16rem",xs:"20rem",sm:"24rem",md:"28rem",lg:"32rem",xl:"36rem","2xl":"42rem","3xl":"48rem","4xl":"56rem","5xl":"64rem","6xl":"72rem","7xl":"80rem","8xl":"90rem",prose:"60ch"},GPe={sm:"640px",md:"768px",lg:"1024px",xl:"1280px"},qPe={...jq,...VPe,container:GPe},Uq=qPe,HPe={breakpoints:MPe,zIndices:PPe,radii:LPe,blur:jPe,colors:$Pe,...zq,sizes:Uq,shadows:BPe,space:jq,borders:RPe,transition:kPe},{defineMultiStyleConfig:WPe,definePartsStyle:kg}=Pt(["stepper","step","title","description","indicator","separator","icon","number"]),Tl=nt("stepper-indicator-size"),Uf=nt("stepper-icon-size"),Vf=nt("stepper-title-font-size"),Ag=nt("stepper-description-font-size"),ag=nt("stepper-accent-color"),KPe=kg(({colorScheme:e})=>({stepper:{display:"flex",justifyContent:"space-between",gap:"4","&[data-orientation=vertical]":{flexDirection:"column",alignItems:"flex-start"},"&[data-orientation=horizontal]":{flexDirection:"row",alignItems:"center"},[ag.variable]:`colors.${e}.500`,_dark:{[ag.variable]:`colors.${e}.200`}},title:{fontSize:Vf.reference,fontWeight:"medium"},description:{fontSize:Ag.reference,color:"chakra-subtle-text"},number:{fontSize:Vf.reference},step:{flexShrink:0,position:"relative",display:"flex",gap:"2","&[data-orientation=horizontal]":{alignItems:"center"},flex:"1","&:last-of-type:not([data-stretch])":{flex:"initial"}},icon:{flexShrink:0,width:Uf.reference,height:Uf.reference},indicator:{flexShrink:0,borderRadius:"full",width:Tl.reference,height:Tl.reference,display:"flex",justifyContent:"center",alignItems:"center","&[data-status=active]":{borderWidth:"2px",borderColor:ag.reference},"&[data-status=complete]":{bg:ag.reference,color:"chakra-inverse-text"},"&[data-status=incomplete]":{borderWidth:"2px"}},separator:{bg:"chakra-border-color",flex:"1","&[data-status=complete]":{bg:ag.reference},"&[data-orientation=horizontal]":{width:"100%",height:"2px",marginStart:"2"},"&[data-orientation=vertical]":{width:"2px",position:"absolute",height:"100%",maxHeight:`calc(100% - ${Tl.reference} - 8px)`,top:`calc(${Tl.reference} + 4px)`,insetStart:`calc(${Tl.reference} / 2 - 1px)`}}})),QPe=WPe({baseStyle:KPe,sizes:{xs:kg({stepper:{[Tl.variable]:"sizes.4",[Uf.variable]:"sizes.3",[Vf.variable]:"fontSizes.xs",[Ag.variable]:"fontSizes.xs"}}),sm:kg({stepper:{[Tl.variable]:"sizes.6",[Uf.variable]:"sizes.4",[Vf.variable]:"fontSizes.sm",[Ag.variable]:"fontSizes.xs"}}),md:kg({stepper:{[Tl.variable]:"sizes.8",[Uf.variable]:"sizes.5",[Vf.variable]:"fontSizes.md",[Ag.variable]:"fontSizes.sm"}}),lg:kg({stepper:{[Tl.variable]:"sizes.10",[Uf.variable]:"sizes.6",[Vf.variable]:"fontSizes.lg",[Ag.variable]:"fontSizes.md"}})},defaultProps:{size:"md",colorScheme:"blue"}});function pn(e,t={}){let n=!1;function r(){if(!n){n=!0;return}throw new Error("[anatomy] .part(...) should only be called once. Did you mean to use .extend(...) ?")}function i(...c){r();for(const d of c)t[d]=l(d);return pn(e,t)}function o(...c){for(const d of c)d in t||(t[d]=l(d));return pn(e,t)}function a(){return Object.fromEntries(Object.entries(t).map(([d,f])=>[d,f.selector]))}function s(){return Object.fromEntries(Object.entries(t).map(([d,f])=>[d,f.className]))}function l(c){const h=`chakra-${(["container","root"].includes(c??"")?[e]:[e,c]).filter(Boolean).join("__")}`;return{className:h,selector:`.${h}`,toString:()=>c}}return{parts:i,toPart:l,extend:o,selectors:a,classnames:s,get keys(){return Object.keys(t)},__type:{}}}var Vq=pn("accordion").parts("root","container","button","panel").extend("icon"),XPe=pn("alert").parts("title","description","container").extend("icon","spinner"),YPe=pn("avatar").parts("label","badge","container").extend("excessLabel","group"),ZPe=pn("breadcrumb").parts("link","item","container").extend("separator");pn("button").parts();var Gq=pn("checkbox").parts("control","icon","container").extend("label");pn("progress").parts("track","filledTrack").extend("label");var JPe=pn("drawer").parts("overlay","dialogContainer","dialog").extend("header","closeButton","body","footer"),qq=pn("editable").parts("preview","input","textarea"),e6e=pn("form").parts("container","requiredIndicator","helperText"),t6e=pn("formError").parts("text","icon"),Hq=pn("input").parts("addon","field","element","group"),n6e=pn("list").parts("container","item","icon"),Wq=pn("menu").parts("button","list","item").extend("groupTitle","icon","command","divider"),Kq=pn("modal").parts("overlay","dialogContainer","dialog").extend("header","closeButton","body","footer"),Qq=pn("numberinput").parts("root","field","stepperGroup","stepper");pn("pininput").parts("field");var Xq=pn("popover").parts("content","header","body","footer").extend("popper","arrow","closeButton"),Yq=pn("progress").parts("label","filledTrack","track"),r6e=pn("radio").parts("container","control","label"),Zq=pn("select").parts("field","icon"),Jq=pn("slider").parts("container","track","thumb","filledTrack","mark"),i6e=pn("stat").parts("container","label","helpText","number","icon"),eH=pn("switch").parts("container","track","thumb"),o6e=pn("table").parts("table","thead","tbody","tr","th","td","tfoot","caption"),tH=pn("tabs").parts("root","tab","tablist","tabpanel","tabpanels","indicator"),a6e=pn("tag").parts("container","label","closeButton"),s6e=pn("card").parts("container","header","body","footer");function ld(e,t,n){return Math.min(Math.max(e,n),t)}class l6e extends Error{constructor(t){super(`Failed to parse color: "${t}"`)}}var Pg=l6e;function QA(e){if(typeof e!="string")throw new Pg(e);if(e.trim().toLowerCase()==="transparent")return[0,0,0,0];let t=e.trim();t=m6e.test(e)?d6e(e):e;const n=f6e.exec(t);if(n){const a=Array.from(n).slice(1);return[...a.slice(0,3).map(s=>parseInt(T0(s,2),16)),parseInt(T0(a[3]||"f",2),16)/255]}const r=h6e.exec(t);if(r){const a=Array.from(r).slice(1);return[...a.slice(0,3).map(s=>parseInt(s,16)),parseInt(a[3]||"ff",16)/255]}const i=p6e.exec(t);if(i){const a=Array.from(i).slice(1);return[...a.slice(0,3).map(s=>parseInt(s,10)),parseFloat(a[3]||"1")]}const o=g6e.exec(t);if(o){const[a,s,l,u]=Array.from(o).slice(1).map(parseFloat);if(ld(0,100,s)!==s)throw new Pg(e);if(ld(0,100,l)!==l)throw new Pg(e);return[...y6e(a,s,l),Number.isNaN(u)?1:u]}throw new Pg(e)}function u6e(e){let t=5381,n=e.length;for(;n;)t=t*33^e.charCodeAt(--n);return(t>>>0)%2341}const gM=e=>parseInt(e.replace(/_/g,""),36),c6e="1q29ehhb 1n09sgk7 1kl1ekf_ _yl4zsno 16z9eiv3 1p29lhp8 _bd9zg04 17u0____ _iw9zhe5 _to73___ _r45e31e _7l6g016 _jh8ouiv _zn3qba8 1jy4zshs 11u87k0u 1ro9yvyo 1aj3xael 1gz9zjz0 _3w8l4xo 1bf1ekf_ _ke3v___ _4rrkb__ 13j776yz _646mbhl _nrjr4__ _le6mbhl 1n37ehkb _m75f91n _qj3bzfz 1939yygw 11i5z6x8 _1k5f8xs 1509441m 15t5lwgf _ae2th1n _tg1ugcv 1lp1ugcv 16e14up_ _h55rw7n _ny9yavn _7a11xb_ 1ih442g9 _pv442g9 1mv16xof 14e6y7tu 1oo9zkds 17d1cisi _4v9y70f _y98m8kc 1019pq0v 12o9zda8 _348j4f4 1et50i2o _8epa8__ _ts6senj 1o350i2o 1mi9eiuo 1259yrp0 1ln80gnw _632xcoy 1cn9zldc _f29edu4 1n490c8q _9f9ziet 1b94vk74 _m49zkct 1kz6s73a 1eu9dtog _q58s1rz 1dy9sjiq __u89jo3 _aj5nkwg _ld89jo3 13h9z6wx _qa9z2ii _l119xgq _bs5arju 1hj4nwk9 1qt4nwk9 1ge6wau6 14j9zlcw 11p1edc_ _ms1zcxe _439shk6 _jt9y70f _754zsow 1la40eju _oq5p___ _x279qkz 1fa5r3rv _yd2d9ip _424tcku _8y1di2_ _zi2uabw _yy7rn9h 12yz980_ __39ljp6 1b59zg0x _n39zfzp 1fy9zest _b33k___ _hp9wq92 1il50hz4 _io472ub _lj9z3eo 19z9ykg0 _8t8iu3a 12b9bl4a 1ak5yw0o _896v4ku _tb8k8lv _s59zi6t _c09ze0p 1lg80oqn 1id9z8wb _238nba5 1kq6wgdi _154zssg _tn3zk49 _da9y6tc 1sg7cv4f _r12jvtt 1gq5fmkz 1cs9rvci _lp9jn1c _xw1tdnb 13f9zje6 16f6973h _vo7ir40 _bt5arjf _rc45e4t _hr4e100 10v4e100 _hc9zke2 _w91egv_ _sj2r1kk 13c87yx8 _vqpds__ _ni8ggk8 _tj9yqfb 1ia2j4r4 _7x9b10u 1fc9ld4j 1eq9zldr _5j9lhpx _ez9zl6o _md61fzm".split(" ").reduce((e,t)=>{const n=gM(t.substring(0,3)),r=gM(t.substring(3)).toString(16);let i="";for(let o=0;o<6-r.length;o++)i+="0";return e[n]=`${i}${r}`,e},{});function d6e(e){const t=e.toLowerCase().trim(),n=c6e[u6e(t)];if(!n)throw new Pg(e);return`#${n}`}const T0=(e,t)=>Array.from(Array(t)).map(()=>e).join(""),f6e=new RegExp(`^#${T0("([a-f0-9])",3)}([a-f0-9])?$`,"i"),h6e=new RegExp(`^#${T0("([a-f0-9]{2})",3)}([a-f0-9]{2})?$`,"i"),p6e=new RegExp(`^rgba?\\(\\s*(\\d+)\\s*${T0(",\\s*(\\d+)\\s*",2)}(?:,\\s*([\\d.]+))?\\s*\\)$`,"i"),g6e=/^hsla?\(\s*([\d.]+)\s*,\s*([\d.]+)%\s*,\s*([\d.]+)%(?:\s*,\s*([\d.]+))?\s*\)$/i,m6e=/^[a-z]+$/i,mM=e=>Math.round(e*255),y6e=(e,t,n)=>{let r=n/100;if(t===0)return[r,r,r].map(mM);const i=(e%360+360)%360/60,o=(1-Math.abs(2*r-1))*(t/100),a=o*(1-Math.abs(i%2-1));let s=0,l=0,u=0;i>=0&&i<1?(s=o,l=a):i>=1&&i<2?(s=a,l=o):i>=2&&i<3?(l=o,u=a):i>=3&&i<4?(l=a,u=o):i>=4&&i<5?(s=a,u=o):i>=5&&i<6&&(s=o,u=a);const c=r-o/2,d=s+c,f=l+c,h=u+c;return[d,f,h].map(mM)};function v6e(e,t,n,r){return`rgba(${ld(0,255,e).toFixed()}, ${ld(0,255,t).toFixed()}, ${ld(0,255,n).toFixed()}, ${parseFloat(ld(0,1,r).toFixed(3))})`}function b6e(e,t){const[n,r,i,o]=QA(e);return v6e(n,r,i,o-t)}function _6e(e){const[t,n,r,i]=QA(e);let o=a=>{const s=ld(0,255,a).toString(16);return s.length===1?`0${s}`:s};return`#${o(t)}${o(n)}${o(r)}${i<1?o(Math.round(i*255)):""}`}function S6e(e,t,n,r,i){for(t=t.split?t.split("."):t,r=0;rObject.keys(e).length===0,no=(e,t,n)=>{const r=S6e(e,`colors.${t}`,t);try{return _6e(r),r}catch{return n??"#000000"}},w6e=e=>{const[t,n,r]=QA(e);return(t*299+n*587+r*114)/1e3},C6e=e=>t=>{const n=no(t,e);return w6e(n)<128?"dark":"light"},E6e=e=>t=>C6e(e)(t)==="dark",sp=(e,t)=>n=>{const r=no(n,e);return b6e(r,1-t)};function yM(e="1rem",t="rgba(255, 255, 255, 0.15)"){return{backgroundImage:`linear-gradient( + 45deg, + ${t} 25%, + transparent 25%, + transparent 50%, + ${t} 50%, + ${t} 75%, + transparent 75%, + transparent + )`,backgroundSize:`${e} ${e}`}}var T6e=()=>`#${Math.floor(Math.random()*16777215).toString(16).padEnd(6,"0")}`;function k6e(e){const t=T6e();return!e||x6e(e)?t:e.string&&e.colors?P6e(e.string,e.colors):e.string&&!e.colors?A6e(e.string):e.colors&&!e.string?I6e(e.colors):t}function A6e(e){let t=0;if(e.length===0)return t.toString();for(let r=0;r>r*8&255;n+=`00${i.toString(16)}`.substr(-2)}return n}function P6e(e,t){let n=0;if(e.length===0)return t[0];for(let r=0;rn.colorMode==="dark"?t:e}function XA(e){const{orientation:t,vertical:n,horizontal:r}=e;return t?t==="vertical"?n:r:{}}function nH(e){return Hs(e)&&e.reference?e.reference:String(e)}var ow=(e,...t)=>t.map(nH).join(` ${e} `).replace(/calc/g,""),vM=(...e)=>`calc(${ow("+",...e)})`,bM=(...e)=>`calc(${ow("-",...e)})`,pT=(...e)=>`calc(${ow("*",...e)})`,_M=(...e)=>`calc(${ow("/",...e)})`,SM=e=>{const t=nH(e);return t!=null&&!Number.isNaN(parseFloat(t))?String(t).startsWith("-")?String(t).slice(1):`-${t}`:pT(t,-1)},kl=Object.assign(e=>({add:(...t)=>kl(vM(e,...t)),subtract:(...t)=>kl(bM(e,...t)),multiply:(...t)=>kl(pT(e,...t)),divide:(...t)=>kl(_M(e,...t)),negate:()=>kl(SM(e)),toString:()=>e.toString()}),{add:vM,subtract:bM,multiply:pT,divide:_M,negate:SM});function R6e(e){return!Number.isInteger(parseFloat(e.toString()))}function O6e(e,t="-"){return e.replace(/\s+/g,t)}function rH(e){const t=O6e(e.toString());return t.includes("\\.")?e:R6e(e)?t.replace(".","\\."):e}function M6e(e,t=""){return[t,rH(e)].filter(Boolean).join("-")}function N6e(e,t){return`var(${rH(e)}${t?`, ${t}`:""})`}function $6e(e,t=""){return`--${M6e(e,t)}`}function fr(e,t){const n=$6e(e,t==null?void 0:t.prefix);return{variable:n,reference:N6e(n,D6e(t==null?void 0:t.fallback))}}function D6e(e){return typeof e=="string"?e:e==null?void 0:e.reference}var{defineMultiStyleConfig:L6e,definePartsStyle:Q1}=Pt(eH.keys),Yg=fr("switch-track-width"),bd=fr("switch-track-height"),s5=fr("switch-track-diff"),F6e=kl.subtract(Yg,bd),gT=fr("switch-thumb-x"),sg=fr("switch-bg"),B6e=e=>{const{colorScheme:t}=e;return{borderRadius:"full",p:"0.5",width:[Yg.reference],height:[bd.reference],transitionProperty:"common",transitionDuration:"fast",[sg.variable]:"colors.gray.300",_dark:{[sg.variable]:"colors.whiteAlpha.400"},_focusVisible:{boxShadow:"outline"},_disabled:{opacity:.4,cursor:"not-allowed"},_checked:{[sg.variable]:`colors.${t}.500`,_dark:{[sg.variable]:`colors.${t}.200`}},bg:sg.reference}},z6e={bg:"white",transitionProperty:"transform",transitionDuration:"normal",borderRadius:"inherit",width:[bd.reference],height:[bd.reference],_checked:{transform:`translateX(${gT.reference})`}},j6e=Q1(e=>({container:{[s5.variable]:F6e,[gT.variable]:s5.reference,_rtl:{[gT.variable]:kl(s5).negate().toString()}},track:B6e(e),thumb:z6e})),U6e={sm:Q1({container:{[Yg.variable]:"1.375rem",[bd.variable]:"sizes.3"}}),md:Q1({container:{[Yg.variable]:"1.875rem",[bd.variable]:"sizes.4"}}),lg:Q1({container:{[Yg.variable]:"2.875rem",[bd.variable]:"sizes.6"}})},V6e=L6e({baseStyle:j6e,sizes:U6e,defaultProps:{size:"md",colorScheme:"blue"}}),{defineMultiStyleConfig:G6e,definePartsStyle:xh}=Pt(o6e.keys),q6e=xh({table:{fontVariantNumeric:"lining-nums tabular-nums",borderCollapse:"collapse",width:"full"},th:{fontFamily:"heading",fontWeight:"bold",textTransform:"uppercase",letterSpacing:"wider",textAlign:"start"},td:{textAlign:"start"},caption:{mt:4,fontFamily:"heading",textAlign:"center",fontWeight:"medium"}}),H_={"&[data-is-numeric=true]":{textAlign:"end"}},H6e=xh(e=>{const{colorScheme:t}=e;return{th:{color:K("gray.600","gray.400")(e),borderBottom:"1px",borderColor:K(`${t}.100`,`${t}.700`)(e),...H_},td:{borderBottom:"1px",borderColor:K(`${t}.100`,`${t}.700`)(e),...H_},caption:{color:K("gray.600","gray.100")(e)},tfoot:{tr:{"&:last-of-type":{th:{borderBottomWidth:0}}}}}}),W6e=xh(e=>{const{colorScheme:t}=e;return{th:{color:K("gray.600","gray.400")(e),borderBottom:"1px",borderColor:K(`${t}.100`,`${t}.700`)(e),...H_},td:{borderBottom:"1px",borderColor:K(`${t}.100`,`${t}.700`)(e),...H_},caption:{color:K("gray.600","gray.100")(e)},tbody:{tr:{"&:nth-of-type(odd)":{"th, td":{borderBottomWidth:"1px",borderColor:K(`${t}.100`,`${t}.700`)(e)},td:{background:K(`${t}.100`,`${t}.700`)(e)}}}},tfoot:{tr:{"&:last-of-type":{th:{borderBottomWidth:0}}}}}}),K6e={simple:H6e,striped:W6e,unstyled:{}},Q6e={sm:xh({th:{px:"4",py:"1",lineHeight:"4",fontSize:"xs"},td:{px:"4",py:"2",fontSize:"sm",lineHeight:"4"},caption:{px:"4",py:"2",fontSize:"xs"}}),md:xh({th:{px:"6",py:"3",lineHeight:"4",fontSize:"xs"},td:{px:"6",py:"4",lineHeight:"5"},caption:{px:"6",py:"2",fontSize:"sm"}}),lg:xh({th:{px:"8",py:"4",lineHeight:"5",fontSize:"sm"},td:{px:"8",py:"5",lineHeight:"6"},caption:{px:"6",py:"2",fontSize:"md"}})},X6e=G6e({baseStyle:q6e,variants:K6e,sizes:Q6e,defaultProps:{variant:"simple",size:"md",colorScheme:"gray"}}),_o=nt("tabs-color"),Xa=nt("tabs-bg"),Qv=nt("tabs-border-color"),{defineMultiStyleConfig:Y6e,definePartsStyle:Ws}=Pt(tH.keys),Z6e=e=>{const{orientation:t}=e;return{display:t==="vertical"?"flex":"block"}},J6e=e=>{const{isFitted:t}=e;return{flex:t?1:void 0,transitionProperty:"common",transitionDuration:"normal",_focusVisible:{zIndex:1,boxShadow:"outline"},_disabled:{cursor:"not-allowed",opacity:.4}}},e8e=e=>{const{align:t="start",orientation:n}=e;return{justifyContent:{end:"flex-end",center:"center",start:"flex-start"}[t],flexDirection:n==="vertical"?"column":"row"}},t8e={p:4},n8e=Ws(e=>({root:Z6e(e),tab:J6e(e),tablist:e8e(e),tabpanel:t8e})),r8e={sm:Ws({tab:{py:1,px:4,fontSize:"sm"}}),md:Ws({tab:{fontSize:"md",py:2,px:4}}),lg:Ws({tab:{fontSize:"lg",py:3,px:4}})},i8e=Ws(e=>{const{colorScheme:t,orientation:n}=e,r=n==="vertical",i=r?"borderStart":"borderBottom",o=r?"marginStart":"marginBottom";return{tablist:{[i]:"2px solid",borderColor:"inherit"},tab:{[i]:"2px solid",borderColor:"transparent",[o]:"-2px",_selected:{[_o.variable]:`colors.${t}.600`,_dark:{[_o.variable]:`colors.${t}.300`},borderColor:"currentColor"},_active:{[Xa.variable]:"colors.gray.200",_dark:{[Xa.variable]:"colors.whiteAlpha.300"}},_disabled:{_active:{bg:"none"}},color:_o.reference,bg:Xa.reference}}}),o8e=Ws(e=>{const{colorScheme:t}=e;return{tab:{borderTopRadius:"md",border:"1px solid",borderColor:"transparent",mb:"-1px",[Qv.variable]:"transparent",_selected:{[_o.variable]:`colors.${t}.600`,[Qv.variable]:"colors.white",_dark:{[_o.variable]:`colors.${t}.300`,[Qv.variable]:"colors.gray.800"},borderColor:"inherit",borderBottomColor:Qv.reference},color:_o.reference},tablist:{mb:"-1px",borderBottom:"1px solid",borderColor:"inherit"}}}),a8e=Ws(e=>{const{colorScheme:t}=e;return{tab:{border:"1px solid",borderColor:"inherit",[Xa.variable]:"colors.gray.50",_dark:{[Xa.variable]:"colors.whiteAlpha.50"},mb:"-1px",_notLast:{marginEnd:"-1px"},_selected:{[Xa.variable]:"colors.white",[_o.variable]:`colors.${t}.600`,_dark:{[Xa.variable]:"colors.gray.800",[_o.variable]:`colors.${t}.300`},borderColor:"inherit",borderTopColor:"currentColor",borderBottomColor:"transparent"},color:_o.reference,bg:Xa.reference},tablist:{mb:"-1px",borderBottom:"1px solid",borderColor:"inherit"}}}),s8e=Ws(e=>{const{colorScheme:t,theme:n}=e;return{tab:{borderRadius:"full",fontWeight:"semibold",color:"gray.600",_selected:{color:no(n,`${t}.700`),bg:no(n,`${t}.100`)}}}}),l8e=Ws(e=>{const{colorScheme:t}=e;return{tab:{borderRadius:"full",fontWeight:"semibold",[_o.variable]:"colors.gray.600",_dark:{[_o.variable]:"inherit"},_selected:{[_o.variable]:"colors.white",[Xa.variable]:`colors.${t}.600`,_dark:{[_o.variable]:"colors.gray.800",[Xa.variable]:`colors.${t}.300`}},color:_o.reference,bg:Xa.reference}}}),u8e=Ws({}),c8e={line:i8e,enclosed:o8e,"enclosed-colored":a8e,"soft-rounded":s8e,"solid-rounded":l8e,unstyled:u8e},d8e=Y6e({baseStyle:n8e,sizes:r8e,variants:c8e,defaultProps:{size:"md",variant:"line",colorScheme:"blue"}}),Er=WAe("badge",["bg","color","shadow"]),f8e={px:1,textTransform:"uppercase",fontSize:"xs",borderRadius:"sm",fontWeight:"bold",bg:Er.bg.reference,color:Er.color.reference,boxShadow:Er.shadow.reference},h8e=e=>{const{colorScheme:t,theme:n}=e,r=sp(`${t}.500`,.6)(n);return{[Er.bg.variable]:`colors.${t}.500`,[Er.color.variable]:"colors.white",_dark:{[Er.bg.variable]:r,[Er.color.variable]:"colors.whiteAlpha.800"}}},p8e=e=>{const{colorScheme:t,theme:n}=e,r=sp(`${t}.200`,.16)(n);return{[Er.bg.variable]:`colors.${t}.100`,[Er.color.variable]:`colors.${t}.800`,_dark:{[Er.bg.variable]:r,[Er.color.variable]:`colors.${t}.200`}}},g8e=e=>{const{colorScheme:t,theme:n}=e,r=sp(`${t}.200`,.8)(n);return{[Er.color.variable]:`colors.${t}.500`,_dark:{[Er.color.variable]:r},[Er.shadow.variable]:`inset 0 0 0px 1px ${Er.color.reference}`}},m8e={solid:h8e,subtle:p8e,outline:g8e},Zg={baseStyle:f8e,variants:m8e,defaultProps:{variant:"subtle",colorScheme:"gray"}},{defineMultiStyleConfig:y8e,definePartsStyle:_d}=Pt(a6e.keys),xM=nt("tag-bg"),wM=nt("tag-color"),l5=nt("tag-shadow"),X1=nt("tag-min-height"),Y1=nt("tag-min-width"),Z1=nt("tag-font-size"),J1=nt("tag-padding-inline"),v8e={fontWeight:"medium",lineHeight:1.2,outline:0,[wM.variable]:Er.color.reference,[xM.variable]:Er.bg.reference,[l5.variable]:Er.shadow.reference,color:wM.reference,bg:xM.reference,boxShadow:l5.reference,borderRadius:"md",minH:X1.reference,minW:Y1.reference,fontSize:Z1.reference,px:J1.reference,_focusVisible:{[l5.variable]:"shadows.outline"}},b8e={lineHeight:1.2,overflow:"visible"},_8e={fontSize:"lg",w:"5",h:"5",transitionProperty:"common",transitionDuration:"normal",borderRadius:"full",marginStart:"1.5",marginEnd:"-1",opacity:.5,_disabled:{opacity:.4},_focusVisible:{boxShadow:"outline",bg:"rgba(0, 0, 0, 0.14)"},_hover:{opacity:.8},_active:{opacity:1}},S8e=_d({container:v8e,label:b8e,closeButton:_8e}),x8e={sm:_d({container:{[X1.variable]:"sizes.5",[Y1.variable]:"sizes.5",[Z1.variable]:"fontSizes.xs",[J1.variable]:"space.2"},closeButton:{marginEnd:"-2px",marginStart:"0.35rem"}}),md:_d({container:{[X1.variable]:"sizes.6",[Y1.variable]:"sizes.6",[Z1.variable]:"fontSizes.sm",[J1.variable]:"space.2"}}),lg:_d({container:{[X1.variable]:"sizes.8",[Y1.variable]:"sizes.8",[Z1.variable]:"fontSizes.md",[J1.variable]:"space.3"}})},w8e={subtle:_d(e=>{var t;return{container:(t=Zg.variants)==null?void 0:t.subtle(e)}}),solid:_d(e=>{var t;return{container:(t=Zg.variants)==null?void 0:t.solid(e)}}),outline:_d(e=>{var t;return{container:(t=Zg.variants)==null?void 0:t.outline(e)}})},C8e=y8e({variants:w8e,baseStyle:S8e,sizes:x8e,defaultProps:{size:"md",variant:"subtle",colorScheme:"gray"}}),{definePartsStyle:Rl,defineMultiStyleConfig:E8e}=Pt(Hq.keys),Gf=nt("input-height"),qf=nt("input-font-size"),Hf=nt("input-padding"),Wf=nt("input-border-radius"),T8e=Rl({addon:{height:Gf.reference,fontSize:qf.reference,px:Hf.reference,borderRadius:Wf.reference},field:{width:"100%",height:Gf.reference,fontSize:qf.reference,px:Hf.reference,borderRadius:Wf.reference,minWidth:0,outline:0,position:"relative",appearance:"none",transitionProperty:"common",transitionDuration:"normal",_disabled:{opacity:.4,cursor:"not-allowed"}}}),hu={lg:{[qf.variable]:"fontSizes.lg",[Hf.variable]:"space.4",[Wf.variable]:"radii.md",[Gf.variable]:"sizes.12"},md:{[qf.variable]:"fontSizes.md",[Hf.variable]:"space.4",[Wf.variable]:"radii.md",[Gf.variable]:"sizes.10"},sm:{[qf.variable]:"fontSizes.sm",[Hf.variable]:"space.3",[Wf.variable]:"radii.sm",[Gf.variable]:"sizes.8"},xs:{[qf.variable]:"fontSizes.xs",[Hf.variable]:"space.2",[Wf.variable]:"radii.sm",[Gf.variable]:"sizes.6"}},k8e={lg:Rl({field:hu.lg,group:hu.lg}),md:Rl({field:hu.md,group:hu.md}),sm:Rl({field:hu.sm,group:hu.sm}),xs:Rl({field:hu.xs,group:hu.xs})};function YA(e){const{focusBorderColor:t,errorBorderColor:n}=e;return{focusBorderColor:t||K("blue.500","blue.300")(e),errorBorderColor:n||K("red.500","red.300")(e)}}var A8e=Rl(e=>{const{theme:t}=e,{focusBorderColor:n,errorBorderColor:r}=YA(e);return{field:{border:"1px solid",borderColor:"inherit",bg:"inherit",_hover:{borderColor:K("gray.300","whiteAlpha.400")(e)},_readOnly:{boxShadow:"none !important",userSelect:"all"},_invalid:{borderColor:no(t,r),boxShadow:`0 0 0 1px ${no(t,r)}`},_focusVisible:{zIndex:1,borderColor:no(t,n),boxShadow:`0 0 0 1px ${no(t,n)}`}},addon:{border:"1px solid",borderColor:K("inherit","whiteAlpha.50")(e),bg:K("gray.100","whiteAlpha.300")(e)}}}),P8e=Rl(e=>{const{theme:t}=e,{focusBorderColor:n,errorBorderColor:r}=YA(e);return{field:{border:"2px solid",borderColor:"transparent",bg:K("gray.100","whiteAlpha.50")(e),_hover:{bg:K("gray.200","whiteAlpha.100")(e)},_readOnly:{boxShadow:"none !important",userSelect:"all"},_invalid:{borderColor:no(t,r)},_focusVisible:{bg:"transparent",borderColor:no(t,n)}},addon:{border:"2px solid",borderColor:"transparent",bg:K("gray.100","whiteAlpha.50")(e)}}}),I8e=Rl(e=>{const{theme:t}=e,{focusBorderColor:n,errorBorderColor:r}=YA(e);return{field:{borderBottom:"1px solid",borderColor:"inherit",borderRadius:"0",px:"0",bg:"transparent",_readOnly:{boxShadow:"none !important",userSelect:"all"},_invalid:{borderColor:no(t,r),boxShadow:`0px 1px 0px 0px ${no(t,r)}`},_focusVisible:{borderColor:no(t,n),boxShadow:`0px 1px 0px 0px ${no(t,n)}`}},addon:{borderBottom:"2px solid",borderColor:"inherit",borderRadius:"0",px:"0",bg:"transparent"}}}),R8e=Rl({field:{bg:"transparent",px:"0",height:"auto"},addon:{bg:"transparent",px:"0",height:"auto"}}),O8e={outline:A8e,filled:P8e,flushed:I8e,unstyled:R8e},un=E8e({baseStyle:T8e,sizes:k8e,variants:O8e,defaultProps:{size:"md",variant:"outline"}}),CM,M8e={...(CM=un.baseStyle)==null?void 0:CM.field,paddingY:"2",minHeight:"20",lineHeight:"short",verticalAlign:"top"},EM,TM,N8e={outline:e=>{var t,n;return(n=(t=un.variants)==null?void 0:t.outline(e).field)!=null?n:{}},flushed:e=>{var t,n;return(n=(t=un.variants)==null?void 0:t.flushed(e).field)!=null?n:{}},filled:e=>{var t,n;return(n=(t=un.variants)==null?void 0:t.filled(e).field)!=null?n:{}},unstyled:(TM=(EM=un.variants)==null?void 0:EM.unstyled.field)!=null?TM:{}},kM,AM,PM,IM,RM,OM,MM,NM,$8e={xs:(AM=(kM=un.sizes)==null?void 0:kM.xs.field)!=null?AM:{},sm:(IM=(PM=un.sizes)==null?void 0:PM.sm.field)!=null?IM:{},md:(OM=(RM=un.sizes)==null?void 0:RM.md.field)!=null?OM:{},lg:(NM=(MM=un.sizes)==null?void 0:MM.lg.field)!=null?NM:{}},D8e={baseStyle:M8e,sizes:$8e,variants:N8e,defaultProps:{size:"md",variant:"outline"}},Xv=fr("tooltip-bg"),u5=fr("tooltip-fg"),L8e=fr("popper-arrow-bg"),F8e={bg:Xv.reference,color:u5.reference,[Xv.variable]:"colors.gray.700",[u5.variable]:"colors.whiteAlpha.900",_dark:{[Xv.variable]:"colors.gray.300",[u5.variable]:"colors.gray.900"},[L8e.variable]:Xv.reference,px:"2",py:"0.5",borderRadius:"sm",fontWeight:"medium",fontSize:"sm",boxShadow:"md",maxW:"xs",zIndex:"tooltip"},B8e={baseStyle:F8e},{defineMultiStyleConfig:z8e,definePartsStyle:Ig}=Pt(Yq.keys),j8e=e=>{const{colorScheme:t,theme:n,isIndeterminate:r,hasStripe:i}=e,o=K(yM(),yM("1rem","rgba(0,0,0,0.1)"))(e),a=K(`${t}.500`,`${t}.200`)(e),s=`linear-gradient( + to right, + transparent 0%, + ${no(n,a)} 50%, + transparent 100% + )`;return{...!r&&i&&o,...r?{bgImage:s}:{bgColor:a}}},U8e={lineHeight:"1",fontSize:"0.25em",fontWeight:"bold",color:"white"},V8e=e=>({bg:K("gray.100","whiteAlpha.300")(e)}),G8e=e=>({transitionProperty:"common",transitionDuration:"slow",...j8e(e)}),q8e=Ig(e=>({label:U8e,filledTrack:G8e(e),track:V8e(e)})),H8e={xs:Ig({track:{h:"1"}}),sm:Ig({track:{h:"2"}}),md:Ig({track:{h:"3"}}),lg:Ig({track:{h:"4"}})},W8e=z8e({sizes:H8e,baseStyle:q8e,defaultProps:{size:"md",colorScheme:"blue"}}),K8e=e=>typeof e=="function";function io(e,...t){return K8e(e)?e(...t):e}var{definePartsStyle:eb,defineMultiStyleConfig:Q8e}=Pt(Gq.keys),Jg=nt("checkbox-size"),X8e=e=>{const{colorScheme:t}=e;return{w:Jg.reference,h:Jg.reference,transitionProperty:"box-shadow",transitionDuration:"normal",border:"2px solid",borderRadius:"sm",borderColor:"inherit",color:"white",_checked:{bg:K(`${t}.500`,`${t}.200`)(e),borderColor:K(`${t}.500`,`${t}.200`)(e),color:K("white","gray.900")(e),_hover:{bg:K(`${t}.600`,`${t}.300`)(e),borderColor:K(`${t}.600`,`${t}.300`)(e)},_disabled:{borderColor:K("gray.200","transparent")(e),bg:K("gray.200","whiteAlpha.300")(e),color:K("gray.500","whiteAlpha.500")(e)}},_indeterminate:{bg:K(`${t}.500`,`${t}.200`)(e),borderColor:K(`${t}.500`,`${t}.200`)(e),color:K("white","gray.900")(e)},_disabled:{bg:K("gray.100","whiteAlpha.100")(e),borderColor:K("gray.100","transparent")(e)},_focusVisible:{boxShadow:"outline"},_invalid:{borderColor:K("red.500","red.300")(e)}}},Y8e={_disabled:{cursor:"not-allowed"}},Z8e={userSelect:"none",_disabled:{opacity:.4}},J8e={transitionProperty:"transform",transitionDuration:"normal"},eIe=eb(e=>({icon:J8e,container:Y8e,control:io(X8e,e),label:Z8e})),tIe={sm:eb({control:{[Jg.variable]:"sizes.3"},label:{fontSize:"sm"},icon:{fontSize:"3xs"}}),md:eb({control:{[Jg.variable]:"sizes.4"},label:{fontSize:"md"},icon:{fontSize:"2xs"}}),lg:eb({control:{[Jg.variable]:"sizes.5"},label:{fontSize:"lg"},icon:{fontSize:"2xs"}})},W_=Q8e({baseStyle:eIe,sizes:tIe,defaultProps:{size:"md",colorScheme:"blue"}}),{defineMultiStyleConfig:nIe,definePartsStyle:tb}=Pt(r6e.keys),rIe=e=>{var t;const n=(t=io(W_.baseStyle,e))==null?void 0:t.control;return{...n,borderRadius:"full",_checked:{...n==null?void 0:n._checked,_before:{content:'""',display:"inline-block",pos:"relative",w:"50%",h:"50%",borderRadius:"50%",bg:"currentColor"}}}},iIe=tb(e=>{var t,n,r,i;return{label:(n=(t=W_).baseStyle)==null?void 0:n.call(t,e).label,container:(i=(r=W_).baseStyle)==null?void 0:i.call(r,e).container,control:rIe(e)}}),oIe={md:tb({control:{w:"4",h:"4"},label:{fontSize:"md"}}),lg:tb({control:{w:"5",h:"5"},label:{fontSize:"lg"}}),sm:tb({control:{width:"3",height:"3"},label:{fontSize:"sm"}})},aIe=nIe({baseStyle:iIe,sizes:oIe,defaultProps:{size:"md",colorScheme:"blue"}}),{defineMultiStyleConfig:sIe,definePartsStyle:lIe}=Pt(Zq.keys),Yv=nt("select-bg"),$M,uIe={...($M=un.baseStyle)==null?void 0:$M.field,appearance:"none",paddingBottom:"1px",lineHeight:"normal",bg:Yv.reference,[Yv.variable]:"colors.white",_dark:{[Yv.variable]:"colors.gray.700"},"> option, > optgroup":{bg:Yv.reference}},cIe={width:"6",height:"100%",insetEnd:"2",position:"relative",color:"currentColor",fontSize:"xl",_disabled:{opacity:.5}},dIe=lIe({field:uIe,icon:cIe}),Zv={paddingInlineEnd:"8"},DM,LM,FM,BM,zM,jM,UM,VM,fIe={lg:{...(DM=un.sizes)==null?void 0:DM.lg,field:{...(LM=un.sizes)==null?void 0:LM.lg.field,...Zv}},md:{...(FM=un.sizes)==null?void 0:FM.md,field:{...(BM=un.sizes)==null?void 0:BM.md.field,...Zv}},sm:{...(zM=un.sizes)==null?void 0:zM.sm,field:{...(jM=un.sizes)==null?void 0:jM.sm.field,...Zv}},xs:{...(UM=un.sizes)==null?void 0:UM.xs,field:{...(VM=un.sizes)==null?void 0:VM.xs.field,...Zv},icon:{insetEnd:"1"}}},hIe=sIe({baseStyle:dIe,sizes:fIe,variants:un.variants,defaultProps:un.defaultProps}),c5=nt("skeleton-start-color"),d5=nt("skeleton-end-color"),pIe={[c5.variable]:"colors.gray.100",[d5.variable]:"colors.gray.400",_dark:{[c5.variable]:"colors.gray.800",[d5.variable]:"colors.gray.600"},background:c5.reference,borderColor:d5.reference,opacity:.7,borderRadius:"sm"},gIe={baseStyle:pIe},f5=nt("skip-link-bg"),mIe={borderRadius:"md",fontWeight:"semibold",_focusVisible:{boxShadow:"outline",padding:"4",position:"fixed",top:"6",insetStart:"6",[f5.variable]:"colors.white",_dark:{[f5.variable]:"colors.gray.700"},bg:f5.reference}},yIe={baseStyle:mIe},{defineMultiStyleConfig:vIe,definePartsStyle:aw}=Pt(Jq.keys),k0=nt("slider-thumb-size"),A0=nt("slider-track-size"),Au=nt("slider-bg"),bIe=e=>{const{orientation:t}=e;return{display:"inline-block",position:"relative",cursor:"pointer",_disabled:{opacity:.6,cursor:"default",pointerEvents:"none"},...XA({orientation:t,vertical:{h:"100%"},horizontal:{w:"100%"}})}},_Ie=e=>({...XA({orientation:e.orientation,horizontal:{h:A0.reference},vertical:{w:A0.reference}}),overflow:"hidden",borderRadius:"sm",[Au.variable]:"colors.gray.200",_dark:{[Au.variable]:"colors.whiteAlpha.200"},_disabled:{[Au.variable]:"colors.gray.300",_dark:{[Au.variable]:"colors.whiteAlpha.300"}},bg:Au.reference}),SIe=e=>{const{orientation:t}=e;return{...XA({orientation:t,vertical:{left:"50%",transform:"translateX(-50%)",_active:{transform:"translateX(-50%) scale(1.15)"}},horizontal:{top:"50%",transform:"translateY(-50%)",_active:{transform:"translateY(-50%) scale(1.15)"}}}),w:k0.reference,h:k0.reference,display:"flex",alignItems:"center",justifyContent:"center",position:"absolute",outline:0,zIndex:1,borderRadius:"full",bg:"white",boxShadow:"base",border:"1px solid",borderColor:"transparent",transitionProperty:"transform",transitionDuration:"normal",_focusVisible:{boxShadow:"outline"},_disabled:{bg:"gray.300"}}},xIe=e=>{const{colorScheme:t}=e;return{width:"inherit",height:"inherit",[Au.variable]:`colors.${t}.500`,_dark:{[Au.variable]:`colors.${t}.200`},bg:Au.reference}},wIe=aw(e=>({container:bIe(e),track:_Ie(e),thumb:SIe(e),filledTrack:xIe(e)})),CIe=aw({container:{[k0.variable]:"sizes.4",[A0.variable]:"sizes.1"}}),EIe=aw({container:{[k0.variable]:"sizes.3.5",[A0.variable]:"sizes.1"}}),TIe=aw({container:{[k0.variable]:"sizes.2.5",[A0.variable]:"sizes.0.5"}}),kIe={lg:CIe,md:EIe,sm:TIe},AIe=vIe({baseStyle:wIe,sizes:kIe,defaultProps:{size:"md",colorScheme:"blue"}}),Yc=fr("spinner-size"),PIe={width:[Yc.reference],height:[Yc.reference]},IIe={xs:{[Yc.variable]:"sizes.3"},sm:{[Yc.variable]:"sizes.4"},md:{[Yc.variable]:"sizes.6"},lg:{[Yc.variable]:"sizes.8"},xl:{[Yc.variable]:"sizes.12"}},RIe={baseStyle:PIe,sizes:IIe,defaultProps:{size:"md"}},{defineMultiStyleConfig:OIe,definePartsStyle:iH}=Pt(i6e.keys),MIe={fontWeight:"medium"},NIe={opacity:.8,marginBottom:"2"},$Ie={verticalAlign:"baseline",fontWeight:"semibold"},DIe={marginEnd:1,w:"3.5",h:"3.5",verticalAlign:"middle"},LIe=iH({container:{},label:MIe,helpText:NIe,number:$Ie,icon:DIe}),FIe={md:iH({label:{fontSize:"sm"},helpText:{fontSize:"sm"},number:{fontSize:"2xl"}})},BIe=OIe({baseStyle:LIe,sizes:FIe,defaultProps:{size:"md"}}),h5=nt("kbd-bg"),zIe={[h5.variable]:"colors.gray.100",_dark:{[h5.variable]:"colors.whiteAlpha.100"},bg:h5.reference,borderRadius:"md",borderWidth:"1px",borderBottomWidth:"3px",fontSize:"0.8em",fontWeight:"bold",lineHeight:"normal",px:"0.4em",whiteSpace:"nowrap"},jIe={baseStyle:zIe},UIe={transitionProperty:"common",transitionDuration:"fast",transitionTimingFunction:"ease-out",cursor:"pointer",textDecoration:"none",outline:"none",color:"inherit",_hover:{textDecoration:"underline"},_focusVisible:{boxShadow:"outline"}},VIe={baseStyle:UIe},{defineMultiStyleConfig:GIe,definePartsStyle:qIe}=Pt(n6e.keys),HIe={marginEnd:"2",display:"inline",verticalAlign:"text-bottom"},WIe=qIe({icon:HIe}),KIe=GIe({baseStyle:WIe}),{defineMultiStyleConfig:QIe,definePartsStyle:XIe}=Pt(Wq.keys),Cs=nt("menu-bg"),p5=nt("menu-shadow"),YIe={[Cs.variable]:"#fff",[p5.variable]:"shadows.sm",_dark:{[Cs.variable]:"colors.gray.700",[p5.variable]:"shadows.dark-lg"},color:"inherit",minW:"3xs",py:"2",zIndex:1,borderRadius:"md",borderWidth:"1px",bg:Cs.reference,boxShadow:p5.reference},ZIe={py:"1.5",px:"3",transitionProperty:"background",transitionDuration:"ultra-fast",transitionTimingFunction:"ease-in",_focus:{[Cs.variable]:"colors.gray.100",_dark:{[Cs.variable]:"colors.whiteAlpha.100"}},_active:{[Cs.variable]:"colors.gray.200",_dark:{[Cs.variable]:"colors.whiteAlpha.200"}},_expanded:{[Cs.variable]:"colors.gray.100",_dark:{[Cs.variable]:"colors.whiteAlpha.100"}},_disabled:{opacity:.4,cursor:"not-allowed"},bg:Cs.reference},JIe={mx:4,my:2,fontWeight:"semibold",fontSize:"sm"},eRe={display:"inline-flex",alignItems:"center",justifyContent:"center",flexShrink:0},tRe={opacity:.6},nRe={border:0,borderBottom:"1px solid",borderColor:"inherit",my:"2",opacity:.6},rRe={transitionProperty:"common",transitionDuration:"normal"},iRe=XIe({button:rRe,list:YIe,item:ZIe,groupTitle:JIe,icon:eRe,command:tRe,divider:nRe}),oRe=QIe({baseStyle:iRe}),{defineMultiStyleConfig:aRe,definePartsStyle:mT}=Pt(Kq.keys),g5=nt("modal-bg"),m5=nt("modal-shadow"),sRe={bg:"blackAlpha.600",zIndex:"modal"},lRe=e=>{const{isCentered:t,scrollBehavior:n}=e;return{display:"flex",zIndex:"modal",justifyContent:"center",alignItems:t?"center":"flex-start",overflow:n==="inside"?"hidden":"auto",overscrollBehaviorY:"none"}},uRe=e=>{const{isCentered:t,scrollBehavior:n}=e;return{borderRadius:"md",color:"inherit",my:t?"auto":"16",mx:t?"auto":void 0,zIndex:"modal",maxH:n==="inside"?"calc(100% - 7.5rem)":void 0,[g5.variable]:"colors.white",[m5.variable]:"shadows.lg",_dark:{[g5.variable]:"colors.gray.700",[m5.variable]:"shadows.dark-lg"},bg:g5.reference,boxShadow:m5.reference}},cRe={px:"6",py:"4",fontSize:"xl",fontWeight:"semibold"},dRe={position:"absolute",top:"2",insetEnd:"3"},fRe=e=>{const{scrollBehavior:t}=e;return{px:"6",py:"2",flex:"1",overflow:t==="inside"?"auto":void 0}},hRe={px:"6",py:"4"},pRe=mT(e=>({overlay:sRe,dialogContainer:io(lRe,e),dialog:io(uRe,e),header:cRe,closeButton:dRe,body:io(fRe,e),footer:hRe}));function Ba(e){return mT(e==="full"?{dialog:{maxW:"100vw",minH:"$100vh",my:"0",borderRadius:"0"}}:{dialog:{maxW:e}})}var gRe={xs:Ba("xs"),sm:Ba("sm"),md:Ba("md"),lg:Ba("lg"),xl:Ba("xl"),"2xl":Ba("2xl"),"3xl":Ba("3xl"),"4xl":Ba("4xl"),"5xl":Ba("5xl"),"6xl":Ba("6xl"),full:Ba("full")},mRe=aRe({baseStyle:pRe,sizes:gRe,defaultProps:{size:"md"}}),{defineMultiStyleConfig:yRe,definePartsStyle:oH}=Pt(Qq.keys),ZA=fr("number-input-stepper-width"),aH=fr("number-input-input-padding"),vRe=kl(ZA).add("0.5rem").toString(),y5=fr("number-input-bg"),v5=fr("number-input-color"),b5=fr("number-input-border-color"),bRe={[ZA.variable]:"sizes.6",[aH.variable]:vRe},_Re=e=>{var t,n;return(n=(t=io(un.baseStyle,e))==null?void 0:t.field)!=null?n:{}},SRe={width:ZA.reference},xRe={borderStart:"1px solid",borderStartColor:b5.reference,color:v5.reference,bg:y5.reference,[v5.variable]:"colors.chakra-body-text",[b5.variable]:"colors.chakra-border-color",_dark:{[v5.variable]:"colors.whiteAlpha.800",[b5.variable]:"colors.whiteAlpha.300"},_active:{[y5.variable]:"colors.gray.200",_dark:{[y5.variable]:"colors.whiteAlpha.300"}},_disabled:{opacity:.4,cursor:"not-allowed"}},wRe=oH(e=>{var t;return{root:bRe,field:(t=io(_Re,e))!=null?t:{},stepperGroup:SRe,stepper:xRe}});function Jv(e){var t,n,r;const i=(t=un.sizes)==null?void 0:t[e],o={lg:"md",md:"md",sm:"sm",xs:"sm"},a=(r=(n=i.field)==null?void 0:n.fontSize)!=null?r:"md",s=zq.fontSizes[a];return oH({field:{...i.field,paddingInlineEnd:aH.reference,verticalAlign:"top"},stepper:{fontSize:kl(s).multiply(.75).toString(),_first:{borderTopEndRadius:o[e]},_last:{borderBottomEndRadius:o[e],mt:"-1px",borderTopWidth:1}}})}var CRe={xs:Jv("xs"),sm:Jv("sm"),md:Jv("md"),lg:Jv("lg")},ERe=yRe({baseStyle:wRe,sizes:CRe,variants:un.variants,defaultProps:un.defaultProps}),GM,TRe={...(GM=un.baseStyle)==null?void 0:GM.field,textAlign:"center"},kRe={lg:{fontSize:"lg",w:12,h:12,borderRadius:"md"},md:{fontSize:"md",w:10,h:10,borderRadius:"md"},sm:{fontSize:"sm",w:8,h:8,borderRadius:"sm"},xs:{fontSize:"xs",w:6,h:6,borderRadius:"sm"}},qM,HM,ARe={outline:e=>{var t,n,r;return(r=(n=io((t=un.variants)==null?void 0:t.outline,e))==null?void 0:n.field)!=null?r:{}},flushed:e=>{var t,n,r;return(r=(n=io((t=un.variants)==null?void 0:t.flushed,e))==null?void 0:n.field)!=null?r:{}},filled:e=>{var t,n,r;return(r=(n=io((t=un.variants)==null?void 0:t.filled,e))==null?void 0:n.field)!=null?r:{}},unstyled:(HM=(qM=un.variants)==null?void 0:qM.unstyled.field)!=null?HM:{}},PRe={baseStyle:TRe,sizes:kRe,variants:ARe,defaultProps:un.defaultProps},{defineMultiStyleConfig:IRe,definePartsStyle:RRe}=Pt(Xq.keys),e1=fr("popper-bg"),ORe=fr("popper-arrow-bg"),WM=fr("popper-arrow-shadow-color"),MRe={zIndex:10},NRe={[e1.variable]:"colors.white",bg:e1.reference,[ORe.variable]:e1.reference,[WM.variable]:"colors.gray.200",_dark:{[e1.variable]:"colors.gray.700",[WM.variable]:"colors.whiteAlpha.300"},width:"xs",border:"1px solid",borderColor:"inherit",borderRadius:"md",boxShadow:"sm",zIndex:"inherit",_focusVisible:{outline:0,boxShadow:"outline"}},$Re={px:3,py:2,borderBottomWidth:"1px"},DRe={px:3,py:2},LRe={px:3,py:2,borderTopWidth:"1px"},FRe={position:"absolute",borderRadius:"md",top:1,insetEnd:2,padding:2},BRe=RRe({popper:MRe,content:NRe,header:$Re,body:DRe,footer:LRe,closeButton:FRe}),zRe=IRe({baseStyle:BRe}),{definePartsStyle:yT,defineMultiStyleConfig:jRe}=Pt(JPe.keys),_5=nt("drawer-bg"),S5=nt("drawer-box-shadow");function _f(e){return yT(e==="full"?{dialog:{maxW:"100vw",h:"100vh"}}:{dialog:{maxW:e}})}var URe={bg:"blackAlpha.600",zIndex:"overlay"},VRe={display:"flex",zIndex:"modal",justifyContent:"center"},GRe=e=>{const{isFullHeight:t}=e;return{...t&&{height:"100vh"},zIndex:"modal",maxH:"100vh",color:"inherit",[_5.variable]:"colors.white",[S5.variable]:"shadows.lg",_dark:{[_5.variable]:"colors.gray.700",[S5.variable]:"shadows.dark-lg"},bg:_5.reference,boxShadow:S5.reference}},qRe={px:"6",py:"4",fontSize:"xl",fontWeight:"semibold"},HRe={position:"absolute",top:"2",insetEnd:"3"},WRe={px:"6",py:"2",flex:"1",overflow:"auto"},KRe={px:"6",py:"4"},QRe=yT(e=>({overlay:URe,dialogContainer:VRe,dialog:io(GRe,e),header:qRe,closeButton:HRe,body:WRe,footer:KRe})),XRe={xs:_f("xs"),sm:_f("md"),md:_f("lg"),lg:_f("2xl"),xl:_f("4xl"),full:_f("full")},YRe=jRe({baseStyle:QRe,sizes:XRe,defaultProps:{size:"xs"}}),{definePartsStyle:ZRe,defineMultiStyleConfig:JRe}=Pt(qq.keys),e9e={borderRadius:"md",py:"1",transitionProperty:"common",transitionDuration:"normal"},t9e={borderRadius:"md",py:"1",transitionProperty:"common",transitionDuration:"normal",width:"full",_focusVisible:{boxShadow:"outline"},_placeholder:{opacity:.6}},n9e={borderRadius:"md",py:"1",transitionProperty:"common",transitionDuration:"normal",width:"full",_focusVisible:{boxShadow:"outline"},_placeholder:{opacity:.6}},r9e=ZRe({preview:e9e,input:t9e,textarea:n9e}),i9e=JRe({baseStyle:r9e}),{definePartsStyle:o9e,defineMultiStyleConfig:a9e}=Pt(e6e.keys),wh=nt("form-control-color"),s9e={marginStart:"1",[wh.variable]:"colors.red.500",_dark:{[wh.variable]:"colors.red.300"},color:wh.reference},l9e={mt:"2",[wh.variable]:"colors.gray.600",_dark:{[wh.variable]:"colors.whiteAlpha.600"},color:wh.reference,lineHeight:"normal",fontSize:"sm"},u9e=o9e({container:{width:"100%",position:"relative"},requiredIndicator:s9e,helperText:l9e}),c9e=a9e({baseStyle:u9e}),{definePartsStyle:d9e,defineMultiStyleConfig:f9e}=Pt(t6e.keys),Ch=nt("form-error-color"),h9e={[Ch.variable]:"colors.red.500",_dark:{[Ch.variable]:"colors.red.300"},color:Ch.reference,mt:"2",fontSize:"sm",lineHeight:"normal"},p9e={marginEnd:"0.5em",[Ch.variable]:"colors.red.500",_dark:{[Ch.variable]:"colors.red.300"},color:Ch.reference},g9e=d9e({text:h9e,icon:p9e}),m9e=f9e({baseStyle:g9e}),y9e={fontSize:"md",marginEnd:"3",mb:"2",fontWeight:"medium",transitionProperty:"common",transitionDuration:"normal",opacity:1,_disabled:{opacity:.4}},v9e={baseStyle:y9e},b9e={fontFamily:"heading",fontWeight:"bold"},_9e={"4xl":{fontSize:["6xl",null,"7xl"],lineHeight:1},"3xl":{fontSize:["5xl",null,"6xl"],lineHeight:1},"2xl":{fontSize:["4xl",null,"5xl"],lineHeight:[1.2,null,1]},xl:{fontSize:["3xl",null,"4xl"],lineHeight:[1.33,null,1.2]},lg:{fontSize:["2xl",null,"3xl"],lineHeight:[1.33,null,1.2]},md:{fontSize:"xl",lineHeight:1.2},sm:{fontSize:"md",lineHeight:1.2},xs:{fontSize:"sm",lineHeight:1.2}},S9e={baseStyle:b9e,sizes:_9e,defaultProps:{size:"xl"}},{defineMultiStyleConfig:x9e,definePartsStyle:w9e}=Pt(ZPe.keys),x5=nt("breadcrumb-link-decor"),C9e={transitionProperty:"common",transitionDuration:"fast",transitionTimingFunction:"ease-out",outline:"none",color:"inherit",textDecoration:x5.reference,[x5.variable]:"none","&:not([aria-current=page])":{cursor:"pointer",_hover:{[x5.variable]:"underline"},_focusVisible:{boxShadow:"outline"}}},E9e=w9e({link:C9e}),T9e=x9e({baseStyle:E9e}),k9e={lineHeight:"1.2",borderRadius:"md",fontWeight:"semibold",transitionProperty:"common",transitionDuration:"normal",_focusVisible:{boxShadow:"outline"},_disabled:{opacity:.4,cursor:"not-allowed",boxShadow:"none"},_hover:{_disabled:{bg:"initial"}}},sH=e=>{const{colorScheme:t,theme:n}=e;if(t==="gray")return{color:K("gray.800","whiteAlpha.900")(e),_hover:{bg:K("gray.100","whiteAlpha.200")(e)},_active:{bg:K("gray.200","whiteAlpha.300")(e)}};const r=sp(`${t}.200`,.12)(n),i=sp(`${t}.200`,.24)(n);return{color:K(`${t}.600`,`${t}.200`)(e),bg:"transparent",_hover:{bg:K(`${t}.50`,r)(e)},_active:{bg:K(`${t}.100`,i)(e)}}},A9e=e=>{const{colorScheme:t}=e,n=K("gray.200","whiteAlpha.300")(e);return{border:"1px solid",borderColor:t==="gray"?n:"currentColor",".chakra-button__group[data-attached][data-orientation=horizontal] > &:not(:last-of-type)":{marginEnd:"-1px"},".chakra-button__group[data-attached][data-orientation=vertical] > &:not(:last-of-type)":{marginBottom:"-1px"},...io(sH,e)}},P9e={yellow:{bg:"yellow.400",color:"black",hoverBg:"yellow.500",activeBg:"yellow.600"},cyan:{bg:"cyan.400",color:"black",hoverBg:"cyan.500",activeBg:"cyan.600"}},I9e=e=>{var t;const{colorScheme:n}=e;if(n==="gray"){const l=K("gray.100","whiteAlpha.200")(e);return{bg:l,color:K("gray.800","whiteAlpha.900")(e),_hover:{bg:K("gray.200","whiteAlpha.300")(e),_disabled:{bg:l}},_active:{bg:K("gray.300","whiteAlpha.400")(e)}}}const{bg:r=`${n}.500`,color:i="white",hoverBg:o=`${n}.600`,activeBg:a=`${n}.700`}=(t=P9e[n])!=null?t:{},s=K(r,`${n}.200`)(e);return{bg:s,color:K(i,"gray.800")(e),_hover:{bg:K(o,`${n}.300`)(e),_disabled:{bg:s}},_active:{bg:K(a,`${n}.400`)(e)}}},R9e=e=>{const{colorScheme:t}=e;return{padding:0,height:"auto",lineHeight:"normal",verticalAlign:"baseline",color:K(`${t}.500`,`${t}.200`)(e),_hover:{textDecoration:"underline",_disabled:{textDecoration:"none"}},_active:{color:K(`${t}.700`,`${t}.500`)(e)}}},O9e={bg:"none",color:"inherit",display:"inline",lineHeight:"inherit",m:"0",p:"0"},M9e={ghost:sH,outline:A9e,solid:I9e,link:R9e,unstyled:O9e},N9e={lg:{h:"12",minW:"12",fontSize:"lg",px:"6"},md:{h:"10",minW:"10",fontSize:"md",px:"4"},sm:{h:"8",minW:"8",fontSize:"sm",px:"3"},xs:{h:"6",minW:"6",fontSize:"xs",px:"2"}},$9e={baseStyle:k9e,variants:M9e,sizes:N9e,defaultProps:{variant:"solid",size:"md",colorScheme:"gray"}},{definePartsStyle:Sd,defineMultiStyleConfig:D9e}=Pt(s6e.keys),K_=nt("card-bg"),Dl=nt("card-padding"),lH=nt("card-shadow"),nb=nt("card-radius"),uH=nt("card-border-width","0"),cH=nt("card-border-color"),L9e=Sd({container:{[K_.variable]:"colors.chakra-body-bg",backgroundColor:K_.reference,boxShadow:lH.reference,borderRadius:nb.reference,color:"chakra-body-text",borderWidth:uH.reference,borderColor:cH.reference},body:{padding:Dl.reference,flex:"1 1 0%"},header:{padding:Dl.reference},footer:{padding:Dl.reference}}),F9e={sm:Sd({container:{[nb.variable]:"radii.base",[Dl.variable]:"space.3"}}),md:Sd({container:{[nb.variable]:"radii.md",[Dl.variable]:"space.5"}}),lg:Sd({container:{[nb.variable]:"radii.xl",[Dl.variable]:"space.7"}})},B9e={elevated:Sd({container:{[lH.variable]:"shadows.base",_dark:{[K_.variable]:"colors.gray.700"}}}),outline:Sd({container:{[uH.variable]:"1px",[cH.variable]:"colors.chakra-border-color"}}),filled:Sd({container:{[K_.variable]:"colors.chakra-subtle-bg"}}),unstyled:{body:{[Dl.variable]:0},header:{[Dl.variable]:0},footer:{[Dl.variable]:0}}},z9e=D9e({baseStyle:L9e,variants:B9e,sizes:F9e,defaultProps:{variant:"elevated",size:"md"}}),em=fr("close-button-size"),lg=fr("close-button-bg"),j9e={w:[em.reference],h:[em.reference],borderRadius:"md",transitionProperty:"common",transitionDuration:"normal",_disabled:{opacity:.4,cursor:"not-allowed",boxShadow:"none"},_hover:{[lg.variable]:"colors.blackAlpha.100",_dark:{[lg.variable]:"colors.whiteAlpha.100"}},_active:{[lg.variable]:"colors.blackAlpha.200",_dark:{[lg.variable]:"colors.whiteAlpha.200"}},_focusVisible:{boxShadow:"outline"},bg:lg.reference},U9e={lg:{[em.variable]:"sizes.10",fontSize:"md"},md:{[em.variable]:"sizes.8",fontSize:"xs"},sm:{[em.variable]:"sizes.6",fontSize:"2xs"}},V9e={baseStyle:j9e,sizes:U9e,defaultProps:{size:"md"}},{variants:G9e,defaultProps:q9e}=Zg,H9e={fontFamily:"mono",fontSize:"sm",px:"0.2em",borderRadius:"sm",bg:Er.bg.reference,color:Er.color.reference,boxShadow:Er.shadow.reference},W9e={baseStyle:H9e,variants:G9e,defaultProps:q9e},K9e={w:"100%",mx:"auto",maxW:"prose",px:"4"},Q9e={baseStyle:K9e},X9e={opacity:.6,borderColor:"inherit"},Y9e={borderStyle:"solid"},Z9e={borderStyle:"dashed"},J9e={solid:Y9e,dashed:Z9e},eOe={baseStyle:X9e,variants:J9e,defaultProps:{variant:"solid"}},{definePartsStyle:tOe,defineMultiStyleConfig:nOe}=Pt(Vq.keys),rOe={borderTopWidth:"1px",borderColor:"inherit",_last:{borderBottomWidth:"1px"}},iOe={transitionProperty:"common",transitionDuration:"normal",fontSize:"md",_focusVisible:{boxShadow:"outline"},_hover:{bg:"blackAlpha.50"},_disabled:{opacity:.4,cursor:"not-allowed"},px:"4",py:"2"},oOe={pt:"2",px:"4",pb:"5"},aOe={fontSize:"1.25em"},sOe=tOe({container:rOe,button:iOe,panel:oOe,icon:aOe}),lOe=nOe({baseStyle:sOe}),{definePartsStyle:Ry,defineMultiStyleConfig:uOe}=Pt(XPe.keys),Qo=nt("alert-fg"),Kl=nt("alert-bg"),cOe=Ry({container:{bg:Kl.reference,px:"4",py:"3"},title:{fontWeight:"bold",lineHeight:"6",marginEnd:"2"},description:{lineHeight:"6"},icon:{color:Qo.reference,flexShrink:0,marginEnd:"3",w:"5",h:"6"},spinner:{color:Qo.reference,flexShrink:0,marginEnd:"3",w:"5",h:"5"}});function JA(e){const{theme:t,colorScheme:n}=e,r=sp(`${n}.200`,.16)(t);return{light:`colors.${n}.100`,dark:r}}var dOe=Ry(e=>{const{colorScheme:t}=e,n=JA(e);return{container:{[Qo.variable]:`colors.${t}.500`,[Kl.variable]:n.light,_dark:{[Qo.variable]:`colors.${t}.200`,[Kl.variable]:n.dark}}}}),fOe=Ry(e=>{const{colorScheme:t}=e,n=JA(e);return{container:{[Qo.variable]:`colors.${t}.500`,[Kl.variable]:n.light,_dark:{[Qo.variable]:`colors.${t}.200`,[Kl.variable]:n.dark},paddingStart:"3",borderStartWidth:"4px",borderStartColor:Qo.reference}}}),hOe=Ry(e=>{const{colorScheme:t}=e,n=JA(e);return{container:{[Qo.variable]:`colors.${t}.500`,[Kl.variable]:n.light,_dark:{[Qo.variable]:`colors.${t}.200`,[Kl.variable]:n.dark},pt:"2",borderTopWidth:"4px",borderTopColor:Qo.reference}}}),pOe=Ry(e=>{const{colorScheme:t}=e;return{container:{[Qo.variable]:"colors.white",[Kl.variable]:`colors.${t}.500`,_dark:{[Qo.variable]:"colors.gray.900",[Kl.variable]:`colors.${t}.200`},color:Qo.reference}}}),gOe={subtle:dOe,"left-accent":fOe,"top-accent":hOe,solid:pOe},mOe=uOe({baseStyle:cOe,variants:gOe,defaultProps:{variant:"subtle",colorScheme:"blue"}}),{definePartsStyle:dH,defineMultiStyleConfig:yOe}=Pt(YPe.keys),Eh=nt("avatar-border-color"),tm=nt("avatar-bg"),P0=nt("avatar-font-size"),lp=nt("avatar-size"),vOe={borderRadius:"full",border:"0.2em solid",borderColor:Eh.reference,[Eh.variable]:"white",_dark:{[Eh.variable]:"colors.gray.800"}},bOe={bg:tm.reference,fontSize:P0.reference,width:lp.reference,height:lp.reference,lineHeight:"1",[tm.variable]:"colors.gray.200",_dark:{[tm.variable]:"colors.whiteAlpha.400"}},_Oe=e=>{const{name:t,theme:n}=e,r=t?k6e({string:t}):"colors.gray.400",i=E6e(r)(n);let o="white";return i||(o="gray.800"),{bg:tm.reference,fontSize:P0.reference,color:o,borderColor:Eh.reference,verticalAlign:"top",width:lp.reference,height:lp.reference,"&:not([data-loaded])":{[tm.variable]:r},[Eh.variable]:"colors.white",_dark:{[Eh.variable]:"colors.gray.800"}}},SOe={fontSize:P0.reference,lineHeight:"1"},xOe=dH(e=>({badge:io(vOe,e),excessLabel:io(bOe,e),container:io(_Oe,e),label:SOe}));function pu(e){const t=e!=="100%"?Uq[e]:void 0;return dH({container:{[lp.variable]:t??e,[P0.variable]:`calc(${t??e} / 2.5)`},excessLabel:{[lp.variable]:t??e,[P0.variable]:`calc(${t??e} / 2.5)`}})}var wOe={"2xs":pu(4),xs:pu(6),sm:pu(8),md:pu(12),lg:pu(16),xl:pu(24),"2xl":pu(32),full:pu("100%")},COe=yOe({baseStyle:xOe,sizes:wOe,defaultProps:{size:"md"}}),EOe={Accordion:lOe,Alert:mOe,Avatar:COe,Badge:Zg,Breadcrumb:T9e,Button:$9e,Checkbox:W_,CloseButton:V9e,Code:W9e,Container:Q9e,Divider:eOe,Drawer:YRe,Editable:i9e,Form:c9e,FormError:m9e,FormLabel:v9e,Heading:S9e,Input:un,Kbd:jIe,Link:VIe,List:KIe,Menu:oRe,Modal:mRe,NumberInput:ERe,PinInput:PRe,Popover:zRe,Progress:W8e,Radio:aIe,Select:hIe,Skeleton:gIe,SkipLink:yIe,Slider:AIe,Spinner:RIe,Stat:BIe,Switch:V6e,Table:X6e,Tabs:d8e,Tag:C8e,Textarea:D8e,Tooltip:B8e,Card:z9e,Stepper:QPe},TOe={colors:{"chakra-body-text":{_light:"gray.800",_dark:"whiteAlpha.900"},"chakra-body-bg":{_light:"white",_dark:"gray.800"},"chakra-border-color":{_light:"gray.200",_dark:"whiteAlpha.300"},"chakra-inverse-text":{_light:"white",_dark:"gray.800"},"chakra-subtle-bg":{_light:"gray.100",_dark:"gray.700"},"chakra-subtle-text":{_light:"gray.600",_dark:"gray.400"},"chakra-placeholder-color":{_light:"gray.500",_dark:"whiteAlpha.400"}}},kOe={global:{body:{fontFamily:"body",color:"chakra-body-text",bg:"chakra-body-bg",transitionProperty:"background-color",transitionDuration:"normal",lineHeight:"base"},"*::placeholder":{color:"chakra-placeholder-color"},"*, *::before, &::after":{borderColor:"chakra-border-color"}}},AOe="ltr",POe={useSystemColorMode:!1,initialColorMode:"light",cssVarPrefix:"chakra"},IOe={semanticTokens:TOe,direction:AOe,...HPe,components:EOe,styles:kOe,config:POe},ROe=IOe;function OOe(e,t){const n={};return Object.keys(e).forEach(r=>{t.includes(r)||(n[r]=e[r])}),n}function MOe(e,t,n,r){const i=typeof t=="string"?t.split("."):[t];for(r=0;r{const t=new WeakMap;return(r,i,o,a)=>{if(typeof r>"u")return e(r,i,o);t.has(r)||t.set(r,new Map);const s=t.get(r);if(s.has(i))return s.get(i);const l=e(r,i,o,a);return s.set(i,l),l}},fH=NOe(MOe);function hH(e,t){const n={};return Object.keys(e).forEach(r=>{const i=e[r];t(i,r,e)&&(n[r]=i)}),n}var pH=e=>hH(e,t=>t!=null);function $Oe(e){return typeof e=="function"}function gH(e,...t){return $Oe(e)?e(...t):e}function qKe(...e){return function(n){e.some(r=>(r==null||r(n),n==null?void 0:n.defaultPrevented))}}var DOe=typeof Element<"u",LOe=typeof Map=="function",FOe=typeof Set=="function",BOe=typeof ArrayBuffer=="function"&&!!ArrayBuffer.isView;function rb(e,t){if(e===t)return!0;if(e&&t&&typeof e=="object"&&typeof t=="object"){if(e.constructor!==t.constructor)return!1;var n,r,i;if(Array.isArray(e)){if(n=e.length,n!=t.length)return!1;for(r=n;r--!==0;)if(!rb(e[r],t[r]))return!1;return!0}var o;if(LOe&&e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(o=e.entries();!(r=o.next()).done;)if(!t.has(r.value[0]))return!1;for(o=e.entries();!(r=o.next()).done;)if(!rb(r.value[1],t.get(r.value[0])))return!1;return!0}if(FOe&&e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(o=e.entries();!(r=o.next()).done;)if(!t.has(r.value[0]))return!1;return!0}if(BOe&&ArrayBuffer.isView(e)&&ArrayBuffer.isView(t)){if(n=e.length,n!=t.length)return!1;for(r=n;r--!==0;)if(e[r]!==t[r])return!1;return!0}if(e.constructor===RegExp)return e.source===t.source&&e.flags===t.flags;if(e.valueOf!==Object.prototype.valueOf&&typeof e.valueOf=="function"&&typeof t.valueOf=="function")return e.valueOf()===t.valueOf();if(e.toString!==Object.prototype.toString&&typeof e.toString=="function"&&typeof t.toString=="function")return e.toString()===t.toString();if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!Object.prototype.hasOwnProperty.call(t,i[r]))return!1;if(DOe&&e instanceof Element)return!1;for(r=n;r--!==0;)if(!((i[r]==="_owner"||i[r]==="__v"||i[r]==="__o")&&e.$$typeof)&&!rb(e[i[r]],t[i[r]]))return!1;return!0}return e!==e&&t!==t}var zOe=function(t,n){try{return rb(t,n)}catch(r){if((r.message||"").match(/stack|recursion/i))return console.warn("react-fast-compare cannot handle circular refs"),!1;throw r}};const jOe=mc(zOe);function mH(e,t={}){var n;const{styleConfig:r,...i}=t,{theme:o,colorMode:a}=tAe(),s=e?fH(o,`components.${e}`):void 0,l=r||s,u=Ls({theme:o,colorMode:a},(n=l==null?void 0:l.defaultProps)!=null?n:{},pH(OOe(i,["children"]))),c=I.useRef({});if(l){const f=xPe(l)(u);jOe(c.current,f)||(c.current=f)}return c.current}function Oy(e,t={}){return mH(e,t)}function UOe(e,t={}){return mH(e,t)}var VOe=new Set([...cPe,"textStyle","layerStyle","apply","noOfLines","focusBorderColor","errorBorderColor","as","__css","css","sx"]),GOe=new Set(["htmlWidth","htmlHeight","htmlSize","htmlTranslate"]);function qOe(e){return GOe.has(e)||!VOe.has(e)}function HOe(e,...t){if(e==null)throw new TypeError("Cannot convert undefined or null to object");const n={...e};for(const r of t)if(r!=null)for(const i in r)Object.prototype.hasOwnProperty.call(r,i)&&(i in n&&delete n[i],n[i]=r[i]);return n}function WOe(e){const t=Object.assign({},e);for(let n in t)t[n]===void 0&&delete t[n];return t}var KOe=/^((children|dangerouslySetInnerHTML|key|ref|autoFocus|defaultValue|defaultChecked|innerHTML|suppressContentEditableWarning|suppressHydrationWarning|valueLink|abbr|accept|acceptCharset|accessKey|action|allow|allowUserMedia|allowPaymentRequest|allowFullScreen|allowTransparency|alt|async|autoComplete|autoPlay|capture|cellPadding|cellSpacing|challenge|charSet|checked|cite|classID|className|cols|colSpan|content|contentEditable|contextMenu|controls|controlsList|coords|crossOrigin|data|dateTime|decoding|default|defer|dir|disabled|disablePictureInPicture|download|draggable|encType|enterKeyHint|form|formAction|formEncType|formMethod|formNoValidate|formTarget|frameBorder|headers|height|hidden|high|href|hrefLang|htmlFor|httpEquiv|id|inputMode|integrity|is|keyParams|keyType|kind|label|lang|list|loading|loop|low|marginHeight|marginWidth|max|maxLength|media|mediaGroup|method|min|minLength|multiple|muted|name|nonce|noValidate|open|optimum|pattern|placeholder|playsInline|poster|preload|profile|radioGroup|readOnly|referrerPolicy|rel|required|reversed|role|rows|rowSpan|sandbox|scope|scoped|scrolling|seamless|selected|shape|size|sizes|slot|span|spellCheck|src|srcDoc|srcLang|srcSet|start|step|style|summary|tabIndex|target|title|translate|type|useMap|value|width|wmode|wrap|about|datatype|inlist|prefix|property|resource|typeof|vocab|autoCapitalize|autoCorrect|autoSave|color|incremental|fallback|inert|itemProp|itemScope|itemType|itemID|itemRef|on|option|results|security|unselectable|accentHeight|accumulate|additive|alignmentBaseline|allowReorder|alphabetic|amplitude|arabicForm|ascent|attributeName|attributeType|autoReverse|azimuth|baseFrequency|baselineShift|baseProfile|bbox|begin|bias|by|calcMode|capHeight|clip|clipPathUnits|clipPath|clipRule|colorInterpolation|colorInterpolationFilters|colorProfile|colorRendering|contentScriptType|contentStyleType|cursor|cx|cy|d|decelerate|descent|diffuseConstant|direction|display|divisor|dominantBaseline|dur|dx|dy|edgeMode|elevation|enableBackground|end|exponent|externalResourcesRequired|fill|fillOpacity|fillRule|filter|filterRes|filterUnits|floodColor|floodOpacity|focusable|fontFamily|fontSize|fontSizeAdjust|fontStretch|fontStyle|fontVariant|fontWeight|format|from|fr|fx|fy|g1|g2|glyphName|glyphOrientationHorizontal|glyphOrientationVertical|glyphRef|gradientTransform|gradientUnits|hanging|horizAdvX|horizOriginX|ideographic|imageRendering|in|in2|intercept|k|k1|k2|k3|k4|kernelMatrix|kernelUnitLength|kerning|keyPoints|keySplines|keyTimes|lengthAdjust|letterSpacing|lightingColor|limitingConeAngle|local|markerEnd|markerMid|markerStart|markerHeight|markerUnits|markerWidth|mask|maskContentUnits|maskUnits|mathematical|mode|numOctaves|offset|opacity|operator|order|orient|orientation|origin|overflow|overlinePosition|overlineThickness|panose1|paintOrder|pathLength|patternContentUnits|patternTransform|patternUnits|pointerEvents|points|pointsAtX|pointsAtY|pointsAtZ|preserveAlpha|preserveAspectRatio|primitiveUnits|r|radius|refX|refY|renderingIntent|repeatCount|repeatDur|requiredExtensions|requiredFeatures|restart|result|rotate|rx|ry|scale|seed|shapeRendering|slope|spacing|specularConstant|specularExponent|speed|spreadMethod|startOffset|stdDeviation|stemh|stemv|stitchTiles|stopColor|stopOpacity|strikethroughPosition|strikethroughThickness|string|stroke|strokeDasharray|strokeDashoffset|strokeLinecap|strokeLinejoin|strokeMiterlimit|strokeOpacity|strokeWidth|surfaceScale|systemLanguage|tableValues|targetX|targetY|textAnchor|textDecoration|textRendering|textLength|to|transform|u1|u2|underlinePosition|underlineThickness|unicode|unicodeBidi|unicodeRange|unitsPerEm|vAlphabetic|vHanging|vIdeographic|vMathematical|values|vectorEffect|version|vertAdvY|vertOriginX|vertOriginY|viewBox|viewTarget|visibility|widths|wordSpacing|writingMode|x|xHeight|x1|x2|xChannelSelector|xlinkActuate|xlinkArcrole|xlinkHref|xlinkRole|xlinkShow|xlinkTitle|xlinkType|xmlBase|xmlns|xmlnsXlink|xmlLang|xmlSpace|y|y1|y2|yChannelSelector|z|zoomAndPan|for|class|autofocus)|(([Dd][Aa][Tt][Aa]|[Aa][Rr][Ii][Aa]|x)-.*))$/,QOe=xq(function(e){return KOe.test(e)||e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&e.charCodeAt(2)<91}),XOe=QOe,YOe=function(t){return t!=="theme"},KM=function(t){return typeof t=="string"&&t.charCodeAt(0)>96?XOe:YOe},QM=function(t,n,r){var i;if(n){var o=n.shouldForwardProp;i=t.__emotion_forwardProp&&o?function(a){return t.__emotion_forwardProp(a)&&o(a)}:o}return typeof i!="function"&&r&&(i=t.__emotion_forwardProp),i},ZOe=function(t){var n=t.cache,r=t.serialized,i=t.isStringTag;return Cq(n,r,i),zke(function(){return Eq(n,r,i)}),null},JOe=function e(t,n){var r=t.__emotion_real===t,i=r&&t.__emotion_base||t,o,a;n!==void 0&&(o=n.label,a=n.target);var s=QM(t,n,r),l=s||KM(i),u=!l("as");return function(){var c=arguments,d=r&&t.__emotion_styles!==void 0?t.__emotion_styles.slice(0):[];if(o!==void 0&&d.push("label:"+o+";"),c[0]==null||c[0].raw===void 0)d.push.apply(d,c);else{d.push(c[0][0]);for(var f=c.length,h=1;ht=>{const{theme:n,css:r,__css:i,sx:o,...a}=t,s=hH(a,(d,f)=>fPe(f)),l=gH(e,t),u=HOe({},i,l,pH(s),o),c=Bq(u)(t.theme);return r?[c,r]:c};function w5(e,t){const{baseStyle:n,...r}=t??{};r.shouldForwardProp||(r.shouldForwardProp=qOe);const i=nMe({baseStyle:n}),o=tMe(e,r)(i);return En.forwardRef(function(l,u){const{colorMode:c,forced:d}=nw();return En.createElement(o,{ref:u,"data-theme":d?c:void 0,...l})})}function rMe(){const e=new Map;return new Proxy(w5,{apply(t,n,r){return w5(...r)},get(t,n){return e.has(n)||e.set(n,w5(n)),e.get(n)}})}var Oi=rMe();function ra(e){return I.forwardRef(e)}function iMe(e={}){const{strict:t=!0,errorMessage:n="useContext: `context` is undefined. Seems you forgot to wrap component within the Provider",name:r}=e,i=I.createContext(void 0);i.displayName=r;function o(){var a;const s=I.useContext(i);if(!s&&t){const l=new Error(n);throw l.name="ContextError",(a=Error.captureStackTrace)==null||a.call(Error,l,o),l}return s}return[i.Provider,o,i]}function oMe(e){const{cssVarsRoot:t,theme:n,children:r}=e,i=I.useMemo(()=>lPe(n),[n]);return W.jsxs(Vke,{theme:i,children:[W.jsx(aMe,{root:t}),r]})}function aMe({root:e=":host, :root"}){const t=[e,"[data-theme]"].join(",");return W.jsx(Iq,{styles:n=>({[t]:n.__cssVars})})}iMe({name:"StylesContext",errorMessage:"useStyles: `styles` is undefined. Seems you forgot to wrap the components in `` "});function HKe(){const{colorMode:e}=nw();return W.jsx(Iq,{styles:t=>{const n=fH(t,"styles.global"),r=gH(n,{theme:t,colorMode:e});return r?Bq(r)(t):void 0}})}var sMe=(e,t)=>e.find(n=>n.id===t);function YM(e,t){const n=yH(e,t),r=n?e[n].findIndex(i=>i.id===t):-1;return{position:n,index:r}}function yH(e,t){for(const[n,r]of Object.entries(e))if(sMe(r,t))return n}function lMe(e){const t=e.includes("right"),n=e.includes("left");let r="center";return t&&(r="flex-end"),n&&(r="flex-start"),{display:"flex",flexDirection:"column",alignItems:r}}function uMe(e){const n=e==="top"||e==="bottom"?"0 auto":void 0,r=e.includes("top")?"env(safe-area-inset-top, 0px)":void 0,i=e.includes("bottom")?"env(safe-area-inset-bottom, 0px)":void 0,o=e.includes("left")?void 0:"env(safe-area-inset-right, 0px)",a=e.includes("right")?void 0:"env(safe-area-inset-left, 0px)";return{position:"fixed",zIndex:"var(--toast-z-index, 5500)",pointerEvents:"none",display:"flex",flexDirection:"column",margin:n,top:r,bottom:i,right:o,left:a}}function cMe(e,t=[]){const n=I.useRef(e);return I.useEffect(()=>{n.current=e}),I.useCallback((...r)=>{var i;return(i=n.current)==null?void 0:i.call(n,...r)},t)}function dMe(e,t){const n=cMe(e);I.useEffect(()=>{if(t==null)return;let r=null;return r=window.setTimeout(()=>{n()},t),()=>{r&&window.clearTimeout(r)}},[t,n])}function ZM(e,t){const n=I.useRef(!1),r=I.useRef(!1);I.useEffect(()=>{if(n.current&&r.current)return e();r.current=!0},t),I.useEffect(()=>(n.current=!0,()=>{n.current=!1}),[])}const vH=I.createContext({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"}),sw=I.createContext({}),My=I.createContext(null),lw=typeof document<"u",eP=lw?I.useLayoutEffect:I.useEffect,bH=I.createContext({strict:!1});function fMe(e,t,n,r){const{visualElement:i}=I.useContext(sw),o=I.useContext(bH),a=I.useContext(My),s=I.useContext(vH).reducedMotion,l=I.useRef();r=r||o.renderer,!l.current&&r&&(l.current=r(e,{visualState:t,parent:i,props:n,presenceContext:a,blockInitialAnimation:a?a.initial===!1:!1,reducedMotionConfig:s}));const u=l.current;I.useInsertionEffect(()=>{u&&u.update(n,a)});const c=I.useRef(!!window.HandoffAppearAnimations);return eP(()=>{u&&(u.render(),c.current&&u.animationState&&u.animationState.animateChanges())}),I.useEffect(()=>{u&&(u.updateFeatures(),!c.current&&u.animationState&&u.animationState.animateChanges(),window.HandoffAppearAnimations=void 0,c.current=!1)}),u}function Kf(e){return typeof e=="object"&&Object.prototype.hasOwnProperty.call(e,"current")}function hMe(e,t,n){return I.useCallback(r=>{r&&e.mount&&e.mount(r),t&&(r?t.mount(r):t.unmount()),n&&(typeof n=="function"?n(r):Kf(n)&&(n.current=r))},[t])}function I0(e){return typeof e=="string"||Array.isArray(e)}function uw(e){return typeof e=="object"&&typeof e.start=="function"}const tP=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],nP=["initial",...tP];function cw(e){return uw(e.animate)||nP.some(t=>I0(e[t]))}function _H(e){return!!(cw(e)||e.variants)}function pMe(e,t){if(cw(e)){const{initial:n,animate:r}=e;return{initial:n===!1||I0(n)?n:void 0,animate:I0(r)?r:void 0}}return e.inherit!==!1?t:{}}function gMe(e){const{initial:t,animate:n}=pMe(e,I.useContext(sw));return I.useMemo(()=>({initial:t,animate:n}),[JM(t),JM(n)])}function JM(e){return Array.isArray(e)?e.join(" "):e}const e7={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]},R0={};for(const e in e7)R0[e]={isEnabled:t=>e7[e].some(n=>!!t[n])};function mMe(e){for(const t in e)R0[t]={...R0[t],...e[t]}}const rP=I.createContext({}),SH=I.createContext({}),yMe=Symbol.for("motionComponentSymbol");function vMe({preloadedFeatures:e,createVisualElement:t,useRender:n,useVisualState:r,Component:i}){e&&mMe(e);function o(s,l){let u;const c={...I.useContext(vH),...s,layoutId:bMe(s)},{isStatic:d}=c,f=gMe(s),h=r(s,d);if(!d&&lw){f.visualElement=fMe(i,h,c,t);const p=I.useContext(SH),m=I.useContext(bH).strict;f.visualElement&&(u=f.visualElement.loadFeatures(c,m,e,p))}return I.createElement(sw.Provider,{value:f},u&&f.visualElement?I.createElement(u,{visualElement:f.visualElement,...c}):null,n(i,s,hMe(h,f.visualElement,l),h,d,f.visualElement))}const a=I.forwardRef(o);return a[yMe]=i,a}function bMe({layoutId:e}){const t=I.useContext(rP).id;return t&&e!==void 0?t+"-"+e:e}function _Me(e){function t(r,i={}){return vMe(e(r,i))}if(typeof Proxy>"u")return t;const n=new Map;return new Proxy(t,{get:(r,i)=>(n.has(i)||n.set(i,t(i)),n.get(i))})}const SMe=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function iP(e){return typeof e!="string"||e.includes("-")?!1:!!(SMe.indexOf(e)>-1||/[A-Z]/.test(e))}const X_={};function xMe(e){Object.assign(X_,e)}const Ny=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],Jd=new Set(Ny);function xH(e,{layout:t,layoutId:n}){return Jd.has(e)||e.startsWith("origin")||(t||n!==void 0)&&(!!X_[e]||e==="opacity")}const Mo=e=>!!(e&&e.getVelocity),wMe={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},CMe=Ny.length;function EMe(e,{enableHardwareAcceleration:t=!0,allowTransformNone:n=!0},r,i){let o="";for(let a=0;at=>typeof t=="string"&&t.startsWith(e),CH=wH("--"),vT=wH("var(--"),TMe=/var\s*\(\s*--[\w-]+(\s*,\s*(?:(?:[^)(]|\((?:[^)(]+|\([^)(]*\))*\))*)+)?\s*\)/g,kMe=(e,t)=>t&&typeof e=="number"?t.transform(e):e,pc=(e,t,n)=>Math.min(Math.max(n,e),t),ef={test:e=>typeof e=="number",parse:parseFloat,transform:e=>e},nm={...ef,transform:e=>pc(0,1,e)},t1={...ef,default:1},rm=e=>Math.round(e*1e5)/1e5,dw=/(-)?([\d]*\.?[\d])+/g,EH=/(#[0-9a-f]{3,8}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2}(-?[\d\.]+%?)\s*[\,\/]?\s*[\d\.]*%?\))/gi,AMe=/^(#[0-9a-f]{3,8}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2}(-?[\d\.]+%?)\s*[\,\/]?\s*[\d\.]*%?\))$/i;function $y(e){return typeof e=="string"}const Dy=e=>({test:t=>$y(t)&&t.endsWith(e)&&t.split(" ").length===1,parse:parseFloat,transform:t=>`${t}${e}`}),mu=Dy("deg"),Ks=Dy("%"),at=Dy("px"),PMe=Dy("vh"),IMe=Dy("vw"),t7={...Ks,parse:e=>Ks.parse(e)/100,transform:e=>Ks.transform(e*100)},n7={...ef,transform:Math.round},TH={borderWidth:at,borderTopWidth:at,borderRightWidth:at,borderBottomWidth:at,borderLeftWidth:at,borderRadius:at,radius:at,borderTopLeftRadius:at,borderTopRightRadius:at,borderBottomRightRadius:at,borderBottomLeftRadius:at,width:at,maxWidth:at,height:at,maxHeight:at,size:at,top:at,right:at,bottom:at,left:at,padding:at,paddingTop:at,paddingRight:at,paddingBottom:at,paddingLeft:at,margin:at,marginTop:at,marginRight:at,marginBottom:at,marginLeft:at,rotate:mu,rotateX:mu,rotateY:mu,rotateZ:mu,scale:t1,scaleX:t1,scaleY:t1,scaleZ:t1,skew:mu,skewX:mu,skewY:mu,distance:at,translateX:at,translateY:at,translateZ:at,x:at,y:at,z:at,perspective:at,transformPerspective:at,opacity:nm,originX:t7,originY:t7,originZ:at,zIndex:n7,fillOpacity:nm,strokeOpacity:nm,numOctaves:n7};function oP(e,t,n,r){const{style:i,vars:o,transform:a,transformOrigin:s}=e;let l=!1,u=!1,c=!0;for(const d in t){const f=t[d];if(CH(d)){o[d]=f;continue}const h=TH[d],p=kMe(f,h);if(Jd.has(d)){if(l=!0,a[d]=p,!c)continue;f!==(h.default||0)&&(c=!1)}else d.startsWith("origin")?(u=!0,s[d]=p):i[d]=p}if(t.transform||(l||r?i.transform=EMe(e.transform,n,c,r):i.transform&&(i.transform="none")),u){const{originX:d="50%",originY:f="50%",originZ:h=0}=s;i.transformOrigin=`${d} ${f} ${h}`}}const aP=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function kH(e,t,n){for(const r in t)!Mo(t[r])&&!xH(r,n)&&(e[r]=t[r])}function RMe({transformTemplate:e},t,n){return I.useMemo(()=>{const r=aP();return oP(r,t,{enableHardwareAcceleration:!n},e),Object.assign({},r.vars,r.style)},[t])}function OMe(e,t,n){const r=e.style||{},i={};return kH(i,r,e),Object.assign(i,RMe(e,t,n)),e.transformValues?e.transformValues(i):i}function MMe(e,t,n){const r={},i=OMe(e,t,n);return e.drag&&e.dragListener!==!1&&(r.draggable=!1,i.userSelect=i.WebkitUserSelect=i.WebkitTouchCallout="none",i.touchAction=e.drag===!0?"none":`pan-${e.drag==="x"?"y":"x"}`),e.tabIndex===void 0&&(e.onTap||e.onTapStart||e.whileTap)&&(r.tabIndex=0),r.style=i,r}const NMe=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","transformValues","custom","inherit","onLayoutAnimationStart","onLayoutAnimationComplete","onLayoutMeasure","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","ignoreStrict","viewport"]);function Y_(e){return e.startsWith("while")||e.startsWith("drag")&&e!=="draggable"||e.startsWith("layout")||e.startsWith("onTap")||e.startsWith("onPan")||NMe.has(e)}let AH=e=>!Y_(e);function $Me(e){e&&(AH=t=>t.startsWith("on")?!Y_(t):e(t))}try{$Me(require("@emotion/is-prop-valid").default)}catch{}function DMe(e,t,n){const r={};for(const i in e)i==="values"&&typeof e.values=="object"||(AH(i)||n===!0&&Y_(i)||!t&&!Y_(i)||e.draggable&&i.startsWith("onDrag"))&&(r[i]=e[i]);return r}function r7(e,t,n){return typeof e=="string"?e:at.transform(t+n*e)}function LMe(e,t,n){const r=r7(t,e.x,e.width),i=r7(n,e.y,e.height);return`${r} ${i}`}const FMe={offset:"stroke-dashoffset",array:"stroke-dasharray"},BMe={offset:"strokeDashoffset",array:"strokeDasharray"};function zMe(e,t,n=1,r=0,i=!0){e.pathLength=1;const o=i?FMe:BMe;e[o.offset]=at.transform(-r);const a=at.transform(t),s=at.transform(n);e[o.array]=`${a} ${s}`}function sP(e,{attrX:t,attrY:n,attrScale:r,originX:i,originY:o,pathLength:a,pathSpacing:s=1,pathOffset:l=0,...u},c,d,f){if(oP(e,u,c,f),d){e.style.viewBox&&(e.attrs.viewBox=e.style.viewBox);return}e.attrs=e.style,e.style={};const{attrs:h,style:p,dimensions:m}=e;h.transform&&(m&&(p.transform=h.transform),delete h.transform),m&&(i!==void 0||o!==void 0||p.transform)&&(p.transformOrigin=LMe(m,i!==void 0?i:.5,o!==void 0?o:.5)),t!==void 0&&(h.x=t),n!==void 0&&(h.y=n),r!==void 0&&(h.scale=r),a!==void 0&&zMe(h,a,s,l,!1)}const PH=()=>({...aP(),attrs:{}}),lP=e=>typeof e=="string"&&e.toLowerCase()==="svg";function jMe(e,t,n,r){const i=I.useMemo(()=>{const o=PH();return sP(o,t,{enableHardwareAcceleration:!1},lP(r),e.transformTemplate),{...o.attrs,style:{...o.style}}},[t]);if(e.style){const o={};kH(o,e.style,e),i.style={...o,...i.style}}return i}function UMe(e=!1){return(n,r,i,{latestValues:o},a)=>{const l=(iP(n)?jMe:MMe)(r,o,a,n),c={...DMe(r,typeof n=="string",e),...l,ref:i},{children:d}=r,f=I.useMemo(()=>Mo(d)?d.get():d,[d]);return I.createElement(n,{...c,children:f})}}const uP=e=>e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase();function IH(e,{style:t,vars:n},r,i){Object.assign(e.style,t,i&&i.getProjectionStyles(r));for(const o in n)e.style.setProperty(o,n[o])}const RH=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]);function OH(e,t,n,r){IH(e,t,void 0,r);for(const i in t.attrs)e.setAttribute(RH.has(i)?i:uP(i),t.attrs[i])}function cP(e,t){const{style:n}=e,r={};for(const i in n)(Mo(n[i])||t.style&&Mo(t.style[i])||xH(i,e))&&(r[i]=n[i]);return r}function MH(e,t){const n=cP(e,t);for(const r in e)if(Mo(e[r])||Mo(t[r])){const i=Ny.indexOf(r)!==-1?"attr"+r.charAt(0).toUpperCase()+r.substring(1):r;n[i]=e[r]}return n}function dP(e,t,n,r={},i={}){return typeof t=="function"&&(t=t(n!==void 0?n:e.custom,r,i)),typeof t=="string"&&(t=e.variants&&e.variants[t]),typeof t=="function"&&(t=t(n!==void 0?n:e.custom,r,i)),t}function NH(e){const t=I.useRef(null);return t.current===null&&(t.current=e()),t.current}const Z_=e=>Array.isArray(e),VMe=e=>!!(e&&typeof e=="object"&&e.mix&&e.toValue),GMe=e=>Z_(e)?e[e.length-1]||0:e;function ib(e){const t=Mo(e)?e.get():e;return VMe(t)?t.toValue():t}function qMe({scrapeMotionValuesFromProps:e,createRenderState:t,onMount:n},r,i,o){const a={latestValues:HMe(r,i,o,e),renderState:t()};return n&&(a.mount=s=>n(r,s,a)),a}const $H=e=>(t,n)=>{const r=I.useContext(sw),i=I.useContext(My),o=()=>qMe(e,t,r,i);return n?o():NH(o)};function HMe(e,t,n,r){const i={},o=r(e,{});for(const f in o)i[f]=ib(o[f]);let{initial:a,animate:s}=e;const l=cw(e),u=_H(e);t&&u&&!l&&e.inherit!==!1&&(a===void 0&&(a=t.initial),s===void 0&&(s=t.animate));let c=n?n.initial===!1:!1;c=c||a===!1;const d=c?s:a;return d&&typeof d!="boolean"&&!uw(d)&&(Array.isArray(d)?d:[d]).forEach(h=>{const p=dP(e,h);if(!p)return;const{transitionEnd:m,transition:_,...b}=p;for(const v in b){let g=b[v];if(Array.isArray(g)){const y=c?g.length-1:0;g=g[y]}g!==null&&(i[v]=g)}for(const v in m)i[v]=m[v]}),i}const yr=e=>e;function WMe(e){let t=[],n=[],r=0,i=!1,o=!1;const a=new WeakSet,s={schedule:(l,u=!1,c=!1)=>{const d=c&&i,f=d?t:n;return u&&a.add(l),f.indexOf(l)===-1&&(f.push(l),d&&i&&(r=t.length)),l},cancel:l=>{const u=n.indexOf(l);u!==-1&&n.splice(u,1),a.delete(l)},process:l=>{if(i){o=!0;return}if(i=!0,[t,n]=[n,t],n.length=0,r=t.length,r)for(let u=0;u(d[f]=WMe(()=>n=!0),d),{}),a=d=>o[d].process(i),s=()=>{const d=performance.now();n=!1,i.delta=r?1e3/60:Math.max(Math.min(d-i.timestamp,KMe),1),i.timestamp=d,i.isProcessing=!0,n1.forEach(a),i.isProcessing=!1,n&&t&&(r=!1,e(s))},l=()=>{n=!0,r=!0,i.isProcessing||e(s)};return{schedule:n1.reduce((d,f)=>{const h=o[f];return d[f]=(p,m=!1,_=!1)=>(n||l(),h.schedule(p,m,_)),d},{}),cancel:d=>n1.forEach(f=>o[f].cancel(d)),state:i,steps:o}}const{schedule:$n,cancel:Ql,state:ji,steps:C5}=QMe(typeof requestAnimationFrame<"u"?requestAnimationFrame:yr,!0),XMe={useVisualState:$H({scrapeMotionValuesFromProps:MH,createRenderState:PH,onMount:(e,t,{renderState:n,latestValues:r})=>{$n.read(()=>{try{n.dimensions=typeof t.getBBox=="function"?t.getBBox():t.getBoundingClientRect()}catch{n.dimensions={x:0,y:0,width:0,height:0}}}),$n.render(()=>{sP(n,r,{enableHardwareAcceleration:!1},lP(t.tagName),e.transformTemplate),OH(t,n)})}})},YMe={useVisualState:$H({scrapeMotionValuesFromProps:cP,createRenderState:aP})};function ZMe(e,{forwardMotionProps:t=!1},n,r){return{...iP(e)?XMe:YMe,preloadedFeatures:n,useRender:UMe(t),createVisualElement:r,Component:e}}function Ol(e,t,n,r={passive:!0}){return e.addEventListener(t,n,r),()=>e.removeEventListener(t,n)}const DH=e=>e.pointerType==="mouse"?typeof e.button!="number"||e.button<=0:e.isPrimary!==!1;function fw(e,t="page"){return{point:{x:e[t+"X"],y:e[t+"Y"]}}}const JMe=e=>t=>DH(t)&&e(t,fw(t));function Ll(e,t,n,r){return Ol(e,t,JMe(n),r)}const e7e=(e,t)=>n=>t(e(n)),Zu=(...e)=>e.reduce(e7e);function LH(e){let t=null;return()=>{const n=()=>{t=null};return t===null?(t=e,n):!1}}const i7=LH("dragHorizontal"),o7=LH("dragVertical");function FH(e){let t=!1;if(e==="y")t=o7();else if(e==="x")t=i7();else{const n=i7(),r=o7();n&&r?t=()=>{n(),r()}:(n&&n(),r&&r())}return t}function BH(){const e=FH(!0);return e?(e(),!1):!0}class Oc{constructor(t){this.isMounted=!1,this.node=t}update(){}}function a7(e,t){const n="pointer"+(t?"enter":"leave"),r="onHover"+(t?"Start":"End"),i=(o,a)=>{if(o.type==="touch"||BH())return;const s=e.getProps();e.animationState&&s.whileHover&&e.animationState.setActive("whileHover",t),s[r]&&$n.update(()=>s[r](o,a))};return Ll(e.current,n,i,{passive:!e.getProps()[r]})}class t7e extends Oc{mount(){this.unmount=Zu(a7(this.node,!0),a7(this.node,!1))}unmount(){}}class n7e extends Oc{constructor(){super(...arguments),this.isActive=!1}onFocus(){let t=!1;try{t=this.node.current.matches(":focus-visible")}catch{t=!0}!t||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=Zu(Ol(this.node.current,"focus",()=>this.onFocus()),Ol(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}const zH=(e,t)=>t?e===t?!0:zH(e,t.parentElement):!1;function E5(e,t){if(!t)return;const n=new PointerEvent("pointer"+e);t(n,fw(n))}class r7e extends Oc{constructor(){super(...arguments),this.removeStartListeners=yr,this.removeEndListeners=yr,this.removeAccessibleListeners=yr,this.startPointerPress=(t,n)=>{if(this.removeEndListeners(),this.isPressing)return;const r=this.node.getProps(),o=Ll(window,"pointerup",(s,l)=>{if(!this.checkPressEnd())return;const{onTap:u,onTapCancel:c}=this.node.getProps();$n.update(()=>{zH(this.node.current,s.target)?u&&u(s,l):c&&c(s,l)})},{passive:!(r.onTap||r.onPointerUp)}),a=Ll(window,"pointercancel",(s,l)=>this.cancelPress(s,l),{passive:!(r.onTapCancel||r.onPointerCancel)});this.removeEndListeners=Zu(o,a),this.startPress(t,n)},this.startAccessiblePress=()=>{const t=o=>{if(o.key!=="Enter"||this.isPressing)return;const a=s=>{s.key!=="Enter"||!this.checkPressEnd()||E5("up",(l,u)=>{const{onTap:c}=this.node.getProps();c&&$n.update(()=>c(l,u))})};this.removeEndListeners(),this.removeEndListeners=Ol(this.node.current,"keyup",a),E5("down",(s,l)=>{this.startPress(s,l)})},n=Ol(this.node.current,"keydown",t),r=()=>{this.isPressing&&E5("cancel",(o,a)=>this.cancelPress(o,a))},i=Ol(this.node.current,"blur",r);this.removeAccessibleListeners=Zu(n,i)}}startPress(t,n){this.isPressing=!0;const{onTapStart:r,whileTap:i}=this.node.getProps();i&&this.node.animationState&&this.node.animationState.setActive("whileTap",!0),r&&$n.update(()=>r(t,n))}checkPressEnd(){return this.removeEndListeners(),this.isPressing=!1,this.node.getProps().whileTap&&this.node.animationState&&this.node.animationState.setActive("whileTap",!1),!BH()}cancelPress(t,n){if(!this.checkPressEnd())return;const{onTapCancel:r}=this.node.getProps();r&&$n.update(()=>r(t,n))}mount(){const t=this.node.getProps(),n=Ll(this.node.current,"pointerdown",this.startPointerPress,{passive:!(t.onTapStart||t.onPointerStart)}),r=Ol(this.node.current,"focus",this.startAccessiblePress);this.removeStartListeners=Zu(n,r)}unmount(){this.removeStartListeners(),this.removeEndListeners(),this.removeAccessibleListeners()}}const bT=new WeakMap,T5=new WeakMap,i7e=e=>{const t=bT.get(e.target);t&&t(e)},o7e=e=>{e.forEach(i7e)};function a7e({root:e,...t}){const n=e||document;T5.has(n)||T5.set(n,{});const r=T5.get(n),i=JSON.stringify(t);return r[i]||(r[i]=new IntersectionObserver(o7e,{root:e,...t})),r[i]}function s7e(e,t,n){const r=a7e(t);return bT.set(e,n),r.observe(e),()=>{bT.delete(e),r.unobserve(e)}}const l7e={some:0,all:1};class u7e extends Oc{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:t={}}=this.node.getProps(),{root:n,margin:r,amount:i="some",once:o}=t,a={root:n?n.current:void 0,rootMargin:r,threshold:typeof i=="number"?i:l7e[i]},s=l=>{const{isIntersecting:u}=l;if(this.isInView===u||(this.isInView=u,o&&!u&&this.hasEnteredView))return;u&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",u);const{onViewportEnter:c,onViewportLeave:d}=this.node.getProps(),f=u?c:d;f&&f(l)};return s7e(this.node.current,a,s)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:t,prevProps:n}=this.node;["amount","margin","root"].some(c7e(t,n))&&this.startObserver()}unmount(){}}function c7e({viewport:e={}},{viewport:t={}}={}){return n=>e[n]!==t[n]}const d7e={inView:{Feature:u7e},tap:{Feature:r7e},focus:{Feature:n7e},hover:{Feature:t7e}};function jH(e,t){if(!Array.isArray(t))return!1;const n=t.length;if(n!==e.length)return!1;for(let r=0;rt[r]=n.get()),t}function h7e(e){const t={};return e.values.forEach((n,r)=>t[r]=n.getVelocity()),t}function hw(e,t,n){const r=e.getProps();return dP(r,t,n!==void 0?n:r.custom,f7e(e),h7e(e))}const p7e="framerAppearId",g7e="data-"+uP(p7e);let m7e=yr,fP=yr;const Ju=e=>e*1e3,Fl=e=>e/1e3,y7e={current:!1},UH=e=>Array.isArray(e)&&typeof e[0]=="number";function VH(e){return!!(!e||typeof e=="string"&&GH[e]||UH(e)||Array.isArray(e)&&e.every(VH))}const Rg=([e,t,n,r])=>`cubic-bezier(${e}, ${t}, ${n}, ${r})`,GH={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:Rg([0,.65,.55,1]),circOut:Rg([.55,0,1,.45]),backIn:Rg([.31,.01,.66,-.59]),backOut:Rg([.33,1.53,.69,.99])};function qH(e){if(e)return UH(e)?Rg(e):Array.isArray(e)?e.map(qH):GH[e]}function v7e(e,t,n,{delay:r=0,duration:i,repeat:o=0,repeatType:a="loop",ease:s,times:l}={}){const u={[t]:n};l&&(u.offset=l);const c=qH(s);return Array.isArray(c)&&(u.easing=c),e.animate(u,{delay:r,duration:i,easing:Array.isArray(c)?"linear":c,fill:"both",iterations:o+1,direction:a==="reverse"?"alternate":"normal"})}function b7e(e,{repeat:t,repeatType:n="loop"}){const r=t&&n!=="loop"&&t%2===1?0:e.length-1;return e[r]}const HH=(e,t,n)=>(((1-3*n+3*t)*e+(3*n-6*t))*e+3*t)*e,_7e=1e-7,S7e=12;function x7e(e,t,n,r,i){let o,a,s=0;do a=t+(n-t)/2,o=HH(a,r,i)-e,o>0?n=a:t=a;while(Math.abs(o)>_7e&&++sx7e(o,0,1,e,n);return o=>o===0||o===1?o:HH(i(o),t,r)}const w7e=Ly(.42,0,1,1),C7e=Ly(0,0,.58,1),WH=Ly(.42,0,.58,1),E7e=e=>Array.isArray(e)&&typeof e[0]!="number",KH=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,QH=e=>t=>1-e(1-t),XH=e=>1-Math.sin(Math.acos(e)),hP=QH(XH),T7e=KH(hP),YH=Ly(.33,1.53,.69,.99),pP=QH(YH),k7e=KH(pP),A7e=e=>(e*=2)<1?.5*pP(e):.5*(2-Math.pow(2,-10*(e-1))),P7e={linear:yr,easeIn:w7e,easeInOut:WH,easeOut:C7e,circIn:XH,circInOut:T7e,circOut:hP,backIn:pP,backInOut:k7e,backOut:YH,anticipate:A7e},s7=e=>{if(Array.isArray(e)){fP(e.length===4);const[t,n,r,i]=e;return Ly(t,n,r,i)}else if(typeof e=="string")return P7e[e];return e},gP=(e,t)=>n=>!!($y(n)&&AMe.test(n)&&n.startsWith(e)||t&&Object.prototype.hasOwnProperty.call(n,t)),ZH=(e,t,n)=>r=>{if(!$y(r))return r;const[i,o,a,s]=r.match(dw);return{[e]:parseFloat(i),[t]:parseFloat(o),[n]:parseFloat(a),alpha:s!==void 0?parseFloat(s):1}},I7e=e=>pc(0,255,e),k5={...ef,transform:e=>Math.round(I7e(e))},ud={test:gP("rgb","red"),parse:ZH("red","green","blue"),transform:({red:e,green:t,blue:n,alpha:r=1})=>"rgba("+k5.transform(e)+", "+k5.transform(t)+", "+k5.transform(n)+", "+rm(nm.transform(r))+")"};function R7e(e){let t="",n="",r="",i="";return e.length>5?(t=e.substring(1,3),n=e.substring(3,5),r=e.substring(5,7),i=e.substring(7,9)):(t=e.substring(1,2),n=e.substring(2,3),r=e.substring(3,4),i=e.substring(4,5),t+=t,n+=n,r+=r,i+=i),{red:parseInt(t,16),green:parseInt(n,16),blue:parseInt(r,16),alpha:i?parseInt(i,16)/255:1}}const _T={test:gP("#"),parse:R7e,transform:ud.transform},Qf={test:gP("hsl","hue"),parse:ZH("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:n,alpha:r=1})=>"hsla("+Math.round(e)+", "+Ks.transform(rm(t))+", "+Ks.transform(rm(n))+", "+rm(nm.transform(r))+")"},Ji={test:e=>ud.test(e)||_T.test(e)||Qf.test(e),parse:e=>ud.test(e)?ud.parse(e):Qf.test(e)?Qf.parse(e):_T.parse(e),transform:e=>$y(e)?e:e.hasOwnProperty("red")?ud.transform(e):Qf.transform(e)},lr=(e,t,n)=>-n*e+n*t+e;function A5(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e}function O7e({hue:e,saturation:t,lightness:n,alpha:r}){e/=360,t/=100,n/=100;let i=0,o=0,a=0;if(!t)i=o=a=n;else{const s=n<.5?n*(1+t):n+t-n*t,l=2*n-s;i=A5(l,s,e+1/3),o=A5(l,s,e),a=A5(l,s,e-1/3)}return{red:Math.round(i*255),green:Math.round(o*255),blue:Math.round(a*255),alpha:r}}const P5=(e,t,n)=>{const r=e*e;return Math.sqrt(Math.max(0,n*(t*t-r)+r))},M7e=[_T,ud,Qf],N7e=e=>M7e.find(t=>t.test(e));function l7(e){const t=N7e(e);let n=t.parse(e);return t===Qf&&(n=O7e(n)),n}const JH=(e,t)=>{const n=l7(e),r=l7(t),i={...n};return o=>(i.red=P5(n.red,r.red,o),i.green=P5(n.green,r.green,o),i.blue=P5(n.blue,r.blue,o),i.alpha=lr(n.alpha,r.alpha,o),ud.transform(i))};function $7e(e){var t,n;return isNaN(e)&&$y(e)&&(((t=e.match(dw))===null||t===void 0?void 0:t.length)||0)+(((n=e.match(EH))===null||n===void 0?void 0:n.length)||0)>0}const eW={regex:TMe,countKey:"Vars",token:"${v}",parse:yr},tW={regex:EH,countKey:"Colors",token:"${c}",parse:Ji.parse},nW={regex:dw,countKey:"Numbers",token:"${n}",parse:ef.parse};function I5(e,{regex:t,countKey:n,token:r,parse:i}){const o=e.tokenised.match(t);o&&(e["num"+n]=o.length,e.tokenised=e.tokenised.replace(t,r),e.values.push(...o.map(i)))}function J_(e){const t=e.toString(),n={value:t,tokenised:t,values:[],numVars:0,numColors:0,numNumbers:0};return n.value.includes("var(--")&&I5(n,eW),I5(n,tW),I5(n,nW),n}function rW(e){return J_(e).values}function iW(e){const{values:t,numColors:n,numVars:r,tokenised:i}=J_(e),o=t.length;return a=>{let s=i;for(let l=0;ltypeof e=="number"?0:e;function L7e(e){const t=rW(e);return iW(e)(t.map(D7e))}const gc={test:$7e,parse:rW,createTransformer:iW,getAnimatableNone:L7e},oW=(e,t)=>n=>`${n>0?t:e}`;function aW(e,t){return typeof e=="number"?n=>lr(e,t,n):Ji.test(e)?JH(e,t):e.startsWith("var(")?oW(e,t):lW(e,t)}const sW=(e,t)=>{const n=[...e],r=n.length,i=e.map((o,a)=>aW(o,t[a]));return o=>{for(let a=0;a{const n={...e,...t},r={};for(const i in n)e[i]!==void 0&&t[i]!==void 0&&(r[i]=aW(e[i],t[i]));return i=>{for(const o in r)n[o]=r[o](i);return n}},lW=(e,t)=>{const n=gc.createTransformer(t),r=J_(e),i=J_(t);return r.numVars===i.numVars&&r.numColors===i.numColors&&r.numNumbers>=i.numNumbers?Zu(sW(r.values,i.values),n):oW(e,t)},O0=(e,t,n)=>{const r=t-e;return r===0?1:(n-e)/r},u7=(e,t)=>n=>lr(e,t,n);function B7e(e){return typeof e=="number"?u7:typeof e=="string"?Ji.test(e)?JH:lW:Array.isArray(e)?sW:typeof e=="object"?F7e:u7}function z7e(e,t,n){const r=[],i=n||B7e(e[0]),o=e.length-1;for(let a=0;at[0];e[0]>e[o-1]&&(e=[...e].reverse(),t=[...t].reverse());const a=z7e(t,r,i),s=a.length,l=u=>{let c=0;if(s>1)for(;cl(pc(e[0],e[o-1],u)):l}function j7e(e,t){const n=e[e.length-1];for(let r=1;r<=t;r++){const i=O0(0,t,r);e.push(lr(n,1,i))}}function U7e(e){const t=[0];return j7e(t,e.length-1),t}function V7e(e,t){return e.map(n=>n*t)}function G7e(e,t){return e.map(()=>t||WH).splice(0,e.length-1)}function eS({duration:e=300,keyframes:t,times:n,ease:r="easeInOut"}){const i=E7e(r)?r.map(s7):s7(r),o={done:!1,value:t[0]},a=V7e(n&&n.length===t.length?n:U7e(t),e),s=uW(a,t,{ease:Array.isArray(i)?i:G7e(t,i)});return{calculatedDuration:e,next:l=>(o.value=s(l),o.done=l>=e,o)}}function cW(e,t){return t?e*(1e3/t):0}const q7e=5;function dW(e,t,n){const r=Math.max(t-q7e,0);return cW(n-e(r),t-r)}const R5=.001,H7e=.01,c7=10,W7e=.05,K7e=1;function Q7e({duration:e=800,bounce:t=.25,velocity:n=0,mass:r=1}){let i,o;m7e(e<=Ju(c7));let a=1-t;a=pc(W7e,K7e,a),e=pc(H7e,c7,Fl(e)),a<1?(i=u=>{const c=u*a,d=c*e,f=c-n,h=ST(u,a),p=Math.exp(-d);return R5-f/h*p},o=u=>{const d=u*a*e,f=d*n+n,h=Math.pow(a,2)*Math.pow(u,2)*e,p=Math.exp(-d),m=ST(Math.pow(u,2),a);return(-i(u)+R5>0?-1:1)*((f-h)*p)/m}):(i=u=>{const c=Math.exp(-u*e),d=(u-n)*e+1;return-R5+c*d},o=u=>{const c=Math.exp(-u*e),d=(n-u)*(e*e);return c*d});const s=5/e,l=Y7e(i,o,s);if(e=Ju(e),isNaN(l))return{stiffness:100,damping:10,duration:e};{const u=Math.pow(l,2)*r;return{stiffness:u,damping:a*2*Math.sqrt(r*u),duration:e}}}const X7e=12;function Y7e(e,t,n){let r=n;for(let i=1;ie[n]!==void 0)}function eNe(e){let t={velocity:0,stiffness:100,damping:10,mass:1,isResolvedFromDuration:!1,...e};if(!d7(e,J7e)&&d7(e,Z7e)){const n=Q7e(e);t={...t,...n,velocity:0,mass:1},t.isResolvedFromDuration=!0}return t}function fW({keyframes:e,restDelta:t,restSpeed:n,...r}){const i=e[0],o=e[e.length-1],a={done:!1,value:i},{stiffness:s,damping:l,mass:u,velocity:c,duration:d,isResolvedFromDuration:f}=eNe(r),h=c?-Fl(c):0,p=l/(2*Math.sqrt(s*u)),m=o-i,_=Fl(Math.sqrt(s/u)),b=Math.abs(m)<5;n||(n=b?.01:2),t||(t=b?.005:.5);let v;if(p<1){const g=ST(_,p);v=y=>{const S=Math.exp(-p*_*y);return o-S*((h+p*_*m)/g*Math.sin(g*y)+m*Math.cos(g*y))}}else if(p===1)v=g=>o-Math.exp(-_*g)*(m+(h+_*m)*g);else{const g=_*Math.sqrt(p*p-1);v=y=>{const S=Math.exp(-p*_*y),w=Math.min(g*y,300);return o-S*((h+p*_*m)*Math.sinh(w)+g*m*Math.cosh(w))/g}}return{calculatedDuration:f&&d||null,next:g=>{const y=v(g);if(f)a.done=g>=d;else{let S=h;g!==0&&(p<1?S=dW(v,g,y):S=0);const w=Math.abs(S)<=n,x=Math.abs(o-y)<=t;a.done=w&&x}return a.value=a.done?o:y,a}}}function f7({keyframes:e,velocity:t=0,power:n=.8,timeConstant:r=325,bounceDamping:i=10,bounceStiffness:o=500,modifyTarget:a,min:s,max:l,restDelta:u=.5,restSpeed:c}){const d=e[0],f={done:!1,value:d},h=C=>s!==void 0&&Cl,p=C=>s===void 0?l:l===void 0||Math.abs(s-C)-m*Math.exp(-C/r),g=C=>b+v(C),y=C=>{const k=v(C),T=g(C);f.done=Math.abs(k)<=u,f.value=f.done?b:T};let S,w;const x=C=>{h(f.value)&&(S=C,w=fW({keyframes:[f.value,p(f.value)],velocity:dW(g,C,f.value),damping:i,stiffness:o,restDelta:u,restSpeed:c}))};return x(0),{calculatedDuration:null,next:C=>{let k=!1;return!w&&S===void 0&&(k=!0,y(C),x(C)),S!==void 0&&C>S?w.next(C-S):(!k&&y(C),f)}}}const tNe=e=>{const t=({timestamp:n})=>e(n);return{start:()=>$n.update(t,!0),stop:()=>Ql(t),now:()=>ji.isProcessing?ji.timestamp:performance.now()}},h7=2e4;function p7(e){let t=0;const n=50;let r=e.next(t);for(;!r.done&&t=h7?1/0:t}const nNe={decay:f7,inertia:f7,tween:eS,keyframes:eS,spring:fW};function tS({autoplay:e=!0,delay:t=0,driver:n=tNe,keyframes:r,type:i="keyframes",repeat:o=0,repeatDelay:a=0,repeatType:s="loop",onPlay:l,onStop:u,onComplete:c,onUpdate:d,...f}){let h=1,p=!1,m,_;const b=()=>{_=new Promise(B=>{m=B})};b();let v;const g=nNe[i]||eS;let y;g!==eS&&typeof r[0]!="number"&&(y=uW([0,100],r,{clamp:!1}),r=[0,100]);const S=g({...f,keyframes:r});let w;s==="mirror"&&(w=g({...f,keyframes:[...r].reverse(),velocity:-(f.velocity||0)}));let x="idle",C=null,k=null,T=null;S.calculatedDuration===null&&o&&(S.calculatedDuration=p7(S));const{calculatedDuration:P}=S;let $=1/0,O=1/0;P!==null&&($=P+a,O=$*(o+1)-a);let E=0;const A=B=>{if(k===null)return;h>0&&(k=Math.min(k,B)),h<0&&(k=Math.min(B-O/h,k)),C!==null?E=C:E=Math.round(B-k)*h;const U=E-t*(h>=0?1:-1),G=h>=0?U<0:U>O;E=Math.max(U,0),x==="finished"&&C===null&&(E=O);let Y=E,ee=S;if(o){const ne=E/$;let se=Math.floor(ne),ve=ne%1;!ve&&ne>=1&&(ve=1),ve===1&&se--,se=Math.min(se,o+1);const ce=!!(se%2);ce&&(s==="reverse"?(ve=1-ve,a&&(ve-=a/$)):s==="mirror"&&(ee=w));let bt=pc(0,1,ve);E>O&&(bt=s==="reverse"&&ce?1:0),Y=bt*$}const J=G?{done:!1,value:r[0]}:ee.next(Y);y&&(J.value=y(J.value));let{done:j}=J;!G&&P!==null&&(j=h>=0?E>=O:E<=0);const Q=C===null&&(x==="finished"||x==="running"&&j);return d&&d(J.value),Q&&M(),J},D=()=>{v&&v.stop(),v=void 0},L=()=>{x="idle",D(),m(),b(),k=T=null},M=()=>{x="finished",c&&c(),D(),m()},R=()=>{if(p)return;v||(v=n(A));const B=v.now();l&&l(),C!==null?k=B-C:(!k||x==="finished")&&(k=B),x==="finished"&&b(),T=k,C=null,x="running",v.start()};e&&R();const N={then(B,U){return _.then(B,U)},get time(){return Fl(E)},set time(B){B=Ju(B),E=B,C!==null||!v||h===0?C=B:k=v.now()-B/h},get duration(){const B=S.calculatedDuration===null?p7(S):S.calculatedDuration;return Fl(B)},get speed(){return h},set speed(B){B===h||!v||(h=B,N.time=Fl(E))},get state(){return x},play:R,pause:()=>{x="paused",C=E},stop:()=>{p=!0,x!=="idle"&&(x="idle",u&&u(),L())},cancel:()=>{T!==null&&A(T),L()},complete:()=>{x="finished"},sample:B=>(k=0,A(B))};return N}function rNe(e){let t;return()=>(t===void 0&&(t=e()),t)}const iNe=rNe(()=>Object.hasOwnProperty.call(Element.prototype,"animate")),oNe=new Set(["opacity","clipPath","filter","transform","backgroundColor"]),r1=10,aNe=2e4,sNe=(e,t)=>t.type==="spring"||e==="backgroundColor"||!VH(t.ease);function lNe(e,t,{onUpdate:n,onComplete:r,...i}){if(!(iNe()&&oNe.has(t)&&!i.repeatDelay&&i.repeatType!=="mirror"&&i.damping!==0&&i.type!=="inertia"))return!1;let a=!1,s,l;const u=()=>{l=new Promise(v=>{s=v})};u();let{keyframes:c,duration:d=300,ease:f,times:h}=i;if(sNe(t,i)){const v=tS({...i,repeat:0,delay:0});let g={done:!1,value:c[0]};const y=[];let S=0;for(;!g.done&&Sp.cancel(),_=()=>{$n.update(m),s(),u()};return p.onfinish=()=>{e.set(b7e(c,i)),r&&r(),_()},{then(v,g){return l.then(v,g)},attachTimeline(v){return p.timeline=v,p.onfinish=null,yr},get time(){return Fl(p.currentTime||0)},set time(v){p.currentTime=Ju(v)},get speed(){return p.playbackRate},set speed(v){p.playbackRate=v},get duration(){return Fl(d)},play:()=>{a||(p.play(),Ql(m))},pause:()=>p.pause(),stop:()=>{if(a=!0,p.playState==="idle")return;const{currentTime:v}=p;if(v){const g=tS({...i,autoplay:!1});e.setWithVelocity(g.sample(v-r1).value,g.sample(v).value,r1)}_()},complete:()=>p.finish(),cancel:_}}function uNe({keyframes:e,delay:t,onUpdate:n,onComplete:r}){const i=()=>(n&&n(e[e.length-1]),r&&r(),{time:0,speed:1,duration:0,play:yr,pause:yr,stop:yr,then:o=>(o(),Promise.resolve()),cancel:yr,complete:yr});return t?tS({keyframes:[0,1],duration:0,delay:t,onComplete:i}):i()}const cNe={type:"spring",stiffness:500,damping:25,restSpeed:10},dNe=e=>({type:"spring",stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),fNe={type:"keyframes",duration:.8},hNe={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},pNe=(e,{keyframes:t})=>t.length>2?fNe:Jd.has(e)?e.startsWith("scale")?dNe(t[1]):cNe:hNe,xT=(e,t)=>e==="zIndex"?!1:!!(typeof t=="number"||Array.isArray(t)||typeof t=="string"&&(gc.test(t)||t==="0")&&!t.startsWith("url(")),gNe=new Set(["brightness","contrast","saturate","opacity"]);function mNe(e){const[t,n]=e.slice(0,-1).split("(");if(t==="drop-shadow")return e;const[r]=n.match(dw)||[];if(!r)return e;const i=n.replace(r,"");let o=gNe.has(t)?1:0;return r!==n&&(o*=100),t+"("+o+i+")"}const yNe=/([a-z-]*)\(.*?\)/g,wT={...gc,getAnimatableNone:e=>{const t=e.match(yNe);return t?t.map(mNe).join(" "):e}},vNe={...TH,color:Ji,backgroundColor:Ji,outlineColor:Ji,fill:Ji,stroke:Ji,borderColor:Ji,borderTopColor:Ji,borderRightColor:Ji,borderBottomColor:Ji,borderLeftColor:Ji,filter:wT,WebkitFilter:wT},mP=e=>vNe[e];function hW(e,t){let n=mP(e);return n!==wT&&(n=gc),n.getAnimatableNone?n.getAnimatableNone(t):void 0}const pW=e=>/^0[^.\s]+$/.test(e);function bNe(e){if(typeof e=="number")return e===0;if(e!==null)return e==="none"||e==="0"||pW(e)}function _Ne(e,t,n,r){const i=xT(t,n);let o;Array.isArray(n)?o=[...n]:o=[null,n];const a=r.from!==void 0?r.from:e.get();let s;const l=[];for(let u=0;ui=>{const o=gW(r,e)||{},a=o.delay||r.delay||0;let{elapsed:s=0}=r;s=s-Ju(a);const l=_Ne(t,e,n,o),u=l[0],c=l[l.length-1],d=xT(e,u),f=xT(e,c);let h={keyframes:l,velocity:t.getVelocity(),ease:"easeOut",...o,delay:-s,onUpdate:p=>{t.set(p),o.onUpdate&&o.onUpdate(p)},onComplete:()=>{i(),o.onComplete&&o.onComplete()}};if(SNe(o)||(h={...h,...pNe(e,h)}),h.duration&&(h.duration=Ju(h.duration)),h.repeatDelay&&(h.repeatDelay=Ju(h.repeatDelay)),!d||!f||y7e.current||o.type===!1)return uNe(h);if(t.owner&&t.owner.current instanceof HTMLElement&&!t.owner.getProps().onUpdate){const p=lNe(t,e,h);if(p)return p}return tS(h)};function nS(e){return!!(Mo(e)&&e.add)}const mW=e=>/^\-?\d*\.?\d+$/.test(e);function vP(e,t){e.indexOf(t)===-1&&e.push(t)}function bP(e,t){const n=e.indexOf(t);n>-1&&e.splice(n,1)}class _P{constructor(){this.subscriptions=[]}add(t){return vP(this.subscriptions,t),()=>bP(this.subscriptions,t)}notify(t,n,r){const i=this.subscriptions.length;if(i)if(i===1)this.subscriptions[0](t,n,r);else for(let o=0;o!isNaN(parseFloat(e));class wNe{constructor(t,n={}){this.version="10.16.1",this.timeDelta=0,this.lastUpdated=0,this.canTrackVelocity=!1,this.events={},this.updateAndNotify=(r,i=!0)=>{this.prev=this.current,this.current=r;const{delta:o,timestamp:a}=ji;this.lastUpdated!==a&&(this.timeDelta=o,this.lastUpdated=a,$n.postRender(this.scheduleVelocityCheck)),this.prev!==this.current&&this.events.change&&this.events.change.notify(this.current),this.events.velocityChange&&this.events.velocityChange.notify(this.getVelocity()),i&&this.events.renderRequest&&this.events.renderRequest.notify(this.current)},this.scheduleVelocityCheck=()=>$n.postRender(this.velocityCheck),this.velocityCheck=({timestamp:r})=>{r!==this.lastUpdated&&(this.prev=this.current,this.events.velocityChange&&this.events.velocityChange.notify(this.getVelocity()))},this.hasAnimated=!1,this.prev=this.current=t,this.canTrackVelocity=xNe(this.current),this.owner=n.owner}onChange(t){return this.on("change",t)}on(t,n){this.events[t]||(this.events[t]=new _P);const r=this.events[t].add(n);return t==="change"?()=>{r(),$n.read(()=>{this.events.change.getSize()||this.stop()})}:r}clearListeners(){for(const t in this.events)this.events[t].clear()}attach(t,n){this.passiveEffect=t,this.stopPassiveEffect=n}set(t,n=!0){!n||!this.passiveEffect?this.updateAndNotify(t,n):this.passiveEffect(t,this.updateAndNotify)}setWithVelocity(t,n,r){this.set(n),this.prev=t,this.timeDelta=r}jump(t){this.updateAndNotify(t),this.prev=t,this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}get(){return this.current}getPrevious(){return this.prev}getVelocity(){return this.canTrackVelocity?cW(parseFloat(this.current)-parseFloat(this.prev),this.timeDelta):0}start(t){return this.stop(),new Promise(n=>{this.hasAnimated=!0,this.animation=t(n),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function up(e,t){return new wNe(e,t)}const yW=e=>t=>t.test(e),CNe={test:e=>e==="auto",parse:e=>e},vW=[ef,at,Ks,mu,IMe,PMe,CNe],ug=e=>vW.find(yW(e)),ENe=[...vW,Ji,gc],TNe=e=>ENe.find(yW(e));function kNe(e,t,n){e.hasValue(t)?e.getValue(t).set(n):e.addValue(t,up(n))}function ANe(e,t){const n=hw(e,t);let{transitionEnd:r={},transition:i={},...o}=n?e.makeTargetAnimatable(n,!1):{};o={...o,...r};for(const a in o){const s=GMe(o[a]);kNe(e,a,s)}}function PNe(e,t,n){var r,i;const o=Object.keys(t).filter(s=>!e.hasValue(s)),a=o.length;if(a)for(let s=0;sl.remove(d))),u.push(m)}return a&&Promise.all(u).then(()=>{a&&ANe(e,a)}),u}function CT(e,t,n={}){const r=hw(e,t,n.custom);let{transition:i=e.getDefaultTransition()||{}}=r||{};n.transitionOverride&&(i=n.transitionOverride);const o=r?()=>Promise.all(bW(e,r,n)):()=>Promise.resolve(),a=e.variantChildren&&e.variantChildren.size?(l=0)=>{const{delayChildren:u=0,staggerChildren:c,staggerDirection:d}=i;return MNe(e,t,u+l,c,d,n)}:()=>Promise.resolve(),{when:s}=i;if(s){const[l,u]=s==="beforeChildren"?[o,a]:[a,o];return l().then(()=>u())}else return Promise.all([o(),a(n.delay)])}function MNe(e,t,n=0,r=0,i=1,o){const a=[],s=(e.variantChildren.size-1)*r,l=i===1?(u=0)=>u*r:(u=0)=>s-u*r;return Array.from(e.variantChildren).sort(NNe).forEach((u,c)=>{u.notify("AnimationStart",t),a.push(CT(u,t,{...o,delay:n+l(c)}).then(()=>u.notify("AnimationComplete",t)))}),Promise.all(a)}function NNe(e,t){return e.sortNodePosition(t)}function $Ne(e,t,n={}){e.notify("AnimationStart",t);let r;if(Array.isArray(t)){const i=t.map(o=>CT(e,o,n));r=Promise.all(i)}else if(typeof t=="string")r=CT(e,t,n);else{const i=typeof t=="function"?hw(e,t,n.custom):t;r=Promise.all(bW(e,i,n))}return r.then(()=>e.notify("AnimationComplete",t))}const DNe=[...tP].reverse(),LNe=tP.length;function FNe(e){return t=>Promise.all(t.map(({animation:n,options:r})=>$Ne(e,n,r)))}function BNe(e){let t=FNe(e);const n=jNe();let r=!0;const i=(l,u)=>{const c=hw(e,u);if(c){const{transition:d,transitionEnd:f,...h}=c;l={...l,...h,...f}}return l};function o(l){t=l(e)}function a(l,u){const c=e.getProps(),d=e.getVariantContext(!0)||{},f=[],h=new Set;let p={},m=1/0;for(let b=0;bm&&S;const T=Array.isArray(y)?y:[y];let P=T.reduce(i,{});w===!1&&(P={});const{prevResolvedValues:$={}}=g,O={...$,...P},E=A=>{k=!0,h.delete(A),g.needsAnimating[A]=!0};for(const A in O){const D=P[A],L=$[A];p.hasOwnProperty(A)||(D!==L?Z_(D)&&Z_(L)?!jH(D,L)||C?E(A):g.protectedKeys[A]=!0:D!==void 0?E(A):h.add(A):D!==void 0&&h.has(A)?E(A):g.protectedKeys[A]=!0)}g.prevProp=y,g.prevResolvedValues=P,g.isActive&&(p={...p,...P}),r&&e.blockInitialAnimation&&(k=!1),k&&!x&&f.push(...T.map(A=>({animation:A,options:{type:v,...l}})))}if(h.size){const b={};h.forEach(v=>{const g=e.getBaseTarget(v);g!==void 0&&(b[v]=g)}),f.push({animation:b})}let _=!!f.length;return r&&c.initial===!1&&!e.manuallyAnimateOnMount&&(_=!1),r=!1,_?t(f):Promise.resolve()}function s(l,u,c){var d;if(n[l].isActive===u)return Promise.resolve();(d=e.variantChildren)===null||d===void 0||d.forEach(h=>{var p;return(p=h.animationState)===null||p===void 0?void 0:p.setActive(l,u)}),n[l].isActive=u;const f=a(c,l);for(const h in n)n[h].protectedKeys={};return f}return{animateChanges:a,setActive:s,setAnimateFunction:o,getState:()=>n}}function zNe(e,t){return typeof t=="string"?t!==e:Array.isArray(t)?!jH(t,e):!1}function Bc(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function jNe(){return{animate:Bc(!0),whileInView:Bc(),whileHover:Bc(),whileTap:Bc(),whileDrag:Bc(),whileFocus:Bc(),exit:Bc()}}class UNe extends Oc{constructor(t){super(t),t.animationState||(t.animationState=BNe(t))}updateAnimationControlsSubscription(){const{animate:t}=this.node.getProps();this.unmount(),uw(t)&&(this.unmount=t.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:t}=this.node.getProps(),{animate:n}=this.node.prevProps||{};t!==n&&this.updateAnimationControlsSubscription()}unmount(){}}let VNe=0;class GNe extends Oc{constructor(){super(...arguments),this.id=VNe++}update(){if(!this.node.presenceContext)return;const{isPresent:t,onExitComplete:n,custom:r}=this.node.presenceContext,{isPresent:i}=this.node.prevPresenceContext||{};if(!this.node.animationState||t===i)return;const o=this.node.animationState.setActive("exit",!t,{custom:r??this.node.getProps().custom});n&&!t&&o.then(()=>n(this.id))}mount(){const{register:t}=this.node.presenceContext||{};t&&(this.unmount=t(this.id))}unmount(){}}const qNe={animation:{Feature:UNe},exit:{Feature:GNe}},g7=(e,t)=>Math.abs(e-t);function HNe(e,t){const n=g7(e.x,t.x),r=g7(e.y,t.y);return Math.sqrt(n**2+r**2)}class _W{constructor(t,n,{transformPagePoint:r}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const u=M5(this.lastMoveEventInfo,this.history),c=this.startEvent!==null,d=HNe(u.offset,{x:0,y:0})>=3;if(!c&&!d)return;const{point:f}=u,{timestamp:h}=ji;this.history.push({...f,timestamp:h});const{onStart:p,onMove:m}=this.handlers;c||(p&&p(this.lastMoveEvent,u),this.startEvent=this.lastMoveEvent),m&&m(this.lastMoveEvent,u)},this.handlePointerMove=(u,c)=>{this.lastMoveEvent=u,this.lastMoveEventInfo=O5(c,this.transformPagePoint),$n.update(this.updatePoint,!0)},this.handlePointerUp=(u,c)=>{if(this.end(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const{onEnd:d,onSessionEnd:f}=this.handlers,h=M5(u.type==="pointercancel"?this.lastMoveEventInfo:O5(c,this.transformPagePoint),this.history);this.startEvent&&d&&d(u,h),f&&f(u,h)},!DH(t))return;this.handlers=n,this.transformPagePoint=r;const i=fw(t),o=O5(i,this.transformPagePoint),{point:a}=o,{timestamp:s}=ji;this.history=[{...a,timestamp:s}];const{onSessionStart:l}=n;l&&l(t,M5(o,this.history)),this.removeListeners=Zu(Ll(window,"pointermove",this.handlePointerMove),Ll(window,"pointerup",this.handlePointerUp),Ll(window,"pointercancel",this.handlePointerUp))}updateHandlers(t){this.handlers=t}end(){this.removeListeners&&this.removeListeners(),Ql(this.updatePoint)}}function O5(e,t){return t?{point:t(e.point)}:e}function m7(e,t){return{x:e.x-t.x,y:e.y-t.y}}function M5({point:e},t){return{point:e,delta:m7(e,SW(t)),offset:m7(e,WNe(t)),velocity:KNe(t,.1)}}function WNe(e){return e[0]}function SW(e){return e[e.length-1]}function KNe(e,t){if(e.length<2)return{x:0,y:0};let n=e.length-1,r=null;const i=SW(e);for(;n>=0&&(r=e[n],!(i.timestamp-r.timestamp>Ju(t)));)n--;if(!r)return{x:0,y:0};const o=Fl(i.timestamp-r.timestamp);if(o===0)return{x:0,y:0};const a={x:(i.x-r.x)/o,y:(i.y-r.y)/o};return a.x===1/0&&(a.x=0),a.y===1/0&&(a.y=0),a}function Jo(e){return e.max-e.min}function ET(e,t=0,n=.01){return Math.abs(e-t)<=n}function y7(e,t,n,r=.5){e.origin=r,e.originPoint=lr(t.min,t.max,e.origin),e.scale=Jo(n)/Jo(t),(ET(e.scale,1,1e-4)||isNaN(e.scale))&&(e.scale=1),e.translate=lr(n.min,n.max,e.origin)-e.originPoint,(ET(e.translate)||isNaN(e.translate))&&(e.translate=0)}function im(e,t,n,r){y7(e.x,t.x,n.x,r?r.originX:void 0),y7(e.y,t.y,n.y,r?r.originY:void 0)}function v7(e,t,n){e.min=n.min+t.min,e.max=e.min+Jo(t)}function QNe(e,t,n){v7(e.x,t.x,n.x),v7(e.y,t.y,n.y)}function b7(e,t,n){e.min=t.min-n.min,e.max=e.min+Jo(t)}function om(e,t,n){b7(e.x,t.x,n.x),b7(e.y,t.y,n.y)}function XNe(e,{min:t,max:n},r){return t!==void 0&&en&&(e=r?lr(n,e,r.max):Math.min(e,n)),e}function _7(e,t,n){return{min:t!==void 0?e.min+t:void 0,max:n!==void 0?e.max+n-(e.max-e.min):void 0}}function YNe(e,{top:t,left:n,bottom:r,right:i}){return{x:_7(e.x,n,i),y:_7(e.y,t,r)}}function S7(e,t){let n=t.min-e.min,r=t.max-e.max;return t.max-t.minr?n=O0(t.min,t.max-r,e.min):r>i&&(n=O0(e.min,e.max-i,t.min)),pc(0,1,n)}function e$e(e,t){const n={};return t.min!==void 0&&(n.min=t.min-e.min),t.max!==void 0&&(n.max=t.max-e.min),n}const TT=.35;function t$e(e=TT){return e===!1?e=0:e===!0&&(e=TT),{x:x7(e,"left","right"),y:x7(e,"top","bottom")}}function x7(e,t,n){return{min:w7(e,t),max:w7(e,n)}}function w7(e,t){return typeof e=="number"?e:e[t]||0}const C7=()=>({translate:0,scale:1,origin:0,originPoint:0}),Xf=()=>({x:C7(),y:C7()}),E7=()=>({min:0,max:0}),Nr=()=>({x:E7(),y:E7()});function xs(e){return[e("x"),e("y")]}function xW({top:e,left:t,right:n,bottom:r}){return{x:{min:t,max:n},y:{min:e,max:r}}}function n$e({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}function r$e(e,t){if(!t)return e;const n=t({x:e.left,y:e.top}),r=t({x:e.right,y:e.bottom});return{top:n.y,left:n.x,bottom:r.y,right:r.x}}function N5(e){return e===void 0||e===1}function kT({scale:e,scaleX:t,scaleY:n}){return!N5(e)||!N5(t)||!N5(n)}function qc(e){return kT(e)||wW(e)||e.z||e.rotate||e.rotateX||e.rotateY}function wW(e){return T7(e.x)||T7(e.y)}function T7(e){return e&&e!=="0%"}function rS(e,t,n){const r=e-n,i=t*r;return n+i}function k7(e,t,n,r,i){return i!==void 0&&(e=rS(e,i,r)),rS(e,n,r)+t}function AT(e,t=0,n=1,r,i){e.min=k7(e.min,t,n,r,i),e.max=k7(e.max,t,n,r,i)}function CW(e,{x:t,y:n}){AT(e.x,t.translate,t.scale,t.originPoint),AT(e.y,n.translate,n.scale,n.originPoint)}function i$e(e,t,n,r=!1){const i=n.length;if(!i)return;t.x=t.y=1;let o,a;for(let s=0;s1.0000000000001||e<.999999999999?e:1}function Su(e,t){e.min=e.min+t,e.max=e.max+t}function P7(e,t,[n,r,i]){const o=t[i]!==void 0?t[i]:.5,a=lr(e.min,e.max,o);AT(e,t[n],t[r],a,t.scale)}const o$e=["x","scaleX","originX"],a$e=["y","scaleY","originY"];function Yf(e,t){P7(e.x,t,o$e),P7(e.y,t,a$e)}function EW(e,t){return xW(r$e(e.getBoundingClientRect(),t))}function s$e(e,t,n){const r=EW(e,n),{scroll:i}=t;return i&&(Su(r.x,i.offset.x),Su(r.y,i.offset.y)),r}const l$e=new WeakMap;class u$e{constructor(t){this.openGlobalLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=Nr(),this.visualElement=t}start(t,{snapToCursor:n=!1}={}){const{presenceContext:r}=this.visualElement;if(r&&r.isPresent===!1)return;const i=l=>{this.stopAnimation(),n&&this.snapToCursor(fw(l,"page").point)},o=(l,u)=>{const{drag:c,dragPropagation:d,onDragStart:f}=this.getProps();if(c&&!d&&(this.openGlobalLock&&this.openGlobalLock(),this.openGlobalLock=FH(c),!this.openGlobalLock))return;this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),xs(p=>{let m=this.getAxisMotionValue(p).get()||0;if(Ks.test(m)){const{projection:_}=this.visualElement;if(_&&_.layout){const b=_.layout.layoutBox[p];b&&(m=Jo(b)*(parseFloat(m)/100))}}this.originPoint[p]=m}),f&&$n.update(()=>f(l,u),!1,!0);const{animationState:h}=this.visualElement;h&&h.setActive("whileDrag",!0)},a=(l,u)=>{const{dragPropagation:c,dragDirectionLock:d,onDirectionLock:f,onDrag:h}=this.getProps();if(!c&&!this.openGlobalLock)return;const{offset:p}=u;if(d&&this.currentDirection===null){this.currentDirection=c$e(p),this.currentDirection!==null&&f&&f(this.currentDirection);return}this.updateAxis("x",u.point,p),this.updateAxis("y",u.point,p),this.visualElement.render(),h&&h(l,u)},s=(l,u)=>this.stop(l,u);this.panSession=new _W(t,{onSessionStart:i,onStart:o,onMove:a,onSessionEnd:s},{transformPagePoint:this.visualElement.getTransformPagePoint()})}stop(t,n){const r=this.isDragging;if(this.cancel(),!r)return;const{velocity:i}=n;this.startAnimation(i);const{onDragEnd:o}=this.getProps();o&&$n.update(()=>o(t,n))}cancel(){this.isDragging=!1;const{projection:t,animationState:n}=this.visualElement;t&&(t.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;const{dragPropagation:r}=this.getProps();!r&&this.openGlobalLock&&(this.openGlobalLock(),this.openGlobalLock=null),n&&n.setActive("whileDrag",!1)}updateAxis(t,n,r){const{drag:i}=this.getProps();if(!r||!i1(t,i,this.currentDirection))return;const o=this.getAxisMotionValue(t);let a=this.originPoint[t]+r[t];this.constraints&&this.constraints[t]&&(a=XNe(a,this.constraints[t],this.elastic[t])),o.set(a)}resolveConstraints(){const{dragConstraints:t,dragElastic:n}=this.getProps(),{layout:r}=this.visualElement.projection||{},i=this.constraints;t&&Kf(t)?this.constraints||(this.constraints=this.resolveRefConstraints()):t&&r?this.constraints=YNe(r.layoutBox,t):this.constraints=!1,this.elastic=t$e(n),i!==this.constraints&&r&&this.constraints&&!this.hasMutatedConstraints&&xs(o=>{this.getAxisMotionValue(o)&&(this.constraints[o]=e$e(r.layoutBox[o],this.constraints[o]))})}resolveRefConstraints(){const{dragConstraints:t,onMeasureDragConstraints:n}=this.getProps();if(!t||!Kf(t))return!1;const r=t.current,{projection:i}=this.visualElement;if(!i||!i.layout)return!1;const o=s$e(r,i.root,this.visualElement.getTransformPagePoint());let a=ZNe(i.layout.layoutBox,o);if(n){const s=n(n$e(a));this.hasMutatedConstraints=!!s,s&&(a=xW(s))}return a}startAnimation(t){const{drag:n,dragMomentum:r,dragElastic:i,dragTransition:o,dragSnapToOrigin:a,onDragTransitionEnd:s}=this.getProps(),l=this.constraints||{},u=xs(c=>{if(!i1(c,n,this.currentDirection))return;let d=l&&l[c]||{};a&&(d={min:0,max:0});const f=i?200:1e6,h=i?40:1e7,p={type:"inertia",velocity:r?t[c]:0,bounceStiffness:f,bounceDamping:h,timeConstant:750,restDelta:1,restSpeed:10,...o,...d};return this.startAxisValueAnimation(c,p)});return Promise.all(u).then(s)}startAxisValueAnimation(t,n){const r=this.getAxisMotionValue(t);return r.start(yP(t,r,0,n))}stopAnimation(){xs(t=>this.getAxisMotionValue(t).stop())}getAxisMotionValue(t){const n="_drag"+t.toUpperCase(),r=this.visualElement.getProps(),i=r[n];return i||this.visualElement.getValue(t,(r.initial?r.initial[t]:void 0)||0)}snapToCursor(t){xs(n=>{const{drag:r}=this.getProps();if(!i1(n,r,this.currentDirection))return;const{projection:i}=this.visualElement,o=this.getAxisMotionValue(n);if(i&&i.layout){const{min:a,max:s}=i.layout.layoutBox[n];o.set(t[n]-lr(a,s,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:t,dragConstraints:n}=this.getProps(),{projection:r}=this.visualElement;if(!Kf(n)||!r||!this.constraints)return;this.stopAnimation();const i={x:0,y:0};xs(a=>{const s=this.getAxisMotionValue(a);if(s){const l=s.get();i[a]=JNe({min:l,max:l},this.constraints[a])}});const{transformTemplate:o}=this.visualElement.getProps();this.visualElement.current.style.transform=o?o({},""):"none",r.root&&r.root.updateScroll(),r.updateLayout(),this.resolveConstraints(),xs(a=>{if(!i1(a,t,null))return;const s=this.getAxisMotionValue(a),{min:l,max:u}=this.constraints[a];s.set(lr(l,u,i[a]))})}addListeners(){if(!this.visualElement.current)return;l$e.set(this.visualElement,this);const t=this.visualElement.current,n=Ll(t,"pointerdown",l=>{const{drag:u,dragListener:c=!0}=this.getProps();u&&c&&this.start(l)}),r=()=>{const{dragConstraints:l}=this.getProps();Kf(l)&&(this.constraints=this.resolveRefConstraints())},{projection:i}=this.visualElement,o=i.addEventListener("measure",r);i&&!i.layout&&(i.root&&i.root.updateScroll(),i.updateLayout()),r();const a=Ol(window,"resize",()=>this.scalePositionWithinConstraints()),s=i.addEventListener("didUpdate",({delta:l,hasLayoutChanged:u})=>{this.isDragging&&u&&(xs(c=>{const d=this.getAxisMotionValue(c);d&&(this.originPoint[c]+=l[c].translate,d.set(d.get()+l[c].translate))}),this.visualElement.render())});return()=>{a(),n(),o(),s&&s()}}getProps(){const t=this.visualElement.getProps(),{drag:n=!1,dragDirectionLock:r=!1,dragPropagation:i=!1,dragConstraints:o=!1,dragElastic:a=TT,dragMomentum:s=!0}=t;return{...t,drag:n,dragDirectionLock:r,dragPropagation:i,dragConstraints:o,dragElastic:a,dragMomentum:s}}}function i1(e,t,n){return(t===!0||t===e)&&(n===null||n===e)}function c$e(e,t=10){let n=null;return Math.abs(e.y)>t?n="y":Math.abs(e.x)>t&&(n="x"),n}class d$e extends Oc{constructor(t){super(t),this.removeGroupControls=yr,this.removeListeners=yr,this.controls=new u$e(t)}mount(){const{dragControls:t}=this.node.getProps();t&&(this.removeGroupControls=t.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||yr}unmount(){this.removeGroupControls(),this.removeListeners()}}const I7=e=>(t,n)=>{e&&$n.update(()=>e(t,n))};class f$e extends Oc{constructor(){super(...arguments),this.removePointerDownListener=yr}onPointerDown(t){this.session=new _W(t,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint()})}createPanHandlers(){const{onPanSessionStart:t,onPanStart:n,onPan:r,onPanEnd:i}=this.node.getProps();return{onSessionStart:I7(t),onStart:I7(n),onMove:r,onEnd:(o,a)=>{delete this.session,i&&$n.update(()=>i(o,a))}}}mount(){this.removePointerDownListener=Ll(this.node.current,"pointerdown",t=>this.onPointerDown(t))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}function h$e(){const e=I.useContext(My);if(e===null)return[!0,null];const{isPresent:t,onExitComplete:n,register:r}=e,i=I.useId();return I.useEffect(()=>r(i),[]),!t&&n?[!1,()=>n&&n(i)]:[!0]}function p$e(){return g$e(I.useContext(My))}function g$e(e){return e===null?!0:e.isPresent}const ob={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function R7(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}const cg={correct:(e,t)=>{if(!t.target)return e;if(typeof e=="string")if(at.test(e))e=parseFloat(e);else return e;const n=R7(e,t.target.x),r=R7(e,t.target.y);return`${n}% ${r}%`}},m$e={correct:(e,{treeScale:t,projectionDelta:n})=>{const r=e,i=gc.parse(e);if(i.length>5)return r;const o=gc.createTransformer(e),a=typeof i[0]!="number"?1:0,s=n.x.scale*t.x,l=n.y.scale*t.y;i[0+a]/=s,i[1+a]/=l;const u=lr(s,l,.5);return typeof i[2+a]=="number"&&(i[2+a]/=u),typeof i[3+a]=="number"&&(i[3+a]/=u),o(i)}};class y$e extends En.Component{componentDidMount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:r,layoutId:i}=this.props,{projection:o}=t;xMe(v$e),o&&(n.group&&n.group.add(o),r&&r.register&&i&&r.register(o),o.root.didUpdate(),o.addEventListener("animationComplete",()=>{this.safeToRemove()}),o.setOptions({...o.options,onExitComplete:()=>this.safeToRemove()})),ob.hasEverUpdated=!0}getSnapshotBeforeUpdate(t){const{layoutDependency:n,visualElement:r,drag:i,isPresent:o}=this.props,a=r.projection;return a&&(a.isPresent=o,i||t.layoutDependency!==n||n===void 0?a.willUpdate():this.safeToRemove(),t.isPresent!==o&&(o?a.promote():a.relegate()||$n.postRender(()=>{const s=a.getStack();(!s||!s.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:t}=this.props.visualElement;t&&(t.root.didUpdate(),queueMicrotask(()=>{!t.currentAnimation&&t.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:r}=this.props,{projection:i}=t;i&&(i.scheduleCheckAfterUnmount(),n&&n.group&&n.group.remove(i),r&&r.deregister&&r.deregister(i))}safeToRemove(){const{safeToRemove:t}=this.props;t&&t()}render(){return null}}function TW(e){const[t,n]=h$e(),r=I.useContext(rP);return En.createElement(y$e,{...e,layoutGroup:r,switchLayoutGroup:I.useContext(SH),isPresent:t,safeToRemove:n})}const v$e={borderRadius:{...cg,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:cg,borderTopRightRadius:cg,borderBottomLeftRadius:cg,borderBottomRightRadius:cg,boxShadow:m$e},kW=["TopLeft","TopRight","BottomLeft","BottomRight"],b$e=kW.length,O7=e=>typeof e=="string"?parseFloat(e):e,M7=e=>typeof e=="number"||at.test(e);function _$e(e,t,n,r,i,o){i?(e.opacity=lr(0,n.opacity!==void 0?n.opacity:1,S$e(r)),e.opacityExit=lr(t.opacity!==void 0?t.opacity:1,0,x$e(r))):o&&(e.opacity=lr(t.opacity!==void 0?t.opacity:1,n.opacity!==void 0?n.opacity:1,r));for(let a=0;art?1:n(O0(e,t,r))}function $7(e,t){e.min=t.min,e.max=t.max}function ua(e,t){$7(e.x,t.x),$7(e.y,t.y)}function D7(e,t,n,r,i){return e-=t,e=rS(e,1/n,r),i!==void 0&&(e=rS(e,1/i,r)),e}function w$e(e,t=0,n=1,r=.5,i,o=e,a=e){if(Ks.test(t)&&(t=parseFloat(t),t=lr(a.min,a.max,t/100)-a.min),typeof t!="number")return;let s=lr(o.min,o.max,r);e===o&&(s-=t),e.min=D7(e.min,t,n,s,i),e.max=D7(e.max,t,n,s,i)}function L7(e,t,[n,r,i],o,a){w$e(e,t[n],t[r],t[i],t.scale,o,a)}const C$e=["x","scaleX","originX"],E$e=["y","scaleY","originY"];function F7(e,t,n,r){L7(e.x,t,C$e,n?n.x:void 0,r?r.x:void 0),L7(e.y,t,E$e,n?n.y:void 0,r?r.y:void 0)}function B7(e){return e.translate===0&&e.scale===1}function PW(e){return B7(e.x)&&B7(e.y)}function T$e(e,t){return e.x.min===t.x.min&&e.x.max===t.x.max&&e.y.min===t.y.min&&e.y.max===t.y.max}function IW(e,t){return Math.round(e.x.min)===Math.round(t.x.min)&&Math.round(e.x.max)===Math.round(t.x.max)&&Math.round(e.y.min)===Math.round(t.y.min)&&Math.round(e.y.max)===Math.round(t.y.max)}function z7(e){return Jo(e.x)/Jo(e.y)}class k$e{constructor(){this.members=[]}add(t){vP(this.members,t),t.scheduleRender()}remove(t){if(bP(this.members,t),t===this.prevLead&&(this.prevLead=void 0),t===this.lead){const n=this.members[this.members.length-1];n&&this.promote(n)}}relegate(t){const n=this.members.findIndex(i=>t===i);if(n===0)return!1;let r;for(let i=n;i>=0;i--){const o=this.members[i];if(o.isPresent!==!1){r=o;break}}return r?(this.promote(r),!0):!1}promote(t,n){const r=this.lead;if(t!==r&&(this.prevLead=r,this.lead=t,t.show(),r)){r.instance&&r.scheduleRender(),t.scheduleRender(),t.resumeFrom=r,n&&(t.resumeFrom.preserveOpacity=!0),r.snapshot&&(t.snapshot=r.snapshot,t.snapshot.latestValues=r.animationValues||r.latestValues),t.root&&t.root.isUpdating&&(t.isLayoutDirty=!0);const{crossfade:i}=t.options;i===!1&&r.hide()}}exitAnimationComplete(){this.members.forEach(t=>{const{options:n,resumingFrom:r}=t;n.onExitComplete&&n.onExitComplete(),r&&r.options.onExitComplete&&r.options.onExitComplete()})}scheduleRender(){this.members.forEach(t=>{t.instance&&t.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}function j7(e,t,n){let r="";const i=e.x.translate/t.x,o=e.y.translate/t.y;if((i||o)&&(r=`translate3d(${i}px, ${o}px, 0) `),(t.x!==1||t.y!==1)&&(r+=`scale(${1/t.x}, ${1/t.y}) `),n){const{rotate:l,rotateX:u,rotateY:c}=n;l&&(r+=`rotate(${l}deg) `),u&&(r+=`rotateX(${u}deg) `),c&&(r+=`rotateY(${c}deg) `)}const a=e.x.scale*t.x,s=e.y.scale*t.y;return(a!==1||s!==1)&&(r+=`scale(${a}, ${s})`),r||"none"}const A$e=(e,t)=>e.depth-t.depth;class P$e{constructor(){this.children=[],this.isDirty=!1}add(t){vP(this.children,t),this.isDirty=!0}remove(t){bP(this.children,t),this.isDirty=!0}forEach(t){this.isDirty&&this.children.sort(A$e),this.isDirty=!1,this.children.forEach(t)}}function I$e(e,t){const n=performance.now(),r=({timestamp:i})=>{const o=i-n;o>=t&&(Ql(r),e(o-t))};return $n.read(r,!0),()=>Ql(r)}function R$e(e){window.MotionDebug&&window.MotionDebug.record(e)}function O$e(e){return e instanceof SVGElement&&e.tagName!=="svg"}function M$e(e,t,n){const r=Mo(e)?e:up(e);return r.start(yP("",r,t,n)),r.animation}const U7=["","X","Y","Z"],V7=1e3;let N$e=0;const Hc={type:"projectionFrame",totalNodes:0,resolvedTargetDeltas:0,recalculatedProjection:0};function RW({attachResizeListener:e,defaultParent:t,measureScroll:n,checkIsScrollRoot:r,resetTransform:i}){return class{constructor(a={},s=t==null?void 0:t()){this.id=N$e++,this.animationId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.updateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{Hc.totalNodes=Hc.resolvedTargetDeltas=Hc.recalculatedProjection=0,this.nodes.forEach(L$e),this.nodes.forEach(U$e),this.nodes.forEach(V$e),this.nodes.forEach(F$e),R$e(Hc)},this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=a,this.root=s?s.root||s:this,this.path=s?[...s.path,s]:[],this.parent=s,this.depth=s?s.depth+1:0;for(let l=0;lthis.root.updateBlockedByResize=!1;e(a,()=>{this.root.updateBlockedByResize=!0,d&&d(),d=I$e(f,250),ob.hasAnimatedSinceResize&&(ob.hasAnimatedSinceResize=!1,this.nodes.forEach(q7))})}l&&this.root.registerSharedNode(l,this),this.options.animate!==!1&&c&&(l||u)&&this.addEventListener("didUpdate",({delta:d,hasLayoutChanged:f,hasRelativeTargetChanged:h,layout:p})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const m=this.options.transition||c.getDefaultTransition()||K$e,{onLayoutAnimationStart:_,onLayoutAnimationComplete:b}=c.getProps(),v=!this.targetLayout||!IW(this.targetLayout,p)||h,g=!f&&h;if(this.options.layoutRoot||this.resumeFrom&&this.resumeFrom.instance||g||f&&(v||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0),this.setAnimationOrigin(d,g);const y={...gW(m,"layout"),onPlay:_,onComplete:b};(c.shouldReduceMotion||this.options.layoutRoot)&&(y.delay=0,y.type=!1),this.startAnimation(y)}else f||q7(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=p})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const a=this.getStack();a&&a.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,Ql(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(G$e),this.animationId++)}getTransformTemplate(){const{visualElement:a}=this.options;return a&&a.getProps().transformTemplate}willUpdate(a=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let c=0;cthis.update()))}clearAllSnapshots(){this.nodes.forEach(B$e),this.sharedNodes.forEach(q$e)}scheduleUpdateProjection(){$n.preRender(this.updateProjection,!1,!0)}scheduleCheckAfterUnmount(){$n.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure())}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let l=0;l{const S=y/1e3;H7(d.x,a.x,S),H7(d.y,a.y,S),this.setTargetDelta(d),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(om(f,this.layout.layoutBox,this.relativeParent.layout.layoutBox),H$e(this.relativeTarget,this.relativeTargetOrigin,f,S),g&&T$e(this.relativeTarget,g)&&(this.isProjectionDirty=!1),g||(g=Nr()),ua(g,this.relativeTarget)),m&&(this.animationValues=c,_$e(c,u,this.latestValues,S,v,b)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=S},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(a){this.notifyListeners("animationStart"),this.currentAnimation&&this.currentAnimation.stop(),this.resumingFrom&&this.resumingFrom.currentAnimation&&this.resumingFrom.currentAnimation.stop(),this.pendingAnimation&&(Ql(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=$n.update(()=>{ob.hasAnimatedSinceResize=!0,this.currentAnimation=M$e(0,V7,{...a,onUpdate:s=>{this.mixTargetDelta(s),a.onUpdate&&a.onUpdate(s)},onComplete:()=>{a.onComplete&&a.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const a=this.getStack();a&&a.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(V7),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const a=this.getLead();let{targetWithTransforms:s,target:l,layout:u,latestValues:c}=a;if(!(!s||!l||!u)){if(this!==a&&this.layout&&u&&OW(this.options.animationType,this.layout.layoutBox,u.layoutBox)){l=this.target||Nr();const d=Jo(this.layout.layoutBox.x);l.x.min=a.target.x.min,l.x.max=l.x.min+d;const f=Jo(this.layout.layoutBox.y);l.y.min=a.target.y.min,l.y.max=l.y.min+f}ua(s,l),Yf(s,c),im(this.projectionDeltaWithTransform,this.layoutCorrected,s,c)}}registerSharedNode(a,s){this.sharedNodes.has(a)||this.sharedNodes.set(a,new k$e),this.sharedNodes.get(a).add(s);const u=s.options.initialPromotionConfig;s.promote({transition:u?u.transition:void 0,preserveFollowOpacity:u&&u.shouldPreserveFollowOpacity?u.shouldPreserveFollowOpacity(s):void 0})}isLead(){const a=this.getStack();return a?a.lead===this:!0}getLead(){var a;const{layoutId:s}=this.options;return s?((a=this.getStack())===null||a===void 0?void 0:a.lead)||this:this}getPrevLead(){var a;const{layoutId:s}=this.options;return s?(a=this.getStack())===null||a===void 0?void 0:a.prevLead:void 0}getStack(){const{layoutId:a}=this.options;if(a)return this.root.sharedNodes.get(a)}promote({needsReset:a,transition:s,preserveFollowOpacity:l}={}){const u=this.getStack();u&&u.promote(this,l),a&&(this.projectionDelta=void 0,this.needsReset=!0),s&&this.setOptions({transition:s})}relegate(){const a=this.getStack();return a?a.relegate(this):!1}resetRotation(){const{visualElement:a}=this.options;if(!a)return;let s=!1;const{latestValues:l}=a;if((l.rotate||l.rotateX||l.rotateY||l.rotateZ)&&(s=!0),!s)return;const u={};for(let c=0;c{var s;return(s=a.currentAnimation)===null||s===void 0?void 0:s.stop()}),this.root.nodes.forEach(G7),this.root.sharedNodes.clear()}}}function $$e(e){e.updateLayout()}function D$e(e){var t;const n=((t=e.resumeFrom)===null||t===void 0?void 0:t.snapshot)||e.snapshot;if(e.isLead()&&e.layout&&n&&e.hasListeners("didUpdate")){const{layoutBox:r,measuredBox:i}=e.layout,{animationType:o}=e.options,a=n.source!==e.layout.source;o==="size"?xs(d=>{const f=a?n.measuredBox[d]:n.layoutBox[d],h=Jo(f);f.min=r[d].min,f.max=f.min+h}):OW(o,n.layoutBox,r)&&xs(d=>{const f=a?n.measuredBox[d]:n.layoutBox[d],h=Jo(r[d]);f.max=f.min+h,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[d].max=e.relativeTarget[d].min+h)});const s=Xf();im(s,r,n.layoutBox);const l=Xf();a?im(l,e.applyTransform(i,!0),n.measuredBox):im(l,r,n.layoutBox);const u=!PW(s);let c=!1;if(!e.resumeFrom){const d=e.getClosestProjectingParent();if(d&&!d.resumeFrom){const{snapshot:f,layout:h}=d;if(f&&h){const p=Nr();om(p,n.layoutBox,f.layoutBox);const m=Nr();om(m,r,h.layoutBox),IW(p,m)||(c=!0),d.options.layoutRoot&&(e.relativeTarget=m,e.relativeTargetOrigin=p,e.relativeParent=d)}}}e.notifyListeners("didUpdate",{layout:r,snapshot:n,delta:l,layoutDelta:s,hasLayoutChanged:u,hasRelativeTargetChanged:c})}else if(e.isLead()){const{onExitComplete:r}=e.options;r&&r()}e.options.transition=void 0}function L$e(e){Hc.totalNodes++,e.parent&&(e.isProjecting()||(e.isProjectionDirty=e.parent.isProjectionDirty),e.isSharedProjectionDirty||(e.isSharedProjectionDirty=!!(e.isProjectionDirty||e.parent.isProjectionDirty||e.parent.isSharedProjectionDirty)),e.isTransformDirty||(e.isTransformDirty=e.parent.isTransformDirty))}function F$e(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function B$e(e){e.clearSnapshot()}function G7(e){e.clearMeasurements()}function z$e(e){e.isLayoutDirty=!1}function j$e(e){const{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify("BeforeLayoutMeasure"),e.resetTransform()}function q7(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function U$e(e){e.resolveTargetDelta()}function V$e(e){e.calcProjection()}function G$e(e){e.resetRotation()}function q$e(e){e.removeLeadSnapshot()}function H7(e,t,n){e.translate=lr(t.translate,0,n),e.scale=lr(t.scale,1,n),e.origin=t.origin,e.originPoint=t.originPoint}function W7(e,t,n,r){e.min=lr(t.min,n.min,r),e.max=lr(t.max,n.max,r)}function H$e(e,t,n,r){W7(e.x,t.x,n.x,r),W7(e.y,t.y,n.y,r)}function W$e(e){return e.animationValues&&e.animationValues.opacityExit!==void 0}const K$e={duration:.45,ease:[.4,0,.1,1]},K7=e=>typeof navigator<"u"&&navigator.userAgent.toLowerCase().includes(e),Q7=K7("applewebkit/")&&!K7("chrome/")?Math.round:yr;function X7(e){e.min=Q7(e.min),e.max=Q7(e.max)}function Q$e(e){X7(e.x),X7(e.y)}function OW(e,t,n){return e==="position"||e==="preserve-aspect"&&!ET(z7(t),z7(n),.2)}const X$e=RW({attachResizeListener:(e,t)=>Ol(e,"resize",t),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),$5={current:void 0},MW=RW({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!$5.current){const e=new X$e({});e.mount(window),e.setOptions({layoutScroll:!0}),$5.current=e}return $5.current},resetTransform:(e,t)=>{e.style.transform=t!==void 0?t:"none"},checkIsScrollRoot:e=>window.getComputedStyle(e).position==="fixed"}),Y$e={pan:{Feature:f$e},drag:{Feature:d$e,ProjectionNode:MW,MeasureLayout:TW}},Z$e=/var\((--[a-zA-Z0-9-_]+),? ?([a-zA-Z0-9 ()%#.,-]+)?\)/;function J$e(e){const t=Z$e.exec(e);if(!t)return[,];const[,n,r]=t;return[n,r]}function PT(e,t,n=1){const[r,i]=J$e(e);if(!r)return;const o=window.getComputedStyle(t).getPropertyValue(r);if(o){const a=o.trim();return mW(a)?parseFloat(a):a}else return vT(i)?PT(i,t,n+1):i}function eDe(e,{...t},n){const r=e.current;if(!(r instanceof Element))return{target:t,transitionEnd:n};n&&(n={...n}),e.values.forEach(i=>{const o=i.get();if(!vT(o))return;const a=PT(o,r);a&&i.set(a)});for(const i in t){const o=t[i];if(!vT(o))continue;const a=PT(o,r);a&&(t[i]=a,n||(n={}),n[i]===void 0&&(n[i]=o))}return{target:t,transitionEnd:n}}const tDe=new Set(["width","height","top","left","right","bottom","x","y","translateX","translateY"]),NW=e=>tDe.has(e),nDe=e=>Object.keys(e).some(NW),Y7=e=>e===ef||e===at,Z7=(e,t)=>parseFloat(e.split(", ")[t]),J7=(e,t)=>(n,{transform:r})=>{if(r==="none"||!r)return 0;const i=r.match(/^matrix3d\((.+)\)$/);if(i)return Z7(i[1],t);{const o=r.match(/^matrix\((.+)\)$/);return o?Z7(o[1],e):0}},rDe=new Set(["x","y","z"]),iDe=Ny.filter(e=>!rDe.has(e));function oDe(e){const t=[];return iDe.forEach(n=>{const r=e.getValue(n);r!==void 0&&(t.push([n,r.get()]),r.set(n.startsWith("scale")?1:0))}),t.length&&e.render(),t}const cp={width:({x:e},{paddingLeft:t="0",paddingRight:n="0"})=>e.max-e.min-parseFloat(t)-parseFloat(n),height:({y:e},{paddingTop:t="0",paddingBottom:n="0"})=>e.max-e.min-parseFloat(t)-parseFloat(n),top:(e,{top:t})=>parseFloat(t),left:(e,{left:t})=>parseFloat(t),bottom:({y:e},{top:t})=>parseFloat(t)+(e.max-e.min),right:({x:e},{left:t})=>parseFloat(t)+(e.max-e.min),x:J7(4,13),y:J7(5,14)};cp.translateX=cp.x;cp.translateY=cp.y;const aDe=(e,t,n)=>{const r=t.measureViewportBox(),i=t.current,o=getComputedStyle(i),{display:a}=o,s={};a==="none"&&t.setStaticValue("display",e.display||"block"),n.forEach(u=>{s[u]=cp[u](r,o)}),t.render();const l=t.measureViewportBox();return n.forEach(u=>{const c=t.getValue(u);c&&c.jump(s[u]),e[u]=cp[u](l,o)}),e},sDe=(e,t,n={},r={})=>{t={...t},r={...r};const i=Object.keys(t).filter(NW);let o=[],a=!1;const s=[];if(i.forEach(l=>{const u=e.getValue(l);if(!e.hasValue(l))return;let c=n[l],d=ug(c);const f=t[l];let h;if(Z_(f)){const p=f.length,m=f[0]===null?1:0;c=f[m],d=ug(c);for(let _=m;_=0?window.pageYOffset:null,u=aDe(t,e,s);return o.length&&o.forEach(([c,d])=>{e.getValue(c).set(d)}),e.render(),lw&&l!==null&&window.scrollTo({top:l}),{target:u,transitionEnd:r}}else return{target:t,transitionEnd:r}};function lDe(e,t,n,r){return nDe(t)?sDe(e,t,n,r):{target:t,transitionEnd:r}}const uDe=(e,t,n,r)=>{const i=eDe(e,t,r);return t=i.target,r=i.transitionEnd,lDe(e,t,n,r)},IT={current:null},$W={current:!1};function cDe(){if($W.current=!0,!!lw)if(window.matchMedia){const e=window.matchMedia("(prefers-reduced-motion)"),t=()=>IT.current=e.matches;e.addListener(t),t()}else IT.current=!1}function dDe(e,t,n){const{willChange:r}=t;for(const i in t){const o=t[i],a=n[i];if(Mo(o))e.addValue(i,o),nS(r)&&r.add(i);else if(Mo(a))e.addValue(i,up(o,{owner:e})),nS(r)&&r.remove(i);else if(a!==o)if(e.hasValue(i)){const s=e.getValue(i);!s.hasAnimated&&s.set(o)}else{const s=e.getStaticValue(i);e.addValue(i,up(s!==void 0?s:o,{owner:e}))}}for(const i in n)t[i]===void 0&&e.removeValue(i);return t}const eN=new WeakMap,DW=Object.keys(R0),fDe=DW.length,tN=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"],hDe=nP.length;class pDe{constructor({parent:t,props:n,presenceContext:r,reducedMotionConfig:i,visualState:o},a={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.scheduleRender=()=>$n.render(this.render,!1,!0);const{latestValues:s,renderState:l}=o;this.latestValues=s,this.baseTarget={...s},this.initialValues=n.initial?{...s}:{},this.renderState=l,this.parent=t,this.props=n,this.presenceContext=r,this.depth=t?t.depth+1:0,this.reducedMotionConfig=i,this.options=a,this.isControllingVariants=cw(n),this.isVariantNode=_H(n),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(t&&t.current);const{willChange:u,...c}=this.scrapeMotionValuesFromProps(n,{});for(const d in c){const f=c[d];s[d]!==void 0&&Mo(f)&&(f.set(s[d],!1),nS(u)&&u.add(d))}}scrapeMotionValuesFromProps(t,n){return{}}mount(t){this.current=t,eN.set(t,this),this.projection&&!this.projection.instance&&this.projection.mount(t),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((n,r)=>this.bindToMotionValue(r,n)),$W.current||cDe(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:IT.current,this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){eN.delete(this.current),this.projection&&this.projection.unmount(),Ql(this.notifyUpdate),Ql(this.render),this.valueSubscriptions.forEach(t=>t()),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent&&this.parent.children.delete(this);for(const t in this.events)this.events[t].clear();for(const t in this.features)this.features[t].unmount();this.current=null}bindToMotionValue(t,n){const r=Jd.has(t),i=n.on("change",a=>{this.latestValues[t]=a,this.props.onUpdate&&$n.update(this.notifyUpdate,!1,!0),r&&this.projection&&(this.projection.isTransformDirty=!0)}),o=n.on("renderRequest",this.scheduleRender);this.valueSubscriptions.set(t,()=>{i(),o()})}sortNodePosition(t){return!this.current||!this.sortInstanceNodePosition||this.type!==t.type?0:this.sortInstanceNodePosition(this.current,t.current)}loadFeatures({children:t,...n},r,i,o){let a,s;for(let l=0;lthis.scheduleRender(),animationType:typeof u=="string"?u:"both",initialPromotionConfig:o,layoutScroll:f,layoutRoot:h})}return s}updateFeatures(){for(const t in this.features){const n=this.features[t];n.isMounted?n.update():(n.mount(),n.isMounted=!0)}}triggerBuild(){this.build(this.renderState,this.latestValues,this.options,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):Nr()}getStaticValue(t){return this.latestValues[t]}setStaticValue(t,n){this.latestValues[t]=n}makeTargetAnimatable(t,n=!0){return this.makeTargetAnimatableFromInstance(t,this.props,n)}update(t,n){(t.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=t,this.prevPresenceContext=this.presenceContext,this.presenceContext=n;for(let r=0;rn.variantChildren.delete(t)}addValue(t,n){n!==this.values.get(t)&&(this.removeValue(t),this.bindToMotionValue(t,n)),this.values.set(t,n),this.latestValues[t]=n.get()}removeValue(t){this.values.delete(t);const n=this.valueSubscriptions.get(t);n&&(n(),this.valueSubscriptions.delete(t)),delete this.latestValues[t],this.removeValueFromRenderState(t,this.renderState)}hasValue(t){return this.values.has(t)}getValue(t,n){if(this.props.values&&this.props.values[t])return this.props.values[t];let r=this.values.get(t);return r===void 0&&n!==void 0&&(r=up(n,{owner:this}),this.addValue(t,r)),r}readValue(t){var n;return this.latestValues[t]!==void 0||!this.current?this.latestValues[t]:(n=this.getBaseTargetFromProps(this.props,t))!==null&&n!==void 0?n:this.readValueFromInstance(this.current,t,this.options)}setBaseTarget(t,n){this.baseTarget[t]=n}getBaseTarget(t){var n;const{initial:r}=this.props,i=typeof r=="string"||typeof r=="object"?(n=dP(this.props,r))===null||n===void 0?void 0:n[t]:void 0;if(r&&i!==void 0)return i;const o=this.getBaseTargetFromProps(this.props,t);return o!==void 0&&!Mo(o)?o:this.initialValues[t]!==void 0&&i===void 0?void 0:this.baseTarget[t]}on(t,n){return this.events[t]||(this.events[t]=new _P),this.events[t].add(n)}notify(t,...n){this.events[t]&&this.events[t].notify(...n)}}class LW extends pDe{sortInstanceNodePosition(t,n){return t.compareDocumentPosition(n)&2?1:-1}getBaseTargetFromProps(t,n){return t.style?t.style[n]:void 0}removeValueFromRenderState(t,{vars:n,style:r}){delete n[t],delete r[t]}makeTargetAnimatableFromInstance({transition:t,transitionEnd:n,...r},{transformValues:i},o){let a=RNe(r,t||{},this);if(i&&(n&&(n=i(n)),r&&(r=i(r)),a&&(a=i(a))),o){PNe(this,r,a);const s=uDe(this,r,a,n);n=s.transitionEnd,r=s.target}return{transition:t,transitionEnd:n,...r}}}function gDe(e){return window.getComputedStyle(e)}class mDe extends LW{readValueFromInstance(t,n){if(Jd.has(n)){const r=mP(n);return r&&r.default||0}else{const r=gDe(t),i=(CH(n)?r.getPropertyValue(n):r[n])||0;return typeof i=="string"?i.trim():i}}measureInstanceViewportBox(t,{transformPagePoint:n}){return EW(t,n)}build(t,n,r,i){oP(t,n,r,i.transformTemplate)}scrapeMotionValuesFromProps(t,n){return cP(t,n)}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:t}=this.props;Mo(t)&&(this.childSubscription=t.on("change",n=>{this.current&&(this.current.textContent=`${n}`)}))}renderInstance(t,n,r,i){IH(t,n,r,i)}}class yDe extends LW{constructor(){super(...arguments),this.isSVGTag=!1}getBaseTargetFromProps(t,n){return t[n]}readValueFromInstance(t,n){if(Jd.has(n)){const r=mP(n);return r&&r.default||0}return n=RH.has(n)?n:uP(n),t.getAttribute(n)}measureInstanceViewportBox(){return Nr()}scrapeMotionValuesFromProps(t,n){return MH(t,n)}build(t,n,r,i){sP(t,n,r,this.isSVGTag,i.transformTemplate)}renderInstance(t,n,r,i){OH(t,n,r,i)}mount(t){this.isSVGTag=lP(t.tagName),super.mount(t)}}const vDe=(e,t)=>iP(e)?new yDe(t,{enableHardwareAcceleration:!1}):new mDe(t,{enableHardwareAcceleration:!0}),bDe={layout:{ProjectionNode:MW,MeasureLayout:TW}},_De={...qNe,...d7e,...Y$e,...bDe},FW=_Me((e,t)=>ZMe(e,t,_De,vDe));function BW(){const e=I.useRef(!1);return eP(()=>(e.current=!0,()=>{e.current=!1}),[]),e}function SDe(){const e=BW(),[t,n]=I.useState(0),r=I.useCallback(()=>{e.current&&n(t+1)},[t]);return[I.useCallback(()=>$n.postRender(r),[r]),t]}class xDe extends I.Component{getSnapshotBeforeUpdate(t){const n=this.props.childRef.current;if(n&&t.isPresent&&!this.props.isPresent){const r=this.props.sizeRef.current;r.height=n.offsetHeight||0,r.width=n.offsetWidth||0,r.top=n.offsetTop,r.left=n.offsetLeft}return null}componentDidUpdate(){}render(){return this.props.children}}function wDe({children:e,isPresent:t}){const n=I.useId(),r=I.useRef(null),i=I.useRef({width:0,height:0,top:0,left:0});return I.useInsertionEffect(()=>{const{width:o,height:a,top:s,left:l}=i.current;if(t||!r.current||!o||!a)return;r.current.dataset.motionPopId=n;const u=document.createElement("style");return document.head.appendChild(u),u.sheet&&u.sheet.insertRule(` + [data-motion-pop-id="${n}"] { + position: absolute !important; + width: ${o}px !important; + height: ${a}px !important; + top: ${s}px !important; + left: ${l}px !important; + } + `),()=>{document.head.removeChild(u)}},[t]),I.createElement(xDe,{isPresent:t,childRef:r,sizeRef:i},I.cloneElement(e,{ref:r}))}const D5=({children:e,initial:t,isPresent:n,onExitComplete:r,custom:i,presenceAffectsLayout:o,mode:a})=>{const s=NH(CDe),l=I.useId(),u=I.useMemo(()=>({id:l,initial:t,isPresent:n,custom:i,onExitComplete:c=>{s.set(c,!0);for(const d of s.values())if(!d)return;r&&r()},register:c=>(s.set(c,!1),()=>s.delete(c))}),o?void 0:[n]);return I.useMemo(()=>{s.forEach((c,d)=>s.set(d,!1))},[n]),I.useEffect(()=>{!n&&!s.size&&r&&r()},[n]),a==="popLayout"&&(e=I.createElement(wDe,{isPresent:n},e)),I.createElement(My.Provider,{value:u},e)};function CDe(){return new Map}function EDe(e){return I.useEffect(()=>()=>e(),[])}const Tf=e=>e.key||"";function TDe(e,t){e.forEach(n=>{const r=Tf(n);t.set(r,n)})}function kDe(e){const t=[];return I.Children.forEach(e,n=>{I.isValidElement(n)&&t.push(n)}),t}const zW=({children:e,custom:t,initial:n=!0,onExitComplete:r,exitBeforeEnter:i,presenceAffectsLayout:o=!0,mode:a="sync"})=>{const s=I.useContext(rP).forceRender||SDe()[0],l=BW(),u=kDe(e);let c=u;const d=I.useRef(new Map).current,f=I.useRef(c),h=I.useRef(new Map).current,p=I.useRef(!0);if(eP(()=>{p.current=!1,TDe(u,h),f.current=c}),EDe(()=>{p.current=!0,h.clear(),d.clear()}),p.current)return I.createElement(I.Fragment,null,c.map(v=>I.createElement(D5,{key:Tf(v),isPresent:!0,initial:n?void 0:!1,presenceAffectsLayout:o,mode:a},v)));c=[...c];const m=f.current.map(Tf),_=u.map(Tf),b=m.length;for(let v=0;v{if(_.indexOf(g)!==-1)return;const y=h.get(g);if(!y)return;const S=m.indexOf(g);let w=v;if(!w){const x=()=>{h.delete(g),d.delete(g);const C=f.current.findIndex(k=>k.key===g);if(f.current.splice(C,1),!d.size){if(f.current=u,l.current===!1)return;s(),r&&r()}};w=I.createElement(D5,{key:Tf(y),isPresent:!1,onExitComplete:x,custom:t,presenceAffectsLayout:o,mode:a},y),d.set(g,w)}c.splice(S,0,w)}),c=c.map(v=>{const g=v.key;return d.has(g)?v:I.createElement(D5,{key:Tf(v),isPresent:!0,presenceAffectsLayout:o,mode:a},v)}),I.createElement(I.Fragment,null,d.size?c:c.map(v=>I.cloneElement(v)))};var ADe={initial:e=>{const{position:t}=e,n=["top","bottom"].includes(t)?"y":"x";let r=["top-right","bottom-right"].includes(t)?1:-1;return t==="bottom"&&(r=1),{opacity:0,[n]:r*24}},animate:{opacity:1,y:0,x:0,scale:1,transition:{duration:.4,ease:[.4,0,.2,1]}},exit:{opacity:0,scale:.85,transition:{duration:.2,ease:[.4,0,1,1]}}},jW=I.memo(e=>{const{id:t,message:n,onCloseComplete:r,onRequestRemove:i,requestClose:o=!1,position:a="bottom",duration:s=5e3,containerStyle:l,motionVariants:u=ADe,toastSpacing:c="0.5rem"}=e,[d,f]=I.useState(s),h=p$e();ZM(()=>{h||r==null||r()},[h]),ZM(()=>{f(s)},[s]);const p=()=>f(null),m=()=>f(s),_=()=>{h&&i()};I.useEffect(()=>{h&&o&&i()},[h,o,i]),dMe(_,d);const b=I.useMemo(()=>({pointerEvents:"auto",maxWidth:560,minWidth:300,margin:c,...l}),[l,c]),v=I.useMemo(()=>lMe(a),[a]);return W.jsx(FW.div,{layout:!0,className:"chakra-toast",variants:u,initial:"initial",animate:"animate",exit:"exit",onHoverStart:p,onHoverEnd:m,custom:{position:a},style:v,children:W.jsx(Oi.div,{role:"status","aria-atomic":"true",className:"chakra-toast__inner",__css:b,children:Ds(n,{id:t,onClose:_})})})});jW.displayName="ToastComponent";function PDe(e,t){var n;const r=e??"bottom",o={"top-start":{ltr:"top-left",rtl:"top-right"},"top-end":{ltr:"top-right",rtl:"top-left"},"bottom-start":{ltr:"bottom-left",rtl:"bottom-right"},"bottom-end":{ltr:"bottom-right",rtl:"bottom-left"}}[r];return(n=o==null?void 0:o[t])!=null?n:r}var nN={path:W.jsxs("g",{stroke:"currentColor",strokeWidth:"1.5",children:[W.jsx("path",{strokeLinecap:"round",fill:"none",d:"M9,9a3,3,0,1,1,4,2.829,1.5,1.5,0,0,0-1,1.415V14.25"}),W.jsx("path",{fill:"currentColor",strokeLinecap:"round",d:"M12,17.25a.375.375,0,1,0,.375.375A.375.375,0,0,0,12,17.25h0"}),W.jsx("circle",{fill:"none",strokeMiterlimit:"10",cx:"12",cy:"12",r:"11.25"})]}),viewBox:"0 0 24 24"},Fy=ra((e,t)=>{const{as:n,viewBox:r,color:i="currentColor",focusable:o=!1,children:a,className:s,__css:l,...u}=e,c=Rc("chakra-icon",s),d=Oy("Icon",e),f={w:"1em",h:"1em",display:"inline-block",lineHeight:"1em",flexShrink:0,color:i,...l,...d},h={ref:t,focusable:o,className:c,__css:f},p=r??nN.viewBox;if(n&&typeof n!="string")return W.jsx(Oi.svg,{as:n,...h,...u});const m=a??nN.path;return W.jsx(Oi.svg,{verticalAlign:"middle",viewBox:p,...h,...u,children:m})});Fy.displayName="Icon";function IDe(e){return W.jsx(Fy,{viewBox:"0 0 24 24",...e,children:W.jsx("path",{fill:"currentColor",d:"M12,0A12,12,0,1,0,24,12,12.014,12.014,0,0,0,12,0Zm6.927,8.2-6.845,9.289a1.011,1.011,0,0,1-1.43.188L5.764,13.769a1,1,0,1,1,1.25-1.562l4.076,3.261,6.227-8.451A1,1,0,1,1,18.927,8.2Z"})})}function RDe(e){return W.jsx(Fy,{viewBox:"0 0 24 24",...e,children:W.jsx("path",{fill:"currentColor",d:"M12,0A12,12,0,1,0,24,12,12.013,12.013,0,0,0,12,0Zm.25,5a1.5,1.5,0,1,1-1.5,1.5A1.5,1.5,0,0,1,12.25,5ZM14.5,18.5h-4a1,1,0,0,1,0-2h.75a.25.25,0,0,0,.25-.25v-4.5a.25.25,0,0,0-.25-.25H10.5a1,1,0,0,1,0-2h1a2,2,0,0,1,2,2v4.75a.25.25,0,0,0,.25.25h.75a1,1,0,1,1,0,2Z"})})}function rN(e){return W.jsx(Fy,{viewBox:"0 0 24 24",...e,children:W.jsx("path",{fill:"currentColor",d:"M11.983,0a12.206,12.206,0,0,0-8.51,3.653A11.8,11.8,0,0,0,0,12.207,11.779,11.779,0,0,0,11.8,24h.214A12.111,12.111,0,0,0,24,11.791h0A11.766,11.766,0,0,0,11.983,0ZM10.5,16.542a1.476,1.476,0,0,1,1.449-1.53h.027a1.527,1.527,0,0,1,1.523,1.47,1.475,1.475,0,0,1-1.449,1.53h-.027A1.529,1.529,0,0,1,10.5,16.542ZM11,12.5v-6a1,1,0,0,1,2,0v6a1,1,0,1,1-2,0Z"})})}var ODe=qke({"0%":{transform:"rotate(0deg)"},"100%":{transform:"rotate(360deg)"}}),SP=ra((e,t)=>{const n=Oy("Spinner",e),{label:r="Loading...",thickness:i="2px",speed:o="0.45s",emptyColor:a="transparent",className:s,...l}=Iy(e),u=Rc("chakra-spinner",s),c={display:"inline-block",borderColor:"currentColor",borderStyle:"solid",borderRadius:"99999px",borderWidth:i,borderBottomColor:a,borderLeftColor:a,animation:`${ODe} ${o} linear infinite`,...n};return W.jsx(Oi.div,{ref:t,__css:c,className:u,...l,children:r&&W.jsx(Oi.span,{srOnly:!0,children:r})})});SP.displayName="Spinner";var[MDe,xP]=Py({name:"AlertContext",hookName:"useAlertContext",providerName:""}),[NDe,wP]=Py({name:"AlertStylesContext",hookName:"useAlertStyles",providerName:""}),UW={info:{icon:RDe,colorScheme:"blue"},warning:{icon:rN,colorScheme:"orange"},success:{icon:IDe,colorScheme:"green"},error:{icon:rN,colorScheme:"red"},loading:{icon:SP,colorScheme:"blue"}};function $De(e){return UW[e].colorScheme}function DDe(e){return UW[e].icon}var VW=ra(function(t,n){const r=wP(),{status:i}=xP(),o={display:"inline",...r.description};return W.jsx(Oi.div,{ref:n,"data-status":i,...t,className:Rc("chakra-alert__desc",t.className),__css:o})});VW.displayName="AlertDescription";function GW(e){const{status:t}=xP(),n=DDe(t),r=wP(),i=t==="loading"?r.spinner:r.icon;return W.jsx(Oi.span,{display:"inherit","data-status":t,...e,className:Rc("chakra-alert__icon",e.className),__css:i,children:e.children||W.jsx(n,{h:"100%",w:"100%"})})}GW.displayName="AlertIcon";var qW=ra(function(t,n){const r=wP(),{status:i}=xP();return W.jsx(Oi.div,{ref:n,"data-status":i,...t,className:Rc("chakra-alert__title",t.className),__css:r.title})});qW.displayName="AlertTitle";var HW=ra(function(t,n){var r;const{status:i="info",addRole:o=!0,...a}=Iy(t),s=(r=t.colorScheme)!=null?r:$De(i),l=UOe("Alert",{...t,colorScheme:s}),u={width:"100%",display:"flex",alignItems:"center",position:"relative",overflow:"hidden",...l.container};return W.jsx(MDe,{value:{status:i},children:W.jsx(NDe,{value:l,children:W.jsx(Oi.div,{"data-status":i,role:o?"alert":void 0,ref:n,...a,className:Rc("chakra-alert",t.className),__css:u})})})});HW.displayName="Alert";function LDe(e){return W.jsx(Fy,{focusable:"false","aria-hidden":!0,...e,children:W.jsx("path",{fill:"currentColor",d:"M.439,21.44a1.5,1.5,0,0,0,2.122,2.121L11.823,14.3a.25.25,0,0,1,.354,0l9.262,9.263a1.5,1.5,0,1,0,2.122-2.121L14.3,12.177a.25.25,0,0,1,0-.354l9.263-9.262A1.5,1.5,0,0,0,21.439.44L12.177,9.7a.25.25,0,0,1-.354,0L2.561.44A1.5,1.5,0,0,0,.439,2.561L9.7,11.823a.25.25,0,0,1,0,.354Z"})})}var WW=ra(function(t,n){const r=Oy("CloseButton",t),{children:i,isDisabled:o,__css:a,...s}=Iy(t),l={outline:0,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0};return W.jsx(Oi.button,{type:"button","aria-label":"Close",ref:n,disabled:o,__css:{...l,...r,...a},...s,children:i||W.jsx(LDe,{width:"1em",height:"1em"})})});WW.displayName="CloseButton";var FDe={top:[],"top-left":[],"top-right":[],"bottom-left":[],bottom:[],"bottom-right":[]},Ms=BDe(FDe);function BDe(e){let t=e;const n=new Set,r=i=>{t=i(t),n.forEach(o=>o())};return{getState:()=>t,subscribe:i=>(n.add(i),()=>{r(()=>e),n.delete(i)}),removeToast:(i,o)=>{r(a=>({...a,[o]:a[o].filter(s=>s.id!=i)}))},notify:(i,o)=>{const a=zDe(i,o),{position:s,id:l}=a;return r(u=>{var c,d;const h=s.includes("top")?[a,...(c=u[s])!=null?c:[]]:[...(d=u[s])!=null?d:[],a];return{...u,[s]:h}}),l},update:(i,o)=>{i&&r(a=>{const s={...a},{position:l,index:u}=YM(s,i);return l&&u!==-1&&(s[l][u]={...s[l][u],...o,message:KW(o)}),s})},closeAll:({positions:i}={})=>{r(o=>(i??["bottom","bottom-right","bottom-left","top","top-left","top-right"]).reduce((l,u)=>(l[u]=o[u].map(c=>({...c,requestClose:!0})),l),{...o}))},close:i=>{r(o=>{const a=yH(o,i);return a?{...o,[a]:o[a].map(s=>s.id==i?{...s,requestClose:!0}:s)}:o})},isActive:i=>!!YM(Ms.getState(),i).position}}var iN=0;function zDe(e,t={}){var n,r;iN+=1;const i=(n=t.id)!=null?n:iN,o=(r=t.position)!=null?r:"bottom";return{id:i,message:e,position:o,duration:t.duration,onCloseComplete:t.onCloseComplete,onRequestRemove:()=>Ms.removeToast(String(i),o),status:t.status,requestClose:!1,containerStyle:t.containerStyle}}var jDe=e=>{const{status:t,variant:n="solid",id:r,title:i,isClosable:o,onClose:a,description:s,colorScheme:l,icon:u}=e,c=r?{root:`toast-${r}`,title:`toast-${r}-title`,description:`toast-${r}-description`}:void 0;return W.jsxs(HW,{addRole:!1,status:t,variant:n,id:c==null?void 0:c.root,alignItems:"start",borderRadius:"md",boxShadow:"lg",paddingEnd:8,textAlign:"start",width:"auto",colorScheme:l,children:[W.jsx(GW,{children:u}),W.jsxs(Oi.div,{flex:"1",maxWidth:"100%",children:[i&&W.jsx(qW,{id:c==null?void 0:c.title,children:i}),s&&W.jsx(VW,{id:c==null?void 0:c.description,display:"block",children:s})]}),o&&W.jsx(WW,{size:"sm",onClick:a,position:"absolute",insetEnd:1,top:1})]})};function KW(e={}){const{render:t,toastComponent:n=jDe}=e;return i=>typeof t=="function"?t({...i,...e}):W.jsx(n,{...i,...e})}function UDe(e,t){const n=i=>{var o;return{...t,...i,position:PDe((o=i==null?void 0:i.position)!=null?o:t==null?void 0:t.position,e)}},r=i=>{const o=n(i),a=KW(o);return Ms.notify(a,o)};return r.update=(i,o)=>{Ms.update(i,n(o))},r.promise=(i,o)=>{const a=r({...o.loading,status:"loading",duration:null});i.then(s=>r.update(a,{status:"success",duration:5e3,...Ds(o.success,s)})).catch(s=>r.update(a,{status:"error",duration:5e3,...Ds(o.error,s)}))},r.closeAll=Ms.closeAll,r.close=Ms.close,r.isActive=Ms.isActive,r}var[KKe,QKe]=Py({name:"ToastOptionsContext",strict:!1}),VDe=e=>{const t=I.useSyncExternalStore(Ms.subscribe,Ms.getState,Ms.getState),{motionVariants:n,component:r=jW,portalProps:i}=e,a=Object.keys(t).map(s=>{const l=t[s];return W.jsx("div",{role:"region","aria-live":"polite","aria-label":"Notifications",id:`chakra-toast-manager-${s}`,style:uMe(s),children:W.jsx(zW,{initial:!1,children:l.map(u=>W.jsx(r,{motionVariants:n,...u},u.id))})},s)});return W.jsx(tw,{...i,children:a})},GDe={duration:5e3,variant:"solid"},Sf={theme:ROe,colorMode:"light",toggleColorMode:()=>{},setColorMode:()=>{},defaultOptions:GDe,forced:!1};function qDe({theme:e=Sf.theme,colorMode:t=Sf.colorMode,toggleColorMode:n=Sf.toggleColorMode,setColorMode:r=Sf.setColorMode,defaultOptions:i=Sf.defaultOptions,motionVariants:o,toastSpacing:a,component:s,forced:l}=Sf){const u={colorMode:t,setColorMode:r,toggleColorMode:n,forced:l};return{ToastContainer:()=>W.jsx(oMe,{theme:e,children:W.jsx(qA.Provider,{value:u,children:W.jsx(VDe,{defaultOptions:i,motionVariants:o,toastSpacing:a,component:s})})}),toast:UDe(e.direction,i)}}var RT=ra(function(t,n){const{htmlWidth:r,htmlHeight:i,alt:o,...a}=t;return W.jsx("img",{width:r,height:i,ref:n,alt:o,...a})});RT.displayName="NativeImage";function HDe(e){const{loading:t,src:n,srcSet:r,onLoad:i,onError:o,crossOrigin:a,sizes:s,ignoreFallback:l}=e,[u,c]=I.useState("pending");I.useEffect(()=>{c(n?"loading":"pending")},[n]);const d=I.useRef(),f=I.useCallback(()=>{if(!n)return;h();const p=new Image;p.src=n,a&&(p.crossOrigin=a),r&&(p.srcset=r),s&&(p.sizes=s),t&&(p.loading=t),p.onload=m=>{h(),c("loaded"),i==null||i(m)},p.onerror=m=>{h(),c("failed"),o==null||o(m)},d.current=p},[n,a,r,s,i,o,t]),h=()=>{d.current&&(d.current.onload=null,d.current.onerror=null,d.current=null)};return V_(()=>{if(!l)return u==="loading"&&f(),()=>{h()}},[u,f,l]),l?"loaded":u}var WDe=(e,t)=>e!=="loaded"&&t==="beforeLoadOrError"||e==="failed"&&t==="onError";function KDe(e,t=[]){const n=Object.assign({},e);for(const r of t)r in n&&delete n[r];return n}var CP=ra(function(t,n){const{fallbackSrc:r,fallback:i,src:o,srcSet:a,align:s,fit:l,loading:u,ignoreFallback:c,crossOrigin:d,fallbackStrategy:f="beforeLoadOrError",referrerPolicy:h,...p}=t,m=r!==void 0||i!==void 0,_=u!=null||c||!m,b=HDe({...t,crossOrigin:d,ignoreFallback:_}),v=WDe(b,f),g={ref:n,objectFit:l,objectPosition:s,..._?p:KDe(p,["onError","onLoad"])};return v?i||W.jsx(Oi.img,{as:RT,className:"chakra-image__placeholder",src:r,...g}):W.jsx(Oi.img,{as:RT,src:o,srcSet:a,crossOrigin:d,loading:u,referrerPolicy:h,className:"chakra-image",...g})});CP.displayName="Image";var QW=ra(function(t,n){const r=Oy("Text",t),{className:i,align:o,decoration:a,casing:s,...l}=Iy(t),u=WOe({textAlign:t.align,textDecoration:t.decoration,textTransform:t.casing});return W.jsx(Oi.p,{ref:n,className:Rc("chakra-text",t.className),...u,...l,__css:r})});QW.displayName="Text";var OT=ra(function(t,n){const r=Oy("Heading",t),{className:i,...o}=Iy(t);return W.jsx(Oi.h2,{ref:n,className:Rc("chakra-heading",t.className),...o,__css:r})});OT.displayName="Heading";var iS=Oi("div");iS.displayName="Box";var XW=ra(function(t,n){const{size:r,centerContent:i=!0,...o}=t,a=i?{display:"flex",alignItems:"center",justifyContent:"center"}:{};return W.jsx(iS,{ref:n,boxSize:r,__css:{...a,flexShrink:0,flexGrow:0},...o})});XW.displayName="Square";var QDe=ra(function(t,n){const{size:r,...i}=t;return W.jsx(XW,{size:r,ref:n,borderRadius:"9999px",...i})});QDe.displayName="Circle";var EP=ra(function(t,n){const{direction:r,align:i,justify:o,wrap:a,basis:s,grow:l,shrink:u,...c}=t,d={display:"flex",flexDirection:r,alignItems:i,justifyContent:o,flexWrap:a,flexBasis:s,flexGrow:l,flexShrink:u};return W.jsx(Oi.div,{ref:n,__css:d,...c})});EP.displayName="Flex";const XDe=z.object({status:z.literal(422),data:z.object({detail:z.array(z.object({loc:z.array(z.string()),msg:z.string(),type:z.string()}))})});function mo(e,t,n=!1){e=String(e),t=String(t);const r=Array.from({length:21},(a,s)=>s*50),i=[0,5,10,15,20,25,30,35,40,45,50,55,59,64,68,73,77,82,86,95,100];return r.reduce((a,s,l)=>{const u=n?i[l]/100:1,c=n?50:i[r.length-1-l];return a[s]=`hsl(${e} ${t}% ${c}% / ${u})`,a},{})}const o1={H:220,S:16},a1={H:250,S:42},s1={H:47,S:42},l1={H:40,S:70},u1={H:28,S:42},c1={H:113,S:42},d1={H:0,S:42},YDe={base:mo(o1.H,o1.S),baseAlpha:mo(o1.H,o1.S,!0),accent:mo(a1.H,a1.S),accentAlpha:mo(a1.H,a1.S,!0),working:mo(s1.H,s1.S),workingAlpha:mo(s1.H,s1.S,!0),gold:mo(l1.H,l1.S),goldAlpha:mo(l1.H,l1.S,!0),warning:mo(u1.H,u1.S),warningAlpha:mo(u1.H,u1.S,!0),ok:mo(c1.H,c1.S),okAlpha:mo(c1.H,c1.S,!0),error:mo(d1.H,d1.S),errorAlpha:mo(d1.H,d1.S,!0)},{definePartsStyle:ZDe,defineMultiStyleConfig:JDe}=Pt(Vq.keys),eLe={border:"none"},tLe=e=>{const{colorScheme:t}=e;return{fontWeight:"600",fontSize:"sm",border:"none",borderRadius:"base",bg:K(`${t}.200`,`${t}.700`)(e),color:K(`${t}.900`,`${t}.100`)(e),_hover:{bg:K(`${t}.250`,`${t}.650`)(e)},_expanded:{bg:K(`${t}.250`,`${t}.650`)(e),borderBottomRadius:"none",_hover:{bg:K(`${t}.300`,`${t}.600`)(e)}}}},nLe=e=>{const{colorScheme:t}=e;return{bg:K(`${t}.100`,`${t}.800`)(e),borderRadius:"base",borderTopRadius:"none"}},rLe={},iLe=ZDe(e=>({container:eLe,button:tLe(e),panel:nLe(e),icon:rLe})),oLe=JDe({variants:{invokeAI:iLe},defaultProps:{variant:"invokeAI",colorScheme:"base"}}),aLe=e=>{const{colorScheme:t}=e;if(t==="base"){const r={bg:K("base.150","base.700")(e),color:K("base.300","base.500")(e),svg:{fill:K("base.300","base.500")(e)},opacity:1},i={bg:"none",color:K("base.300","base.500")(e),svg:{fill:K("base.500","base.500")(e)},opacity:1};return{bg:K("base.250","base.600")(e),color:K("base.850","base.100")(e),borderRadius:"base",svg:{fill:K("base.850","base.100")(e)},_hover:{bg:K("base.300","base.500")(e),color:K("base.900","base.50")(e),svg:{fill:K("base.900","base.50")(e)},_disabled:r},_disabled:r,'&[data-progress="true"]':{...i,_hover:i}}}const n={bg:K(`${t}.400`,`${t}.700`)(e),color:K(`${t}.600`,`${t}.500`)(e),svg:{fill:K(`${t}.600`,`${t}.500`)(e),filter:"unset"},opacity:.7,filter:"saturate(65%)"};return{bg:K(`${t}.400`,`${t}.600`)(e),color:K("base.50","base.100")(e),borderRadius:"base",svg:{fill:K("base.50","base.100")(e)},_disabled:n,_hover:{bg:K(`${t}.500`,`${t}.500`)(e),color:K("white","base.50")(e),svg:{fill:K("white","base.50")(e)},_disabled:n}}},sLe=e=>{const{colorScheme:t}=e,n=K("gray.200","whiteAlpha.300")(e);return{border:"1px solid",borderColor:t==="gray"?n:"currentColor",_hover:{bg:K(`${t}.500`,`${t}.500`)(e),color:K("white","base.50")(e),svg:{fill:K("white","base.50")(e)}},".chakra-button__group[data-attached][data-orientation=horizontal] > &:not(:last-of-type)":{marginEnd:"-1px"},".chakra-button__group[data-attached][data-orientation=vertical] > &:not(:last-of-type)":{marginBottom:"-1px"}}},lLe={variants:{invokeAI:aLe,invokeAIOutline:sLe},defaultProps:{variant:"invokeAI",colorScheme:"base"}},{definePartsStyle:uLe,defineMultiStyleConfig:cLe}=Pt(Gq.keys),dLe=e=>{const{colorScheme:t}=e;return{bg:K("base.200","base.700")(e),borderColor:K("base.300","base.600")(e),color:K("base.900","base.100")(e),_checked:{bg:K(`${t}.300`,`${t}.500`)(e),borderColor:K(`${t}.300`,`${t}.500`)(e),color:K(`${t}.900`,`${t}.100`)(e),_hover:{bg:K(`${t}.400`,`${t}.500`)(e),borderColor:K(`${t}.400`,`${t}.500`)(e)},_disabled:{borderColor:"transparent",bg:"whiteAlpha.300",color:"whiteAlpha.500"}},_indeterminate:{bg:K(`${t}.300`,`${t}.600`)(e),borderColor:K(`${t}.300`,`${t}.600`)(e),color:K(`${t}.900`,`${t}.100`)(e)},_disabled:{bg:"whiteAlpha.100",borderColor:"transparent"},_focusVisible:{boxShadow:"none",outline:"none"},_invalid:{borderColor:K("error.600","error.300")(e)}}},fLe=uLe(e=>({control:dLe(e)})),hLe=cLe({variants:{invokeAI:fLe},defaultProps:{variant:"invokeAI",colorScheme:"accent"}}),{definePartsStyle:pLe,defineMultiStyleConfig:gLe}=Pt(qq.keys),mLe={borderRadius:"md",py:"1",transitionProperty:"common",transitionDuration:"normal"},yLe=e=>({borderRadius:"md",py:"1",transitionProperty:"common",transitionDuration:"normal",width:"full",_focusVisible:{boxShadow:"outline"},_placeholder:{opacity:.6},"::selection":{color:K("accent.900","accent.50")(e),bg:K("accent.200","accent.400")(e)}}),vLe={borderRadius:"md",py:"1",transitionProperty:"common",transitionDuration:"normal",width:"full",_focusVisible:{boxShadow:"outline"},_placeholder:{opacity:.6}},bLe=pLe(e=>({preview:mLe,input:yLe(e),textarea:vLe})),_Le=gLe({variants:{invokeAI:bLe},defaultProps:{size:"sm",variant:"invokeAI"}}),SLe=e=>({fontSize:"sm",marginEnd:0,mb:1,fontWeight:"400",transitionProperty:"common",transitionDuration:"normal",whiteSpace:"nowrap",_disabled:{opacity:.4},color:K("base.700","base.300")(e),_invalid:{color:K("error.500","error.300")(e)}}),xLe={variants:{invokeAI:SLe},defaultProps:{variant:"invokeAI"}},pw=e=>({outline:"none",borderWidth:2,borderStyle:"solid",borderColor:K("base.200","base.800")(e),bg:K("base.50","base.900")(e),borderRadius:"base",color:K("base.900","base.100")(e),boxShadow:"none",_hover:{borderColor:K("base.300","base.600")(e)},_focus:{borderColor:K("accent.200","accent.600")(e),boxShadow:"none",_hover:{borderColor:K("accent.300","accent.500")(e)}},_invalid:{borderColor:K("error.300","error.600")(e),boxShadow:"none",_hover:{borderColor:K("error.400","error.500")(e)}},_disabled:{borderColor:K("base.300","base.700")(e),bg:K("base.300","base.700")(e),color:K("base.600","base.400")(e),_hover:{borderColor:K("base.300","base.700")(e)}},_placeholder:{color:K("base.700","base.400")(e)},"::selection":{bg:K("accent.200","accent.400")(e)}}),{definePartsStyle:wLe,defineMultiStyleConfig:CLe}=Pt(Hq.keys),ELe=wLe(e=>({field:pw(e)})),TLe=CLe({variants:{invokeAI:ELe},defaultProps:{size:"sm",variant:"invokeAI"}}),{definePartsStyle:kLe,defineMultiStyleConfig:ALe}=Pt(Wq.keys),PLe=kLe(e=>({button:{fontWeight:500,bg:K("base.300","base.500")(e),color:K("base.900","base.100")(e),_hover:{bg:K("base.400","base.600")(e),color:K("base.900","base.50")(e),fontWeight:600}},list:{zIndex:9999,color:K("base.900","base.150")(e),bg:K("base.200","base.800")(e),shadow:"dark-lg",border:"none"},item:{fontSize:"sm",bg:K("base.200","base.800")(e),_hover:{bg:K("base.300","base.700")(e),svg:{opacity:1}},_focus:{bg:K("base.400","base.600")(e)},svg:{opacity:.7,fontSize:14}}})),ILe=ALe({variants:{invokeAI:PLe},defaultProps:{variant:"invokeAI"}}),XKe={variants:{enter:{visibility:"visible",opacity:1,scale:1,transition:{duration:.07,ease:[.4,0,.2,1]}},exit:{transitionEnd:{visibility:"hidden"},opacity:0,scale:.8,transition:{duration:.07,easings:"easeOut"}}}},{defineMultiStyleConfig:RLe,definePartsStyle:OLe}=Pt(Kq.keys),MLe=e=>({bg:K("blackAlpha.700","blackAlpha.700")(e)}),NLe={},$Le=()=>({layerStyle:"first",maxH:"80vh"}),DLe=()=>({fontWeight:"600",fontSize:"lg",layerStyle:"first",borderTopRadius:"base",borderInlineEndRadius:"base"}),LLe={},FLe={overflowY:"scroll"},BLe={},zLe=OLe(e=>({overlay:MLe(e),dialogContainer:NLe,dialog:$Le(),header:DLe(),closeButton:LLe,body:FLe,footer:BLe})),jLe=RLe({variants:{invokeAI:zLe},defaultProps:{variant:"invokeAI",size:"lg"}}),{defineMultiStyleConfig:ULe,definePartsStyle:VLe}=Pt(Qq.keys),GLe=e=>({height:8}),qLe=e=>({border:"none",fontWeight:"600",height:"auto",py:1,ps:2,pe:6,...pw(e)}),HLe=e=>({display:"flex"}),WLe=e=>({border:"none",px:2,py:0,mx:-2,my:0,svg:{color:K("base.700","base.300")(e),width:2.5,height:2.5,_hover:{color:K("base.900","base.100")(e)}}}),KLe=VLe(e=>({root:GLe(e),field:qLe(e),stepperGroup:HLe(e),stepper:WLe(e)})),QLe=ULe({variants:{invokeAI:KLe},defaultProps:{size:"sm",variant:"invokeAI"}}),{defineMultiStyleConfig:XLe,definePartsStyle:YW}=Pt(Xq.keys),ZW=fr("popper-bg"),JW=fr("popper-arrow-bg"),eK=fr("popper-arrow-shadow-color"),YLe=e=>({[JW.variable]:K("colors.base.100","colors.base.800")(e),[ZW.variable]:K("colors.base.100","colors.base.800")(e),[eK.variable]:K("colors.base.400","colors.base.600")(e),minW:"unset",width:"unset",p:4,bg:K("base.100","base.800")(e),border:"none",shadow:"dark-lg"}),ZLe=e=>({[JW.variable]:K("colors.base.100","colors.base.700")(e),[ZW.variable]:K("colors.base.100","colors.base.700")(e),[eK.variable]:K("colors.base.400","colors.base.400")(e),p:4,bg:K("base.100","base.700")(e),border:"none",shadow:"dark-lg"}),JLe=YW(e=>({content:YLe(e),body:{padding:0}})),eFe=YW(e=>({content:ZLe(e),body:{padding:0}})),tFe=XLe({variants:{invokeAI:JLe,informational:eFe},defaultProps:{variant:"invokeAI"}}),{defineMultiStyleConfig:nFe,definePartsStyle:rFe}=Pt(Yq.keys),iFe=e=>({bg:"accentAlpha.700"}),oFe=e=>{const{colorScheme:t}=e;return{bg:K(`${t}.200`,`${t}.700`)(e)}},aFe=rFe(e=>({filledTrack:iFe(e),track:oFe(e)})),sFe=nFe({variants:{invokeAI:aFe},defaultProps:{variant:"invokeAI"}}),lFe={"::-webkit-scrollbar":{display:"none"},scrollbarWidth:"none"},{definePartsStyle:uFe,defineMultiStyleConfig:cFe}=Pt(Zq.keys),dFe=e=>({color:K("base.200","base.300")(e)}),fFe=e=>({fontWeight:"600",...pw(e)}),hFe=uFe(e=>({field:fFe(e),icon:dFe(e)})),pFe=cFe({variants:{invokeAI:hFe},defaultProps:{size:"sm",variant:"invokeAI"}}),oN=nt("skeleton-start-color"),aN=nt("skeleton-end-color"),gFe={borderRadius:"base",maxW:"full",maxH:"full",_light:{[oN.variable]:"colors.base.250",[aN.variable]:"colors.base.450"},_dark:{[oN.variable]:"colors.base.700",[aN.variable]:"colors.base.500"}},mFe={variants:{invokeAI:gFe},defaultProps:{variant:"invokeAI"}},{definePartsStyle:yFe,defineMultiStyleConfig:vFe}=Pt(Jq.keys),bFe=e=>({bg:K("base.400","base.600")(e),h:1.5}),_Fe=e=>{const{colorScheme:t}=e;return{bg:K(`${t}.400`,`${t}.600`)(e),h:1.5}},SFe=e=>({w:e.orientation==="horizontal"?2:4,h:e.orientation==="horizontal"?4:2,bg:K("base.50","base.100")(e)}),xFe=e=>({fontSize:"2xs",fontWeight:"500",color:K("base.700","base.400")(e),mt:2,insetInlineStart:"unset"}),wFe=yFe(e=>({container:{_disabled:{opacity:.6,cursor:"default",pointerEvents:"none"}},track:bFe(e),filledTrack:_Fe(e),thumb:SFe(e),mark:xFe(e)})),CFe=vFe({variants:{invokeAI:wFe},defaultProps:{variant:"invokeAI",colorScheme:"accent"}}),{defineMultiStyleConfig:EFe,definePartsStyle:TFe}=Pt(eH.keys),kFe=e=>{const{colorScheme:t}=e;return{bg:K("base.300","base.600")(e),_focusVisible:{boxShadow:"none"},_checked:{bg:K(`${t}.400`,`${t}.500`)(e)}}},AFe=e=>{const{colorScheme:t}=e;return{bg:K(`${t}.50`,`${t}.50`)(e)}},PFe=TFe(e=>({container:{},track:kFe(e),thumb:AFe(e)})),IFe=EFe({variants:{invokeAI:PFe},defaultProps:{size:"md",variant:"invokeAI",colorScheme:"accent"}}),{defineMultiStyleConfig:RFe,definePartsStyle:tK}=Pt(tH.keys),OFe=e=>({display:"flex",columnGap:4}),MFe=e=>({}),NFe=e=>{const{colorScheme:t}=e;return{display:"flex",flexDirection:"column",gap:1,color:K("base.700","base.400")(e),button:{fontSize:"sm",padding:2,borderRadius:"base",textShadow:K("0 0 0.3rem var(--invokeai-colors-accent-100)","0 0 0.3rem var(--invokeai-colors-accent-900)")(e),svg:{fill:K("base.700","base.300")(e)},_selected:{bg:K("accent.400","accent.600")(e),color:K("base.50","base.100")(e),svg:{fill:K("base.50","base.100")(e),filter:K(`drop-shadow(0px 0px 0.3rem var(--invokeai-colors-${t}-600))`,`drop-shadow(0px 0px 0.3rem var(--invokeai-colors-${t}-800))`)(e)},_hover:{bg:K("accent.500","accent.500")(e),color:K("white","base.50")(e),svg:{fill:K("white","base.50")(e)}}},_hover:{bg:K("base.100","base.800")(e),color:K("base.900","base.50")(e),svg:{fill:K("base.800","base.100")(e)}}}}},$Fe=e=>({padding:0,height:"100%"}),DFe=tK(e=>({root:OFe(e),tab:MFe(e),tablist:NFe(e),tabpanel:$Fe(e)})),LFe=tK(e=>({tab:{borderTopRadius:"base",px:4,py:1,fontSize:"sm",color:K("base.600","base.400")(e),fontWeight:500,_selected:{color:K("accent.600","accent.400")(e)}},tabpanel:{p:0,pt:4,w:"full",h:"full"},tabpanels:{w:"full",h:"full"}})),FFe=RFe({variants:{line:LFe,appTabs:DFe},defaultProps:{variant:"appTabs",colorScheme:"accent"}}),BFe=e=>({color:K("base.500","base.400")(e)}),zFe={variants:{subtext:BFe}},jFe=e=>({...pw(e),"::-webkit-scrollbar":{display:"initial"},"::-webkit-resizer":{backgroundImage:`linear-gradient(135deg, + var(--invokeai-colors-base-50) 0%, + var(--invokeai-colors-base-50) 70%, + var(--invokeai-colors-base-200) 70%, + var(--invokeai-colors-base-200) 100%)`},_disabled:{"::-webkit-resizer":{backgroundImage:`linear-gradient(135deg, + var(--invokeai-colors-base-50) 0%, + var(--invokeai-colors-base-50) 70%, + var(--invokeai-colors-base-200) 70%, + var(--invokeai-colors-base-200) 100%)`}},_dark:{"::-webkit-resizer":{backgroundImage:`linear-gradient(135deg, + var(--invokeai-colors-base-900) 0%, + var(--invokeai-colors-base-900) 70%, + var(--invokeai-colors-base-800) 70%, + var(--invokeai-colors-base-800) 100%)`},_disabled:{"::-webkit-resizer":{backgroundImage:`linear-gradient(135deg, + var(--invokeai-colors-base-900) 0%, + var(--invokeai-colors-base-900) 70%, + var(--invokeai-colors-base-800) 70%, + var(--invokeai-colors-base-800) 100%)`}}},p:2}),UFe={variants:{invokeAI:jFe},defaultProps:{size:"md",variant:"invokeAI"}},VFe=fr("popper-arrow-bg"),GFe=e=>({borderRadius:"base",shadow:"dark-lg",bg:K("base.700","base.200")(e),[VFe.variable]:K("colors.base.700","colors.base.200")(e),pb:1.5}),qFe={baseStyle:GFe},sN={backgroundColor:"accentAlpha.150 !important",borderColor:"accentAlpha.700 !important",borderRadius:"base !important",borderStyle:"dashed !important",_dark:{borderColor:"accent.400 !important"}},HFe={".react-flow__nodesselection-rect":{...sN,padding:"1rem !important",boxSizing:"content-box !important",transform:"translate(-1rem, -1rem) !important"},".react-flow__selection":sN},WFe={config:{cssVarPrefix:"invokeai",initialColorMode:"dark",useSystemColorMode:!1},layerStyles:{body:{bg:"base.50",color:"base.900",".chakra-ui-dark &":{bg:"base.900",color:"base.50"}},first:{bg:"base.100",color:"base.900",".chakra-ui-dark &":{bg:"base.850",color:"base.100"}},second:{bg:"base.200",color:"base.900",".chakra-ui-dark &":{bg:"base.800",color:"base.100"}},third:{bg:"base.300",color:"base.900",".chakra-ui-dark &":{bg:"base.750",color:"base.100"}},nodeBody:{bg:"base.100",color:"base.900",".chakra-ui-dark &":{bg:"base.800",color:"base.100"}},nodeHeader:{bg:"base.200",color:"base.900",".chakra-ui-dark &":{bg:"base.900",color:"base.100"}},nodeFooter:{bg:"base.200",color:"base.900",".chakra-ui-dark &":{bg:"base.900",color:"base.100"}}},styles:{global:()=>({layerStyle:"body","*":{...lFe},...HFe})},direction:"ltr",fonts:{body:"'Inter Variable', sans-serif",heading:"'Inter Variable', sans-serif"},shadows:{light:{accent:"0 0 10px 0 var(--invokeai-colors-accent-300)",accentHover:"0 0 10px 0 var(--invokeai-colors-accent-400)",ok:"0 0 7px var(--invokeai-colors-ok-600)",working:"0 0 7px var(--invokeai-colors-working-600)",error:"0 0 7px var(--invokeai-colors-error-600)"},dark:{accent:"0 0 10px 0 var(--invokeai-colors-accent-600)",accentHover:"0 0 10px 0 var(--invokeai-colors-accent-500)",ok:"0 0 7px var(--invokeai-colors-ok-400)",working:"0 0 7px var(--invokeai-colors-working-400)",error:"0 0 7px var(--invokeai-colors-error-400)"},selected:{light:"0px 0px 0px 1px var(--invokeai-colors-base-150), 0px 0px 0px 4px var(--invokeai-colors-accent-400)",dark:"0px 0px 0px 1px var(--invokeai-colors-base-900), 0px 0px 0px 4px var(--invokeai-colors-accent-500)"},hoverSelected:{light:"0px 0px 0px 1px var(--invokeai-colors-base-150), 0px 0px 0px 4px var(--invokeai-colors-accent-500)",dark:"0px 0px 0px 1px var(--invokeai-colors-base-900), 0px 0px 0px 4px var(--invokeai-colors-accent-400)"},hoverUnselected:{light:"0px 0px 0px 1px var(--invokeai-colors-base-150), 0px 0px 0px 3px var(--invokeai-colors-accent-500)",dark:"0px 0px 0px 1px var(--invokeai-colors-base-900), 0px 0px 0px 3px var(--invokeai-colors-accent-400)"},nodeSelected:{light:"0 0 0 3px var(--invokeai-colors-accent-400)",dark:"0 0 0 3px var(--invokeai-colors-accent-500)"},nodeHovered:{light:"0 0 0 2px var(--invokeai-colors-accent-500)",dark:"0 0 0 2px var(--invokeai-colors-accent-400)"},nodeHoveredSelected:{light:"0 0 0 3px var(--invokeai-colors-accent-500)",dark:"0 0 0 3px var(--invokeai-colors-accent-400)"},nodeInProgress:{light:"0 0 0 2px var(--invokeai-colors-accent-500), 0 0 10px 2px var(--invokeai-colors-accent-600)",dark:"0 0 0 2px var(--invokeai-colors-yellow-400), 0 0 20px 2px var(--invokeai-colors-orange-700)"}},colors:YDe,components:{Button:lLe,Input:TLe,Editable:_Le,Textarea:UFe,Tabs:FFe,Progress:sFe,Accordion:oLe,FormLabel:xLe,Switch:IFe,NumberInput:QLe,Select:pFe,Skeleton:mFe,Slider:CFe,Popover:tFe,Modal:jLe,Checkbox:hLe,Menu:ILe,Text:zFe,Tooltip:qFe}},KFe={defaultOptions:{isClosable:!0}},{toast:dg}=qDe({theme:WFe,defaultOptions:KFe.defaultOptions}),QFe=()=>{Fe({matcher:Qr.endpoints.enqueueBatch.matchFulfilled,effect:async e=>{const t=e.payload,n=e.meta.arg.originalArgs;_e("queue").debug({enqueueResult:Qt(t)},"Batch enqueued"),dg.isActive("batch-queued")||dg({id:"batch-queued",title:Z("queue.batchQueued"),description:Z("queue.batchQueuedDesc",{item_count:t.enqueued,direction:n.prepend?Z("queue.front"):Z("queue.back")}),duration:1e3,status:"success"})}}),Fe({matcher:Qr.endpoints.enqueueBatch.matchRejected,effect:async e=>{const t=e.payload,n=e.meta.arg.originalArgs;if(!t){dg({title:Z("queue.batchFailedToQueue"),status:"error",description:"Unknown Error"}),_e("queue").error({batchConfig:Qt(n),error:Qt(t)},Z("queue.batchFailedToQueue"));return}const r=XDe.safeParse(t);if(r.success)r.data.data.detail.map(i=>{dg({id:"batch-failed-to-queue",title:Q8(_F(i.msg),{length:128}),status:"error",description:Q8(`Path: + ${i.loc.join(".")}`,{length:128})})});else{let i="Unknown Error",o;t.status===403&&"body"in t?i=ch(t,"body.detail","Unknown Error"):t.status===403&&"error"in t?i=ch(t,"error.detail","Unknown Error"):t.status===403&&"data"in t&&(i=ch(t,"data.detail","Unknown Error"),o=15e3),dg({title:Z("queue.batchFailedToQueue"),status:"error",description:i,...o?{duration:o}:{}})}_e("queue").error({batchConfig:Qt(n),error:Qt(t)},Z("queue.batchFailedToQueue"))}})},nK=jL(),Fe=nK.startListening;qEe();HEe();YEe();DEe();LEe();FEe();BEe();zEe();Oxe();GEe();WEe();KEe();bEe();MEe();CEe();kxe();QFe();J3e();Q3e();Kxe();X3e();Wxe();qxe();Z3e();C4e();Cxe();f4e();h4e();g4e();m4e();v4e();c4e();d4e();x4e();w4e();b4e();S4e();y4e();_4e();rEe();tEe();NEe();$Ee();UEe();VEe();Mxe();u4e();nke();jEe();ZEe();Ixe();eTe();Axe();Exe();Q4e();T4e();rTe();const XFe={canvas:gle,gallery:P0e,generation:rle,nodes:c2e,postprocessing:d2e,system:v2e,config:$ae,ui:k2e,hotkeys:T2e,controlNet:v0e,dynamicPrompts:A0e,deleteImageModal:S0e,changeBoardModal:yle,lora:O0e,modelmanager:E2e,sdxl:h2e,queue:w2e,[ls.reducerPath]:ls.reducer},YFe=pp(XFe),ZFe=Z2e(YFe),JFe=["canvas","gallery","generation","sdxl","nodes","postprocessing","system","ui","controlNet","dynamicPrompts","lora","modelmanager"],rK=SL({reducer:ZFe,enhancers:e=>e.concat(J2e(window.localStorage,JFe,{persistDebounce:300,serialize:dxe,unserialize:hxe,prefix:exe})).concat(VL()),middleware:e=>e({serializableCheck:!1,immutableCheck:!1}).concat(ls.middleware).concat(R2e).prepend(nK.middleware),devTools:{actionSanitizer:bxe,stateSanitizer:Sxe,trace:!0,predicate:(e,t)=>!_xe.includes(t.type)}}),iK=e=>e;OB.set(rK);const eBe=e=>{const{socket:t,storeApi:n}=e,{dispatch:r}=n;t.on("connect",()=>{_e("socketio").debug("Connected"),r(jj());const o=Ur.get();t.emit("subscribe_queue",{queue_id:o})}),t.on("connect_error",i=>{i&&i.message&&i.data==="ERR_UNAUTHENTICATED"&&r(Gt(Ld({title:i.message,status:"error",duration:1e4})))}),t.on("disconnect",()=>{r(Uj())}),t.on("invocation_started",i=>{r(Gj({data:i}))}),t.on("generator_progress",i=>{r(Kj({data:i}))}),t.on("invocation_error",i=>{r(qj({data:i}))}),t.on("invocation_complete",i=>{r(Vk({data:i}))}),t.on("graph_execution_state_complete",i=>{r(Hj({data:i}))}),t.on("model_load_started",i=>{r(Qj({data:i}))}),t.on("model_load_completed",i=>{r(Yj({data:i}))}),t.on("session_retrieval_error",i=>{r(Jj({data:i}))}),t.on("invocation_retrieval_error",i=>{r(tU({data:i}))}),t.on("queue_item_status_changed",i=>{r(rU({data:i}))})},Zs=Object.create(null);Zs.open="0";Zs.close="1";Zs.ping="2";Zs.pong="3";Zs.message="4";Zs.upgrade="5";Zs.noop="6";const ab=Object.create(null);Object.keys(Zs).forEach(e=>{ab[Zs[e]]=e});const MT={type:"error",data:"parser error"},oK=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",aK=typeof ArrayBuffer=="function",sK=e=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer,TP=({type:e,data:t},n,r)=>oK&&t instanceof Blob?n?r(t):lN(t,r):aK&&(t instanceof ArrayBuffer||sK(t))?n?r(t):lN(new Blob([t]),r):r(Zs[e]+(t||"")),lN=(e,t)=>{const n=new FileReader;return n.onload=function(){const r=n.result.split(",")[1];t("b"+(r||""))},n.readAsDataURL(e)};function uN(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}let L5;function tBe(e,t){if(oK&&e.data instanceof Blob)return e.data.arrayBuffer().then(uN).then(t);if(aK&&(e.data instanceof ArrayBuffer||sK(e.data)))return t(uN(e.data));TP(e,!1,n=>{L5||(L5=new TextEncoder),t(L5.encode(n))})}const cN="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Og=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let e=0;e{let t=e.length*.75,n=e.length,r,i=0,o,a,s,l;e[e.length-1]==="="&&(t--,e[e.length-2]==="="&&t--);const u=new ArrayBuffer(t),c=new Uint8Array(u);for(r=0;r>4,c[i++]=(a&15)<<4|s>>2,c[i++]=(s&3)<<6|l&63;return u},rBe=typeof ArrayBuffer=="function",kP=(e,t)=>{if(typeof e!="string")return{type:"message",data:lK(e,t)};const n=e.charAt(0);return n==="b"?{type:"message",data:iBe(e.substring(1),t)}:ab[n]?e.length>1?{type:ab[n],data:e.substring(1)}:{type:ab[n]}:MT},iBe=(e,t)=>{if(rBe){const n=nBe(e);return lK(n,t)}else return{base64:!0,data:e}},lK=(e,t)=>{switch(t){case"blob":return e instanceof Blob?e:new Blob([e]);case"arraybuffer":default:return e instanceof ArrayBuffer?e:e.buffer}},uK=String.fromCharCode(30),oBe=(e,t)=>{const n=e.length,r=new Array(n);let i=0;e.forEach((o,a)=>{TP(o,!1,s=>{r[a]=s,++i===n&&t(r.join(uK))})})},aBe=(e,t)=>{const n=e.split(uK),r=[];for(let i=0;i{const r=n.length;let i;if(r<126)i=new Uint8Array(1),new DataView(i.buffer).setUint8(0,r);else if(r<65536){i=new Uint8Array(3);const o=new DataView(i.buffer);o.setUint8(0,126),o.setUint16(1,r)}else{i=new Uint8Array(9);const o=new DataView(i.buffer);o.setUint8(0,127),o.setBigUint64(1,BigInt(r))}e.data&&typeof e.data!="string"&&(i[0]|=128),t.enqueue(i),t.enqueue(n)})}})}let F5;function f1(e){return e.reduce((t,n)=>t+n.length,0)}function h1(e,t){if(e[0].length===t)return e.shift();const n=new Uint8Array(t);let r=0;for(let i=0;iMath.pow(2,53-32)-1){s.enqueue(MT);break}i=c*Math.pow(2,32)+u.getUint32(4),r=3}else{if(f1(n)e){s.enqueue(MT);break}}}})}const cK=4;function Lr(e){if(e)return uBe(e)}function uBe(e){for(var t in Lr.prototype)e[t]=Lr.prototype[t];return e}Lr.prototype.on=Lr.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this};Lr.prototype.once=function(e,t){function n(){this.off(e,n),t.apply(this,arguments)}return n.fn=t,this.on(e,n),this};Lr.prototype.off=Lr.prototype.removeListener=Lr.prototype.removeAllListeners=Lr.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var n=this._callbacks["$"+e];if(!n)return this;if(arguments.length==1)return delete this._callbacks["$"+e],this;for(var r,i=0;itypeof self<"u"?self:typeof window<"u"?window:Function("return this")())();function dK(e,...t){return t.reduce((n,r)=>(e.hasOwnProperty(r)&&(n[r]=e[r]),n),{})}const cBe=ma.setTimeout,dBe=ma.clearTimeout;function gw(e,t){t.useNativeTimers?(e.setTimeoutFn=cBe.bind(ma),e.clearTimeoutFn=dBe.bind(ma)):(e.setTimeoutFn=ma.setTimeout.bind(ma),e.clearTimeoutFn=ma.clearTimeout.bind(ma))}const fBe=1.33;function hBe(e){return typeof e=="string"?pBe(e):Math.ceil((e.byteLength||e.size)*fBe)}function pBe(e){let t=0,n=0;for(let r=0,i=e.length;r=57344?n+=3:(r++,n+=4);return n}function gBe(e){let t="";for(let n in e)e.hasOwnProperty(n)&&(t.length&&(t+="&"),t+=encodeURIComponent(n)+"="+encodeURIComponent(e[n]));return t}function mBe(e){let t={},n=e.split("&");for(let r=0,i=n.length;r0);return t}function hK(){const e=hN(+new Date);return e!==fN?(dN=0,fN=e):e+"."+hN(dN++)}for(;p1{this.readyState="paused",t()};if(this.polling||!this.writable){let r=0;this.polling&&(r++,this.once("pollComplete",function(){--r||n()})),this.writable||(r++,this.once("drain",function(){--r||n()}))}else n()}poll(){this.polling=!0,this.doPoll(),this.emitReserved("poll")}onData(t){const n=r=>{if(this.readyState==="opening"&&r.type==="open"&&this.onOpen(),r.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(r)};aBe(t,this.socket.binaryType).forEach(n),this.readyState!=="closed"&&(this.polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this.poll())}doClose(){const t=()=>{this.write([{type:"close"}])};this.readyState==="open"?t():this.once("open",t)}write(t){this.writable=!1,oBe(t,n=>{this.doWrite(n,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const t=this.opts.secure?"https":"http",n=this.query||{};return this.opts.timestampRequests!==!1&&(n[this.opts.timestampParam]=hK()),!this.supportsBinary&&!n.sid&&(n.b64=1),this.createUri(t,n)}request(t={}){return Object.assign(t,{xd:this.xd,cookieJar:this.cookieJar},this.opts),new Th(this.uri(),t)}doWrite(t,n){const r=this.request({method:"POST",data:t});r.on("success",n),r.on("error",(i,o)=>{this.onError("xhr post error",i,o)})}doPoll(){const t=this.request();t.on("data",this.onData.bind(this)),t.on("error",(n,r)=>{this.onError("xhr poll error",n,r)}),this.pollXhr=t}}let Th=class sb extends Lr{constructor(t,n){super(),gw(this,n),this.opts=n,this.method=n.method||"GET",this.uri=t,this.data=n.data!==void 0?n.data:null,this.create()}create(){var t;const n=dK(this.opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");n.xdomain=!!this.opts.xd;const r=this.xhr=new gK(n);try{r.open(this.method,this.uri,!0);try{if(this.opts.extraHeaders){r.setDisableHeaderCheck&&r.setDisableHeaderCheck(!0);for(let i in this.opts.extraHeaders)this.opts.extraHeaders.hasOwnProperty(i)&&r.setRequestHeader(i,this.opts.extraHeaders[i])}}catch{}if(this.method==="POST")try{r.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{r.setRequestHeader("Accept","*/*")}catch{}(t=this.opts.cookieJar)===null||t===void 0||t.addCookies(r),"withCredentials"in r&&(r.withCredentials=this.opts.withCredentials),this.opts.requestTimeout&&(r.timeout=this.opts.requestTimeout),r.onreadystatechange=()=>{var i;r.readyState===3&&((i=this.opts.cookieJar)===null||i===void 0||i.parseCookies(r)),r.readyState===4&&(r.status===200||r.status===1223?this.onLoad():this.setTimeoutFn(()=>{this.onError(typeof r.status=="number"?r.status:0)},0))},r.send(this.data)}catch(i){this.setTimeoutFn(()=>{this.onError(i)},0);return}typeof document<"u"&&(this.index=sb.requestsCount++,sb.requests[this.index]=this)}onError(t){this.emitReserved("error",t,this.xhr),this.cleanup(!0)}cleanup(t){if(!(typeof this.xhr>"u"||this.xhr===null)){if(this.xhr.onreadystatechange=_Be,t)try{this.xhr.abort()}catch{}typeof document<"u"&&delete sb.requests[this.index],this.xhr=null}}onLoad(){const t=this.xhr.responseText;t!==null&&(this.emitReserved("data",t),this.emitReserved("success"),this.cleanup())}abort(){this.cleanup()}};Th.requestsCount=0;Th.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",pN);else if(typeof addEventListener=="function"){const e="onpagehide"in ma?"pagehide":"unload";addEventListener(e,pN,!1)}}function pN(){for(let e in Th.requests)Th.requests.hasOwnProperty(e)&&Th.requests[e].abort()}const PP=(()=>typeof Promise=="function"&&typeof Promise.resolve=="function"?t=>Promise.resolve().then(t):(t,n)=>n(t,0))(),g1=ma.WebSocket||ma.MozWebSocket,gN=!0,wBe="arraybuffer",mN=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class CBe extends AP{constructor(t){super(t),this.supportsBinary=!t.forceBase64}get name(){return"websocket"}doOpen(){if(!this.check())return;const t=this.uri(),n=this.opts.protocols,r=mN?{}:dK(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(r.headers=this.opts.extraHeaders);try{this.ws=gN&&!mN?n?new g1(t,n):new g1(t):new g1(t,n,r)}catch(i){return this.emitReserved("error",i)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=t=>this.onClose({description:"websocket connection closed",context:t}),this.ws.onmessage=t=>this.onData(t.data),this.ws.onerror=t=>this.onError("websocket error",t)}write(t){this.writable=!1;for(let n=0;n{const a={};try{gN&&this.ws.send(o)}catch{}i&&PP(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.close(),this.ws=null)}uri(){const t=this.opts.secure?"wss":"ws",n=this.query||{};return this.opts.timestampRequests&&(n[this.opts.timestampParam]=hK()),this.supportsBinary||(n.b64=1),this.createUri(t,n)}check(){return!!g1}}class EBe extends AP{get name(){return"webtransport"}doOpen(){typeof WebTransport=="function"&&(this.transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name]),this.transport.closed.then(()=>{this.onClose()}).catch(t=>{this.onError("webtransport error",t)}),this.transport.ready.then(()=>{this.transport.createBidirectionalStream().then(t=>{const n=lBe(Number.MAX_SAFE_INTEGER,this.socket.binaryType),r=t.readable.pipeThrough(n).getReader(),i=sBe();i.readable.pipeTo(t.writable),this.writer=i.writable.getWriter();const o=()=>{r.read().then(({done:s,value:l})=>{s||(this.onPacket(l),o())}).catch(s=>{})};o();const a={type:"open"};this.query.sid&&(a.data=`{"sid":"${this.query.sid}"}`),this.writer.write(a).then(()=>this.onOpen())})}))}write(t){this.writable=!1;for(let n=0;n{i&&PP(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var t;(t=this.transport)===null||t===void 0||t.close()}}const TBe={websocket:CBe,webtransport:EBe,polling:xBe},kBe=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,ABe=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function $T(e){const t=e,n=e.indexOf("["),r=e.indexOf("]");n!=-1&&r!=-1&&(e=e.substring(0,n)+e.substring(n,r).replace(/:/g,";")+e.substring(r,e.length));let i=kBe.exec(e||""),o={},a=14;for(;a--;)o[ABe[a]]=i[a]||"";return n!=-1&&r!=-1&&(o.source=t,o.host=o.host.substring(1,o.host.length-1).replace(/;/g,":"),o.authority=o.authority.replace("[","").replace("]","").replace(/;/g,":"),o.ipv6uri=!0),o.pathNames=PBe(o,o.path),o.queryKey=IBe(o,o.query),o}function PBe(e,t){const n=/\/{2,9}/g,r=t.replace(n,"/").split("/");return(t.slice(0,1)=="/"||t.length===0)&&r.splice(0,1),t.slice(-1)=="/"&&r.splice(r.length-1,1),r}function IBe(e,t){const n={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(r,i,o){i&&(n[i]=o)}),n}let mK=class kf extends Lr{constructor(t,n={}){super(),this.binaryType=wBe,this.writeBuffer=[],t&&typeof t=="object"&&(n=t,t=null),t?(t=$T(t),n.hostname=t.host,n.secure=t.protocol==="https"||t.protocol==="wss",n.port=t.port,t.query&&(n.query=t.query)):n.host&&(n.hostname=$T(n.host).host),gw(this,n),this.secure=n.secure!=null?n.secure:typeof location<"u"&&location.protocol==="https:",n.hostname&&!n.port&&(n.port=this.secure?"443":"80"),this.hostname=n.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=n.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=n.transports||["polling","websocket","webtransport"],this.writeBuffer=[],this.prevBufferLen=0,this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},n),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=mBe(this.opts.query)),this.id=null,this.upgrades=null,this.pingInterval=null,this.pingTimeout=null,this.pingTimeoutTimer=null,typeof addEventListener=="function"&&(this.opts.closeOnBeforeunload&&(this.beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this.beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this.offlineEventListener=()=>{this.onClose("transport close",{description:"network connection lost"})},addEventListener("offline",this.offlineEventListener,!1))),this.open()}createTransport(t){const n=Object.assign({},this.opts.query);n.EIO=cK,n.transport=t,this.id&&(n.sid=this.id);const r=Object.assign({},this.opts,{query:n,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[t]);return new TBe[t](r)}open(){let t;if(this.opts.rememberUpgrade&&kf.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1)t="websocket";else if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}else t=this.transports[0];this.readyState="opening";try{t=this.createTransport(t)}catch{this.transports.shift(),this.open();return}t.open(),this.setTransport(t)}setTransport(t){this.transport&&this.transport.removeAllListeners(),this.transport=t,t.on("drain",this.onDrain.bind(this)).on("packet",this.onPacket.bind(this)).on("error",this.onError.bind(this)).on("close",n=>this.onClose("transport close",n))}probe(t){let n=this.createTransport(t),r=!1;kf.priorWebsocketSuccess=!1;const i=()=>{r||(n.send([{type:"ping",data:"probe"}]),n.once("packet",d=>{if(!r)if(d.type==="pong"&&d.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",n),!n)return;kf.priorWebsocketSuccess=n.name==="websocket",this.transport.pause(()=>{r||this.readyState!=="closed"&&(c(),this.setTransport(n),n.send([{type:"upgrade"}]),this.emitReserved("upgrade",n),n=null,this.upgrading=!1,this.flush())})}else{const f=new Error("probe error");f.transport=n.name,this.emitReserved("upgradeError",f)}}))};function o(){r||(r=!0,c(),n.close(),n=null)}const a=d=>{const f=new Error("probe error: "+d);f.transport=n.name,o(),this.emitReserved("upgradeError",f)};function s(){a("transport closed")}function l(){a("socket closed")}function u(d){n&&d.name!==n.name&&o()}const c=()=>{n.removeListener("open",i),n.removeListener("error",a),n.removeListener("close",s),this.off("close",l),this.off("upgrading",u)};n.once("open",i),n.once("error",a),n.once("close",s),this.once("close",l),this.once("upgrading",u),this.upgrades.indexOf("webtransport")!==-1&&t!=="webtransport"?this.setTimeoutFn(()=>{r||n.open()},200):n.open()}onOpen(){if(this.readyState="open",kf.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush(),this.readyState==="open"&&this.opts.upgrade){let t=0;const n=this.upgrades.length;for(;t{this.onClose("ping timeout")},this.pingInterval+this.pingTimeout),this.opts.autoUnref&&this.pingTimeoutTimer.unref()}onDrain(){this.writeBuffer.splice(0,this.prevBufferLen),this.prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const t=this.getWritablePackets();this.transport.send(t),this.prevBufferLen=t.length,this.emitReserved("flush")}}getWritablePackets(){if(!(this.maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let n=1;for(let r=0;r0&&n>this.maxPayload)return this.writeBuffer.slice(0,r);n+=2}return this.writeBuffer}write(t,n,r){return this.sendPacket("message",t,n,r),this}send(t,n,r){return this.sendPacket("message",t,n,r),this}sendPacket(t,n,r,i){if(typeof n=="function"&&(i=n,n=void 0),typeof r=="function"&&(i=r,r=null),this.readyState==="closing"||this.readyState==="closed")return;r=r||{},r.compress=r.compress!==!1;const o={type:t,data:n,options:r};this.emitReserved("packetCreate",o),this.writeBuffer.push(o),i&&this.once("flush",i),this.flush()}close(){const t=()=>{this.onClose("forced close"),this.transport.close()},n=()=>{this.off("upgrade",n),this.off("upgradeError",n),t()},r=()=>{this.once("upgrade",n),this.once("upgradeError",n)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?r():t()}):this.upgrading?r():t()),this}onError(t){kf.priorWebsocketSuccess=!1,this.emitReserved("error",t),this.onClose("transport error",t)}onClose(t,n){(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")&&(this.clearTimeoutFn(this.pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),typeof removeEventListener=="function"&&(removeEventListener("beforeunload",this.beforeunloadEventListener,!1),removeEventListener("offline",this.offlineEventListener,!1)),this.readyState="closed",this.id=null,this.emitReserved("close",t,n),this.writeBuffer=[],this.prevBufferLen=0)}filterUpgrades(t){const n=[];let r=0;const i=t.length;for(;rtypeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer,yK=Object.prototype.toString,NBe=typeof Blob=="function"||typeof Blob<"u"&&yK.call(Blob)==="[object BlobConstructor]",$Be=typeof File=="function"||typeof File<"u"&&yK.call(File)==="[object FileConstructor]";function IP(e){return OBe&&(e instanceof ArrayBuffer||MBe(e))||NBe&&e instanceof Blob||$Be&&e instanceof File}function lb(e,t){if(!e||typeof e!="object")return!1;if(Array.isArray(e)){for(let n=0,r=e.length;n=0&&e.num{delete this.acks[t];for(let a=0;a{this.io.clearTimeoutFn(o),n.apply(this,[null,...a])}}emitWithAck(t,...n){const r=this.flags.timeout!==void 0||this._opts.ackTimeout!==void 0;return new Promise((i,o)=>{n.push((a,s)=>r?a?o(a):i(s):i(a)),this.emit(t,...n)})}_addToQueue(t){let n;typeof t[t.length-1]=="function"&&(n=t.pop());const r={id:this._queueSeq++,tryCount:0,pending:!1,args:t,flags:Object.assign({fromQueue:!0},this.flags)};t.push((i,...o)=>r!==this._queue[0]?void 0:(i!==null?r.tryCount>this._opts.retries&&(this._queue.shift(),n&&n(i)):(this._queue.shift(),n&&n(null,...o)),r.pending=!1,this._drainQueue())),this._queue.push(r),this._drainQueue()}_drainQueue(t=!1){if(!this.connected||this._queue.length===0)return;const n=this._queue[0];n.pending&&!t||(n.pending=!0,n.tryCount++,this.flags=n.flags,this.emit.apply(this,n.args))}packet(t){t.nsp=this.nsp,this.io._packet(t)}onopen(){typeof this.auth=="function"?this.auth(t=>{this._sendConnectPacket(t)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(t){this.packet({type:Ft.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},t):t})}onerror(t){this.connected||this.emitReserved("connect_error",t)}onclose(t,n){this.connected=!1,delete this.id,this.emitReserved("disconnect",t,n)}onpacket(t){if(t.nsp===this.nsp)switch(t.type){case Ft.CONNECT:t.data&&t.data.sid?this.onconnect(t.data.sid,t.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case Ft.EVENT:case Ft.BINARY_EVENT:this.onevent(t);break;case Ft.ACK:case Ft.BINARY_ACK:this.onack(t);break;case Ft.DISCONNECT:this.ondisconnect();break;case Ft.CONNECT_ERROR:this.destroy();const r=new Error(t.data.message);r.data=t.data.data,this.emitReserved("connect_error",r);break}}onevent(t){const n=t.data||[];t.id!=null&&n.push(this.ack(t.id)),this.connected?this.emitEvent(n):this.receiveBuffer.push(Object.freeze(n))}emitEvent(t){if(this._anyListeners&&this._anyListeners.length){const n=this._anyListeners.slice();for(const r of n)r.apply(this,t)}super.emit.apply(this,t),this._pid&&t.length&&typeof t[t.length-1]=="string"&&(this._lastOffset=t[t.length-1])}ack(t){const n=this;let r=!1;return function(...i){r||(r=!0,n.packet({type:Ft.ACK,id:t,data:i}))}}onack(t){const n=this.acks[t.id];typeof n=="function"&&(n.apply(this,t.data),delete this.acks[t.id])}onconnect(t,n){this.id=t,this.recovered=n&&this._pid===n,this._pid=n,this.connected=!0,this.emitBuffered(),this.emitReserved("connect"),this._drainQueue(!0)}emitBuffered(){this.receiveBuffer.forEach(t=>this.emitEvent(t)),this.receiveBuffer=[],this.sendBuffer.forEach(t=>{this.notifyOutgoingListeners(t),this.packet(t)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(t=>t()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:Ft.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(t){return this.flags.compress=t,this}get volatile(){return this.flags.volatile=!0,this}timeout(t){return this.flags.timeout=t,this}onAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(t),this}prependAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(t),this}offAny(t){if(!this._anyListeners)return this;if(t){const n=this._anyListeners;for(let r=0;r0&&e.jitter<=1?e.jitter:0,this.attempts=0}Rp.prototype.duration=function(){var e=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var t=Math.random(),n=Math.floor(t*this.jitter*e);e=Math.floor(t*10)&1?e+n:e-n}return Math.min(e,this.max)|0};Rp.prototype.reset=function(){this.attempts=0};Rp.prototype.setMin=function(e){this.ms=e};Rp.prototype.setMax=function(e){this.max=e};Rp.prototype.setJitter=function(e){this.jitter=e};class FT extends Lr{constructor(t,n){var r;super(),this.nsps={},this.subs=[],t&&typeof t=="object"&&(n=t,t=void 0),n=n||{},n.path=n.path||"/socket.io",this.opts=n,gw(this,n),this.reconnection(n.reconnection!==!1),this.reconnectionAttempts(n.reconnectionAttempts||1/0),this.reconnectionDelay(n.reconnectionDelay||1e3),this.reconnectionDelayMax(n.reconnectionDelayMax||5e3),this.randomizationFactor((r=n.randomizationFactor)!==null&&r!==void 0?r:.5),this.backoff=new Rp({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(n.timeout==null?2e4:n.timeout),this._readyState="closed",this.uri=t;const i=n.parser||UBe;this.encoder=new i.Encoder,this.decoder=new i.Decoder,this._autoConnect=n.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(t){return arguments.length?(this._reconnection=!!t,this):this._reconnection}reconnectionAttempts(t){return t===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=t,this)}reconnectionDelay(t){var n;return t===void 0?this._reconnectionDelay:(this._reconnectionDelay=t,(n=this.backoff)===null||n===void 0||n.setMin(t),this)}randomizationFactor(t){var n;return t===void 0?this._randomizationFactor:(this._randomizationFactor=t,(n=this.backoff)===null||n===void 0||n.setJitter(t),this)}reconnectionDelayMax(t){var n;return t===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=t,(n=this.backoff)===null||n===void 0||n.setMax(t),this)}timeout(t){return arguments.length?(this._timeout=t,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(t){if(~this._readyState.indexOf("open"))return this;this.engine=new mK(this.uri,this.opts);const n=this.engine,r=this;this._readyState="opening",this.skipReconnect=!1;const i=Ga(n,"open",function(){r.onopen(),t&&t()}),o=s=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",s),t?t(s):this.maybeReconnectOnOpen()},a=Ga(n,"error",o);if(this._timeout!==!1){const s=this._timeout,l=this.setTimeoutFn(()=>{i(),o(new Error("timeout")),n.close()},s);this.opts.autoUnref&&l.unref(),this.subs.push(()=>{this.clearTimeoutFn(l)})}return this.subs.push(i),this.subs.push(a),this}connect(t){return this.open(t)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const t=this.engine;this.subs.push(Ga(t,"ping",this.onping.bind(this)),Ga(t,"data",this.ondata.bind(this)),Ga(t,"error",this.onerror.bind(this)),Ga(t,"close",this.onclose.bind(this)),Ga(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(t){try{this.decoder.add(t)}catch(n){this.onclose("parse error",n)}}ondecoded(t){PP(()=>{this.emitReserved("packet",t)},this.setTimeoutFn)}onerror(t){this.emitReserved("error",t)}socket(t,n){let r=this.nsps[t];return r?this._autoConnect&&!r.active&&r.connect():(r=new vK(this,t,n),this.nsps[t]=r),r}_destroy(t){const n=Object.keys(this.nsps);for(const r of n)if(this.nsps[r].active)return;this._close()}_packet(t){const n=this.encoder.encode(t);for(let r=0;rt()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close"),this.engine&&this.engine.close()}disconnect(){return this._close()}onclose(t,n){this.cleanup(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",t,n),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const t=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const n=this.backoff.duration();this._reconnecting=!0;const r=this.setTimeoutFn(()=>{t.skipReconnect||(this.emitReserved("reconnect_attempt",t.backoff.attempts),!t.skipReconnect&&t.open(i=>{i?(t._reconnecting=!1,t.reconnect(),this.emitReserved("reconnect_error",i)):t.onreconnect()}))},n);this.opts.autoUnref&&r.unref(),this.subs.push(()=>{this.clearTimeoutFn(r)})}}onreconnect(){const t=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",t)}}const fg={};function ub(e,t){typeof e=="object"&&(t=e,e=void 0),t=t||{};const n=RBe(e,t.path||"/socket.io"),r=n.source,i=n.id,o=n.path,a=fg[i]&&o in fg[i].nsps,s=t.forceNew||t["force new connection"]||t.multiplex===!1||a;let l;return s?l=new FT(r,t):(fg[i]||(fg[i]=new FT(r,t)),l=fg[i]),n.query&&!t.query&&(t.query=n.queryKey),l.socket(n.path,t)}Object.assign(ub,{Manager:FT,Socket:vK,io:ub,connect:ub});const vN=()=>{let e=!1,n=`${window.location.protocol==="https:"?"wss":"ws"}://${window.location.host}`;const r={timeout:6e4,path:"/ws/socket.io",autoConnect:!1};if(["nodes","package"].includes("production")){const a=a0.get();a&&(n=a.replace(/^https?\:\/\//i,""));const s=Jh.get();s&&(r.auth={token:s}),r.transports=["websocket","polling"]}const i=ub(n,r);return a=>s=>l=>{e||(eBe({storeApi:a,socket:i}),e=!0,i.connect()),s(l)}},GBe=""+new URL("logo-13003d72.png",import.meta.url).href,qBe=()=>W.jsxs(EP,{position:"relative",width:"100vw",height:"100vh",alignItems:"center",justifyContent:"center",bg:"#151519",children:[W.jsx(CP,{src:GBe,w:"8rem",h:"8rem"}),W.jsx(SP,{label:"Loading",color:"grey",position:"absolute",size:"sm",width:"24px !important",height:"24px !important",right:"1.5rem",bottom:"1.5rem"})]}),HBe=I.memo(qBe);function BT(e){"@babel/helpers - typeof";return BT=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},BT(e)}var bK=[],WBe=bK.forEach,KBe=bK.slice;function zT(e){return WBe.call(KBe.call(arguments,1),function(t){if(t)for(var n in t)e[n]===void 0&&(e[n]=t[n])}),e}function _K(){return typeof XMLHttpRequest=="function"||(typeof XMLHttpRequest>"u"?"undefined":BT(XMLHttpRequest))==="object"}function QBe(e){return!!e&&typeof e.then=="function"}function XBe(e){return QBe(e)?e:Promise.resolve(e)}function YBe(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var jT={exports:{}},m1={exports:{}},bN;function ZBe(){return bN||(bN=1,function(e,t){var n=typeof self<"u"?self:yt,r=function(){function o(){this.fetch=!1,this.DOMException=n.DOMException}return o.prototype=n,new o}();(function(o){(function(a){var s={searchParams:"URLSearchParams"in o,iterable:"Symbol"in o&&"iterator"in Symbol,blob:"FileReader"in o&&"Blob"in o&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in o,arrayBuffer:"ArrayBuffer"in o};function l(E){return E&&DataView.prototype.isPrototypeOf(E)}if(s.arrayBuffer)var u=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],c=ArrayBuffer.isView||function(E){return E&&u.indexOf(Object.prototype.toString.call(E))>-1};function d(E){if(typeof E!="string"&&(E=String(E)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(E))throw new TypeError("Invalid character in header field name");return E.toLowerCase()}function f(E){return typeof E!="string"&&(E=String(E)),E}function h(E){var A={next:function(){var D=E.shift();return{done:D===void 0,value:D}}};return s.iterable&&(A[Symbol.iterator]=function(){return A}),A}function p(E){this.map={},E instanceof p?E.forEach(function(A,D){this.append(D,A)},this):Array.isArray(E)?E.forEach(function(A){this.append(A[0],A[1])},this):E&&Object.getOwnPropertyNames(E).forEach(function(A){this.append(A,E[A])},this)}p.prototype.append=function(E,A){E=d(E),A=f(A);var D=this.map[E];this.map[E]=D?D+", "+A:A},p.prototype.delete=function(E){delete this.map[d(E)]},p.prototype.get=function(E){return E=d(E),this.has(E)?this.map[E]:null},p.prototype.has=function(E){return this.map.hasOwnProperty(d(E))},p.prototype.set=function(E,A){this.map[d(E)]=f(A)},p.prototype.forEach=function(E,A){for(var D in this.map)this.map.hasOwnProperty(D)&&E.call(A,this.map[D],D,this)},p.prototype.keys=function(){var E=[];return this.forEach(function(A,D){E.push(D)}),h(E)},p.prototype.values=function(){var E=[];return this.forEach(function(A){E.push(A)}),h(E)},p.prototype.entries=function(){var E=[];return this.forEach(function(A,D){E.push([D,A])}),h(E)},s.iterable&&(p.prototype[Symbol.iterator]=p.prototype.entries);function m(E){if(E.bodyUsed)return Promise.reject(new TypeError("Already read"));E.bodyUsed=!0}function _(E){return new Promise(function(A,D){E.onload=function(){A(E.result)},E.onerror=function(){D(E.error)}})}function b(E){var A=new FileReader,D=_(A);return A.readAsArrayBuffer(E),D}function v(E){var A=new FileReader,D=_(A);return A.readAsText(E),D}function g(E){for(var A=new Uint8Array(E),D=new Array(A.length),L=0;L-1?A:E}function C(E,A){A=A||{};var D=A.body;if(E instanceof C){if(E.bodyUsed)throw new TypeError("Already read");this.url=E.url,this.credentials=E.credentials,A.headers||(this.headers=new p(E.headers)),this.method=E.method,this.mode=E.mode,this.signal=E.signal,!D&&E._bodyInit!=null&&(D=E._bodyInit,E.bodyUsed=!0)}else this.url=String(E);if(this.credentials=A.credentials||this.credentials||"same-origin",(A.headers||!this.headers)&&(this.headers=new p(A.headers)),this.method=x(A.method||this.method||"GET"),this.mode=A.mode||this.mode||null,this.signal=A.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&D)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(D)}C.prototype.clone=function(){return new C(this,{body:this._bodyInit})};function k(E){var A=new FormData;return E.trim().split("&").forEach(function(D){if(D){var L=D.split("="),M=L.shift().replace(/\+/g," "),R=L.join("=").replace(/\+/g," ");A.append(decodeURIComponent(M),decodeURIComponent(R))}}),A}function T(E){var A=new p,D=E.replace(/\r?\n[\t ]+/g," ");return D.split(/\r?\n/).forEach(function(L){var M=L.split(":"),R=M.shift().trim();if(R){var N=M.join(":").trim();A.append(R,N)}}),A}S.call(C.prototype);function P(E,A){A||(A={}),this.type="default",this.status=A.status===void 0?200:A.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in A?A.statusText:"OK",this.headers=new p(A.headers),this.url=A.url||"",this._initBody(E)}S.call(P.prototype),P.prototype.clone=function(){return new P(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new p(this.headers),url:this.url})},P.error=function(){var E=new P(null,{status:0,statusText:""});return E.type="error",E};var $=[301,302,303,307,308];P.redirect=function(E,A){if($.indexOf(A)===-1)throw new RangeError("Invalid status code");return new P(null,{status:A,headers:{location:E}})},a.DOMException=o.DOMException;try{new a.DOMException}catch{a.DOMException=function(A,D){this.message=A,this.name=D;var L=Error(A);this.stack=L.stack},a.DOMException.prototype=Object.create(Error.prototype),a.DOMException.prototype.constructor=a.DOMException}function O(E,A){return new Promise(function(D,L){var M=new C(E,A);if(M.signal&&M.signal.aborted)return L(new a.DOMException("Aborted","AbortError"));var R=new XMLHttpRequest;function N(){R.abort()}R.onload=function(){var B={status:R.status,statusText:R.statusText,headers:T(R.getAllResponseHeaders()||"")};B.url="responseURL"in R?R.responseURL:B.headers.get("X-Request-URL");var U="response"in R?R.response:R.responseText;D(new P(U,B))},R.onerror=function(){L(new TypeError("Network request failed"))},R.ontimeout=function(){L(new TypeError("Network request failed"))},R.onabort=function(){L(new a.DOMException("Aborted","AbortError"))},R.open(M.method,M.url,!0),M.credentials==="include"?R.withCredentials=!0:M.credentials==="omit"&&(R.withCredentials=!1),"responseType"in R&&s.blob&&(R.responseType="blob"),M.headers.forEach(function(B,U){R.setRequestHeader(U,B)}),M.signal&&(M.signal.addEventListener("abort",N),R.onreadystatechange=function(){R.readyState===4&&M.signal.removeEventListener("abort",N)}),R.send(typeof M._bodyInit>"u"?null:M._bodyInit)})}return O.polyfill=!0,o.fetch||(o.fetch=O,o.Headers=p,o.Request=C,o.Response=P),a.Headers=p,a.Request=C,a.Response=P,a.fetch=O,Object.defineProperty(a,"__esModule",{value:!0}),a})({})})(r),r.fetch.ponyfill=!0,delete r.fetch.polyfill;var i=r;t=i.fetch,t.default=i.fetch,t.fetch=i.fetch,t.Headers=i.Headers,t.Request=i.Request,t.Response=i.Response,e.exports=t}(m1,m1.exports)),m1.exports}(function(e,t){var n;if(typeof fetch=="function"&&(typeof yt<"u"&&yt.fetch?n=yt.fetch:typeof window<"u"&&window.fetch?n=window.fetch:n=fetch),typeof YBe<"u"&&(typeof window>"u"||typeof window.document>"u")){var r=n||ZBe();r.default&&(r=r.default),t.default=r,e.exports=t.default}})(jT,jT.exports);var SK=jT.exports;const xK=mc(SK),_N=jN({__proto__:null,default:xK},[SK]);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)}var Bl;typeof fetch=="function"&&(typeof global<"u"&&global.fetch?Bl=global.fetch:typeof window<"u"&&window.fetch?Bl=window.fetch:Bl=fetch);var M0;_K()&&(typeof global<"u"&&global.XMLHttpRequest?M0=global.XMLHttpRequest:typeof window<"u"&&window.XMLHttpRequest&&(M0=window.XMLHttpRequest));var aS;typeof ActiveXObject=="function"&&(typeof global<"u"&&global.ActiveXObject?aS=global.ActiveXObject:typeof window<"u"&&window.ActiveXObject&&(aS=window.ActiveXObject));!Bl&&_N&&!M0&&!aS&&(Bl=xK||_N);typeof Bl!="function"&&(Bl=void 0);var UT=function(t,n){if(n&&oS(n)==="object"){var r="";for(var i in n)r+="&"+encodeURIComponent(i)+"="+encodeURIComponent(n[i]);if(!r)return t;t=t+(t.indexOf("?")!==-1?"&":"?")+r.slice(1)}return t},SN=function(t,n,r){Bl(t,n).then(function(i){if(!i.ok)return r(i.statusText||"Error",{status:i.status});i.text().then(function(o){r(null,{status:i.status,data:o})}).catch(r)}).catch(r)},xN=!1,JBe=function(t,n,r,i){t.queryStringParams&&(n=UT(n,t.queryStringParams));var o=zT({},typeof t.customHeaders=="function"?t.customHeaders():t.customHeaders);r&&(o["Content-Type"]="application/json");var a=typeof t.requestOptions=="function"?t.requestOptions(r):t.requestOptions,s=zT({method:r?"POST":"GET",body:r?t.stringify(r):void 0,headers:o},xN?{}:a);try{SN(n,s,i)}catch(l){if(!a||Object.keys(a).length===0||!l.message||l.message.indexOf("not implemented")<0)return i(l);try{Object.keys(a).forEach(function(u){delete s[u]}),SN(n,s,i),xN=!0}catch(u){i(u)}}},eze=function(t,n,r,i){r&&oS(r)==="object"&&(r=UT("",r).slice(1)),t.queryStringParams&&(n=UT(n,t.queryStringParams));try{var o;M0?o=new M0:o=new aS("MSXML2.XMLHTTP.3.0"),o.open(r?"POST":"GET",n,1),t.crossDomain||o.setRequestHeader("X-Requested-With","XMLHttpRequest"),o.withCredentials=!!t.withCredentials,r&&o.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),o.overrideMimeType&&o.overrideMimeType("application/json");var a=t.customHeaders;if(a=typeof a=="function"?a():a,a)for(var s in a)o.setRequestHeader(s,a[s]);o.onreadystatechange=function(){o.readyState>3&&i(o.status>=400?o.statusText:null,{status:o.status,data:o.responseText})},o.send(r)}catch(l){console&&console.log(l)}},tze=function(t,n,r,i){if(typeof r=="function"&&(i=r,r=void 0),i=i||function(){},Bl&&n.indexOf("file:")!==0)return JBe(t,n,r,i);if(_K()||typeof ActiveXObject=="function")return eze(t,n,r,i);i(new Error("No fetch and no xhr implementation found!"))};function N0(e){"@babel/helpers - typeof";return N0=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},N0(e)}function nze(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function wN(e,t){for(var n=0;n1&&arguments[1]!==void 0?arguments[1]:{},r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};nze(this,e),this.services=t,this.options=n,this.allOptions=r,this.type="backend",this.init(t,n,r)}return rze(e,[{key:"init",value:function(n){var r=this,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};this.services=n,this.options=zT(i,this.options||{},aze()),this.allOptions=o,this.services&&this.options.reloadInterval&&setInterval(function(){return r.reload()},this.options.reloadInterval)}},{key:"readMulti",value:function(n,r,i){this._readAny(n,n,r,r,i)}},{key:"read",value:function(n,r,i){this._readAny([n],n,[r],r,i)}},{key:"_readAny",value:function(n,r,i,o,a){var s=this,l=this.options.loadPath;typeof this.options.loadPath=="function"&&(l=this.options.loadPath(n,i)),l=XBe(l),l.then(function(u){if(!u)return a(null,{});var c=s.services.interpolator.interpolate(u,{lng:n.join("+"),ns:i.join("+")});s.loadUrl(c,a,r,o)})}},{key:"loadUrl",value:function(n,r,i,o){var a=this,s=typeof i=="string"?[i]:i,l=typeof o=="string"?[o]:o,u=this.options.parseLoadPayload(s,l);this.options.request(this.options,n,u,function(c,d){if(d&&(d.status>=500&&d.status<600||!d.status))return r("failed loading "+n+"; status code: "+d.status,!0);if(d&&d.status>=400&&d.status<500)return r("failed loading "+n+"; status code: "+d.status,!1);if(!d&&c&&c.message&&c.message.indexOf("Failed to fetch")>-1)return r("failed loading "+n+": "+c.message,!0);if(c)return r(c,!1);var f,h;try{typeof d.data=="string"?f=a.options.parse(d.data,i,o):f=d.data}catch{h="failed parsing "+n+" to json"}if(h)return r(h,!1);r(null,f)})}},{key:"create",value:function(n,r,i,o,a){var s=this;if(this.options.addPath){typeof n=="string"&&(n=[n]);var l=this.options.parsePayload(r,i,o),u=0,c=[],d=[];n.forEach(function(f){var h=s.options.addPath;typeof s.options.addPath=="function"&&(h=s.options.addPath(f,r));var p=s.services.interpolator.interpolate(h,{lng:f,ns:r});s.options.request(s.options,p,l,function(m,_){u+=1,c.push(m),d.push(_),u===n.length&&typeof a=="function"&&a(c,d)})})}}},{key:"reload",value:function(){var n=this,r=this.services,i=r.backendConnector,o=r.languageUtils,a=r.logger,s=i.language;if(!(s&&s.toLowerCase()==="cimode")){var l=[],u=function(d){var f=o.toResolveHierarchy(d);f.forEach(function(h){l.indexOf(h)<0&&l.push(h)})};u(s),this.allOptions.preload&&this.allOptions.preload.forEach(function(c){return u(c)}),l.forEach(function(c){n.allOptions.ns.forEach(function(d){i.read(c,d,"read",null,null,function(f,h){f&&a.warn("loading namespace ".concat(d," for language ").concat(c," failed"),f),!f&&h&&a.log("loaded namespace ".concat(d," for language ").concat(c),h),i.loaded("".concat(c,"|").concat(d),f,h)})})})}}}]),e}();CK.type="backend";be.use(CK).use(z4e).init({fallbackLng:"en",debug:!1,backend:{loadPath:"/locales/{{lng}}.json"},interpolation:{escapeValue:!1},returnNull:!1});const mw=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Op(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function OP(e){return"nodeType"in e}function co(e){var t,n;return e?Op(e)?e:OP(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function MP(e){const{Document:t}=co(e);return e instanceof t}function By(e){return Op(e)?!1:e instanceof co(e).HTMLElement}function sze(e){return e instanceof co(e).SVGElement}function Mp(e){return e?Op(e)?e.document:OP(e)?MP(e)?e:By(e)?e.ownerDocument:document:document:document}const Js=mw?I.useLayoutEffect:I.useEffect;function yw(e){const t=I.useRef(e);return Js(()=>{t.current=e}),I.useCallback(function(){for(var n=arguments.length,r=new Array(n),i=0;i{e.current=setInterval(r,i)},[]),n=I.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,n]}function $0(e,t){t===void 0&&(t=[e]);const n=I.useRef(e);return Js(()=>{n.current!==e&&(n.current=e)},t),n}function zy(e,t){const n=I.useRef();return I.useMemo(()=>{const r=e(n.current);return n.current=r,r},[...t])}function sS(e){const t=yw(e),n=I.useRef(null),r=I.useCallback(i=>{i!==n.current&&(t==null||t(i,n.current)),n.current=i},[]);return[n,r]}function lS(e){const t=I.useRef();return I.useEffect(()=>{t.current=e},[e]),t.current}let B5={};function vw(e,t){return I.useMemo(()=>{if(t)return t;const n=B5[e]==null?0:B5[e]+1;return B5[e]=n,e+"-"+n},[e,t])}function EK(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i{const s=Object.entries(a);for(const[l,u]of s){const c=o[l];c!=null&&(o[l]=c+e*u)}return o},{...t})}}const kh=EK(1),uS=EK(-1);function uze(e){return"clientX"in e&&"clientY"in e}function NP(e){if(!e)return!1;const{KeyboardEvent:t}=co(e.target);return t&&e instanceof t}function cze(e){if(!e)return!1;const{TouchEvent:t}=co(e.target);return t&&e instanceof t}function D0(e){if(cze(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return uze(e)?{x:e.clientX,y:e.clientY}:null}const L0=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:n}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:n}=e;return"scaleX("+t+") scaleY("+n+")"}},Transform:{toString(e){if(e)return[L0.Translate.toString(e),L0.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+" "+n+"ms "+r}}}),CN="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function dze(e){return e.matches(CN)?e:e.querySelector(CN)}const fze={display:"none"};function hze(e){let{id:t,value:n}=e;return En.createElement("div",{id:t,style:fze},n)}const pze={position:"fixed",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};function gze(e){let{id:t,announcement:n}=e;return En.createElement("div",{id:t,style:pze,role:"status","aria-live":"assertive","aria-atomic":!0},n)}function mze(){const[e,t]=I.useState("");return{announce:I.useCallback(r=>{r!=null&&t(r)},[]),announcement:e}}const TK=I.createContext(null);function yze(e){const t=I.useContext(TK);I.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of ");return t(e)},[e,t])}function vze(){const[e]=I.useState(()=>new Set),t=I.useCallback(r=>(e.add(r),()=>e.delete(r)),[e]);return[I.useCallback(r=>{let{type:i,event:o}=r;e.forEach(a=>{var s;return(s=a[i])==null?void 0:s.call(a,o)})},[e]),t]}const bze={draggable:` + To pick up a draggable item, press the space bar. + While dragging, use the arrow keys to move the item. + Press space again to drop the item in its new position, or press escape to cancel. + `},_ze={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was moved over droppable area "+n.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was dropped over droppable area "+n.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function Sze(e){let{announcements:t=_ze,container:n,hiddenTextDescribedById:r,screenReaderInstructions:i=bze}=e;const{announce:o,announcement:a}=mze(),s=vw("DndLiveRegion"),[l,u]=I.useState(!1);if(I.useEffect(()=>{u(!0)},[]),yze(I.useMemo(()=>({onDragStart(d){let{active:f}=d;o(t.onDragStart({active:f}))},onDragMove(d){let{active:f,over:h}=d;t.onDragMove&&o(t.onDragMove({active:f,over:h}))},onDragOver(d){let{active:f,over:h}=d;o(t.onDragOver({active:f,over:h}))},onDragEnd(d){let{active:f,over:h}=d;o(t.onDragEnd({active:f,over:h}))},onDragCancel(d){let{active:f,over:h}=d;o(t.onDragCancel({active:f,over:h}))}}),[o,t])),!l)return null;const c=En.createElement(En.Fragment,null,En.createElement(hze,{id:r,value:i.draggable}),En.createElement(gze,{id:s,announcement:a}));return n?Uo.createPortal(c,n):c}var qr;(function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"})(qr||(qr={}));function cS(){}function EN(e,t){return I.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function xze(){for(var e=arguments.length,t=new Array(e),n=0;n[...t].filter(r=>r!=null),[...t])}const us=Object.freeze({x:0,y:0});function wze(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Cze(e,t){const n=D0(e);if(!n)return"0 0";const r={x:(n.x-t.left)/t.width*100,y:(n.y-t.top)/t.height*100};return r.x+"% "+r.y+"%"}function Eze(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function Tze(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function kze(e){let{left:t,top:n,height:r,width:i}=e;return[{x:t,y:n},{x:t+i,y:n},{x:t,y:n+r},{x:t+i,y:n+r}]}function Aze(e,t){if(!e||e.length===0)return null;const[n]=e;return t?n[t]:n}function Pze(e,t){const n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),i=Math.min(t.left+t.width,e.left+e.width),o=Math.min(t.top+t.height,e.top+e.height),a=i-r,s=o-n;if(r{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const i=[];for(const o of r){const{id:a}=o,s=n.get(a);if(s){const l=Pze(s,t);l>0&&i.push({id:a,data:{droppableContainer:o,value:l}})}}return i.sort(Tze)};function Rze(e,t){const{top:n,left:r,bottom:i,right:o}=t;return n<=e.y&&e.y<=i&&r<=e.x&&e.x<=o}const Oze=e=>{let{droppableContainers:t,droppableRects:n,pointerCoordinates:r}=e;if(!r)return[];const i=[];for(const o of t){const{id:a}=o,s=n.get(a);if(s&&Rze(r,s)){const u=kze(s).reduce((d,f)=>d+wze(r,f),0),c=Number((u/4).toFixed(4));i.push({id:a,data:{droppableContainer:o,value:c}})}}return i.sort(Eze)};function Mze(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function kK(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:us}function Nze(e){return function(n){for(var r=arguments.length,i=new Array(r>1?r-1:0),o=1;o({...a,top:a.top+e*s.y,bottom:a.bottom+e*s.y,left:a.left+e*s.x,right:a.right+e*s.x}),{...n})}}const $ze=Nze(1);function AK(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function Dze(e,t,n){const r=AK(t);if(!r)return e;const{scaleX:i,scaleY:o,x:a,y:s}=r,l=e.left-a-(1-i)*parseFloat(n),u=e.top-s-(1-o)*parseFloat(n.slice(n.indexOf(" ")+1)),c=i?e.width/i:e.width,d=o?e.height/o:e.height;return{width:c,height:d,top:u,right:l+c,bottom:u+d,left:l}}const Lze={ignoreTransform:!1};function jy(e,t){t===void 0&&(t=Lze);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:u,transformOrigin:c}=co(e).getComputedStyle(e);u&&(n=Dze(n,u,c))}const{top:r,left:i,width:o,height:a,bottom:s,right:l}=n;return{top:r,left:i,width:o,height:a,bottom:s,right:l}}function TN(e){return jy(e,{ignoreTransform:!0})}function Fze(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function Bze(e,t){return t===void 0&&(t=co(e).getComputedStyle(e)),t.position==="fixed"}function zze(e,t){t===void 0&&(t=co(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(i=>{const o=t[i];return typeof o=="string"?n.test(o):!1})}function $P(e,t){const n=[];function r(i){if(t!=null&&n.length>=t||!i)return n;if(MP(i)&&i.scrollingElement!=null&&!n.includes(i.scrollingElement))return n.push(i.scrollingElement),n;if(!By(i)||sze(i)||n.includes(i))return n;const o=co(e).getComputedStyle(i);return i!==e&&zze(i,o)&&n.push(i),Bze(i,o)?n:r(i.parentNode)}return e?r(e):n}function PK(e){const[t]=$P(e,1);return t??null}function z5(e){return!mw||!e?null:Op(e)?e:OP(e)?MP(e)||e===Mp(e).scrollingElement?window:By(e)?e:null:null}function IK(e){return Op(e)?e.scrollX:e.scrollLeft}function RK(e){return Op(e)?e.scrollY:e.scrollTop}function VT(e){return{x:IK(e),y:RK(e)}}var ui;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(ui||(ui={}));function OK(e){return!mw||!e?!1:e===document.scrollingElement}function MK(e){const t={x:0,y:0},n=OK(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height},i=e.scrollTop<=t.y,o=e.scrollLeft<=t.x,a=e.scrollTop>=r.y,s=e.scrollLeft>=r.x;return{isTop:i,isLeft:o,isBottom:a,isRight:s,maxScroll:r,minScroll:t}}const jze={x:.2,y:.2};function Uze(e,t,n,r,i){let{top:o,left:a,right:s,bottom:l}=n;r===void 0&&(r=10),i===void 0&&(i=jze);const{isTop:u,isBottom:c,isLeft:d,isRight:f}=MK(e),h={x:0,y:0},p={x:0,y:0},m={height:t.height*i.y,width:t.width*i.x};return!u&&o<=t.top+m.height?(h.y=ui.Backward,p.y=r*Math.abs((t.top+m.height-o)/m.height)):!c&&l>=t.bottom-m.height&&(h.y=ui.Forward,p.y=r*Math.abs((t.bottom-m.height-l)/m.height)),!f&&s>=t.right-m.width?(h.x=ui.Forward,p.x=r*Math.abs((t.right-m.width-s)/m.width)):!d&&a<=t.left+m.width&&(h.x=ui.Backward,p.x=r*Math.abs((t.left+m.width-a)/m.width)),{direction:h,speed:p}}function Vze(e){if(e===document.scrollingElement){const{innerWidth:o,innerHeight:a}=window;return{top:0,left:0,right:o,bottom:a,width:o,height:a}}const{top:t,left:n,right:r,bottom:i}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:i,width:e.clientWidth,height:e.clientHeight}}function NK(e){return e.reduce((t,n)=>kh(t,VT(n)),us)}function Gze(e){return e.reduce((t,n)=>t+IK(n),0)}function qze(e){return e.reduce((t,n)=>t+RK(n),0)}function $K(e,t){if(t===void 0&&(t=jy),!e)return;const{top:n,left:r,bottom:i,right:o}=t(e);PK(e)&&(i<=0||o<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const Hze=[["x",["left","right"],Gze],["y",["top","bottom"],qze]];class DP{constructor(t,n){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const r=$P(n),i=NK(r);this.rect={...t},this.width=t.width,this.height=t.height;for(const[o,a,s]of Hze)for(const l of a)Object.defineProperty(this,l,{get:()=>{const u=s(r),c=i[o]-u;return this.rect[l]+c},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class am{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var r;return(r=this.target)==null?void 0:r.removeEventListener(...n)})},this.target=t}add(t,n,r){var i;(i=this.target)==null||i.addEventListener(t,n,r),this.listeners.push([t,n,r])}}function Wze(e){const{EventTarget:t}=co(e);return e instanceof t?e:Mp(e)}function j5(e,t){const n=Math.abs(e.x),r=Math.abs(e.y);return typeof t=="number"?Math.sqrt(n**2+r**2)>t:"x"in t&&"y"in t?n>t.x&&r>t.y:"x"in t?n>t.x:"y"in t?r>t.y:!1}var ha;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(ha||(ha={}));function kN(e){e.preventDefault()}function Kze(e){e.stopPropagation()}var On;(function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter"})(On||(On={}));const DK={start:[On.Space,On.Enter],cancel:[On.Esc],end:[On.Space,On.Enter]},Qze=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case On.Right:return{...n,x:n.x+25};case On.Left:return{...n,x:n.x-25};case On.Down:return{...n,y:n.y+25};case On.Up:return{...n,y:n.y-25}}};class LK{constructor(t){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=t;const{event:{target:n}}=t;this.props=t,this.listeners=new am(Mp(n)),this.windowListeners=new am(co(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(ha.Resize,this.handleCancel),this.windowListeners.add(ha.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(ha.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,r=t.node.current;r&&$K(r),n(us)}handleKeyDown(t){if(NP(t)){const{active:n,context:r,options:i}=this.props,{keyboardCodes:o=DK,coordinateGetter:a=Qze,scrollBehavior:s="smooth"}=i,{code:l}=t;if(o.end.includes(l)){this.handleEnd(t);return}if(o.cancel.includes(l)){this.handleCancel(t);return}const{collisionRect:u}=r.current,c=u?{x:u.left,y:u.top}:us;this.referenceCoordinates||(this.referenceCoordinates=c);const d=a(t,{active:n,context:r.current,currentCoordinates:c});if(d){const f=uS(d,c),h={x:0,y:0},{scrollableAncestors:p}=r.current;for(const m of p){const _=t.code,{isTop:b,isRight:v,isLeft:g,isBottom:y,maxScroll:S,minScroll:w}=MK(m),x=Vze(m),C={x:Math.min(_===On.Right?x.right-x.width/2:x.right,Math.max(_===On.Right?x.left:x.left+x.width/2,d.x)),y:Math.min(_===On.Down?x.bottom-x.height/2:x.bottom,Math.max(_===On.Down?x.top:x.top+x.height/2,d.y))},k=_===On.Right&&!v||_===On.Left&&!g,T=_===On.Down&&!y||_===On.Up&&!b;if(k&&C.x!==d.x){const P=m.scrollLeft+f.x,$=_===On.Right&&P<=S.x||_===On.Left&&P>=w.x;if($&&!f.y){m.scrollTo({left:P,behavior:s});return}$?h.x=m.scrollLeft-P:h.x=_===On.Right?m.scrollLeft-S.x:m.scrollLeft-w.x,h.x&&m.scrollBy({left:-h.x,behavior:s});break}else if(T&&C.y!==d.y){const P=m.scrollTop+f.y,$=_===On.Down&&P<=S.y||_===On.Up&&P>=w.y;if($&&!f.x){m.scrollTo({top:P,behavior:s});return}$?h.y=m.scrollTop-P:h.y=_===On.Down?m.scrollTop-S.y:m.scrollTop-w.y,h.y&&m.scrollBy({top:-h.y,behavior:s});break}}this.handleMove(t,kh(uS(d,this.referenceCoordinates),h))}}}handleMove(t,n){const{onMove:r}=this.props;t.preventDefault(),r(n)}handleEnd(t){const{onEnd:n}=this.props;t.preventDefault(),this.detach(),n()}handleCancel(t){const{onCancel:n}=this.props;t.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}LK.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:r=DK,onActivation:i}=t,{active:o}=n;const{code:a}=e.nativeEvent;if(r.start.includes(a)){const s=o.activatorNode.current;return s&&e.target!==s?!1:(e.preventDefault(),i==null||i({event:e.nativeEvent}),!0)}return!1}}];function AN(e){return!!(e&&"distance"in e)}function PN(e){return!!(e&&"delay"in e)}class LP{constructor(t,n,r){var i;r===void 0&&(r=Wze(t.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=t,this.events=n;const{event:o}=t,{target:a}=o;this.props=t,this.events=n,this.document=Mp(a),this.documentListeners=new am(this.document),this.listeners=new am(r),this.windowListeners=new am(co(a)),this.initialCoordinates=(i=D0(o))!=null?i:us,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:t,props:{options:{activationConstraint:n}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),this.windowListeners.add(ha.Resize,this.handleCancel),this.windowListeners.add(ha.DragStart,kN),this.windowListeners.add(ha.VisibilityChange,this.handleCancel),this.windowListeners.add(ha.ContextMenu,kN),this.documentListeners.add(ha.Keydown,this.handleKeydown),n){if(AN(n))return;if(PN(n)){this.timeoutId=setTimeout(this.handleStart,n.delay);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handleStart(){const{initialCoordinates:t}=this,{onStart:n}=this.props;t&&(this.activated=!0,this.documentListeners.add(ha.Click,Kze,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(ha.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){var n;const{activated:r,initialCoordinates:i,props:o}=this,{onMove:a,options:{activationConstraint:s}}=o;if(!i)return;const l=(n=D0(t))!=null?n:us,u=uS(i,l);if(!r&&s){if(PN(s))return j5(u,s.tolerance)?this.handleCancel():void 0;if(AN(s))return s.tolerance!=null&&j5(u,s.tolerance)?this.handleCancel():j5(u,s.distance)?this.handleStart():void 0}t.cancelable&&t.preventDefault(),a(l)}handleEnd(){const{onEnd:t}=this.props;this.detach(),t()}handleCancel(){const{onCancel:t}=this.props;this.detach(),t()}handleKeydown(t){t.code===On.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const Xze={move:{name:"pointermove"},end:{name:"pointerup"}};class FK extends LP{constructor(t){const{event:n}=t,r=Mp(n.target);super(t,Xze,r)}}FK.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r==null||r({event:n}),!0)}}];const Yze={move:{name:"mousemove"},end:{name:"mouseup"}};var GT;(function(e){e[e.RightClick=2]="RightClick"})(GT||(GT={}));class BK extends LP{constructor(t){super(t,Yze,Mp(t.event.target))}}BK.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===GT.RightClick?!1:(r==null||r({event:n}),!0)}}];const U5={move:{name:"touchmove"},end:{name:"touchend"}};class zK extends LP{constructor(t){super(t,U5)}static setup(){return window.addEventListener(U5.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(U5.move.name,t)};function t(){}}}zK.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;const{touches:i}=n;return i.length>1?!1:(r==null||r({event:n}),!0)}}];var sm;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(sm||(sm={}));var dS;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(dS||(dS={}));function Zze(e){let{acceleration:t,activator:n=sm.Pointer,canScroll:r,draggingRect:i,enabled:o,interval:a=5,order:s=dS.TreeOrder,pointerCoordinates:l,scrollableAncestors:u,scrollableAncestorRects:c,delta:d,threshold:f}=e;const h=eje({delta:d,disabled:!o}),[p,m]=lze(),_=I.useRef({x:0,y:0}),b=I.useRef({x:0,y:0}),v=I.useMemo(()=>{switch(n){case sm.Pointer:return l?{top:l.y,bottom:l.y,left:l.x,right:l.x}:null;case sm.DraggableRect:return i}},[n,i,l]),g=I.useRef(null),y=I.useCallback(()=>{const w=g.current;if(!w)return;const x=_.current.x*b.current.x,C=_.current.y*b.current.y;w.scrollBy(x,C)},[]),S=I.useMemo(()=>s===dS.TreeOrder?[...u].reverse():u,[s,u]);I.useEffect(()=>{if(!o||!u.length||!v){m();return}for(const w of S){if((r==null?void 0:r(w))===!1)continue;const x=u.indexOf(w),C=c[x];if(!C)continue;const{direction:k,speed:T}=Uze(w,C,v,t,f);for(const P of["x","y"])h[P][k[P]]||(T[P]=0,k[P]=0);if(T.x>0||T.y>0){m(),g.current=w,p(y,a),_.current=T,b.current=k;return}}_.current={x:0,y:0},b.current={x:0,y:0},m()},[t,y,r,m,o,a,JSON.stringify(v),JSON.stringify(h),p,u,S,c,JSON.stringify(f)])}const Jze={x:{[ui.Backward]:!1,[ui.Forward]:!1},y:{[ui.Backward]:!1,[ui.Forward]:!1}};function eje(e){let{delta:t,disabled:n}=e;const r=lS(t);return zy(i=>{if(n||!r||!i)return Jze;const o={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[ui.Backward]:i.x[ui.Backward]||o.x===-1,[ui.Forward]:i.x[ui.Forward]||o.x===1},y:{[ui.Backward]:i.y[ui.Backward]||o.y===-1,[ui.Forward]:i.y[ui.Forward]||o.y===1}}},[n,t,r])}function tje(e,t){const n=t!==null?e.get(t):void 0,r=n?n.node.current:null;return zy(i=>{var o;return t===null?null:(o=r??i)!=null?o:null},[r,t])}function nje(e,t){return I.useMemo(()=>e.reduce((n,r)=>{const{sensor:i}=r,o=i.activators.map(a=>({eventName:a.eventName,handler:t(a.handler,r)}));return[...n,...o]},[]),[e,t])}var F0;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(F0||(F0={}));var qT;(function(e){e.Optimized="optimized"})(qT||(qT={}));const IN=new Map;function rje(e,t){let{dragging:n,dependencies:r,config:i}=t;const[o,a]=I.useState(null),{frequency:s,measure:l,strategy:u}=i,c=I.useRef(e),d=_(),f=$0(d),h=I.useCallback(function(b){b===void 0&&(b=[]),!f.current&&a(v=>v===null?b:v.concat(b.filter(g=>!v.includes(g))))},[f]),p=I.useRef(null),m=zy(b=>{if(d&&!n)return IN;if(!b||b===IN||c.current!==e||o!=null){const v=new Map;for(let g of e){if(!g)continue;if(o&&o.length>0&&!o.includes(g.id)&&g.rect.current){v.set(g.id,g.rect.current);continue}const y=g.node.current,S=y?new DP(l(y),y):null;g.rect.current=S,S&&v.set(g.id,S)}return v}return b},[e,o,n,d,l]);return I.useEffect(()=>{c.current=e},[e]),I.useEffect(()=>{d||h()},[n,d]),I.useEffect(()=>{o&&o.length>0&&a(null)},[JSON.stringify(o)]),I.useEffect(()=>{d||typeof s!="number"||p.current!==null||(p.current=setTimeout(()=>{h(),p.current=null},s))},[s,d,h,...r]),{droppableRects:m,measureDroppableContainers:h,measuringScheduled:o!=null};function _(){switch(u){case F0.Always:return!1;case F0.BeforeDragging:return n;default:return!n}}}function FP(e,t){return zy(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function ije(e,t){return FP(e,t)}function oje(e){let{callback:t,disabled:n}=e;const r=yw(t),i=I.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:o}=window;return new o(r)},[r,n]);return I.useEffect(()=>()=>i==null?void 0:i.disconnect(),[i]),i}function bw(e){let{callback:t,disabled:n}=e;const r=yw(t),i=I.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:o}=window;return new o(r)},[n]);return I.useEffect(()=>()=>i==null?void 0:i.disconnect(),[i]),i}function aje(e){return new DP(jy(e),e)}function RN(e,t,n){t===void 0&&(t=aje);const[r,i]=I.useReducer(s,null),o=oje({callback(l){if(e)for(const u of l){const{type:c,target:d}=u;if(c==="childList"&&d instanceof HTMLElement&&d.contains(e)){i();break}}}}),a=bw({callback:i});return Js(()=>{i(),e?(a==null||a.observe(e),o==null||o.observe(document.body,{childList:!0,subtree:!0})):(a==null||a.disconnect(),o==null||o.disconnect())},[e]),r;function s(l){if(!e)return null;if(e.isConnected===!1){var u;return(u=l??n)!=null?u:null}const c=t(e);return JSON.stringify(l)===JSON.stringify(c)?l:c}}function sje(e){const t=FP(e);return kK(e,t)}const ON=[];function lje(e){const t=I.useRef(e),n=zy(r=>e?r&&r!==ON&&e&&t.current&&e.parentNode===t.current.parentNode?r:$P(e):ON,[e]);return I.useEffect(()=>{t.current=e},[e]),n}function uje(e){const[t,n]=I.useState(null),r=I.useRef(e),i=I.useCallback(o=>{const a=z5(o.target);a&&n(s=>s?(s.set(a,VT(a)),new Map(s)):null)},[]);return I.useEffect(()=>{const o=r.current;if(e!==o){a(o);const s=e.map(l=>{const u=z5(l);return u?(u.addEventListener("scroll",i,{passive:!0}),[u,VT(u)]):null}).filter(l=>l!=null);n(s.length?new Map(s):null),r.current=e}return()=>{a(e),a(o)};function a(s){s.forEach(l=>{const u=z5(l);u==null||u.removeEventListener("scroll",i)})}},[i,e]),I.useMemo(()=>e.length?t?Array.from(t.values()).reduce((o,a)=>kh(o,a),us):NK(e):us,[e,t])}function MN(e,t){t===void 0&&(t=[]);const n=I.useRef(null);return I.useEffect(()=>{n.current=null},t),I.useEffect(()=>{const r=e!==us;r&&!n.current&&(n.current=e),!r&&n.current&&(n.current=null)},[e]),n.current?uS(e,n.current):us}function cje(e){I.useEffect(()=>{if(!mw)return;const t=e.map(n=>{let{sensor:r}=n;return r.setup==null?void 0:r.setup()});return()=>{for(const n of t)n==null||n()}},e.map(t=>{let{sensor:n}=t;return n}))}function dje(e,t){return I.useMemo(()=>e.reduce((n,r)=>{let{eventName:i,handler:o}=r;return n[i]=a=>{o(a,t)},n},{}),[e,t])}function jK(e){return I.useMemo(()=>e?Fze(e):null,[e])}const V5=[];function fje(e,t){t===void 0&&(t=jy);const[n]=e,r=jK(n?co(n):null),[i,o]=I.useReducer(s,V5),a=bw({callback:o});return e.length>0&&i===V5&&o(),Js(()=>{e.length?e.forEach(l=>a==null?void 0:a.observe(l)):(a==null||a.disconnect(),o())},[e]),i;function s(){return e.length?e.map(l=>OK(l)?r:new DP(t(l),l)):V5}}function UK(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return By(t)?t:e}function hje(e){let{measure:t}=e;const[n,r]=I.useState(null),i=I.useCallback(u=>{for(const{target:c}of u)if(By(c)){r(d=>{const f=t(c);return d?{...d,width:f.width,height:f.height}:f});break}},[t]),o=bw({callback:i}),a=I.useCallback(u=>{const c=UK(u);o==null||o.disconnect(),c&&(o==null||o.observe(c)),r(c?t(c):null)},[t,o]),[s,l]=sS(a);return I.useMemo(()=>({nodeRef:s,rect:n,setRef:l}),[n,s,l])}const pje=[{sensor:FK,options:{}},{sensor:LK,options:{}}],gje={current:{}},cb={draggable:{measure:TN},droppable:{measure:TN,strategy:F0.WhileDragging,frequency:qT.Optimized},dragOverlay:{measure:jy}};class lm extends Map{get(t){var n;return t!=null&&(n=super.get(t))!=null?n:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:n}=t;return!n})}getNodeFor(t){var n,r;return(n=(r=this.get(t))==null?void 0:r.node.current)!=null?n:void 0}}const mje={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new lm,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:cS},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:cb,measureDroppableContainers:cS,windowRect:null,measuringScheduled:!1},VK={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:cS,draggableNodes:new Map,over:null,measureDroppableContainers:cS},Uy=I.createContext(VK),GK=I.createContext(mje);function yje(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new lm}}}function vje(e,t){switch(t.type){case qr.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case qr.DragMove:return e.draggable.active?{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}}:e;case qr.DragEnd:case qr.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case qr.RegisterDroppable:{const{element:n}=t,{id:r}=n,i=new lm(e.droppable.containers);return i.set(r,n),{...e,droppable:{...e.droppable,containers:i}}}case qr.SetDroppableDisabled:{const{id:n,key:r,disabled:i}=t,o=e.droppable.containers.get(n);if(!o||r!==o.key)return e;const a=new lm(e.droppable.containers);return a.set(n,{...o,disabled:i}),{...e,droppable:{...e.droppable,containers:a}}}case qr.UnregisterDroppable:{const{id:n,key:r}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;const o=new lm(e.droppable.containers);return o.delete(n),{...e,droppable:{...e.droppable,containers:o}}}default:return e}}function bje(e){let{disabled:t}=e;const{active:n,activatorEvent:r,draggableNodes:i}=I.useContext(Uy),o=lS(r),a=lS(n==null?void 0:n.id);return I.useEffect(()=>{if(!t&&!r&&o&&a!=null){if(!NP(o)||document.activeElement===o.target)return;const s=i.get(a);if(!s)return;const{activatorNode:l,node:u}=s;if(!l.current&&!u.current)return;requestAnimationFrame(()=>{for(const c of[l.current,u.current]){if(!c)continue;const d=dze(c);if(d){d.focus();break}}})}},[r,t,i,a,o]),null}function qK(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((i,o)=>o({transform:i,...r}),n):n}function _je(e){return I.useMemo(()=>({draggable:{...cb.draggable,...e==null?void 0:e.draggable},droppable:{...cb.droppable,...e==null?void 0:e.droppable},dragOverlay:{...cb.dragOverlay,...e==null?void 0:e.dragOverlay}}),[e==null?void 0:e.draggable,e==null?void 0:e.droppable,e==null?void 0:e.dragOverlay])}function Sje(e){let{activeNode:t,measure:n,initialRect:r,config:i=!0}=e;const o=I.useRef(!1),{x:a,y:s}=typeof i=="boolean"?{x:i,y:i}:i;Js(()=>{if(!a&&!s||!t){o.current=!1;return}if(o.current||!r)return;const u=t==null?void 0:t.node.current;if(!u||u.isConnected===!1)return;const c=n(u),d=kK(c,r);if(a||(d.x=0),s||(d.y=0),o.current=!0,Math.abs(d.x)>0||Math.abs(d.y)>0){const f=PK(u);f&&f.scrollBy({top:d.y,left:d.x})}},[t,a,s,r,n])}const _w=I.createContext({...us,scaleX:1,scaleY:1});var xu;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(xu||(xu={}));const xje=I.memo(function(t){var n,r,i,o;let{id:a,accessibility:s,autoScroll:l=!0,children:u,sensors:c=pje,collisionDetection:d=Ize,measuring:f,modifiers:h,...p}=t;const m=I.useReducer(vje,void 0,yje),[_,b]=m,[v,g]=vze(),[y,S]=I.useState(xu.Uninitialized),w=y===xu.Initialized,{draggable:{active:x,nodes:C,translate:k},droppable:{containers:T}}=_,P=x?C.get(x):null,$=I.useRef({initial:null,translated:null}),O=I.useMemo(()=>{var Bn;return x!=null?{id:x,data:(Bn=P==null?void 0:P.data)!=null?Bn:gje,rect:$}:null},[x,P]),E=I.useRef(null),[A,D]=I.useState(null),[L,M]=I.useState(null),R=$0(p,Object.values(p)),N=vw("DndDescribedBy",a),B=I.useMemo(()=>T.getEnabled(),[T]),U=_je(f),{droppableRects:G,measureDroppableContainers:Y,measuringScheduled:ee}=rje(B,{dragging:w,dependencies:[k.x,k.y],config:U.droppable}),J=tje(C,x),j=I.useMemo(()=>L?D0(L):null,[L]),Q=al(),ne=ije(J,U.draggable.measure);Sje({activeNode:x?C.get(x):null,config:Q.layoutShiftCompensation,initialRect:ne,measure:U.draggable.measure});const se=RN(J,U.draggable.measure,ne),ve=RN(J?J.parentElement:null),ce=I.useRef({activatorEvent:null,active:null,activeNode:J,collisionRect:null,collisions:null,droppableRects:G,draggableNodes:C,draggingNode:null,draggingNodeRect:null,droppableContainers:T,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),bt=T.getNodeFor((n=ce.current.over)==null?void 0:n.id),ot=hje({measure:U.dragOverlay.measure}),ze=(r=ot.nodeRef.current)!=null?r:J,mt=w?(i=ot.rect)!=null?i:se:null,Pe=!!(ot.nodeRef.current&&ot.rect),Jt=sje(Pe?null:se),Ar=jK(ze?co(ze):null),Dn=lje(w?bt??J:null),kn=fje(Dn),en=qK(h,{transform:{x:k.x-Jt.x,y:k.y-Jt.y,scaleX:1,scaleY:1},activatorEvent:L,active:O,activeNodeRect:se,containerNodeRect:ve,draggingNodeRect:mt,over:ce.current.over,overlayNodeRect:ot.rect,scrollableAncestors:Dn,scrollableAncestorRects:kn,windowRect:Ar}),Ln=j?kh(j,k):null,Pr=uje(Dn),fo=MN(Pr),Jr=MN(Pr,[se]),hr=kh(en,fo),Fr=mt?$ze(mt,en):null,ei=O&&Fr?d({active:O,collisionRect:Fr,droppableRects:G,droppableContainers:B,pointerCoordinates:Ln}):null,Fn=Aze(ei,"id"),[bn,Mi]=I.useState(null),pi=Pe?en:kh(en,Jr),Qi=Mze(pi,(o=bn==null?void 0:bn.rect)!=null?o:null,se),$a=I.useCallback((Bn,tn)=>{let{sensor:Br,options:Rr}=tn;if(E.current==null)return;const Or=C.get(E.current);if(!Or)return;const ti=Bn.nativeEvent,Ni=new Br({active:E.current,activeNode:Or,event:ti,options:Rr,context:ce,onStart(gi){const zr=E.current;if(zr==null)return;const Da=C.get(zr);if(!Da)return;const{onDragStart:ps}=R.current,mi={active:{id:zr,data:Da.data,rect:$}};Uo.unstable_batchedUpdates(()=>{ps==null||ps(mi),S(xu.Initializing),b({type:qr.DragStart,initialCoordinates:gi,active:zr}),v({type:"onDragStart",event:mi})})},onMove(gi){b({type:qr.DragMove,coordinates:gi})},onEnd:po(qr.DragEnd),onCancel:po(qr.DragCancel)});Uo.unstable_batchedUpdates(()=>{D(Ni),M(Bn.nativeEvent)});function po(gi){return async function(){const{active:Da,collisions:ps,over:mi,scrollAdjustedTranslate:iu}=ce.current;let ia=null;if(Da&&iu){const{cancelDrop:ni}=R.current;ia={activatorEvent:ti,active:Da,collisions:ps,delta:iu,over:mi},gi===qr.DragEnd&&typeof ni=="function"&&await Promise.resolve(ni(ia))&&(gi=qr.DragCancel)}E.current=null,Uo.unstable_batchedUpdates(()=>{b({type:gi}),S(xu.Uninitialized),Mi(null),D(null),M(null);const ni=gi===qr.DragEnd?"onDragEnd":"onDragCancel";if(ia){const sl=R.current[ni];sl==null||sl(ia),v({type:ni,event:ia})}})}}},[C]),Ir=I.useCallback((Bn,tn)=>(Br,Rr)=>{const Or=Br.nativeEvent,ti=C.get(Rr);if(E.current!==null||!ti||Or.dndKit||Or.defaultPrevented)return;const Ni={active:ti};Bn(Br,tn.options,Ni)===!0&&(Or.dndKit={capturedBy:tn.sensor},E.current=Rr,$a(Br,tn))},[C,$a]),ho=nje(c,Ir);cje(c),Js(()=>{se&&y===xu.Initializing&&S(xu.Initialized)},[se,y]),I.useEffect(()=>{const{onDragMove:Bn}=R.current,{active:tn,activatorEvent:Br,collisions:Rr,over:Or}=ce.current;if(!tn||!Br)return;const ti={active:tn,activatorEvent:Br,collisions:Rr,delta:{x:hr.x,y:hr.y},over:Or};Uo.unstable_batchedUpdates(()=>{Bn==null||Bn(ti),v({type:"onDragMove",event:ti})})},[hr.x,hr.y]),I.useEffect(()=>{const{active:Bn,activatorEvent:tn,collisions:Br,droppableContainers:Rr,scrollAdjustedTranslate:Or}=ce.current;if(!Bn||E.current==null||!tn||!Or)return;const{onDragOver:ti}=R.current,Ni=Rr.get(Fn),po=Ni&&Ni.rect.current?{id:Ni.id,rect:Ni.rect.current,data:Ni.data,disabled:Ni.disabled}:null,gi={active:Bn,activatorEvent:tn,collisions:Br,delta:{x:Or.x,y:Or.y},over:po};Uo.unstable_batchedUpdates(()=>{Mi(po),ti==null||ti(gi),v({type:"onDragOver",event:gi})})},[Fn]),Js(()=>{ce.current={activatorEvent:L,active:O,activeNode:J,collisionRect:Fr,collisions:ei,droppableRects:G,draggableNodes:C,draggingNode:ze,draggingNodeRect:mt,droppableContainers:T,over:bn,scrollableAncestors:Dn,scrollAdjustedTranslate:hr},$.current={initial:mt,translated:Fr}},[O,J,ei,Fr,C,ze,mt,G,T,bn,Dn,hr]),Zze({...Q,delta:k,draggingRect:Fr,pointerCoordinates:Ln,scrollableAncestors:Dn,scrollableAncestorRects:kn});const ol=I.useMemo(()=>({active:O,activeNode:J,activeNodeRect:se,activatorEvent:L,collisions:ei,containerNodeRect:ve,dragOverlay:ot,draggableNodes:C,droppableContainers:T,droppableRects:G,over:bn,measureDroppableContainers:Y,scrollableAncestors:Dn,scrollableAncestorRects:kn,measuringConfiguration:U,measuringScheduled:ee,windowRect:Ar}),[O,J,se,L,ei,ve,ot,C,T,G,bn,Y,Dn,kn,U,ee,Ar]),$o=I.useMemo(()=>({activatorEvent:L,activators:ho,active:O,activeNodeRect:se,ariaDescribedById:{draggable:N},dispatch:b,draggableNodes:C,over:bn,measureDroppableContainers:Y}),[L,ho,O,se,b,N,C,bn,Y]);return En.createElement(TK.Provider,{value:g},En.createElement(Uy.Provider,{value:$o},En.createElement(GK.Provider,{value:ol},En.createElement(_w.Provider,{value:Qi},u)),En.createElement(bje,{disabled:(s==null?void 0:s.restoreFocus)===!1})),En.createElement(Sze,{...s,hiddenTextDescribedById:N}));function al(){const Bn=(A==null?void 0:A.autoScrollEnabled)===!1,tn=typeof l=="object"?l.enabled===!1:l===!1,Br=w&&!Bn&&!tn;return typeof l=="object"?{...l,enabled:Br}:{enabled:Br}}}),wje=I.createContext(null),NN="button",Cje="Droppable";function YKe(e){let{id:t,data:n,disabled:r=!1,attributes:i}=e;const o=vw(Cje),{activators:a,activatorEvent:s,active:l,activeNodeRect:u,ariaDescribedById:c,draggableNodes:d,over:f}=I.useContext(Uy),{role:h=NN,roleDescription:p="draggable",tabIndex:m=0}=i??{},_=(l==null?void 0:l.id)===t,b=I.useContext(_?_w:wje),[v,g]=sS(),[y,S]=sS(),w=dje(a,t),x=$0(n);Js(()=>(d.set(t,{id:t,key:o,node:v,activatorNode:y,data:x}),()=>{const k=d.get(t);k&&k.key===o&&d.delete(t)}),[d,t]);const C=I.useMemo(()=>({role:h,tabIndex:m,"aria-disabled":r,"aria-pressed":_&&h===NN?!0:void 0,"aria-roledescription":p,"aria-describedby":c.draggable}),[r,h,m,_,p,c.draggable]);return{active:l,activatorEvent:s,activeNodeRect:u,attributes:C,isDragging:_,listeners:r?void 0:w,node:v,over:f,setNodeRef:g,setActivatorNodeRef:S,transform:b}}function Eje(){return I.useContext(GK)}const Tje="Droppable",kje={timeout:25};function ZKe(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:i}=e;const o=vw(Tje),{active:a,dispatch:s,over:l,measureDroppableContainers:u}=I.useContext(Uy),c=I.useRef({disabled:n}),d=I.useRef(!1),f=I.useRef(null),h=I.useRef(null),{disabled:p,updateMeasurementsFor:m,timeout:_}={...kje,...i},b=$0(m??r),v=I.useCallback(()=>{if(!d.current){d.current=!0;return}h.current!=null&&clearTimeout(h.current),h.current=setTimeout(()=>{u(Array.isArray(b.current)?b.current:[b.current]),h.current=null},_)},[_]),g=bw({callback:v,disabled:p||!a}),y=I.useCallback((C,k)=>{g&&(k&&(g.unobserve(k),d.current=!1),C&&g.observe(C))},[g]),[S,w]=sS(y),x=$0(t);return I.useEffect(()=>{!g||!S.current||(g.disconnect(),d.current=!1,g.observe(S.current))},[S,g]),Js(()=>(s({type:qr.RegisterDroppable,element:{id:r,key:o,disabled:n,node:S,rect:f,data:x}}),()=>s({type:qr.UnregisterDroppable,key:o,id:r})),[r]),I.useEffect(()=>{n!==c.current.disabled&&(s({type:qr.SetDroppableDisabled,id:r,key:o,disabled:n}),c.current.disabled=n)},[r,o,n,s]),{active:a,rect:f,isOver:(l==null?void 0:l.id)===r,node:S,over:l,setNodeRef:w}}function Aje(e){let{animation:t,children:n}=e;const[r,i]=I.useState(null),[o,a]=I.useState(null),s=lS(n);return!n&&!r&&s&&i(s),Js(()=>{if(!o)return;const l=r==null?void 0:r.key,u=r==null?void 0:r.props.id;if(l==null||u==null){i(null);return}Promise.resolve(t(u,o)).then(()=>{i(null)})},[t,r,o]),En.createElement(En.Fragment,null,n,r?I.cloneElement(r,{ref:a}):null)}const Pje={x:0,y:0,scaleX:1,scaleY:1};function Ije(e){let{children:t}=e;return En.createElement(Uy.Provider,{value:VK},En.createElement(_w.Provider,{value:Pje},t))}const Rje={position:"fixed",touchAction:"none"},Oje=e=>NP(e)?"transform 250ms ease":void 0,Mje=I.forwardRef((e,t)=>{let{as:n,activatorEvent:r,adjustScale:i,children:o,className:a,rect:s,style:l,transform:u,transition:c=Oje}=e;if(!s)return null;const d=i?u:{...u,scaleX:1,scaleY:1},f={...Rje,width:s.width,height:s.height,top:s.top,left:s.left,transform:L0.Transform.toString(d),transformOrigin:i&&r?Cze(r,s):void 0,transition:typeof c=="function"?c(r):c,...l};return En.createElement(n,{className:a,style:f,ref:t},o)}),Nje=e=>t=>{let{active:n,dragOverlay:r}=t;const i={},{styles:o,className:a}=e;if(o!=null&&o.active)for(const[s,l]of Object.entries(o.active))l!==void 0&&(i[s]=n.node.style.getPropertyValue(s),n.node.style.setProperty(s,l));if(o!=null&&o.dragOverlay)for(const[s,l]of Object.entries(o.dragOverlay))l!==void 0&&r.node.style.setProperty(s,l);return a!=null&&a.active&&n.node.classList.add(a.active),a!=null&&a.dragOverlay&&r.node.classList.add(a.dragOverlay),function(){for(const[l,u]of Object.entries(i))n.node.style.setProperty(l,u);a!=null&&a.active&&n.node.classList.remove(a.active)}},$je=e=>{let{transform:{initial:t,final:n}}=e;return[{transform:L0.Transform.toString(t)},{transform:L0.Transform.toString(n)}]},Dje={duration:250,easing:"ease",keyframes:$je,sideEffects:Nje({styles:{active:{opacity:"0"}}})};function Lje(e){let{config:t,draggableNodes:n,droppableContainers:r,measuringConfiguration:i}=e;return yw((o,a)=>{if(t===null)return;const s=n.get(o);if(!s)return;const l=s.node.current;if(!l)return;const u=UK(a);if(!u)return;const{transform:c}=co(a).getComputedStyle(a),d=AK(c);if(!d)return;const f=typeof t=="function"?t:Fje(t);return $K(l,i.draggable.measure),f({active:{id:o,data:s.data,node:l,rect:i.draggable.measure(l)},draggableNodes:n,dragOverlay:{node:a,rect:i.dragOverlay.measure(u)},droppableContainers:r,measuringConfiguration:i,transform:d})})}function Fje(e){const{duration:t,easing:n,sideEffects:r,keyframes:i}={...Dje,...e};return o=>{let{active:a,dragOverlay:s,transform:l,...u}=o;if(!t)return;const c={x:s.rect.left-a.rect.left,y:s.rect.top-a.rect.top},d={scaleX:l.scaleX!==1?a.rect.width*l.scaleX/s.rect.width:1,scaleY:l.scaleY!==1?a.rect.height*l.scaleY/s.rect.height:1},f={x:l.x-c.x,y:l.y-c.y,...d},h=i({...u,active:a,dragOverlay:s,transform:{initial:l,final:f}}),[p]=h,m=h[h.length-1];if(JSON.stringify(p)===JSON.stringify(m))return;const _=r==null?void 0:r({active:a,dragOverlay:s,...u}),b=s.node.animate(h,{duration:t,easing:n,fill:"forwards"});return new Promise(v=>{b.onfinish=()=>{_==null||_(),v()}})}}let $N=0;function Bje(e){return I.useMemo(()=>{if(e!=null)return $N++,$N},[e])}const zje=En.memo(e=>{let{adjustScale:t=!1,children:n,dropAnimation:r,style:i,transition:o,modifiers:a,wrapperElement:s="div",className:l,zIndex:u=999}=e;const{activatorEvent:c,active:d,activeNodeRect:f,containerNodeRect:h,draggableNodes:p,droppableContainers:m,dragOverlay:_,over:b,measuringConfiguration:v,scrollableAncestors:g,scrollableAncestorRects:y,windowRect:S}=Eje(),w=I.useContext(_w),x=Bje(d==null?void 0:d.id),C=qK(a,{activatorEvent:c,active:d,activeNodeRect:f,containerNodeRect:h,draggingNodeRect:_.rect,over:b,overlayNodeRect:_.rect,scrollableAncestors:g,scrollableAncestorRects:y,transform:w,windowRect:S}),k=FP(f),T=Lje({config:r,draggableNodes:p,droppableContainers:m,measuringConfiguration:v}),P=k?_.setRef:void 0;return En.createElement(Ije,null,En.createElement(Aje,{animation:T},d&&x?En.createElement(Mje,{key:x,id:d.id,ref:P,as:s,activatorEvent:c,adjustScale:t,className:l,transition:o,rect:k,style:{zIndex:u,...i},transform:C},n):null))}),jje=Ii([iK,DA],({nodes:e},t)=>t==="nodes"?e.viewport.zoom:1),Uje=()=>{const e=fq(jje);return I.useCallback(({activatorEvent:n,draggingNodeRect:r,transform:i})=>{if(r&&n){const o=D0(n);if(!o)return i;const a=o.x-r.left,s=o.y-r.top,l=i.x+a-r.width/2,u=i.y+s-r.height/2,c=i.scaleX*e,d=i.scaleY*e;return{x:l,y:u,scaleX:c,scaleY:d}}return i},[e])},Vje=e=>{if(!e.pointerCoordinates)return[];const t=document.elementsFromPoint(e.pointerCoordinates.x,e.pointerCoordinates.y),n=e.droppableContainers.filter(r=>r.node.current?t.includes(r.node.current):!1);return Oze({...e,droppableContainers:n})};function Gje(e){return W.jsx(xje,{...e})}const y1=28,DN={w:y1,h:y1,maxW:y1,maxH:y1,shadow:"dark-lg",borderRadius:"lg",opacity:.3,bg:"base.800",color:"base.50",_dark:{borderColor:"base.200",bg:"base.900",color:"base.100"}},qje=e=>{if(!e.dragData)return null;if(e.dragData.payloadType==="NODE_FIELD"){const{field:t,fieldTemplate:n}=e.dragData.payload;return W.jsx(iS,{sx:{position:"relative",p:2,px:3,opacity:.7,bg:"base.300",borderRadius:"base",boxShadow:"dark-lg",whiteSpace:"nowrap",fontSize:"sm"},children:W.jsx(QW,{children:t.label||n.title})})}if(e.dragData.payloadType==="IMAGE_DTO"){const{thumbnail_url:t,width:n,height:r}=e.dragData.payload.imageDTO;return W.jsx(iS,{sx:{position:"relative",width:"full",height:"full",display:"flex",alignItems:"center",justifyContent:"center"},children:W.jsx(CP,{sx:{...DN},objectFit:"contain",src:t,width:n,height:r})})}return e.dragData.payloadType==="IMAGE_DTOS"?W.jsxs(EP,{sx:{position:"relative",alignItems:"center",justifyContent:"center",flexDir:"column",...DN},children:[W.jsx(OT,{children:e.dragData.payload.imageDTOs.length}),W.jsx(OT,{size:"sm",children:"Images"})]}):null},Hje=I.memo(qje),Wje=e=>{const[t,n]=I.useState(null),r=_e("images"),i=A4e(),o=I.useCallback(d=>{r.trace({dragData:Qt(d.active.data.current)},"Drag started");const f=d.active.data.current;f&&n(f)},[r]),a=I.useCallback(d=>{var h;r.trace({dragData:Qt(d.active.data.current)},"Drag ended");const f=(h=d.over)==null?void 0:h.data.current;!t||!f||(i(cq({overData:f,activeData:t})),n(null))},[t,i,r]),s=EN(BK,{activationConstraint:{distance:10}}),l=EN(zK,{activationConstraint:{distance:10}}),u=xze(s,l),c=Uje();return W.jsxs(Gje,{onDragStart:o,onDragEnd:a,sensors:u,collisionDetection:Vje,autoScroll:!1,children:[e.children,W.jsx(zje,{dropAnimation:null,modifiers:[c],style:{width:"min-content",height:"min-content",cursor:"grabbing",userSelect:"none",padding:"10rem"},children:W.jsx(zW,{children:t&&W.jsx(FW.div,{layout:!0,initial:{opacity:0,scale:.7},animate:{opacity:1,scale:1,transition:{duration:.1}},children:W.jsx(Hje,{dragData:t})},"overlay-drag-image")})})]})},Kje=I.memo(Wje),LN=tl(void 0),FN=tl(void 0),Qje=I.lazy(()=>tL(()=>import("./App-c6eb6a29.js"),["./App-c6eb6a29.js","./MantineProvider-2072a471.js","./App-6125620a.css"],import.meta.url)),Xje=I.lazy(()=>tL(()=>import("./ThemeLocaleProvider-bbfac5eb.js"),["./ThemeLocaleProvider-bbfac5eb.js","./MantineProvider-2072a471.js","./ThemeLocaleProvider-90f0fcd3.css"],import.meta.url)),Yje=({apiUrl:e,token:t,config:n,headerComponent:r,middleware:i,projectId:o,queueId:a,selectedImage:s,customStarUi:l})=>(I.useEffect(()=>(t&&Jh.set(t),e&&a0.set(e),o&&s0.set(o),a&&Ur.set(a),lG(),i&&i.length>0?VE(vN(),...i):VE(vN()),()=>{a0.set(void 0),Jh.set(void 0),s0.set(void 0),Ur.set(hG)}),[e,t,i,o,a]),I.useEffect(()=>(l&&LN.set(l),()=>{LN.set(void 0)}),[l]),I.useEffect(()=>(r&&FN.set(r),()=>{FN.set(void 0)}),[r]),W.jsx(En.StrictMode,{children:W.jsx(Tme,{store:rK,children:W.jsx(En.Suspense,{fallback:W.jsx(HBe,{}),children:W.jsx(Xje,{children:W.jsx(Kje,{children:W.jsx(Qje,{config:n,selectedImage:s})})})})})})),Zje=I.memo(Yje);G5.createRoot(document.getElementById("root")).render(W.jsx(Zje,{}));export{Oy as $,hi as A,Wa as B,hbe as C,Ro as D,Xu as E,ws as F,Pqe as G,uA as H,eke as I,ra as J,Fy as K,tAe as L,QKe as M,UDe as N,Py as O,mbe as P,Oi as Q,Rc as R,$m as S,cMe as T,jKe as U,FKe as V,zW as W,FW as X,UOe as Y,Iy as Z,SP as _,HL as a,Qk as a$,BKe as a0,zKe as a1,V_ as a2,ZM as a3,qke as a4,UKe as a5,Ds as a6,mc as a7,S_ as a8,$Y as a9,Ld as aA,iS as aB,EP as aC,OT as aD,DA as aE,J2 as aF,G4e as aG,VGe as aH,Rke as aI,VA as aJ,Eq as aK,Mke as aL,Uo as aM,UP as aN,nw as aO,SWe as aP,IGe as aQ,qGe as aR,HGe as aS,_Ge as aT,vGe as aU,QW as aV,zf as aW,Rxe as aX,gG as aY,sWe as aZ,yqe as a_,En as aa,gH as ab,qKe as ac,WOe as ad,Hs as ae,Oq as af,tw as ag,h$e as ah,WW as ai,VKe as aj,nt as ak,LKe as al,GKe as am,Ii as an,iK as ao,fk as ap,fq as aq,AGe as ar,vy as as,Mz as at,oj as au,S2 as av,_e as aw,A4e as ax,uWe as ay,Gt as az,zS as b,cUe as b$,BA as b0,XWe as b1,CP as b2,GBe as b3,be as b4,DGe as b5,GGe as b6,m0e as b7,yk as b8,dUe as b9,LV as bA,xqe as bB,RGe as bC,OGe as bD,BGe as bE,C_ as bF,NGe as bG,Mu as bH,sv as bI,Sqe as bJ,bqe as bK,_qe as bL,eUe as bM,iUe as bN,oUe as bO,aUe as bP,sUe as bQ,tle as bR,MUe as bS,YHe as bT,ZHe as bU,fUe as bV,zUe as bW,uUe as bX,AUe as bY,gUe as bZ,XEe as b_,IWe as ba,dWe as bb,YWe as bc,$We as bd,exe as be,cWe as bf,hWe as bg,g2e as bh,m2e as bi,kWe as bj,PWe as bk,fWe as bl,OWe as bm,pWe as bn,kGe as bo,lWe as bp,GWe as bq,XKe as br,$Ge as bs,ble as bt,ZGe as bu,YGe as bv,MGe as bw,wqe as bx,ZKe as by,YKe as bz,NJ as c,BWe as c$,NUe as c0,lUe as c1,qUe as c2,hUe as c3,eI as c4,pUe as c5,tI as c6,SUe as c7,IUe as c8,yKe as c9,CUe as cA,aWe as cB,kqe as cC,rqe as cD,Gxe as cE,Ne as cF,LN as cG,tqe as cH,JGe as cI,eqe as cJ,_0e as cK,vxe as cL,sG as cM,AB as cN,bGe as cO,uq as cP,LGe as cQ,l0 as cR,pU as cS,DKe as cT,FGe as cU,fv as cV,xE as cW,KWe as cX,jWe as cY,gWe as cZ,mWe as c_,zO as ca,yUe as cb,Aqe as cc,pKe as cd,jO as ce,vUe as cf,Tv as cg,Ef as ch,jR as ci,oqe as cj,gKe as ck,nT as cl,_Ue as cm,iU as cn,hqe as co,lU as cp,QEe as cq,mUe as cr,W9 as cs,tWe as ct,nWe as cu,rWe as cv,xUe as cw,iWe as cx,wUe as cy,oWe as cz,_oe as d,Eqe as d$,jr as d0,cA as d1,Ca as d2,FWe as d3,EUe as d4,$A as d5,zWe as d6,NWe as d7,dk as d8,qHe as d9,AKe as dA,hKe as dB,MKe as dC,fKe as dD,sHe as dE,lHe as dF,NKe as dG,uHe as dH,OKe as dI,cHe as dJ,dHe as dK,qse as dL,bKe as dM,fHe as dN,Kse as dO,rHe as dP,bUe as dQ,mKe as dR,iHe as dS,Zqe as dT,GHe as dU,joe as dV,WS as dW,RUe as dX,w0e as dY,C0e as dZ,vqe as d_,jHe as da,UHe as db,KHe as dc,VHe as dd,WHe as de,HHe as df,IEe as dg,gHe as dh,$qe as di,xGe as dj,SGe as dk,Fqe as dl,Eae as dm,oHe as dn,Oqe as dp,Jqe as dq,eHe as dr,Wse as ds,tHe as dt,tUe as du,nHe as dv,Y2 as dw,Hse as dx,aHe as dy,uy as dz,KF as e,pGe as e$,Tqe as e0,mU as e1,Cqe as e2,KS as e3,nVe as e4,JUe as e5,eVe as e6,tVe as e7,Dae as e8,UR as e9,vKe as eA,JHe as eB,pk as eC,f2e as eD,E4e as eE,CB as eF,uKe as eG,iVe as eH,nle as eI,rVe as eJ,Ha as eK,PUe as eL,UUe as eM,Lae as eN,qg as eO,GUe as eP,eWe as eQ,LUe as eR,FUe as eS,BUe as eT,$Ue as eU,DUe as eV,ele as eW,KUe as eX,WUe as eY,dVe as eZ,RVe as e_,lqe as ea,QGe as eb,WGe as ec,KGe as ed,Cc as ee,nI as ef,p0e as eg,VR as eh,jxe as ei,zxe as ej,uqe as ek,cqe as el,dqe as em,g0e as en,fqe as eo,aU as ep,aqe as eq,sU as er,gqe as es,mqe as et,G2 as eu,GR as ev,pqe as ew,nqe as ex,lEe as ey,iqe as ez,eF as f,Dqe as f$,OVe as f0,YUe as f1,ZUe as f2,XUe as f3,mk as f4,LWe as f5,UWe as f6,XHe as f7,$Ke as f8,K4e as f9,mHe as fA,jqe as fB,Uqe as fC,hSe as fD,G9 as fE,tV as fF,xy as fG,Iqe as fH,Wc as fI,vHe as fJ,MWe as fK,wj as fL,Cg as fM,Lqe as fN,Nqe as fO,yHe as fP,bHe as fQ,THe as fR,Rqe as fS,_He as fT,SHe as fU,wGe as fV,N_ as fW,tt as fX,xHe as fY,l2e as fZ,Lv as f_,CWe as fa,me as fb,xi as fc,Vn as fd,Vs as fe,dKe as ff,IKe as fg,wKe as fh,_We as fi,xKe as fj,RKe as fk,PKe as fl,bWe as fm,EKe as fn,CKe as fo,_Ke as fp,kKe as fq,rUe as fr,SKe as fs,TKe as ft,nUe as fu,xV as fv,Mqe as fw,J3 as fx,uSe as fy,Coe as fz,lF as g,wVe as g$,kHe as g0,CHe as g1,Qqe as g2,Hqe as g3,qqe as g4,Gqe as g5,Xqe as g6,EHe as g7,IHe as g8,PHe as g9,JWe as gA,eKe as gB,QWe as gC,DWe as gD,qWe as gE,WWe as gF,Kc as gG,vG as gH,gQ as gI,Rt as gJ,VVe as gK,lGe as gL,sGe as gM,kVe as gN,ZVe as gO,cGe as gP,Uxe as gQ,_Ve as gR,FVe as gS,ig as gT,$Ve as gU,SVe as gV,ex as gW,LVe as gX,yVe as gY,DVe as gZ,vVe as g_,zHe as ga,X4e as gb,Wqe as gc,Kqe as gd,QHe as ge,RHe as gf,AHe as gg,MHe as gh,nSe as gi,cKe as gj,WB as gk,FO as gl,Qt as gm,s2e as gn,m0 as go,uc as gp,BHe as gq,NHe as gr,FHe as gs,$He as gt,OHe as gu,wHe as gv,LHe as gw,$V as gx,tKe as gy,ZWe as gz,mp as h,Iq as h$,sVe as h0,aVe as h1,oVe as h2,uGe as h3,bae as h4,nB as h5,EB as h6,Jh as h7,ale as h8,fVe as h9,iGe as hA,rGe as hB,QVe as hC,WVe as hD,KVe as hE,gGe as hF,tGe as hG,mGe as hH,NVe as hI,MVe as hJ,mVe as hK,gVe as hL,hGe as hM,cVe as hN,AVe as hO,Fxe as hP,Nxe as hQ,Dxe as hR,Lxe as hS,lKe as hT,xWe as hU,wWe as hV,zGe as hW,Z as hX,Nae as hY,Pxe as hZ,FN as h_,hVe as ha,pVe as hb,aGe as hc,EVe as hd,CVe as he,ule as hf,oGe as hg,Bxe as hh,cle as hi,MA as hj,sEe as hk,PVe as hl,GVe as hm,UVe as hn,BVe as ho,lVe as hp,uVe as hq,yGe as hr,rKe as hs,nKe as ht,YVe as hu,HVe as hv,qVe as hw,$xe as hx,TVe as hy,bVe as hz,hoe as i,qA as i0,Ls as i1,IOe as i2,oMe as i3,HKe as i4,Qke as i5,KKe as i6,VDe as i7,WFe as i8,KFe as i9,Vke as ia,sy as j,Xr as k,ay as l,ry as m,Io as n,VS as o,J4 as p,ZL as q,ok as r,jF as s,oy as t,Mae as u,I as v,W as w,ka as x,br as y,yh as z}; diff --git a/invokeai/frontend/web/dist/assets/index-94062f76.js b/invokeai/frontend/web/dist/assets/index-94062f76.js deleted file mode 100644 index 7704f5ddb4..0000000000 --- a/invokeai/frontend/web/dist/assets/index-94062f76.js +++ /dev/null @@ -1,158 +0,0 @@ -var UK=Object.defineProperty;var VK=(e,t,n)=>t in e?UK(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var _w=(e,t,n)=>(VK(e,typeof t!="symbol"?t+"":t,n),n),Sw=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)};var ae=(e,t,n)=>(Sw(e,t,"read from private field"),n?n.call(e):t.get(e)),Yn=(e,t,n)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,n)},oa=(e,t,n,r)=>(Sw(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n);var Op=(e,t,n,r)=>({set _(i){oa(e,t,i,n)},get _(){return ae(e,t,r)}}),ps=(e,t,n)=>(Sw(e,t,"access private method"),n);function FN(e,t){for(var n=0;nr[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"]'))r(i);new MutationObserver(i=>{for(const o of i)if(o.type==="childList")for(const a of o.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&r(a)}).observe(document,{childList:!0,subtree:!0});function n(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 r(i){if(i.ep)return;i.ep=!0;const o=n(i);fetch(i.href,o)}})();var mt=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function pc(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function dS(e){if(e.__esModule)return e;var t=e.default;if(typeof t=="function"){var n=function r(){return this instanceof r?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(r){var i=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(n,r,i.get?i:{enumerable:!0,get:function(){return e[r]}})}),n}var BN={exports:{}},fS={},zN={exports:{}},Lt={};/** - * @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 U0=Symbol.for("react.element"),GK=Symbol.for("react.portal"),HK=Symbol.for("react.fragment"),qK=Symbol.for("react.strict_mode"),WK=Symbol.for("react.profiler"),KK=Symbol.for("react.provider"),QK=Symbol.for("react.context"),XK=Symbol.for("react.forward_ref"),YK=Symbol.for("react.suspense"),ZK=Symbol.for("react.memo"),JK=Symbol.for("react.lazy"),LP=Symbol.iterator;function eQ(e){return e===null||typeof e!="object"?null:(e=LP&&e[LP]||e["@@iterator"],typeof e=="function"?e:null)}var jN={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},UN=Object.assign,VN={};function cp(e,t,n){this.props=e,this.context=t,this.refs=VN,this.updater=n||jN}cp.prototype.isReactComponent={};cp.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=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,e,t,"setState")};cp.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function GN(){}GN.prototype=cp.prototype;function G4(e,t,n){this.props=e,this.context=t,this.refs=VN,this.updater=n||jN}var H4=G4.prototype=new GN;H4.constructor=G4;UN(H4,cp.prototype);H4.isPureReactComponent=!0;var FP=Array.isArray,HN=Object.prototype.hasOwnProperty,q4={current:null},qN={key:!0,ref:!0,__self:!0,__source:!0};function WN(e,t,n){var r,i={},o=null,a=null;if(t!=null)for(r in t.ref!==void 0&&(a=t.ref),t.key!==void 0&&(o=""+t.key),t)HN.call(t,r)&&!qN.hasOwnProperty(r)&&(i[r]=t[r]);var s=arguments.length-2;if(s===1)i.children=n;else if(1>>1,U=M[B];if(0>>1;Bi(ee,N))Ji(j,ee)?(M[B]=j,M[J]=N,B=J):(M[B]=ee,M[Y]=N,B=Y);else if(Ji(j,N))M[B]=j,M[J]=N,B=J;else break e}}return R}function i(M,R){var N=M.sortIndex-R.sortIndex;return N!==0?N:M.id-R.id}if(typeof performance=="object"&&typeof performance.now=="function"){var o=performance;e.unstable_now=function(){return o.now()}}else{var a=Date,s=a.now();e.unstable_now=function(){return a.now()-s}}var l=[],u=[],c=1,d=null,f=3,h=!1,p=!1,m=!1,_=typeof setTimeout=="function"?setTimeout:null,b=typeof clearTimeout=="function"?clearTimeout:null,v=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function g(M){for(var R=n(u);R!==null;){if(R.callback===null)r(u);else if(R.startTime<=M)r(u),R.sortIndex=R.expirationTime,t(l,R);else break;R=n(u)}}function y(M){if(m=!1,g(M),!p)if(n(l)!==null)p=!0,D(S);else{var R=n(u);R!==null&&L(y,R.startTime-M)}}function S(M,R){p=!1,m&&(m=!1,b(C),C=-1),h=!0;var N=f;try{for(g(R),d=n(l);d!==null&&(!(d.expirationTime>R)||M&&!P());){var B=d.callback;if(typeof B=="function"){d.callback=null,f=d.priorityLevel;var U=B(d.expirationTime<=R);R=e.unstable_now(),typeof U=="function"?d.callback=U:d===n(l)&&r(l),g(R)}else r(l);d=n(l)}if(d!==null)var G=!0;else{var Y=n(u);Y!==null&&L(y,Y.startTime-R),G=!1}return G}finally{d=null,f=N,h=!1}}var w=!1,x=null,C=-1,T=5,k=-1;function P(){return!(e.unstable_now()-kM||125B?(M.sortIndex=N,t(u,M),n(l)===null&&M===n(u)&&(m?(b(C),C=-1):m=!0,L(y,N-B))):(M.sortIndex=U,t(l,M),p||h||(p=!0,D(S))),M},e.unstable_shouldYield=P,e.unstable_wrapCallback=function(M){var R=f;return function(){var N=f;f=R;try{return M.apply(this,arguments)}finally{f=N}}}})(YN);XN.exports=YN;var dQ=XN.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 ZN=I,Xo=dQ;function le(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),G5=Object.prototype.hasOwnProperty,fQ=/^[: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]*$/,jP={},UP={};function hQ(e){return G5.call(UP,e)?!0:G5.call(jP,e)?!1:fQ.test(e)?UP[e]=!0:(jP[e]=!0,!1)}function pQ(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function gQ(e,t,n,r){if(t===null||typeof t>"u"||pQ(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function so(e,t,n,r,i,o,a){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=i,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=o,this.removeEmptyString=a}var Ri={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){Ri[e]=new so(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];Ri[t]=new so(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){Ri[e]=new so(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){Ri[e]=new so(e,2,!1,e,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(e){Ri[e]=new so(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){Ri[e]=new so(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){Ri[e]=new so(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){Ri[e]=new so(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){Ri[e]=new so(e,5,!1,e.toLowerCase(),null,!1,!1)});var K4=/[\-:]([a-z])/g;function Q4(e){return e[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(e){var t=e.replace(K4,Q4);Ri[t]=new so(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(K4,Q4);Ri[t]=new so(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(K4,Q4);Ri[t]=new so(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){Ri[e]=new so(e,1,!1,e.toLowerCase(),null,!1,!1)});Ri.xlinkHref=new so("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){Ri[e]=new so(e,1,!1,e.toLowerCase(),null,!0,!0)});function X4(e,t,n,r){var i=Ri.hasOwnProperty(t)?Ri[t]:null;(i!==null?i.type!==0:r||!(2s||i[a]!==o[s]){var l=` -`+i[a].replace(" at new "," at ");return e.displayName&&l.includes("")&&(l=l.replace("",e.displayName)),l}while(1<=a&&0<=s);break}}}finally{Cw=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?dg(e):""}function mQ(e){switch(e.tag){case 5:return dg(e.type);case 16:return dg("Lazy");case 13:return dg("Suspense");case 19:return dg("SuspenseList");case 0:case 2:case 15:return e=Ew(e.type,!1),e;case 11:return e=Ew(e.type.render,!1),e;case 1:return e=Ew(e.type,!0),e;default:return""}}function K5(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case Pf:return"Fragment";case Af:return"Portal";case H5:return"Profiler";case Y4:return"StrictMode";case q5:return"Suspense";case W5:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case t$:return(e.displayName||"Context")+".Consumer";case e$:return(e._context.displayName||"Context")+".Provider";case Z4:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case J4:return t=e.displayName||null,t!==null?t:K5(e.type)||"Memo";case pu:t=e._payload,e=e._init;try{return K5(e(t))}catch{}}return null}function yQ(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return K5(t);case 8:return t===Y4?"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 t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function Zu(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function r$(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function vQ(e){var t=r$(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var i=n.get,o=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(a){r=""+a,o.call(this,a)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(a){r=""+a},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Hy(e){e._valueTracker||(e._valueTracker=vQ(e))}function i$(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=r$(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function db(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function Q5(e,t){var n=t.checked;return cr({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function GP(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=Zu(t.value!=null?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function o$(e,t){t=t.checked,t!=null&&X4(e,"checked",t,!1)}function X5(e,t){o$(e,t);var n=Zu(t.value),r=t.type;if(n!=null)r==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?Y5(e,t.type,n):t.hasOwnProperty("defaultValue")&&Y5(e,t.type,Zu(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function HP(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!(r!=="submit"&&r!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function Y5(e,t,n){(t!=="number"||db(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var fg=Array.isArray;function Yf(e,t,n,r){if(e=e.options,t){t={};for(var i=0;i"+t.valueOf().toString()+"",t=qy.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function um(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Rg={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},bQ=["Webkit","ms","Moz","O"];Object.keys(Rg).forEach(function(e){bQ.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Rg[t]=Rg[e]})});function u$(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||Rg.hasOwnProperty(e)&&Rg[e]?(""+t).trim():t+"px"}function c$(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,i=u$(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,i):e[n]=i}}var _Q=cr({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 e3(e,t){if(t){if(_Q[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(le(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(le(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(le(61))}if(t.style!=null&&typeof t.style!="object")throw Error(le(62))}}function t3(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){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 n3=null;function ek(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var r3=null,Zf=null,Jf=null;function KP(e){if(e=H0(e)){if(typeof r3!="function")throw Error(le(280));var t=e.stateNode;t&&(t=yS(t),r3(e.stateNode,e.type,t))}}function d$(e){Zf?Jf?Jf.push(e):Jf=[e]:Zf=e}function f$(){if(Zf){var e=Zf,t=Jf;if(Jf=Zf=null,KP(e),t)for(e=0;e>>=0,e===0?32:31-(RQ(e)/OQ|0)|0}var Wy=64,Ky=4194304;function hg(e){switch(e&-e){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 e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function gb(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,i=e.suspendedLanes,o=e.pingedLanes,a=n&268435455;if(a!==0){var s=a&~i;s!==0?r=hg(s):(o&=a,o!==0&&(r=hg(o)))}else a=n&~i,a!==0?r=hg(a):o!==0&&(r=hg(o));if(r===0)return 0;if(t!==0&&t!==r&&!(t&i)&&(i=r&-r,o=t&-t,i>=o||i===16&&(o&4194240)!==0))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0n;n++)t.push(e);return t}function V0(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Ja(t),e[t]=n}function DQ(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0=Mg),r6=String.fromCharCode(32),i6=!1;function O$(e,t){switch(e){case"keyup":return cX.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function M$(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var If=!1;function fX(e,t){switch(e){case"compositionend":return M$(t);case"keypress":return t.which!==32?null:(i6=!0,r6);case"textInput":return e=t.data,e===r6&&i6?null:e;default:return null}}function hX(e,t){if(If)return e==="compositionend"||!lk&&O$(e,t)?(e=I$(),S1=ok=Pu=null,If=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=l6(n)}}function L$(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?L$(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function F$(){for(var e=window,t=db();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=db(e.document)}return t}function uk(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function xX(e){var t=F$(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&L$(n.ownerDocument.documentElement,n)){if(r!==null&&uk(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var i=n.textContent.length,o=Math.min(r.start,i);r=r.end===void 0?o:Math.min(r.end,i),!e.extend&&o>r&&(i=r,r=o,o=i),i=u6(n,o);var a=u6(n,r);i&&a&&(e.rangeCount!==1||e.anchorNode!==i.node||e.anchorOffset!==i.offset||e.focusNode!==a.node||e.focusOffset!==a.offset)&&(t=t.createRange(),t.setStart(i.node,i.offset),e.removeAllRanges(),o>r?(e.addRange(t),e.extend(a.node,a.offset)):(t.setEnd(a.node,a.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n=document.documentMode,Rf=null,u3=null,$g=null,c3=!1;function c6(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;c3||Rf==null||Rf!==db(r)||(r=Rf,"selectionStart"in r&&uk(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),$g&&gm($g,r)||($g=r,r=vb(u3,"onSelect"),0Nf||(e.current=m3[Nf],m3[Nf]=null,Nf--)}function Nn(e,t){Nf++,m3[Nf]=e.current,e.current=t}var Ju={},Wi=mc(Ju),Eo=mc(!1),_d=Ju;function Mh(e,t){var n=e.type.contextTypes;if(!n)return Ju;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var i={},o;for(o in n)i[o]=t[o];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=i),i}function ko(e){return e=e.childContextTypes,e!=null}function _b(){Kn(Eo),Kn(Wi)}function y6(e,t,n){if(Wi.current!==Ju)throw Error(le(168));Nn(Wi,t),Nn(Eo,n)}function W$(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var i in r)if(!(i in t))throw Error(le(108,yQ(e)||"Unknown",i));return cr({},n,r)}function Sb(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Ju,_d=Wi.current,Nn(Wi,e),Nn(Eo,Eo.current),!0}function v6(e,t,n){var r=e.stateNode;if(!r)throw Error(le(169));n?(e=W$(e,t,_d),r.__reactInternalMemoizedMergedChildContext=e,Kn(Eo),Kn(Wi),Nn(Wi,e)):Kn(Eo),Nn(Eo,n)}var yl=null,vS=!1,Bw=!1;function K$(e){yl===null?yl=[e]:yl.push(e)}function NX(e){vS=!0,K$(e)}function yc(){if(!Bw&&yl!==null){Bw=!0;var e=0,t=mn;try{var n=yl;for(mn=1;e>=a,i-=a,Tl=1<<32-Ja(t)+i|n<C?(T=x,x=null):T=x.sibling;var k=f(b,x,g[C],y);if(k===null){x===null&&(x=T);break}e&&x&&k.alternate===null&&t(b,x),v=o(k,v,C),w===null?S=k:w.sibling=k,w=k,x=T}if(C===g.length)return n(b,x),tr&&Fc(b,C),S;if(x===null){for(;CC?(T=x,x=null):T=x.sibling;var P=f(b,x,k.value,y);if(P===null){x===null&&(x=T);break}e&&x&&P.alternate===null&&t(b,x),v=o(P,v,C),w===null?S=P:w.sibling=P,w=P,x=T}if(k.done)return n(b,x),tr&&Fc(b,C),S;if(x===null){for(;!k.done;C++,k=g.next())k=d(b,k.value,y),k!==null&&(v=o(k,v,C),w===null?S=k:w.sibling=k,w=k);return tr&&Fc(b,C),S}for(x=r(b,x);!k.done;C++,k=g.next())k=h(x,b,C,k.value,y),k!==null&&(e&&k.alternate!==null&&x.delete(k.key===null?C:k.key),v=o(k,v,C),w===null?S=k:w.sibling=k,w=k);return e&&x.forEach(function($){return t(b,$)}),tr&&Fc(b,C),S}function _(b,v,g,y){if(typeof g=="object"&&g!==null&&g.type===Pf&&g.key===null&&(g=g.props.children),typeof g=="object"&&g!==null){switch(g.$$typeof){case Gy:e:{for(var S=g.key,w=v;w!==null;){if(w.key===S){if(S=g.type,S===Pf){if(w.tag===7){n(b,w.sibling),v=i(w,g.props.children),v.return=b,b=v;break e}}else if(w.elementType===S||typeof S=="object"&&S!==null&&S.$$typeof===pu&&E6(S)===w.type){n(b,w.sibling),v=i(w,g.props),v.ref=Fp(b,w,g),v.return=b,b=v;break e}n(b,w);break}else t(b,w);w=w.sibling}g.type===Pf?(v=cd(g.props.children,b.mode,y,g.key),v.return=b,b=v):(y=P1(g.type,g.key,g.props,null,b.mode,y),y.ref=Fp(b,v,g),y.return=b,b=y)}return a(b);case Af:e:{for(w=g.key;v!==null;){if(v.key===w)if(v.tag===4&&v.stateNode.containerInfo===g.containerInfo&&v.stateNode.implementation===g.implementation){n(b,v.sibling),v=i(v,g.children||[]),v.return=b,b=v;break e}else{n(b,v);break}else t(b,v);v=v.sibling}v=Ww(g,b.mode,y),v.return=b,b=v}return a(b);case pu:return w=g._init,_(b,v,w(g._payload),y)}if(fg(g))return p(b,v,g,y);if(Mp(g))return m(b,v,g,y);tv(b,g)}return typeof g=="string"&&g!==""||typeof g=="number"?(g=""+g,v!==null&&v.tag===6?(n(b,v.sibling),v=i(v,g),v.return=b,b=v):(n(b,v),v=qw(g,b.mode,y),v.return=b,b=v),a(b)):n(b,v)}return _}var $h=nD(!0),rD=nD(!1),q0={},Fs=mc(q0),bm=mc(q0),_m=mc(q0);function Zc(e){if(e===q0)throw Error(le(174));return e}function vk(e,t){switch(Nn(_m,t),Nn(bm,e),Nn(Fs,q0),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:J5(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=J5(t,e)}Kn(Fs),Nn(Fs,t)}function Dh(){Kn(Fs),Kn(bm),Kn(_m)}function iD(e){Zc(_m.current);var t=Zc(Fs.current),n=J5(t,e.type);t!==n&&(Nn(bm,e),Nn(Fs,n))}function bk(e){bm.current===e&&(Kn(Fs),Kn(bm))}var sr=mc(0);function Tb(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||n.data==="$?"||n.data==="$!"))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==void 0){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var zw=[];function _k(){for(var e=0;en?n:4,e(!0);var r=jw.transition;jw.transition={};try{e(!1),t()}finally{mn=n,jw.transition=r}}function _D(){return xa().memoizedState}function FX(e,t,n){var r=Uu(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},SD(e))xD(t,n);else if(n=Z$(e,t,n,r),n!==null){var i=no();es(n,e,r,i),wD(n,t,r)}}function BX(e,t,n){var r=Uu(e),i={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(SD(e))xD(t,i);else{var o=e.alternate;if(e.lanes===0&&(o===null||o.lanes===0)&&(o=t.lastRenderedReducer,o!==null))try{var a=t.lastRenderedState,s=o(a,n);if(i.hasEagerState=!0,i.eagerState=s,os(s,a)){var l=t.interleaved;l===null?(i.next=i,mk(t)):(i.next=l.next,l.next=i),t.interleaved=i;return}}catch{}finally{}n=Z$(e,t,i,r),n!==null&&(i=no(),es(n,e,r,i),wD(n,t,r))}}function SD(e){var t=e.alternate;return e===ur||t!==null&&t===ur}function xD(e,t){Dg=Ab=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function wD(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,nk(e,n)}}var Pb={readContext:Sa,useCallback:Li,useContext:Li,useEffect:Li,useImperativeHandle:Li,useInsertionEffect:Li,useLayoutEffect:Li,useMemo:Li,useReducer:Li,useRef:Li,useState:Li,useDebugValue:Li,useDeferredValue:Li,useTransition:Li,useMutableSource:Li,useSyncExternalStore:Li,useId:Li,unstable_isNewReconciler:!1},zX={readContext:Sa,useCallback:function(e,t){return _s().memoizedState=[e,t===void 0?null:t],e},useContext:Sa,useEffect:T6,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,E1(4194308,4,gD.bind(null,t,e),n)},useLayoutEffect:function(e,t){return E1(4194308,4,e,t)},useInsertionEffect:function(e,t){return E1(4,2,e,t)},useMemo:function(e,t){var n=_s();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=_s();return t=n!==void 0?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=FX.bind(null,ur,e),[r.memoizedState,e]},useRef:function(e){var t=_s();return e={current:e},t.memoizedState=e},useState:k6,useDebugValue:Ek,useDeferredValue:function(e){return _s().memoizedState=e},useTransition:function(){var e=k6(!1),t=e[0];return e=LX.bind(null,e[1]),_s().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=ur,i=_s();if(tr){if(n===void 0)throw Error(le(407));n=n()}else{if(n=t(),di===null)throw Error(le(349));xd&30||sD(r,t,n)}i.memoizedState=n;var o={value:n,getSnapshot:t};return i.queue=o,T6(uD.bind(null,r,o,e),[e]),r.flags|=2048,wm(9,lD.bind(null,r,o,n,t),void 0,null),n},useId:function(){var e=_s(),t=di.identifierPrefix;if(tr){var n=Al,r=Tl;n=(r&~(1<<32-Ja(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=Sm++,0<\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=a.createElement(n,{is:r.is}):(e=a.createElement(n),n==="select"&&(a=e,r.multiple?a.multiple=!0:r.size&&(a.size=r.size))):e=a.createElementNS(e,n),e[As]=t,e[vm]=r,OD(e,t,!1,!1),t.stateNode=e;e:{switch(a=t3(n,r),n){case"dialog":jn("cancel",e),jn("close",e),i=r;break;case"iframe":case"object":case"embed":jn("load",e),i=r;break;case"video":case"audio":for(i=0;iFh&&(t.flags|=128,r=!0,Bp(o,!1),t.lanes=4194304)}else{if(!r)if(e=Tb(a),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),Bp(o,!0),o.tail===null&&o.tailMode==="hidden"&&!a.alternate&&!tr)return Fi(t),null}else 2*Cr()-o.renderingStartTime>Fh&&n!==1073741824&&(t.flags|=128,r=!0,Bp(o,!1),t.lanes=4194304);o.isBackwards?(a.sibling=t.child,t.child=a):(n=o.last,n!==null?n.sibling=a:t.child=a,o.last=a)}return o.tail!==null?(t=o.tail,o.rendering=t,o.tail=t.sibling,o.renderingStartTime=Cr(),t.sibling=null,n=sr.current,Nn(sr,r?n&1|2:n&1),t):(Fi(t),null);case 22:case 23:return Rk(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?jo&1073741824&&(Fi(t),t.subtreeFlags&6&&(t.flags|=8192)):Fi(t),null;case 24:return null;case 25:return null}throw Error(le(156,t.tag))}function KX(e,t){switch(dk(t),t.tag){case 1:return ko(t.type)&&_b(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Dh(),Kn(Eo),Kn(Wi),_k(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return bk(t),null;case 13:if(Kn(sr),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(le(340));Nh()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Kn(sr),null;case 4:return Dh(),null;case 10:return gk(t.type._context),null;case 22:case 23:return Rk(),null;case 24:return null;default:return null}}var rv=!1,Gi=!1,QX=typeof WeakSet=="function"?WeakSet:Set,De=null;function Ff(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){gr(e,t,r)}else n.current=null}function A3(e,t,n){try{n()}catch(r){gr(e,t,r)}}var D6=!1;function XX(e,t){if(d3=mb,e=F$(),uk(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var i=r.anchorOffset,o=r.focusNode;r=r.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break e}var a=0,s=-1,l=-1,u=0,c=0,d=e,f=null;t:for(;;){for(var h;d!==n||i!==0&&d.nodeType!==3||(s=a+i),d!==o||r!==0&&d.nodeType!==3||(l=a+r),d.nodeType===3&&(a+=d.nodeValue.length),(h=d.firstChild)!==null;)f=d,d=h;for(;;){if(d===e)break t;if(f===n&&++u===i&&(s=a),f===o&&++c===r&&(l=a),(h=d.nextSibling)!==null)break;d=f,f=d.parentNode}d=h}n=s===-1||l===-1?null:{start:s,end:l}}else n=null}n=n||{start:0,end:0}}else n=null;for(f3={focusedElem:e,selectionRange:n},mb=!1,De=t;De!==null;)if(t=De,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,De=e;else for(;De!==null;){t=De;try{var p=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(p!==null){var m=p.memoizedProps,_=p.memoizedState,b=t.stateNode,v=b.getSnapshotBeforeUpdate(t.elementType===t.type?m:ja(t.type,m),_);b.__reactInternalSnapshotBeforeUpdate=v}break;case 3:var g=t.stateNode.containerInfo;g.nodeType===1?g.textContent="":g.nodeType===9&&g.documentElement&&g.removeChild(g.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(le(163))}}catch(y){gr(t,t.return,y)}if(e=t.sibling,e!==null){e.return=t.return,De=e;break}De=t.return}return p=D6,D6=!1,p}function Lg(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var i=r=r.next;do{if((i.tag&e)===e){var o=i.destroy;i.destroy=void 0,o!==void 0&&A3(t,n,o)}i=i.next}while(i!==r)}}function SS(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function P3(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function $D(e){var t=e.alternate;t!==null&&(e.alternate=null,$D(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[As],delete t[vm],delete t[g3],delete t[OX],delete t[MX])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function DD(e){return e.tag===5||e.tag===3||e.tag===4}function L6(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||DD(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function I3(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=bb));else if(r!==4&&(e=e.child,e!==null))for(I3(e,t,n),e=e.sibling;e!==null;)I3(e,t,n),e=e.sibling}function R3(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(R3(e,t,n),e=e.sibling;e!==null;)R3(e,t,n),e=e.sibling}var wi=null,Va=!1;function ou(e,t,n){for(n=n.child;n!==null;)LD(e,t,n),n=n.sibling}function LD(e,t,n){if(Ls&&typeof Ls.onCommitFiberUnmount=="function")try{Ls.onCommitFiberUnmount(hS,n)}catch{}switch(n.tag){case 5:Gi||Ff(n,t);case 6:var r=wi,i=Va;wi=null,ou(e,t,n),wi=r,Va=i,wi!==null&&(Va?(e=wi,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):wi.removeChild(n.stateNode));break;case 18:wi!==null&&(Va?(e=wi,n=n.stateNode,e.nodeType===8?Fw(e.parentNode,n):e.nodeType===1&&Fw(e,n),hm(e)):Fw(wi,n.stateNode));break;case 4:r=wi,i=Va,wi=n.stateNode.containerInfo,Va=!0,ou(e,t,n),wi=r,Va=i;break;case 0:case 11:case 14:case 15:if(!Gi&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){i=r=r.next;do{var o=i,a=o.destroy;o=o.tag,a!==void 0&&(o&2||o&4)&&A3(n,t,a),i=i.next}while(i!==r)}ou(e,t,n);break;case 1:if(!Gi&&(Ff(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(s){gr(n,t,s)}ou(e,t,n);break;case 21:ou(e,t,n);break;case 22:n.mode&1?(Gi=(r=Gi)||n.memoizedState!==null,ou(e,t,n),Gi=r):ou(e,t,n);break;default:ou(e,t,n)}}function F6(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new QX),t.forEach(function(r){var i=oY.bind(null,e,r);n.has(r)||(n.add(r),r.then(i,i))})}}function Fa(e,t){var n=t.deletions;if(n!==null)for(var r=0;ri&&(i=a),r&=~o}if(r=i,r=Cr()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*ZX(r/1960))-r,10e?16:e,Iu===null)var r=!1;else{if(e=Iu,Iu=null,Ob=0,Ht&6)throw Error(le(331));var i=Ht;for(Ht|=4,De=e.current;De!==null;){var o=De,a=o.child;if(De.flags&16){var s=o.deletions;if(s!==null){for(var l=0;lCr()-Pk?ud(e,0):Ak|=n),To(e,t)}function HD(e,t){t===0&&(e.mode&1?(t=Ky,Ky<<=1,!(Ky&130023424)&&(Ky=4194304)):t=1);var n=no();e=jl(e,t),e!==null&&(V0(e,t,n),To(e,n))}function iY(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),HD(e,n)}function oY(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,i=e.memoizedState;i!==null&&(n=i.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(le(314))}r!==null&&r.delete(t),HD(e,n)}var qD;qD=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||Eo.current)So=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return So=!1,qX(e,t,n);So=!!(e.flags&131072)}else So=!1,tr&&t.flags&1048576&&Q$(t,wb,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;k1(e,t),e=t.pendingProps;var i=Mh(t,Wi.current);th(t,n),i=xk(null,t,r,e,i,n);var o=wk();return t.flags|=1,typeof i=="object"&&i!==null&&typeof i.render=="function"&&i.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,ko(r)?(o=!0,Sb(t)):o=!1,t.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,yk(t),i.updater=bS,t.stateNode=i,i._reactInternals=t,S3(t,r,e,n),t=C3(null,t,r,!0,o,n)):(t.tag=0,tr&&o&&ck(t),Ji(null,t,i,n),t=t.child),t;case 16:r=t.elementType;e:{switch(k1(e,t),e=t.pendingProps,i=r._init,r=i(r._payload),t.type=r,i=t.tag=sY(r),e=ja(r,e),i){case 0:t=w3(null,t,r,e,n);break e;case 1:t=M6(null,t,r,e,n);break e;case 11:t=R6(null,t,r,e,n);break e;case 14:t=O6(null,t,r,ja(r.type,e),n);break e}throw Error(le(306,r,""))}return t;case 0:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:ja(r,i),w3(e,t,r,i,n);case 1:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:ja(r,i),M6(e,t,r,i,n);case 3:e:{if(PD(t),e===null)throw Error(le(387));r=t.pendingProps,o=t.memoizedState,i=o.element,J$(e,t),kb(t,r,null,n);var a=t.memoizedState;if(r=a.element,o.isDehydrated)if(o={element:r,isDehydrated:!1,cache:a.cache,pendingSuspenseBoundaries:a.pendingSuspenseBoundaries,transitions:a.transitions},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){i=Lh(Error(le(423)),t),t=N6(e,t,r,n,i);break e}else if(r!==i){i=Lh(Error(le(424)),t),t=N6(e,t,r,n,i);break e}else for(Ho=Bu(t.stateNode.containerInfo.firstChild),Wo=t,tr=!0,Ha=null,n=rD(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Nh(),r===i){t=Ul(e,t,n);break e}Ji(e,t,r,n)}t=t.child}return t;case 5:return iD(t),e===null&&v3(t),r=t.type,i=t.pendingProps,o=e!==null?e.memoizedProps:null,a=i.children,h3(r,i)?a=null:o!==null&&h3(r,o)&&(t.flags|=32),AD(e,t),Ji(e,t,a,n),t.child;case 6:return e===null&&v3(t),null;case 13:return ID(e,t,n);case 4:return vk(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=$h(t,null,r,n):Ji(e,t,r,n),t.child;case 11:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:ja(r,i),R6(e,t,r,i,n);case 7:return Ji(e,t,t.pendingProps,n),t.child;case 8:return Ji(e,t,t.pendingProps.children,n),t.child;case 12:return Ji(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,i=t.pendingProps,o=t.memoizedProps,a=i.value,Nn(Cb,r._currentValue),r._currentValue=a,o!==null)if(os(o.value,a)){if(o.children===i.children&&!Eo.current){t=Ul(e,t,n);break e}}else for(o=t.child,o!==null&&(o.return=t);o!==null;){var s=o.dependencies;if(s!==null){a=o.child;for(var l=s.firstContext;l!==null;){if(l.context===r){if(o.tag===1){l=Ol(-1,n&-n),l.tag=2;var u=o.updateQueue;if(u!==null){u=u.shared;var c=u.pending;c===null?l.next=l:(l.next=c.next,c.next=l),u.pending=l}}o.lanes|=n,l=o.alternate,l!==null&&(l.lanes|=n),b3(o.return,n,t),s.lanes|=n;break}l=l.next}}else if(o.tag===10)a=o.type===t.type?null:o.child;else if(o.tag===18){if(a=o.return,a===null)throw Error(le(341));a.lanes|=n,s=a.alternate,s!==null&&(s.lanes|=n),b3(a,n,t),a=o.sibling}else a=o.child;if(a!==null)a.return=o;else for(a=o;a!==null;){if(a===t){a=null;break}if(o=a.sibling,o!==null){o.return=a.return,a=o;break}a=a.return}o=a}Ji(e,t,i.children,n),t=t.child}return t;case 9:return i=t.type,r=t.pendingProps.children,th(t,n),i=Sa(i),r=r(i),t.flags|=1,Ji(e,t,r,n),t.child;case 14:return r=t.type,i=ja(r,t.pendingProps),i=ja(r.type,i),O6(e,t,r,i,n);case 15:return kD(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:ja(r,i),k1(e,t),t.tag=1,ko(r)?(e=!0,Sb(t)):e=!1,th(t,n),tD(t,r,i),S3(t,r,i,n),C3(null,t,r,!0,e,n);case 19:return RD(e,t,n);case 22:return TD(e,t,n)}throw Error(le(156,t.tag))};function WD(e,t){return b$(e,t)}function aY(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function va(e,t,n,r){return new aY(e,t,n,r)}function Mk(e){return e=e.prototype,!(!e||!e.isReactComponent)}function sY(e){if(typeof e=="function")return Mk(e)?1:0;if(e!=null){if(e=e.$$typeof,e===Z4)return 11;if(e===J4)return 14}return 2}function Vu(e,t){var n=e.alternate;return n===null?(n=va(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function P1(e,t,n,r,i,o){var a=2;if(r=e,typeof e=="function")Mk(e)&&(a=1);else if(typeof e=="string")a=5;else e:switch(e){case Pf:return cd(n.children,i,o,t);case Y4:a=8,i|=8;break;case H5:return e=va(12,n,t,i|2),e.elementType=H5,e.lanes=o,e;case q5:return e=va(13,n,t,i),e.elementType=q5,e.lanes=o,e;case W5:return e=va(19,n,t,i),e.elementType=W5,e.lanes=o,e;case n$:return wS(n,i,o,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case e$:a=10;break e;case t$:a=9;break e;case Z4:a=11;break e;case J4:a=14;break e;case pu:a=16,r=null;break e}throw Error(le(130,e==null?e:typeof e,""))}return t=va(a,n,t,i),t.elementType=e,t.type=r,t.lanes=o,t}function cd(e,t,n,r){return e=va(7,e,r,t),e.lanes=n,e}function wS(e,t,n,r){return e=va(22,e,r,t),e.elementType=n$,e.lanes=n,e.stateNode={isHidden:!1},e}function qw(e,t,n){return e=va(6,e,null,t),e.lanes=n,e}function Ww(e,t,n){return t=va(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function lY(e,t,n,r,i){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Tw(0),this.expirationTimes=Tw(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Tw(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function Nk(e,t,n,r,i,o,a,s,l){return e=new lY(e,t,n,s,l),t===1?(t=1,o===!0&&(t|=8)):t=0,o=va(3,null,null,t),e.current=o,o.stateNode=e,o.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},yk(o),e}function uY(e,t,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(YD)}catch(e){console.error(e)}}YD(),QN.exports=ea;var Uo=QN.exports;const jje=pc(Uo);var q6=Uo;V5.createRoot=q6.createRoot,V5.hydrateRoot=q6.hydrateRoot;const pY="modulepreload",gY=function(e,t){return new URL(e,t).href},W6={},ZD=function(t,n,r){if(!n||n.length===0)return t();const i=document.getElementsByTagName("link");return Promise.all(n.map(o=>{if(o=gY(o,r),o in W6)return;W6[o]=!0;const a=o.endsWith(".css"),s=a?'[rel="stylesheet"]':"";if(!!r)for(let c=i.length-1;c>=0;c--){const d=i[c];if(d.href===o&&(!a||d.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${o}"]${s}`))return;const u=document.createElement("link");if(u.rel=a?"stylesheet":pY,a||(u.as="script",u.crossOrigin=""),u.href=o,document.head.appendChild(u),a)return new Promise((c,d)=>{u.addEventListener("load",c),u.addEventListener("error",()=>d(new Error(`Unable to preload CSS for ${o}`)))})})).then(()=>t()).catch(o=>{const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=o,window.dispatchEvent(a),!a.defaultPrevented)throw o})};function ci(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r3?t.i-4:t.i:Array.isArray(e)?1:AS(e)?2:PS(e)?3:0}function Gu(e,t){return ec(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function I1(e,t){return ec(e)===2?e.get(t):e[t]}function JD(e,t,n){var r=ec(e);r===2?e.set(t,n):r===3?e.add(n):e[t]=n}function eL(e,t){return e===t?e!==0||1/e==1/t:e!=e&&t!=t}function AS(e){return SY&&e instanceof Map}function PS(e){return xY&&e instanceof Set}function ri(e){return e.o||e.t}function Bk(e){if(Array.isArray(e))return Array.prototype.slice.call(e);var t=nL(e);delete t[St];for(var n=ih(t),r=0;r1&&(e.set=e.add=e.clear=e.delete=mY),Object.freeze(e),t&&Vl(e,function(n,r){return W0(r,!0)},!0)),e}function mY(){ci(2)}function zk(e){return e==null||typeof e!="object"||Object.isFrozen(e)}function Bs(e){var t=L3[e];return t||ci(18,e),t}function jk(e,t){L3[e]||(L3[e]=t)}function Em(){return Tm}function Kw(e,t){t&&(Bs("Patches"),e.u=[],e.s=[],e.v=t)}function $b(e){D3(e),e.p.forEach(yY),e.p=null}function D3(e){e===Tm&&(Tm=e.l)}function K6(e){return Tm={p:[],l:Tm,h:e,m:!0,_:0}}function yY(e){var t=e[St];t.i===0||t.i===1?t.j():t.g=!0}function Qw(e,t){t._=t.p.length;var n=t.p[0],r=e!==void 0&&e!==n;return t.h.O||Bs("ES5").S(t,e,r),r?(n[St].P&&($b(t),ci(4)),Ao(e)&&(e=Db(t,e),t.l||Lb(t,e)),t.u&&Bs("Patches").M(n[St].t,e,t.u,t.s)):e=Db(t,n,[]),$b(t),t.u&&t.v(t.u,t.s),e!==RS?e:void 0}function Db(e,t,n){if(zk(t))return t;var r=t[St];if(!r)return Vl(t,function(s,l){return Q6(e,r,t,s,l,n)},!0),t;if(r.A!==e)return t;if(!r.P)return Lb(e,r.t,!0),r.t;if(!r.I){r.I=!0,r.A._--;var i=r.i===4||r.i===5?r.o=Bk(r.k):r.o,o=i,a=!1;r.i===3&&(o=new Set(i),i.clear(),a=!0),Vl(o,function(s,l){return Q6(e,r,i,s,l,n,a)}),Lb(e,i,!1),n&&e.u&&Bs("Patches").N(r,n,e.u,e.s)}return r.o}function Q6(e,t,n,r,i,o,a){if(io(i)){var s=Db(e,i,o&&t&&t.i!==3&&!Gu(t.R,r)?o.concat(r):void 0);if(JD(n,r,s),!io(s))return;e.m=!1}else a&&n.add(i);if(Ao(i)&&!zk(i)){if(!e.h.D&&e._<1)return;Db(e,i),t&&t.A.l||Lb(e,i)}}function Lb(e,t,n){n===void 0&&(n=!1),!e.l&&e.h.D&&e.m&&W0(t,n)}function Xw(e,t){var n=e[St];return(n?ri(n):e)[t]}function X6(e,t){if(t in e)for(var n=Object.getPrototypeOf(e);n;){var r=Object.getOwnPropertyDescriptor(n,t);if(r)return r;n=Object.getPrototypeOf(n)}}function bo(e){e.P||(e.P=!0,e.l&&bo(e.l))}function Yw(e){e.o||(e.o=Bk(e.t))}function km(e,t,n){var r=AS(t)?Bs("MapSet").F(t,n):PS(t)?Bs("MapSet").T(t,n):e.O?function(i,o){var a=Array.isArray(i),s={i:a?1:0,A:o?o.A:Em(),P:!1,I:!1,R:{},l:o,t:i,k:null,o:null,j:null,C:!1},l=s,u=Am;a&&(l=[s],u=gg);var c=Proxy.revocable(l,u),d=c.revoke,f=c.proxy;return s.k=f,s.j=d,f}(t,n):Bs("ES5").J(t,n);return(n?n.A:Em()).p.push(r),r}function IS(e){return io(e)||ci(22,e),function t(n){if(!Ao(n))return n;var r,i=n[St],o=ec(n);if(i){if(!i.P&&(i.i<4||!Bs("ES5").K(i)))return i.t;i.I=!0,r=Y6(n,o),i.I=!1}else r=Y6(n,o);return Vl(r,function(a,s){i&&I1(i.t,a)===s||JD(r,a,t(s))}),o===3?new Set(r):r}(e)}function Y6(e,t){switch(t){case 2:return new Map(e);case 3:return Array.from(e)}return Bk(e)}function Uk(){function e(o,a){var s=i[o];return s?s.enumerable=a:i[o]=s={configurable:!0,enumerable:a,get:function(){var l=this[St];return Am.get(l,o)},set:function(l){var u=this[St];Am.set(u,o,l)}},s}function t(o){for(var a=o.length-1;a>=0;a--){var s=o[a][St];if(!s.P)switch(s.i){case 5:r(s)&&bo(s);break;case 4:n(s)&&bo(s)}}}function n(o){for(var a=o.t,s=o.k,l=ih(s),u=l.length-1;u>=0;u--){var c=l[u];if(c!==St){var d=a[c];if(d===void 0&&!Gu(a,c))return!0;var f=s[c],h=f&&f[St];if(h?h.t!==d:!eL(f,d))return!0}}var p=!!a[St];return l.length!==ih(a).length+(p?0:1)}function r(o){var a=o.k;if(a.length!==o.t.length)return!0;var s=Object.getOwnPropertyDescriptor(a,a.length-1);if(s&&!s.get)return!0;for(var l=0;l1?b-1:0),g=1;g1?c-1:0),f=1;f=0;i--){var o=r[i];if(o.path.length===0&&o.op==="replace"){n=o.value;break}}i>-1&&(r=r.slice(i+1));var a=Bs("Patches").$;return io(n)?a(n,r):this.produce(n,function(s){return a(s,r)})},e}(),Yo=new rL,iL=Yo.produce,Hk=Yo.produceWithPatches.bind(Yo),CY=Yo.setAutoFreeze.bind(Yo),EY=Yo.setUseProxies.bind(Yo),F3=Yo.applyPatches.bind(Yo),kY=Yo.createDraft.bind(Yo),TY=Yo.finishDraft.bind(Yo);const vc=iL,AY=Object.freeze(Object.defineProperty({__proto__:null,Immer:rL,applyPatches:F3,castDraft:bY,castImmutable:_Y,createDraft:kY,current:IS,default:vc,enableAllPlugins:vY,enableES5:Uk,enableMapSet:tL,enablePatches:Vk,finishDraft:TY,freeze:W0,immerable:rh,isDraft:io,isDraftable:Ao,nothing:RS,original:Fk,produce:iL,produceWithPatches:Hk,setAutoFreeze:CY,setUseProxies:EY},Symbol.toStringTag,{value:"Module"}));function Pm(e){"@babel/helpers - typeof";return Pm=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},Pm(e)}function PY(e,t){if(Pm(e)!=="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(Pm(r)!=="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function IY(e){var t=PY(e,"string");return Pm(t)==="symbol"?t:String(t)}function RY(e,t,n){return t=IY(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function e8(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function t8(e){for(var t=1;t"u"&&(n=t,t=void 0),typeof n<"u"){if(typeof n!="function")throw new Error(Ci(1));return n(K0)(e,t)}if(typeof e!="function")throw new Error(Ci(2));var i=e,o=t,a=[],s=a,l=!1;function u(){s===a&&(s=a.slice())}function c(){if(l)throw new Error(Ci(3));return o}function d(m){if(typeof m!="function")throw new Error(Ci(4));if(l)throw new Error(Ci(5));var _=!0;return u(),s.push(m),function(){if(_){if(l)throw new Error(Ci(6));_=!1,u();var v=s.indexOf(m);s.splice(v,1),a=null}}}function f(m){if(!OY(m))throw new Error(Ci(7));if(typeof m.type>"u")throw new Error(Ci(8));if(l)throw new Error(Ci(9));try{l=!0,o=i(o,m)}finally{l=!1}for(var _=a=s,b=0;b<_.length;b++){var v=_[b];v()}return m}function h(m){if(typeof m!="function")throw new Error(Ci(10));i=m,f({type:Bh.REPLACE})}function p(){var m,_=d;return m={subscribe:function(v){if(typeof v!="object"||v===null)throw new Error(Ci(11));function g(){v.next&&v.next(c())}g();var y=_(g);return{unsubscribe:y}}},m[n8]=function(){return this},m}return f({type:Bh.INIT}),r={dispatch:f,subscribe:d,getState:c,replaceReducer:h},r[n8]=p,r}var oL=K0;function MY(e){Object.keys(e).forEach(function(t){var n=e[t],r=n(void 0,{type:Bh.INIT});if(typeof r>"u")throw new Error(Ci(12));if(typeof n(void 0,{type:Bh.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(Ci(13))})}function hp(e){for(var t=Object.keys(e),n={},r=0;r"u")throw u&&u.type,new Error(Ci(14));d[h]=_,c=c||_!==m}return c=c||o.length!==Object.keys(l).length,c?d:l}}function r8(e,t){return function(){return t(e.apply(this,arguments))}}function aL(e,t){if(typeof e=="function")return r8(e,t);if(typeof e!="object"||e===null)throw new Error(Ci(16));var n={};for(var r in e){var i=e[r];typeof i=="function"&&(n[r]=r8(i,t))}return n}function zh(){for(var e=arguments.length,t=new Array(e),n=0;n-1){var u=n[l];return l>0&&(n.splice(l,1),n.unshift(u)),u.value}return Fb}function i(s,l){r(s)===Fb&&(n.unshift({key:s,value:l}),n.length>e&&n.pop())}function o(){return n}function a(){n=[]}return{get:r,put:i,getEntries:o,clear:a}}var sL=function(t,n){return t===n};function LY(e){return function(n,r){if(n===null||r===null||n.length!==r.length)return!1;for(var i=n.length,o=0;o1?t-1:0),r=1;r0&&o[o.length-1])&&(u[0]===6||u[0]===2)){n=0;continue}if(u[0]===3&&(!o||u[1]>o[0]&&u[1]",value:e};if(typeof e!="object"||e===null||o!=null&&o.has(e))return!1;for(var s=r!=null?r(e):Object.entries(e),l=i.length>0,u=function(_,b){var v=t?t+"."+_:_;if(l){var g=i.some(function(y){return y instanceof RegExp?y.test(v):v===y});if(g)return"continue"}if(!n(b))return{value:{keyPath:v,value:b}};if(typeof b=="object"&&(a=gL(b,v,n,r,i,o),a))return{value:a}},c=0,d=s;c-1}function eZ(e){return""+e}function _L(e){var t={},n=[],r,i={addCase:function(o,a){var s=typeof o=="string"?o:o.type;if(s in t)throw new Error("addCase cannot be called with two reducers for the same action type");return t[s]=a,i},addMatcher:function(o,a){return n.push({matcher:o,reducer:a}),i},addDefaultCase:function(o){return r=o,i}};return e(i),[t,n,r]}function tZ(e){return typeof e=="function"}function SL(e,t,n,r){n===void 0&&(n=[]);var i=typeof t=="function"?_L(t):[t,n,r],o=i[0],a=i[1],s=i[2],l;if(tZ(e))l=function(){return B3(e())};else{var u=B3(e);l=function(){return u}}function c(d,f){d===void 0&&(d=l());var h=tc([o[f.type]],a.filter(function(p){var m=p.matcher;return m(f)}).map(function(p){var m=p.reducer;return m}));return h.filter(function(p){return!!p}).length===0&&(h=[s]),h.reduce(function(p,m){if(m)if(io(p)){var _=p,b=m(_,f);return b===void 0?p:b}else{if(Ao(p))return vc(p,function(v){return m(v,f)});var b=m(p,f);if(b===void 0){if(p===null)return p;throw Error("A case reducer on a non-draftable value must not return undefined")}return b}return p},d)}return c.getInitialState=l,c}function nZ(e,t){return e+"/"+t}function nr(e){var t=e.name;if(!t)throw new Error("`name` is a required option for createSlice");typeof process<"u";var n=typeof e.initialState=="function"?e.initialState:B3(e.initialState),r=e.reducers||{},i=Object.keys(r),o={},a={},s={};i.forEach(function(c){var d=r[c],f=nZ(t,c),h,p;"reducer"in d?(h=d.reducer,p=d.prepare):h=d,o[c]=h,a[f]=h,s[c]=p?Ne(f,p):Ne(f)});function l(){var c=typeof e.extraReducers=="function"?_L(e.extraReducers):[e.extraReducers],d=c[0],f=d===void 0?{}:d,h=c[1],p=h===void 0?[]:h,m=c[2],_=m===void 0?void 0:m,b=xo(xo({},f),a);return SL(n,function(v){for(var g in b)v.addCase(g,b[g]);for(var y=0,S=p;y0;if(v){var g=p.filter(function(y){return u(_,y,m)}).length>0;g&&(m.ids=Object.keys(m.entities))}}function f(p,m){return h([p],m)}function h(p,m){var _=xL(p,e,m),b=_[0],v=_[1];d(v,m),n(b,m)}return{removeAll:aZ(l),addOne:xr(t),addMany:xr(n),setOne:xr(r),setMany:xr(i),setAll:xr(o),updateOne:xr(c),updateMany:xr(d),upsertOne:xr(f),upsertMany:xr(h),removeOne:xr(a),removeMany:xr(s)}}function sZ(e,t){var n=wL(e),r=n.removeOne,i=n.removeMany,o=n.removeAll;function a(v,g){return s([v],g)}function s(v,g){v=dd(v);var y=v.filter(function(S){return!(zg(S,e)in g.entities)});y.length!==0&&_(y,g)}function l(v,g){return u([v],g)}function u(v,g){v=dd(v),v.length!==0&&_(v,g)}function c(v,g){v=dd(v),g.entities={},g.ids=[],s(v,g)}function d(v,g){return f([v],g)}function f(v,g){for(var y=!1,S=0,w=v;S-1;return n&&r}function Y0(e){return typeof e[0]=="function"&&"pending"in e[0]&&"fulfilled"in e[0]&&"rejected"in e[0]}function NS(){for(var e=[],t=0;t0)for(var g=h.getState(),y=Array.from(n.values()),S=0,w=y;SMath.floor(e/t)*t,qa=(e,t)=>Math.round(e/t)*t;var kZ=typeof global=="object"&&global&&global.Object===Object&&global;const jL=kZ;var TZ=typeof self=="object"&&self&&self.Object===Object&&self,AZ=jL||TZ||Function("return this")();const el=AZ;var PZ=el.Symbol;const wa=PZ;var UL=Object.prototype,IZ=UL.hasOwnProperty,RZ=UL.toString,jp=wa?wa.toStringTag:void 0;function OZ(e){var t=IZ.call(e,jp),n=e[jp];try{e[jp]=void 0;var r=!0}catch{}var i=RZ.call(e);return r&&(t?e[jp]=n:delete e[jp]),i}var MZ=Object.prototype,NZ=MZ.toString;function $Z(e){return NZ.call(e)}var DZ="[object Null]",LZ="[object Undefined]",d8=wa?wa.toStringTag:void 0;function cs(e){return e==null?e===void 0?LZ:DZ:d8&&d8 in Object(e)?OZ(e):$Z(e)}function Po(e){return e!=null&&typeof e=="object"}var FZ="[object Symbol]";function $S(e){return typeof e=="symbol"||Po(e)&&cs(e)==FZ}function VL(e,t){for(var n=-1,r=e==null?0:e.length,i=Array(r);++n0){if(++t>=yJ)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}function SJ(e){return function(){return e}}var xJ=function(){try{var e=zd(Object,"defineProperty");return e({},"",{}),e}catch{}}();const Gb=xJ;var wJ=Gb?function(e,t){return Gb(e,"toString",{configurable:!0,enumerable:!1,value:SJ(t),writable:!0})}:DS;const CJ=wJ;var EJ=_J(CJ);const WL=EJ;function KL(e,t){for(var n=-1,r=e==null?0:e.length;++n-1}var RJ=9007199254740991,OJ=/^(?:0|[1-9]\d*)$/;function Yk(e,t){var n=typeof e;return t=t??RJ,!!t&&(n=="number"||n!="symbol"&&OJ.test(e))&&e>-1&&e%1==0&&e-1&&e%1==0&&e<=$J}function gp(e){return e!=null&&Zk(e.length)&&!Xk(e)}function FS(e,t,n){if(!Io(n))return!1;var r=typeof t;return(r=="number"?gp(n)&&Yk(t,n.length):r=="string"&&t in n)?ty(n[t],e):!1}function ZL(e){return YL(function(t,n){var r=-1,i=n.length,o=i>1?n[i-1]:void 0,a=i>2?n[2]:void 0;for(o=e.length>3&&typeof o=="function"?(i--,o):void 0,a&&FS(n[0],n[1],a)&&(o=i<3?void 0:o,i=1),t=Object(t);++r-1}function Xee(e,t){var n=this.__data__,r=zS(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this}function Xl(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t0&&n(s)?t>1?oF(s,t-1,n,r,i):iT(i,s):r||(i[i.length]=s)}return i}function hte(e){var t=e==null?0:e.length;return t?oF(e,1):[]}function pte(e){return WL(XL(e,void 0,hte),e+"")}var gte=rF(Object.getPrototypeOf,Object);const oT=gte;var mte="[object Object]",yte=Function.prototype,vte=Object.prototype,aF=yte.toString,bte=vte.hasOwnProperty,_te=aF.call(Object);function sF(e){if(!Po(e)||cs(e)!=mte)return!1;var t=oT(e);if(t===null)return!0;var n=bte.call(t,"constructor")&&t.constructor;return typeof n=="function"&&n instanceof n&&aF.call(n)==_te}function lF(e,t,n){var r=-1,i=e.length;t<0&&(t=-t>i?0:i+t),n=n>i?i:n,n<0&&(n+=i),i=t>n?0:n-t>>>0,t>>>=0;for(var o=Array(i);++r=r?e:lF(e,t,n)}var Ste="\\ud800-\\udfff",xte="\\u0300-\\u036f",wte="\\ufe20-\\ufe2f",Cte="\\u20d0-\\u20ff",Ete=xte+wte+Cte,kte="\\ufe0e\\ufe0f",Tte="\\u200d",Ate=RegExp("["+Tte+Ste+Ete+kte+"]");function VS(e){return Ate.test(e)}function Pte(e){return e.split("")}var cF="\\ud800-\\udfff",Ite="\\u0300-\\u036f",Rte="\\ufe20-\\ufe2f",Ote="\\u20d0-\\u20ff",Mte=Ite+Rte+Ote,Nte="\\ufe0e\\ufe0f",$te="["+cF+"]",V3="["+Mte+"]",G3="\\ud83c[\\udffb-\\udfff]",Dte="(?:"+V3+"|"+G3+")",dF="[^"+cF+"]",fF="(?:\\ud83c[\\udde6-\\uddff]){2}",hF="[\\ud800-\\udbff][\\udc00-\\udfff]",Lte="\\u200d",pF=Dte+"?",gF="["+Nte+"]?",Fte="(?:"+Lte+"(?:"+[dF,fF,hF].join("|")+")"+gF+pF+")*",Bte=gF+pF+Fte,zte="(?:"+[dF+V3+"?",V3,fF,hF,$te].join("|")+")",jte=RegExp(G3+"(?="+G3+")|"+zte+Bte,"g");function Ute(e){return e.match(jte)||[]}function mF(e){return VS(e)?Ute(e):Pte(e)}function Vte(e){return function(t){t=Uh(t);var n=VS(t)?mF(t):void 0,r=n?n[0]:t.charAt(0),i=n?uF(n,1).join(""):t.slice(1);return r[e]()+i}}var Gte=Vte("toUpperCase");const yF=Gte;function vF(e,t,n,r){var i=-1,o=e==null?0:e.length;for(r&&o&&(n=e[++i]);++i=t?e:t)),e}function Ru(e,t,n){return n===void 0&&(n=t,t=void 0),n!==void 0&&(n=O1(n),n=n===n?n:0),t!==void 0&&(t=O1(t),t=t===t?t:0),Nne(O1(e),t,n)}function $ne(){this.__data__=new Xl,this.size=0}function Dne(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}function Lne(e){return this.__data__.get(e)}function Fne(e){return this.__data__.has(e)}var Bne=200;function zne(e,t){var n=this.__data__;if(n instanceof Xl){var r=n.__data__;if(!Mm||r.lengths))return!1;var u=o.get(e),c=o.get(t);if(u&&c)return u==t&&c==e;var d=-1,f=!0,h=n&_ie?new Nm:void 0;for(o.set(e,t),o.set(t,e);++d1),o}),pp(e,FF(e),n),r&&(n=Ug(n,Boe|zoe|joe,Foe));for(var i=t.length;i--;)eB(n,t[i]);return n});const qS=Uoe;var Voe=XF("length");const Goe=Voe;var tB="\\ud800-\\udfff",Hoe="\\u0300-\\u036f",qoe="\\ufe20-\\ufe2f",Woe="\\u20d0-\\u20ff",Koe=Hoe+qoe+Woe,Qoe="\\ufe0e\\ufe0f",Xoe="["+tB+"]",X3="["+Koe+"]",Y3="\\ud83c[\\udffb-\\udfff]",Yoe="(?:"+X3+"|"+Y3+")",nB="[^"+tB+"]",rB="(?:\\ud83c[\\udde6-\\uddff]){2}",iB="[\\ud800-\\udbff][\\udc00-\\udfff]",Zoe="\\u200d",oB=Yoe+"?",aB="["+Qoe+"]?",Joe="(?:"+Zoe+"(?:"+[nB,rB,iB].join("|")+")"+aB+oB+")*",eae=aB+oB+Joe,tae="(?:"+[nB+X3+"?",X3,rB,iB,Xoe].join("|")+")",q8=RegExp(Y3+"(?="+Y3+")|"+tae+eae,"g");function nae(e){for(var t=q8.lastIndex=0;q8.test(e);)++t;return t}function sB(e){return VS(e)?nae(e):Goe(e)}var rae=Math.floor,iae=Math.random;function oae(e,t){return e+rae(iae()*(t-e+1))}var aae=parseFloat,sae=Math.min,lae=Math.random;function uae(e,t,n){if(n&&typeof n!="boolean"&&FS(e,t,n)&&(t=n=void 0),n===void 0&&(typeof t=="boolean"?(n=t,t=void 0):typeof e=="boolean"&&(n=e,e=void 0)),e===void 0&&t===void 0?(e=0,t=1):(e=lh(e),t===void 0?(t=e,e=0):t=lh(t)),e>t){var r=e;e=t,t=r}if(n||e%1||t%1){var i=lae();return sae(e+i*(t-e+aae("1e-"+((i+"").length-1))),t)}return oae(e,t)}var cae=Math.ceil,dae=Math.max;function fae(e,t,n,r){for(var i=-1,o=dae(cae((t-e)/(n||1)),0),a=Array(o);o--;)a[r?o:++i]=e,e+=n;return a}function hae(e){return function(t,n,r){return r&&typeof r!="number"&&FS(t,n,r)&&(n=r=void 0),t=lh(t),n===void 0?(n=t,t=0):n=lh(n),r=r===void 0?t=o)return e;var s=n-sB(r);if(s<1)return r;var l=a?uF(a,0,s).join(""):e.slice(0,s);if(i===void 0)return l+r;if(a&&(s+=l.length-s),Noe(i)){if(e.slice(s).search(i)){var u,c=l;for(i.global||(i=RegExp(i.source,Uh(Cae.exec(i))+"g")),i.lastIndex=0;u=i.exec(c);)var d=u.index;l=l.slice(0,d===void 0?s:d)}}else if(e.indexOf(Vb(i),s)!=s){var f=l.lastIndexOf(i);f>-1&&(l=l.slice(0,f))}return l+r}var Eae=1/0,kae=ch&&1/lT(new ch([,-0]))[1]==Eae?function(e){return new ch(e)}:mJ;const Tae=kae;var Aae=200;function Pae(e,t,n){var r=-1,i=IJ,o=e.length,a=!0,s=[],l=s;if(n)a=!1,i=moe;else if(o>=Aae){var u=t?null:Tae(e);if(u)return lT(u);a=!1,i=HF,l=new Nm}else l=t?[]:s;e:for(;++r{Loe(e,t.payload)}}}),{configChanged:Iae}=uB.actions,Rae=uB.reducer,Uje={any:"Any","sd-1":"Stable Diffusion 1.x","sd-2":"Stable Diffusion 2.x",sdxl:"Stable Diffusion XL","sdxl-refiner":"Stable Diffusion XL Refiner"},Vje={any:"Any","sd-1":"SD1","sd-2":"SD2",sdxl:"SDXL","sdxl-refiner":"SDXLR"},Oae={any:{maxClip:0,markers:[]},"sd-1":{maxClip:12,markers:[0,1,2,3,4,8,12]},"sd-2":{maxClip:24,markers:[0,1,2,3,5,10,15,20,24]},sdxl:{maxClip:24,markers:[0,1,2,3,5,10,15,20,24]},"sdxl-refiner":{maxClip:24,markers:[0,1,2,3,5,10,15,20,24]}},Gje={lycoris:"LyCORIS",diffusers:"Diffusers"},Mae=0,Gg=4294967295;var Xt;(function(e){e.assertEqual=i=>i;function t(i){}e.assertIs=t;function n(i){throw new Error}e.assertNever=n,e.arrayToEnum=i=>{const o={};for(const a of i)o[a]=a;return o},e.getValidEnumValues=i=>{const o=e.objectKeys(i).filter(s=>typeof i[i[s]]!="number"),a={};for(const s of o)a[s]=i[s];return e.objectValues(a)},e.objectValues=i=>e.objectKeys(i).map(function(o){return i[o]}),e.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{const o=[];for(const a in i)Object.prototype.hasOwnProperty.call(i,a)&&o.push(a);return o},e.find=(i,o)=>{for(const a of i)if(o(a))return a},e.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&isFinite(i)&&Math.floor(i)===i;function r(i,o=" | "){return i.map(a=>typeof a=="string"?`'${a}'`:a).join(o)}e.joinValues=r,e.jsonStringifyReplacer=(i,o)=>typeof o=="bigint"?o.toString():o})(Xt||(Xt={}));var J3;(function(e){e.mergeShapes=(t,n)=>({...t,...n})})(J3||(J3={}));const Re=Xt.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),wu=e=>{switch(typeof e){case"undefined":return Re.undefined;case"string":return Re.string;case"number":return isNaN(e)?Re.nan:Re.number;case"boolean":return Re.boolean;case"function":return Re.function;case"bigint":return Re.bigint;case"symbol":return Re.symbol;case"object":return Array.isArray(e)?Re.array:e===null?Re.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?Re.promise:typeof Map<"u"&&e instanceof Map?Re.map:typeof Set<"u"&&e instanceof Set?Re.set:typeof Date<"u"&&e instanceof Date?Re.date:Re.object;default:return Re.unknown}},he=Xt.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),Nae=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:");class ns extends Error{constructor(t){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};const n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=t}get errors(){return this.issues}format(t){const n=t||function(o){return o.message},r={_errors:[]},i=o=>{for(const a of o.issues)if(a.code==="invalid_union")a.unionErrors.map(i);else if(a.code==="invalid_return_type")i(a.returnTypeError);else if(a.code==="invalid_arguments")i(a.argumentsError);else if(a.path.length===0)r._errors.push(n(a));else{let s=r,l=0;for(;ln.message){const n={},r=[];for(const i of this.issues)i.path.length>0?(n[i.path[0]]=n[i.path[0]]||[],n[i.path[0]].push(t(i))):r.push(t(i));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}}ns.create=e=>new ns(e);const $m=(e,t)=>{let n;switch(e.code){case he.invalid_type:e.received===Re.undefined?n="Required":n=`Expected ${e.expected}, received ${e.received}`;break;case he.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,Xt.jsonStringifyReplacer)}`;break;case he.unrecognized_keys:n=`Unrecognized key(s) in object: ${Xt.joinValues(e.keys,", ")}`;break;case he.invalid_union:n="Invalid input";break;case he.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${Xt.joinValues(e.options)}`;break;case he.invalid_enum_value:n=`Invalid enum value. Expected ${Xt.joinValues(e.options)}, received '${e.received}'`;break;case he.invalid_arguments:n="Invalid function arguments";break;case he.invalid_return_type:n="Invalid function return type";break;case he.invalid_date:n="Invalid date";break;case he.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:Xt.assertNever(e.validation):e.validation!=="regex"?n=`Invalid ${e.validation}`:n="Invalid";break;case he.too_small:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:n="Invalid input";break;case he.too_big:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?n=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:n="Invalid input";break;case he.custom:n="Invalid input";break;case he.invalid_intersection_types:n="Intersection results could not be merged";break;case he.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case he.not_finite:n="Number must be finite";break;default:n=t.defaultError,Xt.assertNever(e)}return{message:n}};let cB=$m;function $ae(e){cB=e}function qb(){return cB}const Wb=e=>{const{data:t,path:n,errorMaps:r,issueData:i}=e,o=[...n,...i.path||[]],a={...i,path:o};let s="";const l=r.filter(u=>!!u).slice().reverse();for(const u of l)s=u(a,{data:t,defaultError:s}).message;return{...i,path:o,message:i.message||s}},Dae=[];function Me(e,t){const n=Wb({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,qb(),$m].filter(r=>!!r)});e.common.issues.push(n)}class Ki{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,n){const r=[];for(const i of n){if(i.status==="aborted")return yt;i.status==="dirty"&&t.dirty(),r.push(i.value)}return{status:t.value,value:r}}static async mergeObjectAsync(t,n){const r=[];for(const i of n)r.push({key:await i.key,value:await i.value});return Ki.mergeObjectSync(t,r)}static mergeObjectSync(t,n){const r={};for(const i of n){const{key:o,value:a}=i;if(o.status==="aborted"||a.status==="aborted")return yt;o.status==="dirty"&&t.dirty(),a.status==="dirty"&&t.dirty(),o.value!=="__proto__"&&(typeof a.value<"u"||i.alwaysSet)&&(r[o.value]=a.value)}return{status:t.value,value:r}}}const yt=Object.freeze({status:"aborted"}),dB=e=>({status:"dirty",value:e}),oo=e=>({status:"valid",value:e}),eE=e=>e.status==="aborted",tE=e=>e.status==="dirty",Dm=e=>e.status==="valid",Kb=e=>typeof Promise<"u"&&e instanceof Promise;var rt;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t==null?void 0:t.message})(rt||(rt={}));class Ks{constructor(t,n,r,i){this._cachedPath=[],this.parent=t,this.data=n,this._path=r,this._key=i}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const X8=(e,t)=>{if(Dm(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const n=new ns(e.common.issues);return this._error=n,this._error}}};function xt(e){if(!e)return{};const{errorMap:t,invalid_type_error:n,required_error:r,description:i}=e;if(t&&(n||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:i}:{errorMap:(a,s)=>a.code!=="invalid_type"?{message:s.defaultError}:typeof s.data>"u"?{message:r??s.defaultError}:{message:n??s.defaultError},description:i}}class Et{constructor(t){this.spa=this.safeParseAsync,this._def=t,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(t){return wu(t.data)}_getOrReturnCtx(t,n){return n||{common:t.parent.common,data:t.data,parsedType:wu(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new Ki,ctx:{common:t.parent.common,data:t.data,parsedType:wu(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){const n=this._parse(t);if(Kb(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(t){const n=this._parse(t);return Promise.resolve(n)}parse(t,n){const r=this.safeParse(t,n);if(r.success)return r.data;throw r.error}safeParse(t,n){var r;const i={common:{issues:[],async:(r=n==null?void 0:n.async)!==null&&r!==void 0?r:!1,contextualErrorMap:n==null?void 0:n.errorMap},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:wu(t)},o=this._parseSync({data:t,path:i.path,parent:i});return X8(i,o)}async parseAsync(t,n){const r=await this.safeParseAsync(t,n);if(r.success)return r.data;throw r.error}async safeParseAsync(t,n){const r={common:{issues:[],contextualErrorMap:n==null?void 0:n.errorMap,async:!0},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:wu(t)},i=this._parse({data:t,path:r.path,parent:r}),o=await(Kb(i)?i:Promise.resolve(i));return X8(r,o)}refine(t,n){const r=i=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(i):n;return this._refinement((i,o)=>{const a=t(i),s=()=>o.addIssue({code:he.custom,...r(i)});return typeof Promise<"u"&&a instanceof Promise?a.then(l=>l?!0:(s(),!1)):a?!0:(s(),!1)})}refinement(t,n){return this._refinement((r,i)=>t(r)?!0:(i.addIssue(typeof n=="function"?n(r,i):n),!1))}_refinement(t){return new ss({schema:this,typeName:st.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}optional(){return Ml.create(this,this._def)}nullable(){return Ad.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return rs.create(this,this._def)}promise(){return Hh.create(this,this._def)}or(t){return zm.create([this,t],this._def)}and(t){return jm.create(this,t,this._def)}transform(t){return new ss({...xt(this._def),schema:this,typeName:st.ZodEffects,effect:{type:"transform",transform:t}})}default(t){const n=typeof t=="function"?t:()=>t;return new qm({...xt(this._def),innerType:this,defaultValue:n,typeName:st.ZodDefault})}brand(){return new hB({typeName:st.ZodBranded,type:this,...xt(this._def)})}catch(t){const n=typeof t=="function"?t:()=>t;return new Zb({...xt(this._def),innerType:this,catchValue:n,typeName:st.ZodCatch})}describe(t){const n=this.constructor;return new n({...this._def,description:t})}pipe(t){return sy.create(this,t)}readonly(){return e_.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const Lae=/^c[^\s-]{8,}$/i,Fae=/^[a-z][a-z0-9]*$/,Bae=/[0-9A-HJKMNP-TV-Z]{26}/,zae=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,jae=/^([A-Z0-9_+-]+\.?)*[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Uae=/^(\p{Extended_Pictographic}|\p{Emoji_Component})+$/u,Vae=/^(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))$/,Gae=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,Hae=e=>e.precision?e.offset?new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${e.precision}}(([+-]\\d{2}(:?\\d{2})?)|Z)$`):new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${e.precision}}Z$`):e.precision===0?e.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(([+-]\\d{2}(:?\\d{2})?)|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$"):e.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}(:?\\d{2})?)|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$");function qae(e,t){return!!((t==="v4"||!t)&&Vae.test(e)||(t==="v6"||!t)&&Gae.test(e))}class Ya extends Et{constructor(){super(...arguments),this._regex=(t,n,r)=>this.refinement(i=>t.test(i),{validation:n,code:he.invalid_string,...rt.errToObj(r)}),this.nonempty=t=>this.min(1,rt.errToObj(t)),this.trim=()=>new Ya({...this._def,checks:[...this._def.checks,{kind:"trim"}]}),this.toLowerCase=()=>new Ya({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]}),this.toUpperCase=()=>new Ya({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==Re.string){const o=this._getOrReturnCtx(t);return Me(o,{code:he.invalid_type,expected:Re.string,received:o.parsedType}),yt}const r=new Ki;let i;for(const o of this._def.checks)if(o.kind==="min")t.data.lengtho.value&&(i=this._getOrReturnCtx(t,i),Me(i,{code:he.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),r.dirty());else if(o.kind==="length"){const a=t.data.length>o.value,s=t.data.length"u"?null:t==null?void 0:t.precision,offset:(n=t==null?void 0:t.offset)!==null&&n!==void 0?n:!1,...rt.errToObj(t==null?void 0:t.message)})}regex(t,n){return this._addCheck({kind:"regex",regex:t,...rt.errToObj(n)})}includes(t,n){return this._addCheck({kind:"includes",value:t,position:n==null?void 0:n.position,...rt.errToObj(n==null?void 0:n.message)})}startsWith(t,n){return this._addCheck({kind:"startsWith",value:t,...rt.errToObj(n)})}endsWith(t,n){return this._addCheck({kind:"endsWith",value:t,...rt.errToObj(n)})}min(t,n){return this._addCheck({kind:"min",value:t,...rt.errToObj(n)})}max(t,n){return this._addCheck({kind:"max",value:t,...rt.errToObj(n)})}length(t,n){return this._addCheck({kind:"length",value:t,...rt.errToObj(n)})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get minLength(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxLength(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value{var t;return new Ya({checks:[],typeName:st.ZodString,coerce:(t=e==null?void 0:e.coerce)!==null&&t!==void 0?t:!1,...xt(e)})};function Wae(e,t){const n=(e.toString().split(".")[1]||"").length,r=(t.toString().split(".")[1]||"").length,i=n>r?n:r,o=parseInt(e.toFixed(i).replace(".","")),a=parseInt(t.toFixed(i).replace(".",""));return o%a/Math.pow(10,i)}class rc extends Et{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==Re.number){const o=this._getOrReturnCtx(t);return Me(o,{code:he.invalid_type,expected:Re.number,received:o.parsedType}),yt}let r;const i=new Ki;for(const o of this._def.checks)o.kind==="int"?Xt.isInteger(t.data)||(r=this._getOrReturnCtx(t,r),Me(r,{code:he.invalid_type,expected:"integer",received:"float",message:o.message}),i.dirty()):o.kind==="min"?(o.inclusive?t.datao.value:t.data>=o.value)&&(r=this._getOrReturnCtx(t,r),Me(r,{code:he.too_big,maximum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),i.dirty()):o.kind==="multipleOf"?Wae(t.data,o.value)!==0&&(r=this._getOrReturnCtx(t,r),Me(r,{code:he.not_multiple_of,multipleOf:o.value,message:o.message}),i.dirty()):o.kind==="finite"?Number.isFinite(t.data)||(r=this._getOrReturnCtx(t,r),Me(r,{code:he.not_finite,message:o.message}),i.dirty()):Xt.assertNever(o);return{status:i.value,value:t.data}}gte(t,n){return this.setLimit("min",t,!0,rt.toString(n))}gt(t,n){return this.setLimit("min",t,!1,rt.toString(n))}lte(t,n){return this.setLimit("max",t,!0,rt.toString(n))}lt(t,n){return this.setLimit("max",t,!1,rt.toString(n))}setLimit(t,n,r,i){return new rc({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:rt.toString(i)}]})}_addCheck(t){return new rc({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:rt.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:rt.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:rt.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:rt.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:rt.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:rt.toString(n)})}finite(t){return this._addCheck({kind:"finite",message:rt.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:rt.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:rt.toString(t)})}get minValue(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.valuet.kind==="int"||t.kind==="multipleOf"&&Xt.isInteger(t.value))}get isFinite(){let t=null,n=null;for(const r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(n===null||r.value>n)&&(n=r.value):r.kind==="max"&&(t===null||r.valuenew rc({checks:[],typeName:st.ZodNumber,coerce:(e==null?void 0:e.coerce)||!1,...xt(e)});class ic extends Et{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce&&(t.data=BigInt(t.data)),this._getType(t)!==Re.bigint){const o=this._getOrReturnCtx(t);return Me(o,{code:he.invalid_type,expected:Re.bigint,received:o.parsedType}),yt}let r;const i=new Ki;for(const o of this._def.checks)o.kind==="min"?(o.inclusive?t.datao.value:t.data>=o.value)&&(r=this._getOrReturnCtx(t,r),Me(r,{code:he.too_big,type:"bigint",maximum:o.value,inclusive:o.inclusive,message:o.message}),i.dirty()):o.kind==="multipleOf"?t.data%o.value!==BigInt(0)&&(r=this._getOrReturnCtx(t,r),Me(r,{code:he.not_multiple_of,multipleOf:o.value,message:o.message}),i.dirty()):Xt.assertNever(o);return{status:i.value,value:t.data}}gte(t,n){return this.setLimit("min",t,!0,rt.toString(n))}gt(t,n){return this.setLimit("min",t,!1,rt.toString(n))}lte(t,n){return this.setLimit("max",t,!0,rt.toString(n))}lt(t,n){return this.setLimit("max",t,!1,rt.toString(n))}setLimit(t,n,r,i){return new ic({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:rt.toString(i)}]})}_addCheck(t){return new ic({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:rt.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:rt.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:rt.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:rt.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:rt.toString(n)})}get minValue(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value{var t;return new ic({checks:[],typeName:st.ZodBigInt,coerce:(t=e==null?void 0:e.coerce)!==null&&t!==void 0?t:!1,...xt(e)})};class Lm extends Et{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==Re.boolean){const r=this._getOrReturnCtx(t);return Me(r,{code:he.invalid_type,expected:Re.boolean,received:r.parsedType}),yt}return oo(t.data)}}Lm.create=e=>new Lm({typeName:st.ZodBoolean,coerce:(e==null?void 0:e.coerce)||!1,...xt(e)});class kd extends Et{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==Re.date){const o=this._getOrReturnCtx(t);return Me(o,{code:he.invalid_type,expected:Re.date,received:o.parsedType}),yt}if(isNaN(t.data.getTime())){const o=this._getOrReturnCtx(t);return Me(o,{code:he.invalid_date}),yt}const r=new Ki;let i;for(const o of this._def.checks)o.kind==="min"?t.data.getTime()o.value&&(i=this._getOrReturnCtx(t,i),Me(i,{code:he.too_big,message:o.message,inclusive:!0,exact:!1,maximum:o.value,type:"date"}),r.dirty()):Xt.assertNever(o);return{status:r.value,value:new Date(t.data.getTime())}}_addCheck(t){return new kd({...this._def,checks:[...this._def.checks,t]})}min(t,n){return this._addCheck({kind:"min",value:t.getTime(),message:rt.toString(n)})}max(t,n){return this._addCheck({kind:"max",value:t.getTime(),message:rt.toString(n)})}get minDate(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.valuenew kd({checks:[],coerce:(e==null?void 0:e.coerce)||!1,typeName:st.ZodDate,...xt(e)});class Qb extends Et{_parse(t){if(this._getType(t)!==Re.symbol){const r=this._getOrReturnCtx(t);return Me(r,{code:he.invalid_type,expected:Re.symbol,received:r.parsedType}),yt}return oo(t.data)}}Qb.create=e=>new Qb({typeName:st.ZodSymbol,...xt(e)});class Fm extends Et{_parse(t){if(this._getType(t)!==Re.undefined){const r=this._getOrReturnCtx(t);return Me(r,{code:he.invalid_type,expected:Re.undefined,received:r.parsedType}),yt}return oo(t.data)}}Fm.create=e=>new Fm({typeName:st.ZodUndefined,...xt(e)});class Bm extends Et{_parse(t){if(this._getType(t)!==Re.null){const r=this._getOrReturnCtx(t);return Me(r,{code:he.invalid_type,expected:Re.null,received:r.parsedType}),yt}return oo(t.data)}}Bm.create=e=>new Bm({typeName:st.ZodNull,...xt(e)});class Gh extends Et{constructor(){super(...arguments),this._any=!0}_parse(t){return oo(t.data)}}Gh.create=e=>new Gh({typeName:st.ZodAny,...xt(e)});class fd extends Et{constructor(){super(...arguments),this._unknown=!0}_parse(t){return oo(t.data)}}fd.create=e=>new fd({typeName:st.ZodUnknown,...xt(e)});class Gl extends Et{_parse(t){const n=this._getOrReturnCtx(t);return Me(n,{code:he.invalid_type,expected:Re.never,received:n.parsedType}),yt}}Gl.create=e=>new Gl({typeName:st.ZodNever,...xt(e)});class Xb extends Et{_parse(t){if(this._getType(t)!==Re.undefined){const r=this._getOrReturnCtx(t);return Me(r,{code:he.invalid_type,expected:Re.void,received:r.parsedType}),yt}return oo(t.data)}}Xb.create=e=>new Xb({typeName:st.ZodVoid,...xt(e)});class rs extends Et{_parse(t){const{ctx:n,status:r}=this._processInputParams(t),i=this._def;if(n.parsedType!==Re.array)return Me(n,{code:he.invalid_type,expected:Re.array,received:n.parsedType}),yt;if(i.exactLength!==null){const a=n.data.length>i.exactLength.value,s=n.data.lengthi.maxLength.value&&(Me(n,{code:he.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((a,s)=>i.type._parseAsync(new Ks(n,a,n.path,s)))).then(a=>Ki.mergeArray(r,a));const o=[...n.data].map((a,s)=>i.type._parseSync(new Ks(n,a,n.path,s)));return Ki.mergeArray(r,o)}get element(){return this._def.type}min(t,n){return new rs({...this._def,minLength:{value:t,message:rt.toString(n)}})}max(t,n){return new rs({...this._def,maxLength:{value:t,message:rt.toString(n)}})}length(t,n){return new rs({...this._def,exactLength:{value:t,message:rt.toString(n)}})}nonempty(t){return this.min(1,t)}}rs.create=(e,t)=>new rs({type:e,minLength:null,maxLength:null,exactLength:null,typeName:st.ZodArray,...xt(t)});function wf(e){if(e instanceof ar){const t={};for(const n in e.shape){const r=e.shape[n];t[n]=Ml.create(wf(r))}return new ar({...e._def,shape:()=>t})}else return e instanceof rs?new rs({...e._def,type:wf(e.element)}):e instanceof Ml?Ml.create(wf(e.unwrap())):e instanceof Ad?Ad.create(wf(e.unwrap())):e instanceof Qs?Qs.create(e.items.map(t=>wf(t))):e}class ar extends Et{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const t=this._def.shape(),n=Xt.objectKeys(t);return this._cached={shape:t,keys:n}}_parse(t){if(this._getType(t)!==Re.object){const u=this._getOrReturnCtx(t);return Me(u,{code:he.invalid_type,expected:Re.object,received:u.parsedType}),yt}const{status:r,ctx:i}=this._processInputParams(t),{shape:o,keys:a}=this._getCached(),s=[];if(!(this._def.catchall instanceof Gl&&this._def.unknownKeys==="strip"))for(const u in i.data)a.includes(u)||s.push(u);const l=[];for(const u of a){const c=o[u],d=i.data[u];l.push({key:{status:"valid",value:u},value:c._parse(new Ks(i,d,i.path,u)),alwaysSet:u in i.data})}if(this._def.catchall instanceof Gl){const u=this._def.unknownKeys;if(u==="passthrough")for(const c of s)l.push({key:{status:"valid",value:c},value:{status:"valid",value:i.data[c]}});else if(u==="strict")s.length>0&&(Me(i,{code:he.unrecognized_keys,keys:s}),r.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const u=this._def.catchall;for(const c of s){const d=i.data[c];l.push({key:{status:"valid",value:c},value:u._parse(new Ks(i,d,i.path,c)),alwaysSet:c in i.data})}}return i.common.async?Promise.resolve().then(async()=>{const u=[];for(const c of l){const d=await c.key;u.push({key:d,value:await c.value,alwaysSet:c.alwaysSet})}return u}).then(u=>Ki.mergeObjectSync(r,u)):Ki.mergeObjectSync(r,l)}get shape(){return this._def.shape()}strict(t){return rt.errToObj,new ar({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(n,r)=>{var i,o,a,s;const l=(a=(o=(i=this._def).errorMap)===null||o===void 0?void 0:o.call(i,n,r).message)!==null&&a!==void 0?a:r.defaultError;return n.code==="unrecognized_keys"?{message:(s=rt.errToObj(t).message)!==null&&s!==void 0?s:l}:{message:l}}}:{}})}strip(){return new ar({...this._def,unknownKeys:"strip"})}passthrough(){return new ar({...this._def,unknownKeys:"passthrough"})}extend(t){return new ar({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new ar({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:st.ZodObject})}setKey(t,n){return this.augment({[t]:n})}catchall(t){return new ar({...this._def,catchall:t})}pick(t){const n={};return Xt.objectKeys(t).forEach(r=>{t[r]&&this.shape[r]&&(n[r]=this.shape[r])}),new ar({...this._def,shape:()=>n})}omit(t){const n={};return Xt.objectKeys(this.shape).forEach(r=>{t[r]||(n[r]=this.shape[r])}),new ar({...this._def,shape:()=>n})}deepPartial(){return wf(this)}partial(t){const n={};return Xt.objectKeys(this.shape).forEach(r=>{const i=this.shape[r];t&&!t[r]?n[r]=i:n[r]=i.optional()}),new ar({...this._def,shape:()=>n})}required(t){const n={};return Xt.objectKeys(this.shape).forEach(r=>{if(t&&!t[r])n[r]=this.shape[r];else{let o=this.shape[r];for(;o instanceof Ml;)o=o._def.innerType;n[r]=o}}),new ar({...this._def,shape:()=>n})}keyof(){return fB(Xt.objectKeys(this.shape))}}ar.create=(e,t)=>new ar({shape:()=>e,unknownKeys:"strip",catchall:Gl.create(),typeName:st.ZodObject,...xt(t)});ar.strictCreate=(e,t)=>new ar({shape:()=>e,unknownKeys:"strict",catchall:Gl.create(),typeName:st.ZodObject,...xt(t)});ar.lazycreate=(e,t)=>new ar({shape:e,unknownKeys:"strip",catchall:Gl.create(),typeName:st.ZodObject,...xt(t)});class zm extends Et{_parse(t){const{ctx:n}=this._processInputParams(t),r=this._def.options;function i(o){for(const s of o)if(s.result.status==="valid")return s.result;for(const s of o)if(s.result.status==="dirty")return n.common.issues.push(...s.ctx.common.issues),s.result;const a=o.map(s=>new ns(s.ctx.common.issues));return Me(n,{code:he.invalid_union,unionErrors:a}),yt}if(n.common.async)return Promise.all(r.map(async o=>{const a={...n,common:{...n.common,issues:[]},parent:null};return{result:await o._parseAsync({data:n.data,path:n.path,parent:a}),ctx:a}})).then(i);{let o;const a=[];for(const l of r){const u={...n,common:{...n.common,issues:[]},parent:null},c=l._parseSync({data:n.data,path:n.path,parent:u});if(c.status==="valid")return c;c.status==="dirty"&&!o&&(o={result:c,ctx:u}),u.common.issues.length&&a.push(u.common.issues)}if(o)return n.common.issues.push(...o.ctx.common.issues),o.result;const s=a.map(l=>new ns(l));return Me(n,{code:he.invalid_union,unionErrors:s}),yt}}get options(){return this._def.options}}zm.create=(e,t)=>new zm({options:e,typeName:st.ZodUnion,...xt(t)});const M1=e=>e instanceof Vm?M1(e.schema):e instanceof ss?M1(e.innerType()):e instanceof Gm?[e.value]:e instanceof oc?e.options:e instanceof Hm?Object.keys(e.enum):e instanceof qm?M1(e._def.innerType):e instanceof Fm?[void 0]:e instanceof Bm?[null]:null;class KS extends Et{_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==Re.object)return Me(n,{code:he.invalid_type,expected:Re.object,received:n.parsedType}),yt;const r=this.discriminator,i=n.data[r],o=this.optionsMap.get(i);return o?n.common.async?o._parseAsync({data:n.data,path:n.path,parent:n}):o._parseSync({data:n.data,path:n.path,parent:n}):(Me(n,{code:he.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),yt)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,n,r){const i=new Map;for(const o of n){const a=M1(o.shape[t]);if(!a)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(const s of a){if(i.has(s))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(s)}`);i.set(s,o)}}return new KS({typeName:st.ZodDiscriminatedUnion,discriminator:t,options:n,optionsMap:i,...xt(r)})}}function nE(e,t){const n=wu(e),r=wu(t);if(e===t)return{valid:!0,data:e};if(n===Re.object&&r===Re.object){const i=Xt.objectKeys(t),o=Xt.objectKeys(e).filter(s=>i.indexOf(s)!==-1),a={...e,...t};for(const s of o){const l=nE(e[s],t[s]);if(!l.valid)return{valid:!1};a[s]=l.data}return{valid:!0,data:a}}else if(n===Re.array&&r===Re.array){if(e.length!==t.length)return{valid:!1};const i=[];for(let o=0;o{if(eE(o)||eE(a))return yt;const s=nE(o.value,a.value);return s.valid?((tE(o)||tE(a))&&n.dirty(),{status:n.value,value:s.data}):(Me(r,{code:he.invalid_intersection_types}),yt)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([o,a])=>i(o,a)):i(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}jm.create=(e,t,n)=>new jm({left:e,right:t,typeName:st.ZodIntersection,...xt(n)});class Qs extends Et{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==Re.array)return Me(r,{code:he.invalid_type,expected:Re.array,received:r.parsedType}),yt;if(r.data.lengththis._def.items.length&&(Me(r,{code:he.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());const o=[...r.data].map((a,s)=>{const l=this._def.items[s]||this._def.rest;return l?l._parse(new Ks(r,a,r.path,s)):null}).filter(a=>!!a);return r.common.async?Promise.all(o).then(a=>Ki.mergeArray(n,a)):Ki.mergeArray(n,o)}get items(){return this._def.items}rest(t){return new Qs({...this._def,rest:t})}}Qs.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Qs({items:e,typeName:st.ZodTuple,rest:null,...xt(t)})};class Um extends Et{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==Re.object)return Me(r,{code:he.invalid_type,expected:Re.object,received:r.parsedType}),yt;const i=[],o=this._def.keyType,a=this._def.valueType;for(const s in r.data)i.push({key:o._parse(new Ks(r,s,r.path,s)),value:a._parse(new Ks(r,r.data[s],r.path,s))});return r.common.async?Ki.mergeObjectAsync(n,i):Ki.mergeObjectSync(n,i)}get element(){return this._def.valueType}static create(t,n,r){return n instanceof Et?new Um({keyType:t,valueType:n,typeName:st.ZodRecord,...xt(r)}):new Um({keyType:Ya.create(),valueType:t,typeName:st.ZodRecord,...xt(n)})}}class Yb extends Et{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==Re.map)return Me(r,{code:he.invalid_type,expected:Re.map,received:r.parsedType}),yt;const i=this._def.keyType,o=this._def.valueType,a=[...r.data.entries()].map(([s,l],u)=>({key:i._parse(new Ks(r,s,r.path,[u,"key"])),value:o._parse(new Ks(r,l,r.path,[u,"value"]))}));if(r.common.async){const s=new Map;return Promise.resolve().then(async()=>{for(const l of a){const u=await l.key,c=await l.value;if(u.status==="aborted"||c.status==="aborted")return yt;(u.status==="dirty"||c.status==="dirty")&&n.dirty(),s.set(u.value,c.value)}return{status:n.value,value:s}})}else{const s=new Map;for(const l of a){const u=l.key,c=l.value;if(u.status==="aborted"||c.status==="aborted")return yt;(u.status==="dirty"||c.status==="dirty")&&n.dirty(),s.set(u.value,c.value)}return{status:n.value,value:s}}}}Yb.create=(e,t,n)=>new Yb({valueType:t,keyType:e,typeName:st.ZodMap,...xt(n)});class Td extends Et{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==Re.set)return Me(r,{code:he.invalid_type,expected:Re.set,received:r.parsedType}),yt;const i=this._def;i.minSize!==null&&r.data.sizei.maxSize.value&&(Me(r,{code:he.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),n.dirty());const o=this._def.valueType;function a(l){const u=new Set;for(const c of l){if(c.status==="aborted")return yt;c.status==="dirty"&&n.dirty(),u.add(c.value)}return{status:n.value,value:u}}const s=[...r.data.values()].map((l,u)=>o._parse(new Ks(r,l,r.path,u)));return r.common.async?Promise.all(s).then(l=>a(l)):a(s)}min(t,n){return new Td({...this._def,minSize:{value:t,message:rt.toString(n)}})}max(t,n){return new Td({...this._def,maxSize:{value:t,message:rt.toString(n)}})}size(t,n){return this.min(t,n).max(t,n)}nonempty(t){return this.min(1,t)}}Td.create=(e,t)=>new Td({valueType:e,minSize:null,maxSize:null,typeName:st.ZodSet,...xt(t)});class dh extends Et{constructor(){super(...arguments),this.validate=this.implement}_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==Re.function)return Me(n,{code:he.invalid_type,expected:Re.function,received:n.parsedType}),yt;function r(s,l){return Wb({data:s,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,qb(),$m].filter(u=>!!u),issueData:{code:he.invalid_arguments,argumentsError:l}})}function i(s,l){return Wb({data:s,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,qb(),$m].filter(u=>!!u),issueData:{code:he.invalid_return_type,returnTypeError:l}})}const o={errorMap:n.common.contextualErrorMap},a=n.data;if(this._def.returns instanceof Hh){const s=this;return oo(async function(...l){const u=new ns([]),c=await s._def.args.parseAsync(l,o).catch(h=>{throw u.addIssue(r(l,h)),u}),d=await Reflect.apply(a,this,c);return await s._def.returns._def.type.parseAsync(d,o).catch(h=>{throw u.addIssue(i(d,h)),u})})}else{const s=this;return oo(function(...l){const u=s._def.args.safeParse(l,o);if(!u.success)throw new ns([r(l,u.error)]);const c=Reflect.apply(a,this,u.data),d=s._def.returns.safeParse(c,o);if(!d.success)throw new ns([i(c,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new dh({...this._def,args:Qs.create(t).rest(fd.create())})}returns(t){return new dh({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,n,r){return new dh({args:t||Qs.create([]).rest(fd.create()),returns:n||fd.create(),typeName:st.ZodFunction,...xt(r)})}}class Vm extends Et{get schema(){return this._def.getter()}_parse(t){const{ctx:n}=this._processInputParams(t);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}}Vm.create=(e,t)=>new Vm({getter:e,typeName:st.ZodLazy,...xt(t)});class Gm extends Et{_parse(t){if(t.data!==this._def.value){const n=this._getOrReturnCtx(t);return Me(n,{received:n.data,code:he.invalid_literal,expected:this._def.value}),yt}return{status:"valid",value:t.data}}get value(){return this._def.value}}Gm.create=(e,t)=>new Gm({value:e,typeName:st.ZodLiteral,...xt(t)});function fB(e,t){return new oc({values:e,typeName:st.ZodEnum,...xt(t)})}class oc extends Et{_parse(t){if(typeof t.data!="string"){const n=this._getOrReturnCtx(t),r=this._def.values;return Me(n,{expected:Xt.joinValues(r),received:n.parsedType,code:he.invalid_type}),yt}if(this._def.values.indexOf(t.data)===-1){const n=this._getOrReturnCtx(t),r=this._def.values;return Me(n,{received:n.data,code:he.invalid_enum_value,options:r}),yt}return oo(t.data)}get options(){return this._def.values}get enum(){const t={};for(const n of this._def.values)t[n]=n;return t}get Values(){const t={};for(const n of this._def.values)t[n]=n;return t}get Enum(){const t={};for(const n of this._def.values)t[n]=n;return t}extract(t){return oc.create(t)}exclude(t){return oc.create(this.options.filter(n=>!t.includes(n)))}}oc.create=fB;class Hm extends Et{_parse(t){const n=Xt.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(t);if(r.parsedType!==Re.string&&r.parsedType!==Re.number){const i=Xt.objectValues(n);return Me(r,{expected:Xt.joinValues(i),received:r.parsedType,code:he.invalid_type}),yt}if(n.indexOf(t.data)===-1){const i=Xt.objectValues(n);return Me(r,{received:r.data,code:he.invalid_enum_value,options:i}),yt}return oo(t.data)}get enum(){return this._def.values}}Hm.create=(e,t)=>new Hm({values:e,typeName:st.ZodNativeEnum,...xt(t)});class Hh extends Et{unwrap(){return this._def.type}_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==Re.promise&&n.common.async===!1)return Me(n,{code:he.invalid_type,expected:Re.promise,received:n.parsedType}),yt;const r=n.parsedType===Re.promise?n.data:Promise.resolve(n.data);return oo(r.then(i=>this._def.type.parseAsync(i,{path:n.path,errorMap:n.common.contextualErrorMap})))}}Hh.create=(e,t)=>new Hh({type:e,typeName:st.ZodPromise,...xt(t)});class ss extends Et{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===st.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){const{status:n,ctx:r}=this._processInputParams(t),i=this._def.effect||null,o={addIssue:a=>{Me(r,a),a.fatal?n.abort():n.dirty()},get path(){return r.path}};if(o.addIssue=o.addIssue.bind(o),i.type==="preprocess"){const a=i.transform(r.data,o);return r.common.issues.length?{status:"dirty",value:r.data}:r.common.async?Promise.resolve(a).then(s=>this._def.schema._parseAsync({data:s,path:r.path,parent:r})):this._def.schema._parseSync({data:a,path:r.path,parent:r})}if(i.type==="refinement"){const a=s=>{const l=i.refinement(s,o);if(r.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return s};if(r.common.async===!1){const s=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?yt:(s.status==="dirty"&&n.dirty(),a(s.value),{status:n.value,value:s.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(s=>s.status==="aborted"?yt:(s.status==="dirty"&&n.dirty(),a(s.value).then(()=>({status:n.value,value:s.value}))))}if(i.type==="transform")if(r.common.async===!1){const a=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!Dm(a))return a;const s=i.transform(a.value,o);if(s instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:s}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(a=>Dm(a)?Promise.resolve(i.transform(a.value,o)).then(s=>({status:n.value,value:s})):a);Xt.assertNever(i)}}ss.create=(e,t,n)=>new ss({schema:e,typeName:st.ZodEffects,effect:t,...xt(n)});ss.createWithPreprocess=(e,t,n)=>new ss({schema:t,effect:{type:"preprocess",transform:e},typeName:st.ZodEffects,...xt(n)});class Ml extends Et{_parse(t){return this._getType(t)===Re.undefined?oo(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}Ml.create=(e,t)=>new Ml({innerType:e,typeName:st.ZodOptional,...xt(t)});class Ad extends Et{_parse(t){return this._getType(t)===Re.null?oo(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}Ad.create=(e,t)=>new Ad({innerType:e,typeName:st.ZodNullable,...xt(t)});class qm extends Et{_parse(t){const{ctx:n}=this._processInputParams(t);let r=n.data;return n.parsedType===Re.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}}qm.create=(e,t)=>new qm({innerType:e,typeName:st.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...xt(t)});class Zb extends Et{_parse(t){const{ctx:n}=this._processInputParams(t),r={...n,common:{...n.common,issues:[]}},i=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return Kb(i)?i.then(o=>({status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new ns(r.common.issues)},input:r.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new ns(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}Zb.create=(e,t)=>new Zb({innerType:e,typeName:st.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...xt(t)});class Jb extends Et{_parse(t){if(this._getType(t)!==Re.nan){const r=this._getOrReturnCtx(t);return Me(r,{code:he.invalid_type,expected:Re.nan,received:r.parsedType}),yt}return{status:"valid",value:t.data}}}Jb.create=e=>new Jb({typeName:st.ZodNaN,...xt(e)});const Kae=Symbol("zod_brand");class hB extends Et{_parse(t){const{ctx:n}=this._processInputParams(t),r=n.data;return this._def.type._parse({data:r,path:n.path,parent:n})}unwrap(){return this._def.type}}class sy extends Et{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.common.async)return(async()=>{const o=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return o.status==="aborted"?yt:o.status==="dirty"?(n.dirty(),dB(o.value)):this._def.out._parseAsync({data:o.value,path:r.path,parent:r})})();{const i=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return i.status==="aborted"?yt:i.status==="dirty"?(n.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:r.path,parent:r})}}static create(t,n){return new sy({in:t,out:n,typeName:st.ZodPipeline})}}class e_ extends Et{_parse(t){const n=this._def.innerType._parse(t);return Dm(n)&&(n.value=Object.freeze(n.value)),n}}e_.create=(e,t)=>new e_({innerType:e,typeName:st.ZodReadonly,...xt(t)});const pB=(e,t={},n)=>e?Gh.create().superRefine((r,i)=>{var o,a;if(!e(r)){const s=typeof t=="function"?t(r):typeof t=="string"?{message:t}:t,l=(a=(o=s.fatal)!==null&&o!==void 0?o:n)!==null&&a!==void 0?a:!0,u=typeof s=="string"?{message:s}:s;i.addIssue({code:"custom",...u,fatal:l})}}):Gh.create(),Qae={object:ar.lazycreate};var st;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(st||(st={}));const Xae=(e,t={message:`Input not instance of ${e.name}`})=>pB(n=>n instanceof e,t),gB=Ya.create,mB=rc.create,Yae=Jb.create,Zae=ic.create,yB=Lm.create,Jae=kd.create,ese=Qb.create,tse=Fm.create,nse=Bm.create,rse=Gh.create,ise=fd.create,ose=Gl.create,ase=Xb.create,sse=rs.create,lse=ar.create,use=ar.strictCreate,cse=zm.create,dse=KS.create,fse=jm.create,hse=Qs.create,pse=Um.create,gse=Yb.create,mse=Td.create,yse=dh.create,vse=Vm.create,bse=Gm.create,_se=oc.create,Sse=Hm.create,xse=Hh.create,Y8=ss.create,wse=Ml.create,Cse=Ad.create,Ese=ss.createWithPreprocess,kse=sy.create,Tse=()=>gB().optional(),Ase=()=>mB().optional(),Pse=()=>yB().optional(),Ise={string:e=>Ya.create({...e,coerce:!0}),number:e=>rc.create({...e,coerce:!0}),boolean:e=>Lm.create({...e,coerce:!0}),bigint:e=>ic.create({...e,coerce:!0}),date:e=>kd.create({...e,coerce:!0})},Rse=yt;var z=Object.freeze({__proto__:null,defaultErrorMap:$m,setErrorMap:$ae,getErrorMap:qb,makeIssue:Wb,EMPTY_PATH:Dae,addIssueToContext:Me,ParseStatus:Ki,INVALID:yt,DIRTY:dB,OK:oo,isAborted:eE,isDirty:tE,isValid:Dm,isAsync:Kb,get util(){return Xt},get objectUtil(){return J3},ZodParsedType:Re,getParsedType:wu,ZodType:Et,ZodString:Ya,ZodNumber:rc,ZodBigInt:ic,ZodBoolean:Lm,ZodDate:kd,ZodSymbol:Qb,ZodUndefined:Fm,ZodNull:Bm,ZodAny:Gh,ZodUnknown:fd,ZodNever:Gl,ZodVoid:Xb,ZodArray:rs,ZodObject:ar,ZodUnion:zm,ZodDiscriminatedUnion:KS,ZodIntersection:jm,ZodTuple:Qs,ZodRecord:Um,ZodMap:Yb,ZodSet:Td,ZodFunction:dh,ZodLazy:Vm,ZodLiteral:Gm,ZodEnum:oc,ZodNativeEnum:Hm,ZodPromise:Hh,ZodEffects:ss,ZodTransformer:ss,ZodOptional:Ml,ZodNullable:Ad,ZodDefault:qm,ZodCatch:Zb,ZodNaN:Jb,BRAND:Kae,ZodBranded:hB,ZodPipeline:sy,ZodReadonly:e_,custom:pB,Schema:Et,ZodSchema:Et,late:Qae,get ZodFirstPartyTypeKind(){return st},coerce:Ise,any:rse,array:sse,bigint:Zae,boolean:yB,date:Jae,discriminatedUnion:dse,effect:Y8,enum:_se,function:yse,instanceof:Xae,intersection:fse,lazy:vse,literal:bse,map:gse,nan:Yae,nativeEnum:Sse,never:ose,null:nse,nullable:Cse,number:mB,object:lse,oboolean:Pse,onumber:Ase,optional:wse,ostring:Tse,pipeline:kse,preprocess:Ese,promise:xse,record:pse,set:mse,strictObject:use,string:gB,symbol:ese,transformer:Y8,tuple:hse,undefined:tse,union:cse,unknown:ise,void:ase,NEVER:Rse,ZodIssueCode:he,quotelessJson:Nae,ZodError:ns});const Ose=z.string(),Hje=e=>Ose.safeParse(e).success,Mse=z.string(),qje=e=>Mse.safeParse(e).success,Nse=z.string(),Wje=e=>Nse.safeParse(e).success,$se=z.string(),Kje=e=>$se.safeParse(e).success,Dse=z.number().int().min(1),Qje=e=>Dse.safeParse(e).success,Lse=z.number().min(1),Xje=e=>Lse.safeParse(e).success,vB=z.enum(["euler","deis","ddim","ddpm","dpmpp_2s","dpmpp_2m","dpmpp_2m_sde","dpmpp_sde","heun","kdpm_2","lms","pndm","unipc","euler_k","dpmpp_2s_k","dpmpp_2m_k","dpmpp_2m_sde_k","dpmpp_sde_k","heun_k","lms_k","euler_a","kdpm_2_a"]),Yje=e=>vB.safeParse(e).success,Zje={euler:"Euler",deis:"DEIS",ddim:"DDIM",ddpm:"DDPM",dpmpp_sde:"DPM++ SDE",dpmpp_2s:"DPM++ 2S",dpmpp_2m:"DPM++ 2M",dpmpp_2m_sde:"DPM++ 2M SDE",heun:"Heun",kdpm_2:"KDPM 2",lms:"LMS",pndm:"PNDM",unipc:"UniPC",euler_k:"Euler Karras",dpmpp_sde_k:"DPM++ SDE Karras",dpmpp_2s_k:"DPM++ 2S Karras",dpmpp_2m_k:"DPM++ 2M Karras",dpmpp_2m_sde_k:"DPM++ 2M SDE Karras",heun_k:"Heun Karras",lms_k:"LMS Karras",euler_a:"Euler Ancestral",kdpm_2_a:"KDPM 2 Ancestral"},Fse=z.number().int().min(0).max(Gg),Jje=e=>Fse.safeParse(e).success,Bse=z.number().multipleOf(8).min(64),eUe=e=>Bse.safeParse(e).success,zse=z.number().multipleOf(8).min(64),tUe=e=>zse.safeParse(e).success,jd=z.enum(["any","sd-1","sd-2","sdxl","sdxl-refiner"]),QS=z.object({model_name:z.string().min(1),base_model:jd,model_type:z.literal("main")}),nUe=e=>QS.safeParse(e).success,fT=z.object({model_name:z.string().min(1),base_model:z.literal("sdxl-refiner"),model_type:z.literal("main")}),rUe=e=>fT.safeParse(e).success,bB=z.object({model_name:z.string().min(1),base_model:jd,model_type:z.literal("onnx")}),ly=z.union([QS,bB]),jse=z.object({model_name:z.string().min(1),base_model:jd}),Use=z.object({model_name:z.string().min(1),base_model:jd}),iUe=e=>Use.safeParse(e).success,Vse=z.object({model_name:z.string().min(1),base_model:jd}),oUe=e=>Vse.safeParse(e).success,Gse=z.object({model_name:z.string().min(1),base_model:jd}),aUe=e=>Gse.safeParse(e).success,Hse=z.number().min(0).max(1),sUe=e=>Hse.safeParse(e).success;z.enum(["fp16","fp32"]);const qse=z.number().min(1).max(10),lUe=e=>qse.safeParse(e).success,Wse=z.number().min(1).max(10),uUe=e=>Wse.safeParse(e).success,Kse=z.number().min(0).max(1),cUe=e=>Kse.safeParse(e).success;z.enum(["box","gaussian"]);z.enum(["unmasked","mask","edge"]);const hT={cfgScale:7.5,height:512,img2imgStrength:.75,infillMethod:"patchmatch",iterations:1,perlin:0,positivePrompt:"",negativePrompt:"",scheduler:"euler",maskBlur:16,maskBlurMethod:"box",canvasCoherenceMode:"unmasked",canvasCoherenceSteps:20,canvasCoherenceStrength:.3,seed:0,seedWeights:"",shouldFitToWidthHeight:!0,shouldGenerateVariations:!1,shouldRandomizeSeed:!0,steps:50,threshold:0,infillTileSize:32,infillPatchmatchDownscaleSize:1,variationAmount:.1,width:512,shouldUseSymmetry:!1,horizontalSymmetrySteps:0,verticalSymmetrySteps:0,model:null,vae:null,vaePrecision:"fp32",seamlessXAxis:!1,seamlessYAxis:!1,clipSkip:0,shouldUseCpuNoise:!0,shouldShowAdvancedOptions:!1,aspectRatio:null,shouldLockAspectRatio:!1},Qse=hT,_B=nr({name:"generation",initialState:Qse,reducers:{setPositivePrompt:(e,t)=>{e.positivePrompt=t.payload},setNegativePrompt:(e,t)=>{e.negativePrompt=t.payload},setIterations:(e,t)=>{e.iterations=t.payload},setSteps:(e,t)=>{e.steps=t.payload},clampSymmetrySteps:e=>{e.horizontalSymmetrySteps=Ru(e.horizontalSymmetrySteps,0,e.steps),e.verticalSymmetrySteps=Ru(e.verticalSymmetrySteps,0,e.steps)},setCfgScale:(e,t)=>{e.cfgScale=t.payload},setThreshold:(e,t)=>{e.threshold=t.payload},setPerlin:(e,t)=>{e.perlin=t.payload},setHeight:(e,t)=>{e.height=t.payload},setWidth:(e,t)=>{e.width=t.payload},toggleSize:e=>{const[t,n]=[e.width,e.height];e.width=n,e.height=t},setScheduler:(e,t)=>{e.scheduler=t.payload},setSeed:(e,t)=>{e.seed=t.payload,e.shouldRandomizeSeed=!1},setImg2imgStrength:(e,t)=>{e.img2imgStrength=t.payload},setSeamlessXAxis:(e,t)=>{e.seamlessXAxis=t.payload},setSeamlessYAxis:(e,t)=>{e.seamlessYAxis=t.payload},setShouldFitToWidthHeight:(e,t)=>{e.shouldFitToWidthHeight=t.payload},resetSeed:e=>{e.seed=-1},setShouldGenerateVariations:(e,t)=>{e.shouldGenerateVariations=t.payload},setVariationAmount:(e,t)=>{e.variationAmount=t.payload},setSeedWeights:(e,t)=>{e.seedWeights=t.payload,e.shouldGenerateVariations=!0,e.variationAmount=0},resetParametersState:e=>({...e,...hT}),setShouldRandomizeSeed:(e,t)=>{e.shouldRandomizeSeed=t.payload},clearInitialImage:e=>{e.initialImage=void 0},setMaskBlur:(e,t)=>{e.maskBlur=t.payload},setMaskBlurMethod:(e,t)=>{e.maskBlurMethod=t.payload},setCanvasCoherenceMode:(e,t)=>{e.canvasCoherenceMode=t.payload},setCanvasCoherenceSteps:(e,t)=>{e.canvasCoherenceSteps=t.payload},setCanvasCoherenceStrength:(e,t)=>{e.canvasCoherenceStrength=t.payload},setInfillMethod:(e,t)=>{e.infillMethod=t.payload},setInfillTileSize:(e,t)=>{e.infillTileSize=t.payload},setInfillPatchmatchDownscaleSize:(e,t)=>{e.infillPatchmatchDownscaleSize=t.payload},setShouldUseSymmetry:(e,t)=>{e.shouldUseSymmetry=t.payload},setHorizontalSymmetrySteps:(e,t)=>{e.horizontalSymmetrySteps=t.payload},setVerticalSymmetrySteps:(e,t)=>{e.verticalSymmetrySteps=t.payload},initialImageChanged:(e,t)=>{const{image_name:n,width:r,height:i}=t.payload;e.initialImage={imageName:n,width:r,height:i}},modelChanged:(e,t)=>{if(e.model=t.payload,e.model===null)return;const{maxClip:n}=Oae[e.model.base_model];e.clipSkip=Ru(e.clipSkip,0,n)},vaeSelected:(e,t)=>{e.vae=t.payload},vaePrecisionChanged:(e,t)=>{e.vaePrecision=t.payload},setClipSkip:(e,t)=>{e.clipSkip=t.payload},shouldUseCpuNoiseChanged:(e,t)=>{e.shouldUseCpuNoise=t.payload},setAspectRatio:(e,t)=>{const n=t.payload;e.aspectRatio=n,n&&(e.height=qa(e.width/n,8))},setShouldLockAspectRatio:(e,t)=>{e.shouldLockAspectRatio=t.payload}},extraReducers:e=>{e.addCase(Iae,(t,n)=>{var i;const r=(i=n.payload.sd)==null?void 0:i.defaultModel;if(r&&!t.model){const[o,a,s]=r.split("/"),l=QS.safeParse({model_name:s,base_model:o,model_type:a});l.success&&(t.model=l.data)}})}}),{clampSymmetrySteps:dUe,clearInitialImage:pT,resetParametersState:fUe,resetSeed:hUe,setCfgScale:pUe,setWidth:Z8,setHeight:J8,toggleSize:gUe,setImg2imgStrength:mUe,setInfillMethod:Xse,setIterations:yUe,setPerlin:vUe,setPositivePrompt:Yse,setNegativePrompt:bUe,setScheduler:_Ue,setMaskBlur:SUe,setMaskBlurMethod:xUe,setCanvasCoherenceMode:wUe,setCanvasCoherenceSteps:CUe,setCanvasCoherenceStrength:EUe,setSeed:kUe,setSeedWeights:TUe,setShouldFitToWidthHeight:AUe,setShouldGenerateVariations:PUe,setShouldRandomizeSeed:IUe,setSteps:RUe,setThreshold:OUe,setInfillTileSize:MUe,setInfillPatchmatchDownscaleSize:NUe,setVariationAmount:$Ue,setShouldUseSymmetry:DUe,setHorizontalSymmetrySteps:LUe,setVerticalSymmetrySteps:FUe,initialImageChanged:XS,modelChanged:Ou,vaeSelected:SB,setSeamlessXAxis:BUe,setSeamlessYAxis:zUe,setClipSkip:jUe,shouldUseCpuNoiseChanged:UUe,setAspectRatio:Zse,setShouldLockAspectRatio:VUe,vaePrecisionChanged:GUe}=_B.actions,Jse=_B.reducer,uv=(e,t,n,r,i,o,a)=>{const s=Math.floor(e/2-(n+i/2)*a),l=Math.floor(t/2-(r+o/2)*a);return{x:s,y:l}},cv=(e,t,n,r,i=.95)=>{const o=e*i/n,a=t*i/r,s=Math.min(1,Math.min(o,a));return s||1},HUe=.999,qUe=.1,WUe=20,dv=.95,KUe=30,QUe=10,ele=e=>({x:Math.floor(e.x),y:Math.floor(e.y)}),af=e=>{const{width:t,height:n}=e,r={width:t,height:n},i=512*512,o=t/n;let a=t*n,s=448;for(;a1?(r.width=s,r.height=qa(s/o,64)):o<1&&(r.height=s,r.width=qa(s*o,64)),a=r.width*r.height;return r},tle=e=>({width:qa(e.width,64),height:qa(e.height,64)}),XUe=[{label:"Base",value:"base"},{label:"Mask",value:"mask"}],YUe=[{label:"None",value:"none"},{label:"Auto",value:"auto"},{label:"Manual",value:"manual"}],xB=e=>e.kind==="line"&&e.layer==="mask",ZUe=e=>e.kind==="line"&&e.layer==="base",nle=e=>e.kind==="image"&&e.layer==="base",JUe=e=>e.kind==="fillRect"&&e.layer==="base",eVe=e=>e.kind==="eraseRect"&&e.layer==="base",rle=e=>e.kind==="line",mg={objects:[],stagingArea:{images:[],selectedImageIndex:-1}},wB={boundingBoxCoordinates:{x:0,y:0},boundingBoxDimensions:{width:512,height:512},boundingBoxPreviewFill:{r:0,g:0,b:0,a:.5},boundingBoxScaleMethod:"none",brushColor:{r:90,g:90,b:255,a:1},brushSize:50,colorPickerColor:{r:90,g:90,b:255,a:1},cursorPosition:null,futureLayerStates:[],isDrawing:!1,isMaskEnabled:!0,isMouseOverBoundingBox:!1,isMoveBoundingBoxKeyHeld:!1,isMoveStageKeyHeld:!1,isMovingBoundingBox:!1,isMovingStage:!1,isTransformingBoundingBox:!1,layer:"base",layerState:mg,maskColor:{r:255,g:90,b:90,a:1},maxHistory:128,minimumStageScale:1,pastLayerStates:[],scaledBoundingBoxDimensions:{width:512,height:512},shouldAntialias:!0,shouldAutoSave:!1,shouldCropToBoundingBoxOnSave:!1,shouldDarkenOutsideBoundingBox:!1,shouldLockBoundingBox:!1,shouldPreserveMaskedArea:!1,shouldRestrictStrokesToBox:!0,shouldShowBoundingBox:!0,shouldShowBrush:!0,shouldShowBrushPreview:!1,shouldShowCanvasDebugInfo:!1,shouldShowCheckboardTransparency:!1,shouldShowGrid:!0,shouldShowIntermediates:!0,shouldShowStagingImage:!0,shouldShowStagingOutline:!0,shouldSnapToGrid:!0,stageCoordinates:{x:0,y:0},stageDimensions:{width:0,height:0},stageScale:1,tool:"brush",batchIds:[]},CB=nr({name:"canvas",initialState:wB,reducers:{setTool:(e,t)=>{const n=t.payload;e.tool=t.payload,n!=="move"&&(e.isTransformingBoundingBox=!1,e.isMouseOverBoundingBox=!1,e.isMovingBoundingBox=!1,e.isMovingStage=!1)},setLayer:(e,t)=>{e.layer=t.payload},toggleTool:e=>{const t=e.tool;t!=="move"&&(e.tool=t==="brush"?"eraser":"brush")},setMaskColor:(e,t)=>{e.maskColor=t.payload},setBrushColor:(e,t)=>{e.brushColor=t.payload},setBrushSize:(e,t)=>{e.brushSize=t.payload},clearMask:e=>{e.pastLayerStates.push(wn(e.layerState)),e.layerState.objects=e.layerState.objects.filter(t=>!xB(t)),e.futureLayerStates=[],e.shouldPreserveMaskedArea=!1},toggleShouldInvertMask:e=>{e.shouldPreserveMaskedArea=!e.shouldPreserveMaskedArea},toggleShouldShowMask:e=>{e.isMaskEnabled=!e.isMaskEnabled},setShouldPreserveMaskedArea:(e,t)=>{e.shouldPreserveMaskedArea=t.payload},setIsMaskEnabled:(e,t)=>{e.isMaskEnabled=t.payload,e.layer=t.payload?"mask":"base"},setShouldShowCheckboardTransparency:(e,t)=>{e.shouldShowCheckboardTransparency=t.payload},setShouldShowBrushPreview:(e,t)=>{e.shouldShowBrushPreview=t.payload},setShouldShowBrush:(e,t)=>{e.shouldShowBrush=t.payload},setCursorPosition:(e,t)=>{e.cursorPosition=t.payload},setInitialCanvasImage:(e,t)=>{const n=t.payload,{width:r,height:i}=n,{stageDimensions:o}=e,a={width:sv(Ru(r,64,512),64),height:sv(Ru(i,64,512),64)},s={x:qa(r/2-a.width/2,64),y:qa(i/2-a.height/2,64)};if(e.boundingBoxScaleMethod==="auto"){const c=af(a);e.scaledBoundingBoxDimensions=c}e.boundingBoxDimensions=a,e.boundingBoxCoordinates=s,e.pastLayerStates.push(wn(e.layerState)),e.layerState={...wn(mg),objects:[{kind:"image",layer:"base",x:0,y:0,width:r,height:i,imageName:n.image_name}]},e.futureLayerStates=[],e.batchIds=[];const l=cv(o.width,o.height,r,i,dv),u=uv(o.width,o.height,0,0,r,i,l);e.stageScale=l,e.stageCoordinates=u},setBoundingBoxDimensions:(e,t)=>{const n=tle(t.payload);if(e.boundingBoxDimensions=n,e.boundingBoxScaleMethod==="auto"){const r=af(n);e.scaledBoundingBoxDimensions=r}},flipBoundingBoxAxes:e=>{const[t,n]=[e.boundingBoxDimensions.width,e.boundingBoxDimensions.height],[r,i]=[e.scaledBoundingBoxDimensions.width,e.scaledBoundingBoxDimensions.height];e.boundingBoxDimensions={width:n,height:t},e.scaledBoundingBoxDimensions={width:i,height:r}},setBoundingBoxCoordinates:(e,t)=>{e.boundingBoxCoordinates=ele(t.payload)},setStageCoordinates:(e,t)=>{e.stageCoordinates=t.payload},setBoundingBoxPreviewFill:(e,t)=>{e.boundingBoxPreviewFill=t.payload},setStageScale:(e,t)=>{e.stageScale=t.payload},setShouldDarkenOutsideBoundingBox:(e,t)=>{e.shouldDarkenOutsideBoundingBox=t.payload},setIsDrawing:(e,t)=>{e.isDrawing=t.payload},clearCanvasHistory:e=>{e.pastLayerStates=[],e.futureLayerStates=[]},setShouldLockBoundingBox:(e,t)=>{e.shouldLockBoundingBox=t.payload},toggleShouldLockBoundingBox:e=>{e.shouldLockBoundingBox=!e.shouldLockBoundingBox},setShouldShowBoundingBox:(e,t)=>{e.shouldShowBoundingBox=t.payload},setIsTransformingBoundingBox:(e,t)=>{e.isTransformingBoundingBox=t.payload},setIsMovingBoundingBox:(e,t)=>{e.isMovingBoundingBox=t.payload},setIsMouseOverBoundingBox:(e,t)=>{e.isMouseOverBoundingBox=t.payload},setIsMoveBoundingBoxKeyHeld:(e,t)=>{e.isMoveBoundingBoxKeyHeld=t.payload},setIsMoveStageKeyHeld:(e,t)=>{e.isMoveStageKeyHeld=t.payload},canvasBatchIdAdded:(e,t)=>{e.batchIds.push(t.payload)},canvasBatchIdsReset:e=>{e.batchIds=[]},stagingAreaInitialized:(e,t)=>{const{boundingBox:n}=t.payload;e.layerState.stagingArea={boundingBox:n,images:[],selectedImageIndex:-1}},addImageToStagingArea:(e,t)=>{const n=t.payload;!n||!e.layerState.stagingArea.boundingBox||(e.pastLayerStates.push(wn(e.layerState)),e.pastLayerStates.length>e.maxHistory&&e.pastLayerStates.shift(),e.layerState.stagingArea.images.push({kind:"image",layer:"base",...e.layerState.stagingArea.boundingBox,imageName:n.image_name}),e.layerState.stagingArea.selectedImageIndex=e.layerState.stagingArea.images.length-1,e.futureLayerStates=[])},discardStagedImages:e=>{e.pastLayerStates.push(wn(e.layerState)),e.pastLayerStates.length>e.maxHistory&&e.pastLayerStates.shift(),e.layerState.stagingArea=wn(wn(mg)).stagingArea,e.futureLayerStates=[],e.shouldShowStagingOutline=!0,e.shouldShowStagingImage=!0,e.batchIds=[]},addFillRect:e=>{const{boundingBoxCoordinates:t,boundingBoxDimensions:n,brushColor:r}=e;e.pastLayerStates.push(wn(e.layerState)),e.pastLayerStates.length>e.maxHistory&&e.pastLayerStates.shift(),e.layerState.objects.push({kind:"fillRect",layer:"base",...t,...n,color:r}),e.futureLayerStates=[]},addEraseRect:e=>{const{boundingBoxCoordinates:t,boundingBoxDimensions:n}=e;e.pastLayerStates.push(wn(e.layerState)),e.pastLayerStates.length>e.maxHistory&&e.pastLayerStates.shift(),e.layerState.objects.push({kind:"eraseRect",layer:"base",...t,...n}),e.futureLayerStates=[]},addLine:(e,t)=>{const{tool:n,layer:r,brushColor:i,brushSize:o,shouldRestrictStrokesToBox:a}=e;if(n==="move"||n==="colorPicker")return;const s=o/2,l=r==="base"&&n==="brush"?{color:i}:{};e.pastLayerStates.push(wn(e.layerState)),e.pastLayerStates.length>e.maxHistory&&e.pastLayerStates.shift();const u={kind:"line",layer:r,tool:n,strokeWidth:s,points:t.payload,...l};a&&(u.clip={...e.boundingBoxCoordinates,...e.boundingBoxDimensions}),e.layerState.objects.push(u),e.futureLayerStates=[]},addPointToCurrentLine:(e,t)=>{const n=e.layerState.objects.findLast(rle);n&&n.points.push(...t.payload)},undo:e=>{const t=e.pastLayerStates.pop();t&&(e.futureLayerStates.unshift(wn(e.layerState)),e.futureLayerStates.length>e.maxHistory&&e.futureLayerStates.pop(),e.layerState=t)},redo:e=>{const t=e.futureLayerStates.shift();t&&(e.pastLayerStates.push(wn(e.layerState)),e.pastLayerStates.length>e.maxHistory&&e.pastLayerStates.shift(),e.layerState=t)},setShouldShowGrid:(e,t)=>{e.shouldShowGrid=t.payload},setIsMovingStage:(e,t)=>{e.isMovingStage=t.payload},setShouldSnapToGrid:(e,t)=>{e.shouldSnapToGrid=t.payload},setShouldAutoSave:(e,t)=>{e.shouldAutoSave=t.payload},setShouldShowIntermediates:(e,t)=>{e.shouldShowIntermediates=t.payload},resetCanvas:e=>{e.pastLayerStates.push(wn(e.layerState)),e.layerState=wn(mg),e.futureLayerStates=[],e.batchIds=[]},canvasResized:(e,t)=>{const{width:n,height:r}=t.payload,i={width:Math.floor(n),height:Math.floor(r)};if(e.stageDimensions=i,!e.layerState.objects.find(nle)){const o=cv(i.width,i.height,512,512,dv),a=uv(i.width,i.height,0,0,512,512,o),s={width:512,height:512};if(e.stageScale=o,e.stageCoordinates=a,e.boundingBoxCoordinates={x:0,y:0},e.boundingBoxDimensions=s,e.boundingBoxScaleMethod==="auto"){const l=af(s);e.scaledBoundingBoxDimensions=l}}},resetCanvasView:(e,t)=>{const{contentRect:n,shouldScaleTo1:r}=t.payload,{stageDimensions:{width:i,height:o}}=e,{x:a,y:s,width:l,height:u}=n;if(l!==0&&u!==0){const c=r?1:cv(i,o,l,u,dv),d=uv(i,o,a,s,l,u,c);e.stageScale=c,e.stageCoordinates=d}else{const c=cv(i,o,512,512,dv),d=uv(i,o,0,0,512,512,c),f={width:512,height:512};if(e.stageScale=c,e.stageCoordinates=d,e.boundingBoxCoordinates={x:0,y:0},e.boundingBoxDimensions=f,e.boundingBoxScaleMethod==="auto"){const h=af(f);e.scaledBoundingBoxDimensions=h}}},nextStagingAreaImage:e=>{if(!e.layerState.stagingArea.images.length)return;const t=e.layerState.stagingArea.selectedImageIndex+1,n=e.layerState.stagingArea.images.length-1;e.layerState.stagingArea.selectedImageIndex=t>n?0:t},prevStagingAreaImage:e=>{if(!e.layerState.stagingArea.images.length)return;const t=e.layerState.stagingArea.selectedImageIndex-1,n=e.layerState.stagingArea.images.length-1;e.layerState.stagingArea.selectedImageIndex=t<0?n:t},commitStagingAreaImage:e=>{if(!e.layerState.stagingArea.images.length)return;const{images:t,selectedImageIndex:n}=e.layerState.stagingArea;e.pastLayerStates.push(wn(e.layerState)),e.pastLayerStates.length>e.maxHistory&&e.pastLayerStates.shift();const r=t[n];r&&e.layerState.objects.push({...r}),e.layerState.stagingArea=wn(mg).stagingArea,e.futureLayerStates=[],e.shouldShowStagingOutline=!0,e.shouldShowStagingImage=!0,e.batchIds=[]},fitBoundingBoxToStage:e=>{const{boundingBoxDimensions:t,boundingBoxCoordinates:n,stageDimensions:r,stageScale:i}=e,o=r.width/i,a=r.height/i;if(n.x<0||n.x+t.width>o||n.y<0||n.y+t.height>a){const s={width:sv(Ru(o,64,512),64),height:sv(Ru(a,64,512),64)},l={x:qa(o/2-s.width/2,64),y:qa(a/2-s.height/2,64)};if(e.boundingBoxDimensions=s,e.boundingBoxCoordinates=l,e.boundingBoxScaleMethod==="auto"){const u=af(s);e.scaledBoundingBoxDimensions=u}}},setBoundingBoxScaleMethod:(e,t)=>{if(e.boundingBoxScaleMethod=t.payload,t.payload==="auto"){const n=af(e.boundingBoxDimensions);e.scaledBoundingBoxDimensions=n}},setScaledBoundingBoxDimensions:(e,t)=>{e.scaledBoundingBoxDimensions=t.payload},setShouldShowStagingImage:(e,t)=>{e.shouldShowStagingImage=t.payload},setShouldShowStagingOutline:(e,t)=>{e.shouldShowStagingOutline=t.payload},setShouldShowCanvasDebugInfo:(e,t)=>{e.shouldShowCanvasDebugInfo=t.payload},setShouldRestrictStrokesToBox:(e,t)=>{e.shouldRestrictStrokesToBox=t.payload},setShouldAntialias:(e,t)=>{e.shouldAntialias=t.payload},setShouldCropToBoundingBoxOnSave:(e,t)=>{e.shouldCropToBoundingBoxOnSave=t.payload},setColorPickerColor:(e,t)=>{e.colorPickerColor=t.payload},commitColorPickerColor:e=>{e.brushColor={...e.colorPickerColor,a:e.brushColor.a},e.tool="brush"},setMergedCanvas:(e,t)=>{e.pastLayerStates.push(wn(e.layerState)),e.futureLayerStates=[],e.layerState.objects=[t.payload]},resetCanvasInteractionState:e=>{e.cursorPosition=null,e.isDrawing=!1,e.isMouseOverBoundingBox=!1,e.isMoveBoundingBoxKeyHeld=!1,e.isMoveStageKeyHeld=!1,e.isMovingBoundingBox=!1,e.isMovingStage=!1,e.isTransformingBoundingBox=!1},mouseLeftCanvas:e=>{e.cursorPosition=null,e.isDrawing=!1,e.isMouseOverBoundingBox=!1,e.isMovingBoundingBox=!1,e.isTransformingBoundingBox=!1}},extraReducers:e=>{e.addCase(Zse,(t,n)=>{const r=n.payload;r&&(t.boundingBoxDimensions.height=qa(t.boundingBoxDimensions.width/r,64),t.scaledBoundingBoxDimensions.height=qa(t.scaledBoundingBoxDimensions.width/r,64))})}}),{addEraseRect:tVe,addFillRect:nVe,addImageToStagingArea:ile,addLine:rVe,addPointToCurrentLine:iVe,clearCanvasHistory:oVe,clearMask:aVe,commitColorPickerColor:sVe,commitStagingAreaImage:ole,discardStagedImages:ale,fitBoundingBoxToStage:lVe,mouseLeftCanvas:uVe,nextStagingAreaImage:cVe,prevStagingAreaImage:dVe,redo:fVe,resetCanvas:gT,resetCanvasInteractionState:hVe,resetCanvasView:pVe,setBoundingBoxCoordinates:gVe,setBoundingBoxDimensions:eI,setBoundingBoxPreviewFill:mVe,setBoundingBoxScaleMethod:yVe,flipBoundingBoxAxes:vVe,setBrushColor:bVe,setBrushSize:_Ve,setColorPickerColor:SVe,setCursorPosition:xVe,setInitialCanvasImage:EB,setIsDrawing:wVe,setIsMaskEnabled:CVe,setIsMouseOverBoundingBox:EVe,setIsMoveBoundingBoxKeyHeld:kVe,setIsMoveStageKeyHeld:TVe,setIsMovingBoundingBox:AVe,setIsMovingStage:PVe,setIsTransformingBoundingBox:IVe,setLayer:RVe,setMaskColor:OVe,setMergedCanvas:sle,setShouldAutoSave:MVe,setShouldCropToBoundingBoxOnSave:NVe,setShouldDarkenOutsideBoundingBox:$Ve,setShouldLockBoundingBox:DVe,setShouldPreserveMaskedArea:LVe,setShouldShowBoundingBox:FVe,setShouldShowBrush:BVe,setShouldShowBrushPreview:zVe,setShouldShowCanvasDebugInfo:jVe,setShouldShowCheckboardTransparency:UVe,setShouldShowGrid:VVe,setShouldShowIntermediates:GVe,setShouldShowStagingImage:HVe,setShouldShowStagingOutline:qVe,setShouldSnapToGrid:WVe,setStageCoordinates:KVe,setStageScale:QVe,setTool:XVe,toggleShouldLockBoundingBox:YVe,toggleTool:ZVe,undo:JVe,setScaledBoundingBoxDimensions:eGe,setShouldRestrictStrokesToBox:tGe,stagingAreaInitialized:lle,setShouldAntialias:nGe,canvasResized:rGe,canvasBatchIdAdded:ule,canvasBatchIdsReset:cle}=CB.actions,dle=CB.reducer,fle={isModalOpen:!1,imagesToChange:[]},kB=nr({name:"changeBoardModal",initialState:fle,reducers:{isModalOpenChanged:(e,t)=>{e.isModalOpen=t.payload},imagesToChangeSelected:(e,t)=>{e.imagesToChange=t.payload},changeBoardReset:e=>{e.imagesToChange=[],e.isModalOpen=!1}}}),{isModalOpenChanged:iGe,imagesToChangeSelected:oGe,changeBoardReset:aGe}=kB.actions,hle=kB.reducer;var TB={exports:{}},AB={};const Lo=dS(EZ),Up=dS(AY),ple=dS(zY);(function(e){var t,n,r=mt&&mt.__generator||function(q,te){var re,de,oe,je,Ge={label:0,sent:function(){if(1&oe[0])throw oe[1];return oe[1]},trys:[],ops:[]};return je={next:lt(0),throw:lt(1),return:lt(2)},typeof Symbol=="function"&&(je[Symbol.iterator]=function(){return this}),je;function lt($e){return function(He){return function(Ie){if(re)throw new TypeError("Generator is already executing.");for(;Ge;)try{if(re=1,de&&(oe=2&Ie[0]?de.return:Ie[0]?de.throw||((oe=de.return)&&oe.call(de),0):de.next)&&!(oe=oe.call(de,Ie[1])).done)return oe;switch(de=0,oe&&(Ie=[2&Ie[0],oe.value]),Ie[0]){case 0:case 1:oe=Ie;break;case 4:return Ge.label++,{value:Ie[1],done:!1};case 5:Ge.label++,de=Ie[1],Ie=[0];continue;case 7:Ie=Ge.ops.pop(),Ge.trys.pop();continue;default:if(!((oe=(oe=Ge.trys).length>0&&oe[oe.length-1])||Ie[0]!==6&&Ie[0]!==2)){Ge=0;continue}if(Ie[0]===3&&(!oe||Ie[1]>oe[0]&&Ie[1]=200&&q.status<=299},$=function(q){return/ion\/(vnd\.api\+)?json/.test(q.get("content-type")||"")};function O(q){if(!(0,T.isPlainObject)(q))return q;for(var te=_({},q),re=0,de=Object.entries(te);re"u"&&Ge===k&&console.warn("Warning: `fetch` is not available. Please supply a custom `fetchFn` property to use `fetchBaseQuery` on SSR environments."),function(wt,kt){return S(te,null,function(){var cn,dn,$i,Do,Di,_r,yi,Qn,po,La,it,fn,nn,ir,Sr,vi,_n,Mt,qt,Sn,rn,gn,Se,Je,Ue,Te,qe,dt,Ve,xe,ue,Ee,fe,ge,we,et;return r(this,function(Qe){switch(Qe.label){case 0:return cn=kt.signal,dn=kt.getState,$i=kt.extra,Do=kt.endpoint,Di=kt.forced,_r=kt.type,po=(Qn=typeof wt=="string"?{url:wt}:wt).url,it=(La=Qn.headers)===void 0?new Headers(ct.headers):La,nn=(fn=Qn.params)===void 0?void 0:fn,Sr=(ir=Qn.responseHandler)===void 0?Ze??"json":ir,_n=(vi=Qn.validateStatus)===void 0?ut??P:vi,qt=(Mt=Qn.timeout)===void 0?Ye:Mt,Sn=g(Qn,["url","headers","params","responseHandler","validateStatus","timeout"]),rn=_(b(_({},ct),{signal:cn}),Sn),it=new Headers(O(it)),gn=rn,[4,oe(it,{getState:dn,extra:$i,endpoint:Do,forced:Di,type:_r})];case 1:gn.headers=Qe.sent()||it,Se=function(Ae){return typeof Ae=="object"&&((0,T.isPlainObject)(Ae)||Array.isArray(Ae)||typeof Ae.toJSON=="function")},!rn.headers.has("content-type")&&Se(rn.body)&&rn.headers.set("content-type",ie),Se(rn.body)&&He(rn.headers)&&(rn.body=JSON.stringify(rn.body,_e)),nn&&(Je=~po.indexOf("?")?"&":"?",Ue=lt?lt(nn):new URLSearchParams(O(nn)),po+=Je+Ue),po=function(Ae,Tt){if(!Ae)return Tt;if(!Tt)return Ae;if(function(Vt){return new RegExp("(^|:)//").test(Vt)}(Tt))return Tt;var jt=Ae.endsWith("/")||!Tt.startsWith("?")?"/":"";return Ae=function(Vt){return Vt.replace(/\/$/,"")}(Ae),""+Ae+jt+function(Vt){return Vt.replace(/^\//,"")}(Tt)}(re,po),Te=new Request(po,rn),qe=Te.clone(),yi={request:qe},Ve=!1,xe=qt&&setTimeout(function(){Ve=!0,kt.abort()},qt),Qe.label=2;case 2:return Qe.trys.push([2,4,5,6]),[4,Ge(Te)];case 3:return dt=Qe.sent(),[3,6];case 4:return ue=Qe.sent(),[2,{error:{status:Ve?"TIMEOUT_ERROR":"FETCH_ERROR",error:String(ue)},meta:yi}];case 5:return xe&&clearTimeout(xe),[7];case 6:Ee=dt.clone(),yi.response=Ee,ge="",Qe.label=7;case 7:return Qe.trys.push([7,9,,10]),[4,Promise.all([_t(dt,Sr).then(function(Ae){return fe=Ae},function(Ae){return we=Ae}),Ee.text().then(function(Ae){return ge=Ae},function(){})])];case 8:if(Qe.sent(),we)throw we;return[3,10];case 9:return et=Qe.sent(),[2,{error:{status:"PARSING_ERROR",originalStatus:dt.status,data:ge,error:String(et)},meta:yi}];case 10:return[2,_n(dt,fe)?{data:fe,meta:yi}:{error:{status:dt.status,data:fe},meta:yi}]}})})};function _t(wt,kt){return S(this,null,function(){var cn;return r(this,function(dn){switch(dn.label){case 0:return typeof kt=="function"?[2,kt(wt)]:(kt==="content-type"&&(kt=He(wt.headers)?"json":"text"),kt!=="json"?[3,2]:[4,wt.text()]);case 1:return[2,(cn=dn.sent()).length?JSON.parse(cn):null];case 2:return[2,wt.text()]}})})}}var A=function(q,te){te===void 0&&(te=void 0),this.value=q,this.meta=te};function D(q,te){return q===void 0&&(q=0),te===void 0&&(te=5),S(this,null,function(){var re,de;return r(this,function(oe){switch(oe.label){case 0:return re=Math.min(q,te),de=~~((Math.random()+.4)*(300<=Ee)}var Sn=(0,Jt.createAsyncThunk)(nn+"/executeQuery",Mt,{getPendingMeta:function(){var Se;return(Se={startedTimeStamp:Date.now()})[Jt.SHOULD_AUTOBATCH]=!0,Se},condition:function(Se,Je){var Ue,Te,qe,dt=(0,Je.getState)(),Ve=(Te=(Ue=dt[nn])==null?void 0:Ue.queries)==null?void 0:Te[Se.queryCacheKey],xe=Ve==null?void 0:Ve.fulfilledTimeStamp,ue=Se.originalArgs,Ee=Ve==null?void 0:Ve.originalArgs,fe=Sr[Se.endpointName];return!(!ze(Se)&&((Ve==null?void 0:Ve.status)==="pending"||!qt(Se,dt)&&(!ne(fe)||!((qe=fe==null?void 0:fe.forceRefetch)!=null&&qe.call(fe,{currentArg:ue,previousArg:Ee,endpointState:Ve,state:dt})))&&xe))},dispatchConditionRejection:!0}),rn=(0,Jt.createAsyncThunk)(nn+"/executeMutation",Mt,{getPendingMeta:function(){var Se;return(Se={startedTimeStamp:Date.now()})[Jt.SHOULD_AUTOBATCH]=!0,Se}});function gn(Se){return function(Je){var Ue,Te;return((Te=(Ue=Je==null?void 0:Je.meta)==null?void 0:Ue.arg)==null?void 0:Te.endpointName)===Se}}return{queryThunk:Sn,mutationThunk:rn,prefetch:function(Se,Je,Ue){return function(Te,qe){var dt=function(fe){return"force"in fe}(Ue)&&Ue.force,Ve=function(fe){return"ifOlderThan"in fe}(Ue)&&Ue.ifOlderThan,xe=function(fe){return fe===void 0&&(fe=!0),_n.endpoints[Se].initiate(Je,{forceRefetch:fe})},ue=_n.endpoints[Se].select(Je)(qe());if(dt)Te(xe());else if(Ve){var Ee=ue==null?void 0:ue.fulfilledTimeStamp;if(!Ee)return void Te(xe());(Number(new Date)-Number(new Date(Ee)))/1e3>=Ve&&Te(xe())}else Te(xe(!1))}},updateQueryData:function(Se,Je,Ue){return function(Te,qe){var dt,Ve,xe=_n.endpoints[Se].select(Je)(qe()),ue={patches:[],inversePatches:[],undo:function(){return Te(_n.util.patchQueryData(Se,Je,ue.inversePatches))}};if(xe.status===t.uninitialized)return ue;if("data"in xe)if((0,Pe.isDraftable)(xe.data)){var Ee=(0,Pe.produceWithPatches)(xe.data,Ue),fe=Ee[2];(dt=ue.patches).push.apply(dt,Ee[1]),(Ve=ue.inversePatches).push.apply(Ve,fe)}else{var ge=Ue(xe.data);ue.patches.push({op:"replace",path:[],value:ge}),ue.inversePatches.push({op:"replace",path:[],value:xe.data})}return Te(_n.util.patchQueryData(Se,Je,ue.patches)),ue}},upsertQueryData:function(Se,Je,Ue){return function(Te){var qe;return Te(_n.endpoints[Se].initiate(Je,((qe={subscribe:!1,forceRefetch:!0})[ot]=function(){return{data:Ue}},qe)))}},patchQueryData:function(Se,Je,Ue){return function(Te){Te(_n.internalActions.queryResultPatched({queryCacheKey:vi({queryArgs:Je,endpointDefinition:Sr[Se],endpointName:Se}),patches:Ue}))}},buildMatchThunkActions:function(Se,Je){return{matchPending:(0,gt.isAllOf)((0,gt.isPending)(Se),gn(Je)),matchFulfilled:(0,gt.isAllOf)((0,gt.isFulfilled)(Se),gn(Je)),matchRejected:(0,gt.isAllOf)((0,gt.isRejected)(Se),gn(Je))}}}}({baseQuery:de,reducerPath:oe,context:re,api:q,serializeQueryArgs:je}),_e=ie.queryThunk,Ye=ie.mutationThunk,Ze=ie.patchQueryData,ut=ie.updateQueryData,ct=ie.upsertQueryData,_t=ie.prefetch,wt=ie.buildMatchThunkActions,kt=function(it){var fn=it.reducerPath,nn=it.queryThunk,ir=it.mutationThunk,Sr=it.context,vi=Sr.endpointDefinitions,_n=Sr.apiUid,Mt=Sr.extractRehydrationInfo,qt=Sr.hasRehydrationInfo,Sn=it.assertTagType,rn=it.config,gn=(0,ce.createAction)(fn+"/resetApiState"),Se=(0,ce.createSlice)({name:fn+"/queries",initialState:Jr,reducers:{removeQueryResult:{reducer:function(xe,ue){delete xe[ue.payload.queryCacheKey]},prepare:(0,ce.prepareAutoBatched)()},queryResultPatched:function(xe,ue){var Ee=ue.payload,fe=Ee.patches;Ln(xe,Ee.queryCacheKey,function(ge){ge.data=(0,en.applyPatches)(ge.data,fe.concat())})}},extraReducers:function(xe){xe.addCase(nn.pending,function(ue,Ee){var fe,ge=Ee.meta,we=Ee.meta.arg,et=ze(we);(we.subscribe||et)&&(ue[fe=we.queryCacheKey]!=null||(ue[fe]={status:t.uninitialized,endpointName:we.endpointName})),Ln(ue,we.queryCacheKey,function(Qe){Qe.status=t.pending,Qe.requestId=et&&Qe.requestId?Qe.requestId:ge.requestId,we.originalArgs!==void 0&&(Qe.originalArgs=we.originalArgs),Qe.startedTimeStamp=ge.startedTimeStamp})}).addCase(nn.fulfilled,function(ue,Ee){var fe=Ee.meta,ge=Ee.payload;Ln(ue,fe.arg.queryCacheKey,function(we){var et;if(we.requestId===fe.requestId||ze(fe.arg)){var Qe=vi[fe.arg.endpointName].merge;if(we.status=t.fulfilled,Qe)if(we.data!==void 0){var Ae=fe.fulfilledTimeStamp,Tt=fe.arg,jt=fe.baseQueryMeta,Vt=fe.requestId,or=(0,ce.createNextState)(we.data,function(pr){return Qe(pr,ge,{arg:Tt.originalArgs,baseQueryMeta:jt,fulfilledTimeStamp:Ae,requestId:Vt})});we.data=or}else we.data=ge;else we.data=(et=vi[fe.arg.endpointName].structuralSharing)==null||et?C((0,Tn.isDraft)(we.data)?(0,en.original)(we.data):we.data,ge):ge;delete we.error,we.fulfilledTimeStamp=fe.fulfilledTimeStamp}})}).addCase(nn.rejected,function(ue,Ee){var fe=Ee.meta,ge=fe.condition,we=fe.requestId,et=Ee.error,Qe=Ee.payload;Ln(ue,fe.arg.queryCacheKey,function(Ae){if(!ge){if(Ae.requestId!==we)return;Ae.status=t.rejected,Ae.error=Qe??et}})}).addMatcher(qt,function(ue,Ee){for(var fe=Mt(Ee).queries,ge=0,we=Object.entries(fe);ge"u"||navigator.onLine===void 0||navigator.onLine,focused:typeof document>"u"||document.visibilityState!=="hidden",middlewareRegistered:!1},rn),reducers:{middlewareRegistered:function(xe,ue){xe.middlewareRegistered=xe.middlewareRegistered!=="conflict"&&_n===ue.payload||"conflict"}},extraReducers:function(xe){xe.addCase(U,function(ue){ue.online=!0}).addCase(G,function(ue){ue.online=!1}).addCase(N,function(ue){ue.focused=!0}).addCase(B,function(ue){ue.focused=!1}).addMatcher(qt,function(ue){return _({},ue)})}}),Ve=(0,ce.combineReducers)({queries:Se.reducer,mutations:Je.reducer,provided:Ue.reducer,subscriptions:qe.reducer,config:dt.reducer});return{reducer:function(xe,ue){return Ve(gn.match(ue)?void 0:xe,ue)},actions:b(_(_(_(_(_({},dt.actions),Se.actions),Te.actions),qe.actions),Je.actions),{unsubscribeMutationResult:Je.actions.removeMutationResult,resetApiState:gn})}}({context:re,queryThunk:_e,mutationThunk:Ye,reducerPath:oe,assertTagType:Ie,config:{refetchOnFocus:$e,refetchOnReconnect:He,refetchOnMountOrArgChange:lt,keepUnusedDataFor:Ge,reducerPath:oe}}),cn=kt.reducer,dn=kt.actions;mi(q.util,{patchQueryData:Ze,updateQueryData:ut,upsertQueryData:ct,prefetch:_t,resetApiState:dn.resetApiState}),mi(q.internalActions,dn);var $i=function(it){var fn=it.reducerPath,nn=it.queryThunk,ir=it.api,Sr=it.context,vi=Sr.apiUid,_n={invalidateTags:(0,al.createAction)(fn+"/invalidateTags")},Mt=[zr,Bn,Br,Rr,Ni,gi];return{middleware:function(Sn){var rn=!1,gn=b(_({},it),{internalState:{currentSubscriptions:{}},refetchQuery:qt}),Se=Mt.map(function(Te){return Te(gn)}),Je=function(Te){var qe=Te.api,dt=Te.queryThunk,Ve=Te.internalState,xe=qe.reducerPath+"/subscriptions",ue=null,Ee=!1,fe=qe.internalActions,ge=fe.updateSubscriptionOptions,we=fe.unsubscribeQueryResult;return function(et,Qe){var Ae,Tt;if(ue||(ue=JSON.parse(JSON.stringify(Ve.currentSubscriptions))),qe.util.resetApiState.match(et))return ue=Ve.currentSubscriptions={},[!0,!1];if(qe.internalActions.internal_probeSubscription.match(et)){var jt=et.payload;return[!1,!!((Ae=Ve.currentSubscriptions[jt.queryCacheKey])!=null&&Ae[jt.requestId])]}var Vt=function(zn,An){var Xi,F,V,X,pe,Ct,hn,Pn,It;if(ge.match(An)){var xn=An.payload,bi=xn.queryCacheKey,Xn=xn.requestId;return(Xi=zn==null?void 0:zn[bi])!=null&&Xi[Xn]&&(zn[bi][Xn]=xn.options),!0}if(we.match(An)){var ru=An.payload;return Xn=ru.requestId,zn[bi=ru.queryCacheKey]&&delete zn[bi][Xn],!0}if(qe.internalActions.removeQueryResult.match(An))return delete zn[An.payload.queryCacheKey],!0;if(dt.pending.match(An)){var tf=An.meta;if(Xn=tf.requestId,(rf=tf.arg).subscribe)return(iu=(V=zn[F=rf.queryCacheKey])!=null?V:zn[F]={})[Xn]=(pe=(X=rf.subscriptionOptions)!=null?X:iu[Xn])!=null?pe:{},!0}if(dt.rejected.match(An)){var iu,nf=An.meta,rf=nf.arg;if(Xn=nf.requestId,nf.condition&&rf.subscribe)return(iu=(hn=zn[Ct=rf.queryCacheKey])!=null?hn:zn[Ct]={})[Xn]=(It=(Pn=rf.subscriptionOptions)!=null?Pn:iu[Xn])!=null?It:{},!0}return!1}(Ve.currentSubscriptions,et);if(Vt){Ee||(hs(function(){var zn=JSON.parse(JSON.stringify(Ve.currentSubscriptions)),An=(0,Da.produceWithPatches)(ue,function(){return zn});Qe.next(qe.internalActions.subscriptionsUpdated(An[1])),ue=zn,Ee=!1}),Ee=!0);var or=!!((Tt=et.type)!=null&&Tt.startsWith(xe)),pr=dt.rejected.match(et)&&et.meta.condition&&!!et.meta.arg.subscribe;return[!or&&!pr,!1]}return[!0,!1]}}(gn),Ue=function(Te){var qe=Te.reducerPath,dt=Te.context,Ve=Te.refetchQuery,xe=Te.internalState,ue=Te.api.internalActions.removeQueryResult;function Ee(fe,ge){var we=fe.getState()[qe],et=we.queries,Qe=xe.currentSubscriptions;dt.batch(function(){for(var Ae=0,Tt=Object.keys(Qe);Ae{let n=[],r={get(){return r.lc||r.listen(()=>{})(),r.value},l:t||0,lc:0,listen(i,o){return r.lc=n.push(i,o||r.l)/2,()=>{let a=n.indexOf(i);~a&&(n.splice(a,2),r.lc--,r.lc||r.off())}},notify(i){let o=!Yi.length;for(let a=0;a(e.events=e.events||{},e.events[n+pv]||(e.events[n+pv]=r(i=>{e.events[n].reduceRight((o,a)=>(a(o),o),{shared:{},...i})})),e.events[n]=e.events[n]||[],e.events[n].push(t),()=>{let i=e.events[n],o=i.indexOf(t);i.splice(o,1),i.length||(delete e.events[n],e.events[n+pv](),delete e.events[n+pv])}),ble=1e3,_le=(e,t)=>vle(e,r=>{let i=t(r);i&&e.events[hv].push(i)},yle,r=>{let i=e.listen;e.listen=(...a)=>(!e.lc&&!e.active&&(e.active=!0,r()),i(...a));let o=e.off;return e.events[hv]=[],e.off=()=>{o(),setTimeout(()=>{if(e.active&&!e.lc){e.active=!1;for(let a of e.events[hv])a();e.events[hv]=[]}},ble)},()=>{e.listen=i,e.off=o}}),Sle=(e,t)=>{Array.isArray(e)||(e=[e]);let n,r=()=>{let o=e.map(a=>a.get());(n===void 0||o.some((a,s)=>a!==n[s]))&&(n=o,i.set(t(...o)))},i=tl(void 0,Math.max(...e.map(o=>o.l))+1);return _le(i,()=>{let o=e.map(a=>a.listen(r,i.l));return r(),()=>{for(let a of o)a()}}),i};const PB=tl(),xle={type:"logger",log(e){this.output("log",e)},warn(e){this.output("warn",e)},error(e){this.output("error",e)},output(e,t){console&&console[e]&&console[e].apply(console,t)}};class t_{constructor(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.init(t,n)}init(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.prefix=n.prefix||"i18next:",this.logger=t||xle,this.options=n,this.debug=n.debug}log(){for(var t=arguments.length,n=new Array(t),r=0;r{this.observers[r]=this.observers[r]||[],this.observers[r].push(n)}),this}off(t,n){if(this.observers[t]){if(!n){delete this.observers[t];return}this.observers[t]=this.observers[t].filter(r=>r!==n)}}emit(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i{a(...r)}),this.observers["*"]&&[].concat(this.observers["*"]).forEach(a=>{a.apply(a,[t,...r])})}}function Vp(){let e,t;const n=new Promise((r,i)=>{e=r,t=i});return n.resolve=e,n.reject=t,n}function tI(e){return e==null?"":""+e}function wle(e,t,n){e.forEach(r=>{t[r]&&(n[r]=t[r])})}function mT(e,t,n){function r(a){return a&&a.indexOf("###")>-1?a.replace(/###/g,"."):a}function i(){return!e||typeof e=="string"}const o=typeof t!="string"?[].concat(t):t.split(".");for(;o.length>1;){if(i())return{};const a=r(o.shift());!e[a]&&n&&(e[a]=new n),Object.prototype.hasOwnProperty.call(e,a)?e=e[a]:e={}}return i()?{}:{obj:e,k:r(o.shift())}}function nI(e,t,n){const{obj:r,k:i}=mT(e,t,Object);r[i]=n}function Cle(e,t,n,r){const{obj:i,k:o}=mT(e,t,Object);i[o]=i[o]||[],r&&(i[o]=i[o].concat(n)),r||i[o].push(n)}function n_(e,t){const{obj:n,k:r}=mT(e,t);if(n)return n[r]}function Ele(e,t,n){const r=n_(e,n);return r!==void 0?r:n_(t,n)}function IB(e,t,n){for(const r in t)r!=="__proto__"&&r!=="constructor"&&(r in e?typeof e[r]=="string"||e[r]instanceof String||typeof t[r]=="string"||t[r]instanceof String?n&&(e[r]=t[r]):IB(e[r],t[r],n):e[r]=t[r]);return e}function sf(e){return e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}var kle={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};function Tle(e){return typeof e=="string"?e.replace(/[&<>"'\/]/g,t=>kle[t]):e}const Ale=[" ",",","?","!",";"];function Ple(e,t,n){t=t||"",n=n||"";const r=Ale.filter(a=>t.indexOf(a)<0&&n.indexOf(a)<0);if(r.length===0)return!0;const i=new RegExp(`(${r.map(a=>a==="?"?"\\?":a).join("|")})`);let o=!i.test(e);if(!o){const a=e.indexOf(n);a>0&&!i.test(e.substring(0,a))&&(o=!0)}return o}function r_(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:".";if(!e)return;if(e[t])return e[t];const r=t.split(n);let i=e;for(let o=0;oo+a;)a++,s=r.slice(o,o+a).join(n),l=i[s];if(l===void 0)return;if(l===null)return null;if(t.endsWith(s)){if(typeof l=="string")return l;if(s&&typeof l[s]=="string")return l[s]}const u=r.slice(o+a).join(n);return u?r_(l,u,n):void 0}i=i[r[o]]}return i}function i_(e){return e&&e.indexOf("_")>0?e.replace("_","-"):e}class rI extends YS{constructor(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{ns:["translation"],defaultNS:"translation"};super(),this.data=t||{},this.options=n,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.options.ignoreJSONStructure===void 0&&(this.options.ignoreJSONStructure=!0)}addNamespaces(t){this.options.ns.indexOf(t)<0&&this.options.ns.push(t)}removeNamespaces(t){const n=this.options.ns.indexOf(t);n>-1&&this.options.ns.splice(n,1)}getResource(t,n,r){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};const o=i.keySeparator!==void 0?i.keySeparator:this.options.keySeparator,a=i.ignoreJSONStructure!==void 0?i.ignoreJSONStructure:this.options.ignoreJSONStructure;let s=[t,n];r&&typeof r!="string"&&(s=s.concat(r)),r&&typeof r=="string"&&(s=s.concat(o?r.split(o):r)),t.indexOf(".")>-1&&(s=t.split("."));const l=n_(this.data,s);return l||!a||typeof r!="string"?l:r_(this.data&&this.data[t]&&this.data[t][n],r,o)}addResource(t,n,r,i){let o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{silent:!1};const a=o.keySeparator!==void 0?o.keySeparator:this.options.keySeparator;let s=[t,n];r&&(s=s.concat(a?r.split(a):r)),t.indexOf(".")>-1&&(s=t.split("."),i=n,n=s[1]),this.addNamespaces(n),nI(this.data,s,i),o.silent||this.emit("added",t,n,r,i)}addResources(t,n,r){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{silent:!1};for(const o in r)(typeof r[o]=="string"||Object.prototype.toString.apply(r[o])==="[object Array]")&&this.addResource(t,n,o,r[o],{silent:!0});i.silent||this.emit("added",t,n,r)}addResourceBundle(t,n,r,i,o){let a=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{silent:!1},s=[t,n];t.indexOf(".")>-1&&(s=t.split("."),i=r,r=n,n=s[1]),this.addNamespaces(n);let l=n_(this.data,s)||{};i?IB(l,r,o):l={...l,...r},nI(this.data,s,l),a.silent||this.emit("added",t,n,r)}removeResourceBundle(t,n){this.hasResourceBundle(t,n)&&delete this.data[t][n],this.removeNamespaces(n),this.emit("removed",t,n)}hasResourceBundle(t,n){return this.getResource(t,n)!==void 0}getResourceBundle(t,n){return n||(n=this.options.defaultNS),this.options.compatibilityAPI==="v1"?{...this.getResource(t,n)}:this.getResource(t,n)}getDataByLanguage(t){return this.data[t]}hasLanguageSomeTranslations(t){const n=this.getDataByLanguage(t);return!!(n&&Object.keys(n)||[]).find(i=>n[i]&&Object.keys(n[i]).length>0)}toJSON(){return this.data}}var RB={processors:{},addPostProcessor(e){this.processors[e.name]=e},handle(e,t,n,r,i){return e.forEach(o=>{this.processors[o]&&(t=this.processors[o].process(t,n,r,i))}),t}};const iI={};class o_ extends YS{constructor(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(),wle(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],t,this),this.options=n,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=Ms.create("translator")}changeLanguage(t){t&&(this.language=t)}exists(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}};if(t==null)return!1;const r=this.resolve(t,n);return r&&r.res!==void 0}extractFromKey(t,n){let r=n.nsSeparator!==void 0?n.nsSeparator:this.options.nsSeparator;r===void 0&&(r=":");const i=n.keySeparator!==void 0?n.keySeparator:this.options.keySeparator;let o=n.ns||this.options.defaultNS||[];const a=r&&t.indexOf(r)>-1,s=!this.options.userDefinedKeySeparator&&!n.keySeparator&&!this.options.userDefinedNsSeparator&&!n.nsSeparator&&!Ple(t,r,i);if(a&&!s){const l=t.match(this.interpolator.nestingRegexp);if(l&&l.length>0)return{key:t,namespaces:o};const u=t.split(r);(r!==i||r===i&&this.options.ns.indexOf(u[0])>-1)&&(o=u.shift()),t=u.join(i)}return typeof o=="string"&&(o=[o]),{key:t,namespaces:o}}translate(t,n,r){if(typeof n!="object"&&this.options.overloadTranslationOptionHandler&&(n=this.options.overloadTranslationOptionHandler(arguments)),typeof n=="object"&&(n={...n}),n||(n={}),t==null)return"";Array.isArray(t)||(t=[String(t)]);const i=n.returnDetails!==void 0?n.returnDetails:this.options.returnDetails,o=n.keySeparator!==void 0?n.keySeparator:this.options.keySeparator,{key:a,namespaces:s}=this.extractFromKey(t[t.length-1],n),l=s[s.length-1],u=n.lng||this.language,c=n.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(u&&u.toLowerCase()==="cimode"){if(c){const y=n.nsSeparator||this.options.nsSeparator;return i?{res:`${l}${y}${a}`,usedKey:a,exactUsedKey:a,usedLng:u,usedNS:l}:`${l}${y}${a}`}return i?{res:a,usedKey:a,exactUsedKey:a,usedLng:u,usedNS:l}:a}const d=this.resolve(t,n);let f=d&&d.res;const h=d&&d.usedKey||a,p=d&&d.exactUsedKey||a,m=Object.prototype.toString.apply(f),_=["[object Number]","[object Function]","[object RegExp]"],b=n.joinArrays!==void 0?n.joinArrays:this.options.joinArrays,v=!this.i18nFormat||this.i18nFormat.handleAsObject;if(v&&f&&(typeof f!="string"&&typeof f!="boolean"&&typeof f!="number")&&_.indexOf(m)<0&&!(typeof b=="string"&&m==="[object Array]")){if(!n.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const y=this.options.returnedObjectHandler?this.options.returnedObjectHandler(h,f,{...n,ns:s}):`key '${a} (${this.language})' returned an object instead of string.`;return i?(d.res=y,d):y}if(o){const y=m==="[object Array]",S=y?[]:{},w=y?p:h;for(const x in f)if(Object.prototype.hasOwnProperty.call(f,x)){const C=`${w}${o}${x}`;S[x]=this.translate(C,{...n,joinArrays:!1,ns:s}),S[x]===C&&(S[x]=f[x])}f=S}}else if(v&&typeof b=="string"&&m==="[object Array]")f=f.join(b),f&&(f=this.extendTranslation(f,t,n,r));else{let y=!1,S=!1;const w=n.count!==void 0&&typeof n.count!="string",x=o_.hasDefaultValue(n),C=w?this.pluralResolver.getSuffix(u,n.count,n):"",T=n.ordinal&&w?this.pluralResolver.getSuffix(u,n.count,{ordinal:!1}):"",k=n[`defaultValue${C}`]||n[`defaultValue${T}`]||n.defaultValue;!this.isValidLookup(f)&&x&&(y=!0,f=k),this.isValidLookup(f)||(S=!0,f=a);const $=(n.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&S?void 0:f,O=x&&k!==f&&this.options.updateMissing;if(S||y||O){if(this.logger.log(O?"updateKey":"missingKey",u,l,a,O?k:f),o){const L=this.resolve(a,{...n,keySeparator:!1});L&&L.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}let E=[];const A=this.languageUtils.getFallbackCodes(this.options.fallbackLng,n.lng||this.language);if(this.options.saveMissingTo==="fallback"&&A&&A[0])for(let L=0;L{const N=x&&R!==f?R:$;this.options.missingKeyHandler?this.options.missingKeyHandler(L,l,M,N,O,n):this.backendConnector&&this.backendConnector.saveMissing&&this.backendConnector.saveMissing(L,l,M,N,O,n),this.emit("missingKey",L,l,M,f)};this.options.saveMissing&&(this.options.saveMissingPlurals&&w?E.forEach(L=>{this.pluralResolver.getSuffixes(L,n).forEach(M=>{D([L],a+M,n[`defaultValue${M}`]||k)})}):D(E,a,k))}f=this.extendTranslation(f,t,n,d,r),S&&f===a&&this.options.appendNamespaceToMissingKey&&(f=`${l}:${a}`),(S||y)&&this.options.parseMissingKeyHandler&&(this.options.compatibilityAPI!=="v1"?f=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${l}:${a}`:a,y?f:void 0):f=this.options.parseMissingKeyHandler(f))}return i?(d.res=f,d):f}extendTranslation(t,n,r,i,o){var a=this;if(this.i18nFormat&&this.i18nFormat.parse)t=this.i18nFormat.parse(t,{...this.options.interpolation.defaultVariables,...r},i.usedLng,i.usedNS,i.usedKey,{resolved:i});else if(!r.skipInterpolation){r.interpolation&&this.interpolator.init({...r,interpolation:{...this.options.interpolation,...r.interpolation}});const u=typeof t=="string"&&(r&&r.interpolation&&r.interpolation.skipOnVariables!==void 0?r.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let c;if(u){const f=t.match(this.interpolator.nestingRegexp);c=f&&f.length}let d=r.replace&&typeof r.replace!="string"?r.replace:r;if(this.options.interpolation.defaultVariables&&(d={...this.options.interpolation.defaultVariables,...d}),t=this.interpolator.interpolate(t,d,r.lng||this.language,r),u){const f=t.match(this.interpolator.nestingRegexp),h=f&&f.length;c1&&arguments[1]!==void 0?arguments[1]:{},r,i,o,a,s;return typeof t=="string"&&(t=[t]),t.forEach(l=>{if(this.isValidLookup(r))return;const u=this.extractFromKey(l,n),c=u.key;i=c;let d=u.namespaces;this.options.fallbackNS&&(d=d.concat(this.options.fallbackNS));const f=n.count!==void 0&&typeof n.count!="string",h=f&&!n.ordinal&&n.count===0&&this.pluralResolver.shouldUseIntlApi(),p=n.context!==void 0&&(typeof n.context=="string"||typeof n.context=="number")&&n.context!=="",m=n.lngs?n.lngs:this.languageUtils.toResolveHierarchy(n.lng||this.language,n.fallbackLng);d.forEach(_=>{this.isValidLookup(r)||(s=_,!iI[`${m[0]}-${_}`]&&this.utils&&this.utils.hasLoadedNamespace&&!this.utils.hasLoadedNamespace(s)&&(iI[`${m[0]}-${_}`]=!0,this.logger.warn(`key "${i}" for languages "${m.join(", ")}" won't get resolved as namespace "${s}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),m.forEach(b=>{if(this.isValidLookup(r))return;a=b;const v=[c];if(this.i18nFormat&&this.i18nFormat.addLookupKeys)this.i18nFormat.addLookupKeys(v,c,b,_,n);else{let y;f&&(y=this.pluralResolver.getSuffix(b,n.count,n));const S=`${this.options.pluralSeparator}zero`,w=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(f&&(v.push(c+y),n.ordinal&&y.indexOf(w)===0&&v.push(c+y.replace(w,this.options.pluralSeparator)),h&&v.push(c+S)),p){const x=`${c}${this.options.contextSeparator}${n.context}`;v.push(x),f&&(v.push(x+y),n.ordinal&&y.indexOf(w)===0&&v.push(x+y.replace(w,this.options.pluralSeparator)),h&&v.push(x+S))}}let g;for(;g=v.pop();)this.isValidLookup(r)||(o=g,r=this.getResource(b,_,g,n))}))})}),{res:r,usedKey:i,exactUsedKey:o,usedLng:a,usedNS:s}}isValidLookup(t){return t!==void 0&&!(!this.options.returnNull&&t===null)&&!(!this.options.returnEmptyString&&t==="")}getResource(t,n,r){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};return this.i18nFormat&&this.i18nFormat.getResource?this.i18nFormat.getResource(t,n,r,i):this.resourceStore.getResource(t,n,r,i)}static hasDefaultValue(t){const n="defaultValue";for(const r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&n===r.substring(0,n.length)&&t[r]!==void 0)return!0;return!1}}function iC(e){return e.charAt(0).toUpperCase()+e.slice(1)}class oI{constructor(t){this.options=t,this.supportedLngs=this.options.supportedLngs||!1,this.logger=Ms.create("languageUtils")}getScriptPartFromCode(t){if(t=i_(t),!t||t.indexOf("-")<0)return null;const n=t.split("-");return n.length===2||(n.pop(),n[n.length-1].toLowerCase()==="x")?null:this.formatLanguageCode(n.join("-"))}getLanguagePartFromCode(t){if(t=i_(t),!t||t.indexOf("-")<0)return t;const n=t.split("-");return this.formatLanguageCode(n[0])}formatLanguageCode(t){if(typeof t=="string"&&t.indexOf("-")>-1){const n=["hans","hant","latn","cyrl","cans","mong","arab"];let r=t.split("-");return this.options.lowerCaseLng?r=r.map(i=>i.toLowerCase()):r.length===2?(r[0]=r[0].toLowerCase(),r[1]=r[1].toUpperCase(),n.indexOf(r[1].toLowerCase())>-1&&(r[1]=iC(r[1].toLowerCase()))):r.length===3&&(r[0]=r[0].toLowerCase(),r[1].length===2&&(r[1]=r[1].toUpperCase()),r[0]!=="sgn"&&r[2].length===2&&(r[2]=r[2].toUpperCase()),n.indexOf(r[1].toLowerCase())>-1&&(r[1]=iC(r[1].toLowerCase())),n.indexOf(r[2].toLowerCase())>-1&&(r[2]=iC(r[2].toLowerCase()))),r.join("-")}return this.options.cleanCode||this.options.lowerCaseLng?t.toLowerCase():t}isSupportedCode(t){return(this.options.load==="languageOnly"||this.options.nonExplicitSupportedLngs)&&(t=this.getLanguagePartFromCode(t)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(t)>-1}getBestMatchFromCodes(t){if(!t)return null;let n;return t.forEach(r=>{if(n)return;const i=this.formatLanguageCode(r);(!this.options.supportedLngs||this.isSupportedCode(i))&&(n=i)}),!n&&this.options.supportedLngs&&t.forEach(r=>{if(n)return;const i=this.getLanguagePartFromCode(r);if(this.isSupportedCode(i))return n=i;n=this.options.supportedLngs.find(o=>{if(o===i)return o;if(!(o.indexOf("-")<0&&i.indexOf("-")<0)&&o.indexOf(i)===0)return o})}),n||(n=this.getFallbackCodes(this.options.fallbackLng)[0]),n}getFallbackCodes(t,n){if(!t)return[];if(typeof t=="function"&&(t=t(n)),typeof t=="string"&&(t=[t]),Object.prototype.toString.apply(t)==="[object Array]")return t;if(!n)return t.default||[];let r=t[n];return r||(r=t[this.getScriptPartFromCode(n)]),r||(r=t[this.formatLanguageCode(n)]),r||(r=t[this.getLanguagePartFromCode(n)]),r||(r=t.default),r||[]}toResolveHierarchy(t,n){const r=this.getFallbackCodes(n||this.options.fallbackLng||[],t),i=[],o=a=>{a&&(this.isSupportedCode(a)?i.push(a):this.logger.warn(`rejecting language code not found in supportedLngs: ${a}`))};return typeof t=="string"&&(t.indexOf("-")>-1||t.indexOf("_")>-1)?(this.options.load!=="languageOnly"&&o(this.formatLanguageCode(t)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&o(this.getScriptPartFromCode(t)),this.options.load!=="currentOnly"&&o(this.getLanguagePartFromCode(t))):typeof t=="string"&&o(this.formatLanguageCode(t)),r.forEach(a=>{i.indexOf(a)<0&&o(this.formatLanguageCode(a))}),i}}let Ile=[{lngs:["ach","ak","am","arn","br","fil","gun","ln","mfe","mg","mi","oc","pt","pt-BR","tg","tl","ti","tr","uz","wa"],nr:[1,2],fc:1},{lngs:["af","an","ast","az","bg","bn","ca","da","de","dev","el","en","eo","es","et","eu","fi","fo","fur","fy","gl","gu","ha","hi","hu","hy","ia","it","kk","kn","ku","lb","mai","ml","mn","mr","nah","nap","nb","ne","nl","nn","no","nso","pa","pap","pms","ps","pt-PT","rm","sco","se","si","so","son","sq","sv","sw","ta","te","tk","ur","yo"],nr:[1,2],fc:2},{lngs:["ay","bo","cgg","fa","ht","id","ja","jbo","ka","km","ko","ky","lo","ms","sah","su","th","tt","ug","vi","wo","zh"],nr:[1],fc:3},{lngs:["be","bs","cnr","dz","hr","ru","sr","uk"],nr:[1,2,5],fc:4},{lngs:["ar"],nr:[0,1,2,3,11,100],fc:5},{lngs:["cs","sk"],nr:[1,2,5],fc:6},{lngs:["csb","pl"],nr:[1,2,5],fc:7},{lngs:["cy"],nr:[1,2,3,8],fc:8},{lngs:["fr"],nr:[1,2],fc:9},{lngs:["ga"],nr:[1,2,3,7,11],fc:10},{lngs:["gd"],nr:[1,2,3,20],fc:11},{lngs:["is"],nr:[1,2],fc:12},{lngs:["jv"],nr:[0,1],fc:13},{lngs:["kw"],nr:[1,2,3,4],fc:14},{lngs:["lt"],nr:[1,2,10],fc:15},{lngs:["lv"],nr:[1,2,0],fc:16},{lngs:["mk"],nr:[1,2],fc:17},{lngs:["mnk"],nr:[0,1,2],fc:18},{lngs:["mt"],nr:[1,2,11,20],fc:19},{lngs:["or"],nr:[2,1],fc:2},{lngs:["ro"],nr:[1,2,20],fc:20},{lngs:["sl"],nr:[5,1,2,3],fc:21},{lngs:["he","iw"],nr:[1,2,20,21],fc:22}],Rle={1:function(e){return+(e>1)},2:function(e){return+(e!=1)},3:function(e){return 0},4:function(e){return e%10==1&&e%100!=11?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2},5:function(e){return e==0?0:e==1?1:e==2?2:e%100>=3&&e%100<=10?3:e%100>=11?4:5},6:function(e){return e==1?0:e>=2&&e<=4?1:2},7:function(e){return e==1?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2},8:function(e){return e==1?0:e==2?1:e!=8&&e!=11?2:3},9:function(e){return+(e>=2)},10:function(e){return e==1?0:e==2?1:e<7?2:e<11?3:4},11:function(e){return e==1||e==11?0:e==2||e==12?1:e>2&&e<20?2:3},12:function(e){return+(e%10!=1||e%100==11)},13:function(e){return+(e!==0)},14:function(e){return e==1?0:e==2?1:e==3?2:3},15:function(e){return e%10==1&&e%100!=11?0:e%10>=2&&(e%100<10||e%100>=20)?1:2},16:function(e){return e%10==1&&e%100!=11?0:e!==0?1:2},17:function(e){return e==1||e%10==1&&e%100!=11?0:1},18:function(e){return e==0?0:e==1?1:2},19:function(e){return e==1?0:e==0||e%100>1&&e%100<11?1:e%100>10&&e%100<20?2:3},20:function(e){return e==1?0:e==0||e%100>0&&e%100<20?1:2},21:function(e){return e%100==1?1:e%100==2?2:e%100==3||e%100==4?3:0},22:function(e){return e==1?0:e==2?1:(e<0||e>10)&&e%10==0?2:3}};const Ole=["v1","v2","v3"],Mle=["v4"],aI={zero:0,one:1,two:2,few:3,many:4,other:5};function Nle(){const e={};return Ile.forEach(t=>{t.lngs.forEach(n=>{e[n]={numbers:t.nr,plurals:Rle[t.fc]}})}),e}class $le{constructor(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.languageUtils=t,this.options=n,this.logger=Ms.create("pluralResolver"),(!this.options.compatibilityJSON||Mle.includes(this.options.compatibilityJSON))&&(typeof Intl>"u"||!Intl.PluralRules)&&(this.options.compatibilityJSON="v3",this.logger.error("Your environment seems not to be Intl API compatible, use an Intl.PluralRules polyfill. Will fallback to the compatibilityJSON v3 format handling.")),this.rules=Nle()}addRule(t,n){this.rules[t]=n}getRule(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(this.shouldUseIntlApi())try{return new Intl.PluralRules(i_(t),{type:n.ordinal?"ordinal":"cardinal"})}catch{return}return this.rules[t]||this.rules[this.languageUtils.getLanguagePartFromCode(t)]}needsPlural(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const r=this.getRule(t,n);return this.shouldUseIntlApi()?r&&r.resolvedOptions().pluralCategories.length>1:r&&r.numbers.length>1}getPluralFormsOfKey(t,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return this.getSuffixes(t,r).map(i=>`${n}${i}`)}getSuffixes(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const r=this.getRule(t,n);return r?this.shouldUseIntlApi()?r.resolvedOptions().pluralCategories.sort((i,o)=>aI[i]-aI[o]).map(i=>`${this.options.prepend}${n.ordinal?`ordinal${this.options.prepend}`:""}${i}`):r.numbers.map(i=>this.getSuffix(t,i,n)):[]}getSuffix(t,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const i=this.getRule(t,r);return i?this.shouldUseIntlApi()?`${this.options.prepend}${r.ordinal?`ordinal${this.options.prepend}`:""}${i.select(n)}`:this.getSuffixRetroCompatible(i,n):(this.logger.warn(`no plural rule found for: ${t}`),"")}getSuffixRetroCompatible(t,n){const r=t.noAbs?t.plurals(n):t.plurals(Math.abs(n));let i=t.numbers[r];this.options.simplifyPluralSuffix&&t.numbers.length===2&&t.numbers[0]===1&&(i===2?i="plural":i===1&&(i=""));const o=()=>this.options.prepend&&i.toString()?this.options.prepend+i.toString():i.toString();return this.options.compatibilityJSON==="v1"?i===1?"":typeof i=="number"?`_plural_${i.toString()}`:o():this.options.compatibilityJSON==="v2"||this.options.simplifyPluralSuffix&&t.numbers.length===2&&t.numbers[0]===1?o():this.options.prepend&&r.toString()?this.options.prepend+r.toString():r.toString()}shouldUseIntlApi(){return!Ole.includes(this.options.compatibilityJSON)}}function sI(e,t,n){let r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:".",i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,o=Ele(e,t,n);return!o&&i&&typeof n=="string"&&(o=r_(e,n,r),o===void 0&&(o=r_(t,n,r))),o}class Dle{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=Ms.create("interpolator"),this.options=t,this.format=t.interpolation&&t.interpolation.format||(n=>n),this.init(t)}init(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};t.interpolation||(t.interpolation={escapeValue:!0});const n=t.interpolation;this.escape=n.escape!==void 0?n.escape:Tle,this.escapeValue=n.escapeValue!==void 0?n.escapeValue:!0,this.useRawValueToEscape=n.useRawValueToEscape!==void 0?n.useRawValueToEscape:!1,this.prefix=n.prefix?sf(n.prefix):n.prefixEscaped||"{{",this.suffix=n.suffix?sf(n.suffix):n.suffixEscaped||"}}",this.formatSeparator=n.formatSeparator?n.formatSeparator:n.formatSeparator||",",this.unescapePrefix=n.unescapeSuffix?"":n.unescapePrefix||"-",this.unescapeSuffix=this.unescapePrefix?"":n.unescapeSuffix||"",this.nestingPrefix=n.nestingPrefix?sf(n.nestingPrefix):n.nestingPrefixEscaped||sf("$t("),this.nestingSuffix=n.nestingSuffix?sf(n.nestingSuffix):n.nestingSuffixEscaped||sf(")"),this.nestingOptionsSeparator=n.nestingOptionsSeparator?n.nestingOptionsSeparator:n.nestingOptionsSeparator||",",this.maxReplaces=n.maxReplaces?n.maxReplaces:1e3,this.alwaysFormat=n.alwaysFormat!==void 0?n.alwaysFormat:!1,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){const t=`${this.prefix}(.+?)${this.suffix}`;this.regexp=new RegExp(t,"g");const n=`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`;this.regexpUnescape=new RegExp(n,"g");const r=`${this.nestingPrefix}(.+?)${this.nestingSuffix}`;this.nestingRegexp=new RegExp(r,"g")}interpolate(t,n,r,i){let o,a,s;const l=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{};function u(p){return p.replace(/\$/g,"$$$$")}const c=p=>{if(p.indexOf(this.formatSeparator)<0){const v=sI(n,l,p,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(v,void 0,r,{...i,...n,interpolationkey:p}):v}const m=p.split(this.formatSeparator),_=m.shift().trim(),b=m.join(this.formatSeparator).trim();return this.format(sI(n,l,_,this.options.keySeparator,this.options.ignoreJSONStructure),b,r,{...i,...n,interpolationkey:_})};this.resetRegExp();const d=i&&i.missingInterpolationHandler||this.options.missingInterpolationHandler,f=i&&i.interpolation&&i.interpolation.skipOnVariables!==void 0?i.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:p=>u(p)},{regex:this.regexp,safeValue:p=>this.escapeValue?u(this.escape(p)):u(p)}].forEach(p=>{for(s=0;o=p.regex.exec(t);){const m=o[1].trim();if(a=c(m),a===void 0)if(typeof d=="function"){const b=d(t,o,i);a=typeof b=="string"?b:""}else if(i&&Object.prototype.hasOwnProperty.call(i,m))a="";else if(f){a=o[0];continue}else this.logger.warn(`missed to pass in variable ${m} for interpolating ${t}`),a="";else typeof a!="string"&&!this.useRawValueToEscape&&(a=tI(a));const _=p.safeValue(a);if(t=t.replace(o[0],_),f?(p.regex.lastIndex+=a.length,p.regex.lastIndex-=o[0].length):p.regex.lastIndex=0,s++,s>=this.maxReplaces)break}}),t}nest(t,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},i,o,a;function s(l,u){const c=this.nestingOptionsSeparator;if(l.indexOf(c)<0)return l;const d=l.split(new RegExp(`${c}[ ]*{`));let f=`{${d[1]}`;l=d[0],f=this.interpolate(f,a);const h=f.match(/'/g),p=f.match(/"/g);(h&&h.length%2===0&&!p||p.length%2!==0)&&(f=f.replace(/'/g,'"'));try{a=JSON.parse(f),u&&(a={...u,...a})}catch(m){return this.logger.warn(`failed parsing options string in nesting for key ${l}`,m),`${l}${c}${f}`}return delete a.defaultValue,l}for(;i=this.nestingRegexp.exec(t);){let l=[];a={...r},a=a.replace&&typeof a.replace!="string"?a.replace:a,a.applyPostProcessor=!1,delete a.defaultValue;let u=!1;if(i[0].indexOf(this.formatSeparator)!==-1&&!/{.*}/.test(i[1])){const c=i[1].split(this.formatSeparator).map(d=>d.trim());i[1]=c.shift(),l=c,u=!0}if(o=n(s.call(this,i[1].trim(),a),a),o&&i[0]===t&&typeof o!="string")return o;typeof o!="string"&&(o=tI(o)),o||(this.logger.warn(`missed to resolve ${i[1]} for nesting ${t}`),o=""),u&&(o=l.reduce((c,d)=>this.format(c,d,r.lng,{...r,interpolationkey:i[1].trim()}),o.trim())),t=t.replace(i[0],o),this.regexp.lastIndex=0}return t}}function Lle(e){let t=e.toLowerCase().trim();const n={};if(e.indexOf("(")>-1){const r=e.split("(");t=r[0].toLowerCase().trim();const i=r[1].substring(0,r[1].length-1);t==="currency"&&i.indexOf(":")<0?n.currency||(n.currency=i.trim()):t==="relativetime"&&i.indexOf(":")<0?n.range||(n.range=i.trim()):i.split(";").forEach(a=>{if(!a)return;const[s,...l]=a.split(":"),u=l.join(":").trim().replace(/^'+|'+$/g,"");n[s.trim()]||(n[s.trim()]=u),u==="false"&&(n[s.trim()]=!1),u==="true"&&(n[s.trim()]=!0),isNaN(u)||(n[s.trim()]=parseInt(u,10))})}return{formatName:t,formatOptions:n}}function lf(e){const t={};return function(r,i,o){const a=i+JSON.stringify(o);let s=t[a];return s||(s=e(i_(i),o),t[a]=s),s(r)}}class Fle{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=Ms.create("formatter"),this.options=t,this.formats={number:lf((n,r)=>{const i=new Intl.NumberFormat(n,{...r});return o=>i.format(o)}),currency:lf((n,r)=>{const i=new Intl.NumberFormat(n,{...r,style:"currency"});return o=>i.format(o)}),datetime:lf((n,r)=>{const i=new Intl.DateTimeFormat(n,{...r});return o=>i.format(o)}),relativetime:lf((n,r)=>{const i=new Intl.RelativeTimeFormat(n,{...r});return o=>i.format(o,r.range||"day")}),list:lf((n,r)=>{const i=new Intl.ListFormat(n,{...r});return o=>i.format(o)})},this.init(t)}init(t){const r=(arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}}).interpolation;this.formatSeparator=r.formatSeparator?r.formatSeparator:r.formatSeparator||","}add(t,n){this.formats[t.toLowerCase().trim()]=n}addCached(t,n){this.formats[t.toLowerCase().trim()]=lf(n)}format(t,n,r){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};return n.split(this.formatSeparator).reduce((s,l)=>{const{formatName:u,formatOptions:c}=Lle(l);if(this.formats[u]){let d=s;try{const f=i&&i.formatParams&&i.formatParams[i.interpolationkey]||{},h=f.locale||f.lng||i.locale||i.lng||r;d=this.formats[u](s,h,{...c,...i,...f})}catch(f){this.logger.warn(f)}return d}else this.logger.warn(`there was no format function for ${u}`);return s},t)}}function Ble(e,t){e.pending[t]!==void 0&&(delete e.pending[t],e.pendingCount--)}class zle extends YS{constructor(t,n,r){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};super(),this.backend=t,this.store=n,this.services=r,this.languageUtils=r.languageUtils,this.options=i,this.logger=Ms.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=i.maxParallelReads||10,this.readingCalls=0,this.maxRetries=i.maxRetries>=0?i.maxRetries:5,this.retryTimeout=i.retryTimeout>=1?i.retryTimeout:350,this.state={},this.queue=[],this.backend&&this.backend.init&&this.backend.init(r,i.backend,i)}queueLoad(t,n,r,i){const o={},a={},s={},l={};return t.forEach(u=>{let c=!0;n.forEach(d=>{const f=`${u}|${d}`;!r.reload&&this.store.hasResourceBundle(u,d)?this.state[f]=2:this.state[f]<0||(this.state[f]===1?a[f]===void 0&&(a[f]=!0):(this.state[f]=1,c=!1,a[f]===void 0&&(a[f]=!0),o[f]===void 0&&(o[f]=!0),l[d]===void 0&&(l[d]=!0)))}),c||(s[u]=!0)}),(Object.keys(o).length||Object.keys(a).length)&&this.queue.push({pending:a,pendingCount:Object.keys(a).length,loaded:{},errors:[],callback:i}),{toLoad:Object.keys(o),pending:Object.keys(a),toLoadLanguages:Object.keys(s),toLoadNamespaces:Object.keys(l)}}loaded(t,n,r){const i=t.split("|"),o=i[0],a=i[1];n&&this.emit("failedLoading",o,a,n),r&&this.store.addResourceBundle(o,a,r),this.state[t]=n?-1:2;const s={};this.queue.forEach(l=>{Cle(l.loaded,[o],a),Ble(l,t),n&&l.errors.push(n),l.pendingCount===0&&!l.done&&(Object.keys(l.loaded).forEach(u=>{s[u]||(s[u]={});const c=l.loaded[u];c.length&&c.forEach(d=>{s[u][d]===void 0&&(s[u][d]=!0)})}),l.done=!0,l.errors.length?l.callback(l.errors):l.callback())}),this.emit("loaded",s),this.queue=this.queue.filter(l=>!l.done)}read(t,n,r){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:this.retryTimeout,a=arguments.length>5?arguments[5]:void 0;if(!t.length)return a(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:t,ns:n,fcName:r,tried:i,wait:o,callback:a});return}this.readingCalls++;const s=(u,c)=>{if(this.readingCalls--,this.waitingReads.length>0){const d=this.waitingReads.shift();this.read(d.lng,d.ns,d.fcName,d.tried,d.wait,d.callback)}if(u&&c&&i{this.read.call(this,t,n,r,i+1,o*2,a)},o);return}a(u,c)},l=this.backend[r].bind(this.backend);if(l.length===2){try{const u=l(t,n);u&&typeof u.then=="function"?u.then(c=>s(null,c)).catch(s):s(null,u)}catch(u){s(u)}return}return l(t,n,s)}prepareLoading(t,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},i=arguments.length>3?arguments[3]:void 0;if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),i&&i();typeof t=="string"&&(t=this.languageUtils.toResolveHierarchy(t)),typeof n=="string"&&(n=[n]);const o=this.queueLoad(t,n,r,i);if(!o.toLoad.length)return o.pending.length||i(),null;o.toLoad.forEach(a=>{this.loadOne(a)})}load(t,n,r){this.prepareLoading(t,n,{},r)}reload(t,n,r){this.prepareLoading(t,n,{reload:!0},r)}loadOne(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";const r=t.split("|"),i=r[0],o=r[1];this.read(i,o,"read",void 0,void 0,(a,s)=>{a&&this.logger.warn(`${n}loading namespace ${o} for language ${i} failed`,a),!a&&s&&this.logger.log(`${n}loaded namespace ${o} for language ${i}`,s),this.loaded(t,a,s)})}saveMissing(t,n,r,i,o){let a=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{},s=arguments.length>6&&arguments[6]!==void 0?arguments[6]:()=>{};if(this.services.utils&&this.services.utils.hasLoadedNamespace&&!this.services.utils.hasLoadedNamespace(n)){this.logger.warn(`did not save key "${r}" as the namespace "${n}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");return}if(!(r==null||r==="")){if(this.backend&&this.backend.create){const l={...a,isUpdate:o},u=this.backend.create.bind(this.backend);if(u.length<6)try{let c;u.length===5?c=u(t,n,r,i,l):c=u(t,n,r,i),c&&typeof c.then=="function"?c.then(d=>s(null,d)).catch(s):s(null,c)}catch(c){s(c)}else u(t,n,r,i,s,l)}!t||!t[0]||this.store.addResource(t[0],n,r,i)}}}function lI(){return{debug:!1,initImmediate:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!1,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:function(t){let n={};if(typeof t[1]=="object"&&(n=t[1]),typeof t[1]=="string"&&(n.defaultValue=t[1]),typeof t[2]=="string"&&(n.tDescription=t[2]),typeof t[2]=="object"||typeof t[3]=="object"){const r=t[3]||t[2];Object.keys(r).forEach(i=>{n[i]=r[i]})}return n},interpolation:{escapeValue:!0,format:(e,t,n,r)=>e,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0}}}function uI(e){return typeof e.ns=="string"&&(e.ns=[e.ns]),typeof e.fallbackLng=="string"&&(e.fallbackLng=[e.fallbackLng]),typeof e.fallbackNS=="string"&&(e.fallbackNS=[e.fallbackNS]),e.supportedLngs&&e.supportedLngs.indexOf("cimode")<0&&(e.supportedLngs=e.supportedLngs.concat(["cimode"])),e}function gv(){}function jle(e){Object.getOwnPropertyNames(Object.getPrototypeOf(e)).forEach(n=>{typeof e[n]=="function"&&(e[n]=e[n].bind(e))})}class Wm extends YS{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;if(super(),this.options=uI(t),this.services={},this.logger=Ms,this.modules={external:[]},jle(this),n&&!this.isInitialized&&!t.isClone){if(!this.options.initImmediate)return this.init(t,n),this;setTimeout(()=>{this.init(t,n)},0)}}init(){var t=this;let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0;typeof n=="function"&&(r=n,n={}),!n.defaultNS&&n.defaultNS!==!1&&n.ns&&(typeof n.ns=="string"?n.defaultNS=n.ns:n.ns.indexOf("translation")<0&&(n.defaultNS=n.ns[0]));const i=lI();this.options={...i,...this.options,...uI(n)},this.options.compatibilityAPI!=="v1"&&(this.options.interpolation={...i.interpolation,...this.options.interpolation}),n.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=n.keySeparator),n.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=n.nsSeparator);function o(c){return c?typeof c=="function"?new c:c:null}if(!this.options.isClone){this.modules.logger?Ms.init(o(this.modules.logger),this.options):Ms.init(null,this.options);let c;this.modules.formatter?c=this.modules.formatter:typeof Intl<"u"&&(c=Fle);const d=new oI(this.options);this.store=new rI(this.options.resources,this.options);const f=this.services;f.logger=Ms,f.resourceStore=this.store,f.languageUtils=d,f.pluralResolver=new $le(d,{prepend:this.options.pluralSeparator,compatibilityJSON:this.options.compatibilityJSON,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),c&&(!this.options.interpolation.format||this.options.interpolation.format===i.interpolation.format)&&(f.formatter=o(c),f.formatter.init(f,this.options),this.options.interpolation.format=f.formatter.format.bind(f.formatter)),f.interpolator=new Dle(this.options),f.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},f.backendConnector=new zle(o(this.modules.backend),f.resourceStore,f,this.options),f.backendConnector.on("*",function(h){for(var p=arguments.length,m=new Array(p>1?p-1:0),_=1;_1?p-1:0),_=1;_{h.init&&h.init(this)})}if(this.format=this.options.interpolation.format,r||(r=gv),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const c=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);c.length>0&&c[0]!=="dev"&&(this.options.lng=c[0])}!this.services.languageDetector&&!this.options.lng&&this.logger.warn("init: no languageDetector is used and no lng is defined"),["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach(c=>{this[c]=function(){return t.store[c](...arguments)}}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(c=>{this[c]=function(){return t.store[c](...arguments),t}});const l=Vp(),u=()=>{const c=(d,f)=>{this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn("init: i18next is already initialized. You should call init just once!"),this.isInitialized=!0,this.options.isClone||this.logger.log("initialized",this.options),this.emit("initialized",this.options),l.resolve(f),r(d,f)};if(this.languages&&this.options.compatibilityAPI!=="v1"&&!this.isInitialized)return c(null,this.t.bind(this));this.changeLanguage(this.options.lng,c)};return this.options.resources||!this.options.initImmediate?u():setTimeout(u,0),l}loadResources(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:gv;const i=typeof t=="string"?t:this.language;if(typeof t=="function"&&(r=t),!this.options.resources||this.options.partialBundledLanguages){if(i&&i.toLowerCase()==="cimode")return r();const o=[],a=s=>{if(!s)return;this.services.languageUtils.toResolveHierarchy(s).forEach(u=>{o.indexOf(u)<0&&o.push(u)})};i?a(i):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(l=>a(l)),this.options.preload&&this.options.preload.forEach(s=>a(s)),this.services.backendConnector.load(o,this.options.ns,s=>{!s&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),r(s)})}else r(null)}reloadResources(t,n,r){const i=Vp();return t||(t=this.languages),n||(n=this.options.ns),r||(r=gv),this.services.backendConnector.reload(t,n,o=>{i.resolve(),r(o)}),i}use(t){if(!t)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!t.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return t.type==="backend"&&(this.modules.backend=t),(t.type==="logger"||t.log&&t.warn&&t.error)&&(this.modules.logger=t),t.type==="languageDetector"&&(this.modules.languageDetector=t),t.type==="i18nFormat"&&(this.modules.i18nFormat=t),t.type==="postProcessor"&&RB.addPostProcessor(t),t.type==="formatter"&&(this.modules.formatter=t),t.type==="3rdParty"&&this.modules.external.push(t),this}setResolvedLanguage(t){if(!(!t||!this.languages)&&!(["cimode","dev"].indexOf(t)>-1))for(let n=0;n-1)&&this.store.hasLanguageSomeTranslations(r)){this.resolvedLanguage=r;break}}}changeLanguage(t,n){var r=this;this.isLanguageChangingTo=t;const i=Vp();this.emit("languageChanging",t);const o=l=>{this.language=l,this.languages=this.services.languageUtils.toResolveHierarchy(l),this.resolvedLanguage=void 0,this.setResolvedLanguage(l)},a=(l,u)=>{u?(o(u),this.translator.changeLanguage(u),this.isLanguageChangingTo=void 0,this.emit("languageChanged",u),this.logger.log("languageChanged",u)):this.isLanguageChangingTo=void 0,i.resolve(function(){return r.t(...arguments)}),n&&n(l,function(){return r.t(...arguments)})},s=l=>{!t&&!l&&this.services.languageDetector&&(l=[]);const u=typeof l=="string"?l:this.services.languageUtils.getBestMatchFromCodes(l);u&&(this.language||o(u),this.translator.language||this.translator.changeLanguage(u),this.services.languageDetector&&this.services.languageDetector.cacheUserLanguage&&this.services.languageDetector.cacheUserLanguage(u)),this.loadResources(u,c=>{a(c,u)})};return!t&&this.services.languageDetector&&!this.services.languageDetector.async?s(this.services.languageDetector.detect()):!t&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(s):this.services.languageDetector.detect(s):s(t),i}getFixedT(t,n,r){var i=this;const o=function(a,s){let l;if(typeof s!="object"){for(var u=arguments.length,c=new Array(u>2?u-2:0),d=2;d`${l.keyPrefix}${f}${p}`):h=l.keyPrefix?`${l.keyPrefix}${f}${a}`:a,i.t(h,l)};return typeof t=="string"?o.lng=t:o.lngs=t,o.ns=n,o.keyPrefix=r,o}t(){return this.translator&&this.translator.translate(...arguments)}exists(){return this.translator&&this.translator.exists(...arguments)}setDefaultNamespace(t){this.options.defaultNS=t}hasLoadedNamespace(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;const r=n.lng||this.resolvedLanguage||this.languages[0],i=this.options?this.options.fallbackLng:!1,o=this.languages[this.languages.length-1];if(r.toLowerCase()==="cimode")return!0;const a=(s,l)=>{const u=this.services.backendConnector.state[`${s}|${l}`];return u===-1||u===2};if(n.precheck){const s=n.precheck(this,a);if(s!==void 0)return s}return!!(this.hasResourceBundle(r,t)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||a(r,t)&&(!i||a(o,t)))}loadNamespaces(t,n){const r=Vp();return this.options.ns?(typeof t=="string"&&(t=[t]),t.forEach(i=>{this.options.ns.indexOf(i)<0&&this.options.ns.push(i)}),this.loadResources(i=>{r.resolve(),n&&n(i)}),r):(n&&n(),Promise.resolve())}loadLanguages(t,n){const r=Vp();typeof t=="string"&&(t=[t]);const i=this.options.preload||[],o=t.filter(a=>i.indexOf(a)<0);return o.length?(this.options.preload=i.concat(o),this.loadResources(a=>{r.resolve(),n&&n(a)}),r):(n&&n(),Promise.resolve())}dir(t){if(t||(t=this.resolvedLanguage||(this.languages&&this.languages.length>0?this.languages[0]:this.language)),!t)return"rtl";const n=["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"],r=this.services&&this.services.languageUtils||new oI(lI());return n.indexOf(r.getLanguagePartFromCode(t))>-1||t.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;return new Wm(t,n)}cloneInstance(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:gv;const r=t.forkResourceStore;r&&delete t.forkResourceStore;const i={...this.options,...t,isClone:!0},o=new Wm(i);return(t.debug!==void 0||t.prefix!==void 0)&&(o.logger=o.logger.clone(t)),["store","services","language"].forEach(s=>{o[s]=this[s]}),o.services={...this.services},o.services.utils={hasLoadedNamespace:o.hasLoadedNamespace.bind(o)},r&&(o.store=new rI(this.store.data,i),o.services.resourceStore=o.store),o.translator=new o_(o.services,i),o.translator.on("*",function(s){for(var l=arguments.length,u=new Array(l>1?l-1:0),c=1;cOB.safeParse(e).success||Ule.safeParse(e).success;z.enum(["connection","direct","any"]);const MB=z.object({id:z.string().trim().min(1),name:z.string().trim().min(1),type:OB}),Vle=MB.extend({fieldKind:z.literal("output")}),vt=MB.extend({fieldKind:z.literal("input"),label:z.string()}),Ud=z.object({model_name:z.string().trim().min(1),base_model:jd}),uy=z.object({image_name:z.string().trim().min(1)}),Gle=z.object({board_id:z.string().trim().min(1)}),a_=z.object({latents_name:z.string().trim().min(1),seed:z.number().int().optional()}),s_=z.object({conditioning_name:z.string().trim().min(1)}),Hle=z.object({mask_name:z.string().trim().min(1),masked_latents_name:z.string().trim().min(1).optional()}),qle=vt.extend({type:z.literal("integer"),value:z.number().int().optional()}),Wle=vt.extend({type:z.literal("IntegerCollection"),value:z.array(z.number().int()).optional()}),Kle=vt.extend({type:z.literal("IntegerPolymorphic"),value:z.number().int().optional()}),Qle=vt.extend({type:z.literal("float"),value:z.number().optional()}),Xle=vt.extend({type:z.literal("FloatCollection"),value:z.array(z.number()).optional()}),Yle=vt.extend({type:z.literal("FloatPolymorphic"),value:z.number().optional()}),Zle=vt.extend({type:z.literal("string"),value:z.string().optional()}),Jle=vt.extend({type:z.literal("StringCollection"),value:z.array(z.string()).optional()}),eue=vt.extend({type:z.literal("StringPolymorphic"),value:z.string().optional()}),tue=vt.extend({type:z.literal("boolean"),value:z.boolean().optional()}),nue=vt.extend({type:z.literal("BooleanCollection"),value:z.array(z.boolean()).optional()}),rue=vt.extend({type:z.literal("BooleanPolymorphic"),value:z.boolean().optional()}),iue=vt.extend({type:z.literal("enum"),value:z.string().optional()}),oue=vt.extend({type:z.literal("LatentsField"),value:a_.optional()}),aue=vt.extend({type:z.literal("LatentsCollection"),value:z.array(a_).optional()}),sue=vt.extend({type:z.literal("LatentsPolymorphic"),value:z.union([a_,z.array(a_)]).optional()}),lue=vt.extend({type:z.literal("DenoiseMaskField"),value:Hle.optional()}),uue=vt.extend({type:z.literal("ConditioningField"),value:s_.optional()}),cue=vt.extend({type:z.literal("ConditioningCollection"),value:z.array(s_).optional()}),due=vt.extend({type:z.literal("ConditioningPolymorphic"),value:z.union([s_,z.array(s_)]).optional()}),fue=Ud,Km=z.object({image:uy,control_model:fue,control_weight:z.union([z.number(),z.array(z.number())]).optional(),begin_step_percent:z.number().optional(),end_step_percent:z.number().optional(),control_mode:z.enum(["balanced","more_prompt","more_control","unbalanced"]).optional(),resize_mode:z.enum(["just_resize","crop_resize","fill_resize","just_resize_simple"]).optional()}),hue=vt.extend({type:z.literal("ControlField"),value:Km.optional()}),pue=vt.extend({type:z.literal("ControlPolymorphic"),value:z.union([Km,z.array(Km)]).optional()}),gue=vt.extend({type:z.literal("ControlCollection"),value:z.array(Km).optional()}),mue=Ud,NB=z.object({image:uy,ip_adapter_model:mue,weight:z.number(),begin_step_percent:z.number().optional(),end_step_percent:z.number().optional()}),yue=vt.extend({type:z.literal("IPAdapterField"),value:NB.optional()}),vue=z.enum(["onnx","main","vae","lora","controlnet","embedding"]),bue=z.enum(["unet","text_encoder","text_encoder_2","tokenizer","tokenizer_2","vae","vae_decoder","vae_encoder","scheduler","safety_checker"]),qh=Ud.extend({model_type:vue,submodel:bue.optional()}),$B=qh.extend({weight:z.number().optional()}),_ue=z.object({unet:qh,scheduler:qh,loras:z.array($B)}),Sue=vt.extend({type:z.literal("UNetField"),value:_ue.optional()}),xue=z.object({tokenizer:qh,text_encoder:qh,skipped_layers:z.number(),loras:z.array($B)}),wue=vt.extend({type:z.literal("ClipField"),value:xue.optional()}),Cue=z.object({vae:qh}),Eue=vt.extend({type:z.literal("VaeField"),value:Cue.optional()}),kue=vt.extend({type:z.literal("ImageField"),value:uy.optional()}),Tue=vt.extend({type:z.literal("BoardField"),value:Gle.optional()}),Aue=vt.extend({type:z.literal("ImagePolymorphic"),value:uy.optional()}),Pue=vt.extend({type:z.literal("ImageCollection"),value:z.array(uy).optional()}),Iue=vt.extend({type:z.literal("MainModelField"),value:ly.optional()}),Rue=vt.extend({type:z.literal("SDXLMainModelField"),value:ly.optional()}),Oue=vt.extend({type:z.literal("SDXLRefinerModelField"),value:ly.optional()}),DB=Ud,Mue=vt.extend({type:z.literal("VaeModelField"),value:DB.optional()}),LB=Ud,Nue=vt.extend({type:z.literal("LoRAModelField"),value:LB.optional()}),$ue=Ud,Due=vt.extend({type:z.literal("ControlNetModelField"),value:$ue.optional()}),Lue=Ud,Fue=vt.extend({type:z.literal("IPAdapterModelField"),value:Lue.optional()}),Bue=vt.extend({type:z.literal("Collection"),value:z.array(z.any()).optional()}),zue=vt.extend({type:z.literal("CollectionItem"),value:z.any().optional()}),l_=z.object({r:z.number().int().min(0).max(255),g:z.number().int().min(0).max(255),b:z.number().int().min(0).max(255),a:z.number().int().min(0).max(255)}),jue=vt.extend({type:z.literal("ColorField"),value:l_.optional()}),Uue=vt.extend({type:z.literal("ColorCollection"),value:z.array(l_).optional()}),Vue=vt.extend({type:z.literal("ColorPolymorphic"),value:z.union([l_,z.array(l_)]).optional()}),Gue=vt.extend({type:z.literal("Scheduler"),value:vB.optional()}),Hue=z.discriminatedUnion("type",[Tue,nue,tue,rue,wue,Bue,zue,jue,Uue,Vue,uue,cue,due,hue,Due,gue,pue,lue,iue,Xle,Qle,Yle,Pue,Aue,kue,Wle,Kle,qle,yue,Fue,oue,aue,sue,Nue,Iue,Gue,Rue,Oue,Jle,eue,Zle,Sue,Eue,Mue]),sGe=e=>!!(e&&e.fieldKind==="input"),lGe=e=>!!(e&&e.fieldKind==="input"),que=e=>!!(e&&!("$ref"in e)),dI=e=>!!(e&&!("$ref"in e)&&e.type==="array"),mv=e=>!!(e&&!("$ref"in e)&&e.type!=="array"),Gp=e=>!!(e&&"$ref"in e),Wue=e=>"class"in e&&e.class==="invocation",Kue=e=>"class"in e&&e.class==="output",fI=e=>!("$ref"in e),Que=z.object({lora:LB.deepPartial(),weight:z.number()}),Xue=Km.deepPartial(),Yue=NB.deepPartial(),FB=z.object({app_version:z.string().nullish().catch(null),generation_mode:z.string().nullish().catch(null),created_by:z.string().nullish().catch(null),positive_prompt:z.string().nullish().catch(null),negative_prompt:z.string().nullish().catch(null),width:z.number().int().nullish().catch(null),height:z.number().int().nullish().catch(null),seed:z.number().int().nullish().catch(null),rand_device:z.string().nullish().catch(null),cfg_scale:z.number().nullish().catch(null),steps:z.number().int().nullish().catch(null),scheduler:z.string().nullish().catch(null),clip_skip:z.number().int().nullish().catch(null),model:z.union([QS.deepPartial(),bB.deepPartial()]).nullish().catch(null),controlnets:z.array(Xue).nullish().catch(null),ipAdapters:z.array(Yue).nullish().catch(null),loras:z.array(Que).nullish().catch(null),vae:DB.nullish().catch(null),strength:z.number().nullish().catch(null),init_image:z.string().nullish().catch(null),positive_style_prompt:z.string().nullish().catch(null),negative_style_prompt:z.string().nullish().catch(null),refiner_model:fT.deepPartial().nullish().catch(null),refiner_cfg_scale:z.number().nullish().catch(null),refiner_steps:z.number().int().nullish().catch(null),refiner_scheduler:z.string().nullish().catch(null),refiner_positive_aesthetic_score:z.number().nullish().catch(null),refiner_negative_aesthetic_score:z.number().nullish().catch(null),refiner_start:z.number().nullish().catch(null)}).passthrough(),yT=z.string().refine(e=>{const[t,n,r]=e.split(".");return t!==void 0&&Number.isInteger(Number(t))&&n!==void 0&&Number.isInteger(Number(n))&&r!==void 0&&Number.isInteger(Number(r))});yT.transform(e=>{const[t,n,r]=e.split(".");return{major:Number(t),minor:Number(n),patch:Number(r)}});const hI=z.object({id:z.string().trim().min(1),type:z.string().trim().min(1),inputs:z.record(Hue),outputs:z.record(Vle),label:z.string(),isOpen:z.boolean(),notes:z.string(),embedWorkflow:z.boolean(),isIntermediate:z.boolean(),useCache:z.boolean().optional(),version:yT.optional()}),Zue=z.preprocess(e=>{var t;try{const n=hI.parse(e);if(!Coe(n,"useCache")){const r=(t=PB.get())==null?void 0:t.getState().nodes.nodeTemplates,i=r==null?void 0:r[n.type];let o=!0;i&&(o=i.useCache),Object.assign(n,{useCache:o})}return n}catch{return e}},hI.extend({useCache:z.boolean()})),Jue=z.object({id:z.string().trim().min(1),type:z.literal("notes"),label:z.string(),isOpen:z.boolean(),notes:z.string()}),BB=z.object({x:z.number(),y:z.number()}).default({x:0,y:0}),u_=z.number().gt(0).nullish(),zB=z.object({id:z.string().trim().min(1),type:z.literal("invocation"),data:Zue,width:u_,height:u_,position:BB}),rE=e=>zB.safeParse(e).success,ece=z.object({id:z.string().trim().min(1),type:z.literal("notes"),data:Jue,width:u_,height:u_,position:BB}),jB=z.discriminatedUnion("type",[zB,ece]),tce=z.object({source:z.string().trim().min(1),sourceHandle:z.string().trim().min(1),target:z.string().trim().min(1),targetHandle:z.string().trim().min(1),id:z.string().trim().min(1),type:z.literal("default")}),nce=z.object({source:z.string().trim().min(1),target:z.string().trim().min(1),id:z.string().trim().min(1),type:z.literal("collapsed")}),UB=z.union([tce,nce]),rce=z.object({nodeId:z.string().trim().min(1),fieldName:z.string().trim().min(1)}),ice="1.0.0",VB=z.object({name:z.string().default(""),author:z.string().default(""),description:z.string().default(""),version:z.string().default(""),contact:z.string().default(""),tags:z.string().default(""),notes:z.string().default(""),nodes:z.array(jB).default([]),edges:z.array(UB).default([]),exposedFields:z.array(rce).default([]),meta:z.object({version:yT}).default({version:ice})});VB.transform(e=>{const{nodes:t,edges:n}=e,r=[],i=t.filter(rE),o=dT(i,"id");return n.forEach((a,s)=>{const l=o[a.source],u=o[a.target],c=[];if(l?a.type==="default"&&!(a.sourceHandle in l.data.outputs)&&c.push(`${be.t("nodes.outputField")}"${a.source}.${a.sourceHandle}" ${be.t("nodes.doesNotExist")}`):c.push(`${be.t("nodes.outputNode")} ${a.source} ${be.t("nodes.doesNotExist")}`),u?a.type==="default"&&!(a.targetHandle in u.data.inputs)&&c.push(`${be.t("nodes.inputField")} "${a.target}.${a.targetHandle}" ${be.t("nodes.doesNotExist")}`):c.push(`${be.t("nodes.inputNode")} ${a.target} ${be.t("nodes.doesNotExist")}`),c.length){delete n[s];const d=a.type==="default"?a.sourceHandle:a.source,f=a.type==="default"?a.targetHandle:a.target;r.push({message:`${be.t("nodes.edge")} "${d} -> ${f}" ${be.t("nodes.skipped")}`,issues:c,data:a})}}),{workflow:e,warnings:r}});const jr=e=>!!(e&&e.type==="invocation"),uGe=e=>!!(e&&!["notes","current_image"].includes(e.type)),pI=e=>!!(e&&e.type==="notes");var Hc=(e=>(e[e.PENDING=0]="PENDING",e[e.IN_PROGRESS=1]="IN_PROGRESS",e[e.COMPLETED=2]="COMPLETED",e[e.FAILED=3]="FAILED",e))(Hc||{});/*! pako 2.1.0 https://github.com/nodeca/pako @license (MIT AND Zlib) */const oce=4,gI=0,mI=1,ace=2;function mp(e){let t=e.length;for(;--t>=0;)e[t]=0}const sce=0,GB=1,lce=2,uce=3,cce=258,vT=29,cy=256,Qm=cy+1+vT,fh=30,bT=19,HB=2*Qm+1,ed=15,oC=16,dce=7,_T=256,qB=16,WB=17,KB=18,iE=new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]),N1=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]),fce=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),QB=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),hce=512,vl=new Array((Qm+2)*2);mp(vl);const Hg=new Array(fh*2);mp(Hg);const Xm=new Array(hce);mp(Xm);const Ym=new Array(cce-uce+1);mp(Ym);const ST=new Array(vT);mp(ST);const c_=new Array(fh);mp(c_);function aC(e,t,n,r,i){this.static_tree=e,this.extra_bits=t,this.extra_base=n,this.elems=r,this.max_length=i,this.has_stree=e&&e.length}let XB,YB,ZB;function sC(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}const JB=e=>e<256?Xm[e]:Xm[256+(e>>>7)],Zm=(e,t)=>{e.pending_buf[e.pending++]=t&255,e.pending_buf[e.pending++]=t>>>8&255},wo=(e,t,n)=>{e.bi_valid>oC-n?(e.bi_buf|=t<>oC-e.bi_valid,e.bi_valid+=n-oC):(e.bi_buf|=t<{wo(e,n[t*2],n[t*2+1])},ez=(e,t)=>{let n=0;do n|=e&1,e>>>=1,n<<=1;while(--t>0);return n>>>1},pce=e=>{e.bi_valid===16?(Zm(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):e.bi_valid>=8&&(e.pending_buf[e.pending++]=e.bi_buf&255,e.bi_buf>>=8,e.bi_valid-=8)},gce=(e,t)=>{const n=t.dyn_tree,r=t.max_code,i=t.stat_desc.static_tree,o=t.stat_desc.has_stree,a=t.stat_desc.extra_bits,s=t.stat_desc.extra_base,l=t.stat_desc.max_length;let u,c,d,f,h,p,m=0;for(f=0;f<=ed;f++)e.bl_count[f]=0;for(n[e.heap[e.heap_max]*2+1]=0,u=e.heap_max+1;ul&&(f=l,m++),n[c*2+1]=f,!(c>r)&&(e.bl_count[f]++,h=0,c>=s&&(h=a[c-s]),p=n[c*2],e.opt_len+=p*(f+h),o&&(e.static_len+=p*(i[c*2+1]+h)));if(m!==0){do{for(f=l-1;e.bl_count[f]===0;)f--;e.bl_count[f]--,e.bl_count[f+1]+=2,e.bl_count[l]--,m-=2}while(m>0);for(f=l;f!==0;f--)for(c=e.bl_count[f];c!==0;)d=e.heap[--u],!(d>r)&&(n[d*2+1]!==f&&(e.opt_len+=(f-n[d*2+1])*n[d*2],n[d*2+1]=f),c--)}},tz=(e,t,n)=>{const r=new Array(ed+1);let i=0,o,a;for(o=1;o<=ed;o++)i=i+n[o-1]<<1,r[o]=i;for(a=0;a<=t;a++){let s=e[a*2+1];s!==0&&(e[a*2]=ez(r[s]++,s))}},mce=()=>{let e,t,n,r,i;const o=new Array(ed+1);for(n=0,r=0;r>=7;r{let t;for(t=0;t{e.bi_valid>8?Zm(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0},yI=(e,t,n,r)=>{const i=t*2,o=n*2;return e[i]{const r=e.heap[n];let i=n<<1;for(;i<=e.heap_len&&(i{let r,i,o=0,a,s;if(e.sym_next!==0)do r=e.pending_buf[e.sym_buf+o++]&255,r+=(e.pending_buf[e.sym_buf+o++]&255)<<8,i=e.pending_buf[e.sym_buf+o++],r===0?Ps(e,i,t):(a=Ym[i],Ps(e,a+cy+1,t),s=iE[a],s!==0&&(i-=ST[a],wo(e,i,s)),r--,a=JB(r),Ps(e,a,n),s=N1[a],s!==0&&(r-=c_[a],wo(e,r,s)));while(o{const n=t.dyn_tree,r=t.stat_desc.static_tree,i=t.stat_desc.has_stree,o=t.stat_desc.elems;let a,s,l=-1,u;for(e.heap_len=0,e.heap_max=HB,a=0;a>1;a>=1;a--)lC(e,n,a);u=o;do a=e.heap[1],e.heap[1]=e.heap[e.heap_len--],lC(e,n,1),s=e.heap[1],e.heap[--e.heap_max]=a,e.heap[--e.heap_max]=s,n[u*2]=n[a*2]+n[s*2],e.depth[u]=(e.depth[a]>=e.depth[s]?e.depth[a]:e.depth[s])+1,n[a*2+1]=n[s*2+1]=u,e.heap[1]=u++,lC(e,n,1);while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],gce(e,t),tz(n,l,e.bl_count)},bI=(e,t,n)=>{let r,i=-1,o,a=t[0*2+1],s=0,l=7,u=4;for(a===0&&(l=138,u=3),t[(n+1)*2+1]=65535,r=0;r<=n;r++)o=a,a=t[(r+1)*2+1],!(++s{let r,i=-1,o,a=t[0*2+1],s=0,l=7,u=4;for(a===0&&(l=138,u=3),r=0;r<=n;r++)if(o=a,a=t[(r+1)*2+1],!(++s{let t;for(bI(e,e.dyn_ltree,e.l_desc.max_code),bI(e,e.dyn_dtree,e.d_desc.max_code),oE(e,e.bl_desc),t=bT-1;t>=3&&e.bl_tree[QB[t]*2+1]===0;t--);return e.opt_len+=3*(t+1)+5+5+4,t},vce=(e,t,n,r)=>{let i;for(wo(e,t-257,5),wo(e,n-1,5),wo(e,r-4,4),i=0;i{let t=4093624447,n;for(n=0;n<=31;n++,t>>>=1)if(t&1&&e.dyn_ltree[n*2]!==0)return gI;if(e.dyn_ltree[9*2]!==0||e.dyn_ltree[10*2]!==0||e.dyn_ltree[13*2]!==0)return mI;for(n=32;n{SI||(mce(),SI=!0),e.l_desc=new sC(e.dyn_ltree,XB),e.d_desc=new sC(e.dyn_dtree,YB),e.bl_desc=new sC(e.bl_tree,ZB),e.bi_buf=0,e.bi_valid=0,nz(e)},iz=(e,t,n,r)=>{wo(e,(sce<<1)+(r?1:0),3),rz(e),Zm(e,n),Zm(e,~n),n&&e.pending_buf.set(e.window.subarray(t,t+n),e.pending),e.pending+=n},Sce=e=>{wo(e,GB<<1,3),Ps(e,_T,vl),pce(e)},xce=(e,t,n,r)=>{let i,o,a=0;e.level>0?(e.strm.data_type===ace&&(e.strm.data_type=bce(e)),oE(e,e.l_desc),oE(e,e.d_desc),a=yce(e),i=e.opt_len+3+7>>>3,o=e.static_len+3+7>>>3,o<=i&&(i=o)):i=o=n+5,n+4<=i&&t!==-1?iz(e,t,n,r):e.strategy===oce||o===i?(wo(e,(GB<<1)+(r?1:0),3),vI(e,vl,Hg)):(wo(e,(lce<<1)+(r?1:0),3),vce(e,e.l_desc.max_code+1,e.d_desc.max_code+1,a+1),vI(e,e.dyn_ltree,e.dyn_dtree)),nz(e),r&&rz(e)},wce=(e,t,n)=>(e.pending_buf[e.sym_buf+e.sym_next++]=t,e.pending_buf[e.sym_buf+e.sym_next++]=t>>8,e.pending_buf[e.sym_buf+e.sym_next++]=n,t===0?e.dyn_ltree[n*2]++:(e.matches++,t--,e.dyn_ltree[(Ym[n]+cy+1)*2]++,e.dyn_dtree[JB(t)*2]++),e.sym_next===e.sym_end);var Cce=_ce,Ece=iz,kce=xce,Tce=wce,Ace=Sce,Pce={_tr_init:Cce,_tr_stored_block:Ece,_tr_flush_block:kce,_tr_tally:Tce,_tr_align:Ace};const Ice=(e,t,n,r)=>{let i=e&65535|0,o=e>>>16&65535|0,a=0;for(;n!==0;){a=n>2e3?2e3:n,n-=a;do i=i+t[r++]|0,o=o+i|0;while(--a);i%=65521,o%=65521}return i|o<<16|0};var Jm=Ice;const Rce=()=>{let e,t=[];for(var n=0;n<256;n++){e=n;for(var r=0;r<8;r++)e=e&1?3988292384^e>>>1:e>>>1;t[n]=e}return t},Oce=new Uint32Array(Rce()),Mce=(e,t,n,r)=>{const i=Oce,o=r+n;e^=-1;for(let a=r;a>>8^i[(e^t[a])&255];return e^-1};var ai=Mce,Wh={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},dy={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8};const{_tr_init:Nce,_tr_stored_block:aE,_tr_flush_block:$ce,_tr_tally:Hu,_tr_align:Dce}=Pce,{Z_NO_FLUSH:qu,Z_PARTIAL_FLUSH:Lce,Z_FULL_FLUSH:Fce,Z_FINISH:ya,Z_BLOCK:xI,Z_OK:Ei,Z_STREAM_END:wI,Z_STREAM_ERROR:zs,Z_DATA_ERROR:Bce,Z_BUF_ERROR:uC,Z_DEFAULT_COMPRESSION:zce,Z_FILTERED:jce,Z_HUFFMAN_ONLY:yv,Z_RLE:Uce,Z_FIXED:Vce,Z_DEFAULT_STRATEGY:Gce,Z_UNKNOWN:Hce,Z_DEFLATED:ZS}=dy,qce=9,Wce=15,Kce=8,Qce=29,Xce=256,sE=Xce+1+Qce,Yce=30,Zce=19,Jce=2*sE+1,ede=15,Bt=3,Nu=258,js=Nu+Bt+1,tde=32,Kh=42,xT=57,lE=69,uE=73,cE=91,dE=103,td=113,yg=666,eo=1,yp=2,Pd=3,vp=4,nde=3,nd=(e,t)=>(e.msg=Wh[t],t),CI=e=>e*2-(e>4?9:0),Cu=e=>{let t=e.length;for(;--t>=0;)e[t]=0},rde=e=>{let t,n,r,i=e.w_size;t=e.hash_size,r=t;do n=e.head[--r],e.head[r]=n>=i?n-i:0;while(--t);t=i,r=t;do n=e.prev[--r],e.prev[r]=n>=i?n-i:0;while(--t)};let ide=(e,t,n)=>(t<{const t=e.state;let n=t.pending;n>e.avail_out&&(n=e.avail_out),n!==0&&(e.output.set(t.pending_buf.subarray(t.pending_out,t.pending_out+n),e.next_out),e.next_out+=n,t.pending_out+=n,e.total_out+=n,e.avail_out-=n,t.pending-=n,t.pending===0&&(t.pending_out=0))},qo=(e,t)=>{$ce(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,Fo(e.strm)},on=(e,t)=>{e.pending_buf[e.pending++]=t},Hp=(e,t)=>{e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=t&255},fE=(e,t,n,r)=>{let i=e.avail_in;return i>r&&(i=r),i===0?0:(e.avail_in-=i,t.set(e.input.subarray(e.next_in,e.next_in+i),n),e.state.wrap===1?e.adler=Jm(e.adler,t,i,n):e.state.wrap===2&&(e.adler=ai(e.adler,t,i,n)),e.next_in+=i,e.total_in+=i,i)},oz=(e,t)=>{let n=e.max_chain_length,r=e.strstart,i,o,a=e.prev_length,s=e.nice_match;const l=e.strstart>e.w_size-js?e.strstart-(e.w_size-js):0,u=e.window,c=e.w_mask,d=e.prev,f=e.strstart+Nu;let h=u[r+a-1],p=u[r+a];e.prev_length>=e.good_match&&(n>>=2),s>e.lookahead&&(s=e.lookahead);do if(i=t,!(u[i+a]!==p||u[i+a-1]!==h||u[i]!==u[r]||u[++i]!==u[r+1])){r+=2,i++;do;while(u[++r]===u[++i]&&u[++r]===u[++i]&&u[++r]===u[++i]&&u[++r]===u[++i]&&u[++r]===u[++i]&&u[++r]===u[++i]&&u[++r]===u[++i]&&u[++r]===u[++i]&&ra){if(e.match_start=t,a=o,o>=s)break;h=u[r+a-1],p=u[r+a]}}while((t=d[t&c])>l&&--n!==0);return a<=e.lookahead?a:e.lookahead},Qh=e=>{const t=e.w_size;let n,r,i;do{if(r=e.window_size-e.lookahead-e.strstart,e.strstart>=t+(t-js)&&(e.window.set(e.window.subarray(t,t+t-r),0),e.match_start-=t,e.strstart-=t,e.block_start-=t,e.insert>e.strstart&&(e.insert=e.strstart),rde(e),r+=t),e.strm.avail_in===0)break;if(n=fE(e.strm,e.window,e.strstart+e.lookahead,r),e.lookahead+=n,e.lookahead+e.insert>=Bt)for(i=e.strstart-e.insert,e.ins_h=e.window[i],e.ins_h=Wu(e,e.ins_h,e.window[i+1]);e.insert&&(e.ins_h=Wu(e,e.ins_h,e.window[i+Bt-1]),e.prev[i&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=i,i++,e.insert--,!(e.lookahead+e.insert{let n=e.pending_buf_size-5>e.w_size?e.w_size:e.pending_buf_size-5,r,i,o,a=0,s=e.strm.avail_in;do{if(r=65535,o=e.bi_valid+42>>3,e.strm.avail_outi+e.strm.avail_in&&(r=i+e.strm.avail_in),r>o&&(r=o),r>8,e.pending_buf[e.pending-2]=~r,e.pending_buf[e.pending-1]=~r>>8,Fo(e.strm),i&&(i>r&&(i=r),e.strm.output.set(e.window.subarray(e.block_start,e.block_start+i),e.strm.next_out),e.strm.next_out+=i,e.strm.avail_out-=i,e.strm.total_out+=i,e.block_start+=i,r-=i),r&&(fE(e.strm,e.strm.output,e.strm.next_out,r),e.strm.next_out+=r,e.strm.avail_out-=r,e.strm.total_out+=r)}while(a===0);return s-=e.strm.avail_in,s&&(s>=e.w_size?(e.matches=2,e.window.set(e.strm.input.subarray(e.strm.next_in-e.w_size,e.strm.next_in),0),e.strstart=e.w_size,e.insert=e.strstart):(e.window_size-e.strstart<=s&&(e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,e.insert>e.strstart&&(e.insert=e.strstart)),e.window.set(e.strm.input.subarray(e.strm.next_in-s,e.strm.next_in),e.strstart),e.strstart+=s,e.insert+=s>e.w_size-e.insert?e.w_size-e.insert:s),e.block_start=e.strstart),e.high_watero&&e.block_start>=e.w_size&&(e.block_start-=e.w_size,e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,o+=e.w_size,e.insert>e.strstart&&(e.insert=e.strstart)),o>e.strm.avail_in&&(o=e.strm.avail_in),o&&(fE(e.strm,e.window,e.strstart,o),e.strstart+=o,e.insert+=o>e.w_size-e.insert?e.w_size-e.insert:o),e.high_water>3,o=e.pending_buf_size-o>65535?65535:e.pending_buf_size-o,n=o>e.w_size?e.w_size:o,i=e.strstart-e.block_start,(i>=n||(i||t===ya)&&t!==qu&&e.strm.avail_in===0&&i<=o)&&(r=i>o?o:i,a=t===ya&&e.strm.avail_in===0&&r===i?1:0,aE(e,e.block_start,r,a),e.block_start+=r,Fo(e.strm)),a?Pd:eo)},cC=(e,t)=>{let n,r;for(;;){if(e.lookahead=Bt&&(e.ins_h=Wu(e,e.ins_h,e.window[e.strstart+Bt-1]),n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),n!==0&&e.strstart-n<=e.w_size-js&&(e.match_length=oz(e,n)),e.match_length>=Bt)if(r=Hu(e,e.strstart-e.match_start,e.match_length-Bt),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=Bt){e.match_length--;do e.strstart++,e.ins_h=Wu(e,e.ins_h,e.window[e.strstart+Bt-1]),n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart;while(--e.match_length!==0);e.strstart++}else e.strstart+=e.match_length,e.match_length=0,e.ins_h=e.window[e.strstart],e.ins_h=Wu(e,e.ins_h,e.window[e.strstart+1]);else r=Hu(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(r&&(qo(e,!1),e.strm.avail_out===0))return eo}return e.insert=e.strstart{let n,r,i;for(;;){if(e.lookahead=Bt&&(e.ins_h=Wu(e,e.ins_h,e.window[e.strstart+Bt-1]),n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),e.prev_length=e.match_length,e.prev_match=e.match_start,e.match_length=Bt-1,n!==0&&e.prev_length4096)&&(e.match_length=Bt-1)),e.prev_length>=Bt&&e.match_length<=e.prev_length){i=e.strstart+e.lookahead-Bt,r=Hu(e,e.strstart-1-e.prev_match,e.prev_length-Bt),e.lookahead-=e.prev_length-1,e.prev_length-=2;do++e.strstart<=i&&(e.ins_h=Wu(e,e.ins_h,e.window[e.strstart+Bt-1]),n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart);while(--e.prev_length!==0);if(e.match_available=0,e.match_length=Bt-1,e.strstart++,r&&(qo(e,!1),e.strm.avail_out===0))return eo}else if(e.match_available){if(r=Hu(e,0,e.window[e.strstart-1]),r&&qo(e,!1),e.strstart++,e.lookahead--,e.strm.avail_out===0)return eo}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&(r=Hu(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart{let n,r,i,o;const a=e.window;for(;;){if(e.lookahead<=Nu){if(Qh(e),e.lookahead<=Nu&&t===qu)return eo;if(e.lookahead===0)break}if(e.match_length=0,e.lookahead>=Bt&&e.strstart>0&&(i=e.strstart-1,r=a[i],r===a[++i]&&r===a[++i]&&r===a[++i])){o=e.strstart+Nu;do;while(r===a[++i]&&r===a[++i]&&r===a[++i]&&r===a[++i]&&r===a[++i]&&r===a[++i]&&r===a[++i]&&r===a[++i]&&ie.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=Bt?(n=Hu(e,1,e.match_length-Bt),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(n=Hu(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),n&&(qo(e,!1),e.strm.avail_out===0))return eo}return e.insert=0,t===ya?(qo(e,!0),e.strm.avail_out===0?Pd:vp):e.sym_next&&(qo(e,!1),e.strm.avail_out===0)?eo:yp},ade=(e,t)=>{let n;for(;;){if(e.lookahead===0&&(Qh(e),e.lookahead===0)){if(t===qu)return eo;break}if(e.match_length=0,n=Hu(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,n&&(qo(e,!1),e.strm.avail_out===0))return eo}return e.insert=0,t===ya?(qo(e,!0),e.strm.avail_out===0?Pd:vp):e.sym_next&&(qo(e,!1),e.strm.avail_out===0)?eo:yp};function ms(e,t,n,r,i){this.good_length=e,this.max_lazy=t,this.nice_length=n,this.max_chain=r,this.func=i}const vg=[new ms(0,0,0,0,az),new ms(4,4,8,4,cC),new ms(4,5,16,8,cC),new ms(4,6,32,32,cC),new ms(4,4,16,16,uf),new ms(8,16,32,32,uf),new ms(8,16,128,128,uf),new ms(8,32,128,256,uf),new ms(32,128,258,1024,uf),new ms(32,258,258,4096,uf)],sde=e=>{e.window_size=2*e.w_size,Cu(e.head),e.max_lazy_match=vg[e.level].max_lazy,e.good_match=vg[e.level].good_length,e.nice_match=vg[e.level].nice_length,e.max_chain_length=vg[e.level].max_chain,e.strstart=0,e.block_start=0,e.lookahead=0,e.insert=0,e.match_length=e.prev_length=Bt-1,e.match_available=0,e.ins_h=0};function lde(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=ZS,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(Jce*2),this.dyn_dtree=new Uint16Array((2*Yce+1)*2),this.bl_tree=new Uint16Array((2*Zce+1)*2),Cu(this.dyn_ltree),Cu(this.dyn_dtree),Cu(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(ede+1),this.heap=new Uint16Array(2*sE+1),Cu(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(2*sE+1),Cu(this.depth),this.sym_buf=0,this.lit_bufsize=0,this.sym_next=0,this.sym_end=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}const fy=e=>{if(!e)return 1;const t=e.state;return!t||t.strm!==e||t.status!==Kh&&t.status!==xT&&t.status!==lE&&t.status!==uE&&t.status!==cE&&t.status!==dE&&t.status!==td&&t.status!==yg?1:0},sz=e=>{if(fy(e))return nd(e,zs);e.total_in=e.total_out=0,e.data_type=Hce;const t=e.state;return t.pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=t.wrap===2?xT:t.wrap?Kh:td,e.adler=t.wrap===2?0:1,t.last_flush=-2,Nce(t),Ei},lz=e=>{const t=sz(e);return t===Ei&&sde(e.state),t},ude=(e,t)=>fy(e)||e.state.wrap!==2?zs:(e.state.gzhead=t,Ei),uz=(e,t,n,r,i,o)=>{if(!e)return zs;let a=1;if(t===zce&&(t=6),r<0?(a=0,r=-r):r>15&&(a=2,r-=16),i<1||i>qce||n!==ZS||r<8||r>15||t<0||t>9||o<0||o>Vce||r===8&&a!==1)return nd(e,zs);r===8&&(r=9);const s=new lde;return e.state=s,s.strm=e,s.status=Kh,s.wrap=a,s.gzhead=null,s.w_bits=r,s.w_size=1<uz(e,t,ZS,Wce,Kce,Gce),dde=(e,t)=>{if(fy(e)||t>xI||t<0)return e?nd(e,zs):zs;const n=e.state;if(!e.output||e.avail_in!==0&&!e.input||n.status===yg&&t!==ya)return nd(e,e.avail_out===0?uC:zs);const r=n.last_flush;if(n.last_flush=t,n.pending!==0){if(Fo(e),e.avail_out===0)return n.last_flush=-1,Ei}else if(e.avail_in===0&&CI(t)<=CI(r)&&t!==ya)return nd(e,uC);if(n.status===yg&&e.avail_in!==0)return nd(e,uC);if(n.status===Kh&&n.wrap===0&&(n.status=td),n.status===Kh){let i=ZS+(n.w_bits-8<<4)<<8,o=-1;if(n.strategy>=yv||n.level<2?o=0:n.level<6?o=1:n.level===6?o=2:o=3,i|=o<<6,n.strstart!==0&&(i|=tde),i+=31-i%31,Hp(n,i),n.strstart!==0&&(Hp(n,e.adler>>>16),Hp(n,e.adler&65535)),e.adler=1,n.status=td,Fo(e),n.pending!==0)return n.last_flush=-1,Ei}if(n.status===xT){if(e.adler=0,on(n,31),on(n,139),on(n,8),n.gzhead)on(n,(n.gzhead.text?1:0)+(n.gzhead.hcrc?2:0)+(n.gzhead.extra?4:0)+(n.gzhead.name?8:0)+(n.gzhead.comment?16:0)),on(n,n.gzhead.time&255),on(n,n.gzhead.time>>8&255),on(n,n.gzhead.time>>16&255),on(n,n.gzhead.time>>24&255),on(n,n.level===9?2:n.strategy>=yv||n.level<2?4:0),on(n,n.gzhead.os&255),n.gzhead.extra&&n.gzhead.extra.length&&(on(n,n.gzhead.extra.length&255),on(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(e.adler=ai(e.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=lE;else if(on(n,0),on(n,0),on(n,0),on(n,0),on(n,0),on(n,n.level===9?2:n.strategy>=yv||n.level<2?4:0),on(n,nde),n.status=td,Fo(e),n.pending!==0)return n.last_flush=-1,Ei}if(n.status===lE){if(n.gzhead.extra){let i=n.pending,o=(n.gzhead.extra.length&65535)-n.gzindex;for(;n.pending+o>n.pending_buf_size;){let s=n.pending_buf_size-n.pending;if(n.pending_buf.set(n.gzhead.extra.subarray(n.gzindex,n.gzindex+s),n.pending),n.pending=n.pending_buf_size,n.gzhead.hcrc&&n.pending>i&&(e.adler=ai(e.adler,n.pending_buf,n.pending-i,i)),n.gzindex+=s,Fo(e),n.pending!==0)return n.last_flush=-1,Ei;i=0,o-=s}let a=new Uint8Array(n.gzhead.extra);n.pending_buf.set(a.subarray(n.gzindex,n.gzindex+o),n.pending),n.pending+=o,n.gzhead.hcrc&&n.pending>i&&(e.adler=ai(e.adler,n.pending_buf,n.pending-i,i)),n.gzindex=0}n.status=uE}if(n.status===uE){if(n.gzhead.name){let i=n.pending,o;do{if(n.pending===n.pending_buf_size){if(n.gzhead.hcrc&&n.pending>i&&(e.adler=ai(e.adler,n.pending_buf,n.pending-i,i)),Fo(e),n.pending!==0)return n.last_flush=-1,Ei;i=0}n.gzindexi&&(e.adler=ai(e.adler,n.pending_buf,n.pending-i,i)),n.gzindex=0}n.status=cE}if(n.status===cE){if(n.gzhead.comment){let i=n.pending,o;do{if(n.pending===n.pending_buf_size){if(n.gzhead.hcrc&&n.pending>i&&(e.adler=ai(e.adler,n.pending_buf,n.pending-i,i)),Fo(e),n.pending!==0)return n.last_flush=-1,Ei;i=0}n.gzindexi&&(e.adler=ai(e.adler,n.pending_buf,n.pending-i,i))}n.status=dE}if(n.status===dE){if(n.gzhead.hcrc){if(n.pending+2>n.pending_buf_size&&(Fo(e),n.pending!==0))return n.last_flush=-1,Ei;on(n,e.adler&255),on(n,e.adler>>8&255),e.adler=0}if(n.status=td,Fo(e),n.pending!==0)return n.last_flush=-1,Ei}if(e.avail_in!==0||n.lookahead!==0||t!==qu&&n.status!==yg){let i=n.level===0?az(n,t):n.strategy===yv?ade(n,t):n.strategy===Uce?ode(n,t):vg[n.level].func(n,t);if((i===Pd||i===vp)&&(n.status=yg),i===eo||i===Pd)return e.avail_out===0&&(n.last_flush=-1),Ei;if(i===yp&&(t===Lce?Dce(n):t!==xI&&(aE(n,0,0,!1),t===Fce&&(Cu(n.head),n.lookahead===0&&(n.strstart=0,n.block_start=0,n.insert=0))),Fo(e),e.avail_out===0))return n.last_flush=-1,Ei}return t!==ya?Ei:n.wrap<=0?wI:(n.wrap===2?(on(n,e.adler&255),on(n,e.adler>>8&255),on(n,e.adler>>16&255),on(n,e.adler>>24&255),on(n,e.total_in&255),on(n,e.total_in>>8&255),on(n,e.total_in>>16&255),on(n,e.total_in>>24&255)):(Hp(n,e.adler>>>16),Hp(n,e.adler&65535)),Fo(e),n.wrap>0&&(n.wrap=-n.wrap),n.pending!==0?Ei:wI)},fde=e=>{if(fy(e))return zs;const t=e.state.status;return e.state=null,t===td?nd(e,Bce):Ei},hde=(e,t)=>{let n=t.length;if(fy(e))return zs;const r=e.state,i=r.wrap;if(i===2||i===1&&r.status!==Kh||r.lookahead)return zs;if(i===1&&(e.adler=Jm(e.adler,t,n,0)),r.wrap=0,n>=r.w_size){i===0&&(Cu(r.head),r.strstart=0,r.block_start=0,r.insert=0);let l=new Uint8Array(r.w_size);l.set(t.subarray(n-r.w_size,n),0),t=l,n=r.w_size}const o=e.avail_in,a=e.next_in,s=e.input;for(e.avail_in=n,e.next_in=0,e.input=t,Qh(r);r.lookahead>=Bt;){let l=r.strstart,u=r.lookahead-(Bt-1);do r.ins_h=Wu(r,r.ins_h,r.window[l+Bt-1]),r.prev[l&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=l,l++;while(--u);r.strstart=l,r.lookahead=Bt-1,Qh(r)}return r.strstart+=r.lookahead,r.block_start=r.strstart,r.insert=r.lookahead,r.lookahead=0,r.match_length=r.prev_length=Bt-1,r.match_available=0,e.next_in=a,e.input=s,e.avail_in=o,r.wrap=i,Ei};var pde=cde,gde=uz,mde=lz,yde=sz,vde=ude,bde=dde,_de=fde,Sde=hde,xde="pako deflate (from Nodeca project)",qg={deflateInit:pde,deflateInit2:gde,deflateReset:mde,deflateResetKeep:yde,deflateSetHeader:vde,deflate:bde,deflateEnd:_de,deflateSetDictionary:Sde,deflateInfo:xde};const wde=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var Cde=function(e){const t=Array.prototype.slice.call(arguments,1);for(;t.length;){const n=t.shift();if(n){if(typeof n!="object")throw new TypeError(n+"must be non-object");for(const r in n)wde(n,r)&&(e[r]=n[r])}}return e},Ede=e=>{let t=0;for(let r=0,i=e.length;r=252?6:e>=248?5:e>=240?4:e>=224?3:e>=192?2:1;e0[254]=e0[254]=1;var kde=e=>{if(typeof TextEncoder=="function"&&TextEncoder.prototype.encode)return new TextEncoder().encode(e);let t,n,r,i,o,a=e.length,s=0;for(i=0;i>>6,t[o++]=128|n&63):n<65536?(t[o++]=224|n>>>12,t[o++]=128|n>>>6&63,t[o++]=128|n&63):(t[o++]=240|n>>>18,t[o++]=128|n>>>12&63,t[o++]=128|n>>>6&63,t[o++]=128|n&63);return t};const Tde=(e,t)=>{if(t<65534&&e.subarray&&cz)return String.fromCharCode.apply(null,e.length===t?e:e.subarray(0,t));let n="";for(let r=0;r{const n=t||e.length;if(typeof TextDecoder=="function"&&TextDecoder.prototype.decode)return new TextDecoder().decode(e.subarray(0,t));let r,i;const o=new Array(n*2);for(i=0,r=0;r4){o[i++]=65533,r+=s-1;continue}for(a&=s===2?31:s===3?15:7;s>1&&r1){o[i++]=65533;continue}a<65536?o[i++]=a:(a-=65536,o[i++]=55296|a>>10&1023,o[i++]=56320|a&1023)}return Tde(o,i)},Pde=(e,t)=>{t=t||e.length,t>e.length&&(t=e.length);let n=t-1;for(;n>=0&&(e[n]&192)===128;)n--;return n<0||n===0?t:n+e0[e[n]]>t?n:t},t0={string2buf:kde,buf2string:Ade,utf8border:Pde};function Ide(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}var dz=Ide;const fz=Object.prototype.toString,{Z_NO_FLUSH:Rde,Z_SYNC_FLUSH:Ode,Z_FULL_FLUSH:Mde,Z_FINISH:Nde,Z_OK:d_,Z_STREAM_END:$de,Z_DEFAULT_COMPRESSION:Dde,Z_DEFAULT_STRATEGY:Lde,Z_DEFLATED:Fde}=dy;function wT(e){this.options=JS.assign({level:Dde,method:Fde,chunkSize:16384,windowBits:15,memLevel:8,strategy:Lde},e||{});let t=this.options;t.raw&&t.windowBits>0?t.windowBits=-t.windowBits:t.gzip&&t.windowBits>0&&t.windowBits<16&&(t.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new dz,this.strm.avail_out=0;let n=qg.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(n!==d_)throw new Error(Wh[n]);if(t.header&&qg.deflateSetHeader(this.strm,t.header),t.dictionary){let r;if(typeof t.dictionary=="string"?r=t0.string2buf(t.dictionary):fz.call(t.dictionary)==="[object ArrayBuffer]"?r=new Uint8Array(t.dictionary):r=t.dictionary,n=qg.deflateSetDictionary(this.strm,r),n!==d_)throw new Error(Wh[n]);this._dict_set=!0}}wT.prototype.push=function(e,t){const n=this.strm,r=this.options.chunkSize;let i,o;if(this.ended)return!1;for(t===~~t?o=t:o=t===!0?Nde:Rde,typeof e=="string"?n.input=t0.string2buf(e):fz.call(e)==="[object ArrayBuffer]"?n.input=new Uint8Array(e):n.input=e,n.next_in=0,n.avail_in=n.input.length;;){if(n.avail_out===0&&(n.output=new Uint8Array(r),n.next_out=0,n.avail_out=r),(o===Ode||o===Mde)&&n.avail_out<=6){this.onData(n.output.subarray(0,n.next_out)),n.avail_out=0;continue}if(i=qg.deflate(n,o),i===$de)return n.next_out>0&&this.onData(n.output.subarray(0,n.next_out)),i=qg.deflateEnd(this.strm),this.onEnd(i),this.ended=!0,i===d_;if(n.avail_out===0){this.onData(n.output);continue}if(o>0&&n.next_out>0){this.onData(n.output.subarray(0,n.next_out)),n.avail_out=0;continue}if(n.avail_in===0)break}return!0};wT.prototype.onData=function(e){this.chunks.push(e)};wT.prototype.onEnd=function(e){e===d_&&(this.result=JS.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};const vv=16209,Bde=16191;var zde=function(t,n){let r,i,o,a,s,l,u,c,d,f,h,p,m,_,b,v,g,y,S,w,x,C,T,k;const P=t.state;r=t.next_in,T=t.input,i=r+(t.avail_in-5),o=t.next_out,k=t.output,a=o-(n-t.avail_out),s=o+(t.avail_out-257),l=P.dmax,u=P.wsize,c=P.whave,d=P.wnext,f=P.window,h=P.hold,p=P.bits,m=P.lencode,_=P.distcode,b=(1<>>24,h>>>=y,p-=y,y=g>>>16&255,y===0)k[o++]=g&65535;else if(y&16){S=g&65535,y&=15,y&&(p>>=y,p-=y),p<15&&(h+=T[r++]<>>24,h>>>=y,p-=y,y=g>>>16&255,y&16){if(w=g&65535,y&=15,pl){t.msg="invalid distance too far back",P.mode=vv;break e}if(h>>>=y,p-=y,y=o-a,w>y){if(y=w-y,y>c&&P.sane){t.msg="invalid distance too far back",P.mode=vv;break e}if(x=0,C=f,d===0){if(x+=u-y,y2;)k[o++]=C[x++],k[o++]=C[x++],k[o++]=C[x++],S-=3;S&&(k[o++]=C[x++],S>1&&(k[o++]=C[x++]))}else{x=o-w;do k[o++]=k[x++],k[o++]=k[x++],k[o++]=k[x++],S-=3;while(S>2);S&&(k[o++]=k[x++],S>1&&(k[o++]=k[x++]))}}else if(y&64){t.msg="invalid distance code",P.mode=vv;break e}else{g=_[(g&65535)+(h&(1<>3,r-=S,p-=S<<3,h&=(1<{const l=s.bits;let u=0,c=0,d=0,f=0,h=0,p=0,m=0,_=0,b=0,v=0,g,y,S,w,x,C=null,T;const k=new Uint16Array(cf+1),P=new Uint16Array(cf+1);let $=null,O,E,A;for(u=0;u<=cf;u++)k[u]=0;for(c=0;c=1&&k[f]===0;f--);if(h>f&&(h=f),f===0)return i[o++]=1<<24|64<<16|0,i[o++]=1<<24|64<<16|0,s.bits=1,0;for(d=1;d0&&(e===TI||f!==1))return-1;for(P[1]=0,u=1;uEI||e===AI&&b>kI)return 1;for(;;){O=u-m,a[c]+1=T?(E=$[a[c]-T],A=C[a[c]-T]):(E=32+64,A=0),g=1<>m)+y]=O<<24|E<<16|A|0;while(y!==0);for(g=1<>=1;if(g!==0?(v&=g-1,v+=g):v=0,c++,--k[u]===0){if(u===f)break;u=t[n+a[c]]}if(u>h&&(v&w)!==S){for(m===0&&(m=h),x+=d,p=u-m,_=1<EI||e===AI&&b>kI)return 1;S=v&w,i[S]=h<<24|p<<16|x-o|0}}return v!==0&&(i[x+v]=u-m<<24|64<<16|0),s.bits=h,0};var Wg=Hde;const qde=0,hz=1,pz=2,{Z_FINISH:PI,Z_BLOCK:Wde,Z_TREES:bv,Z_OK:Id,Z_STREAM_END:Kde,Z_NEED_DICT:Qde,Z_STREAM_ERROR:Ea,Z_DATA_ERROR:gz,Z_MEM_ERROR:mz,Z_BUF_ERROR:Xde,Z_DEFLATED:II}=dy,e2=16180,RI=16181,OI=16182,MI=16183,NI=16184,$I=16185,DI=16186,LI=16187,FI=16188,BI=16189,f_=16190,ll=16191,fC=16192,zI=16193,hC=16194,jI=16195,UI=16196,VI=16197,GI=16198,_v=16199,Sv=16200,HI=16201,qI=16202,WI=16203,KI=16204,QI=16205,pC=16206,XI=16207,YI=16208,Zn=16209,yz=16210,vz=16211,Yde=852,Zde=592,Jde=15,efe=Jde,ZI=e=>(e>>>24&255)+(e>>>8&65280)+((e&65280)<<8)+((e&255)<<24);function tfe(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}const Vd=e=>{if(!e)return 1;const t=e.state;return!t||t.strm!==e||t.modevz?1:0},bz=e=>{if(Vd(e))return Ea;const t=e.state;return e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=t.wrap&1),t.mode=e2,t.last=0,t.havedict=0,t.flags=-1,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new Int32Array(Yde),t.distcode=t.distdyn=new Int32Array(Zde),t.sane=1,t.back=-1,Id},_z=e=>{if(Vd(e))return Ea;const t=e.state;return t.wsize=0,t.whave=0,t.wnext=0,bz(e)},Sz=(e,t)=>{let n;if(Vd(e))return Ea;const r=e.state;return t<0?(n=0,t=-t):(n=(t>>4)+5,t<48&&(t&=15)),t&&(t<8||t>15)?Ea:(r.window!==null&&r.wbits!==t&&(r.window=null),r.wrap=n,r.wbits=t,_z(e))},xz=(e,t)=>{if(!e)return Ea;const n=new tfe;e.state=n,n.strm=e,n.window=null,n.mode=e2;const r=Sz(e,t);return r!==Id&&(e.state=null),r},nfe=e=>xz(e,efe);let JI=!0,gC,mC;const rfe=e=>{if(JI){gC=new Int32Array(512),mC=new Int32Array(32);let t=0;for(;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(Wg(hz,e.lens,0,288,gC,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;Wg(pz,e.lens,0,32,mC,0,e.work,{bits:5}),JI=!1}e.lencode=gC,e.lenbits=9,e.distcode=mC,e.distbits=5},wz=(e,t,n,r)=>{let i;const o=e.state;return o.window===null&&(o.wsize=1<=o.wsize?(o.window.set(t.subarray(n-o.wsize,n),0),o.wnext=0,o.whave=o.wsize):(i=o.wsize-o.wnext,i>r&&(i=r),o.window.set(t.subarray(n-r,n-r+i),o.wnext),r-=i,r?(o.window.set(t.subarray(n-r,n),0),o.wnext=r,o.whave=o.wsize):(o.wnext+=i,o.wnext===o.wsize&&(o.wnext=0),o.whave{let n,r,i,o,a,s,l,u,c,d,f,h,p,m,_=0,b,v,g,y,S,w,x,C;const T=new Uint8Array(4);let k,P;const $=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(Vd(e)||!e.output||!e.input&&e.avail_in!==0)return Ea;n=e.state,n.mode===ll&&(n.mode=fC),a=e.next_out,i=e.output,l=e.avail_out,o=e.next_in,r=e.input,s=e.avail_in,u=n.hold,c=n.bits,d=s,f=l,C=Id;e:for(;;)switch(n.mode){case e2:if(n.wrap===0){n.mode=fC;break}for(;c<16;){if(s===0)break e;s--,u+=r[o++]<>>8&255,n.check=ai(n.check,T,2,0),u=0,c=0,n.mode=RI;break}if(n.head&&(n.head.done=!1),!(n.wrap&1)||(((u&255)<<8)+(u>>8))%31){e.msg="incorrect header check",n.mode=Zn;break}if((u&15)!==II){e.msg="unknown compression method",n.mode=Zn;break}if(u>>>=4,c-=4,x=(u&15)+8,n.wbits===0&&(n.wbits=x),x>15||x>n.wbits){e.msg="invalid window size",n.mode=Zn;break}n.dmax=1<>8&1),n.flags&512&&n.wrap&4&&(T[0]=u&255,T[1]=u>>>8&255,n.check=ai(n.check,T,2,0)),u=0,c=0,n.mode=OI;case OI:for(;c<32;){if(s===0)break e;s--,u+=r[o++]<>>8&255,T[2]=u>>>16&255,T[3]=u>>>24&255,n.check=ai(n.check,T,4,0)),u=0,c=0,n.mode=MI;case MI:for(;c<16;){if(s===0)break e;s--,u+=r[o++]<>8),n.flags&512&&n.wrap&4&&(T[0]=u&255,T[1]=u>>>8&255,n.check=ai(n.check,T,2,0)),u=0,c=0,n.mode=NI;case NI:if(n.flags&1024){for(;c<16;){if(s===0)break e;s--,u+=r[o++]<>>8&255,n.check=ai(n.check,T,2,0)),u=0,c=0}else n.head&&(n.head.extra=null);n.mode=$I;case $I:if(n.flags&1024&&(h=n.length,h>s&&(h=s),h&&(n.head&&(x=n.head.extra_len-n.length,n.head.extra||(n.head.extra=new Uint8Array(n.head.extra_len)),n.head.extra.set(r.subarray(o,o+h),x)),n.flags&512&&n.wrap&4&&(n.check=ai(n.check,r,h,o)),s-=h,o+=h,n.length-=h),n.length))break e;n.length=0,n.mode=DI;case DI:if(n.flags&2048){if(s===0)break e;h=0;do x=r[o+h++],n.head&&x&&n.length<65536&&(n.head.name+=String.fromCharCode(x));while(x&&h>9&1,n.head.done=!0),e.adler=n.check=0,n.mode=ll;break;case BI:for(;c<32;){if(s===0)break e;s--,u+=r[o++]<>>=c&7,c-=c&7,n.mode=pC;break}for(;c<3;){if(s===0)break e;s--,u+=r[o++]<>>=1,c-=1,u&3){case 0:n.mode=zI;break;case 1:if(rfe(n),n.mode=_v,t===bv){u>>>=2,c-=2;break e}break;case 2:n.mode=UI;break;case 3:e.msg="invalid block type",n.mode=Zn}u>>>=2,c-=2;break;case zI:for(u>>>=c&7,c-=c&7;c<32;){if(s===0)break e;s--,u+=r[o++]<>>16^65535)){e.msg="invalid stored block lengths",n.mode=Zn;break}if(n.length=u&65535,u=0,c=0,n.mode=hC,t===bv)break e;case hC:n.mode=jI;case jI:if(h=n.length,h){if(h>s&&(h=s),h>l&&(h=l),h===0)break e;i.set(r.subarray(o,o+h),a),s-=h,o+=h,l-=h,a+=h,n.length-=h;break}n.mode=ll;break;case UI:for(;c<14;){if(s===0)break e;s--,u+=r[o++]<>>=5,c-=5,n.ndist=(u&31)+1,u>>>=5,c-=5,n.ncode=(u&15)+4,u>>>=4,c-=4,n.nlen>286||n.ndist>30){e.msg="too many length or distance symbols",n.mode=Zn;break}n.have=0,n.mode=VI;case VI:for(;n.have>>=3,c-=3}for(;n.have<19;)n.lens[$[n.have++]]=0;if(n.lencode=n.lendyn,n.lenbits=7,k={bits:n.lenbits},C=Wg(qde,n.lens,0,19,n.lencode,0,n.work,k),n.lenbits=k.bits,C){e.msg="invalid code lengths set",n.mode=Zn;break}n.have=0,n.mode=GI;case GI:for(;n.have>>24,v=_>>>16&255,g=_&65535,!(b<=c);){if(s===0)break e;s--,u+=r[o++]<>>=b,c-=b,n.lens[n.have++]=g;else{if(g===16){for(P=b+2;c>>=b,c-=b,n.have===0){e.msg="invalid bit length repeat",n.mode=Zn;break}x=n.lens[n.have-1],h=3+(u&3),u>>>=2,c-=2}else if(g===17){for(P=b+3;c>>=b,c-=b,x=0,h=3+(u&7),u>>>=3,c-=3}else{for(P=b+7;c>>=b,c-=b,x=0,h=11+(u&127),u>>>=7,c-=7}if(n.have+h>n.nlen+n.ndist){e.msg="invalid bit length repeat",n.mode=Zn;break}for(;h--;)n.lens[n.have++]=x}}if(n.mode===Zn)break;if(n.lens[256]===0){e.msg="invalid code -- missing end-of-block",n.mode=Zn;break}if(n.lenbits=9,k={bits:n.lenbits},C=Wg(hz,n.lens,0,n.nlen,n.lencode,0,n.work,k),n.lenbits=k.bits,C){e.msg="invalid literal/lengths set",n.mode=Zn;break}if(n.distbits=6,n.distcode=n.distdyn,k={bits:n.distbits},C=Wg(pz,n.lens,n.nlen,n.ndist,n.distcode,0,n.work,k),n.distbits=k.bits,C){e.msg="invalid distances set",n.mode=Zn;break}if(n.mode=_v,t===bv)break e;case _v:n.mode=Sv;case Sv:if(s>=6&&l>=258){e.next_out=a,e.avail_out=l,e.next_in=o,e.avail_in=s,n.hold=u,n.bits=c,zde(e,f),a=e.next_out,i=e.output,l=e.avail_out,o=e.next_in,r=e.input,s=e.avail_in,u=n.hold,c=n.bits,n.mode===ll&&(n.back=-1);break}for(n.back=0;_=n.lencode[u&(1<>>24,v=_>>>16&255,g=_&65535,!(b<=c);){if(s===0)break e;s--,u+=r[o++]<>y)],b=_>>>24,v=_>>>16&255,g=_&65535,!(y+b<=c);){if(s===0)break e;s--,u+=r[o++]<>>=y,c-=y,n.back+=y}if(u>>>=b,c-=b,n.back+=b,n.length=g,v===0){n.mode=QI;break}if(v&32){n.back=-1,n.mode=ll;break}if(v&64){e.msg="invalid literal/length code",n.mode=Zn;break}n.extra=v&15,n.mode=HI;case HI:if(n.extra){for(P=n.extra;c>>=n.extra,c-=n.extra,n.back+=n.extra}n.was=n.length,n.mode=qI;case qI:for(;_=n.distcode[u&(1<>>24,v=_>>>16&255,g=_&65535,!(b<=c);){if(s===0)break e;s--,u+=r[o++]<>y)],b=_>>>24,v=_>>>16&255,g=_&65535,!(y+b<=c);){if(s===0)break e;s--,u+=r[o++]<>>=y,c-=y,n.back+=y}if(u>>>=b,c-=b,n.back+=b,v&64){e.msg="invalid distance code",n.mode=Zn;break}n.offset=g,n.extra=v&15,n.mode=WI;case WI:if(n.extra){for(P=n.extra;c>>=n.extra,c-=n.extra,n.back+=n.extra}if(n.offset>n.dmax){e.msg="invalid distance too far back",n.mode=Zn;break}n.mode=KI;case KI:if(l===0)break e;if(h=f-l,n.offset>h){if(h=n.offset-h,h>n.whave&&n.sane){e.msg="invalid distance too far back",n.mode=Zn;break}h>n.wnext?(h-=n.wnext,p=n.wsize-h):p=n.wnext-h,h>n.length&&(h=n.length),m=n.window}else m=i,p=a-n.offset,h=n.length;h>l&&(h=l),l-=h,n.length-=h;do i[a++]=m[p++];while(--h);n.length===0&&(n.mode=Sv);break;case QI:if(l===0)break e;i[a++]=n.length,l--,n.mode=Sv;break;case pC:if(n.wrap){for(;c<32;){if(s===0)break e;s--,u|=r[o++]<{if(Vd(e))return Ea;let t=e.state;return t.window&&(t.window=null),e.state=null,Id},afe=(e,t)=>{if(Vd(e))return Ea;const n=e.state;return n.wrap&2?(n.head=t,t.done=!1,Id):Ea},sfe=(e,t)=>{const n=t.length;let r,i,o;return Vd(e)||(r=e.state,r.wrap!==0&&r.mode!==f_)?Ea:r.mode===f_&&(i=1,i=Jm(i,t,n,0),i!==r.check)?gz:(o=wz(e,t,n,n),o?(r.mode=yz,mz):(r.havedict=1,Id))};var lfe=_z,ufe=Sz,cfe=bz,dfe=nfe,ffe=xz,hfe=ife,pfe=ofe,gfe=afe,mfe=sfe,yfe="pako inflate (from Nodeca project)",bl={inflateReset:lfe,inflateReset2:ufe,inflateResetKeep:cfe,inflateInit:dfe,inflateInit2:ffe,inflate:hfe,inflateEnd:pfe,inflateGetHeader:gfe,inflateSetDictionary:mfe,inflateInfo:yfe};function vfe(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}var bfe=vfe;const Cz=Object.prototype.toString,{Z_NO_FLUSH:_fe,Z_FINISH:Sfe,Z_OK:n0,Z_STREAM_END:yC,Z_NEED_DICT:vC,Z_STREAM_ERROR:xfe,Z_DATA_ERROR:eR,Z_MEM_ERROR:wfe}=dy;function hy(e){this.options=JS.assign({chunkSize:1024*64,windowBits:15,to:""},e||{});const t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,t.windowBits===0&&(t.windowBits=-15)),t.windowBits>=0&&t.windowBits<16&&!(e&&e.windowBits)&&(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&(t.windowBits&15||(t.windowBits|=15)),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new dz,this.strm.avail_out=0;let n=bl.inflateInit2(this.strm,t.windowBits);if(n!==n0)throw new Error(Wh[n]);if(this.header=new bfe,bl.inflateGetHeader(this.strm,this.header),t.dictionary&&(typeof t.dictionary=="string"?t.dictionary=t0.string2buf(t.dictionary):Cz.call(t.dictionary)==="[object ArrayBuffer]"&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(n=bl.inflateSetDictionary(this.strm,t.dictionary),n!==n0)))throw new Error(Wh[n])}hy.prototype.push=function(e,t){const n=this.strm,r=this.options.chunkSize,i=this.options.dictionary;let o,a,s;if(this.ended)return!1;for(t===~~t?a=t:a=t===!0?Sfe:_fe,Cz.call(e)==="[object ArrayBuffer]"?n.input=new Uint8Array(e):n.input=e,n.next_in=0,n.avail_in=n.input.length;;){for(n.avail_out===0&&(n.output=new Uint8Array(r),n.next_out=0,n.avail_out=r),o=bl.inflate(n,a),o===vC&&i&&(o=bl.inflateSetDictionary(n,i),o===n0?o=bl.inflate(n,a):o===eR&&(o=vC));n.avail_in>0&&o===yC&&n.state.wrap>0&&e[n.next_in]!==0;)bl.inflateReset(n),o=bl.inflate(n,a);switch(o){case xfe:case eR:case vC:case wfe:return this.onEnd(o),this.ended=!0,!1}if(s=n.avail_out,n.next_out&&(n.avail_out===0||o===yC))if(this.options.to==="string"){let l=t0.utf8border(n.output,n.next_out),u=n.next_out-l,c=t0.buf2string(n.output,l);n.next_out=u,n.avail_out=r-u,u&&n.output.set(n.output.subarray(l,l+u),0),this.onData(c)}else this.onData(n.output.length===n.next_out?n.output:n.output.subarray(0,n.next_out));if(!(o===n0&&s===0)){if(o===yC)return o=bl.inflateEnd(this.strm),this.onEnd(o),this.ended=!0,!0;if(n.avail_in===0)break}}return!0};hy.prototype.onData=function(e){this.chunks.push(e)};hy.prototype.onEnd=function(e){e===n0&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=JS.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};function CT(e,t){const n=new hy(t);if(n.push(e),n.err)throw n.msg||Wh[n.err];return n.result}function Cfe(e,t){return t=t||{},t.raw=!0,CT(e,t)}var Efe=hy,kfe=CT,Tfe=Cfe,Afe=CT,Pfe=dy,Ife={Inflate:Efe,inflate:kfe,inflateRaw:Tfe,ungzip:Afe,constants:Pfe};const{Inflate:cGe,inflate:Rfe,inflateRaw:dGe,ungzip:fGe}=Ife;var Ez=Rfe;const kz=[];for(let e=0;e<256;e++){let t=e;for(let n=0;n<8;n++)t&1?t=3988292384^t>>>1:t=t>>>1;kz[e]=t}function Ofe(e){let t=-1;for(let n=0;n>>8;return t^-1}var Jn;(function(e){e[e.GRAYSCALE=0]="GRAYSCALE",e[e.TRUE_COLOR=2]="TRUE_COLOR",e[e.PALETTE=3]="PALETTE",e[e.GRAYSCALE_WITH_ALPHA=4]="GRAYSCALE_WITH_ALPHA",e[e.TRUE_COLOR_WITH_ALPHA=6]="TRUE_COLOR_WITH_ALPHA"})(Jn||(Jn={}));const Mfe={[Jn.GRAYSCALE]:1,[Jn.TRUE_COLOR]:3,[Jn.PALETTE]:1,[Jn.GRAYSCALE_WITH_ALPHA]:2,[Jn.TRUE_COLOR_WITH_ALPHA]:4},Nfe=1;var Vo;(function(e){e[e.NONE=0]="NONE",e[e.SUB=1]="SUB",e[e.UP=2]="UP",e[e.AVERAGE=3]="AVERAGE",e[e.PAETH=4]="PAETH"})(Vo||(Vo={}));const $fe={[Vo.NONE](e){return e},[Vo.SUB](e,t){const n=new Uint8Array(e.length);for(let r=0;r>1;r[i]=e[i]+s}return r},[Vo.PAETH](e,t,n){const r=new Uint8Array(e.length);for(let i=0;i>7&1,i>>6&1,i>>5&1,i>>4&1,i>>3&1,i>>2&1,i>>1&1,i&1)}else if(t===2){const i=e[r++];n.push(i>>6&3,i>>4&3,i>>2&3,i&3)}else if(t===4){const i=e[r++];n.push(i>>4&15,i&15)}else if(t===8){const i=e[r++];n.push(i)}else if(t===16)n.push(e[r++]<<8|e[r++]);else throw new Error("Unsupported depth: "+t);return n}const Az=[{x:[0],y:[0]},{x:[4],y:[0]},{x:[0,4],y:[4]},{x:[2,6],y:[0,4]},{x:[0,2,4,6],y:[2,6]},{x:[1,3,5,7],y:[0,2,4,6]},{x:[0,1,2,3,4,5,6,7],y:[1,3,5,7]}];function Lfe(e,t,n){if(!e)return[{passWidth:t,passHeight:n,passIndex:0}];const r=[];return Az.forEach(function({x:i,y:o},a){const s=t%8,l=n%8,u=t-s>>3,c=n-l>>3;let d=u*i.length;for(let h=0;h>3||1;let p=0,m=new Uint8Array;for(let _=0;_>3)+Nfe,w=u[p];if(!(w in Vo))throw new Error("Unsupported filter type: "+w);const x=$fe[w],C=x(u.slice(p+1,p+S),h,m);m=C;let T=0;const k=Dfe(C,o);for(let $=0;$127)if(r>191&&r<224){if(t>=e.length)throw new Error("UTF-8 decode: incomplete 2-byte sequence");r=(r&31)<<6|e[t++]&63}else if(r>223&&r<240){if(t+1>=e.length)throw new Error("UTF-8 decode: incomplete 3-byte sequence");r=(r&15)<<12|(e[t++]&63)<<6|e[t++]&63}else if(r>239&&r<248){if(t+2>=e.length)throw new Error("UTF-8 decode: incomplete 4-byte sequence");r=(r&7)<<18|(e[t++]&63)<<12|(e[t++]&63)<<6|e[t++]&63}else throw new Error("UTF-8 decode: unknown multibyte start 0x"+r.toString(16)+" at index "+(t-1));if(r<=65535)n+=String.fromCharCode(r);else if(r<=1114111)r-=65536,n+=String.fromCharCode(r>>10|55296),n+=String.fromCharCode(r&1023|56320);else throw new Error("UTF-8 decode: code point 0x"+r.toString(16)+" exceeds UTF-16 reach")}return n}function jfe(e,t){const n=new Uint8Array(e.length+t.length);return n.set(e),n.set(t,e.length),n}const au=1e5;function Ufe(e){const t=new Uint8Array(e);let n=new Uint8Array;const r={width:0,height:0,depth:0,colorType:0,compression:0,interlace:0,filter:0,data:[]};let i=0;function o(){return t[i++]<<24|t[i++]<<16|t[i++]<<8|t[i++]}function a(){return t[i++]<<8|t[i++]}function s(){return t[i++]}function l(){const M=[];let R=0;for(;(R=t[i++])!==0;)M.push(R);return new Uint8Array(M)}function u(M){const R=i+M;let N="";for(;i=0&&tR.call(t.callee)==="[object Function]"),r},SC,nR;function qfe(){if(nR)return SC;nR=1;var e;if(!Object.keys){var t=Object.prototype.hasOwnProperty,n=Object.prototype.toString,r=Iz,i=Object.prototype.propertyIsEnumerable,o=!i.call({toString:null},"toString"),a=i.call(function(){},"prototype"),s=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],l=function(f){var h=f.constructor;return h&&h.prototype===f},u={$applicationCache:!0,$console:!0,$external:!0,$frame:!0,$frameElement:!0,$frames:!0,$innerHeight:!0,$innerWidth:!0,$onmozfullscreenchange:!0,$onmozfullscreenerror:!0,$outerHeight:!0,$outerWidth:!0,$pageXOffset:!0,$pageYOffset:!0,$parent:!0,$scrollLeft:!0,$scrollTop:!0,$scrollX:!0,$scrollY:!0,$self:!0,$webkitIndexedDB:!0,$webkitStorageInfo:!0,$window:!0},c=function(){if(typeof window>"u")return!1;for(var f in window)try{if(!u["$"+f]&&t.call(window,f)&&window[f]!==null&&typeof window[f]=="object")try{l(window[f])}catch{return!0}}catch{return!0}return!1}(),d=function(f){if(typeof window>"u"||!c)return l(f);try{return l(f)}catch{return!1}};e=function(h){var p=h!==null&&typeof h=="object",m=n.call(h)==="[object Function]",_=r(h),b=p&&n.call(h)==="[object String]",v=[];if(!p&&!m&&!_)throw new TypeError("Object.keys called on a non-object");var g=a&&m;if(b&&h.length>0&&!t.call(h,0))for(var y=0;y0)for(var S=0;S"u"||!oi?$t:oi(Uint8Array),pd={"%AggregateError%":typeof AggregateError>"u"?$t:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?$t:ArrayBuffer,"%ArrayIteratorPrototype%":df&&oi?oi([][Symbol.iterator]()):$t,"%AsyncFromSyncIteratorPrototype%":$t,"%AsyncFunction%":Cf,"%AsyncGenerator%":Cf,"%AsyncGeneratorFunction%":Cf,"%AsyncIteratorPrototype%":Cf,"%Atomics%":typeof Atomics>"u"?$t:Atomics,"%BigInt%":typeof BigInt>"u"?$t:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?$t:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?$t:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?$t:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":typeof Float32Array>"u"?$t:Float32Array,"%Float64Array%":typeof Float64Array>"u"?$t:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?$t:FinalizationRegistry,"%Function%":Oz,"%GeneratorFunction%":Cf,"%Int8Array%":typeof Int8Array>"u"?$t:Int8Array,"%Int16Array%":typeof Int16Array>"u"?$t:Int16Array,"%Int32Array%":typeof Int32Array>"u"?$t:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":df&&oi?oi(oi([][Symbol.iterator]())):$t,"%JSON%":typeof JSON=="object"?JSON:$t,"%Map%":typeof Map>"u"?$t:Map,"%MapIteratorPrototype%":typeof Map>"u"||!df||!oi?$t:oi(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?$t:Promise,"%Proxy%":typeof Proxy>"u"?$t:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":typeof Reflect>"u"?$t:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?$t:Set,"%SetIteratorPrototype%":typeof Set>"u"||!df||!oi?$t:oi(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?$t:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":df&&oi?oi(""[Symbol.iterator]()):$t,"%Symbol%":df?Symbol:$t,"%SyntaxError%":Xh,"%ThrowTypeError%":lhe,"%TypedArray%":che,"%TypeError%":hh,"%Uint8Array%":typeof Uint8Array>"u"?$t:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?$t:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?$t:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?$t:Uint32Array,"%URIError%":URIError,"%WeakMap%":typeof WeakMap>"u"?$t:WeakMap,"%WeakRef%":typeof WeakRef>"u"?$t:WeakRef,"%WeakSet%":typeof WeakSet>"u"?$t:WeakSet};if(oi)try{null.error}catch(e){var dhe=oi(oi(e));pd["%Error.prototype%"]=dhe}var fhe=function e(t){var n;if(t==="%AsyncFunction%")n=wC("async function () {}");else if(t==="%GeneratorFunction%")n=wC("function* () {}");else if(t==="%AsyncGeneratorFunction%")n=wC("async function* () {}");else if(t==="%AsyncGenerator%"){var r=e("%AsyncGeneratorFunction%");r&&(n=r.prototype)}else if(t==="%AsyncIteratorPrototype%"){var i=e("%AsyncGenerator%");i&&oi&&(n=oi(i.prototype))}return pd[t]=n,n},sR={"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},py=Rz,h_=she,hhe=py.call(Function.call,Array.prototype.concat),phe=py.call(Function.apply,Array.prototype.splice),lR=py.call(Function.call,String.prototype.replace),p_=py.call(Function.call,String.prototype.slice),ghe=py.call(Function.call,RegExp.prototype.exec),mhe=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,yhe=/\\(\\)?/g,vhe=function(t){var n=p_(t,0,1),r=p_(t,-1);if(n==="%"&&r!=="%")throw new Xh("invalid intrinsic syntax, expected closing `%`");if(r==="%"&&n!=="%")throw new Xh("invalid intrinsic syntax, expected opening `%`");var i=[];return lR(t,mhe,function(o,a,s,l){i[i.length]=s?lR(l,yhe,"$1"):a||o}),i},bhe=function(t,n){var r=t,i;if(h_(sR,r)&&(i=sR[r],r="%"+i[0]+"%"),h_(pd,r)){var o=pd[r];if(o===Cf&&(o=fhe(r)),typeof o>"u"&&!n)throw new hh("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:i,name:r,value:o}}throw new Xh("intrinsic "+t+" does not exist!")},_he=function(t,n){if(typeof t!="string"||t.length===0)throw new hh("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof n!="boolean")throw new hh('"allowMissing" argument must be a boolean');if(ghe(/^%?[^%]*%?$/,t)===null)throw new Xh("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var r=vhe(t),i=r.length>0?r[0]:"",o=bhe("%"+i+"%",n),a=o.name,s=o.value,l=!1,u=o.alias;u&&(i=u[0],phe(r,hhe([0,1],u)));for(var c=1,d=!0;c=r.length){var m=hd(s,f);d=!!m,d&&"get"in m&&!("originalValue"in m.get)?s=m.get:s=s[f]}else d=h_(s,f),s=s[f];d&&!l&&(pd[a]=s)}}return s},She=_he,hE=She("%Object.defineProperty%",!0),pE=function(){if(hE)try{return hE({},"a",{value:1}),!0}catch{return!1}return!1};pE.hasArrayLengthDefineBug=function(){if(!pE())return null;try{return hE([],"length",{value:1}).length!==1}catch{return!0}};var xhe=pE,whe=Qfe,Che=typeof Symbol=="function"&&typeof Symbol("foo")=="symbol",Ehe=Object.prototype.toString,khe=Array.prototype.concat,Mz=Object.defineProperty,The=function(e){return typeof e=="function"&&Ehe.call(e)==="[object Function]"},Ahe=xhe(),Nz=Mz&&Ahe,Phe=function(e,t,n,r){if(t in e){if(r===!0){if(e[t]===n)return}else if(!The(r)||!r())return}Nz?Mz(e,t,{configurable:!0,enumerable:!1,value:n,writable:!0}):e[t]=n},$z=function(e,t){var n=arguments.length>2?arguments[2]:{},r=whe(t);Che&&(r=khe.call(r,Object.getOwnPropertySymbols(t)));for(var i=0;i":return t>e;case":<":return t=":return t>=e;case":<=":return t<=e;default:throw new Error("Unimplemented comparison operator: ".concat(n))}};l2.testComparisonRange=Xhe;var u2={};Object.defineProperty(u2,"__esModule",{value:!0});u2.testRange=void 0;var Yhe=function(e,t){return typeof e=="number"?!(et.max||e===t.max&&!t.maxInclusive):!1};u2.testRange=Yhe;(function(e){var t=mt&&mt.__assign||function(){return t=Object.assign||function(c){for(var d,f=1,h=arguments.length;f0?{path:l.path,query:new RegExp("("+l.keywords.map(function(u){return(0,epe.escapeRegexString)(u.trim())}).join("|")+")")}:{path:l.path}})};c2.highlight=npe;var d2={},Uz={exports:{}};(function(e){(function(t,n){e.exports?e.exports=n():t.nearley=n()})(mt,function(){function t(u,c,d){return this.id=++t.highestId,this.name=u,this.symbols=c,this.postprocess=d,this}t.highestId=0,t.prototype.toString=function(u){var c=typeof u>"u"?this.symbols.map(l).join(" "):this.symbols.slice(0,u).map(l).join(" ")+" ● "+this.symbols.slice(u).map(l).join(" ");return this.name+" → "+c};function n(u,c,d,f){this.rule=u,this.dot=c,this.reference=d,this.data=[],this.wantedBy=f,this.isComplete=this.dot===u.symbols.length}n.prototype.toString=function(){return"{"+this.rule.toString(this.dot)+"}, from: "+(this.reference||0)},n.prototype.nextState=function(u){var c=new n(this.rule,this.dot+1,this.reference,this.wantedBy);return c.left=this,c.right=u,c.isComplete&&(c.data=c.build(),c.right=void 0),c},n.prototype.build=function(){var u=[],c=this;do u.push(c.right.data),c=c.left;while(c.left);return u.reverse(),u},n.prototype.finish=function(){this.rule.postprocess&&(this.data=this.rule.postprocess(this.data,this.reference,a.fail))};function r(u,c){this.grammar=u,this.index=c,this.states=[],this.wants={},this.scannable=[],this.completed={}}r.prototype.process=function(u){for(var c=this.states,d=this.wants,f=this.completed,h=0;h0&&c.push(" ^ "+f+" more lines identical to this"),f=0,c.push(" "+m)),d=m}},a.prototype.getSymbolDisplay=function(u){return s(u)},a.prototype.buildFirstStateStack=function(u,c){if(c.indexOf(u)!==-1)return null;if(u.wantedBy.length===0)return[u];var d=u.wantedBy[0],f=[u].concat(c),h=this.buildFirstStateStack(d,f);return h===null?null:[u].concat(h)},a.prototype.save=function(){var u=this.table[this.current];return u.lexerState=this.lexerState,u},a.prototype.restore=function(u){var c=u.index;this.current=c,this.table[c]=u,this.table.splice(c+1),this.lexerState=u.lexerState,this.results=this.finish()},a.prototype.rewind=function(u){if(!this.options.keepHistory)throw new Error("set option `keepHistory` to enable rewinding");this.restore(this.table[u])},a.prototype.finish=function(){var u=[],c=this.grammar.start,d=this.table[this.table.length-1];return d.states.forEach(function(f){f.rule.name===c&&f.dot===f.rule.symbols.length&&f.reference===0&&f.data!==a.fail&&u.push(f)}),u.map(function(f){return f.data})};function s(u){var c=typeof u;if(c==="string")return u;if(c==="object"){if(u.literal)return JSON.stringify(u.literal);if(u instanceof RegExp)return"character matching "+u;if(u.type)return u.type+" token";if(u.test)return"token matching "+String(u.test);throw new Error("Unknown symbol type: "+u)}}function l(u){var c=typeof u;if(c==="string")return u;if(c==="object"){if(u.literal)return JSON.stringify(u.literal);if(u instanceof RegExp)return u.toString();if(u.type)return"%"+u.type;if(u.test)return"<"+String(u.test)+">";throw new Error("Unknown symbol type: "+u)}}return{Parser:a,Grammar:i,Rule:t}})})(Uz);var rpe=Uz.exports,Rd={},Vz={},_c={};_c.__esModule=void 0;_c.__esModule=!0;var ipe=typeof Object.setPrototypeOf=="function",ope=typeof Object.getPrototypeOf=="function",ape=typeof Object.defineProperty=="function",spe=typeof Object.create=="function",lpe=typeof Object.prototype.hasOwnProperty=="function",upe=function(t,n){ipe?Object.setPrototypeOf(t,n):t.__proto__=n};_c.setPrototypeOf=upe;var cpe=function(t){return ope?Object.getPrototypeOf(t):t.__proto__||t.prototype};_c.getPrototypeOf=cpe;var uR=!1,dpe=function e(t,n,r){if(ape&&!uR)try{Object.defineProperty(t,n,r)}catch{uR=!0,e(t,n,r)}else t[n]=r.value};_c.defineProperty=dpe;var Gz=function(t,n){return lpe?t.hasOwnProperty(t,n):t[n]===void 0};_c.hasOwnProperty=Gz;var fpe=function(t,n){if(spe)return Object.create(t,n);var r=function(){};r.prototype=t;var i=new r;if(typeof n>"u")return i;if(typeof n=="null")throw new Error("PropertyDescriptors must not be null.");if(typeof n=="object")for(var o in n)Gz(n,o)&&(i[o]=n[o].value);return i};_c.objectCreate=fpe;(function(e){e.__esModule=void 0,e.__esModule=!0;var t=_c,n=t.setPrototypeOf,r=t.getPrototypeOf,i=t.defineProperty,o=t.objectCreate,a=new Error().toString()==="[object Error]",s="";function l(u){var c=this.constructor,d=c.name||function(){var _=c.toString().match(/^function\s*([^\s(]+)/);return _===null?s||"Error":_[1]}(),f=d==="Error",h=f?s:d,p=Error.apply(this,arguments);if(n(p,r(this)),!(p instanceof c)||!(p instanceof l)){var p=this;Error.apply(this,arguments),i(p,"message",{configurable:!0,enumerable:!1,value:u,writable:!0})}if(i(p,"name",{configurable:!0,enumerable:!1,value:h,writable:!0}),Error.captureStackTrace&&Error.captureStackTrace(p,f?l:c),p.stack===void 0){var m=new Error(u);m.name=p.name,p.stack=m.stack}return a&&i(p,"toString",{configurable:!0,enumerable:!1,value:function(){return(this.name||"Error")+(typeof this.message>"u"?"":": "+this.message)},writable:!0}),p}s=l.name||"ExtendableError",l.prototype=o(Error.prototype,{constructor:{value:Error,enumerable:!1,writable:!0,configurable:!0}}),e.ExtendableError=l,e.default=e.ExtendableError})(Vz);var Hz=mt&&mt.__extends||function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(r[o]=i[o])},e(t,n)};return function(t,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}();Object.defineProperty(Rd,"__esModule",{value:!0});Rd.SyntaxError=Rd.LiqeError=void 0;var hpe=Vz,qz=function(e){Hz(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t}(hpe.ExtendableError);Rd.LiqeError=qz;var ppe=function(e){Hz(t,e);function t(n,r,i,o){var a=e.call(this,n)||this;return a.message=n,a.offset=r,a.line=i,a.column=o,a}return t}(qz);Rd.SyntaxError=ppe;var AT={},g_=mt&&mt.__assign||function(){return g_=Object.assign||function(e){for(var t,n=1,r=arguments.length;n"}],postprocess:function(e){return e.join("")}},{name:"comparison_operator$subexpression$1",symbols:["comparison_operator$subexpression$1$string$2"]},{name:"comparison_operator$subexpression$1$string$3",symbols:[{literal:":"},{literal:"<"}],postprocess:function(e){return e.join("")}},{name:"comparison_operator$subexpression$1",symbols:["comparison_operator$subexpression$1$string$3"]},{name:"comparison_operator$subexpression$1$string$4",symbols:[{literal:":"},{literal:">"},{literal:"="}],postprocess:function(e){return e.join("")}},{name:"comparison_operator$subexpression$1",symbols:["comparison_operator$subexpression$1$string$4"]},{name:"comparison_operator$subexpression$1$string$5",symbols:[{literal:":"},{literal:"<"},{literal:"="}],postprocess:function(e){return e.join("")}},{name:"comparison_operator$subexpression$1",symbols:["comparison_operator$subexpression$1$string$5"]},{name:"comparison_operator",symbols:["comparison_operator$subexpression$1"],postprocess:function(e,t){return{location:{start:t,end:t+e[0][0].length},type:"ComparisonOperator",operator:e[0][0]}}},{name:"regex",symbols:["regex_body","regex_flags"],postprocess:function(e){return e.join("")}},{name:"regex_body$ebnf$1",symbols:[]},{name:"regex_body$ebnf$1",symbols:["regex_body$ebnf$1","regex_body_char"],postprocess:function(e){return e[0].concat([e[1]])}},{name:"regex_body",symbols:[{literal:"/"},"regex_body$ebnf$1",{literal:"/"}],postprocess:function(e){return"/"+e[1].join("")+"/"}},{name:"regex_body_char",symbols:[/[^\\]/],postprocess:ul},{name:"regex_body_char",symbols:[{literal:"\\"},/[^\\]/],postprocess:function(e){return"\\"+e[1]}},{name:"regex_flags",symbols:[]},{name:"regex_flags$ebnf$1",symbols:[/[gmiyusd]/]},{name:"regex_flags$ebnf$1",symbols:["regex_flags$ebnf$1",/[gmiyusd]/],postprocess:function(e){return e[0].concat([e[1]])}},{name:"regex_flags",symbols:["regex_flags$ebnf$1"],postprocess:function(e){return e[0].join("")}},{name:"unquoted_value$ebnf$1",symbols:[]},{name:"unquoted_value$ebnf$1",symbols:["unquoted_value$ebnf$1",/[a-zA-Z\.\-_*@#$]/],postprocess:function(e){return e[0].concat([e[1]])}},{name:"unquoted_value",symbols:[/[a-zA-Z_*@#$]/,"unquoted_value$ebnf$1"],postprocess:function(e){return e[0]+e[1].join("")}}],ParserStart:"main"};AT.default=gpe;var Wz={},f2={},yy={};Object.defineProperty(yy,"__esModule",{value:!0});yy.isSafePath=void 0;var mpe=/^(\.(?:[_a-zA-Z][a-zA-Z\d_]*|\0|[1-9]\d*))+$/u,ype=function(e){return mpe.test(e)};yy.isSafePath=ype;Object.defineProperty(f2,"__esModule",{value:!0});f2.createGetValueFunctionBody=void 0;var vpe=yy,bpe=function(e){if(!(0,vpe.isSafePath)(e))throw new Error("Unsafe path.");var t="return subject"+e;return t.replace(/(\.(\d+))/g,".[$2]").replace(/\./g,"?.")};f2.createGetValueFunctionBody=bpe;(function(e){var t=mt&&mt.__assign||function(){return t=Object.assign||function(o){for(var a,s=1,l=arguments.length;s\d+) col (?\d+)/,Epe=function(e){if(e.trim()==="")return{location:{end:0,start:0},type:"EmptyExpression"};var t=new Qz.default.Parser(wpe),n;try{n=t.feed(e).results}catch(o){if(typeof(o==null?void 0:o.message)=="string"&&typeof(o==null?void 0:o.offset)=="number"){var r=o.message.match(Cpe);throw r?new _pe.SyntaxError("Syntax error at line ".concat(r.groups.line," column ").concat(r.groups.column),o.offset,Number(r.groups.line),Number(r.groups.column)):o}throw o}if(n.length===0)throw new Error("Found no parsings.");if(n.length>1)throw new Error("Ambiguous results.");var i=(0,xpe.hydrateAst)(n[0]);return i};d2.parse=Epe;var h2={};Object.defineProperty(h2,"__esModule",{value:!0});h2.test=void 0;var kpe=gy,Tpe=function(e,t){return(0,kpe.filter)(e,[t]).length===1};h2.test=Tpe;var Xz={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.serialize=void 0;var t=function(o,a){return a==="double"?'"'.concat(o,'"'):a==="single"?"'".concat(o,"'"):o},n=function(o){if(o.type==="LiteralExpression")return o.quoted&&typeof o.value=="string"?t(o.value,o.quotes):String(o.value);if(o.type==="RegexExpression")return String(o.value);if(o.type==="RangeExpression"){var a=o.range,s=a.min,l=a.max,u=a.minInclusive,c=a.maxInclusive;return"".concat(u?"[":"{").concat(s," TO ").concat(l).concat(c?"]":"}")}if(o.type==="EmptyExpression")return"";throw new Error("Unexpected AST type.")},r=function(o){if(o.type!=="Tag")throw new Error("Expected a tag expression.");var a=o.field,s=o.expression,l=o.operator;if(a.type==="ImplicitField")return n(s);var u=a.quoted?t(a.name,a.quotes):a.name,c=" ".repeat(s.location.start-l.location.end);return u+l.operator+c+n(s)},i=function(o){if(o.type==="ParenthesizedExpression"){if(!("location"in o.expression))throw new Error("Expected location in expression.");if(!o.location.end)throw new Error("Expected location end.");var a=" ".repeat(o.expression.location.start-(o.location.start+1)),s=" ".repeat(o.location.end-o.expression.location.end-1);return"(".concat(a).concat((0,e.serialize)(o.expression)).concat(s,")")}if(o.type==="Tag")return r(o);if(o.type==="LogicalExpression"){var l="";return o.operator.type==="BooleanOperator"?(l+=" ".repeat(o.operator.location.start-o.left.location.end),l+=o.operator.operator,l+=" ".repeat(o.right.location.start-o.operator.location.end)):l=" ".repeat(o.right.location.start-o.left.location.end),"".concat((0,e.serialize)(o.left)).concat(l).concat((0,e.serialize)(o.right))}if(o.type==="UnaryOperator")return(o.operator==="NOT"?"NOT ":o.operator)+(0,e.serialize)(o.operand);if(o.type==="EmptyExpression")return"";throw new Error("Unexpected AST type.")};e.serialize=i})(Xz);var p2={};Object.defineProperty(p2,"__esModule",{value:!0});p2.isSafeUnquotedExpression=void 0;var Ape=function(e){return/^[#$*@A-Z_a-z][#$*.@A-Z_a-z-]*$/.test(e)};p2.isSafeUnquotedExpression=Ape;(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.isSafeUnquotedExpression=e.serialize=e.SyntaxError=e.LiqeError=e.test=e.parse=e.highlight=e.filter=void 0;var t=gy;Object.defineProperty(e,"filter",{enumerable:!0,get:function(){return t.filter}});var n=c2;Object.defineProperty(e,"highlight",{enumerable:!0,get:function(){return n.highlight}});var r=d2;Object.defineProperty(e,"parse",{enumerable:!0,get:function(){return r.parse}});var i=h2;Object.defineProperty(e,"test",{enumerable:!0,get:function(){return i.test}});var o=Rd;Object.defineProperty(e,"LiqeError",{enumerable:!0,get:function(){return o.LiqeError}}),Object.defineProperty(e,"SyntaxError",{enumerable:!0,get:function(){return o.SyntaxError}});var a=Xz;Object.defineProperty(e,"serialize",{enumerable:!0,get:function(){return a.serialize}});var s=p2;Object.defineProperty(e,"isSafeUnquotedExpression",{enumerable:!0,get:function(){return s.isSafeUnquotedExpression}})})(jz);var vy={},Yz={},Od={};Object.defineProperty(Od,"__esModule",{value:!0});Od.ROARR_LOG_FORMAT_VERSION=Od.ROARR_VERSION=void 0;Od.ROARR_VERSION="5.0.0";Od.ROARR_LOG_FORMAT_VERSION="2.0.0";var by={};Object.defineProperty(by,"__esModule",{value:!0});by.logLevels=void 0;by.logLevels={debug:20,error:50,fatal:60,info:30,trace:10,warn:40};var Zz={},g2={};Object.defineProperty(g2,"__esModule",{value:!0});g2.hasOwnProperty=void 0;const Ppe=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);g2.hasOwnProperty=Ppe;(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.hasOwnProperty=void 0;var t=g2;Object.defineProperty(e,"hasOwnProperty",{enumerable:!0,get:function(){return t.hasOwnProperty}})})(Zz);var Jz={},m2={},y2={};Object.defineProperty(y2,"__esModule",{value:!0});y2.tokenize=void 0;const Ipe=/(?:%(?([+0-]|-\+))?(?\d+)?(?\d+\$)?(?\.\d+)?(?[%BCESb-iosux]))|(\\%)/g,Rpe=e=>{let t;const n=[];let r=0,i=0,o=null;for(;(t=Ipe.exec(e))!==null;){t.index>i&&(o={literal:e.slice(i,t.index),type:"literal"},n.push(o));const a=t[0];i=t.index+a.length,a==="\\%"||a==="%%"?o&&o.type==="literal"?o.literal+="%":(o={literal:"%",type:"literal"},n.push(o)):t.groups&&(o={conversion:t.groups.conversion,flag:t.groups.flag||null,placeholder:a,position:t.groups.position?Number.parseInt(t.groups.position,10)-1:r++,precision:t.groups.precision?Number.parseInt(t.groups.precision.slice(1),10):null,type:"placeholder",width:t.groups.width?Number.parseInt(t.groups.width,10):null},n.push(o))}return i<=e.length-1&&(o&&o.type==="literal"?o.literal+=e.slice(i):n.push({literal:e.slice(i),type:"literal"})),n};y2.tokenize=Rpe;Object.defineProperty(m2,"__esModule",{value:!0});m2.createPrintf=void 0;const cR=ET,Ope=y2,Mpe=(e,t)=>t.placeholder,Npe=e=>{var t;const n=(o,a,s)=>s==="-"?o.padEnd(a," "):s==="-+"?((Number(o)>=0?"+":"")+o).padEnd(a," "):s==="+"?((Number(o)>=0?"+":"")+o).padStart(a," "):s==="0"?o.padStart(a,"0"):o.padStart(a," "),r=(t=e==null?void 0:e.formatUnboundExpression)!==null&&t!==void 0?t:Mpe,i={};return(o,...a)=>{let s=i[o];s||(s=i[o]=Ope.tokenize(o));let l="";for(const u of s)if(u.type==="literal")l+=u.literal;else{let c=a[u.position];if(c===void 0)l+=r(o,u,a);else if(u.conversion==="b")l+=cR.boolean(c)?"true":"false";else if(u.conversion==="B")l+=cR.boolean(c)?"TRUE":"FALSE";else if(u.conversion==="c")l+=c;else if(u.conversion==="C")l+=String(c).toUpperCase();else if(u.conversion==="i"||u.conversion==="d")c=String(Math.trunc(c)),u.width!==null&&(c=n(c,u.width,u.flag)),l+=c;else if(u.conversion==="e")l+=Number(c).toExponential();else if(u.conversion==="E")l+=Number(c).toExponential().toUpperCase();else if(u.conversion==="f")u.precision!==null&&(c=Number(c).toFixed(u.precision)),u.width!==null&&(c=n(String(c),u.width,u.flag)),l+=c;else if(u.conversion==="o")l+=(Number.parseInt(String(c),10)>>>0).toString(8);else if(u.conversion==="s")u.width!==null&&(c=n(String(c),u.width,u.flag)),l+=c;else if(u.conversion==="S")u.width!==null&&(c=n(String(c),u.width,u.flag)),l+=String(c).toUpperCase();else if(u.conversion==="u")l+=Number.parseInt(String(c),10)>>>0;else if(u.conversion==="x")c=(Number.parseInt(String(c),10)>>>0).toString(16),u.width!==null&&(c=n(String(c),u.width,u.flag)),l+=c;else throw new Error("Unknown format specifier.")}return l}};m2.createPrintf=Npe;(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.printf=e.createPrintf=void 0;const t=m2;Object.defineProperty(e,"createPrintf",{enumerable:!0,get:function(){return t.createPrintf}}),e.printf=t.createPrintf()})(Jz);var gE={exports:{}};(function(e,t){const{hasOwnProperty:n}=Object.prototype,r=_();r.configure=_,r.stringify=r,r.default=r,t.stringify=r,t.configure=_,e.exports=r;const i=/[\u0000-\u001f\u0022\u005c\ud800-\udfff]|[\ud800-\udbff](?![\udc00-\udfff])|(?:[^\ud800-\udbff]|^)[\udc00-\udfff]/;function o(b){return b.length<5e3&&!i.test(b)?`"${b}"`:JSON.stringify(b)}function a(b){if(b.length>200)return b.sort();for(let v=1;vg;)b[y]=b[y-1],y--;b[y]=g}return b}const s=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(Object.getPrototypeOf(new Int8Array)),Symbol.toStringTag).get;function l(b){return s.call(b)!==void 0&&b.length!==0}function u(b,v,g){b.length= 1`)}return g===void 0?1/0:g}function h(b){return b===1?"1 item":`${b} items`}function p(b){const v=new Set;for(const g of b)(typeof g=="string"||typeof g=="number")&&v.add(String(g));return v}function m(b){if(n.call(b,"strict")){const v=b.strict;if(typeof v!="boolean")throw new TypeError('The "strict" argument must be of type boolean');if(v)return g=>{let y=`Object can not safely be stringified. Received type ${typeof g}`;throw typeof g!="function"&&(y+=` (${g.toString()})`),new Error(y)}}}function _(b){b={...b};const v=m(b);v&&(b.bigint===void 0&&(b.bigint=!1),"circularValue"in b||(b.circularValue=Error));const g=c(b),y=d(b,"bigint"),S=d(b,"deterministic"),w=f(b,"maximumDepth"),x=f(b,"maximumBreadth");function C(O,E,A,D,L,M){let R=E[O];switch(typeof R=="object"&&R!==null&&typeof R.toJSON=="function"&&(R=R.toJSON(O)),R=D.call(E,O,R),typeof R){case"string":return o(R);case"object":{if(R===null)return"null";if(A.indexOf(R)!==-1)return g;let N="",B=",";const U=M;if(Array.isArray(R)){if(R.length===0)return"[]";if(wx){const ve=R.length-x-1;N+=`${B}"... ${h(ve)} not stringified"`}return L!==""&&(N+=` -${U}`),A.pop(),`[${N}]`}let G=Object.keys(R);const Y=G.length;if(Y===0)return"{}";if(wx){const Q=Y-x;N+=`${J}"...":${ee}"${h(Q)} not stringified"`,J=B}return L!==""&&J.length>1&&(N=` -${M}${N} -${U}`),A.pop(),`{${N}}`}case"number":return isFinite(R)?String(R):v?v(R):"null";case"boolean":return R===!0?"true":"false";case"undefined":return;case"bigint":if(y)return String(R);default:return v?v(R):void 0}}function T(O,E,A,D,L,M){switch(typeof E=="object"&&E!==null&&typeof E.toJSON=="function"&&(E=E.toJSON(O)),typeof E){case"string":return o(E);case"object":{if(E===null)return"null";if(A.indexOf(E)!==-1)return g;const R=M;let N="",B=",";if(Array.isArray(E)){if(E.length===0)return"[]";if(wx){const j=E.length-x-1;N+=`${B}"... ${h(j)} not stringified"`}return L!==""&&(N+=` -${R}`),A.pop(),`[${N}]`}A.push(E);let U="";L!==""&&(M+=L,B=`, -${M}`,U=" ");let G="";for(const Y of D){const ee=T(Y,E[Y],A,D,L,M);ee!==void 0&&(N+=`${G}${o(Y)}:${U}${ee}`,G=B)}return L!==""&&G.length>1&&(N=` -${M}${N} -${R}`),A.pop(),`{${N}}`}case"number":return isFinite(E)?String(E):v?v(E):"null";case"boolean":return E===!0?"true":"false";case"undefined":return;case"bigint":if(y)return String(E);default:return v?v(E):void 0}}function k(O,E,A,D,L){switch(typeof E){case"string":return o(E);case"object":{if(E===null)return"null";if(typeof E.toJSON=="function"){if(E=E.toJSON(O),typeof E!="object")return k(O,E,A,D,L);if(E===null)return"null"}if(A.indexOf(E)!==-1)return g;const M=L;if(Array.isArray(E)){if(E.length===0)return"[]";if(wx){const se=E.length-x-1;ee+=`${J}"... ${h(se)} not stringified"`}return ee+=` -${M}`,A.pop(),`[${ee}]`}let R=Object.keys(E);const N=R.length;if(N===0)return"{}";if(wx){const ee=N-x;U+=`${G}"...": "${h(ee)} not stringified"`,G=B}return G!==""&&(U=` -${L}${U} -${M}`),A.pop(),`{${U}}`}case"number":return isFinite(E)?String(E):v?v(E):"null";case"boolean":return E===!0?"true":"false";case"undefined":return;case"bigint":if(y)return String(E);default:return v?v(E):void 0}}function P(O,E,A){switch(typeof E){case"string":return o(E);case"object":{if(E===null)return"null";if(typeof E.toJSON=="function"){if(E=E.toJSON(O),typeof E!="object")return P(O,E,A);if(E===null)return"null"}if(A.indexOf(E)!==-1)return g;let D="";if(Array.isArray(E)){if(E.length===0)return"[]";if(wx){const Y=E.length-x-1;D+=`,"... ${h(Y)} not stringified"`}return A.pop(),`[${D}]`}let L=Object.keys(E);const M=L.length;if(M===0)return"{}";if(wx){const B=M-x;D+=`${R}"...":"${h(B)} not stringified"`}return A.pop(),`{${D}}`}case"number":return isFinite(E)?String(E):v?v(E):"null";case"boolean":return E===!0?"true":"false";case"undefined":return;case"bigint":if(y)return String(E);default:return v?v(E):void 0}}function $(O,E,A){if(arguments.length>1){let D="";if(typeof A=="number"?D=" ".repeat(Math.min(A,10)):typeof A=="string"&&(D=A.slice(0,10)),E!=null){if(typeof E=="function")return C("",{"":O},[],E,D,"");if(Array.isArray(E))return T("",O,[],p(E),D,"")}if(D.length!==0)return k("",O,[],D,"")}return P("",O,[])}return $}})(gE,gE.exports);var $pe=gE.exports;(function(e){var t=mt&&mt.__importDefault||function(g){return g&&g.__esModule?g:{default:g}};Object.defineProperty(e,"__esModule",{value:!0}),e.createLogger=void 0;const n=Od,r=by,i=Zz,o=Jz,a=t(kT),s=t($pe);let l=!1;const u=(0,a.default)(),c=()=>u.ROARR,d=()=>({messageContext:{},transforms:[]}),f=()=>{const g=c().asyncLocalStorage;if(!g)throw new Error("AsyncLocalContext is unavailable.");const y=g.getStore();return y||d()},h=()=>!!c().asyncLocalStorage,p=()=>{if(h()){const g=f();return(0,i.hasOwnProperty)(g,"sequenceRoot")&&(0,i.hasOwnProperty)(g,"sequence")&&typeof g.sequence=="number"?String(g.sequenceRoot)+"."+String(g.sequence++):String(c().sequence++)}return String(c().sequence++)},m=(g,y)=>(S,w,x,C,T,k,P,$,O,E)=>{g.child({logLevel:y})(S,w,x,C,T,k,P,$,O,E)},_=1e3,b=(g,y)=>(S,w,x,C,T,k,P,$,O,E)=>{const A=(0,s.default)({a:S,b:w,c:x,d:C,e:T,f:k,g:P,h:$,i:O,j:E,logLevel:y});if(!A)throw new Error("Expected key to be a string");const D=c().onceLog;D.has(A)||(D.add(A),D.size>_&&D.clear(),g.child({logLevel:y})(S,w,x,C,T,k,P,$,O,E))},v=(g,y={},S=[])=>{const w=(x,C,T,k,P,$,O,E,A,D)=>{const L=Date.now(),M=p();let R;h()?R=f():R=d();let N,B;if(typeof x=="string"?N={...R.messageContext,...y}:N={...R.messageContext,...y,...x},typeof x=="string"&&C===void 0)B=x;else if(typeof x=="string"){if(!x.includes("%"))throw new Error("When a string parameter is followed by other arguments, then it is assumed that you are attempting to format a message using printf syntax. You either forgot to add printf bindings or if you meant to add context to the log message, pass them in an object as the first parameter.");B=(0,o.printf)(x,C,T,k,P,$,O,E,A,D)}else{let G=C;if(typeof C!="string")if(C===void 0)G="";else throw new TypeError("Message must be a string. Received "+typeof C+".");B=(0,o.printf)(G,T,k,P,$,O,E,A,D)}let U={context:N,message:B,sequence:M,time:L,version:n.ROARR_LOG_FORMAT_VERSION};for(const G of[...R.transforms,...S])if(U=G(U),typeof U!="object"||U===null)throw new Error("Message transform function must return a message object.");g(U)};return w.child=x=>{let C;return h()?C=f():C=d(),typeof x=="function"?(0,e.createLogger)(g,{...C.messageContext,...y,...x},[x,...S]):(0,e.createLogger)(g,{...C.messageContext,...y,...x},S)},w.getContext=()=>{let x;return h()?x=f():x=d(),{...x.messageContext,...y}},w.adopt=async(x,C)=>{if(!h())return l===!1&&(l=!0,g({context:{logLevel:r.logLevels.warn,package:"roarr"},message:"async_hooks are unavailable; Roarr.adopt will not function as expected",sequence:p(),time:Date.now(),version:n.ROARR_LOG_FORMAT_VERSION})),x();const T=f();let k;(0,i.hasOwnProperty)(T,"sequenceRoot")&&(0,i.hasOwnProperty)(T,"sequence")&&typeof T.sequence=="number"?k=T.sequenceRoot+"."+String(T.sequence++):k=String(c().sequence++);let P={...T.messageContext};const $=[...T.transforms];typeof C=="function"?$.push(C):P={...P,...C};const O=c().asyncLocalStorage;if(!O)throw new Error("Async local context unavailable.");return O.run({messageContext:P,sequence:0,sequenceRoot:k,transforms:$},()=>x())},w.debug=m(w,r.logLevels.debug),w.debugOnce=b(w,r.logLevels.debug),w.error=m(w,r.logLevels.error),w.errorOnce=b(w,r.logLevels.error),w.fatal=m(w,r.logLevels.fatal),w.fatalOnce=b(w,r.logLevels.fatal),w.info=m(w,r.logLevels.info),w.infoOnce=b(w,r.logLevels.info),w.trace=m(w,r.logLevels.trace),w.traceOnce=b(w,r.logLevels.trace),w.warn=m(w,r.logLevels.warn),w.warnOnce=b(w,r.logLevels.warn),w};e.createLogger=v})(Yz);var v2={},Dpe=function(t,n){for(var r=t.split("."),i=n.split("."),o=0;o<3;o++){var a=Number(r[o]),s=Number(i[o]);if(a>s)return 1;if(s>a)return-1;if(!isNaN(a)&&isNaN(s))return 1;if(isNaN(a)&&!isNaN(s))return-1}return 0},Lpe=mt&&mt.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(v2,"__esModule",{value:!0});v2.createRoarrInitialGlobalStateBrowser=void 0;const dR=Od,fR=Lpe(Dpe),Fpe=e=>{const t=(e.versions||[]).concat();return t.length>1&&t.sort(fR.default),t.includes(dR.ROARR_VERSION)||t.push(dR.ROARR_VERSION),t.sort(fR.default),{sequence:0,...e,versions:t}};v2.createRoarrInitialGlobalStateBrowser=Fpe;var b2={};Object.defineProperty(b2,"__esModule",{value:!0});b2.getLogLevelName=void 0;const Bpe=e=>e<=10?"trace":e<=20?"debug":e<=30?"info":e<=40?"warn":e<=50?"error":"fatal";b2.getLogLevelName=Bpe;(function(e){var t=mt&&mt.__importDefault||function(d){return d&&d.__esModule?d:{default:d}};Object.defineProperty(e,"__esModule",{value:!0}),e.getLogLevelName=e.logLevels=e.Roarr=e.ROARR=void 0;const n=Yz,r=v2,o=(0,t(kT).default)(),a=(0,r.createRoarrInitialGlobalStateBrowser)(o.ROARR||{});e.ROARR=a,o.ROARR=a;const s=d=>JSON.stringify(d),l=(0,n.createLogger)(d=>{var f;a.write&&a.write(((f=a.serializeMessage)!==null&&f!==void 0?f:s)(d))});e.Roarr=l;var u=by;Object.defineProperty(e,"logLevels",{enumerable:!0,get:function(){return u.logLevels}});var c=b2;Object.defineProperty(e,"getLogLevelName",{enumerable:!0,get:function(){return c.getLogLevelName}})})(vy);var zpe=mt&&mt.__rest||function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(e);i0?h("%c ".concat(f," %c").concat(c?" [".concat(String(c),"]:"):"","%c ").concat(s.message," %O"),m,_,b,d):h("%c ".concat(f," %c").concat(c?" [".concat(String(c),"]:"):"","%c ").concat(s.message),m,_,b)}}};t2.createLogWriter=Qpe;(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.createLogWriter=void 0;var t=t2;Object.defineProperty(e,"createLogWriter",{enumerable:!0,get:function(){return t.createLogWriter}})})(Pz);vy.ROARR.write=Pz.createLogWriter();const tj={};vy.Roarr.child(tj);const _2=tl(vy.Roarr.child(tj)),Ce=e=>_2.get().child({namespace:e}),hGe=["trace","debug","info","warn","error","fatal"],pGe={trace:10,debug:20,info:30,warn:40,error:50,fatal:60},Qt=e=>{try{return JSON.parse(JSON.stringify(e))}catch{return"Error parsing object"}},Xpe=async e=>{const t={},n=await e.arrayBuffer(),r=Ufe(n).text,i=uh(r,"invokeai_metadata");if(i){const a=FB.safeParse(JSON.parse(i));a.success?t.metadata=a.data:Ce("system").error({error:Qt(a.error)},"Problem reading metadata from image")}const o=uh(r,"invokeai_workflow");if(o){const a=VB.safeParse(JSON.parse(o));a.success?t.workflow=a.data:Ce("system").error({error:Qt(a.error)},"Problem reading workflow from image")}return t};var m_=globalThis&&globalThis.__generator||function(e,t){var n={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},r,i,o,a;return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function s(u){return function(c){return l([u,c])}}function l(u){if(r)throw new TypeError("Generator is already executing.");for(;n;)try{if(r=1,i&&(o=u[0]&2?i.return:u[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,u[1])).done)return o;switch(i=0,o&&(u=[u[0]&2,o.value]),u[0]){case 0:case 1:o=u;break;case 4:return n.label++,{value:u[1],done:!1};case 5:n.label++,i=u[1],u=[0];continue;case 7:u=n.ops.pop(),n.trys.pop();continue;default:if(o=n.trys,!(o=o.length>0&&o[o.length-1])&&(u[0]===6||u[0]===2)){n=0;continue}if(u[0]===3&&(!o||u[1]>o[0]&&u[1]"u"||navigator.onLine===void 0?!0:navigator.onLine}function age(){return typeof document>"u"?!0:document.visibilityState!=="hidden"}var yR=as;function ij(e,t){if(e===t||!(yR(e)&&yR(t)||Array.isArray(e)&&Array.isArray(t)))return t;for(var n=Object.keys(t),r=Object.keys(e),i=n.length===r.length,o=Array.isArray(t)?[]:{},a=0,s=n;a=200&&e.status<=299},lge=function(e){return/ion\/(vnd\.api\+)?json/.test(e.get("content-type")||"")};function bR(e){if(!as(e))return e;for(var t=wr({},e),n=0,r=Object.entries(t);n"u"&&s===vR&&console.warn("Warning: `fetch` is not available. Please supply a custom `fetchFn` property to use `fetchBaseQuery` on SSR environments."),function(g,y){return b_(t,null,function(){var S,w,x,C,T,k,P,$,O,E,A,D,L,M,R,N,B,U,G,Y,ee,J,j,Q,ne,se,ve,ce,bt,ot,ze,gt,Pe,Jt,Ar,Dn;return m_(this,function(Tn){switch(Tn.label){case 0:return S=y.signal,w=y.getState,x=y.extra,C=y.endpoint,T=y.forced,k=y.type,$=typeof g=="string"?{url:g}:g,O=$.url,E=$.headers,A=E===void 0?new Headers(b.headers):E,D=$.params,L=D===void 0?void 0:D,M=$.responseHandler,R=M===void 0?m??"json":M,N=$.validateStatus,B=N===void 0?_??sge:N,U=$.timeout,G=U===void 0?p:U,Y=gR($,["url","headers","params","responseHandler","validateStatus","timeout"]),ee=wr(Ns(wr({},b),{signal:S}),Y),A=new Headers(bR(A)),J=ee,[4,o(A,{getState:w,extra:x,endpoint:C,forced:T,type:k})];case 1:J.headers=Tn.sent()||A,j=function(en){return typeof en=="object"&&(as(en)||Array.isArray(en)||typeof en.toJSON=="function")},!ee.headers.has("content-type")&&j(ee.body)&&ee.headers.set("content-type",f),j(ee.body)&&c(ee.headers)&&(ee.body=JSON.stringify(ee.body,h)),L&&(Q=~O.indexOf("?")?"&":"?",ne=l?l(L):new URLSearchParams(bR(L)),O+=Q+ne),O=ige(r,O),se=new Request(O,ee),ve=se.clone(),P={request:ve},bt=!1,ot=G&&setTimeout(function(){bt=!0,y.abort()},G),Tn.label=2;case 2:return Tn.trys.push([2,4,5,6]),[4,s(se)];case 3:return ce=Tn.sent(),[3,6];case 4:return ze=Tn.sent(),[2,{error:{status:bt?"TIMEOUT_ERROR":"FETCH_ERROR",error:String(ze)},meta:P}];case 5:return ot&&clearTimeout(ot),[7];case 6:gt=ce.clone(),P.response=gt,Jt="",Tn.label=7;case 7:return Tn.trys.push([7,9,,10]),[4,Promise.all([v(ce,R).then(function(en){return Pe=en},function(en){return Ar=en}),gt.text().then(function(en){return Jt=en},function(){})])];case 8:if(Tn.sent(),Ar)throw Ar;return[3,10];case 9:return Dn=Tn.sent(),[2,{error:{status:"PARSING_ERROR",originalStatus:ce.status,data:Jt,error:String(Dn)},meta:P}];case 10:return[2,B(ce,Pe)?{data:Pe,meta:P}:{error:{status:ce.status,data:Pe},meta:P}]}})})};function v(g,y){return b_(this,null,function(){var S;return m_(this,function(w){switch(w.label){case 0:return typeof y=="function"?[2,y(g)]:(y==="content-type"&&(y=c(g.headers)?"json":"text"),y!=="json"?[3,2]:[4,g.text()]);case 1:return S=w.sent(),[2,S.length?JSON.parse(S):null];case 2:return[2,g.text()]}})})}}var _R=function(){function e(t,n){n===void 0&&(n=void 0),this.value=t,this.meta=n}return e}(),PT=Ne("__rtkq/focused"),oj=Ne("__rtkq/unfocused"),IT=Ne("__rtkq/online"),aj=Ne("__rtkq/offline"),Xs;(function(e){e.query="query",e.mutation="mutation"})(Xs||(Xs={}));function sj(e){return e.type===Xs.query}function cge(e){return e.type===Xs.mutation}function lj(e,t,n,r,i,o){return dge(e)?e(t,n,r,i).map(mE).map(o):Array.isArray(e)?e.map(mE).map(o):[]}function dge(e){return typeof e=="function"}function mE(e){return typeof e=="string"?{type:e}:e}function kC(e){return e!=null}var r0=Symbol("forceQueryFn"),yE=function(e){return typeof e[r0]=="function"};function fge(e){var t=e.serializeQueryArgs,n=e.queryThunk,r=e.mutationThunk,i=e.api,o=e.context,a=new Map,s=new Map,l=i.internalActions,u=l.unsubscribeQueryResult,c=l.removeMutationResult,d=l.updateSubscriptionOptions;return{buildInitiateQuery:v,buildInitiateMutation:g,getRunningQueryThunk:p,getRunningMutationThunk:m,getRunningQueriesThunk:_,getRunningMutationsThunk:b,getRunningOperationPromises:h,removalWarning:f};function f(){throw new Error(`This method had to be removed due to a conceptual bug in RTK. - Please see https://github.com/reduxjs/redux-toolkit/pull/2481 for details. - See https://redux-toolkit.js.org/rtk-query/usage/server-side-rendering for new guidance on SSR.`)}function h(){typeof process<"u";var y=function(S){return Array.from(S.values()).flatMap(function(w){return w?Object.values(w):[]})};return y_(y_([],y(a)),y(s)).filter(kC)}function p(y,S){return function(w){var x,C=o.endpointDefinitions[y],T=t({queryArgs:S,endpointDefinition:C,endpointName:y});return(x=a.get(w))==null?void 0:x[T]}}function m(y,S){return function(w){var x;return(x=s.get(w))==null?void 0:x[S]}}function _(){return function(y){return Object.values(a.get(y)||{}).filter(kC)}}function b(){return function(y){return Object.values(s.get(y)||{}).filter(kC)}}function v(y,S){var w=function(x,C){var T=C===void 0?{}:C,k=T.subscribe,P=k===void 0?!0:k,$=T.forceRefetch,O=T.subscriptionOptions,E=r0,A=T[E];return function(D,L){var M,R,N=t({queryArgs:x,endpointDefinition:S,endpointName:y}),B=n((M={type:"query",subscribe:P,forceRefetch:$,subscriptionOptions:O,endpointName:y,originalArgs:x,queryCacheKey:N},M[r0]=A,M)),U=i.endpoints[y].select(x),G=D(B),Y=U(L()),ee=G.requestId,J=G.abort,j=Y.requestId!==ee,Q=(R=a.get(D))==null?void 0:R[N],ne=function(){return U(L())},se=Object.assign(A?G.then(ne):j&&!Q?Promise.resolve(Y):Promise.all([Q,G]).then(ne),{arg:x,requestId:ee,subscriptionOptions:O,queryCacheKey:N,abort:J,unwrap:function(){return b_(this,null,function(){var ce;return m_(this,function(bt){switch(bt.label){case 0:return[4,se];case 1:if(ce=bt.sent(),ce.isError)throw ce.error;return[2,ce.data]}})})},refetch:function(){return D(w(x,{subscribe:!1,forceRefetch:!0}))},unsubscribe:function(){P&&D(u({queryCacheKey:N,requestId:ee}))},updateSubscriptionOptions:function(ce){se.subscriptionOptions=ce,D(d({endpointName:y,requestId:ee,queryCacheKey:N,options:ce}))}});if(!Q&&!j&&!A){var ve=a.get(D)||{};ve[N]=se,a.set(D,ve),se.then(function(){delete ve[N],Object.keys(ve).length||a.delete(D)})}return se}};return w}function g(y){return function(S,w){var x=w===void 0?{}:w,C=x.track,T=C===void 0?!0:C,k=x.fixedCacheKey;return function(P,$){var O=r({type:"mutation",endpointName:y,originalArgs:S,track:T,fixedCacheKey:k}),E=P(O),A=E.requestId,D=E.abort,L=E.unwrap,M=E.unwrap().then(function(U){return{data:U}}).catch(function(U){return{error:U}}),R=function(){P(c({requestId:A,fixedCacheKey:k}))},N=Object.assign(M,{arg:E.arg,requestId:A,abort:D,unwrap:L,unsubscribe:R,reset:R}),B=s.get(P)||{};return s.set(P,B),B[A]=N,N.then(function(){delete B[A],Object.keys(B).length||s.delete(P)}),k&&(B[k]=N,N.then(function(){B[k]===N&&(delete B[k],Object.keys(B).length||s.delete(P))})),N}}}}function SR(e){return e}function hge(e){var t=this,n=e.reducerPath,r=e.baseQuery,i=e.context.endpointDefinitions,o=e.serializeQueryArgs,a=e.api,s=function(g,y,S){return function(w){var x=i[g];w(a.internalActions.queryResultPatched({queryCacheKey:o({queryArgs:y,endpointDefinition:x,endpointName:g}),patches:S}))}},l=function(g,y,S){return function(w,x){var C,T,k=a.endpoints[g].select(y)(x()),P={patches:[],inversePatches:[],undo:function(){return w(a.util.patchQueryData(g,y,P.inversePatches))}};if(k.status===er.uninitialized)return P;if("data"in k)if(Ao(k.data)){var $=Hk(k.data,S),O=$[1],E=$[2];(C=P.patches).push.apply(C,O),(T=P.inversePatches).push.apply(T,E)}else{var A=S(k.data);P.patches.push({op:"replace",path:[],value:A}),P.inversePatches.push({op:"replace",path:[],value:k.data})}return w(a.util.patchQueryData(g,y,P.patches)),P}},u=function(g,y,S){return function(w){var x;return w(a.endpoints[g].initiate(y,(x={subscribe:!1,forceRefetch:!0},x[r0]=function(){return{data:S}},x)))}},c=function(g,y){return b_(t,[g,y],function(S,w){var x,C,T,k,P,$,O,E,A,D,L,M,R,N,B,U,G,Y,ee=w.signal,J=w.abort,j=w.rejectWithValue,Q=w.fulfillWithValue,ne=w.dispatch,se=w.getState,ve=w.extra;return m_(this,function(ce){switch(ce.label){case 0:x=i[S.endpointName],ce.label=1;case 1:return ce.trys.push([1,8,,13]),C=SR,T=void 0,k={signal:ee,abort:J,dispatch:ne,getState:se,extra:ve,endpoint:S.endpointName,type:S.type,forced:S.type==="query"?d(S,se()):void 0},P=S.type==="query"?S[r0]:void 0,P?(T=P(),[3,6]):[3,2];case 2:return x.query?[4,r(x.query(S.originalArgs),k,x.extraOptions)]:[3,4];case 3:return T=ce.sent(),x.transformResponse&&(C=x.transformResponse),[3,6];case 4:return[4,x.queryFn(S.originalArgs,k,x.extraOptions,function(bt){return r(bt,k,x.extraOptions)})];case 5:T=ce.sent(),ce.label=6;case 6:if(typeof process<"u",T.error)throw new _R(T.error,T.meta);return L=Q,[4,C(T.data,T.meta,S.originalArgs)];case 7:return[2,L.apply(void 0,[ce.sent(),(G={fulfilledTimeStamp:Date.now(),baseQueryMeta:T.meta},G[Jc]=!0,G)])];case 8:if(M=ce.sent(),R=M,!(R instanceof _R))return[3,12];N=SR,x.query&&x.transformErrorResponse&&(N=x.transformErrorResponse),ce.label=9;case 9:return ce.trys.push([9,11,,12]),B=j,[4,N(R.value,R.meta,S.originalArgs)];case 10:return[2,B.apply(void 0,[ce.sent(),(Y={baseQueryMeta:R.meta},Y[Jc]=!0,Y)])];case 11:return U=ce.sent(),R=U,[3,12];case 12:throw typeof process<"u",console.error(R),R;case 13:return[2]}})})};function d(g,y){var S,w,x,C,T=(w=(S=y[n])==null?void 0:S.queries)==null?void 0:w[g.queryCacheKey],k=(x=y[n])==null?void 0:x.config.refetchOnMountOrArgChange,P=T==null?void 0:T.fulfilledTimeStamp,$=(C=g.forceRefetch)!=null?C:g.subscribe&&k;return $?$===!0||(Number(new Date)-Number(P))/1e3>=$:!1}var f=zb(n+"/executeQuery",c,{getPendingMeta:function(){var g;return g={startedTimeStamp:Date.now()},g[Jc]=!0,g},condition:function(g,y){var S=y.getState,w,x,C,T=S(),k=(x=(w=T[n])==null?void 0:w.queries)==null?void 0:x[g.queryCacheKey],P=k==null?void 0:k.fulfilledTimeStamp,$=g.originalArgs,O=k==null?void 0:k.originalArgs,E=i[g.endpointName];return yE(g)?!0:(k==null?void 0:k.status)==="pending"?!1:d(g,T)||sj(E)&&((C=E==null?void 0:E.forceRefetch)!=null&&C.call(E,{currentArg:$,previousArg:O,endpointState:k,state:T}))?!0:!P},dispatchConditionRejection:!0}),h=zb(n+"/executeMutation",c,{getPendingMeta:function(){var g;return g={startedTimeStamp:Date.now()},g[Jc]=!0,g}}),p=function(g){return"force"in g},m=function(g){return"ifOlderThan"in g},_=function(g,y,S){return function(w,x){var C=p(S)&&S.force,T=m(S)&&S.ifOlderThan,k=function(E){return E===void 0&&(E=!0),a.endpoints[g].initiate(y,{forceRefetch:E})},P=a.endpoints[g].select(y)(x());if(C)w(k());else if(T){var $=P==null?void 0:P.fulfilledTimeStamp;if(!$){w(k());return}var O=(Number(new Date)-Number(new Date($)))/1e3>=T;O&&w(k())}else w(k(!1))}};function b(g){return function(y){var S,w;return((w=(S=y==null?void 0:y.meta)==null?void 0:S.arg)==null?void 0:w.endpointName)===g}}function v(g,y){return{matchPending:oh(NS(g),b(y)),matchFulfilled:oh(bc(g),b(y)),matchRejected:oh(jh(g),b(y))}}return{queryThunk:f,mutationThunk:h,prefetch:_,updateQueryData:l,upsertQueryData:u,patchQueryData:s,buildMatchThunkActions:v}}function uj(e,t,n,r){return lj(n[e.meta.arg.endpointName][t],bc(e)?e.payload:void 0,Z0(e)?e.payload:void 0,e.meta.arg.originalArgs,"baseQueryMeta"in e.meta?e.meta.baseQueryMeta:void 0,r)}function xv(e,t,n){var r=e[t];r&&n(r)}function i0(e){var t;return(t="arg"in e?e.arg.fixedCacheKey:e.fixedCacheKey)!=null?t:e.requestId}function xR(e,t,n){var r=e[i0(t)];r&&n(r)}var qp={};function pge(e){var t=e.reducerPath,n=e.queryThunk,r=e.mutationThunk,i=e.context,o=i.endpointDefinitions,a=i.apiUid,s=i.extractRehydrationInfo,l=i.hasRehydrationInfo,u=e.assertTagType,c=e.config,d=Ne(t+"/resetApiState"),f=nr({name:t+"/queries",initialState:qp,reducers:{removeQueryResult:{reducer:function(S,w){var x=w.payload.queryCacheKey;delete S[x]},prepare:R1()},queryResultPatched:function(S,w){var x=w.payload,C=x.queryCacheKey,T=x.patches;xv(S,C,function(k){k.data=F3(k.data,T.concat())})}},extraReducers:function(S){S.addCase(n.pending,function(w,x){var C=x.meta,T=x.meta.arg,k,P,$=yE(T);(T.subscribe||$)&&((P=w[k=T.queryCacheKey])!=null||(w[k]={status:er.uninitialized,endpointName:T.endpointName})),xv(w,T.queryCacheKey,function(O){O.status=er.pending,O.requestId=$&&O.requestId?O.requestId:C.requestId,T.originalArgs!==void 0&&(O.originalArgs=T.originalArgs),O.startedTimeStamp=C.startedTimeStamp})}).addCase(n.fulfilled,function(w,x){var C=x.meta,T=x.payload;xv(w,C.arg.queryCacheKey,function(k){var P;if(!(k.requestId!==C.requestId&&!yE(C.arg))){var $=o[C.arg.endpointName].merge;if(k.status=er.fulfilled,$)if(k.data!==void 0){var O=C.fulfilledTimeStamp,E=C.arg,A=C.baseQueryMeta,D=C.requestId,L=vc(k.data,function(M){return $(M,T,{arg:E.originalArgs,baseQueryMeta:A,fulfilledTimeStamp:O,requestId:D})});k.data=L}else k.data=T;else k.data=(P=o[C.arg.endpointName].structuralSharing)==null||P?ij(io(k.data)?Fk(k.data):k.data,T):T;delete k.error,k.fulfilledTimeStamp=C.fulfilledTimeStamp}})}).addCase(n.rejected,function(w,x){var C=x.meta,T=C.condition,k=C.arg,P=C.requestId,$=x.error,O=x.payload;xv(w,k.queryCacheKey,function(E){if(!T){if(E.requestId!==P)return;E.status=er.rejected,E.error=O??$}})}).addMatcher(l,function(w,x){for(var C=s(x).queries,T=0,k=Object.entries(C);T"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?Lge:Dge;fj.useSyncExternalStore=Yh.useSyncExternalStore!==void 0?Yh.useSyncExternalStore:Fge;dj.exports=fj;var Bge=dj.exports,hj={exports:{}},pj={};/** - * @license React - * use-sync-external-store-shim/with-selector.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 S2=I,zge=Bge;function jge(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Uge=typeof Object.is=="function"?Object.is:jge,Vge=zge.useSyncExternalStore,Gge=S2.useRef,Hge=S2.useEffect,qge=S2.useMemo,Wge=S2.useDebugValue;pj.useSyncExternalStoreWithSelector=function(e,t,n,r,i){var o=Gge(null);if(o.current===null){var a={hasValue:!1,value:null};o.current=a}else a=o.current;o=qge(function(){function l(h){if(!u){if(u=!0,c=h,h=r(h),i!==void 0&&a.hasValue){var p=a.value;if(i(p,h))return d=p}return d=h}if(p=d,Uge(c,h))return p;var m=r(h);return i!==void 0&&i(p,m)?p:(c=h,d=m)}var u=!1,c,d,f=n===void 0?null:n;return[function(){return l(t())},f===null?void 0:function(){return l(f())}]},[t,n,r,i]);var s=Vge(e,o[0],o[1]);return Hge(function(){a.hasValue=!0,a.value=s},[s]),Wge(s),s};hj.exports=pj;var gj=hj.exports;const Kge=pc(gj);function Qge(e){e()}let mj=Qge;const Xge=e=>mj=e,Yge=()=>mj,PR=Symbol.for("react-redux-context"),IR=typeof globalThis<"u"?globalThis:{};function Zge(){var e;if(!I.createContext)return{};const t=(e=IR[PR])!=null?e:IR[PR]=new Map;let n=t.get(I.createContext);return n||(n=I.createContext(null),t.set(I.createContext,n)),n}const ac=Zge();function RT(e=ac){return function(){return I.useContext(e)}}const yj=RT(),Jge=()=>{throw new Error("uSES not initialized!")};let vj=Jge;const eme=e=>{vj=e},tme=(e,t)=>e===t;function nme(e=ac){const t=e===ac?yj:RT(e);return function(r,i={}){const{equalityFn:o=tme,stabilityCheck:a=void 0,noopCheck:s=void 0}=typeof i=="function"?{equalityFn:i}:i,{store:l,subscription:u,getServerState:c,stabilityCheck:d,noopCheck:f}=t();I.useRef(!0);const h=I.useCallback({[r.name](m){return r(m)}}[r.name],[r,d,a]),p=vj(u.addNestedSub,l.getState,c||l.getState,h,o);return I.useDebugValue(p),p}}const bj=nme();function __(){return __=Object.assign?Object.assign.bind():function(e){for(var t=1;t{let r=t;for(;r;)r.callback(),r=r.next})},get(){let r=[],i=t;for(;i;)r.push(i),i=i.next;return r},subscribe(r){let i=!0,o=n={callback:r,next:null,prev:n};return o.prev?o.prev.next=o:t=o,function(){!i||t===null||(i=!1,o.next?o.next.prev=o.prev:n=o.prev,o.prev?o.prev.next=o.next:t=o.next)}}}}const RR={notify(){},get:()=>[]};function pme(e,t){let n,r=RR;function i(d){return l(),r.subscribe(d)}function o(){r.notify()}function a(){c.onStateChange&&c.onStateChange()}function s(){return!!n}function l(){n||(n=t?t.addNestedSub(a):e.subscribe(a),r=hme())}function u(){n&&(n(),n=void 0,r.clear(),r=RR)}const c={addNestedSub:i,notifyNestedSubs:o,handleChangeWrapper:a,isSubscribed:s,trySubscribe:l,tryUnsubscribe:u,getListeners:()=>r};return c}const gme=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",mme=gme?I.useLayoutEffect:I.useEffect;function OR(e,t){return e===t?e!==0||t!==0||1/e===1/t:e!==e&&t!==t}function S_(e,t){if(OR(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let i=0;i{const u=pme(e);return{store:e,subscription:u,getServerState:r?()=>r:void 0,stabilityCheck:i,noopCheck:o}},[e,r,i,o]),s=I.useMemo(()=>e.getState(),[e]);mme(()=>{const{subscription:u}=a;return u.onStateChange=u.notifyNestedSubs,u.trySubscribe(),s!==e.getState()&&u.notifyNestedSubs(),()=>{u.tryUnsubscribe(),u.onStateChange=void 0}},[a,s]);const l=t||ac;return I.createElement(l.Provider,{value:a},n)}function Ej(e=ac){const t=e===ac?yj:RT(e);return function(){const{store:r}=t();return r}}const kj=Ej();function vme(e=ac){const t=e===ac?kj:Ej(e);return function(){return t().dispatch}}const Tj=vme();eme(gj.useSyncExternalStoreWithSelector);Xge(Uo.unstable_batchedUpdates);var bme=globalThis&&globalThis.__spreadArray||function(e,t){for(var n=0,r=t.length,i=e.length;nLme({headers:{...e?{Authorization:`Bearer ${e}`}:{},...n?{"project-id":n}:{}},baseUrl:`${t??""}`}));const Ume=["Board","BoardImagesTotal","BoardAssetsTotal","Image","ImageNameList","ImageList","ImageMetadata","ImageMetadataFromFile","Model","SessionQueueItem","SessionQueueItemDTO","SessionQueueItemDTOList","SessionQueueStatus","SessionProcessorStatus","BatchStatus","InvocationCacheStatus"],Dt="LIST",Vme=async(e,t,n)=>{const r=o0.get(),i=Zh.get(),o=a0.get();return uge({baseUrl:`${r??""}/api/v1`,prepareHeaders:s=>(i&&s.set("Authorization",`Bearer ${i}`),o&&s.set("project-id",o),s)})(e,t,n)},ls=Nme({baseQuery:Vme,reducerPath:"api",tagTypes:Ume,endpoints:()=>({})}),Gme=(e,t)=>{const n=new Date(e),r=new Date(t);return n>r?1:ne==null,Xme=e=>encodeURIComponent(e).replace(/[!'()*]/g,t=>`%${t.charCodeAt(0).toString(16).toUpperCase()}`),bE=Symbol("encodeFragmentIdentifier");function Yme(e){switch(e.arrayFormat){case"index":return t=>(n,r)=>{const i=n.length;return r===void 0||e.skipNull&&r===null||e.skipEmptyString&&r===""?n:r===null?[...n,[Mr(t,e),"[",i,"]"].join("")]:[...n,[Mr(t,e),"[",Mr(i,e),"]=",Mr(r,e)].join("")]};case"bracket":return t=>(n,r)=>r===void 0||e.skipNull&&r===null||e.skipEmptyString&&r===""?n:r===null?[...n,[Mr(t,e),"[]"].join("")]:[...n,[Mr(t,e),"[]=",Mr(r,e)].join("")];case"colon-list-separator":return t=>(n,r)=>r===void 0||e.skipNull&&r===null||e.skipEmptyString&&r===""?n:r===null?[...n,[Mr(t,e),":list="].join("")]:[...n,[Mr(t,e),":list=",Mr(r,e)].join("")];case"comma":case"separator":case"bracket-separator":{const t=e.arrayFormat==="bracket-separator"?"[]=":"=";return n=>(r,i)=>i===void 0||e.skipNull&&i===null||e.skipEmptyString&&i===""?r:(i=i===null?"":i,r.length===0?[[Mr(n,e),t,Mr(i,e)].join("")]:[[r,Mr(i,e)].join(e.arrayFormatSeparator)])}default:return t=>(n,r)=>r===void 0||e.skipNull&&r===null||e.skipEmptyString&&r===""?n:r===null?[...n,Mr(t,e)]:[...n,[Mr(t,e),"=",Mr(r,e)].join("")]}}function Zme(e){let t;switch(e.arrayFormat){case"index":return(n,r,i)=>{if(t=/\[(\d*)]$/.exec(n),n=n.replace(/\[\d*]$/,""),!t){i[n]=r;return}i[n]===void 0&&(i[n]={}),i[n][t[1]]=r};case"bracket":return(n,r,i)=>{if(t=/(\[])$/.exec(n),n=n.replace(/\[]$/,""),!t){i[n]=r;return}if(i[n]===void 0){i[n]=[r];return}i[n]=[...i[n],r]};case"colon-list-separator":return(n,r,i)=>{if(t=/(:list)$/.exec(n),n=n.replace(/:list$/,""),!t){i[n]=r;return}if(i[n]===void 0){i[n]=[r];return}i[n]=[...i[n],r]};case"comma":case"separator":return(n,r,i)=>{const o=typeof r=="string"&&r.includes(e.arrayFormatSeparator),a=typeof r=="string"&&!o&&_l(r,e).includes(e.arrayFormatSeparator);r=a?_l(r,e):r;const s=o||a?r.split(e.arrayFormatSeparator).map(l=>_l(l,e)):r===null?r:_l(r,e);i[n]=s};case"bracket-separator":return(n,r,i)=>{const o=/(\[])$/.test(n);if(n=n.replace(/\[]$/,""),!o){i[n]=r&&_l(r,e);return}const a=r===null?[]:r.split(e.arrayFormatSeparator).map(s=>_l(s,e));if(i[n]===void 0){i[n]=a;return}i[n]=[...i[n],...a]};default:return(n,r,i)=>{if(i[n]===void 0){i[n]=r;return}i[n]=[...[i[n]].flat(),r]}}}function Ij(e){if(typeof e!="string"||e.length!==1)throw new TypeError("arrayFormatSeparator must be single character string")}function Mr(e,t){return t.encode?t.strict?Xme(e):encodeURIComponent(e):e}function _l(e,t){return t.decode?Wme(e):e}function Rj(e){return Array.isArray(e)?e.sort():typeof e=="object"?Rj(Object.keys(e)).sort((t,n)=>Number(t)-Number(n)).map(t=>e[t]):e}function Oj(e){const t=e.indexOf("#");return t!==-1&&(e=e.slice(0,t)),e}function Jme(e){let t="";const n=e.indexOf("#");return n!==-1&&(t=e.slice(n)),t}function FR(e,t){return t.parseNumbers&&!Number.isNaN(Number(e))&&typeof e=="string"&&e.trim()!==""?e=Number(e):t.parseBooleans&&e!==null&&(e.toLowerCase()==="true"||e.toLowerCase()==="false")&&(e=e.toLowerCase()==="true"),e}function LT(e){e=Oj(e);const t=e.indexOf("?");return t===-1?"":e.slice(t+1)}function FT(e,t){t={decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1,...t},Ij(t.arrayFormatSeparator);const n=Zme(t),r=Object.create(null);if(typeof e!="string"||(e=e.trim().replace(/^[?#&]/,""),!e))return r;for(const i of e.split("&")){if(i==="")continue;const o=t.decode?i.replace(/\+/g," "):i;let[a,s]=Pj(o,"=");a===void 0&&(a=o),s=s===void 0?null:["comma","separator","bracket-separator"].includes(t.arrayFormat)?s:_l(s,t),n(_l(a,t),s,r)}for(const[i,o]of Object.entries(r))if(typeof o=="object"&&o!==null)for(const[a,s]of Object.entries(o))o[a]=FR(s,t);else r[i]=FR(o,t);return t.sort===!1?r:(t.sort===!0?Object.keys(r).sort():Object.keys(r).sort(t.sort)).reduce((i,o)=>{const a=r[o];return a&&typeof a=="object"&&!Array.isArray(a)?i[o]=Rj(a):i[o]=a,i},Object.create(null))}function Mj(e,t){if(!e)return"";t={encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:",",...t},Ij(t.arrayFormatSeparator);const n=a=>t.skipNull&&Qme(e[a])||t.skipEmptyString&&e[a]==="",r=Yme(t),i={};for(const[a,s]of Object.entries(e))n(a)||(i[a]=s);const o=Object.keys(i);return t.sort!==!1&&o.sort(t.sort),o.map(a=>{const s=e[a];return s===void 0?"":s===null?Mr(a,t):Array.isArray(s)?s.length===0&&t.arrayFormat==="bracket-separator"?Mr(a,t)+"[]":s.reduce(r(a),[]).join("&"):Mr(a,t)+"="+Mr(s,t)}).filter(a=>a.length>0).join("&")}function Nj(e,t){var i;t={decode:!0,...t};let[n,r]=Pj(e,"#");return n===void 0&&(n=e),{url:((i=n==null?void 0:n.split("?"))==null?void 0:i[0])??"",query:FT(LT(e),t),...t&&t.parseFragmentIdentifier&&r?{fragmentIdentifier:_l(r,t)}:{}}}function $j(e,t){t={encode:!0,strict:!0,[bE]:!0,...t};const n=Oj(e.url).split("?")[0]||"",r=LT(e.url),i={...FT(r,{sort:!1}),...e.query};let o=Mj(i,t);o&&(o=`?${o}`);let a=Jme(e.url);if(e.fragmentIdentifier){const s=new URL(n);s.hash=e.fragmentIdentifier,a=t[bE]?s.hash:`#${e.fragmentIdentifier}`}return`${n}${o}${a}`}function Dj(e,t,n){n={parseFragmentIdentifier:!0,[bE]:!1,...n};const{url:r,query:i,fragmentIdentifier:o}=Nj(e,n);return $j({url:r,query:Kme(i,t),fragmentIdentifier:o},n)}function e0e(e,t,n){const r=Array.isArray(t)?i=>!t.includes(i):(i,o)=>!t(i,o);return Dj(e,r,n)}const Kg=Object.freeze(Object.defineProperty({__proto__:null,exclude:e0e,extract:LT,parse:FT,parseUrl:Nj,pick:Dj,stringify:Mj,stringifyUrl:$j},Symbol.toStringTag,{value:"Module"})),Ic=(e,t)=>{if(!e)return!1;const n=s0.selectAll(e);if(n.length<=1)return!0;const r=[],i=[];for(let o=0;o=s}else{const o=i[i.length-1];if(!o)return!1;const a=new Date(t.created_at),s=new Date(o.created_at);return a>=s}},aa=e=>ii.includes(e.image_category)?ii:Mu,Vn=Js({selectId:e=>e.image_name,sortComparer:(e,t)=>e.starred&&!t.starred?-1:!e.starred&&t.starred?1:Gme(t.created_at,e.created_at)}),s0=Vn.getSelectors(),Bo=e=>`images/?${Kg.stringify(e,{arrayFormat:"none"})}`,xi=ls.injectEndpoints({endpoints:e=>({listBoards:e.query({query:t=>({url:"boards/",params:t}),providesTags:t=>{const n=[{type:"Board",id:Dt}];return t&&n.push(...t.items.map(({board_id:r})=>({type:"Board",id:r}))),n}}),listAllBoards:e.query({query:()=>({url:"boards/",params:{all:!0}}),providesTags:t=>{const n=[{type:"Board",id:Dt}];return t&&n.push(...t.map(({board_id:r})=>({type:"Board",id:r}))),n}}),listAllImageNamesForBoard:e.query({query:t=>({url:`boards/${t}/image_names`}),providesTags:(t,n,r)=>[{type:"ImageNameList",id:r}],keepUnusedDataFor:0}),getBoardImagesTotal:e.query({query:t=>({url:Bo({board_id:t??"none",categories:ii,is_intermediate:!1,limit:0,offset:0}),method:"GET"}),providesTags:(t,n,r)=>[{type:"BoardImagesTotal",id:r??"none"}],transformResponse:t=>t.total}),getBoardAssetsTotal:e.query({query:t=>({url:Bo({board_id:t??"none",categories:Mu,is_intermediate:!1,limit:0,offset:0}),method:"GET"}),providesTags:(t,n,r)=>[{type:"BoardAssetsTotal",id:r??"none"}],transformResponse:t=>t.total}),createBoard:e.mutation({query:t=>({url:"boards/",method:"POST",params:{board_name:t}}),invalidatesTags:[{type:"Board",id:Dt}]}),updateBoard:e.mutation({query:({board_id:t,changes:n})=>({url:`boards/${t}`,method:"PATCH",body:n}),invalidatesTags:(t,n,r)=>[{type:"Board",id:r.board_id}]})})}),{useListBoardsQuery:gGe,useListAllBoardsQuery:mGe,useGetBoardImagesTotalQuery:yGe,useGetBoardAssetsTotalQuery:vGe,useCreateBoardMutation:bGe,useUpdateBoardMutation:_Ge,useListAllImageNamesForBoardQuery:SGe}=xi,me=ls.injectEndpoints({endpoints:e=>({listImages:e.query({query:t=>({url:Bo(t),method:"GET"}),providesTags:(t,n,{board_id:r,categories:i})=>[{type:"ImageList",id:Bo({board_id:r,categories:i})}],serializeQueryArgs:({queryArgs:t})=>{const{board_id:n,categories:r}=t;return Bo({board_id:n,categories:r})},transformResponse(t){const{items:n}=t;return Vn.addMany(Vn.getInitialState(),n)},merge:(t,n)=>{Vn.addMany(t,s0.selectAll(n))},forceRefetch({currentArg:t,previousArg:n}){return(t==null?void 0:t.offset)!==(n==null?void 0:n.offset)},async onQueryStarted(t,{dispatch:n,queryFulfilled:r}){try{const{data:i}=await r;s0.selectAll(i).forEach(o=>{n(me.util.upsertQueryData("getImageDTO",o.image_name,o))})}catch{}},keepUnusedDataFor:86400}),getIntermediatesCount:e.query({query:()=>({url:Bo({is_intermediate:!0})}),providesTags:["IntermediatesCount"],transformResponse:t=>t.total}),getImageDTO:e.query({query:t=>({url:`images/i/${t}`}),providesTags:(t,n,r)=>[{type:"Image",id:r}],keepUnusedDataFor:86400}),getImageMetadata:e.query({query:t=>({url:`images/i/${t}/metadata`}),providesTags:(t,n,r)=>[{type:"ImageMetadata",id:r}],keepUnusedDataFor:86400}),getImageMetadataFromFile:e.query({queryFn:async(t,n,r,i)=>{var o;if(t.shouldFetchMetadataFromApi){let a;const s=await i(`images/i/${t.image.image_name}/metadata`);if(s.data){const l=FB.safeParse((o=s.data)==null?void 0:o.metadata);l.success&&(a=l.data)}return{data:{metadata:a}}}else{const a=Zh.get(),s=a0.get(),u=await gle.fetchBaseQuery({baseUrl:"",prepareHeaders:d=>(a&&d.set("Authorization",`Bearer ${a}`),s&&d.set("project-id",s),d),responseHandler:async d=>await d.blob()})(t.image.image_url,n,r);return{data:await Xpe(u.data)}}},providesTags:(t,n,{image:r})=>[{type:"ImageMetadataFromFile",id:r.image_name}],keepUnusedDataFor:86400}),clearIntermediates:e.mutation({query:()=>({url:"images/clear-intermediates",method:"POST"}),invalidatesTags:["IntermediatesCount"]}),deleteImage:e.mutation({query:({image_name:t})=>({url:`images/i/${t}`,method:"DELETE"}),invalidatesTags:(t,n,{board_id:r})=>[{type:"BoardImagesTotal",id:r??"none"},{type:"BoardAssetsTotal",id:r??"none"}],async onQueryStarted(t,{dispatch:n,queryFulfilled:r}){const{image_name:i,board_id:o}=t,a={board_id:o??"none",categories:aa(t)},s=n(me.util.updateQueryData("listImages",a,l=>{Vn.removeOne(l,i)}));try{await r}catch{s.undo()}}}),deleteImages:e.mutation({query:({imageDTOs:t})=>({url:"images/delete",method:"POST",body:{image_names:t.map(r=>r.image_name)}}),invalidatesTags:(t,n,{imageDTOs:r})=>{var o;const i=(o=r[0])==null?void 0:o.board_id;return[{type:"BoardImagesTotal",id:i??"none"},{type:"BoardAssetsTotal",id:i??"none"}]},async onQueryStarted({imageDTOs:t},{dispatch:n,queryFulfilled:r}){try{const{data:i}=await r,o=dT(t,"image_name");i.deleted_images.forEach(a=>{const s=o[a];if(s){const l={board_id:s.board_id??"none",categories:aa(s)};n(me.util.updateQueryData("listImages",l,u=>{Vn.removeOne(u,a)}))}})}catch{}}}),changeImageIsIntermediate:e.mutation({query:({imageDTO:t,is_intermediate:n})=>({url:`images/i/${t.image_name}`,method:"PATCH",body:{is_intermediate:n}}),invalidatesTags:(t,n,{imageDTO:r})=>[{type:"BoardImagesTotal",id:r.board_id??"none"},{type:"BoardAssetsTotal",id:r.board_id??"none"}],async onQueryStarted({imageDTO:t,is_intermediate:n},{dispatch:r,queryFulfilled:i,getState:o}){const a=[];a.push(r(me.util.updateQueryData("getImageDTO",t.image_name,l=>{Object.assign(l,{is_intermediate:n})})));const s=aa(t);if(n)a.push(r(me.util.updateQueryData("listImages",{board_id:t.board_id??"none",categories:s},l=>{Vn.removeOne(l,t.image_name)})));else{const l={board_id:t.board_id??"none",categories:s},u=me.endpoints.listImages.select(l)(o()),{data:c}=ii.includes(t.image_category)?xi.endpoints.getBoardImagesTotal.select(t.board_id??"none")(o()):xi.endpoints.getBoardAssetsTotal.select(t.board_id??"none")(o()),d=u.data&&u.data.ids.length>=(c??0),f=Ic(u.data,t);(d||f)&&a.push(r(me.util.updateQueryData("listImages",l,h=>{Vn.upsertOne(h,t)})))}try{await i}catch{a.forEach(l=>l.undo())}}}),changeImageSessionId:e.mutation({query:({imageDTO:t,session_id:n})=>({url:`images/i/${t.image_name}`,method:"PATCH",body:{session_id:n}}),invalidatesTags:(t,n,{imageDTO:r})=>[{type:"BoardImagesTotal",id:r.board_id??"none"},{type:"BoardAssetsTotal",id:r.board_id??"none"}],async onQueryStarted({imageDTO:t,session_id:n},{dispatch:r,queryFulfilled:i}){const o=[];o.push(r(me.util.updateQueryData("getImageDTO",t.image_name,a=>{Object.assign(a,{session_id:n})})));try{await i}catch{o.forEach(a=>a.undo())}}}),starImages:e.mutation({query:({imageDTOs:t})=>({url:"images/star",method:"POST",body:{image_names:t.map(n=>n.image_name)}}),invalidatesTags:(t,n,{imageDTOs:r})=>{if(r[0]){const i=aa(r[0]),o=r[0].board_id;return[{type:"ImageList",id:Bo({board_id:o,categories:i})}]}return[]},async onQueryStarted({imageDTOs:t},{dispatch:n,queryFulfilled:r,getState:i}){try{const{data:o}=await r,a=t.filter(u=>o.updated_image_names.includes(u.image_name));if(!a[0])return;const s=aa(a[0]),l=a[0].board_id;a.forEach(u=>{const{image_name:c}=u;n(me.util.updateQueryData("getImageDTO",c,_=>{_.starred=!0}));const d={board_id:l??"none",categories:s},f=me.endpoints.listImages.select(d)(i()),{data:h}=ii.includes(u.image_category)?xi.endpoints.getBoardImagesTotal.select(l??"none")(i()):xi.endpoints.getBoardAssetsTotal.select(l??"none")(i()),p=f.data&&f.data.ids.length>=(h??0),m=(h||0)>=fv?Ic(f.data,u):!0;(p||m)&&n(me.util.updateQueryData("listImages",d,_=>{Vn.upsertOne(_,{...u,starred:!0})}))})}catch{}}}),unstarImages:e.mutation({query:({imageDTOs:t})=>({url:"images/unstar",method:"POST",body:{image_names:t.map(n=>n.image_name)}}),invalidatesTags:(t,n,{imageDTOs:r})=>{if(r[0]){const i=aa(r[0]),o=r[0].board_id;return[{type:"ImageList",id:Bo({board_id:o,categories:i})}]}return[]},async onQueryStarted({imageDTOs:t},{dispatch:n,queryFulfilled:r,getState:i}){try{const{data:o}=await r,a=t.filter(u=>o.updated_image_names.includes(u.image_name));if(!a[0])return;const s=aa(a[0]),l=a[0].board_id;a.forEach(u=>{const{image_name:c}=u;n(me.util.updateQueryData("getImageDTO",c,_=>{_.starred=!1}));const d={board_id:l??"none",categories:s},f=me.endpoints.listImages.select(d)(i()),{data:h}=ii.includes(u.image_category)?xi.endpoints.getBoardImagesTotal.select(l??"none")(i()):xi.endpoints.getBoardAssetsTotal.select(l??"none")(i()),p=f.data&&f.data.ids.length>=(h??0),m=(h||0)>=fv?Ic(f.data,u):!0;(p||m)&&n(me.util.updateQueryData("listImages",d,_=>{Vn.upsertOne(_,{...u,starred:!1})}))})}catch{}}}),uploadImage:e.mutation({query:({file:t,image_category:n,is_intermediate:r,session_id:i,board_id:o,crop_visible:a})=>{const s=new FormData;return s.append("file",t),{url:"images/upload",method:"POST",body:s,params:{image_category:n,is_intermediate:r,session_id:i,board_id:o==="none"?void 0:o,crop_visible:a}}},async onQueryStarted(t,{dispatch:n,queryFulfilled:r}){try{const{data:i}=await r;if(i.is_intermediate)return;n(me.util.upsertQueryData("getImageDTO",i.image_name,i));const o=aa(i);n(me.util.updateQueryData("listImages",{board_id:i.board_id??"none",categories:o},a=>{Vn.addOne(a,i)})),n(me.util.invalidateTags([{type:"BoardImagesTotal",id:i.board_id??"none"},{type:"BoardAssetsTotal",id:i.board_id??"none"}]))}catch{}}}),deleteBoard:e.mutation({query:t=>({url:`boards/${t}`,method:"DELETE"}),invalidatesTags:()=>[{type:"Board",id:Dt},{type:"ImageList",id:Bo({board_id:"none",categories:ii})},{type:"ImageList",id:Bo({board_id:"none",categories:Mu})},{type:"BoardImagesTotal",id:"none"},{type:"BoardAssetsTotal",id:"none"}],async onQueryStarted(t,{dispatch:n,queryFulfilled:r}){try{const{data:i}=await r,{deleted_board_images:o}=i;o.forEach(l=>{n(me.util.updateQueryData("getImageDTO",l,u=>{u.board_id=void 0}))});const a=[{categories:ii},{categories:Mu}],s=o.map(l=>({id:l,changes:{board_id:void 0}}));a.forEach(l=>{n(me.util.updateQueryData("listImages",l,u=>{Vn.updateMany(u,s)}))})}catch{}}}),deleteBoardAndImages:e.mutation({query:t=>({url:`boards/${t}`,method:"DELETE",params:{include_images:!0}}),invalidatesTags:()=>[{type:"Board",id:Dt},{type:"ImageList",id:Bo({board_id:"none",categories:ii})},{type:"ImageList",id:Bo({board_id:"none",categories:Mu})},{type:"BoardImagesTotal",id:"none"},{type:"BoardAssetsTotal",id:"none"}],async onQueryStarted(t,{dispatch:n,queryFulfilled:r}){try{const{data:i}=await r,{deleted_images:o}=i;[{categories:ii},{categories:Mu}].forEach(s=>{n(me.util.updateQueryData("listImages",s,l=>{Vn.removeMany(l,o)}))})}catch{}}}),addImageToBoard:e.mutation({query:({board_id:t,imageDTO:n})=>{const{image_name:r}=n;return{url:"board_images/",method:"POST",body:{board_id:t,image_name:r}}},invalidatesTags:(t,n,{board_id:r,imageDTO:i})=>[{type:"Board",id:r},{type:"BoardImagesTotal",id:r},{type:"BoardAssetsTotal",id:r},{type:"BoardImagesTotal",id:i.board_id??"none"},{type:"BoardAssetsTotal",id:i.board_id??"none"}],async onQueryStarted({board_id:t,imageDTO:n},{dispatch:r,queryFulfilled:i,getState:o}){const a=[],s=aa(n);if(a.push(r(me.util.updateQueryData("getImageDTO",n.image_name,l=>{l.board_id=t}))),!n.is_intermediate){a.push(r(me.util.updateQueryData("listImages",{board_id:n.board_id??"none",categories:s},h=>{Vn.removeOne(h,n.image_name)})));const l={board_id:t??"none",categories:s},u=me.endpoints.listImages.select(l)(o()),{data:c}=ii.includes(n.image_category)?xi.endpoints.getBoardImagesTotal.select(n.board_id??"none")(o()):xi.endpoints.getBoardAssetsTotal.select(n.board_id??"none")(o()),d=u.data&&u.data.ids.length>=(c??0),f=Ic(u.data,n);(d||f)&&a.push(r(me.util.updateQueryData("listImages",l,h=>{Vn.addOne(h,n)})))}try{await i}catch{a.forEach(l=>l.undo())}}}),removeImageFromBoard:e.mutation({query:({imageDTO:t})=>{const{image_name:n}=t;return{url:"board_images/",method:"DELETE",body:{image_name:n}}},invalidatesTags:(t,n,{imageDTO:r})=>{const{board_id:i}=r;return[{type:"Board",id:i??"none"},{type:"BoardImagesTotal",id:i??"none"},{type:"BoardAssetsTotal",id:i??"none"},{type:"BoardImagesTotal",id:"none"},{type:"BoardAssetsTotal",id:"none"}]},async onQueryStarted({imageDTO:t},{dispatch:n,queryFulfilled:r,getState:i}){const o=aa(t),a=[];a.push(n(me.util.updateQueryData("getImageDTO",t.image_name,f=>{f.board_id=void 0}))),a.push(n(me.util.updateQueryData("listImages",{board_id:t.board_id??"none",categories:o},f=>{Vn.removeOne(f,t.image_name)})));const s={board_id:"none",categories:o},l=me.endpoints.listImages.select(s)(i()),{data:u}=ii.includes(t.image_category)?xi.endpoints.getBoardImagesTotal.select(t.board_id??"none")(i()):xi.endpoints.getBoardAssetsTotal.select(t.board_id??"none")(i()),c=l.data&&l.data.ids.length>=(u??0),d=Ic(l.data,t);(c||d)&&a.push(n(me.util.updateQueryData("listImages",s,f=>{Vn.upsertOne(f,t)})));try{await r}catch{a.forEach(f=>f.undo())}}}),addImagesToBoard:e.mutation({query:({board_id:t,imageDTOs:n})=>({url:"board_images/batch",method:"POST",body:{image_names:n.map(r=>r.image_name),board_id:t}}),invalidatesTags:(t,n,{imageDTOs:r,board_id:i})=>{var a;const o=(a=r[0])==null?void 0:a.board_id;return[{type:"Board",id:i??"none"},{type:"BoardImagesTotal",id:i??"none"},{type:"BoardAssetsTotal",id:i??"none"},{type:"BoardImagesTotal",id:o??"none"},{type:"BoardAssetsTotal",id:o??"none"},{type:"BoardImagesTotal",id:"none"},{type:"BoardAssetsTotal",id:"none"}]},async onQueryStarted({board_id:t,imageDTOs:n},{dispatch:r,queryFulfilled:i,getState:o}){try{const{data:a}=await i,{added_image_names:s}=a;s.forEach(l=>{r(me.util.updateQueryData("getImageDTO",l,b=>{b.board_id=t}));const u=n.find(b=>b.image_name===l);if(!u)return;const c=aa(u),d=u.board_id;r(me.util.updateQueryData("listImages",{board_id:d??"none",categories:c},b=>{Vn.removeOne(b,u.image_name)}));const f={board_id:t,categories:c},h=me.endpoints.listImages.select(f)(o()),{data:p}=ii.includes(u.image_category)?xi.endpoints.getBoardImagesTotal.select(t??"none")(o()):xi.endpoints.getBoardAssetsTotal.select(t??"none")(o()),m=h.data&&h.data.ids.length>=(p??0),_=(p||0)>=fv?Ic(h.data,u):!0;(m||_)&&r(me.util.updateQueryData("listImages",f,b=>{Vn.upsertOne(b,{...u,board_id:t})}))})}catch{}}}),removeImagesFromBoard:e.mutation({query:({imageDTOs:t})=>({url:"board_images/batch/delete",method:"POST",body:{image_names:t.map(n=>n.image_name)}}),invalidatesTags:(t,n,{imageDTOs:r})=>{const i=[],o=[{type:"BoardImagesTotal",id:"none"},{type:"BoardAssetsTotal",id:"none"}];return t==null||t.removed_image_names.forEach(a=>{var l;const s=(l=r.find(u=>u.image_name===a))==null?void 0:l.board_id;!s||i.includes(s)||(o.push({type:"Board",id:s}),o.push({type:"BoardImagesTotal",id:s}),o.push({type:"BoardAssetsTotal",id:s}))}),o},async onQueryStarted({imageDTOs:t},{dispatch:n,queryFulfilled:r,getState:i}){try{const{data:o}=await r,{removed_image_names:a}=o;a.forEach(s=>{n(me.util.updateQueryData("getImageDTO",s,m=>{m.board_id=void 0}));const l=t.find(m=>m.image_name===s);if(!l)return;const u=aa(l);n(me.util.updateQueryData("listImages",{board_id:l.board_id??"none",categories:u},m=>{Vn.removeOne(m,l.image_name)}));const c={board_id:"none",categories:u},d=me.endpoints.listImages.select(c)(i()),{data:f}=ii.includes(l.image_category)?xi.endpoints.getBoardImagesTotal.select(l.board_id??"none")(i()):xi.endpoints.getBoardAssetsTotal.select(l.board_id??"none")(i()),h=d.data&&d.data.ids.length>=(f??0),p=(f||0)>=fv?Ic(d.data,l):!0;(h||p)&&n(me.util.updateQueryData("listImages",c,m=>{Vn.upsertOne(m,{...l,board_id:"none"})}))})}catch{}}})})}),{useGetIntermediatesCountQuery:xGe,useListImagesQuery:wGe,useLazyListImagesQuery:CGe,useGetImageDTOQuery:EGe,useGetImageMetadataQuery:kGe,useDeleteImageMutation:TGe,useDeleteImagesMutation:AGe,useUploadImageMutation:PGe,useClearIntermediatesMutation:IGe,useAddImagesToBoardMutation:RGe,useRemoveImagesFromBoardMutation:OGe,useAddImageToBoardMutation:MGe,useRemoveImageFromBoardMutation:NGe,useChangeImageIsIntermediateMutation:$Ge,useChangeImageSessionIdMutation:DGe,useDeleteBoardAndImagesMutation:LGe,useDeleteBoardMutation:FGe,useStarImagesMutation:BGe,useUnstarImagesMutation:zGe,useGetImageMetadataFromFileQuery:jGe}=me,Lj=Ne("socket/socketConnected"),BT=Ne("socket/appSocketConnected"),Fj=Ne("socket/socketDisconnected"),Bj=Ne("socket/appSocketDisconnected"),t0e=Ne("socket/socketSubscribedSession"),n0e=Ne("socket/appSocketSubscribedSession"),r0e=Ne("socket/socketUnsubscribedSession"),i0e=Ne("socket/appSocketUnsubscribedSession"),zj=Ne("socket/socketInvocationStarted"),zT=Ne("socket/appSocketInvocationStarted"),jT=Ne("socket/socketInvocationComplete"),UT=Ne("socket/appSocketInvocationComplete"),jj=Ne("socket/socketInvocationError"),U2=Ne("socket/appSocketInvocationError"),Uj=Ne("socket/socketGraphExecutionStateComplete"),Vj=Ne("socket/appSocketGraphExecutionStateComplete"),Gj=Ne("socket/socketGeneratorProgress"),VT=Ne("socket/appSocketGeneratorProgress"),Hj=Ne("socket/socketModelLoadStarted"),qj=Ne("socket/appSocketModelLoadStarted"),Wj=Ne("socket/socketModelLoadCompleted"),Kj=Ne("socket/appSocketModelLoadCompleted"),Qj=Ne("socket/socketSessionRetrievalError"),Xj=Ne("socket/appSocketSessionRetrievalError"),Yj=Ne("socket/socketInvocationRetrievalError"),Zj=Ne("socket/appSocketInvocationRetrievalError"),Jj=Ne("socket/socketQueueItemStatusChanged"),GT=Ne("socket/appSocketQueueItemStatusChanged"),HT=Ne("controlNet/imageProcessed"),Ef={none:{type:"none",get label(){return be.t("controlnet.none")},get description(){return be.t("controlnet.noneDescription")},default:{type:"none"}},canny_image_processor:{type:"canny_image_processor",get label(){return be.t("controlnet.canny")},get description(){return be.t("controlnet.cannyDescription")},default:{id:"canny_image_processor",type:"canny_image_processor",low_threshold:100,high_threshold:200}},color_map_image_processor:{type:"color_map_image_processor",get label(){return be.t("controlnet.colorMap")},get description(){return be.t("controlnet.colorMapDescription")},default:{id:"color_map_image_processor",type:"color_map_image_processor",color_map_tile_size:64}},content_shuffle_image_processor:{type:"content_shuffle_image_processor",get label(){return be.t("controlnet.contentShuffle")},get description(){return be.t("controlnet.contentShuffleDescription")},default:{id:"content_shuffle_image_processor",type:"content_shuffle_image_processor",detect_resolution:512,image_resolution:512,h:512,w:512,f:256}},hed_image_processor:{type:"hed_image_processor",get label(){return be.t("controlnet.hed")},get description(){return be.t("controlnet.hedDescription")},default:{id:"hed_image_processor",type:"hed_image_processor",detect_resolution:512,image_resolution:512,scribble:!1}},lineart_anime_image_processor:{type:"lineart_anime_image_processor",get label(){return be.t("controlnet.lineartAnime")},get description(){return be.t("controlnet.lineartAnimeDescription")},default:{id:"lineart_anime_image_processor",type:"lineart_anime_image_processor",detect_resolution:512,image_resolution:512}},lineart_image_processor:{type:"lineart_image_processor",get label(){return be.t("controlnet.lineart")},get description(){return be.t("controlnet.lineartDescription")},default:{id:"lineart_image_processor",type:"lineart_image_processor",detect_resolution:512,image_resolution:512,coarse:!1}},mediapipe_face_processor:{type:"mediapipe_face_processor",get label(){return be.t("controlnet.mediapipeFace")},get description(){return be.t("controlnet.mediapipeFaceDescription")},default:{id:"mediapipe_face_processor",type:"mediapipe_face_processor",max_faces:1,min_confidence:.5}},midas_depth_image_processor:{type:"midas_depth_image_processor",get label(){return be.t("controlnet.depthMidas")},get description(){return be.t("controlnet.depthMidasDescription")},default:{id:"midas_depth_image_processor",type:"midas_depth_image_processor",a_mult:2,bg_th:.1}},mlsd_image_processor:{type:"mlsd_image_processor",get label(){return be.t("controlnet.mlsd")},get description(){return be.t("controlnet.mlsdDescription")},default:{id:"mlsd_image_processor",type:"mlsd_image_processor",detect_resolution:512,image_resolution:512,thr_d:.1,thr_v:.1}},normalbae_image_processor:{type:"normalbae_image_processor",get label(){return be.t("controlnet.normalBae")},get description(){return be.t("controlnet.normalBaeDescription")},default:{id:"normalbae_image_processor",type:"normalbae_image_processor",detect_resolution:512,image_resolution:512}},openpose_image_processor:{type:"openpose_image_processor",get label(){return be.t("controlnet.openPose")},get description(){return be.t("controlnet.openPoseDescription")},default:{id:"openpose_image_processor",type:"openpose_image_processor",detect_resolution:512,image_resolution:512,hand_and_face:!1}},pidi_image_processor:{type:"pidi_image_processor",get label(){return be.t("controlnet.pidi")},get description(){return be.t("controlnet.pidiDescription")},default:{id:"pidi_image_processor",type:"pidi_image_processor",detect_resolution:512,image_resolution:512,scribble:!1,safe:!1}},zoe_depth_image_processor:{type:"zoe_depth_image_processor",get label(){return be.t("controlnet.depthZoe")},get description(){return be.t("controlnet.depthZoeDescription")},default:{id:"zoe_depth_image_processor",type:"zoe_depth_image_processor"}}},kv={canny:"canny_image_processor",mlsd:"mlsd_image_processor",depth:"midas_depth_image_processor",bae:"normalbae_image_processor",lineart:"lineart_image_processor",lineart_anime:"lineart_anime_image_processor",softedge:"hed_image_processor",shuffle:"content_shuffle_image_processor",openpose:"openpose_image_processor",mediapipe:"mediapipe_face_processor",pidi:"pidi_image_processor",zoe:"zoe_depth_image_processor",color:"color_map_image_processor"},BR={isEnabled:!0,model:null,weight:1,beginStepPct:0,endStepPct:1,controlMode:"balanced",resizeMode:"just_resize",controlImage:null,processedControlImage:null,processorType:"canny_image_processor",processorNode:Ef.canny_image_processor.default,shouldAutoConfig:!0},eU={adapterImage:null,model:null,weight:1,beginStepPct:0,endStepPct:1},_E={controlNets:{},isEnabled:!1,pendingControlImages:[],isIPAdapterEnabled:!1,ipAdapterInfo:{...eU}},tU=nr({name:"controlNet",initialState:_E,reducers:{isControlNetEnabledToggled:e=>{e.isEnabled=!e.isEnabled},controlNetEnabled:e=>{e.isEnabled=!0},controlNetAdded:(e,t)=>{const{controlNetId:n,controlNet:r}=t.payload;e.controlNets[n]={...r??BR,controlNetId:n}},controlNetRecalled:(e,t)=>{const n=t.payload;e.controlNets[n.controlNetId]={...n}},controlNetDuplicated:(e,t)=>{const{sourceControlNetId:n,newControlNetId:r}=t.payload,i=e.controlNets[n];if(!i)return;const o=wn(i);o.controlNetId=r,e.controlNets[r]=o},controlNetAddedFromImage:(e,t)=>{const{controlNetId:n,controlImage:r}=t.payload;e.controlNets[n]={...BR,controlNetId:n,controlImage:r}},controlNetRemoved:(e,t)=>{const{controlNetId:n}=t.payload;delete e.controlNets[n]},controlNetIsEnabledChanged:(e,t)=>{const{controlNetId:n,isEnabled:r}=t.payload,i=e.controlNets[n];i&&(i.isEnabled=r)},controlNetImageChanged:(e,t)=>{const{controlNetId:n,controlImage:r}=t.payload,i=e.controlNets[n];i&&(i.controlImage=r,i.processedControlImage=null,r!==null&&i.processorType!=="none"&&e.pendingControlImages.push(n))},controlNetProcessedImageChanged:(e,t)=>{const{controlNetId:n,processedControlImage:r}=t.payload,i=e.controlNets[n];i&&(i.processedControlImage=r,e.pendingControlImages=e.pendingControlImages.filter(o=>o!==n))},controlNetModelChanged:(e,t)=>{const{controlNetId:n,model:r}=t.payload,i=e.controlNets[n];if(i&&(i.model=r,i.processedControlImage=null,i.shouldAutoConfig)){let o;for(const a in kv)if(r.model_name.includes(a)){o=kv[a];break}o?(i.processorType=o,i.processorNode=Ef[o].default):(i.processorType="none",i.processorNode=Ef.none.default)}},controlNetWeightChanged:(e,t)=>{const{controlNetId:n,weight:r}=t.payload,i=e.controlNets[n];i&&(i.weight=r)},controlNetBeginStepPctChanged:(e,t)=>{const{controlNetId:n,beginStepPct:r}=t.payload,i=e.controlNets[n];i&&(i.beginStepPct=r)},controlNetEndStepPctChanged:(e,t)=>{const{controlNetId:n,endStepPct:r}=t.payload,i=e.controlNets[n];i&&(i.endStepPct=r)},controlNetControlModeChanged:(e,t)=>{const{controlNetId:n,controlMode:r}=t.payload,i=e.controlNets[n];i&&(i.controlMode=r)},controlNetResizeModeChanged:(e,t)=>{const{controlNetId:n,resizeMode:r}=t.payload,i=e.controlNets[n];i&&(i.resizeMode=r)},controlNetProcessorParamsChanged:(e,t)=>{const{controlNetId:n,changes:r}=t.payload,i=e.controlNets[n];if(!i)return;const o=i.processorNode;i.processorNode={...o,...r},i.shouldAutoConfig=!1},controlNetProcessorTypeChanged:(e,t)=>{const{controlNetId:n,processorType:r}=t.payload,i=e.controlNets[n];i&&(i.processedControlImage=null,i.processorType=r,i.processorNode=Ef[r].default,i.shouldAutoConfig=!1)},controlNetAutoConfigToggled:(e,t)=>{var o;const{controlNetId:n}=t.payload,r=e.controlNets[n];if(!r)return;const i=!r.shouldAutoConfig;if(i){let a;for(const s in kv)if((o=r.model)!=null&&o.model_name.includes(s)){a=kv[s];break}a?(r.processorType=a,r.processorNode=Ef[a].default):(r.processorType="none",r.processorNode=Ef.none.default)}r.shouldAutoConfig=i},controlNetReset:()=>({..._E}),isIPAdapterEnabledChanged:(e,t)=>{e.isIPAdapterEnabled=t.payload},ipAdapterRecalled:(e,t)=>{e.ipAdapterInfo=t.payload},ipAdapterImageChanged:(e,t)=>{e.ipAdapterInfo.adapterImage=t.payload},ipAdapterWeightChanged:(e,t)=>{e.ipAdapterInfo.weight=t.payload},ipAdapterModelChanged:(e,t)=>{e.ipAdapterInfo.model=t.payload},ipAdapterBeginStepPctChanged:(e,t)=>{e.ipAdapterInfo.beginStepPct=t.payload},ipAdapterEndStepPctChanged:(e,t)=>{e.ipAdapterInfo.endStepPct=t.payload},ipAdapterStateReset:e=>{e.isIPAdapterEnabled=!1,e.ipAdapterInfo={...eU}},clearPendingControlImages:e=>{e.pendingControlImages=[]}},extraReducers:e=>{e.addCase(HT,(t,n)=>{const r=t.controlNets[n.payload.controlNetId];r&&r.controlImage!==null&&t.pendingControlImages.push(n.payload.controlNetId)}),e.addCase(U2,t=>{t.pendingControlImages=[]}),e.addMatcher(me.endpoints.deleteImage.matchFulfilled,(t,n)=>{const{image_name:r}=n.meta.arg.originalArgs;Ca(t.controlNets,i=>{i.controlImage===r&&(i.controlImage=null,i.processedControlImage=null),i.processedControlImage===r&&(i.processedControlImage=null)})})}}),{isControlNetEnabledToggled:UGe,controlNetEnabled:VGe,controlNetAdded:GGe,controlNetRecalled:HGe,controlNetDuplicated:qGe,controlNetAddedFromImage:WGe,controlNetRemoved:nU,controlNetImageChanged:Sc,controlNetProcessedImageChanged:qT,controlNetIsEnabledChanged:rU,controlNetModelChanged:zR,controlNetWeightChanged:KGe,controlNetBeginStepPctChanged:QGe,controlNetEndStepPctChanged:XGe,controlNetControlModeChanged:YGe,controlNetResizeModeChanged:ZGe,controlNetProcessorParamsChanged:o0e,controlNetProcessorTypeChanged:a0e,controlNetReset:s0e,controlNetAutoConfigToggled:jR,isIPAdapterEnabledChanged:iU,ipAdapterRecalled:JGe,ipAdapterImageChanged:V2,ipAdapterWeightChanged:eHe,ipAdapterModelChanged:tHe,ipAdapterBeginStepPctChanged:nHe,ipAdapterEndStepPctChanged:rHe,ipAdapterStateReset:oU,clearPendingControlImages:l0e}=tU.actions,u0e=tU.reducer,c0e={imagesToDelete:[],isModalOpen:!1},aU=nr({name:"deleteImageModal",initialState:c0e,reducers:{isModalOpenChanged:(e,t)=>{e.isModalOpen=t.payload},imagesToDeleteSelected:(e,t)=>{e.imagesToDelete=t.payload},imageDeletionCanceled:e=>{e.imagesToDelete=[],e.isModalOpen=!1}}}),{isModalOpenChanged:WT,imagesToDeleteSelected:d0e,imageDeletionCanceled:iHe}=aU.actions,f0e=aU.reducer,KT={maxPrompts:100,combinatorial:!0,prompts:[],parsingError:void 0,isError:!1,isLoading:!1,seedBehaviour:"PER_ITERATION"},h0e=KT,sU=nr({name:"dynamicPrompts",initialState:h0e,reducers:{maxPromptsChanged:(e,t)=>{e.maxPrompts=t.payload},maxPromptsReset:e=>{e.maxPrompts=KT.maxPrompts},combinatorialToggled:e=>{e.combinatorial=!e.combinatorial},promptsChanged:(e,t)=>{e.prompts=t.payload},parsingErrorChanged:(e,t)=>{e.parsingError=t.payload},isErrorChanged:(e,t)=>{e.isError=t.payload},isLoadingChanged:(e,t)=>{e.isLoading=t.payload},seedBehaviourChanged:(e,t)=>{e.seedBehaviour=t.payload}}}),{maxPromptsChanged:p0e,maxPromptsReset:g0e,combinatorialToggled:m0e,promptsChanged:y0e,parsingErrorChanged:v0e,isErrorChanged:UR,isLoadingChanged:RC,seedBehaviourChanged:oHe}=sU.actions,b0e=sU.reducer,lU={selection:[],shouldAutoSwitch:!0,autoAssignBoardOnClick:!0,autoAddBoardId:"none",galleryImageMinimumWidth:96,selectedBoardId:"none",galleryView:"images",boardSearchText:""},uU=nr({name:"gallery",initialState:lU,reducers:{imageSelected:(e,t)=>{e.selection=t.payload?[t.payload]:[]},selectionChanged:(e,t)=>{e.selection=t.payload},shouldAutoSwitchChanged:(e,t)=>{e.shouldAutoSwitch=t.payload},setGalleryImageMinimumWidth:(e,t)=>{e.galleryImageMinimumWidth=t.payload},autoAssignBoardOnClickChanged:(e,t)=>{e.autoAssignBoardOnClick=t.payload},boardIdSelected:(e,t)=>{e.selectedBoardId=t.payload.boardId,e.galleryView="images"},autoAddBoardIdChanged:(e,t)=>{if(!t.payload){e.autoAddBoardId="none";return}e.autoAddBoardId=t.payload},galleryViewChanged:(e,t)=>{e.galleryView=t.payload},boardSearchTextChanged:(e,t)=>{e.boardSearchText=t.payload}},extraReducers:e=>{e.addMatcher(S0e,(t,n)=>{const r=n.meta.arg.originalArgs;r===t.selectedBoardId&&(t.selectedBoardId="none",t.galleryView="images"),r===t.autoAddBoardId&&(t.autoAddBoardId="none")}),e.addMatcher(xi.endpoints.listAllBoards.matchFulfilled,(t,n)=>{const r=n.payload;t.autoAddBoardId&&(r.map(i=>i.board_id).includes(t.autoAddBoardId)||(t.autoAddBoardId="none"))})}}),{imageSelected:Us,shouldAutoSwitchChanged:aHe,autoAssignBoardOnClickChanged:sHe,setGalleryImageMinimumWidth:lHe,boardIdSelected:w_,autoAddBoardIdChanged:uHe,galleryViewChanged:SE,selectionChanged:cU,boardSearchTextChanged:cHe}=uU.actions,_0e=uU.reducer,S0e=No(me.endpoints.deleteBoard.matchFulfilled,me.endpoints.deleteBoardAndImages.matchFulfilled),VR={weight:.75},x0e={loras:{}},dU=nr({name:"lora",initialState:x0e,reducers:{loraAdded:(e,t)=>{const{model_name:n,id:r,base_model:i}=t.payload;e.loras[r]={id:r,model_name:n,base_model:i,...VR}},loraRecalled:(e,t)=>{const{model_name:n,id:r,base_model:i,weight:o}=t.payload;e.loras[r]={id:r,model_name:n,base_model:i,weight:o}},loraRemoved:(e,t)=>{const n=t.payload;delete e.loras[n]},lorasCleared:e=>{e.loras={}},loraWeightChanged:(e,t)=>{const{id:n,weight:r}=t.payload,i=e.loras[n];i&&(i.weight=r)},loraWeightReset:(e,t)=>{const n=t.payload,r=e.loras[n];r&&(r.weight=VR.weight)}}}),{loraAdded:dHe,loraRemoved:fU,loraWeightChanged:fHe,loraWeightReset:hHe,lorasCleared:pHe,loraRecalled:gHe}=dU.actions,w0e=dU.reducer;function Ta(e){if(typeof e=="string"||typeof e=="number")return""+e;let t="";if(Array.isArray(e))for(let n=0,r;n{let t;const n=new Set,r=(l,u)=>{const c=typeof l=="function"?l(t):l;if(!Object.is(c,t)){const d=t;t=u??typeof c!="object"?c:Object.assign({},t,c),n.forEach(f=>f(t,d))}},i=()=>t,s={setState:r,getState:i,subscribe:l=>(n.add(l),()=>n.delete(l)),destroy:()=>{n.clear()}};return t=e(r,i,s),s},C0e=e=>e?GR(e):GR,{useSyncExternalStoreWithSelector:E0e}=Kge;function hU(e,t=e.getState,n){const r=E0e(e.subscribe,e.getState,e.getServerState||e.getState,t,n);return I.useDebugValue(r),r}const HR=(e,t)=>{const n=C0e(e),r=(i,o=t)=>hU(n,i,o);return Object.assign(r,n),r},k0e=(e,t)=>e?HR(e,t):HR;function Ro(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[r,i]of e)if(!Object.is(i,t.get(r)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const r of e)if(!t.has(r))return!1;return!0}const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(let r=0;r{}};function G2(){for(var e=0,t=arguments.length,n={},r;e=0&&(r=n.slice(i+1),n=n.slice(0,i)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:r}})}F1.prototype=G2.prototype={constructor:F1,on:function(e,t){var n=this._,r=A0e(e+"",n),i,o=-1,a=r.length;if(arguments.length<2){for(;++o0)for(var n=new Array(i),r=0,i,o;r=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),WR.hasOwnProperty(t)?{space:WR[t],local:e}:e}function I0e(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===xE&&t.documentElement.namespaceURI===xE?t.createElement(e):t.createElementNS(n,e)}}function R0e(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function pU(e){var t=H2(e);return(t.local?R0e:I0e)(t)}function O0e(){}function QT(e){return e==null?O0e:function(){return this.querySelector(e)}}function M0e(e){typeof e!="function"&&(e=QT(e));for(var t=this._groups,n=t.length,r=new Array(n),i=0;i=g&&(g=v+1);!(S=_[g])&&++g=0;)(a=r[i])&&(o&&a.compareDocumentPosition(o)^4&&o.parentNode.insertBefore(a,o),o=a);return this}function iye(e){e||(e=oye);function t(d,f){return d&&f?e(d.__data__,f.__data__):!d-!f}for(var n=this._groups,r=n.length,i=new Array(r),o=0;ot?1:e>=t?0:NaN}function aye(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function sye(){return Array.from(this)}function lye(){for(var e=this._groups,t=0,n=e.length;t1?this.each((t==null?bye:typeof t=="function"?Sye:_ye)(e,t,n??"")):Jh(this.node(),e)}function Jh(e,t){return e.style.getPropertyValue(t)||bU(e).getComputedStyle(e,null).getPropertyValue(t)}function wye(e){return function(){delete this[e]}}function Cye(e,t){return function(){this[e]=t}}function Eye(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function kye(e,t){return arguments.length>1?this.each((t==null?wye:typeof t=="function"?Eye:Cye)(e,t)):this.node()[e]}function _U(e){return e.trim().split(/^|\s+/)}function XT(e){return e.classList||new SU(e)}function SU(e){this._node=e,this._names=_U(e.getAttribute("class")||"")}SU.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function xU(e,t){for(var n=XT(e),r=-1,i=t.length;++r=0&&(n=t.slice(r+1),t=t.slice(0,r)),{type:t,name:n}})}function eve(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,i=t.length,o;n()=>e;function wE(e,{sourceEvent:t,subject:n,target:r,identifier:i,active:o,x:a,y:s,dx:l,dy:u,dispatch:c}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:i,enumerable:!0,configurable:!0},active:{value:o,enumerable:!0,configurable:!0},x:{value:a,enumerable:!0,configurable:!0},y:{value:s,enumerable:!0,configurable:!0},dx:{value:l,enumerable:!0,configurable:!0},dy:{value:u,enumerable:!0,configurable:!0},_:{value:c}})}wE.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function cve(e){return!e.ctrlKey&&!e.button}function dve(){return this.parentNode}function fve(e,t){return t??{x:e.x,y:e.y}}function hve(){return navigator.maxTouchPoints||"ontouchstart"in this}function pve(){var e=cve,t=dve,n=fve,r=hve,i={},o=G2("start","drag","end"),a=0,s,l,u,c,d=0;function f(y){y.on("mousedown.drag",h).filter(r).on("touchstart.drag",_).on("touchmove.drag",b,uve).on("touchend.drag touchcancel.drag",v).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function h(y,S){if(!(c||!e.call(this,y,S))){var w=g(this,t.call(this,y,S),y,S,"mouse");w&&(Wa(y.view).on("mousemove.drag",p,l0).on("mouseup.drag",m,l0),kU(y.view),OC(y),u=!1,s=y.clientX,l=y.clientY,w("start",y))}}function p(y){if(ph(y),!u){var S=y.clientX-s,w=y.clientY-l;u=S*S+w*w>d}i.mouse("drag",y)}function m(y){Wa(y.view).on("mousemove.drag mouseup.drag",null),TU(y.view,u),ph(y),i.mouse("end",y)}function _(y,S){if(e.call(this,y,S)){var w=y.changedTouches,x=t.call(this,y,S),C=w.length,T,k;for(T=0;T>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?Av(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?Av(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=mve.exec(e))?new Co(t[1],t[2],t[3],1):(t=yve.exec(e))?new Co(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=vve.exec(e))?Av(t[1],t[2],t[3],t[4]):(t=bve.exec(e))?Av(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=_ve.exec(e))?e9(t[1],t[2]/100,t[3]/100,1):(t=Sve.exec(e))?e9(t[1],t[2]/100,t[3]/100,t[4]):KR.hasOwnProperty(e)?YR(KR[e]):e==="transparent"?new Co(NaN,NaN,NaN,0):null}function YR(e){return new Co(e>>16&255,e>>8&255,e&255,1)}function Av(e,t,n,r){return r<=0&&(e=t=n=NaN),new Co(e,t,n,r)}function Cve(e){return e instanceof Sy||(e=d0(e)),e?(e=e.rgb(),new Co(e.r,e.g,e.b,e.opacity)):new Co}function CE(e,t,n,r){return arguments.length===1?Cve(e):new Co(e,t,n,r??1)}function Co(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}YT(Co,CE,AU(Sy,{brighter(e){return e=e==null?E_:Math.pow(E_,e),new Co(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?u0:Math.pow(u0,e),new Co(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Co(gd(this.r),gd(this.g),gd(this.b),k_(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:ZR,formatHex:ZR,formatHex8:Eve,formatRgb:JR,toString:JR}));function ZR(){return`#${id(this.r)}${id(this.g)}${id(this.b)}`}function Eve(){return`#${id(this.r)}${id(this.g)}${id(this.b)}${id((isNaN(this.opacity)?1:this.opacity)*255)}`}function JR(){const e=k_(this.opacity);return`${e===1?"rgb(":"rgba("}${gd(this.r)}, ${gd(this.g)}, ${gd(this.b)}${e===1?")":`, ${e})`}`}function k_(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function gd(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function id(e){return e=gd(e),(e<16?"0":"")+e.toString(16)}function e9(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new Ka(e,t,n,r)}function PU(e){if(e instanceof Ka)return new Ka(e.h,e.s,e.l,e.opacity);if(e instanceof Sy||(e=d0(e)),!e)return new Ka;if(e instanceof Ka)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,i=Math.min(t,n,r),o=Math.max(t,n,r),a=NaN,s=o-i,l=(o+i)/2;return s?(t===o?a=(n-r)/s+(n0&&l<1?0:a,new Ka(a,s,l,e.opacity)}function kve(e,t,n,r){return arguments.length===1?PU(e):new Ka(e,t,n,r??1)}function Ka(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}YT(Ka,kve,AU(Sy,{brighter(e){return e=e==null?E_:Math.pow(E_,e),new Ka(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?u0:Math.pow(u0,e),new Ka(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,n=this.l,r=n+(n<.5?n:1-n)*t,i=2*n-r;return new Co(MC(e>=240?e-240:e+120,i,r),MC(e,i,r),MC(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new Ka(t9(this.h),Pv(this.s),Pv(this.l),k_(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=k_(this.opacity);return`${e===1?"hsl(":"hsla("}${t9(this.h)}, ${Pv(this.s)*100}%, ${Pv(this.l)*100}%${e===1?")":`, ${e})`}`}}));function t9(e){return e=(e||0)%360,e<0?e+360:e}function Pv(e){return Math.max(0,Math.min(1,e||0))}function MC(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}const IU=e=>()=>e;function Tve(e,t){return function(n){return e+n*t}}function Ave(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(r){return Math.pow(e+r*t,n)}}function Pve(e){return(e=+e)==1?RU:function(t,n){return n-t?Ave(t,n,e):IU(isNaN(t)?n:t)}}function RU(e,t){var n=t-e;return n?Tve(e,n):IU(isNaN(e)?t:e)}const n9=function e(t){var n=Pve(t);function r(i,o){var a=n((i=CE(i)).r,(o=CE(o)).r),s=n(i.g,o.g),l=n(i.b,o.b),u=RU(i.opacity,o.opacity);return function(c){return i.r=a(c),i.g=s(c),i.b=l(c),i.opacity=u(c),i+""}}return r.gamma=e,r}(1);function mu(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}var EE=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,NC=new RegExp(EE.source,"g");function Ive(e){return function(){return e}}function Rve(e){return function(t){return e(t)+""}}function Ove(e,t){var n=EE.lastIndex=NC.lastIndex=0,r,i,o,a=-1,s=[],l=[];for(e=e+"",t=t+"";(r=EE.exec(e))&&(i=NC.exec(t));)(o=i.index)>n&&(o=t.slice(n,o),s[a]?s[a]+=o:s[++a]=o),(r=r[0])===(i=i[0])?s[a]?s[a]+=i:s[++a]=i:(s[++a]=null,l.push({i:a,x:mu(r,i)})),n=NC.lastIndex;return n180?c+=360:c-u>180&&(u+=360),f.push({i:d.push(i(d)+"rotate(",null,r)-2,x:mu(u,c)})):c&&d.push(i(d)+"rotate("+c+r)}function s(u,c,d,f){u!==c?f.push({i:d.push(i(d)+"skewX(",null,r)-2,x:mu(u,c)}):c&&d.push(i(d)+"skewX("+c+r)}function l(u,c,d,f,h,p){if(u!==d||c!==f){var m=h.push(i(h)+"scale(",null,",",null,")");p.push({i:m-4,x:mu(u,d)},{i:m-2,x:mu(c,f)})}else(d!==1||f!==1)&&h.push(i(h)+"scale("+d+","+f+")")}return function(u,c){var d=[],f=[];return u=e(u),c=e(c),o(u.translateX,u.translateY,c.translateX,c.translateY,d,f),a(u.rotate,c.rotate,d,f),s(u.skewX,c.skewX,d,f),l(u.scaleX,u.scaleY,c.scaleX,c.scaleY,d,f),u=c=null,function(h){for(var p=-1,m=f.length,_;++p=0&&e._call.call(void 0,t),e=e._next;--ep}function o9(){Md=(A_=f0.now())+q2,ep=bg=0;try{Uve()}finally{ep=0,Gve(),Md=0}}function Vve(){var e=f0.now(),t=e-A_;t>NU&&(q2-=t,A_=e)}function Gve(){for(var e,t=T_,n,r=1/0;t;)t._call?(r>t._time&&(r=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:T_=n);_g=e,TE(r)}function TE(e){if(!ep){bg&&(bg=clearTimeout(bg));var t=e-Md;t>24?(e<1/0&&(bg=setTimeout(o9,e-f0.now()-q2)),Wp&&(Wp=clearInterval(Wp))):(Wp||(A_=f0.now(),Wp=setInterval(Vve,NU)),ep=1,$U(o9))}}function a9(e,t,n){var r=new P_;return t=t==null?0:+t,r.restart(i=>{r.stop(),e(i+t)},t,n),r}var Hve=G2("start","end","cancel","interrupt"),qve=[],LU=0,s9=1,AE=2,B1=3,l9=4,PE=5,z1=6;function W2(e,t,n,r,i,o){var a=e.__transition;if(!a)e.__transition={};else if(n in a)return;Wve(e,n,{name:t,index:r,group:i,on:Hve,tween:qve,time:o.time,delay:o.delay,duration:o.duration,ease:o.ease,timer:null,state:LU})}function JT(e,t){var n=ds(e,t);if(n.state>LU)throw new Error("too late; already scheduled");return n}function nl(e,t){var n=ds(e,t);if(n.state>B1)throw new Error("too late; already running");return n}function ds(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function Wve(e,t,n){var r=e.__transition,i;r[t]=n,n.timer=DU(o,0,n.time);function o(u){n.state=s9,n.timer.restart(a,n.delay,n.time),n.delay<=u&&a(u-n.delay)}function a(u){var c,d,f,h;if(n.state!==s9)return l();for(c in r)if(h=r[c],h.name===n.name){if(h.state===B1)return a9(a);h.state===l9?(h.state=z1,h.timer.stop(),h.on.call("interrupt",e,e.__data__,h.index,h.group),delete r[c]):+cAE&&r.state=0&&(t=t.slice(0,n)),!t||t==="start"})}function w1e(e,t,n){var r,i,o=x1e(t)?JT:nl;return function(){var a=o(this,e),s=a.on;s!==r&&(i=(r=s).copy()).on(t,n),a.on=i}}function C1e(e,t){var n=this._id;return arguments.length<2?ds(this.node(),n).on.on(e):this.each(w1e(n,e,t))}function E1e(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function k1e(){return this.on("end.remove",E1e(this._id))}function T1e(e){var t=this._name,n=this._id;typeof e!="function"&&(e=QT(e));for(var r=this._groups,i=r.length,o=new Array(i),a=0;a()=>e;function Z1e(e,{sourceEvent:t,target:n,transform:r,dispatch:i}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:i}})}function Pl(e,t,n){this.k=e,this.x=t,this.y=n}Pl.prototype={constructor:Pl,scale:function(e){return e===1?this:new Pl(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Pl(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var Ku=new Pl(1,0,0);Pl.prototype;function $C(e){e.stopImmediatePropagation()}function Kp(e){e.preventDefault(),e.stopImmediatePropagation()}function J1e(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function ebe(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function u9(){return this.__zoom||Ku}function tbe(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function nbe(){return navigator.maxTouchPoints||"ontouchstart"in this}function rbe(e,t,n){var r=e.invertX(t[0][0])-n[0][0],i=e.invertX(t[1][0])-n[1][0],o=e.invertY(t[0][1])-n[0][1],a=e.invertY(t[1][1])-n[1][1];return e.translate(i>r?(r+i)/2:Math.min(0,r)||Math.max(0,i),a>o?(o+a)/2:Math.min(0,o)||Math.max(0,a))}function ibe(){var e=J1e,t=ebe,n=rbe,r=tbe,i=nbe,o=[0,1/0],a=[[-1/0,-1/0],[1/0,1/0]],s=250,l=zve,u=G2("start","zoom","end"),c,d,f,h=500,p=150,m=0,_=10;function b(E){E.property("__zoom",u9).on("wheel.zoom",C,{passive:!1}).on("mousedown.zoom",T).on("dblclick.zoom",k).filter(i).on("touchstart.zoom",P).on("touchmove.zoom",$).on("touchend.zoom touchcancel.zoom",O).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}b.transform=function(E,A,D,L){var M=E.selection?E.selection():E;M.property("__zoom",u9),E!==M?S(E,A,D,L):M.interrupt().each(function(){w(this,arguments).event(L).start().zoom(null,typeof A=="function"?A.apply(this,arguments):A).end()})},b.scaleBy=function(E,A,D,L){b.scaleTo(E,function(){var M=this.__zoom.k,R=typeof A=="function"?A.apply(this,arguments):A;return M*R},D,L)},b.scaleTo=function(E,A,D,L){b.transform(E,function(){var M=t.apply(this,arguments),R=this.__zoom,N=D==null?y(M):typeof D=="function"?D.apply(this,arguments):D,B=R.invert(N),U=typeof A=="function"?A.apply(this,arguments):A;return n(g(v(R,U),N,B),M,a)},D,L)},b.translateBy=function(E,A,D,L){b.transform(E,function(){return n(this.__zoom.translate(typeof A=="function"?A.apply(this,arguments):A,typeof D=="function"?D.apply(this,arguments):D),t.apply(this,arguments),a)},null,L)},b.translateTo=function(E,A,D,L,M){b.transform(E,function(){var R=t.apply(this,arguments),N=this.__zoom,B=L==null?y(R):typeof L=="function"?L.apply(this,arguments):L;return n(Ku.translate(B[0],B[1]).scale(N.k).translate(typeof A=="function"?-A.apply(this,arguments):-A,typeof D=="function"?-D.apply(this,arguments):-D),R,a)},L,M)};function v(E,A){return A=Math.max(o[0],Math.min(o[1],A)),A===E.k?E:new Pl(A,E.x,E.y)}function g(E,A,D){var L=A[0]-D[0]*E.k,M=A[1]-D[1]*E.k;return L===E.x&&M===E.y?E:new Pl(E.k,L,M)}function y(E){return[(+E[0][0]+ +E[1][0])/2,(+E[0][1]+ +E[1][1])/2]}function S(E,A,D,L){E.on("start.zoom",function(){w(this,arguments).event(L).start()}).on("interrupt.zoom end.zoom",function(){w(this,arguments).event(L).end()}).tween("zoom",function(){var M=this,R=arguments,N=w(M,R).event(L),B=t.apply(M,R),U=D==null?y(B):typeof D=="function"?D.apply(M,R):D,G=Math.max(B[1][0]-B[0][0],B[1][1]-B[0][1]),Y=M.__zoom,ee=typeof A=="function"?A.apply(M,R):A,J=l(Y.invert(U).concat(G/Y.k),ee.invert(U).concat(G/ee.k));return function(j){if(j===1)j=ee;else{var Q=J(j),ne=G/Q[2];j=new Pl(ne,U[0]-Q[0]*ne,U[1]-Q[1]*ne)}N.zoom(null,j)}})}function w(E,A,D){return!D&&E.__zooming||new x(E,A)}function x(E,A){this.that=E,this.args=A,this.active=0,this.sourceEvent=null,this.extent=t.apply(E,A),this.taps=0}x.prototype={event:function(E){return E&&(this.sourceEvent=E),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(E,A){return this.mouse&&E!=="mouse"&&(this.mouse[1]=A.invert(this.mouse[0])),this.touch0&&E!=="touch"&&(this.touch0[1]=A.invert(this.touch0[0])),this.touch1&&E!=="touch"&&(this.touch1[1]=A.invert(this.touch1[0])),this.that.__zoom=A,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(E){var A=Wa(this.that).datum();u.call(E,this.that,new Z1e(E,{sourceEvent:this.sourceEvent,target:b,type:E,transform:this.that.__zoom,dispatch:u}),A)}};function C(E,...A){if(!e.apply(this,arguments))return;var D=w(this,A).event(E),L=this.__zoom,M=Math.max(o[0],Math.min(o[1],L.k*Math.pow(2,r.apply(this,arguments)))),R=xs(E);if(D.wheel)(D.mouse[0][0]!==R[0]||D.mouse[0][1]!==R[1])&&(D.mouse[1]=L.invert(D.mouse[0]=R)),clearTimeout(D.wheel);else{if(L.k===M)return;D.mouse=[R,L.invert(R)],j1(this),D.start()}Kp(E),D.wheel=setTimeout(N,p),D.zoom("mouse",n(g(v(L,M),D.mouse[0],D.mouse[1]),D.extent,a));function N(){D.wheel=null,D.end()}}function T(E,...A){if(f||!e.apply(this,arguments))return;var D=E.currentTarget,L=w(this,A,!0).event(E),M=Wa(E.view).on("mousemove.zoom",U,!0).on("mouseup.zoom",G,!0),R=xs(E,D),N=E.clientX,B=E.clientY;kU(E.view),$C(E),L.mouse=[R,this.__zoom.invert(R)],j1(this),L.start();function U(Y){if(Kp(Y),!L.moved){var ee=Y.clientX-N,J=Y.clientY-B;L.moved=ee*ee+J*J>m}L.event(Y).zoom("mouse",n(g(L.that.__zoom,L.mouse[0]=xs(Y,D),L.mouse[1]),L.extent,a))}function G(Y){M.on("mousemove.zoom mouseup.zoom",null),TU(Y.view,L.moved),Kp(Y),L.event(Y).end()}}function k(E,...A){if(e.apply(this,arguments)){var D=this.__zoom,L=xs(E.changedTouches?E.changedTouches[0]:E,this),M=D.invert(L),R=D.k*(E.shiftKey?.5:2),N=n(g(v(D,R),L,M),t.apply(this,A),a);Kp(E),s>0?Wa(this).transition().duration(s).call(S,N,L,E):Wa(this).call(b.transform,N,L,E)}}function P(E,...A){if(e.apply(this,arguments)){var D=E.touches,L=D.length,M=w(this,A,E.changedTouches.length===L).event(E),R,N,B,U;for($C(E),N=0;N"[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.dev/error#001",error002:()=>"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.",error003:e=>`Node type "${e}" not found. Using fallback type "default".`,error004:()=>"The React Flow parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error007:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,t)=>`Couldn't create edge for ${e?"target":"source"} handle id: "${e?t.targetHandle:t.sourceHandle}", edge id: ${t.id}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:e=>`Edge type "${e}" not found. Using fallback type "default".`,error012:e=>`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`},jU=ql.error001();function br(e,t){const n=I.useContext(K2);if(n===null)throw new Error(jU);return hU(n,e,t)}const hi=()=>{const e=I.useContext(K2);if(e===null)throw new Error(jU);return I.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe,destroy:e.destroy}),[e])},abe=e=>e.userSelectionActive?"none":"all";function sbe({position:e,children:t,className:n,style:r,...i}){const o=br(abe),a=`${e}`.split("-");return W.jsx("div",{className:Ta(["react-flow__panel",n,...a]),style:{...r,pointerEvents:o},...i,children:t})}function lbe({proOptions:e,position:t="bottom-right"}){return e!=null&&e.hideAttribution?null:W.jsx(sbe,{position:t,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://pro.reactflow.dev",children:W.jsx("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const ube=({x:e,y:t,label:n,labelStyle:r={},labelShowBg:i=!0,labelBgStyle:o={},labelBgPadding:a=[2,4],labelBgBorderRadius:s=2,children:l,className:u,...c})=>{const d=I.useRef(null),[f,h]=I.useState({x:0,y:0,width:0,height:0}),p=Ta(["react-flow__edge-textwrapper",u]);return I.useEffect(()=>{if(d.current){const m=d.current.getBBox();h({x:m.x,y:m.y,width:m.width,height:m.height})}},[n]),typeof n>"u"||!n?null:W.jsxs("g",{transform:`translate(${e-f.width/2} ${t-f.height/2})`,className:p,visibility:f.width?"visible":"hidden",...c,children:[i&&W.jsx("rect",{width:f.width+2*a[0],x:-a[0],y:-a[1],height:f.height+2*a[1],className:"react-flow__edge-textbg",style:o,rx:s,ry:s}),W.jsx("text",{className:"react-flow__edge-text",y:f.height/2,dy:"0.3em",ref:d,style:r,children:n}),l]})};var cbe=I.memo(ube);const tA=e=>({width:e.offsetWidth,height:e.offsetHeight}),tp=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),nA=(e={x:0,y:0},t)=>({x:tp(e.x,t[0][0],t[1][0]),y:tp(e.y,t[0][1],t[1][1])}),c9=(e,t,n)=>en?-tp(Math.abs(e-n),1,50)/50:0,UU=(e,t)=>{const n=c9(e.x,35,t.width-35)*20,r=c9(e.y,35,t.height-35)*20;return[n,r]},VU=e=>{var t;return((t=e.getRootNode)==null?void 0:t.call(e))||(window==null?void 0:window.document)},GU=(e,t)=>({x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x2,t.x2),y2:Math.max(e.y2,t.y2)}),h0=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),HU=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),d9=e=>({...e.positionAbsolute||{x:0,y:0},width:e.width||0,height:e.height||0}),mHe=(e,t)=>HU(GU(h0(e),h0(t))),IE=(e,t)=>{const n=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),r=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(n*r)},dbe=e=>ba(e.width)&&ba(e.height)&&ba(e.x)&&ba(e.y),ba=e=>!isNaN(e)&&isFinite(e),Kr=Symbol.for("internals"),qU=["Enter"," ","Escape"],fbe=(e,t)=>{},hbe=e=>"nativeEvent"in e;function RE(e){var i,o;const t=hbe(e)?e.nativeEvent:e,n=((o=(i=t.composedPath)==null?void 0:i.call(t))==null?void 0:o[0])||e.target;return["INPUT","SELECT","TEXTAREA"].includes(n==null?void 0:n.nodeName)||(n==null?void 0:n.hasAttribute("contenteditable"))||!!(n!=null&&n.closest(".nokey"))}const WU=e=>"clientX"in e,Qu=(e,t)=>{var o,a;const n=WU(e),r=n?e.clientX:(o=e.touches)==null?void 0:o[0].clientX,i=n?e.clientY:(a=e.touches)==null?void 0:a[0].clientY;return{x:r-((t==null?void 0:t.left)??0),y:i-((t==null?void 0:t.top)??0)}},I_=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0},xy=({id:e,path:t,labelX:n,labelY:r,label:i,labelStyle:o,labelShowBg:a,labelBgStyle:s,labelBgPadding:l,labelBgBorderRadius:u,style:c,markerEnd:d,markerStart:f,interactionWidth:h=20})=>W.jsxs(W.Fragment,{children:[W.jsx("path",{id:e,style:c,d:t,fill:"none",className:"react-flow__edge-path",markerEnd:d,markerStart:f}),h&&W.jsx("path",{d:t,fill:"none",strokeOpacity:0,strokeWidth:h,className:"react-flow__edge-interaction"}),i&&ba(n)&&ba(r)?W.jsx(cbe,{x:n,y:r,label:i,labelStyle:o,labelShowBg:a,labelBgStyle:s,labelBgPadding:l,labelBgBorderRadius:u}):null]});xy.displayName="BaseEdge";function Qp(e,t,n){return n===void 0?n:r=>{const i=t().edges.find(o=>o.id===e);i&&n(r,{...i})}}function KU({sourceX:e,sourceY:t,targetX:n,targetY:r}){const i=Math.abs(n-e)/2,o=n{const[_,b,v]=XU({sourceX:e,sourceY:t,sourcePosition:i,targetX:n,targetY:r,targetPosition:o});return W.jsx(xy,{path:_,labelX:b,labelY:v,label:a,labelStyle:s,labelShowBg:l,labelBgStyle:u,labelBgPadding:c,labelBgBorderRadius:d,style:f,markerEnd:h,markerStart:p,interactionWidth:m})});rA.displayName="SimpleBezierEdge";const h9={[tt.Left]:{x:-1,y:0},[tt.Right]:{x:1,y:0},[tt.Top]:{x:0,y:-1},[tt.Bottom]:{x:0,y:1}},pbe=({source:e,sourcePosition:t=tt.Bottom,target:n})=>t===tt.Left||t===tt.Right?e.xMath.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function gbe({source:e,sourcePosition:t=tt.Bottom,target:n,targetPosition:r=tt.Top,center:i,offset:o}){const a=h9[t],s=h9[r],l={x:e.x+a.x*o,y:e.y+a.y*o},u={x:n.x+s.x*o,y:n.y+s.y*o},c=pbe({source:l,sourcePosition:t,target:u}),d=c.x!==0?"x":"y",f=c[d];let h=[],p,m;const _={x:0,y:0},b={x:0,y:0},[v,g,y,S]=KU({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(a[d]*s[d]===-1){p=i.x||v,m=i.y||g;const x=[{x:p,y:l.y},{x:p,y:u.y}],C=[{x:l.x,y:m},{x:u.x,y:m}];a[d]===f?h=d==="x"?x:C:h=d==="x"?C:x}else{const x=[{x:l.x,y:u.y}],C=[{x:u.x,y:l.y}];if(d==="x"?h=a.x===f?C:x:h=a.y===f?x:C,t===r){const O=Math.abs(e[d]-n[d]);if(O<=o){const E=Math.min(o-1,o-O);a[d]===f?_[d]=(l[d]>e[d]?-1:1)*E:b[d]=(u[d]>n[d]?-1:1)*E}}if(t!==r){const O=d==="x"?"y":"x",E=a[d]===s[O],A=l[O]>u[O],D=l[O]=$?(p=(T.x+k.x)/2,m=h[0].y):(p=h[0].x,m=(T.y+k.y)/2)}return[[e,{x:l.x+_.x,y:l.y+_.y},...h,{x:u.x+b.x,y:u.y+b.y},n],p,m,y,S]}function mbe(e,t,n,r){const i=Math.min(p9(e,t)/2,p9(t,n)/2,r),{x:o,y:a}=t;if(e.x===o&&o===n.x||e.y===a&&a===n.y)return`L${o} ${a}`;if(e.y===a){const u=e.x{let g="";return v>0&&v{const[b,v,g]=OE({sourceX:e,sourceY:t,sourcePosition:d,targetX:n,targetY:r,targetPosition:f,borderRadius:m==null?void 0:m.borderRadius,offset:m==null?void 0:m.offset});return W.jsx(xy,{path:b,labelX:v,labelY:g,label:i,labelStyle:o,labelShowBg:a,labelBgStyle:s,labelBgPadding:l,labelBgBorderRadius:u,style:c,markerEnd:h,markerStart:p,interactionWidth:_})});Q2.displayName="SmoothStepEdge";const iA=I.memo(e=>{var t;return W.jsx(Q2,{...e,pathOptions:I.useMemo(()=>{var n;return{borderRadius:0,offset:(n=e.pathOptions)==null?void 0:n.offset}},[(t=e.pathOptions)==null?void 0:t.offset])})});iA.displayName="StepEdge";function ybe({sourceX:e,sourceY:t,targetX:n,targetY:r}){const[i,o,a,s]=KU({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,i,o,a,s]}const oA=I.memo(({sourceX:e,sourceY:t,targetX:n,targetY:r,label:i,labelStyle:o,labelShowBg:a,labelBgStyle:s,labelBgPadding:l,labelBgBorderRadius:u,style:c,markerEnd:d,markerStart:f,interactionWidth:h})=>{const[p,m,_]=ybe({sourceX:e,sourceY:t,targetX:n,targetY:r});return W.jsx(xy,{path:p,labelX:m,labelY:_,label:i,labelStyle:o,labelShowBg:a,labelBgStyle:s,labelBgPadding:l,labelBgBorderRadius:u,style:c,markerEnd:d,markerStart:f,interactionWidth:h})});oA.displayName="StraightEdge";function Ov(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function g9({pos:e,x1:t,y1:n,x2:r,y2:i,c:o}){switch(e){case tt.Left:return[t-Ov(t-r,o),n];case tt.Right:return[t+Ov(r-t,o),n];case tt.Top:return[t,n-Ov(n-i,o)];case tt.Bottom:return[t,n+Ov(i-n,o)]}}function YU({sourceX:e,sourceY:t,sourcePosition:n=tt.Bottom,targetX:r,targetY:i,targetPosition:o=tt.Top,curvature:a=.25}){const[s,l]=g9({pos:n,x1:e,y1:t,x2:r,y2:i,c:a}),[u,c]=g9({pos:o,x1:r,y1:i,x2:e,y2:t,c:a}),[d,f,h,p]=QU({sourceX:e,sourceY:t,targetX:r,targetY:i,sourceControlX:s,sourceControlY:l,targetControlX:u,targetControlY:c});return[`M${e},${t} C${s},${l} ${u},${c} ${r},${i}`,d,f,h,p]}const O_=I.memo(({sourceX:e,sourceY:t,targetX:n,targetY:r,sourcePosition:i=tt.Bottom,targetPosition:o=tt.Top,label:a,labelStyle:s,labelShowBg:l,labelBgStyle:u,labelBgPadding:c,labelBgBorderRadius:d,style:f,markerEnd:h,markerStart:p,pathOptions:m,interactionWidth:_})=>{const[b,v,g]=YU({sourceX:e,sourceY:t,sourcePosition:i,targetX:n,targetY:r,targetPosition:o,curvature:m==null?void 0:m.curvature});return W.jsx(xy,{path:b,labelX:v,labelY:g,label:a,labelStyle:s,labelShowBg:l,labelBgStyle:u,labelBgPadding:c,labelBgBorderRadius:d,style:f,markerEnd:h,markerStart:p,interactionWidth:_})});O_.displayName="BezierEdge";const aA=I.createContext(null),vbe=aA.Provider;aA.Consumer;const bbe=()=>I.useContext(aA),_be=e=>"id"in e&&"source"in e&&"target"in e,ZU=e=>"id"in e&&!("source"in e)&&!("target"in e),Sbe=(e,t,n)=>{if(!ZU(e))return[];const r=n.filter(i=>i.source===e.id).map(i=>i.target);return t.filter(i=>r.includes(i.id))},xbe=(e,t,n)=>{if(!ZU(e))return[];const r=n.filter(i=>i.target===e.id).map(i=>i.source);return t.filter(i=>r.includes(i.id))},JU=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`reactflow__edge-${e}${t||""}-${n}${r||""}`,ME=(e,t)=>typeof e>"u"?"":typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(r=>`${r}=${e[r]}`).join("&")}`,wbe=(e,t)=>t.some(n=>n.source===e.source&&n.target===e.target&&(n.sourceHandle===e.sourceHandle||!n.sourceHandle&&!e.sourceHandle)&&(n.targetHandle===e.targetHandle||!n.targetHandle&&!e.targetHandle)),Sg=(e,t)=>{if(!e.source||!e.target)return t;let n;return _be(e)?n={...e}:n={...e,id:JU(e)},wbe(n,t)?t:t.concat(n)},Cbe=(e,t,n,r={shouldReplaceId:!0})=>{const{id:i,...o}=e;if(!t.source||!t.target||!n.find(l=>l.id===i))return n;const s={...o,id:r.shouldReplaceId?JU(t):i,source:t.source,target:t.target,sourceHandle:t.sourceHandle,targetHandle:t.targetHandle};return n.filter(l=>l.id!==i).concat(s)},eV=({x:e,y:t},[n,r,i],o,[a,s])=>{const l={x:(e-n)/i,y:(t-r)/i};return o?{x:a*Math.round(l.x/a),y:s*Math.round(l.y/s)}:l},Ebe=({x:e,y:t},[n,r,i])=>({x:e*i+n,y:t*i+r}),mh=(e,t=[0,0])=>{if(!e)return{x:0,y:0,positionAbsolute:{x:0,y:0}};const n=(e.width??0)*t[0],r=(e.height??0)*t[1],i={x:e.position.x-n,y:e.position.y-r};return{...i,positionAbsolute:e.positionAbsolute?{x:e.positionAbsolute.x-n,y:e.positionAbsolute.y-r}:i}},sA=(e,t=[0,0])=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const n=e.reduce((r,i)=>{const{x:o,y:a}=mh(i,t).positionAbsolute;return GU(r,h0({x:o,y:a,width:i.width||0,height:i.height||0}))},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return HU(n)},tV=(e,t,[n,r,i]=[0,0,1],o=!1,a=!1,s=[0,0])=>{const l={x:(t.x-n)/i,y:(t.y-r)/i,width:t.width/i,height:t.height/i},u=[];return e.forEach(c=>{const{width:d,height:f,selectable:h=!0,hidden:p=!1}=c;if(a&&!h||p)return!1;const{positionAbsolute:m}=mh(c,s),_={x:m.x,y:m.y,width:d||0,height:f||0},b=IE(l,_),v=typeof d>"u"||typeof f>"u"||d===null||f===null,g=o&&b>0,y=(d||0)*(f||0);(v||g||b>=y||c.dragging)&&u.push(c)}),u},lA=(e,t)=>{const n=e.map(r=>r.id);return t.filter(r=>n.includes(r.source)||n.includes(r.target))},nV=(e,t,n,r,i,o=.1)=>{const a=t/(e.width*(1+o)),s=n/(e.height*(1+o)),l=Math.min(a,s),u=tp(l,r,i),c=e.x+e.width/2,d=e.y+e.height/2,f=t/2-c*u,h=n/2-d*u;return[f,h,u]},jc=(e,t=0)=>e.transition().duration(t);function m9(e,t,n,r){return(t[n]||[]).reduce((i,o)=>{var a,s;return`${e.id}-${o.id}-${n}`!==r&&i.push({id:o.id||null,type:n,nodeId:e.id,x:(((a=e.positionAbsolute)==null?void 0:a.x)??0)+o.x+o.width/2,y:(((s=e.positionAbsolute)==null?void 0:s.y)??0)+o.y+o.height/2}),i},[])}function kbe(e,t,n,r,i,o){const{x:a,y:s}=Qu(e),u=t.elementsFromPoint(a,s).find(p=>p.classList.contains("react-flow__handle"));if(u){const p=u.getAttribute("data-nodeid");if(p){const m=uA(void 0,u),_=u.getAttribute("data-handleid"),b=o({nodeId:p,id:_,type:m});if(b)return{handle:{id:_,type:m,nodeId:p,x:n.x,y:n.y},validHandleResult:b}}}let c=[],d=1/0;if(i.forEach(p=>{const m=Math.sqrt((p.x-n.x)**2+(p.y-n.y)**2);if(m<=r){const _=o(p);m<=d&&(mp.isValid),h=c.some(({handle:p})=>p.type==="target");return c.find(({handle:p,validHandleResult:m})=>h?p.type==="target":f?m.isValid:!0)||c[0]}const Tbe={source:null,target:null,sourceHandle:null,targetHandle:null},rV=()=>({handleDomNode:null,isValid:!1,connection:Tbe,endHandle:null});function iV(e,t,n,r,i,o,a){const s=i==="target",l=a.querySelector(`.react-flow__handle[data-id="${e==null?void 0:e.nodeId}-${e==null?void 0:e.id}-${e==null?void 0:e.type}"]`),u={...rV(),handleDomNode:l};if(l){const c=uA(void 0,l),d=l.getAttribute("data-nodeid"),f=l.getAttribute("data-handleid"),h=l.classList.contains("connectable"),p=l.classList.contains("connectableend"),m={source:s?d:n,sourceHandle:s?f:r,target:s?n:d,targetHandle:s?r:f};u.connection=m,h&&p&&(t===Nd.Strict?s&&c==="source"||!s&&c==="target":d!==n||f!==r)&&(u.endHandle={nodeId:d,handleId:f,type:c},u.isValid=o(m))}return u}function Abe({nodes:e,nodeId:t,handleId:n,handleType:r}){return e.reduce((i,o)=>{if(o[Kr]){const{handleBounds:a}=o[Kr];let s=[],l=[];a&&(s=m9(o,a,"source",`${t}-${n}-${r}`),l=m9(o,a,"target",`${t}-${n}-${r}`)),i.push(...s,...l)}return i},[])}function uA(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function DC(e){e==null||e.classList.remove("valid","connecting","react-flow__handle-valid","react-flow__handle-connecting")}function Pbe(e,t){let n=null;return t?n="valid":e&&!t&&(n="invalid"),n}function oV({event:e,handleId:t,nodeId:n,onConnect:r,isTarget:i,getState:o,setState:a,isValidConnection:s,edgeUpdaterType:l,onEdgeUpdateEnd:u}){const c=VU(e.target),{connectionMode:d,domNode:f,autoPanOnConnect:h,connectionRadius:p,onConnectStart:m,panBy:_,getNodes:b,cancelConnection:v}=o();let g=0,y;const{x:S,y:w}=Qu(e),x=c==null?void 0:c.elementFromPoint(S,w),C=uA(l,x),T=f==null?void 0:f.getBoundingClientRect();if(!T||!C)return;let k,P=Qu(e,T),$=!1,O=null,E=!1,A=null;const D=Abe({nodes:b(),nodeId:n,handleId:t,handleType:C}),L=()=>{if(!h)return;const[N,B]=UU(P,T);_({x:N,y:B}),g=requestAnimationFrame(L)};a({connectionPosition:P,connectionStatus:null,connectionNodeId:n,connectionHandleId:t,connectionHandleType:C,connectionStartHandle:{nodeId:n,handleId:t,type:C},connectionEndHandle:null}),m==null||m(e,{nodeId:n,handleId:t,handleType:C});function M(N){const{transform:B}=o();P=Qu(N,T);const{handle:U,validHandleResult:G}=kbe(N,c,eV(P,B,!1,[1,1]),p,D,Y=>iV(Y,d,n,t,i?"target":"source",s,c));if(y=U,$||(L(),$=!0),A=G.handleDomNode,O=G.connection,E=G.isValid,a({connectionPosition:y&&E?Ebe({x:y.x,y:y.y},B):P,connectionStatus:Pbe(!!y,E),connectionEndHandle:G.endHandle}),!y&&!E&&!A)return DC(k);O.source!==O.target&&A&&(DC(k),k=A,A.classList.add("connecting","react-flow__handle-connecting"),A.classList.toggle("valid",E),A.classList.toggle("react-flow__handle-valid",E))}function R(N){var B,U;(y||A)&&O&&E&&(r==null||r(O)),(U=(B=o()).onConnectEnd)==null||U.call(B,N),l&&(u==null||u(N)),DC(k),v(),cancelAnimationFrame(g),$=!1,E=!1,O=null,A=null,c.removeEventListener("mousemove",M),c.removeEventListener("mouseup",R),c.removeEventListener("touchmove",M),c.removeEventListener("touchend",R)}c.addEventListener("mousemove",M),c.addEventListener("mouseup",R),c.addEventListener("touchmove",M),c.addEventListener("touchend",R)}const y9=()=>!0,Ibe=e=>({connectionStartHandle:e.connectionStartHandle,connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName}),Rbe=(e,t,n)=>r=>{const{connectionStartHandle:i,connectionEndHandle:o,connectionClickStartHandle:a}=r;return{connecting:(i==null?void 0:i.nodeId)===e&&(i==null?void 0:i.handleId)===t&&(i==null?void 0:i.type)===n||(o==null?void 0:o.nodeId)===e&&(o==null?void 0:o.handleId)===t&&(o==null?void 0:o.type)===n,clickConnecting:(a==null?void 0:a.nodeId)===e&&(a==null?void 0:a.handleId)===t&&(a==null?void 0:a.type)===n}},aV=I.forwardRef(({type:e="source",position:t=tt.Top,isValidConnection:n,isConnectable:r=!0,isConnectableStart:i=!0,isConnectableEnd:o=!0,id:a,onConnect:s,children:l,className:u,onMouseDown:c,onTouchStart:d,...f},h)=>{var T,k;const p=a||null,m=e==="target",_=hi(),b=bbe(),{connectOnClick:v,noPanClassName:g}=br(Ibe,Ro),{connecting:y,clickConnecting:S}=br(Rbe(b,p,e),Ro);b||(k=(T=_.getState()).onError)==null||k.call(T,"010",ql.error010());const w=P=>{const{defaultEdgeOptions:$,onConnect:O,hasDefaultEdges:E}=_.getState(),A={...$,...P};if(E){const{edges:D,setEdges:L}=_.getState();L(Sg(A,D))}O==null||O(A),s==null||s(A)},x=P=>{if(!b)return;const $=WU(P);i&&($&&P.button===0||!$)&&oV({event:P,handleId:p,nodeId:b,onConnect:w,isTarget:m,getState:_.getState,setState:_.setState,isValidConnection:n||_.getState().isValidConnection||y9}),$?c==null||c(P):d==null||d(P)},C=P=>{const{onClickConnectStart:$,onClickConnectEnd:O,connectionClickStartHandle:E,connectionMode:A,isValidConnection:D}=_.getState();if(!b||!E&&!i)return;if(!E){$==null||$(P,{nodeId:b,handleId:p,handleType:e}),_.setState({connectionClickStartHandle:{nodeId:b,type:e,handleId:p}});return}const L=VU(P.target),M=n||D||y9,{connection:R,isValid:N}=iV({nodeId:b,id:p,type:e},A,E.nodeId,E.handleId||null,E.type,M,L);N&&w(R),O==null||O(P),_.setState({connectionClickStartHandle:null})};return W.jsx("div",{"data-handleid":p,"data-nodeid":b,"data-handlepos":t,"data-id":`${b}-${p}-${e}`,className:Ta(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",g,u,{source:!m,target:m,connectable:r,connectablestart:i,connectableend:o,connecting:S,connectionindicator:r&&(i&&!y||o&&y)}]),onMouseDown:x,onTouchStart:x,onClick:v?C:void 0,ref:h,...f,children:l})});aV.displayName="Handle";var M_=I.memo(aV);const sV=({data:e,isConnectable:t,targetPosition:n=tt.Top,sourcePosition:r=tt.Bottom})=>W.jsxs(W.Fragment,{children:[W.jsx(M_,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label,W.jsx(M_,{type:"source",position:r,isConnectable:t})]});sV.displayName="DefaultNode";var NE=I.memo(sV);const lV=({data:e,isConnectable:t,sourcePosition:n=tt.Bottom})=>W.jsxs(W.Fragment,{children:[e==null?void 0:e.label,W.jsx(M_,{type:"source",position:n,isConnectable:t})]});lV.displayName="InputNode";var uV=I.memo(lV);const cV=({data:e,isConnectable:t,targetPosition:n=tt.Top})=>W.jsxs(W.Fragment,{children:[W.jsx(M_,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label]});cV.displayName="OutputNode";var dV=I.memo(cV);const cA=()=>null;cA.displayName="GroupNode";const Obe=e=>({selectedNodes:e.getNodes().filter(t=>t.selected),selectedEdges:e.edges.filter(t=>t.selected)}),Mv=e=>e.id;function Mbe(e,t){return Ro(e.selectedNodes.map(Mv),t.selectedNodes.map(Mv))&&Ro(e.selectedEdges.map(Mv),t.selectedEdges.map(Mv))}const fV=I.memo(({onSelectionChange:e})=>{const t=hi(),{selectedNodes:n,selectedEdges:r}=br(Obe,Mbe);return I.useEffect(()=>{var o,a;const i={nodes:n,edges:r};e==null||e(i),(a=(o=t.getState()).onSelectionChange)==null||a.call(o,i)},[n,r,e]),null});fV.displayName="SelectionListener";const Nbe=e=>!!e.onSelectionChange;function $be({onSelectionChange:e}){const t=br(Nbe);return e||t?W.jsx(fV,{onSelectionChange:e}):null}const Dbe=e=>({setNodes:e.setNodes,setEdges:e.setEdges,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset});function ff(e,t){I.useEffect(()=>{typeof e<"u"&&t(e)},[e])}function Ot(e,t,n){I.useEffect(()=>{typeof t<"u"&&n({[e]:t})},[t])}const Lbe=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:i,onConnectStart:o,onConnectEnd:a,onClickConnectStart:s,onClickConnectEnd:l,nodesDraggable:u,nodesConnectable:c,nodesFocusable:d,edgesFocusable:f,edgesUpdatable:h,elevateNodesOnSelect:p,minZoom:m,maxZoom:_,nodeExtent:b,onNodesChange:v,onEdgesChange:g,elementsSelectable:y,connectionMode:S,snapGrid:w,snapToGrid:x,translateExtent:C,connectOnClick:T,defaultEdgeOptions:k,fitView:P,fitViewOptions:$,onNodesDelete:O,onEdgesDelete:E,onNodeDrag:A,onNodeDragStart:D,onNodeDragStop:L,onSelectionDrag:M,onSelectionDragStart:R,onSelectionDragStop:N,noPanClassName:B,nodeOrigin:U,rfId:G,autoPanOnConnect:Y,autoPanOnNodeDrag:ee,onError:J,connectionRadius:j,isValidConnection:Q})=>{const{setNodes:ne,setEdges:se,setDefaultNodesAndEdges:ve,setMinZoom:ce,setMaxZoom:bt,setTranslateExtent:ot,setNodeExtent:ze,reset:gt}=br(Dbe,Ro),Pe=hi();return I.useEffect(()=>{const Jt=r==null?void 0:r.map(Ar=>({...Ar,...k}));return ve(n,Jt),()=>{gt()}},[]),Ot("defaultEdgeOptions",k,Pe.setState),Ot("connectionMode",S,Pe.setState),Ot("onConnect",i,Pe.setState),Ot("onConnectStart",o,Pe.setState),Ot("onConnectEnd",a,Pe.setState),Ot("onClickConnectStart",s,Pe.setState),Ot("onClickConnectEnd",l,Pe.setState),Ot("nodesDraggable",u,Pe.setState),Ot("nodesConnectable",c,Pe.setState),Ot("nodesFocusable",d,Pe.setState),Ot("edgesFocusable",f,Pe.setState),Ot("edgesUpdatable",h,Pe.setState),Ot("elementsSelectable",y,Pe.setState),Ot("elevateNodesOnSelect",p,Pe.setState),Ot("snapToGrid",x,Pe.setState),Ot("snapGrid",w,Pe.setState),Ot("onNodesChange",v,Pe.setState),Ot("onEdgesChange",g,Pe.setState),Ot("connectOnClick",T,Pe.setState),Ot("fitViewOnInit",P,Pe.setState),Ot("fitViewOnInitOptions",$,Pe.setState),Ot("onNodesDelete",O,Pe.setState),Ot("onEdgesDelete",E,Pe.setState),Ot("onNodeDrag",A,Pe.setState),Ot("onNodeDragStart",D,Pe.setState),Ot("onNodeDragStop",L,Pe.setState),Ot("onSelectionDrag",M,Pe.setState),Ot("onSelectionDragStart",R,Pe.setState),Ot("onSelectionDragStop",N,Pe.setState),Ot("noPanClassName",B,Pe.setState),Ot("nodeOrigin",U,Pe.setState),Ot("rfId",G,Pe.setState),Ot("autoPanOnConnect",Y,Pe.setState),Ot("autoPanOnNodeDrag",ee,Pe.setState),Ot("onError",J,Pe.setState),Ot("connectionRadius",j,Pe.setState),Ot("isValidConnection",Q,Pe.setState),ff(e,ne),ff(t,se),ff(m,ce),ff(_,bt),ff(C,ot),ff(b,ze),null},v9={display:"none"},Fbe={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},hV="react-flow__node-desc",pV="react-flow__edge-desc",Bbe="react-flow__aria-live",zbe=e=>e.ariaLiveMessage;function jbe({rfId:e}){const t=br(zbe);return W.jsx("div",{id:`${Bbe}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:Fbe,children:t})}function Ube({rfId:e,disableKeyboardA11y:t}){return W.jsxs(W.Fragment,{children:[W.jsxs("div",{id:`${hV}-${e}`,style:v9,children:["Press enter or space to select a node.",!t&&"You can then use the arrow keys to move the node around."," Press delete to remove it and escape to cancel."," "]}),W.jsx("div",{id:`${pV}-${e}`,style:v9,children:"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel."}),!t&&W.jsx(jbe,{rfId:e})]})}const Vbe=typeof document<"u"?document:null;var p0=(e=null,t={target:Vbe})=>{const[n,r]=I.useState(!1),i=I.useRef(!1),o=I.useRef(new Set([])),[a,s]=I.useMemo(()=>{if(e!==null){const u=(Array.isArray(e)?e:[e]).filter(d=>typeof d=="string").map(d=>d.split("+")),c=u.reduce((d,f)=>d.concat(...f),[]);return[u,c]}return[[],[]]},[e]);return I.useEffect(()=>{var l,u;if(e!==null){const c=h=>{if(i.current=h.ctrlKey||h.metaKey||h.shiftKey,!i.current&&RE(h))return!1;const p=_9(h.code,s);o.current.add(h[p]),b9(a,o.current,!1)&&(h.preventDefault(),r(!0))},d=h=>{if(!i.current&&RE(h))return!1;const p=_9(h.code,s);b9(a,o.current,!0)?(r(!1),o.current.clear()):o.current.delete(h[p]),h.key==="Meta"&&o.current.clear(),i.current=!1},f=()=>{o.current.clear(),r(!1)};return(l=t==null?void 0:t.target)==null||l.addEventListener("keydown",c),(u=t==null?void 0:t.target)==null||u.addEventListener("keyup",d),window.addEventListener("blur",f),()=>{var h,p;(h=t==null?void 0:t.target)==null||h.removeEventListener("keydown",c),(p=t==null?void 0:t.target)==null||p.removeEventListener("keyup",d),window.removeEventListener("blur",f)}}},[e,r]),n};function b9(e,t,n){return e.filter(r=>n||r.length===t.size).some(r=>r.every(i=>t.has(i)))}function _9(e,t){return t.includes(e)?"code":"key"}function gV(e,t,n,r){var a,s;if(!e.parentNode)return n;const i=t.get(e.parentNode),o=mh(i,r);return gV(i,t,{x:(n.x??0)+o.x,y:(n.y??0)+o.y,z:(((a=i[Kr])==null?void 0:a.z)??0)>(n.z??0)?((s=i[Kr])==null?void 0:s.z)??0:n.z??0},r)}function mV(e,t,n){e.forEach(r=>{var i;if(r.parentNode&&!e.has(r.parentNode))throw new Error(`Parent node ${r.parentNode} not found`);if(r.parentNode||n!=null&&n[r.id]){const{x:o,y:a,z:s}=gV(r,e,{...r.position,z:((i=r[Kr])==null?void 0:i.z)??0},t);r.positionAbsolute={x:o,y:a},r[Kr].z=s,n!=null&&n[r.id]&&(r[Kr].isParent=!0)}})}function LC(e,t,n,r){const i=new Map,o={},a=r?1e3:0;return e.forEach(s=>{var d;const l=(ba(s.zIndex)?s.zIndex:0)+(s.selected?a:0),u=t.get(s.id),c={width:u==null?void 0:u.width,height:u==null?void 0:u.height,...s,positionAbsolute:{x:s.position.x,y:s.position.y}};s.parentNode&&(c.parentNode=s.parentNode,o[s.parentNode]=!0),Object.defineProperty(c,Kr,{enumerable:!1,value:{handleBounds:(d=u==null?void 0:u[Kr])==null?void 0:d.handleBounds,z:l}}),i.set(s.id,c)}),mV(i,n,o),i}function yV(e,t={}){const{getNodes:n,width:r,height:i,minZoom:o,maxZoom:a,d3Zoom:s,d3Selection:l,fitViewOnInitDone:u,fitViewOnInit:c,nodeOrigin:d}=e(),f=t.initial&&!u&&c;if(s&&l&&(f||!t.initial)){const p=n().filter(_=>{var v;const b=t.includeHiddenNodes?_.width&&_.height:!_.hidden;return(v=t.nodes)!=null&&v.length?b&&t.nodes.some(g=>g.id===_.id):b}),m=p.every(_=>_.width&&_.height);if(p.length>0&&m){const _=sA(p,d),[b,v,g]=nV(_,r,i,t.minZoom??o,t.maxZoom??a,t.padding??.1),y=Ku.translate(b,v).scale(g);return typeof t.duration=="number"&&t.duration>0?s.transform(jc(l,t.duration),y):s.transform(l,y),!0}}return!1}function Gbe(e,t){return e.forEach(n=>{const r=t.get(n.id);r&&t.set(r.id,{...r,[Kr]:r[Kr],selected:n.selected})}),new Map(t)}function Hbe(e,t){return t.map(n=>{const r=e.find(i=>i.id===n.id);return r&&(n.selected=r.selected),n})}function Nv({changedNodes:e,changedEdges:t,get:n,set:r}){const{nodeInternals:i,edges:o,onNodesChange:a,onEdgesChange:s,hasDefaultNodes:l,hasDefaultEdges:u}=n();e!=null&&e.length&&(l&&r({nodeInternals:Gbe(e,i)}),a==null||a(e)),t!=null&&t.length&&(u&&r({edges:Hbe(t,o)}),s==null||s(t))}const hf=()=>{},qbe={zoomIn:hf,zoomOut:hf,zoomTo:hf,getZoom:()=>1,setViewport:hf,getViewport:()=>({x:0,y:0,zoom:1}),fitView:()=>!1,setCenter:hf,fitBounds:hf,project:e=>e,viewportInitialized:!1},Wbe=e=>({d3Zoom:e.d3Zoom,d3Selection:e.d3Selection}),Kbe=()=>{const e=hi(),{d3Zoom:t,d3Selection:n}=br(Wbe,Ro);return I.useMemo(()=>n&&t?{zoomIn:i=>t.scaleBy(jc(n,i==null?void 0:i.duration),1.2),zoomOut:i=>t.scaleBy(jc(n,i==null?void 0:i.duration),1/1.2),zoomTo:(i,o)=>t.scaleTo(jc(n,o==null?void 0:o.duration),i),getZoom:()=>e.getState().transform[2],setViewport:(i,o)=>{const[a,s,l]=e.getState().transform,u=Ku.translate(i.x??a,i.y??s).scale(i.zoom??l);t.transform(jc(n,o==null?void 0:o.duration),u)},getViewport:()=>{const[i,o,a]=e.getState().transform;return{x:i,y:o,zoom:a}},fitView:i=>yV(e.getState,i),setCenter:(i,o,a)=>{const{width:s,height:l,maxZoom:u}=e.getState(),c=typeof(a==null?void 0:a.zoom)<"u"?a.zoom:u,d=s/2-i*c,f=l/2-o*c,h=Ku.translate(d,f).scale(c);t.transform(jc(n,a==null?void 0:a.duration),h)},fitBounds:(i,o)=>{const{width:a,height:s,minZoom:l,maxZoom:u}=e.getState(),[c,d,f]=nV(i,a,s,l,u,(o==null?void 0:o.padding)??.1),h=Ku.translate(c,d).scale(f);t.transform(jc(n,o==null?void 0:o.duration),h)},project:i=>{const{transform:o,snapToGrid:a,snapGrid:s}=e.getState();return eV(i,o,a,s)},viewportInitialized:!0}:qbe,[t,n])};function vV(){const e=Kbe(),t=hi(),n=I.useCallback(()=>t.getState().getNodes().map(m=>({...m})),[]),r=I.useCallback(m=>t.getState().nodeInternals.get(m),[]),i=I.useCallback(()=>{const{edges:m=[]}=t.getState();return m.map(_=>({..._}))},[]),o=I.useCallback(m=>{const{edges:_=[]}=t.getState();return _.find(b=>b.id===m)},[]),a=I.useCallback(m=>{const{getNodes:_,setNodes:b,hasDefaultNodes:v,onNodesChange:g}=t.getState(),y=_(),S=typeof m=="function"?m(y):m;if(v)b(S);else if(g){const w=S.length===0?y.map(x=>({type:"remove",id:x.id})):S.map(x=>({item:x,type:"reset"}));g(w)}},[]),s=I.useCallback(m=>{const{edges:_=[],setEdges:b,hasDefaultEdges:v,onEdgesChange:g}=t.getState(),y=typeof m=="function"?m(_):m;if(v)b(y);else if(g){const S=y.length===0?_.map(w=>({type:"remove",id:w.id})):y.map(w=>({item:w,type:"reset"}));g(S)}},[]),l=I.useCallback(m=>{const _=Array.isArray(m)?m:[m],{getNodes:b,setNodes:v,hasDefaultNodes:g,onNodesChange:y}=t.getState();if(g){const w=[...b(),..._];v(w)}else if(y){const S=_.map(w=>({item:w,type:"add"}));y(S)}},[]),u=I.useCallback(m=>{const _=Array.isArray(m)?m:[m],{edges:b=[],setEdges:v,hasDefaultEdges:g,onEdgesChange:y}=t.getState();if(g)v([...b,..._]);else if(y){const S=_.map(w=>({item:w,type:"add"}));y(S)}},[]),c=I.useCallback(()=>{const{getNodes:m,edges:_=[],transform:b}=t.getState(),[v,g,y]=b;return{nodes:m().map(S=>({...S})),edges:_.map(S=>({...S})),viewport:{x:v,y:g,zoom:y}}},[]),d=I.useCallback(({nodes:m,edges:_})=>{const{nodeInternals:b,getNodes:v,edges:g,hasDefaultNodes:y,hasDefaultEdges:S,onNodesDelete:w,onEdgesDelete:x,onNodesChange:C,onEdgesChange:T}=t.getState(),k=(m||[]).map(A=>A.id),P=(_||[]).map(A=>A.id),$=v().reduce((A,D)=>{const L=!k.includes(D.id)&&D.parentNode&&A.find(R=>R.id===D.parentNode);return(typeof D.deletable=="boolean"?D.deletable:!0)&&(k.includes(D.id)||L)&&A.push(D),A},[]),O=g.filter(A=>typeof A.deletable=="boolean"?A.deletable:!0),E=O.filter(A=>P.includes(A.id));if($||E){const A=lA($,O),D=[...E,...A],L=D.reduce((M,R)=>(M.includes(R.id)||M.push(R.id),M),[]);if((S||y)&&(S&&t.setState({edges:g.filter(M=>!L.includes(M.id))}),y&&($.forEach(M=>{b.delete(M.id)}),t.setState({nodeInternals:new Map(b)}))),L.length>0&&(x==null||x(D),T&&T(L.map(M=>({id:M,type:"remove"})))),$.length>0&&(w==null||w($),C)){const M=$.map(R=>({id:R.id,type:"remove"}));C(M)}}},[]),f=I.useCallback(m=>{const _=dbe(m),b=_?null:t.getState().nodeInternals.get(m.id);return[_?m:d9(b),b,_]},[]),h=I.useCallback((m,_=!0,b)=>{const[v,g,y]=f(m);return v?(b||t.getState().getNodes()).filter(S=>{if(!y&&(S.id===g.id||!S.positionAbsolute))return!1;const w=d9(S),x=IE(w,v);return _&&x>0||x>=m.width*m.height}):[]},[]),p=I.useCallback((m,_,b=!0)=>{const[v]=f(m);if(!v)return!1;const g=IE(v,_);return b&&g>0||g>=m.width*m.height},[]);return I.useMemo(()=>({...e,getNodes:n,getNode:r,getEdges:i,getEdge:o,setNodes:a,setEdges:s,addNodes:l,addEdges:u,toObject:c,deleteElements:d,getIntersectingNodes:h,isNodeIntersecting:p}),[e,n,r,i,o,a,s,l,u,c,d,h,p])}var Qbe=({deleteKeyCode:e,multiSelectionKeyCode:t})=>{const n=hi(),{deleteElements:r}=vV(),i=p0(e),o=p0(t);I.useEffect(()=>{if(i){const{edges:a,getNodes:s}=n.getState(),l=s().filter(c=>c.selected),u=a.filter(c=>c.selected);r({nodes:l,edges:u}),n.setState({nodesSelectionActive:!1})}},[i]),I.useEffect(()=>{n.setState({multiSelectionActive:o})},[o])};function Xbe(e){const t=hi();I.useEffect(()=>{let n;const r=()=>{var o,a;if(!e.current)return;const i=tA(e.current);(i.height===0||i.width===0)&&((a=(o=t.getState()).onError)==null||a.call(o,"004",ql.error004())),t.setState({width:i.width||500,height:i.height||500})};return r(),window.addEventListener("resize",r),e.current&&(n=new ResizeObserver(()=>r()),n.observe(e.current)),()=>{window.removeEventListener("resize",r),n&&e.current&&n.unobserve(e.current)}},[])}const dA={position:"absolute",width:"100%",height:"100%",top:0,left:0},Ybe=(e,t)=>e.x!==t.x||e.y!==t.y||e.zoom!==t.k,$v=e=>({x:e.x,y:e.y,zoom:e.k}),pf=(e,t)=>e.target.closest(`.${t}`),S9=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),x9=e=>{const t=e.ctrlKey&&I_()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t},Zbe=e=>({d3Zoom:e.d3Zoom,d3Selection:e.d3Selection,d3ZoomHandler:e.d3ZoomHandler,userSelectionActive:e.userSelectionActive}),Jbe=({onMove:e,onMoveStart:t,onMoveEnd:n,onPaneContextMenu:r,zoomOnScroll:i=!0,zoomOnPinch:o=!0,panOnScroll:a=!1,panOnScrollSpeed:s=.5,panOnScrollMode:l=od.Free,zoomOnDoubleClick:u=!0,elementsSelectable:c,panOnDrag:d=!0,defaultViewport:f,translateExtent:h,minZoom:p,maxZoom:m,zoomActivationKeyCode:_,preventScrolling:b=!0,children:v,noWheelClassName:g,noPanClassName:y})=>{const S=I.useRef(),w=hi(),x=I.useRef(!1),C=I.useRef(!1),T=I.useRef(null),k=I.useRef({x:0,y:0,zoom:0}),{d3Zoom:P,d3Selection:$,d3ZoomHandler:O,userSelectionActive:E}=br(Zbe,Ro),A=p0(_),D=I.useRef(0),L=I.useRef(!1),M=I.useRef();return Xbe(T),I.useEffect(()=>{if(T.current){const R=T.current.getBoundingClientRect(),N=ibe().scaleExtent([p,m]).translateExtent(h),B=Wa(T.current).call(N),U=Ku.translate(f.x,f.y).scale(tp(f.zoom,p,m)),G=[[0,0],[R.width,R.height]],Y=N.constrain()(U,G,h);N.transform(B,Y),N.wheelDelta(x9),w.setState({d3Zoom:N,d3Selection:B,d3ZoomHandler:B.on("wheel.zoom"),transform:[Y.x,Y.y,Y.k],domNode:T.current.closest(".react-flow")})}},[]),I.useEffect(()=>{$&&P&&(a&&!A&&!E?$.on("wheel.zoom",R=>{if(pf(R,g))return!1;R.preventDefault(),R.stopImmediatePropagation();const N=$.property("__zoom").k||1,B=I_();if(R.ctrlKey&&o&&B){const ne=xs(R),se=x9(R),ve=N*Math.pow(2,se);P.scaleTo($,ve,ne,R);return}const U=R.deltaMode===1?20:1;let G=l===od.Vertical?0:R.deltaX*U,Y=l===od.Horizontal?0:R.deltaY*U;!B&&R.shiftKey&&l!==od.Vertical&&(G=R.deltaY*U,Y=0),P.translateBy($,-(G/N)*s,-(Y/N)*s,{internal:!0});const ee=$v($.property("__zoom")),{onViewportChangeStart:J,onViewportChange:j,onViewportChangeEnd:Q}=w.getState();clearTimeout(M.current),L.current||(L.current=!0,t==null||t(R,ee),J==null||J(ee)),L.current&&(e==null||e(R,ee),j==null||j(ee),M.current=setTimeout(()=>{n==null||n(R,ee),Q==null||Q(ee),L.current=!1},150))},{passive:!1}):typeof O<"u"&&$.on("wheel.zoom",function(R,N){if(!b||pf(R,g))return null;R.preventDefault(),O.call(this,R,N)},{passive:!1}))},[E,a,l,$,P,O,A,o,b,g,t,e,n]),I.useEffect(()=>{P&&P.on("start",R=>{var U,G;if(!R.sourceEvent||R.sourceEvent.internal)return null;D.current=(U=R.sourceEvent)==null?void 0:U.button;const{onViewportChangeStart:N}=w.getState(),B=$v(R.transform);x.current=!0,k.current=B,((G=R.sourceEvent)==null?void 0:G.type)==="mousedown"&&w.setState({paneDragging:!0}),N==null||N(B),t==null||t(R.sourceEvent,B)})},[P,t]),I.useEffect(()=>{P&&(E&&!x.current?P.on("zoom",null):E||P.on("zoom",R=>{var B;const{onViewportChange:N}=w.getState();if(w.setState({transform:[R.transform.x,R.transform.y,R.transform.k]}),C.current=!!(r&&S9(d,D.current??0)),(e||N)&&!((B=R.sourceEvent)!=null&&B.internal)){const U=$v(R.transform);N==null||N(U),e==null||e(R.sourceEvent,U)}}))},[E,P,e,d,r]),I.useEffect(()=>{P&&P.on("end",R=>{if(!R.sourceEvent||R.sourceEvent.internal)return null;const{onViewportChangeEnd:N}=w.getState();if(x.current=!1,w.setState({paneDragging:!1}),r&&S9(d,D.current??0)&&!C.current&&r(R.sourceEvent),C.current=!1,(n||N)&&Ybe(k.current,R.transform)){const B=$v(R.transform);k.current=B,clearTimeout(S.current),S.current=setTimeout(()=>{N==null||N(B),n==null||n(R.sourceEvent,B)},a?150:0)}})},[P,a,d,n,r]),I.useEffect(()=>{P&&P.filter(R=>{const N=A||i,B=o&&R.ctrlKey;if(R.button===1&&R.type==="mousedown"&&(pf(R,"react-flow__node")||pf(R,"react-flow__edge")))return!0;if(!d&&!N&&!a&&!u&&!o||E||!u&&R.type==="dblclick"||pf(R,g)&&R.type==="wheel"||pf(R,y)&&R.type!=="wheel"||!o&&R.ctrlKey&&R.type==="wheel"||!N&&!a&&!B&&R.type==="wheel"||!d&&(R.type==="mousedown"||R.type==="touchstart")||Array.isArray(d)&&!d.includes(R.button)&&(R.type==="mousedown"||R.type==="touchstart"))return!1;const U=Array.isArray(d)&&d.includes(R.button)||!R.button||R.button<=1;return(!R.ctrlKey||R.type==="wheel")&&U})},[E,P,i,o,a,u,d,c,A]),W.jsx("div",{className:"react-flow__renderer",ref:T,style:dA,children:v})},e_e=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function t_e(){const{userSelectionActive:e,userSelectionRect:t}=br(e_e,Ro);return e&&t?W.jsx("div",{className:"react-flow__selection react-flow__container",style:{width:t.width,height:t.height,transform:`translate(${t.x}px, ${t.y}px)`}}):null}function w9(e,t){const n=e.find(r=>r.id===t.parentNode);if(n){const r=t.position.x+t.width-n.width,i=t.position.y+t.height-n.height;if(r>0||i>0||t.position.x<0||t.position.y<0){if(n.style={...n.style},n.style.width=n.style.width??n.width,n.style.height=n.style.height??n.height,r>0&&(n.style.width+=r),i>0&&(n.style.height+=i),t.position.x<0){const o=Math.abs(t.position.x);n.position.x=n.position.x-o,n.style.width+=o,t.position.x=0}if(t.position.y<0){const o=Math.abs(t.position.y);n.position.y=n.position.y-o,n.style.height+=o,t.position.y=0}n.width=n.style.width,n.height=n.style.height}}}function bV(e,t){if(e.some(r=>r.type==="reset"))return e.filter(r=>r.type==="reset").map(r=>r.item);const n=e.filter(r=>r.type==="add").map(r=>r.item);return t.reduce((r,i)=>{const o=e.filter(s=>s.id===i.id);if(o.length===0)return r.push(i),r;const a={...i};for(const s of o)if(s)switch(s.type){case"select":{a.selected=s.selected;break}case"position":{typeof s.position<"u"&&(a.position=s.position),typeof s.positionAbsolute<"u"&&(a.positionAbsolute=s.positionAbsolute),typeof s.dragging<"u"&&(a.dragging=s.dragging),a.expandParent&&w9(r,a);break}case"dimensions":{typeof s.dimensions<"u"&&(a.width=s.dimensions.width,a.height=s.dimensions.height),typeof s.updateStyle<"u"&&(a.style={...a.style||{},...s.dimensions}),typeof s.resizing=="boolean"&&(a.resizing=s.resizing),a.expandParent&&w9(r,a);break}case"remove":return r}return r.push(a),r},n)}function Uc(e,t){return bV(e,t)}function Rc(e,t){return bV(e,t)}const yu=(e,t)=>({id:e,type:"select",selected:t});function zf(e,t){return e.reduce((n,r)=>{const i=t.includes(r.id);return!r.selected&&i?(r.selected=!0,n.push(yu(r.id,!0))):r.selected&&!i&&(r.selected=!1,n.push(yu(r.id,!1))),n},[])}const FC=(e,t)=>n=>{n.target===t.current&&(e==null||e(n))},n_e=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,dragging:e.paneDragging}),_V=I.memo(({isSelecting:e,selectionMode:t=sc.Full,panOnDrag:n,onSelectionStart:r,onSelectionEnd:i,onPaneClick:o,onPaneContextMenu:a,onPaneScroll:s,onPaneMouseEnter:l,onPaneMouseMove:u,onPaneMouseLeave:c,children:d})=>{const f=I.useRef(null),h=hi(),p=I.useRef(0),m=I.useRef(0),_=I.useRef(),{userSelectionActive:b,elementsSelectable:v,dragging:g}=br(n_e,Ro),y=()=>{h.setState({userSelectionActive:!1,userSelectionRect:null}),p.current=0,m.current=0},S=O=>{o==null||o(O),h.getState().resetSelectedElements(),h.setState({nodesSelectionActive:!1})},w=O=>{if(Array.isArray(n)&&(n!=null&&n.includes(2))){O.preventDefault();return}a==null||a(O)},x=s?O=>s(O):void 0,C=O=>{const{resetSelectedElements:E,domNode:A}=h.getState();if(_.current=A==null?void 0:A.getBoundingClientRect(),!v||!e||O.button!==0||O.target!==f.current||!_.current)return;const{x:D,y:L}=Qu(O,_.current);E(),h.setState({userSelectionRect:{width:0,height:0,startX:D,startY:L,x:D,y:L}}),r==null||r(O)},T=O=>{const{userSelectionRect:E,nodeInternals:A,edges:D,transform:L,onNodesChange:M,onEdgesChange:R,nodeOrigin:N,getNodes:B}=h.getState();if(!e||!_.current||!E)return;h.setState({userSelectionActive:!0,nodesSelectionActive:!1});const U=Qu(O,_.current),G=E.startX??0,Y=E.startY??0,ee={...E,x:U.xse.id),ne=j.map(se=>se.id);if(p.current!==ne.length){p.current=ne.length;const se=zf(J,ne);se.length&&(M==null||M(se))}if(m.current!==Q.length){m.current=Q.length;const se=zf(D,Q);se.length&&(R==null||R(se))}h.setState({userSelectionRect:ee})},k=O=>{if(O.button!==0)return;const{userSelectionRect:E}=h.getState();!b&&E&&O.target===f.current&&(S==null||S(O)),h.setState({nodesSelectionActive:p.current>0}),y(),i==null||i(O)},P=O=>{b&&(h.setState({nodesSelectionActive:p.current>0}),i==null||i(O)),y()},$=v&&(e||b);return W.jsxs("div",{className:Ta(["react-flow__pane",{dragging:g,selection:e}]),onClick:$?void 0:FC(S,f),onContextMenu:FC(w,f),onWheel:FC(x,f),onMouseEnter:$?void 0:l,onMouseDown:$?C:void 0,onMouseMove:$?T:u,onMouseUp:$?k:void 0,onMouseLeave:$?P:c,ref:f,style:dA,children:[d,W.jsx(t_e,{})]})});_V.displayName="Pane";function SV(e,t){if(!e.parentNode)return!1;const n=t.get(e.parentNode);return n?n.selected?!0:SV(n,t):!1}function C9(e,t,n){let r=e;do{if(r!=null&&r.matches(t))return!0;if(r===n.current)return!1;r=r.parentElement}while(r);return!1}function r_e(e,t,n,r){return Array.from(e.values()).filter(i=>(i.selected||i.id===r)&&(!i.parentNode||!SV(i,e))&&(i.draggable||t&&typeof i.draggable>"u")).map(i=>{var o,a;return{id:i.id,position:i.position||{x:0,y:0},positionAbsolute:i.positionAbsolute||{x:0,y:0},distance:{x:n.x-(((o=i.positionAbsolute)==null?void 0:o.x)??0),y:n.y-(((a=i.positionAbsolute)==null?void 0:a.y)??0)},delta:{x:0,y:0},extent:i.extent,parentNode:i.parentNode,width:i.width,height:i.height}})}function i_e(e,t){return!t||t==="parent"?t:[t[0],[t[1][0]-(e.width||0),t[1][1]-(e.height||0)]]}function xV(e,t,n,r,i=[0,0],o){const a=i_e(e,e.extent||r);let s=a;if(e.extent==="parent")if(e.parentNode&&e.width&&e.height){const c=n.get(e.parentNode),{x:d,y:f}=mh(c,i).positionAbsolute;s=c&&ba(d)&&ba(f)&&ba(c.width)&&ba(c.height)?[[d+e.width*i[0],f+e.height*i[1]],[d+c.width-e.width+e.width*i[0],f+c.height-e.height+e.height*i[1]]]:s}else o==null||o("005",ql.error005()),s=a;else if(e.extent&&e.parentNode){const c=n.get(e.parentNode),{x:d,y:f}=mh(c,i).positionAbsolute;s=[[e.extent[0][0]+d,e.extent[0][1]+f],[e.extent[1][0]+d,e.extent[1][1]+f]]}let l={x:0,y:0};if(e.parentNode){const c=n.get(e.parentNode);l=mh(c,i).positionAbsolute}const u=s&&s!=="parent"?nA(t,s):t;return{position:{x:u.x-l.x,y:u.y-l.y},positionAbsolute:u}}function BC({nodeId:e,dragItems:t,nodeInternals:n}){const r=t.map(i=>({...n.get(i.id),position:i.position,positionAbsolute:i.positionAbsolute}));return[e?r.find(i=>i.id===e):r[0],r]}const E9=(e,t,n,r)=>{const i=t.querySelectorAll(e);if(!i||!i.length)return null;const o=Array.from(i),a=t.getBoundingClientRect(),s={x:a.width*r[0],y:a.height*r[1]};return o.map(l=>{const u=l.getBoundingClientRect();return{id:l.getAttribute("data-handleid"),position:l.getAttribute("data-handlepos"),x:(u.left-a.left-s.x)/n,y:(u.top-a.top-s.y)/n,...tA(l)}})};function Xp(e,t,n){return n===void 0?n:r=>{const i=t().nodeInternals.get(e);i&&n(r,{...i})}}function $E({id:e,store:t,unselect:n=!1,nodeRef:r}){const{addSelectedNodes:i,unselectNodesAndEdges:o,multiSelectionActive:a,nodeInternals:s,onError:l}=t.getState(),u=s.get(e);if(!u){l==null||l("012",ql.error012(e));return}t.setState({nodesSelectionActive:!1}),u.selected?(n||u.selected&&a)&&(o({nodes:[u]}),requestAnimationFrame(()=>{var c;return(c=r==null?void 0:r.current)==null?void 0:c.blur()})):i([e])}function o_e(){const e=hi();return I.useCallback(({sourceEvent:n})=>{const{transform:r,snapGrid:i,snapToGrid:o}=e.getState(),a=n.touches?n.touches[0].clientX:n.clientX,s=n.touches?n.touches[0].clientY:n.clientY,l={x:(a-r[0])/r[2],y:(s-r[1])/r[2]};return{xSnapped:o?i[0]*Math.round(l.x/i[0]):l.x,ySnapped:o?i[1]*Math.round(l.y/i[1]):l.y,...l}},[])}function zC(e){return(t,n,r)=>e==null?void 0:e(t,r)}function wV({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:r,nodeId:i,isSelectable:o,selectNodesOnDrag:a}){const s=hi(),[l,u]=I.useState(!1),c=I.useRef([]),d=I.useRef({x:null,y:null}),f=I.useRef(0),h=I.useRef(null),p=I.useRef({x:0,y:0}),m=I.useRef(null),_=I.useRef(!1),b=o_e();return I.useEffect(()=>{if(e!=null&&e.current){const v=Wa(e.current),g=({x:S,y:w})=>{const{nodeInternals:x,onNodeDrag:C,onSelectionDrag:T,updateNodePositions:k,nodeExtent:P,snapGrid:$,snapToGrid:O,nodeOrigin:E,onError:A}=s.getState();d.current={x:S,y:w};let D=!1,L={x:0,y:0,x2:0,y2:0};if(c.current.length>1&&P){const R=sA(c.current,E);L=h0(R)}if(c.current=c.current.map(R=>{const N={x:S-R.distance.x,y:w-R.distance.y};O&&(N.x=$[0]*Math.round(N.x/$[0]),N.y=$[1]*Math.round(N.y/$[1]));const B=[[P[0][0],P[0][1]],[P[1][0],P[1][1]]];c.current.length>1&&P&&!R.extent&&(B[0][0]=R.positionAbsolute.x-L.x+P[0][0],B[1][0]=R.positionAbsolute.x+(R.width??0)-L.x2+P[1][0],B[0][1]=R.positionAbsolute.y-L.y+P[0][1],B[1][1]=R.positionAbsolute.y+(R.height??0)-L.y2+P[1][1]);const U=xV(R,N,x,B,E,A);return D=D||R.position.x!==U.position.x||R.position.y!==U.position.y,R.position=U.position,R.positionAbsolute=U.positionAbsolute,R}),!D)return;k(c.current,!0,!0),u(!0);const M=i?C:zC(T);if(M&&m.current){const[R,N]=BC({nodeId:i,dragItems:c.current,nodeInternals:x});M(m.current,R,N)}},y=()=>{if(!h.current)return;const[S,w]=UU(p.current,h.current);if(S!==0||w!==0){const{transform:x,panBy:C}=s.getState();d.current.x=(d.current.x??0)-S/x[2],d.current.y=(d.current.y??0)-w/x[2],C({x:S,y:w})&&g(d.current)}f.current=requestAnimationFrame(y)};if(t)v.on(".drag",null);else{const S=pve().on("start",w=>{var D;const{nodeInternals:x,multiSelectionActive:C,domNode:T,nodesDraggable:k,unselectNodesAndEdges:P,onNodeDragStart:$,onSelectionDragStart:O}=s.getState(),E=i?$:zC(O);!a&&!C&&i&&((D=x.get(i))!=null&&D.selected||P()),i&&o&&a&&$E({id:i,store:s,nodeRef:e});const A=b(w);if(d.current=A,c.current=r_e(x,k,A,i),E&&c.current){const[L,M]=BC({nodeId:i,dragItems:c.current,nodeInternals:x});E(w.sourceEvent,L,M)}h.current=(T==null?void 0:T.getBoundingClientRect())||null,p.current=Qu(w.sourceEvent,h.current)}).on("drag",w=>{const x=b(w),{autoPanOnNodeDrag:C}=s.getState();!_.current&&C&&(_.current=!0,y()),(d.current.x!==x.xSnapped||d.current.y!==x.ySnapped)&&c.current&&(m.current=w.sourceEvent,p.current=Qu(w.sourceEvent,h.current),g(x))}).on("end",w=>{if(u(!1),_.current=!1,cancelAnimationFrame(f.current),c.current){const{updateNodePositions:x,nodeInternals:C,onNodeDragStop:T,onSelectionDragStop:k}=s.getState(),P=i?T:zC(k);if(x(c.current,!1,!1),P){const[$,O]=BC({nodeId:i,dragItems:c.current,nodeInternals:C});P(w.sourceEvent,$,O)}}}).filter(w=>{const x=w.target;return!w.button&&(!n||!C9(x,`.${n}`,e))&&(!r||C9(x,r,e))});return v.call(S),()=>{v.on(".drag",null)}}}},[e,t,n,r,o,s,i,a,b]),l}function CV(){const e=hi();return I.useCallback(n=>{const{nodeInternals:r,nodeExtent:i,updateNodePositions:o,getNodes:a,snapToGrid:s,snapGrid:l,onError:u,nodesDraggable:c}=e.getState(),d=a().filter(v=>v.selected&&(v.draggable||c&&typeof v.draggable>"u")),f=s?l[0]:5,h=s?l[1]:5,p=n.isShiftPressed?4:1,m=n.x*f*p,_=n.y*h*p,b=d.map(v=>{if(v.positionAbsolute){const g={x:v.positionAbsolute.x+m,y:v.positionAbsolute.y+_};s&&(g.x=l[0]*Math.round(g.x/l[0]),g.y=l[1]*Math.round(g.y/l[1]));const{positionAbsolute:y,position:S}=xV(v,g,r,i,void 0,u);v.position=S,v.positionAbsolute=y}return v});o(b,!0,!1)},[])}const yh={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};var Yp=e=>{const t=({id:n,type:r,data:i,xPos:o,yPos:a,xPosOrigin:s,yPosOrigin:l,selected:u,onClick:c,onMouseEnter:d,onMouseMove:f,onMouseLeave:h,onContextMenu:p,onDoubleClick:m,style:_,className:b,isDraggable:v,isSelectable:g,isConnectable:y,isFocusable:S,selectNodesOnDrag:w,sourcePosition:x,targetPosition:C,hidden:T,resizeObserver:k,dragHandle:P,zIndex:$,isParent:O,noDragClassName:E,noPanClassName:A,initialized:D,disableKeyboardA11y:L,ariaLabel:M,rfId:R})=>{const N=hi(),B=I.useRef(null),U=I.useRef(x),G=I.useRef(C),Y=I.useRef(r),ee=g||v||c||d||f||h,J=CV(),j=Xp(n,N.getState,d),Q=Xp(n,N.getState,f),ne=Xp(n,N.getState,h),se=Xp(n,N.getState,p),ve=Xp(n,N.getState,m),ce=ze=>{if(g&&(!w||!v)&&$E({id:n,store:N,nodeRef:B}),c){const gt=N.getState().nodeInternals.get(n);gt&&c(ze,{...gt})}},bt=ze=>{if(!RE(ze))if(qU.includes(ze.key)&&g){const gt=ze.key==="Escape";$E({id:n,store:N,unselect:gt,nodeRef:B})}else!L&&v&&u&&Object.prototype.hasOwnProperty.call(yh,ze.key)&&(N.setState({ariaLiveMessage:`Moved selected node ${ze.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~o}, y: ${~~a}`}),J({x:yh[ze.key].x,y:yh[ze.key].y,isShiftPressed:ze.shiftKey}))};I.useEffect(()=>{if(B.current&&!T){const ze=B.current;return k==null||k.observe(ze),()=>k==null?void 0:k.unobserve(ze)}},[T]),I.useEffect(()=>{const ze=Y.current!==r,gt=U.current!==x,Pe=G.current!==C;B.current&&(ze||gt||Pe)&&(ze&&(Y.current=r),gt&&(U.current=x),Pe&&(G.current=C),N.getState().updateNodeDimensions([{id:n,nodeElement:B.current,forceUpdate:!0}]))},[n,r,x,C]);const ot=wV({nodeRef:B,disabled:T||!v,noDragClassName:E,handleSelector:P,nodeId:n,isSelectable:g,selectNodesOnDrag:w});return T?null:W.jsx("div",{className:Ta(["react-flow__node",`react-flow__node-${r}`,{[A]:v},b,{selected:u,selectable:g,parent:O,dragging:ot}]),ref:B,style:{zIndex:$,transform:`translate(${s}px,${l}px)`,pointerEvents:ee?"all":"none",visibility:D?"visible":"hidden",..._},"data-id":n,"data-testid":`rf__node-${n}`,onMouseEnter:j,onMouseMove:Q,onMouseLeave:ne,onContextMenu:se,onClick:ce,onDoubleClick:ve,onKeyDown:S?bt:void 0,tabIndex:S?0:void 0,role:S?"button":void 0,"aria-describedby":L?void 0:`${hV}-${R}`,"aria-label":M,children:W.jsx(vbe,{value:n,children:W.jsx(e,{id:n,data:i,type:r,xPos:o,yPos:a,selected:u,isConnectable:y,sourcePosition:x,targetPosition:C,dragging:ot,dragHandle:P,zIndex:$})})})};return t.displayName="NodeWrapper",I.memo(t)};const a_e=e=>{const t=e.getNodes().filter(n=>n.selected);return{...sA(t,e.nodeOrigin),transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`,userSelectionActive:e.userSelectionActive}};function s_e({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const r=hi(),{width:i,height:o,x:a,y:s,transformString:l,userSelectionActive:u}=br(a_e,Ro),c=CV(),d=I.useRef(null);if(I.useEffect(()=>{var p;n||(p=d.current)==null||p.focus({preventScroll:!0})},[n]),wV({nodeRef:d}),u||!i||!o)return null;const f=e?p=>{const m=r.getState().getNodes().filter(_=>_.selected);e(p,m)}:void 0,h=p=>{Object.prototype.hasOwnProperty.call(yh,p.key)&&c({x:yh[p.key].x,y:yh[p.key].y,isShiftPressed:p.shiftKey})};return W.jsx("div",{className:Ta(["react-flow__nodesselection","react-flow__container",t]),style:{transform:l},children:W.jsx("div",{ref:d,className:"react-flow__nodesselection-rect",onContextMenu:f,tabIndex:n?void 0:-1,onKeyDown:n?void 0:h,style:{width:i,height:o,top:s,left:a}})})}var l_e=I.memo(s_e);const u_e=e=>e.nodesSelectionActive,EV=({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:i,onPaneContextMenu:o,onPaneScroll:a,deleteKeyCode:s,onMove:l,onMoveStart:u,onMoveEnd:c,selectionKeyCode:d,selectionOnDrag:f,selectionMode:h,onSelectionStart:p,onSelectionEnd:m,multiSelectionKeyCode:_,panActivationKeyCode:b,zoomActivationKeyCode:v,elementsSelectable:g,zoomOnScroll:y,zoomOnPinch:S,panOnScroll:w,panOnScrollSpeed:x,panOnScrollMode:C,zoomOnDoubleClick:T,panOnDrag:k,defaultViewport:P,translateExtent:$,minZoom:O,maxZoom:E,preventScrolling:A,onSelectionContextMenu:D,noWheelClassName:L,noPanClassName:M,disableKeyboardA11y:R})=>{const N=br(u_e),B=p0(d),G=p0(b)||k,Y=B||f&&G!==!0;return Qbe({deleteKeyCode:s,multiSelectionKeyCode:_}),W.jsx(Jbe,{onMove:l,onMoveStart:u,onMoveEnd:c,onPaneContextMenu:o,elementsSelectable:g,zoomOnScroll:y,zoomOnPinch:S,panOnScroll:w,panOnScrollSpeed:x,panOnScrollMode:C,zoomOnDoubleClick:T,panOnDrag:!B&&G,defaultViewport:P,translateExtent:$,minZoom:O,maxZoom:E,zoomActivationKeyCode:v,preventScrolling:A,noWheelClassName:L,noPanClassName:M,children:W.jsxs(_V,{onSelectionStart:p,onSelectionEnd:m,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:i,onPaneContextMenu:o,onPaneScroll:a,panOnDrag:G,isSelecting:!!Y,selectionMode:h,children:[e,N&&W.jsx(l_e,{onSelectionContextMenu:D,noPanClassName:M,disableKeyboardA11y:R})]})})};EV.displayName="FlowRenderer";var c_e=I.memo(EV);function d_e(e){return br(I.useCallback(n=>e?tV(n.nodeInternals,{x:0,y:0,width:n.width,height:n.height},n.transform,!0):n.getNodes(),[e]))}function f_e(e){const t={input:Yp(e.input||uV),default:Yp(e.default||NE),output:Yp(e.output||dV),group:Yp(e.group||cA)},n={},r=Object.keys(e).filter(i=>!["input","default","output","group"].includes(i)).reduce((i,o)=>(i[o]=Yp(e[o]||NE),i),n);return{...t,...r}}const h_e=({x:e,y:t,width:n,height:r,origin:i})=>!n||!r?{x:e,y:t}:i[0]<0||i[1]<0||i[0]>1||i[1]>1?{x:e,y:t}:{x:e-n*i[0],y:t-r*i[1]},p_e=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,updateNodeDimensions:e.updateNodeDimensions,onError:e.onError}),kV=e=>{const{nodesDraggable:t,nodesConnectable:n,nodesFocusable:r,elementsSelectable:i,updateNodeDimensions:o,onError:a}=br(p_e,Ro),s=d_e(e.onlyRenderVisibleElements),l=I.useRef(),u=I.useMemo(()=>{if(typeof ResizeObserver>"u")return null;const c=new ResizeObserver(d=>{const f=d.map(h=>({id:h.target.getAttribute("data-id"),nodeElement:h.target,forceUpdate:!0}));o(f)});return l.current=c,c},[]);return I.useEffect(()=>()=>{var c;(c=l==null?void 0:l.current)==null||c.disconnect()},[]),W.jsx("div",{className:"react-flow__nodes",style:dA,children:s.map(c=>{var S,w;let d=c.type||"default";e.nodeTypes[d]||(a==null||a("003",ql.error003(d)),d="default");const f=e.nodeTypes[d]||e.nodeTypes.default,h=!!(c.draggable||t&&typeof c.draggable>"u"),p=!!(c.selectable||i&&typeof c.selectable>"u"),m=!!(c.connectable||n&&typeof c.connectable>"u"),_=!!(c.focusable||r&&typeof c.focusable>"u"),b=e.nodeExtent?nA(c.positionAbsolute,e.nodeExtent):c.positionAbsolute,v=(b==null?void 0:b.x)??0,g=(b==null?void 0:b.y)??0,y=h_e({x:v,y:g,width:c.width??0,height:c.height??0,origin:e.nodeOrigin});return W.jsx(f,{id:c.id,className:c.className,style:c.style,type:d,data:c.data,sourcePosition:c.sourcePosition||tt.Bottom,targetPosition:c.targetPosition||tt.Top,hidden:c.hidden,xPos:v,yPos:g,xPosOrigin:y.x,yPosOrigin:y.y,selectNodesOnDrag:e.selectNodesOnDrag,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,selected:!!c.selected,isDraggable:h,isSelectable:p,isConnectable:m,isFocusable:_,resizeObserver:u,dragHandle:c.dragHandle,zIndex:((S=c[Kr])==null?void 0:S.z)??0,isParent:!!((w=c[Kr])!=null&&w.isParent),noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,initialized:!!c.width&&!!c.height,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,ariaLabel:c.ariaLabel},c.id)})})};kV.displayName="NodeRenderer";var g_e=I.memo(kV);const m_e=(e,t,n)=>n===tt.Left?e-t:n===tt.Right?e+t:e,y_e=(e,t,n)=>n===tt.Top?e-t:n===tt.Bottom?e+t:e,k9="react-flow__edgeupdater",T9=({position:e,centerX:t,centerY:n,radius:r=10,onMouseDown:i,onMouseEnter:o,onMouseOut:a,type:s})=>W.jsx("circle",{onMouseDown:i,onMouseEnter:o,onMouseOut:a,className:Ta([k9,`${k9}-${s}`]),cx:m_e(t,r,e),cy:y_e(n,r,e),r,stroke:"transparent",fill:"transparent"}),v_e=()=>!0;var gf=e=>{const t=({id:n,className:r,type:i,data:o,onClick:a,onEdgeDoubleClick:s,selected:l,animated:u,label:c,labelStyle:d,labelShowBg:f,labelBgStyle:h,labelBgPadding:p,labelBgBorderRadius:m,style:_,source:b,target:v,sourceX:g,sourceY:y,targetX:S,targetY:w,sourcePosition:x,targetPosition:C,elementsSelectable:T,hidden:k,sourceHandleId:P,targetHandleId:$,onContextMenu:O,onMouseEnter:E,onMouseMove:A,onMouseLeave:D,edgeUpdaterRadius:L,onEdgeUpdate:M,onEdgeUpdateStart:R,onEdgeUpdateEnd:N,markerEnd:B,markerStart:U,rfId:G,ariaLabel:Y,isFocusable:ee,isUpdatable:J,pathOptions:j,interactionWidth:Q})=>{const ne=I.useRef(null),[se,ve]=I.useState(!1),[ce,bt]=I.useState(!1),ot=hi(),ze=I.useMemo(()=>`url(#${ME(U,G)})`,[U,G]),gt=I.useMemo(()=>`url(#${ME(B,G)})`,[B,G]);if(k)return null;const Pe=Fn=>{const{edges:bn,addSelectedEdges:Mi}=ot.getState();if(T&&(ot.setState({nodesSelectionActive:!1}),Mi([n])),a){const pi=bn.find(Qi=>Qi.id===n);a(Fn,pi)}},Jt=Qp(n,ot.getState,s),Ar=Qp(n,ot.getState,O),Dn=Qp(n,ot.getState,E),Tn=Qp(n,ot.getState,A),en=Qp(n,ot.getState,D),Ln=(Fn,bn)=>{if(Fn.button!==0)return;const{edges:Mi,isValidConnection:pi}=ot.getState(),Qi=bn?v:b,$a=(bn?$:P)||null,Ir=bn?"target":"source",fo=pi||v_e,ol=bn,$o=Mi.find(tn=>tn.id===n);bt(!0),R==null||R(Fn,$o,Ir);const al=tn=>{bt(!1),N==null||N(tn,$o,Ir)};oV({event:Fn,handleId:$a,nodeId:Qi,onConnect:tn=>M==null?void 0:M($o,tn),isTarget:ol,getState:ot.getState,setState:ot.setState,isValidConnection:fo,edgeUpdaterType:Ir,onEdgeUpdateEnd:al})},Pr=Fn=>Ln(Fn,!0),co=Fn=>Ln(Fn,!1),Jr=()=>ve(!0),hr=()=>ve(!1),Fr=!T&&!a,ei=Fn=>{var bn;if(qU.includes(Fn.key)&&T){const{unselectNodesAndEdges:Mi,addSelectedEdges:pi,edges:Qi}=ot.getState();Fn.key==="Escape"?((bn=ne.current)==null||bn.blur(),Mi({edges:[Qi.find(Ir=>Ir.id===n)]})):pi([n])}};return W.jsxs("g",{className:Ta(["react-flow__edge",`react-flow__edge-${i}`,r,{selected:l,animated:u,inactive:Fr,updating:se}]),onClick:Pe,onDoubleClick:Jt,onContextMenu:Ar,onMouseEnter:Dn,onMouseMove:Tn,onMouseLeave:en,onKeyDown:ee?ei:void 0,tabIndex:ee?0:void 0,role:ee?"button":"img","data-testid":`rf__edge-${n}`,"aria-label":Y===null?void 0:Y||`Edge from ${b} to ${v}`,"aria-describedby":ee?`${pV}-${G}`:void 0,ref:ne,children:[!ce&&W.jsx(e,{id:n,source:b,target:v,selected:l,animated:u,label:c,labelStyle:d,labelShowBg:f,labelBgStyle:h,labelBgPadding:p,labelBgBorderRadius:m,data:o,style:_,sourceX:g,sourceY:y,targetX:S,targetY:w,sourcePosition:x,targetPosition:C,sourceHandleId:P,targetHandleId:$,markerStart:ze,markerEnd:gt,pathOptions:j,interactionWidth:Q}),J&&W.jsxs(W.Fragment,{children:[(J==="source"||J===!0)&&W.jsx(T9,{position:x,centerX:g,centerY:y,radius:L,onMouseDown:Pr,onMouseEnter:Jr,onMouseOut:hr,type:"source"}),(J==="target"||J===!0)&&W.jsx(T9,{position:C,centerX:S,centerY:w,radius:L,onMouseDown:co,onMouseEnter:Jr,onMouseOut:hr,type:"target"})]})]})};return t.displayName="EdgeWrapper",I.memo(t)};function b_e(e){const t={default:gf(e.default||O_),straight:gf(e.bezier||oA),step:gf(e.step||iA),smoothstep:gf(e.step||Q2),simplebezier:gf(e.simplebezier||rA)},n={},r=Object.keys(e).filter(i=>!["default","bezier"].includes(i)).reduce((i,o)=>(i[o]=gf(e[o]||O_),i),n);return{...t,...r}}function A9(e,t,n=null){const r=((n==null?void 0:n.x)||0)+t.x,i=((n==null?void 0:n.y)||0)+t.y,o=(n==null?void 0:n.width)||t.width,a=(n==null?void 0:n.height)||t.height;switch(e){case tt.Top:return{x:r+o/2,y:i};case tt.Right:return{x:r+o,y:i+a/2};case tt.Bottom:return{x:r+o/2,y:i+a};case tt.Left:return{x:r,y:i+a/2}}}function P9(e,t){return e?e.length===1||!t?e[0]:t&&e.find(n=>n.id===t)||null:null}const __e=(e,t,n,r,i,o)=>{const a=A9(n,e,t),s=A9(o,r,i);return{sourceX:a.x,sourceY:a.y,targetX:s.x,targetY:s.y}};function S_e({sourcePos:e,targetPos:t,sourceWidth:n,sourceHeight:r,targetWidth:i,targetHeight:o,width:a,height:s,transform:l}){const u={x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x+n,t.x+i),y2:Math.max(e.y+r,t.y+o)};u.x===u.x2&&(u.x2+=1),u.y===u.y2&&(u.y2+=1);const c=h0({x:(0-l[0])/l[2],y:(0-l[1])/l[2],width:a/l[2],height:s/l[2]}),d=Math.max(0,Math.min(c.x2,u.x2)-Math.max(c.x,u.x)),f=Math.max(0,Math.min(c.y2,u.y2)-Math.max(c.y,u.y));return Math.ceil(d*f)>0}function I9(e){var r,i,o,a,s;const t=((r=e==null?void 0:e[Kr])==null?void 0:r.handleBounds)||null,n=t&&(e==null?void 0:e.width)&&(e==null?void 0:e.height)&&typeof((i=e==null?void 0:e.positionAbsolute)==null?void 0:i.x)<"u"&&typeof((o=e==null?void 0:e.positionAbsolute)==null?void 0:o.y)<"u";return[{x:((a=e==null?void 0:e.positionAbsolute)==null?void 0:a.x)||0,y:((s=e==null?void 0:e.positionAbsolute)==null?void 0:s.y)||0,width:(e==null?void 0:e.width)||0,height:(e==null?void 0:e.height)||0},t,!!n]}const x_e=[{level:0,isMaxLevel:!0,edges:[]}];function w_e(e,t,n=!1){let r=-1;const i=e.reduce((a,s)=>{var c,d;const l=ba(s.zIndex);let u=l?s.zIndex:0;if(n){const f=t.get(s.target),h=t.get(s.source),p=s.selected||(f==null?void 0:f.selected)||(h==null?void 0:h.selected),m=Math.max(((c=h==null?void 0:h[Kr])==null?void 0:c.z)||0,((d=f==null?void 0:f[Kr])==null?void 0:d.z)||0,1e3);u=(l?s.zIndex:0)+(p?m:0)}return a[u]?a[u].push(s):a[u]=[s],r=u>r?u:r,a},{}),o=Object.entries(i).map(([a,s])=>{const l=+a;return{edges:s,level:l,isMaxLevel:l===r}});return o.length===0?x_e:o}function C_e(e,t,n){const r=br(I.useCallback(i=>e?i.edges.filter(o=>{const a=t.get(o.source),s=t.get(o.target);return(a==null?void 0:a.width)&&(a==null?void 0:a.height)&&(s==null?void 0:s.width)&&(s==null?void 0:s.height)&&S_e({sourcePos:a.positionAbsolute||{x:0,y:0},targetPos:s.positionAbsolute||{x:0,y:0},sourceWidth:a.width,sourceHeight:a.height,targetWidth:s.width,targetHeight:s.height,width:i.width,height:i.height,transform:i.transform})}):i.edges,[e,t]));return w_e(r,t,n)}const E_e=({color:e="none",strokeWidth:t=1})=>W.jsx("polyline",{stroke:e,strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:t,fill:"none",points:"-5,-4 0,0 -5,4"}),k_e=({color:e="none",strokeWidth:t=1})=>W.jsx("polyline",{stroke:e,strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:t,fill:e,points:"-5,-4 0,0 -5,4 -5,-4"}),R9={[R_.Arrow]:E_e,[R_.ArrowClosed]:k_e};function T_e(e){const t=hi();return I.useMemo(()=>{var i,o;return Object.prototype.hasOwnProperty.call(R9,e)?R9[e]:((o=(i=t.getState()).onError)==null||o.call(i,"009",ql.error009(e)),null)},[e])}const A_e=({id:e,type:t,color:n,width:r=12.5,height:i=12.5,markerUnits:o="strokeWidth",strokeWidth:a,orient:s="auto-start-reverse"})=>{const l=T_e(t);return l?W.jsx("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${r}`,markerHeight:`${i}`,viewBox:"-10 -10 20 20",markerUnits:o,orient:s,refX:"0",refY:"0",children:W.jsx(l,{color:n,strokeWidth:a})}):null},P_e=({defaultColor:e,rfId:t})=>n=>{const r=[];return n.edges.reduce((i,o)=>([o.markerStart,o.markerEnd].forEach(a=>{if(a&&typeof a=="object"){const s=ME(a,t);r.includes(s)||(i.push({id:s,color:a.color||e,...a}),r.push(s))}}),i),[]).sort((i,o)=>i.id.localeCompare(o.id))},TV=({defaultColor:e,rfId:t})=>{const n=br(I.useCallback(P_e({defaultColor:e,rfId:t}),[e,t]),(r,i)=>!(r.length!==i.length||r.some((o,a)=>o.id!==i[a].id)));return W.jsx("defs",{children:n.map(r=>W.jsx(A_e,{id:r.id,type:r.type,color:r.color,width:r.width,height:r.height,markerUnits:r.markerUnits,strokeWidth:r.strokeWidth,orient:r.orient},r.id))})};TV.displayName="MarkerDefinitions";var I_e=I.memo(TV);const R_e=e=>({nodesConnectable:e.nodesConnectable,edgesFocusable:e.edgesFocusable,edgesUpdatable:e.edgesUpdatable,elementsSelectable:e.elementsSelectable,width:e.width,height:e.height,connectionMode:e.connectionMode,nodeInternals:e.nodeInternals,onError:e.onError}),AV=({defaultMarkerColor:e,onlyRenderVisibleElements:t,elevateEdgesOnSelect:n,rfId:r,edgeTypes:i,noPanClassName:o,onEdgeUpdate:a,onEdgeContextMenu:s,onEdgeMouseEnter:l,onEdgeMouseMove:u,onEdgeMouseLeave:c,onEdgeClick:d,edgeUpdaterRadius:f,onEdgeDoubleClick:h,onEdgeUpdateStart:p,onEdgeUpdateEnd:m,children:_})=>{const{edgesFocusable:b,edgesUpdatable:v,elementsSelectable:g,width:y,height:S,connectionMode:w,nodeInternals:x,onError:C}=br(R_e,Ro),T=C_e(t,x,n);return y?W.jsxs(W.Fragment,{children:[T.map(({level:k,edges:P,isMaxLevel:$})=>W.jsxs("svg",{style:{zIndex:k},width:y,height:S,className:"react-flow__edges react-flow__container",children:[$&&W.jsx(I_e,{defaultColor:e,rfId:r}),W.jsx("g",{children:P.map(O=>{const[E,A,D]=I9(x.get(O.source)),[L,M,R]=I9(x.get(O.target));if(!D||!R)return null;let N=O.type||"default";i[N]||(C==null||C("011",ql.error011(N)),N="default");const B=i[N]||i.default,U=w===Nd.Strict?M.target:(M.target??[]).concat(M.source??[]),G=P9(A.source,O.sourceHandle),Y=P9(U,O.targetHandle),ee=(G==null?void 0:G.position)||tt.Bottom,J=(Y==null?void 0:Y.position)||tt.Top,j=!!(O.focusable||b&&typeof O.focusable>"u"),Q=typeof a<"u"&&(O.updatable||v&&typeof O.updatable>"u");if(!G||!Y)return C==null||C("008",ql.error008(G,O)),null;const{sourceX:ne,sourceY:se,targetX:ve,targetY:ce}=__e(E,G,ee,L,Y,J);return W.jsx(B,{id:O.id,className:Ta([O.className,o]),type:N,data:O.data,selected:!!O.selected,animated:!!O.animated,hidden:!!O.hidden,label:O.label,labelStyle:O.labelStyle,labelShowBg:O.labelShowBg,labelBgStyle:O.labelBgStyle,labelBgPadding:O.labelBgPadding,labelBgBorderRadius:O.labelBgBorderRadius,style:O.style,source:O.source,target:O.target,sourceHandleId:O.sourceHandle,targetHandleId:O.targetHandle,markerEnd:O.markerEnd,markerStart:O.markerStart,sourceX:ne,sourceY:se,targetX:ve,targetY:ce,sourcePosition:ee,targetPosition:J,elementsSelectable:g,onEdgeUpdate:a,onContextMenu:s,onMouseEnter:l,onMouseMove:u,onMouseLeave:c,onClick:d,edgeUpdaterRadius:f,onEdgeDoubleClick:h,onEdgeUpdateStart:p,onEdgeUpdateEnd:m,rfId:r,ariaLabel:O.ariaLabel,isFocusable:j,isUpdatable:Q,pathOptions:"pathOptions"in O?O.pathOptions:void 0,interactionWidth:O.interactionWidth},O.id)})})]},k)),_]}):null};AV.displayName="EdgeRenderer";var O_e=I.memo(AV);const M_e=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function N_e({children:e}){const t=br(M_e);return W.jsx("div",{className:"react-flow__viewport react-flow__container",style:{transform:t},children:e})}function $_e(e){const t=vV(),n=I.useRef(!1);I.useEffect(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}const D_e={[tt.Left]:tt.Right,[tt.Right]:tt.Left,[tt.Top]:tt.Bottom,[tt.Bottom]:tt.Top},PV=({nodeId:e,handleType:t,style:n,type:r=Eu.Bezier,CustomComponent:i,connectionStatus:o})=>{var w,x,C;const{fromNode:a,handleId:s,toX:l,toY:u,connectionMode:c}=br(I.useCallback(T=>({fromNode:T.nodeInternals.get(e),handleId:T.connectionHandleId,toX:(T.connectionPosition.x-T.transform[0])/T.transform[2],toY:(T.connectionPosition.y-T.transform[1])/T.transform[2],connectionMode:T.connectionMode}),[e]),Ro),d=(w=a==null?void 0:a[Kr])==null?void 0:w.handleBounds;let f=d==null?void 0:d[t];if(c===Nd.Loose&&(f=f||(d==null?void 0:d[t==="source"?"target":"source"])),!a||!f)return null;const h=s?f.find(T=>T.id===s):f[0],p=h?h.x+h.width/2:(a.width??0)/2,m=h?h.y+h.height/2:a.height??0,_=(((x=a.positionAbsolute)==null?void 0:x.x)??0)+p,b=(((C=a.positionAbsolute)==null?void 0:C.y)??0)+m,v=h==null?void 0:h.position,g=v?D_e[v]:null;if(!v||!g)return null;if(i)return W.jsx(i,{connectionLineType:r,connectionLineStyle:n,fromNode:a,fromHandle:h,fromX:_,fromY:b,toX:l,toY:u,fromPosition:v,toPosition:g,connectionStatus:o});let y="";const S={sourceX:_,sourceY:b,sourcePosition:v,targetX:l,targetY:u,targetPosition:g};return r===Eu.Bezier?[y]=YU(S):r===Eu.Step?[y]=OE({...S,borderRadius:0}):r===Eu.SmoothStep?[y]=OE(S):r===Eu.SimpleBezier?[y]=XU(S):y=`M${_},${b} ${l},${u}`,W.jsx("path",{d:y,fill:"none",className:"react-flow__connection-path",style:n})};PV.displayName="ConnectionLine";const L_e=e=>({nodeId:e.connectionNodeId,handleType:e.connectionHandleType,nodesConnectable:e.nodesConnectable,connectionStatus:e.connectionStatus,width:e.width,height:e.height});function F_e({containerStyle:e,style:t,type:n,component:r}){const{nodeId:i,handleType:o,nodesConnectable:a,width:s,height:l,connectionStatus:u}=br(L_e,Ro);return!(i&&o&&s&&a)?null:W.jsx("svg",{style:e,width:s,height:l,className:"react-flow__edges react-flow__connectionline react-flow__container",children:W.jsx("g",{className:Ta(["react-flow__connection",u]),children:W.jsx(PV,{nodeId:i,handleType:o,style:t,type:n,CustomComponent:r,connectionStatus:u})})})}function O9(e,t){return I.useRef(null),hi(),I.useMemo(()=>t(e),[e])}const IV=({nodeTypes:e,edgeTypes:t,onMove:n,onMoveStart:r,onMoveEnd:i,onInit:o,onNodeClick:a,onEdgeClick:s,onNodeDoubleClick:l,onEdgeDoubleClick:u,onNodeMouseEnter:c,onNodeMouseMove:d,onNodeMouseLeave:f,onNodeContextMenu:h,onSelectionContextMenu:p,onSelectionStart:m,onSelectionEnd:_,connectionLineType:b,connectionLineStyle:v,connectionLineComponent:g,connectionLineContainerStyle:y,selectionKeyCode:S,selectionOnDrag:w,selectionMode:x,multiSelectionKeyCode:C,panActivationKeyCode:T,zoomActivationKeyCode:k,deleteKeyCode:P,onlyRenderVisibleElements:$,elementsSelectable:O,selectNodesOnDrag:E,defaultViewport:A,translateExtent:D,minZoom:L,maxZoom:M,preventScrolling:R,defaultMarkerColor:N,zoomOnScroll:B,zoomOnPinch:U,panOnScroll:G,panOnScrollSpeed:Y,panOnScrollMode:ee,zoomOnDoubleClick:J,panOnDrag:j,onPaneClick:Q,onPaneMouseEnter:ne,onPaneMouseMove:se,onPaneMouseLeave:ve,onPaneScroll:ce,onPaneContextMenu:bt,onEdgeUpdate:ot,onEdgeContextMenu:ze,onEdgeMouseEnter:gt,onEdgeMouseMove:Pe,onEdgeMouseLeave:Jt,edgeUpdaterRadius:Ar,onEdgeUpdateStart:Dn,onEdgeUpdateEnd:Tn,noDragClassName:en,noWheelClassName:Ln,noPanClassName:Pr,elevateEdgesOnSelect:co,disableKeyboardA11y:Jr,nodeOrigin:hr,nodeExtent:Fr,rfId:ei})=>{const Fn=O9(e,f_e),bn=O9(t,b_e);return $_e(o),W.jsx(c_e,{onPaneClick:Q,onPaneMouseEnter:ne,onPaneMouseMove:se,onPaneMouseLeave:ve,onPaneContextMenu:bt,onPaneScroll:ce,deleteKeyCode:P,selectionKeyCode:S,selectionOnDrag:w,selectionMode:x,onSelectionStart:m,onSelectionEnd:_,multiSelectionKeyCode:C,panActivationKeyCode:T,zoomActivationKeyCode:k,elementsSelectable:O,onMove:n,onMoveStart:r,onMoveEnd:i,zoomOnScroll:B,zoomOnPinch:U,zoomOnDoubleClick:J,panOnScroll:G,panOnScrollSpeed:Y,panOnScrollMode:ee,panOnDrag:j,defaultViewport:A,translateExtent:D,minZoom:L,maxZoom:M,onSelectionContextMenu:p,preventScrolling:R,noDragClassName:en,noWheelClassName:Ln,noPanClassName:Pr,disableKeyboardA11y:Jr,children:W.jsxs(N_e,{children:[W.jsx(O_e,{edgeTypes:bn,onEdgeClick:s,onEdgeDoubleClick:u,onEdgeUpdate:ot,onlyRenderVisibleElements:$,onEdgeContextMenu:ze,onEdgeMouseEnter:gt,onEdgeMouseMove:Pe,onEdgeMouseLeave:Jt,onEdgeUpdateStart:Dn,onEdgeUpdateEnd:Tn,edgeUpdaterRadius:Ar,defaultMarkerColor:N,noPanClassName:Pr,elevateEdgesOnSelect:!!co,disableKeyboardA11y:Jr,rfId:ei,children:W.jsx(F_e,{style:v,type:b,component:g,containerStyle:y})}),W.jsx("div",{className:"react-flow__edgelabel-renderer"}),W.jsx(g_e,{nodeTypes:Fn,onNodeClick:a,onNodeDoubleClick:l,onNodeMouseEnter:c,onNodeMouseMove:d,onNodeMouseLeave:f,onNodeContextMenu:h,selectNodesOnDrag:E,onlyRenderVisibleElements:$,noPanClassName:Pr,noDragClassName:en,disableKeyboardA11y:Jr,nodeOrigin:hr,nodeExtent:Fr,rfId:ei})]})})};IV.displayName="GraphView";var B_e=I.memo(IV);const DE=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],lu={rfId:"1",width:0,height:0,transform:[0,0,1],nodeInternals:new Map,edges:[],onNodesChange:null,onEdgesChange:null,hasDefaultNodes:!1,hasDefaultEdges:!1,d3Zoom:null,d3Selection:null,d3ZoomHandler:void 0,minZoom:.5,maxZoom:2,translateExtent:DE,nodeExtent:DE,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionNodeId:null,connectionHandleId:null,connectionHandleType:"source",connectionPosition:{x:0,y:0},connectionStatus:null,connectionMode:Nd.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:[0,0],snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesUpdatable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,fitViewOnInit:!1,fitViewOnInitDone:!1,fitViewOnInitOptions:void 0,multiSelectionActive:!1,connectionStartHandle:null,connectionEndHandle:null,connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,connectionRadius:20,onError:fbe,isValidConnection:void 0},z_e=()=>k0e((e,t)=>({...lu,setNodes:n=>{const{nodeInternals:r,nodeOrigin:i,elevateNodesOnSelect:o}=t();e({nodeInternals:LC(n,r,i,o)})},getNodes:()=>Array.from(t().nodeInternals.values()),setEdges:n=>{const{defaultEdgeOptions:r={}}=t();e({edges:n.map(i=>({...r,...i}))})},setDefaultNodesAndEdges:(n,r)=>{const i=typeof n<"u",o=typeof r<"u",a=i?LC(n,new Map,t().nodeOrigin,t().elevateNodesOnSelect):new Map;e({nodeInternals:a,edges:o?r:[],hasDefaultNodes:i,hasDefaultEdges:o})},updateNodeDimensions:n=>{const{onNodesChange:r,nodeInternals:i,fitViewOnInit:o,fitViewOnInitDone:a,fitViewOnInitOptions:s,domNode:l,nodeOrigin:u}=t(),c=l==null?void 0:l.querySelector(".react-flow__viewport");if(!c)return;const d=window.getComputedStyle(c),{m22:f}=new window.DOMMatrixReadOnly(d.transform),h=n.reduce((m,_)=>{const b=i.get(_.id);if(b){const v=tA(_.nodeElement);!!(v.width&&v.height&&(b.width!==v.width||b.height!==v.height||_.forceUpdate))&&(i.set(b.id,{...b,[Kr]:{...b[Kr],handleBounds:{source:E9(".source",_.nodeElement,f,u),target:E9(".target",_.nodeElement,f,u)}},...v}),m.push({id:b.id,type:"dimensions",dimensions:v}))}return m},[]);mV(i,u);const p=a||o&&!a&&yV(t,{initial:!0,...s});e({nodeInternals:new Map(i),fitViewOnInitDone:p}),(h==null?void 0:h.length)>0&&(r==null||r(h))},updateNodePositions:(n,r=!0,i=!1)=>{const{triggerNodeChanges:o}=t(),a=n.map(s=>{const l={id:s.id,type:"position",dragging:i};return r&&(l.positionAbsolute=s.positionAbsolute,l.position=s.position),l});o(a)},triggerNodeChanges:n=>{const{onNodesChange:r,nodeInternals:i,hasDefaultNodes:o,nodeOrigin:a,getNodes:s,elevateNodesOnSelect:l}=t();if(n!=null&&n.length){if(o){const u=Uc(n,s()),c=LC(u,i,a,l);e({nodeInternals:c})}r==null||r(n)}},addSelectedNodes:n=>{const{multiSelectionActive:r,edges:i,getNodes:o}=t();let a,s=null;r?a=n.map(l=>yu(l,!0)):(a=zf(o(),n),s=zf(i,[])),Nv({changedNodes:a,changedEdges:s,get:t,set:e})},addSelectedEdges:n=>{const{multiSelectionActive:r,edges:i,getNodes:o}=t();let a,s=null;r?a=n.map(l=>yu(l,!0)):(a=zf(i,n),s=zf(o(),[])),Nv({changedNodes:s,changedEdges:a,get:t,set:e})},unselectNodesAndEdges:({nodes:n,edges:r}={})=>{const{edges:i,getNodes:o}=t(),a=n||o(),s=r||i,l=a.map(c=>(c.selected=!1,yu(c.id,!1))),u=s.map(c=>yu(c.id,!1));Nv({changedNodes:l,changedEdges:u,get:t,set:e})},setMinZoom:n=>{const{d3Zoom:r,maxZoom:i}=t();r==null||r.scaleExtent([n,i]),e({minZoom:n})},setMaxZoom:n=>{const{d3Zoom:r,minZoom:i}=t();r==null||r.scaleExtent([i,n]),e({maxZoom:n})},setTranslateExtent:n=>{var r;(r=t().d3Zoom)==null||r.translateExtent(n),e({translateExtent:n})},resetSelectedElements:()=>{const{edges:n,getNodes:r}=t(),o=r().filter(s=>s.selected).map(s=>yu(s.id,!1)),a=n.filter(s=>s.selected).map(s=>yu(s.id,!1));Nv({changedNodes:o,changedEdges:a,get:t,set:e})},setNodeExtent:n=>{const{nodeInternals:r}=t();r.forEach(i=>{i.positionAbsolute=nA(i.position,n)}),e({nodeExtent:n,nodeInternals:new Map(r)})},panBy:n=>{const{transform:r,width:i,height:o,d3Zoom:a,d3Selection:s,translateExtent:l}=t();if(!a||!s||!n.x&&!n.y)return!1;const u=Ku.translate(r[0]+n.x,r[1]+n.y).scale(r[2]),c=[[0,0],[i,o]],d=a==null?void 0:a.constrain()(u,c,l);return a.transform(s,d),r[0]!==d.x||r[1]!==d.y||r[2]!==d.k},cancelConnection:()=>e({connectionNodeId:lu.connectionNodeId,connectionHandleId:lu.connectionHandleId,connectionHandleType:lu.connectionHandleType,connectionStatus:lu.connectionStatus,connectionStartHandle:lu.connectionStartHandle,connectionEndHandle:lu.connectionEndHandle}),reset:()=>e({...lu})}),Object.is),RV=({children:e})=>{const t=I.useRef(null);return t.current||(t.current=z_e()),W.jsx(obe,{value:t.current,children:e})};RV.displayName="ReactFlowProvider";const OV=({children:e})=>I.useContext(K2)?W.jsx(W.Fragment,{children:e}):W.jsx(RV,{children:e});OV.displayName="ReactFlowWrapper";const j_e={input:uV,default:NE,output:dV,group:cA},U_e={default:O_,straight:oA,step:iA,smoothstep:Q2,simplebezier:rA},V_e=[0,0],G_e=[15,15],H_e={x:0,y:0,zoom:1},q_e={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0},W_e=I.forwardRef(({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,className:i,nodeTypes:o=j_e,edgeTypes:a=U_e,onNodeClick:s,onEdgeClick:l,onInit:u,onMove:c,onMoveStart:d,onMoveEnd:f,onConnect:h,onConnectStart:p,onConnectEnd:m,onClickConnectStart:_,onClickConnectEnd:b,onNodeMouseEnter:v,onNodeMouseMove:g,onNodeMouseLeave:y,onNodeContextMenu:S,onNodeDoubleClick:w,onNodeDragStart:x,onNodeDrag:C,onNodeDragStop:T,onNodesDelete:k,onEdgesDelete:P,onSelectionChange:$,onSelectionDragStart:O,onSelectionDrag:E,onSelectionDragStop:A,onSelectionContextMenu:D,onSelectionStart:L,onSelectionEnd:M,connectionMode:R=Nd.Strict,connectionLineType:N=Eu.Bezier,connectionLineStyle:B,connectionLineComponent:U,connectionLineContainerStyle:G,deleteKeyCode:Y="Backspace",selectionKeyCode:ee="Shift",selectionOnDrag:J=!1,selectionMode:j=sc.Full,panActivationKeyCode:Q="Space",multiSelectionKeyCode:ne=I_()?"Meta":"Control",zoomActivationKeyCode:se=I_()?"Meta":"Control",snapToGrid:ve=!1,snapGrid:ce=G_e,onlyRenderVisibleElements:bt=!1,selectNodesOnDrag:ot=!0,nodesDraggable:ze,nodesConnectable:gt,nodesFocusable:Pe,nodeOrigin:Jt=V_e,edgesFocusable:Ar,edgesUpdatable:Dn,elementsSelectable:Tn,defaultViewport:en=H_e,minZoom:Ln=.5,maxZoom:Pr=2,translateExtent:co=DE,preventScrolling:Jr=!0,nodeExtent:hr,defaultMarkerColor:Fr="#b1b1b7",zoomOnScroll:ei=!0,zoomOnPinch:Fn=!0,panOnScroll:bn=!1,panOnScrollSpeed:Mi=.5,panOnScrollMode:pi=od.Free,zoomOnDoubleClick:Qi=!0,panOnDrag:$a=!0,onPaneClick:Ir,onPaneMouseEnter:fo,onPaneMouseMove:ol,onPaneMouseLeave:$o,onPaneScroll:al,onPaneContextMenu:Bn,children:tn,onEdgeUpdate:Br,onEdgeContextMenu:Rr,onEdgeDoubleClick:Or,onEdgeMouseEnter:ti,onEdgeMouseMove:Ni,onEdgeMouseLeave:ho,onEdgeUpdateStart:gi,onEdgeUpdateEnd:zr,edgeUpdaterRadius:Da=10,onNodesChange:hs,onEdgesChange:mi,noDragClassName:nu="nodrag",noWheelClassName:ia="nowheel",noPanClassName:ni="nopan",fitView:sl=!1,fitViewOptions:q,connectOnClick:te=!0,attributionPosition:re,proOptions:de,defaultEdgeOptions:oe,elevateNodesOnSelect:je=!0,elevateEdgesOnSelect:Ge=!1,disableKeyboardA11y:lt=!1,autoPanOnConnect:$e=!0,autoPanOnNodeDrag:He=!0,connectionRadius:Ie=20,isValidConnection:ie,onError:_e,style:Ye,id:Ze,...ut},ct)=>{const _t=Ze||"1";return W.jsx("div",{...ut,style:{...Ye,...q_e},ref:ct,className:Ta(["react-flow",i]),"data-testid":"rf__wrapper",id:Ze,children:W.jsxs(OV,{children:[W.jsx(B_e,{onInit:u,onMove:c,onMoveStart:d,onMoveEnd:f,onNodeClick:s,onEdgeClick:l,onNodeMouseEnter:v,onNodeMouseMove:g,onNodeMouseLeave:y,onNodeContextMenu:S,onNodeDoubleClick:w,nodeTypes:o,edgeTypes:a,connectionLineType:N,connectionLineStyle:B,connectionLineComponent:U,connectionLineContainerStyle:G,selectionKeyCode:ee,selectionOnDrag:J,selectionMode:j,deleteKeyCode:Y,multiSelectionKeyCode:ne,panActivationKeyCode:Q,zoomActivationKeyCode:se,onlyRenderVisibleElements:bt,selectNodesOnDrag:ot,defaultViewport:en,translateExtent:co,minZoom:Ln,maxZoom:Pr,preventScrolling:Jr,zoomOnScroll:ei,zoomOnPinch:Fn,zoomOnDoubleClick:Qi,panOnScroll:bn,panOnScrollSpeed:Mi,panOnScrollMode:pi,panOnDrag:$a,onPaneClick:Ir,onPaneMouseEnter:fo,onPaneMouseMove:ol,onPaneMouseLeave:$o,onPaneScroll:al,onPaneContextMenu:Bn,onSelectionContextMenu:D,onSelectionStart:L,onSelectionEnd:M,onEdgeUpdate:Br,onEdgeContextMenu:Rr,onEdgeDoubleClick:Or,onEdgeMouseEnter:ti,onEdgeMouseMove:Ni,onEdgeMouseLeave:ho,onEdgeUpdateStart:gi,onEdgeUpdateEnd:zr,edgeUpdaterRadius:Da,defaultMarkerColor:Fr,noDragClassName:nu,noWheelClassName:ia,noPanClassName:ni,elevateEdgesOnSelect:Ge,rfId:_t,disableKeyboardA11y:lt,nodeOrigin:Jt,nodeExtent:hr}),W.jsx(Lbe,{nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:h,onConnectStart:p,onConnectEnd:m,onClickConnectStart:_,onClickConnectEnd:b,nodesDraggable:ze,nodesConnectable:gt,nodesFocusable:Pe,edgesFocusable:Ar,edgesUpdatable:Dn,elementsSelectable:Tn,elevateNodesOnSelect:je,minZoom:Ln,maxZoom:Pr,nodeExtent:hr,onNodesChange:hs,onEdgesChange:mi,snapToGrid:ve,snapGrid:ce,connectionMode:R,translateExtent:co,connectOnClick:te,defaultEdgeOptions:oe,fitView:sl,fitViewOptions:q,onNodesDelete:k,onEdgesDelete:P,onNodeDragStart:x,onNodeDrag:C,onNodeDragStop:T,onSelectionDrag:E,onSelectionDragStart:O,onSelectionDragStop:A,noPanClassName:ni,nodeOrigin:Jt,rfId:_t,autoPanOnConnect:$e,autoPanOnNodeDrag:He,onError:_e,connectionRadius:Ie,isValidConnection:ie}),W.jsx($be,{onSelectionChange:$}),tn,W.jsx(lbe,{proOptions:de,position:re}),W.jsx(Ube,{rfId:_t,disableKeyboardA11y:lt})]})})});W_e.displayName="ReactFlow";const K_e=e=>{var t;return(t=e.domNode)==null?void 0:t.querySelector(".react-flow__edgelabel-renderer")};function yHe({children:e}){const t=br(K_e);return t?Uo.createPortal(e,t):null}function vHe(){const e=hi();return I.useCallback(t=>{const{domNode:n,updateNodeDimensions:r}=e.getState(),o=(Array.isArray(t)?t:[t]).reduce((a,s)=>{const l=n==null?void 0:n.querySelector(`.react-flow__node[data-id="${s}"]`);return l&&a.push({id:s,nodeElement:l,forceUpdate:!0}),a},[]);requestAnimationFrame(()=>r(o))},[])}function Q_e(){const e=[];return function(t,n){if(typeof n!="object"||n===null)return n;for(;e.length>0&&e.at(-1)!==this;)e.pop();return e.includes(n)?"[Circular]":(e.push(n),n)}}const g0=zb("nodes/receivedOpenAPISchema",async(e,{rejectWithValue:t})=>{try{const n=[window.location.origin,"openapi.json"].join("/"),i=await(await fetch(n)).json();return JSON.parse(JSON.stringify(i,Q_e()))}catch(n){return t({error:n})}});let Dv;const X_e=new Uint8Array(16);function Y_e(){if(!Dv&&(Dv=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Dv))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Dv(X_e)}const Si=[];for(let e=0;e<256;++e)Si.push((e+256).toString(16).slice(1));function Z_e(e,t=0){return(Si[e[t+0]]+Si[e[t+1]]+Si[e[t+2]]+Si[e[t+3]]+"-"+Si[e[t+4]]+Si[e[t+5]]+"-"+Si[e[t+6]]+Si[e[t+7]]+"-"+Si[e[t+8]]+Si[e[t+9]]+"-"+Si[e[t+10]]+Si[e[t+11]]+Si[e[t+12]]+Si[e[t+13]]+Si[e[t+14]]+Si[e[t+15]]).toLowerCase()}const J_e=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),M9={randomUUID:J_e};function MV(e,t,n){if(M9.randomUUID&&!t&&!e)return M9.randomUUID();e=e||{};const r=e.random||(e.rng||Y_e)();if(r[6]=r[6]&15|64,r[8]=r[8]&63|128,t){n=n||0;for(let i=0;i<16;++i)t[n+i]=r[i];return t}return Z_e(r)}const bHe=500,_He=320,eSe="node-drag-handle",SHe=["ImageField","ImageCollection"],xHe={input:"inputs",output:"outputs"},Lv=["Collection","IntegerCollection","BooleanCollection","FloatCollection","StringCollection","ImageCollection","LatentsCollection","ConditioningCollection","ControlCollection","ColorCollection"],xg=["IntegerPolymorphic","BooleanPolymorphic","FloatPolymorphic","StringPolymorphic","ImagePolymorphic","LatentsPolymorphic","ConditioningPolymorphic","ControlPolymorphic","ColorPolymorphic"],wHe=["IPAdapterModelField","ControlNetModelField","LoRAModelField","MainModelField","ONNXModelField","SDXLMainModelField","SDXLRefinerModelField","VaeModelField","UNetField","VaeField","ClipField"],fA={integer:"IntegerCollection",boolean:"BooleanCollection",number:"FloatCollection",float:"FloatCollection",string:"StringCollection",ImageField:"ImageCollection",LatentsField:"LatentsCollection",ConditioningField:"ConditioningCollection",ControlField:"ControlCollection",ColorField:"ColorCollection"},tSe=e=>!!(e&&e in fA),NV={integer:"IntegerPolymorphic",boolean:"BooleanPolymorphic",number:"FloatPolymorphic",float:"FloatPolymorphic",string:"StringPolymorphic",ImageField:"ImagePolymorphic",LatentsField:"LatentsPolymorphic",ConditioningField:"ConditioningPolymorphic",ControlField:"ControlPolymorphic",ColorField:"ColorPolymorphic"},nSe={IntegerPolymorphic:"integer",BooleanPolymorphic:"boolean",FloatPolymorphic:"float",StringPolymorphic:"string",ImagePolymorphic:"ImageField",LatentsPolymorphic:"LatentsField",ConditioningPolymorphic:"ConditioningField",ControlPolymorphic:"ControlField",ColorPolymorphic:"ColorField"},CHe=["string","StringPolymorphic","boolean","BooleanPolymorphic","integer","float","FloatPolymorphic","IntegerPolymorphic","enum","ImageField","ImagePolymorphic","MainModelField","SDXLRefinerModelField","VaeModelField","LoRAModelField","ControlNetModelField","ColorField","SDXLMainModelField","Scheduler","IPAdapterModelField","BoardField"],rSe=e=>!!(e&&e in NV),EHe={boolean:{color:"green.500",description:Z("nodes.booleanDescription"),title:Z("nodes.boolean")},BooleanCollection:{color:"green.500",description:Z("nodes.booleanCollectionDescription"),title:Z("nodes.booleanCollection")},BooleanPolymorphic:{color:"green.500",description:Z("nodes.booleanPolymorphicDescription"),title:Z("nodes.booleanPolymorphic")},ClipField:{color:"green.500",description:Z("nodes.clipFieldDescription"),title:Z("nodes.clipField")},Collection:{color:"base.500",description:Z("nodes.collectionDescription"),title:Z("nodes.collection")},CollectionItem:{color:"base.500",description:Z("nodes.collectionItemDescription"),title:Z("nodes.collectionItem")},ColorCollection:{color:"pink.300",description:Z("nodes.colorCollectionDescription"),title:Z("nodes.colorCollection")},ColorField:{color:"pink.300",description:Z("nodes.colorFieldDescription"),title:Z("nodes.colorField")},ColorPolymorphic:{color:"pink.300",description:Z("nodes.colorPolymorphicDescription"),title:Z("nodes.colorPolymorphic")},ConditioningCollection:{color:"cyan.500",description:Z("nodes.conditioningCollectionDescription"),title:Z("nodes.conditioningCollection")},ConditioningField:{color:"cyan.500",description:Z("nodes.conditioningFieldDescription"),title:Z("nodes.conditioningField")},ConditioningPolymorphic:{color:"cyan.500",description:Z("nodes.conditioningPolymorphicDescription"),title:Z("nodes.conditioningPolymorphic")},ControlCollection:{color:"teal.500",description:Z("nodes.controlCollectionDescription"),title:Z("nodes.controlCollection")},ControlField:{color:"teal.500",description:Z("nodes.controlFieldDescription"),title:Z("nodes.controlField")},ControlNetModelField:{color:"teal.500",description:"TODO",title:"ControlNet"},ControlPolymorphic:{color:"teal.500",description:"Control info passed between nodes.",title:"Control Polymorphic"},DenoiseMaskField:{color:"blue.300",description:Z("nodes.denoiseMaskFieldDescription"),title:Z("nodes.denoiseMaskField")},enum:{color:"blue.500",description:Z("nodes.enumDescription"),title:Z("nodes.enum")},float:{color:"orange.500",description:Z("nodes.floatDescription"),title:Z("nodes.float")},FloatCollection:{color:"orange.500",description:Z("nodes.floatCollectionDescription"),title:Z("nodes.floatCollection")},FloatPolymorphic:{color:"orange.500",description:Z("nodes.floatPolymorphicDescription"),title:Z("nodes.floatPolymorphic")},ImageCollection:{color:"purple.500",description:Z("nodes.imageCollectionDescription"),title:Z("nodes.imageCollection")},ImageField:{color:"purple.500",description:Z("nodes.imageFieldDescription"),title:Z("nodes.imageField")},BoardField:{color:"purple.500",description:Z("nodes.imageFieldDescription"),title:Z("nodes.imageField")},ImagePolymorphic:{color:"purple.500",description:Z("nodes.imagePolymorphicDescription"),title:Z("nodes.imagePolymorphic")},integer:{color:"red.500",description:Z("nodes.integerDescription"),title:Z("nodes.integer")},IntegerCollection:{color:"red.500",description:Z("nodes.integerCollectionDescription"),title:Z("nodes.integerCollection")},IntegerPolymorphic:{color:"red.500",description:Z("nodes.integerPolymorphicDescription"),title:Z("nodes.integerPolymorphic")},IPAdapterField:{color:"green.300",description:"IP-Adapter info passed between nodes.",title:"IP-Adapter"},IPAdapterModelField:{color:"teal.500",description:"IP-Adapter model",title:"IP-Adapter Model"},LatentsCollection:{color:"pink.500",description:Z("nodes.latentsCollectionDescription"),title:Z("nodes.latentsCollection")},LatentsField:{color:"pink.500",description:Z("nodes.latentsFieldDescription"),title:Z("nodes.latentsField")},LatentsPolymorphic:{color:"pink.500",description:Z("nodes.latentsPolymorphicDescription"),title:Z("nodes.latentsPolymorphic")},LoRAModelField:{color:"teal.500",description:Z("nodes.loRAModelFieldDescription"),title:Z("nodes.loRAModelField")},MainModelField:{color:"teal.500",description:Z("nodes.mainModelFieldDescription"),title:Z("nodes.mainModelField")},ONNXModelField:{color:"teal.500",description:Z("nodes.oNNXModelFieldDescription"),title:Z("nodes.oNNXModelField")},Scheduler:{color:"base.500",description:Z("nodes.schedulerDescription"),title:Z("nodes.scheduler")},SDXLMainModelField:{color:"teal.500",description:Z("nodes.sDXLMainModelFieldDescription"),title:Z("nodes.sDXLMainModelField")},SDXLRefinerModelField:{color:"teal.500",description:Z("nodes.sDXLRefinerModelFieldDescription"),title:Z("nodes.sDXLRefinerModelField")},string:{color:"yellow.500",description:Z("nodes.stringDescription"),title:Z("nodes.string")},StringCollection:{color:"yellow.500",description:Z("nodes.stringCollectionDescription"),title:Z("nodes.stringCollection")},StringPolymorphic:{color:"yellow.500",description:Z("nodes.stringPolymorphicDescription"),title:Z("nodes.stringPolymorphic")},UNetField:{color:"red.500",description:Z("nodes.uNetFieldDescription"),title:Z("nodes.uNetField")},VaeField:{color:"blue.500",description:Z("nodes.vaeFieldDescription"),title:Z("nodes.vaeField")},VaeModelField:{color:"teal.500",description:Z("nodes.vaeModelFieldDescription"),title:Z("nodes.vaeModelField")}},N9=(e,t,n)=>{let r=t,i=n;for(;e.find(o=>o.position.x===r&&o.position.y===i);)r=r+50,i=i+50;return{x:r,y:i}},iSe=(e,t)=>{if(e==="Collection"&&t==="Collection")return!1;if(e===t)return!0;const n=e==="CollectionItem"&&!Lv.includes(t),r=t==="CollectionItem"&&!Lv.includes(e)&&!xg.includes(e),i=xg.includes(t)&&(()=>{if(!xg.includes(t))return!1;const u=nSe[t],c=fA[u];return e===u||e===c})(),o=e==="Collection"&&(Lv.includes(t)||xg.includes(t)),a=t==="Collection"&&Lv.includes(e);return n||r||i||o||a||e==="integer"&&t==="float"||(e==="integer"||e==="float")&&t==="string"};var oSe="\0",Oc="\0",$9="",yo,ld,zo,F0,Th,Ah,fa,Cs,Tu,Es,Au,Sl,xl,Ph,Ih,wl,Ua,B0,LE,DN;let aSe=(DN=class{constructor(t){Yn(this,B0);Yn(this,yo,!0);Yn(this,ld,!1);Yn(this,zo,!1);Yn(this,F0,void 0);Yn(this,Th,()=>{});Yn(this,Ah,()=>{});Yn(this,fa,{});Yn(this,Cs,{});Yn(this,Tu,{});Yn(this,Es,{});Yn(this,Au,{});Yn(this,Sl,{});Yn(this,xl,{});Yn(this,Ph,0);Yn(this,Ih,0);Yn(this,wl,void 0);Yn(this,Ua,void 0);t&&(oa(this,yo,t.hasOwnProperty("directed")?t.directed:!0),oa(this,ld,t.hasOwnProperty("multigraph")?t.multigraph:!1),oa(this,zo,t.hasOwnProperty("compound")?t.compound:!1)),ae(this,zo)&&(oa(this,wl,{}),oa(this,Ua,{}),ae(this,Ua)[Oc]={})}isDirected(){return ae(this,yo)}isMultigraph(){return ae(this,ld)}isCompound(){return ae(this,zo)}setGraph(t){return oa(this,F0,t),this}graph(){return ae(this,F0)}setDefaultNodeLabel(t){return oa(this,Th,t),typeof t!="function"&&oa(this,Th,()=>t),this}nodeCount(){return ae(this,Ph)}nodes(){return Object.keys(ae(this,fa))}sources(){var t=this;return this.nodes().filter(n=>Object.keys(ae(t,Cs)[n]).length===0)}sinks(){var t=this;return this.nodes().filter(n=>Object.keys(ae(t,Es)[n]).length===0)}setNodes(t,n){var r=arguments,i=this;return t.forEach(function(o){r.length>1?i.setNode(o,n):i.setNode(o)}),this}setNode(t,n){return ae(this,fa).hasOwnProperty(t)?(arguments.length>1&&(ae(this,fa)[t]=n),this):(ae(this,fa)[t]=arguments.length>1?n:ae(this,Th).call(this,t),ae(this,zo)&&(ae(this,wl)[t]=Oc,ae(this,Ua)[t]={},ae(this,Ua)[Oc][t]=!0),ae(this,Cs)[t]={},ae(this,Tu)[t]={},ae(this,Es)[t]={},ae(this,Au)[t]={},++Op(this,Ph)._,this)}node(t){return ae(this,fa)[t]}hasNode(t){return ae(this,fa).hasOwnProperty(t)}removeNode(t){var n=this;if(ae(this,fa).hasOwnProperty(t)){var r=i=>n.removeEdge(ae(n,Sl)[i]);delete ae(this,fa)[t],ae(this,zo)&&(ps(this,B0,LE).call(this,t),delete ae(this,wl)[t],this.children(t).forEach(function(i){n.setParent(i)}),delete ae(this,Ua)[t]),Object.keys(ae(this,Cs)[t]).forEach(r),delete ae(this,Cs)[t],delete ae(this,Tu)[t],Object.keys(ae(this,Es)[t]).forEach(r),delete ae(this,Es)[t],delete ae(this,Au)[t],--Op(this,Ph)._}return this}setParent(t,n){if(!ae(this,zo))throw new Error("Cannot set parent in a non-compound graph");if(n===void 0)n=Oc;else{n+="";for(var r=n;r!==void 0;r=this.parent(r))if(r===t)throw new Error("Setting "+n+" as parent of "+t+" would create a cycle");this.setNode(n)}return this.setNode(t),ps(this,B0,LE).call(this,t),ae(this,wl)[t]=n,ae(this,Ua)[n][t]=!0,this}parent(t){if(ae(this,zo)){var n=ae(this,wl)[t];if(n!==Oc)return n}}children(t=Oc){if(ae(this,zo)){var n=ae(this,Ua)[t];if(n)return Object.keys(n)}else{if(t===Oc)return this.nodes();if(this.hasNode(t))return[]}}predecessors(t){var n=ae(this,Tu)[t];if(n)return Object.keys(n)}successors(t){var n=ae(this,Au)[t];if(n)return Object.keys(n)}neighbors(t){var n=this.predecessors(t);if(n){const i=new Set(n);for(var r of this.successors(t))i.add(r);return Array.from(i.values())}}isLeaf(t){var n;return this.isDirected()?n=this.successors(t):n=this.neighbors(t),n.length===0}filterNodes(t){var n=new this.constructor({directed:ae(this,yo),multigraph:ae(this,ld),compound:ae(this,zo)});n.setGraph(this.graph());var r=this;Object.entries(ae(this,fa)).forEach(function([a,s]){t(a)&&n.setNode(a,s)}),Object.values(ae(this,Sl)).forEach(function(a){n.hasNode(a.v)&&n.hasNode(a.w)&&n.setEdge(a,r.edge(a))});var i={};function o(a){var s=r.parent(a);return s===void 0||n.hasNode(s)?(i[a]=s,s):s in i?i[s]:o(s)}return ae(this,zo)&&n.nodes().forEach(a=>n.setParent(a,o(a))),n}setDefaultEdgeLabel(t){return oa(this,Ah,t),typeof t!="function"&&oa(this,Ah,()=>t),this}edgeCount(){return ae(this,Ih)}edges(){return Object.values(ae(this,Sl))}setPath(t,n){var r=this,i=arguments;return t.reduce(function(o,a){return i.length>1?r.setEdge(o,a,n):r.setEdge(o,a),a}),this}setEdge(){var t,n,r,i,o=!1,a=arguments[0];typeof a=="object"&&a!==null&&"v"in a?(t=a.v,n=a.w,r=a.name,arguments.length===2&&(i=arguments[1],o=!0)):(t=a,n=arguments[1],r=arguments[3],arguments.length>2&&(i=arguments[2],o=!0)),t=""+t,n=""+n,r!==void 0&&(r=""+r);var s=wg(ae(this,yo),t,n,r);if(ae(this,xl).hasOwnProperty(s))return o&&(ae(this,xl)[s]=i),this;if(r!==void 0&&!ae(this,ld))throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(t),this.setNode(n),ae(this,xl)[s]=o?i:ae(this,Ah).call(this,t,n,r);var l=sSe(ae(this,yo),t,n,r);return t=l.v,n=l.w,Object.freeze(l),ae(this,Sl)[s]=l,D9(ae(this,Tu)[n],t),D9(ae(this,Au)[t],n),ae(this,Cs)[n][s]=l,ae(this,Es)[t][s]=l,Op(this,Ih)._++,this}edge(t,n,r){var i=arguments.length===1?jC(ae(this,yo),arguments[0]):wg(ae(this,yo),t,n,r);return ae(this,xl)[i]}edgeAsObj(){const t=this.edge(...arguments);return typeof t!="object"?{label:t}:t}hasEdge(t,n,r){var i=arguments.length===1?jC(ae(this,yo),arguments[0]):wg(ae(this,yo),t,n,r);return ae(this,xl).hasOwnProperty(i)}removeEdge(t,n,r){var i=arguments.length===1?jC(ae(this,yo),arguments[0]):wg(ae(this,yo),t,n,r),o=ae(this,Sl)[i];return o&&(t=o.v,n=o.w,delete ae(this,xl)[i],delete ae(this,Sl)[i],L9(ae(this,Tu)[n],t),L9(ae(this,Au)[t],n),delete ae(this,Cs)[n][i],delete ae(this,Es)[t][i],Op(this,Ih)._--),this}inEdges(t,n){var r=ae(this,Cs)[t];if(r){var i=Object.values(r);return n?i.filter(o=>o.v===n):i}}outEdges(t,n){var r=ae(this,Es)[t];if(r){var i=Object.values(r);return n?i.filter(o=>o.w===n):i}}nodeEdges(t,n){var r=this.inEdges(t,n);if(r)return r.concat(this.outEdges(t,n))}},yo=new WeakMap,ld=new WeakMap,zo=new WeakMap,F0=new WeakMap,Th=new WeakMap,Ah=new WeakMap,fa=new WeakMap,Cs=new WeakMap,Tu=new WeakMap,Es=new WeakMap,Au=new WeakMap,Sl=new WeakMap,xl=new WeakMap,Ph=new WeakMap,Ih=new WeakMap,wl=new WeakMap,Ua=new WeakMap,B0=new WeakSet,LE=function(t){delete ae(this,Ua)[ae(this,wl)[t]][t]},DN);function D9(e,t){e[t]?e[t]++:e[t]=1}function L9(e,t){--e[t]||delete e[t]}function wg(e,t,n,r){var i=""+t,o=""+n;if(!e&&i>o){var a=i;i=o,o=a}return i+$9+o+$9+(r===void 0?oSe:r)}function sSe(e,t,n,r){var i=""+t,o=""+n;if(!e&&i>o){var a=i;i=o,o=a}var s={v:i,w:o};return r&&(s.name=r),s}function jC(e,t){return wg(e,t.v,t.w,t.name)}var hA=aSe,lSe="2.1.13",uSe={Graph:hA,version:lSe},cSe=hA,dSe={write:fSe,read:gSe};function fSe(e){var t={options:{directed:e.isDirected(),multigraph:e.isMultigraph(),compound:e.isCompound()},nodes:hSe(e),edges:pSe(e)};return e.graph()!==void 0&&(t.value=structuredClone(e.graph())),t}function hSe(e){return e.nodes().map(function(t){var n=e.node(t),r=e.parent(t),i={v:t};return n!==void 0&&(i.value=n),r!==void 0&&(i.parent=r),i})}function pSe(e){return e.edges().map(function(t){var n=e.edge(t),r={v:t.v,w:t.w};return t.name!==void 0&&(r.name=t.name),n!==void 0&&(r.value=n),r})}function gSe(e){var t=new cSe(e.options).setGraph(e.value);return e.nodes.forEach(function(n){t.setNode(n.v,n.value),n.parent&&t.setParent(n.v,n.parent)}),e.edges.forEach(function(n){t.setEdge({v:n.v,w:n.w,name:n.name},n.value)}),t}var mSe=ySe;function ySe(e){var t={},n=[],r;function i(o){t.hasOwnProperty(o)||(t[o]=!0,r.push(o),e.successors(o).forEach(i),e.predecessors(o).forEach(i))}return e.nodes().forEach(function(o){r=[],i(o),r.length&&n.push(r)}),n}var zi,Cl,z0,FE,j0,BE,Rh,U1,LN;let vSe=(LN=class{constructor(){Yn(this,z0);Yn(this,j0);Yn(this,Rh);Yn(this,zi,[]);Yn(this,Cl,{})}size(){return ae(this,zi).length}keys(){return ae(this,zi).map(function(t){return t.key})}has(t){return ae(this,Cl).hasOwnProperty(t)}priority(t){var n=ae(this,Cl)[t];if(n!==void 0)return ae(this,zi)[n].priority}min(){if(this.size()===0)throw new Error("Queue underflow");return ae(this,zi)[0].key}add(t,n){var r=ae(this,Cl);if(t=String(t),!r.hasOwnProperty(t)){var i=ae(this,zi),o=i.length;return r[t]=o,i.push({key:t,priority:n}),ps(this,j0,BE).call(this,o),!0}return!1}removeMin(){ps(this,Rh,U1).call(this,0,ae(this,zi).length-1);var t=ae(this,zi).pop();return delete ae(this,Cl)[t.key],ps(this,z0,FE).call(this,0),t.key}decrease(t,n){var r=ae(this,Cl)[t];if(n>ae(this,zi)[r].priority)throw new Error("New priority is greater than current priority. Key: "+t+" Old: "+ae(this,zi)[r].priority+" New: "+n);ae(this,zi)[r].priority=n,ps(this,j0,BE).call(this,r)}},zi=new WeakMap,Cl=new WeakMap,z0=new WeakSet,FE=function(t){var n=ae(this,zi),r=2*t,i=r+1,o=t;r>1,!(n[i].priority1;function SSe(e,t,n,r){return xSe(e,String(t),n||_Se,r||function(i){return e.outEdges(i)})}function xSe(e,t,n,r){var i={},o=new bSe,a,s,l=function(u){var c=u.v!==a?u.v:u.w,d=i[c],f=n(u),h=s.distance+f;if(f<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+u+" Weight: "+f);h0&&(a=o.removeMin(),s=i[a],s.distance!==Number.POSITIVE_INFINITY);)r(a).forEach(l);return i}var wSe=DV,CSe=ESe;function ESe(e,t,n){return e.nodes().reduce(function(r,i){return r[i]=wSe(e,i,t,n),r},{})}var LV=kSe;function kSe(e){var t=0,n=[],r={},i=[];function o(a){var s=r[a]={onStack:!0,lowlink:t,index:t++};if(n.push(a),e.successors(a).forEach(function(c){r.hasOwnProperty(c)?r[c].onStack&&(s.lowlink=Math.min(s.lowlink,r[c].index)):(o(c),s.lowlink=Math.min(s.lowlink,r[c].lowlink))}),s.lowlink===s.index){var l=[],u;do u=n.pop(),r[u].onStack=!1,l.push(u);while(a!==u);i.push(l)}}return e.nodes().forEach(function(a){r.hasOwnProperty(a)||o(a)}),i}var TSe=LV,ASe=PSe;function PSe(e){return TSe(e).filter(function(t){return t.length>1||t.length===1&&e.hasEdge(t[0],t[0])})}var ISe=OSe,RSe=()=>1;function OSe(e,t,n){return MSe(e,t||RSe,n||function(r){return e.outEdges(r)})}function MSe(e,t,n){var r={},i=e.nodes();return i.forEach(function(o){r[o]={},r[o][o]={distance:0},i.forEach(function(a){o!==a&&(r[o][a]={distance:Number.POSITIVE_INFINITY})}),n(o).forEach(function(a){var s=a.v===o?a.w:a.v,l=t(a);r[o][s]={distance:l,predecessor:o}})}),i.forEach(function(o){var a=r[o];i.forEach(function(s){var l=r[s];i.forEach(function(u){var c=l[o],d=a[u],f=l[u],h=c.distance+d.distance;he.successors(s):s=>e.neighbors(s),i=n==="post"?LSe:FSe,o=[],a={};return t.forEach(s=>{if(!e.hasNode(s))throw new Error("Graph does not have node: "+s);i(s,r,a,o)}),o}function LSe(e,t,n,r){for(var i=[[e,!1]];i.length>0;){var o=i.pop();o[1]?r.push(o[0]):n.hasOwnProperty(o[0])||(n[o[0]]=!0,i.push([o[0],!0]),jV(t(o[0]),a=>i.push([a,!1])))}}function FSe(e,t,n,r){for(var i=[e];i.length>0;){var o=i.pop();n.hasOwnProperty(o)||(n[o]=!0,r.push(o),jV(t(o),a=>i.push(a)))}}function jV(e,t){for(var n=e.length;n--;)t(e[n],n,e);return e}var BSe=zV,zSe=jSe;function jSe(e,t){return BSe(e,t,"post")}var USe=zV,VSe=GSe;function GSe(e,t){return USe(e,t,"pre")}var HSe=hA,qSe=$V,WSe=KSe;function KSe(e,t){var n=new HSe,r={},i=new qSe,o;function a(l){var u=l.v===o?l.w:l.v,c=i.priority(u);if(c!==void 0){var d=t(l);d0;){if(o=i.removeMin(),r.hasOwnProperty(o))n.setEdge(o,r[o]);else{if(s)throw new Error("Input graph is not connected: "+e);s=!0}e.nodeEdges(o).forEach(a)}return n}var QSe={components:mSe,dijkstra:DV,dijkstraAll:CSe,findCycles:ASe,floydWarshall:ISe,isAcyclic:NSe,postorder:zSe,preorder:VSe,prim:WSe,tarjan:LV,topsort:BV},B9=uSe,XSe={Graph:B9.Graph,json:dSe,alg:QSe,version:B9.version};const z9=pc(XSe),j9=(e,t,n,r)=>{const i=new z9.Graph;return n.forEach(o=>{i.setNode(o.id)}),r.forEach(o=>{i.setEdge(o.source,o.target)}),i.setEdge(e,t),z9.alg.isAcyclic(i)},U9=(e,t,n,r,i)=>{let o=!0;return t==="source"?e.find(a=>a.target===r.id&&a.targetHandle===i.name)&&(o=!1):e.find(a=>a.source===r.id&&a.sourceHandle===i.name)&&(o=!1),iSe(n,i.type)||(o=!1),o},V9=(e,t,n,r,i,o,a)=>{if(e.id===r)return null;const s=o=="source"?e.data.inputs:e.data.outputs;if(s[i]){const l=s[i],u=o=="source"?r:e.id,c=o=="source"?e.id:r,d=o=="source"?i:l.name,f=o=="source"?l.name:i,h=j9(u,c,t,n),p=U9(n,o,a,e,l);if(h&&p)return{source:u,sourceHandle:d,target:c,targetHandle:f}}for(const l in s){const u=s[l],c=o=="source"?r:e.id,d=o=="source"?e.id:r,f=o=="source"?i:u.name,h=o=="source"?u.name:i,p=j9(c,d,t,n),m=U9(n,o,a,e,u);if(p&&m)return{source:c,sourceHandle:f,target:d,targetHandle:h}}return null},YSe="1.0.0",UC={status:Hc.PENDING,error:null,progress:null,progressImage:null,outputs:[]},jE={meta:{version:YSe},name:"",author:"",description:"",notes:"",tags:"",contact:"",version:"",exposedFields:[]},UV={nodes:[],edges:[],nodeTemplates:{},isReady:!1,connectionStartParams:null,currentConnectionFieldType:null,connectionMade:!1,modifyingEdge:!1,addNewNodePosition:null,shouldShowFieldTypeLegend:!1,shouldShowMinimapPanel:!0,shouldValidateGraph:!0,shouldAnimateEdges:!0,shouldSnapToGrid:!1,shouldColorEdges:!0,isAddNodePopoverOpen:!1,nodeOpacity:1,selectedNodes:[],selectedEdges:[],workflow:jE,nodeExecutionStates:{},viewport:{x:0,y:0,zoom:1},mouseOverField:null,mouseOverNode:null,nodesToCopy:[],edgesToCopy:[],selectionMode:sc.Partial},go=(e,t)=>{var l,u;const{nodeId:n,fieldName:r,value:i}=t.payload,o=e.nodes.findIndex(c=>c.id===n),a=(l=e.nodes)==null?void 0:l[o];if(!jr(a))return;const s=(u=a.data)==null?void 0:u.inputs[r];s&&o>-1&&(s.value=i)},VV=nr({name:"nodes",initialState:UV,reducers:{nodesChanged:(e,t)=>{e.nodes=Uc(t.payload,e.nodes)},nodeAdded:(e,t)=>{var i,o;const n=t.payload,r=N9(e.nodes,((i=e.addNewNodePosition)==null?void 0:i.x)??n.position.x,((o=e.addNewNodePosition)==null?void 0:o.y)??n.position.y);if(n.position=r,n.selected=!0,e.nodes=Uc(e.nodes.map(a=>({id:a.id,type:"select",selected:!1})),e.nodes),e.edges=Rc(e.edges.map(a=>({id:a.id,type:"select",selected:!1})),e.edges),e.nodes.push(n),!!jr(n)){if(e.nodeExecutionStates[n.id]={nodeId:n.id,...UC},e.connectionStartParams){const{nodeId:a,handleId:s,handleType:l}=e.connectionStartParams;if(a&&s&&l&&e.currentConnectionFieldType){const u=V9(n,e.nodes,e.edges,a,s,l,e.currentConnectionFieldType);u&&(e.edges=Sg({...u,type:"default"},e.edges))}}e.connectionStartParams=null,e.currentConnectionFieldType=null}},edgeChangeStarted:e=>{e.modifyingEdge=!0},edgesChanged:(e,t)=>{e.edges=Rc(t.payload,e.edges)},edgeAdded:(e,t)=>{e.edges=Sg(t.payload,e.edges)},edgeUpdated:(e,t)=>{const{oldEdge:n,newConnection:r}=t.payload;e.edges=Cbe(n,r,e.edges)},connectionStarted:(e,t)=>{var l;e.connectionStartParams=t.payload,e.connectionMade=e.modifyingEdge;const{nodeId:n,handleId:r,handleType:i}=t.payload;if(!n||!r)return;const o=e.nodes.findIndex(u=>u.id===n),a=(l=e.nodes)==null?void 0:l[o];if(!jr(a))return;const s=i==="source"?a.data.outputs[r]:a.data.inputs[r];e.currentConnectionFieldType=(s==null?void 0:s.type)??null},connectionMade:(e,t)=>{e.currentConnectionFieldType&&(e.edges=Sg({...t.payload,type:"default"},e.edges),e.connectionMade=!0)},connectionEnded:(e,t)=>{var n;if(e.connectionMade)e.connectionStartParams=null,e.currentConnectionFieldType=null;else if(e.mouseOverNode){const r=e.nodes.findIndex(o=>o.id===e.mouseOverNode),i=(n=e.nodes)==null?void 0:n[r];if(i&&e.connectionStartParams){const{nodeId:o,handleId:a,handleType:s}=e.connectionStartParams;if(o&&a&&s&&e.currentConnectionFieldType){const l=V9(i,e.nodes,e.edges,o,a,s,e.currentConnectionFieldType);l&&(e.edges=Sg({...l,type:"default"},e.edges))}}e.connectionStartParams=null,e.currentConnectionFieldType=null}else e.addNewNodePosition=t.payload.cursorPosition,e.isAddNodePopoverOpen=!0;e.modifyingEdge=!1},workflowExposedFieldAdded:(e,t)=>{e.workflow.exposedFields=K8(e.workflow.exposedFields.concat(t.payload),n=>`${n.nodeId}-${n.fieldName}`)},workflowExposedFieldRemoved:(e,t)=>{e.workflow.exposedFields=e.workflow.exposedFields.filter(n=>!cT(n,t.payload))},fieldLabelChanged:(e,t)=>{const{nodeId:n,fieldName:r,label:i}=t.payload,o=e.nodes.find(s=>s.id===n);if(!jr(o))return;const a=o.data.inputs[r];a&&(a.label=i)},nodeEmbedWorkflowChanged:(e,t)=>{var a;const{nodeId:n,embedWorkflow:r}=t.payload,i=e.nodes.findIndex(s=>s.id===n),o=(a=e.nodes)==null?void 0:a[i];jr(o)&&(o.data.embedWorkflow=r)},nodeUseCacheChanged:(e,t)=>{var a;const{nodeId:n,useCache:r}=t.payload,i=e.nodes.findIndex(s=>s.id===n),o=(a=e.nodes)==null?void 0:a[i];jr(o)&&(o.data.useCache=r)},nodeIsIntermediateChanged:(e,t)=>{var a;const{nodeId:n,isIntermediate:r}=t.payload,i=e.nodes.findIndex(s=>s.id===n),o=(a=e.nodes)==null?void 0:a[i];jr(o)&&(o.data.isIntermediate=r)},nodeIsOpenChanged:(e,t)=>{var s;const{nodeId:n,isOpen:r}=t.payload,i=e.nodes.findIndex(l=>l.id===n),o=(s=e.nodes)==null?void 0:s[i];if(!jr(o)&&!pI(o)||(o.data.isOpen=r,!jr(o)))return;const a=lA([o],e.edges);if(r)a.forEach(l=>{delete l.hidden}),a.forEach(l=>{l.type==="collapsed"&&(e.edges=e.edges.filter(u=>u.id!==l.id))});else{const l=xbe(o,e.nodes,e.edges).filter(d=>jr(d)&&d.data.isOpen===!1),u=Sbe(o,e.nodes,e.edges).filter(d=>jr(d)&&d.data.isOpen===!1),c=[];a.forEach(d=>{var f,h;if(d.target===n&&l.find(p=>p.id===d.source)){d.hidden=!0;const p=c.find(m=>m.source===d.source&&m.target===d.target);p?p.data={count:(((f=p.data)==null?void 0:f.count)??0)+1}:c.push({id:`${d.source}-${d.target}-collapsed`,source:d.source,target:d.target,type:"collapsed",data:{count:1},updatable:!1})}if(d.source===n&&u.find(p=>p.id===d.target)){const p=c.find(m=>m.source===d.source&&m.target===d.target);d.hidden=!0,p?p.data={count:(((h=p.data)==null?void 0:h.count)??0)+1}:c.push({id:`${d.source}-${d.target}-collapsed`,source:d.source,target:d.target,type:"collapsed",data:{count:1},updatable:!1})}}),c.length&&(e.edges=Rc(c.map(d=>({type:"add",item:d})),e.edges))}},edgeDeleted:(e,t)=>{e.edges=e.edges.filter(n=>n.id!==t.payload)},edgesDeleted:(e,t)=>{const r=t.payload.filter(i=>i.type==="collapsed");if(r.length){const i=[];r.forEach(o=>{e.edges.forEach(a=>{a.source===o.source&&a.target===o.target&&i.push({id:a.id,type:"remove"})})}),e.edges=Rc(i,e.edges)}},nodesDeleted:(e,t)=>{t.payload.forEach(n=>{e.workflow.exposedFields=e.workflow.exposedFields.filter(r=>r.nodeId!==n.id),jr(n)&&delete e.nodeExecutionStates[n.id]})},nodeLabelChanged:(e,t)=>{var a;const{nodeId:n,label:r}=t.payload,i=e.nodes.findIndex(s=>s.id===n),o=(a=e.nodes)==null?void 0:a[i];jr(o)&&(o.data.label=r)},nodeNotesChanged:(e,t)=>{var a;const{nodeId:n,notes:r}=t.payload,i=e.nodes.findIndex(s=>s.id===n),o=(a=e.nodes)==null?void 0:a[i];jr(o)&&(o.data.notes=r)},nodeExclusivelySelected:(e,t)=>{const n=t.payload;e.nodes=Uc(e.nodes.map(r=>({id:r.id,type:"select",selected:r.id===n})),e.nodes)},selectedNodesChanged:(e,t)=>{e.selectedNodes=t.payload},selectedEdgesChanged:(e,t)=>{e.selectedEdges=t.payload},fieldStringValueChanged:(e,t)=>{go(e,t)},fieldNumberValueChanged:(e,t)=>{go(e,t)},fieldBooleanValueChanged:(e,t)=>{go(e,t)},fieldBoardValueChanged:(e,t)=>{go(e,t)},fieldImageValueChanged:(e,t)=>{go(e,t)},fieldColorValueChanged:(e,t)=>{go(e,t)},fieldMainModelValueChanged:(e,t)=>{go(e,t)},fieldRefinerModelValueChanged:(e,t)=>{go(e,t)},fieldVaeModelValueChanged:(e,t)=>{go(e,t)},fieldLoRAModelValueChanged:(e,t)=>{go(e,t)},fieldControlNetModelValueChanged:(e,t)=>{go(e,t)},fieldIPAdapterModelValueChanged:(e,t)=>{go(e,t)},fieldEnumModelValueChanged:(e,t)=>{go(e,t)},fieldSchedulerValueChanged:(e,t)=>{go(e,t)},imageCollectionFieldValueChanged:(e,t)=>{var u,c;const{nodeId:n,fieldName:r,value:i}=t.payload,o=e.nodes.findIndex(d=>d.id===n);if(o===-1)return;const a=(u=e.nodes)==null?void 0:u[o];if(!jr(a))return;const s=(c=a.data)==null?void 0:c.inputs[r];if(!s)return;const l=wn(s.value);if(!l){s.value=i;return}s.value=K8(l.concat(i),"image_name")},notesNodeValueChanged:(e,t)=>{var a;const{nodeId:n,value:r}=t.payload,i=e.nodes.findIndex(s=>s.id===n),o=(a=e.nodes)==null?void 0:a[i];pI(o)&&(o.data.notes=r)},shouldShowFieldTypeLegendChanged:(e,t)=>{e.shouldShowFieldTypeLegend=t.payload},shouldShowMinimapPanelChanged:(e,t)=>{e.shouldShowMinimapPanel=t.payload},nodeTemplatesBuilt:(e,t)=>{e.nodeTemplates=t.payload,e.isReady=!0},nodeEditorReset:e=>{e.nodes=[],e.edges=[],e.workflow=wn(jE)},shouldValidateGraphChanged:(e,t)=>{e.shouldValidateGraph=t.payload},shouldAnimateEdgesChanged:(e,t)=>{e.shouldAnimateEdges=t.payload},shouldSnapToGridChanged:(e,t)=>{e.shouldSnapToGrid=t.payload},shouldColorEdgesChanged:(e,t)=>{e.shouldColorEdges=t.payload},nodeOpacityChanged:(e,t)=>{e.nodeOpacity=t.payload},workflowNameChanged:(e,t)=>{e.workflow.name=t.payload},workflowDescriptionChanged:(e,t)=>{e.workflow.description=t.payload},workflowTagsChanged:(e,t)=>{e.workflow.tags=t.payload},workflowAuthorChanged:(e,t)=>{e.workflow.author=t.payload},workflowNotesChanged:(e,t)=>{e.workflow.notes=t.payload},workflowVersionChanged:(e,t)=>{e.workflow.version=t.payload},workflowContactChanged:(e,t)=>{e.workflow.contact=t.payload},workflowLoaded:(e,t)=>{const{nodes:n,edges:r,...i}=t.payload;e.workflow=i,e.nodes=Uc(n.map(o=>({item:{...o,dragHandle:`.${eSe}`},type:"add"})),[]),e.edges=Rc(r.map(o=>({item:o,type:"add"})),[]),e.nodeExecutionStates=n.reduce((o,a)=>(o[a.id]={nodeId:a.id,...UC},o),{})},workflowReset:e=>{e.workflow=wn(jE)},viewportChanged:(e,t)=>{e.viewport=t.payload},mouseOverFieldChanged:(e,t)=>{e.mouseOverField=t.payload},mouseOverNodeChanged:(e,t)=>{e.mouseOverNode=t.payload},selectedAll:e=>{e.nodes=Uc(e.nodes.map(t=>({id:t.id,type:"select",selected:!0})),e.nodes),e.edges=Rc(e.edges.map(t=>({id:t.id,type:"select",selected:!0})),e.edges)},selectionCopied:e=>{if(e.nodesToCopy=e.nodes.filter(t=>t.selected).map(wn),e.edgesToCopy=e.edges.filter(t=>t.selected).map(wn),e.nodesToCopy.length>0){const t={x:0,y:0};e.nodesToCopy.forEach(n=>{const r=.15*(n.width??0),i=.5*(n.height??0);t.x+=n.position.x+r,t.y+=n.position.y+i}),t.x/=e.nodesToCopy.length,t.y/=e.nodesToCopy.length,e.nodesToCopy.forEach(n=>{n.position.x-=t.x,n.position.y-=t.y})}},selectionPasted:(e,t)=>{const{cursorPosition:n}=t.payload,r=e.nodesToCopy.map(wn),i=r.map(c=>c.data.id),o=e.edgesToCopy.filter(c=>i.includes(c.source)&&i.includes(c.target)).map(wn);o.forEach(c=>c.selected=!0),r.forEach(c=>{const d=MV();o.forEach(h=>{h.source===c.data.id&&(h.source=d,h.id=h.id.replace(c.data.id,d)),h.target===c.data.id&&(h.target=d,h.id=h.id.replace(c.data.id,d))}),c.selected=!0,c.id=d,c.data.id=d;const f=N9(e.nodes,c.position.x+((n==null?void 0:n.x)??0),c.position.y+((n==null?void 0:n.y)??0));c.position=f});const a=r.map(c=>({item:c,type:"add"})),s=e.nodes.map(c=>({id:c.data.id,type:"select",selected:!1})),l=o.map(c=>({item:c,type:"add"})),u=e.edges.map(c=>({id:c.id,type:"select",selected:!1}));e.nodes=Uc(a.concat(s),e.nodes),e.edges=Rc(l.concat(u),e.edges),r.forEach(c=>{e.nodeExecutionStates[c.id]={nodeId:c.id,...UC}})},addNodePopoverOpened:e=>{e.addNewNodePosition=null,e.isAddNodePopoverOpen=!0},addNodePopoverClosed:e=>{e.isAddNodePopoverOpen=!1,e.connectionStartParams=null,e.currentConnectionFieldType=null},addNodePopoverToggled:e=>{e.isAddNodePopoverOpen=!e.isAddNodePopoverOpen},selectionModeChanged:(e,t)=>{e.selectionMode=t.payload?sc.Full:sc.Partial}},extraReducers:e=>{e.addCase(g0.pending,t=>{t.isReady=!1}),e.addCase(zT,(t,n)=>{const{source_node_id:r}=n.payload.data,i=t.nodeExecutionStates[r];i&&(i.status=Hc.IN_PROGRESS)}),e.addCase(UT,(t,n)=>{const{source_node_id:r,result:i}=n.payload.data,o=t.nodeExecutionStates[r];o&&(o.status=Hc.COMPLETED,o.progress!==null&&(o.progress=1),o.outputs.push(i))}),e.addCase(U2,(t,n)=>{const{source_node_id:r}=n.payload.data,i=t.nodeExecutionStates[r];i&&(i.status=Hc.FAILED,i.error=n.payload.data.error,i.progress=null,i.progressImage=null)}),e.addCase(VT,(t,n)=>{const{source_node_id:r,step:i,total_steps:o,progress_image:a}=n.payload.data,s=t.nodeExecutionStates[r];s&&(s.status=Hc.IN_PROGRESS,s.progress=(i+1)/o,s.progressImage=a??null)}),e.addCase(GT,(t,n)=>{["in_progress"].includes(n.payload.data.status)&&Ca(t.nodeExecutionStates,r=>{r.status=Hc.PENDING,r.error=null,r.progress=null,r.progressImage=null,r.outputs=[]})})}}),{addNodePopoverClosed:AHe,addNodePopoverOpened:PHe,addNodePopoverToggled:IHe,connectionEnded:RHe,connectionMade:OHe,connectionStarted:MHe,edgeDeleted:NHe,edgeChangeStarted:$He,edgesChanged:DHe,edgesDeleted:LHe,edgeUpdated:FHe,fieldBoardValueChanged:BHe,fieldBooleanValueChanged:zHe,fieldColorValueChanged:jHe,fieldControlNetModelValueChanged:UHe,fieldEnumModelValueChanged:VHe,fieldImageValueChanged:X2,fieldIPAdapterModelValueChanged:GHe,fieldLabelChanged:HHe,fieldLoRAModelValueChanged:qHe,fieldMainModelValueChanged:WHe,fieldNumberValueChanged:KHe,fieldRefinerModelValueChanged:QHe,fieldSchedulerValueChanged:XHe,fieldStringValueChanged:YHe,fieldVaeModelValueChanged:ZHe,imageCollectionFieldValueChanged:JHe,mouseOverFieldChanged:eqe,mouseOverNodeChanged:tqe,nodeAdded:nqe,nodeEditorReset:ZSe,nodeEmbedWorkflowChanged:rqe,nodeExclusivelySelected:iqe,nodeIsIntermediateChanged:oqe,nodeIsOpenChanged:aqe,nodeLabelChanged:sqe,nodeNotesChanged:lqe,nodeOpacityChanged:uqe,nodesChanged:cqe,nodesDeleted:dqe,nodeTemplatesBuilt:GV,nodeUseCacheChanged:fqe,notesNodeValueChanged:hqe,selectedAll:pqe,selectedEdgesChanged:gqe,selectedNodesChanged:mqe,selectionCopied:yqe,selectionModeChanged:vqe,selectionPasted:bqe,shouldAnimateEdgesChanged:_qe,shouldColorEdgesChanged:Sqe,shouldShowFieldTypeLegendChanged:xqe,shouldShowMinimapPanelChanged:wqe,shouldSnapToGridChanged:Cqe,shouldValidateGraphChanged:Eqe,viewportChanged:kqe,workflowAuthorChanged:Tqe,workflowContactChanged:Aqe,workflowDescriptionChanged:Pqe,workflowExposedFieldAdded:JSe,workflowExposedFieldRemoved:Iqe,workflowLoaded:e2e,workflowNameChanged:Rqe,workflowNotesChanged:Oqe,workflowTagsChanged:Mqe,workflowVersionChanged:Nqe,edgeAdded:$qe}=VV.actions,t2e=VV.reducer,HV={esrganModelName:"RealESRGAN_x4plus.pth"},qV=nr({name:"postprocessing",initialState:HV,reducers:{esrganModelNameChanged:(e,t)=>{e.esrganModelName=t.payload}}}),{esrganModelNameChanged:Dqe}=qV.actions,n2e=qV.reducer,WV={positiveStylePrompt:"",negativeStylePrompt:"",shouldConcatSDXLStylePrompt:!0,shouldUseSDXLRefiner:!1,sdxlImg2ImgDenoisingStrength:.7,refinerModel:null,refinerSteps:20,refinerCFGScale:7.5,refinerScheduler:"euler",refinerPositiveAestheticScore:6,refinerNegativeAestheticScore:2.5,refinerStart:.8},KV=nr({name:"sdxl",initialState:WV,reducers:{setPositiveStylePromptSDXL:(e,t)=>{e.positiveStylePrompt=t.payload},setNegativeStylePromptSDXL:(e,t)=>{e.negativeStylePrompt=t.payload},setShouldConcatSDXLStylePrompt:(e,t)=>{e.shouldConcatSDXLStylePrompt=t.payload},setShouldUseSDXLRefiner:(e,t)=>{e.shouldUseSDXLRefiner=t.payload},setSDXLImg2ImgDenoisingStrength:(e,t)=>{e.sdxlImg2ImgDenoisingStrength=t.payload},refinerModelChanged:(e,t)=>{e.refinerModel=t.payload},setRefinerSteps:(e,t)=>{e.refinerSteps=t.payload},setRefinerCFGScale:(e,t)=>{e.refinerCFGScale=t.payload},setRefinerScheduler:(e,t)=>{e.refinerScheduler=t.payload},setRefinerPositiveAestheticScore:(e,t)=>{e.refinerPositiveAestheticScore=t.payload},setRefinerNegativeAestheticScore:(e,t)=>{e.refinerNegativeAestheticScore=t.payload},setRefinerStart:(e,t)=>{e.refinerStart=t.payload}}}),{setPositiveStylePromptSDXL:Lqe,setNegativeStylePromptSDXL:Fqe,setShouldConcatSDXLStylePrompt:Bqe,setShouldUseSDXLRefiner:r2e,setSDXLImg2ImgDenoisingStrength:zqe,refinerModelChanged:G9,setRefinerSteps:jqe,setRefinerCFGScale:Uqe,setRefinerScheduler:Vqe,setRefinerPositiveAestheticScore:Gqe,setRefinerNegativeAestheticScore:Hqe,setRefinerStart:qqe}=KV.actions,i2e=KV.reducer,o2e=(e,t,n)=>t===0?0:n===2?Math.floor((e+1+1)/2)/Math.floor((t+1)/2):(e+1+1)/(t+1),$d=e=>typeof e=="string"?{title:e,status:"info",isClosable:!0,duration:2500}:{status:"info",isClosable:!0,duration:2500,...e},QV={isInitialized:!1,isConnected:!1,shouldConfirmOnDelete:!0,enableImageDebugging:!1,toastQueue:[],denoiseProgress:null,shouldAntialiasProgressImage:!1,consoleLogLevel:"debug",shouldLogToConsole:!0,language:"en",shouldUseNSFWChecker:!1,shouldUseWatermarker:!1,shouldEnableInformationalPopovers:!1,status:"DISCONNECTED"},XV=nr({name:"system",initialState:QV,reducers:{setShouldConfirmOnDelete:(e,t)=>{e.shouldConfirmOnDelete=t.payload},setEnableImageDebugging:(e,t)=>{e.enableImageDebugging=t.payload},addToast:(e,t)=>{e.toastQueue.push(t.payload)},clearToastQueue:e=>{e.toastQueue=[]},consoleLogLevelChanged:(e,t)=>{e.consoleLogLevel=t.payload},shouldLogToConsoleChanged:(e,t)=>{e.shouldLogToConsole=t.payload},shouldAntialiasProgressImageChanged:(e,t)=>{e.shouldAntialiasProgressImage=t.payload},languageChanged:(e,t)=>{e.language=t.payload},shouldUseNSFWCheckerChanged(e,t){e.shouldUseNSFWChecker=t.payload},shouldUseWatermarkerChanged(e,t){e.shouldUseWatermarker=t.payload},setShouldEnableInformationalPopovers(e,t){e.shouldEnableInformationalPopovers=t.payload},isInitializedChanged(e,t){e.isInitialized=t.payload}},extraReducers(e){e.addCase(BT,t=>{t.isConnected=!0,t.denoiseProgress=null,t.status="CONNECTED"}),e.addCase(Bj,t=>{t.isConnected=!1,t.denoiseProgress=null,t.status="DISCONNECTED"}),e.addCase(zT,t=>{t.denoiseProgress=null,t.status="PROCESSING"}),e.addCase(VT,(t,n)=>{const{step:r,total_steps:i,order:o,progress_image:a,graph_execution_state_id:s,queue_batch_id:l}=n.payload.data;t.denoiseProgress={step:r,total_steps:i,order:o,percentage:o2e(r,i,o),progress_image:a,session_id:s,batch_id:l},t.status="PROCESSING"}),e.addCase(UT,t=>{t.denoiseProgress=null,t.status="CONNECTED"}),e.addCase(Vj,t=>{t.denoiseProgress=null,t.status="CONNECTED"}),e.addCase(qj,t=>{t.status="LOADING_MODEL"}),e.addCase(Kj,t=>{t.status="CONNECTED"}),e.addCase(GT,(t,n)=>{["completed","canceled","failed"].includes(n.payload.data.status)&&(t.status="CONNECTED",t.denoiseProgress=null)}),e.addMatcher(c2e,(t,n)=>{t.toastQueue.push($d({title:Z("toast.serverError"),status:"error",description:Sae(n.payload.data.error_type)}))})}}),{setShouldConfirmOnDelete:Wqe,setEnableImageDebugging:Kqe,addToast:Gt,clearToastQueue:Qqe,consoleLogLevelChanged:Xqe,shouldLogToConsoleChanged:Yqe,shouldAntialiasProgressImageChanged:Zqe,languageChanged:Jqe,shouldUseNSFWCheckerChanged:a2e,shouldUseWatermarkerChanged:s2e,setShouldEnableInformationalPopovers:eWe,isInitializedChanged:l2e}=XV.actions,u2e=XV.reducer,c2e=No(U2,Xj,Zj),d2e={listCursor:void 0,listPriority:void 0,selectedQueueItem:void 0,resumeProcessorOnEnqueue:!0},f2e=d2e,YV=nr({name:"queue",initialState:f2e,reducers:{listCursorChanged:(e,t)=>{e.listCursor=t.payload},listPriorityChanged:(e,t)=>{e.listPriority=t.payload},listParamsReset:e=>{e.listCursor=void 0,e.listPriority=void 0},queueItemSelectionToggled:(e,t)=>{e.selectedQueueItem===t.payload?e.selectedQueueItem=void 0:e.selectedQueueItem=t.payload},resumeProcessorOnEnqueueChanged:(e,t)=>{e.resumeProcessorOnEnqueue=t.payload}}}),{listCursorChanged:tWe,listPriorityChanged:nWe,listParamsReset:h2e,queueItemSelectionToggled:rWe,resumeProcessorOnEnqueueChanged:iWe}=YV.actions,p2e=YV.reducer,g2e={searchFolder:null,advancedAddScanModel:null},ZV=nr({name:"modelmanager",initialState:g2e,reducers:{setSearchFolder:(e,t)=>{e.searchFolder=t.payload},setAdvancedAddScanModel:(e,t)=>{e.advancedAddScanModel=t.payload}}}),{setSearchFolder:oWe,setAdvancedAddScanModel:aWe}=ZV.actions,m2e=ZV.reducer,JV={shift:!1,ctrl:!1,meta:!1},eG=nr({name:"hotkeys",initialState:JV,reducers:{shiftKeyPressed:(e,t)=>{e.shift=t.payload},ctrlKeyPressed:(e,t)=>{e.ctrl=t.payload},metaKeyPressed:(e,t)=>{e.meta=t.payload}}}),{shiftKeyPressed:sWe,ctrlKeyPressed:lWe,metaKeyPressed:uWe}=eG.actions,y2e=eG.reducer,tG={activeTab:"txt2img",shouldShowImageDetails:!1,shouldUseCanvasBetaLayout:!1,shouldShowExistingModelsInSearch:!1,shouldUseSliders:!1,shouldHidePreview:!1,shouldShowProgressInViewer:!0,shouldShowEmbeddingPicker:!1,shouldAutoChangeDimensions:!1,favoriteSchedulers:[],globalContextMenuCloseTrigger:0,panels:{}},nG=nr({name:"ui",initialState:tG,reducers:{setActiveTab:(e,t)=>{e.activeTab=t.payload},setShouldShowImageDetails:(e,t)=>{e.shouldShowImageDetails=t.payload},setShouldUseCanvasBetaLayout:(e,t)=>{e.shouldUseCanvasBetaLayout=t.payload},setShouldHidePreview:(e,t)=>{e.shouldHidePreview=t.payload},setShouldShowExistingModelsInSearch:(e,t)=>{e.shouldShowExistingModelsInSearch=t.payload},setShouldUseSliders:(e,t)=>{e.shouldUseSliders=t.payload},setShouldShowProgressInViewer:(e,t)=>{e.shouldShowProgressInViewer=t.payload},favoriteSchedulersChanged:(e,t)=>{e.favoriteSchedulers=t.payload},toggleEmbeddingPicker:e=>{e.shouldShowEmbeddingPicker=!e.shouldShowEmbeddingPicker},setShouldAutoChangeDimensions:(e,t)=>{e.shouldAutoChangeDimensions=t.payload},contextMenusClosed:e=>{e.globalContextMenuCloseTrigger+=1},panelsChanged:(e,t)=>{e.panels[t.payload.name]=t.payload.value}},extraReducers(e){e.addCase(XS,t=>{t.activeTab="img2img"})}}),{setActiveTab:rG,setShouldShowImageDetails:cWe,setShouldUseCanvasBetaLayout:dWe,setShouldShowExistingModelsInSearch:fWe,setShouldUseSliders:hWe,setShouldHidePreview:pWe,setShouldShowProgressInViewer:gWe,favoriteSchedulersChanged:mWe,toggleEmbeddingPicker:yWe,setShouldAutoChangeDimensions:vWe,contextMenusClosed:bWe,panelsChanged:_We}=nG.actions,v2e=nG.reducer,b2e=dS(NY);iG=UE=void 0;var _2e=b2e,S2e=function(){var t=[],n=[],r=void 0,i=function(u){return r=u,function(c){return function(d){return _2e.compose.apply(void 0,n)(c)(d)}}},o=function(){for(var u,c,d=arguments.length,f=Array(d),h=0;h=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(u){throw u},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var o=!0,a=!1,s;return{s:function(){n=n.call(e)},n:function(){var u=n.next();return o=u.done,u},e:function(u){a=!0,s=u},f:function(){try{!o&&n.return!=null&&n.return()}finally{if(a)throw s}}}}function aG(e,t){if(e){if(typeof e=="string")return q9(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return q9(e,t)}}function q9(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=arguments.length>2?arguments[2]:void 0,i=r.prefix,o=r.driver,a=r.persistWholeStore,s=r.serialize;try{var l=a?$2e:D2e;yield l(t,n,{prefix:i,driver:o,serialize:s})}catch(u){console.warn("redux-remember: persist error",u)}});return function(){return e.apply(this,arguments)}}();function X9(e,t,n,r,i,o,a){try{var s=e[o](a),l=s.value}catch(u){n(u);return}s.done?t(l):Promise.resolve(l).then(r,i)}function Y9(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function a(l){X9(o,r,i,a,s,"next",l)}function s(l){X9(o,r,i,a,s,"throw",l)}a(void 0)})}}var F2e=function(){var e=Y9(function*(t,n,r){var i=r.prefix,o=r.driver,a=r.serialize,s=r.unserialize,l=r.persistThrottle,u=r.persistDebounce,c=r.persistWholeStore;yield I2e(t,n,{prefix:i,driver:o,unserialize:s,persistWholeStore:c});var d={},f=function(){var h=Y9(function*(){var p=oG(t.getState(),n);yield L2e(p,d,{prefix:i,driver:o,serialize:a,persistWholeStore:c}),gA(p,d)||t.dispatch({type:E2e,payload:p}),d=p});return function(){return h.apply(this,arguments)}}();u&&u>0?t.subscribe(T2e(f,u)):t.subscribe(k2e(f,l))});return function(n,r,i){return e.apply(this,arguments)}}();const B2e=F2e;function m0(e){"@babel/helpers - typeof";return m0=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},m0(e)}function Z9(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function HC(e){for(var t=1;t0&&arguments[0]!==void 0?arguments[0]:n.state,i=arguments.length>1?arguments[1]:void 0;i.type&&(i.type==="@@INIT"||i.type.startsWith("@@redux/INIT"))&&(n.state=HC({},r));var o=typeof t=="function"?t:hp(t);switch(i.type){case VE:{var a=HC(HC({},n.state),i.payload||{});return n.state=o(a,{type:VE,payload:a}),n.state}default:return o(r,i)}}},G2e=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},i=r.prefix,o=i===void 0?"@@remember-":i,a=r.serialize,s=a===void 0?function(_,b){return JSON.stringify(_)}:a,l=r.unserialize,u=l===void 0?function(_,b){return JSON.parse(_)}:l,c=r.persistThrottle,d=c===void 0?100:c,f=r.persistDebounce,h=r.persistWholeStore,p=h===void 0?!1:h;if(!t)throw Error("redux-remember error: driver required");if(!Array.isArray(n))throw Error("redux-remember error: rememberedKeys needs to be an array");var m=function(b){return function(v,g,y){var S=b(v,g,y);return B2e(S,n,{driver:t,prefix:o,serialize:s,unserialize:u,persistThrottle:d,persistDebounce:f,persistWholeStore:p}),S}};return m};const SWe=["chakra-ui-color-mode","i18nextLng","ROARR_FILTER","ROARR_LOG"],H2e="@@invokeai-",q2e=["cursorPosition"],W2e=["pendingControlImages"],K2e=["prompts"],Q2e=["selection","selectedBoardId","galleryView"],X2e=["nodeTemplates","connectionStartParams","currentConnectionFieldType","selectedNodes","selectedEdges","isReady","nodesToCopy","edgesToCopy","connectionMade","modifyingEdge","addNewNodePosition"],Y2e=[],Z2e=[],J2e=["isInitialized","isConnected","denoiseProgress","status"],exe=["shouldShowImageDetails","globalContextMenuCloseTrigger","panels"],txe={canvas:q2e,gallery:Q2e,generation:Y2e,nodes:X2e,postprocessing:Z2e,system:J2e,ui:exe,controlNet:W2e,dynamicPrompts:K2e},nxe=(e,t)=>{const n=qS(e,txe[t]??[]);return JSON.stringify(n)},rxe={canvas:wB,gallery:lU,generation:hT,nodes:UV,postprocessing:HV,system:QV,config:lB,ui:tG,hotkeys:JV,controlNet:_E,dynamicPrompts:KT,sdxl:WV},ixe=(e,t)=>goe(JSON.parse(e),rxe[t]),oxe=Ne("nodes/textToImageGraphBuilt"),axe=Ne("nodes/imageToImageGraphBuilt"),lG=Ne("nodes/canvasGraphBuilt"),sxe=Ne("nodes/nodesGraphBuilt"),lxe=No(oxe,axe,lG,sxe),uxe=Ne("nodes/workflowLoadRequested"),cxe=e=>{if(lxe(e)&&e.payload.nodes){const t={};return{...e,payload:{...e.payload,nodes:t}}}return g0.fulfilled.match(e)?{...e,payload:""}:GV.match(e)?{...e,payload:""}:e},dxe=["canvas/setCursorPosition","canvas/setStageCoordinates","canvas/setStageScale","canvas/setIsDrawing","canvas/setBoundingBoxCoordinates","canvas/setBoundingBoxDimensions","canvas/setIsDrawing","canvas/addPointToCurrentLine","socket/socketGeneratorProgress","socket/appSocketGeneratorProgress","@@REMEMBER_PERSISTED"],fxe=e=>e,uG="default",Ur=tl(uG),hxe=e=>{const t=e?Kg.stringify(e,{arrayFormat:"none"}):void 0;return t?`queue/${Ur.get()}/list?${t}`:`queue/${Ur.get()}/list`},qc=Js({selectId:e=>e.item_id,sortComparer:(e,t)=>e.priority>t.priority?-1:e.priorityt.item_id?1:0}),Qr=ls.injectEndpoints({endpoints:e=>({enqueueBatch:e.mutation({query:t=>({url:`queue/${Ur.get()}/enqueue_batch`,body:t,method:"POST"}),invalidatesTags:["SessionQueueStatus","CurrentSessionQueueItem","NextSessionQueueItem"],onQueryStarted:async(t,n)=>{const{dispatch:r,queryFulfilled:i}=n;try{await i,Zp(r)}catch{}}}),enqueueGraph:e.mutation({query:t=>({url:`queue/${Ur.get()}/enqueue_graph`,body:t,method:"POST"}),invalidatesTags:["SessionQueueStatus","CurrentSessionQueueItem","NextSessionQueueItem"],onQueryStarted:async(t,n)=>{const{dispatch:r,queryFulfilled:i}=n;try{await i,Zp(r)}catch{}}}),resumeProcessor:e.mutation({query:()=>({url:`queue/${Ur.get()}/processor/resume`,method:"PUT"}),invalidatesTags:["CurrentSessionQueueItem","SessionQueueStatus"]}),pauseProcessor:e.mutation({query:()=>({url:`queue/${Ur.get()}/processor/pause`,method:"PUT"}),invalidatesTags:["CurrentSessionQueueItem","SessionQueueStatus"]}),pruneQueue:e.mutation({query:()=>({url:`queue/${Ur.get()}/prune`,method:"PUT"}),invalidatesTags:["SessionQueueStatus","BatchStatus","SessionQueueItem","SessionQueueItemDTO"],onQueryStarted:async(t,n)=>{const{dispatch:r,queryFulfilled:i}=n;try{await i,Zp(r)}catch{}}}),clearQueue:e.mutation({query:()=>({url:`queue/${Ur.get()}/clear`,method:"PUT"}),invalidatesTags:["SessionQueueStatus","SessionProcessorStatus","BatchStatus","CurrentSessionQueueItem","NextSessionQueueItem","SessionQueueItem","SessionQueueItemDTO"],onQueryStarted:async(t,n)=>{const{dispatch:r,queryFulfilled:i}=n;try{await i,Zp(r)}catch{}}}),getCurrentQueueItem:e.query({query:()=>({url:`queue/${Ur.get()}/current`,method:"GET"}),providesTags:t=>{const n=["CurrentSessionQueueItem"];return t&&n.push({type:"SessionQueueItem",id:t.item_id}),n}}),getNextQueueItem:e.query({query:()=>({url:`queue/${Ur.get()}/next`,method:"GET"}),providesTags:t=>{const n=["NextSessionQueueItem"];return t&&n.push({type:"SessionQueueItem",id:t.item_id}),n}}),getQueueStatus:e.query({query:()=>({url:`queue/${Ur.get()}/status`,method:"GET"}),providesTags:["SessionQueueStatus"]}),getBatchStatus:e.query({query:({batch_id:t})=>({url:`queue/${Ur.get()}/b/${t}/status`,method:"GET"}),providesTags:t=>t?[{type:"BatchStatus",id:t.batch_id}]:[]}),getQueueItem:e.query({query:t=>({url:`queue/${Ur.get()}/i/${t}`,method:"GET"}),providesTags:t=>t?[{type:"SessionQueueItem",id:t.item_id}]:[]}),cancelQueueItem:e.mutation({query:t=>({url:`queue/${Ur.get()}/i/${t}/cancel`,method:"PUT"}),onQueryStarted:async(t,{dispatch:n,queryFulfilled:r})=>{try{const{data:i}=await r;n(Qr.util.updateQueryData("listQueueItems",void 0,o=>{qc.updateOne(o,{id:t,changes:{status:i.status}})}))}catch{}},invalidatesTags:t=>t?[{type:"SessionQueueItem",id:t.item_id},{type:"SessionQueueItemDTO",id:t.item_id},{type:"BatchStatus",id:t.batch_id}]:[]}),cancelByBatchIds:e.mutation({query:t=>({url:`queue/${Ur.get()}/cancel_by_batch_ids`,method:"PUT",body:t}),onQueryStarted:async(t,n)=>{const{dispatch:r,queryFulfilled:i}=n;try{await i,Zp(r)}catch{}},invalidatesTags:["SessionQueueItem","SessionQueueItemDTO","BatchStatus"]}),listQueueItems:e.query({query:t=>({url:hxe(t),method:"GET"}),serializeQueryArgs:()=>`queue/${Ur.get()}/list`,transformResponse:t=>qc.addMany(qc.getInitialState({has_more:t.has_more}),t.items),merge:(t,n)=>{qc.addMany(t,qc.getSelectors().selectAll(n)),t.has_more=n.has_more},forceRefetch:({currentArg:t,previousArg:n})=>t!==n,keepUnusedDataFor:60*5})})}),{useCancelByBatchIdsMutation:xWe,useEnqueueGraphMutation:wWe,useEnqueueBatchMutation:CWe,usePauseProcessorMutation:EWe,useResumeProcessorMutation:kWe,useClearQueueMutation:TWe,usePruneQueueMutation:AWe,useGetCurrentQueueItemQuery:PWe,useGetQueueStatusQuery:IWe,useGetQueueItemQuery:RWe,useGetNextQueueItemQuery:OWe,useListQueueItemsQuery:MWe,useCancelQueueItemMutation:NWe,useGetBatchStatusQuery:$We}=Qr,Zp=e=>{e(Qr.util.updateQueryData("listQueueItems",void 0,t=>{qc.removeAll(t),t.has_more=!1})),e(h2e()),e(Qr.endpoints.listQueueItems.initiate(void 0))},pxe=No(ole,ale),gxe=()=>{Be({matcher:pxe,effect:async(e,{dispatch:t,getState:n})=>{const r=Ce("canvas"),i=n(),{batchIds:o}=i.canvas;try{const a=t(Qr.endpoints.cancelByBatchIds.initiate({batch_ids:o},{fixedCacheKey:"cancelByBatchIds"})),{canceled:s}=await a.unwrap();a.reset(),s>0&&(r.debug(`Canceled ${s} canvas batches`),t(Gt({title:Z("queue.cancelBatchSucceeded"),status:"success"}))),t(cle())}catch{r.error("Failed to cancel canvas batches"),t(Gt({title:Z("queue.cancelBatchFailed"),status:"error"}))}}})};Ne("app/appStarted");const mxe=()=>{Be({matcher:me.endpoints.listImages.matchFulfilled,effect:async(e,{dispatch:t,unsubscribe:n,cancelActiveListeners:r})=>{if(e.meta.arg.queryCacheKey!==Bo({board_id:"none",categories:ii}))return;r(),n();const i=e.payload;if(i.ids.length>0){const o=Vn.getSelectors().selectAll(i)[0];t(Us(o??null))}}})},yxe=No(Qr.endpoints.enqueueBatch.matchFulfilled,Qr.endpoints.enqueueGraph.matchFulfilled),vxe=()=>{Be({matcher:yxe,effect:async(e,{dispatch:t,getState:n})=>{const{data:r}=Qr.endpoints.getQueueStatus.select()(n());!r||r.processor.is_started||t(Qr.endpoints.resumeProcessor.initiate(void 0,{fixedCacheKey:"resumeProcessor"}))}})},cG=ls.injectEndpoints({endpoints:e=>({getAppVersion:e.query({query:()=>({url:"app/version",method:"GET"}),providesTags:["AppVersion"],keepUnusedDataFor:864e5}),getAppConfig:e.query({query:()=>({url:"app/config",method:"GET"}),providesTags:["AppConfig"],keepUnusedDataFor:864e5}),getInvocationCacheStatus:e.query({query:()=>({url:"app/invocation_cache/status",method:"GET"}),providesTags:["InvocationCacheStatus"]}),clearInvocationCache:e.mutation({query:()=>({url:"app/invocation_cache",method:"DELETE"}),invalidatesTags:["InvocationCacheStatus"]}),enableInvocationCache:e.mutation({query:()=>({url:"app/invocation_cache/enable",method:"PUT"}),invalidatesTags:["InvocationCacheStatus"]}),disableInvocationCache:e.mutation({query:()=>({url:"app/invocation_cache/disable",method:"PUT"}),invalidatesTags:["InvocationCacheStatus"]})})}),{useGetAppVersionQuery:DWe,useGetAppConfigQuery:LWe,useClearInvocationCacheMutation:FWe,useDisableInvocationCacheMutation:BWe,useEnableInvocationCacheMutation:zWe,useGetInvocationCacheStatusQuery:jWe}=cG,bxe=()=>{Be({matcher:cG.endpoints.getAppConfig.matchFulfilled,effect:async(e,{getState:t,dispatch:n})=>{const{infill_methods:r=[],nsfw_methods:i=[],watermarking_methods:o=[]}=e.payload,a=t().generation.infillMethod;r.includes(a)||n(Xse(r[0])),i.includes("nsfw_checker")||n(a2e(!1)),o.includes("invisible_watermark")||n(s2e(!1))}})},_xe=Ne("app/appStarted"),Sxe=()=>{Be({actionCreator:_xe,effect:async(e,{unsubscribe:t,cancelActiveListeners:n})=>{n(),t()}})},Z2={memoizeOptions:{resultEqualityCheck:cT}},dG=(e,t)=>{var f;const{generation:n,canvas:r,nodes:i,controlNet:o}=e,a=((f=n.initialImage)==null?void 0:f.imageName)===t,s=r.layerState.objects.some(h=>h.kind==="image"&&h.imageName===t),l=i.nodes.filter(jr).some(h=>Vg(h.data.inputs,p=>{var m;return p.type==="ImageField"&&((m=p.value)==null?void 0:m.image_name)===t})),u=Vg(o.controlNets,h=>h.controlImage===t||h.processedControlImage===t),c=o.ipAdapterInfo.adapterImage===t;return{isInitialImage:a,isCanvasImage:s,isNodesImage:l,isControlNetImage:u,isIPAdapterImage:c}},xxe=Ii([e=>e],e=>{const{imagesToDelete:t}=e.deleteImageModal;return t.length?t.map(r=>dG(e,r.image_name)):[]},Z2),wxe=()=>{Be({matcher:me.endpoints.deleteBoardAndImages.matchFulfilled,effect:async(e,{dispatch:t,getState:n})=>{const{deleted_images:r}=e.payload;let i=!1,o=!1,a=!1,s=!1,l=!1;const u=n();r.forEach(c=>{const d=dG(u,c);d.isInitialImage&&!i&&(t(pT()),i=!0),d.isCanvasImage&&!o&&(t(gT()),o=!0),d.isNodesImage&&!a&&(t(ZSe()),a=!0),d.isControlNetImage&&!s&&(t(s0e()),s=!0),d.isIPAdapterImage&&!l&&(t(oU()),l=!0)})}})},Cxe=()=>{Be({matcher:No(w_,SE),effect:async(e,{getState:t,dispatch:n,condition:r,cancelActiveListeners:i})=>{i();const o=t(),a=w_.match(e)?e.payload.boardId:o.gallery.selectedBoardId,l=(SE.match(e)?e.payload:o.gallery.galleryView)==="images"?ii:Mu,u={board_id:a??"none",categories:l};if(await r(()=>me.endpoints.listImages.select(u)(t()).isSuccess,5e3)){const{data:d}=me.endpoints.listImages.select(u)(t());if(d){const f=s0.selectAll(d)[0],h=s0.selectById(d,e.payload.selectedImageName);n(Us(h||f||null))}else n(Us(null))}else n(Us(null))}})},Exe=Ne("canvas/canvasSavedToGallery"),kxe=Ne("canvas/canvasMaskSavedToGallery"),Txe=Ne("canvas/canvasCopiedToClipboard"),Axe=Ne("canvas/canvasDownloadedAsImage"),Pxe=Ne("canvas/canvasMerged"),Ixe=Ne("canvas/stagingAreaImageSaved"),Rxe=Ne("canvas/canvasMaskToControlNet"),Oxe=Ne("canvas/canvasImageToControlNet");let fG=null,hG=null;const UWe=e=>{fG=e},J2=()=>fG,VWe=e=>{hG=e},Mxe=()=>hG,Nxe=async e=>new Promise((t,n)=>{e.toBlob(r=>{if(r){t(r);return}n("Unable to create Blob")})}),$_=async(e,t)=>await Nxe(e.toCanvas(t)),ex=async(e,t=!1)=>{const n=J2();if(!n)throw new Error("Problem getting base layer blob");const{shouldCropToBoundingBoxOnSave:r,boundingBoxCoordinates:i,boundingBoxDimensions:o}=e.canvas,a=n.clone();a.scale({x:1,y:1});const s=a.getAbsolutePosition(),l=r||t?{x:i.x+s.x,y:i.y+s.y,width:o.width,height:o.height}:a.getClientRect();return $_(a,l)},$xe=(e,t="image/png")=>{navigator.clipboard.write([new ClipboardItem({[t]:e})])},Dxe=()=>{Be({actionCreator:Txe,effect:async(e,{dispatch:t,getState:n})=>{const r=_2.get().child({namespace:"canvasCopiedToClipboardListener"}),i=n();try{const o=ex(i);$xe(o)}catch(o){r.error(String(o)),t(Gt({title:Z("toast.problemCopyingCanvas"),description:Z("toast.problemCopyingCanvasDesc"),status:"error"}));return}t(Gt({title:Z("toast.canvasCopiedClipboard"),status:"success"}))}})},Lxe=(e,t)=>{const n=URL.createObjectURL(e),r=document.createElement("a");r.href=n,r.download=t,document.body.appendChild(r),r.click(),document.body.removeChild(r),r.remove()},Fxe=()=>{Be({actionCreator:Axe,effect:async(e,{dispatch:t,getState:n})=>{const r=_2.get().child({namespace:"canvasSavedToGalleryListener"}),i=n();let o;try{o=await ex(i)}catch(a){r.error(String(a)),t(Gt({title:Z("toast.problemDownloadingCanvas"),description:Z("toast.problemDownloadingCanvasDesc"),status:"error"}));return}Lxe(o,"canvas.png"),t(Gt({title:Z("toast.canvasDownloaded"),status:"success"}))}})},Bxe=()=>{Be({actionCreator:Oxe,effect:async(e,{dispatch:t,getState:n})=>{const r=Ce("canvas"),i=n();let o;try{o=await ex(i,!0)}catch(u){r.error(String(u)),t(Gt({title:Z("toast.problemSavingCanvas"),description:Z("toast.problemSavingCanvasDesc"),status:"error"}));return}const{autoAddBoardId:a}=i.gallery,s=await t(me.endpoints.uploadImage.initiate({file:new File([o],"savedCanvas.png",{type:"image/png"}),image_category:"control",is_intermediate:!1,board_id:a==="none"?void 0:a,crop_visible:!1,postUploadAction:{type:"TOAST",toastOptions:{title:Z("toast.canvasSentControlnetAssets")}}})).unwrap(),{image_name:l}=s;t(Sc({controlNetId:e.payload.controlNet.controlNetId,controlImage:l}))}})};var mA={exports:{}},tx={},pG={},Rt={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e._registerNode=e.Konva=e.glob=void 0;var t=Math.PI/180;function n(){return typeof window<"u"&&({}.toString.call(window)==="[object Window]"||{}.toString.call(window)==="[object global]")}e.glob=typeof mt<"u"?mt:typeof window<"u"?window:typeof WorkerGlobalScope<"u"?self:{},e.Konva={_global:e.glob,version:"9.2.0",isBrowser:n(),isUnminified:/param/.test((function(i){}).toString()),dblClickWindow:400,getAngle(i){return e.Konva.angleDeg?i*t:i},enableTrace:!1,pointerEventsEnabled:!0,autoDrawEnabled:!0,hitOnDragEnabled:!1,capturePointerEventsEnabled:!1,_mouseListenClick:!1,_touchListenClick:!1,_pointerListenClick:!1,_mouseInDblClickWindow:!1,_touchInDblClickWindow:!1,_pointerInDblClickWindow:!1,_mouseDblClickPointerId:null,_touchDblClickPointerId:null,_pointerDblClickPointerId:null,pixelRatio:typeof window<"u"&&window.devicePixelRatio||1,dragDistance:3,angleDeg:!0,showWarnings:!0,dragButtons:[0,1],isDragging(){return e.Konva.DD.isDragging},isDragReady(){return!!e.Konva.DD.node},releaseCanvasOnDestroy:!0,document:e.glob.document,_injectGlobal(i){e.glob.Konva=i}};const r=i=>{e.Konva[i.prototype.getClassName()]=i};e._registerNode=r,e.Konva._injectGlobal(e.Konva)})(Rt);var dr={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.Util=e.Transform=void 0;const t=Rt;class n{constructor(y=[1,0,0,1,0,0]){this.dirty=!1,this.m=y&&y.slice()||[1,0,0,1,0,0]}reset(){this.m[0]=1,this.m[1]=0,this.m[2]=0,this.m[3]=1,this.m[4]=0,this.m[5]=0}copy(){return new n(this.m)}copyInto(y){y.m[0]=this.m[0],y.m[1]=this.m[1],y.m[2]=this.m[2],y.m[3]=this.m[3],y.m[4]=this.m[4],y.m[5]=this.m[5]}point(y){var S=this.m;return{x:S[0]*y.x+S[2]*y.y+S[4],y:S[1]*y.x+S[3]*y.y+S[5]}}translate(y,S){return this.m[4]+=this.m[0]*y+this.m[2]*S,this.m[5]+=this.m[1]*y+this.m[3]*S,this}scale(y,S){return this.m[0]*=y,this.m[1]*=y,this.m[2]*=S,this.m[3]*=S,this}rotate(y){var S=Math.cos(y),w=Math.sin(y),x=this.m[0]*S+this.m[2]*w,C=this.m[1]*S+this.m[3]*w,T=this.m[0]*-w+this.m[2]*S,k=this.m[1]*-w+this.m[3]*S;return this.m[0]=x,this.m[1]=C,this.m[2]=T,this.m[3]=k,this}getTranslation(){return{x:this.m[4],y:this.m[5]}}skew(y,S){var w=this.m[0]+this.m[2]*S,x=this.m[1]+this.m[3]*S,C=this.m[2]+this.m[0]*y,T=this.m[3]+this.m[1]*y;return this.m[0]=w,this.m[1]=x,this.m[2]=C,this.m[3]=T,this}multiply(y){var S=this.m[0]*y.m[0]+this.m[2]*y.m[1],w=this.m[1]*y.m[0]+this.m[3]*y.m[1],x=this.m[0]*y.m[2]+this.m[2]*y.m[3],C=this.m[1]*y.m[2]+this.m[3]*y.m[3],T=this.m[0]*y.m[4]+this.m[2]*y.m[5]+this.m[4],k=this.m[1]*y.m[4]+this.m[3]*y.m[5]+this.m[5];return this.m[0]=S,this.m[1]=w,this.m[2]=x,this.m[3]=C,this.m[4]=T,this.m[5]=k,this}invert(){var y=1/(this.m[0]*this.m[3]-this.m[1]*this.m[2]),S=this.m[3]*y,w=-this.m[1]*y,x=-this.m[2]*y,C=this.m[0]*y,T=y*(this.m[2]*this.m[5]-this.m[3]*this.m[4]),k=y*(this.m[1]*this.m[4]-this.m[0]*this.m[5]);return this.m[0]=S,this.m[1]=w,this.m[2]=x,this.m[3]=C,this.m[4]=T,this.m[5]=k,this}getMatrix(){return this.m}decompose(){var y=this.m[0],S=this.m[1],w=this.m[2],x=this.m[3],C=this.m[4],T=this.m[5],k=y*x-S*w;let P={x:C,y:T,rotation:0,scaleX:0,scaleY:0,skewX:0,skewY:0};if(y!=0||S!=0){var $=Math.sqrt(y*y+S*S);P.rotation=S>0?Math.acos(y/$):-Math.acos(y/$),P.scaleX=$,P.scaleY=k/$,P.skewX=(y*w+S*x)/k,P.skewY=0}else if(w!=0||x!=0){var O=Math.sqrt(w*w+x*x);P.rotation=Math.PI/2-(x>0?Math.acos(-w/O):-Math.acos(w/O)),P.scaleX=k/O,P.scaleY=O,P.skewX=0,P.skewY=(y*w+S*x)/k}return P.rotation=e.Util._getRotation(P.rotation),P}}e.Transform=n;var r="[object Array]",i="[object Number]",o="[object String]",a="[object Boolean]",s=Math.PI/180,l=180/Math.PI,u="#",c="",d="0",f="Konva warning: ",h="Konva error: ",p="rgb(",m={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,132,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,255,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,203],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[119,128,144],slategrey:[119,128,144],snow:[255,255,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],transparent:[255,255,255,0],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,5]},_=/rgb\((\d{1,3}),(\d{1,3}),(\d{1,3})\)/,b=[];const v=typeof requestAnimationFrame<"u"&&requestAnimationFrame||function(g){setTimeout(g,60)};e.Util={_isElement(g){return!!(g&&g.nodeType==1)},_isFunction(g){return!!(g&&g.constructor&&g.call&&g.apply)},_isPlainObject(g){return!!g&&g.constructor===Object},_isArray(g){return Object.prototype.toString.call(g)===r},_isNumber(g){return Object.prototype.toString.call(g)===i&&!isNaN(g)&&isFinite(g)},_isString(g){return Object.prototype.toString.call(g)===o},_isBoolean(g){return Object.prototype.toString.call(g)===a},isObject(g){return g instanceof Object},isValidSelector(g){if(typeof g!="string")return!1;var y=g[0];return y==="#"||y==="."||y===y.toUpperCase()},_sign(g){return g===0||g>0?1:-1},requestAnimFrame(g){b.push(g),b.length===1&&v(function(){const y=b;b=[],y.forEach(function(S){S()})})},createCanvasElement(){var g=document.createElement("canvas");try{g.style=g.style||{}}catch{}return g},createImageElement(){return document.createElement("img")},_isInDocument(g){for(;g=g.parentNode;)if(g==document)return!0;return!1},_urlToImage(g,y){var S=e.Util.createImageElement();S.onload=function(){y(S)},S.src=g},_rgbToHex(g,y,S){return((1<<24)+(g<<16)+(y<<8)+S).toString(16).slice(1)},_hexToRgb(g){g=g.replace(u,c);var y=parseInt(g,16);return{r:y>>16&255,g:y>>8&255,b:y&255}},getRandomColor(){for(var g=(Math.random()*16777215<<0).toString(16);g.length<6;)g=d+g;return u+g},getRGB(g){var y;return g in m?(y=m[g],{r:y[0],g:y[1],b:y[2]}):g[0]===u?this._hexToRgb(g.substring(1)):g.substr(0,4)===p?(y=_.exec(g.replace(/ /g,"")),{r:parseInt(y[1],10),g:parseInt(y[2],10),b:parseInt(y[3],10)}):{r:0,g:0,b:0}},colorToRGBA(g){return g=g||"black",e.Util._namedColorToRBA(g)||e.Util._hex3ColorToRGBA(g)||e.Util._hex4ColorToRGBA(g)||e.Util._hex6ColorToRGBA(g)||e.Util._hex8ColorToRGBA(g)||e.Util._rgbColorToRGBA(g)||e.Util._rgbaColorToRGBA(g)||e.Util._hslColorToRGBA(g)},_namedColorToRBA(g){var y=m[g.toLowerCase()];return y?{r:y[0],g:y[1],b:y[2],a:1}:null},_rgbColorToRGBA(g){if(g.indexOf("rgb(")===0){g=g.match(/rgb\(([^)]+)\)/)[1];var y=g.split(/ *, */).map(Number);return{r:y[0],g:y[1],b:y[2],a:1}}},_rgbaColorToRGBA(g){if(g.indexOf("rgba(")===0){g=g.match(/rgba\(([^)]+)\)/)[1];var y=g.split(/ *, */).map((S,w)=>S.slice(-1)==="%"?w===3?parseInt(S)/100:parseInt(S)/100*255:Number(S));return{r:y[0],g:y[1],b:y[2],a:y[3]}}},_hex8ColorToRGBA(g){if(g[0]==="#"&&g.length===9)return{r:parseInt(g.slice(1,3),16),g:parseInt(g.slice(3,5),16),b:parseInt(g.slice(5,7),16),a:parseInt(g.slice(7,9),16)/255}},_hex6ColorToRGBA(g){if(g[0]==="#"&&g.length===7)return{r:parseInt(g.slice(1,3),16),g:parseInt(g.slice(3,5),16),b:parseInt(g.slice(5,7),16),a:1}},_hex4ColorToRGBA(g){if(g[0]==="#"&&g.length===5)return{r:parseInt(g[1]+g[1],16),g:parseInt(g[2]+g[2],16),b:parseInt(g[3]+g[3],16),a:parseInt(g[4]+g[4],16)/255}},_hex3ColorToRGBA(g){if(g[0]==="#"&&g.length===4)return{r:parseInt(g[1]+g[1],16),g:parseInt(g[2]+g[2],16),b:parseInt(g[3]+g[3],16),a:1}},_hslColorToRGBA(g){if(/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.test(g)){const[y,...S]=/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.exec(g),w=Number(S[0])/360,x=Number(S[1])/100,C=Number(S[2])/100;let T,k,P;if(x===0)return P=C*255,{r:Math.round(P),g:Math.round(P),b:Math.round(P),a:1};C<.5?T=C*(1+x):T=C+x-C*x;const $=2*C-T,O=[0,0,0];for(let E=0;E<3;E++)k=w+1/3*-(E-1),k<0&&k++,k>1&&k--,6*k<1?P=$+(T-$)*6*k:2*k<1?P=T:3*k<2?P=$+(T-$)*(2/3-k)*6:P=$,O[E]=P*255;return{r:Math.round(O[0]),g:Math.round(O[1]),b:Math.round(O[2]),a:1}}},haveIntersection(g,y){return!(y.x>g.x+g.width||y.x+y.widthg.y+g.height||y.y+y.height1?(T=S,k=w,P=(S-x)*(S-x)+(w-C)*(w-C)):(T=g+O*(S-g),k=y+O*(w-y),P=(T-x)*(T-x)+(k-C)*(k-C))}return[T,k,P]},_getProjectionToLine(g,y,S){var w=e.Util.cloneObject(g),x=Number.MAX_VALUE;return y.forEach(function(C,T){if(!(!S&&T===y.length-1)){var k=y[(T+1)%y.length],P=e.Util._getProjectionToSegment(C.x,C.y,k.x,k.y,g.x,g.y),$=P[0],O=P[1],E=P[2];Ey.length){var T=y;y=g,g=T}for(w=0;w{y.width=0,y.height=0})},drawRoundedRectPath(g,y,S,w){let x=0,C=0,T=0,k=0;typeof w=="number"?x=C=T=k=Math.min(w,y/2,S/2):(x=Math.min(w[0]||0,y/2,S/2),C=Math.min(w[1]||0,y/2,S/2),k=Math.min(w[2]||0,y/2,S/2),T=Math.min(w[3]||0,y/2,S/2)),g.moveTo(x,0),g.lineTo(y-C,0),g.arc(y-C,C,C,Math.PI*3/2,0,!1),g.lineTo(y,S-k),g.arc(y-k,S-k,k,0,Math.PI/2,!1),g.lineTo(T,S),g.arc(T,S-T,T,Math.PI/2,Math.PI,!1),g.lineTo(0,x),g.arc(x,x,x,Math.PI,Math.PI*3/2,!1)}}})(dr);var rr={},At={},Xe={};Object.defineProperty(Xe,"__esModule",{value:!0});Xe.getComponentValidator=Xe.getBooleanValidator=Xe.getNumberArrayValidator=Xe.getFunctionValidator=Xe.getStringOrGradientValidator=Xe.getStringValidator=Xe.getNumberOrAutoValidator=Xe.getNumberOrArrayOfNumbersValidator=Xe.getNumberValidator=Xe.alphaComponent=Xe.RGBComponent=void 0;const Zl=Rt,vr=dr;function Jl(e){return vr.Util._isString(e)?'"'+e+'"':Object.prototype.toString.call(e)==="[object Number]"||vr.Util._isBoolean(e)?e:Object.prototype.toString.call(e)}function zxe(e){return e>255?255:e<0?0:Math.round(e)}Xe.RGBComponent=zxe;function jxe(e){return e>1?1:e<1e-4?1e-4:e}Xe.alphaComponent=jxe;function Uxe(){if(Zl.Konva.isUnminified)return function(e,t){return vr.Util._isNumber(e)||vr.Util.warn(Jl(e)+' is a not valid value for "'+t+'" attribute. The value should be a number.'),e}}Xe.getNumberValidator=Uxe;function Vxe(e){if(Zl.Konva.isUnminified)return function(t,n){let r=vr.Util._isNumber(t),i=vr.Util._isArray(t)&&t.length==e;return!r&&!i&&vr.Util.warn(Jl(t)+' is a not valid value for "'+n+'" attribute. The value should be a number or Array('+e+")"),t}}Xe.getNumberOrArrayOfNumbersValidator=Vxe;function Gxe(){if(Zl.Konva.isUnminified)return function(e,t){var n=vr.Util._isNumber(e),r=e==="auto";return n||r||vr.Util.warn(Jl(e)+' is a not valid value for "'+t+'" attribute. The value should be a number or "auto".'),e}}Xe.getNumberOrAutoValidator=Gxe;function Hxe(){if(Zl.Konva.isUnminified)return function(e,t){return vr.Util._isString(e)||vr.Util.warn(Jl(e)+' is a not valid value for "'+t+'" attribute. The value should be a string.'),e}}Xe.getStringValidator=Hxe;function qxe(){if(Zl.Konva.isUnminified)return function(e,t){const n=vr.Util._isString(e),r=Object.prototype.toString.call(e)==="[object CanvasGradient]"||e&&e.addColorStop;return n||r||vr.Util.warn(Jl(e)+' is a not valid value for "'+t+'" attribute. The value should be a string or a native gradient.'),e}}Xe.getStringOrGradientValidator=qxe;function Wxe(){if(Zl.Konva.isUnminified)return function(e,t){return vr.Util._isFunction(e)||vr.Util.warn(Jl(e)+' is a not valid value for "'+t+'" attribute. The value should be a function.'),e}}Xe.getFunctionValidator=Wxe;function Kxe(){if(Zl.Konva.isUnminified)return function(e,t){const n=Int8Array?Object.getPrototypeOf(Int8Array):null;return n&&e instanceof n||(vr.Util._isArray(e)?e.forEach(function(r){vr.Util._isNumber(r)||vr.Util.warn('"'+t+'" attribute has non numeric element '+r+". Make sure that all elements are numbers.")}):vr.Util.warn(Jl(e)+' is a not valid value for "'+t+'" attribute. The value should be a array of numbers.')),e}}Xe.getNumberArrayValidator=Kxe;function Qxe(){if(Zl.Konva.isUnminified)return function(e,t){var n=e===!0||e===!1;return n||vr.Util.warn(Jl(e)+' is a not valid value for "'+t+'" attribute. The value should be a boolean.'),e}}Xe.getBooleanValidator=Qxe;function Xxe(e){if(Zl.Konva.isUnminified)return function(t,n){return t==null||vr.Util.isObject(t)||vr.Util.warn(Jl(t)+' is a not valid value for "'+n+'" attribute. The value should be an object with properties '+e),t}}Xe.getComponentValidator=Xxe;(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.Factory=void 0;const t=dr,n=Xe;var r="get",i="set";e.Factory={addGetterSetter(o,a,s,l,u){e.Factory.addGetter(o,a,s),e.Factory.addSetter(o,a,l,u),e.Factory.addOverloadedGetterSetter(o,a)},addGetter(o,a,s){var l=r+t.Util._capitalize(a);o.prototype[l]=o.prototype[l]||function(){var u=this.attrs[a];return u===void 0?s:u}},addSetter(o,a,s,l){var u=i+t.Util._capitalize(a);o.prototype[u]||e.Factory.overWriteSetter(o,a,s,l)},overWriteSetter(o,a,s,l){var u=i+t.Util._capitalize(a);o.prototype[u]=function(c){return s&&c!==void 0&&c!==null&&(c=s.call(this,c,a)),this._setAttr(a,c),l&&l.call(this),this}},addComponentsGetterSetter(o,a,s,l,u){var c=s.length,d=t.Util._capitalize,f=r+d(a),h=i+d(a),p,m;o.prototype[f]=function(){var b={};for(p=0;p{this._setAttr(a+d(y),void 0)}),this._fireChangeEvent(a,v,b),u&&u.call(this),this},e.Factory.addOverloadedGetterSetter(o,a)},addOverloadedGetterSetter(o,a){var s=t.Util._capitalize(a),l=i+s,u=r+s;o.prototype[a]=function(){return arguments.length?(this[l](arguments[0]),this):this[u]()}},addDeprecatedGetterSetter(o,a,s,l){t.Util.error("Adding deprecated "+a);var u=r+t.Util._capitalize(a),c=a+" property is deprecated and will be removed soon. Look at Konva change log for more information.";o.prototype[u]=function(){t.Util.error(c);var d=this.attrs[a];return d===void 0?s:d},e.Factory.addSetter(o,a,l,function(){t.Util.error(c)}),e.Factory.addOverloadedGetterSetter(o,a)},backCompat(o,a){t.Util.each(a,function(s,l){var u=o.prototype[l],c=r+t.Util._capitalize(s),d=i+t.Util._capitalize(s);function f(){u.apply(this,arguments),t.Util.error('"'+s+'" method is deprecated and will be removed soon. Use ""'+l+'" instead.')}o.prototype[s]=f,o.prototype[c]=f,o.prototype[d]=f})},afterSetFilter(){this._filterUpToDate=!1}}})(At);var is={},Nl={};Object.defineProperty(Nl,"__esModule",{value:!0});Nl.HitContext=Nl.SceneContext=Nl.Context=void 0;const gG=dr,Yxe=Rt;function Zxe(e){var t=[],n=e.length,r=gG.Util,i,o;for(i=0;itypeof c=="number"?Math.floor(c):c)),o+=Jxe+u.join(J9)+ewe)):(o+=s.property,t||(o+=owe+s.val)),o+=rwe;return o}clearTrace(){this.traceArr=[]}_trace(t){var n=this.traceArr,r;n.push(t),r=n.length,r>=swe&&n.shift()}reset(){var t=this.getCanvas().getPixelRatio();this.setTransform(1*t,0,0,1*t,0,0)}getCanvas(){return this.canvas}clear(t){var n=this.getCanvas();t?this.clearRect(t.x||0,t.y||0,t.width||0,t.height||0):this.clearRect(0,0,n.getWidth()/n.pixelRatio,n.getHeight()/n.pixelRatio)}_applyLineCap(t){const n=t.attrs.lineCap;n&&this.setAttr("lineCap",n)}_applyOpacity(t){var n=t.getAbsoluteOpacity();n!==1&&this.setAttr("globalAlpha",n)}_applyLineJoin(t){const n=t.attrs.lineJoin;n&&this.setAttr("lineJoin",n)}setAttr(t,n){this._context[t]=n}arc(t,n,r,i,o,a){this._context.arc(t,n,r,i,o,a)}arcTo(t,n,r,i,o){this._context.arcTo(t,n,r,i,o)}beginPath(){this._context.beginPath()}bezierCurveTo(t,n,r,i,o,a){this._context.bezierCurveTo(t,n,r,i,o,a)}clearRect(t,n,r,i){this._context.clearRect(t,n,r,i)}clip(...t){this._context.clip.apply(this._context,t)}closePath(){this._context.closePath()}createImageData(t,n){var r=arguments;if(r.length===2)return this._context.createImageData(t,n);if(r.length===1)return this._context.createImageData(t)}createLinearGradient(t,n,r,i){return this._context.createLinearGradient(t,n,r,i)}createPattern(t,n){return this._context.createPattern(t,n)}createRadialGradient(t,n,r,i,o,a){return this._context.createRadialGradient(t,n,r,i,o,a)}drawImage(t,n,r,i,o,a,s,l,u){var c=arguments,d=this._context;c.length===3?d.drawImage(t,n,r):c.length===5?d.drawImage(t,n,r,i,o):c.length===9&&d.drawImage(t,n,r,i,o,a,s,l,u)}ellipse(t,n,r,i,o,a,s,l){this._context.ellipse(t,n,r,i,o,a,s,l)}isPointInPath(t,n,r,i){return r?this._context.isPointInPath(r,t,n,i):this._context.isPointInPath(t,n,i)}fill(...t){this._context.fill.apply(this._context,t)}fillRect(t,n,r,i){this._context.fillRect(t,n,r,i)}strokeRect(t,n,r,i){this._context.strokeRect(t,n,r,i)}fillText(t,n,r,i){i?this._context.fillText(t,n,r,i):this._context.fillText(t,n,r)}measureText(t){return this._context.measureText(t)}getImageData(t,n,r,i){return this._context.getImageData(t,n,r,i)}lineTo(t,n){this._context.lineTo(t,n)}moveTo(t,n){this._context.moveTo(t,n)}rect(t,n,r,i){this._context.rect(t,n,r,i)}putImageData(t,n,r){this._context.putImageData(t,n,r)}quadraticCurveTo(t,n,r,i){this._context.quadraticCurveTo(t,n,r,i)}restore(){this._context.restore()}rotate(t){this._context.rotate(t)}save(){this._context.save()}scale(t,n){this._context.scale(t,n)}setLineDash(t){this._context.setLineDash?this._context.setLineDash(t):"mozDash"in this._context?this._context.mozDash=t:"webkitLineDash"in this._context&&(this._context.webkitLineDash=t)}getLineDash(){return this._context.getLineDash()}setTransform(t,n,r,i,o,a){this._context.setTransform(t,n,r,i,o,a)}stroke(t){t?this._context.stroke(t):this._context.stroke()}strokeText(t,n,r,i){this._context.strokeText(t,n,r,i)}transform(t,n,r,i,o,a){this._context.transform(t,n,r,i,o,a)}translate(t,n){this._context.translate(t,n)}_enableTrace(){var t=this,n=eO.length,r=this.setAttr,i,o,a=function(s){var l=t[s],u;t[s]=function(){return o=Zxe(Array.prototype.slice.call(arguments,0)),u=l.apply(t,arguments),t._trace({method:s,args:o}),u}};for(i=0;i{i.dragStatus==="dragging"&&(r=!0)}),r},justDragged:!1,get node(){var r;return e.DD._dragElements.forEach(i=>{r=i.node}),r},_dragElements:new Map,_drag(r){const i=[];e.DD._dragElements.forEach((o,a)=>{const{node:s}=o,l=s.getStage();l.setPointersPositions(r),o.pointerId===void 0&&(o.pointerId=n.Util._getFirstPointerId(r));const u=l._changedPointerPositions.find(f=>f.id===o.pointerId);if(u){if(o.dragStatus!=="dragging"){var c=s.dragDistance(),d=Math.max(Math.abs(u.x-o.startPointerPos.x),Math.abs(u.y-o.startPointerPos.y));if(d{o.fire("dragmove",{type:"dragmove",target:o,evt:r},!0)})},_endDragBefore(r){const i=[];e.DD._dragElements.forEach(o=>{const{node:a}=o,s=a.getStage();if(r&&s.setPointersPositions(r),!s._changedPointerPositions.find(c=>c.id===o.pointerId))return;(o.dragStatus==="dragging"||o.dragStatus==="stopped")&&(e.DD.justDragged=!0,t.Konva._mouseListenClick=!1,t.Konva._touchListenClick=!1,t.Konva._pointerListenClick=!1,o.dragStatus="stopped");const u=o.node.getLayer()||o.node instanceof t.Konva.Stage&&o.node;u&&i.indexOf(u)===-1&&i.push(u)}),i.forEach(o=>{o.draw()})},_endDragAfter(r){e.DD._dragElements.forEach((i,o)=>{i.dragStatus==="stopped"&&i.node.fire("dragend",{type:"dragend",target:i.node,evt:r},!0),i.dragStatus!=="dragging"&&e.DD._dragElements.delete(o)})}},t.Konva.isBrowser&&(window.addEventListener("mouseup",e.DD._endDragBefore,!0),window.addEventListener("touchend",e.DD._endDragBefore,!0),window.addEventListener("mousemove",e.DD._drag),window.addEventListener("touchmove",e.DD._drag),window.addEventListener("mouseup",e.DD._endDragAfter,!1),window.addEventListener("touchend",e.DD._endDragAfter,!1))})(ix);Object.defineProperty(rr,"__esModule",{value:!0});rr.Node=void 0;const Nt=dr,wy=At,Bv=is,Mc=Rt,sa=ix,kr=Xe;var V1="absoluteOpacity",zv="allEventListeners",gl="absoluteTransform",tO="absoluteScale",Nc="canvas",gwe="Change",mwe="children",ywe="konva",HE="listening",nO="mouseenter",rO="mouseleave",iO="set",oO="Shape",G1=" ",aO="stage",fu="transform",vwe="Stage",qE="visible",bwe=["xChange.konva","yChange.konva","scaleXChange.konva","scaleYChange.konva","skewXChange.konva","skewYChange.konva","rotationChange.konva","offsetXChange.konva","offsetYChange.konva","transformsEnabledChange.konva"].join(G1);let _we=1;class ft{constructor(t){this._id=_we++,this.eventListeners={},this.attrs={},this.index=0,this._allEventListeners=null,this.parent=null,this._cache=new Map,this._attachedDepsListeners=new Map,this._lastPos=null,this._batchingTransformChange=!1,this._needClearTransformCache=!1,this._filterUpToDate=!1,this._isUnderCache=!1,this._dragEventId=null,this._shouldFireChangeEvents=!1,this.setAttrs(t),this._shouldFireChangeEvents=!0}hasChildren(){return!1}_clearCache(t){(t===fu||t===gl)&&this._cache.get(t)?this._cache.get(t).dirty=!0:t?this._cache.delete(t):this._cache.clear()}_getCache(t,n){var r=this._cache.get(t),i=t===fu||t===gl,o=r===void 0||i&&r.dirty===!0;return o&&(r=n.call(this),this._cache.set(t,r)),r}_calculate(t,n,r){if(!this._attachedDepsListeners.get(t)){const i=n.map(o=>o+"Change.konva").join(G1);this.on(i,()=>{this._clearCache(t)}),this._attachedDepsListeners.set(t,!0)}return this._getCache(t,r)}_getCanvasCache(){return this._cache.get(Nc)}_clearSelfAndDescendantCache(t){this._clearCache(t),t===gl&&this.fire("absoluteTransformChange")}clearCache(){if(this._cache.has(Nc)){const{scene:t,filter:n,hit:r}=this._cache.get(Nc);Nt.Util.releaseCanvas(t,n,r),this._cache.delete(Nc)}return this._clearSelfAndDescendantCache(),this._requestDraw(),this}cache(t){var n=t||{},r={};(n.x===void 0||n.y===void 0||n.width===void 0||n.height===void 0)&&(r=this.getClientRect({skipTransform:!0,relativeTo:this.getParent()}));var i=Math.ceil(n.width||r.width),o=Math.ceil(n.height||r.height),a=n.pixelRatio,s=n.x===void 0?Math.floor(r.x):n.x,l=n.y===void 0?Math.floor(r.y):n.y,u=n.offset||0,c=n.drawBorder||!1,d=n.hitCanvasPixelRatio||1;if(!i||!o){Nt.Util.error("Can not cache the node. Width or height of the node equals 0. Caching is skipped.");return}i+=u*2+1,o+=u*2+1,s-=u,l-=u;var f=new Bv.SceneCanvas({pixelRatio:a,width:i,height:o}),h=new Bv.SceneCanvas({pixelRatio:a,width:0,height:0,willReadFrequently:!0}),p=new Bv.HitCanvas({pixelRatio:d,width:i,height:o}),m=f.getContext(),_=p.getContext();return p.isCache=!0,f.isCache=!0,this._cache.delete(Nc),this._filterUpToDate=!1,n.imageSmoothingEnabled===!1&&(f.getContext()._context.imageSmoothingEnabled=!1,h.getContext()._context.imageSmoothingEnabled=!1),m.save(),_.save(),m.translate(-s,-l),_.translate(-s,-l),this._isUnderCache=!0,this._clearSelfAndDescendantCache(V1),this._clearSelfAndDescendantCache(tO),this.drawScene(f,this),this.drawHit(p,this),this._isUnderCache=!1,m.restore(),_.restore(),c&&(m.save(),m.beginPath(),m.rect(0,0,i,o),m.closePath(),m.setAttr("strokeStyle","red"),m.setAttr("lineWidth",5),m.stroke(),m.restore()),this._cache.set(Nc,{scene:f,filter:h,hit:p,x:s,y:l}),this._requestDraw(),this}isCached(){return this._cache.has(Nc)}getClientRect(t){throw new Error('abstract "getClientRect" method call')}_transformedRect(t,n){var r=[{x:t.x,y:t.y},{x:t.x+t.width,y:t.y},{x:t.x+t.width,y:t.y+t.height},{x:t.x,y:t.y+t.height}],i,o,a,s,l=this.getAbsoluteTransform(n);return r.forEach(function(u){var c=l.point(u);i===void 0&&(i=a=c.x,o=s=c.y),i=Math.min(i,c.x),o=Math.min(o,c.y),a=Math.max(a,c.x),s=Math.max(s,c.y)}),{x:i,y:o,width:a-i,height:s-o}}_drawCachedSceneCanvas(t){t.save(),t._applyOpacity(this),t._applyGlobalCompositeOperation(this);const n=this._getCanvasCache();t.translate(n.x,n.y);var r=this._getCachedSceneCanvas(),i=r.pixelRatio;t.drawImage(r._canvas,0,0,r.width/i,r.height/i),t.restore()}_drawCachedHitCanvas(t){var n=this._getCanvasCache(),r=n.hit;t.save(),t.translate(n.x,n.y),t.drawImage(r._canvas,0,0,r.width/r.pixelRatio,r.height/r.pixelRatio),t.restore()}_getCachedSceneCanvas(){var t=this.filters(),n=this._getCanvasCache(),r=n.scene,i=n.filter,o=i.getContext(),a,s,l,u;if(t){if(!this._filterUpToDate){var c=r.pixelRatio;i.setSize(r.width/r.pixelRatio,r.height/r.pixelRatio);try{for(a=t.length,o.clear(),o.drawImage(r._canvas,0,0,r.getWidth()/c,r.getHeight()/c),s=o.getImageData(0,0,i.getWidth(),i.getHeight()),l=0;l{var n,r;if(!t)return this;for(n in t)n!==mwe&&(r=iO+Nt.Util._capitalize(n),Nt.Util._isFunction(this[r])?this[r](t[n]):this._setAttr(n,t[n]))}),this}isListening(){return this._getCache(HE,this._isListening)}_isListening(t){if(!this.listening())return!1;const r=this.getParent();return r&&r!==t&&this!==t?r._isListening(t):!0}isVisible(){return this._getCache(qE,this._isVisible)}_isVisible(t){if(!this.visible())return!1;const r=this.getParent();return r&&r!==t&&this!==t?r._isVisible(t):!0}shouldDrawHit(t,n=!1){if(t)return this._isVisible(t)&&this._isListening(t);var r=this.getLayer(),i=!1;sa.DD._dragElements.forEach(a=>{a.dragStatus==="dragging"&&(a.node.nodeType==="Stage"||a.node.getLayer()===r)&&(i=!0)});var o=!n&&!Mc.Konva.hitOnDragEnabled&&i;return this.isListening()&&this.isVisible()&&!o}show(){return this.visible(!0),this}hide(){return this.visible(!1),this}getZIndex(){return this.index||0}getAbsoluteZIndex(){var t=this.getDepth(),n=this,r=0,i,o,a,s;function l(u){for(i=[],o=u.length,a=0;a0&&i[0].getDepth()<=t&&l(i)}return n.nodeType!==vwe&&l(n.getStage().getChildren()),r}getDepth(){for(var t=0,n=this.parent;n;)t++,n=n.parent;return t}_batchTransformChanges(t){this._batchingTransformChange=!0,t(),this._batchingTransformChange=!1,this._needClearTransformCache&&(this._clearCache(fu),this._clearSelfAndDescendantCache(gl)),this._needClearTransformCache=!1}setPosition(t){return this._batchTransformChanges(()=>{this.x(t.x),this.y(t.y)}),this}getPosition(){return{x:this.x(),y:this.y()}}getRelativePointerPosition(){if(!this.getStage())return null;var t=this.getStage().getPointerPosition();if(!t)return null;var n=this.getAbsoluteTransform().copy();return n.invert(),n.point(t)}getAbsolutePosition(t){let n=!1,r=this.parent;for(;r;){if(r.isCached()){n=!0;break}r=r.parent}n&&!t&&(t=!0);var i=this.getAbsoluteTransform(t).getMatrix(),o=new Nt.Transform,a=this.offset();return o.m=i.slice(),o.translate(a.x,a.y),o.getTranslation()}setAbsolutePosition(t){var n=this._clearTransform();this.attrs.x=n.x,this.attrs.y=n.y,delete n.x,delete n.y,this._clearCache(fu);var r=this._getAbsoluteTransform().copy();return r.invert(),r.translate(t.x,t.y),t={x:this.attrs.x+r.getTranslation().x,y:this.attrs.y+r.getTranslation().y},this._setTransform(n),this.setPosition({x:t.x,y:t.y}),this._clearCache(fu),this._clearSelfAndDescendantCache(gl),this}_setTransform(t){var n;for(n in t)this.attrs[n]=t[n]}_clearTransform(){var t={x:this.x(),y:this.y(),rotation:this.rotation(),scaleX:this.scaleX(),scaleY:this.scaleY(),offsetX:this.offsetX(),offsetY:this.offsetY(),skewX:this.skewX(),skewY:this.skewY()};return this.attrs.x=0,this.attrs.y=0,this.attrs.rotation=0,this.attrs.scaleX=1,this.attrs.scaleY=1,this.attrs.offsetX=0,this.attrs.offsetY=0,this.attrs.skewX=0,this.attrs.skewY=0,t}move(t){var n=t.x,r=t.y,i=this.x(),o=this.y();return n!==void 0&&(i+=n),r!==void 0&&(o+=r),this.setPosition({x:i,y:o}),this}_eachAncestorReverse(t,n){var r=[],i=this.getParent(),o,a;if(!(n&&n._id===this._id)){for(r.unshift(this);i&&(!n||i._id!==n._id);)r.unshift(i),i=i.parent;for(o=r.length,a=0;a0?(this.parent.children.splice(t,1),this.parent.children.splice(t-1,0,this),this.parent._setChildrenIndices(),!0):!1}moveToBottom(){if(!this.parent)return Nt.Util.warn("Node has no parent. moveToBottom function is ignored."),!1;var t=this.index;return t>0?(this.parent.children.splice(t,1),this.parent.children.unshift(this),this.parent._setChildrenIndices(),!0):!1}setZIndex(t){if(!this.parent)return Nt.Util.warn("Node has no parent. zIndex parameter is ignored."),this;(t<0||t>=this.parent.children.length)&&Nt.Util.warn("Unexpected value "+t+" for zIndex property. zIndex is just index of a node in children of its parent. Expected value is from 0 to "+(this.parent.children.length-1)+".");var n=this.index;return this.parent.children.splice(n,1),this.parent.children.splice(t,0,this),this.parent._setChildrenIndices(),this}getAbsoluteOpacity(){return this._getCache(V1,this._getAbsoluteOpacity)}_getAbsoluteOpacity(){var t=this.opacity(),n=this.getParent();return n&&!n._isUnderCache&&(t*=n.getAbsoluteOpacity()),t}moveTo(t){return this.getParent()!==t&&(this._remove(),t.add(this)),this}toObject(){var t={},n=this.getAttrs(),r,i,o,a,s;t.attrs={};for(r in n)i=n[r],s=Nt.Util.isObject(i)&&!Nt.Util._isPlainObject(i)&&!Nt.Util._isArray(i),!s&&(o=typeof this[r]=="function"&&this[r],delete n[r],a=o?o.call(this):null,n[r]=i,a!==i&&(t.attrs[r]=i));return t.className=this.getClassName(),Nt.Util._prepareToStringify(t)}toJSON(){return JSON.stringify(this.toObject())}getParent(){return this.parent}findAncestors(t,n,r){var i=[];n&&this._isMatch(t)&&i.push(this);for(var o=this.parent;o;){if(o===r)return i;o._isMatch(t)&&i.push(o),o=o.parent}return i}isAncestorOf(t){return!1}findAncestor(t,n,r){return this.findAncestors(t,n,r)[0]}_isMatch(t){if(!t)return!1;if(typeof t=="function")return t(this);var n=t.replace(/ /g,"").split(","),r=n.length,i,o;for(i=0;i{try{const i=t==null?void 0:t.callback;i&&delete t.callback,Nt.Util._urlToImage(this.toDataURL(t),function(o){n(o),i==null||i(o)})}catch(i){r(i)}})}toBlob(t){return new Promise((n,r)=>{try{const i=t==null?void 0:t.callback;i&&delete t.callback,this.toCanvas(t).toBlob(o=>{n(o),i==null||i(o)})}catch(i){r(i)}})}setSize(t){return this.width(t.width),this.height(t.height),this}getSize(){return{width:this.width(),height:this.height()}}getClassName(){return this.className||this.nodeType}getType(){return this.nodeType}getDragDistance(){return this.attrs.dragDistance!==void 0?this.attrs.dragDistance:this.parent?this.parent.getDragDistance():Mc.Konva.dragDistance}_off(t,n,r){var i=this.eventListeners[t],o,a,s;for(o=0;o=0;if(r&&!this.isDragging()){var i=!1;sa.DD._dragElements.forEach(o=>{this.isAncestorOf(o.node)&&(i=!0)}),i||this._createDragElement(t)}})}_dragChange(){if(this.attrs.draggable)this._listenDrag();else{this._dragCleanup();var t=this.getStage();if(!t)return;const n=sa.DD._dragElements.get(this._id),r=n&&n.dragStatus==="dragging",i=n&&n.dragStatus==="ready";r?this.stopDrag():i&&sa.DD._dragElements.delete(this._id)}}_dragCleanup(){this.off("mousedown.konva"),this.off("touchstart.konva")}isClientRectOnScreen(t={x:0,y:0}){const n=this.getStage();if(!n)return!1;const r={x:-t.x,y:-t.y,width:n.width()+2*t.x,height:n.height()+2*t.y};return Nt.Util.haveIntersection(r,this.getClientRect())}static create(t,n){return Nt.Util._isString(t)&&(t=JSON.parse(t)),this._createNode(t,n)}static _createNode(t,n){var r=ft.prototype.getClassName.call(t),i=t.children,o,a,s;n&&(t.attrs.container=n),Mc.Konva[r]||(Nt.Util.warn('Can not find a node with class name "'+r+'". Fallback to "Shape".'),r="Shape");const l=Mc.Konva[r];if(o=new l(t.attrs),i)for(a=i.length,s=0;s0}removeChildren(){return this.getChildren().forEach(t=>{t.parent=null,t.index=0,t.remove()}),this.children=[],this._requestDraw(),this}destroyChildren(){return this.getChildren().forEach(t=>{t.parent=null,t.index=0,t.destroy()}),this.children=[],this._requestDraw(),this}add(...t){if(t.length===0)return this;if(t.length>1){for(var n=0;n0?n[0]:void 0}_generalFind(t,n){var r=[];return this._descendants(i=>{const o=i._isMatch(t);return o&&r.push(i),!!(o&&n)}),r}_descendants(t){let n=!1;const r=this.getChildren();for(const i of r){if(n=t(i),n)return!0;if(i.hasChildren()&&(n=i._descendants(t),n))return!0}return!1}toObject(){var t=qC.Node.prototype.toObject.call(this);return t.children=[],this.getChildren().forEach(n=>{t.children.push(n.toObject())}),t}isAncestorOf(t){for(var n=t.getParent();n;){if(n._id===this._id)return!0;n=n.getParent()}return!1}clone(t){var n=qC.Node.prototype.clone.call(this,t);return this.getChildren().forEach(function(r){n.add(r.clone())}),n}getAllIntersections(t){var n=[];return this.find("Shape").forEach(function(r){r.isVisible()&&r.intersects(t)&&n.push(r)}),n}_clearSelfAndDescendantCache(t){var n;super._clearSelfAndDescendantCache(t),!this.isCached()&&((n=this.children)===null||n===void 0||n.forEach(function(r){r._clearSelfAndDescendantCache(t)}))}_setChildrenIndices(){var t;(t=this.children)===null||t===void 0||t.forEach(function(n,r){n.index=r}),this._requestDraw()}drawScene(t,n){var r=this.getLayer(),i=t||r&&r.getCanvas(),o=i&&i.getContext(),a=this._getCanvasCache(),s=a&&a.scene,l=i&&i.isCache;if(!this.isVisible()&&!l)return this;if(s){o.save();var u=this.getAbsoluteTransform(n).getMatrix();o.transform(u[0],u[1],u[2],u[3],u[4],u[5]),this._drawCachedSceneCanvas(o),o.restore()}else this._drawChildren("drawScene",i,n);return this}drawHit(t,n){if(!this.shouldDrawHit(n))return this;var r=this.getLayer(),i=t||r&&r.hitCanvas,o=i&&i.getContext(),a=this._getCanvasCache(),s=a&&a.hit;if(s){o.save();var l=this.getAbsoluteTransform(n).getMatrix();o.transform(l[0],l[1],l[2],l[3],l[4],l[5]),this._drawCachedHitCanvas(o),o.restore()}else this._drawChildren("drawHit",i,n);return this}_drawChildren(t,n,r){var i,o=n&&n.getContext(),a=this.clipWidth(),s=this.clipHeight(),l=this.clipFunc(),u=a&&s||l;const c=r===this;if(u){o.save();var d=this.getAbsoluteTransform(r),f=d.getMatrix();o.transform(f[0],f[1],f[2],f[3],f[4],f[5]),o.beginPath();let _;if(l)_=l.call(this,o,this);else{var h=this.clipX(),p=this.clipY();o.rect(h,p,a,s)}o.clip.apply(o,_),f=d.copy().invert().getMatrix(),o.transform(f[0],f[1],f[2],f[3],f[4],f[5])}var m=!c&&this.globalCompositeOperation()!=="source-over"&&t==="drawScene";m&&(o.save(),o._applyGlobalCompositeOperation(this)),(i=this.children)===null||i===void 0||i.forEach(function(_){_[t](n,r)}),m&&o.restore(),u&&o.restore()}getClientRect(t){var n;t=t||{};var r=t.skipTransform,i=t.relativeTo,o,a,s,l,u={x:1/0,y:1/0,width:0,height:0},c=this;(n=this.children)===null||n===void 0||n.forEach(function(m){if(m.visible()){var _=m.getClientRect({relativeTo:c,skipShadow:t.skipShadow,skipStroke:t.skipStroke});_.width===0&&_.height===0||(o===void 0?(o=_.x,a=_.y,s=_.x+_.width,l=_.y+_.height):(o=Math.min(o,_.x),a=Math.min(a,_.y),s=Math.max(s,_.x+_.width),l=Math.max(l,_.y+_.height)))}});for(var d=this.find("Shape"),f=!1,h=0;hJ.indexOf("pointer")>=0?"pointer":J.indexOf("touch")>=0?"touch":"mouse",U=J=>{const j=B(J);if(j==="pointer")return i.Konva.pointerEventsEnabled&&N.pointer;if(j==="touch")return N.touch;if(j==="mouse")return N.mouse};function G(J={}){return(J.clipFunc||J.clipWidth||J.clipHeight)&&t.Util.warn("Stage does not support clipping. Please use clip for Layers or Groups."),J}const Y="Pointer position is missing and not registered by the stage. Looks like it is outside of the stage container. You can set it manually from event: stage.setPointersPositions(event);";e.stages=[];class ee extends r.Container{constructor(j){super(G(j)),this._pointerPositions=[],this._changedPointerPositions=[],this._buildDOM(),this._bindContentEvents(),e.stages.push(this),this.on("widthChange.konva heightChange.konva",this._resizeDOM),this.on("visibleChange.konva",this._checkVisibility),this.on("clipWidthChange.konva clipHeightChange.konva clipFuncChange.konva",()=>{G(this.attrs)}),this._checkVisibility()}_validateAdd(j){const Q=j.getType()==="Layer",ne=j.getType()==="FastLayer";Q||ne||t.Util.throw("You may only add layers to the stage.")}_checkVisibility(){if(!this.content)return;const j=this.visible()?"":"none";this.content.style.display=j}setContainer(j){if(typeof j===c){if(j.charAt(0)==="."){var Q=j.slice(1);j=document.getElementsByClassName(Q)[0]}else{var ne;j.charAt(0)!=="#"?ne=j:ne=j.slice(1),j=document.getElementById(ne)}if(!j)throw"Can not find container in document with id "+ne}return this._setAttr("container",j),this.content&&(this.content.parentElement&&this.content.parentElement.removeChild(this.content),j.appendChild(this.content)),this}shouldDrawHit(){return!0}clear(){var j=this.children,Q=j.length,ne;for(ne=0;ne-1&&e.stages.splice(Q,1),t.Util.releaseCanvas(this.bufferCanvas._canvas,this.bufferHitCanvas._canvas),this}getPointerPosition(){const j=this._pointerPositions[0]||this._changedPointerPositions[0];return j?{x:j.x,y:j.y}:(t.Util.warn(Y),null)}_getPointerById(j){return this._pointerPositions.find(Q=>Q.id===j)}getPointersPositions(){return this._pointerPositions}getStage(){return this}getContent(){return this.content}_toKonvaCanvas(j){j=j||{},j.x=j.x||0,j.y=j.y||0,j.width=j.width||this.width(),j.height=j.height||this.height();var Q=new o.SceneCanvas({width:j.width,height:j.height,pixelRatio:j.pixelRatio||1}),ne=Q.getContext()._context,se=this.children;return(j.x||j.y)&&ne.translate(-1*j.x,-1*j.y),se.forEach(function(ve){if(ve.isVisible()){var ce=ve._toKonvaCanvas(j);ne.drawImage(ce._canvas,j.x,j.y,ce.getWidth()/ce.getPixelRatio(),ce.getHeight()/ce.getPixelRatio())}}),Q}getIntersection(j){if(!j)return null;var Q=this.children,ne=Q.length,se=ne-1,ve;for(ve=se;ve>=0;ve--){const ce=Q[ve].getIntersection(j);if(ce)return ce}return null}_resizeDOM(){var j=this.width(),Q=this.height();this.content&&(this.content.style.width=j+d,this.content.style.height=Q+d),this.bufferCanvas.setSize(j,Q),this.bufferHitCanvas.setSize(j,Q),this.children.forEach(ne=>{ne.setSize({width:j,height:Q}),ne.draw()})}add(j,...Q){if(arguments.length>1){for(var ne=0;neM&&t.Util.warn("The stage has "+se+" layers. Recommended maximum number of layers is 3-5. Adding more layers into the stage may drop the performance. Rethink your tree structure, you can use Konva.Group."),j.setSize({width:this.width(),height:this.height()}),j.draw(),i.Konva.isBrowser&&this.content.appendChild(j.canvas._canvas),this}getParent(){return null}getLayer(){return null}hasPointerCapture(j){return l.hasPointerCapture(j,this)}setPointerCapture(j){l.setPointerCapture(j,this)}releaseCapture(j){l.releaseCapture(j,this)}getLayers(){return this.children}_bindContentEvents(){i.Konva.isBrowser&&R.forEach(([j,Q])=>{this.content.addEventListener(j,ne=>{this[Q](ne)},{passive:!1})})}_pointerenter(j){this.setPointersPositions(j);const Q=U(j.type);this._fire(Q.pointerenter,{evt:j,target:this,currentTarget:this})}_pointerover(j){this.setPointersPositions(j);const Q=U(j.type);this._fire(Q.pointerover,{evt:j,target:this,currentTarget:this})}_getTargetShape(j){let Q=this[j+"targetShape"];return Q&&!Q.getStage()&&(Q=null),Q}_pointerleave(j){const Q=U(j.type),ne=B(j.type);if(Q){this.setPointersPositions(j);var se=this._getTargetShape(ne),ve=!a.DD.isDragging||i.Konva.hitOnDragEnabled;se&&ve?(se._fireAndBubble(Q.pointerout,{evt:j}),se._fireAndBubble(Q.pointerleave,{evt:j}),this._fire(Q.pointerleave,{evt:j,target:this,currentTarget:this}),this[ne+"targetShape"]=null):ve&&(this._fire(Q.pointerleave,{evt:j,target:this,currentTarget:this}),this._fire(Q.pointerout,{evt:j,target:this,currentTarget:this})),this.pointerPos=void 0,this._pointerPositions=[]}}_pointerdown(j){const Q=U(j.type),ne=B(j.type);if(Q){this.setPointersPositions(j);var se=!1;this._changedPointerPositions.forEach(ve=>{var ce=this.getIntersection(ve);if(a.DD.justDragged=!1,i.Konva["_"+ne+"ListenClick"]=!0,!(ce&&ce.isListening()))return;i.Konva.capturePointerEventsEnabled&&ce.setPointerCapture(ve.id),this[ne+"ClickStartShape"]=ce,ce._fireAndBubble(Q.pointerdown,{evt:j,pointerId:ve.id}),se=!0;const ot=j.type.indexOf("touch")>=0;ce.preventDefault()&&j.cancelable&&ot&&j.preventDefault()}),se||this._fire(Q.pointerdown,{evt:j,target:this,currentTarget:this,pointerId:this._pointerPositions[0].id})}}_pointermove(j){const Q=U(j.type),ne=B(j.type);if(!Q)return;a.DD.isDragging&&a.DD.node.preventDefault()&&j.cancelable&&j.preventDefault(),this.setPointersPositions(j);var se=!a.DD.isDragging||i.Konva.hitOnDragEnabled;if(!se)return;var ve={};let ce=!1;var bt=this._getTargetShape(ne);this._changedPointerPositions.forEach(ot=>{const ze=l.getCapturedShape(ot.id)||this.getIntersection(ot),gt=ot.id,Pe={evt:j,pointerId:gt};var Jt=bt!==ze;if(Jt&&bt&&(bt._fireAndBubble(Q.pointerout,Object.assign({},Pe),ze),bt._fireAndBubble(Q.pointerleave,Object.assign({},Pe),ze)),ze){if(ve[ze._id])return;ve[ze._id]=!0}ze&&ze.isListening()?(ce=!0,Jt&&(ze._fireAndBubble(Q.pointerover,Object.assign({},Pe),bt),ze._fireAndBubble(Q.pointerenter,Object.assign({},Pe),bt),this[ne+"targetShape"]=ze),ze._fireAndBubble(Q.pointermove,Object.assign({},Pe))):bt&&(this._fire(Q.pointerover,{evt:j,target:this,currentTarget:this,pointerId:gt}),this[ne+"targetShape"]=null)}),ce||this._fire(Q.pointermove,{evt:j,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id})}_pointerup(j){const Q=U(j.type),ne=B(j.type);if(!Q)return;this.setPointersPositions(j);const se=this[ne+"ClickStartShape"],ve=this[ne+"ClickEndShape"];var ce={};let bt=!1;this._changedPointerPositions.forEach(ot=>{const ze=l.getCapturedShape(ot.id)||this.getIntersection(ot);if(ze){if(ze.releaseCapture(ot.id),ce[ze._id])return;ce[ze._id]=!0}const gt=ot.id,Pe={evt:j,pointerId:gt};let Jt=!1;i.Konva["_"+ne+"InDblClickWindow"]?(Jt=!0,clearTimeout(this[ne+"DblTimeout"])):a.DD.justDragged||(i.Konva["_"+ne+"InDblClickWindow"]=!0,clearTimeout(this[ne+"DblTimeout"])),this[ne+"DblTimeout"]=setTimeout(function(){i.Konva["_"+ne+"InDblClickWindow"]=!1},i.Konva.dblClickWindow),ze&&ze.isListening()?(bt=!0,this[ne+"ClickEndShape"]=ze,ze._fireAndBubble(Q.pointerup,Object.assign({},Pe)),i.Konva["_"+ne+"ListenClick"]&&se&&se===ze&&(ze._fireAndBubble(Q.pointerclick,Object.assign({},Pe)),Jt&&ve&&ve===ze&&ze._fireAndBubble(Q.pointerdblclick,Object.assign({},Pe)))):(this[ne+"ClickEndShape"]=null,i.Konva["_"+ne+"ListenClick"]&&this._fire(Q.pointerclick,{evt:j,target:this,currentTarget:this,pointerId:gt}),Jt&&this._fire(Q.pointerdblclick,{evt:j,target:this,currentTarget:this,pointerId:gt}))}),bt||this._fire(Q.pointerup,{evt:j,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id}),i.Konva["_"+ne+"ListenClick"]=!1,j.cancelable&&ne!=="touch"&&j.preventDefault()}_contextmenu(j){this.setPointersPositions(j);var Q=this.getIntersection(this.getPointerPosition());Q&&Q.isListening()?Q._fireAndBubble($,{evt:j}):this._fire($,{evt:j,target:this,currentTarget:this})}_wheel(j){this.setPointersPositions(j);var Q=this.getIntersection(this.getPointerPosition());Q&&Q.isListening()?Q._fireAndBubble(L,{evt:j}):this._fire(L,{evt:j,target:this,currentTarget:this})}_pointercancel(j){this.setPointersPositions(j);const Q=l.getCapturedShape(j.pointerId)||this.getIntersection(this.getPointerPosition());Q&&Q._fireAndBubble(S,l.createEvent(j)),l.releaseCapture(j.pointerId)}_lostpointercapture(j){l.releaseCapture(j.pointerId)}setPointersPositions(j){var Q=this._getContentPosition(),ne=null,se=null;j=j||window.event,j.touches!==void 0?(this._pointerPositions=[],this._changedPointerPositions=[],Array.prototype.forEach.call(j.touches,ve=>{this._pointerPositions.push({id:ve.identifier,x:(ve.clientX-Q.left)/Q.scaleX,y:(ve.clientY-Q.top)/Q.scaleY})}),Array.prototype.forEach.call(j.changedTouches||j.touches,ve=>{this._changedPointerPositions.push({id:ve.identifier,x:(ve.clientX-Q.left)/Q.scaleX,y:(ve.clientY-Q.top)/Q.scaleY})})):(ne=(j.clientX-Q.left)/Q.scaleX,se=(j.clientY-Q.top)/Q.scaleY,this.pointerPos={x:ne,y:se},this._pointerPositions=[{x:ne,y:se,id:t.Util._getFirstPointerId(j)}],this._changedPointerPositions=[{x:ne,y:se,id:t.Util._getFirstPointerId(j)}])}_setPointerPosition(j){t.Util.warn('Method _setPointerPosition is deprecated. Use "stage.setPointersPositions(event)" instead.'),this.setPointersPositions(j)}_getContentPosition(){if(!this.content||!this.content.getBoundingClientRect)return{top:0,left:0,scaleX:1,scaleY:1};var j=this.content.getBoundingClientRect();return{top:j.top,left:j.left,scaleX:j.width/this.content.clientWidth||1,scaleY:j.height/this.content.clientHeight||1}}_buildDOM(){if(this.bufferCanvas=new o.SceneCanvas({width:this.width(),height:this.height()}),this.bufferHitCanvas=new o.HitCanvas({pixelRatio:1,width:this.width(),height:this.height()}),!!i.Konva.isBrowser){var j=this.container();if(!j)throw"Stage has no container. A container is required.";j.innerHTML="",this.content=document.createElement("div"),this.content.style.position="relative",this.content.style.userSelect="none",this.content.className="konvajs-content",this.content.setAttribute("role","presentation"),j.appendChild(this.content),this._resizeDOM()}}cache(){return t.Util.warn("Cache function is not allowed for stage. You may use cache only for layers, groups and shapes."),this}clearCache(){return this}batchDraw(){return this.getChildren().forEach(function(j){j.batchDraw()}),this}}e.Stage=ee,ee.prototype.nodeType=u,(0,s._registerNode)(ee),n.Factory.addGetterSetter(ee,"container")})(vG);var Cy={},Yr={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.Shape=e.shapes=void 0;const t=Rt,n=dr,r=At,i=rr,o=Xe,a=Rt,s=Go;var l="hasShadow",u="shadowRGBA",c="patternImage",d="linearGradient",f="radialGradient";let h;function p(){return h||(h=n.Util.createCanvasElement().getContext("2d"),h)}e.shapes={};function m(T){const k=this.attrs.fillRule;k?T.fill(k):T.fill()}function _(T){T.stroke()}function b(T){T.fill()}function v(T){T.stroke()}function g(){this._clearCache(l)}function y(){this._clearCache(u)}function S(){this._clearCache(c)}function w(){this._clearCache(d)}function x(){this._clearCache(f)}class C extends i.Node{constructor(k){super(k);let P;for(;P=n.Util.getRandomColor(),!(P&&!(P in e.shapes)););this.colorKey=P,e.shapes[P]=this}getContext(){return n.Util.warn("shape.getContext() method is deprecated. Please do not use it."),this.getLayer().getContext()}getCanvas(){return n.Util.warn("shape.getCanvas() method is deprecated. Please do not use it."),this.getLayer().getCanvas()}getSceneFunc(){return this.attrs.sceneFunc||this._sceneFunc}getHitFunc(){return this.attrs.hitFunc||this._hitFunc}hasShadow(){return this._getCache(l,this._hasShadow)}_hasShadow(){return this.shadowEnabled()&&this.shadowOpacity()!==0&&!!(this.shadowColor()||this.shadowBlur()||this.shadowOffsetX()||this.shadowOffsetY())}_getFillPattern(){return this._getCache(c,this.__getFillPattern)}__getFillPattern(){if(this.fillPatternImage()){var k=p();const P=k.createPattern(this.fillPatternImage(),this.fillPatternRepeat()||"repeat");if(P&&P.setTransform){const $=new n.Transform;$.translate(this.fillPatternX(),this.fillPatternY()),$.rotate(t.Konva.getAngle(this.fillPatternRotation())),$.scale(this.fillPatternScaleX(),this.fillPatternScaleY()),$.translate(-1*this.fillPatternOffsetX(),-1*this.fillPatternOffsetY());const O=$.getMatrix(),E=typeof DOMMatrix>"u"?{a:O[0],b:O[1],c:O[2],d:O[3],e:O[4],f:O[5]}:new DOMMatrix(O);P.setTransform(E)}return P}}_getLinearGradient(){return this._getCache(d,this.__getLinearGradient)}__getLinearGradient(){var k=this.fillLinearGradientColorStops();if(k){for(var P=p(),$=this.fillLinearGradientStartPoint(),O=this.fillLinearGradientEndPoint(),E=P.createLinearGradient($.x,$.y,O.x,O.y),A=0;Athis.fillEnabled()&&!!(this.fill()||this.fillPatternImage()||this.fillLinearGradientColorStops()||this.fillRadialGradientColorStops()))}hasStroke(){return this._calculate("hasStroke",["strokeEnabled","strokeWidth","stroke","strokeLinearGradientColorStops"],()=>this.strokeEnabled()&&this.strokeWidth()&&!!(this.stroke()||this.strokeLinearGradientColorStops()))}hasHitStroke(){const k=this.hitStrokeWidth();return k==="auto"?this.hasStroke():this.strokeEnabled()&&!!k}intersects(k){var P=this.getStage(),$=P.bufferHitCanvas,O;return $.getContext().clear(),this.drawHit($,null,!0),O=$.context.getImageData(Math.round(k.x),Math.round(k.y),1,1).data,O[3]>0}destroy(){return i.Node.prototype.destroy.call(this),delete e.shapes[this.colorKey],delete this.colorKey,this}_useBufferCanvas(k){var P;if(!this.getStage()||!((P=this.attrs.perfectDrawEnabled)!==null&&P!==void 0?P:!0))return!1;const O=k||this.hasFill(),E=this.hasStroke(),A=this.getAbsoluteOpacity()!==1;if(O&&E&&A)return!0;const D=this.hasShadow(),L=this.shadowForStrokeEnabled();return!!(O&&E&&D&&L)}setStrokeHitEnabled(k){n.Util.warn("strokeHitEnabled property is deprecated. Please use hitStrokeWidth instead."),k?this.hitStrokeWidth("auto"):this.hitStrokeWidth(0)}getStrokeHitEnabled(){return this.hitStrokeWidth()!==0}getSelfRect(){var k=this.size();return{x:this._centroid?-k.width/2:0,y:this._centroid?-k.height/2:0,width:k.width,height:k.height}}getClientRect(k={}){const P=k.skipTransform,$=k.relativeTo,O=this.getSelfRect(),A=!k.skipStroke&&this.hasStroke()&&this.strokeWidth()||0,D=O.width+A,L=O.height+A,M=!k.skipShadow&&this.hasShadow(),R=M?this.shadowOffsetX():0,N=M?this.shadowOffsetY():0,B=D+Math.abs(R),U=L+Math.abs(N),G=M&&this.shadowBlur()||0,Y=B+G*2,ee=U+G*2,J={width:Y,height:ee,x:-(A/2+G)+Math.min(R,0)+O.x,y:-(A/2+G)+Math.min(N,0)+O.y};return P?J:this._transformedRect(J,$)}drawScene(k,P){var $=this.getLayer(),O=k||$.getCanvas(),E=O.getContext(),A=this._getCanvasCache(),D=this.getSceneFunc(),L=this.hasShadow(),M,R,N,B=O.isCache,U=P===this;if(!this.isVisible()&&!U)return this;if(A){E.save();var G=this.getAbsoluteTransform(P).getMatrix();return E.transform(G[0],G[1],G[2],G[3],G[4],G[5]),this._drawCachedSceneCanvas(E),E.restore(),this}if(!D)return this;if(E.save(),this._useBufferCanvas()&&!B){M=this.getStage(),R=M.bufferCanvas,N=R.getContext(),N.clear(),N.save(),N._applyLineJoin(this);var Y=this.getAbsoluteTransform(P).getMatrix();N.transform(Y[0],Y[1],Y[2],Y[3],Y[4],Y[5]),D.call(this,N,this),N.restore();var ee=R.pixelRatio;L&&E._applyShadow(this),E._applyOpacity(this),E._applyGlobalCompositeOperation(this),E.drawImage(R._canvas,0,0,R.width/ee,R.height/ee)}else{if(E._applyLineJoin(this),!U){var Y=this.getAbsoluteTransform(P).getMatrix();E.transform(Y[0],Y[1],Y[2],Y[3],Y[4],Y[5]),E._applyOpacity(this),E._applyGlobalCompositeOperation(this)}L&&E._applyShadow(this),D.call(this,E,this)}return E.restore(),this}drawHit(k,P,$=!1){if(!this.shouldDrawHit(P,$))return this;var O=this.getLayer(),E=k||O.hitCanvas,A=E&&E.getContext(),D=this.hitFunc()||this.sceneFunc(),L=this._getCanvasCache(),M=L&&L.hit;if(this.colorKey||n.Util.warn("Looks like your canvas has a destroyed shape in it. Do not reuse shape after you destroyed it. If you want to reuse shape you should call remove() instead of destroy()"),M){A.save();var R=this.getAbsoluteTransform(P).getMatrix();return A.transform(R[0],R[1],R[2],R[3],R[4],R[5]),this._drawCachedHitCanvas(A),A.restore(),this}if(!D)return this;if(A.save(),A._applyLineJoin(this),!(this===P)){var B=this.getAbsoluteTransform(P).getMatrix();A.transform(B[0],B[1],B[2],B[3],B[4],B[5])}return D.call(this,A,this),A.restore(),this}drawHitFromCache(k=0){var P=this._getCanvasCache(),$=this._getCachedSceneCanvas(),O=P.hit,E=O.getContext(),A=O.getWidth(),D=O.getHeight(),L,M,R,N,B,U;E.clear(),E.drawImage($._canvas,0,0,A,D);try{for(L=E.getImageData(0,0,A,D),M=L.data,R=M.length,N=n.Util._hexToRgb(this.colorKey),B=0;Bk?(M[B]=N.r,M[B+1]=N.g,M[B+2]=N.b,M[B+3]=255):M[B+3]=0;E.putImageData(L,0,0)}catch(G){n.Util.error("Unable to draw hit graph from cached scene canvas. "+G.message)}return this}hasPointerCapture(k){return s.hasPointerCapture(k,this)}setPointerCapture(k){s.setPointerCapture(k,this)}releaseCapture(k){s.releaseCapture(k,this)}}e.Shape=C,C.prototype._fillFunc=m,C.prototype._strokeFunc=_,C.prototype._fillFuncHit=b,C.prototype._strokeFuncHit=v,C.prototype._centroid=!1,C.prototype.nodeType="Shape",(0,a._registerNode)(C),C.prototype.eventListeners={},C.prototype.on.call(C.prototype,"shadowColorChange.konva shadowBlurChange.konva shadowOffsetChange.konva shadowOpacityChange.konva shadowEnabledChange.konva",g),C.prototype.on.call(C.prototype,"shadowColorChange.konva shadowOpacityChange.konva shadowEnabledChange.konva",y),C.prototype.on.call(C.prototype,"fillPriorityChange.konva fillPatternImageChange.konva fillPatternRepeatChange.konva fillPatternScaleXChange.konva fillPatternScaleYChange.konva fillPatternOffsetXChange.konva fillPatternOffsetYChange.konva fillPatternXChange.konva fillPatternYChange.konva fillPatternRotationChange.konva",S),C.prototype.on.call(C.prototype,"fillPriorityChange.konva fillLinearGradientColorStopsChange.konva fillLinearGradientStartPointXChange.konva fillLinearGradientStartPointYChange.konva fillLinearGradientEndPointXChange.konva fillLinearGradientEndPointYChange.konva",w),C.prototype.on.call(C.prototype,"fillPriorityChange.konva fillRadialGradientColorStopsChange.konva fillRadialGradientStartPointXChange.konva fillRadialGradientStartPointYChange.konva fillRadialGradientEndPointXChange.konva fillRadialGradientEndPointYChange.konva fillRadialGradientStartRadiusChange.konva fillRadialGradientEndRadiusChange.konva",x),r.Factory.addGetterSetter(C,"stroke",void 0,(0,o.getStringOrGradientValidator)()),r.Factory.addGetterSetter(C,"strokeWidth",2,(0,o.getNumberValidator)()),r.Factory.addGetterSetter(C,"fillAfterStrokeEnabled",!1),r.Factory.addGetterSetter(C,"hitStrokeWidth","auto",(0,o.getNumberOrAutoValidator)()),r.Factory.addGetterSetter(C,"strokeHitEnabled",!0,(0,o.getBooleanValidator)()),r.Factory.addGetterSetter(C,"perfectDrawEnabled",!0,(0,o.getBooleanValidator)()),r.Factory.addGetterSetter(C,"shadowForStrokeEnabled",!0,(0,o.getBooleanValidator)()),r.Factory.addGetterSetter(C,"lineJoin"),r.Factory.addGetterSetter(C,"lineCap"),r.Factory.addGetterSetter(C,"sceneFunc"),r.Factory.addGetterSetter(C,"hitFunc"),r.Factory.addGetterSetter(C,"dash"),r.Factory.addGetterSetter(C,"dashOffset",0,(0,o.getNumberValidator)()),r.Factory.addGetterSetter(C,"shadowColor",void 0,(0,o.getStringValidator)()),r.Factory.addGetterSetter(C,"shadowBlur",0,(0,o.getNumberValidator)()),r.Factory.addGetterSetter(C,"shadowOpacity",1,(0,o.getNumberValidator)()),r.Factory.addComponentsGetterSetter(C,"shadowOffset",["x","y"]),r.Factory.addGetterSetter(C,"shadowOffsetX",0,(0,o.getNumberValidator)()),r.Factory.addGetterSetter(C,"shadowOffsetY",0,(0,o.getNumberValidator)()),r.Factory.addGetterSetter(C,"fillPatternImage"),r.Factory.addGetterSetter(C,"fill",void 0,(0,o.getStringOrGradientValidator)()),r.Factory.addGetterSetter(C,"fillPatternX",0,(0,o.getNumberValidator)()),r.Factory.addGetterSetter(C,"fillPatternY",0,(0,o.getNumberValidator)()),r.Factory.addGetterSetter(C,"fillLinearGradientColorStops"),r.Factory.addGetterSetter(C,"strokeLinearGradientColorStops"),r.Factory.addGetterSetter(C,"fillRadialGradientStartRadius",0),r.Factory.addGetterSetter(C,"fillRadialGradientEndRadius",0),r.Factory.addGetterSetter(C,"fillRadialGradientColorStops"),r.Factory.addGetterSetter(C,"fillPatternRepeat","repeat"),r.Factory.addGetterSetter(C,"fillEnabled",!0),r.Factory.addGetterSetter(C,"strokeEnabled",!0),r.Factory.addGetterSetter(C,"shadowEnabled",!0),r.Factory.addGetterSetter(C,"dashEnabled",!0),r.Factory.addGetterSetter(C,"strokeScaleEnabled",!0),r.Factory.addGetterSetter(C,"fillPriority","color"),r.Factory.addComponentsGetterSetter(C,"fillPatternOffset",["x","y"]),r.Factory.addGetterSetter(C,"fillPatternOffsetX",0,(0,o.getNumberValidator)()),r.Factory.addGetterSetter(C,"fillPatternOffsetY",0,(0,o.getNumberValidator)()),r.Factory.addComponentsGetterSetter(C,"fillPatternScale",["x","y"]),r.Factory.addGetterSetter(C,"fillPatternScaleX",1,(0,o.getNumberValidator)()),r.Factory.addGetterSetter(C,"fillPatternScaleY",1,(0,o.getNumberValidator)()),r.Factory.addComponentsGetterSetter(C,"fillLinearGradientStartPoint",["x","y"]),r.Factory.addComponentsGetterSetter(C,"strokeLinearGradientStartPoint",["x","y"]),r.Factory.addGetterSetter(C,"fillLinearGradientStartPointX",0),r.Factory.addGetterSetter(C,"strokeLinearGradientStartPointX",0),r.Factory.addGetterSetter(C,"fillLinearGradientStartPointY",0),r.Factory.addGetterSetter(C,"strokeLinearGradientStartPointY",0),r.Factory.addComponentsGetterSetter(C,"fillLinearGradientEndPoint",["x","y"]),r.Factory.addComponentsGetterSetter(C,"strokeLinearGradientEndPoint",["x","y"]),r.Factory.addGetterSetter(C,"fillLinearGradientEndPointX",0),r.Factory.addGetterSetter(C,"strokeLinearGradientEndPointX",0),r.Factory.addGetterSetter(C,"fillLinearGradientEndPointY",0),r.Factory.addGetterSetter(C,"strokeLinearGradientEndPointY",0),r.Factory.addComponentsGetterSetter(C,"fillRadialGradientStartPoint",["x","y"]),r.Factory.addGetterSetter(C,"fillRadialGradientStartPointX",0),r.Factory.addGetterSetter(C,"fillRadialGradientStartPointY",0),r.Factory.addComponentsGetterSetter(C,"fillRadialGradientEndPoint",["x","y"]),r.Factory.addGetterSetter(C,"fillRadialGradientEndPointX",0),r.Factory.addGetterSetter(C,"fillRadialGradientEndPointY",0),r.Factory.addGetterSetter(C,"fillPatternRotation",0),r.Factory.addGetterSetter(C,"fillRule",void 0,(0,o.getStringValidator)()),r.Factory.backCompat(C,{dashArray:"dash",getDashArray:"getDash",setDashArray:"getDash",drawFunc:"sceneFunc",getDrawFunc:"getSceneFunc",setDrawFunc:"setSceneFunc",drawHitFunc:"hitFunc",getDrawHitFunc:"getHitFunc",setDrawHitFunc:"setHitFunc"})})(Yr);Object.defineProperty(Cy,"__esModule",{value:!0});Cy.Layer=void 0;const dl=dr,WC=Gd,mf=rr,vA=At,sO=is,Ewe=Xe,kwe=Yr,Twe=Rt;var Awe="#",Pwe="beforeDraw",Iwe="draw",SG=[{x:0,y:0},{x:-1,y:-1},{x:1,y:-1},{x:1,y:1},{x:-1,y:1}],Rwe=SG.length;class _p extends WC.Container{constructor(t){super(t),this.canvas=new sO.SceneCanvas,this.hitCanvas=new sO.HitCanvas({pixelRatio:1}),this._waitingForDraw=!1,this.on("visibleChange.konva",this._checkVisibility),this._checkVisibility(),this.on("imageSmoothingEnabledChange.konva",this._setSmoothEnabled),this._setSmoothEnabled()}createPNGStream(){return this.canvas._canvas.createPNGStream()}getCanvas(){return this.canvas}getNativeCanvasElement(){return this.canvas._canvas}getHitCanvas(){return this.hitCanvas}getContext(){return this.getCanvas().getContext()}clear(t){return this.getContext().clear(t),this.getHitCanvas().getContext().clear(t),this}setZIndex(t){super.setZIndex(t);var n=this.getStage();return n&&n.content&&(n.content.removeChild(this.getNativeCanvasElement()),t{this.draw(),this._waitingForDraw=!1})),this}getIntersection(t){if(!this.isListening()||!this.isVisible())return null;for(var n=1,r=!1;;){for(let i=0;i0)return{antialiased:!0};return{}}drawScene(t,n){var r=this.getLayer(),i=t||r&&r.getCanvas();return this._fire(Pwe,{node:this}),this.clearBeforeDraw()&&i.getContext().clear(),WC.Container.prototype.drawScene.call(this,i,n),this._fire(Iwe,{node:this}),this}drawHit(t,n){var r=this.getLayer(),i=t||r&&r.hitCanvas;return r&&r.clearBeforeDraw()&&r.getHitCanvas().getContext().clear(),WC.Container.prototype.drawHit.call(this,i,n),this}enableHitGraph(){return this.hitGraphEnabled(!0),this}disableHitGraph(){return this.hitGraphEnabled(!1),this}setHitGraphEnabled(t){dl.Util.warn("hitGraphEnabled method is deprecated. Please use layer.listening() instead."),this.listening(t)}getHitGraphEnabled(t){return dl.Util.warn("hitGraphEnabled method is deprecated. Please use layer.listening() instead."),this.listening()}toggleHitCanvas(){if(!(!this.parent||!this.parent.content)){var t=this.parent,n=!!this.hitCanvas._canvas.parentNode;n?t.content.removeChild(this.hitCanvas._canvas):t.content.appendChild(this.hitCanvas._canvas)}}destroy(){return dl.Util.releaseCanvas(this.getNativeCanvasElement(),this.getHitCanvas()._canvas),super.destroy()}}Cy.Layer=_p;_p.prototype.nodeType="Layer";(0,Twe._registerNode)(_p);vA.Factory.addGetterSetter(_p,"imageSmoothingEnabled",!0);vA.Factory.addGetterSetter(_p,"clearBeforeDraw",!0);vA.Factory.addGetterSetter(_p,"hitGraphEnabled",!0,(0,Ewe.getBooleanValidator)());var ax={};Object.defineProperty(ax,"__esModule",{value:!0});ax.FastLayer=void 0;const Owe=dr,Mwe=Cy,Nwe=Rt;class bA extends Mwe.Layer{constructor(t){super(t),this.listening(!1),Owe.Util.warn('Konva.Fast layer is deprecated. Please use "new Konva.Layer({ listening: false })" instead.')}}ax.FastLayer=bA;bA.prototype.nodeType="FastLayer";(0,Nwe._registerNode)(bA);var Sp={};Object.defineProperty(Sp,"__esModule",{value:!0});Sp.Group=void 0;const $we=dr,Dwe=Gd,Lwe=Rt;class _A extends Dwe.Container{_validateAdd(t){var n=t.getType();n!=="Group"&&n!=="Shape"&&$we.Util.throw("You may only add groups and shapes to groups.")}}Sp.Group=_A;_A.prototype.nodeType="Group";(0,Lwe._registerNode)(_A);var xp={};Object.defineProperty(xp,"__esModule",{value:!0});xp.Animation=void 0;const KC=Rt,lO=dr;var QC=function(){return KC.glob.performance&&KC.glob.performance.now?function(){return KC.glob.performance.now()}:function(){return new Date().getTime()}}();class Is{constructor(t,n){this.id=Is.animIdCounter++,this.frame={time:0,timeDiff:0,lastTime:QC(),frameRate:0},this.func=t,this.setLayers(n)}setLayers(t){var n=[];return t?t.length>0?n=t:n=[t]:n=[],this.layers=n,this}getLayers(){return this.layers}addLayer(t){var n=this.layers,r=n.length,i;for(i=0;ithis.duration?this.yoyo?(this._time=this.duration,this.reverse()):this.finish():p<0?this.yoyo?(this._time=0,this.play()):this.reset():(this._time=p,this.update())}getTime(){return this._time}setPosition(p){this.prevPos=this._pos,this.propFunc(p),this._pos=p}getPosition(p){return p===void 0&&(p=this._time),this.func(p,this.begin,this._change,this.duration)}play(){this.state=s,this._startTime=this.getTimer()-this._time,this.onEnterFrame(),this.fire("onPlay")}reverse(){this.state=l,this._time=this.duration-this._time,this._startTime=this.getTimer()-this._time,this.onEnterFrame(),this.fire("onReverse")}seek(p){this.pause(),this._time=p,this.update(),this.fire("onSeek")}reset(){this.pause(),this._time=0,this.update(),this.fire("onReset")}finish(){this.pause(),this._time=this.duration,this.update(),this.fire("onFinish")}update(){this.setPosition(this.getPosition(this._time)),this.fire("onUpdate")}onEnterFrame(){var p=this.getTimer()-this._startTime;this.state===s?this.setTime(p):this.state===l&&this.setTime(this.duration-p)}pause(){this.state=a,this.fire("onPause")}getTimer(){return new Date().getTime()}}class f{constructor(p){var m=this,_=p.node,b=_._id,v,g=p.easing||e.Easings.Linear,y=!!p.yoyo,S;typeof p.duration>"u"?v=.3:p.duration===0?v=.001:v=p.duration,this.node=_,this._id=u++;var w=_.getLayer()||(_ instanceof i.Konva.Stage?_.getLayers():null);w||t.Util.error("Tween constructor have `node` that is not in a layer. Please add node into layer first."),this.anim=new n.Animation(function(){m.tween.onEnterFrame()},w),this.tween=new d(S,function(x){m._tweenFunc(x)},g,0,1,v*1e3,y),this._addListeners(),f.attrs[b]||(f.attrs[b]={}),f.attrs[b][this._id]||(f.attrs[b][this._id]={}),f.tweens[b]||(f.tweens[b]={});for(S in p)o[S]===void 0&&this._addAttr(S,p[S]);this.reset(),this.onFinish=p.onFinish,this.onReset=p.onReset,this.onUpdate=p.onUpdate}_addAttr(p,m){var _=this.node,b=_._id,v,g,y,S,w,x,C,T;if(y=f.tweens[b][p],y&&delete f.attrs[b][y][p],v=_.getAttr(p),t.Util._isArray(m))if(g=[],w=Math.max(m.length,v.length),p==="points"&&m.length!==v.length&&(m.length>v.length?(C=v,v=t.Util._prepareArrayForTween(v,m,_.closed())):(x=m,m=t.Util._prepareArrayForTween(m,v,_.closed()))),p.indexOf("fill")===0)for(S=0;S{this.anim.start()},this.tween.onReverse=()=>{this.anim.start()},this.tween.onPause=()=>{this.anim.stop()},this.tween.onFinish=()=>{var p=this.node,m=f.attrs[p._id][this._id];m.points&&m.points.trueEnd&&p.setAttr("points",m.points.trueEnd),this.onFinish&&this.onFinish.call(this)},this.tween.onReset=()=>{var p=this.node,m=f.attrs[p._id][this._id];m.points&&m.points.trueStart&&p.points(m.points.trueStart),this.onReset&&this.onReset()},this.tween.onUpdate=()=>{this.onUpdate&&this.onUpdate.call(this)}}play(){return this.tween.play(),this}reverse(){return this.tween.reverse(),this}reset(){return this.tween.reset(),this}seek(p){return this.tween.seek(p*1e3),this}pause(){return this.tween.pause(),this}finish(){return this.tween.finish(),this}destroy(){var p=this.node._id,m=this._id,_=f.tweens[p],b;this.pause();for(b in _)delete f.tweens[p][b];delete f.attrs[p][m]}}e.Tween=f,f.attrs={},f.tweens={},r.Node.prototype.to=function(h){var p=h.onFinish;h.node=this,h.onFinish=function(){this.destroy(),p&&p()};var m=new f(h);m.play()},e.Easings={BackEaseIn(h,p,m,_){var b=1.70158;return m*(h/=_)*h*((b+1)*h-b)+p},BackEaseOut(h,p,m,_){var b=1.70158;return m*((h=h/_-1)*h*((b+1)*h+b)+1)+p},BackEaseInOut(h,p,m,_){var b=1.70158;return(h/=_/2)<1?m/2*(h*h*(((b*=1.525)+1)*h-b))+p:m/2*((h-=2)*h*(((b*=1.525)+1)*h+b)+2)+p},ElasticEaseIn(h,p,m,_,b,v){var g=0;return h===0?p:(h/=_)===1?p+m:(v||(v=_*.3),!b||b0?t:n),c=a*n,d=s*(s>0?t:n),f=l*(l>0?n:t);return{x:u,y:r?-1*f:d,width:c-u,height:f-d}}}sx.Arc=eu;eu.prototype._centroid=!0;eu.prototype.className="Arc";eu.prototype._attrsAffectingSize=["innerRadius","outerRadius"];(0,Bwe._registerNode)(eu);lx.Factory.addGetterSetter(eu,"innerRadius",0,(0,ux.getNumberValidator)());lx.Factory.addGetterSetter(eu,"outerRadius",0,(0,ux.getNumberValidator)());lx.Factory.addGetterSetter(eu,"angle",0,(0,ux.getNumberValidator)());lx.Factory.addGetterSetter(eu,"clockwise",!1,(0,ux.getBooleanValidator)());var cx={},Ey={};Object.defineProperty(Ey,"__esModule",{value:!0});Ey.Line=void 0;const dx=At,zwe=Yr,wG=Xe,jwe=Rt;function WE(e,t,n,r,i,o,a){var s=Math.sqrt(Math.pow(n-e,2)+Math.pow(r-t,2)),l=Math.sqrt(Math.pow(i-n,2)+Math.pow(o-r,2)),u=a*s/(s+l),c=a*l/(s+l),d=n-u*(i-e),f=r-u*(o-t),h=n+c*(i-e),p=r+c*(o-t);return[d,f,h,p]}function cO(e,t){var n=e.length,r=[],i,o;for(i=2;i4){for(s=this.getTensionPoints(),l=s.length,u=o?0:4,o||t.quadraticCurveTo(s[0],s[1],s[2],s[3]);u{let u,c,d;u=l/2,c=0;for(let h=0;h<20;h++)d=u*e.tValues[20][h]+u,c+=e.cValues[20][h]*r(a,s,d);return u*c};e.getCubicArcLength=t;const n=(a,s,l)=>{l===void 0&&(l=1);const u=a[0]-2*a[1]+a[2],c=s[0]-2*s[1]+s[2],d=2*a[1]-2*a[0],f=2*s[1]-2*s[0],h=4*(u*u+c*c),p=4*(u*d+c*f),m=d*d+f*f;if(h===0)return l*Math.sqrt(Math.pow(a[2]-a[0],2)+Math.pow(s[2]-s[0],2));const _=p/(2*h),b=m/h,v=l+_,g=b-_*_,y=v*v+g>0?Math.sqrt(v*v+g):0,S=_*_+g>0?Math.sqrt(_*_+g):0,w=_+Math.sqrt(_*_+g)!==0?g*Math.log(Math.abs((v+y)/(_+S))):0;return Math.sqrt(h)/2*(v*y-_*S+w)};e.getQuadraticArcLength=n;function r(a,s,l){const u=i(1,l,a),c=i(1,l,s),d=u*u+c*c;return Math.sqrt(d)}const i=(a,s,l)=>{const u=l.length-1;let c,d;if(u===0)return 0;if(a===0){d=0;for(let f=0;f<=u;f++)d+=e.binomialCoefficients[u][f]*Math.pow(1-s,u-f)*Math.pow(s,f)*l[f];return d}else{c=new Array(u);for(let f=0;f{let u=1,c=a/s,d=(a-l(c))/s,f=0;for(;u>.001;){const h=l(c+d),p=Math.abs(a-h)/s;if(p500)break}return c};e.t2length=o})(CG);Object.defineProperty(wp,"__esModule",{value:!0});wp.Path=void 0;const Uwe=At,Vwe=Yr,Gwe=Rt,yf=CG;class Vr extends Vwe.Shape{constructor(t){super(t),this.dataArray=[],this.pathLength=0,this._readDataAttribute(),this.on("dataChange.konva",function(){this._readDataAttribute()})}_readDataAttribute(){this.dataArray=Vr.parsePathData(this.data()),this.pathLength=Vr.getPathLength(this.dataArray)}_sceneFunc(t){var n=this.dataArray;t.beginPath();for(var r=!1,i=0;ic?u:c,_=u>c?1:u/c,b=u>c?c/u:1;t.translate(s,l),t.rotate(h),t.scale(_,b),t.arc(0,0,m,d,d+f,1-p),t.scale(1/_,1/b),t.rotate(-h),t.translate(-s,-l);break;case"z":r=!0,t.closePath();break}}!r&&!this.hasFill()?t.strokeShape(this):t.fillStrokeShape(this)}getSelfRect(){var t=[];this.dataArray.forEach(function(u){if(u.command==="A"){var c=u.points[4],d=u.points[5],f=u.points[4]+d,h=Math.PI/180;if(Math.abs(c-f)f;p-=h){const m=Vr.getPointOnEllipticalArc(u.points[0],u.points[1],u.points[2],u.points[3],p,0);t.push(m.x,m.y)}else for(let p=c+h;pn[i].pathLength;)t-=n[i].pathLength,++i;if(i===o)return r=n[i-1].points.slice(-2),{x:r[0],y:r[1]};if(t<.01)return r=n[i].points.slice(0,2),{x:r[0],y:r[1]};var a=n[i],s=a.points;switch(a.command){case"L":return Vr.getPointOnLine(t,a.start.x,a.start.y,s[0],s[1]);case"C":return Vr.getPointOnCubicBezier((0,yf.t2length)(t,Vr.getPathLength(n),m=>(0,yf.getCubicArcLength)([a.start.x,s[0],s[2],s[4]],[a.start.y,s[1],s[3],s[5]],m)),a.start.x,a.start.y,s[0],s[1],s[2],s[3],s[4],s[5]);case"Q":return Vr.getPointOnQuadraticBezier((0,yf.t2length)(t,Vr.getPathLength(n),m=>(0,yf.getQuadraticArcLength)([a.start.x,s[0],s[2]],[a.start.y,s[1],s[3]],m)),a.start.x,a.start.y,s[0],s[1],s[2],s[3]);case"A":var l=s[0],u=s[1],c=s[2],d=s[3],f=s[4],h=s[5],p=s[6];return f+=h*t/a.pathLength,Vr.getPointOnEllipticalArc(l,u,c,d,f,p)}return null}static getPointOnLine(t,n,r,i,o,a,s){a===void 0&&(a=n),s===void 0&&(s=r);var l=(o-r)/(i-n+1e-8),u=Math.sqrt(t*t/(1+l*l));i0&&!isNaN(p[0]);){var v=null,g=[],y=l,S=u,w,x,C,T,k,P,$,O,E,A;switch(h){case"l":l+=p.shift(),u+=p.shift(),v="L",g.push(l,u);break;case"L":l=p.shift(),u=p.shift(),g.push(l,u);break;case"m":var D=p.shift(),L=p.shift();if(l+=D,u+=L,v="M",a.length>2&&a[a.length-1].command==="z"){for(var M=a.length-2;M>=0;M--)if(a[M].command==="M"){l=a[M].points[0]+D,u=a[M].points[1]+L;break}}g.push(l,u),h="l";break;case"M":l=p.shift(),u=p.shift(),v="M",g.push(l,u),h="L";break;case"h":l+=p.shift(),v="L",g.push(l,u);break;case"H":l=p.shift(),v="L",g.push(l,u);break;case"v":u+=p.shift(),v="L",g.push(l,u);break;case"V":u=p.shift(),v="L",g.push(l,u);break;case"C":g.push(p.shift(),p.shift(),p.shift(),p.shift()),l=p.shift(),u=p.shift(),g.push(l,u);break;case"c":g.push(l+p.shift(),u+p.shift(),l+p.shift(),u+p.shift()),l+=p.shift(),u+=p.shift(),v="C",g.push(l,u);break;case"S":x=l,C=u,w=a[a.length-1],w.command==="C"&&(x=l+(l-w.points[2]),C=u+(u-w.points[3])),g.push(x,C,p.shift(),p.shift()),l=p.shift(),u=p.shift(),v="C",g.push(l,u);break;case"s":x=l,C=u,w=a[a.length-1],w.command==="C"&&(x=l+(l-w.points[2]),C=u+(u-w.points[3])),g.push(x,C,l+p.shift(),u+p.shift()),l+=p.shift(),u+=p.shift(),v="C",g.push(l,u);break;case"Q":g.push(p.shift(),p.shift()),l=p.shift(),u=p.shift(),g.push(l,u);break;case"q":g.push(l+p.shift(),u+p.shift()),l+=p.shift(),u+=p.shift(),v="Q",g.push(l,u);break;case"T":x=l,C=u,w=a[a.length-1],w.command==="Q"&&(x=l+(l-w.points[0]),C=u+(u-w.points[1])),l=p.shift(),u=p.shift(),v="Q",g.push(x,C,l,u);break;case"t":x=l,C=u,w=a[a.length-1],w.command==="Q"&&(x=l+(l-w.points[0]),C=u+(u-w.points[1])),l+=p.shift(),u+=p.shift(),v="Q",g.push(x,C,l,u);break;case"A":T=p.shift(),k=p.shift(),P=p.shift(),$=p.shift(),O=p.shift(),E=l,A=u,l=p.shift(),u=p.shift(),v="A",g=this.convertEndpointToCenterParameterization(E,A,l,u,$,O,T,k,P);break;case"a":T=p.shift(),k=p.shift(),P=p.shift(),$=p.shift(),O=p.shift(),E=l,A=u,l+=p.shift(),u+=p.shift(),v="A",g=this.convertEndpointToCenterParameterization(E,A,l,u,$,O,T,k,P);break}a.push({command:v||h,points:g,start:{x:y,y:S},pathLength:this.calcLength(y,S,v||h,g)})}(h==="z"||h==="Z")&&a.push({command:"z",points:[],start:void 0,pathLength:0})}return a}static calcLength(t,n,r,i){var o,a,s,l,u=Vr;switch(r){case"L":return u.getLineLength(t,n,i[0],i[1]);case"C":return(0,yf.getCubicArcLength)([t,i[0],i[2],i[4]],[n,i[1],i[3],i[5]],1);case"Q":return(0,yf.getQuadraticArcLength)([t,i[0],i[2]],[n,i[1],i[3]],1);case"A":o=0;var c=i[4],d=i[5],f=i[4]+d,h=Math.PI/180;if(Math.abs(c-f)f;l-=h)s=u.getPointOnEllipticalArc(i[0],i[1],i[2],i[3],l,0),o+=u.getLineLength(a.x,a.y,s.x,s.y),a=s;else for(l=c+h;l1&&(s*=Math.sqrt(h),l*=Math.sqrt(h));var p=Math.sqrt((s*s*(l*l)-s*s*(f*f)-l*l*(d*d))/(s*s*(f*f)+l*l*(d*d)));o===a&&(p*=-1),isNaN(p)&&(p=0);var m=p*s*f/l,_=p*-l*d/s,b=(t+r)/2+Math.cos(c)*m-Math.sin(c)*_,v=(n+i)/2+Math.sin(c)*m+Math.cos(c)*_,g=function(k){return Math.sqrt(k[0]*k[0]+k[1]*k[1])},y=function(k,P){return(k[0]*P[0]+k[1]*P[1])/(g(k)*g(P))},S=function(k,P){return(k[0]*P[1]=1&&(T=0),a===0&&T>0&&(T=T-2*Math.PI),a===1&&T<0&&(T=T+2*Math.PI),[b,v,s,l,w,T,c,a]}}wp.Path=Vr;Vr.prototype.className="Path";Vr.prototype._attrsAffectingSize=["data"];(0,Gwe._registerNode)(Vr);Uwe.Factory.addGetterSetter(Vr,"data");Object.defineProperty(cx,"__esModule",{value:!0});cx.Arrow=void 0;const fx=At,Hwe=Ey,EG=Xe,qwe=Rt,dO=wp;class qd extends Hwe.Line{_sceneFunc(t){super._sceneFunc(t);var n=Math.PI*2,r=this.points(),i=r,o=this.tension()!==0&&r.length>4;o&&(i=this.getTensionPoints());var a=this.pointerLength(),s=r.length,l,u;if(o){const f=[i[i.length-4],i[i.length-3],i[i.length-2],i[i.length-1],r[s-2],r[s-1]],h=dO.Path.calcLength(i[i.length-4],i[i.length-3],"C",f),p=dO.Path.getPointOnQuadraticBezier(Math.min(1,1-a/h),f[0],f[1],f[2],f[3],f[4],f[5]);l=r[s-2]-p.x,u=r[s-1]-p.y}else l=r[s-2]-r[s-4],u=r[s-1]-r[s-3];var c=(Math.atan2(u,l)+n)%n,d=this.pointerWidth();this.pointerAtEnding()&&(t.save(),t.beginPath(),t.translate(r[s-2],r[s-1]),t.rotate(c),t.moveTo(0,0),t.lineTo(-a,d/2),t.lineTo(-a,-d/2),t.closePath(),t.restore(),this.__fillStroke(t)),this.pointerAtBeginning()&&(t.save(),t.beginPath(),t.translate(r[0],r[1]),o?(l=(i[0]+i[2])/2-r[0],u=(i[1]+i[3])/2-r[1]):(l=r[2]-r[0],u=r[3]-r[1]),t.rotate((Math.atan2(-u,-l)+n)%n),t.moveTo(0,0),t.lineTo(-a,d/2),t.lineTo(-a,-d/2),t.closePath(),t.restore(),this.__fillStroke(t))}__fillStroke(t){var n=this.dashEnabled();n&&(this.attrs.dashEnabled=!1,t.setLineDash([])),t.fillStrokeShape(this),n&&(this.attrs.dashEnabled=!0)}getSelfRect(){const t=super.getSelfRect(),n=this.pointerWidth()/2;return{x:t.x-n,y:t.y-n,width:t.width+n*2,height:t.height+n*2}}}cx.Arrow=qd;qd.prototype.className="Arrow";(0,qwe._registerNode)(qd);fx.Factory.addGetterSetter(qd,"pointerLength",10,(0,EG.getNumberValidator)());fx.Factory.addGetterSetter(qd,"pointerWidth",10,(0,EG.getNumberValidator)());fx.Factory.addGetterSetter(qd,"pointerAtBeginning",!1);fx.Factory.addGetterSetter(qd,"pointerAtEnding",!0);var hx={};Object.defineProperty(hx,"__esModule",{value:!0});hx.Circle=void 0;const Wwe=At,Kwe=Yr,Qwe=Xe,Xwe=Rt;let Cp=class extends Kwe.Shape{_sceneFunc(t){t.beginPath(),t.arc(0,0,this.attrs.radius||0,0,Math.PI*2,!1),t.closePath(),t.fillStrokeShape(this)}getWidth(){return this.radius()*2}getHeight(){return this.radius()*2}setWidth(t){this.radius()!==t/2&&this.radius(t/2)}setHeight(t){this.radius()!==t/2&&this.radius(t/2)}};hx.Circle=Cp;Cp.prototype._centroid=!0;Cp.prototype.className="Circle";Cp.prototype._attrsAffectingSize=["radius"];(0,Xwe._registerNode)(Cp);Wwe.Factory.addGetterSetter(Cp,"radius",0,(0,Qwe.getNumberValidator)());var px={};Object.defineProperty(px,"__esModule",{value:!0});px.Ellipse=void 0;const SA=At,Ywe=Yr,kG=Xe,Zwe=Rt;class wc extends Ywe.Shape{_sceneFunc(t){var n=this.radiusX(),r=this.radiusY();t.beginPath(),t.save(),n!==r&&t.scale(1,r/n),t.arc(0,0,n,0,Math.PI*2,!1),t.restore(),t.closePath(),t.fillStrokeShape(this)}getWidth(){return this.radiusX()*2}getHeight(){return this.radiusY()*2}setWidth(t){this.radiusX(t/2)}setHeight(t){this.radiusY(t/2)}}px.Ellipse=wc;wc.prototype.className="Ellipse";wc.prototype._centroid=!0;wc.prototype._attrsAffectingSize=["radiusX","radiusY"];(0,Zwe._registerNode)(wc);SA.Factory.addComponentsGetterSetter(wc,"radius",["x","y"]);SA.Factory.addGetterSetter(wc,"radiusX",0,(0,kG.getNumberValidator)());SA.Factory.addGetterSetter(wc,"radiusY",0,(0,kG.getNumberValidator)());var gx={};Object.defineProperty(gx,"__esModule",{value:!0});gx.Image=void 0;const XC=dr,Wd=At,Jwe=Yr,eCe=Rt,ky=Xe;let rl=class TG extends Jwe.Shape{constructor(t){super(t),this.on("imageChange.konva",()=>{this._setImageLoad()}),this._setImageLoad()}_setImageLoad(){const t=this.image();t&&t.complete||t&&t.readyState===4||t&&t.addEventListener&&t.addEventListener("load",()=>{this._requestDraw()})}_useBufferCanvas(){return super._useBufferCanvas(!0)}_sceneFunc(t){const n=this.getWidth(),r=this.getHeight(),i=this.cornerRadius(),o=this.attrs.image;let a;if(o){const s=this.attrs.cropWidth,l=this.attrs.cropHeight;s&&l?a=[o,this.cropX(),this.cropY(),s,l,0,0,n,r]:a=[o,0,0,n,r]}(this.hasFill()||this.hasStroke()||i)&&(t.beginPath(),i?XC.Util.drawRoundedRectPath(t,n,r,i):t.rect(0,0,n,r),t.closePath(),t.fillStrokeShape(this)),o&&(i&&t.clip(),t.drawImage.apply(t,a))}_hitFunc(t){var n=this.width(),r=this.height(),i=this.cornerRadius();t.beginPath(),i?XC.Util.drawRoundedRectPath(t,n,r,i):t.rect(0,0,n,r),t.closePath(),t.fillStrokeShape(this)}getWidth(){var t,n;return(t=this.attrs.width)!==null&&t!==void 0?t:(n=this.image())===null||n===void 0?void 0:n.width}getHeight(){var t,n;return(t=this.attrs.height)!==null&&t!==void 0?t:(n=this.image())===null||n===void 0?void 0:n.height}static fromURL(t,n,r=null){var i=XC.Util.createImageElement();i.onload=function(){var o=new TG({image:i});n(o)},i.onerror=r,i.crossOrigin="Anonymous",i.src=t}};gx.Image=rl;rl.prototype.className="Image";(0,eCe._registerNode)(rl);Wd.Factory.addGetterSetter(rl,"cornerRadius",0,(0,ky.getNumberOrArrayOfNumbersValidator)(4));Wd.Factory.addGetterSetter(rl,"image");Wd.Factory.addComponentsGetterSetter(rl,"crop",["x","y","width","height"]);Wd.Factory.addGetterSetter(rl,"cropX",0,(0,ky.getNumberValidator)());Wd.Factory.addGetterSetter(rl,"cropY",0,(0,ky.getNumberValidator)());Wd.Factory.addGetterSetter(rl,"cropWidth",0,(0,ky.getNumberValidator)());Wd.Factory.addGetterSetter(rl,"cropHeight",0,(0,ky.getNumberValidator)());var np={};Object.defineProperty(np,"__esModule",{value:!0});np.Tag=np.Label=void 0;const mx=At,tCe=Yr,nCe=Sp,xA=Xe,AG=Rt;var PG=["fontFamily","fontSize","fontStyle","padding","lineHeight","text","width","height","pointerDirection","pointerWidth","pointerHeight"],rCe="Change.konva",iCe="none",KE="up",QE="right",XE="down",YE="left",oCe=PG.length;class wA extends nCe.Group{constructor(t){super(t),this.on("add.konva",function(n){this._addListeners(n.child),this._sync()})}getText(){return this.find("Text")[0]}getTag(){return this.find("Tag")[0]}_addListeners(t){var n=this,r,i=function(){n._sync()};for(r=0;r{n=Math.min(n,a.x),r=Math.max(r,a.x),i=Math.min(i,a.y),o=Math.max(o,a.y)}),{x:n,y:i,width:r-n,height:o-i}}getWidth(){return this.radius()*2}getHeight(){return this.radius()*2}setWidth(t){this.radius(t/2)}setHeight(t){this.radius(t/2)}}vx.RegularPolygon=Qd;Qd.prototype.className="RegularPolygon";Qd.prototype._centroid=!0;Qd.prototype._attrsAffectingSize=["radius"];(0,fCe._registerNode)(Qd);IG.Factory.addGetterSetter(Qd,"radius",0,(0,RG.getNumberValidator)());IG.Factory.addGetterSetter(Qd,"sides",0,(0,RG.getNumberValidator)());var bx={};Object.defineProperty(bx,"__esModule",{value:!0});bx.Ring=void 0;const OG=At,hCe=Yr,MG=Xe,pCe=Rt;var fO=Math.PI*2;class Xd extends hCe.Shape{_sceneFunc(t){t.beginPath(),t.arc(0,0,this.innerRadius(),0,fO,!1),t.moveTo(this.outerRadius(),0),t.arc(0,0,this.outerRadius(),fO,0,!0),t.closePath(),t.fillStrokeShape(this)}getWidth(){return this.outerRadius()*2}getHeight(){return this.outerRadius()*2}setWidth(t){this.outerRadius(t/2)}setHeight(t){this.outerRadius(t/2)}}bx.Ring=Xd;Xd.prototype.className="Ring";Xd.prototype._centroid=!0;Xd.prototype._attrsAffectingSize=["innerRadius","outerRadius"];(0,pCe._registerNode)(Xd);OG.Factory.addGetterSetter(Xd,"innerRadius",0,(0,MG.getNumberValidator)());OG.Factory.addGetterSetter(Xd,"outerRadius",0,(0,MG.getNumberValidator)());var _x={};Object.defineProperty(_x,"__esModule",{value:!0});_x.Sprite=void 0;const Yd=At,gCe=Yr,mCe=xp,NG=Xe,yCe=Rt;class il extends gCe.Shape{constructor(t){super(t),this._updated=!0,this.anim=new mCe.Animation(()=>{var n=this._updated;return this._updated=!1,n}),this.on("animationChange.konva",function(){this.frameIndex(0)}),this.on("frameIndexChange.konva",function(){this._updated=!0}),this.on("frameRateChange.konva",function(){this.anim.isRunning()&&(clearInterval(this.interval),this._setInterval())})}_sceneFunc(t){var n=this.animation(),r=this.frameIndex(),i=r*4,o=this.animations()[n],a=this.frameOffsets(),s=o[i+0],l=o[i+1],u=o[i+2],c=o[i+3],d=this.image();if((this.hasFill()||this.hasStroke())&&(t.beginPath(),t.rect(0,0,u,c),t.closePath(),t.fillStrokeShape(this)),d)if(a){var f=a[n],h=r*2;t.drawImage(d,s,l,u,c,f[h+0],f[h+1],u,c)}else t.drawImage(d,s,l,u,c,0,0,u,c)}_hitFunc(t){var n=this.animation(),r=this.frameIndex(),i=r*4,o=this.animations()[n],a=this.frameOffsets(),s=o[i+2],l=o[i+3];if(t.beginPath(),a){var u=a[n],c=r*2;t.rect(u[c+0],u[c+1],s,l)}else t.rect(0,0,s,l);t.closePath(),t.fillShape(this)}_useBufferCanvas(){return super._useBufferCanvas(!0)}_setInterval(){var t=this;this.interval=setInterval(function(){t._updateIndex()},1e3/this.frameRate())}start(){if(!this.isRunning()){var t=this.getLayer();this.anim.setLayers(t),this._setInterval(),this.anim.start()}}stop(){this.anim.stop(),clearInterval(this.interval)}isRunning(){return this.anim.isRunning()}_updateIndex(){var t=this.frameIndex(),n=this.animation(),r=this.animations(),i=r[n],o=i.length/4;t{t=t.trim();const n=t.indexOf(" ")>=0,r=t.indexOf('"')>=0||t.indexOf("'")>=0;return n&&!r&&(t=`"${t}"`),t}).join(", ")}var Uv;function ZC(){return Uv||(Uv=ZE.Util.createCanvasElement().getContext(CCe),Uv)}function $Ce(e){e.fillText(this._partialText,this._partialTextX,this._partialTextY)}function DCe(e){e.setAttr("miterLimit",2),e.strokeText(this._partialText,this._partialTextX,this._partialTextY)}function LCe(e){return e=e||{},!e.fillLinearGradientColorStops&&!e.fillRadialGradientColorStops&&!e.fillPatternImage&&(e.fill=e.fill||"black"),e}let Tr=class extends _Ce.Shape{constructor(t){super(LCe(t)),this._partialTextX=0,this._partialTextY=0;for(var n=0;n1&&(b+=a)}}}_hitFunc(t){var n=this.getWidth(),r=this.getHeight();t.beginPath(),t.rect(0,0,n,r),t.closePath(),t.fillStrokeShape(this)}setText(t){var n=ZE.Util._isString(t)?t:t==null?"":t+"";return this._setAttr(ECe,n),this}getWidth(){var t=this.attrs.width===vf||this.attrs.width===void 0;return t?this.getTextWidth()+this.padding()*2:this.attrs.width}getHeight(){var t=this.attrs.height===vf||this.attrs.height===void 0;return t?this.fontSize()*this.textArr.length*this.lineHeight()+this.padding()*2:this.attrs.height}getTextWidth(){return this.textWidth}getTextHeight(){return ZE.Util.warn("text.getTextHeight() method is deprecated. Use text.height() - for full height and text.fontSize() - for one line height."),this.textHeight}measureSize(t){var n=ZC(),r=this.fontSize(),i;return n.save(),n.font=this._getContextFont(),i=n.measureText(t),n.restore(),{width:i.width,height:r}}_getContextFont(){return this.fontStyle()+jv+this.fontVariant()+jv+(this.fontSize()+PCe)+NCe(this.fontFamily())}_addTextLine(t){this.align()===Jp&&(t=t.trim());var r=this._getTextWidth(t);return this.textArr.push({text:t,width:r,lastInParagraph:!1})}_getTextWidth(t){var n=this.letterSpacing(),r=t.length;return ZC().measureText(t).width+(r?n*(r-1):0)}_setTextData(){var t=this.text().split(` -`),n=+this.fontSize(),r=0,i=this.lineHeight()*n,o=this.attrs.width,a=this.attrs.height,s=o!==vf&&o!==void 0,l=a!==vf&&a!==void 0,u=this.padding(),c=o-u*2,d=a-u*2,f=0,h=this.wrap(),p=h!==gO,m=h!==OCe&&p,_=this.ellipsis();this.textArr=[],ZC().font=this._getContextFont();for(var b=_?this._getTextWidth(YC):0,v=0,g=t.length;vc)for(;y.length>0;){for(var w=0,x=y.length,C="",T=0;w>>1,P=y.slice(0,k+1),$=this._getTextWidth(P)+b;$<=c?(w=k+1,C=P,T=$):x=k}if(C){if(m){var O,E=y[C.length],A=E===jv||E===hO;A&&T<=c?O=C.length:O=Math.max(C.lastIndexOf(jv),C.lastIndexOf(hO))+1,O>0&&(w=O,C=C.slice(0,w),T=this._getTextWidth(C))}C=C.trimRight(),this._addTextLine(C),r=Math.max(r,T),f+=i;var D=this._shouldHandleEllipsis(f);if(D){this._tryToAddEllipsisToLastLine();break}if(y=y.slice(w),y=y.trimLeft(),y.length>0&&(S=this._getTextWidth(y),S<=c)){this._addTextLine(y),f+=i,r=Math.max(r,S);break}}else break}else this._addTextLine(y),f+=i,r=Math.max(r,S),this._shouldHandleEllipsis(f)&&vd)break}this.textHeight=n,this.textWidth=r}_shouldHandleEllipsis(t){var n=+this.fontSize(),r=this.lineHeight()*n,i=this.attrs.height,o=i!==vf&&i!==void 0,a=this.padding(),s=i-a*2,l=this.wrap(),u=l!==gO;return!u||o&&t+r>s}_tryToAddEllipsisToLastLine(){var t=this.attrs.width,n=t!==vf&&t!==void 0,r=this.padding(),i=t-r*2,o=this.ellipsis(),a=this.textArr[this.textArr.length-1];if(!(!a||!o)){if(n){var s=this._getTextWidth(a.text+YC)n?null:eg.Path.getPointAtLengthOfDataArray(t,this.dataArray)}_readDataAttribute(){this.dataArray=eg.Path.parsePathData(this.attrs.data),this.pathLength=this._getTextPathLength()}_sceneFunc(t){t.setAttr("font",this._getContextFont()),t.setAttr("textBaseline",this.textBaseline()),t.setAttr("textAlign","left"),t.save();var n=this.textDecoration(),r=this.fill(),i=this.fontSize(),o=this.glyphInfo;n==="underline"&&t.beginPath();for(var a=0;a=1){var r=n[0].p0;t.moveTo(r.x,r.y)}for(var i=0;ie+`.${VG}`).join(" "),vO="nodesRect",HCe=["widthChange","heightChange","scaleXChange","scaleYChange","skewXChange","skewYChange","rotationChange","offsetXChange","offsetYChange","transformsEnabledChange","strokeWidthChange"],qCe={"top-left":-45,"top-center":0,"top-right":45,"middle-right":-90,"middle-left":90,"bottom-left":-135,"bottom-center":180,"bottom-right":135};const WCe="ontouchstart"in za.Konva._global;function KCe(e,t){if(e==="rotater")return"crosshair";t+=Cn.Util.degToRad(qCe[e]||0);var n=(Cn.Util.radToDeg(t)%360+360)%360;return Cn.Util._inRange(n,315+22.5,360)||Cn.Util._inRange(n,0,22.5)?"ns-resize":Cn.Util._inRange(n,45-22.5,45+22.5)?"nesw-resize":Cn.Util._inRange(n,90-22.5,90+22.5)?"ew-resize":Cn.Util._inRange(n,135-22.5,135+22.5)?"nwse-resize":Cn.Util._inRange(n,180-22.5,180+22.5)?"ns-resize":Cn.Util._inRange(n,225-22.5,225+22.5)?"nesw-resize":Cn.Util._inRange(n,270-22.5,270+22.5)?"ew-resize":Cn.Util._inRange(n,315-22.5,315+22.5)?"nwse-resize":(Cn.Util.error("Transformer has unknown angle for cursor detection: "+n),"pointer")}var L_=["top-left","top-center","top-right","middle-right","middle-left","bottom-left","bottom-center","bottom-right"],bO=1e8;function QCe(e){return{x:e.x+e.width/2*Math.cos(e.rotation)+e.height/2*Math.sin(-e.rotation),y:e.y+e.height/2*Math.cos(e.rotation)+e.width/2*Math.sin(e.rotation)}}function GG(e,t,n){const r=n.x+(e.x-n.x)*Math.cos(t)-(e.y-n.y)*Math.sin(t),i=n.y+(e.x-n.x)*Math.sin(t)+(e.y-n.y)*Math.cos(t);return Object.assign(Object.assign({},e),{rotation:e.rotation+t,x:r,y:i})}function XCe(e,t){const n=QCe(e);return GG(e,t,n)}function YCe(e,t,n){let r=t;for(let i=0;ii.isAncestorOf(this)?(Cn.Util.error("Konva.Transformer cannot be an a child of the node you are trying to attach"),!1):!0);this._nodes=t=n,t.length===1&&this.useSingleNodeRotation()?this.rotation(t[0].getAbsoluteRotation()):this.rotation(0),this._nodes.forEach(i=>{const o=()=>{this.nodes().length===1&&this.useSingleNodeRotation()&&this.rotation(this.nodes()[0].getAbsoluteRotation()),this._resetTransformCache(),!this._transforming&&!this.isDragging()&&this.update()},a=i._attrsAffectingSize.map(s=>s+"Change."+this._getEventNamespace()).join(" ");i.on(a,o),i.on(HCe.map(s=>s+`.${this._getEventNamespace()}`).join(" "),o),i.on(`absoluteTransformChange.${this._getEventNamespace()}`,o),this._proxyDrag(i)}),this._resetTransformCache();var r=!!this.findOne(".top-left");return r&&this.update(),this}_proxyDrag(t){let n;t.on(`dragstart.${this._getEventNamespace()}`,r=>{n=t.getAbsolutePosition(),!this.isDragging()&&t!==this.findOne(".back")&&this.startDrag(r,!1)}),t.on(`dragmove.${this._getEventNamespace()}`,r=>{if(!n)return;const i=t.getAbsolutePosition(),o=i.x-n.x,a=i.y-n.y;this.nodes().forEach(s=>{if(s===t||s.isDragging())return;const l=s.getAbsolutePosition();s.setAbsolutePosition({x:l.x+o,y:l.y+a}),s.startDrag(r)}),n=null})}getNodes(){return this._nodes||[]}getActiveAnchor(){return this._movingAnchorName}detach(){this._nodes&&this._nodes.forEach(t=>{t.off("."+this._getEventNamespace())}),this._nodes=[],this._resetTransformCache()}_resetTransformCache(){this._clearCache(vO),this._clearCache("transform"),this._clearSelfAndDescendantCache("absoluteTransform")}_getNodeRect(){return this._getCache(vO,this.__getNodeRect)}__getNodeShape(t,n=this.rotation(),r){var i=t.getClientRect({skipTransform:!0,skipShadow:!0,skipStroke:this.ignoreStroke()}),o=t.getAbsoluteScale(r),a=t.getAbsolutePosition(r),s=i.x*o.x-t.offsetX()*o.x,l=i.y*o.y-t.offsetY()*o.y;const u=(za.Konva.getAngle(t.getAbsoluteRotation())+Math.PI*2)%(Math.PI*2),c={x:a.x+s*Math.cos(u)+l*Math.sin(-u),y:a.y+l*Math.cos(u)+s*Math.sin(u),width:i.width*o.x,height:i.height*o.y,rotation:u};return GG(c,-za.Konva.getAngle(n),{x:0,y:0})}__getNodeRect(){var t=this.getNode();if(!t)return{x:-bO,y:-bO,width:0,height:0,rotation:0};const n=[];this.nodes().map(u=>{const c=u.getClientRect({skipTransform:!0,skipShadow:!0,skipStroke:this.ignoreStroke()});var d=[{x:c.x,y:c.y},{x:c.x+c.width,y:c.y},{x:c.x+c.width,y:c.y+c.height},{x:c.x,y:c.y+c.height}],f=u.getAbsoluteTransform();d.forEach(function(h){var p=f.point(h);n.push(p)})});const r=new Cn.Transform;r.rotate(-za.Konva.getAngle(this.rotation()));var i,o,a,s;n.forEach(function(u){var c=r.point(u);i===void 0&&(i=a=c.x,o=s=c.y),i=Math.min(i,c.x),o=Math.min(o,c.y),a=Math.max(a,c.x),s=Math.max(s,c.y)}),r.invert();const l=r.point({x:i,y:o});return{x:l.x,y:l.y,width:a-i,height:s-o,rotation:za.Konva.getAngle(this.rotation())}}getX(){return this._getNodeRect().x}getY(){return this._getNodeRect().y}getWidth(){return this._getNodeRect().width}getHeight(){return this._getNodeRect().height}_createElements(){this._createBack(),L_.forEach((function(t){this._createAnchor(t)}).bind(this)),this._createAnchor("rotater")}_createAnchor(t){var n=new UCe.Rect({stroke:"rgb(0, 161, 255)",fill:"white",strokeWidth:1,name:t+" _anchor",dragDistance:0,draggable:!0,hitStrokeWidth:WCe?10:"auto"}),r=this;n.on("mousedown touchstart",function(i){r._handleMouseDown(i)}),n.on("dragstart",i=>{n.stopDrag(),i.cancelBubble=!0}),n.on("dragend",i=>{i.cancelBubble=!0}),n.on("mouseenter",()=>{var i=za.Konva.getAngle(this.rotation()),o=KCe(t,i);n.getStage().content&&(n.getStage().content.style.cursor=o),this._cursorChange=!0}),n.on("mouseout",()=>{n.getStage().content&&(n.getStage().content.style.cursor=""),this._cursorChange=!1}),this.add(n)}_createBack(){var t=new jCe.Shape({name:"back",width:0,height:0,draggable:!0,sceneFunc(n){var r=this.getParent(),i=r.padding();n.beginPath(),n.rect(-i,-i,this.width()+i*2,this.height()+i*2),n.moveTo(this.width()/2,-i),r.rotateEnabled()&&n.lineTo(this.width()/2,-r.rotateAnchorOffset()*Cn.Util._sign(this.height())-i),n.fillStrokeShape(this)},hitFunc:(n,r)=>{if(this.shouldOverdrawWholeArea()){var i=this.padding();n.beginPath(),n.rect(-i,-i,r.width()+i*2,r.height()+i*2),n.fillStrokeShape(r)}}});this.add(t),this._proxyDrag(t),t.on("dragstart",n=>{n.cancelBubble=!0}),t.on("dragmove",n=>{n.cancelBubble=!0}),t.on("dragend",n=>{n.cancelBubble=!0}),this.on("dragmove",n=>{this.update()})}_handleMouseDown(t){this._movingAnchorName=t.target.name().split(" ")[0];var n=this._getNodeRect(),r=n.width,i=n.height,o=Math.sqrt(Math.pow(r,2)+Math.pow(i,2));this.sin=Math.abs(i/o),this.cos=Math.abs(r/o),typeof window<"u"&&(window.addEventListener("mousemove",this._handleMouseMove),window.addEventListener("touchmove",this._handleMouseMove),window.addEventListener("mouseup",this._handleMouseUp,!0),window.addEventListener("touchend",this._handleMouseUp,!0)),this._transforming=!0;var a=t.target.getAbsolutePosition(),s=t.target.getStage().getPointerPosition();this._anchorDragOffset={x:s.x-a.x,y:s.y-a.y},this._fire("transformstart",{evt:t.evt,target:this.getNode()}),this._nodes.forEach(l=>{l._fire("transformstart",{evt:t.evt,target:l})})}_handleMouseMove(t){var n,r,i,o=this.findOne("."+this._movingAnchorName),a=o.getStage();a.setPointersPositions(t);const s=a.getPointerPosition();let l={x:s.x-this._anchorDragOffset.x,y:s.y-this._anchorDragOffset.y};const u=o.getAbsolutePosition();this.anchorDragBoundFunc()&&(l=this.anchorDragBoundFunc()(u,l,t)),o.setAbsolutePosition(l);const c=o.getAbsolutePosition();if(!(u.x===c.x&&u.y===c.y)){if(this._movingAnchorName==="rotater"){var d=this._getNodeRect();n=o.x()-d.width/2,r=-o.y()+d.height/2;let O=Math.atan2(-r,n)+Math.PI/2;d.height<0&&(O-=Math.PI);var f=za.Konva.getAngle(this.rotation());const E=f+O,A=za.Konva.getAngle(this.rotationSnapTolerance()),L=YCe(this.rotationSnaps(),E,A)-d.rotation,M=XCe(d,L);this._fitNodesInto(M,t);return}var h=this.shiftBehavior(),p;h==="inverted"?p=this.keepRatio()&&!t.shiftKey:h==="none"?p=this.keepRatio():p=this.keepRatio()||t.shiftKey;var g=this.centeredScaling()||t.altKey;if(this._movingAnchorName==="top-left"){if(p){var m=g?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".bottom-right").x(),y:this.findOne(".bottom-right").y()};i=Math.sqrt(Math.pow(m.x-o.x(),2)+Math.pow(m.y-o.y(),2));var _=this.findOne(".top-left").x()>m.x?-1:1,b=this.findOne(".top-left").y()>m.y?-1:1;n=i*this.cos*_,r=i*this.sin*b,this.findOne(".top-left").x(m.x-n),this.findOne(".top-left").y(m.y-r)}}else if(this._movingAnchorName==="top-center")this.findOne(".top-left").y(o.y());else if(this._movingAnchorName==="top-right"){if(p){var m=g?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".bottom-left").x(),y:this.findOne(".bottom-left").y()};i=Math.sqrt(Math.pow(o.x()-m.x,2)+Math.pow(m.y-o.y(),2));var _=this.findOne(".top-right").x()m.y?-1:1;n=i*this.cos*_,r=i*this.sin*b,this.findOne(".top-right").x(m.x+n),this.findOne(".top-right").y(m.y-r)}var v=o.position();this.findOne(".top-left").y(v.y),this.findOne(".bottom-right").x(v.x)}else if(this._movingAnchorName==="middle-left")this.findOne(".top-left").x(o.x());else if(this._movingAnchorName==="middle-right")this.findOne(".bottom-right").x(o.x());else if(this._movingAnchorName==="bottom-left"){if(p){var m=g?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".top-right").x(),y:this.findOne(".top-right").y()};i=Math.sqrt(Math.pow(m.x-o.x(),2)+Math.pow(o.y()-m.y,2));var _=m.x{r._fire("transformend",{evt:t,target:r})}),this._movingAnchorName=null}}_fitNodesInto(t,n){var r=this._getNodeRect();const i=1;if(Cn.Util._inRange(t.width,-this.padding()*2-i,i)){this.update();return}if(Cn.Util._inRange(t.height,-this.padding()*2-i,i)){this.update();return}const o=this.flipEnabled();var a=new Cn.Transform;if(a.rotate(za.Konva.getAngle(this.rotation())),this._movingAnchorName&&t.width<0&&this._movingAnchorName.indexOf("left")>=0){const d=a.point({x:-this.padding()*2,y:0});if(t.x+=d.x,t.y+=d.y,t.width+=this.padding()*2,this._movingAnchorName=this._movingAnchorName.replace("left","right"),this._anchorDragOffset.x-=d.x,this._anchorDragOffset.y-=d.y,!o){this.update();return}}else if(this._movingAnchorName&&t.width<0&&this._movingAnchorName.indexOf("right")>=0){const d=a.point({x:this.padding()*2,y:0});if(this._movingAnchorName=this._movingAnchorName.replace("right","left"),this._anchorDragOffset.x-=d.x,this._anchorDragOffset.y-=d.y,t.width+=this.padding()*2,!o){this.update();return}}if(this._movingAnchorName&&t.height<0&&this._movingAnchorName.indexOf("top")>=0){const d=a.point({x:0,y:-this.padding()*2});if(t.x+=d.x,t.y+=d.y,this._movingAnchorName=this._movingAnchorName.replace("top","bottom"),this._anchorDragOffset.x-=d.x,this._anchorDragOffset.y-=d.y,t.height+=this.padding()*2,!o){this.update();return}}else if(this._movingAnchorName&&t.height<0&&this._movingAnchorName.indexOf("bottom")>=0){const d=a.point({x:0,y:this.padding()*2});if(this._movingAnchorName=this._movingAnchorName.replace("bottom","top"),this._anchorDragOffset.x-=d.x,this._anchorDragOffset.y-=d.y,t.height+=this.padding()*2,!o){this.update();return}}if(this.boundBoxFunc()){const d=this.boundBoxFunc()(r,t);d?t=d:Cn.Util.warn("boundBoxFunc returned falsy. You should return new bound rect from it!")}const s=1e7,l=new Cn.Transform;l.translate(r.x,r.y),l.rotate(r.rotation),l.scale(r.width/s,r.height/s);const u=new Cn.Transform;u.translate(t.x,t.y),u.rotate(t.rotation),u.scale(t.width/s,t.height/s);const c=u.multiply(l.invert());this._nodes.forEach(d=>{var f;const h=d.getParent().getAbsoluteTransform(),p=d.getTransform().copy();p.translate(d.offsetX(),d.offsetY());const m=new Cn.Transform;m.multiply(h.copy().invert()).multiply(c).multiply(h).multiply(p);const _=m.decompose();d.setAttrs(_),this._fire("transform",{evt:n,target:d}),d._fire("transform",{evt:n,target:d}),(f=d.getLayer())===null||f===void 0||f.batchDraw()}),this.rotation(Cn.Util._getRotation(t.rotation)),this._resetTransformCache(),this.update(),this.getLayer().batchDraw()}forceUpdate(){this._resetTransformCache(),this.update()}_batchChangeChild(t,n){this.findOne(t).setAttrs(n)}update(){var t,n=this._getNodeRect();this.rotation(Cn.Util._getRotation(n.rotation));var r=n.width,i=n.height,o=this.enabledAnchors(),a=this.resizeEnabled(),s=this.padding(),l=this.anchorSize();const u=this.find("._anchor");u.forEach(d=>{d.setAttrs({width:l,height:l,offsetX:l/2,offsetY:l/2,stroke:this.anchorStroke(),strokeWidth:this.anchorStrokeWidth(),fill:this.anchorFill(),cornerRadius:this.anchorCornerRadius()})}),this._batchChangeChild(".top-left",{x:0,y:0,offsetX:l/2+s,offsetY:l/2+s,visible:a&&o.indexOf("top-left")>=0}),this._batchChangeChild(".top-center",{x:r/2,y:0,offsetY:l/2+s,visible:a&&o.indexOf("top-center")>=0}),this._batchChangeChild(".top-right",{x:r,y:0,offsetX:l/2-s,offsetY:l/2+s,visible:a&&o.indexOf("top-right")>=0}),this._batchChangeChild(".middle-left",{x:0,y:i/2,offsetX:l/2+s,visible:a&&o.indexOf("middle-left")>=0}),this._batchChangeChild(".middle-right",{x:r,y:i/2,offsetX:l/2-s,visible:a&&o.indexOf("middle-right")>=0}),this._batchChangeChild(".bottom-left",{x:0,y:i,offsetX:l/2+s,offsetY:l/2-s,visible:a&&o.indexOf("bottom-left")>=0}),this._batchChangeChild(".bottom-center",{x:r/2,y:i,offsetY:l/2-s,visible:a&&o.indexOf("bottom-center")>=0}),this._batchChangeChild(".bottom-right",{x:r,y:i,offsetX:l/2-s,offsetY:l/2-s,visible:a&&o.indexOf("bottom-right")>=0}),this._batchChangeChild(".rotater",{x:r/2,y:-this.rotateAnchorOffset()*Cn.Util._sign(i)-s,visible:this.rotateEnabled()}),this._batchChangeChild(".back",{width:r,height:i,visible:this.borderEnabled(),stroke:this.borderStroke(),strokeWidth:this.borderStrokeWidth(),dash:this.borderDash(),x:0,y:0});const c=this.anchorStyleFunc();c&&u.forEach(d=>{c(d)}),(t=this.getLayer())===null||t===void 0||t.batchDraw()}isTransforming(){return this._transforming}stopTransform(){if(this._transforming){this._removeEvents();var t=this.findOne("."+this._movingAnchorName);t&&t.stopDrag()}}destroy(){return this.getStage()&&this._cursorChange&&this.getStage().content&&(this.getStage().content.style.cursor=""),yO.Group.prototype.destroy.call(this),this.detach(),this._removeEvents(),this}toObject(){return mO.Node.prototype.toObject.call(this)}clone(t){var n=mO.Node.prototype.clone.call(this,t);return n}getClientRect(){return this.nodes().length>0?super.getClientRect():{x:0,y:0,width:0,height:0}}}wx.Transformer=Zt;function ZCe(e){return e instanceof Array||Cn.Util.warn("enabledAnchors value should be an array"),e instanceof Array&&e.forEach(function(t){L_.indexOf(t)===-1&&Cn.Util.warn("Unknown anchor name: "+t+". Available names are: "+L_.join(", "))}),e||[]}Zt.prototype.className="Transformer";(0,VCe._registerNode)(Zt);vn.Factory.addGetterSetter(Zt,"enabledAnchors",L_,ZCe);vn.Factory.addGetterSetter(Zt,"flipEnabled",!0,(0,kc.getBooleanValidator)());vn.Factory.addGetterSetter(Zt,"resizeEnabled",!0);vn.Factory.addGetterSetter(Zt,"anchorSize",10,(0,kc.getNumberValidator)());vn.Factory.addGetterSetter(Zt,"rotateEnabled",!0);vn.Factory.addGetterSetter(Zt,"rotationSnaps",[]);vn.Factory.addGetterSetter(Zt,"rotateAnchorOffset",50,(0,kc.getNumberValidator)());vn.Factory.addGetterSetter(Zt,"rotationSnapTolerance",5,(0,kc.getNumberValidator)());vn.Factory.addGetterSetter(Zt,"borderEnabled",!0);vn.Factory.addGetterSetter(Zt,"anchorStroke","rgb(0, 161, 255)");vn.Factory.addGetterSetter(Zt,"anchorStrokeWidth",1,(0,kc.getNumberValidator)());vn.Factory.addGetterSetter(Zt,"anchorFill","white");vn.Factory.addGetterSetter(Zt,"anchorCornerRadius",0,(0,kc.getNumberValidator)());vn.Factory.addGetterSetter(Zt,"borderStroke","rgb(0, 161, 255)");vn.Factory.addGetterSetter(Zt,"borderStrokeWidth",1,(0,kc.getNumberValidator)());vn.Factory.addGetterSetter(Zt,"borderDash");vn.Factory.addGetterSetter(Zt,"keepRatio",!0);vn.Factory.addGetterSetter(Zt,"shiftBehavior","default");vn.Factory.addGetterSetter(Zt,"centeredScaling",!1);vn.Factory.addGetterSetter(Zt,"ignoreStroke",!1);vn.Factory.addGetterSetter(Zt,"padding",0,(0,kc.getNumberValidator)());vn.Factory.addGetterSetter(Zt,"node");vn.Factory.addGetterSetter(Zt,"nodes");vn.Factory.addGetterSetter(Zt,"boundBoxFunc");vn.Factory.addGetterSetter(Zt,"anchorDragBoundFunc");vn.Factory.addGetterSetter(Zt,"anchorStyleFunc");vn.Factory.addGetterSetter(Zt,"shouldOverdrawWholeArea",!1);vn.Factory.addGetterSetter(Zt,"useSingleNodeRotation",!0);vn.Factory.backCompat(Zt,{lineEnabled:"borderEnabled",rotateHandlerOffset:"rotateAnchorOffset",enabledHandlers:"enabledAnchors"});var Cx={};Object.defineProperty(Cx,"__esModule",{value:!0});Cx.Wedge=void 0;const Ex=At,JCe=Yr,e5e=Rt,HG=Xe,t5e=Rt;class tu extends JCe.Shape{_sceneFunc(t){t.beginPath(),t.arc(0,0,this.radius(),0,e5e.Konva.getAngle(this.angle()),this.clockwise()),t.lineTo(0,0),t.closePath(),t.fillStrokeShape(this)}getWidth(){return this.radius()*2}getHeight(){return this.radius()*2}setWidth(t){this.radius(t/2)}setHeight(t){this.radius(t/2)}}Cx.Wedge=tu;tu.prototype.className="Wedge";tu.prototype._centroid=!0;tu.prototype._attrsAffectingSize=["radius"];(0,t5e._registerNode)(tu);Ex.Factory.addGetterSetter(tu,"radius",0,(0,HG.getNumberValidator)());Ex.Factory.addGetterSetter(tu,"angle",0,(0,HG.getNumberValidator)());Ex.Factory.addGetterSetter(tu,"clockwise",!1);Ex.Factory.backCompat(tu,{angleDeg:"angle",getAngleDeg:"getAngle",setAngleDeg:"setAngle"});var kx={};Object.defineProperty(kx,"__esModule",{value:!0});kx.Blur=void 0;const _O=At,n5e=rr,r5e=Xe;function SO(){this.r=0,this.g=0,this.b=0,this.a=0,this.next=null}var i5e=[512,512,456,512,328,456,335,512,405,328,271,456,388,335,292,512,454,405,364,328,298,271,496,456,420,388,360,335,312,292,273,512,482,454,428,405,383,364,345,328,312,298,284,271,259,496,475,456,437,420,404,388,374,360,347,335,323,312,302,292,282,273,265,512,497,482,468,454,441,428,417,405,394,383,373,364,354,345,337,328,320,312,305,298,291,284,278,271,265,259,507,496,485,475,465,456,446,437,428,420,412,404,396,388,381,374,367,360,354,347,341,335,329,323,318,312,307,302,297,292,287,282,278,273,269,265,261,512,505,497,489,482,475,468,461,454,447,441,435,428,422,417,411,405,399,394,389,383,378,373,368,364,359,354,350,345,341,337,332,328,324,320,316,312,309,305,301,298,294,291,287,284,281,278,274,271,268,265,262,259,257,507,501,496,491,485,480,475,470,465,460,456,451,446,442,437,433,428,424,420,416,412,408,404,400,396,392,388,385,381,377,374,370,367,363,360,357,354,350,347,344,341,338,335,332,329,326,323,320,318,315,312,310,307,304,302,299,297,294,292,289,287,285,282,280,278,275,273,271,269,267,265,263,261,259],o5e=[9,11,12,13,13,14,14,15,15,15,15,16,16,16,16,17,17,17,17,17,17,17,18,18,18,18,18,18,18,18,18,19,19,19,19,19,19,19,19,19,19,19,19,19,19,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24];function a5e(e,t){var n=e.data,r=e.width,i=e.height,o,a,s,l,u,c,d,f,h,p,m,_,b,v,g,y,S,w,x,C,T,k,P,$,O=t+t+1,E=r-1,A=i-1,D=t+1,L=D*(D+1)/2,M=new SO,R=null,N=M,B=null,U=null,G=i5e[t],Y=o5e[t];for(s=1;s>Y,P!==0?(P=255/P,n[c]=(f*G>>Y)*P,n[c+1]=(h*G>>Y)*P,n[c+2]=(p*G>>Y)*P):n[c]=n[c+1]=n[c+2]=0,f-=_,h-=b,p-=v,m-=g,_-=B.r,b-=B.g,v-=B.b,g-=B.a,l=d+((l=o+t+1)>Y,P>0?(P=255/P,n[l]=(f*G>>Y)*P,n[l+1]=(h*G>>Y)*P,n[l+2]=(p*G>>Y)*P):n[l]=n[l+1]=n[l+2]=0,f-=_,h-=b,p-=v,m-=g,_-=B.r,b-=B.g,v-=B.b,g-=B.a,l=o+((l=a+D)0&&a5e(t,n)};kx.Blur=s5e;_O.Factory.addGetterSetter(n5e.Node,"blurRadius",0,(0,r5e.getNumberValidator)(),_O.Factory.afterSetFilter);var Tx={};Object.defineProperty(Tx,"__esModule",{value:!0});Tx.Brighten=void 0;const xO=At,l5e=rr,u5e=Xe,c5e=function(e){var t=this.brightness()*255,n=e.data,r=n.length,i;for(i=0;i255?255:i,o=o<0?0:o>255?255:o,a=a<0?0:a>255?255:a,n[s]=i,n[s+1]=o,n[s+2]=a};Ax.Contrast=h5e;wO.Factory.addGetterSetter(d5e.Node,"contrast",0,(0,f5e.getNumberValidator)(),wO.Factory.afterSetFilter);var Px={};Object.defineProperty(Px,"__esModule",{value:!0});Px.Emboss=void 0;const lc=At,Ix=rr,p5e=dr,qG=Xe,g5e=function(e){var t=this.embossStrength()*10,n=this.embossWhiteLevel()*255,r=this.embossDirection(),i=this.embossBlend(),o=0,a=0,s=e.data,l=e.width,u=e.height,c=l*4,d=u;switch(r){case"top-left":o=-1,a=-1;break;case"top":o=-1,a=0;break;case"top-right":o=-1,a=1;break;case"right":o=0,a=1;break;case"bottom-right":o=1,a=1;break;case"bottom":o=1,a=0;break;case"bottom-left":o=1,a=-1;break;case"left":o=0,a=-1;break;default:p5e.Util.error("Unknown emboss direction: "+r)}do{var f=(d-1)*c,h=o;d+h<1&&(h=0),d+h>u&&(h=0);var p=(d-1+h)*l*4,m=l;do{var _=f+(m-1)*4,b=a;m+b<1&&(b=0),m+b>l&&(b=0);var v=p+(m-1+b)*4,g=s[_]-s[v],y=s[_+1]-s[v+1],S=s[_+2]-s[v+2],w=g,x=w>0?w:-w,C=y>0?y:-y,T=S>0?S:-S;if(C>x&&(w=y),T>x&&(w=S),w*=t,i){var k=s[_]+w,P=s[_+1]+w,$=s[_+2]+w;s[_]=k>255?255:k<0?0:k,s[_+1]=P>255?255:P<0?0:P,s[_+2]=$>255?255:$<0?0:$}else{var O=n-w;O<0?O=0:O>255&&(O=255),s[_]=s[_+1]=s[_+2]=O}}while(--m)}while(--d)};Px.Emboss=g5e;lc.Factory.addGetterSetter(Ix.Node,"embossStrength",.5,(0,qG.getNumberValidator)(),lc.Factory.afterSetFilter);lc.Factory.addGetterSetter(Ix.Node,"embossWhiteLevel",.5,(0,qG.getNumberValidator)(),lc.Factory.afterSetFilter);lc.Factory.addGetterSetter(Ix.Node,"embossDirection","top-left",null,lc.Factory.afterSetFilter);lc.Factory.addGetterSetter(Ix.Node,"embossBlend",!1,null,lc.Factory.afterSetFilter);var Rx={};Object.defineProperty(Rx,"__esModule",{value:!0});Rx.Enhance=void 0;const CO=At,m5e=rr,y5e=Xe;function t5(e,t,n,r,i){var o=n-t,a=i-r,s;return o===0?r+a/2:a===0?r:(s=(e-t)/o,s=a*s+r,s)}const v5e=function(e){var t=e.data,n=t.length,r=t[0],i=r,o,a=t[1],s=a,l,u=t[2],c=u,d,f,h=this.enhance();if(h!==0){for(f=0;fi&&(i=o),l=t[f+1],ls&&(s=l),d=t[f+2],dc&&(c=d);i===r&&(i=255,r=0),s===a&&(s=255,a=0),c===u&&(c=255,u=0);var p,m,_,b,v,g,y,S,w;for(h>0?(m=i+h*(255-i),_=r-h*(r-0),v=s+h*(255-s),g=a-h*(a-0),S=c+h*(255-c),w=u-h*(u-0)):(p=(i+r)*.5,m=i+h*(i-p),_=r+h*(r-p),b=(s+a)*.5,v=s+h*(s-b),g=a+h*(a-b),y=(c+u)*.5,S=c+h*(c-y),w=u+h*(u-y)),f=0;fb?_:b;var v=a,g=o,y,S,w=360/g*Math.PI/180,x,C;for(S=0;Sg?v:g;var y=a,S=o,w,x,C=n.polarRotation||0,T,k;for(c=0;ct&&(y=g,S=0,w=-1),i=0;i=0&&h=0&&p=0&&h=0&&p=255*4?255:0}return a}function M5e(e,t,n){for(var r=[.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111],i=Math.round(Math.sqrt(r.length)),o=Math.floor(i/2),a=[],s=0;s=0&&h=0&&p=n))for(o=m;o<_;o+=1)o>=r||(a=(n*o+i)*4,s+=y[a+0],l+=y[a+1],u+=y[a+2],c+=y[a+3],g+=1);for(s=s/g,l=l/g,u=u/g,c=c/g,i=h;i=n))for(o=m;o<_;o+=1)o>=r||(a=(n*o+i)*4,y[a+0]=s,y[a+1]=l,y[a+2]=u,y[a+3]=c)}};Bx.Pixelate=j5e;AO.Factory.addGetterSetter(B5e.Node,"pixelSize",8,(0,z5e.getNumberValidator)(),AO.Factory.afterSetFilter);var zx={};Object.defineProperty(zx,"__esModule",{value:!0});zx.Posterize=void 0;const PO=At,U5e=rr,V5e=Xe,G5e=function(e){var t=Math.round(this.levels()*254)+1,n=e.data,r=n.length,i=255/t,o;for(o=0;o255?255:e<0?0:Math.round(e)});B_.Factory.addGetterSetter(IA.Node,"green",0,function(e){return this._filterUpToDate=!1,e>255?255:e<0?0:Math.round(e)});B_.Factory.addGetterSetter(IA.Node,"blue",0,H5e.RGBComponent,B_.Factory.afterSetFilter);var Ux={};Object.defineProperty(Ux,"__esModule",{value:!0});Ux.RGBA=void 0;const v0=At,Vx=rr,W5e=Xe,K5e=function(e){var t=e.data,n=t.length,r=this.red(),i=this.green(),o=this.blue(),a=this.alpha(),s,l;for(s=0;s255?255:e<0?0:Math.round(e)});v0.Factory.addGetterSetter(Vx.Node,"green",0,function(e){return this._filterUpToDate=!1,e>255?255:e<0?0:Math.round(e)});v0.Factory.addGetterSetter(Vx.Node,"blue",0,W5e.RGBComponent,v0.Factory.afterSetFilter);v0.Factory.addGetterSetter(Vx.Node,"alpha",1,function(e){return this._filterUpToDate=!1,e>1?1:e<0?0:e});var Gx={};Object.defineProperty(Gx,"__esModule",{value:!0});Gx.Sepia=void 0;const Q5e=function(e){var t=e.data,n=t.length,r,i,o,a;for(r=0;r127&&(u=255-u),c>127&&(c=255-c),d>127&&(d=255-d),t[l]=u,t[l+1]=c,t[l+2]=d}while(--s)}while(--o)};Hx.Solarize=X5e;var qx={};Object.defineProperty(qx,"__esModule",{value:!0});qx.Threshold=void 0;const IO=At,Y5e=rr,Z5e=Xe,J5e=function(e){var t=this.threshold()*255,n=e.data,r=n.length,i;for(i=0;i{const{width:r,height:i}=t,o=document.createElement("div"),a=new ng.Stage({container:o,width:r,height:i}),s=new ng.Layer,l=new ng.Layer;return s.add(new ng.Rect({...t,fill:n?"black":"white"})),e.forEach(u=>l.add(new ng.Line({points:u.points,stroke:n?"white":"black",strokeWidth:u.strokeWidth*2,tension:0,lineCap:"round",lineJoin:"round",shadowForStrokeEnabled:!1,globalCompositeOperation:u.tool==="brush"?"source-over":"destination-out"}))),a.add(s),a.add(l),o.remove(),a},B3e=async(e,t,n)=>new Promise((r,i)=>{const o=document.createElement("canvas");o.width=t,o.height=n;const a=o.getContext("2d"),s=new Image;if(!a){o.remove(),i("Unable to get context");return}s.onload=function(){a.drawImage(s,0,0),o.remove(),r(a.getImageData(0,0,t,n))},s.src=e}),MO=async(e,t)=>{const n=e.toDataURL(t);return await B3e(n,t.width,t.height)},RA=async(e,t,n,r,i)=>{const o=Ce("canvas"),a=J2(),s=Mxe();if(!a||!s){o.error("Unable to find canvas / stage");return}const l={...t,...n},u=a.clone();u.scale({x:1,y:1});const c=u.getAbsolutePosition(),d={x:l.x+c.x,y:l.y+c.y,width:l.width,height:l.height},f=await $_(u,d),h=await MO(u,d),p=await F3e(r?e.objects.filter(xB):[],l,i),m=await $_(p,l),_=await MO(p,l);return{baseBlob:f,baseImageData:h,maskBlob:m,maskImageData:_}},z3e=()=>{Be({actionCreator:kxe,effect:async(e,{dispatch:t,getState:n})=>{const r=Ce("canvas"),i=n(),o=await RA(i.canvas.layerState,i.canvas.boundingBoxCoordinates,i.canvas.boundingBoxDimensions,i.canvas.isMaskEnabled,i.canvas.shouldPreserveMaskedArea);if(!o)return;const{maskBlob:a}=o;if(!a){r.error("Problem getting mask layer blob"),t(Gt({title:Z("toast.problemSavingMask"),description:Z("toast.problemSavingMaskDesc"),status:"error"}));return}const{autoAddBoardId:s}=i.gallery;t(me.endpoints.uploadImage.initiate({file:new File([a],"canvasMaskImage.png",{type:"image/png"}),image_category:"mask",is_intermediate:!1,board_id:s==="none"?void 0:s,crop_visible:!0,postUploadAction:{type:"TOAST",toastOptions:{title:Z("toast.maskSavedAssets")}}}))}})},j3e=()=>{Be({actionCreator:Rxe,effect:async(e,{dispatch:t,getState:n})=>{const r=Ce("canvas"),i=n(),o=await RA(i.canvas.layerState,i.canvas.boundingBoxCoordinates,i.canvas.boundingBoxDimensions,i.canvas.isMaskEnabled,i.canvas.shouldPreserveMaskedArea);if(!o)return;const{maskBlob:a}=o;if(!a){r.error("Problem getting mask layer blob"),t(Gt({title:Z("toast.problemImportingMask"),description:Z("toast.problemImportingMaskDesc"),status:"error"}));return}const{autoAddBoardId:s}=i.gallery,l=await t(me.endpoints.uploadImage.initiate({file:new File([a],"canvasMaskImage.png",{type:"image/png"}),image_category:"mask",is_intermediate:!1,board_id:s==="none"?void 0:s,crop_visible:!1,postUploadAction:{type:"TOAST",toastOptions:{title:Z("toast.maskSentControlnetAssets")}}})).unwrap(),{image_name:u}=l;t(Sc({controlNetId:e.payload.controlNet.controlNetId,controlImage:u}))}})},U3e=async()=>{const e=J2();if(!e)return;const t=e.clone();return t.scale({x:1,y:1}),$_(t,t.getClientRect())},V3e=()=>{Be({actionCreator:Pxe,effect:async(e,{dispatch:t})=>{const n=_2.get().child({namespace:"canvasCopiedToClipboardListener"}),r=await U3e();if(!r){n.error("Problem getting base layer blob"),t(Gt({title:Z("toast.problemMergingCanvas"),description:Z("toast.problemMergingCanvasDesc"),status:"error"}));return}const i=J2();if(!i){n.error("Problem getting canvas base layer"),t(Gt({title:Z("toast.problemMergingCanvas"),description:Z("toast.problemMergingCanvasDesc"),status:"error"}));return}const o=i.getClientRect({relativeTo:i.getParent()}),a=await t(me.endpoints.uploadImage.initiate({file:new File([r],"mergedCanvas.png",{type:"image/png"}),image_category:"general",is_intermediate:!0,postUploadAction:{type:"TOAST",toastOptions:{title:Z("toast.canvasMerged")}}})).unwrap(),{image_name:s}=a;t(sle({kind:"image",layer:"base",imageName:s,...o}))}})},G3e=()=>{Be({actionCreator:Exe,effect:async(e,{dispatch:t,getState:n})=>{const r=Ce("canvas"),i=n();let o;try{o=await ex(i)}catch(s){r.error(String(s)),t(Gt({title:Z("toast.problemSavingCanvas"),description:Z("toast.problemSavingCanvasDesc"),status:"error"}));return}const{autoAddBoardId:a}=i.gallery;t(me.endpoints.uploadImage.initiate({file:new File([o],"savedCanvas.png",{type:"image/png"}),image_category:"general",is_intermediate:!1,board_id:a==="none"?void 0:a,crop_visible:!0,postUploadAction:{type:"TOAST",toastOptions:{title:Z("toast.canvasSavedGallery")}}}))}})},H3e=(e,t,n)=>{var c;if(!(o0e.match(e)||zR.match(e)||Sc.match(e)||a0e.match(e)||jR.match(e))||jR.match(e)&&((c=n.controlNet.controlNets[e.payload.controlNetId])==null?void 0:c.shouldAutoConfig)===!0)return!1;const i=t.controlNet.controlNets[e.payload.controlNetId];if(!i)return!1;const{controlImage:o,processorType:a,shouldAutoConfig:s}=i;return zR.match(e)&&!s?!1:a!=="none"&&!!o},q3e=()=>{Be({predicate:H3e,effect:async(e,{dispatch:t,cancelActiveListeners:n,delay:r})=>{const i=Ce("session"),{controlNetId:o}=e.payload;n(),i.trace("ControlNet auto-process triggered"),await r(300),t(HT({controlNetId:o}))}})},Fe="positive_conditioning",We="negative_conditioning",Oe="denoise_latents",Ke="latents_to_image",Za="save_image",md="nsfw_checker",Wc="invisible_watermark",Le="noise",Tc="main_model_loader",Wx="onnx_model_loader",ys="vae_loader",QG="lora_loader",Yt="clip_skip",Hn="image_to_latents",Rs="resize_image",vh="img2img_resize",ye="canvas_output",Wn="inpaint_image",Ai="inpaint_image_resize_up",Hi="inpaint_image_resize_down",Wt="inpaint_infill",$u="inpaint_infill_resize_down",qn="inpaint_create_mask",pt="canvas_coherence_denoise_latents",Ut="canvas_coherence_noise",uc="canvas_coherence_noise_increment",mr="canvas_coherence_mask_edge",zt="canvas_coherence_inpaint_create_mask",bh="tomask",Ui="mask_blur",ki="mask_combine",Mn="mask_resize_up",qi="mask_resize_down",Gv="control_net_collect",W3e="ip_adapter",ht="metadata_accumulator",n5="esrgan",Vi="sdxl_model_loader",ke="sdxl_denoise_latents",$c="sdxl_refiner_model_loader",Hv="sdxl_refiner_positive_conditioning",qv="sdxl_refiner_negative_conditioning",vs="sdxl_refiner_denoise_latents",ca="refiner_inpaint_create_mask",qr="seamless",Qa="refiner_seamless",XG="text_to_image_graph",JE="image_to_image_graph",YG="canvas_text_to_image_graph",e4="canvas_image_to_image_graph",Kx="canvas_inpaint_graph",Qx="canvas_outpaint_graph",OA="sdxl_text_to_image_graph",z_="sxdl_image_to_image_graph",Xx="sdxl_canvas_text_to_image_graph",b0="sdxl_canvas_image_to_image_graph",cc="sdxl_canvas_inpaint_graph",dc="sdxl_canvas_outpaint_graph",ZG=e=>(e==null?void 0:e.type)==="image_output",K3e=()=>{Be({actionCreator:HT,effect:async(e,{dispatch:t,getState:n,take:r})=>{var l;const i=Ce("session"),{controlNetId:o}=e.payload,a=n().controlNet.controlNets[o];if(!(a!=null&&a.controlImage)){i.error("Unable to process ControlNet image");return}const s={nodes:{[a.processorNode.id]:{...a.processorNode,is_intermediate:!0,image:{image_name:a.controlImage}},[Za]:{id:Za,type:"save_image",is_intermediate:!0,use_cache:!1}},edges:[{source:{node_id:a.processorNode.id,field:"image"},destination:{node_id:Za,field:"image"}}]};try{const u=t(Qr.endpoints.enqueueGraph.initiate({graph:s,prepend:!0},{fixedCacheKey:"enqueueGraph"})),c=await u.unwrap();u.reset(),i.debug({enqueueResult:Qt(c)},Z("queue.graphQueued"));const[d]=await r(f=>jT.match(f)&&f.payload.data.graph_execution_state_id===c.queue_item.session_id&&f.payload.data.source_node_id===Za);if(ZG(d.payload.data.result)){const{image_name:f}=d.payload.data.result.image,[{payload:h}]=await r(m=>me.endpoints.getImageDTO.matchFulfilled(m)&&m.payload.image_name===f),p=h;i.debug({controlNetId:e.payload,processedControlImage:p},"ControlNet image processed"),t(qT({controlNetId:o,processedControlImage:p.image_name}))}}catch(u){if(i.error({graph:Qt(s)},Z("queue.graphFailedToQueue")),u instanceof Object&&"data"in u&&"status"in u&&u.status===403){const c=((l=u.data)==null?void 0:l.detail)||"Unknown Error";t(Gt({title:Z("queue.graphFailedToQueue"),status:"error",description:c,duration:15e3})),t(l0e()),t(Sc({controlNetId:o,controlImage:null}));return}t(Gt({title:Z("queue.graphFailedToQueue"),status:"error"}))}}})},MA=Ne("app/enqueueRequested");Ne("app/batchEnqueued");const Q3e=e=>{const t=window.open("");t&&e.forEach(n=>{const r=new Image;r.src=n.base64,t.document.write(n.caption),t.document.write("
"),t.document.write(r.outerHTML),t.document.write("

")})},NO=e=>new Promise((t,n)=>{const r=new FileReader;r.onload=i=>t(r.result),r.onerror=i=>n(r.error),r.onabort=i=>n(new Error("Read aborted")),r.readAsDataURL(e)}),X3e=e=>{let t=!0,n=!1;const r=e.length;let i=3;for(i;i{const t=e.length;let n=0;for(n;n{const{isPartiallyTransparent:n,isFullyTransparent:r}=X3e(e.data),i=Y3e(t.data);return n?r?"txt2img":"outpaint":i?"inpaint":"img2img"},J3e=e=>_oe(e,n=>n.isEnabled&&(!!n.processedControlImage||n.processorType==="none"&&!!n.controlImage)),Aa=(e,t,n)=>{const{isEnabled:r,controlNets:i}=e.controlNet,o=J3e(i),a=t.nodes[ht];if(r&&o.length&&o.length){const s={id:Gv,type:"collect",is_intermediate:!0};t.nodes[Gv]=s,t.edges.push({source:{node_id:Gv,field:"collection"},destination:{node_id:n,field:"control"}}),o.forEach(l=>{const{controlNetId:u,controlImage:c,processedControlImage:d,beginStepPct:f,endStepPct:h,controlMode:p,resizeMode:m,model:_,processorType:b,weight:v}=l,g={id:`control_net_${u}`,type:"controlnet",is_intermediate:!0,begin_step_percent:f,end_step_percent:h,control_mode:p,resize_mode:m,control_model:_,control_weight:v};if(d&&b!=="none")g.image={image_name:d};else if(c)g.image={image_name:c};else return;if(t.nodes[g.id]=g,a!=null&&a.controlnets){const y=qS(g,["id","type"]);a.controlnets.push(y)}t.edges.push({source:{node_id:g.id,field:"control"},destination:{node_id:Gv,field:"item"}}),pt in t.nodes&&t.edges.push({source:{node_id:g.id,field:"control"},destination:{node_id:pt,field:"control"}})})}},Pa=(e,t,n)=>{var a,s,l,u;const{isIPAdapterEnabled:r,ipAdapterInfo:i}=e.controlNet,o=t.nodes[ht];if(r&&i.model){const c={id:W3e,type:"ip_adapter",is_intermediate:!0,weight:i.weight,ip_adapter_model:{base_model:(a=i.model)==null?void 0:a.base_model,model_name:(s=i.model)==null?void 0:s.model_name},begin_step_percent:i.beginStepPct,end_step_percent:i.endStepPct};if(i.adapterImage)c.image={image_name:i.adapterImage};else return;if(t.nodes[c.id]=c,o!=null&&o.ipAdapters){const d={image:{image_name:i.adapterImage},ip_adapter_model:{base_model:(l=i.model)==null?void 0:l.base_model,model_name:(u=i.model)==null?void 0:u.model_name},weight:i.weight,begin_step_percent:i.beginStepPct,end_step_percent:i.endStepPct};o.ipAdapters.push(d)}t.edges.push({source:{node_id:c.id,field:"ip_adapter"},destination:{node_id:n,field:"ip_adapter"}}),pt in t.nodes&&t.edges.push({source:{node_id:c.id,field:"ip_adapter"},destination:{node_id:pt,field:"ip_adapter"}})}},Ep=(e,t,n,r=Tc)=>{const{loras:i}=e.lora,o=WS(i),a=t.nodes[ht];o>0&&(t.edges=t.edges.filter(u=>!(u.source.node_id===r&&["unet"].includes(u.source.field))),t.edges=t.edges.filter(u=>!(u.source.node_id===Yt&&["clip"].includes(u.source.field))));let s="",l=0;Ca(i,u=>{const{model_name:c,base_model:d,weight:f}=u,h=`${QG}_${c.replace(".","_")}`,p={type:"lora_loader",id:h,is_intermediate:!0,lora:{model_name:c,base_model:d},weight:f};a!=null&&a.loras&&a.loras.push({lora:{model_name:c,base_model:d},weight:f}),t.nodes[h]=p,l===0?(t.edges.push({source:{node_id:r,field:"unet"},destination:{node_id:h,field:"unet"}}),t.edges.push({source:{node_id:Yt,field:"clip"},destination:{node_id:h,field:"clip"}})):(t.edges.push({source:{node_id:s,field:"unet"},destination:{node_id:h,field:"unet"}}),t.edges.push({source:{node_id:s,field:"clip"},destination:{node_id:h,field:"clip"}})),l===o-1&&(t.edges.push({source:{node_id:h,field:"unet"},destination:{node_id:n,field:"unet"}}),t.id&&[Kx,Qx].includes(t.id)&&t.edges.push({source:{node_id:h,field:"unet"},destination:{node_id:pt,field:"unet"}}),t.edges.push({source:{node_id:h,field:"clip"},destination:{node_id:Fe,field:"clip"}}),t.edges.push({source:{node_id:h,field:"clip"},destination:{node_id:We,field:"clip"}})),s=h,l+=1})},Ia=(e,t,n=Ke)=>{const r=t.nodes[n];if(!r)return;r.is_intermediate=!0,r.use_cache=!0;const i={id:md,type:"img_nsfw",is_intermediate:!0};t.nodes[md]=i,t.edges.push({source:{node_id:n,field:"image"},destination:{node_id:md,field:"image"}})},eEe=["txt2img","img2img","unifiedCanvas","nodes","modelManager","queue"],NA=Ii(e=>e,({ui:e})=>uT(e.activeTab)?e.activeTab:"txt2img"),KWe=Ii(e=>e,({ui:e,config:t})=>{const r=eEe.filter(i=>!t.disabledTabs.includes(i)).indexOf(e.activeTab);return r===-1?0:r}),QWe=Ii(e=>e.ui,e=>e,{memoizeOptions:{equalityCheck:cT}}),Ra=(e,t)=>{const r=NA(e)==="unifiedCanvas"?!e.canvas.shouldAutoSave:!1,{autoAddBoardId:i}=e.gallery,o={id:Za,type:"save_image",is_intermediate:r,use_cache:!1,board:i==="none"?void 0:{board_id:i}};t.nodes[Za]=o,t.nodes[ht]&&t.edges.push({source:{node_id:ht,field:"metadata"},destination:{node_id:Za,field:"metadata"}});const s={node_id:Za,field:"image"};Wc in t.nodes?t.edges.push({source:{node_id:Wc,field:"image"},destination:s}):md in t.nodes?t.edges.push({source:{node_id:md,field:"image"},destination:s}):ye in t.nodes?t.edges.push({source:{node_id:ye,field:"image"},destination:s}):Ke in t.nodes&&t.edges.push({source:{node_id:Ke,field:"image"},destination:s})},Oa=(e,t,n)=>{const{seamlessXAxis:r,seamlessYAxis:i}=e.generation;t.nodes[qr]={id:qr,type:"seamless",seamless_x:r,seamless_y:i};let o=Oe;(t.id===OA||t.id===z_||t.id===Xx||t.id===b0||t.id===cc||t.id===dc)&&(o=ke),t.edges=t.edges.filter(a=>!(a.source.node_id===n&&["unet"].includes(a.source.field))&&!(a.source.node_id===n&&["vae"].includes(a.source.field))),t.edges.push({source:{node_id:n,field:"unet"},destination:{node_id:qr,field:"unet"}},{source:{node_id:n,field:"vae"},destination:{node_id:qr,field:"vae"}},{source:{node_id:qr,field:"unet"},destination:{node_id:o,field:"unet"}}),(t.id==Kx||t.id===Qx||t.id===cc||t.id===dc)&&t.edges.push({source:{node_id:qr,field:"unet"},destination:{node_id:pt,field:"unet"}})},Ma=(e,t,n=Tc)=>{const{vae:r,canvasCoherenceMode:i}=e.generation,{boundingBoxScaleMethod:o}=e.canvas,{shouldUseSDXLRefiner:a}=e.sdxl,s=["auto","manual"].includes(o),l=!r,u=t.nodes[ht];l||(t.nodes[ys]={type:"vae_loader",id:ys,is_intermediate:!0,vae_model:r});const c=n==Wx;(t.id===XG||t.id===JE||t.id===OA||t.id===z_)&&t.edges.push({source:{node_id:l?n:ys,field:l&&c?"vae_decoder":"vae"},destination:{node_id:Ke,field:"vae"}}),(t.id===YG||t.id===e4||t.id===Xx||t.id==b0)&&t.edges.push({source:{node_id:l?n:ys,field:l&&c?"vae_decoder":"vae"},destination:{node_id:s?Ke:ye,field:"vae"}}),(t.id===JE||t.id===z_||t.id===e4||t.id===b0)&&t.edges.push({source:{node_id:l?n:ys,field:l&&c?"vae_decoder":"vae"},destination:{node_id:Hn,field:"vae"}}),(t.id===Kx||t.id===Qx||t.id===cc||t.id===dc)&&(t.edges.push({source:{node_id:l?n:ys,field:l&&c?"vae_decoder":"vae"},destination:{node_id:Wn,field:"vae"}},{source:{node_id:l?n:ys,field:l&&c?"vae_decoder":"vae"},destination:{node_id:qn,field:"vae"}},{source:{node_id:l?n:ys,field:l&&c?"vae_decoder":"vae"},destination:{node_id:Ke,field:"vae"}}),i!=="unmasked"&&t.edges.push({source:{node_id:l?n:ys,field:l&&c?"vae_decoder":"vae"},destination:{node_id:zt,field:"vae"}})),a&&(t.id===cc||t.id===dc)&&t.edges.push({source:{node_id:l?n:ys,field:l&&c?"vae_decoder":"vae"},destination:{node_id:ca,field:"vae"}}),r&&u&&(u.vae=r)},Na=(e,t,n=Ke)=>{const i=NA(e)==="unifiedCanvas"?!e.canvas.shouldAutoSave:!1,o=t.nodes[n],a=t.nodes[md],s=t.nodes[ht];if(!o)return;const l={id:Wc,type:"img_watermark",is_intermediate:i};t.nodes[Wc]=l,o.is_intermediate=!0,o.use_cache=!0,a?(a.is_intermediate=!0,t.edges.push({source:{node_id:md,field:"image"},destination:{node_id:Wc,field:"image"}})):t.edges.push({source:{node_id:n,field:"image"},destination:{node_id:Wc,field:"image"}}),s&&t.edges.push({source:{node_id:ht,field:"metadata"},destination:{node_id:Wc,field:"metadata"}})},tEe=(e,t)=>{const n=Ce("nodes"),{positivePrompt:r,negativePrompt:i,model:o,cfgScale:a,scheduler:s,seed:l,steps:u,img2imgStrength:c,vaePrecision:d,clipSkip:f,shouldUseCpuNoise:h,seamlessXAxis:p,seamlessYAxis:m}=e.generation,{width:_,height:b}=e.canvas.boundingBoxDimensions,{scaledBoundingBoxDimensions:v,boundingBoxScaleMethod:g}=e.canvas,y=d==="fp32",S=!0,w=["auto","manual"].includes(g);if(!o)throw n.error("No model found in state"),new Error("No model found in state");let x=Tc;const C=h,T={id:e4,nodes:{[x]:{type:"main_model_loader",id:x,is_intermediate:S,model:o},[Yt]:{type:"clip_skip",id:Yt,is_intermediate:S,skipped_layers:f},[Fe]:{type:"compel",id:Fe,is_intermediate:S,prompt:r},[We]:{type:"compel",id:We,is_intermediate:S,prompt:i},[Le]:{type:"noise",id:Le,is_intermediate:S,use_cpu:C,seed:l,width:w?v.width:_,height:w?v.height:b},[Hn]:{type:"i2l",id:Hn,is_intermediate:S},[Oe]:{type:"denoise_latents",id:Oe,is_intermediate:S,cfg_scale:a,scheduler:s,steps:u,denoising_start:1-c,denoising_end:1},[ye]:{type:"l2i",id:ye,is_intermediate:S}},edges:[{source:{node_id:x,field:"unet"},destination:{node_id:Oe,field:"unet"}},{source:{node_id:x,field:"clip"},destination:{node_id:Yt,field:"clip"}},{source:{node_id:Yt,field:"clip"},destination:{node_id:Fe,field:"clip"}},{source:{node_id:Yt,field:"clip"},destination:{node_id:We,field:"clip"}},{source:{node_id:Fe,field:"conditioning"},destination:{node_id:Oe,field:"positive_conditioning"}},{source:{node_id:We,field:"conditioning"},destination:{node_id:Oe,field:"negative_conditioning"}},{source:{node_id:Le,field:"noise"},destination:{node_id:Oe,field:"noise"}},{source:{node_id:Hn,field:"latents"},destination:{node_id:Oe,field:"latents"}}]};return w?(T.nodes[vh]={id:vh,type:"img_resize",is_intermediate:S,image:t,width:v.width,height:v.height},T.nodes[Ke]={id:Ke,type:"l2i",is_intermediate:S,fp32:y},T.nodes[ye]={id:ye,type:"img_resize",is_intermediate:S,width:_,height:b},T.edges.push({source:{node_id:vh,field:"image"},destination:{node_id:Hn,field:"image"}},{source:{node_id:Oe,field:"latents"},destination:{node_id:Ke,field:"latents"}},{source:{node_id:Ke,field:"image"},destination:{node_id:ye,field:"image"}})):(T.nodes[ye]={type:"l2i",id:ye,is_intermediate:S,fp32:y},T.nodes[Hn].image=t,T.edges.push({source:{node_id:Oe,field:"latents"},destination:{node_id:ye,field:"latents"}})),T.nodes[ht]={id:ht,type:"metadata_accumulator",generation_mode:"img2img",cfg_scale:a,width:w?v.width:_,height:w?v.height:b,positive_prompt:r,negative_prompt:i,model:o,seed:l,steps:u,rand_device:C?"cpu":"cuda",scheduler:s,vae:void 0,controlnets:[],loras:[],ipAdapters:[],clip_skip:f,strength:c,init_image:t.image_name},(p||m)&&(Oa(e,T,x),x=qr),Ep(e,T,Oe),Ma(e,T,x),Aa(e,T,Oe),Pa(e,T,Oe),e.system.shouldUseNSFWChecker&&Ia(e,T,ye),e.system.shouldUseWatermarker&&Na(e,T,ye),Ra(e,T),T},nEe=(e,t,n)=>{const r=Ce("nodes"),{positivePrompt:i,negativePrompt:o,model:a,cfgScale:s,scheduler:l,steps:u,img2imgStrength:c,seed:d,vaePrecision:f,shouldUseCpuNoise:h,maskBlur:p,maskBlurMethod:m,canvasCoherenceMode:_,canvasCoherenceSteps:b,canvasCoherenceStrength:v,clipSkip:g,seamlessXAxis:y,seamlessYAxis:S}=e.generation;if(!a)throw r.error("No Image found in state"),new Error("No Image found in state");const{width:w,height:x}=e.canvas.boundingBoxDimensions,{scaledBoundingBoxDimensions:C,boundingBoxScaleMethod:T}=e.canvas,k=!0,P=f==="fp32",$=["auto","manual"].includes(T);let O=Tc;const E=h,A={id:Kx,nodes:{[O]:{type:"main_model_loader",id:O,is_intermediate:k,model:a},[Yt]:{type:"clip_skip",id:Yt,is_intermediate:k,skipped_layers:g},[Fe]:{type:"compel",id:Fe,is_intermediate:k,prompt:i},[We]:{type:"compel",id:We,is_intermediate:k,prompt:o},[Ui]:{type:"img_blur",id:Ui,is_intermediate:k,radius:p,blur_type:m},[Wn]:{type:"i2l",id:Wn,is_intermediate:k,fp32:P},[Le]:{type:"noise",id:Le,use_cpu:E,seed:d,is_intermediate:k},[qn]:{type:"create_denoise_mask",id:qn,is_intermediate:k,fp32:P},[Oe]:{type:"denoise_latents",id:Oe,is_intermediate:k,steps:u,cfg_scale:s,scheduler:l,denoising_start:1-c,denoising_end:1},[Ut]:{type:"noise",id:Ut,use_cpu:E,seed:d+1,is_intermediate:k},[uc]:{type:"add",id:uc,b:1,is_intermediate:k},[pt]:{type:"denoise_latents",id:pt,is_intermediate:k,steps:b,cfg_scale:s,scheduler:l,denoising_start:1-v,denoising_end:1},[Ke]:{type:"l2i",id:Ke,is_intermediate:k,fp32:P},[ye]:{type:"color_correct",id:ye,is_intermediate:k,reference:t}},edges:[{source:{node_id:O,field:"unet"},destination:{node_id:Oe,field:"unet"}},{source:{node_id:O,field:"clip"},destination:{node_id:Yt,field:"clip"}},{source:{node_id:Yt,field:"clip"},destination:{node_id:Fe,field:"clip"}},{source:{node_id:Yt,field:"clip"},destination:{node_id:We,field:"clip"}},{source:{node_id:Fe,field:"conditioning"},destination:{node_id:Oe,field:"positive_conditioning"}},{source:{node_id:We,field:"conditioning"},destination:{node_id:Oe,field:"negative_conditioning"}},{source:{node_id:Le,field:"noise"},destination:{node_id:Oe,field:"noise"}},{source:{node_id:Wn,field:"latents"},destination:{node_id:Oe,field:"latents"}},{source:{node_id:Ui,field:"image"},destination:{node_id:qn,field:"mask"}},{source:{node_id:qn,field:"denoise_mask"},destination:{node_id:Oe,field:"denoise_mask"}},{source:{node_id:O,field:"unet"},destination:{node_id:pt,field:"unet"}},{source:{node_id:Fe,field:"conditioning"},destination:{node_id:pt,field:"positive_conditioning"}},{source:{node_id:We,field:"conditioning"},destination:{node_id:pt,field:"negative_conditioning"}},{source:{node_id:Ut,field:"noise"},destination:{node_id:pt,field:"noise"}},{source:{node_id:Oe,field:"latents"},destination:{node_id:pt,field:"latents"}},{source:{node_id:pt,field:"latents"},destination:{node_id:Ke,field:"latents"}}]};if($){const D=C.width,L=C.height;A.nodes[Ai]={type:"img_resize",id:Ai,is_intermediate:k,width:D,height:L,image:t},A.nodes[Mn]={type:"img_resize",id:Mn,is_intermediate:k,width:D,height:L,image:n},A.nodes[Hi]={type:"img_resize",id:Hi,is_intermediate:k,width:w,height:x},A.nodes[qi]={type:"img_resize",id:qi,is_intermediate:k,width:w,height:x},A.nodes[Le].width=D,A.nodes[Le].height=L,A.nodes[Ut].width=D,A.nodes[Ut].height=L,A.edges.push({source:{node_id:Ai,field:"image"},destination:{node_id:Wn,field:"image"}},{source:{node_id:Mn,field:"image"},destination:{node_id:Ui,field:"image"}},{source:{node_id:Ai,field:"image"},destination:{node_id:qn,field:"image"}},{source:{node_id:Ke,field:"image"},destination:{node_id:Hi,field:"image"}},{source:{node_id:Hi,field:"image"},destination:{node_id:ye,field:"image"}},{source:{node_id:Ui,field:"image"},destination:{node_id:qi,field:"image"}},{source:{node_id:qi,field:"image"},destination:{node_id:ye,field:"mask"}})}else A.nodes[Le].width=w,A.nodes[Le].height=x,A.nodes[Ut].width=w,A.nodes[Ut].height=x,A.nodes[Wn]={...A.nodes[Wn],image:t},A.nodes[Ui]={...A.nodes[Ui],image:n},A.nodes[qn]={...A.nodes[qn],image:t},A.edges.push({source:{node_id:Ke,field:"image"},destination:{node_id:ye,field:"image"}},{source:{node_id:Ui,field:"image"},destination:{node_id:ye,field:"mask"}});return _!=="unmasked"&&(A.nodes[zt]={type:"create_denoise_mask",id:zt,is_intermediate:k,fp32:P},$?A.edges.push({source:{node_id:Ai,field:"image"},destination:{node_id:zt,field:"image"}}):A.nodes[zt]={...A.nodes[zt],image:t},_==="mask"&&($?A.edges.push({source:{node_id:Mn,field:"image"},destination:{node_id:zt,field:"mask"}}):A.nodes[zt]={...A.nodes[zt],mask:n}),_==="edge"&&(A.nodes[mr]={type:"mask_edge",id:mr,is_intermediate:k,edge_blur:p,edge_size:p*2,low_threshold:100,high_threshold:200},$?A.edges.push({source:{node_id:Mn,field:"image"},destination:{node_id:mr,field:"image"}}):A.nodes[mr]={...A.nodes[mr],image:n},A.edges.push({source:{node_id:mr,field:"image"},destination:{node_id:zt,field:"mask"}})),A.edges.push({source:{node_id:zt,field:"denoise_mask"},destination:{node_id:pt,field:"denoise_mask"}})),(y||S)&&(Oa(e,A,O),O=qr),Ma(e,A,O),Ep(e,A,Oe,O),Aa(e,A,Oe),Pa(e,A,Oe),e.system.shouldUseNSFWChecker&&Ia(e,A,ye),e.system.shouldUseWatermarker&&Na(e,A,ye),Ra(e,A),A},rEe=(e,t,n)=>{const r=Ce("nodes"),{positivePrompt:i,negativePrompt:o,model:a,cfgScale:s,scheduler:l,steps:u,img2imgStrength:c,seed:d,vaePrecision:f,shouldUseCpuNoise:h,maskBlur:p,canvasCoherenceMode:m,canvasCoherenceSteps:_,canvasCoherenceStrength:b,infillTileSize:v,infillPatchmatchDownscaleSize:g,infillMethod:y,clipSkip:S,seamlessXAxis:w,seamlessYAxis:x}=e.generation;if(!a)throw r.error("No model found in state"),new Error("No model found in state");const{width:C,height:T}=e.canvas.boundingBoxDimensions,{scaledBoundingBoxDimensions:k,boundingBoxScaleMethod:P}=e.canvas,$=f==="fp32",O=!0,E=["auto","manual"].includes(P);let A=Tc;const D=h,L={id:Qx,nodes:{[A]:{type:"main_model_loader",id:A,is_intermediate:O,model:a},[Yt]:{type:"clip_skip",id:Yt,is_intermediate:O,skipped_layers:S},[Fe]:{type:"compel",id:Fe,is_intermediate:O,prompt:i},[We]:{type:"compel",id:We,is_intermediate:O,prompt:o},[bh]:{type:"tomask",id:bh,is_intermediate:O,image:t},[ki]:{type:"mask_combine",id:ki,is_intermediate:O,mask2:n},[Wn]:{type:"i2l",id:Wn,is_intermediate:O,fp32:$},[Le]:{type:"noise",id:Le,use_cpu:D,seed:d,is_intermediate:O},[qn]:{type:"create_denoise_mask",id:qn,is_intermediate:O,fp32:$},[Oe]:{type:"denoise_latents",id:Oe,is_intermediate:O,steps:u,cfg_scale:s,scheduler:l,denoising_start:1-c,denoising_end:1},[Ut]:{type:"noise",id:Ut,use_cpu:D,seed:d+1,is_intermediate:O},[uc]:{type:"add",id:uc,b:1,is_intermediate:O},[pt]:{type:"denoise_latents",id:pt,is_intermediate:O,steps:_,cfg_scale:s,scheduler:l,denoising_start:1-b,denoising_end:1},[Ke]:{type:"l2i",id:Ke,is_intermediate:O,fp32:$},[ye]:{type:"color_correct",id:ye,is_intermediate:O}},edges:[{source:{node_id:A,field:"unet"},destination:{node_id:Oe,field:"unet"}},{source:{node_id:A,field:"clip"},destination:{node_id:Yt,field:"clip"}},{source:{node_id:Yt,field:"clip"},destination:{node_id:Fe,field:"clip"}},{source:{node_id:Yt,field:"clip"},destination:{node_id:We,field:"clip"}},{source:{node_id:Wt,field:"image"},destination:{node_id:Wn,field:"image"}},{source:{node_id:bh,field:"image"},destination:{node_id:ki,field:"mask1"}},{source:{node_id:Fe,field:"conditioning"},destination:{node_id:Oe,field:"positive_conditioning"}},{source:{node_id:We,field:"conditioning"},destination:{node_id:Oe,field:"negative_conditioning"}},{source:{node_id:Le,field:"noise"},destination:{node_id:Oe,field:"noise"}},{source:{node_id:Wn,field:"latents"},destination:{node_id:Oe,field:"latents"}},{source:{node_id:E?Mn:ki,field:"image"},destination:{node_id:qn,field:"mask"}},{source:{node_id:qn,field:"denoise_mask"},destination:{node_id:Oe,field:"denoise_mask"}},{source:{node_id:A,field:"unet"},destination:{node_id:pt,field:"unet"}},{source:{node_id:Fe,field:"conditioning"},destination:{node_id:pt,field:"positive_conditioning"}},{source:{node_id:We,field:"conditioning"},destination:{node_id:pt,field:"negative_conditioning"}},{source:{node_id:Ut,field:"noise"},destination:{node_id:pt,field:"noise"}},{source:{node_id:Oe,field:"latents"},destination:{node_id:pt,field:"latents"}},{source:{node_id:Wt,field:"image"},destination:{node_id:qn,field:"image"}},{source:{node_id:pt,field:"latents"},destination:{node_id:Ke,field:"latents"}}]};if(y==="patchmatch"&&(L.nodes[Wt]={type:"infill_patchmatch",id:Wt,is_intermediate:O,downscale:g}),y==="lama"&&(L.nodes[Wt]={type:"infill_lama",id:Wt,is_intermediate:O}),y==="cv2"&&(L.nodes[Wt]={type:"infill_cv2",id:Wt,is_intermediate:O}),y==="tile"&&(L.nodes[Wt]={type:"infill_tile",id:Wt,is_intermediate:O,tile_size:v}),E){const M=k.width,R=k.height;L.nodes[Ai]={type:"img_resize",id:Ai,is_intermediate:O,width:M,height:R,image:t},L.nodes[Mn]={type:"img_resize",id:Mn,is_intermediate:O,width:M,height:R},L.nodes[Hi]={type:"img_resize",id:Hi,is_intermediate:O,width:C,height:T},L.nodes[$u]={type:"img_resize",id:$u,is_intermediate:O,width:C,height:T},L.nodes[qi]={type:"img_resize",id:qi,is_intermediate:O,width:C,height:T},L.nodes[Le].width=M,L.nodes[Le].height=R,L.nodes[Ut].width=M,L.nodes[Ut].height=R,L.edges.push({source:{node_id:Ai,field:"image"},destination:{node_id:Wt,field:"image"}},{source:{node_id:ki,field:"image"},destination:{node_id:Mn,field:"image"}},{source:{node_id:Ke,field:"image"},destination:{node_id:Hi,field:"image"}},{source:{node_id:Mn,field:"image"},destination:{node_id:qi,field:"image"}},{source:{node_id:Wt,field:"image"},destination:{node_id:$u,field:"image"}},{source:{node_id:$u,field:"image"},destination:{node_id:ye,field:"reference"}},{source:{node_id:Hi,field:"image"},destination:{node_id:ye,field:"image"}},{source:{node_id:qi,field:"image"},destination:{node_id:ye,field:"mask"}})}else L.nodes[Wt]={...L.nodes[Wt],image:t},L.nodes[Le].width=C,L.nodes[Le].height=T,L.nodes[Ut].width=C,L.nodes[Ut].height=T,L.nodes[Wn]={...L.nodes[Wn],image:t},L.edges.push({source:{node_id:Wt,field:"image"},destination:{node_id:ye,field:"reference"}},{source:{node_id:Ke,field:"image"},destination:{node_id:ye,field:"image"}},{source:{node_id:ki,field:"image"},destination:{node_id:ye,field:"mask"}});return m!=="unmasked"&&(L.nodes[zt]={type:"create_denoise_mask",id:zt,is_intermediate:O,fp32:$},L.edges.push({source:{node_id:Wt,field:"image"},destination:{node_id:zt,field:"image"}}),m==="mask"&&(E?L.edges.push({source:{node_id:Mn,field:"image"},destination:{node_id:zt,field:"mask"}}):L.edges.push({source:{node_id:ki,field:"image"},destination:{node_id:zt,field:"mask"}})),m==="edge"&&(L.nodes[mr]={type:"mask_edge",id:mr,is_intermediate:O,edge_blur:p,edge_size:p*2,low_threshold:100,high_threshold:200},E?L.edges.push({source:{node_id:Mn,field:"image"},destination:{node_id:mr,field:"image"}}):L.edges.push({source:{node_id:ki,field:"image"},destination:{node_id:mr,field:"image"}}),L.edges.push({source:{node_id:mr,field:"image"},destination:{node_id:zt,field:"mask"}})),L.edges.push({source:{node_id:zt,field:"denoise_mask"},destination:{node_id:pt,field:"denoise_mask"}})),(w||x)&&(Oa(e,L,A),A=qr),Ma(e,L,A),Ep(e,L,Oe,A),Aa(e,L,Oe),Pa(e,L,Oe),e.system.shouldUseNSFWChecker&&Ia(e,L,ye),e.system.shouldUseWatermarker&&Na(e,L,ye),Ra(e,L),L},kp=(e,t,n,r=Vi)=>{const{loras:i}=e.lora,o=WS(i),a=t.nodes[ht],s=r;let l=r;[qr,ca].includes(r)&&(l=Vi),o>0&&(t.edges=t.edges.filter(d=>!(d.source.node_id===s&&["unet"].includes(d.source.field))&&!(d.source.node_id===l&&["clip"].includes(d.source.field))&&!(d.source.node_id===l&&["clip2"].includes(d.source.field))));let u="",c=0;Ca(i,d=>{const{model_name:f,base_model:h,weight:p}=d,m=`${QG}_${f.replace(".","_")}`,_={type:"sdxl_lora_loader",id:m,is_intermediate:!0,lora:{model_name:f,base_model:h},weight:p};a&&(a.loras||(a.loras=[]),a.loras.push({lora:{model_name:f,base_model:h},weight:p})),t.nodes[m]=_,c===0?(t.edges.push({source:{node_id:s,field:"unet"},destination:{node_id:m,field:"unet"}}),t.edges.push({source:{node_id:l,field:"clip"},destination:{node_id:m,field:"clip"}}),t.edges.push({source:{node_id:l,field:"clip2"},destination:{node_id:m,field:"clip2"}})):(t.edges.push({source:{node_id:u,field:"unet"},destination:{node_id:m,field:"unet"}}),t.edges.push({source:{node_id:u,field:"clip"},destination:{node_id:m,field:"clip"}}),t.edges.push({source:{node_id:u,field:"clip2"},destination:{node_id:m,field:"clip2"}})),c===o-1&&(t.edges.push({source:{node_id:m,field:"unet"},destination:{node_id:n,field:"unet"}}),t.id&&[cc,dc].includes(t.id)&&t.edges.push({source:{node_id:m,field:"unet"},destination:{node_id:pt,field:"unet"}}),t.edges.push({source:{node_id:m,field:"clip"},destination:{node_id:Fe,field:"clip"}}),t.edges.push({source:{node_id:m,field:"clip"},destination:{node_id:We,field:"clip"}}),t.edges.push({source:{node_id:m,field:"clip2"},destination:{node_id:Fe,field:"clip2"}}),t.edges.push({source:{node_id:m,field:"clip2"},destination:{node_id:We,field:"clip2"}})),u=m,c+=1})},Zd=(e,t)=>{const{positivePrompt:n,negativePrompt:r}=e.generation,{positiveStylePrompt:i,negativeStylePrompt:o,shouldConcatSDXLStylePrompt:a}=e.sdxl,s=a||t?[n,i].join(" "):i,l=a||t?[r,o].join(" "):o;return{joinedPositiveStylePrompt:s,joinedNegativeStylePrompt:l}},Tp=(e,t,n,r,i,o)=>{const{refinerModel:a,refinerPositiveAestheticScore:s,refinerNegativeAestheticScore:l,refinerSteps:u,refinerScheduler:c,refinerCFGScale:d,refinerStart:f}=e.sdxl,{seamlessXAxis:h,seamlessYAxis:p,vaePrecision:m}=e.generation,{boundingBoxScaleMethod:_}=e.canvas,b=m==="fp32",v=["auto","manual"].includes(_);if(!a)return;const g=t.nodes[ht];g&&(g.refiner_model=a,g.refiner_positive_aesthetic_score=s,g.refiner_negative_aesthetic_score=l,g.refiner_cfg_scale=d,g.refiner_scheduler=c,g.refiner_start=f,g.refiner_steps=u);const y=r||Vi,{joinedPositiveStylePrompt:S,joinedNegativeStylePrompt:w}=Zd(e,!0);t.edges=t.edges.filter(x=>!(x.source.node_id===n&&["latents"].includes(x.source.field))),t.edges=t.edges.filter(x=>!(x.source.node_id===y&&["vae"].includes(x.source.field))),t.nodes[$c]={type:"sdxl_refiner_model_loader",id:$c,model:a},t.nodes[Hv]={type:"sdxl_refiner_compel_prompt",id:Hv,style:S,aesthetic_score:s},t.nodes[qv]={type:"sdxl_refiner_compel_prompt",id:qv,style:w,aesthetic_score:l},t.nodes[vs]={type:"denoise_latents",id:vs,cfg_scale:d,steps:u,scheduler:c,denoising_start:f,denoising_end:1},h||p?(t.nodes[Qa]={id:Qa,type:"seamless",seamless_x:h,seamless_y:p},t.edges.push({source:{node_id:$c,field:"unet"},destination:{node_id:Qa,field:"unet"}},{source:{node_id:$c,field:"vae"},destination:{node_id:Qa,field:"vae"}},{source:{node_id:Qa,field:"unet"},destination:{node_id:vs,field:"unet"}})):t.edges.push({source:{node_id:$c,field:"unet"},destination:{node_id:vs,field:"unet"}}),t.edges.push({source:{node_id:$c,field:"clip2"},destination:{node_id:Hv,field:"clip2"}},{source:{node_id:$c,field:"clip2"},destination:{node_id:qv,field:"clip2"}},{source:{node_id:Hv,field:"conditioning"},destination:{node_id:vs,field:"positive_conditioning"}},{source:{node_id:qv,field:"conditioning"},destination:{node_id:vs,field:"negative_conditioning"}},{source:{node_id:n,field:"latents"},destination:{node_id:vs,field:"latents"}}),(t.id===cc||t.id===dc)&&(t.nodes[ca]={type:"create_denoise_mask",id:ca,is_intermediate:!0,fp32:b},v?t.edges.push({source:{node_id:Ai,field:"image"},destination:{node_id:ca,field:"image"}}):t.nodes[ca]={...t.nodes[ca],image:i},t.id===cc&&(v?t.edges.push({source:{node_id:Mn,field:"image"},destination:{node_id:ca,field:"mask"}}):t.nodes[ca]={...t.nodes[ca],mask:o}),t.id===dc&&t.edges.push({source:{node_id:v?Mn:ki,field:"image"},destination:{node_id:ca,field:"mask"}}),t.edges.push({source:{node_id:ca,field:"denoise_mask"},destination:{node_id:vs,field:"denoise_mask"}})),t.id===Xx||t.id===b0?t.edges.push({source:{node_id:vs,field:"latents"},destination:{node_id:v?Ke:ye,field:"latents"}}):t.edges.push({source:{node_id:vs,field:"latents"},destination:{node_id:Ke,field:"latents"}})},iEe=(e,t)=>{const n=Ce("nodes"),{positivePrompt:r,negativePrompt:i,model:o,cfgScale:a,scheduler:s,seed:l,steps:u,vaePrecision:c,shouldUseCpuNoise:d,seamlessXAxis:f,seamlessYAxis:h}=e.generation,{shouldUseSDXLRefiner:p,refinerStart:m,sdxlImg2ImgDenoisingStrength:_}=e.sdxl,{width:b,height:v}=e.canvas.boundingBoxDimensions,{scaledBoundingBoxDimensions:g,boundingBoxScaleMethod:y}=e.canvas,S=c==="fp32",w=!0,x=["auto","manual"].includes(y);if(!o)throw n.error("No model found in state"),new Error("No model found in state");let C=Vi;const T=d,{joinedPositiveStylePrompt:k,joinedNegativeStylePrompt:P}=Zd(e),$={id:b0,nodes:{[C]:{type:"sdxl_model_loader",id:C,model:o},[Fe]:{type:"sdxl_compel_prompt",id:Fe,prompt:r,style:k},[We]:{type:"sdxl_compel_prompt",id:We,prompt:i,style:P},[Le]:{type:"noise",id:Le,is_intermediate:w,use_cpu:T,seed:l,width:x?g.width:b,height:x?g.height:v},[Hn]:{type:"i2l",id:Hn,is_intermediate:w,fp32:S},[ke]:{type:"denoise_latents",id:ke,is_intermediate:w,cfg_scale:a,scheduler:s,steps:u,denoising_start:p?Math.min(m,1-_):1-_,denoising_end:p?m:1}},edges:[{source:{node_id:C,field:"unet"},destination:{node_id:ke,field:"unet"}},{source:{node_id:C,field:"clip"},destination:{node_id:Fe,field:"clip"}},{source:{node_id:C,field:"clip2"},destination:{node_id:Fe,field:"clip2"}},{source:{node_id:C,field:"clip"},destination:{node_id:We,field:"clip"}},{source:{node_id:C,field:"clip2"},destination:{node_id:We,field:"clip2"}},{source:{node_id:Fe,field:"conditioning"},destination:{node_id:ke,field:"positive_conditioning"}},{source:{node_id:We,field:"conditioning"},destination:{node_id:ke,field:"negative_conditioning"}},{source:{node_id:Le,field:"noise"},destination:{node_id:ke,field:"noise"}},{source:{node_id:Hn,field:"latents"},destination:{node_id:ke,field:"latents"}}]};return x?($.nodes[vh]={id:vh,type:"img_resize",is_intermediate:w,image:t,width:g.width,height:g.height},$.nodes[Ke]={id:Ke,type:"l2i",is_intermediate:w,fp32:S},$.nodes[ye]={id:ye,type:"img_resize",is_intermediate:w,width:b,height:v},$.edges.push({source:{node_id:vh,field:"image"},destination:{node_id:Hn,field:"image"}},{source:{node_id:ke,field:"latents"},destination:{node_id:Ke,field:"latents"}},{source:{node_id:Ke,field:"image"},destination:{node_id:ye,field:"image"}})):($.nodes[ye]={type:"l2i",id:ye,is_intermediate:w,fp32:S},$.nodes[Hn].image=t,$.edges.push({source:{node_id:ke,field:"latents"},destination:{node_id:ye,field:"latents"}})),$.nodes[ht]={id:ht,type:"metadata_accumulator",generation_mode:"img2img",cfg_scale:a,width:x?g.width:b,height:x?g.height:v,positive_prompt:r,negative_prompt:i,model:o,seed:l,steps:u,rand_device:T?"cpu":"cuda",scheduler:s,vae:void 0,controlnets:[],loras:[],ipAdapters:[],strength:_,init_image:t.image_name},$.edges.push({source:{node_id:ht,field:"metadata"},destination:{node_id:ye,field:"metadata"}}),(f||h)&&(Oa(e,$,C),C=qr),p&&(Tp(e,$,ke,C),(f||h)&&(C=Qa)),Ma(e,$,C),kp(e,$,ke,C),Aa(e,$,ke),Pa(e,$,ke),e.system.shouldUseNSFWChecker&&Ia(e,$,ye),e.system.shouldUseWatermarker&&Na(e,$,ye),Ra(e,$),$},oEe=(e,t,n)=>{const r=Ce("nodes"),{positivePrompt:i,negativePrompt:o,model:a,cfgScale:s,scheduler:l,steps:u,seed:c,vaePrecision:d,shouldUseCpuNoise:f,maskBlur:h,maskBlurMethod:p,canvasCoherenceMode:m,canvasCoherenceSteps:_,canvasCoherenceStrength:b,seamlessXAxis:v,seamlessYAxis:g}=e.generation,{sdxlImg2ImgDenoisingStrength:y,shouldUseSDXLRefiner:S,refinerStart:w}=e.sdxl;if(!a)throw r.error("No model found in state"),new Error("No model found in state");const{width:x,height:C}=e.canvas.boundingBoxDimensions,{scaledBoundingBoxDimensions:T,boundingBoxScaleMethod:k}=e.canvas,P=d==="fp32",$=!0,O=["auto","manual"].includes(k);let E=Vi;const A=f,{joinedPositiveStylePrompt:D,joinedNegativeStylePrompt:L}=Zd(e),M={id:cc,nodes:{[E]:{type:"sdxl_model_loader",id:E,model:a},[Fe]:{type:"sdxl_compel_prompt",id:Fe,prompt:i,style:D},[We]:{type:"sdxl_compel_prompt",id:We,prompt:o,style:L},[Ui]:{type:"img_blur",id:Ui,is_intermediate:$,radius:h,blur_type:p},[Wn]:{type:"i2l",id:Wn,is_intermediate:$,fp32:P},[Le]:{type:"noise",id:Le,use_cpu:A,seed:c,is_intermediate:$},[qn]:{type:"create_denoise_mask",id:qn,is_intermediate:$,fp32:P},[ke]:{type:"denoise_latents",id:ke,is_intermediate:$,steps:u,cfg_scale:s,scheduler:l,denoising_start:S?Math.min(w,1-y):1-y,denoising_end:S?w:1},[Ut]:{type:"noise",id:Ut,use_cpu:A,seed:c+1,is_intermediate:$},[uc]:{type:"add",id:uc,b:1,is_intermediate:$},[pt]:{type:"denoise_latents",id:pt,is_intermediate:$,steps:_,cfg_scale:s,scheduler:l,denoising_start:1-b,denoising_end:1},[Ke]:{type:"l2i",id:Ke,is_intermediate:$,fp32:P},[ye]:{type:"color_correct",id:ye,is_intermediate:$,reference:t}},edges:[{source:{node_id:E,field:"unet"},destination:{node_id:ke,field:"unet"}},{source:{node_id:E,field:"clip"},destination:{node_id:Fe,field:"clip"}},{source:{node_id:E,field:"clip2"},destination:{node_id:Fe,field:"clip2"}},{source:{node_id:E,field:"clip"},destination:{node_id:We,field:"clip"}},{source:{node_id:E,field:"clip2"},destination:{node_id:We,field:"clip2"}},{source:{node_id:Fe,field:"conditioning"},destination:{node_id:ke,field:"positive_conditioning"}},{source:{node_id:We,field:"conditioning"},destination:{node_id:ke,field:"negative_conditioning"}},{source:{node_id:Le,field:"noise"},destination:{node_id:ke,field:"noise"}},{source:{node_id:Wn,field:"latents"},destination:{node_id:ke,field:"latents"}},{source:{node_id:Ui,field:"image"},destination:{node_id:qn,field:"mask"}},{source:{node_id:qn,field:"denoise_mask"},destination:{node_id:ke,field:"denoise_mask"}},{source:{node_id:E,field:"unet"},destination:{node_id:pt,field:"unet"}},{source:{node_id:Fe,field:"conditioning"},destination:{node_id:pt,field:"positive_conditioning"}},{source:{node_id:We,field:"conditioning"},destination:{node_id:pt,field:"negative_conditioning"}},{source:{node_id:Ut,field:"noise"},destination:{node_id:pt,field:"noise"}},{source:{node_id:ke,field:"latents"},destination:{node_id:pt,field:"latents"}},{source:{node_id:pt,field:"latents"},destination:{node_id:Ke,field:"latents"}}]};if(O){const R=T.width,N=T.height;M.nodes[Ai]={type:"img_resize",id:Ai,is_intermediate:$,width:R,height:N,image:t},M.nodes[Mn]={type:"img_resize",id:Mn,is_intermediate:$,width:R,height:N,image:n},M.nodes[Hi]={type:"img_resize",id:Hi,is_intermediate:$,width:x,height:C},M.nodes[qi]={type:"img_resize",id:qi,is_intermediate:$,width:x,height:C},M.nodes[Le].width=R,M.nodes[Le].height=N,M.nodes[Ut].width=R,M.nodes[Ut].height=N,M.edges.push({source:{node_id:Ai,field:"image"},destination:{node_id:Wn,field:"image"}},{source:{node_id:Mn,field:"image"},destination:{node_id:Ui,field:"image"}},{source:{node_id:Ai,field:"image"},destination:{node_id:qn,field:"image"}},{source:{node_id:Ke,field:"image"},destination:{node_id:Hi,field:"image"}},{source:{node_id:Hi,field:"image"},destination:{node_id:ye,field:"image"}},{source:{node_id:Ui,field:"image"},destination:{node_id:qi,field:"image"}},{source:{node_id:qi,field:"image"},destination:{node_id:ye,field:"mask"}})}else M.nodes[Le].width=x,M.nodes[Le].height=C,M.nodes[Ut].width=x,M.nodes[Ut].height=C,M.nodes[Wn]={...M.nodes[Wn],image:t},M.nodes[Ui]={...M.nodes[Ui],image:n},M.nodes[qn]={...M.nodes[qn],image:t},M.edges.push({source:{node_id:Ke,field:"image"},destination:{node_id:ye,field:"image"}},{source:{node_id:Ui,field:"image"},destination:{node_id:ye,field:"mask"}});return m!=="unmasked"&&(M.nodes[zt]={type:"create_denoise_mask",id:zt,is_intermediate:$,fp32:P},O?M.edges.push({source:{node_id:Ai,field:"image"},destination:{node_id:zt,field:"image"}}):M.nodes[zt]={...M.nodes[zt],image:t},m==="mask"&&(O?M.edges.push({source:{node_id:Mn,field:"image"},destination:{node_id:zt,field:"mask"}}):M.nodes[zt]={...M.nodes[zt],mask:n}),m==="edge"&&(M.nodes[mr]={type:"mask_edge",id:mr,is_intermediate:$,edge_blur:h,edge_size:h*2,low_threshold:100,high_threshold:200},O?M.edges.push({source:{node_id:Mn,field:"image"},destination:{node_id:mr,field:"image"}}):M.nodes[mr]={...M.nodes[mr],image:n},M.edges.push({source:{node_id:mr,field:"image"},destination:{node_id:zt,field:"mask"}})),M.edges.push({source:{node_id:zt,field:"denoise_mask"},destination:{node_id:pt,field:"denoise_mask"}})),(v||g)&&(Oa(e,M,E),E=qr),S&&(Tp(e,M,pt,E,t,n),(v||g)&&(E=Qa)),Ma(e,M,E),kp(e,M,ke,E),Aa(e,M,ke),Pa(e,M,ke),e.system.shouldUseNSFWChecker&&Ia(e,M,ye),e.system.shouldUseWatermarker&&Na(e,M,ye),Ra(e,M),M},aEe=(e,t,n)=>{const r=Ce("nodes"),{positivePrompt:i,negativePrompt:o,model:a,cfgScale:s,scheduler:l,steps:u,seed:c,vaePrecision:d,shouldUseCpuNoise:f,maskBlur:h,canvasCoherenceMode:p,canvasCoherenceSteps:m,canvasCoherenceStrength:_,infillTileSize:b,infillPatchmatchDownscaleSize:v,infillMethod:g,seamlessXAxis:y,seamlessYAxis:S}=e.generation,{sdxlImg2ImgDenoisingStrength:w,shouldUseSDXLRefiner:x,refinerStart:C}=e.sdxl;if(!a)throw r.error("No model found in state"),new Error("No model found in state");const{width:T,height:k}=e.canvas.boundingBoxDimensions,{scaledBoundingBoxDimensions:P,boundingBoxScaleMethod:$}=e.canvas,O=d==="fp32",E=!0,A=["auto","manual"].includes($);let D=Vi;const L=f,{joinedPositiveStylePrompt:M,joinedNegativeStylePrompt:R}=Zd(e),N={id:dc,nodes:{[Vi]:{type:"sdxl_model_loader",id:Vi,model:a},[Fe]:{type:"sdxl_compel_prompt",id:Fe,prompt:i,style:M},[We]:{type:"sdxl_compel_prompt",id:We,prompt:o,style:R},[bh]:{type:"tomask",id:bh,is_intermediate:E,image:t},[ki]:{type:"mask_combine",id:ki,is_intermediate:E,mask2:n},[Wn]:{type:"i2l",id:Wn,is_intermediate:E,fp32:O},[Le]:{type:"noise",id:Le,use_cpu:L,seed:c,is_intermediate:E},[qn]:{type:"create_denoise_mask",id:qn,is_intermediate:E,fp32:O},[ke]:{type:"denoise_latents",id:ke,is_intermediate:E,steps:u,cfg_scale:s,scheduler:l,denoising_start:x?Math.min(C,1-w):1-w,denoising_end:x?C:1},[Ut]:{type:"noise",id:Ut,use_cpu:L,seed:c+1,is_intermediate:E},[uc]:{type:"add",id:uc,b:1,is_intermediate:E},[pt]:{type:"denoise_latents",id:pt,is_intermediate:E,steps:m,cfg_scale:s,scheduler:l,denoising_start:1-_,denoising_end:1},[Ke]:{type:"l2i",id:Ke,is_intermediate:E,fp32:O},[ye]:{type:"color_correct",id:ye,is_intermediate:E}},edges:[{source:{node_id:Vi,field:"unet"},destination:{node_id:ke,field:"unet"}},{source:{node_id:Vi,field:"clip"},destination:{node_id:Fe,field:"clip"}},{source:{node_id:Vi,field:"clip2"},destination:{node_id:Fe,field:"clip2"}},{source:{node_id:Vi,field:"clip"},destination:{node_id:We,field:"clip"}},{source:{node_id:Vi,field:"clip2"},destination:{node_id:We,field:"clip2"}},{source:{node_id:Wt,field:"image"},destination:{node_id:Wn,field:"image"}},{source:{node_id:bh,field:"image"},destination:{node_id:ki,field:"mask1"}},{source:{node_id:Fe,field:"conditioning"},destination:{node_id:ke,field:"positive_conditioning"}},{source:{node_id:We,field:"conditioning"},destination:{node_id:ke,field:"negative_conditioning"}},{source:{node_id:Le,field:"noise"},destination:{node_id:ke,field:"noise"}},{source:{node_id:Wn,field:"latents"},destination:{node_id:ke,field:"latents"}},{source:{node_id:A?Mn:ki,field:"image"},destination:{node_id:qn,field:"mask"}},{source:{node_id:qn,field:"denoise_mask"},destination:{node_id:ke,field:"denoise_mask"}},{source:{node_id:D,field:"unet"},destination:{node_id:pt,field:"unet"}},{source:{node_id:Fe,field:"conditioning"},destination:{node_id:pt,field:"positive_conditioning"}},{source:{node_id:We,field:"conditioning"},destination:{node_id:pt,field:"negative_conditioning"}},{source:{node_id:Ut,field:"noise"},destination:{node_id:pt,field:"noise"}},{source:{node_id:ke,field:"latents"},destination:{node_id:pt,field:"latents"}},{source:{node_id:Wt,field:"image"},destination:{node_id:qn,field:"image"}},{source:{node_id:pt,field:"latents"},destination:{node_id:Ke,field:"latents"}}]};if(g==="patchmatch"&&(N.nodes[Wt]={type:"infill_patchmatch",id:Wt,is_intermediate:E,downscale:v}),g==="lama"&&(N.nodes[Wt]={type:"infill_lama",id:Wt,is_intermediate:E}),g==="cv2"&&(N.nodes[Wt]={type:"infill_cv2",id:Wt,is_intermediate:E}),g==="tile"&&(N.nodes[Wt]={type:"infill_tile",id:Wt,is_intermediate:E,tile_size:b}),A){const B=P.width,U=P.height;N.nodes[Ai]={type:"img_resize",id:Ai,is_intermediate:E,width:B,height:U,image:t},N.nodes[Mn]={type:"img_resize",id:Mn,is_intermediate:E,width:B,height:U},N.nodes[Hi]={type:"img_resize",id:Hi,is_intermediate:E,width:T,height:k},N.nodes[$u]={type:"img_resize",id:$u,is_intermediate:E,width:T,height:k},N.nodes[qi]={type:"img_resize",id:qi,is_intermediate:E,width:T,height:k},N.nodes[Le].width=B,N.nodes[Le].height=U,N.nodes[Ut].width=B,N.nodes[Ut].height=U,N.edges.push({source:{node_id:Ai,field:"image"},destination:{node_id:Wt,field:"image"}},{source:{node_id:ki,field:"image"},destination:{node_id:Mn,field:"image"}},{source:{node_id:Ke,field:"image"},destination:{node_id:Hi,field:"image"}},{source:{node_id:Mn,field:"image"},destination:{node_id:qi,field:"image"}},{source:{node_id:Wt,field:"image"},destination:{node_id:$u,field:"image"}},{source:{node_id:$u,field:"image"},destination:{node_id:ye,field:"reference"}},{source:{node_id:Hi,field:"image"},destination:{node_id:ye,field:"image"}},{source:{node_id:qi,field:"image"},destination:{node_id:ye,field:"mask"}})}else N.nodes[Wt]={...N.nodes[Wt],image:t},N.nodes[Le].width=T,N.nodes[Le].height=k,N.nodes[Ut].width=T,N.nodes[Ut].height=k,N.nodes[Wn]={...N.nodes[Wn],image:t},N.edges.push({source:{node_id:Wt,field:"image"},destination:{node_id:ye,field:"reference"}},{source:{node_id:Ke,field:"image"},destination:{node_id:ye,field:"image"}},{source:{node_id:ki,field:"image"},destination:{node_id:ye,field:"mask"}});return p!=="unmasked"&&(N.nodes[zt]={type:"create_denoise_mask",id:zt,is_intermediate:E,fp32:O},N.edges.push({source:{node_id:Wt,field:"image"},destination:{node_id:zt,field:"image"}}),p==="mask"&&(A?N.edges.push({source:{node_id:Mn,field:"image"},destination:{node_id:zt,field:"mask"}}):N.edges.push({source:{node_id:ki,field:"image"},destination:{node_id:zt,field:"mask"}})),p==="edge"&&(N.nodes[mr]={type:"mask_edge",id:mr,is_intermediate:E,edge_blur:h,edge_size:h*2,low_threshold:100,high_threshold:200},A?N.edges.push({source:{node_id:Mn,field:"image"},destination:{node_id:mr,field:"image"}}):N.edges.push({source:{node_id:ki,field:"image"},destination:{node_id:mr,field:"image"}}),N.edges.push({source:{node_id:mr,field:"image"},destination:{node_id:zt,field:"mask"}})),N.edges.push({source:{node_id:zt,field:"denoise_mask"},destination:{node_id:pt,field:"denoise_mask"}})),(y||S)&&(Oa(e,N,D),D=qr),x&&(Tp(e,N,pt,D,t),(y||S)&&(D=Qa)),Ma(e,N,D),kp(e,N,ke,D),Aa(e,N,ke),Pa(e,N,ke),e.system.shouldUseNSFWChecker&&Ia(e,N,ye),e.system.shouldUseWatermarker&&Na(e,N,ye),Ra(e,N),N},sEe=e=>{const t=Ce("nodes"),{positivePrompt:n,negativePrompt:r,model:i,cfgScale:o,scheduler:a,seed:s,steps:l,vaePrecision:u,shouldUseCpuNoise:c,seamlessXAxis:d,seamlessYAxis:f}=e.generation,{width:h,height:p}=e.canvas.boundingBoxDimensions,{scaledBoundingBoxDimensions:m,boundingBoxScaleMethod:_}=e.canvas,b=u==="fp32",v=!0,g=["auto","manual"].includes(_),{shouldUseSDXLRefiner:y,refinerStart:S}=e.sdxl;if(!i)throw t.error("No model found in state"),new Error("No model found in state");const w=c,x=i.model_type==="onnx";let C=x?Wx:Vi;const T=x?"onnx_model_loader":"sdxl_model_loader",k=x?{type:"t2l_onnx",id:ke,is_intermediate:v,cfg_scale:o,scheduler:a,steps:l}:{type:"denoise_latents",id:ke,is_intermediate:v,cfg_scale:o,scheduler:a,steps:l,denoising_start:0,denoising_end:y?S:1},{joinedPositiveStylePrompt:P,joinedNegativeStylePrompt:$}=Zd(e),O={id:Xx,nodes:{[C]:{type:T,id:C,is_intermediate:v,model:i},[Fe]:{type:x?"prompt_onnx":"sdxl_compel_prompt",id:Fe,is_intermediate:v,prompt:n,style:P},[We]:{type:x?"prompt_onnx":"sdxl_compel_prompt",id:We,is_intermediate:v,prompt:r,style:$},[Le]:{type:"noise",id:Le,is_intermediate:v,seed:s,width:g?m.width:h,height:g?m.height:p,use_cpu:w},[k.id]:k},edges:[{source:{node_id:C,field:"unet"},destination:{node_id:ke,field:"unet"}},{source:{node_id:C,field:"clip"},destination:{node_id:Fe,field:"clip"}},{source:{node_id:C,field:"clip2"},destination:{node_id:Fe,field:"clip2"}},{source:{node_id:C,field:"clip"},destination:{node_id:We,field:"clip"}},{source:{node_id:C,field:"clip2"},destination:{node_id:We,field:"clip2"}},{source:{node_id:Fe,field:"conditioning"},destination:{node_id:ke,field:"positive_conditioning"}},{source:{node_id:We,field:"conditioning"},destination:{node_id:ke,field:"negative_conditioning"}},{source:{node_id:Le,field:"noise"},destination:{node_id:ke,field:"noise"}}]};return g?(O.nodes[Ke]={id:Ke,type:x?"l2i_onnx":"l2i",is_intermediate:v,fp32:b},O.nodes[ye]={id:ye,type:"img_resize",is_intermediate:v,width:h,height:p},O.edges.push({source:{node_id:ke,field:"latents"},destination:{node_id:Ke,field:"latents"}},{source:{node_id:Ke,field:"image"},destination:{node_id:ye,field:"image"}})):(O.nodes[ye]={type:x?"l2i_onnx":"l2i",id:ye,is_intermediate:v,fp32:b},O.edges.push({source:{node_id:ke,field:"latents"},destination:{node_id:ye,field:"latents"}})),O.nodes[ht]={id:ht,type:"metadata_accumulator",generation_mode:"txt2img",cfg_scale:o,width:g?m.width:h,height:g?m.height:p,positive_prompt:n,negative_prompt:r,model:i,seed:s,steps:l,rand_device:w?"cpu":"cuda",scheduler:a,vae:void 0,controlnets:[],loras:[],ipAdapters:[]},O.edges.push({source:{node_id:ht,field:"metadata"},destination:{node_id:ye,field:"metadata"}}),(d||f)&&(Oa(e,O,C),C=qr),y&&(Tp(e,O,ke,C),(d||f)&&(C=Qa)),kp(e,O,ke,C),Ma(e,O,C),Aa(e,O,ke),Pa(e,O,ke),e.system.shouldUseNSFWChecker&&Ia(e,O,ye),e.system.shouldUseWatermarker&&Na(e,O,ye),Ra(e,O),O},lEe=e=>{const t=Ce("nodes"),{positivePrompt:n,negativePrompt:r,model:i,cfgScale:o,scheduler:a,seed:s,steps:l,vaePrecision:u,clipSkip:c,shouldUseCpuNoise:d,seamlessXAxis:f,seamlessYAxis:h}=e.generation,{width:p,height:m}=e.canvas.boundingBoxDimensions,{scaledBoundingBoxDimensions:_,boundingBoxScaleMethod:b}=e.canvas,v=u==="fp32",g=!0,y=["auto","manual"].includes(b);if(!i)throw t.error("No model found in state"),new Error("No model found in state");const S=d,w=i.model_type==="onnx";let x=w?Wx:Tc;const C=w?"onnx_model_loader":"main_model_loader",T=w?{type:"t2l_onnx",id:Oe,is_intermediate:g,cfg_scale:o,scheduler:a,steps:l}:{type:"denoise_latents",id:Oe,is_intermediate:g,cfg_scale:o,scheduler:a,steps:l,denoising_start:0,denoising_end:1},k={id:YG,nodes:{[x]:{type:C,id:x,is_intermediate:g,model:i},[Yt]:{type:"clip_skip",id:Yt,is_intermediate:g,skipped_layers:c},[Fe]:{type:w?"prompt_onnx":"compel",id:Fe,is_intermediate:g,prompt:n},[We]:{type:w?"prompt_onnx":"compel",id:We,is_intermediate:g,prompt:r},[Le]:{type:"noise",id:Le,is_intermediate:g,seed:s,width:y?_.width:p,height:y?_.height:m,use_cpu:S},[T.id]:T},edges:[{source:{node_id:x,field:"unet"},destination:{node_id:Oe,field:"unet"}},{source:{node_id:x,field:"clip"},destination:{node_id:Yt,field:"clip"}},{source:{node_id:Yt,field:"clip"},destination:{node_id:Fe,field:"clip"}},{source:{node_id:Yt,field:"clip"},destination:{node_id:We,field:"clip"}},{source:{node_id:Fe,field:"conditioning"},destination:{node_id:Oe,field:"positive_conditioning"}},{source:{node_id:We,field:"conditioning"},destination:{node_id:Oe,field:"negative_conditioning"}},{source:{node_id:Le,field:"noise"},destination:{node_id:Oe,field:"noise"}}]};return y?(k.nodes[Ke]={id:Ke,type:w?"l2i_onnx":"l2i",is_intermediate:g,fp32:v},k.nodes[ye]={id:ye,type:"img_resize",is_intermediate:g,width:p,height:m},k.edges.push({source:{node_id:Oe,field:"latents"},destination:{node_id:Ke,field:"latents"}},{source:{node_id:Ke,field:"image"},destination:{node_id:ye,field:"image"}})):(k.nodes[ye]={type:w?"l2i_onnx":"l2i",id:ye,is_intermediate:g,fp32:v},k.edges.push({source:{node_id:Oe,field:"latents"},destination:{node_id:ye,field:"latents"}})),k.nodes[ht]={id:ht,type:"metadata_accumulator",generation_mode:"txt2img",cfg_scale:o,width:y?_.width:p,height:y?_.height:m,positive_prompt:n,negative_prompt:r,model:i,seed:s,steps:l,rand_device:S?"cpu":"cuda",scheduler:a,vae:void 0,controlnets:[],loras:[],ipAdapters:[],clip_skip:c},k.edges.push({source:{node_id:ht,field:"metadata"},destination:{node_id:ye,field:"metadata"}}),(f||h)&&(Oa(e,k,x),x=qr),Ma(e,k,x),Ep(e,k,Oe,x),Aa(e,k,Oe),Pa(e,k,Oe),e.system.shouldUseNSFWChecker&&Ia(e,k,ye),e.system.shouldUseWatermarker&&Na(e,k,ye),Ra(e,k),k},uEe=(e,t,n,r)=>{let i;if(t==="txt2img")e.generation.model&&e.generation.model.base_model==="sdxl"?i=sEe(e):i=lEe(e);else if(t==="img2img"){if(!n)throw new Error("Missing canvas init image");e.generation.model&&e.generation.model.base_model==="sdxl"?i=iEe(e,n):i=tEe(e,n)}else if(t==="inpaint"){if(!n||!r)throw new Error("Missing canvas init and mask images");e.generation.model&&e.generation.model.base_model==="sdxl"?i=oEe(e,n,r):i=nEe(e,n,r)}else{if(!n)throw new Error("Missing canvas init image");e.generation.model&&e.generation.model.base_model==="sdxl"?i=aEe(e,n,r):i=rEe(e,n,r)}return i},r5=({count:e,start:t,min:n=Mae,max:r=Gg})=>{const i=t??uae(n,r),o=[];for(let a=i;a{const{iterations:r,model:i,shouldRandomizeSeed:o,seed:a}=e.generation,{shouldConcatSDXLStylePrompt:s,positiveStylePrompt:l}=e.sdxl,{prompts:u,seedBehaviour:c}=e.dynamicPrompts,d=[];if(u.length===1){Q8(t.nodes[ht],"seed");const h=r5({count:r,start:o?void 0:a}),p=[];t.nodes[Le]&&p.push({node_path:Le,field_name:"seed",items:h}),t.nodes[ht]&&p.push({node_path:ht,field_name:"seed",items:h}),t.nodes[Ut]&&p.push({node_path:Ut,field_name:"seed",items:h.map(m=>(m+1)%Gg)}),d.push(p)}else{const h=[],p=[];if(c==="PER_PROMPT"){const _=r5({count:u.length*r,start:o?void 0:a});t.nodes[Le]&&h.push({node_path:Le,field_name:"seed",items:_}),t.nodes[ht]&&h.push({node_path:ht,field_name:"seed",items:_}),t.nodes[Ut]&&h.push({node_path:Ut,field_name:"seed",items:_.map(b=>(b+1)%Gg)})}else{const _=r5({count:r,start:o?void 0:a});t.nodes[Le]&&p.push({node_path:Le,field_name:"seed",items:_}),t.nodes[ht]&&p.push({node_path:ht,field_name:"seed",items:_}),t.nodes[Ut]&&p.push({node_path:Ut,field_name:"seed",items:_.map(b=>(b+1)%Gg)}),d.push(p)}const m=c==="PER_PROMPT"?gae(r).flatMap(()=>u):u;if(t.nodes[Fe]&&h.push({node_path:Fe,field_name:"prompt",items:m}),t.nodes[ht]&&h.push({node_path:ht,field_name:"positive_prompt",items:m}),s&&(i==null?void 0:i.base_model)==="sdxl"){Q8(t.nodes[ht],"positive_style_prompt");const _=m.map(b=>[b,l].join(" "));t.nodes[Fe]&&h.push({node_path:Fe,field_name:"style",items:_}),t.nodes[ht]&&h.push({node_path:ht,field_name:"positive_style_prompt",items:_})}d.push(h)}return{prepend:n,batch:{graph:t,runs:1,data:d}}},cEe=()=>{Be({predicate:e=>MA.match(e)&&e.payload.tabName==="unifiedCanvas",effect:async(e,{getState:t,dispatch:n})=>{const r=Ce("queue"),{prepend:i}=e.payload,o=t(),{layerState:a,boundingBoxCoordinates:s,boundingBoxDimensions:l,isMaskEnabled:u,shouldPreserveMaskedArea:c}=o.canvas,d=await RA(a,s,l,u,c);if(!d){r.error("Unable to create canvas data");return}const{baseBlob:f,baseImageData:h,maskBlob:p,maskImageData:m}=d,_=Z3e(h,m);if(o.system.enableImageDebugging){const S=await NO(f),w=await NO(p);Q3e([{base64:w,caption:"mask b64"},{base64:S,caption:"image b64"}])}r.debug(`Generation mode: ${_}`);let b,v;["img2img","inpaint","outpaint"].includes(_)&&(b=await n(me.endpoints.uploadImage.initiate({file:new File([f],"canvasInitImage.png",{type:"image/png"}),image_category:"general",is_intermediate:!0})).unwrap()),["inpaint","outpaint"].includes(_)&&(v=await n(me.endpoints.uploadImage.initiate({file:new File([p],"canvasMaskImage.png",{type:"image/png"}),image_category:"mask",is_intermediate:!0})).unwrap());const g=uEe(o,_,b,v);r.debug({graph:Qt(g)},"Canvas graph built"),n(lG(g));const y=JG(o,g,i);try{const S=n(Qr.endpoints.enqueueBatch.initiate(y,{fixedCacheKey:"enqueueBatch"})),w=await S.unwrap();S.reset();const x=w.batch.batch_id;o.canvas.layerState.stagingArea.boundingBox||n(lle({boundingBox:{...o.canvas.boundingBoxCoordinates,...o.canvas.boundingBoxDimensions}})),n(ule(x))}catch{}}})},dEe=e=>{const t=Ce("nodes"),{positivePrompt:n,negativePrompt:r,model:i,cfgScale:o,scheduler:a,seed:s,steps:l,initialImage:u,img2imgStrength:c,shouldFitToWidthHeight:d,width:f,height:h,clipSkip:p,shouldUseCpuNoise:m,vaePrecision:_,seamlessXAxis:b,seamlessYAxis:v}=e.generation;if(!u)throw t.error("No initial image found in state"),new Error("No initial image found in state");if(!i)throw t.error("No model found in state"),new Error("No model found in state");const g=_==="fp32",y=!0;let S=Tc;const w=m,x={id:JE,nodes:{[S]:{type:"main_model_loader",id:S,model:i,is_intermediate:y},[Yt]:{type:"clip_skip",id:Yt,skipped_layers:p,is_intermediate:y},[Fe]:{type:"compel",id:Fe,prompt:n,is_intermediate:y},[We]:{type:"compel",id:We,prompt:r,is_intermediate:y},[Le]:{type:"noise",id:Le,use_cpu:w,seed:s,is_intermediate:y},[Ke]:{type:"l2i",id:Ke,fp32:g,is_intermediate:y},[Oe]:{type:"denoise_latents",id:Oe,cfg_scale:o,scheduler:a,steps:l,denoising_start:1-c,denoising_end:1,is_intermediate:y},[Hn]:{type:"i2l",id:Hn,fp32:g,is_intermediate:y}},edges:[{source:{node_id:S,field:"unet"},destination:{node_id:Oe,field:"unet"}},{source:{node_id:S,field:"clip"},destination:{node_id:Yt,field:"clip"}},{source:{node_id:Yt,field:"clip"},destination:{node_id:Fe,field:"clip"}},{source:{node_id:Yt,field:"clip"},destination:{node_id:We,field:"clip"}},{source:{node_id:Fe,field:"conditioning"},destination:{node_id:Oe,field:"positive_conditioning"}},{source:{node_id:We,field:"conditioning"},destination:{node_id:Oe,field:"negative_conditioning"}},{source:{node_id:Le,field:"noise"},destination:{node_id:Oe,field:"noise"}},{source:{node_id:Hn,field:"latents"},destination:{node_id:Oe,field:"latents"}},{source:{node_id:Oe,field:"latents"},destination:{node_id:Ke,field:"latents"}}]};if(d&&(u.width!==f||u.height!==h)){const C={id:Rs,type:"img_resize",image:{image_name:u.imageName},is_intermediate:!0,width:f,height:h};x.nodes[Rs]=C,x.edges.push({source:{node_id:Rs,field:"image"},destination:{node_id:Hn,field:"image"}}),x.edges.push({source:{node_id:Rs,field:"width"},destination:{node_id:Le,field:"width"}}),x.edges.push({source:{node_id:Rs,field:"height"},destination:{node_id:Le,field:"height"}})}else x.nodes[Hn].image={image_name:u.imageName},x.edges.push({source:{node_id:Hn,field:"width"},destination:{node_id:Le,field:"width"}}),x.edges.push({source:{node_id:Hn,field:"height"},destination:{node_id:Le,field:"height"}});return x.nodes[ht]={id:ht,type:"metadata_accumulator",generation_mode:"img2img",cfg_scale:o,height:h,width:f,positive_prompt:n,negative_prompt:r,model:i,seed:s,steps:l,rand_device:w?"cpu":"cuda",scheduler:a,vae:void 0,controlnets:[],loras:[],ipAdapters:[],clip_skip:p,strength:c,init_image:u.imageName},x.edges.push({source:{node_id:ht,field:"metadata"},destination:{node_id:Ke,field:"metadata"}}),(b||v)&&(Oa(e,x,S),S=qr),Ma(e,x,S),Ep(e,x,Oe,S),Aa(e,x,Oe),Pa(e,x,Oe),e.system.shouldUseNSFWChecker&&Ia(e,x),e.system.shouldUseWatermarker&&Na(e,x),Ra(e,x),x},fEe=e=>{const t=Ce("nodes"),{positivePrompt:n,negativePrompt:r,model:i,cfgScale:o,scheduler:a,seed:s,steps:l,initialImage:u,shouldFitToWidthHeight:c,width:d,height:f,shouldUseCpuNoise:h,vaePrecision:p,seamlessXAxis:m,seamlessYAxis:_}=e.generation,{positiveStylePrompt:b,negativeStylePrompt:v,shouldUseSDXLRefiner:g,refinerStart:y,sdxlImg2ImgDenoisingStrength:S}=e.sdxl;if(!u)throw t.error("No initial image found in state"),new Error("No initial image found in state");if(!i)throw t.error("No model found in state"),new Error("No model found in state");const w=p==="fp32",x=!0;let C=Vi;const T=h,{joinedPositiveStylePrompt:k,joinedNegativeStylePrompt:P}=Zd(e),$={id:z_,nodes:{[C]:{type:"sdxl_model_loader",id:C,model:i,is_intermediate:x},[Fe]:{type:"sdxl_compel_prompt",id:Fe,prompt:n,style:k,is_intermediate:x},[We]:{type:"sdxl_compel_prompt",id:We,prompt:r,style:P,is_intermediate:x},[Le]:{type:"noise",id:Le,use_cpu:T,seed:s,is_intermediate:x},[Ke]:{type:"l2i",id:Ke,fp32:w,is_intermediate:x},[ke]:{type:"denoise_latents",id:ke,cfg_scale:o,scheduler:a,steps:l,denoising_start:g?Math.min(y,1-S):1-S,denoising_end:g?y:1,is_intermediate:x},[Hn]:{type:"i2l",id:Hn,fp32:w,is_intermediate:x}},edges:[{source:{node_id:C,field:"unet"},destination:{node_id:ke,field:"unet"}},{source:{node_id:C,field:"clip"},destination:{node_id:Fe,field:"clip"}},{source:{node_id:C,field:"clip2"},destination:{node_id:Fe,field:"clip2"}},{source:{node_id:C,field:"clip"},destination:{node_id:We,field:"clip"}},{source:{node_id:C,field:"clip2"},destination:{node_id:We,field:"clip2"}},{source:{node_id:Fe,field:"conditioning"},destination:{node_id:ke,field:"positive_conditioning"}},{source:{node_id:We,field:"conditioning"},destination:{node_id:ke,field:"negative_conditioning"}},{source:{node_id:Le,field:"noise"},destination:{node_id:ke,field:"noise"}},{source:{node_id:Hn,field:"latents"},destination:{node_id:ke,field:"latents"}},{source:{node_id:ke,field:"latents"},destination:{node_id:Ke,field:"latents"}}]};if(c&&(u.width!==d||u.height!==f)){const O={id:Rs,type:"img_resize",image:{image_name:u.imageName},is_intermediate:!0,width:d,height:f};$.nodes[Rs]=O,$.edges.push({source:{node_id:Rs,field:"image"},destination:{node_id:Hn,field:"image"}}),$.edges.push({source:{node_id:Rs,field:"width"},destination:{node_id:Le,field:"width"}}),$.edges.push({source:{node_id:Rs,field:"height"},destination:{node_id:Le,field:"height"}})}else $.nodes[Hn].image={image_name:u.imageName},$.edges.push({source:{node_id:Hn,field:"width"},destination:{node_id:Le,field:"width"}}),$.edges.push({source:{node_id:Hn,field:"height"},destination:{node_id:Le,field:"height"}});return $.nodes[ht]={id:ht,type:"metadata_accumulator",generation_mode:"sdxl_img2img",cfg_scale:o,height:f,width:d,positive_prompt:n,negative_prompt:r,model:i,seed:s,steps:l,rand_device:T?"cpu":"cuda",scheduler:a,vae:void 0,controlnets:[],loras:[],ipAdapters:[],strength:S,init_image:u.imageName,positive_style_prompt:b,negative_style_prompt:v},$.edges.push({source:{node_id:ht,field:"metadata"},destination:{node_id:Ke,field:"metadata"}}),(m||_)&&(Oa(e,$,C),C=qr),g&&(Tp(e,$,ke),(m||_)&&(C=Qa)),Ma(e,$,C),kp(e,$,ke,C),Aa(e,$,ke),Pa(e,$,ke),e.system.shouldUseNSFWChecker&&Ia(e,$),e.system.shouldUseWatermarker&&Na(e,$),Ra(e,$),$},hEe=e=>{const t=Ce("nodes"),{positivePrompt:n,negativePrompt:r,model:i,cfgScale:o,scheduler:a,seed:s,steps:l,width:u,height:c,shouldUseCpuNoise:d,vaePrecision:f,seamlessXAxis:h,seamlessYAxis:p}=e.generation,{positiveStylePrompt:m,negativeStylePrompt:_,shouldUseSDXLRefiner:b,refinerStart:v}=e.sdxl,g=d;if(!i)throw t.error("No model found in state"),new Error("No model found in state");const y=f==="fp32",S=!0,{joinedPositiveStylePrompt:w,joinedNegativeStylePrompt:x}=Zd(e);let C=Vi;const T={id:OA,nodes:{[C]:{type:"sdxl_model_loader",id:C,model:i,is_intermediate:S},[Fe]:{type:"sdxl_compel_prompt",id:Fe,prompt:n,style:w,is_intermediate:S},[We]:{type:"sdxl_compel_prompt",id:We,prompt:r,style:x,is_intermediate:S},[Le]:{type:"noise",id:Le,seed:s,width:u,height:c,use_cpu:g,is_intermediate:S},[ke]:{type:"denoise_latents",id:ke,cfg_scale:o,scheduler:a,steps:l,denoising_start:0,denoising_end:b?v:1,is_intermediate:S},[Ke]:{type:"l2i",id:Ke,fp32:y,is_intermediate:S}},edges:[{source:{node_id:C,field:"unet"},destination:{node_id:ke,field:"unet"}},{source:{node_id:C,field:"clip"},destination:{node_id:Fe,field:"clip"}},{source:{node_id:C,field:"clip2"},destination:{node_id:Fe,field:"clip2"}},{source:{node_id:C,field:"clip"},destination:{node_id:We,field:"clip"}},{source:{node_id:C,field:"clip2"},destination:{node_id:We,field:"clip2"}},{source:{node_id:Fe,field:"conditioning"},destination:{node_id:ke,field:"positive_conditioning"}},{source:{node_id:We,field:"conditioning"},destination:{node_id:ke,field:"negative_conditioning"}},{source:{node_id:Le,field:"noise"},destination:{node_id:ke,field:"noise"}},{source:{node_id:ke,field:"latents"},destination:{node_id:Ke,field:"latents"}}]};return T.nodes[ht]={id:ht,type:"metadata_accumulator",generation_mode:"sdxl_txt2img",cfg_scale:o,height:c,width:u,positive_prompt:n,negative_prompt:r,model:i,seed:s,steps:l,rand_device:g?"cpu":"cuda",scheduler:a,vae:void 0,controlnets:[],loras:[],ipAdapters:[],positive_style_prompt:m,negative_style_prompt:_},T.edges.push({source:{node_id:ht,field:"metadata"},destination:{node_id:Ke,field:"metadata"}}),(h||p)&&(Oa(e,T,C),C=qr),b&&(Tp(e,T,ke),(h||p)&&(C=Qa)),Ma(e,T,C),kp(e,T,ke,C),Aa(e,T,ke),Pa(e,T,ke),e.system.shouldUseNSFWChecker&&Ia(e,T),e.system.shouldUseWatermarker&&Na(e,T),Ra(e,T),T},pEe=e=>{const t=Ce("nodes"),{positivePrompt:n,negativePrompt:r,model:i,cfgScale:o,scheduler:a,steps:s,width:l,height:u,clipSkip:c,shouldUseCpuNoise:d,vaePrecision:f,seamlessXAxis:h,seamlessYAxis:p,seed:m}=e.generation,_=d;if(!i)throw t.error("No model found in state"),new Error("No model found in state");const b=f==="fp32",v=!0,g=i.model_type==="onnx";let y=g?Wx:Tc;const S=g?"onnx_model_loader":"main_model_loader",w=g?{type:"t2l_onnx",id:Oe,is_intermediate:v,cfg_scale:o,scheduler:a,steps:s}:{type:"denoise_latents",id:Oe,is_intermediate:v,cfg_scale:o,scheduler:a,steps:s,denoising_start:0,denoising_end:1},x={id:XG,nodes:{[y]:{type:S,id:y,is_intermediate:v,model:i},[Yt]:{type:"clip_skip",id:Yt,skipped_layers:c,is_intermediate:v},[Fe]:{type:g?"prompt_onnx":"compel",id:Fe,prompt:n,is_intermediate:v},[We]:{type:g?"prompt_onnx":"compel",id:We,prompt:r,is_intermediate:v},[Le]:{type:"noise",id:Le,seed:m,width:l,height:u,use_cpu:_,is_intermediate:v},[w.id]:w,[Ke]:{type:g?"l2i_onnx":"l2i",id:Ke,fp32:b,is_intermediate:v}},edges:[{source:{node_id:y,field:"unet"},destination:{node_id:Oe,field:"unet"}},{source:{node_id:y,field:"clip"},destination:{node_id:Yt,field:"clip"}},{source:{node_id:Yt,field:"clip"},destination:{node_id:Fe,field:"clip"}},{source:{node_id:Yt,field:"clip"},destination:{node_id:We,field:"clip"}},{source:{node_id:Fe,field:"conditioning"},destination:{node_id:Oe,field:"positive_conditioning"}},{source:{node_id:We,field:"conditioning"},destination:{node_id:Oe,field:"negative_conditioning"}},{source:{node_id:Le,field:"noise"},destination:{node_id:Oe,field:"noise"}},{source:{node_id:Oe,field:"latents"},destination:{node_id:Ke,field:"latents"}}]};return x.nodes[ht]={id:ht,type:"metadata_accumulator",generation_mode:"txt2img",cfg_scale:o,height:u,width:l,positive_prompt:n,negative_prompt:r,model:i,seed:m,steps:s,rand_device:_?"cpu":"cuda",scheduler:a,vae:void 0,controlnets:[],loras:[],ipAdapters:[],clip_skip:c},x.edges.push({source:{node_id:ht,field:"metadata"},destination:{node_id:Ke,field:"metadata"}}),(h||p)&&(Oa(e,x,y),y=qr),Ma(e,x,y),Ep(e,x,Oe,y),Aa(e,x,Oe),Pa(e,x,Oe),e.system.shouldUseNSFWChecker&&Ia(e,x),e.system.shouldUseWatermarker&&Na(e,x),Ra(e,x),x},gEe=()=>{Be({predicate:e=>MA.match(e)&&(e.payload.tabName==="txt2img"||e.payload.tabName==="img2img"),effect:async(e,{getState:t,dispatch:n})=>{const r=t(),i=r.generation.model,{prepend:o}=e.payload;let a;i&&i.base_model==="sdxl"?e.payload.tabName==="txt2img"?a=hEe(r):a=fEe(r):e.payload.tabName==="txt2img"?a=pEe(r):a=dEe(r);const s=JG(r,a,o);n(Qr.endpoints.enqueueBatch.initiate(s,{fixedCacheKey:"enqueueBatch"})).reset()}})},mEe=/[$_\p{ID_Start}][$\u200c\u200d\p{ID_Continue}]*/u;function yEe(e){return e.length===1?e[0].toString():e.reduce((t,n)=>{if(typeof n=="number")return t+"["+n.toString()+"]";if(n.includes('"'))return t+'["'+vEe(n)+'"]';if(!mEe.test(n))return t+'["'+n+'"]';const r=t.length===0?"":".";return t+r+n},"")}function vEe(e){return e.replace(/"/g,'\\"')}function bEe(e){return e.length!==0}const _Ee=99,eH="; ",tH=", or ",$A="Validation error",nH=": ";class rH extends Error{constructor(n,r=[]){super(n);_w(this,"details");_w(this,"name");this.details=r,this.name="ZodValidationError"}toString(){return this.message}}function DA(e,t,n){if(e.code==="invalid_union")return e.unionErrors.reduce((r,i)=>{const o=i.issues.map(a=>DA(a,t,n)).join(t);return r.includes(o)||r.push(o),r},[]).join(n);if(bEe(e.path)){if(e.path.length===1){const r=e.path[0];if(typeof r=="number")return`${e.message} at index ${r}`}return`${e.message} at "${yEe(e.path)}"`}return e.message}function iH(e,t,n){return t!==null?e.length>0?[t,e].join(n):t:e.length>0?e:$A}function XWe(e,t={}){const{issueSeparator:n=eH,unionSeparator:r=tH,prefixSeparator:i=nH,prefix:o=$A}=t,a=DA(e,n,r),s=iH(a,o,i);return new rH(s,[e])}function $O(e,t={}){const{maxIssuesInMessage:n=_Ee,issueSeparator:r=eH,unionSeparator:i=tH,prefixSeparator:o=nH,prefix:a=$A}=t,s=e.errors.slice(0,n).map(u=>DA(u,r,i)).join(r),l=iH(s,a,o);return new rH(l,e.errors)}const SEe=e=>{const{workflow:t,nodes:n,edges:r}=e,i={...t,nodes:[],edges:[]};return n.filter(o=>["invocation","notes"].includes(o.type??"__UNKNOWN_NODE_TYPE__")).forEach(o=>{const a=jB.safeParse(o);if(!a.success){const{message:s}=$O(a.error,{prefix:be.t("nodes.unableToParseNode")});Ce("nodes").warn({node:Qt(o)},s);return}i.nodes.push(a.data)}),r.forEach(o=>{const a=UB.safeParse(o);if(!a.success){const{message:s}=$O(a.error,{prefix:be.t("nodes.unableToParseEdge")});Ce("nodes").warn({edge:Qt(o)},s);return}i.edges.push(a.data)}),i},xEe=e=>{if(e.type==="ColorField"&&e.value){const t=wn(e.value),{r:n,g:r,b:i,a:o}=e.value,a=Math.max(0,Math.min(o*255,255));return Object.assign(t,{r:n,g:r,b:i,a}),t}return e.value},wEe=e=>{const{nodes:t,edges:n}=e,r=t.filter(jr),i=JSON.stringify(SEe(e)),o=r.reduce((u,c)=>{const{id:d,data:f}=c,{type:h,inputs:p,isIntermediate:m,embedWorkflow:_}=f,b=Z3(p,(g,y,S)=>{const w=xEe(y);return g[S]=w,g},{});b.use_cache=c.data.useCache;const v={type:h,id:d,...b,is_intermediate:m};return _&&Object.assign(v,{workflow:i}),Object.assign(u,{[d]:v}),u},{}),s=n.filter(u=>u.type!=="collapsed").reduce((u,c)=>{const{source:d,target:f,sourceHandle:h,targetHandle:p}=c;return u.push({source:{node_id:d,field:h},destination:{node_id:f,field:p}}),u},[]);return s.forEach(u=>{const c=o[u.destination.node_id],d=u.destination.field;o[u.destination.node_id]=qS(c,d)}),{id:MV(),nodes:o,edges:s}},CEe=()=>{Be({predicate:e=>MA.match(e)&&e.payload.tabName==="nodes",effect:async(e,{getState:t,dispatch:n})=>{const r=t(),o={batch:{graph:wEe(r.nodes),runs:r.generation.iterations},prepend:e.payload.prepend};n(Qr.endpoints.enqueueBatch.initiate(o,{fixedCacheKey:"enqueueBatch"})).reset()}})},EEe=()=>{Be({matcher:me.endpoints.addImageToBoard.matchFulfilled,effect:e=>{const t=Ce("images"),{board_id:n,imageDTO:r}=e.meta.arg.originalArgs;t.debug({board_id:n,imageDTO:r},"Image added to board")}})},kEe=()=>{Be({matcher:me.endpoints.addImageToBoard.matchRejected,effect:e=>{const t=Ce("images"),{board_id:n,imageDTO:r}=e.meta.arg.originalArgs;t.debug({board_id:n,imageDTO:r},"Problem adding image to board")}})},LA=Ne("deleteImageModal/imageDeletionConfirmed"),YWe=Ii(e=>e,e=>e.gallery.selection[e.gallery.selection.length-1],Z2),oH=Ii([e=>e],e=>{const{selectedBoardId:t,galleryView:n}=e.gallery;return{board_id:t,categories:n==="images"?ii:Mu,offset:0,limit:mle,is_intermediate:!1}},Z2),TEe=()=>{Be({actionCreator:LA,effect:async(e,{dispatch:t,getState:n,condition:r})=>{var f;const{imageDTOs:i,imagesUsage:o}=e.payload;if(i.length!==1||o.length!==1)return;const a=i[0],s=o[0];if(!a||!s)return;t(WT(!1));const l=n(),u=(f=l.gallery.selection[l.gallery.selection.length-1])==null?void 0:f.image_name;if(a&&(a==null?void 0:a.image_name)===u){const{image_name:h}=a,p=oH(l),{data:m}=me.endpoints.listImages.select(p)(l),_=m?Vn.getSelectors().selectAll(m):[],b=_.findIndex(S=>S.image_name===h),v=_.filter(S=>S.image_name!==h),g=Ru(b,0,v.length-1),y=v[g];t(Us(y||null))}s.isCanvasImage&&t(gT()),i.forEach(h=>{var p;((p=n().generation.initialImage)==null?void 0:p.imageName)===h.image_name&&t(pT()),Ca(n().controlNet.controlNets,m=>{(m.controlImage===h.image_name||m.processedControlImage===h.image_name)&&(t(Sc({controlNetId:m.controlNetId,controlImage:null})),t(qT({controlNetId:m.controlNetId,processedControlImage:null})))}),n().controlNet.ipAdapterInfo.adapterImage===h.image_name&&t(V2(null)),n().nodes.nodes.forEach(m=>{jr(m)&&Ca(m.data.inputs,_=>{var b;_.type==="ImageField"&&((b=_.value)==null?void 0:b.image_name)===h.image_name&&t(X2({nodeId:m.data.id,fieldName:_.name,value:void 0}))})})});const{requestId:c}=t(me.endpoints.deleteImage.initiate(a));await r(h=>me.endpoints.deleteImage.matchFulfilled(h)&&h.meta.requestId===c,3e4)&&t(ls.util.invalidateTags([{type:"Board",id:a.board_id}]))}})},AEe=()=>{Be({actionCreator:LA,effect:async(e,{dispatch:t,getState:n})=>{const{imageDTOs:r,imagesUsage:i}=e.payload;if(!(r.length<=1||i.length<=1))try{await t(me.endpoints.deleteImages.initiate({imageDTOs:r})).unwrap();const o=n(),a=oH(o),{data:s}=me.endpoints.listImages.select(a)(o),l=s?Vn.getSelectors().selectAll(s)[0]:void 0;t(Us(l||null)),t(WT(!1)),i.some(u=>u.isCanvasImage)&&t(gT()),r.forEach(u=>{var c;((c=n().generation.initialImage)==null?void 0:c.imageName)===u.image_name&&t(pT()),Ca(n().controlNet.controlNets,d=>{(d.controlImage===u.image_name||d.processedControlImage===u.image_name)&&(t(Sc({controlNetId:d.controlNetId,controlImage:null})),t(qT({controlNetId:d.controlNetId,processedControlImage:null})))}),n().controlNet.ipAdapterInfo.adapterImage===u.image_name&&t(V2(null)),n().nodes.nodes.forEach(d=>{jr(d)&&Ca(d.data.inputs,f=>{var h;f.type==="ImageField"&&((h=f.value)==null?void 0:h.image_name)===u.image_name&&t(X2({nodeId:d.data.id,fieldName:f.name,value:void 0}))})})})}catch{}}})},PEe=()=>{Be({matcher:me.endpoints.deleteImage.matchPending,effect:()=>{}})},IEe=()=>{Be({matcher:me.endpoints.deleteImage.matchFulfilled,effect:e=>{Ce("images").debug({imageDTO:e.meta.arg.originalArgs},"Image deleted")}})},REe=()=>{Be({matcher:me.endpoints.deleteImage.matchRejected,effect:e=>{Ce("images").debug({imageDTO:e.meta.arg.originalArgs},"Unable to delete image")}})},aH=Ne("dnd/dndDropped"),OEe=()=>{Be({actionCreator:aH,effect:async(e,{dispatch:t})=>{const n=Ce("dnd"),{activeData:r,overData:i}=e.payload;if(r.payloadType==="IMAGE_DTO"?n.debug({activeData:r,overData:i},"Image dropped"):r.payloadType==="IMAGE_DTOS"?n.debug({activeData:r,overData:i},`Images (${r.payload.imageDTOs.length}) dropped`):r.payloadType==="NODE_FIELD"?n.debug({activeData:Qt(r),overData:Qt(i)},"Node field dropped"):n.debug({activeData:r,overData:i},"Unknown payload dropped"),i.actionType==="ADD_FIELD_TO_LINEAR"&&r.payloadType==="NODE_FIELD"){const{nodeId:o,field:a}=r.payload;t(JSe({nodeId:o,fieldName:a.name}))}if(i.actionType==="SET_CURRENT_IMAGE"&&r.payloadType==="IMAGE_DTO"&&r.payload.imageDTO){t(Us(r.payload.imageDTO));return}if(i.actionType==="SET_INITIAL_IMAGE"&&r.payloadType==="IMAGE_DTO"&&r.payload.imageDTO){t(XS(r.payload.imageDTO));return}if(i.actionType==="SET_CONTROLNET_IMAGE"&&r.payloadType==="IMAGE_DTO"&&r.payload.imageDTO){const{controlNetId:o}=i.context;t(Sc({controlImage:r.payload.imageDTO.image_name,controlNetId:o})),t(rU({controlNetId:o,isEnabled:!0}));return}if(i.actionType==="SET_IP_ADAPTER_IMAGE"&&r.payloadType==="IMAGE_DTO"&&r.payload.imageDTO){t(V2(r.payload.imageDTO.image_name)),t(iU(!0));return}if(i.actionType==="SET_CANVAS_INITIAL_IMAGE"&&r.payloadType==="IMAGE_DTO"&&r.payload.imageDTO){t(EB(r.payload.imageDTO));return}if(i.actionType==="SET_NODES_IMAGE"&&r.payloadType==="IMAGE_DTO"&&r.payload.imageDTO){const{fieldName:o,nodeId:a}=i.context;t(X2({nodeId:a,fieldName:o,value:r.payload.imageDTO}));return}if(i.actionType==="ADD_TO_BOARD"&&r.payloadType==="IMAGE_DTO"&&r.payload.imageDTO){const{imageDTO:o}=r.payload,{boardId:a}=i.context;t(me.endpoints.addImageToBoard.initiate({imageDTO:o,board_id:a}));return}if(i.actionType==="REMOVE_FROM_BOARD"&&r.payloadType==="IMAGE_DTO"&&r.payload.imageDTO){const{imageDTO:o}=r.payload;t(me.endpoints.removeImageFromBoard.initiate({imageDTO:o}));return}if(i.actionType==="ADD_TO_BOARD"&&r.payloadType==="IMAGE_DTOS"&&r.payload.imageDTOs){const{imageDTOs:o}=r.payload,{boardId:a}=i.context;t(me.endpoints.addImagesToBoard.initiate({imageDTOs:o,board_id:a}));return}if(i.actionType==="REMOVE_FROM_BOARD"&&r.payloadType==="IMAGE_DTOS"&&r.payload.imageDTOs){const{imageDTOs:o}=r.payload;t(me.endpoints.removeImagesFromBoard.initiate({imageDTOs:o}));return}}})},MEe=()=>{Be({matcher:me.endpoints.removeImageFromBoard.matchFulfilled,effect:e=>{const t=Ce("images"),n=e.meta.arg.originalArgs;t.debug({imageDTO:n},"Image removed from board")}})},NEe=()=>{Be({matcher:me.endpoints.removeImageFromBoard.matchRejected,effect:e=>{const t=Ce("images"),n=e.meta.arg.originalArgs;t.debug({imageDTO:n},"Problem removing image from board")}})},$Ee=()=>{Be({actionCreator:d0e,effect:async(e,{dispatch:t,getState:n})=>{const r=e.payload,i=n(),{shouldConfirmOnDelete:o}=i.system,a=xxe(n()),s=a.some(l=>l.isCanvasImage)||a.some(l=>l.isInitialImage)||a.some(l=>l.isControlNetImage)||a.some(l=>l.isIPAdapterImage)||a.some(l=>l.isNodesImage);if(o||s){t(WT(!0));return}t(LA({imageDTOs:r,imagesUsage:a}))}})},DEe=()=>{Be({matcher:me.endpoints.uploadImage.matchFulfilled,effect:(e,{dispatch:t,getState:n})=>{const r=Ce("images"),i=e.payload,o=n(),{autoAddBoardId:a}=o.gallery;r.debug({imageDTO:i},"Image uploaded");const{postUploadAction:s}=e.meta.arg.originalArgs;if(e.payload.is_intermediate&&!s)return;const l={title:Z("toast.imageUploaded"),status:"success"};if((s==null?void 0:s.type)==="TOAST"){const{toastOptions:u}=s;if(!a||a==="none")t(Gt({...l,...u}));else{t(me.endpoints.addImageToBoard.initiate({board_id:a,imageDTO:i}));const{data:c}=xi.endpoints.listAllBoards.select()(o),d=c==null?void 0:c.find(h=>h.board_id===a),f=d?`${Z("toast.addedToBoard")} ${d.board_name}`:`${Z("toast.addedToBoard")} ${a}`;t(Gt({...l,description:f}))}return}if((s==null?void 0:s.type)==="SET_CANVAS_INITIAL_IMAGE"){t(EB(i)),t(Gt({...l,description:Z("toast.setCanvasInitialImage")}));return}if((s==null?void 0:s.type)==="SET_CONTROLNET_IMAGE"){const{controlNetId:u}=s;t(rU({controlNetId:u,isEnabled:!0})),t(Sc({controlNetId:u,controlImage:i.image_name})),t(Gt({...l,description:Z("toast.setControlImage")}));return}if((s==null?void 0:s.type)==="SET_IP_ADAPTER_IMAGE"){t(V2(i.image_name)),t(iU(!0)),t(Gt({...l,description:Z("toast.setIPAdapterImage")}));return}if((s==null?void 0:s.type)==="SET_INITIAL_IMAGE"){t(XS(i)),t(Gt({...l,description:Z("toast.setInitialImage")}));return}if((s==null?void 0:s.type)==="SET_NODES_IMAGE"){const{nodeId:u,fieldName:c}=s;t(X2({nodeId:u,fieldName:c,value:i})),t(Gt({...l,description:`${Z("toast.setNodeField")} ${c}`}));return}}})},LEe=()=>{Be({matcher:me.endpoints.uploadImage.matchRejected,effect:(e,{dispatch:t})=>{const n=Ce("images"),r={arg:{...qS(e.meta.arg.originalArgs,["file","postUploadAction"]),file:""}};n.error({...r},"Image upload failed"),t(Gt({title:Z("toast.imageUploadFailed"),description:e.error.message,status:"error"}))}})},FEe=()=>{Be({matcher:me.endpoints.starImages.matchFulfilled,effect:async(e,{dispatch:t,getState:n})=>{const{updated_image_names:r}=e.payload,i=n(),{selection:o}=i.gallery,a=[];o.forEach(s=>{r.includes(s.image_name)?a.push({...s,starred:!0}):a.push(s)}),t(cU(a))}})},BEe=()=>{Be({matcher:me.endpoints.unstarImages.matchFulfilled,effect:async(e,{dispatch:t,getState:n})=>{const{updated_image_names:r}=e.payload,i=n(),{selection:o}=i.gallery,a=[];o.forEach(s=>{r.includes(s.image_name)?a.push({...s,starred:!1}):a.push(s)}),t(cU(a))}})},zEe=Ne("generation/initialImageSelected"),jEe=Ne("generation/modelSelected"),UEe=()=>{Be({actionCreator:zEe,effect:(e,{dispatch:t})=>{if(!e.payload){t(Gt($d({title:Z("toast.imageNotLoadedDesc"),status:"error"})));return}t(XS(e.payload)),t(Gt($d(Z("toast.sentToImageToImage"))))}})},VEe=()=>{Be({actionCreator:jEe,effect:(e,{getState:t,dispatch:n})=>{var l,u;const r=Ce("models"),i=t(),o=ly.safeParse(e.payload);if(!o.success){r.error({error:o.error.format()},"Failed to parse main model");return}const a=o.data,{base_model:s}=a;if(((l=i.generation.model)==null?void 0:l.base_model)!==s){let c=0;Ca(i.lora.loras,(p,m)=>{p.base_model!==s&&(n(fU(m)),c+=1)});const{vae:d}=i.generation;d&&d.base_model!==s&&(n(SB(null)),c+=1);const{controlNets:f}=i.controlNet;Ca(f,(p,m)=>{var _;((_=p.model)==null?void 0:_.base_model)!==s&&(n(nU({controlNetId:m})),c+=1)});const{ipAdapterInfo:h}=i.controlNet;h.model&&h.model.base_model!==s&&(n(oU()),c+=1),c>0&&n(Gt($d({title:`${Z("toast.baseModelChangedCleared")} ${c} ${Z("toast.incompatibleSubmodel")}${c===1?"":"s"}`,status:"warning"})))}((u=i.generation.model)==null?void 0:u.base_model)!==a.base_model&&i.ui.shouldAutoChangeDimensions&&(["sdxl","sdxl-refiner"].includes(a.base_model)?(n(Z8(1024)),n(J8(1024)),n(eI({width:1024,height:1024}))):(n(Z8(512)),n(J8(512)),n(eI({width:512,height:512})))),n(Ou(a))}})},_0=Js({sortComparer:(e,t)=>e.model_name.localeCompare(t.model_name)}),DO=Js({sortComparer:(e,t)=>e.model_name.localeCompare(t.model_name)}),LO=Js({sortComparer:(e,t)=>e.model_name.localeCompare(t.model_name)}),FO=Js({sortComparer:(e,t)=>e.model_name.localeCompare(t.model_name)}),BO=Js({sortComparer:(e,t)=>e.model_name.localeCompare(t.model_name)}),zO=Js({sortComparer:(e,t)=>e.model_name.localeCompare(t.model_name)}),t4=Js({sortComparer:(e,t)=>e.model_name.localeCompare(t.model_name)}),GEe=({base_model:e,model_type:t,model_name:n})=>`${e}/${t}/${n}`,Dc=e=>{const t=[];return e.forEach(n=>{const r={...wn(n),id:GEe(n)};t.push(r)}),t},vu=ls.injectEndpoints({endpoints:e=>({getOnnxModels:e.query({query:t=>{const n={model_type:"onnx",base_models:t};return`models/?${Kg.stringify(n,{arrayFormat:"none"})}`},providesTags:t=>{const n=[{type:"OnnxModel",id:Dt}];return t&&n.push(...t.ids.map(r=>({type:"OnnxModel",id:r}))),n},transformResponse:t=>{const n=Dc(t.models);return DO.setAll(DO.getInitialState(),n)}}),getMainModels:e.query({query:t=>{const n={model_type:"main",base_models:t};return`models/?${Kg.stringify(n,{arrayFormat:"none"})}`},providesTags:t=>{const n=[{type:"MainModel",id:Dt}];return t&&n.push(...t.ids.map(r=>({type:"MainModel",id:r}))),n},transformResponse:t=>{const n=Dc(t.models);return _0.setAll(_0.getInitialState(),n)}}),updateMainModels:e.mutation({query:({base_model:t,model_name:n,body:r})=>({url:`models/${t}/main/${n}`,method:"PATCH",body:r}),invalidatesTags:[{type:"MainModel",id:Dt},{type:"SDXLRefinerModel",id:Dt},{type:"OnnxModel",id:Dt}]}),importMainModels:e.mutation({query:({body:t})=>({url:"models/import",method:"POST",body:t}),invalidatesTags:[{type:"MainModel",id:Dt},{type:"SDXLRefinerModel",id:Dt},{type:"OnnxModel",id:Dt}]}),addMainModels:e.mutation({query:({body:t})=>({url:"models/add",method:"POST",body:t}),invalidatesTags:[{type:"MainModel",id:Dt},{type:"SDXLRefinerModel",id:Dt},{type:"OnnxModel",id:Dt}]}),deleteMainModels:e.mutation({query:({base_model:t,model_name:n,model_type:r})=>({url:`models/${t}/${r}/${n}`,method:"DELETE"}),invalidatesTags:[{type:"MainModel",id:Dt},{type:"SDXLRefinerModel",id:Dt},{type:"OnnxModel",id:Dt}]}),convertMainModels:e.mutation({query:({base_model:t,model_name:n,convert_dest_directory:r})=>({url:`models/convert/${t}/main/${n}`,method:"PUT",params:{convert_dest_directory:r}}),invalidatesTags:[{type:"MainModel",id:Dt},{type:"SDXLRefinerModel",id:Dt},{type:"OnnxModel",id:Dt}]}),mergeMainModels:e.mutation({query:({base_model:t,body:n})=>({url:`models/merge/${t}`,method:"PUT",body:n}),invalidatesTags:[{type:"MainModel",id:Dt},{type:"SDXLRefinerModel",id:Dt},{type:"OnnxModel",id:Dt}]}),syncModels:e.mutation({query:()=>({url:"models/sync",method:"POST"}),invalidatesTags:[{type:"MainModel",id:Dt},{type:"SDXLRefinerModel",id:Dt},{type:"OnnxModel",id:Dt}]}),getLoRAModels:e.query({query:()=>({url:"models/",params:{model_type:"lora"}}),providesTags:t=>{const n=[{type:"LoRAModel",id:Dt}];return t&&n.push(...t.ids.map(r=>({type:"LoRAModel",id:r}))),n},transformResponse:t=>{const n=Dc(t.models);return LO.setAll(LO.getInitialState(),n)}}),updateLoRAModels:e.mutation({query:({base_model:t,model_name:n,body:r})=>({url:`models/${t}/lora/${n}`,method:"PATCH",body:r}),invalidatesTags:[{type:"LoRAModel",id:Dt}]}),deleteLoRAModels:e.mutation({query:({base_model:t,model_name:n})=>({url:`models/${t}/lora/${n}`,method:"DELETE"}),invalidatesTags:[{type:"LoRAModel",id:Dt}]}),getControlNetModels:e.query({query:()=>({url:"models/",params:{model_type:"controlnet"}}),providesTags:t=>{const n=[{type:"ControlNetModel",id:Dt}];return t&&n.push(...t.ids.map(r=>({type:"ControlNetModel",id:r}))),n},transformResponse:t=>{const n=Dc(t.models);return FO.setAll(FO.getInitialState(),n)}}),getIPAdapterModels:e.query({query:()=>({url:"models/",params:{model_type:"ip_adapter"}}),providesTags:t=>{const n=[{type:"IPAdapterModel",id:Dt}];return t&&n.push(...t.ids.map(r=>({type:"IPAdapterModel",id:r}))),n},transformResponse:t=>{const n=Dc(t.models);return BO.setAll(BO.getInitialState(),n)}}),getVaeModels:e.query({query:()=>({url:"models/",params:{model_type:"vae"}}),providesTags:t=>{const n=[{type:"VaeModel",id:Dt}];return t&&n.push(...t.ids.map(r=>({type:"VaeModel",id:r}))),n},transformResponse:t=>{const n=Dc(t.models);return t4.setAll(t4.getInitialState(),n)}}),getTextualInversionModels:e.query({query:()=>({url:"models/",params:{model_type:"embedding"}}),providesTags:t=>{const n=[{type:"TextualInversionModel",id:Dt}];return t&&n.push(...t.ids.map(r=>({type:"TextualInversionModel",id:r}))),n},transformResponse:t=>{const n=Dc(t.models);return zO.setAll(zO.getInitialState(),n)}}),getModelsInFolder:e.query({query:t=>({url:`/models/search?${Kg.stringify(t,{})}`}),providesTags:t=>{const n=[{type:"ScannedModels",id:Dt}];return t&&n.push(...t.map(r=>({type:"ScannedModels",id:r}))),n}}),getCheckpointConfigs:e.query({query:()=>({url:"/models/ckpt_confs"})})})}),{useGetMainModelsQuery:ZWe,useGetOnnxModelsQuery:JWe,useGetControlNetModelsQuery:eKe,useGetIPAdapterModelsQuery:tKe,useGetLoRAModelsQuery:nKe,useGetTextualInversionModelsQuery:rKe,useGetVaeModelsQuery:iKe,useUpdateMainModelsMutation:oKe,useDeleteMainModelsMutation:aKe,useImportMainModelsMutation:sKe,useAddMainModelsMutation:lKe,useConvertMainModelsMutation:uKe,useMergeMainModelsMutation:cKe,useDeleteLoRAModelsMutation:dKe,useUpdateLoRAModelsMutation:fKe,useSyncModelsMutation:hKe,useGetModelsInFolderQuery:pKe,useGetCheckpointConfigsQuery:gKe}=vu,HEe=()=>{Be({predicate:e=>vu.endpoints.getMainModels.matchFulfilled(e)&&!e.meta.arg.originalArgs.includes("sdxl-refiner"),effect:async(e,{getState:t,dispatch:n})=>{const r=Ce("models");r.info({models:e.payload.entities},`Main models loaded (${e.payload.ids.length})`);const i=t().generation.model,o=_0.getSelectors().selectAll(e.payload);if(o.length===0){n(Ou(null));return}if(i?o.some(l=>l.model_name===i.model_name&&l.base_model===i.base_model&&l.model_type===i.model_type):!1)return;const s=ly.safeParse(o[0]);if(!s.success){r.error({error:s.error.format()},"Failed to parse main model");return}n(Ou(s.data))}}),Be({predicate:e=>vu.endpoints.getMainModels.matchFulfilled(e)&&e.meta.arg.originalArgs.includes("sdxl-refiner"),effect:async(e,{getState:t,dispatch:n})=>{const r=Ce("models");r.info({models:e.payload.entities},`SDXL Refiner models loaded (${e.payload.ids.length})`);const i=t().sdxl.refinerModel,o=_0.getSelectors().selectAll(e.payload);if(o.length===0){n(G9(null)),n(r2e(!1));return}if(i?o.some(l=>l.model_name===i.model_name&&l.base_model===i.base_model&&l.model_type===i.model_type):!1)return;const s=fT.safeParse(o[0]);if(!s.success){r.error({error:s.error.format()},"Failed to parse SDXL Refiner Model");return}n(G9(s.data))}}),Be({matcher:vu.endpoints.getVaeModels.matchFulfilled,effect:async(e,{getState:t,dispatch:n})=>{const r=Ce("models");r.info({models:e.payload.entities},`VAEs loaded (${e.payload.ids.length})`);const i=t().generation.vae;if(i===null||Vg(e.payload.entities,l=>(l==null?void 0:l.model_name)===(i==null?void 0:i.model_name)&&(l==null?void 0:l.base_model)===(i==null?void 0:i.base_model)))return;const a=t4.getSelectors().selectAll(e.payload)[0];if(!a){n(Ou(null));return}const s=jse.safeParse(a);if(!s.success){r.error({error:s.error.format()},"Failed to parse VAE model");return}n(SB(s.data))}}),Be({matcher:vu.endpoints.getLoRAModels.matchFulfilled,effect:async(e,{getState:t,dispatch:n})=>{Ce("models").info({models:e.payload.entities},`LoRAs loaded (${e.payload.ids.length})`);const i=t().lora.loras;Ca(i,(o,a)=>{Vg(e.payload.entities,l=>(l==null?void 0:l.model_name)===(o==null?void 0:o.model_name)&&(l==null?void 0:l.base_model)===(o==null?void 0:o.base_model))||n(fU(a))})}}),Be({matcher:vu.endpoints.getControlNetModels.matchFulfilled,effect:async(e,{getState:t,dispatch:n})=>{Ce("models").info({models:e.payload.entities},`ControlNet models loaded (${e.payload.ids.length})`);const i=t().controlNet.controlNets;Ca(i,(o,a)=>{Vg(e.payload.entities,l=>{var u,c;return(l==null?void 0:l.model_name)===((u=o==null?void 0:o.model)==null?void 0:u.model_name)&&(l==null?void 0:l.base_model)===((c=o==null?void 0:o.model)==null?void 0:c.base_model)})||n(nU({controlNetId:a}))})}}),Be({matcher:vu.endpoints.getTextualInversionModels.matchFulfilled,effect:async e=>{Ce("models").info({models:e.payload.entities},`Embeddings loaded (${e.payload.ids.length})`)}})},qEe=ls.injectEndpoints({endpoints:e=>({dynamicPrompts:e.query({query:t=>({url:"utilities/dynamicprompts",body:t,method:"POST"}),keepUnusedDataFor:86400})})}),WEe=No(Yse,m0e,p0e,g0e,BT),KEe=()=>{Be({matcher:WEe,effect:async(e,{dispatch:t,getState:n,cancelActiveListeners:r,delay:i})=>{r(),await i(1e3);const o=n();if(o.config.disabledFeatures.includes("dynamicPrompting"))return;const{positivePrompt:a}=o.generation,{maxPrompts:s}=o.dynamicPrompts;t(RC(!0));try{const l=t(qEe.endpoints.dynamicPrompts.initiate({prompt:a,max_prompts:s})),u=await l.unwrap();l.unsubscribe(),t(y0e(u.prompts)),t(v0e(u.error)),t(UR(!1)),t(RC(!1))}catch{t(UR(!0)),t(RC(!1))}}})},bf=e=>e.$ref.split("/").slice(-1)[0],QEe=({schemaObject:e,baseField:t})=>{const n={...t,type:"integer",default:e.default??0};return e.multipleOf!==void 0&&(n.multipleOf=e.multipleOf),e.maximum!==void 0&&(n.maximum=e.maximum),e.exclusiveMaximum!==void 0&&(n.exclusiveMaximum=e.exclusiveMaximum),e.minimum!==void 0&&(n.minimum=e.minimum),e.exclusiveMinimum!==void 0&&(n.exclusiveMinimum=e.exclusiveMinimum),n},XEe=({schemaObject:e,baseField:t})=>{const n={...t,type:"IntegerPolymorphic",default:e.default??0};return e.multipleOf!==void 0&&(n.multipleOf=e.multipleOf),e.maximum!==void 0&&(n.maximum=e.maximum),e.exclusiveMaximum!==void 0&&(n.exclusiveMaximum=e.exclusiveMaximum),e.minimum!==void 0&&(n.minimum=e.minimum),e.exclusiveMinimum!==void 0&&(n.exclusiveMinimum=e.exclusiveMinimum),n},YEe=({schemaObject:e,baseField:t})=>{const n=JF(e.item_default)&&Poe(e.item_default)?e.item_default:0;return{...t,type:"IntegerCollection",default:e.default??[],item_default:n}},ZEe=({schemaObject:e,baseField:t})=>{const n={...t,type:"float",default:e.default??0};return e.multipleOf!==void 0&&(n.multipleOf=e.multipleOf),e.maximum!==void 0&&(n.maximum=e.maximum),e.exclusiveMaximum!==void 0&&(n.exclusiveMaximum=e.exclusiveMaximum),e.minimum!==void 0&&(n.minimum=e.minimum),e.exclusiveMinimum!==void 0&&(n.exclusiveMinimum=e.exclusiveMinimum),n},JEe=({schemaObject:e,baseField:t})=>{const n={...t,type:"FloatPolymorphic",default:e.default??0};return e.multipleOf!==void 0&&(n.multipleOf=e.multipleOf),e.maximum!==void 0&&(n.maximum=e.maximum),e.exclusiveMaximum!==void 0&&(n.exclusiveMaximum=e.exclusiveMaximum),e.minimum!==void 0&&(n.minimum=e.minimum),e.exclusiveMinimum!==void 0&&(n.exclusiveMinimum=e.exclusiveMinimum),n},e4e=({schemaObject:e,baseField:t})=>{const n=JF(e.item_default)?e.item_default:0;return{...t,type:"FloatCollection",default:e.default??[],item_default:n}},t4e=({schemaObject:e,baseField:t})=>{const n={...t,type:"string",default:e.default??""};return e.minLength!==void 0&&(n.minLength=e.minLength),e.maxLength!==void 0&&(n.maxLength=e.maxLength),e.pattern!==void 0&&(n.pattern=e.pattern),n},n4e=({schemaObject:e,baseField:t})=>{const n={...t,type:"StringPolymorphic",default:e.default??""};return e.minLength!==void 0&&(n.minLength=e.minLength),e.maxLength!==void 0&&(n.maxLength=e.maxLength),e.pattern!==void 0&&(n.pattern=e.pattern),n},r4e=({schemaObject:e,baseField:t})=>{const n=uT(e.item_default)?e.item_default:"";return{...t,type:"StringCollection",default:e.default??[],item_default:n}},i4e=({schemaObject:e,baseField:t})=>({...t,type:"boolean",default:e.default??!1}),o4e=({schemaObject:e,baseField:t})=>({...t,type:"BooleanPolymorphic",default:e.default??!1}),a4e=({schemaObject:e,baseField:t})=>{const n=e.item_default&&Aoe(e.item_default)?e.item_default:!1;return{...t,type:"BooleanCollection",default:e.default??[],item_default:n}},s4e=({schemaObject:e,baseField:t})=>({...t,type:"MainModelField",default:e.default??void 0}),l4e=({schemaObject:e,baseField:t})=>({...t,type:"SDXLMainModelField",default:e.default??void 0}),u4e=({schemaObject:e,baseField:t})=>({...t,type:"SDXLRefinerModelField",default:e.default??void 0}),c4e=({schemaObject:e,baseField:t})=>({...t,type:"VaeModelField",default:e.default??void 0}),d4e=({schemaObject:e,baseField:t})=>({...t,type:"LoRAModelField",default:e.default??void 0}),f4e=({schemaObject:e,baseField:t})=>({...t,type:"ControlNetModelField",default:e.default??void 0}),h4e=({schemaObject:e,baseField:t})=>({...t,type:"IPAdapterModelField",default:e.default??void 0}),p4e=({schemaObject:e,baseField:t})=>({...t,type:"BoardField",default:e.default??void 0}),g4e=({schemaObject:e,baseField:t})=>({...t,type:"ImageField",default:e.default??void 0}),m4e=({schemaObject:e,baseField:t})=>({...t,type:"ImagePolymorphic",default:e.default??void 0}),y4e=({schemaObject:e,baseField:t})=>({...t,type:"ImageCollection",default:e.default??[],item_default:e.item_default??void 0}),v4e=({schemaObject:e,baseField:t})=>({...t,type:"DenoiseMaskField",default:e.default??void 0}),b4e=({schemaObject:e,baseField:t})=>({...t,type:"LatentsField",default:e.default??void 0}),_4e=({schemaObject:e,baseField:t})=>({...t,type:"LatentsPolymorphic",default:e.default??void 0}),S4e=({schemaObject:e,baseField:t})=>({...t,type:"LatentsCollection",default:e.default??[],item_default:e.item_default??void 0}),x4e=({schemaObject:e,baseField:t})=>({...t,type:"ConditioningField",default:e.default??void 0}),w4e=({schemaObject:e,baseField:t})=>({...t,type:"ConditioningPolymorphic",default:e.default??void 0}),C4e=({schemaObject:e,baseField:t})=>({...t,type:"ConditioningCollection",default:e.default??[],item_default:e.item_default??void 0}),E4e=({schemaObject:e,baseField:t})=>({...t,type:"UNetField",default:e.default??void 0}),k4e=({schemaObject:e,baseField:t})=>({...t,type:"ClipField",default:e.default??void 0}),T4e=({schemaObject:e,baseField:t})=>({...t,type:"VaeField",default:e.default??void 0}),A4e=({schemaObject:e,baseField:t})=>({...t,type:"ControlField",default:e.default??void 0}),P4e=({schemaObject:e,baseField:t})=>({...t,type:"ControlPolymorphic",default:e.default??void 0}),I4e=({schemaObject:e,baseField:t})=>({...t,type:"ControlCollection",default:e.default??[],item_default:e.item_default??void 0}),R4e=({schemaObject:e,baseField:t})=>({...t,type:"IPAdapterField",default:e.default??void 0}),O4e=({schemaObject:e,baseField:t})=>{const n=e.enum??[];return{...t,type:"enum",options:n,ui_choice_labels:e.ui_choice_labels,default:e.default??n[0]}},M4e=({baseField:e})=>({...e,type:"Collection",default:[]}),N4e=({baseField:e})=>({...e,type:"CollectionItem",default:void 0}),$4e=({schemaObject:e,baseField:t})=>({...t,type:"ColorField",default:e.default??{r:127,g:127,b:127,a:255}}),D4e=({schemaObject:e,baseField:t})=>({...t,type:"ColorPolymorphic",default:e.default??{r:127,g:127,b:127,a:255}}),L4e=({schemaObject:e,baseField:t})=>({...t,type:"ColorCollection",default:e.default??[]}),F4e=({schemaObject:e,baseField:t})=>({...t,type:"Scheduler",default:e.default??"euler"}),jO=e=>{if(e!=null&&e.ui_type)return e.ui_type;if(e.type){if(e.enum)return"enum";if(e.type){if(e.type==="number")return"float";if(e.type==="array"){const t=que(e.items)?e.items.type:bf(e.items);return tSe(t)?fA[t]:void 0}else return e.type}}else if(e.allOf){const t=e.allOf;if(t&&t[0]&&Gp(t[0]))return bf(t[0])}else if(e.anyOf){const t=e.anyOf;let n,r;if(dI(t[0])){const i=t[0].items,o=t[1];Gp(i)&&Gp(o)?(n=bf(i),r=bf(o)):mv(i)&&mv(o)&&(n=i.type,r=o.type)}else if(dI(t[1])){const i=t[0],o=t[1].items;Gp(i)&&Gp(o)?(n=bf(i),r=bf(o)):mv(i)&&mv(o)&&(n=i.type,r=o.type)}if(n===r&&rSe(n))return NV[n]}},sH={BoardField:p4e,boolean:i4e,BooleanCollection:a4e,BooleanPolymorphic:o4e,ClipField:k4e,Collection:M4e,CollectionItem:N4e,ColorCollection:L4e,ColorField:$4e,ColorPolymorphic:D4e,ConditioningCollection:C4e,ConditioningField:x4e,ConditioningPolymorphic:w4e,ControlCollection:I4e,ControlField:A4e,ControlNetModelField:f4e,ControlPolymorphic:P4e,DenoiseMaskField:v4e,enum:O4e,float:ZEe,FloatCollection:e4e,FloatPolymorphic:JEe,ImageCollection:y4e,ImageField:g4e,ImagePolymorphic:m4e,integer:QEe,IntegerCollection:YEe,IntegerPolymorphic:XEe,IPAdapterField:R4e,IPAdapterModelField:h4e,LatentsCollection:S4e,LatentsField:b4e,LatentsPolymorphic:_4e,LoRAModelField:d4e,MainModelField:s4e,Scheduler:F4e,SDXLMainModelField:l4e,SDXLRefinerModelField:u4e,string:t4e,StringCollection:r4e,StringPolymorphic:n4e,UNetField:E4e,VaeField:T4e,VaeModelField:c4e},B4e=e=>!!(e&&e in sH),z4e=(e,t,n,r)=>{var f;const{input:i,ui_hidden:o,ui_component:a,ui_type:s,ui_order:l}=t,u={input:xg.includes(r)?"connection":i,ui_hidden:o,ui_component:a,ui_type:s,required:((f=e.required)==null?void 0:f.includes(n))??!1,ui_order:l},c={name:n,title:t.title??"",description:t.description??"",fieldKind:"input",...u};if(!B4e(r))return;const d=sH[r];if(d)return d({schemaObject:t,baseField:c})},j4e=["id","type","metadata","use_cache"],U4e=["type"],V4e=["WorkflowField","MetadataField","IsIntermediate"],G4e=["graph","metadata_accumulator"],H4e=(e,t)=>!!(j4e.includes(t)||e==="collect"&&t==="collection"||e==="iterate"&&t==="index"),q4e=e=>!!V4e.includes(e),W4e=(e,t)=>!U4e.includes(t),K4e=e=>!G4e.includes(e.properties.type.default),Q4e=(e,t=void 0,n=void 0)=>{var o;return Object.values(((o=e.components)==null?void 0:o.schemas)??{}).filter(Wue).filter(K4e).filter(a=>t?t.includes(a.properties.type.default):!0).filter(a=>n?!n.includes(a.properties.type.default):!0).reduce((a,s)=>{var y,S;const l=s.properties.type.default,u=s.title.replace("Invocation",""),c=s.tags??[],d=s.description??"",f=s.version,h=Z3(s.properties,(w,x,C)=>{if(H4e(l,C))return Ce("nodes").trace({node:l,fieldName:C,field:Qt(x)},"Skipped reserved input field"),w;if(!fI(x))return Ce("nodes").warn({node:l,propertyName:C,property:Qt(x)},"Unhandled input property"),w;const T=jO(x);if(!cI(T))return Ce("nodes").warn({node:l,fieldName:C,fieldType:T,field:Qt(x)},"Skipping unknown input field type"),w;if(q4e(T))return Ce("nodes").trace({node:l,fieldName:C,fieldType:T,field:Qt(x)},"Skipping reserved field type"),w;const k=z4e(s,x,C,T);return k?(w[C]=k,w):(Ce("nodes").debug({node:l,fieldName:C,fieldType:T,field:Qt(x)},"Skipping input field with no template"),w)},{}),p=s.output.$ref.split("/").pop();if(!p)return Ce("nodes").warn({outputRefObject:Qt(s.output)},"No output schema name found in ref object"),a;const m=(S=(y=e.components)==null?void 0:y.schemas)==null?void 0:S[p];if(!m)return Ce("nodes").warn({outputSchemaName:p},"Output schema not found"),a;if(!Kue(m))return Ce("nodes").error({outputSchema:Qt(m)},"Invalid output schema"),a;const _=m.properties.type.default,b=Z3(m.properties,(w,x,C)=>{if(!W4e(l,C))return Ce("nodes").trace({type:l,propertyName:C,property:Qt(x)},"Skipped reserved output field"),w;if(!fI(x))return Ce("nodes").warn({type:l,propertyName:C,property:Qt(x)},"Unhandled output property"),w;const T=jO(x);return cI(T)?(w[C]={fieldKind:"output",name:C,title:x.title??"",description:x.description??"",type:T,ui_hidden:x.ui_hidden??!1,ui_type:x.ui_type,ui_order:x.ui_order},w):(Ce("nodes").warn({fieldName:C,fieldType:T,field:Qt(x)},"Skipping unknown output field type"),w)},{}),v=s.properties.use_cache.default,g={title:u,type:l,version:f,tags:c,description:d,outputType:_,inputs:h,outputs:b,useCache:v};return Object.assign(a,{[l]:g}),a},{})},X4e=()=>{Be({actionCreator:g0.fulfilled,effect:(e,{dispatch:t,getState:n})=>{const r=Ce("system"),i=e.payload;r.debug({schemaJSON:i},"Received OpenAPI schema");const{nodesAllowlist:o,nodesDenylist:a}=n().config,s=Q4e(i,o,a);r.debug({nodeTemplates:Qt(s)},`Built ${WS(s)} node templates`),t(GV(s))}}),Be({actionCreator:g0.rejected,effect:e=>{Ce("system").error({error:Qt(e.error)},"Problem retrieving OpenAPI Schema")}})},Y4e=()=>{Be({actionCreator:Lj,effect:(e,{dispatch:t,getState:n})=>{Ce("socketio").debug("Connected");const{nodes:i,config:o,system:a}=n(),{disabledTabs:s}=o;!WS(i.nodeTemplates)&&!s.includes("nodes")&&t(g0()),a.isInitialized?t(ls.util.resetApiState()):t(l2e(!0)),t(BT(e.payload))}})},Z4e=()=>{Be({actionCreator:Fj,effect:(e,{dispatch:t})=>{Ce("socketio").debug("Disconnected"),t(Bj(e.payload))}})},J4e=()=>{Be({actionCreator:Gj,effect:(e,{dispatch:t})=>{Ce("socketio").trace(e.payload,"Generator progress"),t(VT(e.payload))}})},eke=()=>{Be({actionCreator:Uj,effect:(e,{dispatch:t})=>{Ce("socketio").debug(e.payload,"Session complete"),t(Vj(e.payload))}})},tke=["load_image","image"],nke=()=>{Be({actionCreator:jT,effect:async(e,{dispatch:t,getState:n})=>{const r=Ce("socketio"),{data:i}=e.payload;r.debug({data:Qt(i)},`Invocation complete (${e.payload.data.node.type})`);const{result:o,node:a,queue_batch_id:s}=i;if(ZG(o)&&!tke.includes(a.type)){const{image_name:l}=o.image,{canvas:u,gallery:c}=n(),d=await t(me.endpoints.getImageDTO.initiate(l)).unwrap();if(u.batchIds.includes(s)&&[ye].includes(i.source_node_id)&&t(ile(d)),!d.is_intermediate){t(me.util.updateQueryData("listImages",{board_id:d.board_id??"none",categories:ii},h=>{Vn.addOne(h,d)})),t(me.util.invalidateTags([{type:"BoardImagesTotal",id:d.board_id},{type:"BoardAssetsTotal",id:d.board_id},{type:"Board",id:d.board_id}]));const{shouldAutoSwitch:f}=c;f&&(c.galleryView!=="images"&&t(SE("images")),d.board_id&&d.board_id!==c.selectedBoardId&&t(w_({boardId:d.board_id,selectedImageName:d.image_name})),!d.board_id&&c.selectedBoardId!=="none"&&t(w_({boardId:"none",selectedImageName:d.image_name})),t(Us(d)))}}t(UT(e.payload))}})},rke=()=>{Be({actionCreator:jj,effect:(e,{dispatch:t})=>{Ce("socketio").error(e.payload,`Invocation error (${e.payload.data.node.type})`),t(U2(e.payload))}})},ike=()=>{Be({actionCreator:Yj,effect:(e,{dispatch:t})=>{Ce("socketio").error(e.payload,`Invocation retrieval error (${e.payload.data.graph_execution_state_id})`),t(Zj(e.payload))}})},oke=()=>{Be({actionCreator:zj,effect:(e,{dispatch:t})=>{Ce("socketio").debug(e.payload,`Invocation started (${e.payload.data.node.type})`),t(zT(e.payload))}})},ake=()=>{Be({actionCreator:Hj,effect:(e,{dispatch:t})=>{const n=Ce("socketio"),{base_model:r,model_name:i,model_type:o,submodel:a}=e.payload.data;let s=`Model load started: ${r}/${o}/${i}`;a&&(s=s.concat(`/${a}`)),n.debug(e.payload,s),t(qj(e.payload))}}),Be({actionCreator:Wj,effect:(e,{dispatch:t})=>{const n=Ce("socketio"),{base_model:r,model_name:i,model_type:o,submodel:a}=e.payload.data;let s=`Model load complete: ${r}/${o}/${i}`;a&&(s=s.concat(`/${a}`)),n.debug(e.payload,s),t(Kj(e.payload))}})},ske=()=>{Be({actionCreator:Jj,effect:async(e,{dispatch:t})=>{const n=Ce("socketio"),{queue_item_id:r,queue_batch_id:i,status:o}=e.payload.data;n.debug(e.payload,`Queue item ${r} status updated: ${o}`),t(GT(e.payload)),t(Qr.util.updateQueryData("listQueueItems",void 0,s=>{qc.updateOne(s,{id:r,changes:e.payload.data})})),t(Qr.util.invalidateTags(["CurrentSessionQueueItem","NextSessionQueueItem","InvocationCacheStatus",{type:"SessionQueueItem",id:r},{type:"SessionQueueItemDTO",id:r},{type:"BatchStatus",id:i}]));const a=t(Qr.endpoints.getQueueStatus.initiate(void 0,{forceRefetch:!0}));await a.unwrap(),a.unsubscribe()}})},lke=()=>{Be({actionCreator:Qj,effect:(e,{dispatch:t})=>{Ce("socketio").error(e.payload,`Session retrieval error (${e.payload.data.graph_execution_state_id})`),t(Xj(e.payload))}})},uke=()=>{Be({actionCreator:t0e,effect:(e,{dispatch:t})=>{Ce("socketio").debug(e.payload,"Subscribed"),t(n0e(e.payload))}})},cke=()=>{Be({actionCreator:r0e,effect:(e,{dispatch:t})=>{Ce("socketio").debug(e.payload,"Unsubscribed"),t(i0e(e.payload))}})},dke=()=>{Be({actionCreator:Ixe,effect:async(e,{dispatch:t,getState:n})=>{const{imageDTO:r}=e.payload;try{const i=await t(me.endpoints.changeImageIsIntermediate.initiate({imageDTO:r,is_intermediate:!1})).unwrap(),{autoAddBoardId:o}=n().gallery;o&&o!=="none"&&await t(me.endpoints.addImageToBoard.initiate({imageDTO:i,board_id:o})),t(Gt({title:Z("toast.imageSaved"),status:"success"}))}catch(i){t(Gt({title:Z("toast.imageSavingFailed"),description:i==null?void 0:i.message,status:"error"}))}}})},mKe=["sd-1","sd-2","sdxl","sdxl-refiner"],fke=["sd-1","sd-2","sdxl"],yKe=["sdxl"],vKe=["sd-1","sd-2"],bKe=["sdxl-refiner"],hke=()=>{Be({actionCreator:rG,effect:async(e,{getState:t,dispatch:n})=>{var i;if(e.payload==="unifiedCanvas"){const o=(i=t().generation.model)==null?void 0:i.base_model;if(o&&["sd-1","sd-2","sdxl"].includes(o))return;try{const a=n(vu.endpoints.getMainModels.initiate(fke)),s=await a.unwrap();if(a.unsubscribe(),!s.ids.length){n(Ou(null));return}const u=_0.getSelectors().selectAll(s).filter(h=>["sd-1","sd-2","sxdl"].includes(h.base_model))[0];if(!u){n(Ou(null));return}const{base_model:c,model_name:d,model_type:f}=u;n(Ou({base_model:c,model_name:d,model_type:f}))}catch{n(Ou(null))}}}})},pke=({image_name:e,esrganModelName:t,autoAddBoardId:n})=>{const r={id:n5,type:"esrgan",image:{image_name:e},model_name:t,is_intermediate:!0},i={id:Za,type:"save_image",use_cache:!1,is_intermediate:!1,board:n==="none"?void 0:{board_id:n}};return{id:"adhoc-esrgan-graph",nodes:{[n5]:r,[Za]:i},edges:[{source:{node_id:n5,field:"image"},destination:{node_id:Za,field:"image"}}]}},gke=()=>Tj(),lH=bj;function mke(){if(console&&console.warn){for(var e=arguments.length,t=new Array(e),n=0;n()=>{if(e.isInitialized)t();else{const n=()=>{setTimeout(()=>{e.off("initialized",n)},0),t()};e.on("initialized",n)}};function VO(e,t,n){e.loadNamespaces(t,uH(e,n))}function GO(e,t,n,r){typeof n=="string"&&(n=[n]),n.forEach(i=>{e.options.ns.indexOf(i)<0&&e.options.ns.push(i)}),e.loadLanguages(t,uH(e,r))}function yke(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const r=t.languages[0],i=t.options?t.options.fallbackLng:!1,o=t.languages[t.languages.length-1];if(r.toLowerCase()==="cimode")return!0;const a=(s,l)=>{const u=t.services.backendConnector.state[`${s}|${l}`];return u===-1||u===2};return n.bindI18n&&n.bindI18n.indexOf("languageChanging")>-1&&t.services.backendConnector.backend&&t.isLanguageChangingTo&&!a(t.isLanguageChangingTo,e)?!1:!!(t.hasResourceBundle(r,e)||!t.services.backendConnector.backend||t.options.resources&&!t.options.partialBundledLanguages||a(r,e)&&(!i||a(o,e)))}function vke(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return!t.languages||!t.languages.length?(n4("i18n.languages were undefined or empty",t.languages),!0):t.options.ignoreJSONStructure!==void 0?t.hasLoadedNamespace(e,{lng:n.lng,precheck:(i,o)=>{if(n.bindI18n&&n.bindI18n.indexOf("languageChanging")>-1&&i.services.backendConnector.backend&&i.isLanguageChangingTo&&!o(i.isLanguageChangingTo,e))return!1}}):yke(e,t,n)}const bke=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,_ke={"&":"&","&":"&","<":"<","<":"<",">":">",">":">","'":"'","'":"'",""":'"',""":'"'," ":" "," ":" ","©":"©","©":"©","®":"®","®":"®","…":"…","…":"…","/":"/","/":"/"},Ske=e=>_ke[e],xke=e=>e.replace(bke,Ske);let r4={bindI18n:"languageChanged",bindI18nStore:"",transEmptyNodeValue:"",transSupportBasicHtmlNodes:!0,transWrapTextNodes:"",transKeepBasicHtmlNodesFor:["br","strong","i","p"],useSuspense:!0,unescape:xke};function wke(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};r4={...r4,...e}}function Cke(){return r4}let cH;function Eke(e){cH=e}function kke(){return cH}const Tke={type:"3rdParty",init(e){wke(e.options.react),Eke(e)}},Ake=I.createContext();class Pke{constructor(){this.usedNamespaces={}}addUsedNamespaces(t){t.forEach(n=>{this.usedNamespaces[n]||(this.usedNamespaces[n]=!0)})}getUsedNamespaces(){return Object.keys(this.usedNamespaces)}}const Ike=(e,t)=>{const n=I.useRef();return I.useEffect(()=>{n.current=t?n.current:e},[e,t]),n.current};function Rke(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const{i18n:n}=t,{i18n:r,defaultNS:i}=I.useContext(Ake)||{},o=n||r||kke();if(o&&!o.reportNamespaces&&(o.reportNamespaces=new Pke),!o){n4("You will need to pass in an i18next instance by using initReactI18next");const g=(S,w)=>typeof w=="string"?w:w&&typeof w=="object"&&typeof w.defaultValue=="string"?w.defaultValue:Array.isArray(S)?S[S.length-1]:S,y=[g,{},!1];return y.t=g,y.i18n={},y.ready=!1,y}o.options.react&&o.options.react.wait!==void 0&&n4("It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");const a={...Cke(),...o.options.react,...t},{useSuspense:s,keyPrefix:l}=a;let u=e||i||o.options&&o.options.defaultNS;u=typeof u=="string"?[u]:u||["translation"],o.reportNamespaces.addUsedNamespaces&&o.reportNamespaces.addUsedNamespaces(u);const c=(o.isInitialized||o.initializedStoreOnce)&&u.every(g=>vke(g,o,a));function d(){return o.getFixedT(t.lng||null,a.nsMode==="fallback"?u:u[0],l)}const[f,h]=I.useState(d);let p=u.join();t.lng&&(p=`${t.lng}${p}`);const m=Ike(p),_=I.useRef(!0);I.useEffect(()=>{const{bindI18n:g,bindI18nStore:y}=a;_.current=!0,!c&&!s&&(t.lng?GO(o,t.lng,u,()=>{_.current&&h(d)}):VO(o,u,()=>{_.current&&h(d)})),c&&m&&m!==p&&_.current&&h(d);function S(){_.current&&h(d)}return g&&o&&o.on(g,S),y&&o&&o.store.on(y,S),()=>{_.current=!1,g&&o&&g.split(" ").forEach(w=>o.off(w,S)),y&&o&&y.split(" ").forEach(w=>o.store.off(w,S))}},[o,p]);const b=I.useRef(!0);I.useEffect(()=>{_.current&&!b.current&&h(d),b.current=!1},[o,l]);const v=[f,o,c];if(v.t=f,v.i18n=o,v.ready=c,c||!c&&!s)return v;throw new Promise(g=>{t.lng?GO(o,t.lng,u,()=>g()):VO(o,u,()=>g())})}const Oke=(e,t)=>{if(!e||!t)return;const{width:n,height:r}=e,i=r*4*n*4,o=r*2*n*2;return{x4:i,x2:o}},Mke=(e,t)=>{if(!e||!t)return{x4:!0,x2:!0};const n={x4:!1,x2:!1};return e.x4<=t&&(n.x4=!0),e.x2<=t&&(n.x2=!0),n},Nke=(e,t)=>{if(!(!e||!t)&&!(e.x4&&e.x2)){if(!e.x2&&!e.x4)return"parameters.isAllowedToUpscale.tooLarge";if(!e.x4&&e.x2&&t===4)return"parameters.isAllowedToUpscale.useX2Model"}},dH=e=>Ii(eK,({postprocessing:t,config:n})=>{const{esrganModelName:r}=t,{maxUpscalePixels:i}=n,o=Oke(e,i),a=Mke(o,i),s=r.includes("x2")?2:4,l=Nke(a,s);return{isAllowedToUpscale:s===2?a.x2:a.x4,detailTKey:l}},Z2),_Ke=e=>{const{t}=Rke(),n=I.useMemo(()=>dH(e),[e]),{isAllowedToUpscale:r,detailTKey:i}=lH(n);return{isAllowedToUpscale:r,detail:i?t(i):void 0}},$ke=Ne("upscale/upscaleRequested"),Dke=()=>{Be({actionCreator:$ke,effect:async(e,{dispatch:t,getState:n})=>{var f;const r=Ce("session"),{imageDTO:i}=e.payload,{image_name:o}=i,a=n(),{isAllowedToUpscale:s,detailTKey:l}=dH(i)(a);if(!s){r.error({imageDTO:i},Z(l??"parameters.isAllowedToUpscale.tooLarge")),t(Gt({title:Z(l??"parameters.isAllowedToUpscale.tooLarge"),status:"error"}));return}const{esrganModelName:u}=a.postprocessing,{autoAddBoardId:c}=a.gallery,d=pke({image_name:o,esrganModelName:u,autoAddBoardId:c});try{const h=t(Qr.endpoints.enqueueGraph.initiate({graph:d,prepend:!0},{fixedCacheKey:"enqueueGraph"})),p=await h.unwrap();h.reset(),r.debug({enqueueResult:Qt(p)},Z("queue.graphQueued"))}catch(h){if(r.error({graph:Qt(d)},Z("queue.graphFailedToQueue")),h instanceof Object&&"data"in h&&"status"in h&&h.status===403){const p=((f=h.data)==null?void 0:f.detail)||"Unknown Error";t(Gt({title:Z("queue.graphFailedToQueue"),status:"error",description:p,duration:15e3}));return}t(Gt({title:Z("queue.graphFailedToQueue"),status:"error"}))}}})},Lke=tl(null),Fke=/^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z\-]+(?:\.[\da-z\-]+)*))?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?)?)?$/i,HO=e=>{if(typeof e!="string")throw new TypeError("Invalid argument expected string");const t=e.match(Fke);if(!t)throw new Error(`Invalid argument not valid semver ('${e}' received)`);return t.shift(),t},qO=e=>e==="*"||e==="x"||e==="X",WO=e=>{const t=parseInt(e,10);return isNaN(t)?e:t},Bke=(e,t)=>typeof e!=typeof t?[String(e),String(t)]:[e,t],zke=(e,t)=>{if(qO(e)||qO(t))return 0;const[n,r]=Bke(WO(e),WO(t));return n>r?1:n{for(let n=0;n{const n=HO(e),r=HO(t),i=n.pop(),o=r.pop(),a=KO(n,r);return a!==0?a:i&&o?KO(i.split("."),o.split(".")):i||o?i?-1:1:0},Uke=(e,t)=>{const n=wn(e),{nodes:r,edges:i}=n,o=[],a=r.filter(rE),s=dT(a,"id");return r.forEach(l=>{if(!rE(l))return;const u=t[l.data.type];if(!u){o.push({message:`${be.t("nodes.node")} "${l.data.type}" ${be.t("nodes.skipped")}`,issues:[`${be.t("nodes.nodeType")}"${l.data.type}" ${be.t("nodes.doesNotExist")}`],data:l});return}if(u.version&&l.data.version&&jke(u.version,l.data.version)!==0){o.push({message:`${be.t("nodes.node")} "${l.data.type}" ${be.t("nodes.mismatchedVersion")}`,issues:[`${be.t("nodes.node")} "${l.data.type}" v${l.data.version} ${be.t("nodes.maybeIncompatible")} v${u.version}`],data:{node:l,nodeTemplate:Qt(u)}});return}}),i.forEach((l,u)=>{const c=s[l.source],d=s[l.target],f=[];if(c?l.type==="default"&&!(l.sourceHandle in c.data.outputs)&&f.push(`${be.t("nodes.outputNode")} "${l.source}.${l.sourceHandle}" ${be.t("nodes.doesNotExist")}`):f.push(`${be.t("nodes.outputNode")} ${l.source} ${be.t("nodes.doesNotExist")}`),d?l.type==="default"&&!(l.targetHandle in d.data.inputs)&&f.push(`${be.t("nodes.inputField")} "${l.target}.${l.targetHandle}" ${be.t("nodes.doesNotExist")}`):f.push(`${be.t("nodes.inputNode")} ${l.target} ${be.t("nodes.doesNotExist")}`),t[(c==null?void 0:c.data.type)??"__UNKNOWN_NODE_TYPE__"]||f.push(`${be.t("nodes.sourceNode")} "${l.source}" ${be.t("nodes.missingTemplate")} "${c==null?void 0:c.data.type}"`),t[(d==null?void 0:d.data.type)??"__UNKNOWN_NODE_TYPE__"]||f.push(`${be.t("nodes.sourceNode")}"${l.target}" ${be.t("nodes.missingTemplate")} "${d==null?void 0:d.data.type}"`),f.length){delete i[u];const h=l.type==="default"?l.sourceHandle:l.source,p=l.type==="default"?l.targetHandle:l.target;o.push({message:`Edge "${h} -> ${p}" skipped`,issues:f,data:l})}}),{workflow:n,errors:o}},Vke=()=>{Be({actionCreator:uxe,effect:(e,{dispatch:t,getState:n})=>{const r=Ce("nodes"),i=e.payload,o=n().nodes.nodeTemplates,{workflow:a,errors:s}=Uke(i,o);t(e2e(a)),s.length?(t(Gt($d({title:Z("toast.loadedWithWarnings"),status:"warning"}))),s.forEach(({message:l,...u})=>{r.warn(u,l)})):t(Gt($d({title:Z("toast.workflowLoaded"),status:"success"}))),t(rG("nodes")),requestAnimationFrame(()=>{var l;(l=Lke.get())==null||l.fitView()})}})};function Gke(e){if(e.sheet)return e.sheet;for(var t=0;t0?Ti(Ap,--Oo):0,op--,$r===10&&(op=1,Zx--),$r}function Ko(){return $r=Oo2||x0($r)>3?"":" "}function rTe(e,t){for(;--t&&Ko()&&!($r<48||$r>102||$r>57&&$r<65||$r>70&&$r<97););return Ay(e,H1()+(t<6&&Gs()==32&&Ko()==32))}function o4(e){for(;Ko();)switch($r){case e:return Oo;case 34:case 39:e!==34&&e!==39&&o4($r);break;case 40:e===41&&o4(e);break;case 92:Ko();break}return Oo}function iTe(e,t){for(;Ko()&&e+$r!==47+10;)if(e+$r===42+42&&Gs()===47)break;return"/*"+Ay(t,Oo-1)+"*"+Yx(e===47?e:Ko())}function oTe(e){for(;!x0(Gs());)Ko();return Ay(e,Oo)}function aTe(e){return yH(W1("",null,null,null,[""],e=mH(e),0,[0],e))}function W1(e,t,n,r,i,o,a,s,l){for(var u=0,c=0,d=a,f=0,h=0,p=0,m=1,_=1,b=1,v=0,g="",y=i,S=o,w=r,x=g;_;)switch(p=v,v=Ko()){case 40:if(p!=108&&Ti(x,d-1)==58){i4(x+=ln(q1(v),"&","&\f"),"&\f")!=-1&&(b=-1);break}case 34:case 39:case 91:x+=q1(v);break;case 9:case 10:case 13:case 32:x+=nTe(p);break;case 92:x+=rTe(H1()-1,7);continue;case 47:switch(Gs()){case 42:case 47:Wv(sTe(iTe(Ko(),H1()),t,n),l);break;default:x+="/"}break;case 123*m:s[u++]=ks(x)*b;case 125*m:case 59:case 0:switch(v){case 0:case 125:_=0;case 59+c:b==-1&&(x=ln(x,/\f/g,"")),h>0&&ks(x)-d&&Wv(h>32?XO(x+";",r,n,d-1):XO(ln(x," ","")+";",r,n,d-2),l);break;case 59:x+=";";default:if(Wv(w=QO(x,t,n,u,c,i,s,g,y=[],S=[],d),o),v===123)if(c===0)W1(x,t,w,w,y,o,d,s,S);else switch(f===99&&Ti(x,3)===110?100:f){case 100:case 108:case 109:case 115:W1(e,w,w,r&&Wv(QO(e,w,w,0,0,i,s,g,i,y=[],d),S),i,S,d,s,r?y:S);break;default:W1(x,w,w,w,[""],S,0,s,S)}}u=c=h=0,m=b=1,g=x="",d=a;break;case 58:d=1+ks(x),h=p;default:if(m<1){if(v==123)--m;else if(v==125&&m++==0&&tTe()==125)continue}switch(x+=Yx(v),v*m){case 38:b=c>0?1:(x+="\f",-1);break;case 44:s[u++]=(ks(x)-1)*b,b=1;break;case 64:Gs()===45&&(x+=q1(Ko())),f=Gs(),c=d=ks(g=x+=oTe(H1())),v++;break;case 45:p===45&&ks(x)==2&&(m=0)}}return o}function QO(e,t,n,r,i,o,a,s,l,u,c){for(var d=i-1,f=i===0?o:[""],h=zA(f),p=0,m=0,_=0;p0?f[b]+" "+v:ln(v,/&\f/g,f[b])))&&(l[_++]=g);return Jx(e,t,n,i===0?FA:s,l,u,c)}function sTe(e,t,n){return Jx(e,t,n,fH,Yx(eTe()),S0(e,2,-2),0)}function XO(e,t,n,r){return Jx(e,t,n,BA,S0(e,0,r),S0(e,r+1,-1),r)}function _h(e,t){for(var n="",r=zA(e),i=0;i6)switch(Ti(e,t+1)){case 109:if(Ti(e,t+4)!==45)break;case 102:return ln(e,/(.+:)(.+)-([^]+)/,"$1"+sn+"$2-$3$1"+j_+(Ti(e,t+3)==108?"$3":"$2-$3"))+e;case 115:return~i4(e,"stretch")?bH(ln(e,"stretch","fill-available"),t)+e:e}break;case 4949:if(Ti(e,t+1)!==115)break;case 6444:switch(Ti(e,ks(e)-3-(~i4(e,"!important")&&10))){case 107:return ln(e,":",":"+sn)+e;case 101:return ln(e,/(.+:)([^;!]+)(;|!.+)?/,"$1"+sn+(Ti(e,14)===45?"inline-":"")+"box$3$1"+sn+"$2$3$1"+Bi+"$2box$3")+e}break;case 5936:switch(Ti(e,t+11)){case 114:return sn+e+Bi+ln(e,/[svh]\w+-[tblr]{2}/,"tb")+e;case 108:return sn+e+Bi+ln(e,/[svh]\w+-[tblr]{2}/,"tb-rl")+e;case 45:return sn+e+Bi+ln(e,/[svh]\w+-[tblr]{2}/,"lr")+e}return sn+e+Bi+e+e}return e}var mTe=function(t,n,r,i){if(t.length>-1&&!t.return)switch(t.type){case BA:t.return=bH(t.value,t.length);break;case hH:return _h([rg(t,{value:ln(t.value,"@","@"+sn)})],i);case FA:if(t.length)return Jke(t.props,function(o){switch(Zke(o,/(::plac\w+|:read-\w+)/)){case":read-only":case":read-write":return _h([rg(t,{props:[ln(o,/:(read-\w+)/,":"+j_+"$1")]})],i);case"::placeholder":return _h([rg(t,{props:[ln(o,/:(plac\w+)/,":"+sn+"input-$1")]}),rg(t,{props:[ln(o,/:(plac\w+)/,":"+j_+"$1")]}),rg(t,{props:[ln(o,/:(plac\w+)/,Bi+"input-$1")]})],i)}return""})}},yTe=[mTe],vTe=function(t){var n=t.key;if(n==="css"){var r=document.querySelectorAll("style[data-emotion]:not([data-s])");Array.prototype.forEach.call(r,function(m){var _=m.getAttribute("data-emotion");_.indexOf(" ")!==-1&&(document.head.appendChild(m),m.setAttribute("data-s",""))})}var i=t.stylisPlugins||yTe,o={},a,s=[];a=t.container||document.head,Array.prototype.forEach.call(document.querySelectorAll('style[data-emotion^="'+n+' "]'),function(m){for(var _=m.getAttribute("data-emotion").split(" "),b=1;b<_.length;b++)o[_[b]]=!0;s.push(m)});var l,u=[pTe,gTe];{var c,d=[lTe,cTe(function(m){c.insert(m)})],f=uTe(u.concat(i,d)),h=function(_){return _h(aTe(_),f)};l=function(_,b,v,g){c=v,h(_?_+"{"+b.styles+"}":b.styles),g&&(p.inserted[b.name]=!0)}}var p={key:n,sheet:new qke({key:n,container:a,nonce:t.nonce,speedy:t.speedy,prepend:t.prepend,insertionPoint:t.insertionPoint}),nonce:t.nonce,inserted:o,registered:{},insert:l};return p.sheet.hydrate(s),p},bTe=!0;function _Te(e,t,n){var r="";return n.split(" ").forEach(function(i){e[i]!==void 0?t.push(e[i]+";"):r+=i+" "}),r}var _H=function(t,n,r){var i=t.key+"-"+n.name;(r===!1||bTe===!1)&&t.registered[i]===void 0&&(t.registered[i]=n.styles)},SH=function(t,n,r){_H(t,n,r);var i=t.key+"-"+n.name;if(t.inserted[n.name]===void 0){var o=n;do t.insert(n===o?"."+i:"",o,t.sheet,!0),o=o.next;while(o!==void 0)}};function STe(e){for(var t=0,n,r=0,i=e.length;i>=4;++r,i-=4)n=e.charCodeAt(r)&255|(e.charCodeAt(++r)&255)<<8|(e.charCodeAt(++r)&255)<<16|(e.charCodeAt(++r)&255)<<24,n=(n&65535)*1540483477+((n>>>16)*59797<<16),n^=n>>>24,t=(n&65535)*1540483477+((n>>>16)*59797<<16)^(t&65535)*1540483477+((t>>>16)*59797<<16);switch(i){case 3:t^=(e.charCodeAt(r+2)&255)<<16;case 2:t^=(e.charCodeAt(r+1)&255)<<8;case 1:t^=e.charCodeAt(r)&255,t=(t&65535)*1540483477+((t>>>16)*59797<<16)}return t^=t>>>13,t=(t&65535)*1540483477+((t>>>16)*59797<<16),((t^t>>>15)>>>0).toString(36)}var xTe={animationIterationCount:1,aspectRatio:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,msGridRow:1,msGridRowSpan:1,msGridColumn:1,msGridColumnSpan:1,fontWeight:1,lineHeight:1,opacity:1,order:1,orphans:1,tabSize:1,widows:1,zIndex:1,zoom:1,WebkitLineClamp:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1},wTe=/[A-Z]|^ms/g,CTe=/_EMO_([^_]+?)_([^]*?)_EMO_/g,xH=function(t){return t.charCodeAt(1)===45},JO=function(t){return t!=null&&typeof t!="boolean"},i5=vH(function(e){return xH(e)?e:e.replace(wTe,"-$&").toLowerCase()}),eM=function(t,n){switch(t){case"animation":case"animationName":if(typeof n=="string")return n.replace(CTe,function(r,i,o){return Ts={name:i,styles:o,next:Ts},i})}return xTe[t]!==1&&!xH(t)&&typeof n=="number"&&n!==0?n+"px":n};function w0(e,t,n){if(n==null)return"";if(n.__emotion_styles!==void 0)return n;switch(typeof n){case"boolean":return"";case"object":{if(n.anim===1)return Ts={name:n.name,styles:n.styles,next:Ts},n.name;if(n.styles!==void 0){var r=n.next;if(r!==void 0)for(;r!==void 0;)Ts={name:r.name,styles:r.styles,next:Ts},r=r.next;var i=n.styles+";";return i}return ETe(e,t,n)}case"function":{if(e!==void 0){var o=Ts,a=n(e);return Ts=o,w0(e,t,a)}break}}if(t==null)return n;var s=t[n];return s!==void 0?s:n}function ETe(e,t,n){var r="";if(Array.isArray(n))for(var i=0;iW.jsx("div",{className:"chakra-portal-zIndex",style:{position:"absolute",zIndex:e.zIndex,top:0,left:0,right:0},children:e.children}),zTe=e=>{const{appendToParentPortal:t,children:n}=e,[r,i]=I.useState(null),o=I.useRef(null),[,a]=I.useState({});I.useEffect(()=>a({}),[]);const s=LTe(),l=$Te();U_(()=>{if(!r)return;const c=r.ownerDocument,d=t?s??c.body:c.body;if(!d)return;o.current=c.createElement("div"),o.current.className=UA,d.appendChild(o.current),a({});const f=o.current;return()=>{d.contains(f)&&d.removeChild(f)}},[r]);const u=l!=null&&l.zIndex?W.jsx(BTe,{zIndex:l==null?void 0:l.zIndex,children:n}):n;return o.current?Uo.createPortal(W.jsx(TH,{value:o.current,children:u}),o.current):W.jsx("span",{ref:c=>{c&&i(c)}})},jTe=e=>{const{children:t,containerRef:n,appendToParentPortal:r}=e,i=n.current,o=i??(typeof window<"u"?document.body:void 0),a=I.useMemo(()=>{const l=i==null?void 0:i.ownerDocument.createElement("div");return l&&(l.className=UA),l},[i]),[,s]=I.useState({});return U_(()=>s({}),[]),U_(()=>{if(!(!a||!o))return o.appendChild(a),()=>{o.removeChild(a)}},[a,o]),o&&a?Uo.createPortal(W.jsx(TH,{value:r?a:null,children:t}),a):null};function ew(e){const t={appendToParentPortal:!0,...e},{containerRef:n,...r}=t;return n?W.jsx(jTe,{containerRef:n,...r}):W.jsx(zTe,{...r})}ew.className=UA;ew.selector=FTe;ew.displayName="Portal";function AH(){const e=I.useContext(C0);if(!e)throw Error("useTheme: `theme` is undefined. Seems you forgot to wrap your app in `` or ``");return e}var VA=I.createContext({});VA.displayName="ColorModeContext";function tw(){const e=I.useContext(VA);if(e===void 0)throw new Error("useColorMode must be used within a ColorModeProvider");return e}function SKe(e,t){const{colorMode:n}=tw();return n==="dark"?t:e}function UTe(){const e=tw(),t=AH();return{...e,theme:t}}function VTe(e,t,n){var r,i;if(t==null)return t;const o=a=>{var s,l;return(l=(s=e.__breakpoints)==null?void 0:s.asArray)==null?void 0:l[a]};return(i=(r=o(t))!=null?r:o(n))!=null?i:n}function GTe(e,t,n){var r,i;if(t==null)return t;const o=a=>{var s,l;return(l=(s=e.__cssMap)==null?void 0:s[a])==null?void 0:l.value};return(i=(r=o(t))!=null?r:o(n))!=null?i:n}function xKe(e,t,n){const r=AH();return HTe(e,t,n)(r)}function HTe(e,t,n){const r=Array.isArray(t)?t:[t],i=Array.isArray(n)?n:[n];return o=>{const a=i.filter(Boolean),s=r.map((l,u)=>{var c,d;if(e==="breakpoints")return VTe(o,l,(c=a[u])!=null?c:l);const f=`${e}.${l}`;return GTe(o,f,(d=a[u])!=null?d:l)});return Array.isArray(t)?s:s[0]}}var Ac=(...e)=>e.filter(Boolean).join(" ");function qTe(){return!1}function Hs(e){const t=typeof e;return e!=null&&(t==="object"||t==="function")&&!Array.isArray(e)}var wKe=e=>{const{condition:t,message:n}=e;t&&qTe()&&console.warn(n)};function $s(e,...t){return WTe(e)?e(...t):e}var WTe=e=>typeof e=="function",CKe=e=>e?"":void 0,EKe=e=>e?!0:void 0;function kKe(...e){return function(n){e.some(r=>(r==null||r(n),n==null?void 0:n.defaultPrevented))}}function TKe(...e){return function(n){e.forEach(r=>{r==null||r(n)})}}var V_={exports:{}};V_.exports;(function(e,t){var n=200,r="__lodash_hash_undefined__",i=800,o=16,a=9007199254740991,s="[object Arguments]",l="[object Array]",u="[object AsyncFunction]",c="[object Boolean]",d="[object Date]",f="[object Error]",h="[object Function]",p="[object GeneratorFunction]",m="[object Map]",_="[object Number]",b="[object Null]",v="[object Object]",g="[object Proxy]",y="[object RegExp]",S="[object Set]",w="[object String]",x="[object Undefined]",C="[object WeakMap]",T="[object ArrayBuffer]",k="[object DataView]",P="[object Float32Array]",$="[object Float64Array]",O="[object Int8Array]",E="[object Int16Array]",A="[object Int32Array]",D="[object Uint8Array]",L="[object Uint8ClampedArray]",M="[object Uint16Array]",R="[object Uint32Array]",N=/[\\^$.*+?()[\]{}|]/g,B=/^\[object .+?Constructor\]$/,U=/^(?:0|[1-9]\d*)$/,G={};G[P]=G[$]=G[O]=G[E]=G[A]=G[D]=G[L]=G[M]=G[R]=!0,G[s]=G[l]=G[T]=G[c]=G[k]=G[d]=G[f]=G[h]=G[m]=G[_]=G[v]=G[y]=G[S]=G[w]=G[C]=!1;var Y=typeof mt=="object"&&mt&&mt.Object===Object&&mt,ee=typeof self=="object"&&self&&self.Object===Object&&self,J=Y||ee||Function("return this")(),j=t&&!t.nodeType&&t,Q=j&&!0&&e&&!e.nodeType&&e,ne=Q&&Q.exports===j,se=ne&&Y.process,ve=function(){try{var F=Q&&Q.require&&Q.require("util").types;return F||se&&se.binding&&se.binding("util")}catch{}}(),ce=ve&&ve.isTypedArray;function bt(F,V,X){switch(X.length){case 0:return F.call(V);case 1:return F.call(V,X[0]);case 2:return F.call(V,X[0],X[1]);case 3:return F.call(V,X[0],X[1],X[2])}return F.apply(V,X)}function ot(F,V){for(var X=-1,pe=Array(F);++X-1}function ia(F,V){var X=this.__data__,pe=Ye(X,F);return pe<0?(++this.size,X.push([F,V])):X[pe][1]=V,this}zr.prototype.clear=Da,zr.prototype.delete=hs,zr.prototype.get=mi,zr.prototype.has=nu,zr.prototype.set=ia;function ni(F){var V=-1,X=F==null?0:F.length;for(this.clear();++V1?X[Ct-1]:void 0,Pn=Ct>2?X[2]:void 0;for(hn=F.length>3&&typeof hn=="function"?(Ct--,hn):void 0,Pn&&Mt(X[0],X[1],Pn)&&(hn=Ct<3?void 0:hn,Ct=1),V=Object(V);++pe-1&&F%1==0&&F0){if(++V>=i)return arguments[0]}else V=0;return F.apply(void 0,arguments)}}function dt(F){if(F!=null){try{return en.call(F)}catch{}try{return F+""}catch{}}return""}function Ve(F,V){return F===V||F!==F&&V!==V}var xe=_t(function(){return arguments}())?_t:function(F){return Ae(F)&&Ln.call(F,"callee")&&!Qi.call(F,"callee")},ue=Array.isArray;function Ee(F){return F!=null&&et(F.length)&&!we(F)}function fe(F){return Ae(F)&&Ee(F)}var ge=ol||Xi;function we(F){if(!Qe(F))return!1;var V=ct(F);return V==h||V==p||V==u||V==g}function et(F){return typeof F=="number"&&F>-1&&F%1==0&&F<=a}function Qe(F){var V=typeof F;return F!=null&&(V=="object"||V=="function")}function Ae(F){return F!=null&&typeof F=="object"}function Tt(F){if(!Ae(F)||ct(F)!=v)return!1;var V=Mi(F);if(V===null)return!0;var X=Ln.call(V,"constructor")&&V.constructor;return typeof X=="function"&&X instanceof X&&en.call(X)==Jr}var jt=ce?ze(ce):kt;function Vt(F){return La(F,or(F))}function or(F){return Ee(F)?Ie(F,!0):cn(F)}var pr=it(function(F,V,X,pe){dn(F,V,X,pe)});function zn(F){return function(){return F}}function An(F){return F}function Xi(){return!1}e.exports=pr})(V_,V_.exports);var KTe=V_.exports;const Ds=pc(KTe);var QTe=e=>/!(important)?$/.test(e),rM=e=>typeof e=="string"?e.replace(/!(important)?$/,"").trim():e,XTe=(e,t)=>n=>{const r=String(t),i=QTe(r),o=rM(r),a=e?`${e}.${o}`:o;let s=Hs(n.__cssMap)&&a in n.__cssMap?n.__cssMap[a].varRef:t;return s=rM(s),i?`${s} !important`:s};function GA(e){const{scale:t,transform:n,compose:r}=e;return(o,a)=>{var s;const l=XTe(t,o)(a);let u=(s=n==null?void 0:n(l,a))!=null?s:l;return r&&(u=r(u,a)),u}}var Kv=(...e)=>t=>e.reduce((n,r)=>r(n),t);function la(e,t){return n=>{const r={property:n,scale:e};return r.transform=GA({scale:e,transform:t}),r}}var YTe=({rtl:e,ltr:t})=>n=>n.direction==="rtl"?e:t;function ZTe(e){const{property:t,scale:n,transform:r}=e;return{scale:n,property:YTe(t),transform:n?GA({scale:n,compose:r}):r}}var PH=["rotate(var(--chakra-rotate, 0))","scaleX(var(--chakra-scale-x, 1))","scaleY(var(--chakra-scale-y, 1))","skewX(var(--chakra-skew-x, 0))","skewY(var(--chakra-skew-y, 0))"];function JTe(){return["translateX(var(--chakra-translate-x, 0))","translateY(var(--chakra-translate-y, 0))",...PH].join(" ")}function eAe(){return["translate3d(var(--chakra-translate-x, 0), var(--chakra-translate-y, 0), 0)",...PH].join(" ")}var tAe={"--chakra-blur":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-brightness":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-contrast":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-grayscale":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-hue-rotate":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-invert":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-saturate":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-sepia":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-drop-shadow":"var(--chakra-empty,/*!*/ /*!*/)",filter:["var(--chakra-blur)","var(--chakra-brightness)","var(--chakra-contrast)","var(--chakra-grayscale)","var(--chakra-hue-rotate)","var(--chakra-invert)","var(--chakra-saturate)","var(--chakra-sepia)","var(--chakra-drop-shadow)"].join(" ")},nAe={backdropFilter:["var(--chakra-backdrop-blur)","var(--chakra-backdrop-brightness)","var(--chakra-backdrop-contrast)","var(--chakra-backdrop-grayscale)","var(--chakra-backdrop-hue-rotate)","var(--chakra-backdrop-invert)","var(--chakra-backdrop-opacity)","var(--chakra-backdrop-saturate)","var(--chakra-backdrop-sepia)"].join(" "),"--chakra-backdrop-blur":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-backdrop-brightness":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-backdrop-contrast":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-backdrop-grayscale":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-backdrop-hue-rotate":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-backdrop-invert":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-backdrop-opacity":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-backdrop-saturate":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-backdrop-sepia":"var(--chakra-empty,/*!*/ /*!*/)"};function rAe(e){return{"--chakra-ring-offset-shadow":"var(--chakra-ring-inset) 0 0 0 var(--chakra-ring-offset-width) var(--chakra-ring-offset-color)","--chakra-ring-shadow":"var(--chakra-ring-inset) 0 0 0 calc(var(--chakra-ring-width) + var(--chakra-ring-offset-width)) var(--chakra-ring-color)","--chakra-ring-width":e,boxShadow:["var(--chakra-ring-offset-shadow)","var(--chakra-ring-shadow)","var(--chakra-shadow, 0 0 #0000)"].join(", ")}}var iAe={"row-reverse":{space:"--chakra-space-x-reverse",divide:"--chakra-divide-x-reverse"},"column-reverse":{space:"--chakra-space-y-reverse",divide:"--chakra-divide-y-reverse"}},a4={"to-t":"to top","to-tr":"to top right","to-r":"to right","to-br":"to bottom right","to-b":"to bottom","to-bl":"to bottom left","to-l":"to left","to-tl":"to top left"},oAe=new Set(Object.values(a4)),s4=new Set(["none","-moz-initial","inherit","initial","revert","unset"]),aAe=e=>e.trim();function sAe(e,t){if(e==null||s4.has(e))return e;if(!(l4(e)||s4.has(e)))return`url('${e}')`;const i=/(^[a-z-A-Z]+)\((.*)\)/g.exec(e),o=i==null?void 0:i[1],a=i==null?void 0:i[2];if(!o||!a)return e;const s=o.includes("-gradient")?o:`${o}-gradient`,[l,...u]=a.split(",").map(aAe).filter(Boolean);if((u==null?void 0:u.length)===0)return e;const c=l in a4?a4[l]:l;u.unshift(c);const d=u.map(f=>{if(oAe.has(f))return f;const h=f.indexOf(" "),[p,m]=h!==-1?[f.substr(0,h),f.substr(h+1)]:[f],_=l4(m)?m:m&&m.split(" "),b=`colors.${p}`,v=b in t.__cssMap?t.__cssMap[b].varRef:p;return _?[v,...Array.isArray(_)?_:[_]].join(" "):v});return`${s}(${d.join(", ")})`}var l4=e=>typeof e=="string"&&e.includes("(")&&e.includes(")"),lAe=(e,t)=>sAe(e,t??{});function uAe(e){return/^var\(--.+\)$/.test(e)}var cAe=e=>{const t=parseFloat(e.toString()),n=e.toString().replace(String(t),"");return{unitless:!n,value:t,unit:n}},bs=e=>t=>`${e}(${t})`,Kt={filter(e){return e!=="auto"?e:tAe},backdropFilter(e){return e!=="auto"?e:nAe},ring(e){return rAe(Kt.px(e))},bgClip(e){return e==="text"?{color:"transparent",backgroundClip:"text"}:{backgroundClip:e}},transform(e){return e==="auto"?JTe():e==="auto-gpu"?eAe():e},vh(e){return e==="$100vh"?"var(--chakra-vh)":e},px(e){if(e==null)return e;const{unitless:t}=cAe(e);return t||typeof e=="number"?`${e}px`:e},fraction(e){return typeof e!="number"||e>1?e:`${e*100}%`},float(e,t){const n={left:"right",right:"left"};return t.direction==="rtl"?n[e]:e},degree(e){if(uAe(e)||e==null)return e;const t=typeof e=="string"&&!e.endsWith("deg");return typeof e=="number"||t?`${e}deg`:e},gradient:lAe,blur:bs("blur"),opacity:bs("opacity"),brightness:bs("brightness"),contrast:bs("contrast"),dropShadow:bs("drop-shadow"),grayscale:bs("grayscale"),hueRotate:bs("hue-rotate"),invert:bs("invert"),saturate:bs("saturate"),sepia:bs("sepia"),bgImage(e){return e==null||l4(e)||s4.has(e)?e:`url(${e})`},outline(e){const t=String(e)==="0"||String(e)==="none";return e!==null&&t?{outline:"2px solid transparent",outlineOffset:"2px"}:{outline:e}},flexDirection(e){var t;const{space:n,divide:r}=(t=iAe[e])!=null?t:{},i={flexDirection:e};return n&&(i[n]=1),r&&(i[r]=1),i}},H={borderWidths:la("borderWidths"),borderStyles:la("borderStyles"),colors:la("colors"),borders:la("borders"),gradients:la("gradients",Kt.gradient),radii:la("radii",Kt.px),space:la("space",Kv(Kt.vh,Kt.px)),spaceT:la("space",Kv(Kt.vh,Kt.px)),degreeT(e){return{property:e,transform:Kt.degree}},prop(e,t,n){return{property:e,scale:t,...t&&{transform:GA({scale:t,transform:n})}}},propT(e,t){return{property:e,transform:t}},sizes:la("sizes",Kv(Kt.vh,Kt.px)),sizesT:la("sizes",Kv(Kt.vh,Kt.fraction)),shadows:la("shadows"),logical:ZTe,blur:la("blur",Kt.blur)},K1={background:H.colors("background"),backgroundColor:H.colors("backgroundColor"),backgroundImage:H.gradients("backgroundImage"),backgroundSize:!0,backgroundPosition:!0,backgroundRepeat:!0,backgroundAttachment:!0,backgroundClip:{transform:Kt.bgClip},bgSize:H.prop("backgroundSize"),bgPosition:H.prop("backgroundPosition"),bg:H.colors("background"),bgColor:H.colors("backgroundColor"),bgPos:H.prop("backgroundPosition"),bgRepeat:H.prop("backgroundRepeat"),bgAttachment:H.prop("backgroundAttachment"),bgGradient:H.gradients("backgroundImage"),bgClip:{transform:Kt.bgClip}};Object.assign(K1,{bgImage:K1.backgroundImage,bgImg:K1.backgroundImage});var an={border:H.borders("border"),borderWidth:H.borderWidths("borderWidth"),borderStyle:H.borderStyles("borderStyle"),borderColor:H.colors("borderColor"),borderRadius:H.radii("borderRadius"),borderTop:H.borders("borderTop"),borderBlockStart:H.borders("borderBlockStart"),borderTopLeftRadius:H.radii("borderTopLeftRadius"),borderStartStartRadius:H.logical({scale:"radii",property:{ltr:"borderTopLeftRadius",rtl:"borderTopRightRadius"}}),borderEndStartRadius:H.logical({scale:"radii",property:{ltr:"borderBottomLeftRadius",rtl:"borderBottomRightRadius"}}),borderTopRightRadius:H.radii("borderTopRightRadius"),borderStartEndRadius:H.logical({scale:"radii",property:{ltr:"borderTopRightRadius",rtl:"borderTopLeftRadius"}}),borderEndEndRadius:H.logical({scale:"radii",property:{ltr:"borderBottomRightRadius",rtl:"borderBottomLeftRadius"}}),borderRight:H.borders("borderRight"),borderInlineEnd:H.borders("borderInlineEnd"),borderBottom:H.borders("borderBottom"),borderBlockEnd:H.borders("borderBlockEnd"),borderBottomLeftRadius:H.radii("borderBottomLeftRadius"),borderBottomRightRadius:H.radii("borderBottomRightRadius"),borderLeft:H.borders("borderLeft"),borderInlineStart:{property:"borderInlineStart",scale:"borders"},borderInlineStartRadius:H.logical({scale:"radii",property:{ltr:["borderTopLeftRadius","borderBottomLeftRadius"],rtl:["borderTopRightRadius","borderBottomRightRadius"]}}),borderInlineEndRadius:H.logical({scale:"radii",property:{ltr:["borderTopRightRadius","borderBottomRightRadius"],rtl:["borderTopLeftRadius","borderBottomLeftRadius"]}}),borderX:H.borders(["borderLeft","borderRight"]),borderInline:H.borders("borderInline"),borderY:H.borders(["borderTop","borderBottom"]),borderBlock:H.borders("borderBlock"),borderTopWidth:H.borderWidths("borderTopWidth"),borderBlockStartWidth:H.borderWidths("borderBlockStartWidth"),borderTopColor:H.colors("borderTopColor"),borderBlockStartColor:H.colors("borderBlockStartColor"),borderTopStyle:H.borderStyles("borderTopStyle"),borderBlockStartStyle:H.borderStyles("borderBlockStartStyle"),borderBottomWidth:H.borderWidths("borderBottomWidth"),borderBlockEndWidth:H.borderWidths("borderBlockEndWidth"),borderBottomColor:H.colors("borderBottomColor"),borderBlockEndColor:H.colors("borderBlockEndColor"),borderBottomStyle:H.borderStyles("borderBottomStyle"),borderBlockEndStyle:H.borderStyles("borderBlockEndStyle"),borderLeftWidth:H.borderWidths("borderLeftWidth"),borderInlineStartWidth:H.borderWidths("borderInlineStartWidth"),borderLeftColor:H.colors("borderLeftColor"),borderInlineStartColor:H.colors("borderInlineStartColor"),borderLeftStyle:H.borderStyles("borderLeftStyle"),borderInlineStartStyle:H.borderStyles("borderInlineStartStyle"),borderRightWidth:H.borderWidths("borderRightWidth"),borderInlineEndWidth:H.borderWidths("borderInlineEndWidth"),borderRightColor:H.colors("borderRightColor"),borderInlineEndColor:H.colors("borderInlineEndColor"),borderRightStyle:H.borderStyles("borderRightStyle"),borderInlineEndStyle:H.borderStyles("borderInlineEndStyle"),borderTopRadius:H.radii(["borderTopLeftRadius","borderTopRightRadius"]),borderBottomRadius:H.radii(["borderBottomLeftRadius","borderBottomRightRadius"]),borderLeftRadius:H.radii(["borderTopLeftRadius","borderBottomLeftRadius"]),borderRightRadius:H.radii(["borderTopRightRadius","borderBottomRightRadius"])};Object.assign(an,{rounded:an.borderRadius,roundedTop:an.borderTopRadius,roundedTopLeft:an.borderTopLeftRadius,roundedTopRight:an.borderTopRightRadius,roundedTopStart:an.borderStartStartRadius,roundedTopEnd:an.borderStartEndRadius,roundedBottom:an.borderBottomRadius,roundedBottomLeft:an.borderBottomLeftRadius,roundedBottomRight:an.borderBottomRightRadius,roundedBottomStart:an.borderEndStartRadius,roundedBottomEnd:an.borderEndEndRadius,roundedLeft:an.borderLeftRadius,roundedRight:an.borderRightRadius,roundedStart:an.borderInlineStartRadius,roundedEnd:an.borderInlineEndRadius,borderStart:an.borderInlineStart,borderEnd:an.borderInlineEnd,borderTopStartRadius:an.borderStartStartRadius,borderTopEndRadius:an.borderStartEndRadius,borderBottomStartRadius:an.borderEndStartRadius,borderBottomEndRadius:an.borderEndEndRadius,borderStartRadius:an.borderInlineStartRadius,borderEndRadius:an.borderInlineEndRadius,borderStartWidth:an.borderInlineStartWidth,borderEndWidth:an.borderInlineEndWidth,borderStartColor:an.borderInlineStartColor,borderEndColor:an.borderInlineEndColor,borderStartStyle:an.borderInlineStartStyle,borderEndStyle:an.borderInlineEndStyle});var dAe={color:H.colors("color"),textColor:H.colors("color"),fill:H.colors("fill"),stroke:H.colors("stroke")},u4={boxShadow:H.shadows("boxShadow"),mixBlendMode:!0,blendMode:H.prop("mixBlendMode"),backgroundBlendMode:!0,bgBlendMode:H.prop("backgroundBlendMode"),opacity:!0};Object.assign(u4,{shadow:u4.boxShadow});var fAe={filter:{transform:Kt.filter},blur:H.blur("--chakra-blur"),brightness:H.propT("--chakra-brightness",Kt.brightness),contrast:H.propT("--chakra-contrast",Kt.contrast),hueRotate:H.degreeT("--chakra-hue-rotate"),invert:H.propT("--chakra-invert",Kt.invert),saturate:H.propT("--chakra-saturate",Kt.saturate),dropShadow:H.propT("--chakra-drop-shadow",Kt.dropShadow),backdropFilter:{transform:Kt.backdropFilter},backdropBlur:H.blur("--chakra-backdrop-blur"),backdropBrightness:H.propT("--chakra-backdrop-brightness",Kt.brightness),backdropContrast:H.propT("--chakra-backdrop-contrast",Kt.contrast),backdropHueRotate:H.degreeT("--chakra-backdrop-hue-rotate"),backdropInvert:H.propT("--chakra-backdrop-invert",Kt.invert),backdropSaturate:H.propT("--chakra-backdrop-saturate",Kt.saturate)},G_={alignItems:!0,alignContent:!0,justifyItems:!0,justifyContent:!0,flexWrap:!0,flexDirection:{transform:Kt.flexDirection},flex:!0,flexFlow:!0,flexGrow:!0,flexShrink:!0,flexBasis:H.sizes("flexBasis"),justifySelf:!0,alignSelf:!0,order:!0,placeItems:!0,placeContent:!0,placeSelf:!0,gap:H.space("gap"),rowGap:H.space("rowGap"),columnGap:H.space("columnGap")};Object.assign(G_,{flexDir:G_.flexDirection});var IH={gridGap:H.space("gridGap"),gridColumnGap:H.space("gridColumnGap"),gridRowGap:H.space("gridRowGap"),gridColumn:!0,gridRow:!0,gridAutoFlow:!0,gridAutoColumns:!0,gridColumnStart:!0,gridColumnEnd:!0,gridRowStart:!0,gridRowEnd:!0,gridAutoRows:!0,gridTemplate:!0,gridTemplateColumns:!0,gridTemplateRows:!0,gridTemplateAreas:!0,gridArea:!0},hAe={appearance:!0,cursor:!0,resize:!0,userSelect:!0,pointerEvents:!0,outline:{transform:Kt.outline},outlineOffset:!0,outlineColor:H.colors("outlineColor")},da={width:H.sizesT("width"),inlineSize:H.sizesT("inlineSize"),height:H.sizes("height"),blockSize:H.sizes("blockSize"),boxSize:H.sizes(["width","height"]),minWidth:H.sizes("minWidth"),minInlineSize:H.sizes("minInlineSize"),minHeight:H.sizes("minHeight"),minBlockSize:H.sizes("minBlockSize"),maxWidth:H.sizes("maxWidth"),maxInlineSize:H.sizes("maxInlineSize"),maxHeight:H.sizes("maxHeight"),maxBlockSize:H.sizes("maxBlockSize"),overflow:!0,overflowX:!0,overflowY:!0,overscrollBehavior:!0,overscrollBehaviorX:!0,overscrollBehaviorY:!0,display:!0,aspectRatio:!0,hideFrom:{scale:"breakpoints",transform:(e,t)=>{var n,r,i;return{[`@media screen and (min-width: ${(i=(r=(n=t.__breakpoints)==null?void 0:n.get(e))==null?void 0:r.minW)!=null?i:e})`]:{display:"none"}}}},hideBelow:{scale:"breakpoints",transform:(e,t)=>{var n,r,i;return{[`@media screen and (max-width: ${(i=(r=(n=t.__breakpoints)==null?void 0:n.get(e))==null?void 0:r._minW)!=null?i:e})`]:{display:"none"}}}},verticalAlign:!0,boxSizing:!0,boxDecorationBreak:!0,float:H.propT("float",Kt.float),objectFit:!0,objectPosition:!0,visibility:!0,isolation:!0};Object.assign(da,{w:da.width,h:da.height,minW:da.minWidth,maxW:da.maxWidth,minH:da.minHeight,maxH:da.maxHeight,overscroll:da.overscrollBehavior,overscrollX:da.overscrollBehaviorX,overscrollY:da.overscrollBehaviorY});var pAe={listStyleType:!0,listStylePosition:!0,listStylePos:H.prop("listStylePosition"),listStyleImage:!0,listStyleImg:H.prop("listStyleImage")};function gAe(e,t,n,r){const i=typeof t=="string"?t.split("."):[t];for(r=0;r{const t=new WeakMap;return(r,i,o,a)=>{if(typeof r>"u")return e(r,i,o);t.has(r)||t.set(r,new Map);const s=t.get(r);if(s.has(i))return s.get(i);const l=e(r,i,o,a);return s.set(i,l),l}},yAe=mAe(gAe),vAe={border:"0px",clip:"rect(0, 0, 0, 0)",width:"1px",height:"1px",margin:"-1px",padding:"0px",overflow:"hidden",whiteSpace:"nowrap",position:"absolute"},bAe={position:"static",width:"auto",height:"auto",clip:"auto",padding:"0",margin:"0",overflow:"visible",whiteSpace:"normal"},o5=(e,t,n)=>{const r={},i=yAe(e,t,{});for(const o in i)o in n&&n[o]!=null||(r[o]=i[o]);return r},_Ae={srOnly:{transform(e){return e===!0?vAe:e==="focusable"?bAe:{}}},layerStyle:{processResult:!0,transform:(e,t,n)=>o5(t,`layerStyles.${e}`,n)},textStyle:{processResult:!0,transform:(e,t,n)=>o5(t,`textStyles.${e}`,n)},apply:{processResult:!0,transform:(e,t,n)=>o5(t,e,n)}},Qg={position:!0,pos:H.prop("position"),zIndex:H.prop("zIndex","zIndices"),inset:H.spaceT("inset"),insetX:H.spaceT(["left","right"]),insetInline:H.spaceT("insetInline"),insetY:H.spaceT(["top","bottom"]),insetBlock:H.spaceT("insetBlock"),top:H.spaceT("top"),insetBlockStart:H.spaceT("insetBlockStart"),bottom:H.spaceT("bottom"),insetBlockEnd:H.spaceT("insetBlockEnd"),left:H.spaceT("left"),insetInlineStart:H.logical({scale:"space",property:{ltr:"left",rtl:"right"}}),right:H.spaceT("right"),insetInlineEnd:H.logical({scale:"space",property:{ltr:"right",rtl:"left"}})};Object.assign(Qg,{insetStart:Qg.insetInlineStart,insetEnd:Qg.insetInlineEnd});var SAe={ring:{transform:Kt.ring},ringColor:H.colors("--chakra-ring-color"),ringOffset:H.prop("--chakra-ring-offset-width"),ringOffsetColor:H.colors("--chakra-ring-offset-color"),ringInset:H.prop("--chakra-ring-inset")},Un={margin:H.spaceT("margin"),marginTop:H.spaceT("marginTop"),marginBlockStart:H.spaceT("marginBlockStart"),marginRight:H.spaceT("marginRight"),marginInlineEnd:H.spaceT("marginInlineEnd"),marginBottom:H.spaceT("marginBottom"),marginBlockEnd:H.spaceT("marginBlockEnd"),marginLeft:H.spaceT("marginLeft"),marginInlineStart:H.spaceT("marginInlineStart"),marginX:H.spaceT(["marginInlineStart","marginInlineEnd"]),marginInline:H.spaceT("marginInline"),marginY:H.spaceT(["marginTop","marginBottom"]),marginBlock:H.spaceT("marginBlock"),padding:H.space("padding"),paddingTop:H.space("paddingTop"),paddingBlockStart:H.space("paddingBlockStart"),paddingRight:H.space("paddingRight"),paddingBottom:H.space("paddingBottom"),paddingBlockEnd:H.space("paddingBlockEnd"),paddingLeft:H.space("paddingLeft"),paddingInlineStart:H.space("paddingInlineStart"),paddingInlineEnd:H.space("paddingInlineEnd"),paddingX:H.space(["paddingInlineStart","paddingInlineEnd"]),paddingInline:H.space("paddingInline"),paddingY:H.space(["paddingTop","paddingBottom"]),paddingBlock:H.space("paddingBlock")};Object.assign(Un,{m:Un.margin,mt:Un.marginTop,mr:Un.marginRight,me:Un.marginInlineEnd,marginEnd:Un.marginInlineEnd,mb:Un.marginBottom,ml:Un.marginLeft,ms:Un.marginInlineStart,marginStart:Un.marginInlineStart,mx:Un.marginX,my:Un.marginY,p:Un.padding,pt:Un.paddingTop,py:Un.paddingY,px:Un.paddingX,pb:Un.paddingBottom,pl:Un.paddingLeft,ps:Un.paddingInlineStart,paddingStart:Un.paddingInlineStart,pr:Un.paddingRight,pe:Un.paddingInlineEnd,paddingEnd:Un.paddingInlineEnd});var xAe={textDecorationColor:H.colors("textDecorationColor"),textDecoration:!0,textDecor:{property:"textDecoration"},textDecorationLine:!0,textDecorationStyle:!0,textDecorationThickness:!0,textUnderlineOffset:!0,textShadow:H.shadows("textShadow")},wAe={clipPath:!0,transform:H.propT("transform",Kt.transform),transformOrigin:!0,translateX:H.spaceT("--chakra-translate-x"),translateY:H.spaceT("--chakra-translate-y"),skewX:H.degreeT("--chakra-skew-x"),skewY:H.degreeT("--chakra-skew-y"),scaleX:H.prop("--chakra-scale-x"),scaleY:H.prop("--chakra-scale-y"),scale:H.prop(["--chakra-scale-x","--chakra-scale-y"]),rotate:H.degreeT("--chakra-rotate")},CAe={transition:!0,transitionDelay:!0,animation:!0,willChange:!0,transitionDuration:H.prop("transitionDuration","transition.duration"),transitionProperty:H.prop("transitionProperty","transition.property"),transitionTimingFunction:H.prop("transitionTimingFunction","transition.easing")},EAe={fontFamily:H.prop("fontFamily","fonts"),fontSize:H.prop("fontSize","fontSizes",Kt.px),fontWeight:H.prop("fontWeight","fontWeights"),lineHeight:H.prop("lineHeight","lineHeights"),letterSpacing:H.prop("letterSpacing","letterSpacings"),textAlign:!0,fontStyle:!0,textIndent:!0,wordBreak:!0,overflowWrap:!0,textOverflow:!0,textTransform:!0,whiteSpace:!0,isTruncated:{transform(e){if(e===!0)return{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}}},noOfLines:{static:{overflow:"hidden",textOverflow:"ellipsis",display:"-webkit-box",WebkitBoxOrient:"vertical",WebkitLineClamp:"var(--chakra-line-clamp)"},property:"--chakra-line-clamp"}},kAe={scrollBehavior:!0,scrollSnapAlign:!0,scrollSnapStop:!0,scrollSnapType:!0,scrollMargin:H.spaceT("scrollMargin"),scrollMarginTop:H.spaceT("scrollMarginTop"),scrollMarginBottom:H.spaceT("scrollMarginBottom"),scrollMarginLeft:H.spaceT("scrollMarginLeft"),scrollMarginRight:H.spaceT("scrollMarginRight"),scrollMarginX:H.spaceT(["scrollMarginLeft","scrollMarginRight"]),scrollMarginY:H.spaceT(["scrollMarginTop","scrollMarginBottom"]),scrollPadding:H.spaceT("scrollPadding"),scrollPaddingTop:H.spaceT("scrollPaddingTop"),scrollPaddingBottom:H.spaceT("scrollPaddingBottom"),scrollPaddingLeft:H.spaceT("scrollPaddingLeft"),scrollPaddingRight:H.spaceT("scrollPaddingRight"),scrollPaddingX:H.spaceT(["scrollPaddingLeft","scrollPaddingRight"]),scrollPaddingY:H.spaceT(["scrollPaddingTop","scrollPaddingBottom"])};function RH(e){return Hs(e)&&e.reference?e.reference:String(e)}var nw=(e,...t)=>t.map(RH).join(` ${e} `).replace(/calc/g,""),iM=(...e)=>`calc(${nw("+",...e)})`,oM=(...e)=>`calc(${nw("-",...e)})`,c4=(...e)=>`calc(${nw("*",...e)})`,aM=(...e)=>`calc(${nw("/",...e)})`,sM=e=>{const t=RH(e);return t!=null&&!Number.isNaN(parseFloat(t))?String(t).startsWith("-")?String(t).slice(1):`-${t}`:c4(t,-1)},Kc=Object.assign(e=>({add:(...t)=>Kc(iM(e,...t)),subtract:(...t)=>Kc(oM(e,...t)),multiply:(...t)=>Kc(c4(e,...t)),divide:(...t)=>Kc(aM(e,...t)),negate:()=>Kc(sM(e)),toString:()=>e.toString()}),{add:iM,subtract:oM,multiply:c4,divide:aM,negate:sM});function TAe(e,t="-"){return e.replace(/\s+/g,t)}function AAe(e){const t=TAe(e.toString());return IAe(PAe(t))}function PAe(e){return e.includes("\\.")?e:!Number.isInteger(parseFloat(e.toString()))?e.replace(".","\\."):e}function IAe(e){return e.replace(/[!-,/:-@[-^`{-~]/g,"\\$&")}function RAe(e,t=""){return[t,e].filter(Boolean).join("-")}function OAe(e,t){return`var(${e}${t?`, ${t}`:""})`}function MAe(e,t=""){return AAe(`--${RAe(e,t)}`)}function nt(e,t,n){const r=MAe(e,n);return{variable:r,reference:OAe(r,t)}}function NAe(e,t){const n={};for(const r of t){if(Array.isArray(r)){const[i,o]=r;n[i]=nt(`${e}-${i}`,o);continue}n[r]=nt(`${e}-${r}`)}return n}function $Ae(e){const t=e==null?0:e.length;return t?e[t-1]:void 0}function DAe(e){const t=parseFloat(e.toString()),n=e.toString().replace(String(t),"");return{unitless:!n,value:t,unit:n}}function d4(e){if(e==null)return e;const{unitless:t}=DAe(e);return t||typeof e=="number"?`${e}px`:e}var OH=(e,t)=>parseInt(e[1],10)>parseInt(t[1],10)?1:-1,HA=e=>Object.fromEntries(Object.entries(e).sort(OH));function lM(e){const t=HA(e);return Object.assign(Object.values(t),t)}function LAe(e){const t=Object.keys(HA(e));return new Set(t)}function uM(e){var t;if(!e)return e;e=(t=d4(e))!=null?t:e;const n=-.02;return typeof e=="number"?`${e+n}`:e.replace(/(\d+\.?\d*)/u,r=>`${parseFloat(r)+n}`)}function Cg(e,t){const n=["@media screen"];return e&&n.push("and",`(min-width: ${d4(e)})`),t&&n.push("and",`(max-width: ${d4(t)})`),n.join(" ")}function FAe(e){var t;if(!e)return null;e.base=(t=e.base)!=null?t:"0px";const n=lM(e),r=Object.entries(e).sort(OH).map(([a,s],l,u)=>{var c;let[,d]=(c=u[l+1])!=null?c:[];return d=parseFloat(d)>0?uM(d):void 0,{_minW:uM(s),breakpoint:a,minW:s,maxW:d,maxWQuery:Cg(null,d),minWQuery:Cg(s),minMaxQuery:Cg(s,d)}}),i=LAe(e),o=Array.from(i.values());return{keys:i,normalized:n,isResponsive(a){const s=Object.keys(a);return s.length>0&&s.every(l=>i.has(l))},asObject:HA(e),asArray:lM(e),details:r,get(a){return r.find(s=>s.breakpoint===a)},media:[null,...n.map(a=>Cg(a)).slice(1)],toArrayValue(a){if(!Hs(a))throw new Error("toArrayValue: value must be an object");const s=o.map(l=>{var u;return(u=a[l])!=null?u:null});for(;$Ae(s)===null;)s.pop();return s},toObjectValue(a){if(!Array.isArray(a))throw new Error("toObjectValue: value must be an array");return a.reduce((s,l,u)=>{const c=o[u];return c!=null&&l!=null&&(s[c]=l),s},{})}}}var _i={hover:(e,t)=>`${e}:hover ${t}, ${e}[data-hover] ${t}`,focus:(e,t)=>`${e}:focus ${t}, ${e}[data-focus] ${t}`,focusVisible:(e,t)=>`${e}:focus-visible ${t}`,focusWithin:(e,t)=>`${e}:focus-within ${t}`,active:(e,t)=>`${e}:active ${t}, ${e}[data-active] ${t}`,disabled:(e,t)=>`${e}:disabled ${t}, ${e}[data-disabled] ${t}`,invalid:(e,t)=>`${e}:invalid ${t}, ${e}[data-invalid] ${t}`,checked:(e,t)=>`${e}:checked ${t}, ${e}[data-checked] ${t}`,indeterminate:(e,t)=>`${e}:indeterminate ${t}, ${e}[aria-checked=mixed] ${t}, ${e}[data-indeterminate] ${t}`,readOnly:(e,t)=>`${e}:read-only ${t}, ${e}[readonly] ${t}, ${e}[data-read-only] ${t}`,expanded:(e,t)=>`${e}:read-only ${t}, ${e}[aria-expanded=true] ${t}, ${e}[data-expanded] ${t}`,placeholderShown:(e,t)=>`${e}:placeholder-shown ${t}`},uu=e=>MH(t=>e(t,"&"),"[role=group]","[data-group]",".group"),fl=e=>MH(t=>e(t,"~ &"),"[data-peer]",".peer"),MH=(e,...t)=>t.map(e).join(", "),rw={_hover:"&:hover, &[data-hover]",_active:"&:active, &[data-active]",_focus:"&:focus, &[data-focus]",_highlighted:"&[data-highlighted]",_focusWithin:"&:focus-within",_focusVisible:"&:focus-visible, &[data-focus-visible]",_disabled:"&:disabled, &[disabled], &[aria-disabled=true], &[data-disabled]",_readOnly:"&[aria-readonly=true], &[readonly], &[data-readonly]",_before:"&::before",_after:"&::after",_empty:"&:empty",_expanded:"&[aria-expanded=true], &[data-expanded]",_checked:"&[aria-checked=true], &[data-checked]",_grabbed:"&[aria-grabbed=true], &[data-grabbed]",_pressed:"&[aria-pressed=true], &[data-pressed]",_invalid:"&[aria-invalid=true], &[data-invalid]",_valid:"&[data-valid], &[data-state=valid]",_loading:"&[data-loading], &[aria-busy=true]",_selected:"&[aria-selected=true], &[data-selected]",_hidden:"&[hidden], &[data-hidden]",_autofill:"&:-webkit-autofill",_even:"&:nth-of-type(even)",_odd:"&:nth-of-type(odd)",_first:"&:first-of-type",_firstLetter:"&::first-letter",_last:"&:last-of-type",_notFirst:"&:not(:first-of-type)",_notLast:"&:not(:last-of-type)",_visited:"&:visited",_activeLink:"&[aria-current=page]",_activeStep:"&[aria-current=step]",_indeterminate:"&:indeterminate, &[aria-checked=mixed], &[data-indeterminate]",_groupHover:uu(_i.hover),_peerHover:fl(_i.hover),_groupFocus:uu(_i.focus),_peerFocus:fl(_i.focus),_groupFocusVisible:uu(_i.focusVisible),_peerFocusVisible:fl(_i.focusVisible),_groupActive:uu(_i.active),_peerActive:fl(_i.active),_groupDisabled:uu(_i.disabled),_peerDisabled:fl(_i.disabled),_groupInvalid:uu(_i.invalid),_peerInvalid:fl(_i.invalid),_groupChecked:uu(_i.checked),_peerChecked:fl(_i.checked),_groupFocusWithin:uu(_i.focusWithin),_peerFocusWithin:fl(_i.focusWithin),_peerPlaceholderShown:fl(_i.placeholderShown),_placeholder:"&::placeholder",_placeholderShown:"&:placeholder-shown",_fullScreen:"&:fullscreen",_selection:"&::selection",_rtl:"[dir=rtl] &, &[dir=rtl]",_ltr:"[dir=ltr] &, &[dir=ltr]",_mediaDark:"@media (prefers-color-scheme: dark)",_mediaReduceMotion:"@media (prefers-reduced-motion: reduce)",_dark:".chakra-ui-dark &:not([data-theme]),[data-theme=dark] &:not([data-theme]),&[data-theme=dark]",_light:".chakra-ui-light &:not([data-theme]),[data-theme=light] &:not([data-theme]),&[data-theme=light]",_horizontal:"&[data-orientation=horizontal]",_vertical:"&[data-orientation=vertical]"},NH=Object.keys(rw);function cM(e,t){return nt(String(e).replace(/\./g,"-"),void 0,t)}function BAe(e,t){let n={};const r={};for(const[i,o]of Object.entries(e)){const{isSemantic:a,value:s}=o,{variable:l,reference:u}=cM(i,t==null?void 0:t.cssVarPrefix);if(!a){if(i.startsWith("space")){const f=i.split("."),[h,...p]=f,m=`${h}.-${p.join(".")}`,_=Kc.negate(s),b=Kc.negate(u);r[m]={value:_,var:l,varRef:b}}n[l]=s,r[i]={value:s,var:l,varRef:u};continue}const c=f=>{const p=[String(i).split(".")[0],f].join(".");if(!e[p])return f;const{reference:_}=cM(p,t==null?void 0:t.cssVarPrefix);return _},d=Hs(s)?s:{default:s};n=Ds(n,Object.entries(d).reduce((f,[h,p])=>{var m,_;if(!p)return f;const b=c(`${p}`);if(h==="default")return f[l]=b,f;const v=(_=(m=rw)==null?void 0:m[h])!=null?_:h;return f[v]={[l]:b},f},{})),r[i]={value:u,var:l,varRef:u}}return{cssVars:n,cssMap:r}}function zAe(e,t=[]){const n=Object.assign({},e);for(const r of t)r in n&&delete n[r];return n}function jAe(e,t){const n={};for(const r of t)r in e&&(n[r]=e[r]);return n}function UAe(e){return typeof e=="object"&&e!=null&&!Array.isArray(e)}function dM(e,t,n={}){const{stop:r,getKey:i}=n;function o(a,s=[]){var l;if(UAe(a)||Array.isArray(a)){const u={};for(const[c,d]of Object.entries(a)){const f=(l=i==null?void 0:i(c))!=null?l:c,h=[...s,f];if(r!=null&&r(a,h))return t(a,s);u[f]=o(d,h)}return u}return t(a,s)}return o(e)}var VAe=["colors","borders","borderWidths","borderStyles","fonts","fontSizes","fontWeights","gradients","letterSpacings","lineHeights","radii","space","shadows","sizes","zIndices","transition","blur","breakpoints"];function GAe(e){return jAe(e,VAe)}function HAe(e){return e.semanticTokens}function qAe(e){const{__cssMap:t,__cssVars:n,__breakpoints:r,...i}=e;return i}var WAe=e=>NH.includes(e)||e==="default";function KAe({tokens:e,semanticTokens:t}){const n={};return dM(e,(r,i)=>{r!=null&&(n[i.join(".")]={isSemantic:!1,value:r})}),dM(t,(r,i)=>{r!=null&&(n[i.join(".")]={isSemantic:!0,value:r})},{stop:r=>Object.keys(r).every(WAe)}),n}function QAe(e){var t;const n=qAe(e),r=GAe(n),i=HAe(n),o=KAe({tokens:r,semanticTokens:i}),a=(t=n.config)==null?void 0:t.cssVarPrefix,{cssMap:s,cssVars:l}=BAe(o,{cssVarPrefix:a});return Object.assign(n,{__cssVars:{...{"--chakra-ring-inset":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-ring-offset-width":"0px","--chakra-ring-offset-color":"#fff","--chakra-ring-color":"rgba(66, 153, 225, 0.6)","--chakra-ring-offset-shadow":"0 0 #0000","--chakra-ring-shadow":"0 0 #0000","--chakra-space-x-reverse":"0","--chakra-space-y-reverse":"0"},...l},__cssMap:s,__breakpoints:FAe(n.breakpoints)}),n}var qA=Ds({},K1,an,dAe,G_,da,fAe,SAe,hAe,IH,_Ae,Qg,u4,Un,kAe,EAe,xAe,wAe,pAe,CAe),XAe=Object.assign({},Un,da,G_,IH,Qg),AKe=Object.keys(XAe),YAe=[...Object.keys(qA),...NH],ZAe={...qA,...rw},JAe=e=>e in ZAe,ePe=e=>t=>{if(!t.__breakpoints)return e;const{isResponsive:n,toArrayValue:r,media:i}=t.__breakpoints,o={};for(const a in e){let s=$s(e[a],t);if(s==null)continue;if(s=Hs(s)&&n(s)?r(s):s,!Array.isArray(s)){o[a]=s;continue}const l=s.slice(0,i.length).length;for(let u=0;ue.startsWith("--")&&typeof t=="string"&&!nPe(t),iPe=(e,t)=>{var n,r;if(t==null)return t;const i=l=>{var u,c;return(c=(u=e.__cssMap)==null?void 0:u[l])==null?void 0:c.varRef},o=l=>{var u;return(u=i(l))!=null?u:l},[a,s]=tPe(t);return t=(r=(n=i(a))!=null?n:o(s))!=null?r:o(t),t};function oPe(e){const{configs:t={},pseudos:n={},theme:r}=e,i=(o,a=!1)=>{var s,l,u;const c=$s(o,r),d=ePe(c)(r);let f={};for(let h in d){const p=d[h];let m=$s(p,r);h in n&&(h=n[h]),rPe(h,m)&&(m=iPe(r,m));let _=t[h];if(_===!0&&(_={property:h}),Hs(m)){f[h]=(s=f[h])!=null?s:{},f[h]=Ds({},f[h],i(m,!0));continue}let b=(u=(l=_==null?void 0:_.transform)==null?void 0:l.call(_,m,r,c))!=null?u:m;b=_!=null&&_.processResult?i(b,!0):b;const v=$s(_==null?void 0:_.property,r);if(!a&&(_!=null&&_.static)){const g=$s(_.static,r);f=Ds({},f,g)}if(v&&Array.isArray(v)){for(const g of v)f[g]=b;continue}if(v){v==="&"&&Hs(b)?f=Ds({},f,b):f[v]=b;continue}if(Hs(b)){f=Ds({},f,b);continue}f[h]=b}return f};return i}var $H=e=>t=>oPe({theme:t,pseudos:rw,configs:qA})(e);function Pt(e){return{definePartsStyle(t){return t},defineMultiStyleConfig(t){return{parts:e,...t}}}}function aPe(e,t){if(Array.isArray(e))return e;if(Hs(e))return t(e);if(e!=null)return[e]}function sPe(e,t){for(let n=t+1;n{Ds(u,{[g]:f?v[g]:{[b]:v[g]}})});continue}if(!h){f?Ds(u,v):u[b]=v;continue}u[b]=v}}return u}}function uPe(e){return t=>{var n;const{variant:r,size:i,theme:o}=t,a=lPe(o);return Ds({},$s((n=e.baseStyle)!=null?n:{},t),a(e,"sizes",i,t),a(e,"variants",r,t))}}function PKe(e,t,n){var r,i,o;return(o=(i=(r=e.__cssMap)==null?void 0:r[`${t}.${n}`])==null?void 0:i.varRef)!=null?o:n}function Iy(e){return zAe(e,["styleConfig","size","variant","colorScheme"])}var cPe={common:"background-color, border-color, color, fill, stroke, opacity, box-shadow, transform",colors:"background-color, border-color, color, fill, stroke",dimensions:"width, height",position:"left, right, top, bottom",background:"background-color, background-image, background-position"},dPe={"ease-in":"cubic-bezier(0.4, 0, 1, 1)","ease-out":"cubic-bezier(0, 0, 0.2, 1)","ease-in-out":"cubic-bezier(0.4, 0, 0.2, 1)"},fPe={"ultra-fast":"50ms",faster:"100ms",fast:"150ms",normal:"200ms",slow:"300ms",slower:"400ms","ultra-slow":"500ms"},hPe={property:cPe,easing:dPe,duration:fPe},pPe=hPe,gPe={hide:-1,auto:"auto",base:0,docked:10,dropdown:1e3,sticky:1100,banner:1200,overlay:1300,modal:1400,popover:1500,skipLink:1600,toast:1700,tooltip:1800},mPe=gPe,yPe={none:0,"1px":"1px solid","2px":"2px solid","4px":"4px solid","8px":"8px solid"},vPe=yPe,bPe={base:"0em",sm:"30em",md:"48em",lg:"62em",xl:"80em","2xl":"96em"},_Pe=bPe,SPe={transparent:"transparent",current:"currentColor",black:"#000000",white:"#FFFFFF",whiteAlpha:{50:"rgba(255, 255, 255, 0.04)",100:"rgba(255, 255, 255, 0.06)",200:"rgba(255, 255, 255, 0.08)",300:"rgba(255, 255, 255, 0.16)",400:"rgba(255, 255, 255, 0.24)",500:"rgba(255, 255, 255, 0.36)",600:"rgba(255, 255, 255, 0.48)",700:"rgba(255, 255, 255, 0.64)",800:"rgba(255, 255, 255, 0.80)",900:"rgba(255, 255, 255, 0.92)"},blackAlpha:{50:"rgba(0, 0, 0, 0.04)",100:"rgba(0, 0, 0, 0.06)",200:"rgba(0, 0, 0, 0.08)",300:"rgba(0, 0, 0, 0.16)",400:"rgba(0, 0, 0, 0.24)",500:"rgba(0, 0, 0, 0.36)",600:"rgba(0, 0, 0, 0.48)",700:"rgba(0, 0, 0, 0.64)",800:"rgba(0, 0, 0, 0.80)",900:"rgba(0, 0, 0, 0.92)"},gray:{50:"#F7FAFC",100:"#EDF2F7",200:"#E2E8F0",300:"#CBD5E0",400:"#A0AEC0",500:"#718096",600:"#4A5568",700:"#2D3748",800:"#1A202C",900:"#171923"},red:{50:"#FFF5F5",100:"#FED7D7",200:"#FEB2B2",300:"#FC8181",400:"#F56565",500:"#E53E3E",600:"#C53030",700:"#9B2C2C",800:"#822727",900:"#63171B"},orange:{50:"#FFFAF0",100:"#FEEBC8",200:"#FBD38D",300:"#F6AD55",400:"#ED8936",500:"#DD6B20",600:"#C05621",700:"#9C4221",800:"#7B341E",900:"#652B19"},yellow:{50:"#FFFFF0",100:"#FEFCBF",200:"#FAF089",300:"#F6E05E",400:"#ECC94B",500:"#D69E2E",600:"#B7791F",700:"#975A16",800:"#744210",900:"#5F370E"},green:{50:"#F0FFF4",100:"#C6F6D5",200:"#9AE6B4",300:"#68D391",400:"#48BB78",500:"#38A169",600:"#2F855A",700:"#276749",800:"#22543D",900:"#1C4532"},teal:{50:"#E6FFFA",100:"#B2F5EA",200:"#81E6D9",300:"#4FD1C5",400:"#38B2AC",500:"#319795",600:"#2C7A7B",700:"#285E61",800:"#234E52",900:"#1D4044"},blue:{50:"#ebf8ff",100:"#bee3f8",200:"#90cdf4",300:"#63b3ed",400:"#4299e1",500:"#3182ce",600:"#2b6cb0",700:"#2c5282",800:"#2a4365",900:"#1A365D"},cyan:{50:"#EDFDFD",100:"#C4F1F9",200:"#9DECF9",300:"#76E4F7",400:"#0BC5EA",500:"#00B5D8",600:"#00A3C4",700:"#0987A0",800:"#086F83",900:"#065666"},purple:{50:"#FAF5FF",100:"#E9D8FD",200:"#D6BCFA",300:"#B794F4",400:"#9F7AEA",500:"#805AD5",600:"#6B46C1",700:"#553C9A",800:"#44337A",900:"#322659"},pink:{50:"#FFF5F7",100:"#FED7E2",200:"#FBB6CE",300:"#F687B3",400:"#ED64A6",500:"#D53F8C",600:"#B83280",700:"#97266D",800:"#702459",900:"#521B41"},linkedin:{50:"#E8F4F9",100:"#CFEDFB",200:"#9BDAF3",300:"#68C7EC",400:"#34B3E4",500:"#00A0DC",600:"#008CC9",700:"#0077B5",800:"#005E93",900:"#004471"},facebook:{50:"#E8F4F9",100:"#D9DEE9",200:"#B7C2DA",300:"#6482C0",400:"#4267B2",500:"#385898",600:"#314E89",700:"#29487D",800:"#223B67",900:"#1E355B"},messenger:{50:"#D0E6FF",100:"#B9DAFF",200:"#A2CDFF",300:"#7AB8FF",400:"#2E90FF",500:"#0078FF",600:"#0063D1",700:"#0052AC",800:"#003C7E",900:"#002C5C"},whatsapp:{50:"#dffeec",100:"#b9f5d0",200:"#90edb3",300:"#65e495",400:"#3cdd78",500:"#22c35e",600:"#179848",700:"#0c6c33",800:"#01421c",900:"#001803"},twitter:{50:"#E5F4FD",100:"#C8E9FB",200:"#A8DCFA",300:"#83CDF7",400:"#57BBF5",500:"#1DA1F2",600:"#1A94DA",700:"#1681BF",800:"#136B9E",900:"#0D4D71"},telegram:{50:"#E3F2F9",100:"#C5E4F3",200:"#A2D4EC",300:"#7AC1E4",400:"#47A9DA",500:"#0088CC",600:"#007AB8",700:"#006BA1",800:"#005885",900:"#003F5E"}},xPe=SPe,wPe={none:"0",sm:"0.125rem",base:"0.25rem",md:"0.375rem",lg:"0.5rem",xl:"0.75rem","2xl":"1rem","3xl":"1.5rem",full:"9999px"},CPe=wPe,EPe={xs:"0 0 0 1px rgba(0, 0, 0, 0.05)",sm:"0 1px 2px 0 rgba(0, 0, 0, 0.05)",base:"0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06)",md:"0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)",lg:"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)",xl:"0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04)","2xl":"0 25px 50px -12px rgba(0, 0, 0, 0.25)",outline:"0 0 0 3px rgba(66, 153, 225, 0.6)",inner:"inset 0 2px 4px 0 rgba(0,0,0,0.06)",none:"none","dark-lg":"rgba(0, 0, 0, 0.1) 0px 0px 0px 1px, rgba(0, 0, 0, 0.2) 0px 5px 10px, rgba(0, 0, 0, 0.4) 0px 15px 40px"},kPe=EPe,TPe={none:0,sm:"4px",base:"8px",md:"12px",lg:"16px",xl:"24px","2xl":"40px","3xl":"64px"},APe=TPe,PPe={letterSpacings:{tighter:"-0.05em",tight:"-0.025em",normal:"0",wide:"0.025em",wider:"0.05em",widest:"0.1em"},lineHeights:{normal:"normal",none:1,shorter:1.25,short:1.375,base:1.5,tall:1.625,taller:"2",3:".75rem",4:"1rem",5:"1.25rem",6:"1.5rem",7:"1.75rem",8:"2rem",9:"2.25rem",10:"2.5rem"},fontWeights:{hairline:100,thin:200,light:300,normal:400,medium:500,semibold:600,bold:700,extrabold:800,black:900},fonts:{heading:'-apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"',body:'-apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"',mono:'SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace'},fontSizes:{"3xs":"0.45rem","2xs":"0.625rem",xs:"0.75rem",sm:"0.875rem",md:"1rem",lg:"1.125rem",xl:"1.25rem","2xl":"1.5rem","3xl":"1.875rem","4xl":"2.25rem","5xl":"3rem","6xl":"3.75rem","7xl":"4.5rem","8xl":"6rem","9xl":"8rem"}},DH=PPe,LH={px:"1px",.5:"0.125rem",1:"0.25rem",1.5:"0.375rem",2:"0.5rem",2.5:"0.625rem",3:"0.75rem",3.5:"0.875rem",4:"1rem",5:"1.25rem",6:"1.5rem",7:"1.75rem",8:"2rem",9:"2.25rem",10:"2.5rem",12:"3rem",14:"3.5rem",16:"4rem",20:"5rem",24:"6rem",28:"7rem",32:"8rem",36:"9rem",40:"10rem",44:"11rem",48:"12rem",52:"13rem",56:"14rem",60:"15rem",64:"16rem",72:"18rem",80:"20rem",96:"24rem"},IPe={max:"max-content",min:"min-content",full:"100%","3xs":"14rem","2xs":"16rem",xs:"20rem",sm:"24rem",md:"28rem",lg:"32rem",xl:"36rem","2xl":"42rem","3xl":"48rem","4xl":"56rem","5xl":"64rem","6xl":"72rem","7xl":"80rem","8xl":"90rem",prose:"60ch"},RPe={sm:"640px",md:"768px",lg:"1024px",xl:"1280px"},OPe={...LH,...IPe,container:RPe},FH=OPe,MPe={breakpoints:_Pe,zIndices:mPe,radii:CPe,blur:APe,colors:xPe,...DH,sizes:FH,shadows:kPe,space:LH,borders:vPe,transition:pPe},{defineMultiStyleConfig:NPe,definePartsStyle:Eg}=Pt(["stepper","step","title","description","indicator","separator","icon","number"]),El=nt("stepper-indicator-size"),jf=nt("stepper-icon-size"),Uf=nt("stepper-title-font-size"),kg=nt("stepper-description-font-size"),ig=nt("stepper-accent-color"),$Pe=Eg(({colorScheme:e})=>({stepper:{display:"flex",justifyContent:"space-between",gap:"4","&[data-orientation=vertical]":{flexDirection:"column",alignItems:"flex-start"},"&[data-orientation=horizontal]":{flexDirection:"row",alignItems:"center"},[ig.variable]:`colors.${e}.500`,_dark:{[ig.variable]:`colors.${e}.200`}},title:{fontSize:Uf.reference,fontWeight:"medium"},description:{fontSize:kg.reference,color:"chakra-subtle-text"},number:{fontSize:Uf.reference},step:{flexShrink:0,position:"relative",display:"flex",gap:"2","&[data-orientation=horizontal]":{alignItems:"center"},flex:"1","&:last-of-type:not([data-stretch])":{flex:"initial"}},icon:{flexShrink:0,width:jf.reference,height:jf.reference},indicator:{flexShrink:0,borderRadius:"full",width:El.reference,height:El.reference,display:"flex",justifyContent:"center",alignItems:"center","&[data-status=active]":{borderWidth:"2px",borderColor:ig.reference},"&[data-status=complete]":{bg:ig.reference,color:"chakra-inverse-text"},"&[data-status=incomplete]":{borderWidth:"2px"}},separator:{bg:"chakra-border-color",flex:"1","&[data-status=complete]":{bg:ig.reference},"&[data-orientation=horizontal]":{width:"100%",height:"2px",marginStart:"2"},"&[data-orientation=vertical]":{width:"2px",position:"absolute",height:"100%",maxHeight:`calc(100% - ${El.reference} - 8px)`,top:`calc(${El.reference} + 4px)`,insetStart:`calc(${El.reference} / 2 - 1px)`}}})),DPe=NPe({baseStyle:$Pe,sizes:{xs:Eg({stepper:{[El.variable]:"sizes.4",[jf.variable]:"sizes.3",[Uf.variable]:"fontSizes.xs",[kg.variable]:"fontSizes.xs"}}),sm:Eg({stepper:{[El.variable]:"sizes.6",[jf.variable]:"sizes.4",[Uf.variable]:"fontSizes.sm",[kg.variable]:"fontSizes.xs"}}),md:Eg({stepper:{[El.variable]:"sizes.8",[jf.variable]:"sizes.5",[Uf.variable]:"fontSizes.md",[kg.variable]:"fontSizes.sm"}}),lg:Eg({stepper:{[El.variable]:"sizes.10",[jf.variable]:"sizes.6",[Uf.variable]:"fontSizes.lg",[kg.variable]:"fontSizes.md"}})},defaultProps:{size:"md",colorScheme:"blue"}});function pn(e,t={}){let n=!1;function r(){if(!n){n=!0;return}throw new Error("[anatomy] .part(...) should only be called once. Did you mean to use .extend(...) ?")}function i(...c){r();for(const d of c)t[d]=l(d);return pn(e,t)}function o(...c){for(const d of c)d in t||(t[d]=l(d));return pn(e,t)}function a(){return Object.fromEntries(Object.entries(t).map(([d,f])=>[d,f.selector]))}function s(){return Object.fromEntries(Object.entries(t).map(([d,f])=>[d,f.className]))}function l(c){const h=`chakra-${(["container","root"].includes(c??"")?[e]:[e,c]).filter(Boolean).join("__")}`;return{className:h,selector:`.${h}`,toString:()=>c}}return{parts:i,toPart:l,extend:o,selectors:a,classnames:s,get keys(){return Object.keys(t)},__type:{}}}var BH=pn("accordion").parts("root","container","button","panel").extend("icon"),LPe=pn("alert").parts("title","description","container").extend("icon","spinner"),FPe=pn("avatar").parts("label","badge","container").extend("excessLabel","group"),BPe=pn("breadcrumb").parts("link","item","container").extend("separator");pn("button").parts();var zH=pn("checkbox").parts("control","icon","container").extend("label");pn("progress").parts("track","filledTrack").extend("label");var zPe=pn("drawer").parts("overlay","dialogContainer","dialog").extend("header","closeButton","body","footer"),jH=pn("editable").parts("preview","input","textarea"),jPe=pn("form").parts("container","requiredIndicator","helperText"),UPe=pn("formError").parts("text","icon"),UH=pn("input").parts("addon","field","element","group"),VPe=pn("list").parts("container","item","icon"),VH=pn("menu").parts("button","list","item").extend("groupTitle","icon","command","divider"),GH=pn("modal").parts("overlay","dialogContainer","dialog").extend("header","closeButton","body","footer"),HH=pn("numberinput").parts("root","field","stepperGroup","stepper");pn("pininput").parts("field");var qH=pn("popover").parts("content","header","body","footer").extend("popper","arrow","closeButton"),WH=pn("progress").parts("label","filledTrack","track"),GPe=pn("radio").parts("container","control","label"),KH=pn("select").parts("field","icon"),QH=pn("slider").parts("container","track","thumb","filledTrack","mark"),HPe=pn("stat").parts("container","label","helpText","number","icon"),XH=pn("switch").parts("container","track","thumb"),qPe=pn("table").parts("table","thead","tbody","tr","th","td","tfoot","caption"),YH=pn("tabs").parts("root","tab","tablist","tabpanel","tabpanels","indicator"),WPe=pn("tag").parts("container","label","closeButton"),KPe=pn("card").parts("container","header","body","footer");function ad(e,t,n){return Math.min(Math.max(e,n),t)}class QPe extends Error{constructor(t){super(`Failed to parse color: "${t}"`)}}var Tg=QPe;function WA(e){if(typeof e!="string")throw new Tg(e);if(e.trim().toLowerCase()==="transparent")return[0,0,0,0];let t=e.trim();t=r6e.test(e)?ZPe(e):e;const n=JPe.exec(t);if(n){const a=Array.from(n).slice(1);return[...a.slice(0,3).map(s=>parseInt(E0(s,2),16)),parseInt(E0(a[3]||"f",2),16)/255]}const r=e6e.exec(t);if(r){const a=Array.from(r).slice(1);return[...a.slice(0,3).map(s=>parseInt(s,16)),parseInt(a[3]||"ff",16)/255]}const i=t6e.exec(t);if(i){const a=Array.from(i).slice(1);return[...a.slice(0,3).map(s=>parseInt(s,10)),parseFloat(a[3]||"1")]}const o=n6e.exec(t);if(o){const[a,s,l,u]=Array.from(o).slice(1).map(parseFloat);if(ad(0,100,s)!==s)throw new Tg(e);if(ad(0,100,l)!==l)throw new Tg(e);return[...i6e(a,s,l),Number.isNaN(u)?1:u]}throw new Tg(e)}function XPe(e){let t=5381,n=e.length;for(;n;)t=t*33^e.charCodeAt(--n);return(t>>>0)%2341}const fM=e=>parseInt(e.replace(/_/g,""),36),YPe="1q29ehhb 1n09sgk7 1kl1ekf_ _yl4zsno 16z9eiv3 1p29lhp8 _bd9zg04 17u0____ _iw9zhe5 _to73___ _r45e31e _7l6g016 _jh8ouiv _zn3qba8 1jy4zshs 11u87k0u 1ro9yvyo 1aj3xael 1gz9zjz0 _3w8l4xo 1bf1ekf_ _ke3v___ _4rrkb__ 13j776yz _646mbhl _nrjr4__ _le6mbhl 1n37ehkb _m75f91n _qj3bzfz 1939yygw 11i5z6x8 _1k5f8xs 1509441m 15t5lwgf _ae2th1n _tg1ugcv 1lp1ugcv 16e14up_ _h55rw7n _ny9yavn _7a11xb_ 1ih442g9 _pv442g9 1mv16xof 14e6y7tu 1oo9zkds 17d1cisi _4v9y70f _y98m8kc 1019pq0v 12o9zda8 _348j4f4 1et50i2o _8epa8__ _ts6senj 1o350i2o 1mi9eiuo 1259yrp0 1ln80gnw _632xcoy 1cn9zldc _f29edu4 1n490c8q _9f9ziet 1b94vk74 _m49zkct 1kz6s73a 1eu9dtog _q58s1rz 1dy9sjiq __u89jo3 _aj5nkwg _ld89jo3 13h9z6wx _qa9z2ii _l119xgq _bs5arju 1hj4nwk9 1qt4nwk9 1ge6wau6 14j9zlcw 11p1edc_ _ms1zcxe _439shk6 _jt9y70f _754zsow 1la40eju _oq5p___ _x279qkz 1fa5r3rv _yd2d9ip _424tcku _8y1di2_ _zi2uabw _yy7rn9h 12yz980_ __39ljp6 1b59zg0x _n39zfzp 1fy9zest _b33k___ _hp9wq92 1il50hz4 _io472ub _lj9z3eo 19z9ykg0 _8t8iu3a 12b9bl4a 1ak5yw0o _896v4ku _tb8k8lv _s59zi6t _c09ze0p 1lg80oqn 1id9z8wb _238nba5 1kq6wgdi _154zssg _tn3zk49 _da9y6tc 1sg7cv4f _r12jvtt 1gq5fmkz 1cs9rvci _lp9jn1c _xw1tdnb 13f9zje6 16f6973h _vo7ir40 _bt5arjf _rc45e4t _hr4e100 10v4e100 _hc9zke2 _w91egv_ _sj2r1kk 13c87yx8 _vqpds__ _ni8ggk8 _tj9yqfb 1ia2j4r4 _7x9b10u 1fc9ld4j 1eq9zldr _5j9lhpx _ez9zl6o _md61fzm".split(" ").reduce((e,t)=>{const n=fM(t.substring(0,3)),r=fM(t.substring(3)).toString(16);let i="";for(let o=0;o<6-r.length;o++)i+="0";return e[n]=`${i}${r}`,e},{});function ZPe(e){const t=e.toLowerCase().trim(),n=YPe[XPe(t)];if(!n)throw new Tg(e);return`#${n}`}const E0=(e,t)=>Array.from(Array(t)).map(()=>e).join(""),JPe=new RegExp(`^#${E0("([a-f0-9])",3)}([a-f0-9])?$`,"i"),e6e=new RegExp(`^#${E0("([a-f0-9]{2})",3)}([a-f0-9]{2})?$`,"i"),t6e=new RegExp(`^rgba?\\(\\s*(\\d+)\\s*${E0(",\\s*(\\d+)\\s*",2)}(?:,\\s*([\\d.]+))?\\s*\\)$`,"i"),n6e=/^hsla?\(\s*([\d.]+)\s*,\s*([\d.]+)%\s*,\s*([\d.]+)%(?:\s*,\s*([\d.]+))?\s*\)$/i,r6e=/^[a-z]+$/i,hM=e=>Math.round(e*255),i6e=(e,t,n)=>{let r=n/100;if(t===0)return[r,r,r].map(hM);const i=(e%360+360)%360/60,o=(1-Math.abs(2*r-1))*(t/100),a=o*(1-Math.abs(i%2-1));let s=0,l=0,u=0;i>=0&&i<1?(s=o,l=a):i>=1&&i<2?(s=a,l=o):i>=2&&i<3?(l=o,u=a):i>=3&&i<4?(l=a,u=o):i>=4&&i<5?(s=a,u=o):i>=5&&i<6&&(s=o,u=a);const c=r-o/2,d=s+c,f=l+c,h=u+c;return[d,f,h].map(hM)};function o6e(e,t,n,r){return`rgba(${ad(0,255,e).toFixed()}, ${ad(0,255,t).toFixed()}, ${ad(0,255,n).toFixed()}, ${parseFloat(ad(0,1,r).toFixed(3))})`}function a6e(e,t){const[n,r,i,o]=WA(e);return o6e(n,r,i,o-t)}function s6e(e){const[t,n,r,i]=WA(e);let o=a=>{const s=ad(0,255,a).toString(16);return s.length===1?`0${s}`:s};return`#${o(t)}${o(n)}${o(r)}${i<1?o(Math.round(i*255)):""}`}function l6e(e,t,n,r,i){for(t=t.split?t.split("."):t,r=0;rObject.keys(e).length===0,to=(e,t,n)=>{const r=l6e(e,`colors.${t}`,t);try{return s6e(r),r}catch{return n??"#000000"}},c6e=e=>{const[t,n,r]=WA(e);return(t*299+n*587+r*114)/1e3},d6e=e=>t=>{const n=to(t,e);return c6e(n)<128?"dark":"light"},f6e=e=>t=>d6e(e)(t)==="dark",ap=(e,t)=>n=>{const r=to(n,e);return a6e(r,1-t)};function pM(e="1rem",t="rgba(255, 255, 255, 0.15)"){return{backgroundImage:`linear-gradient( - 45deg, - ${t} 25%, - transparent 25%, - transparent 50%, - ${t} 50%, - ${t} 75%, - transparent 75%, - transparent - )`,backgroundSize:`${e} ${e}`}}var h6e=()=>`#${Math.floor(Math.random()*16777215).toString(16).padEnd(6,"0")}`;function p6e(e){const t=h6e();return!e||u6e(e)?t:e.string&&e.colors?m6e(e.string,e.colors):e.string&&!e.colors?g6e(e.string):e.colors&&!e.string?y6e(e.colors):t}function g6e(e){let t=0;if(e.length===0)return t.toString();for(let r=0;r>r*8&255;n+=`00${i.toString(16)}`.substr(-2)}return n}function m6e(e,t){let n=0;if(e.length===0)return t[0];for(let r=0;rn.colorMode==="dark"?t:e}function KA(e){const{orientation:t,vertical:n,horizontal:r}=e;return t?t==="vertical"?n:r:{}}function ZH(e){return Hs(e)&&e.reference?e.reference:String(e)}var iw=(e,...t)=>t.map(ZH).join(` ${e} `).replace(/calc/g,""),gM=(...e)=>`calc(${iw("+",...e)})`,mM=(...e)=>`calc(${iw("-",...e)})`,f4=(...e)=>`calc(${iw("*",...e)})`,yM=(...e)=>`calc(${iw("/",...e)})`,vM=e=>{const t=ZH(e);return t!=null&&!Number.isNaN(parseFloat(t))?String(t).startsWith("-")?String(t).slice(1):`-${t}`:f4(t,-1)},kl=Object.assign(e=>({add:(...t)=>kl(gM(e,...t)),subtract:(...t)=>kl(mM(e,...t)),multiply:(...t)=>kl(f4(e,...t)),divide:(...t)=>kl(yM(e,...t)),negate:()=>kl(vM(e)),toString:()=>e.toString()}),{add:gM,subtract:mM,multiply:f4,divide:yM,negate:vM});function v6e(e){return!Number.isInteger(parseFloat(e.toString()))}function b6e(e,t="-"){return e.replace(/\s+/g,t)}function JH(e){const t=b6e(e.toString());return t.includes("\\.")?e:v6e(e)?t.replace(".","\\."):e}function _6e(e,t=""){return[t,JH(e)].filter(Boolean).join("-")}function S6e(e,t){return`var(${JH(e)}${t?`, ${t}`:""})`}function x6e(e,t=""){return`--${_6e(e,t)}`}function fr(e,t){const n=x6e(e,t==null?void 0:t.prefix);return{variable:n,reference:S6e(n,w6e(t==null?void 0:t.fallback))}}function w6e(e){return typeof e=="string"?e:e==null?void 0:e.reference}var{defineMultiStyleConfig:C6e,definePartsStyle:Q1}=Pt(XH.keys),Xg=fr("switch-track-width"),yd=fr("switch-track-height"),a5=fr("switch-track-diff"),E6e=kl.subtract(Xg,yd),h4=fr("switch-thumb-x"),og=fr("switch-bg"),k6e=e=>{const{colorScheme:t}=e;return{borderRadius:"full",p:"0.5",width:[Xg.reference],height:[yd.reference],transitionProperty:"common",transitionDuration:"fast",[og.variable]:"colors.gray.300",_dark:{[og.variable]:"colors.whiteAlpha.400"},_focusVisible:{boxShadow:"outline"},_disabled:{opacity:.4,cursor:"not-allowed"},_checked:{[og.variable]:`colors.${t}.500`,_dark:{[og.variable]:`colors.${t}.200`}},bg:og.reference}},T6e={bg:"white",transitionProperty:"transform",transitionDuration:"normal",borderRadius:"inherit",width:[yd.reference],height:[yd.reference],_checked:{transform:`translateX(${h4.reference})`}},A6e=Q1(e=>({container:{[a5.variable]:E6e,[h4.variable]:a5.reference,_rtl:{[h4.variable]:kl(a5).negate().toString()}},track:k6e(e),thumb:T6e})),P6e={sm:Q1({container:{[Xg.variable]:"1.375rem",[yd.variable]:"sizes.3"}}),md:Q1({container:{[Xg.variable]:"1.875rem",[yd.variable]:"sizes.4"}}),lg:Q1({container:{[Xg.variable]:"2.875rem",[yd.variable]:"sizes.6"}})},I6e=C6e({baseStyle:A6e,sizes:P6e,defaultProps:{size:"md",colorScheme:"blue"}}),{defineMultiStyleConfig:R6e,definePartsStyle:Sh}=Pt(qPe.keys),O6e=Sh({table:{fontVariantNumeric:"lining-nums tabular-nums",borderCollapse:"collapse",width:"full"},th:{fontFamily:"heading",fontWeight:"bold",textTransform:"uppercase",letterSpacing:"wider",textAlign:"start"},td:{textAlign:"start"},caption:{mt:4,fontFamily:"heading",textAlign:"center",fontWeight:"medium"}}),H_={"&[data-is-numeric=true]":{textAlign:"end"}},M6e=Sh(e=>{const{colorScheme:t}=e;return{th:{color:K("gray.600","gray.400")(e),borderBottom:"1px",borderColor:K(`${t}.100`,`${t}.700`)(e),...H_},td:{borderBottom:"1px",borderColor:K(`${t}.100`,`${t}.700`)(e),...H_},caption:{color:K("gray.600","gray.100")(e)},tfoot:{tr:{"&:last-of-type":{th:{borderBottomWidth:0}}}}}}),N6e=Sh(e=>{const{colorScheme:t}=e;return{th:{color:K("gray.600","gray.400")(e),borderBottom:"1px",borderColor:K(`${t}.100`,`${t}.700`)(e),...H_},td:{borderBottom:"1px",borderColor:K(`${t}.100`,`${t}.700`)(e),...H_},caption:{color:K("gray.600","gray.100")(e)},tbody:{tr:{"&:nth-of-type(odd)":{"th, td":{borderBottomWidth:"1px",borderColor:K(`${t}.100`,`${t}.700`)(e)},td:{background:K(`${t}.100`,`${t}.700`)(e)}}}},tfoot:{tr:{"&:last-of-type":{th:{borderBottomWidth:0}}}}}}),$6e={simple:M6e,striped:N6e,unstyled:{}},D6e={sm:Sh({th:{px:"4",py:"1",lineHeight:"4",fontSize:"xs"},td:{px:"4",py:"2",fontSize:"sm",lineHeight:"4"},caption:{px:"4",py:"2",fontSize:"xs"}}),md:Sh({th:{px:"6",py:"3",lineHeight:"4",fontSize:"xs"},td:{px:"6",py:"4",lineHeight:"5"},caption:{px:"6",py:"2",fontSize:"sm"}}),lg:Sh({th:{px:"8",py:"4",lineHeight:"5",fontSize:"sm"},td:{px:"8",py:"5",lineHeight:"6"},caption:{px:"6",py:"2",fontSize:"md"}})},L6e=R6e({baseStyle:O6e,variants:$6e,sizes:D6e,defaultProps:{variant:"simple",size:"md",colorScheme:"gray"}}),_o=nt("tabs-color"),Xa=nt("tabs-bg"),Qv=nt("tabs-border-color"),{defineMultiStyleConfig:F6e,definePartsStyle:qs}=Pt(YH.keys),B6e=e=>{const{orientation:t}=e;return{display:t==="vertical"?"flex":"block"}},z6e=e=>{const{isFitted:t}=e;return{flex:t?1:void 0,transitionProperty:"common",transitionDuration:"normal",_focusVisible:{zIndex:1,boxShadow:"outline"},_disabled:{cursor:"not-allowed",opacity:.4}}},j6e=e=>{const{align:t="start",orientation:n}=e;return{justifyContent:{end:"flex-end",center:"center",start:"flex-start"}[t],flexDirection:n==="vertical"?"column":"row"}},U6e={p:4},V6e=qs(e=>({root:B6e(e),tab:z6e(e),tablist:j6e(e),tabpanel:U6e})),G6e={sm:qs({tab:{py:1,px:4,fontSize:"sm"}}),md:qs({tab:{fontSize:"md",py:2,px:4}}),lg:qs({tab:{fontSize:"lg",py:3,px:4}})},H6e=qs(e=>{const{colorScheme:t,orientation:n}=e,r=n==="vertical",i=r?"borderStart":"borderBottom",o=r?"marginStart":"marginBottom";return{tablist:{[i]:"2px solid",borderColor:"inherit"},tab:{[i]:"2px solid",borderColor:"transparent",[o]:"-2px",_selected:{[_o.variable]:`colors.${t}.600`,_dark:{[_o.variable]:`colors.${t}.300`},borderColor:"currentColor"},_active:{[Xa.variable]:"colors.gray.200",_dark:{[Xa.variable]:"colors.whiteAlpha.300"}},_disabled:{_active:{bg:"none"}},color:_o.reference,bg:Xa.reference}}}),q6e=qs(e=>{const{colorScheme:t}=e;return{tab:{borderTopRadius:"md",border:"1px solid",borderColor:"transparent",mb:"-1px",[Qv.variable]:"transparent",_selected:{[_o.variable]:`colors.${t}.600`,[Qv.variable]:"colors.white",_dark:{[_o.variable]:`colors.${t}.300`,[Qv.variable]:"colors.gray.800"},borderColor:"inherit",borderBottomColor:Qv.reference},color:_o.reference},tablist:{mb:"-1px",borderBottom:"1px solid",borderColor:"inherit"}}}),W6e=qs(e=>{const{colorScheme:t}=e;return{tab:{border:"1px solid",borderColor:"inherit",[Xa.variable]:"colors.gray.50",_dark:{[Xa.variable]:"colors.whiteAlpha.50"},mb:"-1px",_notLast:{marginEnd:"-1px"},_selected:{[Xa.variable]:"colors.white",[_o.variable]:`colors.${t}.600`,_dark:{[Xa.variable]:"colors.gray.800",[_o.variable]:`colors.${t}.300`},borderColor:"inherit",borderTopColor:"currentColor",borderBottomColor:"transparent"},color:_o.reference,bg:Xa.reference},tablist:{mb:"-1px",borderBottom:"1px solid",borderColor:"inherit"}}}),K6e=qs(e=>{const{colorScheme:t,theme:n}=e;return{tab:{borderRadius:"full",fontWeight:"semibold",color:"gray.600",_selected:{color:to(n,`${t}.700`),bg:to(n,`${t}.100`)}}}}),Q6e=qs(e=>{const{colorScheme:t}=e;return{tab:{borderRadius:"full",fontWeight:"semibold",[_o.variable]:"colors.gray.600",_dark:{[_o.variable]:"inherit"},_selected:{[_o.variable]:"colors.white",[Xa.variable]:`colors.${t}.600`,_dark:{[_o.variable]:"colors.gray.800",[Xa.variable]:`colors.${t}.300`}},color:_o.reference,bg:Xa.reference}}}),X6e=qs({}),Y6e={line:H6e,enclosed:q6e,"enclosed-colored":W6e,"soft-rounded":K6e,"solid-rounded":Q6e,unstyled:X6e},Z6e=F6e({baseStyle:V6e,sizes:G6e,variants:Y6e,defaultProps:{size:"md",variant:"line",colorScheme:"blue"}}),Er=NAe("badge",["bg","color","shadow"]),J6e={px:1,textTransform:"uppercase",fontSize:"xs",borderRadius:"sm",fontWeight:"bold",bg:Er.bg.reference,color:Er.color.reference,boxShadow:Er.shadow.reference},e8e=e=>{const{colorScheme:t,theme:n}=e,r=ap(`${t}.500`,.6)(n);return{[Er.bg.variable]:`colors.${t}.500`,[Er.color.variable]:"colors.white",_dark:{[Er.bg.variable]:r,[Er.color.variable]:"colors.whiteAlpha.800"}}},t8e=e=>{const{colorScheme:t,theme:n}=e,r=ap(`${t}.200`,.16)(n);return{[Er.bg.variable]:`colors.${t}.100`,[Er.color.variable]:`colors.${t}.800`,_dark:{[Er.bg.variable]:r,[Er.color.variable]:`colors.${t}.200`}}},n8e=e=>{const{colorScheme:t,theme:n}=e,r=ap(`${t}.200`,.8)(n);return{[Er.color.variable]:`colors.${t}.500`,_dark:{[Er.color.variable]:r},[Er.shadow.variable]:`inset 0 0 0px 1px ${Er.color.reference}`}},r8e={solid:e8e,subtle:t8e,outline:n8e},Yg={baseStyle:J6e,variants:r8e,defaultProps:{variant:"subtle",colorScheme:"gray"}},{defineMultiStyleConfig:i8e,definePartsStyle:vd}=Pt(WPe.keys),bM=nt("tag-bg"),_M=nt("tag-color"),s5=nt("tag-shadow"),X1=nt("tag-min-height"),Y1=nt("tag-min-width"),Z1=nt("tag-font-size"),J1=nt("tag-padding-inline"),o8e={fontWeight:"medium",lineHeight:1.2,outline:0,[_M.variable]:Er.color.reference,[bM.variable]:Er.bg.reference,[s5.variable]:Er.shadow.reference,color:_M.reference,bg:bM.reference,boxShadow:s5.reference,borderRadius:"md",minH:X1.reference,minW:Y1.reference,fontSize:Z1.reference,px:J1.reference,_focusVisible:{[s5.variable]:"shadows.outline"}},a8e={lineHeight:1.2,overflow:"visible"},s8e={fontSize:"lg",w:"5",h:"5",transitionProperty:"common",transitionDuration:"normal",borderRadius:"full",marginStart:"1.5",marginEnd:"-1",opacity:.5,_disabled:{opacity:.4},_focusVisible:{boxShadow:"outline",bg:"rgba(0, 0, 0, 0.14)"},_hover:{opacity:.8},_active:{opacity:1}},l8e=vd({container:o8e,label:a8e,closeButton:s8e}),u8e={sm:vd({container:{[X1.variable]:"sizes.5",[Y1.variable]:"sizes.5",[Z1.variable]:"fontSizes.xs",[J1.variable]:"space.2"},closeButton:{marginEnd:"-2px",marginStart:"0.35rem"}}),md:vd({container:{[X1.variable]:"sizes.6",[Y1.variable]:"sizes.6",[Z1.variable]:"fontSizes.sm",[J1.variable]:"space.2"}}),lg:vd({container:{[X1.variable]:"sizes.8",[Y1.variable]:"sizes.8",[Z1.variable]:"fontSizes.md",[J1.variable]:"space.3"}})},c8e={subtle:vd(e=>{var t;return{container:(t=Yg.variants)==null?void 0:t.subtle(e)}}),solid:vd(e=>{var t;return{container:(t=Yg.variants)==null?void 0:t.solid(e)}}),outline:vd(e=>{var t;return{container:(t=Yg.variants)==null?void 0:t.outline(e)}})},d8e=i8e({variants:c8e,baseStyle:l8e,sizes:u8e,defaultProps:{size:"md",variant:"subtle",colorScheme:"gray"}}),{definePartsStyle:Il,defineMultiStyleConfig:f8e}=Pt(UH.keys),Vf=nt("input-height"),Gf=nt("input-font-size"),Hf=nt("input-padding"),qf=nt("input-border-radius"),h8e=Il({addon:{height:Vf.reference,fontSize:Gf.reference,px:Hf.reference,borderRadius:qf.reference},field:{width:"100%",height:Vf.reference,fontSize:Gf.reference,px:Hf.reference,borderRadius:qf.reference,minWidth:0,outline:0,position:"relative",appearance:"none",transitionProperty:"common",transitionDuration:"normal",_disabled:{opacity:.4,cursor:"not-allowed"}}}),cu={lg:{[Gf.variable]:"fontSizes.lg",[Hf.variable]:"space.4",[qf.variable]:"radii.md",[Vf.variable]:"sizes.12"},md:{[Gf.variable]:"fontSizes.md",[Hf.variable]:"space.4",[qf.variable]:"radii.md",[Vf.variable]:"sizes.10"},sm:{[Gf.variable]:"fontSizes.sm",[Hf.variable]:"space.3",[qf.variable]:"radii.sm",[Vf.variable]:"sizes.8"},xs:{[Gf.variable]:"fontSizes.xs",[Hf.variable]:"space.2",[qf.variable]:"radii.sm",[Vf.variable]:"sizes.6"}},p8e={lg:Il({field:cu.lg,group:cu.lg}),md:Il({field:cu.md,group:cu.md}),sm:Il({field:cu.sm,group:cu.sm}),xs:Il({field:cu.xs,group:cu.xs})};function QA(e){const{focusBorderColor:t,errorBorderColor:n}=e;return{focusBorderColor:t||K("blue.500","blue.300")(e),errorBorderColor:n||K("red.500","red.300")(e)}}var g8e=Il(e=>{const{theme:t}=e,{focusBorderColor:n,errorBorderColor:r}=QA(e);return{field:{border:"1px solid",borderColor:"inherit",bg:"inherit",_hover:{borderColor:K("gray.300","whiteAlpha.400")(e)},_readOnly:{boxShadow:"none !important",userSelect:"all"},_invalid:{borderColor:to(t,r),boxShadow:`0 0 0 1px ${to(t,r)}`},_focusVisible:{zIndex:1,borderColor:to(t,n),boxShadow:`0 0 0 1px ${to(t,n)}`}},addon:{border:"1px solid",borderColor:K("inherit","whiteAlpha.50")(e),bg:K("gray.100","whiteAlpha.300")(e)}}}),m8e=Il(e=>{const{theme:t}=e,{focusBorderColor:n,errorBorderColor:r}=QA(e);return{field:{border:"2px solid",borderColor:"transparent",bg:K("gray.100","whiteAlpha.50")(e),_hover:{bg:K("gray.200","whiteAlpha.100")(e)},_readOnly:{boxShadow:"none !important",userSelect:"all"},_invalid:{borderColor:to(t,r)},_focusVisible:{bg:"transparent",borderColor:to(t,n)}},addon:{border:"2px solid",borderColor:"transparent",bg:K("gray.100","whiteAlpha.50")(e)}}}),y8e=Il(e=>{const{theme:t}=e,{focusBorderColor:n,errorBorderColor:r}=QA(e);return{field:{borderBottom:"1px solid",borderColor:"inherit",borderRadius:"0",px:"0",bg:"transparent",_readOnly:{boxShadow:"none !important",userSelect:"all"},_invalid:{borderColor:to(t,r),boxShadow:`0px 1px 0px 0px ${to(t,r)}`},_focusVisible:{borderColor:to(t,n),boxShadow:`0px 1px 0px 0px ${to(t,n)}`}},addon:{borderBottom:"2px solid",borderColor:"inherit",borderRadius:"0",px:"0",bg:"transparent"}}}),v8e=Il({field:{bg:"transparent",px:"0",height:"auto"},addon:{bg:"transparent",px:"0",height:"auto"}}),b8e={outline:g8e,filled:m8e,flushed:y8e,unstyled:v8e},un=f8e({baseStyle:h8e,sizes:p8e,variants:b8e,defaultProps:{size:"md",variant:"outline"}}),SM,_8e={...(SM=un.baseStyle)==null?void 0:SM.field,paddingY:"2",minHeight:"20",lineHeight:"short",verticalAlign:"top"},xM,wM,S8e={outline:e=>{var t,n;return(n=(t=un.variants)==null?void 0:t.outline(e).field)!=null?n:{}},flushed:e=>{var t,n;return(n=(t=un.variants)==null?void 0:t.flushed(e).field)!=null?n:{}},filled:e=>{var t,n;return(n=(t=un.variants)==null?void 0:t.filled(e).field)!=null?n:{}},unstyled:(wM=(xM=un.variants)==null?void 0:xM.unstyled.field)!=null?wM:{}},CM,EM,kM,TM,AM,PM,IM,RM,x8e={xs:(EM=(CM=un.sizes)==null?void 0:CM.xs.field)!=null?EM:{},sm:(TM=(kM=un.sizes)==null?void 0:kM.sm.field)!=null?TM:{},md:(PM=(AM=un.sizes)==null?void 0:AM.md.field)!=null?PM:{},lg:(RM=(IM=un.sizes)==null?void 0:IM.lg.field)!=null?RM:{}},w8e={baseStyle:_8e,sizes:x8e,variants:S8e,defaultProps:{size:"md",variant:"outline"}},Xv=fr("tooltip-bg"),l5=fr("tooltip-fg"),C8e=fr("popper-arrow-bg"),E8e={bg:Xv.reference,color:l5.reference,[Xv.variable]:"colors.gray.700",[l5.variable]:"colors.whiteAlpha.900",_dark:{[Xv.variable]:"colors.gray.300",[l5.variable]:"colors.gray.900"},[C8e.variable]:Xv.reference,px:"2",py:"0.5",borderRadius:"sm",fontWeight:"medium",fontSize:"sm",boxShadow:"md",maxW:"xs",zIndex:"tooltip"},k8e={baseStyle:E8e},{defineMultiStyleConfig:T8e,definePartsStyle:Ag}=Pt(WH.keys),A8e=e=>{const{colorScheme:t,theme:n,isIndeterminate:r,hasStripe:i}=e,o=K(pM(),pM("1rem","rgba(0,0,0,0.1)"))(e),a=K(`${t}.500`,`${t}.200`)(e),s=`linear-gradient( - to right, - transparent 0%, - ${to(n,a)} 50%, - transparent 100% - )`;return{...!r&&i&&o,...r?{bgImage:s}:{bgColor:a}}},P8e={lineHeight:"1",fontSize:"0.25em",fontWeight:"bold",color:"white"},I8e=e=>({bg:K("gray.100","whiteAlpha.300")(e)}),R8e=e=>({transitionProperty:"common",transitionDuration:"slow",...A8e(e)}),O8e=Ag(e=>({label:P8e,filledTrack:R8e(e),track:I8e(e)})),M8e={xs:Ag({track:{h:"1"}}),sm:Ag({track:{h:"2"}}),md:Ag({track:{h:"3"}}),lg:Ag({track:{h:"4"}})},N8e=T8e({sizes:M8e,baseStyle:O8e,defaultProps:{size:"md",colorScheme:"blue"}}),$8e=e=>typeof e=="function";function ro(e,...t){return $8e(e)?e(...t):e}var{definePartsStyle:eb,defineMultiStyleConfig:D8e}=Pt(zH.keys),Zg=nt("checkbox-size"),L8e=e=>{const{colorScheme:t}=e;return{w:Zg.reference,h:Zg.reference,transitionProperty:"box-shadow",transitionDuration:"normal",border:"2px solid",borderRadius:"sm",borderColor:"inherit",color:"white",_checked:{bg:K(`${t}.500`,`${t}.200`)(e),borderColor:K(`${t}.500`,`${t}.200`)(e),color:K("white","gray.900")(e),_hover:{bg:K(`${t}.600`,`${t}.300`)(e),borderColor:K(`${t}.600`,`${t}.300`)(e)},_disabled:{borderColor:K("gray.200","transparent")(e),bg:K("gray.200","whiteAlpha.300")(e),color:K("gray.500","whiteAlpha.500")(e)}},_indeterminate:{bg:K(`${t}.500`,`${t}.200`)(e),borderColor:K(`${t}.500`,`${t}.200`)(e),color:K("white","gray.900")(e)},_disabled:{bg:K("gray.100","whiteAlpha.100")(e),borderColor:K("gray.100","transparent")(e)},_focusVisible:{boxShadow:"outline"},_invalid:{borderColor:K("red.500","red.300")(e)}}},F8e={_disabled:{cursor:"not-allowed"}},B8e={userSelect:"none",_disabled:{opacity:.4}},z8e={transitionProperty:"transform",transitionDuration:"normal"},j8e=eb(e=>({icon:z8e,container:F8e,control:ro(L8e,e),label:B8e})),U8e={sm:eb({control:{[Zg.variable]:"sizes.3"},label:{fontSize:"sm"},icon:{fontSize:"3xs"}}),md:eb({control:{[Zg.variable]:"sizes.4"},label:{fontSize:"md"},icon:{fontSize:"2xs"}}),lg:eb({control:{[Zg.variable]:"sizes.5"},label:{fontSize:"lg"},icon:{fontSize:"2xs"}})},q_=D8e({baseStyle:j8e,sizes:U8e,defaultProps:{size:"md",colorScheme:"blue"}}),{defineMultiStyleConfig:V8e,definePartsStyle:tb}=Pt(GPe.keys),G8e=e=>{var t;const n=(t=ro(q_.baseStyle,e))==null?void 0:t.control;return{...n,borderRadius:"full",_checked:{...n==null?void 0:n._checked,_before:{content:'""',display:"inline-block",pos:"relative",w:"50%",h:"50%",borderRadius:"50%",bg:"currentColor"}}}},H8e=tb(e=>{var t,n,r,i;return{label:(n=(t=q_).baseStyle)==null?void 0:n.call(t,e).label,container:(i=(r=q_).baseStyle)==null?void 0:i.call(r,e).container,control:G8e(e)}}),q8e={md:tb({control:{w:"4",h:"4"},label:{fontSize:"md"}}),lg:tb({control:{w:"5",h:"5"},label:{fontSize:"lg"}}),sm:tb({control:{width:"3",height:"3"},label:{fontSize:"sm"}})},W8e=V8e({baseStyle:H8e,sizes:q8e,defaultProps:{size:"md",colorScheme:"blue"}}),{defineMultiStyleConfig:K8e,definePartsStyle:Q8e}=Pt(KH.keys),Yv=nt("select-bg"),OM,X8e={...(OM=un.baseStyle)==null?void 0:OM.field,appearance:"none",paddingBottom:"1px",lineHeight:"normal",bg:Yv.reference,[Yv.variable]:"colors.white",_dark:{[Yv.variable]:"colors.gray.700"},"> option, > optgroup":{bg:Yv.reference}},Y8e={width:"6",height:"100%",insetEnd:"2",position:"relative",color:"currentColor",fontSize:"xl",_disabled:{opacity:.5}},Z8e=Q8e({field:X8e,icon:Y8e}),Zv={paddingInlineEnd:"8"},MM,NM,$M,DM,LM,FM,BM,zM,J8e={lg:{...(MM=un.sizes)==null?void 0:MM.lg,field:{...(NM=un.sizes)==null?void 0:NM.lg.field,...Zv}},md:{...($M=un.sizes)==null?void 0:$M.md,field:{...(DM=un.sizes)==null?void 0:DM.md.field,...Zv}},sm:{...(LM=un.sizes)==null?void 0:LM.sm,field:{...(FM=un.sizes)==null?void 0:FM.sm.field,...Zv}},xs:{...(BM=un.sizes)==null?void 0:BM.xs,field:{...(zM=un.sizes)==null?void 0:zM.xs.field,...Zv},icon:{insetEnd:"1"}}},eIe=K8e({baseStyle:Z8e,sizes:J8e,variants:un.variants,defaultProps:un.defaultProps}),u5=nt("skeleton-start-color"),c5=nt("skeleton-end-color"),tIe={[u5.variable]:"colors.gray.100",[c5.variable]:"colors.gray.400",_dark:{[u5.variable]:"colors.gray.800",[c5.variable]:"colors.gray.600"},background:u5.reference,borderColor:c5.reference,opacity:.7,borderRadius:"sm"},nIe={baseStyle:tIe},d5=nt("skip-link-bg"),rIe={borderRadius:"md",fontWeight:"semibold",_focusVisible:{boxShadow:"outline",padding:"4",position:"fixed",top:"6",insetStart:"6",[d5.variable]:"colors.white",_dark:{[d5.variable]:"colors.gray.700"},bg:d5.reference}},iIe={baseStyle:rIe},{defineMultiStyleConfig:oIe,definePartsStyle:ow}=Pt(QH.keys),k0=nt("slider-thumb-size"),T0=nt("slider-track-size"),ku=nt("slider-bg"),aIe=e=>{const{orientation:t}=e;return{display:"inline-block",position:"relative",cursor:"pointer",_disabled:{opacity:.6,cursor:"default",pointerEvents:"none"},...KA({orientation:t,vertical:{h:"100%"},horizontal:{w:"100%"}})}},sIe=e=>({...KA({orientation:e.orientation,horizontal:{h:T0.reference},vertical:{w:T0.reference}}),overflow:"hidden",borderRadius:"sm",[ku.variable]:"colors.gray.200",_dark:{[ku.variable]:"colors.whiteAlpha.200"},_disabled:{[ku.variable]:"colors.gray.300",_dark:{[ku.variable]:"colors.whiteAlpha.300"}},bg:ku.reference}),lIe=e=>{const{orientation:t}=e;return{...KA({orientation:t,vertical:{left:"50%",transform:"translateX(-50%)",_active:{transform:"translateX(-50%) scale(1.15)"}},horizontal:{top:"50%",transform:"translateY(-50%)",_active:{transform:"translateY(-50%) scale(1.15)"}}}),w:k0.reference,h:k0.reference,display:"flex",alignItems:"center",justifyContent:"center",position:"absolute",outline:0,zIndex:1,borderRadius:"full",bg:"white",boxShadow:"base",border:"1px solid",borderColor:"transparent",transitionProperty:"transform",transitionDuration:"normal",_focusVisible:{boxShadow:"outline"},_disabled:{bg:"gray.300"}}},uIe=e=>{const{colorScheme:t}=e;return{width:"inherit",height:"inherit",[ku.variable]:`colors.${t}.500`,_dark:{[ku.variable]:`colors.${t}.200`},bg:ku.reference}},cIe=ow(e=>({container:aIe(e),track:sIe(e),thumb:lIe(e),filledTrack:uIe(e)})),dIe=ow({container:{[k0.variable]:"sizes.4",[T0.variable]:"sizes.1"}}),fIe=ow({container:{[k0.variable]:"sizes.3.5",[T0.variable]:"sizes.1"}}),hIe=ow({container:{[k0.variable]:"sizes.2.5",[T0.variable]:"sizes.0.5"}}),pIe={lg:dIe,md:fIe,sm:hIe},gIe=oIe({baseStyle:cIe,sizes:pIe,defaultProps:{size:"md",colorScheme:"blue"}}),Qc=fr("spinner-size"),mIe={width:[Qc.reference],height:[Qc.reference]},yIe={xs:{[Qc.variable]:"sizes.3"},sm:{[Qc.variable]:"sizes.4"},md:{[Qc.variable]:"sizes.6"},lg:{[Qc.variable]:"sizes.8"},xl:{[Qc.variable]:"sizes.12"}},vIe={baseStyle:mIe,sizes:yIe,defaultProps:{size:"md"}},{defineMultiStyleConfig:bIe,definePartsStyle:eq}=Pt(HPe.keys),_Ie={fontWeight:"medium"},SIe={opacity:.8,marginBottom:"2"},xIe={verticalAlign:"baseline",fontWeight:"semibold"},wIe={marginEnd:1,w:"3.5",h:"3.5",verticalAlign:"middle"},CIe=eq({container:{},label:_Ie,helpText:SIe,number:xIe,icon:wIe}),EIe={md:eq({label:{fontSize:"sm"},helpText:{fontSize:"sm"},number:{fontSize:"2xl"}})},kIe=bIe({baseStyle:CIe,sizes:EIe,defaultProps:{size:"md"}}),f5=nt("kbd-bg"),TIe={[f5.variable]:"colors.gray.100",_dark:{[f5.variable]:"colors.whiteAlpha.100"},bg:f5.reference,borderRadius:"md",borderWidth:"1px",borderBottomWidth:"3px",fontSize:"0.8em",fontWeight:"bold",lineHeight:"normal",px:"0.4em",whiteSpace:"nowrap"},AIe={baseStyle:TIe},PIe={transitionProperty:"common",transitionDuration:"fast",transitionTimingFunction:"ease-out",cursor:"pointer",textDecoration:"none",outline:"none",color:"inherit",_hover:{textDecoration:"underline"},_focusVisible:{boxShadow:"outline"}},IIe={baseStyle:PIe},{defineMultiStyleConfig:RIe,definePartsStyle:OIe}=Pt(VPe.keys),MIe={marginEnd:"2",display:"inline",verticalAlign:"text-bottom"},NIe=OIe({icon:MIe}),$Ie=RIe({baseStyle:NIe}),{defineMultiStyleConfig:DIe,definePartsStyle:LIe}=Pt(VH.keys),ws=nt("menu-bg"),h5=nt("menu-shadow"),FIe={[ws.variable]:"#fff",[h5.variable]:"shadows.sm",_dark:{[ws.variable]:"colors.gray.700",[h5.variable]:"shadows.dark-lg"},color:"inherit",minW:"3xs",py:"2",zIndex:1,borderRadius:"md",borderWidth:"1px",bg:ws.reference,boxShadow:h5.reference},BIe={py:"1.5",px:"3",transitionProperty:"background",transitionDuration:"ultra-fast",transitionTimingFunction:"ease-in",_focus:{[ws.variable]:"colors.gray.100",_dark:{[ws.variable]:"colors.whiteAlpha.100"}},_active:{[ws.variable]:"colors.gray.200",_dark:{[ws.variable]:"colors.whiteAlpha.200"}},_expanded:{[ws.variable]:"colors.gray.100",_dark:{[ws.variable]:"colors.whiteAlpha.100"}},_disabled:{opacity:.4,cursor:"not-allowed"},bg:ws.reference},zIe={mx:4,my:2,fontWeight:"semibold",fontSize:"sm"},jIe={display:"inline-flex",alignItems:"center",justifyContent:"center",flexShrink:0},UIe={opacity:.6},VIe={border:0,borderBottom:"1px solid",borderColor:"inherit",my:"2",opacity:.6},GIe={transitionProperty:"common",transitionDuration:"normal"},HIe=LIe({button:GIe,list:FIe,item:BIe,groupTitle:zIe,icon:jIe,command:UIe,divider:VIe}),qIe=DIe({baseStyle:HIe}),{defineMultiStyleConfig:WIe,definePartsStyle:p4}=Pt(GH.keys),p5=nt("modal-bg"),g5=nt("modal-shadow"),KIe={bg:"blackAlpha.600",zIndex:"modal"},QIe=e=>{const{isCentered:t,scrollBehavior:n}=e;return{display:"flex",zIndex:"modal",justifyContent:"center",alignItems:t?"center":"flex-start",overflow:n==="inside"?"hidden":"auto",overscrollBehaviorY:"none"}},XIe=e=>{const{isCentered:t,scrollBehavior:n}=e;return{borderRadius:"md",color:"inherit",my:t?"auto":"16",mx:t?"auto":void 0,zIndex:"modal",maxH:n==="inside"?"calc(100% - 7.5rem)":void 0,[p5.variable]:"colors.white",[g5.variable]:"shadows.lg",_dark:{[p5.variable]:"colors.gray.700",[g5.variable]:"shadows.dark-lg"},bg:p5.reference,boxShadow:g5.reference}},YIe={px:"6",py:"4",fontSize:"xl",fontWeight:"semibold"},ZIe={position:"absolute",top:"2",insetEnd:"3"},JIe=e=>{const{scrollBehavior:t}=e;return{px:"6",py:"2",flex:"1",overflow:t==="inside"?"auto":void 0}},eRe={px:"6",py:"4"},tRe=p4(e=>({overlay:KIe,dialogContainer:ro(QIe,e),dialog:ro(XIe,e),header:YIe,closeButton:ZIe,body:ro(JIe,e),footer:eRe}));function Ba(e){return p4(e==="full"?{dialog:{maxW:"100vw",minH:"$100vh",my:"0",borderRadius:"0"}}:{dialog:{maxW:e}})}var nRe={xs:Ba("xs"),sm:Ba("sm"),md:Ba("md"),lg:Ba("lg"),xl:Ba("xl"),"2xl":Ba("2xl"),"3xl":Ba("3xl"),"4xl":Ba("4xl"),"5xl":Ba("5xl"),"6xl":Ba("6xl"),full:Ba("full")},rRe=WIe({baseStyle:tRe,sizes:nRe,defaultProps:{size:"md"}}),{defineMultiStyleConfig:iRe,definePartsStyle:tq}=Pt(HH.keys),XA=fr("number-input-stepper-width"),nq=fr("number-input-input-padding"),oRe=kl(XA).add("0.5rem").toString(),m5=fr("number-input-bg"),y5=fr("number-input-color"),v5=fr("number-input-border-color"),aRe={[XA.variable]:"sizes.6",[nq.variable]:oRe},sRe=e=>{var t,n;return(n=(t=ro(un.baseStyle,e))==null?void 0:t.field)!=null?n:{}},lRe={width:XA.reference},uRe={borderStart:"1px solid",borderStartColor:v5.reference,color:y5.reference,bg:m5.reference,[y5.variable]:"colors.chakra-body-text",[v5.variable]:"colors.chakra-border-color",_dark:{[y5.variable]:"colors.whiteAlpha.800",[v5.variable]:"colors.whiteAlpha.300"},_active:{[m5.variable]:"colors.gray.200",_dark:{[m5.variable]:"colors.whiteAlpha.300"}},_disabled:{opacity:.4,cursor:"not-allowed"}},cRe=tq(e=>{var t;return{root:aRe,field:(t=ro(sRe,e))!=null?t:{},stepperGroup:lRe,stepper:uRe}});function Jv(e){var t,n,r;const i=(t=un.sizes)==null?void 0:t[e],o={lg:"md",md:"md",sm:"sm",xs:"sm"},a=(r=(n=i.field)==null?void 0:n.fontSize)!=null?r:"md",s=DH.fontSizes[a];return tq({field:{...i.field,paddingInlineEnd:nq.reference,verticalAlign:"top"},stepper:{fontSize:kl(s).multiply(.75).toString(),_first:{borderTopEndRadius:o[e]},_last:{borderBottomEndRadius:o[e],mt:"-1px",borderTopWidth:1}}})}var dRe={xs:Jv("xs"),sm:Jv("sm"),md:Jv("md"),lg:Jv("lg")},fRe=iRe({baseStyle:cRe,sizes:dRe,variants:un.variants,defaultProps:un.defaultProps}),jM,hRe={...(jM=un.baseStyle)==null?void 0:jM.field,textAlign:"center"},pRe={lg:{fontSize:"lg",w:12,h:12,borderRadius:"md"},md:{fontSize:"md",w:10,h:10,borderRadius:"md"},sm:{fontSize:"sm",w:8,h:8,borderRadius:"sm"},xs:{fontSize:"xs",w:6,h:6,borderRadius:"sm"}},UM,VM,gRe={outline:e=>{var t,n,r;return(r=(n=ro((t=un.variants)==null?void 0:t.outline,e))==null?void 0:n.field)!=null?r:{}},flushed:e=>{var t,n,r;return(r=(n=ro((t=un.variants)==null?void 0:t.flushed,e))==null?void 0:n.field)!=null?r:{}},filled:e=>{var t,n,r;return(r=(n=ro((t=un.variants)==null?void 0:t.filled,e))==null?void 0:n.field)!=null?r:{}},unstyled:(VM=(UM=un.variants)==null?void 0:UM.unstyled.field)!=null?VM:{}},mRe={baseStyle:hRe,sizes:pRe,variants:gRe,defaultProps:un.defaultProps},{defineMultiStyleConfig:yRe,definePartsStyle:vRe}=Pt(qH.keys),e1=fr("popper-bg"),bRe=fr("popper-arrow-bg"),GM=fr("popper-arrow-shadow-color"),_Re={zIndex:10},SRe={[e1.variable]:"colors.white",bg:e1.reference,[bRe.variable]:e1.reference,[GM.variable]:"colors.gray.200",_dark:{[e1.variable]:"colors.gray.700",[GM.variable]:"colors.whiteAlpha.300"},width:"xs",border:"1px solid",borderColor:"inherit",borderRadius:"md",boxShadow:"sm",zIndex:"inherit",_focusVisible:{outline:0,boxShadow:"outline"}},xRe={px:3,py:2,borderBottomWidth:"1px"},wRe={px:3,py:2},CRe={px:3,py:2,borderTopWidth:"1px"},ERe={position:"absolute",borderRadius:"md",top:1,insetEnd:2,padding:2},kRe=vRe({popper:_Re,content:SRe,header:xRe,body:wRe,footer:CRe,closeButton:ERe}),TRe=yRe({baseStyle:kRe}),{definePartsStyle:g4,defineMultiStyleConfig:ARe}=Pt(zPe.keys),b5=nt("drawer-bg"),_5=nt("drawer-box-shadow");function _f(e){return g4(e==="full"?{dialog:{maxW:"100vw",h:"100vh"}}:{dialog:{maxW:e}})}var PRe={bg:"blackAlpha.600",zIndex:"overlay"},IRe={display:"flex",zIndex:"modal",justifyContent:"center"},RRe=e=>{const{isFullHeight:t}=e;return{...t&&{height:"100vh"},zIndex:"modal",maxH:"100vh",color:"inherit",[b5.variable]:"colors.white",[_5.variable]:"shadows.lg",_dark:{[b5.variable]:"colors.gray.700",[_5.variable]:"shadows.dark-lg"},bg:b5.reference,boxShadow:_5.reference}},ORe={px:"6",py:"4",fontSize:"xl",fontWeight:"semibold"},MRe={position:"absolute",top:"2",insetEnd:"3"},NRe={px:"6",py:"2",flex:"1",overflow:"auto"},$Re={px:"6",py:"4"},DRe=g4(e=>({overlay:PRe,dialogContainer:IRe,dialog:ro(RRe,e),header:ORe,closeButton:MRe,body:NRe,footer:$Re})),LRe={xs:_f("xs"),sm:_f("md"),md:_f("lg"),lg:_f("2xl"),xl:_f("4xl"),full:_f("full")},FRe=ARe({baseStyle:DRe,sizes:LRe,defaultProps:{size:"xs"}}),{definePartsStyle:BRe,defineMultiStyleConfig:zRe}=Pt(jH.keys),jRe={borderRadius:"md",py:"1",transitionProperty:"common",transitionDuration:"normal"},URe={borderRadius:"md",py:"1",transitionProperty:"common",transitionDuration:"normal",width:"full",_focusVisible:{boxShadow:"outline"},_placeholder:{opacity:.6}},VRe={borderRadius:"md",py:"1",transitionProperty:"common",transitionDuration:"normal",width:"full",_focusVisible:{boxShadow:"outline"},_placeholder:{opacity:.6}},GRe=BRe({preview:jRe,input:URe,textarea:VRe}),HRe=zRe({baseStyle:GRe}),{definePartsStyle:qRe,defineMultiStyleConfig:WRe}=Pt(jPe.keys),xh=nt("form-control-color"),KRe={marginStart:"1",[xh.variable]:"colors.red.500",_dark:{[xh.variable]:"colors.red.300"},color:xh.reference},QRe={mt:"2",[xh.variable]:"colors.gray.600",_dark:{[xh.variable]:"colors.whiteAlpha.600"},color:xh.reference,lineHeight:"normal",fontSize:"sm"},XRe=qRe({container:{width:"100%",position:"relative"},requiredIndicator:KRe,helperText:QRe}),YRe=WRe({baseStyle:XRe}),{definePartsStyle:ZRe,defineMultiStyleConfig:JRe}=Pt(UPe.keys),wh=nt("form-error-color"),e9e={[wh.variable]:"colors.red.500",_dark:{[wh.variable]:"colors.red.300"},color:wh.reference,mt:"2",fontSize:"sm",lineHeight:"normal"},t9e={marginEnd:"0.5em",[wh.variable]:"colors.red.500",_dark:{[wh.variable]:"colors.red.300"},color:wh.reference},n9e=ZRe({text:e9e,icon:t9e}),r9e=JRe({baseStyle:n9e}),i9e={fontSize:"md",marginEnd:"3",mb:"2",fontWeight:"medium",transitionProperty:"common",transitionDuration:"normal",opacity:1,_disabled:{opacity:.4}},o9e={baseStyle:i9e},a9e={fontFamily:"heading",fontWeight:"bold"},s9e={"4xl":{fontSize:["6xl",null,"7xl"],lineHeight:1},"3xl":{fontSize:["5xl",null,"6xl"],lineHeight:1},"2xl":{fontSize:["4xl",null,"5xl"],lineHeight:[1.2,null,1]},xl:{fontSize:["3xl",null,"4xl"],lineHeight:[1.33,null,1.2]},lg:{fontSize:["2xl",null,"3xl"],lineHeight:[1.33,null,1.2]},md:{fontSize:"xl",lineHeight:1.2},sm:{fontSize:"md",lineHeight:1.2},xs:{fontSize:"sm",lineHeight:1.2}},l9e={baseStyle:a9e,sizes:s9e,defaultProps:{size:"xl"}},{defineMultiStyleConfig:u9e,definePartsStyle:c9e}=Pt(BPe.keys),S5=nt("breadcrumb-link-decor"),d9e={transitionProperty:"common",transitionDuration:"fast",transitionTimingFunction:"ease-out",outline:"none",color:"inherit",textDecoration:S5.reference,[S5.variable]:"none","&:not([aria-current=page])":{cursor:"pointer",_hover:{[S5.variable]:"underline"},_focusVisible:{boxShadow:"outline"}}},f9e=c9e({link:d9e}),h9e=u9e({baseStyle:f9e}),p9e={lineHeight:"1.2",borderRadius:"md",fontWeight:"semibold",transitionProperty:"common",transitionDuration:"normal",_focusVisible:{boxShadow:"outline"},_disabled:{opacity:.4,cursor:"not-allowed",boxShadow:"none"},_hover:{_disabled:{bg:"initial"}}},rq=e=>{const{colorScheme:t,theme:n}=e;if(t==="gray")return{color:K("gray.800","whiteAlpha.900")(e),_hover:{bg:K("gray.100","whiteAlpha.200")(e)},_active:{bg:K("gray.200","whiteAlpha.300")(e)}};const r=ap(`${t}.200`,.12)(n),i=ap(`${t}.200`,.24)(n);return{color:K(`${t}.600`,`${t}.200`)(e),bg:"transparent",_hover:{bg:K(`${t}.50`,r)(e)},_active:{bg:K(`${t}.100`,i)(e)}}},g9e=e=>{const{colorScheme:t}=e,n=K("gray.200","whiteAlpha.300")(e);return{border:"1px solid",borderColor:t==="gray"?n:"currentColor",".chakra-button__group[data-attached][data-orientation=horizontal] > &:not(:last-of-type)":{marginEnd:"-1px"},".chakra-button__group[data-attached][data-orientation=vertical] > &:not(:last-of-type)":{marginBottom:"-1px"},...ro(rq,e)}},m9e={yellow:{bg:"yellow.400",color:"black",hoverBg:"yellow.500",activeBg:"yellow.600"},cyan:{bg:"cyan.400",color:"black",hoverBg:"cyan.500",activeBg:"cyan.600"}},y9e=e=>{var t;const{colorScheme:n}=e;if(n==="gray"){const l=K("gray.100","whiteAlpha.200")(e);return{bg:l,color:K("gray.800","whiteAlpha.900")(e),_hover:{bg:K("gray.200","whiteAlpha.300")(e),_disabled:{bg:l}},_active:{bg:K("gray.300","whiteAlpha.400")(e)}}}const{bg:r=`${n}.500`,color:i="white",hoverBg:o=`${n}.600`,activeBg:a=`${n}.700`}=(t=m9e[n])!=null?t:{},s=K(r,`${n}.200`)(e);return{bg:s,color:K(i,"gray.800")(e),_hover:{bg:K(o,`${n}.300`)(e),_disabled:{bg:s}},_active:{bg:K(a,`${n}.400`)(e)}}},v9e=e=>{const{colorScheme:t}=e;return{padding:0,height:"auto",lineHeight:"normal",verticalAlign:"baseline",color:K(`${t}.500`,`${t}.200`)(e),_hover:{textDecoration:"underline",_disabled:{textDecoration:"none"}},_active:{color:K(`${t}.700`,`${t}.500`)(e)}}},b9e={bg:"none",color:"inherit",display:"inline",lineHeight:"inherit",m:"0",p:"0"},_9e={ghost:rq,outline:g9e,solid:y9e,link:v9e,unstyled:b9e},S9e={lg:{h:"12",minW:"12",fontSize:"lg",px:"6"},md:{h:"10",minW:"10",fontSize:"md",px:"4"},sm:{h:"8",minW:"8",fontSize:"sm",px:"3"},xs:{h:"6",minW:"6",fontSize:"xs",px:"2"}},x9e={baseStyle:p9e,variants:_9e,sizes:S9e,defaultProps:{variant:"solid",size:"md",colorScheme:"gray"}},{definePartsStyle:bd,defineMultiStyleConfig:w9e}=Pt(KPe.keys),W_=nt("card-bg"),$l=nt("card-padding"),iq=nt("card-shadow"),nb=nt("card-radius"),oq=nt("card-border-width","0"),aq=nt("card-border-color"),C9e=bd({container:{[W_.variable]:"colors.chakra-body-bg",backgroundColor:W_.reference,boxShadow:iq.reference,borderRadius:nb.reference,color:"chakra-body-text",borderWidth:oq.reference,borderColor:aq.reference},body:{padding:$l.reference,flex:"1 1 0%"},header:{padding:$l.reference},footer:{padding:$l.reference}}),E9e={sm:bd({container:{[nb.variable]:"radii.base",[$l.variable]:"space.3"}}),md:bd({container:{[nb.variable]:"radii.md",[$l.variable]:"space.5"}}),lg:bd({container:{[nb.variable]:"radii.xl",[$l.variable]:"space.7"}})},k9e={elevated:bd({container:{[iq.variable]:"shadows.base",_dark:{[W_.variable]:"colors.gray.700"}}}),outline:bd({container:{[oq.variable]:"1px",[aq.variable]:"colors.chakra-border-color"}}),filled:bd({container:{[W_.variable]:"colors.chakra-subtle-bg"}}),unstyled:{body:{[$l.variable]:0},header:{[$l.variable]:0},footer:{[$l.variable]:0}}},T9e=w9e({baseStyle:C9e,variants:k9e,sizes:E9e,defaultProps:{variant:"elevated",size:"md"}}),Jg=fr("close-button-size"),ag=fr("close-button-bg"),A9e={w:[Jg.reference],h:[Jg.reference],borderRadius:"md",transitionProperty:"common",transitionDuration:"normal",_disabled:{opacity:.4,cursor:"not-allowed",boxShadow:"none"},_hover:{[ag.variable]:"colors.blackAlpha.100",_dark:{[ag.variable]:"colors.whiteAlpha.100"}},_active:{[ag.variable]:"colors.blackAlpha.200",_dark:{[ag.variable]:"colors.whiteAlpha.200"}},_focusVisible:{boxShadow:"outline"},bg:ag.reference},P9e={lg:{[Jg.variable]:"sizes.10",fontSize:"md"},md:{[Jg.variable]:"sizes.8",fontSize:"xs"},sm:{[Jg.variable]:"sizes.6",fontSize:"2xs"}},I9e={baseStyle:A9e,sizes:P9e,defaultProps:{size:"md"}},{variants:R9e,defaultProps:O9e}=Yg,M9e={fontFamily:"mono",fontSize:"sm",px:"0.2em",borderRadius:"sm",bg:Er.bg.reference,color:Er.color.reference,boxShadow:Er.shadow.reference},N9e={baseStyle:M9e,variants:R9e,defaultProps:O9e},$9e={w:"100%",mx:"auto",maxW:"prose",px:"4"},D9e={baseStyle:$9e},L9e={opacity:.6,borderColor:"inherit"},F9e={borderStyle:"solid"},B9e={borderStyle:"dashed"},z9e={solid:F9e,dashed:B9e},j9e={baseStyle:L9e,variants:z9e,defaultProps:{variant:"solid"}},{definePartsStyle:U9e,defineMultiStyleConfig:V9e}=Pt(BH.keys),G9e={borderTopWidth:"1px",borderColor:"inherit",_last:{borderBottomWidth:"1px"}},H9e={transitionProperty:"common",transitionDuration:"normal",fontSize:"md",_focusVisible:{boxShadow:"outline"},_hover:{bg:"blackAlpha.50"},_disabled:{opacity:.4,cursor:"not-allowed"},px:"4",py:"2"},q9e={pt:"2",px:"4",pb:"5"},W9e={fontSize:"1.25em"},K9e=U9e({container:G9e,button:H9e,panel:q9e,icon:W9e}),Q9e=V9e({baseStyle:K9e}),{definePartsStyle:Ry,defineMultiStyleConfig:X9e}=Pt(LPe.keys),Qo=nt("alert-fg"),Wl=nt("alert-bg"),Y9e=Ry({container:{bg:Wl.reference,px:"4",py:"3"},title:{fontWeight:"bold",lineHeight:"6",marginEnd:"2"},description:{lineHeight:"6"},icon:{color:Qo.reference,flexShrink:0,marginEnd:"3",w:"5",h:"6"},spinner:{color:Qo.reference,flexShrink:0,marginEnd:"3",w:"5",h:"5"}});function YA(e){const{theme:t,colorScheme:n}=e,r=ap(`${n}.200`,.16)(t);return{light:`colors.${n}.100`,dark:r}}var Z9e=Ry(e=>{const{colorScheme:t}=e,n=YA(e);return{container:{[Qo.variable]:`colors.${t}.500`,[Wl.variable]:n.light,_dark:{[Qo.variable]:`colors.${t}.200`,[Wl.variable]:n.dark}}}}),J9e=Ry(e=>{const{colorScheme:t}=e,n=YA(e);return{container:{[Qo.variable]:`colors.${t}.500`,[Wl.variable]:n.light,_dark:{[Qo.variable]:`colors.${t}.200`,[Wl.variable]:n.dark},paddingStart:"3",borderStartWidth:"4px",borderStartColor:Qo.reference}}}),eOe=Ry(e=>{const{colorScheme:t}=e,n=YA(e);return{container:{[Qo.variable]:`colors.${t}.500`,[Wl.variable]:n.light,_dark:{[Qo.variable]:`colors.${t}.200`,[Wl.variable]:n.dark},pt:"2",borderTopWidth:"4px",borderTopColor:Qo.reference}}}),tOe=Ry(e=>{const{colorScheme:t}=e;return{container:{[Qo.variable]:"colors.white",[Wl.variable]:`colors.${t}.500`,_dark:{[Qo.variable]:"colors.gray.900",[Wl.variable]:`colors.${t}.200`},color:Qo.reference}}}),nOe={subtle:Z9e,"left-accent":J9e,"top-accent":eOe,solid:tOe},rOe=X9e({baseStyle:Y9e,variants:nOe,defaultProps:{variant:"subtle",colorScheme:"blue"}}),{definePartsStyle:sq,defineMultiStyleConfig:iOe}=Pt(FPe.keys),Ch=nt("avatar-border-color"),em=nt("avatar-bg"),A0=nt("avatar-font-size"),sp=nt("avatar-size"),oOe={borderRadius:"full",border:"0.2em solid",borderColor:Ch.reference,[Ch.variable]:"white",_dark:{[Ch.variable]:"colors.gray.800"}},aOe={bg:em.reference,fontSize:A0.reference,width:sp.reference,height:sp.reference,lineHeight:"1",[em.variable]:"colors.gray.200",_dark:{[em.variable]:"colors.whiteAlpha.400"}},sOe=e=>{const{name:t,theme:n}=e,r=t?p6e({string:t}):"colors.gray.400",i=f6e(r)(n);let o="white";return i||(o="gray.800"),{bg:em.reference,fontSize:A0.reference,color:o,borderColor:Ch.reference,verticalAlign:"top",width:sp.reference,height:sp.reference,"&:not([data-loaded])":{[em.variable]:r},[Ch.variable]:"colors.white",_dark:{[Ch.variable]:"colors.gray.800"}}},lOe={fontSize:A0.reference,lineHeight:"1"},uOe=sq(e=>({badge:ro(oOe,e),excessLabel:ro(aOe,e),container:ro(sOe,e),label:lOe}));function du(e){const t=e!=="100%"?FH[e]:void 0;return sq({container:{[sp.variable]:t??e,[A0.variable]:`calc(${t??e} / 2.5)`},excessLabel:{[sp.variable]:t??e,[A0.variable]:`calc(${t??e} / 2.5)`}})}var cOe={"2xs":du(4),xs:du(6),sm:du(8),md:du(12),lg:du(16),xl:du(24),"2xl":du(32),full:du("100%")},dOe=iOe({baseStyle:uOe,sizes:cOe,defaultProps:{size:"md"}}),fOe={Accordion:Q9e,Alert:rOe,Avatar:dOe,Badge:Yg,Breadcrumb:h9e,Button:x9e,Checkbox:q_,CloseButton:I9e,Code:N9e,Container:D9e,Divider:j9e,Drawer:FRe,Editable:HRe,Form:YRe,FormError:r9e,FormLabel:o9e,Heading:l9e,Input:un,Kbd:AIe,Link:IIe,List:$Ie,Menu:qIe,Modal:rRe,NumberInput:fRe,PinInput:mRe,Popover:TRe,Progress:N8e,Radio:W8e,Select:eIe,Skeleton:nIe,SkipLink:iIe,Slider:gIe,Spinner:vIe,Stat:kIe,Switch:I6e,Table:L6e,Tabs:Z6e,Tag:d8e,Textarea:w8e,Tooltip:k8e,Card:T9e,Stepper:DPe},hOe={colors:{"chakra-body-text":{_light:"gray.800",_dark:"whiteAlpha.900"},"chakra-body-bg":{_light:"white",_dark:"gray.800"},"chakra-border-color":{_light:"gray.200",_dark:"whiteAlpha.300"},"chakra-inverse-text":{_light:"white",_dark:"gray.800"},"chakra-subtle-bg":{_light:"gray.100",_dark:"gray.700"},"chakra-subtle-text":{_light:"gray.600",_dark:"gray.400"},"chakra-placeholder-color":{_light:"gray.500",_dark:"whiteAlpha.400"}}},pOe={global:{body:{fontFamily:"body",color:"chakra-body-text",bg:"chakra-body-bg",transitionProperty:"background-color",transitionDuration:"normal",lineHeight:"base"},"*::placeholder":{color:"chakra-placeholder-color"},"*, *::before, &::after":{borderColor:"chakra-border-color"}}},gOe="ltr",mOe={useSystemColorMode:!1,initialColorMode:"light",cssVarPrefix:"chakra"},yOe={semanticTokens:hOe,direction:gOe,...MPe,components:fOe,styles:pOe,config:mOe},vOe=yOe;function bOe(e,t){const n={};return Object.keys(e).forEach(r=>{t.includes(r)||(n[r]=e[r])}),n}function _Oe(e,t,n,r){const i=typeof t=="string"?t.split("."):[t];for(r=0;r{const t=new WeakMap;return(r,i,o,a)=>{if(typeof r>"u")return e(r,i,o);t.has(r)||t.set(r,new Map);const s=t.get(r);if(s.has(i))return s.get(i);const l=e(r,i,o,a);return s.set(i,l),l}},lq=SOe(_Oe);function uq(e,t){const n={};return Object.keys(e).forEach(r=>{const i=e[r];t(i,r,e)&&(n[r]=i)}),n}var cq=e=>uq(e,t=>t!=null);function xOe(e){return typeof e=="function"}function dq(e,...t){return xOe(e)?e(...t):e}function IKe(...e){return function(n){e.some(r=>(r==null||r(n),n==null?void 0:n.defaultPrevented))}}var wOe=typeof Element<"u",COe=typeof Map=="function",EOe=typeof Set=="function",kOe=typeof ArrayBuffer=="function"&&!!ArrayBuffer.isView;function rb(e,t){if(e===t)return!0;if(e&&t&&typeof e=="object"&&typeof t=="object"){if(e.constructor!==t.constructor)return!1;var n,r,i;if(Array.isArray(e)){if(n=e.length,n!=t.length)return!1;for(r=n;r--!==0;)if(!rb(e[r],t[r]))return!1;return!0}var o;if(COe&&e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(o=e.entries();!(r=o.next()).done;)if(!t.has(r.value[0]))return!1;for(o=e.entries();!(r=o.next()).done;)if(!rb(r.value[1],t.get(r.value[0])))return!1;return!0}if(EOe&&e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(o=e.entries();!(r=o.next()).done;)if(!t.has(r.value[0]))return!1;return!0}if(kOe&&ArrayBuffer.isView(e)&&ArrayBuffer.isView(t)){if(n=e.length,n!=t.length)return!1;for(r=n;r--!==0;)if(e[r]!==t[r])return!1;return!0}if(e.constructor===RegExp)return e.source===t.source&&e.flags===t.flags;if(e.valueOf!==Object.prototype.valueOf&&typeof e.valueOf=="function"&&typeof t.valueOf=="function")return e.valueOf()===t.valueOf();if(e.toString!==Object.prototype.toString&&typeof e.toString=="function"&&typeof t.toString=="function")return e.toString()===t.toString();if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!Object.prototype.hasOwnProperty.call(t,i[r]))return!1;if(wOe&&e instanceof Element)return!1;for(r=n;r--!==0;)if(!((i[r]==="_owner"||i[r]==="__v"||i[r]==="__o")&&e.$$typeof)&&!rb(e[i[r]],t[i[r]]))return!1;return!0}return e!==e&&t!==t}var TOe=function(t,n){try{return rb(t,n)}catch(r){if((r.message||"").match(/stack|recursion/i))return console.warn("react-fast-compare cannot handle circular refs"),!1;throw r}};const AOe=pc(TOe);function fq(e,t={}){var n;const{styleConfig:r,...i}=t,{theme:o,colorMode:a}=UTe(),s=e?lq(o,`components.${e}`):void 0,l=r||s,u=Ds({theme:o,colorMode:a},(n=l==null?void 0:l.defaultProps)!=null?n:{},cq(bOe(i,["children"]))),c=I.useRef({});if(l){const f=uPe(l)(u);AOe(c.current,f)||(c.current=f)}return c.current}function Oy(e,t={}){return fq(e,t)}function POe(e,t={}){return fq(e,t)}var IOe=new Set([...YAe,"textStyle","layerStyle","apply","noOfLines","focusBorderColor","errorBorderColor","as","__css","css","sx"]),ROe=new Set(["htmlWidth","htmlHeight","htmlSize","htmlTranslate"]);function OOe(e){return ROe.has(e)||!IOe.has(e)}function MOe(e,...t){if(e==null)throw new TypeError("Cannot convert undefined or null to object");const n={...e};for(const r of t)if(r!=null)for(const i in r)Object.prototype.hasOwnProperty.call(r,i)&&(i in n&&delete n[i],n[i]=r[i]);return n}function NOe(e){const t=Object.assign({},e);for(let n in t)t[n]===void 0&&delete t[n];return t}var $Oe=/^((children|dangerouslySetInnerHTML|key|ref|autoFocus|defaultValue|defaultChecked|innerHTML|suppressContentEditableWarning|suppressHydrationWarning|valueLink|abbr|accept|acceptCharset|accessKey|action|allow|allowUserMedia|allowPaymentRequest|allowFullScreen|allowTransparency|alt|async|autoComplete|autoPlay|capture|cellPadding|cellSpacing|challenge|charSet|checked|cite|classID|className|cols|colSpan|content|contentEditable|contextMenu|controls|controlsList|coords|crossOrigin|data|dateTime|decoding|default|defer|dir|disabled|disablePictureInPicture|download|draggable|encType|enterKeyHint|form|formAction|formEncType|formMethod|formNoValidate|formTarget|frameBorder|headers|height|hidden|high|href|hrefLang|htmlFor|httpEquiv|id|inputMode|integrity|is|keyParams|keyType|kind|label|lang|list|loading|loop|low|marginHeight|marginWidth|max|maxLength|media|mediaGroup|method|min|minLength|multiple|muted|name|nonce|noValidate|open|optimum|pattern|placeholder|playsInline|poster|preload|profile|radioGroup|readOnly|referrerPolicy|rel|required|reversed|role|rows|rowSpan|sandbox|scope|scoped|scrolling|seamless|selected|shape|size|sizes|slot|span|spellCheck|src|srcDoc|srcLang|srcSet|start|step|style|summary|tabIndex|target|title|translate|type|useMap|value|width|wmode|wrap|about|datatype|inlist|prefix|property|resource|typeof|vocab|autoCapitalize|autoCorrect|autoSave|color|incremental|fallback|inert|itemProp|itemScope|itemType|itemID|itemRef|on|option|results|security|unselectable|accentHeight|accumulate|additive|alignmentBaseline|allowReorder|alphabetic|amplitude|arabicForm|ascent|attributeName|attributeType|autoReverse|azimuth|baseFrequency|baselineShift|baseProfile|bbox|begin|bias|by|calcMode|capHeight|clip|clipPathUnits|clipPath|clipRule|colorInterpolation|colorInterpolationFilters|colorProfile|colorRendering|contentScriptType|contentStyleType|cursor|cx|cy|d|decelerate|descent|diffuseConstant|direction|display|divisor|dominantBaseline|dur|dx|dy|edgeMode|elevation|enableBackground|end|exponent|externalResourcesRequired|fill|fillOpacity|fillRule|filter|filterRes|filterUnits|floodColor|floodOpacity|focusable|fontFamily|fontSize|fontSizeAdjust|fontStretch|fontStyle|fontVariant|fontWeight|format|from|fr|fx|fy|g1|g2|glyphName|glyphOrientationHorizontal|glyphOrientationVertical|glyphRef|gradientTransform|gradientUnits|hanging|horizAdvX|horizOriginX|ideographic|imageRendering|in|in2|intercept|k|k1|k2|k3|k4|kernelMatrix|kernelUnitLength|kerning|keyPoints|keySplines|keyTimes|lengthAdjust|letterSpacing|lightingColor|limitingConeAngle|local|markerEnd|markerMid|markerStart|markerHeight|markerUnits|markerWidth|mask|maskContentUnits|maskUnits|mathematical|mode|numOctaves|offset|opacity|operator|order|orient|orientation|origin|overflow|overlinePosition|overlineThickness|panose1|paintOrder|pathLength|patternContentUnits|patternTransform|patternUnits|pointerEvents|points|pointsAtX|pointsAtY|pointsAtZ|preserveAlpha|preserveAspectRatio|primitiveUnits|r|radius|refX|refY|renderingIntent|repeatCount|repeatDur|requiredExtensions|requiredFeatures|restart|result|rotate|rx|ry|scale|seed|shapeRendering|slope|spacing|specularConstant|specularExponent|speed|spreadMethod|startOffset|stdDeviation|stemh|stemv|stitchTiles|stopColor|stopOpacity|strikethroughPosition|strikethroughThickness|string|stroke|strokeDasharray|strokeDashoffset|strokeLinecap|strokeLinejoin|strokeMiterlimit|strokeOpacity|strokeWidth|surfaceScale|systemLanguage|tableValues|targetX|targetY|textAnchor|textDecoration|textRendering|textLength|to|transform|u1|u2|underlinePosition|underlineThickness|unicode|unicodeBidi|unicodeRange|unitsPerEm|vAlphabetic|vHanging|vIdeographic|vMathematical|values|vectorEffect|version|vertAdvY|vertOriginX|vertOriginY|viewBox|viewTarget|visibility|widths|wordSpacing|writingMode|x|xHeight|x1|x2|xChannelSelector|xlinkActuate|xlinkArcrole|xlinkHref|xlinkRole|xlinkShow|xlinkTitle|xlinkType|xmlBase|xmlns|xmlnsXlink|xmlLang|xmlSpace|y|y1|y2|yChannelSelector|z|zoomAndPan|for|class|autofocus)|(([Dd][Aa][Tt][Aa]|[Aa][Rr][Ii][Aa]|x)-.*))$/,DOe=vH(function(e){return $Oe.test(e)||e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&e.charCodeAt(2)<91}),LOe=DOe,FOe=function(t){return t!=="theme"},HM=function(t){return typeof t=="string"&&t.charCodeAt(0)>96?LOe:FOe},qM=function(t,n,r){var i;if(n){var o=n.shouldForwardProp;i=t.__emotion_forwardProp&&o?function(a){return t.__emotion_forwardProp(a)&&o(a)}:o}return typeof i!="function"&&r&&(i=t.__emotion_forwardProp),i},BOe=function(t){var n=t.cache,r=t.serialized,i=t.isStringTag;return _H(n,r,i),TTe(function(){return SH(n,r,i)}),null},zOe=function e(t,n){var r=t.__emotion_real===t,i=r&&t.__emotion_base||t,o,a;n!==void 0&&(o=n.label,a=n.target);var s=qM(t,n,r),l=s||HM(i),u=!l("as");return function(){var c=arguments,d=r&&t.__emotion_styles!==void 0?t.__emotion_styles.slice(0):[];if(o!==void 0&&d.push("label:"+o+";"),c[0]==null||c[0].raw===void 0)d.push.apply(d,c);else{d.push(c[0][0]);for(var f=c.length,h=1;ht=>{const{theme:n,css:r,__css:i,sx:o,...a}=t,s=uq(a,(d,f)=>JAe(f)),l=dq(e,t),u=MOe({},i,l,cq(s),o),c=$H(u)(t.theme);return r?[c,r]:c};function x5(e,t){const{baseStyle:n,...r}=t??{};r.shouldForwardProp||(r.shouldForwardProp=OOe);const i=VOe({baseStyle:n}),o=UOe(e,r)(i);return En.forwardRef(function(l,u){const{colorMode:c,forced:d}=tw();return En.createElement(o,{ref:u,"data-theme":d?c:void 0,...l})})}function GOe(){const e=new Map;return new Proxy(x5,{apply(t,n,r){return x5(...r)},get(t,n){return e.has(n)||e.set(n,x5(n)),e.get(n)}})}var Oi=GOe();function ra(e){return I.forwardRef(e)}function HOe(e={}){const{strict:t=!0,errorMessage:n="useContext: `context` is undefined. Seems you forgot to wrap component within the Provider",name:r}=e,i=I.createContext(void 0);i.displayName=r;function o(){var a;const s=I.useContext(i);if(!s&&t){const l=new Error(n);throw l.name="ContextError",(a=Error.captureStackTrace)==null||a.call(Error,l,o),l}return s}return[i.Provider,o,i]}function qOe(e){const{cssVarsRoot:t,theme:n,children:r}=e,i=I.useMemo(()=>QAe(n),[n]);return W.jsxs(ITe,{theme:i,children:[W.jsx(WOe,{root:t}),r]})}function WOe({root:e=":host, :root"}){const t=[e,"[data-theme]"].join(",");return W.jsx(kH,{styles:n=>({[t]:n.__cssVars})})}HOe({name:"StylesContext",errorMessage:"useStyles: `styles` is undefined. Seems you forgot to wrap the components in `` "});function RKe(){const{colorMode:e}=tw();return W.jsx(kH,{styles:t=>{const n=lq(t,"styles.global"),r=dq(n,{theme:t,colorMode:e});return r?$H(r)(t):void 0}})}var KOe=(e,t)=>e.find(n=>n.id===t);function KM(e,t){const n=hq(e,t),r=n?e[n].findIndex(i=>i.id===t):-1;return{position:n,index:r}}function hq(e,t){for(const[n,r]of Object.entries(e))if(KOe(r,t))return n}function QOe(e){const t=e.includes("right"),n=e.includes("left");let r="center";return t&&(r="flex-end"),n&&(r="flex-start"),{display:"flex",flexDirection:"column",alignItems:r}}function XOe(e){const n=e==="top"||e==="bottom"?"0 auto":void 0,r=e.includes("top")?"env(safe-area-inset-top, 0px)":void 0,i=e.includes("bottom")?"env(safe-area-inset-bottom, 0px)":void 0,o=e.includes("left")?void 0:"env(safe-area-inset-right, 0px)",a=e.includes("right")?void 0:"env(safe-area-inset-left, 0px)";return{position:"fixed",zIndex:"var(--toast-z-index, 5500)",pointerEvents:"none",display:"flex",flexDirection:"column",margin:n,top:r,bottom:i,right:o,left:a}}function YOe(e,t=[]){const n=I.useRef(e);return I.useEffect(()=>{n.current=e}),I.useCallback((...r)=>{var i;return(i=n.current)==null?void 0:i.call(n,...r)},t)}function ZOe(e,t){const n=YOe(e);I.useEffect(()=>{if(t==null)return;let r=null;return r=window.setTimeout(()=>{n()},t),()=>{r&&window.clearTimeout(r)}},[t,n])}function QM(e,t){const n=I.useRef(!1),r=I.useRef(!1);I.useEffect(()=>{if(n.current&&r.current)return e();r.current=!0},t),I.useEffect(()=>(n.current=!0,()=>{n.current=!1}),[])}const pq=I.createContext({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"}),aw=I.createContext({}),My=I.createContext(null),sw=typeof document<"u",ZA=sw?I.useLayoutEffect:I.useEffect,gq=I.createContext({strict:!1});function JOe(e,t,n,r){const{visualElement:i}=I.useContext(aw),o=I.useContext(gq),a=I.useContext(My),s=I.useContext(pq).reducedMotion,l=I.useRef();r=r||o.renderer,!l.current&&r&&(l.current=r(e,{visualState:t,parent:i,props:n,presenceContext:a,blockInitialAnimation:a?a.initial===!1:!1,reducedMotionConfig:s}));const u=l.current;I.useInsertionEffect(()=>{u&&u.update(n,a)});const c=I.useRef(!!window.HandoffAppearAnimations);return ZA(()=>{u&&(u.render(),c.current&&u.animationState&&u.animationState.animateChanges())}),I.useEffect(()=>{u&&(u.updateFeatures(),!c.current&&u.animationState&&u.animationState.animateChanges(),window.HandoffAppearAnimations=void 0,c.current=!1)}),u}function Wf(e){return typeof e=="object"&&Object.prototype.hasOwnProperty.call(e,"current")}function eMe(e,t,n){return I.useCallback(r=>{r&&e.mount&&e.mount(r),t&&(r?t.mount(r):t.unmount()),n&&(typeof n=="function"?n(r):Wf(n)&&(n.current=r))},[t])}function P0(e){return typeof e=="string"||Array.isArray(e)}function lw(e){return typeof e=="object"&&typeof e.start=="function"}const JA=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],eP=["initial",...JA];function uw(e){return lw(e.animate)||eP.some(t=>P0(e[t]))}function mq(e){return!!(uw(e)||e.variants)}function tMe(e,t){if(uw(e)){const{initial:n,animate:r}=e;return{initial:n===!1||P0(n)?n:void 0,animate:P0(r)?r:void 0}}return e.inherit!==!1?t:{}}function nMe(e){const{initial:t,animate:n}=tMe(e,I.useContext(aw));return I.useMemo(()=>({initial:t,animate:n}),[XM(t),XM(n)])}function XM(e){return Array.isArray(e)?e.join(" "):e}const YM={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]},I0={};for(const e in YM)I0[e]={isEnabled:t=>YM[e].some(n=>!!t[n])};function rMe(e){for(const t in e)I0[t]={...I0[t],...e[t]}}const tP=I.createContext({}),yq=I.createContext({}),iMe=Symbol.for("motionComponentSymbol");function oMe({preloadedFeatures:e,createVisualElement:t,useRender:n,useVisualState:r,Component:i}){e&&rMe(e);function o(s,l){let u;const c={...I.useContext(pq),...s,layoutId:aMe(s)},{isStatic:d}=c,f=nMe(s),h=r(s,d);if(!d&&sw){f.visualElement=JOe(i,h,c,t);const p=I.useContext(yq),m=I.useContext(gq).strict;f.visualElement&&(u=f.visualElement.loadFeatures(c,m,e,p))}return I.createElement(aw.Provider,{value:f},u&&f.visualElement?I.createElement(u,{visualElement:f.visualElement,...c}):null,n(i,s,eMe(h,f.visualElement,l),h,d,f.visualElement))}const a=I.forwardRef(o);return a[iMe]=i,a}function aMe({layoutId:e}){const t=I.useContext(tP).id;return t&&e!==void 0?t+"-"+e:e}function sMe(e){function t(r,i={}){return oMe(e(r,i))}if(typeof Proxy>"u")return t;const n=new Map;return new Proxy(t,{get:(r,i)=>(n.has(i)||n.set(i,t(i)),n.get(i))})}const lMe=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function nP(e){return typeof e!="string"||e.includes("-")?!1:!!(lMe.indexOf(e)>-1||/[A-Z]/.test(e))}const Q_={};function uMe(e){Object.assign(Q_,e)}const Ny=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],Jd=new Set(Ny);function vq(e,{layout:t,layoutId:n}){return Jd.has(e)||e.startsWith("origin")||(t||n!==void 0)&&(!!Q_[e]||e==="opacity")}const Mo=e=>!!(e&&e.getVelocity),cMe={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},dMe=Ny.length;function fMe(e,{enableHardwareAcceleration:t=!0,allowTransformNone:n=!0},r,i){let o="";for(let a=0;at=>typeof t=="string"&&t.startsWith(e),_q=bq("--"),m4=bq("var(--"),hMe=/var\s*\(\s*--[\w-]+(\s*,\s*(?:(?:[^)(]|\((?:[^)(]+|\([^)(]*\))*\))*)+)?\s*\)/g,pMe=(e,t)=>t&&typeof e=="number"?t.transform(e):e,fc=(e,t,n)=>Math.min(Math.max(n,e),t),ef={test:e=>typeof e=="number",parse:parseFloat,transform:e=>e},tm={...ef,transform:e=>fc(0,1,e)},t1={...ef,default:1},nm=e=>Math.round(e*1e5)/1e5,cw=/(-)?([\d]*\.?[\d])+/g,Sq=/(#[0-9a-f]{3,8}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2}(-?[\d\.]+%?)\s*[\,\/]?\s*[\d\.]*%?\))/gi,gMe=/^(#[0-9a-f]{3,8}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2}(-?[\d\.]+%?)\s*[\,\/]?\s*[\d\.]*%?\))$/i;function $y(e){return typeof e=="string"}const Dy=e=>({test:t=>$y(t)&&t.endsWith(e)&&t.split(" ").length===1,parse:parseFloat,transform:t=>`${t}${e}`}),hu=Dy("deg"),Ws=Dy("%"),at=Dy("px"),mMe=Dy("vh"),yMe=Dy("vw"),ZM={...Ws,parse:e=>Ws.parse(e)/100,transform:e=>Ws.transform(e*100)},JM={...ef,transform:Math.round},xq={borderWidth:at,borderTopWidth:at,borderRightWidth:at,borderBottomWidth:at,borderLeftWidth:at,borderRadius:at,radius:at,borderTopLeftRadius:at,borderTopRightRadius:at,borderBottomRightRadius:at,borderBottomLeftRadius:at,width:at,maxWidth:at,height:at,maxHeight:at,size:at,top:at,right:at,bottom:at,left:at,padding:at,paddingTop:at,paddingRight:at,paddingBottom:at,paddingLeft:at,margin:at,marginTop:at,marginRight:at,marginBottom:at,marginLeft:at,rotate:hu,rotateX:hu,rotateY:hu,rotateZ:hu,scale:t1,scaleX:t1,scaleY:t1,scaleZ:t1,skew:hu,skewX:hu,skewY:hu,distance:at,translateX:at,translateY:at,translateZ:at,x:at,y:at,z:at,perspective:at,transformPerspective:at,opacity:tm,originX:ZM,originY:ZM,originZ:at,zIndex:JM,fillOpacity:tm,strokeOpacity:tm,numOctaves:JM};function rP(e,t,n,r){const{style:i,vars:o,transform:a,transformOrigin:s}=e;let l=!1,u=!1,c=!0;for(const d in t){const f=t[d];if(_q(d)){o[d]=f;continue}const h=xq[d],p=pMe(f,h);if(Jd.has(d)){if(l=!0,a[d]=p,!c)continue;f!==(h.default||0)&&(c=!1)}else d.startsWith("origin")?(u=!0,s[d]=p):i[d]=p}if(t.transform||(l||r?i.transform=fMe(e.transform,n,c,r):i.transform&&(i.transform="none")),u){const{originX:d="50%",originY:f="50%",originZ:h=0}=s;i.transformOrigin=`${d} ${f} ${h}`}}const iP=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function wq(e,t,n){for(const r in t)!Mo(t[r])&&!vq(r,n)&&(e[r]=t[r])}function vMe({transformTemplate:e},t,n){return I.useMemo(()=>{const r=iP();return rP(r,t,{enableHardwareAcceleration:!n},e),Object.assign({},r.vars,r.style)},[t])}function bMe(e,t,n){const r=e.style||{},i={};return wq(i,r,e),Object.assign(i,vMe(e,t,n)),e.transformValues?e.transformValues(i):i}function _Me(e,t,n){const r={},i=bMe(e,t,n);return e.drag&&e.dragListener!==!1&&(r.draggable=!1,i.userSelect=i.WebkitUserSelect=i.WebkitTouchCallout="none",i.touchAction=e.drag===!0?"none":`pan-${e.drag==="x"?"y":"x"}`),e.tabIndex===void 0&&(e.onTap||e.onTapStart||e.whileTap)&&(r.tabIndex=0),r.style=i,r}const SMe=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","transformValues","custom","inherit","onLayoutAnimationStart","onLayoutAnimationComplete","onLayoutMeasure","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","ignoreStrict","viewport"]);function X_(e){return e.startsWith("while")||e.startsWith("drag")&&e!=="draggable"||e.startsWith("layout")||e.startsWith("onTap")||e.startsWith("onPan")||SMe.has(e)}let Cq=e=>!X_(e);function xMe(e){e&&(Cq=t=>t.startsWith("on")?!X_(t):e(t))}try{xMe(require("@emotion/is-prop-valid").default)}catch{}function wMe(e,t,n){const r={};for(const i in e)i==="values"&&typeof e.values=="object"||(Cq(i)||n===!0&&X_(i)||!t&&!X_(i)||e.draggable&&i.startsWith("onDrag"))&&(r[i]=e[i]);return r}function e7(e,t,n){return typeof e=="string"?e:at.transform(t+n*e)}function CMe(e,t,n){const r=e7(t,e.x,e.width),i=e7(n,e.y,e.height);return`${r} ${i}`}const EMe={offset:"stroke-dashoffset",array:"stroke-dasharray"},kMe={offset:"strokeDashoffset",array:"strokeDasharray"};function TMe(e,t,n=1,r=0,i=!0){e.pathLength=1;const o=i?EMe:kMe;e[o.offset]=at.transform(-r);const a=at.transform(t),s=at.transform(n);e[o.array]=`${a} ${s}`}function oP(e,{attrX:t,attrY:n,attrScale:r,originX:i,originY:o,pathLength:a,pathSpacing:s=1,pathOffset:l=0,...u},c,d,f){if(rP(e,u,c,f),d){e.style.viewBox&&(e.attrs.viewBox=e.style.viewBox);return}e.attrs=e.style,e.style={};const{attrs:h,style:p,dimensions:m}=e;h.transform&&(m&&(p.transform=h.transform),delete h.transform),m&&(i!==void 0||o!==void 0||p.transform)&&(p.transformOrigin=CMe(m,i!==void 0?i:.5,o!==void 0?o:.5)),t!==void 0&&(h.x=t),n!==void 0&&(h.y=n),r!==void 0&&(h.scale=r),a!==void 0&&TMe(h,a,s,l,!1)}const Eq=()=>({...iP(),attrs:{}}),aP=e=>typeof e=="string"&&e.toLowerCase()==="svg";function AMe(e,t,n,r){const i=I.useMemo(()=>{const o=Eq();return oP(o,t,{enableHardwareAcceleration:!1},aP(r),e.transformTemplate),{...o.attrs,style:{...o.style}}},[t]);if(e.style){const o={};wq(o,e.style,e),i.style={...o,...i.style}}return i}function PMe(e=!1){return(n,r,i,{latestValues:o},a)=>{const l=(nP(n)?AMe:_Me)(r,o,a,n),c={...wMe(r,typeof n=="string",e),...l,ref:i},{children:d}=r,f=I.useMemo(()=>Mo(d)?d.get():d,[d]);return I.createElement(n,{...c,children:f})}}const sP=e=>e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase();function kq(e,{style:t,vars:n},r,i){Object.assign(e.style,t,i&&i.getProjectionStyles(r));for(const o in n)e.style.setProperty(o,n[o])}const Tq=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]);function Aq(e,t,n,r){kq(e,t,void 0,r);for(const i in t.attrs)e.setAttribute(Tq.has(i)?i:sP(i),t.attrs[i])}function lP(e,t){const{style:n}=e,r={};for(const i in n)(Mo(n[i])||t.style&&Mo(t.style[i])||vq(i,e))&&(r[i]=n[i]);return r}function Pq(e,t){const n=lP(e,t);for(const r in e)if(Mo(e[r])||Mo(t[r])){const i=Ny.indexOf(r)!==-1?"attr"+r.charAt(0).toUpperCase()+r.substring(1):r;n[i]=e[r]}return n}function uP(e,t,n,r={},i={}){return typeof t=="function"&&(t=t(n!==void 0?n:e.custom,r,i)),typeof t=="string"&&(t=e.variants&&e.variants[t]),typeof t=="function"&&(t=t(n!==void 0?n:e.custom,r,i)),t}function Iq(e){const t=I.useRef(null);return t.current===null&&(t.current=e()),t.current}const Y_=e=>Array.isArray(e),IMe=e=>!!(e&&typeof e=="object"&&e.mix&&e.toValue),RMe=e=>Y_(e)?e[e.length-1]||0:e;function ib(e){const t=Mo(e)?e.get():e;return IMe(t)?t.toValue():t}function OMe({scrapeMotionValuesFromProps:e,createRenderState:t,onMount:n},r,i,o){const a={latestValues:MMe(r,i,o,e),renderState:t()};return n&&(a.mount=s=>n(r,s,a)),a}const Rq=e=>(t,n)=>{const r=I.useContext(aw),i=I.useContext(My),o=()=>OMe(e,t,r,i);return n?o():Iq(o)};function MMe(e,t,n,r){const i={},o=r(e,{});for(const f in o)i[f]=ib(o[f]);let{initial:a,animate:s}=e;const l=uw(e),u=mq(e);t&&u&&!l&&e.inherit!==!1&&(a===void 0&&(a=t.initial),s===void 0&&(s=t.animate));let c=n?n.initial===!1:!1;c=c||a===!1;const d=c?s:a;return d&&typeof d!="boolean"&&!lw(d)&&(Array.isArray(d)?d:[d]).forEach(h=>{const p=uP(e,h);if(!p)return;const{transitionEnd:m,transition:_,...b}=p;for(const v in b){let g=b[v];if(Array.isArray(g)){const y=c?g.length-1:0;g=g[y]}g!==null&&(i[v]=g)}for(const v in m)i[v]=m[v]}),i}const yr=e=>e;function NMe(e){let t=[],n=[],r=0,i=!1,o=!1;const a=new WeakSet,s={schedule:(l,u=!1,c=!1)=>{const d=c&&i,f=d?t:n;return u&&a.add(l),f.indexOf(l)===-1&&(f.push(l),d&&i&&(r=t.length)),l},cancel:l=>{const u=n.indexOf(l);u!==-1&&n.splice(u,1),a.delete(l)},process:l=>{if(i){o=!0;return}if(i=!0,[t,n]=[n,t],n.length=0,r=t.length,r)for(let u=0;u(d[f]=NMe(()=>n=!0),d),{}),a=d=>o[d].process(i),s=()=>{const d=performance.now();n=!1,i.delta=r?1e3/60:Math.max(Math.min(d-i.timestamp,$Me),1),i.timestamp=d,i.isProcessing=!0,n1.forEach(a),i.isProcessing=!1,n&&t&&(r=!1,e(s))},l=()=>{n=!0,r=!0,i.isProcessing||e(s)};return{schedule:n1.reduce((d,f)=>{const h=o[f];return d[f]=(p,m=!1,_=!1)=>(n||l(),h.schedule(p,m,_)),d},{}),cancel:d=>n1.forEach(f=>o[f].cancel(d)),state:i,steps:o}}const{schedule:$n,cancel:Kl,state:ji,steps:w5}=DMe(typeof requestAnimationFrame<"u"?requestAnimationFrame:yr,!0),LMe={useVisualState:Rq({scrapeMotionValuesFromProps:Pq,createRenderState:Eq,onMount:(e,t,{renderState:n,latestValues:r})=>{$n.read(()=>{try{n.dimensions=typeof t.getBBox=="function"?t.getBBox():t.getBoundingClientRect()}catch{n.dimensions={x:0,y:0,width:0,height:0}}}),$n.render(()=>{oP(n,r,{enableHardwareAcceleration:!1},aP(t.tagName),e.transformTemplate),Aq(t,n)})}})},FMe={useVisualState:Rq({scrapeMotionValuesFromProps:lP,createRenderState:iP})};function BMe(e,{forwardMotionProps:t=!1},n,r){return{...nP(e)?LMe:FMe,preloadedFeatures:n,useRender:PMe(t),createVisualElement:r,Component:e}}function Rl(e,t,n,r={passive:!0}){return e.addEventListener(t,n,r),()=>e.removeEventListener(t,n)}const Oq=e=>e.pointerType==="mouse"?typeof e.button!="number"||e.button<=0:e.isPrimary!==!1;function dw(e,t="page"){return{point:{x:e[t+"X"],y:e[t+"Y"]}}}const zMe=e=>t=>Oq(t)&&e(t,dw(t));function Dl(e,t,n,r){return Rl(e,t,zMe(n),r)}const jMe=(e,t)=>n=>t(e(n)),Xu=(...e)=>e.reduce(jMe);function Mq(e){let t=null;return()=>{const n=()=>{t=null};return t===null?(t=e,n):!1}}const t7=Mq("dragHorizontal"),n7=Mq("dragVertical");function Nq(e){let t=!1;if(e==="y")t=n7();else if(e==="x")t=t7();else{const n=t7(),r=n7();n&&r?t=()=>{n(),r()}:(n&&n(),r&&r())}return t}function $q(){const e=Nq(!0);return e?(e(),!1):!0}class Pc{constructor(t){this.isMounted=!1,this.node=t}update(){}}function r7(e,t){const n="pointer"+(t?"enter":"leave"),r="onHover"+(t?"Start":"End"),i=(o,a)=>{if(o.type==="touch"||$q())return;const s=e.getProps();e.animationState&&s.whileHover&&e.animationState.setActive("whileHover",t),s[r]&&$n.update(()=>s[r](o,a))};return Dl(e.current,n,i,{passive:!e.getProps()[r]})}class UMe extends Pc{mount(){this.unmount=Xu(r7(this.node,!0),r7(this.node,!1))}unmount(){}}class VMe extends Pc{constructor(){super(...arguments),this.isActive=!1}onFocus(){let t=!1;try{t=this.node.current.matches(":focus-visible")}catch{t=!0}!t||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=Xu(Rl(this.node.current,"focus",()=>this.onFocus()),Rl(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}const Dq=(e,t)=>t?e===t?!0:Dq(e,t.parentElement):!1;function C5(e,t){if(!t)return;const n=new PointerEvent("pointer"+e);t(n,dw(n))}class GMe extends Pc{constructor(){super(...arguments),this.removeStartListeners=yr,this.removeEndListeners=yr,this.removeAccessibleListeners=yr,this.startPointerPress=(t,n)=>{if(this.removeEndListeners(),this.isPressing)return;const r=this.node.getProps(),o=Dl(window,"pointerup",(s,l)=>{if(!this.checkPressEnd())return;const{onTap:u,onTapCancel:c}=this.node.getProps();$n.update(()=>{Dq(this.node.current,s.target)?u&&u(s,l):c&&c(s,l)})},{passive:!(r.onTap||r.onPointerUp)}),a=Dl(window,"pointercancel",(s,l)=>this.cancelPress(s,l),{passive:!(r.onTapCancel||r.onPointerCancel)});this.removeEndListeners=Xu(o,a),this.startPress(t,n)},this.startAccessiblePress=()=>{const t=o=>{if(o.key!=="Enter"||this.isPressing)return;const a=s=>{s.key!=="Enter"||!this.checkPressEnd()||C5("up",(l,u)=>{const{onTap:c}=this.node.getProps();c&&$n.update(()=>c(l,u))})};this.removeEndListeners(),this.removeEndListeners=Rl(this.node.current,"keyup",a),C5("down",(s,l)=>{this.startPress(s,l)})},n=Rl(this.node.current,"keydown",t),r=()=>{this.isPressing&&C5("cancel",(o,a)=>this.cancelPress(o,a))},i=Rl(this.node.current,"blur",r);this.removeAccessibleListeners=Xu(n,i)}}startPress(t,n){this.isPressing=!0;const{onTapStart:r,whileTap:i}=this.node.getProps();i&&this.node.animationState&&this.node.animationState.setActive("whileTap",!0),r&&$n.update(()=>r(t,n))}checkPressEnd(){return this.removeEndListeners(),this.isPressing=!1,this.node.getProps().whileTap&&this.node.animationState&&this.node.animationState.setActive("whileTap",!1),!$q()}cancelPress(t,n){if(!this.checkPressEnd())return;const{onTapCancel:r}=this.node.getProps();r&&$n.update(()=>r(t,n))}mount(){const t=this.node.getProps(),n=Dl(this.node.current,"pointerdown",this.startPointerPress,{passive:!(t.onTapStart||t.onPointerStart)}),r=Rl(this.node.current,"focus",this.startAccessiblePress);this.removeStartListeners=Xu(n,r)}unmount(){this.removeStartListeners(),this.removeEndListeners(),this.removeAccessibleListeners()}}const y4=new WeakMap,E5=new WeakMap,HMe=e=>{const t=y4.get(e.target);t&&t(e)},qMe=e=>{e.forEach(HMe)};function WMe({root:e,...t}){const n=e||document;E5.has(n)||E5.set(n,{});const r=E5.get(n),i=JSON.stringify(t);return r[i]||(r[i]=new IntersectionObserver(qMe,{root:e,...t})),r[i]}function KMe(e,t,n){const r=WMe(t);return y4.set(e,n),r.observe(e),()=>{y4.delete(e),r.unobserve(e)}}const QMe={some:0,all:1};class XMe extends Pc{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:t={}}=this.node.getProps(),{root:n,margin:r,amount:i="some",once:o}=t,a={root:n?n.current:void 0,rootMargin:r,threshold:typeof i=="number"?i:QMe[i]},s=l=>{const{isIntersecting:u}=l;if(this.isInView===u||(this.isInView=u,o&&!u&&this.hasEnteredView))return;u&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",u);const{onViewportEnter:c,onViewportLeave:d}=this.node.getProps(),f=u?c:d;f&&f(l)};return KMe(this.node.current,a,s)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:t,prevProps:n}=this.node;["amount","margin","root"].some(YMe(t,n))&&this.startObserver()}unmount(){}}function YMe({viewport:e={}},{viewport:t={}}={}){return n=>e[n]!==t[n]}const ZMe={inView:{Feature:XMe},tap:{Feature:GMe},focus:{Feature:VMe},hover:{Feature:UMe}};function Lq(e,t){if(!Array.isArray(t))return!1;const n=t.length;if(n!==e.length)return!1;for(let r=0;rt[r]=n.get()),t}function e7e(e){const t={};return e.values.forEach((n,r)=>t[r]=n.getVelocity()),t}function fw(e,t,n){const r=e.getProps();return uP(r,t,n!==void 0?n:r.custom,JMe(e),e7e(e))}const t7e="framerAppearId",n7e="data-"+sP(t7e);let r7e=yr,cP=yr;const Yu=e=>e*1e3,Ll=e=>e/1e3,i7e={current:!1},Fq=e=>Array.isArray(e)&&typeof e[0]=="number";function Bq(e){return!!(!e||typeof e=="string"&&zq[e]||Fq(e)||Array.isArray(e)&&e.every(Bq))}const Pg=([e,t,n,r])=>`cubic-bezier(${e}, ${t}, ${n}, ${r})`,zq={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:Pg([0,.65,.55,1]),circOut:Pg([.55,0,1,.45]),backIn:Pg([.31,.01,.66,-.59]),backOut:Pg([.33,1.53,.69,.99])};function jq(e){if(e)return Fq(e)?Pg(e):Array.isArray(e)?e.map(jq):zq[e]}function o7e(e,t,n,{delay:r=0,duration:i,repeat:o=0,repeatType:a="loop",ease:s,times:l}={}){const u={[t]:n};l&&(u.offset=l);const c=jq(s);return Array.isArray(c)&&(u.easing=c),e.animate(u,{delay:r,duration:i,easing:Array.isArray(c)?"linear":c,fill:"both",iterations:o+1,direction:a==="reverse"?"alternate":"normal"})}function a7e(e,{repeat:t,repeatType:n="loop"}){const r=t&&n!=="loop"&&t%2===1?0:e.length-1;return e[r]}const Uq=(e,t,n)=>(((1-3*n+3*t)*e+(3*n-6*t))*e+3*t)*e,s7e=1e-7,l7e=12;function u7e(e,t,n,r,i){let o,a,s=0;do a=t+(n-t)/2,o=Uq(a,r,i)-e,o>0?n=a:t=a;while(Math.abs(o)>s7e&&++su7e(o,0,1,e,n);return o=>o===0||o===1?o:Uq(i(o),t,r)}const c7e=Ly(.42,0,1,1),d7e=Ly(0,0,.58,1),Vq=Ly(.42,0,.58,1),f7e=e=>Array.isArray(e)&&typeof e[0]!="number",Gq=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,Hq=e=>t=>1-e(1-t),qq=e=>1-Math.sin(Math.acos(e)),dP=Hq(qq),h7e=Gq(dP),Wq=Ly(.33,1.53,.69,.99),fP=Hq(Wq),p7e=Gq(fP),g7e=e=>(e*=2)<1?.5*fP(e):.5*(2-Math.pow(2,-10*(e-1))),m7e={linear:yr,easeIn:c7e,easeInOut:Vq,easeOut:d7e,circIn:qq,circInOut:h7e,circOut:dP,backIn:fP,backInOut:p7e,backOut:Wq,anticipate:g7e},i7=e=>{if(Array.isArray(e)){cP(e.length===4);const[t,n,r,i]=e;return Ly(t,n,r,i)}else if(typeof e=="string")return m7e[e];return e},hP=(e,t)=>n=>!!($y(n)&&gMe.test(n)&&n.startsWith(e)||t&&Object.prototype.hasOwnProperty.call(n,t)),Kq=(e,t,n)=>r=>{if(!$y(r))return r;const[i,o,a,s]=r.match(cw);return{[e]:parseFloat(i),[t]:parseFloat(o),[n]:parseFloat(a),alpha:s!==void 0?parseFloat(s):1}},y7e=e=>fc(0,255,e),k5={...ef,transform:e=>Math.round(y7e(e))},sd={test:hP("rgb","red"),parse:Kq("red","green","blue"),transform:({red:e,green:t,blue:n,alpha:r=1})=>"rgba("+k5.transform(e)+", "+k5.transform(t)+", "+k5.transform(n)+", "+nm(tm.transform(r))+")"};function v7e(e){let t="",n="",r="",i="";return e.length>5?(t=e.substring(1,3),n=e.substring(3,5),r=e.substring(5,7),i=e.substring(7,9)):(t=e.substring(1,2),n=e.substring(2,3),r=e.substring(3,4),i=e.substring(4,5),t+=t,n+=n,r+=r,i+=i),{red:parseInt(t,16),green:parseInt(n,16),blue:parseInt(r,16),alpha:i?parseInt(i,16)/255:1}}const v4={test:hP("#"),parse:v7e,transform:sd.transform},Kf={test:hP("hsl","hue"),parse:Kq("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:n,alpha:r=1})=>"hsla("+Math.round(e)+", "+Ws.transform(nm(t))+", "+Ws.transform(nm(n))+", "+nm(tm.transform(r))+")"},Zi={test:e=>sd.test(e)||v4.test(e)||Kf.test(e),parse:e=>sd.test(e)?sd.parse(e):Kf.test(e)?Kf.parse(e):v4.parse(e),transform:e=>$y(e)?e:e.hasOwnProperty("red")?sd.transform(e):Kf.transform(e)},lr=(e,t,n)=>-n*e+n*t+e;function T5(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e}function b7e({hue:e,saturation:t,lightness:n,alpha:r}){e/=360,t/=100,n/=100;let i=0,o=0,a=0;if(!t)i=o=a=n;else{const s=n<.5?n*(1+t):n+t-n*t,l=2*n-s;i=T5(l,s,e+1/3),o=T5(l,s,e),a=T5(l,s,e-1/3)}return{red:Math.round(i*255),green:Math.round(o*255),blue:Math.round(a*255),alpha:r}}const A5=(e,t,n)=>{const r=e*e;return Math.sqrt(Math.max(0,n*(t*t-r)+r))},_7e=[v4,sd,Kf],S7e=e=>_7e.find(t=>t.test(e));function o7(e){const t=S7e(e);let n=t.parse(e);return t===Kf&&(n=b7e(n)),n}const Qq=(e,t)=>{const n=o7(e),r=o7(t),i={...n};return o=>(i.red=A5(n.red,r.red,o),i.green=A5(n.green,r.green,o),i.blue=A5(n.blue,r.blue,o),i.alpha=lr(n.alpha,r.alpha,o),sd.transform(i))};function x7e(e){var t,n;return isNaN(e)&&$y(e)&&(((t=e.match(cw))===null||t===void 0?void 0:t.length)||0)+(((n=e.match(Sq))===null||n===void 0?void 0:n.length)||0)>0}const Xq={regex:hMe,countKey:"Vars",token:"${v}",parse:yr},Yq={regex:Sq,countKey:"Colors",token:"${c}",parse:Zi.parse},Zq={regex:cw,countKey:"Numbers",token:"${n}",parse:ef.parse};function P5(e,{regex:t,countKey:n,token:r,parse:i}){const o=e.tokenised.match(t);o&&(e["num"+n]=o.length,e.tokenised=e.tokenised.replace(t,r),e.values.push(...o.map(i)))}function Z_(e){const t=e.toString(),n={value:t,tokenised:t,values:[],numVars:0,numColors:0,numNumbers:0};return n.value.includes("var(--")&&P5(n,Xq),P5(n,Yq),P5(n,Zq),n}function Jq(e){return Z_(e).values}function eW(e){const{values:t,numColors:n,numVars:r,tokenised:i}=Z_(e),o=t.length;return a=>{let s=i;for(let l=0;ltypeof e=="number"?0:e;function C7e(e){const t=Jq(e);return eW(e)(t.map(w7e))}const hc={test:x7e,parse:Jq,createTransformer:eW,getAnimatableNone:C7e},tW=(e,t)=>n=>`${n>0?t:e}`;function nW(e,t){return typeof e=="number"?n=>lr(e,t,n):Zi.test(e)?Qq(e,t):e.startsWith("var(")?tW(e,t):iW(e,t)}const rW=(e,t)=>{const n=[...e],r=n.length,i=e.map((o,a)=>nW(o,t[a]));return o=>{for(let a=0;a{const n={...e,...t},r={};for(const i in n)e[i]!==void 0&&t[i]!==void 0&&(r[i]=nW(e[i],t[i]));return i=>{for(const o in r)n[o]=r[o](i);return n}},iW=(e,t)=>{const n=hc.createTransformer(t),r=Z_(e),i=Z_(t);return r.numVars===i.numVars&&r.numColors===i.numColors&&r.numNumbers>=i.numNumbers?Xu(rW(r.values,i.values),n):tW(e,t)},R0=(e,t,n)=>{const r=t-e;return r===0?1:(n-e)/r},a7=(e,t)=>n=>lr(e,t,n);function k7e(e){return typeof e=="number"?a7:typeof e=="string"?Zi.test(e)?Qq:iW:Array.isArray(e)?rW:typeof e=="object"?E7e:a7}function T7e(e,t,n){const r=[],i=n||k7e(e[0]),o=e.length-1;for(let a=0;at[0];e[0]>e[o-1]&&(e=[...e].reverse(),t=[...t].reverse());const a=T7e(t,r,i),s=a.length,l=u=>{let c=0;if(s>1)for(;cl(fc(e[0],e[o-1],u)):l}function A7e(e,t){const n=e[e.length-1];for(let r=1;r<=t;r++){const i=R0(0,t,r);e.push(lr(n,1,i))}}function P7e(e){const t=[0];return A7e(t,e.length-1),t}function I7e(e,t){return e.map(n=>n*t)}function R7e(e,t){return e.map(()=>t||Vq).splice(0,e.length-1)}function J_({duration:e=300,keyframes:t,times:n,ease:r="easeInOut"}){const i=f7e(r)?r.map(i7):i7(r),o={done:!1,value:t[0]},a=I7e(n&&n.length===t.length?n:P7e(t),e),s=oW(a,t,{ease:Array.isArray(i)?i:R7e(t,i)});return{calculatedDuration:e,next:l=>(o.value=s(l),o.done=l>=e,o)}}function aW(e,t){return t?e*(1e3/t):0}const O7e=5;function sW(e,t,n){const r=Math.max(t-O7e,0);return aW(n-e(r),t-r)}const I5=.001,M7e=.01,s7=10,N7e=.05,$7e=1;function D7e({duration:e=800,bounce:t=.25,velocity:n=0,mass:r=1}){let i,o;r7e(e<=Yu(s7));let a=1-t;a=fc(N7e,$7e,a),e=fc(M7e,s7,Ll(e)),a<1?(i=u=>{const c=u*a,d=c*e,f=c-n,h=b4(u,a),p=Math.exp(-d);return I5-f/h*p},o=u=>{const d=u*a*e,f=d*n+n,h=Math.pow(a,2)*Math.pow(u,2)*e,p=Math.exp(-d),m=b4(Math.pow(u,2),a);return(-i(u)+I5>0?-1:1)*((f-h)*p)/m}):(i=u=>{const c=Math.exp(-u*e),d=(u-n)*e+1;return-I5+c*d},o=u=>{const c=Math.exp(-u*e),d=(n-u)*(e*e);return c*d});const s=5/e,l=F7e(i,o,s);if(e=Yu(e),isNaN(l))return{stiffness:100,damping:10,duration:e};{const u=Math.pow(l,2)*r;return{stiffness:u,damping:a*2*Math.sqrt(r*u),duration:e}}}const L7e=12;function F7e(e,t,n){let r=n;for(let i=1;ie[n]!==void 0)}function j7e(e){let t={velocity:0,stiffness:100,damping:10,mass:1,isResolvedFromDuration:!1,...e};if(!l7(e,z7e)&&l7(e,B7e)){const n=D7e(e);t={...t,...n,velocity:0,mass:1},t.isResolvedFromDuration=!0}return t}function lW({keyframes:e,restDelta:t,restSpeed:n,...r}){const i=e[0],o=e[e.length-1],a={done:!1,value:i},{stiffness:s,damping:l,mass:u,velocity:c,duration:d,isResolvedFromDuration:f}=j7e(r),h=c?-Ll(c):0,p=l/(2*Math.sqrt(s*u)),m=o-i,_=Ll(Math.sqrt(s/u)),b=Math.abs(m)<5;n||(n=b?.01:2),t||(t=b?.005:.5);let v;if(p<1){const g=b4(_,p);v=y=>{const S=Math.exp(-p*_*y);return o-S*((h+p*_*m)/g*Math.sin(g*y)+m*Math.cos(g*y))}}else if(p===1)v=g=>o-Math.exp(-_*g)*(m+(h+_*m)*g);else{const g=_*Math.sqrt(p*p-1);v=y=>{const S=Math.exp(-p*_*y),w=Math.min(g*y,300);return o-S*((h+p*_*m)*Math.sinh(w)+g*m*Math.cosh(w))/g}}return{calculatedDuration:f&&d||null,next:g=>{const y=v(g);if(f)a.done=g>=d;else{let S=h;g!==0&&(p<1?S=sW(v,g,y):S=0);const w=Math.abs(S)<=n,x=Math.abs(o-y)<=t;a.done=w&&x}return a.value=a.done?o:y,a}}}function u7({keyframes:e,velocity:t=0,power:n=.8,timeConstant:r=325,bounceDamping:i=10,bounceStiffness:o=500,modifyTarget:a,min:s,max:l,restDelta:u=.5,restSpeed:c}){const d=e[0],f={done:!1,value:d},h=C=>s!==void 0&&Cl,p=C=>s===void 0?l:l===void 0||Math.abs(s-C)-m*Math.exp(-C/r),g=C=>b+v(C),y=C=>{const T=v(C),k=g(C);f.done=Math.abs(T)<=u,f.value=f.done?b:k};let S,w;const x=C=>{h(f.value)&&(S=C,w=lW({keyframes:[f.value,p(f.value)],velocity:sW(g,C,f.value),damping:i,stiffness:o,restDelta:u,restSpeed:c}))};return x(0),{calculatedDuration:null,next:C=>{let T=!1;return!w&&S===void 0&&(T=!0,y(C),x(C)),S!==void 0&&C>S?w.next(C-S):(!T&&y(C),f)}}}const U7e=e=>{const t=({timestamp:n})=>e(n);return{start:()=>$n.update(t,!0),stop:()=>Kl(t),now:()=>ji.isProcessing?ji.timestamp:performance.now()}},c7=2e4;function d7(e){let t=0;const n=50;let r=e.next(t);for(;!r.done&&t=c7?1/0:t}const V7e={decay:u7,inertia:u7,tween:J_,keyframes:J_,spring:lW};function eS({autoplay:e=!0,delay:t=0,driver:n=U7e,keyframes:r,type:i="keyframes",repeat:o=0,repeatDelay:a=0,repeatType:s="loop",onPlay:l,onStop:u,onComplete:c,onUpdate:d,...f}){let h=1,p=!1,m,_;const b=()=>{_=new Promise(B=>{m=B})};b();let v;const g=V7e[i]||J_;let y;g!==J_&&typeof r[0]!="number"&&(y=oW([0,100],r,{clamp:!1}),r=[0,100]);const S=g({...f,keyframes:r});let w;s==="mirror"&&(w=g({...f,keyframes:[...r].reverse(),velocity:-(f.velocity||0)}));let x="idle",C=null,T=null,k=null;S.calculatedDuration===null&&o&&(S.calculatedDuration=d7(S));const{calculatedDuration:P}=S;let $=1/0,O=1/0;P!==null&&($=P+a,O=$*(o+1)-a);let E=0;const A=B=>{if(T===null)return;h>0&&(T=Math.min(T,B)),h<0&&(T=Math.min(B-O/h,T)),C!==null?E=C:E=Math.round(B-T)*h;const U=E-t*(h>=0?1:-1),G=h>=0?U<0:U>O;E=Math.max(U,0),x==="finished"&&C===null&&(E=O);let Y=E,ee=S;if(o){const ne=E/$;let se=Math.floor(ne),ve=ne%1;!ve&&ne>=1&&(ve=1),ve===1&&se--,se=Math.min(se,o+1);const ce=!!(se%2);ce&&(s==="reverse"?(ve=1-ve,a&&(ve-=a/$)):s==="mirror"&&(ee=w));let bt=fc(0,1,ve);E>O&&(bt=s==="reverse"&&ce?1:0),Y=bt*$}const J=G?{done:!1,value:r[0]}:ee.next(Y);y&&(J.value=y(J.value));let{done:j}=J;!G&&P!==null&&(j=h>=0?E>=O:E<=0);const Q=C===null&&(x==="finished"||x==="running"&&j);return d&&d(J.value),Q&&M(),J},D=()=>{v&&v.stop(),v=void 0},L=()=>{x="idle",D(),m(),b(),T=k=null},M=()=>{x="finished",c&&c(),D(),m()},R=()=>{if(p)return;v||(v=n(A));const B=v.now();l&&l(),C!==null?T=B-C:(!T||x==="finished")&&(T=B),x==="finished"&&b(),k=T,C=null,x="running",v.start()};e&&R();const N={then(B,U){return _.then(B,U)},get time(){return Ll(E)},set time(B){B=Yu(B),E=B,C!==null||!v||h===0?C=B:T=v.now()-B/h},get duration(){const B=S.calculatedDuration===null?d7(S):S.calculatedDuration;return Ll(B)},get speed(){return h},set speed(B){B===h||!v||(h=B,N.time=Ll(E))},get state(){return x},play:R,pause:()=>{x="paused",C=E},stop:()=>{p=!0,x!=="idle"&&(x="idle",u&&u(),L())},cancel:()=>{k!==null&&A(k),L()},complete:()=>{x="finished"},sample:B=>(T=0,A(B))};return N}function G7e(e){let t;return()=>(t===void 0&&(t=e()),t)}const H7e=G7e(()=>Object.hasOwnProperty.call(Element.prototype,"animate")),q7e=new Set(["opacity","clipPath","filter","transform","backgroundColor"]),r1=10,W7e=2e4,K7e=(e,t)=>t.type==="spring"||e==="backgroundColor"||!Bq(t.ease);function Q7e(e,t,{onUpdate:n,onComplete:r,...i}){if(!(H7e()&&q7e.has(t)&&!i.repeatDelay&&i.repeatType!=="mirror"&&i.damping!==0&&i.type!=="inertia"))return!1;let a=!1,s,l;const u=()=>{l=new Promise(v=>{s=v})};u();let{keyframes:c,duration:d=300,ease:f,times:h}=i;if(K7e(t,i)){const v=eS({...i,repeat:0,delay:0});let g={done:!1,value:c[0]};const y=[];let S=0;for(;!g.done&&Sp.cancel(),_=()=>{$n.update(m),s(),u()};return p.onfinish=()=>{e.set(a7e(c,i)),r&&r(),_()},{then(v,g){return l.then(v,g)},attachTimeline(v){return p.timeline=v,p.onfinish=null,yr},get time(){return Ll(p.currentTime||0)},set time(v){p.currentTime=Yu(v)},get speed(){return p.playbackRate},set speed(v){p.playbackRate=v},get duration(){return Ll(d)},play:()=>{a||(p.play(),Kl(m))},pause:()=>p.pause(),stop:()=>{if(a=!0,p.playState==="idle")return;const{currentTime:v}=p;if(v){const g=eS({...i,autoplay:!1});e.setWithVelocity(g.sample(v-r1).value,g.sample(v).value,r1)}_()},complete:()=>p.finish(),cancel:_}}function X7e({keyframes:e,delay:t,onUpdate:n,onComplete:r}){const i=()=>(n&&n(e[e.length-1]),r&&r(),{time:0,speed:1,duration:0,play:yr,pause:yr,stop:yr,then:o=>(o(),Promise.resolve()),cancel:yr,complete:yr});return t?eS({keyframes:[0,1],duration:0,delay:t,onComplete:i}):i()}const Y7e={type:"spring",stiffness:500,damping:25,restSpeed:10},Z7e=e=>({type:"spring",stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),J7e={type:"keyframes",duration:.8},eNe={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},tNe=(e,{keyframes:t})=>t.length>2?J7e:Jd.has(e)?e.startsWith("scale")?Z7e(t[1]):Y7e:eNe,_4=(e,t)=>e==="zIndex"?!1:!!(typeof t=="number"||Array.isArray(t)||typeof t=="string"&&(hc.test(t)||t==="0")&&!t.startsWith("url(")),nNe=new Set(["brightness","contrast","saturate","opacity"]);function rNe(e){const[t,n]=e.slice(0,-1).split("(");if(t==="drop-shadow")return e;const[r]=n.match(cw)||[];if(!r)return e;const i=n.replace(r,"");let o=nNe.has(t)?1:0;return r!==n&&(o*=100),t+"("+o+i+")"}const iNe=/([a-z-]*)\(.*?\)/g,S4={...hc,getAnimatableNone:e=>{const t=e.match(iNe);return t?t.map(rNe).join(" "):e}},oNe={...xq,color:Zi,backgroundColor:Zi,outlineColor:Zi,fill:Zi,stroke:Zi,borderColor:Zi,borderTopColor:Zi,borderRightColor:Zi,borderBottomColor:Zi,borderLeftColor:Zi,filter:S4,WebkitFilter:S4},pP=e=>oNe[e];function uW(e,t){let n=pP(e);return n!==S4&&(n=hc),n.getAnimatableNone?n.getAnimatableNone(t):void 0}const cW=e=>/^0[^.\s]+$/.test(e);function aNe(e){if(typeof e=="number")return e===0;if(e!==null)return e==="none"||e==="0"||cW(e)}function sNe(e,t,n,r){const i=_4(t,n);let o;Array.isArray(n)?o=[...n]:o=[null,n];const a=r.from!==void 0?r.from:e.get();let s;const l=[];for(let u=0;ui=>{const o=dW(r,e)||{},a=o.delay||r.delay||0;let{elapsed:s=0}=r;s=s-Yu(a);const l=sNe(t,e,n,o),u=l[0],c=l[l.length-1],d=_4(e,u),f=_4(e,c);let h={keyframes:l,velocity:t.getVelocity(),ease:"easeOut",...o,delay:-s,onUpdate:p=>{t.set(p),o.onUpdate&&o.onUpdate(p)},onComplete:()=>{i(),o.onComplete&&o.onComplete()}};if(lNe(o)||(h={...h,...tNe(e,h)}),h.duration&&(h.duration=Yu(h.duration)),h.repeatDelay&&(h.repeatDelay=Yu(h.repeatDelay)),!d||!f||i7e.current||o.type===!1)return X7e(h);if(t.owner&&t.owner.current instanceof HTMLElement&&!t.owner.getProps().onUpdate){const p=Q7e(t,e,h);if(p)return p}return eS(h)};function tS(e){return!!(Mo(e)&&e.add)}const fW=e=>/^\-?\d*\.?\d+$/.test(e);function mP(e,t){e.indexOf(t)===-1&&e.push(t)}function yP(e,t){const n=e.indexOf(t);n>-1&&e.splice(n,1)}class vP{constructor(){this.subscriptions=[]}add(t){return mP(this.subscriptions,t),()=>yP(this.subscriptions,t)}notify(t,n,r){const i=this.subscriptions.length;if(i)if(i===1)this.subscriptions[0](t,n,r);else for(let o=0;o!isNaN(parseFloat(e));class cNe{constructor(t,n={}){this.version="10.16.1",this.timeDelta=0,this.lastUpdated=0,this.canTrackVelocity=!1,this.events={},this.updateAndNotify=(r,i=!0)=>{this.prev=this.current,this.current=r;const{delta:o,timestamp:a}=ji;this.lastUpdated!==a&&(this.timeDelta=o,this.lastUpdated=a,$n.postRender(this.scheduleVelocityCheck)),this.prev!==this.current&&this.events.change&&this.events.change.notify(this.current),this.events.velocityChange&&this.events.velocityChange.notify(this.getVelocity()),i&&this.events.renderRequest&&this.events.renderRequest.notify(this.current)},this.scheduleVelocityCheck=()=>$n.postRender(this.velocityCheck),this.velocityCheck=({timestamp:r})=>{r!==this.lastUpdated&&(this.prev=this.current,this.events.velocityChange&&this.events.velocityChange.notify(this.getVelocity()))},this.hasAnimated=!1,this.prev=this.current=t,this.canTrackVelocity=uNe(this.current),this.owner=n.owner}onChange(t){return this.on("change",t)}on(t,n){this.events[t]||(this.events[t]=new vP);const r=this.events[t].add(n);return t==="change"?()=>{r(),$n.read(()=>{this.events.change.getSize()||this.stop()})}:r}clearListeners(){for(const t in this.events)this.events[t].clear()}attach(t,n){this.passiveEffect=t,this.stopPassiveEffect=n}set(t,n=!0){!n||!this.passiveEffect?this.updateAndNotify(t,n):this.passiveEffect(t,this.updateAndNotify)}setWithVelocity(t,n,r){this.set(n),this.prev=t,this.timeDelta=r}jump(t){this.updateAndNotify(t),this.prev=t,this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}get(){return this.current}getPrevious(){return this.prev}getVelocity(){return this.canTrackVelocity?aW(parseFloat(this.current)-parseFloat(this.prev),this.timeDelta):0}start(t){return this.stop(),new Promise(n=>{this.hasAnimated=!0,this.animation=t(n),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function lp(e,t){return new cNe(e,t)}const hW=e=>t=>t.test(e),dNe={test:e=>e==="auto",parse:e=>e},pW=[ef,at,Ws,hu,yMe,mMe,dNe],sg=e=>pW.find(hW(e)),fNe=[...pW,Zi,hc],hNe=e=>fNe.find(hW(e));function pNe(e,t,n){e.hasValue(t)?e.getValue(t).set(n):e.addValue(t,lp(n))}function gNe(e,t){const n=fw(e,t);let{transitionEnd:r={},transition:i={},...o}=n?e.makeTargetAnimatable(n,!1):{};o={...o,...r};for(const a in o){const s=RMe(o[a]);pNe(e,a,s)}}function mNe(e,t,n){var r,i;const o=Object.keys(t).filter(s=>!e.hasValue(s)),a=o.length;if(a)for(let s=0;sl.remove(d))),u.push(m)}return a&&Promise.all(u).then(()=>{a&&gNe(e,a)}),u}function x4(e,t,n={}){const r=fw(e,t,n.custom);let{transition:i=e.getDefaultTransition()||{}}=r||{};n.transitionOverride&&(i=n.transitionOverride);const o=r?()=>Promise.all(gW(e,r,n)):()=>Promise.resolve(),a=e.variantChildren&&e.variantChildren.size?(l=0)=>{const{delayChildren:u=0,staggerChildren:c,staggerDirection:d}=i;return _Ne(e,t,u+l,c,d,n)}:()=>Promise.resolve(),{when:s}=i;if(s){const[l,u]=s==="beforeChildren"?[o,a]:[a,o];return l().then(()=>u())}else return Promise.all([o(),a(n.delay)])}function _Ne(e,t,n=0,r=0,i=1,o){const a=[],s=(e.variantChildren.size-1)*r,l=i===1?(u=0)=>u*r:(u=0)=>s-u*r;return Array.from(e.variantChildren).sort(SNe).forEach((u,c)=>{u.notify("AnimationStart",t),a.push(x4(u,t,{...o,delay:n+l(c)}).then(()=>u.notify("AnimationComplete",t)))}),Promise.all(a)}function SNe(e,t){return e.sortNodePosition(t)}function xNe(e,t,n={}){e.notify("AnimationStart",t);let r;if(Array.isArray(t)){const i=t.map(o=>x4(e,o,n));r=Promise.all(i)}else if(typeof t=="string")r=x4(e,t,n);else{const i=typeof t=="function"?fw(e,t,n.custom):t;r=Promise.all(gW(e,i,n))}return r.then(()=>e.notify("AnimationComplete",t))}const wNe=[...JA].reverse(),CNe=JA.length;function ENe(e){return t=>Promise.all(t.map(({animation:n,options:r})=>xNe(e,n,r)))}function kNe(e){let t=ENe(e);const n=ANe();let r=!0;const i=(l,u)=>{const c=fw(e,u);if(c){const{transition:d,transitionEnd:f,...h}=c;l={...l,...h,...f}}return l};function o(l){t=l(e)}function a(l,u){const c=e.getProps(),d=e.getVariantContext(!0)||{},f=[],h=new Set;let p={},m=1/0;for(let b=0;bm&&S;const k=Array.isArray(y)?y:[y];let P=k.reduce(i,{});w===!1&&(P={});const{prevResolvedValues:$={}}=g,O={...$,...P},E=A=>{T=!0,h.delete(A),g.needsAnimating[A]=!0};for(const A in O){const D=P[A],L=$[A];p.hasOwnProperty(A)||(D!==L?Y_(D)&&Y_(L)?!Lq(D,L)||C?E(A):g.protectedKeys[A]=!0:D!==void 0?E(A):h.add(A):D!==void 0&&h.has(A)?E(A):g.protectedKeys[A]=!0)}g.prevProp=y,g.prevResolvedValues=P,g.isActive&&(p={...p,...P}),r&&e.blockInitialAnimation&&(T=!1),T&&!x&&f.push(...k.map(A=>({animation:A,options:{type:v,...l}})))}if(h.size){const b={};h.forEach(v=>{const g=e.getBaseTarget(v);g!==void 0&&(b[v]=g)}),f.push({animation:b})}let _=!!f.length;return r&&c.initial===!1&&!e.manuallyAnimateOnMount&&(_=!1),r=!1,_?t(f):Promise.resolve()}function s(l,u,c){var d;if(n[l].isActive===u)return Promise.resolve();(d=e.variantChildren)===null||d===void 0||d.forEach(h=>{var p;return(p=h.animationState)===null||p===void 0?void 0:p.setActive(l,u)}),n[l].isActive=u;const f=a(c,l);for(const h in n)n[h].protectedKeys={};return f}return{animateChanges:a,setActive:s,setAnimateFunction:o,getState:()=>n}}function TNe(e,t){return typeof t=="string"?t!==e:Array.isArray(t)?!Lq(t,e):!1}function Lc(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function ANe(){return{animate:Lc(!0),whileInView:Lc(),whileHover:Lc(),whileTap:Lc(),whileDrag:Lc(),whileFocus:Lc(),exit:Lc()}}class PNe extends Pc{constructor(t){super(t),t.animationState||(t.animationState=kNe(t))}updateAnimationControlsSubscription(){const{animate:t}=this.node.getProps();this.unmount(),lw(t)&&(this.unmount=t.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:t}=this.node.getProps(),{animate:n}=this.node.prevProps||{};t!==n&&this.updateAnimationControlsSubscription()}unmount(){}}let INe=0;class RNe extends Pc{constructor(){super(...arguments),this.id=INe++}update(){if(!this.node.presenceContext)return;const{isPresent:t,onExitComplete:n,custom:r}=this.node.presenceContext,{isPresent:i}=this.node.prevPresenceContext||{};if(!this.node.animationState||t===i)return;const o=this.node.animationState.setActive("exit",!t,{custom:r??this.node.getProps().custom});n&&!t&&o.then(()=>n(this.id))}mount(){const{register:t}=this.node.presenceContext||{};t&&(this.unmount=t(this.id))}unmount(){}}const ONe={animation:{Feature:PNe},exit:{Feature:RNe}},f7=(e,t)=>Math.abs(e-t);function MNe(e,t){const n=f7(e.x,t.x),r=f7(e.y,t.y);return Math.sqrt(n**2+r**2)}class mW{constructor(t,n,{transformPagePoint:r}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const u=O5(this.lastMoveEventInfo,this.history),c=this.startEvent!==null,d=MNe(u.offset,{x:0,y:0})>=3;if(!c&&!d)return;const{point:f}=u,{timestamp:h}=ji;this.history.push({...f,timestamp:h});const{onStart:p,onMove:m}=this.handlers;c||(p&&p(this.lastMoveEvent,u),this.startEvent=this.lastMoveEvent),m&&m(this.lastMoveEvent,u)},this.handlePointerMove=(u,c)=>{this.lastMoveEvent=u,this.lastMoveEventInfo=R5(c,this.transformPagePoint),$n.update(this.updatePoint,!0)},this.handlePointerUp=(u,c)=>{if(this.end(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const{onEnd:d,onSessionEnd:f}=this.handlers,h=O5(u.type==="pointercancel"?this.lastMoveEventInfo:R5(c,this.transformPagePoint),this.history);this.startEvent&&d&&d(u,h),f&&f(u,h)},!Oq(t))return;this.handlers=n,this.transformPagePoint=r;const i=dw(t),o=R5(i,this.transformPagePoint),{point:a}=o,{timestamp:s}=ji;this.history=[{...a,timestamp:s}];const{onSessionStart:l}=n;l&&l(t,O5(o,this.history)),this.removeListeners=Xu(Dl(window,"pointermove",this.handlePointerMove),Dl(window,"pointerup",this.handlePointerUp),Dl(window,"pointercancel",this.handlePointerUp))}updateHandlers(t){this.handlers=t}end(){this.removeListeners&&this.removeListeners(),Kl(this.updatePoint)}}function R5(e,t){return t?{point:t(e.point)}:e}function h7(e,t){return{x:e.x-t.x,y:e.y-t.y}}function O5({point:e},t){return{point:e,delta:h7(e,yW(t)),offset:h7(e,NNe(t)),velocity:$Ne(t,.1)}}function NNe(e){return e[0]}function yW(e){return e[e.length-1]}function $Ne(e,t){if(e.length<2)return{x:0,y:0};let n=e.length-1,r=null;const i=yW(e);for(;n>=0&&(r=e[n],!(i.timestamp-r.timestamp>Yu(t)));)n--;if(!r)return{x:0,y:0};const o=Ll(i.timestamp-r.timestamp);if(o===0)return{x:0,y:0};const a={x:(i.x-r.x)/o,y:(i.y-r.y)/o};return a.x===1/0&&(a.x=0),a.y===1/0&&(a.y=0),a}function Jo(e){return e.max-e.min}function w4(e,t=0,n=.01){return Math.abs(e-t)<=n}function p7(e,t,n,r=.5){e.origin=r,e.originPoint=lr(t.min,t.max,e.origin),e.scale=Jo(n)/Jo(t),(w4(e.scale,1,1e-4)||isNaN(e.scale))&&(e.scale=1),e.translate=lr(n.min,n.max,e.origin)-e.originPoint,(w4(e.translate)||isNaN(e.translate))&&(e.translate=0)}function rm(e,t,n,r){p7(e.x,t.x,n.x,r?r.originX:void 0),p7(e.y,t.y,n.y,r?r.originY:void 0)}function g7(e,t,n){e.min=n.min+t.min,e.max=e.min+Jo(t)}function DNe(e,t,n){g7(e.x,t.x,n.x),g7(e.y,t.y,n.y)}function m7(e,t,n){e.min=t.min-n.min,e.max=e.min+Jo(t)}function im(e,t,n){m7(e.x,t.x,n.x),m7(e.y,t.y,n.y)}function LNe(e,{min:t,max:n},r){return t!==void 0&&en&&(e=r?lr(n,e,r.max):Math.min(e,n)),e}function y7(e,t,n){return{min:t!==void 0?e.min+t:void 0,max:n!==void 0?e.max+n-(e.max-e.min):void 0}}function FNe(e,{top:t,left:n,bottom:r,right:i}){return{x:y7(e.x,n,i),y:y7(e.y,t,r)}}function v7(e,t){let n=t.min-e.min,r=t.max-e.max;return t.max-t.minr?n=R0(t.min,t.max-r,e.min):r>i&&(n=R0(e.min,e.max-i,t.min)),fc(0,1,n)}function jNe(e,t){const n={};return t.min!==void 0&&(n.min=t.min-e.min),t.max!==void 0&&(n.max=t.max-e.min),n}const C4=.35;function UNe(e=C4){return e===!1?e=0:e===!0&&(e=C4),{x:b7(e,"left","right"),y:b7(e,"top","bottom")}}function b7(e,t,n){return{min:_7(e,t),max:_7(e,n)}}function _7(e,t){return typeof e=="number"?e:e[t]||0}const S7=()=>({translate:0,scale:1,origin:0,originPoint:0}),Qf=()=>({x:S7(),y:S7()}),x7=()=>({min:0,max:0}),Nr=()=>({x:x7(),y:x7()});function Ss(e){return[e("x"),e("y")]}function vW({top:e,left:t,right:n,bottom:r}){return{x:{min:t,max:n},y:{min:e,max:r}}}function VNe({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}function GNe(e,t){if(!t)return e;const n=t({x:e.left,y:e.top}),r=t({x:e.right,y:e.bottom});return{top:n.y,left:n.x,bottom:r.y,right:r.x}}function M5(e){return e===void 0||e===1}function E4({scale:e,scaleX:t,scaleY:n}){return!M5(e)||!M5(t)||!M5(n)}function Vc(e){return E4(e)||bW(e)||e.z||e.rotate||e.rotateX||e.rotateY}function bW(e){return w7(e.x)||w7(e.y)}function w7(e){return e&&e!=="0%"}function nS(e,t,n){const r=e-n,i=t*r;return n+i}function C7(e,t,n,r,i){return i!==void 0&&(e=nS(e,i,r)),nS(e,n,r)+t}function k4(e,t=0,n=1,r,i){e.min=C7(e.min,t,n,r,i),e.max=C7(e.max,t,n,r,i)}function _W(e,{x:t,y:n}){k4(e.x,t.translate,t.scale,t.originPoint),k4(e.y,n.translate,n.scale,n.originPoint)}function HNe(e,t,n,r=!1){const i=n.length;if(!i)return;t.x=t.y=1;let o,a;for(let s=0;s1.0000000000001||e<.999999999999?e:1}function bu(e,t){e.min=e.min+t,e.max=e.max+t}function k7(e,t,[n,r,i]){const o=t[i]!==void 0?t[i]:.5,a=lr(e.min,e.max,o);k4(e,t[n],t[r],a,t.scale)}const qNe=["x","scaleX","originX"],WNe=["y","scaleY","originY"];function Xf(e,t){k7(e.x,t,qNe),k7(e.y,t,WNe)}function SW(e,t){return vW(GNe(e.getBoundingClientRect(),t))}function KNe(e,t,n){const r=SW(e,n),{scroll:i}=t;return i&&(bu(r.x,i.offset.x),bu(r.y,i.offset.y)),r}const QNe=new WeakMap;class XNe{constructor(t){this.openGlobalLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=Nr(),this.visualElement=t}start(t,{snapToCursor:n=!1}={}){const{presenceContext:r}=this.visualElement;if(r&&r.isPresent===!1)return;const i=l=>{this.stopAnimation(),n&&this.snapToCursor(dw(l,"page").point)},o=(l,u)=>{const{drag:c,dragPropagation:d,onDragStart:f}=this.getProps();if(c&&!d&&(this.openGlobalLock&&this.openGlobalLock(),this.openGlobalLock=Nq(c),!this.openGlobalLock))return;this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),Ss(p=>{let m=this.getAxisMotionValue(p).get()||0;if(Ws.test(m)){const{projection:_}=this.visualElement;if(_&&_.layout){const b=_.layout.layoutBox[p];b&&(m=Jo(b)*(parseFloat(m)/100))}}this.originPoint[p]=m}),f&&$n.update(()=>f(l,u),!1,!0);const{animationState:h}=this.visualElement;h&&h.setActive("whileDrag",!0)},a=(l,u)=>{const{dragPropagation:c,dragDirectionLock:d,onDirectionLock:f,onDrag:h}=this.getProps();if(!c&&!this.openGlobalLock)return;const{offset:p}=u;if(d&&this.currentDirection===null){this.currentDirection=YNe(p),this.currentDirection!==null&&f&&f(this.currentDirection);return}this.updateAxis("x",u.point,p),this.updateAxis("y",u.point,p),this.visualElement.render(),h&&h(l,u)},s=(l,u)=>this.stop(l,u);this.panSession=new mW(t,{onSessionStart:i,onStart:o,onMove:a,onSessionEnd:s},{transformPagePoint:this.visualElement.getTransformPagePoint()})}stop(t,n){const r=this.isDragging;if(this.cancel(),!r)return;const{velocity:i}=n;this.startAnimation(i);const{onDragEnd:o}=this.getProps();o&&$n.update(()=>o(t,n))}cancel(){this.isDragging=!1;const{projection:t,animationState:n}=this.visualElement;t&&(t.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;const{dragPropagation:r}=this.getProps();!r&&this.openGlobalLock&&(this.openGlobalLock(),this.openGlobalLock=null),n&&n.setActive("whileDrag",!1)}updateAxis(t,n,r){const{drag:i}=this.getProps();if(!r||!i1(t,i,this.currentDirection))return;const o=this.getAxisMotionValue(t);let a=this.originPoint[t]+r[t];this.constraints&&this.constraints[t]&&(a=LNe(a,this.constraints[t],this.elastic[t])),o.set(a)}resolveConstraints(){const{dragConstraints:t,dragElastic:n}=this.getProps(),{layout:r}=this.visualElement.projection||{},i=this.constraints;t&&Wf(t)?this.constraints||(this.constraints=this.resolveRefConstraints()):t&&r?this.constraints=FNe(r.layoutBox,t):this.constraints=!1,this.elastic=UNe(n),i!==this.constraints&&r&&this.constraints&&!this.hasMutatedConstraints&&Ss(o=>{this.getAxisMotionValue(o)&&(this.constraints[o]=jNe(r.layoutBox[o],this.constraints[o]))})}resolveRefConstraints(){const{dragConstraints:t,onMeasureDragConstraints:n}=this.getProps();if(!t||!Wf(t))return!1;const r=t.current,{projection:i}=this.visualElement;if(!i||!i.layout)return!1;const o=KNe(r,i.root,this.visualElement.getTransformPagePoint());let a=BNe(i.layout.layoutBox,o);if(n){const s=n(VNe(a));this.hasMutatedConstraints=!!s,s&&(a=vW(s))}return a}startAnimation(t){const{drag:n,dragMomentum:r,dragElastic:i,dragTransition:o,dragSnapToOrigin:a,onDragTransitionEnd:s}=this.getProps(),l=this.constraints||{},u=Ss(c=>{if(!i1(c,n,this.currentDirection))return;let d=l&&l[c]||{};a&&(d={min:0,max:0});const f=i?200:1e6,h=i?40:1e7,p={type:"inertia",velocity:r?t[c]:0,bounceStiffness:f,bounceDamping:h,timeConstant:750,restDelta:1,restSpeed:10,...o,...d};return this.startAxisValueAnimation(c,p)});return Promise.all(u).then(s)}startAxisValueAnimation(t,n){const r=this.getAxisMotionValue(t);return r.start(gP(t,r,0,n))}stopAnimation(){Ss(t=>this.getAxisMotionValue(t).stop())}getAxisMotionValue(t){const n="_drag"+t.toUpperCase(),r=this.visualElement.getProps(),i=r[n];return i||this.visualElement.getValue(t,(r.initial?r.initial[t]:void 0)||0)}snapToCursor(t){Ss(n=>{const{drag:r}=this.getProps();if(!i1(n,r,this.currentDirection))return;const{projection:i}=this.visualElement,o=this.getAxisMotionValue(n);if(i&&i.layout){const{min:a,max:s}=i.layout.layoutBox[n];o.set(t[n]-lr(a,s,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:t,dragConstraints:n}=this.getProps(),{projection:r}=this.visualElement;if(!Wf(n)||!r||!this.constraints)return;this.stopAnimation();const i={x:0,y:0};Ss(a=>{const s=this.getAxisMotionValue(a);if(s){const l=s.get();i[a]=zNe({min:l,max:l},this.constraints[a])}});const{transformTemplate:o}=this.visualElement.getProps();this.visualElement.current.style.transform=o?o({},""):"none",r.root&&r.root.updateScroll(),r.updateLayout(),this.resolveConstraints(),Ss(a=>{if(!i1(a,t,null))return;const s=this.getAxisMotionValue(a),{min:l,max:u}=this.constraints[a];s.set(lr(l,u,i[a]))})}addListeners(){if(!this.visualElement.current)return;QNe.set(this.visualElement,this);const t=this.visualElement.current,n=Dl(t,"pointerdown",l=>{const{drag:u,dragListener:c=!0}=this.getProps();u&&c&&this.start(l)}),r=()=>{const{dragConstraints:l}=this.getProps();Wf(l)&&(this.constraints=this.resolveRefConstraints())},{projection:i}=this.visualElement,o=i.addEventListener("measure",r);i&&!i.layout&&(i.root&&i.root.updateScroll(),i.updateLayout()),r();const a=Rl(window,"resize",()=>this.scalePositionWithinConstraints()),s=i.addEventListener("didUpdate",({delta:l,hasLayoutChanged:u})=>{this.isDragging&&u&&(Ss(c=>{const d=this.getAxisMotionValue(c);d&&(this.originPoint[c]+=l[c].translate,d.set(d.get()+l[c].translate))}),this.visualElement.render())});return()=>{a(),n(),o(),s&&s()}}getProps(){const t=this.visualElement.getProps(),{drag:n=!1,dragDirectionLock:r=!1,dragPropagation:i=!1,dragConstraints:o=!1,dragElastic:a=C4,dragMomentum:s=!0}=t;return{...t,drag:n,dragDirectionLock:r,dragPropagation:i,dragConstraints:o,dragElastic:a,dragMomentum:s}}}function i1(e,t,n){return(t===!0||t===e)&&(n===null||n===e)}function YNe(e,t=10){let n=null;return Math.abs(e.y)>t?n="y":Math.abs(e.x)>t&&(n="x"),n}class ZNe extends Pc{constructor(t){super(t),this.removeGroupControls=yr,this.removeListeners=yr,this.controls=new XNe(t)}mount(){const{dragControls:t}=this.node.getProps();t&&(this.removeGroupControls=t.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||yr}unmount(){this.removeGroupControls(),this.removeListeners()}}const T7=e=>(t,n)=>{e&&$n.update(()=>e(t,n))};class JNe extends Pc{constructor(){super(...arguments),this.removePointerDownListener=yr}onPointerDown(t){this.session=new mW(t,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint()})}createPanHandlers(){const{onPanSessionStart:t,onPanStart:n,onPan:r,onPanEnd:i}=this.node.getProps();return{onSessionStart:T7(t),onStart:T7(n),onMove:r,onEnd:(o,a)=>{delete this.session,i&&$n.update(()=>i(o,a))}}}mount(){this.removePointerDownListener=Dl(this.node.current,"pointerdown",t=>this.onPointerDown(t))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}function e$e(){const e=I.useContext(My);if(e===null)return[!0,null];const{isPresent:t,onExitComplete:n,register:r}=e,i=I.useId();return I.useEffect(()=>r(i),[]),!t&&n?[!1,()=>n&&n(i)]:[!0]}function t$e(){return n$e(I.useContext(My))}function n$e(e){return e===null?!0:e.isPresent}const ob={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function A7(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}const lg={correct:(e,t)=>{if(!t.target)return e;if(typeof e=="string")if(at.test(e))e=parseFloat(e);else return e;const n=A7(e,t.target.x),r=A7(e,t.target.y);return`${n}% ${r}%`}},r$e={correct:(e,{treeScale:t,projectionDelta:n})=>{const r=e,i=hc.parse(e);if(i.length>5)return r;const o=hc.createTransformer(e),a=typeof i[0]!="number"?1:0,s=n.x.scale*t.x,l=n.y.scale*t.y;i[0+a]/=s,i[1+a]/=l;const u=lr(s,l,.5);return typeof i[2+a]=="number"&&(i[2+a]/=u),typeof i[3+a]=="number"&&(i[3+a]/=u),o(i)}};class i$e extends En.Component{componentDidMount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:r,layoutId:i}=this.props,{projection:o}=t;uMe(o$e),o&&(n.group&&n.group.add(o),r&&r.register&&i&&r.register(o),o.root.didUpdate(),o.addEventListener("animationComplete",()=>{this.safeToRemove()}),o.setOptions({...o.options,onExitComplete:()=>this.safeToRemove()})),ob.hasEverUpdated=!0}getSnapshotBeforeUpdate(t){const{layoutDependency:n,visualElement:r,drag:i,isPresent:o}=this.props,a=r.projection;return a&&(a.isPresent=o,i||t.layoutDependency!==n||n===void 0?a.willUpdate():this.safeToRemove(),t.isPresent!==o&&(o?a.promote():a.relegate()||$n.postRender(()=>{const s=a.getStack();(!s||!s.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:t}=this.props.visualElement;t&&(t.root.didUpdate(),queueMicrotask(()=>{!t.currentAnimation&&t.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:r}=this.props,{projection:i}=t;i&&(i.scheduleCheckAfterUnmount(),n&&n.group&&n.group.remove(i),r&&r.deregister&&r.deregister(i))}safeToRemove(){const{safeToRemove:t}=this.props;t&&t()}render(){return null}}function xW(e){const[t,n]=e$e(),r=I.useContext(tP);return En.createElement(i$e,{...e,layoutGroup:r,switchLayoutGroup:I.useContext(yq),isPresent:t,safeToRemove:n})}const o$e={borderRadius:{...lg,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:lg,borderTopRightRadius:lg,borderBottomLeftRadius:lg,borderBottomRightRadius:lg,boxShadow:r$e},wW=["TopLeft","TopRight","BottomLeft","BottomRight"],a$e=wW.length,P7=e=>typeof e=="string"?parseFloat(e):e,I7=e=>typeof e=="number"||at.test(e);function s$e(e,t,n,r,i,o){i?(e.opacity=lr(0,n.opacity!==void 0?n.opacity:1,l$e(r)),e.opacityExit=lr(t.opacity!==void 0?t.opacity:1,0,u$e(r))):o&&(e.opacity=lr(t.opacity!==void 0?t.opacity:1,n.opacity!==void 0?n.opacity:1,r));for(let a=0;art?1:n(R0(e,t,r))}function O7(e,t){e.min=t.min,e.max=t.max}function ua(e,t){O7(e.x,t.x),O7(e.y,t.y)}function M7(e,t,n,r,i){return e-=t,e=nS(e,1/n,r),i!==void 0&&(e=nS(e,1/i,r)),e}function c$e(e,t=0,n=1,r=.5,i,o=e,a=e){if(Ws.test(t)&&(t=parseFloat(t),t=lr(a.min,a.max,t/100)-a.min),typeof t!="number")return;let s=lr(o.min,o.max,r);e===o&&(s-=t),e.min=M7(e.min,t,n,s,i),e.max=M7(e.max,t,n,s,i)}function N7(e,t,[n,r,i],o,a){c$e(e,t[n],t[r],t[i],t.scale,o,a)}const d$e=["x","scaleX","originX"],f$e=["y","scaleY","originY"];function $7(e,t,n,r){N7(e.x,t,d$e,n?n.x:void 0,r?r.x:void 0),N7(e.y,t,f$e,n?n.y:void 0,r?r.y:void 0)}function D7(e){return e.translate===0&&e.scale===1}function EW(e){return D7(e.x)&&D7(e.y)}function h$e(e,t){return e.x.min===t.x.min&&e.x.max===t.x.max&&e.y.min===t.y.min&&e.y.max===t.y.max}function kW(e,t){return Math.round(e.x.min)===Math.round(t.x.min)&&Math.round(e.x.max)===Math.round(t.x.max)&&Math.round(e.y.min)===Math.round(t.y.min)&&Math.round(e.y.max)===Math.round(t.y.max)}function L7(e){return Jo(e.x)/Jo(e.y)}class p$e{constructor(){this.members=[]}add(t){mP(this.members,t),t.scheduleRender()}remove(t){if(yP(this.members,t),t===this.prevLead&&(this.prevLead=void 0),t===this.lead){const n=this.members[this.members.length-1];n&&this.promote(n)}}relegate(t){const n=this.members.findIndex(i=>t===i);if(n===0)return!1;let r;for(let i=n;i>=0;i--){const o=this.members[i];if(o.isPresent!==!1){r=o;break}}return r?(this.promote(r),!0):!1}promote(t,n){const r=this.lead;if(t!==r&&(this.prevLead=r,this.lead=t,t.show(),r)){r.instance&&r.scheduleRender(),t.scheduleRender(),t.resumeFrom=r,n&&(t.resumeFrom.preserveOpacity=!0),r.snapshot&&(t.snapshot=r.snapshot,t.snapshot.latestValues=r.animationValues||r.latestValues),t.root&&t.root.isUpdating&&(t.isLayoutDirty=!0);const{crossfade:i}=t.options;i===!1&&r.hide()}}exitAnimationComplete(){this.members.forEach(t=>{const{options:n,resumingFrom:r}=t;n.onExitComplete&&n.onExitComplete(),r&&r.options.onExitComplete&&r.options.onExitComplete()})}scheduleRender(){this.members.forEach(t=>{t.instance&&t.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}function F7(e,t,n){let r="";const i=e.x.translate/t.x,o=e.y.translate/t.y;if((i||o)&&(r=`translate3d(${i}px, ${o}px, 0) `),(t.x!==1||t.y!==1)&&(r+=`scale(${1/t.x}, ${1/t.y}) `),n){const{rotate:l,rotateX:u,rotateY:c}=n;l&&(r+=`rotate(${l}deg) `),u&&(r+=`rotateX(${u}deg) `),c&&(r+=`rotateY(${c}deg) `)}const a=e.x.scale*t.x,s=e.y.scale*t.y;return(a!==1||s!==1)&&(r+=`scale(${a}, ${s})`),r||"none"}const g$e=(e,t)=>e.depth-t.depth;class m$e{constructor(){this.children=[],this.isDirty=!1}add(t){mP(this.children,t),this.isDirty=!0}remove(t){yP(this.children,t),this.isDirty=!0}forEach(t){this.isDirty&&this.children.sort(g$e),this.isDirty=!1,this.children.forEach(t)}}function y$e(e,t){const n=performance.now(),r=({timestamp:i})=>{const o=i-n;o>=t&&(Kl(r),e(o-t))};return $n.read(r,!0),()=>Kl(r)}function v$e(e){window.MotionDebug&&window.MotionDebug.record(e)}function b$e(e){return e instanceof SVGElement&&e.tagName!=="svg"}function _$e(e,t,n){const r=Mo(e)?e:lp(e);return r.start(gP("",r,t,n)),r.animation}const B7=["","X","Y","Z"],z7=1e3;let S$e=0;const Gc={type:"projectionFrame",totalNodes:0,resolvedTargetDeltas:0,recalculatedProjection:0};function TW({attachResizeListener:e,defaultParent:t,measureScroll:n,checkIsScrollRoot:r,resetTransform:i}){return class{constructor(a={},s=t==null?void 0:t()){this.id=S$e++,this.animationId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.updateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{Gc.totalNodes=Gc.resolvedTargetDeltas=Gc.recalculatedProjection=0,this.nodes.forEach(C$e),this.nodes.forEach(P$e),this.nodes.forEach(I$e),this.nodes.forEach(E$e),v$e(Gc)},this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=a,this.root=s?s.root||s:this,this.path=s?[...s.path,s]:[],this.parent=s,this.depth=s?s.depth+1:0;for(let l=0;lthis.root.updateBlockedByResize=!1;e(a,()=>{this.root.updateBlockedByResize=!0,d&&d(),d=y$e(f,250),ob.hasAnimatedSinceResize&&(ob.hasAnimatedSinceResize=!1,this.nodes.forEach(U7))})}l&&this.root.registerSharedNode(l,this),this.options.animate!==!1&&c&&(l||u)&&this.addEventListener("didUpdate",({delta:d,hasLayoutChanged:f,hasRelativeTargetChanged:h,layout:p})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const m=this.options.transition||c.getDefaultTransition()||$$e,{onLayoutAnimationStart:_,onLayoutAnimationComplete:b}=c.getProps(),v=!this.targetLayout||!kW(this.targetLayout,p)||h,g=!f&&h;if(this.options.layoutRoot||this.resumeFrom&&this.resumeFrom.instance||g||f&&(v||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0),this.setAnimationOrigin(d,g);const y={...dW(m,"layout"),onPlay:_,onComplete:b};(c.shouldReduceMotion||this.options.layoutRoot)&&(y.delay=0,y.type=!1),this.startAnimation(y)}else f||U7(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=p})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const a=this.getStack();a&&a.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,Kl(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(R$e),this.animationId++)}getTransformTemplate(){const{visualElement:a}=this.options;return a&&a.getProps().transformTemplate}willUpdate(a=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let c=0;cthis.update()))}clearAllSnapshots(){this.nodes.forEach(k$e),this.sharedNodes.forEach(O$e)}scheduleUpdateProjection(){$n.preRender(this.updateProjection,!1,!0)}scheduleCheckAfterUnmount(){$n.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure())}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let l=0;l{const S=y/1e3;V7(d.x,a.x,S),V7(d.y,a.y,S),this.setTargetDelta(d),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(im(f,this.layout.layoutBox,this.relativeParent.layout.layoutBox),M$e(this.relativeTarget,this.relativeTargetOrigin,f,S),g&&h$e(this.relativeTarget,g)&&(this.isProjectionDirty=!1),g||(g=Nr()),ua(g,this.relativeTarget)),m&&(this.animationValues=c,s$e(c,u,this.latestValues,S,v,b)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=S},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(a){this.notifyListeners("animationStart"),this.currentAnimation&&this.currentAnimation.stop(),this.resumingFrom&&this.resumingFrom.currentAnimation&&this.resumingFrom.currentAnimation.stop(),this.pendingAnimation&&(Kl(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=$n.update(()=>{ob.hasAnimatedSinceResize=!0,this.currentAnimation=_$e(0,z7,{...a,onUpdate:s=>{this.mixTargetDelta(s),a.onUpdate&&a.onUpdate(s)},onComplete:()=>{a.onComplete&&a.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const a=this.getStack();a&&a.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(z7),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const a=this.getLead();let{targetWithTransforms:s,target:l,layout:u,latestValues:c}=a;if(!(!s||!l||!u)){if(this!==a&&this.layout&&u&&AW(this.options.animationType,this.layout.layoutBox,u.layoutBox)){l=this.target||Nr();const d=Jo(this.layout.layoutBox.x);l.x.min=a.target.x.min,l.x.max=l.x.min+d;const f=Jo(this.layout.layoutBox.y);l.y.min=a.target.y.min,l.y.max=l.y.min+f}ua(s,l),Xf(s,c),rm(this.projectionDeltaWithTransform,this.layoutCorrected,s,c)}}registerSharedNode(a,s){this.sharedNodes.has(a)||this.sharedNodes.set(a,new p$e),this.sharedNodes.get(a).add(s);const u=s.options.initialPromotionConfig;s.promote({transition:u?u.transition:void 0,preserveFollowOpacity:u&&u.shouldPreserveFollowOpacity?u.shouldPreserveFollowOpacity(s):void 0})}isLead(){const a=this.getStack();return a?a.lead===this:!0}getLead(){var a;const{layoutId:s}=this.options;return s?((a=this.getStack())===null||a===void 0?void 0:a.lead)||this:this}getPrevLead(){var a;const{layoutId:s}=this.options;return s?(a=this.getStack())===null||a===void 0?void 0:a.prevLead:void 0}getStack(){const{layoutId:a}=this.options;if(a)return this.root.sharedNodes.get(a)}promote({needsReset:a,transition:s,preserveFollowOpacity:l}={}){const u=this.getStack();u&&u.promote(this,l),a&&(this.projectionDelta=void 0,this.needsReset=!0),s&&this.setOptions({transition:s})}relegate(){const a=this.getStack();return a?a.relegate(this):!1}resetRotation(){const{visualElement:a}=this.options;if(!a)return;let s=!1;const{latestValues:l}=a;if((l.rotate||l.rotateX||l.rotateY||l.rotateZ)&&(s=!0),!s)return;const u={};for(let c=0;c{var s;return(s=a.currentAnimation)===null||s===void 0?void 0:s.stop()}),this.root.nodes.forEach(j7),this.root.sharedNodes.clear()}}}function x$e(e){e.updateLayout()}function w$e(e){var t;const n=((t=e.resumeFrom)===null||t===void 0?void 0:t.snapshot)||e.snapshot;if(e.isLead()&&e.layout&&n&&e.hasListeners("didUpdate")){const{layoutBox:r,measuredBox:i}=e.layout,{animationType:o}=e.options,a=n.source!==e.layout.source;o==="size"?Ss(d=>{const f=a?n.measuredBox[d]:n.layoutBox[d],h=Jo(f);f.min=r[d].min,f.max=f.min+h}):AW(o,n.layoutBox,r)&&Ss(d=>{const f=a?n.measuredBox[d]:n.layoutBox[d],h=Jo(r[d]);f.max=f.min+h,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[d].max=e.relativeTarget[d].min+h)});const s=Qf();rm(s,r,n.layoutBox);const l=Qf();a?rm(l,e.applyTransform(i,!0),n.measuredBox):rm(l,r,n.layoutBox);const u=!EW(s);let c=!1;if(!e.resumeFrom){const d=e.getClosestProjectingParent();if(d&&!d.resumeFrom){const{snapshot:f,layout:h}=d;if(f&&h){const p=Nr();im(p,n.layoutBox,f.layoutBox);const m=Nr();im(m,r,h.layoutBox),kW(p,m)||(c=!0),d.options.layoutRoot&&(e.relativeTarget=m,e.relativeTargetOrigin=p,e.relativeParent=d)}}}e.notifyListeners("didUpdate",{layout:r,snapshot:n,delta:l,layoutDelta:s,hasLayoutChanged:u,hasRelativeTargetChanged:c})}else if(e.isLead()){const{onExitComplete:r}=e.options;r&&r()}e.options.transition=void 0}function C$e(e){Gc.totalNodes++,e.parent&&(e.isProjecting()||(e.isProjectionDirty=e.parent.isProjectionDirty),e.isSharedProjectionDirty||(e.isSharedProjectionDirty=!!(e.isProjectionDirty||e.parent.isProjectionDirty||e.parent.isSharedProjectionDirty)),e.isTransformDirty||(e.isTransformDirty=e.parent.isTransformDirty))}function E$e(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function k$e(e){e.clearSnapshot()}function j7(e){e.clearMeasurements()}function T$e(e){e.isLayoutDirty=!1}function A$e(e){const{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify("BeforeLayoutMeasure"),e.resetTransform()}function U7(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function P$e(e){e.resolveTargetDelta()}function I$e(e){e.calcProjection()}function R$e(e){e.resetRotation()}function O$e(e){e.removeLeadSnapshot()}function V7(e,t,n){e.translate=lr(t.translate,0,n),e.scale=lr(t.scale,1,n),e.origin=t.origin,e.originPoint=t.originPoint}function G7(e,t,n,r){e.min=lr(t.min,n.min,r),e.max=lr(t.max,n.max,r)}function M$e(e,t,n,r){G7(e.x,t.x,n.x,r),G7(e.y,t.y,n.y,r)}function N$e(e){return e.animationValues&&e.animationValues.opacityExit!==void 0}const $$e={duration:.45,ease:[.4,0,.1,1]},H7=e=>typeof navigator<"u"&&navigator.userAgent.toLowerCase().includes(e),q7=H7("applewebkit/")&&!H7("chrome/")?Math.round:yr;function W7(e){e.min=q7(e.min),e.max=q7(e.max)}function D$e(e){W7(e.x),W7(e.y)}function AW(e,t,n){return e==="position"||e==="preserve-aspect"&&!w4(L7(t),L7(n),.2)}const L$e=TW({attachResizeListener:(e,t)=>Rl(e,"resize",t),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),N5={current:void 0},PW=TW({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!N5.current){const e=new L$e({});e.mount(window),e.setOptions({layoutScroll:!0}),N5.current=e}return N5.current},resetTransform:(e,t)=>{e.style.transform=t!==void 0?t:"none"},checkIsScrollRoot:e=>window.getComputedStyle(e).position==="fixed"}),F$e={pan:{Feature:JNe},drag:{Feature:ZNe,ProjectionNode:PW,MeasureLayout:xW}},B$e=/var\((--[a-zA-Z0-9-_]+),? ?([a-zA-Z0-9 ()%#.,-]+)?\)/;function z$e(e){const t=B$e.exec(e);if(!t)return[,];const[,n,r]=t;return[n,r]}function T4(e,t,n=1){const[r,i]=z$e(e);if(!r)return;const o=window.getComputedStyle(t).getPropertyValue(r);if(o){const a=o.trim();return fW(a)?parseFloat(a):a}else return m4(i)?T4(i,t,n+1):i}function j$e(e,{...t},n){const r=e.current;if(!(r instanceof Element))return{target:t,transitionEnd:n};n&&(n={...n}),e.values.forEach(i=>{const o=i.get();if(!m4(o))return;const a=T4(o,r);a&&i.set(a)});for(const i in t){const o=t[i];if(!m4(o))continue;const a=T4(o,r);a&&(t[i]=a,n||(n={}),n[i]===void 0&&(n[i]=o))}return{target:t,transitionEnd:n}}const U$e=new Set(["width","height","top","left","right","bottom","x","y","translateX","translateY"]),IW=e=>U$e.has(e),V$e=e=>Object.keys(e).some(IW),K7=e=>e===ef||e===at,Q7=(e,t)=>parseFloat(e.split(", ")[t]),X7=(e,t)=>(n,{transform:r})=>{if(r==="none"||!r)return 0;const i=r.match(/^matrix3d\((.+)\)$/);if(i)return Q7(i[1],t);{const o=r.match(/^matrix\((.+)\)$/);return o?Q7(o[1],e):0}},G$e=new Set(["x","y","z"]),H$e=Ny.filter(e=>!G$e.has(e));function q$e(e){const t=[];return H$e.forEach(n=>{const r=e.getValue(n);r!==void 0&&(t.push([n,r.get()]),r.set(n.startsWith("scale")?1:0))}),t.length&&e.render(),t}const up={width:({x:e},{paddingLeft:t="0",paddingRight:n="0"})=>e.max-e.min-parseFloat(t)-parseFloat(n),height:({y:e},{paddingTop:t="0",paddingBottom:n="0"})=>e.max-e.min-parseFloat(t)-parseFloat(n),top:(e,{top:t})=>parseFloat(t),left:(e,{left:t})=>parseFloat(t),bottom:({y:e},{top:t})=>parseFloat(t)+(e.max-e.min),right:({x:e},{left:t})=>parseFloat(t)+(e.max-e.min),x:X7(4,13),y:X7(5,14)};up.translateX=up.x;up.translateY=up.y;const W$e=(e,t,n)=>{const r=t.measureViewportBox(),i=t.current,o=getComputedStyle(i),{display:a}=o,s={};a==="none"&&t.setStaticValue("display",e.display||"block"),n.forEach(u=>{s[u]=up[u](r,o)}),t.render();const l=t.measureViewportBox();return n.forEach(u=>{const c=t.getValue(u);c&&c.jump(s[u]),e[u]=up[u](l,o)}),e},K$e=(e,t,n={},r={})=>{t={...t},r={...r};const i=Object.keys(t).filter(IW);let o=[],a=!1;const s=[];if(i.forEach(l=>{const u=e.getValue(l);if(!e.hasValue(l))return;let c=n[l],d=sg(c);const f=t[l];let h;if(Y_(f)){const p=f.length,m=f[0]===null?1:0;c=f[m],d=sg(c);for(let _=m;_=0?window.pageYOffset:null,u=W$e(t,e,s);return o.length&&o.forEach(([c,d])=>{e.getValue(c).set(d)}),e.render(),sw&&l!==null&&window.scrollTo({top:l}),{target:u,transitionEnd:r}}else return{target:t,transitionEnd:r}};function Q$e(e,t,n,r){return V$e(t)?K$e(e,t,n,r):{target:t,transitionEnd:r}}const X$e=(e,t,n,r)=>{const i=j$e(e,t,r);return t=i.target,r=i.transitionEnd,Q$e(e,t,n,r)},A4={current:null},RW={current:!1};function Y$e(){if(RW.current=!0,!!sw)if(window.matchMedia){const e=window.matchMedia("(prefers-reduced-motion)"),t=()=>A4.current=e.matches;e.addListener(t),t()}else A4.current=!1}function Z$e(e,t,n){const{willChange:r}=t;for(const i in t){const o=t[i],a=n[i];if(Mo(o))e.addValue(i,o),tS(r)&&r.add(i);else if(Mo(a))e.addValue(i,lp(o,{owner:e})),tS(r)&&r.remove(i);else if(a!==o)if(e.hasValue(i)){const s=e.getValue(i);!s.hasAnimated&&s.set(o)}else{const s=e.getStaticValue(i);e.addValue(i,lp(s!==void 0?s:o,{owner:e}))}}for(const i in n)t[i]===void 0&&e.removeValue(i);return t}const Y7=new WeakMap,OW=Object.keys(I0),J$e=OW.length,Z7=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"],eDe=eP.length;class tDe{constructor({parent:t,props:n,presenceContext:r,reducedMotionConfig:i,visualState:o},a={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.scheduleRender=()=>$n.render(this.render,!1,!0);const{latestValues:s,renderState:l}=o;this.latestValues=s,this.baseTarget={...s},this.initialValues=n.initial?{...s}:{},this.renderState=l,this.parent=t,this.props=n,this.presenceContext=r,this.depth=t?t.depth+1:0,this.reducedMotionConfig=i,this.options=a,this.isControllingVariants=uw(n),this.isVariantNode=mq(n),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(t&&t.current);const{willChange:u,...c}=this.scrapeMotionValuesFromProps(n,{});for(const d in c){const f=c[d];s[d]!==void 0&&Mo(f)&&(f.set(s[d],!1),tS(u)&&u.add(d))}}scrapeMotionValuesFromProps(t,n){return{}}mount(t){this.current=t,Y7.set(t,this),this.projection&&!this.projection.instance&&this.projection.mount(t),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((n,r)=>this.bindToMotionValue(r,n)),RW.current||Y$e(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:A4.current,this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){Y7.delete(this.current),this.projection&&this.projection.unmount(),Kl(this.notifyUpdate),Kl(this.render),this.valueSubscriptions.forEach(t=>t()),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent&&this.parent.children.delete(this);for(const t in this.events)this.events[t].clear();for(const t in this.features)this.features[t].unmount();this.current=null}bindToMotionValue(t,n){const r=Jd.has(t),i=n.on("change",a=>{this.latestValues[t]=a,this.props.onUpdate&&$n.update(this.notifyUpdate,!1,!0),r&&this.projection&&(this.projection.isTransformDirty=!0)}),o=n.on("renderRequest",this.scheduleRender);this.valueSubscriptions.set(t,()=>{i(),o()})}sortNodePosition(t){return!this.current||!this.sortInstanceNodePosition||this.type!==t.type?0:this.sortInstanceNodePosition(this.current,t.current)}loadFeatures({children:t,...n},r,i,o){let a,s;for(let l=0;lthis.scheduleRender(),animationType:typeof u=="string"?u:"both",initialPromotionConfig:o,layoutScroll:f,layoutRoot:h})}return s}updateFeatures(){for(const t in this.features){const n=this.features[t];n.isMounted?n.update():(n.mount(),n.isMounted=!0)}}triggerBuild(){this.build(this.renderState,this.latestValues,this.options,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):Nr()}getStaticValue(t){return this.latestValues[t]}setStaticValue(t,n){this.latestValues[t]=n}makeTargetAnimatable(t,n=!0){return this.makeTargetAnimatableFromInstance(t,this.props,n)}update(t,n){(t.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=t,this.prevPresenceContext=this.presenceContext,this.presenceContext=n;for(let r=0;rn.variantChildren.delete(t)}addValue(t,n){n!==this.values.get(t)&&(this.removeValue(t),this.bindToMotionValue(t,n)),this.values.set(t,n),this.latestValues[t]=n.get()}removeValue(t){this.values.delete(t);const n=this.valueSubscriptions.get(t);n&&(n(),this.valueSubscriptions.delete(t)),delete this.latestValues[t],this.removeValueFromRenderState(t,this.renderState)}hasValue(t){return this.values.has(t)}getValue(t,n){if(this.props.values&&this.props.values[t])return this.props.values[t];let r=this.values.get(t);return r===void 0&&n!==void 0&&(r=lp(n,{owner:this}),this.addValue(t,r)),r}readValue(t){var n;return this.latestValues[t]!==void 0||!this.current?this.latestValues[t]:(n=this.getBaseTargetFromProps(this.props,t))!==null&&n!==void 0?n:this.readValueFromInstance(this.current,t,this.options)}setBaseTarget(t,n){this.baseTarget[t]=n}getBaseTarget(t){var n;const{initial:r}=this.props,i=typeof r=="string"||typeof r=="object"?(n=uP(this.props,r))===null||n===void 0?void 0:n[t]:void 0;if(r&&i!==void 0)return i;const o=this.getBaseTargetFromProps(this.props,t);return o!==void 0&&!Mo(o)?o:this.initialValues[t]!==void 0&&i===void 0?void 0:this.baseTarget[t]}on(t,n){return this.events[t]||(this.events[t]=new vP),this.events[t].add(n)}notify(t,...n){this.events[t]&&this.events[t].notify(...n)}}class MW extends tDe{sortInstanceNodePosition(t,n){return t.compareDocumentPosition(n)&2?1:-1}getBaseTargetFromProps(t,n){return t.style?t.style[n]:void 0}removeValueFromRenderState(t,{vars:n,style:r}){delete n[t],delete r[t]}makeTargetAnimatableFromInstance({transition:t,transitionEnd:n,...r},{transformValues:i},o){let a=vNe(r,t||{},this);if(i&&(n&&(n=i(n)),r&&(r=i(r)),a&&(a=i(a))),o){mNe(this,r,a);const s=X$e(this,r,a,n);n=s.transitionEnd,r=s.target}return{transition:t,transitionEnd:n,...r}}}function nDe(e){return window.getComputedStyle(e)}class rDe extends MW{readValueFromInstance(t,n){if(Jd.has(n)){const r=pP(n);return r&&r.default||0}else{const r=nDe(t),i=(_q(n)?r.getPropertyValue(n):r[n])||0;return typeof i=="string"?i.trim():i}}measureInstanceViewportBox(t,{transformPagePoint:n}){return SW(t,n)}build(t,n,r,i){rP(t,n,r,i.transformTemplate)}scrapeMotionValuesFromProps(t,n){return lP(t,n)}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:t}=this.props;Mo(t)&&(this.childSubscription=t.on("change",n=>{this.current&&(this.current.textContent=`${n}`)}))}renderInstance(t,n,r,i){kq(t,n,r,i)}}class iDe extends MW{constructor(){super(...arguments),this.isSVGTag=!1}getBaseTargetFromProps(t,n){return t[n]}readValueFromInstance(t,n){if(Jd.has(n)){const r=pP(n);return r&&r.default||0}return n=Tq.has(n)?n:sP(n),t.getAttribute(n)}measureInstanceViewportBox(){return Nr()}scrapeMotionValuesFromProps(t,n){return Pq(t,n)}build(t,n,r,i){oP(t,n,r,this.isSVGTag,i.transformTemplate)}renderInstance(t,n,r,i){Aq(t,n,r,i)}mount(t){this.isSVGTag=aP(t.tagName),super.mount(t)}}const oDe=(e,t)=>nP(e)?new iDe(t,{enableHardwareAcceleration:!1}):new rDe(t,{enableHardwareAcceleration:!0}),aDe={layout:{ProjectionNode:PW,MeasureLayout:xW}},sDe={...ONe,...ZMe,...F$e,...aDe},NW=sMe((e,t)=>BMe(e,t,sDe,oDe));function $W(){const e=I.useRef(!1);return ZA(()=>(e.current=!0,()=>{e.current=!1}),[]),e}function lDe(){const e=$W(),[t,n]=I.useState(0),r=I.useCallback(()=>{e.current&&n(t+1)},[t]);return[I.useCallback(()=>$n.postRender(r),[r]),t]}class uDe extends I.Component{getSnapshotBeforeUpdate(t){const n=this.props.childRef.current;if(n&&t.isPresent&&!this.props.isPresent){const r=this.props.sizeRef.current;r.height=n.offsetHeight||0,r.width=n.offsetWidth||0,r.top=n.offsetTop,r.left=n.offsetLeft}return null}componentDidUpdate(){}render(){return this.props.children}}function cDe({children:e,isPresent:t}){const n=I.useId(),r=I.useRef(null),i=I.useRef({width:0,height:0,top:0,left:0});return I.useInsertionEffect(()=>{const{width:o,height:a,top:s,left:l}=i.current;if(t||!r.current||!o||!a)return;r.current.dataset.motionPopId=n;const u=document.createElement("style");return document.head.appendChild(u),u.sheet&&u.sheet.insertRule(` - [data-motion-pop-id="${n}"] { - position: absolute !important; - width: ${o}px !important; - height: ${a}px !important; - top: ${s}px !important; - left: ${l}px !important; - } - `),()=>{document.head.removeChild(u)}},[t]),I.createElement(uDe,{isPresent:t,childRef:r,sizeRef:i},I.cloneElement(e,{ref:r}))}const $5=({children:e,initial:t,isPresent:n,onExitComplete:r,custom:i,presenceAffectsLayout:o,mode:a})=>{const s=Iq(dDe),l=I.useId(),u=I.useMemo(()=>({id:l,initial:t,isPresent:n,custom:i,onExitComplete:c=>{s.set(c,!0);for(const d of s.values())if(!d)return;r&&r()},register:c=>(s.set(c,!1),()=>s.delete(c))}),o?void 0:[n]);return I.useMemo(()=>{s.forEach((c,d)=>s.set(d,!1))},[n]),I.useEffect(()=>{!n&&!s.size&&r&&r()},[n]),a==="popLayout"&&(e=I.createElement(cDe,{isPresent:n},e)),I.createElement(My.Provider,{value:u},e)};function dDe(){return new Map}function fDe(e){return I.useEffect(()=>()=>e(),[])}const kf=e=>e.key||"";function hDe(e,t){e.forEach(n=>{const r=kf(n);t.set(r,n)})}function pDe(e){const t=[];return I.Children.forEach(e,n=>{I.isValidElement(n)&&t.push(n)}),t}const DW=({children:e,custom:t,initial:n=!0,onExitComplete:r,exitBeforeEnter:i,presenceAffectsLayout:o=!0,mode:a="sync"})=>{const s=I.useContext(tP).forceRender||lDe()[0],l=$W(),u=pDe(e);let c=u;const d=I.useRef(new Map).current,f=I.useRef(c),h=I.useRef(new Map).current,p=I.useRef(!0);if(ZA(()=>{p.current=!1,hDe(u,h),f.current=c}),fDe(()=>{p.current=!0,h.clear(),d.clear()}),p.current)return I.createElement(I.Fragment,null,c.map(v=>I.createElement($5,{key:kf(v),isPresent:!0,initial:n?void 0:!1,presenceAffectsLayout:o,mode:a},v)));c=[...c];const m=f.current.map(kf),_=u.map(kf),b=m.length;for(let v=0;v{if(_.indexOf(g)!==-1)return;const y=h.get(g);if(!y)return;const S=m.indexOf(g);let w=v;if(!w){const x=()=>{h.delete(g),d.delete(g);const C=f.current.findIndex(T=>T.key===g);if(f.current.splice(C,1),!d.size){if(f.current=u,l.current===!1)return;s(),r&&r()}};w=I.createElement($5,{key:kf(y),isPresent:!1,onExitComplete:x,custom:t,presenceAffectsLayout:o,mode:a},y),d.set(g,w)}c.splice(S,0,w)}),c=c.map(v=>{const g=v.key;return d.has(g)?v:I.createElement($5,{key:kf(v),isPresent:!0,presenceAffectsLayout:o,mode:a},v)}),I.createElement(I.Fragment,null,d.size?c:c.map(v=>I.cloneElement(v)))};var gDe={initial:e=>{const{position:t}=e,n=["top","bottom"].includes(t)?"y":"x";let r=["top-right","bottom-right"].includes(t)?1:-1;return t==="bottom"&&(r=1),{opacity:0,[n]:r*24}},animate:{opacity:1,y:0,x:0,scale:1,transition:{duration:.4,ease:[.4,0,.2,1]}},exit:{opacity:0,scale:.85,transition:{duration:.2,ease:[.4,0,1,1]}}},LW=I.memo(e=>{const{id:t,message:n,onCloseComplete:r,onRequestRemove:i,requestClose:o=!1,position:a="bottom",duration:s=5e3,containerStyle:l,motionVariants:u=gDe,toastSpacing:c="0.5rem"}=e,[d,f]=I.useState(s),h=t$e();QM(()=>{h||r==null||r()},[h]),QM(()=>{f(s)},[s]);const p=()=>f(null),m=()=>f(s),_=()=>{h&&i()};I.useEffect(()=>{h&&o&&i()},[h,o,i]),ZOe(_,d);const b=I.useMemo(()=>({pointerEvents:"auto",maxWidth:560,minWidth:300,margin:c,...l}),[l,c]),v=I.useMemo(()=>QOe(a),[a]);return W.jsx(NW.div,{layout:!0,className:"chakra-toast",variants:u,initial:"initial",animate:"animate",exit:"exit",onHoverStart:p,onHoverEnd:m,custom:{position:a},style:v,children:W.jsx(Oi.div,{role:"status","aria-atomic":"true",className:"chakra-toast__inner",__css:b,children:$s(n,{id:t,onClose:_})})})});LW.displayName="ToastComponent";function mDe(e,t){var n;const r=e??"bottom",o={"top-start":{ltr:"top-left",rtl:"top-right"},"top-end":{ltr:"top-right",rtl:"top-left"},"bottom-start":{ltr:"bottom-left",rtl:"bottom-right"},"bottom-end":{ltr:"bottom-right",rtl:"bottom-left"}}[r];return(n=o==null?void 0:o[t])!=null?n:r}var J7={path:W.jsxs("g",{stroke:"currentColor",strokeWidth:"1.5",children:[W.jsx("path",{strokeLinecap:"round",fill:"none",d:"M9,9a3,3,0,1,1,4,2.829,1.5,1.5,0,0,0-1,1.415V14.25"}),W.jsx("path",{fill:"currentColor",strokeLinecap:"round",d:"M12,17.25a.375.375,0,1,0,.375.375A.375.375,0,0,0,12,17.25h0"}),W.jsx("circle",{fill:"none",strokeMiterlimit:"10",cx:"12",cy:"12",r:"11.25"})]}),viewBox:"0 0 24 24"},Fy=ra((e,t)=>{const{as:n,viewBox:r,color:i="currentColor",focusable:o=!1,children:a,className:s,__css:l,...u}=e,c=Ac("chakra-icon",s),d=Oy("Icon",e),f={w:"1em",h:"1em",display:"inline-block",lineHeight:"1em",flexShrink:0,color:i,...l,...d},h={ref:t,focusable:o,className:c,__css:f},p=r??J7.viewBox;if(n&&typeof n!="string")return W.jsx(Oi.svg,{as:n,...h,...u});const m=a??J7.path;return W.jsx(Oi.svg,{verticalAlign:"middle",viewBox:p,...h,...u,children:m})});Fy.displayName="Icon";function yDe(e){return W.jsx(Fy,{viewBox:"0 0 24 24",...e,children:W.jsx("path",{fill:"currentColor",d:"M12,0A12,12,0,1,0,24,12,12.014,12.014,0,0,0,12,0Zm6.927,8.2-6.845,9.289a1.011,1.011,0,0,1-1.43.188L5.764,13.769a1,1,0,1,1,1.25-1.562l4.076,3.261,6.227-8.451A1,1,0,1,1,18.927,8.2Z"})})}function vDe(e){return W.jsx(Fy,{viewBox:"0 0 24 24",...e,children:W.jsx("path",{fill:"currentColor",d:"M12,0A12,12,0,1,0,24,12,12.013,12.013,0,0,0,12,0Zm.25,5a1.5,1.5,0,1,1-1.5,1.5A1.5,1.5,0,0,1,12.25,5ZM14.5,18.5h-4a1,1,0,0,1,0-2h.75a.25.25,0,0,0,.25-.25v-4.5a.25.25,0,0,0-.25-.25H10.5a1,1,0,0,1,0-2h1a2,2,0,0,1,2,2v4.75a.25.25,0,0,0,.25.25h.75a1,1,0,1,1,0,2Z"})})}function eN(e){return W.jsx(Fy,{viewBox:"0 0 24 24",...e,children:W.jsx("path",{fill:"currentColor",d:"M11.983,0a12.206,12.206,0,0,0-8.51,3.653A11.8,11.8,0,0,0,0,12.207,11.779,11.779,0,0,0,11.8,24h.214A12.111,12.111,0,0,0,24,11.791h0A11.766,11.766,0,0,0,11.983,0ZM10.5,16.542a1.476,1.476,0,0,1,1.449-1.53h.027a1.527,1.527,0,0,1,1.523,1.47,1.475,1.475,0,0,1-1.449,1.53h-.027A1.529,1.529,0,0,1,10.5,16.542ZM11,12.5v-6a1,1,0,0,1,2,0v6a1,1,0,1,1-2,0Z"})})}var bDe=OTe({"0%":{transform:"rotate(0deg)"},"100%":{transform:"rotate(360deg)"}}),bP=ra((e,t)=>{const n=Oy("Spinner",e),{label:r="Loading...",thickness:i="2px",speed:o="0.45s",emptyColor:a="transparent",className:s,...l}=Iy(e),u=Ac("chakra-spinner",s),c={display:"inline-block",borderColor:"currentColor",borderStyle:"solid",borderRadius:"99999px",borderWidth:i,borderBottomColor:a,borderLeftColor:a,animation:`${bDe} ${o} linear infinite`,...n};return W.jsx(Oi.div,{ref:t,__css:c,className:u,...l,children:r&&W.jsx(Oi.span,{srOnly:!0,children:r})})});bP.displayName="Spinner";var[_De,_P]=Py({name:"AlertContext",hookName:"useAlertContext",providerName:""}),[SDe,SP]=Py({name:"AlertStylesContext",hookName:"useAlertStyles",providerName:""}),FW={info:{icon:vDe,colorScheme:"blue"},warning:{icon:eN,colorScheme:"orange"},success:{icon:yDe,colorScheme:"green"},error:{icon:eN,colorScheme:"red"},loading:{icon:bP,colorScheme:"blue"}};function xDe(e){return FW[e].colorScheme}function wDe(e){return FW[e].icon}var BW=ra(function(t,n){const r=SP(),{status:i}=_P(),o={display:"inline",...r.description};return W.jsx(Oi.div,{ref:n,"data-status":i,...t,className:Ac("chakra-alert__desc",t.className),__css:o})});BW.displayName="AlertDescription";function zW(e){const{status:t}=_P(),n=wDe(t),r=SP(),i=t==="loading"?r.spinner:r.icon;return W.jsx(Oi.span,{display:"inherit","data-status":t,...e,className:Ac("chakra-alert__icon",e.className),__css:i,children:e.children||W.jsx(n,{h:"100%",w:"100%"})})}zW.displayName="AlertIcon";var jW=ra(function(t,n){const r=SP(),{status:i}=_P();return W.jsx(Oi.div,{ref:n,"data-status":i,...t,className:Ac("chakra-alert__title",t.className),__css:r.title})});jW.displayName="AlertTitle";var UW=ra(function(t,n){var r;const{status:i="info",addRole:o=!0,...a}=Iy(t),s=(r=t.colorScheme)!=null?r:xDe(i),l=POe("Alert",{...t,colorScheme:s}),u={width:"100%",display:"flex",alignItems:"center",position:"relative",overflow:"hidden",...l.container};return W.jsx(_De,{value:{status:i},children:W.jsx(SDe,{value:l,children:W.jsx(Oi.div,{"data-status":i,role:o?"alert":void 0,ref:n,...a,className:Ac("chakra-alert",t.className),__css:u})})})});UW.displayName="Alert";function CDe(e){return W.jsx(Fy,{focusable:"false","aria-hidden":!0,...e,children:W.jsx("path",{fill:"currentColor",d:"M.439,21.44a1.5,1.5,0,0,0,2.122,2.121L11.823,14.3a.25.25,0,0,1,.354,0l9.262,9.263a1.5,1.5,0,1,0,2.122-2.121L14.3,12.177a.25.25,0,0,1,0-.354l9.263-9.262A1.5,1.5,0,0,0,21.439.44L12.177,9.7a.25.25,0,0,1-.354,0L2.561.44A1.5,1.5,0,0,0,.439,2.561L9.7,11.823a.25.25,0,0,1,0,.354Z"})})}var VW=ra(function(t,n){const r=Oy("CloseButton",t),{children:i,isDisabled:o,__css:a,...s}=Iy(t),l={outline:0,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0};return W.jsx(Oi.button,{type:"button","aria-label":"Close",ref:n,disabled:o,__css:{...l,...r,...a},...s,children:i||W.jsx(CDe,{width:"1em",height:"1em"})})});VW.displayName="CloseButton";var EDe={top:[],"top-left":[],"top-right":[],"bottom-left":[],bottom:[],"bottom-right":[]},Os=kDe(EDe);function kDe(e){let t=e;const n=new Set,r=i=>{t=i(t),n.forEach(o=>o())};return{getState:()=>t,subscribe:i=>(n.add(i),()=>{r(()=>e),n.delete(i)}),removeToast:(i,o)=>{r(a=>({...a,[o]:a[o].filter(s=>s.id!=i)}))},notify:(i,o)=>{const a=TDe(i,o),{position:s,id:l}=a;return r(u=>{var c,d;const h=s.includes("top")?[a,...(c=u[s])!=null?c:[]]:[...(d=u[s])!=null?d:[],a];return{...u,[s]:h}}),l},update:(i,o)=>{i&&r(a=>{const s={...a},{position:l,index:u}=KM(s,i);return l&&u!==-1&&(s[l][u]={...s[l][u],...o,message:GW(o)}),s})},closeAll:({positions:i}={})=>{r(o=>(i??["bottom","bottom-right","bottom-left","top","top-left","top-right"]).reduce((l,u)=>(l[u]=o[u].map(c=>({...c,requestClose:!0})),l),{...o}))},close:i=>{r(o=>{const a=hq(o,i);return a?{...o,[a]:o[a].map(s=>s.id==i?{...s,requestClose:!0}:s)}:o})},isActive:i=>!!KM(Os.getState(),i).position}}var tN=0;function TDe(e,t={}){var n,r;tN+=1;const i=(n=t.id)!=null?n:tN,o=(r=t.position)!=null?r:"bottom";return{id:i,message:e,position:o,duration:t.duration,onCloseComplete:t.onCloseComplete,onRequestRemove:()=>Os.removeToast(String(i),o),status:t.status,requestClose:!1,containerStyle:t.containerStyle}}var ADe=e=>{const{status:t,variant:n="solid",id:r,title:i,isClosable:o,onClose:a,description:s,colorScheme:l,icon:u}=e,c=r?{root:`toast-${r}`,title:`toast-${r}-title`,description:`toast-${r}-description`}:void 0;return W.jsxs(UW,{addRole:!1,status:t,variant:n,id:c==null?void 0:c.root,alignItems:"start",borderRadius:"md",boxShadow:"lg",paddingEnd:8,textAlign:"start",width:"auto",colorScheme:l,children:[W.jsx(zW,{children:u}),W.jsxs(Oi.div,{flex:"1",maxWidth:"100%",children:[i&&W.jsx(jW,{id:c==null?void 0:c.title,children:i}),s&&W.jsx(BW,{id:c==null?void 0:c.description,display:"block",children:s})]}),o&&W.jsx(VW,{size:"sm",onClick:a,position:"absolute",insetEnd:1,top:1})]})};function GW(e={}){const{render:t,toastComponent:n=ADe}=e;return i=>typeof t=="function"?t({...i,...e}):W.jsx(n,{...i,...e})}function PDe(e,t){const n=i=>{var o;return{...t,...i,position:mDe((o=i==null?void 0:i.position)!=null?o:t==null?void 0:t.position,e)}},r=i=>{const o=n(i),a=GW(o);return Os.notify(a,o)};return r.update=(i,o)=>{Os.update(i,n(o))},r.promise=(i,o)=>{const a=r({...o.loading,status:"loading",duration:null});i.then(s=>r.update(a,{status:"success",duration:5e3,...$s(o.success,s)})).catch(s=>r.update(a,{status:"error",duration:5e3,...$s(o.error,s)}))},r.closeAll=Os.closeAll,r.close=Os.close,r.isActive=Os.isActive,r}var[MKe,NKe]=Py({name:"ToastOptionsContext",strict:!1}),IDe=e=>{const t=I.useSyncExternalStore(Os.subscribe,Os.getState,Os.getState),{motionVariants:n,component:r=LW,portalProps:i}=e,a=Object.keys(t).map(s=>{const l=t[s];return W.jsx("div",{role:"region","aria-live":"polite","aria-label":"Notifications",id:`chakra-toast-manager-${s}`,style:XOe(s),children:W.jsx(DW,{initial:!1,children:l.map(u=>W.jsx(r,{motionVariants:n,...u},u.id))})},s)});return W.jsx(ew,{...i,children:a})},RDe={duration:5e3,variant:"solid"},Sf={theme:vOe,colorMode:"light",toggleColorMode:()=>{},setColorMode:()=>{},defaultOptions:RDe,forced:!1};function ODe({theme:e=Sf.theme,colorMode:t=Sf.colorMode,toggleColorMode:n=Sf.toggleColorMode,setColorMode:r=Sf.setColorMode,defaultOptions:i=Sf.defaultOptions,motionVariants:o,toastSpacing:a,component:s,forced:l}=Sf){const u={colorMode:t,setColorMode:r,toggleColorMode:n,forced:l};return{ToastContainer:()=>W.jsx(qOe,{theme:e,children:W.jsx(VA.Provider,{value:u,children:W.jsx(IDe,{defaultOptions:i,motionVariants:o,toastSpacing:a,component:s})})}),toast:PDe(e.direction,i)}}var P4=ra(function(t,n){const{htmlWidth:r,htmlHeight:i,alt:o,...a}=t;return W.jsx("img",{width:r,height:i,ref:n,alt:o,...a})});P4.displayName="NativeImage";function MDe(e){const{loading:t,src:n,srcSet:r,onLoad:i,onError:o,crossOrigin:a,sizes:s,ignoreFallback:l}=e,[u,c]=I.useState("pending");I.useEffect(()=>{c(n?"loading":"pending")},[n]);const d=I.useRef(),f=I.useCallback(()=>{if(!n)return;h();const p=new Image;p.src=n,a&&(p.crossOrigin=a),r&&(p.srcset=r),s&&(p.sizes=s),t&&(p.loading=t),p.onload=m=>{h(),c("loaded"),i==null||i(m)},p.onerror=m=>{h(),c("failed"),o==null||o(m)},d.current=p},[n,a,r,s,i,o,t]),h=()=>{d.current&&(d.current.onload=null,d.current.onerror=null,d.current=null)};return U_(()=>{if(!l)return u==="loading"&&f(),()=>{h()}},[u,f,l]),l?"loaded":u}var NDe=(e,t)=>e!=="loaded"&&t==="beforeLoadOrError"||e==="failed"&&t==="onError";function $De(e,t=[]){const n=Object.assign({},e);for(const r of t)r in n&&delete n[r];return n}var xP=ra(function(t,n){const{fallbackSrc:r,fallback:i,src:o,srcSet:a,align:s,fit:l,loading:u,ignoreFallback:c,crossOrigin:d,fallbackStrategy:f="beforeLoadOrError",referrerPolicy:h,...p}=t,m=r!==void 0||i!==void 0,_=u!=null||c||!m,b=MDe({...t,crossOrigin:d,ignoreFallback:_}),v=NDe(b,f),g={ref:n,objectFit:l,objectPosition:s,..._?p:$De(p,["onError","onLoad"])};return v?i||W.jsx(Oi.img,{as:P4,className:"chakra-image__placeholder",src:r,...g}):W.jsx(Oi.img,{as:P4,src:o,srcSet:a,crossOrigin:d,loading:u,referrerPolicy:h,className:"chakra-image",...g})});xP.displayName="Image";var HW=ra(function(t,n){const r=Oy("Text",t),{className:i,align:o,decoration:a,casing:s,...l}=Iy(t),u=NOe({textAlign:t.align,textDecoration:t.decoration,textTransform:t.casing});return W.jsx(Oi.p,{ref:n,className:Ac("chakra-text",t.className),...u,...l,__css:r})});HW.displayName="Text";var I4=ra(function(t,n){const r=Oy("Heading",t),{className:i,...o}=Iy(t);return W.jsx(Oi.h2,{ref:n,className:Ac("chakra-heading",t.className),...o,__css:r})});I4.displayName="Heading";var rS=Oi("div");rS.displayName="Box";var qW=ra(function(t,n){const{size:r,centerContent:i=!0,...o}=t,a=i?{display:"flex",alignItems:"center",justifyContent:"center"}:{};return W.jsx(rS,{ref:n,boxSize:r,__css:{...a,flexShrink:0,flexGrow:0},...o})});qW.displayName="Square";var DDe=ra(function(t,n){const{size:r,...i}=t;return W.jsx(qW,{size:r,ref:n,borderRadius:"9999px",...i})});DDe.displayName="Circle";var wP=ra(function(t,n){const{direction:r,align:i,justify:o,wrap:a,basis:s,grow:l,shrink:u,...c}=t,d={display:"flex",flexDirection:r,alignItems:i,justifyContent:o,flexWrap:a,flexBasis:s,flexGrow:l,flexShrink:u};return W.jsx(Oi.div,{ref:n,__css:d,...c})});wP.displayName="Flex";const LDe=z.object({status:z.literal(422),data:z.object({detail:z.array(z.object({loc:z.array(z.string()),msg:z.string(),type:z.string()}))})});function mo(e,t,n=!1){e=String(e),t=String(t);const r=Array.from({length:21},(a,s)=>s*50),i=[0,5,10,15,20,25,30,35,40,45,50,55,59,64,68,73,77,82,86,95,100];return r.reduce((a,s,l)=>{const u=n?i[l]/100:1,c=n?50:i[r.length-1-l];return a[s]=`hsl(${e} ${t}% ${c}% / ${u})`,a},{})}const o1={H:220,S:16},a1={H:250,S:42},s1={H:47,S:42},l1={H:40,S:70},u1={H:28,S:42},c1={H:113,S:42},d1={H:0,S:42},FDe={base:mo(o1.H,o1.S),baseAlpha:mo(o1.H,o1.S,!0),accent:mo(a1.H,a1.S),accentAlpha:mo(a1.H,a1.S,!0),working:mo(s1.H,s1.S),workingAlpha:mo(s1.H,s1.S,!0),gold:mo(l1.H,l1.S),goldAlpha:mo(l1.H,l1.S,!0),warning:mo(u1.H,u1.S),warningAlpha:mo(u1.H,u1.S,!0),ok:mo(c1.H,c1.S),okAlpha:mo(c1.H,c1.S,!0),error:mo(d1.H,d1.S),errorAlpha:mo(d1.H,d1.S,!0)},{definePartsStyle:BDe,defineMultiStyleConfig:zDe}=Pt(BH.keys),jDe={border:"none"},UDe=e=>{const{colorScheme:t}=e;return{fontWeight:"600",fontSize:"sm",border:"none",borderRadius:"base",bg:K(`${t}.200`,`${t}.700`)(e),color:K(`${t}.900`,`${t}.100`)(e),_hover:{bg:K(`${t}.250`,`${t}.650`)(e)},_expanded:{bg:K(`${t}.250`,`${t}.650`)(e),borderBottomRadius:"none",_hover:{bg:K(`${t}.300`,`${t}.600`)(e)}}}},VDe=e=>{const{colorScheme:t}=e;return{bg:K(`${t}.100`,`${t}.800`)(e),borderRadius:"base",borderTopRadius:"none"}},GDe={},HDe=BDe(e=>({container:jDe,button:UDe(e),panel:VDe(e),icon:GDe})),qDe=zDe({variants:{invokeAI:HDe},defaultProps:{variant:"invokeAI",colorScheme:"base"}}),WDe=e=>{const{colorScheme:t}=e;if(t==="base"){const r={bg:K("base.150","base.700")(e),color:K("base.300","base.500")(e),svg:{fill:K("base.300","base.500")(e)},opacity:1},i={bg:"none",color:K("base.300","base.500")(e),svg:{fill:K("base.500","base.500")(e)},opacity:1};return{bg:K("base.250","base.600")(e),color:K("base.850","base.100")(e),borderRadius:"base",svg:{fill:K("base.850","base.100")(e)},_hover:{bg:K("base.300","base.500")(e),color:K("base.900","base.50")(e),svg:{fill:K("base.900","base.50")(e)},_disabled:r},_disabled:r,'&[data-progress="true"]':{...i,_hover:i}}}const n={bg:K(`${t}.400`,`${t}.700`)(e),color:K(`${t}.600`,`${t}.500`)(e),svg:{fill:K(`${t}.600`,`${t}.500`)(e),filter:"unset"},opacity:.7,filter:"saturate(65%)"};return{bg:K(`${t}.400`,`${t}.600`)(e),color:K("base.50","base.100")(e),borderRadius:"base",svg:{fill:K("base.50","base.100")(e)},_disabled:n,_hover:{bg:K(`${t}.500`,`${t}.500`)(e),color:K("white","base.50")(e),svg:{fill:K("white","base.50")(e)},_disabled:n}}},KDe=e=>{const{colorScheme:t}=e,n=K("gray.200","whiteAlpha.300")(e);return{border:"1px solid",borderColor:t==="gray"?n:"currentColor",_hover:{bg:K(`${t}.500`,`${t}.500`)(e),color:K("white","base.50")(e),svg:{fill:K("white","base.50")(e)}},".chakra-button__group[data-attached][data-orientation=horizontal] > &:not(:last-of-type)":{marginEnd:"-1px"},".chakra-button__group[data-attached][data-orientation=vertical] > &:not(:last-of-type)":{marginBottom:"-1px"}}},QDe={variants:{invokeAI:WDe,invokeAIOutline:KDe},defaultProps:{variant:"invokeAI",colorScheme:"base"}},{definePartsStyle:XDe,defineMultiStyleConfig:YDe}=Pt(zH.keys),ZDe=e=>{const{colorScheme:t}=e;return{bg:K("base.200","base.700")(e),borderColor:K("base.300","base.600")(e),color:K("base.900","base.100")(e),_checked:{bg:K(`${t}.300`,`${t}.500`)(e),borderColor:K(`${t}.300`,`${t}.500`)(e),color:K(`${t}.900`,`${t}.100`)(e),_hover:{bg:K(`${t}.400`,`${t}.500`)(e),borderColor:K(`${t}.400`,`${t}.500`)(e)},_disabled:{borderColor:"transparent",bg:"whiteAlpha.300",color:"whiteAlpha.500"}},_indeterminate:{bg:K(`${t}.300`,`${t}.600`)(e),borderColor:K(`${t}.300`,`${t}.600`)(e),color:K(`${t}.900`,`${t}.100`)(e)},_disabled:{bg:"whiteAlpha.100",borderColor:"transparent"},_focusVisible:{boxShadow:"none",outline:"none"},_invalid:{borderColor:K("error.600","error.300")(e)}}},JDe=XDe(e=>({control:ZDe(e)})),eLe=YDe({variants:{invokeAI:JDe},defaultProps:{variant:"invokeAI",colorScheme:"accent"}}),{definePartsStyle:tLe,defineMultiStyleConfig:nLe}=Pt(jH.keys),rLe={borderRadius:"md",py:"1",transitionProperty:"common",transitionDuration:"normal"},iLe=e=>({borderRadius:"md",py:"1",transitionProperty:"common",transitionDuration:"normal",width:"full",_focusVisible:{boxShadow:"outline"},_placeholder:{opacity:.6},"::selection":{color:K("accent.900","accent.50")(e),bg:K("accent.200","accent.400")(e)}}),oLe={borderRadius:"md",py:"1",transitionProperty:"common",transitionDuration:"normal",width:"full",_focusVisible:{boxShadow:"outline"},_placeholder:{opacity:.6}},aLe=tLe(e=>({preview:rLe,input:iLe(e),textarea:oLe})),sLe=nLe({variants:{invokeAI:aLe},defaultProps:{size:"sm",variant:"invokeAI"}}),lLe=e=>({fontSize:"sm",marginEnd:0,mb:1,fontWeight:"400",transitionProperty:"common",transitionDuration:"normal",whiteSpace:"nowrap",_disabled:{opacity:.4},color:K("base.700","base.300")(e),_invalid:{color:K("error.500","error.300")(e)}}),uLe={variants:{invokeAI:lLe},defaultProps:{variant:"invokeAI"}},hw=e=>({outline:"none",borderWidth:2,borderStyle:"solid",borderColor:K("base.200","base.800")(e),bg:K("base.50","base.900")(e),borderRadius:"base",color:K("base.900","base.100")(e),boxShadow:"none",_hover:{borderColor:K("base.300","base.600")(e)},_focus:{borderColor:K("accent.200","accent.600")(e),boxShadow:"none",_hover:{borderColor:K("accent.300","accent.500")(e)}},_invalid:{borderColor:K("error.300","error.600")(e),boxShadow:"none",_hover:{borderColor:K("error.400","error.500")(e)}},_disabled:{borderColor:K("base.300","base.700")(e),bg:K("base.300","base.700")(e),color:K("base.600","base.400")(e),_hover:{borderColor:K("base.300","base.700")(e)}},_placeholder:{color:K("base.700","base.400")(e)},"::selection":{bg:K("accent.200","accent.400")(e)}}),{definePartsStyle:cLe,defineMultiStyleConfig:dLe}=Pt(UH.keys),fLe=cLe(e=>({field:hw(e)})),hLe=dLe({variants:{invokeAI:fLe},defaultProps:{size:"sm",variant:"invokeAI"}}),{definePartsStyle:pLe,defineMultiStyleConfig:gLe}=Pt(VH.keys),mLe=pLe(e=>({button:{fontWeight:500,bg:K("base.300","base.500")(e),color:K("base.900","base.100")(e),_hover:{bg:K("base.400","base.600")(e),color:K("base.900","base.50")(e),fontWeight:600}},list:{zIndex:9999,color:K("base.900","base.150")(e),bg:K("base.200","base.800")(e),shadow:"dark-lg",border:"none"},item:{fontSize:"sm",bg:K("base.200","base.800")(e),_hover:{bg:K("base.300","base.700")(e),svg:{opacity:1}},_focus:{bg:K("base.400","base.600")(e)},svg:{opacity:.7,fontSize:14}}})),yLe=gLe({variants:{invokeAI:mLe},defaultProps:{variant:"invokeAI"}}),$Ke={variants:{enter:{visibility:"visible",opacity:1,scale:1,transition:{duration:.07,ease:[.4,0,.2,1]}},exit:{transitionEnd:{visibility:"hidden"},opacity:0,scale:.8,transition:{duration:.07,easings:"easeOut"}}}},{defineMultiStyleConfig:vLe,definePartsStyle:bLe}=Pt(GH.keys),_Le=e=>({bg:K("blackAlpha.700","blackAlpha.700")(e)}),SLe={},xLe=()=>({layerStyle:"first",maxH:"80vh"}),wLe=()=>({fontWeight:"600",fontSize:"lg",layerStyle:"first",borderTopRadius:"base",borderInlineEndRadius:"base"}),CLe={},ELe={overflowY:"scroll"},kLe={},TLe=bLe(e=>({overlay:_Le(e),dialogContainer:SLe,dialog:xLe(),header:wLe(),closeButton:CLe,body:ELe,footer:kLe})),ALe=vLe({variants:{invokeAI:TLe},defaultProps:{variant:"invokeAI",size:"lg"}}),{defineMultiStyleConfig:PLe,definePartsStyle:ILe}=Pt(HH.keys),RLe=e=>({height:8}),OLe=e=>({border:"none",fontWeight:"600",height:"auto",py:1,ps:2,pe:6,...hw(e)}),MLe=e=>({display:"flex"}),NLe=e=>({border:"none",px:2,py:0,mx:-2,my:0,svg:{color:K("base.700","base.300")(e),width:2.5,height:2.5,_hover:{color:K("base.900","base.100")(e)}}}),$Le=ILe(e=>({root:RLe(e),field:OLe(e),stepperGroup:MLe(e),stepper:NLe(e)})),DLe=PLe({variants:{invokeAI:$Le},defaultProps:{size:"sm",variant:"invokeAI"}}),{defineMultiStyleConfig:LLe,definePartsStyle:WW}=Pt(qH.keys),KW=fr("popper-bg"),QW=fr("popper-arrow-bg"),XW=fr("popper-arrow-shadow-color"),FLe=e=>({[QW.variable]:K("colors.base.100","colors.base.800")(e),[KW.variable]:K("colors.base.100","colors.base.800")(e),[XW.variable]:K("colors.base.400","colors.base.600")(e),minW:"unset",width:"unset",p:4,bg:K("base.100","base.800")(e),border:"none",shadow:"dark-lg"}),BLe=e=>({[QW.variable]:K("colors.base.100","colors.base.700")(e),[KW.variable]:K("colors.base.100","colors.base.700")(e),[XW.variable]:K("colors.base.400","colors.base.400")(e),p:4,bg:K("base.100","base.700")(e),border:"none",shadow:"dark-lg"}),zLe=WW(e=>({content:FLe(e),body:{padding:0}})),jLe=WW(e=>({content:BLe(e),body:{padding:0}})),ULe=LLe({variants:{invokeAI:zLe,informational:jLe},defaultProps:{variant:"invokeAI"}}),{defineMultiStyleConfig:VLe,definePartsStyle:GLe}=Pt(WH.keys),HLe=e=>({bg:"accentAlpha.700"}),qLe=e=>{const{colorScheme:t}=e;return{bg:K(`${t}.200`,`${t}.700`)(e)}},WLe=GLe(e=>({filledTrack:HLe(e),track:qLe(e)})),KLe=VLe({variants:{invokeAI:WLe},defaultProps:{variant:"invokeAI"}}),QLe={"::-webkit-scrollbar":{display:"none"},scrollbarWidth:"none"},{definePartsStyle:XLe,defineMultiStyleConfig:YLe}=Pt(KH.keys),ZLe=e=>({color:K("base.200","base.300")(e)}),JLe=e=>({fontWeight:"600",...hw(e)}),eFe=XLe(e=>({field:JLe(e),icon:ZLe(e)})),tFe=YLe({variants:{invokeAI:eFe},defaultProps:{size:"sm",variant:"invokeAI"}}),nN=nt("skeleton-start-color"),rN=nt("skeleton-end-color"),nFe={borderRadius:"base",maxW:"full",maxH:"full",_light:{[nN.variable]:"colors.base.250",[rN.variable]:"colors.base.450"},_dark:{[nN.variable]:"colors.base.700",[rN.variable]:"colors.base.500"}},rFe={variants:{invokeAI:nFe},defaultProps:{variant:"invokeAI"}},{definePartsStyle:iFe,defineMultiStyleConfig:oFe}=Pt(QH.keys),aFe=e=>({bg:K("base.400","base.600")(e),h:1.5}),sFe=e=>{const{colorScheme:t}=e;return{bg:K(`${t}.400`,`${t}.600`)(e),h:1.5}},lFe=e=>({w:e.orientation==="horizontal"?2:4,h:e.orientation==="horizontal"?4:2,bg:K("base.50","base.100")(e)}),uFe=e=>({fontSize:"2xs",fontWeight:"500",color:K("base.700","base.400")(e),mt:2,insetInlineStart:"unset"}),cFe=iFe(e=>({container:{_disabled:{opacity:.6,cursor:"default",pointerEvents:"none"}},track:aFe(e),filledTrack:sFe(e),thumb:lFe(e),mark:uFe(e)})),dFe=oFe({variants:{invokeAI:cFe},defaultProps:{variant:"invokeAI",colorScheme:"accent"}}),{defineMultiStyleConfig:fFe,definePartsStyle:hFe}=Pt(XH.keys),pFe=e=>{const{colorScheme:t}=e;return{bg:K("base.300","base.600")(e),_focusVisible:{boxShadow:"none"},_checked:{bg:K(`${t}.400`,`${t}.500`)(e)}}},gFe=e=>{const{colorScheme:t}=e;return{bg:K(`${t}.50`,`${t}.50`)(e)}},mFe=hFe(e=>({container:{},track:pFe(e),thumb:gFe(e)})),yFe=fFe({variants:{invokeAI:mFe},defaultProps:{size:"md",variant:"invokeAI",colorScheme:"accent"}}),{defineMultiStyleConfig:vFe,definePartsStyle:YW}=Pt(YH.keys),bFe=e=>({display:"flex",columnGap:4}),_Fe=e=>({}),SFe=e=>{const{colorScheme:t}=e;return{display:"flex",flexDirection:"column",gap:1,color:K("base.700","base.400")(e),button:{fontSize:"sm",padding:2,borderRadius:"base",textShadow:K("0 0 0.3rem var(--invokeai-colors-accent-100)","0 0 0.3rem var(--invokeai-colors-accent-900)")(e),svg:{fill:K("base.700","base.300")(e)},_selected:{bg:K("accent.400","accent.600")(e),color:K("base.50","base.100")(e),svg:{fill:K("base.50","base.100")(e),filter:K(`drop-shadow(0px 0px 0.3rem var(--invokeai-colors-${t}-600))`,`drop-shadow(0px 0px 0.3rem var(--invokeai-colors-${t}-800))`)(e)},_hover:{bg:K("accent.500","accent.500")(e),color:K("white","base.50")(e),svg:{fill:K("white","base.50")(e)}}},_hover:{bg:K("base.100","base.800")(e),color:K("base.900","base.50")(e),svg:{fill:K("base.800","base.100")(e)}}}}},xFe=e=>({padding:0,height:"100%"}),wFe=YW(e=>({root:bFe(e),tab:_Fe(e),tablist:SFe(e),tabpanel:xFe(e)})),CFe=YW(e=>({tab:{borderTopRadius:"base",px:4,py:1,fontSize:"sm",color:K("base.600","base.400")(e),fontWeight:500,_selected:{color:K("accent.600","accent.400")(e)}},tabpanel:{p:0,pt:4,w:"full",h:"full"},tabpanels:{w:"full",h:"full"}})),EFe=vFe({variants:{line:CFe,appTabs:wFe},defaultProps:{variant:"appTabs",colorScheme:"accent"}}),kFe=e=>({color:K("base.500","base.400")(e)}),TFe={variants:{subtext:kFe}},AFe=e=>({...hw(e),"::-webkit-scrollbar":{display:"initial"},"::-webkit-resizer":{backgroundImage:`linear-gradient(135deg, - var(--invokeai-colors-base-50) 0%, - var(--invokeai-colors-base-50) 70%, - var(--invokeai-colors-base-200) 70%, - var(--invokeai-colors-base-200) 100%)`},_disabled:{"::-webkit-resizer":{backgroundImage:`linear-gradient(135deg, - var(--invokeai-colors-base-50) 0%, - var(--invokeai-colors-base-50) 70%, - var(--invokeai-colors-base-200) 70%, - var(--invokeai-colors-base-200) 100%)`}},_dark:{"::-webkit-resizer":{backgroundImage:`linear-gradient(135deg, - var(--invokeai-colors-base-900) 0%, - var(--invokeai-colors-base-900) 70%, - var(--invokeai-colors-base-800) 70%, - var(--invokeai-colors-base-800) 100%)`},_disabled:{"::-webkit-resizer":{backgroundImage:`linear-gradient(135deg, - var(--invokeai-colors-base-900) 0%, - var(--invokeai-colors-base-900) 70%, - var(--invokeai-colors-base-800) 70%, - var(--invokeai-colors-base-800) 100%)`}}},p:2}),PFe={variants:{invokeAI:AFe},defaultProps:{size:"md",variant:"invokeAI"}},IFe=fr("popper-arrow-bg"),RFe=e=>({borderRadius:"base",shadow:"dark-lg",bg:K("base.700","base.200")(e),[IFe.variable]:K("colors.base.700","colors.base.200")(e),pb:1.5}),OFe={baseStyle:RFe},iN={backgroundColor:"accentAlpha.150 !important",borderColor:"accentAlpha.700 !important",borderRadius:"base !important",borderStyle:"dashed !important",_dark:{borderColor:"accent.400 !important"}},MFe={".react-flow__nodesselection-rect":{...iN,padding:"1rem !important",boxSizing:"content-box !important",transform:"translate(-1rem, -1rem) !important"},".react-flow__selection":iN},NFe={config:{cssVarPrefix:"invokeai",initialColorMode:"dark",useSystemColorMode:!1},layerStyles:{body:{bg:"base.50",color:"base.900",".chakra-ui-dark &":{bg:"base.900",color:"base.50"}},first:{bg:"base.100",color:"base.900",".chakra-ui-dark &":{bg:"base.850",color:"base.100"}},second:{bg:"base.200",color:"base.900",".chakra-ui-dark &":{bg:"base.800",color:"base.100"}},third:{bg:"base.300",color:"base.900",".chakra-ui-dark &":{bg:"base.750",color:"base.100"}},nodeBody:{bg:"base.100",color:"base.900",".chakra-ui-dark &":{bg:"base.800",color:"base.100"}},nodeHeader:{bg:"base.200",color:"base.900",".chakra-ui-dark &":{bg:"base.900",color:"base.100"}},nodeFooter:{bg:"base.200",color:"base.900",".chakra-ui-dark &":{bg:"base.900",color:"base.100"}}},styles:{global:()=>({layerStyle:"body","*":{...QLe},...MFe})},direction:"ltr",fonts:{body:"'Inter Variable', sans-serif",heading:"'Inter Variable', sans-serif"},shadows:{light:{accent:"0 0 10px 0 var(--invokeai-colors-accent-300)",accentHover:"0 0 10px 0 var(--invokeai-colors-accent-400)",ok:"0 0 7px var(--invokeai-colors-ok-600)",working:"0 0 7px var(--invokeai-colors-working-600)",error:"0 0 7px var(--invokeai-colors-error-600)"},dark:{accent:"0 0 10px 0 var(--invokeai-colors-accent-600)",accentHover:"0 0 10px 0 var(--invokeai-colors-accent-500)",ok:"0 0 7px var(--invokeai-colors-ok-400)",working:"0 0 7px var(--invokeai-colors-working-400)",error:"0 0 7px var(--invokeai-colors-error-400)"},selected:{light:"0px 0px 0px 1px var(--invokeai-colors-base-150), 0px 0px 0px 4px var(--invokeai-colors-accent-400)",dark:"0px 0px 0px 1px var(--invokeai-colors-base-900), 0px 0px 0px 4px var(--invokeai-colors-accent-500)"},hoverSelected:{light:"0px 0px 0px 1px var(--invokeai-colors-base-150), 0px 0px 0px 4px var(--invokeai-colors-accent-500)",dark:"0px 0px 0px 1px var(--invokeai-colors-base-900), 0px 0px 0px 4px var(--invokeai-colors-accent-400)"},hoverUnselected:{light:"0px 0px 0px 1px var(--invokeai-colors-base-150), 0px 0px 0px 3px var(--invokeai-colors-accent-500)",dark:"0px 0px 0px 1px var(--invokeai-colors-base-900), 0px 0px 0px 3px var(--invokeai-colors-accent-400)"},nodeSelected:{light:"0 0 0 3px var(--invokeai-colors-accent-400)",dark:"0 0 0 3px var(--invokeai-colors-accent-500)"},nodeHovered:{light:"0 0 0 2px var(--invokeai-colors-accent-500)",dark:"0 0 0 2px var(--invokeai-colors-accent-400)"},nodeHoveredSelected:{light:"0 0 0 3px var(--invokeai-colors-accent-500)",dark:"0 0 0 3px var(--invokeai-colors-accent-400)"},nodeInProgress:{light:"0 0 0 2px var(--invokeai-colors-accent-500), 0 0 10px 2px var(--invokeai-colors-accent-600)",dark:"0 0 0 2px var(--invokeai-colors-yellow-400), 0 0 20px 2px var(--invokeai-colors-orange-700)"}},colors:FDe,components:{Button:QDe,Input:hLe,Editable:sLe,Textarea:PFe,Tabs:EFe,Progress:KLe,Accordion:qDe,FormLabel:uLe,Switch:yFe,NumberInput:DLe,Select:tFe,Skeleton:rFe,Slider:dFe,Popover:ULe,Modal:ALe,Checkbox:eLe,Menu:yLe,Text:TFe,Tooltip:OFe}},$Fe={defaultOptions:{isClosable:!0}},{toast:ug}=ODe({theme:NFe,defaultOptions:$Fe.defaultOptions}),DFe=()=>{Be({matcher:Qr.endpoints.enqueueBatch.matchFulfilled,effect:async e=>{const t=e.payload,n=e.meta.arg.originalArgs;Ce("queue").debug({enqueueResult:Qt(t)},"Batch enqueued"),ug.isActive("batch-queued")||ug({id:"batch-queued",title:Z("queue.batchQueued"),description:Z("queue.batchQueuedDesc",{item_count:t.enqueued,direction:n.prepend?Z("queue.front"):Z("queue.back")}),duration:1e3,status:"success"})}}),Be({matcher:Qr.endpoints.enqueueBatch.matchRejected,effect:async e=>{const t=e.payload,n=e.meta.arg.originalArgs;if(!t){ug({title:Z("queue.batchFailedToQueue"),status:"error",description:"Unknown Error"}),Ce("queue").error({batchConfig:Qt(n),error:Qt(t)},Z("queue.batchFailedToQueue"));return}const r=LDe.safeParse(t);if(r.success)r.data.data.detail.map(i=>{ug({id:"batch-failed-to-queue",title:W8(yF(i.msg),{length:128}),status:"error",description:W8(`Path: - ${i.loc.join(".")}`,{length:128})})});else{let i="Unknown Error",o;t.status===403&&"body"in t?i=uh(t,"body.detail","Unknown Error"):t.status===403&&"error"in t?i=uh(t,"error.detail","Unknown Error"):t.status===403&&"data"in t&&(i=uh(t,"data.detail","Unknown Error"),o=15e3),ug({title:Z("queue.batchFailedToQueue"),status:"error",description:i,...o?{duration:o}:{}})}Ce("queue").error({batchConfig:Qt(n),error:Qt(t)},Z("queue.batchFailedToQueue"))}})},ZW=FL(),Be=ZW.startListening;DEe();LEe();UEe();TEe();AEe();PEe();IEe();REe();wxe();$Ee();FEe();BEe();cEe();CEe();gEe();vxe();DFe();G3e();z3e();Bxe();j3e();Fxe();Dxe();V3e();dke();gxe();J4e();eke();nke();rke();oke();Y4e();Z4e();uke();cke();ake();lke();ike();ske();K3e();q3e();EEe();kEe();MEe();NEe();Cxe();X4e();Vke();OEe();VEe();Sxe();HEe();bxe();mxe();Dke();hke();KEe();const LFe={canvas:dle,gallery:_0e,generation:Jse,nodes:t2e,postprocessing:n2e,system:u2e,config:Rae,ui:v2e,hotkeys:y2e,controlNet:u0e,dynamicPrompts:b0e,deleteImageModal:f0e,changeBoardModal:hle,lora:w0e,modelmanager:m2e,sdxl:i2e,queue:p2e,[ls.reducerPath]:ls.reducer},FFe=hp(LFe),BFe=V2e(FFe),zFe=["canvas","gallery","generation","sdxl","nodes","postprocessing","system","ui","controlNet","dynamicPrompts","lora","modelmanager"],JW=vL({reducer:BFe,enhancers:e=>e.concat(G2e(window.localStorage,zFe,{persistDebounce:300,serialize:nxe,unserialize:ixe,prefix:H2e})).concat(zL()),middleware:e=>e({serializableCheck:!1,immutableCheck:!1}).concat(ls.middleware).concat(x2e).prepend(ZW.middleware),devTools:{actionSanitizer:cxe,stateSanitizer:fxe,trace:!0,predicate:(e,t)=>!dxe.includes(t.type)}}),eK=e=>e;PB.set(JW);const jFe=e=>{const{socket:t,storeApi:n}=e,{dispatch:r}=n;t.on("connect",()=>{Ce("socketio").debug("Connected"),r(Lj());const o=Ur.get();t.emit("subscribe_queue",{queue_id:o})}),t.on("connect_error",i=>{i&&i.message&&i.data==="ERR_UNAUTHENTICATED"&&r(Gt($d({title:i.message,status:"error",duration:1e4})))}),t.on("disconnect",()=>{r(Fj())}),t.on("invocation_started",i=>{r(zj({data:i}))}),t.on("generator_progress",i=>{r(Gj({data:i}))}),t.on("invocation_error",i=>{r(jj({data:i}))}),t.on("invocation_complete",i=>{r(jT({data:i}))}),t.on("graph_execution_state_complete",i=>{r(Uj({data:i}))}),t.on("model_load_started",i=>{r(Hj({data:i}))}),t.on("model_load_completed",i=>{r(Wj({data:i}))}),t.on("session_retrieval_error",i=>{r(Qj({data:i}))}),t.on("invocation_retrieval_error",i=>{r(Yj({data:i}))}),t.on("queue_item_status_changed",i=>{r(Jj({data:i}))})},Ys=Object.create(null);Ys.open="0";Ys.close="1";Ys.ping="2";Ys.pong="3";Ys.message="4";Ys.upgrade="5";Ys.noop="6";const ab=Object.create(null);Object.keys(Ys).forEach(e=>{ab[Ys[e]]=e});const R4={type:"error",data:"parser error"},tK=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",nK=typeof ArrayBuffer=="function",rK=e=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer,CP=({type:e,data:t},n,r)=>tK&&t instanceof Blob?n?r(t):oN(t,r):nK&&(t instanceof ArrayBuffer||rK(t))?n?r(t):oN(new Blob([t]),r):r(Ys[e]+(t||"")),oN=(e,t)=>{const n=new FileReader;return n.onload=function(){const r=n.result.split(",")[1];t("b"+(r||""))},n.readAsDataURL(e)};function aN(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}let D5;function UFe(e,t){if(tK&&e.data instanceof Blob)return e.data.arrayBuffer().then(aN).then(t);if(nK&&(e.data instanceof ArrayBuffer||rK(e.data)))return t(aN(e.data));CP(e,!1,n=>{D5||(D5=new TextEncoder),t(D5.encode(n))})}const sN="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Ig=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let e=0;e{let t=e.length*.75,n=e.length,r,i=0,o,a,s,l;e[e.length-1]==="="&&(t--,e[e.length-2]==="="&&t--);const u=new ArrayBuffer(t),c=new Uint8Array(u);for(r=0;r>4,c[i++]=(a&15)<<4|s>>2,c[i++]=(s&3)<<6|l&63;return u},GFe=typeof ArrayBuffer=="function",EP=(e,t)=>{if(typeof e!="string")return{type:"message",data:iK(e,t)};const n=e.charAt(0);return n==="b"?{type:"message",data:HFe(e.substring(1),t)}:ab[n]?e.length>1?{type:ab[n],data:e.substring(1)}:{type:ab[n]}:R4},HFe=(e,t)=>{if(GFe){const n=VFe(e);return iK(n,t)}else return{base64:!0,data:e}},iK=(e,t)=>{switch(t){case"blob":return e instanceof Blob?e:new Blob([e]);case"arraybuffer":default:return e instanceof ArrayBuffer?e:e.buffer}},oK=String.fromCharCode(30),qFe=(e,t)=>{const n=e.length,r=new Array(n);let i=0;e.forEach((o,a)=>{CP(o,!1,s=>{r[a]=s,++i===n&&t(r.join(oK))})})},WFe=(e,t)=>{const n=e.split(oK),r=[];for(let i=0;i{const r=n.length;let i;if(r<126)i=new Uint8Array(1),new DataView(i.buffer).setUint8(0,r);else if(r<65536){i=new Uint8Array(3);const o=new DataView(i.buffer);o.setUint8(0,126),o.setUint16(1,r)}else{i=new Uint8Array(9);const o=new DataView(i.buffer);o.setUint8(0,127),o.setBigUint64(1,BigInt(r))}e.data&&typeof e.data!="string"&&(i[0]|=128),t.enqueue(i),t.enqueue(n)})}})}let L5;function f1(e){return e.reduce((t,n)=>t+n.length,0)}function h1(e,t){if(e[0].length===t)return e.shift();const n=new Uint8Array(t);let r=0;for(let i=0;iMath.pow(2,53-32)-1){s.enqueue(R4);break}i=c*Math.pow(2,32)+u.getUint32(4),r=3}else{if(f1(n)e){s.enqueue(R4);break}}}})}const aK=4;function Lr(e){if(e)return XFe(e)}function XFe(e){for(var t in Lr.prototype)e[t]=Lr.prototype[t];return e}Lr.prototype.on=Lr.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this};Lr.prototype.once=function(e,t){function n(){this.off(e,n),t.apply(this,arguments)}return n.fn=t,this.on(e,n),this};Lr.prototype.off=Lr.prototype.removeListener=Lr.prototype.removeAllListeners=Lr.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var n=this._callbacks["$"+e];if(!n)return this;if(arguments.length==1)return delete this._callbacks["$"+e],this;for(var r,i=0;itypeof self<"u"?self:typeof window<"u"?window:Function("return this")())();function sK(e,...t){return t.reduce((n,r)=>(e.hasOwnProperty(r)&&(n[r]=e[r]),n),{})}const YFe=ma.setTimeout,ZFe=ma.clearTimeout;function pw(e,t){t.useNativeTimers?(e.setTimeoutFn=YFe.bind(ma),e.clearTimeoutFn=ZFe.bind(ma)):(e.setTimeoutFn=ma.setTimeout.bind(ma),e.clearTimeoutFn=ma.clearTimeout.bind(ma))}const JFe=1.33;function eBe(e){return typeof e=="string"?tBe(e):Math.ceil((e.byteLength||e.size)*JFe)}function tBe(e){let t=0,n=0;for(let r=0,i=e.length;r=57344?n+=3:(r++,n+=4);return n}function nBe(e){let t="";for(let n in e)e.hasOwnProperty(n)&&(t.length&&(t+="&"),t+=encodeURIComponent(n)+"="+encodeURIComponent(e[n]));return t}function rBe(e){let t={},n=e.split("&");for(let r=0,i=n.length;r0);return t}function uK(){const e=cN(+new Date);return e!==uN?(lN=0,uN=e):e+"."+cN(lN++)}for(;p1{this.readyState="paused",t()};if(this.polling||!this.writable){let r=0;this.polling&&(r++,this.once("pollComplete",function(){--r||n()})),this.writable||(r++,this.once("drain",function(){--r||n()}))}else n()}poll(){this.polling=!0,this.doPoll(),this.emitReserved("poll")}onData(t){const n=r=>{if(this.readyState==="opening"&&r.type==="open"&&this.onOpen(),r.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(r)};WFe(t,this.socket.binaryType).forEach(n),this.readyState!=="closed"&&(this.polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this.poll())}doClose(){const t=()=>{this.write([{type:"close"}])};this.readyState==="open"?t():this.once("open",t)}write(t){this.writable=!1,qFe(t,n=>{this.doWrite(n,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const t=this.opts.secure?"https":"http",n=this.query||{};return this.opts.timestampRequests!==!1&&(n[this.opts.timestampParam]=uK()),!this.supportsBinary&&!n.sid&&(n.b64=1),this.createUri(t,n)}request(t={}){return Object.assign(t,{xd:this.xd,cookieJar:this.cookieJar},this.opts),new Eh(this.uri(),t)}doWrite(t,n){const r=this.request({method:"POST",data:t});r.on("success",n),r.on("error",(i,o)=>{this.onError("xhr post error",i,o)})}doPoll(){const t=this.request();t.on("data",this.onData.bind(this)),t.on("error",(n,r)=>{this.onError("xhr poll error",n,r)}),this.pollXhr=t}}let Eh=class sb extends Lr{constructor(t,n){super(),pw(this,n),this.opts=n,this.method=n.method||"GET",this.uri=t,this.data=n.data!==void 0?n.data:null,this.create()}create(){var t;const n=sK(this.opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");n.xdomain=!!this.opts.xd;const r=this.xhr=new dK(n);try{r.open(this.method,this.uri,!0);try{if(this.opts.extraHeaders){r.setDisableHeaderCheck&&r.setDisableHeaderCheck(!0);for(let i in this.opts.extraHeaders)this.opts.extraHeaders.hasOwnProperty(i)&&r.setRequestHeader(i,this.opts.extraHeaders[i])}}catch{}if(this.method==="POST")try{r.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{r.setRequestHeader("Accept","*/*")}catch{}(t=this.opts.cookieJar)===null||t===void 0||t.addCookies(r),"withCredentials"in r&&(r.withCredentials=this.opts.withCredentials),this.opts.requestTimeout&&(r.timeout=this.opts.requestTimeout),r.onreadystatechange=()=>{var i;r.readyState===3&&((i=this.opts.cookieJar)===null||i===void 0||i.parseCookies(r)),r.readyState===4&&(r.status===200||r.status===1223?this.onLoad():this.setTimeoutFn(()=>{this.onError(typeof r.status=="number"?r.status:0)},0))},r.send(this.data)}catch(i){this.setTimeoutFn(()=>{this.onError(i)},0);return}typeof document<"u"&&(this.index=sb.requestsCount++,sb.requests[this.index]=this)}onError(t){this.emitReserved("error",t,this.xhr),this.cleanup(!0)}cleanup(t){if(!(typeof this.xhr>"u"||this.xhr===null)){if(this.xhr.onreadystatechange=sBe,t)try{this.xhr.abort()}catch{}typeof document<"u"&&delete sb.requests[this.index],this.xhr=null}}onLoad(){const t=this.xhr.responseText;t!==null&&(this.emitReserved("data",t),this.emitReserved("success"),this.cleanup())}abort(){this.cleanup()}};Eh.requestsCount=0;Eh.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",dN);else if(typeof addEventListener=="function"){const e="onpagehide"in ma?"pagehide":"unload";addEventListener(e,dN,!1)}}function dN(){for(let e in Eh.requests)Eh.requests.hasOwnProperty(e)&&Eh.requests[e].abort()}const TP=(()=>typeof Promise=="function"&&typeof Promise.resolve=="function"?t=>Promise.resolve().then(t):(t,n)=>n(t,0))(),g1=ma.WebSocket||ma.MozWebSocket,fN=!0,cBe="arraybuffer",hN=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class dBe extends kP{constructor(t){super(t),this.supportsBinary=!t.forceBase64}get name(){return"websocket"}doOpen(){if(!this.check())return;const t=this.uri(),n=this.opts.protocols,r=hN?{}:sK(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(r.headers=this.opts.extraHeaders);try{this.ws=fN&&!hN?n?new g1(t,n):new g1(t):new g1(t,n,r)}catch(i){return this.emitReserved("error",i)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=t=>this.onClose({description:"websocket connection closed",context:t}),this.ws.onmessage=t=>this.onData(t.data),this.ws.onerror=t=>this.onError("websocket error",t)}write(t){this.writable=!1;for(let n=0;n{const a={};try{fN&&this.ws.send(o)}catch{}i&&TP(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.close(),this.ws=null)}uri(){const t=this.opts.secure?"wss":"ws",n=this.query||{};return this.opts.timestampRequests&&(n[this.opts.timestampParam]=uK()),this.supportsBinary||(n.b64=1),this.createUri(t,n)}check(){return!!g1}}class fBe extends kP{get name(){return"webtransport"}doOpen(){typeof WebTransport=="function"&&(this.transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name]),this.transport.closed.then(()=>{this.onClose()}).catch(t=>{this.onError("webtransport error",t)}),this.transport.ready.then(()=>{this.transport.createBidirectionalStream().then(t=>{const n=QFe(Number.MAX_SAFE_INTEGER,this.socket.binaryType),r=t.readable.pipeThrough(n).getReader(),i=KFe();i.readable.pipeTo(t.writable),this.writer=i.writable.getWriter();const o=()=>{r.read().then(({done:s,value:l})=>{s||(this.onPacket(l),o())}).catch(s=>{})};o();const a={type:"open"};this.query.sid&&(a.data=`{"sid":"${this.query.sid}"}`),this.writer.write(a).then(()=>this.onOpen())})}))}write(t){this.writable=!1;for(let n=0;n{i&&TP(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var t;(t=this.transport)===null||t===void 0||t.close()}}const hBe={websocket:dBe,webtransport:fBe,polling:uBe},pBe=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,gBe=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function M4(e){const t=e,n=e.indexOf("["),r=e.indexOf("]");n!=-1&&r!=-1&&(e=e.substring(0,n)+e.substring(n,r).replace(/:/g,";")+e.substring(r,e.length));let i=pBe.exec(e||""),o={},a=14;for(;a--;)o[gBe[a]]=i[a]||"";return n!=-1&&r!=-1&&(o.source=t,o.host=o.host.substring(1,o.host.length-1).replace(/;/g,":"),o.authority=o.authority.replace("[","").replace("]","").replace(/;/g,":"),o.ipv6uri=!0),o.pathNames=mBe(o,o.path),o.queryKey=yBe(o,o.query),o}function mBe(e,t){const n=/\/{2,9}/g,r=t.replace(n,"/").split("/");return(t.slice(0,1)=="/"||t.length===0)&&r.splice(0,1),t.slice(-1)=="/"&&r.splice(r.length-1,1),r}function yBe(e,t){const n={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(r,i,o){i&&(n[i]=o)}),n}let fK=class Tf extends Lr{constructor(t,n={}){super(),this.binaryType=cBe,this.writeBuffer=[],t&&typeof t=="object"&&(n=t,t=null),t?(t=M4(t),n.hostname=t.host,n.secure=t.protocol==="https"||t.protocol==="wss",n.port=t.port,t.query&&(n.query=t.query)):n.host&&(n.hostname=M4(n.host).host),pw(this,n),this.secure=n.secure!=null?n.secure:typeof location<"u"&&location.protocol==="https:",n.hostname&&!n.port&&(n.port=this.secure?"443":"80"),this.hostname=n.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=n.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=n.transports||["polling","websocket","webtransport"],this.writeBuffer=[],this.prevBufferLen=0,this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},n),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=rBe(this.opts.query)),this.id=null,this.upgrades=null,this.pingInterval=null,this.pingTimeout=null,this.pingTimeoutTimer=null,typeof addEventListener=="function"&&(this.opts.closeOnBeforeunload&&(this.beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this.beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this.offlineEventListener=()=>{this.onClose("transport close",{description:"network connection lost"})},addEventListener("offline",this.offlineEventListener,!1))),this.open()}createTransport(t){const n=Object.assign({},this.opts.query);n.EIO=aK,n.transport=t,this.id&&(n.sid=this.id);const r=Object.assign({},this.opts,{query:n,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[t]);return new hBe[t](r)}open(){let t;if(this.opts.rememberUpgrade&&Tf.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1)t="websocket";else if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}else t=this.transports[0];this.readyState="opening";try{t=this.createTransport(t)}catch{this.transports.shift(),this.open();return}t.open(),this.setTransport(t)}setTransport(t){this.transport&&this.transport.removeAllListeners(),this.transport=t,t.on("drain",this.onDrain.bind(this)).on("packet",this.onPacket.bind(this)).on("error",this.onError.bind(this)).on("close",n=>this.onClose("transport close",n))}probe(t){let n=this.createTransport(t),r=!1;Tf.priorWebsocketSuccess=!1;const i=()=>{r||(n.send([{type:"ping",data:"probe"}]),n.once("packet",d=>{if(!r)if(d.type==="pong"&&d.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",n),!n)return;Tf.priorWebsocketSuccess=n.name==="websocket",this.transport.pause(()=>{r||this.readyState!=="closed"&&(c(),this.setTransport(n),n.send([{type:"upgrade"}]),this.emitReserved("upgrade",n),n=null,this.upgrading=!1,this.flush())})}else{const f=new Error("probe error");f.transport=n.name,this.emitReserved("upgradeError",f)}}))};function o(){r||(r=!0,c(),n.close(),n=null)}const a=d=>{const f=new Error("probe error: "+d);f.transport=n.name,o(),this.emitReserved("upgradeError",f)};function s(){a("transport closed")}function l(){a("socket closed")}function u(d){n&&d.name!==n.name&&o()}const c=()=>{n.removeListener("open",i),n.removeListener("error",a),n.removeListener("close",s),this.off("close",l),this.off("upgrading",u)};n.once("open",i),n.once("error",a),n.once("close",s),this.once("close",l),this.once("upgrading",u),this.upgrades.indexOf("webtransport")!==-1&&t!=="webtransport"?this.setTimeoutFn(()=>{r||n.open()},200):n.open()}onOpen(){if(this.readyState="open",Tf.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush(),this.readyState==="open"&&this.opts.upgrade){let t=0;const n=this.upgrades.length;for(;t{this.onClose("ping timeout")},this.pingInterval+this.pingTimeout),this.opts.autoUnref&&this.pingTimeoutTimer.unref()}onDrain(){this.writeBuffer.splice(0,this.prevBufferLen),this.prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const t=this.getWritablePackets();this.transport.send(t),this.prevBufferLen=t.length,this.emitReserved("flush")}}getWritablePackets(){if(!(this.maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let n=1;for(let r=0;r0&&n>this.maxPayload)return this.writeBuffer.slice(0,r);n+=2}return this.writeBuffer}write(t,n,r){return this.sendPacket("message",t,n,r),this}send(t,n,r){return this.sendPacket("message",t,n,r),this}sendPacket(t,n,r,i){if(typeof n=="function"&&(i=n,n=void 0),typeof r=="function"&&(i=r,r=null),this.readyState==="closing"||this.readyState==="closed")return;r=r||{},r.compress=r.compress!==!1;const o={type:t,data:n,options:r};this.emitReserved("packetCreate",o),this.writeBuffer.push(o),i&&this.once("flush",i),this.flush()}close(){const t=()=>{this.onClose("forced close"),this.transport.close()},n=()=>{this.off("upgrade",n),this.off("upgradeError",n),t()},r=()=>{this.once("upgrade",n),this.once("upgradeError",n)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?r():t()}):this.upgrading?r():t()),this}onError(t){Tf.priorWebsocketSuccess=!1,this.emitReserved("error",t),this.onClose("transport error",t)}onClose(t,n){(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")&&(this.clearTimeoutFn(this.pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),typeof removeEventListener=="function"&&(removeEventListener("beforeunload",this.beforeunloadEventListener,!1),removeEventListener("offline",this.offlineEventListener,!1)),this.readyState="closed",this.id=null,this.emitReserved("close",t,n),this.writeBuffer=[],this.prevBufferLen=0)}filterUpgrades(t){const n=[];let r=0;const i=t.length;for(;rtypeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer,hK=Object.prototype.toString,SBe=typeof Blob=="function"||typeof Blob<"u"&&hK.call(Blob)==="[object BlobConstructor]",xBe=typeof File=="function"||typeof File<"u"&&hK.call(File)==="[object FileConstructor]";function AP(e){return bBe&&(e instanceof ArrayBuffer||_Be(e))||SBe&&e instanceof Blob||xBe&&e instanceof File}function lb(e,t){if(!e||typeof e!="object")return!1;if(Array.isArray(e)){for(let n=0,r=e.length;n=0&&e.num{delete this.acks[t];for(let a=0;a{this.io.clearTimeoutFn(o),n.apply(this,[null,...a])}}emitWithAck(t,...n){const r=this.flags.timeout!==void 0||this._opts.ackTimeout!==void 0;return new Promise((i,o)=>{n.push((a,s)=>r?a?o(a):i(s):i(a)),this.emit(t,...n)})}_addToQueue(t){let n;typeof t[t.length-1]=="function"&&(n=t.pop());const r={id:this._queueSeq++,tryCount:0,pending:!1,args:t,flags:Object.assign({fromQueue:!0},this.flags)};t.push((i,...o)=>r!==this._queue[0]?void 0:(i!==null?r.tryCount>this._opts.retries&&(this._queue.shift(),n&&n(i)):(this._queue.shift(),n&&n(null,...o)),r.pending=!1,this._drainQueue())),this._queue.push(r),this._drainQueue()}_drainQueue(t=!1){if(!this.connected||this._queue.length===0)return;const n=this._queue[0];n.pending&&!t||(n.pending=!0,n.tryCount++,this.flags=n.flags,this.emit.apply(this,n.args))}packet(t){t.nsp=this.nsp,this.io._packet(t)}onopen(){typeof this.auth=="function"?this.auth(t=>{this._sendConnectPacket(t)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(t){this.packet({type:Ft.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},t):t})}onerror(t){this.connected||this.emitReserved("connect_error",t)}onclose(t,n){this.connected=!1,delete this.id,this.emitReserved("disconnect",t,n)}onpacket(t){if(t.nsp===this.nsp)switch(t.type){case Ft.CONNECT:t.data&&t.data.sid?this.onconnect(t.data.sid,t.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case Ft.EVENT:case Ft.BINARY_EVENT:this.onevent(t);break;case Ft.ACK:case Ft.BINARY_ACK:this.onack(t);break;case Ft.DISCONNECT:this.ondisconnect();break;case Ft.CONNECT_ERROR:this.destroy();const r=new Error(t.data.message);r.data=t.data.data,this.emitReserved("connect_error",r);break}}onevent(t){const n=t.data||[];t.id!=null&&n.push(this.ack(t.id)),this.connected?this.emitEvent(n):this.receiveBuffer.push(Object.freeze(n))}emitEvent(t){if(this._anyListeners&&this._anyListeners.length){const n=this._anyListeners.slice();for(const r of n)r.apply(this,t)}super.emit.apply(this,t),this._pid&&t.length&&typeof t[t.length-1]=="string"&&(this._lastOffset=t[t.length-1])}ack(t){const n=this;let r=!1;return function(...i){r||(r=!0,n.packet({type:Ft.ACK,id:t,data:i}))}}onack(t){const n=this.acks[t.id];typeof n=="function"&&(n.apply(this,t.data),delete this.acks[t.id])}onconnect(t,n){this.id=t,this.recovered=n&&this._pid===n,this._pid=n,this.connected=!0,this.emitBuffered(),this.emitReserved("connect"),this._drainQueue(!0)}emitBuffered(){this.receiveBuffer.forEach(t=>this.emitEvent(t)),this.receiveBuffer=[],this.sendBuffer.forEach(t=>{this.notifyOutgoingListeners(t),this.packet(t)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(t=>t()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:Ft.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(t){return this.flags.compress=t,this}get volatile(){return this.flags.volatile=!0,this}timeout(t){return this.flags.timeout=t,this}onAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(t),this}prependAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(t),this}offAny(t){if(!this._anyListeners)return this;if(t){const n=this._anyListeners;for(let r=0;r0&&e.jitter<=1?e.jitter:0,this.attempts=0}Pp.prototype.duration=function(){var e=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var t=Math.random(),n=Math.floor(t*this.jitter*e);e=Math.floor(t*10)&1?e+n:e-n}return Math.min(e,this.max)|0};Pp.prototype.reset=function(){this.attempts=0};Pp.prototype.setMin=function(e){this.ms=e};Pp.prototype.setMax=function(e){this.max=e};Pp.prototype.setJitter=function(e){this.jitter=e};class D4 extends Lr{constructor(t,n){var r;super(),this.nsps={},this.subs=[],t&&typeof t=="object"&&(n=t,t=void 0),n=n||{},n.path=n.path||"/socket.io",this.opts=n,pw(this,n),this.reconnection(n.reconnection!==!1),this.reconnectionAttempts(n.reconnectionAttempts||1/0),this.reconnectionDelay(n.reconnectionDelay||1e3),this.reconnectionDelayMax(n.reconnectionDelayMax||5e3),this.randomizationFactor((r=n.randomizationFactor)!==null&&r!==void 0?r:.5),this.backoff=new Pp({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(n.timeout==null?2e4:n.timeout),this._readyState="closed",this.uri=t;const i=n.parser||PBe;this.encoder=new i.Encoder,this.decoder=new i.Decoder,this._autoConnect=n.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(t){return arguments.length?(this._reconnection=!!t,this):this._reconnection}reconnectionAttempts(t){return t===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=t,this)}reconnectionDelay(t){var n;return t===void 0?this._reconnectionDelay:(this._reconnectionDelay=t,(n=this.backoff)===null||n===void 0||n.setMin(t),this)}randomizationFactor(t){var n;return t===void 0?this._randomizationFactor:(this._randomizationFactor=t,(n=this.backoff)===null||n===void 0||n.setJitter(t),this)}reconnectionDelayMax(t){var n;return t===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=t,(n=this.backoff)===null||n===void 0||n.setMax(t),this)}timeout(t){return arguments.length?(this._timeout=t,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(t){if(~this._readyState.indexOf("open"))return this;this.engine=new fK(this.uri,this.opts);const n=this.engine,r=this;this._readyState="opening",this.skipReconnect=!1;const i=Ga(n,"open",function(){r.onopen(),t&&t()}),o=s=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",s),t?t(s):this.maybeReconnectOnOpen()},a=Ga(n,"error",o);if(this._timeout!==!1){const s=this._timeout,l=this.setTimeoutFn(()=>{i(),o(new Error("timeout")),n.close()},s);this.opts.autoUnref&&l.unref(),this.subs.push(()=>{this.clearTimeoutFn(l)})}return this.subs.push(i),this.subs.push(a),this}connect(t){return this.open(t)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const t=this.engine;this.subs.push(Ga(t,"ping",this.onping.bind(this)),Ga(t,"data",this.ondata.bind(this)),Ga(t,"error",this.onerror.bind(this)),Ga(t,"close",this.onclose.bind(this)),Ga(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(t){try{this.decoder.add(t)}catch(n){this.onclose("parse error",n)}}ondecoded(t){TP(()=>{this.emitReserved("packet",t)},this.setTimeoutFn)}onerror(t){this.emitReserved("error",t)}socket(t,n){let r=this.nsps[t];return r?this._autoConnect&&!r.active&&r.connect():(r=new pK(this,t,n),this.nsps[t]=r),r}_destroy(t){const n=Object.keys(this.nsps);for(const r of n)if(this.nsps[r].active)return;this._close()}_packet(t){const n=this.encoder.encode(t);for(let r=0;rt()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close"),this.engine&&this.engine.close()}disconnect(){return this._close()}onclose(t,n){this.cleanup(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",t,n),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const t=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const n=this.backoff.duration();this._reconnecting=!0;const r=this.setTimeoutFn(()=>{t.skipReconnect||(this.emitReserved("reconnect_attempt",t.backoff.attempts),!t.skipReconnect&&t.open(i=>{i?(t._reconnecting=!1,t.reconnect(),this.emitReserved("reconnect_error",i)):t.onreconnect()}))},n);this.opts.autoUnref&&r.unref(),this.subs.push(()=>{this.clearTimeoutFn(r)})}}onreconnect(){const t=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",t)}}const cg={};function ub(e,t){typeof e=="object"&&(t=e,e=void 0),t=t||{};const n=vBe(e,t.path||"/socket.io"),r=n.source,i=n.id,o=n.path,a=cg[i]&&o in cg[i].nsps,s=t.forceNew||t["force new connection"]||t.multiplex===!1||a;let l;return s?l=new D4(r,t):(cg[i]||(cg[i]=new D4(r,t)),l=cg[i]),n.query&&!t.query&&(t.query=n.queryKey),l.socket(n.path,t)}Object.assign(ub,{Manager:D4,Socket:pK,io:ub,connect:ub});const gN=()=>{let e=!1,n=`${window.location.protocol==="https:"?"wss":"ws"}://${window.location.host}`;const r={timeout:6e4,path:"/ws/socket.io",autoConnect:!1};if(["nodes","package"].includes("production")){const a=o0.get();a&&(n=a.replace(/^https?\:\/\//i,""));const s=Zh.get();s&&(r.auth={token:s}),r.transports=["websocket","polling"]}const i=ub(n,r);return a=>s=>l=>{e||(jFe({storeApi:a,socket:i}),e=!0,i.connect()),s(l)}},RBe=""+new URL("logo-13003d72.png",import.meta.url).href,OBe=()=>W.jsxs(wP,{position:"relative",width:"100vw",height:"100vh",alignItems:"center",justifyContent:"center",bg:"#151519",children:[W.jsx(xP,{src:RBe,w:"8rem",h:"8rem"}),W.jsx(bP,{label:"Loading",color:"grey",position:"absolute",size:"sm",width:"24px !important",height:"24px !important",right:"1.5rem",bottom:"1.5rem"})]}),MBe=I.memo(OBe);function L4(e){"@babel/helpers - typeof";return L4=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},L4(e)}var gK=[],NBe=gK.forEach,$Be=gK.slice;function F4(e){return NBe.call($Be.call(arguments,1),function(t){if(t)for(var n in t)e[n]===void 0&&(e[n]=t[n])}),e}function mK(){return typeof XMLHttpRequest=="function"||(typeof XMLHttpRequest>"u"?"undefined":L4(XMLHttpRequest))==="object"}function DBe(e){return!!e&&typeof e.then=="function"}function LBe(e){return DBe(e)?e:Promise.resolve(e)}function FBe(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var B4={exports:{}},m1={exports:{}},mN;function BBe(){return mN||(mN=1,function(e,t){var n=typeof self<"u"?self:mt,r=function(){function o(){this.fetch=!1,this.DOMException=n.DOMException}return o.prototype=n,new o}();(function(o){(function(a){var s={searchParams:"URLSearchParams"in o,iterable:"Symbol"in o&&"iterator"in Symbol,blob:"FileReader"in o&&"Blob"in o&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in o,arrayBuffer:"ArrayBuffer"in o};function l(E){return E&&DataView.prototype.isPrototypeOf(E)}if(s.arrayBuffer)var u=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],c=ArrayBuffer.isView||function(E){return E&&u.indexOf(Object.prototype.toString.call(E))>-1};function d(E){if(typeof E!="string"&&(E=String(E)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(E))throw new TypeError("Invalid character in header field name");return E.toLowerCase()}function f(E){return typeof E!="string"&&(E=String(E)),E}function h(E){var A={next:function(){var D=E.shift();return{done:D===void 0,value:D}}};return s.iterable&&(A[Symbol.iterator]=function(){return A}),A}function p(E){this.map={},E instanceof p?E.forEach(function(A,D){this.append(D,A)},this):Array.isArray(E)?E.forEach(function(A){this.append(A[0],A[1])},this):E&&Object.getOwnPropertyNames(E).forEach(function(A){this.append(A,E[A])},this)}p.prototype.append=function(E,A){E=d(E),A=f(A);var D=this.map[E];this.map[E]=D?D+", "+A:A},p.prototype.delete=function(E){delete this.map[d(E)]},p.prototype.get=function(E){return E=d(E),this.has(E)?this.map[E]:null},p.prototype.has=function(E){return this.map.hasOwnProperty(d(E))},p.prototype.set=function(E,A){this.map[d(E)]=f(A)},p.prototype.forEach=function(E,A){for(var D in this.map)this.map.hasOwnProperty(D)&&E.call(A,this.map[D],D,this)},p.prototype.keys=function(){var E=[];return this.forEach(function(A,D){E.push(D)}),h(E)},p.prototype.values=function(){var E=[];return this.forEach(function(A){E.push(A)}),h(E)},p.prototype.entries=function(){var E=[];return this.forEach(function(A,D){E.push([D,A])}),h(E)},s.iterable&&(p.prototype[Symbol.iterator]=p.prototype.entries);function m(E){if(E.bodyUsed)return Promise.reject(new TypeError("Already read"));E.bodyUsed=!0}function _(E){return new Promise(function(A,D){E.onload=function(){A(E.result)},E.onerror=function(){D(E.error)}})}function b(E){var A=new FileReader,D=_(A);return A.readAsArrayBuffer(E),D}function v(E){var A=new FileReader,D=_(A);return A.readAsText(E),D}function g(E){for(var A=new Uint8Array(E),D=new Array(A.length),L=0;L-1?A:E}function C(E,A){A=A||{};var D=A.body;if(E instanceof C){if(E.bodyUsed)throw new TypeError("Already read");this.url=E.url,this.credentials=E.credentials,A.headers||(this.headers=new p(E.headers)),this.method=E.method,this.mode=E.mode,this.signal=E.signal,!D&&E._bodyInit!=null&&(D=E._bodyInit,E.bodyUsed=!0)}else this.url=String(E);if(this.credentials=A.credentials||this.credentials||"same-origin",(A.headers||!this.headers)&&(this.headers=new p(A.headers)),this.method=x(A.method||this.method||"GET"),this.mode=A.mode||this.mode||null,this.signal=A.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&D)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(D)}C.prototype.clone=function(){return new C(this,{body:this._bodyInit})};function T(E){var A=new FormData;return E.trim().split("&").forEach(function(D){if(D){var L=D.split("="),M=L.shift().replace(/\+/g," "),R=L.join("=").replace(/\+/g," ");A.append(decodeURIComponent(M),decodeURIComponent(R))}}),A}function k(E){var A=new p,D=E.replace(/\r?\n[\t ]+/g," ");return D.split(/\r?\n/).forEach(function(L){var M=L.split(":"),R=M.shift().trim();if(R){var N=M.join(":").trim();A.append(R,N)}}),A}S.call(C.prototype);function P(E,A){A||(A={}),this.type="default",this.status=A.status===void 0?200:A.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in A?A.statusText:"OK",this.headers=new p(A.headers),this.url=A.url||"",this._initBody(E)}S.call(P.prototype),P.prototype.clone=function(){return new P(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new p(this.headers),url:this.url})},P.error=function(){var E=new P(null,{status:0,statusText:""});return E.type="error",E};var $=[301,302,303,307,308];P.redirect=function(E,A){if($.indexOf(A)===-1)throw new RangeError("Invalid status code");return new P(null,{status:A,headers:{location:E}})},a.DOMException=o.DOMException;try{new a.DOMException}catch{a.DOMException=function(A,D){this.message=A,this.name=D;var L=Error(A);this.stack=L.stack},a.DOMException.prototype=Object.create(Error.prototype),a.DOMException.prototype.constructor=a.DOMException}function O(E,A){return new Promise(function(D,L){var M=new C(E,A);if(M.signal&&M.signal.aborted)return L(new a.DOMException("Aborted","AbortError"));var R=new XMLHttpRequest;function N(){R.abort()}R.onload=function(){var B={status:R.status,statusText:R.statusText,headers:k(R.getAllResponseHeaders()||"")};B.url="responseURL"in R?R.responseURL:B.headers.get("X-Request-URL");var U="response"in R?R.response:R.responseText;D(new P(U,B))},R.onerror=function(){L(new TypeError("Network request failed"))},R.ontimeout=function(){L(new TypeError("Network request failed"))},R.onabort=function(){L(new a.DOMException("Aborted","AbortError"))},R.open(M.method,M.url,!0),M.credentials==="include"?R.withCredentials=!0:M.credentials==="omit"&&(R.withCredentials=!1),"responseType"in R&&s.blob&&(R.responseType="blob"),M.headers.forEach(function(B,U){R.setRequestHeader(U,B)}),M.signal&&(M.signal.addEventListener("abort",N),R.onreadystatechange=function(){R.readyState===4&&M.signal.removeEventListener("abort",N)}),R.send(typeof M._bodyInit>"u"?null:M._bodyInit)})}return O.polyfill=!0,o.fetch||(o.fetch=O,o.Headers=p,o.Request=C,o.Response=P),a.Headers=p,a.Request=C,a.Response=P,a.fetch=O,Object.defineProperty(a,"__esModule",{value:!0}),a})({})})(r),r.fetch.ponyfill=!0,delete r.fetch.polyfill;var i=r;t=i.fetch,t.default=i.fetch,t.fetch=i.fetch,t.Headers=i.Headers,t.Request=i.Request,t.Response=i.Response,e.exports=t}(m1,m1.exports)),m1.exports}(function(e,t){var n;if(typeof fetch=="function"&&(typeof mt<"u"&&mt.fetch?n=mt.fetch:typeof window<"u"&&window.fetch?n=window.fetch:n=fetch),typeof FBe<"u"&&(typeof window>"u"||typeof window.document>"u")){var r=n||BBe();r.default&&(r=r.default),t.default=r,e.exports=t.default}})(B4,B4.exports);var yK=B4.exports;const vK=pc(yK),yN=FN({__proto__:null,default:vK},[yK]);function iS(e){"@babel/helpers - typeof";return iS=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},iS(e)}var Fl;typeof fetch=="function"&&(typeof global<"u"&&global.fetch?Fl=global.fetch:typeof window<"u"&&window.fetch?Fl=window.fetch:Fl=fetch);var O0;mK()&&(typeof global<"u"&&global.XMLHttpRequest?O0=global.XMLHttpRequest:typeof window<"u"&&window.XMLHttpRequest&&(O0=window.XMLHttpRequest));var oS;typeof ActiveXObject=="function"&&(typeof global<"u"&&global.ActiveXObject?oS=global.ActiveXObject:typeof window<"u"&&window.ActiveXObject&&(oS=window.ActiveXObject));!Fl&&yN&&!O0&&!oS&&(Fl=vK||yN);typeof Fl!="function"&&(Fl=void 0);var z4=function(t,n){if(n&&iS(n)==="object"){var r="";for(var i in n)r+="&"+encodeURIComponent(i)+"="+encodeURIComponent(n[i]);if(!r)return t;t=t+(t.indexOf("?")!==-1?"&":"?")+r.slice(1)}return t},vN=function(t,n,r){Fl(t,n).then(function(i){if(!i.ok)return r(i.statusText||"Error",{status:i.status});i.text().then(function(o){r(null,{status:i.status,data:o})}).catch(r)}).catch(r)},bN=!1,zBe=function(t,n,r,i){t.queryStringParams&&(n=z4(n,t.queryStringParams));var o=F4({},typeof t.customHeaders=="function"?t.customHeaders():t.customHeaders);r&&(o["Content-Type"]="application/json");var a=typeof t.requestOptions=="function"?t.requestOptions(r):t.requestOptions,s=F4({method:r?"POST":"GET",body:r?t.stringify(r):void 0,headers:o},bN?{}:a);try{vN(n,s,i)}catch(l){if(!a||Object.keys(a).length===0||!l.message||l.message.indexOf("not implemented")<0)return i(l);try{Object.keys(a).forEach(function(u){delete s[u]}),vN(n,s,i),bN=!0}catch(u){i(u)}}},jBe=function(t,n,r,i){r&&iS(r)==="object"&&(r=z4("",r).slice(1)),t.queryStringParams&&(n=z4(n,t.queryStringParams));try{var o;O0?o=new O0:o=new oS("MSXML2.XMLHTTP.3.0"),o.open(r?"POST":"GET",n,1),t.crossDomain||o.setRequestHeader("X-Requested-With","XMLHttpRequest"),o.withCredentials=!!t.withCredentials,r&&o.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),o.overrideMimeType&&o.overrideMimeType("application/json");var a=t.customHeaders;if(a=typeof a=="function"?a():a,a)for(var s in a)o.setRequestHeader(s,a[s]);o.onreadystatechange=function(){o.readyState>3&&i(o.status>=400?o.statusText:null,{status:o.status,data:o.responseText})},o.send(r)}catch(l){console&&console.log(l)}},UBe=function(t,n,r,i){if(typeof r=="function"&&(i=r,r=void 0),i=i||function(){},Fl&&n.indexOf("file:")!==0)return zBe(t,n,r,i);if(mK()||typeof ActiveXObject=="function")return jBe(t,n,r,i);i(new Error("No fetch and no xhr implementation found!"))};function M0(e){"@babel/helpers - typeof";return M0=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},M0(e)}function VBe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _N(e,t){for(var n=0;n1&&arguments[1]!==void 0?arguments[1]:{},r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};VBe(this,e),this.services=t,this.options=n,this.allOptions=r,this.type="backend",this.init(t,n,r)}return GBe(e,[{key:"init",value:function(n){var r=this,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};this.services=n,this.options=F4(i,this.options||{},WBe()),this.allOptions=o,this.services&&this.options.reloadInterval&&setInterval(function(){return r.reload()},this.options.reloadInterval)}},{key:"readMulti",value:function(n,r,i){this._readAny(n,n,r,r,i)}},{key:"read",value:function(n,r,i){this._readAny([n],n,[r],r,i)}},{key:"_readAny",value:function(n,r,i,o,a){var s=this,l=this.options.loadPath;typeof this.options.loadPath=="function"&&(l=this.options.loadPath(n,i)),l=LBe(l),l.then(function(u){if(!u)return a(null,{});var c=s.services.interpolator.interpolate(u,{lng:n.join("+"),ns:i.join("+")});s.loadUrl(c,a,r,o)})}},{key:"loadUrl",value:function(n,r,i,o){var a=this,s=typeof i=="string"?[i]:i,l=typeof o=="string"?[o]:o,u=this.options.parseLoadPayload(s,l);this.options.request(this.options,n,u,function(c,d){if(d&&(d.status>=500&&d.status<600||!d.status))return r("failed loading "+n+"; status code: "+d.status,!0);if(d&&d.status>=400&&d.status<500)return r("failed loading "+n+"; status code: "+d.status,!1);if(!d&&c&&c.message&&c.message.indexOf("Failed to fetch")>-1)return r("failed loading "+n+": "+c.message,!0);if(c)return r(c,!1);var f,h;try{typeof d.data=="string"?f=a.options.parse(d.data,i,o):f=d.data}catch{h="failed parsing "+n+" to json"}if(h)return r(h,!1);r(null,f)})}},{key:"create",value:function(n,r,i,o,a){var s=this;if(this.options.addPath){typeof n=="string"&&(n=[n]);var l=this.options.parsePayload(r,i,o),u=0,c=[],d=[];n.forEach(function(f){var h=s.options.addPath;typeof s.options.addPath=="function"&&(h=s.options.addPath(f,r));var p=s.services.interpolator.interpolate(h,{lng:f,ns:r});s.options.request(s.options,p,l,function(m,_){u+=1,c.push(m),d.push(_),u===n.length&&typeof a=="function"&&a(c,d)})})}}},{key:"reload",value:function(){var n=this,r=this.services,i=r.backendConnector,o=r.languageUtils,a=r.logger,s=i.language;if(!(s&&s.toLowerCase()==="cimode")){var l=[],u=function(d){var f=o.toResolveHierarchy(d);f.forEach(function(h){l.indexOf(h)<0&&l.push(h)})};u(s),this.allOptions.preload&&this.allOptions.preload.forEach(function(c){return u(c)}),l.forEach(function(c){n.allOptions.ns.forEach(function(d){i.read(c,d,"read",null,null,function(f,h){f&&a.warn("loading namespace ".concat(d," for language ").concat(c," failed"),f),!f&&h&&a.log("loaded namespace ".concat(d," for language ").concat(c),h),i.loaded("".concat(c,"|").concat(d),f,h)})})})}}}]),e}();_K.type="backend";be.use(_K).use(Tke).init({fallbackLng:"en",debug:!1,backend:{loadPath:"/locales/{{lng}}.json"},interpolation:{escapeValue:!1},returnNull:!1});const gw=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Ip(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function IP(e){return"nodeType"in e}function uo(e){var t,n;return e?Ip(e)?e:IP(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function RP(e){const{Document:t}=uo(e);return e instanceof t}function By(e){return Ip(e)?!1:e instanceof uo(e).HTMLElement}function KBe(e){return e instanceof uo(e).SVGElement}function Rp(e){return e?Ip(e)?e.document:IP(e)?RP(e)?e:By(e)?e.ownerDocument:document:document:document}const Zs=gw?I.useLayoutEffect:I.useEffect;function mw(e){const t=I.useRef(e);return Zs(()=>{t.current=e}),I.useCallback(function(){for(var n=arguments.length,r=new Array(n),i=0;i{e.current=setInterval(r,i)},[]),n=I.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,n]}function N0(e,t){t===void 0&&(t=[e]);const n=I.useRef(e);return Zs(()=>{n.current!==e&&(n.current=e)},t),n}function zy(e,t){const n=I.useRef();return I.useMemo(()=>{const r=e(n.current);return n.current=r,r},[...t])}function aS(e){const t=mw(e),n=I.useRef(null),r=I.useCallback(i=>{i!==n.current&&(t==null||t(i,n.current)),n.current=i},[]);return[n,r]}function sS(e){const t=I.useRef();return I.useEffect(()=>{t.current=e},[e]),t.current}let F5={};function yw(e,t){return I.useMemo(()=>{if(t)return t;const n=F5[e]==null?0:F5[e]+1;return F5[e]=n,e+"-"+n},[e,t])}function SK(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i{const s=Object.entries(a);for(const[l,u]of s){const c=o[l];c!=null&&(o[l]=c+e*u)}return o},{...t})}}const kh=SK(1),lS=SK(-1);function XBe(e){return"clientX"in e&&"clientY"in e}function OP(e){if(!e)return!1;const{KeyboardEvent:t}=uo(e.target);return t&&e instanceof t}function YBe(e){if(!e)return!1;const{TouchEvent:t}=uo(e.target);return t&&e instanceof t}function $0(e){if(YBe(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return XBe(e)?{x:e.clientX,y:e.clientY}:null}const D0=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:n}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:n}=e;return"scaleX("+t+") scaleY("+n+")"}},Transform:{toString(e){if(e)return[D0.Translate.toString(e),D0.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+" "+n+"ms "+r}}}),SN="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function ZBe(e){return e.matches(SN)?e:e.querySelector(SN)}const JBe={display:"none"};function eze(e){let{id:t,value:n}=e;return En.createElement("div",{id:t,style:JBe},n)}const tze={position:"fixed",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};function nze(e){let{id:t,announcement:n}=e;return En.createElement("div",{id:t,style:tze,role:"status","aria-live":"assertive","aria-atomic":!0},n)}function rze(){const[e,t]=I.useState("");return{announce:I.useCallback(r=>{r!=null&&t(r)},[]),announcement:e}}const xK=I.createContext(null);function ize(e){const t=I.useContext(xK);I.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of ");return t(e)},[e,t])}function oze(){const[e]=I.useState(()=>new Set),t=I.useCallback(r=>(e.add(r),()=>e.delete(r)),[e]);return[I.useCallback(r=>{let{type:i,event:o}=r;e.forEach(a=>{var s;return(s=a[i])==null?void 0:s.call(a,o)})},[e]),t]}const aze={draggable:` - To pick up a draggable item, press the space bar. - While dragging, use the arrow keys to move the item. - Press space again to drop the item in its new position, or press escape to cancel. - `},sze={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was moved over droppable area "+n.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was dropped over droppable area "+n.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function lze(e){let{announcements:t=sze,container:n,hiddenTextDescribedById:r,screenReaderInstructions:i=aze}=e;const{announce:o,announcement:a}=rze(),s=yw("DndLiveRegion"),[l,u]=I.useState(!1);if(I.useEffect(()=>{u(!0)},[]),ize(I.useMemo(()=>({onDragStart(d){let{active:f}=d;o(t.onDragStart({active:f}))},onDragMove(d){let{active:f,over:h}=d;t.onDragMove&&o(t.onDragMove({active:f,over:h}))},onDragOver(d){let{active:f,over:h}=d;o(t.onDragOver({active:f,over:h}))},onDragEnd(d){let{active:f,over:h}=d;o(t.onDragEnd({active:f,over:h}))},onDragCancel(d){let{active:f,over:h}=d;o(t.onDragCancel({active:f,over:h}))}}),[o,t])),!l)return null;const c=En.createElement(En.Fragment,null,En.createElement(eze,{id:r,value:i.draggable}),En.createElement(nze,{id:s,announcement:a}));return n?Uo.createPortal(c,n):c}var Hr;(function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"})(Hr||(Hr={}));function uS(){}function xN(e,t){return I.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function uze(){for(var e=arguments.length,t=new Array(e),n=0;n[...t].filter(r=>r!=null),[...t])}const us=Object.freeze({x:0,y:0});function cze(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function dze(e,t){const n=$0(e);if(!n)return"0 0";const r={x:(n.x-t.left)/t.width*100,y:(n.y-t.top)/t.height*100};return r.x+"% "+r.y+"%"}function fze(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function hze(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function pze(e){let{left:t,top:n,height:r,width:i}=e;return[{x:t,y:n},{x:t+i,y:n},{x:t,y:n+r},{x:t+i,y:n+r}]}function gze(e,t){if(!e||e.length===0)return null;const[n]=e;return t?n[t]:n}function mze(e,t){const n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),i=Math.min(t.left+t.width,e.left+e.width),o=Math.min(t.top+t.height,e.top+e.height),a=i-r,s=o-n;if(r{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const i=[];for(const o of r){const{id:a}=o,s=n.get(a);if(s){const l=mze(s,t);l>0&&i.push({id:a,data:{droppableContainer:o,value:l}})}}return i.sort(hze)};function vze(e,t){const{top:n,left:r,bottom:i,right:o}=t;return n<=e.y&&e.y<=i&&r<=e.x&&e.x<=o}const bze=e=>{let{droppableContainers:t,droppableRects:n,pointerCoordinates:r}=e;if(!r)return[];const i=[];for(const o of t){const{id:a}=o,s=n.get(a);if(s&&vze(r,s)){const u=pze(s).reduce((d,f)=>d+cze(r,f),0),c=Number((u/4).toFixed(4));i.push({id:a,data:{droppableContainer:o,value:c}})}}return i.sort(fze)};function _ze(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function wK(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:us}function Sze(e){return function(n){for(var r=arguments.length,i=new Array(r>1?r-1:0),o=1;o({...a,top:a.top+e*s.y,bottom:a.bottom+e*s.y,left:a.left+e*s.x,right:a.right+e*s.x}),{...n})}}const xze=Sze(1);function CK(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function wze(e,t,n){const r=CK(t);if(!r)return e;const{scaleX:i,scaleY:o,x:a,y:s}=r,l=e.left-a-(1-i)*parseFloat(n),u=e.top-s-(1-o)*parseFloat(n.slice(n.indexOf(" ")+1)),c=i?e.width/i:e.width,d=o?e.height/o:e.height;return{width:c,height:d,top:u,right:l+c,bottom:u+d,left:l}}const Cze={ignoreTransform:!1};function jy(e,t){t===void 0&&(t=Cze);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:u,transformOrigin:c}=uo(e).getComputedStyle(e);u&&(n=wze(n,u,c))}const{top:r,left:i,width:o,height:a,bottom:s,right:l}=n;return{top:r,left:i,width:o,height:a,bottom:s,right:l}}function wN(e){return jy(e,{ignoreTransform:!0})}function Eze(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function kze(e,t){return t===void 0&&(t=uo(e).getComputedStyle(e)),t.position==="fixed"}function Tze(e,t){t===void 0&&(t=uo(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(i=>{const o=t[i];return typeof o=="string"?n.test(o):!1})}function MP(e,t){const n=[];function r(i){if(t!=null&&n.length>=t||!i)return n;if(RP(i)&&i.scrollingElement!=null&&!n.includes(i.scrollingElement))return n.push(i.scrollingElement),n;if(!By(i)||KBe(i)||n.includes(i))return n;const o=uo(e).getComputedStyle(i);return i!==e&&Tze(i,o)&&n.push(i),kze(i,o)?n:r(i.parentNode)}return e?r(e):n}function EK(e){const[t]=MP(e,1);return t??null}function B5(e){return!gw||!e?null:Ip(e)?e:IP(e)?RP(e)||e===Rp(e).scrollingElement?window:By(e)?e:null:null}function kK(e){return Ip(e)?e.scrollX:e.scrollLeft}function TK(e){return Ip(e)?e.scrollY:e.scrollTop}function j4(e){return{x:kK(e),y:TK(e)}}var ui;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(ui||(ui={}));function AK(e){return!gw||!e?!1:e===document.scrollingElement}function PK(e){const t={x:0,y:0},n=AK(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height},i=e.scrollTop<=t.y,o=e.scrollLeft<=t.x,a=e.scrollTop>=r.y,s=e.scrollLeft>=r.x;return{isTop:i,isLeft:o,isBottom:a,isRight:s,maxScroll:r,minScroll:t}}const Aze={x:.2,y:.2};function Pze(e,t,n,r,i){let{top:o,left:a,right:s,bottom:l}=n;r===void 0&&(r=10),i===void 0&&(i=Aze);const{isTop:u,isBottom:c,isLeft:d,isRight:f}=PK(e),h={x:0,y:0},p={x:0,y:0},m={height:t.height*i.y,width:t.width*i.x};return!u&&o<=t.top+m.height?(h.y=ui.Backward,p.y=r*Math.abs((t.top+m.height-o)/m.height)):!c&&l>=t.bottom-m.height&&(h.y=ui.Forward,p.y=r*Math.abs((t.bottom-m.height-l)/m.height)),!f&&s>=t.right-m.width?(h.x=ui.Forward,p.x=r*Math.abs((t.right-m.width-s)/m.width)):!d&&a<=t.left+m.width&&(h.x=ui.Backward,p.x=r*Math.abs((t.left+m.width-a)/m.width)),{direction:h,speed:p}}function Ize(e){if(e===document.scrollingElement){const{innerWidth:o,innerHeight:a}=window;return{top:0,left:0,right:o,bottom:a,width:o,height:a}}const{top:t,left:n,right:r,bottom:i}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:i,width:e.clientWidth,height:e.clientHeight}}function IK(e){return e.reduce((t,n)=>kh(t,j4(n)),us)}function Rze(e){return e.reduce((t,n)=>t+kK(n),0)}function Oze(e){return e.reduce((t,n)=>t+TK(n),0)}function RK(e,t){if(t===void 0&&(t=jy),!e)return;const{top:n,left:r,bottom:i,right:o}=t(e);EK(e)&&(i<=0||o<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const Mze=[["x",["left","right"],Rze],["y",["top","bottom"],Oze]];class NP{constructor(t,n){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const r=MP(n),i=IK(r);this.rect={...t},this.width=t.width,this.height=t.height;for(const[o,a,s]of Mze)for(const l of a)Object.defineProperty(this,l,{get:()=>{const u=s(r),c=i[o]-u;return this.rect[l]+c},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class om{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var r;return(r=this.target)==null?void 0:r.removeEventListener(...n)})},this.target=t}add(t,n,r){var i;(i=this.target)==null||i.addEventListener(t,n,r),this.listeners.push([t,n,r])}}function Nze(e){const{EventTarget:t}=uo(e);return e instanceof t?e:Rp(e)}function z5(e,t){const n=Math.abs(e.x),r=Math.abs(e.y);return typeof t=="number"?Math.sqrt(n**2+r**2)>t:"x"in t&&"y"in t?n>t.x&&r>t.y:"x"in t?n>t.x:"y"in t?r>t.y:!1}var ha;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(ha||(ha={}));function CN(e){e.preventDefault()}function $ze(e){e.stopPropagation()}var On;(function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter"})(On||(On={}));const OK={start:[On.Space,On.Enter],cancel:[On.Esc],end:[On.Space,On.Enter]},Dze=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case On.Right:return{...n,x:n.x+25};case On.Left:return{...n,x:n.x-25};case On.Down:return{...n,y:n.y+25};case On.Up:return{...n,y:n.y-25}}};class MK{constructor(t){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=t;const{event:{target:n}}=t;this.props=t,this.listeners=new om(Rp(n)),this.windowListeners=new om(uo(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(ha.Resize,this.handleCancel),this.windowListeners.add(ha.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(ha.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,r=t.node.current;r&&RK(r),n(us)}handleKeyDown(t){if(OP(t)){const{active:n,context:r,options:i}=this.props,{keyboardCodes:o=OK,coordinateGetter:a=Dze,scrollBehavior:s="smooth"}=i,{code:l}=t;if(o.end.includes(l)){this.handleEnd(t);return}if(o.cancel.includes(l)){this.handleCancel(t);return}const{collisionRect:u}=r.current,c=u?{x:u.left,y:u.top}:us;this.referenceCoordinates||(this.referenceCoordinates=c);const d=a(t,{active:n,context:r.current,currentCoordinates:c});if(d){const f=lS(d,c),h={x:0,y:0},{scrollableAncestors:p}=r.current;for(const m of p){const _=t.code,{isTop:b,isRight:v,isLeft:g,isBottom:y,maxScroll:S,minScroll:w}=PK(m),x=Ize(m),C={x:Math.min(_===On.Right?x.right-x.width/2:x.right,Math.max(_===On.Right?x.left:x.left+x.width/2,d.x)),y:Math.min(_===On.Down?x.bottom-x.height/2:x.bottom,Math.max(_===On.Down?x.top:x.top+x.height/2,d.y))},T=_===On.Right&&!v||_===On.Left&&!g,k=_===On.Down&&!y||_===On.Up&&!b;if(T&&C.x!==d.x){const P=m.scrollLeft+f.x,$=_===On.Right&&P<=S.x||_===On.Left&&P>=w.x;if($&&!f.y){m.scrollTo({left:P,behavior:s});return}$?h.x=m.scrollLeft-P:h.x=_===On.Right?m.scrollLeft-S.x:m.scrollLeft-w.x,h.x&&m.scrollBy({left:-h.x,behavior:s});break}else if(k&&C.y!==d.y){const P=m.scrollTop+f.y,$=_===On.Down&&P<=S.y||_===On.Up&&P>=w.y;if($&&!f.x){m.scrollTo({top:P,behavior:s});return}$?h.y=m.scrollTop-P:h.y=_===On.Down?m.scrollTop-S.y:m.scrollTop-w.y,h.y&&m.scrollBy({top:-h.y,behavior:s});break}}this.handleMove(t,kh(lS(d,this.referenceCoordinates),h))}}}handleMove(t,n){const{onMove:r}=this.props;t.preventDefault(),r(n)}handleEnd(t){const{onEnd:n}=this.props;t.preventDefault(),this.detach(),n()}handleCancel(t){const{onCancel:n}=this.props;t.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}MK.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:r=OK,onActivation:i}=t,{active:o}=n;const{code:a}=e.nativeEvent;if(r.start.includes(a)){const s=o.activatorNode.current;return s&&e.target!==s?!1:(e.preventDefault(),i==null||i({event:e.nativeEvent}),!0)}return!1}}];function EN(e){return!!(e&&"distance"in e)}function kN(e){return!!(e&&"delay"in e)}class $P{constructor(t,n,r){var i;r===void 0&&(r=Nze(t.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=t,this.events=n;const{event:o}=t,{target:a}=o;this.props=t,this.events=n,this.document=Rp(a),this.documentListeners=new om(this.document),this.listeners=new om(r),this.windowListeners=new om(uo(a)),this.initialCoordinates=(i=$0(o))!=null?i:us,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:t,props:{options:{activationConstraint:n}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),this.windowListeners.add(ha.Resize,this.handleCancel),this.windowListeners.add(ha.DragStart,CN),this.windowListeners.add(ha.VisibilityChange,this.handleCancel),this.windowListeners.add(ha.ContextMenu,CN),this.documentListeners.add(ha.Keydown,this.handleKeydown),n){if(EN(n))return;if(kN(n)){this.timeoutId=setTimeout(this.handleStart,n.delay);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handleStart(){const{initialCoordinates:t}=this,{onStart:n}=this.props;t&&(this.activated=!0,this.documentListeners.add(ha.Click,$ze,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(ha.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){var n;const{activated:r,initialCoordinates:i,props:o}=this,{onMove:a,options:{activationConstraint:s}}=o;if(!i)return;const l=(n=$0(t))!=null?n:us,u=lS(i,l);if(!r&&s){if(kN(s))return z5(u,s.tolerance)?this.handleCancel():void 0;if(EN(s))return s.tolerance!=null&&z5(u,s.tolerance)?this.handleCancel():z5(u,s.distance)?this.handleStart():void 0}t.cancelable&&t.preventDefault(),a(l)}handleEnd(){const{onEnd:t}=this.props;this.detach(),t()}handleCancel(){const{onCancel:t}=this.props;this.detach(),t()}handleKeydown(t){t.code===On.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const Lze={move:{name:"pointermove"},end:{name:"pointerup"}};class NK extends $P{constructor(t){const{event:n}=t,r=Rp(n.target);super(t,Lze,r)}}NK.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r==null||r({event:n}),!0)}}];const Fze={move:{name:"mousemove"},end:{name:"mouseup"}};var U4;(function(e){e[e.RightClick=2]="RightClick"})(U4||(U4={}));class $K extends $P{constructor(t){super(t,Fze,Rp(t.event.target))}}$K.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===U4.RightClick?!1:(r==null||r({event:n}),!0)}}];const j5={move:{name:"touchmove"},end:{name:"touchend"}};class DK extends $P{constructor(t){super(t,j5)}static setup(){return window.addEventListener(j5.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(j5.move.name,t)};function t(){}}}DK.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;const{touches:i}=n;return i.length>1?!1:(r==null||r({event:n}),!0)}}];var am;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(am||(am={}));var cS;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(cS||(cS={}));function Bze(e){let{acceleration:t,activator:n=am.Pointer,canScroll:r,draggingRect:i,enabled:o,interval:a=5,order:s=cS.TreeOrder,pointerCoordinates:l,scrollableAncestors:u,scrollableAncestorRects:c,delta:d,threshold:f}=e;const h=jze({delta:d,disabled:!o}),[p,m]=QBe(),_=I.useRef({x:0,y:0}),b=I.useRef({x:0,y:0}),v=I.useMemo(()=>{switch(n){case am.Pointer:return l?{top:l.y,bottom:l.y,left:l.x,right:l.x}:null;case am.DraggableRect:return i}},[n,i,l]),g=I.useRef(null),y=I.useCallback(()=>{const w=g.current;if(!w)return;const x=_.current.x*b.current.x,C=_.current.y*b.current.y;w.scrollBy(x,C)},[]),S=I.useMemo(()=>s===cS.TreeOrder?[...u].reverse():u,[s,u]);I.useEffect(()=>{if(!o||!u.length||!v){m();return}for(const w of S){if((r==null?void 0:r(w))===!1)continue;const x=u.indexOf(w),C=c[x];if(!C)continue;const{direction:T,speed:k}=Pze(w,C,v,t,f);for(const P of["x","y"])h[P][T[P]]||(k[P]=0,T[P]=0);if(k.x>0||k.y>0){m(),g.current=w,p(y,a),_.current=k,b.current=T;return}}_.current={x:0,y:0},b.current={x:0,y:0},m()},[t,y,r,m,o,a,JSON.stringify(v),JSON.stringify(h),p,u,S,c,JSON.stringify(f)])}const zze={x:{[ui.Backward]:!1,[ui.Forward]:!1},y:{[ui.Backward]:!1,[ui.Forward]:!1}};function jze(e){let{delta:t,disabled:n}=e;const r=sS(t);return zy(i=>{if(n||!r||!i)return zze;const o={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[ui.Backward]:i.x[ui.Backward]||o.x===-1,[ui.Forward]:i.x[ui.Forward]||o.x===1},y:{[ui.Backward]:i.y[ui.Backward]||o.y===-1,[ui.Forward]:i.y[ui.Forward]||o.y===1}}},[n,t,r])}function Uze(e,t){const n=t!==null?e.get(t):void 0,r=n?n.node.current:null;return zy(i=>{var o;return t===null?null:(o=r??i)!=null?o:null},[r,t])}function Vze(e,t){return I.useMemo(()=>e.reduce((n,r)=>{const{sensor:i}=r,o=i.activators.map(a=>({eventName:a.eventName,handler:t(a.handler,r)}));return[...n,...o]},[]),[e,t])}var L0;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(L0||(L0={}));var V4;(function(e){e.Optimized="optimized"})(V4||(V4={}));const TN=new Map;function Gze(e,t){let{dragging:n,dependencies:r,config:i}=t;const[o,a]=I.useState(null),{frequency:s,measure:l,strategy:u}=i,c=I.useRef(e),d=_(),f=N0(d),h=I.useCallback(function(b){b===void 0&&(b=[]),!f.current&&a(v=>v===null?b:v.concat(b.filter(g=>!v.includes(g))))},[f]),p=I.useRef(null),m=zy(b=>{if(d&&!n)return TN;if(!b||b===TN||c.current!==e||o!=null){const v=new Map;for(let g of e){if(!g)continue;if(o&&o.length>0&&!o.includes(g.id)&&g.rect.current){v.set(g.id,g.rect.current);continue}const y=g.node.current,S=y?new NP(l(y),y):null;g.rect.current=S,S&&v.set(g.id,S)}return v}return b},[e,o,n,d,l]);return I.useEffect(()=>{c.current=e},[e]),I.useEffect(()=>{d||h()},[n,d]),I.useEffect(()=>{o&&o.length>0&&a(null)},[JSON.stringify(o)]),I.useEffect(()=>{d||typeof s!="number"||p.current!==null||(p.current=setTimeout(()=>{h(),p.current=null},s))},[s,d,h,...r]),{droppableRects:m,measureDroppableContainers:h,measuringScheduled:o!=null};function _(){switch(u){case L0.Always:return!1;case L0.BeforeDragging:return n;default:return!n}}}function DP(e,t){return zy(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function Hze(e,t){return DP(e,t)}function qze(e){let{callback:t,disabled:n}=e;const r=mw(t),i=I.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:o}=window;return new o(r)},[r,n]);return I.useEffect(()=>()=>i==null?void 0:i.disconnect(),[i]),i}function vw(e){let{callback:t,disabled:n}=e;const r=mw(t),i=I.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:o}=window;return new o(r)},[n]);return I.useEffect(()=>()=>i==null?void 0:i.disconnect(),[i]),i}function Wze(e){return new NP(jy(e),e)}function AN(e,t,n){t===void 0&&(t=Wze);const[r,i]=I.useReducer(s,null),o=qze({callback(l){if(e)for(const u of l){const{type:c,target:d}=u;if(c==="childList"&&d instanceof HTMLElement&&d.contains(e)){i();break}}}}),a=vw({callback:i});return Zs(()=>{i(),e?(a==null||a.observe(e),o==null||o.observe(document.body,{childList:!0,subtree:!0})):(a==null||a.disconnect(),o==null||o.disconnect())},[e]),r;function s(l){if(!e)return null;if(e.isConnected===!1){var u;return(u=l??n)!=null?u:null}const c=t(e);return JSON.stringify(l)===JSON.stringify(c)?l:c}}function Kze(e){const t=DP(e);return wK(e,t)}const PN=[];function Qze(e){const t=I.useRef(e),n=zy(r=>e?r&&r!==PN&&e&&t.current&&e.parentNode===t.current.parentNode?r:MP(e):PN,[e]);return I.useEffect(()=>{t.current=e},[e]),n}function Xze(e){const[t,n]=I.useState(null),r=I.useRef(e),i=I.useCallback(o=>{const a=B5(o.target);a&&n(s=>s?(s.set(a,j4(a)),new Map(s)):null)},[]);return I.useEffect(()=>{const o=r.current;if(e!==o){a(o);const s=e.map(l=>{const u=B5(l);return u?(u.addEventListener("scroll",i,{passive:!0}),[u,j4(u)]):null}).filter(l=>l!=null);n(s.length?new Map(s):null),r.current=e}return()=>{a(e),a(o)};function a(s){s.forEach(l=>{const u=B5(l);u==null||u.removeEventListener("scroll",i)})}},[i,e]),I.useMemo(()=>e.length?t?Array.from(t.values()).reduce((o,a)=>kh(o,a),us):IK(e):us,[e,t])}function IN(e,t){t===void 0&&(t=[]);const n=I.useRef(null);return I.useEffect(()=>{n.current=null},t),I.useEffect(()=>{const r=e!==us;r&&!n.current&&(n.current=e),!r&&n.current&&(n.current=null)},[e]),n.current?lS(e,n.current):us}function Yze(e){I.useEffect(()=>{if(!gw)return;const t=e.map(n=>{let{sensor:r}=n;return r.setup==null?void 0:r.setup()});return()=>{for(const n of t)n==null||n()}},e.map(t=>{let{sensor:n}=t;return n}))}function Zze(e,t){return I.useMemo(()=>e.reduce((n,r)=>{let{eventName:i,handler:o}=r;return n[i]=a=>{o(a,t)},n},{}),[e,t])}function LK(e){return I.useMemo(()=>e?Eze(e):null,[e])}const U5=[];function Jze(e,t){t===void 0&&(t=jy);const[n]=e,r=LK(n?uo(n):null),[i,o]=I.useReducer(s,U5),a=vw({callback:o});return e.length>0&&i===U5&&o(),Zs(()=>{e.length?e.forEach(l=>a==null?void 0:a.observe(l)):(a==null||a.disconnect(),o())},[e]),i;function s(){return e.length?e.map(l=>AK(l)?r:new NP(t(l),l)):U5}}function FK(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return By(t)?t:e}function eje(e){let{measure:t}=e;const[n,r]=I.useState(null),i=I.useCallback(u=>{for(const{target:c}of u)if(By(c)){r(d=>{const f=t(c);return d?{...d,width:f.width,height:f.height}:f});break}},[t]),o=vw({callback:i}),a=I.useCallback(u=>{const c=FK(u);o==null||o.disconnect(),c&&(o==null||o.observe(c)),r(c?t(c):null)},[t,o]),[s,l]=aS(a);return I.useMemo(()=>({nodeRef:s,rect:n,setRef:l}),[n,s,l])}const tje=[{sensor:NK,options:{}},{sensor:MK,options:{}}],nje={current:{}},cb={draggable:{measure:wN},droppable:{measure:wN,strategy:L0.WhileDragging,frequency:V4.Optimized},dragOverlay:{measure:jy}};class sm extends Map{get(t){var n;return t!=null&&(n=super.get(t))!=null?n:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:n}=t;return!n})}getNodeFor(t){var n,r;return(n=(r=this.get(t))==null?void 0:r.node.current)!=null?n:void 0}}const rje={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new sm,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:uS},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:cb,measureDroppableContainers:uS,windowRect:null,measuringScheduled:!1},BK={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:uS,draggableNodes:new Map,over:null,measureDroppableContainers:uS},Uy=I.createContext(BK),zK=I.createContext(rje);function ije(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new sm}}}function oje(e,t){switch(t.type){case Hr.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case Hr.DragMove:return e.draggable.active?{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}}:e;case Hr.DragEnd:case Hr.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case Hr.RegisterDroppable:{const{element:n}=t,{id:r}=n,i=new sm(e.droppable.containers);return i.set(r,n),{...e,droppable:{...e.droppable,containers:i}}}case Hr.SetDroppableDisabled:{const{id:n,key:r,disabled:i}=t,o=e.droppable.containers.get(n);if(!o||r!==o.key)return e;const a=new sm(e.droppable.containers);return a.set(n,{...o,disabled:i}),{...e,droppable:{...e.droppable,containers:a}}}case Hr.UnregisterDroppable:{const{id:n,key:r}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;const o=new sm(e.droppable.containers);return o.delete(n),{...e,droppable:{...e.droppable,containers:o}}}default:return e}}function aje(e){let{disabled:t}=e;const{active:n,activatorEvent:r,draggableNodes:i}=I.useContext(Uy),o=sS(r),a=sS(n==null?void 0:n.id);return I.useEffect(()=>{if(!t&&!r&&o&&a!=null){if(!OP(o)||document.activeElement===o.target)return;const s=i.get(a);if(!s)return;const{activatorNode:l,node:u}=s;if(!l.current&&!u.current)return;requestAnimationFrame(()=>{for(const c of[l.current,u.current]){if(!c)continue;const d=ZBe(c);if(d){d.focus();break}}})}},[r,t,i,a,o]),null}function jK(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((i,o)=>o({transform:i,...r}),n):n}function sje(e){return I.useMemo(()=>({draggable:{...cb.draggable,...e==null?void 0:e.draggable},droppable:{...cb.droppable,...e==null?void 0:e.droppable},dragOverlay:{...cb.dragOverlay,...e==null?void 0:e.dragOverlay}}),[e==null?void 0:e.draggable,e==null?void 0:e.droppable,e==null?void 0:e.dragOverlay])}function lje(e){let{activeNode:t,measure:n,initialRect:r,config:i=!0}=e;const o=I.useRef(!1),{x:a,y:s}=typeof i=="boolean"?{x:i,y:i}:i;Zs(()=>{if(!a&&!s||!t){o.current=!1;return}if(o.current||!r)return;const u=t==null?void 0:t.node.current;if(!u||u.isConnected===!1)return;const c=n(u),d=wK(c,r);if(a||(d.x=0),s||(d.y=0),o.current=!0,Math.abs(d.x)>0||Math.abs(d.y)>0){const f=EK(u);f&&f.scrollBy({top:d.y,left:d.x})}},[t,a,s,r,n])}const bw=I.createContext({...us,scaleX:1,scaleY:1});var _u;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(_u||(_u={}));const uje=I.memo(function(t){var n,r,i,o;let{id:a,accessibility:s,autoScroll:l=!0,children:u,sensors:c=tje,collisionDetection:d=yze,measuring:f,modifiers:h,...p}=t;const m=I.useReducer(oje,void 0,ije),[_,b]=m,[v,g]=oze(),[y,S]=I.useState(_u.Uninitialized),w=y===_u.Initialized,{draggable:{active:x,nodes:C,translate:T},droppable:{containers:k}}=_,P=x?C.get(x):null,$=I.useRef({initial:null,translated:null}),O=I.useMemo(()=>{var Bn;return x!=null?{id:x,data:(Bn=P==null?void 0:P.data)!=null?Bn:nje,rect:$}:null},[x,P]),E=I.useRef(null),[A,D]=I.useState(null),[L,M]=I.useState(null),R=N0(p,Object.values(p)),N=yw("DndDescribedBy",a),B=I.useMemo(()=>k.getEnabled(),[k]),U=sje(f),{droppableRects:G,measureDroppableContainers:Y,measuringScheduled:ee}=Gze(B,{dragging:w,dependencies:[T.x,T.y],config:U.droppable}),J=Uze(C,x),j=I.useMemo(()=>L?$0(L):null,[L]),Q=al(),ne=Hze(J,U.draggable.measure);lje({activeNode:x?C.get(x):null,config:Q.layoutShiftCompensation,initialRect:ne,measure:U.draggable.measure});const se=AN(J,U.draggable.measure,ne),ve=AN(J?J.parentElement:null),ce=I.useRef({activatorEvent:null,active:null,activeNode:J,collisionRect:null,collisions:null,droppableRects:G,draggableNodes:C,draggingNode:null,draggingNodeRect:null,droppableContainers:k,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),bt=k.getNodeFor((n=ce.current.over)==null?void 0:n.id),ot=eje({measure:U.dragOverlay.measure}),ze=(r=ot.nodeRef.current)!=null?r:J,gt=w?(i=ot.rect)!=null?i:se:null,Pe=!!(ot.nodeRef.current&&ot.rect),Jt=Kze(Pe?null:se),Ar=LK(ze?uo(ze):null),Dn=Qze(w?bt??J:null),Tn=Jze(Dn),en=jK(h,{transform:{x:T.x-Jt.x,y:T.y-Jt.y,scaleX:1,scaleY:1},activatorEvent:L,active:O,activeNodeRect:se,containerNodeRect:ve,draggingNodeRect:gt,over:ce.current.over,overlayNodeRect:ot.rect,scrollableAncestors:Dn,scrollableAncestorRects:Tn,windowRect:Ar}),Ln=j?kh(j,T):null,Pr=Xze(Dn),co=IN(Pr),Jr=IN(Pr,[se]),hr=kh(en,co),Fr=gt?xze(gt,en):null,ei=O&&Fr?d({active:O,collisionRect:Fr,droppableRects:G,droppableContainers:B,pointerCoordinates:Ln}):null,Fn=gze(ei,"id"),[bn,Mi]=I.useState(null),pi=Pe?en:kh(en,Jr),Qi=_ze(pi,(o=bn==null?void 0:bn.rect)!=null?o:null,se),$a=I.useCallback((Bn,tn)=>{let{sensor:Br,options:Rr}=tn;if(E.current==null)return;const Or=C.get(E.current);if(!Or)return;const ti=Bn.nativeEvent,Ni=new Br({active:E.current,activeNode:Or,event:ti,options:Rr,context:ce,onStart(gi){const zr=E.current;if(zr==null)return;const Da=C.get(zr);if(!Da)return;const{onDragStart:hs}=R.current,mi={active:{id:zr,data:Da.data,rect:$}};Uo.unstable_batchedUpdates(()=>{hs==null||hs(mi),S(_u.Initializing),b({type:Hr.DragStart,initialCoordinates:gi,active:zr}),v({type:"onDragStart",event:mi})})},onMove(gi){b({type:Hr.DragMove,coordinates:gi})},onEnd:ho(Hr.DragEnd),onCancel:ho(Hr.DragCancel)});Uo.unstable_batchedUpdates(()=>{D(Ni),M(Bn.nativeEvent)});function ho(gi){return async function(){const{active:Da,collisions:hs,over:mi,scrollAdjustedTranslate:nu}=ce.current;let ia=null;if(Da&&nu){const{cancelDrop:ni}=R.current;ia={activatorEvent:ti,active:Da,collisions:hs,delta:nu,over:mi},gi===Hr.DragEnd&&typeof ni=="function"&&await Promise.resolve(ni(ia))&&(gi=Hr.DragCancel)}E.current=null,Uo.unstable_batchedUpdates(()=>{b({type:gi}),S(_u.Uninitialized),Mi(null),D(null),M(null);const ni=gi===Hr.DragEnd?"onDragEnd":"onDragCancel";if(ia){const sl=R.current[ni];sl==null||sl(ia),v({type:ni,event:ia})}})}}},[C]),Ir=I.useCallback((Bn,tn)=>(Br,Rr)=>{const Or=Br.nativeEvent,ti=C.get(Rr);if(E.current!==null||!ti||Or.dndKit||Or.defaultPrevented)return;const Ni={active:ti};Bn(Br,tn.options,Ni)===!0&&(Or.dndKit={capturedBy:tn.sensor},E.current=Rr,$a(Br,tn))},[C,$a]),fo=Vze(c,Ir);Yze(c),Zs(()=>{se&&y===_u.Initializing&&S(_u.Initialized)},[se,y]),I.useEffect(()=>{const{onDragMove:Bn}=R.current,{active:tn,activatorEvent:Br,collisions:Rr,over:Or}=ce.current;if(!tn||!Br)return;const ti={active:tn,activatorEvent:Br,collisions:Rr,delta:{x:hr.x,y:hr.y},over:Or};Uo.unstable_batchedUpdates(()=>{Bn==null||Bn(ti),v({type:"onDragMove",event:ti})})},[hr.x,hr.y]),I.useEffect(()=>{const{active:Bn,activatorEvent:tn,collisions:Br,droppableContainers:Rr,scrollAdjustedTranslate:Or}=ce.current;if(!Bn||E.current==null||!tn||!Or)return;const{onDragOver:ti}=R.current,Ni=Rr.get(Fn),ho=Ni&&Ni.rect.current?{id:Ni.id,rect:Ni.rect.current,data:Ni.data,disabled:Ni.disabled}:null,gi={active:Bn,activatorEvent:tn,collisions:Br,delta:{x:Or.x,y:Or.y},over:ho};Uo.unstable_batchedUpdates(()=>{Mi(ho),ti==null||ti(gi),v({type:"onDragOver",event:gi})})},[Fn]),Zs(()=>{ce.current={activatorEvent:L,active:O,activeNode:J,collisionRect:Fr,collisions:ei,droppableRects:G,draggableNodes:C,draggingNode:ze,draggingNodeRect:gt,droppableContainers:k,over:bn,scrollableAncestors:Dn,scrollAdjustedTranslate:hr},$.current={initial:gt,translated:Fr}},[O,J,ei,Fr,C,ze,gt,G,k,bn,Dn,hr]),Bze({...Q,delta:T,draggingRect:Fr,pointerCoordinates:Ln,scrollableAncestors:Dn,scrollableAncestorRects:Tn});const ol=I.useMemo(()=>({active:O,activeNode:J,activeNodeRect:se,activatorEvent:L,collisions:ei,containerNodeRect:ve,dragOverlay:ot,draggableNodes:C,droppableContainers:k,droppableRects:G,over:bn,measureDroppableContainers:Y,scrollableAncestors:Dn,scrollableAncestorRects:Tn,measuringConfiguration:U,measuringScheduled:ee,windowRect:Ar}),[O,J,se,L,ei,ve,ot,C,k,G,bn,Y,Dn,Tn,U,ee,Ar]),$o=I.useMemo(()=>({activatorEvent:L,activators:fo,active:O,activeNodeRect:se,ariaDescribedById:{draggable:N},dispatch:b,draggableNodes:C,over:bn,measureDroppableContainers:Y}),[L,fo,O,se,b,N,C,bn,Y]);return En.createElement(xK.Provider,{value:g},En.createElement(Uy.Provider,{value:$o},En.createElement(zK.Provider,{value:ol},En.createElement(bw.Provider,{value:Qi},u)),En.createElement(aje,{disabled:(s==null?void 0:s.restoreFocus)===!1})),En.createElement(lze,{...s,hiddenTextDescribedById:N}));function al(){const Bn=(A==null?void 0:A.autoScrollEnabled)===!1,tn=typeof l=="object"?l.enabled===!1:l===!1,Br=w&&!Bn&&!tn;return typeof l=="object"?{...l,enabled:Br}:{enabled:Br}}}),cje=I.createContext(null),RN="button",dje="Droppable";function DKe(e){let{id:t,data:n,disabled:r=!1,attributes:i}=e;const o=yw(dje),{activators:a,activatorEvent:s,active:l,activeNodeRect:u,ariaDescribedById:c,draggableNodes:d,over:f}=I.useContext(Uy),{role:h=RN,roleDescription:p="draggable",tabIndex:m=0}=i??{},_=(l==null?void 0:l.id)===t,b=I.useContext(_?bw:cje),[v,g]=aS(),[y,S]=aS(),w=Zze(a,t),x=N0(n);Zs(()=>(d.set(t,{id:t,key:o,node:v,activatorNode:y,data:x}),()=>{const T=d.get(t);T&&T.key===o&&d.delete(t)}),[d,t]);const C=I.useMemo(()=>({role:h,tabIndex:m,"aria-disabled":r,"aria-pressed":_&&h===RN?!0:void 0,"aria-roledescription":p,"aria-describedby":c.draggable}),[r,h,m,_,p,c.draggable]);return{active:l,activatorEvent:s,activeNodeRect:u,attributes:C,isDragging:_,listeners:r?void 0:w,node:v,over:f,setNodeRef:g,setActivatorNodeRef:S,transform:b}}function fje(){return I.useContext(zK)}const hje="Droppable",pje={timeout:25};function LKe(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:i}=e;const o=yw(hje),{active:a,dispatch:s,over:l,measureDroppableContainers:u}=I.useContext(Uy),c=I.useRef({disabled:n}),d=I.useRef(!1),f=I.useRef(null),h=I.useRef(null),{disabled:p,updateMeasurementsFor:m,timeout:_}={...pje,...i},b=N0(m??r),v=I.useCallback(()=>{if(!d.current){d.current=!0;return}h.current!=null&&clearTimeout(h.current),h.current=setTimeout(()=>{u(Array.isArray(b.current)?b.current:[b.current]),h.current=null},_)},[_]),g=vw({callback:v,disabled:p||!a}),y=I.useCallback((C,T)=>{g&&(T&&(g.unobserve(T),d.current=!1),C&&g.observe(C))},[g]),[S,w]=aS(y),x=N0(t);return I.useEffect(()=>{!g||!S.current||(g.disconnect(),d.current=!1,g.observe(S.current))},[S,g]),Zs(()=>(s({type:Hr.RegisterDroppable,element:{id:r,key:o,disabled:n,node:S,rect:f,data:x}}),()=>s({type:Hr.UnregisterDroppable,key:o,id:r})),[r]),I.useEffect(()=>{n!==c.current.disabled&&(s({type:Hr.SetDroppableDisabled,id:r,key:o,disabled:n}),c.current.disabled=n)},[r,o,n,s]),{active:a,rect:f,isOver:(l==null?void 0:l.id)===r,node:S,over:l,setNodeRef:w}}function gje(e){let{animation:t,children:n}=e;const[r,i]=I.useState(null),[o,a]=I.useState(null),s=sS(n);return!n&&!r&&s&&i(s),Zs(()=>{if(!o)return;const l=r==null?void 0:r.key,u=r==null?void 0:r.props.id;if(l==null||u==null){i(null);return}Promise.resolve(t(u,o)).then(()=>{i(null)})},[t,r,o]),En.createElement(En.Fragment,null,n,r?I.cloneElement(r,{ref:a}):null)}const mje={x:0,y:0,scaleX:1,scaleY:1};function yje(e){let{children:t}=e;return En.createElement(Uy.Provider,{value:BK},En.createElement(bw.Provider,{value:mje},t))}const vje={position:"fixed",touchAction:"none"},bje=e=>OP(e)?"transform 250ms ease":void 0,_je=I.forwardRef((e,t)=>{let{as:n,activatorEvent:r,adjustScale:i,children:o,className:a,rect:s,style:l,transform:u,transition:c=bje}=e;if(!s)return null;const d=i?u:{...u,scaleX:1,scaleY:1},f={...vje,width:s.width,height:s.height,top:s.top,left:s.left,transform:D0.Transform.toString(d),transformOrigin:i&&r?dze(r,s):void 0,transition:typeof c=="function"?c(r):c,...l};return En.createElement(n,{className:a,style:f,ref:t},o)}),Sje=e=>t=>{let{active:n,dragOverlay:r}=t;const i={},{styles:o,className:a}=e;if(o!=null&&o.active)for(const[s,l]of Object.entries(o.active))l!==void 0&&(i[s]=n.node.style.getPropertyValue(s),n.node.style.setProperty(s,l));if(o!=null&&o.dragOverlay)for(const[s,l]of Object.entries(o.dragOverlay))l!==void 0&&r.node.style.setProperty(s,l);return a!=null&&a.active&&n.node.classList.add(a.active),a!=null&&a.dragOverlay&&r.node.classList.add(a.dragOverlay),function(){for(const[l,u]of Object.entries(i))n.node.style.setProperty(l,u);a!=null&&a.active&&n.node.classList.remove(a.active)}},xje=e=>{let{transform:{initial:t,final:n}}=e;return[{transform:D0.Transform.toString(t)},{transform:D0.Transform.toString(n)}]},wje={duration:250,easing:"ease",keyframes:xje,sideEffects:Sje({styles:{active:{opacity:"0"}}})};function Cje(e){let{config:t,draggableNodes:n,droppableContainers:r,measuringConfiguration:i}=e;return mw((o,a)=>{if(t===null)return;const s=n.get(o);if(!s)return;const l=s.node.current;if(!l)return;const u=FK(a);if(!u)return;const{transform:c}=uo(a).getComputedStyle(a),d=CK(c);if(!d)return;const f=typeof t=="function"?t:Eje(t);return RK(l,i.draggable.measure),f({active:{id:o,data:s.data,node:l,rect:i.draggable.measure(l)},draggableNodes:n,dragOverlay:{node:a,rect:i.dragOverlay.measure(u)},droppableContainers:r,measuringConfiguration:i,transform:d})})}function Eje(e){const{duration:t,easing:n,sideEffects:r,keyframes:i}={...wje,...e};return o=>{let{active:a,dragOverlay:s,transform:l,...u}=o;if(!t)return;const c={x:s.rect.left-a.rect.left,y:s.rect.top-a.rect.top},d={scaleX:l.scaleX!==1?a.rect.width*l.scaleX/s.rect.width:1,scaleY:l.scaleY!==1?a.rect.height*l.scaleY/s.rect.height:1},f={x:l.x-c.x,y:l.y-c.y,...d},h=i({...u,active:a,dragOverlay:s,transform:{initial:l,final:f}}),[p]=h,m=h[h.length-1];if(JSON.stringify(p)===JSON.stringify(m))return;const _=r==null?void 0:r({active:a,dragOverlay:s,...u}),b=s.node.animate(h,{duration:t,easing:n,fill:"forwards"});return new Promise(v=>{b.onfinish=()=>{_==null||_(),v()}})}}let ON=0;function kje(e){return I.useMemo(()=>{if(e!=null)return ON++,ON},[e])}const Tje=En.memo(e=>{let{adjustScale:t=!1,children:n,dropAnimation:r,style:i,transition:o,modifiers:a,wrapperElement:s="div",className:l,zIndex:u=999}=e;const{activatorEvent:c,active:d,activeNodeRect:f,containerNodeRect:h,draggableNodes:p,droppableContainers:m,dragOverlay:_,over:b,measuringConfiguration:v,scrollableAncestors:g,scrollableAncestorRects:y,windowRect:S}=fje(),w=I.useContext(bw),x=kje(d==null?void 0:d.id),C=jK(a,{activatorEvent:c,active:d,activeNodeRect:f,containerNodeRect:h,draggingNodeRect:_.rect,over:b,overlayNodeRect:_.rect,scrollableAncestors:g,scrollableAncestorRects:y,transform:w,windowRect:S}),T=DP(f),k=Cje({config:r,draggableNodes:p,droppableContainers:m,measuringConfiguration:v}),P=T?_.setRef:void 0;return En.createElement(yje,null,En.createElement(gje,{animation:k},d&&x?En.createElement(_je,{key:x,id:d.id,ref:P,as:s,activatorEvent:c,adjustScale:t,className:l,transition:o,rect:T,style:{zIndex:u,...i},transform:C},n):null))}),Aje=Ii([eK,NA],({nodes:e},t)=>t==="nodes"?e.viewport.zoom:1),Pje=()=>{const e=lH(Aje);return I.useCallback(({activatorEvent:n,draggingNodeRect:r,transform:i})=>{if(r&&n){const o=$0(n);if(!o)return i;const a=o.x-r.left,s=o.y-r.top,l=i.x+a-r.width/2,u=i.y+s-r.height/2,c=i.scaleX*e,d=i.scaleY*e;return{x:l,y:u,scaleX:c,scaleY:d}}return i},[e])},Ije=e=>{if(!e.pointerCoordinates)return[];const t=document.elementsFromPoint(e.pointerCoordinates.x,e.pointerCoordinates.y),n=e.droppableContainers.filter(r=>r.node.current?t.includes(r.node.current):!1);return bze({...e,droppableContainers:n})};function Rje(e){return W.jsx(uje,{...e})}const y1=28,MN={w:y1,h:y1,maxW:y1,maxH:y1,shadow:"dark-lg",borderRadius:"lg",opacity:.3,bg:"base.800",color:"base.50",_dark:{borderColor:"base.200",bg:"base.900",color:"base.100"}},Oje=e=>{if(!e.dragData)return null;if(e.dragData.payloadType==="NODE_FIELD"){const{field:t,fieldTemplate:n}=e.dragData.payload;return W.jsx(rS,{sx:{position:"relative",p:2,px:3,opacity:.7,bg:"base.300",borderRadius:"base",boxShadow:"dark-lg",whiteSpace:"nowrap",fontSize:"sm"},children:W.jsx(HW,{children:t.label||n.title})})}if(e.dragData.payloadType==="IMAGE_DTO"){const{thumbnail_url:t,width:n,height:r}=e.dragData.payload.imageDTO;return W.jsx(rS,{sx:{position:"relative",width:"full",height:"full",display:"flex",alignItems:"center",justifyContent:"center"},children:W.jsx(xP,{sx:{...MN},objectFit:"contain",src:t,width:n,height:r})})}return e.dragData.payloadType==="IMAGE_DTOS"?W.jsxs(wP,{sx:{position:"relative",alignItems:"center",justifyContent:"center",flexDir:"column",...MN},children:[W.jsx(I4,{children:e.dragData.payload.imageDTOs.length}),W.jsx(I4,{size:"sm",children:"Images"})]}):null},Mje=I.memo(Oje),Nje=e=>{const[t,n]=I.useState(null),r=Ce("images"),i=gke(),o=I.useCallback(d=>{r.trace({dragData:Qt(d.active.data.current)},"Drag started");const f=d.active.data.current;f&&n(f)},[r]),a=I.useCallback(d=>{var h;r.trace({dragData:Qt(d.active.data.current)},"Drag ended");const f=(h=d.over)==null?void 0:h.data.current;!t||!f||(i(aH({overData:f,activeData:t})),n(null))},[t,i,r]),s=xN($K,{activationConstraint:{distance:10}}),l=xN(DK,{activationConstraint:{distance:10}}),u=uze(s,l),c=Pje();return W.jsxs(Rje,{onDragStart:o,onDragEnd:a,sensors:u,collisionDetection:Ije,autoScroll:!1,children:[e.children,W.jsx(Tje,{dropAnimation:null,modifiers:[c],style:{width:"min-content",height:"min-content",cursor:"grabbing",userSelect:"none",padding:"10rem"},children:W.jsx(DW,{children:t&&W.jsx(NW.div,{layout:!0,initial:{opacity:0,scale:.7},animate:{opacity:1,scale:1,transition:{duration:.1}},children:W.jsx(Mje,{dragData:t})},"overlay-drag-image")})})]})},$je=I.memo(Nje),NN=tl(void 0),$N=tl(void 0),Dje=I.lazy(()=>ZD(()=>import("./App-ba2d118a.js"),["./App-ba2d118a.js","./MantineProvider-a057bfc9.js","./App-6125620a.css"],import.meta.url)),Lje=I.lazy(()=>ZD(()=>import("./ThemeLocaleProvider-632b3401.js"),["./ThemeLocaleProvider-632b3401.js","./MantineProvider-a057bfc9.js","./ThemeLocaleProvider-90f0fcd3.css"],import.meta.url)),Fje=({apiUrl:e,token:t,config:n,headerComponent:r,middleware:i,projectId:o,queueId:a,selectedImage:s,customStarUi:l})=>(I.useEffect(()=>(t&&Zh.set(t),e&&o0.set(e),o&&a0.set(o),a&&Ur.set(a),iG(),i&&i.length>0?UE(gN(),...i):UE(gN()),()=>{o0.set(void 0),Zh.set(void 0),a0.set(void 0),Ur.set(uG)}),[e,t,i,o,a]),I.useEffect(()=>(l&&NN.set(l),()=>{NN.set(void 0)}),[l]),I.useEffect(()=>(r&&$N.set(r),()=>{$N.set(void 0)}),[r]),W.jsx(En.StrictMode,{children:W.jsx(yme,{store:JW,children:W.jsx(En.Suspense,{fallback:W.jsx(MBe,{}),children:W.jsx(Lje,{children:W.jsx($je,{children:W.jsx(Dje,{config:n,selectedImage:s})})})})})})),Bje=I.memo(Fje);V5.createRoot(document.getElementById("root")).render(W.jsx(Bje,{}));export{Oy as $,hi as A,Wa as B,ibe as C,Ro as D,Ku as E,xs as F,mHe as G,sA as H,jke as I,ra as J,Fy as K,UTe as L,NKe as M,PDe as N,Py as O,sbe as P,Oi as Q,Ac as R,Nm as S,YOe as T,kKe as U,wKe as V,DW as W,NW as X,POe as Y,Iy as Z,bP as _,VL as a,WT as a$,CKe as a0,EKe as a1,U_ as a2,QM as a3,OTe as a4,TKe as a5,$s as a6,pc as a7,__ as a8,RY as a9,$d as aA,rS as aB,wP as aC,I4 as aD,NA as aE,Z2 as aF,Rke as aG,PGe as aH,vTe as aI,jA as aJ,SH as aK,_Te as aL,Uo as aM,zP as aN,tw as aO,sWe as aP,mGe as aQ,RGe as aR,OGe as aS,aGe as aT,iGe as aU,HW as aV,Vg as aW,xxe as aX,dG as aY,Wqe as aZ,iHe as a_,En as aa,dq as ab,IKe as ac,NOe as ad,Hs as ae,AH as af,ew as ag,e$e as ah,VW as ai,AKe as aj,nt as ak,xKe as al,PKe as am,Ii as an,eK as ao,cT as ap,lH as aq,pGe as ar,vy as as,Pz as at,tj as au,_2 as av,Ce as aw,gke as ax,Qqe as ay,Gt as az,BS as b,Yje as b$,LA as b0,DWe as b1,xP as b2,RBe as b3,be as b4,xGe as b5,IGe as b6,s0e as b7,gT as b8,Zje as b9,MV as bA,uHe as bB,yGe as bC,vGe as bD,EGe as bE,w_ as bF,_Ge as bG,Ru as bH,sv as bI,lHe as bJ,aHe as bK,sHe as bL,jje as bM,Hje as bN,qje as bO,Wje as bP,Kje as bQ,Yse as bR,bUe as bS,Lqe as bT,Fqe as bU,Jje as bV,kUe as bW,Xje as bX,pUe as bY,nUe as bZ,jEe as b_,mWe as ba,Yqe as bb,LWe as bc,SWe as bd,H2e as be,Xqe as bf,Jqe as bg,a2e as bh,s2e as bi,hWe as bj,gWe as bk,Zqe as bl,vWe as bm,eWe as bn,hGe as bo,Kqe as bp,IWe as bq,$Ke as br,SGe as bs,gle as bt,FGe as bu,LGe as bv,bGe as bw,cHe as bx,LKe as by,DKe as bz,IJ as c,EWe as c$,_Ue as c0,Qje as c1,RUe as c2,eUe as c3,Z8 as c4,tUe as c5,J8 as c6,sUe as c7,mUe as c8,nKe as c9,cUe as cA,qqe as cB,pHe as cC,VGe as cD,$xe as cE,Ne as cF,NN as cG,jGe as cH,BGe as cI,zGe as cJ,d0e as cK,uxe as cL,rG as cM,EB as cN,oGe as cO,oH as cP,wGe as cQ,s0 as cR,cU as cS,SKe as cT,CGe as cU,fv as cV,SE as cW,NWe as cX,TWe as cY,tWe as cZ,nWe as c_,LO as ca,iUe as cb,gHe as cc,eKe as cd,FO as ce,oUe as cf,kv as cg,Ef as ch,BR as ci,HGe as cj,tKe as ck,BO as cl,aUe as cm,eU as cn,JGe as co,iU as cp,zEe as cq,rUe as cr,G9 as cs,jqe as ct,Uqe as cu,Vqe as cv,lUe as cw,Gqe as cx,uUe as cy,Hqe as cz,moe as d,dHe as d$,jr as d0,lA as d1,Ca as d2,CWe as d3,dUe as d4,MA as d5,kWe as d6,_We as d7,uT as d8,Rqe as d9,hKe as dA,JWe as dB,vKe as dC,ZWe as dD,WHe as dE,KHe as dF,bKe as dG,QHe as dH,yKe as dI,XHe as dJ,YHe as dK,jse as dL,iKe as dM,ZHe as dN,Gse as dO,GHe as dP,BHe as dQ,Iqe as dR,Loe as dS,qS as dT,yUe as dU,p0e as dV,g0e as dW,oHe as dX,fHe as dY,hHe as dZ,fU as d_,Tqe as da,Aqe as db,Nqe as dc,Pqe as dd,Mqe as de,Oqe as df,SEe as dg,tqe as dh,xHe as di,lGe as dj,sGe as dk,EHe as dl,Sae as dm,HHe as dn,bHe as dp,zHe as dq,jHe as dr,Vse as ds,UHe as dt,Uje as du,VHe as dv,X2 as dw,Use as dx,qHe as dy,ly as dz,HF as e,FUe as e$,WS as e0,UUe as e1,BUe as e2,zUe as e3,jUe as e4,Oae as e5,zR as e6,KGe as e7,$Ge as e8,MGe as e9,r2e as eA,fke as eB,SB as eC,QWe as eD,GUe as eE,Zse as eF,VUe as eG,qa as eH,gUe as eI,AUe as eJ,Mae as eK,Gg as eL,IUe as eM,zqe as eN,wUe as eO,CUe as eP,EUe as eQ,SUe as eR,xUe as eS,Xse as eT,NUe as eU,MUe as eV,YUe as eW,yVe as eX,eGe as eY,vVe as eZ,LUe as e_,NGe as ea,Sc as eb,eI as ec,o0e as ed,jR as ee,Oxe as ef,Rxe as eg,QGe as eh,XGe as ei,YGe as ej,a0e as ek,ZGe as el,nU as em,qGe as en,rU as eo,nHe as ep,rHe as eq,V2 as er,tHe as es,eHe as et,UGe as eu,J3e as ev,GGe as ew,rKe as ex,Bqe as ey,fT as ez,YL as f,DHe as f$,DUe as f0,pT as f1,wWe as f2,AWe as f3,Dqe as f4,_Ke as f5,$ke as f6,cWe as f7,me as f8,xi as f9,iSe as fA,j9 as fB,YU as fC,xy as fD,yHe as fE,Hc as fF,iqe as fG,bWe as fH,bj as fI,xg as fJ,CHe as fK,SHe as fL,rqe as fM,oqe as fN,fqe as fO,vHe as fP,aqe as fQ,sqe as fR,uGe as fS,M_ as fT,tt as fU,lqe as fV,JSe as fW,Lv as fX,wHe as fY,hqe as fZ,cqe as f_,Vn as fa,Us as fb,YWe as fc,gKe as fd,lKe as fe,aWe as ff,sKe as fg,mKe as fh,pKe as fi,oWe as fj,cKe as fk,uKe as fl,oKe as fm,fKe as fn,Gje as fo,aKe as fp,dKe as fq,Vje as fr,vV as fs,_He as ft,Z3 as fu,eSe as fv,_oe as fw,nqe as fx,AHe as fy,PHe as fz,oF as g,HUe as g$,MHe as g0,OHe as g1,RHe as g2,LHe as g3,dqe as g4,mqe as g5,gqe as g6,kqe as g7,Lke as g8,NHe as g9,xWe as gA,RWe as gB,MWe as gC,qc as gD,pG as gE,dQ as gF,Rt as gG,PVe as gH,KVe as gI,WVe as gJ,hVe as gK,FVe as gL,XVe as gM,Mxe as gN,aVe as gO,CVe as gP,ng as gQ,SVe as gR,sVe as gS,J2 as gT,wVe as gU,rVe as gV,xVe as gW,iVe as gX,uVe as gY,WUe as gZ,qUe as g_,$He as ga,$qe as gb,yqe as gc,pqe as gd,bqe as ge,W_e as gf,XWe as gg,VB as gh,$O as gi,Qt as gj,ZSe as gk,g0 as gl,sc as gm,Eqe as gn,_qe as go,Cqe as gp,Sqe as gq,vqe as gr,uqe as gs,wqe as gt,RV as gu,jWe as gv,FWe as gw,BWe as gx,zWe as gy,$We as gz,gp as h,yOe as h$,QVe as h0,gae as h1,JF as h2,xB as h3,Zh as h4,nle as h5,ZUe as h6,JUe as h7,eVe as h8,qVe as h9,MVe as hA,NVe as hB,tGe as hC,jVe as hD,nGe as hE,_Ve as hF,bVe as hG,nVe as hH,tVe as hI,JVe as hJ,XUe as hK,pVe as hL,Pxe as hM,Exe as hN,Txe as hO,Axe as hP,KWe as hQ,lWe as hR,uWe as hS,kGe as hT,Z as hU,Iae as hV,_xe as hW,$N as hX,kH as hY,VA as hZ,Ds as h_,dVe as ha,cVe as hb,ole as hc,HVe as hd,Ixe as he,ale as hf,RA as hg,Z3e as hh,gVe as hi,IVe as hj,AVe as hk,EVe as hl,KUe as hm,QUe as hn,rGe as ho,VWe as hp,UWe as hq,LVe as hr,OVe as hs,RVe as ht,kxe as hu,fVe as hv,oVe as hw,GVe as hx,VVe as hy,$Ve as hz,uoe as i,qOe as i0,RKe as i1,DTe as i2,MKe as i3,IDe as i4,NFe as i5,$Fe as i6,ITe as i7,ay as j,Xr as k,oy as l,ny as m,Io as n,US as o,Yk as p,QL as q,rT as r,FF as s,iy as t,Pae as u,I as v,W as w,Ta as x,br as y,mh as z}; diff --git a/invokeai/frontend/web/dist/index.html b/invokeai/frontend/web/dist/index.html index 87cb562c9d..c98e4f61b4 100644 --- a/invokeai/frontend/web/dist/index.html +++ b/invokeai/frontend/web/dist/index.html @@ -3,6 +3,9 @@ + + + InvokeAI - A Stable Diffusion Toolkit - + diff --git a/invokeai/frontend/web/dist/locales/en.json b/invokeai/frontend/web/dist/locales/en.json index 34e4dd79d6..b635db997a 100644 --- a/invokeai/frontend/web/dist/locales/en.json +++ b/invokeai/frontend/web/dist/locales/en.json @@ -697,7 +697,7 @@ "noLoRAsAvailable": "No LoRAs available", "noMatchingLoRAs": "No matching LoRAs", "noMatchingModels": "No matching Models", - "noModelsAvailable": "No Modelss available", + "noModelsAvailable": "No models available", "selectLoRA": "Select a LoRA", "selectModel": "Select a Model" }, diff --git a/invokeai/frontend/web/src/features/nodes/components/flow/nodes/Invocation/fields/InputFieldRenderer.tsx b/invokeai/frontend/web/src/features/nodes/components/flow/nodes/Invocation/fields/InputFieldRenderer.tsx index 5dc1305900..13695c44c3 100644 --- a/invokeai/frontend/web/src/features/nodes/components/flow/nodes/Invocation/fields/InputFieldRenderer.tsx +++ b/invokeai/frontend/web/src/features/nodes/components/flow/nodes/Invocation/fields/InputFieldRenderer.tsx @@ -16,6 +16,7 @@ import SchedulerInputField from './inputs/SchedulerInputField'; import StringInputField from './inputs/StringInputField'; import VaeModelInputField from './inputs/VaeModelInputField'; import IPAdapterModelInputField from './inputs/IPAdapterModelInputField'; +import T2IAdapterModelInputField from './inputs/T2IAdapterModelInputField'; import BoardInputField from './inputs/BoardInputField'; type InputFieldProps = { @@ -188,6 +189,18 @@ const InputFieldRenderer = ({ nodeId, fieldName }: InputFieldProps) => { ); } + if ( + field?.type === 'T2IAdapterModelField' && + fieldTemplate?.type === 'T2IAdapterModelField' + ) { + return ( + + ); + } if (field?.type === 'ColorField' && fieldTemplate?.type === 'ColorField') { return ( +) => { + return null; +}; + +export default memo(T2IAdapterInputFieldComponent); diff --git a/invokeai/frontend/web/src/features/nodes/components/flow/nodes/Invocation/fields/inputs/T2IAdapterModelInputField.tsx b/invokeai/frontend/web/src/features/nodes/components/flow/nodes/Invocation/fields/inputs/T2IAdapterModelInputField.tsx new file mode 100644 index 0000000000..f5ae6b747a --- /dev/null +++ b/invokeai/frontend/web/src/features/nodes/components/flow/nodes/Invocation/fields/inputs/T2IAdapterModelInputField.tsx @@ -0,0 +1,100 @@ +import { SelectItem } from '@mantine/core'; +import { useAppDispatch } from 'app/store/storeHooks'; +import IAIMantineSelect from 'common/components/IAIMantineSelect'; +import { fieldT2IAdapterModelValueChanged } from 'features/nodes/store/nodesSlice'; +import { + T2IAdapterModelInputFieldTemplate, + T2IAdapterModelInputFieldValue, + FieldComponentProps, +} from 'features/nodes/types/types'; +import { MODEL_TYPE_MAP } from 'features/parameters/types/constants'; +import { modelIdToT2IAdapterModelParam } from 'features/parameters/util/modelIdToT2IAdapterModelParam'; +import { forEach } from 'lodash-es'; +import { memo, useCallback, useMemo } from 'react'; +import { useGetT2IAdapterModelsQuery } from 'services/api/endpoints/models'; + +const T2IAdapterModelInputFieldComponent = ( + props: FieldComponentProps< + T2IAdapterModelInputFieldValue, + T2IAdapterModelInputFieldTemplate + > +) => { + const { nodeId, field } = props; + const t2iAdapterModel = field.value; + const dispatch = useAppDispatch(); + + const { data: t2iAdapterModels } = useGetT2IAdapterModelsQuery(); + + // grab the full model entity from the RTK Query cache + const selectedModel = useMemo( + () => + t2iAdapterModels?.entities[ + `${t2iAdapterModel?.base_model}/t2i_adapter/${t2iAdapterModel?.model_name}` + ] ?? null, + [ + t2iAdapterModel?.base_model, + t2iAdapterModel?.model_name, + t2iAdapterModels?.entities, + ] + ); + + const data = useMemo(() => { + if (!t2iAdapterModels) { + return []; + } + + const data: SelectItem[] = []; + + forEach(t2iAdapterModels.entities, (model, id) => { + if (!model) { + return; + } + + data.push({ + value: id, + label: model.model_name, + group: MODEL_TYPE_MAP[model.base_model], + }); + }); + + return data; + }, [t2iAdapterModels]); + + const handleValueChanged = useCallback( + (v: string | null) => { + if (!v) { + return; + } + + const newT2IAdapterModel = modelIdToT2IAdapterModelParam(v); + + if (!newT2IAdapterModel) { + return; + } + + dispatch( + fieldT2IAdapterModelValueChanged({ + nodeId, + fieldName: field.name, + value: newT2IAdapterModel, + }) + ); + }, + [dispatch, field.name, nodeId] + ); + + return ( + + ); +}; + +export default memo(T2IAdapterModelInputFieldComponent); diff --git a/invokeai/frontend/web/src/features/nodes/store/nodesSlice.ts b/invokeai/frontend/web/src/features/nodes/store/nodesSlice.ts index 768017d86d..5ff0046d2d 100644 --- a/invokeai/frontend/web/src/features/nodes/store/nodesSlice.ts +++ b/invokeai/frontend/web/src/features/nodes/store/nodesSlice.ts @@ -55,6 +55,7 @@ import { SchedulerInputFieldValue, SDXLRefinerModelInputFieldValue, StringInputFieldValue, + T2IAdapterModelInputFieldValue, VaeModelInputFieldValue, Workflow, } from '../types/types'; @@ -645,6 +646,12 @@ const nodesSlice = createSlice({ ) => { fieldValueReducer(state, action); }, + fieldT2IAdapterModelValueChanged: ( + state, + action: FieldValueAction + ) => { + fieldValueReducer(state, action); + }, fieldEnumModelValueChanged: ( state, action: FieldValueAction @@ -1009,6 +1016,7 @@ export const { fieldEnumModelValueChanged, fieldImageValueChanged, fieldIPAdapterModelValueChanged, + fieldT2IAdapterModelValueChanged, fieldLabelChanged, fieldLoRAModelValueChanged, fieldMainModelValueChanged, diff --git a/invokeai/frontend/web/src/features/nodes/types/constants.ts b/invokeai/frontend/web/src/features/nodes/types/constants.ts index c41d8369b1..9c2470c57c 100644 --- a/invokeai/frontend/web/src/features/nodes/types/constants.ts +++ b/invokeai/frontend/web/src/features/nodes/types/constants.ts @@ -31,6 +31,7 @@ export const COLLECTION_TYPES: FieldType[] = [ 'ConditioningCollection', 'ControlCollection', 'ColorCollection', + 'T2IAdapterCollection', ]; export const POLYMORPHIC_TYPES: FieldType[] = [ @@ -43,6 +44,7 @@ export const POLYMORPHIC_TYPES: FieldType[] = [ 'ConditioningPolymorphic', 'ControlPolymorphic', 'ColorPolymorphic', + 'T2IAdapterPolymorphic', ]; export const MODEL_TYPES: FieldType[] = [ @@ -57,6 +59,7 @@ export const MODEL_TYPES: FieldType[] = [ 'UNetField', 'VaeField', 'ClipField', + 'T2IAdapterModelField', ]; export const COLLECTION_MAP: FieldTypeMapWithNumber = { @@ -70,6 +73,7 @@ export const COLLECTION_MAP: FieldTypeMapWithNumber = { ConditioningField: 'ConditioningCollection', ControlField: 'ControlCollection', ColorField: 'ColorCollection', + T2IAdapterField: 'T2IAdapterCollection', }; export const isCollectionItemType = ( itemType: string | undefined @@ -87,6 +91,7 @@ export const SINGLE_TO_POLYMORPHIC_MAP: FieldTypeMapWithNumber = { ConditioningField: 'ConditioningPolymorphic', ControlField: 'ControlPolymorphic', ColorField: 'ColorPolymorphic', + T2IAdapterField: 'T2IAdapterPolymorphic', }; export const POLYMORPHIC_TO_SINGLE_MAP: FieldTypeMap = { @@ -99,6 +104,7 @@ export const POLYMORPHIC_TO_SINGLE_MAP: FieldTypeMap = { ConditioningPolymorphic: 'ConditioningField', ControlPolymorphic: 'ControlField', ColorPolymorphic: 'ColorField', + T2IAdapterPolymorphic: 'T2IAdapterField', }; export const TYPES_WITH_INPUT_COMPONENTS: FieldType[] = [ @@ -123,6 +129,7 @@ export const TYPES_WITH_INPUT_COMPONENTS: FieldType[] = [ 'Scheduler', 'IPAdapterModelField', 'BoardField', + 'T2IAdapterModelField', ]; export const isPolymorphicItemType = ( @@ -272,7 +279,7 @@ export const FIELDS: Record = { title: t('nodes.integerPolymorphic'), }, IPAdapterField: { - color: 'green.300', + color: 'teal.500', description: 'IP-Adapter info passed between nodes.', title: 'IP-Adapter', }, @@ -341,6 +348,26 @@ export const FIELDS: Record = { description: t('nodes.stringPolymorphicDescription'), title: t('nodes.stringPolymorphic'), }, + T2IAdapterCollection: { + color: 'teal.500', + description: t('nodes.t2iAdapterCollectionDescription'), + title: t('nodes.t2iAdapterCollection'), + }, + T2IAdapterField: { + color: 'teal.500', + description: t('nodes.t2iAdapterFieldDescription'), + title: t('nodes.t2iAdapterField'), + }, + T2IAdapterModelField: { + color: 'teal.500', + description: 'TODO', + title: 'T2I-Adapter', + }, + T2IAdapterPolymorphic: { + color: 'teal.500', + description: 'T2I-Adapter info passed between nodes.', + title: 'T2I-Adapter Polymorphic', + }, UNetField: { color: 'red.500', description: t('nodes.uNetFieldDescription'), diff --git a/invokeai/frontend/web/src/features/nodes/types/types.ts b/invokeai/frontend/web/src/features/nodes/types/types.ts index 2e64a36926..d65eb1b21e 100644 --- a/invokeai/frontend/web/src/features/nodes/types/types.ts +++ b/invokeai/frontend/web/src/features/nodes/types/types.ts @@ -114,6 +114,10 @@ export const zFieldType = z.enum([ 'string', 'StringCollection', 'StringPolymorphic', + 'T2IAdapterCollection', + 'T2IAdapterField', + 'T2IAdapterModelField', + 'T2IAdapterPolymorphic', 'UNetField', 'VaeField', 'VaeModelField', @@ -426,6 +430,48 @@ export type IPAdapterInputFieldValue = z.infer< typeof zIPAdapterInputFieldValue >; +export const zT2IAdapterModel = zModelIdentifier; +export type T2IAdapterModel = z.infer; + +export const zT2IAdapterField = z.object({ + image: zImageField, + t2i_adapter_model: zT2IAdapterModel, + weight: z.union([z.number(), z.array(z.number())]).optional(), + begin_step_percent: z.number().optional(), + end_step_percent: z.number().optional(), + resize_mode: z + .enum(['just_resize', 'crop_resize', 'fill_resize', 'just_resize_simple']) + .optional(), +}); +export type T2IAdapterField = z.infer; + +export const zT2IAdapterInputFieldValue = zInputFieldValueBase.extend({ + type: z.literal('T2IAdapterField'), + value: zT2IAdapterField.optional(), +}); +export type T2IAdapterInputFieldValue = z.infer< + typeof zT2IAdapterInputFieldValue +>; + +export const zT2IAdapterPolymorphicInputFieldValue = + zInputFieldValueBase.extend({ + type: z.literal('T2IAdapterPolymorphic'), + value: z.union([zT2IAdapterField, z.array(zT2IAdapterField)]).optional(), + }); +export type T2IAdapterPolymorphicInputFieldValue = z.infer< + typeof zT2IAdapterPolymorphicInputFieldValue +>; + +export const zT2IAdapterCollectionInputFieldValue = zInputFieldValueBase.extend( + { + type: z.literal('T2IAdapterCollection'), + value: z.array(zT2IAdapterField).optional(), + } +); +export type T2IAdapterCollectionInputFieldValue = z.infer< + typeof zT2IAdapterCollectionInputFieldValue +>; + export const zModelType = z.enum([ 'onnx', 'main', @@ -592,6 +638,17 @@ export type IPAdapterModelInputFieldValue = z.infer< typeof zIPAdapterModelInputFieldValue >; +export const zT2IAdapterModelField = zModelIdentifier; +export type T2IAdapterModelField = z.infer; + +export const zT2IAdapterModelInputFieldValue = zInputFieldValueBase.extend({ + type: z.literal('T2IAdapterModelField'), + value: zT2IAdapterModelField.optional(), +}); +export type T2IAdapterModelInputFieldValue = z.infer< + typeof zT2IAdapterModelInputFieldValue +>; + export const zCollectionInputFieldValue = zInputFieldValueBase.extend({ type: z.literal('Collection'), value: z.array(z.any()).optional(), // TODO: should this field ever have a value? @@ -688,6 +745,10 @@ export const zInputFieldValue = z.discriminatedUnion('type', [ zStringCollectionInputFieldValue, zStringPolymorphicInputFieldValue, zStringInputFieldValue, + zT2IAdapterInputFieldValue, + zT2IAdapterModelInputFieldValue, + zT2IAdapterCollectionInputFieldValue, + zT2IAdapterPolymorphicInputFieldValue, zUNetInputFieldValue, zVaeInputFieldValue, zVaeModelInputFieldValue, @@ -889,6 +950,24 @@ export type IPAdapterInputFieldTemplate = InputFieldTemplateBase & { type: 'IPAdapterField'; }; +export type T2IAdapterInputFieldTemplate = InputFieldTemplateBase & { + default: undefined; + type: 'T2IAdapterField'; +}; + +export type T2IAdapterCollectionInputFieldTemplate = InputFieldTemplateBase & { + default: undefined; + type: 'T2IAdapterCollection'; + item_default?: T2IAdapterField; +}; + +export type T2IAdapterPolymorphicInputFieldTemplate = Omit< + T2IAdapterInputFieldTemplate, + 'type' +> & { + type: 'T2IAdapterPolymorphic'; +}; + export type EnumInputFieldTemplate = InputFieldTemplateBase & { default: string; type: 'enum'; @@ -931,6 +1010,11 @@ export type IPAdapterModelInputFieldTemplate = InputFieldTemplateBase & { type: 'IPAdapterModelField'; }; +export type T2IAdapterModelInputFieldTemplate = InputFieldTemplateBase & { + default: string; + type: 'T2IAdapterModelField'; +}; + export type CollectionInputFieldTemplate = InputFieldTemplateBase & { default: []; type: 'Collection'; @@ -1016,6 +1100,10 @@ export type InputFieldTemplate = | StringCollectionInputFieldTemplate | StringPolymorphicInputFieldTemplate | StringInputFieldTemplate + | T2IAdapterInputFieldTemplate + | T2IAdapterCollectionInputFieldTemplate + | T2IAdapterModelInputFieldTemplate + | T2IAdapterPolymorphicInputFieldTemplate | UNetInputFieldTemplate | VaeInputFieldTemplate | VaeModelInputFieldTemplate; diff --git a/invokeai/frontend/web/src/features/nodes/util/fieldTemplateBuilders.ts b/invokeai/frontend/web/src/features/nodes/util/fieldTemplateBuilders.ts index cf5f7c5523..74bbe2d3ac 100644 --- a/invokeai/frontend/web/src/features/nodes/util/fieldTemplateBuilders.ts +++ b/invokeai/frontend/web/src/features/nodes/util/fieldTemplateBuilders.ts @@ -62,6 +62,11 @@ import { ConditioningField, IPAdapterInputFieldTemplate, IPAdapterModelInputFieldTemplate, + T2IAdapterField, + T2IAdapterInputFieldTemplate, + T2IAdapterModelInputFieldTemplate, + T2IAdapterPolymorphicInputFieldTemplate, + T2IAdapterCollectionInputFieldTemplate, BoardInputFieldTemplate, InputFieldTemplate, } from '../types/types'; @@ -452,6 +457,19 @@ const buildIPAdapterModelInputFieldTemplate = ({ return template; }; +const buildT2IAdapterModelInputFieldTemplate = ({ + schemaObject, + baseField, +}: BuildInputFieldArg): T2IAdapterModelInputFieldTemplate => { + const template: T2IAdapterModelInputFieldTemplate = { + ...baseField, + type: 'T2IAdapterModelField', + default: schemaObject.default ?? undefined, + }; + + return template; +}; + const buildBoardInputFieldTemplate = ({ schemaObject, baseField, @@ -691,6 +709,46 @@ const buildIPAdapterInputFieldTemplate = ({ return template; }; +const buildT2IAdapterInputFieldTemplate = ({ + schemaObject, + baseField, +}: BuildInputFieldArg): T2IAdapterInputFieldTemplate => { + const template: T2IAdapterInputFieldTemplate = { + ...baseField, + type: 'T2IAdapterField', + default: schemaObject.default ?? undefined, + }; + + return template; +}; + +const buildT2IAdapterPolymorphicInputFieldTemplate = ({ + schemaObject, + baseField, +}: BuildInputFieldArg): T2IAdapterPolymorphicInputFieldTemplate => { + const template: T2IAdapterPolymorphicInputFieldTemplate = { + ...baseField, + type: 'T2IAdapterPolymorphic', + default: schemaObject.default ?? undefined, + }; + + return template; +}; + +const buildT2IAdapterCollectionInputFieldTemplate = ({ + schemaObject, + baseField, +}: BuildInputFieldArg): T2IAdapterCollectionInputFieldTemplate => { + const template: T2IAdapterCollectionInputFieldTemplate = { + ...baseField, + type: 'T2IAdapterCollection', + default: schemaObject.default ?? [], + item_default: (schemaObject.item_default as T2IAdapterField) ?? undefined, + }; + + return template; +}; + const buildEnumInputFieldTemplate = ({ schemaObject, baseField, @@ -910,6 +968,10 @@ const TEMPLATE_BUILDER_MAP: { string: buildStringInputFieldTemplate, StringCollection: buildStringCollectionInputFieldTemplate, StringPolymorphic: buildStringPolymorphicInputFieldTemplate, + T2IAdapterCollection: buildT2IAdapterCollectionInputFieldTemplate, + T2IAdapterField: buildT2IAdapterInputFieldTemplate, + T2IAdapterModelField: buildT2IAdapterModelInputFieldTemplate, + T2IAdapterPolymorphic: buildT2IAdapterPolymorphicInputFieldTemplate, UNetField: buildUNetInputFieldTemplate, VaeField: buildVaeInputFieldTemplate, VaeModelField: buildVaeModelInputFieldTemplate, diff --git a/invokeai/frontend/web/src/features/nodes/util/fieldValueBuilders.ts b/invokeai/frontend/web/src/features/nodes/util/fieldValueBuilders.ts index 9c90595c70..532449eeb6 100644 --- a/invokeai/frontend/web/src/features/nodes/util/fieldValueBuilders.ts +++ b/invokeai/frontend/web/src/features/nodes/util/fieldValueBuilders.ts @@ -45,6 +45,10 @@ const FIELD_VALUE_FALLBACK_MAP: { string: '', StringCollection: [], StringPolymorphic: '', + T2IAdapterCollection: [], + T2IAdapterField: undefined, + T2IAdapterModelField: undefined, + T2IAdapterPolymorphic: undefined, UNetField: undefined, VaeField: undefined, VaeModelField: undefined, diff --git a/invokeai/frontend/web/src/features/parameters/types/parameterSchemas.ts b/invokeai/frontend/web/src/features/parameters/types/parameterSchemas.ts index 532bdb92f3..b8f0a68974 100644 --- a/invokeai/frontend/web/src/features/parameters/types/parameterSchemas.ts +++ b/invokeai/frontend/web/src/features/parameters/types/parameterSchemas.ts @@ -340,6 +340,17 @@ export const zIPAdapterModel = z.object({ * Type alias for model parameter, inferred from its zod schema */ export type IPAdapterModelParam = z.infer; +/** + * Zod schema for T2I-Adapter models + */ +export const zT2IAdapterModel = z.object({ + model_name: z.string().min(1), + base_model: zBaseModel, +}); +/** + * Type alias for model parameter, inferred from its zod schema + */ +export type T2IAdapterModelParam = z.infer; /** * Zod schema for l2l strength parameter */ diff --git a/invokeai/frontend/web/src/features/parameters/util/modelIdToT2IAdapterModelParam.ts b/invokeai/frontend/web/src/features/parameters/util/modelIdToT2IAdapterModelParam.ts new file mode 100644 index 0000000000..95f1a3f25a --- /dev/null +++ b/invokeai/frontend/web/src/features/parameters/util/modelIdToT2IAdapterModelParam.ts @@ -0,0 +1,29 @@ +import { logger } from 'app/logging/logger'; +import { zT2IAdapterModel } from 'features/parameters/types/parameterSchemas'; +import { T2IAdapterModelField } from 'services/api/types'; + +export const modelIdToT2IAdapterModelParam = ( + t2iAdapterModelId: string +): T2IAdapterModelField | undefined => { + const log = logger('models'); + const [base_model, _model_type, model_name] = t2iAdapterModelId.split('/'); + + const result = zT2IAdapterModel.safeParse({ + base_model, + model_name, + }); + + if (!result.success) { + log.error( + { + t2iAdapterModelId, + errors: result.error.format(), + }, + 'Failed to parse T2I-Adapter model id' + ); + + return; + } + + return result.data; +}; diff --git a/invokeai/frontend/web/src/services/api/endpoints/models.ts b/invokeai/frontend/web/src/services/api/endpoints/models.ts index 41c0dee7fd..65cb151818 100644 --- a/invokeai/frontend/web/src/services/api/endpoints/models.ts +++ b/invokeai/frontend/web/src/services/api/endpoints/models.ts @@ -6,6 +6,7 @@ import { CheckpointModelConfig, ControlNetModelConfig, IPAdapterModelConfig, + T2IAdapterModelConfig, DiffusersModelConfig, ImportModelConfig, LoRAModelConfig, @@ -41,6 +42,10 @@ export type IPAdapterModelConfigEntity = IPAdapterModelConfig & { id: string; }; +export type T2IAdapterModelConfigEntity = T2IAdapterModelConfig & { + id: string; +}; + export type TextualInversionModelConfigEntity = TextualInversionModelConfig & { id: string; }; @@ -53,6 +58,7 @@ type AnyModelConfigEntity = | LoRAModelConfigEntity | ControlNetModelConfigEntity | IPAdapterModelConfigEntity + | T2IAdapterModelConfigEntity | TextualInversionModelConfigEntity | VaeModelConfigEntity; @@ -145,6 +151,10 @@ export const ipAdapterModelsAdapter = createEntityAdapter({ sortComparer: (a, b) => a.model_name.localeCompare(b.model_name), }); +export const t2iAdapterModelsAdapter = + createEntityAdapter({ + sortComparer: (a, b) => a.model_name.localeCompare(b.model_name), + }); export const textualInversionModelsAdapter = createEntityAdapter({ sortComparer: (a, b) => a.model_name.localeCompare(b.model_name), @@ -470,6 +480,37 @@ export const modelsApi = api.injectEndpoints({ ); }, }), + getT2IAdapterModels: build.query< + EntityState, + void + >({ + query: () => ({ url: 'models/', params: { model_type: 't2i_adapter' } }), + providesTags: (result) => { + const tags: ApiTagDescription[] = [ + { type: 'T2IAdapterModel', id: LIST_TAG }, + ]; + + if (result) { + tags.push( + ...result.ids.map((id) => ({ + type: 'T2IAdapterModel' as const, + id, + })) + ); + } + + return tags; + }, + transformResponse: (response: { models: T2IAdapterModelConfig[] }) => { + const entities = createModelEntities( + response.models + ); + return t2iAdapterModelsAdapter.setAll( + t2iAdapterModelsAdapter.getInitialState(), + entities + ); + }, + }), getVaeModels: build.query, void>({ query: () => ({ url: 'models/', params: { model_type: 'vae' } }), providesTags: (result) => { @@ -567,6 +608,7 @@ export const { useGetOnnxModelsQuery, useGetControlNetModelsQuery, useGetIPAdapterModelsQuery, + useGetT2IAdapterModelsQuery, useGetLoRAModelsQuery, useGetTextualInversionModelsQuery, useGetVaeModelsQuery, diff --git a/invokeai/frontend/web/src/services/api/schema.d.ts b/invokeai/frontend/web/src/services/api/schema.d.ts index 30f365951b..1db22fd6b4 100644 --- a/invokeai/frontend/web/src/services/api/schema.d.ts +++ b/invokeai/frontend/web/src/services/api/schema.d.ts @@ -894,8 +894,7 @@ export type components = { location: string; /** * Prediction Type - * @description Prediction type for SDv2 checkpoint files - * @default v_prediction + * @description Prediction type for SDv2 checkpoints and rare SDv1 checkpoints * @enum {string} */ prediction_type?: "v_prediction" | "epsilon" | "sample"; @@ -2042,7 +2041,7 @@ export type components = { /** * App Version * @description The version of InvokeAI used to generate this image - * @default 3.1.1 + * @default 3.2.0 */ app_version?: string; /** @@ -2116,10 +2115,10 @@ export type components = { */ controlnets: components["schemas"]["ControlField"][]; /** - * Loras - * @description The LoRAs used for inference + * Ipadapters + * @description The IP Adapters used for inference */ - ipAdapters: components["schemas"]["IPAdapterField"][]; + ipAdapters: components["schemas"]["IPAdapterMetadataField"][]; /** * Loras * @description The LoRAs used for inference @@ -2405,6 +2404,11 @@ export type components = { * @description IP-Adapter to apply */ ip_adapter?: components["schemas"]["IPAdapterField"]; + /** + * T2I-Adapter + * @description T2I-Adapter(s) to apply + */ + t2i_adapter?: components["schemas"]["T2IAdapterField"] | components["schemas"]["T2IAdapterField"][]; /** * Latents * @description Latents tensor @@ -2702,6 +2706,281 @@ export type components = { */ queue_item: components["schemas"]["SessionQueueItemDTO"]; }; + /** + * FaceIdentifier + * @description Outputs an image with detected face IDs printed on each face. For use with other FaceTools. + */ + FaceIdentifierInvocation: { + /** + * Id + * @description The id of this instance of an invocation. Must be unique among all instances of invocations. + */ + id: string; + /** + * Is Intermediate + * @description Whether or not this is an intermediate invocation. + * @default false + */ + is_intermediate?: boolean; + /** + * Workflow + * @description The workflow to save with the image + */ + workflow?: string; + /** + * Use Cache + * @description Whether or not to use the cache + * @default true + */ + use_cache?: boolean; + /** + * Image + * @description Image to face detect + */ + image?: components["schemas"]["ImageField"]; + /** + * Minimum Confidence + * @description Minimum confidence for face detection (lower if detection is failing) + * @default 0.5 + */ + minimum_confidence?: number; + /** + * Chunk + * @description Whether to bypass full image face detection and default to image chunking. Chunking will occur if no faces are found in the full image. + * @default false + */ + chunk?: boolean; + /** + * Type + * @default face_identifier + * @enum {string} + */ + type: "face_identifier"; + }; + /** + * FaceMask + * @description Face mask creation using mediapipe face detection + */ + FaceMaskInvocation: { + /** + * Id + * @description The id of this instance of an invocation. Must be unique among all instances of invocations. + */ + id: string; + /** + * Is Intermediate + * @description Whether or not this is an intermediate invocation. + * @default false + */ + is_intermediate?: boolean; + /** + * Workflow + * @description The workflow to save with the image + */ + workflow?: string; + /** + * Use Cache + * @description Whether or not to use the cache + * @default true + */ + use_cache?: boolean; + /** + * Image + * @description Image to face detect + */ + image?: components["schemas"]["ImageField"]; + /** + * Face Ids + * @description Comma-separated list of face ids to mask eg '0,2,7'. Numbered from 0. Leave empty to mask all. Find face IDs with FaceIdentifier node. + * @default + */ + face_ids?: string; + /** + * Minimum Confidence + * @description Minimum confidence for face detection (lower if detection is failing) + * @default 0.5 + */ + minimum_confidence?: number; + /** + * X Offset + * @description Offset for the X-axis of the face mask + * @default 0 + */ + x_offset?: number; + /** + * Y Offset + * @description Offset for the Y-axis of the face mask + * @default 0 + */ + y_offset?: number; + /** + * Chunk + * @description Whether to bypass full image face detection and default to image chunking. Chunking will occur if no faces are found in the full image. + * @default false + */ + chunk?: boolean; + /** + * Invert Mask + * @description Toggle to invert the mask + * @default false + */ + invert_mask?: boolean; + /** + * Type + * @default face_mask_detection + * @enum {string} + */ + type: "face_mask_detection"; + }; + /** + * FaceMaskOutput + * @description Base class for FaceMask output + */ + FaceMaskOutput: { + /** + * Image + * @description The output image + */ + image: components["schemas"]["ImageField"]; + /** + * Width + * @description The width of the image in pixels + */ + width: number; + /** + * Height + * @description The height of the image in pixels + */ + height: number; + /** + * Type + * @default face_mask_output + * @enum {string} + */ + type: "face_mask_output"; + /** + * Mask + * @description The output mask + */ + mask: components["schemas"]["ImageField"]; + }; + /** + * FaceOff + * @description Bound, extract, and mask a face from an image using MediaPipe detection + */ + FaceOffInvocation: { + /** + * Id + * @description The id of this instance of an invocation. Must be unique among all instances of invocations. + */ + id: string; + /** + * Is Intermediate + * @description Whether or not this is an intermediate invocation. + * @default false + */ + is_intermediate?: boolean; + /** + * Workflow + * @description The workflow to save with the image + */ + workflow?: string; + /** + * Use Cache + * @description Whether or not to use the cache + * @default true + */ + use_cache?: boolean; + /** + * Image + * @description Image for face detection + */ + image?: components["schemas"]["ImageField"]; + /** + * Face Id + * @description The face ID to process, numbered from 0. Multiple faces not supported. Find a face's ID with FaceIdentifier node. + * @default 0 + */ + face_id?: number; + /** + * Minimum Confidence + * @description Minimum confidence for face detection (lower if detection is failing) + * @default 0.5 + */ + minimum_confidence?: number; + /** + * X Offset + * @description X-axis offset of the mask + * @default 0 + */ + x_offset?: number; + /** + * Y Offset + * @description Y-axis offset of the mask + * @default 0 + */ + y_offset?: number; + /** + * Padding + * @description All-axis padding around the mask in pixels + * @default 0 + */ + padding?: number; + /** + * Chunk + * @description Whether to bypass full image face detection and default to image chunking. Chunking will occur if no faces are found in the full image. + * @default false + */ + chunk?: boolean; + /** + * Type + * @default face_off + * @enum {string} + */ + type: "face_off"; + }; + /** + * FaceOffOutput + * @description Base class for FaceOff Output + */ + FaceOffOutput: { + /** + * Image + * @description The output image + */ + image: components["schemas"]["ImageField"]; + /** + * Width + * @description The width of the image in pixels + */ + width: number; + /** + * Height + * @description The height of the image in pixels + */ + height: number; + /** + * Type + * @default face_off_output + * @enum {string} + */ + type: "face_off_output"; + /** + * Mask + * @description The output mask + */ + mask: components["schemas"]["ImageField"]; + /** + * X + * @description The x coordinate of the bounding box's left side + */ + x: number; + /** + * Y + * @description The y coordinate of the bounding box's top side + */ + y: number; + }; /** * Float Collection Primitive * @description A collection of float primitive values @@ -2985,7 +3264,7 @@ export type components = { * @description The nodes in this graph */ nodes?: { - [key: string]: components["schemas"]["BooleanInvocation"] | components["schemas"]["BooleanCollectionInvocation"] | components["schemas"]["IntegerInvocation"] | components["schemas"]["IntegerCollectionInvocation"] | components["schemas"]["FloatInvocation"] | components["schemas"]["FloatCollectionInvocation"] | components["schemas"]["StringInvocation"] | components["schemas"]["StringCollectionInvocation"] | components["schemas"]["ImageInvocation"] | components["schemas"]["ImageCollectionInvocation"] | components["schemas"]["LatentsInvocation"] | components["schemas"]["LatentsCollectionInvocation"] | components["schemas"]["ColorInvocation"] | components["schemas"]["ConditioningInvocation"] | components["schemas"]["ConditioningCollectionInvocation"] | components["schemas"]["ControlNetInvocation"] | components["schemas"]["ImageProcessorInvocation"] | components["schemas"]["MainModelLoaderInvocation"] | components["schemas"]["LoraLoaderInvocation"] | components["schemas"]["SDXLLoraLoaderInvocation"] | components["schemas"]["VaeLoaderInvocation"] | components["schemas"]["SeamlessModeInvocation"] | components["schemas"]["MetadataAccumulatorInvocation"] | components["schemas"]["RangeInvocation"] | components["schemas"]["RangeOfSizeInvocation"] | components["schemas"]["RandomRangeInvocation"] | components["schemas"]["CompelInvocation"] | components["schemas"]["SDXLCompelPromptInvocation"] | components["schemas"]["SDXLRefinerCompelPromptInvocation"] | components["schemas"]["ClipSkipInvocation"] | components["schemas"]["CvInpaintInvocation"] | components["schemas"]["ShowImageInvocation"] | components["schemas"]["BlankImageInvocation"] | components["schemas"]["ImageCropInvocation"] | components["schemas"]["ImagePasteInvocation"] | components["schemas"]["MaskFromAlphaInvocation"] | components["schemas"]["ImageMultiplyInvocation"] | components["schemas"]["ImageChannelInvocation"] | components["schemas"]["ImageConvertInvocation"] | components["schemas"]["ImageBlurInvocation"] | components["schemas"]["ImageResizeInvocation"] | components["schemas"]["ImageScaleInvocation"] | components["schemas"]["ImageLerpInvocation"] | components["schemas"]["ImageInverseLerpInvocation"] | components["schemas"]["ImageNSFWBlurInvocation"] | components["schemas"]["ImageWatermarkInvocation"] | components["schemas"]["MaskEdgeInvocation"] | components["schemas"]["MaskCombineInvocation"] | components["schemas"]["ColorCorrectInvocation"] | components["schemas"]["ImageHueAdjustmentInvocation"] | components["schemas"]["ImageChannelOffsetInvocation"] | components["schemas"]["ImageChannelMultiplyInvocation"] | components["schemas"]["SaveImageInvocation"] | components["schemas"]["InfillColorInvocation"] | components["schemas"]["InfillTileInvocation"] | components["schemas"]["InfillPatchMatchInvocation"] | components["schemas"]["LaMaInfillInvocation"] | components["schemas"]["CV2InfillInvocation"] | components["schemas"]["IPAdapterInvocation"] | components["schemas"]["SchedulerInvocation"] | components["schemas"]["CreateDenoiseMaskInvocation"] | components["schemas"]["DenoiseLatentsInvocation"] | components["schemas"]["LatentsToImageInvocation"] | components["schemas"]["ResizeLatentsInvocation"] | components["schemas"]["ScaleLatentsInvocation"] | components["schemas"]["ImageToLatentsInvocation"] | components["schemas"]["BlendLatentsInvocation"] | components["schemas"]["AddInvocation"] | components["schemas"]["SubtractInvocation"] | components["schemas"]["MultiplyInvocation"] | components["schemas"]["DivideInvocation"] | components["schemas"]["RandomIntInvocation"] | components["schemas"]["FloatToIntegerInvocation"] | components["schemas"]["RoundInvocation"] | components["schemas"]["IntegerMathInvocation"] | components["schemas"]["FloatMathInvocation"] | components["schemas"]["NoiseInvocation"] | components["schemas"]["ONNXPromptInvocation"] | components["schemas"]["ONNXTextToLatentsInvocation"] | components["schemas"]["ONNXLatentsToImageInvocation"] | components["schemas"]["OnnxModelLoaderInvocation"] | components["schemas"]["FloatLinearRangeInvocation"] | components["schemas"]["StepParamEasingInvocation"] | components["schemas"]["DynamicPromptInvocation"] | components["schemas"]["PromptsFromFileInvocation"] | components["schemas"]["SDXLModelLoaderInvocation"] | components["schemas"]["SDXLRefinerModelLoaderInvocation"] | components["schemas"]["StringSplitNegInvocation"] | components["schemas"]["StringSplitInvocation"] | components["schemas"]["StringJoinInvocation"] | components["schemas"]["StringJoinThreeInvocation"] | components["schemas"]["StringReplaceInvocation"] | components["schemas"]["ESRGANInvocation"] | components["schemas"]["GraphInvocation"] | components["schemas"]["IterateInvocation"] | components["schemas"]["CollectInvocation"] | components["schemas"]["CannyImageProcessorInvocation"] | components["schemas"]["HedImageProcessorInvocation"] | components["schemas"]["LineartImageProcessorInvocation"] | components["schemas"]["LineartAnimeImageProcessorInvocation"] | components["schemas"]["OpenposeImageProcessorInvocation"] | components["schemas"]["MidasDepthImageProcessorInvocation"] | components["schemas"]["NormalbaeImageProcessorInvocation"] | components["schemas"]["MlsdImageProcessorInvocation"] | components["schemas"]["PidiImageProcessorInvocation"] | components["schemas"]["ContentShuffleImageProcessorInvocation"] | components["schemas"]["ZoeDepthImageProcessorInvocation"] | components["schemas"]["MediapipeFaceProcessorInvocation"] | components["schemas"]["LeresImageProcessorInvocation"] | components["schemas"]["TileResamplerProcessorInvocation"] | components["schemas"]["SegmentAnythingProcessorInvocation"] | components["schemas"]["ColorMapImageProcessorInvocation"]; + [key: string]: components["schemas"]["BooleanInvocation"] | components["schemas"]["BooleanCollectionInvocation"] | components["schemas"]["IntegerInvocation"] | components["schemas"]["IntegerCollectionInvocation"] | components["schemas"]["FloatInvocation"] | components["schemas"]["FloatCollectionInvocation"] | components["schemas"]["StringInvocation"] | components["schemas"]["StringCollectionInvocation"] | components["schemas"]["ImageInvocation"] | components["schemas"]["ImageCollectionInvocation"] | components["schemas"]["LatentsInvocation"] | components["schemas"]["LatentsCollectionInvocation"] | components["schemas"]["ColorInvocation"] | components["schemas"]["ConditioningInvocation"] | components["schemas"]["ConditioningCollectionInvocation"] | components["schemas"]["ControlNetInvocation"] | components["schemas"]["ImageProcessorInvocation"] | components["schemas"]["IPAdapterInvocation"] | components["schemas"]["MainModelLoaderInvocation"] | components["schemas"]["LoraLoaderInvocation"] | components["schemas"]["SDXLLoraLoaderInvocation"] | components["schemas"]["VaeLoaderInvocation"] | components["schemas"]["SeamlessModeInvocation"] | components["schemas"]["MetadataAccumulatorInvocation"] | components["schemas"]["CompelInvocation"] | components["schemas"]["SDXLCompelPromptInvocation"] | components["schemas"]["SDXLRefinerCompelPromptInvocation"] | components["schemas"]["ClipSkipInvocation"] | components["schemas"]["T2IAdapterInvocation"] | components["schemas"]["SchedulerInvocation"] | components["schemas"]["CreateDenoiseMaskInvocation"] | components["schemas"]["DenoiseLatentsInvocation"] | components["schemas"]["LatentsToImageInvocation"] | components["schemas"]["ResizeLatentsInvocation"] | components["schemas"]["ScaleLatentsInvocation"] | components["schemas"]["ImageToLatentsInvocation"] | components["schemas"]["BlendLatentsInvocation"] | components["schemas"]["ONNXPromptInvocation"] | components["schemas"]["ONNXTextToLatentsInvocation"] | components["schemas"]["ONNXLatentsToImageInvocation"] | components["schemas"]["OnnxModelLoaderInvocation"] | components["schemas"]["FloatLinearRangeInvocation"] | components["schemas"]["StepParamEasingInvocation"] | components["schemas"]["ShowImageInvocation"] | components["schemas"]["BlankImageInvocation"] | components["schemas"]["ImageCropInvocation"] | components["schemas"]["ImagePasteInvocation"] | components["schemas"]["MaskFromAlphaInvocation"] | components["schemas"]["ImageMultiplyInvocation"] | components["schemas"]["ImageChannelInvocation"] | components["schemas"]["ImageConvertInvocation"] | components["schemas"]["ImageBlurInvocation"] | components["schemas"]["ImageResizeInvocation"] | components["schemas"]["ImageScaleInvocation"] | components["schemas"]["ImageLerpInvocation"] | components["schemas"]["ImageInverseLerpInvocation"] | components["schemas"]["ImageNSFWBlurInvocation"] | components["schemas"]["ImageWatermarkInvocation"] | components["schemas"]["MaskEdgeInvocation"] | components["schemas"]["MaskCombineInvocation"] | components["schemas"]["ColorCorrectInvocation"] | components["schemas"]["ImageHueAdjustmentInvocation"] | components["schemas"]["ImageChannelOffsetInvocation"] | components["schemas"]["ImageChannelMultiplyInvocation"] | components["schemas"]["SaveImageInvocation"] | components["schemas"]["NoiseInvocation"] | components["schemas"]["DynamicPromptInvocation"] | components["schemas"]["PromptsFromFileInvocation"] | components["schemas"]["AddInvocation"] | components["schemas"]["SubtractInvocation"] | components["schemas"]["MultiplyInvocation"] | components["schemas"]["DivideInvocation"] | components["schemas"]["RandomIntInvocation"] | components["schemas"]["RandomFloatInvocation"] | components["schemas"]["FloatToIntegerInvocation"] | components["schemas"]["RoundInvocation"] | components["schemas"]["IntegerMathInvocation"] | components["schemas"]["FloatMathInvocation"] | components["schemas"]["StringSplitNegInvocation"] | components["schemas"]["StringSplitInvocation"] | components["schemas"]["StringJoinInvocation"] | components["schemas"]["StringJoinThreeInvocation"] | components["schemas"]["StringReplaceInvocation"] | components["schemas"]["RangeInvocation"] | components["schemas"]["RangeOfSizeInvocation"] | components["schemas"]["RandomRangeInvocation"] | components["schemas"]["CvInpaintInvocation"] | components["schemas"]["InfillColorInvocation"] | components["schemas"]["InfillTileInvocation"] | components["schemas"]["InfillPatchMatchInvocation"] | components["schemas"]["LaMaInfillInvocation"] | components["schemas"]["CV2InfillInvocation"] | components["schemas"]["SDXLModelLoaderInvocation"] | components["schemas"]["SDXLRefinerModelLoaderInvocation"] | components["schemas"]["FaceOffInvocation"] | components["schemas"]["FaceMaskInvocation"] | components["schemas"]["FaceIdentifierInvocation"] | components["schemas"]["ESRGANInvocation"] | components["schemas"]["GraphInvocation"] | components["schemas"]["IterateInvocation"] | components["schemas"]["CollectInvocation"] | components["schemas"]["CannyImageProcessorInvocation"] | components["schemas"]["HedImageProcessorInvocation"] | components["schemas"]["LineartImageProcessorInvocation"] | components["schemas"]["LineartAnimeImageProcessorInvocation"] | components["schemas"]["OpenposeImageProcessorInvocation"] | components["schemas"]["MidasDepthImageProcessorInvocation"] | components["schemas"]["NormalbaeImageProcessorInvocation"] | components["schemas"]["MlsdImageProcessorInvocation"] | components["schemas"]["PidiImageProcessorInvocation"] | components["schemas"]["ContentShuffleImageProcessorInvocation"] | components["schemas"]["ZoeDepthImageProcessorInvocation"] | components["schemas"]["MediapipeFaceProcessorInvocation"] | components["schemas"]["LeresImageProcessorInvocation"] | components["schemas"]["TileResamplerProcessorInvocation"] | components["schemas"]["SegmentAnythingProcessorInvocation"] | components["schemas"]["ColorMapImageProcessorInvocation"]; }; /** * Edges @@ -3028,7 +3307,7 @@ export type components = { * @description The results of node executions */ results: { - [key: string]: components["schemas"]["BooleanOutput"] | components["schemas"]["BooleanCollectionOutput"] | components["schemas"]["IntegerOutput"] | components["schemas"]["IntegerCollectionOutput"] | components["schemas"]["FloatOutput"] | components["schemas"]["FloatCollectionOutput"] | components["schemas"]["StringOutput"] | components["schemas"]["StringCollectionOutput"] | components["schemas"]["ImageOutput"] | components["schemas"]["ImageCollectionOutput"] | components["schemas"]["DenoiseMaskOutput"] | components["schemas"]["LatentsOutput"] | components["schemas"]["LatentsCollectionOutput"] | components["schemas"]["ColorOutput"] | components["schemas"]["ColorCollectionOutput"] | components["schemas"]["ConditioningOutput"] | components["schemas"]["ConditioningCollectionOutput"] | components["schemas"]["ControlOutput"] | components["schemas"]["ModelLoaderOutput"] | components["schemas"]["LoraLoaderOutput"] | components["schemas"]["SDXLLoraLoaderOutput"] | components["schemas"]["VaeLoaderOutput"] | components["schemas"]["SeamlessModeOutput"] | components["schemas"]["MetadataAccumulatorOutput"] | components["schemas"]["ClipSkipInvocationOutput"] | components["schemas"]["IPAdapterOutput"] | components["schemas"]["SchedulerOutput"] | components["schemas"]["NoiseOutput"] | components["schemas"]["ONNXModelLoaderOutput"] | components["schemas"]["SDXLModelLoaderOutput"] | components["schemas"]["SDXLRefinerModelLoaderOutput"] | components["schemas"]["StringPosNegOutput"] | components["schemas"]["String2Output"] | components["schemas"]["GraphInvocationOutput"] | components["schemas"]["IterateInvocationOutput"] | components["schemas"]["CollectInvocationOutput"]; + [key: string]: components["schemas"]["BooleanOutput"] | components["schemas"]["BooleanCollectionOutput"] | components["schemas"]["IntegerOutput"] | components["schemas"]["IntegerCollectionOutput"] | components["schemas"]["FloatOutput"] | components["schemas"]["FloatCollectionOutput"] | components["schemas"]["StringOutput"] | components["schemas"]["StringCollectionOutput"] | components["schemas"]["ImageOutput"] | components["schemas"]["ImageCollectionOutput"] | components["schemas"]["DenoiseMaskOutput"] | components["schemas"]["LatentsOutput"] | components["schemas"]["LatentsCollectionOutput"] | components["schemas"]["ColorOutput"] | components["schemas"]["ColorCollectionOutput"] | components["schemas"]["ConditioningOutput"] | components["schemas"]["ConditioningCollectionOutput"] | components["schemas"]["ControlOutput"] | components["schemas"]["IPAdapterOutput"] | components["schemas"]["ModelLoaderOutput"] | components["schemas"]["LoraLoaderOutput"] | components["schemas"]["SDXLLoraLoaderOutput"] | components["schemas"]["VaeLoaderOutput"] | components["schemas"]["SeamlessModeOutput"] | components["schemas"]["MetadataAccumulatorOutput"] | components["schemas"]["ClipSkipInvocationOutput"] | components["schemas"]["T2IAdapterOutput"] | components["schemas"]["SchedulerOutput"] | components["schemas"]["ONNXModelLoaderOutput"] | components["schemas"]["NoiseOutput"] | components["schemas"]["StringPosNegOutput"] | components["schemas"]["String2Output"] | components["schemas"]["SDXLModelLoaderOutput"] | components["schemas"]["SDXLRefinerModelLoaderOutput"] | components["schemas"]["GraphInvocationOutput"] | components["schemas"]["IterateInvocationOutput"] | components["schemas"]["CollectInvocationOutput"] | components["schemas"]["FaceMaskOutput"] | components["schemas"]["FaceOffOutput"]; }; /** * Errors @@ -3183,7 +3462,7 @@ export type components = { * Image Encoder Model * @description The name of the CLIP image encoder model. */ - image_encoder_model?: components["schemas"]["CLIPVisionModelField"]; + image_encoder_model: components["schemas"]["CLIPVisionModelField"]; /** * Weight * @description The weight given to the ControlNet @@ -3265,6 +3544,36 @@ export type components = { */ type: "ip_adapter"; }; + /** IPAdapterMetadataField */ + IPAdapterMetadataField: { + /** + * Image + * @description The IP-Adapter image prompt. + */ + image: components["schemas"]["ImageField"]; + /** + * Ip Adapter Model + * @description The IP-Adapter model to use. + */ + ip_adapter_model: components["schemas"]["IPAdapterModelField"]; + /** + * Weight + * @description The weight of the IP-Adapter model + */ + weight: number; + /** + * Begin Step Percent + * @description When the IP-Adapter is first applied (% of total steps) + * @default 0 + */ + begin_step_percent?: number; + /** + * End Step Percent + * @description When the IP-Adapter is last applied (% of total steps) + * @default 1 + */ + end_step_percent?: number; + }; /** IPAdapterModelField */ IPAdapterModelField: { /** @@ -5814,16 +6123,16 @@ export type components = { * @description The ControlNets used for inference */ controlnets?: components["schemas"]["ControlField"][]; + /** + * Ipadapters + * @description The IP Adapters used for inference + */ + ipAdapters?: components["schemas"]["IPAdapterMetadataField"][]; /** * Loras * @description The LoRAs used for inference */ loras?: components["schemas"]["LoRAMetadataField"][]; - /** - * Strength - * @description The strength used for latents-to-latents - */ - ipAdapters?: components["schemas"]["IPAdapterField"][]; /** * Strength * @description The strength used for latents-to-latents @@ -6074,7 +6383,7 @@ export type components = { * @description An enumeration. * @enum {string} */ - ModelType: "onnx" | "main" | "vae" | "lora" | "controlnet" | "embedding" | "ip_adapter" | "clip_vision"; + ModelType: "onnx" | "main" | "vae" | "lora" | "controlnet" | "embedding" | "ip_adapter" | "clip_vision" | "t2i_adapter"; /** * ModelVariantType * @description An enumeration. @@ -6084,7 +6393,7 @@ export type components = { /** ModelsList */ ModelsList: { /** Models */ - models: (components["schemas"]["ONNXStableDiffusion1ModelConfig"] | components["schemas"]["StableDiffusion1ModelCheckpointConfig"] | components["schemas"]["StableDiffusion1ModelDiffusersConfig"] | components["schemas"]["VaeModelConfig"] | components["schemas"]["LoRAModelConfig"] | components["schemas"]["ControlNetModelCheckpointConfig"] | components["schemas"]["ControlNetModelDiffusersConfig"] | components["schemas"]["TextualInversionModelConfig"] | components["schemas"]["IPAdapterModelInvokeAIConfig"] | components["schemas"]["CLIPVisionModelDiffusersConfig"] | components["schemas"]["ONNXStableDiffusion2ModelConfig"] | components["schemas"]["StableDiffusion2ModelCheckpointConfig"] | components["schemas"]["StableDiffusion2ModelDiffusersConfig"] | components["schemas"]["StableDiffusionXLModelCheckpointConfig"] | components["schemas"]["StableDiffusionXLModelDiffusersConfig"])[]; + models: (components["schemas"]["ONNXStableDiffusion1ModelConfig"] | components["schemas"]["StableDiffusion1ModelCheckpointConfig"] | components["schemas"]["StableDiffusion1ModelDiffusersConfig"] | components["schemas"]["VaeModelConfig"] | components["schemas"]["LoRAModelConfig"] | components["schemas"]["ControlNetModelCheckpointConfig"] | components["schemas"]["ControlNetModelDiffusersConfig"] | components["schemas"]["TextualInversionModelConfig"] | components["schemas"]["IPAdapterModelInvokeAIConfig"] | components["schemas"]["CLIPVisionModelDiffusersConfig"] | components["schemas"]["T2IAdapterModelDiffusersConfig"] | components["schemas"]["ONNXStableDiffusion2ModelConfig"] | components["schemas"]["StableDiffusion2ModelCheckpointConfig"] | components["schemas"]["StableDiffusion2ModelDiffusersConfig"] | components["schemas"]["StableDiffusionXLModelCheckpointConfig"] | components["schemas"]["StableDiffusionXLModelDiffusersConfig"])[]; }; /** * Multiply Integers @@ -6875,6 +7184,58 @@ export type components = { */ deleted: number; }; + /** + * Random Float + * @description Outputs a single random float + */ + RandomFloatInvocation: { + /** + * Id + * @description The id of this instance of an invocation. Must be unique among all instances of invocations. + */ + id: string; + /** + * Is Intermediate + * @description Whether or not this is an intermediate invocation. + * @default false + */ + is_intermediate?: boolean; + /** + * Workflow + * @description The workflow to save with the image + */ + workflow?: string; + /** + * Use Cache + * @description Whether or not to use the cache + * @default true + */ + use_cache?: boolean; + /** + * Low + * @description The inclusive low value + * @default 0 + */ + low?: number; + /** + * High + * @description The exclusive high value + * @default 1 + */ + high?: number; + /** + * Decimals + * @description The number of decimal places to round to + * @default 2 + */ + decimals?: number; + /** + * Type + * @default rand_float + * @enum {string} + */ + type: "rand_float"; + }; /** * Random Integer * @description Outputs a single random integer. @@ -8829,6 +9190,163 @@ export type components = { */ type: "sub"; }; + /** T2IAdapterField */ + T2IAdapterField: { + /** + * Image + * @description The T2I-Adapter image prompt. + */ + image: components["schemas"]["ImageField"]; + /** + * T2I Adapter Model + * @description The T2I-Adapter model to use. + */ + t2i_adapter_model: components["schemas"]["T2IAdapterModelField"]; + /** + * Weight + * @description The weight given to the T2I-Adapter + * @default 1 + */ + weight?: number | number[]; + /** + * Begin Step Percent + * @description When the T2I-Adapter is first applied (% of total steps) + * @default 0 + */ + begin_step_percent?: number; + /** + * End Step Percent + * @description When the T2I-Adapter is last applied (% of total steps) + * @default 1 + */ + end_step_percent?: number; + /** + * Resize Mode + * @description The resize mode to use + * @default just_resize + * @enum {string} + */ + resize_mode?: "just_resize" | "crop_resize" | "fill_resize" | "just_resize_simple"; + }; + /** + * T2I-Adapter + * @description Collects T2I-Adapter info to pass to other nodes. + */ + T2IAdapterInvocation: { + /** + * Id + * @description The id of this instance of an invocation. Must be unique among all instances of invocations. + */ + id: string; + /** + * Is Intermediate + * @description Whether or not this is an intermediate invocation. + * @default false + */ + is_intermediate?: boolean; + /** + * Workflow + * @description The workflow to save with the image + */ + workflow?: string; + /** + * Use Cache + * @description Whether or not to use the cache + * @default true + */ + use_cache?: boolean; + /** + * Image + * @description The IP-Adapter image prompt. + */ + image?: components["schemas"]["ImageField"]; + /** + * T2I-Adapter Model + * @description The T2I-Adapter model. + */ + ip_adapter_model: components["schemas"]["T2IAdapterModelField"]; + /** + * Weight + * @description The weight given to the T2I-Adapter + * @default 1 + */ + weight?: number | number[]; + /** + * Begin Step Percent + * @description When the T2I-Adapter is first applied (% of total steps) + * @default 0 + */ + begin_step_percent?: number; + /** + * End Step Percent + * @description When the T2I-Adapter is last applied (% of total steps) + * @default 1 + */ + end_step_percent?: number; + /** + * Resize Mode + * @description The resize mode applied to the T2I-Adapter input image so that it matches the target output size. + * @default just_resize + * @enum {string} + */ + resize_mode?: "just_resize" | "crop_resize" | "fill_resize" | "just_resize_simple"; + /** + * Type + * @default t2i_adapter + * @enum {string} + */ + type: "t2i_adapter"; + }; + /** T2IAdapterModelDiffusersConfig */ + T2IAdapterModelDiffusersConfig: { + /** Model Name */ + model_name: string; + base_model: components["schemas"]["BaseModelType"]; + /** + * Model Type + * @enum {string} + */ + model_type: "t2i_adapter"; + /** Path */ + path: string; + /** Description */ + description?: string; + /** + * Model Format + * @enum {string} + */ + model_format: "diffusers"; + error?: components["schemas"]["ModelError"]; + }; + /** T2IAdapterModelField */ + T2IAdapterModelField: { + /** + * Model Name + * @description Name of the T2I-Adapter model + */ + model_name: string; + /** @description Base model */ + base_model: components["schemas"]["BaseModelType"]; + }; + /** + * T2IAdapterOutput + * @description Base class for all invocation outputs. + * + * All invocation outputs must use the `@invocation_output` decorator to provide their unique type. + */ + T2IAdapterOutput: { + /** + * T2I Adapter + * @description T2I-Adapter(s) to apply + */ + t2i_adapter: components["schemas"]["T2IAdapterField"]; + /** + * Type + * @default t2i_adapter_output + * @enum {string} + */ + type: "t2i_adapter_output"; + }; /** TextualInversionModelConfig */ TextualInversionModelConfig: { /** Model Name */ @@ -9167,11 +9685,17 @@ export type components = { ui_order?: number; }; /** - * CLIPVisionModelFormat + * StableDiffusion2ModelFormat * @description An enumeration. * @enum {string} */ - CLIPVisionModelFormat: "diffusers"; + StableDiffusion2ModelFormat: "checkpoint" | "diffusers"; + /** + * T2IAdapterModelFormat + * @description An enumeration. + * @enum {string} + */ + T2IAdapterModelFormat: "diffusers"; /** * StableDiffusionOnnxModelFormat * @description An enumeration. @@ -9179,11 +9703,17 @@ export type components = { */ StableDiffusionOnnxModelFormat: "olive" | "onnx"; /** - * StableDiffusion2ModelFormat + * CLIPVisionModelFormat * @description An enumeration. * @enum {string} */ - StableDiffusion2ModelFormat: "checkpoint" | "diffusers"; + CLIPVisionModelFormat: "diffusers"; + /** + * ControlNetModelFormat + * @description An enumeration. + * @enum {string} + */ + ControlNetModelFormat: "checkpoint" | "diffusers"; /** * StableDiffusionXLModelFormat * @description An enumeration. @@ -9196,12 +9726,6 @@ export type components = { * @enum {string} */ IPAdapterModelFormat: "invokeai"; - /** - * ControlNetModelFormat - * @description An enumeration. - * @enum {string} - */ - ControlNetModelFormat: "checkpoint" | "diffusers"; /** * StableDiffusion1ModelFormat * @description An enumeration. @@ -9334,7 +9858,7 @@ export type operations = { }; requestBody: { content: { - "application/json": components["schemas"]["BooleanInvocation"] | components["schemas"]["BooleanCollectionInvocation"] | components["schemas"]["IntegerInvocation"] | components["schemas"]["IntegerCollectionInvocation"] | components["schemas"]["FloatInvocation"] | components["schemas"]["FloatCollectionInvocation"] | components["schemas"]["StringInvocation"] | components["schemas"]["StringCollectionInvocation"] | components["schemas"]["ImageInvocation"] | components["schemas"]["ImageCollectionInvocation"] | components["schemas"]["LatentsInvocation"] | components["schemas"]["LatentsCollectionInvocation"] | components["schemas"]["ColorInvocation"] | components["schemas"]["ConditioningInvocation"] | components["schemas"]["ConditioningCollectionInvocation"] | components["schemas"]["ControlNetInvocation"] | components["schemas"]["ImageProcessorInvocation"] | components["schemas"]["MainModelLoaderInvocation"] | components["schemas"]["LoraLoaderInvocation"] | components["schemas"]["SDXLLoraLoaderInvocation"] | components["schemas"]["VaeLoaderInvocation"] | components["schemas"]["SeamlessModeInvocation"] | components["schemas"]["MetadataAccumulatorInvocation"] | components["schemas"]["RangeInvocation"] | components["schemas"]["RangeOfSizeInvocation"] | components["schemas"]["RandomRangeInvocation"] | components["schemas"]["CompelInvocation"] | components["schemas"]["SDXLCompelPromptInvocation"] | components["schemas"]["SDXLRefinerCompelPromptInvocation"] | components["schemas"]["ClipSkipInvocation"] | components["schemas"]["CvInpaintInvocation"] | components["schemas"]["ShowImageInvocation"] | components["schemas"]["BlankImageInvocation"] | components["schemas"]["ImageCropInvocation"] | components["schemas"]["ImagePasteInvocation"] | components["schemas"]["MaskFromAlphaInvocation"] | components["schemas"]["ImageMultiplyInvocation"] | components["schemas"]["ImageChannelInvocation"] | components["schemas"]["ImageConvertInvocation"] | components["schemas"]["ImageBlurInvocation"] | components["schemas"]["ImageResizeInvocation"] | components["schemas"]["ImageScaleInvocation"] | components["schemas"]["ImageLerpInvocation"] | components["schemas"]["ImageInverseLerpInvocation"] | components["schemas"]["ImageNSFWBlurInvocation"] | components["schemas"]["ImageWatermarkInvocation"] | components["schemas"]["MaskEdgeInvocation"] | components["schemas"]["MaskCombineInvocation"] | components["schemas"]["ColorCorrectInvocation"] | components["schemas"]["ImageHueAdjustmentInvocation"] | components["schemas"]["ImageChannelOffsetInvocation"] | components["schemas"]["ImageChannelMultiplyInvocation"] | components["schemas"]["SaveImageInvocation"] | components["schemas"]["InfillColorInvocation"] | components["schemas"]["InfillTileInvocation"] | components["schemas"]["InfillPatchMatchInvocation"] | components["schemas"]["LaMaInfillInvocation"] | components["schemas"]["CV2InfillInvocation"] | components["schemas"]["IPAdapterInvocation"] | components["schemas"]["SchedulerInvocation"] | components["schemas"]["CreateDenoiseMaskInvocation"] | components["schemas"]["DenoiseLatentsInvocation"] | components["schemas"]["LatentsToImageInvocation"] | components["schemas"]["ResizeLatentsInvocation"] | components["schemas"]["ScaleLatentsInvocation"] | components["schemas"]["ImageToLatentsInvocation"] | components["schemas"]["BlendLatentsInvocation"] | components["schemas"]["AddInvocation"] | components["schemas"]["SubtractInvocation"] | components["schemas"]["MultiplyInvocation"] | components["schemas"]["DivideInvocation"] | components["schemas"]["RandomIntInvocation"] | components["schemas"]["FloatToIntegerInvocation"] | components["schemas"]["RoundInvocation"] | components["schemas"]["IntegerMathInvocation"] | components["schemas"]["FloatMathInvocation"] | components["schemas"]["NoiseInvocation"] | components["schemas"]["ONNXPromptInvocation"] | components["schemas"]["ONNXTextToLatentsInvocation"] | components["schemas"]["ONNXLatentsToImageInvocation"] | components["schemas"]["OnnxModelLoaderInvocation"] | components["schemas"]["FloatLinearRangeInvocation"] | components["schemas"]["StepParamEasingInvocation"] | components["schemas"]["DynamicPromptInvocation"] | components["schemas"]["PromptsFromFileInvocation"] | components["schemas"]["SDXLModelLoaderInvocation"] | components["schemas"]["SDXLRefinerModelLoaderInvocation"] | components["schemas"]["StringSplitNegInvocation"] | components["schemas"]["StringSplitInvocation"] | components["schemas"]["StringJoinInvocation"] | components["schemas"]["StringJoinThreeInvocation"] | components["schemas"]["StringReplaceInvocation"] | components["schemas"]["ESRGANInvocation"] | components["schemas"]["GraphInvocation"] | components["schemas"]["IterateInvocation"] | components["schemas"]["CollectInvocation"] | components["schemas"]["CannyImageProcessorInvocation"] | components["schemas"]["HedImageProcessorInvocation"] | components["schemas"]["LineartImageProcessorInvocation"] | components["schemas"]["LineartAnimeImageProcessorInvocation"] | components["schemas"]["OpenposeImageProcessorInvocation"] | components["schemas"]["MidasDepthImageProcessorInvocation"] | components["schemas"]["NormalbaeImageProcessorInvocation"] | components["schemas"]["MlsdImageProcessorInvocation"] | components["schemas"]["PidiImageProcessorInvocation"] | components["schemas"]["ContentShuffleImageProcessorInvocation"] | components["schemas"]["ZoeDepthImageProcessorInvocation"] | components["schemas"]["MediapipeFaceProcessorInvocation"] | components["schemas"]["LeresImageProcessorInvocation"] | components["schemas"]["TileResamplerProcessorInvocation"] | components["schemas"]["SegmentAnythingProcessorInvocation"] | components["schemas"]["ColorMapImageProcessorInvocation"]; + "application/json": components["schemas"]["BooleanInvocation"] | components["schemas"]["BooleanCollectionInvocation"] | components["schemas"]["IntegerInvocation"] | components["schemas"]["IntegerCollectionInvocation"] | components["schemas"]["FloatInvocation"] | components["schemas"]["FloatCollectionInvocation"] | components["schemas"]["StringInvocation"] | components["schemas"]["StringCollectionInvocation"] | components["schemas"]["ImageInvocation"] | components["schemas"]["ImageCollectionInvocation"] | components["schemas"]["LatentsInvocation"] | components["schemas"]["LatentsCollectionInvocation"] | components["schemas"]["ColorInvocation"] | components["schemas"]["ConditioningInvocation"] | components["schemas"]["ConditioningCollectionInvocation"] | components["schemas"]["ControlNetInvocation"] | components["schemas"]["ImageProcessorInvocation"] | components["schemas"]["IPAdapterInvocation"] | components["schemas"]["MainModelLoaderInvocation"] | components["schemas"]["LoraLoaderInvocation"] | components["schemas"]["SDXLLoraLoaderInvocation"] | components["schemas"]["VaeLoaderInvocation"] | components["schemas"]["SeamlessModeInvocation"] | components["schemas"]["MetadataAccumulatorInvocation"] | components["schemas"]["CompelInvocation"] | components["schemas"]["SDXLCompelPromptInvocation"] | components["schemas"]["SDXLRefinerCompelPromptInvocation"] | components["schemas"]["ClipSkipInvocation"] | components["schemas"]["T2IAdapterInvocation"] | components["schemas"]["SchedulerInvocation"] | components["schemas"]["CreateDenoiseMaskInvocation"] | components["schemas"]["DenoiseLatentsInvocation"] | components["schemas"]["LatentsToImageInvocation"] | components["schemas"]["ResizeLatentsInvocation"] | components["schemas"]["ScaleLatentsInvocation"] | components["schemas"]["ImageToLatentsInvocation"] | components["schemas"]["BlendLatentsInvocation"] | components["schemas"]["ONNXPromptInvocation"] | components["schemas"]["ONNXTextToLatentsInvocation"] | components["schemas"]["ONNXLatentsToImageInvocation"] | components["schemas"]["OnnxModelLoaderInvocation"] | components["schemas"]["FloatLinearRangeInvocation"] | components["schemas"]["StepParamEasingInvocation"] | components["schemas"]["ShowImageInvocation"] | components["schemas"]["BlankImageInvocation"] | components["schemas"]["ImageCropInvocation"] | components["schemas"]["ImagePasteInvocation"] | components["schemas"]["MaskFromAlphaInvocation"] | components["schemas"]["ImageMultiplyInvocation"] | components["schemas"]["ImageChannelInvocation"] | components["schemas"]["ImageConvertInvocation"] | components["schemas"]["ImageBlurInvocation"] | components["schemas"]["ImageResizeInvocation"] | components["schemas"]["ImageScaleInvocation"] | components["schemas"]["ImageLerpInvocation"] | components["schemas"]["ImageInverseLerpInvocation"] | components["schemas"]["ImageNSFWBlurInvocation"] | components["schemas"]["ImageWatermarkInvocation"] | components["schemas"]["MaskEdgeInvocation"] | components["schemas"]["MaskCombineInvocation"] | components["schemas"]["ColorCorrectInvocation"] | components["schemas"]["ImageHueAdjustmentInvocation"] | components["schemas"]["ImageChannelOffsetInvocation"] | components["schemas"]["ImageChannelMultiplyInvocation"] | components["schemas"]["SaveImageInvocation"] | components["schemas"]["NoiseInvocation"] | components["schemas"]["DynamicPromptInvocation"] | components["schemas"]["PromptsFromFileInvocation"] | components["schemas"]["AddInvocation"] | components["schemas"]["SubtractInvocation"] | components["schemas"]["MultiplyInvocation"] | components["schemas"]["DivideInvocation"] | components["schemas"]["RandomIntInvocation"] | components["schemas"]["RandomFloatInvocation"] | components["schemas"]["FloatToIntegerInvocation"] | components["schemas"]["RoundInvocation"] | components["schemas"]["IntegerMathInvocation"] | components["schemas"]["FloatMathInvocation"] | components["schemas"]["StringSplitNegInvocation"] | components["schemas"]["StringSplitInvocation"] | components["schemas"]["StringJoinInvocation"] | components["schemas"]["StringJoinThreeInvocation"] | components["schemas"]["StringReplaceInvocation"] | components["schemas"]["RangeInvocation"] | components["schemas"]["RangeOfSizeInvocation"] | components["schemas"]["RandomRangeInvocation"] | components["schemas"]["CvInpaintInvocation"] | components["schemas"]["InfillColorInvocation"] | components["schemas"]["InfillTileInvocation"] | components["schemas"]["InfillPatchMatchInvocation"] | components["schemas"]["LaMaInfillInvocation"] | components["schemas"]["CV2InfillInvocation"] | components["schemas"]["SDXLModelLoaderInvocation"] | components["schemas"]["SDXLRefinerModelLoaderInvocation"] | components["schemas"]["FaceOffInvocation"] | components["schemas"]["FaceMaskInvocation"] | components["schemas"]["FaceIdentifierInvocation"] | components["schemas"]["ESRGANInvocation"] | components["schemas"]["GraphInvocation"] | components["schemas"]["IterateInvocation"] | components["schemas"]["CollectInvocation"] | components["schemas"]["CannyImageProcessorInvocation"] | components["schemas"]["HedImageProcessorInvocation"] | components["schemas"]["LineartImageProcessorInvocation"] | components["schemas"]["LineartAnimeImageProcessorInvocation"] | components["schemas"]["OpenposeImageProcessorInvocation"] | components["schemas"]["MidasDepthImageProcessorInvocation"] | components["schemas"]["NormalbaeImageProcessorInvocation"] | components["schemas"]["MlsdImageProcessorInvocation"] | components["schemas"]["PidiImageProcessorInvocation"] | components["schemas"]["ContentShuffleImageProcessorInvocation"] | components["schemas"]["ZoeDepthImageProcessorInvocation"] | components["schemas"]["MediapipeFaceProcessorInvocation"] | components["schemas"]["LeresImageProcessorInvocation"] | components["schemas"]["TileResamplerProcessorInvocation"] | components["schemas"]["SegmentAnythingProcessorInvocation"] | components["schemas"]["ColorMapImageProcessorInvocation"]; }; }; responses: { @@ -9376,7 +9900,7 @@ export type operations = { }; requestBody: { content: { - "application/json": components["schemas"]["BooleanInvocation"] | components["schemas"]["BooleanCollectionInvocation"] | components["schemas"]["IntegerInvocation"] | components["schemas"]["IntegerCollectionInvocation"] | components["schemas"]["FloatInvocation"] | components["schemas"]["FloatCollectionInvocation"] | components["schemas"]["StringInvocation"] | components["schemas"]["StringCollectionInvocation"] | components["schemas"]["ImageInvocation"] | components["schemas"]["ImageCollectionInvocation"] | components["schemas"]["LatentsInvocation"] | components["schemas"]["LatentsCollectionInvocation"] | components["schemas"]["ColorInvocation"] | components["schemas"]["ConditioningInvocation"] | components["schemas"]["ConditioningCollectionInvocation"] | components["schemas"]["ControlNetInvocation"] | components["schemas"]["ImageProcessorInvocation"] | components["schemas"]["MainModelLoaderInvocation"] | components["schemas"]["LoraLoaderInvocation"] | components["schemas"]["SDXLLoraLoaderInvocation"] | components["schemas"]["VaeLoaderInvocation"] | components["schemas"]["SeamlessModeInvocation"] | components["schemas"]["MetadataAccumulatorInvocation"] | components["schemas"]["RangeInvocation"] | components["schemas"]["RangeOfSizeInvocation"] | components["schemas"]["RandomRangeInvocation"] | components["schemas"]["CompelInvocation"] | components["schemas"]["SDXLCompelPromptInvocation"] | components["schemas"]["SDXLRefinerCompelPromptInvocation"] | components["schemas"]["ClipSkipInvocation"] | components["schemas"]["CvInpaintInvocation"] | components["schemas"]["ShowImageInvocation"] | components["schemas"]["BlankImageInvocation"] | components["schemas"]["ImageCropInvocation"] | components["schemas"]["ImagePasteInvocation"] | components["schemas"]["MaskFromAlphaInvocation"] | components["schemas"]["ImageMultiplyInvocation"] | components["schemas"]["ImageChannelInvocation"] | components["schemas"]["ImageConvertInvocation"] | components["schemas"]["ImageBlurInvocation"] | components["schemas"]["ImageResizeInvocation"] | components["schemas"]["ImageScaleInvocation"] | components["schemas"]["ImageLerpInvocation"] | components["schemas"]["ImageInverseLerpInvocation"] | components["schemas"]["ImageNSFWBlurInvocation"] | components["schemas"]["ImageWatermarkInvocation"] | components["schemas"]["MaskEdgeInvocation"] | components["schemas"]["MaskCombineInvocation"] | components["schemas"]["ColorCorrectInvocation"] | components["schemas"]["ImageHueAdjustmentInvocation"] | components["schemas"]["ImageChannelOffsetInvocation"] | components["schemas"]["ImageChannelMultiplyInvocation"] | components["schemas"]["SaveImageInvocation"] | components["schemas"]["InfillColorInvocation"] | components["schemas"]["InfillTileInvocation"] | components["schemas"]["InfillPatchMatchInvocation"] | components["schemas"]["LaMaInfillInvocation"] | components["schemas"]["CV2InfillInvocation"] | components["schemas"]["IPAdapterInvocation"] | components["schemas"]["SchedulerInvocation"] | components["schemas"]["CreateDenoiseMaskInvocation"] | components["schemas"]["DenoiseLatentsInvocation"] | components["schemas"]["LatentsToImageInvocation"] | components["schemas"]["ResizeLatentsInvocation"] | components["schemas"]["ScaleLatentsInvocation"] | components["schemas"]["ImageToLatentsInvocation"] | components["schemas"]["BlendLatentsInvocation"] | components["schemas"]["AddInvocation"] | components["schemas"]["SubtractInvocation"] | components["schemas"]["MultiplyInvocation"] | components["schemas"]["DivideInvocation"] | components["schemas"]["RandomIntInvocation"] | components["schemas"]["FloatToIntegerInvocation"] | components["schemas"]["RoundInvocation"] | components["schemas"]["IntegerMathInvocation"] | components["schemas"]["FloatMathInvocation"] | components["schemas"]["NoiseInvocation"] | components["schemas"]["ONNXPromptInvocation"] | components["schemas"]["ONNXTextToLatentsInvocation"] | components["schemas"]["ONNXLatentsToImageInvocation"] | components["schemas"]["OnnxModelLoaderInvocation"] | components["schemas"]["FloatLinearRangeInvocation"] | components["schemas"]["StepParamEasingInvocation"] | components["schemas"]["DynamicPromptInvocation"] | components["schemas"]["PromptsFromFileInvocation"] | components["schemas"]["SDXLModelLoaderInvocation"] | components["schemas"]["SDXLRefinerModelLoaderInvocation"] | components["schemas"]["StringSplitNegInvocation"] | components["schemas"]["StringSplitInvocation"] | components["schemas"]["StringJoinInvocation"] | components["schemas"]["StringJoinThreeInvocation"] | components["schemas"]["StringReplaceInvocation"] | components["schemas"]["ESRGANInvocation"] | components["schemas"]["GraphInvocation"] | components["schemas"]["IterateInvocation"] | components["schemas"]["CollectInvocation"] | components["schemas"]["CannyImageProcessorInvocation"] | components["schemas"]["HedImageProcessorInvocation"] | components["schemas"]["LineartImageProcessorInvocation"] | components["schemas"]["LineartAnimeImageProcessorInvocation"] | components["schemas"]["OpenposeImageProcessorInvocation"] | components["schemas"]["MidasDepthImageProcessorInvocation"] | components["schemas"]["NormalbaeImageProcessorInvocation"] | components["schemas"]["MlsdImageProcessorInvocation"] | components["schemas"]["PidiImageProcessorInvocation"] | components["schemas"]["ContentShuffleImageProcessorInvocation"] | components["schemas"]["ZoeDepthImageProcessorInvocation"] | components["schemas"]["MediapipeFaceProcessorInvocation"] | components["schemas"]["LeresImageProcessorInvocation"] | components["schemas"]["TileResamplerProcessorInvocation"] | components["schemas"]["SegmentAnythingProcessorInvocation"] | components["schemas"]["ColorMapImageProcessorInvocation"]; + "application/json": components["schemas"]["BooleanInvocation"] | components["schemas"]["BooleanCollectionInvocation"] | components["schemas"]["IntegerInvocation"] | components["schemas"]["IntegerCollectionInvocation"] | components["schemas"]["FloatInvocation"] | components["schemas"]["FloatCollectionInvocation"] | components["schemas"]["StringInvocation"] | components["schemas"]["StringCollectionInvocation"] | components["schemas"]["ImageInvocation"] | components["schemas"]["ImageCollectionInvocation"] | components["schemas"]["LatentsInvocation"] | components["schemas"]["LatentsCollectionInvocation"] | components["schemas"]["ColorInvocation"] | components["schemas"]["ConditioningInvocation"] | components["schemas"]["ConditioningCollectionInvocation"] | components["schemas"]["ControlNetInvocation"] | components["schemas"]["ImageProcessorInvocation"] | components["schemas"]["IPAdapterInvocation"] | components["schemas"]["MainModelLoaderInvocation"] | components["schemas"]["LoraLoaderInvocation"] | components["schemas"]["SDXLLoraLoaderInvocation"] | components["schemas"]["VaeLoaderInvocation"] | components["schemas"]["SeamlessModeInvocation"] | components["schemas"]["MetadataAccumulatorInvocation"] | components["schemas"]["CompelInvocation"] | components["schemas"]["SDXLCompelPromptInvocation"] | components["schemas"]["SDXLRefinerCompelPromptInvocation"] | components["schemas"]["ClipSkipInvocation"] | components["schemas"]["T2IAdapterInvocation"] | components["schemas"]["SchedulerInvocation"] | components["schemas"]["CreateDenoiseMaskInvocation"] | components["schemas"]["DenoiseLatentsInvocation"] | components["schemas"]["LatentsToImageInvocation"] | components["schemas"]["ResizeLatentsInvocation"] | components["schemas"]["ScaleLatentsInvocation"] | components["schemas"]["ImageToLatentsInvocation"] | components["schemas"]["BlendLatentsInvocation"] | components["schemas"]["ONNXPromptInvocation"] | components["schemas"]["ONNXTextToLatentsInvocation"] | components["schemas"]["ONNXLatentsToImageInvocation"] | components["schemas"]["OnnxModelLoaderInvocation"] | components["schemas"]["FloatLinearRangeInvocation"] | components["schemas"]["StepParamEasingInvocation"] | components["schemas"]["ShowImageInvocation"] | components["schemas"]["BlankImageInvocation"] | components["schemas"]["ImageCropInvocation"] | components["schemas"]["ImagePasteInvocation"] | components["schemas"]["MaskFromAlphaInvocation"] | components["schemas"]["ImageMultiplyInvocation"] | components["schemas"]["ImageChannelInvocation"] | components["schemas"]["ImageConvertInvocation"] | components["schemas"]["ImageBlurInvocation"] | components["schemas"]["ImageResizeInvocation"] | components["schemas"]["ImageScaleInvocation"] | components["schemas"]["ImageLerpInvocation"] | components["schemas"]["ImageInverseLerpInvocation"] | components["schemas"]["ImageNSFWBlurInvocation"] | components["schemas"]["ImageWatermarkInvocation"] | components["schemas"]["MaskEdgeInvocation"] | components["schemas"]["MaskCombineInvocation"] | components["schemas"]["ColorCorrectInvocation"] | components["schemas"]["ImageHueAdjustmentInvocation"] | components["schemas"]["ImageChannelOffsetInvocation"] | components["schemas"]["ImageChannelMultiplyInvocation"] | components["schemas"]["SaveImageInvocation"] | components["schemas"]["NoiseInvocation"] | components["schemas"]["DynamicPromptInvocation"] | components["schemas"]["PromptsFromFileInvocation"] | components["schemas"]["AddInvocation"] | components["schemas"]["SubtractInvocation"] | components["schemas"]["MultiplyInvocation"] | components["schemas"]["DivideInvocation"] | components["schemas"]["RandomIntInvocation"] | components["schemas"]["RandomFloatInvocation"] | components["schemas"]["FloatToIntegerInvocation"] | components["schemas"]["RoundInvocation"] | components["schemas"]["IntegerMathInvocation"] | components["schemas"]["FloatMathInvocation"] | components["schemas"]["StringSplitNegInvocation"] | components["schemas"]["StringSplitInvocation"] | components["schemas"]["StringJoinInvocation"] | components["schemas"]["StringJoinThreeInvocation"] | components["schemas"]["StringReplaceInvocation"] | components["schemas"]["RangeInvocation"] | components["schemas"]["RangeOfSizeInvocation"] | components["schemas"]["RandomRangeInvocation"] | components["schemas"]["CvInpaintInvocation"] | components["schemas"]["InfillColorInvocation"] | components["schemas"]["InfillTileInvocation"] | components["schemas"]["InfillPatchMatchInvocation"] | components["schemas"]["LaMaInfillInvocation"] | components["schemas"]["CV2InfillInvocation"] | components["schemas"]["SDXLModelLoaderInvocation"] | components["schemas"]["SDXLRefinerModelLoaderInvocation"] | components["schemas"]["FaceOffInvocation"] | components["schemas"]["FaceMaskInvocation"] | components["schemas"]["FaceIdentifierInvocation"] | components["schemas"]["ESRGANInvocation"] | components["schemas"]["GraphInvocation"] | components["schemas"]["IterateInvocation"] | components["schemas"]["CollectInvocation"] | components["schemas"]["CannyImageProcessorInvocation"] | components["schemas"]["HedImageProcessorInvocation"] | components["schemas"]["LineartImageProcessorInvocation"] | components["schemas"]["LineartAnimeImageProcessorInvocation"] | components["schemas"]["OpenposeImageProcessorInvocation"] | components["schemas"]["MidasDepthImageProcessorInvocation"] | components["schemas"]["NormalbaeImageProcessorInvocation"] | components["schemas"]["MlsdImageProcessorInvocation"] | components["schemas"]["PidiImageProcessorInvocation"] | components["schemas"]["ContentShuffleImageProcessorInvocation"] | components["schemas"]["ZoeDepthImageProcessorInvocation"] | components["schemas"]["MediapipeFaceProcessorInvocation"] | components["schemas"]["LeresImageProcessorInvocation"] | components["schemas"]["TileResamplerProcessorInvocation"] | components["schemas"]["SegmentAnythingProcessorInvocation"] | components["schemas"]["ColorMapImageProcessorInvocation"]; }; }; responses: { @@ -9700,14 +10224,14 @@ export type operations = { }; requestBody: { content: { - "application/json": components["schemas"]["ONNXStableDiffusion1ModelConfig"] | components["schemas"]["StableDiffusion1ModelCheckpointConfig"] | components["schemas"]["StableDiffusion1ModelDiffusersConfig"] | components["schemas"]["VaeModelConfig"] | components["schemas"]["LoRAModelConfig"] | components["schemas"]["ControlNetModelCheckpointConfig"] | components["schemas"]["ControlNetModelDiffusersConfig"] | components["schemas"]["TextualInversionModelConfig"] | components["schemas"]["IPAdapterModelInvokeAIConfig"] | components["schemas"]["CLIPVisionModelDiffusersConfig"] | components["schemas"]["ONNXStableDiffusion2ModelConfig"] | components["schemas"]["StableDiffusion2ModelCheckpointConfig"] | components["schemas"]["StableDiffusion2ModelDiffusersConfig"] | components["schemas"]["StableDiffusionXLModelCheckpointConfig"] | components["schemas"]["StableDiffusionXLModelDiffusersConfig"]; + "application/json": components["schemas"]["ONNXStableDiffusion1ModelConfig"] | components["schemas"]["StableDiffusion1ModelCheckpointConfig"] | components["schemas"]["StableDiffusion1ModelDiffusersConfig"] | components["schemas"]["VaeModelConfig"] | components["schemas"]["LoRAModelConfig"] | components["schemas"]["ControlNetModelCheckpointConfig"] | components["schemas"]["ControlNetModelDiffusersConfig"] | components["schemas"]["TextualInversionModelConfig"] | components["schemas"]["IPAdapterModelInvokeAIConfig"] | components["schemas"]["CLIPVisionModelDiffusersConfig"] | components["schemas"]["T2IAdapterModelDiffusersConfig"] | components["schemas"]["ONNXStableDiffusion2ModelConfig"] | components["schemas"]["StableDiffusion2ModelCheckpointConfig"] | components["schemas"]["StableDiffusion2ModelDiffusersConfig"] | components["schemas"]["StableDiffusionXLModelCheckpointConfig"] | components["schemas"]["StableDiffusionXLModelDiffusersConfig"]; }; }; responses: { /** @description The model was updated successfully */ 200: { content: { - "application/json": components["schemas"]["ONNXStableDiffusion1ModelConfig"] | components["schemas"]["StableDiffusion1ModelCheckpointConfig"] | components["schemas"]["StableDiffusion1ModelDiffusersConfig"] | components["schemas"]["VaeModelConfig"] | components["schemas"]["LoRAModelConfig"] | components["schemas"]["ControlNetModelCheckpointConfig"] | components["schemas"]["ControlNetModelDiffusersConfig"] | components["schemas"]["TextualInversionModelConfig"] | components["schemas"]["IPAdapterModelInvokeAIConfig"] | components["schemas"]["CLIPVisionModelDiffusersConfig"] | components["schemas"]["ONNXStableDiffusion2ModelConfig"] | components["schemas"]["StableDiffusion2ModelCheckpointConfig"] | components["schemas"]["StableDiffusion2ModelDiffusersConfig"] | components["schemas"]["StableDiffusionXLModelCheckpointConfig"] | components["schemas"]["StableDiffusionXLModelDiffusersConfig"]; + "application/json": components["schemas"]["ONNXStableDiffusion1ModelConfig"] | components["schemas"]["StableDiffusion1ModelCheckpointConfig"] | components["schemas"]["StableDiffusion1ModelDiffusersConfig"] | components["schemas"]["VaeModelConfig"] | components["schemas"]["LoRAModelConfig"] | components["schemas"]["ControlNetModelCheckpointConfig"] | components["schemas"]["ControlNetModelDiffusersConfig"] | components["schemas"]["TextualInversionModelConfig"] | components["schemas"]["IPAdapterModelInvokeAIConfig"] | components["schemas"]["CLIPVisionModelDiffusersConfig"] | components["schemas"]["T2IAdapterModelDiffusersConfig"] | components["schemas"]["ONNXStableDiffusion2ModelConfig"] | components["schemas"]["StableDiffusion2ModelCheckpointConfig"] | components["schemas"]["StableDiffusion2ModelDiffusersConfig"] | components["schemas"]["StableDiffusionXLModelCheckpointConfig"] | components["schemas"]["StableDiffusionXLModelDiffusersConfig"]; }; }; /** @description Bad request */ @@ -9744,7 +10268,7 @@ export type operations = { /** @description The model imported successfully */ 201: { content: { - "application/json": components["schemas"]["ONNXStableDiffusion1ModelConfig"] | components["schemas"]["StableDiffusion1ModelCheckpointConfig"] | components["schemas"]["StableDiffusion1ModelDiffusersConfig"] | components["schemas"]["VaeModelConfig"] | components["schemas"]["LoRAModelConfig"] | components["schemas"]["ControlNetModelCheckpointConfig"] | components["schemas"]["ControlNetModelDiffusersConfig"] | components["schemas"]["TextualInversionModelConfig"] | components["schemas"]["IPAdapterModelInvokeAIConfig"] | components["schemas"]["CLIPVisionModelDiffusersConfig"] | components["schemas"]["ONNXStableDiffusion2ModelConfig"] | components["schemas"]["StableDiffusion2ModelCheckpointConfig"] | components["schemas"]["StableDiffusion2ModelDiffusersConfig"] | components["schemas"]["StableDiffusionXLModelCheckpointConfig"] | components["schemas"]["StableDiffusionXLModelDiffusersConfig"]; + "application/json": components["schemas"]["ONNXStableDiffusion1ModelConfig"] | components["schemas"]["StableDiffusion1ModelCheckpointConfig"] | components["schemas"]["StableDiffusion1ModelDiffusersConfig"] | components["schemas"]["VaeModelConfig"] | components["schemas"]["LoRAModelConfig"] | components["schemas"]["ControlNetModelCheckpointConfig"] | components["schemas"]["ControlNetModelDiffusersConfig"] | components["schemas"]["TextualInversionModelConfig"] | components["schemas"]["IPAdapterModelInvokeAIConfig"] | components["schemas"]["CLIPVisionModelDiffusersConfig"] | components["schemas"]["T2IAdapterModelDiffusersConfig"] | components["schemas"]["ONNXStableDiffusion2ModelConfig"] | components["schemas"]["StableDiffusion2ModelCheckpointConfig"] | components["schemas"]["StableDiffusion2ModelDiffusersConfig"] | components["schemas"]["StableDiffusionXLModelCheckpointConfig"] | components["schemas"]["StableDiffusionXLModelDiffusersConfig"]; }; }; /** @description The model could not be found */ @@ -9778,14 +10302,14 @@ export type operations = { add_model: { requestBody: { content: { - "application/json": components["schemas"]["ONNXStableDiffusion1ModelConfig"] | components["schemas"]["StableDiffusion1ModelCheckpointConfig"] | components["schemas"]["StableDiffusion1ModelDiffusersConfig"] | components["schemas"]["VaeModelConfig"] | components["schemas"]["LoRAModelConfig"] | components["schemas"]["ControlNetModelCheckpointConfig"] | components["schemas"]["ControlNetModelDiffusersConfig"] | components["schemas"]["TextualInversionModelConfig"] | components["schemas"]["IPAdapterModelInvokeAIConfig"] | components["schemas"]["CLIPVisionModelDiffusersConfig"] | components["schemas"]["ONNXStableDiffusion2ModelConfig"] | components["schemas"]["StableDiffusion2ModelCheckpointConfig"] | components["schemas"]["StableDiffusion2ModelDiffusersConfig"] | components["schemas"]["StableDiffusionXLModelCheckpointConfig"] | components["schemas"]["StableDiffusionXLModelDiffusersConfig"]; + "application/json": components["schemas"]["ONNXStableDiffusion1ModelConfig"] | components["schemas"]["StableDiffusion1ModelCheckpointConfig"] | components["schemas"]["StableDiffusion1ModelDiffusersConfig"] | components["schemas"]["VaeModelConfig"] | components["schemas"]["LoRAModelConfig"] | components["schemas"]["ControlNetModelCheckpointConfig"] | components["schemas"]["ControlNetModelDiffusersConfig"] | components["schemas"]["TextualInversionModelConfig"] | components["schemas"]["IPAdapterModelInvokeAIConfig"] | components["schemas"]["CLIPVisionModelDiffusersConfig"] | components["schemas"]["T2IAdapterModelDiffusersConfig"] | components["schemas"]["ONNXStableDiffusion2ModelConfig"] | components["schemas"]["StableDiffusion2ModelCheckpointConfig"] | components["schemas"]["StableDiffusion2ModelDiffusersConfig"] | components["schemas"]["StableDiffusionXLModelCheckpointConfig"] | components["schemas"]["StableDiffusionXLModelDiffusersConfig"]; }; }; responses: { /** @description The model added successfully */ 201: { content: { - "application/json": components["schemas"]["ONNXStableDiffusion1ModelConfig"] | components["schemas"]["StableDiffusion1ModelCheckpointConfig"] | components["schemas"]["StableDiffusion1ModelDiffusersConfig"] | components["schemas"]["VaeModelConfig"] | components["schemas"]["LoRAModelConfig"] | components["schemas"]["ControlNetModelCheckpointConfig"] | components["schemas"]["ControlNetModelDiffusersConfig"] | components["schemas"]["TextualInversionModelConfig"] | components["schemas"]["IPAdapterModelInvokeAIConfig"] | components["schemas"]["CLIPVisionModelDiffusersConfig"] | components["schemas"]["ONNXStableDiffusion2ModelConfig"] | components["schemas"]["StableDiffusion2ModelCheckpointConfig"] | components["schemas"]["StableDiffusion2ModelDiffusersConfig"] | components["schemas"]["StableDiffusionXLModelCheckpointConfig"] | components["schemas"]["StableDiffusionXLModelDiffusersConfig"]; + "application/json": components["schemas"]["ONNXStableDiffusion1ModelConfig"] | components["schemas"]["StableDiffusion1ModelCheckpointConfig"] | components["schemas"]["StableDiffusion1ModelDiffusersConfig"] | components["schemas"]["VaeModelConfig"] | components["schemas"]["LoRAModelConfig"] | components["schemas"]["ControlNetModelCheckpointConfig"] | components["schemas"]["ControlNetModelDiffusersConfig"] | components["schemas"]["TextualInversionModelConfig"] | components["schemas"]["IPAdapterModelInvokeAIConfig"] | components["schemas"]["CLIPVisionModelDiffusersConfig"] | components["schemas"]["T2IAdapterModelDiffusersConfig"] | components["schemas"]["ONNXStableDiffusion2ModelConfig"] | components["schemas"]["StableDiffusion2ModelCheckpointConfig"] | components["schemas"]["StableDiffusion2ModelDiffusersConfig"] | components["schemas"]["StableDiffusionXLModelCheckpointConfig"] | components["schemas"]["StableDiffusionXLModelDiffusersConfig"]; }; }; /** @description The model could not be found */ @@ -9831,7 +10355,7 @@ export type operations = { /** @description Model converted successfully */ 200: { content: { - "application/json": components["schemas"]["ONNXStableDiffusion1ModelConfig"] | components["schemas"]["StableDiffusion1ModelCheckpointConfig"] | components["schemas"]["StableDiffusion1ModelDiffusersConfig"] | components["schemas"]["VaeModelConfig"] | components["schemas"]["LoRAModelConfig"] | components["schemas"]["ControlNetModelCheckpointConfig"] | components["schemas"]["ControlNetModelDiffusersConfig"] | components["schemas"]["TextualInversionModelConfig"] | components["schemas"]["IPAdapterModelInvokeAIConfig"] | components["schemas"]["CLIPVisionModelDiffusersConfig"] | components["schemas"]["ONNXStableDiffusion2ModelConfig"] | components["schemas"]["StableDiffusion2ModelCheckpointConfig"] | components["schemas"]["StableDiffusion2ModelDiffusersConfig"] | components["schemas"]["StableDiffusionXLModelCheckpointConfig"] | components["schemas"]["StableDiffusionXLModelDiffusersConfig"]; + "application/json": components["schemas"]["ONNXStableDiffusion1ModelConfig"] | components["schemas"]["StableDiffusion1ModelCheckpointConfig"] | components["schemas"]["StableDiffusion1ModelDiffusersConfig"] | components["schemas"]["VaeModelConfig"] | components["schemas"]["LoRAModelConfig"] | components["schemas"]["ControlNetModelCheckpointConfig"] | components["schemas"]["ControlNetModelDiffusersConfig"] | components["schemas"]["TextualInversionModelConfig"] | components["schemas"]["IPAdapterModelInvokeAIConfig"] | components["schemas"]["CLIPVisionModelDiffusersConfig"] | components["schemas"]["T2IAdapterModelDiffusersConfig"] | components["schemas"]["ONNXStableDiffusion2ModelConfig"] | components["schemas"]["StableDiffusion2ModelCheckpointConfig"] | components["schemas"]["StableDiffusion2ModelDiffusersConfig"] | components["schemas"]["StableDiffusionXLModelCheckpointConfig"] | components["schemas"]["StableDiffusionXLModelDiffusersConfig"]; }; }; /** @description Bad request */ @@ -9926,7 +10450,7 @@ export type operations = { /** @description Model converted successfully */ 200: { content: { - "application/json": components["schemas"]["ONNXStableDiffusion1ModelConfig"] | components["schemas"]["StableDiffusion1ModelCheckpointConfig"] | components["schemas"]["StableDiffusion1ModelDiffusersConfig"] | components["schemas"]["VaeModelConfig"] | components["schemas"]["LoRAModelConfig"] | components["schemas"]["ControlNetModelCheckpointConfig"] | components["schemas"]["ControlNetModelDiffusersConfig"] | components["schemas"]["TextualInversionModelConfig"] | components["schemas"]["IPAdapterModelInvokeAIConfig"] | components["schemas"]["CLIPVisionModelDiffusersConfig"] | components["schemas"]["ONNXStableDiffusion2ModelConfig"] | components["schemas"]["StableDiffusion2ModelCheckpointConfig"] | components["schemas"]["StableDiffusion2ModelDiffusersConfig"] | components["schemas"]["StableDiffusionXLModelCheckpointConfig"] | components["schemas"]["StableDiffusionXLModelDiffusersConfig"]; + "application/json": components["schemas"]["ONNXStableDiffusion1ModelConfig"] | components["schemas"]["StableDiffusion1ModelCheckpointConfig"] | components["schemas"]["StableDiffusion1ModelDiffusersConfig"] | components["schemas"]["VaeModelConfig"] | components["schemas"]["LoRAModelConfig"] | components["schemas"]["ControlNetModelCheckpointConfig"] | components["schemas"]["ControlNetModelDiffusersConfig"] | components["schemas"]["TextualInversionModelConfig"] | components["schemas"]["IPAdapterModelInvokeAIConfig"] | components["schemas"]["CLIPVisionModelDiffusersConfig"] | components["schemas"]["T2IAdapterModelDiffusersConfig"] | components["schemas"]["ONNXStableDiffusion2ModelConfig"] | components["schemas"]["StableDiffusion2ModelCheckpointConfig"] | components["schemas"]["StableDiffusion2ModelDiffusersConfig"] | components["schemas"]["StableDiffusionXLModelCheckpointConfig"] | components["schemas"]["StableDiffusionXLModelDiffusersConfig"]; }; }; /** @description Incompatible models */ diff --git a/invokeai/frontend/web/src/services/api/types.ts b/invokeai/frontend/web/src/services/api/types.ts index afa2cd7bd7..6dfb16a45a 100644 --- a/invokeai/frontend/web/src/services/api/types.ts +++ b/invokeai/frontend/web/src/services/api/types.ts @@ -67,6 +67,7 @@ export type VAEModelField = s['VAEModelField']; export type LoRAModelField = s['LoRAModelField']; export type ControlNetModelField = s['ControlNetModelField']; export type IPAdapterModelField = s['IPAdapterModelField']; +export type T2IAdapterModelField = s['T2IAdapterModelField']; export type ModelsList = s['ModelsList']; export type ControlField = s['ControlField']; export type IPAdapterField = s['IPAdapterField']; @@ -83,6 +84,9 @@ export type ControlNetModelConfig = | ControlNetModelDiffusersConfig; export type IPAdapterModelInvokeAIConfig = s['IPAdapterModelInvokeAIConfig']; export type IPAdapterModelConfig = IPAdapterModelInvokeAIConfig; +export type T2IAdapterModelDiffusersConfig = + s['T2IAdapterModelDiffusersConfig']; +export type T2IAdapterModelConfig = T2IAdapterModelDiffusersConfig; export type TextualInversionModelConfig = s['TextualInversionModelConfig']; export type DiffusersModelConfig = | s['StableDiffusion1ModelDiffusersConfig'] @@ -99,6 +103,7 @@ export type AnyModelConfig = | VaeModelConfig | ControlNetModelConfig | IPAdapterModelConfig + | T2IAdapterModelConfig | TextualInversionModelConfig | MainModelConfig | OnnxModelConfig; diff --git a/tests/app/__init__.py b/tests/app/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/app/util/__init__.py b/tests/app/util/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/app/util/test_controlnet_utils.py b/tests/app/util/test_controlnet_utils.py new file mode 100644 index 0000000000..21662cce8d --- /dev/null +++ b/tests/app/util/test_controlnet_utils.py @@ -0,0 +1,42 @@ +import numpy as np +import pytest +from PIL import Image + +from invokeai.app.util.controlnet_utils import prepare_control_image + + +@pytest.mark.parametrize("num_channels", [1, 2, 3]) +def test_prepare_control_image_num_channels(num_channels): + """Test that the `num_channels` parameter is applied correctly in prepare_control_image(...).""" + np_image = np.zeros((256, 256, 3), dtype=np.uint8) + pil_image = Image.fromarray(np_image) + + torch_image = prepare_control_image( + image=pil_image, + width=256, + height=256, + num_channels=num_channels, + device="cpu", + do_classifier_free_guidance=False, + ) + + assert torch_image.shape == (1, num_channels, 256, 256) + + +@pytest.mark.parametrize("num_channels", [0, 4]) +def test_prepare_control_image_num_channels_too_large(num_channels): + """Test that an exception is raised in prepare_control_image(...) if the `num_channels` parameter is out of the + supported range. + """ + np_image = np.zeros((256, 256, 3), dtype=np.uint8) + pil_image = Image.fromarray(np_image) + + with pytest.raises(ValueError): + _ = prepare_control_image( + image=pil_image, + width=256, + height=256, + num_channels=num_channels, + device="cpu", + do_classifier_free_guidance=False, + )